Finalize music and update logic - v1.9.1

This commit is contained in:
Michael Howard 2026-04-23 16:48:28 -05:00
parent 73d289be97
commit c599fd1fef
3 changed files with 10 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View File

@ -676,7 +676,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 v1.9.0"); InitWindow(screenWidth, screenHeight, "MorriCraft v1.9.1");
LoadConfig(); LoadConfig();
SetExitKey(KEY_NULL); // Prevent ESC from closing the window SetExitKey(KEY_NULL); // Prevent ESC from closing the window
@ -857,7 +857,9 @@ int main(void)
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Update ONLY active music streams and ensure others are fully stopped // Update ONLY active music streams and ensure others are fully stopped
if (currentState == MAIN_MENU || currentState == LOAD_WORLD_MENU || currentState == CREATE_WORLD_MENU) { if (currentState == MAIN_MENU || currentState == LOAD_WORLD_MENU || currentState == CREATE_WORLD_MENU ||
currentState == CHECKING_UPDATES || currentState == UPDATE_FOUND || currentState == UPDATE_NOTES ||
currentState == DOWNLOADING_UPDATE) {
UpdateMusicStream(titleMusic); UpdateMusicStream(titleMusic);
if (IsMusicStreamPlaying(gameplayMusic)) StopMusicStream(gameplayMusic); if (IsMusicStreamPlaying(gameplayMusic)) StopMusicStream(gameplayMusic);
if (IsMusicStreamPlaying(nightMusic)) StopMusicStream(nightMusic); if (IsMusicStreamPlaying(nightMusic)) StopMusicStream(nightMusic);
@ -891,7 +893,6 @@ int main(void)
if (crossfade < 0.0f) crossfade = 0.0f; if (crossfade < 0.0f) crossfade = 0.0f;
} }
SetMusicVolume(titleMusic, titleLoopFade * masterMusicVolume * (1.0f - crossfade));
// --- GLOBAL TIME & AUDIO MANAGEMENT --- // --- GLOBAL TIME & AUDIO MANAGEMENT ---
float cycleLength = 300.0f; float cycleLength = 300.0f;
@ -1202,8 +1203,9 @@ int main(void)
// Simulate check (2 seconds) // Simulate check (2 seconds)
if (updateTimer > 2.0f) { if (updateTimer > 2.0f) {
// For demo purposes, we'll say an update is available on the first run after 1.8.0 // Update check logic: Only show if remote version > local version
updateReady = true; // For now, we are at v1.9.1, so we set to false.
updateReady = false;
if (updateReady) currentState = UPDATE_FOUND; if (updateReady) currentState = UPDATE_FOUND;
else currentState = MAIN_MENU; else currentState = MAIN_MENU;
} }
@ -1258,8 +1260,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 (v1.9.0) in Red // Show Version Number (v1.9.1) in Red
DrawTextEx(customFont, "v1.9.0", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED); DrawTextEx(customFont, "v1.9.1", (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 == "") {