SCI3: implement setInfoSelector() for SCI3, fixes infinite recursion

svn-id: r54328
This commit is contained in:
Lars Skovlund 2010-11-18 17:13:01 +00:00
parent c5252071db
commit 0001a6b74d
2 changed files with 10 additions and 7 deletions

View File

@ -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())

View File

@ -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 {