diff --git a/src/drawing/supports.c b/src/drawing/supports.c index dc238b9ffb..fe06291c32 100644 --- a/src/drawing/supports.c +++ b/src/drawing/supports.c @@ -148,10 +148,15 @@ const uint16 word_97B3C4[] = { * @param special (ax) Used for curved supports. * @param height (dx) The height of the supports. * @param imageColourFlags (ebp) The colour and palette flags for the support sprites. - * @returns true if any supports have been drawn, otherwise false. + * @param underground (Carry flag) true if underground. + * @returns (al) true if any supports have been drawn, otherwise false. */ -bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags) +bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, bool* underground) { + if (underground != NULL){ + *underground = false; + } + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) { return false; } @@ -163,7 +168,10 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin int z = floor2(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) + 15, 16); height -= z; if (height < 0) { - return true; + if (underground != NULL) { + *underground = true; + } + return false; } height /= 16; @@ -180,7 +188,10 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin // Steep diagonal (place the correct shaped support for the slope) height -= 2; if (height < 0) { - return true; + if (underground != NULL) { + *underground = true; + } + return false; } int imageId = WoodenSupportImageIds[supportType].slope; @@ -207,7 +218,10 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin // 1 to 3 quarters up height--; if (height < 0) { - return true; + if (underground != NULL) { + *underground = true; + } + return false; } int imageId = WoodenSupportImageIds[supportType].slope; diff --git a/src/drawing/supports.h b/src/drawing/supports.h index 73b60f5fcd..abc23cd094 100644 --- a/src/drawing/supports.h +++ b/src/drawing/supports.h @@ -3,6 +3,6 @@ #include "../common.h" -bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags); +bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, bool* underground); #endif diff --git a/src/interface/viewport.c b/src/interface/viewport.c index b0040e88ad..4f5c0827b2 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -1381,7 +1381,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma if (image_id == 0) { image_id = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_SATURATED_BROWN); } - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; @@ -1496,7 +1496,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele if (image_id == 0) { image_id = SPRITE_ID_PALETTE_COLOUR_1(COLOUR_SATURATED_BROWN); } - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index 9b84ff7945..b15e3eff12 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -38,7 +38,7 @@ */ static void top_spin_paint_tile_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); @@ -342,7 +342,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di */ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); @@ -411,7 +411,7 @@ static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 di */ static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); @@ -461,7 +461,7 @@ static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 di */ static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); @@ -511,7 +511,7 @@ static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 di */ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); @@ -580,7 +580,7 @@ static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 di */ static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); @@ -631,7 +631,7 @@ static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 di */ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); @@ -700,7 +700,7 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di */ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22134 | RCT2_GLOBAL(0x00F44198, uint32); @@ -769,7 +769,7 @@ static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 di */ static void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32); - wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL); image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); @@ -991,7 +991,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int directi */ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - bool hasSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32)); + bool hasSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32), NULL); RCT2_GLOBAL(0x0141E9D0, sint16) = -1; RCT2_GLOBAL(0x0141E9C4, sint16) = -1; @@ -1062,7 +1062,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction) */ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - bool hasSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32)); + bool hasSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32), NULL); RCT2_GLOBAL(0x0141E9D0, sint16) = -1; RCT2_GLOBAL(0x0141E9C4, sint16) = -1;