aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-02 02:10:43 +0100
committerMartin Kiewitz2016-02-02 02:10:43 +0100
commit59d2c4b27ed7481eee32578985604d9345e182b2 (patch)
treeec2043fc86d5f6d488cd160d6876cf2f1aec13ca /engines
parentc0bdbe1ca88967bddd877e14d1e99d3fedaf715e (diff)
downloadscummvm-rg350-59d2c4b27ed7481eee32578985604d9345e182b2.tar.gz
scummvm-rg350-59d2c4b27ed7481eee32578985604d9345e182b2.tar.bz2
scummvm-rg350-59d2c4b27ed7481eee32578985604d9345e182b2.zip
SCI: Do not pass/use .data for mouse button type
Also added comment about .data field. Should be renamed.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kevent.cpp2
-rw-r--r--engines/sci/event.cpp23
-rw-r--r--engines/sci/event.h2
3 files changed, 14 insertions, 13 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 0e5cd7ae12..bb595e9960 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 2d4fc0f50c..121e572a58 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 82e93a9373..885ddcef03 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