From 87ee91638e960182198680e21ce88d243df3f6e3 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 31 Jan 2023 14:09:21 +0000 Subject: [PATCH] D_ClearState, G_EndGame, G_GameEndTicker: Move netgame-specific server looping out of the general state-clearing function, for sanity's sake. --- src/d_main.c | 20 -------------------- src/f_finale.c | 7 ++++++- src/g_game.c | 24 ++++++++++++++++++++---- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index b3597ef6e..268fcd4e5 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -923,23 +923,6 @@ void D_ClearState(void) S_StopMusic(); - if (netgame) - { - G_SetGamestate(GS_WAITINGPLAYERS); // hack to prevent a command repeat - - if (server) - { - i = G_GetFirstMapOfGametype(gametype)+1; - - if (i > nummapheaders) - I_Error("D_ClearState: No valid map ID found!?"); - - COM_BufAddText(va("map %s\n", G_BuildMapName(i))); - } - - return; - } - // okay, stop now // (otherwise the game still thinks we're playing!) SV_StopServer(); @@ -995,9 +978,6 @@ void D_ClearState(void) void D_StartTitle(void) { D_ClearState(); - if (netgame) - return; - F_StartTitleScreen(); M_ClearMenus(false); } diff --git a/src/f_finale.c b/src/f_finale.c index 2a7d83146..dd053b558 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1638,9 +1638,14 @@ void F_GameEndDrawer(void) void F_GameEndTicker(void) { if (timetonext > 0) + { timetonext--; + } else - D_StartTitle(); + { + nextmap = NEXTMAP_TITLE; + G_EndGame(); + } } diff --git a/src/g_game.c b/src/g_game.c index b657e9e45..972f449e1 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4178,12 +4178,28 @@ void G_EndGame(void) } } - // direct or competitive multiplayer, so go back to title screen. - D_ClearState(); - if (!netgame) + // In a netgame, don't unwittingly boot everyone. + if (netgame) { - M_StartControlPanel(); + S_StopMusic(); + G_SetGamestate(GS_WAITINGPLAYERS); // hack to prevent a command repeat + + if (server) + { + UINT16 map = G_GetFirstMapOfGametype(gametype)+1; + + if (map > nummapheaders) + I_Error("G_EndGame: No valid map ID found!?"); + + COM_BufAddText(va("map %s\n", G_BuildMapName(map))); + } + + return; } + + // Time to return to the menu. + D_ClearState(); + M_StartControlPanel(); } //