DIRECTOR: Lingo: Fix b_rollOver() implementation

This commit is contained in:
Eugene Sandulenko 2017-03-12 19:17:32 +01:00
parent e8fb572487
commit f802d26fa8
3 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);