diff options
-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 { |