Make Bonus Time Start executor into a general Egg Capsule Touch executor

* Entrance/exit flags
* Enough/not-enough-rings flags (with "doesn't matter" line option)
This commit is contained in:
mazmazz 2018-08-14 12:00:37 -04:00
parent 8c57218027
commit 3f312ce114
3 changed files with 12 additions and 8 deletions

View file

@ -1418,17 +1418,20 @@ void P_RunNightsLapExecutors(mobj_t *actor)
} }
// //
// P_RunNightsBonusTimeExecutors // P_RunNightsCapsuleTouchExecutors
// //
void P_RunNightsBonusTimeExecutors(mobj_t *actor, boolean preblowup) void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean enoughspheres)
{ {
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)) && ((entering && (lines[i].flags & ML_TFERLINE))
|| (!preblowup && !(lines[i].flags & ML_BOUNCY)))) || (!entering && !(lines[i].flags & ML_TFERLINE)))
&& ((lines[i].flags & ML_DONTPEGTOP)
|| (enoughspheres && !(lines[i].flags & ML_BOUNCY))
|| (!enoughspheres && (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, boolean preblowup); void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean enoughspheres);
ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id); ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id);

View file

@ -6009,8 +6009,8 @@ static void P_DoNiGHTSCapsule(player_t *player)
} }
} }
if (player->capsule->extravalue2 <= 0 && player->spheres >= player->capsule->health) if (player->capsule->extravalue2 <= 0)
P_RunNightsBonusTimeExecutors(player->mo, true); // run pre-blowup executors P_RunNightsCapsuleTouchExecutors(player->mo, true, player->spheres >= player->capsule->health); // run capsule entrance 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
@ -6104,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); // run post blow-up executors P_RunNightsCapsuleTouchExecutors(player->mo, false, true); // run capsule exit executors, and we destroyed it
} }
} }
else else
@ -6114,6 +6114,7 @@ static void P_DoNiGHTSCapsule(player_t *player)
player->textvar = 3; // Get more rings! player->textvar = 3; // Get more rings!
player->capsule->reactiontime = 0; player->capsule->reactiontime = 0;
player->capsule->extravalue1 = player->capsule->extravalue2 = -1; player->capsule->extravalue1 = player->capsule->extravalue2 = -1;
P_RunNightsCapsuleTouchExecutors(player->mo, false, false); // run capsule exit executors, and we lacked rings
} }
} }
else else