From 96b9a4ed1885f872918f3f068a5af179c23c8e3c Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 19 Dec 2015 18:39:10 +0000 Subject: [PATCH 1/2] implement wooden_a_supports_paint_setup --- projects/openrct2.vcxproj | 4 +- projects/openrct2.vcxproj.filters | 6 + src/drawing/supports.c | 333 ++++++++++++++++++++++++++++++ src/drawing/supports.h | 8 + src/interface/viewport.c | 72 ++++--- src/interface/viewport.h | 3 +- src/ride/track_paint.c | 29 +-- 7 files changed, 413 insertions(+), 42 deletions(-) create mode 100644 src/drawing/supports.c create mode 100644 src/drawing/supports.h diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 5470566dae..59b45df7f9 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -45,6 +45,7 @@ + @@ -212,6 +213,7 @@ + @@ -509,4 +511,4 @@ xcopy /YS "$(SolutionDir)..\Data" "$(TargetDir)Data" - + \ No newline at end of file diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index e10faf806c..e3a5deeca8 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -552,6 +552,9 @@ Source + + Source\Drawing + @@ -827,5 +830,8 @@ Source\Core + + Source\Drawing + \ No newline at end of file diff --git a/src/drawing/supports.c b/src/drawing/supports.c new file mode 100644 index 0000000000..4ab328d6e3 --- /dev/null +++ b/src/drawing/supports.c @@ -0,0 +1,333 @@ +#include "../addresses.h" +#include "../interface/viewport.h" +#include "supports.h" + +typedef struct { + uint16 full; + uint16 half; + uint16 flat; + uint16 unk; +} supports_id_desc; + +/* 0x0097B1C4 */ +const supports_id_desc WoodenSupportImageIds[] = { + { 3392, 3393, 3394, 3536 }, + { 3390, 3391, 3394, 3514 }, + { 3558, 3559, 3560, 3570 }, + { 3561, 3562, 3563, 3592 }, + { 3564, 3565, 3566, 3614 }, + { 3567, 3568, 3569, 3636 }, + { 3677, 3678, 3680, 3739 }, + { 3675, 3676, 3679, 3717 }, + { 3761, 3762, 3763, 3773 }, + { 3764, 3765, 3766, 3795 }, + { 3767, 3768, 3769, 3817 }, + { 3770, 3771, 3772, 3839 }, +}; + +/* 0x0097B224 */ +const uint16 WoodenCurveSupportImageIds[] = { + 3465, + 3465, + 0, + 0, + 0, + 0, + 3681, + 3681, + 0, + 0, + 0, + 0, +}; + +typedef struct { + uint8 var_0; + uint8 var_1; + uint8 var_2; + uint8 var_3; + uint8 var_4; + uint8 var_5; + uint8 var_6; + uint8 var_7; +} unk_supports_desc; + +/* 0x0097B23C */ +const unk_supports_desc byte_97B23C[] = { + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 10, 0, 0, 10, 32, 44, 1, 1 }, + { 0, 10, 0, 32, 10, 44, 1, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 10, 0, 0, 10, 32, 44, 1, 1 }, + { 0, 10, 0, 32, 10, 44, 1, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 10, 0, 2, 10, 32, 76, 1, 1 }, + { 0, 10, 2, 32, 10, 76, 1, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 4, 0, 1 }, + { 0, 0, 0, 1, 1, 4, 0, 1 }, + { 0, 0, 0, 1, 1, 4, 0, 1 }, + { 0, 0, 0, 1, 1, 4, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 0, 0, 0, 1, 1, 8, 0, 1 }, + { 2, 2, 1, 28, 28, 2, 0, 1 }, +}; + +/* 0x0097B3C4 */ +const uint16 word_97B3C4[] = { + 0, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 14, + 0, + 0, + 0, + 17, + 0, + 16, + 15, + 0, +}; + +/** + * + * rct2: 0x006629BC + * dx: height + * ax: unknown + * ebp: imageColourFlags + * edi: unknown + * @returns true if any supports have been drawn. + */ +bool wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +{ + // { + // int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + // RCT2_CALLFUNC_X(0x006629BC, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); + // return eax & 0xFF; + // } + + RCT2_GLOBAL(0x009E32B1, uint8) = 0; + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) { + return false; + } + + if (!(RCT2_GLOBAL(0x0141E9DB, uint8) & 1)) { + return false; + } + + int z = floor2(RCT2_GLOBAL(0x00141E9D8, uint16) + 15, 16); + height -= z; + if (height < 0) { + return true; + } + height /= 16; + + bool drawFlatPiece = false; + int ecx = RCT2_GLOBAL(0x0141E9DA, uint8); + if (ecx & (1 << 5)) { + drawFlatPiece = true; + } else if (ecx & (1 << 4)) { + height -= 2; + if (height < 0) { + return true; + } + + int imageId = WoodenSupportImageIds[supportType].unk; + if (imageId != 0) { + ecx &= 0x1F; + imageId += word_97B3C4[ecx]; + imageId |= imageColourFlags; + + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = z + 2; + sub_98197C(0, 11, imageId, 0, z, 32, 32, get_current_rotation()); + + RCT2_GLOBAL(0x009E32B1, uint8) = 1; + z += 32; + } else { + z += 32; + drawFlatPiece = true; + } + } else if (ecx & 0x0F) { + height--; + if (height < 0) { + return true; + } + int imageId = WoodenSupportImageIds[supportType].unk; + if (imageId == 0) { + z += 16; + drawFlatPiece = true; + } else { + ecx &= 0x1F; + imageId += word_97B3C4[ecx]; + imageId |= imageColourFlags; + + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = z + 2; + sub_98196C(0, 11, imageId, 0, z, 32, 32, get_current_rotation()); + z += 16; + RCT2_GLOBAL(0x009E32B1, uint8) = 1; + } + } + + if (drawFlatPiece) { + int imageId = WoodenSupportImageIds[supportType].flat | imageColourFlags; + sub_98197C(0, 0, imageId, 0, z - 2, 32, 32, get_current_rotation()); + RCT2_GLOBAL(0x009E32B1, uint8) = 1; + } + + while (height != 0) { + if ((z & 16) == 0 && height >= 2 && z + 16 != RCT2_GLOBAL(0x00141E9DC, uint16)) { + // Full support + int imageId = WoodenSupportImageIds[supportType].full | imageColourFlags; + uint8 ah = ax == 2 ? 23 : 28; + sub_98196C(0, ah, imageId, 0, z, 32, 32, get_current_rotation()); + RCT2_GLOBAL(0x009E32B1, uint8) = 1; + z += 32; + height -= 2; + } else { + // Half support + int imageId = WoodenSupportImageIds[supportType].half | imageColourFlags; + uint8 ah = ax == 1 ? 7 : 12; + sub_98196C(0, ah, imageId, 0, z, 32, 32, get_current_rotation()); + z += 16; + RCT2_GLOBAL(0x009E32B1, uint8) = 1; + height -= 1; + } + } + + if (ax != 0) { + int eax = (ax - 1) & 0xFFFF; + int imageId = WoodenCurveSupportImageIds[supportType]; + if (imageId != 0 && byte_97B23C[eax].var_7 != 0) { + imageId += eax; + imageId |= imageColourFlags; + RCT2_GLOBAL(0x009DEA52, uint16) = byte_97B23C[eax].var_0; + RCT2_GLOBAL(0x009DEA54, uint16) = byte_97B23C[eax].var_1; + RCT2_GLOBAL(0x009DEA56, uint16) = byte_97B23C[eax].var_2 + z; + uint16 lengthY = byte_97B23C[eax].var_3; + uint16 lengthX = byte_97B23C[eax].var_4; + uint8 ah = byte_97B23C[eax].var_5; + if (byte_97B23C[eax].var_6 == 0 || RCT2_GLOBAL(0x009DEA58, uint32) == 0) { + sub_98197C(0, ah, imageId, 0, z, lengthY, lengthX, get_current_rotation()); + RCT2_GLOBAL(0x009E32B1, uint8) = 1; + } else { + RCT2_GLOBAL(0x009E32B1, uint8) = 1; + if (!sub_98198C(0, ah, imageId, 0, z, lengthY, lengthX, get_current_rotation())) { + int edi = RCT2_GLOBAL(0x009DEA58, uint32); + RCT2_GLOBAL(edi + 0x20, uint32) = imageColourFlags; + } + } + } + } + return false; +} + +/** + * Wooden supports + * rct2: 0x00662D5C + */ +bool wooden_b_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +{ + int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + RCT2_CALLFUNC_X(0x00662D5C, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); + return eax & 0xFF; +} + +/** + * Metal pole supports + * rct2: 0x00663105 + */ +bool metal_a_wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +{ + int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + RCT2_CALLFUNC_X(0x00663105, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); + return eax & 0xFF; +} + +/** + * Metal pole supports + * rct2: 0x00663584 + */ +bool metal_b_wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +{ + int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + RCT2_CALLFUNC_X(0x00663584, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); + return eax & 0xFF; +} + +/** + * Some kind of supports + * rct2: 0x006A2ECC + */ +bool sub_6A2ECC(int height, uint16 ax, uint32 imageColourFlags, int supportType) +{ + int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + RCT2_CALLFUNC_X(0x006A2ECC, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); + return eax & 0xFF; +} + +/** + * + * rct2: 0x006A326B + */ +bool path_wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +{ + int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + RCT2_CALLFUNC_X(0x006A326B, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); + return eax & 0xFF; +} diff --git a/src/drawing/supports.h b/src/drawing/supports.h new file mode 100644 index 0000000000..97a4ef9ec8 --- /dev/null +++ b/src/drawing/supports.h @@ -0,0 +1,8 @@ +#ifndef _DRAWING_SUPPORTS_H_ +#define _DRAWING_SUPPORTS_H_ + +#include "../common.h" + +bool wooden_a_supports_paint_setup(int height, uint16 ax, uint32 image_id, int supportType); + +#endif \ No newline at end of file diff --git a/src/interface/viewport.c b/src/interface/viewport.c index bd42241590..19dc1aafa8 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -21,6 +21,7 @@ #include "../addresses.h" #include "../config.h" #include "../drawing/drawing.h" +#include "../drawing/supports.h" #include "../localisation/localisation.h" #include "../ride/ride_data.h" #include "../ride/track_data.h" @@ -870,6 +871,24 @@ int sub_98199C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 le return 1; } +/** + * + * rct2: 0x006861AC, 0x00686337, 0x006864D0, 0x0068666B, 0x0098196C + */ +int sub_98196C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation) +{ + RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098196C, uint32)[get_current_rotation()], + al | (ah << 8), + image_id, + cl, + height, + length_y, + length_x, + rotation + ); + return 1; +} + /** * * rct2: 0x00686806, 0x006869B2, 0x00686B6F, 0x00686D31, 0x0098197C @@ -1036,6 +1055,24 @@ int sub_98197C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 le return 0; } +/** + * + * rct2: 0x00686EF0, 0x00687056, 0x006871C8, 0x0068733C, 0x0098198C + */ +int sub_98198C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation) +{ + RCT2_CALLPROC_X(RCT2_ADDRESS(0x0098196C, uint32)[get_current_rotation()], + al | (ah << 8), + image_id, + cl, + height, + length_y, + length_x, + rotation + ); + return 1; +} + /** * * rct2: 0x006D4244 @@ -1203,23 +1240,6 @@ void sprite_paint_setup(uint16 eax, uint16 ecx){ } } -/** - * - * rct2: 0x006629BC - * returns al - * ebp: image_id - * ax: unknown - * dx: height - * edi: unknown - */ -bool sub_6629BC(int height, uint16 ax, uint32 image_id, int edi){ - int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = edi, ebp = image_id; - - RCT2_CALLFUNC_X(0x006629BC, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); - - return eax & 0xFF; -} - /** * * rct2: 0x0066508C, 0x00665540 @@ -1365,11 +1385,10 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma image_id = 0x20B80000; } - if (direction & 1){ - sub_6629BC(height, 0, image_id, 1); - } - else{ - sub_6629BC(height, 0, image_id, 0); + if (direction & 1) { + wooden_a_supports_paint_setup(height, 0, image_id, 1); + } else { + wooden_a_supports_paint_setup(height, 0, image_id, 0); } RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; @@ -1486,11 +1505,10 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele image_id = 0x20B80000; } - if (direction & 1){ - sub_6629BC(height, 0, image_id, 1); - } - else{ - sub_6629BC(height, 0, image_id, 0); + if (direction & 1) { + wooden_a_supports_paint_setup(height, 0, image_id, 1); + } else { + wooden_a_supports_paint_setup(height, 0, image_id, 0); } RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; diff --git a/src/interface/viewport.h b/src/interface/viewport.h index b8e4df70fa..be4ab85a81 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -131,9 +131,10 @@ void painter_setup(); void sub_688485(); void sub_688217(); +int sub_98196C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation); int sub_98197C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation); +int sub_98198C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation); int sub_98199C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation); -bool sub_6629BC(int height, uint16 ax, uint32 image_id, int edi); void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, int bottom); diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index a5b339e18d..796e445b67 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -21,12 +21,13 @@ #include "../addresses.h" #include "../config.h" #include "../drawing/drawing.h" +#include "../drawing/supports.h" +#include "../interface/viewport.h" +#include "../interface/window.h" #include "../localisation/localisation.h" #include "../sprites.h" #include "../world/map.h" #include "../world/sprite.h" -#include "../interface/viewport.h" -#include "../interface/window.h" #include "ride_data.h" #include "track_data.h" #include "track_paint.h" @@ -37,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); @@ -341,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); @@ -410,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); @@ -460,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32); @@ -510,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); @@ -579,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32); @@ -630,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); @@ -699,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22134 | RCT2_GLOBAL(0x00F44198, uint32); @@ -768,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); - sub_6629BC(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(height, 0, image_id, direction & 1); image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32); @@ -990,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 = sub_6629BC(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); + bool hasSupports = wooden_a_supports_paint_setup(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); RCT2_GLOBAL(0x0141E9D0, sint16) = -1; RCT2_GLOBAL(0x0141E9C4, sint16) = -1; @@ -1052,6 +1053,8 @@ TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction) return NULL; } +static int tempi = 0; + /** * * rct2: 0x00763234 @@ -1061,7 +1064,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 = sub_6629BC(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); + bool hasSupports = wooden_a_supports_paint_setup(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); RCT2_GLOBAL(0x0141E9D0, sint16) = -1; RCT2_GLOBAL(0x0141E9C4, sint16) = -1; From 1ffc9a635507c458f3950d46d054eda57abe8b94 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 19 Dec 2015 21:30:32 +0000 Subject: [PATCH 2/2] fix problems with wooden_a_supports_paint_setup and refactor --- src/drawing/drawing.h | 2 + src/drawing/supports.c | 148 +++++++++++++++++++++------------------ src/drawing/supports.h | 2 +- src/interface/viewport.c | 22 ++---- src/ride/track_paint.c | 24 +++---- 5 files changed, 98 insertions(+), 100 deletions(-) diff --git a/src/drawing/drawing.h b/src/drawing/drawing.h index 69d8c85c3a..f4a6f885f7 100644 --- a/src/drawing/drawing.h +++ b/src/drawing/drawing.h @@ -69,6 +69,8 @@ typedef struct { void *data; } rct_gx; +#define SPRITE_ID_PALETTE_COLOUR_1(colourId) ((IMAGE_TYPE_USE_PALETTE << 28) | ((colourId) << 19)) + extern const uint16 palette_to_g1_offset[]; extern const uint8 peep_palette[]; extern uint8 text_palette[]; diff --git a/src/drawing/supports.c b/src/drawing/supports.c index 4ab328d6e3..f242877c07 100644 --- a/src/drawing/supports.c +++ b/src/drawing/supports.c @@ -6,7 +6,7 @@ typedef struct { uint16 full; uint16 half; uint16 flat; - uint16 unk; + uint16 slope; } supports_id_desc; /* 0x0097B1C4 */ @@ -142,23 +142,16 @@ const uint16 word_97B3C4[] = { }; /** - * + * Adds paint structs for wooden supports. * rct2: 0x006629BC - * dx: height - * ax: unknown - * ebp: imageColourFlags - * edi: unknown - * @returns true if any supports have been drawn. + * @param supportType (edi) Type and direction of supports. + * @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. */ -bool wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags) { - // { - // int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; - // RCT2_CALLFUNC_X(0x006629BC, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); - // return eax & 0xFF; - // } - - RCT2_GLOBAL(0x009E32B1, uint8) = 0; if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) { return false; } @@ -174,116 +167,131 @@ bool wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlag } height /= 16; + bool hasSupports = false; bool drawFlatPiece = false; - int ecx = RCT2_GLOBAL(0x0141E9DA, uint8); - if (ecx & (1 << 5)) { + int rotation = get_current_rotation(); + + // Draw base support (usually shaped to the slope) + int slope = RCT2_GLOBAL(0x0141E9DA, uint8); + if (slope & (1 << 5)) { + // Above scenery (just put a base piece above it) drawFlatPiece = true; - } else if (ecx & (1 << 4)) { + } else if (slope & (1 << 4)) { + // Steep diagonal (place the correct shaped support for the slope) height -= 2; if (height < 0) { return true; } - int imageId = WoodenSupportImageIds[supportType].unk; - if (imageId != 0) { - ecx &= 0x1F; - imageId += word_97B3C4[ecx]; + int imageId = WoodenSupportImageIds[supportType].slope; + if (imageId == 0) { + drawFlatPiece = true; + } else { + imageId += word_97B3C4[slope & 0x1F]; imageId |= imageColourFlags; RCT2_GLOBAL(0x009DEA52, uint16) = 0; RCT2_GLOBAL(0x009DEA54, uint16) = 0; RCT2_GLOBAL(0x009DEA56, uint16) = z + 2; - sub_98197C(0, 11, imageId, 0, z, 32, 32, get_current_rotation()); + sub_98197C(0, 11, imageId, 0, z, 32, 32, rotation); - RCT2_GLOBAL(0x009E32B1, uint8) = 1; - z += 32; - } else { - z += 32; - drawFlatPiece = true; + RCT2_GLOBAL(0x009DEA52, uint16) = 0; + RCT2_GLOBAL(0x009DEA54, uint16) = 0; + RCT2_GLOBAL(0x009DEA56, uint16) = z + 16 + 2; + sub_98197C(0, 11, imageId + 4, 0, z + 16, 32, 32, rotation); + + hasSupports = true; } - } else if (ecx & 0x0F) { + z += 32; + } else if ((slope & 0x0F) != 0) { + // 1 to 3 quarters up height--; if (height < 0) { return true; } - int imageId = WoodenSupportImageIds[supportType].unk; + + int imageId = WoodenSupportImageIds[supportType].slope; if (imageId == 0) { - z += 16; drawFlatPiece = true; } else { - ecx &= 0x1F; - imageId += word_97B3C4[ecx]; + imageId += word_97B3C4[slope & 0x1F]; imageId |= imageColourFlags; RCT2_GLOBAL(0x009DEA52, uint16) = 0; RCT2_GLOBAL(0x009DEA54, uint16) = 0; RCT2_GLOBAL(0x009DEA56, uint16) = z + 2; - sub_98196C(0, 11, imageId, 0, z, 32, 32, get_current_rotation()); - z += 16; - RCT2_GLOBAL(0x009E32B1, uint8) = 1; + sub_98196C(0, 11, imageId, 0, z, 32, 32, rotation); + hasSupports = true; } + z += 16; } + // Draw flat base support if (drawFlatPiece) { int imageId = WoodenSupportImageIds[supportType].flat | imageColourFlags; - sub_98197C(0, 0, imageId, 0, z - 2, 32, 32, get_current_rotation()); - RCT2_GLOBAL(0x009E32B1, uint8) = 1; + sub_98196C(0, 0, imageId, 0, z - 2, 32, 32, rotation); + hasSupports = true; } + // Draw repeated supports for left over space while (height != 0) { if ((z & 16) == 0 && height >= 2 && z + 16 != RCT2_GLOBAL(0x00141E9DC, uint16)) { // Full support int imageId = WoodenSupportImageIds[supportType].full | imageColourFlags; - uint8 ah = ax == 2 ? 23 : 28; - sub_98196C(0, ah, imageId, 0, z, 32, 32, get_current_rotation()); - RCT2_GLOBAL(0x009E32B1, uint8) = 1; + uint8 ah = special == 2 ? 23 : 28; + sub_98196C(0, ah, imageId, 0, z, 32, 32, rotation); + hasSupports = true; z += 32; height -= 2; } else { // Half support int imageId = WoodenSupportImageIds[supportType].half | imageColourFlags; - uint8 ah = ax == 1 ? 7 : 12; - sub_98196C(0, ah, imageId, 0, z, 32, 32, get_current_rotation()); + uint8 ah = special == 1 ? 7 : 12; + sub_98196C(0, ah, imageId, 0, z, 32, 32, rotation); + hasSupports = true; z += 16; - RCT2_GLOBAL(0x009E32B1, uint8) = 1; height -= 1; } } - if (ax != 0) { - int eax = (ax - 1) & 0xFFFF; + // Draw special pieces, e.g. curved supports + if (special != 0) { + special = (special - 1) & 0xFFFF; + int imageId = WoodenCurveSupportImageIds[supportType]; - if (imageId != 0 && byte_97B23C[eax].var_7 != 0) { - imageId += eax; + if (imageId != 0 && byte_97B23C[special].var_7 != 0) { + imageId += special; imageId |= imageColourFlags; - RCT2_GLOBAL(0x009DEA52, uint16) = byte_97B23C[eax].var_0; - RCT2_GLOBAL(0x009DEA54, uint16) = byte_97B23C[eax].var_1; - RCT2_GLOBAL(0x009DEA56, uint16) = byte_97B23C[eax].var_2 + z; - uint16 lengthY = byte_97B23C[eax].var_3; - uint16 lengthX = byte_97B23C[eax].var_4; - uint8 ah = byte_97B23C[eax].var_5; - if (byte_97B23C[eax].var_6 == 0 || RCT2_GLOBAL(0x009DEA58, uint32) == 0) { - sub_98197C(0, ah, imageId, 0, z, lengthY, lengthX, get_current_rotation()); - RCT2_GLOBAL(0x009E32B1, uint8) = 1; + + RCT2_GLOBAL(0x009DEA52, uint16) = byte_97B23C[special].var_0; + RCT2_GLOBAL(0x009DEA54, uint16) = byte_97B23C[special].var_1; + RCT2_GLOBAL(0x009DEA56, uint16) = byte_97B23C[special].var_2 + z; + uint16 lengthY = byte_97B23C[special].var_3; + uint16 lengthX = byte_97B23C[special].var_4; + uint8 ah = byte_97B23C[special].var_5; + if (byte_97B23C[special].var_6 == 0 || RCT2_GLOBAL(0x009DEA58, uint32) == 0) { + sub_98197C(0, ah, imageId, 0, z, lengthY, lengthX, rotation); + hasSupports = true; } else { - RCT2_GLOBAL(0x009E32B1, uint8) = 1; - if (!sub_98198C(0, ah, imageId, 0, z, lengthY, lengthX, get_current_rotation())) { + hasSupports = true; + if (!sub_98198C(0, ah, imageId, 0, z, lengthY, lengthX, rotation)) { int edi = RCT2_GLOBAL(0x009DEA58, uint32); RCT2_GLOBAL(edi + 0x20, uint32) = imageColourFlags; } } } } - return false; + + return hasSupports; } /** * Wooden supports * rct2: 0x00662D5C */ -bool wooden_b_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +bool wooden_b_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags) { - int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + int eax = special, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; RCT2_CALLFUNC_X(0x00662D5C, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); return eax & 0xFF; } @@ -292,9 +300,9 @@ bool wooden_b_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlag * Metal pole supports * rct2: 0x00663105 */ -bool metal_a_wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +bool metal_a_wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags) { - int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + int eax = special, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; RCT2_CALLFUNC_X(0x00663105, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); return eax & 0xFF; } @@ -303,9 +311,9 @@ bool metal_a_wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageCo * Metal pole supports * rct2: 0x00663584 */ -bool metal_b_wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +bool metal_b_wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags) { - int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + int eax = special, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; RCT2_CALLFUNC_X(0x00663584, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); return eax & 0xFF; } @@ -314,9 +322,9 @@ bool metal_b_wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageCo * Some kind of supports * rct2: 0x006A2ECC */ -bool sub_6A2ECC(int height, uint16 ax, uint32 imageColourFlags, int supportType) +bool sub_6A2ECC(int supportType, int special, int height, uint32 imageColourFlags) { - int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + int eax = special, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; RCT2_CALLFUNC_X(0x006A2ECC, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); return eax & 0xFF; } @@ -325,9 +333,9 @@ bool sub_6A2ECC(int height, uint16 ax, uint32 imageColourFlags, int supportType) * * rct2: 0x006A326B */ -bool path_wooden_a_supports_paint_setup(int height, uint16 ax, uint32 imageColourFlags, int supportType) +bool path_wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags) { - int eax = ax, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; + int eax = special, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags; RCT2_CALLFUNC_X(0x006A326B, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp); return eax & 0xFF; } diff --git a/src/drawing/supports.h b/src/drawing/supports.h index 97a4ef9ec8..f5e71b9854 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 height, uint16 ax, uint32 image_id, int supportType); +bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags); #endif \ No newline at end of file diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 19dc1aafa8..0c77c432c6 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -1381,15 +1381,10 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma } image_id = RCT2_GLOBAL(0x009E32BC, uint32); - if (!image_id){ - image_id = 0x20B80000; - } - - if (direction & 1) { - wooden_a_supports_paint_setup(height, 0, image_id, 1); - } else { - wooden_a_supports_paint_setup(height, 0, image_id, 0); + 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); RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF; RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF; @@ -1501,15 +1496,10 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele } image_id = ghost_id; - if (!image_id){ - image_id = 0x20B80000; - } - - if (direction & 1) { - wooden_a_supports_paint_setup(height, 0, image_id, 1); - } else { - wooden_a_supports_paint_setup(height, 0, image_id, 0); + 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); 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 796e445b67..26f762edd9 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, image_id, direction & 1); + wooden_a_supports_paint_setup(direction & 1, 0, height, image_id); 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(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); + bool hasSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32)); RCT2_GLOBAL(0x0141E9D0, sint16) = -1; RCT2_GLOBAL(0x0141E9C4, sint16) = -1; @@ -1053,8 +1053,6 @@ TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction) return NULL; } -static int tempi = 0; - /** * * rct2: 0x00763234 @@ -1064,7 +1062,7 @@ static int tempi = 0; */ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { - bool hasSupports = wooden_a_supports_paint_setup(height, 0, RCT2_GLOBAL(0x00F441A4, uint32), direction & 1); + bool hasSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32)); RCT2_GLOBAL(0x0141E9D0, sint16) = -1; RCT2_GLOBAL(0x0141E9C4, sint16) = -1;