Skip to content

Commit

Permalink
v5.1.3: the upper border of the level is one continuous body instead …
Browse files Browse the repository at this point in the history
…of two separate bodies at the entrance and exit
  • Loading branch information
Regalis committed Sep 7, 2016
1 parent e61e405 commit d884f23
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Subsurface/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.1.2")]
[assembly: AssemblyFileVersion("0.5.1.2")]
[assembly: AssemblyVersion("0.5.1.3")]
[assembly: AssemblyFileVersion("0.5.1.3")]
24 changes: 10 additions & 14 deletions Subsurface/Source/Map/Levels/Level.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public float Difficulty
private set;
}

public Body[] ShaftBodies
public Body ShaftBody
{
get;
private set;
Expand Down Expand Up @@ -511,21 +511,17 @@ public void Generate(bool mirror=false)
cells.AddRange(wrappingWalls[side, i].Cells);
}
}

ShaftBody = BodyFactory.CreateEdge(GameMain.World,
ConvertUnits.ToSimUnits(new Vector2(borders.X, 0)),
ConvertUnits.ToSimUnits(new Vector2(borders.Right, 0)));

ShaftBody.SetTransform(ConvertUnits.ToSimUnits(new Vector2(0.0f, borders.Height)), 0.0f);

ShaftBody.BodyType = BodyType.Static;
ShaftBody.CollisionCategories = Physics.CollisionLevel;

ShaftBodies = new Body[2];
for (int i = 0; i < 2; i++)
{
ShaftBodies[i] = BodyFactory.CreateRectangle(GameMain.World, 200.0f, ConvertUnits.ToSimUnits(ShaftHeight), 5.0f);
ShaftBodies[i].BodyType = BodyType.Static;
ShaftBodies[i].CollisionCategories = Physics.CollisionLevel;

Vector2 shaftPos = (i == 0) ? startPosition : endPosition;
shaftPos.Y = borders.Height + 150.0f;

ShaftBodies[i].SetTransform(ConvertUnits.ToSimUnits(shaftPos), 0.0f);
bodies.Add(ShaftBodies[i]);
}
bodies.Add(ShaftBody);

foreach (VoronoiCell cell in cells)
{
Expand Down
15 changes: 4 additions & 11 deletions Subsurface/Source/Map/Levels/LevelRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,32 +172,25 @@ public void Draw(SpriteBatch spriteBatch)
}
}

//RuinGeneration.RuinGenerator.Draw(spriteBatch);
}


Vector2 pos = new Vector2(0.0f, -level.Size.Y);// level.EndPosition;
Vector2 pos = new Vector2(0.0f, -level.Size.Y);

if (GameMain.GameScreen.Cam.WorldView.Y < -pos.Y - 1024) return;

pos.X = GameMain.GameScreen.Cam.WorldView.X -1024;

int width = (int)(Math.Ceiling(GameMain.GameScreen.Cam.WorldView.Width / 1024 + 4.0f) * 1024);

GUI.DrawRectangle(spriteBatch,new Rectangle((int)(MathUtils.Round(pos.X, 1024)), (int)-GameMain.GameScreen.Cam.WorldView.Y, width, (int)(GameMain.GameScreen.Cam.WorldView.Y - level.Size.Y) + 30),Color.Black, true);
GUI.DrawRectangle(spriteBatch,new Rectangle((int)(MathUtils.Round(pos.X, 1024)), (int)-GameMain.GameScreen.Cam.WorldView.Y, width, (int)(GameMain.GameScreen.Cam.WorldView.Y + pos.Y) - 30),Color.Black, true);
spriteBatch.Draw(shaftTexture,
new Rectangle((int)(MathUtils.Round(pos.X, 1024)), (int)pos.Y, width, 1024),
new Rectangle(0, 0, width, 1024),
new Rectangle((int)(MathUtils.Round(pos.X, 1024)), (int)pos.Y-1000, width, 1024),
new Rectangle(0, 0, width, -1024),
level.BackgroundColor, 0.0f,
Vector2.Zero,
SpriteEffects.None, 0.0f);



//background.DrawTiled(spriteBatch,
// (backgroundPos.Y < 0) ? new Vector2(0.0f, -backgroundPos.Y) : Vector2.Zero,
// new Vector2(GameMain.GraphicsWidth, 1024 - backgroundPos.Y),
// Vector2.Zero, level.BackgroundColor);
}


Expand Down
5 changes: 2 additions & 3 deletions Subsurface/Source/Map/TransitionCinematic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ private IEnumerable<object> UpdateTransitionCinematic(List<Submarine> subs, Came
//Vector2 diff = targetPos - sub.Position;
float targetSpeed = 10.0f;

Level.Loaded.ShaftBodies[0].Enabled = false;
Level.Loaded.ShaftBodies[1].Enabled = false;
Level.Loaded.ShaftBody.Enabled = false;

cam.TargetPos = Vector2.Zero;
float timer = 0.0f;
Expand All @@ -79,7 +78,7 @@ private IEnumerable<object> UpdateTransitionCinematic(List<Submarine> subs, Came
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.UnscaledDeltaTime * 0.1f);

Vector2 cameraPos = subs.First().Position + Submarine.MainSub.HiddenSubPosition;
cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBodies[0].Position.Y) - cam.WorldView.Height/2.0f);
cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBody.Position.Y) - cam.WorldView.Height/2.0f);

GUI.ScreenOverlayColor = Color.Lerp(Color.TransparentBlack, Color.Black, timer/duration);

Expand Down
8 changes: 4 additions & 4 deletions Subsurface/Source/Networking/RespawnManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private void UpdateReturning(float deltaTime)
{
updateReturnTimer = 0.0f;

respawnShuttle.SubBody.Body.IgnoreCollisionWith(Level.Loaded.ShaftBodies[0]);
respawnShuttle.SubBody.Body.IgnoreCollisionWith(Level.Loaded.ShaftBody);

shuttleSteering.AutoPilot = true;
shuttleSteering.MaintainPos = false;
Expand Down Expand Up @@ -302,7 +302,7 @@ private void DispatchShuttle()

private IEnumerable<object> ForceShuttleToPos(Vector2 position, float speed)
{
respawnShuttle.SubBody.Body.IgnoreCollisionWith(Level.Loaded.ShaftBodies[0]);
respawnShuttle.SubBody.Body.IgnoreCollisionWith(Level.Loaded.ShaftBody);

while (Math.Abs(position.Y - respawnShuttle.WorldPosition.Y) > 100.0f)
{
Expand All @@ -313,7 +313,7 @@ private IEnumerable<object> ForceShuttleToPos(Vector2 position, float speed)
if (respawnShuttle.SubBody == null) yield return CoroutineStatus.Success;
}

respawnShuttle.SubBody.Body.RestoreCollisionWith(Level.Loaded.ShaftBodies[0]);
respawnShuttle.SubBody.Body.RestoreCollisionWith(Level.Loaded.ShaftBody);

yield return CoroutineStatus.Success;
}
Expand Down Expand Up @@ -378,7 +378,7 @@ private void ResetShuttle()

respawnShuttle.Velocity = Vector2.Zero;

respawnShuttle.SubBody.Body.RestoreCollisionWith(Level.Loaded.ShaftBodies[0]);
respawnShuttle.SubBody.Body.RestoreCollisionWith(Level.Loaded.ShaftBody);

}

Expand Down
12 changes: 12 additions & 0 deletions Subsurface/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
---------------------------------------------------------------------------------------------------------
v0.5.1.3
---------------------------------------------------------------------------------------------------------

- server whitelists
- a new monster
- improved autopilot
- background sprites and creatures can be customized via Content Packages
- Linux clients can connect to Windows servers again (and vice versa)
- fixed the upper boundary of the level occasionally being possible to pass through
- textboxes can't be selected through other UI elements anymore

---------------------------------------------------------------------------------------------------------
v0.5.1.2
---------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit d884f23

Please sign in to comment.