Merge branch 'master' into animcontroller-overhaul
This commit is contained in:
@@ -419,9 +419,12 @@ namespace Barotrauma
|
||||
|
||||
for (int i = 0; i < triangles.Count; i++)
|
||||
{
|
||||
if (triangles[i][0].Y == triangles[i][1].Y && triangles[i][0].Y == triangles[i][2].Y) continue;
|
||||
if (triangles[i][0].X == triangles[i][1].X && triangles[i][0].X == triangles[i][2].X) continue;
|
||||
|
||||
//don't create a triangle if any of the vertices are too close to each other
|
||||
//(apparently Farseer doesn't like polygons with a very small area, see Shape.ComputeProperties)
|
||||
if (Vector2.Distance(triangles[i][0], triangles[i][1]) < 0.05f ||
|
||||
Vector2.Distance(triangles[i][0], triangles[i][2]) < 0.05f ||
|
||||
Vector2.Distance(triangles[i][1], triangles[i][2]) < 0.05f) continue;
|
||||
|
||||
Vertices bodyVertices = new Vertices(triangles[i]);
|
||||
FixtureFactory.AttachPolygon(bodyVertices, 5.0f, cellBody);
|
||||
}
|
||||
|
||||
@@ -366,15 +366,15 @@ namespace Barotrauma.Lights
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
public void DrawLOS(SpriteBatch spriteBatch, Effect effect)
|
||||
public void DrawLOS(SpriteBatch spriteBatch, Effect effect,bool renderingBackground)
|
||||
{
|
||||
if (!LosEnabled || ViewTarget == null) return;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, effect);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, renderingBackground ? CustomBlendStates.LOS : CustomBlendStates.Multiplicative, null, null, null, effect);
|
||||
spriteBatch.Draw(losTexture, Vector2.Zero, Color.White);
|
||||
spriteBatch.End();
|
||||
|
||||
ObstructVision = false;
|
||||
if (!renderingBackground) ObstructVision = false;
|
||||
}
|
||||
|
||||
public void ClearLights()
|
||||
@@ -399,10 +399,16 @@ namespace Barotrauma.Lights
|
||||
MultiplyWithAlpha = new BlendState();
|
||||
MultiplyWithAlpha.ColorDestinationBlend = MultiplyWithAlpha.AlphaDestinationBlend = Blend.One;
|
||||
MultiplyWithAlpha.ColorSourceBlend = MultiplyWithAlpha.AlphaSourceBlend = Blend.DestinationAlpha;
|
||||
|
||||
LOS = new BlendState();
|
||||
LOS.ColorSourceBlend = LOS.AlphaSourceBlend = Blend.Zero;
|
||||
LOS.ColorDestinationBlend = LOS.AlphaDestinationBlend = Blend.InverseSourceColor;
|
||||
LOS.ColorBlendFunction = LOS.AlphaBlendFunction = BlendFunction.Add;
|
||||
}
|
||||
public static BlendState Multiplicative { get; private set; }
|
||||
public static BlendState WriteToAlpha { get; private set; }
|
||||
public static BlendState MultiplyWithAlpha { get; private set; }
|
||||
public static BlendState LOS { get; private set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace Barotrauma
|
||||
protected ConstructorInfo constructor;
|
||||
|
||||
//is it possible to stretch the entity horizontally/vertically
|
||||
protected bool resizeHorizontal;
|
||||
protected bool resizeVertical;
|
||||
|
||||
public bool resizeHorizontal { get; protected set; }
|
||||
public bool resizeVertical { get; protected set; }
|
||||
|
||||
//which prefab has been selected for placing
|
||||
protected static MapEntityPrefab selected;
|
||||
|
||||
|
||||
@@ -67,6 +67,16 @@ namespace Barotrauma
|
||||
|
||||
public SpriteEffects SpriteEffects = SpriteEffects.None;
|
||||
|
||||
public bool resizeHorizontal
|
||||
{
|
||||
get { return prefab.resizeHorizontal; }
|
||||
}
|
||||
|
||||
public bool resizeVertical
|
||||
{
|
||||
get { return prefab.resizeVertical; }
|
||||
}
|
||||
|
||||
private bool flippedX;
|
||||
|
||||
public override Sprite Sprite
|
||||
|
||||
@@ -317,15 +317,23 @@ namespace Barotrauma
|
||||
if (MapEntity.mapEntityList[i].DrawDamageEffect)
|
||||
MapEntity.mapEntityList[i].DrawDamage(spriteBatch, damageEffect);
|
||||
}
|
||||
damageEffect.Parameters["aCutoff"].SetValue(0.0f);
|
||||
damageEffect.Parameters["cCutoff"].SetValue(0.0f);
|
||||
if (damageEffect != null)
|
||||
{
|
||||
damageEffect.Parameters["aCutoff"].SetValue(0.0f);
|
||||
damageEffect.Parameters["cCutoff"].SetValue(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void DrawBack(SpriteBatch spriteBatch, bool editing = false)
|
||||
public static void DrawBack(SpriteBatch spriteBatch, bool editing = false, Predicate<MapEntity> predicate = null)
|
||||
{
|
||||
for (int i = 0; i < MapEntity.mapEntityList.Count; i++)
|
||||
{
|
||||
if (predicate != null)
|
||||
{
|
||||
if (!predicate(MapEntity.mapEntityList[i])) continue;
|
||||
}
|
||||
|
||||
if (MapEntity.mapEntityList[i].DrawBelowWater)
|
||||
MapEntity.mapEntityList[i].Draw(spriteBatch, editing, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user