diff --git a/src/paint/map_element/map_element.h b/src/paint/map_element/map_element.h index d053b2001f..58503db004 100644 --- a/src/paint/map_element/map_element.h +++ b/src/paint/map_element/map_element.h @@ -22,27 +22,27 @@ typedef enum edge { - EDGE_NE = (1 << 0), - EDGE_SE = (1 << 1), - EDGE_SW = (1 << 2), - EDGE_NW = (1 << 3), - EDGE_BOTTOMLEFT = EDGE_SW, - EDGE_BOTTOMRIGHT = EDGE_SE, - EDGE_TOPLEFT = EDGE_NW, - EDGE_TOPRIGHT = EDGE_NE + EDGE_NE = (1 << 0), + EDGE_SE = (1 << 1), + EDGE_SW = (1 << 2), + EDGE_NW = (1 << 3), + EDGE_BOTTOMLEFT = EDGE_SW, + EDGE_BOTTOMRIGHT = EDGE_SE, + EDGE_TOPLEFT = EDGE_NW, + EDGE_TOPRIGHT = EDGE_NE } edge; enum { - SEGMENT_B4 = (1 << 0), // 0 - SEGMENT_CC = (1 << 1), // 6 - SEGMENT_BC = (1 << 2), // 2 - SEGMENT_D4 = (1 << 3), // 8 - SEGMENT_C0 = (1 << 4), // 3 - SEGMENT_D0 = (1 << 5), // 7 - SEGMENT_B8 = (1 << 6), // 1 - SEGMENT_C8 = (1 << 7), // 5 - SEGMENT_C4 = (1 << 8), // 4 + SEGMENT_B4 = (1 << 0), // 0 + SEGMENT_CC = (1 << 1), // 6 + SEGMENT_BC = (1 << 2), // 2 + SEGMENT_D4 = (1 << 3), // 8 + SEGMENT_C0 = (1 << 4), // 3 + SEGMENT_D0 = (1 << 5), // 7 + SEGMENT_B8 = (1 << 6), // 1 + SEGMENT_C8 = (1 << 7), // 5 + SEGMENT_C4 = (1 << 8), // 4 }; extern const int SEGMENTS_ALL; @@ -50,10 +50,13 @@ extern const uint16 segment_offsets[9]; enum { - TUNNEL_0 = 0, - TUNNEL_6 = 6, + TUNNEL_0 = 0, + TUNNEL_1 = 1, + TUNNEL_2 = 2, + TUNNEL_6 = 6, TUNNEL_7 = 7, TUNNEL_8 = 8, + TUNNEL_12 = 0x0C, TUNNEL_14 = 0x0E }; diff --git a/src/paint/supports.c b/src/paint/supports.c index fc01a6edbb..1551d0b20c 100644 --- a/src/paint/supports.c +++ b/src/paint/supports.c @@ -320,11 +320,11 @@ bool wooden_b_supports_paint_setup(int supportType, int special, int height, uin /** * Metal pole supports - * eax = special, - * ebx = segment, - * edx = height, - * edi = supportType, - * ebp = imageColourFlags; + * @param supportType (edi) + * @param segment (ebx) + * @param special (ax) + * @param height (edx) + * @param imageColourFlags (ebp) * rct2: 0x00663105 */ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int height, uint32 imageColourFlags) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 846fd9695d..5135a4a6b7 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -13,3 +13,418 @@ * A full copy of the GNU General Public License can be found in licence.txt *****************************************************************************/ #pragma endregion + +#include "../track_paint.h" +#include "../track.h" +#include "../vehicle_paint.h" +#include "../../interface/viewport.h" +#include "../../paint/paint.h" +#include "../../paint/supports.h" +#include "../ride_data.h" +#include "../../world/map.h" + +/** rct2: 0x */ +static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; + rct_ride * ride = get_ride(rideIndex); + const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style]; + uint32 imageId; + bool hasFence; + + bool hasGreenLight = (bool) (mapElement->properties.track.sequence & 0x80); + + if (direction == 0 || direction == 2) { + // height -= 2 (height - 2) + imageId = SPR_STATION_BASE_B_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation()); + + // height += 2 (height) + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, 32, 20, 1, height, 0, 0, height, get_current_rotation()); + + metal_a_supports_paint_setup(3, 5, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); + metal_a_supports_paint_setup(3, 8, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_push_tunnel_left(height, TUNNEL_6); + + //height += 5 (height + 5); + hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation()); + + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { + if (hasGreenLight) { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 2) { + imageId = (hasFence ? SPR_STATION_PLATFORM_BEGIN_FENCED_SW_NE : SPR_STATION_PLATFORM_BEGIN_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_SW_NE : SPR_STATION_PLATFORM_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 0, 0, 32, 8, 1, height + 5, get_current_rotation()); + //height -= 5 (height) + track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height); + //height += 5 (height + 5) + + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { + imageId = (hasGreenLight ? SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 2) { + imageId = SPR_STATION_PLATFORM_BEGIN_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = SPR_STATION_PLATFORM_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 0, 24, 32, 8, 1, height + 5, get_current_rotation()); + //height += 2 (height + 7) + + hasFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation()); + if (hasFence) { + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { + imageId = SPR_STATION_BEGIN_ANGLE_FENCE_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { + imageId = SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = SPR_STATION_FENCE_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 0, 31, 32, 1, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { + // Addition: draw only small fence if there is an entrance/exit at the beginning + imageId = SPR_STATION_FENCE_SMALL_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 23, 1, 8, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { + // Addition: draw only small fence if there is an entrance/exit at the end + imageId = SPR_STATION_LIGHT_BACK_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 23, 1, 8, 7, height + 7, get_current_rotation()); + } + //height -= 7 (height) + track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height); + //height += 7 (height + 7) + + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { + imageId = SPR_STATION_FENCE_SMALL_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { + imageId = SPR_STATION_LIGHT_BACK_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); + } + } else if (direction == 1 || direction == 3) { + // height -= 2 (height - 2) + imageId = SPR_STATION_BASE_B_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 28, 32, 1, height - 2, 2, 0, height, get_current_rotation()); + + // height += 2 (height) + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, 20, 32, 1, height, 0, 0, height, get_current_rotation()); + + metal_a_supports_paint_setup(3, 6, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); + metal_a_supports_paint_setup(3, 7, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_push_tunnel_right(height, TUNNEL_6); + + //height += 5 (height + 5); + hasFence = track_paint_util_has_fence(EDGE_NE, position, mapElement, ride, get_current_rotation()); + + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 3) { + if (hasGreenLight) { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_NW_SE : SPR_STATION_PLATFORM_END_GREEN_LIGHT_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_NW_SE : SPR_STATION_PLATFORM_END_RED_LIGHT_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); + } + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 1) { + imageId = (hasFence ? SPR_STATION_PLATFORM_BEGIN_FENCED_NW_SE : SPR_STATION_PLATFORM_BEGIN_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_NW_SE : SPR_STATION_PLATFORM_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 0, 0, 8, 32, 1, height + 5, get_current_rotation()); + //height -= 5 (height) + track_paint_util_draw_station_covers(EDGE_NE, hasFence, entranceStyle, direction, height); + //height += 5 (height + 5) + + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 3) { + imageId = (hasGreenLight ? SPR_STATION_PLATFORM_END_GREEN_LIGHT_NW_SE : SPR_STATION_PLATFORM_END_RED_LIGHT_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 1) { + imageId = SPR_STATION_PLATFORM_BEGIN_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = SPR_STATION_PLATFORM_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 24, 0, 8, 32, 1, height + 5, get_current_rotation()); + //height += 2 (height + 7) + + hasFence = track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation()); + if (hasFence) { + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 3) { + imageId = SPR_STATION_BEGIN_ANGLE_FENCE_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 1) { + imageId = SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = SPR_STATION_FENCE_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 31, 0, 1, 32, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 3) { + // Addition: draw only small fence if there is an entrance/exit at the beginning + imageId = SPR_STATION_FENCE_SMALL_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 23, 31, 8, 1, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 1) { + // Addition: draw only small fence if there is an entrance/exit at the end + imageId = SPR_STATION_LIGHT_BACK_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 23, 31, 8, 1, 7, height + 7, get_current_rotation()); + } + + //height -= 7 (height) + track_paint_util_draw_station_covers(EDGE_SW, hasFence, entranceStyle, direction, height); + //height += 7 (height + 7) + + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 3) { + imageId = SPR_STATION_FENCE_SMALL_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 0, 31, 8, 1, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 1) { + imageId = SPR_STATION_LIGHT_BACK_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 0, 31, 8, 1, 7, height + 7, get_current_rotation()); + } + } + + paint_util_set_general_support_height(height + 32, 0x20); +} + +/** rct2: 0x0081F348 */ +static void paint_mini_helicopters_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; + uint32 imageId; + + if (direction & 1) { + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height, TUNNEL_0); + } else { + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); + paint_util_push_tunnel_left(height, TUNNEL_0); + } + + if (track_paint_util_should_paint_supports(position)) { + metal_a_supports_paint_setup((direction & 1) ? 5 : 4, 4, -1, height, RCT2_GLOBAL(0x00F4419C, uint32)); + } + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); +} + +/** rct2: 0x0081F368 */ +static void paint_mini_helicopters_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; + uint32 imageId; + + switch (direction) { + case 0: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); + paint_util_push_tunnel_left(height, TUNNEL_0); + break; + case 1: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height, TUNNEL_2); + break; + case 2: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); + paint_util_push_tunnel_left(height, TUNNEL_2); + break; + case 3: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height, TUNNEL_0); + break; + } + + if (track_paint_util_should_paint_supports(position)) { + metal_a_supports_paint_setup(4, 4, -4, height, RCT2_GLOBAL(0x00F4419C, uint32)); + } + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 48, 0x20); +} + +/** rct2: 0x0081F358 */ +static void paint_mini_helicopters_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; + uint32 imageId; + + switch (direction) { + case 0: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); + paint_util_push_tunnel_left(height - 8, TUNNEL_1); + break; + case 1: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height + 8, TUNNEL_2); + break; + case 2: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); + paint_util_push_tunnel_left(height + 8, TUNNEL_2); + break; + case 3: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height - 8, TUNNEL_1); + break; + } + + if (track_paint_util_should_paint_supports(position)) { + metal_a_supports_paint_setup(4, 4, -9, height, RCT2_GLOBAL(0x00F4419C, uint32)); + } + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 56, 0x20); +} + +/** rct2: 0x0081F378 */ +static void paint_mini_helicopters_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; + uint32 imageId; + + switch (direction) { + case 0: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); + paint_util_push_tunnel_left(height - 8, TUNNEL_0); + break; + case 1: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height + 8, TUNNEL_12); + break; + case 2: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); + paint_util_push_tunnel_left(height + 8, TUNNEL_12); + break; + case 3: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height - 8, TUNNEL_0); + break; + } + + if (track_paint_util_should_paint_supports(position)) { + metal_a_supports_paint_setup(4, 4, -7, height, RCT2_GLOBAL(0x00F4419C, uint32)); + } + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 40, 0x20); +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_helicopters_track_25_deg_up_to_flat(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); +} + +/** rct2: 0x0081F388 */ +static void paint_mini_helicopters_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_helicopters_track_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); +} + +/** rct2: 0x0081F3A8 */ +static void paint_mini_helicopters_track_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_helicopters_track_flat_to_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); +} + +/** rct2: 0x0081F3E8 */ +static void paint_mini_helicopters_track_left_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + track_paint_util_left_quarter_turn_3_tiles_paint(height, direction, trackSequence, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles, get_current_rotation()); + track_paint_util_left_quarter_turn_3_tiles_tunnel(height, direction, trackSequence); + + switch (trackSequence) { + case 0: + metal_a_supports_paint_setup(4, 4, -1, height, RCT2_GLOBAL(0x00F4419C, uint32)); + 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_C8 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8, direction), 0xFFFF, 0); + break; + case 3: + metal_a_supports_paint_setup(4, 4, -1, height, RCT2_GLOBAL(0x00F4419C, uint32)); + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0, direction), 0xFFFF, 0); + break; + } + + paint_util_set_general_support_height(height + 16, 0x20); +} + +static const uint8 right_quarter_turn_3_tiles_to_left_turn_map[] = {3, 1, 2, 0}; + +/** rct2: 0x0081F3F8 */ +static void paint_mini_helicopters_track_right_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + trackSequence = right_quarter_turn_3_tiles_to_left_turn_map[trackSequence]; + paint_mini_helicopters_track_left_quarter_turn_3_tiles(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); +} + +/** rct2: 0x0081F408 */ +static void paint_mini_helicopters_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + track_paint_util_left_quarter_turn_1_tile_paint(height, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); + track_paint_util_left_quarter_turn_1_tile_tunnel(height, direction, trackSequence); + + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); +} + +/** rct2: 0x0081F418 */ +static void paint_mini_helicopters_track_right_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_mini_helicopters_track_left_quarter_turn_1_tile(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); +} + +/** + * rct2: 0x0081F268 + */ +TRACK_PAINT_FUNCTION get_track_paint_function_mini_helicopters(int trackType, int direction) +{ + switch (trackType) { + case TRACK_ELEM_FLAT: + return paint_mini_helicopters_track_flat; + + case TRACK_ELEM_END_STATION: + case TRACK_ELEM_BEGIN_STATION: + case TRACK_ELEM_MIDDLE_STATION: + return paint_mini_helicopters_track_station; + + case TRACK_ELEM_25_DEG_UP: + return paint_mini_helicopters_track_25_deg_up; + case TRACK_ELEM_FLAT_TO_25_DEG_UP: + return paint_mini_helicopters_track_flat_to_25_deg_up; + case TRACK_ELEM_25_DEG_UP_TO_FLAT: + return paint_mini_helicopters_track_25_deg_up_to_flat; + + case TRACK_ELEM_25_DEG_DOWN: + return paint_mini_helicopters_track_25_deg_down; + case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: + return paint_mini_helicopters_track_flat_to_25_deg_down; + case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: + return paint_mini_helicopters_track_25_deg_down_to_flat; + + case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES: + return paint_mini_helicopters_track_left_quarter_turn_3_tiles; + case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES: + return paint_mini_helicopters_track_right_quarter_turn_3_tiles; + + case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE: + return paint_mini_helicopters_track_left_quarter_turn_1_tile; + case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE: + return paint_mini_helicopters_track_right_quarter_turn_1_tile; + } + + return NULL; +} \ No newline at end of file diff --git a/src/ride/track_data.c b/src/ride/track_data.c index 3946321bc5..177e6e6974 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5528,7 +5528,7 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = { 0x007C6C00, // RIDE_TYPE_3A 0x00811184, // RIDE_TYPE_VIRGINIA_REEL 0x008164AC, // RIDE_TYPE_SPLASH_BOATS - 0x0081F268, // RIDE_TYPE_MINI_HELICOPTERS + 0, // RIDE_TYPE_MINI_HELICOPTERS 0x008245A8, // RIDE_TYPE_LAY_DOWN_ROLLER_COASTER 0x0086347C, // RIDE_TYPE_SUSPENDED_MONORAIL 0x008245A8, // RIDE_TYPE_40 @@ -5623,7 +5623,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_3A 0, // RIDE_TYPE_VIRGINIA_REEL 0, // RIDE_TYPE_SPLASH_BOATS - 0, // RIDE_TYPE_MINI_HELICOPTERS + get_track_paint_function_mini_helicopters, // RIDE_TYPE_MINI_HELICOPTERS 0, // RIDE_TYPE_LAY_DOWN_ROLLER_COASTER 0, // RIDE_TYPE_SUSPENDED_MONORAIL 0, // RIDE_TYPE_40 diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index d9e6522876..bac6878b2c 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -126,6 +126,33 @@ const uint32 fenceSpritesMetalB[] = { SPR_FENCE_METAL_B_NW }; +const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles[4][3] = { + { + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2 + }, { + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2 + }, { + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2 + }, { + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2 + } +}; + +const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4] = { + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW, +}; + enum { SPR_STATION_COVER_OFFSET_NE_SW_BACK_0 = 0, @@ -217,7 +244,7 @@ bool track_paint_util_should_paint_supports(rct_xy16 position) bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height) { - if (RCT2_GLOBAL(0x0141E9DB, uint8) & 3) { + if (!(RCT2_GLOBAL(0x0141E9DB, uint8) & 3)) { return false; } @@ -275,6 +302,101 @@ bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const r return true; } +static const sint8 left_quarter_turn_3_tiles_sprite_map[] = {2, -1, 1, 0}; +void track_paint_util_left_quarter_turn_3_tiles_paint(sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3], uint8 rotation) +{ + sint8 sprite = left_quarter_turn_3_tiles_sprite_map[trackSequence]; + if (sprite < 0) { + return; + } + + uint32 imageId = sprites[(direction + 1) % 4][sprite] | colourFlags; + + switch (direction) { + case 0: + switch (trackSequence) { + case 0: sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 16, 16, 3, height, 16, 0, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, rotation); break; + } + break; + + case 1: + switch (trackSequence) { + case 0: sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 16, 16, 3, height, 0, 0, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, rotation); break; + } + break; + + case 2: + switch (trackSequence) { + case 0: sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 16, 16, 3, height, 0, 16, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, rotation); break; + } + break; + + case 3: + switch (trackSequence) { + case 0: sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 16, 16, 3, height, 16, 16, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, rotation); break; + } + break; + } +} + +void track_paint_util_left_quarter_turn_3_tiles_tunnel(sint16 height, uint8 direction, uint8 trackSequence) +{ + if (direction == 0 && trackSequence == 0) { + paint_util_push_tunnel_left(height, TUNNEL_0); + } + + + if (direction == 2 && trackSequence == 3) { + paint_util_push_tunnel_right(height, TUNNEL_0); + } + + + if (direction == 3 && trackSequence == 0) { + paint_util_push_tunnel_right(height, TUNNEL_0); + } + + if (direction == 3 && trackSequence == 3) { + paint_util_push_tunnel_left(height, TUNNEL_0); + } +} + + +void track_paint_util_left_quarter_turn_1_tile_paint(sint16 height, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation) +{ + uint32 imageId = sprites[direction] | colourFlags; + + switch (direction) { + case 0: sub_98197C(imageId, 0, 0, 26, 24, 1, height, 6, 2, height, rotation); break; + case 1: sub_98197C(imageId, 0, 0, 26, 26, 1, height, 0, 0, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 24, 26, 1, height, 2, 6, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 24, 24, 1, height, 6, 6, height, rotation); break; + } +} + +void track_paint_util_left_quarter_turn_1_tile_tunnel(sint16 height, uint8 direction, uint8 trackSequence) +{ + switch (direction) { + case 0: + paint_util_push_tunnel_left(height, TUNNEL_0); + break; + case 2: + paint_util_push_tunnel_right(height, TUNNEL_0); + break; + case 3: + paint_util_push_tunnel_right(height, TUNNEL_0); + paint_util_push_tunnel_left(height, TUNNEL_0); + break; + } +} + /** * * rct2: 0x006C4794 diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 12f67063a6..008f9105fd 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -44,6 +44,37 @@ enum { SPR_FENCE_METAL_B_SW = 14992, SPR_FENCE_METAL_B_NW = 14993, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW = 16870, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_SE_NW = 16871, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0 = 16872, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1 = 16873, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2 = 16874, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0 = 16875, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1 = 16876, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2 = 16877, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0 = 16878, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1 = 16879, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2 = 16880, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0 = 16881, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1 = 16882, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2 = 16883, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_SW_NE = 16884, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_NW_SE = 16885, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_NE_SW = 16886, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_SE_NW = 16887, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_SW_NE = 16888, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_NW_SE = 16889, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_NE_SW = 16890, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_SE_NW = 16891, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_SW_NE = 16892, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_NW_SE = 16893, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_NE_SW = 16894, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_SE_NW = 16895, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW = 16896, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE = 16897, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE = 16898, + SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW = 16899, + SPR_FLOOR_CORK_SE_SW = 22134, SPR_FLOOR_CORK_SW = 22135, SPR_FLOOR_CORK_SE = 22136, @@ -53,8 +84,33 @@ enum { SPR_FENCE_ROPE_SW = 22140, SPR_FENCE_ROPE_NW = 22141, + SPR_STATION_PLATFORM_SW_NE = 22362, + SPR_STATION_PLATFORM_NW_SE = 22363, + SPR_STATION_PLATFORM_FENCED_SW_NE = 22364, + SPR_STATION_PLATFORM_FENCED_NW_SE = 22365, + SPR_STATION_PLATFORM_BEGIN_FENCED_SW_NE = 22366, + SPR_STATION_PLATFORM_BEGIN_FENCED_NW_SE = 22367, + SPR_STATION_PLATFORM_BEGIN_SW_NE = 22368, + SPR_STATION_PLATFORM_BEGIN_NW_SE = 22369, SPR_STATION_FENCE_SW_NE = 22370, SPR_STATION_FENCE_NW_SE = 22371, + SPR_STATION_BEGIN_ANGLE_FENCE_SW_NE = 22372, + SPR_STATION_BEGIN_ANGLE_FENCE_NW_SE = 22373, + SPR_STATION_FENCE_SMALL_NW_SE = 22374, + SPR_STATION_FENCE_SMALL_SW_NE = 22375, + + SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_SW_NE = 22380, + SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_NW_SE = 22381, + SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_SW_NE = 22382, + SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_NW_SE = 22383, + SPR_STATION_LIGHT_BACK_NE_SW = 22384, + SPR_STATION_LIGHT_BACK_NW_SE = 22385, + SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NE_SW = 22386, + SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NW_SE = 22387, + SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE = 22388, + SPR_STATION_PLATFORM_END_RED_LIGHT_NW_SE = 22389, + SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE = 22390, + SPR_STATION_PLATFORM_END_GREEN_LIGHT_NW_SE = 22391, SPR_STATION_PIER_EDGE_SE = 22404, SPR_STATION_PIER_EDGE_SW = 22405, @@ -71,6 +127,9 @@ enum { SPR_STATION_NARROW_EDGE_NW = 22416, SPR_STATION_NARROW_EDGE_NE = 22417, + SPR_STATION_BASE_B_SW_NE = 22428, + SPR_STATION_BASE_B_NW_SE = 22429, + SPR_ON_RIDE_PHOTO_CAMERA_N = 25615, SPR_ON_RIDE_PHOTO_CAMERA_E = 25616, SPR_ON_RIDE_PHOTO_CAMERA_S = 25617, @@ -90,12 +149,20 @@ extern const uint32 floorSpritesCork[]; extern const uint32 fenceSpritesRope[]; extern const uint32 fenceSpritesMetalB[]; +extern const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles[4][3]; +extern const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4]; + bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation); void track_paint_util_paint_floor(uint8 edges, uint32 colourFlags, uint16 height, const uint32 floorSprites[4], uint8 rotation); void track_paint_util_paint_fences(uint8 edges, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint32 colourFlags, uint16 height, const uint32 fenceSprites[4], uint8 rotation); bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height); bool track_paint_util_should_paint_supports(rct_xy16 position); +void track_paint_util_left_quarter_turn_3_tiles_paint(sint16 height, int direction, uint8 trackSequence, uint32 colourFlags, const uint32 sprites[4][3], uint8 rotation); +void track_paint_util_left_quarter_turn_3_tiles_tunnel(sint16 height, uint8 direction, uint8 trackSequence); +void track_paint_util_left_quarter_turn_1_tile_paint(sint16 height, int direction, uint32 colourFlags, const uint32 sprites[4], uint8 rotation); +void track_paint_util_left_quarter_turn_1_tile_tunnel(sint16 height, uint8 direction, uint8 trackSequence); + typedef void (*TRACK_PAINT_FUNCTION)(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement); typedef TRACK_PAINT_FUNCTION (*TRACK_PAINT_FUNCTION_GETTER)(int trackType, int direction); @@ -113,6 +180,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_merry_go_round(int trackType, int TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_haunted_house(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_circus_show(int trackType, int direction); +TRACK_PAINT_FUNCTION get_track_paint_function_mini_helicopters(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_roto_drop(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_flying_saucers(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_crooked_house(int trackType, int direction); diff --git a/src/ride/water/submarine_ride.c b/src/ride/water/submarine_ride.c index fb243a349c..cd7be2d918 100644 --- a/src/ride/water/submarine_ride.c +++ b/src/ride/water/submarine_ride.c @@ -66,45 +66,6 @@ void vehicle_visual_submarine(int x, int imageDirection, int y, int z, rct_vehic assert(vehicleEntry->effect_visual == 1); } -enum -{ - SPR_SUBMARINE_RIDE_FLAT_NE_SW = 16870, - SPR_SUBMARINE_RIDE_FLAT_SE_NW = 16871, - - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0 = 16872, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1 = 16873, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2 = 16874, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0 = 16875, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1 = 16876, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2 = 16877, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0 = 16878, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1 = 16879, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2 = 16880, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0 = 16881, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1 = 16882, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2 = 16883, - - SPR_SUBMARINE_RIDE_FLAT_TO_25_DEG_UP_SW_NE, - SPR_SUBMARINE_RIDE_FLAT_TO_25_DEG_UP_NW_SE, - SPR_SUBMARINE_RIDE_FLAT_TO_25_DEG_UP_NE_SW, - SPR_SUBMARINE_RIDE_FLAT_TO_25_DEG_UP_SE_NW, - - SPR_SUBMARINE_RIDE_25_DEG_UP_TO_FLAT_SW_NE, - SPR_SUBMARINE_RIDE_25_DEG_UP_TO_FLAT_NW_SE, - SPR_SUBMARINE_RIDE_25_DEG_UP_TO_FLAT_NE_SW, - SPR_SUBMARINE_RIDE_25_DEG_UP_TO_FLAT_SE_NW, - - SPR_SUBMARINE_RIDE_25_DEG_UP_SW_NE, - SPR_SUBMARINE_RIDE_25_DEG_UP_NW_SE, - SPR_SUBMARINE_RIDE_25_DEG_UP_NE_SW, - SPR_SUBMARINE_RIDE_25_DEG_UP_SE_NW, - - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_SW_NW = 16896, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_NW_NE = 16897, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_NE_SE = 16898, - SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_SE_SW = 16899, -}; - static void submarine_ride_paint_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; @@ -115,7 +76,7 @@ static void submarine_ride_paint_track_station(uint8 rideIndex, uint8 trackSeque bool hasFence; if (direction & 1) { - imageId = SPR_SUBMARINE_RIDE_FLAT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); sub_98197C(imageId, 0, 0, 20, 32, 3, heightLower, 6, 0, heightLower, get_current_rotation()); paint_util_push_tunnel_right(height, TUNNEL_6); @@ -135,7 +96,7 @@ static void submarine_ride_paint_track_station(uint8 rideIndex, uint8 trackSeque track_paint_util_draw_station_covers(EDGE_SW, hasFence, entranceStyle, direction, height); } else { - imageId = SPR_SUBMARINE_RIDE_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); sub_98197C(imageId, 0, 0, 32, 20, 3, heightLower, 0, 6, heightLower, get_current_rotation()); paint_util_push_tunnel_left(height, TUNNEL_6); @@ -166,11 +127,11 @@ static void submarine_ride_paint_track_flat(uint8 rideIndex, uint8 trackSequence uint32 imageId; if (direction & 1) { - imageId = SPR_SUBMARINE_RIDE_FLAT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); sub_98197C(imageId, 0, 0, 20, 32, 3, heightLower, 6, 0, heightLower, get_current_rotation()); paint_util_push_tunnel_right(heightLower, TUNNEL_0); } else { - imageId = SPR_SUBMARINE_RIDE_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); sub_98197C(imageId, 0, 0, 32, 20, 3, heightLower, 0, 6, heightLower, get_current_rotation()); paint_util_push_tunnel_left(heightLower, TUNNEL_0); } @@ -183,160 +144,29 @@ static void submarine_ride_paint_track_flat(uint8 rideIndex, uint8 trackSequence paint_util_set_general_support_height(height + 16, 0x20); } -static void submarine_ride_paint_track_quarter_turn_3_tiles_nw_sw(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) -{ - int heightLower = height - 16; - uint32 imageId; - - switch (trackSequence) { - case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 20, 3, heightLower, 0, 6, heightLower, get_current_rotation()); - - paint_util_push_tunnel_right(heightLower, TUNNEL_0); - metal_a_supports_paint_setup(4, 4, -1, heightLower, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, 0xFFFF, 0); - break; - case 1: - break; - case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 16, 16, 3, heightLower, 16, 0, heightLower, get_current_rotation()); - - paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8, 0xFFFF, 0); - break; - case 3: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 20, 32, 3, heightLower, 6, 0, heightLower, get_current_rotation()); - - metal_a_supports_paint_setup(4, 4, -1, heightLower, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0, 0xFFFF, 0); - break; - } - - paint_util_set_general_support_height(height + 16, 0x20); -} - -static void submarine_ride_paint_track_quarter_turn_3_tiles_ne_nw(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) -{ - int heightLower = height - 16; - uint32 imageId; - - switch (trackSequence) { - case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 20, 32, 3, heightLower, 6, 0, heightLower, get_current_rotation()); - - metal_a_supports_paint_setup(4, 4, -1, heightLower, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC, 0xFFFF, 0); - break; - case 1: - break; - case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 16, 16, 3, heightLower, 0, 0, heightLower, get_current_rotation()); - - paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C8, 0xFFFF, 0); - break; - case 3: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 20, 3, heightLower, 0, 6, heightLower, get_current_rotation()); - - metal_a_supports_paint_setup(4, 4, -1, heightLower, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8, 0xFFFF, 0); - break; - } - - paint_util_set_general_support_height(height + 16, 0x20); -} - -static void submarine_ride_paint_track_quarter_turn_3_tiles_se_ne(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) -{ - int heightLower = height - 16; - uint32 imageId; - - switch (trackSequence) { - case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 20, 3, heightLower, 0, 6, heightLower, get_current_rotation()); - - metal_a_supports_paint_setup(4, 4, -1, heightLower, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_C0, 0xFFFF, 0); - break; - case 1: - break; - case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 16, 16, 3, heightLower, 0, 16, heightLower, get_current_rotation()); - - paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC, 0xFFFF, 0); - break; - case 3: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 20, 32, 3, heightLower, 6, 0, heightLower, get_current_rotation()); - - metal_a_supports_paint_setup(4, 4, -1, heightLower, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, 0xFFFF, 0); - paint_util_push_tunnel_left(heightLower, TUNNEL_0); - break; - } - - paint_util_set_general_support_height(height + 16, 0x20); -} - -static void submarine_ride_paint_track_quarter_turn_3_tiles_sw_se(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) -{ - int heightLower = height - 16; - uint32 imageId; - - switch (trackSequence) { - case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 20, 32, 3, heightLower, 6, 0, heightLower, get_current_rotation()); - - metal_a_supports_paint_setup(4, 4, -1, heightLower, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENT_D4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_B8, 0xFFFF, 0); - paint_util_push_tunnel_right(heightLower, TUNNEL_0); - break; - case 1: - break; - case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 16, 16, 3, heightLower, 16, 16, heightLower, get_current_rotation()); - - paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0, 0xFFFF, 0); - break; - case 3: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0 | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 20, 3, heightLower, 0, 6, heightLower, get_current_rotation()); - - metal_a_supports_paint_setup(4, 4, -1, heightLower, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_B4, 0xFFFF, 0); - break; - } - - paint_util_set_general_support_height(height + 16, 0x20); -} - static void submarine_ride_paint_track_left_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - switch (direction) { + track_paint_util_left_quarter_turn_3_tiles_paint(height - 16, direction, trackSequence, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles, get_current_rotation()); + track_paint_util_left_quarter_turn_3_tiles_tunnel(height - 16, direction, trackSequence); + + switch (trackSequence) { case 0: - submarine_ride_paint_track_quarter_turn_3_tiles_nw_sw(rideIndex, trackSequence, direction, height, mapElement); - break; - case 1: - submarine_ride_paint_track_quarter_turn_3_tiles_ne_nw(rideIndex, trackSequence, direction, height, mapElement); + metal_a_supports_paint_setup(4, 4, -1, height - 16, RCT2_GLOBAL(0x00F4419C, uint32)); + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction), 0xFFFF, 0); break; case 2: - submarine_ride_paint_track_quarter_turn_3_tiles_se_ne(rideIndex, trackSequence, direction, height, mapElement); + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8, direction), 0xFFFF, 0); break; case 3: - submarine_ride_paint_track_quarter_turn_3_tiles_sw_se(rideIndex, trackSequence, direction, height, mapElement); + metal_a_supports_paint_setup(4, 4, -1, height - 16, RCT2_GLOBAL(0x00F4419C, uint32)); + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0, direction), 0xFFFF, 0); break; } + + paint_util_set_general_support_height(height + 16, 0x20); } -uint8 right_quarter_turn_3_tiles_to_left_turn_map[] = {3, 1, 2, 0}; +static const uint8 right_quarter_turn_3_tiles_to_left_turn_map[] = {3, 1, 2, 0}; static void submarine_ride_paint_track_right_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { trackSequence = right_quarter_turn_3_tiles_to_left_turn_map[trackSequence]; @@ -345,31 +175,8 @@ static void submarine_ride_paint_track_right_quarter_turn_3_tiles(uint8 rideInde static void submarine_ride_paint_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - int heightLower = height - 16; - uint32 imageId; - - switch (direction) { - case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_SW_NW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 26, 24, 1, heightLower, 6, 2, heightLower, get_current_rotation()); - paint_util_push_tunnel_left(heightLower, TUNNEL_0); - break; - case 1: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_NW_NE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 26, 26, 1, heightLower, 0, 0, heightLower, get_current_rotation()); - break; - case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_NE_SE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 24, 26, 1, heightLower, 2, 6, heightLower, get_current_rotation()); - paint_util_push_tunnel_right(heightLower, TUNNEL_0); - break; - case 3: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_SE_SW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 24, 24, 1, heightLower, 6, 6, heightLower, get_current_rotation()); - paint_util_push_tunnel_right(heightLower, TUNNEL_0); - paint_util_push_tunnel_left(heightLower, TUNNEL_0); - break; - } + track_paint_util_left_quarter_turn_1_tile_paint(height - 16, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); + track_paint_util_left_quarter_turn_1_tile_tunnel(height - 16, direction, trackSequence); paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); paint_util_set_general_support_height(height + 16, 0x20);