Fixed damageshader ignoring sprite colors. Closes #212

This commit is contained in:
Joonas Rikkonen
2017-12-30 04:51:39 +02:00
parent 6777a039d5
commit 65d6071378
5 changed files with 8 additions and 3 deletions
@@ -148,14 +148,17 @@ namespace Barotrauma
{
float newCutoff = Math.Min((sections[i].damage / prefab.Health), 0.65f);
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f)
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f || color != Submarine.DamageEffectColor)
{
damageEffect.Parameters["aCutoff"].SetValue(newCutoff);
damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f);
damageEffect.Parameters["color"].SetValue(color.ToVector4());
damageEffect.CurrentTechnique.Passes[0].Apply();
Submarine.DamageEffectCutoff = newCutoff;
Submarine.DamageEffectColor = color;
}
}