Fix AI angling

This commit is contained in:
lachwright 2019-10-05 02:48:20 +08:00
parent 00697caa6e
commit b120193eb7

View file

@ -114,11 +114,11 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
// Orientation // Orientation
if ((bot->pflags & (PF_SPINNING|PF_STARTDASH)) || flymode == 2) if ((bot->pflags & (PF_SPINNING|PF_STARTDASH)) || flymode == 2)
{ {
tails->angle = sonic->angle; cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
} }
else 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 if (dist < followthres && dist > touchdist) // Do positioning
{ {
tails->angle = ang; cmd->angleturn = (ang - tails->angle) >> FRACBITS;
cmd->forwardmove = 50; cmd->forwardmove = 50;
spinmode = true; spinmode = true;
} }
else if (dist < touchdist && !bmom else if (dist < touchdist && !bmom
&& (!(bot->pflags & PF_SPINNING) || (bot->dashspeed && bot->pflags & PF_SPINNING))) && (!(bot->pflags & PF_SPINNING) || (bot->dashspeed && bot->pflags & PF_SPINNING)))
{ {
tails->angle = sonic->angle; cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
spin = true; spin = true;
spinmode = 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) if (bot->pflags & PF_SPINNING || !spin_last)
{ {
spin = true; spin = true;
tails->angle = sonic->angle; cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
cmd->forwardmove = MAXPLMOVE; cmd->forwardmove = MAXPLMOVE;
spinmode = true; spinmode = true;
} }
@ -284,7 +284,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
else if (dist < followmin) else if (dist < followmin)
{ {
// Copy inputs // Copy inputs
tails->angle = sonic->angle; cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
bot->drawangle = player->drawangle; bot->drawangle = player->drawangle;
cmd->forwardmove = 8 * pcmd->forwardmove / 10; cmd->forwardmove = 8 * pcmd->forwardmove / 10;
cmd->sidemove = 8 * pcmd->sidemove / 10; cmd->sidemove = 8 * pcmd->sidemove / 10;