mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 12:03:07 +01:00
Add diagonal toggle to MP
This commit is contained in:
committed by
Michał Janiszewski
parent
7349177c2d
commit
577d1d1128
@@ -742,6 +742,19 @@ static void window_tile_inspector_surface_toggle_corner(sint32 cornerIndex)
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_surface_toggle_diagonal()
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_SURFACE_TOGGLE_DIAGONAL,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
0,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
// Copied from track.c (track_remove), and modified for raising/lowering
|
||||
// Not sure if this should be in this file, track.c, or maybe another one
|
||||
static void window_tile_inspector_track_block_height_offset(rct_map_element *mapElement, uint8 offset)
|
||||
@@ -1050,19 +1063,7 @@ static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
window_tile_inspector_surface_toggle_corner(((widgetIndex - WIDX_SURFACE_CHECK_CORNER_N) + 2 - get_current_rotation()) & 3);
|
||||
break;
|
||||
case WIDX_SURFACE_CHECK_DIAGONAL:
|
||||
mapElement->properties.surface.slope ^= 0x10;
|
||||
if (mapElement->properties.surface.slope & 0x10) {
|
||||
mapElement->clearance_height = mapElement->base_height + 4;
|
||||
}
|
||||
else if (mapElement->properties.surface.slope & 0x0F) {
|
||||
mapElement->clearance_height = mapElement->base_height + 2;
|
||||
}
|
||||
else {
|
||||
mapElement->clearance_height = mapElement->base_height;
|
||||
}
|
||||
|
||||
map_invalidate_tile_full(windowTileInspectorTileX << 5, windowTileInspectorTileY << 5);
|
||||
widget_invalidate(w, widgetIndex);
|
||||
window_tile_inspector_surface_toggle_diagonal();
|
||||
break;
|
||||
} // switch widgetindex
|
||||
break;
|
||||
|
||||
@@ -5672,6 +5672,11 @@ void game_command_modify_tile(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx
|
||||
*ebx = tile_inspector_surface_toggle_corner(x, y, corner_index, flags);
|
||||
return;
|
||||
}
|
||||
case TILE_INSPECTOR_SURFACE_TOGGLE_DIAGONAL:
|
||||
{
|
||||
*ebx = tile_inspector_surface_toggle_diagonal(x, y, flags);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
log_error("invalid instruction");
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
|
||||
@@ -335,7 +335,12 @@ sint32 tile_inspector_change_base_height_at(sint32 x, sint32 y, sint16 element_i
|
||||
map_element->clearance_height += height_offset;
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
||||
|
||||
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;
|
||||
@@ -357,6 +362,12 @@ sint32 tile_inspector_surface_show_park_fences(sint32 x, sint32 y, bool show_fen
|
||||
update_park_fences(x << 5, y << 5);
|
||||
|
||||
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;
|
||||
@@ -407,7 +418,48 @@ sint32 tile_inspector_surface_toggle_corner(sint32 x, sint32 y, sint32 corner_in
|
||||
}
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
||||
|
||||
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_surface_toggle_diagonal(sint32 x, sint32 y, sint32 flags)
|
||||
{
|
||||
rct_map_element *const surface = map_get_surface_element_at(x, y);
|
||||
|
||||
// No surface element on tile
|
||||
if (surface == NULL)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
surface->properties.surface.slope ^= 0x10;
|
||||
if (surface->properties.surface.slope & 0x10)
|
||||
{
|
||||
surface->clearance_height = surface->base_height + 4;
|
||||
}
|
||||
else if (surface->properties.surface.slope & 0x0F)
|
||||
{
|
||||
surface->clearance_height = surface->base_height + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->clearance_height = surface->base_height;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -42,6 +42,7 @@ typedef enum {
|
||||
TILE_INSPECTOR_ANY_BASE_HEIGHT_OFFSET,
|
||||
TILE_INSPECTOR_SURFACE_SHOW_PARK_FENCES,
|
||||
TILE_INSPECTOR_SURFACE_TOGGLE_CORNER,
|
||||
TILE_INSPECTOR_SURFACE_TOGGLE_DIAGONAL,
|
||||
} tile_inspector_instruction;
|
||||
|
||||
sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 element_index, sint32 flags);
|
||||
@@ -53,3 +54,4 @@ sint32 tile_inspector_sort_elements_at(sint32 x, sint32 y, sint32 flags);
|
||||
sint32 tile_inspector_change_base_height_at(sint32 x, sint32 y, sint16 element_index, sint8 height_offset, sint32 flags);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user