diff --git a/build-linux/MorriCraft b/build-linux/MorriCraft index 6c6ee72..1fb781f 100755 Binary files a/build-linux/MorriCraft and b/build-linux/MorriCraft differ diff --git a/build-windows/MorriCraft.exe b/build-windows/MorriCraft.exe index 2cc28f1..c8dacc2 100755 Binary files a/build-windows/MorriCraft.exe and b/build-windows/MorriCraft.exe differ diff --git a/src/main.cpp b/src/main.cpp index 9081131..115296d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,6 +85,8 @@ static unsigned int globalSeedHash = 0; static std::string currentWorldName = ""; static std::string playerName = "Player"; static bool serverMode = false; +static float masterMusicVolume = 1.0f; +static float masterSoundVolume = 1.0f; enum MenuState { MAIN_MENU, OPTIONS_MENU, CREATE_WORLD_MENU, LOAD_WORLD_MENU, GAMEPLAY, PAUSE_MENU, CRAFTING_GUI, CHECKING_UPDATES, UPDATE_NOTES, UPDATE_FOUND, DOWNLOADING_UPDATE, CONNECT_MENU }; @@ -319,7 +321,8 @@ void SaveConfig() { std::ofstream file("config.cfg"); if (file.is_open()) { file << "playerName=" << playerName << "\n"; - file << "serverMode=" << (serverMode ? "true" : "false") << "\n"; + file << "music=" << masterMusicVolume << "\n"; + file << "sound=" << masterSoundVolume << "\n"; file.close(); } } @@ -334,12 +337,13 @@ void LoadConfig() { std::string key = line.substr(0, sep); std::string val = line.substr(sep + 1); if (key == "playerName") playerName = val; - else if (key == "serverMode") serverMode = (val == "true"); + else if (key == "music") masterMusicVolume = std::stof(val); + else if (key == "sound") masterSoundVolume = std::stof(val); } } file.close(); } else { - playerName = ""; // Trigger popup + playerName = ""; // Trigger name entry popup } } @@ -750,7 +754,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.0.4"); + InitWindow(screenWidth, screenHeight, "MorriCraft v2.0.5"); LoadConfig(); SetExitKey(KEY_NULL); // Prevent ESC from closing the window @@ -830,9 +834,6 @@ int main(void) float targetZoom = 1.1f; float currentZoom = 1.1f; - float masterMusicVolume = 1.0f; - float masterSoundVolume = 1.0f; - char worldName[64] = "New World"; int worldNameLen = 9; char worldSeed[64] = ""; @@ -1269,7 +1270,7 @@ int main(void) if (scroll < 0.0f) activeHotbarSlot = (activeHotbarSlot + 1) % 9; // Toggle inventory - if (IsKeyPressed(KEY_E)) { + if (IsKeyPressed(KEY_E) && !isChatting) { inventoryOpen = !inventoryOpen; if (inventoryOpen) EnableCursor(); else DisableCursor(); @@ -1726,8 +1727,8 @@ int main(void) DrawTexturePro(titleTexture, sourceRec, destRec, origin, 0.0f, WHITE); EndMode2D(); - // Show Version Number (v2.0.4) in Red - DrawTextEx(customFont, "v2.0.4", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED); + // Show Version Number (v2.0.5) in Red + DrawTextEx(customFont, "v2.0.5", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED); // --- PLAYER NAME POPUP (IF MISSING) --- if (playerName == "") {