2014-05-11 09:01:01 +02:00
/*****************************************************************************
2024-12-31 20:30:04 +01:00
* Copyright (c) 2014-2025 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>
2022-07-25 15:26:28 +01:00
#include <openrct2/PlatformEnvironment.h>
2025-02-13 10:51:46 -05:00
#include <openrct2/SpriteIds.h>
2021-03-18 20:30:11 +01:00
#include <openrct2/actions/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>
#include <openrct2/drawing/IDrawingEngine.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>
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>
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 ;
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 ,
WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE ,
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 ,
WIDX_TAB_CONTROLS_AND_INTERFACE ,
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
WIDX_HARDWARE_GROUP = WIDX_PAGE_START ,
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 ,
WIDX_DRAWING_ENGINE_LABEL ,
WIDX_DRAWING_ENGINE ,
WIDX_DRAWING_ENGINE_DROPDOWN ,
WIDX_STEAM_OVERLAY_PAUSE ,
WIDX_UNCAP_FPS_CHECKBOX ,
WIDX_SHOW_FPS_CHECKBOX ,
WIDX_MULTITHREADING_CHECKBOX ,
WIDX_USE_VSYNC_CHECKBOX ,
WIDX_MINIMIZE_FOCUS_LOSS ,
WIDX_DISABLE_SCREENSAVER_LOCK ,
2016-01-31 19:26:28 +01:00
2024-09-04 21:11:26 +02:00
// Rendering
WIDX_RENDERING_GROUP = WIDX_PAGE_START ,
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
2024-09-04 21:11:26 +02:00
// Controls and interface
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 ,
WIDX_THEMES_GROUP ,
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
2024-09-04 21:11:26 +02:00
// Misc
WIDX_TITLE_SEQUENCE_GROUP = WIDX_PAGE_START ,
WIDX_TITLE_SEQUENCE ,
WIDX_TITLE_SEQUENCE_DROPDOWN ,
WIDX_SCENARIO_GROUP ,
WIDX_SCENARIO_GROUPING_LABEL ,
WIDX_SCENARIO_GROUPING ,
WIDX_SCENARIO_GROUPING_DROPDOWN ,
WIDX_SCENARIO_UNLOCKING ,
WIDX_SCENARIO_OPTIONS_GROUP ,
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
WIDX_DEBUGGING_TOOLS = WIDX_PAGE_START ,
WIDX_SAVE_PLUGIN_DATA_CHECKBOX ,
WIDX_STAY_CONNECTED_AFTER_DESYNC ,
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 ,
WIDX_PATH_TO_RCT1_TEXT ,
WIDX_PATH_TO_RCT1_BUTTON ,
WIDX_PATH_TO_RCT1_CLEAR ,
WIDX_ASSET_PACKS ,
2024-12-31 09:31:33 -06:00
#ifdef __EMSCRIPTEN__
WIDX_EXPORT_EMSCRIPTEN_DATA ,
WIDX_IMPORT_EMSCRIPTEN_DATA ,
#endif
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
static constexpr StringId WINDOW_TITLE = STR_OPTIONS_TITLE ;
static constexpr int32_t WW = 310 ;
static constexpr int32_t WH = 332 ;
2014-07-24 16:57:02 +02:00
2024-09-04 21:11:26 +02:00
#define MAIN_OPTIONS_WIDGETS \
WINDOW_SHIM(WINDOW_TITLE, WW, WH), \
MakeWidget({ 0, 43 }, { WW, 289 }, WindowWidgetType::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_CONTROLS_AND_INTERFACE_TIP), \
MakeTab({ 158, 17 }, STR_OPTIONS_MISCELLANEOUS_TIP), \
MakeTab({ 189, 17 }, STR_OPTIONS_ADVANCED)
2014-08-16 15:29:15 +01:00
2025-01-18 14:45:17 +02:00
static constexpr Widget window_options_display_widgets [] = {
2024-09-04 21:11:26 +02:00
MAIN_OPTIONS_WIDGETS ,
MakeWidget ({ 5 , 53 }, { 300 , 170 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_HARDWARE_GROUP ), // Hardware group
MakeWidget ({ 10 , 67 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_FULLSCREEN_MODE , STR_FULLSCREEN_MODE_TIP ), // Fullscreen
MakeWidget ({ 155 , 68 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ),
MakeWidget ({ 288 , 69 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_FULLSCREEN_MODE_TIP ),
MakeWidget ({ 24 , 82 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_DISPLAY_RESOLUTION , STR_DISPLAY_RESOLUTION_TIP ), // Resolution
MakeWidget ({ 155 , 83 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary , STR_ARG_16_RESOLUTION_X_BY_Y ),
MakeWidget ({ 288 , 84 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_DISPLAY_RESOLUTION_TIP ),
MakeWidget ({ 10 , 98 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_UI_SCALING_DESC , STR_WINDOW_SCALE_TIP ), // Scale
2025-01-19 16:59:45 +01:00
MakeSpinnerWidgets ({ 155 , 98 }, { 145 , 12 }, WindowWidgetType :: Spinner , WindowColour :: Secondary , kStringIdNone , STR_WINDOW_SCALE_TIP ), // Scale spinner (3 widgets)
2024-09-04 21:11:26 +02:00
MakeWidget ({ 10 , 113 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_DRAWING_ENGINE , STR_DRAWING_ENGINE_TIP ), // Drawing engine
MakeWidget ({ 155 , 113 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ), // Drawing engine
MakeWidget ({ 288 , 114 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_DRAWING_ENGINE_TIP ),
MakeWidget ({ 11 , 144 }, { 280 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_STEAM_OVERLAY_PAUSE , STR_STEAM_OVERLAY_PAUSE_TIP ), // Pause on steam overlay
MakeWidget ({ 11 , 161 }, { 143 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_UNCAP_FPS , STR_UNCAP_FPS_TIP ), // Uncap fps
MakeWidget ({ 155 , 161 }, { 136 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_SHOW_FPS , STR_SHOW_FPS_TIP ), // Show fps
MakeWidget ({ 155 , 176 }, { 136 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_MULTITHREADING , STR_MULTITHREADING_TIP ), // Multithreading
MakeWidget ({ 11 , 176 }, { 143 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_USE_VSYNC , STR_USE_VSYNC_TIP ), // Use vsync
MakeWidget ({ 11 , 191 }, { 280 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS , STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS_TIP ), // Minimise fullscreen focus loss
MakeWidget ({ 11 , 206 }, { 280 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_DISABLE_SCREENSAVER , STR_DISABLE_SCREENSAVER_TIP ), // Disable screensaver
};
2015-07-26 14:37:27 +02:00
2024-09-04 21:11:26 +02:00
constexpr int32_t kFrameRenderingStart = 53 ;
constexpr int32_t kFrameEffectStart = 163 ;
2024-05-18 06:37:42 -04:00
2025-01-18 14:45:17 +02:00
static constexpr Widget window_options_rendering_widgets [] = {
2024-09-04 21:11:26 +02:00
MAIN_OPTIONS_WIDGETS ,
MakeWidget ({ 5 , kFrameRenderingStart + 0 }, { 300 , 108 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_RENDERING_GROUP ), // Rendering group
MakeWidget ({ 10 , kFrameRenderingStart + 15 }, { 281 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_TILE_SMOOTHING , STR_TILE_SMOOTHING_TIP ), // Landscape smoothing
MakeWidget ({ 10 , kFrameRenderingStart + 30 }, { 281 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_GRIDLINES , STR_GRIDLINES_TIP ), // Gridlines
MakeWidget ({ 10 , kFrameRenderingStart + 45 }, { 281 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_UPPERCASE_BANNERS , STR_UPPERCASE_BANNERS_TIP ), // Uppercase banners
MakeWidget ({ 10 , kFrameRenderingStart + 60 }, { 281 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_SHOW_GUEST_PURCHASES , STR_SHOW_GUEST_PURCHASES_TIP ), // Guest purchases
MakeWidget ({ 10 , kFrameRenderingStart + 75 }, { 281 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_TRANSPARENT_SCREENSHOT , STR_TRANSPARENT_SCREENSHOT_TIP ), // Transparent screenshot
MakeWidget ({ 10 , kFrameRenderingStart + 90 }, { 281 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_VIRTUAL_FLOOR_STYLE , STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor
2025-01-19 16:59:45 +01:00
MakeWidget ({ 155 , kFrameRenderingStart + 90 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary , kStringIdNone , STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor dropdown
2024-09-04 21:11:26 +02:00
MakeWidget ({ 288 , kFrameRenderingStart + 91 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor dropdown
2024-05-18 06:37:42 -04:00
2024-09-04 21:11:26 +02:00
MakeWidget ({ 5 , kFrameEffectStart + 0 }, { 300 , 94 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_EFFECTS_GROUP ), // Rendering group
MakeWidget ({ 10 , kFrameEffectStart + 15 }, { 281 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_CYCLE_DAY_NIGHT , STR_CYCLE_DAY_NIGHT_TIP ), // Cycle day-night
MakeWidget ({ 25 , kFrameEffectStart + 30 }, { 266 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_ENABLE_LIGHTING_EFFECTS , STR_ENABLE_LIGHTING_EFFECTS_TIP ), // Enable light fx
MakeWidget ({ 40 , kFrameEffectStart + 45 }, { 251 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_ENABLE_LIGHTING_VEHICLES , STR_ENABLE_LIGHTING_VEHICLES_TIP ), // Enable light fx for vehicles
MakeWidget ({ 10 , kFrameEffectStart + 60 }, { 281 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_RENDER_WEATHER_EFFECTS , STR_RENDER_WEATHER_EFFECTS_TIP ), // Render weather effects
MakeWidget ({ 25 , kFrameEffectStart + 75 }, { 266 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_DISABLE_LIGHTNING_EFFECT , STR_DISABLE_LIGHTNING_EFFECT_TIP ), // Disable lightning effect
};
2014-08-16 15:29:15 +01:00
2025-01-18 14:45:17 +02:00
static constexpr Widget window_options_culture_widgets [] = {
2024-09-04 21:11:26 +02:00
MAIN_OPTIONS_WIDGETS ,
MakeWidget ({ 10 , 53 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_OPTIONS_LANGUAGE , STR_LANGUAGE_TIP ), // language
MakeWidget ({ 155 , 53 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary , STR_STRING ),
MakeWidget ({ 288 , 54 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_LANGUAGE_TIP ),
MakeWidget ({ 10 , 68 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_CURRENCY , STR_CURRENCY_TIP ), // Currency
MakeWidget ({ 155 , 68 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ),
MakeWidget ({ 288 , 69 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_CURRENCY_TIP ),
MakeWidget ({ 10 , 83 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_DISTANCE_AND_SPEED , STR_DISTANCE_AND_SPEED_TIP ), // Distance and speed
MakeWidget ({ 155 , 83 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ),
MakeWidget ({ 288 , 84 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_DISTANCE_AND_SPEED_TIP ),
MakeWidget ({ 10 , 98 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_TEMPERATURE , STR_TEMPERATURE_FORMAT_TIP ), // Temperature
MakeWidget ({ 155 , 98 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ),
MakeWidget ({ 288 , 99 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_TEMPERATURE_FORMAT_TIP ),
MakeWidget ({ 10 , 113 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_HEIGHT_LABELS , STR_HEIGHT_LABELS_UNITS_TIP ), // Height labels
MakeWidget ({ 155 , 113 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ),
MakeWidget ({ 288 , 114 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_HEIGHT_LABELS_UNITS_TIP ),
MakeWidget ({ 10 , 128 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_DATE_FORMAT , STR_DATE_FORMAT_TIP ), // Date format
MakeWidget ({ 155 , 128 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ),
MakeWidget ({ 288 , 129 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_DATE_FORMAT_TIP ),
};
2014-05-11 09:01:01 +02:00
2025-01-18 14:45:17 +02:00
static constexpr Widget window_options_audio_widgets [] = {
2024-09-04 21:11:26 +02:00
MAIN_OPTIONS_WIDGETS ,
MakeWidget ({ 10 , 53 }, { 290 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ), // Audio device
MakeWidget ({ 288 , 54 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_AUDIO_DEVICE_TIP ),
MakeWidget ({ 10 , 69 }, { 220 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_MASTER_VOLUME , STR_MASTER_VOLUME_TIP ), // Enable / disable master sound
MakeWidget ({ 10 , 84 }, { 220 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_SOUND_EFFECTS , STR_SOUND_EFFECTS_TIP ), // Enable / disable sound effects
MakeWidget ({ 10 , 99 }, { 220 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_RIDE_MUSIC , STR_RIDE_MUSIC_TIP ), // Enable / disable ride music
MakeWidget ({ 10 , 113 }, { 290 , 13 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_AUDIO_FOCUS , STR_AUDIO_FOCUS_TIP ), // Enable / disable audio disabled on focus lost
MakeWidget ({ 10 , 128 }, { 145 , 13 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_OPTIONS_MUSIC_LABEL , STR_TITLE_MUSIC_TIP ), // Title music label
MakeWidget ({ 155 , 127 }, { 145 , 13 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ), // Title music
MakeWidget ({ 288 , 128 }, { 11 , 11 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_TITLE_MUSIC_TIP ),
MakeWidget ({ 155 , 68 }, { 145 , 13 }, WindowWidgetType :: Scroll , WindowColour :: Secondary , SCROLL_HORIZONTAL ), // Master volume
MakeWidget ({ 155 , 83 }, { 145 , 13 }, WindowWidgetType :: Scroll , WindowColour :: Secondary , SCROLL_HORIZONTAL ), // Sound effect volume
MakeWidget ({ 155 , 98 }, { 145 , 13 }, WindowWidgetType :: Scroll , WindowColour :: Secondary , SCROLL_HORIZONTAL ), // Music volume
};
2015-06-04 14:51:54 -04:00
2024-09-04 21:11:26 +02:00
constexpr int32_t kControlsGroupStart = 53 ;
constexpr int32_t kThemesGroupStart = 193 ;
constexpr int32_t kToolbarGroupStart = 245 ;
2024-05-18 06:37:42 -04:00
2025-01-18 14:45:17 +02:00
static constexpr Widget window_options_controls_and_interface_widgets [] = {
2024-09-04 21:11:26 +02:00
MAIN_OPTIONS_WIDGETS ,
MakeWidget ({ 5 , kControlsGroupStart + 0 }, { 300 , 137 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_CONTROLS_GROUP ), // Controls group
MakeWidget ({ 10 , kControlsGroupStart + 13 }, { 290 , 14 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_SCREEN_EDGE_SCROLLING , STR_SCREEN_EDGE_SCROLLING_TIP ), // Edge scrolling
MakeWidget ({ 10 , kControlsGroupStart + 30 }, { 290 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_TRAP_MOUSE , STR_TRAP_MOUSE_TIP ), // Trap mouse
MakeWidget ({ 10 , kControlsGroupStart + 45 }, { 290 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_INVERT_RIGHT_MOUSE_DRAG , STR_INVERT_RIGHT_MOUSE_DRAG_TIP ), // Invert right mouse dragging
MakeWidget ({ 10 , kControlsGroupStart + 60 }, { 290 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_ZOOM_TO_CURSOR , STR_ZOOM_TO_CURSOR_TIP ), // Zoom to cursor
MakeWidget ({ 10 , kControlsGroupStart + 75 }, { 290 , 12 }, WindowWidgetType :: 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 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_ENLARGED_UI , STR_ENLARGED_UI_TIP ),
MakeWidget ({ 25 , kControlsGroupStart + 105 }, { 275 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_TOUCH_ENHANCEMENTS , STR_TOUCH_ENHANCEMENTS_TIP ),
MakeWidget ({ 155 , kControlsGroupStart + 120 }, { 145 , 13 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_HOTKEY , STR_HOTKEY_TIP ), // Set hotkeys buttons
2024-05-08 21:19:57 +02:00
2024-09-04 21:11:26 +02:00
MakeWidget ({ 5 , kThemesGroupStart + 0 }, { 300 , 48 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_THEMES_GROUP ), // Themes group
MakeWidget ({ 10 , kThemesGroupStart + 14 }, { 145 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_THEMES_LABEL_CURRENT_THEME , STR_CURRENT_THEME_TIP ), // Themes
MakeWidget ({ 155 , kThemesGroupStart + 14 }, { 145 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary , STR_STRING ),
MakeWidget ({ 288 , kThemesGroupStart + 15 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_CURRENT_THEME_TIP ),
MakeWidget ({ 155 , kThemesGroupStart + 30 }, { 145 , 13 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_EDIT_THEMES_BUTTON , STR_EDIT_THEMES_BUTTON_TIP ), // Themes button
2024-05-08 21:19:57 +02:00
2025-01-30 23:02:36 +01:00
MakeWidget ({ 5 , kToolbarGroupStart + 0 }, { 300 , 107 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_TOOLBAR_BUTTONS_GROUP ), // Toolbar buttons group
MakeWidget ({ 10 , kToolbarGroupStart + 14 }, { 280 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_OPTIONS_TOOLBAR_BUTTONS_CENTRED , STR_OPTIONS_TOOLBAR_BUTTONS_CENTRED_TIP ),
MakeWidget ({ 10 , kToolbarGroupStart + 31 }, { 280 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_SHOW_TOOLBAR_BUTTONS_FOR ),
MakeWidget ({ 24 , kToolbarGroupStart + 46 }, { 122 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_FINANCES_BUTTON_ON_TOOLBAR , STR_FINANCES_BUTTON_ON_TOOLBAR_TIP ), // Finances
MakeWidget ({ 24 , kToolbarGroupStart + 61 }, { 122 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_RESEARCH_BUTTON_ON_TOOLBAR , STR_RESEARCH_BUTTON_ON_TOOLBAR_TIP ), // Research
MakeWidget ({ 155 , kToolbarGroupStart + 46 }, { 145 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_CHEATS_BUTTON_ON_TOOLBAR , STR_CHEATS_BUTTON_ON_TOOLBAR_TIP ), // Cheats
MakeWidget ({ 155 , kToolbarGroupStart + 61 }, { 145 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR , STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR_TIP ), // Recent messages
MakeWidget ({ 24 , kToolbarGroupStart + 76 }, { 162 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_MUTE_BUTTON_ON_TOOLBAR , STR_MUTE_BUTTON_ON_TOOLBAR_TIP ), // Mute
MakeWidget ({ 155 , kToolbarGroupStart + 76 }, { 145 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_CHAT_BUTTON_ON_TOOLBAR , STR_CHAT_BUTTON_ON_TOOLBAR_TIP ), // Chat
MakeWidget ({ 24 , kToolbarGroupStart + 91 }, { 122 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_ZOOM_BUTTON_ON_TOOLBAR , STR_ZOOM_BUTTON_ON_TOOLBAR_TIP ), // Zoom
MakeWidget ({ 155 , kToolbarGroupStart + 91 }, { 145 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_ROTATE_ANTI_CLOCKWISE , STR_ROTATE_VIEW_ANTI_CLOCKWISE_IN_TOOLBAR_TIP ), // Rotate anti-clockwise
2024-09-04 21:11:26 +02:00
};
2015-06-04 14:51:54 -04:00
2024-09-04 21:11:26 +02:00
constexpr int32_t kTitleSequenceStart = 53 ;
constexpr int32_t kScenarioGroupStart = kTitleSequenceStart + 35 ;
constexpr int32_t kScenarioOptionsGroupStart = kScenarioGroupStart + 55 ;
constexpr int32_t kTweaksStart = kScenarioOptionsGroupStart + 39 ;
2022-04-05 23:06:47 +01:00
2025-01-18 14:45:17 +02:00
static constexpr Widget window_options_misc_widgets [] = {
2024-09-04 21:11:26 +02:00
MAIN_OPTIONS_WIDGETS ,
MakeWidget ( { 5 , kTitleSequenceStart + 0 }, { 300 , 31 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_OPTIONS_TITLE_SEQUENCE ),
MakeDropdownWidgets ({ 10 , kTitleSequenceStart + 15 }, { 290 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary , STR_STRINGID , STR_TITLE_SEQUENCE_TIP ), // Title sequence dropdown
2022-04-05 23:06:47 +01:00
2024-09-04 21:11:26 +02:00
MakeWidget ({ 5 , kScenarioGroupStart + 0 }, { 300 , 51 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_OPTIONS_SCENARIO_SELECTION ),
MakeWidget ({ 10 , kScenarioGroupStart + 16 }, { 165 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_OPTIONS_SCENARIO_GROUPING , STR_SCENARIO_GROUPING_TIP ),
MakeWidget ({ 175 , kScenarioGroupStart + 15 }, { 125 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ), // Scenario select mode
MakeWidget ({ 288 , kScenarioGroupStart + 16 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_SCENARIO_GROUPING_TIP ),
MakeWidget ({ 25 , kScenarioGroupStart + 30 }, { 275 , 16 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_OPTIONS_SCENARIO_UNLOCKING , STR_SCENARIO_UNLOCKING_TIP ), // Unlocking of scenarios
2022-04-05 23:06:47 +01:00
2024-09-04 21:11:26 +02:00
MakeWidget ({ 5 , kScenarioOptionsGroupStart + 0 }, { 300 , 35 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_SCENARIO_OPTIONS ),
MakeWidget ({ 10 , kScenarioOptionsGroupStart + 15 }, { 290 , 15 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_ALLOW_EARLY_COMPLETION , STR_EARLY_COMPLETION_TIP ), // Allow early scenario completion
2022-04-05 23:06:47 +01:00
2024-09-15 22:18:00 +02:00
MakeWidget ({ 5 , kTweaksStart + 0 }, { 300 , 96 }, WindowWidgetType :: Groupbox , WindowColour :: Secondary , STR_OPTIONS_TWEAKS ),
MakeWidget ({ 10 , kTweaksStart + 15 }, { 290 , 15 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_REAL_NAME_GUESTS , STR_REAL_NAME_GUESTS_TIP ), // Show 'real' names of guests
MakeWidget ({ 10 , kTweaksStart + 30 }, { 290 , 15 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_REAL_NAME_STAFF , STR_REAL_NAME_STAFF_TIP ), // Show 'real' names of staff
MakeWidget ({ 10 , kTweaksStart + 45 }, { 290 , 15 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_AUTO_STAFF_PLACEMENT , STR_AUTO_STAFF_PLACEMENT_TIP ), // Auto staff placement
MakeWidget ({ 10 , kTweaksStart + 60 }, { 290 , 15 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_AUTO_OPEN_SHOPS , STR_AUTO_OPEN_SHOPS_TIP ), // Automatically open shops & stalls
MakeWidget ({ 10 , kTweaksStart + 77 }, { 165 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_DEFAULT_INSPECTION_INTERVAL , STR_DEFAULT_INSPECTION_INTERVAL_TIP ),
MakeWidget ({ 175 , kTweaksStart + 76 }, { 125 , 12 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ), // Default inspection time dropdown
MakeWidget ({ 288 , kTweaksStart + 77 }, { 11 , 10 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_DEFAULT_INSPECTION_INTERVAL_TIP ), // Default inspection time dropdown button
2024-09-04 21:11:26 +02:00
};
2017-12-10 16:27:40 +01:00
2025-01-18 14:45:17 +02:00
static constexpr Widget window_options_advanced_widgets [] = {
2024-09-04 21:11:26 +02:00
MAIN_OPTIONS_WIDGETS ,
MakeWidget ({ 10 , 54 }, { 290 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_ENABLE_DEBUGGING_TOOLS , STR_ENABLE_DEBUGGING_TOOLS_TIP ), // Enable debugging tools
MakeWidget ({ 10 , 69 }, { 290 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_SAVE_PLUGIN_DATA , STR_SAVE_PLUGIN_DATA_TIP ), // Export plug-in objects with saved games
MakeWidget ({ 10 , 84 }, { 290 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Tertiary , STR_STAY_CONNECTED_AFTER_DESYNC , STR_STAY_CONNECTED_AFTER_DESYNC_TIP ), // Do not disconnect after the client desynchronises with the server
MakeWidget ({ 10 , 99 }, { 290 , 12 }, WindowWidgetType :: Checkbox , WindowColour :: Secondary , STR_ALWAYS_NATIVE_LOADSAVE , STR_ALWAYS_NATIVE_LOADSAVE_TIP ), // Use native load/save window
MakeWidget ({ 23 , 114 }, { 135 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_OPTIONS_AUTOSAVE_FREQUENCY_LABEL , STR_AUTOSAVE_FREQUENCY_TIP ),
MakeWidget ({ 165 , 113 }, { 135 , 13 }, WindowWidgetType :: DropdownMenu , WindowColour :: Secondary ), // Autosave dropdown
MakeWidget ({ 288 , 114 }, { 11 , 11 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_DROPDOWN_GLYPH , STR_AUTOSAVE_FREQUENCY_TIP ), // Autosave dropdown button
MakeWidget ({ 23 , 130 }, { 135 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_AUTOSAVE_AMOUNT , STR_AUTOSAVE_AMOUNT_TIP ),
2025-01-20 08:31:12 -06:00
MakeSpinnerWidgets ({ 165 , 130 }, { 135 , 12 }, WindowWidgetType :: Spinner , WindowColour :: Secondary , kStringIdNone , STR_AUTOSAVE_AMOUNT_TIP ), // Autosave amount spinner
2024-09-04 21:11:26 +02:00
MakeWidget ({ 23 , 145 }, { 276 , 12 }, WindowWidgetType :: Label , WindowColour :: Secondary , STR_PATH_TO_RCT1 , STR_PATH_TO_RCT1_TIP ), // RCT 1 path text
2025-01-20 08:31:12 -06:00
MakeWidget ({ 24 , 160 }, { 266 , 14 }, WindowWidgetType :: Button , WindowColour :: Secondary , kStringIdNone , STR_STRING_TOOLTIP ), // RCT 1 path button
2024-09-04 21:11:26 +02:00
MakeWidget ({ 289 , 160 }, { 11 , 14 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_CLOSE_X , STR_PATH_TO_RCT1_CLEAR_TIP ), // RCT 1 path clear button
2025-01-20 08:31:12 -06:00
MakeWidget ({ 150 , 176 }, { 150 , 14 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_EDIT_ASSET_PACKS_BUTTON , kStringIdNone ), // Asset packs
2024-12-31 09:31:33 -06:00
#ifdef __EMSCRIPTEN__
2025-01-20 08:31:12 -06:00
MakeWidget ({ 150 , 192 }, { 150 , 14 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_EXPORT_EMSCRIPTEN , kStringIdNone ), // Emscripten data export
MakeWidget ({ 150 , 208 }, { 150 , 14 }, WindowWidgetType :: Button , WindowColour :: Secondary , STR_IMPORT_EMSCRIPTEN , kStringIdNone ), // Emscripten data import
2024-12-31 09:31:33 -06:00
#endif
2024-09-04 21:11:26 +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 ,
window_options_controls_and_interface_widgets ,
window_options_misc_widgets ,
window_options_advanced_widgets ,
};
// clang-format on
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
{
2024-03-10 13:52:35 +00:00
public :
void OnOpen () override
{
2025-01-18 14:45:17 +02:00
SetPage ( WINDOW_OPTIONS_PAGE_DISPLAY );
2024-03-10 13:52:35 +00:00
}
2014-05-11 09:01:01 +02:00
2024-03-10 13:52:35 +00:00
void OnMouseUp ( WidgetIndex widgetIndex ) override
{
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 ;
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE :
ControlsMouseUp ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_MISC :
MiscMouseUp ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_ADVANCED :
AdvancedMouseUp ( widgetIndex );
break ;
case WINDOW_OPTIONS_PAGE_CULTURE :
default :
break ;
}
}
}
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 ;
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE :
ControlsMouseDown ( widgetIndex );
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
2024-03-10 13:52:35 +00: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 ;
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE :
ControlsDropdown ( widgetIndex , dropdownIndex );
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
2024-03-10 13:52:35 +00: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 ;
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE :
ControlsPrepareDraw ();
break ;
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
}
2024-03-10 13:52:35 +00:00
void OnDraw ( DrawPixelInfo & dpi ) override
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
DrawWidgets ( dpi );
DrawTabImages ( dpi );
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
switch ( page )
{
case WINDOW_OPTIONS_PAGE_DISPLAY :
DisplayDraw ( dpi );
break ;
case WINDOW_OPTIONS_PAGE_ADVANCED :
AdvancedDraw ( dpi );
break ;
default :
break ;
}
}
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 ;
case WINDOW_OPTIONS_PAGE_DISPLAY :
case WINDOW_OPTIONS_PAGE_RENDERING :
case WINDOW_OPTIONS_PAGE_CULTURE :
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE :
case WINDOW_OPTIONS_PAGE_MISC :
case WINDOW_OPTIONS_PAGE_ADVANCED :
default :
break ;
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
ScreenSize OnScrollGetSize ( int32_t scrollIndex ) override
{
switch ( page )
{
case WINDOW_OPTIONS_PAGE_AUDIO :
return AudioScrollGetSize ( scrollIndex );
case WINDOW_OPTIONS_PAGE_DISPLAY :
case WINDOW_OPTIONS_PAGE_RENDERING :
case WINDOW_OPTIONS_PAGE_CULTURE :
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE :
case WINDOW_OPTIONS_PAGE_MISC :
case WINDOW_OPTIONS_PAGE_ADVANCED :
default :
return { WW , WH };
}
}
2022-01-29 21:52:33 +00:00
2024-03-10 13:52:35 +00:00
OpenRCT2String OnTooltip ( WidgetIndex widgetIndex , StringId fallback ) override
{
if ( page == WINDOW_OPTIONS_PAGE_ADVANCED )
return AdvancedTooltip ( widgetIndex , fallback );
2022-01-29 21:52:33 +00:00
2024-03-10 13:52:35 +00:00
return WindowBase :: OnTooltip ( widgetIndex , fallback );
}
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-01-19 18:49:18 +01: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 :
case WIDX_TAB_CONTROLS_AND_INTERFACE :
case WIDX_TAB_MISC :
case WIDX_TAB_ADVANCED :
SetPage ( widgetIndex - WIDX_FIRST_TAB );
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
2024-03-10 13:52:35 +00:00
disabled_widgets = 0 ;
auto hasFilePicker = OpenRCT2 :: GetContext () -> GetUiContext () -> HasFilePicker ();
const bool controlsTabSelected = ( WIDX_FIRST_TAB + page ) == WIDX_TAB_CONTROLS_AND_INTERFACE ;
if ( ! hasFilePicker && controlsTabSelected )
{
disabled_widgets |= ( 1uLL << WIDX_ALWAYS_NATIVE_LOADSAVE );
widgets [ WIDX_ALWAYS_NATIVE_LOADSAVE ]. type = WindowWidgetType :: Empty ;
}
}
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
}
height = y + 6 ;
ResizeFrameWithPage ();
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
void OnResize () override
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
ResizeFrameWithPage ();
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
frame_no ++ ;
InvalidateWidget ( WIDX_FIRST_TAB + page );
}
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_UNCAP_FPS_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . UncapFPS ^= 1 ;
DrawingEngineSetVSync ( Config :: Get (). general . UseVSync );
Config :: Save ();
2022-01-29 21:52:33 +00:00
Invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_USE_VSYNC_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . UseVSync ^= 1 ;
DrawingEngineSetVSync ( Config :: Get (). general . UseVSync );
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_SHOW_FPS_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . ShowFPS ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_MULTITHREADING_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . MultiThreading ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_MINIMIZE_FOCUS_LOSS :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . MinimizeFullscreenFocusLoss ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_STEAM_OVERLAY_PAUSE :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . SteamOverlayPause ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_DISABLE_SCREENSAVER_LOCK :
2024-05-10 12:10:21 +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 ();
2024-03-10 13:52:35 +00:00
Invalidate ();
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
{
2024-03-10 13:52:35 +00:00
const auto & resolutions = OpenRCT2 :: GetContext () -> GetUiContext () -> GetFullscreenResolutions ();
int32_t selectedResolution = - 1 ;
for ( size_t i = 0 ; i < resolutions . size (); i ++ )
{
const Resolution & resolution = resolutions [ i ];
gDropdownItems [ i ]. Format = STR_DROPDOWN_MENU_LABEL ;
uint16_t * args = reinterpret_cast < uint16_t *> ( & gDropdownItems [ i ]. Args );
args [ 0 ] = STR_RESOLUTION_X_BY_Y ;
args [ 1 ] = resolution . Width ;
args [ 2 ] = resolution . Height ;
2024-05-10 12:10:21 +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 )
{
Dropdown :: SetChecked ( selectedResolution , true );
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
break ;
case WIDX_FULLSCREEN_DROPDOWN :
gDropdownItems [ 0 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 1 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 2 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 0 ]. Args = STR_OPTIONS_DISPLAY_WINDOWED ;
gDropdownItems [ 1 ]. Args = STR_OPTIONS_DISPLAY_FULLSCREEN ;
gDropdownItems [ 2 ]. Args = 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
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( Config :: Get (). general . FullscreenMode , true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_DRAWING_ENGINE_DROPDOWN :
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
int32_t numItems = 3 ;
#ifdef DISABLE_OPENGL
numItems = 2 ;
#endif
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
for ( int32_t i = 0 ; i < numItems ; i ++ )
{
gDropdownItems [ i ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ i ]. Args = DrawingEngineStringIds [ i ];
}
ShowDropdown ( widget , numItems );
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( EnumValue ( Config :: Get (). general . DrawingEngine ), 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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . WindowScale += 0.25f ;
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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . WindowScale -= 0.25f ;
Config :: Get (). general . WindowScale = std :: max ( 0.5f , Config :: Get (). general . WindowScale );
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
ContextTriggerResize ();
ContextUpdateCursorScale ();
break ;
}
}
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
{
2024-03-10 13:52:35 +00:00
const auto & resolutions = OpenRCT2 :: GetContext () -> GetUiContext () -> GetFullscreenResolutions ();
const Resolution & resolution = resolutions [ dropdownIndex ];
2024-05-10 12:10:21 +02:00
if ( resolution . Width != Config :: Get (). general . FullscreenWidth
|| resolution . Height != Config :: Get (). general . FullscreenHeight )
2020-10-04 17:08:10 +02:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . FullscreenWidth = resolution . Width ;
Config :: Get (). general . FullscreenHeight = resolution . Height ;
2024-03-10 13:52:35 +00:00
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). general . FullscreenMode
== static_cast < int32_t > ( OpenRCT2 :: Ui :: FULLSCREEN_MODE :: FULLSCREEN ))
2024-03-10 13:52:35 +00:00
ContextSetFullscreenMode ( static_cast < int32_t > ( OpenRCT2 :: Ui :: FULLSCREEN_MODE :: FULLSCREEN ));
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
}
}
2024-03-10 13:52:35 +00:00
break ;
case WIDX_FULLSCREEN_DROPDOWN :
2024-05-10 12:10:21 +02:00
if ( dropdownIndex != Config :: Get (). general . FullscreenMode )
2024-03-10 13:52:35 +00:00
{
ContextSetFullscreenMode ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Get (). general . FullscreenMode = static_cast < uint8_t > ( dropdownIndex );
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
}
break ;
case WIDX_DRAWING_ENGINE_DROPDOWN :
2024-05-10 12:10:21 +02:00
if ( dropdownIndex != EnumValue ( Config :: Get (). general . DrawingEngine ))
2024-03-10 13:52:35 +00:00
{
DrawingEngine dstEngine = static_cast < DrawingEngine > ( dropdownIndex );
2024-05-10 12:10:21 +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 ();
2024-03-10 13:52:35 +00:00
Invalidate ();
}
break ;
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
}
void DisplayPrepareDraw ()
{
// Resolution dropdown caption.
auto ft = Formatter :: Common ();
ft . Increment ( 16 );
2024-05-10 12:10:21 +02:00
ft . Add < uint16_t > ( static_cast < uint16_t > ( Config :: Get (). general . FullscreenWidth ));
ft . Add < uint16_t > ( static_cast < uint16_t > ( Config :: Get (). general . FullscreenHeight ));
2024-03-10 13:52:35 +00:00
// Disable resolution dropdown on "Windowed" and "Fullscreen (desktop)"
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). general . FullscreenMode != static_cast < int32_t > ( OpenRCT2 :: Ui :: FULLSCREEN_MODE :: FULLSCREEN ))
2024-03-10 13:52:35 +00:00
{
disabled_widgets |= ( 1uLL << WIDX_RESOLUTION_DROPDOWN );
disabled_widgets |= ( 1uLL << WIDX_RESOLUTION );
disabled_widgets |= ( 1uLL << WIDX_RESOLUTION_LABEL );
}
else
{
disabled_widgets &= ~ ( 1uLL << WIDX_RESOLUTION_DROPDOWN );
disabled_widgets &= ~ ( 1uLL << WIDX_RESOLUTION );
disabled_widgets &= ~ ( 1uLL << WIDX_RESOLUTION_LABEL );
}
// Disable Steam Overlay checkbox when using software or OpenGL rendering.
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). general . DrawingEngine == DrawingEngine :: Software
|| Config :: Get (). general . DrawingEngine == DrawingEngine :: OpenGL )
2024-03-10 13:52:35 +00:00
{
disabled_widgets |= ( 1uLL << WIDX_STEAM_OVERLAY_PAUSE );
}
else
{
disabled_widgets &= ~ ( 1uLL << WIDX_STEAM_OVERLAY_PAUSE );
}
// Disable changing VSync for Software engine, as we can't control its use of VSync
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). general . DrawingEngine == DrawingEngine :: Software )
2024-03-10 13:52:35 +00:00
{
disabled_widgets |= ( 1uLL << WIDX_USE_VSYNC_CHECKBOX );
}
else
{
disabled_widgets &= ~ ( 1uLL << WIDX_USE_VSYNC_CHECKBOX );
}
2024-05-10 12:10:21 +02:00
SetCheckboxValue ( WIDX_UNCAP_FPS_CHECKBOX , Config :: Get (). general . UncapFPS );
SetCheckboxValue ( WIDX_USE_VSYNC_CHECKBOX , Config :: Get (). general . UseVSync );
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_STEAM_OVERLAY_PAUSE , Config :: Get (). general . SteamOverlayPause );
SetCheckboxValue ( WIDX_DISABLE_SCREENSAVER_LOCK , Config :: Get (). general . DisableScreensaver );
2024-03-10 13:52:35 +00:00
// Dropdown captions for straightforward strings.
2024-05-10 12:10:21 +02:00
widgets [ WIDX_FULLSCREEN ]. text = FullscreenModeNames [ Config :: Get (). general . FullscreenMode ];
widgets [ WIDX_DRAWING_ENGINE ]. text = DrawingEngineStringIds [ EnumValue ( Config :: Get (). general . DrawingEngine )];
2024-03-10 13:52:35 +00:00
}
void DisplayDraw ( DrawPixelInfo & dpi )
{
auto ft = Formatter ();
2024-05-10 12:10:21 +02:00
ft . Add < int32_t > ( static_cast < int32_t > ( Config :: Get (). general . WindowScale * 100 ));
2024-03-10 13:52:35 +00:00
DrawTextBasic (
dpi , windowPos + ScreenCoordsXY { widgets [ WIDX_SCALE ]. left + 1 , widgets [ WIDX_SCALE ]. top + 1 },
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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . LandscapeSmoothing ^= 1 ;
Config :: Save ();
2023-01-16 13:50:43 +00:00
GfxInvalidateScreen ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_GRIDLINES_CHECKBOX :
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . AlwaysShowGridlines ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
WindowBase * mainWindow = WindowGetMain ();
if ( mainWindow != nullptr )
{
2024-05-10 12:10:21 +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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . DayNightCycle ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00: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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . EnableLightFx ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00: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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . EnableLightFxForVehicles ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_UPPER_CASE_BANNERS_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . UpperCaseBanners ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
ScrollingTextInvalidate ();
break ;
case WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . DisableLightningEffect ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . RenderWeatherEffects ^= 1 ;
Config :: Get (). general . RenderWeatherGloom = Config :: Get (). general . RenderWeatherEffects ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
GfxInvalidateScreen ();
break ;
case WIDX_SHOW_GUEST_PURCHASES_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . ShowGuestPurchases ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . TransparentScreenshot ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00: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 :
gDropdownItems [ 0 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 1 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 2 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 0 ]. Args = STR_VIRTUAL_FLOOR_STYLE_DISABLED ;
gDropdownItems [ 1 ]. Args = STR_VIRTUAL_FLOOR_STYLE_TRANSPARENT ;
gDropdownItems [ 2 ]. Args = 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
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( static_cast < int32_t > ( Config :: Get (). general . VirtualFloorStyle ), true );
2024-03-10 13:52:35 +00:00
break ;
}
}
void RenderingDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
{
switch ( widgetIndex )
{
case WIDX_VIRTUAL_FLOOR_DROPDOWN :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . VirtualFloorStyle = static_cast < VirtualFloorStyles > ( dropdownIndex );
Config :: Save ();
2024-03-10 13:52:35 +00:00
break ;
}
}
void RenderingPrepareDraw ()
{
2024-05-10 12:10:21 +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 ,
};
2024-05-10 12:10:21 +02:00
widgets [ WIDX_VIRTUAL_FLOOR ]. text = _virtualFloorStyleStrings [ EnumValue ( Config :: Get (). general . VirtualFloorStyle )];
2024-03-10 13:52:35 +00:00
2024-05-10 12:10:21 +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
{
disabled_widgets &= ~ ( 1uLL << WIDX_ENABLE_LIGHT_FX_CHECKBOX );
}
else
{
disabled_widgets |= ( 1uLL << WIDX_ENABLE_LIGHT_FX_CHECKBOX );
2024-05-10 12:10:21 +02:00
Config :: Get (). general . EnableLightFx = false ;
2024-03-10 13:52:35 +00:00
}
2024-05-10 12:10:21 +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
{
disabled_widgets &= ~ ( 1uLL << WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX );
}
else
{
disabled_widgets |= ( 1uLL << WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX );
2024-05-10 12:10:21 +02:00
Config :: Get (). general . EnableLightFxForVehicles = false ;
2024-03-10 13:52:35 +00:00
}
WidgetSetCheckboxValue (
* this , WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX ,
2024-05-10 12:10:21 +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
{
SetCheckboxValue ( WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX , true );
disabled_widgets |= ( 1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX );
}
else
{
disabled_widgets &= ~ ( 1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX );
}
}
#pragma endregion
#pragma region Culture tab events
void CultureMouseDown ( WidgetIndex widgetIndex )
{
Widget * widget = & widgets [ widgetIndex - 1 ];
switch ( widgetIndex )
{
case WIDX_HEIGHT_LABELS_DROPDOWN :
gDropdownItems [ 0 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 1 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 0 ]. Args = STR_HEIGHT_IN_UNITS ;
gDropdownItems [ 1 ]. Args = STR_REAL_VALUES ;
ShowDropdown ( widget , 2 );
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( Config :: Get (). general . ShowHeightAsUnits ? 0 : 1 , true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_CURRENCY_DROPDOWN :
{
// All the currencies plus the separator
constexpr auto numItems = EnumValue ( CurrencyType :: Count ) + 1 ;
// All the currencies except custom currency
size_t numOrdinaryCurrencies = EnumValue ( CurrencyType :: Count ) - 1 ;
for ( size_t i = 0 ; i < numOrdinaryCurrencies ; i ++ )
{
gDropdownItems [ i ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ i ]. Args = CurrencyDescriptors [ i ]. stringId ;
}
2025-01-19 16:59:45 +01:00
gDropdownItems [ numOrdinaryCurrencies ]. Format = Dropdown :: kSeparatorString ;
2024-03-10 13:52:35 +00:00
gDropdownItems [ numOrdinaryCurrencies + 1 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ numOrdinaryCurrencies + 1 ]. Args = CurrencyDescriptors [ EnumValue ( CurrencyType :: Custom )]
. stringId ;
ShowDropdown ( widget , numItems );
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). general . CurrencyFormat == CurrencyType :: Custom )
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( EnumValue ( Config :: Get (). general . CurrencyFormat ) + 1 , true );
2024-03-10 13:52:35 +00:00
}
else
{
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( EnumValue ( Config :: Get (). general . CurrencyFormat ), true );
2024-03-10 13:52:35 +00:00
}
break ;
}
case WIDX_DISTANCE_DROPDOWN :
gDropdownItems [ 0 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 1 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 2 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 0 ]. Args = STR_IMPERIAL ;
gDropdownItems [ 1 ]. Args = STR_METRIC ;
gDropdownItems [ 2 ]. Args = STR_SI ;
ShowDropdown ( widget , 3 );
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( static_cast < int32_t > ( Config :: Get (). general . MeasurementFormat ), true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TEMPERATURE_DROPDOWN :
gDropdownItems [ 0 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 1 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 0 ]. Args = STR_CELSIUS ;
gDropdownItems [ 1 ]. Args = STR_FAHRENHEIT ;
ShowDropdown ( widget , 2 );
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( static_cast < int32_t > ( Config :: Get (). general . TemperatureFormat ), true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_LANGUAGE_DROPDOWN :
for ( size_t i = 1 ; i < LANGUAGE_COUNT ; i ++ )
{
gDropdownItems [ i - 1 ]. Format = STR_OPTIONS_DROPDOWN_ITEM ;
gDropdownItems [ i - 1 ]. Args = reinterpret_cast < uintptr_t > ( LanguagesDescriptors [ i ]. native_name );
}
ShowDropdown ( widget , LANGUAGE_COUNT - 1 );
Dropdown :: SetChecked ( LocalisationService_GetCurrentLanguage () - 1 , true );
break ;
case WIDX_DATE_FORMAT_DROPDOWN :
for ( size_t i = 0 ; i < 4 ; i ++ )
{
gDropdownItems [ i ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ i ]. Args = DateFormatStringIDs [ i ];
}
ShowDropdown ( widget , 4 );
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( Config :: Get (). general . DateFormat , 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
2024-05-10 12:10:21 +02:00
Config :: Get (). general . ShowHeightAsUnits = 0 ;
2024-03-10 13:52:35 +00:00
if ( dropdownIndex == 0 )
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . ShowHeightAsUnits = 1 ;
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 :
if ( dropdownIndex == EnumValue ( CurrencyType :: Custom ) + 1 )
{ // Add 1 because the separator occupies a position
2024-05-10 12:10:21 +02:00
Config :: Get (). general . CurrencyFormat = static_cast < CurrencyType > ( dropdownIndex - 1 );
2024-03-10 13:52:35 +00:00
ContextOpenWindow ( WindowClass :: CustomCurrencyConfig );
}
else
{
2024-05-10 12:10:21 +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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . MeasurementFormat = static_cast < MeasurementFormat > ( dropdownIndex );
Config :: Save ();
2024-03-10 13:52:35 +00:00
UpdateHeightMarkers ();
break ;
case WIDX_TEMPERATURE_DROPDOWN :
2024-05-10 12:10:21 +02:00
if ( dropdownIndex != static_cast < int32_t > ( Config :: Get (). general . TemperatureFormat ))
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . TemperatureFormat = static_cast < TemperatureUnit > ( dropdownIndex );
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
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . Language = dropdownIndex + 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
}
}
}
break ;
case WIDX_DATE_FORMAT_DROPDOWN :
2024-05-10 12:10:21 +02:00
if ( dropdownIndex != Config :: Get (). general . DateFormat )
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . DateFormat = static_cast < uint8_t > ( dropdownIndex );
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
}
break ;
}
}
void CulturePrepareDraw ()
{
// Language
auto ft = Formatter :: Common ();
ft . Add < char *> ( LanguagesDescriptors [ LocalisationService_GetCurrentLanguage ()]. native_name );
// Currency: pounds, dollars, etc. (10 total)
2024-05-10 12:10:21 +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 ;
2024-05-10 12:10:21 +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
2024-05-10 12:10:21 +02:00
widgets [ WIDX_DATE_FORMAT ]. text = DateFormatStringIDs [ Config :: Get (). general . DateFormat ];
2024-03-10 13:52:35 +00:00
// Temperature: celsius/fahrenheit
2024-05-10 12:10:21 +02:00
widgets [ WIDX_TEMPERATURE ]. text = Config :: Get (). general . TemperatureFormat == TemperatureUnit :: Fahrenheit
? STR_FAHRENHEIT
: STR_CELSIUS ;
2024-03-10 13:52:35 +00:00
// Height: units/real values
2024-05-10 12:10:21 +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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . SoundEnabled = ! Config :: Get (). sound . SoundEnabled ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
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
{
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . MasterSoundEnabled = ! Config :: Get (). sound . MasterSoundEnabled ;
if ( ! Config :: Get (). sound . MasterSoundEnabled )
2024-03-10 13:52:35 +00:00
OpenRCT2 :: Audio :: Pause ();
2021-10-15 11:41:30 +02:00
else
2024-03-10 13:52:35 +00:00
OpenRCT2 :: Audio :: Resume ();
2025-01-25 13:46:08 +01:00
auto * windowMgr = Ui :: GetWindowManager ();
windowMgr -> InvalidateByClass ( WindowClass :: TopToolbar );
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
2025-01-25 13:46:08 +01:00
}
2024-03-10 13:52:35 +00:00
case WIDX_MUSIC_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . RideMusicEnabled = ! Config :: Get (). sound . RideMusicEnabled ;
if ( ! Config :: Get (). sound . RideMusicEnabled )
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
OpenRCT2 :: RideAudio :: StopAllChannels ();
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
Invalidate ();
break ;
2023-05-15 20:57:17 +02:00
2024-03-10 13:52:35 +00:00
case WIDX_AUDIO_FOCUS_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . audio_focus = ! Config :: Get (). sound . audio_focus ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
}
}
void AudioMouseDown ( WidgetIndex widgetIndex )
{
Widget * widget = & widgets [ widgetIndex - 1 ];
switch ( widgetIndex )
{
case WIDX_SOUND_DROPDOWN :
OpenRCT2 :: Audio :: PopulateDevices ();
// populate the list with the sound devices
for ( int32_t i = 0 ; i < OpenRCT2 :: Audio :: GetDeviceCount (); i ++ )
{
gDropdownItems [ i ]. Format = STR_OPTIONS_DROPDOWN_ITEM ;
gDropdownItems [ i ]. Args = reinterpret_cast < uintptr_t > ( OpenRCT2 :: Audio :: GetDeviceName ( i ). c_str ());
}
ShowDropdown ( widget , OpenRCT2 :: Audio :: GetDeviceCount ());
Dropdown :: SetChecked ( OpenRCT2 :: Audio :: GetCurrentDeviceIndex (), true );
break ;
case WIDX_TITLE_MUSIC_DROPDOWN :
{
const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable ();
int32_t numItems {};
int32_t checkedIndex {};
for ( auto theme : TitleThemeOptions )
{
if ( theme . Kind == TitleMusicKind :: RCT1 && ! rct1MusicThemeIsAvailable )
continue ;
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). sound . TitleMusic == theme . Kind )
2024-03-10 13:52:35 +00:00
checkedIndex = numItems ;
gDropdownItems [ numItems ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ numItems ++ ]. Args = theme . Name ;
}
ShowDropdown ( widget , numItems );
Dropdown :: SetChecked ( checkedIndex , true );
break ;
}
}
}
void AudioDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex )
{
switch ( widgetIndex )
{
case WIDX_SOUND_DROPDOWN :
OpenRCT2 :: Audio :: InitRideSounds ( dropdownIndex );
if ( dropdownIndex < OpenRCT2 :: Audio :: GetDeviceCount ())
{
auto audioContext = GetContext () -> GetAudioContext ();
if ( dropdownIndex == 0 )
{
audioContext -> SetOutputDevice ( "" );
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . Device = "" ;
2024-03-10 13:52:35 +00:00
}
else
{
const auto & deviceName = GetDeviceName ( dropdownIndex );
audioContext -> SetOutputDevice ( deviceName );
2024-05-10 12:10:21 +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 ();
2024-03-10 13:52:35 +00:00
OpenRCT2 :: Audio :: PlayTitleMusic ();
}
Invalidate ();
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
const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable ();
for ( size_t i = 0 ; i < std :: size ( TitleThemeOptions ) && static_cast < int32_t > ( i ) <= dropdownIndex ; i ++ )
{
if ( TitleThemeOptions [ i ]. Kind == TitleMusicKind :: RCT1 && ! rct1MusicThemeIsAvailable )
dropdownIndex ++ ;
}
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . TitleMusic = TitleThemeOptions [ dropdownIndex ]. Kind ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
OpenRCT2 :: Audio :: StopTitleMusic ();
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). sound . TitleMusic != TitleMusicKind :: None )
2024-03-10 13:52:35 +00:00
{
OpenRCT2 :: Audio :: PlayTitleMusic ();
}
break ;
}
}
}
void AudioUpdate ()
{
const auto & masterVolumeWidget = widgets [ WIDX_MASTER_VOLUME ];
const auto & masterVolumeScroll = scrolls [ 0 ];
uint8_t masterVolume = GetScrollPercentage ( masterVolumeWidget , masterVolumeScroll );
2024-05-10 12:10:21 +02:00
if ( masterVolume != Config :: Get (). sound . MasterVolume )
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . MasterVolume = masterVolume ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
InvalidateWidget ( WIDX_MASTER_VOLUME );
}
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 );
2024-05-10 12:10:21 +02:00
if ( soundVolume != Config :: Get (). sound . SoundVolume )
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . SoundVolume = soundVolume ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
InvalidateWidget ( WIDX_SOUND_VOLUME );
}
const auto & musicVolumeWidget = widgets [ WIDX_MASTER_VOLUME ];
const auto & musicVolumeScroll = scrolls [ 2 ];
uint8_t rideMusicVolume = GetScrollPercentage ( musicVolumeWidget , musicVolumeScroll );
2024-05-10 12:10:21 +02:00
if ( rideMusicVolume != Config :: Get (). sound . AudioFocus )
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). sound . AudioFocus = rideMusicVolume ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
InvalidateWidget ( WIDX_MUSIC_VOLUME );
2022-05-09 18:34:38 +01:00
}
2021-10-15 11:41:30 +02:00
}
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 ) {
2024-05-10 12:10:21 +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
}
2024-03-10 13:52:35 +00:00
void AudioPrepareDraw ()
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
// Sound device
StringId audioDeviceStringId = STR_OPTIONS_SOUND_VALUE_DEFAULT ;
const char * audioDeviceName = nullptr ;
const int32_t currentDeviceIndex = OpenRCT2 :: Audio :: GetCurrentDeviceIndex ();
if ( currentDeviceIndex == - 1 || OpenRCT2 :: Audio :: GetDeviceCount () == 0 )
{
audioDeviceStringId = STR_SOUND_NONE ;
}
else
{
audioDeviceStringId = STR_STRING ;
2021-10-15 11:41:30 +02:00
#ifndef __linux__
2024-03-10 13:52:35 +00:00
if ( currentDeviceIndex == 0 )
{
audioDeviceStringId = STR_OPTIONS_SOUND_VALUE_DEFAULT ;
}
2021-10-15 11:41:30 +02:00
#endif // __linux__
2024-03-10 13:52:35 +00:00
if ( audioDeviceStringId == STR_STRING )
{
audioDeviceName = OpenRCT2 :: Audio :: GetDeviceName ( currentDeviceIndex ). c_str ();
}
}
widgets [ WIDX_SOUND ]. text = audioDeviceStringId ;
auto ft = Formatter :: Common ();
ft . Add < char *> ( audioDeviceName );
widgets [ WIDX_TITLE_MUSIC ]. text = GetTitleMusicName ();
2024-05-10 12:10:21 +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 . audio_focus );
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
if ( frame_no == 0 )
2021-10-15 11:41:30 +02:00
{
2024-05-10 12:10:21 +02:00
InitializeScrollPosition ( WIDX_MASTER_VOLUME , 0 , Config :: Get (). sound . MasterVolume );
InitializeScrollPosition ( WIDX_SOUND_VOLUME , 1 , Config :: Get (). sound . SoundVolume );
InitializeScrollPosition ( WIDX_MUSIC_VOLUME , 2 , Config :: Get (). sound . AudioFocus );
2021-10-15 11:41:30 +02:00
}
}
#pragma endregion
#pragma region Controls tab events
2024-05-08 21:22:28 +02:00
void ToggleToolbarSetting ( bool & setting )
{
setting ^= true ;
Config :: Save ();
Invalidate ();
2025-01-25 13:46:08 +01:00
auto * windowMgr = Ui :: GetWindowManager ();
windowMgr -> InvalidateByClass ( WindowClass :: TopToolbar );
2024-05-08 21:22:28 +02:00
}
2024-03-10 13:52:35 +00:00
void ControlsMouseUp ( WidgetIndex widgetIndex )
2021-10-15 11:41:30 +02:00
{
2025-01-25 13:46:08 +01:00
auto * windowMgr = Ui :: GetWindowManager ();
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
{
case WIDX_HOTKEY_DROPDOWN :
ContextOpenWindow ( WindowClass :: KeyboardShortcutList );
break ;
case WIDX_SCREEN_EDGE_SCROLLING :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . EdgeScrolling ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_TRAP_CURSOR :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . TrapCursor ^= 1 ;
Config :: Save ();
ContextSetCursorTrap ( Config :: Get (). general . TrapCursor );
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_ZOOM_TO_CURSOR :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . ZoomToCursor ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
2024-05-08 21:19:57 +02:00
case WIDX_TOOLBAR_BUTTONS_CENTRED :
2024-05-08 21:22:28 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarButtonsCentred );
2024-05-08 21:19:57 +02:00
break ;
2024-03-10 13:52:35 +00:00
case WIDX_TOOLBAR_SHOW_FINANCES :
2024-05-08 21:22:28 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarShowFinances );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TOOLBAR_SHOW_RESEARCH :
2024-05-08 21:22:28 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarShowResearch );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TOOLBAR_SHOW_CHEATS :
2024-05-08 21:22:28 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarShowCheats );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TOOLBAR_SHOW_NEWS :
2024-05-08 21:22:28 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarShowNews );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TOOLBAR_SHOW_MUTE :
2024-05-08 21:22:28 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarShowMute );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TOOLBAR_SHOW_CHAT :
2024-05-08 21:22:28 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarShowChat );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TOOLBAR_SHOW_ZOOM :
2024-05-08 21:22:28 +02:00
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarShowZoom );
2024-03-10 13:52:35 +00:00
break ;
2025-01-30 23:02:36 +01:00
case WIDX_TOOLBAR_SHOW_ROTATE_ANTI_CLOCKWISE :
ToggleToolbarSetting ( Config :: Get (). interface . ToolbarShowRotateAnticlockwise );
break ;
2024-03-10 13:52:35 +00:00
case WIDX_WINDOW_BUTTONS_ON_THE_LEFT :
2024-05-10 12:10:21 +02:00
Config :: Get (). interface . WindowButtonsOnTheLeft ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
2025-01-25 13:46:08 +01:00
windowMgr -> InvalidateAll ();
2024-03-10 13:52:35 +00:00
break ;
2024-04-20 17:02:39 +02:00
case WIDX_ENLARGED_UI :
Config :: Get (). interface . EnlargedUi ^= 1 ;
2024-06-15 06:49:12 +10:00
if ( Config :: Get (). interface . EnlargedUi == false )
Config :: Get (). interface . TouchEnhancements = false ;
Config :: Save ();
Invalidate ();
2025-01-25 13:46:08 +01:00
windowMgr -> InvalidateAll ();
2024-06-15 06:49:12 +10:00
break ;
case WIDX_TOUCH_ENHANCEMENTS :
Config :: Get (). interface . TouchEnhancements ^= 1 ;
2024-04-20 17:02:39 +02:00
Config :: Save ();
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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . InvertViewportDrag ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_THEMES_BUTTON :
ContextOpenWindow ( WindowClass :: Themes );
Invalidate ();
break ;
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
void ControlsMouseDown ( 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 ++ )
{
gDropdownItems [ i ]. Format = STR_OPTIONS_DROPDOWN_ITEM ;
gDropdownItems [ i ]. Args = reinterpret_cast < uintptr_t > ( ThemeManagerGetAvailableThemeName ( i ));
}
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
WindowDropdownShowTextCustomWidth (
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height () + 1 , colours [ 1 ], 0 ,
Dropdown :: Flag :: StayOpen , numItems , widget -> width () - 3 );
Dropdown :: SetChecked ( static_cast < int32_t > ( ThemeManagerGetAvailableThemeIndex ()), true );
InvalidateWidget ( WIDX_THEMES_DROPDOWN );
break ;
}
2021-10-15 11:41:30 +02:00
}
2024-03-10 13:52:35 +00:00
void ControlsDropdown ( 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
}
2024-03-10 13:52:35 +00:00
void ControlsPrepareDraw ()
{
2024-05-10 12:10:21 +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 );
2024-05-08 21:19:57 +02:00
SetCheckboxValue ( WIDX_TOOLBAR_BUTTONS_CENTRED , Config :: Get (). interface . ToolbarButtonsCentred );
2024-05-10 12:10:21 +02:00
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 );
2025-01-30 23:02:36 +01:00
SetCheckboxValue ( WIDX_TOOLBAR_SHOW_ROTATE_ANTI_CLOCKWISE , Config :: Get (). interface . ToolbarShowRotateAnticlockwise );
2024-05-10 12:10:21 +02:00
SetCheckboxValue ( WIDX_WINDOW_BUTTONS_ON_THE_LEFT , Config :: Get (). interface . WindowButtonsOnTheLeft );
2024-04-20 17:02:39 +02:00
SetCheckboxValue ( WIDX_ENLARGED_UI , Config :: Get (). interface . EnlargedUi );
2024-06-15 06:49:12 +10:00
SetCheckboxValue ( WIDX_TOUCH_ENHANCEMENTS , Config :: Get (). interface . TouchEnhancements );
WidgetSetEnabled ( * this , WIDX_TOUCH_ENHANCEMENTS , Config :: Get (). interface . EnlargedUi );
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex ();
const utf8 * activeThemeName = ThemeManagerGetAvailableThemeName ( activeAvailableThemeIndex );
auto ft = Formatter :: Common ();
ft . Add < utf8 *> ( activeThemeName );
}
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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . ShowRealNamesOfGuests ^= 1 ;
Config :: Save ();
2022-01-29 21:52:33 +00:00
Invalidate ();
2024-09-15 22:18:00 +02:00
PeepUpdateNames ();
break ;
case WIDX_REAL_NAMES_STAFF_CHECKBOX :
Config :: Get (). general . ShowRealNamesOfStaff ^= 1 ;
Config :: Save ();
Invalidate ();
PeepUpdateNames ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_AUTO_STAFF_PLACEMENT :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . AutoStaffPlacement ^= 1 ;
Config :: Save ();
2022-04-05 23:06:47 +01:00
Invalidate ();
2024-03-10 13:52:35 +00:00
break ;
case WIDX_SCENARIO_UNLOCKING :
2025-01-19 18:49:18 +01:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . ScenarioUnlockingEnabled ^= 1 ;
Config :: Save ();
2025-01-19 18:49:18 +01:00
auto * windowMgr = Ui :: GetWindowManager ();
windowMgr -> CloseByClass ( 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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . AutoOpenShops = ! Config :: Get (). general . AutoOpenShops ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_ALLOW_EARLY_COMPLETION :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . AllowEarlyCompletion ^= 1 ;
2024-03-10 13:52:35 +00:00
// Only the server can control this setting and needs to send the
// current value of allow_early_completion to all clients
if ( NetworkGetMode () == NETWORK_MODE_SERVER )
{
auto setAllowEarlyCompletionAction = ScenarioSetSettingAction (
2024-05-10 12:10:21 +02:00
ScenarioSetSetting :: AllowEarlyCompletion , Config :: Get (). general . AllowEarlyCompletion );
2024-03-10 13:52:35 +00:00
GameActions :: Execute ( & setAllowEarlyCompletionAction );
}
2024-05-10 12:10:21 +02:00
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
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 ++ )
{
gDropdownItems [ i ]. Format = STR_OPTIONS_DROPDOWN_ITEM ;
2024-07-26 09:59:58 +02:00
gDropdownItems [ i ]. Args = reinterpret_cast < uintptr_t > ( TitleSequenceManager :: GetName ( i ));
2024-03-10 13:52:35 +00:00
}
gDropdownItems [ numItems ]. Format = 0 ;
numItems ++ ;
gDropdownItems [ numItems ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ numItems ]. Args = STR_TITLE_SEQUENCE_RANDOM ;
numItems ++ ;
WindowDropdownShowText (
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height () + 1 , colours [ 1 ],
Dropdown :: Flag :: StayOpen , numItems );
2024-05-10 12:10:21 +02:00
auto selectedIndex = Config :: Get (). interface . RandomTitleSequence
? numItems - 1
: static_cast < int32_t > ( TitleGetCurrentSequence ());
2024-03-10 13:52:35 +00:00
Dropdown :: SetChecked ( selectedIndex , true );
break ;
}
case WIDX_SCENARIO_GROUPING_DROPDOWN :
{
uint32_t numItems = 2 ;
gDropdownItems [ 0 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 0 ]. Args = STR_OPTIONS_SCENARIO_DIFFICULTY ;
gDropdownItems [ 1 ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ 1 ]. Args = STR_OPTIONS_SCENARIO_ORIGIN ;
WindowDropdownShowTextCustomWidth (
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height () + 1 , colours [ 1 ], 0 ,
Dropdown :: Flag :: StayOpen , numItems , widget -> width () - 3 );
2025-03-25 00:37:08 +01:00
Dropdown :: SetChecked ( EnumValue ( Config :: Get (). general . scenarioSelectMode ), true );
2024-03-10 13:52:35 +00:00
break ;
}
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN :
for ( size_t i = 0 ; i < 7 ; i ++ )
{
gDropdownItems [ i ]. Format = STR_DROPDOWN_MENU_LABEL ;
2024-07-13 12:30:40 +02:00
gDropdownItems [ i ]. Args = kRideInspectionIntervalNames [ i ];
2024-03-10 13:52:35 +00:00
}
ShowDropdown ( widget , 7 );
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( Config :: Get (). general . DefaultInspectionInterval , 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 ()))
{
2024-05-10 12:10:21 +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 ();
2024-03-10 13:52:35 +00:00
Invalidate ();
}
else if ( dropdownIndex == numItems + 1 )
{
2024-05-10 12:10:21 +02:00
Config :: Get (). interface . RandomTitleSequence = true ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
}
break ;
}
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN :
2024-05-10 12:10:21 +02:00
if ( dropdownIndex != Config :: Get (). general . DefaultInspectionInterval )
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . DefaultInspectionInterval = static_cast < uint8_t > ( dropdownIndex );
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
}
break ;
case WIDX_SCENARIO_GROUPING_DROPDOWN :
2025-03-25 00:37:08 +01:00
if ( dropdownIndex != EnumValue ( Config :: Get (). general . scenarioSelectMode ))
2024-03-10 13:52:35 +00:00
{
2025-03-25 00:37:08 +01:00
Config :: Get (). general . scenarioSelectMode = static_cast < ScenarioSelectMode > ( dropdownIndex );
2024-05-10 12:10:21 +02:00
Config :: Get (). interface . ScenarioselectLastTab = 0 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
2025-01-19 18:49:18 +01:00
auto * windowMgr = Ui :: GetWindowManager ();
windowMgr -> CloseByClass ( WindowClass :: ScenarioSelect );
2024-03-10 13:52:35 +00:00
}
break ;
}
}
void MiscPrepareDraw ()
{
auto ft = Formatter :: Common ();
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). interface . RandomTitleSequence )
2024-03-10 13:52:35 +00:00
{
ft . Add < StringId > ( STR_TITLE_SEQUENCE_RANDOM );
}
else
{
2024-07-26 09:59:58 +02:00
auto name = TitleSequenceManager :: GetName ( TitleGetConfigSequence ());
2024-03-10 13:52:35 +00:00
ft . Add < StringId > ( STR_STRING );
ft . Add < utf8 *> ( name );
}
// The real name setting of clients is fixed to that of the server
// and the server cannot change the setting during gameplay to prevent desyncs
if ( NetworkGetMode () != NETWORK_MODE_NONE )
{
2024-09-15 22:18:00 +02:00
disabled_widgets |= ( 1uLL << WIDX_REAL_NAMES_GUESTS_CHECKBOX ) | ( 1uLL << WIDX_REAL_NAMES_STAFF_CHECKBOX );
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
if ( NetworkGetMode () == NETWORK_MODE_CLIENT )
{
disabled_widgets |= ( 1uLL << WIDX_ALLOW_EARLY_COMPLETION );
widgets [ WIDX_ALLOW_EARLY_COMPLETION ]. tooltip = STR_OPTION_DISABLED_DURING_NETWORK_PLAY ;
}
}
2024-09-15 22:18:00 +02:00
SetCheckboxValue ( WIDX_REAL_NAMES_GUESTS_CHECKBOX , Config :: Get (). general . ShowRealNamesOfGuests );
SetCheckboxValue ( WIDX_REAL_NAMES_STAFF_CHECKBOX , Config :: Get (). general . ShowRealNamesOfStaff );
2024-05-10 12:10:21 +02:00
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-03-25 00:37:08 +01:00
if ( Config :: Get (). general . scenarioSelectMode == ScenarioSelectMode :: difficulty )
2024-03-10 13:52:35 +00:00
widgets [ WIDX_SCENARIO_GROUPING ]. text = STR_OPTIONS_SCENARIO_DIFFICULTY ;
else
widgets [ WIDX_SCENARIO_GROUPING ]. text = STR_OPTIONS_SCENARIO_ORIGIN ;
2024-05-10 12:10:21 +02:00
SetCheckboxValue ( WIDX_SCENARIO_UNLOCKING , Config :: Get (). general . ScenarioUnlockingEnabled );
2024-03-10 13:52:35 +00:00
2025-03-25 00:37:08 +01:00
if ( Config :: Get (). general . scenarioSelectMode == ScenarioSelectMode :: origin )
2024-03-10 13:52:35 +00:00
{
disabled_widgets &= ~ ( 1uLL << WIDX_SCENARIO_UNLOCKING );
}
else
{
disabled_widgets |= ( 1uLL << WIDX_SCENARIO_UNLOCKING );
}
2024-07-13 12:30:40 +02:00
widgets [ WIDX_DEFAULT_INSPECTION_INTERVAL ]. text = kRideInspectionIntervalNames
2024-05-10 12:10:21 +02:00
[ Config :: Get (). general . DefaultInspectionInterval ];
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 :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . DebuggingTools ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
GfxInvalidateScreen ();
break ;
case WIDX_SAVE_PLUGIN_DATA_CHECKBOX :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . SavePluginData ^= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_STAY_CONNECTED_AFTER_DESYNC :
2024-05-10 12:10:21 +02:00
Config :: Get (). network . StayConnected = ! Config :: Get (). network . StayConnected ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_ALWAYS_NATIVE_LOADSAVE :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . UseNativeBrowseDialog = ! Config :: Get (). general . UseNativeBrowseDialog ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_PATH_TO_RCT1_BUTTON :
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
auto rct1path = OpenRCT2 :: GetContext () -> GetUiContext () -> ShowDirectoryDialog (
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 ))
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . RCT1Path = std :: move ( rct1path );
Config :: Get (). interface . ScenarioselectLastTab = 0 ;
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
}
}
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
}
case WIDX_PATH_TO_RCT1_CLEAR :
2024-05-10 12:10:21 +02:00
if ( ! Config :: Get (). general . RCT1Path . empty ())
2020-10-04 17:08:10 +02:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . RCT1Path . clear ();
Config :: Save ();
2020-10-04 17:08:10 +02:00
}
2024-03-10 13:52:35 +00:00
Invalidate ();
break ;
case WIDX_ASSET_PACKS :
ContextOpenWindow ( WindowClass :: AssetPacks );
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 ++ )
{
gDropdownItems [ i ]. Format = STR_DROPDOWN_MENU_LABEL ;
gDropdownItems [ i ]. Args = AutosaveNames [ i ];
}
ShowDropdown ( widget , AUTOSAVE_NEVER + 1 );
2024-05-10 12:10:21 +02:00
Dropdown :: SetChecked ( Config :: Get (). general . AutosaveFrequency , true );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_AUTOSAVE_AMOUNT_UP :
2024-05-10 12:10:21 +02:00
Config :: Get (). general . AutosaveAmount += 1 ;
Config :: Save ();
2022-02-17 22:09:39 +00:00
InvalidateWidget ( WIDX_AUTOSAVE_FREQUENCY );
InvalidateWidget ( WIDX_AUTOSAVE_FREQUENCY_DROPDOWN );
2022-01-29 21:52:33 +00:00
InvalidateWidget ( WIDX_AUTOSAVE_AMOUNT );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_AUTOSAVE_AMOUNT_DOWN :
2024-05-10 12:10:21 +02:00
if ( Config :: Get (). general . AutosaveAmount > 1 )
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . AutosaveAmount -= 1 ;
Config :: Save ();
2024-03-10 13:52:35 +00:00
InvalidateWidget ( WIDX_AUTOSAVE_FREQUENCY );
InvalidateWidget ( WIDX_AUTOSAVE_FREQUENCY_DROPDOWN );
InvalidateWidget ( WIDX_AUTOSAVE_AMOUNT );
}
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 :
2024-05-10 12:10:21 +02:00
if ( dropdownIndex != Config :: Get (). general . AutosaveFrequency )
2024-03-10 13:52:35 +00:00
{
2024-05-10 12:10:21 +02:00
Config :: Get (). general . AutosaveFrequency = static_cast < uint8_t > ( dropdownIndex );
Config :: Save ();
2024-03-10 13:52:35 +00:00
Invalidate ();
}
break ;
}
}
void AdvancedPrepareDraw ()
{
2024-05-10 12:10:21 +02:00
SetCheckboxValue ( WIDX_DEBUGGING_TOOLS , Config :: Get (). general . DebuggingTools );
SetCheckboxValue ( WIDX_SAVE_PLUGIN_DATA_CHECKBOX , Config :: Get (). general . SavePluginData );
SetCheckboxValue ( WIDX_STAY_CONNECTED_AFTER_DESYNC , Config :: Get (). network . StayConnected );
SetCheckboxValue ( WIDX_ALWAYS_NATIVE_LOADSAVE , Config :: Get (). general . UseNativeBrowseDialog );
widgets [ WIDX_AUTOSAVE_FREQUENCY ]. text = AutosaveNames [ Config :: Get (). general . AutosaveFrequency ];
2024-03-10 13:52:35 +00:00
}
void AdvancedDraw ( DrawPixelInfo & dpi )
{
auto ft = Formatter ();
2024-05-10 12:10:21 +02:00
ft . Add < int32_t > ( static_cast < int32_t > ( Config :: Get (). general . AutosaveAmount ));
2024-03-10 13:52:35 +00:00
DrawTextBasic (
dpi ,
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
2024-05-10 12:10:21 +02:00
const auto normalisedPath = Platform :: StrDecompToPrecomp ( Config :: Get (). general . RCT1Path );
2024-03-10 13:52:35 +00:00
ft = Formatter ();
ft . Add < const utf8 *> ( normalisedPath . c_str ());
Widget pathWidget = widgets [ WIDX_PATH_TO_RCT1_BUTTON ];
// Apply vertical alignment if appropriate.
int32_t widgetHeight = pathWidget . bottom - pathWidget . top ;
int32_t lineHeight = FontGetLineHeight ( FontStyle :: Medium );
uint32_t padding = widgetHeight > lineHeight ? ( widgetHeight - lineHeight ) / 2 : 0 ;
ScreenCoordsXY screenCoords = { windowPos . x + pathWidget . left + 1 ,
windowPos . y + pathWidget . top + static_cast < int32_t > ( padding ) };
DrawTextEllipsised ( dpi , screenCoords , 277 , STR_STRING , ft , { colours [ 1 ] });
}
OpenRCT2String AdvancedTooltip ( WidgetIndex widgetIndex , StringId fallback )
{
if ( widgetIndex == WIDX_PATH_TO_RCT1_BUTTON )
{
2024-05-10 12:10:21 +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 ();
2024-05-10 12:10:21 +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
2024-03-10 13:52:35 +00: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 ;
frame_no = 0 ;
pressed_widgets = 0 ;
2025-01-18 14:45:17 +02:00
SetWidgets ( window_options_page_widgets [ page ]);
2024-03-10 13:52:35 +00:00
Invalidate ();
OnResize ();
OnPrepareDraw ();
InitScrollWidgets ();
Invalidate ();
}
void SetPressedTab ()
{
for ( int32_t i = 0 ; i < WINDOW_OPTIONS_PAGE_COUNT ; i ++ )
pressed_widgets &= ~ ( 1 << ( WIDX_FIRST_TAB + i ));
pressed_widgets |= 1LL << ( WIDX_FIRST_TAB + page );
}
void ShowDropdown ( Widget * widget , int32_t num_items )
{
// helper function, all dropdown boxes have similar properties
WindowDropdownShowTextCustomWidth (
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height () + 1 , colours [ 1 ], 0 ,
Dropdown :: Flag :: StayOpen , num_items , widget -> width () - 3 );
}
void DrawTabImages ( DrawPixelInfo & dpi )
{
DrawTabImage ( dpi , WINDOW_OPTIONS_PAGE_DISPLAY , SPR_TAB_PAINT_0 );
DrawTabImage ( dpi , WINDOW_OPTIONS_PAGE_RENDERING , SPR_G2_TAB_TREE );
DrawTabImage ( dpi , WINDOW_OPTIONS_PAGE_CULTURE , SPR_TAB_TIMER_0 );
DrawTabImage ( dpi , WINDOW_OPTIONS_PAGE_AUDIO , SPR_TAB_MUSIC_0 );
DrawTabImage ( dpi , WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE , SPR_TAB_GEARS_0 );
DrawTabImage ( dpi , WINDOW_OPTIONS_PAGE_MISC , SPR_TAB_RIDE_0 );
DrawTabImage ( dpi , WINDOW_OPTIONS_PAGE_ADVANCED , SPR_TAB_WRENCH_0 );
}
void DrawTabImage ( DrawPixelInfo & dpi , int32_t p , int32_t spriteIndex )
{
WidgetIndex widgetIndex = WIDX_FIRST_TAB + p ;
Widget * widget = & widgets [ widgetIndex ];
auto screenCoords = windowPos + ScreenCoordsXY { widget -> left , widget -> top };
if ( ! WidgetIsDisabled ( * this , widgetIndex ))
2021-10-15 11:41:30 +02:00
{
2024-03-10 13:52:35 +00:00
if ( page == p )
{
int32_t frame = frame_no / TabAnimationDivisor [ page ];
spriteIndex += ( frame % TabAnimationFrames [ page ]);
}
// Draw normal, enabled sprite.
GfxDrawSprite ( dpi , 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 (
2024-05-09 02:45:07 +02:00
dpi , ImageId ( spriteIndex ), screenCoords + ScreenCoordsXY { 1 , 1 }, ColourMapA [ windowColour ]. lighter );
2024-03-10 13:52:35 +00:00
// Draw greyed out (dark)
2024-05-09 02:45:07 +02:00
GfxDrawSpriteSolid ( dpi , ImageId ( spriteIndex ), screenCoords , ColourMapA [ windowColour ]. mid_light );
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
{
uint8_t w = widget . width () - 1 ;
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
2024-03-10 13:52:35 +00:00
void InitializeScrollPosition ( WidgetIndex widgetIndex , int32_t scrollId , uint8_t volume )
{
const auto & widget = widgets [ widgetIndex ];
auto & scroll = scrolls [ scrollId ];
2021-10-15 11:41:30 +02:00
2024-08-11 16:21:53 +02:00
int32_t widgetSize = scroll . contentWidth - ( widget . width () - 1 );
scroll . contentOffsetX = ceil ( volume / 100.0f * widgetSize );
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
WidgetScrollUpdateThumbs ( * this , widgetIndex );
}
2021-10-15 11:41:30 +02:00
2024-03-10 13:52:35 +00:00
static bool IsRCT1TitleMusicAvailable ()
{
auto env = GetContext () -> GetPlatformEnvironment ();
2025-03-25 22:27:57 +01:00
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,
2 , // WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE,
4 , // WINDOW_OPTIONS_PAGE_MISC,
2 , // WINDOW_OPTIONS_PAGE_ADVANCED,
};
static constexpr int32_t TabAnimationFrames [] = {
8 , // WINDOW_OPTIONS_PAGE_DISPLAY,
1 , // WINDOW_OPTIONS_PAGE_RENDERING,
8 , // WINDOW_OPTIONS_PAGE_CULTURE,
16 , // WINDOW_OPTIONS_PAGE_AUDIO,
4 , // WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE,
16 , // WINDOW_OPTIONS_PAGE_MISC,
16 , // WINDOW_OPTIONS_PAGE_ADVANCED,
};
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 ();
return windowMgr -> FocusOrCreate < OptionsWindow > ( WindowClass :: Options , WW , WH , WF_CENTRE_SCREEN );
2024-03-10 13:52:35 +00:00
}
} // namespace OpenRCT2::Ui::Windows