Refactor some unnecessary Invalidate calls and call member function if available

This commit is contained in:
Matt 2019-08-15 20:16:13 +02:00
parent 2f8dccbba2
commit 66793e664a
No known key found for this signature in database
GPG Key ID: 6D4C24A61C93E208
3 changed files with 22 additions and 165 deletions

View File

@ -439,7 +439,7 @@ void Guest::GivePassingPeepsPurpleClothes(Guest* passingPeep)
{
passingPeep->tshirt_colour = COLOUR_BRIGHT_PURPLE;
passingPeep->trousers_colour = COLOUR_BRIGHT_PURPLE;
invalidate_sprite_2((rct_sprite*)passingPeep);
passingPeep->Invalidate();
}
void Guest::GivePassingPeepsPizza(Guest* passingPeep)
@ -455,15 +455,12 @@ void Guest::GivePassingPeepsPizza(Guest* passingPeep)
{
if (passingPeep->action == PEEP_ACTION_NONE_1 || passingPeep->action == PEEP_ACTION_NONE_2)
{
Invalidate();
passingPeep->action = PEEP_ACTION_WAVE_2;
passingPeep->action_frame = 0;
passingPeep->action_sprite_image_offset = 0;
passingPeep->UpdateCurrentActionSpriteType();
invalidate_sprite_2((rct_sprite*)passingPeep);
}
}
invalidate_sprite_2((rct_sprite*)passingPeep);
}
void Guest::MakePassingPeepsSick(Guest* passingPeep)
@ -479,7 +476,6 @@ void Guest::MakePassingPeepsSick(Guest* passingPeep)
passingPeep->action_frame = 0;
passingPeep->action_sprite_image_offset = 0;
passingPeep->UpdateCurrentActionSpriteType();
invalidate_sprite_2((rct_sprite*)passingPeep);
}
}
@ -525,7 +521,6 @@ void Guest::UpdateEasterEggInteractions()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
}
}
@ -1053,7 +1048,6 @@ void Guest::Tick128UpdateGuest(int32_t index)
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
invalidate_sprite_2((rct_sprite*)this);
}
}
}
@ -1236,11 +1230,9 @@ void Guest::UpdateSitting()
z,
};
Invalidate();
MoveTo(loc.x, loc.y, loc.z);
sprite_direction = ((var_37 + 2) & 3) * 8;
Invalidate();
action = PEEP_ACTION_NONE_1;
next_action_sprite_type = PEEP_ACTION_SPRITE_TYPE_SITTING_IDLE;
SwitchNextActionSpriteType();
@ -1292,7 +1284,6 @@ void Guest::UpdateSitting()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
return;
}
@ -1321,7 +1312,6 @@ void Guest::UpdateSitting()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
return;
}
}
@ -2416,7 +2406,6 @@ void Guest::ReadMap()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
}
@ -3419,7 +3408,6 @@ void Guest::UpdateBuying()
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
ride->no_primary_items_sold++;
}
@ -3486,8 +3474,6 @@ void Guest::UpdateRideAtEntrance()
// this is the state it will return to.
if (destination_tolerance != 0)
{
Invalidate();
int16_t xy_distance;
if (auto loc = UpdateAction(xy_distance))
{
@ -3498,12 +3484,12 @@ void Guest::UpdateRideAtEntrance()
actionZ = entrance.z * 8 + 2;
}
MoveTo((*loc).x, (*loc).y, actionZ);
Invalidate();
}
else
{
destination_tolerance = 0;
sprite_direction ^= (1 << 4);
Invalidate();
}
}
@ -3703,8 +3689,6 @@ void Guest::UpdateRideAdvanceThroughEntrance()
sub_state = PEEP_RIDE_FREE_VEHICLE_CHECK;
}
Invalidate();
actionZ = ride->stations[current_ride_station].Height * 8;
distanceThreshold += 4;
@ -3714,7 +3698,6 @@ void Guest::UpdateRideAdvanceThroughEntrance()
}
MoveTo((*loc).x, (*loc).y, actionZ);
Invalidate();
return;
}
@ -3823,8 +3806,7 @@ static void peep_go_to_ride_exit(Peep* peep, Ride* ride, int16_t x, int16_t y, i
{
z += RideData5[ride->type].z;
sprite_move(x, y, z, (rct_sprite*)peep);
peep->Invalidate();
peep->MoveTo(x, y, z);
Guard::Assert(peep->current_ride_station < MAX_STATIONS);
auto exit = ride_get_exit_location(ride, peep->current_ride_station);
@ -4058,9 +4040,7 @@ void Guest::UpdateRideApproachVehicle()
{
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
sub_state = PEEP_RIDE_ENTER_VEHICLE;
@ -4098,9 +4078,7 @@ void Guest::UpdateRideEnterVehicle()
ride->cur_num_customers++;
vehicle->mass += seatedPeepAsGuest->mass;
seatedPeepAsGuest->Invalidate();
sprite_move(LOCATION_NULL, 0, 0, reinterpret_cast<rct_sprite*>(seatedPeepAsGuest));
seatedPeepAsGuest->MoveTo(LOCATION_NULL, 0, 0);
seatedPeepAsGuest->SetState(PEEP_STATE_ON_RIDE);
seatedPeepAsGuest->time_on_ride = 0;
seatedPeepAsGuest->sub_state = PEEP_RIDE_ON_RIDE;
@ -4114,7 +4092,6 @@ void Guest::UpdateRideEnterVehicle()
vehicle->mass += mass;
invalidate_sprite_2(reinterpret_cast<rct_sprite*>(vehicle));
Invalidate();
MoveTo(LOCATION_NULL, 0, 0);
SetState(PEEP_STATE_ON_RIDE);
@ -4321,7 +4298,6 @@ void Guest::UpdateRideLeaveVehicle()
exitWaypointLoc.z += 15;
MoveTo(exitWaypointLoc.x, exitWaypointLoc.y, exitWaypointLoc.z);
Invalidate();
waypointLoc.x += vehicleEntry->peep_loading_waypoints[var_37 / 4][1].x;
waypointLoc.y += vehicleEntry->peep_loading_waypoints[var_37 / 4][1].y;
@ -4387,9 +4363,7 @@ void Guest::UpdateRideApproachExit()
{
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
@ -4410,21 +4384,17 @@ void Guest::UpdateRideInExit()
if (auto loc = UpdateAction(xy_distance))
{
Invalidate();
if (xy_distance >= 16)
{
int16_t actionZ = ride->stations[current_ride_station].Height * 8;
actionZ += RideData5[ride->type].z;
MoveTo((*loc).x, (*loc).y, actionZ);
Invalidate();
return;
}
SwitchToSpecialSprite(0);
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
}
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO)
@ -4475,9 +4445,7 @@ void Guest::UpdateRideApproachVehicleWaypoints()
{
actionZ = z;
}
Invalidate();
MoveTo((*loc).x, (*loc).y, actionZ);
Invalidate();
return;
}
@ -4549,9 +4517,7 @@ void Guest::UpdateRideApproachExitWaypoints()
{
actionZ = z;
}
Invalidate();
MoveTo((*loc).x, (*loc).y, actionZ);
Invalidate();
return;
}
@ -4630,9 +4596,7 @@ void Guest::UpdateRideApproachSpiralSlide()
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
@ -4761,7 +4725,6 @@ void Guest::UpdateRideOnSpiralSlide()
MoveTo(newX, newY, z);
sprite_direction = (var_37 & 0xC) * 2;
Invalidate();
var_37++;
return;
@ -4773,11 +4736,10 @@ void Guest::UpdateRideOnSpiralSlide()
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
uint8_t waypoint = 2;
var_37 = (var_37 * 4 & 0x30) + waypoint;
@ -4805,9 +4767,7 @@ void Guest::UpdateRideLeaveSpiralSlide()
// waypoint 0. Then it readies to leave the ride by the entrance.
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
@ -4887,9 +4847,7 @@ void Guest::UpdateRideMazePathfinding()
{
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
@ -4911,7 +4869,6 @@ void Guest::UpdateRideMazePathfinding()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
}
@ -5033,9 +4990,7 @@ void Guest::UpdateRideMazePathfinding()
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
}
@ -5052,9 +5007,7 @@ void Guest::UpdateRideLeaveExit()
{
if (ride != nullptr)
{
Invalidate();
MoveTo((*loc).x, (*loc).y, ride->stations[current_ride_station].Height * 8);
Invalidate();
}
return;
}
@ -5093,7 +5046,6 @@ void Guest::UpdateRideLeaveExit()
continue;
MoveTo(x, y, height);
Invalidate();
return;
} while (!(tileElement++)->IsLastForTile());
}
@ -5106,9 +5058,7 @@ void Guest::UpdateRideShopApproach()
{
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
@ -5178,9 +5128,7 @@ void Guest::UpdateRideShopLeave()
{
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
if ((x & 0xFFE0) != next_x)
return;
@ -5338,14 +5286,11 @@ void Guest::UpdateWalking()
{
if ((0xFFFF & scenario_rand()) < 936)
{
Invalidate();
action = PEEP_ACTION_WAVE_2;
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
}
}
@ -5356,14 +5301,11 @@ void Guest::UpdateWalking()
{
if ((0xFFFF & scenario_rand()) < 936)
{
Invalidate();
action = PEEP_ACTION_TAKE_PHOTO;
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
}
}
@ -5374,14 +5316,11 @@ void Guest::UpdateWalking()
{
if ((0xFFFF & scenario_rand()) < 936)
{
Invalidate();
action = PEEP_ACTION_DRAW_PICTURE;
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
}
}
@ -5469,11 +5408,8 @@ void Guest::UpdateWalking()
int32_t water_height = surfaceElement->GetWaterHeight();
if (water_height)
{
Invalidate();
water_height *= 16;
MoveTo(x, y, water_height);
Invalidate();
SetState(PEEP_STATE_FALLING);
return;
}
@ -5678,7 +5614,6 @@ void Guest::UpdateQueuing()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
if (time_in_queue >= 3500 && (0xFFFF & scenario_rand()) <= 93)
{
@ -5719,7 +5654,6 @@ void Guest::UpdateQueuing()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
break;
default:
break;
@ -5757,9 +5691,7 @@ void Guest::UpdateEnteringPark()
}
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
SetState(PEEP_STATE_FALLING);
@ -5790,9 +5722,7 @@ void Guest::UpdateLeavingPark()
if (auto loc = UpdateAction())
{
Invalidate();
MoveTo((*loc).x, (*loc).y, z);
Invalidate();
return;
}
@ -5808,7 +5738,7 @@ void Guest::UpdateLeavingPark()
PerformNextAction(pathingResult);
if (!(pathingResult & PATHING_OUTSIDE_PARK))
return;
peep_sprite_remove(this);
Remove();
}
/**
@ -5830,7 +5760,6 @@ void Guest::UpdateWatching()
destination_y = y;
sprite_direction = (var_37 & 3) * 8;
Invalidate();
action = PEEP_ACTION_NONE_1;
next_action_sprite_type = PEEP_ACTION_SPRITE_TYPE_WATCH_RIDE;
@ -5863,7 +5792,6 @@ void Guest::UpdateWatching()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
return;
}
}
@ -5874,7 +5802,6 @@ void Guest::UpdateWatching()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
return;
}
@ -5886,7 +5813,6 @@ void Guest::UpdateWatching()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
return;
}
}

View File

@ -347,7 +347,9 @@ void Peep::Invalidate()
void Peep::MoveTo(int16_t destX, int16_t destY, int16_t destZ)
{
Invalidate(); // Invalidate current position.
sprite_move(destX, destY, destZ, (rct_sprite*)this);
Invalidate(); // Invalidate new position.
}
uint8_t Peep::GetNextDirection() const
@ -641,7 +643,6 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
action_sprite_image_offset = 0;
action = PEEP_ACTION_NONE_2;
UpdateCurrentActionSpriteType();
Invalidate();
return { { x, y } };
}
action_sprite_image_offset = peepAnimation[action_sprite_type].frame_offsets[action_frame];
@ -649,7 +650,6 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
// If not throwing up and not at the frame where sick appears.
if (action != PEEP_ACTION_THROW_UP || action_frame != 15)
{
Invalidate();
return { { x, y } };
}
@ -671,7 +671,6 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
auto soundId = coughs[scenario_rand() & 3];
audio_play_sound_at_location(soundId, { x, y, z });
Invalidate();
return { { x, y } };
}
@ -732,9 +731,7 @@ void Peep::Pickup()
{
guest->RemoveFromRide();
}
Invalidate();
sprite_move(LOCATION_NULL, y, z, (rct_sprite*)this);
MoveTo(LOCATION_NULL, y, z);
SetState(PEEP_STATE_PICKED);
sub_state = 0;
}
@ -744,8 +741,7 @@ void Peep::PickupAbort(int32_t old_x)
if (state != PEEP_STATE_PICKED)
return;
sprite_move(old_x, y, z + 8, (rct_sprite*)this);
Invalidate();
MoveTo(old_x, y, z + 8);
if (x != (int16_t)LOCATION_NULL)
{
@ -797,8 +793,7 @@ bool Peep::Place(TileCoordsXYZ location, bool apply)
if (apply)
{
sprite_move(destination.x, destination.y, destination.z, (rct_sprite*)this);
Invalidate();
MoveTo(destination.x, destination.y, destination.z);
SetState(PEEP_STATE_FALLING);
action = PEEP_ACTION_NONE_2;
special_sprite = 0;
@ -933,7 +928,6 @@ void Peep::UpdateFalling()
if (height - 4 >= z && height < z + 20)
{
// Looks like we are drowning!
Invalidate();
MoveTo(x, y, height);
auto guest = AsGuest();
@ -950,7 +944,6 @@ void Peep::UpdateFalling()
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
peep_window_state_update(this);
return;
}
@ -969,7 +962,6 @@ void Peep::UpdateFalling()
// This will be null if peep is falling
if (saved_map == nullptr)
{
Invalidate();
if (z <= 1)
{
// Remove peep if it has gone to the void
@ -977,13 +969,10 @@ void Peep::UpdateFalling()
return;
}
MoveTo(x, y, z - 2);
Invalidate();
return;
}
Invalidate();
MoveTo(x, y, saved_height);
Invalidate();
next_x = x & 0xFFE0;
next_y = y & 0xFFE0;
@ -1466,7 +1455,6 @@ void peep_applause()
peep->action_frame = 0;
peep->action_sprite_image_offset = 0;
peep->UpdateCurrentActionSpriteType();
peep->Invalidate();
}
}
@ -1587,7 +1575,6 @@ void Peep::InsertNewThought(PeepThoughtType thoughtType, uint8_t thoughtArgument
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
for (int32_t i = 0; i < PEEP_MAX_THOUGHTS; ++i)
@ -1648,11 +1635,8 @@ Peep* Peep::Generate(const CoordsXYZ coords)
peep->sprite_height_negative = spriteBounds[peep->action_sprite_type].sprite_height_negative;
peep->sprite_height_positive = spriteBounds[peep->action_sprite_type].sprite_height_positive;
peep->MoveTo(coords.x, coords.y, coords.z);
peep->sprite_direction = 0;
sprite_move(coords.x, coords.y, coords.z, (rct_sprite*)peep);
peep->Invalidate();
peep->mass = (scenario_rand() & 0x1F) + 45;
peep->path_check_optimisation = 0;
peep->interaction_ride_index = RIDE_ID_NULL;
@ -2507,10 +2491,7 @@ 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_tolerance = 9;
peep->Invalidate();
sprite_move(x, y, peep->z, (rct_sprite*)peep);
peep->Invalidate();
peep->MoveTo(x, y, peep->z);
peep->SetState(PEEP_STATE_LEAVING_PARK);
peep->var_37 = 0;
@ -2649,10 +2630,7 @@ 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_tolerance = 7;
peep->Invalidate();
sprite_move(x, y, peep->z, (rct_sprite*)peep);
peep->Invalidate();
peep->MoveTo(x, y, peep->z);
}
}
@ -2671,9 +2649,7 @@ static void peep_footpath_move_forward(Peep* peep, int16_t x, int16_t y, TileEle
if (peep->type == PEEP_TYPE_STAFF)
{
peep->Invalidate();
sprite_move(x, y, z, (rct_sprite*)peep);
peep->Invalidate();
peep->MoveTo(x, y, z);
return;
}
@ -2797,9 +2773,7 @@ static void peep_footpath_move_forward(Peep* peep, int16_t x, int16_t y, TileEle
}
}
peep->Invalidate();
sprite_move(x, y, z, (rct_sprite*)peep);
peep->Invalidate();
peep->MoveTo(x, y, z);
}
/**
@ -3102,9 +3076,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result)
if ((newLoc.x & 0xFFE0) == next_x && (newLoc.y & 0xFFE0) == next_y)
{
int16_t height = GetZOnSlope(newLoc.x, newLoc.y);
Invalidate();
MoveTo(newLoc.x, newLoc.y, height);
Invalidate();
return;
}
@ -3202,9 +3174,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result)
SetNextFlags(0, false, true);
height = GetZOnSlope(newLoc.x, newLoc.y);
Invalidate();
MoveTo(newLoc.x, newLoc.y, height);
Invalidate();
return;
}
}

View File

@ -1052,14 +1052,11 @@ static int32_t staff_path_finding_entertainer(Peep* peep)
{
if (((scenario_rand() & 0xFFFF) <= 0x4000) && (peep->action == PEEP_ACTION_NONE_1 || peep->action == PEEP_ACTION_NONE_2))
{
peep->Invalidate();
peep->action = (scenario_rand() & 1) ? PEEP_ACTION_WAVE_2 : PEEP_ACTION_JOY;
peep->action_frame = 0;
peep->action_sprite_image_offset = 0;
peep->UpdateCurrentActionSpriteType();
peep->Invalidate();
staff_entertainer_update_nearby_peeps(peep);
}
@ -1176,14 +1173,12 @@ void Staff::UpdateMowing()
if (!CheckForPath())
return;
Invalidate();
while (true)
{
if (auto loc = UpdateAction())
{
int16_t checkZ = tile_element_height(*loc);
MoveTo((*loc).x, (*loc).y, checkZ);
Invalidate();
return;
}
@ -1239,7 +1234,6 @@ void Staff::UpdateWatering()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
sub_state = 1;
}
@ -1291,6 +1285,7 @@ void Staff::UpdateEmptyingBin()
{
if (!CheckForPath())
return;
uint8_t pathingResult;
PerformNextAction(pathingResult);
if (!(pathingResult & PATHING_DESTINATION_REACHED))
@ -1301,7 +1296,6 @@ void Staff::UpdateEmptyingBin()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
sub_state = 1;
}
@ -1368,8 +1362,6 @@ void Staff::UpdateSweeping()
if (!CheckForPath())
return;
Invalidate();
if (action == PEEP_ACTION_STAFF_SWEEP && action_frame == 8)
{
// Remove sick at this location
@ -1381,7 +1373,6 @@ void Staff::UpdateSweeping()
{
int16_t actionZ = GetZOnSlope((*loc).x, (*loc).y);
MoveTo((*loc).x, (*loc).y, actionZ);
Invalidate();
return;
}
@ -1392,7 +1383,6 @@ void Staff::UpdateSweeping()
action_frame = 0;
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
return;
}
StateReset();
@ -1487,8 +1477,6 @@ void Staff::UpdateHeadingToInspect()
// Falls through into sub_state 4
}
Invalidate();
int16_t delta_y = abs(y - destination_y);
if (auto loc = UpdateAction())
{
@ -1500,7 +1488,6 @@ void Staff::UpdateHeadingToInspect()
}
MoveTo((*loc).x, (*loc).y, newZ);
Invalidate();
return;
}
@ -1528,7 +1515,6 @@ void Staff::UpdateAnswering()
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
sub_state = 1;
peep_window_state_update(this);
@ -1601,8 +1587,6 @@ void Staff::UpdateAnswering()
// Falls through into sub_state 4
}
Invalidate();
int16_t delta_y = abs(y - destination_y);
if (auto loc = UpdateAction())
{
@ -1614,7 +1598,6 @@ void Staff::UpdateAnswering()
}
MoveTo((*loc).x, (*loc).y, newZ);
Invalidate();
return;
}
@ -1923,11 +1906,8 @@ void Staff::UpdatePatrolling()
int32_t water_height = surfaceElement->GetWaterHeight();
if (water_height)
{
Invalidate();
water_height *= 16;
MoveTo(x, y, water_height);
Invalidate();
SetState(PEEP_STATE_FALLING);
return;
}
@ -2218,11 +2198,9 @@ bool Staff::UpdateFixingMoveToBrokenDownVehicle(bool firstRun, Ride* ride)
destination_tolerance = 2;
}
Invalidate();
if (auto loc = UpdateAction())
{
sprite_move((*loc).x, (*loc).y, z, (rct_sprite*)this);
Invalidate();
MoveTo(loc->x, loc->y, z);
return false;
}
@ -2248,7 +2226,6 @@ bool Staff::UpdateFixingFixVehicle(bool firstRun, Ride* ride)
action_sprite_image_offset = 0;
action_frame = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
if (action == PEEP_ACTION_NONE_2)
@ -2290,7 +2267,6 @@ bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, Ride* ride)
action_frame = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
if (action == PEEP_ACTION_NONE_2)
@ -2375,12 +2351,9 @@ bool Staff::UpdateFixingMoveToStationEnd(bool firstRun, Ride* ride)
destination_tolerance = 2;
}
Invalidate();
if (auto loc = UpdateAction())
{
sprite_move((*loc).x, (*loc).y, z, (rct_sprite*)this);
Invalidate();
MoveTo(loc->x, loc->y, z);
return false;
}
@ -2403,7 +2376,6 @@ bool Staff::UpdateFixingFixStationEnd(bool firstRun)
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
if (action == PEEP_ACTION_NONE_2)
@ -2490,12 +2462,9 @@ bool Staff::UpdateFixingMoveToStationStart(bool firstRun, Ride* ride)
destination_tolerance = 2;
}
Invalidate();
if (auto loc = UpdateAction())
{
sprite_move((*loc).x, (*loc).y, z, (rct_sprite*)this);
Invalidate();
MoveTo(loc->x, loc->y, z);
return false;
}
@ -2525,7 +2494,6 @@ bool Staff::UpdateFixingFixStationStart(bool firstRun, Ride* ride)
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
if (action == PEEP_ACTION_NONE_2)
@ -2554,7 +2522,6 @@ bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride* ride)
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
if (action == PEEP_ACTION_NONE_2)
@ -2612,11 +2579,9 @@ bool Staff::UpdateFixingMoveToStationExit(bool firstRun, Ride* ride)
destination_tolerance = 2;
}
Invalidate();
if (auto loc = UpdateAction())
{
sprite_move((*loc).x, (*loc).y, z, (rct_sprite*)this);
Invalidate();
MoveTo(loc->x, loc->y, z);
return false;
}
else
@ -2655,7 +2620,6 @@ bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride* r
action_sprite_image_offset = 0;
UpdateCurrentActionSpriteType();
Invalidate();
}
if (action != PEEP_ACTION_NONE_2)
@ -2705,7 +2669,6 @@ bool Staff::UpdateFixingLeaveByEntranceExit(bool firstRun, Ride* ride)
destination_tolerance = 2;
}
Invalidate();
int16_t xy_distance;
if (auto loc = UpdateAction(xy_distance))
{
@ -2716,9 +2679,7 @@ bool Staff::UpdateFixingLeaveByEntranceExit(bool firstRun, Ride* ride)
stationHeight += RideData5[ride->type].z;
}
sprite_move((*loc).x, (*loc).y, stationHeight, (rct_sprite*)this);
Invalidate();
MoveTo(loc->x, loc->y, stationHeight);
return false;
}
SetState(PEEP_STATE_FALLING);