Refactor uses of PaintAddImageAsParent in BoatHire.cpp

This commit is contained in:
Matt 2021-03-08 15:03:43 +02:00
parent fcf8903304
commit 83a196ca13
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 14 additions and 12 deletions

View File

@ -36,21 +36,22 @@ static void paint_boat_hire_track_flat(
{
uint32_t imageId;
const auto offset = CoordsXYZ{ 0, 0, height };
if (direction & 1)
{
imageId = SPR_BOAT_HIRE_FLAT_BACK_NW_SE | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 3, height, 4, 0, height);
PaintAddImageAsParent(session, imageId, offset, { 1, 32, 3 }, { 4, 0, height });
imageId = SPR_BOAT_HIRE_FLAT_FRONT_NW_SE | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 1, 32, 3, height, 28, 0, height);
PaintAddImageAsParent(session, imageId, offset, { 1, 32, 3 }, { 28, 0, height });
}
else
{
imageId = SPR_BOAT_HIRE_FLAT_BACK_SW_NE | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 3, height, 0, 4, height);
PaintAddImageAsParent(session, imageId, offset, { 32, 1, 3 }, { 0, 4, height });
imageId = SPR_BOAT_HIRE_FLAT_FRONT_SW_NE | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 32, 1, 3, height, 0, 28, height);
PaintAddImageAsParent(session, imageId, offset, { 32, 1, 3 }, { 0, 28, height });
}
paint_util_set_segment_support_height(
@ -92,35 +93,36 @@ static void paint_boat_hire_track_left_quarter_turn_1_tile(
const TileElement* tileElement)
{
uint32_t imageId;
const auto offset = CoordsXYZ{ 0, 0, height };
switch (direction)
{
case 0:
imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_BACK_SW_NW | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, height, 0, 0, height);
PaintAddImageAsParent(session, imageId, offset, { 32, 32, 0 }, { 0, 0, height });
imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_FRONT_SW_NW | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 3, height, 28, 28, height + 2);
PaintAddImageAsParent(session, imageId, offset, { 3, 3, 3 }, { 28, 28, height + 2 });
break;
case 1:
imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_BACK_NW_NE | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, height, 0, 0, height);
PaintAddImageAsParent(session, imageId, offset, { 32, 32, 0 }, { 0, 0, height });
imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_FRONT_NW_NE | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 3, height, 28, 28, height + 2);
PaintAddImageAsParent(session, imageId, offset, { 3, 3, 3 }, { 28, 28, height + 2 });
break;
case 2:
imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_BACK_NE_SE | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, height, 0, 0, height);
PaintAddImageAsParent(session, imageId, offset, { 32, 32, 0 }, { 0, 0, height });
imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_FRONT_NE_SE | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 3, height, 28, 28, height + 2);
PaintAddImageAsParent(session, imageId, offset, { 3, 3, 3 }, { 28, 28, height + 2 });
break;
case 3:
imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_FRONT_SE_SW | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 3, 3, 3, height, 28, 28, height + 2);
PaintAddImageAsParent(session, imageId, offset, { 3, 3, 3 }, { 28, 28, height + 2 });
imageId = SPR_BOAT_HIRE_FLAT_QUARTER_TURN_1_TILE_BACK_SE_SW | session->TrackColours[SCHEME_TRACK];
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, 0, height, 0, 0, height);
PaintAddImageAsParent(session, imageId, offset, { 32, 32, 0 }, { 0, 0, height });
break;
}