From 24b439fce20772c8ce5f929315472fac5681f4c6 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Thu, 16 Oct 2025 11:24:21 +0200 Subject: [PATCH 1/4] Allow theming news item background --- distribution/changelog.txt | 1 + src/openrct2-ui/interface/Theme.cpp | 4 ++-- src/openrct2-ui/windows/News.cpp | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 57dcb79633..ea45c66d42 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,6 +1,7 @@ 0.4.28 (in development) ------------------------------------------------------------------------ - Feature: [#25286] Footpath area dragging tool. +- Improved: [#25349] ‘Recent Messages’ window can now be fully themed. - Change: [#25089] Peep actions and animations that cause them to stop moving no longer trigger when they are on a level crossing. - Change: [#25337] Placing track designs with scenery that is obstructed no longer disables all of the scenery. - Fix: [#20486] Multiplayer desync when placing track designs without any scenery. diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index 3c3e21e2da..0cc4f9dc7a 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -181,7 +181,7 @@ namespace OpenRCT2::Ui { WindowClass::finances, "WC_FINANCES", STR_THEMES_WINDOW_FINANCES, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_YELLOW), opaque(COLOUR_DARK_YELLOW) } }, { WindowClass::titleMenu, "WC_TITLE_MENU", STR_THEMES_WINDOW_TITLE_MENU_BUTTONS, { translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN) } }, { WindowClass::titleExit, "WC_TITLE_EXIT", STR_THEMES_WINDOW_TITLE_MENU_EXIT, { translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN), translucent(COLOUR_DARK_GREEN) } }, - { WindowClass::recentNews, "WC_RECENT_NEWS", STR_THEMES_WINDOW_RECENT_NEWS, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_GREY), opaque(COLOUR_BLACK) } }, + { WindowClass::recentNews, "WC_RECENT_NEWS", STR_THEMES_WINDOW_RECENT_NEWS, { opaque(COLOUR_DARK_GREEN), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, { WindowClass::scenarioSelect, "WC_SCENARIO_SELECT", STR_THEMES_WINDOW_TITLE_MENU_SCENARIO_SELECTION, { opaque(COLOUR_GREY), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED) } }, { WindowClass::trackDesignList, "WC_TRACK_DESIGN_LIST", STR_THEMES_WINDOW_TRACK_DESIGN_LIST, { opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED), opaque(COLOUR_BORDEAUX_RED) } }, { WindowClass::trackDesignPlace, "WC_TRACK_DESIGN_PLACE", STR_THEMES_WINDOW_TRACK_DESIGN_PLACE, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN) } }, @@ -249,7 +249,7 @@ namespace OpenRCT2::Ui { WindowClass::assetPacks, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, { WindowClass::keyboardShortcutList, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, { WindowClass::changeKeyboardShortcut, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, - { WindowClass::recentNews, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, + { WindowClass::recentNews, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_VOID), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, { WindowClass::trackDesignList, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, { WindowClass::map, { opaque(COLOUR_DARK_BROWN), opaque(COLOUR_GREY), opaque(COLOUR_GREY), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, { WindowClass::about, { opaque(COLOUR_GREY), opaque(COLOUR_DARK_BROWN), opaque(COLOUR_WHITE), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK), opaque(COLOUR_BLACK) } }, diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 35070aec37..f57c802a04 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -28,6 +28,7 @@ namespace OpenRCT2::Ui::Windows { static constexpr ScreenSize kWindowSize = { 400, 300 }; + static constexpr uint8_t kItemSeparatorHeight = 2; enum WindowNewsWidgetIdx { @@ -391,7 +392,8 @@ namespace OpenRCT2::Ui::Windows ScreenSize onScrollGetSize(int32_t scrollIndex) override { int32_t scrollHeight = static_cast(getGameState().newsItems.GetArchived().size()) - * CalculateNewsItemHeight(); + * CalculateNewsItemHeight() + - kItemSeparatorHeight; return { kWindowSize.width, scrollHeight }; } @@ -443,6 +445,7 @@ namespace OpenRCT2::Ui::Windows int32_t y = 0; int32_t i = 0; + const auto backgroundPaletteIndex = ColourMapA[colours[3].colour].light; for (const auto& newsItem : getGameState().newsItems.GetArchived()) { if (y >= rt.y + rt.height) @@ -454,10 +457,10 @@ namespace OpenRCT2::Ui::Windows continue; } + // Outer frame + GfxFillRectInset(rt, { -1, y, 383, y + itemHeight - 1 }, colours[1], INSET_RECT_F_30); // Background - GfxFillRectInset( - rt, { -1, y, 383, y + itemHeight - 1 }, colours[1], - (INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_GREY)); + GfxFillRect(rt, { 0, y + 1, 381, y + itemHeight - 2 }, backgroundPaletteIndex); // Date text { From 3ef7c2d9e8762ddfb5f49a57d7a274e6762dcf39 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Thu, 16 Oct 2025 11:40:02 +0200 Subject: [PATCH 2/4] Fill scrollbar gap in news window if no scrollbar is visible --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/News.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index ea45c66d42..44cef4dd47 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -12,6 +12,7 @@ - Fix: [#25299] The Mine Train Coaster left large helix draws incorrect sprites at certain angles (original bug). - Fix: [#25328] Spiral Slide in Blackpool Pleasure Beach has its entrance and exit the wrong way round (bug in the original scenario). - Fix: [#25342] The Go-Karts medium right gentle sloped turn does not have a tunnel at the end. +- Fix: [#25349] Items in Recent Messages are too narrow if there is no scrollbar visible. - Fix: [#25350] The scrolling intro background switches colour halfway through (original bug). - Fix: [#25350] When skipping the scrolling intro, the screen does not get cleared properly. - Fix: [#25350] Scrolling intro cannot be skipped using a mouse click. diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index f57c802a04..7ac603638b 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -446,6 +446,10 @@ namespace OpenRCT2::Ui::Windows int32_t i = 0; const auto backgroundPaletteIndex = ColourMapA[colours[3].colour].light; + // Fill the scrollbar gap if no scrollbar is visible + const bool scrollbarVisible = scrolls[0].contentHeight > widgets[WIDX_SCROLL].height(); + const auto scrollbarFill = scrollbarVisible ? 0 : kScrollBarWidth; + for (const auto& newsItem : getGameState().newsItems.GetArchived()) { if (y >= rt.y + rt.height) @@ -458,9 +462,9 @@ namespace OpenRCT2::Ui::Windows } // Outer frame - GfxFillRectInset(rt, { -1, y, 383, y + itemHeight - 1 }, colours[1], INSET_RECT_F_30); + GfxFillRectInset(rt, { -1, y, 383 + scrollbarFill, y + itemHeight - 1 }, colours[1], INSET_RECT_F_30); // Background - GfxFillRect(rt, { 0, y + 1, 381, y + itemHeight - 2 }, backgroundPaletteIndex); + GfxFillRect(rt, { 0, y + 1, 381 + scrollbarFill, y + itemHeight - 2 }, backgroundPaletteIndex); // Date text { @@ -480,7 +484,7 @@ namespace OpenRCT2::Ui::Windows // Subject button if ((newsItem.typeHasSubject()) && !(newsItem.hasButton())) { - auto screenCoords = ScreenCoordsXY{ 328, y + lineHeight + 4 }; + auto screenCoords = ScreenCoordsXY{ 328 + scrollbarFill, y + lineHeight + 4 }; int32_t press = 0; if (_pressedNewsItemIndex != -1) @@ -561,7 +565,7 @@ namespace OpenRCT2::Ui::Windows // Location button if ((newsItem.typeHasLocation()) && !(newsItem.hasButton())) { - auto screenCoords = ScreenCoordsXY{ 352, y + lineHeight + 4 }; + auto screenCoords = ScreenCoordsXY{ 352 + scrollbarFill, y + lineHeight + 4 }; int32_t press = 0; if (_pressedNewsItemIndex != -1) From 0659350577d9c58bb936f97430cbb441f1f4ecb7 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Thu, 16 Oct 2025 11:40:30 +0200 Subject: [PATCH 3/4] Use constant instead of hardcoded number --- src/openrct2-ui/windows/News.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 7ac603638b..0a37f0c7dc 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -572,7 +572,7 @@ namespace OpenRCT2::Ui::Windows { News::IsValidIndex(_pressedNewsItemIndex + News::ItemHistoryStart); if (i == _pressedNewsItemIndex && _pressedButtonIndex == 2) - press = 0x20; + press = INSET_RECT_FLAG_BORDER_INSET; } GfxFillRectInset(rt, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], press); GfxDrawSprite(rt, ImageId(SPR_LOCATE), screenCoords); From a047154cdff597cb19ba4a1dad23235582f2ff1b Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Thu, 16 Oct 2025 11:42:10 +0200 Subject: [PATCH 4/4] Remove now-unused INSET_RECT_FLAG_FILL_GREY --- src/openrct2/drawing/Drawing.h | 1 - src/openrct2/drawing/Rect.cpp | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index a39575f7b2..c00d8e7049 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -185,7 +185,6 @@ constexpr DrawBlendOp kBlendDst = 2 << 2; enum { - INSET_RECT_FLAG_FILL_GREY = (1 << 2), // 0x04 INSET_RECT_FLAG_BORDER_NONE = (1 << 3), // 0x08 INSET_RECT_FLAG_FILL_NONE = (1 << 4), // 0x10 INSET_RECT_FLAG_BORDER_INSET = (1 << 5), // 0x20 diff --git a/src/openrct2/drawing/Rect.cpp b/src/openrct2/drawing/Rect.cpp index bea8a9e9cf..74a03e6bbd 100644 --- a/src/openrct2/drawing/Rect.cpp +++ b/src/openrct2/drawing/Rect.cpp @@ -96,14 +96,7 @@ void GfxFillRectInset(RenderTarget& rt, const ScreenRect& rect, ColourWithFlags { if (!(flags & INSET_RECT_FLAG_FILL_DONT_LIGHTEN)) { - if (flags & INSET_RECT_FLAG_FILL_GREY) - { - fill = ColourMapA[COLOUR_BLACK].light; - } - else - { - fill = ColourMapA[colour.colour].lighter; - } + fill = ColourMapA[colour.colour].lighter; } GfxFillRect(rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, fill); } @@ -118,10 +111,6 @@ void GfxFillRectInset(RenderTarget& rt, const ScreenRect& rect, ColourWithFlags if (!(flags & INSET_RECT_FLAG_FILL_NONE)) { - if (flags & INSET_RECT_FLAG_FILL_GREY) - { - fill = ColourMapA[COLOUR_BLACK].light; - } GfxFillRect(rt, { leftTop + ScreenCoordsXY{ 1, 1 }, rightBottom - ScreenCoordsXY{ 1, 1 } }, fill); } }