Merge branch 'master' into animcontroller-overhaul

This commit is contained in:
Regalis
2016-10-19 21:15:44 +03:00
9 changed files with 116 additions and 29 deletions
@@ -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);
}
+10 -4
View File
@@ -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; }
}
}
+3 -3
View File
@@ -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;
+10
View File
@@ -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
+11 -3
View File
@@ -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);
}