SCI: A provisional fix for the "invalid selector" problem in KQ6 and other

SCI1.1 games.

svn-id: r40575
This commit is contained in:
Walter van Niftrik 2009-05-14 22:33:31 +00:00
parent 61d9a42c56
commit 67ce8fee85
2 changed files with 10 additions and 1 deletions

View File

@ -863,7 +863,15 @@ void SegManager::scriptInitialiseObjectsSci11(EngineState *s, int seg) {
#endif
// Copy base from species class, as we need its selector IDs
obj->_variables[6] = INST_LOOKUP_CLASS(obj->_variables[6].offset);
obj->_variables[SCRIPT_SUPERCLASS_SELECTOR] = INST_LOOKUP_CLASS(obj->_variables[SCRIPT_SUPERCLASS_SELECTOR].offset);
// Set the -classScript- selector to the script number.
// FIXME: As this selector is filled in at run-time, it is likely
// that it is supposed to hold a pointer. The Obj::isKindOf method
// uses this selector together with -propDict- to compare classes.
// For the purpose of Obj::isKindOf, using the script number appears
// to be sufficient.
obj->_variables[SCRIPT_CLASSSCRIPT_SELECTOR] = make_reg(0, scr->nr);
seeker += READ_LE_UINT16(seeker + 2) * 2;
}

View File

@ -203,6 +203,7 @@ public:
/*---------------------------------*/
#define SCRIPT_SPECIES_SELECTOR (s->version < SCI_VERSION(1,001,000) ? 0 : 5)
#define SCRIPT_SUPERCLASS_SELECTOR (s->version < SCI_VERSION(1,001,000) ? 1 : 6)
#define SCRIPT_CLASSSCRIPT_SELECTOR 4
/** Magic adjustment value for lofsa and lofss */
#define SCRIPT_LOFS_MAGIC 3