diff --git a/src/openrct2/SpriteIds.h b/src/openrct2/SpriteIds.h index afd6abff2e..00f6e54f20 100644 --- a/src/openrct2/SpriteIds.h +++ b/src/openrct2/SpriteIds.h @@ -928,6 +928,9 @@ enum : ImageIndex SPR_CREDITS_LOGO_SMALL = 23213, SPR_CREDITS_CHRIS_SAWYER_SMALL = 23214, + SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE = 22164, + SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE = 22165, + SPR_NEW_RIDE_MASK = 29013, SPR_SPLASH_EFFECT_1_NE_0 = 29014, diff --git a/src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp b/src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp index 4284c45128..9e4f0100b3 100644 --- a/src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp +++ b/src/openrct2/paint/track/coaster/AirPoweredVerticalCoaster.cpp @@ -26,9 +26,6 @@ static constexpr TunnelGroup kTunnelGroup = TunnelGroup::Square; enum { - SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE = 22164, - SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE = 22165, - SPR_AIR_POWERED_VERTICAL_RC_FLAT_SW_NE = 22226, SPR_AIR_POWERED_VERTICAL_RC_FLAT_NW_SE = 22227, SPR_AIR_POWERED_VERTICAL_RC_STATION_SW_NE = 22228, diff --git a/src/openrct2/paint/track/coaster/ReverseFreefallCoaster.cpp b/src/openrct2/paint/track/coaster/ReverseFreefallCoaster.cpp index a6519bfa06..ccddf2e383 100644 --- a/src/openrct2/paint/track/coaster/ReverseFreefallCoaster.cpp +++ b/src/openrct2/paint/track/coaster/ReverseFreefallCoaster.cpp @@ -28,8 +28,6 @@ enum { SPR_REVERSE_FREEFALL_RC_STATION_SW_NE = 22162, SPR_REVERSE_FREEFALL_RC_STATION_NW_SE = 22163, - SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE = 22164, - SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE = 22165, SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE = 22166, SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE = 22167, SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW = 22168, diff --git a/src/openrct2/ride/Vehicle.MiniGolf.cpp b/src/openrct2/ride/Vehicle.MiniGolf.cpp index 7c07c07b7e..4e835ae1f5 100644 --- a/src/openrct2/ride/Vehicle.MiniGolf.cpp +++ b/src/openrct2/ride/Vehicle.MiniGolf.cpp @@ -32,13 +32,6 @@ using namespace OpenRCT2; using namespace OpenRCT2::RideVehicle; using namespace OpenRCT2::TrackMetadata; -static PitchAndRoll PitchAndRollStart(bool useInvertedSprites, TileElement* tileElement) -{ - auto trackType = tileElement->AsTrack()->GetTrackType(); - const auto& ted = GetTrackElementDescriptor(trackType); - return PitchAndRoll{ ted.definition.pitchStart, TrackGetActualBank3(useInvertedSprites, tileElement) }; -} - void RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const TrackElemType trackType) { const auto& ted = GetTrackElementDescriptor(trackType); @@ -645,24 +638,6 @@ void Vehicle::Loc6DCE02(const Ride& curRide) } } -static constexpr int32_t GetAccelerationDecrease2(const int32_t velocity, const int32_t totalMass) -{ - int32_t accelerationDecrease2 = velocity >> 8; - accelerationDecrease2 *= accelerationDecrease2; - if (velocity < 0) - { - accelerationDecrease2 = -accelerationDecrease2; - } - accelerationDecrease2 >>= 4; - // OpenRCT2: vehicles from different track types can have 0 mass. - if (totalMass != 0) - { - return accelerationDecrease2 / totalMass; - } - - return accelerationDecrease2; -} - int32_t Vehicle::UpdateTrackMotionMiniGolfCalculateAcceleration(const CarEntry& carEntry) { int32_t sumAcceleration = 0; diff --git a/src/openrct2/ride/Vehicle.TrackMotion.cpp b/src/openrct2/ride/Vehicle.TrackMotion.cpp index ca2f3108d9..c258ac2e4f 100644 --- a/src/openrct2/ride/Vehicle.TrackMotion.cpp +++ b/src/openrct2/ride/Vehicle.TrackMotion.cpp @@ -325,17 +325,6 @@ static void BlockBrakesOpenPreviousSection(const Ride& ride, const CoordsXYZ& ve } } -/** - * - * rct2: 0x006DB38B - */ -static PitchAndRoll PitchAndRollStart(bool useInvertedSprites, TileElement* tileElement) -{ - auto trackType = tileElement->AsTrack()->GetTrackType(); - const auto& ted = GetTrackElementDescriptor(trackType); - return PitchAndRoll{ ted.definition.pitchStart, TrackGetActualBank3(useInvertedSprites, tileElement) }; -} - void Vehicle::UpdateGoKartAttemptSwitchLanes() { uint16_t probability = 0x8000; @@ -1284,24 +1273,6 @@ bool Vehicle::UpdateTrackMotionBackwards(const CarEntry* carEntry, const Ride& c } } -static constexpr int32_t GetAccelerationDecrease2(const int32_t velocity, const int32_t totalMass) -{ - int32_t accelerationDecrease2 = velocity >> 8; - accelerationDecrease2 *= accelerationDecrease2; - if (velocity < 0) - { - accelerationDecrease2 = -accelerationDecrease2; - } - accelerationDecrease2 >>= 4; - // OpenRCT2: vehicles from different track types can have 0 mass. - if (totalMass != 0) - { - return accelerationDecrease2 / totalMass; - } - - return accelerationDecrease2; -} - /** * * rct2: 0x006DC1E4 diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 0cccb0d691..02ba77dc05 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -82,6 +82,31 @@ uint8_t _vehicleF64E2C; Vehicle* _vehicleFrontVehicle; CoordsXYZ _vehicleCurPosition; +PitchAndRoll PitchAndRollStart(bool useInvertedSprites, TileElement* tileElement) +{ + auto trackType = tileElement->AsTrack()->GetTrackType(); + const auto& ted = GetTrackElementDescriptor(trackType); + return PitchAndRoll{ ted.definition.pitchStart, TrackGetActualBank3(useInvertedSprites, tileElement) }; +} + +int32_t GetAccelerationDecrease2(const int32_t velocity, const int32_t totalMass) +{ + int32_t accelerationDecrease2 = velocity >> 8; + accelerationDecrease2 *= accelerationDecrease2; + if (velocity < 0) + { + accelerationDecrease2 = -accelerationDecrease2; + } + accelerationDecrease2 >>= 4; + // OpenRCT2: vehicles from different track types can have 0 mass. + if (totalMass != 0) + { + return accelerationDecrease2 / totalMass; + } + + return accelerationDecrease2; +} + template<> bool EntityBase::Is() const { diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index dcaabfb5ea..03e2e8d74a 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -14,6 +14,7 @@ #include "../core/FlagHolder.hpp" #include "../entity/EntityBase.h" #include "../ride/RideTypes.h" +#include "../ride/Track.h" #include "../world/Location.hpp" #include "Angles.h" #include "CarEntry.h" @@ -556,6 +557,9 @@ enum class SoundRange : uint8_t constexpr uint8_t kVehicleSeatPairFlag = 0x80; constexpr uint8_t kVehicleSeatNumMask = 0x7F; +OpenRCT2::TrackMetadata::PitchAndRoll PitchAndRollStart(bool useInvertedSprites, OpenRCT2::TileElement* tileElement); +int32_t GetAccelerationDecrease2(const int32_t velocity, const int32_t totalMass); + Vehicle* TryGetVehicle(EntityId spriteIndex); void VehicleUpdateAll(); void VehicleSoundsUpdate();