#2698 closed defect (fixed)
FOA: Indy walks on the spot
Reported by: | eriktorbjorn | Owned by: | cyxx |
---|---|---|---|
Priority: | normal | Component: | Engine: SCUMM |
Version: | Keywords: | ||
Cc: | Game: | Indiana Jones 4 |
Description
Current 0.9.0 SVN English talkie version
On the wits path, when starting a fire on the submarine, Indy walks away. When he reaches his destination, he keeps walking on the spot. To reproduce the glitch, simply use the attached savegame and push the lever.
Ticket imported from: #1508935. Ticket imported from: bugs/2698.
Attachments (2)
Change History (10)
by , 18 years ago
Attachment: | atlantisa.s21 added |
---|
comment:1 by , 18 years ago
Hmm, I thought I fixed that bugs years ago. I wonder if that is a regression...
comment:2 by , 18 years ago
From script-39-212, we have :
[0040] (1E) walkActorTo(1,617,144) [0046] (80) breakHere() [0047] (43) VAR_RESULT = getActorX(1) [004C] (38) unless (VAR_RESULT >= 617) goto 0046; [0053] (11) animateCostume(1,246)
First, walkActorTo gets called, Indy walks up to the destination box 12.
When he walks on the last box, walkActor() detects it, breaks out of its loop and sets the flag MF_LAST_LEG to the _moving field of the actor.
Thing is, that in this script, animateCostume() gets called, which will call turnToDirection ; which does this :
if (newdir != _facing) { if (_vm->_game.version <= 6) _moving = MF_TURN; else _moving |= MF_TURN; _targetFacing = newdir;
Since this is version 5, the MF_LAST_LEG flag of the _moving field is 'lost' (and hasn't been handled at all).
Then, walkActor() will be invoked, but won't stop the actor from moving since _moving is equal to MF_TURN.
It seems this part of the code was changed to match disassembly, but this clearly looks problematic in this particular situation.
Removing the 'if (_vm->_game.version <= 6)' block fixes the problem (MF_LAST_LEG won't be lost, then), but if we change that, there's probably more to update in walkActor too.
comment:3 by , 18 years ago
I made the change, based on assembler code of original games. I rechecked the original code of FOA to be sure, and it matches the current code of turnToDirection() too.
Maybe we have a bug elsewhere in walk code?
comment:4 by , 18 years ago
Looking further at code of animateActor() in earlier games, I noticed the original used set cases values.
In SCUMM 3 - 4 the set values of (244, 248 and 252 were used. In SCUMM5 it was changed to 'anim / 4', and set values of 61, 62 and 63. Which would trigger the into beween values, ie 246.
I wonder if that was a mistake though, since it would caused by rounding issue.
comment:5 by , 18 years ago
Nevermnd, the earlier games use similar technique for commands of animateActor().
by , 18 years ago
Attachment: | 1508935.diff added |
---|
Possible fix for the issue (adds extra check to actorWalkStep)
comment:6 by , 18 years ago
Looking at the disassembly of monkey2 and atlantis, there's a special check in actorWalkStep() which makes a difference in this situation (MF_LAST_LEG gets handled properly).
Patch attached.
While I was at it, I modified some other parts of the code to match disasm.
Unfortunately, that doesn't seem to help bug #551715...
comment:7 by , 18 years ago
I added patch to ScummVM SVN, since it fixes the problem and matches the original games.
Your patch fixed the problem of car failing to turn during the smart star challenge in Big Thinker's 1st Grade too.
comment:8 by , 18 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Savegame on board the submarine