fixed two more places where a negative pitch was calculated:

- A_CustomRailgun when missing the target.
 - A_FaceMovementDirection which ironically had some bad compensation inside. It is not restored to how the code looked in 2.8.1.
This commit is contained in:
Christoph Oelckers 2016-12-24 18:10:37 +01:00
parent 287974968a
commit 39d2945016

View file

@ -2302,7 +2302,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomRailgun)
// We probably won't hit the target, but aim at it anyway so we don't look stupid. // We probably won't hit the target, but aim at it anyway so we don't look stupid.
DVector2 xydiff = self->Vec2To(self->target); DVector2 xydiff = self->Vec2To(self->target);
double zdiff = self->target->Center() - self->Center() - self->Floorclip; double zdiff = self->target->Center() - self->Center() - self->Floorclip;
self->Angles.Pitch = VecToAngle(xydiff.Length(), zdiff); self->Angles.Pitch = -VecToAngle(xydiff.Length(), zdiff);
} }
// Let the aim trail behind the player // Let the aim trail behind the player
if (aim) if (aim)
@ -6690,10 +6690,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FaceMovementDirection)
{ {
DAngle current = mobj->Angles.Pitch; DAngle current = mobj->Angles.Pitch;
const DVector2 velocity = mobj->Vel.XY(); const DVector2 velocity = mobj->Vel.XY();
DAngle pitch = VecToAngle(velocity.Length(), mobj->Vel.Z); DAngle pitch = -VecToAngle(velocity.Length(), mobj->Vel.Z);
if (pitchlimit > 0) if (pitchlimit > 0)
{ {
DAngle pdelta = deltaangle(-current, pitch); DAngle pdelta = deltaangle(current, pitch);
if (fabs(pdelta) > pitchlimit) if (fabs(pdelta) > pitchlimit)
{ {