diff --git a/Barotrauma/BarotraumaClient/ClientSource/Camera.cs b/Barotrauma/BarotraumaClient/ClientSource/Camera.cs index c497c157f1..534ae7b648 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Camera.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Camera.cs @@ -378,7 +378,7 @@ public void MoveCamera(float deltaTime, bool allowMove = true, bool allowZoom = shakeTimer += deltaTime * 5.0f; Vector2 noisePos = new Vector2((float)PerlinNoise.CalculatePerlin(shakeTimer, shakeTimer, 0) - 0.5f, (float)PerlinNoise.CalculatePerlin(shakeTimer, shakeTimer, 0.5f) - 0.5f); - ShakePosition = noisePos * Shake * 2.0f; + ShakePosition = noisePos * Shake * GameSettings.CurrentConfig.Graphics.ScreenShake * 2.0f; Shake = MathHelper.Lerp(Shake, 0.0f, deltaTime * 2.0f); } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Settings/SettingsMenu.cs b/Barotrauma/BarotraumaClient/ClientSource/Settings/SettingsMenu.cs index 0e5e54d1cf..c3956854c0 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Settings/SettingsMenu.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Settings/SettingsMenu.cs @@ -167,7 +167,12 @@ private static void Spacer(GUILayoutGroup parent) { new GUIFrame(new RectTransform((1.0f, 0.03f), parent.RectTransform, Anchor.CenterLeft), style: null); } - + + private static void Divider(GUILayoutGroup parent) + { + new GUICustomComponent(new RectTransform((1.0f, 0.03f), parent.RectTransform, Anchor.CenterLeft), onDraw: (sb, c) => sb.DrawLine((c.Rect.Left, c.Rect.Center.Y), (c.Rect.Right, c.Rect.Center.Y), GUIStyle.TextColorDim, 2f)); + } + private static GUITextBlock Label(GUILayoutGroup parent, LocalizedString str, GUIFont font) { return new GUITextBlock(NewItemRectT(parent), str, font: font); @@ -270,8 +275,11 @@ private void CreateGraphicsTab() Tickbox(left, TextManager.Get("EnableVSync"), TextManager.Get("EnableVSyncTooltip"), unsavedConfig.Graphics.VSync, v => unsavedConfig.Graphics.VSync = v); Tickbox(left, TextManager.Get("EnableTextureCompression"), TextManager.Get("EnableTextureCompressionTooltip"), unsavedConfig.Graphics.CompressTextures, v => unsavedConfig.Graphics.CompressTextures = v); - Spacer(right); - + Divider(left); + + Label(left, TextManager.Get("ScreenShake"), GUIStyle.SubHeadingFont); + Slider(left, (0.0f, 1.0f), 11, v => TextManager.GetWithVariable("percentageformat", "[value]", Round(v * 100).ToString()).Value, unsavedConfig.Graphics.ScreenShake, v => unsavedConfig.Graphics.ScreenShake = v); + Label(right, TextManager.Get("LOSEffect"), GUIStyle.SubHeadingFont); DropdownEnum(right, (m) => TextManager.Get($"LosMode{m}"), null, unsavedConfig.Graphics.LosMode, v => unsavedConfig.Graphics.LosMode = v); Spacer(right); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Settings/GameSettings.cs b/Barotrauma/BarotraumaShared/SharedSource/Settings/GameSettings.cs index 68e231cb91..9cb926178d 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Settings/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Settings/GameSettings.cs @@ -195,7 +195,8 @@ public static GraphicsSettings GetDefault() Specularity = true, ChromaticAberration = true, ParticleLimit = 1500, - LosMode = LosMode.Transparent + LosMode = LosMode.Transparent, + ScreenShake = 1.0f }; gfxSettings.RadialDistortion = true; gfxSettings.CompressTextures = true; @@ -232,6 +233,7 @@ public static GraphicsSettings FromElements(IEnumerable elements, in G public int VisibleLightLimit; public float TextScale; public bool RadialDistortion; + public float ScreenShake; } [StructSerialization.Skip]