mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Use WoodenBSupportsSetupRotated() for scenery supports drawing
This commit is contained in:
@@ -353,19 +353,19 @@ static constexpr UnkSupportsDescriptor Byte97B23C[] = {
|
|||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1}, // ?
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1}, // ?
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1}, // ?
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{2, 2, 1}, {28, 28, 2}}, 0, 1}, // Large scenery (all directions)
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
|
||||||
{{{2, 2, 1}, {28, 28, 2}}, 0, 1},
|
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1}, // Flat to steep large 1
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1}, // Flat to steep large 1
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
{{{0, 0, 0}, {1, 1, 8}}, 0, 1},
|
||||||
@@ -680,16 +680,32 @@ bool WoodenASupportsPaintSetup(
|
|||||||
return hasSupports;
|
return hasSupports;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t GetSpecialOffsetForTransitionType(WoodenSupportTransitionType transitionType, Direction direction)
|
||||||
|
{
|
||||||
|
if (transitionType == WoodenSupportTransitionType::None)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// "Special" values are an offset into tables like Byte97B23C, plus 1.
|
||||||
|
// Save for WoodenSupportTransitionType::LargeScenery, there are four entries (one per direction) for every
|
||||||
|
// transition type. While these tables will have to be refactored in due course, we can only do so once all
|
||||||
|
// drawing functions use WoodenSupportTransitionType instead of passing the "special" value directly.
|
||||||
|
int32_t specialOffset = 0;
|
||||||
|
if (transitionType < WoodenSupportTransitionType::Scenery)
|
||||||
|
specialOffset = (EnumValue(transitionType) * NumOrthogonalDirections) + direction;
|
||||||
|
else if (transitionType == WoodenSupportTransitionType::Scenery)
|
||||||
|
specialOffset = (EnumValue(transitionType) * NumOrthogonalDirections);
|
||||||
|
else
|
||||||
|
specialOffset = (EnumValue(transitionType) * NumOrthogonalDirections) + direction - 3;
|
||||||
|
|
||||||
|
return specialOffset + 1;
|
||||||
|
}
|
||||||
|
|
||||||
bool WoodenASupportsPaintSetup(
|
bool WoodenASupportsPaintSetup(
|
||||||
PaintSession& session, WoodenSupportType supportType, WoodenSupportSubType subType, int32_t height, ImageId imageTemplate,
|
PaintSession& session, WoodenSupportType supportType, WoodenSupportSubType subType, int32_t height, ImageId imageTemplate,
|
||||||
WoodenSupportTransitionType transitionType, Direction direction)
|
WoodenSupportTransitionType transitionType, Direction direction)
|
||||||
{
|
{
|
||||||
int32_t oldSupportType = (EnumValue(supportType) * 6) + EnumValue(subType);
|
int32_t oldSupportType = (EnumValue(supportType) * 6) + EnumValue(subType);
|
||||||
int32_t special = 0;
|
int32_t special = GetSpecialOffsetForTransitionType(transitionType, direction);
|
||||||
if (transitionType != WoodenSupportTransitionType::None)
|
|
||||||
{
|
|
||||||
special = (EnumValue(transitionType) * NumOrthogonalDirections) + direction + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WoodenASupportsPaintSetup(session, oldSupportType, special, height, imageTemplate);
|
return WoodenASupportsPaintSetup(session, oldSupportType, special, height, imageTemplate);
|
||||||
}
|
}
|
||||||
@@ -829,11 +845,7 @@ bool WoodenBSupportsPaintSetup(
|
|||||||
WoodenSupportTransitionType transitionType, Direction direction)
|
WoodenSupportTransitionType transitionType, Direction direction)
|
||||||
{
|
{
|
||||||
int32_t oldSupportType = (EnumValue(supportType) * 6) + EnumValue(subType);
|
int32_t oldSupportType = (EnumValue(supportType) * 6) + EnumValue(subType);
|
||||||
int32_t special = 0;
|
int32_t special = GetSpecialOffsetForTransitionType(transitionType, direction);
|
||||||
if (transitionType != WoodenSupportTransitionType::None)
|
|
||||||
{
|
|
||||||
special = (EnumValue(transitionType) * NumOrthogonalDirections) + direction + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WoodenBSupportsPaintSetup(session, oldSupportType, special, height, imageTemplate);
|
return WoodenBSupportsPaintSetup(session, oldSupportType, special, height, imageTemplate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ enum class WoodenSupportTransitionType : uint8_t
|
|||||||
Up25DegToUp60Deg = 3,
|
Up25DegToUp60Deg = 3,
|
||||||
Up60DegToUp25Deg = 4,
|
Up60DegToUp25Deg = 4,
|
||||||
Up60Deg = 5,
|
Up60Deg = 5,
|
||||||
|
Scenery = 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
// There are 13 types of metal supports. A graphic showing all of them is available here:
|
// There are 13 types of metal supports. A graphic showing all of them is available here:
|
||||||
|
|||||||
@@ -61,15 +61,16 @@ static void PaintLargeScenerySupports(
|
|||||||
if (tile.flags & LARGE_SCENERY_TILE_FLAG_NO_SUPPORTS)
|
if (tile.flags & LARGE_SCENERY_TILE_FLAG_NO_SUPPORTS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto special = 0;
|
auto transitionType = WoodenSupportTransitionType::None;
|
||||||
auto supportHeight = height;
|
auto supportHeight = height;
|
||||||
if (supportHeight & 0xF)
|
if (supportHeight & 0xF)
|
||||||
{
|
{
|
||||||
supportHeight &= ~0xF;
|
supportHeight &= ~0xF;
|
||||||
special = 49;
|
transitionType = WoodenSupportTransitionType::Scenery;
|
||||||
}
|
}
|
||||||
|
|
||||||
WoodenBSupportsPaintSetup(session, (direction & 1), special, supportHeight, imageTemplate);
|
WoodenBSupportsPaintSetupRotated(
|
||||||
|
session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, supportHeight, imageTemplate, transitionType);
|
||||||
|
|
||||||
int32_t clearanceHeight = Ceil2(tileElement.GetClearanceZ() + 15, 16);
|
int32_t clearanceHeight = Ceil2(tileElement.GetClearanceZ() + 15, 16);
|
||||||
if (tile.flags & LARGE_SCENERY_TILE_FLAG_ALLOW_SUPPORTS_ABOVE)
|
if (tile.flags & LARGE_SCENERY_TILE_FLAG_ALLOW_SUPPORTS_ABOVE)
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ static void PaintSmallScenerySupports(
|
|||||||
if (sceneryEntry.HasFlag(SMALL_SCENERY_FLAG_NO_SUPPORTS))
|
if (sceneryEntry.HasFlag(SMALL_SCENERY_FLAG_NO_SUPPORTS))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto special = 0;
|
auto transitionType = WoodenSupportTransitionType::None;
|
||||||
auto supportHeight = height;
|
auto supportHeight = height;
|
||||||
if (supportHeight & 0xF)
|
if (supportHeight & 0xF)
|
||||||
{
|
{
|
||||||
supportHeight &= ~0xF;
|
supportHeight &= ~0xF;
|
||||||
special = 49;
|
transitionType = WoodenSupportTransitionType::Scenery;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto supportImageTemplate = ImageId().WithRemap(0);
|
auto supportImageTemplate = ImageId().WithRemap(0);
|
||||||
@@ -60,8 +60,9 @@ static void PaintSmallScenerySupports(
|
|||||||
supportImageTemplate = imageTemplate;
|
supportImageTemplate = imageTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto supportType = (direction & 1) ? 1 : 0;
|
WoodenBSupportsPaintSetupRotated(
|
||||||
WoodenBSupportsPaintSetup(session, supportType, special, supportHeight, supportImageTemplate);
|
session, WoodenSupportType::Truss, WoodenSupportSubType::NeSw, direction, supportHeight, supportImageTemplate,
|
||||||
|
transitionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetSupportHeights(
|
static void SetSupportHeights(
|
||||||
|
|||||||
Reference in New Issue
Block a user