diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 6d063e10d3..abbf2ef186 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3847,4 +3847,7 @@ 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 -STR_7018 :{SPRITE}{NEWLINE_SMALLER}{MOVE_X}{26}{STRINGID} +STR_7018 :{SPRITE}{MOVE_X}{17}{STRINGID} +STR_7019 :{SPRITE}{MOVE_X}{27}{STRINGID} +STR_7020 :{MOVE_X}{10}{SPRITE}{NEWLINE_SMALLER}{MOVE_X}{36}{STRINGID} +STR_7021 :{MOVE_X}{10}{SPRITE}{NEWLINE_SMALLER}»{MOVE_X}{36}{STRINGID} diff --git a/resources/g2/icons/weather_blizzard_small.png b/resources/g2/icons/weather_blizzard_small.png new file mode 100644 index 0000000000..155c9b3d12 Binary files /dev/null and b/resources/g2/icons/weather_blizzard_small.png differ diff --git a/resources/g2/icons/weather_cloud_small.png b/resources/g2/icons/weather_cloud_small.png new file mode 100644 index 0000000000..071dde1629 Binary files /dev/null and b/resources/g2/icons/weather_cloud_small.png differ diff --git a/resources/g2/icons/weather_heavy_rain_small.png b/resources/g2/icons/weather_heavy_rain_small.png new file mode 100644 index 0000000000..1620dc92aa Binary files /dev/null and b/resources/g2/icons/weather_heavy_rain_small.png differ diff --git a/resources/g2/icons/weather_heavy_snow_small.png b/resources/g2/icons/weather_heavy_snow_small.png new file mode 100644 index 0000000000..8c3b217a74 Binary files /dev/null and b/resources/g2/icons/weather_heavy_snow_small.png differ diff --git a/resources/g2/icons/weather_light_rain_small.png b/resources/g2/icons/weather_light_rain_small.png new file mode 100644 index 0000000000..6463a8f64e Binary files /dev/null and b/resources/g2/icons/weather_light_rain_small.png differ diff --git a/resources/g2/icons/weather_snow_small.png b/resources/g2/icons/weather_snow_small.png new file mode 100644 index 0000000000..d921631593 Binary files /dev/null and b/resources/g2/icons/weather_snow_small.png differ diff --git a/resources/g2/icons/weather_storm_small.png b/resources/g2/icons/weather_storm_small.png new file mode 100644 index 0000000000..7942c1f8f9 Binary files /dev/null and b/resources/g2/icons/weather_storm_small.png differ diff --git a/resources/g2/icons/weather_sun_cloud_small.png b/resources/g2/icons/weather_sun_cloud_small.png new file mode 100644 index 0000000000..1f0097797b Binary files /dev/null and b/resources/g2/icons/weather_sun_cloud_small.png differ diff --git a/resources/g2/icons/weather_sun_small.png b/resources/g2/icons/weather_sun_small.png new file mode 100644 index 0000000000..0d082c85ff Binary files /dev/null and b/resources/g2/icons/weather_sun_small.png differ diff --git a/resources/g2/sprites.json b/resources/g2/sprites.json index 321b1ed5c8..ca8d600fb3 100644 --- a/resources/g2/sprites.json +++ b/resources/g2/sprites.json @@ -363,18 +363,54 @@ "x": 2, "y": 1 }, + { + "path": "icons/weather_sun_small.png", + "x": 3 + }, + { + "path": "icons/weather_sun_cloud_small.png", + "x": 0 + }, + { + "path": "icons/weather_cloud_small.png", + "x": 0 + }, + { + "path": "icons/weather_light_rain_small.png", + "x": 3 + }, + { + "path": "icons/weather_heavy_rain_small.png", + "x": 2 + }, + { + "path": "icons/weather_storm_small.png", + "x": 3 + }, { "path": "icons/weather_snow.png", "x": 3 }, + { + "path": "icons/weather_snow_small.png", + "x": 3 + }, { "path": "icons/weather_heavy_snow.png", "x": 1 }, + { + "path": "icons/weather_heavy_snow_small.png", + "x": 3 + }, { "path": "icons/weather_blizzard.png", "x": 1 }, + { + "path": "icons/weather_blizzard_small.png", + "x": 2 + }, { "path": "icons/monitor_0.png", "x": 3, diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index ea9ecc1e24..12decff53c 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -433,7 +433,10 @@ 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_CAPTION = 7018, + STR_WEATHER_DROPDOWN_ITEM = 7019, + STR_WEATHER_DROPDOWN_ITEM_ENLARGED = 7020, + STR_WEATHER_DROPDOWN_ITEM_ENLARGED_SELECTED = 7021, STR_WEATHER_NATURE_CHEATS_TIP = 6666, STR_YEAR = 6196, STR_CHEAT_IGNORE_PRICE_TIP = 6660, diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index fb812f5af3..efa08827c8 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -56,16 +57,23 @@ static StringId _staffSpeedNames[] = STR_FAST, }; -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 }, +struct WeatherInfo +{ + ImageIndex smallIcon; + ImageIndex largeIcon; + StringId label; +}; + +static constexpr auto kWeatherTypes = std::to_array({ + { SPR_G2_WEATHER_SUN_SMALL, SPR_WEATHER_SUN, STR_SUNNY }, + { SPR_G2_WEATHER_SUN_CLOUD_SMALL, SPR_WEATHER_SUN_CLOUD, STR_PARTIALLY_CLOUDY }, + { SPR_G2_WEATHER_CLOUD_SMALL, SPR_WEATHER_CLOUD, STR_CLOUDY }, + { SPR_G2_WEATHER_LIGHT_RAIN_SMALL, SPR_WEATHER_LIGHT_RAIN, STR_RAIN }, + { SPR_G2_WEATHER_HEAVY_RAIN_SMALL, SPR_WEATHER_HEAVY_RAIN, STR_HEAVY_RAIN }, + { SPR_G2_WEATHER_STORM_SMALL, SPR_WEATHER_STORM, STR_THUNDERSTORM }, + { SPR_G2_WEATHER_SNOW_SMALL, SPR_G2_WEATHER_SNOW, STR_SNOW }, + { SPR_G2_WEATHER_HEAVY_SNOW_SMALL, SPR_G2_WEATHER_HEAVY_SNOW, STR_HEAVY_SNOW }, + { SPR_G2_WEATHER_BLIZZARD_SMALL, SPR_G2_WEATHER_BLIZZARD, STR_BLIZZARD }, }); enum WindowCheatsWidgetIdx @@ -341,7 +349,7 @@ static constexpr auto window_cheats_rides_widgets = makeWidgets( static constexpr auto window_cheats_weather_widgets = makeWidgets( kMainCheatWidgets, makeWidget ({ 5, 48}, {238, 50}, WidgetType::groupbox, WindowColour::secondary, STR_CHEAT_WEATHER_GROUP ), // Weather group - makeWidget ({126, 62}, {111, 14}, WidgetType::dropdownMenu, WindowColour::secondary, kStringIdNone, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather + makeWidget ({126, 62}, {111, 14}, WidgetType::dropdownMenu, WindowColour::secondary, STR_WEATHER_CAPTION, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather makeWidget ({225, 63}, { 11, 12}, WidgetType::button, WindowColour::secondary, STR_DROPDOWN_GLYPH, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather makeWidget ({ 11, 80}, kCheatCheckSize, WidgetType::checkbox, WindowColour::secondary, STR_CHEAT_FREEZE_WEATHER, STR_CHEAT_FREEZE_WEATHER_TIP), // Freeze weather makeWidget ({ 5, 102}, {238, 37}, WidgetType::groupbox, WindowColour::secondary, STR_FAUNA ), // Fauna group @@ -577,7 +585,10 @@ static StringId window_cheats_page_titles[] = { if (page == WINDOW_CHEATS_PAGE_WEATHER) { auto& weatherType = kWeatherTypes[EnumValue(gameState.weatherCurrent.weatherType)]; - widgets[WIDX_WEATHER].text = weatherType.second; + + auto ft = Formatter::Common(); + ft.Add(weatherType.smallIcon); + ft.Add(weatherType.label); } // Staff speed @@ -1004,22 +1015,37 @@ static StringId window_cheats_page_titles[] = { { case WIDX_WEATHER_DROPDOWN_BUTTON: { - auto& dropdownWidget = widgets[widgetIndex - 1]; + const auto& dropdownWidget = widgets[widgetIndex - 1]; + const bool isEnlarged = Config::Get().interface.enlargedUi; + const auto currentSelection = EnumValue(getGameState().weatherCurrent.weatherType); + + const auto itemWidth = dropdownWidget.width() + (isEnlarged ? 30 : 22) - 3; + const auto itemHeight = isEnlarged ? 20 : 12; // !!! TTF? + + const auto format = isEnlarged ? STR_WEATHER_DROPDOWN_ITEM_ENLARGED : STR_DROPDOWN_MENU_LABEL; + const auto formatAlt = isEnlarged ? STR_WEATHER_DROPDOWN_ITEM_ENLARGED_SELECTED + : STR_DROPDOWN_MENU_LABEL_SELECTED; + auto i = 0u; for (auto& weatherType : kWeatherTypes) { - Formatter fmt; - fmt.Add(weatherType.first); - fmt.Add(weatherType.second); + Formatter ft; + if (!isEnlarged) + ft.Add(STR_WEATHER_DROPDOWN_ITEM); + + ft.Add(isEnlarged ? weatherType.largeIcon : weatherType.smallIcon); + ft.Add(weatherType.label); + + // Workaround: DIY to keep selection indicator aligned with label + auto label = i == currentSelection ? formatAlt : format; + gDropdown.items[i] = Dropdown::PlainMenuLabel(label, ft); - gDropdown.items[i] = Dropdown::PlainMenuLabel(STR_WEATHER_DROPDOWN_ITEM, fmt); i++; } WindowDropdownShowTextCustomWidth( - { 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); + { windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.bottom }, 0, colours[1], itemHeight, + Dropdown::Flag::CustomHeight | Dropdown::Flag::StayOpen, std::size(kWeatherTypes), itemWidth); } } } diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index f952f45740..db813b49a8 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -90,7 +90,7 @@ namespace OpenRCT2::Ui::Windows } void drawTextItem( - RenderTarget& rt, ScreenCoordsXY screenCoords, int32_t width, const Dropdown::Item& item, bool highlighted, + RenderTarget& rt, ScreenCoordsXY screenCoords, int32_t ddWidth, const Dropdown::Item& item, bool highlighted, StringId format, Colour background) { ColourWithFlags colour = { background }; @@ -103,7 +103,7 @@ namespace OpenRCT2::Ui::Windows Formatter ft; ft.Add(item.text); - DrawTextEllipsised(rt, { screenCoords.x + 2, screenCoords.y + yOffset }, width - 7, format, ft, { colour }); + DrawTextEllipsised(rt, { screenCoords.x + 2, screenCoords.y + yOffset }, ddWidth - 7, format, ft, { colour }); } void onDraw(RenderTarget& rt) override diff --git a/src/openrct2/SpriteIds.h b/src/openrct2/SpriteIds.h index 6dc84b8833..58ec99299d 100644 --- a/src/openrct2/SpriteIds.h +++ b/src/openrct2/SpriteIds.h @@ -1155,9 +1155,18 @@ enum : ImageIndex SPR_G2_FOLDER_DEFAULT, SPR_G2_SYSTEM_BROWSER, SPR_G2_PEEP_ANIMATIONS, + SPR_G2_WEATHER_SUN_SMALL, + SPR_G2_WEATHER_SUN_CLOUD_SMALL, + SPR_G2_WEATHER_CLOUD_SMALL, + SPR_G2_WEATHER_LIGHT_RAIN_SMALL, + SPR_G2_WEATHER_HEAVY_RAIN_SMALL, + SPR_G2_WEATHER_STORM_SMALL, SPR_G2_WEATHER_SNOW, + SPR_G2_WEATHER_SNOW_SMALL, SPR_G2_WEATHER_HEAVY_SNOW, + SPR_G2_WEATHER_HEAVY_SNOW_SMALL, SPR_G2_WEATHER_BLIZZARD, + SPR_G2_WEATHER_BLIZZARD_SMALL, SPR_G2_MONITOR_TAB_START, SPR_G2_MONITOR_TAB_END = SPR_G2_MONITOR_TAB_START + 15, SPR_G2_CONTROLS_TAB_START,