1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 23:33:04 +01:00

Port some OpenLoco helper functions (#13113)

* Port some OpenLoco helper functions

Added a few helper functions from OpenLoco to make viewport code a bit simpler
This commit is contained in:
Duncan
2020-10-13 02:25:11 +01:00
committed by GitHub
parent 0c195d14b9
commit 250586cb45
7 changed files with 31 additions and 20 deletions

View File

@@ -948,7 +948,7 @@ void window_viewport_get_map_coords_by_cursor(
auto mouseCoords = context_get_cursor_position_scaled();
// Compute map coordinate by mouse position.
auto viewportPos = screen_coord_to_viewport_coord(w->viewport, mouseCoords);
auto viewportPos = w->viewport->ScreenToViewportCoord(mouseCoords);
auto coordsXYZ = viewport_adjust_for_map_height(viewportPos);
auto mapCoords = viewport_coord_to_map_coord(viewportPos, coordsXYZ.z);
*map_x = mapCoords.x;