Simplify passing args on PaintAddImageAsParent where possible

This commit is contained in:
ZehMatt 2021-08-20 22:10:46 +03:00
parent 7feea62ab3
commit efa9af4610
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
6 changed files with 49 additions and 105 deletions

View File

@ -289,9 +289,7 @@ void PaintLargeScenery(paint_session* session, uint8_t direction, uint16_t heigh
boxlength.x = s98E3C4[esi].length.x;
boxlength.y = s98E3C4[esi].length.y;
boxlength.z = boxlengthZ;
PaintAddImageAsParent(
session, image_id, { 0, 0, height }, { boxlength.x, boxlength.y, boxlengthZ },
{ boxoffset.x, boxoffset.y, boxoffset.z });
PaintAddImageAsParent(session, image_id, { 0, 0, height }, { boxlength.x, boxlength.y, boxlengthZ }, boxoffset);
if (sceneryEntry->scrolling_mode == SCROLLING_MODE_NONE || direction == 1 || direction == 2)
{
large_scenery_paint_supports(session, direction, height, tileElement, dword_F4387C, tile);

View File

@ -441,8 +441,7 @@ static void sub_6A4101(
boundBoxOffsets.x = BannerBoundBoxes[direction][1].x;
boundBoxOffsets.y = BannerBoundBoxes[direction][1].y;
imageId++;
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);
direction--;
// If text shown

View File

@ -159,8 +159,7 @@ void PaintSmallScenery(paint_session* session, uint8_t direction, int32_t height
if (!(scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED)))
{
PaintAddImageAsParent(
session, baseImageid, { x_offset, y_offset, height }, { boxlength.x, boxlength.y, boxlength.z - 1 },
{ boxoffset.x, boxoffset.y, boxoffset.z });
session, baseImageid, { x_offset, y_offset, height }, { boxlength.x, boxlength.y, boxlength.z - 1 }, boxoffset);
}
if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_HAS_GLASS))
@ -327,7 +326,7 @@ void PaintSmallScenery(paint_session* session, uint8_t direction, int32_t height
{
PaintAddImageAsParent(
session, image_id, { x_offset, y_offset, height }, { boxlength.x, boxlength.y, boxlength.z - 1 },
{ boxoffset.x, boxoffset.y, boxoffset.z });
boxoffset);
}
else
{

View File

@ -59,17 +59,13 @@ static void PaintWallDoor(
{
paint_struct* ps;
ps = PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), offset.z },
{ boundsR1.x, boundsR1.y, static_cast<int8_t>(boundsR1.z) }, { boundsR1_.x, boundsR1_.y, boundsR1_.z });
ps = PaintAddImageAsParent(session, imageId, offset, boundsR1, boundsR1_);
if (ps != nullptr)
{
ps->tertiary_colour = tertiaryColour;
}
ps = PaintAddImageAsParent(
session, imageId + 1, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), offset.z },
{ boundsR2.x, boundsR2.y, static_cast<int8_t>(boundsR2.z) }, { boundsR2_.x, boundsR2_.y, boundsR2_.z });
ps = PaintAddImageAsParent(session, imageId + 1, offset, boundsR2, boundsR2_);
if (ps != nullptr)
{
ps->tertiary_colour = tertiaryColour;
@ -79,9 +75,7 @@ static void PaintWallDoor(
{
paint_struct* ps;
ps = PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), offset.z },
{ boundsL1.x, boundsL1.y, static_cast<int8_t>(boundsL1.z) }, { boundsL1_.x, boundsL1_.y, boundsL1_.z });
ps = PaintAddImageAsParent(session, imageId, offset, boundsL1, boundsL1_);
if (ps != nullptr)
{
ps->tertiary_colour = tertiaryColour;
@ -117,9 +111,7 @@ static void PaintWallWall(
imageId = (imageId & 0x7FFFF) | dword_141F710;
}
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);
if (dword_141F710 == 0)
{
imageId = baseImageId + dword_141F718;
@ -140,9 +132,7 @@ static void PaintWallWall(
imageId = (imageId & 0x7FFFF) | dword_141F710;
}
paint_struct* paint = 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 });
paint_struct* paint = PaintAddImageAsParent(session, imageId, offset, bounds, boundsOffset);
if (paint != nullptr)
{
paint->tertiary_colour = tertiaryColour;

View File

@ -844,9 +844,7 @@ bool track_paint_util_draw_station_covers_2(
}
imageId = (baseImageId + imageOffset) | session->TrackColours[SCHEME_TRACK];
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);
return true;
}
@ -1048,7 +1046,7 @@ void track_paint_util_right_helix_up_small_quarter_tiles_paint(
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 });
{ boundsLength.x, boundsLength.y, thickness[1] }, boundsOffset);
}
}
@ -1305,8 +1303,7 @@ void track_paint_util_eighth_to_diag_tiles_paint(
CoordsXYZ boundsOffset = (boundsOffsets == nullptr ? CoordsXYZ(offset, 0) : boundsOffsets[direction][index]);
PaintAddImageAsParent(
session, imageId, { static_cast<int8_t>(offset.x), static_cast<int8_t>(offset.y), height },
{ boundsLength.x, boundsLength.y, thickness[direction][index] },
session, imageId, { offset.x, offset.y, height }, { boundsLength.x, boundsLength.y, thickness[direction][index] },
{ boundsOffset.x, boundsOffset.y, height + boundsOffset.z });
}
@ -1484,12 +1481,12 @@ void track_paint_util_right_quarter_turn_5_tiles_paint_2(
}
const sprite_bb* spriteBB = &sprites[direction][sprite];
uint32_t imageId = spriteBB->sprite_id | colourFlags;
const uint32_t imageId = spriteBB->sprite_id | colourFlags;
const auto& offset = spriteBB->offset;
const auto& bbOffset = spriteBB->offset;
PaintAddImageAsParent(
session, imageId,
{ static_cast<int8_t>(spriteBB->offset.x), static_cast<int8_t>(spriteBB->offset.y), height + spriteBB->offset.z },
{ 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, imageId, { offset.x, offset.y, height + offset.z }, spriteBB->bb_size,
{ bbOffset.x, bbOffset.y, height + bbOffset.z });
}
void track_paint_util_right_quarter_turn_5_tiles_paint_3(

View File

@ -2467,10 +2467,8 @@ static void junior_rc_left_bank_paint_setup(
image_id = junior_rc_track_pieces_left_bank[direction] | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(
session, image_id, { 0, 0, height },
{ junior_rc_left_bank_bound_lengths[direction].x, junior_rc_left_bank_bound_lengths[direction].y,
static_cast<int8_t>(junior_rc_left_bank_bound_lengths[direction].z) },
{ junior_rc_left_bank_bound_offsets[direction].x, junior_rc_left_bank_bound_offsets[direction].y, height });
session, image_id, { 0, 0, height }, junior_rc_left_bank_bound_lengths[direction],
{ junior_rc_left_bank_bound_offsets[direction], height });
if (direction & 1)
{
@ -3085,9 +3083,9 @@ void junior_rc_paint_track_right_quarter_turn_3_tiles_25_deg_up(
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 });
{
PaintAddImageAsParent(session, imageId, { offset, height }, { boundsLength, 1 }, { boundsOffset, height });
}
if (direction == 0 && trackSequence == 0)
{
@ -4959,12 +4957,9 @@ void junior_rc_paint_track_60_deg_up(
image_id |= junior_rc_track_pieces_60_deg_up[EnumValue(chainType)][direction];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].x),
static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].y), height },
{ junior_rc_60_deg_up_bound_lengths[direction].x, junior_rc_60_deg_up_bound_lengths[direction].y,
junior_rc_60_deg_up_bound_thickness[direction] },
{ junior_rc_60_deg_up_bound_offsets[direction].x, junior_rc_60_deg_up_bound_offsets[direction].y, height });
session, image_id, { junior_rc_60_deg_up_tile_offsets[direction], height },
{ junior_rc_60_deg_up_bound_lengths[direction], junior_rc_60_deg_up_bound_thickness[direction] },
{ junior_rc_60_deg_up_bound_offsets[direction], height });
switch (direction)
{
@ -5037,14 +5032,10 @@ void junior_rc_paint_track_25_deg_up_to_60_deg_up(
image_id |= junior_rc_track_pieces_25_deg_up_to_60_deg_up[EnumValue(chainType)][direction][0];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].x),
static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].y), height },
{ junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].x,
junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].y,
session, image_id, { junior_rc_60_deg_up_tile_offsets[direction], height },
{ junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0],
junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].x,
junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].y, height });
{ junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0], height });
if (junior_rc_track_pieces_25_deg_up_to_60_deg_up[EnumValue(chainType)][direction][1] != 0)
{
@ -5053,14 +5044,10 @@ void junior_rc_paint_track_25_deg_up_to_60_deg_up(
image_id |= junior_rc_track_pieces_25_deg_up_to_60_deg_up[EnumValue(chainType)][direction][1];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].x),
static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].y), height },
{ junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].x,
junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].y,
session, image_id, { junior_rc_60_deg_up_tile_offsets[direction], height },
{ junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1],
junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].x,
junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].y, height });
{ junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1], height });
}
switch (direction)
@ -5118,14 +5105,10 @@ void junior_rc_paint_track_60_deg_up_to_25_deg_up(
image_id |= junior_rc_track_pieces_60_deg_up_to_25_deg_up[EnumValue(chainType)][direction][0];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].x),
static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].y), height },
{ junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].x,
junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0].y,
session, image_id, { junior_rc_60_deg_up_tile_offsets[direction], height },
{ junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][0],
junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].x,
junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0].y, height });
{ junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][0], height });
if (junior_rc_track_pieces_60_deg_up_to_25_deg_up[EnumValue(chainType)][direction][1] != 0)
{
@ -5134,14 +5117,10 @@ void junior_rc_paint_track_60_deg_up_to_25_deg_up(
image_id |= junior_rc_track_pieces_60_deg_up_to_25_deg_up[EnumValue(chainType)][direction][1];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].x),
static_cast<int8_t>(junior_rc_60_deg_up_tile_offsets[direction].y), height },
{ junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].x,
junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1].y,
session, image_id, { junior_rc_60_deg_up_tile_offsets[direction], height },
{ junior_rc_25_deg_up_to_60_deg_up_bound_lengths[direction][1],
junior_rc_25_deg_up_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].x,
junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1].y, height });
{ junior_rc_25_deg_up_to_60_deg_up_bound_offsets[direction][1], height });
}
switch (direction)
@ -5437,13 +5416,9 @@ static void junior_rc_flat_to_60_deg_up_paint_setup(
image_id |= junior_rc_track_pieces_flat_to_60_deg_up[isChained][direction][0];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_flat_to_60_deg_up_tile_offsets[direction][0].x),
static_cast<int8_t>(junior_rc_flat_to_60_deg_up_tile_offsets[direction][0].y), height + 24 },
{ junior_rc_flat_to_60_deg_up_bound_lengths[direction][0].x, junior_rc_flat_to_60_deg_up_bound_lengths[direction][0].y,
junior_rc_flat_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_flat_to_60_deg_up_bound_offsets[direction][0].x, junior_rc_flat_to_60_deg_up_bound_offsets[direction][0].y,
height });
session, image_id, { junior_rc_flat_to_60_deg_up_tile_offsets[direction][0], height + 24 },
{ junior_rc_flat_to_60_deg_up_bound_lengths[direction][0], junior_rc_flat_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_flat_to_60_deg_up_bound_offsets[direction][0], height });
if (junior_rc_track_pieces_flat_to_60_deg_up[isChained][direction][1] != 0)
{
@ -5452,14 +5427,9 @@ static void junior_rc_flat_to_60_deg_up_paint_setup(
image_id |= junior_rc_track_pieces_flat_to_60_deg_up[isChained][direction][1];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_flat_to_60_deg_up_tile_offsets[direction][1].x),
static_cast<int8_t>(junior_rc_flat_to_60_deg_up_tile_offsets[direction][1].y), height },
{ junior_rc_flat_to_60_deg_up_bound_lengths[direction][1].x,
junior_rc_flat_to_60_deg_up_bound_lengths[direction][1].y,
junior_rc_flat_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_flat_to_60_deg_up_bound_offsets[direction][1].x,
junior_rc_flat_to_60_deg_up_bound_offsets[direction][1].y, height });
session, image_id, { junior_rc_flat_to_60_deg_up_tile_offsets[direction][1], height },
{ junior_rc_flat_to_60_deg_up_bound_lengths[direction][1], junior_rc_flat_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_flat_to_60_deg_up_bound_offsets[direction][1], height });
}
switch (direction)
@ -5509,13 +5479,9 @@ static void junior_rc_60_deg_up_to_flat_paint_setup(
image_id |= junior_rc_track_pieces_60_deg_up_to_flat[isChained][direction][0];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_60_deg_up_to_flat_tile_offsets[direction][0].x),
static_cast<int8_t>(junior_rc_60_deg_up_to_flat_tile_offsets[direction][0].y), height + 24 },
{ junior_rc_flat_to_60_deg_up_bound_lengths[direction][0].x, junior_rc_flat_to_60_deg_up_bound_lengths[direction][0].y,
junior_rc_flat_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_flat_to_60_deg_up_bound_offsets[direction][0].x, junior_rc_flat_to_60_deg_up_bound_offsets[direction][0].y,
height });
session, image_id, { junior_rc_60_deg_up_to_flat_tile_offsets[direction][0], height + 24 },
{ junior_rc_flat_to_60_deg_up_bound_lengths[direction][0], junior_rc_flat_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_flat_to_60_deg_up_bound_offsets[direction][0], height });
if (junior_rc_track_pieces_60_deg_up_to_flat[isChained][direction][1] != 0)
{
@ -5524,14 +5490,9 @@ static void junior_rc_60_deg_up_to_flat_paint_setup(
image_id |= junior_rc_track_pieces_60_deg_up_to_flat[isChained][direction][1];
PaintAddImageAsParent(
session, image_id,
{ static_cast<int8_t>(junior_rc_60_deg_up_to_flat_tile_offsets[direction][1].x),
static_cast<int8_t>(junior_rc_60_deg_up_to_flat_tile_offsets[direction][1].y), height },
{ junior_rc_flat_to_60_deg_up_bound_lengths[direction][1].x,
junior_rc_flat_to_60_deg_up_bound_lengths[direction][1].y,
junior_rc_flat_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_flat_to_60_deg_up_bound_offsets[direction][1].x,
junior_rc_flat_to_60_deg_up_bound_offsets[direction][1].y, height });
session, image_id, { junior_rc_60_deg_up_to_flat_tile_offsets[direction][1], height },
{ junior_rc_flat_to_60_deg_up_bound_lengths[direction][1], junior_rc_flat_to_60_deg_up_bound_thickness[direction] },
{ junior_rc_flat_to_60_deg_up_bound_offsets[direction][1], height });
}
switch (direction)