From d56be63249b47c558e39825cd0a850bfdecc01b5 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 27 Feb 2023 20:54:31 -0800 Subject: [PATCH] Battle: eliminate players killed by the Overtime Barrier - Players killed this way become invisible and unable to move. - Ends the match when one player is remaining. --- src/k_battle.c | 30 ++++++++++++++++++++---------- src/p_user.c | 5 +++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/k_battle.c b/src/k_battle.c index d2a2175dd..bad1f1694 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -92,6 +92,9 @@ void K_CheckBumpers(void) UINT8 i; UINT8 numingame = 0; UINT8 nobumpers = 0; + UINT8 eliminated = 0; + + const boolean singleplayer = (battlecapsules || bossinfo.valid); if (!(gametyperules & GTR_BUMPERS)) return; @@ -113,21 +116,28 @@ void K_CheckBumpers(void) { nobumpers++; } + + if (players[i].pflags & PF_ELIMINATED) + { + eliminated++; + } } - if (battlecapsules || bossinfo.valid) + if (singleplayer + ? nobumpers > 0 && nobumpers >= numingame + : eliminated >= numingame - 1) { - if (nobumpers > 0 && nobumpers >= numingame) + for (i = 0; i < MAXPLAYERS; i++) { - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i]) - continue; - if (players[i].spectator) - continue; + if (!playeringame[i]) + continue; + if (players[i].spectator) + continue; + + if (singleplayer) players[i].pflags |= PF_NOCONTEST; - P_DoPlayerExit(&players[i]); - } + + P_DoPlayerExit(&players[i]); } return; } diff --git a/src/p_user.c b/src/p_user.c index f95d5afc1..6eb0417ef 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2773,6 +2773,11 @@ static void P_DeathThink(player_t *player) } } + if ((player->pflags & PF_ELIMINATED) && (gametyperules & GTR_BUMPERS)) + { + playerGone = true; + } + if (playerGone == false && player->deadtimer > TICRATE) { player->playerstate = PST_REBORN;