diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/engine.cpp | 4 | ||||
-rw-r--r-- | engines/lab/mouse.cpp | 54 | ||||
-rw-r--r-- | engines/lab/mouse.h | 4 | ||||
-rw-r--r-- | engines/lab/vga.cpp | 6 |
4 files changed, 21 insertions, 47 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 69ebae6548..37e86fba81 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -1400,9 +1400,7 @@ void LabEngine::go() { mem = mem && setUpScreens(); } - if (!initMouse()) { - return; - } + initMouse(); mem = mem && initRoomBuffer() && initLabText(); 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 */ diff --git a/engines/lab/mouse.h b/engines/lab/mouse.h index 18e5c2caca..5dd77fb964 100644 --- a/engines/lab/mouse.h +++ b/engines/lab/mouse.h @@ -37,7 +37,7 @@ namespace Lab { struct Gadget; -bool initMouse(); +void initMouse(); void updateMouse(); @@ -55,7 +55,7 @@ Gadget *mouseGadget(); void attachGadgetList(Gadget *GadList); -void mouse_handler(int32 flag, int32 mouseX, int32 mouseY); +void mouseHandler(int32 flag, int32 mouseX, int32 mouseY); } // End of namespace Lab diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index d9633e97b5..388af2d4c7 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -135,12 +135,12 @@ void WSDL_ProcessInput(bool can_delay) { switch (event.type) { case Common::EVENT_RBUTTONDOWN: flags |= 8; - mouse_handler(flags, g_MouseX, g_MouseY); + mouseHandler(flags, g_MouseX, g_MouseY); break; case Common::EVENT_LBUTTONDOWN: flags |= 2; - mouse_handler(flags, g_MouseX, g_MouseY); + mouseHandler(flags, g_MouseX, g_MouseY); break; case Common::EVENT_MOUSEMOVE: @@ -167,7 +167,7 @@ void WSDL_ProcessInput(bool can_delay) { } if (!lastMouseAtEdge || !g_MouseAtEdge) - mouse_handler(1, g_MouseX, g_MouseY); + mouseHandler(1, g_MouseX, g_MouseY); break; |