[Scummvm-cvs-logs] scummvm master -> 4ebca0353461cf4461f3425d52a7b82eb9fd983f

m-kiewitz m_kiewitz at users.sourceforge.net
Sat Mar 5 21:27:20 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4ebca03534 SCI: Make cursor workaround work properly on OpenPandora


Commit: 4ebca0353461cf4461f3425d52a7b82eb9fd983f
    https://github.com/scummvm/scummvm/commit/4ebca0353461cf4461f3425d52a7b82eb9fd983f
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-03-05T21:28:09+01:00

Commit Message:
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.

Changed paths:
    engines/sci/engine/kevent.cpp
    engines/sci/engine/state.h
    engines/sci/graphics/cursor.cpp



diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index bb595e9..2543421 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;
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 6efc56e..cf9a753 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -143,6 +143,7 @@ public:
 	uint _chosenQfGImportItem; // Remembers the item selected in QfG import rooms
 
 	bool _cursorWorkaroundActive; // Refer to GfxCursor::setPosition()
+	int16 _cursorWorkaroundPosCount; // When the cursor is reported to be at the previously set coordinate, we won't disable the workaround unless it happened for this many times
 	Common::Point _cursorWorkaroundPoint;
 	Common::Rect _cursorWorkaroundRect;
 
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index e8496b9..f5dd473 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -336,6 +336,9 @@ void GfxCursor::setPosition(Common::Point pos) {
 			&& ((workaround->newPositionX == pos.x) && (workaround->newPositionY == pos.y))) {
 			EngineState *s = g_sci->getEngineState();
 			s->_cursorWorkaroundActive = true;
+			// At least on OpenPandora it seems that the cursor is actually set, but a bit afterwards
+			// touch screen controls will overwrite the position. More information see kGetEvent in kevent.cpp.
+			s->_cursorWorkaroundPosCount = 5; // should be enough for OpenPandora
 			s->_cursorWorkaroundPoint = pos;
 			s->_cursorWorkaroundRect = Common::Rect(workaround->rectLeft, workaround->rectTop, workaround->rectRight, workaround->rectBottom);
 			return;






More information about the Scummvm-git-logs mailing list