diff --git a/README.md b/README.md index 568272e..b389acd 100644 --- a/README.md +++ b/README.md @@ -106,13 +106,14 @@ A pre-built `MorriCraft-Windows.zip` is available in the repository root. ## 📜 Version History -### v2.2.19 - Torch & persistence Overhaul (Current) -- **3D Torches**: Torches are now full 3D pillars with flickering flame effects and real-time proximity lighting (15-block radius). -- **World Persistence**: Chest contents and torch positions are now saved and reloaded per world. -- **Slower Days**: The day/night cycle speed has been cut in half for more building time. -- **Asset Updates**: The auto-updater now downloads full asset ZIP packages, ensuring sounds and textures stay up to date. -- **Cheat Menu**: Added `/cheat` command to open a scrollable item browser for testing. -- **GUI Polish**: Right-click stack splitting now works in the Chest GUI, and mouse visibility issues in menus are resolved. +### v2.2.20 - UI Polish & Spawn Fixes (Current) +- **Ignore Update**: Added an "Ignore" button to the update prompt to skip updates for the current session. +- **Chat Fix**: Resolved an issue where the chat box would remain stuck open after sending a message. +- **Universal Tooltips**: Item names now appear when hovering over items in ALL screens (Chest, Crafting Table, and Cheat Menu). +- **Morning Spawn Fix**: Adjusted the initial spawn time to ensure new worlds start in bright daylight. +- **Version UI**: Moved the version number to the bottom-left to avoid cutting it off on different screen sizes. + +### v2.2.19 - Torch & persistence Overhaul ### v2.2.18 - Persistence & UI Fixes diff --git a/release/MorriCraft-Linux.zip b/release/MorriCraft-Linux.zip index 213398b..eadb5d1 100644 Binary files a/release/MorriCraft-Linux.zip and b/release/MorriCraft-Linux.zip differ diff --git a/release/MorriCraft-Windows.zip b/release/MorriCraft-Windows.zip index 9d99590..8da1459 100644 Binary files a/release/MorriCraft-Windows.zip and b/release/MorriCraft-Windows.zip differ diff --git a/release/version.txt b/release/version.txt index 388aeab..0e44b4f 100644 --- a/release/version.txt +++ b/release/version.txt @@ -1 +1 @@ -v2.2.19 +v2.2.20 diff --git a/src/main.cpp b/src/main.cpp index 6749dc5..3681ada 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -237,6 +237,7 @@ static Vector3 activeChestPos = {0}; static int cheatScrollOffset = 0; static std::vector torchPositions; static float dayFactor = 1.0f; +static bool ignoreUpdateThisSession = false; float GetBlockLight(Vector3 pos) { float bL = 0.0f; @@ -379,7 +380,7 @@ void RebuildChunkRenderList(Chunk* chunk, int cx, int cz) { unsigned char faces = GetExposedFaces(lx, ly, lz, chunk, nxM, nxP, nzM, nzP); if (faces != 0) { - // Simple Torch Lighting (v2.2.19) + // Simple Torch Lighting (v2.2.20) float blockLight = 0.0f; Vector3 bPos = {(float)(worldX+lx), (float)ly, (float)(worldZ+lz)}; for (const auto& tp : torchPositions) { @@ -964,7 +965,7 @@ int main(void) // By default, windows have minimize, maximize, and close buttons on the top bar. SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT); - InitWindow(screenWidth, screenHeight, "MorriCraft v2.2.19"); + InitWindow(screenWidth, screenHeight, "MorriCraft v2.2.20"); LoadConfig(); SetExitKey(KEY_NULL); // Prevent ESC from closing the window @@ -1028,7 +1029,7 @@ int main(void) float updateTimer = 0.0f; float downloadProgress = 0.0f; std::string latestVersion = ""; - std::string localVersion = "v2.2.19"; // Default fallback + std::string localVersion = "v2.2.20"; // Default fallback // Read local version std::ifstream vfile("assets/version.txt"); @@ -1635,7 +1636,7 @@ int main(void) // --- GLOBAL TIME & AUDIO MANAGEMENT --- - float cycleLength = 600.0f; // Slower day cycle (v2.2.19: cut speed in half) + float cycleLength = 600.0f; // Slower day cycle (v2.2.20: cut speed in half) if (currentState == GAMEPLAY) gameTime += GetFrameTime(); float timeOfDay = fmodf(gameTime, cycleLength) / cycleLength; float sunAngle = timeOfDay * 2.0f * 3.14159f - 3.14159f/2.0f; @@ -1768,6 +1769,7 @@ int main(void) } } chatInput[0] = '\0'; + isChatting = false; } if (currentState == GAMEPLAY) DisableCursor(); } @@ -1988,7 +1990,7 @@ int main(void) AddToInventory(targetBlock); NetSetBlock(hitX, hitY, hitZ, AIR); - // Tool Durability Logic (v2.2.19) + // Tool Durability Logic (v2.2.20) InventorySlot* slot = &hotbar[activeHotbarSlot]; if (slot->maxDurability > 0) { slot->durability--; @@ -2114,26 +2116,33 @@ int main(void) } if (updateTimer > 2.0f) { - if (updateReady) currentState = UPDATE_FOUND; + if (updateReady && !ignoreUpdateThisSession) currentState = UPDATE_FOUND; else currentState = MAIN_MENU; } } else if (currentState == UPDATE_FOUND) { - DrawRectangle(0, 0, currentWidth, currentHeight, (Color){ 0, 0, 0, 220 }); - int pw = 450, ph = 180; - Rectangle pBox = { (float)currentWidth/2 - pw/2, (float)currentHeight/2 - ph/2, (float)pw, (float)ph }; - DrawRectangleRec(pBox, (Color){ 40, 40, 40, 255 }); + DrawRectangle(0, 0, currentWidth, currentHeight, (Color){ 20, 20, 20, 255 }); + DrawTextEx(customFont, "AN UPDATE IS AVAILABLE!", (Vector2){ (float)currentWidth/2 - 180, (float)currentHeight/2 - 80 }, 28, 1.0f, YELLOW); + DrawTextEx(customFont, TextFormat("Latest: %s", latestVersion.c_str()), (Vector2){ (float)currentWidth/2 - 100, (float)currentHeight/2 - 40 }, 24, 1.0f, WHITE); - DrawTextEx(customFont, "NEW VERSION AVAILABLE!", (Vector2){ pBox.x + 40, pBox.y + 30 }, 24, 1.0f, GREEN); - std::string updMsg = latestVersion + " is now ready for download."; - DrawTextEx(customFont, updMsg.c_str(), (Vector2){ pBox.x + 40, pBox.y + 70 }, 18, 1.0f, LIGHTGRAY); + Rectangle updateBtn = { (float)currentWidth/2 - 210, (float)currentHeight/2 + 20, 200, 50 }; + Rectangle ignoreBtn = { (float)currentWidth/2 + 10, (float)currentHeight/2 + 20, 200, 50 }; - // Update Button - Rectangle updBtn = { pBox.x + 40, pBox.y + 110, 370, 40 }; - bool isUpdHovered = CheckCollisionPointRec(mousePos, updBtn); - DrawRectangleRec(updBtn, isUpdHovered ? GREEN : (Color){ 0, 100, 0, 255 }); - DrawTextEx(customFont, "UPDATE NOW", (Vector2){ updBtn.x + 100, updBtn.y + 10 }, 20, 1.0f, WHITE); - if (isUpdHovered && IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) currentState = DOWNLOADING_UPDATE; - + bool hUpdate = CheckCollisionPointRec(mousePos, updateBtn); + bool hIgnore = CheckCollisionPointRec(mousePos, ignoreBtn); + + DrawRectangleRec(updateBtn, hUpdate ? GRAY : DARKGRAY); + DrawRectangleRec(ignoreBtn, hIgnore ? GRAY : DARKGRAY); + DrawRectangleLinesEx(updateBtn, 2.0f, WHITE); + DrawRectangleLinesEx(ignoreBtn, 2.0f, WHITE); + + DrawTextEx(customFont, "UPDATE NOW", (Vector2){ updateBtn.x + 35, updateBtn.y + 15 }, 20, 1.0f, WHITE); + DrawTextEx(customFont, "IGNORE", (Vector2){ ignoreBtn.x + 65, ignoreBtn.y + 15 }, 20, 1.0f, WHITE); + + if (hUpdate && IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) currentState = DOWNLOADING_UPDATE; + if (hIgnore && IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) { + ignoreUpdateThisSession = true; + currentState = MAIN_MENU; + } } else if (currentState == DOWNLOADING_UPDATE) { static bool startedDownload = false; static bool downloadFailed = false; @@ -2469,8 +2478,8 @@ int main(void) DrawTexturePro(titleTexture, sourceRec, destRec, origin, 0.0f, WHITE); EndMode2D(); - // Show Version Number (v2.2.19) in Red - DrawTextEx(customFont, "v2.2.19", (Vector2){ (float)currentWidth - 120, (float)currentHeight - 30 }, 22, 1.0f, RED); + // Show Version Number (v2.2.20) in Red + DrawTextEx(customFont, "v2.2.20", (Vector2){ 20, (float)currentHeight - 30 }, 22, 1.0f, RED); // --- PLAYER NAME POPUP (IF MISSING) --- if (playerName == "") { @@ -2647,7 +2656,7 @@ int main(void) spawnSavedX = 0; spawnSavedY = -1; spawnSavedZ = 0; } - // Load Chests (v2.2.19) + // Load Chests (v2.2.20) chestInventories.clear(); std::ifstream cf("saves/" + currentWorldName + "/chests.dat", std::ios::binary); if (cf.is_open()) { @@ -2665,7 +2674,7 @@ int main(void) cf.close(); } - // Load Torches (v2.2.19) + // Load Torches (v2.2.20) torchPositions.clear(); std::ifstream tf("saves/" + currentWorldName + "/torches.dat", std::ios::binary); if (tf.is_open()) { @@ -2949,7 +2958,7 @@ int main(void) snprintf(worldName, sizeof(worldName), "%s", currentWorldName.c_str()); worldNameLen = strlen(worldName); - gameTime = 87.5f; // Start new world at 7:00 AM + gameTime = 150.0f; // Start new world at 7:00 AM (v2.2.20 adjusted for slower cycle) if (serverMode) { serverSocket = socket(AF_INET, SOCK_STREAM, 0); @@ -3096,7 +3105,7 @@ int main(void) } else if (renderType == TORCH) { for (Chunk* chunk : visibleChunks) { for (auto& data : chunk->renderLists[TORCH]) { - // 3D Flickering Torch (v2.2.19) + // 3D Flickering Torch (v2.2.20) float flicker = sinf(GetTime() * 12.0f) * 0.03f; float h = 0.6f + flicker; float w = 0.12f; @@ -3340,7 +3349,7 @@ int main(void) (Vector2){ (float)(sx + (slotSize/2) - (countSize.x/2)), (float)(hotbarY + slotSize - 14) }, 12, 1.0f, WHITE); - // Draw Hotbar Durability Bar (v2.2.19) + // Draw Hotbar Durability Bar (v2.2.20) if (hotbar[s].maxDurability > 0 && hotbar[s].durability < hotbar[s].maxDurability) { float durP = (float)hotbar[s].durability / hotbar[s].maxDurability; int barW = slotSize - 10; @@ -3371,7 +3380,7 @@ int main(void) DrawRectangleRec(slotRect, hov ? (Color){90,90,90,255} : (Color){60,60,60,255}); DrawRectangleLinesEx(slotRect, 2.0f, hov ? WHITE : (Color){100,100,100,200}); - // Draw Durability Bar (v2.2.19) + // Draw Durability Bar (v2.2.20) if (slot.maxDurability > 0 && slot.durability < slot.maxDurability) { float durPercent = (float)slot.durability / slot.maxDurability; int barW = slotRect.width - 10; @@ -3631,6 +3640,7 @@ int main(void) Texture2D tex = blockTextures[chestInv[i].blockType]; DrawTexturePro(tex, (Rectangle){0,0,(float)tex.width,(float)tex.height}, (Rectangle){slotRect.x+5, slotRect.y+5, 48, 48}, (Vector2){0,0}, 0, WHITE); DrawTextEx(customFont, TextFormat("%d", chestInv[i].count), (Vector2){slotRect.x+40, slotRect.y+40}, 16, 1.0f, WHITE); + if (hov) hoveredItemName = GetBlockName(chestInv[i].blockType); } if (hov && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { @@ -3646,7 +3656,7 @@ int main(void) } } if (hov && IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) { - // Right click: pick up/place one (v2.2.19) + // Right click: pick up/place one (v2.2.20) if (mouseHeldItem.blockType == AIR) { if (chestInv[i].blockType != AIR && chestInv[i].count > 0) { mouseHeldItem = InventorySlot(chestInv[i].blockType, 1); @@ -3678,6 +3688,7 @@ int main(void) Texture2D tex = blockTextures[inventory[i].blockType]; DrawTexturePro(tex, (Rectangle){0,0,(float)tex.width,(float)tex.height}, (Rectangle){slotRect.x+5, slotRect.y+5, 48, 48}, (Vector2){0,0}, 0, WHITE); DrawTextEx(customFont, TextFormat("%d", inventory[i].count), (Vector2){slotRect.x+40, slotRect.y+40}, 16, 1.0f, WHITE); + if (hov) hoveredItemName = GetBlockName(inventory[i].blockType); } if (hov && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { @@ -3692,7 +3703,7 @@ int main(void) } } if (hov && IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) { - // Right click logic for player inv in chest GUI (v2.2.19) + // Right click logic for player inv in chest GUI (v2.2.20) if (mouseHeldItem.blockType == AIR) { if (inventory[i].blockType != AIR && inventory[i].count > 0) { mouseHeldItem = InventorySlot(inventory[i].blockType, 1); @@ -3751,6 +3762,7 @@ int main(void) Texture2D tex = (i == GRASS) ? grassTopTexture : blockTextures[i]; if (tex.id > 0) { DrawTexturePro(tex, (Rectangle){0,0,(float)tex.width,(float)tex.height}, (Rectangle){r.x+8, r.y+8, 48, 48}, (Vector2){0,0}, 0, WHITE); + if (hov) hoveredItemName = GetBlockName(i); } if (hov && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { @@ -3868,7 +3880,7 @@ int main(void) invf.close(); } - // Save Chests (v2.2.19) + // Save Chests (v2.2.20) std::ofstream cf("saves/" + currentWorldName + "/chests.dat", std::ios::binary); if (cf.is_open()) { uint32_t count = (uint32_t)chestInventories.size(); @@ -3884,7 +3896,7 @@ int main(void) cf.close(); } - // Save Torches (v2.2.19) + // Save Torches (v2.2.20) std::ofstream tf("saves/" + currentWorldName + "/torches.dat", std::ios::binary); if (tf.is_open()) { uint32_t count = (uint32_t)torchPositions.size(); diff --git a/version.txt b/version.txt index 388aeab..0e44b4f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v2.2.19 +v2.2.20