aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-09-05 15:09:50 +0000
committerMartin Kiewitz2010-09-05 15:09:50 +0000
commitd817bec4fddf5d808d2a0d630bb9057610267386 (patch)
tree6103d2558e4efa145795a2bce1798a64c9d7198a /engines/sci
parent2a08124f0f9274dd442b7154e3b72dd981a7e2e7 (diff)
downloadscummvm-rg350-d817bec4fddf5d808d2a0d630bb9057610267386.tar.gz
scummvm-rg350-d817bec4fddf5d808d2a0d630bb9057610267386.tar.bz2
scummvm-rg350-d817bec4fddf5d808d2a0d630bb9057610267386.zip
SCI: merging -info- stuff in Clone/DisposeClone
svn-id: r52562
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kscripts.cpp13
-rw-r--r--engines/sci/engine/segment.h2
2 files changed, 3 insertions, 12 deletions
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 7cc677cd3a..cebf33017a 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -178,17 +178,13 @@ reg_t kClone(EngineState *s, int argc, reg_t *argv) {
*clone_obj = *parent_obj;
// Mark as clone
- clone_obj->markAsClone();
+ clone_obj->markAsClone(); // sets -info- selector
clone_obj->setSpeciesSelector(clone_obj->getPos());
if (parent_obj->isClass())
clone_obj->setSuperClassSelector(parent_obj->getPos());
s->_segMan->getScript(parent_obj->getPos().segment)->incrementLockers();
s->_segMan->getScript(clone_obj->getPos().segment)->incrementLockers();
- // Mark as clone for scripts as well
- uint16 infoSelector = readSelectorValue(s->_segMan, clone_addr, SELECTOR(_info_));
- writeSelectorValue(s->_segMan, clone_addr, SELECTOR(_info_), (infoSelector & 0x7fff) | 1);
-
return clone_addr;
}
@@ -204,17 +200,12 @@ reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
- if (!object->isClone()) {
- // SCI silently ignores non-clones; some games actually depend on it
- return s->r_acc;
- }
-
// SCI uses this technique to find out, if it's a clone and if it's supposed to get freed
// At least kq4early relies on this behaviour. The scripts clone "Sound", then set bit 1 manually
// and call kDisposeClone later. In that case we may not free it, otherwise we will run into issues
// later, because kIsObject would then return false and Sound object wouldn't get checked.
uint16 infoSelector = readSelectorValue(s->_segMan, obj, SELECTOR(_info_));
- if ((infoSelector & 3) == 1)
+ if ((infoSelector & 3) == kInfoFlagClone)
object->markAsFreed();
return s->r_acc;
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index 16ceb979f4..3c7addfab2 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -290,7 +290,7 @@ public:
bool isClass() const { return (getInfoSelector().offset & kInfoFlagClass); }
const Object *getClass(SegManager *segMan) const;
- void markAsClone() { setInfoSelector(make_reg(0, kInfoFlagClone)); }
+ void markAsClone() { setInfoSelector(make_reg(0, getInfoSelector().offset | kInfoFlagClone)); }
bool isClone() const { return (getInfoSelector().offset & kInfoFlagClone); }
void markAsFreed() { _flags |= OBJECT_FLAG_FREED; }