mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add more generic virtual floor tile check
This commit is contained in:
parent
d31a911725
commit
e4b53dc68a
|
@ -152,6 +152,11 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y)
|
|||
rct_tile_element* tile_element = map_get_first_element_at(x >> 5, y >> 5);
|
||||
uint8 rotation = get_current_rotation();
|
||||
|
||||
bool partOfVirtualFloor = false;
|
||||
#ifndef __TESTPAINT__
|
||||
partOfVirtualFloor = map_tile_is_part_of_virtual_floor(session->MapPosition.x, session->MapPosition.y);
|
||||
#endif // __TESTPAINT__
|
||||
|
||||
/* Check if the first (lowest) tile_element is below the clip
|
||||
* height. */
|
||||
if ((gCurrentViewportFlags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT) && (tile_element->base_height > gClipHeight)) {
|
||||
|
@ -222,6 +227,12 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y)
|
|||
|
||||
max_height *= 8;
|
||||
|
||||
if (partOfVirtualFloor)
|
||||
{
|
||||
// We must pretend this tile is at least as tall as the virtual floor
|
||||
max_height = Math::Max(max_height, gMapVirtualFloorHeight);
|
||||
}
|
||||
|
||||
dx -= max_height + 32;
|
||||
|
||||
element = tile_element;//pop tile_element
|
||||
|
@ -317,7 +328,10 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y)
|
|||
session->MapPosition = dword_9DE574;
|
||||
} while (!tile_element_is_last_for_tile(tile_element++));
|
||||
|
||||
virtual_floor_paint(session);
|
||||
if (partOfVirtualFloor)
|
||||
{
|
||||
virtual_floor_paint(session);
|
||||
}
|
||||
|
||||
if (!gShowSupportSegmentHeights) {
|
||||
return;
|
||||
|
|
|
@ -113,47 +113,8 @@ static void virtual_floor_get_tile_properties(sint16 x, sint16 y, sint16 height,
|
|||
|
||||
void virtual_floor_paint(paint_session * session)
|
||||
{
|
||||
// We only show when the placement modifier keys are active
|
||||
if (!input_test_place_object_modifier(PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 direction = get_current_rotation();
|
||||
|
||||
bool show = false;
|
||||
|
||||
// Check if map selection (usually single tiles) are enabled
|
||||
// and if the current tile is near or on them
|
||||
if ((gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) &&
|
||||
session->MapPosition.x >= gMapSelectPositionA.x - gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.y >= gMapSelectPositionA.y - gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.x <= gMapSelectPositionB.x + gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.y <= gMapSelectPositionB.y + gMapVirtualFloorBaseSize)
|
||||
{
|
||||
show = true;
|
||||
}
|
||||
else if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT)
|
||||
{
|
||||
// Check if we are anywhere near the selection tiles (larger scenery / rides)
|
||||
for (LocationXY16 * tile = gMapSelectionTiles; tile->x != -1; tile++)
|
||||
{
|
||||
if (session->MapPosition.x >= tile->x - gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.y >= tile->y - gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.x <= tile->x + gMapVirtualFloorBaseSize &&
|
||||
session->MapPosition.y <= tile->y + gMapVirtualFloorBaseSize)
|
||||
{
|
||||
show = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!show)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// This is a virtual floor, so no interactions
|
||||
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
|
||||
|
|
|
@ -4757,3 +4757,39 @@ void map_invalidate_virtual_floor_tiles()
|
|||
{
|
||||
// TODO: invalidate tiles covered by the current virtual floor
|
||||
}
|
||||
|
||||
bool map_tile_is_part_of_virtual_floor(sint16 x, sint16 y)
|
||||
{
|
||||
// We only show when the placement modifier keys are active
|
||||
if (!input_test_place_object_modifier(PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if map selection (usually single tiles) are enabled
|
||||
// and if the current tile is near or on them
|
||||
if ((gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) &&
|
||||
x >= gMapSelectPositionA.x - gMapVirtualFloorBaseSize &&
|
||||
y >= gMapSelectPositionA.y - gMapVirtualFloorBaseSize &&
|
||||
x <= gMapSelectPositionB.x + gMapVirtualFloorBaseSize &&
|
||||
y <= gMapSelectPositionB.y + gMapVirtualFloorBaseSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT)
|
||||
{
|
||||
// Check if we are anywhere near the selection tiles (larger scenery / rides)
|
||||
for (LocationXY16 * tile = gMapSelectionTiles; tile->x != -1; tile++)
|
||||
{
|
||||
if (x >= tile->x - gMapVirtualFloorBaseSize &&
|
||||
y >= tile->y - gMapVirtualFloorBaseSize &&
|
||||
x <= tile->x + gMapVirtualFloorBaseSize &&
|
||||
y <= tile->y + gMapVirtualFloorBaseSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -462,6 +462,7 @@ bool tile_element_check_address(const rct_tile_element * const element);
|
|||
void map_set_virtual_floor_height(sint16 height);
|
||||
void map_remove_virtual_floor();
|
||||
void map_invalidate_virtual_floor_tiles();
|
||||
bool map_tile_is_part_of_virtual_floor(sint16 x, sint16 y);
|
||||
|
||||
typedef sint32 (CLEAR_FUNC)(rct_tile_element** tile_element, sint32 x, sint32 y, uint8 flags, money32* price);
|
||||
sint32 map_place_non_scenery_clear_func(rct_tile_element** tile_element, sint32 x, sint32 y, uint8 flags, money32* price);
|
||||
|
|
Loading…
Reference in New Issue