mirror of https://github.com/OpenRCT2/OpenRCT2.git
Part of #9473: Create Vehicle::UpdateTrackMotionMiniGolf
Converted from vehicle_update_track_motion_mini_golf
This commit is contained in:
parent
5fc414eaf6
commit
178e74fd26
|
@ -8700,30 +8700,28 @@ loc_6DBE7F:
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int32_t vehicle_update_track_motion_mini_golf(Vehicle* vehicle, int32_t* outStation)
|
int32_t Vehicle::UpdateTrackMotionMiniGolf(int32_t* outStation)
|
||||||
{
|
{
|
||||||
registers regs = {};
|
registers regs = {};
|
||||||
uint16_t otherVehicleIndex = SPRITE_INDEX_NULL;
|
uint16_t otherVehicleIndex = SPRITE_INDEX_NULL;
|
||||||
|
|
||||||
auto ride = get_ride(vehicle->ride);
|
auto curRide = get_ride(ride);
|
||||||
if (ride == nullptr)
|
if (curRide == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
rct_ride_entry* rideEntry = get_ride_entry(vehicle->ride_subtype);
|
rct_ride_entry* rideEntry = get_ride_entry(ride_subtype);
|
||||||
rct_ride_entry_vehicle* vehicleEntry = vehicle->Entry();
|
rct_ride_entry_vehicle* vehicleEntry = Entry();
|
||||||
|
|
||||||
TileElement* tileElement = nullptr;
|
TileElement* tileElement = nullptr;
|
||||||
|
|
||||||
gCurrentVehicle = vehicle;
|
gCurrentVehicle = this;
|
||||||
_vehicleMotionTrackFlags = 0;
|
_vehicleMotionTrackFlags = 0;
|
||||||
vehicle->velocity += vehicle->acceleration;
|
velocity += acceleration;
|
||||||
_vehicleVelocityF64E08 = vehicle->velocity;
|
_vehicleVelocityF64E08 = velocity;
|
||||||
_vehicleVelocityF64E0C = (vehicle->velocity >> 10) * 42;
|
_vehicleVelocityF64E0C = (velocity >> 10) * 42;
|
||||||
if (_vehicleVelocityF64E08 < 0)
|
Vehicle* vehicle = _vehicleVelocityF64E08 < 0 ? TrainTail() : this;
|
||||||
{
|
|
||||||
vehicle = vehicle->TrainTail();
|
|
||||||
}
|
|
||||||
_vehicleFrontVehicle = vehicle;
|
_vehicleFrontVehicle = vehicle;
|
||||||
|
CoordsXYZ trackPos;
|
||||||
|
|
||||||
loc_6DC40E:
|
loc_6DC40E:
|
||||||
regs.ebx = vehicle->vehicle_sprite_type;
|
regs.ebx = vehicle->vehicle_sprite_type;
|
||||||
|
@ -8843,7 +8841,6 @@ loc_6DC476:
|
||||||
_vehicleBankEndF64E37 = TrackDefinitions[trackType].bank_end;
|
_vehicleBankEndF64E37 = TrackDefinitions[trackType].bank_end;
|
||||||
tileElement = map_get_track_element_at_of_type_seq(vehicle->TrackLocation, trackType, 0);
|
tileElement = map_get_track_element_at_of_type_seq(vehicle->TrackLocation, trackType, 0);
|
||||||
}
|
}
|
||||||
int16_t x, y, z;
|
|
||||||
int32_t direction;
|
int32_t direction;
|
||||||
{
|
{
|
||||||
CoordsXYE output;
|
CoordsXYE output;
|
||||||
|
@ -8854,9 +8851,7 @@ loc_6DC476:
|
||||||
goto loc_6DC9BC;
|
goto loc_6DC9BC;
|
||||||
}
|
}
|
||||||
tileElement = output.element;
|
tileElement = output.element;
|
||||||
x = output.x;
|
trackPos = { output.x, output.y, outZ };
|
||||||
y = output.y;
|
|
||||||
z = outZ;
|
|
||||||
direction = outDirection;
|
direction = outDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8877,7 +8872,7 @@ loc_6DC476:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vehicle->TrackLocation = { x, y, z };
|
vehicle->TrackLocation = trackPos;
|
||||||
|
|
||||||
if (!vehicle->IsHead())
|
if (!vehicle->IsHead())
|
||||||
{
|
{
|
||||||
|
@ -8949,30 +8944,30 @@ loc_6DC743:
|
||||||
vehicle->track_progress++;
|
vehicle->track_progress++;
|
||||||
break;
|
break;
|
||||||
case 4: // loc_6DC820
|
case 4: // loc_6DC820
|
||||||
z = moveInfo->z;
|
trackPos.z = moveInfo->z;
|
||||||
// When the ride is closed occasionally the peep is removed
|
// When the ride is closed occasionally the peep is removed
|
||||||
// but the vehicle is still on the track. This will prevent
|
// but the vehicle is still on the track. This will prevent
|
||||||
// it from crashing in that situation.
|
// it from crashing in that situation.
|
||||||
if (vehicle->peep[0] != SPRITE_INDEX_NULL)
|
if (vehicle->peep[0] != SPRITE_INDEX_NULL)
|
||||||
{
|
{
|
||||||
if (z == 2)
|
if (trackPos.z == 2)
|
||||||
{
|
{
|
||||||
Peep* peep = GET_PEEP(vehicle->peep[0]);
|
Peep* curPeep = GET_PEEP(vehicle->peep[0]);
|
||||||
if (peep->Id & 7)
|
if (curPeep->Id & 7)
|
||||||
{
|
{
|
||||||
z = 7;
|
trackPos.z = 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (z == 6)
|
if (trackPos.z == 6)
|
||||||
{
|
{
|
||||||
Peep* peep = GET_PEEP(vehicle->peep[0]);
|
Peep* curPeep = GET_PEEP(vehicle->peep[0]);
|
||||||
if (peep->Id & 7)
|
if (curPeep->Id & 7)
|
||||||
{
|
{
|
||||||
z = 8;
|
trackPos.z = 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vehicle->mini_golf_current_animation = static_cast<uint8_t>(z);
|
vehicle->mini_golf_current_animation = static_cast<uint8_t>(trackPos.z);
|
||||||
vehicle->animation_frame = 0;
|
vehicle->animation_frame = 0;
|
||||||
vehicle->track_progress++;
|
vehicle->track_progress++;
|
||||||
break;
|
break;
|
||||||
|
@ -8993,9 +8988,8 @@ loc_6DC743:
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_6DC8A1
|
// loc_6DC8A1
|
||||||
x = vehicle->TrackLocation.x + moveInfo->x;
|
trackPos = { vehicle->TrackLocation.x + moveInfo->x, vehicle->TrackLocation.y + moveInfo->y,
|
||||||
y = vehicle->TrackLocation.y + moveInfo->y;
|
vehicle->TrackLocation.z + moveInfo->z + RideData5[curRide->type].z_offset };
|
||||||
z = vehicle->TrackLocation.z + moveInfo->z + RideData5[ride->type].z_offset;
|
|
||||||
|
|
||||||
// Investigate redundant code
|
// Investigate redundant code
|
||||||
regs.ebx = 0;
|
regs.ebx = 0;
|
||||||
|
@ -9018,9 +9012,7 @@ loc_6DC743:
|
||||||
vehicle->remaining_distance = 0;
|
vehicle->remaining_distance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unk_F64E20.x = x;
|
unk_F64E20 = trackPos;
|
||||||
unk_F64E20.y = y;
|
|
||||||
unk_F64E20.z = z;
|
|
||||||
vehicle->sprite_direction = moveInfo->direction;
|
vehicle->sprite_direction = moveInfo->direction;
|
||||||
vehicle->bank_rotation = moveInfo->bank_rotation;
|
vehicle->bank_rotation = moveInfo->bank_rotation;
|
||||||
vehicle->vehicle_sprite_type = moveInfo->vehicle_sprite_type;
|
vehicle->vehicle_sprite_type = moveInfo->vehicle_sprite_type;
|
||||||
|
@ -9040,7 +9032,7 @@ loc_6DC743:
|
||||||
if (_vehicleVelocityF64E08 >= 0)
|
if (_vehicleVelocityF64E08 >= 0)
|
||||||
{
|
{
|
||||||
otherVehicleIndex = vehicle->prev_vehicle_on_ride;
|
otherVehicleIndex = vehicle->prev_vehicle_on_ride;
|
||||||
vehicle_update_motion_collision_detection(vehicle, x, y, z, &otherVehicleIndex);
|
vehicle_update_motion_collision_detection(vehicle, trackPos.x, trackPos.y, trackPos.z, &otherVehicleIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto loc_6DC99A;
|
goto loc_6DC99A;
|
||||||
|
@ -9099,9 +9091,7 @@ loc_6DCA9A:
|
||||||
{
|
{
|
||||||
goto loc_6DC9BC;
|
goto loc_6DC9BC;
|
||||||
}
|
}
|
||||||
x = trackBeginEnd.begin_x;
|
trackPos = { trackBeginEnd.begin_x, trackBeginEnd.begin_y, trackBeginEnd.begin_z };
|
||||||
y = trackBeginEnd.begin_y;
|
|
||||||
z = trackBeginEnd.begin_z;
|
|
||||||
direction = trackBeginEnd.begin_direction;
|
direction = trackBeginEnd.begin_direction;
|
||||||
tileElement = trackBeginEnd.begin_element;
|
tileElement = trackBeginEnd.begin_element;
|
||||||
}
|
}
|
||||||
|
@ -9123,7 +9113,7 @@ loc_6DCA9A:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vehicle->TrackLocation = { x, y, z };
|
vehicle->TrackLocation = trackPos;
|
||||||
|
|
||||||
if (vehicle->UpdateFlag(VEHICLE_UPDATE_FLAG_ON_LIFT_HILL))
|
if (vehicle->UpdateFlag(VEHICLE_UPDATE_FLAG_ON_LIFT_HILL))
|
||||||
{
|
{
|
||||||
|
@ -9147,9 +9137,8 @@ loc_6DCC2C:
|
||||||
vehicle->track_progress = regs.ax;
|
vehicle->track_progress = regs.ax;
|
||||||
|
|
||||||
moveInfo = vehicle_get_move_info(vehicle->TrackSubposition, vehicle->track_type, vehicle->track_progress);
|
moveInfo = vehicle_get_move_info(vehicle->TrackSubposition, vehicle->track_type, vehicle->track_progress);
|
||||||
x = vehicle->TrackLocation.x + moveInfo->x;
|
trackPos = { vehicle->TrackLocation.x + moveInfo->x, vehicle->TrackLocation.y + moveInfo->y,
|
||||||
y = vehicle->TrackLocation.y + moveInfo->y;
|
vehicle->TrackLocation.z + moveInfo->z + RideData5[curRide->type].z_offset };
|
||||||
z = vehicle->TrackLocation.z + moveInfo->z + RideData5[ride->type].z_offset;
|
|
||||||
|
|
||||||
// Investigate redundant code
|
// Investigate redundant code
|
||||||
regs.ebx = 0;
|
regs.ebx = 0;
|
||||||
|
@ -9172,9 +9161,7 @@ loc_6DCC2C:
|
||||||
vehicle->remaining_distance = 0;
|
vehicle->remaining_distance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unk_F64E20.x = x;
|
unk_F64E20 = trackPos;
|
||||||
unk_F64E20.y = y;
|
|
||||||
unk_F64E20.z = z;
|
|
||||||
vehicle->sprite_direction = moveInfo->direction;
|
vehicle->sprite_direction = moveInfo->direction;
|
||||||
vehicle->bank_rotation = moveInfo->bank_rotation;
|
vehicle->bank_rotation = moveInfo->bank_rotation;
|
||||||
vehicle->vehicle_sprite_type = moveInfo->vehicle_sprite_type;
|
vehicle->vehicle_sprite_type = moveInfo->vehicle_sprite_type;
|
||||||
|
@ -9194,7 +9181,7 @@ loc_6DCC2C:
|
||||||
if (_vehicleVelocityF64E08 >= 0)
|
if (_vehicleVelocityF64E08 >= 0)
|
||||||
{
|
{
|
||||||
otherVehicleIndex = vehicle->var_44;
|
otherVehicleIndex = vehicle->var_44;
|
||||||
if (vehicle_update_motion_collision_detection(vehicle, x, y, z, &otherVehicleIndex))
|
if (vehicle_update_motion_collision_detection(vehicle, trackPos.x, trackPos.y, trackPos.z, &otherVehicleIndex))
|
||||||
{
|
{
|
||||||
goto loc_6DCD6B;
|
goto loc_6DCD6B;
|
||||||
}
|
}
|
||||||
|
@ -9286,11 +9273,11 @@ loc_6DCE68:
|
||||||
|
|
||||||
for (int32_t i = 0; i < MAX_STATIONS; i++)
|
for (int32_t i = 0; i < MAX_STATIONS; i++)
|
||||||
{
|
{
|
||||||
if (vehicle->TrackLocation != ride->stations[i].Start)
|
if (vehicle->TrackLocation != curRide->stations[i].Start)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((vehicle->TrackLocation.z) != ride->stations[i].GetBaseZ())
|
if ((vehicle->TrackLocation.z) != curRide->stations[i].GetBaseZ())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -9562,7 +9549,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation)
|
||||||
|
|
||||||
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_MINI_GOLF)
|
if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_MINI_GOLF)
|
||||||
{
|
{
|
||||||
return vehicle_update_track_motion_mini_golf(this, outStation);
|
return UpdateTrackMotionMiniGolf(outStation);
|
||||||
}
|
}
|
||||||
|
|
||||||
_vehicleF64E2C = 0;
|
_vehicleF64E2C = 0;
|
||||||
|
|
|
@ -419,6 +419,7 @@ private:
|
||||||
void KillAllPassengersInTrain();
|
void KillAllPassengersInTrain();
|
||||||
void KillPassengers(Ride* curRide);
|
void KillPassengers(Ride* curRide);
|
||||||
void TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_seats);
|
void TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_seats);
|
||||||
|
int32_t UpdateTrackMotionMiniGolf(int32_t* outStation);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct train_ref
|
struct train_ref
|
||||||
|
|
Loading…
Reference in New Issue