Use screen borders for scrolling worldmap

This commit is contained in:
Alexander Batalov 2023-02-10 09:00:59 +03:00
parent 28083cfea9
commit 33141672ed
1 changed files with 13 additions and 13 deletions

View File

@ -745,12 +745,6 @@ static int wmRndCallCount = 0;
// 0x51DEAC // 0x51DEAC
static int _terrainCounter = 1; static int _terrainCounter = 1;
// 0x51DEB0
static unsigned int _lastTime_2 = 0;
// 0x51DEB4
static bool _couldScroll = true;
// 0x51DEC8 // 0x51DEC8
static char* wmRemapSfxList[2] = { static char* wmRemapSfxList[2] = {
_aCricket, _aCricket,
@ -4871,19 +4865,25 @@ static int wmInterfaceScrollPixel(int stepX, int stepY, int dx, int dy, bool* su
// 0x4C32EC // 0x4C32EC
static void wmMouseBkProc() static void wmMouseBkProc()
{ {
// 0x51DEB0
static unsigned int lastTime = 0;
// 0x51DEB4
static bool couldScroll = true;
int x; int x;
int y; int y;
mouseGetPositionInWindow(wmBkWin, &x, &y); mouseGetPosition(&x, &y);
int dx = 0; int dx = 0;
if (x == 639) { if (x == screenGetWidth() - 1) {
dx = 1; dx = 1;
} else if (x == 0) { } else if (x == 0) {
dx = -1; dx = -1;
} }
int dy = 0; int dy = 0;
if (y == 479) { if (y == screenGetHeight() - 1) {
dy = 1; dy = 1;
} else if (y == 0) { } else if (y == 0) {
dy = -1; dy = -1;
@ -4918,13 +4918,13 @@ static void wmMouseBkProc()
} }
unsigned int tick = _get_bk_time(); unsigned int tick = _get_bk_time();
if (getTicksBetween(tick, _lastTime_2) > 50) { if (getTicksBetween(tick, lastTime) > 50) {
_lastTime_2 = _get_bk_time(); lastTime = _get_bk_time();
// NOTE: Uninline. // NOTE: Uninline.
wmInterfaceScroll(dx, dy, &_couldScroll); wmInterfaceScroll(dx, dy, &couldScroll);
} }
if (!_couldScroll) { if (!couldScroll) {
newMouseCursor += 8; newMouseCursor += 8;
} }
} else { } else {