1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 19:43:06 +01:00

Tile inspector raises surface when all corners are raised. Removes printf.

This commit is contained in:
Broxzier
2016-10-09 00:00:36 +02:00
parent 2ad5ef3c5f
commit 9fdad31be2

View File

@@ -459,6 +459,7 @@ static void window_tile_inspector_swap_elements(sint16 first, sint16 second);
static void window_tile_inspector_remove_element(int index);
static void window_tile_inspector_rotate_element(int index);
static void window_tile_inspector_sort_elements(rct_window *w);
static void window_tile_inspector_surface_toggle_corner(rct_map_element *mapElement, int cornerIndex);
static void window_tile_inspector_track_block_height_offset(rct_map_element *mapElement, uint8 offset);
static void window_tile_inspector_track_block_set_lift(rct_map_element *mapElement, bool chain);
static void window_tile_inspector_quarter_tile_set(rct_map_element *const mapElement, const int index);
@@ -707,6 +708,37 @@ static void window_tile_inspector_sort_elements(rct_window *w) {
}
}
static void window_tile_inspector_surface_toggle_corner(rct_map_element *mapElement, int cornerIndex) {
const uint8 originalSlope = mapElement->properties.surface.slope;
const bool diagonal = (originalSlope & 0x10) >> 4;
mapElement->properties.surface.slope ^= 1 << cornerIndex;
if (mapElement->properties.surface.slope & 0x0F) {
mapElement->clearance_height = mapElement->base_height + 2;
}
else {
mapElement->clearance_height = mapElement->base_height;
}
// All corners are raised
if ((mapElement->properties.surface.slope & 0x0F) == 0x0F) {
mapElement->properties.surface.slope &= ~0x1F;
if (diagonal) {
switch (originalSlope & 0x0F) {
case 0b1011: mapElement->properties.surface.slope |= (1 << 0); break;
case 0b0111: mapElement->properties.surface.slope |= (1 << 1); break;
case 0b1110: mapElement->properties.surface.slope |= (1 << 2); break;
case 0b1101: mapElement->properties.surface.slope |= (1 << 3); break;
}
}
// Update base and clearance heights
mapElement->base_height += 2;
mapElement->clearance_height = mapElement->base_height + (diagonal ? 2 : 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) {
@@ -1027,21 +1059,22 @@ static void window_tile_inspector_mouseup(rct_window *w, int widgetIndex) {
case WIDX_SURFACE_CHECK_CORNER_E:
case WIDX_SURFACE_CHECK_CORNER_S:
case WIDX_SURFACE_CHECK_CORNER_W:
mapElement->properties.surface.slope ^= 1 << (((widgetIndex - WIDX_SURFACE_CHECK_CORNER_N) + 2 - get_current_rotation()) & 3);
if (mapElement->properties.surface.slope & 0x0F) {
mapElement->clearance_height = mapElement->base_height + 2;
}
else {
mapElement->clearance_height = mapElement->base_height;
}
window_tile_inspector_surface_toggle_corner(mapElement, ((widgetIndex - WIDX_SURFACE_CHECK_CORNER_N) + 2 - get_current_rotation()) & 3);
map_invalidate_tile_full(windowTileInspectorTileX << 5, windowTileInspectorTileY << 5);
widget_invalidate(w, widgetIndex);
window_invalidate(w);
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);
break;
@@ -1332,7 +1365,6 @@ static void window_tile_inspector_dropdown(rct_window *w, int widgetIndex, int d
switch (widgetIndex) {
case WIDX_FENCE_DROPDOWN_SLOPE_BUTTON:
printf("Dropdown index: %d\n", dropdownIndex);
mapElement->type &= ~0xC0;
mapElement->type |= dropdownIndex << 6;
break;