mirror of https://github.com/OpenRCT2/OpenRCT2.git
Added start of sub_state_7
This commit is contained in:
parent
3ce979504a
commit
ddfdfd37be
137
src/peep/peep.c
137
src/peep/peep.c
|
@ -1573,6 +1573,140 @@ static void peep_update_ride_sub_state_5(rct_peep* peep){
|
|||
RCT2_CALLPROC_X(0x00695444, 0, 0, 0, peep->current_ride, (int)peep, 0, 0);
|
||||
}
|
||||
|
||||
/* rct2: 0x00693028*/
|
||||
static void peep_update_ride_sub_state_7(rct_peep* peep){
|
||||
rct_ride* ride = GET_RIDE(peep->current_ride);
|
||||
|
||||
rct_vehicle* vehicle = GET_VEHICLE(ride->vehicles[peep->current_train]);
|
||||
uint8 ride_station = vehicle->current_station;
|
||||
|
||||
for (int i = peep->current_car; i != 0; --i){
|
||||
vehicle = GET_VEHICLE(vehicle->next_vehicle_on_train);
|
||||
}
|
||||
|
||||
// Unsure why backward rotation is missing.
|
||||
if (ride->mode != RIDE_MODE_FORWARD_ROTATION){
|
||||
if (vehicle->num_peeps - 1 != peep->current_seat)
|
||||
return;
|
||||
}
|
||||
|
||||
peep->action_sprite_image_offset++;
|
||||
if (peep->action_sprite_image_offset & 3)
|
||||
return;
|
||||
|
||||
peep->action_sprite_image_offset = 0;
|
||||
|
||||
vehicle->num_peeps--;
|
||||
vehicle->var_46 -= peep->var_41;
|
||||
invalidate_sprite((rct_sprite*)vehicle);
|
||||
|
||||
peep->current_ride_station = ride_station;
|
||||
|
||||
rct_ride_type* ride_entry = GET_RIDE_ENTRY(vehicle->ride_subtype);
|
||||
rct_ride_type_vehicle* vehicle_entry = &ride_entry->vehicles[vehicle->vehicle_type];
|
||||
|
||||
if (!(vehicle_entry->var_14 & (1 << 10))){
|
||||
sint16 x, y, z;
|
||||
x = ride->exits[peep->current_ride_station] & 0xFF;
|
||||
y = ride->exits[peep->current_ride_station] >> 8;
|
||||
z = ride->station_heights[peep->current_ride_station];
|
||||
|
||||
rct_map_element* map_element = map_get_first_element_at(x, y);
|
||||
for (;; map_element++){
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_ENTRANCE)
|
||||
continue;
|
||||
if (map_element->base_height == z)
|
||||
break;
|
||||
}
|
||||
|
||||
uint8 exit_direction = map_element->type & MAP_ELEMENT_DIRECTION_MASK;
|
||||
exit_direction ^= (1 << 1);
|
||||
|
||||
if (!(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_FLAGS, uint32)[ride->type * 2] & RIDE_TYPE_FLAG_16)){
|
||||
|
||||
for (; vehicle->var_01 != 0; vehicle = GET_VEHICLE(vehicle->prev_vehicle_on_train)){
|
||||
uint16 eax = vehicle->var_36 / 4;
|
||||
if (eax == 0 || eax > 3)
|
||||
continue;
|
||||
|
||||
rct_map_element* inner_map = map_get_first_element_at(vehicle->var_38 / 32, vehicle->var_3A / 32);
|
||||
for (;; map_element++){
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_TRACK)
|
||||
continue;
|
||||
if (map_element->base_height == vehicle->var_3C)
|
||||
break;
|
||||
}
|
||||
|
||||
uint8 al = (inner_map->properties.track.sequence & 0x70) >> 4;
|
||||
if (al == peep->current_ride_station)
|
||||
break;
|
||||
}
|
||||
|
||||
ride_entry = GET_RIDE_ENTRY(ride->subtype);
|
||||
vehicle_entry = &ride_entry->vehicles[ride_entry->var_014];
|
||||
|
||||
uint8 shift_multiplier = 12;
|
||||
if (vehicle_entry->var_14 & (1 << 14)){
|
||||
shift_multiplier = 9;
|
||||
}
|
||||
|
||||
uint8 direction = exit_direction;
|
||||
if (vehicle_entry->var_14 & ((1 << 14) | (1 << 12))){
|
||||
direction = ((vehicle->sprite_direction + 3) / 8) + 1;
|
||||
direction &= 3;
|
||||
|
||||
if (vehicle->var_CD == 6)
|
||||
direction ^= (1 << 1);
|
||||
}
|
||||
|
||||
sint16 x_shift = RCT2_ADDRESS(0x00981D6C, sint16)[direction * 2];
|
||||
sint16 y_shift = RCT2_ADDRESS(0x00981D6E, sint16)[direction * 2];
|
||||
|
||||
x = vehicle->x + x_shift * shift_multiplier;
|
||||
y = vehicle->y + y_shift * shift_multiplier;
|
||||
z *= 8;
|
||||
z += RCT2_ADDRESS(0x0097D21C, uint8)[ride->type * 8];
|
||||
|
||||
sprite_move(x, y, z, (rct_sprite*)peep);
|
||||
invalidate_sprite((rct_sprite*)peep);
|
||||
|
||||
x = ride->exits[peep->current_ride_station] & 0xFF;
|
||||
y = ride->exits[peep->current_ride_station] >> 8;
|
||||
x *= 32;
|
||||
y *= 32;
|
||||
x += 16;
|
||||
y += 16;
|
||||
|
||||
x_shift = RCT2_ADDRESS(0x00981D6C, sint16)[exit_direction * 2];
|
||||
y_shift = RCT2_ADDRESS(0x00981D6E, sint16)[exit_direction * 2];
|
||||
|
||||
shift_multiplier = 21;
|
||||
|
||||
rct_ride_type* ride_type = GET_RIDE_ENTRY(ride->subtype);
|
||||
if (vehicle_entry->var_12 & (1 << 3) ||
|
||||
vehicle_entry->var_14 & 0x5000){
|
||||
shift_multiplier = 32;
|
||||
}
|
||||
|
||||
x_shift *= shift_multiplier;
|
||||
y_shift *= shift_multiplier;
|
||||
|
||||
x += x_shift;
|
||||
y += y_shift;
|
||||
|
||||
peep->destination_x = x;
|
||||
peep->destination_y = y;
|
||||
peep->destination_tolerence = 2;
|
||||
|
||||
peep->sprite_direction = exit_direction;
|
||||
peep->sub_state = 8;
|
||||
return;
|
||||
}
|
||||
//6934ef
|
||||
}
|
||||
//6932cd
|
||||
}
|
||||
|
||||
/* rct2: 0x691A30
|
||||
* Used by entering_ride and queueing_front */
|
||||
static void peep_update_ride(rct_peep* peep){
|
||||
|
@ -1609,6 +1743,9 @@ static void peep_update_ride(rct_peep* peep){
|
|||
case 6:
|
||||
// No action, on ride.
|
||||
break;
|
||||
case 7:
|
||||
peep_update_ride_sub_state_7(peep);
|
||||
break;
|
||||
default:
|
||||
RCT2_CALLPROC_X(RCT2_ADDRESS(0x9820DC, int)[peep->sub_state], 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
}
|
||||
|
|
|
@ -1884,7 +1884,7 @@ void ride_measurement_update(rct_ride_measurement *measurement)
|
|||
return;
|
||||
|
||||
measurement->flags &= ~RIDE_MEASUREMENT_FLAG_UNLOADING;
|
||||
if (measurement->var_0B == vehicle->var_4B)
|
||||
if (measurement->current_station == vehicle->current_station)
|
||||
measurement->current_item = 0;
|
||||
}
|
||||
|
||||
|
@ -1968,7 +1968,7 @@ void ride_measurements_update()
|
|||
vehicle = &(g_sprite_list[spriteIndex].vehicle);
|
||||
if (vehicle->status == VEHICLE_STATUS_DEPARTING || vehicle->status == VEHICLE_STATUS_STOPPING) {
|
||||
measurement->vehicle_index = j;
|
||||
measurement->var_0B = vehicle->var_4B;
|
||||
measurement->current_station = vehicle->current_station;
|
||||
measurement->flags |= RIDE_MEASUREMENT_FLAG_RUNNING;
|
||||
measurement->flags &= ~RIDE_MEASUREMENT_FLAG_UNLOADING;
|
||||
ride_measurement_update(measurement);
|
||||
|
|
|
@ -318,7 +318,7 @@ typedef struct {
|
|||
uint16 num_items; // 0x0006
|
||||
uint16 current_item; // 0x0008
|
||||
uint8 vehicle_index; // 0x000A
|
||||
uint8 var_0B;
|
||||
uint8 current_station; // 0x000B
|
||||
sint8 vertical[RIDE_MEASUREMENT_MAX_ITEMS]; // 0x000C
|
||||
sint8 lateral[RIDE_MEASUREMENT_MAX_ITEMS]; // 0x12CC
|
||||
uint8 velocity[RIDE_MEASUREMENT_MAX_ITEMS]; // 0x258C
|
||||
|
|
|
@ -55,7 +55,9 @@ typedef struct {
|
|||
uint8 pad_32[0x02];
|
||||
uint16 var_34;
|
||||
sint16 var_36;
|
||||
uint8 pad_38[0x06];
|
||||
uint16 var_38;
|
||||
uint16 var_3A;
|
||||
uint16 var_3C;
|
||||
uint16 next_vehicle_on_train; // 0x3E
|
||||
uint16 prev_vehicle_on_train; // 0x40
|
||||
uint16 pad_42;
|
||||
|
@ -63,7 +65,7 @@ typedef struct {
|
|||
uint16 var_46;
|
||||
uint16 var_48;
|
||||
uint8 pad_4A;
|
||||
uint8 var_4B;
|
||||
uint8 current_station; // 0x4B
|
||||
uint8 pad_4C[0x4];
|
||||
uint8 status; // 0x50
|
||||
uint8 var_51;
|
||||
|
|
|
@ -2070,7 +2070,7 @@ static rct_string_id window_ride_get_status_vehicle(rct_window *w, void *argumen
|
|||
stringId += 23;
|
||||
|
||||
RCT2_GLOBAL((int)arguments + 4, uint16) = RideNameConvention[ride->type].station_name;
|
||||
RCT2_GLOBAL((int)arguments + 6, uint16) = vehicle->var_4B + 1;
|
||||
RCT2_GLOBAL((int)arguments + 6, uint16) = vehicle->current_station + 1;
|
||||
if (ride->num_stations > 1)
|
||||
RCT2_GLOBAL((int)arguments + 4, uint16) += 6;
|
||||
|
||||
|
|
Loading…
Reference in New Issue