1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Simplify more argument passing to PaintAddImageAsParent

This commit is contained in:
ZehMatt
2021-08-20 23:01:57 +03:00
parent 7764bb910f
commit 3d90257dde
5 changed files with 40 additions and 53 deletions

View File

@@ -1079,9 +1079,7 @@ bool metal_b_supports_paint_setup(
PaintAddImageAsParent(
session, _metalSupportTypeToCrossbeamImages[supportType][ebp] | imageColourFlags,
{ SupportBoundBoxes[originalSegment].x + loc_97B052[ebp].x,
SupportBoundBoxes[originalSegment].y + loc_97B052[ebp].y, baseHeight },
{ _97B062[ebp].x, _97B062[ebp].y, 1 });
{ SupportBoundBoxes[originalSegment] + loc_97B052[ebp], baseHeight }, { _97B062[ebp], 1 });
}
int32_t si = baseHeight;
@@ -1097,8 +1095,7 @@ bool metal_b_supports_paint_setup(
uint32_t imageId = _97B15C[supportType].base_id + imageOffset;
PaintAddImageAsParent(
session, imageId | imageColourFlags,
{ SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, supportSegments[segment].height }, { 0, 0, 5 });
session, imageId | imageColourFlags, { SupportBoundBoxes[segment], supportSegments[segment].height }, { 0, 0, 5 });
baseHeight = supportSegments[segment].height + 6;
}
@@ -1114,7 +1111,7 @@ bool metal_b_supports_paint_setup(
{
PaintAddImageAsParent(
session, (_97B15C[supportType].beam_id + (heightDiff - 1)) | imageColourFlags,
{ SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, baseHeight }, { 0, 0, heightDiff - 1 });
{ SupportBoundBoxes[segment], baseHeight }, { 0, 0, heightDiff - 1 });
}
baseHeight += heightDiff;
@@ -1149,8 +1146,7 @@ bool metal_b_supports_paint_setup(
}
PaintAddImageAsParent(
session, imageId | imageColourFlags, { SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, baseHeight },
{ 0, 0, beamLength - 1 });
session, imageId | imageColourFlags, { SupportBoundBoxes[segment], baseHeight }, { 0, 0, beamLength - 1 });
baseHeight += beamLength;
i++;
@@ -1179,9 +1175,8 @@ bool metal_b_supports_paint_setup(
uint32_t imageId = _97B15C[supportType].beam_id + (beamLength - 1);
PaintAddImageAsParent(
session, imageId | imageColourFlags,
{ SupportBoundBoxes[originalSegment].x, SupportBoundBoxes[originalSegment].y, baseHeight }, { 0, 0, 0 },
{ SupportBoundBoxes[originalSegment].x, SupportBoundBoxes[originalSegment].y, height });
session, imageId | imageColourFlags, { SupportBoundBoxes[originalSegment], baseHeight }, { 0, 0, 0 },
{ SupportBoundBoxes[originalSegment], height });
baseHeight += beamLength;
}
}
@@ -1312,14 +1307,13 @@ bool path_a_supports_paint_setup(
uint32_t imageId = railingEntry->bridge_image + 55 + specialIndex;
unk_supports_desc supportsDesc = byte_98D8D4[specialIndex];
unk_supports_desc_bound_box boundBox = supportsDesc.bounding_box;
const unk_supports_desc& supportsDesc = byte_98D8D4[specialIndex];
const unk_supports_desc_bound_box& boundBox = supportsDesc.bounding_box;
if (supportsDesc.var_6 == 0 || session->WoodenSupportsPrependTo == nullptr)
{
PaintAddImageAsParent(
session, imageId | imageColourFlags, { 0, 0, baseHeight },
{ boundBox.length.y, boundBox.length.x, boundBox.length.z },
session, imageId | imageColourFlags, { 0, 0, baseHeight }, boundBox.length,
{ boundBox.offset.x, boundBox.offset.y, baseHeight + boundBox.offset.z });
hasSupports = true;
}
@@ -1408,7 +1402,7 @@ bool path_b_supports_paint_setup(
{
PaintAddImageAsParent(
session, (railingEntry->bridge_image + 20 + (heightDiff - 1)) | imageColourFlags,
{ SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, baseHeight }, { 0, 0, heightDiff - 1 });
{ SupportBoundBoxes[segment], baseHeight }, { 0, 0, heightDiff - 1 });
}
baseHeight += heightDiff;
@@ -1441,7 +1435,7 @@ bool path_b_supports_paint_setup(
PaintAddImageAsParent(
session, (railingEntry->bridge_image + 20 + (z - 1)) | imageColourFlags,
{ SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, baseHeight }, { 0, 0, (z - 1) });
{ SupportBoundBoxes[segment], baseHeight }, { 0, 0, (z - 1) });
baseHeight += z;
}
@@ -1458,8 +1452,7 @@ bool path_b_supports_paint_setup(
}
PaintAddImageAsParent(
session, imageId | imageColourFlags, { SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, baseHeight },
{ 0, 0, (z - 1) });
session, imageId | imageColourFlags, { SupportBoundBoxes[segment], baseHeight }, { 0, 0, (z - 1) });
baseHeight += z;
}
@@ -1488,8 +1481,8 @@ bool path_b_supports_paint_setup(
uint32_t imageId = railingEntry->bridge_image + 20 + (z - 1);
PaintAddImageAsParent(
session, imageId | imageColourFlags, { SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, baseHeight },
{ 0, 0, 0 }, { SupportBoundBoxes[segment].x, SupportBoundBoxes[segment].y, baseHeight });
session, imageId | imageColourFlags, { SupportBoundBoxes[segment], baseHeight }, { 0, 0, 0 },
{ SupportBoundBoxes[segment], baseHeight });
baseHeight += z;
}

View File

@@ -78,14 +78,12 @@ void PaintBanner(paint_session* session, uint8_t direction, int32_t height, cons
image_id |= (banner->colour << 19) | IMAGE_TYPE_REMAP;
}
PaintAddImageAsParent(
session, image_id, { 0, 0, height }, { 1, 1, 0x15 }, { boundBoxOffset.x, boundBoxOffset.y, boundBoxOffset.z });
PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 1, 0x15 }, boundBoxOffset);
boundBoxOffset.x = BannerBoundBoxes[direction][1].x;
boundBoxOffset.y = BannerBoundBoxes[direction][1].y;
image_id++;
PaintAddImageAsParent(
session, image_id, { 0, 0, height }, { 1, 1, 0x15 }, { boundBoxOffset.x, boundBoxOffset.y, boundBoxOffset.z });
PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 1, 0x15 }, boundBoxOffset);
// Opposite direction
direction = direction_reverse(direction);

View File

@@ -434,8 +434,7 @@ static void sub_6A4101(
uint32_t imageId = (direction << 1) + base_image_id + 28;
// Draw pole in the back
PaintAddImageAsParent(
session, imageId, { 0, 0, height }, { 1, 1, 21 }, { boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z });
PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 1, 21 }, boundBoxOffsets);
// Draw pole in the front and banner
boundBoxOffsets.x = BannerBoundBoxes[direction][1].x;
@@ -1046,8 +1045,8 @@ void path_paint_box_support(
if (!hasSupports || !session->DidPassSurface)
{
PaintAddImageAsParent(
session, imageId | imageFlags, { 0, 0, height }, { boundBoxSize.x, boundBoxSize.y, 0 },
{ boundBoxOffset.x, boundBoxOffset.y, height + boundingBoxZOffset });
session, imageId | imageFlags, { 0, 0, height }, { boundBoxSize, 0 },
{ boundBoxOffset, height + boundingBoxZOffset });
}
else
{
@@ -1063,8 +1062,8 @@ void path_paint_box_support(
}
PaintAddImageAsParent(
session, image_id | imageFlags, { 0, 0, height }, { boundBoxSize.x, boundBoxSize.y, 0 },
{ boundBoxOffset.x, boundBoxOffset.y, height + boundingBoxZOffset });
session, image_id | imageFlags, { 0, 0, height }, { boundBoxSize, 0 },
{ boundBoxOffset, height + boundingBoxZOffset });
// TODO: Revert this when path import works correctly.
if (!pathElement.IsQueue() && !pathElement.ShouldDrawPathOverSupports())
@@ -1212,8 +1211,8 @@ void path_paint_pole_support(
}
PaintAddImageAsParent(
session, bridgeImage | imageFlags, { 0, 0, height }, { boundBoxSize.x, boundBoxSize.y, 0 },
{ boundBoxOffset.x, boundBoxOffset.y, height + boundingBoxZOffset });
session, bridgeImage | imageFlags, { 0, 0, height }, { boundBoxSize, 0 },
{ boundBoxOffset, height + boundingBoxZOffset });
// TODO: Revert this when path import works correctly.
if (pathElement.IsQueue() || pathElement.ShouldDrawPathOverSupports())

View File

@@ -829,9 +829,7 @@ bool track_paint_util_draw_station_covers_2(
if (baseImageId & IMAGE_TYPE_TRANSPARENT)
{
imageId = (baseImageId & ~IMAGE_TYPE_TRANSPARENT) + imageOffset;
PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), offset.z },
{ bounds.x, bounds.y, static_cast<int8_t>(bounds.z) }, { boundsOffset.x, boundsOffset.y, boundsOffset.z });
PaintAddImageAsParent(session, imageId, offset, bounds, boundsOffset);
uint32_t edi = session->TrackColours[SCHEME_TRACK] & (0b11111 << 19);
@@ -1034,8 +1032,8 @@ void track_paint_util_right_helix_up_small_quarter_tiles_paint(
CoordsXYZ boundsOffset = (boundsOffsets == nullptr ? CoordsXYZ(offset, 0) : boundsOffsets[direction][index][0]);
PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), height },
{ boundsLength.x, boundsLength.y, thickness[0] }, { boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
session, imageId, { offset, height }, { boundsLength, thickness[0] },
{ boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
}
if (sprites[direction][index][1] != 0)
{
@@ -1044,9 +1042,7 @@ void track_paint_util_right_helix_up_small_quarter_tiles_paint(
CoordsXY boundsLength = boundsLengths[direction][index][1];
CoordsXYZ boundsOffset = (boundsOffsets == nullptr ? CoordsXYZ(offset, 0) : boundsOffsets[direction][index][1]);
PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), height },
{ boundsLength.x, boundsLength.y, thickness[1] }, boundsOffset);
PaintAddImageAsParent(session, imageId, { offset, height }, { boundsLength, thickness[1] }, boundsOffset);
}
}
@@ -1132,8 +1128,8 @@ void track_paint_util_right_helix_up_large_quarter_tiles_paint(
CoordsXYZ boundsOffset = (boundsOffsets == nullptr ? CoordsXYZ(offset, 0) : boundsOffsets[direction][index][0]);
PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), height },
{ boundsLength.x, boundsLength.y, thickness[0] }, { boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
session, imageId, { offset, height }, { boundsLength, thickness[0] },
{ boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
}
if (sprites[direction][index][1] != 0)
{
@@ -1143,8 +1139,8 @@ void track_paint_util_right_helix_up_large_quarter_tiles_paint(
CoordsXYZ boundsOffset = (boundsOffsets == nullptr ? CoordsXYZ(offset, 0) : boundsOffsets[direction][index][1]);
PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), height },
{ boundsLength.x, boundsLength.y, thickness[1] }, { boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
session, imageId, { offset, height }, { boundsLength, thickness[1] },
{ boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
}
}
@@ -1344,8 +1340,8 @@ void track_paint_util_diag_tiles_paint(
CoordsXYZ boundsOffset = (boundsOffsets == nullptr ? CoordsXYZ(offset, 0) : boundsOffsets[direction]);
PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), height },
{ boundsLength.x, boundsLength.y, thickness }, { boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
session, imageId, { offset, height }, { boundsLength, thickness },
{ boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
}
const uint8_t mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[] = {
@@ -1752,11 +1748,11 @@ void track_paint_util_right_quarter_turn_3_tiles_paint_3(
return;
}
const sprite_bb* spriteBB = &sprites[direction][sprite];
const auto& offset = spriteBB->offset;
const auto& bbOffset = spriteBB->bb_offset;
PaintAddImageAsParent(
session, spriteBB->sprite_id | colourFlags,
{ static_cast<int8_t>(spriteBB->offset.x), static_cast<int8_t>(spriteBB->offset.y), spriteBB->offset.z + height },
{ spriteBB->bb_size.x, spriteBB->bb_size.y, static_cast<int8_t>(spriteBB->bb_size.z) },
{ spriteBB->bb_offset.x, spriteBB->bb_offset.y, height + spriteBB->bb_offset.z });
session, spriteBB->sprite_id | colourFlags, { offset.x, offset.y, offset.z + height }, spriteBB->bb_size,
{ bbOffset.x, bbOffset.y, height + bbOffset.z });
}
void track_paint_util_right_quarter_turn_3_tiles_paint_4(

View File

@@ -3162,9 +3162,10 @@ void junior_rc_paint_track_right_quarter_turn_3_tiles_25_deg_down(
break;
}
if (imageId != 0)
{
PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), height },
{ boundsLength.x, boundsLength.y, 1 }, { boundsOffset.x, boundsOffset.y, height });
session, imageId, { offset, height }, { boundsLength.x, boundsLength.y, 1 }, { boundsOffset, height });
}
if (direction == 0 && trackSequence == 0)
{