aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-05-27 17:41:20 +0000
committerMartin Kiewitz2010-05-27 17:41:20 +0000
commit453d13dc2d2bec3a4d7cc4395bf98bd2103c5ff8 (patch)
treea52cada57a5ecac70c1619d68b28962120baf21a /engines
parent5f5dcbad47c3f120541c59a141e84bb8aed5184d (diff)
downloadscummvm-rg350-453d13dc2d2bec3a4d7cc4395bf98bd2103c5ff8.tar.gz
scummvm-rg350-453d13dc2d2bec3a4d7cc4395bf98bd2103c5ff8.tar.bz2
scummvm-rg350-453d13dc2d2bec3a4d7cc4395bf98bd2103c5ff8.zip
SCI: fixing -propDict- selector on instances to contain -propDict- of the corresponding class - fixes sq4cd/room 381 talk-clicking on robot - thx to waltervn & wjp
svn-id: r49263
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/script.cpp10
-rw-r--r--engines/sci/engine/segment.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 9bbb7738e9..e0bcd632cc 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -256,6 +256,16 @@ void SegManager::scriptInitialiseObjectsSci11(SegmentId seg) {
obj->setSuperClassSelector(
getClassAddress(obj->getSuperClassSelector().offset, SCRIPT_GET_LOCK, NULL_REG));
+ // If object is instance, get -propDict- from class and set it for this object
+ // This is needed for ::isMemberOf() to work.
+ // Example testcase - room 381 of sq4cd - if isMemberOf() doesn't work, talk-clicks on the robot will act like
+ // clicking on ego
+ if (!obj->isClass()) {
+ reg_t classObject = obj->getSuperClassSelector();
+ Object *classObj = getObject(classObject);
+ obj->setPropDictSelector(classObj->getPropDictSelector());
+ }
+
// Set the -classScript- selector to the script number.
// FIXME: As this selector is filled in at run-time, it is likely
// that it is supposed to hold a pointer. The Obj::isKindOf method
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index cbaf2d09d4..44bf6569b6 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -226,6 +226,9 @@ public:
reg_t getNameSelector() const { return _variables[_offset + 3]; }
void setNameSelector(reg_t value) { _variables[_offset + 3] = value; }
+ reg_t getPropDictSelector() const { return _variables[2]; }
+ void setPropDictSelector(reg_t value) { _variables[2] = value; }
+
reg_t getClassScriptSelector() const { return _variables[4]; }
void setClassScriptSelector(reg_t value) { _variables[4] = value; }