From d67afb263b2c03dbf108c0142cdced59cb62dccc Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 14 Aug 2016 15:03:04 +0200 Subject: [PATCH] Integrate variables for metal supports --- src/paint/supports.c | 105 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 95 insertions(+), 10 deletions(-) diff --git a/src/paint/supports.c b/src/paint/supports.c index ecd0dd475d..d5c6f7e85e 100644 --- a/src/paint/supports.c +++ b/src/paint/supports.c @@ -44,6 +44,91 @@ const rct_xy16 loc_97B052[] = { {-1, -26} }; +/** rct2: 0x0097B062, 0x0097B063 */ +const rct_xy8 _97B062[] = { + { 18, 3 }, + { 3, 18 }, + { 18, 3 }, + { 3, 18 }, + { 32, 3 }, + { 3, 32 }, + { 32, 3 }, + { 3, 32 } +}; + +/** rct2: 0x0097B072 */ +const uint32 _97B072[][8] = { + { 3370, 3371, 3370, 3371, 3372, 3373, 3372, 3373 }, + { 3374, 3375, 3374, 3375, 3376, 3377, 3376, 3377 }, + { 3374, 3375, 3374, 3375, 3376, 3377, 3376, 3377 }, + { 3370, 3371, 3370, 3371, 3372, 3373, 3372, 3373 }, + { 3374, 3375, 3374, 3375, 3376, 3377, 3376, 3377 }, + { 3374, 3375, 3374, 3375, 3376, 3377, 3376, 3377 }, + { 3378, 3383, 3378, 3383, 3380, 3385, 3380, 3385 }, + { 3378, 3383, 3378, 3383, 3380, 3385, 3380, 3385 }, + { 3382, 3379, 3382, 3379, 3384, 3381, 3384, 3381 }, + { 3382, 3379, 3382, 3379, 3384, 3381, 3384, 3381 }, + { 3378, 3379, 3378, 3379, 3380, 3381, 3380, 3381 }, + { 3386, 3387, 3386, 3387, 3388, 3389, 3388, 3389 }, + { 3370, 3371, 3370, 3371, 3372, 3373, 3372, 3373 }, +}; + +/** rct2: 0x0097B142 */ +static const uint8 word_97B142[] = { + 6, + 3, + 3, + 6, + 3, + 3, + 6, + 6, + 6, + 6, + 4, + 3, + 6, +}; + +/** rct2: 0x0097B15C */ +static const uint32 _97B15C[][2] = { + { 3243, 3209 }, + { 3279, 3262 }, + { 3298, 3262 }, + { 3334, 3317 }, + { 0, 3658 }, + { 0, 3658 }, + { 0, 3141 }, + { 0, 3158 }, + { 0, 3175 }, + { 0, 3192 }, + { 0, 3124 }, + { 3243, 3209 }, + { 3334, 3353 }, +}; + +/** rct2: 0x0097B190 */ +static const uint32 _97B190[][2] = { + { 3243, 3226 }, // 3209 + { 3279, 3262 }, + { 3298, 3262 }, + { 3334, 3317 }, + { 0, 3658 }, + { 0, 3658 }, + { 0, 3141 }, + { 0, 3158 }, + { 0, 3175 }, + { 0, 3192 }, + { 0, 3124 }, + { 3243, 3226 }, // 3209 + { 3334, 3353 }, +}; + +/** rct2: 0x0097B404 */ +static const uint8 metal_supports_slope_image_map[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, + 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 16, 0, 17, 18, 0, +}; typedef struct supports_id_desc { uint16 full; @@ -370,7 +455,7 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int if (height < gSupportSegments[segment].height){ RCT2_GLOBAL(0x009E3294, sint16) = height; - height -= RCT2_ADDRESS(0x0097B142, sint16)[supportType]; + height -= word_97B142[supportType]; if (height < 0) return false; @@ -402,10 +487,10 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int xOffset += loc_97B052[ebp].x; yOffset += loc_97B052[ebp].y; - sint16 boundBoxLengthX = RCT2_ADDRESS(0x0097B062, uint8)[ebp * 2]; - sint16 boundBoxLengthY = RCT2_ADDRESS(0x0097B062 + 1, uint8)[ebp * 2]; + sint16 boundBoxLengthX = _97B062[ebp].x; + sint16 boundBoxLengthY = _97B062[ebp].y; - uint32 image_id = RCT2_ADDRESS(0x0097B072, uint16)[supportType * 8 + ebp]; + uint32 image_id = _97B072[supportType][ebp]; image_id |= imageColourFlags; sub_98196C(image_id, xOffset, yOffset, boundBoxLengthX, boundBoxLengthY, 1, height, rotation); @@ -414,7 +499,7 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int sint16 si = height; if (gSupportSegments[segment].slope & (1 << 5) || height - gSupportSegments[segment].height < 6 || - RCT2_ADDRESS(0x0097B15C, uint16)[supportType * 2] == 0 + _97B15C[supportType][0] == 0 ) { height = gSupportSegments[segment].height; @@ -422,8 +507,8 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int sint8 xOffset = loc_97AF20[segment].x; sint8 yOffset = loc_97AF20[segment].y; - uint32 image_id = RCT2_ADDRESS(0x0097B15C, uint16)[supportType * 2]; - image_id += RCT2_ADDRESS(0x0097B404, sint16)[gSupportSegments[segment].slope & 0x1F]; + uint32 image_id = _97B15C[supportType][0]; + image_id += metal_supports_slope_image_map[gSupportSegments[segment].slope & 0x1F]; image_id |= imageColourFlags; sub_98196C(image_id, xOffset, yOffset, 0, 0, 5, gSupportSegments[segment].height, rotation); @@ -445,7 +530,7 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int sint8 xOffset = loc_97AF20[segment].x; sint8 yOffset = loc_97AF20[segment].y; - uint32 image_id = RCT2_ADDRESS(0x0097B15C + 2, uint16)[supportType * 2]; + uint32 image_id = _97B15C[supportType][1]; image_id += heightDiff - 1; image_id |= imageColourFlags; @@ -472,7 +557,7 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int sint8 xOffset = loc_97AF20[segment].x; sint8 yOffset = loc_97AF20[segment].y; - uint32 image_id = RCT2_ADDRESS(0x0097B15C + 2, uint16)[supportType * 2]; + uint32 image_id = _97B15C[supportType][1]; image_id += z - 1; image_id |= imageColourFlags; @@ -514,7 +599,7 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int sint8 xOffset = loc_97AF20[segment].x; sint8 yOffset = loc_97AF20[segment].y; - uint32 image_id = RCT2_ADDRESS(0x0097B15C + 2, uint16)[supportType * 2]; + uint32 image_id = _97B190[supportType][1]; image_id += z - 1; image_id |= imageColourFlags;