Merge pull request #26947 from AaronVanGeffen/news-ticker

Move NewsTicker to its own window
This commit is contained in:
Aaron van Geffen authored and GitHub committed 2026-09-12 15:57:43 +02:00
commit cd728ac481
25 files changed
+426 -250

No files matched your search

+6 -4
View File
@@ -2448,9 +2448,6 @@ STR_5242 :Theme name already exists
STR_5243 :Invalid characters used
STR_5244 :Themes
STR_5245 :Top Toolbar
STR_5246 :Bottom Toolbar
STR_5247 :Track Editor Bottom Toolbar
STR_5248 :Scenario Editor Bottom Toolbar
STR_5249 :Title Menu Buttons
STR_5250 :Title Exit Button
STR_5251 :Title Options Button
@@ -3179,7 +3176,6 @@ STR_6137 :OpenRCT2, a free and open source recreation of and expansion to Rol
STR_6138 :OpenRCT2 is the work of many authors, a full list can be found under the “Contributors” button. For more information, visit http://github.com/OpenRCT2/OpenRCT2
STR_6139 :All product and company names belong to their respective holders. Use of them does not imply any affiliation with or endorsement by them.
STR_6140 :Changelog…
STR_6141 :RCT1 Bottom Toolbar
STR_6142 :{WINDOW_COLOUR_2}Track name: {BLACK}{STRING}
STR_6143 :{WINDOW_COLOUR_2}Ride type: {BLACK}{STRINGID}
STR_6144 :Show dirty visuals
@@ -3838,3 +3834,9 @@ STR_7040 :Footpath additions
STR_7041 :Park info panel
STR_7042 :Date info panel
STR_7043 :Can’t change land height here…
STR_7044 :News ticker
STR_7045 :RCT1 style status bar
STR_7046 :Status bar (RCT1 style)
STR_7047 :Step control (Track Editor)
STR_7048 :Step control (Scenario Editor)
STR_7049 :OpenRCT2
+1
View File
@@ -1,6 +1,7 @@
0.5.6 (in development)
------------------------------------------------------------------------
- Improved: [#21400] The selector for setting staff patrol areas is now drawn on the water as well as on the surface under water.
- Improved: [#26947] Rain is now drawn next to the bottom info panels (in RCT2 style).
- Fix: [#21320] RCT1 allows more cars per train on some rides than OpenRCT2.
- Fix: [#24457] Yellow is always rendered as third remap in Ride window.
- Fix: [#26754] Switching window tabs by touch could crash the game on some Linux builds.
+29 -21
View File
@@ -34,6 +34,8 @@ namespace OpenRCT2
STR_COPY_INPUT_TO_CLIPBOARD = 6363,
STR_COST_AMOUNT = 986,
STR_COST_LABEL = 1408,
STR_CURRENCY2DP = 1390,
STR_CURRENCY2DP_NEGATIVE = 1391,
STR_ENTER_NEW_VALUE = 6000,
STR_ENTER_PARK_NAME = 1719,
STR_ENTER_SELECTION_SIZE = 5129,
@@ -471,6 +473,10 @@ namespace OpenRCT2
STR_RATE_INPUT_TITLE = 5893,
STR_SUFFIX = 5888,
// Window: DateInfoPanel
STR_CELSIUS_VALUE = 2216,
STR_FAHRENHEIT_VALUE = 2217,
// Window: DebugPaint
STR_DEBUG_PAINT_SHOW_BLOCKED_TILES = 6260,
STR_DEBUG_PAINT_SHOW_BOUND_BOXES = 5902,
@@ -708,22 +714,8 @@ namespace OpenRCT2
STR_SLOPE_UP_TIP = 1188,
STR_TYPE = 1182,
// Window: GameBottomToolbar
STR_BOTTOM_TOOLBAR_CASH = 1390,
STR_BOTTOM_TOOLBAR_CASH_NEGATIVE = 1391,
STR_BOTTOM_TOOLBAR_NEWS_TEXT = 5485,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE = 1847,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE_SINGULAR = 6194,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE = 1848,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE_SINGULAR = 6195,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE = 1846,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE_SINGULAR = 6193,
STR_CELSIUS_VALUE = 2216,
STR_FAHRENHEIT_VALUE = 2217,
STR_PARK_RATING_TIP = 2221,
STR_PROFIT_PER_WEEK_AND_PARK_VALUE_TIP = 2482,
STR_SHOW_SUBJECT_TIP = 1937,
STR_FOLLOW_SUBJECT_TIP = 6458,
// Window: GameStatusBar
STR_STATUS_BAR_OPENRCT2 = 7049,
// Window: Guest
STR_CARRYING = 1810,
@@ -1070,6 +1062,11 @@ namespace OpenRCT2
STR_NOTIFICATION_SETTINGS = 5589,
STR_RECENT_MESSAGES = 2234,
// Window: NewsTicker
STR_NEWS_ITEM_TEXT = 5485,
STR_SHOW_SUBJECT_TIP = 1937,
STR_FOLLOW_SUBJECT_TIP = 6458,
// Window: ObjectLoadError
STR_COPY_ALL = 6130,
STR_COPY_ALL_TIP = 6302,
@@ -1326,6 +1323,16 @@ namespace OpenRCT2
STR_STAFF_LABEL = 2322,
STR_TOTAL_ADMISSIONS = 2800,
// Window: ParkInfoPanel
STR_PARK_INFO_PANEL_NUM_GUESTS_DECREASE = 1847,
STR_PARK_INFO_PANEL_NUM_GUESTS_DECREASE_SINGULAR = 6194,
STR_PARK_INFO_PANEL_NUM_GUESTS_INCREASE = 1848,
STR_PARK_INFO_PANEL_NUM_GUESTS_INCREASE_SINGULAR = 6195,
STR_PARK_INFO_PANEL_NUM_GUESTS_STABLE = 1846,
STR_PARK_INFO_PANEL_NUM_GUESTS_STABLE_SINGULAR = 6193,
STR_PARK_RATING_TIP = 2221,
STR_PROFIT_PER_WEEK_AND_PARK_VALUE_TIP = 2482,
// Window: PatrolArea
STR_ADJUST_LARGER_PATROL_AREA_TIP = 6470,
STR_ADJUST_SMALLER_PATROL_AREA_TIP = 6469,
@@ -1946,7 +1953,7 @@ namespace OpenRCT2
STR_THEMES_HEADER_PALETTE = 5237,
STR_THEMES_HEADER_WINDOW = 5236,
STR_THEMES_HEADER_TRANSPARENCY = 6673,
STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR = 6141,
STR_THEMES_OPTION_RCT1_GAME_STATUS_BAR = 7045,
STR_THEMES_OPTION_RCT1_PARK_CONTROLS = 5283,
STR_THEMES_OPTION_RCT1_RIDE_CONTROLS = 5282,
STR_THEMES_OPTION_RCT1_SCENARIO_SELECTION_FONT = 5284,
@@ -1963,9 +1970,6 @@ namespace OpenRCT2
STR_THEMES_TAB_TOOLS_TIP = 5230,
STR_THEMES_TITLE = 5244,
STR_THEMES_WINDOW_BANNER = 5209,
STR_THEMES_WINDOW_BOTTOM_TOOLBAR = 5246,
STR_THEMES_WINDOW_BOTTOM_TOOLBAR_SCENARIO_EDITOR = 5248,
STR_THEMES_WINDOW_BOTTOM_TOOLBAR_TRACK_EDITOR = 5247,
STR_THEMES_WINDOW_CHANGE_KEYBOARD_SHORTCUT = 5221,
STR_THEMES_WINDOW_CLEAR_SCENERY = 5195,
STR_THEMES_WINDOW_CONSTRUCT_RIDE = 5201,
@@ -1973,12 +1977,15 @@ namespace OpenRCT2
STR_THEMES_WINDOW_DEMOLISH_RIDE_PROMPT = 5224,
STR_THEMES_WINDOW_EDITOR_INVENTION_LIST = 5211,
STR_THEMES_WINDOW_EDITOR_OBJECT_SELECTION = 5210,
STR_THEMES_WINDOW_EDITOR_SCENARIO_OPTIONS = 5212,
STR_THEMES_WINDOW_EDITOR_OBJECTIVE_OPTIONS = 5213,
STR_THEMES_WINDOW_EDITOR_SCENARIO_OPTIONS = 5212,
STR_THEMES_WINDOW_EDITOR_STEP_CONTROL_SCENARIO = 7047,
STR_THEMES_WINDOW_EDITOR_STEP_CONTROL_TRACK = 7048,
STR_THEMES_WINDOW_ERROR = 6652,
STR_THEMES_WINDOW_FINANCES = 5187,
STR_THEMES_WINDOW_FIRE_PROMPT = 5225,
STR_THEMES_WINDOW_FOOTPATH = 5198,
STR_THEMES_WINDOW_GAME_STATUS_BAR = 7046,
STR_THEMES_WINDOW_GUEST_LIST = 5206,
STR_THEMES_WINDOW_INSTALL_TRACK = 5216,
STR_THEMES_WINDOW_KEYBOARD_SHORTCUT_LIST = 5220,
@@ -1991,6 +1998,7 @@ namespace OpenRCT2
STR_THEMES_WINDOW_MAPGEN = 5214,
STR_THEMES_WINDOW_NETWORK_STATUS = 5735,
STR_THEMES_WINDOW_NEW_CAMPAIGN = 5188,
STR_THEMES_WINDOW_NEWS_TICKER = 7044,
STR_THEMES_WINDOW_OPTIONS = 5219,
STR_THEMES_WINDOW_PARK_INFORMATION = 5253,
STR_THEMES_WINDOW_PARK_INFO_PANEL = 7041,
+4 -4
View File
@@ -64,8 +64,8 @@ public:
{
case WindowClass::about:
return AboutOpen();
case WindowClass::bottomToolbar:
return GameBottomToolbarOpen();
case WindowClass::gameStatusBar:
return gameStatusBarOpen();
case WindowClass::changelog:
return openView(WindowView::changelog);
case WindowClass::cheats:
@@ -470,8 +470,8 @@ public:
WindowSceneryResetSelectedSceneryItems();
break;
case INTENT_ACTION_INVALIDATE_TICKER_NEWS:
WindowGameBottomToolbarInvalidateNewsItem();
case INTENT_ACTION_UPDATE_NEWS_TICKER:
newsTickerInvalidateNewsItem();
break;
case INTENT_ACTION_REFRESH_GUEST_LIST:
+3 -2
View File
@@ -170,14 +170,15 @@ static void ShortcutRemoveTopBottomToolbarToggle()
{
windowMgr->CloseByClass(WindowClass::dropdown);
windowMgr->CloseByClass(WindowClass::topToolbar);
windowMgr->CloseByClass(WindowClass::bottomToolbar);
windowMgr->CloseByClass(WindowClass::gameStatusBar);
windowMgr->CloseByClass(WindowClass::newsTicker);
windowMgr->CloseByClass(WindowClass::parkInfoPanel);
windowMgr->CloseByClass(WindowClass::dateInfoPanel);
}
else if (gLegacyScene == LegacyScene::playing)
{
ContextOpenWindow(WindowClass::topToolbar);
ContextOpenWindow(WindowClass::bottomToolbar);
ContextOpenWindow(WindowClass::gameStatusBar);
ContextOpenWindow(WindowClass::parkInfoPanel);
ContextOpenWindow(WindowClass::dateInfoPanel);
}
+79 -27
View File
@@ -157,7 +157,8 @@ namespace OpenRCT2::Ui
{
// WindowClass WindowClassSZ WindowName windowColours
{ WindowClass::topToolbar, "WC_TOP_TOOLBAR", STR_THEMES_WINDOW_TOP_TOOLBAR, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkBrown), opaque(Drawing::Colour::grey) } },
{ WindowClass::bottomToolbar, "WC_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR, { translucent(Drawing::Colour::darkGreen), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::gameStatusBar, "WC_GAME_STATUS_BAR", STR_THEMES_WINDOW_GAME_STATUS_BAR, { translucent(Drawing::Colour::darkGreen) } },
{ WindowClass::newsTicker, "WC_NEWS_TICKER", STR_THEMES_WINDOW_NEWS_TICKER, { opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::parkInfoPanel, "WC_PARK_INFO_PANEL", STR_THEMES_WINDOW_PARK_INFO_PANEL, { translucent(Drawing::Colour::darkGreen), opaque(Drawing::Colour::brightGreen) } },
{ WindowClass::dateInfoPanel, "WC_DATE_INFO_PANEL", STR_THEMES_WINDOW_DATE_INFO_PANEL, { translucent(Drawing::Colour::darkGreen) } },
{ WindowClass::ride, "WC_RIDE", STR_THEMES_WINDOW_RIDE, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::saturatedGreen) } },
@@ -209,8 +210,8 @@ namespace OpenRCT2::Ui
{ WindowClass::landRights, "WC_LAND_RIGHTS", STR_THEMES_WINDOW_LAND_RIGHTS, { opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow), opaque(Drawing::Colour::darkYellow) } },
{ WindowClass::themes, "WC_THEMES", STR_THEMES_WINDOW_THEMES, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::darkGreen), opaque(Drawing::Colour::darkGreen) } },
{ WindowClass::staff, "WC_STAFF", STR_THEMES_WINDOW_STAFF, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple) } },
{ WindowClass::editorTrackBottomToolbar, "WC_EDITOR_TRACK_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR_TRACK_EDITOR, { translucent(Drawing::Colour::lightBlue), translucent(Drawing::Colour::lightBlue), translucent(Drawing::Colour::lightBlue) } },
{ WindowClass::editorScenarioBottomToolbar, "WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR_SCENARIO_EDITOR, { translucent(Drawing::Colour::lightBrown), translucent(Drawing::Colour::lightBrown), translucent(Drawing::Colour::mossGreen) } },
{ WindowClass::editorStepControlTrack, "WC_EDITOR_STEP_CONTROL_TRACK", STR_THEMES_WINDOW_EDITOR_STEP_CONTROL_TRACK, { translucent(Drawing::Colour::lightBlue), translucent(Drawing::Colour::lightBlue), translucent(Drawing::Colour::lightBlue) } },
{ WindowClass::editorStepControlScenario, "WC_EDITOR_STEP_CONTROL_SCENARIO", STR_THEMES_WINDOW_EDITOR_STEP_CONTROL_SCENARIO, { translucent(Drawing::Colour::lightBrown), translucent(Drawing::Colour::lightBrown), translucent(Drawing::Colour::mossGreen) } },
{ WindowClass::tileInspector, "WC_TILE_INSPECTOR", STR_TILE_INSPECTOR_TITLE, { opaque(Drawing::Colour::lightBlue), opaque(Drawing::Colour::lightBlue) } },
{ WindowClass::viewClipping, "WC_VIEW_CLIPPING", STR_VIEW_CLIPPING_TITLE, { opaque(Drawing::Colour::darkGreen) } },
{ WindowClass::patrolArea, "WC_PATROL_AREA", STR_SET_PATROL_AREA, { opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple), opaque(Drawing::Colour::lightPurple) } },
@@ -233,7 +234,8 @@ namespace OpenRCT2::Ui
static constexpr std::array kPredefinedThemeRCT1Entries = std::to_array<UIThemeWindowEntry>({
{ WindowClass::topToolbar, { opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
{ WindowClass::bottomToolbar, { translucent(Drawing::Colour::grey), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::voidBackground) } },
{ WindowClass::gameStatusBar, { translucent(Drawing::Colour::grey) } },
{ WindowClass::newsTicker, { opaque(Drawing::Colour::voidBackground), opaque(Drawing::Colour::grey) } },
{ WindowClass::parkInfoPanel, { translucent(Drawing::Colour::grey), opaque(Drawing::Colour::yellow) } },
{ WindowClass::dateInfoPanel, { translucent(Drawing::Colour::grey) } },
{ WindowClass::ride, { opaque(Drawing::Colour::bordeauxRed), opaque(Drawing::Colour::grey), opaque(Drawing::Colour::saturatedGreen), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black), opaque(Drawing::Colour::black) } },
@@ -265,7 +267,7 @@ namespace OpenRCT2::Ui
const UITheme kPredefinedThemeRCT1 = UITheme::CreatePredefined(
"*RCT1", kPredefinedThemeRCT1Entries,
UITHEME_FLAG_USE_LIGHTS_RIDE | UITHEME_FLAG_USE_LIGHTS_PARK | UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT
| UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR | UITHEME_FLAG_USE_3D_IMAGE_BUTTONS);
| UITHEME_FLAG_USE_GAME_STATUS_BAR | UITHEME_FLAG_USE_3D_IMAGE_BUTTONS);
const UITheme kPredefinedThemeRCT2 = UITheme::CreatePredefined("*RCT2", kPredefinedThemeRCT2Entries, 0);
@@ -337,6 +339,22 @@ namespace OpenRCT2::Ui
return colourSettingsEntry;
}
static ColourWithFlags jsonColourObjectToColourWithFlags(json_t input, uint8_t version)
{
if (version == 0)
{
auto number = Json::GetNumber<uint8_t>(input);
return ColourWithFlags::fromLegacy(number);
}
auto colourObject = Json::AsObject(input);
auto colour = colourFromString(Json::GetString(colourObject["colour"]), Drawing::Colour::black);
auto isTranslucent = Json::GetBoolean(colourObject["translucent"], false);
ColourFlags flags{};
flags.set(ColourFlag::translucent, isTranslucent);
return ColourWithFlags{ colour, flags };
}
UIThemeWindowEntry UIThemeWindowEntry::FromJson(const WindowThemeDesc* wtDesc, json_t& jsonData, uint8_t version)
{
Guard::Assert(jsonData.is_object(), "UIThemeWindowEntry::FromJson expects parameter jsonData to be object");
@@ -357,21 +375,7 @@ namespace OpenRCT2::Ui
for (size_t i = 0; i < colourCount; i++)
{
if (version == 0)
{
auto number = Json::GetNumber<uint8_t>(jsonColours[i]);
result.Theme.Colours[i] = ColourWithFlags::fromLegacy(number);
}
else
{
auto colourObject = Json::AsObject(jsonColours[i]);
auto colour = colourFromString(Json::GetString(colourObject["colour"]), Drawing::Colour::black);
auto isTranslucent = Json::GetBoolean(colourObject["translucent"], false);
ColourFlags flags{};
flags.set(ColourFlag::translucent, isTranslucent);
result.Theme.Colours[i] = { colour, flags };
}
result.Theme.Colours[i] = jsonColourObjectToColourWithFlags(jsonColours[i], version);
}
return result;
@@ -444,7 +448,7 @@ namespace OpenRCT2::Ui
{ "useLightsRide", (Flags & UITHEME_FLAG_USE_LIGHTS_RIDE) != 0 },
{ "useLightsPark", (Flags & UITHEME_FLAG_USE_LIGHTS_PARK) != 0 },
{ "useAltScenarioSelectFont", (Flags & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) != 0 },
{ "useFullBottomToolbar", (Flags & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) != 0 },
{ "useFullBottomToolbar", (Flags & UITHEME_FLAG_USE_GAME_STATUS_BAR) != 0 },
{ "use3dImageButtons", (Flags & UITHEME_FLAG_USE_3D_IMAGE_BUTTONS) != 0 },
};
@@ -469,6 +473,45 @@ namespace OpenRCT2::Ui
return result;
}
static void importOldBottomToolbar(UITheme& theme, json_t& jsonObj, uint8_t version)
{
auto jsonColours = Json::AsArray(jsonObj["colours"]);
const auto panelColour = jsonColourObjectToColourWithFlags(jsonColours[0], version);
const auto newsTickerButtonsColour = jsonColourObjectToColourWithFlags(jsonColours[1], version);
const auto messageBackgroundColour = jsonColourObjectToColourWithFlags(jsonColours[2], version);
const auto parkRatingBarColour = jsonColourObjectToColourWithFlags(jsonColours[3], version);
const auto* parkInfoPanelDesc = GetWindowThemeDescriptor(WindowClass::parkInfoPanel);
UIThemeWindowEntry parkInfoPanelEntry{};
parkInfoPanelEntry.Class = parkInfoPanelDesc->WindowClass;
parkInfoPanelEntry.Theme = parkInfoPanelDesc->windowColours.defaultTheme;
parkInfoPanelEntry.Theme.Colours[0] = panelColour;
parkInfoPanelEntry.Theme.Colours[1] = parkRatingBarColour;
theme.SetEntry(&parkInfoPanelEntry);
const auto* dateInfoPanelDesc = GetWindowThemeDescriptor(WindowClass::dateInfoPanel);
UIThemeWindowEntry dateInfoPanelEntry{};
dateInfoPanelEntry.Class = dateInfoPanelDesc->WindowClass;
dateInfoPanelEntry.Theme = dateInfoPanelDesc->windowColours.defaultTheme;
dateInfoPanelEntry.Theme.Colours[0] = panelColour;
theme.SetEntry(&dateInfoPanelEntry);
const auto* statusBarDesc = GetWindowThemeDescriptor(WindowClass::gameStatusBar);
UIThemeWindowEntry statusBarEntry{};
statusBarEntry.Class = statusBarDesc->WindowClass;
statusBarEntry.Theme = statusBarDesc->windowColours.defaultTheme;
statusBarEntry.Theme.Colours[0] = panelColour;
theme.SetEntry(&statusBarEntry);
const auto* newsTickerDesc = GetWindowThemeDescriptor(WindowClass::newsTicker);
UIThemeWindowEntry newsTickerEntry{};
newsTickerEntry.Class = newsTickerDesc->WindowClass;
newsTickerEntry.Theme = newsTickerDesc->windowColours.defaultTheme;
newsTickerEntry.Theme.Colours[0] = messageBackgroundColour;
newsTickerEntry.Theme.Colours[1] = newsTickerButtonsColour;
theme.SetEntry(&newsTickerEntry);
}
UITheme* UITheme::FromJson(json_t& jsonObj)
{
Guard::Assert(jsonObj.is_object(), "UITheme::FromJson expects parameter jsonObj to be object");
@@ -493,7 +536,7 @@ namespace OpenRCT2::Ui
{ "useLightsRide", UITHEME_FLAG_USE_LIGHTS_RIDE },
{ "useLightsPark", UITHEME_FLAG_USE_LIGHTS_PARK },
{ "useAltScenarioSelectFont", UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT },
{ "useFullBottomToolbar", UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR },
{ "useFullBottomToolbar", UITHEME_FLAG_USE_GAME_STATUS_BAR },
{ "use3dImageButtons", UITHEME_FLAG_USE_3D_IMAGE_BUTTONS },
});
@@ -503,14 +546,23 @@ namespace OpenRCT2::Ui
{
if (jsonValue.is_object())
{
const WindowThemeDesc* wtDesc = GetWindowThemeDescriptor(jsonKey.data());
if (wtDesc == nullptr)
const utf8* windowClassName = jsonKey.data();
// May occur in older themes created before the bottom toolbar split
if (strcmp(windowClassName, "WC_BOTTOM_TOOLBAR") == 0)
{
continue;
importOldBottomToolbar(*result, jsonValue, version);
}
else
{
const WindowThemeDesc* wtDesc = GetWindowThemeDescriptor(windowClassName);
if (wtDesc == nullptr)
{
continue;
}
UIThemeWindowEntry entry = UIThemeWindowEntry::FromJson(wtDesc, jsonValue, version);
result->SetEntry(&entry);
UIThemeWindowEntry entry = UIThemeWindowEntry::FromJson(wtDesc, jsonValue, version);
result->SetEntry(&entry);
}
}
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ namespace OpenRCT2::Ui
UITHEME_FLAG_USE_LIGHTS_RIDE = 1 << 1,
UITHEME_FLAG_USE_LIGHTS_PARK = 1 << 2,
UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT = 1 << 3,
UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR = 1 << 4,
UITHEME_FLAG_USE_GAME_STATUS_BAR = 1 << 4,
UITHEME_FLAG_USE_3D_IMAGE_BUTTONS = 1 << 5,
};
+2 -1
View File
@@ -187,7 +187,7 @@
<ClCompile Include="windows\Error.cpp" />
<ClCompile Include="windows\Finances.cpp" />
<ClCompile Include="windows\Footpath.cpp" />
<ClCompile Include="windows\GameBottomToolbar.cpp" />
<ClCompile Include="windows\GameStatusBar.cpp" />
<ClCompile Include="windows\Guest.cpp" />
<ClCompile Include="windows\GuestList.cpp" />
<ClCompile Include="windows\InstallTrack.cpp" />
@@ -204,6 +204,7 @@
<ClCompile Include="windows\NewCampaign.cpp" />
<ClCompile Include="windows\NewRide.cpp" />
<ClCompile Include="windows\News.cpp" />
<ClCompile Include="windows\NewsTicker.cpp" />
<ClCompile Include="windows\ObjectLoadError.cpp" />
<ClCompile Include="windows\Options.cpp" />
<ClCompile Include="windows\OverwritePrompt.cpp" />
+1 -1
View File
@@ -591,7 +591,7 @@ static StringId window_cheats_page_titles[] = {
}
auto& widget = widgets[WIDX_MONEY_SPINNER];
drawText(rt, windowPos + ScreenCoordsXY{ _xLcol, widget.top + 2 }, STR_BOTTOM_TOOLBAR_CASH, ft, { colour });
drawText(rt, windowPos + ScreenCoordsXY{ _xLcol, widget.top + 2 }, STR_CURRENCY2DP, ft, { colour });
}
else if (page == WINDOW_CHEATS_PAGE_DATE)
{
+2 -2
View File
@@ -40,8 +40,8 @@ namespace OpenRCT2::Ui::Windows
{
ColourSchemeUpdateByClass(
this,
gLegacyScene == LegacyScene::scenarioEditor ? WindowClass::editorScenarioBottomToolbar
: WindowClass::editorTrackBottomToolbar);
gLegacyScene == LegacyScene::scenarioEditor ? WindowClass::editorStepControlScenario
: WindowClass::editorStepControlTrack);
}
void onDraw(RenderTarget& rt) override
@@ -82,8 +82,8 @@ namespace OpenRCT2::Ui::Windows
{
ColourSchemeUpdateByClass(
this,
gLegacyScene == LegacyScene::scenarioEditor ? WindowClass::editorScenarioBottomToolbar
: WindowClass::editorTrackBottomToolbar);
gLegacyScene == LegacyScene::scenarioEditor ? WindowClass::editorStepControlScenario
: WindowClass::editorStepControlTrack);
auto& gameState = getGameState();
bool stepVisible = gLegacyScene != LegacyScene::trackDesignsManager
+171
View File
@@ -0,0 +1,171 @@
/*****************************************************************************
* Copyright (c) 2014-2026 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <openrct2-ui/interface/Theme.h>
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/interface/Window.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Context.h>
#include <openrct2/OpenRCT2.h>
#include <openrct2/drawing/Rectangle.h>
#include <openrct2/drawing/Text.h>
#include <openrct2/localisation/StringIds.h>
#include <openrct2/management/NewsItem.h>
#include <openrct2/ui/WindowManager.h>
using namespace OpenRCT2::Drawing;
namespace OpenRCT2::Ui::Windows
{
enum GameStatusBarWidgetIdx : WidgetIndex
{
WIDX_PANEL_OUTSET,
WIDX_PANEL_INSET,
};
// clang-format off
static constexpr Widget kGameStatusBarWidgets[] =
{
makeWidget({ 0, 0}, {356, 34}, WidgetType::imgBtn, WindowColour::primary), // Middle outset panel
makeWidget({ 2, 2}, {352, 30}, WidgetType::hiddenButton, WindowColour::primary), // Middle inset panel
};
// clang-format on
class GameStatusBar final : public Window
{
void DrawMiddlePanel(RenderTarget& rt)
{
Widget* middleOutsetWidget = &widgets[WIDX_PANEL_OUTSET];
Rectangle::fillInset(
rt,
{ windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 },
windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } },
colours[0], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::light, Rectangle::FillMode::none);
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::medium);
ScreenCoordsXY middleWidgetCoords(
windowPos.x + middleOutsetWidget->midX(), windowPos.y + middleOutsetWidget->top + line_height + 1);
int32_t panelWidth = middleOutsetWidget->width() - 63;
// Check if there is a map tooltip to draw
StringId stringId;
auto ft = GetMapTooltip();
std::memcpy(&stringId, ft.Data(), sizeof(StringId));
if (stringId == kStringIdNone)
{
drawTextWrapped(
rt, middleWidgetCoords, panelWidth, STR_STATUS_BAR_OPENRCT2, ft, { colours[0], TextAlignment::centre });
}
else
{
// Show tooltip in bottom toolbar
drawTextWrapped(rt, middleWidgetCoords, panelWidth, STR_STRINGID, ft, { colours[0], TextAlignment::centre });
}
}
public:
GameStatusBar()
{
setWidgets(kGameStatusBarWidgets);
// Reset the middle widget to not show by default.
// If it is required to be shown news_update will reshow it.
widgets[WIDX_PANEL_OUTSET].setHidden();
}
void onMouseUp(WidgetIndex widgetIndex) override
{
switch (widgetIndex)
{
case WIDX_PANEL_INSET:
ContextOpenWindow(WindowClass::recentNews);
break;
}
}
void onPrepareDraw() override
{
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::medium);
// Reset dimensions as appropriate -- in case we're switching languages.
height = line_height * 2 + 12;
windowPos.y = ContextGetHeight() - height;
// Change height of widgets in accordance with line height.
widgets[WIDX_PANEL_OUTSET].bottom = line_height * 3 + 3;
widgets[WIDX_PANEL_INSET].bottom = line_height * 3 + 1;
// Anchor the middle and right panel to the right
widgets[WIDX_PANEL_OUTSET].right = width - 1;
widgets[WIDX_PANEL_INSET].right = width - 3;
bool useFullToolbar = News::IsQueueEmpty() && (ThemeGetFlags() & UITHEME_FLAG_USE_GAME_STATUS_BAR)
&& gLegacyScene == LegacyScene::playing;
widgets[WIDX_PANEL_OUTSET].setVisible(useFullToolbar);
widgets[WIDX_PANEL_INSET].setVisible(useFullToolbar);
}
void onDraw(RenderTarget& rt) override
{
const auto& middleWidget = widgets[WIDX_PANEL_OUTSET];
if (middleWidget.isHidden())
return;
if (ThemeGetFlags() & UITHEME_FLAG_USE_GAME_STATUS_BAR)
{
// Draw grey background
auto leftTop = windowPos + ScreenCoordsXY{ middleWidget.left, middleWidget.top };
auto rightBottom = windowPos + ScreenCoordsXY{ middleWidget.right, middleWidget.bottom };
Rectangle::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51);
}
drawWidgets(rt);
if (ThemeGetFlags() & UITHEME_FLAG_USE_GAME_STATUS_BAR)
{
DrawMiddlePanel(rt);
}
}
};
/**
* Creates the main game bottom toolbar window.
*/
WindowBase* gameStatusBarOpen()
{
// Don't create window when theme does not require it
// NB: bailing out here as Game.cpp calls this function without access to themes
if (!(ThemeGetFlags() & UITHEME_FLAG_USE_GAME_STATUS_BAR))
return nullptr;
// TODO: query ParkInfoPanel, DateInfoPanel
constexpr auto kPanelWidth = 142;
// Toolbar width depends on whether we're showing panels besides
// TODO: read config when applicable
auto toolbarWidth = ContextGetWidth() - kPanelWidth * 2;
// Figure out how much line height we have to work with.
uint32_t lineHeight = FontGetLineHeight(FontStyle::medium);
int32_t toolbarHeight = lineHeight * 2 + 12;
auto* windowMgr = GetWindowManager();
auto* window = windowMgr->Create<GameStatusBar>(
WindowClass::gameStatusBar, ScreenCoordsXY(kPanelWidth, ContextGetHeight() - toolbarHeight),
{ toolbarWidth, toolbarHeight },
{ WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noBackground, WindowFlag::noTitleBar });
return window;
}
} // namespace OpenRCT2::Ui::Windows
+2 -2
View File
@@ -73,11 +73,11 @@ namespace OpenRCT2::Ui::Windows
void WindowMapTooltipUpdateVisibility()
{
if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)
if (ThemeGetFlags() & UITHEME_FLAG_USE_GAME_STATUS_BAR)
{
// The map tooltip is drawn by the bottom toolbar
auto* windowMgr = GetWindowManager();
windowMgr->InvalidateByClass(WindowClass::bottomToolbar);
windowMgr->InvalidateByClass(WindowClass::gameStatusBar);
return;
}
+1 -1
View File
@@ -501,7 +501,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter();
ft.Add<const char*>(newsItem.text.c_str());
drawTextWrapped(
rt, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft,
rt, { 2, y + lineHeight }, 325, STR_NEWS_ITEM_TEXT, ft,
{ Drawing::Colour::brightGreen, FontStyle::small });
}
// Subject button
@@ -13,7 +13,6 @@
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Context.h>
#include <openrct2/GameState.h>
#include <openrct2/OpenRCT2.h>
#include <openrct2/SpriteIds.h>
#include <openrct2/drawing/Drawing.String.h>
#include <openrct2/drawing/Drawing.h>
@@ -22,18 +21,18 @@
#include <openrct2/drawing/Text.h>
#include <openrct2/entity/Guest.h>
#include <openrct2/entity/Staff.h>
#include <openrct2/localisation/StringIds.h>
#include <openrct2/management/NewsItem.h>
#include <openrct2/object/ObjectManager.h>
#include <openrct2/object/PeepAnimationsObject.h>
#include <openrct2/peep/PeepSpriteIds.h>
#include <openrct2/scenes/SceneManager.h>
#include <openrct2/ui/WindowManager.h>
using namespace OpenRCT2::Drawing;
namespace OpenRCT2::Ui::Windows
{
enum WindowGameBottomToolbarWidgetIdx : WidgetIndex
enum NewsTickerWidgetIdx : WidgetIndex
{
WIDX_PANEL_OUTSET,
WIDX_PANEL_INSET,
@@ -42,24 +41,26 @@ namespace OpenRCT2::Ui::Windows
};
// clang-format off
static constexpr Widget kGameBottomToolbarWidgets[] =
static constexpr Widget kNewsTickerWidgets[] =
{
makeWidget({ 0, 0}, {356, 34}, WidgetType::imgBtn, WindowColour::tertiary ), // Middle outset panel
makeWidget({ 2, 2}, {352, 30}, WidgetType::hiddenButton, WindowColour::tertiary ), // Middle inset panel
makeWidget({ 0, 0}, {356, 34}, WidgetType::imgBtn, WindowColour::primary ), // Middle outset panel
makeWidget({ 2, 2}, {352, 30}, WidgetType::hiddenButton, WindowColour::primary ), // Middle inset panel
makeWidget({ 5, 5}, { 24, 24}, WidgetType::flatBtn, WindowColour::secondary, 0xFFFFFFFF, STR_SHOW_SUBJECT_TIP ), // Associated news item window
makeWidget({327, 5}, { 24, 24}, WidgetType::flatBtn, WindowColour::secondary, ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP) // Scroll to news item target
};
// clang-format on
class GameBottomToolbar final : public Window
class NewsTicker final : public Window
{
private:
void DrawNewsItem(RenderTarget& rt)
void drawNewsItem(RenderTarget& rt)
{
const auto& middleOutsetWidget = widgets[WIDX_PANEL_OUTSET];
auto* newsItem = News::GetItem(0);
const auto* newsItem = News::GetItem(0);
if (newsItem == nullptr)
return;
// Current news item
const auto& middleOutsetWidget = widgets[WIDX_PANEL_OUTSET];
Rectangle::fillInset(
rt,
@@ -71,8 +72,7 @@ namespace OpenRCT2::Ui::Windows
auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget.midX(), middleOutsetWidget.top + 11 };
int32_t itemWidth = middleOutsetWidget.width() - 63;
drawNewsTicker(
rt, screenCoords, itemWidth, Drawing::Colour::brightGreen, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->text,
newsItem->ticks);
rt, screenCoords, itemWidth, Drawing::Colour::brightGreen, STR_NEWS_ITEM_TEXT, newsItem->text, newsItem->ticks);
const auto& newsSubjectWidget = widgets[WIDX_NEWS_SUBJECT];
screenCoords = windowPos + ScreenCoordsXY{ newsSubjectWidget.left, newsSubjectWidget.top };
@@ -170,90 +170,41 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawMiddlePanel(RenderTarget& rt)
{
Widget* middleOutsetWidget = &widgets[WIDX_PANEL_OUTSET];
Rectangle::fillInset(
rt,
{ windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 },
windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } },
colours[0], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::light, Rectangle::FillMode::none);
// Figure out how much line height we have to work with.
uint32_t line_height = FontGetLineHeight(FontStyle::medium);
ScreenCoordsXY middleWidgetCoords(
windowPos.x + middleOutsetWidget->midX(), windowPos.y + middleOutsetWidget->top + line_height + 1);
int32_t panelWidth = middleOutsetWidget->width() - 63;
// Check if there is a map tooltip to draw
StringId stringId;
auto ft = GetMapTooltip();
std::memcpy(&stringId, ft.Data(), sizeof(StringId));
if (stringId == kStringIdNone)
{
// TODO: this string probably shouldn't be reused for this
drawTextWrapped(
rt, middleWidgetCoords, panelWidth, STR_TITLE_SEQUENCE_OPENRCT2, ft, { colours[0], TextAlignment::centre });
}
else
{
// Show tooltip in bottom toolbar
drawTextWrapped(rt, middleWidgetCoords, panelWidth, STR_STRINGID, ft, { colours[0], TextAlignment::centre });
}
}
public:
GameBottomToolbar()
NewsTicker()
{
setWidgets(kGameBottomToolbarWidgets);
setWidgets(kNewsTickerWidgets);
currentFrame = 0;
initScrollWidgets();
// Reset the middle widget to not show by default.
// If it is required to be shown news_update will reshow it.
widgets[WIDX_PANEL_OUTSET].setHidden();
}
void onMouseUp(WidgetIndex widgetIndex) override
{
News::Item* newsItem;
const auto* newsItem = News::GetItem(0);
if (newsItem == nullptr)
return;
switch (widgetIndex)
{
case WIDX_PANEL_INSET:
if (News::IsQueueEmpty())
{
ContextOpenWindow(WindowClass::recentNews);
}
else
{
News::CloseCurrentItem();
}
News::CloseCurrentItem();
break;
case WIDX_NEWS_SUBJECT:
newsItem = News::GetItem(0);
News::OpenSubject(newsItem->type, newsItem->assoc);
break;
case WIDX_NEWS_LOCATE:
if (News::IsQueueEmpty())
{
auto subjectLoc = News::GetSubjectLocation(newsItem->type, newsItem->assoc);
if (!subjectLoc.has_value())
break;
{
newsItem = News::GetItem(0);
WindowBase* mainWindow = WindowGetMain();
if (mainWindow != nullptr)
WindowScrollToLocation(*mainWindow, subjectLoc.value());
auto subjectLoc = News::GetSubjectLocation(newsItem->type, newsItem->assoc);
if (!subjectLoc.has_value())
break;
WindowBase* mainWindow = WindowGetMain();
if (mainWindow != nullptr)
WindowScrollToLocation(*mainWindow, subjectLoc.value());
}
break;
}
}
}
@@ -276,74 +227,33 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_NEWS_LOCATE].right = width - 6;
widgets[WIDX_NEWS_LOCATE].left = widgets[WIDX_NEWS_LOCATE].right - 24;
if (News::IsQueueEmpty())
auto* newsItem = News::GetItem(0);
setWidgetDisabled(WIDX_NEWS_SUBJECT, false);
setWidgetDisabled(WIDX_NEWS_LOCATE, false);
// Find out if the news item is no longer valid
auto subjectLoc = News::GetSubjectLocation(newsItem->type, newsItem->assoc);
if (!subjectLoc.has_value())
setWidgetDisabled(WIDX_NEWS_LOCATE, true);
if (!(newsItem->typeHasSubject()))
{
bool useFullToolbar = ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR;
widgets[WIDX_PANEL_OUTSET].setVisible(useFullToolbar);
widgets[WIDX_PANEL_INSET].setVisible(useFullToolbar);
setWidgetDisabled(WIDX_NEWS_SUBJECT, true);
widgets[WIDX_NEWS_SUBJECT].setHidden();
widgets[WIDX_NEWS_LOCATE].setHidden();
if (useFullToolbar)
{
widgets[WIDX_PANEL_OUTSET].colour = 0;
widgets[WIDX_PANEL_INSET].colour = 0;
}
}
else
if (newsItem->hasButton())
{
News::Item* newsItem = News::GetItem(0);
widgets[WIDX_PANEL_OUTSET].setVisible();
widgets[WIDX_PANEL_INSET].setVisible();
widgets[WIDX_NEWS_SUBJECT].setVisible();
widgets[WIDX_NEWS_LOCATE].setVisible();
widgets[WIDX_PANEL_OUTSET].colour = 2;
widgets[WIDX_PANEL_INSET].colour = 2;
setWidgetDisabled(WIDX_NEWS_SUBJECT, false);
setWidgetDisabled(WIDX_NEWS_LOCATE, false);
// Find out if the news item is no longer valid
auto subjectLoc = News::GetSubjectLocation(newsItem->type, newsItem->assoc);
if (!subjectLoc.has_value())
setWidgetDisabled(WIDX_NEWS_LOCATE, true);
if (!(newsItem->typeHasSubject()))
{
setWidgetDisabled(WIDX_NEWS_SUBJECT, true);
widgets[WIDX_NEWS_SUBJECT].setHidden();
}
if (newsItem->hasButton())
{
setWidgetDisabled(WIDX_NEWS_SUBJECT, true);
setWidgetDisabled(WIDX_NEWS_LOCATE, true);
}
setWidgetDisabled(WIDX_NEWS_SUBJECT, true);
setWidgetDisabled(WIDX_NEWS_LOCATE, true);
}
}
void onDraw(RenderTarget& rt) override
{
const auto& middleWidget = widgets[WIDX_PANEL_OUTSET];
if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)
{
// Draw grey background
auto leftTop = windowPos + ScreenCoordsXY{ middleWidget.left, middleWidget.top };
auto rightBottom = windowPos + ScreenCoordsXY{ middleWidget.right, middleWidget.bottom };
Rectangle::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51);
}
drawWidgets(rt);
if (!News::IsQueueEmpty())
{
DrawNewsItem(rt);
}
else if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR)
{
DrawMiddlePanel(rt);
}
drawNewsItem(rt);
}
void onUpdate() override
@@ -351,14 +261,19 @@ namespace OpenRCT2::Ui::Windows
currentFrame++;
if (currentFrame >= 24)
currentFrame = 0;
if (News::IsQueueEmpty())
close();
}
};
/**
* Creates the main game bottom toolbar window.
*/
WindowBase* GameBottomToolbarOpen()
WindowBase* newsTickerOpen()
{
// Only show news ticker in-game
auto* sceneMgr = GetContext()->GetSceneManager();
if (sceneMgr->getActiveScene() != sceneMgr->getGameScene())
return nullptr;
// TODO: query ParkInfoPanel, DateInfoPanel
constexpr auto kPanelWidth = 142;
@@ -371,20 +286,21 @@ namespace OpenRCT2::Ui::Windows
int32_t toolbarHeight = lineHeight * 2 + 12;
auto* windowMgr = GetWindowManager();
auto* window = windowMgr->Create<GameBottomToolbar>(
WindowClass::bottomToolbar, ScreenCoordsXY(kPanelWidth, ContextGetHeight() - toolbarHeight),
auto* window = windowMgr->Create<NewsTicker>(
WindowClass::newsTicker, ScreenCoordsXY(kPanelWidth, ContextGetHeight() - toolbarHeight),
{ toolbarWidth, toolbarHeight },
{ WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noBackground, WindowFlag::noTitleBar });
return window;
}
void WindowGameBottomToolbarInvalidateNewsItem()
void newsTickerInvalidateNewsItem()
{
if (gLegacyScene == LegacyScene::playing)
{
auto* windowMgr = GetWindowManager();
windowMgr->InvalidateWidgetByClass(WindowClass::bottomToolbar, WIDX_PANEL_OUTSET);
}
auto* windowMgr = GetWindowManager();
auto* window = windowMgr->FindByClass(WindowClass::newsTicker);
if (window != nullptr)
window->invalidate();
else
newsTickerOpen();
}
} // namespace OpenRCT2::Ui::Windows
+1 -1
View File
@@ -881,7 +881,7 @@ namespace OpenRCT2::Ui::Windows
ft = Formatter();
ft.Add<money64>(parkEntranceFee);
StringId stringId = STR_BOTTOM_TOOLBAR_CASH;
StringId stringId = STR_CURRENCY2DP;
if (parkEntranceFee == 0)
stringId = STR_FREE;
+7 -7
View File
@@ -81,22 +81,22 @@ namespace OpenRCT2::Ui::Windows
windowPos.y + widget.midY() - (line_height == 10 ? 5 : 6) };
auto colour = getHoverWidgetColour(WIDX_MONEY);
StringId stringId = gameState.park.cash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH;
StringId stringId = gameState.park.cash < 0 ? STR_CURRENCY2DP_NEGATIVE : STR_CURRENCY2DP;
auto ft = Formatter();
ft.Add<money64>(gameState.park.cash);
drawText(rt, screenCoords, stringId, ft, { colour, TextAlignment::centre });
}
static constexpr StringId kGuestCountFormats[] = {
STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE,
STR_PARK_INFO_PANEL_NUM_GUESTS_STABLE,
STR_PARK_INFO_PANEL_NUM_GUESTS_DECREASE,
STR_PARK_INFO_PANEL_NUM_GUESTS_INCREASE,
};
static constexpr StringId kGuestCountFormatsSingular[] = {
STR_BOTTOM_TOOLBAR_NUM_GUESTS_STABLE_SINGULAR,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_DECREASE_SINGULAR,
STR_BOTTOM_TOOLBAR_NUM_GUESTS_INCREASE_SINGULAR,
STR_PARK_INFO_PANEL_NUM_GUESTS_STABLE_SINGULAR,
STR_PARK_INFO_PANEL_NUM_GUESTS_DECREASE_SINGULAR,
STR_PARK_INFO_PANEL_NUM_GUESTS_INCREASE_SINGULAR,
};
// Draw guests
+2 -2
View File
@@ -6847,7 +6847,7 @@ namespace OpenRCT2::Ui::Windows
}
else
{
_spinnerCaption0 = FormatStringID(STR_BOTTOM_TOOLBAR_CASH, ridePrimaryPrice);
_spinnerCaption0 = FormatStringID(STR_CURRENCY2DP, ridePrimaryPrice);
widgets[WIDX_PRIMARY_PRICE].setString(_spinnerCaption0.c_str());
}
@@ -6891,7 +6891,7 @@ namespace OpenRCT2::Ui::Windows
}
else
{
_spinnerCaption1 = FormatStringID(STR_BOTTOM_TOOLBAR_CASH, ride->price[1]);
_spinnerCaption1 = FormatStringID(STR_CURRENCY2DP, ride->price[1]);
widgets[WIDX_SECONDARY_PRICE].setString(_spinnerCaption1.c_str());
}
}
+16 -7
View File
@@ -110,7 +110,7 @@ namespace OpenRCT2::Ui::Windows
makeWidget({ 10, 54}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_RIDE_CONTROLS ), // rct1 ride lights
makeWidget({ 10, 69}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_PARK_CONTROLS ), // rct1 park lights
makeWidget({ 10, 84}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_SCENARIO_SELECTION_FONT ), // rct1 scenario font
makeWidget({ 10, 99}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR ), // rct1 bottom toolbar
makeWidget({ 10, 99}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_GAME_STATUS_BAR ), // rct1 bottom toolbar
makeWidget({ 10,114}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_USE_3D_IMAGE_BUTTONS ) // use 3D image buttons
);
// clang-format on
@@ -119,11 +119,12 @@ namespace OpenRCT2::Ui::Windows
static constexpr std::array kThemesTabMainClasses = std::to_array<WindowClass>({
WindowClass::topToolbar,
WindowClass::bottomToolbar,
WindowClass::gameStatusBar,
WindowClass::newsTicker,
WindowClass::parkInfoPanel,
WindowClass::dateInfoPanel,
WindowClass::editorScenarioBottomToolbar,
WindowClass::editorTrackBottomToolbar,
WindowClass::editorStepControlScenario,
WindowClass::editorStepControlTrack,
WindowClass::titleMenu,
WindowClass::titleExit,
WindowClass::titleOptions,
@@ -340,7 +341,7 @@ namespace OpenRCT2::Ui::Windows
setCheckboxValue(WIDX_THEMES_RCT1_PARK_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK);
setCheckboxValue(
WIDX_THEMES_RCT1_SCENARIO_FONT, ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT);
setCheckboxValue(WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR);
setCheckboxValue(WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, ThemeGetFlags() & UITHEME_FLAG_USE_GAME_STATUS_BAR);
setCheckboxValue(WIDX_THEMES_USE_3D_IMAGE_BUTTONS, ThemeGetFlags() & UITHEME_FLAG_USE_3D_IMAGE_BUTTONS);
}
}
@@ -459,9 +460,17 @@ namespace OpenRCT2::Ui::Windows
}
else
{
ThemeSetFlags(ThemeGetFlags() ^ static_cast<uint8_t>(UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR));
ThemeSetFlags(ThemeGetFlags() ^ static_cast<uint8_t>(UITHEME_FLAG_USE_GAME_STATUS_BAR));
ThemeSave();
windowMgr->InvalidateAll();
if (ThemeGetFlags() & UITHEME_FLAG_USE_GAME_STATUS_BAR)
{
windowMgr->OpenWindow(WindowClass::gameStatusBar);
}
else
{
windowMgr->CloseByClass(WindowClass::gameStatusBar);
}
}
break;
case WIDX_THEMES_USE_3D_IMAGE_BUTTONS:
+6 -3
View File
@@ -131,9 +131,8 @@ namespace OpenRCT2::Ui::Windows
void WindowFootpathKeyboardShortcutDemolishCurrent();
bool WindowFootpathSelectDefault();
// GameBottomToolbar
WindowBase* GameBottomToolbarOpen();
void WindowGameBottomToolbarInvalidateNewsItem();
// GameStatusBar
WindowBase* gameStatusBarOpen();
// Guest
WindowBase* GuestOpen(Peep* peep);
@@ -195,6 +194,10 @@ namespace OpenRCT2::Ui::Windows
// News
WindowBase* NewsOpen();
// NewsTicker
WindowBase* newsTickerOpen();
void newsTickerInvalidateNewsItem();
// NetworkStatus
WindowBase* NetworkStatusOpen(const std::string& text, CloseCallback onClose);
WindowBase* NetworkStatusOpenPassword();
+2 -1
View File
@@ -119,7 +119,7 @@ void GameCreateWindows()
{
ContextOpenWindow(WindowClass::mainWindow);
ContextOpenWindow(WindowClass::topToolbar);
ContextOpenWindow(WindowClass::bottomToolbar);
ContextOpenWindow(WindowClass::gameStatusBar);
ContextOpenWindow(WindowClass::parkInfoPanel);
ContextOpenWindow(WindowClass::dateInfoPanel);
WindowResizeGui(ContextGetWidth(), ContextGetHeight());
@@ -349,6 +349,7 @@ void GameLoadInit()
// being displayed due to pointer value reuse in the cache matching logic
Drawing::ScrollingText::invalidate();
// TODO: move relevant UI calls to UI subproject
if (!gLoadKeepWindowsOpen)
{
ContextResetSubsystems();
+19 -9
View File
@@ -763,18 +763,28 @@ static constexpr float kWindowScrollLocations[][2] = {
dateInfoPanel->windowPos.y = height - 32;
}
WindowBase* bottomWind = windowMgr->FindByClass(WindowClass::bottomToolbar);
if (bottomWind != nullptr && parkInfoPanel != nullptr && dateInfoPanel != nullptr)
auto bottomWidth = std::max(640, width);
auto bottomOffset = 0;
if (parkInfoPanel != nullptr && dateInfoPanel != nullptr)
{
bottomWind->width = std::max(640, width) - parkInfoPanel->width - dateInfoPanel->width;
bottomWind->windowPos.x = parkInfoPanel->width;
bottomWind->windowPos.y = height - 32;
bottomWidth -= parkInfoPanel->width + dateInfoPanel->width;
bottomOffset = parkInfoPanel->width;
}
else if (bottomWind != nullptr)
WindowBase* statusBar = windowMgr->FindByClass(WindowClass::gameStatusBar);
if (statusBar != nullptr)
{
bottomWind->width = std::max(640, width);
bottomWind->windowPos.x = 0;
bottomWind->windowPos.y = height - 32;
statusBar->width = bottomWidth;
statusBar->windowPos.x = bottomOffset;
statusBar->windowPos.y = height - 32;
}
WindowBase* newsTicker = windowMgr->FindByClass(WindowClass::newsTicker);
if (newsTicker != nullptr)
{
newsTicker->width = bottomWidth;
newsTicker->windowPos.x = bottomOffset;
newsTicker->windowPos.y = height - 32;
}
}
+4 -3
View File
@@ -17,11 +17,12 @@ namespace OpenRCT2
{
mainWindow = 0,
topToolbar = 1,
bottomToolbar = 2,
gameStatusBar = 2,
parkInfoPanel = 3,
dateInfoPanel = 4,
tooltip = 5,
dropdown = 6,
newsTicker = 7,
about = 8,
// publisherCredits = 9,
// musicCredits = 10,
@@ -99,8 +100,8 @@ namespace OpenRCT2
// Only used for colour schemes
staff = 220,
editorTrackBottomToolbar = 221,
editorScenarioBottomToolbar = 222,
editorStepControlTrack = 221,
editorStepControlScenario = 222,
chat = 223,
console = 224,
custom = 225,
+4 -4
View File
@@ -116,7 +116,7 @@ void News::InitQueue(GameState_t& gameState)
warningThrottle = 0;
}
auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS);
auto intent = Intent(INTENT_ACTION_UPDATE_NEWS_TICKER);
ContextBroadcastIntent(&intent);
}
@@ -163,7 +163,7 @@ void News::UpdateCurrentItem()
if (gameState.newsItems.isEmpty())
return;
auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS);
auto intent = Intent(INTENT_ACTION_UPDATE_NEWS_TICKER);
ContextBroadcastIntent(&intent);
// Update the current news item
@@ -199,7 +199,7 @@ void News::ItemQueues::archiveCurrent()
_recent.pop_front();
// Invalidate current news item bar
auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS);
auto intent = Intent(INTENT_ACTION_UPDATE_NEWS_TICKER);
ContextBroadcastIntent(&intent);
}
@@ -447,7 +447,7 @@ void News::DisableNewsItems(ItemType type, uint32_t assoc)
newsItem.setFlags(ItemFlags::hasButton);
if (&newsItem == &gameState.newsItems.current())
{
auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS);
auto intent = Intent(INTENT_ACTION_UPDATE_NEWS_TICKER);
ContextBroadcastIntent(&intent);
}
}
+1 -1
View File
@@ -33,7 +33,7 @@ namespace OpenRCT2
INTENT_ACTION_INIT_SCENERY,
INTENT_ACTION_SET_DEFAULT_SCENERY_CONFIG,
INTENT_ACTION_REFRESH_SCENERY,
INTENT_ACTION_INVALIDATE_TICKER_NEWS,
INTENT_ACTION_UPDATE_NEWS_TICKER,
INTENT_ACTION_REFRESH_GUEST_LIST,
INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD,
INTENT_ACTION_REFRESH_STAFF_LIST,