Small tidy up of vehicles related to using in pairs

This commit is contained in:
Duncan Frost 2015-03-21 12:26:28 +00:00
parent 4971a69a93
commit 3ce979504a
3 changed files with 19 additions and 14 deletions

View File

@ -883,7 +883,7 @@ static void peep_choose_seat_from_car(rct_peep* peep, rct_ride* ride, rct_vehicl
ride->mode == RIDE_MODE_BACKWARD_ROTATION){
chosen_seat = (((~vehicle->var_1F + 1) >> 3) & 0xF) * 2;
if (vehicle->var_B4 & 1){
if (vehicle->next_free_seat & 1){
chosen_seat++;
}
}
@ -1014,17 +1014,17 @@ static void peep_update_ride_sub_state_0(rct_peep* peep){
i++){
vehicle = GET_VEHICLE(vehicle_id);
uint8 al = vehicle->num_seats;
if (al & 0x80){
al &= ~0x80;
if (vehicle->var_B4 & 1){
uint8 num_seats = vehicle->num_seats;
if (vehicle_is_used_in_pairs(vehicle)){
num_seats &= VEHICLE_SEAT_NUM_MASK;
if (vehicle->next_free_seat & 1){
peep->current_car = i;
peep_choose_seat_from_car(peep, ride, vehicle);
peep_go_to_ride_entrance(peep, ride);
return;
}
}
if (al == vehicle->next_free_seat)
if (num_seats == vehicle->next_free_seat)
continue;
if (ride->mode == RIDE_MODE_FORWARD_ROTATION ||
@ -1481,7 +1481,7 @@ static void peep_update_ride_sub_state_2(rct_peep* peep){
}
}
if (!(vehicle->num_seats & 0x80)){
if (!vehicle_is_used_in_pairs(vehicle)){
peep_update_ride_sub_state_2_enter_ride(peep, ride);
return;
}
@ -1489,7 +1489,7 @@ static void peep_update_ride_sub_state_2(rct_peep* peep){
if (ride->mode == RIDE_MODE_FORWARD_ROTATION ||
ride->mode == RIDE_MODE_BACKWARD_ROTATION){
if (peep->current_seat & 1 ||
!(vehicle->var_B4 & 1)){
!(vehicle->next_free_seat & 1)){
peep_update_ride_sub_state_2_enter_ride(peep, ride);
return;
}
@ -1534,7 +1534,7 @@ static void peep_update_ride_sub_state_5(rct_peep* peep){
return;
}
if (vehicle->num_seats & 0x80){
if (vehicle_is_used_in_pairs(vehicle)){
rct_peep* seated_peep = GET_PEEP(vehicle->peep[peep->current_seat ^ 1]);
if (seated_peep->sub_state != 5)
return;

View File

@ -632,4 +632,9 @@ rct_vehicle *vehicle_get_head(rct_vehicle *vehicle)
}
return vehicle;
}
int vehicle_is_used_in_pairs(rct_vehicle *vehicle)
{
return vehicle->num_seats & VEHICLE_SEAT_PAIR_FLAG;
}

View File

@ -71,10 +71,7 @@ typedef struct {
uint8 peep_tshirt_colours[32]; // 0x92
uint8 num_seats; // 0xB2
uint8 num_peeps; // 0xB3
union{
uint8 var_B4; // When Forward/Backward rotation this variable is used differently
uint8 next_free_seat; // 0xB4
};
uint8 next_free_seat; // 0xB4
uint8 pad_B5[0x06];
uint8 sound1_id; // 0xBB
uint8 sound1_volume; // 0xBC
@ -129,13 +126,16 @@ enum {
VEHICLE_STATUS_STOPPED_BY_BLOCK_BRAKES
};
#define VEHICLE_SEAT_PAIR_FLAG 0x80
#define VEHICLE_SEAT_NUM_MASK 0x7F
void vehicle_update_all();
int sub_6BC2F3(rct_vehicle* vehicle);
void sub_6BB9FF(rct_vehicle* vehicle);
void vehicle_sounds_update();
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);
/** Helper macro until rides are stored in this module. */