2014-05-11 09:01:01 +02:00
/*****************************************************************************
2026-01-05 14:42:59 +01:00
* Copyright (c) 2014-2026 OpenRCT2 developers
2014-05-11 09:01:01 +02:00
*
2018-06-15 14:07:34 +02:00
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2014-05-11 09:01:01 +02:00
*
2018-06-15 14:07:34 +02:00
* OpenRCT2 is licensed under the GNU General Public License version 3.
2014-05-11 09:01:01 +02:00
*****************************************************************************/
2014-08-16 15:29:15 +01:00
/**
2018-05-11 19:36:48 +02:00
* To better group the options together and allow the window to be scalable with additional OpenRCT2 options,
* the window has been changed to a tab interface similar to the options window seen in Locomotion.
2014-08-16 15:29:15 +01:00
*/
2017-12-03 22:35:16 +01:00
#include <cmath>
2018-06-22 23:21:44 +02:00
#include <openrct2-ui/interface/Dropdown.h>
2025-01-19 10:58:28 +01:00
#include <openrct2-ui/interface/Theme.h>
2018-01-03 00:13:37 +01:00
#include <openrct2-ui/interface/Viewport.h>
#include <openrct2-ui/interface/Widget.h>
2025-01-19 15:50:54 +01:00
#include <openrct2-ui/windows/Windows.h>
2024-07-09 16:23:31 +02:00
#include <openrct2/Diagnostic.h>
2025-09-08 16:21:29 +02:00
#include <openrct2/GameState.h>
2022-07-25 15:26:28 +01:00
#include <openrct2/PlatformEnvironment.h>
2025-02-13 10:51:46 -05:00
#include <openrct2/SpriteIds.h>
2026-02-09 15:07:42 +01:00
#include <openrct2/actions/GameActionRunner.h>
2026-02-10 08:57:40 +01:00
#include <openrct2/actions/general/ScenarioSetSettingAction.h>
2025-02-17 07:24:03 -05:00
#include <openrct2/audio/Audio.h>
2022-06-27 17:41:53 +01:00
#include <openrct2/audio/AudioContext.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/audio/AudioMixer.h>
#include <openrct2/config/Config.h>
2024-12-15 17:39:52 +01:00
#include <openrct2/core/EnumUtils.hpp>
2022-01-08 18:38:09 +01:00
#include <openrct2/core/File.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/core/String.hpp>
2026-01-13 23:41:59 +01:00
#include <openrct2/drawing/ColourMap.h>
2026-03-22 14:14:32 +01:00
#include <openrct2/drawing/Drawing.String.h>
2026-01-05 20:09:34 +01:00
#include <openrct2/drawing/Drawing.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/drawing/IDrawingEngine.h>
2025-12-16 21:09:14 +01:00
#include <openrct2/drawing/ScrollingText.h>
2018-01-06 18:32:25 +01:00
#include <openrct2/localisation/Currency.h>
2021-12-11 18:06:06 -05:00
#include <openrct2/localisation/Formatter.h>
2026-03-16 14:01:38 +01:00
#include <openrct2/localisation/Formatting.h>
2018-01-06 18:32:25 +01:00
#include <openrct2/localisation/Language.h>
2024-07-12 22:18:43 +02:00
#include <openrct2/localisation/Localisation.Date.h>
2018-04-26 23:48:25 +01:00
#include <openrct2/localisation/LocalisationService.h>
2026-03-06 12:46:41 -03:00
#include <openrct2/localisation/StringWithArgs.h>
2025-02-24 04:43:06 -05:00
#include <openrct2/network/Network.h>
2022-02-18 21:57:00 +01:00
#include <openrct2/platform/Platform.h>
2024-05-10 12:05:52 +02:00
#include <openrct2/rct1/Csg.h>
2021-01-09 20:54:02 +00:00
#include <openrct2/ride/RideAudio.h>
2018-03-19 23:28:40 +01:00
#include <openrct2/scenario/Scenario.h>
2024-04-23 21:31:05 +02:00
#include <openrct2/scenes/title/TitleScene.h>
#include <openrct2/scenes/title/TitleSequenceManager.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/ui/UiContext.h>
2025-01-19 10:58:28 +01:00
#include <openrct2/ui/WindowManager.h>
2014-05-11 09:01:01 +02:00
2024-12-31 09:31:33 -06:00
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
2025-01-17 08:36:38 -06:00
extern "C" {
2025-01-17 09:33:05 -06:00
extern void ExportPersistentData ();
extern void ImportPersistentData ();
2025-01-17 08:36:38 -06:00
}
2024-12-31 09:31:33 -06:00
#endif
2024-05-10 12:05:52 +02:00
using namespace OpenRCT2 ;
2022-06-27 17:41:53 +01:00
using namespace OpenRCT2 :: Audio ;
2026-01-13 23:41:59 +01:00
using namespace OpenRCT2 :: Drawing ;
2024-05-10 12:05:52 +02:00
2024-03-10 13:52:35 +00:00
namespace OpenRCT2 :: Ui :: Windows
{
2024-09-04 21:11:26 +02:00
enum WindowOptionsPage
{
WINDOW_OPTIONS_PAGE_DISPLAY ,
WINDOW_OPTIONS_PAGE_RENDERING ,
WINDOW_OPTIONS_PAGE_CULTURE ,
WINDOW_OPTIONS_PAGE_AUDIO ,
2025-04-18 16:40:38 +02:00
WINDOW_OPTIONS_PAGE_INTERFACE ,
WINDOW_OPTIONS_PAGE_CONTROLS ,
2024-09-04 21:11:26 +02:00
WINDOW_OPTIONS_PAGE_MISC ,
WINDOW_OPTIONS_PAGE_ADVANCED ,
WINDOW_OPTIONS_PAGE_COUNT
};
2014-05-27 02:06:57 +09:00
2015-06-04 14:51:54 -04:00
#pragma region Widgets
2024-09-04 21:11:26 +02:00
enum WindowOptionsWidgetIdx
{
WIDX_BACKGROUND ,
WIDX_TITLE ,
WIDX_CLOSE ,
WIDX_PAGE_BACKGROUND ,
WIDX_FIRST_TAB ,
WIDX_TAB_DISPLAY = WIDX_FIRST_TAB ,
WIDX_TAB_RENDERING ,
WIDX_TAB_CULTURE ,
WIDX_TAB_AUDIO ,
2025-04-18 16:40:38 +02:00
WIDX_TAB_INTERFACE ,
WIDX_TAB_CONTROLS ,
2024-09-04 21:11:26 +02:00
WIDX_TAB_MISC ,
WIDX_TAB_ADVANCED ,
2014-08-16 15:29:15 +01:00
2024-09-04 21:11:26 +02:00
WIDX_PAGE_START ,
2015-06-04 14:51:54 -04:00
2024-09-04 21:11:26 +02:00
// Display
2025-05-15 22:40:04 +02:00
WIDX_WINDOW_GROUP = WIDX_PAGE_START ,
2024-09-04 21:11:26 +02:00
WIDX_FULLSCREEN_LABEL ,
WIDX_FULLSCREEN ,
WIDX_FULLSCREEN_DROPDOWN ,
WIDX_RESOLUTION_LABEL ,
WIDX_RESOLUTION ,
WIDX_RESOLUTION_DROPDOWN ,
WIDX_SCALE_LABEL ,
WIDX_SCALE ,
WIDX_SCALE_UP ,
WIDX_SCALE_DOWN ,
2025-05-15 22:40:04 +02:00
WIDX_RENDERING_GROUP ,
2024-09-04 21:11:26 +02:00
WIDX_DRAWING_ENGINE_LABEL ,
WIDX_DRAWING_ENGINE ,
WIDX_DRAWING_ENGINE_DROPDOWN ,
2025-05-15 22:40:04 +02:00
WIDX_FRAME_RATE_LIMIT_LABEL ,
WIDX_FRAME_RATE_LIMIT ,
WIDX_FRAME_RATE_LIMIT_DROPDOWN ,
2024-09-04 21:11:26 +02:00
WIDX_SHOW_FPS_CHECKBOX ,
WIDX_MULTITHREADING_CHECKBOX ,
2025-05-15 22:40:04 +02:00
WIDX_BEHAVIOUR_GROUP ,
2024-09-04 21:11:26 +02:00
WIDX_MINIMIZE_FOCUS_LOSS ,
WIDX_DISABLE_SCREENSAVER_LOCK ,
2016-01-31 19:26:28 +01:00
2025-05-15 22:40:04 +02:00
// Map rendering
WIDX_MAP_RENDERING_GROUP = WIDX_PAGE_START ,
2024-09-04 21:11:26 +02:00
WIDX_TILE_SMOOTHING_CHECKBOX ,
WIDX_GRIDLINES_CHECKBOX ,
WIDX_UPPER_CASE_BANNERS_CHECKBOX ,
WIDX_SHOW_GUEST_PURCHASES_CHECKBOX ,
WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX ,
WIDX_VIRTUAL_FLOOR_LABEL ,
WIDX_VIRTUAL_FLOOR ,
WIDX_VIRTUAL_FLOOR_DROPDOWN ,
WIDX_EFFECTS_GROUP ,
WIDX_DAY_NIGHT_CHECKBOX ,
WIDX_ENABLE_LIGHT_FX_CHECKBOX ,
WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX ,
WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX ,
WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX ,
2016-09-03 09:09:40 -04:00
2024-09-04 21:11:26 +02:00
// Culture / Units
WIDX_LANGUAGE_LABEL = WIDX_PAGE_START ,
WIDX_LANGUAGE ,
WIDX_LANGUAGE_DROPDOWN ,
WIDX_CURRENCY_LABEL ,
WIDX_CURRENCY ,
WIDX_CURRENCY_DROPDOWN ,
WIDX_DISTANCE_LABEL ,
WIDX_DISTANCE ,
WIDX_DISTANCE_DROPDOWN ,
WIDX_TEMPERATURE_LABEL ,
WIDX_TEMPERATURE ,
WIDX_TEMPERATURE_DROPDOWN ,
WIDX_HEIGHT_LABELS_LABEL ,
WIDX_HEIGHT_LABELS ,
WIDX_HEIGHT_LABELS_DROPDOWN ,
WIDX_DATE_FORMAT_LABEL ,
WIDX_DATE_FORMAT ,
WIDX_DATE_FORMAT_DROPDOWN ,
2014-08-16 15:29:15 +01:00
2024-09-04 21:11:26 +02:00
// Audio
WIDX_SOUND = WIDX_PAGE_START ,
WIDX_SOUND_DROPDOWN ,
WIDX_MASTER_SOUND_CHECKBOX ,
WIDX_SOUND_CHECKBOX ,
WIDX_MUSIC_CHECKBOX ,
WIDX_AUDIO_FOCUS_CHECKBOX ,
WIDX_TITLE_MUSIC_LABEL ,
WIDX_TITLE_MUSIC ,
WIDX_TITLE_MUSIC_DROPDOWN ,
WIDX_MASTER_VOLUME ,
WIDX_SOUND_VOLUME ,
WIDX_MUSIC_VOLUME ,
2014-08-16 15:29:15 +01:00
2025-04-18 16:40:38 +02:00
// Interface
WIDX_THEMES_GROUP = WIDX_PAGE_START ,
2024-09-04 21:11:26 +02:00
WIDX_THEMES_LABEL ,
WIDX_THEMES ,
WIDX_THEMES_DROPDOWN ,
WIDX_THEMES_BUTTON ,
WIDX_TOOLBAR_BUTTONS_GROUP ,
WIDX_TOOLBAR_BUTTONS_CENTRED ,
WIDX_TOOLBAR_BUTTONS_SHOW_FOR_LABEL ,
WIDX_TOOLBAR_SHOW_FINANCES ,
WIDX_TOOLBAR_SHOW_RESEARCH ,
WIDX_TOOLBAR_SHOW_CHEATS ,
WIDX_TOOLBAR_SHOW_NEWS ,
WIDX_TOOLBAR_SHOW_MUTE ,
WIDX_TOOLBAR_SHOW_CHAT ,
WIDX_TOOLBAR_SHOW_ZOOM ,
2025-01-30 23:02:36 +01:00
WIDX_TOOLBAR_SHOW_ROTATE_ANTI_CLOCKWISE ,
2017-12-10 17:43:27 +01:00
2025-04-18 16:40:38 +02:00
// Controls
WIDX_CONTROLS_GROUP = WIDX_PAGE_START ,
WIDX_SCREEN_EDGE_SCROLLING ,
WIDX_TRAP_CURSOR ,
WIDX_INVERT_DRAG ,
WIDX_ZOOM_TO_CURSOR ,
WIDX_WINDOW_BUTTONS_ON_THE_LEFT ,
WIDX_ENLARGED_UI ,
WIDX_TOUCH_ENHANCEMENTS ,
WIDX_HOTKEY_DROPDOWN ,
2025-07-03 22:48:59 +02:00
// Gamepad
WIDX_GAMEPAD_GROUP ,
WIDX_GAMEPAD_DEADZONE_LABEL ,
WIDX_GAMEPAD_DEADZONE ,
WIDX_GAMEPAD_SENSITIVITY_LABEL ,
WIDX_GAMEPAD_SENSITIVITY ,
2024-09-04 21:11:26 +02:00
// Misc
WIDX_TITLE_SEQUENCE_GROUP = WIDX_PAGE_START ,
WIDX_TITLE_SEQUENCE ,
WIDX_TITLE_SEQUENCE_DROPDOWN ,
2025-06-24 12:53:26 +02:00
WIDX_SCENARIO_OPTIONS_GROUP ,
2025-05-21 18:07:19 +02:00
WIDX_SCENARIO_PREVIEWS_LABEL ,
WIDX_SCENARIO_PREVIEWS ,
WIDX_SCENARIO_PREVIEWS_DROPDOWN ,
2024-09-04 21:11:26 +02:00
WIDX_SCENARIO_UNLOCKING ,
WIDX_ALLOW_EARLY_COMPLETION ,
WIDX_TWEAKS_GROUP ,
2024-09-15 22:18:00 +02:00
WIDX_REAL_NAMES_GUESTS_CHECKBOX ,
WIDX_REAL_NAMES_STAFF_CHECKBOX ,
2024-09-04 21:11:26 +02:00
WIDX_AUTO_STAFF_PLACEMENT ,
WIDX_AUTO_OPEN_SHOPS ,
WIDX_DEFAULT_INSPECTION_INTERVAL_LABEL ,
WIDX_DEFAULT_INSPECTION_INTERVAL ,
WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN ,
2017-12-10 16:27:40 +01:00
2024-09-04 21:11:26 +02:00
// Advanced
2025-05-04 15:30:49 +02:00
WIDX_GROUP_RCT1_PATH = WIDX_PAGE_START ,
WIDX_PATH_TO_RCT1_LABEL ,
WIDX_PATH_TO_RCT1_PATH ,
WIDX_PATH_TO_RCT1_BROWSE ,
WIDX_PATH_TO_RCT1_CLEAR ,
WIDX_GROUP_SAVING ,
WIDX_EXPORT_CUSTOM_OBJECTS_CHECKBOX ,
2024-09-04 21:11:26 +02:00
WIDX_ALWAYS_NATIVE_LOADSAVE ,
WIDX_AUTOSAVE_FREQUENCY_LABEL ,
WIDX_AUTOSAVE_FREQUENCY ,
WIDX_AUTOSAVE_FREQUENCY_DROPDOWN ,
WIDX_AUTOSAVE_AMOUNT_LABEL ,
WIDX_AUTOSAVE_AMOUNT ,
WIDX_AUTOSAVE_AMOUNT_UP ,
WIDX_AUTOSAVE_AMOUNT_DOWN ,
2025-05-04 15:30:49 +02:00
WIDX_GROUP_ADVANCED ,
WIDX_DEBUGGING_TOOLS ,
WIDX_STAY_CONNECTED_AFTER_DESYNC ,
2024-12-31 09:31:33 -06:00
#ifdef __EMSCRIPTEN__
WIDX_EXPORT_EMSCRIPTEN_DATA ,
WIDX_IMPORT_EMSCRIPTEN_DATA ,
#endif
2025-05-04 15:30:49 +02:00
WIDX_ASSET_PACKS ,
2024-09-04 21:11:26 +02:00
};
2014-05-11 09:01:01 +02:00
2024-09-04 21:11:26 +02:00
// clang-format off
2025-06-16 23:10:47 +02:00
static constexpr StringId kWindowTitle = STR_OPTIONS_TITLE ;
static constexpr ScreenSize kWindowSize = { 310 , 332 };
2014-07-24 16:57:02 +02:00
2025-06-07 23:02:14 +02:00
static constexpr auto kMainOptionsWidgets = makeWidgets (
2025-06-16 23:10:47 +02:00
makeWindowShim ( kWindowTitle , kWindowSize ),
makeWidget ({ 0 , 43 }, { kWindowSize . width , 289 }, WidgetType :: resize , WindowColour :: secondary ),
makeTab ({ 3 , 17 }, STR_OPTIONS_DISPLAY_TIP ),
makeTab ({ 34 , 17 }, STR_OPTIONS_RENDERING_TIP ),
makeTab ({ 65 , 17 }, STR_OPTIONS_CULTURE_TIP ),
makeTab ({ 96 , 17 }, STR_OPTIONS_AUDIO_TIP ),
makeTab ({ 127 , 17 }, STR_OPTIONS_INTERFACE_TIP ),
makeTab ({ 158 , 17 }, STR_OPTIONS_CONTROLS_TIP ),
makeTab ({ 189 , 17 }, STR_OPTIONS_MISCELLANEOUS_TIP ),
makeTab ({ 220 , 17 }, STR_OPTIONS_ADVANCED )
2025-06-07 23:02:14 +02:00
);
2014-08-16 15:29:15 +01:00
2025-06-07 23:02:14 +02:00
static constexpr auto window_options_display_widgets = makeWidgets (
kMainOptionsWidgets ,
2026-03-05 22:17:37 +01:00
makeWidget ({ 5 , 53 }, { 300 , 70 }, WidgetType :: groupbox , WindowColour :: secondary , STR_GROUP_WINDOW ), // Window group
makeWidget ({ 10 , 69 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_FULLSCREEN_MODE , STR_FULLSCREEN_MODE_TIP ), // Fullscreen
makeWidget ({ 155 , 68 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ),
makeWidget ({ 288 , 69 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_FULLSCREEN_MODE_TIP ),
makeWidget ({ 24 , 86 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_DISPLAY_RESOLUTION , STR_DISPLAY_RESOLUTION_TIP ), // Resolution
2026-03-16 14:01:38 +01:00
makeWidget ({ 155 , 85 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary , kStringIdEmpty ),
2026-03-05 22:17:37 +01:00
makeWidget ({ 288 , 86 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_DISPLAY_RESOLUTION_TIP ),
makeWidget ({ 10 , 102 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_UI_SCALING_DESC , STR_WINDOW_SCALE_TIP ), // Scale
makeSpinnerWidgets ({ 155 , 102 }, { 145 , 14 }, WidgetType :: spinner , WindowColour :: secondary , kStringIdNone , STR_WINDOW_SCALE_TIP ), // Scale spinner (3 widgets)
2025-05-15 22:40:04 +02:00
2026-03-05 22:17:37 +01:00
makeWidget ({ 5 , 129 }, { 300 , 68 }, WidgetType :: groupbox , WindowColour :: secondary , STR_GROUP_RENDERING ), // Rendering group
makeWidget ({ 10 , 146 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_DRAWING_ENGINE , STR_DRAWING_ENGINE_TIP ), // Drawing engine (label)
makeWidget ({ 155 , 145 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ), // Drawing engine (dropdown label)
makeWidget ({ 288 , 146 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_DRAWING_ENGINE_TIP ), // Drawing engine (chevron)
makeWidget ({ 10 , 161 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_FRAME_RATE_LIMIT_LABEL ), // Frame rate limit (label)
makeWidget ({ 155 , 160 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ), // Frame rate limit (dropdown label)
makeWidget ({ 288 , 161 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH ), // Frame rate limit (chevron)
makeWidget ({ 11 , 178 }, { 136 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_SHOW_FPS , STR_SHOW_FPS_TIP ), // Show fps
makeWidget ({ 155 , 178 }, { 136 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_MULTITHREADING , STR_MULTITHREADING_TIP ), // Multithreading
2025-05-15 22:40:04 +02:00
2026-03-05 22:17:37 +01:00
makeWidget ({ 5 , 200 }, { 300 , 49 }, WidgetType :: groupbox , WindowColour :: secondary , STR_GROUP_BEHAVIOUR ), // Behaviour group
makeWidget ({ 11 , 215 }, { 280 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS , STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS_TIP ), // Minimise fullscreen focus loss
makeWidget ({ 11 , 230 }, { 280 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_DISABLE_SCREENSAVER , STR_DISABLE_SCREENSAVER_TIP ) // Disable screensaver
2025-06-07 23:02:14 +02:00
);
2015-07-26 14:37:27 +02:00
2024-09-04 21:11:26 +02:00
constexpr int32_t kFrameRenderingStart = 53 ;
2026-03-05 22:17:37 +01:00
constexpr int32_t kFrameEffectStart = 165 ;
2024-05-18 06:37:42 -04:00
2025-06-07 23:02:14 +02:00
static constexpr auto window_options_rendering_widgets = makeWidgets (
kMainOptionsWidgets ,
2026-03-05 22:17:37 +01:00
makeWidget ({ 5 , kFrameRenderingStart + 0 }, { 300 , 110 }, WidgetType :: groupbox , WindowColour :: secondary , STR_RENDERING_GROUP ), // Rendering group
2025-06-10 19:55:12 +02:00
makeWidget ({ 10 , kFrameRenderingStart + 15 }, { 281 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_SMOOTHING , STR_TILE_SMOOTHING_TIP ), // Landscape smoothing
makeWidget ({ 10 , kFrameRenderingStart + 30 }, { 281 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_GRIDLINES , STR_GRIDLINES_TIP ), // Gridlines
makeWidget ({ 10 , kFrameRenderingStart + 45 }, { 281 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_UPPERCASE_BANNERS , STR_UPPERCASE_BANNERS_TIP ), // Uppercase banners
makeWidget ({ 10 , kFrameRenderingStart + 60 }, { 281 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_SHOW_GUEST_PURCHASES , STR_SHOW_GUEST_PURCHASES_TIP ), // Guest purchases
makeWidget ({ 10 , kFrameRenderingStart + 75 }, { 281 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_TRANSPARENT_SCREENSHOT , STR_TRANSPARENT_SCREENSHOT_TIP ), // Transparent screenshot
2026-03-05 22:17:37 +01:00
makeWidget ({ 10 , kFrameRenderingStart + 91 }, { 281 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_VIRTUAL_FLOOR_STYLE , STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor
makeWidget ({ 155 , kFrameRenderingStart + 90 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary , kStringIdNone , STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor dropdown
makeWidget ({ 288 , kFrameRenderingStart + 91 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor dropdown
2024-05-18 06:37:42 -04:00
2025-06-10 19:55:12 +02:00
makeWidget ({ 5 , kFrameEffectStart + 0 }, { 300 , 94 }, WidgetType :: groupbox , WindowColour :: secondary , STR_EFFECTS_GROUP ), // Rendering group
makeWidget ({ 10 , kFrameEffectStart + 15 }, { 281 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_CYCLE_DAY_NIGHT , STR_CYCLE_DAY_NIGHT_TIP ), // Cycle day-night
makeWidget ({ 25 , kFrameEffectStart + 30 }, { 266 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_ENABLE_LIGHTING_EFFECTS , STR_ENABLE_LIGHTING_EFFECTS_TIP ), // Enable light fx
makeWidget ({ 40 , kFrameEffectStart + 45 }, { 251 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_ENABLE_LIGHTING_VEHICLES , STR_ENABLE_LIGHTING_VEHICLES_TIP ), // Enable light fx for vehicles
makeWidget ({ 10 , kFrameEffectStart + 60 }, { 281 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_RENDER_WEATHER_EFFECTS , STR_RENDER_WEATHER_EFFECTS_TIP ), // Render weather effects
makeWidget ({ 25 , kFrameEffectStart + 75 }, { 266 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_DISABLE_LIGHTNING_EFFECT , STR_DISABLE_LIGHTNING_EFFECT_TIP ) // Disable lightning effect
2025-06-07 23:02:14 +02:00
);
2014-08-16 15:29:15 +01:00
2025-06-07 23:02:14 +02:00
static constexpr auto window_options_culture_widgets = makeWidgets (
kMainOptionsWidgets ,
2026-03-05 22:17:37 +01:00
makeWidget ({ 10 , 54 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_OPTIONS_LANGUAGE , STR_LANGUAGE_TIP ), // language
2026-03-16 14:01:38 +01:00
makeWidget ({ 155 , 53 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary , kStringIdEmpty ),
2026-03-05 22:17:37 +01:00
makeWidget ({ 288 , 54 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_LANGUAGE_TIP ),
makeWidget ({ 10 , 71 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_CURRENCY , STR_CURRENCY_TIP ), // Currency
makeWidget ({ 155 , 70 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ),
makeWidget ({ 288 , 71 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_CURRENCY_TIP ),
makeWidget ({ 10 , 88 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_DISTANCE_AND_SPEED , STR_DISTANCE_AND_SPEED_TIP ), // Distance and speed
makeWidget ({ 155 , 87 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ),
makeWidget ({ 288 , 88 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_DISTANCE_AND_SPEED_TIP ),
makeWidget ({ 10 , 105 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_TEMPERATURE , STR_TEMPERATURE_FORMAT_TIP ), // Temperature
makeWidget ({ 155 , 104 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ),
makeWidget ({ 288 , 105 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_TEMPERATURE_FORMAT_TIP ),
makeWidget ({ 10 , 122 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_HEIGHT_LABELS , STR_HEIGHT_LABELS_UNITS_TIP ), // Height labels
makeWidget ({ 155 , 121 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ),
makeWidget ({ 288 , 122 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_HEIGHT_LABELS_UNITS_TIP ),
makeWidget ({ 10 , 139 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_DATE_FORMAT , STR_DATE_FORMAT_TIP ), // Date format
makeWidget ({ 155 , 138 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ),
makeWidget ({ 288 , 139 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_DATE_FORMAT_TIP )
2025-06-07 23:02:14 +02:00
);
2014-05-11 09:01:01 +02:00
2025-06-07 23:02:14 +02:00
static constexpr auto window_options_audio_widgets = makeWidgets (
kMainOptionsWidgets ,
2026-03-05 22:17:37 +01:00
makeWidget ({ 10 , 53 }, { 290 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ), // Audio device
makeWidget ({ 288 , 54 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_AUDIO_DEVICE_TIP ),
makeWidget ({ 10 , 71 }, { 220 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_MASTER_VOLUME , STR_MASTER_VOLUME_TIP ), // Enable / disable master sound
makeWidget ({ 10 , 86 }, { 220 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_SOUND_EFFECTS , STR_SOUND_EFFECTS_TIP ), // Enable / disable sound effects
makeWidget ({ 10 , 101 }, { 220 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_RIDE_MUSIC , STR_RIDE_MUSIC_TIP ), // Enable / disable ride music
makeWidget ({ 10 , 115 }, { 290 , 13 }, WidgetType :: checkbox , WindowColour :: secondary , STR_AUDIO_FOCUS , STR_AUDIO_FOCUS_TIP ), // Enable / disable audio disabled on focus lost
makeWidget ({ 10 , 130 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_OPTIONS_MUSIC_LABEL , STR_TITLE_MUSIC_TIP ), // Title music label
makeWidget ({ 155 , 129 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ), // Title music
makeWidget ({ 288 , 130 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_TITLE_MUSIC_TIP ),
makeWidget ({ 155 , 72 }, { 145 , 13 }, WidgetType :: scroll , WindowColour :: secondary , SCROLL_HORIZONTAL ), // Master volume
makeWidget ({ 155 , 87 }, { 145 , 13 }, WidgetType :: scroll , WindowColour :: secondary , SCROLL_HORIZONTAL ), // Sound effect volume
makeWidget ({ 155 , 102 }, { 145 , 13 }, WidgetType :: scroll , WindowColour :: secondary , SCROLL_HORIZONTAL ) // Music volume
2025-06-07 23:02:14 +02:00
);
2015-06-04 14:51:54 -04:00
2024-09-04 21:11:26 +02:00
constexpr int32_t kControlsGroupStart = 53 ;
2026-03-05 22:17:37 +01:00
constexpr int32_t kGamepadGroupStart = kControlsGroupStart + 142 ;
2024-05-18 06:37:42 -04:00
2025-06-07 23:02:14 +02:00
static constexpr auto window_options_controls_widgets = makeWidgets (
kMainOptionsWidgets ,
2026-03-05 22:17:37 +01:00
makeWidget ({ 5 , kControlsGroupStart + 0 }, { 300 , 139 }, WidgetType :: groupbox , WindowColour :: secondary , STR_CONTROLS_GROUP ), // Controls group
makeWidget ({ 10 , kControlsGroupStart + 13 }, { 290 , 14 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_SCREEN_EDGE_SCROLLING , STR_SCREEN_EDGE_SCROLLING_TIP ), // Edge scrolling
makeWidget ({ 10 , kControlsGroupStart + 30 }, { 290 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_TRAP_MOUSE , STR_TRAP_MOUSE_TIP ), // Trap mouse
makeWidget ({ 10 , kControlsGroupStart + 45 }, { 290 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_INVERT_RIGHT_MOUSE_DRAG , STR_INVERT_RIGHT_MOUSE_DRAG_TIP ), // Invert right mouse dragging
makeWidget ({ 10 , kControlsGroupStart + 60 }, { 290 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_ZOOM_TO_CURSOR , STR_ZOOM_TO_CURSOR_TIP ), // Zoom to cursor
2025-06-10 19:55:12 +02:00
makeWidget ({ 10 , kControlsGroupStart + 75 }, { 290 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_WINDOW_BUTTONS_ON_THE_LEFT , STR_WINDOW_BUTTONS_ON_THE_LEFT_TIP ), // Window buttons on the left
makeWidget ({ 10 , kControlsGroupStart + 90 }, { 290 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_ENLARGED_UI , STR_ENLARGED_UI_TIP ),
makeWidget ({ 25 , kControlsGroupStart + 105 }, { 275 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_TOUCH_ENHANCEMENTS , STR_TOUCH_ENHANCEMENTS_TIP ),
2026-03-05 22:17:37 +01:00
makeWidget ({ 155 , kControlsGroupStart + 120 }, { 144 , 13 }, WidgetType :: button , WindowColour :: secondary , STR_HOTKEY , STR_HOTKEY_TIP ), // Set hotkeys buttons
2025-07-03 22:48:59 +02:00
// Gamepad group
2026-03-05 22:17:37 +01:00
makeWidget ({ 5 , kGamepadGroupStart + 0 }, { 300 , 46 }, WidgetType :: groupbox , WindowColour :: secondary , STR_GAMEPAD_GROUP ), // Gamepad group
2025-07-03 22:48:59 +02:00
makeWidget ({ 10 , kGamepadGroupStart + 13 }, { 90 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_GAMEPAD_DEADZONE_LABEL , STR_GAMEPAD_DEADZONE_TIP ), // Deadzone label
makeWidget ({ 105 , kGamepadGroupStart + 13 }, { 190 , 13 }, WidgetType :: scroll , WindowColour :: secondary , SCROLL_HORIZONTAL , STR_GAMEPAD_DEADZONE_TOOLTIP_FORMAT ), // Deadzone slider
makeWidget ({ 10 , kGamepadGroupStart + 28 }, { 90 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_GAMEPAD_SENSITIVITY_LABEL , STR_GAMEPAD_SENSITIVITY_TIP ), // Sensitivity label
makeWidget ({ 105 , kGamepadGroupStart + 28 }, { 190 , 13 }, WidgetType :: scroll , WindowColour :: secondary , SCROLL_HORIZONTAL , STR_GAMEPAD_SENSITIVITY_TOOLTIP_FORMAT ) // Sensitivity slider
2025-06-07 23:02:14 +02:00
);
2024-05-08 21:19:57 +02:00
2025-04-18 16:40:38 +02:00
constexpr int32_t kThemesGroupStart = 53 ;
2026-03-05 22:17:37 +01:00
constexpr int32_t kToolbarGroupStart = kThemesGroupStart + 53 ;
2025-04-18 16:40:38 +02:00
2025-06-07 23:02:14 +02:00
static constexpr auto window_options_interface_widgets = makeWidgets (
kMainOptionsWidgets ,
2026-03-05 22:17:37 +01:00
makeWidget ({ 5 , kThemesGroupStart + 0 }, { 300 , 50 }, WidgetType :: groupbox , WindowColour :: secondary , STR_THEMES_GROUP ), // Themes group
2025-06-10 19:55:12 +02:00
makeWidget ({ 10 , kThemesGroupStart + 14 }, { 145 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_THEMES_LABEL_CURRENT_THEME , STR_CURRENT_THEME_TIP ), // Themes
2026-03-16 14:01:38 +01:00
makeWidget ({ 155 , kThemesGroupStart + 14 }, { 145 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary , kStringIdEmpty ),
2026-03-05 22:17:37 +01:00
makeWidget ({ 288 , kThemesGroupStart + 15 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_CURRENT_THEME_TIP ),
makeWidget ({ 155 , kThemesGroupStart + 30 }, { 145 , 14 }, WidgetType :: button , WindowColour :: secondary , STR_EDIT_THEMES_BUTTON , STR_EDIT_THEMES_BUTTON_TIP ), // Themes button
2024-05-08 21:19:57 +02:00
2025-06-10 19:55:12 +02:00
makeWidget ({ 5 , kToolbarGroupStart + 0 }, { 300 , 107 }, WidgetType :: groupbox , WindowColour :: secondary , STR_TOOLBAR_BUTTONS_GROUP ), // Toolbar buttons group
makeWidget ({ 10 , kToolbarGroupStart + 14 }, { 280 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_OPTIONS_TOOLBAR_BUTTONS_CENTRED , STR_OPTIONS_TOOLBAR_BUTTONS_CENTRED_TIP ),
makeWidget ({ 10 , kToolbarGroupStart + 31 }, { 280 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_SHOW_TOOLBAR_BUTTONS_FOR ),
makeWidget ({ 24 , kToolbarGroupStart + 46 }, { 122 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_FINANCES_BUTTON_ON_TOOLBAR , STR_FINANCES_BUTTON_ON_TOOLBAR_TIP ), // Finances
makeWidget ({ 24 , kToolbarGroupStart + 61 }, { 122 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_RESEARCH_BUTTON_ON_TOOLBAR , STR_RESEARCH_BUTTON_ON_TOOLBAR_TIP ), // Research
makeWidget ({ 155 , kToolbarGroupStart + 46 }, { 145 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_CHEATS_BUTTON_ON_TOOLBAR , STR_CHEATS_BUTTON_ON_TOOLBAR_TIP ), // Cheats
makeWidget ({ 155 , kToolbarGroupStart + 61 }, { 145 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR , STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR_TIP ), // Recent messages
makeWidget ({ 24 , kToolbarGroupStart + 76 }, { 162 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_MUTE_BUTTON_ON_TOOLBAR , STR_MUTE_BUTTON_ON_TOOLBAR_TIP ), // Mute
makeWidget ({ 155 , kToolbarGroupStart + 76 }, { 145 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_CHAT_BUTTON_ON_TOOLBAR , STR_CHAT_BUTTON_ON_TOOLBAR_TIP ), // Chat
makeWidget ({ 24 , kToolbarGroupStart + 91 }, { 122 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_ZOOM_BUTTON_ON_TOOLBAR , STR_ZOOM_BUTTON_ON_TOOLBAR_TIP ), // Zoom
makeWidget ({ 155 , kToolbarGroupStart + 91 }, { 145 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_ROTATE_ANTI_CLOCKWISE , STR_ROTATE_VIEW_ANTI_CLOCKWISE_IN_TOOLBAR_TIP ) // Rotate anti-clockwise
2025-06-07 23:02:14 +02:00
);
2015-06-04 14:51:54 -04:00
2024-09-04 21:11:26 +02:00
constexpr int32_t kTitleSequenceStart = 53 ;
2026-03-05 22:17:37 +01:00
constexpr int32_t kScenarioOptionsGroupStart = kTitleSequenceStart + 39 ;
constexpr int32_t kTweaksStart = kScenarioOptionsGroupStart + 72 ;
2022-04-05 23:06:47 +01:00
2025-06-07 23:02:14 +02:00
static constexpr auto window_options_misc_widgets = makeWidgets (
kMainOptionsWidgets ,
2026-03-05 22:17:37 +01:00
makeWidget ( { 5 , kTitleSequenceStart + 0 }, { 300 , 35 }, WidgetType :: groupbox , WindowColour :: secondary , STR_OPTIONS_TITLE_SEQUENCE ),
2026-03-16 14:01:38 +01:00
makeDropdownWidgets ({ 10 , kTitleSequenceStart + 15 }, { 290 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary , kStringIdEmpty , STR_TITLE_SEQUENCE_TIP ), // Title sequence dropdown
2022-04-05 23:06:47 +01:00
2025-06-24 12:53:26 +02:00
makeWidget ({ 5 , kScenarioOptionsGroupStart + 0 }, { 300 , 66 }, WidgetType :: groupbox , WindowColour :: secondary , STR_SCENARIO_OPTIONS ),
makeWidget ({ 10 , kScenarioOptionsGroupStart + 16 }, { 165 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_SCENARIO_PREVIEWS_LABEL , STR_SCENARIO_PREVIEWS_TIP ),
2026-03-05 22:17:37 +01:00
makeWidget ({ 175 , kScenarioOptionsGroupStart + 15 }, { 125 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ), // Scenario previews
makeWidget ({ 288 , kScenarioOptionsGroupStart + 16 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_SCENARIO_PREVIEWS_TIP ),
makeWidget ({ 10 , kScenarioOptionsGroupStart + 32 }, { 275 , 16 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_OPTIONS_SCENARIO_UNLOCKING , STR_SCENARIO_UNLOCKING_TIP ), // Unlocking of scenarios
makeWidget ({ 10 , kScenarioOptionsGroupStart + 47 }, { 290 , 15 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_ALLOW_EARLY_COMPLETION , STR_EARLY_COMPLETION_TIP ), // Allow early scenario completion
2022-04-05 23:06:47 +01:00
2025-06-10 19:55:12 +02:00
makeWidget ({ 5 , kTweaksStart + 0 }, { 300 , 96 }, WidgetType :: groupbox , WindowColour :: secondary , STR_OPTIONS_TWEAKS ),
makeWidget ({ 10 , kTweaksStart + 15 }, { 290 , 15 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_REAL_NAME_GUESTS , STR_REAL_NAME_GUESTS_TIP ), // Show 'real' names of guests
makeWidget ({ 10 , kTweaksStart + 30 }, { 290 , 15 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_REAL_NAME_STAFF , STR_REAL_NAME_STAFF_TIP ), // Show 'real' names of staff
makeWidget ({ 10 , kTweaksStart + 45 }, { 290 , 15 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_AUTO_STAFF_PLACEMENT , STR_AUTO_STAFF_PLACEMENT_TIP ), // Auto staff placement
makeWidget ({ 10 , kTweaksStart + 60 }, { 290 , 15 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_AUTO_OPEN_SHOPS , STR_AUTO_OPEN_SHOPS_TIP ), // Automatically open shops & stalls
makeWidget ({ 10 , kTweaksStart + 77 }, { 165 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_DEFAULT_INSPECTION_INTERVAL , STR_DEFAULT_INSPECTION_INTERVAL_TIP ),
2026-03-05 22:17:37 +01:00
makeWidget ({ 175 , kTweaksStart + 76 }, { 125 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ), // Default inspection time dropdown
makeWidget ({ 288 , kTweaksStart + 77 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_DEFAULT_INSPECTION_INTERVAL_TIP ) // Default inspection time dropdown button
2025-06-07 23:02:14 +02:00
);
2017-12-10 16:27:40 +01:00
2025-05-04 15:30:49 +02:00
constexpr int32_t kRCT1Start = 53 ;
constexpr int32_t kSavingStart = kRCT1Start + 54 ;
constexpr int32_t kAdvancedStart = kSavingStart + 84 ;
2025-06-07 23:02:14 +02:00
static constexpr auto window_options_advanced_widgets = makeWidgets (
kMainOptionsWidgets ,
2025-06-10 19:55:12 +02:00
makeWidget ({ 5 , kRCT1Start + 0 }, { 300 , 50 }, WidgetType :: groupbox , WindowColour :: secondary , STR_GROUP_RCT1 ),
makeWidget ({ 10 , kRCT1Start + 16 }, { 276 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_PATH_TO_RCT1 , STR_PATH_TO_RCT1_TIP ), // RCT 1 path label
makeWidget ({ 10 , kRCT1Start + 30 }, { 290 , 14 }, WidgetType :: label , WindowColour :: secondary , kStringIdNone , STR_STRING_TOOLTIP ), // RCT 1 path path
makeWidget ({ 239 , kRCT1Start + 15 }, { 60 , 14 }, WidgetType :: button , WindowColour :: secondary , STR_BROWSE ), // RCT 1 path browse
makeWidget ({ 249 , kRCT1Start + 15 }, { 50 , 14 }, WidgetType :: button , WindowColour :: secondary , STR_CLEAR_BUTTON , STR_PATH_TO_RCT1_CLEAR_TIP ), // RCT 1 path clear
2025-05-04 15:30:49 +02:00
2026-03-05 22:17:37 +01:00
makeWidget ({ 5 , kSavingStart + 0 }, { 300 , 82 }, WidgetType :: groupbox , WindowColour :: secondary , STR_GROUP_SAVING ),
2025-06-10 19:55:12 +02:00
makeWidget ({ 10 , kSavingStart + 16 }, { 290 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_SAVE_PLUGIN_DATA , STR_SAVE_PLUGIN_DATA_TIP ), // Export plug-in objects with saved games
makeWidget ({ 10 , kSavingStart + 30 }, { 290 , 12 }, WidgetType :: checkbox , WindowColour :: secondary , STR_ALWAYS_NATIVE_LOADSAVE , STR_ALWAYS_NATIVE_LOADSAVE_TIP ), // Use native load/save window
makeWidget ({ 23 , kSavingStart + 46 }, { 135 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_OPTIONS_AUTOSAVE_FREQUENCY_LABEL , STR_AUTOSAVE_FREQUENCY_TIP ),
2026-03-05 22:17:37 +01:00
makeWidget ({ 165 , kSavingStart + 45 }, { 135 , 14 }, WidgetType :: dropdownMenu , WindowColour :: secondary ), // Autosave dropdown
makeWidget ({ 288 , kSavingStart + 46 }, { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH , STR_AUTOSAVE_FREQUENCY_TIP ), // Autosave dropdown button
makeWidget ({ 23 , kSavingStart + 63 }, { 135 , 12 }, WidgetType :: label , WindowColour :: secondary , STR_AUTOSAVE_AMOUNT , STR_AUTOSAVE_AMOUNT_TIP ),
makeSpinnerWidgets ({ 165 , kSavingStart + 62 }, { 135 , 14 }, WidgetType :: spinner , WindowColour :: secondary , kStringIdNone , STR_AUTOSAVE_AMOUNT_TIP ), // Autosave amount spinner
2025-05-04 15:30:49 +02:00
2025-06-10 19:55:12 +02:00
makeWidget ({ 5 , kAdvancedStart + 0 }, { 300 , 97 }, WidgetType :: groupbox , WindowColour :: secondary , STR_GROUP_ADVANCED ),
makeWidget ({ 10 , kAdvancedStart + 16 }, { 295 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_ENABLE_DEBUGGING_TOOLS , STR_ENABLE_DEBUGGING_TOOLS_TIP ), // Enable debugging tools
makeWidget ({ 10 , kAdvancedStart + 30 }, { 295 , 12 }, WidgetType :: checkbox , WindowColour :: tertiary , STR_STAY_CONNECTED_AFTER_DESYNC , STR_STAY_CONNECTED_AFTER_DESYNC_TIP ), // Do not disconnect after the client desynchronises with the server
2024-12-31 09:31:33 -06:00
#ifdef __EMSCRIPTEN__
2025-06-10 19:55:12 +02:00
makeWidget ({ 10 , kAdvancedStart + 46 }, { 135 , 14 }, WidgetType :: button , WindowColour :: secondary , STR_EXPORT_EMSCRIPTEN , kStringIdNone ), // Emscripten data export
makeWidget ({ 150 , kAdvancedStart + 46 }, { 150 , 14 }, WidgetType :: button , WindowColour :: secondary , STR_IMPORT_EMSCRIPTEN , kStringIdNone ), // Emscripten data import
2024-12-31 09:31:33 -06:00
#endif
2025-06-10 19:55:12 +02:00
makeWidget ({ 150 , kAdvancedStart + 64 }, { 150 , 14 }, WidgetType :: button , WindowColour :: secondary , STR_EDIT_ASSET_PACKS_BUTTON , kStringIdNone ) // Asset packs
2025-06-07 23:02:14 +02:00
);
2015-06-04 14:51:54 -04:00
2025-01-18 14:45:17 +02:00
static constexpr std :: span < const Widget > window_options_page_widgets [] = {
2024-09-04 21:11:26 +02:00
window_options_display_widgets ,
window_options_rendering_widgets ,
window_options_culture_widgets ,
window_options_audio_widgets ,
2025-04-18 16:40:38 +02:00
window_options_interface_widgets ,
window_options_controls_widgets ,
2024-09-04 21:11:26 +02:00
window_options_misc_widgets ,
window_options_advanced_widgets ,
};
// clang-format on
2015-06-04 14:51:54 -04:00
2025-05-01 14:59:34 +03:00
static constexpr StringId kDrawingEngineStringIds [] = {
STR_DRAWING_ENGINE_SOFTWARE ,
2025-04-30 18:04:06 +03:00
#ifndef DISABLE_OPENGL
2025-05-01 14:59:34 +03:00
STR_DRAWING_ENGINE_OPENGL ,
2025-04-30 18:04:06 +03:00
#endif
};
2015-06-04 14:51:54 -04:00
#pragma endregion
2024-03-10 13:52:35 +00:00
class OptionsWindow final : public Window
2018-06-22 23:21:44 +02:00
{
2026-03-16 14:01:38 +01:00
u8string _dropdownCaption {};
2024-03-10 13:52:35 +00:00
public :
2025-09-17 20:10:06 +02:00
void onOpen () override
2024-03-10 13:52:35 +00:00
{
2025-09-17 20:10:06 +02:00
setPage ( WINDOW_OPTIONS_PAGE_DISPLAY );
2024-03-10 13:52:35 +00:00
}
2014-05-11 09:01:01 +02:00
2025-09-17 20:10:06 +02:00
void onMouseUp ( WidgetIndex widgetIndex ) override
2024-03-10 13:52:35 +00:00
{
if ( widgetIndex < WIDX_PAGE_START )
CommonMouseUp ( widgetIndex );
else
{
switch ( page )
{
case WINDOW_OPTIONS_PAGE_DISPLAY :
DisplayMouseUp ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_RENDERING :
RenderingMouseUp ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_AUDIO :
AudioMouseUp ( widgetIndex );
break ;
2025-04-18 16:40:38 +02:00
case WINDOW_OPTIONS_PAGE_CONTROLS :
2024-03-10 13:52:35 +00:00
ControlsMouseUp ( widgetIndex );
break ;
2025-04-18 16:40:38 +02:00
case WINDOW_OPTIONS_PAGE_INTERFACE :
InterfaceMouseUp ( widgetIndex );
break ;
2024-03-10 13:52:35 +00:00
case WINDOW_OPTIONS_PAGE_MISC :
MiscMouseUp ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_ADVANCED :
AdvancedMouseUp ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_CULTURE :
default :
break ;
}
}
}
2025-09-17 20:10:06 +02:00
void onMouseDown ( WidgetIndex widgetIndex ) override
2020-10-04 17:08:10 +02:00
{
2021-10-15 11:41:30 +02:00
switch ( page )
2020-10-04 17:08:10 +02:00
{
2021-10-15 11:41:30 +02:00
case WINDOW_OPTIONS_PAGE_DISPLAY :
2024-03-10 13:52:35 +00:00
DisplayMouseDown ( widgetIndex );
2021-10-15 11:41:30 +02:00
break ;
case WINDOW_OPTIONS_PAGE_RENDERING :
2024-03-10 13:52:35 +00:00
RenderingMouseDown ( widgetIndex );
2021-10-15 11:41:30 +02:00
break ;
case WINDOW_OPTIONS_PAGE_CULTURE :
2024-03-10 13:52:35 +00:00
CultureMouseDown ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_AUDIO :
AudioMouseDown ( widgetIndex );
break ;
2025-04-18 16:40:38 +02:00
case WINDOW_OPTIONS_PAGE_INTERFACE :
InterfaceMouseDown ( widgetIndex );
2024-03-10 13:52:35 +00:00
break ;
case WINDOW_OPTIONS_PAGE_MISC :
MiscMouseDown ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_ADVANCED :
AdvancedMouseDown ( widgetIndex );
break ;
2021-10-15 11:41:30 +02:00
default :
break ;
}
}
2020-10-04 17:08:10 +02:00
2025-09-17 20:10:06 +02:00
void onDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex ) override
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
if ( dropdownIndex == - 1 )
return ;
2020-10-04 17:08:10 +02:00
2024-03-10 13:52:35 +00:00
switch ( page )
{
case WINDOW_OPTIONS_PAGE_DISPLAY :
DisplayDropdown ( widgetIndex , dropdownIndex );
break ;
case WINDOW_OPTIONS_PAGE_RENDERING :
RenderingDropdown ( widgetIndex , dropdownIndex );
break ;
case WINDOW_OPTIONS_PAGE_CULTURE :
CultureDropdown ( widgetIndex , dropdownIndex );
break ;
case WINDOW_OPTIONS_PAGE_AUDIO :
AudioDropdown ( widgetIndex , dropdownIndex );
break ;
2025-04-18 16:40:38 +02:00
case WINDOW_OPTIONS_PAGE_INTERFACE :
InterfaceDropdown ( widgetIndex , dropdownIndex );
2024-03-10 13:52:35 +00:00
break ;
case WINDOW_OPTIONS_PAGE_MISC :
MiscDropdown ( widgetIndex , dropdownIndex );
break ;
case WINDOW_OPTIONS_PAGE_ADVANCED :
AdvancedDropdown ( widgetIndex , dropdownIndex );
break ;
default :
break ;
}
2021-10-15 11:41:30 +02:00
}
2022-01-29 21:52:33 +00:00
2025-09-17 20:10:06 +02:00
void onPrepareDraw () override
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
CommonPrepareDrawBefore ();
switch ( page )
{
case WINDOW_OPTIONS_PAGE_DISPLAY :
DisplayPrepareDraw ();
break ;
case WINDOW_OPTIONS_PAGE_RENDERING :
RenderingPrepareDraw ();
break ;
case WINDOW_OPTIONS_PAGE_CULTURE :
CulturePrepareDraw ();
break ;
case WINDOW_OPTIONS_PAGE_AUDIO :
AudioPrepareDraw ();
break ;
2025-04-18 16:40:38 +02:00
case WINDOW_OPTIONS_PAGE_CONTROLS :
2024-03-10 13:52:35 +00:00
ControlsPrepareDraw ();
break ;
2025-04-18 16:40:38 +02:00
case WINDOW_OPTIONS_PAGE_INTERFACE :
InterfacePrepareDraw ();
break ;
2024-03-10 13:52:35 +00:00
case WINDOW_OPTIONS_PAGE_MISC :
MiscPrepareDraw ();
break ;
case WINDOW_OPTIONS_PAGE_ADVANCED :
AdvancedPrepareDraw ();
break ;
default :
break ;
}
CommonPrepareDrawAfter ();
2021-10-15 11:41:30 +02:00
}
2026-01-13 23:41:59 +01:00
void onDraw ( RenderTarget & rt ) override
2021-10-15 11:41:30 +02:00
{
2025-09-17 20:10:06 +02:00
drawWidgets ( rt );
2025-05-05 01:06:46 +03:00
DrawTabImages ( rt );
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
switch ( page )
{
case WINDOW_OPTIONS_PAGE_DISPLAY :
2025-05-05 01:06:46 +03:00
DisplayDraw ( rt );
2024-03-10 13:52:35 +00:00
break ;
case WINDOW_OPTIONS_PAGE_ADVANCED :
2025-05-05 01:06:46 +03:00
AdvancedDraw ( rt );
2024-03-10 13:52:35 +00:00
break ;
default :
break ;
}
}
2025-09-17 20:10:06 +02:00
void onUpdate () override
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
CommonUpdate ();
switch ( page )
{
case WINDOW_OPTIONS_PAGE_AUDIO :
AudioUpdate ();
break ;
2025-07-03 22:48:59 +02:00
case WINDOW_OPTIONS_PAGE_CONTROLS :
ControlsUpdate ();
break ;
2024-03-10 13:52:35 +00:00
case WINDOW_OPTIONS_PAGE_DISPLAY :
case WINDOW_OPTIONS_PAGE_RENDERING :
case WINDOW_OPTIONS_PAGE_CULTURE :
case WINDOW_OPTIONS_PAGE_MISC :
case WINDOW_OPTIONS_PAGE_ADVANCED :
default :
break ;
}
2021-10-15 11:41:30 +02:00
}
2025-09-17 20:10:06 +02:00
ScreenSize onScrollGetSize ( int32_t scrollIndex ) override
2024-03-10 13:52:35 +00:00
{
switch ( page )
{
case WINDOW_OPTIONS_PAGE_AUDIO :
return AudioScrollGetSize ( scrollIndex );
2025-07-03 22:48:59 +02:00
case WINDOW_OPTIONS_PAGE_CONTROLS :
return ControlsScrollGetSize ( scrollIndex );
2024-03-10 13:52:35 +00:00
case WINDOW_OPTIONS_PAGE_DISPLAY :
case WINDOW_OPTIONS_PAGE_RENDERING :
case WINDOW_OPTIONS_PAGE_CULTURE :
case WINDOW_OPTIONS_PAGE_MISC :
case WINDOW_OPTIONS_PAGE_ADVANCED :
default :
2025-06-16 23:10:47 +02:00
return kWindowSize ;
2024-03-10 13:52:35 +00:00
}
}
2022-01-29 21:52:33 +00:00
2026-03-01 07:46:37 -03:00
StringWithArgs onTooltip ( WidgetIndex widgetIndex , StringId fallback ) override
2024-03-10 13:52:35 +00:00
{
if ( page == WINDOW_OPTIONS_PAGE_ADVANCED )
return AdvancedTooltip ( widgetIndex , fallback );
2022-01-29 21:52:33 +00:00
2025-07-03 22:48:59 +02:00
if ( page == WINDOW_OPTIONS_PAGE_CONTROLS )
{
if ( widgetIndex == WIDX_GAMEPAD_DEADZONE )
{
const int32_t deadzone = Config :: Get (). general . gamepadDeadzone ;
const int32_t deadzonePercent = static_cast < int32_t > (( deadzone / 32767.0f ) * 100 );
auto ft = Formatter ();
ft . Add < int32_t > ( deadzonePercent );
return { STR_GAMEPAD_DEADZONE_TOOLTIP_FORMAT , ft };
}
else if ( widgetIndex == WIDX_GAMEPAD_SENSITIVITY )
{
const float sensitivity = Config :: Get (). general . gamepadSensitivity ;
const int32_t sensitivityDisplay = static_cast < int32_t > ( sensitivity * 100 );
auto ft = Formatter ();
ft . Add < int32_t > ( sensitivityDisplay );
return { STR_GAMEPAD_SENSITIVITY_TOOLTIP_FORMAT , ft };
}
}
2025-09-17 20:10:06 +02:00
return WindowBase :: onTooltip ( widgetIndex , fallback );
2024-03-10 13:52:35 +00:00
}
private :
2021-10-15 11:41:30 +02:00
#pragma region Common events
2024-03-10 13:52:35 +00:00
void CommonMouseUp ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
{
case WIDX_CLOSE :
2025-09-17 20:10:06 +02:00
close ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TAB_DISPLAY :
case WIDX_TAB_RENDERING :
case WIDX_TAB_CULTURE :
case WIDX_TAB_AUDIO :
2025-04-18 16:40:38 +02:00
case WIDX_TAB_CONTROLS :
case WIDX_TAB_INTERFACE :
2024-03-10 13:52:35 +00:00
case WIDX_TAB_MISC :
case WIDX_TAB_ADVANCED :
2025-09-17 20:10:06 +02:00
setPage ( widgetIndex - WIDX_FIRST_TAB );
2024-03-10 13:52:35 +00:00
break ;
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
void CommonPrepareDrawBefore ()
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
SetPressedTab ();
2021-10-15 11:41:30 +02:00
2025-09-17 19:03:29 +02:00
disabledWidgets = 0 ;
2026-01-16 04:38:20 -03:00
auto hasFilePicker = GetContext () -> GetUiContext (). HasFilePicker ();
2025-04-18 16:27:06 +02:00
const bool advancedTabSelected = ( WIDX_FIRST_TAB + page ) == WIDX_TAB_ADVANCED ;
if ( ! hasFilePicker && advancedTabSelected )
2024-03-10 13:52:35 +00:00
{
2025-09-17 19:03:29 +02:00
disabledWidgets |= ( 1uLL << WIDX_ALWAYS_NATIVE_LOADSAVE );
2025-06-10 19:55:12 +02:00
widgets [ WIDX_ALWAYS_NATIVE_LOADSAVE ]. type = WidgetType :: empty ;
2024-03-10 13:52:35 +00:00
}
}
void CommonPrepareDrawAfter ()
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
// Automatically adjust window height to fit widgets
int32_t y = 0 ;
2025-01-18 14:45:17 +02:00
for ( WidgetIndex widgetIdx = WIDX_PAGE_START ; widgetIdx < widgets . size (); widgetIdx ++ )
2024-03-10 13:52:35 +00:00
{
2025-01-18 14:45:17 +02:00
const auto & widget = widgets [ widgetIdx ];
y = std :: max < int32_t > ( y , widget . bottom );
2024-03-10 13:52:35 +00:00
}
2025-04-11 20:37:54 +02:00
y += 6 ;
2021-10-15 11:41:30 +02:00
2025-04-11 20:37:54 +02:00
if ( height != y )
{
2025-09-17 20:10:06 +02:00
invalidate ();
2025-04-11 20:37:54 +02:00
height = y ;
2025-09-17 20:10:06 +02:00
resizeFrame ();
invalidate ();
2025-04-11 20:37:54 +02:00
}
2021-10-15 11:41:30 +02:00
}
2023-05-19 10:17:38 +02:00
2024-03-10 13:52:35 +00:00
void CommonUpdate ()
{
// Tab animation
2025-09-17 19:03:29 +02:00
currentFrame ++ ;
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_FIRST_TAB + page );
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
#pragma endregion
#pragma region Display tab events
2024-03-10 13:52:35 +00:00
void DisplayMouseUp ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
case WIDX_SHOW_FPS_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . showFPS ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_MULTITHREADING_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . multiThreading ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_MINIMIZE_FOCUS_LOSS :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . minimizeFullscreenFocusLoss ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_DISABLE_SCREENSAVER_LOCK :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . disableScreensaver ^= 1 ;
2024-03-10 13:52:35 +00:00
ApplyScreenSaverLockSetting ();
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
2020-10-04 17:08:10 +02:00
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
void DisplayMouseDown ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
Widget * widget = & widgets [ widgetIndex - 1 ];
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
2020-10-04 17:08:10 +02:00
{
2024-03-10 13:52:35 +00:00
case WIDX_RESOLUTION_DROPDOWN :
2020-10-04 17:08:10 +02:00
{
2026-01-16 04:38:20 -03:00
const auto & resolutions = GetContext () -> GetUiContext (). GetFullscreenResolutions ();
2024-03-10 13:52:35 +00:00
int32_t selectedResolution = - 1 ;
for ( size_t i = 0 ; i < resolutions . size (); i ++ )
{
const Resolution & resolution = resolutions [ i ];
2025-08-23 20:04:21 +02:00
Formatter ft ;
ft . Add < uint16_t > ( resolution . Width );
ft . Add < uint16_t > ( resolution . Height );
gDropdown . items [ i ] = Dropdown :: MenuLabel ( STR_RESOLUTION_X_BY_Y , ft );
2024-03-10 13:52:35 +00:00
2025-10-07 20:14:37 +02:00
if ( resolution . Width == Config :: Get (). general . fullscreenWidth
&& resolution . Height == Config :: Get (). general . fullscreenHeight )
2024-03-10 13:52:35 +00:00
{
selectedResolution = static_cast < int32_t > ( i );
}
}
ShowDropdown ( widget , static_cast < int32_t > ( resolutions . size ()));
if ( selectedResolution != - 1 && selectedResolution < 32 )
{
2025-08-23 14:09:40 +02:00
gDropdown . items [ selectedResolution ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
break ;
case WIDX_FULLSCREEN_DROPDOWN :
2025-08-23 16:06:48 +02:00
gDropdown . items [ 0 ] = Dropdown :: MenuLabel ( STR_OPTIONS_DISPLAY_WINDOWED );
gDropdown . items [ 1 ] = Dropdown :: MenuLabel ( STR_OPTIONS_DISPLAY_FULLSCREEN );
gDropdown . items [ 2 ] = Dropdown :: MenuLabel ( STR_OPTIONS_DISPLAY_FULLSCREEN_BORDERLESS );
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
ShowDropdown ( widget , 3 );
2021-10-15 11:41:30 +02:00
2025-10-07 20:14:37 +02:00
gDropdown . items [ Config :: Get (). general . fullscreenMode ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_DRAWING_ENGINE_DROPDOWN :
2021-10-15 11:41:30 +02:00
{
2025-05-01 14:59:34 +03:00
const auto numItems = static_cast < int32_t > ( std :: size ( kDrawingEngineStringIds ));
2024-03-10 13:52:35 +00:00
for ( int32_t i = 0 ; i < numItems ; i ++ )
{
2025-08-23 16:06:48 +02:00
gDropdown . items [ i ] = Dropdown :: MenuLabel ( kDrawingEngineStringIds [ i ]);
2024-03-10 13:52:35 +00:00
}
ShowDropdown ( widget , numItems );
2025-10-07 20:14:37 +02:00
gDropdown . items [ EnumValue ( Config :: Get (). general . drawingEngine )]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
case WIDX_SCALE_UP :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . windowScale += 0.25f ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2023-01-16 13:50:43 +00:00
GfxInvalidateScreen ();
2024-03-10 13:52:35 +00:00
ContextTriggerResize ();
ContextUpdateCursorScale ();
break ;
case WIDX_SCALE_DOWN :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . windowScale -= 0.25f ;
Config :: Get (). general . windowScale = std :: max ( 0.5f , Config :: Get (). general . windowScale );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
ContextTriggerResize ();
ContextUpdateCursorScale ();
break ;
2025-05-15 22:40:04 +02:00
case WIDX_FRAME_RATE_LIMIT_DROPDOWN :
{
2025-08-23 16:06:48 +02:00
gDropdown . items [ 0 ] = Dropdown :: MenuLabel ( STR_FRAME_RATE_LIMIT_DEFAULT );
gDropdown . items [ 1 ] = Dropdown :: MenuLabel ( STR_FRAME_RATE_LIMIT_VSYNC );
gDropdown . items [ 2 ] = Dropdown :: MenuLabel ( STR_FRAME_RATE_LIMIT_UNRESTRICTED );
2025-05-15 22:40:04 +02:00
ShowDropdown ( widget , 3 );
auto & config = Config :: Get (). general ;
auto activeItem = 0 ;
2025-10-07 20:14:37 +02:00
if ( config . uncapFPS )
2025-05-15 22:40:04 +02:00
{
2025-10-07 20:14:37 +02:00
activeItem = config . useVSync ? 1 : 2 ;
2025-05-15 22:40:04 +02:00
}
2025-08-23 14:09:40 +02:00
gDropdown . items [ activeItem ]. setChecked ( true );
2025-05-15 22:40:04 +02:00
break ;
}
2024-03-10 13:52:35 +00:00
}
}
void DisplayDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
{
switch ( widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
case WIDX_RESOLUTION_DROPDOWN :
2021-10-15 11:41:30 +02:00
{
2026-01-16 04:38:20 -03:00
const auto & resolutions = GetContext () -> GetUiContext (). GetFullscreenResolutions ();
2024-03-10 13:52:35 +00:00
const Resolution & resolution = resolutions [ dropdownIndex ];
2025-10-07 20:14:37 +02:00
if ( resolution . Width != Config :: Get (). general . fullscreenWidth
|| resolution . Height != Config :: Get (). general . fullscreenHeight )
2020-10-04 17:08:10 +02:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . fullscreenWidth = resolution . Width ;
Config :: Get (). general . fullscreenHeight = resolution . Height ;
2024-03-10 13:52:35 +00:00
2026-01-16 04:38:20 -03:00
if ( Config :: Get (). general . fullscreenMode == static_cast < int32_t > ( FullscreenMode :: fullscreen ))
ContextSetFullscreenMode ( static_cast < int32_t > ( FullscreenMode :: fullscreen ));
2024-03-10 13:52:35 +00:00
2024-05-10 12:10:21 +02:00
Config :: Save ();
2023-01-16 13:50:43 +00:00
GfxInvalidateScreen ();
2021-10-15 11:41:30 +02:00
}
2025-05-15 22:40:04 +02:00
break ;
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
case WIDX_FULLSCREEN_DROPDOWN :
2025-10-07 20:14:37 +02:00
if ( dropdownIndex != Config :: Get (). general . fullscreenMode )
2024-03-10 13:52:35 +00:00
{
ContextSetFullscreenMode ( dropdownIndex );
2025-10-07 20:14:37 +02:00
Config :: Get (). general . fullscreenMode = static_cast < uint8_t > ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
}
break ;
case WIDX_DRAWING_ENGINE_DROPDOWN :
2025-10-07 20:14:37 +02:00
if ( dropdownIndex != EnumValue ( Config :: Get (). general . drawingEngine ))
2024-03-10 13:52:35 +00:00
{
2025-05-01 14:59:34 +03:00
DrawingEngine dstEngine = static_cast < DrawingEngine > ( dropdownIndex );
2025-10-07 20:14:37 +02:00
Config :: Get (). general . drawingEngine = dstEngine ;
2024-08-13 00:49:58 +03:00
RefreshVideo ();
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
}
break ;
2025-05-15 22:40:04 +02:00
case WIDX_FRAME_RATE_LIMIT_DROPDOWN :
{
auto & config = Config :: Get (). general ;
switch ( dropdownIndex )
{
case 0 : // vanilla
2026-01-14 19:10:13 -03:00
config . uncapFPS = false ;
config . useVSync = false ;
2025-05-15 22:40:04 +02:00
break ;
case 1 : // vsync
2026-01-14 19:10:13 -03:00
config . uncapFPS = true ;
config . useVSync = true ;
2025-05-15 22:40:04 +02:00
break ;
case 2 : // uncapped
2026-01-14 19:10:13 -03:00
config . uncapFPS = true ;
config . useVSync = false ;
2025-05-15 22:40:04 +02:00
break ;
}
2025-10-07 20:14:37 +02:00
DrawingEngineSetVSync ( config . useVSync );
2025-05-15 22:40:04 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2025-05-15 22:40:04 +02:00
break ;
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
}
void DisplayPrepareDraw ()
{
2026-03-16 14:01:38 +01:00
auto & generalConfig = Config :: Get (). general ;
_dropdownCaption = FormatStringID (
STR_RESOLUTION_X_BY_Y , generalConfig . fullscreenWidth , generalConfig . fullscreenHeight );
widgets [ WIDX_RESOLUTION ]. setString ( _dropdownCaption . c_str ());
2024-03-10 13:52:35 +00:00
// Disable resolution dropdown on "Windowed" and "Fullscreen (desktop)"
2026-01-16 04:38:20 -03:00
if ( Config :: Get (). general . fullscreenMode != static_cast < int32_t > ( FullscreenMode :: fullscreen ))
2024-03-10 13:52:35 +00:00
{
2025-09-17 19:03:29 +02:00
disabledWidgets |= ( 1uLL << WIDX_RESOLUTION_DROPDOWN );
disabledWidgets |= ( 1uLL << WIDX_RESOLUTION );
disabledWidgets |= ( 1uLL << WIDX_RESOLUTION_LABEL );
2024-03-10 13:52:35 +00:00
}
else
{
2025-09-17 19:03:29 +02:00
disabledWidgets &= ~ ( 1uLL << WIDX_RESOLUTION_DROPDOWN );
disabledWidgets &= ~ ( 1uLL << WIDX_RESOLUTION );
disabledWidgets &= ~ ( 1uLL << WIDX_RESOLUTION_LABEL );
2024-03-10 13:52:35 +00:00
}
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_SHOW_FPS_CHECKBOX , Config :: Get (). general . showFPS );
setCheckboxValue ( WIDX_MULTITHREADING_CHECKBOX , Config :: Get (). general . multiThreading );
setCheckboxValue ( WIDX_MINIMIZE_FOCUS_LOSS , Config :: Get (). general . minimizeFullscreenFocusLoss );
setCheckboxValue ( WIDX_DISABLE_SCREENSAVER_LOCK , Config :: Get (). general . disableScreensaver );
2024-03-10 13:52:35 +00:00
// Dropdown captions for straightforward strings.
2025-10-07 20:14:37 +02:00
widgets [ WIDX_FULLSCREEN ]. text = FullscreenModeNames [ Config :: Get (). general . fullscreenMode ];
widgets [ WIDX_DRAWING_ENGINE ]. text = kDrawingEngineStringIds [ EnumValue ( Config :: Get (). general . drawingEngine )];
2025-05-15 22:40:04 +02:00
static constexpr StringId kFrameRateLimitStringIds [] = {
STR_FRAME_RATE_LIMIT_DEFAULT ,
STR_FRAME_RATE_LIMIT_VSYNC ,
STR_FRAME_RATE_LIMIT_UNRESTRICTED ,
};
auto & config = Config :: Get (). general ;
auto activeItem = 0 ;
2025-10-07 20:14:37 +02:00
if ( config . uncapFPS )
2025-05-15 22:40:04 +02:00
{
2025-10-07 20:14:37 +02:00
activeItem = config . useVSync ? 1 : 2 ;
2025-05-15 22:40:04 +02:00
}
widgets [ WIDX_FRAME_RATE_LIMIT ]. text = kFrameRateLimitStringIds [ activeItem ];
2024-03-10 13:52:35 +00:00
}
2026-01-13 23:41:59 +01:00
void DisplayDraw ( RenderTarget & rt )
2024-03-10 13:52:35 +00:00
{
auto ft = Formatter ();
2025-10-07 20:14:37 +02:00
ft . Add < int32_t > ( static_cast < int32_t > ( Config :: Get (). general . windowScale * 100 ));
2026-03-22 18:58:24 +01:00
DrawText (
2025-05-05 01:06:46 +03:00
rt , windowPos + ScreenCoordsXY { widgets [ WIDX_SCALE ]. left + 1 , widgets [ WIDX_SCALE ]. top + 1 },
2024-03-10 13:52:35 +00:00
STR_WINDOW_COLOUR_2_COMMA2DP32 , ft , { colours [ 1 ] });
}
#pragma endregion
#pragma region Rendering tab events
void RenderingMouseUp ( WidgetIndex widgetIndex )
{
switch ( widgetIndex )
{
case WIDX_TILE_SMOOTHING_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . landscapeSmoothing ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2023-01-16 13:50:43 +00:00
GfxInvalidateScreen ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_GRIDLINES_CHECKBOX :
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . alwaysShowGridlines ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
WindowBase * mainWindow = WindowGetMain ();
if ( mainWindow != nullptr )
{
2025-10-07 20:14:37 +02:00
if ( Config :: Get (). general . alwaysShowGridlines )
2024-03-10 13:52:35 +00:00
mainWindow -> viewport -> flags |= VIEWPORT_FLAG_GRIDLINES ;
else
mainWindow -> viewport -> flags &= ~ VIEWPORT_FLAG_GRIDLINES ;
}
break ;
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
case WIDX_DAY_NIGHT_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . dayNightCycle ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2021-10-15 11:41:30 +02:00
break ;
2024-03-10 13:52:35 +00:00
case WIDX_ENABLE_LIGHT_FX_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . enableLightFx ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2021-10-15 11:41:30 +02:00
break ;
2024-03-10 13:52:35 +00:00
case WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . enableLightFxForVehicles ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_UPPER_CASE_BANNERS_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . upperCaseBanners ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2026-01-13 23:41:59 +01:00
ScrollingText :: invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . disableLightningEffect ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . renderWeatherEffects ^= 1 ;
Config :: Get (). general . renderWeatherGloom = Config :: Get (). general . renderWeatherEffects ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
break ;
case WIDX_SHOW_GUEST_PURCHASES_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . showGuestPurchases ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . transparentScreenshot ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2021-10-15 11:41:30 +02:00
break ;
}
}
2024-03-10 13:52:35 +00:00
void RenderingMouseDown ( WidgetIndex widgetIndex )
{
switch ( widgetIndex )
{
case WIDX_VIRTUAL_FLOOR_DROPDOWN :
2025-08-23 16:06:48 +02:00
gDropdown . items [ 0 ] = Dropdown :: MenuLabel ( STR_VIRTUAL_FLOOR_STYLE_DISABLED );
gDropdown . items [ 1 ] = Dropdown :: MenuLabel ( STR_VIRTUAL_FLOOR_STYLE_TRANSPARENT );
gDropdown . items [ 2 ] = Dropdown :: MenuLabel ( STR_VIRTUAL_FLOOR_STYLE_GLASSY );
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
Widget * widget = & widgets [ widgetIndex - 1 ];
ShowDropdown ( widget , 3 );
2021-10-15 11:41:30 +02:00
2025-10-07 20:14:37 +02:00
gDropdown . items [ static_cast < int32_t > ( Config :: Get (). general . virtualFloorStyle )]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
}
}
void RenderingDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
{
switch ( widgetIndex )
{
case WIDX_VIRTUAL_FLOOR_DROPDOWN :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . virtualFloorStyle = static_cast < VirtualFloorStyles > ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
break ;
}
}
void RenderingPrepareDraw ()
{
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_TILE_SMOOTHING_CHECKBOX , Config :: Get (). general . landscapeSmoothing );
setCheckboxValue ( WIDX_GRIDLINES_CHECKBOX , Config :: Get (). general . alwaysShowGridlines );
setCheckboxValue ( WIDX_DAY_NIGHT_CHECKBOX , Config :: Get (). general . dayNightCycle );
setCheckboxValue ( WIDX_SHOW_GUEST_PURCHASES_CHECKBOX , Config :: Get (). general . showGuestPurchases );
setCheckboxValue ( WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX , Config :: Get (). general . transparentScreenshot );
setCheckboxValue ( WIDX_UPPER_CASE_BANNERS_CHECKBOX , Config :: Get (). general . upperCaseBanners );
2024-03-10 13:52:35 +00:00
static constexpr StringId _virtualFloorStyleStrings [] = {
STR_VIRTUAL_FLOOR_STYLE_DISABLED ,
STR_VIRTUAL_FLOOR_STYLE_TRANSPARENT ,
STR_VIRTUAL_FLOOR_STYLE_GLASSY ,
};
2025-10-07 20:14:37 +02:00
widgets [ WIDX_VIRTUAL_FLOOR ]. text = _virtualFloorStyleStrings [ EnumValue ( Config :: Get (). general . virtualFloorStyle )];
2024-03-10 13:52:35 +00:00
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_ENABLE_LIGHT_FX_CHECKBOX , Config :: Get (). general . enableLightFx );
if ( Config :: Get (). general . dayNightCycle
&& Config :: Get (). general . drawingEngine == DrawingEngine :: SoftwareWithHardwareDisplay )
2024-03-10 13:52:35 +00:00
{
2025-09-17 19:03:29 +02:00
disabledWidgets &= ~ ( 1uLL << WIDX_ENABLE_LIGHT_FX_CHECKBOX );
2024-03-10 13:52:35 +00:00
}
else
{
2025-09-17 19:03:29 +02:00
disabledWidgets |= ( 1uLL << WIDX_ENABLE_LIGHT_FX_CHECKBOX );
2025-10-07 20:14:37 +02:00
Config :: Get (). general . enableLightFx = false ;
2024-03-10 13:52:35 +00:00
}
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX , Config :: Get (). general . enableLightFxForVehicles );
if ( Config :: Get (). general . dayNightCycle
&& Config :: Get (). general . drawingEngine == DrawingEngine :: SoftwareWithHardwareDisplay
&& Config :: Get (). general . enableLightFx )
2024-03-10 13:52:35 +00:00
{
2025-09-17 19:03:29 +02:00
disabledWidgets &= ~ ( 1uLL << WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX );
2024-03-10 13:52:35 +00:00
}
else
{
2025-09-17 19:03:29 +02:00
disabledWidgets |= ( 1uLL << WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX );
2025-10-07 20:14:37 +02:00
Config :: Get (). general . enableLightFxForVehicles = false ;
2024-03-10 13:52:35 +00:00
}
2025-09-17 20:10:06 +02:00
setCheckboxValue (
WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX ,
2025-10-07 20:14:37 +02:00
Config :: Get (). general . renderWeatherEffects || Config :: Get (). general . renderWeatherGloom );
setCheckboxValue ( WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX , Config :: Get (). general . disableLightningEffect );
if ( ! Config :: Get (). general . renderWeatherEffects && ! Config :: Get (). general . renderWeatherGloom )
2024-03-10 13:52:35 +00:00
{
2025-09-17 20:10:06 +02:00
setCheckboxValue ( WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX , true );
2025-09-17 19:03:29 +02:00
disabledWidgets |= ( 1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX );
2024-03-10 13:52:35 +00:00
}
else
{
2025-09-17 19:03:29 +02:00
disabledWidgets &= ~ ( 1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX );
2024-03-10 13:52:35 +00:00
}
}
#pragma endregion
#pragma region Culture tab events
void CultureMouseDown ( WidgetIndex widgetIndex )
{
Widget * widget = & widgets [ widgetIndex - 1 ];
switch ( widgetIndex )
{
case WIDX_HEIGHT_LABELS_DROPDOWN :
2025-08-23 16:06:48 +02:00
gDropdown . items [ 0 ] = Dropdown :: MenuLabel ( STR_HEIGHT_IN_UNITS );
gDropdown . items [ 1 ] = Dropdown :: MenuLabel ( STR_REAL_VALUES );
2024-03-10 13:52:35 +00:00
ShowDropdown ( widget , 2 );
2025-10-07 20:14:37 +02:00
gDropdown . items [ Config :: Get (). general . showHeightAsUnits ? 0 : 1 ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_CURRENCY_DROPDOWN :
{
// All the currencies plus the separator
2025-10-07 20:24:14 +02:00
constexpr auto numItems = EnumValue ( CurrencyType :: count ) + 1 ;
2024-03-10 13:52:35 +00:00
// All the currencies except custom currency
2025-10-07 20:24:14 +02:00
constexpr size_t numOrdinaryCurrencies = EnumValue ( CurrencyType :: count ) - 1 ;
2024-03-10 13:52:35 +00:00
for ( size_t i = 0 ; i < numOrdinaryCurrencies ; i ++ )
{
2025-08-23 16:06:48 +02:00
gDropdown . items [ i ] = Dropdown :: MenuLabel ( CurrencyDescriptors [ i ]. stringId );
2024-03-10 13:52:35 +00:00
}
2025-08-23 16:29:55 +02:00
gDropdown . items [ numOrdinaryCurrencies ] = Dropdown :: Separator ();
2024-03-10 13:52:35 +00:00
2025-08-23 16:06:48 +02:00
gDropdown . items [ numOrdinaryCurrencies + 1 ] = Dropdown :: MenuLabel (
2025-10-07 20:24:14 +02:00
CurrencyDescriptors [ EnumValue ( CurrencyType :: custom )]. stringId );
2024-03-10 13:52:35 +00:00
ShowDropdown ( widget , numItems );
2025-10-07 20:24:14 +02:00
if ( Config :: Get (). general . currencyFormat == CurrencyType :: custom )
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
gDropdown . items [ EnumValue ( Config :: Get (). general . currencyFormat ) + 1 ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
}
else
{
2025-10-07 20:14:37 +02:00
gDropdown . items [ EnumValue ( Config :: Get (). general . currencyFormat )]. setChecked ( true );
2024-03-10 13:52:35 +00:00
}
break ;
}
case WIDX_DISTANCE_DROPDOWN :
2025-08-23 16:06:48 +02:00
gDropdown . items [ 0 ] = Dropdown :: MenuLabel ( STR_IMPERIAL );
gDropdown . items [ 1 ] = Dropdown :: MenuLabel ( STR_METRIC );
gDropdown . items [ 2 ] = Dropdown :: MenuLabel ( STR_SI );
2024-03-10 13:52:35 +00:00
ShowDropdown ( widget , 3 );
2025-10-07 20:14:37 +02:00
gDropdown . items [ static_cast < int32_t > ( Config :: Get (). general . measurementFormat )]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TEMPERATURE_DROPDOWN :
2025-08-23 16:06:48 +02:00
gDropdown . items [ 0 ] = Dropdown :: MenuLabel ( STR_CELSIUS );
gDropdown . items [ 1 ] = Dropdown :: MenuLabel ( STR_FAHRENHEIT );
2024-03-10 13:52:35 +00:00
ShowDropdown ( widget , 2 );
2025-10-07 20:14:37 +02:00
gDropdown . items [ static_cast < int32_t > ( Config :: Get (). general . temperatureFormat )]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_LANGUAGE_DROPDOWN :
for ( size_t i = 1 ; i < LANGUAGE_COUNT ; i ++ )
{
2025-08-23 16:59:48 +02:00
gDropdown . items [ i - 1 ] = Dropdown :: MenuLabel ( LanguagesDescriptors [ i ]. native_name );
2024-03-10 13:52:35 +00:00
}
ShowDropdown ( widget , LANGUAGE_COUNT - 1 );
2025-08-23 14:09:40 +02:00
gDropdown . items [ LocalisationService_GetCurrentLanguage () - 1 ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_DATE_FORMAT_DROPDOWN :
for ( size_t i = 0 ; i < 4 ; i ++ )
{
2025-08-23 16:06:48 +02:00
gDropdown . items [ i ] = Dropdown :: MenuLabel ( DateFormatStringIDs [ i ]);
2024-03-10 13:52:35 +00:00
}
ShowDropdown ( widget , 4 );
2025-10-07 20:14:37 +02:00
gDropdown . items [ Config :: Get (). general . dateFormat ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
}
}
void CultureDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
{
switch ( widgetIndex )
{
case WIDX_HEIGHT_LABELS_DROPDOWN :
// reset flag and set it to 1 if height as units is selected
2026-01-14 19:10:13 -03:00
Config :: Get (). general . showHeightAsUnits = false ;
2024-03-10 13:52:35 +00:00
if ( dropdownIndex == 0 )
{
2026-01-14 19:10:13 -03:00
Config :: Get (). general . showHeightAsUnits = true ;
2024-03-10 13:52:35 +00:00
}
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
UpdateHeightMarkers ();
break ;
case WIDX_CURRENCY_DROPDOWN :
2025-10-07 20:24:14 +02:00
if ( dropdownIndex == EnumValue ( CurrencyType :: custom ) + 1 )
2024-03-10 13:52:35 +00:00
{ // Add 1 because the separator occupies a position
2025-10-07 20:14:37 +02:00
Config :: Get (). general . currencyFormat = static_cast < CurrencyType > ( dropdownIndex - 1 );
2025-09-17 23:18:52 +02:00
ContextOpenWindow ( WindowClass :: customCurrencyConfig );
2024-03-10 13:52:35 +00:00
}
else
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . currencyFormat = static_cast < CurrencyType > ( dropdownIndex );
2024-03-10 13:52:35 +00:00
}
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
break ;
case WIDX_DISTANCE_DROPDOWN :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . measurementFormat = static_cast < MeasurementFormat > ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
UpdateHeightMarkers ();
break ;
case WIDX_TEMPERATURE_DROPDOWN :
2025-10-07 20:14:37 +02:00
if ( dropdownIndex != static_cast < int32_t > ( Config :: Get (). general . temperatureFormat ))
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . temperatureFormat = static_cast < TemperatureUnit > ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
}
break ;
case WIDX_LANGUAGE_DROPDOWN :
{
auto fallbackLanguage = LocalisationService_GetCurrentLanguage ();
if ( dropdownIndex != LocalisationService_GetCurrentLanguage () - 1 )
{
if ( ! LanguageOpen ( dropdownIndex + 1 ))
{
// Failed to open language file, try to recover by falling
// back to previously used language
if ( LanguageOpen ( fallbackLanguage ))
{
// It worked, so we can say it with error message in-game
2025-01-19 16:59:45 +01:00
ContextShowError ( STR_LANGUAGE_LOAD_FAILED , kStringIdNone , {});
2024-03-10 13:52:35 +00:00
}
// report error to console regardless
LOG_ERROR ( "Failed to open language file." );
}
else
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . language = dropdownIndex + 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
}
}
}
break ;
case WIDX_DATE_FORMAT_DROPDOWN :
2025-10-07 20:14:37 +02:00
if ( dropdownIndex != Config :: Get (). general . dateFormat )
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . dateFormat = static_cast < uint8_t > ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
}
break ;
}
}
void CulturePrepareDraw ()
{
// Language
2026-03-16 14:01:38 +01:00
_dropdownCaption = LanguagesDescriptors [ LocalisationService_GetCurrentLanguage ()]. native_name ;
widgets [ WIDX_LANGUAGE ]. setString ( _dropdownCaption . c_str ());
2024-03-10 13:52:35 +00:00
// Currency: pounds, dollars, etc. (10 total)
2025-10-07 20:14:37 +02:00
widgets [ WIDX_CURRENCY ]. text = CurrencyDescriptors [ EnumValue ( Config :: Get (). general . currencyFormat )]. stringId ;
2024-03-10 13:52:35 +00:00
// Distance: metric / imperial / si
{
2025-01-19 16:59:45 +01:00
StringId stringId = kStringIdNone ;
2025-10-07 20:14:37 +02:00
switch ( Config :: Get (). general . measurementFormat )
2024-03-10 13:52:35 +00:00
{
case MeasurementFormat :: Imperial :
stringId = STR_IMPERIAL ;
break ;
case MeasurementFormat :: Metric :
stringId = STR_METRIC ;
break ;
case MeasurementFormat :: SI :
stringId = STR_SI ;
break ;
}
widgets [ WIDX_DISTANCE ]. text = stringId ;
}
// Date format
2025-10-07 20:14:37 +02:00
widgets [ WIDX_DATE_FORMAT ]. text = DateFormatStringIDs [ Config :: Get (). general . dateFormat ];
2024-03-10 13:52:35 +00:00
// Temperature: celsius/fahrenheit
2025-10-07 20:14:37 +02:00
widgets [ WIDX_TEMPERATURE ]. text = Config :: Get (). general . temperatureFormat == TemperatureUnit :: Fahrenheit
2024-05-10 12:10:21 +02:00
? STR_FAHRENHEIT
: STR_CELSIUS ;
2024-03-10 13:52:35 +00:00
// Height: units/real values
2025-10-07 20:14:37 +02:00
widgets [ WIDX_HEIGHT_LABELS ]. text = Config :: Get (). general . showHeightAsUnits ? STR_HEIGHT_IN_UNITS : STR_REAL_VALUES ;
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
#pragma endregion
#pragma region Audio tab events
2024-03-10 13:52:35 +00:00
void AudioMouseUp ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
2022-05-09 18:34:38 +01:00
{
2024-03-10 13:52:35 +00:00
case WIDX_SOUND_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . soundEnabled = ! Config :: Get (). sound . soundEnabled ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
2023-05-15 00:10:45 +02:00
2024-03-10 13:52:35 +00:00
case WIDX_MASTER_SOUND_CHECKBOX :
2025-01-25 13:46:08 +01:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . masterSoundEnabled = ! Config :: Get (). sound . masterSoundEnabled ;
if ( ! Config :: Get (). sound . masterSoundEnabled )
2026-01-16 04:38:20 -03:00
Pause ();
2021-10-15 11:41:30 +02:00
else
2026-01-16 04:38:20 -03:00
Resume ();
2025-01-25 13:46:08 +01:00
2026-01-16 04:38:20 -03:00
auto * windowMgr = GetWindowManager ();
2025-09-17 23:18:52 +02:00
windowMgr -> InvalidateByClass ( WindowClass :: topToolbar );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
2025-01-25 13:46:08 +01:00
}
2024-03-10 13:52:35 +00:00
case WIDX_MUSIC_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . rideMusicEnabled = ! Config :: Get (). sound . rideMusicEnabled ;
if ( ! Config :: Get (). sound . rideMusicEnabled )
2021-10-15 11:41:30 +02:00
{
2026-01-16 04:38:20 -03:00
RideAudio :: StopAllChannels ();
2021-10-15 11:41:30 +02:00
}
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
2023-05-15 20:57:17 +02:00
2024-03-10 13:52:35 +00:00
case WIDX_AUDIO_FOCUS_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . audioFocus = ! Config :: Get (). sound . audioFocus ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
}
}
void AudioMouseDown ( WidgetIndex widgetIndex )
{
Widget * widget = & widgets [ widgetIndex - 1 ];
switch ( widgetIndex )
{
case WIDX_SOUND_DROPDOWN :
2026-01-16 04:38:20 -03:00
PopulateDevices ();
2024-03-10 13:52:35 +00:00
// populate the list with the sound devices
2026-01-16 04:38:20 -03:00
for ( int32_t i = 0 ; i < GetDeviceCount (); i ++ )
2024-03-10 13:52:35 +00:00
{
2026-01-16 04:38:20 -03:00
gDropdown . items [ i ] = Dropdown :: MenuLabel ( GetDeviceName ( i ). c_str ());
2024-03-10 13:52:35 +00:00
}
2026-01-16 04:38:20 -03:00
ShowDropdown ( widget , GetDeviceCount ());
2024-03-10 13:52:35 +00:00
2026-01-16 04:38:20 -03:00
gDropdown . items [ GetCurrentDeviceIndex ()]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TITLE_MUSIC_DROPDOWN :
{
2025-09-17 20:10:06 +02:00
const bool rct1MusicThemeIsAvailable = isRCT1TitleMusicAvailable ();
2024-03-10 13:52:35 +00:00
int32_t numItems {};
int32_t checkedIndex {};
for ( auto theme : TitleThemeOptions )
{
if ( theme . Kind == TitleMusicKind :: RCT1 && ! rct1MusicThemeIsAvailable )
continue ;
2025-10-07 20:14:37 +02:00
if ( Config :: Get (). sound . titleMusic == theme . Kind )
2024-03-10 13:52:35 +00:00
checkedIndex = numItems ;
2025-08-23 16:06:48 +02:00
gDropdown . items [ numItems ++ ] = Dropdown :: MenuLabel ( theme . Name );
2024-03-10 13:52:35 +00:00
}
ShowDropdown ( widget , numItems );
2025-08-23 14:09:40 +02:00
gDropdown . items [ checkedIndex ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
}
}
}
void AudioDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
{
switch ( widgetIndex )
{
case WIDX_SOUND_DROPDOWN :
2026-01-16 04:38:20 -03:00
InitRideSounds ( dropdownIndex );
if ( dropdownIndex < GetDeviceCount ())
2024-03-10 13:52:35 +00:00
{
2025-05-15 22:46:06 +03:00
auto & audioContext = GetContext () -> GetAudioContext ();
2024-03-10 13:52:35 +00:00
if ( dropdownIndex == 0 )
{
2025-05-15 22:46:06 +03:00
audioContext . SetOutputDevice ( "" );
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . device = "" ;
2024-03-10 13:52:35 +00:00
}
else
{
const auto & deviceName = GetDeviceName ( dropdownIndex );
2025-05-15 22:46:06 +03:00
audioContext . SetOutputDevice ( deviceName );
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . device = deviceName ;
2024-03-10 13:52:35 +00:00
}
2024-05-10 12:10:21 +02:00
Config :: Save ();
2026-01-16 04:38:20 -03:00
PlayTitleMusic ();
2024-03-10 13:52:35 +00:00
}
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TITLE_MUSIC_DROPDOWN :
{
// HACK: When RCT1 is not available, it's not in the dropdown, so indices higher than it should be
// incremented
2025-09-17 20:10:06 +02:00
const bool rct1MusicThemeIsAvailable = isRCT1TitleMusicAvailable ();
2024-03-10 13:52:35 +00:00
for ( size_t i = 0 ; i < std :: size ( TitleThemeOptions ) && static_cast < int32_t > ( i ) <= dropdownIndex ; i ++ )
{
if ( TitleThemeOptions [ i ]. Kind == TitleMusicKind :: RCT1 && ! rct1MusicThemeIsAvailable )
dropdownIndex ++ ;
}
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . titleMusic = TitleThemeOptions [ dropdownIndex ]. Kind ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
2026-01-16 04:38:20 -03:00
StopTitleMusic ();
2025-10-07 20:14:37 +02:00
if ( Config :: Get (). sound . titleMusic != TitleMusicKind :: None )
2024-03-10 13:52:35 +00:00
{
2026-01-16 04:38:20 -03:00
PlayTitleMusic ();
2024-03-10 13:52:35 +00:00
}
break ;
}
}
}
void AudioUpdate ()
{
const auto & masterVolumeWidget = widgets [ WIDX_MASTER_VOLUME ];
const auto & masterVolumeScroll = scrolls [ 0 ];
uint8_t masterVolume = GetScrollPercentage ( masterVolumeWidget , masterVolumeScroll );
2025-10-07 20:14:37 +02:00
if ( masterVolume != Config :: Get (). sound . masterVolume )
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . masterVolume = masterVolume ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_MASTER_VOLUME );
2024-03-10 13:52:35 +00:00
}
2022-05-09 18:34:38 +01:00
2024-03-10 13:52:35 +00:00
const auto & soundVolumeWidget = widgets [ WIDX_MASTER_VOLUME ];
const auto & soundVolumeScroll = scrolls [ 1 ];
uint8_t soundVolume = GetScrollPercentage ( soundVolumeWidget , soundVolumeScroll );
2025-10-07 20:14:37 +02:00
if ( soundVolume != Config :: Get (). sound . soundVolume )
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . soundVolume = soundVolume ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_SOUND_VOLUME );
2024-03-10 13:52:35 +00:00
}
const auto & musicVolumeWidget = widgets [ WIDX_MASTER_VOLUME ];
const auto & musicVolumeScroll = scrolls [ 2 ];
uint8_t rideMusicVolume = GetScrollPercentage ( musicVolumeWidget , musicVolumeScroll );
2025-10-07 20:14:37 +02:00
if ( rideMusicVolume != Config :: Get (). sound . rideMusicVolume )
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). sound . rideMusicVolume = rideMusicVolume ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_MUSIC_VOLUME );
2022-05-09 18:34:38 +01:00
}
2021-10-15 11:41:30 +02:00
}
2025-07-03 22:48:59 +02:00
void ControlsUpdate ()
{
const auto & deadzoneWidget = widgets [ WIDX_GAMEPAD_DEADZONE ];
const auto & deadzoneScroll = scrolls [ 0 ];
uint8_t deadzonePercent = GetScrollPercentage ( deadzoneWidget , deadzoneScroll );
int32_t deadzoneValue = static_cast < int32_t > (( deadzonePercent / 100.0f ) * 32767 );
if ( deadzoneValue != Config :: Get (). general . gamepadDeadzone )
{
Config :: Get (). general . gamepadDeadzone = deadzoneValue ;
Config :: Save ();
}
const auto & sensitivityWidget = widgets [ WIDX_GAMEPAD_SENSITIVITY ];
const auto & sensitivityScroll = scrolls [ 1 ];
uint8_t sensitivityPercent = GetScrollPercentage ( sensitivityWidget , sensitivityScroll );
float sensitivityValue = 0.5f + ( sensitivityPercent / 100.0f ) * 2.5f ; // Map 0-100% to 0.5-3.0
if ( std :: abs ( sensitivityValue - Config :: Get (). general . gamepadSensitivity ) > 0.01f )
{
Config :: Get (). general . gamepadSensitivity = sensitivityValue ;
Config :: Save ();
}
}
ScreenSize ControlsScrollGetSize ( int32_t scrollIndex )
{
switch ( scrollIndex )
{
case 0 : // Deadzone slider
return { 500 , 0 }; // Range 0-500 (same as audio sliders)
case 1 : // Sensitivity slider
return { 500 , 0 }; // Range 0-500 (same as audio sliders)
default :
return { 0 , 0 };
}
}
2024-03-10 13:52:35 +00:00
ScreenSize AudioScrollGetSize ( int32_t scrollIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
return { 500 , 0 };
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
StringId GetTitleMusicName () const
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
auto theme = std :: find_if ( std :: begin ( TitleThemeOptions ), std :: end ( TitleThemeOptions ), []( auto && option ) {
2025-10-07 20:14:37 +02:00
return Config :: Get (). sound . titleMusic == option . Kind ;
2024-03-10 13:52:35 +00:00
});
if ( theme != std :: end ( TitleThemeOptions ))
return theme -> Name ;
return STR_OPENRCT2_DROPDOWN ;
2021-10-15 11:41:30 +02:00
}
2026-03-16 14:01:38 +01:00
static u8string getCurrentAudioDeviceName ()
2021-10-15 11:41:30 +02:00
{
2026-01-16 04:38:20 -03:00
const int32_t currentDeviceIndex = GetCurrentDeviceIndex ();
if ( currentDeviceIndex == - 1 || GetDeviceCount () == 0 )
2024-03-10 13:52:35 +00:00
{
2026-03-16 14:01:38 +01:00
return LanguageGetString ( STR_SOUND_NONE );
2024-03-10 13:52:35 +00:00
}
2026-03-16 14:01:38 +01:00
return GetDeviceName ( currentDeviceIndex ). c_str ();
}
void AudioPrepareDraw ()
{
// Sound device
_dropdownCaption = getCurrentAudioDeviceName ();
widgets [ WIDX_SOUND ]. setString ( _dropdownCaption . c_str ());
2024-03-10 13:52:35 +00:00
widgets [ WIDX_TITLE_MUSIC ]. text = GetTitleMusicName ();
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_SOUND_CHECKBOX , Config :: Get (). sound . soundEnabled );
setCheckboxValue ( WIDX_MASTER_SOUND_CHECKBOX , Config :: Get (). sound . masterSoundEnabled );
setCheckboxValue ( WIDX_MUSIC_CHECKBOX , Config :: Get (). sound . rideMusicEnabled );
setCheckboxValue ( WIDX_AUDIO_FOCUS_CHECKBOX , Config :: Get (). sound . audioFocus );
widgetSetEnabled ( * this , WIDX_SOUND_CHECKBOX , Config :: Get (). sound . masterSoundEnabled );
widgetSetEnabled ( * this , WIDX_MUSIC_CHECKBOX , Config :: Get (). sound . masterSoundEnabled );
2024-03-10 13:52:35 +00:00
// Initialize only on first frame, otherwise the scrollbars won't be able to be modified
2025-09-17 19:03:29 +02:00
if ( currentFrame == 0 )
2021-10-15 11:41:30 +02:00
{
2025-10-07 20:14:37 +02:00
initialiseScrollPosition ( WIDX_MASTER_VOLUME , 0 , Config :: Get (). sound . masterVolume );
initialiseScrollPosition ( WIDX_SOUND_VOLUME , 1 , Config :: Get (). sound . soundVolume );
initialiseScrollPosition ( WIDX_MUSIC_VOLUME , 2 , Config :: Get (). sound . rideMusicVolume );
2021-10-15 11:41:30 +02:00
}
}
#pragma endregion
#pragma region Controls tab events
2024-03-10 13:52:35 +00:00
void ControlsMouseUp ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2026-01-16 04:38:20 -03:00
auto * windowMgr = GetWindowManager ();
2025-01-25 13:46:08 +01:00
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
{
case WIDX_HOTKEY_DROPDOWN :
2025-09-17 23:18:52 +02:00
ContextOpenWindow ( WindowClass :: keyboardShortcutList );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_SCREEN_EDGE_SCROLLING :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . edgeScrolling ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TRAP_CURSOR :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . trapCursor ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-10-07 20:14:37 +02:00
ContextSetCursorTrap ( Config :: Get (). general . trapCursor );
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_ZOOM_TO_CURSOR :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . zoomToCursor ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_WINDOW_BUTTONS_ON_THE_LEFT :
2025-10-07 20:14:37 +02:00
Config :: Get (). interface . windowButtonsOnTheLeft ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2025-01-25 13:46:08 +01:00
windowMgr -> InvalidateAll ();
2025-09-17 20:10:06 +02:00
WindowVisitEach ([]( WindowBase * w ) { w -> resizeFrame (); });
2024-03-10 13:52:35 +00:00
break ;
2024-04-20 17:02:39 +02:00
case WIDX_ENLARGED_UI :
2025-10-07 20:14:37 +02:00
Config :: Get (). interface . enlargedUi ^= 1 ;
if ( Config :: Get (). interface . enlargedUi == false )
Config :: Get (). interface . touchEnhancements = false ;
2024-06-15 06:49:12 +10:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2025-01-25 13:46:08 +01:00
windowMgr -> InvalidateAll ();
2025-09-17 20:10:06 +02:00
WindowVisitEach ([]( WindowBase * w ) { w -> resizeFrame (); });
2024-06-15 06:49:12 +10:00
break ;
case WIDX_TOUCH_ENHANCEMENTS :
2025-10-07 20:14:37 +02:00
Config :: Get (). interface . touchEnhancements ^= 1 ;
2024-04-20 17:02:39 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2025-01-25 13:46:08 +01:00
windowMgr -> InvalidateAll ();
2024-04-20 17:02:39 +02:00
break ;
2024-03-10 13:52:35 +00:00
case WIDX_INVERT_DRAG :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . invertViewportDrag ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
2025-04-18 16:40:38 +02:00
}
}
void ControlsPrepareDraw ()
{
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_SCREEN_EDGE_SCROLLING , Config :: Get (). general . edgeScrolling );
setCheckboxValue ( WIDX_TRAP_CURSOR , Config :: Get (). general . trapCursor );
setCheckboxValue ( WIDX_INVERT_DRAG , Config :: Get (). general . invertViewportDrag );
setCheckboxValue ( WIDX_ZOOM_TO_CURSOR , Config :: Get (). general . zoomToCursor );
setCheckboxValue ( WIDX_WINDOW_BUTTONS_ON_THE_LEFT , Config :: Get (). interface . windowButtonsOnTheLeft );
setCheckboxValue ( WIDX_ENLARGED_UI , Config :: Get (). interface . enlargedUi );
setCheckboxValue ( WIDX_TOUCH_ENHANCEMENTS , Config :: Get (). interface . touchEnhancements );
2025-04-18 16:40:38 +02:00
2025-10-07 20:14:37 +02:00
widgetSetEnabled ( * this , WIDX_TOUCH_ENHANCEMENTS , Config :: Get (). interface . enlargedUi );
2025-07-03 22:48:59 +02:00
// Initialize scroll positions for sliders only on first frame
2025-09-17 19:03:29 +02:00
if ( currentFrame == 0 )
2025-07-03 22:48:59 +02:00
{
// Convert deadzone (0-32767) to percentage (0-100), then to scroll position (0-500)
uint8_t deadzonePercent = static_cast < uint8_t > (( Config :: Get (). general . gamepadDeadzone / 32767.0f ) * 100 );
2025-09-17 20:10:06 +02:00
initialiseScrollPosition ( WIDX_GAMEPAD_DEADZONE , 0 , deadzonePercent );
2025-07-03 22:48:59 +02:00
// Convert sensitivity (0.5-3.0) to percentage (0-100), then to scroll position (0-500)
uint8_t sensitivityPercent = static_cast < uint8_t > (
(( Config :: Get (). general . gamepadSensitivity - 0.5f ) / 2.5f ) * 100 );
2025-09-17 20:10:06 +02:00
initialiseScrollPosition ( WIDX_GAMEPAD_SENSITIVITY , 1 , sensitivityPercent );
2025-07-03 22:48:59 +02:00
}
2025-04-18 16:40:38 +02:00
}
#pragma endregion
#pragma region Interface tab events
void ToggleToolbarSetting ( bool & setting )
{
setting ^= true ;
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2025-04-18 16:40:38 +02:00
2026-01-16 04:38:20 -03:00
auto * windowMgr = GetWindowManager ();
2025-09-17 23:18:52 +02:00
windowMgr -> InvalidateByClass ( WindowClass :: topToolbar );
2025-04-18 16:40:38 +02:00
}
void InterfaceMouseUp ( WidgetIndex widgetIndex )
{
switch ( widgetIndex )
{
case WIDX_TOOLBAR_BUTTONS_CENTRED :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarButtonsCentred );
2025-04-18 16:40:38 +02:00
break ;
case WIDX_TOOLBAR_SHOW_FINANCES :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarShowFinances );
2025-04-18 16:40:38 +02:00
break ;
case WIDX_TOOLBAR_SHOW_RESEARCH :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarShowResearch );
2025-04-18 16:40:38 +02:00
break ;
case WIDX_TOOLBAR_SHOW_CHEATS :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarShowCheats );
2025-04-18 16:40:38 +02:00
break ;
case WIDX_TOOLBAR_SHOW_NEWS :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarShowNews );
2025-04-18 16:40:38 +02:00
break ;
case WIDX_TOOLBAR_SHOW_MUTE :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarShowMute );
2025-04-18 16:40:38 +02:00
break ;
case WIDX_TOOLBAR_SHOW_CHAT :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarShowChat );
2025-04-18 16:40:38 +02:00
break ;
case WIDX_TOOLBAR_SHOW_ZOOM :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarShowZoom );
2025-04-18 16:40:38 +02:00
break ;
case WIDX_TOOLBAR_SHOW_ROTATE_ANTI_CLOCKWISE :
2025-10-07 20:14:37 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . toolbarShowRotateAnticlockwise );
2025-04-18 16:40:38 +02:00
break ;
2024-03-10 13:52:35 +00:00
case WIDX_THEMES_BUTTON :
2025-09-17 23:18:52 +02:00
ContextOpenWindow ( WindowClass :: themes );
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
}
2021-10-15 11:41:30 +02:00
}
2025-04-18 16:40:38 +02:00
void InterfaceMouseDown ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
Widget * widget = & widgets [ widgetIndex - 1 ];
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
{
case WIDX_THEMES_DROPDOWN :
uint32_t numItems = static_cast < uint32_t > ( ThemeManagerGetNumAvailableThemes ());
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
for ( size_t i = 0 ; i < numItems ; i ++ )
{
2025-08-23 16:59:48 +02:00
gDropdown . items [ i ] = Dropdown :: MenuLabel ( ThemeManagerGetAvailableThemeName ( i ));
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
WindowDropdownShowTextCustomWidth (
2025-12-12 18:26:05 +01:00
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height (), colours [ 1 ], 0 ,
2025-11-08 10:27:58 +01:00
Dropdown :: Flag :: StayOpen , numItems , widget -> width () - 4 );
2024-03-10 13:52:35 +00:00
2025-08-23 14:09:40 +02:00
gDropdown . items [ static_cast < int32_t > ( ThemeManagerGetAvailableThemeIndex ())]. setChecked ( true );
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_THEMES_DROPDOWN );
2024-03-10 13:52:35 +00:00
break ;
}
2021-10-15 11:41:30 +02:00
}
2025-04-18 16:40:38 +02:00
void InterfaceDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
{
case WIDX_THEMES_DROPDOWN :
if ( dropdownIndex != - 1 )
{
ThemeManagerSetActiveAvailableTheme ( dropdownIndex );
}
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
break ;
}
2021-10-15 11:41:30 +02:00
}
2025-04-18 16:40:38 +02:00
void InterfacePrepareDraw ()
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_TOOLBAR_BUTTONS_CENTRED , Config :: Get (). interface . toolbarButtonsCentred );
setCheckboxValue ( WIDX_TOOLBAR_SHOW_FINANCES , Config :: Get (). interface . toolbarShowFinances );
setCheckboxValue ( WIDX_TOOLBAR_SHOW_RESEARCH , Config :: Get (). interface . toolbarShowResearch );
setCheckboxValue ( WIDX_TOOLBAR_SHOW_CHEATS , Config :: Get (). interface . toolbarShowCheats );
setCheckboxValue ( WIDX_TOOLBAR_SHOW_NEWS , Config :: Get (). interface . toolbarShowNews );
setCheckboxValue ( WIDX_TOOLBAR_SHOW_MUTE , Config :: Get (). interface . toolbarShowMute );
setCheckboxValue ( WIDX_TOOLBAR_SHOW_CHAT , Config :: Get (). interface . toolbarShowChat );
setCheckboxValue ( WIDX_TOOLBAR_SHOW_ZOOM , Config :: Get (). interface . toolbarShowZoom );
setCheckboxValue ( WIDX_TOOLBAR_SHOW_ROTATE_ANTI_CLOCKWISE , Config :: Get (). interface . toolbarShowRotateAnticlockwise );
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex ();
2026-03-16 14:01:38 +01:00
_dropdownCaption = ThemeManagerGetAvailableThemeName ( activeAvailableThemeIndex );
widgets [ WIDX_THEMES ]. setString ( _dropdownCaption . c_str ());
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
#pragma endregion
#pragma region Misc tab events
2024-03-10 13:52:35 +00:00
void MiscMouseUp ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-09-15 22:18:00 +02:00
case WIDX_REAL_NAMES_GUESTS_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . showRealNamesOfGuests ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-09-15 22:18:00 +02:00
PeepUpdateNames ();
break ;
case WIDX_REAL_NAMES_STAFF_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . showRealNamesOfStaff ^= 1 ;
2024-09-15 22:18:00 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-09-15 22:18:00 +02:00
PeepUpdateNames ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_AUTO_STAFF_PLACEMENT :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . autoStaffPlacement ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_SCENARIO_UNLOCKING :
2025-01-19 18:49:18 +01:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . scenarioUnlockingEnabled ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2026-01-16 04:38:20 -03:00
auto * windowMgr = GetWindowManager ();
2025-09-17 23:18:52 +02:00
windowMgr -> InvalidateByClass ( WindowClass :: scenarioSelect );
2024-03-10 13:52:35 +00:00
break ;
2025-01-19 18:49:18 +01:00
}
2024-03-10 13:52:35 +00:00
case WIDX_AUTO_OPEN_SHOPS :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . autoOpenShops = ! Config :: Get (). general . autoOpenShops ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_ALLOW_EARLY_COMPLETION :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . allowEarlyCompletion ^= 1 ;
2025-09-17 20:10:06 +02:00
// only the server can control this setting and needs to send the
2024-03-10 13:52:35 +00:00
// current value of allow_early_completion to all clients
2025-08-31 16:02:43 +02:00
if ( Network :: GetMode () == Network :: Mode :: server )
2024-03-10 13:52:35 +00:00
{
2025-08-29 11:32:05 +02:00
auto setAllowEarlyCompletionAction = GameActions :: ScenarioSetSettingAction (
2025-10-07 20:14:37 +02:00
GameActions :: ScenarioSetSetting :: AllowEarlyCompletion , Config :: Get (). general . allowEarlyCompletion );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & setAllowEarlyCompletionAction , getGameState ());
2024-03-10 13:52:35 +00:00
}
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
2021-10-15 11:41:30 +02:00
}
}
2024-03-10 13:52:35 +00:00
void MiscMouseDown ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
Widget * widget = & widgets [ widgetIndex - 1 ];
switch ( widgetIndex )
{
case WIDX_TITLE_SEQUENCE_DROPDOWN :
{
2024-07-26 09:59:58 +02:00
uint32_t numItems = static_cast < int32_t > ( TitleSequenceManager :: GetCount ());
2024-03-10 13:52:35 +00:00
for ( size_t i = 0 ; i < numItems ; i ++ )
{
2025-08-23 16:59:48 +02:00
gDropdown . items [ i ] = Dropdown :: MenuLabel ( TitleSequenceManager :: GetName ( i ));
2024-03-10 13:52:35 +00:00
}
2025-08-23 16:29:55 +02:00
gDropdown . items [ numItems ] = Dropdown :: Separator ();
2024-03-10 13:52:35 +00:00
numItems ++ ;
2025-08-23 16:06:48 +02:00
gDropdown . items [ numItems ] = Dropdown :: MenuLabel ( STR_TITLE_SEQUENCE_RANDOM );
2024-03-10 13:52:35 +00:00
numItems ++ ;
WindowDropdownShowText (
2025-12-12 18:26:05 +01:00
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height (), colours [ 1 ],
2024-03-10 13:52:35 +00:00
Dropdown :: Flag :: StayOpen , numItems );
2025-10-07 20:14:37 +02:00
auto selectedIndex = Config :: Get (). interface . randomTitleSequence
2024-05-10 12:10:21 +02:00
? numItems - 1
: static_cast < int32_t > ( TitleGetCurrentSequence ());
2025-08-23 14:09:40 +02:00
gDropdown . items [ selectedIndex ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
}
2025-05-21 18:07:19 +02:00
case WIDX_SCENARIO_PREVIEWS_DROPDOWN :
{
uint32_t numItems = 2 ;
2025-08-23 16:06:48 +02:00
gDropdown . items [ 0 ] = Dropdown :: MenuLabel ( STR_SCENARIO_PREVIEWS_MINIMAPS );
gDropdown . items [ 1 ] = Dropdown :: MenuLabel ( STR_SCENARIO_PREVIEWS_SCREENSHOTS );
2025-05-21 18:07:19 +02:00
WindowDropdownShowTextCustomWidth (
2025-12-12 18:26:05 +01:00
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height (), colours [ 1 ], 0 ,
2025-11-08 10:27:58 +01:00
Dropdown :: Flag :: StayOpen , numItems , widget -> width () - 4 );
2025-05-21 18:07:19 +02:00
2025-08-23 14:09:40 +02:00
gDropdown . items [ Config :: Get (). interface . scenarioPreviewScreenshots ]. setChecked ( true );
2025-05-21 18:07:19 +02:00
break ;
}
2024-03-10 13:52:35 +00:00
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN :
for ( size_t i = 0 ; i < 7 ; i ++ )
{
2025-08-23 16:06:48 +02:00
gDropdown . items [ i ] = Dropdown :: MenuLabel ( kRideInspectionIntervalNames [ i ]);
2024-03-10 13:52:35 +00:00
}
ShowDropdown ( widget , 7 );
2025-12-12 23:38:03 +01:00
auto selectedIndex = EnumValue ( Config :: Get (). general . defaultInspectionInterval );
gDropdown . items [ selectedIndex ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
void MiscDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
{
switch ( widgetIndex )
{
case WIDX_TITLE_SEQUENCE_DROPDOWN :
{
2024-07-26 09:59:58 +02:00
auto numItems = static_cast < int32_t > ( TitleSequenceManager :: GetCount ());
2024-03-10 13:52:35 +00:00
if ( dropdownIndex < numItems && dropdownIndex != static_cast < int32_t > ( TitleGetCurrentSequence ()))
{
2025-10-07 20:14:37 +02:00
Config :: Get (). interface . randomTitleSequence = false ;
2024-03-10 13:52:35 +00:00
TitleSequenceChangePreset ( static_cast < size_t > ( dropdownIndex ));
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
}
else if ( dropdownIndex == numItems + 1 )
{
2025-10-07 20:14:37 +02:00
Config :: Get (). interface . randomTitleSequence = true ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
}
break ;
}
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN :
2025-12-12 23:38:03 +01:00
if ( dropdownIndex != EnumValue ( Config :: Get (). general . defaultInspectionInterval ))
2024-03-10 13:52:35 +00:00
{
2025-12-12 23:38:03 +01:00
Config :: Get (). general . defaultInspectionInterval = static_cast < RideInspection > ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
}
break ;
2025-05-21 18:07:19 +02:00
case WIDX_SCENARIO_PREVIEWS_DROPDOWN :
if ( dropdownIndex != static_cast < int32_t > ( Config :: Get (). interface . scenarioPreviewScreenshots ))
{
Config :: Get (). interface . scenarioPreviewScreenshots = dropdownIndex ;
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2026-01-16 04:38:20 -03:00
auto * windowMgr = GetWindowManager ();
2025-09-17 23:18:52 +02:00
windowMgr -> InvalidateByClass ( WindowClass :: scenarioSelect );
2025-05-21 18:07:19 +02:00
}
break ;
2024-03-10 13:52:35 +00:00
}
}
void MiscPrepareDraw ()
{
2025-10-07 20:14:37 +02:00
if ( Config :: Get (). interface . randomTitleSequence )
2024-03-10 13:52:35 +00:00
{
2026-03-16 14:01:38 +01:00
_dropdownCaption = LanguageGetString ( STR_TITLE_SEQUENCE_RANDOM );
2024-03-10 13:52:35 +00:00
}
else
{
2026-03-16 14:01:38 +01:00
_dropdownCaption = TitleSequenceManager :: GetName ( TitleGetConfigSequence ());
2024-03-10 13:52:35 +00:00
}
2026-03-16 14:01:38 +01:00
widgets [ WIDX_TITLE_SEQUENCE ]. setString ( _dropdownCaption . c_str ());
2024-03-10 13:52:35 +00:00
// 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
2025-08-31 16:02:43 +02:00
if ( Network :: GetMode () != Network :: Mode :: none )
2024-03-10 13:52:35 +00:00
{
2025-09-17 19:03:29 +02:00
disabledWidgets |= ( 1uLL << WIDX_REAL_NAMES_GUESTS_CHECKBOX ) | ( 1uLL << WIDX_REAL_NAMES_STAFF_CHECKBOX );
2024-09-15 22:18:00 +02:00
widgets [ WIDX_REAL_NAMES_GUESTS_CHECKBOX ]. tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY ;
widgets [ WIDX_REAL_NAMES_STAFF_CHECKBOX ]. tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY ;
2024-03-10 13:52:35 +00:00
// Disable the use of the allow_early_completion option during network play on clients.
// This is to prevent confusion on clients because changing this setting during network play wouldn't change
// the way scenarios are completed during this network-session
2025-08-31 16:02:43 +02:00
if ( Network :: GetMode () == Network :: Mode :: client )
2024-03-10 13:52:35 +00:00
{
2025-09-17 19:03:29 +02:00
disabledWidgets |= ( 1uLL << WIDX_ALLOW_EARLY_COMPLETION );
2024-03-10 13:52:35 +00:00
widgets [ WIDX_ALLOW_EARLY_COMPLETION ]. tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY ;
}
}
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_REAL_NAMES_GUESTS_CHECKBOX , Config :: Get (). general . showRealNamesOfGuests );
setCheckboxValue ( WIDX_REAL_NAMES_STAFF_CHECKBOX , Config :: Get (). general . showRealNamesOfStaff );
setCheckboxValue ( WIDX_AUTO_STAFF_PLACEMENT , Config :: Get (). general . autoStaffPlacement );
setCheckboxValue ( WIDX_AUTO_OPEN_SHOPS , Config :: Get (). general . autoOpenShops );
setCheckboxValue ( WIDX_ALLOW_EARLY_COMPLETION , Config :: Get (). general . allowEarlyCompletion );
2024-03-10 13:52:35 +00:00
2025-05-21 18:07:19 +02:00
if ( Config :: Get (). interface . scenarioPreviewScreenshots )
widgets [ WIDX_SCENARIO_PREVIEWS ]. text = STR_SCENARIO_PREVIEWS_SCREENSHOTS ;
else
widgets [ WIDX_SCENARIO_PREVIEWS ]. text = STR_SCENARIO_PREVIEWS_MINIMAPS ;
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_SCENARIO_UNLOCKING , Config :: Get (). general . scenarioUnlockingEnabled );
2024-03-10 13:52:35 +00:00
2025-12-12 23:38:03 +01:00
auto selectedIndex = EnumValue ( Config :: Get (). general . defaultInspectionInterval );
widgets [ WIDX_DEFAULT_INSPECTION_INTERVAL ]. text = kRideInspectionIntervalNames [ selectedIndex ];
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
#pragma endregion
#pragma region Advanced tab events
2024-03-10 13:52:35 +00:00
void AdvancedMouseUp ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
case WIDX_DEBUGGING_TOOLS :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . debuggingTools ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
break ;
2025-05-04 15:30:49 +02:00
case WIDX_EXPORT_CUSTOM_OBJECTS_CHECKBOX :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . savePluginData ^= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_STAY_CONNECTED_AFTER_DESYNC :
2025-10-07 20:14:37 +02:00
Config :: Get (). network . stayConnected = ! Config :: Get (). network . stayConnected ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_ALWAYS_NATIVE_LOADSAVE :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . useNativeBrowseDialog = ! Config :: Get (). general . useNativeBrowseDialog ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
2025-05-04 15:30:49 +02:00
case WIDX_PATH_TO_RCT1_BROWSE :
2021-10-15 11:41:30 +02:00
{
2026-01-16 04:38:20 -03:00
auto rct1path = GetContext () -> GetUiContext (). ShowDirectoryDialog (
2024-03-10 13:52:35 +00:00
LanguageGetString ( STR_PATH_TO_RCT1_BROWSER ));
if ( ! rct1path . empty ())
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
// Check if this directory actually contains RCT1
if ( Csg1datPresentAtLocation ( rct1path ))
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
if ( Csg1idatPresentAtLocation ( rct1path ))
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
if ( CsgAtLocationIsUsable ( rct1path ))
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . rct1Path = std :: move ( rct1path );
2025-05-21 18:07:19 +02:00
Config :: Get (). interface . scenarioSelectLastTab = 0 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-01-19 16:59:45 +01:00
ContextShowError ( STR_RESTART_REQUIRED , kStringIdNone , {});
2024-03-10 13:52:35 +00:00
}
else
{
2025-01-19 16:59:45 +01:00
ContextShowError ( STR_PATH_TO_RCT1_IS_WRONG_VERSION , kStringIdNone , {});
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
}
else
{
2025-01-19 16:59:45 +01:00
ContextShowError ( STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT , kStringIdNone , {});
2021-10-15 11:41:30 +02:00
}
2020-10-04 17:08:10 +02:00
}
else
{
2025-01-19 16:59:45 +01:00
ContextShowError ( STR_PATH_TO_RCT1_WRONG_ERROR , kStringIdNone , {});
2020-10-04 17:08:10 +02:00
}
}
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
}
case WIDX_PATH_TO_RCT1_CLEAR :
2025-10-07 20:14:37 +02:00
if ( ! Config :: Get (). general . rct1Path . empty ())
2020-10-04 17:08:10 +02:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . rct1Path . clear ();
2024-05-10 12:10:21 +02:00
Config :: Save ();
2020-10-04 17:08:10 +02:00
}
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_ASSET_PACKS :
2025-09-17 23:18:52 +02:00
ContextOpenWindow ( WindowClass :: assetPacks );
2024-03-10 13:52:35 +00:00
break ;
2024-12-31 09:31:33 -06:00
#ifdef __EMSCRIPTEN__
case WIDX_EXPORT_EMSCRIPTEN_DATA :
2025-01-17 09:33:05 -06:00
ExportPersistentData ();
2024-12-31 09:31:33 -06:00
break ;
case WIDX_IMPORT_EMSCRIPTEN_DATA :
2025-01-17 09:33:05 -06:00
ImportPersistentData ();
2024-12-31 09:31:33 -06:00
break ;
#endif
2021-10-15 11:41:30 +02:00
}
2020-10-04 17:08:10 +02:00
}
2024-03-10 13:52:35 +00:00
void AdvancedMouseDown ( WidgetIndex widgetIndex )
2017-12-10 16:27:40 +01:00
{
2024-03-10 13:52:35 +00:00
Widget * widget = & widgets [ widgetIndex - 1 ];
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
{
case WIDX_AUTOSAVE_FREQUENCY_DROPDOWN :
for ( size_t i = AUTOSAVE_EVERY_MINUTE ; i <= AUTOSAVE_NEVER ; i ++ )
{
2025-08-23 16:06:48 +02:00
gDropdown . items [ i ] = Dropdown :: MenuLabel ( AutosaveNames [ i ]);
2024-03-10 13:52:35 +00:00
}
ShowDropdown ( widget , AUTOSAVE_NEVER + 1 );
2025-10-07 20:14:37 +02:00
gDropdown . items [ Config :: Get (). general . autosaveFrequency ]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_AUTOSAVE_AMOUNT_UP :
2025-10-07 20:14:37 +02:00
Config :: Get (). general . autosaveAmount += 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_AUTOSAVE_FREQUENCY );
invalidateWidget ( WIDX_AUTOSAVE_FREQUENCY_DROPDOWN );
invalidateWidget ( WIDX_AUTOSAVE_AMOUNT );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_AUTOSAVE_AMOUNT_DOWN :
2025-10-07 20:14:37 +02:00
if ( Config :: Get (). general . autosaveAmount > 1 )
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . autosaveAmount -= 1 ;
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_AUTOSAVE_FREQUENCY );
invalidateWidget ( WIDX_AUTOSAVE_FREQUENCY_DROPDOWN );
invalidateWidget ( WIDX_AUTOSAVE_AMOUNT );
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
}
}
2024-03-10 13:52:35 +00:00
void AdvancedDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
{
switch ( widgetIndex )
{
case WIDX_AUTOSAVE_FREQUENCY_DROPDOWN :
2025-10-07 20:14:37 +02:00
if ( dropdownIndex != Config :: Get (). general . autosaveFrequency )
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
Config :: Get (). general . autosaveFrequency = static_cast < uint8_t > ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
}
break ;
}
}
void AdvancedPrepareDraw ()
{
2025-10-07 20:14:37 +02:00
if ( ! Config :: Get (). general . rct1Path . empty ())
2025-05-04 15:30:49 +02:00
{
2025-06-10 19:55:12 +02:00
widgets [ WIDX_PATH_TO_RCT1_PATH ]. type = WidgetType :: label ;
widgets [ WIDX_PATH_TO_RCT1_BROWSE ]. type = WidgetType :: empty ;
widgets [ WIDX_PATH_TO_RCT1_CLEAR ]. type = WidgetType :: button ;
2025-05-04 15:30:49 +02:00
// Get 'Clear' button string width
2025-05-12 17:53:46 +02:00
auto clearLabel = LanguageGetString ( STR_CLEAR_BUTTON );
2026-03-22 14:22:00 +01:00
auto clearLabelWidth = getStringWidth ( clearLabel , FontStyle :: medium ) + 12 ;
2025-05-04 15:30:49 +02:00
widgets [ WIDX_PATH_TO_RCT1_CLEAR ]. right = widgets [ WIDX_PAGE_BACKGROUND ]. right - 12 ;
widgets [ WIDX_PATH_TO_RCT1_CLEAR ]. left = widgets [ WIDX_PATH_TO_RCT1_BROWSE ]. right - clearLabelWidth ;
}
else
{
2025-06-10 19:55:12 +02:00
widgets [ WIDX_PATH_TO_RCT1_PATH ]. type = WidgetType :: empty ;
widgets [ WIDX_PATH_TO_RCT1_BROWSE ]. type = WidgetType :: button ;
widgets [ WIDX_PATH_TO_RCT1_CLEAR ]. type = WidgetType :: empty ;
2025-05-04 15:30:49 +02:00
// Get 'Browse' button string width
auto browseLabel = LanguageGetString ( STR_BROWSE );
2026-03-22 14:22:00 +01:00
auto browseLabelWidth = getStringWidth ( browseLabel , FontStyle :: medium ) + 12 ;
2025-05-04 15:30:49 +02:00
widgets [ WIDX_PATH_TO_RCT1_BROWSE ]. right = widgets [ WIDX_PAGE_BACKGROUND ]. right - 12 ;
widgets [ WIDX_PATH_TO_RCT1_BROWSE ]. left = widgets [ WIDX_PATH_TO_RCT1_BROWSE ]. right - browseLabelWidth ;
}
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_EXPORT_CUSTOM_OBJECTS_CHECKBOX , Config :: Get (). general . savePluginData );
setCheckboxValue ( WIDX_ALWAYS_NATIVE_LOADSAVE , Config :: Get (). general . useNativeBrowseDialog );
widgets [ WIDX_AUTOSAVE_FREQUENCY ]. text = AutosaveNames [ Config :: Get (). general . autosaveFrequency ];
2025-05-04 15:30:49 +02:00
2025-10-07 20:14:37 +02:00
setCheckboxValue ( WIDX_DEBUGGING_TOOLS , Config :: Get (). general . debuggingTools );
setCheckboxValue ( WIDX_STAY_CONNECTED_AFTER_DESYNC , Config :: Get (). network . stayConnected );
2025-05-04 15:30:49 +02:00
#ifdef __EMSCRIPTEN__
widgets [ WIDX_GROUP_ADVANCED ]. bottom = kAdvancedStart + 84 + getTitleBarDiffNormal ();
#else
widgets [ WIDX_GROUP_ADVANCED ]. bottom = kAdvancedStart + 64 + getTitleBarDiffNormal ();
#endif
widgets [ WIDX_ASSET_PACKS ]. top = widgets [ WIDX_GROUP_ADVANCED ]. bottom - 20 ;
widgets [ WIDX_ASSET_PACKS ]. bottom = widgets [ WIDX_GROUP_ADVANCED ]. bottom - 6 ;
2024-03-10 13:52:35 +00:00
}
2026-01-13 23:41:59 +01:00
void AdvancedDraw ( RenderTarget & rt )
2024-03-10 13:52:35 +00:00
{
auto ft = Formatter ();
2026-01-08 09:34:44 -03:00
ft . Add < int32_t > ( Config :: Get (). general . autosaveAmount );
2026-03-22 18:58:24 +01:00
DrawText (
2025-05-05 01:06:46 +03:00
rt , windowPos + ScreenCoordsXY { widgets [ WIDX_AUTOSAVE_AMOUNT ]. left + 1 , widgets [ WIDX_AUTOSAVE_AMOUNT ]. top + 1 },
2024-03-14 19:49:57 +01:00
STR_WINDOW_COLOUR_2_COMMA32 , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
2025-05-04 15:30:49 +02:00
// Format RCT1 path
2025-10-07 20:14:37 +02:00
const auto normalisedPath = Platform :: StrDecompToPrecomp ( Config :: Get (). general . rct1Path );
2024-03-10 13:52:35 +00:00
ft = Formatter ();
2025-05-04 15:30:49 +02:00
ft . Add < StringId > ( STR_STRING );
2024-03-10 13:52:35 +00:00
ft . Add < const utf8 *> ( normalisedPath . c_str ());
2025-05-04 15:30:49 +02:00
auto & pathWidget = widgets [ WIDX_PATH_TO_RCT1_PATH ];
2024-03-10 13:52:35 +00:00
int32_t widgetHeight = pathWidget . bottom - pathWidget . top ;
2025-05-04 15:30:49 +02:00
// Apply vertical alignment if font height requires it
2025-10-16 20:20:46 +02:00
int32_t lineHeight = FontGetLineHeight ( FontStyle :: medium );
2025-05-04 15:30:49 +02:00
int32_t padding = widgetHeight > lineHeight ? ( widgetHeight - lineHeight ) / 2 : 0 ;
auto screenCoords = windowPos + ScreenCoordsXY { pathWidget . left + 1 , pathWidget . top + padding };
2025-11-08 10:27:58 +01:00
DrawTextEllipsised ( rt , screenCoords , pathWidget . width () - 1 , STR_BLACK_STRING , ft );
2024-03-10 13:52:35 +00:00
}
2026-03-01 07:46:37 -03:00
StringWithArgs AdvancedTooltip ( WidgetIndex widgetIndex , StringId fallback )
2024-03-10 13:52:35 +00:00
{
2025-05-04 15:30:49 +02:00
if ( widgetIndex == WIDX_PATH_TO_RCT1_PATH )
2024-03-10 13:52:35 +00:00
{
2025-10-07 20:14:37 +02:00
if ( Config :: Get (). general . rct1Path . empty ())
2024-03-10 13:52:35 +00:00
{
// No tooltip if the path is empty
2025-01-19 16:59:45 +01:00
return { kStringIdNone , {} };
2024-03-10 13:52:35 +00:00
}
auto ft = Formatter ();
2025-10-07 20:14:37 +02:00
ft . Add < utf8 *> ( Config :: Get (). general . rct1Path . c_str ());
2024-03-10 13:52:35 +00:00
return { fallback , ft };
}
return { fallback , {} };
}
2021-10-15 11:41:30 +02:00
#pragma endregion
2025-09-17 20:10:06 +02:00
void setPage ( int32_t p )
2021-10-15 11:41:30 +02:00
{
2025-03-12 19:50:19 +01:00
// Skip setting page if we're already on this page, unless we're initialising the window
if ( page == p && ! widgets . empty ())
return ;
2024-03-10 13:52:35 +00:00
page = p ;
2025-09-17 19:03:29 +02:00
currentFrame = 0 ;
pressedWidgets = 0 ;
2025-09-17 20:10:06 +02:00
setWidgets ( window_options_page_widgets [ page ]);
2024-03-10 13:52:35 +00:00
2025-09-17 20:10:06 +02:00
invalidate ();
onPrepareDraw ();
onResize ();
initScrollWidgets ();
invalidate ();
2024-03-10 13:52:35 +00:00
}
void SetPressedTab ()
{
for ( int32_t i = 0 ; i < WINDOW_OPTIONS_PAGE_COUNT ; i ++ )
2025-09-17 19:03:29 +02:00
pressedWidgets &= ~ ( 1 << ( WIDX_FIRST_TAB + i ));
pressedWidgets |= 1LL << ( WIDX_FIRST_TAB + page );
2024-03-10 13:52:35 +00:00
}
void ShowDropdown ( Widget * widget , int32_t num_items )
{
// helper function, all dropdown boxes have similar properties
WindowDropdownShowTextCustomWidth (
2025-12-12 18:26:05 +01:00
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height (), colours [ 1 ], 0 ,
2025-11-08 10:27:58 +01:00
Dropdown :: Flag :: StayOpen , num_items , widget -> width () - 4 );
2024-03-10 13:52:35 +00:00
}
2026-01-13 23:41:59 +01:00
void DrawTabImages ( RenderTarget & rt )
2024-03-10 13:52:35 +00:00
{
2025-05-05 01:06:46 +03:00
DrawTabImage ( rt , WINDOW_OPTIONS_PAGE_DISPLAY , SPR_G2_MONITOR_TAB_START );
DrawTabImage ( rt , WINDOW_OPTIONS_PAGE_RENDERING , SPR_G2_TAB_TREE );
DrawTabImage ( rt , WINDOW_OPTIONS_PAGE_CULTURE , SPR_TAB_TIMER_0 );
DrawTabImage ( rt , WINDOW_OPTIONS_PAGE_AUDIO , SPR_TAB_MUSIC_0 );
DrawTabImage ( rt , WINDOW_OPTIONS_PAGE_INTERFACE , SPR_TAB_PAINT_0 );
DrawTabImage ( rt , WINDOW_OPTIONS_PAGE_CONTROLS , SPR_G2_CONTROLS_TAB_START );
DrawTabImage ( rt , WINDOW_OPTIONS_PAGE_MISC , SPR_TAB_RIDE_0 );
DrawTabImage ( rt , WINDOW_OPTIONS_PAGE_ADVANCED , SPR_TAB_WRENCH_0 );
2024-03-10 13:52:35 +00:00
}
2026-01-13 23:41:59 +01:00
void DrawTabImage ( RenderTarget & rt , int32_t p , int32_t spriteIndex )
2024-03-10 13:52:35 +00:00
{
WidgetIndex widgetIndex = WIDX_FIRST_TAB + p ;
Widget * widget = & widgets [ widgetIndex ];
auto screenCoords = windowPos + ScreenCoordsXY { widget -> left , widget -> top };
2025-06-10 21:57:53 +02:00
if ( ! widgetIsDisabled ( * this , widgetIndex ))
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
if ( page == p )
{
2025-09-17 19:03:29 +02:00
int32_t frame = currentFrame / TabAnimationDivisor [ page ];
2024-03-10 13:52:35 +00:00
spriteIndex += ( frame % TabAnimationFrames [ page ]);
}
// Draw normal, enabled sprite.
2025-05-05 01:06:46 +03:00
GfxDrawSprite ( rt , ImageId ( spriteIndex ), screenCoords );
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
else
{
// Get the window background colour
2024-05-09 02:45:07 +02:00
auto windowColour = colours [ widget -> colour ]. colour ;
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
// Draw greyed out (light border bottom right shadow)
GfxDrawSpriteSolid (
2026-01-13 23:41:59 +01:00
rt , ImageId ( spriteIndex ), screenCoords + ScreenCoordsXY { 1 , 1 }, getColourMap ( windowColour ). lighter );
2024-03-10 13:52:35 +00:00
// Draw greyed out (dark)
2026-01-13 23:41:59 +01:00
GfxDrawSpriteSolid ( rt , ImageId ( spriteIndex ), screenCoords , getColourMap ( windowColour ). midLight );
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
void UpdateHeightMarkers ()
2021-10-15 11:41:30 +02:00
{
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
2021-10-15 11:41:30 +02:00
}
2024-08-11 16:21:53 +02:00
uint8_t GetScrollPercentage ( const Widget & widget , const ScrollArea & scroll )
2024-03-10 13:52:35 +00:00
{
2025-11-08 10:27:58 +01:00
uint8_t w = widget . width () - 2 ;
2024-08-11 16:21:53 +02:00
return static_cast < float > ( scroll . contentOffsetX ) / ( scroll . contentWidth - w ) * 100 ;
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
2025-09-17 20:10:06 +02:00
void initialiseScrollPosition ( WidgetIndex widgetIndex , int32_t scrollId , uint8_t volume )
2024-03-10 13:52:35 +00:00
{
const auto & widget = widgets [ widgetIndex ];
auto & scroll = scrolls [ scrollId ];
2021-10-15 11:41:30 +02:00
2025-11-08 10:27:58 +01:00
int32_t widgetSize = scroll . contentWidth - ( widget . width () - 2 );
2024-08-11 16:21:53 +02:00
scroll . contentOffsetX = ceil ( volume / 100.0f * widgetSize );
2021-10-15 11:41:30 +02:00
2025-06-10 21:57:53 +02:00
widgetScrollUpdateThumbs ( * this , widgetIndex );
2024-03-10 13:52:35 +00:00
}
2021-10-15 11:41:30 +02:00
2025-09-17 20:10:06 +02:00
static bool isRCT1TitleMusicAvailable ()
2024-03-10 13:52:35 +00:00
{
2025-05-15 22:46:06 +03:00
auto & env = GetContext () -> GetPlatformEnvironment ();
auto rct1path = env . GetDirectoryPath ( DirBase :: rct1 );
2024-03-10 13:52:35 +00:00
return ! rct1path . empty ();
}
2022-01-29 21:52:33 +00:00
2024-03-10 13:52:35 +00:00
static constexpr StringId AutosaveNames [] = {
STR_SAVE_EVERY_MINUTE , STR_SAVE_EVERY_5MINUTES , STR_SAVE_EVERY_15MINUTES ,
STR_SAVE_EVERY_30MINUTES , STR_SAVE_EVERY_HOUR , STR_SAVE_NEVER ,
};
2022-07-25 15:26:28 +01:00
2024-03-10 13:52:35 +00:00
static constexpr struct
{
TitleMusicKind Kind ;
StringId Name ;
} TitleThemeOptions [] = {
{ TitleMusicKind :: None , STR_OPTIONS_MUSIC_VALUE_NONE },
{ TitleMusicKind :: OpenRCT2 , STR_OPENRCT2_DROPDOWN },
{ TitleMusicKind :: RCT1 , STR_ROLLERCOASTER_TYCOON_1_DROPDOWN },
{ TitleMusicKind :: RCT2 , STR_ROLLERCOASTER_TYCOON_2_DROPDOWN },
{ TitleMusicKind :: Random , STR_OPTIONS_MUSIC_VALUE_RANDOM },
};
static constexpr StringId FullscreenModeNames [] = {
STR_OPTIONS_DISPLAY_WINDOWED ,
STR_OPTIONS_DISPLAY_FULLSCREEN ,
STR_OPTIONS_DISPLAY_FULLSCREEN_BORDERLESS ,
};
static constexpr int32_t TabAnimationDivisor [] = {
4 , // WINDOW_OPTIONS_PAGE_DISPLAY,
1 , // WINDOW_OPTIONS_PAGE_RENDERING,
8 , // WINDOW_OPTIONS_PAGE_CULTURE,
2 , // WINDOW_OPTIONS_PAGE_AUDIO,
2025-04-18 16:40:38 +02:00
4 , // WINDOW_OPTIONS_PAGE_INTERFACE,
2025-04-20 15:02:40 +02:00
8 , // WINDOW_OPTIONS_PAGE_CONTROLS,
2024-03-10 13:52:35 +00:00
4 , // WINDOW_OPTIONS_PAGE_MISC,
2 , // WINDOW_OPTIONS_PAGE_ADVANCED,
};
static constexpr int32_t TabAnimationFrames [] = {
2025-04-17 07:45:03 -07:00
SPR_G2_MONITOR_TAB_END - SPR_G2_MONITOR_TAB_START , // WINDOW_OPTIONS_PAGE_DISPLAY,
1 , // WINDOW_OPTIONS_PAGE_RENDERING,
8 , // WINDOW_OPTIONS_PAGE_CULTURE,
16 , // WINDOW_OPTIONS_PAGE_AUDIO,
2025-04-18 16:40:38 +02:00
8 , // WINDOW_OPTIONS_PAGE_INTERFACE,
2025-04-20 15:02:40 +02:00
8 , // WINDOW_OPTIONS_PAGE_CONTROLS,
2025-04-17 07:45:03 -07:00
16 , // WINDOW_OPTIONS_PAGE_MISC,
16 , // WINDOW_OPTIONS_PAGE_ADVANCED,
2024-03-10 13:52:35 +00:00
};
2022-01-29 21:52:33 +00:00
};
2024-03-10 13:52:35 +00:00
/**
*
* rct2: 0x006BAC5B
*/
2024-03-17 02:37:46 -04:00
WindowBase * OptionsOpen ()
2023-05-15 00:10:45 +02:00
{
2025-01-19 10:58:28 +01:00
auto * windowMgr = GetWindowManager ();
2025-09-20 21:46:42 +02:00
return windowMgr -> FocusOrCreate < OptionsWindow > ( WindowClass :: options , kWindowSize , WindowFlag :: centreScreen );
2024-03-10 13:52:35 +00:00
}
} // namespace OpenRCT2::Ui::Windows