[Scummvm-cvs-logs] SF.net SVN: scummvm:[47502] scummvm/trunk/engines/cine/various.cpp
buddha_ at users.sourceforge.net
buddha_ at users.sourceforge.net
Sun Jan 24 17:25:08 CET 2010
Revision: 47502
http://scummvm.svn.sourceforge.net/scummvm/?rev=47502&view=rev
Author: buddha_
Date: 2010-01-24 16:25:08 +0000 (Sun, 24 Jan 2010)
Log Message:
-----------
Cine: Cleanup (Use an enumeration for mouse button states rather than values 1 and 2).
Modified Paths:
--------------
scummvm/trunk/engines/cine/various.cpp
Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp 2010-01-24 15:40:36 UTC (rev 47501)
+++ scummvm/trunk/engines/cine/various.cpp 2010-01-24 16:25:08 UTC (rev 47502)
@@ -93,6 +93,16 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
g_cine->makeSystemMenu();
}
} else {
- if (mouseButton & 1) {
- if (!(mouseButton & 2)) {
+ if (mouseButton & kLeftMouseButton) {
+ if (!(mouseButton & kRightMouseButton)) {
int16 objIdx;
int16 relEntry;
@@ -989,14 +991,7 @@
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 @@
mouseButton = di;
}
- if ((mouseButton & 1) && (mouseButton & 2)) {
+ if ((mouseButton & kLeftMouseButton) && (mouseButton & kRightMouseButton)) {
g_cine->makeSystemMenu();
}
}
@@ -1636,10 +1631,10 @@
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 @@
renderer->popMenu();
delete inputBox;
- if (quit == 2)
+ if (quit == kRightMouseButton)
return false;
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list