[Scummvm-devel] The "Sam and Max inventory hack"
James 'Ender' Brown
ender at scummvm.org
Mon Mar 1 06:22:04 CET 2004
I could have told whomever put the comment there that, as I wrote it.
Heck, looking through the bug tracker could have told you that :)
See bug
http://sourceforge.net/tracker/index.php?func=detail&aid=493153&group_id=37116&atid=418820
- Ender
On Mon, 2004-03-01 at 21:11, Torbjorn.E.Andersson at tietoenator.com wrote:
> There's a big "What's this?" comment in ScummEngine_v6::o6_setOwner() -
> perhaps this sheds some light on it?
>
> While looking at bug #907113 ("SAM: Items in box causes crash") I noticed
> that losing your stuff at the Cone of Tragedy, and regaining it is one case
> where the "Sam and Max inventory hack" is triggered.
>
> If I understand things correctly, this fragment from room-17-202 is what
> removes the inventory:
>
> [002B] (5D) while (localvar1 >= 1) {
> [0035] (43) localvar2 = findInventory(2,localvar1)
> [003F] (5D) if (localvar2 != 35) {
> [0049] (5E) startScript(0,56,[localvar2])
> [0056] (71) setOwner(localvar2,14)
> [005D] (**) }
> [005D] (57) localvar1 += -1
> [0063] (**) }
>
> I assume object 35 is the inventory object for Max.
>
> This fragment, from room-15-207, probably restores the inventory:
>
> [0026] (5D) while (localvar1 >= 1) {
> [0030] (43) localvar2 = findInventory(14,localvar1)
> [003A] (71) setOwner(localvar2,2)
> [0041] (57) localvar1 += -1
> [0047] (**) }
>
> So there's nothing to correspond to the first script's calling of script 56.
> Here's that script:
>
> [0000] (5D) if ((var181 == localvar0) || (var180 == localvar0)) {
> [0012] (43) var181 = 0
> [0018] (43) var180 = 0
> [001E] (**) }
> [001E] (43) localvar1 = 6
> [0024] (5D) while (localvar1 <= 80) {
> [002E] (5D) if (array-178[localvar1] == localvar0) {
> [003B] (47) array-178[localvar1] = 0
> [0044] (57) var179 += -1
> [0047] (73) } else {
> [004A] (4F) localvar1 += 1
> [004D] (73) jump 24
> [0050] (**) }
> [0050] (**) }
> [0050] (66) stopObjectCodeB()
>
> So the inventory hack looks like an inverse of script-56. I have no idea what
> it's for, but when I removed it I didn't get my stuff back from the Lost and
> Found office.
>
> Whether or not the hack is involved in bug #907113 I don't know.
>
> Torbjörn
More information about the Scummvm-devel
mailing list