Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/ClientSource/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
14 changes: 11 additions & 3 deletions Barotrauma/BarotraumaClient/ClientSource/Settings/SettingsMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -232,6 +233,7 @@ public static GraphicsSettings FromElements(IEnumerable<XElement> elements, in G
public int VisibleLightLimit;
public float TextScale;
public bool RadialDistortion;
public float ScreenShake;
}

[StructSerialization.Skip]
Expand Down