diff --git a/src/d_main.c b/src/d_main.c index 270ad63e4..bc248fdb8 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -963,6 +963,9 @@ void D_StartTitle(void) //demosequence = -1; gametype = GT_RACE; // SRB2kart paused = false; + + S_ResetKeepAndSpecialMus(); // just in case + F_StartTitleScreen(); // Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade diff --git a/src/g_game.c b/src/g_game.c index d18ae4fc7..a245c8657 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1214,16 +1214,19 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (cv_director.value) CV_SetValue(&cv_director, 0); } - } // // G_DoLoadLevel // -void G_DoLoadLevel(boolean resetplayer) +static void G_DoLoadLevel(boolean resetplayer) { INT32 i; + // Saturn Music Feature stuffs + S_ResetKeepAndSpecialMus(); + S_CheckMap(); + // Make sure objectplace is OFF when you first start the level! OP_ResetObjectplace(); @@ -3963,7 +3966,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool else { LUA_HookInt(gamemap, HOOK(MapChange)); - S_CheckMap(); G_DoLoadLevel(resetplayer); } diff --git a/src/g_game.h b/src/g_game.h index 6e754f8bf..4b9002c3b 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -275,7 +275,6 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost); // A normal game starts at map 1, but a warp test can start elsewhere void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar, UINT8 ssplayers, boolean FLS); -void G_DoLoadLevel(boolean resetplayer); void G_LoadDemoInfo(menudemo_t *pdemo); void G_LoadDemoTitle(menudemo_t *pdemo); // For use in replay search feature diff --git a/src/k_kart.c b/src/k_kart.c index 7db6431c8..d1bc0d2d3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5459,7 +5459,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) // Plays the music during and after the starting countdown. if (P_IsLocalPlayer(player)) - S_StartMapMusic(false); + S_StartMapMusic(); } void K_KartPlayerAfterThink(player_t *player) diff --git a/src/p_user.c b/src/p_user.c index 188332d9c..a57db2f7f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -704,7 +704,7 @@ void P_RestoreMusic(player_t *player) return; if (leveltime < MUSICSTARTTIME) - S_StartMapMusic(true); + S_StartMapMusic(); else // see also where time overs are handled - search for "lives = 2" in this file { INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow diff --git a/src/s_sound.c b/src/s_sound.c index a0043da4b..d6b481512 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2004,6 +2004,11 @@ static const char *musicexception_list[17] = { "CHRSHF", "CHRSHP" // no clue what those are tbh }; +void S_ResetKeepAndSpecialMus(void) +{ + keepmusic = skipintromus = false; +} + //checks for any kind of event music like intermission, vote etc. //always runs when musicchange gets invoked static void S_CheckEventMus(const char *newmus) @@ -2020,9 +2025,9 @@ static void S_CheckEventMus(const char *newmus) break; } - //CONS_Printf("musname = %s\n", music_name); + //CONS_Printf("music_name = %s\n", music_name); //CONS_Printf("newmus = %s\n", newmus); - //CONS_Printf("newmus = %d\n", skipmusic); + //CONS_Printf("skipmusic = %d\n", skipmusic); } //this one compares map and encoremode instead of the music itself @@ -2037,6 +2042,8 @@ void S_CheckMap(void) keepmusic = (!skipmusic && gamestate == GS_LEVEL && oldmap == gamemap && oldencore == encoremode); + //CONS_Printf("keepmusic = %s\n", keepmusic); + oldencore = encoremode; oldmap = gamemap; } @@ -2083,13 +2090,13 @@ void S_InitMapMusic(void) //S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); } -void S_StartMapMusic(boolean restore) +void S_StartMapMusic(void) { //no need to constantly run this after race has started if (leveltime > MUSICSTARTTIME) return; - if (keepmusic && !restore) // make sure this doesent kill the music when its called from P_RestoreMusic in some cases + if (keepmusic) return; if (skipintromus) @@ -2124,6 +2131,8 @@ void S_RestartMusic(void) S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value); #endif + S_ResetKeepAndSpecialMus(); + if (Playing()) // Gotta make sure the player is in a level P_RestoreMusic(&players[consoleplayer]); else @@ -2228,6 +2237,8 @@ static void Command_RestartAudio_f(void) S_StartSound(NULL, sfx_strpst); + S_ResetKeepAndSpecialMus(); + if (Playing()) // Gotta make sure the player is in a level P_RestoreMusic(&players[consoleplayer]); else @@ -2305,6 +2316,8 @@ static void GameDigiMusic_OnChange(void) I_StartupSound(); // will return early if initialised I_InitMusic(); + S_ResetKeepAndSpecialMus(); + if (Playing()) P_RestoreMusic(&players[consoleplayer]); else @@ -2390,6 +2403,9 @@ static void GameMIDIMusic_OnChange(void) { midi_disabled = false; I_InitMusic(); + + S_ResetKeepAndSpecialMus(); + if (Playing()) P_RestoreMusic(&players[consoleplayer]); else diff --git a/src/s_sound.h b/src/s_sound.h index 2eeff8550..11cfbf8fd 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -109,8 +109,10 @@ void S_InitSfxChannels(INT32 sfxVolume); void S_StopSounds(void); void S_ClearSfx(void); +void S_ResetKeepAndSpecialMus(void); + void S_InitMapMusic(void); -void S_StartMapMusic(boolean restore); +void S_StartMapMusic(void); void S_CheckMap(void);