fp: Add initial impl of fade in and out wave music
This commit is contained in:
parent
b03c6c3e56
commit
93e5302c60
2
External/tely
vendored
2
External/tely
vendored
@ -1 +1 @@
|
||||
Subproject commit 9f8b905eab0c7a60084790f340488d858821adcc
|
||||
Subproject commit d3b03b99ebeefe19097e07f0a04e4c614175a526
|
@ -2015,16 +2015,18 @@ static void FP_Update(TELY_OS *os, FP_Game *game, TELY_OSInput *input, TELY_Audi
|
||||
// haven't given the player cooldown yet, so we assign a timestamp for that
|
||||
if (game->play.wave_cooldown_timestamp_ms == 0) {
|
||||
game->play.wave_cooldown_timestamp_ms = game->play.clock_ms + FP_COOLDOWN_WAVE_TIME_MS;
|
||||
TELY_Audio_Stop(audio, game->audio[FP_GameAudio_Music1]);
|
||||
TELY_Audio_Fade(audio, game->audio[FP_GameAudio_Music1], TELY_AudioEffectFade_Out, 2000 /*fade_duration_ms*/);
|
||||
TELY_Audio_Play(audio, game->audio[FP_GameAudio_Music2], 1.f);
|
||||
TELY_Audio_Fade(audio, game->audio[FP_GameAudio_Music2], TELY_AudioEffectFade_In, 2000 /*fade_duration_ms*/);
|
||||
} else {
|
||||
// NOTE: Check if cooldown has elapsed, the next wave can start if so
|
||||
if (game->play.clock_ms > game->play.wave_cooldown_timestamp_ms) {
|
||||
game->play.enemies_per_wave = DQN_MAX(5 * DQN_CAST(uint32_t)game->play.mob_spawners.size, DQN_CAST(uint32_t)(game->play.enemies_per_wave * 1.5));
|
||||
game->play.enemies_spawned_this_wave = 0; // Important! Reset the spawn count
|
||||
game->play.wave_cooldown_timestamp_ms = 0; // Important! We reset the timestamp for the next wave
|
||||
TELY_Audio_Stop(audio, game->audio[FP_GameAudio_Music2]);
|
||||
TELY_Audio_Fade(audio, game->audio[FP_GameAudio_Music2], TELY_AudioEffectFade_Out, 2000 /*fade_duration_ms*/);
|
||||
TELY_Audio_Play(audio, game->audio[FP_GameAudio_Music1], 1.f);
|
||||
TELY_Audio_Fade(audio, game->audio[FP_GameAudio_Music1], TELY_AudioEffectFade_In, 2000 /*fade_duration_ms*/);
|
||||
|
||||
if (monkey_spawn && game->play.current_wave != 0) {
|
||||
// NOTE: We spawn a monkey at these wave intervals;
|
||||
|
Loading…
Reference in New Issue
Block a user