#1384 closed defect (fixed)
ALL: Local script variables not always initialized
Reported by: | eriktorbjorn | Owned by: | Kirben |
---|---|---|---|
Priority: | low | Component: | Engine: SCUMM |
Version: | Keywords: | ||
Cc: | Game: |
Description
While looking for a different bug, I noticed that in SCUMM games we sometimes ensure that all unused local variables for a script are zeroed before calling runScript(), and sometimes we don't.
Specifically, I noticed these cases:
In Actor::startWalkAnim(), when a walk script is invoked.
In ScummEngine::runInventoryScript()
When running the boot script. In this case we don't even bother to give the script as many local variables as we usually do.
Now, in all likelyhood these cases are probably still well-defined. I assume the scripts never look at the uninitialized variables. But maybe we should initialize them anyway, just to be nice?
Ticket imported from: #874631. Ticket imported from: bugs/1384.
Change History (9)
comment:1 by , 21 years ago
Priority: | normal → low |
---|---|
Resolution: | → invalid |
comment:2 by , 21 years ago
comment:3 by , 21 years ago
Definately should zero all unused vars, this was cause of start up problem in puttputt: I was tracing down cause of puttputt trying to load non exisant verb images and noticed it was getting insane var values (ie 2292776) shortly before problem. The actual cause was that the inventory script's local vars were not been cleared.
I changed runInventoryScript() and startWalkAnim() to zero local script vars, would be worth enabling walkscripts again to see if they work better now too.
comment:4 by , 21 years ago
Resolution: | invalid |
---|
comment:5 by , 21 years ago
Summary: | Local script variables not always initialized? → ALL: Local script variables not always initialized |
---|
comment:6 by , 21 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:7 by , 21 years ago
"enabling walkscripts again" -> what do you mean, walkscripts were never disabled ?!?
comment:9 by , 6 years ago
Component: | → Engine: SCUMM |
---|
I am aware of this. Note that the original engines didn't init the local vars at all. In fact, we have severalhacks in our code base which work around scripting bugs - those scripts only worked in the original engine because the engine didn't clean the local vars properly (this is a case of a bug in the scripts being canceled out by a bug in the engine :-).
If you feel like it, you have my blessings of 'fixing' this. However, be aware that it might actually cause regressions, and is unlikely to fix any bugs.