From d3d853b7d6645b7b03f5bfd9b724a1b3cb32a7f1 Mon Sep 17 00:00:00 2001 From: hdpoliveira Date: Sun, 14 Jun 2020 19:50:26 -0300 Subject: [PATCH] Make loc_6DB38B receive only the update flag --- src/openrct2/ride/Track.cpp | 4 ++-- src/openrct2/ride/Track.h | 2 +- src/openrct2/ride/Vehicle.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index 5282c10bef..f470239ce0 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -1150,7 +1150,7 @@ int32_t track_get_actual_bank_2(int32_t rideType, bool isInverted, int32_t bank) return bank; } -int32_t track_get_actual_bank_3(Vehicle* vehicle, TileElement* tileElement) +int32_t track_get_actual_bank_3(bool useInvertedSprites, TileElement* tileElement) { auto trackType = tileElement->AsTrack()->GetTrackType(); auto bankStart = TrackDefinitions[trackType].bank_start; @@ -1158,7 +1158,7 @@ int32_t track_get_actual_bank_3(Vehicle* vehicle, TileElement* tileElement) if (ride == nullptr) return bankStart; - bool isInverted = vehicle->HasUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES) ^ tileElement->AsTrack()->IsInverted(); + bool isInverted = useInvertedSprites ^ tileElement->AsTrack()->IsInverted(); return track_get_actual_bank_2(ride->type, isInverted, bankStart); } diff --git a/src/openrct2/ride/Track.h b/src/openrct2/ride/Track.h index 72474bec3d..23e4e3a5ee 100644 --- a/src/openrct2/ride/Track.h +++ b/src/openrct2/ride/Track.h @@ -558,7 +558,7 @@ bool track_type_is_station(track_type_t trackType); int32_t track_get_actual_bank(TileElement* tileElement, int32_t bank); int32_t track_get_actual_bank_2(int32_t rideType, bool isInverted, int32_t bank); -int32_t track_get_actual_bank_3(Vehicle* vehicle, TileElement* tileElement); +int32_t track_get_actual_bank_3(bool useInvertedSprites, TileElement* tileElement); bool track_add_station_element(CoordsXYZD loc, ride_id_t rideIndex, int32_t flags, bool fromTrackDesign); bool track_remove_station_element(int32_t x, int32_t y, int32_t z, Direction direction, ride_id_t rideIndex, int32_t flags); diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 6102db1f70..2b0afa17b8 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -7481,10 +7481,10 @@ static void vehicle_update_scenery_door(Vehicle* vehicle) * * rct2: 0x006DB38B */ -static bool loc_6DB38B(Vehicle* vehicle, TileElement* tileElement) +static bool loc_6DB38B(bool useInvertedSprites, TileElement* tileElement) { // Get bank - int32_t bankStart = track_get_actual_bank_3(vehicle, tileElement); + int32_t bankStart = track_get_actual_bank_3(useInvertedSprites, tileElement); // Get vangle int32_t trackType = tileElement->AsTrack()->GetTrackType(); @@ -8034,7 +8034,7 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur } } - if (!loc_6DB38B(this, tileElement)) + if (!loc_6DB38B(HasUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES), tileElement)) { return false; } @@ -8815,7 +8815,7 @@ loc_6DC476: direction = outDirection; } - if (!loc_6DB38B(this, tileElement)) + if (!loc_6DB38B(HasUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES), tileElement)) { goto loc_6DC9BC; } @@ -9027,7 +9027,7 @@ loc_6DCA9A: tileElement = trackBeginEnd.begin_element; } - if (!loc_6DB38B(this, tileElement)) + if (!loc_6DB38B(HasUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES), tileElement)) { goto loc_6DCD4A; }