From 1503b024c8cbd0f167c8d89f188634b279320f0c Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 24 May 2016 11:52:03 +0200 Subject: [PATCH] Draw 25 deg up - 60 deg up --- src/ride/gentle/car_ride.c | 59 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/src/ride/gentle/car_ride.c b/src/ride/gentle/car_ride.c index 52e52c433d..50ae2175d5 100644 --- a/src/ride/gentle/car_ride.c +++ b/src/ride/gentle/car_ride.c @@ -40,6 +40,12 @@ enum { SPR_CAR_RIDE_FLAT_TO_25_DEG_UP_SE_NW = 28786, SPR_CAR_RIDE_DEG_UP_TO_FLAT_SE_NW = 28787, SPR_CAR_RIDE_DEG_UP_TO_FLAT_NW_SE = 28788, + SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_SW_NE = 28789, + SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_NW_SE = 28790, + SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_NE_SW = 28791, + SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_SE_NW = 28792, + SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_FRONT_NW_SE = 28793, + SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_FRONT_NE_SW = 28794, SPR_CAR_RIDE_60_DEG_UP_SW_NE = 28801, SPR_CAR_RIDE_60_DEG_UP_NW_SE = 28802, @@ -82,6 +88,13 @@ static const uint32 car_ride_track_pieces_60_deg_up[4] = { SPR_CAR_RIDE_60_DEG_UP_SE_NW, }; +static const uint32 car_ride_track_pieces_25_deg_up_to_60_deg_up[4][2] = { + {SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_SW_NE, 0}, + {SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_NW_SE, SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_FRONT_NW_SE}, + {SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_NE_SW, SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_FRONT_NE_SW}, + {SPR_CAR_RIDE_25_DEG_UP_TO_60_DEG_UP_SE_NW, 0}, +}; + /** rct2: 0x006F72C8 */ static void paint_car_ride_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) @@ -292,9 +305,50 @@ static void paint_car_ride_track_60_deg_up(uint8 rideIndex, uint8 trackSequence, paint_util_set_general_support_height(height + 104, 0x20); } -/** rct2: 0x */ +/** rct2: 0x006F73C8 */ static void paint_car_ride_track_25_deg_up_to_60_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 = car_ride_track_pieces_25_deg_up_to_60_deg_up[direction][0] | RCT2_GLOBAL(0x00F44198, uint32); + + if (direction == 0 || direction == 2) { + sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); + } else { + sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation()); + } + + if (car_ride_track_pieces_25_deg_up_to_60_deg_up[direction][1] != 0) { + imageId = car_ride_track_pieces_25_deg_up_to_60_deg_up[direction][1] | RCT2_GLOBAL(0x00F44198, uint32); + + if (direction == 0 || direction == 2) { + sub_98197C(imageId, 0, 0, 32, 1, 66, height, 0, 27, height, get_current_rotation()); + } else { + sub_98197C(imageId, 0, 0, 1, 32, 66, height, 27, 0, 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; + } + + if (track_paint_util_should_paint_supports(position)) { + metal_a_supports_paint_setup(3, 4, 12, 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 + 72, 0x20); } /** rct2: 0x */ @@ -313,9 +367,10 @@ static void paint_car_ride_track_25_deg_down_to_60_deg_down(uint8 rideIndex, uin { } -/** rct2: 0x */ +/** rct2: 0x006F7408 */ static void paint_car_ride_track_60_deg_down_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { + paint_car_ride_track_25_deg_up_to_60_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } /** rct2: 0x */