P_ResetLevelMusic: cycle through alt music (no RNG) if restarting the level

This commit is contained in:
James R 2023-11-27 06:25:33 -08:00
parent 5d0c062785
commit 5013144344

View file

@ -8069,7 +8069,7 @@ static void P_InitMinimapInfo(void)
void P_ResetLevelMusic(void)
{
mapmusrng = 0;
UINT8 idx = 0;
if (mapheaderinfo[gamemap-1]->musname_size > 1)
{
@ -8090,11 +8090,22 @@ void P_ResetLevelMusic(void)
if (tempmapmus_size > 1)
{
mapmusrng = P_RandomKey(PR_MUSICSELECT, tempmapmus_size);
if (g_reloadingMap)
{
// If restarting the map, simply cycle
// through available alt music.
idx = (mapmusrng + 1) % tempmapmus_size;
}
else
{
idx = P_RandomKey(PR_MUSICSELECT, tempmapmus_size);
}
//CONS_Printf("Rolled position %u, maps to %u\n", mapmusrng, tempmapmus[mapmusrng]);
mapmusrng = tempmapmus[mapmusrng];
idx = tempmapmus[idx];
}
}
mapmusrng = idx;
}
void P_LoadLevelMusic(void)