From 551962123a8db205d697b7e8e5885139f7bd21a2 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 23 Oct 2016 14:19:49 +0200 Subject: [PATCH] Reorganise file to minimise diffs --- src/ride/coaster/junior_roller_coaster.c | 1459 +++++++++++----------- 1 file changed, 729 insertions(+), 730 deletions(-) diff --git a/src/ride/coaster/junior_roller_coaster.c b/src/ride/coaster/junior_roller_coaster.c index ddcb094f4d..4b3f96a996 100644 --- a/src/ride/coaster/junior_roller_coaster.c +++ b/src/ride/coaster/junior_roller_coaster.c @@ -1804,6 +1804,57 @@ void junior_rc_paint_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 dire paint_util_set_general_support_height(height + 32, 0x20); } +void junior_rc_paint_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, uint8 rideType) { + rct_ride * ride = get_ride(rideIndex); + const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style]; + uint32 imageId = entranceStyle->base_image_id; + if (!(gTrackColours[SCHEME_MISC] & (1 << 29))) { + imageId &= 0x7FFFF; + } + + bool isBraked = (bool)(mapElement->flags & MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED); + + if (direction == 0 || direction == 2) { + // height -= 2 (height - 2) + imageId = SPR_STATION_BASE_B_SW_NE | gTrackColours[SCHEME_MISC]; + sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation()); + + // height += 2 (height) + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER) { + imageId = junior_rc_track_pieces_block_brake[isBraked][direction] | gTrackColours[SCHEME_TRACK]; + }else{ + imageId = junior_rc_track_pieces_station[false][direction] | gTrackColours[SCHEME_TRACK]; + } + sub_98199C(imageId, 0, 6, 32, 20, 1, height, 0, 0, height, get_current_rotation()); + + metal_a_supports_paint_setup(3, 5, 0, height, gTrackColours[SCHEME_SUPPORTS]); + metal_a_supports_paint_setup(3, 8, 0, height, gTrackColours[SCHEME_SUPPORTS]); + + paint_util_push_tunnel_left(height, TUNNEL_6); + } else if (direction == 1 || direction == 3) { + // height -= 2 (height - 2) + imageId = SPR_STATION_BASE_B_NW_SE | gTrackColours[SCHEME_MISC]; + sub_98197C(imageId, 0, 0, 28, 32, 1, height - 2, 2, 0, height, get_current_rotation()); + + // height += 2 (height) + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER) { + imageId = junior_rc_track_pieces_block_brake[isBraked][direction] | gTrackColours[SCHEME_TRACK]; + }else{ + imageId = junior_rc_track_pieces_station[false][direction] | gTrackColours[SCHEME_TRACK]; + } + sub_98199C(imageId, 6, 0, 20, 32, 1, height, 0, 0, height, get_current_rotation()); + + metal_a_supports_paint_setup(3, 6, 0, height, gTrackColours[SCHEME_SUPPORTS]); + metal_a_supports_paint_setup(3, 7, 0, height, gTrackColours[SCHEME_SUPPORTS]); + paint_util_push_tunnel_right(height, TUNNEL_6); + } + + track_paint_util_draw_station(rideIndex, trackSequence, direction, height, mapElement); + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); +} + void junior_rc_paint_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) { uint32 imageId = junior_rc_track_pieces_25_deg_up[chainType][direction] | gTrackColours[SCHEME_TRACK]; @@ -1822,78 +1873,6 @@ void junior_rc_paint_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 paint_util_set_general_support_height(height + 56, 0x20); } -static const rct_xy16 junior_rc_60_deg_up_bound_offsets[4] = { - {0, 6}, - {10, 29}, - {29, 10}, - {6, 0}, -}; - -static const rct_xy16 junior_rc_60_deg_up_tile_offsets[4] = { - {0, 6}, - {6, 0}, - {0, 6}, - {6, 0}, -}; - -static const sint8 junior_rc_60_deg_up_bound_thickness[4] = { - 1, - 75, - 75, - 1 -}; - -static const rct_xy16 junior_rc_60_deg_up_bound_lengths[4] = { - {32, 20}, - {10, 1}, - {1, 10}, - {20, 32}, -}; - -void junior_rc_paint_track_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - uint32 image_id = gTrackColours[SCHEME_TRACK]; - - image_id |= junior_rc_track_pieces_60_deg_up[chainType][direction]; - - sub_98197C(image_id, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, - junior_rc_60_deg_up_bound_lengths[direction].x, - junior_rc_60_deg_up_bound_lengths[direction].y, - junior_rc_60_deg_up_bound_thickness[direction], - height, - junior_rc_60_deg_up_bound_offsets[direction].x, - junior_rc_60_deg_up_bound_offsets[direction].y, - height, - get_current_rotation()); - - switch (direction) { - case 0: - paint_util_push_tunnel_left(height - 8, TUNNEL_1); - break; - case 1: - paint_util_push_tunnel_right(height + 56, TUNNEL_2); - break; - case 2: - paint_util_push_tunnel_left(height + 56, TUNNEL_2); - break; - case 3: - paint_util_push_tunnel_right(height - 8, TUNNEL_1); - break; - } - - const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y}; - - sint8 support[4] = { 35, 29, 25, 32}; - if (track_paint_util_should_paint_supports(pos)) { - metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, support[direction], height, gTrackColours[SCHEME_SUPPORTS]); - } - - paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 104, 0x20); -} - void junior_rc_paint_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) { uint32 imageId = junior_rc_track_pieces_flat_to_25_deg_up[chainType][direction] | gTrackColours[SCHEME_TRACK]; @@ -1915,151 +1894,6 @@ void junior_rc_paint_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequenc paint_util_set_general_support_height(height + 48, 0x20); } -static const rct_xy16 junior_rc_25_deg_up_to_60_deg_up_bound_lengths[4][2] = { - {{32, 20}, {0}}, - {{10, 32}, {2, 32}}, - {{32, 10}, {32, 2}}, - {{20, 32}, {0}}, -}; - -static const sint8 junior_rc_25_deg_up_to_60_deg_up_bound_thickness[4] = { - 1, - 43, - 43, - 1 -}; - -static const rct_xy16 junior_rc_25_deg_up_to_60_deg_up_bound_offsets[4][2] = { - {{0, 6}, {0}}, - {{10, 0}, {4, 0}}, - {{0, 10}, {0, 4}}, - {{6, 0}, {0}}, -}; - -void junior_rc_paint_track_25_deg_up_to_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - uint32 image_id = gTrackColours[SCHEME_TRACK]; - - image_id |= junior_rc_track_pieces_25_deg_up_to_60_deg_up[chainType][direction][0]; - - sub_98197C(image_id, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, - junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].x, - junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].y, - junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction], - height, - junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].x, - junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].y, - height, - get_current_rotation()); - - if (junior_rc_track_pieces_25_deg_up_to_60_deg_up[chainType][direction][1] != 0) { - image_id = gTrackColours[SCHEME_TRACK]; - - image_id |= junior_rc_track_pieces_25_deg_up_to_60_deg_up[chainType][direction][1]; - - sub_98197C(image_id, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, - junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].x, - junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].y, - junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction], - height, - junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].x, - junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].y, - height, - get_current_rotation()); - } - - switch (direction) { - case 0: - paint_util_push_tunnel_left(height - 8, TUNNEL_1); - break; - case 1: - paint_util_push_tunnel_right(height + 24, TUNNEL_2); - break; - case 2: - paint_util_push_tunnel_left(height + 24, TUNNEL_2); - break; - case 3: - paint_util_push_tunnel_right(height - 8, TUNNEL_1); - break; - } - - const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y}; - - sint8 support[4] = { 12, 12, 12, 14}; - if (track_paint_util_should_paint_supports(pos)) { - metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, support[direction], height, gTrackColours[SCHEME_SUPPORTS]); - } - - paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 72, 0x20); -} - -void junior_rc_paint_track_60_deg_up_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - uint32 image_id = gTrackColours[SCHEME_TRACK]; - - image_id |= junior_rc_track_pieces_60_deg_up_to_25_deg_up[chainType][direction][0]; - - sub_98197C(image_id, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, - junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].x, - junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].y, - junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction], - height, - junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].x, - junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].y, - height, - get_current_rotation()); - - if (junior_rc_track_pieces_60_deg_up_to_25_deg_up[chainType][direction][1] != 0) { - image_id = gTrackColours[SCHEME_TRACK]; - - image_id |= junior_rc_track_pieces_60_deg_up_to_25_deg_up[chainType][direction][1]; - - sub_98197C(image_id, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, - (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, - junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].x, - junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].y, - junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction], - height, - junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].x, - junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].y, - height, - get_current_rotation()); - } - - switch (direction) { - case 0: - paint_util_push_tunnel_left(height - 8, TUNNEL_1); - break; - case 1: - paint_util_push_tunnel_right(height + 24, TUNNEL_2); - break; - case 2: - paint_util_push_tunnel_left(height + 24, TUNNEL_2); - break; - case 3: - paint_util_push_tunnel_right(height - 8, TUNNEL_1); - break; - } - - const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y}; - - if (track_paint_util_should_paint_supports(pos)) { - metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 20, height, gTrackColours[SCHEME_SUPPORTS]); - } - - paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 72, 0x20); -} - - void junior_rc_paint_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) { uint32 imageId = junior_rc_track_pieces_25_deg_up_to_flat[chainType][direction] | gTrackColours[SCHEME_TRACK]; @@ -2095,519 +1929,6 @@ void junior_rc_paint_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequenc paint_util_set_general_support_height(height + 40, 0x20); } -void junior_rc_paint_track_left_quarter_turn_5_tiles_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_right_quarter_turn_5_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_left_quarter_turn_5_tiles_25_deg_up[chainType], junior_rc_left_quarter_turn_5_tiles_25_deg_up_offsets, defaultRightQuarterTurn5TilesBoundLengths, NULL, get_current_rotation()); - - uint8 supportSpecial[4] = { 8, 8, 8, 3 }; - switch (trackSequence) { - case 0: - metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, (direction == 0 || direction == 3) ? 10 : 8, height, gTrackColours[SCHEME_SUPPORTS]); - break; - case 6: - metal_a_supports_paint_setup((direction & 1) ? 1 : 2, 4, supportSpecial[direction], height, gTrackColours[SCHEME_SUPPORTS]); - break; - } - - if (direction == 0 && trackSequence == 0) { - paint_util_push_tunnel_left(height - 8, TUNNEL_1); - } - if (direction == 2 && trackSequence == 6) { - paint_util_push_tunnel_right(height + 8, TUNNEL_2); - } - if (direction == 3 && trackSequence == 0) { - paint_util_push_tunnel_right(height - 8, TUNNEL_1); - } - if (direction == 3 && trackSequence == 6) { - paint_util_push_tunnel_left(height + 8, TUNNEL_2); - } - - switch (trackSequence) { - case 0: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction), 0xFFFF, 0); break; - case 2: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); break; - case 3: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_BC | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); break; - case 5: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 0xFFFF, 0); break; - case 6: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_C0, direction), 0xFFFF, 0); break; - } - if (trackSequence == 3) { - paint_util_set_general_support_height(height + 64, 0x20); - } - else { - paint_util_set_general_support_height(height + 72, 0x20); - } -} - -void junior_rc_paint_track_right_quarter_turn_5_tiles_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_right_quarter_turn_5_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_right_quarter_turn_5_tiles_25_deg_up[chainType], defaultRightQuarterTurn5TilesOffsets, defaultRightQuarterTurn5TilesBoundLengths, NULL, get_current_rotation()); - - uint8 supportSpecial[4] = { 11, 8, 8, 7 }; - switch (trackSequence) { - case 0: - metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, supportSpecial[direction], height, gTrackColours[SCHEME_SUPPORTS]); - break; - case 6: - metal_a_supports_paint_setup((direction & 1) ? 1 : 2, 4, 8, height, gTrackColours[SCHEME_SUPPORTS]); - break; - } - - if (direction == 0 && trackSequence == 0) { - paint_util_push_tunnel_left(height - 8, TUNNEL_1); - } - if (direction == 0 && trackSequence == 6) { - paint_util_push_tunnel_right(height + 8, TUNNEL_2); - } - if (direction == 3 && trackSequence == 0) { - paint_util_push_tunnel_right(height - 8, TUNNEL_1); - } - if (direction == 1 && trackSequence == 6) { - paint_util_push_tunnel_left(height + 8, TUNNEL_2); - } - - switch (trackSequence) { - case 0: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); break; - case 2: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 0xFFFF, 0); break; - case 3: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); break; - case 5: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 0xFFFF, 0); break; - case 6: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), 0xFFFF, 0); break; - } - if (trackSequence == 3) { - paint_util_set_general_support_height(height + 64, 0x20); - } - else { - paint_util_set_general_support_height(height + 72, 0x20); - } -} - -void junior_rc_paint_track_right_quarter_turn_3_tiles_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - uint32 imageId = 0; - rct_xy16 offset; - rct_xy16 boundsLength; - rct_xy16 boundsOffset; - - switch (trackSequence) { - case 0: - imageId = junior_rc_track_pieces_right_quarter_turn_3_tiles_25_deg_up[chainType][direction][0] | gTrackColours[SCHEME_TRACK]; - offset = defaultRightQuarterTurn3TilesOffsets[direction][0]; - boundsLength = defaultRightQuarterTurn3TilesBoundLengths[direction][0]; - boundsOffset = offset; - break; - case 3: - imageId = junior_rc_track_pieces_right_quarter_turn_3_tiles_25_deg_up[chainType][direction][1] | gTrackColours[SCHEME_TRACK]; - offset = defaultRightQuarterTurn3TilesOffsets[direction][2]; - boundsLength = defaultRightQuarterTurn3TilesBoundLengths[direction][2]; - boundsOffset = offset; - break; - } - if (imageId != 0) - sub_98197C(imageId, (sint8)offset.x, (sint8)offset.y, boundsLength.x, boundsLength.y, 1, height, boundsOffset.x, boundsOffset.y, height, get_current_rotation()); - - - if (direction == 0 && trackSequence == 0) { - paint_util_push_tunnel_left(height - 8, TUNNEL_1); - } - - if (direction == 0 && trackSequence == 3) { - paint_util_push_tunnel_right(height + 8, TUNNEL_2); - } - - if (direction == 1 && trackSequence == 3) { - paint_util_push_tunnel_left(height + 8, TUNNEL_2); - } - - if (direction == 3 && trackSequence == 0) { - paint_util_push_tunnel_right(height - 8, TUNNEL_1); - } - - uint8 supportType[2][4] = { - { 1, 0, 0, 2}, - { 2, 0, 0, 1} - }; - switch (trackSequence) { - case 0: - case 3: - metal_a_supports_paint_setup(supportType[direction & 1][trackSequence], 4, 8, height, gTrackColours[SCHEME_SUPPORTS]); - break; - } - - int blockedSegments = 0; - switch (trackSequence) { - case 0: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; break; - case 3: blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; break; - } - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - - if (trackSequence == 0 || trackSequence == 3) - paint_util_set_general_support_height(height + 72, 0x20); - else - paint_util_set_general_support_height(height + 56, 0x20); -} - -void junior_rc_paint_track_right_quarter_turn_3_tiles_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - uint32 imageId = 0; - rct_xy16 offset; - rct_xy16 boundsLength; - rct_xy16 boundsOffset; - - switch (trackSequence) { - case 0: - imageId = junior_rc_track_pieces_right_quarter_turn_3_tiles_25_deg_down[chainType][direction][0] | gTrackColours[SCHEME_TRACK]; - offset = defaultRightQuarterTurn3TilesOffsets[direction][0]; - boundsLength = defaultRightQuarterTurn3TilesBoundLengths[direction][0]; - boundsOffset = offset; - break; - case 3: - imageId = junior_rc_track_pieces_right_quarter_turn_3_tiles_25_deg_down[chainType][direction][1] | gTrackColours[SCHEME_TRACK]; - offset = defaultRightQuarterTurn3TilesOffsets[direction][2]; - boundsLength = defaultRightQuarterTurn3TilesBoundLengths[direction][2]; - boundsOffset = offset; - break; - } - if (imageId != 0) - sub_98197C(imageId, (sint8)offset.x, (sint8)offset.y, boundsLength.x, boundsLength.y, 1, height, boundsOffset.x, boundsOffset.y, height, get_current_rotation()); - - if (direction == 0 && trackSequence == 0) { - paint_util_push_tunnel_left(height + 8, TUNNEL_2); - } - - if (direction == 0 && trackSequence == 3) { - paint_util_push_tunnel_right(height - 8, TUNNEL_1); - } - - if (direction == 1 && trackSequence == 3) { - paint_util_push_tunnel_left(height - 8, TUNNEL_1); - } - - if (direction == 3 && trackSequence == 0) { - paint_util_push_tunnel_right(height + 8, TUNNEL_2); - } - - uint8 supportType[2][4] = { - { 1, 0, 0, 2}, - { 2, 0, 0, 1} - }; - switch (trackSequence) { - case 0: - case 3: - metal_a_supports_paint_setup(supportType[direction & 1][trackSequence], 4, 8, height, gTrackColours[SCHEME_SUPPORTS]); - break; - } - - int blockedSegments = 0; - switch (trackSequence) { - case 0: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; break; - case 3: blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; break; - } - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - - if (trackSequence == 0 || trackSequence == 3) - paint_util_set_general_support_height(height + 72, 0x20); - else - paint_util_set_general_support_height(height + 56, 0x20); -} - -static const int junior_rc_diag_blocked_segments[] = { - SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4 | SEGMENT_BC, - SEGMENT_C4 | SEGMENT_CC | SEGMENT_C8 | SEGMENT_B4, - SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C0 | SEGMENT_D4, - SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_C8 -}; - -static const uint8 junior_rc_diag_support_segment[] = {1, 0, 2, 3}; - -void junior_rc_paint_track_diag_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 32, 0x20); -} - -void junior_rc_paint_track_diag_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 56, 0x20); -} - -void junior_rc_paint_track_diag_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 36, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 104, 0x20); -} - -void junior_rc_paint_track_diag_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat_to_25_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 48, 0x20); -} - -void junior_rc_paint_track_diag_25_deg_up_to_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up_to_60_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 16, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 72, 0x20); -} - -void junior_rc_paint_track_diag_60_deg_up_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - if (direction == 1 && trackSequence == 3) { - sub_98197C( - junior_rc_track_pieces_diag_60_deg_up_to_25_deg_up[chainType][direction] | gTrackColours[SCHEME_TRACK], - -16, -16, - 16, 16, 1, - height, - 0, 0, height, - get_current_rotation() - ); - } else { - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_up_to_25_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - } - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 21, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 72, 0x20); -} - -void junior_rc_paint_track_diag_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up_to_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 56, 0x20); -} - -void junior_rc_paint_track_diag_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 56, 0x20); -} - -void junior_rc_paint_track_diag_60_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 28, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 104, 0x20); -} - -void junior_rc_paint_track_diag_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat_to_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 56, 0x20); -} - -void junior_rc_paint_track_diag_25_deg_down_to_60_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - if (direction == 3 && trackSequence == 0) { - sub_98197C( - junior_rc_track_pieces_diag_25_deg_down_to_60_deg_down[chainType][direction] | gTrackColours[SCHEME_TRACK], - -16, -16, - 16, 16, 1, - height, - 0, 0, height, - get_current_rotation() - ); - } else { - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_down_to_60_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - } - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 17, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 72, 0x20); -} - -void junior_rc_paint_track_diag_60_deg_down_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_down_to_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 72, 0x20); -} - -void junior_rc_paint_track_diag_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) -{ - track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_down_to_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); - - if (trackSequence == 3) { - metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]); - } - - int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; - paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); - paint_util_set_general_support_height(height + 48, 0x20); -} - -/* rct2: 0x00518394 */ -static void junior_rc_flat_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement){ - bool isChained = track_element_is_lift_hill(mapElement); - junior_rc_paint_track_flat(rideIndex, trackSequence, direction, height, mapElement, isChained ? JUNIOR_RC_CHAIN_FRICTION_WHEELS : JUNIOR_RC_CHAIN_NONE); -} - -void junior_rc_paint_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, uint8 rideType) { - rct_ride * ride = get_ride(rideIndex); - const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style]; - uint32 imageId = entranceStyle->base_image_id; - if (!(gTrackColours[SCHEME_MISC] & (1 << 29))) { - imageId &= 0x7FFFF; - } - - bool isBraked = (bool)(mapElement->flags & MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED); - - if (direction == 0 || direction == 2) { - // height -= 2 (height - 2) - imageId = SPR_STATION_BASE_B_SW_NE | gTrackColours[SCHEME_MISC]; - sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation()); - - // height += 2 (height) - if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER) { - imageId = junior_rc_track_pieces_block_brake[isBraked][direction] | gTrackColours[SCHEME_TRACK]; - }else{ - imageId = junior_rc_track_pieces_station[false][direction] | gTrackColours[SCHEME_TRACK]; - } - sub_98199C(imageId, 0, 6, 32, 20, 1, height, 0, 0, height, get_current_rotation()); - - metal_a_supports_paint_setup(3, 5, 0, height, gTrackColours[SCHEME_SUPPORTS]); - metal_a_supports_paint_setup(3, 8, 0, height, gTrackColours[SCHEME_SUPPORTS]); - - paint_util_push_tunnel_left(height, TUNNEL_6); - } else if (direction == 1 || direction == 3) { - // height -= 2 (height - 2) - imageId = SPR_STATION_BASE_B_NW_SE | gTrackColours[SCHEME_MISC]; - sub_98197C(imageId, 0, 0, 28, 32, 1, height - 2, 2, 0, height, get_current_rotation()); - - // height += 2 (height) - if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER) { - imageId = junior_rc_track_pieces_block_brake[isBraked][direction] | gTrackColours[SCHEME_TRACK]; - }else{ - imageId = junior_rc_track_pieces_station[false][direction] | gTrackColours[SCHEME_TRACK]; - } - sub_98199C(imageId, 6, 0, 20, 32, 1, height, 0, 0, height, get_current_rotation()); - - metal_a_supports_paint_setup(3, 6, 0, height, gTrackColours[SCHEME_SUPPORTS]); - metal_a_supports_paint_setup(3, 7, 0, height, gTrackColours[SCHEME_SUPPORTS]); - paint_util_push_tunnel_right(height, TUNNEL_6); - } - - track_paint_util_draw_station(rideIndex, trackSequence, direction, height, mapElement); - - paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); - paint_util_set_general_support_height(height + 32, 0x20); -} - -/* rct2: 0x00515629, 0x00514D22, 0x005151B9 */ -static void paint_junior_rc_station_track(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) -{ - junior_rc_paint_station(rideIndex, trackSequence, direction, height, mapElement, RIDE_TYPE_JUNIOR_ROLLER_COASTER); -} - -/* rct2: 0x0051881E */ -static void junior_rc_25_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - bool isChained = track_element_is_lift_hill(mapElement); - junior_rc_paint_track_25_deg_up(rideIndex, trackSequence, direction, height, mapElement, isChained ? JUNIOR_RC_CHAIN_FRICTION_WHEELS : JUNIOR_RC_CHAIN_NONE); -} - -/* rct2: 0x00518B42 */ -static void junior_rc_flat_to_25_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - bool isChained = track_element_is_lift_hill(mapElement); - junior_rc_paint_track_flat_to_25_deg_up(rideIndex, trackSequence, direction, height, mapElement, isChained ? JUNIOR_RC_CHAIN_FRICTION_WHEELS : JUNIOR_RC_CHAIN_NONE); -} - -/* rct2: 0x00518E56 */ -static void junior_rc_25_deg_up_to_flat_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - bool isChained = track_element_is_lift_hill(mapElement); - junior_rc_paint_track_25_deg_up_to_flat(rideIndex, trackSequence, direction, height, mapElement, isChained ? JUNIOR_RC_CHAIN_FRICTION_WHEELS : JUNIOR_RC_CHAIN_NONE); -} - -/* rct2: 0x005189B0 */ -static void junior_rc_25_deg_down_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - - junior_rc_25_deg_up_paint_setup(rideIndex, trackSequence, (direction + 2) & 3, height, mapElement); -} - -/* rct2: 0x00518FE8 */ -static void junior_rc_flat_to_25_deg_down_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - - junior_rc_25_deg_up_to_flat_paint_setup(rideIndex, trackSequence, (direction + 2) & 3, height, mapElement); -} - -/* rct2: 0x00518CCC */ -static void junior_rc_25_deg_down_to_flat_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - - junior_rc_flat_to_25_deg_up_paint_setup(rideIndex, trackSequence, (direction + 2) & 3, height, mapElement); -} - static const sint8 junior_rc_track_right_quarter_turn_5_tiles_support_height_offset[][7] = { {0, 0, 0, 0, 0, 0, -1}, {-1, 0, 0, 0, 0, 0, 0}, @@ -3152,6 +2473,90 @@ static void junior_rc_right_bank_paint_setup(uint8 rideIndex, uint8 trackSequenc junior_rc_left_bank_paint_setup(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } +void junior_rc_paint_track_left_quarter_turn_5_tiles_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_right_quarter_turn_5_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_left_quarter_turn_5_tiles_25_deg_up[chainType], junior_rc_left_quarter_turn_5_tiles_25_deg_up_offsets, defaultRightQuarterTurn5TilesBoundLengths, NULL, get_current_rotation()); + + uint8 supportSpecial[4] = { 8, 8, 8, 3 }; + switch (trackSequence) { + case 0: + metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, (direction == 0 || direction == 3) ? 10 : 8, height, gTrackColours[SCHEME_SUPPORTS]); + break; + case 6: + metal_a_supports_paint_setup((direction & 1) ? 1 : 2, 4, supportSpecial[direction], height, gTrackColours[SCHEME_SUPPORTS]); + break; + } + + if (direction == 0 && trackSequence == 0) { + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + } + if (direction == 2 && trackSequence == 6) { + paint_util_push_tunnel_right(height + 8, TUNNEL_2); + } + if (direction == 3 && trackSequence == 0) { + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + } + if (direction == 3 && trackSequence == 6) { + paint_util_push_tunnel_left(height + 8, TUNNEL_2); + } + + switch (trackSequence) { + case 0: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction), 0xFFFF, 0); break; + case 2: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); break; + case 3: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_BC | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); break; + case 5: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 0xFFFF, 0); break; + case 6: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_C0, direction), 0xFFFF, 0); break; + } + if (trackSequence == 3) { + paint_util_set_general_support_height(height + 64, 0x20); + } + else { + paint_util_set_general_support_height(height + 72, 0x20); + } +} + +void junior_rc_paint_track_right_quarter_turn_5_tiles_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_right_quarter_turn_5_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_right_quarter_turn_5_tiles_25_deg_up[chainType], defaultRightQuarterTurn5TilesOffsets, defaultRightQuarterTurn5TilesBoundLengths, NULL, get_current_rotation()); + + uint8 supportSpecial[4] = { 11, 8, 8, 7 }; + switch (trackSequence) { + case 0: + metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, supportSpecial[direction], height, gTrackColours[SCHEME_SUPPORTS]); + break; + case 6: + metal_a_supports_paint_setup((direction & 1) ? 1 : 2, 4, 8, height, gTrackColours[SCHEME_SUPPORTS]); + break; + } + + if (direction == 0 && trackSequence == 0) { + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + } + if (direction == 0 && trackSequence == 6) { + paint_util_push_tunnel_right(height + 8, TUNNEL_2); + } + if (direction == 3 && trackSequence == 0) { + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + } + if (direction == 1 && trackSequence == 6) { + paint_util_push_tunnel_left(height + 8, TUNNEL_2); + } + + switch (trackSequence) { + case 0: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); break; + case 2: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 0xFFFF, 0); break; + case 3: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_C4, direction), 0xFFFF, 0); break; + case 5: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C8, direction), 0xFFFF, 0); break; + case 6: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, direction), 0xFFFF, 0); break; + } + if (trackSequence == 3) { + paint_util_set_general_support_height(height + 64, 0x20); + } + else { + paint_util_set_general_support_height(height + 72, 0x20); + } +} + /* rct2: 0x008AAE10, 0x00519D88, 0x00519DAC, 0x00519DD0, 0x00519DF4 */ static void junior_rc_left_quarter_turn_5_tiles_25_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { bool isChained = track_element_is_lift_hill(mapElement); @@ -3447,6 +2852,135 @@ static void junior_rc_right_quarter_turn_3_tiles_bank_paint_setup(uint8 rideInde paint_util_set_general_support_height(height + 32, 0x20); } +void junior_rc_paint_track_right_quarter_turn_3_tiles_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + uint32 imageId = 0; + rct_xy16 offset; + rct_xy16 boundsLength; + rct_xy16 boundsOffset; + + switch (trackSequence) { + case 0: + imageId = junior_rc_track_pieces_right_quarter_turn_3_tiles_25_deg_up[chainType][direction][0] | gTrackColours[SCHEME_TRACK]; + offset = defaultRightQuarterTurn3TilesOffsets[direction][0]; + boundsLength = defaultRightQuarterTurn3TilesBoundLengths[direction][0]; + boundsOffset = offset; + break; + case 3: + imageId = junior_rc_track_pieces_right_quarter_turn_3_tiles_25_deg_up[chainType][direction][1] | gTrackColours[SCHEME_TRACK]; + offset = defaultRightQuarterTurn3TilesOffsets[direction][2]; + boundsLength = defaultRightQuarterTurn3TilesBoundLengths[direction][2]; + boundsOffset = offset; + break; + } + if (imageId != 0) + sub_98197C(imageId, (sint8)offset.x, (sint8)offset.y, boundsLength.x, boundsLength.y, 1, height, boundsOffset.x, boundsOffset.y, height, get_current_rotation()); + + + if (direction == 0 && trackSequence == 0) { + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + } + + if (direction == 0 && trackSequence == 3) { + paint_util_push_tunnel_right(height + 8, TUNNEL_2); + } + + if (direction == 1 && trackSequence == 3) { + paint_util_push_tunnel_left(height + 8, TUNNEL_2); + } + + if (direction == 3 && trackSequence == 0) { + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + } + + uint8 supportType[2][4] = { + { 1, 0, 0, 2}, + { 2, 0, 0, 1} + }; + switch (trackSequence) { + case 0: + case 3: + metal_a_supports_paint_setup(supportType[direction & 1][trackSequence], 4, 8, height, gTrackColours[SCHEME_SUPPORTS]); + break; + } + + int blockedSegments = 0; + switch (trackSequence) { + case 0: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; break; + case 3: blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; break; + } + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + + if (trackSequence == 0 || trackSequence == 3) + paint_util_set_general_support_height(height + 72, 0x20); + else + paint_util_set_general_support_height(height + 56, 0x20); +} + +void junior_rc_paint_track_right_quarter_turn_3_tiles_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + uint32 imageId = 0; + rct_xy16 offset; + rct_xy16 boundsLength; + rct_xy16 boundsOffset; + + switch (trackSequence) { + case 0: + imageId = junior_rc_track_pieces_right_quarter_turn_3_tiles_25_deg_down[chainType][direction][0] | gTrackColours[SCHEME_TRACK]; + offset = defaultRightQuarterTurn3TilesOffsets[direction][0]; + boundsLength = defaultRightQuarterTurn3TilesBoundLengths[direction][0]; + boundsOffset = offset; + break; + case 3: + imageId = junior_rc_track_pieces_right_quarter_turn_3_tiles_25_deg_down[chainType][direction][1] | gTrackColours[SCHEME_TRACK]; + offset = defaultRightQuarterTurn3TilesOffsets[direction][2]; + boundsLength = defaultRightQuarterTurn3TilesBoundLengths[direction][2]; + boundsOffset = offset; + break; + } + if (imageId != 0) + sub_98197C(imageId, (sint8)offset.x, (sint8)offset.y, boundsLength.x, boundsLength.y, 1, height, boundsOffset.x, boundsOffset.y, height, get_current_rotation()); + + if (direction == 0 && trackSequence == 0) { + paint_util_push_tunnel_left(height + 8, TUNNEL_2); + } + + if (direction == 0 && trackSequence == 3) { + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + } + + if (direction == 1 && trackSequence == 3) { + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + } + + if (direction == 3 && trackSequence == 0) { + paint_util_push_tunnel_right(height + 8, TUNNEL_2); + } + + uint8 supportType[2][4] = { + { 1, 0, 0, 2}, + { 2, 0, 0, 1} + }; + switch (trackSequence) { + case 0: + case 3: + metal_a_supports_paint_setup(supportType[direction & 1][trackSequence], 4, 8, height, gTrackColours[SCHEME_SUPPORTS]); + break; + } + + int blockedSegments = 0; + switch (trackSequence) { + case 0: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC; break; + case 3: blockedSegments = SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8; break; + } + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + + if (trackSequence == 0 || trackSequence == 3) + paint_util_set_general_support_height(height + 72, 0x20); + else + paint_util_set_general_support_height(height + 56, 0x20); +} + /** rct2: 0x008AA0C0 */ static void junior_rc_left_quarter_turn_3_tiles_bank_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -4116,6 +3650,107 @@ static void junior_rc_right_eighth_to_orthogonal_bank_paint_setup(uint8 rideInde junior_rc_left_eighth_to_diag_bank_paint_setup(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); } +static const int junior_rc_diag_blocked_segments[] = { + SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4 | SEGMENT_BC, + SEGMENT_C4 | SEGMENT_CC | SEGMENT_C8 | SEGMENT_B4, + SEGMENT_D0 | SEGMENT_C4 | SEGMENT_C0 | SEGMENT_D4, + SEGMENT_D0 | SEGMENT_C4 | SEGMENT_B8 | SEGMENT_C8 +}; + +static const uint8 junior_rc_diag_support_segment[] = {1, 0, 2, 3}; + +void junior_rc_paint_track_diag_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); +} + +void junior_rc_paint_track_diag_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 56, 0x20); +} + +void junior_rc_paint_track_diag_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat_to_25_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 48, 0x20); +} + +void junior_rc_paint_track_diag_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up_to_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 56, 0x20); +} + +void junior_rc_paint_track_diag_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 56, 0x20); +} + +void junior_rc_paint_track_diag_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat_to_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 56, 0x20); +} + +void junior_rc_paint_track_diag_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_down_to_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 48, 0x20); +} + /** rct2: 0x008AAF10 */ static void junior_rc_diag_flat_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -4437,6 +4072,78 @@ static void junior_rc_diag_right_bank_paint_setup(uint8 rideIndex, uint8 trackSe paint_util_set_general_support_height(height + 32, 0x20); } +static const rct_xy16 junior_rc_60_deg_up_bound_offsets[4] = { + {0, 6}, + {10, 29}, + {29, 10}, + {6, 0}, +}; + +static const rct_xy16 junior_rc_60_deg_up_tile_offsets[4] = { + {0, 6}, + {6, 0}, + {0, 6}, + {6, 0}, +}; + +static const sint8 junior_rc_60_deg_up_bound_thickness[4] = { + 1, + 75, + 75, + 1 +}; + +static const rct_xy16 junior_rc_60_deg_up_bound_lengths[4] = { + {32, 20}, + {10, 1}, + {1, 10}, + {20, 32}, +}; + +void junior_rc_paint_track_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + uint32 image_id = gTrackColours[SCHEME_TRACK]; + + image_id |= junior_rc_track_pieces_60_deg_up[chainType][direction]; + + sub_98197C(image_id, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, + junior_rc_60_deg_up_bound_lengths[direction].x, + junior_rc_60_deg_up_bound_lengths[direction].y, + junior_rc_60_deg_up_bound_thickness[direction], + height, + junior_rc_60_deg_up_bound_offsets[direction].x, + junior_rc_60_deg_up_bound_offsets[direction].y, + height, + get_current_rotation()); + + switch (direction) { + case 0: + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + break; + case 1: + paint_util_push_tunnel_right(height + 56, TUNNEL_2); + break; + case 2: + paint_util_push_tunnel_left(height + 56, TUNNEL_2); + break; + case 3: + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + break; + } + + const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y}; + + sint8 support[4] = { 35, 29, 25, 32}; + if (track_paint_util_should_paint_supports(pos)) { + metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, support[direction], height, gTrackColours[SCHEME_SUPPORTS]); + } + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 104, 0x20); +} + static void junior_rc_60_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { bool isChained = track_element_is_lift_hill(mapElement); @@ -4447,6 +4154,89 @@ static void junior_rc_60_deg_down_paint_setup(uint8 rideIndex, uint8 trackSequen junior_rc_60_deg_up_paint_setup(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } +static const rct_xy16 junior_rc_25_deg_up_to_60_deg_up_bound_lengths[4][2] = { + {{32, 20}, {0}}, + {{10, 32}, {2, 32}}, + {{32, 10}, {32, 2}}, + {{20, 32}, {0}}, +}; + +static const sint8 junior_rc_25_deg_up_to_60_deg_up_bound_thickness[4] = { + 1, + 43, + 43, + 1 +}; + +static const rct_xy16 junior_rc_25_deg_up_to_60_deg_up_bound_offsets[4][2] = { + {{0, 6}, {0}}, + {{10, 0}, {4, 0}}, + {{0, 10}, {0, 4}}, + {{6, 0}, {0}}, +}; + +void junior_rc_paint_track_25_deg_up_to_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + uint32 image_id = gTrackColours[SCHEME_TRACK]; + + image_id |= junior_rc_track_pieces_25_deg_up_to_60_deg_up[chainType][direction][0]; + + sub_98197C(image_id, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, + junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].x, + junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].y, + junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction], + height, + junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].x, + junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].y, + height, + get_current_rotation()); + + if (junior_rc_track_pieces_25_deg_up_to_60_deg_up[chainType][direction][1] != 0) { + image_id = gTrackColours[SCHEME_TRACK]; + + image_id |= junior_rc_track_pieces_25_deg_up_to_60_deg_up[chainType][direction][1]; + + sub_98197C(image_id, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, + junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].x, + junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].y, + junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction], + height, + junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].x, + junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].y, + height, + get_current_rotation()); + } + + switch (direction) { + case 0: + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + break; + case 1: + paint_util_push_tunnel_right(height + 24, TUNNEL_2); + break; + case 2: + paint_util_push_tunnel_left(height + 24, TUNNEL_2); + break; + case 3: + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + break; + } + + const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y}; + + sint8 support[4] = { 12, 12, 12, 14}; + if (track_paint_util_should_paint_supports(pos)) { + metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, support[direction], height, gTrackColours[SCHEME_SUPPORTS]); + } + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 72, 0x20); +} + static void junior_rc_25_deg_up_to_60_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { bool isChained = track_element_is_lift_hill(mapElement); @@ -4457,6 +4247,67 @@ static void junior_rc_60_deg_down_to_25_deg_down_paint_setup(uint8 rideIndex, ui junior_rc_25_deg_up_to_60_deg_up_paint_setup(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } +void junior_rc_paint_track_60_deg_up_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + uint32 image_id = gTrackColours[SCHEME_TRACK]; + + image_id |= junior_rc_track_pieces_60_deg_up_to_25_deg_up[chainType][direction][0]; + + sub_98197C(image_id, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, + junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].x, + junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].y, + junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction], + height, + junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].x, + junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].y, + height, + get_current_rotation()); + + if (junior_rc_track_pieces_60_deg_up_to_25_deg_up[chainType][direction][1] != 0) { + image_id = gTrackColours[SCHEME_TRACK]; + + image_id |= junior_rc_track_pieces_60_deg_up_to_25_deg_up[chainType][direction][1]; + + sub_98197C(image_id, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].x, + (sint8)junior_rc_60_deg_up_tile_offsets[direction].y, + junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].x, + junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].y, + junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction], + height, + junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].x, + junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].y, + height, + get_current_rotation()); + } + + switch (direction) { + case 0: + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + break; + case 1: + paint_util_push_tunnel_right(height + 24, TUNNEL_2); + break; + case 2: + paint_util_push_tunnel_left(height + 24, TUNNEL_2); + break; + case 3: + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + break; + } + + const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y}; + + if (track_paint_util_should_paint_supports(pos)) { + metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 20, height, gTrackColours[SCHEME_SUPPORTS]); + } + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 72, 0x20); +} + static void junior_rc_60_deg_up_to_25_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { bool isChained = track_element_is_lift_hill(mapElement); @@ -4467,6 +4318,106 @@ static void junior_rc_25_deg_down_to_60_deg_down_paint_setup(uint8 rideIndex, ui junior_rc_60_deg_up_to_25_deg_up_paint_setup(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } +void junior_rc_paint_track_diag_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 36, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 104, 0x20); +} + +void junior_rc_paint_track_diag_60_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 28, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 104, 0x20); +} + +void junior_rc_paint_track_diag_25_deg_up_to_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up_to_60_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 16, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 72, 0x20); +} + +void junior_rc_paint_track_diag_60_deg_up_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + if (direction == 1 && trackSequence == 3) { + sub_98197C( + junior_rc_track_pieces_diag_60_deg_up_to_25_deg_up[chainType][direction] | gTrackColours[SCHEME_TRACK], + -16, -16, + 16, 16, 1, + height, + 0, 0, height, + get_current_rotation() + ); + } else { + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_up_to_25_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + } + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 21, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 72, 0x20); +} + +void junior_rc_paint_track_diag_25_deg_down_to_60_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + if (direction == 3 && trackSequence == 0) { + sub_98197C( + junior_rc_track_pieces_diag_25_deg_down_to_60_deg_down[chainType][direction] | gTrackColours[SCHEME_TRACK], + -16, -16, + 16, 16, 1, + height, + 0, 0, height, + get_current_rotation() + ); + } else { + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_down_to_60_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + } + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 17, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 72, 0x20); +} + +void junior_rc_paint_track_diag_60_deg_down_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, uint16 height, rct_map_element* mapElement, JUNIOR_RC_CHAINTYPE chainType) +{ + track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_down_to_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation()); + + if (trackSequence == 3) { + metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]); + } + + int blockedSegments = junior_rc_diag_blocked_segments[trackSequence]; + paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 72, 0x20); +} + static void junior_rc_diag_60_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { bool isChained = track_element_is_lift_hill(mapElement); @@ -4675,6 +4626,54 @@ static void junior_rc_flat_to_60_deg_down_paint_setup(uint8 rideIndex, uint8 tra junior_rc_60_deg_up_to_flat_paint_setup(rideIndex, trackSequence, (direction + 2) & 3, height, mapElement); } +/* rct2: 0x00518394 */ +static void junior_rc_flat_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement){ + bool isChained = track_element_is_lift_hill(mapElement); + junior_rc_paint_track_flat(rideIndex, trackSequence, direction, height, mapElement, isChained ? JUNIOR_RC_CHAIN_FRICTION_WHEELS : JUNIOR_RC_CHAIN_NONE); +} + +/* rct2: 0x00515629, 0x00514D22, 0x005151B9 */ +static void paint_junior_rc_station_track(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) +{ + junior_rc_paint_station(rideIndex, trackSequence, direction, height, mapElement, RIDE_TYPE_JUNIOR_ROLLER_COASTER); +} + +/* rct2: 0x0051881E */ +static void junior_rc_25_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { + bool isChained = track_element_is_lift_hill(mapElement); + junior_rc_paint_track_25_deg_up(rideIndex, trackSequence, direction, height, mapElement, isChained ? JUNIOR_RC_CHAIN_FRICTION_WHEELS : JUNIOR_RC_CHAIN_NONE); +} + +/* rct2: 0x00518B42 */ +static void junior_rc_flat_to_25_deg_up_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { + bool isChained = track_element_is_lift_hill(mapElement); + junior_rc_paint_track_flat_to_25_deg_up(rideIndex, trackSequence, direction, height, mapElement, isChained ? JUNIOR_RC_CHAIN_FRICTION_WHEELS : JUNIOR_RC_CHAIN_NONE); +} + +/* rct2: 0x00518E56 */ +static void junior_rc_25_deg_up_to_flat_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { + bool isChained = track_element_is_lift_hill(mapElement); + junior_rc_paint_track_25_deg_up_to_flat(rideIndex, trackSequence, direction, height, mapElement, isChained ? JUNIOR_RC_CHAIN_FRICTION_WHEELS : JUNIOR_RC_CHAIN_NONE); +} + +/* rct2: 0x005189B0 */ +static void junior_rc_25_deg_down_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { + + junior_rc_25_deg_up_paint_setup(rideIndex, trackSequence, (direction + 2) & 3, height, mapElement); +} + +/* rct2: 0x00518FE8 */ +static void junior_rc_flat_to_25_deg_down_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { + + junior_rc_25_deg_up_to_flat_paint_setup(rideIndex, trackSequence, (direction + 2) & 3, height, mapElement); +} + +/* rct2: 0x00518CCC */ +static void junior_rc_25_deg_down_to_flat_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { + + junior_rc_flat_to_25_deg_up_paint_setup(rideIndex, trackSequence, (direction + 2) & 3, height, mapElement); +} + /* 0x008AAA0C */ TRACK_PAINT_FUNCTION get_track_paint_function_junior_rc(int trackType, int direction) {