Opened 14 years ago

Closed 14 years ago

Last modified 6 years ago

#9148 closed patch

MM V0: Ed(na) walk fix

Reported by: SF/tobigun Owned by: Kirben
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Maniac Mansion


Ed and Edna are getting stuck when they try to catch one of the kids. For example Edna at the left corner of the kitchen or Ed when he tries to go down the stairs in the basement. The script for following the intruder starts the walkActorToActor() in very small intervals (multiple times per second). This messes up the _walkdata.curbox (the next box) and _walkbox (the current box) states. If the actor reaches the next walkbox, ScummVM marks _walkdata.curbox to be used as _walkbox at the next call of some walk related routine. But before this routine is called, the script will call Actor::startWalkActor() again and the state of _walkdata.curbox and _walkbox is reset to the old values and the transition will not happen, the actor is stuck in the old walkbox.

This problem is not present in MM V1. The only difference in the script for Edna in the kitchen (script 30 in V0, 36 in V1) is an additional breakHere() after walkActorToActor() that is present in V1 but not in V0. Simply adding the breakHere() at the end of walkActorToActor() for V0 solves the problem.

Ticket imported from: #2971126. Ticket imported from: patches/1253.

Attachments (1)

edna-walk.patch (332 bytes ) - added by SF/tobigun 14 years ago.

Download all attachments as: .zip

Change History (10)

by SF/tobigun, 14 years ago

Attachment: edna-walk.patch added

comment:1 by Kirben, 14 years ago

Thanks, I added the patch to ScummVM SVN.

comment:2 by Kirben, 14 years ago

Owner: set to Kirben
Status: newclosed

comment:3 by fingolfin, 14 years ago

Please mark the modification in the source with a pointer to this bug report; i.e. add a "WORKAROUND: See bug #2971126".

Also, I have to wonder whether this change won't cause regressions in other parts of the game? I.e. is this simply a bug in this particular script, or does the game interpreter really invoke breakHere in its walkActorToActor implementation?

comment:4 by fingolfin, 14 years ago

Status: closednew

comment:5 by SF/tobigun, 14 years ago

The fix is a workaround. But it is not only that one script that has a breakHere() following a walkActorToActor(). Approximate 70% of the MM V1 scripts that contain walkActorToActor() have an additional breakHere() after walkActorToActor() that is not present in the V0 equivalent. Sometimes there are even two new breakHere() calls. There is no recognizable pattern of when these are inserted. So it is not easy to call the breakHere() conditionally in ScummVM. At least MM C64 seems to be more playable with the breakHere than without it and I did not notice any regression so far (although it does not mean there is none).

I took a closer look at the original interpreter and it does not call breakHere() in the walkActorToActor() opcode. As I already mentioned the problem is that walkActorToActor() is called to often. The breakHere() increases the interval between the calls a bit so the walk-routines can be executed uninterrupted. So I first meassured the time between two walkActorToActor() calls without my breakHere() patch: 80ms. The interval with the patch is 130ms. MM V1 takes 160ms, almost the exact double amount.

If you look at the actor's talk animations, you will notice that they are too fast, too. I would estimate that this is also by factor 2.

As a conclusion the correct solution to this problem seems to be to handle the walk-code on every clock period and talking and script-execution only every second clock period. As the frequency doubled from V0 to V1 it was necessary to add the breakHeres. Maybe this was done just by trial and error.

comment:6 by SF/tobigun, 14 years ago

I forgot to mention that the speeds of MM V1 in ScummVM and MM V0 in Vice are the same. So in ScummVM MM V0 has double speed for talking and script execution in comparison to Vice.

comment:7 by fingolfin, 14 years ago

Thanks for the explanations, that's very helpful. I'll modify SVN to link to this tracker item, for future reference.

comment:8 by fingolfin, 14 years ago

Status: newclosed

comment:9 by digitall, 6 years ago

Component: Engine: SCUMM
Game: Maniac Mansion
Note: See TracTickets for help on using tickets.