- SW: Fix stupid issue with playerSetAngle() and tweak how angTarget/horizTarget is determined to have been met.

This commit is contained in:
Mitchell Richters 2020-09-10 20:26:19 +10:00
parent be6e0d87d7
commit 3df0d40312
2 changed files with 3 additions and 3 deletions

View file

@ -289,7 +289,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
fixed_t horizDelta = pp->horizTarget - pp->q16horiz; fixed_t horizDelta = pp->horizTarget - pp->q16horiz;
pp->q16horiz += xs_CRoundToInt(scaleAdjust * horizDelta); pp->q16horiz += xs_CRoundToInt(scaleAdjust * horizDelta);
if (abs(pp->q16horiz) >= abs(horizDelta)) if (abs(pp->q16horiz - pp->horizTarget) < FRACUNIT)
{ {
pp->q16horiz = pp->horizTarget; pp->q16horiz = pp->horizTarget;
pp->horizTarget = 0; pp->horizTarget = 0;
@ -310,7 +310,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
fixed_t angDelta = GetDeltaQ16Angle(pp->angTarget, pp->q16ang); fixed_t angDelta = GetDeltaQ16Angle(pp->angTarget, pp->q16ang);
pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * angDelta)); pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * angDelta));
if (pp->q16ang >= pp->angTarget) if (abs(pp->q16ang - pp->angTarget) < FRACUNIT)
{ {
pp->q16ang = pp->angTarget; pp->q16ang = pp->angTarget;
pp->angTarget = 0; pp->angTarget = 0;

View file

@ -7817,7 +7817,7 @@ void playerSetAngle(PLAYERp pp, double ang)
ang += 0.1; ang += 0.1;
} }
pp->angTarget = pp->q16ang + GetDeltaQ16Angle(ang, pp->q16ang); pp->angTarget = pp->q16ang + GetDeltaQ16Angle(FloatToFixed(ang), pp->q16ang);
} }
else else
{ {