From dd8633499a0e1c0849a541aeb3d66cea28a4329d Mon Sep 17 00:00:00 2001 From: hdpoliveira Date: Sun, 19 Apr 2020 21:56:03 -0300 Subject: [PATCH] Part of #9473: Create Vehicle::UpdateTrackMotionUpStopCheck Converted from vehicle_update_track_motion_up_stop_check --- src/openrct2/ride/Vehicle.cpp | 22 +++++++++++----------- src/openrct2/ride/Vehicle.h | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index c313b6cf8b..503bdb193e 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -6480,9 +6480,9 @@ bool Vehicle::DodgemsCarWouldCollideAt(const CoordsXY& coords, uint16_t* collide * * rct2: 0x006DAB90 */ -static void vehicle_update_track_motion_up_stop_check(Vehicle* vehicle) +void Vehicle::UpdateTrackMotionUpStopCheck() const { - auto vehicleEntry = vehicle->Entry(); + auto vehicleEntry = Entry(); if (vehicleEntry == nullptr) { return; @@ -6491,14 +6491,14 @@ static void vehicle_update_track_motion_up_stop_check(Vehicle* vehicle) // No up stops (coaster types) if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_NO_UPSTOP_WHEELS) { - int32_t trackType = vehicle->track_type >> 2; + int32_t trackType = track_type >> 2; if (!track_element_is_covered(trackType)) { - auto gForces = vehicle->GetGForces(); + auto gForces = GetGForces(); gForces.LateralG = std::abs(gForces.LateralG); if (gForces.LateralG <= 150) { - if (dword_9A2970[vehicle->vehicle_sprite_type] < 0) + if (dword_9A2970[vehicle_sprite_type] < 0) { if (gForces.VerticalG > -40) { @@ -6511,7 +6511,7 @@ static void vehicle_update_track_motion_up_stop_check(Vehicle* vehicle) } } - if (vehicle->vehicle_sprite_type != 8) + if (vehicle_sprite_type != 8) { _vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_VEHICLE_DERAILED; } @@ -6520,12 +6520,12 @@ static void vehicle_update_track_motion_up_stop_check(Vehicle* vehicle) else if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_NO_UPSTOP_BOBSLEIGH) { // No up stops bobsleigh type - int32_t trackType = vehicle->track_type >> 2; + int32_t trackType = track_type >> 2; if (!track_element_is_covered(trackType)) { - auto gForces = vehicle->GetGForces(); + auto gForces = GetGForces(); - if (dword_9A2970[vehicle->vehicle_sprite_type] < 0) + if (dword_9A2970[vehicle_sprite_type] < 0) { if (gForces.VerticalG > -45) { @@ -6540,7 +6540,7 @@ static void vehicle_update_track_motion_up_stop_check(Vehicle* vehicle) } } - if (vehicle->vehicle_sprite_type != 8 && vehicle->vehicle_sprite_type != 55) + if (vehicle_sprite_type != 8 && vehicle_sprite_type != 55) { _vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_VEHICLE_DERAILED; } @@ -9540,7 +9540,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation) _vehicleMotionTrackFlags = 0; _vehicleStationIndex = STATION_INDEX_NULL; - vehicle_update_track_motion_up_stop_check(this); + UpdateTrackMotionUpStopCheck(); check_and_apply_block_section_stop_site(this); update_velocity(this); diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index eef016ae39..7759e2d95e 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -379,6 +379,7 @@ private: void UpdateReverserCarBogies(); void UpdateHandleWaterSplash() const; void Claxon() const; + void UpdateTrackMotionUpStopCheck() const; }; struct train_ref