From e82b19100de93bb5a838188867e57b26335d57b5 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 25 Dec 2016 15:50:06 +0100 Subject: [PATCH] Re-add boosters, fix typo --- src/ride/vehicle.c | 35 +++++++++++++++++++++++++++++++---- src/ride/vehicle.h | 2 +- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index 09280795c3..06ddb2584b 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -7425,7 +7425,7 @@ loc_6DB41D: } vehicle->track_direction = regs.bl & 3; vehicle->track_type |= trackType << 2; - vehicle->break_speed = (mapElement->properties.track.sequence >> 4) << 1; + vehicle->brake_speed = (mapElement->properties.track.sequence >> 4) << 1; if (trackType == TRACK_ELEM_ON_RIDE_PHOTO) { vehicle_trigger_on_ride_photo(vehicle, mapElement); } @@ -7466,7 +7466,7 @@ loc_6DAEB9: ride->breakdown_reason_pending == BREAKDOWN_BRAKES_FAILURE && ride->mechanic_status == RIDE_MECHANIC_STATUS_4 )) { - regs.eax = vehicle->break_speed << 16; + regs.eax = vehicle->brake_speed << 16; if (regs.eax < _vehicleVelocityF64E08) { vehicle->acceleration = -_vehicleVelocityF64E08 * 16; } @@ -7478,6 +7478,24 @@ loc_6DAEB9: } } } + else if (trackType == TRACK_ELEM_RCTC_BOOSTER && rideEntry->ride_type[0] != RIDE_TYPE_WILD_MOUSE) { + if (!( + ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN && + ride->breakdown_reason_pending == BREAKDOWN_BRAKES_FAILURE && + ride->mechanic_status == RIDE_MECHANIC_STATUS_4 + )) { + regs.eax = (vehicle->brake_speed << 16) / 2; + if (regs.eax > _vehicleVelocityF64E08) { + vehicle->acceleration = _vehicleVelocityF64E08 * 16; + } +// else if (!(gCurrentTicks & 0x0F)) { +// if (_vehicleF64E2C == 0) { +// _vehicleF64E2C++; +// audio_play_sound_at_location(SOUND_51, vehicle->x, vehicle->y, vehicle->z); +// } +// } + } + } if ((trackType == TRACK_ELEM_FLAT && ride->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER) || (trackType == TRACK_ELEM_POWERED_LIFT) @@ -7790,7 +7808,7 @@ static bool vehicle_update_track_motion_backwards_get_new_track(rct_vehicle *veh direction &= 3; vehicle->track_type = trackType << 2; vehicle->track_direction |= direction; - vehicle->break_speed = (mapElement->properties.track.sequence >> 4) << 1; + vehicle->brake_speed = (mapElement->properties.track.sequence >> 4) << 1; // There are two bytes before the move info list uint16 trackTotalProgress = vehicle_get_move_info_size(vehicle->var_CD, vehicle->track_type); @@ -7816,13 +7834,22 @@ loc_6DBA33:; } if (trackType == TRACK_ELEM_BRAKES) { - regs.eax = -(vehicle->break_speed << 16); + regs.eax = -(vehicle->brake_speed << 16); if (regs.eax > _vehicleVelocityF64E08) { regs.eax = _vehicleVelocityF64E08 * -16; vehicle->acceleration = regs.eax; } } + // Bit of a hack. We need a flag or something similar to distinguish between spinning control track and boosters. + if (trackType == TRACK_ELEM_RCTC_BOOSTER && rideEntry->ride_type[0] != RIDE_TYPE_WILD_MOUSE) { + regs.eax = (vehicle->brake_speed << 16) / 2; + if (regs.eax < _vehicleVelocityF64E08) { + regs.eax = _vehicleVelocityF64E08 * 16; + vehicle->acceleration = regs.eax; + } + } + regs.ax = vehicle->track_progress - 1; if (regs.ax == -1) { if (!vehicle_update_track_motion_backwards_get_new_track(vehicle, trackType, ride, rideEntry, (uint16 *)®s.ax)) { diff --git a/src/ride/vehicle.h b/src/ride/vehicle.h index fd33c7cccf..bb73091c16 100644 --- a/src/ride/vehicle.h +++ b/src/ride/vehicle.h @@ -187,7 +187,7 @@ typedef struct rct_vehicle { }; union { uint8 var_CF; - uint8 break_speed; // 0xCF + uint8 brake_speed; // 0xCF }; uint16 lost_time_out; // 0xD0 sint8 vertical_drop_countdown; // 0xD1