From 59c31e8b7ac076b17eb5cf9e5312d7b7599e97e1 Mon Sep 17 00:00:00 2001 From: frutiemax Date: Tue, 9 Aug 2022 21:20:07 -0400 Subject: [PATCH] Add AccelerationFactor field to RTD (#17687) --- src/openrct2/ride/RideData.h | 3 ++- src/openrct2/ride/Vehicle.cpp | 15 ++++----------- .../ride/coaster/meta/AirPoweredVerticalCoaster.h | 2 +- src/openrct2/ride/thrill/meta/Twist.h | 2 +- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/openrct2/ride/RideData.h b/src/openrct2/ride/RideData.h index 1f68b2eb5f..f373a5717f 100644 --- a/src/openrct2/ride/RideData.h +++ b/src/openrct2/ride/RideData.h @@ -128,7 +128,8 @@ struct RideOperatingSettings uint8_t MaxBrakesSpeed; uint8_t PoweredLiftAcceleration; uint8_t BoosterAcceleration; - int8_t BoosterSpeedFactor; // The factor to shift the raw booster speed with + int8_t BoosterSpeedFactor; // The factor to shift the raw booster speed with + uint16_t AccelerationFactor = 12; uint8_t OperatingSettingMultiplier = 1; // Used for the Ride window, cosmetic only. }; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 9b7f5ab642..36291aeeaf 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -3164,7 +3164,7 @@ void Vehicle::UpdateDeparting() } CarEntry* carEntry = &rideEntry->Cars[vehicle_type]; - + const auto& rtd = curRide->GetRideTypeDescriptor(); switch (curRide->mode) { case RideMode::ReverseInclineLaunchedShuttle: @@ -3176,17 +3176,10 @@ void Vehicle::UpdateDeparting() case RideMode::PoweredLaunchBlockSectioned: case RideMode::LimPoweredLaunch: case RideMode::UpwardLaunch: - if (curRide->type == RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER) - { - if ((curRide->launch_speed << 16) > velocity) - { - acceleration = curRide->launch_speed << 13; - } - break; - } - if ((curRide->launch_speed << 16) > velocity) - acceleration = curRide->launch_speed << 12; + { + acceleration = curRide->launch_speed << rtd.OperatingSettings.AccelerationFactor; + } break; case RideMode::DownwardLaunch: if (NumLaunches >= 1) diff --git a/src/openrct2/ride/coaster/meta/AirPoweredVerticalCoaster.h b/src/openrct2/ride/coaster/meta/AirPoweredVerticalCoaster.h index d0f4b24f38..eb6ce14e80 100644 --- a/src/openrct2/ride/coaster/meta/AirPoweredVerticalCoaster.h +++ b/src/openrct2/ride/coaster/meta/AirPoweredVerticalCoaster.h @@ -27,7 +27,7 @@ constexpr const RideTypeDescriptor AirPoweredVerticalCoasterRTD = SET_FIELD(Flags, RIDE_TYPE_FLAGS_TRACK_HAS_3_COLOURS | RIDE_TYPE_FLAGS_COMMON_COASTER | RIDE_TYPE_FLAGS_COMMON_COASTER_NON_ALT | RIDE_TYPE_FLAG_PEEP_CHECK_GFORCES), SET_FIELD(RideModes, EnumsToFlags(RideMode::PoweredLaunchPasstrough, RideMode::PoweredLaunch)), SET_FIELD(DefaultMode, RideMode::PoweredLaunchPasstrough), - SET_FIELD(OperatingSettings, { 30, 50, 30, 40, 40, 0 }), + SET_FIELD(OperatingSettings, { 30, 50, 30, 40, 40, 0, 13 }), SET_FIELD(Naming, { STR_RIDE_NAME_AIR_POWERED_VERTICAL_COASTER, STR_RIDE_DESCRIPTION_AIR_POWERED_VERTICAL_COASTER }), SET_FIELD(NameConvention, { RideComponentType::Train, RideComponentType::Track, RideComponentType::Station }), SET_FIELD(EnumName, nameof(RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER)), diff --git a/src/openrct2/ride/thrill/meta/Twist.h b/src/openrct2/ride/thrill/meta/Twist.h index 0ef113053d..0baee9a6ee 100644 --- a/src/openrct2/ride/thrill/meta/Twist.h +++ b/src/openrct2/ride/thrill/meta/Twist.h @@ -29,7 +29,7 @@ constexpr const RideTypeDescriptor TwistRTD = RIDE_TYPE_FLAG_SINGLE_SESSION | RIDE_TYPE_FLAG_INTERESTING_TO_LOOK_AT | RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY), SET_FIELD(RideModes, EnumsToFlags(RideMode::Rotation)), SET_FIELD(DefaultMode, RideMode::Rotation), - SET_FIELD(OperatingSettings, { 3, 6, 0, 0, 0, 0, 3 }), + SET_FIELD(OperatingSettings, { 3, 6, 0, 0, 0, 0, 12, 3 }), SET_FIELD(Naming, { STR_RIDE_NAME_TWIST, STR_RIDE_DESCRIPTION_TWIST }), SET_FIELD(NameConvention, { RideComponentType::Structure, RideComponentType::Structure, RideComponentType::Station }), SET_FIELD(EnumName, nameof(RIDE_TYPE_TWIST)),