From b045953256da9fe4b62c62c1c8d575e193b5d7f7 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 24 Mar 2016 21:52:32 +0100 Subject: [PATCH] Implement Spiral Slide drawing --- src/ride/track_data.c | 4 +- src/ride/track_paint.c | 452 +++++++++++++++++++++++++++++++++++++++++ src/ride/track_paint.h | 1 + 3 files changed, 455 insertions(+), 2 deletions(-) diff --git a/src/ride/track_data.c b/src/ride/track_data.c index 2a7d6ecec6..8b3ff45fc3 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5492,7 +5492,7 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = { 0x00743EC8, // RIDE_TYPE_CHAIRLIFT 0x008A7784, // RIDE_TYPE_CORKSCREW_ROLLER_COASTER 0x008A81E8, // RIDE_TYPE_MAZE - 0x0074840C, // RIDE_TYPE_SPIRAL_SLIDE + 0, // RIDE_TYPE_SPIRAL_SLIDE 0x0074A668, // RIDE_TYPE_GO_KARTS 0x0074DDEC, // RIDE_TYPE_LOG_FLUME 0x0075745C, // RIDE_TYPE_RIVER_RAPIDS @@ -5587,7 +5587,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_CHAIRLIFT 0, // RIDE_TYPE_CORKSCREW_ROLLER_COASTER 0, // RIDE_TYPE_MAZE - 0, // RIDE_TYPE_SPIRAL_SLIDE + get_track_paint_function_spiral_slide, // RIDE_TYPE_SPIRAL_SLIDE 0, // RIDE_TYPE_GO_KARTS 0, // RIDE_TYPE_LOG_FLUME 0, // RIDE_TYPE_RIVER_RAPIDS diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index ca861e3867..81378a7c1e 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -76,6 +76,23 @@ static rct_xy16 loc_7667AC[] = { { .x = 0, .y = 1 }, }; +/* rct2: 0x007485D8 (same as loc_7667AC) */ +static rct_xy16 dword_7485D8[] = { + {.x = -1, .y = 0}, + {.x = 0, .y = -1}, + {.x = 1, .y = 0}, + {.x = 0, .y = 1}, +}; + +/* rct2: 0x007485D8 (same as loc_7667AC) */ +static rct_xy16 dword_7485da[] = { + {.x = 0, .y = -1}, + {.x = 1, .y = 0}, + {.x = 0, .y = 1}, + {.x = -1, .y = 0}, +}; + + /** * * rct2: 0x0142811C @@ -860,6 +877,441 @@ TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int directi return NULL; } +enum { + SPIRAL_SLIDE_LEFT_R0 = 20548, + SPIRAL_SLIDE_CENTER_R0 = 20549, + SPIRAL_SLIDE_RIGHT_R0 = 20550, + + SPIRAL_SLIDE_LEFT_R1 = 20551, + SPIRAL_SLIDE_CENTER_R1 = 20552, + SPIRAL_SLIDE_RIGHT_R1 = 20553, + + SPIRAL_SLIDE_LEFT_R2 = 20554, + SPIRAL_SLIDE_CENTER_R2 = 20555, + SPIRAL_SLIDE_RIGHT_R2 = 20556, + + SPIRAL_SLIDE_LEFT_R3 = 20557, + SPIRAL_SLIDE_CENTER_R3 = 20558, + SPIRAL_SLIDE_RIGHT_R3 = 20559, + + SPIRAL_SLIDE_INSIDE_R1 = 20560, + SPIRAL_SLIDE_INSIDE_R2 = 20561, + + SPIRAL_SLIDE_BASE_A = 20562, + SPIRAL_SLIDE_BASE_B = 20563, + + SPIRAL_SLIDE_FENCE_TOP_RIGHT = 20564, + SPIRAL_SLIDE_FENCE_BOTTOM_RIGHT = 20565, + SPIRAL_SLIDE_FENCE_BOTTOM_LEFT = 20566, + SPIRAL_SLIDE_FENCE_TOP_LEFT = 20567, + + SPIRAL_SLIDE_PEEP = 20568, // 46 sprites per direction +}; + +static void spiral_slide_paint_tile_back(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); + + // Base + image_id = ((direction & 1) ? SPIRAL_SLIDE_BASE_B : SPIRAL_SLIDE_BASE_A) | RCT2_GLOBAL(0x00F4419C, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height; + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + + sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); + uint16 entranceLoc = + ((x / 32) + loc_7667AE[get_current_rotation()].x) | + (((y / 32) + loc_7667AE[get_current_rotation()].y) << 8); + + uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; + rct_ride *ride = get_ride(rideIndex); + + if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { + image_id = SPIRAL_SLIDE_FENCE_TOP_LEFT | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 2; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + sub_98199C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation()); + } + + entranceLoc = + ((x / 32) + loc_7667AC[get_current_rotation()].x) | + (((y / 32) + loc_7667AC[get_current_rotation()].y) << 8); + + if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { + image_id = SPIRAL_SLIDE_FENCE_TOP_RIGHT | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 2; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + sub_98199C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation()); + } + + RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF; + + height += 128; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; + RCT2_GLOBAL(0x141E9DA, uint8) = 32; + } +} + +static void spiral_slide_paint_tile_right(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); + + // Base + image_id = ((direction & 1) ? SPIRAL_SLIDE_BASE_B : SPIRAL_SLIDE_BASE_A) | RCT2_GLOBAL(0x00F4419C, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height; + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + + sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); + uint16 entranceLoc = + ((x / 32) + dword_7485D8[get_current_rotation()].x) | + (((y / 32) + dword_7485D8[get_current_rotation()].y) << 8); + + uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; + rct_ride *ride = get_ride(rideIndex); + + if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { + image_id = SPIRAL_SLIDE_FENCE_TOP_RIGHT | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 2; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + + sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0); + } + + image_id = SPIRAL_SLIDE_FENCE_BOTTOM_RIGHT | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 30; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation()); //TODO 1, 32 + + if (direction == 0) image_id = SPIRAL_SLIDE_RIGHT_R0 | RCT2_GLOBAL(0x00F44198, uint32); + if (direction == 1) image_id = SPIRAL_SLIDE_RIGHT_R1 | RCT2_GLOBAL(0x00F44198, uint32); + if (direction == 2) image_id = SPIRAL_SLIDE_RIGHT_R2 | RCT2_GLOBAL(0x00F44198, uint32); + if (direction == 3) image_id = SPIRAL_SLIDE_RIGHT_R3 | RCT2_GLOBAL(0x00F44198, uint32); + + RCT2_GLOBAL(0x009DEA52, uint16) = 16; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 3; + sub_98197C(image_id, 16, 16, 16, 16, 108, height, get_current_rotation()); + + RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF; + + height += 128; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; + RCT2_GLOBAL(0x141E9DA, uint8) = 32; + } +} + +static void spiral_slide_paint_tile_left(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); + + // Base + image_id = ((direction & 1) ? SPIRAL_SLIDE_BASE_B : SPIRAL_SLIDE_BASE_A) | RCT2_GLOBAL(0x00F4419C, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height; + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + + sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16); + uint16 entranceLoc = + ((x / 32) + dword_7485da[get_current_rotation()].x) | + (((y / 32) + dword_7485da[get_current_rotation()].y) << 8); + + uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4; + rct_ride *ride = get_ride(rideIndex); + + if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) { + image_id = SPIRAL_SLIDE_FENCE_TOP_LEFT | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 2; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + + sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0); + } + + // Fence + image_id = SPIRAL_SLIDE_FENCE_BOTTOM_LEFT | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 30; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation()); + + if (direction == 0) image_id = SPIRAL_SLIDE_LEFT_R0 | RCT2_GLOBAL(0x00F44198, uint32); + if (direction == 1) image_id = SPIRAL_SLIDE_LEFT_R1 | RCT2_GLOBAL(0x00F44198, uint32); + if (direction == 2) image_id = SPIRAL_SLIDE_LEFT_R2 | RCT2_GLOBAL(0x00F44198, uint32); + if (direction == 3) image_id = SPIRAL_SLIDE_LEFT_R3 | RCT2_GLOBAL(0x00F44198, uint32); + + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 16; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 3; + sub_98197C(image_id, 16, 16, 16, 16, 108, height, get_current_rotation()); + + RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF; + RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF; + + height += 128; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; + RCT2_GLOBAL(0x141E9DA, uint8) = 32; + } +} + +static void spiral_slide_paint_tile_front(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); + + // Base + image_id = ((direction & 1) ? SPIRAL_SLIDE_BASE_B : SPIRAL_SLIDE_BASE_A) | RCT2_GLOBAL(0x00F4419C, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height; + sub_98197C(image_id, 0, 0, 32, 32, 1, height, get_current_rotation()); + + // Fence 1 + image_id = SPIRAL_SLIDE_FENCE_BOTTOM_LEFT | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 30; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + sub_98197C(image_id, 0, 0, 1, 32, 7, height, get_current_rotation()); + + // Fence 2 + image_id = SPIRAL_SLIDE_FENCE_BOTTOM_RIGHT | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 30; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 2; + sub_98197C(image_id, 0, 0, 32, 1, 7, height, get_current_rotation()); + + if (direction == 1) { + image_id = SPIRAL_SLIDE_INSIDE_R1 | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0xFFF4; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 3; + sub_98197C(image_id, 16, 16, 2, 16, 108, height, get_current_rotation()); + } else if (direction == 2) { + image_id = SPIRAL_SLIDE_INSIDE_R2 | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 0xFFF4; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 3; + sub_98197C(image_id, 16, 16, 16, 2, 108, height, get_current_rotation()); + } + + + RCT2_GLOBAL(0x009DEA56, uint16) = height + 3; + if (direction == 0) { + image_id = SPIRAL_SLIDE_CENTER_R0 | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 8; + sub_98197C(image_id, 16, 16, 16, 8, 108, height, get_current_rotation()); + } else if (direction == 1) { + image_id = SPIRAL_SLIDE_CENTER_R1 | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 14; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + sub_98197C(image_id, 16, 16, 2, 16, 108, height, get_current_rotation()); + } else if (direction == 2) { + image_id = SPIRAL_SLIDE_CENTER_R2 | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 14; + sub_98197C(image_id, 16, 16, 16, 2, 108, height, get_current_rotation()); + } else if (direction == 3) { + image_id = SPIRAL_SLIDE_CENTER_R3 | RCT2_GLOBAL(0x00F44198, uint32); + RCT2_GLOBAL(0x009DEA52, uint16) = 8; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + sub_98197C(image_id, 16, 16, 8, 16, 108, height, get_current_rotation()); + } + + rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_ride *ride = get_ride(rideIndex); + if (dpi->zoom_level == 0 && ride->slide_in_use != 0) { + uint8 slide_progress = ride->spiral_slide_progress; + if (slide_progress != 0) { + slide_progress--; + } + + if (slide_progress == 46) { + slide_progress--; + } + + if (slide_progress < 46) { + + int offset = SPIRAL_SLIDE_PEEP + 46 * direction; + int dea52, dea54, si, di; + if (direction == 0) { + dea52 = 0; + dea54 = 8; + si = 8; + di = 16; + } else if (direction == 1) { + dea52 = 14; + dea54 = 0; + si = 2; + di = 16; + } else if (direction == 2) { + dea52 = 0; + dea54 = 14; + si = 16; + di = 2; + } else if (direction == 3) { + dea52 = 8; + dea54 = 0; + si = 16; + di = 8; + } + + image_id = (offset + slide_progress) | (ride->slide_peep_t_shirt_colour << 19) | (1 << 29); + + RCT2_GLOBAL(0x009DEA52, uint16) = dea52; + RCT2_GLOBAL(0x009DEA54, uint16) = dea54; + RCT2_GLOBAL(0x009DEA56, uint16) = height + 3; + + sub_98199C(image_id, 16, 16, di, si, 108, height, get_current_rotation()); + } + } + + height += 128; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) { + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height; + RCT2_GLOBAL(0x141E9DA, uint8) = 32; + } +} + + +/** + * rct: 0x007485E8 + */ +static void spiral_slide_paint_setup_rot_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + switch (trackSequence) { + case 0: + spiral_slide_paint_tile_back(rideIndex, trackSequence, direction, height, mapElement); + break; + + case 1: + spiral_slide_paint_tile_right(rideIndex, trackSequence, direction, height, mapElement); + break; + + case 2: + spiral_slide_paint_tile_left(rideIndex, trackSequence, direction, height, mapElement); + break; + + case 3: + spiral_slide_paint_tile_front(rideIndex, trackSequence, direction, height, mapElement); + break; + } +} + +/** + * rct: 0x00748DE4 + */ +static void spiral_slide_paint_setup_rot_1(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + + switch (trackSequence) { + case 0: + spiral_slide_paint_tile_right(rideIndex, trackSequence, direction, height, mapElement); + break; + case 1: + spiral_slide_paint_tile_front(rideIndex, trackSequence, direction, height, mapElement); + break; + case 2: + spiral_slide_paint_tile_back(rideIndex, trackSequence, direction, height, mapElement); + break; + case 3: + spiral_slide_paint_tile_left(rideIndex, trackSequence, direction, height, mapElement); + break; + } +} + +/** + * rct: 0x00749628 + */ +static void spiral_slide_paint_setup_rot_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + switch (trackSequence) { + case 0: + spiral_slide_paint_tile_front(rideIndex, trackSequence, direction, height, mapElement); + break; + case 1: + spiral_slide_paint_tile_left(rideIndex, trackSequence, direction, height, mapElement); + break; + case 2: + spiral_slide_paint_tile_right(rideIndex, trackSequence, direction, height, mapElement); + break; + case 3: + spiral_slide_paint_tile_back(rideIndex, trackSequence, direction, height, mapElement); + break; + } +} + +/** + * rct: 0x00749E6C + */ +static void spiral_slide_paint_setup_rot_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) { + switch (trackSequence) { + case 0: + spiral_slide_paint_tile_left(rideIndex, trackSequence, direction, height, mapElement); + break; + case 1: + spiral_slide_paint_tile_back(rideIndex, trackSequence, direction, height, mapElement); + break; + case 2: + spiral_slide_paint_tile_front(rideIndex, trackSequence, direction, height, mapElement); + break; + case 3: + spiral_slide_paint_tile_right(rideIndex, trackSequence, direction, height, mapElement); + break; + } +} + +/** + * rct2: 0x0074840C + */ +TRACK_PAINT_FUNCTION get_track_paint_function_spiral_slide(int trackType, int direction) { + if (trackType != 110) { + return NULL; + } + + switch (direction) { + case 0: + return spiral_slide_paint_setup_rot_0; + case 1: + return spiral_slide_paint_setup_rot_1; + case 2: + return spiral_slide_paint_setup_rot_2; + case 3: + return spiral_slide_paint_setup_rot_3; + } + + return NULL; +} + /** * * rct2: 0x00761378 diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 410a85ce1d..2aba037c4b 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -6,6 +6,7 @@ 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); +TRACK_PAINT_FUNCTION get_track_paint_function_spiral_slide(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direction);