diff --git a/src/k_battle.c b/src/k_battle.c index c95455925..0e4f8b368 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -487,22 +487,13 @@ void K_SpawnPlayerBattleBumpers(player_t *p) } } -void K_BattleInit(UINT8 numPlayers) +void K_BattleInit(boolean singleplayercontext) { - if ((gametyperules & GTR_ITEMBREAKER) && !itembreaker && !bossinfo.boss) + if ((gametyperules & GTR_ITEMBREAKER) && singleplayercontext && !itembreaker && !bossinfo.boss) { - if (modeattacking != ATTACKING_ITEMBREAK) - { - if (K_CanChangeRules() && !cv_kartitembreaker.value) - goto afteritembreaker; - - if (numPlayers > 1) - goto afteritembreaker; - } - - itembreaker = true; + if (!(K_CanChangeRules() && !cv_kartitembreaker.value)) + itembreaker = true; } -afteritembreaker: if (gametyperules & GTR_BUMPERS) { diff --git a/src/k_battle.h b/src/k_battle.h index 0ef5b52ef..1e6aa9d75 100644 --- a/src/k_battle.h +++ b/src/k_battle.h @@ -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(UINT8 numPlayers); +void K_BattleInit(boolean singleplayercontext); void K_RespawnBattleBoxes(void); #ifdef __cplusplus diff --git a/src/k_kart.c b/src/k_kart.c index f4b13f00f..fb5ae7262 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -101,7 +101,9 @@ vector3_t clusterpoint, clusterdtf; void K_TimerInit(void) { UINT8 i; - UINT8 numPlayers = 0;//, numspec = 0; + UINT8 numPlayers = 0; + boolean singleplayercontext = ((modeattacking != ATTACKING_NONE) + || (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE)); starttime = introtime = 0; @@ -111,20 +113,22 @@ void K_TimerInit(void) } else if (bossinfo.boss == false) { - for (i = 0; i < MAXPLAYERS; i++) + if (!singleplayercontext) { - if (!playeringame[i]) + for (i = 0; i < MAXPLAYERS; i++) { - continue; + if (!playeringame[i] || players[i].spectator) + { + continue; + } + + numPlayers++; } - if (players[i].spectator == true) + if (numPlayers < 2) { - //numspec++; - continue; + singleplayercontext = true; } - - numPlayers++; } introtime = (108) + 5; // 108 for rotation, + 5 for white fade @@ -136,13 +140,10 @@ void K_TimerInit(void) } } - // NOW you can try to setup Item Breaker, if there's not enough players for a match - K_BattleInit(numPlayers); - timelimitintics = extratimeintics = secretextratime = 0; if ((gametyperules & GTR_TIMELIMIT) && !bossinfo.boss) { - if (!K_CanChangeRules()) + if (singleplayercontext) { if (grandprixinfo.gp) { @@ -161,6 +162,8 @@ void K_TimerInit(void) timelimitintics = cv_timelimit.value * (60*TICRATE); } } + + K_BattleInit(singleplayercontext); } UINT32 K_GetPlayerDontDrawFlag(player_t *player)