aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorTobias Gunkel2012-01-26 22:39:34 +0100
committerTobias Gunkel2012-02-11 08:29:30 +0100
commitddd65dfc22333eefccf3a875fcd33c4597426089 (patch)
treecb2ad8020248e14849c35289d5678f7a1a1a8da6 /engines/scumm
parentf99dab78e401608e45da672355ecac468f8e5e1d (diff)
downloadscummvm-rg350-ddd65dfc22333eefccf3a875fcd33c4597426089.tar.gz
scummvm-rg350-ddd65dfc22333eefccf3a875fcd33c4597426089.tar.bz2
scummvm-rg350-ddd65dfc22333eefccf3a875fcd33c4597426089.zip
SCUMM: fix actor climbing on plant or swimming pool ladder
Before, the actor will descend the ladder of the pool and maybe even into the the pool. Another issue fixed by this is the actor climbing onto the plant pot if you give something to it.
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/actor.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index ed517524ff..19cd0ae2eb 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -1105,16 +1105,11 @@ static int checkXYInBoxBounds(int boxnum, int x, int y, int &destX, int &destY)
// yDist must be divided by 4, as we are using 8x2 pixels
// blocks for actor coordinates).
int xDist = ABS(x - destX);
- int yDist;
+ int yDist = ABS(y - destY) / 4;
int dist;
- // MM C64: This fixes the trunk bug (#3070065), as well
- // as the fruit bowl, however im not sure if its
- // the proper solution or not.
- if( g_scumm->_game.version == 0 )
- yDist = ABS(y - destY);
- else
- yDist = ABS(y - destY) / 4;
+ if(g_scumm->_game.version == 0)
+ xDist *= 2;
if (xDist < yDist)
dist = (xDist >> 1) + yDist;
@@ -1133,7 +1128,9 @@ AdjustBoxResult Actor_v2::adjustXYToBeInBox(const int dstX, const int dstY) {
int numBoxes = _vm->getNumBoxes() - 1;
int bestDist = 0xFF;
- for (int box = numBoxes; box >= 0; box--) {
+ for (int i = 0; i <= numBoxes; i++) {
+ // MM v0 prioritizes lower boxes, other engines higher boxes
+ int box = (_vm->_game.version == 0 ? i : numBoxes - i);
int foundX, foundY;
int flags = _vm->getBoxFlags(box);
if ((flags & kBoxInvisible) && !((flags & kBoxPlayerOnly) && !isPlayer()))
@@ -1143,7 +1140,6 @@ AdjustBoxResult Actor_v2::adjustXYToBeInBox(const int dstX, const int dstY) {
abr.x = foundX;
abr.y = foundY;
abr.box = box;
-
break;
}
if (dist < bestDist) {