diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs index 1dfe397b6..bb5744db5 100644 --- a/Subsurface/Source/Map/Levels/Level.cs +++ b/Subsurface/Source/Map/Levels/Level.cs @@ -807,7 +807,7 @@ namespace Barotrauma return matchingPositions[Rand.Int(matchingPositions.Count, !useSyncedRand)].Position; } - public void Update (float deltaTime) + public void Update(float deltaTime) { if (Submarine.MainSub != null) { @@ -849,6 +849,11 @@ namespace Barotrauma public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null) { + float brightness = MathHelper.Clamp(50.0f + (cam.Position.Y - Size.Y) / 2000.0f, 10.0f, 40.0f); + + float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3; + GameMain.LightManager.AmbientLight = new Color(backgroundColor * (brightness / avgValue), 1.0f); + graphics.Clear(backgroundColor); if (renderer == null) return; diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index 55a217098..1d741e248 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -95,6 +95,9 @@ namespace Barotrauma #if DEBUG if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null) { + var closestSub = Submarine.GetClosest(cam.WorldViewCenter); + if (closestSub == null) closestSub = GameMain.GameSession.Submarine; + Vector2 targetMovement = Vector2.Zero; if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f; if (PlayerInput.KeyDown(Keys.K)) targetMovement.Y -= 1.0f; @@ -102,7 +105,7 @@ namespace Barotrauma if (PlayerInput.KeyDown(Keys.L)) targetMovement.X += 1.0f; if (targetMovement != Vector2.Zero) - GameMain.GameSession.Submarine.ApplyForce(targetMovement * GameMain.GameSession.Submarine.SubBody.Body.Mass * 100.0f); + closestSub.ApplyForce(targetMovement * closestSub.SubBody.Body.Mass * 100.0f); } #endif if (GameMain.GameSession != null) GameMain.GameSession.Update((float)deltaTime);