aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-15 16:36:09 +0000
committerFilippos Karapetis2010-06-15 16:36:09 +0000
commit90408a59cca70c9890f7b32bc0788f8c0418bad7 (patch)
treeeb30276b1f1782a4da1f3e69fd18d3e07ad1f28e
parent365973542c1b5abbf0d9320d85115f0ff24c3bbf (diff)
downloadscummvm-rg350-90408a59cca70c9890f7b32bc0788f8c0418bad7.tar.gz
scummvm-rg350-90408a59cca70c9890f7b32bc0788f8c0418bad7.tar.bz2
scummvm-rg350-90408a59cca70c9890f7b32bc0788f8c0418bad7.zip
Don't adjust the object's coordinates if the object does not belong to a plane in kIsOnMe(). It's now possible to start the interactive part of the Phantasmagoria 1 demo
svn-id: r49862
-rw-r--r--engines/sci/engine/kernel32.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp
index b42e0c4144..a077f110cf 100644
--- a/engines/sci/engine/kernel32.cpp
+++ b/engines/sci/engine/kernel32.cpp
@@ -834,22 +834,24 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
// Get the object's plane
reg_t planeObject = readSelector(s->_segMan, targetObject, SELECTOR(plane));
- uint16 planeResY = readSelectorValue(s->_segMan, planeObject, SELECTOR(resY));
- uint16 planeResX = readSelectorValue(s->_segMan, planeObject, SELECTOR(resX));
- uint16 planeTop = readSelectorValue(s->_segMan, planeObject, SELECTOR(top));
- uint16 planeLeft = readSelectorValue(s->_segMan, planeObject, SELECTOR(left));
- planeTop = (planeTop * g_sci->_gfxScreen->getHeight()) / planeResY;
- planeLeft = (planeLeft * g_sci->_gfxScreen->getWidth()) / planeResX;
-
- // Adjust the bounding rectangle of the object by the object's actual X, Y coordinates
- uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x));
- uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y));
- itemY = ((itemY * g_sci->_gfxScreen->getHeight()) / planeResY);
- itemX = ((itemX * g_sci->_gfxScreen->getWidth()) / planeResX);
- itemY += planeTop;
- itemX += planeLeft;
+ if (!planeObject.isNull()) {
+ uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x));
+ uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y));
+ uint16 planeResY = readSelectorValue(s->_segMan, planeObject, SELECTOR(resY));
+ uint16 planeResX = readSelectorValue(s->_segMan, planeObject, SELECTOR(resX));
+ uint16 planeTop = readSelectorValue(s->_segMan, planeObject, SELECTOR(top));
+ uint16 planeLeft = readSelectorValue(s->_segMan, planeObject, SELECTOR(left));
+ planeTop = (planeTop * g_sci->_gfxScreen->getHeight()) / planeResY;
+ planeLeft = (planeLeft * g_sci->_gfxScreen->getWidth()) / planeResX;
+
+ // Adjust the bounding rectangle of the object by the object's actual X, Y coordinates
+ itemY = ((itemY * g_sci->_gfxScreen->getHeight()) / planeResY);
+ itemX = ((itemX * g_sci->_gfxScreen->getWidth()) / planeResX);
+ itemY += planeTop;
+ itemX += planeLeft;
- nsRect.translate(itemX, itemY);
+ nsRect.translate(itemX, itemY);
+ }
//warning("kIsOnMe: (%d, %d) on object %04x:%04x, parameter %d", argv[0].toUint16(), argv[1].toUint16(), PRINT_REG(argv[2]), argv[3].toUint16());