diff --git a/Subsurface/Content/Items/Diving/divinggear.xml b/Subsurface/Content/Items/Diving/divinggear.xml
index 88ba2281e..2b6146371 100644
--- a/Subsurface/Content/Items/Diving/divinggear.xml
+++ b/Subsurface/Content/Items/Diving/divinggear.xml
@@ -41,10 +41,10 @@
-
+
-
+
@@ -86,10 +86,13 @@
-
+
-
+
+
+
+
diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs
index c6fa76fac..4ef576e61 100644
--- a/Subsurface/Source/Characters/Character.cs
+++ b/Subsurface/Source/Characters/Character.cs
@@ -81,7 +81,7 @@ namespace Barotrauma
private Vector2 cursorPosition;
protected bool needsAir;
- protected float oxygen;
+ protected float oxygen, oxygenAvailable;
protected float drowningTime;
protected float health;
@@ -251,6 +251,12 @@ namespace Barotrauma
}
}
+ public float OxygenAvailable
+ {
+ get { return oxygenAvailable; }
+ set { oxygenAvailable = MathHelper.Clamp(value, 0.0f, 100.0f); }
+ }
+
public float Stun
{
get { return AnimController.StunTimer; }
@@ -416,6 +422,7 @@ namespace Barotrauma
IsNetworkPlayer = isNetworkPlayer;
oxygen = 100.0f;
+ oxygenAvailable = 100.0f;
aiTarget = new AITarget(this);
lowPassMultiplier = 1.0f;
@@ -1027,20 +1034,20 @@ namespace Barotrauma
if (needsAir)
{
- if (AnimController.HeadInWater)
- {
- Oxygen -= deltaTime*100.0f / drowningTime;
- }
- else if (AnimController.CurrentHull != null)
- {
- float hullOxygen = AnimController.CurrentHull.OxygenPercentage;
- hullOxygen -= 30.0f;
+ Oxygen += deltaTime * (oxygenAvailable < 30.0f ? -5.0f : 10.0f);
- Oxygen += deltaTime * 100.0f * (hullOxygen / 500.0f);
+ PressureProtection -= deltaTime*100.0f;
+
+ float hullAvailableOxygen = 0.0f;
+
+ if (!AnimController.HeadInWater && AnimController.CurrentHull != null)
+ {
+ hullAvailableOxygen = AnimController.CurrentHull.OxygenPercentage;
AnimController.CurrentHull.Oxygen -= Hull.OxygenConsumptionSpeed * deltaTime;
}
- PressureProtection -= deltaTime*100.0f;
+
+ OxygenAvailable += Math.Sign(hullAvailableOxygen - oxygenAvailable) * deltaTime * 50.0f;
}
Health -= bleeding * deltaTime;
diff --git a/Subsurface/Source/Characters/CharacterHUD.cs b/Subsurface/Source/Characters/CharacterHUD.cs
index 669d19dc7..3d192d008 100644
--- a/Subsurface/Source/Characters/CharacterHUD.cs
+++ b/Subsurface/Source/Characters/CharacterHUD.cs
@@ -98,7 +98,7 @@ namespace Barotrauma
if (Screen.Selected == GameMain.EditMapScreen) return;
- if (character.Oxygen < 50.0f && !character.IsDead)
+ if (character.Oxygen < 80.0f && !character.IsDead)
{
Vector2 offset = Rand.Vector(noiseOverlay.size.X);
offset.X = Math.Abs(offset.X);
@@ -106,7 +106,7 @@ namespace Barotrauma
noiseOverlay.DrawTiled(spriteBatch, Vector2.Zero - offset, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) + offset,
Vector2.Zero,
- Color.White * ((50.0f - character.Oxygen) / 50.0f));
+ Color.White * Math.Min((80.0f - character.Oxygen) / 50.0f, 0.8f));
}
if (damageOverlayTimer>0.0f)
diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs
index 76acc6c00..a67d2bea2 100644
--- a/Subsurface/Source/Map/Levels/Level.cs
+++ b/Subsurface/Source/Map/Levels/Level.cs
@@ -200,22 +200,19 @@ namespace Barotrauma
float tunnelLength = Rand.Range(5000.0f, 10000.0f, false);
- var tunnelNodes = MathUtils.GenerateJaggedLine(tunnelStartPos, tunnelStartPos + Rand.Vector(tunnelLength,false) + Vector2.UnitY*5000.0f, 3, 1000.0f);
+ var tunnelNodes = MathUtils.GenerateJaggedLine(
+ tunnelStartPos,
+ new Vector2(tunnelStartPos.X, pathBorders.Bottom)+Rand.Vector(tunnelLength,false),
+ 4, 1000.0f);
List tunnel = new List();
foreach (Vector2[] tunnelNode in tunnelNodes)
{
- if (!pathBorders.Contains(tunnelNode[0])) break;
+ if (!pathBorders.Contains(tunnelNode[0])) continue;
tunnel.Add(tunnelNode[0]);
}
- if (tunnel.Any())
- {
- smallTunnels.Add(tunnel);
- positionsOfInterest.Add(new InterestingPosition(tunnel.Last(), false));
-
- if (tunnel.Count() > 4) positionsOfInterest.Add(new InterestingPosition(tunnel[tunnel.Count()/2], false));
- }
+ if (tunnel.Any()) smallTunnels.Add(tunnel);
}
@@ -229,9 +226,9 @@ namespace Barotrauma
if (smallTunnels.Any(t => t.Any(node => Vector2.Distance(node, site) < siteInterval)))
{
- if (x < borders.Width - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitX * siteInterval * 0.2f);
- if (y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitY * siteInterval * 0.2f);
- if (x < borders.Width - siteInterval && y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.One * siteInterval * 0.2f);
+ if (x < borders.Width - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitX * siteInterval * 0.5f);
+ if (y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitY * siteInterval * 0.5f);
+ if (x < borders.Width - siteInterval && y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.One * siteInterval * 0.5f);
}
if (mirror) site.X = borders.Width - site.X;
@@ -314,42 +311,22 @@ namespace Barotrauma
{
if (tunnel.Count<2) continue;
+ //find the cell which the path starts from
+ int startCellIndex = FindCellIndex(tunnel[0]);
+ if (startCellIndex < 0) continue;
+
+ //if it wasn't one of the cells in the main path, don't create a tunnel
+ if (!pathCells.Contains(cells[startCellIndex])) continue;
+
var newPathCells = GeneratePath(tunnel, cells, pathBorders, 0.0f, 0.0f);
- //for (int n = 0; n < newPathCells.Count; n += 5)
- //{
- // positionsOfInterest.Add(newPathCells[n].Center);
- //}
+ positionsOfInterest.Add(new InterestingPosition(tunnel.Last(), false));
+ if (tunnel.Count() > 4) positionsOfInterest.Add(new InterestingPosition(tunnel[tunnel.Count() / 2], false));
+
pathCells.AddRange(newPathCells);
}
- ////generate a couple of random paths
- //for (int i = 0; i <= Rand.Range(1,4,false); i++)
- //{
- // //pathBorders = new Rectangle(
- // //borders.X + siteInterval * 2, borders.Y - siteInterval * 2,
- // //borders.Right - siteInterval * 2, borders.Y + borders.Height - siteInterval * 2);
-
- // Vector2 start = pathCells[Rand.Range(1, pathCells.Count - 2,false)].Center;
-
- // float x = pathBorders.X + Rand.Range(0, pathBorders.Right - pathBorders.X, false);
- // float y = pathBorders.Y + Rand.Range(0,pathBorders.Bottom - pathBorders.Y, false);
-
- // if (mirror) x = borders.Width - x;
-
- // Vector2 end = new Vector2(x, y);
-
- // var newPathCells = GeneratePath(new List { start, end }, cells, pathBorders, 0.0f, 0.8f, mirror);
-
- // for (int n = 0; n < newPathCells.Count; n += 5)
- // {
- // positionsOfInterest.Add(newPathCells[n].Center);
- // }
-
- // pathCells.AddRange(newPathCells);
- //}
-
Debug.WriteLine("path: " + sw2.ElapsedMilliseconds + " ms");
sw2.Restart();
diff --git a/Subsurface/Source/Map/Levels/VoronoiElements.cs b/Subsurface/Source/Map/Levels/VoronoiElements.cs
index d657f6aeb..b5ce48af9 100644
--- a/Subsurface/Source/Map/Levels/VoronoiElements.cs
+++ b/Subsurface/Source/Map/Levels/VoronoiElements.cs
@@ -152,6 +152,8 @@ namespace Voronoi2
ge.point1 = vertices[i-1];
ge.point2 = vertices[i];
+ System.Diagnostics.Debug.Assert(ge.point1 != ge.point2);
+
edges.Add(ge);
}
diff --git a/Subsurface/Source/Map/Lights/LightManager.cs b/Subsurface/Source/Map/Lights/LightManager.cs
index 446f522c3..6d1bb92c4 100644
--- a/Subsurface/Source/Map/Lights/LightManager.cs
+++ b/Subsurface/Source/Map/Lights/LightManager.cs
@@ -39,7 +39,7 @@ namespace Barotrauma.Lights
{
lights = new List();
- AmbientLight = new Color(80, 80, 80, 255);
+ AmbientLight = new Color(60, 60, 60, 255);
visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");