aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2010-06-13 06:55:40 +0000
committerNicola Mettifogo2010-06-13 06:55:40 +0000
commit3cacd7bc4372dbaae5c454236b4413ab87955347 (patch)
treead4de443e7a9ef2c3a49e1145f02781989b6c70c /engines
parent0659d5f2448cbea343d294146ba20f656f759f42 (diff)
downloadscummvm-rg350-3cacd7bc4372dbaae5c454236b4413ab87955347.tar.gz
scummvm-rg350-3cacd7bc4372dbaae5c454236b4413ab87955347.tar.bz2
scummvm-rg350-3cacd7bc4372dbaae5c454236b4413ab87955347.zip
Keep the balloon from getting stuck in an infinite loop when floating near the borders of the screen.
See the detailed explanation in walk.cpp. svn-id: r49619
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/walk.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp
index 4468a7a678..d6df23d415 100644
--- a/engines/parallaction/walk.cpp
+++ b/engines/parallaction/walk.cpp
@@ -626,6 +626,19 @@ void PathWalker_BR::doWalk(State &s) {
int xStep = (scale * 16) / 100 + 1;
int yStep = (scale * 10) / 100 + 1;
+
+ /* WORKAROUND: in the balloon scene, the position of the balloon (which is implemented as a
+ Character) is controlled by the user (for movement, via this walking code) and by the scripts
+ (to simulate the balloon floating in the air, in a neverending loop that alters the position
+ coordinates).
+ When the two step sizes are equal in magnitude and opposite in direction, then the walk code
+ enters an infinite loop without giving control back to the user (this happens quite frequently
+ when navigating the balloon near the borders of the screen, where the calculated step is
+ forcibly small because of clipping). Since the "floating" script (part1/scripts/mongolo.scr)
+ uses increments of 3 for both x and y, we tweak the calculated steps accordingly here. */
+ if (xStep == 3) xStep--;
+ if (yStep == 3) yStep--;
+
debugC(9, kDebugWalk, "calculated step: (%i, %i)", xStep, yStep);
s._fieldC = 0;