1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 21:13:05 +01:00

Add banner toggle for blocking paths to MP

This commit is contained in:
Broxzier
2017-02-07 21:42:39 +01:00
committed by Michał Janiszewski
parent f44a78ff8a
commit bc93ecaf30
4 changed files with 50 additions and 3 deletions

View File

@@ -852,6 +852,24 @@ static void window_tile_inspector_toggle_quadrant_collosion(sint32 element_index
);
}
static void window_tile_inspector_banner_toggle_block(sint32 element_index, sint32 edge_index)
{
openrct2_assert(edge_index >= 0 && edge_index < 4, "edge_index out of range");
// Make edge_index abstract
edge_index = (edge_index - get_current_rotation()) & 3;
game_do_command(
TILE_INSPECTOR_BANNER_TOGGLE_BLOCKING_EDGE,
GAME_COMMAND_FLAG_APPLY,
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
element_index,
GAME_COMMAND_MODIFY_TILE,
edge_index,
0
);
}
static void window_tile_inspector_clamp_corrupt(sint32 element_index)
{
game_do_command(
@@ -1094,9 +1112,7 @@ static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
case WIDX_BANNER_CHECK_BLOCK_SE:
case WIDX_BANNER_CHECK_BLOCK_SW:
case WIDX_BANNER_CHECK_BLOCK_NW:
mapElement->properties.banner.flags ^= 1 << ((widgetIndex - WIDX_BANNER_CHECK_BLOCK_NE - get_current_rotation()) & 3);
map_invalidate_tile_full(windowTileInspectorTileX << 5, windowTileInspectorTileY << 5);
widget_invalidate(w, widgetIndex);
window_tile_inspector_banner_toggle_block(w->selected_list_item, widgetIndex - WIDX_BANNER_CHECK_BLOCK_NE);
break;
} // switch widget index
break;

View File

@@ -5727,6 +5727,13 @@ void game_command_modify_tile(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx
*ebx = tile_inspector_scenery_set_quarter_collision(x, y, element_index, quarter_index, flags);
break;
}
case TILE_INSPECTOR_BANNER_TOGGLE_BLOCKING_EDGE:
{
const sint32 element_index = *edx;
const sint32 edge_index = *edi;
*ebx = tile_inspector_banner_toggle_blocking_edge(x, y, element_index, edge_index, flags);
break;
}
case TILE_INSPECTOR_CORRUPT_CLAMP:
{
const sint32 element_index = *edx;

View File

@@ -855,6 +855,28 @@ sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 e
return 0;
}
sint32 tile_inspector_banner_toggle_blocking_edge(sint32 x, sint32 y, sint32 element_index, sint32 edge_index, sint32 flags)
{
rct_map_element *const bannerElement = map_get_first_element_at(x, y) + element_index;
if (!bannerElement || map_element_get_type(bannerElement) != MAP_ELEMENT_TYPE_BANNER)
{
return MONEY32_UNDEFINED;
}
if (flags & GAME_COMMAND_FLAG_APPLY)
{
bannerElement->properties.banner.flags ^= 1 << edge_index;
if ((uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
{
window_invalidate_by_class(WC_TILE_INSPECTOR);
}
}
return 0;
}
sint32 tile_inspector_corrupt_clamp(sint32 x, sint32 y, sint32 element_index, sint32 flags)
{
rct_map_element *const corruptElement = map_get_first_element_at(x, y) + element_index;

View File

@@ -50,6 +50,7 @@ typedef enum {
TILE_INSPECTOR_TRACK_SET_CHAIN,
TILE_INSPECTOR_SCENERY_SET_QUARTER_LOCATION,
TILE_INSPECTOR_SCENERY_SET_QUARTER_COLLISION,
TILE_INSPECTOR_BANNER_TOGGLE_BLOCKING_EDGE,
TILE_INSPECTOR_CORRUPT_CLAMP,
} tile_inspector_instruction;
@@ -70,4 +71,5 @@ sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elemen
sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 element_index, bool entire_track_block, bool set_chain, sint32 flags);
sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 element_index, sint32 quarter_index, sint32 flags);
sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 element_index, sint32 quarter_index, sint32 flags);
sint32 tile_inspector_banner_toggle_blocking_edge(sint32 x, sint32 y, sint32 element_index, sint32 edge_index, sint32 flags);
sint32 tile_inspector_corrupt_clamp(sint32 x, sint32 y, sint32 element_index, sint32 flags);