diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index 09acc2f87..f3e3535ad 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -668,6 +668,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Subsurface/Content/UI/noise.png b/Subsurface/Content/UI/noise.png new file mode 100644 index 000000000..2ea26c0f1 Binary files /dev/null and b/Subsurface/Content/UI/noise.png differ diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index fe7364af3..cde80ccc1 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -809,7 +809,17 @@ namespace Barotrauma if (moveCam) { - cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, Submarine == null ? 400.0f : 250.0f, 0.05f); + float pressureEffect = 0.0f; + + if (pressureProtection < 80.0f && AnimController.CurrentHull != null && AnimController.CurrentHull.LethalPressure > 50.0f) + { + cam.Zoom = MathHelper.Lerp(cam.Zoom, + (AnimController.CurrentHull.LethalPressure / 50.0f) * Rand.Range(1.0f, 1.05f), + (AnimController.CurrentHull.LethalPressure - 50.0f) / 50.0f); + } + cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, (Submarine == null ? 400.0f : 250.0f)+pressureEffect, 0.05f); + + } cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition); @@ -939,13 +949,14 @@ namespace Barotrauma } if (!protectedFromPressure && - (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f)) + (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 80.0f)) { PressureTimer += ((AnimController.CurrentHull == null) ? 100.0f : AnimController.CurrentHull.LethalPressure) * deltaTime; if (PressureTimer >= 100.0f) { + if (controlled == this) cam.Zoom = 5.0f; Implode(); return; } @@ -1178,7 +1189,7 @@ namespace Barotrauma } SoundPlayer.PlayDamageSound(DamageSoundType.Implode, 50.0f, AnimController.RefLimb.body); - + for (int i = 0; i < 10; i++) { Particle p = GameMain.ParticleManager.CreateParticle("waterblood", diff --git a/Subsurface/Source/Characters/CharacterHUD.cs b/Subsurface/Source/Characters/CharacterHUD.cs index 8a29e24b9..efdfa0b6f 100644 --- a/Subsurface/Source/Characters/CharacterHUD.cs +++ b/Subsurface/Source/Characters/CharacterHUD.cs @@ -12,6 +12,8 @@ namespace Barotrauma private static Sprite statusIcons; + private static Sprite noise; + private static GUIProgressBar drowningBar, healthBar; public static void TakeDamage() @@ -36,6 +38,11 @@ namespace Barotrauma statusIcons = new Sprite("Content/UI/statusIcons.png", Vector2.Zero); } + if (noise==null) + { + noise = new Sprite("Content/UI/noise.png", Vector2.Zero); + } + DrawStatusIcons(spriteBatch, character); if (character.Inventory != null) character.Inventory.DrawOwn(spriteBatch); @@ -89,6 +96,29 @@ namespace Barotrauma textPos.Y += 25; } } + //Vector2 offset = Rand.Vector(noise.size.X); + //offset.X = Math.Abs(offset.X); + //offset.Y = Math.Abs(offset.Y); + + //noise.DrawTiled(spriteBatch, Vector2.Zero - offset, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) + offset, + // Vector2.Zero, + // Color.White * 0.1f); + + if (character.Oxygen < 50.0f) + { + Vector2 offset = Rand.Vector(noise.size.X); + offset.X = Math.Abs(offset.X); + offset.Y = Math.Abs(offset.Y); + + noise.DrawTiled(spriteBatch, Vector2.Zero - offset, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) + offset, + Vector2.Zero, + Color.White * ((50.0f - character.Oxygen) / 50.0f)); + + //spriteBatch.Draw(noise.Texture, + // new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), + // new Rectangle(Rand.Int(GameMain.GraphicsWidth), Rand.Int(GameMain.GraphicsHeight), (int)noise.size.X, (int)noise.size.Y), + // Color.White * ((100.0f - character.Oxygen) / 100.0f)); + } } private static void DrawStatusIcons(SpriteBatch spriteBatch, Character character) diff --git a/Subsurface/Source/Items/Components/Door.cs b/Subsurface/Source/Items/Components/Door.cs index 5169f8bc4..3eaeed503 100644 --- a/Subsurface/Source/Items/Components/Door.cs +++ b/Subsurface/Source/Items/Components/Door.cs @@ -358,6 +358,7 @@ namespace Barotrauma.Items.Components if (linkedGap!=null) linkedGap.Remove(); doorSprite.Remove(); + weldedSprite.Remove(); if (convexHull!=null) convexHull.Remove(); if (convexHull2 != null) convexHull2.Remove(); diff --git a/Subsurface/Source/Items/Components/Signal/Connection.cs b/Subsurface/Source/Items/Components/Signal/Connection.cs index e79e562b5..21b19efa6 100644 --- a/Subsurface/Source/Items/Components/Signal/Connection.cs +++ b/Subsurface/Source/Items/Components/Signal/Connection.cs @@ -64,10 +64,8 @@ namespace Barotrauma.Items.Components { panelTexture = Sprite.LoadTexture("Content/Items/connectionpanel.png"); - connector = new Sprite(panelTexture, new Rectangle(448, 80, 64, 64), Vector2.Zero, 0.0f); - connector.Origin = new Vector2(32.0f, 32.0f); - wireCorner = new Sprite(panelTexture, new Rectangle(448, 0, 64, 64), Vector2.Zero, 0.0f); - wireCorner.Origin = new Vector2(32.0f, 32.0f); + connector = new Sprite(panelTexture, new Rectangle(448, 80, 64, 64), new Vector2(-32.0f, -32.0f), 0.0f); + wireCorner = new Sprite(panelTexture, new Rectangle(448, 0, 64, 64), new Vector2(-32.0f, -32.0f), 0.0f); wireVertical = new Sprite(panelTexture, new Rectangle(480, 64, 16, 16), new Vector2(-8.0f, -8.0f), 0.0f); wireHorizontal = new Sprite(panelTexture, new Rectangle(496, 64, 16, 16), new Vector2(-8.0f, -8.0f), 0.0f); } diff --git a/Subsurface/Source/Map/Hull.cs b/Subsurface/Source/Map/Hull.cs index 21fa54a95..1348ab1b2 100644 --- a/Subsurface/Source/Map/Hull.cs +++ b/Subsurface/Source/Map/Hull.cs @@ -270,7 +270,11 @@ namespace Barotrauma fireSource.Remove(); } - if (soundIndex > -1) Sounds.SoundManager.Stop(soundIndex); + if (soundIndex > -1) + { + Sounds.SoundManager.Stop(soundIndex); + soundIndex = -1; + } //renderer.Dispose(); @@ -344,7 +348,11 @@ namespace Barotrauma } else { - if (soundIndex > -1) Sounds.SoundManager.Stop(soundIndex); + if (soundIndex > -1) + { + Sounds.SoundManager.Stop(soundIndex); + soundIndex = -1; + } } //update client hulls if the amount of water has changed by >10% @@ -353,7 +361,12 @@ namespace Barotrauma new Networking.NetworkEvent(ID, false); lastSentVolume = volume; } - if (!update) return; + + if (!update) + { + lethalPressure = 0.0f; + return; + } float surfaceY = rect.Y - rect.Height + Volume / rect.Width; for (int i = 0; i < waveY.Length; i++) diff --git a/Subsurface/Source/Sounds/SoundPlayer.cs b/Subsurface/Source/Sounds/SoundPlayer.cs index e5e410de5..cc0faa22f 100644 --- a/Subsurface/Source/Sounds/SoundPlayer.cs +++ b/Subsurface/Source/Sounds/SoundPlayer.cs @@ -303,7 +303,6 @@ namespace Barotrauma public static void PlayDamageSound(DamageSoundType damageType, float damage, PhysicsBody body) { Vector2 bodyPosition = body.DrawPosition; - bodyPosition.Y = -bodyPosition.Y; PlayDamageSound(damageType, damage, bodyPosition); } diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index d65067001..735cb3706 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ