diff options
author | Filippos Karapetis | 2014-02-17 11:57:18 +0200 |
---|---|---|
committer | Filippos Karapetis | 2014-02-17 12:00:17 +0200 |
commit | ed400d57fce69a88c9cdaf6dde03c89e22925968 (patch) | |
tree | 589c651429226b5ae765b6377f219bc8ee58a6c9 /engines | |
parent | 9addca7287b7e22f22d80ffc04077187a0693ad3 (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 10 | ||||
-rw-r--r-- | engines/sci/graphics/compare.cpp | 10 | ||||
-rw-r--r-- | engines/sci/graphics/compare.h | 2 |
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: |