Skip to content

Commit

Permalink
SCUMM: fix bug no. 14582
Browse files Browse the repository at this point in the history
(pathfinding doesn't match original)

This does not address the (allegedly) wrong actor turning direction.
  • Loading branch information
athrxx committed Aug 22, 2023
1 parent 4a3e074 commit b36c487
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion engines/scumm/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,13 @@ int Actor::calcMovementFactor(const Common::Point& next) {
deltaYFactor = 0;
}

if ((uint)ABS(deltaXFactor >> 16) > _speedx) {
// We used to have ABS(deltaXFactor >> 16) for the calculation here, which
// caused bug no. https://bugs.scummvm.org/ticket/14582
// For SCUMM4-6 it is obvious from disam that they do the division by 0x10000.
// SCUMM7/8 original code gives the impression of using deltaXFactor >> 16 at
// first glance, but it really doesn't. It is a more complicated operation
// which amounts to the exact same thing as the following...
if ((uint)ABS(deltaXFactor / 0x10000) > _speedx) {
deltaXFactor = _speedx << 16;
if (diffX < 0)
deltaXFactor = -deltaXFactor;
Expand Down

0 comments on commit b36c487

Please sign in to comment.