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
//
void P_RunNightsBonusTimeExecutors(mobj_t *actor)
void P_RunNightsBonusTimeExecutors(mobj_t *actor, boolean preblowup)
{
size_t 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);
}
}
@ -1574,8 +1576,8 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor)
}
// Get current mare and lap (and check early return for DeNightserize)
if (perglobal || perglobalinverse
|| (specialtype >= 325 && specialtype <= 326 && (fromnonights || fromnights)))
if (perglobal || perglobalinverse
|| (specialtype >= 325 && specialtype <= 326 && (fromnonights || fromnights)))
{
UINT8 playersarenights = 0;
@ -1604,7 +1606,7 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor)
currentmare = players[i].mare;
currentlap = UINT8_MAX;
}
if (players[i].mare == currentmare
if (players[i].mare == currentmare
&& (lap > currentlap || currentlap == UINT8_MAX))
currentlap = lap;
}
@ -1616,7 +1618,7 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor)
currentmare = players[i].mare;
currentlap = UINT8_MAX;
}
if (players[i].mare == currentmare
if (players[i].mare == currentmare
&& (lap < currentlap || currentlap == UINT8_MAX))
currentlap = lap;
}

View File

@ -69,7 +69,7 @@ void P_ChangeSectorTag(UINT32 sector, INT16 newtag);
void P_RunNightserizeExecutors(mobj_t *actor);
void P_RunDeNightserizeExecutors(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);

View File

@ -6014,6 +6014,9 @@ static void P_DoNiGHTSCapsule(player_t *player)
{
if (player->spheres > 0)
{
if (player->capsule->extravalue1 <= 0 && player->spheres >= player->capsule->health)
P_RunNightsBonusTimeExecutors(player->mo, true);
player->spheres--;
player->capsule->health--;
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!
S_StartScreamSound(player->mo, sfx_ngdone);
P_SwitchSpheresBonusMode(true);
P_RunNightsBonusTimeExecutors(player->mo);
P_RunNightsBonusTimeExecutors(player->mo, false);
}
}
else