mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r1080) Improve mini-map scrolling in a similar way as viewport scrolling (r1063): now the centre of the mini-map window is the region of interest instead some arbitrary coordinate.
This commit is contained in:
parent
0495bbdca1
commit
cf8e2459e7
16
window.c
16
window.c
@ -968,6 +968,10 @@ stop_capt:;
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// scroll the smallmap ?
|
// scroll the smallmap ?
|
||||||
|
int hx;
|
||||||
|
int hy;
|
||||||
|
int hvx;
|
||||||
|
int hvy;
|
||||||
|
|
||||||
_cursor.fix_at = true;
|
_cursor.fix_at = true;
|
||||||
|
|
||||||
@ -996,10 +1000,14 @@ stop_capt:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x < 16) { x = 16; sub = 0; }
|
hx = (w->widget[4].right - w->widget[4].left) / 2;
|
||||||
if (x > (TILES_X-2)*16) { x = (TILES_X-2)*16; sub = 0; }
|
hy = (w->widget[4].bottom - w->widget[4].top ) / 2;
|
||||||
if (y < -1120) { y = -1120; sub = 0; }
|
hvx = hx * -4 + hy * 8;
|
||||||
if (y > (TILE_X_MAX-40) * 16) { y = (TILE_X_MAX-40) * 16; sub = 0; }
|
hvy = hx * 4 + hy * 8;
|
||||||
|
if (x < -hvx) { x = -hvx; sub = 0; }
|
||||||
|
if (x > TILE_X_MAX * 16 - hvx) { x = TILE_X_MAX * 16 - hvx; sub = 0; }
|
||||||
|
if (y < -hvy) { y = -hvy; sub = 0; }
|
||||||
|
if (y > TILE_Y_MAX * 16 - hvy) { y = TILE_Y_MAX * 16 - hvy; sub = 0; }
|
||||||
|
|
||||||
WP(w,smallmap_d).scroll_x = x;
|
WP(w,smallmap_d).scroll_x = x;
|
||||||
WP(w,smallmap_d).scroll_y = y;
|
WP(w,smallmap_d).scroll_y = y;
|
||||||
|
Loading…
Reference in New Issue
Block a user