diff --git a/src/ride/coaster/virginia_reel.c b/src/ride/coaster/virginia_reel.c index e7d5f2de76..4602200820 100644 --- a/src/ride/coaster/virginia_reel.c +++ b/src/ride/coaster/virginia_reel.c @@ -14,12 +14,13 @@ *****************************************************************************/ #pragma endregion -#include "../../addresses.h" -#include "../../config.h" -#include "../../interface/viewport.h" -#include "../../world/sprite.h" -#include "../../paint/paint.h" +#include "../../common.h" +#include "../track_paint.h" +#include "../track.h" #include "../vehicle_paint.h" +#include "../../interface/viewport.h" +#include "../../paint/paint.h" +#include "../../paint/supports.h" // 0x009927E6: static const vehicle_boundbox _virginiaReelBoundbox[] = { @@ -34,6 +35,142 @@ static const vehicle_boundbox _virginiaReelBoundbox[] = { { -11, -11, 1, 22, 22, 13 }, }; +enum +{ + SPR_VIRGINIA_REEL_FLAT_SW_NE = 21458, + SPR_VIRGINIA_REEL_FLAT_NW_SE = 21459, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_SW_NE = 21460, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_NW_SE = 21461, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_NE_SW = 21462, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_SE_NW = 21463, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_SW_NE = 21464, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_NW_SE = 21465, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_NE_SW = 21466, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_SE_NW = 21467, + SPR_VIRGINIA_REEL_25_DEG_UP_SW_NE = 21468, + 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, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_1_TILE_SE_SW = 21487, + SPR_VIRGINIA_REEL_FLAT_LIFT_HILL_SW_NE = 21488, + SPR_VIRGINIA_REEL_FLAT_LIFT_HILL_NW_SE = 21489, + SPR_VIRGINIA_REEL_FLAT_LIFT_HILL_NE_SW = 21490, + SPR_VIRGINIA_REEL_FLAT_LIFT_HILL_SE_NW = 21491, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_LIFT_HILL_SW_NE = 21492, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_LIFT_HILL_NW_SE = 21493, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_LIFT_HILL_NE_SW = 21494, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_LIFT_HILL_SE_NW = 21495, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_LIFT_HILL_SW_NE = 21496, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_LIFT_HILL_NW_SE = 21497, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_LIFT_HILL_NE_SW = 21498, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_LIFT_HILL_SE_NW = 21499, + SPR_VIRGINIA_REEL_25_DEG_UP_LIFT_HILL_SW_NE = 21500, + SPR_VIRGINIA_REEL_25_DEG_UP_LIFT_HILL_NW_SE = 21501, + SPR_VIRGINIA_REEL_25_DEG_UP_LIFT_HILL_NE_SW = 21502, + SPR_VIRGINIA_REEL_25_DEG_UP_LIFT_HILL_SE_NW = 21503, +}; + +static const uint32 virginia_reel_track_pieces_flat[4] = { + SPR_VIRGINIA_REEL_FLAT_SW_NE, + SPR_VIRGINIA_REEL_FLAT_NW_SE, + SPR_VIRGINIA_REEL_FLAT_SW_NE, + SPR_VIRGINIA_REEL_FLAT_NW_SE, +}; + +static const uint32 virginia_reel_track_pieces_flat_lift_hill[4] = { + SPR_VIRGINIA_REEL_FLAT_LIFT_HILL_SW_NE, + SPR_VIRGINIA_REEL_FLAT_LIFT_HILL_NW_SE, + SPR_VIRGINIA_REEL_FLAT_LIFT_HILL_NE_SW, + SPR_VIRGINIA_REEL_FLAT_LIFT_HILL_SE_NW, +}; + +static const uint32 virginia_reel_track_pieces_flat_to_25_deg_up[4] = { + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_SW_NE, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_NW_SE, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_NE_SW, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_SE_NW, +}; + +static const uint32 virginia_reel_track_pieces_flat_to_25_deg_up_lift_hill[4] = { + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_LIFT_HILL_SW_NE, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_LIFT_HILL_NW_SE, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_LIFT_HILL_NE_SW, + SPR_VIRGINIA_REEL_FLAT_TO_25_DEG_UP_LIFT_HILL_SE_NW, +}; + +static const uint32 virginia_reel_track_pieces_25_deg_up_to_flat[4] = { + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_SW_NE, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_NW_SE, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_NE_SW, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_SE_NW, +}; + +static const uint32 virginia_reel_track_pieces_25_deg_up_to_flat_lift_hill[4] = { + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_LIFT_HILL_SW_NE, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_LIFT_HILL_NW_SE, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_LIFT_HILL_NE_SW, + SPR_VIRGINIA_REEL_25_DEG_UP_TO_FLAT_LIFT_HILL_SE_NW, +}; + +static const uint32 virginia_reel_track_pieces_25_deg_up[4] = { + SPR_VIRGINIA_REEL_25_DEG_UP_SW_NE, + SPR_VIRGINIA_REEL_25_DEG_UP_NW_SE, + SPR_VIRGINIA_REEL_25_DEG_UP_NE_SW, + SPR_VIRGINIA_REEL_25_DEG_UP_SE_NW, +}; + +static const uint32 virginia_reel_track_pieces_25_deg_up_lift_hill[4] = { + SPR_VIRGINIA_REEL_25_DEG_UP_LIFT_HILL_SW_NE, + SPR_VIRGINIA_REEL_25_DEG_UP_LIFT_HILL_NW_SE, + SPR_VIRGINIA_REEL_25_DEG_UP_LIFT_HILL_NE_SW, + 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, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_1_TILE_NE_SE, + SPR_VIRGINIA_REEL_FLAT_QUARTER_TURN_1_TILE_SE_SW, +}; + /** * * rct2: 0x006D5B48 @@ -91,3 +228,315 @@ void vehicle_visual_virginia_reel(int x, int imageDirection, int y, int z, rct_v assert(vehicleEntry->effect_visual == 1); } + +/** rct2: 0x00811264 */ +static void paint_viriginia_reel_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + const uint32 * sprites = virginia_reel_track_pieces_flat; + if (mapElement->type & 0x80) { + sprites = virginia_reel_track_pieces_flat_lift_hill; + } + + uint32 imageId = sprites[direction] | RCT2_GLOBAL(0x00F44198, uint32); + if (direction & 1) { + sub_98197C(imageId, 0, 0, 27, 32, 2, height, 2, 0, height, get_current_rotation()); + paint_util_push_tunnel_right(height, TUNNEL_0); + } else { + sub_98197C(imageId, 0, 0, 32, 27, 2, height, 0, 2, height, get_current_rotation()); + paint_util_push_tunnel_left(height, TUNNEL_0); + } + + wooden_a_supports_paint_setup((direction & 1), 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); +} + +/** rct2: 0x00811274 */ +static void paint_viriginia_reel_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + const uint32 * sprites = virginia_reel_track_pieces_25_deg_up; + if (mapElement->type & 0x80) { + sprites = virginia_reel_track_pieces_25_deg_up_lift_hill; + } + + uint32 imageId = sprites[direction] | RCT2_GLOBAL(0x00F44198, uint32); + paint_struct * ps; + + if (direction & 1) { + ps = sub_98197C(imageId, 0, 0, 27, 32, 2, height, 2, 0, height, get_current_rotation()); + } else { + ps = sub_98197C(imageId, 0, 0, 32, 27, 2, height, 0, 2, height, get_current_rotation()); + } + + if (direction == 1 || direction == 2) { + RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; + } + + switch (direction) { + case 0: + wooden_a_supports_paint_setup(0, 9, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_left(height - 8, TUNNEL_7); + break; + case 1: + wooden_a_supports_paint_setup(1, 10, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_right(height + 8, TUNNEL_8); + break; + case 2: + wooden_a_supports_paint_setup(0, 11, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_left(height + 8, TUNNEL_8); + break; + case 3: + wooden_a_supports_paint_setup(1, 12, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_right(height - 8, TUNNEL_7); + break; + } + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 56, 0x20); +} + +/** rct2: 0x00811294 */ +static void paint_viriginia_reel_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + const uint32 * sprites = virginia_reel_track_pieces_flat_to_25_deg_up; + if (mapElement->type & 0x80) { + sprites = virginia_reel_track_pieces_flat_to_25_deg_up_lift_hill; + } + + uint32 imageId = sprites[direction] | RCT2_GLOBAL(0x00F44198, uint32); + paint_struct * ps; + switch (direction) { + case 0: + sub_98197C(imageId, 0, 0, 32, 27, 2, height, 0, 2, height, get_current_rotation()); + + wooden_a_supports_paint_setup(0, 1, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_left(height, TUNNEL_6); + break; + case 1: + ps = sub_98197C(imageId, 0, 0, 27, 32, 2, height, 2, 0, height, get_current_rotation()); + RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; + + wooden_a_supports_paint_setup(1, 2, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_right(height, TUNNEL_8); + break; + case 2: + ps = sub_98197C(imageId, 0, 0, 32, 27, 2, height, 0, 2, height, get_current_rotation()); + RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; + + wooden_a_supports_paint_setup(0, 3, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_left(height, TUNNEL_8); + break; + case 3: + sub_98197C(imageId, 0, 0, 27, 32, 2, height, 2, 0, height, get_current_rotation()); + + wooden_a_supports_paint_setup(1, 4, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_right(height, TUNNEL_6); + break; + } + + wooden_a_supports_paint_setup((direction & 1), 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 48, 0x20); +} + +/** rct2: 0x00811294 */ +static void paint_viriginia_reel_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + const uint32 * sprites = virginia_reel_track_pieces_25_deg_up_to_flat; + if (mapElement->type & 0x80) { + sprites = virginia_reel_track_pieces_25_deg_up_to_flat_lift_hill; + } + + uint32 imageId = sprites[direction] | RCT2_GLOBAL(0x00F44198, uint32); + paint_struct * ps; + + if (direction & 1) { + ps = sub_98197C(imageId, 0, 0, 27, 32, 2, height, 2, 0, height, get_current_rotation()); + } else { + ps = sub_98197C(imageId, 0, 0, 32, 27, 2, height, 0, 2, height, get_current_rotation()); + } + + if (direction == 1 || direction == 2) { + RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; + } + + switch (direction) { + case 0: + wooden_a_supports_paint_setup(0, 5, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_left(height - 8, TUNNEL_6); + break; + case 1: + wooden_a_supports_paint_setup(1, 6, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_right(height + 8, TUNNEL_14); + break; + case 2: + wooden_a_supports_paint_setup(0, 7, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_left(height + 8, TUNNEL_14); + break; + case 3: + wooden_a_supports_paint_setup(1, 8, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_right(height - 8, TUNNEL_6); + break; + } + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 40, 0x20); +} + +/** rct2: 0x008112A4 */ +static void paint_viriginia_reel_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_viriginia_reel_track_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); +} + +/** rct2: 0x008112B4 */ +static void paint_viriginia_reel_track_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_viriginia_reel_track_25_deg_up_to_flat(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); +} + +/** rct2: 0x008112C4 */ +static void paint_viriginia_reel_track_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_viriginia_reel_track_flat_to_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); +} + +/** rct2: 0x008112D4, 0x008112E4, 0x008112F4 */ +static void paint_viriginia_reel_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + uint32 imageId; + + if (direction == 0 || direction == 2) { + imageId = SPR_STATION_BASE_B_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 32, 28, 2, height - 2, 0, 2, height, get_current_rotation()); + + imageId = SPR_VIRGINIA_REEL_FLAT_SW_NE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98197C(imageId, 0, 0, 27, 32, 2, height, 2, 0, height, get_current_rotation()); + + paint_util_push_tunnel_left(height, TUNNEL_6); + } else if (direction == 1 || direction == 3) { + imageId = SPR_STATION_BASE_B_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32); + sub_98197C(imageId, 0, 0, 28, 32, 2, height - 2, 2, 0, height, get_current_rotation()); + + imageId = SPR_VIRGINIA_REEL_FLAT_NW_SE | RCT2_GLOBAL(0x00F44198, uint32); + sub_98199C(imageId, 0, 0, 20, 32, 1, height, 0, 0, height, get_current_rotation()); + + paint_util_push_tunnel_right(height, TUNNEL_6); + } + + wooden_a_supports_paint_setup((direction & 1), 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + track_paint_util_draw_station(rideIndex, trackSequence, direction, height, mapElement); + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); +} + +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); +} + +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 */ +static void paint_viriginia_reel_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + track_paint_util_left_quarter_turn_1_tile_paint(2, height, 0, direction, RCT2_GLOBAL(0x00F44198, uint32), virginia_reel_track_pieces_flat_quarter_turn_1_tile, get_current_rotation()); + + switch (direction) { + case 0: + wooden_a_supports_paint_setup(5, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_left(height, TUNNEL_6); + break; + case 1: + wooden_a_supports_paint_setup(2, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_left(height, TUNNEL_6); + break; + case 2: + wooden_a_supports_paint_setup(3, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_right(height, TUNNEL_6); + break; + case 3: + wooden_a_supports_paint_setup(4, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL); + paint_util_push_tunnel_right(height, TUNNEL_6); + paint_util_push_tunnel_left(height, TUNNEL_6); + break; + } + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + paint_util_set_general_support_height(height + 32, 0x20); +} + +/** rct2: 0x00811334 */ +static void paint_viriginia_reel_track_right_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_viriginia_reel_track_left_quarter_turn_1_tile(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); +} + +/** + * rct2: 0x00811184 + */ +TRACK_PAINT_FUNCTION get_track_paint_function_virginia_reel(int trackType, int direction) +{ + switch (trackType) { + case TRACK_ELEM_FLAT: + return paint_viriginia_reel_track_flat; + + case TRACK_ELEM_END_STATION: + case TRACK_ELEM_BEGIN_STATION: + case TRACK_ELEM_MIDDLE_STATION: + return paint_viriginia_reel_station; + + case TRACK_ELEM_25_DEG_UP: + return paint_viriginia_reel_track_25_deg_up; + case TRACK_ELEM_FLAT_TO_25_DEG_UP: + return paint_viriginia_reel_track_flat_to_25_deg_up; + case TRACK_ELEM_25_DEG_UP_TO_FLAT: + return paint_viriginia_reel_track_25_deg_up_to_flat; + + case TRACK_ELEM_25_DEG_DOWN: + return paint_viriginia_reel_track_25_deg_down; + case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: + return paint_viriginia_reel_track_flat_to_25_deg_down; + case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: + return paint_viriginia_reel_track_25_deg_down_to_flat; + + case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES: + return paint_viriginia_reel_track_left_quarter_turn_3_tiles; + case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES: + return paint_viriginia_reel_track_right_quarter_turn_3_tiles; + + case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE: + return paint_viriginia_reel_track_left_quarter_turn_1_tile; + case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE: + return paint_viriginia_reel_track_right_quarter_turn_1_tile; + } + + return NULL; +} \ No newline at end of file diff --git a/src/ride/gentle/mini_helicopters.c b/src/ride/gentle/mini_helicopters.c index 38debabfad..1468d7b162 100644 --- a/src/ride/gentle/mini_helicopters.c +++ b/src/ride/gentle/mini_helicopters.c @@ -26,163 +26,33 @@ /** rct2: 0x */ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)}; - rct_ride * ride = get_ride(rideIndex); - const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style]; uint32 imageId; - bool hasFence; - - bool hasGreenLight = (bool) (mapElement->properties.track.sequence & 0x80); if (direction == 0 || direction == 2) { - // height -= 2 (height - 2) imageId = SPR_STATION_BASE_B_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32); sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation()); - // height += 2 (height) imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32); sub_98199C(imageId, 0, 0, 32, 20, 1, height, 0, 0, height, get_current_rotation()); metal_a_supports_paint_setup(3, 5, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); metal_a_supports_paint_setup(3, 8, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); paint_util_push_tunnel_left(height, TUNNEL_6); - - //height += 5 (height + 5); - hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation()); - - if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { - if (hasGreenLight) { - imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); - } else { - imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); - } - } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 2) { - imageId = (hasFence ? SPR_STATION_PLATFORM_BEGIN_FENCED_SW_NE : SPR_STATION_PLATFORM_BEGIN_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); - } else { - imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_SW_NE : SPR_STATION_PLATFORM_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); - } - sub_98196C(imageId, 0, 0, 32, 8, 1, height + 5, get_current_rotation()); - //height -= 5 (height) - track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height); - //height += 5 (height + 5) - - if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { - imageId = (hasGreenLight ? SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); - } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 2) { - imageId = SPR_STATION_PLATFORM_BEGIN_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); - } else { - imageId = SPR_STATION_PLATFORM_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); - } - sub_98196C(imageId, 0, 24, 32, 8, 1, height + 5, get_current_rotation()); - //height += 2 (height + 7) - - hasFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation()); - if (hasFence) { - if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { - imageId = SPR_STATION_BEGIN_ANGLE_FENCE_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); - } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { - imageId = SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); - } else { - imageId = SPR_STATION_FENCE_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); - } - sub_98196C(imageId, 0, 31, 32, 1, 7, height + 7, get_current_rotation()); - } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { - // Addition: draw only small fence if there is an entrance/exit at the beginning - imageId = SPR_STATION_FENCE_SMALL_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 31, 23, 1, 8, 7, height + 7, get_current_rotation()); - } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { - // Addition: draw only small fence if there is an entrance/exit at the end - imageId = SPR_STATION_LIGHT_BACK_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 31, 23, 1, 8, 7, height + 7, get_current_rotation()); - } - //height -= 7 (height) - track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height); - //height += 7 (height + 7) - - if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { - imageId = SPR_STATION_FENCE_SMALL_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); - } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { - imageId = SPR_STATION_LIGHT_BACK_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); - } } else if (direction == 1 || direction == 3) { - // height -= 2 (height - 2) imageId = SPR_STATION_BASE_B_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32); sub_98197C(imageId, 0, 0, 28, 32, 1, height - 2, 2, 0, height, get_current_rotation()); - // height += 2 (height) imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_SE_NW | RCT2_GLOBAL(0x00F44198, uint32); sub_98199C(imageId, 0, 0, 20, 32, 1, height, 0, 0, height, get_current_rotation()); metal_a_supports_paint_setup(3, 6, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); metal_a_supports_paint_setup(3, 7, 0, height, RCT2_GLOBAL(0x00F4419C, uint32)); - paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); paint_util_push_tunnel_right(height, TUNNEL_6); - - //height += 5 (height + 5); - hasFence = track_paint_util_has_fence(EDGE_NE, position, mapElement, ride, get_current_rotation()); - - if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 3) { - if (hasGreenLight) { - imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_NW_SE : SPR_STATION_PLATFORM_END_GREEN_LIGHT_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); - } else { - imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_NW_SE : SPR_STATION_PLATFORM_END_RED_LIGHT_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); - } - } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 1) { - imageId = (hasFence ? SPR_STATION_PLATFORM_BEGIN_FENCED_NW_SE : SPR_STATION_PLATFORM_BEGIN_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); - } else { - imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_NW_SE : SPR_STATION_PLATFORM_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); - } - sub_98196C(imageId, 0, 0, 8, 32, 1, height + 5, get_current_rotation()); - //height -= 5 (height) - track_paint_util_draw_station_covers(EDGE_NE, hasFence, entranceStyle, direction, height); - //height += 5 (height + 5) - - if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 3) { - imageId = (hasGreenLight ? SPR_STATION_PLATFORM_END_GREEN_LIGHT_NW_SE : SPR_STATION_PLATFORM_END_RED_LIGHT_NW_SE) | RCT2_GLOBAL(0x00F4419C, uint32); - } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 1) { - imageId = SPR_STATION_PLATFORM_BEGIN_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - } else { - imageId = SPR_STATION_PLATFORM_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - } - sub_98196C(imageId, 24, 0, 8, 32, 1, height + 5, get_current_rotation()); - //height += 2 (height + 7) - - hasFence = track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation()); - if (hasFence) { - if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 3) { - imageId = SPR_STATION_BEGIN_ANGLE_FENCE_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 1) { - imageId = SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - } else { - imageId = SPR_STATION_FENCE_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - } - sub_98196C(imageId, 31, 0, 1, 32, 7, height + 7, get_current_rotation()); - } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 3) { - // Addition: draw only small fence if there is an entrance/exit at the beginning - imageId = SPR_STATION_FENCE_SMALL_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 23, 31, 8, 1, 7, height + 7, get_current_rotation()); - } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 1) { - // Addition: draw only small fence if there is an entrance/exit at the end - imageId = SPR_STATION_LIGHT_BACK_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 23, 31, 8, 1, 7, height + 7, get_current_rotation()); - } - - //height -= 7 (height) - track_paint_util_draw_station_covers(EDGE_SW, hasFence, entranceStyle, direction, height); - //height += 7 (height + 7) - - if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 3) { - imageId = SPR_STATION_FENCE_SMALL_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 0, 31, 8, 1, 7, height + 7, get_current_rotation()); - } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 1) { - imageId = SPR_STATION_LIGHT_BACK_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); - sub_98196C(imageId, 0, 31, 8, 1, 7, height + 7, get_current_rotation()); - } } + track_paint_util_draw_station(rideIndex, trackSequence, direction, height, mapElement); + + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); paint_util_set_general_support_height(height + 32, 0x20); } @@ -342,7 +212,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_data.c b/src/ride/track_data.c index d2c0f0f4b5..078250d2e7 100644 --- a/src/ride/track_data.c +++ b/src/ride/track_data.c @@ -5621,7 +5621,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = { 0, // RIDE_TYPE_38 0, // RIDE_TYPE_FLYING_ROLLER_COASTER 0, // RIDE_TYPE_3A - 0, // RIDE_TYPE_VIRGINIA_REEL + get_track_paint_function_virginia_reel, // RIDE_TYPE_VIRGINIA_REEL 0, // RIDE_TYPE_SPLASH_BOATS get_track_paint_function_mini_helicopters, // RIDE_TYPE_MINI_HELICOPTERS 0, // RIDE_TYPE_LAY_DOWN_ROLLER_COASTER diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 4d2cb28cf9..ff56497844 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -251,6 +251,140 @@ bool track_paint_util_should_paint_supports(rct_xy16 position) return false; } +void track_paint_util_draw_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]; + const bool hasGreenLight = (bool) (mapElement->properties.track.sequence & 0x80); + + bool hasFence; + uint32 imageId; + + if (direction == 0 || direction == 2) { + //height += 5 (height + 5); + hasFence = track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation()); + + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { + if (hasGreenLight) { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 2) { + imageId = (hasFence ? SPR_STATION_PLATFORM_BEGIN_FENCED_SW_NE : SPR_STATION_PLATFORM_BEGIN_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = (hasFence ? SPR_STATION_PLATFORM_FENCED_SW_NE : SPR_STATION_PLATFORM_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 0, 0, 32, 8, 1, height + 5, get_current_rotation()); + //height -= 5 (height) + track_paint_util_draw_station_covers(EDGE_NW, hasFence, entranceStyle, direction, height); + //height += 5 (height + 5) + + if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 0) { + imageId = (hasGreenLight ? SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE : SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE) | RCT2_GLOBAL(0x00F4419C, uint32); + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 2) { + imageId = SPR_STATION_PLATFORM_BEGIN_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = SPR_STATION_PLATFORM_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 0, 24, 32, 8, 1, height + 5, get_current_rotation()); + //height += 2 (height + 7) + + hasFence = track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation()); + if (hasFence) { + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { + imageId = SPR_STATION_BEGIN_ANGLE_FENCE_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { + imageId = SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); + } else { + imageId = SPR_STATION_FENCE_SW_NE | RCT2_GLOBAL(0x00F4419C, uint32); + } + sub_98196C(imageId, 0, 31, 32, 1, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { + // Addition: draw only small fence if there is an entrance/exit at the beginning + imageId = SPR_STATION_FENCE_SMALL_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 23, 1, 8, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { + // Addition: draw only small fence if there is an entrance/exit at the end + imageId = SPR_STATION_LIGHT_BACK_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 23, 1, 8, 7, height + 7, get_current_rotation()); + } + //height -= 7 (height) + track_paint_util_draw_station_covers(EDGE_SE, hasFence, entranceStyle, direction, height); + //height += 7 (height + 7) + + if (mapElement->properties.track.type == TRACK_ELEM_BEGIN_STATION && direction == 0) { + imageId = SPR_STATION_FENCE_SMALL_NW_SE | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); + } else if (mapElement->properties.track.type == TRACK_ELEM_END_STATION && direction == 2) { + imageId = SPR_STATION_LIGHT_BACK_NE_SW | RCT2_GLOBAL(0x00F4419C, uint32); + sub_98196C(imageId, 31, 0, 1, 8, 7, height + 7, get_current_rotation()); + } + } else if (direction == 1 || direction == 3) { + //height += 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()); + } + } +} + 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)) { @@ -271,12 +405,12 @@ bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const r break; case EDGE_SE: bounds = (rct_xyz16) {32, 32, 0}; - boundsOffset = (rct_xyz16) {1, 0, height + 31}; + boundsOffset = (rct_xyz16) {1, 0, height + 23}; imageOffset = SPR_STATION_COVER_OFFSET_NE_SW_FRONT; break; case EDGE_SW: bounds = (rct_xyz16) {32, 32, 0}; - boundsOffset = (rct_xyz16) {0, 0, height + 31}; + boundsOffset = (rct_xyz16) {0, 0, height + 23}; imageOffset = SPR_STATION_COVER_OFFSET_SE_NW_FRONT; break; case EDGE_NW: @@ -350,7 +484,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 +496,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 9fe3ab71c9..2b1c44f7d3 100644 --- a/src/ride/track_paint.h +++ b/src/ride/track_paint.h @@ -165,10 +165,11 @@ bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_eleme 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); +void track_paint_util_draw_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement); 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); @@ -198,6 +199,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direct TRACK_PAINT_FUNCTION get_track_paint_function_twist(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_virginia_reel(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_mini_helicopters(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direction); TRACK_PAINT_FUNCTION get_track_paint_function_roto_drop(int trackType, int direction); 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) {