diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kernel.h | 2 | ||||
-rw-r--r-- | engines/sci/engine/kernel_tables.h | 4 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 9 | ||||
-rw-r--r-- | engines/sci/graphics/compare.cpp | 58 |
4 files changed, 44 insertions, 29 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index f844d96c35..d521d4f057 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -452,7 +452,7 @@ reg_t kScrollWindowShow(EngineState *s, int argc, reg_t *argv); reg_t kScrollWindowDestroy(EngineState *s, int argc, reg_t *argv); reg_t kMulDiv(EngineState *s, int argc, reg_t *argv); -reg_t kCantBeHere32(EngineState *s, int argc, reg_t *argv); +reg_t kSetNowSeen32(EngineState *s, int argc, reg_t *argv); reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv); reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv); diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 6258197206..ad07072aea 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -446,10 +446,10 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(AvoidPath), SIG_EVERYWHERE, "ii(.*)", NULL, NULL }, { MAP_CALL(BaseSetter), SIG_EVERYWHERE, "o", NULL, NULL }, { MAP_CALL(CanBeHere), SIG_EVERYWHERE, "o(l)", NULL, NULL }, + { MAP_CALL(CantBeHere), SIG_SCI16, SIGFOR_ALL, "o(l)", NULL, NULL }, #ifdef ENABLE_SCI32 - { "CantBeHere", kCantBeHere32, SIG_SCI32, SIGFOR_ALL, "ol", NULL, NULL }, + { MAP_CALL(CantBeHere), SIG_SCI32, SIGFOR_ALL, "ol", NULL, NULL }, #endif - { MAP_CALL(CantBeHere), SIG_EVERYWHERE, "o(l)", NULL, NULL }, { MAP_CALL(CelHigh), SIG_EVERYWHERE, "ii(i)", NULL, kCelHigh_workarounds }, { MAP_CALL(CelWide), SIG_EVERYWHERE, "ii(i)", NULL, kCelWide_workarounds }, { MAP_CALL(CheckFreeSpace), SIG_SCI32, SIGFOR_ALL, "r.*", NULL, NULL }, diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 9c5d214488..84506cc911 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -71,15 +71,6 @@ reg_t kIsHiRes(EngineState *s, int argc, reg_t *argv) { return make_reg(0, 1); } -// SCI32 variant, can't work like sci16 variants -reg_t kCantBeHere32(EngineState *s, int argc, reg_t *argv) { - // TODO -// reg_t curObject = argv[0]; -// reg_t listReference = (argc > 1) ? argv[1] : NULL_REG; - - return NULL_REG; -} - reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv) { debugC(6, kDebugLevelGraphics, "kAddScreenItem %x:%x (%s)", argv[0].getSegment(), argv[0].getOffset(), g_sci->getEngineState()->_segMan->getObjectName(argv[0])); g_sci->_gfxFrameout->kernelAddScreenItem(argv[0]); diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp index 8333459b64..698ad1baf1 100644 --- a/engines/sci/graphics/compare.cpp +++ b/engines/sci/graphics/compare.cpp @@ -74,11 +74,22 @@ reg_t GfxCompare::canBeHereCheckRectList(reg_t checkObject, const Common::Rect & uint16 signal; Common::Rect curRect; + uint16 flags; +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2) { + flags = kSignalIgnoreActor | kSignalHidden; + } else { +#endif + flags = kSignalIgnoreActor | kSignalRemoveView | kSignalNoUpdate; +#ifdef ENABLE_SCI32 + } +#endif + while (curNode) { curObject = curNode->value; if (curObject != checkObject) { signal = readSelectorValue(_segMan, curObject, SELECTOR(signal)); - if (!(signal & (kSignalIgnoreActor | kSignalRemoveView | kSignalNoUpdate))) { + if (!(signal & flags)) { curRect.left = readSelectorValue(_segMan, curObject, SELECTOR(brLeft)); curRect.top = readSelectorValue(_segMan, curObject, SELECTOR(brTop)); curRect.right = readSelectorValue(_segMan, curObject, SELECTOR(brRight)); @@ -151,32 +162,45 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) { reg_t GfxCompare::kernelCanBeHere(reg_t curObject, reg_t listReference) { Common::Rect checkRect; - Common::Rect adjustedRect; - uint16 signal, controlMask; uint16 result; checkRect.left = readSelectorValue(_segMan, curObject, SELECTOR(brLeft)); checkRect.top = readSelectorValue(_segMan, curObject, SELECTOR(brTop)); checkRect.right = readSelectorValue(_segMan, curObject, SELECTOR(brRight)); checkRect.bottom = readSelectorValue(_segMan, curObject, SELECTOR(brBottom)); + uint16 signal = readSelectorValue(_segMan, curObject, SELECTOR(signal)); - if (!checkRect.isValidRect()) { // can occur in Iceman and Mother Goose - HACK? TODO: is this really occuring in sierra sci? check this - warning("kCan(t)BeHere - invalid rect %d, %d -> %d, %d", checkRect.left, checkRect.top, checkRect.right, checkRect.bottom); - return NULL_REG; // this means "can be here" - } - - adjustedRect = _coordAdjuster->onControl(checkRect); +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2) { + result = 0; + if ((signal & (kSignalIgnoreActor | kSignalHidden)) == 0) { + List *list = _segMan->lookupList(listReference); + if (!list) { + error("kCanBeHere called with non-list as parameter"); + } + result = !canBeHereCheckRectList(curObject, checkRect, list).isNull(); + } + } else { +#endif + if (!checkRect.isValidRect()) { // can occur in Iceman and Mother Goose - HACK? TODO: is this really occuring in sierra sci? check this + warning("kCan(t)BeHere - invalid rect %d, %d -> %d, %d", checkRect.left, checkRect.top, checkRect.right, checkRect.bottom); + return NULL_REG; // this means "can be here" + } - signal = readSelectorValue(_segMan, curObject, SELECTOR(signal)); - controlMask = readSelectorValue(_segMan, curObject, SELECTOR(illegalBits)); - result = isOnControl(GFX_SCREEN_MASK_CONTROL, adjustedRect) & controlMask; - if ((!result) && (signal & (kSignalIgnoreActor | kSignalRemoveView)) == 0) { - List *list = _segMan->lookupList(listReference); - if (!list) - error("kCanBeHere called with non-list as parameter"); + Common::Rect adjustedRect = _coordAdjuster->onControl(checkRect); + uint16 controlMask = readSelectorValue(_segMan, curObject, SELECTOR(illegalBits)); + result = isOnControl(GFX_SCREEN_MASK_CONTROL, adjustedRect) & controlMask; + if ((!result) && (signal & (kSignalIgnoreActor | kSignalRemoveView)) == 0) { + List *list = _segMan->lookupList(listReference); + if (!list) + error("kCanBeHere called with non-list as parameter"); - return canBeHereCheckRectList(curObject, checkRect, list); + return canBeHereCheckRectList(curObject, checkRect, list); + } +#ifdef ENABLE_SCI32 } +#endif + return make_reg(0, result); } |