aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2014-02-17 11:57:18 +0200
committerFilippos Karapetis2014-02-17 12:00:17 +0200
commited400d57fce69a88c9cdaf6dde03c89e22925968 (patch)
tree589c651429226b5ae765b6377f219bc8ee58a6c9 /engines/sci/engine
parent9addca7287b7e22f22d80ffc04077187a0693ad3 (diff)
downloadscummvm-rg350-ed400d57fce69a88c9cdaf6dde03c89e22925968.tar.gz
scummvm-rg350-ed400d57fce69a88c9cdaf6dde03c89e22925968.tar.bz2
scummvm-rg350-ed400d57fce69a88c9cdaf6dde03c89e22925968.zip
SCI: Fix NS rect calculation in GK1 (and SCI32 in general)
This fixes the regressions caused by refactoring in SCI32. Thanks to Timo Korvola for tracking down the issue and providing an initial patch in bug #6452
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kgraphics32.cpp10
1 files changed, 9 insertions, 1 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