mirror of https://github.com/OpenRCT2/OpenRCT2.git
parent
72be84caf8
commit
9ab1f3b5fe
|
@ -759,104 +759,23 @@ static bool footpath_disconnect_queue_from_path(const CoordsXY& footpathPos, Til
|
|||
*
|
||||
* rct2: 0x006A6D7E
|
||||
*/
|
||||
static void loc_6A6D7E(
|
||||
const CoordsXYZ& initialTileElementPos, int32_t direction, TileElement* initialTileElement, int32_t flags, bool query,
|
||||
rct_neighbour_list* neighbourList)
|
||||
|
||||
static void loc_6A6FD2(const CoordsXYZ& initialTileElementPos, int32_t direction, TileElement* initialTileElement, bool query)
|
||||
{
|
||||
auto targetPos = CoordsXY{ initialTileElementPos } + CoordsDirectionDelta[direction];
|
||||
if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && map_is_edge(targetPos))
|
||||
if ((initialTileElement)->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
if (query)
|
||||
if (!query)
|
||||
{
|
||||
neighbour_list_push(neighbourList, 7, direction, 255, 255);
|
||||
initialTileElement->AsPath()->SetEdges(initialTileElement->AsPath()->GetEdges() | (1 << direction));
|
||||
map_invalidate_element(initialTileElementPos, initialTileElement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TileElement* tileElement = map_get_first_element_at(targetPos);
|
||||
if (tileElement == nullptr)
|
||||
return;
|
||||
do
|
||||
{
|
||||
switch (tileElement->GetType())
|
||||
{
|
||||
case TILE_ELEMENT_TYPE_PATH:
|
||||
if (initialTileElementPos.z == tileElement->GetBaseZ())
|
||||
{
|
||||
if (tileElement->AsPath()->IsSloped() && tileElement->AsPath()->GetSlopeDirection() != direction)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto loc_6A6F1F;
|
||||
}
|
||||
}
|
||||
if (initialTileElementPos.z - LAND_HEIGHT_STEP == tileElement->GetBaseZ())
|
||||
{
|
||||
if (!tileElement->AsPath()->IsSloped()
|
||||
|| tileElement->AsPath()->GetSlopeDirection() != direction_reverse(direction))
|
||||
{
|
||||
return;
|
||||
}
|
||||
goto loc_6A6F1F;
|
||||
}
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_TRACK:
|
||||
if (initialTileElementPos.z == tileElement->GetBaseZ())
|
||||
{
|
||||
auto ride = get_ride(tileElement->AsTrack()->GetRideIndex());
|
||||
if (ride == nullptr || !ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto trackType = tileElement->AsTrack()->GetTrackType();
|
||||
const uint8_t trackSequence = tileElement->AsTrack()->GetSequenceIndex();
|
||||
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH))
|
||||
static void loc_6A6F1F(
|
||||
const CoordsXYZ& initialTileElementPos, int32_t direction, TileElement* tileElement, TileElement* initialTileElement,
|
||||
const CoordsXY& targetPos, int32_t flags, bool query, rct_neighbour_list* neighbourList)
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint16_t dx = direction_reverse(
|
||||
(direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK);
|
||||
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & (1 << dx)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (query)
|
||||
{
|
||||
neighbour_list_push(neighbourList, 1, direction, tileElement->AsTrack()->GetRideIndex(), 255);
|
||||
}
|
||||
goto loc_6A6FD2;
|
||||
}
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_ENTRANCE:
|
||||
if (initialTileElementPos.z == tileElement->GetBaseZ())
|
||||
{
|
||||
if (entrance_has_direction(tileElement, direction_reverse(direction - tileElement->GetDirection())))
|
||||
{
|
||||
if (query)
|
||||
{
|
||||
neighbour_list_push(
|
||||
neighbourList, 8, direction, tileElement->AsEntrance()->GetRideIndex(),
|
||||
tileElement->AsEntrance()->GetStationIndex());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
|
||||
{
|
||||
footpath_queue_chain_push(tileElement->AsEntrance()->GetRideIndex());
|
||||
}
|
||||
}
|
||||
goto loc_6A6FD2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
return;
|
||||
|
||||
loc_6A6F1F:
|
||||
if (query)
|
||||
{
|
||||
if (fence_in_the_way(
|
||||
|
@ -904,17 +823,109 @@ static void loc_6A6D7E(
|
|||
footpath_interrupt_peeps({ targetPos, tileElement->GetBaseZ() });
|
||||
}
|
||||
map_invalidate_element(targetPos, tileElement);
|
||||
loc_6A6FD2(initialTileElementPos, direction, initialTileElement, query);
|
||||
}
|
||||
|
||||
loc_6A6FD2:
|
||||
if ((initialTileElement)->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
static void loc_6A6D7E(
|
||||
const CoordsXYZ& initialTileElementPos, int32_t direction, TileElement* initialTileElement, int32_t flags, bool query,
|
||||
rct_neighbour_list* neighbourList)
|
||||
{
|
||||
if (!query)
|
||||
auto targetPos = CoordsXY{ initialTileElementPos } + CoordsDirectionDelta[direction];
|
||||
if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && map_is_edge(targetPos))
|
||||
{
|
||||
initialTileElement->AsPath()->SetEdges(initialTileElement->AsPath()->GetEdges() | (1 << direction));
|
||||
map_invalidate_element(initialTileElementPos, initialTileElement);
|
||||
if (query)
|
||||
{
|
||||
neighbour_list_push(neighbourList, 7, direction, 255, 255);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TileElement* tileElement = map_get_first_element_at(targetPos);
|
||||
if (tileElement == nullptr)
|
||||
return;
|
||||
do
|
||||
{
|
||||
switch (tileElement->GetType())
|
||||
{
|
||||
case TILE_ELEMENT_TYPE_PATH:
|
||||
if (tileElement->GetBaseZ() == initialTileElementPos.z)
|
||||
{
|
||||
if (!tileElement->AsPath()->IsSloped() || tileElement->AsPath()->GetSlopeDirection() == direction)
|
||||
{
|
||||
loc_6A6F1F(
|
||||
initialTileElementPos, direction, tileElement, initialTileElement, targetPos, flags, query,
|
||||
neighbourList);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (tileElement->GetBaseZ() == initialTileElementPos.z - LAND_HEIGHT_STEP)
|
||||
{
|
||||
if (tileElement->AsPath()->IsSloped()
|
||||
&& tileElement->AsPath()->GetSlopeDirection() == direction_reverse(direction))
|
||||
{
|
||||
loc_6A6F1F(
|
||||
initialTileElementPos, direction, tileElement, initialTileElement, targetPos, flags, query,
|
||||
neighbourList);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_TRACK:
|
||||
if (initialTileElementPos.z == tileElement->GetBaseZ())
|
||||
{
|
||||
auto ride = get_ride(tileElement->AsTrack()->GetRideIndex());
|
||||
if (ride == nullptr || !ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto trackType = tileElement->AsTrack()->GetTrackType();
|
||||
const uint8_t trackSequence = tileElement->AsTrack()->GetSequenceIndex();
|
||||
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH))
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint16_t dx = direction_reverse(
|
||||
(direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK);
|
||||
if (!(FlatRideTrackSequenceProperties[trackType][trackSequence] & (1 << dx)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (query)
|
||||
{
|
||||
neighbour_list_push(neighbourList, 1, direction, tileElement->AsTrack()->GetRideIndex(), 255);
|
||||
}
|
||||
loc_6A6FD2(initialTileElementPos, direction, initialTileElement, query);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_ENTRANCE:
|
||||
if (initialTileElementPos.z == tileElement->GetBaseZ())
|
||||
{
|
||||
if (entrance_has_direction(tileElement, direction_reverse(direction - tileElement->GetDirection())))
|
||||
{
|
||||
if (query)
|
||||
{
|
||||
neighbour_list_push(
|
||||
neighbourList, 8, direction, tileElement->AsEntrance()->GetRideIndex(),
|
||||
tileElement->AsEntrance()->GetStationIndex());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
|
||||
{
|
||||
footpath_queue_chain_push(tileElement->AsEntrance()->GetRideIndex());
|
||||
}
|
||||
}
|
||||
loc_6A6FD2(initialTileElementPos, direction, initialTileElement, query);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Change this into a simple check that validates if the direction should be fully checked with loc_6A6D7E and move the
|
||||
|
|
Loading…
Reference in New Issue