1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 12:33:17 +01:00
Files
OpenRCT2/src/openrct2/paint/tile_element/Paint.Path.cpp
2021-04-14 01:34:07 +01:00

1311 lines
48 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2020 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "../../Context.h"
#include "../../Game.h"
#include "../../config/Config.h"
#include "../../drawing/LightFX.h"
#include "../../interface/Viewport.h"
#include "../../localisation/Localisation.h"
#include "../../object/FootpathObject.h"
#include "../../object/FootpathRailingsObject.h"
#include "../../object/ObjectList.h"
#include "../../object/ObjectManager.h"
#include "../../peep/Staff.h"
#include "../../ride/Track.h"
#include "../../ride/TrackDesign.h"
#include "../../ride/TrackPaint.h"
#include "../../world/Footpath.h"
#include "../../world/Map.h"
#include "../../world/Scenery.h"
#include "../../world/Sprite.h"
#include "../../world/Surface.h"
#include "../Paint.h"
#include "../Supports.h"
#include "Paint.Surface.h"
#include "Paint.TileElement.h"
bool gPaintWidePathsAsGhost = false;
// clang-format off
const uint8_t PathSlopeToLandSlope[] =
{
TILE_ELEMENT_SLOPE_SW_SIDE_UP,
TILE_ELEMENT_SLOPE_NW_SIDE_UP,
TILE_ELEMENT_SLOPE_NE_SIDE_UP,
TILE_ELEMENT_SLOPE_SE_SIDE_UP
};
static constexpr const uint8_t byte_98D6E0[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
0, 1, 2, 20, 4, 5, 6, 22, 8, 9, 10, 26, 12, 13, 14, 36,
0, 1, 2, 3, 4, 5, 21, 23, 8, 9, 10, 11, 12, 13, 33, 37,
0, 1, 2, 3, 4, 5, 6, 24, 8, 9, 10, 11, 12, 13, 14, 38,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 29, 30, 34, 39,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 40,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 35, 41,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 42,
0, 1, 2, 3, 4, 5, 6, 7, 8, 25, 10, 27, 12, 31, 14, 43,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 28, 12, 13, 14, 44,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 45,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 46,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 32, 14, 47,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 48,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 49,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 50
};
static constexpr const int16_t stru_98D804[][4] = {
{3, 3, 26, 26},
{0, 3, 29, 26},
{3, 3, 26, 29},
{0, 3, 29, 29},
{3, 3, 29, 26},
{0, 3, 32, 26},
{3, 3, 29, 29},
{0, 3, 32, 29},
{3, 0, 26, 29},
{0, 0, 29, 29},
{3, 0, 26, 32},
{0, 0, 29, 32},
{3, 0, 29, 29},
{0, 0, 32, 29},
{3, 0, 29, 32},
{0, 0, 32, 32},
};
static constexpr const uint8_t byte_98D8A4[] = {
0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0
};
// clang-format on
void path_paint_box_support(
paint_session* session, const TileElement* tileElement, int32_t height, const FootpathPaintInfo& pathPaintInfo,
bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags);
void path_paint_pole_support(
paint_session* session, const TileElement* tileElement, int16_t height, const FootpathPaintInfo& pathPaintInfo,
bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags);
/* rct2: 0x006A5AE5 */
static void path_bit_lights_paint(
paint_session* session, rct_scenery_entry* pathBitEntry, const TileElement* tileElement, int32_t height, uint8_t edges,
uint32_t pathBitImageFlags)
{
if (tileElement->AsPath()->IsSloped())
height += 8;
uint32_t imageId;
if (!(edges & EDGE_NE))
{
imageId = pathBitEntry->image + 1;
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId, 2, 16, 1, 1, 23, height, 3, 16, height + 2);
}
if (!(edges & EDGE_SE))
{
imageId = pathBitEntry->image + 2;
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId, 16, 30, 1, 0, 23, height, 16, 29, height + 2);
}
if (!(edges & EDGE_SW))
{
imageId = pathBitEntry->image + 3;
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId, 30, 16, 0, 1, 23, height, 29, 16, height + 2);
}
if (!(edges & EDGE_NW))
{
imageId = pathBitEntry->image + 4;
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId, 16, 2, 1, 1, 23, height, 16, 3, height + 2);
}
}
/* rct2: 0x006A5C94 */
static void path_bit_bins_paint(
paint_session* session, rct_scenery_entry* pathBitEntry, const TileElement* tileElement, int32_t height, uint8_t edges,
uint32_t pathBitImageFlags)
{
if (tileElement->AsPath()->IsSloped())
height += 8;
uint32_t imageId;
bool binsAreVandalised = tileElement->AsPath()->IsBroken();
if (!(edges & EDGE_NE))
{
imageId = pathBitEntry->image + 5;
imageId |= pathBitImageFlags;
bool binIsFull = false;
if (!binsAreVandalised)
{
imageId -= 4;
// Edges have been rotated around the rotation to check addition status
// this will also need to be rotated.
binIsFull = !(tileElement->AsPath()->GetAdditionStatus() & ror8(0x3, (2 * session->CurrentRotation)));
if (binIsFull)
imageId += 8;
}
if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised)
PaintAddImageAsParent(session, imageId, 7, 16, 1, 1, 7, height, 7, 16, height + 2);
}
if (!(edges & EDGE_SE))
{
imageId = pathBitEntry->image + 6;
imageId |= pathBitImageFlags;
bool binIsFull = false;
if (!binsAreVandalised)
{
imageId -= 4;
// Edges have been rotated around the rotation to check addition status
// this will also need to be rotated.
binIsFull = !(tileElement->AsPath()->GetAdditionStatus() & ror8(0xC, (2 * session->CurrentRotation)));
if (binIsFull)
imageId += 8;
}
if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised)
PaintAddImageAsParent(session, imageId, 16, 25, 1, 1, 7, height, 16, 25, height + 2);
}
if (!(edges & EDGE_SW))
{
imageId = pathBitEntry->image + 7;
imageId |= pathBitImageFlags;
bool binIsFull = false;
if (!binsAreVandalised)
{
imageId -= 4;
// Edges have been rotated around the rotation to check addition status
// this will also need to be rotated.
binIsFull = !(tileElement->AsPath()->GetAdditionStatus() & ror8(0x30, (2 * session->CurrentRotation)));
if (binIsFull)
imageId += 8;
}
if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised)
PaintAddImageAsParent(session, imageId, 25, 16, 1, 1, 7, height, 25, 16, height + 2);
}
if (!(edges & EDGE_NW))
{
imageId = pathBitEntry->image + 8;
imageId |= pathBitImageFlags;
bool binIsFull = false;
if (!binsAreVandalised)
{
imageId -= 4;
// Edges have been rotated around the rotation to check addition status
// this will also need to be rotated.
binIsFull = !(tileElement->AsPath()->GetAdditionStatus() & ror8(0xC0, (2 * session->CurrentRotation)));
if (binIsFull)
imageId += 8;
}
if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised)
PaintAddImageAsParent(session, imageId, 16, 7, 1, 1, 7, height, 16, 7, height + 2);
}
}
/* rct2: 0x006A5E81 */
static void path_bit_benches_paint(
paint_session* session, rct_scenery_entry* pathBitEntry, const TileElement* tileElement, int32_t height, uint8_t edges,
uint32_t pathBitImageFlags)
{
uint32_t imageId;
if (!(edges & EDGE_NE))
{
imageId = pathBitEntry->image + 1;
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId, 7, 16, 0, 16, 7, height, 6, 8, height + 2);
}
if (!(edges & EDGE_SE))
{
imageId = pathBitEntry->image + 2;
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId, 16, 25, 16, 0, 7, height, 8, 23, height + 2);
}
if (!(edges & EDGE_SW))
{
imageId = pathBitEntry->image + 3;
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId, 25, 16, 0, 16, 7, height, 23, 8, height + 2);
}
if (!(edges & EDGE_NW))
{
imageId = pathBitEntry->image + 4;
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId, 16, 7, 16, 0, 7, height, 8, 6, height + 2);
}
}
/* rct2: 0x006A6008 */
static void path_bit_jumping_fountains_paint(
paint_session* session, rct_scenery_entry* pathBitEntry, int32_t height, uint32_t pathBitImageFlags, rct_drawpixelinfo* dpi)
{
if (dpi->zoom_level > 0)
return;
uint32_t imageId = pathBitEntry->image;
imageId |= pathBitImageFlags;
PaintAddImageAsParent(session, imageId + 1, 0, 0, 1, 1, 2, height, 3, 3, height + 2);
PaintAddImageAsParent(session, imageId + 2, 0, 0, 1, 1, 2, height, 3, 29, height + 2);
PaintAddImageAsParent(session, imageId + 3, 0, 0, 1, 1, 2, height, 29, 29, height + 2);
PaintAddImageAsParent(session, imageId + 4, 0, 0, 1, 1, 2, height, 29, 3, height + 2);
}
/**
* rct2: 0x006A4101
* @param tile_element (esi)
*/
static void sub_6A4101(
paint_session* session, const TileElement* tile_element, uint16_t height, uint32_t connectedEdges, bool hasSupports,
const FootpathPaintInfo& pathPaintInfo, uint32_t imageFlags)
{
uint32_t base_image_id = pathPaintInfo.RailingsImageId | imageFlags;
if (tile_element->AsPath()->IsQueue())
{
uint8_t local_ebp = connectedEdges & 0x0F;
if (tile_element->AsPath()->IsSloped())
{
switch ((tile_element->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
{
case 0:
PaintAddImageAsParent(session, 22 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 22 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2);
break;
case 1:
PaintAddImageAsParent(session, 21 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 21 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2);
break;
case 2:
PaintAddImageAsParent(session, 23 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 23 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2);
break;
case 3:
PaintAddImageAsParent(session, 20 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 20 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2);
break;
}
}
else
{
switch (local_ebp)
{
case 1:
PaintAddImageAsParent(session, 17 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 17 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2);
break;
case 2:
PaintAddImageAsParent(session, 18 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 18 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2);
break;
case 3:
PaintAddImageAsParent(session, 17 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(
session, 18 + base_image_id, 28, 0, 1, 28, 7, height, 28, 4,
height + 2); // bound_box_offset_y seems to be a bug
PaintAddImageAsParent(session, 25 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2);
break;
case 4:
PaintAddImageAsParent(session, 19 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 19 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2);
break;
case 5:
PaintAddImageAsParent(session, 15 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 15 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2);
break;
case 6:
PaintAddImageAsParent(session, 18 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 19 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 26 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2);
break;
case 8:
PaintAddImageAsParent(session, 16 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 16 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2);
break;
case 9:
PaintAddImageAsParent(session, 16 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2);
PaintAddImageAsParent(session, 17 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2);
PaintAddImageAsParent(session, 24 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2);
break;
case 10:
PaintAddImageAsParent(session, 14 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 14 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2);
break;
case 12:
PaintAddImageAsParent(session, 16 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(
session, 19 + base_image_id, 0, 28, 28, 1, 7, height, 4, 28,
height + 2); // bound_box_offset_x seems to be a bug
PaintAddImageAsParent(session, 27 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2);
break;
default:
// purposely left empty
break;
}
}
if (!tile_element->AsPath()->HasQueueBanner())
{
return;
}
uint8_t direction = tile_element->AsPath()->GetQueueBannerDirection();
// Draw ride sign
session->InteractionType = ViewportInteractionItem::Ride;
if (tile_element->AsPath()->IsSloped())
{
if (tile_element->AsPath()->GetSlopeDirection() == direction)
height += 16;
}
direction += session->CurrentRotation;
direction &= 3;
CoordsXYZ boundBoxOffsets = CoordsXYZ(BannerBoundBoxes[direction][0], height + 2);
uint32_t imageId = (direction << 1) + base_image_id + 28;
// Draw pole in the back
PaintAddImageAsParent(
session, imageId, 0, 0, 1, 1, 21, height, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z);
// Draw pole in the front and banner
boundBoxOffsets.x = BannerBoundBoxes[direction][1].x;
boundBoxOffsets.y = BannerBoundBoxes[direction][1].y;
imageId++;
PaintAddImageAsParent(
session, imageId, 0, 0, 1, 1, 21, height, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z);
direction--;
// If text shown
auto ride = get_ride(tile_element->AsPath()->GetRideIndex());
if (direction < 2 && ride != nullptr && imageFlags == 0)
{
uint16_t scrollingMode = pathPaintInfo.ScrollingMode;
scrollingMode += direction;
auto ft = Formatter();
if (ride->status == RIDE_STATUS_OPEN && !(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN))
{
ft.Add<rct_string_id>(STR_RIDE_ENTRANCE_NAME);
ride->FormatNameTo(ft);
}
else
{
ft.Add<rct_string_id>(STR_RIDE_ENTRANCE_CLOSED);
}
if (gConfigGeneral.upper_case_banners)
{
format_string_to_upper(
gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
}
else
{
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
}
uint16_t stringWidth = gfx_get_string_width(gCommonStringFormatBuffer, FontSpriteBase::TINY);
uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0;
PaintAddImageAsChild(
session, scrolling_text_setup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK), 0, 0,
1, 1, 21, height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z);
}
session->InteractionType = ViewportInteractionItem::Footpath;
if (imageFlags != 0)
{
session->InteractionType = ViewportInteractionItem::None;
}
return;
}
uint32_t drawnCorners = 0;
// If the path is not drawn over the supports, then no corner sprites will be drawn (making double-width paths
// look like connected series of intersections).
if (pathPaintInfo.RailingFlags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS)
{
drawnCorners = (connectedEdges & FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK) >> 4;
}
auto slopeRailingsSupported = !(pathPaintInfo.SurfaceFlags & FOOTPATH_ENTRY_FLAG_NO_SLOPE_RAILINGS);
if ((hasSupports || slopeRailingsSupported) && tile_element->AsPath()->IsSloped())
{
switch ((tile_element->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
{
case 0:
PaintAddImageAsParent(session, 8 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 8 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2);
break;
case 1:
PaintAddImageAsParent(session, 7 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 7 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2);
break;
case 2:
PaintAddImageAsParent(session, 9 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 9 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2);
break;
case 3:
PaintAddImageAsParent(session, 6 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 6 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2);
break;
}
}
else
{
if (!hasSupports)
{
return;
}
switch (connectedEdges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK)
{
case 0:
// purposely left empty
break;
case 1:
PaintAddImageAsParent(session, 3 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 3 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2);
break;
case 2:
PaintAddImageAsParent(session, 4 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 4 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2);
break;
case 4:
PaintAddImageAsParent(session, 5 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 5 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2);
break;
case 5:
PaintAddImageAsParent(session, 1 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(session, 1 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2);
break;
case 8:
PaintAddImageAsParent(session, 2 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 2 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2);
break;
case 10:
PaintAddImageAsParent(session, 0 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 0 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2);
break;
case 3:
PaintAddImageAsParent(session, 3 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2);
PaintAddImageAsParent(
session, 4 + base_image_id, 28, 0, 1, 28, 7, height, 28, 4,
height + 2); // bound_box_offset_y seems to be a bug
if (!(drawnCorners & FOOTPATH_CORNER_0))
{
PaintAddImageAsParent(session, 11 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2);
}
break;
case 6:
PaintAddImageAsParent(session, 4 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(session, 5 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2);
if (!(drawnCorners & FOOTPATH_CORNER_1))
{
PaintAddImageAsParent(session, 12 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2);
}
break;
case 9:
PaintAddImageAsParent(session, 2 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2);
PaintAddImageAsParent(session, 3 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2);
if (!(drawnCorners & FOOTPATH_CORNER_3))
{
PaintAddImageAsParent(session, 10 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2);
}
break;
case 12:
PaintAddImageAsParent(session, 2 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2);
PaintAddImageAsParent(
session, 5 + base_image_id, 0, 28, 28, 1, 7, height, 4, 28,
height + 2); // bound_box_offset_x seems to be a bug
if (!(drawnCorners & FOOTPATH_CORNER_2))
{
PaintAddImageAsParent(session, 13 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2);
}
break;
case 7:
PaintAddImageAsParent(session, 1 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2);
if (!(drawnCorners & FOOTPATH_CORNER_0))
{
PaintAddImageAsParent(session, 11 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2);
}
if (!(drawnCorners & FOOTPATH_CORNER_1))
{
PaintAddImageAsParent(session, 12 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2);
}
break;
case 13:
PaintAddImageAsParent(session, 1 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2);
if (!(drawnCorners & FOOTPATH_CORNER_2))
{
PaintAddImageAsParent(session, 13 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2);
}
if (!(drawnCorners & FOOTPATH_CORNER_3))
{
PaintAddImageAsParent(session, 10 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2);
}
break;
case 14:
PaintAddImageAsParent(session, 0 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2);
if (!(drawnCorners & FOOTPATH_CORNER_1))
{
PaintAddImageAsParent(session, 12 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2);
}
if (!(drawnCorners & FOOTPATH_CORNER_2))
{
PaintAddImageAsParent(session, 13 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2);
}
break;
case 11:
PaintAddImageAsParent(session, 0 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2);
if (!(drawnCorners & FOOTPATH_CORNER_0))
{
PaintAddImageAsParent(session, 11 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2);
}
if (!(drawnCorners & FOOTPATH_CORNER_3))
{
PaintAddImageAsParent(session, 10 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2);
}
break;
case 15:
if (!(drawnCorners & FOOTPATH_CORNER_0))
{
PaintAddImageAsParent(session, 11 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2);
}
if (!(drawnCorners & FOOTPATH_CORNER_1))
{
PaintAddImageAsParent(session, 12 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2);
}
if (!(drawnCorners & FOOTPATH_CORNER_2))
{
PaintAddImageAsParent(session, 13 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2);
}
if (!(drawnCorners & FOOTPATH_CORNER_3))
{
PaintAddImageAsParent(session, 10 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2);
}
break;
}
}
}
/**
* rct2: 0x006A3F61
* @param tile_element (esp[0])
* @param connectedEdges (bp) (relative to the camera's rotation)
* @param height (dx)
* @param railingEntry (0x00F3EF6C)
* @param imageFlags (0x00F3EF70)
* @param sceneryImageFlags (0x00F3EF74)
*/
static void sub_6A3F61(
paint_session* session, const TileElement* tile_element, uint16_t connectedEdges, uint16_t height,
const FootpathPaintInfo& pathPaintInfo, uint32_t imageFlags, uint32_t sceneryImageFlags, bool hasSupports)
{
// eax --
// ebx --
// ecx
// edx
// esi --
// edi --
// ebp
// esp: [ esi, ???, 000]
// Probably drawing benches etc.
rct_drawpixelinfo* dpi = &session->DPI;
if (dpi->zoom_level <= 1)
{
bool paintScenery = true;
if (!gTrackDesignSaveMode)
{
if (tile_element->AsPath()->HasAddition())
{
session->InteractionType = ViewportInteractionItem::FootpathItem;
if (sceneryImageFlags != 0)
{
session->InteractionType = ViewportInteractionItem::None;
}
// Draw additional path bits (bins, benches, lamps, queue screens)
rct_scenery_entry* sceneryEntry = tile_element->AsPath()->GetAdditionEntry();
// Can be null if the object is not loaded.
if (sceneryEntry == nullptr)
{
paintScenery = false;
}
else if (
(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) && !(tile_element->AsPath()->IsBroken())
&& !(sceneryEntry->path_bit.draw_type == PATH_BIT_DRAW_TYPE_BINS))
{
paintScenery = false;
}
else
{
switch (sceneryEntry->path_bit.draw_type)
{
case PATH_BIT_DRAW_TYPE_LIGHTS:
path_bit_lights_paint(
session, sceneryEntry, tile_element, height, static_cast<uint8_t>(connectedEdges),
sceneryImageFlags);
break;
case PATH_BIT_DRAW_TYPE_BINS:
path_bit_bins_paint(
session, sceneryEntry, tile_element, height, static_cast<uint8_t>(connectedEdges),
sceneryImageFlags);
break;
case PATH_BIT_DRAW_TYPE_BENCHES:
path_bit_benches_paint(
session, sceneryEntry, tile_element, height, static_cast<uint8_t>(connectedEdges),
sceneryImageFlags);
break;
case PATH_BIT_DRAW_TYPE_JUMPING_FOUNTAINS:
path_bit_jumping_fountains_paint(session, sceneryEntry, height, sceneryImageFlags, dpi);
break;
}
session->InteractionType = ViewportInteractionItem::Footpath;
if (sceneryImageFlags != 0)
{
session->InteractionType = ViewportInteractionItem::None;
}
}
}
}
// Redundant zoom-level check removed
if (paintScenery)
sub_6A4101(session, tile_element, height, connectedEdges, hasSupports, pathPaintInfo, imageFlags);
}
// This is about tunnel drawing
uint8_t direction = (tile_element->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
bool sloped = tile_element->AsPath()->IsSloped();
if (connectedEdges & EDGE_SE)
{
// Bottom right of tile is a tunnel
if (sloped && direction == EDGE_NE)
{
// Path going down into the tunnel
paint_util_push_tunnel_right(session, height + 16, TUNNEL_PATH_AND_MINI_GOLF);
}
else if (connectedEdges & EDGE_NE)
{
// Flat path with edge to the right (north-east)
paint_util_push_tunnel_right(session, height, TUNNEL_PATH_11);
}
else
{
// Path going up, or flat and not connected to the right
paint_util_push_tunnel_right(session, height, TUNNEL_PATH_AND_MINI_GOLF);
}
}
if (!(connectedEdges & EDGE_SW))
{
return;
}
// Bottom left of the tile is a tunnel
if (sloped && direction == EDGE_SE)
{
// Path going down into the tunnel
paint_util_push_tunnel_left(session, height + 16, TUNNEL_PATH_AND_MINI_GOLF);
}
else if (connectedEdges & EDGE_NW)
{
// Flat path with edge to the left (north-west)
paint_util_push_tunnel_left(session, height, TUNNEL_PATH_11);
}
else
{
// Path going up, or flat and not connected to the left
paint_util_push_tunnel_left(session, height, TUNNEL_PATH_AND_MINI_GOLF);
}
}
/**
* rct2: 0x0006A3590
*/
void path_paint(paint_session* session, uint16_t height, const TileElement* tile_element)
{
session->InteractionType = ViewportInteractionItem::Footpath;
bool hasSupports = false;
uint32_t sceneryImageFlags = 0;
uint32_t imageFlags = 0;
if (gTrackDesignSaveMode)
{
if (tile_element->AsPath()->IsQueue())
{
if (tile_element->AsPath()->GetRideIndex() != gTrackDesignSaveRideIndex)
{
return;
}
}
if (!track_design_save_contains_tile_element(tile_element))
{
imageFlags = SPRITE_ID_PALETTE_COLOUR_1(EnumValue(FilterPaletteID::Palette46));
}
}
if (session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
{
imageFlags = SPRITE_ID_PALETTE_COLOUR_1(EnumValue(FilterPaletteID::Palette46));
}
if (tile_element->AsPath()->AdditionIsGhost())
{
sceneryImageFlags = CONSTRUCTION_MARKER;
}
if (tile_element->IsGhost())
{
session->InteractionType = ViewportInteractionItem::None;
imageFlags = CONSTRUCTION_MARKER;
}
// For debugging purpose, show blocked tiles with a colour
if (gPaintBlockedTiles && tile_element->AsPath()->IsBlockedByVehicle())
{
imageFlags = COLOUR_BRIGHT_GREEN << 19 | COLOUR_GREY << 24 | IMAGE_TYPE_REMAP;
}
// Draw wide flags as ghosts, leaving only the "walkable" paths to be drawn normally
if (gPaintWidePathsAsGhost && tile_element->AsPath()->IsWide())
{
imageFlags &= 0x7FFFF;
imageFlags |= CONSTRUCTION_MARKER;
}
auto surface = map_get_surface_element_at(session->MapPosition);
if (surface == nullptr)
{
hasSupports = true;
}
else if (surface->GetBaseZ() != height)
{
hasSupports = true;
}
else
{
if (tile_element->AsPath()->IsSloped())
{
// Diagonal path
if (surface->GetSlope() != PathSlopeToLandSlope[tile_element->AsPath()->GetSlopeDirection()])
{
hasSupports = true;
}
}
else
{
if (surface->GetSlope() != TILE_ELEMENT_SLOPE_FLAT)
{
hasSupports = true;
}
}
}
if (gStaffDrawPatrolAreas != 0xFFFF)
{
int32_t staffIndex = gStaffDrawPatrolAreas;
uint8_t staffType = staffIndex & 0x7FFF;
bool is_staff_list = staffIndex & 0x8000;
uint8_t patrolColour = COLOUR_LIGHT_BLUE;
if (!is_staff_list)
{
Staff* staff = GetEntity<Staff>(staffIndex);
if (staff == nullptr)
{
log_error("Invalid staff index for draw patrol areas!");
}
else
{
if (!staff->IsPatrolAreaSet(session->MapPosition))
{
patrolColour = COLOUR_GREY;
}
staffType = static_cast<uint8_t>(staff->AssignedStaffType);
}
}
if (staff_is_patrol_area_set_for_type(static_cast<StaffType>(staffType), session->MapPosition))
{
uint32_t imageId = 2618;
int32_t patrolAreaBaseZ = tile_element->GetBaseZ();
if (tile_element->AsPath()->IsSloped())
{
imageId = 2619 + ((tile_element->AsPath()->GetSlopeDirection() + session->CurrentRotation) & 3);
patrolAreaBaseZ += 16;
}
PaintAddImageAsParent(
session, imageId | patrolColour << 19 | IMAGE_TYPE_REMAP, 16, 16, 1, 1, 0, patrolAreaBaseZ + 2);
}
}
if (PaintShouldShowHeightMarkers(session, VIEWPORT_FLAG_PATH_HEIGHTS))
{
uint16_t heightMarkerBaseZ = tile_element->GetBaseZ() + 3;
if (tile_element->AsPath()->IsSloped())
{
heightMarkerBaseZ += 8;
}
uint32_t imageId = (SPR_HEIGHT_MARKER_BASE + heightMarkerBaseZ / 16) | COLOUR_GREY << 19 | IMAGE_TYPE_REMAP;
imageId += get_height_marker_offset();
imageId -= gMapBaseZ;
PaintAddImageAsParent(session, imageId, 16, 16, 1, 1, 0, heightMarkerBaseZ);
}
auto footpathObj = tile_element->AsPath()->GetSurfaceEntry();
if (footpathObj != nullptr)
{
auto surfaceEntry = tile_element->AsPath()->IsQueue() ? footpathObj->GetQueueEntry()
: footpathObj->GetPathSurfaceEntry();
auto railingsEntry = footpathObj->GetPathRailingsEntry();
FootpathPaintInfo pathPaintInfo;
pathPaintInfo.SurfaceImageId = surfaceEntry->image;
pathPaintInfo.SurfaceFlags = surfaceEntry->flags;
auto railingObj = tile_element->AsPath()->GetRailingEntry();
if (railingObj != nullptr)
{
pathPaintInfo.BridgeImageId = railingObj->BridgeImageId;
pathPaintInfo.RailingsImageId = railingObj->RailingsImageId;
pathPaintInfo.RailingFlags = railingObj->Flags;
pathPaintInfo.ScrollingMode = railingObj->ScrollingMode;
pathPaintInfo.SupportType = railingObj->SupportType;
}
else
{
pathPaintInfo.BridgeImageId = railingsEntry->bridge_image;
pathPaintInfo.RailingsImageId = railingsEntry->railings_image;
pathPaintInfo.RailingFlags = railingsEntry->flags;
pathPaintInfo.ScrollingMode = railingsEntry->scrolling_mode;
pathPaintInfo.SupportType = railingsEntry->support_type;
}
if (pathPaintInfo.SupportType == RailingEntrySupportType::Pole)
{
path_paint_pole_support(session, tile_element, height, pathPaintInfo, hasSupports, imageFlags, sceneryImageFlags);
}
else
{
path_paint_box_support(session, tile_element, height, pathPaintInfo, hasSupports, imageFlags, sceneryImageFlags);
}
}
#ifdef __ENABLE_LIGHTFX__
if (lightfx_is_available())
{
if (tile_element->AsPath()->HasAddition() && !(tile_element->AsPath()->IsBroken()))
{
rct_scenery_entry* sceneryEntry = tile_element->AsPath()->GetAdditionEntry();
if (sceneryEntry != nullptr && sceneryEntry->path_bit.flags & PATH_BIT_FLAG_LAMP)
{
if (!(tile_element->AsPath()->GetEdges() & EDGE_NE))
{
lightfx_add_3d_light_magic_from_drawing_tile(
session->MapPosition, -16, 0, height + 23, LightType::Lantern3);
}
if (!(tile_element->AsPath()->GetEdges() & EDGE_SE))
{
lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 0, 16, height + 23, LightType::Lantern3);
}
if (!(tile_element->AsPath()->GetEdges() & EDGE_SW))
{
lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 16, 0, height + 23, LightType::Lantern3);
}
if (!(tile_element->AsPath()->GetEdges() & EDGE_NW))
{
lightfx_add_3d_light_magic_from_drawing_tile(
session->MapPosition, 0, -16, height + 23, LightType::Lantern3);
}
}
}
}
#endif
}
void path_paint_box_support(
paint_session* session, const TileElement* tileElement, int32_t height, const FootpathPaintInfo& pathPaintInfo,
bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags)
{
const PathElement* pathElement = tileElement->AsPath();
// Rol edges around rotation
uint8_t edges = ((tileElement->AsPath()->GetEdges() << session->CurrentRotation) & 0xF)
| (((tileElement->AsPath()->GetEdges()) << session->CurrentRotation) >> 4);
uint8_t corners = (((tileElement->AsPath()->GetCorners()) << session->CurrentRotation) & 0xF)
| (((tileElement->AsPath()->GetCorners()) << session->CurrentRotation) >> 4);
LocationXY16 boundBoxOffset = { stru_98D804[edges][0], stru_98D804[edges][1] };
LocationXY16 boundBoxSize = { stru_98D804[edges][2], stru_98D804[edges][3] };
uint16_t edi = edges | (corners << 4);
uint32_t imageId = pathPaintInfo.SurfaceImageId;
if (tileElement->AsPath()->IsSloped())
{
imageId += ((tileElement->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
+ 16;
}
else
{
imageId += byte_98D6E0[edi];
}
if (!session->DidPassSurface)
{
boundBoxOffset.x = 3;
boundBoxOffset.y = 3;
boundBoxSize.x = 26;
boundBoxSize.y = 26;
}
// By default, add 1 to the z bounding box to always clip above the surface
uint8_t boundingBoxZOffset = 1;
// If we are on the same tile as a straight track, add the offset 2 so we
// can clip above gravel part of the track sprite
if (session->TrackElementOnSameHeight)
{
if (session->TrackElementOnSameHeight->AsTrack()->GetTrackType() == TrackElemType::Flat)
{
boundingBoxZOffset = 2;
}
}
if (!hasSupports || !session->DidPassSurface)
{
PaintAddImageAsParent(
session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y,
height + boundingBoxZOffset);
}
else
{
uint32_t image_id;
if (tileElement->AsPath()->IsSloped())
{
image_id = ((tileElement->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
+ pathPaintInfo.BridgeImageId + 51;
}
else
{
image_id = byte_98D8A4[edges] + pathPaintInfo.BridgeImageId + 49;
}
PaintAddImageAsParent(
session, image_id | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y,
height + boundingBoxZOffset);
// TODO: Revert this when path import works correctly.
if (!pathElement->IsQueue() && !(pathPaintInfo.RailingFlags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS))
{
// don't draw
}
else
{
PaintAddImageAsChild(
session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x,
boundBoxOffset.y, height + boundingBoxZOffset);
}
}
sub_6A3F61(session, tileElement, edi, height, pathPaintInfo, imageFlags, sceneryImageFlags, hasSupports);
uint16_t ax = 0;
if (tileElement->AsPath()->IsSloped())
{
ax = ((tileElement->AsPath()->GetSlopeDirection() + session->CurrentRotation) & 0x3) + 1;
}
auto supportType = byte_98D8A4[edges] == 0 ? 0 : 1;
path_a_supports_paint_setup(session, supportType, ax, height, imageFlags, pathPaintInfo, nullptr);
height += 32;
if (tileElement->AsPath()->IsSloped())
{
height += 16;
}
paint_util_set_general_support_height(session, height, 0x20);
if (pathElement->IsQueue() || (tileElement->AsPath()->GetEdgesAndCorners() != 0xFF && hasSupports))
{
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
return;
}
if (tileElement->AsPath()->GetEdgesAndCorners() == 0xFF)
{
paint_util_set_segment_support_height(session, SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, 0xFFFF, 0);
return;
}
paint_util_set_segment_support_height(session, SEGMENT_C4, 0xFFFF, 0);
if (edges & 1)
{
paint_util_set_segment_support_height(session, SEGMENT_CC, 0xFFFF, 0);
}
if (edges & 2)
{
paint_util_set_segment_support_height(session, SEGMENT_D4, 0xFFFF, 0);
}
if (edges & 4)
{
paint_util_set_segment_support_height(session, SEGMENT_D0, 0xFFFF, 0);
}
if (edges & 8)
{
paint_util_set_segment_support_height(session, SEGMENT_C8, 0xFFFF, 0);
}
}
void path_paint_pole_support(
paint_session* session, const TileElement* tileElement, int16_t height, const FootpathPaintInfo& pathPaintInfo,
bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags)
{
const PathElement* pathElement = tileElement->AsPath();
// Rol edges around rotation
uint8_t edges = ((tileElement->AsPath()->GetEdges() << session->CurrentRotation) & 0xF)
| (((tileElement->AsPath()->GetEdges()) << session->CurrentRotation) >> 4);
LocationXY16 boundBoxOffset = { stru_98D804[edges][0], stru_98D804[edges][1] };
LocationXY16 boundBoxSize = { stru_98D804[edges][2], stru_98D804[edges][3] };
uint8_t corners = (((tileElement->AsPath()->GetCorners()) << session->CurrentRotation) & 0xF)
| (((tileElement->AsPath()->GetCorners()) << session->CurrentRotation) >> 4);
uint16_t edi = edges | (corners << 4);
uint32_t imageId = pathPaintInfo.SurfaceImageId;
if (tileElement->AsPath()->IsSloped())
{
imageId += ((tileElement->AsPath()->GetSlopeDirection() + session->CurrentRotation) & 3) + 16;
}
else
{
imageId += byte_98D6E0[edi];
}
// Below Surface
if (!session->DidPassSurface)
{
boundBoxOffset.x = 3;
boundBoxOffset.y = 3;
boundBoxSize.x = 26;
boundBoxSize.y = 26;
}
// By default, add 1 to the z bounding box to always clip above the surface
uint8_t boundingBoxZOffset = 1;
// If we are on the same tile as a straight track, add the offset 2 so we
// can clip above gravel part of the track sprite
if (session->TrackElementOnSameHeight)
{
if (session->TrackElementOnSameHeight->AsTrack()->GetTrackType() == TrackElemType::Flat)
{
boundingBoxZOffset = 2;
}
}
if (!hasSupports || !session->DidPassSurface)
{
PaintAddImageAsParent(
session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y,
height + boundingBoxZOffset);
}
else
{
uint32_t bridgeImage;
if (tileElement->AsPath()->IsSloped())
{
bridgeImage = ((tileElement->AsPath()->GetSlopeDirection() + session->CurrentRotation)
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
+ pathPaintInfo.BridgeImageId + 16;
}
else
{
bridgeImage = edges + pathPaintInfo.BridgeImageId;
bridgeImage |= imageFlags;
}
PaintAddImageAsParent(
session, bridgeImage | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x,
boundBoxOffset.y, height + boundingBoxZOffset);
// TODO: Revert this when path import works correctly.
if (pathElement->IsQueue() || (pathPaintInfo.RailingFlags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS))
{
PaintAddImageAsChild(
session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x,
boundBoxOffset.y, height + boundingBoxZOffset);
}
}
sub_6A3F61(session, tileElement, edi, height, pathPaintInfo, imageFlags, sceneryImageFlags,
hasSupports); // TODO: arguments
uint16_t ax = 0;
if (tileElement->AsPath()->IsSloped())
{
ax = 8;
}
uint8_t supports[] = {
6,
8,
7,
5,
};
for (int8_t i = 3; i > -1; --i)
{
if (!(edges & (1 << i)))
{
path_b_supports_paint_setup(session, supports[i], ax, height, imageFlags, pathPaintInfo);
}
}
height += 32;
if (tileElement->AsPath()->IsSloped())
{
height += 16;
}
paint_util_set_general_support_height(session, height, 0x20);
if (pathElement->IsQueue() || (tileElement->AsPath()->GetEdgesAndCorners() != 0xFF && hasSupports))
{
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
return;
}
if (tileElement->AsPath()->GetEdgesAndCorners() == 0xFF)
{
paint_util_set_segment_support_height(session, SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, 0xFFFF, 0);
return;
}
paint_util_set_segment_support_height(session, SEGMENT_C4, 0xFFFF, 0);
if (edges & EDGE_NE)
{
paint_util_set_segment_support_height(session, SEGMENT_CC, 0xFFFF, 0);
}
if (edges & EDGE_SE)
{
paint_util_set_segment_support_height(session, SEGMENT_D4, 0xFFFF, 0);
}
if (edges & EDGE_SW)
{
paint_util_set_segment_support_height(session, SEGMENT_D0, 0xFFFF, 0);
}
if (edges & EDGE_NW)
{
paint_util_set_segment_support_height(session, SEGMENT_C8, 0xFFFF, 0);
}
}