mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Distinguish Screen and Map Coords on window_rotate_camera
This commit is contained in:
@@ -922,21 +922,20 @@ void window_rotate_camera(rct_window* w, int32_t direction)
|
|||||||
// x is LOCATION_NULL if middle of viewport is obstructed by another window?
|
// x is LOCATION_NULL if middle of viewport is obstructed by another window?
|
||||||
if (coords.x == LOCATION_NULL || other != viewport)
|
if (coords.x == LOCATION_NULL || other != viewport)
|
||||||
{
|
{
|
||||||
coords.x = (viewport->view_width >> 1) + viewport->view_x;
|
x = (viewport->view_width >> 1) + viewport->view_x;
|
||||||
coords.y = (viewport->view_height >> 1) + viewport->view_y;
|
y = (viewport->view_height >> 1) + viewport->view_y;
|
||||||
|
|
||||||
viewport_adjust_for_map_height(&x, &y, &z);
|
viewport_adjust_for_map_height(&x, &y, &z);
|
||||||
coords = { x, y };
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = tile_element_height({ coords.x, coords.y });
|
z = tile_element_height(coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
gCurrentRotation = (get_current_rotation() + direction) & 3;
|
gCurrentRotation = (get_current_rotation() + direction) & 3;
|
||||||
|
|
||||||
int32_t new_x, new_y;
|
int32_t new_x, new_y;
|
||||||
centre_2d_coordinates(coords.x, coords.y, z, &new_x, &new_y, viewport);
|
centre_2d_coordinates(x, y, z, &new_x, &new_y, viewport);
|
||||||
|
|
||||||
w->saved_view_x = new_x;
|
w->saved_view_x = new_x;
|
||||||
w->saved_view_y = new_y;
|
w->saved_view_y = new_y;
|
||||||
|
|||||||
Reference in New Issue
Block a user