Fix regression for title/credits attract demo fades

Mild cleanup around this area of the code to make it more obvious what mistake I made prior
This commit is contained in:
toaster 2025-10-30 20:15:59 +00:00
parent 5a34474264
commit ec0413bee5

View file

@ -8505,9 +8505,11 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// use gamemap to get map number. // use gamemap to get map number.
// 99% of the things already did, so. // 99% of the things already did, so.
// Map header should always be in place at this point // Map header should always be in place at this point
INT32 i, ranspecialwipe = 0; INT32 i;
virtlump_t *encoreLump = NULL; virtlump_t *encoreLump = NULL;
boolean fade_shortcircuit = false;
levelloading = true; levelloading = true;
g_reloadinggamestate = reloadinggamestate; g_reloadinggamestate = reloadinggamestate;
@ -8631,12 +8633,10 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
#undef WAIT #undef WAIT
// Special stage & record attack retry fade to white if (demo.attract
// This is handled BEFORE sounds are stopped. || (G_IsModeAttackRetrying() && !demo.playback && (gametyperules & GTR_BOSS) == 0))
if (G_IsModeAttackRetrying() && !demo.playback && (gametyperules & GTR_BOSS) == 0)
{ {
ranspecialwipe = 2; fade_shortcircuit = true;
//wipestyleflags |= (WSF_FADEOUT|WSF_TOWHITE);
} }
// Make sure all sounds are stopped before Z_FreeTags. // Make sure all sounds are stopped before Z_FreeTags.
@ -8647,8 +8647,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
if (rendermode != render_none) if (rendermode != render_none)
V_ReloadPalette(); // Set the level palette V_ReloadPalette(); // Set the level palette
// Let's fade to white here // Music set-up
// But only if we didn't do the encore startup wipe
if (demo.attract || demo.simplerewind) if (demo.attract || demo.simplerewind)
{ {
// Leave the music alone! We're already playing what we want! // Leave the music alone! We're already playing what we want!
@ -8658,17 +8657,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
else if (!reloadinggamestate) else if (!reloadinggamestate)
{ {
int wipetype = wipe_level_toblack;
// TODO: What is this?? This does nothing because P_LoadLevelMusic is gonna halt music, anyway.
#if 0
// Fade out music here. Deduct 2 tics so the fade volume actually reaches 0.
// But don't halt the music! S_Start will take care of that. This dodges a MIDI crash bug.
if (gamestate == GS_LEVEL)
S_FadeMusic(0, FixedMul(
FixedDiv((F_GetWipeLength(wipedefs[wipe_level_toblack])-2)*NEWTICRATERATIO, NEWTICRATE), MUSICRATE));
#endif
if (K_PodiumSequence()) if (K_PodiumSequence())
{ {
// mapmusrng is set by local player position in K_ResetCeremony // mapmusrng is set by local player position in K_ResetCeremony
@ -8676,7 +8664,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
else if (gamestate == GS_LEVEL) else if (gamestate == GS_LEVEL)
{ {
if (ranspecialwipe == 2) if (fade_shortcircuit)
{ {
pausedelay = -3; // preticker plus one pausedelay = -3; // preticker plus one
} }
@ -8690,6 +8678,14 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
P_LoadLevelMusic(); P_LoadLevelMusic();
} }
} }
}
// Let's fade to black or white here
// But only if we didn't do the encore startup wipe
if (!reloadinggamestate && !demo.simplerewind)
{
int wipetype = wipe_level_toblack;
sfxenum_t fadesound = sfx_None;
// Default // Default
levelfadecol = 31; levelfadecol = 31;
@ -8701,24 +8697,21 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
else if (K_PodiumHasEmerald()) else if (K_PodiumHasEmerald())
{ {
// Special Stage out // Special Stage out
if (ranspecialwipe != 2) fadesound = sfx_s3k6a;
S_StartSound(NULL, sfx_s3k6a);
levelfadecol = 0; levelfadecol = 0;
wipetype = wipe_encore_towhite; wipetype = wipe_encore_towhite;
} }
else if (gametyperules & GTR_SPECIALSTART) else if (gametyperules & GTR_SPECIALSTART)
{ {
// Special Stage in // Special Stage in
if (ranspecialwipe != 2) fadesound = sfx_s3kaf;
S_StartSound(NULL, sfx_s3kaf);
levelfadecol = 0; levelfadecol = 0;
wipetype = wipe_encore_towhite; wipetype = wipe_encore_towhite;
} }
else if (skipstats == 1 && (gametyperules & GTR_BOSS) == 0) else if (skipstats == 1 && (gametyperules & GTR_BOSS) == 0)
{ {
// MapWarp // MapWarp
if (ranspecialwipe != 2) fadesound = sfx_s3k73;
S_StartSound(NULL, sfx_s3k73);
levelfadecol = 0; levelfadecol = 0;
wipetype = wipe_encore_towhite; wipetype = wipe_encore_towhite;
} }
@ -8737,6 +8730,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
} }
else else
{ {
if (!fade_shortcircuit)
S_StartSound(NULL, fadesound);
if (rendermode != render_none) if (rendermode != render_none)
{ {
F_WipeStartScreen(); F_WipeStartScreen();
@ -9016,7 +9012,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
G_StartTitleCard(); G_StartTitleCard();
// Can the title card actually run, though? // Can the title card actually run, though?
if (WipeStageTitle && ranspecialwipe != 2 && fromnetsave == false) if (WipeStageTitle && !fade_shortcircuit && fromnetsave == false)
{ {
G_PreLevelTitleCard(); G_PreLevelTitleCard();
} }