Don't award Prison Eggs bopped after exiting

- Short-circuits P_AddBrokenPrison if EVERYONE is exiting
    - Still calls P_DoAllPlayersExit to catch spectators with respect to server softlock
- Don't run K_SpawnBattlePoints if the recipient is exiting
    - Also re-arranges K_GivePointsToPlayer just in case the score addition ends the round
This commit is contained in:
toaster 2025-02-23 14:39:37 +00:00
parent b5483faecf
commit b5fd26777c
3 changed files with 31 additions and 16 deletions

View file

@ -105,6 +105,9 @@ void K_SpawnBattlePoints(player_t *source, player_t *victim, UINT8 amount)
if (!source || !source->mo) if (!source || !source->mo)
return; return;
if (source->exiting)
return;
if (amount == 1) if (amount == 1)
st = S_BATTLEPOINT1A; st = S_BATTLEPOINT1A;
else if (amount == 2) else if (amount == 2)

View file

@ -5337,8 +5337,8 @@ void K_TakeBumpersFromPlayer(player_t *player, player_t *victim, UINT8 amount)
void K_GivePointsToPlayer(player_t *player, player_t *victim, UINT8 amount) void K_GivePointsToPlayer(player_t *player, player_t *victim, UINT8 amount)
{ {
K_SpawnBattlePoints(player, victim, amount); // first just in case player score ends the game
P_AddPlayerScore(player, amount); P_AddPlayerScore(player, amount);
K_SpawnBattlePoints(player, victim, amount);
} }
#define MINEQUAKEDIST 4096 #define MINEQUAKEDIST 4096

View file

@ -1142,22 +1142,29 @@ static void P_AddBrokenPrison(mobj_t *target, mobj_t *inflictor, mobj_t *source)
if (!battleprisons) if (!battleprisons)
return; return;
// Check to see if everyone's out.
{
UINT8 i = 0;
for (; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator || players[i].exiting)
continue;
break;
}
if (i == MAXPLAYERS)
{
// Nobody can claim credit for this just-too-late hit!
P_DoAllPlayersExit(0, false); // softlock prevention
return;
}
}
// If you CAN recieve points, get them!
if ((gametyperules & GTR_POINTLIMIT) && (source && source->player)) if ((gametyperules & GTR_POINTLIMIT) && (source && source->player))
{ {
/*mobj_t * ring; K_GivePointsToPlayer(source->player, NULL, 1);
for (i = 0; i < 2; i++)
{
dir += (ANGLE_MAX/3);
ring = P_SpawnMobj(target->x, target->y, target->z, MT_RING);
ring->angle = dir;
P_InstaThrust(ring, dir, 16*ring->scale);
ring->momz = 8 * target->scale * P_MobjFlip(target);
P_SetTarget(&ring->tracer, source);
source->player->pickuprings++;
}*/
P_AddPlayerScore(source->player, 1);
K_SpawnBattlePoints(source->player, NULL, 1);
} }
targetdamaging_t targetdamaging = UFOD_GENERIC; targetdamaging_t targetdamaging = UFOD_GENERIC;
@ -1202,13 +1209,18 @@ static void P_AddBrokenPrison(mobj_t *target, mobj_t *inflictor, mobj_t *source)
gamedata->prisoneggstothispickup--; gamedata->prisoneggstothispickup--;
} }
// Standard progression.
if (++numtargets >= maptargets) if (++numtargets >= maptargets)
{ {
// Yipue!
P_DoAllPlayersExit(0, true); P_DoAllPlayersExit(0, true);
} }
else else
{ {
S_StartSound(NULL, sfx_s221); S_StartSound(NULL, sfx_s221);
// Time limit recovery
if (timelimitintics) if (timelimitintics)
{ {
UINT16 bonustime = 10*TICRATE; UINT16 bonustime = 10*TICRATE;
@ -1255,7 +1267,7 @@ static void P_AddBrokenPrison(mobj_t *target, mobj_t *inflictor, mobj_t *source)
secretextratime = TICRATE/2; secretextratime = TICRATE/2;
} }
// Prison Egg challenge drops (CDs, etc)
#ifdef DEVELOP #ifdef DEVELOP
extern consvar_t cv_debugprisoncd; extern consvar_t cv_debugprisoncd;
#endif #endif