From 5d570123905e51edf935060f99a71eb0eb72941f Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Mon, 8 Jun 2020 23:47:45 -0300 Subject: [PATCH] Rename Peep::var_37 to Var37 --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 138 ++++++++++++++-------------- src/openrct2/peep/Peep.cpp | 10 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 32 +++---- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/world/Park.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 10 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index ca68e145ac..747d1de3e6 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -226,7 +226,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, destination_x); COMPARE_FIELD(Peep, destination_y); COMPARE_FIELD(Peep, destination_tolerance); - COMPARE_FIELD(Peep, var_37); + COMPARE_FIELD(Peep, Var37); COMPARE_FIELD(Peep, Energy); COMPARE_FIELD(Peep, EnergyTarget); COMPARE_FIELD(Peep, Happiness); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 62ecbef7a0..fe5374b1bb 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -1227,11 +1227,11 @@ void Guest::UpdateSitting() if (!(pathingResult & PATHING_DESTINATION_REACHED)) return; - auto loc = CoordsXYZ{ x, y, z }.ToTileStart() + CoordsXYZ{ BenchUseOffsets[var_37 & 0x7], 0 }; + auto loc = CoordsXYZ{ x, y, z }.ToTileStart() + CoordsXYZ{ BenchUseOffsets[Var37 & 0x7], 0 }; MoveTo(loc); - sprite_direction = ((var_37 + 2) & 3) * 8; + sprite_direction = ((Var37 + 2) & 3) * 8; Action = PEEP_ACTION_NONE_1; NextActionSpriteType = PEEP_ACTION_SPRITE_TYPE_SITTING_IDLE; SwitchNextActionSpriteType(); @@ -3551,7 +3551,7 @@ static void peep_update_ride_leave_entrance_maze(Guest* peep, Ride* ride, Coords direction &= 0xF; // Direction is 11, 15, 3, or 7 - peep->var_37 = direction; + peep->Var37 = direction; peep->MazeLastEdge &= 3; entrance_loc.x += _MazeEntranceStart[direction / 4].x; @@ -3574,9 +3574,9 @@ static void peep_update_ride_leave_entrance_spiral_slide(Guest* peep, Ride* ride uint8_t direction_track = (tile_element == nullptr ? 0 : tile_element->GetDirection()); - peep->var_37 = (entrance_loc.direction << 2) | (direction_track << 4); + peep->Var37 = (entrance_loc.direction << 2) | (direction_track << 4); - entrance_loc += SpiralSlideWalkingPath[peep->var_37]; + entrance_loc += SpiralSlideWalkingPath[peep->Var37]; peep->destination_x = entrance_loc.x; peep->destination_y = entrance_loc.y; @@ -3629,7 +3629,7 @@ static void peep_update_ride_leave_entrance_waypoints(Peep* peep, Ride* ride) auto ride_entry = get_ride_entry(vehicle->ride_subtype); auto vehicle_type = &ride_entry->vehicles[vehicle->vehicle_type]; - peep->var_37 = (direction_entrance | peep_get_waypointed_seat_location(peep, ride, vehicle_type, direction_track) * 4) * 4; + peep->Var37 = (direction_entrance | peep_get_waypointed_seat_location(peep, ride, vehicle_type, direction_track) * 4) * 4; if (ride->type == RIDE_TYPE_ENTERPRISE) { @@ -3637,9 +3637,9 @@ static void peep_update_ride_leave_entrance_waypoints(Peep* peep, Ride* ride) waypoint.y = vehicle->y; } - Guard::Assert(vehicle_type->peep_loading_waypoints.size() >= static_cast(peep->var_37 / 4)); - waypoint.x += vehicle_type->peep_loading_waypoints[peep->var_37 / 4][0].x; - waypoint.y += vehicle_type->peep_loading_waypoints[peep->var_37 / 4][0].y; + Guard::Assert(vehicle_type->peep_loading_waypoints.size() >= static_cast(peep->Var37 / 4)); + waypoint.x += vehicle_type->peep_loading_waypoints[peep->Var37 / 4][0].x; + waypoint.y += vehicle_type->peep_loading_waypoints[peep->Var37 / 4][0].y; peep->destination_x = waypoint.x; peep->destination_y = waypoint.y; @@ -4276,7 +4276,7 @@ void Guest::UpdateRideLeaveVehicle() rideEntry = get_ride_entry(vehicle->ride_subtype); rct_ride_entry_vehicle* vehicleEntry = &rideEntry->vehicles[vehicle->vehicle_type]; - var_37 = ((exitLocation.direction | peep_get_waypointed_seat_location(this, ride, vehicleEntry, station_direction) * 4) * 4) + Var37 = ((exitLocation.direction | peep_get_waypointed_seat_location(this, ride, vehicleEntry, station_direction) * 4) * 4) | 1; if (ride->type == RIDE_TYPE_ENTERPRISE) @@ -4285,19 +4285,19 @@ void Guest::UpdateRideLeaveVehicle() waypointLoc.y = vehicle->y; } - Guard::Assert(vehicleEntry->peep_loading_waypoints.size() >= static_cast(var_37 / 4)); + Guard::Assert(vehicleEntry->peep_loading_waypoints.size() >= static_cast(Var37 / 4)); CoordsXYZ exitWaypointLoc = waypointLoc; - exitWaypointLoc.x += vehicleEntry->peep_loading_waypoints[var_37 / 4][2].x; - exitWaypointLoc.y += vehicleEntry->peep_loading_waypoints[var_37 / 4][2].y; + exitWaypointLoc.x += vehicleEntry->peep_loading_waypoints[Var37 / 4][2].x; + exitWaypointLoc.y += vehicleEntry->peep_loading_waypoints[Var37 / 4][2].y; if (ride->type == RIDE_TYPE_MOTION_SIMULATOR) exitWaypointLoc.z += 15; MoveTo(exitWaypointLoc); - waypointLoc.x += vehicleEntry->peep_loading_waypoints[var_37 / 4][1].x; - waypointLoc.y += vehicleEntry->peep_loading_waypoints[var_37 / 4][1].y; + waypointLoc.x += vehicleEntry->peep_loading_waypoints[Var37 / 4][1].x; + waypointLoc.y += vehicleEntry->peep_loading_waypoints[Var37 / 4][1].y; destination_x = waypointLoc.x; destination_y = waypointLoc.y; @@ -4416,7 +4416,7 @@ void Guest::UpdateRideApproachVehicleWaypoints() return; int16_t xy_distance; - uint8_t waypoint = var_37 & 3; + uint8_t waypoint = Var37 & 3; if (auto loc = UpdateAction(xy_distance)) { @@ -4454,7 +4454,7 @@ void Guest::UpdateRideApproachVehicleWaypoints() waypoint++; // This is incrementing the actual peep waypoint - var_37++; + Var37++; Vehicle* vehicle = GET_VEHICLE(ride->vehicles[CurrentTrain]); @@ -4474,8 +4474,8 @@ void Guest::UpdateRideApproachVehicleWaypoints() rct_ride_entry_vehicle* vehicle_type = &ride_entry->vehicles[vehicle->vehicle_type]; Guard::Assert(waypoint < 3); - targetLoc.x += vehicle_type->peep_loading_waypoints[var_37 / 4][waypoint].x; - targetLoc.y += vehicle_type->peep_loading_waypoints[var_37 / 4][waypoint].y; + targetLoc.x += vehicle_type->peep_loading_waypoints[Var37 / 4][waypoint].x; + targetLoc.y += vehicle_type->peep_loading_waypoints[Var37 / 4][waypoint].y; destination_x = targetLoc.x; destination_y = targetLoc.y; @@ -4500,7 +4500,7 @@ void Guest::UpdateRideApproachExitWaypoints() { actionZ = ride->stations[CurrentRideStation].GetBaseZ() + 2; - if ((var_37 & 3) == 1) + if ((Var37 & 3) == 1) { if (xy_distance > 15) xy_distance = 15; @@ -4516,15 +4516,15 @@ void Guest::UpdateRideApproachExitWaypoints() return; } - if ((var_37 & 3) != 0) + if ((Var37 & 3) != 0) { - if ((var_37 & 3) == 3) + if ((Var37 & 3) == 3) { peep_update_ride_prepare_for_exit(this); return; } - var_37--; + Var37--; Vehicle* vehicle = GET_VEHICLE(ride->vehicles[CurrentTrain]); CoordsXY targetLoc = ride->stations[CurrentRideStation].Start.ToTileCentre(); @@ -4537,16 +4537,16 @@ void Guest::UpdateRideApproachExitWaypoints() rct_ride_entry* rideEntry = get_ride_entry(vehicle->ride_subtype); rct_ride_entry_vehicle* vehicleEntry = &rideEntry->vehicles[vehicle->vehicle_type]; - Guard::Assert((var_37 & 3) < 3); - targetLoc.x += vehicleEntry->peep_loading_waypoints[var_37 / 4][var_37 & 3].x; - targetLoc.y += vehicleEntry->peep_loading_waypoints[var_37 / 4][var_37 & 3].y; + Guard::Assert((Var37 & 3) < 3); + targetLoc.x += vehicleEntry->peep_loading_waypoints[Var37 / 4][Var37 & 3].x; + targetLoc.y += vehicleEntry->peep_loading_waypoints[Var37 / 4][Var37 & 3].y; destination_x = targetLoc.x; destination_y = targetLoc.y; return; } - var_37 |= 3; + Var37 |= 3; auto targetLoc = ride_get_exit_location(ride, CurrentRideStation).ToCoordsXYZD().ToTileCentre(); uint8_t exit_direction = direction_reverse(targetLoc.direction); @@ -4592,14 +4592,14 @@ void Guest::UpdateRideApproachSpiralSlide() return; } - uint8_t waypoint = var_37 & 3; + uint8_t waypoint = Var37 & 3; if (waypoint == 3) { sub_state = 15; destination_x = 0; destination_y = 0; - var_37 = (var_37 / 4) & 0xC; + Var37 = (Var37 / 4) & 0xC; MoveTo({ LOCATION_NULL, y, z }); return; } @@ -4620,11 +4620,11 @@ void Guest::UpdateRideApproachSpiralSlide() { auto exit = ride_get_exit_location(ride, CurrentRideStation); waypoint = 1; - var_37 = (exit.direction * 4) | (var_37 & 0x30) | waypoint; + Var37 = (exit.direction * 4) | (Var37 & 0x30) | waypoint; CoordsXY targetLoc = ride->stations[CurrentRideStation].Start; assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE); - targetLoc += SpiralSlideWalkingPath[var_37]; + targetLoc += SpiralSlideWalkingPath[Var37]; destination_x = targetLoc.x; destination_y = targetLoc.y; @@ -4634,12 +4634,12 @@ void Guest::UpdateRideApproachSpiralSlide() } waypoint++; // Actually increment the real peep waypoint - var_37++; + Var37++; CoordsXY targetLoc = ride->stations[CurrentRideStation].Start; assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE); - targetLoc += SpiralSlideWalkingPath[var_37]; + targetLoc += SpiralSlideWalkingPath[Var37]; destination_x = targetLoc.x; destination_y = targetLoc.y; @@ -4671,7 +4671,7 @@ void Guest::UpdateRideOnSpiralSlide() if (ride == nullptr || ride->type != RIDE_TYPE_SPIRAL_SLIDE) return; - if ((var_37 & 3) == 0) + if ((Var37 & 3) == 0) { switch (destination_x) { @@ -4695,7 +4695,7 @@ void Guest::UpdateRideOnSpiralSlide() case 3: { auto newLocation = ride->stations[CurrentRideStation].Start; - uint8_t dir = (var_37 / 4) & 3; + uint8_t dir = (Var37 / 4) & 3; // Set the location that the peep walks to go on slide again destination_x = newLocation.x + _SpiralSlideEndWaypoint[dir].x; @@ -4707,9 +4707,9 @@ void Guest::UpdateRideOnSpiralSlide() MoveTo({ newLocation, z }); - sprite_direction = (var_37 & 0xC) * 2; + sprite_direction = (Var37 & 0xC) * 2; - var_37++; + Var37++; return; } default: @@ -4724,12 +4724,12 @@ void Guest::UpdateRideOnSpiralSlide() } uint8_t waypoint = 2; - var_37 = (var_37 * 4 & 0x30) + waypoint; + Var37 = (Var37 * 4 & 0x30) + waypoint; CoordsXY targetLoc = ride->stations[CurrentRideStation].Start; assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE); - targetLoc += SpiralSlideWalkingPath[var_37]; + targetLoc += SpiralSlideWalkingPath[Var37]; destination_x = targetLoc.x; destination_y = targetLoc.y; @@ -4754,7 +4754,7 @@ void Guest::UpdateRideLeaveSpiralSlide() if (ride == nullptr) return; - uint8_t waypoint = var_37 & 3; + uint8_t waypoint = Var37 & 3; if (waypoint != 0) { @@ -4766,11 +4766,11 @@ void Guest::UpdateRideLeaveSpiralSlide() waypoint--; // Actually decrement the peep waypoint - var_37--; + Var37--; CoordsXY targetLoc = ride->stations[CurrentRideStation].Start; assert(ride->type == RIDE_TYPE_SPIRAL_SLIDE); - targetLoc += SpiralSlideWalkingPath[var_37]; + targetLoc += SpiralSlideWalkingPath[Var37]; destination_x = targetLoc.x; destination_y = targetLoc.y; @@ -4778,7 +4778,7 @@ void Guest::UpdateRideLeaveSpiralSlide() } waypoint = 3; // Actually force the final waypoint - var_37 |= 3; + Var37 |= 3; auto targetLoc = ride_get_exit_location(ride, CurrentRideStation).ToCoordsXYZD().ToTileCentre(); @@ -4829,7 +4829,7 @@ void Guest::UpdateRideMazePathfinding() if (ride == nullptr) return; - if (var_37 == 16) + if (Var37 == 16) { peep_update_ride_prepare_for_exit(this); return; @@ -4858,24 +4858,24 @@ void Guest::UpdateRideMazePathfinding() } uint16_t mazeEntry = trackElement->GetMazeEntry(); uint16_t openHedges = 0; - // var_37 is 3, 7, 11 or 15 + // Var37 is 3, 7, 11 or 15 - if (mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[var_37 / 4][3])) + if (mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[Var37 / 4][3])) { openHedges = 1; } openHedges <<= 1; - if (mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[var_37 / 4][2])) + if (mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[Var37 / 4][2])) { openHedges |= 1; } openHedges <<= 1; - if (mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[var_37 / 4][1])) + if (mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[Var37 / 4][1])) { openHedges |= 1; } openHedges <<= 1; - if (mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[var_37 / 4][0])) + if (mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[Var37 / 4][0])) { openHedges |= 1; } @@ -4941,7 +4941,7 @@ void Guest::UpdateRideMazePathfinding() destination_x = targetLoc.x; destination_y = targetLoc.y; - var_37 = _MazeGetNewDirectionFromEdge[var_37 / 4][chosenEdge]; + Var37 = _MazeGetNewDirectionFromEdge[Var37 / 4][chosenEdge]; MazeLastEdge = chosenEdge; break; case maze_type::entrance_or_exit: @@ -4957,7 +4957,7 @@ void Guest::UpdateRideMazePathfinding() } destination_x = targetLoc.x; destination_y = targetLoc.y; - var_37 = 16; + Var37 = 16; MazeLastEdge = chosenEdge; break; } @@ -5491,10 +5491,10 @@ void Guest::UpdateWalking() if (z != sprite->peep.z) continue; - if ((sprite->peep.var_37 & 0x3) != chosen_edge) + if ((sprite->peep.Var37 & 0x3) != chosen_edge) continue; - positions_free &= ~(1 << ((sprite->peep.var_37 & 0x1C) >> 2)); + positions_free &= ~(1 << ((sprite->peep.Var37 & 0x1C) >> 2)); } if (!positions_free) @@ -5507,13 +5507,13 @@ void Guest::UpdateWalking() CurrentRide = ride_to_view; CurrentSeat = ride_seat_to_view; - var_37 = chosen_edge | (chosen_position << 2); + Var37 = chosen_edge | (chosen_position << 2); SetState(PEEP_STATE_WATCHING); sub_state = 0; - int32_t destX = (x & 0xFFE0) + _WatchingPositionOffsets[var_37 & 0x1F].x; - int32_t destY = (y & 0xFFE0) + _WatchingPositionOffsets[var_37 & 0x1F].y; + int32_t destX = (x & 0xFFE0) + _WatchingPositionOffsets[Var37 & 0x1F].x; + int32_t destY = (y & 0xFFE0) + _WatchingPositionOffsets[Var37 & 0x1F].y; destination_x = destX; destination_y = destY; @@ -5659,7 +5659,7 @@ void Guest::UpdateQueuing() */ void Guest::UpdateEnteringPark() { - if (var_37 != 1) + if (Var37 != 1) { uint8_t pathingResult; PerformNextAction(pathingResult); @@ -5691,7 +5691,7 @@ void Guest::UpdateEnteringPark() */ void Guest::UpdateLeavingPark() { - if (var_37 != 0) + if (Var37 != 0) { uint8_t pathingResult; PerformNextAction(pathingResult); @@ -5712,7 +5712,7 @@ void Guest::UpdateLeavingPark() decrement_guests_in_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); context_broadcast_intent(&intent); - var_37 = 1; + Var37 = 1; window_invalidate_by_class(WC_GUEST_LIST); uint8_t pathingResult; @@ -5740,7 +5740,7 @@ void Guest::UpdateWatching() destination_x = x; destination_y = y; - sprite_direction = (var_37 & 3) * 8; + sprite_direction = (Var37 & 3) * 8; Action = PEEP_ACTION_NONE_1; NextActionSpriteType = PEEP_ACTION_SPRITE_TYPE_WATCH_RIDE; @@ -5898,7 +5898,7 @@ void Guest::UpdateUsingBin() } // Bin selection is one of 4 corners - uint8_t selected_bin = var_37 * 2; + uint8_t selected_bin = Var37 * 2; // This counts down 2 = No rubbish, 0 = full uint8_t space_left_in_bin = 0x3 & (tileElement->AsPath()->GetAdditionStatus() >> selected_bin); @@ -6077,10 +6077,10 @@ bool Guest::UpdateWalkingFindBench() if (z != sprite->peep.z) continue; - if ((sprite->peep.var_37 & 0x3) != chosen_edge) + if ((sprite->peep.Var37 & 0x3) != chosen_edge) continue; - free_edge &= ~(1 << ((sprite->peep.var_37 & 0x4) >> 2)); + free_edge &= ~(1 << ((sprite->peep.Var37 & 0x4) >> 2)); } if (!free_edge) @@ -6093,14 +6093,14 @@ bool Guest::UpdateWalkingFindBench() free_edge = 1; } - var_37 = ((free_edge & 1) << 2) | chosen_edge; + Var37 = ((free_edge & 1) << 2) | chosen_edge; SetState(PEEP_STATE_SITTING); sub_state = PEEP_SITTING_TRYING_TO_SIT; - int32_t benchX = (x & 0xFFE0) + BenchUseOffsets[var_37 & 0x7].x; - int32_t benchY = (y & 0xFFE0) + BenchUseOffsets[var_37 & 0x7].y; + int32_t benchX = (x & 0xFFE0) + BenchUseOffsets[Var37 & 0x7].x; + int32_t benchY = (y & 0xFFE0) + BenchUseOffsets[Var37 & 0x7].y; destination_x = benchX; destination_y = benchY; @@ -6178,13 +6178,13 @@ bool Guest::UpdateWalkingFindBin() return 0; } - peep->var_37 = chosen_edge; + peep->Var37 = chosen_edge; peep->SetState(PEEP_STATE_USING_BIN); peep->sub_state = PEEP_USING_BIN_WALKING_TO_BIN; - int32_t binX = (peep->x & 0xFFE0) + BinUseOffsets[peep->var_37 & 0x3].x; - int32_t binY = (peep->y & 0xFFE0) + BinUseOffsets[peep->var_37 & 0x3].y; + int32_t binX = (peep->x & 0xFFE0) + BinUseOffsets[peep->Var37 & 0x3].x; + int32_t binY = (peep->y & 0xFFE0) + BinUseOffsets[peep->Var37 & 0x3].y; peep->destination_x = binX; peep->destination_y = binY; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index e9acc8348e..2cdddc1896 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -2490,7 +2490,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl peep->MoveTo({ x, y, peep->z }); peep->SetState(PEEP_STATE_LEAVING_PARK); - peep->var_37 = 0; + peep->Var37 = 0; if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { auto ft = Formatter::Common(); @@ -2514,7 +2514,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl if (!(gParkFlags & PARK_FLAGS_PARK_OPEN)) { peep->state = PEEP_STATE_LEAVING_PARK; - peep->var_37 = 1; + peep->Var37 = 1; decrement_guests_heading_for_park(); peep_window_state_update(peep); peep_return_to_centre_of_tile(peep); @@ -2581,7 +2581,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl if (!found) { peep->state = PEEP_STATE_LEAVING_PARK; - peep->var_37 = 1; + peep->Var37 = 1; decrement_guests_heading_for_park(); peep_window_state_update(peep); peep_return_to_centre_of_tile(peep); @@ -2609,7 +2609,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl if (entranceFee > peep->CashInPocket) { peep->state = PEEP_STATE_LEAVING_PARK; - peep->var_37 = 1; + peep->Var37 = 1; decrement_guests_heading_for_park(); peep_window_state_update(peep); peep_return_to_centre_of_tile(peep); @@ -2624,7 +2624,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl gTotalAdmissions++; window_invalidate_by_number(WC_PARK_INFORMATION, 0); - peep->var_37 = 1; + peep->Var37 = 1; peep->destination_x += CoordsDirectionDelta[peep->PeepDirection].x; peep->destination_y += CoordsDirectionDelta[peep->PeepDirection].y; peep->destination_tolerance = 7; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 32ab3d5879..48b085ad98 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -614,7 +614,7 @@ struct Peep : SpriteBase uint16_t destination_x; // Location that the peep is trying to get to uint16_t destination_y; uint8_t destination_tolerance; // How close to destination before next action/state 0 = exact - uint8_t var_37; + uint8_t Var37; uint8_t Energy; uint8_t EnergyTarget; uint8_t Happiness; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 86982a657b..ea7ebc47da 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -1206,23 +1206,23 @@ void Staff::UpdateMowing() return; } - var_37++; + Var37++; - if (var_37 == 1) + if (Var37 == 1) { SwitchToSpecialSprite(2); } - if (var_37 == std::size(_MowingWaypoints)) + if (Var37 == std::size(_MowingWaypoints)) { StateReset(); return; } - destination_x = _MowingWaypoints[var_37].x + NextLoc.x; - destination_y = _MowingWaypoints[var_37].y + NextLoc.y; + destination_x = _MowingWaypoints[Var37].x + NextLoc.x; + destination_y = _MowingWaypoints[Var37].y + NextLoc.y; - if (var_37 != 7) + if (Var37 != 7) continue; auto surfaceElement = map_get_surface_element_at(NextLoc); @@ -1253,7 +1253,7 @@ void Staff::UpdateWatering() if (!(pathingResult & PATHING_DESTINATION_REACHED)) return; - sprite_direction = (var_37 & 3) << 3; + sprite_direction = (Var37 & 3) << 3; Action = PEEP_ACTION_STAFF_WATERING; ActionFrame = 0; ActionSpriteImageOffset = 0; @@ -1270,7 +1270,7 @@ void Staff::UpdateWatering() return; } - auto actionLoc = CoordsXY{ NextLoc } + CoordsDirectionDelta[var_37]; + auto actionLoc = CoordsXY{ NextLoc } + CoordsDirectionDelta[Var37]; TileElement* tile_element = map_get_first_element_at(actionLoc); if (tile_element == nullptr) @@ -1317,7 +1317,7 @@ void Staff::UpdateEmptyingBin() if (!(pathingResult & PATHING_DESTINATION_REACHED)) return; - sprite_direction = (var_37 & 3) << 3; + sprite_direction = (Var37 & 3) << 3; Action = PEEP_ACTION_STAFF_EMPTY_BIN; ActionFrame = 0; ActionSpriteImageOffset = 0; @@ -1371,7 +1371,7 @@ void Staff::UpdateEmptyingBin() return; } - uint8_t additionStatus = tile_element->AsPath()->GetAdditionStatus() | ((3 << var_37) << var_37); + uint8_t additionStatus = tile_element->AsPath()->GetAdditionStatus() | ((3 << Var37) << Var37); tile_element->AsPath()->SetAdditionStatus(additionStatus); map_invalidate_tile_zoom0({ NextLoc, tile_element->GetBaseZ(), tile_element->GetClearanceZ() }); @@ -1404,8 +1404,8 @@ void Staff::UpdateSweeping() return; } - var_37++; - if (var_37 != 2) + Var37++; + if (Var37 != 2) { Action = PEEP_ACTION_STAFF_SWEEP; ActionFrame = 0; @@ -1698,7 +1698,7 @@ static int32_t peep_update_patrolling_find_watering(Peep* peep) } peep->SetState(PEEP_STATE_WATERING); - peep->var_37 = chosen_position; + peep->Var37 = chosen_position; peep->sub_state = 0; peep->destination_x = (peep->x & 0xFFE0) + _WateringUseOffsets[chosen_position].x; @@ -1766,7 +1766,7 @@ static int32_t peep_update_patrolling_find_bin(Peep* peep) if (chosen_position == 4) return 0; - peep->var_37 = chosen_position; + peep->Var37 = chosen_position; peep->SetState(PEEP_STATE_EMPTYING_BIN); peep->sub_state = 0; @@ -1797,7 +1797,7 @@ static int32_t peep_update_patrolling_find_grass(Peep* peep) if ((surfaceElement->GetGrassLength() & 0x7) >= GRASS_LENGTH_CLEAR_1) { peep->SetState(PEEP_STATE_MOWING); - peep->var_37 = 0; + peep->Var37 = 0; // Original code used .y for both x and y. Changed to .x to make more sense (both x and y are 28) peep->destination_x = peep->NextLoc.x + _MowingWaypoints[0].x; peep->destination_y = peep->NextLoc.y + _MowingWaypoints[0].y; @@ -1832,7 +1832,7 @@ static int32_t peep_update_patrolling_find_sweeping(Peep* peep) continue; peep->SetState(PEEP_STATE_SWEEPING); - peep->var_37 = 0; + peep->Var37 = 0; peep->destination_x = sprite->litter.x; peep->destination_y = sprite->litter.y; peep->destination_tolerance = 5; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 3e12cb24b7..d0a9bfb7c4 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1421,7 +1421,7 @@ private: dst->sub_state = src->sub_state; dst->NextLoc = { src->next_x, src->next_y, src->next_z * RCT1_COORDS_Z_STEP }; dst->next_flags = src->next_flags; - dst->var_37 = src->var_37; + dst->Var37 = src->var_37; dst->TimeToConsume = src->time_to_consume; dst->StepProgress = src->step_progress; dst->VandalismSeen = src->vandalism_seen; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index dde84c1ce8..5609e70021 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1148,7 +1148,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->destination_x = src->destination_x; dst->destination_y = src->destination_y; dst->destination_tolerance = src->destination_tolerance; - dst->var_37 = src->var_37; + dst->var_37 = src->Var37; dst->energy = src->Energy; dst->energy_target = src->EnergyTarget; dst->happiness = src->Happiness; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 64929e1e0e..abc5f6610e 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1413,7 +1413,7 @@ public: dst->destination_x = src->destination_x; dst->destination_y = src->destination_y; dst->destination_tolerance = src->destination_tolerance; - dst->var_37 = src->var_37; + dst->Var37 = src->var_37; dst->Energy = src->energy; dst->EnergyTarget = src->energy_target; dst->Happiness = src->happiness; diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 4742f6f45c..1870f19e21 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -729,7 +729,7 @@ Peep* Park::GenerateGuest() peep->destination_tolerance = 5; peep->PeepDirection = direction; - peep->var_37 = 0; + peep->Var37 = 0; peep->state = PEEP_STATE_ENTERING_PARK; } } diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 232714561e..d2182dc291 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -170,7 +170,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(destination_x); COMPARE_FIELD(destination_y); COMPARE_FIELD(destination_tolerance); - COMPARE_FIELD(var_37); + COMPARE_FIELD(Var37); COMPARE_FIELD(Energy); COMPARE_FIELD(EnergyTarget); COMPARE_FIELD(Happiness);