diff --git a/Subsurface/Source/Characters/Animation/Ragdoll.cs b/Subsurface/Source/Characters/Animation/Ragdoll.cs index 08fbbaa0f..0a934195d 100644 --- a/Subsurface/Source/Characters/Animation/Ragdoll.cs +++ b/Subsurface/Source/Characters/Animation/Ragdoll.cs @@ -464,15 +464,15 @@ namespace Barotrauma float impact = Vector2.Dot(velocity, -normal); - float volume = Math.Min(impact, 1.0f); + float volume = Math.Min(impact-3.0f, 1.0f); if (f1.Body.UserData is Limb) { Limb limb = (Limb)f1.Body.UserData; - if (impact > 0.5f && limb.HitSound != null && limb.soundTimer <= 0.0f) + if (impact > 3.0f && limb.HitSound != null && limb.soundTimer <= 0.0f) { limb.soundTimer = Limb.SoundInterval; - limb.HitSound.Play(volume, impact * 250.0f, limb.WorldPosition); + limb.HitSound.Play(volume, impact * 100.0f, limb.WorldPosition); } } else if (f1.Body == collider.FarseerBody) diff --git a/Subsurface/Source/Characters/Limb.cs b/Subsurface/Source/Characters/Limb.cs index 4532a846a..348c84739 100644 --- a/Subsurface/Source/Characters/Limb.cs +++ b/Subsurface/Source/Characters/Limb.cs @@ -63,7 +63,7 @@ namespace Barotrauma Sound hitSound; //a timer for delaying when a hitsound/attacksound can be played again public float soundTimer; - public const float SoundInterval = 0.2f; + public const float SoundInterval = 0.4f; public readonly Attack attack; diff --git a/Subsurface/Source/GameMain.cs b/Subsurface/Source/GameMain.cs index 3ca6f0528..7326838e2 100644 --- a/Subsurface/Source/GameMain.cs +++ b/Subsurface/Source/GameMain.cs @@ -65,7 +65,7 @@ namespace Barotrauma public static World World; public static LoadingScreen TitleScreen; - private static bool titleScreenOpen; + private static bool loadingScreenOpen; public static GameSettings Config; @@ -187,7 +187,7 @@ namespace Barotrauma spriteBatch = new SpriteBatch(GraphicsDevice); TextureLoader.Init(GraphicsDevice); - titleScreenOpen = true; + loadingScreenOpen = true; TitleScreen = new LoadingScreen(GraphicsDevice); CoroutineManager.StartCoroutine(Load()); @@ -304,12 +304,17 @@ namespace Barotrauma PlayerInput.Update(Timing.Step); - if (titleScreenOpen) + if (loadingScreenOpen) { + //reset accumulator if loading + // -> less choppy loading screens because the screen is rendered after each update + // -> no pause caused by leftover time in the accumulator when starting a new shift + Timing.Accumulator = 0.0f; + if (TitleScreen.LoadState >= 100.0f && (!waitForKeyHit || PlayerInput.GetKeyboardState.GetPressedKeys().Length>0 || PlayerInput.LeftButtonClicked())) { - titleScreenOpen = false; + loadingScreenOpen = false; } } else if (hasLoaded) @@ -334,8 +339,7 @@ namespace Barotrauma } GUI.Update((float)Timing.Step); - } - + } CoroutineManager.Update((float)Timing.Step, paused ? 0.0f : (float)Timing.Step); @@ -355,7 +359,7 @@ namespace Barotrauma FrameCounter.Update(deltaTime); - if (titleScreenOpen) + if (loadingScreenOpen) { TitleScreen.Draw(spriteBatch, GraphicsDevice, (float)deltaTime); } @@ -369,7 +373,7 @@ namespace Barotrauma public static CoroutineHandle ShowLoading(IEnumerable loader, bool waitKeyHit = true) { waitForKeyHit = waitKeyHit; - titleScreenOpen = true; + loadingScreenOpen = true; TitleScreen.LoadState = null; return CoroutineManager.StartCoroutine(TitleScreen.DoLoading(loader)); } diff --git a/Subsurface/Source/Map/Submarine.cs b/Subsurface/Source/Map/Submarine.cs index 013d42d3b..7a8d32f82 100644 --- a/Subsurface/Source/Map/Submarine.cs +++ b/Subsurface/Source/Map/Submarine.cs @@ -294,18 +294,23 @@ namespace Barotrauma { MapEntity.mapEntityList[i].Draw(spriteBatch, editing); } - } - public static void DrawFront(SpriteBatch spriteBatch, bool editing = false) + public static void DrawFront(SpriteBatch spriteBatch, bool editing = false, Predicate predicate = null) { for (int i = 0; i < MapEntity.mapEntityList.Count; i++) { - if (MapEntity.mapEntityList[i].DrawOverWater) - MapEntity.mapEntityList[i].Draw(spriteBatch, editing, false); - } + if (!MapEntity.mapEntityList[i].DrawOverWater) continue; + if (predicate != null) + { + if (!predicate(MapEntity.mapEntityList[i])) continue; + } + + MapEntity.mapEntityList[i].Draw(spriteBatch, editing, false); + } + if (GameMain.DebugDraw) { foreach (Submarine sub in Submarine.Loaded) @@ -325,10 +330,7 @@ namespace Barotrauma prevPos = currPos; } - } - - } } @@ -351,13 +353,14 @@ namespace Barotrauma { for (int i = 0; i < MapEntity.mapEntityList.Count; i++) { + if (!MapEntity.mapEntityList[i].DrawBelowWater) continue; + if (predicate != null) { if (!predicate(MapEntity.mapEntityList[i])) continue; } - if (MapEntity.mapEntityList[i].DrawBelowWater) - MapEntity.mapEntityList[i].Draw(spriteBatch, editing, true); + MapEntity.mapEntityList[i].Draw(spriteBatch, editing, true); } } diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index fe856ae67..d04951049 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -242,7 +242,7 @@ namespace Barotrauma null, null, null, null, cam.Transform); - Submarine.DrawBack(spriteBatch,false,s => s is Structure && (((Structure)s).resizeHorizontal || ((Structure)s).resizeVertical)); + Submarine.DrawBack(spriteBatch, false, s => s is Structure); spriteBatch.End(); @@ -258,7 +258,7 @@ namespace Barotrauma null, null, null, null, cam.Transform); - Submarine.DrawBack(spriteBatch, false, s => !(s is Structure) || (!((Structure)s).resizeHorizontal && !((Structure)s).resizeHorizontal)); + Submarine.DrawBack(spriteBatch, false, s => !(s is Structure)); foreach (Character c in Character.CharacterList) c.Draw(spriteBatch); @@ -328,19 +328,22 @@ namespace Barotrauma { graphics.SetRenderTarget(renderTarget); spriteBatch.Begin(SpriteSortMode.Deferred, - BlendState.Opaque, null, null, null, lightBlur.Effect); + BlendState.Opaque, null, null, null, lightBlur.Effect); + spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White); + spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.BackToFront, - BlendState.AlphaBlend, SamplerState.LinearWrap, - null, null, null, - cam.Transform); + BlendState.AlphaBlend, SamplerState.LinearWrap, + null, null, null, + cam.Transform); + Submarine.DrawDamageable(spriteBatch, null); + Submarine.DrawFront(spriteBatch, false, s => s is Structure); + spriteBatch.End(); - - //GameMain.LightManager.DrawLightMap(spriteBatch, lightBlur.Effect); - + GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, true); }