move replay replayhut list free and reset into M_ResetDemoList

use it to free demolists from within levelload when you switched maps out of a replay
This commit is contained in:
Alug committed 2025-09-17 23:32:21 +02:00
1 parent 7f996d4c1b
commit d40b636bbe
4 files changed
+23 -15

No files matched your search

+1 -1
View File
@@ -1088,7 +1088,6 @@ void D_ClearState(void)
P_FreeLevelState();
netgame = false; // title menu shouldnt be a netgame lmao
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
}
@@ -1100,6 +1099,7 @@ void D_StartTitle(void)
{
demo.title = false;
D_ClearState();
netgame = false; // title menu shouldnt be a netgame lmao
M_ClearMenus(true);
F_StartTitleScreen();
D_ResetDeviceLED();
+15 -10
View File
@@ -3924,13 +3924,12 @@ static void PrepReplayList(boolean reset)
replayquerycheck = replayqueryfound = 0;
if (demolist)
Z_Free(demolist);
Z_Free(demolist);
demolist = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL);
// If directory didn't change, keep demolist_all
if (!reset) return;
if (!reset)
return;
Lock_search_state();
@@ -4586,17 +4585,23 @@ static void M_DrawReplayStartMenu(void)
V_DrawSmallString(4, BASEVIDHEIGHT-14, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, warning);
}
void M_ResetDemoList(void)
{
Z_Free(demolist_all);
demolist_all = NULL;
Z_Free(demolist);
demolist = NULL;
demo.inreplayhut = false;
}
static boolean M_QuitReplayHut(void)
{
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
menuactive = false;
D_StartTitle();
if (demolist)
Z_Free(demolist);
demolist = NULL;
demo.inreplayhut = false;
M_ResetDemoList();
return true;
}
+1
View File
@@ -319,6 +319,7 @@ void GameFocus_menu_Onchange (void);
void M_UpdateOGLMenu(void);
#endif
void M_ResetDemoList(void);
void M_ReplayHut(INT32 choice);
void M_SetPlaybackMenuPointer(void);
+6 -4
View File
@@ -2761,14 +2761,16 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
lumpnum_t encoreLump = LUMPERROR;
UINT8 levelfadecol;
// HACK: this doesent reset if you change the map from within a replay and may cause crashes or the replayhut to be non functional
if (!demo.playback && demo.inreplayhut)
{
M_ResetDemoList();
}
midgamejoin = fromnetsave; // makes dynslopes run in P_Ticker/P_PreTicker to avoid synch issues and other stuff
levelloading = true;
// HACK: this doesent reset if you change the map from within a replay and may cause crashes or the replayhut to be non functional
if (!demo.playback)
demo.inreplayhut = false;
// This is needed. Don't touch.
maptol = mapheaderinfo[gamemap-1]->typeoflevel;