1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Merge pull request #25349 from Gymnasiast/feature/background-news-item

Allow theming news item background in Recent Messages
This commit is contained in:
Michael Steenbeek
2025-10-18 22:04:48 +02:00
committed by GitHub
5 changed files with 19 additions and 22 deletions

View File

@@ -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.
@@ -11,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.

View File

@@ -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) } },

View File

@@ -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<int32_t>(getGameState().newsItems.GetArchived().size())
* CalculateNewsItemHeight();
* CalculateNewsItemHeight()
- kItemSeparatorHeight;
return { kWindowSize.width, scrollHeight };
}
@@ -443,6 +445,11 @@ namespace OpenRCT2::Ui::Windows
int32_t y = 0;
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)
@@ -454,10 +461,10 @@ namespace OpenRCT2::Ui::Windows
continue;
}
// Outer frame
GfxFillRectInset(rt, { -1, y, 383 + scrollbarFill, 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 + scrollbarFill, y + itemHeight - 2 }, backgroundPaletteIndex);
// Date text
{
@@ -477,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)
@@ -558,14 +565,14 @@ 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)
{
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);

View File

@@ -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

View File

@@ -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);
}
}