mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #8046 from Gymnasiast/tile-elementor-strikes-again
Port path elements to new structure, part 1
This commit is contained in:
commit
7fd0571b9c
|
@ -362,7 +362,7 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
|
|||
return info->type;
|
||||
|
||||
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
|
||||
sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
|
||||
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
|
||||
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
|
||||
{
|
||||
|
@ -506,7 +506,7 @@ static void viewport_interaction_remove_footpath_item(rct_tile_element* tileElem
|
|||
{
|
||||
int32_t type;
|
||||
|
||||
type = footpath_element_get_type(tileElement);
|
||||
type = tileElement->AsPath()->GetEntryIndex();
|
||||
if (tileElement->AsPath()->IsQueue())
|
||||
type |= 0x80;
|
||||
|
||||
|
|
|
@ -824,7 +824,7 @@ static void window_footpath_set_selection_start_bridge_at_point(int32_t screenX,
|
|||
*/
|
||||
static void window_footpath_place_path_at_point(int32_t x, int32_t y)
|
||||
{
|
||||
int32_t interactionType, presentType, selectedType, z, cost;
|
||||
int32_t interactionType, currentType, selectedType, z, cost;
|
||||
rct_tile_element* tileElement;
|
||||
|
||||
if (_footpathErrorOccured)
|
||||
|
@ -847,15 +847,18 @@ static void window_footpath_place_path_at_point(int32_t x, int32_t y)
|
|||
}
|
||||
|
||||
// Set path
|
||||
presentType = 0;
|
||||
currentType = 0;
|
||||
switch (interactionType)
|
||||
{
|
||||
case VIEWPORT_INTERACTION_ITEM_TERRAIN:
|
||||
presentType = DefaultPathSlope[tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK];
|
||||
currentType = DefaultPathSlope[tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK];
|
||||
break;
|
||||
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
|
||||
presentType = tileElement->properties.path.type
|
||||
& (FOOTPATH_PROPERTIES_FLAG_IS_SLOPED | FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK);
|
||||
currentType = tileElement->properties.path.type & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
currentType |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
z = tileElement->base_height;
|
||||
|
@ -863,7 +866,7 @@ static void window_footpath_place_path_at_point(int32_t x, int32_t y)
|
|||
|
||||
// Try and place path
|
||||
gGameCommandErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE;
|
||||
cost = footpath_place(selectedType, x, y, z, presentType, GAME_COMMAND_FLAG_APPLY);
|
||||
cost = footpath_place(selectedType, x, y, z, currentType, GAME_COMMAND_FLAG_APPLY);
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
{
|
||||
|
|
|
@ -3601,7 +3601,7 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
|
|||
{
|
||||
pathsByDir[i] = map_get_footpath_element((x >> 5) + DirOffsets[i].x, (y >> 5) + DirOffsets[i].y, z >> 3);
|
||||
|
||||
if (pathsByDir[i] && footpath_element_is_sloped(pathsByDir[i])
|
||||
if (pathsByDir[i] && (pathsByDir[i])->AsPath()->IsSloped()
|
||||
&& footpath_element_get_slope_direction(pathsByDir[i]) != i)
|
||||
{
|
||||
pathsByDir[i] = nullptr;
|
||||
|
@ -3613,7 +3613,7 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
|
|||
pathsByDir[i] = map_get_footpath_element((x >> 5) + DirOffsets[i].x, (y >> 5) + DirOffsets[i].y, (z >> 3) - 2);
|
||||
|
||||
if (pathsByDir[i]
|
||||
&& (!footpath_element_is_sloped(pathsByDir[i])
|
||||
&& (!(pathsByDir[i])->AsPath()->IsSloped()
|
||||
|| footpath_element_get_slope_direction(pathsByDir[i]) != (i ^ 2)))
|
||||
{
|
||||
pathsByDir[i] = nullptr;
|
||||
|
|
|
@ -865,8 +865,7 @@ static void window_tile_inspector_mouseup(rct_window* w, rct_widgetindex widgetI
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_PATH_CHECK_SLOPED:
|
||||
window_tile_inspector_path_set_sloped(
|
||||
windowTileInspectorSelectedIndex, !footpath_element_is_sloped(tileElement));
|
||||
window_tile_inspector_path_set_sloped(windowTileInspectorSelectedIndex, !tileElement->AsPath()->IsSloped());
|
||||
break;
|
||||
case WIDX_PATH_CHECK_EDGE_E:
|
||||
case WIDX_PATH_CHECK_EDGE_S:
|
||||
|
@ -1514,7 +1513,7 @@ static void window_tile_inspector_invalidate(rct_window* w)
|
|||
w->widgets[WIDX_PATH_CHECK_EDGE_W].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_W].top + 13;
|
||||
w->widgets[WIDX_PATH_CHECK_EDGE_NW].top = GBBT(propertiesAnchor, 2) + 7 * 1;
|
||||
w->widgets[WIDX_PATH_CHECK_EDGE_NW].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_NW].top + 13;
|
||||
widget_set_checkbox_value(w, WIDX_PATH_CHECK_SLOPED, footpath_element_is_sloped(tileElement));
|
||||
widget_set_checkbox_value(w, WIDX_PATH_CHECK_SLOPED, tileElement->AsPath()->IsSloped());
|
||||
widget_set_checkbox_value(
|
||||
w, WIDX_PATH_CHECK_EDGE_NE, tileElement->properties.path.edges & (1 << ((0 - get_current_rotation()) & 3)));
|
||||
widget_set_checkbox_value(
|
||||
|
@ -1809,13 +1808,13 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
// Details
|
||||
// Path name
|
||||
rct_string_id pathNameId = get_footpath_entry(footpath_element_get_type(tileElement))->string_idx;
|
||||
rct_string_id pathNameId = tileElement->AsPath()->GetEntry()->string_idx;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_NAME, &pathNameId, COLOUR_DARK_GREEN, x, y);
|
||||
|
||||
// Path addition
|
||||
if (footpath_element_has_path_scenery(tileElement))
|
||||
if (tileElement->AsPath()->HasAddition())
|
||||
{
|
||||
const uint8_t pathAdditionType = footpath_element_get_path_scenery_index(tileElement);
|
||||
const uint8_t pathAdditionType = tileElement->AsPath()->GetAdditionEntryIndex();
|
||||
rct_string_id additionNameId = get_footpath_item_entry(pathAdditionType)->name;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_ADDITIONS, &additionNameId, COLOUR_DARK_GREEN, x, y + 11);
|
||||
}
|
||||
|
|
|
@ -1129,7 +1129,7 @@ static void scenery_eyedropper_tool_down(int16_t x, int16_t y, rct_widgetindex w
|
|||
}
|
||||
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
|
||||
{
|
||||
int32_t entryIndex = footpath_element_get_path_scenery_index(tileElement);
|
||||
int32_t entryIndex = tileElement->AsPath()->GetAdditionEntryIndex();
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(entryIndex);
|
||||
if (sceneryEntry != nullptr)
|
||||
{
|
||||
|
@ -1454,7 +1454,7 @@ static void sub_6E1F34(
|
|||
& (FOOTPATH_PROPERTIES_FLAG_IS_SLOPED | FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK))
|
||||
<< 8;
|
||||
*parameter_2 = tile_element->base_height;
|
||||
*parameter_2 |= ((footpath_element_get_type(tile_element)) << 8);
|
||||
*parameter_2 |= (tile_element->AsPath()->GetEntryIndex() << 8);
|
||||
if (tile_element->AsPath()->IsQueue())
|
||||
{
|
||||
*parameter_2 |= LOCATION_NULL;
|
||||
|
|
|
@ -108,7 +108,7 @@ static void cheat_fix_vandalism()
|
|||
if (it.element->GetType() != TILE_ELEMENT_TYPE_PATH)
|
||||
continue;
|
||||
|
||||
if (!footpath_element_has_path_scenery(it.element))
|
||||
if (!(it.element)->AsPath()->HasAddition())
|
||||
continue;
|
||||
|
||||
it.element->flags &= ~TILE_ELEMENT_FLAG_BROKEN;
|
||||
|
@ -138,10 +138,10 @@ static void cheat_remove_litter()
|
|||
if (it.element->GetType() != TILE_ELEMENT_TYPE_PATH)
|
||||
continue;
|
||||
|
||||
if (!footpath_element_has_path_scenery(it.element))
|
||||
if (!(it.element)->AsPath()->HasAddition())
|
||||
continue;
|
||||
|
||||
sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(it.element));
|
||||
sceneryEntry = it.element->AsPath()->GetAdditionEntry();
|
||||
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN)
|
||||
it.element->properties.path.addition_status = 0xFF;
|
||||
|
||||
|
|
|
@ -136,9 +136,9 @@ void setup_in_use_selection_flags()
|
|||
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
|
||||
Editor::SetSelectedObject(OBJECT_TYPE_PATHS, type, OBJECT_SELECTION_FLAG_SELECTED);
|
||||
|
||||
if (footpath_element_has_path_scenery(iter.element))
|
||||
if (iter.element->AsPath()->HasAddition())
|
||||
{
|
||||
uint8_t path_additions = footpath_element_get_path_scenery_index(iter.element);
|
||||
uint8_t path_additions = iter.element->AsPath()->GetAdditionEntryIndex();
|
||||
Editor::SetSelectedObject(OBJECT_TYPE_PATH_BITS, path_additions, OBJECT_SELECTION_FLAG_SELECTED);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -89,7 +89,7 @@ static void path_bit_lights_paint(
|
|||
paint_session* session, rct_scenery_entry* pathBitEntry, const rct_tile_element* tileElement, int32_t height, uint8_t edges,
|
||||
uint32_t pathBitImageFlags)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
height += 8;
|
||||
|
||||
uint32_t imageId;
|
||||
|
@ -147,7 +147,7 @@ static void path_bit_bins_paint(
|
|||
paint_session* session, rct_scenery_entry* pathBitEntry, const rct_tile_element* tileElement, int32_t height, uint8_t edges,
|
||||
uint32_t pathBitImageFlags)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
height += 8;
|
||||
|
||||
uint32_t imageId;
|
||||
|
@ -323,7 +323,7 @@ static void sub_6A4101(
|
|||
if (tile_element->AsPath()->IsQueue())
|
||||
{
|
||||
uint8_t local_ebp = ebp & 0x0F;
|
||||
if (footpath_element_is_sloped(tile_element))
|
||||
if (tile_element->AsPath()->IsSloped())
|
||||
{
|
||||
switch ((footpath_element_get_slope_direction(tile_element) + session->CurrentRotation)
|
||||
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
||||
|
@ -404,15 +404,15 @@ static void sub_6A4101(
|
|||
}
|
||||
}
|
||||
|
||||
if (!footpath_element_has_queue_banner(tile_element))
|
||||
if (!tile_element->AsPath()->HasQueueBanner())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t direction = footpath_element_get_direction(tile_element);
|
||||
uint8_t direction = tile_element->AsPath()->GetQueueBannerDirection();
|
||||
// Draw ride sign
|
||||
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
|
||||
if (footpath_element_is_sloped(tile_element))
|
||||
if (tile_element->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(tile_element) == direction)
|
||||
height += 16;
|
||||
|
@ -487,7 +487,7 @@ static void sub_6A4101(
|
|||
dword_F3EF80 &= 0x0F;
|
||||
}
|
||||
|
||||
if (footpath_element_is_sloped(tile_element))
|
||||
if (tile_element->AsPath()->IsSloped())
|
||||
{
|
||||
switch ((footpath_element_get_slope_direction(tile_element) + session->CurrentRotation)
|
||||
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
||||
|
@ -682,7 +682,7 @@ static void sub_6A3F61(
|
|||
{
|
||||
if (!gTrackDesignSaveMode)
|
||||
{
|
||||
if (footpath_element_has_path_scenery(tile_element))
|
||||
if (tile_element->AsPath()->HasAddition())
|
||||
{
|
||||
session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM;
|
||||
if (sceneryImageFlags != 0)
|
||||
|
@ -691,8 +691,7 @@ static void sub_6A3F61(
|
|||
}
|
||||
|
||||
// Draw additional path bits (bins, benches, lamps, queue screens)
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(
|
||||
footpath_element_get_path_scenery_index(tile_element));
|
||||
rct_scenery_entry* sceneryEntry = tile_element->AsPath()->GetAdditionEntry();
|
||||
|
||||
if ((gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
|
||||
&& !(tile_element->flags & TILE_ELEMENT_FLAG_BROKEN)
|
||||
|
@ -739,7 +738,7 @@ static void sub_6A3F61(
|
|||
// This is about tunnel drawing
|
||||
uint8_t direction = (footpath_element_get_slope_direction(tile_element) + session->CurrentRotation)
|
||||
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
||||
bool sloped = footpath_element_is_sloped(tile_element);
|
||||
bool sloped = tile_element->AsPath()->IsSloped();
|
||||
|
||||
if (connectedEdges & EDGE_SE)
|
||||
{
|
||||
|
@ -817,7 +816,7 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
|
|||
imageFlags = SPRITE_ID_PALETTE_COLOUR_1(PALETTE_46);
|
||||
}
|
||||
|
||||
if (footpath_element_path_scenery_is_ghost(tile_element))
|
||||
if (tile_element->AsPath()->AdditionIsGhost())
|
||||
{
|
||||
sceneryImageFlags = CONSTRUCTION_MARKER;
|
||||
}
|
||||
|
@ -835,7 +834,7 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
|
|||
}
|
||||
|
||||
// Draw wide flags as ghosts, leaving only the "walkable" paths to be drawn normally
|
||||
if (gPaintWidePathsAsGhost && footpath_element_is_wide(tile_element))
|
||||
if (gPaintWidePathsAsGhost && tile_element->AsPath()->IsWide())
|
||||
{
|
||||
imageFlags &= 0x7FFFF;
|
||||
imageFlags |= CONSTRUCTION_MARKER;
|
||||
|
@ -856,7 +855,7 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
|
|||
}
|
||||
else
|
||||
{
|
||||
if (footpath_element_is_sloped(tile_element))
|
||||
if (tile_element->AsPath()->IsSloped())
|
||||
{
|
||||
// Diagonal path
|
||||
|
||||
|
@ -898,7 +897,7 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
|
|||
{
|
||||
uint32_t imageId = 2618;
|
||||
int32_t height2 = tile_element->base_height * 8;
|
||||
if (footpath_element_is_sloped(tile_element))
|
||||
if (tile_element->AsPath()->IsSloped())
|
||||
{
|
||||
imageId = 2619 + ((footpath_element_get_slope_direction(tile_element) + session->CurrentRotation) & 3);
|
||||
height2 += 16;
|
||||
|
@ -911,7 +910,7 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
|
|||
if (gCurrentViewportFlags & VIEWPORT_FLAG_PATH_HEIGHTS)
|
||||
{
|
||||
uint16_t height2 = 3 + tile_element->base_height * 8;
|
||||
if (footpath_element_is_sloped(tile_element))
|
||||
if (tile_element->AsPath()->IsSloped())
|
||||
{
|
||||
height2 += 8;
|
||||
}
|
||||
|
@ -921,8 +920,7 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
|
|||
sub_98196C(session, imageId, 16, 16, 1, 1, 0, height2);
|
||||
}
|
||||
|
||||
uint8_t pathType = footpath_element_get_type(tile_element);
|
||||
rct_footpath_entry* footpathEntry = get_footpath_entry(pathType);
|
||||
rct_footpath_entry* footpathEntry = tile_element->AsPath()->GetEntry();
|
||||
|
||||
if (footpathEntry != nullptr)
|
||||
{
|
||||
|
@ -939,9 +937,9 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
|
|||
#ifdef __ENABLE_LIGHTFX__
|
||||
if (lightfx_is_available())
|
||||
{
|
||||
if (footpath_element_has_path_scenery(tile_element) && !(tile_element->flags & TILE_ELEMENT_FLAG_BROKEN))
|
||||
if (tile_element->AsPath()->HasAddition() && !(tile_element->flags & TILE_ELEMENT_FLAG_BROKEN))
|
||||
{
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element));
|
||||
rct_scenery_entry* sceneryEntry = tile_element->AsPath()->GetAdditionEntry();
|
||||
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_LAMP)
|
||||
{
|
||||
if (!(tile_element->properties.path.edges & EDGE_NE))
|
||||
|
@ -989,7 +987,7 @@ void path_paint_box_support(
|
|||
uint16_t edi = edges | (corners << 4);
|
||||
|
||||
uint32_t imageId;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
imageId = ((footpath_element_get_slope_direction(tileElement) + session->CurrentRotation)
|
||||
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
||||
|
@ -1036,7 +1034,7 @@ void path_paint_box_support(
|
|||
else
|
||||
{
|
||||
uint32_t image_id;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
image_id = ((footpath_element_get_slope_direction(tileElement) + session->CurrentRotation)
|
||||
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
||||
|
@ -1066,7 +1064,7 @@ void path_paint_box_support(
|
|||
sub_6A3F61(session, tileElement, edi, height, footpathEntry, imageFlags, sceneryImageFlags, hasFences);
|
||||
|
||||
uint16_t ax = 0;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
ax = ((footpath_element_get_slope_direction(tileElement) + session->CurrentRotation) & 0x3) + 1;
|
||||
}
|
||||
|
@ -1081,7 +1079,7 @@ void path_paint_box_support(
|
|||
}
|
||||
|
||||
height += 32;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
height += 16;
|
||||
}
|
||||
|
@ -1143,7 +1141,7 @@ void path_paint_pole_support(
|
|||
uint16_t edi = edges | (corners << 4);
|
||||
|
||||
uint32_t imageId;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
imageId = ((footpath_element_get_slope_direction(tileElement) + session->CurrentRotation) & 3) + 16;
|
||||
}
|
||||
|
@ -1189,7 +1187,7 @@ void path_paint_pole_support(
|
|||
else
|
||||
{
|
||||
uint32_t bridgeImage;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
bridgeImage = ((footpath_element_get_slope_direction(tileElement) + session->CurrentRotation)
|
||||
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
||||
|
@ -1216,7 +1214,7 @@ void path_paint_pole_support(
|
|||
sub_6A3F61(session, tileElement, edi, height, footpathEntry, imageFlags, sceneryImageFlags, hasFences); // TODO: arguments
|
||||
|
||||
uint16_t ax = 0;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
ax = 8;
|
||||
}
|
||||
|
@ -1237,7 +1235,7 @@ void path_paint_pole_support(
|
|||
}
|
||||
|
||||
height += 32;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
height += 16;
|
||||
}
|
||||
|
|
|
@ -640,10 +640,9 @@ void rct_peep::Tick128UpdateGuest(int32_t index)
|
|||
continue;
|
||||
|
||||
// Check if the footpath has a queue line TV monitor on it
|
||||
if (footpath_element_has_path_scenery(tileElement)
|
||||
&& !footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->HasAddition() && !tileElement->AsPath()->AdditionIsGhost())
|
||||
{
|
||||
uint8_t pathSceneryIndex = footpath_element_get_path_scenery_index(tileElement);
|
||||
uint8_t pathSceneryIndex = tileElement->AsPath()->GetAdditionEntryIndex();
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(pathSceneryIndex);
|
||||
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_QUEUE_SCREEN)
|
||||
{
|
||||
|
@ -2718,15 +2717,15 @@ static uint8_t peep_assess_surroundings(int16_t centre_x, int16_t centre_y, int1
|
|||
switch (tileElement->GetType())
|
||||
{
|
||||
case TILE_ELEMENT_TYPE_PATH:
|
||||
if (!footpath_element_has_path_scenery(tileElement))
|
||||
if (!tileElement->AsPath()->HasAddition())
|
||||
break;
|
||||
|
||||
scenery = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
scenery = tileElement->AsPath()->GetAdditionEntry();
|
||||
if (scenery == nullptr)
|
||||
{
|
||||
return PEEP_THOUGHT_TYPE_NONE;
|
||||
}
|
||||
if (footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->AdditionIsGhost())
|
||||
break;
|
||||
|
||||
if (scenery->path_bit.flags
|
||||
|
@ -4914,7 +4913,7 @@ void rct_peep::UpdateRideLeaveExit()
|
|||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
|
||||
continue;
|
||||
|
||||
int16_t height = map_height_from_slope(x, y, tileElement->properties.path.type);
|
||||
int16_t height = map_height_from_slope({ x, y }, tileElement->properties.path.type, tileElement->AsPath()->IsSloped());
|
||||
height += tileElement->base_height * 8;
|
||||
|
||||
int16_t z_diff = z - height;
|
||||
|
@ -5318,11 +5317,11 @@ void rct_peep::UpdateWalking()
|
|||
|
||||
int32_t positions_free = 15;
|
||||
|
||||
if (footpath_element_has_path_scenery(tileElement))
|
||||
if (tileElement->AsPath()->HasAddition())
|
||||
{
|
||||
if (!footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (!tileElement->AsPath()->AdditionIsGhost())
|
||||
{
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
rct_scenery_entry* sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return;
|
||||
|
@ -5753,13 +5752,13 @@ void rct_peep::UpdateUsingBin()
|
|||
}
|
||||
}
|
||||
|
||||
if (!footpath_element_has_path_scenery(tileElement))
|
||||
if (!tileElement->AsPath()->HasAddition())
|
||||
{
|
||||
StateReset();
|
||||
return;
|
||||
}
|
||||
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
rct_scenery_entry* sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
|
||||
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN))
|
||||
{
|
||||
StateReset();
|
||||
|
@ -5772,7 +5771,7 @@ void rct_peep::UpdateUsingBin()
|
|||
return;
|
||||
}
|
||||
|
||||
if (footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->AdditionIsGhost())
|
||||
{
|
||||
StateReset();
|
||||
return;
|
||||
|
@ -5920,9 +5919,9 @@ bool rct_peep::UpdateWalkingFindBench()
|
|||
}
|
||||
}
|
||||
|
||||
if (!footpath_element_has_path_scenery(tileElement))
|
||||
if (!tileElement->AsPath()->HasAddition())
|
||||
return false;
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
rct_scenery_entry* sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
|
||||
|
||||
if (sceneryEntry == nullptr || !(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BENCH))
|
||||
return false;
|
||||
|
@ -5930,7 +5929,7 @@ bool rct_peep::UpdateWalkingFindBench()
|
|||
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
|
||||
return false;
|
||||
|
||||
if (footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->AdditionIsGhost())
|
||||
return false;
|
||||
|
||||
int32_t edges = (tileElement->properties.path.edges & 0xF) ^ 0xF;
|
||||
|
@ -6015,9 +6014,9 @@ bool rct_peep::UpdateWalkingFindBin()
|
|||
}
|
||||
}
|
||||
|
||||
if (!footpath_element_has_path_scenery(tileElement))
|
||||
if (!tileElement->AsPath()->HasAddition())
|
||||
return false;
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
rct_scenery_entry* sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
@ -6029,7 +6028,7 @@ bool rct_peep::UpdateWalkingFindBin()
|
|||
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
|
||||
return false;
|
||||
|
||||
if (footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->AdditionIsGhost())
|
||||
return false;
|
||||
|
||||
int32_t edges = (tileElement->properties.path.edges & 0xF) ^ 0xF;
|
||||
|
@ -6116,9 +6115,9 @@ static void peep_update_walking_break_scenery(rct_peep* peep)
|
|||
}
|
||||
}
|
||||
|
||||
if (!footpath_element_has_path_scenery(tileElement))
|
||||
if (!tileElement->AsPath()->HasAddition())
|
||||
return;
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
rct_scenery_entry* sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
|
||||
|
||||
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BREAKABLE))
|
||||
return;
|
||||
|
@ -6126,7 +6125,7 @@ static void peep_update_walking_break_scenery(rct_peep* peep)
|
|||
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
|
||||
return;
|
||||
|
||||
if (footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->AdditionIsGhost())
|
||||
return;
|
||||
|
||||
int32_t edges = tileElement->properties.path.edges & 0xF;
|
||||
|
|
|
@ -226,7 +226,7 @@ static uint8_t footpath_element_next_in_direction(TileCoordsXYZ loc, rct_tile_el
|
|||
{
|
||||
rct_tile_element* nextTileElement;
|
||||
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(tileElement) == chosenDirection)
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ static uint8_t footpath_element_next_in_direction(TileCoordsXYZ loc, rct_tile_el
|
|||
continue;
|
||||
if (!is_valid_path_z_and_direction(nextTileElement, loc.z, chosenDirection))
|
||||
continue;
|
||||
if (footpath_element_is_wide(nextTileElement))
|
||||
if (nextTileElement->AsPath()->IsWide())
|
||||
return PATH_SEARCH_WIDE;
|
||||
// Only queue tiles that are connected to a ride are returned as ride queues.
|
||||
if (nextTileElement->AsPath()->IsQueue() && nextTileElement->properties.path.ride_index != 0xFF)
|
||||
|
@ -338,7 +338,7 @@ static uint8_t footpath_element_dest_in_dir(
|
|||
case TILE_ELEMENT_TYPE_PATH:
|
||||
if (!is_valid_path_z_and_direction(tileElement, loc.z, chosenDirection))
|
||||
continue;
|
||||
if (footpath_element_is_wide(tileElement))
|
||||
if (tileElement->AsPath()->IsWide())
|
||||
return PATH_SEARCH_WIDE;
|
||||
|
||||
uint8_t edges = path_get_permitted_edges(tileElement);
|
||||
|
@ -354,7 +354,7 @@ static uint8_t footpath_element_dest_in_dir(
|
|||
if (edges != 0)
|
||||
return PATH_SEARCH_JUNCTION;
|
||||
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(tileElement) == direction)
|
||||
{
|
||||
|
@ -396,7 +396,7 @@ static uint8_t footpath_element_dest_in_dir(
|
|||
static uint8_t footpath_element_destination_in_direction(
|
||||
TileCoordsXYZ loc, rct_tile_element* inputTileElement, uint8_t chosenDirection, uint8_t* outRideIndex)
|
||||
{
|
||||
if (footpath_element_is_sloped(inputTileElement))
|
||||
if (inputTileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(inputTileElement) == chosenDirection)
|
||||
{
|
||||
|
@ -589,7 +589,7 @@ static void peep_pathfind_heuristic_search(
|
|||
uint8_t searchResult = PATH_SEARCH_FAILED;
|
||||
|
||||
bool currentElementIsWide
|
||||
= (footpath_element_is_wide(currentTileElement)
|
||||
= (currentTileElement->AsPath()->IsWide()
|
||||
&& !staff_can_ignore_wide_flag(peep, loc.x * 32, loc.y * 32, loc.z, currentTileElement));
|
||||
|
||||
loc += TileDirectionDelta[test_edge];
|
||||
|
@ -725,7 +725,7 @@ static void peep_pathfind_heuristic_search(
|
|||
// Path may be sloped, so set z to path base height.
|
||||
loc.z = tileElement->base_height;
|
||||
|
||||
if (footpath_element_is_wide(tileElement))
|
||||
if (tileElement->AsPath()->IsWide())
|
||||
{
|
||||
/* Check if staff can ignore this wide flag. */
|
||||
if (!staff_can_ignore_wide_flag(peep, loc.x * 32, loc.y * 32, loc.z, tileElement))
|
||||
|
@ -1087,7 +1087,7 @@ static void peep_pathfind_heuristic_search(
|
|||
uint8_t savedNumJunctions = _peepPathFindNumJunctions;
|
||||
|
||||
uint8_t height = loc.z;
|
||||
if (footpath_element_is_sloped(tileElement) && footpath_element_get_slope_direction(tileElement) == next_test_edge)
|
||||
if (tileElement->AsPath()->IsSloped() && footpath_element_get_slope_direction(tileElement) == next_test_edge)
|
||||
{
|
||||
height += 2;
|
||||
}
|
||||
|
@ -1353,7 +1353,7 @@ int32_t peep_pathfind_choose_direction(TileCoordsXYZ loc, rct_peep* peep)
|
|||
edges &= ~(1 << test_edge);
|
||||
uint8_t height = loc.z;
|
||||
|
||||
if (footpath_element_is_sloped(first_tile_element)
|
||||
if (first_tile_element->AsPath()->IsSloped()
|
||||
&& footpath_element_get_slope_direction(first_tile_element) == test_edge)
|
||||
{
|
||||
height += 0x2;
|
||||
|
@ -1764,7 +1764,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
|
|||
// Update the current queue end
|
||||
queueEnd = nextTile;
|
||||
// queueEnd.direction = direction;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(tileElement) == direction)
|
||||
{
|
||||
|
@ -1786,7 +1786,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
|
|||
|
||||
if (baseZ == tileElement->base_height)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(tileElement) != direction)
|
||||
{
|
||||
|
@ -1799,7 +1799,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
|
|||
|
||||
if (baseZ - 2 == tileElement->base_height)
|
||||
{
|
||||
if (!footpath_element_is_sloped(tileElement))
|
||||
if (!tileElement->AsPath()->IsSloped())
|
||||
break;
|
||||
|
||||
if (footpath_element_get_slope_direction(tileElement) != (direction ^ 2))
|
||||
|
|
|
@ -1021,7 +1021,8 @@ void rct_peep::UpdateFalling()
|
|||
// If a path check if we are on it
|
||||
if (tile_element->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
int32_t height = map_height_from_slope(x, y, tile_element->properties.path.type)
|
||||
int32_t height = map_height_from_slope(
|
||||
{ x, y }, tile_element->properties.path.type, tile_element->AsPath()->IsSloped())
|
||||
+ tile_element->base_height * 8;
|
||||
|
||||
if (height < z - 1 || height > z + 4)
|
||||
|
@ -2634,7 +2635,7 @@ static void peep_interact_with_entrance(
|
|||
if (nextTileElement->AsPath()->IsQueue())
|
||||
continue;
|
||||
|
||||
if (footpath_element_is_sloped(nextTileElement))
|
||||
if (nextTileElement->AsPath()->IsSloped())
|
||||
{
|
||||
uint8_t slopeDirection = footpath_element_get_slope_direction(nextTileElement);
|
||||
if (slopeDirection == entranceDirection)
|
||||
|
@ -2878,7 +2879,7 @@ static void peep_interact_with_path(rct_peep* peep, int16_t x, int16_t y, rct_ti
|
|||
{
|
||||
// 0x00F1AEE2
|
||||
bool vandalism_present = false;
|
||||
if (footpath_element_has_path_scenery(tile_element) && (tile_element->flags & TILE_ELEMENT_FLAG_BROKEN)
|
||||
if (tile_element->AsPath()->HasAddition() && (tile_element->flags & TILE_ELEMENT_FLAG_BROKEN)
|
||||
&& (tile_element->properties.path.edges & 0xF) != 0xF)
|
||||
{
|
||||
vandalism_present = true;
|
||||
|
@ -2926,10 +2927,10 @@ static void peep_interact_with_path(rct_peep* peep, int16_t x, int16_t y, rct_ti
|
|||
|
||||
// Peep is not queuing.
|
||||
peep->time_lost = 0;
|
||||
uint8_t stationNum = (tile_element->properties.path.additions & 0x70) >> 4;
|
||||
uint8_t stationNum = tile_element->AsPath()->GetStationIndex();
|
||||
|
||||
if ((tile_element->properties.path.type & (1 << 3)) // Queue has the ride sign on it
|
||||
&& (footpath_element_get_direction(tile_element)
|
||||
&& (tile_element->AsPath()->GetQueueBannerDirection()
|
||||
== ((peep->direction) ^ 2)) // Ride sign is facing the direction the peep is walking
|
||||
)
|
||||
{
|
||||
|
@ -3093,7 +3094,7 @@ static bool peep_interact_with_shop(rct_peep* peep, int16_t x, int16_t y, rct_ti
|
|||
|
||||
bool is_valid_path_z_and_direction(rct_tile_element* tileElement, int32_t currentZ, int32_t currentDirection)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
int32_t slopeDirection = footpath_element_get_slope_direction(tileElement);
|
||||
if (slopeDirection == currentDirection)
|
||||
|
@ -3457,8 +3458,7 @@ int32_t rct_peep::GetZOnSlope(int32_t tile_x, int32_t tile_y)
|
|||
|
||||
int32_t height = next_z * 8;
|
||||
uint8_t slope = GetNextDirection();
|
||||
slope |= GetNextIsSloped() ? (1 << 2) : 0;
|
||||
return height + map_height_from_slope(tile_x, tile_y, slope);
|
||||
return height + map_height_from_slope({ tile_x, tile_y }, slope, GetNextIsSloped());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -707,7 +707,7 @@ bool staff_can_ignore_wide_flag(rct_peep* staff, int32_t x, int32_t y, uint8_t z
|
|||
continue;
|
||||
}
|
||||
|
||||
if (footpath_element_is_sloped(path))
|
||||
if (path->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(path) == adjac_dir)
|
||||
{
|
||||
|
@ -737,7 +737,7 @@ bool staff_can_ignore_wide_flag(rct_peep* staff, int32_t x, int32_t y, uint8_t z
|
|||
pathcount++;
|
||||
}
|
||||
|
||||
if (footpath_element_is_wide(test_element))
|
||||
if (test_element->AsPath()->IsWide())
|
||||
{
|
||||
if (!widefound)
|
||||
{
|
||||
|
@ -1810,15 +1810,15 @@ void rct_peep::UpdateEmptyingBin()
|
|||
}
|
||||
}
|
||||
|
||||
if (!footpath_element_has_path_scenery(tile_element))
|
||||
if (!tile_element->AsPath()->HasAddition())
|
||||
{
|
||||
StateReset();
|
||||
return;
|
||||
}
|
||||
|
||||
rct_scenery_entry* scenery_entry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element));
|
||||
rct_scenery_entry* scenery_entry = tile_element->AsPath()->GetAdditionEntry();
|
||||
if (!(scenery_entry->path_bit.flags & PATH_BIT_FLAG_IS_BIN) || tile_element->flags & (1 << 5)
|
||||
|| footpath_element_path_scenery_is_ghost(tile_element))
|
||||
|| tile_element->AsPath()->AdditionIsGhost())
|
||||
{
|
||||
StateReset();
|
||||
return;
|
||||
|
@ -2210,9 +2210,9 @@ static int32_t peep_update_patrolling_find_bin(rct_peep* peep)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!footpath_element_has_path_scenery(tileElement))
|
||||
if (!tileElement->AsPath()->HasAddition())
|
||||
return 0;
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
rct_scenery_entry* sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
|
||||
|
||||
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN))
|
||||
return 0;
|
||||
|
@ -2220,7 +2220,7 @@ static int32_t peep_update_patrolling_find_bin(rct_peep* peep)
|
|||
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
|
||||
return 0;
|
||||
|
||||
if (footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->AdditionIsGhost())
|
||||
return 0;
|
||||
|
||||
uint8_t bin_positions = tileElement->properties.path.edges & 0xF;
|
||||
|
|
|
@ -479,7 +479,7 @@ private:
|
|||
case TILE_ELEMENT_TYPE_PATH:
|
||||
{
|
||||
uint8_t pathType = tileElement->AsPath()->GetRCT1PathType();
|
||||
uint8_t pathAdditionsType = tileElement->properties.path.additions & 0x0F;
|
||||
uint8_t pathAdditionsType = tileElement->AsPath()->GetAddition();
|
||||
|
||||
AddEntryForPath(pathType);
|
||||
AddEntryForPathAddition(pathAdditionsType);
|
||||
|
@ -2505,16 +2505,16 @@ private:
|
|||
tileElement->SetDirection(0);
|
||||
tileElement->flags &= ~(TILE_ELEMENT_FLAG_BROKEN | TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE);
|
||||
|
||||
footpath_element_set_type(tileElement, entryIndex);
|
||||
tileElement->AsPath()->SetEntryIndex(entryIndex);
|
||||
if (RCT1::PathIsQueue(pathType))
|
||||
{
|
||||
tileElement->AsPath()->SetIsQueue(true);
|
||||
}
|
||||
|
||||
footpath_scenery_set_is_ghost(tileElement, false);
|
||||
tileElement->AsPath()->SetAdditionIsGhost(false);
|
||||
|
||||
// Additions
|
||||
uint8_t additionType = footpath_element_get_path_scenery(tileElement);
|
||||
uint8_t additionType = tileElement->AsPath()->GetAddition();
|
||||
if (additionType != RCT1_PATH_ADDITION_NONE)
|
||||
{
|
||||
uint8_t normalisedType = RCT1::NormalisePathAddition(additionType);
|
||||
|
@ -2523,7 +2523,7 @@ private:
|
|||
{
|
||||
tileElement->flags |= TILE_ELEMENT_FLAG_BROKEN;
|
||||
}
|
||||
footpath_element_set_path_scenery(tileElement, entryIndex + 1);
|
||||
tileElement->AsPath()->SetAddition(entryIndex + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2881,7 +2881,7 @@ void load_from_sc4(const utf8* path)
|
|||
uint8_t PathElement::GetRCT1PathType() const
|
||||
{
|
||||
uint8_t pathColour = type & 3;
|
||||
uint8_t pathType2 = (pathType & FOOTPATH_PROPERTIES_TYPE_MASK) >> 2;
|
||||
uint8_t pathType2 = (entryIndex & FOOTPATH_PROPERTIES_TYPE_MASK) >> 2;
|
||||
|
||||
pathType2 = pathType2 | pathColour;
|
||||
return pathType2;
|
||||
|
|
|
@ -568,7 +568,7 @@ static void ride_ratings_score_close_proximity(rct_tile_element* inputTileElemen
|
|||
break;
|
||||
case TILE_ELEMENT_TYPE_PATH:
|
||||
// Bonus for normal path
|
||||
if (footpath_element_get_type(tileElement) != 0)
|
||||
if (tileElement->AsPath()->GetEntryIndex() != 0)
|
||||
{
|
||||
if (tileElement->clearance_height == inputTileElement->base_height)
|
||||
{
|
||||
|
|
|
@ -375,8 +375,9 @@ static void track_design_save_add_footpath(int32_t x, int32_t y, rct_tile_elemen
|
|||
|
||||
uint8_t flags = 0;
|
||||
flags |= tileElement->properties.path.edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
|
||||
flags |= (tileElement->properties.path.type & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) << 2;
|
||||
flags |= (tileElement->properties.path.type & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK) << 5;
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
flags |= 0b00010000;
|
||||
if (tileElement->AsPath()->IsQueue())
|
||||
flags |= 1 << 7;
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ static rct_tile_element* map_get_footpath_element_slope(int32_t x, int32_t y, in
|
|||
|
||||
static void loc_6A6620(int32_t flags, int32_t x, int32_t y, rct_tile_element* tileElement)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement) && !(flags & GAME_COMMAND_FLAG_GHOST))
|
||||
if (tileElement->AsPath()->IsSloped() && !(flags & GAME_COMMAND_FLAG_GHOST))
|
||||
{
|
||||
int32_t direction = footpath_element_get_slope_direction(tileElement);
|
||||
int32_t z = tileElement->base_height;
|
||||
|
@ -267,11 +267,11 @@ static money32 footpath_element_insert(
|
|||
assert(tileElement != nullptr);
|
||||
tileElement->type = TILE_ELEMENT_TYPE_PATH;
|
||||
tileElement->clearance_height = z + 4 + ((slope & TILE_ELEMENT_SLOPE_NE_SIDE_UP) ? 2 : 0);
|
||||
footpath_element_set_type(tileElement, type);
|
||||
tileElement->AsPath()->SetEntryIndex(type);
|
||||
tileElement->properties.path.type |= (slope & TILE_ELEMENT_SLOPE_W_CORNER_DN);
|
||||
if (type & FOOTPATH_ELEMENT_INSERT_QUEUE)
|
||||
tileElement->AsPath()->SetIsQueue(true);
|
||||
tileElement->properties.path.additions = pathItemType;
|
||||
tileElement->AsPath()->SetAddition(pathItemType);
|
||||
tileElement->properties.path.addition_status = 255;
|
||||
tileElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN;
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
|
@ -302,13 +302,13 @@ static money32 footpath_element_update(
|
|||
const int32_t newFootpathType = (type & (FOOTPATH_PROPERTIES_TYPE_MASK >> 4));
|
||||
const bool newPathIsQueue = ((type >> 7) == 1);
|
||||
|
||||
if (footpath_element_get_type(tileElement) != newFootpathType || tileElement->AsPath()->IsQueue() != newPathIsQueue)
|
||||
if (tileElement->AsPath()->GetEntryIndex() != newFootpathType || tileElement->AsPath()->IsQueue() != newPathIsQueue)
|
||||
{
|
||||
gFootpathPrice += MONEY(6, 00);
|
||||
}
|
||||
else if (pathItemType != 0)
|
||||
{
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST) && footpath_element_get_path_scenery(tileElement) == pathItemType
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST) && tileElement->AsPath()->GetAddition() == pathItemType
|
||||
&& !(tileElement->flags & TILE_ELEMENT_FLAG_BROKEN))
|
||||
{
|
||||
if (flags & GAME_COMMAND_FLAG_4)
|
||||
|
@ -322,7 +322,7 @@ static money32 footpath_element_update(
|
|||
rct_scenery_entry* scenery_entry = get_footpath_item_entry(pathItemType - 1);
|
||||
uint16_t unk6 = scenery_entry->path_bit.flags;
|
||||
|
||||
if ((unk6 & PATH_BIT_FLAG_DONT_ALLOW_ON_SLOPE) && footpath_element_is_sloped(tileElement))
|
||||
if ((unk6 & PATH_BIT_FLAG_DONT_ALLOW_ON_SLOPE) && tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
gGameCommandErrorText = STR_CANT_BUILD_THIS_ON_SLOPED_FOOTPATH;
|
||||
return MONEY32_UNDEFINED;
|
||||
|
@ -357,7 +357,7 @@ static money32 footpath_element_update(
|
|||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
{
|
||||
// Check if there is something on the path already
|
||||
if (footpath_element_has_path_scenery(tileElement))
|
||||
if (tileElement->AsPath()->HasAddition())
|
||||
{
|
||||
gGameCommandErrorText = STR_NONE;
|
||||
return MONEY32_UNDEFINED;
|
||||
|
@ -365,19 +365,19 @@ static money32 footpath_element_update(
|
|||
|
||||
// There is nothing yet - check if we should place a ghost
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
footpath_scenery_set_is_ghost(tileElement, true);
|
||||
tileElement->AsPath()->SetAdditionIsGhost(true);
|
||||
}
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY))
|
||||
return gParkFlags & PARK_FLAGS_NO_MONEY ? 0 : gFootpathPrice;
|
||||
|
||||
if ((pathItemType != 0 && !(flags & GAME_COMMAND_FLAG_GHOST))
|
||||
|| (pathItemType == 0 && footpath_element_path_scenery_is_ghost(tileElement)))
|
||||
|| (pathItemType == 0 && tileElement->AsPath()->AdditionIsGhost()))
|
||||
{
|
||||
footpath_scenery_set_is_ghost(tileElement, false);
|
||||
tileElement->AsPath()->SetAdditionIsGhost(false);
|
||||
}
|
||||
|
||||
footpath_element_set_path_scenery(tileElement, pathItemType);
|
||||
tileElement->AsPath()->SetAddition(pathItemType);
|
||||
tileElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN;
|
||||
if (pathItemType != 0)
|
||||
{
|
||||
|
@ -401,10 +401,10 @@ static money32 footpath_element_update(
|
|||
if (!(flags & GAME_COMMAND_FLAG_PATH_SCENERY))
|
||||
footpath_remove_edges_at(x, y, tileElement);
|
||||
|
||||
footpath_element_set_type(tileElement, type);
|
||||
tileElement->AsPath()->SetEntryIndex(type);
|
||||
|
||||
tileElement->type = (tileElement->type & 0xFE) | (type >> 7);
|
||||
footpath_element_set_path_scenery(tileElement, pathItemType);
|
||||
tileElement->AsPath()->SetAddition(pathItemType);
|
||||
tileElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN;
|
||||
|
||||
loc_6A6620(flags, x, y, tileElement);
|
||||
|
@ -650,7 +650,7 @@ static money32 footpath_place_from_track(
|
|||
tileElement->clearance_height = z + 4 + ((slope & TILE_ELEMENT_SLOPE_S_CORNER_UP) ? 2 : 0);
|
||||
tileElement->properties.path.type = (type << 4) | (slope & TILE_ELEMENT_SLOPE_W_CORNER_DN);
|
||||
tileElement->type |= type >> 7;
|
||||
tileElement->properties.path.additions = 0;
|
||||
tileElement->AsPath()->SetAddition(0);
|
||||
tileElement->properties.path.addition_status = 255;
|
||||
tileElement->properties.path.edges = edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
|
||||
tileElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN;
|
||||
|
@ -846,7 +846,7 @@ void footpath_get_coordinates_from_pos(
|
|||
if (interactionType == VIEWPORT_INTERACTION_ITEM_FOOTPATH)
|
||||
{
|
||||
z = myTileElement->base_height * 8;
|
||||
if (footpath_element_is_sloped(myTileElement))
|
||||
if (myTileElement->AsPath()->IsSloped())
|
||||
{
|
||||
z += 8;
|
||||
}
|
||||
|
@ -1083,7 +1083,7 @@ static void footpath_connect_corners(int32_t initialX, int32_t initialY, rct_til
|
|||
|
||||
if (initialTileElement->AsPath()->IsQueue())
|
||||
return;
|
||||
if (footpath_element_is_sloped(initialTileElement))
|
||||
if (initialTileElement->AsPath()->IsSloped())
|
||||
return;
|
||||
|
||||
tileElement[0] = initialTileElement;
|
||||
|
@ -1229,7 +1229,7 @@ static rct_tile_element* footpath_get_element(int32_t x, int32_t y, int32_t z0,
|
|||
|
||||
if (z1 == tileElement->base_height)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
slope = footpath_element_get_slope_direction(tileElement);
|
||||
if (slope != direction)
|
||||
|
@ -1239,7 +1239,7 @@ static rct_tile_element* footpath_get_element(int32_t x, int32_t y, int32_t z0,
|
|||
}
|
||||
if (z0 == tileElement->base_height)
|
||||
{
|
||||
if (!footpath_element_is_sloped(tileElement))
|
||||
if (!tileElement->AsPath()->IsSloped())
|
||||
break;
|
||||
|
||||
slope = footpath_element_get_slope_direction(tileElement) ^ 2;
|
||||
|
@ -1291,7 +1291,7 @@ static bool footpath_disconnect_queue_from_path(int32_t x, int32_t y, rct_tile_e
|
|||
if (!tileElement->AsPath()->IsQueue())
|
||||
return false;
|
||||
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
return false;
|
||||
|
||||
uint8_t c = connected_path_count[tileElement->properties.path.edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK];
|
||||
|
@ -1343,8 +1343,7 @@ static void loc_6A6D7E(
|
|||
case TILE_ELEMENT_TYPE_PATH:
|
||||
if (z == tileElement->base_height)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement)
|
||||
&& footpath_element_get_slope_direction(tileElement) != direction)
|
||||
if (tileElement->AsPath()->IsSloped() && footpath_element_get_slope_direction(tileElement) != direction)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1355,7 +1354,7 @@ static void loc_6A6D7E(
|
|||
}
|
||||
if (z - 2 == tileElement->base_height)
|
||||
{
|
||||
if (!footpath_element_is_sloped(tileElement)
|
||||
if (!tileElement->AsPath()->IsSloped()
|
||||
|| footpath_element_get_slope_direction(tileElement) != (direction ^ 2))
|
||||
{
|
||||
return;
|
||||
|
@ -1514,7 +1513,7 @@ static void loc_6A6C85(
|
|||
int32_t z = tileElement->base_height;
|
||||
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if ((footpath_element_get_slope_direction(tileElement) - direction) & 1)
|
||||
{
|
||||
|
@ -1612,7 +1611,7 @@ void footpath_chain_ride_queue(
|
|||
lastPathX = x;
|
||||
lastPathY = y;
|
||||
lastPathDirection = direction;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(tileElement) == direction)
|
||||
{
|
||||
|
@ -1632,7 +1631,7 @@ void footpath_chain_ride_queue(
|
|||
continue;
|
||||
if (tileElement->base_height == z)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if (footpath_element_get_slope_direction(tileElement) != direction)
|
||||
break;
|
||||
|
@ -1641,7 +1640,7 @@ void footpath_chain_ride_queue(
|
|||
}
|
||||
if (tileElement->base_height == z - 2)
|
||||
{
|
||||
if (!footpath_element_is_sloped(tileElement))
|
||||
if (!tileElement->AsPath()->IsSloped())
|
||||
break;
|
||||
|
||||
if ((footpath_element_get_slope_direction(tileElement) ^ 2) != direction)
|
||||
|
@ -1672,8 +1671,7 @@ void footpath_chain_ride_queue(
|
|||
tileElement->properties.path.type &= ~FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
|
||||
tileElement->properties.path.edges |= (1 << (direction ^ 2));
|
||||
tileElement->properties.path.ride_index = rideIndex;
|
||||
tileElement->properties.path.additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK;
|
||||
tileElement->properties.path.additions |= (entranceIndex << 4) & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK;
|
||||
tileElement->AsPath()->SetStationIndex(entranceIndex);
|
||||
|
||||
map_invalidate_element(x, y, tileElement);
|
||||
|
||||
|
@ -1701,8 +1699,7 @@ void footpath_chain_ride_queue(
|
|||
if (lastPathElement->AsPath()->IsQueue())
|
||||
{
|
||||
lastPathElement->properties.path.type |= FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
|
||||
lastPathElement->type &= 0x3F; // Clear the ride sign direction
|
||||
footpath_element_set_direction(lastPathElement, lastPathDirection); // set the ride sign direction
|
||||
lastPathElement->AsPath()->SetQueueBannerDirection(lastPathDirection); // set the ride sign direction
|
||||
|
||||
map_animation_create(MAP_ANIMATION_TYPE_QUEUE_BANNER, lastPathX, lastPathY, lastPathElement->base_height);
|
||||
}
|
||||
|
@ -1843,7 +1840,7 @@ static int32_t footpath_is_connected_to_map_edge_recurse(
|
|||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
|
||||
continue;
|
||||
|
||||
if (footpath_element_is_sloped(tileElement)
|
||||
if (tileElement->AsPath()->IsSloped()
|
||||
&& (slopeDirection = footpath_element_get_slope_direction(tileElement)) != direction)
|
||||
{
|
||||
if ((slopeDirection ^ 2) != direction)
|
||||
|
@ -1914,7 +1911,7 @@ searchFromFootpath:
|
|||
if (edges == 0)
|
||||
{
|
||||
// Only possible direction to go
|
||||
if (footpath_element_is_sloped(tileElement) && footpath_element_get_slope_direction(tileElement) == direction)
|
||||
if (tileElement->AsPath()->IsSloped() && footpath_element_get_slope_direction(tileElement) == direction)
|
||||
{
|
||||
z += 2;
|
||||
}
|
||||
|
@ -1937,7 +1934,7 @@ searchFromFootpath:
|
|||
do
|
||||
{
|
||||
edges &= ~(1 << direction);
|
||||
if (footpath_element_is_sloped(tileElement) && footpath_element_get_slope_direction(tileElement) == direction)
|
||||
if (tileElement->AsPath()->IsSloped() && footpath_element_get_slope_direction(tileElement) == direction)
|
||||
{
|
||||
z += 2;
|
||||
}
|
||||
|
@ -1958,16 +1955,16 @@ int32_t footpath_is_connected_to_map_edge(int32_t x, int32_t y, int32_t z, int32
|
|||
return footpath_is_connected_to_map_edge_recurse(x, y, z, direction, flags, 0, 0, 16);
|
||||
}
|
||||
|
||||
bool footpath_element_is_sloped(const rct_tile_element* tileElement)
|
||||
bool PathElement::IsSloped() const
|
||||
{
|
||||
return (tileElement->properties.path.type & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) != 0;
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED) != 0;
|
||||
}
|
||||
|
||||
void footpath_element_set_sloped(rct_tile_element* tileElement, bool isSloped)
|
||||
void PathElement::SetSloped(bool isSloped)
|
||||
{
|
||||
tileElement->properties.path.type &= ~FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
if (isSloped)
|
||||
tileElement->properties.path.type |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
entryIndex |= FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
|
||||
}
|
||||
|
||||
uint8_t footpath_element_get_slope_direction(const rct_tile_element* tileElement)
|
||||
|
@ -1987,78 +1984,97 @@ void PathElement::SetIsQueue(bool isQueue)
|
|||
type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_QUEUE;
|
||||
}
|
||||
|
||||
bool footpath_element_has_queue_banner(const rct_tile_element* tileElement)
|
||||
bool PathElement::HasQueueBanner() const
|
||||
{
|
||||
return (tileElement->properties.path.type & FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER) != 0;
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER) != 0;
|
||||
}
|
||||
|
||||
bool footpath_element_is_wide(const rct_tile_element* tileElement)
|
||||
uint8_t PathElement::GetStationIndex() const
|
||||
{
|
||||
return (tileElement->type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE) != 0;
|
||||
return (additions & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK) >> 4;
|
||||
}
|
||||
|
||||
void footpath_element_set_wide(rct_tile_element* tileElement, bool isWide)
|
||||
void PathElement::SetStationIndex(uint8_t newStationIndex)
|
||||
{
|
||||
tileElement->type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
|
||||
additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK;
|
||||
additions |= ((newStationIndex << 4) & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK);
|
||||
}
|
||||
|
||||
bool PathElement::IsWide() const
|
||||
{
|
||||
return (type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE) != 0;
|
||||
}
|
||||
|
||||
void PathElement::SetWide(bool isWide)
|
||||
{
|
||||
type &= ~FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
|
||||
if (isWide)
|
||||
tileElement->type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
|
||||
type |= FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE;
|
||||
}
|
||||
|
||||
bool footpath_element_has_path_scenery(const rct_tile_element* tileElement)
|
||||
bool PathElement::HasAddition() const
|
||||
{
|
||||
return footpath_element_get_path_scenery(tileElement) != 0;
|
||||
return (additions & FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK) != 0;
|
||||
}
|
||||
|
||||
uint8_t footpath_element_get_path_scenery(const rct_tile_element* tileElement)
|
||||
uint8_t PathElement::GetAddition() const
|
||||
{
|
||||
return tileElement->properties.path.additions & FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
return additions & FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
}
|
||||
|
||||
void footpath_element_set_path_scenery(rct_tile_element* tileElement, uint8_t pathSceneryType)
|
||||
uint8_t PathElement::GetAdditionEntryIndex() const
|
||||
{
|
||||
tileElement->properties.path.additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
tileElement->properties.path.additions |= pathSceneryType;
|
||||
return GetAddition() - 1;
|
||||
}
|
||||
|
||||
uint8_t footpath_element_get_path_scenery_index(const rct_tile_element* tileElement)
|
||||
rct_scenery_entry* PathElement::GetAdditionEntry() const
|
||||
{
|
||||
return footpath_element_get_path_scenery(tileElement) - 1;
|
||||
return get_footpath_item_entry(GetAdditionEntryIndex());
|
||||
}
|
||||
|
||||
bool footpath_element_path_scenery_is_ghost(const rct_tile_element* tileElement)
|
||||
void PathElement::SetAddition(uint8_t newAddition)
|
||||
{
|
||||
return (tileElement->properties.path.additions & FOOTPATH_ADDITION_FLAG_IS_GHOST) != 0;
|
||||
additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_TYPE_MASK;
|
||||
additions |= newAddition;
|
||||
}
|
||||
|
||||
void footpath_scenery_set_is_ghost(rct_tile_element* tileElement, bool isGhost)
|
||||
bool PathElement::AdditionIsGhost() const
|
||||
{
|
||||
// Remove ghost flag
|
||||
tileElement->properties.path.additions &= ~FOOTPATH_ADDITION_FLAG_IS_GHOST;
|
||||
// Set flag if it should be a ghost
|
||||
return (additions & FOOTPATH_ADDITION_FLAG_IS_GHOST) != 0;
|
||||
}
|
||||
|
||||
void PathElement::SetAdditionIsGhost(bool isGhost)
|
||||
{
|
||||
additions &= ~FOOTPATH_ADDITION_FLAG_IS_GHOST;
|
||||
if (isGhost)
|
||||
tileElement->properties.path.additions |= FOOTPATH_ADDITION_FLAG_IS_GHOST;
|
||||
additions |= FOOTPATH_ADDITION_FLAG_IS_GHOST;
|
||||
}
|
||||
|
||||
uint8_t footpath_element_get_type(const rct_tile_element* tileElement)
|
||||
uint8_t PathElement::GetEntryIndex() const
|
||||
{
|
||||
return (tileElement->properties.path.type & FOOTPATH_PROPERTIES_TYPE_MASK) >> 4;
|
||||
return (entryIndex & FOOTPATH_PROPERTIES_TYPE_MASK) >> 4;
|
||||
}
|
||||
|
||||
void footpath_element_set_type(rct_tile_element* tileElement, uint8_t type)
|
||||
rct_footpath_entry* PathElement::GetEntry() const
|
||||
{
|
||||
tileElement->properties.path.type &= ~FOOTPATH_PROPERTIES_TYPE_MASK;
|
||||
tileElement->properties.path.type |= (type << 4);
|
||||
return get_footpath_entry(GetEntryIndex());
|
||||
}
|
||||
|
||||
uint8_t footpath_element_get_direction(const rct_tile_element* tileElement)
|
||||
void PathElement::SetEntryIndex(uint8_t newEntryIndex)
|
||||
{
|
||||
return ((tileElement->type & FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK) >> 6);
|
||||
entryIndex &= ~FOOTPATH_PROPERTIES_TYPE_MASK;
|
||||
entryIndex |= (newEntryIndex << 4);
|
||||
}
|
||||
|
||||
void footpath_element_set_direction(rct_tile_element* tileElement, uint8_t direction)
|
||||
uint8_t PathElement::GetQueueBannerDirection() const
|
||||
{
|
||||
tileElement->type &= ~FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK;
|
||||
tileElement->type |= (direction << 6);
|
||||
return ((type & FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK) >> 6);
|
||||
}
|
||||
|
||||
void PathElement::SetQueueBannerDirection(uint8_t direction)
|
||||
{
|
||||
type &= ~FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK;
|
||||
type |= (direction << 6);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2074,7 +2090,7 @@ static void footpath_clear_wide(int32_t x, int32_t y)
|
|||
{
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
|
||||
continue;
|
||||
footpath_element_set_wide(tileElement, false);
|
||||
tileElement->AsPath()->SetWide(false);
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
}
|
||||
|
||||
|
@ -2095,7 +2111,7 @@ static rct_tile_element* footpath_can_be_wide(int32_t x, int32_t y, uint8_t heig
|
|||
continue;
|
||||
if (tileElement->AsPath()->IsQueue())
|
||||
continue;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
continue;
|
||||
return tileElement;
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
|
@ -2146,7 +2162,7 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
|
|||
if (tileElement->AsPath()->IsQueue())
|
||||
continue;
|
||||
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
continue;
|
||||
|
||||
if ((tileElement->properties.path.edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK) == 0)
|
||||
|
@ -2183,7 +2199,7 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
|
|||
F3EFA5 |= 0x80;
|
||||
if (pathList[7] != nullptr)
|
||||
{
|
||||
if (footpath_element_is_wide(pathList[7]))
|
||||
if ((pathList[7])->AsPath()->IsWide())
|
||||
{
|
||||
F3EFA5 &= ~0x80;
|
||||
}
|
||||
|
@ -2195,7 +2211,7 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
|
|||
F3EFA5 |= 0x2;
|
||||
if (pathList[1] != nullptr)
|
||||
{
|
||||
if (footpath_element_is_wide(pathList[1]))
|
||||
if ((pathList[1])->AsPath()->IsWide())
|
||||
{
|
||||
F3EFA5 &= ~0x2;
|
||||
}
|
||||
|
@ -2232,11 +2248,11 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
|
|||
//}
|
||||
}
|
||||
|
||||
if ((F3EFA5 & 0x80) && (pathList[7] != nullptr) && !(footpath_element_is_wide(pathList[7])))
|
||||
if ((F3EFA5 & 0x80) && (pathList[7] != nullptr) && !(pathList[7])->AsPath()->IsWide())
|
||||
{
|
||||
if ((F3EFA5 & 2) && (pathList[0] != nullptr) && (!footpath_element_is_wide(pathList[0]))
|
||||
if ((F3EFA5 & 2) && (pathList[0] != nullptr) && !(pathList[0])->AsPath()->IsWide()
|
||||
&& ((pathList[0]->properties.path.edges & 6) == 6) && // N E
|
||||
(pathList[1] != nullptr) && (!footpath_element_is_wide(pathList[1])))
|
||||
(pathList[1] != nullptr) && !(pathList[1])->AsPath()->IsWide())
|
||||
{
|
||||
F3EFA5 |= 0x1;
|
||||
}
|
||||
|
@ -2246,9 +2262,9 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
|
|||
* is always false due to the tile update order
|
||||
* in combination with reset tiles.
|
||||
* Short circuit the logic appropriately. */
|
||||
if ((F3EFA5 & 0x20) && (pathList[6] != nullptr) && (!footpath_element_is_wide(pathList[6]))
|
||||
if ((F3EFA5 & 0x20) && (pathList[6] != nullptr) && !(pathList[6])->AsPath()->IsWide()
|
||||
&& ((pathList[6]->properties.path.edges & 3) == 3) && // N W
|
||||
(pathList[5] != nullptr) && (true || !footpath_element_is_wide(pathList[5])))
|
||||
(pathList[5] != nullptr) && (true || !(pathList[5])->AsPath()->IsWide()))
|
||||
{
|
||||
F3EFA5 |= 0x40;
|
||||
}
|
||||
|
@ -2260,11 +2276,11 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
|
|||
* are always false due to the tile update order
|
||||
* in combination with reset tiles.
|
||||
* Short circuit the logic appropriately. */
|
||||
if ((F3EFA5 & 0x8) && (pathList[3] != nullptr) && (true || !footpath_element_is_wide(pathList[3])))
|
||||
if ((F3EFA5 & 0x8) && (pathList[3] != nullptr) && (true || !(pathList[3])->AsPath()->IsWide()))
|
||||
{
|
||||
if ((F3EFA5 & 2) && (pathList[2] != nullptr) && (true || !footpath_element_is_wide(pathList[2]))
|
||||
if ((F3EFA5 & 2) && (pathList[2] != nullptr) && (true || !(pathList[2])->AsPath()->IsWide())
|
||||
&& ((pathList[2]->properties.path.edges & 0xC) == 0xC) && (pathList[1] != nullptr)
|
||||
&& (!footpath_element_is_wide(pathList[1])))
|
||||
&& (!(pathList[1])->AsPath()->IsWide()))
|
||||
{
|
||||
F3EFA5 |= 0x4;
|
||||
}
|
||||
|
@ -2275,9 +2291,9 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
|
|||
* are always false due to the tile update order
|
||||
* in combination with reset tiles.
|
||||
* Short circuit the logic appropriately. */
|
||||
if ((F3EFA5 & 0x20) && (pathList[4] != nullptr) && (true || !footpath_element_is_wide(pathList[4]))
|
||||
if ((F3EFA5 & 0x20) && (pathList[4] != nullptr) && (true || !(pathList[4])->AsPath()->IsWide())
|
||||
&& ((pathList[4]->properties.path.edges & 9) == 9) && (pathList[5] != nullptr)
|
||||
&& (true || !footpath_element_is_wide(pathList[5])))
|
||||
&& (true || !(pathList[5])->AsPath()->IsWide()))
|
||||
{
|
||||
F3EFA5 |= 0x10;
|
||||
}
|
||||
|
@ -2299,7 +2315,7 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y)
|
|||
{
|
||||
uint8_t e = tileElement->properties.path.edges;
|
||||
if ((e != 0b10101111) && (e != 0b01011111) && (e != 0b11101111))
|
||||
footpath_element_set_wide(tileElement, true);
|
||||
tileElement->AsPath()->SetWide(true);
|
||||
}
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
}
|
||||
|
@ -2380,7 +2396,7 @@ static void footpath_remove_edges_towards_here(
|
|||
if (tileElement->base_height != z)
|
||||
continue;
|
||||
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
break;
|
||||
|
||||
d = ((direction + 1) & 3) + 4;
|
||||
|
@ -2409,7 +2425,7 @@ static void footpath_remove_edges_towards(int32_t x, int32_t y, int32_t z0, int3
|
|||
|
||||
if (z1 == tileElement->base_height)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
uint8_t slope = footpath_element_get_slope_direction(tileElement);
|
||||
if (slope != direction)
|
||||
|
@ -2421,7 +2437,7 @@ static void footpath_remove_edges_towards(int32_t x, int32_t y, int32_t z0, int3
|
|||
|
||||
if (z0 == tileElement->base_height)
|
||||
{
|
||||
if (!footpath_element_is_sloped(tileElement))
|
||||
if (!tileElement->AsPath()->IsSloped())
|
||||
break;
|
||||
|
||||
uint8_t slope = footpath_element_get_slope_direction(tileElement) ^ 2;
|
||||
|
@ -2450,7 +2466,7 @@ bool tile_element_wants_path_connection_towards(TileCoordsXYZD coords, const rct
|
|||
case TILE_ELEMENT_TYPE_PATH:
|
||||
if (tileElement->base_height == coords.z)
|
||||
{
|
||||
if (!footpath_element_is_sloped(tileElement))
|
||||
if (!tileElement->AsPath()->IsSloped())
|
||||
// The footpath is flat, it can be connected to from any direction
|
||||
return true;
|
||||
else if (footpath_element_get_slope_direction(tileElement) == (coords.direction ^ 2))
|
||||
|
@ -2459,7 +2475,7 @@ bool tile_element_wants_path_connection_towards(TileCoordsXYZD coords, const rct
|
|||
}
|
||||
else if (tileElement->base_height + 2 == coords.z)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement)
|
||||
if (tileElement->AsPath()->IsSloped()
|
||||
&& footpath_element_get_slope_direction(tileElement) == coords.direction)
|
||||
// The footpath is sloped and its higher point matches the edge connection
|
||||
return true;
|
||||
|
@ -2514,7 +2530,7 @@ static void footpath_fix_corners_around(int32_t x, int32_t y, rct_tile_element*
|
|||
};
|
||||
|
||||
// Sloped paths don't create filled corners, so no need to remove any
|
||||
if (footpath_element_is_sloped(pathElement))
|
||||
if (pathElement->AsPath()->IsSloped())
|
||||
return;
|
||||
|
||||
for (int32_t xOffset = -1; xOffset <= 1; xOffset++)
|
||||
|
@ -2530,7 +2546,7 @@ static void footpath_fix_corners_around(int32_t x, int32_t y, rct_tile_element*
|
|||
{
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
|
||||
continue;
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
continue;
|
||||
if (tileElement->base_height != pathElement->base_height)
|
||||
continue;
|
||||
|
@ -2567,7 +2583,7 @@ void footpath_remove_edges_at(int32_t x, int32_t y, rct_tile_element* tileElemen
|
|||
int32_t z1 = tileElement->base_height;
|
||||
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
int32_t slope = footpath_element_get_slope_direction(tileElement);
|
||||
// Sloped footpaths don't connect sideways
|
||||
|
|
|
@ -154,22 +154,7 @@ void footpath_update_path_wide_flags(int32_t x, int32_t y);
|
|||
bool footpath_is_blocked_by_vehicle(const TileCoordsXYZ& position);
|
||||
|
||||
int32_t footpath_is_connected_to_map_edge(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t flags);
|
||||
bool footpath_element_is_sloped(const rct_tile_element* tileElement);
|
||||
void footpath_element_set_sloped(rct_tile_element* tileElement, bool isSloped);
|
||||
uint8_t footpath_element_get_slope_direction(const rct_tile_element* tileElement);
|
||||
bool footpath_element_has_queue_banner(const rct_tile_element* tileElement);
|
||||
bool footpath_element_is_wide(const rct_tile_element* tileElement);
|
||||
uint8_t footpath_element_get_type(const rct_tile_element* tileElement);
|
||||
void footpath_element_set_type(rct_tile_element* tileElement, uint8_t type);
|
||||
uint8_t footpath_element_get_direction(const rct_tile_element* tileElement);
|
||||
void footpath_element_set_direction(rct_tile_element* tileElement, uint8_t direction);
|
||||
void footpath_element_set_wide(rct_tile_element* tileElement, bool isWide);
|
||||
bool footpath_element_has_path_scenery(const rct_tile_element* tileElement);
|
||||
uint8_t footpath_element_get_path_scenery(const rct_tile_element* tileElement);
|
||||
void footpath_element_set_path_scenery(rct_tile_element* tileElement, uint8_t pathSceneryType);
|
||||
uint8_t footpath_element_get_path_scenery_index(const rct_tile_element* tileElement);
|
||||
bool footpath_element_path_scenery_is_ghost(const rct_tile_element* tileElement);
|
||||
void footpath_scenery_set_is_ghost(rct_tile_element* tileElement, bool isGhost);
|
||||
void footpath_remove_edges_at(int32_t x, int32_t y, rct_tile_element* tileElement);
|
||||
int32_t entrance_get_directions(const rct_tile_element* tileElement);
|
||||
|
||||
|
|
|
@ -259,12 +259,12 @@ static bool is_jumping_fountain(int32_t type, int32_t x, int32_t y, int32_t z)
|
|||
continue;
|
||||
if (tileElement->base_height != z)
|
||||
continue;
|
||||
if (footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->AdditionIsGhost())
|
||||
continue;
|
||||
if (!footpath_element_has_path_scenery(tileElement))
|
||||
if (!tileElement->AsPath()->HasAddition())
|
||||
continue;
|
||||
|
||||
uint8_t additionIndex = footpath_element_get_path_scenery_index(tileElement);
|
||||
uint8_t additionIndex = tileElement->AsPath()->GetAdditionEntryIndex();
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(additionIndex);
|
||||
if (sceneryEntry != reinterpret_cast<void*>(-1) && sceneryEntry->path_bit.flags & pathBitFlagMask)
|
||||
{
|
||||
|
|
|
@ -632,7 +632,7 @@ bool map_coord_is_connected(int32_t x, int32_t y, int32_t z, uint8_t faceDirecti
|
|||
rct_tile_element_path_properties props = tileElement->properties.path;
|
||||
uint8_t pathDirection = props.type & 3;
|
||||
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
if (pathDirection == faceDirection)
|
||||
{
|
||||
|
@ -694,21 +694,21 @@ void map_update_path_wide_flags()
|
|||
*
|
||||
* rct2: 0x006A7B84
|
||||
*/
|
||||
int32_t map_height_from_slope(int32_t x, int32_t y, int32_t slope)
|
||||
int32_t map_height_from_slope(const CoordsXY coords, int32_t slope, bool isSloped)
|
||||
{
|
||||
if (!(slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED))
|
||||
if (!isSloped)
|
||||
return 0;
|
||||
|
||||
switch (slope & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
||||
{
|
||||
case TILE_ELEMENT_DIRECTION_WEST:
|
||||
return (31 - (x & 31)) / 2;
|
||||
return (31 - (coords.x & 31)) / 2;
|
||||
case TILE_ELEMENT_DIRECTION_NORTH:
|
||||
return (y & 31) / 2;
|
||||
return (coords.y & 31) / 2;
|
||||
case TILE_ELEMENT_DIRECTION_EAST:
|
||||
return (x & 31) / 2;
|
||||
return (coords.x & 31) / 2;
|
||||
case TILE_ELEMENT_DIRECTION_SOUTH:
|
||||
return (31 - (y & 31)) / 2;
|
||||
return (31 - (coords.y & 31)) / 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -3587,7 +3587,7 @@ bool map_can_construct_with_clear_at(
|
|||
// Crossing mode 1: building track over path
|
||||
if (crossingMode == 1 && canBuildCrossing && tileElement->GetType() == TILE_ELEMENT_TYPE_PATH
|
||||
&& tileElement->base_height == zLow && !tileElement->AsPath()->IsQueue()
|
||||
&& !footpath_element_is_sloped(tileElement))
|
||||
&& !tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ void map_update_tile_pointers();
|
|||
rct_tile_element* map_get_first_element_at(int32_t x, int32_t y);
|
||||
rct_tile_element* map_get_nth_element_at(int32_t x, int32_t y, int32_t n);
|
||||
void map_set_tile_elements(int32_t x, int32_t y, rct_tile_element* elements);
|
||||
int32_t map_height_from_slope(int32_t x, int32_t y, int32_t slope);
|
||||
int32_t map_height_from_slope(CoordsXY coords, int32_t slope, bool isSloped);
|
||||
BannerElement* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t direction);
|
||||
rct_tile_element* map_get_surface_element_at(int32_t x, int32_t y);
|
||||
rct_tile_element* map_get_surface_element_at(CoordsXY coords);
|
||||
|
|
|
@ -145,10 +145,10 @@ static bool map_animation_invalidate_queue_banner(int32_t x, int32_t y, int32_t
|
|||
continue;
|
||||
if (!(tileElement->flags & 1))
|
||||
continue;
|
||||
if (!footpath_element_has_queue_banner(tileElement))
|
||||
if (!tileElement->AsPath()->HasQueueBanner())
|
||||
continue;
|
||||
|
||||
int32_t direction = (footpath_element_get_direction(tileElement) + get_current_rotation()) & 3;
|
||||
int32_t direction = (tileElement->AsPath()->GetQueueBannerDirection() + get_current_rotation()) & 3;
|
||||
if (direction == TILE_ELEMENT_DIRECTION_NORTH || direction == TILE_ELEMENT_DIRECTION_EAST)
|
||||
{
|
||||
baseZ = tileElement->base_height * 8;
|
||||
|
|
|
@ -88,9 +88,9 @@ void scenery_update_tile(int32_t x, int32_t y)
|
|||
}
|
||||
else if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
if (footpath_element_has_path_scenery(tileElement) && !footpath_element_path_scenery_is_ghost(tileElement))
|
||||
if (tileElement->AsPath()->HasAddition() && !tileElement->AsPath()->AdditionIsGhost())
|
||||
{
|
||||
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
|
||||
rct_scenery_entry* sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
|
||||
if (sceneryEntry != nullptr)
|
||||
{
|
||||
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "Location.hpp"
|
||||
|
||||
struct rct_scenery_entry;
|
||||
struct rct_footpath_entry;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct rct_tile_element_path_properties
|
||||
|
@ -186,9 +187,10 @@ assert_struct_size(SurfaceElement, 8);
|
|||
|
||||
struct PathElement : TileElementBase
|
||||
{
|
||||
uint8_t pathType; // 4 0xF0 Path type, 0x08 Ride sign, 0x04 Set when path is diagonal, 0x03 Rotation
|
||||
uint8_t additions; // 5
|
||||
uint8_t edges; // 6
|
||||
private:
|
||||
uint8_t entryIndex; // 4 0xF0 Path type, 0x08 Ride sign, 0x04 Set when path is diagonal, 0x03 Rotation
|
||||
uint8_t additions; // 5
|
||||
uint8_t edges; // 6
|
||||
union
|
||||
{
|
||||
uint8_t additionStatus; // 7
|
||||
|
@ -196,8 +198,34 @@ struct PathElement : TileElementBase
|
|||
};
|
||||
|
||||
public:
|
||||
uint8_t GetEntryIndex() const;
|
||||
rct_footpath_entry* GetEntry() const;
|
||||
void SetEntryIndex(uint8_t newIndex);
|
||||
|
||||
uint8_t GetQueueBannerDirection() const;
|
||||
void SetQueueBannerDirection(uint8_t direction);
|
||||
|
||||
bool IsSloped() const;
|
||||
void SetSloped(bool isSloped);
|
||||
|
||||
uint8_t GetStationIndex() const;
|
||||
void SetStationIndex(uint8_t newStationIndex);
|
||||
|
||||
bool IsWide() const;
|
||||
void SetWide(bool isWide);
|
||||
|
||||
bool IsQueue() const;
|
||||
void SetIsQueue(bool isQueue);
|
||||
bool HasQueueBanner() const;
|
||||
|
||||
bool HasAddition() const;
|
||||
uint8_t GetAddition() const;
|
||||
uint8_t GetAdditionEntryIndex() const;
|
||||
rct_scenery_entry* GetAdditionEntry() const;
|
||||
void SetAddition(uint8_t newAddition);
|
||||
|
||||
bool AdditionIsGhost() const;
|
||||
void SetAdditionIsGhost(bool isGhost);
|
||||
|
||||
uint8_t GetRCT1PathType() const;
|
||||
};
|
||||
|
|
|
@ -222,7 +222,7 @@ int32_t tile_inspector_rotate_element_at(int32_t x, int32_t y, int32_t elementIn
|
|||
switch (tileElement->GetType())
|
||||
{
|
||||
case TILE_ELEMENT_TYPE_PATH:
|
||||
if (footpath_element_is_sloped(tileElement))
|
||||
if (tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
newRotation = (footpath_element_get_slope_direction(tileElement) + 1) & TILE_ELEMENT_DIRECTION_MASK;
|
||||
tileElement->properties.path.type &= ~TILE_ELEMENT_DIRECTION_MASK;
|
||||
|
|
|
@ -59,7 +59,7 @@ TEST_F(TileElementWantsFootpathConnection, SlopedPath)
|
|||
// Sloped paths only want to connect in two directions, of which is one at a higher offset
|
||||
const rct_tile_element* const slopedPathElement = map_get_footpath_element(18, 18, 14);
|
||||
ASSERT_NE(slopedPathElement, nullptr);
|
||||
ASSERT_TRUE(footpath_element_is_sloped(slopedPathElement));
|
||||
ASSERT_TRUE(slopedPathElement->AsPath()->IsSloped());
|
||||
// Bottom and top of sloped path want a path connection
|
||||
EXPECT_TRUE(tile_element_wants_path_connection_towards({ 18, 18, 14, 2 }, nullptr));
|
||||
EXPECT_TRUE(tile_element_wants_path_connection_towards({ 18, 18, 16, 0 }, nullptr));
|
||||
|
|
Loading…
Reference in New Issue