From 33141672ed8343271dab92e66bee5c29e2391fbd Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Fri, 10 Feb 2023 09:00:59 +0300 Subject: [PATCH] Use screen borders for scrolling worldmap --- src/worldmap.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/worldmap.cc b/src/worldmap.cc index 34148c9..a02914f 100644 --- a/src/worldmap.cc +++ b/src/worldmap.cc @@ -745,12 +745,6 @@ static int wmRndCallCount = 0; // 0x51DEAC static int _terrainCounter = 1; -// 0x51DEB0 -static unsigned int _lastTime_2 = 0; - -// 0x51DEB4 -static bool _couldScroll = true; - // 0x51DEC8 static char* wmRemapSfxList[2] = { _aCricket, @@ -4871,19 +4865,25 @@ static int wmInterfaceScrollPixel(int stepX, int stepY, int dx, int dy, bool* su // 0x4C32EC static void wmMouseBkProc() { + // 0x51DEB0 + static unsigned int lastTime = 0; + + // 0x51DEB4 + static bool couldScroll = true; + int x; int y; - mouseGetPositionInWindow(wmBkWin, &x, &y); + mouseGetPosition(&x, &y); int dx = 0; - if (x == 639) { + if (x == screenGetWidth() - 1) { dx = 1; } else if (x == 0) { dx = -1; } int dy = 0; - if (y == 479) { + if (y == screenGetHeight() - 1) { dy = 1; } else if (y == 0) { dy = -1; @@ -4918,13 +4918,13 @@ static void wmMouseBkProc() } unsigned int tick = _get_bk_time(); - if (getTicksBetween(tick, _lastTime_2) > 50) { - _lastTime_2 = _get_bk_time(); + if (getTicksBetween(tick, lastTime) > 50) { + lastTime = _get_bk_time(); // NOTE: Uninline. - wmInterfaceScroll(dx, dy, &_couldScroll); + wmInterfaceScroll(dx, dy, &couldScroll); } - if (!_couldScroll) { + if (!couldScroll) { newMouseCursor += 8; } } else {