Add quick music crossfade and new axe icon - v1.6.5
This commit is contained in:
parent
6f7fa0d69d
commit
f71add61c4
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 |
17
src/main.cpp
17
src/main.cpp
|
|
@ -786,7 +786,9 @@ int main(void)
|
|||
|
||||
// Handle crossfading based on state
|
||||
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;
|
||||
if (crossfade > 1.0f) crossfade = 1.0f;
|
||||
} else {
|
||||
|
|
@ -1093,8 +1095,8 @@ int main(void)
|
|||
DrawTexturePro(titleTexture, sourceRec, destRec, origin, 0.0f, WHITE);
|
||||
EndMode2D();
|
||||
|
||||
// Show Version Number (v1.6.4) in Red
|
||||
DrawTextEx(customFont, "v1.6.4", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED);
|
||||
// Show Version Number (v1.6.5) in Red
|
||||
DrawTextEx(customFont, "v1.6.5", (Vector2){ (float)currentWidth - 140, (float)currentHeight - 40 }, 22, 1.0f, RED);
|
||||
}
|
||||
|
||||
Vector2 mousePos = GetMousePosition();
|
||||
|
|
@ -1533,9 +1535,14 @@ int main(void)
|
|||
|
||||
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
|
||||
SetMusicVolume(gameplayMusic, masterMusicVolume * crossfade * dayFactor);
|
||||
SetMusicVolume(nightMusic, masterMusicVolume * crossfade * (1.0f - dayFactor));
|
||||
SetMusicVolume(gameplayMusic, masterMusicVolume * crossfade * quickMix);
|
||||
SetMusicVolume(nightMusic, masterMusicVolume * crossfade * (1.0f - quickMix));
|
||||
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 };
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue