From e95aefe15c5ccc720029d4efdcc9463d0c1eb7e7 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 22 May 2016 00:30:56 +0200 Subject: [PATCH] Draw 3-tile turns --- src/ride/coaster/virginia_reel.c | 61 ++++++++++++++++++++++++++++-- src/ride/gentle/mini_helicopters.c | 2 +- src/ride/track_paint.c | 26 ++++++------- src/ride/track_paint.h | 2 +- src/ride/water/submarine_ride.c | 2 +- 5 files changed, 74 insertions(+), 19 deletions(-) diff --git a/src/ride/coaster/virginia_reel.c b/src/ride/coaster/virginia_reel.c index 68b5f288f3..5693006199 100644 --- a/src/ride/coaster/virginia_reel.c +++ b/src/ride/coaster/virginia_reel.c @@ -51,7 +51,18 @@ enum SPR_VIRGINIA_REEL_25_DEG_UP_NW_SE = 21469, SPR_VIRGINIA_REEL_25_DEG_UP_NE_SW = 21470, SPR_VIRGINIA_REEL_25_DEG_UP_SE_NW = 21471, - + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0 = 21472, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1 = 21473, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2 = 21474, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0 = 21475, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1 = 21476, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2 = 21477, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0 = 21478, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1 = 21479, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2 = 21480, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0 = 21481, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1 = 21482, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2 = 21483, SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_1_TILE_SW_NW = 21484, SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_1_TILE_NW_NE = 21485, SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_1_TILE_NE_SE = 21486, @@ -130,6 +141,29 @@ static const uint32 virginia_reel_track_pieces_25_deg_up_lift_hill[4] = { SPR_VIRGINIA_REEL_25_DEG_UP_LIFT_HILL_SE_NW, }; +static const uint32 virginia_reel_track_pieces_flat_quarter_turn_3_tiles[4][3] = { + { + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2 + }, + { + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2 + }, + { + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2 + }, + { + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2 + } +}; + static const uint32 virginia_reel_track_pieces_flat_quarter_turn_1_tile[4] = { SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_1_TILE_SW_NW, SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_1_TILE_NW_NE, @@ -374,14 +408,35 @@ static void paint_viriginia_reel_station(uint8 rideIndex, uint8 trackSequence, u { } -/** rct2: 0x */ +static const uint8 virginia_reel_left_quarter_turn_supports[] = {5, 2, 3, 4}; + +/** rct2: 0x00811304 */ static void paint_viriginia_reel_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(2, height, direction, trackSequence, RCT2_GLOBAL(0x00F44198, uint32), virginia_reel_track_pieces_flat_quarter_turn_3_tiles, get_current_rotation()); + track_paint_util_left_quarter_turn_3_tiles_tunnel(height - 16, direction, trackSequence); + + switch (trackSequence) { + 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 0: + case 3: + wooden_a_supports_paint_setup(virginia_reel_left_quarter_turn_supports[direction], 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + 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 + 32, 0x20); } -/** rct2: 0x */ +static const uint8 right_quarter_turn_3_tiles_to_left_turn_map[] = {3, 1, 2, 0}; + +/** rct2: 0x00811314 */ static void paint_viriginia_reel_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_viriginia_reel_track_left_quarter_turn_3_tiles(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); } /** rct2: 0x00811324 */ diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 38debabfad..3f4b447050 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -342,7 +342,7 @@ static void paint_mini_helicopters_track_25_deg_down_to_flat(uint8 rideIndex, ui /** 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_paint(3, 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) { diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 4d2cb28cf9..b5acda4af8 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -350,7 +350,7 @@ void track_paint_util_draw_pier(rct_ride * ride, const rct_ride_entrance_definit } 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) +void track_paint_util_left_quarter_turn_3_tiles_paint(sint8 thickness, 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) { @@ -362,33 +362,33 @@ void track_paint_util_left_quarter_turn_3_tiles_paint(sint16 height, int directi 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; + case 0: sub_98197C(imageId, 0, 0, 32, 20, thickness, height, 0, 6, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 16, 16, thickness, height, 16, 0, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 20, 32, thickness, 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; + case 0: sub_98197C(imageId, 0, 0, 20, 32, thickness, height, 6, 0, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 16, 16, thickness, height, 0, 0, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 32, 20, thickness, 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; + case 0: sub_98197C(imageId, 0, 0, 32, 20, thickness, height, 0, 6, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 16, 16, thickness, height, 0, 16, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 20, 32, thickness, 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; + case 0: sub_98197C(imageId, 0, 0, 20, 32, thickness, height, 6, 0, height, rotation); break; + case 2: sub_98197C(imageId, 0, 0, 16, 16, thickness, height, 16, 16, height, rotation); break; + case 3: sub_98197C(imageId, 0, 0, 32, 20, thickness, height, 0, 6, height, rotation); break; } break; } diff --git a/src/ride/track_paint.h b/src/ride/track_paint.h index 8cd90b8967..6a1436cd21 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -168,7 +168,7 @@ bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const r bool track_paint_util_should_paint_supports(rct_xy16 position); void track_paint_util_draw_pier(rct_ride * ride, const rct_ride_entrance_definition * entranceStyle, rct_xy16 position, uint8 direction, int height, rct_map_element * mapElement, 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_paint(sint8 thickness, 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(sint8 thickness, sint16 height, sint16 boundBoxZOffset, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation); void track_paint_util_left_quarter_turn_1_tile_tunnel(sint16 height, uint8 direction, uint8 trackSequence); diff --git a/src/ride/water/submarine_ride.c b/src/ride/water/submarine_ride.c index d3a87eb4a9..963cb67d0e 100644 --- a/src/ride/water/submarine_ride.c +++ b/src/ride/water/submarine_ride.c @@ -118,7 +118,7 @@ static void submarine_ride_paint_track_flat(uint8 rideIndex, uint8 trackSequence static void submarine_ride_paint_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 - 16, direction, trackSequence, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles, get_current_rotation()); + track_paint_util_left_quarter_turn_3_tiles_paint(3, 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) {