Attempted fix for drawableComponents crash + LOS tweaks

This commit is contained in:
juanjp600
2016-10-12 19:24:39 -03:00
parent 7e6ef65eb3
commit 506ef2f2aa
5 changed files with 23 additions and 10 deletions

Binary file not shown.

View File

@@ -872,12 +872,13 @@ namespace Barotrauma
prefab.sprite.effects = oldEffects;
for (int i = 0; i < drawableComponents.Count; i++ )
List<IDrawableComponent> staticDrawableComponents = new List<IDrawableComponent>(drawableComponents); //static list to compensate for drawable toggling
for (int i = 0; i < staticDrawableComponents.Count; i++ )
{
drawableComponents[i].Draw(spriteBatch, editing);
staticDrawableComponents[i].Draw(spriteBatch, editing);
}
//foreach (ItemComponent component in components) component.Draw(spriteBatch, editing);
//foreach (ItemComponent component in components) component.Draw(spriteBatch, editing);
if (GameMain.DebugDraw && aiTarget!=null) aiTarget.Draw(spriteBatch);

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;

View File

@@ -63,6 +63,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

View File

@@ -239,7 +239,7 @@ namespace Barotrauma
null, null, null, null,
cam.Transform);
Submarine.DrawBack(spriteBatch,false,s => s is Structure);
Submarine.DrawBack(spriteBatch,false,s => s is Structure && ((s as Structure).resizeHorizontal || (s as Structure).resizeVertical));
spriteBatch.End();
@@ -255,7 +255,7 @@ namespace Barotrauma
null, null, null, null,
cam.Transform);
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
Submarine.DrawBack(spriteBatch, false, s => (!(s is Structure)) || (!(s as Structure).resizeHorizontal && !(s as Structure).resizeHorizontal));
foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
@@ -336,6 +336,8 @@ namespace Barotrauma
Submarine.DrawDamageable(spriteBatch, null);
spriteBatch.End();
GameMain.LightManager.DrawLightMap(spriteBatch, lightBlur.Effect);
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, true);
}
@@ -398,9 +400,9 @@ namespace Barotrauma
spriteBatch.Begin(SpriteSortMode.Immediate,
BlendState.AlphaBlend);
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.03f, 0.04f);
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.1f);
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
new Color(0.04f + r, Math.Max(0.04f-r,0.0f), Math.Max(0.045f - r, 0.0f), 1.0f));
new Color(r, Math.Max(0.07f-r*0.07f/0.1f,0.0f), Math.Max(0.1f - r, 0.0f), 1.0f));
spriteBatch.End();
}