aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-03-01 16:07:16 +0000
committerTorbjörn Andersson2004-03-01 16:07:16 +0000
commite67aaba0c3da89778faff5d5822cbf6dfba811dd (patch)
treed9dbe12242537cd0e06aae039a5b73e19fef0cfb /scumm
parent0603c3a11fc377f6b20b766e046d7b1373b12319 (diff)
downloadscummvm-rg350-e67aaba0c3da89778faff5d5822cbf6dfba811dd.tar.gz
scummvm-rg350-e67aaba0c3da89778faff5d5822cbf6dfba811dd.tar.bz2
scummvm-rg350-e67aaba0c3da89778faff5d5822cbf6dfba811dd.zip
Got rid of the Sam & Max inventory hack. This fixes at least one aspect of
bug #907113. See also bug #493153 for the origins of the hack. It would be very nice if we could get this fix into 0.6.0 as well, because bug #907113 crashes ScummVM for reasons which escape me. But someone will have to verify that the fix is correct first. Pretty please...? svn-id: r13124
Diffstat (limited to 'scumm')
-rw-r--r--scumm/object.cpp11
-rw-r--r--scumm/script_v6.cpp30
2 files changed, 9 insertions, 32 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 9a8d2561cf..979236a365 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -1191,19 +1191,26 @@ int ScummEngine::getInventorySlot() {
void ScummEngine::setOwnerOf(int obj, int owner) {
ScriptSlot *ss;
+
+ // In Sam & Max this is necessary, or you won't get your stuff back
+ // from the Lost and Found tent after riding the Cone of Tragedy. But
+ // it probably applies to all V6+ games. See bugs #493153 and #907113.
+
+ int arg = (_version >= 6) ? obj : 0;
+
if (owner == 0) {
clearOwnerOf(obj);
ss = &vm.slot[_currentScript];
if (ss->where == WIO_INVENTORY && _inventory[ss->number] == obj) {
putOwner(obj, 0);
- runInventoryScript(0);
+ runInventoryScript(arg);
stopObjectCode();
return;
}
}
putOwner(obj, owner);
- runInventoryScript(0);
+ runInventoryScript(arg);
}
int ScummEngine::getObjX(int obj) {
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index 2d8b64aabb..a14fac6603 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -1020,36 +1020,6 @@ void ScummEngine_v6::o6_setState() {
void ScummEngine_v6::o6_setOwner() {
int owner = pop();
int obj = pop();
-
- if ((owner == 2) && (_gameId == GID_SAMNMAX)) {
- // TODO / FIXME: This hack was added a long time ago, in revision 1.28
- // of object.cpp in the old CVS module (see also here:
- // http://cvs.sourceforge.net/viewcvs.py/scummvm/scummvm-old/object.cpp?r1=1.27&r2=1.28
- // Commited by Endy with message:
- // "Sam and Max inventory hack. Makes it work, but is nasty ;)"
- //
- // Sadly, it's not quite clear what exactly the hack fixes. In a quick
- // test I didn't find any place where it is being used, but of course
- // that means nothing.
- //
- // There aren't many places that invoke setOwner at all (in Sam and Max).
- // I did a quick search of the script dumps I have here; in those I found
- // seven calls to setOwner, and only one with owner == 2.
-
- warning("Inside Sam and Max inventory hack! (obj %d)", obj);
- for (int base = 6; base < 80; base++) {
- int value = readArray(178, 0, base);
- if (value == obj)
- break;
- if (value == 0) {
- _scummVars[179]++;
- writeArray(178, 0, base, obj);
- break;
- }
- base++;
- }
- }
-
setOwnerOf(obj, owner);
}