diff --git a/src/paint/map_element/map_element.c b/src/paint/map_element/map_element.c index a2cf71d677..4a5e72ae8e 100644 --- a/src/paint/map_element/map_element.c +++ b/src/paint/map_element/map_element.c @@ -38,6 +38,7 @@ tunnel_entry gLeftTunnels[65]; uint8 gLeftTunnelCount; tunnel_entry gRightTunnels[65]; uint8 gRightTunnelCount; +uint8 gVerticalTunnelHeight; #endif static void blank_tiles_paint(int x, int y); @@ -146,7 +147,8 @@ static void sub_68B3FB(int x, int y) gLeftTunnels[0] = (tunnel_entry){0xFF, 0xFF}; gRightTunnels[0] = (tunnel_entry){0xFF, 0xFF}; - RCT2_GLOBAL(0x9E323C, uint8_t) = 0xFF; + gVerticalTunnelHeight = 0xFF; + RCT2_GLOBAL(0x9DE56A, uint16_t) = x; RCT2_GLOBAL(0x9DE56E, uint16_t) = y; RCT2_GLOBAL(0x9DE574, uint16_t) = x; @@ -323,6 +325,11 @@ void paint_util_push_tunnel_right(uint16 height, uint8 type) gRightTunnelCount++; } +void paint_util_set_vertical_tunnel(uint16 height) +{ + gVerticalTunnelHeight = height / 16; +} + void paint_util_set_general_support_height(sint16 height, uint8 slope) { if (gSupport.height >= height) { diff --git a/src/paint/map_element/map_element.h b/src/paint/map_element/map_element.h index a42a4917ba..655a460d6a 100644 --- a/src/paint/map_element/map_element.h +++ b/src/paint/map_element/map_element.h @@ -72,17 +72,20 @@ extern tunnel_entry gLeftTunnels[65]; extern uint8 gLeftTunnelCount; extern tunnel_entry gRightTunnels[65]; extern uint8 gRightTunnelCount; +extern uint8 gVerticalTunnelHeight; #else #define gLeftTunnels RCT2_ADDRESS(0x009E3138, tunnel_entry) #define gLeftTunnelCount RCT2_GLOBAL(0x0141F56A, uint8) #define gRightTunnels RCT2_ADDRESS(0x009E30B6, tunnel_entry) #define gRightTunnelCount RCT2_GLOBAL(0x0141F56B, uint8) +#define gVerticalTunnelHeight RCT2_GLOBAL(0x009E323C, uint8) #endif extern bool gShowSupportSegmentHeights; void paint_util_push_tunnel_left(uint16 height, uint8 type); void paint_util_push_tunnel_right(uint16 height, uint8 type); +void paint_util_set_vertical_tunnel(uint16 height); void paint_util_set_general_support_height(sint16 height, uint8 slope); void paint_util_force_set_general_support_height(sint16 height, uint8 slope); diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index 698cdf30b5..a0395eb63e 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -1037,7 +1037,7 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement) bool has_surface = false; - if (RCT2_GLOBAL(0x9E323C, uint8) * 16 == height) { + if (gVerticalTunnelHeight * 16 == height) { // Vertical tunnels sub_98197C(1575, 0, 0, 1, 30, 39, height, -2, 1, height - 40, rotation); sub_98197C(1576, 0, 0, 30, 1, 0, height, 1, 31, height, rotation); diff --git a/src/ride/gentle/observation_tower.c b/src/ride/gentle/observation_tower.c index 6c749ef259..6453ff15a0 100644 --- a/src/ride/gentle/observation_tower.c +++ b/src/ride/gentle/observation_tower.c @@ -97,7 +97,7 @@ static void paint_observation_tower_base(uint8 rideIndex, uint8 trackSequence, u imageId = SPR_OBSERVATION_TOWER_SEGMENT | RCT2_GLOBAL(0x00F44198, uint32); sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation()); - RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8); + paint_util_set_vertical_tunnel(height + 32); } int blockedSegments = 0; @@ -135,7 +135,7 @@ static void paint_observation_tower_section(uint8 rideIndex, uint8 trackSequence paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); - RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8); + paint_util_set_vertical_tunnel(height + 32); paint_util_set_general_support_height(height + 32, 0x20); } diff --git a/src/ride/thrill/launched_freefall.c b/src/ride/thrill/launched_freefall.c index be76745fe3..2ff4f7311e 100644 --- a/src/ride/thrill/launched_freefall.c +++ b/src/ride/thrill/launched_freefall.c @@ -112,7 +112,7 @@ static void paint_launched_freefall_base(uint8 rideIndex, uint8 trackSequence, u imageId = SPR_LAUNCHED_FREEFALL_TOWER_SEGMENT | RCT2_GLOBAL(0x00F44198, uint32); sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation()); - RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8); + paint_util_set_vertical_tunnel(height + 32); height -= 64; } @@ -152,7 +152,7 @@ static void paint_launched_freefall_tower_section(uint8 rideIndex, uint8 trackSe paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); - RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8); + paint_util_set_vertical_tunnel(height + 32); paint_util_set_general_support_height(height + 32, 0x20); } diff --git a/src/ride/thrill/roto_drop.c b/src/ride/thrill/roto_drop.c index 74d5c633d2..a2c8dc8b0a 100644 --- a/src/ride/thrill/roto_drop.c +++ b/src/ride/thrill/roto_drop.c @@ -112,7 +112,7 @@ static void paint_roto_drop_base(uint8 rideIndex, uint8 trackSequence, uint8 dir imageId = (direction & 1 ? SPR_ROTO_DROP_TOWER_BASE_SEGMENT_90_DEG : SPR_ROTO_DROP_TOWER_BASE_SEGMENT) | RCT2_GLOBAL(0x00F44198, uint32); sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation()); - RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8); + paint_util_set_vertical_tunnel(height + 32); } int blockedSegments = 0; @@ -150,7 +150,7 @@ static void paint_roto_drop_tower_section(uint8 rideIndex, uint8 trackSequence, paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); - RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8); + paint_util_set_vertical_tunnel(height + 32); paint_util_set_general_support_height(height + 32, 0x20); } diff --git a/src/ride/transport/lift.c b/src/ride/transport/lift.c index 87cfe430c4..143344ec45 100644 --- a/src/ride/transport/lift.c +++ b/src/ride/transport/lift.c @@ -66,7 +66,7 @@ static void paint_lift_base(uint8 rideIndex, uint8 trackSequence, uint8 directio paint_lift_cage(-1, RCT2_GLOBAL(0x00F44198, uint32), height + 64, get_current_rotation()); - RCT2_GLOBAL(0x9E323C, uint16) = (((height + 96) >> 4) & 0x00FF) | (6 << 8); + 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. @@ -111,7 +111,7 @@ static void paint_lift_tower_section(uint8 rideIndex, uint8 trackSequence, uint8 paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); - RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8); + paint_util_set_vertical_tunnel(height + 32); paint_util_set_general_support_height(height + 32, 0x20); }