mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix supports changing when trees were invisible
This commit is contained in:
parent
e134be9538
commit
1c306e0a1a
|
@ -103,54 +103,15 @@ static void SetSupportHeights(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void PaintSmallSceneryBody(
|
||||||
*
|
paint_session& session, uint8_t direction, int32_t height, const SmallSceneryElement& sceneryElement,
|
||||||
* rct2: 0x006DFF47
|
const SmallSceneryEntry* sceneryEntry, ImageId imageTemplate)
|
||||||
*/
|
|
||||||
void PaintSmallScenery(paint_session& session, uint8_t direction, int32_t height, const SmallSceneryElement& sceneryElement)
|
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
if (session.ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* sceneryEntry = sceneryElement.GetEntry();
|
|
||||||
if (sceneryEntry == nullptr)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE) && (session.ViewFlags & VIEWPORT_FLAG_INVISIBLE_TREES))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
session.InteractionType = ViewportInteractionItem::Scenery;
|
session.InteractionType = ViewportInteractionItem::Scenery;
|
||||||
CoordsXYZ boxLength;
|
CoordsXYZ boxLength;
|
||||||
CoordsXYZ boxOffset{ 0, 0, height };
|
CoordsXYZ boxOffset{ 0, 0, height };
|
||||||
ImageId imageTemplate;
|
|
||||||
if (gTrackDesignSaveMode)
|
|
||||||
{
|
|
||||||
if (!track_design_save_contains_tile_element(reinterpret_cast<const TileElement*>(&sceneryElement)))
|
|
||||||
{
|
|
||||||
imageTemplate = ImageId().WithRemap(FilterPaletteID::Palette46);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sceneryElement.IsGhost())
|
|
||||||
{
|
|
||||||
session.InteractionType = ViewportInteractionItem::None;
|
|
||||||
imageTemplate = ImageId().WithRemap(FilterPaletteID::Palette44);
|
|
||||||
}
|
|
||||||
else if (OpenRCT2::TileInspector::IsElementSelected(reinterpret_cast<const TileElement*>(&sceneryElement)))
|
|
||||||
{
|
|
||||||
imageTemplate = ImageId().WithRemap(FilterPaletteID::Palette44);
|
|
||||||
}
|
|
||||||
else if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE) && (session.ViewFlags & VIEWPORT_FLAG_SEETHROUGH_TREES))
|
|
||||||
{
|
|
||||||
imageTemplate = ImageId().WithTransparancy(FilterPaletteID::PaletteDarken1);
|
|
||||||
}
|
|
||||||
|
|
||||||
boxLength.x = 2;
|
boxLength.x = 2;
|
||||||
boxLength.y = 2;
|
boxLength.y = 2;
|
||||||
|
@ -344,6 +305,50 @@ void PaintSmallScenery(paint_session& session, uint8_t direction, int32_t height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PaintSmallScenery(paint_session& session, uint8_t direction, int32_t height, const SmallSceneryElement& sceneryElement)
|
||||||
|
{
|
||||||
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
|
if (session.ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* sceneryEntry = sceneryElement.GetEntry();
|
||||||
|
if (sceneryEntry == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
session.InteractionType = ViewportInteractionItem::Scenery;
|
||||||
|
ImageId imageTemplate;
|
||||||
|
if (gTrackDesignSaveMode)
|
||||||
|
{
|
||||||
|
if (!track_design_save_contains_tile_element(reinterpret_cast<const TileElement*>(&sceneryElement)))
|
||||||
|
{
|
||||||
|
imageTemplate = ImageId().WithRemap(FilterPaletteID::Palette46);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sceneryElement.IsGhost())
|
||||||
|
{
|
||||||
|
session.InteractionType = ViewportInteractionItem::None;
|
||||||
|
imageTemplate = ImageId().WithRemap(FilterPaletteID::Palette44);
|
||||||
|
}
|
||||||
|
else if (OpenRCT2::TileInspector::IsElementSelected(reinterpret_cast<const TileElement*>(&sceneryElement)))
|
||||||
|
{
|
||||||
|
imageTemplate = ImageId().WithRemap(FilterPaletteID::Palette44);
|
||||||
|
}
|
||||||
|
else if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE) && (session.ViewFlags & VIEWPORT_FLAG_SEETHROUGH_TREES))
|
||||||
|
{
|
||||||
|
imageTemplate = ImageId().WithTransparancy(FilterPaletteID::PaletteDarken1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_IS_TREE) || !(session.ViewFlags & VIEWPORT_FLAG_INVISIBLE_TREES))
|
||||||
|
{
|
||||||
|
PaintSmallSceneryBody(session, direction, height, sceneryElement, sceneryEntry, imageTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
PaintSmallScenerySupports(session, *sceneryEntry, sceneryElement, direction, height, imageTemplate);
|
PaintSmallScenerySupports(session, *sceneryEntry, sceneryElement, direction, height, imageTemplate);
|
||||||
SetSupportHeights(session, *sceneryEntry, sceneryElement, height);
|
SetSupportHeights(session, *sceneryEntry, sceneryElement, height);
|
||||||
|
|
Loading…
Reference in New Issue