aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kevent.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2016-03-05 21:28:09 +0100
committerMartin Kiewitz2016-03-05 21:28:09 +0100
commit4ebca0353461cf4461f3425d52a7b82eb9fd983f (patch)
tree20b8acfd24b1255ff0a0bb5c5833a90c28babf62 /engines/sci/engine/kevent.cpp
parent04b5f3833771c3073df5860c023c8274706dbbc7 (diff)
downloadscummvm-rg350-4ebca0353461cf4461f3425d52a7b82eb9fd983f.tar.gz
scummvm-rg350-4ebca0353461cf4461f3425d52a7b82eb9fd983f.tar.bz2
scummvm-rg350-4ebca0353461cf4461f3425d52a7b82eb9fd983f.zip
SCI: Make cursor workaround work properly on OpenPandora
Other platforms, that support analog stick + touch screen at the same time, are possibly also affected. Cursor workarounds exist for qfg1vga, qfg3, lsl5 and Island of Dr. Brain. Those sometimes worked and sometimes didn't on at least OpenPandora and should be fixed now.
Diffstat (limited to 'engines/sci/engine/kevent.cpp')
-rw-r--r--engines/sci/engine/kevent.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index bb595e9960..254342111b 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -101,7 +101,25 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
// question. Check GfxCursor::setPosition(), for a more detailed
// explanation and a list of cursor position workarounds.
if (s->_cursorWorkaroundRect.contains(mousePos.x, mousePos.y)) {
- s->_cursorWorkaroundActive = false;
+ // For OpenPandora and possibly other platforms, that support analog-stick control + touch screen
+ // control at the same time: in case the cursor is currently at the coordinate set by the scripts,
+ // we will count down instead of immediately disabling the workaround.
+ // On OpenPandora the cursor position is set, but it's overwritten shortly afterwards by the
+ // touch screen. In this case we would sometimes disable the workaround, simply because the touch
+ // screen hasn't yet overwritten the position and thus the workaround would not work anymore.
+ // On OpenPandora it would sometimes work and sometimes not without this.
+ if (s->_cursorWorkaroundPoint == mousePos) {
+ // Cursor is still at the same spot as set by the scripts
+ if (s->_cursorWorkaroundPosCount > 0) {
+ s->_cursorWorkaroundPosCount--;
+ } else {
+ // Was for quite a bit of time at that spot, so disable workaround now
+ s->_cursorWorkaroundActive = false;
+ }
+ } else {
+ // Cursor has moved, but is within the rect -> disable workaround immediately
+ s->_cursorWorkaroundActive = false;
+ }
} else {
mousePos.x = s->_cursorWorkaroundPoint.x;
mousePos.y = s->_cursorWorkaroundPoint.y;