aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-07-24 23:59:59 +0300
committerEugene Sandulenko2016-07-24 23:59:59 +0300
commit27d29090d8ea626226af92e5a626b3d261ce5d59 (patch)
tree0dda93d210d6b749f58e46fd7b2bb6dedab6c956 /engines
parent6f8075833f6b3a6a351e7571f8df06d682fdd722 (diff)
downloadscummvm-rg350-27d29090d8ea626226af92e5a626b3d261ce5d59.tar.gz
scummvm-rg350-27d29090d8ea626226af92e5a626b3d261ce5d59.tar.bz2
scummvm-rg350-27d29090d8ea626226af92e5a626b3d261ce5d59.zip
FULLPIPE: Clarified MovGraph::calcDistance() implementation
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/motion.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index baea2e28bd..47cf52417b 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -1289,11 +1289,11 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzz
int n2x = link->_graphDst->_x;
int n2y = link->_graphDst->_y;
double dist1x = (double)(point->x - n1x);
- double dist1y = (double)(n1y - point->y);
+ double dist1y = (double)(point->y - n1y);
double dist2x = (double)(n2x - n1x);
double dist2y = (double)(n2y - n1y);
- double dist1 = sqrt(dist1y * dist1y + dist1x * dist1x);
- double dist2 = ((double)(n1y - n2y) * dist1y + dist2x * dist1x) / link->_length / dist1;
+ double dist1 = sqrt(dist1x * dist1x + dist1y * dist1y);
+ double dist2 = (dist2y * dist1y + dist2x * dist1x) / link->_length / dist1;
double distm = dist2 * dist1;
double res = sqrt(1.0 - dist2 * dist2) * dist1;