aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2010-10-25 03:39:58 +0000
committerSven Hesse2010-10-25 03:39:58 +0000
commit66de867fe4ebc1015b9c9d61d2e987f0bef2fdaa (patch)
tree6a626842a63802cd6ce3c025bcd6b6b63206ba8b
parent9605cda50ba32dfb96020ffe4dc92c2353cad222 (diff)
downloadscummvm-rg350-66de867fe4ebc1015b9c9d61d2e987f0bef2fdaa.tar.gz
scummvm-rg350-66de867fe4ebc1015b9c9d61d2e987f0bef2fdaa.tar.bz2
scummvm-rg350-66de867fe4ebc1015b9c9d61d2e987f0bef2fdaa.zip
GOB: Fix the Gob3 ladder walking bug
Fix the bug where Blount stops in the middle of big ladders. svn-id: r53794
-rw-r--r--engines/gob/goblin.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp
index 1d4996ce78..a516c844e4 100644
--- a/engines/gob/goblin.cpp
+++ b/engines/gob/goblin.cpp
@@ -1814,14 +1814,36 @@ void Goblin::move(int16 destX, int16 destY, int16 objIndex) {
WRITE_VAR(56, 0);
+ byte passType = _vm->_map->getPass(obj->gobDestX, obj->gobDestY);
+
// Prevent continous walking on wide stairs
- if (_vm->_map->getPass(obj->gobDestX, obj->gobDestY) == 11) {
+ if (passType == 11) {
if (_vm->_map->_screenWidth == 640) {
obj->gobDestY++;
animData->destY++;
}
}
+ // Prevent stopping in the middle of big ladders
+ if ((passType == 19) || (passType == 20)) {
+ int ladderTop = 0;
+ while (_vm->_map->getPass(obj->gobDestX, obj->gobDestY + ladderTop) == passType)
+ ladderTop++;
+
+ int ladderBottom = 0;
+ while (_vm->_map->getPass(obj->gobDestX, obj->gobDestY + ladderBottom) == passType)
+ ladderBottom--;
+
+ int ladderDest;
+ if (ABS(ladderBottom) <= ladderTop)
+ ladderDest = obj->gobDestY + ladderBottom;
+ else
+ ladderDest = obj->gobDestY + ladderTop;
+
+ obj->gobDestY = ladderDest;
+ animData->destY = ladderDest;
+ }
+
initiateMove(obj);
}