Create Vehicle::UpdateSceneryDoorBackwards

This commit is contained in:
hdpoliveira 2020-06-19 12:51:24 -03:00
parent 64b6e2a2ee
commit 06a3f01730
2 changed files with 10 additions and 9 deletions

View File

@ -7525,13 +7525,13 @@ static void trigger_on_ride_photo(const CoordsXYZ& loc, TileElement* tileElement
* *
* rct2: 0x006DEDE8 * rct2: 0x006DEDE8
*/ */
static void vehicle_update_handle_scenery_door(Vehicle* vehicle) void Vehicle::UpdateSceneryDoorBackwards()
{ {
int32_t trackType = vehicle->GetTrackType(); int32_t trackType = GetTrackType();
const rct_preview_track* trackBlock = TrackBlocks[trackType]; const rct_preview_track* trackBlock = TrackBlocks[trackType];
const rct_track_coordinates* trackCoordinates = &TrackCoordinates[trackType]; const rct_track_coordinates* trackCoordinates = &TrackCoordinates[trackType];
auto wallCoords = CoordsXYZ{ vehicle->TrackLocation, vehicle->TrackLocation.z - trackBlock->z + trackCoordinates->z_begin }; auto wallCoords = CoordsXYZ{ TrackLocation, TrackLocation.z - trackBlock->z + trackCoordinates->z_begin };
int32_t direction = (vehicle->track_direction + trackCoordinates->rotation_begin) & 3; int32_t direction = (track_direction + trackCoordinates->rotation_begin) & 3;
direction = direction_reverse(direction); direction = direction_reverse(direction);
auto tileElement = map_get_wall_element_at(CoordsXYZD{ wallCoords, static_cast<Direction>(direction) }); auto tileElement = map_get_wall_element_at(CoordsXYZD{ wallCoords, static_cast<Direction>(direction) });
@ -7540,19 +7540,19 @@ static void vehicle_update_handle_scenery_door(Vehicle* vehicle)
return; return;
} }
if ((vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL) && (tileElement->GetAnimationFrame() == 0)) if ((next_vehicle_on_train != SPRITE_INDEX_NULL) && (tileElement->GetAnimationFrame() == 0))
{ {
tileElement->SetAnimationIsBackwards(true); tileElement->SetAnimationIsBackwards(true);
tileElement->SetAnimationFrame(1); tileElement->SetAnimationFrame(1);
map_animation_create(MAP_ANIMATION_TYPE_WALL_DOOR, wallCoords); map_animation_create(MAP_ANIMATION_TYPE_WALL_DOOR, wallCoords);
play_scenery_door_open_sound(vehicle->TrackLocation, tileElement); play_scenery_door_open_sound(TrackLocation, tileElement);
} }
if (vehicle->next_vehicle_on_train == SPRITE_INDEX_NULL) if (next_vehicle_on_train == SPRITE_INDEX_NULL)
{ {
tileElement->SetAnimationIsBackwards(true); tileElement->SetAnimationIsBackwards(true);
tileElement->SetAnimationFrame(6); tileElement->SetAnimationFrame(6);
play_scenery_door_close_sound(vehicle->TrackLocation, tileElement); play_scenery_door_close_sound(TrackLocation, tileElement);
} }
} }
@ -8118,7 +8118,7 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur
} }
} }
// Change from original: this used to check if the vehicle allowed doors. // Change from original: this used to check if the vehicle allowed doors.
vehicle_update_handle_scenery_door(this); UpdateSceneryDoorBackwards();
return true; return true;
} }

View File

@ -427,6 +427,7 @@ private:
bool UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* curRide, uint16_t* progress); bool UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* curRide, uint16_t* progress);
void UpdateGoKartAttemptSwitchLanes(); void UpdateGoKartAttemptSwitchLanes();
void UpdateSceneryDoor(); void UpdateSceneryDoor();
void UpdateSceneryDoorBackwards();
}; };
struct train_ref struct train_ref