Browse Source

♻️ Leverage 'Point' to represent mouse position

pull/2252/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
fd9f2099d0
  1. 5
      Source/DiabloUI/diabloui.cpp
  2. 80
      Source/control.cpp
  3. 34
      Source/controls/plrctrls.cpp
  4. 14
      Source/cursor.cpp
  5. 69
      Source/diablo.cpp
  6. 3
      Source/diablo.h
  7. 20
      Source/gmenu.cpp
  8. 18
      Source/inv.cpp
  9. 7
      Source/miniwin/misc_msg.cpp
  10. 4
      Source/movie.cpp
  11. 6
      Source/player.cpp
  12. 8
      Source/qol/itemlabels.cpp
  13. 2
      Source/qol/xpbar.cpp
  14. 2
      Source/quests.cpp
  15. 16
      Source/scrollrt.cpp
  16. 10
      Source/stores.cpp
  17. 2
      Source/trigs.cpp

5
Source/DiabloUI/diabloui.cpp

@ -374,8 +374,7 @@ void UiHandleEvents(SDL_Event *event)
#ifdef USE_SDL1 #ifdef USE_SDL1
OutputToLogical(&event->motion.x, &event->motion.y); OutputToLogical(&event->motion.x, &event->motion.y);
#endif #endif
MouseX = event->motion.x; MousePosition = { event->motion.x, event->motion.y };
MouseY = event->motion.y;
return; return;
} }
@ -969,6 +968,6 @@ void DrawMouse()
if (IsHardwareCursor() || sgbControllerActive) if (IsHardwareCursor() || sgbControllerActive)
return; return;
DrawArt(MouseX, MouseY, &ArtCursor); DrawArt(MousePosition.x, MousePosition.y, &ArtCursor);
} }
} // namespace devilution } // namespace devilution

80
Source/control.cpp

@ -389,7 +389,7 @@ void DrawSpellList(const CelOutputBuffer &out)
DrawSpellCel(out, location, *pSpellCels, SpellITbl[j]); DrawSpellCel(out, location, *pSpellCels, SpellITbl[j]);
int lx = x; int lx = x;
int ly = y - SPLICONLENGTH; int ly = y - SPLICONLENGTH;
if (MouseX >= lx && MouseX < lx + SPLICONLENGTH && MouseY >= ly && MouseY < ly + SPLICONLENGTH) { if (MousePosition.x >= lx && MousePosition.x < lx + SPLICONLENGTH && MousePosition.y >= ly && MousePosition.y < ly + SPLICONLENGTH) {
pSpell = (spell_id)j; pSpell = (spell_id)j;
pSplType = (spell_type)i; pSplType = (spell_type)i;
if (myPlayer._pClass == HeroClass::Monk && j == SPL_SEARCH) if (myPlayer._pClass == HeroClass::Monk && j == SPL_SEARCH)
@ -843,15 +843,15 @@ void DoPanBtn()
for (int i = 0; i < numpanbtns; i++) { for (int i = 0; i < numpanbtns; i++) {
int x = PanBtnPos[i].x + PANEL_LEFT + PanBtnPos[i].w; int x = PanBtnPos[i].x + PANEL_LEFT + PanBtnPos[i].w;
int y = PanBtnPos[i].y + PANEL_TOP + PanBtnPos[i].h; int y = PanBtnPos[i].y + PANEL_TOP + PanBtnPos[i].h;
if (MouseX >= PanBtnPos[i].x + PANEL_LEFT && MouseX <= x) { if (MousePosition.x >= PanBtnPos[i].x + PANEL_LEFT && MousePosition.x <= x) {
if (MouseY >= PanBtnPos[i].y + PANEL_TOP && MouseY <= y) { if (MousePosition.y >= PanBtnPos[i].y + PANEL_TOP && MousePosition.y <= y) {
panbtns[i] = true; panbtns[i] = true;
drawbtnflag = true; drawbtnflag = true;
panbtndown = true; panbtndown = true;
} }
} }
} }
if (!spselflag && MouseX >= 565 + PANEL_LEFT && MouseX < 621 + PANEL_LEFT && MouseY >= 64 + PANEL_TOP && MouseY < 120 + PANEL_TOP) { if (!spselflag && MousePosition.x >= 565 + PANEL_LEFT && MousePosition.x < 621 + PANEL_LEFT && MousePosition.y >= 64 + PANEL_TOP && MousePosition.y < 120 + PANEL_TOP) {
if ((SDL_GetModState() & KMOD_SHIFT) != 0) { if ((SDL_GetModState() & KMOD_SHIFT) != 0) {
auto &myPlayer = plr[myplr]; auto &myPlayer = plr[myplr];
myPlayer._pRSpell = SPL_INVALID; myPlayer._pRSpell = SPL_INVALID;
@ -875,18 +875,18 @@ void control_check_btn_press()
{ {
int x = PanBtnPos[3].x + PANEL_LEFT + PanBtnPos[3].w; int x = PanBtnPos[3].x + PANEL_LEFT + PanBtnPos[3].w;
int y = PanBtnPos[3].y + PANEL_TOP + PanBtnPos[3].h; int y = PanBtnPos[3].y + PANEL_TOP + PanBtnPos[3].h;
if (MouseX >= PanBtnPos[3].x + PANEL_LEFT if (MousePosition.x >= PanBtnPos[3].x + PANEL_LEFT
&& MouseX <= x && MousePosition.x <= x
&& MouseY >= PanBtnPos[3].y + PANEL_TOP && MousePosition.y >= PanBtnPos[3].y + PANEL_TOP
&& MouseY <= y) { && MousePosition.y <= y) {
control_set_button_down(3); control_set_button_down(3);
} }
x = PanBtnPos[6].x + PANEL_LEFT + PanBtnPos[6].w; x = PanBtnPos[6].x + PANEL_LEFT + PanBtnPos[6].w;
y = PanBtnPos[6].y + PANEL_TOP + PanBtnPos[6].h; y = PanBtnPos[6].y + PANEL_TOP + PanBtnPos[6].h;
if (MouseX >= PanBtnPos[6].x + PANEL_LEFT if (MousePosition.x >= PanBtnPos[6].x + PANEL_LEFT
&& MouseX <= x && MousePosition.x <= x
&& MouseY >= PanBtnPos[6].y + PANEL_TOP && MousePosition.y >= PanBtnPos[6].y + PANEL_TOP
&& MouseY <= y) { && MousePosition.y <= y) {
control_set_button_down(6); control_set_button_down(6);
} }
} }
@ -914,7 +914,7 @@ void CheckPanelInfo()
for (int i = 0; i < numpanbtns; i++) { for (int i = 0; i < numpanbtns; i++) {
int xend = PanBtnPos[i].x + PANEL_LEFT + PanBtnPos[i].w; int xend = PanBtnPos[i].x + PANEL_LEFT + PanBtnPos[i].w;
int yend = PanBtnPos[i].y + PANEL_TOP + PanBtnPos[i].h; int yend = PanBtnPos[i].y + PANEL_TOP + PanBtnPos[i].h;
if (MouseX >= PanBtnPos[i].x + PANEL_LEFT && MouseX <= xend && MouseY >= PanBtnPos[i].y + PANEL_TOP && MouseY <= yend) { if (MousePosition.x >= PanBtnPos[i].x + PANEL_LEFT && MousePosition.x <= xend && MousePosition.y >= PanBtnPos[i].y + PANEL_TOP && MousePosition.y <= yend) {
if (i != 7) { if (i != 7) {
strcpy(infostr, _(PanBtnStr[i])); strcpy(infostr, _(PanBtnStr[i]));
} else { } else {
@ -932,7 +932,7 @@ void CheckPanelInfo()
pinfoflag = true; pinfoflag = true;
} }
} }
if (!spselflag && MouseX >= 565 + PANEL_LEFT && MouseX < 621 + PANEL_LEFT && MouseY >= 64 + PANEL_TOP && MouseY < 120 + PANEL_TOP) { if (!spselflag && MousePosition.x >= 565 + PANEL_LEFT && MousePosition.x < 621 + PANEL_LEFT && MousePosition.y >= 64 + PANEL_TOP && MousePosition.y < 120 + PANEL_TOP) {
strcpy(infostr, _("Select current spell button")); strcpy(infostr, _("Select current spell button"));
infoclr = UIS_SILVER; infoclr = UIS_SILVER;
panelflag = true; panelflag = true;
@ -991,7 +991,7 @@ void CheckPanelInfo()
} }
} }
} }
if (MouseX > 190 + PANEL_LEFT && MouseX < 437 + PANEL_LEFT && MouseY > 4 + PANEL_TOP && MouseY < 33 + PANEL_TOP) if (MousePosition.x > 190 + PANEL_LEFT && MousePosition.x < 437 + PANEL_LEFT && MousePosition.y > 4 + PANEL_TOP && MousePosition.y < 33 + PANEL_TOP)
pcursinvitem = CheckInvHLight(); pcursinvitem = CheckInvHLight();
if (CheckXPBarInfo()) { if (CheckXPBarInfo()) {
@ -1017,10 +1017,10 @@ void CheckBtnUp()
panbtns[i] = false; panbtns[i] = false;
if (MouseX < PanBtnPos[i].x + PANEL_LEFT if (MousePosition.x < PanBtnPos[i].x + PANEL_LEFT
|| MouseX > PanBtnPos[i].x + PANEL_LEFT + PanBtnPos[i].w || MousePosition.x > PanBtnPos[i].x + PANEL_LEFT + PanBtnPos[i].w
|| MouseY < PanBtnPos[i].y + PANEL_TOP || MousePosition.y < PanBtnPos[i].y + PANEL_TOP
|| MouseY > PanBtnPos[i].y + PANEL_TOP + PanBtnPos[i].h) { || MousePosition.y > PanBtnPos[i].y + PANEL_TOP + PanBtnPos[i].h) {
continue; continue;
} }
@ -1388,13 +1388,13 @@ void DrawChr(const CelOutputBuffer &out)
void CheckLvlBtn() void CheckLvlBtn()
{ {
if (!lvlbtndown && MouseX >= 40 + PANEL_LEFT && MouseX <= 81 + PANEL_LEFT && MouseY >= -39 + PANEL_TOP && MouseY <= -17 + PANEL_TOP) if (!lvlbtndown && MousePosition.x >= 40 + PANEL_LEFT && MousePosition.x <= 81 + PANEL_LEFT && MousePosition.y >= -39 + PANEL_TOP && MousePosition.y <= -17 + PANEL_TOP)
lvlbtndown = true; lvlbtndown = true;
} }
void ReleaseLvlBtn() void ReleaseLvlBtn()
{ {
if (MouseX >= 40 + PANEL_LEFT && MouseX <= 81 + PANEL_LEFT && MouseY >= -39 + PANEL_TOP && MouseY <= -17 + PANEL_TOP) if (MousePosition.x >= 40 + PANEL_LEFT && MousePosition.x <= 81 + PANEL_LEFT && MousePosition.y >= -39 + PANEL_TOP && MousePosition.y <= -17 + PANEL_TOP)
chrflag = true; chrflag = true;
lvlbtndown = false; lvlbtndown = false;
} }
@ -1440,10 +1440,10 @@ void CheckChrBtns()
auto buttonId = static_cast<size_t>(attribute); auto buttonId = static_cast<size_t>(attribute);
int x = ChrBtnsRect[buttonId].position.x + ChrBtnsRect[buttonId].size.width; int x = ChrBtnsRect[buttonId].position.x + ChrBtnsRect[buttonId].size.width;
int y = ChrBtnsRect[buttonId].position.y + ChrBtnsRect[buttonId].size.height; int y = ChrBtnsRect[buttonId].position.y + ChrBtnsRect[buttonId].size.height;
if (MouseX >= ChrBtnsRect[buttonId].position.x if (MousePosition.x >= ChrBtnsRect[buttonId].position.x
&& MouseX <= x && MousePosition.x <= x
&& MouseY >= ChrBtnsRect[buttonId].position.y && MousePosition.y >= ChrBtnsRect[buttonId].position.y
&& MouseY <= y) { && MousePosition.y <= y) {
chrbtn[buttonId] = true; chrbtn[buttonId] = true;
chrbtnactive = true; chrbtnactive = true;
} }
@ -1466,10 +1466,10 @@ void ReleaseChrBtns(bool addAllStatPoints)
continue; continue;
chrbtn[buttonId] = false; chrbtn[buttonId] = false;
if (MouseX >= ChrBtnsRect[buttonId].position.x if (MousePosition.x >= ChrBtnsRect[buttonId].position.x
&& MouseX <= ChrBtnsRect[buttonId].position.x + ChrBtnsRect[buttonId].size.width && MousePosition.x <= ChrBtnsRect[buttonId].position.x + ChrBtnsRect[buttonId].size.width
&& MouseY >= ChrBtnsRect[buttonId].position.y && MousePosition.y >= ChrBtnsRect[buttonId].position.y
&& MouseY <= ChrBtnsRect[buttonId].position.y + ChrBtnsRect[buttonId].size.height) { && MousePosition.y <= ChrBtnsRect[buttonId].position.y + ChrBtnsRect[buttonId].size.height) {
auto &myPlayer = plr[myplr]; auto &myPlayer = plr[myplr];
int statPointsToAdd = 1; int statPointsToAdd = 1;
if (addAllStatPoints) if (addAllStatPoints)
@ -1668,8 +1668,8 @@ void DrawSpellBook(const CelOutputBuffer &out)
void CheckSBook() void CheckSBook()
{ {
if (MouseX >= RIGHT_PANEL + 11 && MouseX < RIGHT_PANEL + 48 && MouseY >= 18 && MouseY < 314) { if (MousePosition.x >= RIGHT_PANEL + 11 && MousePosition.x < RIGHT_PANEL + 48 && MousePosition.y >= 18 && MousePosition.y < 314) {
spell_id sn = SpellPages[sbooktab][(MouseY - 18) / 43]; spell_id sn = SpellPages[sbooktab][(MousePosition.y - 18) / 43];
auto &myPlayer = plr[myplr]; auto &myPlayer = plr[myplr];
uint64_t spl = myPlayer._pMemSpells | myPlayer._pISpells | myPlayer._pAblSpells; uint64_t spl = myPlayer._pMemSpells | myPlayer._pISpells | myPlayer._pAblSpells;
if (sn != SPL_INVALID && (spl & GetSpellBitmask(sn)) != 0) { if (sn != SPL_INVALID && (spl & GetSpellBitmask(sn)) != 0) {
@ -1685,8 +1685,8 @@ void CheckSBook()
force_redraw = 255; force_redraw = 255;
} }
} }
if (MouseX >= RIGHT_PANEL + 7 && MouseX < RIGHT_PANEL + 311 && MouseY >= SPANEL_WIDTH && MouseY < 349) { if (MousePosition.x >= RIGHT_PANEL + 7 && MousePosition.x < RIGHT_PANEL + 311 && MousePosition.y >= SPANEL_WIDTH && MousePosition.y < 349) {
sbooktab = (MouseX - (RIGHT_PANEL + 7)) / (gbIsHellfire ? 61 : 76); sbooktab = (MousePosition.x - (RIGHT_PANEL + 7)) / (gbIsHellfire ? 61 : 76);
} }
} }
@ -1851,20 +1851,20 @@ bool control_check_talk_btn()
if (!talkflag) if (!talkflag)
return false; return false;
if (MouseX < 172 + PANEL_LEFT) if (MousePosition.x < 172 + PANEL_LEFT)
return false; return false;
if (MouseY < 69 + PANEL_TOP) if (MousePosition.y < 69 + PANEL_TOP)
return false; return false;
if (MouseX > 233 + PANEL_LEFT) if (MousePosition.x > 233 + PANEL_LEFT)
return false; return false;
if (MouseY > 123 + PANEL_TOP) if (MousePosition.y > 123 + PANEL_TOP)
return false; return false;
for (bool &talkButtonDown : talkButtonsDown) { for (bool &talkButtonDown : talkButtonsDown) {
talkButtonDown = false; talkButtonDown = false;
} }
talkButtonsDown[(MouseY - (69 + PANEL_TOP)) / 18] = true; talkButtonsDown[(MousePosition.y - (69 + PANEL_TOP)) / 18] = true;
return true; return true;
} }
@ -1877,10 +1877,10 @@ void control_release_talk_btn()
for (bool &talkButtonDown : talkButtonsDown) for (bool &talkButtonDown : talkButtonsDown)
talkButtonDown = false; talkButtonDown = false;
if (MouseX < 172 + PANEL_LEFT || MouseY < 69 + PANEL_TOP || MouseX > 233 + PANEL_LEFT || MouseY > 123 + PANEL_TOP) if (MousePosition.x < 172 + PANEL_LEFT || MousePosition.y < 69 + PANEL_TOP || MousePosition.x > 233 + PANEL_LEFT || MousePosition.y > 123 + PANEL_TOP)
return; return;
int off = (MouseY - (69 + PANEL_TOP)) / 18; int off = (MousePosition.y - (69 + PANEL_TOP)) / 18;
int p = 0; int p = 0;
for (; p < MAX_PLRS && off != -1; p++) { for (; p < MAX_PLRS && off != -1; p++) {

34
Source/controls/plrctrls.cpp

@ -465,10 +465,10 @@ void AttrIncBtnSnap(AxisDirection dir)
// first, find our cursor location // first, find our cursor location
int slot = 0; int slot = 0;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (MouseX >= ChrBtnsRect[i].position.x if (MousePosition.x >= ChrBtnsRect[i].position.x
&& MouseX <= ChrBtnsRect[i].position.x + ChrBtnsRect[i].size.width && MousePosition.x <= ChrBtnsRect[i].position.x + ChrBtnsRect[i].size.width
&& MouseY >= ChrBtnsRect[i].position.y && MousePosition.y >= ChrBtnsRect[i].position.y
&& MouseY <= ChrBtnsRect[i].size.height + ChrBtnsRect[i].position.y) { && MousePosition.y <= ChrBtnsRect[i].size.height + ChrBtnsRect[i].position.y) {
slot = i; slot = i;
break; break;
} }
@ -654,7 +654,7 @@ void InvMove(AxisDirection dir)
char itemInvId; char itemInvId;
auto itemSize = GetItemSizeOnSlot(slot, itemInvId); auto itemSize = GetItemSizeOnSlot(slot, itemInvId);
Point mousePos { MouseX, MouseY }; Point mousePos { MousePosition.x, MousePosition.y };
const bool isHoldingItem = pcurs > 1; const bool isHoldingItem = pcurs > 1;
@ -925,7 +925,7 @@ void InvMove(AxisDirection dir)
mousePos.y -= (InventorySlotSizeInPixels.height / 2); mousePos.y -= (InventorySlotSizeInPixels.height / 2);
} }
if (mousePos.x == MouseX && mousePos.y == MouseY) { if (mousePos == MousePosition) {
return; // Avoid wobeling when scalled return; // Avoid wobeling when scalled
} }
@ -957,10 +957,10 @@ void HotSpellMove(AxisDirection dir)
int spbslot = plr[myplr]._pRSpell; int spbslot = plr[myplr]._pRSpell;
for (int r = 0; r < speedspellcount; r++) { for (int r = 0; r < speedspellcount; r++) {
if (MouseX >= speedspellscoords[r].x - SPLICONLENGTH / 2 if (MousePosition.x >= speedspellscoords[r].x - SPLICONLENGTH / 2
&& MouseX < speedspellscoords[r].x + SPLICONLENGTH / 2 && MousePosition.x < speedspellscoords[r].x + SPLICONLENGTH / 2
&& MouseY >= speedspellscoords[r].y - SPLICONLENGTH / 2 && MousePosition.y >= speedspellscoords[r].y - SPLICONLENGTH / 2
&& MouseY < speedspellscoords[r].y + SPLICONLENGTH / 2) { && MousePosition.y < speedspellscoords[r].y + SPLICONLENGTH / 2) {
spbslot = r; spbslot = r;
break; break;
} }
@ -991,7 +991,7 @@ void HotSpellMove(AxisDirection dir)
} }
} }
if (x != MouseX || y != MouseY) { if (Point { x, y } != MousePosition) {
SetCursorPos(x, y); SetCursorPos(x, y);
} }
} }
@ -1277,8 +1277,8 @@ void HandleRightStickMotion()
{ // move cursor { // move cursor
sgbControllerActive = false; sgbControllerActive = false;
int x = MouseX; int x = MousePosition.x;
int y = MouseY; int y = MousePosition.y;
acc.Pool(&x, &y, 2); acc.Pool(&x, &y, 2);
x = std::min(std::max(x, 0), gnScreenWidth - 1); x = std::min(std::max(x, 0), gnScreenWidth - 1);
y = std::min(std::max(y, 0), gnScreenHeight - 1); y = std::min(std::max(y, 0), gnScreenHeight - 1);
@ -1382,10 +1382,10 @@ void PerformPrimaryAction()
if (chrflag && !chrbtnactive && plr[myplr]._pStatPts > 0) { if (chrflag && !chrbtnactive && plr[myplr]._pStatPts > 0) {
CheckChrBtns(); CheckChrBtns();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (MouseX >= ChrBtnsRect[i].position.x if (MousePosition.x >= ChrBtnsRect[i].position.x
&& MouseX <= ChrBtnsRect[i].position.x + ChrBtnsRect[i].size.width && MousePosition.x <= ChrBtnsRect[i].position.x + ChrBtnsRect[i].size.width
&& MouseY >= ChrBtnsRect[i].position.y && MousePosition.y >= ChrBtnsRect[i].position.y
&& MouseY <= ChrBtnsRect[i].size.height + ChrBtnsRect[i].position.y) { && MousePosition.y <= ChrBtnsRect[i].size.height + ChrBtnsRect[i].position.y) {
chrbtn[i] = true; chrbtn[i] = true;
chrbtnactive = true; chrbtnactive = true;
ReleaseChrBtns(false); ReleaseChrBtns(false);

14
Source/cursor.cpp

@ -277,8 +277,8 @@ void CheckCursMove()
if (IsItemLabelHighlighted()) if (IsItemLabelHighlighted())
return; return;
sx = MouseX; sx = MousePosition.x;
sy = MouseY; sy = MousePosition.y;
if (CanPanelsCoverView()) { if (CanPanelsCoverView()) {
if (chrflag || questlog) { if (chrflag || questlog) {
@ -295,7 +295,7 @@ void CheckCursMove()
} }
} }
} }
if (sy > PANEL_TOP - 1 && MouseX >= PANEL_LEFT && MouseX < PANEL_LEFT + PANEL_WIDTH && track_isscrolling()) { if (sy > PANEL_TOP - 1 && MousePosition.x >= PANEL_LEFT && MousePosition.x < PANEL_LEFT + PANEL_WIDTH && track_isscrolling()) {
sy = PANEL_TOP - 1; sy = PANEL_TOP - 1;
} }
@ -400,21 +400,21 @@ void CheckCursMove()
cursmy = my; cursmy = my;
return; return;
} }
if (MouseY > PANEL_TOP && MouseX >= PANEL_LEFT && MouseX <= PANEL_LEFT + PANEL_WIDTH) { if (MousePosition.y > PANEL_TOP && MousePosition.x >= PANEL_LEFT && MousePosition.x <= PANEL_LEFT + PANEL_WIDTH) {
CheckPanelInfo(); CheckPanelInfo();
return; return;
} }
if (DoomFlag) { if (DoomFlag) {
return; return;
} }
if (invflag && MouseX > RIGHT_PANEL && MouseY <= SPANEL_HEIGHT) { if (invflag && MousePosition.x > RIGHT_PANEL && MousePosition.y <= SPANEL_HEIGHT) {
pcursinvitem = CheckInvHLight(); pcursinvitem = CheckInvHLight();
return; return;
} }
if (sbookflag && MouseX > RIGHT_PANEL && MouseY <= SPANEL_HEIGHT) { if (sbookflag && MousePosition.x > RIGHT_PANEL && MousePosition.y <= SPANEL_HEIGHT) {
return; return;
} }
if ((chrflag || questlog) && MouseX < SPANEL_WIDTH && MouseY <= SPANEL_HEIGHT) { if ((chrflag || questlog) && MousePosition.x < SPANEL_WIDTH && MousePosition.y <= SPANEL_HEIGHT) {
return; return;
} }

69
Source/diablo.cpp

@ -81,8 +81,7 @@ uint32_t glMid1Seed[NUMLEVELS];
uint32_t glMid2Seed[NUMLEVELS]; uint32_t glMid2Seed[NUMLEVELS];
uint32_t glMid3Seed[NUMLEVELS]; uint32_t glMid3Seed[NUMLEVELS];
int MouseX; Point MousePosition;
int MouseY;
bool gbGameLoopStartup; bool gbGameLoopStartup;
bool gbRunGame; bool gbRunGame;
bool gbRunGameResult; bool gbRunGameResult;
@ -346,7 +345,7 @@ static bool ProcessInput()
if (!gmenu_is_active() && sgnTimeoutCurs == CURSOR_NONE) { if (!gmenu_is_active() && sgnTimeoutCurs == CURSOR_NONE) {
#ifndef USE_SDL1 #ifndef USE_SDL1
finish_simulated_mouse_clicks(MouseX, MouseY); finish_simulated_mouse_clicks(MousePosition.x, MousePosition.y);
#endif #endif
CheckCursMove(); CheckCursMove();
plrctrls_after_check_curs_move(); plrctrls_after_check_curs_move();
@ -472,10 +471,9 @@ bool StartGame(bool bNewGame, bool bSinglePlayer)
static void diablo_init_screen() static void diablo_init_screen()
{ {
MouseX = gnScreenWidth / 2; MousePosition = { gnScreenWidth / 2, gnScreenHeight / 2 };
MouseY = gnScreenHeight / 2;
if (!sgbControllerActive) if (!sgbControllerActive)
SetCursorPos(MouseX, MouseY); SetCursorPos(MousePosition.x, MousePosition.y);
ScrollInfo.tile = { 0, 0 }; ScrollInfo.tile = { 0, 0 };
ScrollInfo.offset = { 0, 0 }; ScrollInfo.offset = { 0, 0 };
ScrollInfo._sdir = SDIR_NONE; ScrollInfo._sdir = SDIR_NONE;
@ -613,7 +611,7 @@ static bool LeftMouseCmd(bool bShift)
{ {
bool bNear; bool bNear;
assert(MouseY < PANEL_TOP || MouseX < PANEL_LEFT || MouseX >= PANEL_LEFT + PANEL_WIDTH); assert(MousePosition.y < PANEL_TOP || MousePosition.x < PANEL_LEFT || MousePosition.x >= PANEL_LEFT + PANEL_WIDTH);
if (leveltype == DTYPE_TOWN) { if (leveltype == DTYPE_TOWN) {
if (pcursitem != -1 && pcurs == CURSOR_HAND) if (pcursitem != -1 && pcurs == CURSOR_HAND)
@ -770,19 +768,19 @@ static bool LeftMouseDown(int wParam)
bool isShiftHeld = (wParam & DVL_MK_SHIFT) != 0; bool isShiftHeld = (wParam & DVL_MK_SHIFT) != 0;
if (MouseY < PANEL_TOP || MouseX < PANEL_LEFT || MouseX >= PANEL_LEFT + PANEL_WIDTH) { if (MousePosition.y < PANEL_TOP || MousePosition.x < PANEL_LEFT || MousePosition.x >= PANEL_LEFT + PANEL_WIDTH) {
if (!gmenu_is_active() && !TryIconCurs()) { if (!gmenu_is_active() && !TryIconCurs()) {
if (questlog && MouseX > 32 && MouseX < 288 && MouseY > 32 && MouseY < 308) { if (questlog && MousePosition.x > 32 && MousePosition.x < 288 && MousePosition.y > 32 && MousePosition.y < 308) {
QuestlogESC(); QuestlogESC();
} else if (qtextflag) { } else if (qtextflag) {
qtextflag = false; qtextflag = false;
stream_stop(); stream_stop();
} else if (chrflag && MouseX < SPANEL_WIDTH && MouseY < SPANEL_HEIGHT) { } else if (chrflag && MousePosition.x < SPANEL_WIDTH && MousePosition.y < SPANEL_HEIGHT) {
CheckChrBtns(); CheckChrBtns();
} else if (invflag && MouseX > RIGHT_PANEL && MouseY < SPANEL_HEIGHT) { } else if (invflag && MousePosition.x > RIGHT_PANEL && MousePosition.y < SPANEL_HEIGHT) {
if (!dropGoldFlag) if (!dropGoldFlag)
CheckInvItem(isShiftHeld); CheckInvItem(isShiftHeld);
} else if (sbookflag && MouseX > RIGHT_PANEL && MouseY < SPANEL_HEIGHT) { } else if (sbookflag && MousePosition.x > RIGHT_PANEL && MousePosition.y < SPANEL_HEIGHT) {
CheckSBook(); CheckSBook();
} else if (pcurs >= CURSOR_FIRSTITEM) { } else if (pcurs >= CURSOR_FIRSTITEM) {
if (TryInvPut()) { if (TryInvPut()) {
@ -838,8 +836,8 @@ static void RightMouseDown()
SetSpell(); SetSpell();
return; return;
} }
if (MouseY >= SPANEL_HEIGHT if (MousePosition.y >= SPANEL_HEIGHT
|| ((!sbookflag || MouseX <= RIGHT_PANEL) || ((!sbookflag || MousePosition.x <= RIGHT_PANEL)
&& !TryIconCurs() && !TryIconCurs()
&& (pcursinvitem == -1 || !UseInvItem(myplr, pcursinvitem)))) { && (pcursinvitem == -1 || !UseInvItem(myplr, pcursinvitem)))) {
if (pcurs == CURSOR_HAND) { if (pcurs == CURSOR_HAND) {
@ -897,10 +895,10 @@ static void ReleaseKey(int vkey)
static void ClosePanels() static void ClosePanels()
{ {
if (CanPanelsCoverView()) { if (CanPanelsCoverView()) {
if (!chrflag && !questlog && (invflag || sbookflag) && MouseX < 480 && MouseY < PANEL_TOP) { if (!chrflag && !questlog && (invflag || sbookflag) && MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX + 160, MouseY); SetCursorPos(MousePosition.x + 160, MousePosition.y);
} else if (!invflag && !sbookflag && (chrflag || questlog) && MouseX > 160 && MouseY < PANEL_TOP) { } else if (!invflag && !sbookflag && (chrflag || questlog) && MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX - 160, MouseY); SetCursorPos(MousePosition.x - 160, MousePosition.y);
} }
} }
invflag = false; invflag = false;
@ -1200,8 +1198,7 @@ static void PressChar(int32_t vkey)
static void GetMousePos(int32_t lParam) static void GetMousePos(int32_t lParam)
{ {
MouseX = (short)(lParam & 0xffff); MousePosition = { (short)(lParam & 0xffff), (short)((lParam >> 16) & 0xffff) };
MouseY = (short)((lParam >> 16) & 0xffff);
} }
void DisableInputWndProc(uint32_t uMsg, int32_t wParam, int32_t lParam) void DisableInputWndProc(uint32_t uMsg, int32_t wParam, int32_t lParam)
@ -1857,12 +1854,12 @@ void inventoryKeyPressed()
invflag = !invflag; invflag = !invflag;
if (!chrflag && !questlog && CanPanelsCoverView()) { if (!chrflag && !questlog && CanPanelsCoverView()) {
if (!invflag) { // We closed the invetory if (!invflag) { // We closed the invetory
if (MouseX < 480 && MouseY < PANEL_TOP) { if (MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX + 160, MouseY); SetCursorPos(MousePosition.x + 160, MousePosition.y);
} }
} else if (!sbookflag) { // We opened the invetory } else if (!sbookflag) { // We opened the invetory
if (MouseX > 160 && MouseY < PANEL_TOP) { if (MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX - 160, MouseY); SetCursorPos(MousePosition.x - 160, MousePosition.y);
} }
} }
} }
@ -1876,12 +1873,12 @@ void characterSheetKeyPressed()
chrflag = !chrflag; chrflag = !chrflag;
if (!invflag && !sbookflag && CanPanelsCoverView()) { if (!invflag && !sbookflag && CanPanelsCoverView()) {
if (!chrflag) { // We closed the character sheet if (!chrflag) { // We closed the character sheet
if (MouseX > 160 && MouseY < PANEL_TOP) { if (MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX - 160, MouseY); SetCursorPos(MousePosition.x - 160, MousePosition.y);
} }
} else if (!questlog) { // We opened the character sheet } else if (!questlog) { // We opened the character sheet
if (MouseX < 480 && MouseY < PANEL_TOP) { if (MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX + 160, MouseY); SetCursorPos(MousePosition.x + 160, MousePosition.y);
} }
} }
} }
@ -1899,12 +1896,12 @@ void questLogKeyPressed()
} }
if (!invflag && !sbookflag && CanPanelsCoverView()) { if (!invflag && !sbookflag && CanPanelsCoverView()) {
if (!questlog) { // We closed the quest log if (!questlog) { // We closed the quest log
if (MouseX > 160 && MouseY < PANEL_TOP) { if (MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX - 160, MouseY); SetCursorPos(MousePosition.x - 160, MousePosition.y);
} }
} else if (!chrflag) { // We opened the character quest log } else if (!chrflag) { // We opened the character quest log
if (MouseX < 480 && MouseY < PANEL_TOP) { if (MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX + 160, MouseY); SetCursorPos(MousePosition.x + 160, MousePosition.y);
} }
} }
} }
@ -1934,12 +1931,12 @@ void spellBookKeyPressed()
sbookflag = !sbookflag; sbookflag = !sbookflag;
if (!chrflag && !questlog && CanPanelsCoverView()) { if (!chrflag && !questlog && CanPanelsCoverView()) {
if (!sbookflag) { // We closed the invetory if (!sbookflag) { // We closed the invetory
if (MouseX < 480 && MouseY < PANEL_TOP) { if (MousePosition.x < 480 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX + 160, MouseY); SetCursorPos(MousePosition.x + 160, MousePosition.y);
} }
} else if (!invflag) { // We opened the invetory } else if (!invflag) { // We opened the invetory
if (MouseX > 160 && MouseY < PANEL_TOP) { if (MousePosition.x > 160 && MousePosition.y < PANEL_TOP) {
SetCursorPos(MouseX - 160, MouseY); SetCursorPos(MousePosition.x - 160, MousePosition.y);
} }
} }
} }

3
Source/diablo.h

@ -31,8 +31,7 @@ enum clicktype : int8_t {
extern SDL_Window *ghMainWnd; extern SDL_Window *ghMainWnd;
extern DWORD glSeedTbl[NUMLEVELS]; extern DWORD glSeedTbl[NUMLEVELS];
extern dungeon_type gnLevelTypeTbl[NUMLEVELS]; extern dungeon_type gnLevelTypeTbl[NUMLEVELS];
extern int MouseX; extern Point MousePosition;
extern int MouseY;
extern bool gbRunGame; extern bool gbRunGame;
extern bool gbRunGameResult; extern bool gbRunGameResult;
extern bool zoomflag; extern bool zoomflag;

20
Source/gmenu.cpp

@ -257,10 +257,10 @@ bool gmenu_presskeys(int vkey)
static bool GmenuMouseNavigation() static bool GmenuMouseNavigation()
{ {
if (MouseX < 282 + PANEL_LEFT) { if (MousePosition.x < 282 + PANEL_LEFT) {
return false; return false;
} }
if (MouseX > 538 + PANEL_LEFT) { if (MousePosition.x > 538 + PANEL_LEFT) {
return false; return false;
} }
return true; return true;
@ -268,13 +268,13 @@ static bool GmenuMouseNavigation()
static int GmenuGetMouseSlider() static int GmenuGetMouseSlider()
{ {
if (MouseX < 282 + PANEL_LEFT) { if (MousePosition.x < 282 + PANEL_LEFT) {
return 0; return 0;
} }
if (MouseX > 538 + PANEL_LEFT) { if (MousePosition.x > 538 + PANEL_LEFT) {
return 256; return 256;
} }
return MouseX - 282 - PANEL_LEFT; return MousePosition.x - 282 - PANEL_LEFT;
} }
bool gmenu_on_mouse_move() bool gmenu_on_mouse_move()
@ -306,13 +306,13 @@ bool gmenu_left_mouse(bool isDown)
if (sgpCurrentMenu == nullptr) { if (sgpCurrentMenu == nullptr) {
return false; return false;
} }
if (MouseY >= PANEL_TOP) { if (MousePosition.y >= PANEL_TOP) {
return false; return false;
} }
if (MouseY - (117 + UI_OFFSET_Y) < 0) { if (MousePosition.y - (117 + UI_OFFSET_Y) < 0) {
return true; return true;
} }
int i = (MouseY - (117 + UI_OFFSET_Y)) / 45; int i = (MousePosition.y - (117 + UI_OFFSET_Y)) / 45;
if (i >= sgCurrentMenuIdx) { if (i >= sgCurrentMenuIdx) {
return true; return true;
} }
@ -321,10 +321,10 @@ bool gmenu_left_mouse(bool isDown)
return true; return true;
} }
int w = GmenuGetLfont(pItem); int w = GmenuGetLfont(pItem);
if (MouseX < gnScreenWidth / 2 - w / 2) { if (MousePosition.x < gnScreenWidth / 2 - w / 2) {
return true; return true;
} }
if (MouseX > gnScreenWidth / 2 + w / 2) { if (MousePosition.x > gnScreenWidth / 2 + w / 2) {
return true; return true;
} }
sgpCurrItem = pItem; sgpCurrItem = pItem;

18
Source/inv.cpp

@ -1168,7 +1168,7 @@ void CheckInvPaste(int pnum, Point cursorPosition)
CalcPlrInv(pnum, true); CalcPlrInv(pnum, true);
if (pnum == myplr) { if (pnum == myplr) {
if (cn == CURSOR_HAND && !IsHardwareCursor()) if (cn == CURSOR_HAND && !IsHardwareCursor())
SetCursorPos(MouseX + (cursW / 2), MouseY + (cursH / 2)); SetCursorPos(MousePosition.x + (cursW / 2), MousePosition.y + (cursH / 2));
NewCursor(cn); NewCursor(cn);
} }
} }
@ -1429,9 +1429,9 @@ void inv_update_rem_item(int pnum, BYTE iv)
void CheckInvItem(bool isShiftHeld) void CheckInvItem(bool isShiftHeld)
{ {
if (pcurs >= CURSOR_FIRSTITEM) { if (pcurs >= CURSOR_FIRSTITEM) {
CheckInvPaste(myplr, { MouseX, MouseY }); CheckInvPaste(myplr, MousePosition);
} else { } else {
CheckInvCut(myplr, { MouseX, MouseY }, isShiftHeld); CheckInvCut(myplr, MousePosition, isShiftHeld);
} }
} }
@ -1440,8 +1440,8 @@ void CheckInvItem(bool isShiftHeld)
*/ */
void CheckInvScrn(bool isShiftHeld) void CheckInvScrn(bool isShiftHeld)
{ {
if (MouseX > 190 + PANEL_LEFT && MouseX < 437 + PANEL_LEFT if (MousePosition.x > 190 + PANEL_LEFT && MousePosition.x < 437 + PANEL_LEFT
&& MouseY > PANEL_TOP && MouseY < 33 + PANEL_TOP) { && MousePosition.y > PANEL_TOP && MousePosition.y < 33 + PANEL_TOP) {
CheckInvItem(isShiftHeld); CheckInvItem(isShiftHeld);
} }
} }
@ -1907,10 +1907,10 @@ char CheckInvHLight()
yo = PANEL_TOP; yo = PANEL_TOP;
} }
if (MouseX >= InvRect[r].x + xo if (MousePosition.x >= InvRect[r].x + xo
&& MouseX < InvRect[r].x + xo + (InventorySlotSizeInPixels.width + 1) && MousePosition.x < InvRect[r].x + xo + (InventorySlotSizeInPixels.width + 1)
&& MouseY >= InvRect[r].y + yo - (InventorySlotSizeInPixels.height + 1) && MousePosition.y >= InvRect[r].y + yo - (InventorySlotSizeInPixels.height + 1)
&& MouseY < InvRect[r].y + yo) { && MousePosition.y < InvRect[r].y + yo) {
break; break;
} }
} }

7
Source/miniwin/misc_msg.cpp

@ -326,7 +326,7 @@ bool FetchMessage(tagMSG *lpMsg)
} }
#ifndef USE_SDL1 #ifndef USE_SDL1
handle_touch(&e, MouseX, MouseY); handle_touch(&e, MousePosition.x, MousePosition.y);
#endif #endif
#ifdef USE_SDL1 #ifdef USE_SDL1
@ -444,7 +444,7 @@ bool FetchMessage(tagMSG *lpMsg)
lpMsg->message = action.send_mouse_click.up ? DVL_WM_RBUTTONUP : DVL_WM_RBUTTONDOWN; lpMsg->message = action.send_mouse_click.up ? DVL_WM_RBUTTONUP : DVL_WM_RBUTTONDOWN;
break; break;
} }
lpMsg->lParam = PositionForMouse(MouseX, MouseY); lpMsg->lParam = PositionForMouse(MousePosition.x, MousePosition.y);
break; break;
} }
return true; return true;
@ -562,8 +562,7 @@ bool FetchMessage(tagMSG *lpMsg)
// and SDL_GetMouseState gives previous location if mouse was // and SDL_GetMouseState gives previous location if mouse was
// outside window (observed on Ubuntu 19.04) // outside window (observed on Ubuntu 19.04)
if (mouseWarping) { if (mouseWarping) {
MouseX = mouseWarpingX; MousePosition = { mouseWarpingX, mouseWarpingY };
MouseY = mouseWarpingY;
mouseWarping = false; mouseWarping = false;
} }
break; break;

4
Source/movie.cpp

@ -67,8 +67,8 @@ void play_movie(const char *pszMovie, bool user_can_close)
movie_playing = false; movie_playing = false;
SDL_GetMouseState(&MouseX, &MouseY); SDL_GetMouseState(&MousePosition.x, &MousePosition.y);
OutputToLogical(&MouseX, &MouseY); OutputToLogical(&MousePosition.x, &MousePosition.y);
} }
} // namespace devilution } // namespace devilution

6
Source/player.cpp

@ -3625,12 +3625,12 @@ void CheckPlrSpell()
if (pcurs != CURSOR_HAND) if (pcurs != CURSOR_HAND)
return; return;
if (MouseY >= PANEL_TOP && MouseX >= PANEL_LEFT && MouseX <= RIGHT_PANEL) // inside main panel if (MousePosition.y >= PANEL_TOP && MousePosition.x >= PANEL_LEFT && MousePosition.x <= RIGHT_PANEL) // inside main panel
return; return;
if ( if (
((chrflag || questlog) && MouseX < SPANEL_WIDTH && MouseY < SPANEL_HEIGHT) // inside left panel ((chrflag || questlog) && MousePosition.x < SPANEL_WIDTH && MousePosition.y < SPANEL_HEIGHT) // inside left panel
|| ((invflag || sbookflag) && MouseX > RIGHT_PANEL && MouseY < SPANEL_HEIGHT) // inside right panel || ((invflag || sbookflag) && MousePosition.x > RIGHT_PANEL && MousePosition.y < SPANEL_HEIGHT) // inside right panel
) { ) {
if (rspell != SPL_HEAL if (rspell != SPL_HEAL
&& rspell != SPL_IDENTIFY && rspell != SPL_IDENTIFY

8
Source/qol/itemlabels.cpp

@ -93,11 +93,11 @@ void AddItemToLabelQueue(int id, int x, int y)
bool IsMouseOverGameArea() bool IsMouseOverGameArea()
{ {
if ((invflag || sbookflag) && MouseX > RIGHT_PANEL && MouseY <= SPANEL_HEIGHT) if ((invflag || sbookflag) && MousePosition.x > RIGHT_PANEL && MousePosition.y <= SPANEL_HEIGHT)
return false; return false;
if ((chrflag || questlog) && MouseX < SPANEL_WIDTH && MouseY <= SPANEL_HEIGHT) if ((chrflag || questlog) && MousePosition.x < SPANEL_WIDTH && MousePosition.y <= SPANEL_HEIGHT)
return false; return false;
if (MouseY >= PANEL_TOP && MouseX >= PANEL_LEFT && MouseX <= PANEL_LEFT + PANEL_WIDTH) if (MousePosition.y >= PANEL_TOP && MousePosition.x >= PANEL_LEFT && MousePosition.x <= PANEL_LEFT + PANEL_WIDTH)
return false; return false;
return true; return true;
@ -147,7 +147,7 @@ void DrawItemNameLabels(const CelOutputBuffer &out)
for (const itemLabel &label : labelQueue) { for (const itemLabel &label : labelQueue) {
ItemStruct &itm = items[label.id]; ItemStruct &itm = items[label.id];
if (MouseX >= label.pos.x && MouseX < label.pos.x + label.width && MouseY >= label.pos.y - height + marginY && MouseY < label.pos.y + marginY) { if (MousePosition.x >= label.pos.x && MousePosition.x < label.pos.x + label.width && MousePosition.y >= label.pos.y - height + marginY && MousePosition.y < label.pos.y + marginY) {
if (!gmenu_is_active() && PauseMode == 0 && !deathflag && IsMouseOverGameArea()) { if (!gmenu_is_active() && PauseMode == 0 && !deathflag && IsMouseOverGameArea()) {
isLabelHighlighted = true; isLabelHighlighted = true;
cursmx = itm.position.x; cursmx = itm.position.x;

2
Source/qol/xpbar.cpp

@ -118,7 +118,7 @@ bool CheckXPBarInfo()
const int backX = PANEL_LEFT + PANEL_WIDTH / 2 - 155; const int backX = PANEL_LEFT + PANEL_WIDTH / 2 - 155;
const int backY = PANEL_TOP + PANEL_HEIGHT - 11; const int backY = PANEL_TOP + PANEL_HEIGHT - 11;
if (MouseX < backX || MouseX >= backX + BACK_WIDTH || MouseY < backY || MouseY >= backY + BACK_HEIGHT) if (MousePosition.x < backX || MousePosition.x >= backX + BACK_WIDTH || MousePosition.y < backY || MousePosition.y >= backY + BACK_HEIGHT)
return false; return false;
const auto &player = plr[myplr]; const auto &player = plr[myplr];

2
Source/quests.cpp

@ -801,7 +801,7 @@ void QuestlogEnter()
void QuestlogESC() void QuestlogESC()
{ {
int y = (MouseY - 32) / 12; int y = (MousePosition.y - 32) / 12;
for (int i = 0; i < numqlines; i++) { for (int i = 0; i < numqlines; i++) {
if (y == qtopline + 2 * i) { if (y == qtopline + 2 * i) {
qline = y; qline = y;

16
Source/scrollrt.cpp

@ -208,7 +208,7 @@ static void DrawCursor(const CelOutputBuffer &out)
// Copy the buffer before the item cursor and its 1px outline are drawn to a temporary buffer. // Copy the buffer before the item cursor and its 1px outline are drawn to a temporary buffer.
const int outlineWidth = IsItemSprite(pcurs) ? 1 : 0; const int outlineWidth = IsItemSprite(pcurs) ? 1 : 0;
if (MouseX < -cursW - outlineWidth || MouseX - outlineWidth >= out.w() || MouseY < -cursH - outlineWidth || MouseY - outlineWidth >= out.h()) if (MousePosition.x < -cursW - outlineWidth || MousePosition.x - outlineWidth >= out.w() || MousePosition.y < -cursH - outlineWidth || MousePosition.y - outlineWidth >= out.h())
return; return;
constexpr auto Clip = [](int &pos, std::uint32_t &length, std::uint32_t posEnd) { constexpr auto Clip = [](int &pos, std::uint32_t &length, std::uint32_t posEnd) {
@ -220,16 +220,16 @@ static void DrawCursor(const CelOutputBuffer &out)
} }
}; };
sgdwCursX = MouseX - outlineWidth; sgdwCursX = MousePosition.x - outlineWidth;
sgdwCursWdt = cursW + 2 * outlineWidth; sgdwCursWdt = cursW + 2 * outlineWidth;
Clip(sgdwCursX, sgdwCursWdt, out.w()); Clip(sgdwCursX, sgdwCursWdt, out.w());
sgdwCursY = MouseY - outlineWidth; sgdwCursY = MousePosition.y - outlineWidth;
sgdwCursHgt = cursH + 2 * outlineWidth; sgdwCursHgt = cursH + 2 * outlineWidth;
Clip(sgdwCursY, sgdwCursHgt, out.h()); Clip(sgdwCursY, sgdwCursHgt, out.h());
BlitCursor(sgSaveBack, sgdwCursWdt, out.at(sgdwCursX, sgdwCursY), out.pitch()); BlitCursor(sgSaveBack, sgdwCursWdt, out.at(sgdwCursX, sgdwCursY), out.pitch());
CelDrawCursor(out, Point { MouseX, MouseY + cursH - 1 }, pcurs); CelDrawCursor(out, MousePosition + Point { 0, cursH - 1 }, pcurs);
} }
/** /**
@ -1349,7 +1349,7 @@ void ScrollView()
scroll = false; scroll = false;
if (MouseX < 20) { if (MousePosition.x < 20) {
if (dmaxy - 1 <= ViewY || dminx >= ViewX) { if (dmaxy - 1 <= ViewY || dminx >= ViewX) {
if (dmaxy - 1 > ViewY) { if (dmaxy - 1 > ViewY) {
ViewY++; ViewY++;
@ -1365,7 +1365,7 @@ void ScrollView()
scroll = true; scroll = true;
} }
} }
if (MouseX > gnScreenWidth - 20) { if (MousePosition.x > gnScreenWidth - 20) {
if (dmaxx - 1 <= ViewX || dminy >= ViewY) { if (dmaxx - 1 <= ViewX || dminy >= ViewY) {
if (dmaxx - 1 > ViewX) { if (dmaxx - 1 > ViewX) {
ViewX++; ViewX++;
@ -1381,7 +1381,7 @@ void ScrollView()
scroll = true; scroll = true;
} }
} }
if (MouseY < 20) { if (MousePosition.y < 20) {
if (dminy >= ViewY || dminx >= ViewX) { if (dminy >= ViewY || dminx >= ViewX) {
if (dminy < ViewY) { if (dminy < ViewY) {
ViewY--; ViewY--;
@ -1397,7 +1397,7 @@ void ScrollView()
scroll = true; scroll = true;
} }
} }
if (MouseY > gnScreenHeight - 20) { if (MousePosition.y > gnScreenHeight - 20) {
if (dmaxy - 1 <= ViewY || dmaxx - 1 <= ViewX) { if (dmaxy - 1 <= ViewY || dmaxx - 1 <= ViewX) {
if (dmaxy - 1 > ViewY) { if (dmaxy - 1 > ViewY) {
ViewY++; ViewY++;

10
Source/stores.cpp

@ -2757,16 +2757,16 @@ void CheckStoreBtn()
qtextflag = false; qtextflag = false;
if (leveltype == DTYPE_TOWN) if (leveltype == DTYPE_TOWN)
stream_stop(); stream_stop();
} else if (stextsel != -1 && MouseY >= (32 + UI_OFFSET_Y) && MouseY <= (320 + UI_OFFSET_Y)) { } else if (stextsel != -1 && MousePosition.y >= (32 + UI_OFFSET_Y) && MousePosition.y <= (320 + UI_OFFSET_Y)) {
if (!stextsize) { if (!stextsize) {
if (MouseX < 344 + PANEL_LEFT || MouseX > 616 + PANEL_LEFT) if (MousePosition.x < 344 + PANEL_LEFT || MousePosition.x > 616 + PANEL_LEFT)
return; return;
} else { } else {
if (MouseX < 24 + PANEL_LEFT || MouseX > 616 + PANEL_LEFT) if (MousePosition.x < 24 + PANEL_LEFT || MousePosition.x > 616 + PANEL_LEFT)
return; return;
} }
y = (MouseY - (32 + UI_OFFSET_Y)) / 12; y = (MousePosition.y - (32 + UI_OFFSET_Y)) / 12;
if (stextscrl && MouseX > 600 + PANEL_LEFT) { if (stextscrl && MousePosition.x > 600 + PANEL_LEFT) {
if (y == 4) { if (y == 4) {
if (stextscrlubtn <= 0) { if (stextscrlubtn <= 0) {
STextUp(); STextUp();

2
Source/trigs.cpp

@ -768,7 +768,7 @@ void CheckTrigForce()
{ {
trigflag = false; trigflag = false;
if (!sgbControllerActive && MouseY > PANEL_TOP - 1) { if (!sgbControllerActive && MousePosition.y > PANEL_TOP - 1) {
return; return;
} }

Loading…
Cancel
Save