Music (Game Tunes + First-Hit Trigger)¶
This note documents the original game's "iconic" Survival music behavior: menu music mutes/fades on mode entry, and a random in-game tune starts on the first projectile hit on a creature (the impact SFX is suppressed for that hit).
Game tune loading (playlist)¶
-
audio_init_music(0x0043c9c0) loads core tracks and runsexec music\\game_tunes.txtduring startup. -
console_cmd_snd_add_game_tune(0x0042c360) handlessnd_addGameTuneby loadingmusic\\<name>.oggand callingmusic_queue_track(0x0043c960), which appends the loaded track id intomusic_playlist[]and increments the countDAT_004cc8d0.
"First hit starts the tune" gate¶
-
audio_init_musicdefines a sentinel idmusic_track_extra_0 = music_track_crimsonquest_id + 1. -
sfx_play_exclusive(0x0043d460) treatsmusic_track_extra_0specially: when called with the sentinel and the gateDAT_004cc8d4 == 0, it picks a random id frommusic_playlist[], setsDAT_004cc8d4 = 1, and starts playback exclusively. -
projectile_update(0x00420b90) uses this gate: on the first creature impact (bullet/explosion path), ifdemo_mode_active == 0,DAT_004cc8d4 == 0andgame_mode != 2(rush), it callssfx_play_exclusive(music_track_extra_0)instead of playing the normal impact sound. -
sfx_mute_all(0x0043d550) resets the gate (DAT_004cc8d4 = 0), allowing the first-hit trigger to happen again next round.
Menu -> gameplay transition¶
Mode entry paths mute menu music before entering gameplay. For example, the
victory screen handler game_update_victory_screen (0x00406350) mutes:
music_track_crimson_theme_id, music_track_shortie_monk_id, and
music_track_extra_0 when starting Survival/Rush/Typ-o, immediately cutting the
menu theme (fade out) and resetting the first-hit gate.
Port behavior (this repo)¶
For Survival we mirror the original behavior:
- Entering Survival mutes (fades out) the menu theme.
- The first projectile hit starts a random queued game tune and suppresses the impact SFX for that hit.
- Leaving Survival mutes (fades out) the game tune; the menu theme resumes when the menu opens.