mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Improve coords management on window_rotate_camera
This commit is contained in:
@@ -922,10 +922,11 @@ void window_rotate_camera(rct_window* w, int32_t direction)
|
||||
// x is LOCATION_NULL if middle of viewport is obstructed by another window?
|
||||
if (coords.x == LOCATION_NULL || other != viewport)
|
||||
{
|
||||
x = (viewport->view_width >> 1) + viewport->view_x;
|
||||
y = (viewport->view_height >> 1) + viewport->view_y;
|
||||
int16_t view_x = (viewport->view_width >> 1) + viewport->view_x;
|
||||
int16_t view_y = (viewport->view_height >> 1) + viewport->view_y;
|
||||
|
||||
viewport_adjust_for_map_height(&x, &y, &z);
|
||||
viewport_adjust_for_map_height(&view_x, &view_y, &z);
|
||||
coords = { view_x, view_y };
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -935,7 +936,7 @@ void window_rotate_camera(rct_window* w, int32_t direction)
|
||||
gCurrentRotation = (get_current_rotation() + direction) & 3;
|
||||
|
||||
int32_t new_x, new_y;
|
||||
centre_2d_coordinates(x, y, z, &new_x, &new_y, viewport);
|
||||
centre_2d_coordinates(coords.x, coords.y, z, &new_x, &new_y, viewport);
|
||||
|
||||
w->saved_view_x = new_x;
|
||||
w->saved_view_y = new_y;
|
||||
|
||||
Reference in New Issue
Block a user