Compare commits

...

2 Commits

Author SHA1 Message Date
2d685fcdb9 Submodule changes 2023-11-14 08:59:28 +11:00
ebc969603d tely: Add a way to stop music from playing 2023-11-14 08:44:10 +11:00
4 changed files with 12 additions and 2 deletions

BIN
Data/Audio/music_2.ogg (Stored with Git LFS) Normal file

Binary file not shown.

2
External/tely vendored

@ -1 +1 @@
Subproject commit 07b3737cf4e5e68be355630228375c5b5873513f Subproject commit 4a4c88a9f012af5fe6e9337505b47b202c4ba50e

View File

@ -454,6 +454,7 @@ void TELY_OS_DLLInit(TELY_OS *os)
game->audio[FP_GameAudio_Ambience1] = os->funcs.load_audio(assets, DQN_STR8("Ambience one"), DQN_STR8("Data/Audio/ambience_1.ogg")); game->audio[FP_GameAudio_Ambience1] = os->funcs.load_audio(assets, DQN_STR8("Ambience one"), DQN_STR8("Data/Audio/ambience_1.ogg"));
game->audio[FP_GameAudio_Ambience2] = os->funcs.load_audio(assets, DQN_STR8("Ambience two"), DQN_STR8("Data/Audio/ambience_2.ogg")); game->audio[FP_GameAudio_Ambience2] = os->funcs.load_audio(assets, DQN_STR8("Ambience two"), DQN_STR8("Data/Audio/ambience_2.ogg"));
game->audio[FP_GameAudio_Music1] = os->funcs.load_audio(assets, DQN_STR8("Music one"), DQN_STR8("Data/Audio/music_1.ogg")); game->audio[FP_GameAudio_Music1] = os->funcs.load_audio(assets, DQN_STR8("Music one"), DQN_STR8("Data/Audio/music_1.ogg"));
game->audio[FP_GameAudio_Music2] = os->funcs.load_audio(assets, DQN_STR8("Music two"), DQN_STR8("Data/Audio/music_2.ogg"));
// NOTE: Load sprite sheets ==================================================================== // NOTE: Load sprite sheets ====================================================================
os->user_data = game; os->user_data = game;
@ -2014,12 +2015,16 @@ 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 // haven't given the player cooldown yet, so we assign a timestamp for that
if (game->play.wave_cooldown_timestamp_ms == 0) { if (game->play.wave_cooldown_timestamp_ms == 0) {
game->play.wave_cooldown_timestamp_ms = game->play.clock_ms + FP_COOLDOWN_WAVE_TIME_MS; 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_Play(audio, game->audio[FP_GameAudio_Music2], 1.f);
} else { } else {
// NOTE: Check if cooldown has elapsed, the next wave can start if so // NOTE: Check if cooldown has elapsed, the next wave can start if so
if (game->play.clock_ms > game->play.wave_cooldown_timestamp_ms) { 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_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.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 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_Play(audio, game->audio[FP_GameAudio_Music1], 1.f);
if (monkey_spawn && game->play.current_wave != 0) { if (monkey_spawn && game->play.current_wave != 0) {
// NOTE: We spawn a monkey at these wave intervals; // NOTE: We spawn a monkey at these wave intervals;
@ -2036,6 +2041,7 @@ static void FP_Update(TELY_OS *os, FP_Game *game, TELY_OSInput *input, TELY_Audi
} }
game->play.current_wave++; game->play.current_wave++;
//TELY_Audio_Stop(audio, game->audio[FP_GameAudio_Music2]);
} }
} }
@ -4457,7 +4463,7 @@ void TELY_OS_DLLFrameUpdate(TELY_OS *os)
#if 1 #if 1
if (audio->playback_size == 0) { if (audio->playback_size == 0) {
TELY_Audio_Play(audio, game->audio[FP_GameAudio_Ambience2], 1.f /*volume*/); //TELY_Audio_Play(audio, game->audio[FP_GameAudio_Music2], 1.f /*volume*/);
} }
#endif #endif

View File

@ -339,6 +339,7 @@ enum FP_GameAudio
FP_GameAudio_Ambience1, FP_GameAudio_Ambience1,
FP_GameAudio_Ambience2, FP_GameAudio_Ambience2,
FP_GameAudio_Music1, FP_GameAudio_Music1,
FP_GameAudio_Music2,
FP_GameAudio_Count, FP_GameAudio_Count,
}; };