Unstable 0.17.3.0

This commit is contained in:
Juan Pablo Arce
2022-03-22 14:44:12 -03:00
parent cefac171f5
commit 4206f6db42
100 changed files with 1380 additions and 655 deletions
@@ -248,17 +248,24 @@ namespace Barotrauma
}
spriteBatch.End();
//draw characters with deformable limbs last, because they can't be batched into SpriteBatch
//pretty hacky way of preventing draw order issues between normal and deformable sprites
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.None, null, null, cam.Transform);
//backwards order to render the most recently spawned characters in front (characters spawned later have a larger sprite depth)
for (int i = Character.CharacterList.Count - 1; i >= 0; i--)
DrawDeformed(firstPass: true);
DrawDeformed(firstPass: false);
void DrawDeformed(bool firstPass)
{
Character c = Character.CharacterList[i];
if (!c.IsVisible || c.AnimController.Limbs.All(l => l.DeformSprite == null)) { continue; }
c.Draw(spriteBatch, Cam);
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.None, null, null, cam.Transform);
//backwards order to render the most recently spawned characters in front (characters spawned later have a larger sprite depth)
for (int i = Character.CharacterList.Count - 1; i >= 0; i--)
{
Character c = Character.CharacterList[i];
if (!c.IsVisible) { continue; }
if (c.Params.DrawLast == firstPass) { continue; }
if (c.AnimController.Limbs.All(l => l.DeformSprite == null)) { continue; }
c.Draw(spriteBatch, Cam);
}
spriteBatch.End();
}
spriteBatch.End();
Level.Loaded?.DrawFront(spriteBatch, cam);