Refactor Battle points cap to use g_pointlimit

Fixes players leaving mid-game lowering the point limit
and instantly ending the match.

see 94c811b55
This commit is contained in:
James R 2023-02-23 19:55:43 -08:00
parent 368116bc59
commit 01227814b9
2 changed files with 25 additions and 18 deletions

View file

@ -140,11 +140,6 @@ void K_CheckBumpers(void)
else
{
g_hiscore = toproundscore;
if (toproundscore < (numingame * 3))
{
return;
}
}
if (numingame <= 1)
@ -158,18 +153,6 @@ void K_CheckBumpers(void)
return;
}
for (i = 0; i < MAXPLAYERS; i++) // This can't go in the earlier loop because winning adds points
K_KartUpdatePosition(&players[i]);
for (i = 0; i < MAXPLAYERS; i++) // and it can't be merged with this loop because it needs to be all updated before exiting... multi-loops suck...
{
if (!playeringame[i])
continue;
if (players[i].spectator)
continue;
P_DoPlayerExit(&players[i]);
}
}
void K_CheckEmeralds(player_t *player)

View file

@ -11350,6 +11350,9 @@ tic_t K_TimeLimitForGametype(void)
UINT32 K_PointLimitForGametype(void)
{
const UINT32 gametypeDefault = gametypes[gametype]->pointlimit;
const UINT32 battleRules = GTR_BUMPERS|GTR_CLOSERPLAYERS|GTR_PAPERITEMS;
UINT32 ptsCap = gametypeDefault;
if (!(gametyperules & GTR_POINTLIMIT))
{
@ -11361,7 +11364,28 @@ UINT32 K_PointLimitForGametype(void)
return cv_pointlimit.value;
}
return gametypeDefault;
if (battlecapsules || bossinfo.valid)
{
return 0;
}
if ((gametyperules & battleRules) == battleRules)
{
INT32 i;
// It's frustrating that this shitty for-loop needs to
// be duplicated every time the players need to be
// counted.
for (i = 0; i < MAXPLAYERS; ++i)
{
if (D_IsPlayerHumanAndGaming(i))
{
ptsCap += 3;
}
}
}
return ptsCap;
}
//}