diff options
author | Filippos Karapetis | 2010-05-26 08:27:24 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-05-26 08:27:24 +0000 |
commit | 1c0bbb10cbb20b8dd0bdc1cb748bb5ec9e538b42 (patch) | |
tree | 1e81f1578e48386f02fc5bb426c134ebe59b2362 /engines/sci/engine/script.cpp | |
parent | 60dd3106885b9784af15cb96122d28a5f0bf33f1 (diff) | |
download | scummvm-rg350-1c0bbb10cbb20b8dd0bdc1cb748bb5ec9e538b42.tar.gz scummvm-rg350-1c0bbb10cbb20b8dd0bdc1cb748bb5ec9e538b42.tar.bz2 scummvm-rg350-1c0bbb10cbb20b8dd0bdc1cb748bb5ec9e538b42.zip |
More work on controlling access to members of the Object class:
- Moved the code for initializing the object class, species and base object inside the Object class
- Made propertyOffsetToId() a method of the Object class
- Made relocateObject() a method of the Object class
- The Object getVariable() method now returns a reference to the requested variable
Only SegManager::reconstructScripts() is left needing direct access to the members of the Object class
svn-id: r49228
Diffstat (limited to 'engines/sci/engine/script.cpp')
-rw-r--r-- | engines/sci/engine/script.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index e9b1ce3f28..aa3fbc995a 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -318,8 +318,6 @@ int script_instantiate_common(ResourceManager *resMan, SegManager *segMan, int s return seg_id; } -#define INST_LOOKUP_CLASS(id) ((id == 0xffff)? NULL_REG : segMan->getClassAddress(id, SCRIPT_GET_LOCK, addr)) - int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int script_nr) { int objType; uint32 objLength = 0; @@ -429,21 +427,10 @@ int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int scr case SCI_OBJ_OBJECT: case SCI_OBJ_CLASS: { // object or class? Object *obj = scr->scriptObjInit(addr); + obj->initSpecies(segMan, addr); - // Instantiate the superclass, if neccessary - obj->setSpeciesSelector(INST_LOOKUP_CLASS(obj->getSpeciesSelector().offset)); - - Object *baseObj = segMan->getObject(obj->getSpeciesSelector()); - - if (baseObj) { - obj->setVarCount(baseObj->getVarCount()); - // Copy base from species class, as we need its selector IDs - obj->_baseObj = baseObj->_baseObj; - - obj->setSuperClassSelector(INST_LOOKUP_CLASS(obj->getSuperClassSelector().offset)); - } else { + if (!obj->initBaseObject(segMan, addr)) { warning("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr)); - scr->scriptObjRemove(addr); } } // if object or class |