Make Tails' "I'll give you a hand!" bubble a hnext chain instead of a target set, which is way less likely to be clobbered in standard gameplay.

Should resolve both #440 and #458, which are two sides of the same issue - target being overwritten.
This commit is contained in:
toaster 2019-12-05 09:36:58 +00:00
parent e6f1b82cc4
commit 25eacbffb8
1 changed files with 9 additions and 8 deletions

View File

@ -339,20 +339,21 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
// Thinkfly overlay
if (thinkfly)
{
if (!tails->target)
if (!tails->hnext)
{
P_SetTarget(&tails->target, P_SpawnMobjFromMobj(tails, 0, 0, 0, MT_OVERLAY));
if (tails->target)
P_SetTarget(&tails->hnext, P_SpawnMobjFromMobj(tails, 0, 0, 0, MT_OVERLAY));
if (tails->hnext)
{
P_SetTarget(&tails->target->target, tails);
P_SetMobjState(tails->target, S_FLIGHTINDICATOR);
P_SetTarget(&tails->hnext->target, tails);
P_SetTarget(&tails->hnext->hprev, tails);
P_SetMobjState(tails->hnext, S_FLIGHTINDICATOR);
}
}
}
else if (tails->target && tails->target->type == MT_OVERLAY && tails->target->state == states+S_FLIGHTINDICATOR)
else if (tails->hnext && tails->hnext->type == MT_OVERLAY && tails->hnext->state == states+S_FLIGHTINDICATOR)
{
P_RemoveMobj(tails->target);
P_SetTarget(&tails->target, NULL);
P_RemoveMobj(tails->hnext);
P_SetTarget(&tails->hnext, NULL);
}
// Turn the virtual keypresses into ticcmd_t.