diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/script.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/segment.h | 3 |
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; } |