Merge remote-tracking branch 'barotrauma/master' into new-netcode
# Conflicts: # Subsurface/Source/Characters/Character.cs # Subsurface/Source/Items/Components/Machines/Steering.cs # Subsurface/Source/Map/Structure.cs # Subsurface/Source/Networking/GameClient.cs # Subsurface/Source/Networking/GameServer.cs
This commit is contained in:
@@ -126,21 +126,32 @@ namespace Barotrauma
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
BlendState.Additive,
|
||||
SamplerState.LinearWrap, DepthStencilState.Default, null, null,
|
||||
cam.Transform);
|
||||
|
||||
for (int i = 1; i < 2; i++)
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
Vector2 offset = new Vector2(cam.WorldView.X, cam.WorldView.Y);
|
||||
float scale = 1.0f - i * 0.2f;
|
||||
|
||||
dustParticles.SourceRect = new Rectangle((int)(offset.X), (int)(-offset.Y), (int)(1024), (int)(1024));
|
||||
//alpha goes from 1.0 to 0.0 when scale is in the range of 0.2-0.1
|
||||
float alpha = (cam.Zoom * scale) < 0.2f ? (cam.Zoom * scale - 0.1f) * 10.0f : 1.0f;
|
||||
if (alpha <= 0.0f) continue;
|
||||
|
||||
Vector2 offset = (new Vector2(cam.WorldViewCenter.X, cam.WorldViewCenter.Y) + dustOffset) * scale;
|
||||
Vector3 origin = new Vector3(cam.WorldView.Width, cam.WorldView.Height, 0.0f) * 0.5f;
|
||||
|
||||
dustParticles.DrawTiled(spriteBatch, new Vector2(cam.WorldView.X, -cam.WorldView.Y),
|
||||
new Vector2(cam.WorldView.Width, cam.WorldView.Height),
|
||||
Vector2.Zero, Color.White);
|
||||
dustParticles.SourceRect = new Rectangle(
|
||||
(int)((offset.X - origin.X + (i * 256)) / scale),
|
||||
(int)((-offset.Y - origin.Y + (i * 256)) / scale),
|
||||
(int)((cam.WorldView.Width) / scale),
|
||||
(int)((cam.WorldView.Height) / scale));
|
||||
|
||||
spriteBatch.Draw(dustParticles.Texture,
|
||||
new Vector2(cam.WorldViewCenter.X, -cam.WorldViewCenter.Y),
|
||||
dustParticles.SourceRect, Color.White * alpha, 0.0f,
|
||||
new Vector2(cam.WorldView.Width, cam.WorldView.Height) * 0.5f / scale, scale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
@@ -437,11 +437,11 @@ namespace Barotrauma
|
||||
WayPoint[] stairPoints = new WayPoint[2];
|
||||
|
||||
stairPoints[0] = new WayPoint(
|
||||
new Vector2(stairs.Rect.X - 75.0f,
|
||||
new Vector2(stairs.Rect.X - 32.0f,
|
||||
stairs.Rect.Y - (stairs.StairDirection == Direction.Left ? 80 : stairs.Rect.Height) + heightFromFloor), SpawnType.Path, submarine);
|
||||
|
||||
stairPoints[1] = new WayPoint(
|
||||
new Vector2(stairs.Rect.Right + 75.0f,
|
||||
new Vector2(stairs.Rect.Right + 32.0f,
|
||||
stairs.Rect.Y - (stairs.StairDirection == Direction.Left ? stairs.Rect.Height : 80) + heightFromFloor), SpawnType.Path, submarine);
|
||||
|
||||
for (int i = 0; i < 2; i++ )
|
||||
@@ -536,11 +536,11 @@ namespace Barotrauma
|
||||
|
||||
//ladderPoints[0].ConnectTo(ladderPoints[1]);
|
||||
}
|
||||
|
||||
|
||||
foreach (Gap gap in Gap.GapList)
|
||||
{
|
||||
if (!gap.isHorizontal) continue;
|
||||
|
||||
|
||||
//too small to walk through
|
||||
if (gap.Rect.Height < 150.0f) continue;
|
||||
|
||||
@@ -550,9 +550,15 @@ namespace Barotrauma
|
||||
for (int dir = -1; dir <= 1; dir += 2)
|
||||
{
|
||||
float tolerance = gap.IsRoomToRoom ? 50.0f : outSideWaypointInterval / 2.0f;
|
||||
WayPoint closest = wayPoint.FindClosest(dir, true, new Vector2(-tolerance, tolerance));
|
||||
if (closest == null) continue;
|
||||
wayPoint.ConnectTo(closest);
|
||||
|
||||
WayPoint closest = wayPoint.FindClosest(
|
||||
dir, true, new Vector2(-tolerance, tolerance),
|
||||
gap.ConnectedDoor == null ? null : gap.ConnectedDoor.Body.FarseerBody);
|
||||
|
||||
if (closest != null)
|
||||
{
|
||||
wayPoint.ConnectTo(closest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,7 +588,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private WayPoint FindClosest(int dir, bool horizontalSearch, Vector2 tolerance)
|
||||
private WayPoint FindClosest(int dir, bool horizontalSearch, Vector2 tolerance, Body ignoredBody = null)
|
||||
{
|
||||
if (dir != -1 && dir != 1) return null;
|
||||
|
||||
@@ -614,9 +620,9 @@ namespace Barotrauma
|
||||
if (closest == null || dist < closestDist)
|
||||
{
|
||||
var body = Submarine.CheckVisibility(SimPosition, wp.SimPosition, true);
|
||||
if (body != null)
|
||||
if (body != null && body != ignoredBody && !(body.UserData is Submarine))
|
||||
{
|
||||
if (body.UserData is Structure) continue;
|
||||
if (body.UserData is Structure || body.FixtureList[0].CollisionCategories.HasFlag(Physics.CollisionWall)) continue;
|
||||
}
|
||||
|
||||
closestDist = dist;
|
||||
|
||||
Reference in New Issue
Block a user