Attempted fix for drawableComponents crash + LOS tweaks
This commit is contained in:
Binary file not shown.
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user