Add small weather icons and tweak alignment
@@ -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}
|
||||
|
||||
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <openrct2/SpriteIds.h>
|
||||
#include <openrct2/actions/CheatSetAction.h>
|
||||
#include <openrct2/actions/ParkSetDateAction.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/EnumUtils.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Currency.h>
|
||||
@@ -56,16 +57,23 @@ static StringId _staffSpeedNames[] =
|
||||
STR_FAST,
|
||||
};
|
||||
|
||||
static constexpr auto kWeatherTypes = std::to_array<std::pair<ImageIndex, StringId>>({
|
||||
{ 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<WeatherInfo>({
|
||||
{ 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<uint32_t>(weatherType.smallIcon);
|
||||
ft.Add<StringId>(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<uint32_t>(weatherType.first);
|
||||
fmt.Add<StringId>(weatherType.second);
|
||||
Formatter ft;
|
||||
if (!isEnlarged)
|
||||
ft.Add<StringId>(STR_WEATHER_DROPDOWN_ITEM);
|
||||
|
||||
ft.Add<uint32_t>(isEnlarged ? weatherType.largeIcon : weatherType.smallIcon);
|
||||
ft.Add<StringId>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<const utf8*>(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
|
||||
|
||||
@@ -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,
|
||||
|
||||