aboutsummaryrefslogtreecommitdiff
path: root/engines/lab/mouse.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2015-07-17 10:24:34 +0300
committerEugene Sandulenko2015-12-15 00:05:02 +0100
commitf017cb624e219aa7ace135b4c2d6a3b262202f12 (patch)
tree4482f9789adc1a200031e6c0689eb96a8ad53f6f /engines/lab/mouse.cpp
parent8ebb53948d006f816510a311ae95dc963171d77c (diff)
downloadscummvm-rg350-f017cb624e219aa7ace135b4c2d6a3b262202f12.tar.gz
scummvm-rg350-f017cb624e219aa7ace135b4c2d6a3b262202f12.tar.bz2
scummvm-rg350-f017cb624e219aa7ace135b4c2d6a3b262202f12.zip
LAB: Use CamelCase, and simplify mouseHandler()
Diffstat (limited to 'engines/lab/mouse.cpp')
-rw-r--r--engines/lab/mouse.cpp54
1 files changed, 15 insertions, 39 deletions
diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp
index 591014c595..8636ad7733 100644
--- a/engines/lab/mouse.cpp
+++ b/engines/lab/mouse.cpp
@@ -37,7 +37,6 @@
namespace Lab {
extern bool IsHiRes;
-extern uint32 VGAScreenWidth, VGAScreenHeight;
static bool LeftClick = false;
static bool RightClick = false;
@@ -65,7 +64,6 @@ static byte MouseData[] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
#define MOUSE_WIDTH 10
#define MOUSE_HEIGHT 15
-static bool gadhit = false;
static Gadget *hitgad = NULL;
/*****************************************************************************/
@@ -81,7 +79,6 @@ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) {
(y <= (gadlist->y + gadlist->Im->Height)) &&
!(GADGETOFF & gadlist->GadgetFlags)) {
if (IsHiRes) {
- gadhit = true;
hitgad = gadlist;
} else {
VGAStorePage();
@@ -116,47 +113,36 @@ void attachGadgetList(Gadget *GadList) {
ScreenGadgetList = GadList;
}
-static Gadget *TempGad;
+void mouseHandler(int32 flag, int32 mouseX, int32 mouseY) {
+ if (NumHidden >= 2)
+ return;
-
-void mouse_handler(int32 flag, int32 mouseX, int32 mouseY) {
if (!IsHiRes)
mouseX /= 2;
- if (flag & 0x01) { /* mouse Move */
- }
-
- if ((flag & 0x02) && (NumHidden < 2)) { /* Left mouse button click */
+ if (flag & 0x02) { /* Left mouse button click */
+ Gadget *tmp = NULL;
if (ScreenGadgetList)
- TempGad = checkGadgetHit(ScreenGadgetList, mouseX, mouseY);
- else
- TempGad = NULL;
+ tmp = checkGadgetHit(ScreenGadgetList, mouseX, mouseY);
- if (TempGad) {
- LastGadgetHit = TempGad;
- } else {
+ if (tmp)
+ LastGadgetHit = tmp;
+ else
LeftClick = true;
- }
}
- if ((flag & 0x08) && (NumHidden < 2)) { /* Right mouse button click */
+ if (flag & 0x08) /* Right mouse button click */
RightClick = true;
- }
}
-
-
-
void updateMouse() {
uint16 counter;
bool doUpdateDisplay = false;
- if (!MouseHidden) {
+ if (!MouseHidden)
doUpdateDisplay = true;
- }
- if (gadhit) {
- gadhit = false;
+ if (hitgad) {
mouseHide();
drawImage(hitgad->ImAlt, hitgad->x, hitgad->y);
mouseShow();
@@ -168,6 +154,7 @@ void updateMouse() {
drawImage(hitgad->Im, hitgad->x, hitgad->y);
mouseShow();
doUpdateDisplay = true;
+ hitgad = NULL;
}
if (doUpdateDisplay)
@@ -175,23 +162,17 @@ void updateMouse() {
}
-
-
/*****************************************************************************/
/* Initializes the mouse. */
/*****************************************************************************/
-bool initMouse() {
+void initMouse() {
g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0);
g_system->showMouse(false);
mouseMove(0, 0);
-
- return true;
}
-
-
/*****************************************************************************/
/* Shows the mouse. */
/*****************************************************************************/
@@ -237,8 +218,6 @@ void mouseXY(uint16 *x, uint16 *y) {
}
-
-
/*****************************************************************************/
/* Moves the mouse to new co-ordinates. */
/*****************************************************************************/
@@ -248,14 +227,11 @@ void mouseMove(uint16 x, uint16 y) {
g_system->warpMouse(x, y);
- if (!MouseHidden) {
+ if (!MouseHidden)
WSDL_ProcessInput(0);
- }
}
-
-
/*****************************************************************************/
/* Checks whether or not the mouse buttons have been pressed, and the last */
/* co-ordinates of the button press. leftbutton tells whether to check the */