1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Fix #996, #2254, #2589, #2875: Viewport scrolling getting stuck or shaking

Shaking while at the edge of the map has been completely eliminated. In
order to do this, comparison with tile height was also removed which
fixed a few outlier cases.

The main cause was viewport axis were only being set if it's respective
isometric axis was at the boundary, instead of either isometric axis.
Viewport no longer gets stuck which was related to the shaking in the
end. (#2875)

Refactored viewport_update_position. I moved
viewport_set_underground_flag above the bounds checking function since
it had no relation to it. (#996, #2589)

Scrolling on the map edge with arrow keys or mouse edge will now go the
same speed in both directions. (#2254)

Added changelog entry.
This commit is contained in:
Robert Jordan
2017-11-08 11:43:50 -05:00
committed by Michael Steenbeek
parent 27e3703fec
commit 4c3065619e
5 changed files with 112 additions and 61 deletions

View File

@@ -101,17 +101,7 @@ static void game_handle_key_scroll()
const uint8 * keysState = context_get_keys_state();
get_keyboard_map_scroll(keysState, &scrollX, &scrollY);
// Scroll viewport
if (scrollX != 0)
{
mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom);
input_set_flag(INPUT_FLAG_VIEWPORT_SCROLLING, true);
}
if (scrollY != 0)
{
mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom);
input_set_flag(INPUT_FLAG_VIEWPORT_SCROLLING, true);
}
input_scroll_viewport(scrollX, scrollY);
}
static sint32 input_scancode_to_rct_keycode(sint32 sdl_key)