try fix keepmusic occasionally not working

idk but sometimes DoReborn broke it?
also this ensures keepmusic and skipintromus flags always get reset
This commit is contained in:
Alug committed 2024-12-05 07:58:11 +01:00
1 parent 88aafd9df2
commit 2bed437313
7 files changed
+33 -11

No files matched your search

+3
View File
@@ -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
+5 -3
View File
@@ -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);
}
-1
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+20 -4
View File
@@ -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
+3 -1
View File
@@ -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);