diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 1890553909..c4501edeef 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -393,12 +393,6 @@ static constexpr CoordsXY kSurroundingTiles[] = { { 0, +kCoordsXYStep }, }; -/** rct2: 0x009A39C4 */ -static constexpr int32_t kUnk9A39C4[] = { - 2147483647, 2096579710, 1946281152, 2096579710, 1946281152, 1380375879, 555809667, -372906620, -1231746017, -1859775391, - 1380375879, 555809667, -372906620, -1231746017, -1859775391, 0, 2096579710, 1946281152, 2096579710, 1946281152, -}; - static constexpr OpenRCT2::Audio::SoundId kDoorOpenSoundIds[] = { OpenRCT2::Audio::SoundId::null, // DoorSoundType::none OpenRCT2::Audio::SoundId::doorOpen, // DoorSoundType::door @@ -5036,7 +5030,7 @@ OpenRCT2::Audio::SoundId Vehicle::ProduceScreamSound(const int32_t totalNumPeeps GForces Vehicle::GetGForces() const { int32_t gForceVert = ((static_cast(0x280000)) * Geometry::getPitchVector32(pitch).x) >> 32; - gForceVert = ((static_cast(gForceVert)) * kUnk9A39C4[EnumValue(roll)]) >> 32; + gForceVert = ((static_cast(gForceVert)) * Geometry::kRollHorizontalComponent[EnumValue(roll)]) >> 32; const auto& ted = GetTrackElementDescriptor(GetTrackType()); const int32_t vertFactor = ted.verticalFactor(track_progress); diff --git a/src/openrct2/ride/VehicleGeometry.cpp b/src/openrct2/ride/VehicleGeometry.cpp index 6882f12149..25a27e3a33 100644 --- a/src/openrct2/ride/VehicleGeometry.cpp +++ b/src/openrct2/ride/VehicleGeometry.cpp @@ -183,4 +183,11 @@ namespace OpenRCT2::RideVehicle::Geometry }); static_assert(std::size(kPitchToDirectionVectorInt32) == EnumValue(VehiclePitch::pitchCount)); + /** rct2: 0x009A39C4 */ + constexpr auto kRollHorizontalComponent = std::to_array({ + 2147483647, 2096579710, 1946281152, 2096579710, 1946281152, 1380375879, 555809667, + -372906620, -1231746017, -1859775391, 1380375879, 555809667, -372906620, -1231746017, + -1859775391, 0, 2096579710, 1946281152, 2096579710, 1946281152, + }); + static_assert(std::size(kRollHorizontalComponent) == EnumValue(VehicleRoll::rollCount)); } // namespace OpenRCT2::RideVehicle::Geometry diff --git a/src/openrct2/ride/VehicleGeometry.h b/src/openrct2/ride/VehicleGeometry.h index d877882d3a..7768dbbddf 100644 --- a/src/openrct2/ride/VehicleGeometry.h +++ b/src/openrct2/ride/VehicleGeometry.h @@ -29,6 +29,7 @@ namespace OpenRCT2::RideVehicle::Geometry extern const std::array kFreeroamVehicleMovementData; extern const std::array kAccelerationFromPitch; extern const std::array kPitchToDirectionVectorInt32; + extern const std::array kRollHorizontalComponent; /** The distance between subposition points in a movement vector. * Squashes vector components to 0 or !0, so vector length is ignored.