diff options
author | Lars Skovlund | 2010-11-18 17:13:01 +0000 |
---|---|---|
committer | Lars Skovlund | 2010-11-18 17:13:01 +0000 |
commit | 0001a6b74d77166dfa427ca0c9bf55e32119fce3 (patch) | |
tree | 3e37ac011d457d3f1504661649e8de48c4bda0f3 /engines | |
parent | c5252071db22b31cc83c2687f93606b79194efe6 (diff) | |
download | scummvm-rg350-0001a6b74d77166dfa427ca0c9bf55e32119fce3.tar.gz scummvm-rg350-0001a6b74d77166dfa427ca0c9bf55e32119fce3.tar.bz2 scummvm-rg350-0001a6b74d77166dfa427ca0c9bf55e32119fce3.zip |
SCI3: implement setInfoSelector() for SCI3, fixes infinite recursion
svn-id: r54328
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kscripts.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/segment.h | 7 |
2 files changed, 10 insertions, 7 deletions
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index f711530e86..194505e54d 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -103,7 +103,7 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) { g_sci->getResMan()->unlockResource(which); else { if (id.getType() == kResourceTypeInvalid) - warning("[resMan] Attempt to unlock resource %i of invalid type %i", id.getNumber(), type); + warning("[resMan] Attempt to unlock resource %i of invalid type %i", id.getNumber(), argv[0].toUint16()); else // Happens in CD games (e.g. LSL6CD) with the message // resource. It isn't fatal, and it's usually caused @@ -156,7 +156,7 @@ reg_t kClone(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelMemory, "Attempting to clone from %04x:%04x", PRINT_REG(parentAddr)); // TODO: SCI3 equivalent, SCI3 objects don't have an -info- selector - uint16 infoSelector = readSelectorValue(s->_segMan, parentAddr, SELECTOR(_info_)); + uint16 infoSelector = parentObj->getInfoSelector().offset; cloneObj = s->_segMan->allocateClone(&cloneAddr); if (!cloneObj) { @@ -185,11 +185,7 @@ reg_t kClone(EngineState *s, int argc, reg_t *argv) { // Mark as clone infoSelector &= ~kInfoFlagClass; // remove class bit - if (getSciVersion() == SCI_VERSION_3) - // TODO: SCI3 equivalent, SCI3 objects don't have an -info- selector - warning("TODO: not modifying -info- selector in kClone for SCI3"); - else - writeSelectorValue(s->_segMan, cloneAddr, SELECTOR(_info_), infoSelector | kInfoFlagClone); + cloneObj->setInfoSelector(make_reg(0, infoSelector | kInfoFlagClone)); cloneObj->setSpeciesSelector(cloneObj->getPos()); if (parentObj->isClass()) diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h index a674100673..40fd385275 100644 --- a/engines/sci/engine/segment.h +++ b/engines/sci/engine/segment.h @@ -273,6 +273,13 @@ public: return make_reg(0, READ_SCI11ENDIAN_UINT16(_baseObj + 10)); } + void setInfoSelector(reg_t info) { + if (getSciVersion() <= SCI_VERSION_2_1) + _variables[_offset + 2] = info; + else // SCI3 + WRITE_SCI11ENDIAN_UINT16(const_cast<byte*>(_baseObj + 10), info.offset); + } + // No setter for the -info- selector reg_t getNameSelector() const { |