From 3a9b3841149d22d9a8221a8ae32d2b0feca0b14f Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 28 Aug 2013 09:10:59 -0500 Subject: ZVISION: Round to int *after* converting to degrees --- engines/zvision/lever_control.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 08a620f646..71b284c459 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -247,10 +247,9 @@ int LeverControl::calculateVectorAngle(const Common::Point &pointOne, const Comm int16 xDist = pointTwo.x - pointOne.x; int16 yDist = pointTwo.y - pointOne.y; - int angle = int(atan((float)yDist / (float)xDist)); - - // Convert to degrees. (180 / 3.14159 = 57.2958) - angle *= 57; + // Calculate the angle using arctan + // Then convert to degrees. (180 / 3.14159 = 57.2958) + int angle = int(atan((float)yDist / (float)xDist) * 57); // Calculate what quadrant pointTwo is in uint quadrant = ((yDist > 0 ? 1 : 0) << 1) | (xDist < 0 ? 1 : 0); -- cgit v1.2.3