From ef9dce9a0d4d252334d1674c0afabcc582d6134d Mon Sep 17 00:00:00 2001 From: Regalis Date: Sun, 9 Oct 2016 18:20:32 +0300 Subject: [PATCH] - fixed exception in GetSubsToLeaveBehind if the round ends when none of the subs is at an exit - water surface is clamped above the bottom of the hull - character names don't overlap with health bars --- Subsurface/Source/Characters/Character.cs | 2 +- .../GameSession/GameModes/SinglePlayerMode.cs | 22 ++++++++++--------- Subsurface/Source/Map/Hull.cs | 12 +++++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 7808e6797..d69420376 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -1328,7 +1328,7 @@ namespace Barotrauma if (info != null) { - Vector2 namePos = new Vector2(pos.X, pos.Y - 80.0f - (5.0f/cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom; + Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f/cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom; Color nameColor = Color.White; if (Character.Controlled != null && TeamID!=Character.Controlled.TeamID) diff --git a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs index f76525739..ce1b6ea64 100644 --- a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs +++ b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs @@ -241,17 +241,19 @@ namespace Barotrauma { isRunning = false; - if (subsToLeaveBehind == null || leavingSub == null) - { - DebugConsole.ThrowError("Leaving submarine not selected -> selecting the closest one"); - - leavingSub = GetLeavingSub(); - - subsToLeaveBehind = GetSubsToLeaveBehind(leavingSub); - } - - bool success = CrewManager.characters.Any(c => !c.IsDead); + + if (success) + { + if (subsToLeaveBehind == null || leavingSub == null) + { + DebugConsole.ThrowError("Leaving submarine not selected -> selecting the closest one"); + + leavingSub = GetLeavingSub(); + + subsToLeaveBehind = GetSubsToLeaveBehind(leavingSub); + } + } GameMain.GameSession.EndShift(""); diff --git a/Subsurface/Source/Map/Hull.cs b/Subsurface/Source/Map/Hull.cs index 9474d9430..ff306401f 100644 --- a/Subsurface/Source/Map/Hull.cs +++ b/Subsurface/Source/Map/Hull.cs @@ -100,6 +100,8 @@ namespace Barotrauma Item.UpdateHulls(); Gap.UpdateHulls(); } + + surface = rect.Y - rect.Height + Volume / rect.Width; } } @@ -506,7 +508,7 @@ namespace Barotrauma } //interpolate the position of the rendered surface towards the "target surface" - surface = MathHelper.Lerp(surface, surfaceY, deltaTime*10.0f); + surface = Math.Max(MathHelper.Lerp(surface, surfaceY, deltaTime*10.0f), rect.Y - rect.Height); if (volume < FullVolume) { @@ -556,7 +558,7 @@ namespace Barotrauma if (!Visible) { drawRect = - Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); + Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); GUI.DrawRectangle(spriteBatch, new Vector2(drawRect.X, -drawRect.Y), @@ -577,11 +579,11 @@ namespace Barotrauma GUI.DrawRectangle(spriteBatch, new Vector2(drawRect.X, -drawRect.Y), new Vector2(rect.Width, rect.Height), - Color.Blue,false,0, (int)Math.Max((1.5f / Screen.Selected.Cam.Zoom), 1.0f)); + Color.Blue, false, 0, (int)Math.Max((1.5f / Screen.Selected.Cam.Zoom), 1.0f)); GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), - Color.Red*((100.0f-OxygenPercentage)/400.0f), true,0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + Color.Red * ((100.0f - OxygenPercentage) / 400.0f), true, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); if (GameMain.DebugDraw) { @@ -596,7 +598,7 @@ namespace Barotrauma GUI.DrawRectangle(spriteBatch, new Vector2(drawRect.X + 5, -drawRect.Y + 5), new Vector2(rect.Width - 10, rect.Height - 10), - isHighlighted ? Color.LightBlue*0.5f : Color.Red*0.5f, true,0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + isHighlighted ? Color.LightBlue * 0.5f : Color.Red * 0.5f, true, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); } }