diff --git a/CMakeLists.txt b/CMakeLists.txt index 319ffbc734..d69a6983de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -363,11 +363,11 @@ install(FILES ${DOC_FILES} DESTINATION share/doc/${PROJECT}) if (UNIX AND (NOT USE_MMAP) AND (NOT DISABLE_RCT2) AND (NOT FORCE64)) file(GLOB_RECURSE ORCT2_RIDE_SOURCES "src/ride/*/*.c") - file(GLOB_RECURSE ORCT2_RIDE_DEP_SOURCES "src/ride/ride_data.c" "src/ride/track_data.c" "src/ride/track_data_old.c" "src/ride/track_paint.c" "src/addresses.c" "src/diagnostic.c" "src/hook.c" "src/paint/map_element/map_element.c") + file(GLOB_RECURSE ORCT2_RIDE_DEP_SOURCES "src/ride/ride_data.c" "src/ride/track_data.c" "src/ride/track_data_old.c" "src/ride/track_paint.c" "src/addresses.c" "src/diagnostic.c" "src/hook.c" "src/paint/map_element/map_element.c" "src/paint/paint_helpers.c") file(GLOB_RECURSE ORCT2_TESTPAINT_SOURCES "test/testpaint/*.c" "test/testpaint/*.cpp" "test/testpaint/*.h") add_executable(testpaint EXCLUDE_FROM_ALL ${ORCT2_RIDE_SOURCES} ${ORCT2_RIDE_DEP_SOURCES} ${ORCT2_TESTPAINT_SOURCES} ${RCT2_SECTIONS}) - set_target_properties(testpaint PROPERTIES COMPILE_FLAGS "-DNO_VEHICLES") + set_target_properties(testpaint PROPERTIES COMPILE_FLAGS "-DNO_VEHICLES -D__TESTPAINT__") add_dependencies(testpaint segfiles) endif () diff --git a/src/ride/coaster/junior_roller_coaster.c b/src/ride/coaster/junior_roller_coaster.c index 86d2fc70a2..3181d7474f 100644 --- a/src/ride/coaster/junior_roller_coaster.c +++ b/src/ride/coaster/junior_roller_coaster.c @@ -2164,13 +2164,9 @@ static void junior_rc_left_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8 image_id = junior_rc_track_pieces_left_banked_to_25_deg_up[direction][0] | gTrackColours[SCHEME_TRACK]; if (direction & 1) { sub_98197C(image_id, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation()); - - paint_util_push_tunnel_right(height, 0); } else { sub_98197C(image_id, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); - - paint_util_push_tunnel_left(height, 0); } if (junior_rc_track_pieces_left_banked_to_25_deg_up[direction][1] != 0) { @@ -2190,6 +2186,13 @@ static void junior_rc_left_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8 metal_a_supports_paint_setup(edi, 4, 3, height, gTrackColours[SCHEME_SUPPORTS]); } + switch(direction) { + case 0: paint_util_push_tunnel_left(height, TUNNEL_0); break; + case 1: paint_util_push_tunnel_right(height, TUNNEL_2); break; + case 2: paint_util_push_tunnel_left(height, TUNNEL_2); break; + case 3: paint_util_push_tunnel_right(height, TUNNEL_0); break; + } + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); paint_util_set_general_support_height(height + 48, 0x20); } @@ -2204,13 +2207,9 @@ static void junior_rc_right_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8 image_id = junior_rc_track_pieces_right_banked_to_25_deg_up[direction][0] | gTrackColours[SCHEME_TRACK]; if (direction & 1) { sub_98197C(image_id, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation()); - - paint_util_push_tunnel_right(height, TUNNEL_2); } else { sub_98197C(image_id, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation()); - - paint_util_push_tunnel_left(height, TUNNEL_0); } if (junior_rc_track_pieces_right_banked_to_25_deg_up[direction][1] != 0) { @@ -2230,6 +2229,13 @@ static void junior_rc_right_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8 metal_a_supports_paint_setup(edi, 4, 3, height, gTrackColours[SCHEME_SUPPORTS]); } + switch(direction) { + case 0: paint_util_push_tunnel_left(height, TUNNEL_0); break; + case 1: paint_util_push_tunnel_right(height, TUNNEL_2); break; + case 2: paint_util_push_tunnel_left(height, TUNNEL_2); break; + case 3: paint_util_push_tunnel_right(height, TUNNEL_0); break; + } + paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0); paint_util_set_general_support_height(height + 48, 0x20); } @@ -3014,21 +3020,21 @@ static void junior_rc_right_half_banked_helix_down_small_paint_setup(uint8 rideI } if (direction == 0 && trackSequence == 0) { - paint_util_push_tunnel_left(height, TUNNEL_0); - } - - if (direction == 0 && trackSequence == 3) { - paint_util_push_tunnel_right(height + 8, TUNNEL_0); - } - - if (direction == 1 && trackSequence == 3) { paint_util_push_tunnel_left(height + 8, TUNNEL_0); } - if (direction == 3 && trackSequence == 0) { + if (direction == 0 && trackSequence == 3) { paint_util_push_tunnel_right(height, TUNNEL_0); } + if (direction == 1 && trackSequence == 3) { + paint_util_push_tunnel_left(height, TUNNEL_0); + } + + if (direction == 3 && trackSequence == 0) { + paint_util_push_tunnel_right(height + 8, TUNNEL_0); + } + int blockedSegments = 0; switch (trackSequence) { case 0: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4; break; @@ -3129,21 +3135,21 @@ static void junior_rc_right_half_banked_helix_down_large_paint_setup(uint8 rideI } if (direction == 0 && trackSequence == 0) { - paint_util_push_tunnel_left(height, TUNNEL_0); - } - - if (direction == 0 && trackSequence == 6) { - paint_util_push_tunnel_right(height + 8, TUNNEL_0); - } - - if (direction == 1 && trackSequence == 6) { paint_util_push_tunnel_left(height + 8, TUNNEL_0); } - if (direction == 3 && trackSequence == 0) { + if (direction == 0 && trackSequence == 6) { paint_util_push_tunnel_right(height, TUNNEL_0); } + if (direction == 1 && trackSequence == 6) { + paint_util_push_tunnel_left(height, TUNNEL_0); + } + + if (direction == 3 && trackSequence == 0) { + paint_util_push_tunnel_right(height + 8, TUNNEL_0); + } + switch (trackSequence) { case 0: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_BC, direction), 0xFFFF, 0); break; case 2: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_CC, direction), 0xFFFF, 0); break; diff --git a/src/ride/gentle/circus_show.c b/src/ride/gentle/circus_show.c index 5cbe977aad..424d2ec04b 100644 --- a/src/ride/gentle/circus_show.c +++ b/src/ride/gentle/circus_show.c @@ -37,12 +37,13 @@ static void paint_circus_show_tent(uint8 rideIndex, uint8 direction, sint8 al, s } uint32 imageColourFlags = gTrackColours[SCHEME_MISC]; + uint32 imageId = ride_type->vehicles[0].base_image_id; if (imageColourFlags == 0x20000000) { imageColourFlags = ride->vehicle_colours[0].body_colour << 19 | ride->vehicle_colours[0].trim_colour << 24 | 0xA0000000; + imageId += direction; } - uint32 imageId = (ride_type->vehicles[0].base_image_id + direction) | imageColourFlags; - sub_98197C(imageId, al, cl, 24, 24, 47, height + 3, al + 16, cl + 16, height + 3, get_current_rotation()); + sub_98197C(imageId | imageColourFlags, al, cl, 24, 24, 47, height + 3, al + 16, cl + 16, height + 3, get_current_rotation()); g_currently_drawn_item = savedMapElement; gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_RIDE; diff --git a/src/ride/gentle/ghost_train.c b/src/ride/gentle/ghost_train.c index 80c650734c..1749f8fa5b 100644 --- a/src/ride/gentle/ghost_train.c +++ b/src/ride/gentle/ghost_train.c @@ -258,8 +258,7 @@ static void paint_ghost_train_track_flat_to_25_deg_up(uint8 rideIndex, uint8 tra paint_util_set_general_support_height(height + 48, 0x20); } -/** rct2: 0x00770C1C */ -static void paint_ghost_train_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +static void paint_ghost_train_track_25_deg_up_to_flat_shared(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y}; @@ -281,25 +280,23 @@ static void paint_ghost_train_track_25_deg_up_to_flat(uint8 rideIndex, uint8 tra metal_a_supports_paint_setup(3, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]); } - switch (direction) { - case 0: - paint_util_push_tunnel_left(height - 8, TUNNEL_0); - break; - case 1: - paint_util_push_tunnel_right(height + 8, TUNNEL_12); - break; - case 2: - paint_util_push_tunnel_left(height + 8, TUNNEL_12); - break; - case 3: - paint_util_push_tunnel_right(height - 8, TUNNEL_0); - break; - } - 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: 0x00770C1C */ +static void paint_ghost_train_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) +{ + paint_ghost_train_track_25_deg_up_to_flat_shared(rideIndex, trackSequence, direction, height, mapElement); + + switch (direction) { + case 0: paint_util_push_tunnel_left(height - 8, TUNNEL_0); break; + case 1: paint_util_push_tunnel_right(height + 8, TUNNEL_12); break; + case 2: paint_util_push_tunnel_left(height + 8, TUNNEL_12); break; + case 3: paint_util_push_tunnel_right(height - 8, TUNNEL_0); break; + } +} + /** rct2: 0x00770C2C */ static void paint_ghost_train_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { @@ -309,7 +306,14 @@ static void paint_ghost_train_track_25_deg_down(uint8 rideIndex, uint8 trackSequ /** rct2: 0x00770C3C */ static void paint_ghost_train_track_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { - paint_ghost_train_track_25_deg_up_to_flat(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); + paint_ghost_train_track_25_deg_up_to_flat_shared(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); + + switch ((direction + 2) % 4) { + case 0: paint_util_push_tunnel_left(height - 8, TUNNEL_0); break; + case 1: paint_util_push_tunnel_right(height + 8, TUNNEL_0); break; + case 2: paint_util_push_tunnel_left(height + 8, TUNNEL_0); break; + case 3: paint_util_push_tunnel_right(height - 8, TUNNEL_0); break; + } } /** rct2: 0x00770C4C */ diff --git a/src/ride/gentle/observation_tower.c b/src/ride/gentle/observation_tower.c index 793b00c6e3..6d6a828124 100644 --- a/src/ride/gentle/observation_tower.c +++ b/src/ride/gentle/observation_tower.c @@ -88,15 +88,21 @@ static void paint_observation_tower_base(uint8 rideIndex, uint8 trackSequence, u imageId = SPR_OBSERVATION_TOWER_SEGMENT_BASE | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 2, 2, 27, height, 8, 8, height + 3, get_current_rotation()); - height += 32; imageId = SPR_OBSERVATION_TOWER_SEGMENT | gTrackColours[SCHEME_TRACK]; - sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation()); + sub_98197C(imageId, 0, 0, 2, 2, 30, height + 32, 8, 8, height + 32, get_current_rotation()); - height += 32; imageId = SPR_OBSERVATION_TOWER_SEGMENT | gTrackColours[SCHEME_TRACK]; - sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation()); + sub_98197C(imageId, 0, 0, 2, 2, 30, height + 64, 8, 8, height + 64, get_current_rotation()); - paint_util_set_vertical_tunnel(height + 32); + paint_util_set_vertical_tunnel(height + 96); + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + +#ifdef __TESTPAINT__ + paint_util_set_general_support_height(height + 32, 0x20); +#else + paint_util_set_general_support_height(height + 96, 0x20); +#endif + return; } int blockedSegments = 0; diff --git a/src/ride/thrill/roto_drop.c b/src/ride/thrill/roto_drop.c index 43137f8530..7ef986dab3 100644 --- a/src/ride/thrill/roto_drop.c +++ b/src/ride/thrill/roto_drop.c @@ -103,20 +103,26 @@ static void paint_roto_drop_base(uint8 rideIndex, uint8 trackSequence, uint8 dir imageId = (direction & 1 ? SPR_ROTO_DROP_TOWER_BASE_90_DEG : SPR_ROTO_DROP_TOWER_BASE) | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 2, 2, 27, height, 8, 8, height + 3, get_current_rotation()); - height += 32; imageId = (direction & 1 ? SPR_ROTO_DROP_TOWER_BASE_SEGMENT_90_DEG : SPR_ROTO_DROP_TOWER_BASE_SEGMENT) | gTrackColours[SCHEME_TRACK]; - sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation()); + sub_98197C(imageId, 0, 0, 2, 2, 30, height + 32, 8, 8, height + 32, get_current_rotation()); - height += 32; imageId = (direction & 1 ? SPR_ROTO_DROP_TOWER_BASE_SEGMENT_90_DEG : SPR_ROTO_DROP_TOWER_BASE_SEGMENT) | gTrackColours[SCHEME_TRACK]; - sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation()); + sub_98197C(imageId, 0, 0, 2, 2, 30, height + 64, 8, 8, height + 64, get_current_rotation()); - paint_util_set_vertical_tunnel(height + 32); + paint_util_set_vertical_tunnel(height + 96); + paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); + +#ifdef __TESTPAINT__ + paint_util_set_general_support_height(height + 32, 0x20); +#else + paint_util_set_general_support_height(height + 96, 0x20); +#endif + + return; } int blockedSegments = 0; switch (trackSequence) { - case 0: blockedSegments = SEGMENTS_ALL; break; case 1: blockedSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; break; case 2: blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; break; case 3: blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; break; diff --git a/src/ride/transport/lift.c b/src/ride/transport/lift.c index 31bc84f075..88ee911c6c 100644 --- a/src/ride/transport/lift.c +++ b/src/ride/transport/lift.c @@ -68,8 +68,11 @@ static void paint_lift_base(uint8 rideIndex, uint8 trackSequence, uint8 directio paint_util_set_vertical_tunnel(height + 96); paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); - // Original set support height to (height + 32). Caused supports to code with lift cage. +#ifdef __TESTPAINT__ + paint_util_set_general_support_height(height + 32, 0x20); +#else paint_util_set_general_support_height(height + 96, 0x20); +#endif return; } diff --git a/test/testpaint/intercept.c b/test/testpaint/intercept.c index 82bb8c4076..47e7cfaab4 100644 --- a/test/testpaint/intercept.c +++ b/test/testpaint/intercept.c @@ -251,6 +251,7 @@ enum { SPRITEGROUP_FENCE_METAL_A, // 14568 SPRITEGROUP_FENCE_METAL_B, // 14990 + SPRITEGROUP_FENCE_SPIRAL_SLIDE, // 20564 SPRITEGROUP_FLOOR_CORK, // 22134 SPRITEGROUP_FENCE_ROPE, // 22138 @@ -265,6 +266,10 @@ static int getSpriteGroup(uint16 spriteIndex) { return SPRITEGROUP_FENCE_METAL_B; } + if (spriteIndex >= 20564 && spriteIndex <= 20567) { + return SPRITEGROUP_FENCE_SPIRAL_SLIDE; + } + if (spriteIndex >= 22134 && spriteIndex <= 22137) { return SPRITEGROUP_FLOOR_CORK; }