diff --git a/Subsurface/Source/Items/Components/Machines/MiniMap.cs b/Subsurface/Source/Items/Components/Machines/MiniMap.cs index 4e504ba58..8f583d995 100644 --- a/Subsurface/Source/Items/Components/Machines/MiniMap.cs +++ b/Subsurface/Source/Items/Components/Machines/MiniMap.cs @@ -177,17 +177,17 @@ namespace Barotrauma.Items.Components "Hull breach", Color.Red, Color.Black * 0.5f, 2, GUI.SmallFont); } - GUI.DrawString(spriteBatch, - new Vector2(x+10, y+height-40), - oxygenAmount == null ? "Air quality data not available" : "Air quality: "+(int)oxygenAmount+" %", + GUI.DrawString(spriteBatch, + new Vector2(x + 10, y + height - 60), + oxygenAmount == null ? "Air quality data not available" : "Air quality: " + (int)oxygenAmount + " %", oxygenAmount == null ? Color.Red : Color.Lerp(Color.Red, Color.LightGreen, (float)oxygenAmount / 100.0f), Color.Black * 0.5f, 2, GUI.SmallFont); GUI.DrawString(spriteBatch, - new Vector2(x + 10, y + height - 20), - waterAmount == null ? "Water level data not available" : "Water level: " + (int)(waterAmount*100.0f) + " %", + new Vector2(x + 10, y + height - 40), + waterAmount == null ? "Water level data not available" : "Water level: " + (int)(waterAmount * 100.0f) + " %", waterAmount == null ? Color.Red : Color.Lerp(Color.LightGreen, Color.Red, (float)waterAmount), - Color.Black * 0.5f, 2, GUI.SmallFont); + Color.Black * 0.5f, 2, GUI.SmallFont); } GUI.DrawRectangle(spriteBatch, hullRect, borderColor, false, 0.0f, 2); diff --git a/Subsurface/Source/Particles/Particle.cs b/Subsurface/Source/Particles/Particle.cs index 61374da06..fdd027ab3 100644 --- a/Subsurface/Source/Particles/Particle.cs +++ b/Subsurface/Source/Particles/Particle.cs @@ -180,91 +180,87 @@ namespace Barotrauma.Particles animFrame = (int)Math.Min(Math.Floor(animState / prefab.AnimDuration * frameCount), frameCount - 1); } - if (prefab.DeleteOnCollision || prefab.CollidesWithWalls) + lifeTime -= deltaTime; + if (lifeTime <= 0.0f || alpha <= 0.0f || size.X <= 0.0f || size.Y <= 0.0f) return false; + + if (!prefab.DeleteOnCollision && !prefab.CollidesWithWalls) return true; + + if (currentHull == null) { - //Vector2 edgePos = position + prefab.CollisionRadius * Vector2.Normalize(velocity) * size.X; - - if (currentHull == null) + Hull collidedHull = Hull.FindHull(position); + if (collidedHull != null) { - Hull collidedHull = Hull.FindHull(position); - if (collidedHull != null) - { - if (prefab.DeleteOnCollision) return false; - OnWallCollisionOutside(collidedHull); - } + if (prefab.DeleteOnCollision) return false; + OnWallCollisionOutside(collidedHull); + } + } + else + { + Vector2 collisionNormal = Vector2.Zero; + if (velocity.Y < 0.0f && position.Y - prefab.CollisionRadius * size.Y < currentHull.WorldRect.Y - currentHull.WorldRect.Height) + { + if (prefab.DeleteOnCollision) return false; + collisionNormal = new Vector2(0.0f, 1.0f); } - else + else if (velocity.Y > 0.0f && position.Y + prefab.CollisionRadius * size.Y > currentHull.WorldRect.Y) { - Vector2 collisionNormal = Vector2.Zero; - if (velocity.Y < 0.0f && position.Y - prefab.CollisionRadius * size.Y < currentHull.WorldRect.Y - currentHull.WorldRect.Height) - { - if (prefab.DeleteOnCollision) return false; - collisionNormal = new Vector2(0.0f, 1.0f); - } - else if (velocity.Y > 0.0f && position.Y + prefab.CollisionRadius * size.Y > currentHull.WorldRect.Y) - { - if (prefab.DeleteOnCollision) return false; - collisionNormal = new Vector2(0.0f, -1.0f); - } - else if (velocity.X < 0.0f && position.X - prefab.CollisionRadius * size.X < currentHull.WorldRect.X) - { - if (prefab.DeleteOnCollision) return false; - collisionNormal = new Vector2(1.0f, 0.0f); - } - else if (velocity.X > 0.0f && position.X + prefab.CollisionRadius * size.X > currentHull.WorldRect.Right) - { - if (prefab.DeleteOnCollision) return false; - collisionNormal = new Vector2(-1.0f, 0.0f); - } + if (prefab.DeleteOnCollision) return false; + collisionNormal = new Vector2(0.0f, -1.0f); + } + else if (velocity.X < 0.0f && position.X - prefab.CollisionRadius * size.X < currentHull.WorldRect.X) + { + if (prefab.DeleteOnCollision) return false; + collisionNormal = new Vector2(1.0f, 0.0f); + } + else if (velocity.X > 0.0f && position.X + prefab.CollisionRadius * size.X > currentHull.WorldRect.Right) + { + if (prefab.DeleteOnCollision) return false; + collisionNormal = new Vector2(-1.0f, 0.0f); + } - if (collisionNormal != Vector2.Zero) + if (collisionNormal != Vector2.Zero) + { + bool gapFound = false; + foreach (Gap gap in hullGaps) { - bool gapFound = false; - foreach (Gap gap in hullGaps) + if (gap.isHorizontal != (collisionNormal.X != 0.0f)) continue; + + if (gap.isHorizontal) { - if (gap.isHorizontal != (collisionNormal.X != 0.0f)) continue; - - if (gap.isHorizontal) - { - if (gap.WorldRect.Y < position.Y || gap.WorldRect.Y - gap.WorldRect.Height > position.Y) continue; - int gapDir = Math.Sign(gap.WorldRect.Center.X - currentHull.WorldRect.Center.X); - if (Math.Sign(velocity.X) != gapDir || Math.Sign(position.X - currentHull.WorldRect.Center.X) != gapDir) continue; - } - else - { - if (gap.WorldRect.X > position.X || gap.WorldRect.Right < position.X) continue; - float hullCenterY = currentHull.WorldRect.Y - currentHull.WorldRect.Height / 2; - int gapDir = Math.Sign(gap.WorldRect.Y - hullCenterY); - if (Math.Sign(velocity.Y) != gapDir || Math.Sign(position.Y - hullCenterY) != gapDir) continue; - } - - gapFound = true; - break; - } - - if (!gapFound) - { - OnWallCollisionInside(currentHull, collisionNormal); + if (gap.WorldRect.Y < position.Y || gap.WorldRect.Y - gap.WorldRect.Height > position.Y) continue; + int gapDir = Math.Sign(gap.WorldRect.Center.X - currentHull.WorldRect.Center.X); + if (Math.Sign(velocity.X) != gapDir || Math.Sign(position.X - currentHull.WorldRect.Center.X) != gapDir) continue; } else { - Hull newHull = Hull.FindHull(position); - if (newHull != currentHull) - { - currentHull = newHull; - hullGaps = currentHull == null ? new List() : currentHull.ConnectedGaps; - OnChangeHull?.Invoke(position, currentHull); - } + if (gap.WorldRect.X > position.X || gap.WorldRect.Right < position.X) continue; + float hullCenterY = currentHull.WorldRect.Y - currentHull.WorldRect.Height / 2; + int gapDir = Math.Sign(gap.WorldRect.Y - hullCenterY); + if (Math.Sign(velocity.Y) != gapDir || Math.Sign(position.Y - hullCenterY) != gapDir) continue; + } + + gapFound = true; + break; + } + + if (!gapFound) + { + OnWallCollisionInside(currentHull, collisionNormal); + } + else + { + Hull newHull = Hull.FindHull(position); + if (newHull != currentHull) + { + currentHull = newHull; + hullGaps = currentHull == null ? new List() : currentHull.ConnectedGaps; + OnChangeHull?.Invoke(position, currentHull); } } } } - lifeTime -= deltaTime; - - if (lifeTime <= 0.0f || alpha <= 0.0f || size.X <= 0.0f || size.Y <= 0.0f) return false; - return true; } diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index 29cfc59ef..d35cddc8c 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -1,19 +1,16 @@ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; -using Barotrauma.Lights; -using System.Diagnostics; using Microsoft.Xna.Framework.Content; -using System.Collections.Generic; +using Microsoft.Xna.Framework.Input; namespace Barotrauma { class GameScreen : Screen { - Camera cam; + private Camera cam; - Color waterColor = new Color(0.75f, 0.8f, 0.9f, 1.0f); + private Color waterColor = new Color(0.75f, 0.8f, 0.9f, 1.0f); readonly RenderTarget2D renderTargetBackground; readonly RenderTarget2D renderTarget; diff --git a/Subsurface/Source/Sounds/SoundPlayer.cs b/Subsurface/Source/Sounds/SoundPlayer.cs index e28e438b5..60e9689ef 100644 --- a/Subsurface/Source/Sounds/SoundPlayer.cs +++ b/Subsurface/Source/Sounds/SoundPlayer.cs @@ -233,7 +233,7 @@ namespace Barotrauma foreach (Submarine sub in Submarine.Loaded) { - float movementFactor = (sub.Velocity == Vector2.Zero) ? 0.0f : sub.Velocity.Length() / 5.0f; + float movementFactor = (sub.Velocity == Vector2.Zero) ? 0.0f : sub.Velocity.Length() / 10.0f; movementFactor = MathHelper.Clamp(movementFactor, 0.0f, 1.0f); if (Character.Controlled==null || Character.Controlled.Submarine != sub) diff --git a/Subsurface/changelog.txt b/Subsurface/changelog.txt index 905d04179..c8a300e7d 100644 --- a/Subsurface/changelog.txt +++ b/Subsurface/changelog.txt @@ -38,23 +38,16 @@ Submarine editor: - open menus are closed when opening another one (e.g. the save dialog box is automatically closed if the item selection menu is opened) - -- background ice formations with a parallax effect - -- swimming animation fix: characters don't swim with their legs extended up over their shoulders after a -sharp turn - -- the level generation algorithm doesn't place walls behind alien ruins - -- improved fire & smoke particles - -- water puts out fires more slowly - -- explosion damage is reduced if there are walls or other solid obstacles between and explosion and a character - -- heal and revive commands can also be used on other characters than the controlled one - -- fixed fires occasionally causing incorrect sound clips to loop continuously +Misc: + - background ice formations with a parallax effect + - the level generation algorithm doesn't place walls behind alien ruins + - improved fire & smoke particles + - water puts out fires more slowly + - explosion damage is reduced if there are walls or other solid obstacles between and explosion and a character + - heal and revive commands can also be used on other characters than the controlled one + - fixed fires occasionally causing incorrect sound clips to loop continuously + - swimming animation fix: characters don't swim with their legs extended up over their shoulders + after a sharp turn ---------------------------------------------------------------------------------------------------------