Fix volume scope and finalize v2.0.5
This commit is contained in:
parent
70b417b87c
commit
69ba3372f6
Binary file not shown.
Binary file not shown.
21
src/main.cpp
21
src/main.cpp
|
|
@ -85,6 +85,8 @@ static unsigned int globalSeedHash = 0;
|
||||||
static std::string currentWorldName = "";
|
static std::string currentWorldName = "";
|
||||||
static std::string playerName = "Player";
|
static std::string playerName = "Player";
|
||||||
static bool serverMode = false;
|
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 };
|
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");
|
std::ofstream file("config.cfg");
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
file << "playerName=" << playerName << "\n";
|
file << "playerName=" << playerName << "\n";
|
||||||
file << "serverMode=" << (serverMode ? "true" : "false") << "\n";
|
file << "music=" << masterMusicVolume << "\n";
|
||||||
|
file << "sound=" << masterSoundVolume << "\n";
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -334,12 +337,13 @@ void LoadConfig() {
|
||||||
std::string key = line.substr(0, sep);
|
std::string key = line.substr(0, sep);
|
||||||
std::string val = line.substr(sep + 1);
|
std::string val = line.substr(sep + 1);
|
||||||
if (key == "playerName") playerName = val;
|
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();
|
file.close();
|
||||||
} else {
|
} 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.
|
// By default, windows have minimize, maximize, and close buttons on the top bar.
|
||||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT);
|
SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT);
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "MorriCraft v2.0.4");
|
InitWindow(screenWidth, screenHeight, "MorriCraft v2.0.5");
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
SetExitKey(KEY_NULL); // Prevent ESC from closing the window
|
SetExitKey(KEY_NULL); // Prevent ESC from closing the window
|
||||||
|
|
||||||
|
|
@ -830,9 +834,6 @@ int main(void)
|
||||||
float targetZoom = 1.1f;
|
float targetZoom = 1.1f;
|
||||||
float currentZoom = 1.1f;
|
float currentZoom = 1.1f;
|
||||||
|
|
||||||
float masterMusicVolume = 1.0f;
|
|
||||||
float masterSoundVolume = 1.0f;
|
|
||||||
|
|
||||||
char worldName[64] = "New World";
|
char worldName[64] = "New World";
|
||||||
int worldNameLen = 9;
|
int worldNameLen = 9;
|
||||||
char worldSeed[64] = "";
|
char worldSeed[64] = "";
|
||||||
|
|
@ -1269,7 +1270,7 @@ int main(void)
|
||||||
if (scroll < 0.0f) activeHotbarSlot = (activeHotbarSlot + 1) % 9;
|
if (scroll < 0.0f) activeHotbarSlot = (activeHotbarSlot + 1) % 9;
|
||||||
|
|
||||||
// Toggle inventory
|
// Toggle inventory
|
||||||
if (IsKeyPressed(KEY_E)) {
|
if (IsKeyPressed(KEY_E) && !isChatting) {
|
||||||
inventoryOpen = !inventoryOpen;
|
inventoryOpen = !inventoryOpen;
|
||||||
if (inventoryOpen) EnableCursor();
|
if (inventoryOpen) EnableCursor();
|
||||||
else DisableCursor();
|
else DisableCursor();
|
||||||
|
|
@ -1726,8 +1727,8 @@ int main(void)
|
||||||
DrawTexturePro(titleTexture, sourceRec, destRec, origin, 0.0f, WHITE);
|
DrawTexturePro(titleTexture, sourceRec, destRec, origin, 0.0f, WHITE);
|
||||||
EndMode2D();
|
EndMode2D();
|
||||||
|
|
||||||
// Show Version Number (v2.0.4) in Red
|
// Show Version Number (v2.0.5) in Red
|
||||||
DrawTextEx(customFont, "v2.0.4", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED);
|
DrawTextEx(customFont, "v2.0.5", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED);
|
||||||
|
|
||||||
// --- PLAYER NAME POPUP (IF MISSING) ---
|
// --- PLAYER NAME POPUP (IF MISSING) ---
|
||||||
if (playerName == "") {
|
if (playerName == "") {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue