Merge branch 'walldamage'

This commit is contained in:
Regalis
2016-09-26 16:28:52 +03:00
32 changed files with 871 additions and 329 deletions
+41 -16
View File
@@ -18,6 +18,10 @@ namespace Barotrauma
private BlurEffect lightBlur;
private Effect damageEffect;
private Texture2D damageStencil;
public BackgroundCreatureManager BackgroundCreatureManager;
public Camera Cam
@@ -46,10 +50,14 @@ namespace Barotrauma
var blurEffect = content.Load<Effect>("blurshader");
#endif
damageStencil = TextureLoader.FromFile("Content/Map/walldamage.png");
damageEffect = content.Load<Effect>("damageshader");
damageEffect.Parameters["xStencil"].SetValue(damageStencil);
damageEffect.Parameters["aMultiplier"].SetValue(50.0f);
damageEffect.Parameters["cMultiplier"].SetValue(200.0f);
lightBlur = new BlurEffect(blurEffect, 0.001f, 0.001f);
}
public override void Select()
@@ -101,23 +109,24 @@ namespace Barotrauma
}
#endif
if (GameMain.GameSession!=null) GameMain.GameSession.Update((float)deltaTime);
//EventManager.Update(gameTime);
if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime);
Character.UpdateAll(cam, (float)deltaTime);
BackgroundCreatureManager.Update(cam, (float)deltaTime);
GameMain.ParticleManager.Update((float)deltaTime);
StatusEffect.UpdateAll((float)deltaTime);
Physics.accumulator = Math.Min(Physics.accumulator, Physics.step * 6);
//Physics.accumulator = Physics.step;
while (Physics.accumulator >= Physics.step)
{
if (GameMain.GameSession != null) GameMain.GameSession.Update((float)Physics.step);
//EventManager.Update(gameTime);
if (Level.Loaded != null) Level.Loaded.Update((float)Physics.step);
Character.UpdateAll(cam, (float)Physics.step);
BackgroundCreatureManager.Update(cam, (float)Physics.step);
GameMain.ParticleManager.Update((float)Physics.step);
StatusEffect.UpdateAll((float)Physics.step);
if (Character.Controlled != null && Lights.LightManager.ViewTarget != null)
{
cam.TargetPos = Lights.LightManager.ViewTarget.WorldPosition;
@@ -160,7 +169,10 @@ namespace Barotrauma
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
{
cam.UpdateTransform(true);
cam.UpdateTransform(true);
//damageStencil = TextureLoader.FromFile("Content/Map/background.png");
DrawMap(graphics, spriteBatch);
@@ -199,6 +211,8 @@ namespace Barotrauma
sub.UpdateTransform();
}
GameMain.ParticleManager.UpdateTransforms();
GameMain.LightManager.ObstructVision = Character.Controlled != null && Character.Controlled.ObstructVision;
GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam);
@@ -324,6 +338,17 @@ namespace Barotrauma
Submarine.DrawFront(spriteBatch);
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate,
BlendState.NonPremultiplied, SamplerState.LinearWrap,
null, null,
damageEffect,
cam.Transform);
Submarine.DrawDamageable(spriteBatch, damageEffect);
spriteBatch.End();
GameMain.LightManager.DrawLightMap(spriteBatch, cam, lightBlur.Effect);