1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 05:23:04 +01:00

Refactor out DidPassSurface and rename Unk141E9DB to Flags

This commit is contained in:
ζeh Matt
2022-01-02 15:45:15 +02:00
parent 2ef5265ead
commit b5d6abdd22
8 changed files with 23 additions and 18 deletions

View File

@@ -210,12 +210,14 @@ struct PaintSessionCore
tunnel_entry RightTunnels[TUNNEL_MAX_COUNT];
uint8_t RightTunnelCount;
uint8_t VerticalTunnelHeight;
bool DidPassSurface;
uint8_t Unk141E9DB;
uint8_t Flags;
uint16_t WaterHeight;
uint32_t TrackColours[4];
};
// 16544
static constexpr size_t SizeOfPaintSessionCore = sizeof(PaintSessionCore);
struct paint_session : public PaintSessionCore
{
rct_drawpixelinfo DPI;

View File

@@ -157,6 +157,7 @@ paint_session* Painter::CreateSession(rct_drawpixelinfo* dpi, uint32_t viewFlags
session->QuadrantBackIndex = std::numeric_limits<uint32_t>::max();
session->QuadrantFrontIndex = 0;
session->PaintEntryChain = _paintStructPool.Create();
session->Flags = 0;
std::fill(std::begin(session->Quadrants), std::end(session->Quadrants), nullptr);
session->LastPS = nullptr;

View File

@@ -477,7 +477,7 @@ bool wooden_a_supports_paint_setup(
return false;
}
if (!(session.Unk141E9DB & PaintSessionFlags::IsPassedSurface))
if (!(session.Flags & PaintSessionFlags::IsPassedSurface))
{
return false;
}
@@ -636,7 +636,7 @@ bool wooden_b_supports_paint_setup(
return false;
}
if (!(session.Unk141E9DB & PaintSessionFlags::IsPassedSurface))
if (!(session.Flags & PaintSessionFlags::IsPassedSurface))
{
return false;
}
@@ -806,7 +806,7 @@ bool metal_a_supports_paint_setup(
return false;
}
if (!(session.Unk141E9DB & PaintSessionFlags::IsPassedSurface))
if (!(session.Flags & PaintSessionFlags::IsPassedSurface))
{
return false;
}
@@ -1005,7 +1005,7 @@ bool metal_b_supports_paint_setup(
return false; // AND
}
if (!(session.Unk141E9DB & PaintSessionFlags::IsPassedSurface))
if (!(session.Flags & PaintSessionFlags::IsPassedSurface))
{
return false; // AND
}
@@ -1185,7 +1185,7 @@ bool path_a_supports_paint_setup(
return false;
}
if (!(session.Unk141E9DB & PaintSessionFlags::IsPassedSurface))
if (!(session.Flags & PaintSessionFlags::IsPassedSurface))
{
return false;
}
@@ -1335,7 +1335,7 @@ bool path_b_supports_paint_setup(
return false; // AND
}
if (!(session.Unk141E9DB & PaintSessionFlags::IsPassedSurface))
if (!(session.Flags & PaintSessionFlags::IsPassedSurface))
{
return false; // AND
}

View File

@@ -1099,7 +1099,8 @@ void path_paint_box_support(
surfaceBaseImageIndex += byte_98D6E0[edi];
}
if (!session.DidPassSurface)
const bool hasPassedSurface = (session.Flags & PaintSessionFlags::IsPassedSurface) != 0;
if (!hasPassedSurface)
{
boundBoxOffset.x = 3;
boundBoxOffset.y = 3;
@@ -1120,7 +1121,7 @@ void path_paint_box_support(
}
}
if (!hasSupports || !session.DidPassSurface)
if (!hasSupports || !hasPassedSurface)
{
PaintAddImageAsParent(
session, imageTemplate.WithIndex(surfaceBaseImageIndex), { 0, 0, height }, { boundBoxSize, 0 },
@@ -1238,7 +1239,8 @@ void path_paint_pole_support(
}
// Below Surface
if (!session.DidPassSurface)
const bool hasPassedSurface = (session.Flags & PaintSessionFlags::IsPassedSurface) != 0;
if (!hasPassedSurface)
{
boundBoxOffset.x = 3;
boundBoxOffset.y = 3;
@@ -1259,7 +1261,7 @@ void path_paint_pole_support(
}
}
if (!hasSupports || !session.DidPassSurface)
if (!hasSupports || !hasPassedSurface)
{
PaintAddImageAsParent(
session, imageTemplate.WithIndex(surfaceBaseImageIndex), { 0, 0, height }, { boundBoxSize.x, boundBoxSize.y, 0 },

View File

@@ -978,7 +978,7 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co
rct_drawpixelinfo* dpi = &session.DPI;
session.InteractionType = ViewportInteractionItem::Terrain;
session.DidPassSurface = true;
session.Flags |= PaintSessionFlags::IsPassedSurface;
session.SurfaceElement = reinterpret_cast<const TileElement*>(&tileElement);
const auto zoomLevel = dpi->zoom_level;
@@ -1414,7 +1414,6 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co
}
session.InteractionType = ViewportInteractionItem::Terrain;
session.Unk141E9DB |= PaintSessionFlags::IsPassedSurface;
switch (surfaceShape)
{

View File

@@ -56,7 +56,7 @@ void tile_element_paint_setup(paint_session& session, const CoordsXY& mapCoords,
{
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
paint_util_force_set_general_support_height(session, -1, 0);
session.Unk141E9DB = isTrackPiecePreview ? PaintSessionFlags::IsTrackPiecePreview : 0;
session.Flags = isTrackPiecePreview ? PaintSessionFlags::IsTrackPiecePreview : 0;
session.WaterHeight = 0xFFFF;
PaintTileElementBase(session, mapCoords);
@@ -218,7 +218,8 @@ static void PaintTileElementBase(paint_session& session, const CoordsXY& origCoo
session.SpritePosition.x = coords.x;
session.SpritePosition.y = coords.y;
session.DidPassSurface = false;
session.Flags &= ~PaintSessionFlags::IsPassedSurface;
int32_t previousBaseZ = 0;
do
{

View File

@@ -783,7 +783,7 @@ bool track_paint_util_draw_station_covers_2(
return false;
}
if (!(session.Unk141E9DB & (PaintSessionFlags::IsPassedSurface | PaintSessionFlags::IsTrackPiecePreview)))
if (!(session.Flags & (PaintSessionFlags::IsPassedSurface | PaintSessionFlags::IsTrackPiecePreview)))
{
return false;
}

View File

@@ -462,7 +462,7 @@ static paint_struct* mini_golf_paint_util_7c(
static bool mini_golf_paint_util_should_draw_fence(paint_session& session, const TrackElement& trackElement)
{
if (!session.DidPassSurface)
if (!(session.Flags & PaintSessionFlags::IsPassedSurface))
{
// Should be above ground (have passed surface rendering)
return false;