Rename Peep::direction to PeepDirection

This commit is contained in:
Tulio Leao 2020-06-06 11:12:11 -03:00
parent 8a50fafdc8
commit 1a3f8490ad
10 changed files with 53 additions and 53 deletions

View file

@ -3380,7 +3380,7 @@ void Guest::UpdateBuying()
sprite_direction ^= 0x10;
destination_x = NextLoc.x + 16;
destination_y = NextLoc.y + 16;
direction = direction_reverse(direction);
PeepDirection = direction_reverse(PeepDirection);
SetState(PEEP_STATE_WALKING);
return;

View file

@ -118,7 +118,7 @@ static int32_t peep_move_one_tile(Direction direction, Peep* peep)
return guest_surface_path_finding(peep);
}
peep->direction = direction;
peep->PeepDirection = direction;
peep->destination_x = newTile.x;
peep->destination_y = newTile.y;
peep->destination_tolerance = 2;
@ -415,9 +415,9 @@ static int32_t guest_path_find_aimless(Peep* peep, uint8_t edges)
if (scenario_rand() & 1)
{
// If possible go straight
if (edges & (1 << peep->direction))
if (edges & (1 << peep->PeepDirection))
{
return peep_move_one_tile(peep->direction, peep);
return peep_move_one_tile(peep->PeepDirection, peep);
}
}
@ -1496,13 +1496,13 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep)
peep->PathfindHistory[i].direction &= ~(1 << chosen_edge);
/* Also remove the edge through which the peep
* entered the junction from those left to try. */
peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->direction));
peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->PeepDirection));
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
if (gPathFindDebug)
{
log_verbose(
"Updating existing pf_history (in index: %d) for %d,%d,%d without entry edge %d & exit edge %d.", i,
loc.x, loc.y, loc.z, direction_reverse(peep->direction), chosen_edge);
loc.x, loc.y, loc.z, direction_reverse(peep->PeepDirection), chosen_edge);
}
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
return chosen_edge;
@ -1521,13 +1521,13 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep)
peep->PathfindHistory[i].direction &= ~(1 << chosen_edge);
/* Also remove the edge through which the peep
* entered the junction from those left to try. */
peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->direction));
peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->PeepDirection));
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
if (gPathFindDebug)
{
log_verbose(
"Storing new pf_history (in index: %d) for %d,%d,%d without entry edge %d & exit edge %d.", i, loc.x, loc.y,
loc.z, direction_reverse(peep->direction), chosen_edge);
loc.z, direction_reverse(peep->PeepDirection), chosen_edge);
}
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
}
@ -1935,7 +1935,7 @@ int32_t guest_path_finding(Guest* peep)
edges = adjustedEdges;
}
int32_t direction = direction_reverse(peep->direction);
int32_t direction = direction_reverse(peep->PeepDirection);
// Check if in a dead end (i.e. only edge is where the peep came from)
if (!(edges & ~(1 << direction)))
{

View file

@ -1018,7 +1018,7 @@ void Peep::Update1()
destination_x = x;
destination_y = y;
destination_tolerance = 10;
direction = sprite_direction >> 3;
PeepDirection = sprite_direction >> 3;
}
void Peep::SetState(PeepState new_state)
@ -2337,7 +2337,7 @@ static bool peep_update_queue_position(Peep* peep, uint8_t previous_action)
*/
static void peep_return_to_centre_of_tile(Peep* peep)
{
peep->direction = direction_reverse(peep->direction);
peep->PeepDirection = direction_reverse(peep->PeepDirection);
peep->destination_x = (peep->x & 0xFFE0) + 16;
peep->destination_y = (peep->y & 0xFFE0) + 16;
peep->destination_tolerance = 5;
@ -2469,9 +2469,9 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl
}
uint8_t entranceDirection = tile_element->GetDirection();
if (entranceDirection != peep->direction)
if (entranceDirection != peep->PeepDirection)
{
if (direction_reverse(entranceDirection) != peep->direction)
if (direction_reverse(entranceDirection) != peep->PeepDirection)
{
peep_return_to_centre_of_tile(peep);
return;
@ -2494,8 +2494,8 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl
}
}
peep->destination_x += CoordsDirectionDelta[peep->direction].x;
peep->destination_y += CoordsDirectionDelta[peep->direction].y;
peep->destination_x += CoordsDirectionDelta[peep->PeepDirection].x;
peep->destination_y += CoordsDirectionDelta[peep->PeepDirection].y;
peep->destination_tolerance = 9;
peep->MoveTo({ x, y, peep->z });
peep->SetState(PEEP_STATE_LEAVING_PARK);
@ -2635,8 +2635,8 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl
window_invalidate_by_number(WC_PARK_INFORMATION, 0);
peep->var_37 = 1;
peep->destination_x += CoordsDirectionDelta[peep->direction].x;
peep->destination_y += CoordsDirectionDelta[peep->direction].y;
peep->destination_x += CoordsDirectionDelta[peep->PeepDirection].x;
peep->destination_y += CoordsDirectionDelta[peep->PeepDirection].y;
peep->destination_tolerance = 7;
peep->MoveTo({ x, y, peep->z });
}
@ -2844,7 +2844,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen
if ((tile_element->AsPath()->HasQueueBanner())
&& (tile_element->AsPath()->GetQueueBannerDirection()
== direction_reverse(peep->direction)) // Ride sign is facing the direction the peep is walking
== direction_reverse(peep->PeepDirection)) // Ride sign is facing the direction the peep is walking
)
{
/* Peep is approaching the entrance of a ride queue.

View file

@ -670,7 +670,7 @@ struct Peep : SpriteBase
union
{
uint8_t maze_last_edge;
Direction direction; // Direction ?
Direction PeepDirection; // Direction ?
};
uint8_t InteractionRideIndex;
uint16_t TimeInQueue;

View file

@ -658,10 +658,10 @@ bool Staff::DoHandymanPathFinding()
}
else
{
pathDirections &= ~(1 << direction_reverse(direction));
pathDirections &= ~(1 << direction_reverse(PeepDirection));
if (pathDirections == 0)
{
pathDirections |= 1 << direction_reverse(direction);
pathDirections |= 1 << direction_reverse(PeepDirection);
}
}
@ -687,7 +687,7 @@ bool Staff::DoHandymanPathFinding()
chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection];
}
direction = newDirection;
PeepDirection = newDirection;
destination_x = chosenTile.x + 16;
destination_y = chosenTile.y + 16;
destination_tolerance = 3;
@ -781,8 +781,8 @@ static uint8_t staff_mechanic_direction_path_rand(Peep* peep, uint8_t pathDirect
{
if (scenario_rand() & 1)
{
if (pathDirections & (1 << peep->direction))
return peep->direction;
if (pathDirections & (1 << peep->PeepDirection))
return peep->PeepDirection;
}
// Modified from original to spam scenario_rand less
@ -794,7 +794,7 @@ static uint8_t staff_mechanic_direction_path_rand(Peep* peep, uint8_t pathDirect
return direction;
}
// This will never happen as pathDirections always has a bit set.
return peep->direction;
return peep->PeepDirection;
}
/**
@ -813,10 +813,10 @@ static uint8_t staff_mechanic_direction_path(Peep* peep, uint8_t validDirections
}
// Check if this is dead end - i.e. only way out is the reverse direction.
pathDirections &= ~(1 << direction_reverse(peep->direction));
pathDirections &= ~(1 << direction_reverse(peep->PeepDirection));
if (pathDirections == 0)
{
pathDirections |= (1 << direction_reverse(peep->direction));
pathDirections |= (1 << direction_reverse(peep->PeepDirection));
}
direction = bitscanforward(pathDirections);
@ -921,7 +921,7 @@ bool Staff::DoMechanicPathFinding()
chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection];
}
direction = newDirection;
PeepDirection = newDirection;
destination_x = chosenTile.x + 16;
destination_y = chosenTile.y + 16;
destination_tolerance = (scenario_rand() & 7) + 2;
@ -947,10 +947,10 @@ static uint8_t staff_direction_path(Peep* peep, uint8_t validDirections, PathEle
return staff_direction_surface(peep, scenario_rand() & 3);
}
pathDirections &= ~(1 << direction_reverse(peep->direction));
pathDirections &= ~(1 << direction_reverse(peep->PeepDirection));
if (pathDirections == 0)
{
pathDirections |= (1 << direction_reverse(peep->direction));
pathDirections |= (1 << direction_reverse(peep->PeepDirection));
}
direction = bitscanforward(pathDirections);
@ -1004,7 +1004,7 @@ bool Staff::DoMiscPathFinding()
chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection];
}
direction = newDirection;
PeepDirection = newDirection;
destination_x = chosenTile.x + 16;
destination_y = chosenTile.y + 16;
destination_tolerance = (scenario_rand() & 7) + 2;
@ -1490,15 +1490,15 @@ void Staff::UpdateHeadingToInspect()
}
}
direction = rideEntranceExitElement->GetDirection();
PeepDirection = rideEntranceExitElement->GetDirection();
int32_t destX = NextLoc.x + 16 + DirectionOffsets[direction].x * 53;
int32_t destY = NextLoc.y + 16 + DirectionOffsets[direction].y * 53;
int32_t destX = NextLoc.x + 16 + DirectionOffsets[PeepDirection].x * 53;
int32_t destY = NextLoc.y + 16 + DirectionOffsets[PeepDirection].y * 53;
destination_x = destX;
destination_y = destY;
destination_tolerance = 2;
sprite_direction = direction << 3;
sprite_direction = PeepDirection << 3;
z = rideEntranceExitElement->base_height * 4;
sub_state = 4;
@ -1601,15 +1601,15 @@ void Staff::UpdateAnswering()
}
}
direction = rideEntranceExitElement->GetDirection();
PeepDirection = rideEntranceExitElement->GetDirection();
int32_t destX = NextLoc.x + 16 + DirectionOffsets[direction].x * 53;
int32_t destY = NextLoc.y + 16 + DirectionOffsets[direction].y * 53;
int32_t destX = NextLoc.x + 16 + DirectionOffsets[PeepDirection].x * 53;
int32_t destY = NextLoc.y + 16 + DirectionOffsets[PeepDirection].y * 53;
destination_x = destX;
destination_y = destY;
destination_tolerance = 2;
sprite_direction = direction << 3;
sprite_direction = PeepDirection << 3;
z = rideEntranceExitElement->base_height * 4;
sub_state = 4;
@ -2211,7 +2211,7 @@ bool Staff::UpdateFixingMoveToBrokenDownVehicle(bool firstRun, Ride* ride)
vehicle = GET_VEHICLE(vehicle->prev_vehicle_on_ride);
}
CoordsXY offset = DirectionOffsets[direction];
CoordsXY offset = DirectionOffsets[PeepDirection];
destination_x = (offset.x * -12) + vehicle->x;
destination_y = (offset.y * -12) + vehicle->y;
destination_tolerance = 2;
@ -2239,7 +2239,7 @@ bool Staff::UpdateFixingFixVehicle(bool firstRun, Ride* ride)
{
if (!firstRun)
{
sprite_direction = direction << 3;
sprite_direction = PeepDirection << 3;
action = (scenario_rand() & 1) ? PEEP_ACTION_STAFF_FIX_2 : PEEP_ACTION_STAFF_FIX;
action_sprite_image_offset = 0;
@ -2281,7 +2281,7 @@ bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, Ride* ride)
{
if (!firstRun)
{
sprite_direction = direction << 3;
sprite_direction = PeepDirection << 3;
action = PEEP_ACTION_STAFF_FIX_3;
action_sprite_image_offset = 0;
action_frame = 0;
@ -2388,7 +2388,7 @@ bool Staff::UpdateFixingFixStationEnd(bool firstRun)
{
if (!firstRun)
{
sprite_direction = direction << 3;
sprite_direction = PeepDirection << 3;
action = PEEP_ACTION_STAFF_CHECKBOARD;
action_frame = 0;
action_sprite_image_offset = 0;
@ -2504,7 +2504,7 @@ bool Staff::UpdateFixingFixStationStart(bool firstRun, Ride* ride)
return true;
}
sprite_direction = direction << 3;
sprite_direction = PeepDirection << 3;
action = PEEP_ACTION_STAFF_FIX;
action_frame = 0;
@ -2532,7 +2532,7 @@ bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride* ride)
{
if (!firstRun)
{
sprite_direction = direction << 3;
sprite_direction = PeepDirection << 3;
action = PEEP_ACTION_STAFF_FIX_GROUND;
action_frame = 0;
@ -2585,7 +2585,7 @@ bool Staff::UpdateFixingMoveToStationExit(bool firstRun, Ride* ride)
stationPosition = stationPosition.ToTileCentre();
CoordsXY stationPlatformDirection = DirectionOffsets[direction];
CoordsXY stationPlatformDirection = DirectionOffsets[PeepDirection];
stationPosition.x += stationPlatformDirection.x * 20;
stationPosition.y += stationPlatformDirection.y * 20;
@ -2629,7 +2629,7 @@ bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride* r
StaffRidesFixed++;
window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME | RIDE_INVALIDATE_RIDE_LIST;
sprite_direction = direction << 3;
sprite_direction = PeepDirection << 3;
action = PEEP_ACTION_STAFF_ANSWER_CALL_2;
action_frame = 0;
action_sprite_image_offset = 0;
@ -2672,7 +2672,7 @@ bool Staff::UpdateFixingLeaveByEntranceExit(bool firstRun, Ride* ride)
exitPosition = exitPosition.ToTileCentre();
CoordsXY ebx_direction = DirectionOffsets[direction];
CoordsXY ebx_direction = DirectionOffsets[PeepDirection];
exitPosition.x -= ebx_direction.x * 19;
exitPosition.y -= ebx_direction.y * 19;

View file

@ -1446,7 +1446,7 @@ private:
dst->destination_x = src->destination_x;
dst->destination_y = src->destination_y;
dst->destination_tolerance = src->destination_tolerance;
dst->direction = src->direction;
dst->PeepDirection = src->direction;
dst->energy = src->energy;
dst->energy_target = src->energy_target;

View file

@ -1184,7 +1184,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dst->action_frame = src->action_frame;
dst->step_progress = src->step_progress;
dst->next_in_queue = src->next_in_queue;
dst->direction = src->direction;
dst->direction = src->PeepDirection;
dst->interaction_ride_index = src->InteractionRideIndex;
dst->time_in_queue = src->TimeInQueue;
for (size_t i = 0; i < std::size(src->RidesBeenOn); i++)

View file

@ -1449,7 +1449,7 @@ public:
dst->action_frame = src->action_frame;
dst->step_progress = src->step_progress;
dst->next_in_queue = src->next_in_queue;
dst->direction = src->direction;
dst->PeepDirection = src->direction;
dst->InteractionRideIndex = src->interaction_ride_index;
dst->TimeInQueue = src->time_in_queue;
for (size_t i = 0; i < std::size(src->rides_been_on); i++)

View file

@ -728,7 +728,7 @@ Peep* Park::GenerateGuest()
peep->destination_y = (peep->y & 0xFFE0) + 16;
peep->destination_tolerance = 5;
peep->direction = direction;
peep->PeepDirection = direction;
peep->var_37 = 0;
peep->state = PEEP_STATE_ENTERING_PARK;
}

View file

@ -94,7 +94,7 @@ protected:
// 'destination' which is a close position that they will walk towards in a straight line - in this case, one
// tile away. Stepping the peep will move them towards their destination, and once they reach it, a new
// destination will be picked, to try and get the peep towards the overall pathfinding goal.
peep->direction = moveDir;
peep->PeepDirection = moveDir;
peep->destination_x = peep->x + CoordsDirectionDelta[moveDir].x;
peep->destination_y = peep->y + CoordsDirectionDelta[moveDir].y;
peep->destination_tolerance = 2;