mirror of https://github.com/OpenRCT2/OpenRCT2.git
Update options UI
This commit is contained in:
parent
e9799aa243
commit
e3ee511a0c
|
@ -172,8 +172,6 @@ enum WindowOptionsWidgetIdx {
|
|||
|
||||
// Misc
|
||||
WIDX_TITLE_SEQUENCE_GROUP = WIDX_PAGE_START,
|
||||
WIDX_TITLE_SEQUENCE_RANDOM,
|
||||
WIDX_TITLE_SEQUENCE_LABEL,
|
||||
WIDX_TITLE_SEQUENCE,
|
||||
WIDX_TITLE_SEQUENCE_DROPDOWN,
|
||||
WIDX_SCENARIO_GROUP,
|
||||
|
@ -343,27 +341,25 @@ static rct_widget window_options_controls_and_interface_widgets[] = {
|
|||
#undef TOOLBAR_GROUP_START
|
||||
};
|
||||
|
||||
#define TITLE_SEQUENCE_START 53
|
||||
#define SCENARIO_START (TITLE_SEQUENCE_START + 35)
|
||||
#define SCENARIO_OPTIONS_START (SCENARIO_START + 55)
|
||||
#define TWEAKS_START (SCENARIO_OPTIONS_START + 39)
|
||||
|
||||
static rct_widget window_options_misc_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
#define TITLE_SEQUENCE_START 53
|
||||
MakeWidget({ 5, TITLE_SEQUENCE_START + 0}, {300, 65}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_OPTIONS_TITLE_SEQUENCE ),
|
||||
MakeWidget({ 10, TITLE_SEQUENCE_START + 15}, {290, 16}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_OPTIONS_RANDOM_TITLE_SEQUENCE ), // Random Title Sequence
|
||||
MakeWidget({ 10, TITLE_SEQUENCE_START + 33}, {125, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_TITLE_SEQUENCE, STR_TITLE_SEQUENCE_TIP ),
|
||||
MakeWidget({135, TITLE_SEQUENCE_START + 32}, {165, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_STRING ), // Title sequence dropdown
|
||||
MakeWidget({288, TITLE_SEQUENCE_START + 33}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_TITLE_SEQUENCE_TIP ), // Title sequence dropdown button
|
||||
#undef TITLE_SEQUENCE_START
|
||||
#define SCENARIO_START 122
|
||||
MakeWidget( { 5, TITLE_SEQUENCE_START + 0}, {300, 31}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_OPTIONS_TITLE_SEQUENCE ),
|
||||
MakeDropdownWidgets({ 10, TITLE_SEQUENCE_START + 15}, {290, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_STRINGID, STR_TITLE_SEQUENCE_TIP), // Title sequence dropdown
|
||||
|
||||
MakeWidget({ 5, SCENARIO_START + 0}, {300, 51}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_OPTIONS_SCENARIO_SELECTION ),
|
||||
MakeWidget({ 10, SCENARIO_START + 16}, {165, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_OPTIONS_SCENARIO_GROUPING, STR_SCENARIO_GROUPING_TIP ),
|
||||
MakeWidget({175, SCENARIO_START + 15}, {125, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Scenario select mode
|
||||
MakeWidget({288, SCENARIO_START + 16}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SCENARIO_GROUPING_TIP ),
|
||||
MakeWidget({ 25, SCENARIO_START + 30}, {275, 16}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_OPTIONS_SCENARIO_UNLOCKING, STR_SCENARIO_UNLOCKING_TIP), // Unlocking of scenarios
|
||||
#undef SCENARIO_START
|
||||
#define SCENARIO_OPTIONS_START 177
|
||||
|
||||
MakeWidget({ 5, SCENARIO_OPTIONS_START + 0}, {300, 35}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_SCENARIO_OPTIONS ),
|
||||
MakeWidget({10, SCENARIO_OPTIONS_START + 15}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ALLOW_EARLY_COMPLETION, STR_EARLY_COMPLETION_TIP), // Allow early scenario completion
|
||||
#undef SCENARIO_OPTIONS_START
|
||||
#define TWEAKS_START 216
|
||||
|
||||
MakeWidget({ 5, TWEAKS_START + 0}, {300, 81}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_OPTIONS_TWEAKS ),
|
||||
MakeWidget({ 10, TWEAKS_START + 15}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_REAL_NAME, STR_REAL_NAME_TIP ), // Show 'real' names of guests
|
||||
MakeWidget({ 10, TWEAKS_START + 30}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_AUTO_STAFF_PLACEMENT, STR_AUTO_STAFF_PLACEMENT_TIP ), // Auto staff placement
|
||||
|
@ -371,10 +367,14 @@ static rct_widget window_options_misc_widgets[] = {
|
|||
MakeWidget({ 10, TWEAKS_START + 62}, {165, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DEFAULT_INSPECTION_INTERVAL, STR_DEFAULT_INSPECTION_INTERVAL_TIP),
|
||||
MakeWidget({175, TWEAKS_START + 61}, {125, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Default inspection time dropdown
|
||||
MakeWidget({288, TWEAKS_START + 62}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DEFAULT_INSPECTION_INTERVAL_TIP ), // Default inspection time dropdown button
|
||||
#undef TWEAKS_START
|
||||
WIDGETS_END,
|
||||
};
|
||||
|
||||
#undef TWEAKS_START
|
||||
#undef SCENARIO_OPTIONS_START
|
||||
#undef SCENARIO_START
|
||||
#undef TITLE_SEQUENCE_START
|
||||
|
||||
static rct_widget window_options_advanced_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
MakeWidget ({ 10, 54}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ENABLE_DEBUGGING_TOOLS, STR_ENABLE_DEBUGGING_TOOLS_TIP ), // Enable debugging tools
|
||||
|
@ -404,6 +404,7 @@ static rct_widget *window_options_page_widgets[] = {
|
|||
};
|
||||
|
||||
#pragma endregion
|
||||
// clang-format on
|
||||
|
||||
class OptionsWindow final : public Window
|
||||
{
|
||||
|
@ -1648,11 +1649,6 @@ private:
|
|||
config_save_default();
|
||||
window_close_by_class(WC_SCENARIO_SELECT);
|
||||
break;
|
||||
case WIDX_TITLE_SEQUENCE_RANDOM:
|
||||
gConfigInterface.random_title_sequence ^= 1;
|
||||
config_save_default();
|
||||
Invalidate();
|
||||
break;
|
||||
case WIDX_AUTO_OPEN_SHOPS:
|
||||
gConfigGeneral.auto_open_shops = !gConfigGeneral.auto_open_shops;
|
||||
config_save_default();
|
||||
|
@ -1689,11 +1685,20 @@ private:
|
|||
gDropdownItems[i].Args = reinterpret_cast<uintptr_t>(title_sequence_manager_get_name(i));
|
||||
}
|
||||
|
||||
gDropdownItems[numItems].Format = 0;
|
||||
numItems++;
|
||||
gDropdownItems[numItems].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItems[numItems].Args = STR_TITLE_SEQUENCE_RANDOM;
|
||||
numItems++;
|
||||
|
||||
WindowDropdownShowText(
|
||||
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1],
|
||||
Dropdown::Flag::StayOpen, numItems);
|
||||
|
||||
Dropdown::SetChecked(static_cast<int32_t>(title_get_current_sequence()), true);
|
||||
auto selectedIndex = gConfigInterface.random_title_sequence
|
||||
? numItems - 1
|
||||
: static_cast<int32_t>(title_get_current_sequence());
|
||||
Dropdown::SetChecked(selectedIndex, true);
|
||||
break;
|
||||
}
|
||||
case WIDX_SCENARIO_GROUPING_DROPDOWN:
|
||||
|
@ -1730,13 +1735,23 @@ private:
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_TITLE_SEQUENCE_DROPDOWN:
|
||||
if (dropdownIndex != static_cast<int32_t>(title_get_current_sequence()))
|
||||
{
|
||||
auto numItems = static_cast<int32_t>(title_sequence_manager_get_count());
|
||||
if (dropdownIndex < numItems && dropdownIndex != static_cast<int32_t>(title_get_current_sequence()))
|
||||
{
|
||||
gConfigInterface.random_title_sequence = false;
|
||||
title_sequence_change_preset(static_cast<size_t>(dropdownIndex));
|
||||
config_save_default();
|
||||
Invalidate();
|
||||
}
|
||||
else if (dropdownIndex == numItems + 1)
|
||||
{
|
||||
gConfigInterface.random_title_sequence = true;
|
||||
config_save_default();
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN:
|
||||
if (dropdownIndex != gConfigGeneral.default_inspection_interval)
|
||||
{
|
||||
|
@ -1760,9 +1775,17 @@ private:
|
|||
|
||||
void MiscPrepareDraw()
|
||||
{
|
||||
const utf8* name = title_sequence_manager_get_name(title_get_config_sequence());
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<utf8*>(name);
|
||||
if (gConfigInterface.random_title_sequence)
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_TITLE_SEQUENCE_RANDOM);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto name = title_sequence_manager_get_name(title_get_config_sequence());
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<utf8*>(name);
|
||||
}
|
||||
|
||||
// The real name setting of clients is fixed to that of the server
|
||||
// and the server cannot change the setting during gameplay to prevent desyncs
|
||||
|
@ -1783,21 +1806,8 @@ private:
|
|||
SetCheckboxValue(WIDX_REAL_NAME_CHECKBOX, gConfigGeneral.show_real_names_of_guests);
|
||||
SetCheckboxValue(WIDX_AUTO_STAFF_PLACEMENT, gConfigGeneral.auto_staff_placement);
|
||||
SetCheckboxValue(WIDX_AUTO_OPEN_SHOPS, gConfigGeneral.auto_open_shops);
|
||||
SetCheckboxValue(WIDX_TITLE_SEQUENCE_RANDOM, gConfigInterface.random_title_sequence);
|
||||
SetCheckboxValue(WIDX_ALLOW_EARLY_COMPLETION, gConfigGeneral.allow_early_completion);
|
||||
|
||||
// Disable title sequence dropdown if set to random
|
||||
if (gConfigInterface.random_title_sequence)
|
||||
{
|
||||
disabled_widgets |= (1ULL << WIDX_TITLE_SEQUENCE_DROPDOWN);
|
||||
disabled_widgets |= (1ULL << WIDX_TITLE_SEQUENCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
disabled_widgets &= ~(1ULL << WIDX_TITLE_SEQUENCE_DROPDOWN);
|
||||
disabled_widgets &= ~(1ULL << WIDX_TITLE_SEQUENCE);
|
||||
}
|
||||
|
||||
if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_DIFFICULTY)
|
||||
widgets[WIDX_SCENARIO_GROUPING].text = STR_OPTIONS_SCENARIO_DIFFICULTY;
|
||||
else
|
||||
|
|
|
@ -123,6 +123,27 @@ constexpr rct_widget MakeSpinnerIncreaseWidget(
|
|||
return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_NUMERIC_UP, tooltip);
|
||||
}
|
||||
|
||||
#define MakeDropdownWidgets(...) MakeDropdownBoxWidget(__VA_ARGS__), MakeDropdownButtonWidget(__VA_ARGS__)
|
||||
|
||||
constexpr rct_widget MakeDropdownBoxWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
|
||||
[[maybe_unused]] uint32_t content = 0xFFFFFFFF, rct_string_id tooltip = STR_NONE)
|
||||
{
|
||||
return MakeWidget(origin, size, type, colour, content);
|
||||
}
|
||||
|
||||
constexpr rct_widget MakeDropdownButtonWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
|
||||
[[maybe_unused]] uint32_t content = 0xFFFFFFFF, rct_string_id tooltip = STR_NONE)
|
||||
{
|
||||
const int16_t xPos = origin.x + size.width - 11;
|
||||
const int16_t yPos = origin.y + 1;
|
||||
const uint16_t width = 11;
|
||||
const uint16_t height = 10;
|
||||
|
||||
return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_DROPDOWN_GLYPH, tooltip);
|
||||
}
|
||||
|
||||
void WidgetScrollUpdateThumbs(rct_window* w, rct_widgetindex widget_index);
|
||||
void WidgetDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgetindex widgetIndex);
|
||||
|
||||
|
|
|
@ -2734,7 +2734,7 @@ enum : uint16_t
|
|||
STR_TITLE_SEQUENCE_RCT1_AA_LL = 5307,
|
||||
STR_TITLE_SEQUENCE_RCT2 = 5308,
|
||||
STR_TITLE_SEQUENCE_OPENRCT2 = 5309,
|
||||
STR_TITLE_SEQUENCE_RANDOM = 5310, // Unused
|
||||
STR_TITLE_SEQUENCE_RANDOM = 5310,
|
||||
STR_DEBUG_TIP = 5311,
|
||||
STR_DEBUG_DROPDOWN_CONSOLE = 5312,
|
||||
STR_DEBUG_DROPDOWN_TILE_INSPECTOR = 5313,
|
||||
|
|
Loading…
Reference in New Issue