Add ML_BOUNCY flag to Bonus Time executor to execute BEFORE the capsule is destroyed and player has enough spheres

This commit is contained in:
mazmazz 2018-08-14 10:48:50 -04:00
parent 296d527993
commit 62a6fe845d
3 changed files with 13 additions and 8 deletions

View file

@ -1420,13 +1420,15 @@ void P_RunNightsLapExecutors(mobj_t *actor)
// //
// P_RunNightsBonusTimeExecutors // P_RunNightsBonusTimeExecutors
// //
void P_RunNightsBonusTimeExecutors(mobj_t *actor) void P_RunNightsBonusTimeExecutors(mobj_t *actor, boolean preblowup)
{ {
size_t i; size_t i;
for (i = 0; i < numlines; i++) for (i = 0; i < numlines; i++)
{ {
if (lines[i].special == 329 || lines[i].special == 330) if ((lines[i].special == 329 || lines[i].special == 330)
&& ((preblowup && (lines[i].flags & ML_BOUNCY))
|| (!preblowup && !(lines[i].flags & ML_BOUNCY))))
P_RunTriggerLinedef(&lines[i], actor, NULL); P_RunTriggerLinedef(&lines[i], actor, NULL);
} }
} }

View file

@ -69,7 +69,7 @@ void P_ChangeSectorTag(UINT32 sector, INT16 newtag);
void P_RunNightserizeExecutors(mobj_t *actor); void P_RunNightserizeExecutors(mobj_t *actor);
void P_RunDeNightserizeExecutors(mobj_t *actor); void P_RunDeNightserizeExecutors(mobj_t *actor);
void P_RunNightsLapExecutors(mobj_t *actor); void P_RunNightsLapExecutors(mobj_t *actor);
void P_RunNightsBonusTimeExecutors(mobj_t *actor); void P_RunNightsBonusTimeExecutors(mobj_t *actor, boolean preblowup);
ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id); ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id);

View file

@ -6014,6 +6014,9 @@ 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++;
@ -6099,7 +6102,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); P_RunNightsBonusTimeExecutors(player->mo, false);
} }
} }
else else