From 453d13dc2d2bec3a4d7cc4395bf98bd2103c5ff8 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Thu, 27 May 2010 17:41:20 +0000 Subject: 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 --- engines/sci/engine/script.cpp | 10 ++++++++++ engines/sci/engine/segment.h | 3 +++ 2 files changed, 13 insertions(+) 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; } -- cgit v1.2.3