1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Replace regs.(e)bp in vehicle_update_track_motion_mini_golf()

This commit is contained in:
Gymnasiast
2020-05-04 18:45:32 +02:00
parent 09955a0114
commit 4ad38f14fc

View File

@@ -8653,6 +8653,7 @@ loc_6DBE7F:
static int32_t vehicle_update_track_motion_mini_golf(Vehicle* vehicle, int32_t* outStation)
{
registers regs = {};
uint16_t otherVehicleIndex = SPRITE_INDEX_NULL;
auto ride = get_ride(vehicle->ride);
if (ride == nullptr)
@@ -8988,8 +8989,8 @@ loc_6DC743:
{
if (_vehicleVelocityF64E08 >= 0)
{
regs.bp = vehicle->prev_vehicle_on_ride;
vehicle_update_motion_collision_detection(vehicle, x, y, z, reinterpret_cast<uint16_t*>(&regs.bp));
otherVehicleIndex = vehicle->prev_vehicle_on_ride;
vehicle_update_motion_collision_detection(vehicle, x, y, z, &otherVehicleIndex);
}
}
goto loc_6DC99A;
@@ -9142,8 +9143,8 @@ loc_6DCC2C:
{
if (_vehicleVelocityF64E08 >= 0)
{
regs.bp = vehicle->var_44;
if (vehicle_update_motion_collision_detection(vehicle, x, y, z, reinterpret_cast<uint16_t*>(&regs.bp)))
otherVehicleIndex = vehicle->var_44;
if (vehicle_update_motion_collision_detection(vehicle, x, y, z, &otherVehicleIndex))
{
goto loc_6DCD6B;
}
@@ -9170,7 +9171,7 @@ loc_6DCD6B:
_vehicleVelocityF64E0C -= vehicle->remaining_distance - 0x368A;
vehicle->remaining_distance = 0x368A;
{
Vehicle* vEBP = GET_VEHICLE(regs.bp);
Vehicle* vEBP = GET_VEHICLE(otherVehicleIndex);
Vehicle* vEDI = gCurrentVehicle;
regs.eax = abs(vEDI->velocity - vEBP->velocity);
if (regs.eax > 0xE0000)
@@ -9272,15 +9273,15 @@ loc_6DCEB2:
loc_6DCEFF:
vehicle = gCurrentVehicle;
regs.eax = 0;
regs.ebp = 0;
regs.dx = 0;
regs.ebx = 0;
uint16_t totalMass = 0;
for (;;)
{
regs.ebx++;
regs.dx |= vehicle->update_flags;
regs.bp += vehicle->mass;
totalMass += vehicle->mass;
regs.eax += vehicle->acceleration;
regs.si = vehicle->next_vehicle_on_train;
if (static_cast<uint16_t>(regs.si) == SPRITE_INDEX_NULL)
@@ -9303,7 +9304,7 @@ loc_6DCEFF:
regs.edx = -regs.edx;
}
regs.edx >>= 4;
regs.eax = regs.edx / regs.ebp;
regs.eax = regs.edx / totalMass;
regs.ecx -= regs.eax;
if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_POWERED))
@@ -9322,7 +9323,7 @@ loc_6DCEFF:
regs.bx = vehicle->track_type >> 2;
regs.ebx = regs.eax;
regs.eax <<= 14;
regs.ebx *= regs.ebp;
regs.ebx *= totalMass;
regs.ebx >>= 2;
if (vehicle->update_flags & VEHICLE_UPDATE_FLAG_REVERSING_SHUTTLE)
{