diff --git a/src/openrct2/ride/VehicleGeometry.cpp b/src/openrct2/ride/VehicleGeometry.cpp index 8975deefa7..53c241aa9d 100644 --- a/src/openrct2/ride/VehicleGeometry.cpp +++ b/src/openrct2/ride/VehicleGeometry.cpp @@ -15,7 +15,7 @@ namespace OpenRCT2::RideVehicle::Geometry { /** rct2: 0x009A2930 */ - static constexpr auto kSubpositionTranslationDistances = std::to_array({ + constexpr auto kSubpositionTranslationDistances = std::to_array({ // For a base length of 8716 (0x220C) on the horizontal and 6554 (0x199A) on the vertical, // use the Pythagoras theorem and round up. 0, // no movement @@ -38,11 +38,4 @@ namespace OpenRCT2::RideVehicle::Geometry }); static_assert(std::size(kSubpositionTranslationDistances) == 16); - constexpr int32_t getTranslationDistance(CoordsXYZ distance, bool useReverserDistance) - { - uint8_t index = ((distance.x != 0) << 0) | ((distance.y != 0) << 1) | ((distance.z != 0) << 2) - | ((useReverserDistance) << 3); - return kSubpositionTranslationDistances[index]; - } - } // namespace OpenRCT2::RideVehicle::Geometry diff --git a/src/openrct2/ride/VehicleGeometry.h b/src/openrct2/ride/VehicleGeometry.h index fdec24347e..918b886046 100644 --- a/src/openrct2/ride/VehicleGeometry.h +++ b/src/openrct2/ride/VehicleGeometry.h @@ -17,9 +17,16 @@ namespace OpenRCT2::RideVehicle::Geometry { + extern const std::array kSubpositionTranslationDistances; + /** The distance between subposition points in a movement vector. * Squashes vector components to 0 or !0, so vector length is ignored. */ - constexpr int32_t getTranslationDistance(CoordsXYZ distance, bool useReverserDistance); + constexpr int32_t getTranslationDistance(CoordsXYZ distance, bool useReverserDistance) + { + uint8_t index = ((distance.x != 0) << 0) | ((distance.y != 0) << 1) | ((distance.z != 0) << 2) + | ((useReverserDistance) << 3); + return kSubpositionTranslationDistances[index]; + } } // namespace OpenRCT2::RideVehicle::Geometry