[Scummvm-devel] The "Sam and Max inventory hack"

Torbjorn.E.Andersson at tietoenator.com Torbjorn.E.Andersson at tietoenator.com
Mon Mar 1 06:59:11 CET 2004


This is script-52, the inventory script that Sam & Max invokes when calling
setOwnerOf():

[0000] (5D) if (getOwner(localvar0) == 2) {
[000B] (43)   localvar1 = 6
[0011] (5D)   while (localvar1 <= 80) {
[001B] (5D)     if (array-178[localvar1] == localvar0) {
[0028] (73)       jump 63
[002B] (**)     }
[002B] (4F)     localvar1 += 1
[0031] (**)   }
[002E] (43)   localvar1 = 6
[0037] (5D)   while (localvar1 <= 80) {
[0041] (5D)     if (array-178[localvar1] == 0) {
[004E] (47)       array-178[localvar1] = localvar0
[0057] (4F)       var179 += 1
[005A] (73)     } else {
[005D] (4F)       localvar1 += 1
[0060] (73)       jump 37
[0063] (**)     }
[0063] (**)   }
[0063] (**) }
[0063] (66) stopObjectCodeB()

This can't work, because we invoke the inventory script by calling
runInventoryScript(0), so localvar0 is 0 instead of the object that
the script is called for. I think.

Changing this to runInventoryScript(obj) allows me to remove the hack,
and ScummVM no longer crashes on the savegame I attached to bug #907113,
http://sourceforge.net/tracker/index.php?func=detail&aid=907113&group_id=37116&atid=418820

But I don't know if this would break other things.

Torbjörn




More information about the Scummvm-devel mailing list