From 7d77600e71f31ec41564c94a5b47c6b5246e9072 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 29 Feb 2020 01:51:45 -0300 Subject: [PATCH] Make exitmove friendly, don't start empty intermission screens --- src/d_netcmd.c | 2 +- src/g_game.c | 7 ++++-- src/p_spec.c | 4 ++-- src/p_user.c | 4 ++-- src/y_inter.c | 63 +++++++++++++++++++++++++------------------------- src/y_inter.h | 4 ++++ 6 files changed, 45 insertions(+), 39 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ed612aaef..196d67a60 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3743,7 +3743,7 @@ static void ExitMove_OnChange(void) { UINT8 i; - if (!(netgame || multiplayer) || !G_CoopGametype()) + if (!(netgame || multiplayer) || !(gametyperules & GTR_FRIENDLY)) return; if (cv_exitmove.value) diff --git a/src/g_game.c b/src/g_game.c index f0ca101fa..5c7b5fbcb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3180,7 +3180,7 @@ void G_ExitLevel(void) CV_SetValue(&cv_teamscramble, cv_scrambleonchange.value); } - if (!(gametyperules & GTR_CAMPAIGN)) + if (!(gametyperules & (GTR_FRIENDLY|GTR_CAMPAIGN))) CONS_Printf(M_GetText("The round has ended.\n")); // Remove CEcho text on round end. @@ -3840,7 +3840,10 @@ static void G_DoCompleted(void) if (nextmap < NUMMAPS && !mapheaderinfo[nextmap]) P_AllocMapHeader(nextmap); - if ((skipstats && !modeattacking) || (spec && modeattacking && stagefailed)) + // If the current gametype has no intermission screen set, then don't start it. + Y_DetermineIntermissionType(); + + if ((skipstats && !modeattacking) || (spec && modeattacking && stagefailed) || (intertype == int_none)) { G_UpdateVisited(); G_AfterIntermission(); diff --git a/src/p_spec.c b/src/p_spec.c index f4057fba5..30379fcb7 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4100,7 +4100,7 @@ void P_SetupSignExit(player_t *player) if (!numfound && !(player->mo->target && player->mo->target->type == MT_SIGN) - && !(G_CoopGametype() && (netgame || multiplayer) && cv_exitmove.value)) + && !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value)) P_SetTarget(&player->mo->target, thing); if (thing->state != &states[thing->info->spawnstate]) @@ -4131,7 +4131,7 @@ void P_SetupSignExit(player_t *player) if (!numfound && !(player->mo->target && player->mo->target->type == MT_SIGN) - && !(G_CoopGametype() && (netgame || multiplayer) && cv_exitmove.value)) + && !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value)) P_SetTarget(&player->mo->target, thing); if (thing->state != &states[thing->info->spawnstate]) diff --git a/src/p_user.c b/src/p_user.c index 33329a929..d90300e01 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9925,7 +9925,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (player->exiting) { if (mo->target && mo->target->type == MT_SIGN && mo->target->spawnpoint - && !(G_CoopGametype() && (netgame || multiplayer) && cv_exitmove.value) + && !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value) && !(twodlevel || (mo->flags2 & MF2_TWOD))) sign = mo->target; else if ((player->powers[pw_carry] == CR_NIGHTSMODE) @@ -11826,7 +11826,7 @@ void P_PlayerThink(player_t *player) if (player->pflags & PF_FINISHED) { - if ((G_CoopGametype() && cv_exitmove.value) && !G_EnoughPlayersFinished()) + if (((gametyperules & GTR_FRIENDLY) && cv_exitmove.value) && !G_EnoughPlayersFinished()) player->exiting = 0; else P_DoPlayerExit(player); diff --git a/src/y_inter.c b/src/y_inter.c index 36cb64d06..701739ad1 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -229,8 +229,7 @@ static void Y_IntermissionTokenDrawer(void) // // Y_ConsiderScreenBuffer // -// Can we copy the current screen -// to a buffer? +// Can we copy the current screen to a buffer? // void Y_ConsiderScreenBuffer(void) { @@ -256,9 +255,7 @@ void Y_ConsiderScreenBuffer(void) // // Y_RescaleScreenBuffer // -// Write the rescaled source picture, -// to the destination picture that -// has the current screen's resolutions. +// Write the rescaled source picture, to the destination picture that has the current screen's resolutions. // static void Y_RescaleScreenBuffer(void) { @@ -328,14 +325,6 @@ void Y_IntermissionDrawer(void) if (rendermode == render_none) return; - if (intertype == int_none) - { -#ifdef HAVE_BLUA - LUAh_IntermissionHUD(); -#endif - return; - } - if (!usebuffer) // Lactozilla: Renderer switching if (needpatchrecache) @@ -1196,6 +1185,34 @@ void Y_Ticker(void) } } +// +// Y_DetermineIntermissionType +// +// Determines the intermission type from the current gametype. +// +void Y_DetermineIntermissionType(void) +{ + // set to int_none initially + intertype = int_none; + + if (intermissiontypes[gametype] != int_none) + intertype = intermissiontypes[gametype]; + else if (gametype == GT_COOP) + intertype = (G_IsSpecialStage(gamemap)) ? int_spec : int_coop; + else if (gametype == GT_TEAMMATCH) + intertype = int_teammatch; + else if (gametype == GT_MATCH + || gametype == GT_TAG + || gametype == GT_HIDEANDSEEK) + intertype = int_match; + else if (gametype == GT_RACE) + intertype = int_race; + else if (gametype == GT_COMPETITION) + intertype = int_comp; + else if (gametype == GT_CTF) + intertype = int_ctf; +} + // // Y_StartIntermission // @@ -1217,12 +1234,11 @@ void Y_StartIntermission(void) if (!multiplayer) { timer = 0; - intertype = (G_IsSpecialStage(gamemap)) ? int_spec : int_coop; } else { - if (cv_inttime.value == 0 && gametype == GT_COOP) + if (cv_inttime.value == 0 && ((intertype == int_coop) || (intertype == int_spec))) timer = 0; else { @@ -1231,23 +1247,6 @@ void Y_StartIntermission(void) if (!timer) timer = 1; } - - if (intermissiontypes[gametype] != int_none) - intertype = intermissiontypes[gametype]; - else if (gametype == GT_COOP) - intertype = (G_IsSpecialStage(gamemap)) ? int_spec : int_coop; - else if (gametype == GT_TEAMMATCH) - intertype = int_teammatch; - else if (gametype == GT_MATCH - || gametype == GT_TAG - || gametype == GT_HIDEANDSEEK) - intertype = int_match; - else if (gametype == GT_RACE) - intertype = int_race; - else if (gametype == GT_COMPETITION) - intertype = int_comp; - else if (gametype == GT_CTF) - intertype = int_ctf; } // We couldn't display the intermission even if we wanted to. diff --git a/src/y_inter.h b/src/y_inter.h index 855844fcc..859144b1d 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -13,11 +13,15 @@ extern boolean usebuffer; void Y_IntermissionDrawer(void); void Y_Ticker(void); + void Y_StartIntermission(void); void Y_EndIntermission(void); + void Y_ConsiderScreenBuffer(void); void Y_CleanupScreenBuffer(void); +void Y_DetermineIntermissionType(void); + typedef enum { int_none,