mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 19:43:06 +01:00
Add setting quadrant collision for small scenery to MP
This commit is contained in:
committed by
Michał Janiszewski
parent
2682639393
commit
cc2fae2f6a
@@ -839,6 +839,19 @@ static void window_tile_inspector_quarter_tile_set(sint32 element_index, const s
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_toggle_quadrant_collosion(sint32 element_index, const sint32 quadrant_index)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_SCENERY_SET_QUARTER_COLLISION,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
(quadrant_index + 2 - get_current_rotation()) & 3,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
switch (widgetIndex) {
|
||||
@@ -1013,14 +1026,12 @@ static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
case WIDX_SCENERY_CHECK_QUARTER_S:
|
||||
case WIDX_SCENERY_CHECK_QUARTER_W:
|
||||
window_tile_inspector_quarter_tile_set(w->selected_list_item, widgetIndex - WIDX_SCENERY_CHECK_QUARTER_N);
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_SCENERY_CHECK_COLLISION_N:
|
||||
case WIDX_SCENERY_CHECK_COLLISION_E:
|
||||
case WIDX_SCENERY_CHECK_COLLISION_S:
|
||||
case WIDX_SCENERY_CHECK_COLLISION_W:
|
||||
mapElement->flags ^= 1 << (((widgetIndex - WIDX_SCENERY_CHECK_COLLISION_N) + 2 - get_current_rotation()) & 3);
|
||||
window_invalidate(w);
|
||||
window_tile_inspector_toggle_quadrant_collosion(w->selected_list_item, widgetIndex - WIDX_SCENERY_CHECK_COLLISION_N);
|
||||
break;
|
||||
} // switch widget index
|
||||
break;
|
||||
|
||||
@@ -5720,6 +5720,13 @@ void game_command_modify_tile(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx
|
||||
*ebx = tile_inspector_scenery_set_quarter_location(x, y, element_index, quarter_index, flags);
|
||||
break;
|
||||
}
|
||||
case TILE_INSPECTOR_SCENERY_SET_QUARTER_COLLISION:
|
||||
{
|
||||
const sint32 element_index = *edx;
|
||||
const sint32 quarter_index = *edi;
|
||||
*ebx = tile_inspector_scenery_set_quarter_collision(x, y, element_index, quarter_index, flags);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
log_error("invalid instruction");
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
|
||||
@@ -831,3 +831,26 @@ sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 el
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (!mapElement || map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_SCENERY)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
mapElement->flags ^= 1 << quarter_index;
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
if ((uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate_by_class(WC_TILE_INSPECTOR);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ 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_instruction;
|
||||
|
||||
sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 element_index, sint32 flags);
|
||||
@@ -67,3 +68,4 @@ sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 element_index,
|
||||
sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 element_index, sint8 offset, sint32 flags);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user