From 71f9b79e717b35d625e8273b783c6ca1dcaafdeb Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 20 Aug 2023 18:20:46 -0700 Subject: [PATCH] Prisons: fix exit conditions around spectating Fixes player death not ending a Prisons round, bugged debug feature. Now, do it properly. Don't end the round if the last player spectates. This is more than a debug feature; in Free Play, it lets the player spectate and fly around if they want to, and even come back in, all without restarting the level. --- src/k_battle.c | 7 ++----- src/p_inter.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/k_battle.c b/src/k_battle.c index 7020e7fcf..64673953d 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -127,10 +127,7 @@ void K_CheckBumpers(void) { if (nobumpers > 0 && nobumpers >= numingame) { - // TODO: this would make a great debug feature for release -#ifndef DEVELOP P_DoAllPlayersExit(PF_NOCONTEST, false); -#endif return; } } @@ -142,9 +139,9 @@ void K_CheckBumpers(void) if (numingame <= 1) { - if ((gametyperules & GTR_PRISONS) && (K_CanChangeRules(true) == true)) + if ((gametyperules & GTR_PRISONS) && !battleprisons && (K_CanChangeRules(true) == true)) { - // Reset map to turn on battle capsules + // Reset map to turn on battle prisons if (server) D_MapChange(gamemap, gametype, encoremode, true, 0, false, false); } diff --git a/src/p_inter.c b/src/p_inter.c index 890644320..b68ee18dd 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1556,7 +1556,11 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget P_PlayDeathSound(target); } - if (K_Cooperative()) + // Prisons Free Play: don't eliminate P1 for + // spectating. Because in Free Play, this player + // can enter the game again, and these flags would + // make them intangible. + if (K_Cooperative() && !target->player->spectator) { target->player->pflags |= PF_ELIMINATED; @@ -2160,6 +2164,12 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source, player->pflags |= PF_ELIMINATED; } + if (type == DMG_SPECTATOR) + { + // Set it here so K_CheckBumpers knows about it later. + player->spectator = true; + } + return true; }