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.
This commit is contained in:
James R 2023-08-20 18:20:46 -07:00 committed by toaster
parent 9bbd850d74
commit 71f9b79e71
2 changed files with 13 additions and 6 deletions

View file

@ -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);
}

View file

@ -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;
}