1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 15:54:31 +01:00

Part of #13874: Replace TrackCoordinates

This commit is contained in:
frutiemax
2021-08-22 09:42:27 -04:00
parent 5c261b6d2e
commit 80418efafb
8 changed files with 41 additions and 22 deletions

View File

@@ -405,6 +405,9 @@ bool WallPlaceAction::WallCheckObstructionWithTrack(
WallSceneryEntry* wall, int32_t z0, TrackElement* trackElement, bool* wallAcrossTrack) const
{
track_type_t trackType = trackElement->GetTrackType();
using namespace OpenRCT2::TrackMetaData;
const auto& teDescriptor = GetTrackElementDescriptor(trackType);
int32_t sequence = trackElement->GetSequenceIndex();
int32_t direction = (_edge - trackElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK;
auto ride = get_ride(trackElement->GetRideIndex());
@@ -444,13 +447,13 @@ bool WallPlaceAction::WallCheckObstructionWithTrack(
if (TrackDefinitions[trackType].bank_start == 0)
{
if (!(TrackCoordinates[trackType].rotation_begin & 4))
if (!(teDescriptor.Coordinates.rotation_begin & 4))
{
direction = direction_reverse(trackElement->GetDirection());
if (direction == _edge)
{
const rct_preview_track* trackBlock = &TrackBlocks[trackType][sequence];
z = TrackCoordinates[trackType].z_begin;
z = teDescriptor.Coordinates.z_begin;
z = trackElement->base_height + ((z - trackBlock->z) * 8);
if (z == z0)
{
@@ -472,20 +475,20 @@ bool WallPlaceAction::WallCheckObstructionWithTrack(
return false;
}
direction = TrackCoordinates[trackType].rotation_end;
direction = teDescriptor.Coordinates.rotation_end;
if (direction & 4)
{
return false;
}
direction = (trackElement->GetDirection() + TrackCoordinates[trackType].rotation_end) & TILE_ELEMENT_DIRECTION_MASK;
direction = (trackElement->GetDirection() + teDescriptor.Coordinates.rotation_end) & TILE_ELEMENT_DIRECTION_MASK;
if (direction != _edge)
{
return false;
}
trackBlock = &TrackBlocks[trackType][sequence];
z = TrackCoordinates[trackType].z_end;
z = teDescriptor.Coordinates.z_end;
z = trackElement->base_height + ((z - trackBlock->z) * 8);
return z == z0;
}