Added peep_update_answering

This commit is contained in:
Duncan Frost 2015-03-13 14:48:46 +00:00
parent 4359f4ce1b
commit ae462adc8f
2 changed files with 116 additions and 3 deletions

View File

@ -245,7 +245,7 @@ void peep_check_cant_find_exit(rct_peep* peep){
/* rct2: 0x6939EB
* Possibly peep update action frame.
* Also used to move peeps to the correct position to
* start an action. Returns 0 if the correct destination
* start an action. Returns 1 if the correct destination
* has not yet been reached.
*/
int sub_6939EB(sint16* x, sint16* y, rct_peep* peep){
@ -338,6 +338,7 @@ int sub_6939EB(sint16* x, sint16* y, rct_peep* peep){
*y = peep->y;
return 1;
}
/**
* rct2: 0x0069A409
* Decreases rider count if on/entering a ride.
@ -1753,6 +1754,118 @@ static void peep_update_using_bin(rct_peep* peep){
}
}
/* rct2: 0x006C0CB8 */
static void peep_update_answering(rct_peep* peep){
//RCT2_CALLPROC_X(0x006C0CB8, 0, 0, 0, 0, (int)peep, 0, 0);
//return;
rct_ride* ride = GET_RIDE(peep->current_ride);
if (ride->type == RIDE_TYPE_NULL ||
ride->mechanic_status != RIDE_MECHANIC_STATUS_HEADING){
peep_decrement_num_riders(peep);
peep->state = PEEP_STATE_FALLING;
peep_window_state_update(peep);
return;
}
if (peep->sub_state == 0){
peep->action = PEEP_ACTION_STAFF_ANSWER_CALL;
peep->action_frame = 0;
peep->action_sprite_image_offset = 0;
sub_693B58(peep);
invalidate_sprite((rct_sprite*)peep);
peep->sub_state = 1;
peep_window_state_update(peep);
return;
}
else if (peep->sub_state == 1){
if (peep->action == PEEP_ACTION_NONE_2){
peep->sub_state = 2;
peep_window_state_update(peep);
peep->var_74 = 0;
RCT2_CALLPROC_X(0x0069A98C, 0, 0, 0, 0, (int)peep, 0, 0);
return;
}
sint16 x, y;
sub_6939EB(&x, &y, peep);
return;
}
else if (peep->sub_state <= 3){
peep->var_74++;
if (peep->var_74 > 2500){
if (ride->mechanic_status == RIDE_MECHANIC_STATUS_HEADING){
ride->mechanic_status = RIDE_MECHANIC_STATUS_CALLING;
ride->var_14D |= (1 << 5);
}
peep_decrement_num_riders(peep);
peep->state = PEEP_STATE_FALLING;
peep_window_state_update(peep);
return;
}
if (!sub_68F3AE(peep))return;
RCT2_CALLPROC_X(0x693C9E, 0, 0, 0, 0, (int)peep, 0, 0);
if (!(RCT2_GLOBAL(0xF1EE18, uint16) & 0xC))return;
rct_map_element* map_element = RCT2_GLOBAL(0x00F1EE1A, rct_map_element*);
if (peep->current_ride !=
map_element->properties.entrance.ride_index)
return;
uint8 exit_index = ((map_element->properties.entrance.index & 0x70) >> 4);
if (peep->current_ride_station != exit_index)
return;
if (RCT2_GLOBAL(0xF1EE18, uint16)&(1 << 3)){
if (ride->exits[exit_index] != 0xFFFF)return;
}
uint8 direction = map_element->type & MAP_ELEMENT_DIRECTION_MASK;
peep->var_78 = direction;
int x = peep->next_x + 16 + RCT2_ADDRESS(0x00981D6C, sint16)[direction * 2] * 53;
int y = peep->next_y + 16 + RCT2_ADDRESS(0x00981D6E, sint16)[direction * 2] * 53;
peep->destination_x = x;
peep->destination_y = y;
peep->destination_tolerence = 2;
peep->sprite_direction = direction << 3;
peep->z = map_element->base_height * 4;
peep->sub_state = 4;
// Falls through into sub_state 4
}
invalidate_sprite((rct_sprite*)peep);
sint16 delta_y = abs(peep->y - peep->destination_y);
sint16 x, y;
if (!sub_6939EB(&x, &y, peep)){
peep_decrement_num_riders(peep);
peep->state = PEEP_STATE_FIXING;
peep->sub_state = 0;
peep_window_state_update(peep);
return;
}
int z = ride->station_heights[peep->current_ride_station] * 8;
if (delta_y < 20){
z += RCT2_ADDRESS(0x0097D21C, uint8)[ride->type * 8];
}
sprite_move(x, y, z, (rct_sprite*)peep);
invalidate_sprite((rct_sprite*)peep);
}
/* rct2: 0x0069030A */
static void peep_update_walking(rct_peep* peep){
//RCT2_CALLPROC_X(0x0069030A, 0, 0, 0, 0, (int)peep, 0, 0);
@ -2118,7 +2231,7 @@ static void peep_update(rct_peep *peep)
peep_update_leaving_park(peep);
break;
case PEEP_STATE_ANSWERING:
RCT2_CALLPROC_X(0x006C0CB8, 0, 0, 0, 0, (int)peep, 0, 0);
peep_update_answering(peep);
break;
case PEEP_STATE_FIXING:
RCT2_CALLPROC_X(0x006C0E8B, stepsToTake, 0, 0, 0, (int)peep, 0, 0);

View File

@ -427,7 +427,7 @@ typedef struct {
uint8 action; // 0x71
uint8 action_frame; // 0x72
uint8 var_73;
uint16 var_74;
uint16 var_74; // time getting to ride to fix
uint8 var_76;
uint8 pad_77;
uint8 var_78;