2021-04-14 00:43:11 +00:00
|
|
|
use super::SessionState;
|
|
|
|
use crate::{
|
|
|
|
controller::ControllerSettings,
|
2021-07-21 11:23:45 +00:00
|
|
|
game_input::GameInput,
|
2021-04-14 00:43:11 +00:00
|
|
|
hud::{
|
2021-05-14 12:27:15 +00:00
|
|
|
BarNumbers, BuffPosition, ChatTab, CrosshairType, Intro, PressBehavior, ScaleChange,
|
2021-04-14 00:43:11 +00:00
|
|
|
ShortcutNumbers, XpBar,
|
|
|
|
},
|
|
|
|
render::RenderMode,
|
|
|
|
settings::{
|
2021-05-14 12:27:15 +00:00
|
|
|
AudioSettings, ChatSettings, ControlSettings, Fps, GamepadSettings, GameplaySettings,
|
|
|
|
GraphicsSettings, InterfaceSettings,
|
2021-04-14 00:43:11 +00:00
|
|
|
},
|
2021-07-21 11:23:45 +00:00
|
|
|
window::FullScreenSettings,
|
2021-04-14 00:43:11 +00:00
|
|
|
GlobalState,
|
|
|
|
};
|
2021-07-29 18:47:45 +00:00
|
|
|
use i18n::{LanguageMetadata, LocalizationHandle};
|
2021-04-14 00:43:11 +00:00
|
|
|
use vek::*;
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum Audio {
|
2021-04-18 19:52:35 +00:00
|
|
|
AdjustMasterVolume(f32),
|
|
|
|
AdjustInactiveMasterVolume(f32),
|
2021-04-14 00:43:11 +00:00
|
|
|
AdjustMusicVolume(f32),
|
|
|
|
AdjustSfxVolume(f32),
|
|
|
|
//ChangeAudioDevice(String),
|
|
|
|
ResetAudioSettings,
|
|
|
|
}
|
|
|
|
#[derive(Clone)]
|
2021-05-14 12:27:15 +00:00
|
|
|
pub enum Chat {
|
|
|
|
Transp(f32),
|
|
|
|
CharName(bool),
|
|
|
|
ChangeChatTab(Option<usize>),
|
|
|
|
ChatTabUpdate(usize, ChatTab),
|
|
|
|
ChatTabInsert(usize, ChatTab),
|
|
|
|
ChatTabMove(usize, usize), //(i, j) move item from position i, and insert into position j
|
|
|
|
ChatTabRemove(usize),
|
|
|
|
ResetChatSettings,
|
|
|
|
}
|
|
|
|
#[derive(Clone)]
|
2021-04-14 00:43:11 +00:00
|
|
|
pub enum Control {
|
|
|
|
ChangeBinding(GameInput),
|
|
|
|
ResetKeyBindings,
|
|
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum Gamepad {}
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum Gameplay {
|
|
|
|
AdjustMousePan(u32),
|
|
|
|
AdjustMouseZoom(u32),
|
|
|
|
AdjustCameraClamp(u32),
|
|
|
|
|
|
|
|
ToggleControllerYInvert(bool),
|
|
|
|
ToggleMouseYInvert(bool),
|
|
|
|
ToggleZoomInvert(bool),
|
|
|
|
|
|
|
|
ToggleSmoothPan(bool),
|
|
|
|
|
|
|
|
ChangeFreeLookBehavior(PressBehavior),
|
|
|
|
ChangeAutoWalkBehavior(PressBehavior),
|
|
|
|
ChangeCameraClampBehavior(PressBehavior),
|
2021-04-14 19:51:03 +00:00
|
|
|
ChangePlayerPhysicsBehavior { server_authoritative: bool },
|
2021-04-14 00:43:11 +00:00
|
|
|
ChangeStopAutoWalkOnInput(bool),
|
|
|
|
ChangeAutoCamera(bool),
|
|
|
|
|
|
|
|
ResetGameplaySettings,
|
|
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum Graphics {
|
|
|
|
AdjustViewDistance(u32),
|
|
|
|
AdjustLodDetail(u32),
|
|
|
|
AdjustSpriteRenderDistance(u32),
|
|
|
|
AdjustFigureLoDRenderDistance(u32),
|
|
|
|
|
|
|
|
ChangeMaxFPS(Fps),
|
|
|
|
ChangeFOV(u16),
|
|
|
|
|
|
|
|
ChangeGamma(f32),
|
|
|
|
ChangeExposure(f32),
|
|
|
|
ChangeAmbiance(f32),
|
|
|
|
|
|
|
|
ChangeRenderMode(Box<RenderMode>),
|
|
|
|
|
|
|
|
ChangeFullscreenMode(FullScreenSettings),
|
|
|
|
ToggleParticlesEnabled(bool),
|
2021-05-01 18:28:20 +00:00
|
|
|
ToggleLossyTerrainCompression(bool),
|
2021-04-14 00:43:11 +00:00
|
|
|
AdjustWindowSize([u16; 2]),
|
|
|
|
|
|
|
|
ResetGraphicsSettings,
|
|
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum Interface {
|
|
|
|
Sct(bool),
|
|
|
|
SctPlayerBatch(bool),
|
|
|
|
SctDamageBatch(bool),
|
|
|
|
SpeechBubbleDarkMode(bool),
|
|
|
|
SpeechBubbleIcon(bool),
|
|
|
|
ToggleHelp(bool),
|
|
|
|
ToggleDebug(bool),
|
2021-05-04 20:12:26 +00:00
|
|
|
ToggleHitboxes(bool),
|
2021-06-21 19:16:03 +00:00
|
|
|
ToggleChat(bool),
|
2021-04-14 00:43:11 +00:00
|
|
|
ToggleTips(bool),
|
2021-09-24 16:03:05 +00:00
|
|
|
ToggleHotkeyHints(bool),
|
2021-04-14 00:43:11 +00:00
|
|
|
|
|
|
|
CrosshairTransp(f32),
|
|
|
|
CrosshairType(CrosshairType),
|
|
|
|
Intro(Intro),
|
|
|
|
ToggleXpBar(XpBar),
|
|
|
|
ToggleBarNumbers(BarNumbers),
|
2021-09-15 12:04:44 +00:00
|
|
|
ToggleAlwaysShowBars(bool),
|
2021-04-14 00:43:11 +00:00
|
|
|
ToggleShortcutNumbers(ShortcutNumbers),
|
|
|
|
BuffPosition(BuffPosition),
|
|
|
|
|
|
|
|
UiScale(ScaleChange),
|
2021-04-14 13:29:22 +00:00
|
|
|
//Minimap
|
|
|
|
MinimapShow(bool),
|
|
|
|
MinimapFaceNorth(bool),
|
2021-04-19 18:51:53 +00:00
|
|
|
MinimapZoom(f64),
|
2021-04-14 00:43:11 +00:00
|
|
|
//Map settings
|
|
|
|
MapZoom(f64),
|
|
|
|
MapDrag(Vec2<f64>),
|
|
|
|
MapShowTopoMap(bool),
|
|
|
|
MapShowDifficulty(bool),
|
|
|
|
MapShowTowns(bool),
|
|
|
|
MapShowDungeons(bool),
|
|
|
|
MapShowCastles(bool),
|
|
|
|
MapShowCaves(bool),
|
|
|
|
MapShowTrees(bool),
|
2021-05-03 02:00:23 +00:00
|
|
|
MapShowPeaks(bool),
|
2021-05-14 00:46:17 +00:00
|
|
|
MapShowVoxelMap(bool),
|
2021-04-14 00:43:11 +00:00
|
|
|
|
|
|
|
ResetInterfaceSettings,
|
|
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum Language {
|
|
|
|
ChangeLanguage(Box<LanguageMetadata>),
|
2021-04-24 14:39:35 +00:00
|
|
|
ToggleEnglishFallback(bool),
|
2021-04-14 00:43:11 +00:00
|
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum Networking {}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub enum SettingsChange {
|
|
|
|
Audio(Audio),
|
2021-05-14 12:27:15 +00:00
|
|
|
Chat(Chat),
|
2021-04-14 00:43:11 +00:00
|
|
|
Control(Control),
|
|
|
|
Gamepad(Gamepad),
|
|
|
|
Gameplay(Gameplay),
|
|
|
|
Graphics(Graphics),
|
|
|
|
Interface(Interface),
|
|
|
|
Language(Language),
|
|
|
|
Networking(Networking),
|
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! settings_change_from {
|
|
|
|
($i: ident) => {
|
|
|
|
impl From<$i> for SettingsChange {
|
|
|
|
fn from(change: $i) -> Self { SettingsChange::$i(change) }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
settings_change_from!(Audio);
|
2021-05-14 12:27:15 +00:00
|
|
|
settings_change_from!(Chat);
|
2021-04-14 00:43:11 +00:00
|
|
|
settings_change_from!(Control);
|
|
|
|
settings_change_from!(Gamepad);
|
|
|
|
settings_change_from!(Gameplay);
|
|
|
|
settings_change_from!(Graphics);
|
|
|
|
settings_change_from!(Interface);
|
|
|
|
settings_change_from!(Language);
|
|
|
|
settings_change_from!(Networking);
|
|
|
|
|
|
|
|
impl SettingsChange {
|
|
|
|
pub fn process(self, global_state: &mut GlobalState, session_state: &mut SessionState) {
|
2021-04-14 00:55:52 +00:00
|
|
|
let mut settings = &mut global_state.settings;
|
2021-04-14 00:43:11 +00:00
|
|
|
match self {
|
2021-04-14 00:55:52 +00:00
|
|
|
SettingsChange::Audio(audio_change) => {
|
|
|
|
match audio_change {
|
2021-04-18 19:52:35 +00:00
|
|
|
Audio::AdjustMasterVolume(master_volume) => {
|
|
|
|
global_state.audio.set_master_volume(master_volume);
|
|
|
|
|
|
|
|
settings.audio.master_volume = master_volume;
|
|
|
|
},
|
2021-05-09 09:51:41 +00:00
|
|
|
Audio::AdjustInactiveMasterVolume(inactive_master_volume_perc) => {
|
|
|
|
settings.audio.inactive_master_volume_perc = inactive_master_volume_perc;
|
2021-04-18 19:52:35 +00:00
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
Audio::AdjustMusicVolume(music_volume) => {
|
|
|
|
global_state.audio.set_music_volume(music_volume);
|
2021-04-14 00:43:11 +00:00
|
|
|
|
2021-04-14 00:55:52 +00:00
|
|
|
settings.audio.music_volume = music_volume;
|
|
|
|
},
|
|
|
|
Audio::AdjustSfxVolume(sfx_volume) => {
|
|
|
|
global_state.audio.set_sfx_volume(sfx_volume);
|
2021-04-14 00:43:11 +00:00
|
|
|
|
2021-04-14 00:55:52 +00:00
|
|
|
settings.audio.sfx_volume = sfx_volume;
|
|
|
|
},
|
|
|
|
//Audio::ChangeAudioDevice(name) => {
|
|
|
|
// global_state.audio.set_device(name.clone());
|
2021-04-14 00:43:11 +00:00
|
|
|
|
2021-04-14 00:55:52 +00:00
|
|
|
// settings.audio.output = AudioOutput::Device(name);
|
|
|
|
//},
|
|
|
|
Audio::ResetAudioSettings => {
|
|
|
|
settings.audio = AudioSettings::default();
|
|
|
|
let audio = &settings.audio;
|
|
|
|
global_state.audio.set_music_volume(audio.music_volume);
|
|
|
|
global_state.audio.set_sfx_volume(audio.sfx_volume);
|
|
|
|
},
|
|
|
|
}
|
2021-04-14 00:43:11 +00:00
|
|
|
},
|
2021-05-14 12:27:15 +00:00
|
|
|
SettingsChange::Chat(chat_change) => {
|
|
|
|
let chat_tabs = &mut settings.chat.chat_tabs;
|
|
|
|
match chat_change {
|
2021-08-01 19:40:06 +00:00
|
|
|
Chat::Transp(chat_opacity) => {
|
|
|
|
settings.chat.chat_opacity = chat_opacity;
|
2021-05-14 12:27:15 +00:00
|
|
|
},
|
|
|
|
Chat::CharName(chat_char_name) => {
|
|
|
|
settings.chat.chat_character_name = chat_char_name;
|
|
|
|
},
|
|
|
|
Chat::ChangeChatTab(chat_tab_index) => {
|
|
|
|
settings.chat.chat_tab_index =
|
|
|
|
chat_tab_index.filter(|i| *i < chat_tabs.len());
|
|
|
|
},
|
|
|
|
Chat::ChatTabUpdate(i, chat_tab) => {
|
|
|
|
if i < chat_tabs.len() {
|
|
|
|
chat_tabs[i] = chat_tab;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Chat::ChatTabInsert(i, chat_tab) => {
|
|
|
|
if i <= chat_tabs.len() {
|
|
|
|
settings.chat.chat_tabs.insert(i, chat_tab);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Chat::ChatTabMove(i, j) => {
|
|
|
|
if i < chat_tabs.len() && j < chat_tabs.len() {
|
|
|
|
let chat_tab = settings.chat.chat_tabs.remove(i);
|
|
|
|
settings.chat.chat_tabs.insert(j, chat_tab);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Chat::ChatTabRemove(i) => {
|
|
|
|
if i < chat_tabs.len() {
|
|
|
|
settings.chat.chat_tabs.remove(i);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Chat::ResetChatSettings => {
|
|
|
|
settings.chat = ChatSettings::default();
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2021-04-14 00:43:11 +00:00
|
|
|
SettingsChange::Control(control_change) => match control_change {
|
|
|
|
Control::ChangeBinding(game_input) => {
|
|
|
|
global_state.window.set_keybinding_mode(game_input);
|
|
|
|
},
|
|
|
|
Control::ResetKeyBindings => {
|
2021-04-14 00:55:52 +00:00
|
|
|
settings.controls = ControlSettings::default();
|
2021-04-14 00:43:11 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
SettingsChange::Gamepad(gamepad_change) => match gamepad_change {},
|
2021-04-14 00:55:52 +00:00
|
|
|
SettingsChange::Gameplay(gameplay_change) => {
|
|
|
|
let mut window = &mut global_state.window;
|
|
|
|
match gameplay_change {
|
|
|
|
Gameplay::AdjustMousePan(sensitivity) => {
|
|
|
|
window.pan_sensitivity = sensitivity;
|
|
|
|
settings.gameplay.pan_sensitivity = sensitivity;
|
|
|
|
},
|
|
|
|
Gameplay::AdjustMouseZoom(sensitivity) => {
|
|
|
|
window.zoom_sensitivity = sensitivity;
|
|
|
|
settings.gameplay.zoom_sensitivity = sensitivity;
|
|
|
|
},
|
|
|
|
Gameplay::AdjustCameraClamp(angle) => {
|
|
|
|
settings.gameplay.camera_clamp_angle = angle;
|
|
|
|
},
|
|
|
|
Gameplay::ToggleControllerYInvert(controller_y_inverted) => {
|
|
|
|
window.controller_settings.pan_invert_y = controller_y_inverted;
|
|
|
|
settings.controller.pan_invert_y = controller_y_inverted;
|
|
|
|
},
|
|
|
|
Gameplay::ToggleMouseYInvert(mouse_y_inverted) => {
|
|
|
|
window.mouse_y_inversion = mouse_y_inverted;
|
|
|
|
settings.gameplay.mouse_y_inversion = mouse_y_inverted;
|
|
|
|
},
|
|
|
|
Gameplay::ToggleZoomInvert(zoom_inverted) => {
|
|
|
|
window.zoom_inversion = zoom_inverted;
|
|
|
|
settings.gameplay.zoom_inversion = zoom_inverted;
|
|
|
|
},
|
|
|
|
Gameplay::ToggleSmoothPan(smooth_pan_enabled) => {
|
|
|
|
settings.gameplay.smooth_pan_enable = smooth_pan_enabled;
|
|
|
|
},
|
|
|
|
Gameplay::ChangeFreeLookBehavior(behavior) => {
|
|
|
|
settings.gameplay.free_look_behavior = behavior;
|
|
|
|
},
|
|
|
|
Gameplay::ChangeAutoWalkBehavior(behavior) => {
|
|
|
|
settings.gameplay.auto_walk_behavior = behavior;
|
|
|
|
},
|
|
|
|
Gameplay::ChangeCameraClampBehavior(behavior) => {
|
|
|
|
settings.gameplay.camera_clamp_behavior = behavior;
|
|
|
|
},
|
2021-04-14 19:51:03 +00:00
|
|
|
Gameplay::ChangePlayerPhysicsBehavior {
|
|
|
|
server_authoritative,
|
|
|
|
} => {
|
|
|
|
settings.gameplay.player_physics_behavior = server_authoritative;
|
|
|
|
session_state
|
|
|
|
.client
|
|
|
|
.borrow_mut()
|
|
|
|
.request_player_physics(server_authoritative);
|
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
Gameplay::ChangeStopAutoWalkOnInput(state) => {
|
|
|
|
settings.gameplay.stop_auto_walk_on_input = state;
|
|
|
|
},
|
|
|
|
Gameplay::ChangeAutoCamera(state) => {
|
|
|
|
settings.gameplay.auto_camera = state;
|
|
|
|
},
|
|
|
|
Gameplay::ResetGameplaySettings => {
|
|
|
|
// Reset Gameplay Settings
|
|
|
|
settings.gameplay = GameplaySettings::default();
|
|
|
|
// Reset Gamepad and Controller Settings
|
|
|
|
settings.controller = GamepadSettings::default();
|
|
|
|
window.controller_settings = ControllerSettings::from(&settings.controller);
|
|
|
|
// Pan Sensitivity
|
|
|
|
window.pan_sensitivity = settings.gameplay.pan_sensitivity;
|
|
|
|
// Zoom Sensitivity
|
|
|
|
window.zoom_sensitivity = settings.gameplay.zoom_sensitivity;
|
|
|
|
// Invert Scroll Zoom
|
|
|
|
window.zoom_inversion = settings.gameplay.zoom_inversion;
|
|
|
|
// Invert Mouse Y Axis
|
|
|
|
window.mouse_y_inversion = settings.gameplay.mouse_y_inversion;
|
|
|
|
},
|
|
|
|
}
|
2021-04-14 00:43:11 +00:00
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
SettingsChange::Graphics(graphics_change) => {
|
|
|
|
match graphics_change {
|
|
|
|
Graphics::AdjustViewDistance(view_distance) => {
|
|
|
|
session_state
|
|
|
|
.client
|
|
|
|
.borrow_mut()
|
|
|
|
.set_view_distance(view_distance);
|
2021-04-14 00:43:11 +00:00
|
|
|
|
2021-04-14 00:55:52 +00:00
|
|
|
settings.graphics.view_distance = view_distance;
|
|
|
|
},
|
|
|
|
Graphics::AdjustLodDetail(lod_detail) => {
|
|
|
|
session_state.scene.lod.set_detail(lod_detail);
|
2021-04-14 00:43:11 +00:00
|
|
|
|
2021-04-14 00:55:52 +00:00
|
|
|
settings.graphics.lod_detail = lod_detail;
|
|
|
|
},
|
|
|
|
Graphics::AdjustSpriteRenderDistance(sprite_render_distance) => {
|
|
|
|
settings.graphics.sprite_render_distance = sprite_render_distance;
|
|
|
|
},
|
|
|
|
Graphics::AdjustFigureLoDRenderDistance(figure_lod_render_distance) => {
|
|
|
|
settings.graphics.figure_lod_render_distance = figure_lod_render_distance;
|
|
|
|
},
|
|
|
|
Graphics::ChangeMaxFPS(fps) => {
|
|
|
|
settings.graphics.max_fps = fps;
|
|
|
|
},
|
|
|
|
Graphics::ChangeFOV(new_fov) => {
|
|
|
|
settings.graphics.fov = new_fov;
|
|
|
|
session_state.scene.camera_mut().set_fov_deg(new_fov);
|
|
|
|
session_state
|
|
|
|
.scene
|
|
|
|
.camera_mut()
|
|
|
|
.compute_dependents(&*session_state.client.borrow().state().terrain());
|
|
|
|
},
|
|
|
|
Graphics::ChangeGamma(new_gamma) => {
|
|
|
|
settings.graphics.gamma = new_gamma;
|
|
|
|
},
|
|
|
|
Graphics::ChangeExposure(new_exposure) => {
|
|
|
|
settings.graphics.exposure = new_exposure;
|
|
|
|
},
|
|
|
|
Graphics::ChangeAmbiance(new_ambiance) => {
|
|
|
|
settings.graphics.ambiance = new_ambiance;
|
|
|
|
},
|
|
|
|
Graphics::ChangeRenderMode(new_render_mode) => {
|
|
|
|
// Do this first so if it crashes the setting isn't saved :)
|
|
|
|
global_state
|
|
|
|
.window
|
|
|
|
.renderer_mut()
|
|
|
|
.set_render_mode((&*new_render_mode).clone())
|
|
|
|
.unwrap();
|
|
|
|
settings.graphics.render_mode = *new_render_mode;
|
|
|
|
},
|
|
|
|
Graphics::ChangeFullscreenMode(new_fullscreen_settings) => {
|
|
|
|
global_state
|
|
|
|
.window
|
|
|
|
.set_fullscreen_mode(new_fullscreen_settings);
|
|
|
|
settings.graphics.fullscreen = new_fullscreen_settings;
|
|
|
|
},
|
|
|
|
Graphics::ToggleParticlesEnabled(particles_enabled) => {
|
|
|
|
settings.graphics.particles_enabled = particles_enabled;
|
|
|
|
},
|
2021-05-01 18:28:20 +00:00
|
|
|
Graphics::ToggleLossyTerrainCompression(lossy_terrain_compression) => {
|
|
|
|
settings.graphics.lossy_terrain_compression = lossy_terrain_compression;
|
|
|
|
session_state
|
|
|
|
.client
|
|
|
|
.borrow_mut()
|
|
|
|
.request_lossy_terrain_compression(lossy_terrain_compression);
|
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
Graphics::AdjustWindowSize(new_size) => {
|
|
|
|
global_state.window.set_size(new_size.into());
|
|
|
|
settings.graphics.window_size = new_size;
|
|
|
|
},
|
|
|
|
Graphics::ResetGraphicsSettings => {
|
|
|
|
settings.graphics = GraphicsSettings::default();
|
|
|
|
let graphics = &settings.graphics;
|
|
|
|
// View distance
|
|
|
|
session_state
|
|
|
|
.client
|
|
|
|
.borrow_mut()
|
|
|
|
.set_view_distance(graphics.view_distance);
|
|
|
|
// FOV
|
|
|
|
session_state.scene.camera_mut().set_fov_deg(graphics.fov);
|
|
|
|
session_state
|
|
|
|
.scene
|
|
|
|
.camera_mut()
|
|
|
|
.compute_dependents(&*session_state.client.borrow().state().terrain());
|
|
|
|
// LoD
|
|
|
|
session_state.scene.lod.set_detail(graphics.lod_detail);
|
|
|
|
// Render mode
|
|
|
|
global_state
|
|
|
|
.window
|
|
|
|
.renderer_mut()
|
|
|
|
.set_render_mode(graphics.render_mode.clone())
|
|
|
|
.unwrap();
|
|
|
|
// Fullscreen mode
|
|
|
|
global_state.window.set_fullscreen_mode(graphics.fullscreen);
|
|
|
|
// Window size
|
|
|
|
global_state.window.set_size(graphics.window_size.into());
|
|
|
|
},
|
|
|
|
}
|
2021-04-14 00:43:11 +00:00
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
SettingsChange::Interface(interface_change) => {
|
|
|
|
match interface_change {
|
|
|
|
Interface::Sct(sct) => {
|
|
|
|
settings.interface.sct = sct;
|
|
|
|
},
|
|
|
|
Interface::SctPlayerBatch(sct_player_batch) => {
|
|
|
|
settings.interface.sct_player_batch = sct_player_batch;
|
|
|
|
},
|
|
|
|
Interface::SctDamageBatch(sct_damage_batch) => {
|
|
|
|
settings.interface.sct_damage_batch = sct_damage_batch;
|
|
|
|
},
|
|
|
|
Interface::SpeechBubbleDarkMode(sbdm) => {
|
|
|
|
settings.interface.speech_bubble_dark_mode = sbdm;
|
|
|
|
},
|
|
|
|
Interface::SpeechBubbleIcon(sbi) => {
|
|
|
|
settings.interface.speech_bubble_icon = sbi;
|
|
|
|
},
|
|
|
|
Interface::ToggleHelp(_) => {
|
|
|
|
// implemented in hud
|
|
|
|
},
|
|
|
|
Interface::ToggleDebug(toggle_debug) => {
|
|
|
|
settings.interface.toggle_debug = toggle_debug;
|
|
|
|
},
|
2021-05-04 20:12:26 +00:00
|
|
|
Interface::ToggleHitboxes(toggle_hitboxes) => {
|
|
|
|
settings.interface.toggle_hitboxes = toggle_hitboxes;
|
|
|
|
},
|
2021-06-21 19:16:03 +00:00
|
|
|
Interface::ToggleChat(toggle_chat) => {
|
|
|
|
settings.interface.toggle_chat = toggle_chat;
|
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
Interface::ToggleTips(loading_tips) => {
|
|
|
|
settings.interface.loading_tips = loading_tips;
|
|
|
|
},
|
2021-09-24 16:03:05 +00:00
|
|
|
Interface::ToggleHotkeyHints(toggle_hotkey_hints) => {
|
|
|
|
settings.interface.toggle_hotkey_hints = toggle_hotkey_hints;
|
|
|
|
},
|
2021-08-01 19:40:06 +00:00
|
|
|
Interface::CrosshairTransp(crosshair_opacity) => {
|
|
|
|
settings.interface.crosshair_opacity = crosshair_opacity;
|
2021-04-14 00:55:52 +00:00
|
|
|
},
|
|
|
|
Interface::CrosshairType(crosshair_type) => {
|
|
|
|
settings.interface.crosshair_type = crosshair_type;
|
|
|
|
},
|
|
|
|
Interface::Intro(intro_show) => {
|
|
|
|
settings.interface.intro_show = intro_show;
|
|
|
|
},
|
|
|
|
Interface::ToggleXpBar(xp_bar) => {
|
|
|
|
settings.interface.xp_bar = xp_bar;
|
|
|
|
},
|
|
|
|
Interface::ToggleBarNumbers(bar_numbers) => {
|
|
|
|
settings.interface.bar_numbers = bar_numbers;
|
|
|
|
},
|
2021-09-15 12:04:44 +00:00
|
|
|
Interface::ToggleAlwaysShowBars(always_show_bars) => {
|
|
|
|
settings.interface.always_show_bars = always_show_bars;
|
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
Interface::ToggleShortcutNumbers(shortcut_numbers) => {
|
|
|
|
settings.interface.shortcut_numbers = shortcut_numbers;
|
|
|
|
},
|
|
|
|
Interface::BuffPosition(buff_position) => {
|
|
|
|
settings.interface.buff_position = buff_position;
|
|
|
|
},
|
|
|
|
Interface::UiScale(scale_change) => {
|
|
|
|
settings.interface.ui_scale = session_state.hud.scale_change(scale_change);
|
|
|
|
},
|
2021-04-14 13:29:22 +00:00
|
|
|
Interface::MinimapShow(state) => {
|
|
|
|
settings.interface.minimap_show = state;
|
|
|
|
},
|
|
|
|
Interface::MinimapFaceNorth(state) => {
|
|
|
|
settings.interface.minimap_face_north = state;
|
|
|
|
},
|
2021-04-19 18:51:53 +00:00
|
|
|
Interface::MinimapZoom(minimap_zoom) => {
|
|
|
|
settings.interface.minimap_zoom = minimap_zoom;
|
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
Interface::MapZoom(map_zoom) => {
|
|
|
|
settings.interface.map_zoom = map_zoom;
|
|
|
|
},
|
|
|
|
Interface::MapDrag(map_drag) => {
|
|
|
|
settings.interface.map_drag = map_drag;
|
|
|
|
},
|
|
|
|
Interface::MapShowTopoMap(map_show_topo_map) => {
|
|
|
|
settings.interface.map_show_topo_map = map_show_topo_map;
|
|
|
|
},
|
|
|
|
Interface::MapShowDifficulty(map_show_difficulty) => {
|
|
|
|
settings.interface.map_show_difficulty = map_show_difficulty;
|
|
|
|
},
|
|
|
|
Interface::MapShowTowns(map_show_towns) => {
|
|
|
|
settings.interface.map_show_towns = map_show_towns;
|
|
|
|
},
|
|
|
|
Interface::MapShowDungeons(map_show_dungeons) => {
|
|
|
|
settings.interface.map_show_dungeons = map_show_dungeons;
|
|
|
|
},
|
|
|
|
Interface::MapShowCastles(map_show_castles) => {
|
|
|
|
settings.interface.map_show_castles = map_show_castles;
|
|
|
|
},
|
|
|
|
Interface::MapShowCaves(map_show_caves) => {
|
|
|
|
settings.interface.map_show_caves = map_show_caves;
|
|
|
|
},
|
|
|
|
Interface::MapShowTrees(map_show_trees) => {
|
|
|
|
settings.interface.map_show_trees = map_show_trees;
|
|
|
|
},
|
2021-05-03 02:00:23 +00:00
|
|
|
Interface::MapShowPeaks(map_show_peaks) => {
|
|
|
|
settings.interface.map_show_peaks = map_show_peaks;
|
|
|
|
},
|
2021-05-14 00:46:17 +00:00
|
|
|
Interface::MapShowVoxelMap(map_show_voxel_map) => {
|
|
|
|
settings.interface.map_show_voxel_map = map_show_voxel_map;
|
|
|
|
},
|
2021-04-14 00:55:52 +00:00
|
|
|
Interface::ResetInterfaceSettings => {
|
|
|
|
// Reset Interface Settings
|
|
|
|
let tmp = settings.interface.intro_show;
|
|
|
|
settings.interface = InterfaceSettings::default();
|
|
|
|
settings.interface.intro_show = tmp;
|
|
|
|
// Update Current Scaling Mode
|
|
|
|
session_state
|
|
|
|
.hud
|
|
|
|
.set_scaling_mode(settings.interface.ui_scale);
|
|
|
|
},
|
|
|
|
}
|
2021-04-14 00:43:11 +00:00
|
|
|
},
|
|
|
|
SettingsChange::Language(language_change) => match language_change {
|
|
|
|
Language::ChangeLanguage(new_language) => {
|
2021-04-14 00:55:52 +00:00
|
|
|
settings.language.selected_language = new_language.language_identifier;
|
2021-05-07 11:24:37 +00:00
|
|
|
global_state.i18n =
|
|
|
|
LocalizationHandle::load_expect(&settings.language.selected_language);
|
2021-04-14 00:43:11 +00:00
|
|
|
global_state.i18n.read().log_missing_entries();
|
2021-04-24 14:39:35 +00:00
|
|
|
global_state
|
|
|
|
.i18n
|
|
|
|
.set_english_fallback(settings.language.use_english_fallback);
|
2021-04-14 00:43:11 +00:00
|
|
|
session_state.hud.update_fonts(&global_state.i18n.read());
|
|
|
|
},
|
2021-04-24 14:39:35 +00:00
|
|
|
Language::ToggleEnglishFallback(toggle_fallback) => {
|
|
|
|
settings.language.use_english_fallback = toggle_fallback;
|
|
|
|
global_state
|
|
|
|
.i18n
|
|
|
|
.set_english_fallback(settings.language.use_english_fallback);
|
|
|
|
},
|
2021-04-14 00:43:11 +00:00
|
|
|
},
|
|
|
|
SettingsChange::Networking(networking_change) => match networking_change {},
|
|
|
|
}
|
2021-07-19 02:57:14 +00:00
|
|
|
settings.save_to_file_warn(&global_state.config_dir);
|
2021-04-14 00:43:11 +00:00
|
|
|
}
|
|
|
|
}
|