Opened 20 years ago
Closed 8 months ago
#832 closed defect (fixed)
FOA: Invalid actor XXX in o5_getActorRoom()
|Reported by:||SF/grandepuffo||Owned by:||AndywinXp|
|Cc:||Game:||Indiana Jones 4|
In room 222 (crashed door, robot and chain), crossing the door causes scummvm to entering console, showing the following log
Loading room 222 loadResource(Script,23) loadResource(Room,94) loadResource(Script,33) loadResource(Script,19) loadResource(Script,45) loadResource(Script,10) loadResource(Script,131) (94:206:0x15FFA): Invalid actor 205 in o5_getActorRoom(94:206:0x15FFA): Invalid actor 205 in o5_getActorRoom!
i'm using today (05/30/2003) cvs snapshot (0.4.2cvs)
Ticket imported from: #746349. Ticket imported from: bugs/832.
Change History (12)
comment:1 by , 20 years ago
|Summary:||Invalid actor → INDY4: Invalid actor|
by , 20 years ago
comment:2 by , 20 years ago
I can't even load this savegame. Was it made with a non-english version of FOA by chance (your name sounds italian :-)
comment:3 by , 20 years ago
comment:4 by , 20 years ago
Found my own savegame for that place to reproduce the problem.
comment:5 by , 20 years ago
This seems to be either a bug in the FOA scripts, or we have a bug in our script engine. Script 206 (in room 94) is run from script 200, like this:
...  (10) Var = getObjectOwner(586) [001E] (2A) startScript(201,[Var])  (6A) startScript(206,[Var]) ...
The problem is that script 201 gets to run first, and it changes the value of Var, so by the time script 206 is invoked, it gets a bad value as param.
So, either: 1) A script bug, and we should just "ignore" it 2) An engine bug, several things possible: 2a) Maybe high vars should be "buffered", kind of like local vars? That seems odd... but then again it seems odd to use a global var like 442 for something which is clearly a local business 2b) Maybe we shouldn't be running script 201/206 immediately but rather just queue them for running. But that seems very unlikely.
Var is really used a lot for temporary results, in many scripts. I wonder why they didn't use a localvar instead. Maybe this was kind of a "TEMP_REGISTER" variable or so.
comment:6 by , 20 years ago
|Summary:||INDY4: Invalid actor → FOA: Invalid actor|
comment:7 by , 20 years ago
Put a workaround into CVS; but I don't like this a bit, hm...
comment:8 by , 20 years ago
|Status:||new → closed|
comment:9 by , 10 months ago
|Status:||closed → new|
|Summary:||FOA: Invalid actor → FOA: Invalid actor XXX in o5_getActorRoom()|
Reopening this very old ticket, as suggested by AndywinXp ("This way I will eventually remember to check for the correct behavior in my v5 disasm and properly fix it") after this commit of mine:
It appears that we still need this workaround as of 2022. A quick test for this is the
5234 boot param.
If I test the original interpreter with DREAMM, I don't see any crash, while ScummVM will issue a fatal error about this. I can't say if this is because we're more strict in our getActorRoom() implementation for v5, or if we don't handle these startScript() and Var calls exactly as the original does.
comment:10 by , 8 months ago
|Status:||new → pending|
Apparently the original relies on undefined behavior for these (well, actually this is currently the only one which has shown up in 20 years...) edge cases, so the fix seems to be correct. But I have extended this to all the games using this piece of code.
comment:11 by , 8 months ago
|Status:||pending → closed|
Savegame just before the crash