mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-06 18:00:44 +00:00
LAB: Use CamelCase, and simplify mouseHandler()
This commit is contained in:
parent
8ebb53948d
commit
f017cb624e
@ -1400,9 +1400,7 @@ void LabEngine::go() {
|
||||
mem = mem && setUpScreens();
|
||||
}
|
||||
|
||||
if (!initMouse()) {
|
||||
return;
|
||||
}
|
||||
initMouse();
|
||||
|
||||
mem = mem && initRoomBuffer() &&
|
||||
initLabText();
|
||||
|
@ -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);
|
||||
tmp = checkGadgetHit(ScreenGadgetList, mouseX, mouseY);
|
||||
|
||||
if (tmp)
|
||||
LastGadgetHit = tmp;
|
||||
else
|
||||
TempGad = NULL;
|
||||
|
||||
if (TempGad) {
|
||||
LastGadgetHit = TempGad;
|
||||
} 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 */
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user