mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add clamp corrupt element to MP
This commit is contained in:
parent
cc2fae2f6a
commit
f44a78ff8a
|
@ -852,6 +852,19 @@ static void window_tile_inspector_toggle_quadrant_collosion(sint32 element_index
|
|||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_clamp_corrupt(sint32 element_index)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_CORRUPT_CLAMP,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
switch (widgetIndex) {
|
||||
|
@ -1097,9 +1110,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_CORRUPT_BUTTON_CLAMP:
|
||||
if (!map_element_is_last_for_tile(mapElement)) {
|
||||
mapElement->base_height = mapElement->clearance_height = (mapElement + 1)->base_height;
|
||||
}
|
||||
window_tile_inspector_clamp_corrupt(w->selected_list_item);
|
||||
break;
|
||||
} // switch widget index
|
||||
break;
|
||||
|
|
|
@ -5727,6 +5727,12 @@ 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_CORRUPT_CLAMP:
|
||||
{
|
||||
const sint32 element_index = *edx;
|
||||
*ebx = tile_inspector_corrupt_clamp(x, y, element_index, flags);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
log_error("invalid instruction");
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
|
|
|
@ -834,7 +834,7 @@ sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 el
|
|||
|
||||
sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 element_index, sint32 quarter_index, sint32 flags)
|
||||
{
|
||||
rct_map_element *mapElement = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const mapElement = map_get_first_element_at(x, y) + element_index;
|
||||
|
||||
if (!mapElement || map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_SCENERY)
|
||||
{
|
||||
|
@ -854,3 +854,31 @@ sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 e
|
|||
|
||||
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;
|
||||
|
||||
if (!corruptElement || map_element_get_type(corruptElement) != MAP_ELEMENT_TYPE_CORRUPT)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (map_element_is_last_for_tile(corruptElement))
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
rct_map_element *const nextElement = corruptElement + 1;
|
||||
corruptElement->base_height = corruptElement->clearance_height = nextElement->base_height;
|
||||
|
||||
if ((uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ typedef enum {
|
|||
TILE_INSPECTOR_TRACK_BASE_HEIGHT_OFFSET,
|
||||
TILE_INSPECTOR_TRACK_SET_CHAIN,
|
||||
TILE_INSPECTOR_SCENERY_SET_QUARTER_LOCATION,
|
||||
TILE_INSPECTOR_SCENERY_SET_QUARTER_COLLISION
|
||||
TILE_INSPECTOR_SCENERY_SET_QUARTER_COLLISION,
|
||||
TILE_INSPECTOR_CORRUPT_CLAMP,
|
||||
} tile_inspector_instruction;
|
||||
|
||||
sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 element_index, sint32 flags);
|
||||
|
@ -69,3 +70,4 @@ 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_corrupt_clamp(sint32 x, sint32 y, sint32 element_index, sint32 flags);
|
||||
|
|
Loading…
Reference in New Issue