diff options
author | Max Horn | 2009-09-17 13:22:00 +0000 |
---|---|---|
committer | Max Horn | 2009-09-17 13:22:00 +0000 |
commit | 730c7c964163f3db2ee9888480754a6a0236578e (patch) | |
tree | 5fba446fc924be24d1545fc73027dc72d78e5eda /engines/sci/engine | |
parent | 364640cfd58a99a7b61f914a836c156d55a25c3c (diff) | |
download | scummvm-rg350-730c7c964163f3db2ee9888480754a6a0236578e.tar.gz scummvm-rg350-730c7c964163f3db2ee9888480754a6a0236578e.tar.bz2 scummvm-rg350-730c7c964163f3db2ee9888480754a6a0236578e.zip |
SCI: Get rid of the not_register() hack
svn-id: r44153
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 1 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 18 | ||||
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 14 |
5 files changed, 19 insertions, 24 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 034c67deb6..b61df148e8 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -276,7 +276,7 @@ SciKernelFunction kfunct_mappers[] = { // Opcode 51 is defined twice for a reason: In older SCI versions // it is CanBeHere, whereas in newer version it is CantBeHere /*51*/ DEFUN("CanBeHere", kCanBeHere, "ol*"), - /*51*/ DEFUN("CantBeHere", kCanBeHere, "ol*"), + /*51*/ DEFUN("CantBeHere", kCantBeHere, "ol*"), /*52*/ DEFUN("OnControl", kOnControl, "i*"), /*53*/ DEFUN("InitBresen", kInitBresen, "oi*"), /*54*/ DEFUN("DoBresen", kDoBresen, "o"), diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 58174ac9fb..8ba7b0ea93 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -416,6 +416,7 @@ reg_t kHiliteControl(EngineState *s, int, int argc, reg_t *argv); reg_t kClone(EngineState *s, int, int argc, reg_t *argv); reg_t kDisposeClone(EngineState *s, int, int argc, reg_t *argv); reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv); +reg_t kCantBeHere(EngineState *s, int, int argc, reg_t *argv); reg_t kSetNowSeen(EngineState *s, int, int argc, reg_t *argv); reg_t kInitBresen(EngineState *s, int, int argc, reg_t *argv); reg_t kDoBresen(EngineState *s, int, int argc, reg_t *argv); diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 07886d2fa1..025a6f4aac 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -791,7 +791,7 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { debugC(2, kDebugLevelBresen, "edgehit = %04x (illegalBits %04x)\n", edgehit, illegal_bits); if (retval == 0) { debugC(2, kDebugLevelBresen, " -> %04x\n", retval); - return not_register(s, NULL_REG); // Can't BeHere + return NULL_REG; // Can't BeHere } retval = 0; @@ -807,7 +807,7 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { && ((widget->_ID != obj.segment) || (widget->_subID != obj.offset)) && s->segMan->isObject(make_reg(widget->_ID, widget->_subID))) if (collides_with(s, abs_zone, make_reg(widget->_ID, widget->_subID), 1, GASEOUS_VIEW_MASK_ACTIVE, argc, argv)) - return not_register(s, NULL_REG); + return NULL_REG; widget = (GfxDynView *)widget->_next; } @@ -816,7 +816,7 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { if (signal & GASEOUS_VIEW_MASK_ACTIVE) { retval = signal & GASEOUS_VIEW_MASK_ACTIVE; // CanBeHere- it's either being disposed, or it ignores actors anyway debugC(2, kDebugLevelBresen, " -> %04x\n", retval); - return not_register(s, make_reg(0, retval)); // CanBeHere + return make_reg(0, retval); // CanBeHere } if (cliplist_ref.segment) @@ -837,7 +837,7 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { if (collides_with(s, abs_zone, other_obj, 0, GASEOUS_VIEW_MASK_PASSIVE, argc, argv)) { debugC(2, kDebugLevelBresen, " -> %04x\n", retval); - return not_register(s, NULL_REG); + return NULL_REG; } } // if (other_obj != obj) @@ -849,9 +849,17 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { retval = 1; debugC(2, kDebugLevelBresen, " -> %04x\n", retval); - return not_register(s, make_reg(0, retval)); + return make_reg(0, retval); } // CanBeHere +reg_t kCantBeHere(EngineState *s, int, int argc, reg_t *argv) { + // kCantBeHere does the same thing as kCanBeHere, except that + // it returns the opposite result. + reg_t result = kCanBeHere(s, 0, argc, argv); + result.offset = !result.offset; + return result; +} + reg_t kIsItSkip(EngineState *s, int, int argc, reg_t *argv) { int view = argv[0].toSint16(); int loop = argv[1].toSint16(); diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 54f0f4680b..9f7e418c91 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -365,12 +365,12 @@ reg_t kDoBresen(EngineState *s, int, int argc, reg_t *argv) { debugC(2, kDebugLevelBresen, "New data: (x,y)=(%d,%d), di=%d\n", x, y, bdi); - if (((SciEngine*)g_engine)->getKernel()->_selectorCache.cantBeHere != -1) + if (((SciEngine*)g_engine)->getKernel()->_selectorCache.cantBeHere != -1) { invoke_selector(INV_SEL(client, cantBeHere, kStopOnInvalidSelector), 0); - else + s->r_acc = make_reg(0, !s->r_acc.offset); + } else { invoke_selector(INV_SEL(client, canBeHere, kStopOnInvalidSelector), 0); - - s->r_acc = not_register(s, s->r_acc); + } if (!s->r_acc.offset) { // Contains the return value signal = GET_SEL32V(client, signal); diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index ba599739b0..46ec34f2ba 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -322,20 +322,6 @@ private: */ PaletteEntry get_pic_color(EngineState *s, int color); -// FIXME: Document this strange function. -// It seems to negate the given register but only if the "cantBeHere" exists. -// My guess: Since some SCI versions have cantBeHere and some have canBeHere, -// this function allows unifying the code, making it look identical for both -// kinds of SCI games. That's fine, but the name not_register is rather -// misleading. A different name (and a different place for declaring this) -// would be highly welcome. -static inline reg_t not_register(EngineState *s, reg_t r) { - if (((SciEngine*)g_engine)->getKernel()->_selectorCache.cantBeHere != -1) - return make_reg(0, !r.offset); - else - return r; -} - } // End of namespace Sci #endif // SCI_INCLUDE_ENGINE_H |