aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorKari Salminen2010-01-24 16:25:08 +0000
committerKari Salminen2010-01-24 16:25:08 +0000
commit53d8bd976034975b46d41227729e5aee64a3ce17 (patch)
tree21f95624c86fffe4c4a435d5787414ce6b095d64 /engines
parent4eb077dcf374a77bdffb1e0a80ea0da31886f86b (diff)
downloadscummvm-rg350-53d8bd976034975b46d41227729e5aee64a3ce17.tar.gz
scummvm-rg350-53d8bd976034975b46d41227729e5aee64a3ce17.tar.bz2
scummvm-rg350-53d8bd976034975b46d41227729e5aee64a3ce17.zip
Cine: Cleanup (Use an enumeration for mouse button states rather than values 1 and 2).
svn-id: r47502
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/various.cpp57
1 files changed, 26 insertions, 31 deletions
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 1228aa8e42..3b141cb435 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -93,6 +93,16 @@ uint16 musicIsPlaying;
byte isInPause = 0;
+/*! \brief Bit masks for mouse buttons' states
+ * Bit on = mouse button down
+ * Bit off = mouse button up
+ */
+enum MouseButtonState
+{
+ kLeftMouseButton = (1 << 0),
+ kRightMouseButton = (1 << 1)
+};
+
/*! \brief Values used by the xMoveKeyb variable */
enum xMoveKeybEnums {
kKeybMoveCenterX = 0,
@@ -846,16 +856,8 @@ uint16 executePlayerInput() {
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
while (mouseButton && currentEntry < 200) {
- if (mouseButton & 1) {
- di |= 1;
- }
-
- if (mouseButton & 2) {
- di |= 2;
- }
-
+ di |= (mouseButton & (kLeftMouseButton | kRightMouseButton));
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
-
currentEntry++;
}
@@ -864,8 +866,8 @@ uint16 executePlayerInput() {
}
if (playerCommand != -1) {
- if (mouseButton & 1) {
- if (mouseButton & 2) {
+ if (mouseButton & kLeftMouseButton) {
+ if (mouseButton & kRightMouseButton) {
g_cine->makeSystemMenu();
} else {
int16 si;
@@ -913,8 +915,8 @@ uint16 executePlayerInput() {
globalVars[VAR_MOUSE_Y_POS] = mouseY;
}
}
- } else if (mouseButton & 2) {
- if (mouseButton & 1) {
+ } else if (mouseButton & kRightMouseButton) {
+ if (mouseButton & kLeftMouseButton) {
g_cine->makeSystemMenu();
}
@@ -936,8 +938,8 @@ uint16 executePlayerInput() {
commandVar2 = objIdx;
}
} else {
- if (mouseButton & 2) {
- if (!(mouseButton & 1)) {
+ if (mouseButton & kRightMouseButton) {
+ if (!(mouseButton & kLeftMouseButton)) {
if (g_cine->getGameType() == Cine::GType_OS) {
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true);
@@ -954,8 +956,8 @@ uint16 executePlayerInput() {
g_cine->makeSystemMenu();
}
} else {
- if (mouseButton & 1) {
- if (!(mouseButton & 2)) {
+ if (mouseButton & kLeftMouseButton) {
+ if (!(mouseButton & kRightMouseButton)) {
int16 objIdx;
int16 relEntry;
@@ -989,14 +991,7 @@ uint16 executePlayerInput() {
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
while (mouseButton && !g_cine->shouldQuit()) {
- if (mouseButton & 1) {
- di |= 1;
- }
-
- if (mouseButton & 2) {
- di |= 2;
- }
-
+ di |= (mouseButton & (kLeftMouseButton | kRightMouseButton));
manageEvents();
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
}
@@ -1005,7 +1000,7 @@ uint16 executePlayerInput() {
mouseButton = di;
}
- if ((mouseButton & 1) && (mouseButton & 2)) {
+ if ((mouseButton & kLeftMouseButton) && (mouseButton & kRightMouseButton)) {
g_cine->makeSystemMenu();
}
}
@@ -1636,10 +1631,10 @@ bool makeTextEntryMenu(const char *messagePtr, char *inputString, int stringMaxL
getMouseData(0, &mouseButton, &mouseX, &mouseY);
- if ((mouseButton & 2) || g_cine->shouldQuit())
- quit = 2;
- else if (mouseButton & 1)
- quit = 1;
+ if ((mouseButton & kRightMouseButton) || g_cine->shouldQuit())
+ quit = kRightMouseButton;
+ else if (mouseButton & kLeftMouseButton)
+ quit = kLeftMouseButton;
switch (keycode) {
case Common::KEYCODE_BACKSPACE:
@@ -1704,7 +1699,7 @@ bool makeTextEntryMenu(const char *messagePtr, char *inputString, int stringMaxL
renderer->popMenu();
delete inputBox;
- if (quit == 2)
+ if (quit == kRightMouseButton)
return false;
return true;