Fixed wall damage not being visible if there's only one damaged section
This commit is contained in:
@@ -488,7 +488,6 @@ namespace Barotrauma
|
|||||||
Draw(spriteBatch, false, false, damageEffect);
|
Draw(spriteBatch, false, false, damageEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float prevCutoff;
|
|
||||||
|
|
||||||
private void Draw(SpriteBatch spriteBatch, bool editing, bool back = true, Effect damageEffect = null)
|
private void Draw(SpriteBatch spriteBatch, bool editing, bool back = true, Effect damageEffect = null)
|
||||||
{
|
{
|
||||||
@@ -527,14 +526,14 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
float newCutoff = Math.Min((sections[i].damage / prefab.MaxHealth), 0.65f);
|
float newCutoff = Math.Min((sections[i].damage / prefab.MaxHealth), 0.65f);
|
||||||
|
|
||||||
if (Math.Abs(newCutoff - prevCutoff) > 0.01f)
|
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f)
|
||||||
{
|
{
|
||||||
damageEffect.Parameters["aCutoff"].SetValue(newCutoff);
|
damageEffect.Parameters["aCutoff"].SetValue(newCutoff);
|
||||||
damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f);
|
damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f);
|
||||||
|
|
||||||
damageEffect.CurrentTechnique.Passes[0].Apply();
|
damageEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
prevCutoff = newCutoff;
|
Submarine.DamageEffectCutoff = newCutoff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -373,6 +373,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static float DamageEffectCutoff;
|
||||||
|
|
||||||
public static void DrawDamageable(SpriteBatch spriteBatch, Effect damageEffect, bool editing = false)
|
public static void DrawDamageable(SpriteBatch spriteBatch, Effect damageEffect, bool editing = false)
|
||||||
{
|
{
|
||||||
var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList;
|
var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList;
|
||||||
@@ -386,6 +389,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
damageEffect.Parameters["aCutoff"].SetValue(0.0f);
|
damageEffect.Parameters["aCutoff"].SetValue(0.0f);
|
||||||
damageEffect.Parameters["cCutoff"].SetValue(0.0f);
|
damageEffect.Parameters["cCutoff"].SetValue(0.0f);
|
||||||
|
|
||||||
|
DamageEffectCutoff = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user