aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2011-10-19 20:27:43 +0300
committerFilippos Karapetis2011-10-19 20:29:05 +0300
commit513d0be10628574c98bb2588a7ef4567590228e2 (patch)
treefece4be1f2bc0224eccf799fe20879b95a1beea3 /engines/sci/engine
parent7a96bcb3eda703426d6d88a7392f520cae32bf88 (diff)
downloadscummvm-rg350-513d0be10628574c98bb2588a7ef4567590228e2.tar.gz
scummvm-rg350-513d0be10628574c98bb2588a7ef4567590228e2.tar.bz2
scummvm-rg350-513d0be10628574c98bb2588a7ef4567590228e2.zip
SCI: Merged all the code to get/set the NS rect
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kgraphics.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 5a3ba6cc4a..bd036fcac1 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1351,24 +1351,11 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
uint16 y = argv[1].toUint16();
reg_t targetObject = argv[2];
uint16 illegalBits = argv[3].offset;
- Common::Rect nsRect;
+ Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, true);
// we assume that x, y are local coordinates
- // Get the bounding rectangle of the object
- nsRect.left = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsLeft));
- nsRect.top = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsTop));
- nsRect.right = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsRight));
- nsRect.bottom = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsBottom));
-
- // nsRect top/left may be negative, adjust accordingly
- Common::Rect checkRect = nsRect;
- if (checkRect.top < 0)
- checkRect.top = 0;
- if (checkRect.left < 0)
- checkRect.left = 0;
-
- bool contained = checkRect.contains(x, y);
+ bool contained = nsRect.contains(x, y);
if (contained && illegalBits) {
// If illegalbits are set, we check the color of the pixel that got clicked on
// for now, we return false if the pixel is transparent