diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index afe5165230..4d7b2898a1 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -889,66 +889,6 @@ void WindowScrollToLocation(WindowBase& w, const CoordsXYZ& coords) } } -/** - * - * rct2: 0x00688956 - */ -static void call_event_viewport_rotate_on_all_windows() -{ - WindowVisitEach([](WindowBase* w) { w->OnViewportRotate(); }); -} - -/** - * - * rct2: 0x0068881A - * direction can be used to alter the camera rotation: - * 1: clockwise - * -1: anti-clockwise - */ -void WindowRotateCamera(WindowBase& w, int32_t direction) -{ - Viewport* viewport = w.viewport; - if (viewport == nullptr) - return; - - auto windowPos = ScreenCoordsXY{ (viewport->width >> 1), (viewport->height >> 1) } + viewport->pos; - - // has something to do with checking if middle of the viewport is obstructed - Viewport* other; - auto mapXYCoords = ScreenGetMapXY(windowPos, &other); - CoordsXYZ coords{}; - - // other != viewport probably triggers on viewports in ride or guest window? - // naoXYCoords is nullopt if middle of viewport is obstructed by another window? - if (!mapXYCoords.has_value() || other != viewport) - { - auto viewPos = ScreenCoordsXY{ (viewport->view_width >> 1), (viewport->view_height >> 1) } + viewport->viewPos; - - coords = ViewportAdjustForMapHeight(viewPos, viewport->rotation); - } - else - { - coords.x = mapXYCoords->x; - coords.y = mapXYCoords->y; - coords.z = TileElementHeight(coords); - } - - viewport->rotation = (viewport->rotation + direction) & 3; - - auto centreLoc = centre_2d_coordinates(coords, viewport); - - if (centreLoc.has_value()) - { - w.savedViewPos = centreLoc.value(); - viewport->viewPos = *centreLoc; - } - - w.Invalidate(); - - call_event_viewport_rotate_on_all_windows(); - ResetAllSpriteQuadrantPlacements(); -} - void WindowViewportGetMapCoordsByCursor( const WindowBase& w, int32_t* map_x, int32_t* map_y, int32_t* offset_x, int32_t* offset_y) { diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 9d84d0bd0a..f671194564 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -579,7 +579,6 @@ void WindowPushOthersBelow(WindowBase& w1); WindowBase* WindowGetMain(); void WindowScrollToLocation(WindowBase& w, const CoordsXYZ& coords); -void WindowRotateCamera(WindowBase& w, int32_t direction); void WindowViewportGetMapCoordsByCursor( const WindowBase& w, int32_t* map_x, int32_t* map_y, int32_t* offset_x, int32_t* offset_y); void WindowViewportCentreTileAroundCursor(WindowBase& w, int32_t map_x, int32_t map_y, int32_t offset_x, int32_t offset_y);