diff options
author | Eugene Sandulenko | 2017-03-12 19:17:32 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-03-12 19:17:32 +0100 |
commit | f802d26fa8ee3cec41d46370a0655de9c4a312a8 (patch) | |
tree | e7beb08dc9c27c172f6bd8719bc9017fa71a3ad8 | |
parent | e8fb572487a599b8b66748b765e4669e811ab8c9 (diff) | |
download | scummvm-rg350-f802d26fa8ee3cec41d46370a0655de9c4a312a8.tar.gz scummvm-rg350-f802d26fa8ee3cec41d46370a0655de9c4a312a8.tar.bz2 scummvm-rg350-f802d26fa8ee3cec41d46370a0655de9c4a312a8.zip |
DIRECTOR: Lingo: Fix b_rollOver() implementation
-rw-r--r-- | engines/director/frame.cpp | 9 | ||||
-rw-r--r-- | engines/director/frame.h | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-builtins.cpp | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index b629e43705..f19c3221ab 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -1055,4 +1055,13 @@ uint16 Frame::getSpriteIDFromPos(Common::Point pos) { return 0; } +bool Frame::checkSpriteIntersection(uint16 spriteId, Common::Point pos) { + // Find first from front to back + for (int dr = _drawRects.size() - 1; dr >= 0; dr--) + if (_drawRects[dr]->spriteId == spriteId && _drawRects[dr]->rect.contains(pos)) + return true; + + return false; +} + } // End of namespace Director diff --git a/engines/director/frame.h b/engines/director/frame.h index 704319ba0d..575d6fdbdd 100644 --- a/engines/director/frame.h +++ b/engines/director/frame.h @@ -119,6 +119,8 @@ public: void readChannel(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size); void prepareFrame(Score *score); uint16 getSpriteIDFromPos(Common::Point pos); + bool checkSpriteIntersection(uint16 spriteId, Common::Point pos); + private: void playTransition(Score *score); diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index c94717ac74..d79b201a04 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -1234,9 +1234,8 @@ void Lingo::b_rollOver(int nargs) { } Common::Point pos = g_system->getEventManager()->getMousePos(); - uint16 spriteId = frame->getSpriteIDFromPos(pos); - if (spriteId == arg) + if (frame->checkSpriteIntersection(arg, pos)) d.u.i = 1; // TRUE g_lingo->push(d); |