From bcebeadedc639e51cd5657e1149f4400d0270a40 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 9 Apr 2016 21:44:09 +0200 Subject: [PATCH] - fixed: ACS's GetActorPitch needs to convert to a signed angle. --- src/p_acs.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 186e9c3d4e..bdc13357e7 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -178,6 +178,11 @@ inline int AngleToACS(DAngle ang) return ang.BAMs() >> 16; } +inline int PitchToACS(DAngle ang) +{ + return int(ang.Normalized180().Degrees * (65536. / 360)); +} + struct CallReturn { CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway) @@ -8751,7 +8756,7 @@ scriptwait: case PCD_GETACTORPITCH: { AActor *actor = SingleActorFromTID(STACK(1), activator); - STACK(1) = actor == NULL ? 0 : AngleToACS(actor->Angles.Pitch); + STACK(1) = actor == NULL ? 0 : PitchToACS(actor->Angles.Pitch); } break;