Introduce tables to group information

This commit is contained in:
duncanspumpkin 2020-10-17 18:14:48 +01:00
parent 11f2199476
commit 54a33674d3
1 changed files with 102 additions and 118 deletions

View File

@ -127,58 +127,43 @@ namespace HybridRC
paint_session* session, uint16_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, paint_session* session, uint16_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height,
const TileElement* tileElement) const TileElement* tileElement)
{ {
if (tileElement->AsTrack()->HasChain()) const CoordsXYZ boundBoxOffsets[4] = {
{ { 0, 6, height },
switch (direction) { 28, 4, height - 16 },
{ 28, 4, height - 16 },
{ 0, 6, height },
};
static const CoordsXYZ boundBoxLengths[4] = {
{ 32, 20, 3 },
{ 2, 24, 93 },
{ 2, 24, 93 },
{ 32, 20, 3 },
};
static const uint32_t imageIds[2][4] = {
{ {
case 0: SPR_G2_HYBRID_LIFT_TRACK_STEEP + 12,
sub_98197C_rotated( SPR_G2_HYBRID_LIFT_TRACK_STEEP + 13,
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_LIFT_TRACK_STEEP + 12), 0, 0, 32, 20, 3, SPR_G2_HYBRID_LIFT_TRACK_STEEP + 14,
height, 0, 6, height); SPR_G2_HYBRID_LIFT_TRACK_STEEP + 15,
break; },
case 1:
session->WoodenSupportsPrependTo = sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_LIFT_TRACK_STEEP + 13), 0, 0, 2, 24, 93,
height, 28, 4, height - 16);
break;
case 2:
session->WoodenSupportsPrependTo = sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_LIFT_TRACK_STEEP + 14), 0, 0, 2, 24, 93,
height, 28, 4, height - 16);
break;
case 3:
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_LIFT_TRACK_STEEP + 15), 0, 0, 32, 20, 3,
height, 0, 6, height);
break;
}
}
else
{
switch (direction)
{ {
case 0: SPR_G2_HYBRID_TRACK_STEEP + 12,
sub_98197C_rotated( SPR_G2_HYBRID_TRACK_STEEP + 13,
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_STEEP + 12), 0, 0, 32, 20, 3, height, SPR_G2_HYBRID_TRACK_STEEP + 14,
0, 6, height); SPR_G2_HYBRID_TRACK_STEEP + 15,
break; },
case 1: };
session->WoodenSupportsPrependTo = sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_STEEP + 13), 0, 0, 2, 24, 93, height, auto* ps = sub_98197C_rotated(
28, 4, height - 16); session, direction, GetTrackColour(session) | imageIds[tileElement->AsTrack()->HasChain() ? 0 : 1][direction], 0, 0,
break; boundBoxLengths[direction].x, boundBoxLengths[direction].y, boundBoxLengths[direction].z, height,
case 2: boundBoxOffsets[direction].x, boundBoxOffsets[direction].y, boundBoxOffsets[direction].z);
session->WoodenSupportsPrependTo = sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_STEEP + 14), 0, 0, 2, 24, 93, height, if (direction == 1 || direction == 2)
28, 4, height - 16); {
break; session->WoodenSupportsPrependTo = ps;
case 3:
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_STEEP + 15), 0, 0, 32, 20, 3, height,
0, 6, height);
break;
}
} }
wooden_a_supports_paint_setup( wooden_a_supports_paint_setup(
session, direction & 1, 21 + direction, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); session, direction & 1, 21 + direction, height, session->TrackColours[SCHEME_SUPPORTS], nullptr);
if (direction == 0 || direction == 3) if (direction == 0 || direction == 3)
@ -464,32 +449,31 @@ namespace HybridRC
paint_session* session, uint16_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, paint_session* session, uint16_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height,
const TileElement* tileElement) const TileElement* tileElement)
{ {
const CoordsXYZ boundBoxOffsets[4] = {
{ 4, 6, height + 8 },
{ 24, 6, height + 8 },
{ 24, 6, height + 8 },
{ 4, 6, height + 8 },
};
static const CoordsXYZ boundBoxLengths[4] = {
{ 2, 20, 31 },
{ 2, 20, 31 },
{ 2, 20, 31 },
{ 2, 20, 31 },
};
static const uint32_t imageIds[4] = {
SPR_G2_HYBRID_TRACK_VERTICAL + 8,
SPR_G2_HYBRID_TRACK_VERTICAL + 9,
SPR_G2_HYBRID_TRACK_VERTICAL + 10,
SPR_G2_HYBRID_TRACK_VERTICAL + 11,
};
switch (trackSequence) switch (trackSequence)
{ {
case 0: case 0:
switch (direction) sub_98197C_rotated(
{ session, direction, GetTrackColour(session) | imageIds[direction], 0, 0, boundBoxLengths[direction].x,
case 0: boundBoxLengths[direction].y, boundBoxLengths[direction].z, height, boundBoxOffsets[direction].x,
sub_98197C_rotated( boundBoxOffsets[direction].y, boundBoxOffsets[direction].z);
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 8), 0, 0, 2, 20, 31,
height, 4, 6, height + 8);
break;
case 1:
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 9), 0, 0, 2, 20, 31,
height, 24, 6, height + 8);
break;
case 2:
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 10), 0, 0, 2, 20, 31,
height, 24, 6, height + 8);
break;
case 3:
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 11), 0, 0, 2, 20, 31,
height, 4, 6, height + 8);
break;
}
paint_util_set_vertical_tunnel(session, height + 32); paint_util_set_vertical_tunnel(session, height + 32);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENTS_ALL, direction), 0xFFFF, 0); paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENTS_ALL, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20); paint_util_set_general_support_height(session, height + 32, 0x20);
@ -510,32 +494,32 @@ namespace HybridRC
paint_session* session, uint16_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, paint_session* session, uint16_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height,
const TileElement* tileElement) const TileElement* tileElement)
{ {
const CoordsXYZ boundBoxOffsets[4] = {
{ 0, 6, height },
{ 24, 6, height },
{ 24, 6, height },
{ 0, 6, height },
};
static const CoordsXYZ boundBoxLengths[4] = {
{ 32, 20, 3 },
{ 2, 20, 55 },
{ 2, 20, 55 },
{ 32, 20, 3 },
};
static const uint32_t imageIds[4] = {
SPR_G2_HYBRID_TRACK_VERTICAL + 0,
SPR_G2_HYBRID_TRACK_VERTICAL + 1,
SPR_G2_HYBRID_TRACK_VERTICAL + 2,
SPR_G2_HYBRID_TRACK_VERTICAL + 3,
};
switch (trackSequence) switch (trackSequence)
{ {
case 0: case 0:
switch (direction) sub_98197C_rotated(
{ session, direction, GetTrackColour(session) | imageIds[direction], 0, 0, boundBoxLengths[direction].x,
case 0: boundBoxLengths[direction].y, boundBoxLengths[direction].z, height, boundBoxOffsets[direction].x,
sub_98197C_rotated( boundBoxOffsets[direction].y, boundBoxOffsets[direction].z);
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 0), 0, 0, 32, 20, 3,
height, 0, 6, height);
break;
case 1:
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 1), 0, 0, 2, 20, 55,
height, 24, 6, height);
break;
case 2:
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 2), 0, 0, 2, 20, 55,
height, 24, 6, height);
break;
case 3:
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 3), 0, 0, 32, 20, 3,
height, 0, 6, height);
break;
}
wooden_a_supports_paint_setup( wooden_a_supports_paint_setup(
session, direction & 1, 0, height, session->TrackColours[SCHEME_SUPPORTS], nullptr); session, direction & 1, 0, height, session->TrackColours[SCHEME_SUPPORTS], nullptr);
if (direction == 0 || direction == 3) if (direction == 0 || direction == 3)
@ -562,29 +546,29 @@ namespace HybridRC
paint_session* session, uint16_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height, paint_session* session, uint16_t rideIndex, uint8_t trackSequence, uint8_t direction, int32_t height,
const TileElement* tileElement) const TileElement* tileElement)
{ {
switch (direction) const CoordsXYZ boundBoxOffsets[4] = {
{ { 0, 6, height + 8 },
case 0: { 24, 6, height + 8 },
sub_98197C_rotated( { 24, 6, height + 8 },
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 4), 0, 0, 32, 20, 3, height, { 0, 6, height + 8 },
0, 6, height + 8); };
break; static const CoordsXYZ boundBoxLengths[4] = {
case 1: { 32, 20, 3 },
sub_98197C_rotated( { 2, 20, 31 },
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 5), 0, 0, 2, 20, 31, height, { 2, 20, 31 },
24, 6, height + 8); { 32, 20, 3 },
break; };
case 2: static const uint32_t imageIds[4] = {
sub_98197C_rotated( SPR_G2_HYBRID_TRACK_VERTICAL + 4,
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 6), 0, 0, 2, 20, 31, height, SPR_G2_HYBRID_TRACK_VERTICAL + 5,
24, 6, height + 8); SPR_G2_HYBRID_TRACK_VERTICAL + 6,
break; SPR_G2_HYBRID_TRACK_VERTICAL + 7,
case 3: };
sub_98197C_rotated(
session, direction, GetTrackColour(session) | (SPR_G2_HYBRID_TRACK_VERTICAL + 7), 0, 0, 32, 20, 3, height, sub_98197C_rotated(
0, 6, height + 8); session, direction, GetTrackColour(session) | imageIds[direction], 0, 0, boundBoxLengths[direction].x,
break; boundBoxLengths[direction].y, boundBoxLengths[direction].z, height, boundBoxOffsets[direction].x,
} boundBoxOffsets[direction].y, boundBoxOffsets[direction].z);
switch (direction) switch (direction)
{ {
case 1: case 1: