aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision
diff options
context:
space:
mode:
authorrichiesams2013-08-28 09:10:59 -0500
committerrichiesams2013-08-28 16:44:26 -0500
commit3a9b3841149d22d9a8221a8ae32d2b0feca0b14f (patch)
treefe719a33be83a491bb57c4d3f9268ad35443dc0d /engines/zvision
parentb317ea45fed9cdf444bba3b972ff1e12c12717ad (diff)
downloadscummvm-rg350-3a9b3841149d22d9a8221a8ae32d2b0feca0b14f.tar.gz
scummvm-rg350-3a9b3841149d22d9a8221a8ae32d2b0feca0b14f.tar.bz2
scummvm-rg350-3a9b3841149d22d9a8221a8ae32d2b0feca0b14f.zip
ZVISION: Round to int *after* converting to degrees
Diffstat (limited to 'engines/zvision')
-rw-r--r--engines/zvision/lever_control.cpp7
1 files changed, 3 insertions, 4 deletions
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);