Finish diagonal pieces

This commit is contained in:
Marijn van der Werf 2016-10-15 13:37:34 +02:00
parent 12b931e723
commit 4687549185
1 changed files with 92 additions and 128 deletions

View File

@ -1807,140 +1807,104 @@ static void miniature_railway_track_diag_25_deg_down(uint8 rideIndex, uint8 trac
/** rct2: 0x008AD240 */
static void miniature_railway_track_diag_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
switch (trackSequence) {
case 0:
switch (direction) {
case 3:
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | 23446, -16, -16, 32, 32, 2, height, -16, -16, height + 8);
break;
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
break;
case 1:
switch (direction) {
case 0:
wooden_b_supports_paint_setup(2, 0, height + 16, gTrackColours[SCHEME_SUPPORTS], NULL);
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | 23447, -16, -16, 32, 32, 2, height, -16, -16, height);
break;
case 1:
wooden_b_supports_paint_setup(3, 0, height - 8, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 2:
wooden_b_supports_paint_setup(4, 0, height + 8, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 3:
wooden_b_supports_paint_setup(5, 0, height - 8, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 56, 0x20);
break;
case 2:
switch (direction) {
case 0:
wooden_b_supports_paint_setup(4, 0, height + 16, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 1:
wooden_b_supports_paint_setup(5, 0, height - 8, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 2:
wooden_b_supports_paint_setup(2, 0, height + 8, gTrackColours[SCHEME_SUPPORTS], NULL);
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | 23445, -16, -16, 32, 32, 2, height, -16, -16, height + 8);
break;
case 3:
wooden_b_supports_paint_setup(3, 0, height - 8, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 56, 0x20);
break;
case 3:
switch (direction) {
case 0:
case 2:
wooden_a_supports_paint_setup(0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 1:
wooden_a_supports_paint_setup(1, 0, height - 8, gTrackColours[SCHEME_SUPPORTS], NULL);
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | 23448, -16, -16, 32, 32, 2, height, -16, -16, height + 8);
break;
case 3:
wooden_a_supports_paint_setup(1, 0, height - 8, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 56, 0x20);
break;
const sint8 supportOffsets[][4] = {
{0, +16, +16, 0},
{0, -8, -8, -8},
{0, +8, +8, 0},
{0, -8, -8, -8},
};
sint8 supportFunction = WOOD_B;
if (trackSequence == 3) {
supportFunction = WOOD_A;
}
bool hasSupports = false;
uint32 floorImage;
rct_xy16 floorBoundSize, floorBoundOffset;
sint16 supportType = monorail_diag_support_types[direction][trackSequence];
if (supportType != -1) {
floorImage = floors[supportType].image_id;
floorBoundSize = floors[supportType].bound_size;
floorBoundOffset = floors[supportType].bound_offset;
hasSupports = wooden_supports_paint_setup(supportFunction, supportType, 0, height + supportOffsets[direction][trackSequence], gTrackColours[SCHEME_SUPPORTS], NULL);
}
if (direction == 1 && trackSequence == 3) {
floorBoundOffset = (rct_xy16) {-16, -16};
}
const sint8 offsetsB[4][4][2] = {
{{0, 0}, {+8, +8}, {+8, +8}, {-8, -8}},
{{0, 0}, {-8, -8}, {-8, -8}, {-8, 0}},
{{0, 0}, {+8, +8}, {+8, +16}, {-8, -8}},
{{0, 0}, {-8, -8}, {-8, -8}, {-8, -8}},
};
uint32 imageId = miniature_railway_track_pieces_diag_25_deg_up_to_flat[(direction + 2) % 4];
bool drawRail = monorail_diag_image_segment[direction][trackSequence];
const sint8 railOffsets[] = {0, +8, +8, +8};
if (hasSupports) {
sub_98197C(
floorImage | gTrackColours[SCHEME_SUPPORTS],
0, 0,
floorBoundSize.x, floorBoundSize.y, (drawRail ? 2 : 0),
height + offsetsB[direction][trackSequence][0],
floorBoundOffset.x, floorBoundOffset.y, height + offsetsB[direction][trackSequence][1],
get_current_rotation()
);
if (drawRail) {
sub_98199C(imageId | gTrackColours[SCHEME_TRACK], -16, -16, 32, 32, 2, height, -16, -16, height + railOffsets[direction], get_current_rotation());
}
} else if (drawRail) {
sub_98197C(imageId | gTrackColours[SCHEME_TRACK], -16, -16, 32, 32, 2, height, -16, -16, height + railOffsets[direction], get_current_rotation());
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 56, 0x20);
}
static void miniature_railway_track_diag_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
switch (trackSequence) {
case 0:
switch (direction) {
case 3:
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | 23442, -16, -16, 32, 32, 2, height, -16, -16, height);
break;
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
break;
case 1:
switch (direction) {
case 0:
wooden_a_supports_paint_setup(2, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | 23443, -16, -16, 32, 32, 2, height, -16, -16, height);
break;
case 1:
wooden_a_supports_paint_setup(3, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 2:
wooden_a_supports_paint_setup(4, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 3:
wooden_a_supports_paint_setup(5, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);
break;
case 2:
switch (direction) {
case 0:
wooden_a_supports_paint_setup(4, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 1:
wooden_a_supports_paint_setup(5, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 2:
wooden_a_supports_paint_setup(2, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | 23441, -16, -16, 32, 32, 2, height, -16, -16, height);
break;
case 3:
wooden_a_supports_paint_setup(3, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);
break;
case 3:
switch (direction) {
case 0:
case 2:
wooden_a_supports_paint_setup(0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
case 1:
wooden_a_supports_paint_setup(1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | 23444, -16, -16, 32, 32, 2, height, -16, -16, height);
break;
case 3:
wooden_a_supports_paint_setup(1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
break;
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);
break;
bool hasSupports = false;
uint32 floorImage;
rct_xy16 floorBoundSize, floorBoundOffset;
sint16 supportType = monorail_diag_support_types[direction][trackSequence];
if (supportType != -1) {
floorImage = floors[supportType].image_id;
floorBoundSize = floors[supportType].bound_size;
floorBoundOffset = floors[supportType].bound_offset;
hasSupports = wooden_a_supports_paint_setup(supportType, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
}
if (direction == 1 && trackSequence == 3) {
floorBoundOffset = (rct_xy16) {-16, -16};
}
uint32 imageId = miniature_railway_track_pieces_diag_flat_to_25_deg_up[(direction + 2) % 4];
bool drawRail = monorail_diag_image_segment[direction][trackSequence];
if (hasSupports) {
sub_98197C(
floorImage | gTrackColours[SCHEME_SUPPORTS],
0, 0,
floorBoundSize.x, floorBoundSize.y, (drawRail ? 2 : 0),
height,
floorBoundOffset.x, floorBoundOffset.y, height,
get_current_rotation()
);
if (drawRail) {
sub_98199C(imageId | gTrackColours[SCHEME_TRACK], -16, -16, 32, 32, 2, height, -16, -16, height, get_current_rotation());
}
} else if (drawRail) {
sub_98197C(imageId | gTrackColours[SCHEME_TRACK], -16, -16, 32, 32, 2, height, -16, -16, height, get_current_rotation());
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(height + 48, 0x20);
}
/**