mirror of https://github.com/OpenRCT2/OpenRCT2.git
Simplify some code in Vehicle.cpp (#8595)
* Simplify some code in Vehicle.cpp This reduces amount of code that depends on registers struct * Simplify code in Vehicle.cpp This removes one goto.
This commit is contained in:
parent
a2e45b56c0
commit
1fa5606509
|
@ -8231,7 +8231,10 @@ loc_6DAEB9:
|
||||||
|
|
||||||
if (!vehicle_update_track_motion_forwards_get_new_track(vehicle, trackType, ride, rideEntry))
|
if (!vehicle_update_track_motion_forwards_get_new_track(vehicle, trackType, ride, rideEntry))
|
||||||
{
|
{
|
||||||
goto loc_6DB94A;
|
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
||||||
|
_vehicleVelocityF64E0C -= vehicle->remaining_distance + 1;
|
||||||
|
vehicle->remaining_distance = -1;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
regs.ax = 0;
|
regs.ax = 0;
|
||||||
}
|
}
|
||||||
|
@ -8322,18 +8325,9 @@ loc_6DAEB9:
|
||||||
_vehicleUnkF64E10++;
|
_vehicleUnkF64E10++;
|
||||||
goto loc_6DAEB9;
|
goto loc_6DAEB9;
|
||||||
|
|
||||||
loc_6DB94A:
|
|
||||||
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
|
||||||
regs.eax = vehicle->remaining_distance + 1;
|
|
||||||
_vehicleVelocityF64E0C -= regs.eax;
|
|
||||||
vehicle->remaining_distance = 0xFFFFFFFF;
|
|
||||||
regs.ebx = vehicle->vehicle_sprite_type;
|
|
||||||
return false;
|
|
||||||
|
|
||||||
loc_6DB967:
|
loc_6DB967:
|
||||||
regs.eax = vehicle->remaining_distance + 1;
|
_vehicleVelocityF64E0C -= vehicle->remaining_distance + 1;
|
||||||
_vehicleVelocityF64E0C -= regs.eax;
|
vehicle->remaining_distance = -1;
|
||||||
vehicle->remaining_distance -= regs.eax;
|
|
||||||
|
|
||||||
// Might need to be bp rather than vehicle, but hopefully not
|
// Might need to be bp rather than vehicle, but hopefully not
|
||||||
rct_vehicle* head = vehicle_get_head(GET_VEHICLE(regs.bp));
|
rct_vehicle* head = vehicle_get_head(GET_VEHICLE(regs.bp));
|
||||||
|
@ -8647,24 +8641,20 @@ loc_6DBA33:;
|
||||||
|
|
||||||
loc_6DBE5E:
|
loc_6DBE5E:
|
||||||
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
||||||
regs.eax = vehicle->remaining_distance - 0x368A;
|
_vehicleVelocityF64E0C -= vehicle->remaining_distance - 0x368A;
|
||||||
_vehicleVelocityF64E0C -= regs.eax;
|
vehicle->remaining_distance = 0x368A;
|
||||||
vehicle->remaining_distance -= regs.eax;
|
|
||||||
regs.ebx = vehicle->vehicle_sprite_type;
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
loc_6DBE7F:
|
loc_6DBE7F:
|
||||||
regs.eax = vehicle->remaining_distance - 0x368A;
|
_vehicleVelocityF64E0C -= vehicle->remaining_distance - 0x368A;
|
||||||
_vehicleVelocityF64E0C -= regs.eax;
|
vehicle->remaining_distance = 0x368A;
|
||||||
vehicle->remaining_distance -= regs.eax;
|
|
||||||
|
|
||||||
rct_vehicle* v3 = GET_VEHICLE(regs.bp);
|
rct_vehicle* v3 = GET_VEHICLE(regs.bp);
|
||||||
rct_vehicle* v4 = gCurrentVehicle;
|
rct_vehicle* v4 = gCurrentVehicle;
|
||||||
regs.eax = abs(v4->velocity - v3->velocity);
|
|
||||||
|
|
||||||
if (!(rideEntry->flags & RIDE_ENTRY_FLAG_DISABLE_COLLISION_CRASHES))
|
if (!(rideEntry->flags & RIDE_ENTRY_FLAG_DISABLE_COLLISION_CRASHES))
|
||||||
{
|
{
|
||||||
if (regs.eax > 0xE0000)
|
if (abs(v4->velocity - v3->velocity) > 0xE0000)
|
||||||
{
|
{
|
||||||
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_BOAT_HIRE_COLLISION_DETECTION))
|
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_BOAT_HIRE_COLLISION_DETECTION))
|
||||||
{
|
{
|
||||||
|
@ -9063,10 +9053,8 @@ loc_6DC99A:
|
||||||
|
|
||||||
loc_6DC9BC:
|
loc_6DC9BC:
|
||||||
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
||||||
regs.eax = vehicle->remaining_distance + 1;
|
_vehicleVelocityF64E0C -= vehicle->remaining_distance + 1;
|
||||||
_vehicleVelocityF64E0C -= regs.eax;
|
vehicle->remaining_distance = -1;
|
||||||
vehicle->remaining_distance -= regs.eax;
|
|
||||||
regs.ebx = vehicle->vehicle_sprite_type;
|
|
||||||
goto loc_6DCD2B;
|
goto loc_6DCD2B;
|
||||||
|
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
|
@ -9216,16 +9204,14 @@ loc_6DCD2B:
|
||||||
|
|
||||||
loc_6DCD4A:
|
loc_6DCD4A:
|
||||||
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
||||||
regs.eax = vehicle->remaining_distance - 0x368A;
|
_vehicleVelocityF64E0C -= vehicle->remaining_distance - 0x368A;
|
||||||
_vehicleVelocityF64E0C -= regs.eax;
|
vehicle->remaining_distance = 0x368A;
|
||||||
vehicle->remaining_distance -= regs.eax;
|
|
||||||
regs.ebx = vehicle->vehicle_sprite_type;
|
regs.ebx = vehicle->vehicle_sprite_type;
|
||||||
goto loc_6DC99A;
|
goto loc_6DC99A;
|
||||||
|
|
||||||
loc_6DCD6B:
|
loc_6DCD6B:
|
||||||
regs.eax = vehicle->remaining_distance - 0x368A;
|
_vehicleVelocityF64E0C -= vehicle->remaining_distance - 0x368A;
|
||||||
_vehicleVelocityF64E0C -= regs.eax;
|
vehicle->remaining_distance = 0x368A;
|
||||||
vehicle->remaining_distance -= regs.eax;
|
|
||||||
{
|
{
|
||||||
rct_vehicle* vEBP = GET_VEHICLE(regs.bp);
|
rct_vehicle* vEBP = GET_VEHICLE(regs.bp);
|
||||||
rct_vehicle* vEDI = gCurrentVehicle;
|
rct_vehicle* vEDI = gCurrentVehicle;
|
||||||
|
@ -9626,8 +9612,7 @@ int32_t vehicle_update_track_motion(rct_vehicle* vehicle, int32_t* outStation)
|
||||||
car->acceleration = dword_9A2970[car->vehicle_sprite_type];
|
car->acceleration = dword_9A2970[car->vehicle_sprite_type];
|
||||||
_vehicleUnkF64E10 = 1;
|
_vehicleUnkF64E10 = 1;
|
||||||
|
|
||||||
regs.eax = _vehicleVelocityF64E0C + car->remaining_distance;
|
car->remaining_distance += _vehicleVelocityF64E0C;
|
||||||
car->remaining_distance = regs.eax;
|
|
||||||
|
|
||||||
car->sound2_flags &= ~VEHICLE_SOUND2_FLAGS_LIFT_HILL;
|
car->sound2_flags &= ~VEHICLE_SOUND2_FLAGS_LIFT_HILL;
|
||||||
unk_F64E20.x = car->x;
|
unk_F64E20.x = car->x;
|
||||||
|
|
Loading…
Reference in New Issue