mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Part of #9473: Create Vehicle::GetTrackProgress
This commit is contained in:
@@ -229,7 +229,7 @@ bool Vehicle::CableLiftUpdateTrackMotionForwards()
|
||||
|
||||
uint16_t trackProgress = track_progress + 1;
|
||||
|
||||
uint16_t trackTotalProgress = vehicle_get_move_info_size(TrackSubposition, track_type);
|
||||
uint16_t trackTotalProgress = GetTrackProgress();
|
||||
if (trackProgress >= trackTotalProgress)
|
||||
{
|
||||
_vehicleVAngleEndF64E36 = TrackDefinitions[trackType].vangle_end;
|
||||
@@ -322,7 +322,7 @@ bool Vehicle::CableLiftUpdateTrackMotionBackwards()
|
||||
_vehicleMotionTrackFlags = VEHICLE_UPDATE_MOTION_TRACK_FLAG_VEHICLE_AT_STATION;
|
||||
}
|
||||
|
||||
uint16_t trackTotalProgress = vehicle_get_move_info_size(TrackSubposition, track_type);
|
||||
uint16_t trackTotalProgress = GetTrackProgress();
|
||||
trackProgress = trackTotalProgress - 1;
|
||||
}
|
||||
track_progress = trackProgress;
|
||||
|
||||
@@ -797,7 +797,7 @@ const rct_vehicle_info* Vehicle::GetMoveInfo() const
|
||||
return vehicle_get_move_info(TrackSubposition, track_type, track_progress);
|
||||
}
|
||||
|
||||
uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection)
|
||||
static uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection)
|
||||
{
|
||||
if (!vehicle_move_info_valid(trackSubposition, typeAndDirection, 0))
|
||||
{
|
||||
@@ -806,6 +806,11 @@ uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDir
|
||||
return gTrackVehicleInfo[trackSubposition][typeAndDirection]->size;
|
||||
}
|
||||
|
||||
uint16_t Vehicle::GetTrackProgress() const
|
||||
{
|
||||
return vehicle_get_move_info_size(TrackSubposition, track_type);
|
||||
}
|
||||
|
||||
Vehicle* try_get_vehicle(uint16_t spriteIndex)
|
||||
{
|
||||
rct_sprite* sprite = try_get_sprite(spriteIndex);
|
||||
@@ -8230,7 +8235,7 @@ loc_6DAEB9:
|
||||
regs.ax = track_progress + 1;
|
||||
|
||||
// Track Total Progress is in the two bytes before the move info list
|
||||
uint16_t trackTotalProgress = vehicle_get_move_info_size(TrackSubposition, track_type);
|
||||
uint16_t trackTotalProgress = GetTrackProgress();
|
||||
if (regs.ax >= trackTotalProgress)
|
||||
{
|
||||
UpdateCrossings();
|
||||
@@ -8515,7 +8520,7 @@ bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* cu
|
||||
brake_speed = tileElement->AsTrack()->GetBrakeBoosterSpeed();
|
||||
|
||||
// There are two bytes before the move info list
|
||||
uint16_t trackTotalProgress = vehicle_get_move_info_size(TrackSubposition, track_type);
|
||||
uint16_t trackTotalProgress = GetTrackProgress();
|
||||
*progress = trackTotalProgress - 1;
|
||||
return true;
|
||||
}
|
||||
@@ -8778,7 +8783,7 @@ loc_6DC476:
|
||||
|
||||
// There are two bytes before the move info list
|
||||
{
|
||||
uint16_t trackTotalProgress = vehicle_get_move_info_size(TrackSubposition, track_type);
|
||||
uint16_t trackTotalProgress = GetTrackProgress();
|
||||
if (track_progress + 1 < trackTotalProgress)
|
||||
{
|
||||
track_progress += 1;
|
||||
@@ -9053,7 +9058,7 @@ loc_6DCA9A:
|
||||
var_CF = tileElement->AsTrack()->GetSeatRotation() << 1;
|
||||
|
||||
// There are two bytes before the move info list
|
||||
track_progress = vehicle_get_move_info_size(TrackSubposition, track_type);
|
||||
track_progress = GetTrackProgress();
|
||||
|
||||
loc_6DCC2C:
|
||||
moveInfo = GetMoveInfo();
|
||||
|
||||
@@ -356,6 +356,7 @@ private:
|
||||
bool SoundCanPlay() const;
|
||||
uint16_t GetSoundPriority() const;
|
||||
const rct_vehicle_info* GetMoveInfo() const;
|
||||
uint16_t GetTrackProgress() const;
|
||||
rct_vehicle_sound_params CreateSoundParam(uint16_t priority) const;
|
||||
void CableLiftUpdate();
|
||||
bool CableLiftUpdateTrackMotionForwards();
|
||||
@@ -616,7 +617,6 @@ enum
|
||||
Vehicle* try_get_vehicle(uint16_t spriteIndex);
|
||||
void vehicle_update_all();
|
||||
void vehicle_sounds_update();
|
||||
uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection);
|
||||
|
||||
extern Vehicle* gCurrentVehicle;
|
||||
extern StationIndex _vehicleStationIndex;
|
||||
|
||||
Reference in New Issue
Block a user