diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs index 0f2ff1a6c..e81bf75e3 100644 --- a/Subsurface/Source/Map/Levels/Level.cs +++ b/Subsurface/Source/Map/Levels/Level.cs @@ -54,7 +54,7 @@ namespace Barotrauma public const int GridCellSize = 2000; private List[,] cellGrid; - private WrappingWall[,] wrappingWalls; + //private WrappingWall[,] wrappingWalls; //private float shaftHeight; @@ -97,10 +97,10 @@ namespace Barotrauma get { return ruins; } } - public WrappingWall[,] WrappingWalls - { - get { return wrappingWalls; } - } + //public WrappingWall[,] WrappingWalls + //{ + // get { return wrappingWalls; } + //} public string Seed { @@ -440,6 +440,7 @@ namespace Barotrauma renderer.PlaceSprites(generationParams.BackgroundSpriteAmount); + /* wrappingWalls = new WrappingWall[2, 2]; Rectangle ignoredArea = new Rectangle((int)startPosition.X, 0, (int)(endPosition.X - startPosition.X), borders.Height); @@ -465,7 +466,7 @@ namespace Barotrauma { cells.AddRange(wrappingWalls[side, i].Cells); } - } + }*/ ShaftBody = BodyFactory.CreateEdge(GameMain.World, ConvertUnits.ToSimUnits(new Vector2(borders.X, 0)), @@ -809,10 +810,11 @@ namespace Barotrauma public void Update(float deltaTime) { + /* if (Submarine.MainSub != null) { WrappingWall.UpdateWallShift(Submarine.MainSub.WorldPosition, wrappingWalls); - } + }*/ if (Hull.renderer != null) { @@ -884,6 +886,7 @@ namespace Barotrauma } } + /* if (wrappingWalls == null) return cells; for (int side = 0; side < 2; side++) @@ -899,7 +902,7 @@ namespace Barotrauma cells.Add(cell); } } - } + }*/ return cells; } @@ -918,6 +921,7 @@ namespace Barotrauma ruins = null; } + /* if (wrappingWalls!=null) { for (int side = 0; side < 2; side++) @@ -929,7 +933,7 @@ namespace Barotrauma } wrappingWalls = null; - } + }*/ cells = null; diff --git a/Subsurface/Source/Map/Levels/LevelRenderer.cs b/Subsurface/Source/Map/Levels/LevelRenderer.cs index f1e5148c1..0910925c2 100644 --- a/Subsurface/Source/Map/Levels/LevelRenderer.cs +++ b/Subsurface/Source/Map/Levels/LevelRenderer.cs @@ -219,6 +219,7 @@ namespace Barotrauma graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(bodyVertices.VertexCount / 3.0f)); + /* for (int side = 0; side < 2; side++) { for (int i = 0; i < 2; i++) @@ -234,7 +235,7 @@ namespace Barotrauma PrimitiveType.TriangleList, 0, (int)Math.Floor(level.WrappingWalls[side, i].BodyVertices.VertexCount / 3.0f)); } - } + }*/ graphicsDevice.SetVertexBuffer(wallVertices); @@ -243,7 +244,7 @@ namespace Barotrauma basicEffect.CurrentTechnique = basicEffect.Techniques["BasicEffect_Texture"]; basicEffect.CurrentTechnique.Passes[0].Apply(); graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(wallVertices.VertexCount / 3.0f)); - + /* for (int side = 0; side < 2; side++) { for (int i = 0; i < 2; i++) @@ -260,7 +261,7 @@ namespace Barotrauma (int)Math.Floor(level.WrappingWalls[side, i].WallVertices.VertexCount / 3.0f)); } - } + }*/ } diff --git a/Subsurface/Source/Map/SubmarineBody.cs b/Subsurface/Source/Map/SubmarineBody.cs index c17d6c302..c9c904ef9 100644 --- a/Subsurface/Source/Map/SubmarineBody.cs +++ b/Subsurface/Source/Map/SubmarineBody.cs @@ -243,6 +243,21 @@ namespace Barotrauma return; } + //if outside left or right edge of the level + if (Position.X < 0 || Position.X > Level.Loaded.Size.X) + { + Rectangle worldBorders = Borders; + worldBorders.Location += Position.ToPoint(); + + //push the sub back below the upper "barrier" of the level + if (worldBorders.Y > Level.Loaded.Size.Y) + { + Body.LinearVelocity = new Vector2( + Body.LinearVelocity.X, + Math.Min(Body.LinearVelocity.Y, ConvertUnits.ToSimUnits(Level.Loaded.Size.Y - worldBorders.Y))); + } + } + //------------------------- Vector2 totalForce = CalculateBuoyancy();