[Scummvm-git-logs] scummvm master -> 8cbcde0c5716b948a56730c026da9057ff592a62
athrxx
athrxx at scummvm.org
Tue Jun 29 21:20:30 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8cbcde0c57 SCUMM: fix bug 12666 ("Dodgy path finding in Indy 3")
Commit: 8cbcde0c5716b948a56730c026da9057ff592a62
https://github.com/scummvm/scummvm/commit/8cbcde0c5716b948a56730c026da9057ff592a62
Author: athrxx (athrxx at scummvm.org)
Date: 2021-06-29T23:19:29+02:00
Commit Message:
SCUMM: fix bug 12666 ("Dodgy path finding in Indy 3")
The particular scene with Indy and Donovan's men had all sorts of pathfinding issues compared to DOSBox:
- Indy's initial facing was downwards instead of to the right when walking from the window to the "meeting point" and the path he walked wasn't exactly correct.
- One of Donovan's men was facing down instead of left.
- Indy would take several weird up and down walks at the walk box transition from box 1 to box 3
- Indy would walk over the grass instead of on the road.
All fixes are from disasm. Some code I have removed (or rather commented out) seems to have been meant as a fix for bug no. 1778. So maybe that one has to be fixed again (correctly), but I don't know that yet.
The scene is not 100% fixed yet. Donovan's men walk a bit too much upwards in the beginning. But I can do that separately...
It will really be necessary to do some testing (and possibly more fixing) in the catacombs, in castle brunwald and in the zeppelin maze.
Changed paths:
engines/scumm/actor.cpp
engines/scumm/boxes.cpp
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index d71cf5b3ea..b52110631d 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -547,14 +547,20 @@ int Actor::actorWalkStep() {
return 1;
}
- if (_walkbox != _walkdata.curbox && _vm->checkXYInBoxBounds(_walkdata.curbox, _pos.x, _pos.y)) {
- setBox(_walkdata.curbox);
+ if (_vm->_game.version == 3) {
+ if (_walkdata.next.x - (int)_speedx <= _pos.x && _walkdata.next.x + (int)_speedx >= _pos.x)
+ _pos.x = _walkdata.next.x;
+ if (_walkdata.next.y - (int)_speedy <= _pos.y && _walkdata.next.y + (int)_speedy >= _pos.y)
+ _pos.y = _walkdata.next.y;
}
+ if (_walkbox != _walkdata.curbox && _vm->checkXYInBoxBounds(_walkdata.curbox, _pos.x, _pos.y))
+ setBox(_walkdata.curbox);
+
distX = ABS(_walkdata.next.x - _walkdata.cur.x);
distY = ABS(_walkdata.next.y - _walkdata.cur.y);
- if (ABS(_pos.x - _walkdata.cur.x) >= distX && ABS(_pos.y - _walkdata.cur.y) >= distY) {
+ if ((_vm->_game.version == 3 && _pos == _walkdata.next) || (_vm->_game.version != 3 && ABS(_pos.x - _walkdata.cur.x) >= distX && ABS(_pos.y - _walkdata.cur.y) >= distY)) {
_moving &= ~MF_IN_LEG;
return 0;
}
diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp
index 0b29921f1c..0b5f5d6b3d 100644
--- a/engines/scumm/boxes.cpp
+++ b/engines/scumm/boxes.cpp
@@ -1253,9 +1253,16 @@ void Actor_v3::findPathTowardsOld(byte box1, byte box2, byte finalBox, Common::P
// next box (box2) = final box?
if (box2 == finalBox) {
+ // I have commented out the mask check for INDY3 which was meant as a fix for the zeppeline path finding. But it
+ // is wrong and causes issues (e. g. bug #12666 - when Indy starts walking away from the window he will be facing
+ // down instead of right; the mask check is not the cause of all the problems that particular scene had, but at
+ // least some of them). At first glance at disasm it might seem that the original would do such a check, since it
+ // actually calls getMaskFromBox() for both boxes. However, the results do not get evaluated. Looks like some
+ // leftover code...
+
// In Indy3, the masks (= z-level) have to match, too -- needed for the
// 'maze' in the zeppelin (see bug #1778).
- if (_vm->_game.id != GID_INDY3 || _vm->getMaskFromBox(box1) == _vm->getMaskFromBox(box2)) {
+ //if (_vm->_game.id != GID_INDY3 || _vm->getMaskFromBox(box1) == _vm->getMaskFromBox(box2)) {
// Is the actor (x,y) between both gates?
if (compareSlope(_pos, _walkdata.dest, gateA[0]) !=
compareSlope(_pos, _walkdata.dest, gateB[0]) &&
@@ -1263,7 +1270,7 @@ void Actor_v3::findPathTowardsOld(byte box1, byte box2, byte finalBox, Common::P
compareSlope(_pos, _walkdata.dest, gateB[1])) {
return;
}
- }
+ //}
}
p3 = closestPtOnLine(gateA[1], gateB[1], _pos);
More information about the Scummvm-git-logs
mailing list