1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Part of #12245: Use coords for window_scroll_to_location (#12282)

This commit is contained in:
frutiemax
2020-07-15 22:26:27 -04:00
committed by GitHub
parent c474f2ddc0
commit 0fa0ca451e
11 changed files with 33 additions and 46 deletions

View File

@@ -809,18 +809,14 @@ rct_window* window_get_main()
* @param y (ecx)
* @param z (edx)
*/
void window_scroll_to_location(rct_window* w, int32_t x, int32_t y, int32_t z)
void window_scroll_to_location(rct_window* w, const CoordsXYZ& coords)
{
CoordsXYZ location_3d = { x, y, z };
assert(w != nullptr);
window_unfollow_sprite(w);
if (w->viewport)
{
int16_t height = tile_element_height({ x, y });
if (z < height - 16)
int16_t height = tile_element_height(coords);
if (coords.z < height - 16)
{
if (!(w->viewport->flags & 1 << 0))
{
@@ -837,7 +833,7 @@ void window_scroll_to_location(rct_window* w, int32_t x, int32_t y, int32_t z)
}
}
auto screenCoords = translate_3d_to_2d_with_z(get_current_rotation(), location_3d);
auto screenCoords = translate_3d_to_2d_with_z(get_current_rotation(), coords);
int32_t i = 0;
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))