Fixed inconsistent decal draw order
This commit is contained in:
@@ -190,10 +190,12 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Rectangle hullDrawRect = rect;
|
Rectangle hullDrawRect = rect;
|
||||||
if (Submarine != null) hullDrawRect.Location += Submarine.DrawPosition.ToPoint();
|
if (Submarine != null) hullDrawRect.Location += Submarine.DrawPosition.ToPoint();
|
||||||
|
|
||||||
|
float depth = 1.0f;
|
||||||
foreach (Decal d in decals)
|
foreach (Decal d in decals)
|
||||||
{
|
{
|
||||||
d.Draw(spriteBatch, this);
|
d.Draw(spriteBatch, this, depth);
|
||||||
|
depth -= 0.000001f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,13 +105,13 @@ namespace Barotrauma.Particles
|
|||||||
fadeTimer = Prefab.FadeInTime;
|
fadeTimer = Prefab.FadeInTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, Hull hull)
|
public void Draw(SpriteBatch spriteBatch, Hull hull, float depth)
|
||||||
{
|
{
|
||||||
Vector2 drawPos = position + hull.Rect.Location.ToVector2();
|
Vector2 drawPos = position + hull.Rect.Location.ToVector2();
|
||||||
drawPos += hull.Submarine.DrawPosition;
|
drawPos += hull.Submarine.DrawPosition;
|
||||||
drawPos.Y = -drawPos.Y;
|
drawPos.Y = -drawPos.Y;
|
||||||
|
|
||||||
spriteBatch.Draw(Sprite.Texture, drawPos, clippedSourceRect, Color * GetAlpha(), 0, Vector2.Zero, scale, SpriteEffects.None, 1);
|
spriteBatch.Draw(Sprite.Texture, drawPos, clippedSourceRect, Color * GetAlpha(), 0, Vector2.Zero, scale, SpriteEffects.None, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetAlpha()
|
private float GetAlpha()
|
||||||
|
|||||||
Reference in New Issue
Block a user