From cdab952a1cffe3e715197e14bf2176e3792a8c82 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 09:05:19 +0200 Subject: [PATCH 01/16] Paint Mini Helicopters --- src/paint/supports.c | 10 +-- src/ride/gentle/mini_helicopters.c | 140 +++++++++++++++++++++++++++++ src/ride/track_data.c | 4 +- src/ride/track_paint.h | 32 +++++++ src/ride/water/submarine_ride.c | 79 +++++----------- 5 files changed, 199 insertions(+), 66 deletions(-) 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..6f73637daa 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -13,3 +13,143 @@ * 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" + +/** rct2: 0x */ +static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** 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: 0x */ +static void paint_mini_helicopters_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** 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) +{ + +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_left_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_right_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** rct2: 0x */ +static void paint_mini_helicopters_track_right_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + +} + +/** + * rct2: 0x0081F268 + */ +TRACK_PAINT_FUNCTION get_track_paint_function_mini_helicopters(int trackType, int direction) +{ + switch (trackType) { + case TRACK_ELEM_BEGIN_STATION: + case TRACK_ELEM_MIDDLE_STATION: + case TRACK_ELEM_END_STATION: + return paint_mini_helicopters_track_station; + + case TRACK_ELEM_FLAT: + return paint_mini_helicopters_track_flat; + + case TRACK_ELEM_FLAT_TO_25_DEG_UP: + return paint_mini_helicopters_track_flat_to_25_deg_up; + case TRACK_ELEM_25_DEG_UP: + return paint_mini_helicopters_track_25_deg_up; + case TRACK_ELEM_25_DEG_UP_TO_FLAT: + return paint_mini_helicopters_track_25_deg_up_to_flat; + + case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: + return paint_mini_helicopters_track_flat_to_25_deg_down; + case TRACK_ELEM_25_DEG_DOWN: + return paint_mini_helicopters_track_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.h b/src/ride/track_paint.h index 12f67063a6..98adf779cb 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, @@ -113,6 +144,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..952ce7ea4b 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); } @@ -190,7 +151,7 @@ static void submarine_ride_paint_track_quarter_turn_3_tiles_nw_sw(uint8 rideInde switch (trackSequence) { case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2 | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); @@ -200,13 +161,13 @@ static void submarine_ride_paint_track_quarter_turn_3_tiles_nw_sw(uint8 rideInde case 1: break; case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1 | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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)); @@ -224,7 +185,7 @@ static void submarine_ride_paint_track_quarter_turn_3_tiles_ne_nw(uint8 rideInde switch (trackSequence) { case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2 | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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)); @@ -233,13 +194,13 @@ static void submarine_ride_paint_track_quarter_turn_3_tiles_ne_nw(uint8 rideInde case 1: break; case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1 | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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)); @@ -257,7 +218,7 @@ static void submarine_ride_paint_track_quarter_turn_3_tiles_se_ne(uint8 rideInde switch (trackSequence) { case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2 | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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)); @@ -266,13 +227,13 @@ static void submarine_ride_paint_track_quarter_turn_3_tiles_se_ne(uint8 rideInde case 1: break; case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1 | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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)); @@ -291,7 +252,7 @@ static void submarine_ride_paint_track_quarter_turn_3_tiles_sw_se(uint8 rideInde switch (trackSequence) { case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2 | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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)); @@ -301,13 +262,13 @@ static void submarine_ride_paint_track_quarter_turn_3_tiles_sw_se(uint8 rideInde case 1: break; case 2: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1 | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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)); @@ -350,21 +311,21 @@ static void submarine_ride_paint_track_left_quarter_turn_1_tile(uint8 rideIndex, switch (direction) { case 0: - imageId = SPR_SUBMARINE_RIDE_FLAT_QUARTER_TURN_1_TILE_SW_NW | RCT2_GLOBAL(0x00F44198, uint32); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); From 1c16b11aff9b00932c8348c97244851d4a1d5ceb Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 09:19:13 +0200 Subject: [PATCH 02/16] Draw slopes --- src/paint/map_element/map_element.h | 2 ++ src/ride/gentle/mini_helicopters.c | 37 ++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/paint/map_element/map_element.h b/src/paint/map_element/map_element.h index d053b2001f..c3259833b3 100644 --- a/src/paint/map_element/map_element.h +++ b/src/paint/map_element/map_element.h @@ -51,6 +51,8 @@ extern const uint16 segment_offsets[9]; enum { TUNNEL_0 = 0, + TUNNEL_1 = 1, + TUNNEL_2 = 2, TUNNEL_6 = 6, TUNNEL_7 = 7, TUNNEL_8 = 8, diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 6f73637daa..e47f72cdec 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -58,10 +58,41 @@ static void paint_mini_helicopters_track_flat_to_25_deg_up(uint8 rideIndex, uint } -/** rct2: 0x */ +/** 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: 0x */ @@ -76,10 +107,10 @@ static void paint_mini_helicopters_track_flat_to_25_deg_down(uint8 rideIndex, ui } -/** rct2: 0x */ +/** 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: 0x */ From e8350fd375ae0e1d4d2e7042fdfd65839b44ed0e Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 09:24:56 +0200 Subject: [PATCH 03/16] Draw flat to slope --- src/ride/gentle/mini_helicopters.c | 37 +++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index e47f72cdec..226cb4a9a6 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -52,10 +52,41 @@ static void paint_mini_helicopters_track_flat(uint8 rideIndex, uint8 trackSequen paint_util_set_general_support_height(height + 32, 0x20); } -/** rct2: 0x */ +/** 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 */ @@ -113,10 +144,10 @@ static void paint_mini_helicopters_track_25_deg_down(uint8 rideIndex, uint8 trac paint_mini_helicopters_track_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } -/** rct2: 0x */ +/** 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: 0x */ From 779f6dfe8d1b677f04c05d68bf1f9f8d01793f05 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 09:33:33 +0200 Subject: [PATCH 04/16] Draw slope to flat --- src/paint/map_element/map_element.h | 1 + src/ride/gentle/mini_helicopters.c | 35 +++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/paint/map_element/map_element.h b/src/paint/map_element/map_element.h index c3259833b3..58a2dd54ce 100644 --- a/src/paint/map_element/map_element.h +++ b/src/paint/map_element/map_element.h @@ -56,6 +56,7 @@ enum TUNNEL_6 = 6, TUNNEL_7 = 7, TUNNEL_8 = 8, + TUNNEL_12 = 0x0C, TUNNEL_14 = 0x0E }; diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 226cb4a9a6..82dac87b6e 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -126,16 +126,47 @@ static void paint_mini_helicopters_track_25_deg_up(uint8 rideIndex, uint8 trackS paint_util_set_general_support_height(height + 56, 0x20); } -/** rct2: 0x */ +/** 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 */ From 6ce21878f5f40dc35ee6857d2679f0a79f8dd4e5 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 10:08:10 +0200 Subject: [PATCH 05/16] Draw station --- src/ride/gentle/mini_helicopters.c | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 82dac87b6e..2dbaafbcc4 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -22,10 +22,61 @@ #include "../../paint/supports.h" #include "../ride_data.h" +enum +{ + SPR_22362 = 22362, + SPR_22364 = 22364, + SPR_22370 = 22370, + SPR_22428 = 22428, +}; + /** 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; + if (direction & 1) { + + } else { + imageId = SPR_22428 | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation()); + + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(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 += 6; + hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation()); + imageId = (hasFence ? SPR_22364 : SPR_22362) | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 0, 0, 32, 8, 1, height + 6, get_current_rotation()); + //height -= 5 (height + 1) + track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height + 1); + //height += 5 (height + 6) + + imageId = SPR_22362 | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 0, 24, 32, 8, 1, height, get_current_rotation()); + //height += 2 (height + 8) + + hasFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation()); + if (hasFence) { + imageId = SPR_22370 | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 0, 31, 32, 1, 7, height + 2, get_current_rotation()); + } + //height -= 7 (height + 1) + track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height); + //height += 7 (height + 8) + + //height += 25 (height + 33) + paint_util_set_general_support_height(height + 33, 0x20); + } } /** rct2: 0x0081F348 */ From fe8b7cfd78a97f3c9bda5bbf23a38f5c8c69074a Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 10:18:11 +0200 Subject: [PATCH 06/16] Flip cover drawing check --- src/ride/track_paint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index d9e6522876..28a50592c3 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -217,7 +217,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; } From 46fcfa4bab9f424d10048ca849daa7e24a163192 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 10:22:33 +0200 Subject: [PATCH 07/16] Draw station --- src/ride/gentle/mini_helicopters.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 2dbaafbcc4..a638ff559a 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -42,9 +42,11 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq if (direction & 1) { } else { + // height -= 2 (height - 2) imageId = SPR_22428 | 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_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 0, height, get_current_rotation()); @@ -53,29 +55,29 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); paint_util_push_tunnel_left(height, TUNNEL_6); - //height += 6; + //height += 5 (height + 5); hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation()); imageId = (hasFence ? SPR_22364 : SPR_22362) | RCT2_GLOBAL(0x00F4419C, uint32); sub_98196C(imageId, 0, 0, 32, 8, 1, height + 6, get_current_rotation()); - //height -= 5 (height + 1) - track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height + 1); - //height += 5 (height + 6) + //height -= 5 (height) + track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height); + //height += 5 (height + 5) imageId = SPR_22362 | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 0, 24, 32, 8, 1, height, get_current_rotation()); - //height += 2 (height + 8) + 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) { imageId = SPR_22370 | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 0, 31, 32, 1, 7, height + 2, get_current_rotation()); + sub_98196C(imageId, 0, 31, 32, 1, 7, height + 7, get_current_rotation()); } - //height -= 7 (height + 1) + //height -= 7 (height) track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height); - //height += 7 (height + 8) + //height += 7 (height + 7) - //height += 25 (height + 33) - paint_util_set_general_support_height(height + 33, 0x20); + //height += 25 (height + 32) + paint_util_set_general_support_height(height + 32, 0x20); } } From ca905a62f88a481a9db3d6f9342df2f0e039181c Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 11:30:04 +0200 Subject: [PATCH 08/16] Draw station (direction 0) --- src/ride/gentle/mini_helicopters.c | 49 +++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index a638ff559a..18f0569bf9 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -21,12 +21,19 @@ #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../ride_data.h" +#include "../../world/map.h" enum { SPR_22362 = 22362, SPR_22364 = 22364, SPR_22370 = 22370, + SPR_22372 = 22372, + SPR_22374 = 22374, + SPR_22380 = 22380, + SPR_22382 = 22382, + SPR_22388 = 22388, + SPR_22390 = 22390, SPR_22428 = 22428, }; @@ -39,9 +46,9 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq uint32 imageId; bool hasFence; - if (direction & 1) { + bool hasGreenLight = (bool) (mapElement->properties.track.sequence & 0x80); - } else { + if (direction == 0) { // height -= 2 (height - 2) imageId = SPR_22428 | RCT2_GLOBAL(0x00F441A0, uint32); sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation()); @@ -57,27 +64,59 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq //height += 5 (height + 5); hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation()); - imageId = (hasFence ? SPR_22364 : SPR_22362) | RCT2_GLOBAL(0x00F4419C, uint32); + + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION) { + if (hasGreenLight) { + imageId = (hasFence ? SPR_22382 : SPR_22390) | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = (hasFence ? SPR_22380 : SPR_22388) | RCT2_GLOBAL(0x00F4419C, uint32); + } + } else { + imageId = (hasFence ? SPR_22364 : SPR_22362) | RCT2_GLOBAL(0x00F4419C, uint32); + } sub_98196C(imageId, 0, 0, 32, 8, 1, height + 6, get_current_rotation()); //height -= 5 (height) track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height); //height += 5 (height + 5) - imageId = SPR_22362 | RCT2_GLOBAL(0x00F4419C, uint32); + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION) { + imageId = (hasGreenLight ? SPR_22390 : SPR_22388) | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = SPR_22362 | 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) { - imageId = SPR_22370 | RCT2_GLOBAL(0x00F4419C, uint32); + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION) { + imageId = SPR_22372 | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = SPR_22370 | 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) { + // Addition: draw only small fence if there is an entrance/exit at the beginning + imageId = SPR_22374 | 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) { + imageId = SPR_22374 | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); + } + //height += 25 (height + 32) paint_util_set_general_support_height(height + 32, 0x20); + } else if (direction == 1) { + + } else if (direction == 2) { + + } else if (direction == 3) { + } } From 87a39593d01f7e7564173986030180426c330985 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 11:57:57 +0200 Subject: [PATCH 09/16] Draw station direction 2 --- src/ride/gentle/mini_helicopters.c | 31 ++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 18f0569bf9..af6b1bcd29 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -27,11 +27,15 @@ enum { SPR_22362 = 22362, SPR_22364 = 22364, + SPR_22366 = 22366, + SPR_22368 = 22368, SPR_22370 = 22370, SPR_22372 = 22372, SPR_22374 = 22374, SPR_22380 = 22380, SPR_22382 = 22382, + SPR_22384 = 22384, + SPR_22386 = 22386, SPR_22388 = 22388, SPR_22390 = 22390, SPR_22428 = 22428, @@ -48,7 +52,7 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq bool hasGreenLight = (bool) (mapElement->properties.track.sequence & 0x80); - if (direction == 0) { + if (direction == 0 || direction == 2) { // height -= 2 (height - 2) imageId = SPR_22428 | RCT2_GLOBAL(0x00F441A0, uint32); sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation()); @@ -65,12 +69,14 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq //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) { + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { if (hasGreenLight) { imageId = (hasFence ? SPR_22382 : SPR_22390) | RCT2_GLOBAL(0x00F4419C, uint32); } else { imageId = (hasFence ? SPR_22380 : SPR_22388) | RCT2_GLOBAL(0x00F4419C, uint32); } + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 2) { + imageId = (hasFence ? SPR_22366 : SPR_22368) | RCT2_GLOBAL(0x00F4419C, uint32); } else { imageId = (hasFence ? SPR_22364 : SPR_22362) | RCT2_GLOBAL(0x00F4419C, uint32); } @@ -79,8 +85,10 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq 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) { + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { imageId = (hasGreenLight ? SPR_22390 : SPR_22388) | RCT2_GLOBAL(0x00F4419C, uint32); + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 2) { + imageId = SPR_22368 | RCT2_GLOBAL(0x00F4419C, uint32); } else { imageId = SPR_22362 | RCT2_GLOBAL(0x00F4419C, uint32); } @@ -89,32 +97,39 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq 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) { + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { imageId = SPR_22372 | RCT2_GLOBAL(0x00F4419C, uint32); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { + imageId = SPR_22386 | RCT2_GLOBAL(0x00F4419C, uint32); } else { imageId = SPR_22370 | 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) { + } 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_22374 | 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 beginning + imageId = SPR_22384 | 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) { + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { imageId = SPR_22374 | 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_22384 | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); } //height += 25 (height + 32) paint_util_set_general_support_height(height + 32, 0x20); } else if (direction == 1) { - } else if (direction == 2) { - } else if (direction == 3) { } From 5322c88acce60a8aa54ad3743a24278c40fea297 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 12:20:13 +0200 Subject: [PATCH 10/16] Draw 1-tile turns --- src/ride/gentle/mini_helicopters.c | 32 +++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index af6b1bcd29..59b220886d 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -300,16 +300,42 @@ static void paint_mini_helicopters_track_right_quarter_turn_3_tiles(uint8 rideIn } -/** rct2: 0x */ +/** 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) { + uint32 imageId; + switch (direction) { + case 0: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 26, 24, 1, height, 6, 2, height, get_current_rotation()); + paint_util_push_tunnel_left(height, TUNNEL_0); + break; + case 1: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 26, 26, 1, height, 0, 0, height, get_current_rotation()); + break; + case 2: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 24, 26, 1, height, 2, 6, height, get_current_rotation()); + paint_util_push_tunnel_right(height, TUNNEL_0); + break; + case 3: + imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 24, 24, 1, height, 6, 6, height, get_current_rotation()); + paint_util_push_tunnel_right(height, TUNNEL_0); + paint_util_push_tunnel_left(height, TUNNEL_0); + break; + } + + 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: 0x */ +/** 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); } /** From 66350f9d8aad2588e435b65bbad5d814e8804472 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 12:38:46 +0200 Subject: [PATCH 11/16] Name station sprites --- src/ride/gentle/mini_helicopters.c | 58 +++++++++++++++--------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 59b220886d..828c083300 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -25,20 +25,20 @@ enum { - SPR_22362 = 22362, - SPR_22364 = 22364, - SPR_22366 = 22366, - SPR_22368 = 22368, - SPR_22370 = 22370, - SPR_22372 = 22372, - SPR_22374 = 22374, - SPR_22380 = 22380, - SPR_22382 = 22382, - SPR_22384 = 22384, - SPR_22386 = 22386, - SPR_22388 = 22388, - SPR_22390 = 22390, - SPR_22428 = 22428, + SPR_STATION_PLATFORM_SW_NE = 22362, + SPR_STATION_PLATFORM_FENCED_SW_NE = 22364, + SPR_STATION_PLATFORM_BEGIN_FENCED_SW_NE = 22366, + SPR_STATION_PLATFORM_BEGIN_SW_NE = 22368, + SPR_STATION_FENCE_SW_NE = 22370, + SPR_STATION_BEGIN_ANGLE_FENCE_SW_NE = 22372, + SPR_STATION_FENCE_SMALL_NW_SE = 22374, + SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_SW_NE = 22380, + SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_SW_NE = 22382, + SPR_STATION_LIGHT_BACK_NE_SW = 22384, + SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NE_SW = 22386, + SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE = 22388, + SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE = 22390, + SPR_STATION_BASE_B_SW_NE = 22428, }; /** rct2: 0x */ @@ -54,7 +54,7 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq if (direction == 0 || direction == 2) { // height -= 2 (height - 2) - imageId = SPR_22428 | RCT2_GLOBAL(0x00F441A0, uint32); + 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) @@ -71,14 +71,14 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { if (hasGreenLight) { - imageId = (hasFence ? SPR_22382 : SPR_22390) | RCT2_GLOBAL(0x00F4419C, uint32); + 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_22380 : SPR_22388) | RCT2_GLOBAL(0x00F4419C, uint32); + 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_22366 : SPR_22368) | RCT2_GLOBAL(0x00F4419C, uint32); + imageId = (hasFence ? SPR_STATION_PLATFORM_BEGIN_FENCED_SW_NE : SPR_STATION_PLATFORM_BEGIN_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); } else { - imageId = (hasFence ? SPR_22364 : SPR_22362) | RCT2_GLOBAL(0x00F4419C, uint32); + 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 + 6, get_current_rotation()); //height -= 5 (height) @@ -86,11 +86,11 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq //height += 5 (height + 5) if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { - imageId = (hasGreenLight ? SPR_22390 : SPR_22388) | RCT2_GLOBAL(0x00F4419C, uint32); + 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_22368 | RCT2_GLOBAL(0x00F4419C, uint32); + imageId = SPR_STATION_PLATFORM_BEGIN_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); } else { - imageId = SPR_22362 | RCT2_GLOBAL(0x00F4419C, uint32); + 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) @@ -98,20 +98,20 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq 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_22372 | RCT2_GLOBAL(0x00F4419C, uint32); + 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_22386 | RCT2_GLOBAL(0x00F4419C, uint32); + imageId = SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); } else { - imageId = SPR_22370 | RCT2_GLOBAL(0x00F4419C, uint32); + 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_22374 | RCT2_GLOBAL(0x00F4419C, uint32); + 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 beginning - imageId = SPR_22384 | RCT2_GLOBAL(0x00F4419C, uint32); + 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) @@ -119,10 +119,10 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq //height += 7 (height + 7) if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { - imageId = SPR_22374 | RCT2_GLOBAL(0x00F4419C, uint32); + 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_22384 | RCT2_GLOBAL(0x00F4419C, uint32); + imageId = SPR_STATION_LIGHT_BACK_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); } From 6914c9353329a028970b53c222f6e09e4233993e Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 14:30:16 +0200 Subject: [PATCH 12/16] Draw other station rotation --- src/ride/gentle/mini_helicopters.c | 99 +++++++++++++++++++++++++++--- 1 file changed, 92 insertions(+), 7 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 828c083300..1fac4a8689 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -26,19 +26,35 @@ enum { 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_BASE_B_SW_NE = 22428, + SPR_STATION_BASE_B_NW_SE = 22429, }; /** rct2: 0x */ @@ -59,7 +75,7 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq // height += 2 (height) imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 0, height, get_current_rotation()); + 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)); @@ -80,7 +96,7 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq } 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 + 6, get_current_rotation()); + 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) @@ -110,7 +126,7 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq 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 beginning + // 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()); } @@ -125,14 +141,83 @@ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSeq 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 += 25 (height + 32) - paint_util_set_general_support_height(height + 32, 0x20); - } else if (direction == 1) { + // 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()); - } else if (direction == 3) { + 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 */ From a7cb43d863f08c4fc078da51e5352f96613967ae Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 14:48:25 +0200 Subject: [PATCH 13/16] Sort switch --- src/ride/gentle/mini_helicopters.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 1fac4a8689..896f8943a7 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -429,25 +429,25 @@ static void paint_mini_helicopters_track_right_quarter_turn_1_tile(uint8 rideInd TRACK_PAINT_FUNCTION get_track_paint_function_mini_helicopters(int trackType, int direction) { switch (trackType) { - case TRACK_ELEM_BEGIN_STATION: - case TRACK_ELEM_MIDDLE_STATION: - case TRACK_ELEM_END_STATION: - return paint_mini_helicopters_track_station; - case TRACK_ELEM_FLAT: return paint_mini_helicopters_track_flat; - case TRACK_ELEM_FLAT_TO_25_DEG_UP: - return paint_mini_helicopters_track_flat_to_25_deg_up; + 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_FLAT_TO_25_DEG_DOWN: - return paint_mini_helicopters_track_flat_to_25_deg_down; 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; From 915c3a52b634f592eece22604e8749c1da0f227f Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 14:50:06 +0200 Subject: [PATCH 14/16] Fix indentation --- src/paint/map_element/map_element.h | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/paint/map_element/map_element.h b/src/paint/map_element/map_element.h index 58a2dd54ce..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,10 @@ extern const uint16 segment_offsets[9]; enum { - TUNNEL_0 = 0, + TUNNEL_0 = 0, TUNNEL_1 = 1, TUNNEL_2 = 2, - TUNNEL_6 = 6, + TUNNEL_6 = 6, TUNNEL_7 = 7, TUNNEL_8 = 8, TUNNEL_12 = 0x0C, From 87f60b6ba453077fca6ee703b044917a17e62076 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 15:12:01 +0200 Subject: [PATCH 15/16] Refactor 1-tile corner drawing --- src/ride/gentle/mini_helicopters.c | 46 +----------------------------- src/ride/track_paint.c | 39 +++++++++++++++++++++++++ src/ride/track_paint.h | 33 +++++++++++++++++++++ src/ride/water/submarine_ride.c | 21 ++++---------- 4 files changed, 78 insertions(+), 61 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 896f8943a7..819afaca9a 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -23,40 +23,6 @@ #include "../ride_data.h" #include "../../world/map.h" -enum -{ - 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_BASE_B_SW_NE = 22428, - SPR_STATION_BASE_B_NW_SE = 22429, -}; - /** rct2: 0x */ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -388,26 +354,16 @@ static void paint_mini_helicopters_track_right_quarter_turn_3_tiles(uint8 rideIn /** 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) { - uint32 imageId; + track_paint_util_paint_left_quarter_turn_1_tile(height, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); switch (direction) { case 0: - imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 26, 24, 1, height, 6, 2, height, get_current_rotation()); paint_util_push_tunnel_left(height, TUNNEL_0); break; - case 1: - imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 26, 26, 1, height, 0, 0, height, get_current_rotation()); - break; case 2: - imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 24, 26, 1, height, 2, 6, height, get_current_rotation()); paint_util_push_tunnel_right(height, TUNNEL_0); break; case 3: - imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW | RCT2_GLOBAL(0x00F44198, uint32); - sub_98197C(imageId, 0, 0, 24, 24, 1, height, 6, 6, height, get_current_rotation()); paint_util_push_tunnel_right(height, TUNNEL_0); paint_util_push_tunnel_left(height, TUNNEL_0); break; diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 28a50592c3..745a7e4eae 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, @@ -275,6 +302,18 @@ bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const r return true; } +void track_paint_util_paint_left_quarter_turn_1_tile(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; + } +} + /** * * rct2: 0x006C4794 diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 98adf779cb..afbba9268e 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -84,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, @@ -102,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, @@ -121,12 +149,17 @@ 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_paint_left_quarter_turn_1_tile(sint16 height, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation); + 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); diff --git a/src/ride/water/submarine_ride.c b/src/ride/water/submarine_ride.c index 952ce7ea4b..f7783d9d5c 100644 --- a/src/ride/water/submarine_ride.c +++ b/src/ride/water/submarine_ride.c @@ -306,29 +306,18 @@ 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; + track_paint_util_paint_left_quarter_turn_1_tile(height - 16, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); switch (direction) { case 0: - imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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()); + paint_util_push_tunnel_left(height - 16, TUNNEL_0); break; case 2: - imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + paint_util_push_tunnel_right(height - 16, TUNNEL_0); break; case 3: - imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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); + paint_util_push_tunnel_right(height - 16, TUNNEL_0); + paint_util_push_tunnel_left(height - 16, TUNNEL_0); break; } From f015a9ae2833f64e23d55af6692a774804554086 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 19 May 2016 15:28:50 +0200 Subject: [PATCH 16/16] Refactor 3-tile turn --- src/ride/gentle/mini_helicopters.c | 42 ++++--- src/ride/track_paint.c | 85 +++++++++++++- src/ride/track_paint.h | 5 +- src/ride/water/submarine_ride.c | 171 +++-------------------------- 4 files changed, 127 insertions(+), 176 deletions(-) diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 819afaca9a..5135a4a6b7 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -339,35 +339,43 @@ static void paint_mini_helicopters_track_25_deg_down_to_flat(uint8 rideIndex, ui paint_mini_helicopters_track_flat_to_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } -/** rct2: 0x */ +/** 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); } -/** rct2: 0x */ +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_paint_left_quarter_turn_1_tile(height, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); - - 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; - } + 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); diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 745a7e4eae..bac6878b2c 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -302,7 +302,74 @@ bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const r return true; } -void track_paint_util_paint_left_quarter_turn_1_tile(sint16 height, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation) +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; @@ -314,6 +381,22 @@ void track_paint_util_paint_left_quarter_turn_1_tile(sint16 height, int directio } } +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 afbba9268e..008f9105fd 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -158,7 +158,10 @@ void track_paint_util_paint_fences(uint8 edges, rct_xy16 position, rct_map_eleme 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_paint_left_quarter_turn_1_tile(sint16 height, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation); +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); diff --git a/src/ride/water/submarine_ride.c b/src/ride/water/submarine_ride.c index f7783d9d5c..cd7be2d918 100644 --- a/src/ride/water/submarine_ride.c +++ b/src/ride/water/submarine_ride.c @@ -144,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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_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]; @@ -306,20 +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) { - track_paint_util_paint_left_quarter_turn_1_tile(height - 16, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); - - switch (direction) { - case 0: - paint_util_push_tunnel_left(height - 16, TUNNEL_0); - break; - case 2: - paint_util_push_tunnel_right(height - 16, TUNNEL_0); - break; - case 3: - paint_util_push_tunnel_right(height - 16, TUNNEL_0); - paint_util_push_tunnel_left(height - 16, 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);