Skip to content

Commit

Permalink
SCI32: Fix index/offset mixup in updateInfoFlagViewVisible
Browse files Browse the repository at this point in the history
  • Loading branch information
wjp committed Mar 1, 2016
1 parent b6a8907 commit 0012390
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions engines/sci/engine/selector.cpp
Expand Up @@ -207,10 +207,10 @@ reg_t readSelector(SegManager *segMan, reg_t object, Selector selectorId) {
}

#ifdef ENABLE_SCI32
void updateInfoFlagViewVisible(Object *obj, int offset) {
void updateInfoFlagViewVisible(Object *obj, int index) {
// 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) {
if (index >= 26 && index <= 44 && getSciVersion() >= SCI_VERSION_2) {
obj->setInfoSelectorFlag(kInfoFlagViewVisible);
}
}
Expand Down
4 changes: 2 additions & 2 deletions engines/sci/engine/selector.h
Expand Up @@ -201,10 +201,10 @@ void invokeSelector(EngineState *s, reg_t object, int selectorId,
/**
* 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
* This function checks if index is in the right range, and sets the flag
* on obj.-info- if it is.
*/
void updateInfoFlagViewVisible(Object *obj, int offset);
void updateInfoFlagViewVisible(Object *obj, int index);
#endif

} // End of namespace Sci
Expand Down
6 changes: 3 additions & 3 deletions engines/sci/engine/vm.cpp
Expand Up @@ -1100,7 +1100,7 @@ void run_vm(EngineState *s) {
// Accumulator To Property
validate_property(s, obj, opparams[0]) = s->r_acc;
#ifdef ENABLE_SCI32
updateInfoFlagViewVisible(obj, opparams[0]);
updateInfoFlagViewVisible(obj, opparams[0]>>1);
#endif
break;

Expand All @@ -1113,7 +1113,7 @@ void run_vm(EngineState *s) {
// Stack To Property
validate_property(s, obj, opparams[0]) = POP32();
#ifdef ENABLE_SCI32
updateInfoFlagViewVisible(obj, opparams[0]);
updateInfoFlagViewVisible(obj, opparams[0]>>1);
#endif
break;

Expand All @@ -1130,7 +1130,7 @@ void run_vm(EngineState *s) {
else
opProperty -= 1;
#ifdef ENABLE_SCI32
updateInfoFlagViewVisible(obj, opparams[0]);
updateInfoFlagViewVisible(obj, opparams[0]>>1);
#endif
if (opcode == op_ipToa || opcode == op_dpToa)
s->r_acc = opProperty;
Expand Down

0 comments on commit 0012390

Please sign in to comment.