aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kgraphics32.cpp10
-rw-r--r--engines/sci/graphics/compare.cpp10
-rw-r--r--engines/sci/graphics/compare.h2
3 files changed, 11 insertions, 11 deletions
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index cd735d1233..0eb4fa856b 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -142,7 +142,15 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
uint16 y = argv[1].toUint16();
reg_t targetObject = argv[2];
uint16 illegalBits = argv[3].getOffset();
- Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, true);
+ Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject);
+
+ uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x));
+ uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y));
+ // If top and left are negative, we need to adjust coordinates by the item's x and y
+ if (nsRect.left < 0)
+ nsRect.translate(itemX, 0);
+ if (nsRect.top < 0)
+ nsRect.translate(0, itemY);
// we assume that x, y are local coordinates
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp
index b42063b119..8b89cf4a65 100644
--- a/engines/sci/graphics/compare.cpp
+++ b/engines/sci/graphics/compare.cpp
@@ -241,21 +241,13 @@ void GfxCompare::kernelBaseSetter(reg_t object) {
}
}
-Common::Rect GfxCompare::getNSRect(reg_t object, bool fixRect) {
+Common::Rect GfxCompare::getNSRect(reg_t object) {
Common::Rect nsRect;
nsRect.top = readSelectorValue(_segMan, object, SELECTOR(nsTop));
nsRect.left = readSelectorValue(_segMan, object, SELECTOR(nsLeft));
nsRect.bottom = readSelectorValue(_segMan, object, SELECTOR(nsBottom));
nsRect.right = readSelectorValue(_segMan, object, SELECTOR(nsRight));
- if (fixRect) {
- // nsRect top/left may be negative, adjust accordingly
- if (nsRect.top < 0)
- nsRect.top = 0;
- if (nsRect.left < 0)
- nsRect.left = 0;
- }
-
return nsRect;
}
diff --git a/engines/sci/graphics/compare.h b/engines/sci/graphics/compare.h
index 0080406a3b..48e9e376b5 100644
--- a/engines/sci/graphics/compare.h
+++ b/engines/sci/graphics/compare.h
@@ -42,7 +42,7 @@ public:
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);
- Common::Rect getNSRect(reg_t object, bool fixRect = false);
+ Common::Rect getNSRect(reg_t object);
void setNSRect(reg_t object, Common::Rect nsRect);
private: