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.
+3 -2
View File
@@ -872,9 +872,10 @@ namespace Barotrauma
prefab.sprite.effects = oldEffects; 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);
+2 -2
View File
@@ -31,8 +31,8 @@ namespace Barotrauma
protected ConstructorInfo constructor; protected ConstructorInfo constructor;
//is it possible to stretch the entity horizontally/vertically //is it possible to stretch the entity horizontally/vertically
protected bool resizeHorizontal; public bool resizeHorizontal { get; protected set; }
protected bool resizeVertical; public bool resizeVertical { get; protected set; }
//which prefab has been selected for placing //which prefab has been selected for placing
protected static MapEntityPrefab selected; protected static MapEntityPrefab selected;
+10
View File
@@ -63,6 +63,16 @@ namespace Barotrauma
public SpriteEffects SpriteEffects = SpriteEffects.None; public SpriteEffects SpriteEffects = SpriteEffects.None;
public bool resizeHorizontal
{
get { return prefab.resizeHorizontal; }
}
public bool resizeVertical
{
get { return prefab.resizeVertical; }
}
private bool flippedX; private bool flippedX;
public override Sprite Sprite public override Sprite Sprite
+6 -4
View File
@@ -239,7 +239,7 @@ namespace Barotrauma
null, null, null, null, null, null, null, null,
cam.Transform); 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(); spriteBatch.End();
@@ -255,7 +255,7 @@ namespace Barotrauma
null, null, null, null, null, null, null, null,
cam.Transform); 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); foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
@@ -336,6 +336,8 @@ namespace Barotrauma
Submarine.DrawDamageable(spriteBatch, null); Submarine.DrawDamageable(spriteBatch, null);
spriteBatch.End(); spriteBatch.End();
GameMain.LightManager.DrawLightMap(spriteBatch, lightBlur.Effect);
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, true); GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, true);
} }
@@ -398,9 +400,9 @@ namespace Barotrauma
spriteBatch.Begin(SpriteSortMode.Immediate, spriteBatch.Begin(SpriteSortMode.Immediate,
BlendState.AlphaBlend); 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), 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(); spriteBatch.End();
} }