use D_ClearState in G_StopDemo

actually fixes issues with crashes AND palette reset
also resets a bunch of more stuff which def is good
This commit is contained in:
Alug committed 2025-10-24 03:37:56 +02:00
1 parent fd86f13150
commit 17d03c6b43
3 files changed
+26 -15

No files matched your search

+24 -3
View File
@@ -954,6 +954,24 @@ void D_SRB2Loop(void)
// D_SRB2Main
// =========================================================================
static void ResetSplitScreen(void)
{
UINT8 i;
// recompute screen size
R_ExecuteSetViewSize();
if (!demo.playback && !botingame)
{
for (i = 1; i < MAXSPLITSCREENPLAYERS; i++)
{
if (i > splitscreen)
CL_RemoveSplitscreenPlayer(displayplayers[i]);
else
CL_AddSplitscreenPlayer();
}
}
}
//
// D_ClearState
//
@@ -963,6 +981,7 @@ void D_ClearState(void)
// okay, stop now
// (otherwise the game still thinks we're playing!)
CURLAbortFile();
SV_StopServer();
SV_ResetServer();
serverlistultimatecount = 0;
@@ -971,7 +990,8 @@ void D_ClearState(void)
CL_ClearPlayer(i);
splitscreen = 0;
SplitScreen_OnChange();
ResetSplitScreen(); // splitscreen onchange resets us to singleplayer :chaosleep:
botingame = false;
botskin = 0;
cv_debug = 0;
@@ -990,7 +1010,6 @@ void D_ClearState(void)
gameaction = ga_nothing;
memset(displayplayers, 0, sizeof(displayplayers));
consoleplayer = 0;
//demosequence = -1;
gametype = GT_RACE; // SRB2kart
paused = false;
@@ -1013,6 +1032,8 @@ void D_ClearState(void)
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
M_ClearMenus(true);
}
//
@@ -1022,8 +1043,8 @@ void D_StartTitle(void)
{
demo.title = false;
D_ClearState();
multiplayer = false; // reset manually
netgame = false; // title menu shouldnt be a netgame lmao
M_ClearMenus(true);
F_StartTitleScreen();
D_ResetDeviceLED();
}
+1
View File
@@ -963,6 +963,7 @@ void F_StartTitleScreen(void)
finalecount = 0;
else
wipegamestate = GS_TITLESCREEN;
G_SetGamestate(GS_TITLESCREEN);
CON_ClearHUD();
+1 -12
View File
@@ -3416,18 +3416,7 @@ void G_StopDemo(void)
if (gamestate == GS_VOTING)
Y_EndVote();
M_ClearMenus(true);
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
SV_StopServer();
SV_ResetServer();
if (gamestate == GS_LEVEL && rendermode != render_none)
{
V_SetPaletteLump("PLAYPAL"); // Reset the palette
R_ReInitColormaps(0, LUMPERROR);
}
D_ClearState();
}
// Stops timing a demo.