diff options
author | Retro-Junk | 2016-08-30 00:02:47 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-29 23:36:15 +0200 |
commit | 957354353623bac6d3c4b41f0914e7ab770fa501 (patch) | |
tree | 272841591286c4073482bb02b96c4bbb0ce46faf | |
parent | 888a4578af7ee7f5d47f59a2b6d8718f88b96eb3 (diff) | |
download | scummvm-rg350-957354353623bac6d3c4b41f0914e7ab770fa501.tar.gz scummvm-rg350-957354353623bac6d3c4b41f0914e7ab770fa501.tar.bz2 scummvm-rg350-957354353623bac6d3c4b41f0914e7ab770fa501.zip |
FULLPIPE: Fix arithmetics in MovGraph::putToLink
-rw-r--r-- | engines/fullpipe/motion.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 87ac98db44..81d92ccac8 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1332,9 +1332,9 @@ double MovGraph::putToLink(Common::Point *point, MovGraphLink *link, int fuzzyMa int n2x = link->_graphDst->_x; int n2y = link->_graphDst->_y; double dist1x = (double)(point->x - n1x); - double dist1y = (double)(point->y - n1y); + double dist1y = (double)(n1y - point->y); double dist2x = (double)(n2x - n1x); - double dist2y = (double)(n2y - n1y); + double dist2y = (double)(n1y - n2y); double dist1 = sqrt(dist1x * dist1x + dist1y * dist1y); double dist2 = (dist2y * dist1y + dist2x * dist1x) / link->_length / dist1; double distm = dist2 * dist1; @@ -1355,8 +1355,8 @@ double MovGraph::putToLink(Common::Point *point, MovGraphLink *link, int fuzzyMa return -1.0; } } else { - point->x = (int)(n1x + (dist2x * distm / link->_length)); - point->y = (int)(n1y + (dist2y * distm / link->_length)); + point->x = n1x + (int)((double)(n2x - n1x) * distm / link->_length); + point->y = n1y + (int)((double)(n2y - n1y) * distm / link->_length); } return res; |