diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 7a5d510a69..ad3a4197c3 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -4234,7 +4234,7 @@ void Guest::UpdateRideLeaveVehicle() specialDirection = ((vehicle->sprite_direction + 3) / 8) + 1; specialDirection &= 3; - if (vehicle->TrackSubposition == VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE) + if (vehicle->TrackSubposition == VehicleTrackSubposition::GoKartsRightLane) specialDirection = direction_reverse(specialDirection); } } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 8cd69b7d2d..c2686e75f5 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1224,7 +1224,7 @@ private: statusSrc = static_cast(src->status); } dst->status = statusSrc; - dst->TrackSubposition = src->TrackSubposition; + dst->TrackSubposition = VehicleTrackSubposition{ src->TrackSubposition }; dst->TrackLocation = { src->track_x, src->track_y, src->track_z }; dst->current_station = src->current_station; if (src->boat_location.isNull() || ride->mode != RIDE_MODE_BOAT_HIRE || statusSrc != VEHICLE_STATUS_TRAVELLING_BOAT) diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index bab38b9bf3..afd2617034 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1075,7 +1075,7 @@ void S6Exporter::ExportSpriteVehicle(RCT2SpriteVehicle* dst, const Vehicle* src) dst->var_C8 = src->var_C8; dst->var_CA = src->var_CA; dst->scream_sound_id = static_cast(src->scream_sound_id); - dst->TrackSubposition = src->TrackSubposition; + dst->TrackSubposition = static_cast(src->TrackSubposition); dst->var_CE = src->var_CE; dst->var_CF = src->var_CF; dst->lost_time_out = src->lost_time_out; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index c3a8c9c8fb..1c9c3e250b 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1401,7 +1401,7 @@ public: dst->var_C8 = src->var_C8; dst->var_CA = src->var_CA; dst->scream_sound_id = static_cast(src->scream_sound_id); - dst->TrackSubposition = src->TrackSubposition; + dst->TrackSubposition = VehicleTrackSubposition{ src->TrackSubposition }; dst->var_CE = src->var_CE; dst->var_CF = src->var_CF; dst->lost_time_out = src->lost_time_out; diff --git a/src/openrct2/ride/CableLift.cpp b/src/openrct2/ride/CableLift.cpp index b3a30c0fea..65fe4ccd56 100644 --- a/src/openrct2/ride/CableLift.cpp +++ b/src/openrct2/ride/CableLift.cpp @@ -64,7 +64,7 @@ Vehicle* cable_lift_segment_create( { peep = SPRITE_INDEX_NULL; } - current->TrackSubposition = VEHICLE_TRACK_SUBPOSITION_0; + current->TrackSubposition = VehicleTrackSubposition::Default; current->sprite_direction = direction << 3; z = z * COORDS_Z_STEP; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 7eb1ebb465..a54ec6f7fc 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -4412,7 +4412,7 @@ static Vehicle* vehicle_create_car( if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_DODGEM_CAR_PLACEMENT) { // loc_6DDCA4: - vehicle->TrackSubposition = VEHICLE_TRACK_SUBPOSITION_0; + vehicle->TrackSubposition = VehicleTrackSubposition::Default; int32_t direction = tileElement->GetDirection(); auto dodgemPos = carPosition + CoordsXYZ{ word_9A3AB4[direction], 0 }; vehicle->TrackLocation = dodgemPos; @@ -4438,24 +4438,24 @@ static Vehicle* vehicle_create_car( } else { - VEHICLE_TRACK_SUBPOSITION subposition = VEHICLE_TRACK_SUBPOSITION_0; + VehicleTrackSubposition subposition = VehicleTrackSubposition::Default; if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_CHAIRLIFT) { - subposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT; + subposition = VehicleTrackSubposition::ChairliftGoingOut; } if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_GO_KART) { // Choose which lane Go Kart should start in - subposition = VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE; + subposition = VehicleTrackSubposition::GoKartsLeftLane; if (vehicleIndex & 1) { - subposition = VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE; + subposition = VehicleTrackSubposition::GoKartsRightLane; } } if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_MINI_GOLF) { - subposition = VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_START_9; + subposition = VehicleTrackSubposition::MiniGolfStart9; vehicle->var_D3 = 0; vehicle->mini_golf_current_animation = 0; vehicle->mini_golf_flags = 0; @@ -4464,12 +4464,12 @@ static Vehicle* vehicle_create_car( { if (vehicle->IsHead()) { - subposition = VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_FRONT_BOGIE; + subposition = VehicleTrackSubposition::ReverserRCFrontBogie; } } if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_5) { - subposition = VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_REAR_BOGIE; + subposition = VehicleTrackSubposition::ReverserRCRearBogie; } vehicle->TrackSubposition = subposition; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index ef5d44403f..65c464bfd6 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -728,64 +728,67 @@ template<> bool SpriteBase::Is() const return sprite_identifier == SPRITE_IDENTIFIER_VEHICLE; } -static bool vehicle_move_info_valid(int32_t trackSubposition, int32_t typeAndDirection, int32_t offset) +static bool vehicle_move_info_valid(VehicleTrackSubposition trackSubposition, int32_t typeAndDirection, int32_t offset) { - if (trackSubposition >= static_cast(std::size(gTrackVehicleInfo))) + if (trackSubposition >= VehicleTrackSubposition{ std::size(gTrackVehicleInfo) }) { return false; } int32_t size = 0; switch (trackSubposition) { - case VEHICLE_TRACK_SUBPOSITION_0: + case VehicleTrackSubposition::Default: size = 1024; break; - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT: + case VehicleTrackSubposition::ChairliftGoingOut: size = 692; break; - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK: - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_END_BULLWHEEL: - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL: + case VehicleTrackSubposition::ChairliftGoingBack: + case VehicleTrackSubposition::ChairliftEndBullwheel: + case VehicleTrackSubposition::ChairliftStartBullwheel: size = 404; break; - case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE: - case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE: - case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_RIGHT_LANE: - case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_LEFT_LANE: + case VehicleTrackSubposition::GoKartsLeftLane: + case VehicleTrackSubposition::GoKartsRightLane: + case VehicleTrackSubposition::GoKartsMovingToRightLane: + case VehicleTrackSubposition::GoKartsMovingToLeftLane: size = 208; break; - case VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_A_9: // VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_START_9 - case VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_A_10: - case VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_B_11: - case VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_B_12: - case VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_C_13: - case VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_C_14: + case VehicleTrackSubposition::MiniGolfPathA9: // VehicleTrackSubposition::MiniGolfStart9 + case VehicleTrackSubposition::MiniGolfBallPathA10: + case VehicleTrackSubposition::MiniGolfPathB11: + case VehicleTrackSubposition::MiniGolfBallPathB12: + case VehicleTrackSubposition::MiniGolfPathC13: + case VehicleTrackSubposition::MiniGolfBallPathC14: size = 824; break; - case VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_FRONT_BOGIE: - case VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_REAR_BOGIE: + case VehicleTrackSubposition::ReverserRCFrontBogie: + case VehicleTrackSubposition::ReverserRCRearBogie: size = 868; break; + default: + break; } if (typeAndDirection >= size) { return false; } - if (offset >= gTrackVehicleInfo[trackSubposition][typeAndDirection]->size) + if (offset >= gTrackVehicleInfo[static_cast(trackSubposition)][typeAndDirection]->size) { return false; } return true; } -static const rct_vehicle_info* vehicle_get_move_info(int32_t trackSubposition, int32_t typeAndDirection, int32_t offset) +static const rct_vehicle_info* vehicle_get_move_info( + VehicleTrackSubposition trackSubposition, int32_t typeAndDirection, int32_t offset) { if (!vehicle_move_info_valid(trackSubposition, typeAndDirection, offset)) { static constexpr const rct_vehicle_info zero = {}; return &zero; } - return &gTrackVehicleInfo[trackSubposition][typeAndDirection]->info[offset]; + return &gTrackVehicleInfo[static_cast(trackSubposition)][typeAndDirection]->info[offset]; } const rct_vehicle_info* Vehicle::GetMoveInfo() const @@ -793,13 +796,13 @@ const rct_vehicle_info* Vehicle::GetMoveInfo() const return vehicle_get_move_info(TrackSubposition, track_type, track_progress); } -static uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection) +static uint16_t vehicle_get_move_info_size(VehicleTrackSubposition trackSubposition, int32_t typeAndDirection) { if (!vehicle_move_info_valid(trackSubposition, typeAndDirection, 0)) { return 0; } - return gTrackVehicleInfo[trackSubposition][typeAndDirection]->size; + return gTrackVehicleInfo[static_cast(trackSubposition)][typeAndDirection]->size; } uint16_t Vehicle::GetTrackProgress() const @@ -7464,7 +7467,7 @@ void Vehicle::UpdateGoKartAttemptSwitchLanes() if ((scenario_rand() & 0xFFFF) <= probability) { // This changes "riding left" to "moving to right lane" and "riding right" to "moving to left lane". - TrackSubposition += 2; + TrackSubposition = VehicleTrackSubposition{ static_cast(static_cast(TrackSubposition) + 2U) }; } } @@ -7666,11 +7669,11 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, uint16_t* oth if (y_diff > 0x7FFF) continue; - uint8_t cl = std::min(TrackSubposition, vehicle2->TrackSubposition); - uint8_t ch = std::max(TrackSubposition, vehicle2->TrackSubposition); + VehicleTrackSubposition cl = std::min(TrackSubposition, vehicle2->TrackSubposition); + VehicleTrackSubposition ch = std::max(TrackSubposition, vehicle2->TrackSubposition); if (cl != ch) { - if (cl == VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE && ch == VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE) + if (cl == VehicleTrackSubposition::GoKartsLeftLane && ch == VehicleTrackSubposition::GoKartsRightLane) continue; } @@ -7803,7 +7806,7 @@ void Vehicle::Sub6DBF3E() rct_ride_entry_vehicle* vehicleEntry = Entry(); acceleration /= _vehicleUnkF64E10; - if (TrackSubposition == VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK) + if (TrackSubposition == VehicleTrackSubposition::ChairliftGoingBack) { return; } @@ -7877,7 +7880,7 @@ void Vehicle::Sub6DBF3E() // Determine the stop positions for the karts. If in left lane it's further along the track than the right lane. // Since it's not possible to overtake when the race has ended, this does not check for overtake states (7 and // 8). - cx = TrackSubposition == VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE ? 18 : 20; + cx = TrackSubposition == VehicleTrackSubposition::GoKartsRightLane ? 18 : 20; } if (ax > cx) @@ -7931,19 +7934,19 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur bool isGoingBack = false; switch (TrackSubposition) { - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK: - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_END_BULLWHEEL: - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK; + case VehicleTrackSubposition::ChairliftGoingBack: + case VehicleTrackSubposition::ChairliftEndBullwheel: + TrackSubposition = VehicleTrackSubposition::ChairliftGoingBack; isGoingBack = true; break; - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL: - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT; + case VehicleTrackSubposition::ChairliftStartBullwheel: + TrackSubposition = VehicleTrackSubposition::ChairliftGoingOut; break; - case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_RIGHT_LANE: - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE; + case VehicleTrackSubposition::GoKartsMovingToRightLane: + TrackSubposition = VehicleTrackSubposition::GoKartsRightLane; break; - case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_LEFT_LANE: - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE; + case VehicleTrackSubposition::GoKartsMovingToLeftLane: + TrackSubposition = VehicleTrackSubposition::GoKartsLeftLane; break; default: break; @@ -8011,7 +8014,7 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur return false; } if ((vehicleEntry->flags & VEHICLE_ENTRY_FLAG_GO_KART) - && TrackSubposition < VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_RIGHT_LANE) + && TrackSubposition < VehicleTrackSubposition::GoKartsMovingToRightLane) { trackType = tileElement->AsTrack()->GetTrackType(); if (trackType == TRACK_ELEM_FLAT @@ -8021,18 +8024,18 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur } } - if (TrackSubposition >= VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT - && TrackSubposition <= VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL) + if (TrackSubposition >= VehicleTrackSubposition::ChairliftGoingOut + && TrackSubposition <= VehicleTrackSubposition::ChairliftStartBullwheel) { TileCoordsXYZ curLocation{ TrackLocation }; if (curLocation == curRide->ChairliftBullwheelLocation[1]) { - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_END_BULLWHEEL; + TrackSubposition = VehicleTrackSubposition::ChairliftEndBullwheel; } else if (curLocation == curRide->ChairliftBullwheelLocation[0]) { - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL; + TrackSubposition = VehicleTrackSubposition::ChairliftStartBullwheel; } } @@ -8213,14 +8216,14 @@ loc_6DAEB9: regs.ebx |= 4; } - if (TrackSubposition == VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_FRONT_BOGIE + if (TrackSubposition == VehicleTrackSubposition::ReverserRCFrontBogie && (trackType == TRACK_ELEM_LEFT_REVERSER || trackType == TRACK_ELEM_RIGHT_REVERSER) && track_progress >= 30 && track_progress <= 66) { regs.ebx |= 8; } - if (TrackSubposition == VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_REAR_BOGIE + if (TrackSubposition == VehicleTrackSubposition::ReverserRCRearBogie && (trackType == TRACK_ELEM_LEFT_REVERSER || trackType == TRACK_ELEM_RIGHT_REVERSER) && track_progress == 96) { ReverseReverserCar(); @@ -8338,20 +8341,22 @@ bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* cu switch (TrackSubposition) { - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_END_BULLWHEEL: - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT; + case VehicleTrackSubposition::ChairliftEndBullwheel: + TrackSubposition = VehicleTrackSubposition::ChairliftGoingOut; break; - case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_RIGHT_LANE: - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE; + case VehicleTrackSubposition::GoKartsMovingToRightLane: + TrackSubposition = VehicleTrackSubposition::GoKartsLeftLane; break; - case VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_LEFT_LANE: - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE; + case VehicleTrackSubposition::GoKartsMovingToLeftLane: + TrackSubposition = VehicleTrackSubposition::GoKartsRightLane; break; - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK: - case VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL: - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK; + case VehicleTrackSubposition::ChairliftGoingBack: + case VehicleTrackSubposition::ChairliftStartBullwheel: + TrackSubposition = VehicleTrackSubposition::ChairliftGoingBack; nextTileBackwards = false; break; + default: + break; } if (nextTileBackwards) @@ -8410,18 +8415,18 @@ bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* cu // loc_6DBC3B: TrackLocation = trackPos; - if (TrackSubposition >= VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT - && TrackSubposition <= VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL) + if (TrackSubposition >= VehicleTrackSubposition::ChairliftGoingOut + && TrackSubposition <= VehicleTrackSubposition::ChairliftStartBullwheel) { TileCoordsXYZ curLocation{ TrackLocation }; if (curLocation == curRide->ChairliftBullwheelLocation[1]) { - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_END_BULLWHEEL; + TrackSubposition = VehicleTrackSubposition::ChairliftEndBullwheel; } else if (curLocation == curRide->ChairliftBullwheelLocation[0]) { - TrackSubposition = VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL; + TrackSubposition = VehicleTrackSubposition::ChairliftStartBullwheel; } } @@ -8788,9 +8793,9 @@ loc_6DC476: { TrackSubposition = prevVehicle->TrackSubposition; } - if (TrackSubposition != VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_START_9) + if (TrackSubposition != VehicleTrackSubposition::MiniGolfStart9) { - TrackSubposition--; + TrackSubposition = VehicleTrackSubposition{ static_cast(static_cast(TrackSubposition) - 1U) }; } } @@ -8826,13 +8831,13 @@ loc_6DC743: else { uint16_t rand16 = scenario_rand() & 0xFFFF; - uint8_t nextTrackSubposition = VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_C_14; + VehicleTrackSubposition nextTrackSubposition = VehicleTrackSubposition::MiniGolfBallPathC14; if (rand16 <= 0xA000) { - nextTrackSubposition = VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_B_12; + nextTrackSubposition = VehicleTrackSubposition::MiniGolfBallPathB12; if (rand16 <= 0x900) { - nextTrackSubposition = VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_A_10; + nextTrackSubposition = VehicleTrackSubposition::MiniGolfBallPathA10; } } TrackSubposition = nextTrackSubposition; @@ -9091,7 +9096,7 @@ loc_6DCDE4: loc_6DCE02: acceleration /= _vehicleUnkF64E10; - if (TrackSubposition == VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK) + if (TrackSubposition == VehicleTrackSubposition::ChairliftGoingBack) { return; } @@ -9278,7 +9283,7 @@ loc_6DD069: * * rct2: 0x006DC1E4 */ -static uint8_t modified_speed(uint16_t trackType, uint8_t trackSubposition, uint8_t speed) +static uint8_t modified_speed(uint16_t trackType, VehicleTrackSubposition trackSubposition, uint8_t speed) { enum { @@ -9291,11 +9296,11 @@ static uint8_t modified_speed(uint16_t trackType, uint8_t trackSubposition, uint if (trackType == TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE) { - speedModifier = (trackSubposition == VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE) ? HALF_SPEED : THREE_QUARTER_SPEED; + speedModifier = (trackSubposition == VehicleTrackSubposition::GoKartsLeftLane) ? HALF_SPEED : THREE_QUARTER_SPEED; } else if (trackType == TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE) { - speedModifier = (trackSubposition == VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE) ? HALF_SPEED : THREE_QUARTER_SPEED; + speedModifier = (trackSubposition == VehicleTrackSubposition::GoKartsRightLane) ? HALF_SPEED : THREE_QUARTER_SPEED; } switch (speedModifier) diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index 9cd40148fe..78f728777f 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -152,30 +152,30 @@ enum VEHICLE_STATUS struct rct_vehicle_sound_params; -enum VEHICLE_TRACK_SUBPOSITION : uint8_t +enum class VehicleTrackSubposition : uint8_t { - VEHICLE_TRACK_SUBPOSITION_0, + Default, // Going out means "moving away from the start". Viewed from Station 1, this is the left hand side of the track. - VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT, - VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK, + ChairliftGoingOut, + ChairliftGoingBack, // End and start bullwheel as viewed from Station 1. - VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_END_BULLWHEEL, - VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL, - VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE, - VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE, - VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_RIGHT_LANE, - VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_LEFT_LANE, - VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_START_9 = 9, - VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_A_9 = 9, - VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_A_10, - VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_B_11, - VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_B_12, - VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_C_13, - VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_C_14, - VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_FRONT_BOGIE, - VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_REAR_BOGIE, + ChairliftEndBullwheel, + ChairliftStartBullwheel, + GoKartsLeftLane, + GoKartsRightLane, + GoKartsMovingToRightLane, + GoKartsMovingToLeftLane, + MiniGolfStart9 = 9, + MiniGolfPathA9 = 9, + MiniGolfBallPathA10, + MiniGolfPathB11, + MiniGolfBallPathB12, + MiniGolfPathC13, + MiniGolfBallPathC14, + ReverserRCFrontBogie, + ReverserRCRearBogie, - VEHICLE_TRACK_SUBPOSITION_COUNT, + Count, }; struct Ride; @@ -290,7 +290,7 @@ struct Vehicle : SpriteBase uint16_t var_C8; uint16_t var_CA; SoundId scream_sound_id; - uint8_t TrackSubposition; + VehicleTrackSubposition TrackSubposition; union { uint8_t var_CE; diff --git a/src/openrct2/ride/VehicleSubpositionData.cpp b/src/openrct2/ride/VehicleSubpositionData.cpp index a385a4ad96..f58e06ca1e 100644 --- a/src/openrct2/ride/VehicleSubpositionData.cpp +++ b/src/openrct2/ride/VehicleSubpositionData.cpp @@ -25724,24 +25724,24 @@ static constexpr const rct_vehicle_info_list *TrackVehicleInfoListReverserRCRear }; // rct2: 0x008B8F30 -constexpr const rct_vehicle_info_list * const * gTrackVehicleInfo[VEHICLE_TRACK_SUBPOSITION_COUNT] = { - TrackVehicleInfoListDefault, // VEHICLE_TRACK_SUBPOSITION_0 - TrackVehicleInfoListChairliftGoingOut, // VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_OUT - TrackVehicleInfoListChairliftGoingBack, // VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_GOING_BACK - TrackVehicleInfoListChairliftEndBullwheel, // VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_END_BULLWHEEL - TrackVehicleInfoListChairliftStartBullwheel, // VEHICLE_TRACK_SUBPOSITION_CHAIRLIFT_START_BULLWHEEL - TrackVehicleInfoListGoKartsLeftLane, // VEHICLE_TRACK_SUBPOSITION_GO_KARTS_LEFT_LANE - TrackVehicleInfoListGoKartsRightLane, // VEHICLE_TRACK_SUBPOSITION_GO_KARTS_RIGHT_LANE - TrackVehicleInfoListGoKartsMovingToRightLane, // VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_RIGHT_LANE - TrackVehicleInfoListGoKartsMovingToLeftLane, // VEHICLE_TRACK_SUBPOSITION_GO_KARTS_MOVING_TO_LEFT_LANE - TrackVehicleInfoListMiniGolfStartPathA9, // VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_START_9, VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_A_9 - TrackVehicleInfoListMiniGolfBallPathA10, // VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_A_10 - TrackVehicleInfoListMiniGolfPathB11, // VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_B_11 - TrackVehicleInfoListMiniGolfBallPathB12, // VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_BALL_PATH_B_12 - TrackVehicleInfoListMiniGolfPathC13, // VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_C_13 - TrackVehicleInfoListMiniGolfPathC14, // VEHICLE_TRACK_SUBPOSITION_MINI_GOLF_PATH_C_14 - TrackVehicleInfoListReverserRCFrontBogie, // VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_FRONT_BOGIE - TrackVehicleInfoListReverserRCRearBogie, // VEHICLE_TRACK_SUBPOSITION_REVERSER_RC_REAR_BOGIE +constexpr const rct_vehicle_info_list * const * gTrackVehicleInfo[static_cast(VehicleTrackSubposition::Count)] = { + TrackVehicleInfoListDefault, // VehicleTrackSubposition::Default + TrackVehicleInfoListChairliftGoingOut, // VehicleTrackSubposition::ChairliftGoingOut + TrackVehicleInfoListChairliftGoingBack, // VehicleTrackSubposition::ChairliftGoingBack + TrackVehicleInfoListChairliftEndBullwheel, // VehicleTrackSubposition::ChairliftEndBullwheel + TrackVehicleInfoListChairliftStartBullwheel, // VehicleTrackSubposition::ChairliftStartBullwheel + TrackVehicleInfoListGoKartsLeftLane, // VehicleTrackSubposition::GoKartsLeftLane + TrackVehicleInfoListGoKartsRightLane, // VehicleTrackSubposition::GoKartsRightLane + TrackVehicleInfoListGoKartsMovingToRightLane, // VehicleTrackSubposition::GoKartsMovingToRightLane + TrackVehicleInfoListGoKartsMovingToLeftLane, // VehicleTrackSubposition::GoKartsMovingToLeftLane + TrackVehicleInfoListMiniGolfStartPathA9, // VehicleTrackSubposition::MiniGolfStart9, VehicleTrackSubposition::MiniGolfPathA9 + TrackVehicleInfoListMiniGolfBallPathA10, // VehicleTrackSubposition::MiniGolfBallPathA10 + TrackVehicleInfoListMiniGolfPathB11, // VehicleTrackSubposition::MiniGolfPathB11 + TrackVehicleInfoListMiniGolfBallPathB12, // VehicleTrackSubposition::MiniGolfBallPathB12 + TrackVehicleInfoListMiniGolfPathC13, // VehicleTrackSubposition::MiniGolfPathC13 + TrackVehicleInfoListMiniGolfPathC14, // VehicleTrackSubposition::MiniGolfBallPathC14 + TrackVehicleInfoListReverserRCFrontBogie, // VehicleTrackSubposition::ReverserRCFrontBogie + TrackVehicleInfoListReverserRCRearBogie, // VehicleTrackSubposition::ReverserRCRearBogie }; // clang-format on