level_nosync only temporarily resists batch operations

It's supposed to resist Music_StopAll so it doesn't get
reset when the level changes. But only do this for one
turn, so level music does not have the potential to leak
into other contexts.
This commit is contained in:
James R 2023-12-05 04:16:43 -08:00
parent 806067f48f
commit 8546643b0c
2 changed files with 5 additions and 7 deletions

View file

@ -39,7 +39,6 @@ void Music_Init(void)
Tune& tune = g_tunes.insert("level_nosync", g_tunes.find("level"));
tune.sync = false;
tune.resist = true;
}
{

View file

@ -8112,20 +8112,19 @@ void P_LoadLevelMusic(void)
{
const char *music = mapheaderinfo[gamemap-1]->musname[mapmusrng];
Music_StopAll();
if (gametyperules & GTR_NOPOSITION)
{
if (stricmp(Music_Song("level_nosync"), music))
if (!stricmp(Music_Song("level_nosync"), music))
{
Music_Stop("level_nosync"); // reset when music changes
// Do not reset music if it is the same
Music_BatchExempt("level_nosync");
}
Music_StopAll();
Music_Remap("level_nosync", music);
}
else
{
Music_Stop("level_nosync");
Music_Remap("level_nosync", ""); // signal that this should not play
Music_StopAll();
Music_Remap("level", music);
tic_t level_music_start = starttime + (TICRATE/2);