Make a bit more sense of sub_6A4101

This commit is contained in:
Hielke Morsink 2022-10-30 16:29:40 +01:00 committed by Rik Smeets
parent d1baf094af
commit 474e04f957
1 changed files with 17 additions and 16 deletions

View File

@ -288,7 +288,7 @@ static void PathBitJumpingFountainsPaint(
* rct2: 0x006A4101
* @param tile_element (esi)
*/
static void sub_6A4101(
static void PathPaintFencesAndQueueBanners(
PaintSession& session, const PathElement& pathElement, uint16_t height, uint32_t connectedEdges, bool hasSupports,
const FootpathPaintInfo& pathPaintInfo, ImageId imageTemplate)
{
@ -297,7 +297,6 @@ static void sub_6A4101(
auto imageId = imageTemplate.WithIndex(pathPaintInfo.RailingsImageId);
if (pathElement.IsQueue())
{
uint8_t local_ebp = connectedEdges & 0x0F;
if (pathElement.IsSloped())
{
switch ((pathElement.GetSlopeDirection() + session.CurrentRotation) & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
@ -330,21 +329,22 @@ static void sub_6A4101(
}
else
{
switch (local_ebp)
const auto pathEdges = connectedEdges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
switch (pathEdges)
{
case 1:
case 0b0001:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(17), { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
PaintAddImageAsParent(
session, imageId.WithIndexOffset(17), { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 });
break;
case 2:
case 0b0010:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(18), { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
PaintAddImageAsParent(
session, imageId.WithIndexOffset(18), { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
break;
case 3:
case 0b0011:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(17), { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
PaintAddImageAsParent(
@ -353,19 +353,19 @@ static void sub_6A4101(
PaintAddImageAsParent(
session, imageId.WithIndexOffset(25), { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 });
break;
case 4:
case 0b0100:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(19), { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
PaintAddImageAsParent(
session, imageId.WithIndexOffset(19), { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 });
break;
case 5:
case 0b0101:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(15), { 0, 4, height }, { 32, 1, 7 }, { 0, 4, height + 2 });
PaintAddImageAsParent(
session, imageId.WithIndexOffset(15), { 0, 28, height }, { 32, 1, 7 }, { 0, 28, height + 2 });
break;
case 6:
case 0b0110:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(18), { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
PaintAddImageAsParent(
@ -373,13 +373,13 @@ static void sub_6A4101(
PaintAddImageAsParent(
session, imageId.WithIndexOffset(26), { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 });
break;
case 8:
case 0b1000:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(16), { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
PaintAddImageAsParent(
session, imageId.WithIndexOffset(16), { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
break;
case 9:
case 0b1001:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(16), { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
PaintAddImageAsParent(
@ -387,13 +387,13 @@ static void sub_6A4101(
PaintAddImageAsParent(
session, imageId.WithIndexOffset(24), { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 });
break;
case 10:
case 0b1010:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(14), { 4, 0, height }, { 1, 32, 7 }, { 4, 0, height + 2 });
PaintAddImageAsParent(
session, imageId.WithIndexOffset(14), { 28, 0, height }, { 1, 32, 7 }, { 28, 0, height + 2 });
break;
case 12:
case 0b1100:
PaintAddImageAsParent(
session, imageId.WithIndexOffset(16), { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
PaintAddImageAsParent(
@ -403,7 +403,7 @@ static void sub_6A4101(
session, imageId.WithIndexOffset(27), { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 });
break;
default:
// purposely left empty
// Purposely left empty, queues cannot have 3 or 4 connected edges
break;
}
}
@ -419,7 +419,7 @@ static void sub_6A4101(
if (pathElement.IsSloped())
{
if (pathElement.GetSlopeDirection() == direction)
height += 16;
height += COORDS_Z_STEP * 2;
}
direction += session.CurrentRotation;
direction &= 3;
@ -792,7 +792,8 @@ static void sub_6A3F61(
// Redundant zoom-level check removed
if (paintScenery)
sub_6A4101(session, pathElement, height, connectedEdges, hasSupports, pathPaintInfo, imageTemplate);
PathPaintFencesAndQueueBanners(
session, pathElement, height, connectedEdges, hasSupports, pathPaintInfo, imageTemplate);
}
// This is about tunnel drawing