Add quick music crossfade and new axe icon - v1.6.5

This commit is contained in:
Michael Howard 2026-04-23 15:48:06 -05:00
parent 6f7fa0d69d
commit f71add61c4
6 changed files with 12 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -786,7 +786,9 @@ int main(void)
// Handle crossfading based on state // Handle crossfading based on state
static float crossfade = 0.0f; // 0.0 = title, 1.0 = gameplay static float crossfade = 0.0f; // 0.0 = title, 1.0 = gameplay
if (currentState == GAMEPLAY || currentState == PAUSE_MENU || currentState == CRAFTING_GUI) { bool inGame = (currentState == GAMEPLAY || currentState == PAUSE_MENU || currentState == CRAFTING_GUI || (currentState == OPTIONS_MENU && optionsReturnState != MAIN_MENU));
if (inGame) {
crossfade += 0.02f; crossfade += 0.02f;
if (crossfade > 1.0f) crossfade = 1.0f; if (crossfade > 1.0f) crossfade = 1.0f;
} else { } else {
@ -1093,8 +1095,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.6.4) in Red // Show Version Number (v1.6.5) in Red
DrawTextEx(customFont, "v1.6.4", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED); DrawTextEx(customFont, "v1.6.5", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED);
} }
Vector2 mousePos = GetMousePosition(); Vector2 mousePos = GetMousePosition();
@ -1533,9 +1535,14 @@ int main(void)
float dayFactor = (sinf(sunAngle) + 1.0f) / 2.0f; // 0 (night) to 1 (day) float dayFactor = (sinf(sunAngle) + 1.0f) / 2.0f; // 0 (night) to 1 (day)
// Rapid Music Crossfade Logic
float quickMix = (dayFactor - 0.5f) * 5.0f + 0.5f; // Steeper transition centered at 0.5
if (quickMix > 1.0f) quickMix = 1.0f;
if (quickMix < 0.0f) quickMix = 0.0f;
// Update Music Volumes based on time of day // Update Music Volumes based on time of day
SetMusicVolume(gameplayMusic, masterMusicVolume * crossfade * dayFactor); SetMusicVolume(gameplayMusic, masterMusicVolume * crossfade * quickMix);
SetMusicVolume(nightMusic, masterMusicVolume * crossfade * (1.0f - dayFactor)); SetMusicVolume(nightMusic, masterMusicVolume * crossfade * (1.0f - quickMix));
float lightLevel = 0.2f + 0.8f * dayFactor; // Ambient light multiplier float lightLevel = 0.2f + 0.8f * dayFactor; // Ambient light multiplier
Color blockTint = { (unsigned char)(255 * lightLevel), (unsigned char)(255 * lightLevel), (unsigned char)(255 * lightLevel), 255 }; Color blockTint = { (unsigned char)(255 * lightLevel), (unsigned char)(255 * lightLevel), (unsigned char)(255 * lightLevel), 255 };