1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-13 02:52:35 +01:00

Fix park fences drawing underneath and through opaque water

This commit is contained in:
mix
2025-05-16 13:47:52 +01:00
committed by GitHub
parent bcb6c40c59
commit c51b755ea9
2 changed files with 14 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
- Fix: [#24353] Show dirty visuals is off by one pixel and does not work correctly with higher framerates.
- Fix: [#24362] When upgrading from an older version on Windows, old versions of official objects are not always removed.
- Fix: [#24371] Fix divide by zero in the scenery window when there is no scenery.
- Fix: [#24403] Park fences draw underneath and through opaque water.
0.4.22 (2025-05-04)
------------------------------------------------------------------------

View File

@@ -1298,6 +1298,8 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
const uint16_t waterHeight = tileElement.GetWaterHeight();
const bool waterGetsClipped = (session.ViewFlags & VIEWPORT_FLAG_CLIP_VIEW) && (waterHeight > gClipHeight * kCoordsZStep);
const bool waterIsTransparent = Config::Get().general.TransparentWater
|| (session.ViewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE);
if (waterHeight > 0 && !gTrackDesignSaveMode && !waterGetsClipped)
{
@@ -1317,9 +1319,8 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
const auto image_id = ImageId(SPR_WATER_MASK + image_offset, FilterPaletteID::PaletteWater).WithBlended(true);
PaintAddImageAsParent(session, image_id, { 0, 0, waterHeight }, { 32, 32, -1 });
const bool transparent = Config::Get().general.TransparentWater
|| (session.ViewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE);
const uint32_t overlayStart = transparent ? EnumValue(SPR_WATER_OVERLAY) : EnumValue(SPR_G2_OPAQUE_WATER_OVERLAY);
const uint32_t overlayStart = waterIsTransparent ? EnumValue(SPR_WATER_OVERLAY)
: EnumValue(SPR_G2_OPAQUE_WATER_OVERLAY);
PaintAttachToPreviousPS(session, ImageId(overlayStart + image_offset), 0, 0);
if (!(session.ViewFlags & VIEWPORT_FLAG_HIDE_VERTICAL))
@@ -1350,7 +1351,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
if (edgeHasFence == 0)
continue;
int32_t local_height = height;
int32_t fenceHeight = height;
int32_t image_id = 0;
if (!(surfaceShape & fenceData.bit_1))
@@ -1370,7 +1371,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
}
else
{
local_height += 16;
fenceHeight += 16;
if (!(surfaceShape & 0x10))
{ // Loc6619B5 (first)
@@ -1390,9 +1391,14 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
}
}
if (!waterIsTransparent && fenceHeight < waterHeight)
{
continue;
}
PaintAddImageAsParent(
session, ImageId(image_id), { fenceData.offset, local_height },
{ { fenceData.Boundbox.offset, local_height + 1 }, { fenceData.Boundbox.length, 9 } });
session, ImageId(image_id), { fenceData.offset, fenceHeight },
{ { fenceData.Boundbox.offset, fenceHeight + 1 }, { fenceData.Boundbox.length, 9 } });
}
}