diff --git a/src/d_main.c b/src/d_main.c index 589a686e9..c18261c16 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -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(); diff --git a/src/m_menu.c b/src/m_menu.c index 781595bad..3ccbed5eb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -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; } diff --git a/src/m_menu.h b/src/m_menu.h index 06e0273fe..024fd62a0 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -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); diff --git a/src/p_setup.c b/src/p_setup.c index 4f2b3fee4..789eac2ea 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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;