aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorLars Skovlund2011-03-09 20:19:50 +0100
committerLars Skovlund2011-03-09 20:19:50 +0100
commit354e7d05888c69f1af9778ecd065ffc02505fa4b (patch)
tree2e2ea11e871cada74dccbfacc320cc7104c9f37c /engines/sci/engine
parenta55a211ddc270e8f9f292874b1a8e5881b572294 (diff)
parent0d271324db406bcdfe51ae4b8ebf30eebef32860 (diff)
downloadscummvm-rg350-354e7d05888c69f1af9778ecd065ffc02505fa4b.tar.gz
scummvm-rg350-354e7d05888c69f1af9778ecd065ffc02505fa4b.tar.bz2
scummvm-rg350-354e7d05888c69f1af9778ecd065ffc02505fa4b.zip
Merge branch 'master' of github.com:scummvm/scummvm
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kevent.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index e5a9931605..2540861a93 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -46,17 +46,18 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
SegManager *segMan = s->_segMan;
Common::Point mousePos;
- // Limit the mouse cursor position, if necessary
- g_sci->_gfxCursor->refreshPosition();
- mousePos = g_sci->_gfxCursor->getPosition();
-#ifdef ENABLE_SCI32
- if (getSciVersion() >= SCI_VERSION_2_1)
- g_sci->_gfxCoordAdjuster->fromDisplayToScript(mousePos.y, mousePos.x);
-#endif
-
// If there's a simkey pending, and the game wants a keyboard event, use the
// simkey instead of a normal event
if (g_debug_simulated_key && (mask & SCI_EVENT_KEYBOARD)) {
+ // In case we use a simulated event we query the current mouse position
+ mousePos = g_sci->_gfxCursor->getPosition();
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2_1)
+ g_sci->_gfxCoordAdjuster->fromDisplayToScript(mousePos.y, mousePos.x);
+#endif
+ // Limit the mouse cursor position, if necessary
+ g_sci->_gfxCursor->refreshPosition();
+
writeSelectorValue(segMan, obj, SELECTOR(type), SCI_EVENT_KEYBOARD); // Keyboard event
writeSelectorValue(segMan, obj, SELECTOR(message), g_debug_simulated_key);
writeSelectorValue(segMan, obj, SELECTOR(modifiers), SCI_KEYMOD_NUMLOCK); // Numlock on
@@ -68,6 +69,15 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
curEvent = g_sci->getEventManager()->getSciEvent(mask);
+ // For a real event we use its associated mouse position
+ mousePos = curEvent.mousePos;
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2_1)
+ g_sci->_gfxCoordAdjuster->fromDisplayToScript(mousePos.y, mousePos.x);
+#endif
+ // Limit the mouse cursor position, if necessary
+ g_sci->_gfxCursor->refreshPosition();
+
if (g_sci->getVocabulary())
g_sci->getVocabulary()->parser_event = NULL_REG; // Invalidate parser event