Implemented some of the cable lift code

This commit is contained in:
duncanspumpkin 2015-11-30 21:11:22 +00:00
parent 9e182df025
commit 5a69dd50ef
3 changed files with 51 additions and 26 deletions

View File

@ -4486,7 +4486,7 @@ bool ride_create_cable_lift(int rideIndex, bool isApplying)
tail->next_vehicle_on_ride = head->sprite_index;
ride->lifecycle_flags |= RIDE_LIFECYCLE_CABLE_LIFT;
sub_6DEF56(head);
sub_6DEF56(head, NULL, NULL);
return true;
}

View File

@ -37,11 +37,11 @@
static void vehicle_update(rct_vehicle *vehicle);
static void vehicle_ride_null_update_moving_to_end_of_station(rct_vehicle *vehicle);
static void vehicle_ride_null_update_waiting_to_depart(rct_vehicle *vehicle);
static void vehicle_ride_null_update_departing(rct_vehicle *vehicle);
static void vehicle_ride_null_update_travelling(rct_vehicle *vehicle);
static void vehicle_ride_null_update_arriving(rct_vehicle *vehicle);
static void vehicle_update_cable_lift_moving_to_end_of_station(rct_vehicle *vehicle);
static void vehicle_update_cable_lift_waiting_to_depart(rct_vehicle *vehicle);
static void vehicle_update_cable_lift_departing(rct_vehicle *vehicle);
static void vehicle_update_cable_lift_travelling(rct_vehicle *vehicle);
static void vehicle_update_cable_lift_arriving(rct_vehicle *vehicle);
static void vehicle_update_showing_film(rct_vehicle *vehicle);
static void vehicle_update_doing_circus_show(rct_vehicle *vehicle);
@ -999,22 +999,23 @@ static void vehicle_update(rct_vehicle *vehicle)
rct_ride *ride;
rct_ride_type *rideEntry;
// The cable lift uses the ride type of NULL
if (vehicle->ride_subtype == RIDE_TYPE_NULL) {
switch (vehicle->status) {
case VEHICLE_STATUS_MOVING_TO_END_OF_STATION:
vehicle_ride_null_update_moving_to_end_of_station(vehicle);
vehicle_update_cable_lift_moving_to_end_of_station(vehicle);
break;
case VEHICLE_STATUS_WAITING_TO_DEPART:
vehicle_ride_null_update_waiting_to_depart(vehicle);
vehicle_update_cable_lift_waiting_to_depart(vehicle);
break;
case VEHICLE_STATUS_DEPARTING:
vehicle_ride_null_update_departing(vehicle);
vehicle_update_cable_lift_departing(vehicle);
break;
case VEHICLE_STATUS_TRAVELLING:
vehicle_ride_null_update_travelling(vehicle);
vehicle_update_cable_lift_travelling(vehicle);
break;
case VEHICLE_STATUS_ARRIVING:
vehicle_ride_null_update_arriving(vehicle);
vehicle_update_cable_lift_arriving(vehicle);
break;
}
return;
@ -1057,7 +1058,7 @@ static void vehicle_update(rct_vehicle *vehicle)
case VEHICLE_STATUS_CRASHED:
vehicle_update_crash(vehicle);
break;
case VEHICLE_STATUS_TRAVELING_BUMPER_CARS:
case VEHICLE_STATUS_TRAVELLING_BUMPER_CARS:
vehicle_update_bumpcar_mode(vehicle);
break;
case VEHICLE_STATUS_SWINGING:
@ -1093,7 +1094,7 @@ static void vehicle_update(rct_vehicle *vehicle)
case VEHICLE_STATUS_ARRIVING:
case VEHICLE_STATUS_UNLOADING_PASSENGERS:
case VEHICLE_STATUS_TRAVELLING_07:
case VEHICLE_STATUS_TRAVELLING_15:
case VEHICLE_STATUS_TRAVELLING_CABLE_LIFT:
{
int *addressSwitchPtr = (int*)(0x006D7B70 + (vehicle->status * 4));
RCT2_CALLPROC_X(*addressSwitchPtr, 0, 0, 0, (vehicle->sub_state << 8) | ride->mode, (int)vehicle, 0, 0);
@ -1112,27 +1113,48 @@ static void vehicle_update(rct_vehicle *vehicle)
vehicle_update_sound(vehicle);
}
static void vehicle_ride_null_update_moving_to_end_of_station(rct_vehicle *vehicle)
static void vehicle_update_cable_lift_moving_to_end_of_station(rct_vehicle *vehicle)
{
RCT2_CALLPROC_X(0x006DF8A4, 0, 0, 0, 0, (int)vehicle, 0, 0);
}
static void vehicle_ride_null_update_waiting_to_depart(rct_vehicle *vehicle)
static void vehicle_update_cable_lift_waiting_to_depart(rct_vehicle *vehicle)
{
RCT2_CALLPROC_X(0x006DF8F1, 0, 0, 0, 0, (int)vehicle, 0, 0);
}
static void vehicle_ride_null_update_departing(rct_vehicle *vehicle)
static void vehicle_update_cable_lift_departing(rct_vehicle *vehicle)
{
RCT2_CALLPROC_X(0x006DF97A, 0, 0, 0, 0, (int)vehicle, 0, 0);
vehicle->sub_state++;
if (vehicle->sub_state < 16)
return;
rct_vehicle* passengerVehicle = GET_VEHICLE(vehicle->var_C0);
vehicle->status = VEHICLE_STATUS_TRAVELLING;
passengerVehicle->status = VEHICLE_STATUS_TRAVELLING_CABLE_LIFT;
}
static void vehicle_ride_null_update_travelling(rct_vehicle *vehicle)
static void vehicle_update_cable_lift_travelling(rct_vehicle *vehicle)
{
RCT2_CALLPROC_X(0x006DF99C, 0, 0, 0, 0, (int)vehicle, 0, 0);
rct_vehicle* passengerVehicle = GET_VEHICLE(vehicle->var_C0);
vehicle->velocity = min(passengerVehicle->velocity, 439800);
vehicle->var_2C = 0;
if (passengerVehicle->update_flags & VEHICLE_UPDATE_FLAG_BROKEN_TRAIN)
return;
int eax = 0;
sub_6DEF56(vehicle, &eax, NULL);
if (!(eax & (1 << 1)))
return;
vehicle->velocity = 0;
vehicle->var_2C = 0;
vehicle->status = VEHICLE_STATUS_ARRIVING;
vehicle->sub_state = 0;
}
static void vehicle_ride_null_update_arriving(rct_vehicle *vehicle)
static void vehicle_update_cable_lift_arriving(rct_vehicle *vehicle)
{
vehicle->sub_state++;
if (vehicle->sub_state >= 64)
@ -1595,7 +1617,7 @@ static void vehicle_update_waiting_to_depart(rct_vehicle* vehicle) {
switch (ride->mode) {
case RIDE_MODE_BUMPERCAR:
vehicle->status = VEHICLE_STATUS_TRAVELING_BUMPER_CARS;
vehicle->status = VEHICLE_STATUS_TRAVELLING_BUMPER_CARS;
vehicle_invalidate_window(vehicle);
// Bumper mode uses sub_state / var_CE to tell how long
// the vehicle has been ridden.
@ -3277,9 +3299,12 @@ int vehicle_is_used_in_pairs(rct_vehicle *vehicle)
*
* rct2: 0x006DEF56
*/
void sub_6DEF56(rct_vehicle *cableLift)
void sub_6DEF56(rct_vehicle *cableLift, int* eax, int* ebx)
{
RCT2_CALLPROC_X(0x006DEF56, 0, 0, 0, 0, (int)cableLift, 0, 0);
int _eax, _ebx, ecx, edx, ebp, edi;
RCT2_CALLFUNC_X(0x006DEF56, &_eax, &_ebx, &ecx, &edx, (int*)&cableLift, &edi, &ebp);
if (eax != NULL)*eax = _eax;
if (ebx != NULL)*ebx = _ebx;
}
rct_vehicle *cable_lift_segment_create(int rideIndex, int x, int y, int z, int direction, uint16 var_44, uint32 var_24, bool head)

View File

@ -193,7 +193,7 @@ enum {
VEHICLE_STATUS_TRAVELLING_07,
VEHICLE_STATUS_CRASHING,
VEHICLE_STATUS_CRASHED,
VEHICLE_STATUS_TRAVELING_BUMPER_CARS,
VEHICLE_STATUS_TRAVELLING_BUMPER_CARS,
VEHICLE_STATUS_SWINGING,
VEHICLE_STATUS_ROTATING,
VEHICLE_STATUS_FERRIS_WHEEL_ROTATING,
@ -205,7 +205,7 @@ enum {
VEHICLE_STATUS_DOING_CIRCUS_SHOW,
VEHICLE_STATUS_CROOKED_HOUSE_OPERATING,
VEHICLE_STATUS_WAITING_FOR_CABLE_LIFT,
VEHICLE_STATUS_TRAVELLING_15,
VEHICLE_STATUS_TRAVELLING_CABLE_LIFT,
VEHICLE_STATUS_STOPPING,
VEHICLE_STATUS_WAITING_FOR_PASSENGERS_17,
VEHICLE_STATUS_WAITING_TO_START,
@ -280,7 +280,7 @@ void vehicle_get_g_forces(rct_vehicle *vehicle, int *verticalG, int *lateralG);
void vehicle_set_map_toolbar(rct_vehicle *vehicle);
int vehicle_is_used_in_pairs(rct_vehicle *vehicle);
rct_vehicle *vehicle_get_head(rct_vehicle *vehicle);
void sub_6DEF56(rct_vehicle *cableLift);
void sub_6DEF56(rct_vehicle *cableLift, int* eax, int* ebx);
rct_vehicle *cable_lift_segment_create(int rideIndex, int x, int y, int z, int direction, uint16 var_44, uint32 var_24, bool head);
bool sub_6DD365(rct_vehicle *vehicle);
int sub_6DAB4C(rct_vehicle *vehicle, int *outStation);