diff options
author | Colin Snover | 2017-04-24 21:26:53 -0500 |
---|---|---|
committer | Colin Snover | 2017-04-24 21:39:30 -0500 |
commit | e15a4c806a92403a3cf060bc369542b04bdeae15 (patch) | |
tree | 85a536e46037fed6e329575f66b433dd4f9cab4e | |
parent | 827e4efb09e2023d04da79e37147ea6ffdcb654a (diff) | |
download | scummvm-rg350-e15a4c806a92403a3cf060bc369542b04bdeae15.tar.gz scummvm-rg350-e15a4c806a92403a3cf060bc369542b04bdeae15.tar.bz2 scummvm-rg350-e15a4c806a92403a3cf060bc369542b04bdeae15.zip |
SCI: Use the var count from the instance's class in SCI1.1-2.1 when looking up selectors
At least some versions of Island of Dr Brain have a bMessager
instance in script 0 with a var count greater than that of its
class. This probably should never happen since it means the
object has a variable with no corresponding selector.
The next commit adds some extra sanity checking code to object
initialization, to warn on any other games where this happens.
-rw-r--r-- | engines/sci/engine/object.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp index 2875c8b041..a09d530812 100644 --- a/engines/sci/engine/object.cpp +++ b/engines/sci/engine/object.cpp @@ -122,13 +122,19 @@ const Object *Object::getClass(SegManager *segMan) const { int Object::locateVarSelector(SegManager *segMan, Selector slc) const { const Common::Array<uint16> *buf; - const uint varCount = getVarCount(); + uint varCount; - if (getSciVersion() <= SCI_VERSION_2_1_LATE) { +#ifdef ENABLE_SCI32 + if (getSciVersion() == SCI_VERSION_3) { + buf = &_baseVars; + varCount = getVarCount(); + } else { +#else + { +#endif const Object *obj = getClass(segMan); buf = &obj->_baseVars; - } else if (getSciVersion() == SCI_VERSION_3) { - buf = &_baseVars; + varCount = obj->getVarCount(); } for (uint i = 0; i < varCount; i++) |