diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 5e5a3e61f7..6d063e10d3 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3846,4 +3846,5 @@ STR_7013 :Drag areas of path STR_7014 :I own the game on Steam, but I haven’t installed it yet. STR_7015 :Please close Steam if it’s running, then click ‘OK’. STR_7016 :OpenRCT2 has tried to trigger a download in Steam. Please open Steam and let it download the game. When Steam is finished, click ‘OK’. -STR_7017 :Quit \ No newline at end of file +STR_7017 :Quit +STR_7018 :{SPRITE}{NEWLINE_SMALLER}{MOVE_X}{26}{STRINGID} diff --git a/distribution/changelog.txt b/distribution/changelog.txt index c481c01e7a..ffd2ad8239 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,6 +1,7 @@ 0.4.31 (in development) ------------------------------------------------------------------------ - Feature: [#25844] The sprite builder now also supports adding JSON-based palettes. +- Improved: [#25719] The weather change dropdown now shows icons next to the weather types for easier selection. - Improved: [#25765] The ‘View options’ and ‘Special track elements’ dropdowns no longer need click-and-hold. - Improved: [#25858] macOS now supports the onboarding menu. - Change: [#25018] Add upkeep cost to booster pieces. diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index d880ea2344..ea9ecc1e24 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -433,6 +433,7 @@ namespace OpenRCT2 STR_STAFF_CHEATS_TIP = 6669, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE = 5563, STR_WARNING_IN_CAPS = 5562, + STR_WEATHER_DROPDOWN_ITEM = 7018, STR_WEATHER_NATURE_CHEATS_TIP = 6666, STR_YEAR = 6196, STR_CHEAT_IGNORE_PRICE_TIP = 6660, diff --git a/src/openrct2-ui/interface/Dropdown.h b/src/openrct2-ui/interface/Dropdown.h index 5dcd249030..6f619e3ae8 100644 --- a/src/openrct2-ui/interface/Dropdown.h +++ b/src/openrct2-ui/interface/Dropdown.h @@ -178,6 +178,7 @@ namespace OpenRCT2::Dropdown Item PlainMenuLabel(StringId stringId); Item PlainMenuLabel(u8string string); Item PlainMenuLabel(const utf8* string); + Item PlainMenuLabel(StringId format, const Formatter& ft); /** * Like MenuLabel, but shows a tick when selected. diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 3240732f12..fb812f5af3 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -56,18 +56,17 @@ static StringId _staffSpeedNames[] = STR_FAST, }; -static constexpr StringId WeatherTypes[] = -{ - STR_SUNNY, - STR_PARTIALLY_CLOUDY, - STR_CLOUDY, - STR_RAIN, - STR_HEAVY_RAIN, - STR_THUNDERSTORM, - STR_SNOW, - STR_HEAVY_SNOW, - STR_BLIZZARD, -}; +static constexpr auto kWeatherTypes = std::to_array>({ + { SPR_WEATHER_SUN, STR_SUNNY }, + { SPR_WEATHER_SUN_CLOUD, STR_PARTIALLY_CLOUDY }, + { SPR_WEATHER_CLOUD, STR_CLOUDY }, + { SPR_WEATHER_LIGHT_RAIN, STR_RAIN }, + { SPR_WEATHER_HEAVY_RAIN, STR_HEAVY_RAIN }, + { SPR_WEATHER_STORM, STR_THUNDERSTORM }, + { SPR_G2_WEATHER_SNOW, STR_SNOW }, + { SPR_G2_WEATHER_HEAVY_SNOW, STR_HEAVY_SNOW }, + { SPR_G2_WEATHER_BLIZZARD, STR_BLIZZARD }, +}); enum WindowCheatsWidgetIdx { @@ -577,7 +576,8 @@ static StringId window_cheats_page_titles[] = { // Current weather if (page == WINDOW_CHEATS_PAGE_WEATHER) { - widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue(gameState.weatherCurrent.weatherType)]; + auto& weatherType = kWeatherTypes[EnumValue(gameState.weatherCurrent.weatherType)]; + widgets[WIDX_WEATHER].text = weatherType.second; } // Staff speed @@ -1000,26 +1000,26 @@ static StringId window_cheats_page_titles[] = { void onMouseDownWeather(WidgetIndex widgetIndex) { - auto* widget = &widgets[widgetIndex]; - auto& gameState = getGameState(); switch (widgetIndex) { case WIDX_WEATHER_DROPDOWN_BUTTON: { - Widget* dropdownWidget = widget - 1; - - for (size_t i = 0; i < std::size(WeatherTypes); i++) + auto& dropdownWidget = widgets[widgetIndex - 1]; + auto i = 0u; + for (auto& weatherType : kWeatherTypes) { - gDropdown.items[i] = Dropdown::MenuLabel(WeatherTypes[i]); + Formatter fmt; + fmt.Add(weatherType.first); + fmt.Add(weatherType.second); + + gDropdown.items[i] = Dropdown::PlainMenuLabel(STR_WEATHER_DROPDOWN_ITEM, fmt); + i++; } + WindowDropdownShowTextCustomWidth( - { windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), - colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 4); - - auto currentWeather = gameState.weatherCurrent.weatherType; - gDropdown.items[EnumValue(currentWeather)].setChecked(true); - - break; + { windowPos.x - 30 + dropdownWidget.left, windowPos.y + dropdownWidget.bottom }, 0, colours[1], 20, + Dropdown::Flag::CustomHeight | Dropdown::Flag::StayOpen, std::size(kWeatherTypes), + dropdownWidget.width() + 26); } } } diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 1eccd35212..4f08d386d7 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -670,6 +670,12 @@ namespace OpenRCT2::Dropdown return StringItem(ItemType::plain, LanguageGetString(stringId)); } + Item PlainMenuLabel(StringId format, const Formatter& ft) + { + auto string = FormatStringIDLegacy(format, ft.Data()); + return StringItem(ItemType::plain, string.c_str()); + } + Item ToggleOption(StringId stringId) { return StringItem(ItemType::toggle, LanguageGetString(stringId));