Skip to content

Commit

Permalink
Refactor metal support placement
Browse files Browse the repository at this point in the history
  • Loading branch information
Gymnasiast committed Oct 13, 2023
1 parent 88608e0 commit 8b3cb21
Show file tree
Hide file tree
Showing 42 changed files with 12,725 additions and 6,360 deletions.
6 changes: 4 additions & 2 deletions src/openrct2/paint/Supports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,10 @@ bool WoodenBSupportsPaintSetupRotated(
* rct2: 0x00663105
*/
bool MetalASupportsPaintSetup(
PaintSession& session, MetalSupportType supportTypeMember, uint8_t segment, int32_t special, int32_t height,
PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, int32_t special, int32_t height,
ImageId imageTemplate)
{
uint8_t segment = EnumValue(placement);
auto supportType = EnumValue(supportTypeMember);
SupportHeight* supportSegments = session.SupportSegments;

Expand Down Expand Up @@ -1054,9 +1055,10 @@ bool MetalASupportsPaintSetup(
* @return (Carry Flag)
*/
bool MetalBSupportsPaintSetup(
PaintSession& session, MetalSupportType supportTypeMember, uint8_t segment, int32_t special, int32_t height,
PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, int32_t special, int32_t height,
ImageId imageTemplate)
{
uint8_t segment = EnumValue(placement);
auto supportType = EnumValue(supportTypeMember);
SupportHeight* supportSegments = session.SupportSegments;
uint8_t originalSegment = segment;
Expand Down
17 changes: 15 additions & 2 deletions src/openrct2/paint/Supports.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ enum class MetalSupportType : uint8_t
BoxedCoated,
};

enum class MetalSupportPlace : uint8_t
{
Corner0 = 0,
Corner1 = 1,
Corner2 = 2,
Corner3 = 3,
Centre = 4,
Side0 = 5,
Side1 = 6,
Side2 = 7,
Side3 = 8,
};

bool WoodenASupportsPaintSetup(
PaintSession& session, int32_t supportType, int32_t special, int32_t height, ImageId imageTemplate);
bool WoodenASupportsPaintSetup(
Expand All @@ -111,10 +124,10 @@ bool WoodenBSupportsPaintSetupRotated(
PaintSession& session, WoodenSupportType supportType, WoodenSupportSubType subType, Direction direction, int32_t height,
ImageId imageTemplate, WoodenSupportTransitionType transitionType = WoodenSupportTransitionType::None);
bool MetalASupportsPaintSetup(
PaintSession& session, MetalSupportType supportTypeMember, uint8_t segment, int32_t special, int32_t height,
PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, int32_t special, int32_t height,
ImageId imageTemplate);
bool MetalBSupportsPaintSetup(
PaintSession& session, MetalSupportType supportTypeMember, uint8_t segment, int32_t special, int32_t height,
PaintSession& session, MetalSupportType supportTypeMember, MetalSupportPlace placement, int32_t special, int32_t height,
ImageId imageTemplate);
bool PathASupportsPaintSetup(
PaintSession& session, int32_t supportType, int32_t special, int32_t height, ImageId imageTemplate,
Expand Down
21 changes: 11 additions & 10 deletions src/openrct2/ride/TrackPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ const int32_t DiagBlockedSegments[] = {
SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_C8,
};

const uint8_t DiagSupportSegments[] = {
1,
0,
2,
3,
const MetalSupportPlace DiagSupportPlacement[] = {
MetalSupportPlace::Corner1,
MetalSupportPlace::Corner0,
MetalSupportPlace::Corner2,
MetalSupportPlace::Corner3,
};

const uint8_t track_map_1x4[][4] = {
Expand Down Expand Up @@ -953,13 +953,13 @@ void TrackPaintUtilDrawStationMetalSupports2(
{
if (direction & 1)
{
MetalASupportsPaintSetup(session, type, 6, 0, height, colour);
MetalASupportsPaintSetup(session, type, 7, 0, height, colour);
MetalASupportsPaintSetup(session, type, MetalSupportPlace::Side1, 0, height, colour);
MetalASupportsPaintSetup(session, type, MetalSupportPlace::Side2, 0, height, colour);
}
else
{
MetalASupportsPaintSetup(session, type, 5, 0, height, colour);
MetalASupportsPaintSetup(session, type, 8, 0, height, colour);
MetalASupportsPaintSetup(session, type, MetalSupportPlace::Side0, 0, height, colour);
MetalASupportsPaintSetup(session, type, MetalSupportPlace::Side3, 0, height, colour);
}
}

Expand Down Expand Up @@ -2173,7 +2173,8 @@ void TrackPaintUtilLeftCorkscrewUpSupports(PaintSession& session, Direction dire
session, PaintUtilRotateSegments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF,
0);
}
MetalASupportsPaintSetup(session, MetalSupportType::Tubes, 4, 0, height, session.TrackColours[SCHEME_SUPPORTS]);
MetalASupportsPaintSetup(
session, MetalSupportType::Tubes, MetalSupportPlace::Centre, 0, height, session.TrackColours[SCHEME_SUPPORTS]);
if (direction != 2)
{
PaintUtilSetSegmentSupportHeight(
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/ride/TrackPaint.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern const uint8_t edges_4x4[];
extern const uint8_t track_map_1x4[][4];

extern const int32_t DiagBlockedSegments[];
extern const uint8_t DiagSupportSegments[];
extern const MetalSupportPlace DiagSupportPlacement[];

enum
{
Expand Down
Loading

0 comments on commit 8b3cb21

Please sign in to comment.