[Scummvm-cvs-logs] scummvm master -> 59d2c4b27ed7481eee32578985604d9345e182b2

m-kiewitz m_kiewitz at users.sourceforge.net
Tue Feb 2 02:10:36 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:
59d2c4b27e SCI: Do not pass/use .data for mouse button type


Commit: 59d2c4b27ed7481eee32578985604d9345e182b2
    https://github.com/scummvm/scummvm/commit/59d2c4b27ed7481eee32578985604d9345e182b2
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-02T02:10:43+01:00

Commit Message:
SCI: Do not pass/use .data for mouse button type

Also added comment about .data field. Should be renamed.

Changed paths:
    engines/sci/engine/kevent.cpp
    engines/sci/event.cpp
    engines/sci/event.h



diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 0e5cd7a..bb595e9 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -152,7 +152,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
 	case SCI_EVENT_MOUSE_RELEASE:
 	case SCI_EVENT_MOUSE_PRESS:
 		// track left buttton clicks, if requested
-		if (curEvent.type == SCI_EVENT_MOUSE_PRESS && curEvent.data == 1 && g_debug_track_mouse_clicks) {
+		if (curEvent.type == SCI_EVENT_MOUSE_PRESS && curEvent.modifiers == 0 && g_debug_track_mouse_clicks) {
 			g_sci->getSciDebugger()->debugPrintf("Mouse clicked at %d, %d\n",
 						mousePos.x, mousePos.y);
 		}
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 2d4fc0f..121e572 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -94,16 +94,15 @@ const SciKeyConversion keyMappings[] = {
 struct MouseEventConversion {
 	Common::EventType commonType;
 	short sciType;
-	short data;
 };
 
 const MouseEventConversion mouseEventMappings[] = {
-	{ Common::EVENT_LBUTTONDOWN,   SCI_EVENT_MOUSE_PRESS, 1 },
-	{ Common::EVENT_RBUTTONDOWN,   SCI_EVENT_MOUSE_PRESS, 2 },
-	{ Common::EVENT_MBUTTONDOWN,   SCI_EVENT_MOUSE_PRESS, 3 },
-	{   Common::EVENT_LBUTTONUP, SCI_EVENT_MOUSE_RELEASE, 1 },
-	{   Common::EVENT_RBUTTONUP, SCI_EVENT_MOUSE_RELEASE, 2 },
-	{   Common::EVENT_MBUTTONUP, SCI_EVENT_MOUSE_RELEASE, 3 }
+	{ Common::EVENT_LBUTTONDOWN,   SCI_EVENT_MOUSE_PRESS },
+	{ Common::EVENT_RBUTTONDOWN,   SCI_EVENT_MOUSE_PRESS },
+	{ Common::EVENT_MBUTTONDOWN,   SCI_EVENT_MOUSE_PRESS },
+	{   Common::EVENT_LBUTTONUP, SCI_EVENT_MOUSE_RELEASE },
+	{   Common::EVENT_RBUTTONUP, SCI_EVENT_MOUSE_RELEASE },
+	{   Common::EVENT_MBUTTONUP, SCI_EVENT_MOUSE_RELEASE }
 };
 
 EventManager::EventManager(bool fontIsExtended) : _fontIsExtended(fontIsExtended) {
@@ -189,18 +188,20 @@ SciEvent EventManager::getScummVMEvent() {
 	for (int i = 0; i < ARRAYSIZE(mouseEventMappings); i++) {
 		if (mouseEventMappings[i].commonType == ev.type) {
 			input.type = mouseEventMappings[i].sciType;
-			input.data = mouseEventMappings[i].data;
 			// Sierra passed keyboard modifiers for mouse events, too.
 
 			// Sierra also set certain modifiers within their mouse interrupt handler
 			// This whole thing was probably meant for people using a mouse, that only featured 1 button
 			// So the user was able to press Ctrl and click the mouse button to create a right click.
-			switch (input.data) {
-			case 2: // right button click
+			switch (ev.type) {
+			case Common::EVENT_RBUTTONDOWN: // right button
+			case Common::EVENT_RBUTTONUP:
 				input.modifiers |= (SCI_KEYMOD_RSHIFT | SCI_KEYMOD_LSHIFT); // this value was hardcoded in the mouse interrupt handler
 				break;
-			case 3: //  middle button click
+			case Common::EVENT_MBUTTONDOWN: // middle button
+			case Common::EVENT_MBUTTONUP:
 				input.modifiers |= SCI_KEYMOD_CTRL; // this value was hardcoded in the mouse interrupt handler
+				break;
 			default:
 				break;
 			}
diff --git a/engines/sci/event.h b/engines/sci/event.h
index 82e93a9..885ddce 100644
--- a/engines/sci/event.h
+++ b/engines/sci/event.h
@@ -30,7 +30,7 @@ namespace Sci {
 
 struct SciEvent {
 	short type;
-	short data;
+	short data; // holds the ScummVM system keycode TODO: rename
 	short modifiers;
 	/**
 	 * For keyboard events: 'data' after applying






More information about the Scummvm-git-logs mailing list