From b120193eb72ea66112e5a70c3b6a6c87d5a53056 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sat, 5 Oct 2019 02:48:20 +0800 Subject: [PATCH] Fix AI angling --- src/b_bot.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index 02ac6d1bc..be1d9dd60 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -114,11 +114,11 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm // Orientation if ((bot->pflags & (PF_SPINNING|PF_STARTDASH)) || flymode == 2) { - tails->angle = sonic->angle; + cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS; } else { - tails->angle = ang; + cmd->angleturn = (ang - tails->angle) >> FRACBITS; } // ******** @@ -219,14 +219,14 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm { if (dist < followthres && dist > touchdist) // Do positioning { - tails->angle = ang; + cmd->angleturn = (ang - tails->angle) >> FRACBITS; cmd->forwardmove = 50; spinmode = true; } else if (dist < touchdist && !bmom && (!(bot->pflags & PF_SPINNING) || (bot->dashspeed && bot->pflags & PF_SPINNING))) { - tails->angle = sonic->angle; + cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS; spin = true; spinmode = true; } @@ -239,7 +239,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm if (bot->pflags & PF_SPINNING || !spin_last) { spin = true; - tails->angle = sonic->angle; + cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS; cmd->forwardmove = MAXPLMOVE; spinmode = true; } @@ -284,7 +284,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm else if (dist < followmin) { // Copy inputs - tails->angle = sonic->angle; + cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS; bot->drawangle = player->drawangle; cmd->forwardmove = 8 * pcmd->forwardmove / 10; cmd->sidemove = 8 * pcmd->sidemove / 10;