LAB: Some rework related to the mouse code
This commit is contained in:
parent
ff2def7da1
commit
c485d9e8a6
11 changed files with 108 additions and 119 deletions
|
@ -638,7 +638,7 @@ void LabEngine::mainGameLoop() {
|
|||
IntuiMessage *Msg;
|
||||
uint32 Class;
|
||||
|
||||
uint16 Qualifier, MouseX, MouseY, ActionMode = 4;
|
||||
uint16 Qualifier, ActionMode = 4;
|
||||
uint16 CurInv = MAPNUM, LastInv = MAPNUM, Old;
|
||||
|
||||
bool ForceDraw = false, doit, GotMessage = true;
|
||||
|
@ -742,6 +742,7 @@ void LabEngine::mainGameLoop() {
|
|||
interfaceOn();
|
||||
Msg = getMsg();
|
||||
|
||||
Common::Point curPos;
|
||||
if (Msg == NULL) { /* Does music load and next animation frame when you've run out of messages */
|
||||
GotMessage = false;
|
||||
g_music->checkRoomMusic();
|
||||
|
@ -752,22 +753,16 @@ void LabEngine::mainGameLoop() {
|
|||
int result = followCrumbs();
|
||||
|
||||
if (result != 0) {
|
||||
int x = 0, y = 0;
|
||||
|
||||
WSDL_GetMousePos(&x, &y);
|
||||
|
||||
curPos = WSDL_GetMousePos();
|
||||
Class = GADGETUP;
|
||||
Qualifier = 0;
|
||||
MouseX = x;
|
||||
MouseY = y;
|
||||
|
||||
if (result == VKEY_UPARROW) {
|
||||
if (result == VKEY_UPARROW)
|
||||
code = GadID = 7;
|
||||
} else if (result == VKEY_LTARROW) {
|
||||
else if (result == VKEY_LTARROW)
|
||||
code = GadID = 6;
|
||||
} else if (result == VKEY_RTARROW) {
|
||||
else if (result == VKEY_RTARROW)
|
||||
code = GadID = 8;
|
||||
}
|
||||
|
||||
GotMessage = true;
|
||||
mayShowCrumbIndicator();
|
||||
|
@ -784,8 +779,8 @@ void LabEngine::mainGameLoop() {
|
|||
Class = Msg->msgClass;
|
||||
code = Msg->code;
|
||||
Qualifier = Msg->qualifier;
|
||||
MouseX = Msg->mouseX;
|
||||
MouseY = Msg->mouseY;
|
||||
curPos.x = Msg->mouseX;
|
||||
curPos.y = Msg->mouseY;
|
||||
GadID = Msg->gadgetID;
|
||||
|
||||
FollowingCrumbs = false;
|
||||
|
@ -797,7 +792,7 @@ from_crumbs:
|
|||
if (code == 13) { /* The return key */
|
||||
Class = MOUSEBUTTONS;
|
||||
Qualifier = IEQUALIFIER_LEFTBUTTON;
|
||||
mouseXY(&MouseX, &MouseY);
|
||||
curPos = getMousePos();
|
||||
} else if (g_lab->getPlatform() == Common::kPlatformWindows &&
|
||||
(code == 'b' || code == 'B')) { /* Start bread crumbs */
|
||||
BreadCrumbs[0].RoomNum = 0;
|
||||
|
@ -1169,10 +1164,10 @@ from_crumbs:
|
|||
doit = false;
|
||||
|
||||
if (CPtr) {
|
||||
if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labrinth specific code */
|
||||
mouseCombination(MouseX, MouseY);
|
||||
if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */
|
||||
mouseCombination(curPos);
|
||||
else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay)
|
||||
mouseTile(MouseX, MouseY);
|
||||
mouseTile(curPos);
|
||||
else
|
||||
doit = true;
|
||||
} else
|
||||
|
@ -1184,48 +1179,48 @@ from_crumbs:
|
|||
eatMessages();
|
||||
|
||||
if (ActionMode == 0) { /* Take something. */
|
||||
if (doActionRule(MouseX, MouseY, ActionMode, RoomNum, &CPtr))
|
||||
if (doActionRule(Common::Point(curPos.x, curPos.y), ActionMode, RoomNum, &CPtr))
|
||||
CurFileName = NewFileName;
|
||||
else if (takeItem(MouseX, MouseY, &CPtr))
|
||||
else if (takeItem(curPos.x, curPos.y, &CPtr))
|
||||
drawStaticMessage(kTextTakeItem);
|
||||
else if (doActionRule(MouseX, MouseY, TAKEDEF - 1, RoomNum, &CPtr))
|
||||
else if (doActionRule(curPos, TAKEDEF - 1, RoomNum, &CPtr))
|
||||
CurFileName = NewFileName;
|
||||
else if (doActionRule(MouseX, MouseY, TAKE - 1, 0, &CPtr))
|
||||
else if (doActionRule(curPos, TAKE - 1, 0, &CPtr))
|
||||
CurFileName = NewFileName;
|
||||
else if (MouseY < (VGAScaleY(149) + SVGACord(2)))
|
||||
else if (curPos.y < (VGAScaleY(149) + SVGACord(2)))
|
||||
drawStaticMessage(kTextNothing);
|
||||
} else if ((ActionMode == 1) /* Manipulate an object */ ||
|
||||
(ActionMode == 2) /* Open up a "door" */ ||
|
||||
(ActionMode == 3)) { /* Close a "door" */
|
||||
if (doActionRule(MouseX, MouseY, ActionMode, RoomNum, &CPtr))
|
||||
if (doActionRule(curPos, ActionMode, RoomNum, &CPtr))
|
||||
CurFileName = NewFileName;
|
||||
else if (!doActionRule(MouseX, MouseY, ActionMode, 0, &CPtr)) {
|
||||
if (MouseY < (VGAScaleY(149) + SVGACord(2)))
|
||||
else if (!doActionRule(curPos, ActionMode, 0, &CPtr)) {
|
||||
if (curPos.y < (VGAScaleY(149) + SVGACord(2)))
|
||||
drawStaticMessage(kTextNothing);
|
||||
}
|
||||
} else if (ActionMode == 4) { /* Look at closeups */
|
||||
TempCPtr = CPtr;
|
||||
setCurClose(MouseX, MouseY, &TempCPtr);
|
||||
setCurClose(curPos, &TempCPtr);
|
||||
|
||||
if (CPtr == TempCPtr) {
|
||||
if (MouseY < (VGAScaleY(149) + SVGACord(2)))
|
||||
if (curPos.y < (VGAScaleY(149) + SVGACord(2)))
|
||||
drawStaticMessage(kTextNothing);
|
||||
} else if (TempCPtr->GraphicName) {
|
||||
if (*(TempCPtr->GraphicName)) {
|
||||
DoBlack = true;
|
||||
CPtr = TempCPtr;
|
||||
} else if (MouseY < (VGAScaleY(149) + SVGACord(2)))
|
||||
} else if (curPos.y < (VGAScaleY(149) + SVGACord(2)))
|
||||
drawStaticMessage(kTextNothing);
|
||||
} else if (MouseY < (VGAScaleY(149) + SVGACord(2)))
|
||||
} else if (curPos.y < (VGAScaleY(149) + SVGACord(2)))
|
||||
drawStaticMessage(kTextNothing);
|
||||
} else if ((ActionMode == 5) &&
|
||||
g_lab->_conditions->in(CurInv)) { /* Use an item on something else */
|
||||
if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) {
|
||||
if (doOperateRule(curPos.x, curPos.y, CurInv, &CPtr)) {
|
||||
CurFileName = NewFileName;
|
||||
|
||||
if (!g_lab->_conditions->in(CurInv))
|
||||
decIncInv(&CurInv, false);
|
||||
} else if (MouseY < (VGAScaleY(149) + SVGACord(2)))
|
||||
} else if (curPos.y < (VGAScaleY(149) + SVGACord(2)))
|
||||
drawStaticMessage(kTextNothing);
|
||||
}
|
||||
}
|
||||
|
@ -1238,7 +1233,7 @@ from_crumbs:
|
|||
|
||||
if (HCPtr == NULL) {
|
||||
TempCPtr = CPtr;
|
||||
setCurClose(MouseX, MouseY, &TempCPtr);
|
||||
setCurClose(curPos, &TempCPtr);
|
||||
|
||||
if ((TempCPtr == NULL) || (TempCPtr == CPtr)) {
|
||||
if (CPtr == NULL)
|
||||
|
@ -1259,7 +1254,7 @@ from_crumbs:
|
|||
}
|
||||
|
||||
if (HCPtr)
|
||||
mouseMove(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2));
|
||||
setMousePos(Common::Point(scaleX((HCPtr->x1 + HCPtr->x2) / 2), scaleY((HCPtr->y1 + HCPtr->y2) / 2)));
|
||||
} else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_RBUTTON & Qualifier)) {
|
||||
eatMessages();
|
||||
Alternate = !Alternate;
|
||||
|
|
|
@ -66,12 +66,11 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
|
|||
|
||||
_lastWaitTOFTicks = 0;
|
||||
|
||||
_mouseX = 0;
|
||||
_mouseY = 0;
|
||||
_mousePos = Common::Point(0, 0);
|
||||
_mouseAtEdge = false;
|
||||
|
||||
_nextKeyIn = 0;
|
||||
_nextKeyIn = 0;
|
||||
_nextKeyOut = 0;
|
||||
_mouseAtEdge = false;
|
||||
|
||||
//const Common::FSNode gameDataDir(ConfMan.get("path"));
|
||||
//SearchMan.addSubDirectoryMatching(gameDataDir, "game");
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define LAB_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/events.h"
|
||||
|
||||
#include "engines/engine.h"
|
||||
#include "lab/labfun.h"
|
||||
|
@ -96,9 +97,7 @@ private:
|
|||
|
||||
public:
|
||||
byte *_currentDsplayBuffer;
|
||||
|
||||
uint32 _mouseX;
|
||||
uint32 _mouseY;
|
||||
Common::Point _mousePos;
|
||||
|
||||
private:
|
||||
byte *_displayBuffer;
|
||||
|
@ -145,7 +144,7 @@ private:
|
|||
/*---------- Drawing Routines ----------*/
|
||||
|
||||
void drawMaskImage(Image *Im, uint16 x, uint16 y);
|
||||
void WSDL_GetMousePos(int *x, int *y);
|
||||
Common::Point WSDL_GetMousePos();
|
||||
void changeVolume(int delta);
|
||||
void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#ifndef LAB_LABFUN_H
|
||||
#define LAB_LABFUN_H
|
||||
|
||||
#include "common/events.h"
|
||||
#include "lab/stddefines.h"
|
||||
#include "lab/parsetypes.h"
|
||||
|
||||
|
@ -228,8 +229,8 @@ uint16 scaleY(uint16 y);
|
|||
int16 VGAScaleX(int16 x);
|
||||
int16 VGAScaleY(int16 y);
|
||||
uint16 SVGACord(uint16 cord);
|
||||
uint16 VGAUnScaleX(uint16 x);
|
||||
uint16 VGAUnScaleY(uint16 y);
|
||||
int VGAUnScaleX(int x);
|
||||
int VGAUnScaleY(int y);
|
||||
char *translateFileName(const char *filename);
|
||||
|
||||
/*---------------------------*/
|
||||
|
@ -260,9 +261,9 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header);
|
|||
/*--------------------------*/
|
||||
|
||||
void showCombination(const char *filename);
|
||||
void mouseCombination(uint16 x, uint16 y);
|
||||
void mouseCombination(Common::Point pos);
|
||||
void showTile(const char *filename, bool showsolution);
|
||||
void mouseTile(uint16 x, uint16 y);
|
||||
void mouseTile(Common::Point pos);
|
||||
|
||||
} // End of namespace Lab
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ uint16 SVGACord(uint16 cord) {
|
|||
/*****************************************************************************/
|
||||
/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */
|
||||
/*****************************************************************************/
|
||||
uint16 VGAUnScaleX(uint16 x) {
|
||||
int VGAUnScaleX(int x) {
|
||||
if (IsHiRes)
|
||||
return (x / 2);
|
||||
else
|
||||
|
@ -98,7 +98,7 @@ uint16 VGAUnScaleX(uint16 x) {
|
|||
/*****************************************************************************/
|
||||
/* Converts SVGA cords to VGA if necessary, otherwise returns VGA cords. */
|
||||
/*****************************************************************************/
|
||||
uint16 VGAUnScaleY(uint16 y) {
|
||||
int VGAUnScaleY(int y) {
|
||||
if (IsHiRes)
|
||||
return ((y * 5) / 12);
|
||||
else
|
||||
|
|
|
@ -69,12 +69,12 @@ static Gadget *hitgad = NULL;
|
|||
/* Checks whether or not the cords fall within one of the gadgets in a list */
|
||||
/* of gadgets. */
|
||||
/*****************************************************************************/
|
||||
static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) {
|
||||
static Gadget *checkGadgetHit(Gadget *gadlist, Common::Point pos) {
|
||||
while (gadlist != NULL) {
|
||||
if ((x >= gadlist->x) && (y >= gadlist->y) &&
|
||||
(x <= (gadlist->x + gadlist->Im->Width)) &&
|
||||
(y <= (gadlist->y + gadlist->Im->Height)) &&
|
||||
!(GADGETOFF & gadlist->GadgetFlags)) {
|
||||
if ((pos.x >= gadlist->x) && (pos.y >= gadlist->y) &&
|
||||
(pos.x <= (gadlist->x + gadlist->Im->Width)) &&
|
||||
(pos.y <= (gadlist->y + gadlist->Im->Height)) &&
|
||||
!(GADGETOFF & gadlist->GadgetFlags)) {
|
||||
if (IsHiRes) {
|
||||
hitgad = gadlist;
|
||||
} else {
|
||||
|
@ -108,17 +108,14 @@ void attachGadgetList(Gadget *GadList) {
|
|||
ScreenGadgetList = GadList;
|
||||
}
|
||||
|
||||
void mouseHandler(int32 flag, int32 mouseX, int32 mouseY) {
|
||||
void mouseHandler(int flag, Common::Point pos) {
|
||||
if (NumHidden >= 2)
|
||||
return;
|
||||
|
||||
if (!IsHiRes)
|
||||
mouseX /= 2;
|
||||
|
||||
if (flag & 0x02) { /* Left mouse button click */
|
||||
Gadget *tmp = NULL;
|
||||
if (ScreenGadgetList)
|
||||
tmp = checkGadgetHit(ScreenGadgetList, mouseX, mouseY);
|
||||
tmp = checkGadgetHit(ScreenGadgetList, IsHiRes ? pos : Common::Point(pos.x / 2, pos.y));
|
||||
|
||||
if (tmp)
|
||||
LastGadgetHit = tmp;
|
||||
|
@ -163,7 +160,7 @@ void initMouse() {
|
|||
g_system->setMouseCursor(MouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0);
|
||||
g_system->showMouse(false);
|
||||
|
||||
mouseMove(0, 0);
|
||||
setMousePos(Common::Point(0, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,23 +196,22 @@ void mouseHide() {
|
|||
/* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */
|
||||
/* from virtual to screen co-ordinates automatically. */
|
||||
/*****************************************************************************/
|
||||
void mouseXY(uint16 *x, uint16 *y) {
|
||||
*x = (uint16)g_lab->_mouseX;
|
||||
*y = (uint16)g_lab->_mouseY;
|
||||
|
||||
if (!IsHiRes)
|
||||
(*x) /= 2;
|
||||
Common::Point getMousePos() {
|
||||
if (IsHiRes)
|
||||
return g_lab->_mousePos;
|
||||
else
|
||||
return Common::Point(g_lab->_mousePos.x / 2, g_lab->_mousePos.y);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Moves the mouse to new co-ordinates. */
|
||||
/*****************************************************************************/
|
||||
void mouseMove(uint16 x, uint16 y) {
|
||||
if (!IsHiRes)
|
||||
x *= 2;
|
||||
|
||||
g_system->warpMouse(x, y);
|
||||
void setMousePos(Common::Point pos) {
|
||||
if (IsHiRes)
|
||||
g_system->warpMouse(pos.x, pos.y);
|
||||
else
|
||||
g_system->warpMouse(pos.x * 2, pos.y);
|
||||
|
||||
if (!MouseHidden)
|
||||
g_lab->WSDL_ProcessInput(0);
|
||||
|
@ -230,15 +226,15 @@ void mouseMove(uint16 x, uint16 y) {
|
|||
bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) {
|
||||
if (leftbutton) {
|
||||
if (LeftClick) {
|
||||
*x = (!IsHiRes) ? (uint16)g_lab->_mouseX / 2 : (uint16)g_lab->_mouseX;
|
||||
*y = (uint16)g_lab->_mouseY;
|
||||
*x = (!IsHiRes) ? (uint16)g_lab->_mousePos.x / 2 : (uint16)g_lab->_mousePos.x;
|
||||
*y = (uint16)g_lab->_mousePos.y;
|
||||
LeftClick = false;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (RightClick) {
|
||||
*x = (!IsHiRes) ? (uint16)g_lab->_mouseX / 2 : (uint16)g_lab->_mouseX;
|
||||
*y = (uint16)g_lab->_mouseY;
|
||||
*x = (!IsHiRes) ? (uint16)g_lab->_mousePos.x / 2 : (uint16)g_lab->_mousePos.x;
|
||||
*y = (uint16)g_lab->_mousePos.y;
|
||||
RightClick = false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "common/events.h"
|
||||
#include "lab/stddefines.h"
|
||||
|
||||
#ifndef LAB_MOUSE_H
|
||||
|
@ -45,9 +46,9 @@ void mouseShow();
|
|||
|
||||
void mouseHide();
|
||||
|
||||
void mouseXY(uint16 *x, uint16 *y);
|
||||
Common::Point getMousePos();
|
||||
|
||||
void mouseMove(uint16 x, uint16 y);
|
||||
void setMousePos(Common::Point pos);
|
||||
|
||||
bool mouseButton(uint16 *x, uint16 *y, bool leftbutton);
|
||||
|
||||
|
@ -55,7 +56,7 @@ Gadget *mouseGadget();
|
|||
|
||||
void attachGadgetList(Gadget *GadList);
|
||||
|
||||
void mouseHandler(int32 flag, int32 mouseX, int32 mouseY);
|
||||
void mouseHandler(int flag, Common::Point pos);
|
||||
|
||||
} // End of namespace Lab
|
||||
|
||||
|
|
|
@ -55,9 +55,9 @@ ViewData *getViewData(uint16 RoomNum, uint16 Direction);
|
|||
char *getPictName(CloseDataPtr *LCPtr);
|
||||
void drawDirection(CloseDataPtr LCPtr);
|
||||
bool processArrow(uint16 *Direction, uint16 Arrow);
|
||||
void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords = false);
|
||||
void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false);
|
||||
bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr);
|
||||
bool doActionRule(int16 x, int16 y, int16 action, int16 RoomNum, CloseDataPtr *LCPtr);
|
||||
bool doActionRule(Common::Point pos, int16 action, int16 RoomNum, CloseDataPtr *LCPtr);
|
||||
bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr);
|
||||
bool doGoForward(CloseDataPtr *LCPtr);
|
||||
bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr);
|
||||
|
|
|
@ -259,7 +259,7 @@ bool processArrow(uint16 *direction, uint16 Arrow) {
|
|||
/*****************************************************************************/
|
||||
/* Sets the current close up data. */
|
||||
/*****************************************************************************/
|
||||
void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) {
|
||||
void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) {
|
||||
ViewData *VPtr;
|
||||
CloseDataPtr LCPtr;
|
||||
uint16 x1, y1, x2, y2;
|
||||
|
@ -283,7 +283,7 @@ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords)
|
|||
y2 = scaleY(LCPtr->y2);
|
||||
}
|
||||
|
||||
if (x >= x1 && y >= y1 && x <= x2 && y <= y2 && LCPtr->GraphicName) {
|
||||
if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && LCPtr->GraphicName) {
|
||||
*cptr = LCPtr;
|
||||
return;
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo
|
|||
/*****************************************************************************/
|
||||
/* Goes through the rules if an action is taken. */
|
||||
/*****************************************************************************/
|
||||
bool doActionRule(int16 x, int16 y, int16 action, int16 roomNum, CloseDataPtr *LCPtr) {
|
||||
bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *LCPtr) {
|
||||
CloseDataPtr TLCPtr;
|
||||
|
||||
if (roomNum)
|
||||
|
@ -648,7 +648,7 @@ bool doActionRule(int16 x, int16 y, int16 action, int16 roomNum, CloseDataPtr *L
|
|||
else
|
||||
NewFileName = CurFileName;
|
||||
|
||||
TLCPtr = getObject(x, y, *LCPtr);
|
||||
TLCPtr = getObject(pos.x, pos.y, *LCPtr);
|
||||
|
||||
if (doActionRuleSub(action, roomNum, TLCPtr, LCPtr, false))
|
||||
return true;
|
||||
|
|
|
@ -213,11 +213,11 @@ static void changeCombination(uint16 number) {
|
|||
/*****************************************************************************/
|
||||
/* Processes mouse clicks and changes the combination. */
|
||||
/*****************************************************************************/
|
||||
void mouseCombination(uint16 x, uint16 y) {
|
||||
void mouseCombination(Common::Point pos) {
|
||||
uint16 number;
|
||||
|
||||
x = VGAUnScaleX(x);
|
||||
y = VGAUnScaleY(y);
|
||||
int x = VGAUnScaleX(pos.x);
|
||||
int y = VGAUnScaleY(pos.y);
|
||||
|
||||
if ((y >= 63) && (y <= 99)) {
|
||||
if ((x >= 44) && (x < 83))
|
||||
|
@ -437,9 +437,9 @@ static void changeTile(uint16 col, uint16 row) {
|
|||
/*****************************************************************************/
|
||||
/* Processes mouse clicks and changes the combination. */
|
||||
/*****************************************************************************/
|
||||
void mouseTile(uint16 x, uint16 y) {
|
||||
x = VGAUnScaleX(x);
|
||||
y = VGAUnScaleY(y);
|
||||
void mouseTile(Common::Point pos) {
|
||||
int x = VGAUnScaleX(pos.x);
|
||||
int y = VGAUnScaleY(pos.y);
|
||||
|
||||
if ((x < 101) || (y < 26))
|
||||
return;
|
||||
|
@ -1007,7 +1007,7 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1
|
|||
TestCPtr = CPtr;
|
||||
MouseY = 64 + (MouseY / MonGadHeight) * 42;
|
||||
MouseX = 101;
|
||||
setCurClose(MouseX, MouseY, &CPtr, true);
|
||||
setCurClose(Common::Point(MouseX, MouseY), &CPtr, true);
|
||||
|
||||
if (TestCPtr != CPtr) {
|
||||
LastCPtr[depth] = TestCPtr;
|
||||
|
|
|
@ -90,40 +90,39 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) {
|
|||
switch (event.type) {
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
flags |= 8;
|
||||
mouseHandler(flags, _mouseX, _mouseY);
|
||||
mouseHandler(flags, _mousePos);
|
||||
break;
|
||||
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
flags |= 2;
|
||||
mouseHandler(flags, _mouseX, _mouseY);
|
||||
mouseHandler(flags, _mousePos);
|
||||
break;
|
||||
|
||||
case Common::EVENT_MOUSEMOVE: {
|
||||
int lastMouseAtEdge = _mouseAtEdge;
|
||||
_mouseAtEdge = false;
|
||||
_mouseX = event.mouse.x;
|
||||
_mousePos.x = event.mouse.x;
|
||||
if (event.mouse.x <= 0) {
|
||||
_mouseX = 0;
|
||||
_mousePos.x = 0;
|
||||
_mouseAtEdge = true;
|
||||
}
|
||||
if (_mouseX > g_lab->_screenWidth - 1) {
|
||||
_mouseX = g_lab->_screenWidth;
|
||||
if (_mousePos.x > g_lab->_screenWidth - 1) {
|
||||
_mousePos.x = g_lab->_screenWidth;
|
||||
_mouseAtEdge = true;
|
||||
}
|
||||
|
||||
_mouseY = event.mouse.y;
|
||||
_mousePos.y = event.mouse.y;
|
||||
if (event.mouse.y <= 0) {
|
||||
_mouseY = 0;
|
||||
_mousePos.y = 0;
|
||||
_mouseAtEdge = true;
|
||||
}
|
||||
if (_mouseY > g_lab->_screenHeight - 1) {
|
||||
_mouseY = g_lab->_screenHeight;
|
||||
if (_mousePos.y > g_lab->_screenHeight - 1) {
|
||||
_mousePos.y = g_lab->_screenHeight;
|
||||
_mouseAtEdge = true;
|
||||
}
|
||||
|
||||
if (!lastMouseAtEdge || !_mouseAtEdge)
|
||||
mouseHandler(1, _mouseX, _mouseY);
|
||||
|
||||
mouseHandler(1, _mousePos);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -167,11 +166,10 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) {
|
|||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
void LabEngine::WSDL_GetMousePos(int *x, int *y) {
|
||||
Common::Point LabEngine::WSDL_GetMousePos() {
|
||||
WSDL_ProcessInput(0);
|
||||
|
||||
*x = _mouseX;
|
||||
*y = _mouseY;
|
||||
return _mousePos;
|
||||
}
|
||||
|
||||
void LabEngine::waitTOF() {
|
||||
|
@ -278,13 +276,13 @@ void LabEngine::drawImage(Image *Im, uint16 x, uint16 y) {
|
|||
dy = 0;
|
||||
}
|
||||
|
||||
if ((uint)(dx + w) > g_lab->_screenWidth)
|
||||
if (dx + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - dx;
|
||||
|
||||
if ((uint)(dy + h) > g_lab->_screenHeight)
|
||||
if (dy + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - dy;
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
if ((w > 0) && (h > 0)) {
|
||||
byte *s = Im->ImageData + sy * Im->Width + sx;
|
||||
byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx;
|
||||
|
||||
|
@ -321,13 +319,13 @@ void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) {
|
|||
dy = 0;
|
||||
}
|
||||
|
||||
if ((uint)(dx + w) > g_lab->_screenWidth)
|
||||
if (dx + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - dx;
|
||||
|
||||
if ((uint)(dy + h) > g_lab->_screenHeight)
|
||||
if (dy + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - dy;
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
if ((w > 0) && (h > 0)) {
|
||||
byte *s = Im->ImageData + sy * Im->Width + sx;
|
||||
byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx;
|
||||
|
||||
|
@ -374,13 +372,13 @@ void LabEngine::readScreenImage(Image *Im, uint16 x, uint16 y) {
|
|||
dy = 0;
|
||||
}
|
||||
|
||||
if ((uint)(dx + w) > g_lab->_screenWidth)
|
||||
if (dx + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - dx;
|
||||
|
||||
if ((uint)(dy + h) > g_lab->_screenHeight)
|
||||
if (dy + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - dy;
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
if ((w > 0) && (h > 0)) {
|
||||
byte *s = Im->ImageData + sy * Im->Width + sx;
|
||||
byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx;
|
||||
|
||||
|
@ -551,13 +549,13 @@ void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
|||
dy = 0;
|
||||
}
|
||||
|
||||
if ((uint)(dx + w) > g_lab->_screenWidth)
|
||||
if (dx + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - dx;
|
||||
|
||||
if ((uint)(dy + h) > g_lab->_screenHeight)
|
||||
if (dy + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - dy;
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
if ((w > 0) && (h > 0)) {
|
||||
char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx;
|
||||
|
||||
while (h-- > 0) {
|
||||
|
@ -608,13 +606,13 @@ void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uin
|
|||
dy = 0;
|
||||
}
|
||||
|
||||
if ((uint)(dx + w) > g_lab->_screenWidth)
|
||||
if (dx + w > g_lab->_screenWidth)
|
||||
w = g_lab->_screenWidth - dx;
|
||||
|
||||
if ((uint)(dy + h) > g_lab->_screenHeight)
|
||||
if (dy + h > g_lab->_screenHeight)
|
||||
h = g_lab->_screenHeight - dy;
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
if ((w > 0) && (h > 0)) {
|
||||
char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx;
|
||||
|
||||
while (h-- > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue