Save a loop for battle init

This commit is contained in:
NepDisk 2025-10-03 13:48:24 -04:00
parent 74d646f39c
commit 9ce4fcb2b8
3 changed files with 5 additions and 15 deletions

View file

@ -486,27 +486,16 @@ void K_SpawnPlayerBattleBumpers(player_t *p)
}
}
void K_BattleInit(void)
void K_BattleInit(UINT8 numPlayers)
{
size_t i;
if ((gametyperules & GTR_ITEMBREAKER) && !itembreaker && !bossinfo.boss)
{
if (modeattacking != ATTACKING_ITEMBREAK)
{
UINT8 n = 0;
if (!cv_kartitembreaker.value)
goto afteritembreaker;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator)
continue;
n++;
}
if (n > 1)
if (numPlayers > 1)
goto afteritembreaker;
}
@ -517,6 +506,7 @@ afteritembreaker:
if (gametyperules & GTR_BUMPERS)
{
INT32 maxbumpers = K_StartingBumperCount();
UINT8 i;
for (i = 0; i < MAXPLAYERS; i++)
{

View file

@ -21,7 +21,7 @@ void K_CheckBumpers(void);
UINT8 K_NumEmeralds(player_t *player);
void K_RunPaperItemSpawners(void);
void K_SpawnPlayerBattleBumpers(player_t *p);
void K_BattleInit(void);
void K_BattleInit(UINT8 numPlayers);
void K_RespawnBattleBoxes(void);
#ifdef __cplusplus

View file

@ -130,7 +130,7 @@ void K_TimerInit(void)
}
// NOW you can try to setup Item Breaker, if there's not enough players for a match
K_BattleInit();
K_BattleInit(numPlayers);
timelimitintics = extratimeintics = secretextratime = 0;
if ((gametyperules & GTR_TIMELIMIT) && !bossinfo.boss)