forked from rosebudai/OpenRCT2-Web
Add sprites to weather cheat dropdown
This commit is contained in:
1 parent
445b38fe0f
commit
0669f0d107
6 files changed
+37
-27
No files matched your search
@@ -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
|
||||
STR_7017 :Quit
|
||||
STR_7018 :{SPRITE}{NEWLINE_SMALLER}{MOVE_X}{26}{STRINGID}
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<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 },
|
||||
});
|
||||
|
||||
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<uint32_t>(weatherType.first);
|
||||
fmt.Add<StringId>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user