diff --git a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs index 9e3e7dfca..1fe366c5b 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs @@ -204,22 +204,6 @@ namespace Barotrauma return true; } - private bool RefreshJoinButtonState(GUIComponent component, object obj) - { - if (obj == null || waitingForRefresh) { return false; } - - if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text)) - { - joinButton.Enabled = true; - } - else - { - joinButton.Enabled = false; - } - - return true; - } - private bool RefreshJoinButtonState(GUIComponent component, object obj) { if (obj == null || waitingForRefresh) return false; @@ -238,17 +222,7 @@ namespace Barotrauma private bool SelectServer(GUIComponent component, object obj) { - if (obj == null || waitingForRefresh) { return false; } - - if (!string.IsNullOrWhiteSpace(clientNameBox.Text)) - { - joinButton.Enabled = true; - } - else - { - clientNameBox.Flash(); - joinButton.Enabled = false; - } + if (obj == null || waitingForRefresh) return false; if (!string.IsNullOrWhiteSpace(clientNameBox.Text)) { diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs index 6c3d8212f..ce223ae35 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; namespace Barotrauma diff --git a/Barotrauma/BarotraumaShared/Source/Extensions/VectorExtensions.cs b/Barotrauma/BarotraumaShared/Source/Extensions/VectorExtensions.cs index 3ea2039a7..479b031d3 100644 --- a/Barotrauma/BarotraumaShared/Source/Extensions/VectorExtensions.cs +++ b/Barotrauma/BarotraumaShared/Source/Extensions/VectorExtensions.cs @@ -69,6 +69,7 @@ namespace Barotrauma.Extensions /// public static Vector2 TransformVector(this Vector2 v, Vector2 up) { + up = Vector2.Normalize(up); return (up * v.Y) + (up.Right() * v.X); } diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index 6316e04d9..753eb173f 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -415,79 +415,6 @@ namespace Barotrauma } } - #region Load DefaultConfig - private void LoadDefaultConfig(bool setLanguage = true) - { - XDocument doc = XMLExtensions.TryLoadXml(savePath); - - if (setLanguage || string.IsNullOrEmpty(Language)) - { - Language = doc.Root.GetAttributeString("language", "English"); - } - if (doc != null) - { - foreach (XElement subElement in doc.Root.Elements()) - { - if (subElement.Name.ToString().ToLowerInvariant() == "keymapping") - { - LoadKeyBinds(subElement); - } - } - } - } - - public void CheckBindings(bool useDefaults) - { - foreach (InputType inputType in Enum.GetValues(typeof(InputType))) - { - var binding = keyMapping[(int)inputType]; - if (binding == null) - { - switch (inputType) - { - case InputType.Deselect: - if (useDefaults) - { - binding = new KeyOrMouse(1); - } - else - { - // Legacy support - var selectKey = keyMapping[(int)InputType.Select]; - if (selectKey != null && selectKey.Key != Keys.None) - { - binding = new KeyOrMouse(selectKey.Key); - } - } - break; - case InputType.Shoot: - if (useDefaults) - { - binding = new KeyOrMouse(0); - } - else - { - // Legacy support - var useKey = keyMapping[(int)InputType.Use]; - if (useKey != null && useKey.MouseButton.HasValue) - { - binding = new KeyOrMouse(useKey.MouseButton.Value); - } - } - break; - default: - break; - } - if (binding == null) - { - DebugConsole.ThrowError("Key binding for the input type \"" + inputType + " not set!"); - binding = new KeyOrMouse(Keys.D1); - } - keyMapping[(int)inputType] = binding; - } - } - } - #region Load DefaultConfig private void LoadDefaultConfig(bool setLanguage = true) { @@ -566,6 +493,16 @@ namespace Barotrauma QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); + MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); + + AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true); + WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false); + + VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false); + SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false); + + QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); + if (doc == null) { GraphicsWidth = 1024; @@ -1020,70 +957,6 @@ namespace Barotrauma foreach (XElement subElement in doc.Root.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "keymapping": - LoadKeyBinds(subElement); - break; - case "gameplay": - jobPreferences = new List(); - foreach (XElement ele in subElement.Element("jobpreferences").Elements("job")) - { - string jobIdentifier = ele.GetAttributeString("identifier", ""); - if (string.IsNullOrEmpty(jobIdentifier)) continue; - jobPreferences.Add(jobIdentifier); - } - break; - case "player": - defaultPlayerName = subElement.GetAttributeString("name", defaultPlayerName); - CharacterHeadIndex = subElement.GetAttributeInt("headindex", CharacterHeadIndex); - if (Enum.TryParse(subElement.GetAttributeString("gender", "none"), true, out Gender g)) - { - CharacterGender = g; - } - if (Enum.TryParse(subElement.GetAttributeString("race", "white"), true, out Race r)) - { - CharacterRace = r; - } - else - { - CharacterRace = Race.White; - } - CharacterHairIndex = subElement.GetAttributeInt("hairindex", CharacterHairIndex); - CharacterBeardIndex = subElement.GetAttributeInt("beardindex", CharacterBeardIndex); - CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", CharacterMoustacheIndex); - CharacterFaceAttachmentIndex = subElement.GetAttributeInt("faceattachmentindex", CharacterFaceAttachmentIndex); - break; - case "tutorials": - foreach (XElement tutorialElement in subElement.Elements()) - { - CompletedTutorialNames.Add(tutorialElement.GetAttributeString("name", "")); - } - break; - } - } - - UnsavedSettings = false; - - selectedContentPackagePaths = new HashSet(); - - foreach (XElement subElement in doc.Root.Elements()) - { - gSettings = new XElement("graphicssettings"); - doc.Root.Add(gSettings); - } - - gSettings.ReplaceAttributes( - new XAttribute("particlelimit", ParticleLimit), - new XAttribute("lightmapscale", LightMapScale), - new XAttribute("specularity", SpecularityEnabled), - new XAttribute("chromaticaberration", ChromaticAberrationEnabled), - new XAttribute("losmode", LosMode), - new XAttribute("hudscale", HUDScale), - new XAttribute("inventoryscale", InventoryScale)); - - foreach (ContentPackage contentPackage in SelectedContentPackages) - { - if (contentPackage.Path.Contains(vanillaContentPackagePath)) { case "contentpackage": string path = System.IO.Path.GetFullPath(subElement.GetAttributeString("path", ""));