Refactor uses of PaintAddImageAsParent in Supports.cpp

This commit is contained in:
Matt 2021-03-08 17:47:18 +02:00
parent db493d157e
commit 1d3b56a59e
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 21 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/*****************************************************************************
/*****************************************************************************
* Copyright (c) 2014-2020 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
@ -521,9 +521,9 @@ bool wooden_a_supports_paint_setup(
{
imageId += word_97B3C4[slope & TILE_ELEMENT_SURFACE_SLOPE_MASK];
imageId |= imageColourFlags;
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 11, z, 0, 0, z + 2);
PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 32, 32, 11 }, { 0, 0, z + 2 });
PaintAddImageAsParent(session, imageId + 4, 0, 0, 32, 32, 11, z + 16, 0, 0, z + 16 + 2);
PaintAddImageAsParent(session, imageId + 4, { 0, 0, z + 16 }, { 32, 32, 11 }, { 0, 0, z + 16 + 2 });
hasSupports = true;
}
@ -552,7 +552,7 @@ bool wooden_a_supports_paint_setup(
imageId += word_97B3C4[slope & TILE_ELEMENT_SURFACE_SLOPE_MASK];
imageId |= imageColourFlags;
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 11, z, 0, 0, z + 2);
PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 32, 32, 11 }, { 0, 0, z + 2 });
hasSupports = true;
}
z += 16;
@ -562,7 +562,7 @@ bool wooden_a_supports_paint_setup(
if (drawFlatPiece)
{
int32_t imageId = WoodenSupportImageIds[supportType].flat | imageColourFlags;
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, z - 2);
PaintAddImageAsParent(session, imageId, { 0, 0, z - 2 }, { 32, 32, 0 });
hasSupports = true;
}
@ -574,7 +574,7 @@ bool wooden_a_supports_paint_setup(
// Full support
int32_t imageId = WoodenSupportImageIds[supportType].full | imageColourFlags;
uint8_t ah = height == 2 ? 23 : 28;
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, ah, z);
PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 32, 32, ah });
hasSupports = true;
z += 32;
height -= 2;
@ -584,7 +584,7 @@ bool wooden_a_supports_paint_setup(
// Half support
int32_t imageId = WoodenSupportImageIds[supportType].half | imageColourFlags;
uint8_t ah = height == 1 ? 7 : 12;
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, ah, z);
PaintAddImageAsParent(session, imageId, { 0, 0, z }, { 32, 32, ah });
hasSupports = true;
z += 16;
height -= 1;
@ -697,7 +697,8 @@ bool wooden_b_supports_paint_setup(
{
imageId += word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK];
PaintAddImageAsParent(session, imageId | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2);
PaintAddImageAsParent(
session, imageId | imageColourFlags, { 0, 0, baseHeight }, { 32, 32, 11 }, { 0, 0, baseHeight + 2 });
baseHeight += 16;
PaintAddImageAsParent(session, (imageId + 4) | imageColourFlags, 0, 0, 32, 32, 3, baseHeight, 0, 0, baseHeight + 2);
@ -726,7 +727,8 @@ bool wooden_b_supports_paint_setup(
{
imageId += word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK];
PaintAddImageAsParent(session, imageId | imageColourFlags, 0, 0, 32, 32, 3, baseHeight, 0, 0, baseHeight + 2);
PaintAddImageAsParent(
session, imageId | imageColourFlags, { 0, 0, baseHeight }, { 32, 32, 3 }, { 0, 0, baseHeight + 2 });
baseHeight += 16;
_9E32B1 = true;
@ -743,7 +745,7 @@ bool wooden_b_supports_paint_setup(
else
{
PaintAddImageAsParent(
session, WoodenSupportImageIds[supportType].flat | imageColourFlags, 0, 0, 32, 32, 0, baseHeight - 2);
session, WoodenSupportImageIds[supportType].flat | imageColourFlags, { 0, 0, baseHeight - 2 }, { 32, 32, 0 });
_9E32B1 = true;
}
}
@ -885,7 +887,7 @@ bool metal_a_supports_paint_setup(
uint32_t image_id = _metalSupportTypeToCrossbeamImages[supportType][ebp];
image_id |= imageColourFlags;
PaintAddImageAsParent(session, image_id, xOffset, yOffset, boundBoxLengthX, boundBoxLengthY, 1, height);
PaintAddImageAsParent(session, image_id, { xOffset, yOffset, height }, { boundBoxLengthX, boundBoxLengthY, 1 });
segment = newSegment;
}
@ -904,7 +906,7 @@ bool metal_a_supports_paint_setup(
image_id += metal_supports_slope_image_map[supportSegments[segment].slope & TILE_ELEMENT_SURFACE_SLOPE_MASK];
image_id |= imageColourFlags;
PaintAddImageAsParent(session, image_id, xOffset, yOffset, 0, 0, 5, supportSegments[segment].height);
PaintAddImageAsParent(session, image_id, { xOffset, yOffset, supportSegments[segment].height }, { 0, 0, 5 });
height = supportSegments[segment].height + 6;
}
@ -928,7 +930,7 @@ bool metal_a_supports_paint_setup(
image_id += heightDiff - 1;
image_id |= imageColourFlags;
PaintAddImageAsParent(session, image_id, xOffset, yOffset, 0, 0, heightDiff - 1, height);
PaintAddImageAsParent(session, image_id, { xOffset, yOffset, height }, { 0, 0, heightDiff - 1 });
}
height += heightDiff;
@ -959,7 +961,7 @@ bool metal_a_supports_paint_setup(
if (count == 3 && z == 0x10)
image_id++;
PaintAddImageAsParent(session, image_id, xOffset, yOffset, 0, 0, z - 1, height);
PaintAddImageAsParent(session, image_id, { xOffset, yOffset, height }, { 0, 0, z - 1 });
height += z;
}
@ -1001,7 +1003,8 @@ bool metal_a_supports_paint_setup(
image_id |= imageColourFlags;
PaintAddImageAsParent(
session, image_id, xOffset, yOffset, 0, 0, 0, height, boundBoxOffset.x, boundBoxOffset.y, boundBoxOffset.z);
session, image_id, { xOffset, yOffset, height }, { 0, 0, 0 },
{ boundBoxOffset.x, boundBoxOffset.y, boundBoxOffset.z });
height += z;
}
@ -1252,7 +1255,8 @@ bool path_a_supports_paint_setup(
uint32_t imageId = (supportType * 24) + word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]
+ railingEntry->bridge_image;
PaintAddImageAsParent(session, imageId | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2);
PaintAddImageAsParent(
session, imageId | imageColourFlags, { 0, 0, baseHeight }, { 32, 32, 11 }, { 0, 0, baseHeight + 2 });
baseHeight += 16;
PaintAddImageAsParent(session, (imageId + 4) | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2);
@ -1273,7 +1277,7 @@ bool path_a_supports_paint_setup(
uint32_t ebx = (supportType * 24) + word_97B3C4[session->Support.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK]
+ railingEntry->bridge_image;
PaintAddImageAsParent(session, ebx | imageColourFlags, 0, 0, 32, 32, 11, baseHeight, 0, 0, baseHeight + 2);
PaintAddImageAsParent(session, ebx | imageColourFlags, { 0, 0, baseHeight }, { 32, 32, 11 }, { 0, 0, baseHeight + 2 });
hasSupports = true;
baseHeight += 16;