diff options
author | Max Horn | 2002-07-27 20:11:02 +0000 |
---|---|---|
committer | Max Horn | 2002-07-27 20:11:02 +0000 |
commit | 064c16dd2161370d4238becdd59322f7d9c9b981 (patch) | |
tree | 0c310df87369d4a3555ba6b0ad72a3cb13a9ca38 | |
parent | a31e3bf235716fe40abb392084a89f5578716dfb (diff) | |
download | scummvm-rg350-064c16dd2161370d4238becdd59322f7d9c9b981.tar.gz scummvm-rg350-064c16dd2161370d4238becdd59322f7d9c9b981.tar.bz2 scummvm-rg350-064c16dd2161370d4238becdd59322f7d9c9b981.zip |
fixed buglet that allowed you to leave the crow nest in MonkeyVGA (on the SeaMonkey). Could break other stuff, but I see no way how. Since I am the one to blame for any box bugs currently anyway, I don't care for one more :-)
svn-id: r4659
-rw-r--r-- | actor.cpp | 76 |
1 files changed, 37 insertions, 39 deletions
@@ -584,60 +584,58 @@ AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY, int pathfrom) if (iterations > 1000) return abr; /* Safety net */ box = _vm->getNumBoxes() - 1; - if (box == 0) + if (box < firstValidBox) return abr; best = (uint) 0xFFFF; b = 0; - if (((_vm->_features & GF_SMALL_HEADER) && box) - || !(_vm->_features & GF_SMALL_HEADER)) - for (j = box; j >= firstValidBox; j--) { - flags = _vm->getBoxFlags(j); - if (flags & 0x80 && (!(flags & 0x20) || isInClass(31))) - continue; + for (j = box; j >= firstValidBox; j--) { + flags = _vm->getBoxFlags(j); + if (flags & 0x80 && (!(flags & 0x20) || isInClass(31))) + continue; - if (pathfrom >= firstValidBox) { - int i = _vm->getPathToDestBox(pathfrom, j); - if (i == -1) + if (pathfrom >= firstValidBox) { + int i = _vm->getPathToDestBox(pathfrom, j); + if (i == -1) + continue; + + if (_vm->_features & GF_OLD256) { + // FIXME - we check here if the box suggested by getPathToDestBox + // is locked or not. This prevents us from walking thru + // closed doors in some cases in Zak256. However a better fix + // would be to recompute the box matrix whenever flags change. + flags = _vm->getBoxFlags(i); + if (flags & 0x80 && (!(flags & 0x20) || isInClass(31))) continue; - - if (_vm->_features & GF_OLD256) { - // FIXME - we check here if the box suggested by getPathToDestBox - // is locked or not. This prevents us from walking thru - // closed doors in some cases in Zak256. However a better fix - // would be to recompute the box matrix whenever flags change. - flags = _vm->getBoxFlags(i); - if (flags & 0x80 && (!(flags & 0x20) || isInClass(31))) - continue; - } } + } - if (!_vm->inBoxQuickReject(j, dstX, dstY, threshold)) - continue; + if (!_vm->inBoxQuickReject(j, dstX, dstY, threshold)) + continue; - if (_vm->checkXYInBoxBounds(j, dstX, dstY)) { - abr.x = dstX; - abr.y = dstY; - abr.dist = j; - return abr; - } + if (_vm->checkXYInBoxBounds(j, dstX, dstY)) { + abr.x = dstX; + abr.y = dstY; + abr.dist = j; + return abr; + } - tmp = _vm->getClosestPtOnBox(j, dstX, dstY); + tmp = _vm->getClosestPtOnBox(j, dstX, dstY); - if (tmp.dist >= best) - continue; + if (tmp.dist >= best) + continue; - abr.x = tmp.x; - abr.y = tmp.y; + abr.x = tmp.x; + abr.y = tmp.y; - if (tmp.dist == 0) { - abr.dist = j; - return abr; - } - best = tmp.dist; - b = j; + if (tmp.dist == 0) { + abr.dist = j; + return abr; } + best = tmp.dist; + b = j; + } if (threshold == 0 || threshold * threshold >= best) { abr.dist = b; |