From 065e23cc56102699f2b158e2760fac8cff7b0c48 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 1 Oct 2016 00:15:21 +0200 Subject: [PATCH 1/8] Update CMake target --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 () From 95cae68e5f86908879c1a7c257b3ef3ac0bb3706 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 1 Oct 2016 00:28:11 +0200 Subject: [PATCH 2/8] Fix Observation Tower --- src/ride/gentle/observation_tower.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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; From 88235d1b0b67862b4beaeb86774442250b0cee54 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 1 Oct 2016 00:28:17 +0200 Subject: [PATCH 3/8] Fix Roto Drop --- src/ride/thrill/roto_drop.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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; From 142bb0ca22c95602cf6c6c0b8bf70eb8ec04d621 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 1 Oct 2016 00:28:23 +0200 Subject: [PATCH 4/8] Fix Lift --- src/ride/transport/lift.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } From 584ef402c73b5a286efcb9a1caf3f8ce467404d3 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 1 Oct 2016 00:45:44 +0200 Subject: [PATCH 5/8] Fix Ghost Train --- src/ride/gentle/ghost_train.c | 40 +++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 18 deletions(-) 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 */ From db85b413b5e5537f3c02c23347dacf57a0886a20 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 1 Oct 2016 01:08:12 +0200 Subject: [PATCH 6/8] Fix Circus Show --- src/ride/gentle/circus_show.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; From 4860f0c6ab4043e0d6dd832d17ef5ebc858a9601 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 1 Oct 2016 01:20:44 +0200 Subject: [PATCH 7/8] Add sprite group for spiral slide fences --- test/testpaint/intercept.c | 5 +++++ 1 file changed, 5 insertions(+) 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; } From 7693ba1af932cf191779360dccb880649be1b372 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 1 Oct 2016 01:29:23 +0200 Subject: [PATCH 8/8] Partly fix Junior RC --- src/ride/coaster/junior_roller_coaster.c | 58 +++++++++++++----------- 1 file changed, 32 insertions(+), 26 deletions(-) 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;