aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2017-03-12 16:06:03 +0100
committerEugene Sandulenko2017-03-12 16:20:00 +0100
commitd1d8fc698a769cc2746084b231426b4ec8870394 (patch)
treeaa3c9b89b5aaaed77397980ba47746329286951a
parent319bbcfbf16b04b695c0d4c3e5f57de8a2928f3e (diff)
downloadscummvm-rg350-d1d8fc698a769cc2746084b231426b4ec8870394.tar.gz
scummvm-rg350-d1d8fc698a769cc2746084b231426b4ec8870394.tar.bz2
scummvm-rg350-d1d8fc698a769cc2746084b231426b4ec8870394.zip
DIRECTOR: Lingo: Implement b_rollOver()
-rw-r--r--engines/director/lingo/lingo-builtins.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 85af1865b3..c94717ac74 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -21,7 +21,10 @@
*/
#include "common/system.h"
+#include "common/events.h"
+
#include "director/lingo/lingo.h"
+#include "director/frame.h"
namespace Director {
@@ -1216,9 +1219,27 @@ void Lingo::b_ramNeeded(int nargs) {
void Lingo::b_rollOver(int nargs) {
Datum d = g_lingo->pop();
- warning("STUB: b_rollOver(%d)", d.u.i);
- g_lingo->push(Datum(0));
+ d.toInt();
+
+ int arg = d.u.i;
+
+ d.u.i = 0; // FALSE
+
+ Frame *frame = g_director->getCurrentScore()->_frames[g_director->getCurrentScore()->getCurrentFrame()];
+
+ if (arg >= frame->_sprites.size()) {
+ g_lingo->push(d);
+ return;
+ }
+
+ Common::Point pos = g_system->getEventManager()->getMousePos();
+ uint16 spriteId = frame->getSpriteIDFromPos(pos);
+
+ if (spriteId == arg)
+ d.u.i = 1; // TRUE
+
+ g_lingo->push(d);
}
void Lingo::b_spriteBox(int nargs) {