diff options
Diffstat (limited to 'engines')
-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); |