1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 04:23:20 +01:00

Add toggling footpath slope to MP

This commit is contained in:
Broxzier
2017-02-06 14:51:45 +01:00
committed by Michał Janiszewski
parent 7ffcc61bf2
commit 9400b292cf
4 changed files with 52 additions and 3 deletions

View File

@@ -757,6 +757,19 @@ static void window_tile_inspector_surface_toggle_diagonal()
);
}
static void window_tile_inspector_path_set_sloped(sint32 element_index, bool sloped)
{
game_do_command(
TILE_INSPECTOR_PATH_SET_SLOPE,
GAME_COMMAND_FLAG_APPLY,
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
element_index,
GAME_COMMAND_MODIFY_TILE,
sloped,
0
);
}
static void window_tile_inspector_path_toggle_edge(sint32 element_index, sint32 corner_index)
{
assert(corner_index >= 0 && corner_index < 8);
@@ -1109,9 +1122,7 @@ static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
window_tile_inspector_base_height_offset(w->selected_list_item, -1);
break;
case WIDX_PATH_CHECK_SLOPED:
mapElement->properties.path.type ^= 1 << 2;
map_invalidate_tile_full(windowTileInspectorTileX << 5, windowTileInspectorTileY << 5);
widget_invalidate(w, WIDX_PATH_CHECK_SLOPED);
window_tile_inspector_path_set_sloped(w->selected_list_item, !footpath_element_is_sloped(mapElement));
break;
case WIDX_PATH_CHECK_EDGE_E:
case WIDX_PATH_CHECK_EDGE_S:

View File

@@ -5677,6 +5677,13 @@ void game_command_modify_tile(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx
*ebx = tile_inspector_surface_toggle_diagonal(x, y, flags);
return;
}
case TILE_INSPECTOR_PATH_SET_SLOPE:
{
const sint32 element_index = *edx;
const bool sloped = *edi;
*ebx = tile_inspector_path_set_sloped(x, y, element_index, sloped, flags);
return;
}
case TILE_INSPECTOR_PATH_TOGGLE_EDGE:
{
const sint32 element_index = *edx;

View File

@@ -465,6 +465,35 @@ sint32 tile_inspector_surface_toggle_diagonal(sint32 x, sint32 y, sint32 flags)
return 0;
}
sint32 tile_inspector_path_set_sloped(sint32 x, sint32 y, sint32 element_index, bool sloped, sint32 flags)
{
rct_map_element *const path_element = map_get_first_element_at(x, y) + element_index;
if (!path_element || map_element_get_type(path_element) != MAP_ELEMENT_TYPE_PATH)
{
return MONEY32_UNDEFINED;
}
if (flags & GAME_COMMAND_FLAG_APPLY)
{
path_element->properties.path.type &= ~(1 << 2);
if (sloped)
{
path_element->properties.path.type |= (1 << 2);
}
map_invalidate_tile_full(x << 5, y << 5);
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
{
window_invalidate(tile_inspector_window);
}
}
return 0;
}
sint32 tile_inspector_path_toggle_edge(sint32 x, sint32 y, sint32 element_index, sint32 edge_index, sint32 flags)
{
rct_map_element *const path_element = map_get_first_element_at(x, y) + element_index;

View File

@@ -43,6 +43,7 @@ typedef enum {
TILE_INSPECTOR_SURFACE_SHOW_PARK_FENCES,
TILE_INSPECTOR_SURFACE_TOGGLE_CORNER,
TILE_INSPECTOR_SURFACE_TOGGLE_DIAGONAL,
TILE_INSPECTOR_PATH_SET_SLOPE,
TILE_INSPECTOR_PATH_TOGGLE_EDGE,
TILE_INSPECTOR_FENCE_SET_SLOPE,
} tile_inspector_instruction;
@@ -57,5 +58,6 @@ sint32 tile_inspector_change_base_height_at(sint32 x, sint32 y, sint16 element_i
sint32 tile_inspector_surface_show_park_fences(sint32 x, sint32 y, bool enabled, sint32 flags);
sint32 tile_inspector_surface_toggle_corner(sint32 x, sint32 y, sint32 corner_index, sint32 flags);
sint32 tile_inspector_surface_toggle_diagonal(sint32 x, sint32 y, sint32 flags);
sint32 tile_inspector_path_set_sloped(sint32 x, sint32 y, sint32 element_index, bool sloped, sint32 flags);
sint32 tile_inspector_path_toggle_edge(sint32 x, sint32 y, sint32 element_index, sint32 corner_index, sint32 flags);
sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 element_index, sint32 slope_value, sint32 flags);