mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-29 09:44:52 +01:00
Fix ViewportAdjustForMapHeight not using the correct rotation
This commit is contained in:
@@ -254,11 +254,10 @@ void ViewportsInvalidate(const ScreenRect& screenRect, ZoomLevel maxZoom)
|
||||
* edx is assumed to be (and always is) the current rotation, so it is not
|
||||
* needed as parameter.
|
||||
*/
|
||||
CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords)
|
||||
CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords, uint8_t rotation)
|
||||
{
|
||||
int32_t height = 0;
|
||||
|
||||
uint32_t rotation = GetCurrentRotation();
|
||||
CoordsXY pos{};
|
||||
for (int32_t i = 0; i < 6; i++)
|
||||
{
|
||||
|
||||
@@ -137,7 +137,7 @@ void ViewportUpdateSmartFollowStaff(WindowBase* window, const Staff* peep);
|
||||
void ViewportUpdateSmartFollowVehicle(WindowBase* window);
|
||||
void ViewportRender(DrawPixelInfo& dpi, const Viewport* viewport, const ScreenRect& screenRect);
|
||||
|
||||
CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords);
|
||||
CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords, uint8_t rotation);
|
||||
|
||||
CoordsXY ViewportPosToMapPos(const ScreenCoordsXY& coords, int32_t z);
|
||||
std::optional<CoordsXY> ScreenPosToMapPos(const ScreenCoordsXY& screenCoords, int32_t* direction);
|
||||
|
||||
@@ -924,7 +924,7 @@ void WindowRotateCamera(WindowBase& w, int32_t direction)
|
||||
{
|
||||
auto viewPos = ScreenCoordsXY{ (viewport->view_width >> 1), (viewport->view_height >> 1) } + viewport->viewPos;
|
||||
|
||||
coords = ViewportAdjustForMapHeight(viewPos);
|
||||
coords = ViewportAdjustForMapHeight(viewPos, viewport->rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -957,7 +957,7 @@ void WindowViewportGetMapCoordsByCursor(
|
||||
|
||||
// Compute map coordinate by mouse position.
|
||||
auto viewportPos = w.viewport->ScreenToViewportCoord(mouseCoords);
|
||||
auto coordsXYZ = ViewportAdjustForMapHeight(viewportPos);
|
||||
auto coordsXYZ = ViewportAdjustForMapHeight(viewportPos, w.viewport->rotation);
|
||||
auto mapCoords = ViewportPosToMapPos(viewportPos, coordsXYZ.z);
|
||||
*map_x = mapCoords.x;
|
||||
*map_y = mapCoords.y;
|
||||
|
||||
Reference in New Issue
Block a user