mirror of https://github.com/OpenTTD/OpenTTD
(svn r9885) -Fix r9846: some last bitshifts with zoom-levels that were forgotten
-Fix r9846: initialize the zoom level for 'screen', as assuming 0 is not correctrelease/0.6
parent
6954045bb4
commit
49aa3bedfb
|
@ -2425,8 +2425,8 @@ static void MainWindowWndProc(Window *w, WindowEvent *e)
|
||||||
_scrolling_viewport = false;
|
_scrolling_viewport = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WP(w, vp_d).scrollpos_x += e->we.scroll.delta.x << vp->zoom;
|
WP(w, vp_d).scrollpos_x += ScaleByZoom(e->we.scroll.delta.x, vp->zoom);
|
||||||
WP(w, vp_d).scrollpos_y += e->we.scroll.delta.y << vp->zoom;
|
WP(w, vp_d).scrollpos_y += ScaleByZoom(e->we.scroll.delta.y, vp->zoom);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_MOUSEWHEEL:
|
case WE_MOUSEWHEEL:
|
||||||
|
|
|
@ -505,6 +505,8 @@ int ttd_main(int argc, char *argv[])
|
||||||
LoadDriver(MUSIC_DRIVER, _ini_musicdriver);
|
LoadDriver(MUSIC_DRIVER, _ini_musicdriver);
|
||||||
LoadDriver(VIDEO_DRIVER, _ini_videodriver); // load video last, to prevent an empty window while sound and music loads
|
LoadDriver(VIDEO_DRIVER, _ini_videodriver); // load video last, to prevent an empty window while sound and music loads
|
||||||
_savegame_sort_order = SORT_BY_DATE | SORT_DESCENDING;
|
_savegame_sort_order = SORT_BY_DATE | SORT_DESCENDING;
|
||||||
|
/* Initialize the zoom level of the screen to normal */
|
||||||
|
_screen.zoom = ZOOM_LVL_NORMAL;
|
||||||
|
|
||||||
/* restore saved music volume */
|
/* restore saved music volume */
|
||||||
_music_driver->set_volume(msf.music_vol);
|
_music_driver->set_volume(msf.music_vol);
|
||||||
|
|
|
@ -152,7 +152,8 @@ static void StartSound(uint sound, int panning, uint volume)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const byte _vol_factor_by_zoom[ZOOM_LVL_END] = {255, 190, 134};
|
static const byte _vol_factor_by_zoom[] = {255, 190, 134, 87, 49};
|
||||||
|
assert_compile(lengthof(_vol_factor_by_zoom) == ZOOM_LVL_END);
|
||||||
|
|
||||||
static const byte _sound_base_vol[] = {
|
static const byte _sound_base_vol[] = {
|
||||||
128, 90, 128, 128, 128, 128, 128, 128,
|
128, 90, 128, 128, 128, 128, 128, 128,
|
||||||
|
|
|
@ -164,8 +164,8 @@ void AssignWindowViewport(Window *w, int x, int y,
|
||||||
|
|
||||||
vp->zoom = zoom;
|
vp->zoom = zoom;
|
||||||
|
|
||||||
vp->virtual_width = width << zoom;
|
vp->virtual_width = ScaleByZoom(width, zoom);
|
||||||
vp->virtual_height = height << zoom;
|
vp->virtual_height = ScaleByZoom(height, zoom);
|
||||||
|
|
||||||
if (follow_flags & 0x80000000) {
|
if (follow_flags & 0x80000000) {
|
||||||
const Vehicle *veh;
|
const Vehicle *veh;
|
||||||
|
@ -1196,17 +1196,17 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, const StringSpriteToDraw *ss
|
||||||
zoom = dp.zoom;
|
zoom = dp.zoom;
|
||||||
dp.zoom = ZOOM_LVL_NORMAL;
|
dp.zoom = ZOOM_LVL_NORMAL;
|
||||||
|
|
||||||
dp.left >>= zoom;
|
dp.left = UnScaleByZoom(dp.left, zoom);
|
||||||
dp.top >>= zoom;
|
dp.top = UnScaleByZoom(dp.top, zoom);
|
||||||
dp.width >>= zoom;
|
dp.width = UnScaleByZoom(dp.width, zoom);
|
||||||
dp.height >>= zoom;
|
dp.height = UnScaleByZoom(dp.height, zoom);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
uint16 colour;
|
uint16 colour;
|
||||||
|
|
||||||
if (ss->width != 0) {
|
if (ss->width != 0) {
|
||||||
int x = (ss->x >> zoom) - 1;
|
int x = UnScaleByZoom(ss->x, zoom) - 1;
|
||||||
int y = (ss->y >> zoom) - 1;
|
int y = UnScaleByZoom(ss->y, zoom) - 1;
|
||||||
int bottom = y + 11;
|
int bottom = y + 11;
|
||||||
int w = ss->width;
|
int w = ss->width;
|
||||||
|
|
||||||
|
@ -1239,7 +1239,7 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, const StringSpriteToDraw *ss
|
||||||
colour = 16;
|
colour = 16;
|
||||||
}
|
}
|
||||||
DrawString(
|
DrawString(
|
||||||
ss->x >> zoom, (ss->y >> zoom) - (ss->width & 0x8000 ? 2 : 0),
|
UnScaleByZoom(ss->x, zoom), UnScaleByZoom(ss->y, zoom) - (ss->width & 0x8000 ? 2 : 0),
|
||||||
ss->string, colour
|
ss->string, colour
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue