From 28fb2611cb62e388e82abccbda324bcc6d5ec640 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 19 Apr 2021 20:46:30 +0100 Subject: [PATCH] Add supports to railing preview --- .../object/FootpathRailingsObject.cpp | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/openrct2/object/FootpathRailingsObject.cpp b/src/openrct2/object/FootpathRailingsObject.cpp index f5bdd01973..ee16825968 100644 --- a/src/openrct2/object/FootpathRailingsObject.cpp +++ b/src/openrct2/object/FootpathRailingsObject.cpp @@ -39,8 +39,29 @@ void FootpathRailingsObject::Unload() void FootpathRailingsObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t height) const { - auto screenCoords = ScreenCoordsXY{ (width - 45) / 2, (height - 34) / 2 }; - gfx_draw_sprite(dpi, PreviewImageId, screenCoords, 0); + auto x = width / 2; + auto y = height / 2; + if (SupportType == RailingEntrySupportType::Pole) + { + auto img = ImageId(BridgeImageId + 20 + 15, Colour); + for (int i = 0; i < 2; i++) + { + auto h = i * 16; + gfx_draw_sprite(dpi, img, { x - 8, y + 8 + h }); + gfx_draw_sprite(dpi, img, { x + 8, y + 16 + h }); + } + + gfx_draw_sprite(dpi, BridgeImageId + 5, { x, y - 17 }, 0); + gfx_draw_sprite(dpi, RailingsImageId + 1, { x + 4, y - 14 }, 0); + gfx_draw_sprite(dpi, RailingsImageId + 1, { x + 27, y - 2 }, 0); + } + else + { + gfx_draw_sprite(dpi, BridgeImageId + 22, { x + 0, y + 16 }, 0); + gfx_draw_sprite(dpi, BridgeImageId + 49, { x, y - 17 }, 0); + gfx_draw_sprite(dpi, RailingsImageId + 1, { x + 4, y - 14 }, 0); + gfx_draw_sprite(dpi, RailingsImageId + 1, { x + 27, y - 3 }, 0); + } } void FootpathRailingsObject::ReadJson(IReadObjectContext* context, json_t& root)