From ddd65dfc22333eefccf3a875fcd33c4597426089 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Thu, 26 Jan 2012 22:39:34 +0100 Subject: 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. --- engines/scumm/actor.cpp | 16 ++++++---------- 1 file 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) { -- cgit v1.2.3