diff options
-rw-r--r-- | engines/sci/engine/object.cpp | 25 | ||||
-rw-r--r-- | engines/sci/engine/object.h | 4 | ||||
-rw-r--r-- | engines/sci/engine/selector.cpp | 11 |
3 files changed, 29 insertions, 11 deletions
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp index 2c1ab2a44a..621810d856 100644 --- a/engines/sci/engine/object.cpp +++ b/engines/sci/engine/object.cpp @@ -24,6 +24,9 @@ #include "sci/engine/kernel.h" #include "sci/engine/object.h" #include "sci/engine/seg_manager.h" +#ifdef ENABLE_SCI32 +#include "sci/engine/features.h" +#endif namespace Sci { @@ -247,6 +250,28 @@ bool Object::initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClas const int EXTRA_GROUPS = 3; +#ifdef ENABLE_SCI32 +bool Object::mustSetViewVisible(const int index) const { + if (getSciVersion() == SCI_VERSION_3) { + if ((uint)index < getVarCount()) { + return _mustSetViewVisible[getVarSelector(index) >> 5]; + } + return false; + } else { + int minIndex, maxIndex; + if (g_sci->_features->usesAlternateSelectors()) { + minIndex = 24; + maxIndex = 43; + } else { + minIndex = 26; + maxIndex = 44; + } + + return index >= minIndex && index <= maxIndex; + } +} +#endif + void Object::initSelectorsSci3(const SciSpan<const byte> &buf) { const SciSpan<const byte> groupInfo = _baseObj.subspan(16); const SciSpan<const byte> selectorBase = groupInfo.subspan(EXTRA_GROUPS * 32 * 2); diff --git a/engines/sci/engine/object.h b/engines/sci/engine/object.h index dca7e97e81..20b1e01776 100644 --- a/engines/sci/engine/object.h +++ b/engines/sci/engine/object.h @@ -295,7 +295,9 @@ public: bool initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClass = true); void syncBaseObject(const SciSpan<const byte> &ptr) { _baseObj = ptr; } - bool mustSetViewVisibleSci3(int selector) const { return _mustSetViewVisible[selector/32]; } +#ifdef ENABLE_SCI32 + bool mustSetViewVisible(int selector) const; +#endif private: void initSelectorsSci3(const SciSpan<const byte> &buf); diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index 5bfc73b801..7f509f3968 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -231,16 +231,7 @@ reg_t readSelector(SegManager *segMan, reg_t object, Selector selectorId) { #ifdef ENABLE_SCI32 void updateInfoFlagViewVisible(Object *obj, int index) { - int minIndex, maxIndex; - if (g_sci->_features->usesAlternateSelectors()) { - minIndex = 24; - maxIndex = 43; - } else { - minIndex = 26; - maxIndex = 44; - } - - if (index >= minIndex && index <= maxIndex && getSciVersion() >= SCI_VERSION_2) { + if (getSciVersion() >= SCI_VERSION_2 && obj->mustSetViewVisible(index)) { obj->setInfoSelectorFlag(kInfoFlagViewVisible); } } |