Clean up K_TimerInit()

- Fix not being able to change timelimit in MP break the capsules
- Use more readable variable name (singleplayercontext --> domodeattack)
- Reset timelimitintics in K_TimerReset()
This commit is contained in:
toaster 2022-10-16 14:23:21 +01:00
parent 735c487b65
commit 59094f73fb

View file

@ -98,13 +98,14 @@ void K_TimerReset(void)
starttime = introtime = 3; starttime = introtime = 3;
numbulbs = 1; numbulbs = 1;
inDuel = rainbowstartavailable = false; inDuel = rainbowstartavailable = false;
timelimitintics = extratimeintics = secretextratime = 0;
} }
void K_TimerInit(void) void K_TimerInit(void)
{ {
UINT8 i; UINT8 i;
UINT8 numPlayers = 0; UINT8 numPlayers = 0;
boolean singleplayercontext = ((modeattacking != ATTACKING_NONE) boolean domodeattack = ((modeattacking != ATTACKING_NONE)
|| (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE)); || (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE));
if (specialStage.active == true) if (specialStage.active == true)
@ -113,7 +114,7 @@ void K_TimerInit(void)
} }
else if (bossinfo.boss == false) else if (bossinfo.boss == false)
{ {
if (!singleplayercontext) if (!domodeattack)
{ {
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
@ -127,7 +128,7 @@ void K_TimerInit(void)
if (numPlayers < 2) if (numPlayers < 2)
{ {
singleplayercontext = true; domodeattack = true;
} }
else else
{ {
@ -148,12 +149,13 @@ void K_TimerInit(void)
starttime = (introtime + (3*TICRATE)) + ((2*TICRATE) + (numbulbs * bulbtime)); // Start countdown time, + buffer time starttime = (introtime + (3*TICRATE)) + ((2*TICRATE) + (numbulbs * bulbtime)); // Start countdown time, + buffer time
} }
timelimitintics = extratimeintics = secretextratime = 0; K_BattleInit(domodeattack);
if ((gametyperules & GTR_TIMELIMIT) && !bossinfo.boss && !modeattacking) if ((gametyperules & GTR_TIMELIMIT) && !bossinfo.boss && !modeattacking)
{ {
if (singleplayercontext) if (!K_CanChangeRules(true))
{ {
if (grandprixinfo.gp) if (battlecapsules)
{ {
timelimitintics = (20*TICRATE); timelimitintics = (20*TICRATE);
} }
@ -171,8 +173,6 @@ void K_TimerInit(void)
} }
} }
K_BattleInit(singleplayercontext);
if (inDuel == true) if (inDuel == true)
{ {
K_SpawnDuelOnlyItems(); K_SpawnDuelOnlyItems();