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

View File

@ -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 {