Characters that are outside are rendered under particles -> creatures can be hidden by smoke from hydrothermal vents.
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -103,6 +105,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
|
HashSet<Character> outsideCharacters = new HashSet<Character>();
|
||||||
|
foreach (Character c in Character.CharacterList)
|
||||||
|
{
|
||||||
|
if (!c.AnimController.CanEnterSubmarine)
|
||||||
|
{
|
||||||
|
outsideCharacters.Add(c);
|
||||||
|
}
|
||||||
|
else if (c.CurrentHull == null && !Submarine.Loaded.Any(s => Submarine.RectContains(s.WorldBorders, c.WorldPosition)))
|
||||||
|
{
|
||||||
|
outsideCharacters.Add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Submarine sub in Submarine.Loaded)
|
foreach (Submarine sub in Submarine.Loaded)
|
||||||
{
|
{
|
||||||
@@ -134,6 +148,18 @@ namespace Barotrauma
|
|||||||
Level.Loaded.DrawBack(graphics, spriteBatch, cam, BackgroundCreatureManager);
|
Level.Loaded.DrawBack(graphics, spriteBatch, cam, BackgroundCreatureManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||||
|
BlendState.AlphaBlend,
|
||||||
|
null, null, null, null,
|
||||||
|
cam.Transform);
|
||||||
|
|
||||||
|
foreach (Character c in outsideCharacters)
|
||||||
|
{
|
||||||
|
if (c.CurrentHull == null) c.Draw(spriteBatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
#if LINUX
|
#if LINUX
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||||
BlendState.NonPremultiplied,
|
BlendState.NonPremultiplied,
|
||||||
@@ -141,9 +167,9 @@ namespace Barotrauma
|
|||||||
cam.Transform);
|
cam.Transform);
|
||||||
#else
|
#else
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||||
BlendState.AlphaBlend,
|
BlendState.AlphaBlend,
|
||||||
null, DepthStencilState.DepthRead, null, null,
|
null, DepthStencilState.DepthRead, null, null,
|
||||||
cam.Transform);
|
cam.Transform);
|
||||||
#endif
|
#endif
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.AlphaBlend);
|
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.AlphaBlend);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
@@ -178,7 +204,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
|
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
|
||||||
|
|
||||||
foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
|
foreach (Character c in Character.CharacterList)
|
||||||
|
{
|
||||||
|
if (!outsideCharacters.Contains(c)) c.Draw(spriteBatch);
|
||||||
|
}
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
|
|||||||
@@ -151,12 +151,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Rectangle Borders
|
public Rectangle Borders
|
||||||
{
|
{
|
||||||
get
|
get { return subBody.Borders; }
|
||||||
{
|
|
||||||
return subBody.Borders;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Rectangle WorldBorders
|
||||||
|
{
|
||||||
|
get { return SubBody.WorldBorders; }
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector2 Position
|
public override Vector2 Position
|
||||||
{
|
{
|
||||||
get { return subBody==null ? Vector2.Zero : subBody.Position - HiddenSubPosition; }
|
get { return subBody==null ? Vector2.Zero : subBody.Position - HiddenSubPosition; }
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ namespace Barotrauma
|
|||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Rectangle WorldBorders
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
public Vector2 Velocity
|
public Vector2 Velocity
|
||||||
{
|
{
|
||||||
@@ -181,6 +187,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
|
var worldBorders = Borders;
|
||||||
|
worldBorders.Location += MathUtils.ToPoint(Position);
|
||||||
|
WorldBorders = worldBorders;
|
||||||
|
|
||||||
if (GameMain.Client != null)
|
if (GameMain.Client != null)
|
||||||
{
|
{
|
||||||
if (memPos.Count == 0) return;
|
if (memPos.Count == 0) return;
|
||||||
@@ -232,9 +242,6 @@ namespace Barotrauma
|
|||||||
//if outside left or right edge of the level
|
//if outside left or right edge of the level
|
||||||
if (Position.X < 0 || Position.X > Level.Loaded.Size.X)
|
if (Position.X < 0 || Position.X > Level.Loaded.Size.X)
|
||||||
{
|
{
|
||||||
Rectangle worldBorders = Borders;
|
|
||||||
worldBorders.Location += MathUtils.ToPoint(Position);
|
|
||||||
|
|
||||||
//push the sub back below the upper "barrier" of the level
|
//push the sub back below the upper "barrier" of the level
|
||||||
if (worldBorders.Y > Level.Loaded.Size.Y)
|
if (worldBorders.Y > Level.Loaded.Size.Y)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user