From 2e2c206d5fb9884e7ae9f8941a7d3ca736f12752 Mon Sep 17 00:00:00 2001 From: Regalis Date: Tue, 29 Nov 2016 19:21:46 +0200 Subject: [PATCH] ID-based hull & gap depth sorting --- Subsurface/Source/Map/Gap.cs | 16 +++++++++++----- Subsurface/Source/Map/Hull.cs | 3 +-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Subsurface/Source/Map/Gap.cs b/Subsurface/Source/Map/Gap.cs index 7aa460dca..f7b23a11b 100644 --- a/Subsurface/Source/Map/Gap.cs +++ b/Subsurface/Source/Map/Gap.cs @@ -205,7 +205,13 @@ namespace Barotrauma Color clr = (open == 0.0f) ? Color.Red : Color.Cyan; if (isHighlighted) clr = Color.Gold; - GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), clr * 0.5f, true,0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); + float depth = (ID % 255) * 0.000001f; + + GUI.DrawRectangle( + sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), + clr * 0.5f, true, + depth, + (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); for (int i = 0; i < linkedTo.Count; i++) { @@ -217,10 +223,10 @@ namespace Barotrauma arrowPos += new Vector2(dir.X * (WorldRect.Width / 2 + 10), dir.Y * (WorldRect.Height / 2 + 10)); GUI.Arrow.Draw(sb, - arrowPos, - clr * 0.8f, + arrowPos, clr * 0.8f, GUI.Arrow.Origin, MathUtils.VectorToAngle(dir) + MathHelper.PiOver2, - isHorizontal ? new Vector2(rect.Height / 16.0f, 1.0f) : new Vector2(rect.Width / 16.0f, 1.0f)); + isHorizontal ? new Vector2(rect.Height / 16.0f, 1.0f) : new Vector2(rect.Width / 16.0f, 1.0f), + SpriteEffects.None, depth); } if (IsSelected) @@ -230,7 +236,7 @@ namespace Barotrauma new Vector2(rect.Width + 10, rect.Height + 10), Color.Red, false, - 0, + depth, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f)); } } diff --git a/Subsurface/Source/Map/Hull.cs b/Subsurface/Source/Map/Hull.cs index 055f82e46..ec2ae613c 100644 --- a/Subsurface/Source/Map/Hull.cs +++ b/Subsurface/Source/Map/Hull.cs @@ -595,7 +595,7 @@ 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, (ID % 255) * 0.000001f, (int)Math.Max((1.5f / Screen.Selected.Cam.Zoom), 1.0f)); GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), @@ -606,7 +606,6 @@ namespace Barotrauma spriteBatch.DrawString(GUI.SmallFont, "Pressure: " + ((int)pressure - rect.Y).ToString() + " - Oxygen: " + ((int)OxygenPercentage), new Vector2(drawRect.X + 5, -drawRect.Y + 5), Color.White); spriteBatch.DrawString(GUI.SmallFont, volume + " / " + FullVolume, new Vector2(drawRect.X + 5, -drawRect.Y + 20), Color.White); - } if ((IsSelected || isHighlighted) && editing)