From 25eacbffb86b55fb8194d2a6bbc061d7fab6ecc9 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 5 Dec 2019 09:36:58 +0000 Subject: [PATCH] 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. --- src/b_bot.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index 8c1a0f184..67fac64f6 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -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.