Alternate take on pre-blowup: Do it on first touching tic, instead of first ring pop

* Use MT_EGGCAPSULE extravalue2 for tic timer
This commit is contained in:
mazmazz 2018-08-14 11:06:09 -04:00
parent 62a6fe845d
commit 8c57218027
2 changed files with 11 additions and 8 deletions

View file

@ -8751,7 +8751,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
nummaprings = -1; // no perfect bonus, rings are free nummaprings = -1; // no perfect bonus, rings are free
break; break;
case MT_EGGCAPSULE: case MT_EGGCAPSULE:
mobj->extravalue1 = -1; // timer for how long a player has been at the capsule mobj->extravalue1 = -1; // sphere timer for how long a player has been at the capsule
mobj->extravalue2 = -1; // tic timer for how long a player has been at the capsule
break; break;
case MT_REDTEAMRING: case MT_REDTEAMRING:
mobj->color = skincolor_redteam; mobj->color = skincolor_redteam;

View file

@ -5946,6 +5946,8 @@ static void P_DoNiGHTSCapsule(player_t *player)
{ {
INT32 i; INT32 i;
player->capsule->extravalue2++; // tic counter
if (abs(player->mo->x-player->capsule->x) <= 2*FRACUNIT) if (abs(player->mo->x-player->capsule->x) <= 2*FRACUNIT)
{ {
P_UnsetThingPosition(player->mo); P_UnsetThingPosition(player->mo);
@ -6007,6 +6009,9 @@ static void P_DoNiGHTSCapsule(player_t *player)
} }
} }
if (player->capsule->extravalue2 <= 0 && player->spheres >= player->capsule->health)
P_RunNightsBonusTimeExecutors(player->mo, true); // run pre-blowup executors
// Time to blow it up! // Time to blow it up!
if (player->mo->x == player->capsule->x if (player->mo->x == player->capsule->x
&& player->mo->y == player->capsule->y && player->mo->y == player->capsule->y
@ -6014,9 +6019,6 @@ static void P_DoNiGHTSCapsule(player_t *player)
{ {
if (player->spheres > 0) if (player->spheres > 0)
{ {
if (player->capsule->extravalue1 <= 0 && player->spheres >= player->capsule->health)
P_RunNightsBonusTimeExecutors(player->mo, true);
player->spheres--; player->spheres--;
player->capsule->health--; player->capsule->health--;
player->capsule->extravalue1++; player->capsule->extravalue1++;
@ -6033,7 +6035,7 @@ static void P_DoNiGHTSCapsule(player_t *player)
player->capsule->flags &= ~MF_NOGRAVITY; player->capsule->flags &= ~MF_NOGRAVITY;
player->capsule->momz = 5*FRACUNIT; player->capsule->momz = 5*FRACUNIT;
player->capsule->reactiontime = 0; player->capsule->reactiontime = 0;
player->capsule->extravalue1 = -1; player->capsule->extravalue1 = player->capsule->extravalue2 = -1;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && !player->exiting && players[i].mare == player->mare) if (playeringame[i] && !player->exiting && players[i].mare == player->mare)
@ -6102,7 +6104,7 @@ static void P_DoNiGHTSCapsule(player_t *player)
P_SetTarget(&players[i].capsule, NULL); // Remove capsule from everyone now that it is dead! P_SetTarget(&players[i].capsule, NULL); // Remove capsule from everyone now that it is dead!
S_StartScreamSound(player->mo, sfx_ngdone); S_StartScreamSound(player->mo, sfx_ngdone);
P_SwitchSpheresBonusMode(true); P_SwitchSpheresBonusMode(true);
P_RunNightsBonusTimeExecutors(player->mo, false); P_RunNightsBonusTimeExecutors(player->mo, false); // run post blow-up executors
} }
} }
else else
@ -6111,11 +6113,11 @@ static void P_DoNiGHTSCapsule(player_t *player)
player->texttimer = 4*TICRATE; player->texttimer = 4*TICRATE;
player->textvar = 3; // Get more rings! player->textvar = 3; // Get more rings!
player->capsule->reactiontime = 0; player->capsule->reactiontime = 0;
player->capsule->extravalue1 = -1; player->capsule->extravalue1 = player->capsule->extravalue2 = -1;
} }
} }
else else
player->capsule->extravalue1 = -1; player->capsule->extravalue1 = player->capsule->extravalue2 = -1;
} }
// //