diff options
-rw-r--r-- | engines/sci/engine/selector.cpp | 16 | ||||
-rw-r--r-- | engines/sci/engine/selector.h | 10 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 10 |
3 files changed, 30 insertions, 6 deletions
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index 66f3793918..320f2c0664 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -206,6 +206,16 @@ reg_t readSelector(SegManager *segMan, reg_t object, Selector selectorId) { return *address.getPointer(segMan); } +#ifdef ENABLE_SCI32 +void updateInfoFlagViewVisible(Object *obj, int offset) { + // TODO: Make this correct for all SCI versions + // Selectors 26 through 44 are selectors for View script objects in SQ6 + if (offset >= 26 && offset <= 44 && getSciVersion() >= SCI_VERSION_2) { + obj->setInfoSelectorFlag(kInfoFlagViewVisible); + } +} +#endif + void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t value) { ObjVarRef address; @@ -221,11 +231,7 @@ void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t else { *address.getPointer(segMan) = value; #ifdef ENABLE_SCI32 - // TODO: Make this correct for all SCI versions - // Selectors 26 through 44 are selectors for View script objects - if (getSciVersion() >= SCI_VERSION_2 && selectorId >= 26 && selectorId <= 44) { - segMan->getObject(object)->setInfoSelectorFlag(kInfoFlagViewVisible); - } + updateInfoFlagViewVisible(segMan->getObject(object), selectorId); #endif } } diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h index 12074ed7d2..1952ca0599 100644 --- a/engines/sci/engine/selector.h +++ b/engines/sci/engine/selector.h @@ -197,6 +197,16 @@ void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t void invokeSelector(EngineState *s, reg_t object, int selectorId, int k_argc, StackPtr k_argp, int argc = 0, const reg_t *argv = 0); +#ifdef ENABLE_SCI32 +/** + * SCI32 set kInfoFlagViewVisible in the -info- selector if a certain + * range of properties was written to. + * This function checks if offset is in the right range, and sets the flag + * on obj.-info- if it is. + */ +void updateInfoFlagViewVisible(Object *obj, int offset); +#endif + } // End of namespace Sci #endif // SCI_ENGINE_KERNEL_H diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 3729fc5236..5db3198864 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -1095,6 +1095,9 @@ void run_vm(EngineState *s) { case op_aTop: // 0x32 (50) // Accumulator To Property validate_property(s, obj, opparams[0]) = s->r_acc; +#ifdef ENABLE_SCI32 + updateInfoFlagViewVisible(obj, opparams[0]); +#endif break; case op_pTos: // 0x33 (51) @@ -1105,6 +1108,9 @@ void run_vm(EngineState *s) { case op_sTop: // 0x34 (52) // Stack To Property validate_property(s, obj, opparams[0]) = POP32(); +#ifdef ENABLE_SCI32 + updateInfoFlagViewVisible(obj, opparams[0]); +#endif break; case op_ipToa: // 0x35 (53) @@ -1119,7 +1125,9 @@ void run_vm(EngineState *s) { opProperty += 1; else opProperty -= 1; - +#ifdef ENABLE_SCI32 + updateInfoFlagViewVisible(obj, opparams[0]); +#endif if (opcode == op_ipToa || opcode == op_dpToa) s->r_acc = opProperty; else |