mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-28 09:14:58 +01:00
Add UpdateRideApproachVehicleWaypoints to RTD (#17124)
This commit is contained in:
@@ -4391,31 +4391,10 @@ void Guest::UpdateRideApproachVehicleWaypoints()
|
||||
int16_t xy_distance;
|
||||
uint8_t waypoint = Var37 & 3;
|
||||
|
||||
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||
if (auto loc = UpdateAction(xy_distance); loc.has_value())
|
||||
{
|
||||
int16_t actionZ;
|
||||
// Motion simulators have steps this moves the peeps up the steps
|
||||
if (ride->type == RIDE_TYPE_MOTION_SIMULATOR)
|
||||
{
|
||||
actionZ = ride->GetStation(CurrentRideStation).GetBaseZ() + 2;
|
||||
|
||||
if (waypoint == 2)
|
||||
{
|
||||
xy_distance -= 12;
|
||||
if (xy_distance < 0)
|
||||
xy_distance = 0;
|
||||
|
||||
if (xy_distance <= 15)
|
||||
{
|
||||
actionZ += 15 - xy_distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
actionZ = z;
|
||||
}
|
||||
MoveTo({ loc.value(), actionZ });
|
||||
rtd.UpdateRideApproachVehicleWaypoints(*this, loc.value(), xy_distance);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4435,7 +4414,6 @@ void Guest::UpdateRideApproachVehicleWaypoints()
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||
CoordsXY targetLoc = rtd.GetGuestWaypointLocation(*vehicle, *ride, CurrentRideStation);
|
||||
|
||||
rct_ride_entry* ride_entry = vehicle->GetRideEntry();
|
||||
@@ -4452,6 +4430,33 @@ void Guest::UpdateRideApproachVehicleWaypoints()
|
||||
SetDestination(targetLoc);
|
||||
}
|
||||
|
||||
void UpdateRideApproachVehicleWaypointsMotionSimulator(Guest& guest, const CoordsXY& loc, int16_t& xy_distance)
|
||||
{
|
||||
int16_t actionZ;
|
||||
auto ride = get_ride(guest.CurrentRide);
|
||||
// Motion simulators have steps this moves the peeps up the steps
|
||||
actionZ = ride->GetStation(guest.CurrentRideStation).GetBaseZ() + 2;
|
||||
|
||||
uint8_t waypoint = guest.Var37 & 3;
|
||||
if (waypoint == 2)
|
||||
{
|
||||
xy_distance -= 12;
|
||||
if (xy_distance < 0)
|
||||
xy_distance = 0;
|
||||
|
||||
if (xy_distance <= 15)
|
||||
{
|
||||
actionZ += 15 - xy_distance;
|
||||
}
|
||||
}
|
||||
guest.MoveTo({ loc, actionZ });
|
||||
}
|
||||
|
||||
void UpdateRideApproachVehicleWaypointsDefault(Guest& guest, const CoordsXY& loc, int16_t& xy_distance)
|
||||
{
|
||||
guest.MoveTo({ loc, guest.z });
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0069357D
|
||||
@@ -4467,6 +4472,7 @@ void Guest::UpdateRideApproachExitWaypoints()
|
||||
if (auto loc = UpdateAction(xy_distance); loc.has_value())
|
||||
{
|
||||
int16_t actionZ;
|
||||
|
||||
if (ride->type == RIDE_TYPE_MOTION_SIMULATOR)
|
||||
{
|
||||
actionZ = ride->GetStation(CurrentRideStation).GetBaseZ() + 2;
|
||||
|
||||
@@ -400,7 +400,9 @@ private:
|
||||
void UpdateRideLeaveVehicle();
|
||||
void UpdateRideApproachExit();
|
||||
void UpdateRideInExit();
|
||||
|
||||
void UpdateRideApproachVehicleWaypoints();
|
||||
|
||||
void UpdateRideApproachExitWaypoints();
|
||||
void UpdateRideApproachSpiralSlide();
|
||||
void UpdateRideOnSpiralSlide();
|
||||
@@ -425,6 +427,9 @@ private:
|
||||
void GoToRideEntrance(Ride* ride);
|
||||
};
|
||||
|
||||
void UpdateRideApproachVehicleWaypointsMotionSimulator(Guest&, const CoordsXY&, int16_t&);
|
||||
void UpdateRideApproachVehicleWaypointsDefault(Guest&, const CoordsXY&, int16_t&);
|
||||
|
||||
static_assert(sizeof(Guest) <= 512);
|
||||
|
||||
enum
|
||||
|
||||
@@ -157,6 +157,7 @@ struct UpkeepCostsDescriptor
|
||||
};
|
||||
|
||||
using RideTrackGroup = OpenRCT2::BitSet<TRACK_GROUP_COUNT>;
|
||||
using UpdateRideApproachVehicleWaypointsFunction = void (*)(Guest&, const CoordsXY&, int16_t&);
|
||||
using RideMusicUpdateFunction = void (*)(Ride*);
|
||||
using PeepUpdateRideLeaveEntranceFunc = void (*)(Guest*, Ride*, CoordsXYZD&);
|
||||
using StartRideMusicFunction = void (*)(const OpenRCT2::RideAudio::ViewportRideMusicInstance&);
|
||||
@@ -244,6 +245,8 @@ struct RideTypeDescriptor
|
||||
|
||||
MusicTrackOffsetLengthFunc MusicTrackOffsetLength = OpenRCT2::RideAudio::RideMusicGetTrackOffsetLength_Default;
|
||||
|
||||
UpdateRideApproachVehicleWaypointsFunction UpdateRideApproachVehicleWaypoints = UpdateRideApproachVehicleWaypointsDefault;
|
||||
|
||||
bool HasFlag(uint64_t flag) const;
|
||||
void GetAvailableTrackPieces(RideTrackGroup& res) const;
|
||||
bool SupportsTrackPiece(const uint64_t trackPiece) const;
|
||||
|
||||
@@ -50,5 +50,18 @@ constexpr const RideTypeDescriptor MotionSimulatorRTD =
|
||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||
SET_FIELD(ColourKey, RideColourKey::Ride),
|
||||
SET_FIELD(Name, "motion_simulator"),
|
||||
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(SpecialElementRatingAdjustment, SpecialTrackElementRatingsAjustment_Default),
|
||||
SET_FIELD(GetGuestWaypointLocation, GetGuestWaypointLocationDefault),
|
||||
SET_FIELD(ConstructionWindowContext, RideConstructionWindowContext::Default),
|
||||
SET_FIELD(RideUpdate, nullptr),
|
||||
SET_FIELD(UpdateMeasurementsSpecialElements, RideUpdateMeasurementsSpecialElements_Default),
|
||||
SET_FIELD(MusicTrackOffsetLength, OpenRCT2::RideAudio::RideMusicGetTrackOffsetLength_Default),
|
||||
SET_FIELD(UpdateRideApproachVehicleWaypoints, UpdateRideApproachVehicleWaypointsMotionSimulator),
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
Reference in New Issue
Block a user