aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-15 19:23:18 +0000
committerMartin Kiewitz2010-07-15 19:23:18 +0000
commitddd01ffcb6a5b3766892529523c912c7c623835c (patch)
tree069a493a6bf1f35613f1d7bb8a73e80bcbb99b96 /engines/sci/graphics
parent20a0ad6833fd50ed32e660a652ab962cb75d92ca (diff)
downloadscummvm-rg350-ddd01ffcb6a5b3766892529523c912c7c623835c.tar.gz
scummvm-rg350-ddd01ffcb6a5b3766892529523c912c7c623835c.tar.bz2
scummvm-rg350-ddd01ffcb6a5b3766892529523c912c7c623835c.zip
SCI: some big changes to kCantBeHere - kCantBeHere returns the actual "problem" instead of being a plain boolean - part of solving lsl1 casino door / qfg1vga gate
svn-id: r50919
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/compare.cpp20
-rw-r--r--engines/sci/graphics/compare.h4
2 files changed, 12 insertions, 12 deletions
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp
index 31c2b210ce..760108ffd2 100644
--- a/engines/sci/graphics/compare.cpp
+++ b/engines/sci/graphics/compare.cpp
@@ -70,7 +70,7 @@ uint16 GfxCompare::isOnControl(uint16 screenMask, const Common::Rect &rect) {
return result;
}
-bool GfxCompare::canBeHereCheckRectList(reg_t checkObject, const Common::Rect &checkRect, List *list) {
+reg_t GfxCompare::canBeHereCheckRectList(reg_t checkObject, const Common::Rect &checkRect, List *list) {
reg_t curAddress = list->first;
Node *curNode = _segMan->lookupNode(curAddress);
reg_t curObject;
@@ -96,14 +96,14 @@ bool GfxCompare::canBeHereCheckRectList(reg_t checkObject, const Common::Rect &c
curRect.left < checkRect.right &&
curRect.bottom > checkRect.top &&
curRect.top < checkRect.bottom) {
- return false;
+ return curObject;
}
}
}
curAddress = curNode->succ;
curNode = _segMan->lookupNode(curAddress);
}
- return true;
+ return NULL_REG;
}
uint16 GfxCompare::kernelOnControl(byte screenMask, const Common::Rect &rect) {
@@ -150,11 +150,11 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
}
}
-bool GfxCompare::kernelCanBeHere(reg_t curObject, reg_t listReference) {
+reg_t GfxCompare::kernelCanBeHere(reg_t curObject, reg_t listReference) {
Common::Rect checkRect;
Common::Rect adjustedRect;
uint16 signal, controlMask;
- bool result;
+ uint16 result;
checkRect.left = readSelectorValue(_segMan, curObject, SELECTOR(brLeft));
checkRect.top = readSelectorValue(_segMan, curObject, SELECTOR(brTop));
@@ -163,22 +163,22 @@ bool GfxCompare::kernelCanBeHere(reg_t curObject, reg_t listReference) {
if (!checkRect.isValidRect()) { // can occur in Iceman - 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 false;
+ return NULL_REG;
}
adjustedRect = _coordAdjuster->onControl(checkRect);
signal = readSelectorValue(_segMan, curObject, SELECTOR(signal));
controlMask = readSelectorValue(_segMan, curObject, SELECTOR(illegalBits));
- result = (isOnControl(GFX_SCREEN_MASK_CONTROL, adjustedRect) & controlMask) ? false : true;
- if ((result) && (signal & (kSignalIgnoreActor | kSignalRemoveView)) == 0) {
+ 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");
- result = canBeHereCheckRectList(curObject, checkRect, list);
+ return canBeHereCheckRectList(curObject, checkRect, list);
}
- return result;
+ return make_reg(0, result);
}
bool GfxCompare::kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position) {
diff --git a/engines/sci/graphics/compare.h b/engines/sci/graphics/compare.h
index be461cdc5b..1079f5f98c 100644
--- a/engines/sci/graphics/compare.h
+++ b/engines/sci/graphics/compare.h
@@ -42,7 +42,7 @@ public:
uint16 kernelOnControl(byte screenMask, const Common::Rect &rect);
void kernelSetNowSeen(reg_t objectReference);
- bool kernelCanBeHere(reg_t curObject, reg_t listReference);
+ reg_t kernelCanBeHere(reg_t curObject, reg_t listReference);
bool kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
void kernelBaseSetter(reg_t object);
@@ -60,7 +60,7 @@ private:
* *different* from checkObject, has a brRect which is contained inside
* checkRect.
*/
- bool canBeHereCheckRectList(reg_t checkObject, const Common::Rect &checkRect, List *list);
+ reg_t canBeHereCheckRectList(reg_t checkObject, const Common::Rect &checkRect, List *list);
};
} // End of namespace Sci