From 01c62437b2671eaad6b948bf679b8619df0e9473 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Mon, 9 Dec 2019 16:52:47 -0300 Subject: [PATCH] Remove Ride::ride_get_rotated_coords() --- src/openrct2-ui/windows/RideConstruction.cpp | 2 +- src/openrct2/ride/Ride.cpp | 12 +++--------- src/openrct2/ride/Ride.h | 2 -- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index a98371090f..820e3d1a1f 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2385,7 +2385,7 @@ static void window_ride_construction_draw_track_piece( : TrackDefinitions[trackType].preview_z_offset; mapCoords.z -= previewZOffset; - const ScreenCoordsXY rotatedScreenCoords = ride_get_rotated_coords(mapCoords); + const ScreenCoordsXY rotatedScreenCoords = translate_3d_to_2d_with_z(get_current_rotation(), mapCoords); dpi->x += rotatedScreenCoords.x - width / 2; dpi->y += rotatedScreenCoords.y - height / 2 - 16; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 66807d0d02..cac818ec8e 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -2899,8 +2899,8 @@ static void ride_music_update(Ride* ride) return; } - TileCoordsXYZ rideTileCoords{ ride->stations[0].Start.x, ride->stations[0].Start.y, ride->stations[0].Height }; - CoordsXYZ rideCoords{rideTileCoords.ToCoordsXYZ()}; + TileCoordsXYZ stationTileCoords{ ride->stations[0].Start.x, ride->stations[0].Start.y, ride->stations[0].Height }; + CoordsXYZ rideCoords{ stationTileCoords.ToCoordsXYZ() }; rideCoords = { rideCoords.ToTileCentre(), rideCoords.z }; int32_t sampleRate = 22050; @@ -3567,7 +3567,7 @@ int32_t ride_music_params_update(CoordsXYZ rideCoords, Ride* ride, uint16_t samp { if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gGameSoundsOff && g_music_tracking_viewport != nullptr) { - const ScreenCoordsXY rotatedCoords = ride_get_rotated_coords(rideCoords); + const ScreenCoordsXY rotatedCoords = translate_3d_to_2d_with_z(get_current_rotation(), rideCoords); rct_viewport* viewport = g_music_tracking_viewport; int16_t view_width = viewport->view_width; int16_t view_width2 = view_width * 2; @@ -7657,12 +7657,6 @@ StationObject* ride_get_station_object(const Ride* ride) return static_cast(objManager.GetLoadedObject(OBJECT_TYPE_STATION, ride->entrance_style)); } -ScreenCoordsXY ride_get_rotated_coords(CoordsXYZ coords3d) -{ - auto screenCoords = translate_3d_to_2d_with_z(get_current_rotation(), coords3d); - return screenCoords; -} - // Normally, a station has at most one entrance and one exit, which are at the same height // as the station. But in hacked parks, neither can be taken for granted. This code ensures // that the ride->entrances and ride->exits arrays will point to one of them. There is diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index 45d74233e9..3cba7fc502 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -1278,8 +1278,6 @@ StationObject* ride_get_station_object(const Ride* ride); void ride_action_modify(Ride* ride, int32_t modifyType, int32_t flags); -ScreenCoordsXY ride_get_rotated_coords(CoordsXYZ coords); - void determine_ride_entrance_and_exit_locations(); void ride_clear_leftover_entrances(Ride* ride);