Ideya anchoring optimization

This commit is contained in:
mazmazz 2018-08-13 02:17:29 -04:00
parent ef9a03b021
commit d3d837392f

View file

@ -797,7 +797,17 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_NightserizePlayer(player, special->health); // Transform! P_NightserizePlayer(player, special->health); // Transform!
if (!spec) if (!spec)
{ {
if (toucher->tracer) // Move the ideya! if (player->exiting) // Move existing Ideyas back to player
{
mobj_t *hnext = special->target ? special->target : special; // goalpost
while ((hnext = hnext->hnext))
{
hnext->flags &= ~MF_GRENADEBOUNCE;
hnext->threshold = 0;
P_SetTarget(&hnext->target, toucher);
}
}
else if (toucher->tracer) // Move the Ideya to an anchor!
{ {
mobj_t *orbittarget = special->target ? special->target : special; mobj_t *orbittarget = special->target ? special->target : special;
mobj_t *hnext = orbittarget->hnext, *anchorpoint = NULL; mobj_t *hnext = orbittarget->hnext, *anchorpoint = NULL;
@ -847,16 +857,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
orbittarget->hnext->extravalue1 -= (72*ANG1)/orbittarget->hnext->extravalue1; orbittarget->hnext->extravalue1 -= (72*ANG1)/orbittarget->hnext->extravalue1;
} }
} }
if (player->exiting) // ...then move it back?
{
mobj_t *hnext = special->target ? special->target : special; // goalpost
while ((hnext = hnext->hnext))
{
hnext->flags &= ~MF_GRENADEBOUNCE;
hnext->threshold = 0;
P_SetTarget(&hnext->target, toucher);
}
}
return; return;
} }