From 31f3f8b8e787f41e4c22ac2d84130f0a02861912 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 18 May 2017 16:54:58 +0100 Subject: [PATCH 1/3] Moved Y_EndGame from y_inter.c/h to g_game.c/h, renamed it to G_EndGame --- src/f_finale.c | 4 ++-- src/g_game.c | 34 +++++++++++++++++++++++++++++++++- src/g_game.h | 1 + src/y_inter.c | 33 +-------------------------------- src/y_inter.h | 1 - 5 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index a8b27bb8..0a448692 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1733,7 +1733,7 @@ static void F_AdvanceToNextScene(void) void F_EndCutScene(void) { - cutsceneover = true; // do this first, just in case Y_EndGame or something wants to turn it back false later + cutsceneover = true; // do this first, just in case G_EndGame or something wants to turn it back false later if (runningprecutscene) { if (server) @@ -1748,7 +1748,7 @@ void F_EndCutScene(void) else if (nextmap < 1100-1) G_NextLevel(); else - Y_EndGame(); + G_EndGame(); } } diff --git a/src/g_game.c b/src/g_game.c index 4f1c49b4..25730ce7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2911,7 +2911,7 @@ void G_AfterIntermission(void) if (nextmap < 1100-1) G_NextLevel(); else - Y_EndGame(); + G_EndGame(); } } @@ -2997,6 +2997,38 @@ static void G_DoContinued(void) gameaction = ga_nothing; } +// +// G_EndGame (formerly Y_EndGame) +// Franky this function fits better in g_game.c than it does in y_inter.c +// +// ...Gee, (why) end the game? +// Because Y_FollowIntermission and F_EndCutscene would +// both do this exact same thing *in different ways* otherwise, +// which made it so that you could only unlock Ultimate mode +// if you had a cutscene after the final level and crap like that. +// This function simplifies it so only one place has to be updated +// when something new is added. +void G_EndGame(void) +{ + // Only do evaluation and credits in coop games. + if (gametype == GT_COOP) + { + if (nextmap == 1102-1) // end game with credits + { + F_StartCredits(); + return; + } + if (nextmap == 1101-1) // end game with evaluation + { + F_StartGameEvaluation(); + return; + } + } + + // 1100 or competitive multiplayer, so go back to title screen. + D_StartTitle(); +} + // // G_LoadGameSettings // diff --git a/src/g_game.h b/src/g_game.h index ada82404..196ba2ea 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -171,6 +171,7 @@ void G_NextLevel(void); void G_Continue(void); void G_UseContinue(void); void G_AfterIntermission(void); +void G_EndGame(void); // moved from y_inter.c/h and renamed void G_Ticker(boolean run); boolean G_Responder(event_t *ev); diff --git a/src/y_inter.c b/src/y_inter.c index e7df165b..37c59730 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1794,37 +1794,6 @@ void Y_EndIntermission(void) usebuffer = false; } -// -// Y_EndGame -// -// Why end the game? -// Because Y_FollowIntermission and F_EndCutscene would -// both do this exact same thing *in different ways* otherwise, -// which made it so that you could only unlock Ultimate mode -// if you had a cutscene after the final level and crap like that. -// This function simplifies it so only one place has to be updated -// when something new is added. -void Y_EndGame(void) -{ - // Only do evaluation and credits in coop games. - if (gametype == GT_COOP) - { - if (nextmap == 1102-1) // end game with credits - { - F_StartCredits(); - return; - } - if (nextmap == 1101-1) // end game with evaluation - { - F_StartGameEvaluation(); - return; - } - } - - // 1100 or competitive multiplayer, so go back to title screen. - D_StartTitle(); -} - // // Y_FollowIntermission // @@ -1850,7 +1819,7 @@ static void Y_FollowIntermission(void) return; } - Y_EndGame(); + G_EndGame(); } #define UNLOAD(x) Z_ChangeTag(x, PU_CACHE); x = NULL diff --git a/src/y_inter.h b/src/y_inter.h index 9fe95fcc..26f7dc39 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -15,7 +15,6 @@ void Y_IntermissionDrawer(void); void Y_Ticker(void); void Y_StartIntermission(void); void Y_EndIntermission(void); -void Y_EndGame(void); typedef enum { From 2bb7df5f49d90ac9f8c4d80ec5bbfeb11c9a064e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 18 May 2017 17:10:44 +0100 Subject: [PATCH 2/3] G_ExitLevel tweak: Use HU_ClearCEcho() instead of HU_DoCEcho(""), the latter causes an empty line to appear in log.txt --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 25730ce7..d145fcbe 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2615,7 +2615,7 @@ void G_ExitLevel(void) CONS_Printf(M_GetText("The round has ended.\n")); // Remove CEcho text on round end. - HU_DoCEcho(""); + HU_ClearCEcho(); } } From feceaf6d30144e19ef64e773705b637b242c7b05 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 18 May 2017 17:23:19 +0100 Subject: [PATCH 3/3] Removed all code in Y_FollowIntermission that's already handled in G_AfterIntermission Only real difference here is that CEcho messages will always be cleared when going to credits/evaluation, but that's hardly a loss tbh. --- src/g_game.c | 4 ++-- src/y_inter.c | 19 ++++--------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index d145fcbe..b8df32f9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2999,10 +2999,10 @@ static void G_DoContinued(void) // // G_EndGame (formerly Y_EndGame) -// Franky this function fits better in g_game.c than it does in y_inter.c +// Frankly this function fits better in g_game.c than it does in y_inter.c // // ...Gee, (why) end the game? -// Because Y_FollowIntermission and F_EndCutscene would +// Because G_AfterIntermission and F_EndCutscene would // both do this exact same thing *in different ways* otherwise, // which made it so that you could only unlock Ultimate mode // if you had a cutscene after the final level and crap like that. diff --git a/src/y_inter.c b/src/y_inter.c index 37c59730..9d41caf3 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1805,21 +1805,10 @@ static void Y_FollowIntermission(void) return; } - if (nextmap < 1100-1) - { - // normal level - G_AfterIntermission(); - return; - } - - // Start a custom cutscene if there is one. - if (mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking) - { - F_StartCustomCutscene(mapheaderinfo[gamemap-1]->cutscenenum-1, false, false); - return; - } - - G_EndGame(); + // This handles whether to play a post-level cutscene, end the game, + // or simply go to the next level. + // No need to duplicate the code here! + G_AfterIntermission(); } #define UNLOAD(x) Z_ChangeTag(x, PU_CACHE); x = NULL