mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add GetGuestWaypointLocation to RTD (#17750)
This commit is contained in:
parent
d9e23e9dfa
commit
f9bb5b2447
|
@ -3595,8 +3595,6 @@ void Guest::UpdateRideLeaveEntranceWaypoints(const Ride& ride)
|
||||||
Guard::Assert(!station.Entrance.IsNull());
|
Guard::Assert(!station.Entrance.IsNull());
|
||||||
uint8_t direction_entrance = station.Entrance.direction;
|
uint8_t direction_entrance = station.Entrance.direction;
|
||||||
|
|
||||||
CoordsXY waypoint = ride.GetStation(CurrentRideStation).Start.ToTileCentre();
|
|
||||||
|
|
||||||
TileElement* tile_element = ride_get_station_start_track_element(&ride, CurrentRideStation);
|
TileElement* tile_element = ride_get_station_start_track_element(&ride, CurrentRideStation);
|
||||||
|
|
||||||
uint8_t direction_track = (tile_element == nullptr ? 0 : tile_element->GetDirection());
|
uint8_t direction_track = (tile_element == nullptr ? 0 : tile_element->GetDirection());
|
||||||
|
@ -3612,11 +3610,8 @@ void Guest::UpdateRideLeaveEntranceWaypoints(const Ride& ride)
|
||||||
|
|
||||||
Var37 = (direction_entrance | GetWaypointedSeatLocation(ride, vehicle_type, direction_track) * 4) * 4;
|
Var37 = (direction_entrance | GetWaypointedSeatLocation(ride, vehicle_type, direction_track) * 4) * 4;
|
||||||
|
|
||||||
if (ride.type == RIDE_TYPE_ENTERPRISE)
|
const auto& rtd = ride.GetRideTypeDescriptor();
|
||||||
{
|
CoordsXY waypoint = rtd.GetGuestWaypointLocation(*vehicle, ride, CurrentRideStation);
|
||||||
waypoint.x = vehicle->x;
|
|
||||||
waypoint.y = vehicle->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto waypointIndex = Var37 / 4;
|
const auto waypointIndex = Var37 / 4;
|
||||||
Guard::Assert(vehicle_type->peep_loading_waypoints.size() >= static_cast<size_t>(waypointIndex));
|
Guard::Assert(vehicle_type->peep_loading_waypoints.size() >= static_cast<size_t>(waypointIndex));
|
||||||
|
@ -4237,9 +4232,6 @@ void Guest::UpdateRideLeaveVehicle()
|
||||||
auto exitLocation = station.Exit.ToCoordsXYZD();
|
auto exitLocation = station.Exit.ToCoordsXYZD();
|
||||||
Guard::Assert(!exitLocation.IsNull());
|
Guard::Assert(!exitLocation.IsNull());
|
||||||
|
|
||||||
auto waypointLoc = CoordsXYZ{ station.Start.ToTileCentre(),
|
|
||||||
exitLocation.z + ride->GetRideTypeDescriptor().Heights.PlatformHeight };
|
|
||||||
|
|
||||||
TileElement* trackElement = ride_get_station_start_track_element(ride, CurrentRideStation);
|
TileElement* trackElement = ride_get_station_start_track_element(ride, CurrentRideStation);
|
||||||
|
|
||||||
Direction station_direction = (trackElement == nullptr ? 0 : trackElement->GetDirection());
|
Direction station_direction = (trackElement == nullptr ? 0 : trackElement->GetDirection());
|
||||||
|
@ -4250,19 +4242,17 @@ void Guest::UpdateRideLeaveVehicle()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoordsXYZ waypointLoc;
|
||||||
|
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||||
|
waypointLoc = { rtd.GetGuestWaypointLocation(*vehicle, *ride, CurrentRideStation),
|
||||||
|
exitLocation.z + ride->GetRideTypeDescriptor().Heights.PlatformHeight };
|
||||||
|
|
||||||
rideEntry = vehicle->GetRideEntry();
|
rideEntry = vehicle->GetRideEntry();
|
||||||
carEntry = &rideEntry->Cars[vehicle->vehicle_type];
|
carEntry = &rideEntry->Cars[vehicle->vehicle_type];
|
||||||
if (carEntry == nullptr)
|
if (carEntry == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Var37 = ((exitLocation.direction | GetWaypointedSeatLocation(*ride, carEntry, station_direction) * 4) * 4) | 1;
|
Var37 = ((exitLocation.direction | GetWaypointedSeatLocation(*ride, carEntry, station_direction) * 4) * 4) | 1;
|
||||||
|
|
||||||
if (ride->type == RIDE_TYPE_ENTERPRISE)
|
|
||||||
{
|
|
||||||
waypointLoc.x = vehicle->x;
|
|
||||||
waypointLoc.y = vehicle->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
Guard::Assert(carEntry->peep_loading_waypoints.size() >= static_cast<size_t>(Var37 / 4));
|
Guard::Assert(carEntry->peep_loading_waypoints.size() >= static_cast<size_t>(Var37 / 4));
|
||||||
CoordsXYZ exitWaypointLoc = waypointLoc;
|
CoordsXYZ exitWaypointLoc = waypointLoc;
|
||||||
|
|
||||||
|
@ -4371,6 +4361,17 @@ void Guest::UpdateRideInExit()
|
||||||
RideSubState = PeepRideSubState::LeaveExit;
|
RideSubState = PeepRideSubState::LeaveExit;
|
||||||
}
|
}
|
||||||
#pragma warning(default : 6011)
|
#pragma warning(default : 6011)
|
||||||
|
|
||||||
|
CoordsXY GetGuestWaypointLocationDefault(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation)
|
||||||
|
{
|
||||||
|
return ride.GetStation(CurrentRideStation).Start.ToTileCentre();
|
||||||
|
}
|
||||||
|
|
||||||
|
CoordsXY GetGuestWaypointLocationEnterprise(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation)
|
||||||
|
{
|
||||||
|
return { vehicle.x, vehicle.y };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x006926AD
|
* rct2: 0x006926AD
|
||||||
|
@ -4428,13 +4429,8 @@ void Guest::UpdateRideApproachVehicleWaypoints()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoordsXY targetLoc = ride->GetStation(CurrentRideStation).Start.ToTileCentre();
|
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||||
|
CoordsXY targetLoc = rtd.GetGuestWaypointLocation(*vehicle, *ride, CurrentRideStation);
|
||||||
if (ride->type == RIDE_TYPE_ENTERPRISE)
|
|
||||||
{
|
|
||||||
targetLoc.x = vehicle->x;
|
|
||||||
targetLoc.y = vehicle->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
rct_ride_entry* ride_entry = vehicle->GetRideEntry();
|
rct_ride_entry* ride_entry = vehicle->GetRideEntry();
|
||||||
if (ride_entry == nullptr)
|
if (ride_entry == nullptr)
|
||||||
|
@ -4499,13 +4495,9 @@ void Guest::UpdateRideApproachExitWaypoints()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CoordsXY targetLoc = ride->GetStation(CurrentRideStation).Start.ToTileCentre();
|
|
||||||
|
|
||||||
if (ride->type == RIDE_TYPE_ENTERPRISE)
|
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||||
{
|
CoordsXY targetLoc = rtd.GetGuestWaypointLocation(*vehicle, *ride, CurrentRideStation);
|
||||||
targetLoc.x = vehicle->x;
|
|
||||||
targetLoc.y = vehicle->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
rct_ride_entry* rideEntry = vehicle->GetRideEntry();
|
rct_ride_entry* rideEntry = vehicle->GetRideEntry();
|
||||||
CarEntry* carEntry = &rideEntry->Cars[vehicle->vehicle_type];
|
CarEntry* carEntry = &rideEntry->Cars[vehicle->vehicle_type];
|
||||||
|
|
|
@ -477,3 +477,6 @@ void decrement_guests_heading_for_park();
|
||||||
void PeepUpdateRideLeaveEntranceMaze(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
void PeepUpdateRideLeaveEntranceMaze(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
||||||
void PeepUpdateRideLeaveEntranceSpiralSlide(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
void PeepUpdateRideLeaveEntranceSpiralSlide(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
||||||
void PeepUpdateRideLeaveEntranceDefault(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
void PeepUpdateRideLeaveEntranceDefault(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
||||||
|
|
||||||
|
CoordsXY GetGuestWaypointLocationDefault(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation);
|
||||||
|
CoordsXY GetGuestWaypointLocationEnterprise(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation);
|
||||||
|
|
|
@ -160,6 +160,7 @@ using RideMusicUpdateFunction = void (*)(Ride*);
|
||||||
using PeepUpdateRideLeaveEntranceFunc = void (*)(Guest*, Ride*, CoordsXYZD&);
|
using PeepUpdateRideLeaveEntranceFunc = void (*)(Guest*, Ride*, CoordsXYZD&);
|
||||||
using StartRideMusicFunction = void (*)(const OpenRCT2::RideAudio::ViewportRideMusicInstance&);
|
using StartRideMusicFunction = void (*)(const OpenRCT2::RideAudio::ViewportRideMusicInstance&);
|
||||||
using LightFXAddLightsMagicVehicleFunction = void (*)(const Vehicle* vehicle);
|
using LightFXAddLightsMagicVehicleFunction = void (*)(const Vehicle* vehicle);
|
||||||
|
using RideLocationFunction = CoordsXY (*)(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation);
|
||||||
using RideUpdateFunction = void (*)(Ride& ride);
|
using RideUpdateFunction = void (*)(Ride& ride);
|
||||||
using RideUpdateMeasurementsSpecialElementsFunc = void (*)(Ride* ride, const track_type_t trackType);
|
using RideUpdateMeasurementsSpecialElementsFunc = void (*)(Ride* ride, const track_type_t trackType);
|
||||||
using MusicTrackOffsetLengthFunc = std::pair<size_t, size_t> (*)(const Ride& ride);
|
using MusicTrackOffsetLengthFunc = std::pair<size_t, size_t> (*)(const Ride& ride);
|
||||||
|
@ -228,6 +229,8 @@ struct RideTypeDescriptor
|
||||||
|
|
||||||
PeepUpdateRideLeaveEntranceFunc UpdateLeaveEntrance = PeepUpdateRideLeaveEntranceDefault;
|
PeepUpdateRideLeaveEntranceFunc UpdateLeaveEntrance = PeepUpdateRideLeaveEntranceDefault;
|
||||||
|
|
||||||
|
RideLocationFunction GetGuestWaypointLocation = GetGuestWaypointLocationDefault;
|
||||||
|
|
||||||
RideConstructionWindowContext ConstructionWindowContext = RideConstructionWindowContext::Default;
|
RideConstructionWindowContext ConstructionWindowContext = RideConstructionWindowContext::Default;
|
||||||
RideUpdateFunction RideUpdate = nullptr;
|
RideUpdateFunction RideUpdate = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ constexpr const RideTypeDescriptor WaterCoasterRTD =
|
||||||
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::Ride),
|
SET_FIELD(Classification, RideClassification::Ride),
|
||||||
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceDefault),
|
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceDefault),
|
||||||
|
SET_FIELD(GetGuestWaypointLocation, GetGuestWaypointLocationDefault),
|
||||||
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
||||||
SET_FIELD(RideUpdate, nullptr),
|
SET_FIELD(RideUpdate, nullptr),
|
||||||
SET_FIELD(UpdateMeasurementsSpecialElements, RideUpdateMeasurementsSpecialElements_WaterCoaster),
|
SET_FIELD(UpdateMeasurementsSpecialElements, RideUpdateMeasurementsSpecialElements_WaterCoaster),
|
||||||
|
|
|
@ -56,6 +56,7 @@ constexpr const RideTypeDescriptor CircusRTD =
|
||||||
SET_FIELD(MusicUpdateFunction, CircusMusicUpdate),
|
SET_FIELD(MusicUpdateFunction, CircusMusicUpdate),
|
||||||
SET_FIELD(Classification,RideClassification::Ride),
|
SET_FIELD(Classification,RideClassification::Ride),
|
||||||
SET_FIELD(UpdateLeaveEntrance,PeepUpdateRideLeaveEntranceDefault),
|
SET_FIELD(UpdateLeaveEntrance,PeepUpdateRideLeaveEntranceDefault),
|
||||||
|
SET_FIELD(GetGuestWaypointLocation, GetGuestWaypointLocationDefault),
|
||||||
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
||||||
SET_FIELD(RideUpdate, nullptr),
|
SET_FIELD(RideUpdate, nullptr),
|
||||||
SET_FIELD(UpdateMeasurementsSpecialElements, RideUpdateMeasurementsSpecialElements_Default),
|
SET_FIELD(UpdateMeasurementsSpecialElements, RideUpdateMeasurementsSpecialElements_Default),
|
||||||
|
|
|
@ -58,6 +58,7 @@ constexpr const RideTypeDescriptor MazeRTD =
|
||||||
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::Ride),
|
SET_FIELD(Classification, RideClassification::Ride),
|
||||||
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceMaze),
|
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceMaze),
|
||||||
|
SET_FIELD(GetGuestWaypointLocation, GetGuestWaypointLocationDefault),
|
||||||
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Maze),
|
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Maze),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
|
@ -58,6 +58,7 @@ constexpr const RideTypeDescriptor MiniGolfRTD =
|
||||||
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::Ride),
|
SET_FIELD(Classification, RideClassification::Ride),
|
||||||
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceDefault),
|
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceDefault),
|
||||||
|
SET_FIELD(GetGuestWaypointLocation, GetGuestWaypointLocationDefault),
|
||||||
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
||||||
SET_FIELD(RideUpdate, nullptr),
|
SET_FIELD(RideUpdate, nullptr),
|
||||||
SET_FIELD(UpdateMeasurementsSpecialElements, RideUpdateMeasurementsSpecialElements_MiniGolf),
|
SET_FIELD(UpdateMeasurementsSpecialElements, RideUpdateMeasurementsSpecialElements_MiniGolf),
|
||||||
|
|
|
@ -59,6 +59,7 @@ constexpr const RideTypeDescriptor SpiralSlideRTD =
|
||||||
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::Ride),
|
SET_FIELD(Classification, RideClassification::Ride),
|
||||||
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceSpiralSlide),
|
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceSpiralSlide),
|
||||||
|
SET_FIELD(GetGuestWaypointLocation, GetGuestWaypointLocationDefault),
|
||||||
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
||||||
SET_FIELD(RideUpdate, UpdateSpiralSlide),
|
SET_FIELD(RideUpdate, UpdateSpiralSlide),
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,5 +50,12 @@ constexpr const RideTypeDescriptor EnterpriseRTD =
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::Ride),
|
SET_FIELD(ColourKey, RideColourKey::Ride),
|
||||||
SET_FIELD(Name, "enterprise"),
|
SET_FIELD(Name, "enterprise"),
|
||||||
|
SET_FIELD(LightFXAddLightsMagicVehicle, nullptr),
|
||||||
|
SET_FIELD(StartRideMusic, OpenRCT2::RideAudio::DefaultStartRideMusicChannel),
|
||||||
|
SET_FIELD(DesignCreateMode, TrackDesignCreateMode::Default),
|
||||||
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
|
SET_FIELD(Classification, RideClassification::Ride),
|
||||||
|
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceDefault),
|
||||||
|
SET_FIELD(GetGuestWaypointLocation, GetGuestWaypointLocationEnterprise),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
|
@ -62,6 +62,7 @@ constexpr const RideTypeDescriptor ChairliftRTD =
|
||||||
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::Ride),
|
SET_FIELD(Classification, RideClassification::Ride),
|
||||||
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceDefault),
|
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceDefault),
|
||||||
|
SET_FIELD(GetGuestWaypointLocation, GetGuestWaypointLocationDefault),
|
||||||
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
||||||
SET_FIELD(RideUpdate, UpdateChairlift),
|
SET_FIELD(RideUpdate, UpdateChairlift),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue