From 50131443443989e0a29962b52f870be92c92bf02 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 27 Nov 2023 06:25:33 -0800 Subject: [PATCH] P_ResetLevelMusic: cycle through alt music (no RNG) if restarting the level --- src/p_setup.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 1f1e371af..4b458037c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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)