Merge remote-tracking branch 'barotrauma/master' into new-netcode

# Conflicts:
#	Subsurface/Properties/AssemblyInfo.cs
#	Subsurface/Source/Characters/AI/EnemyAIController.cs
#	Subsurface/Source/Characters/AICharacter.cs
#	Subsurface/Source/Characters/Character.cs
#	Subsurface/Source/Items/Components/Signal/Connection.cs
#	Subsurface/Source/Items/Item.cs
#	Subsurface/Source/Map/Structure.cs
#	Subsurface/Source/Networking/GameClient.cs
#	Subsurface/Source/Networking/GameServer.cs
#	Subsurface/Source/Screens/NetLobbyScreen.cs
This commit is contained in:
juanjp600
2016-11-05 18:18:20 -03:00
57 changed files with 454 additions and 362 deletions

View File

@@ -28,12 +28,16 @@ namespace Barotrauma
public WallSection(Rectangle rect)
{
System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0);
this.rect = rect;
damage = 0.0f;
}
public WallSection(Rectangle rect, float damage)
{
System.Diagnostics.Debug.Assert(rect.Width > 0 && rect.Height > 0);
this.rect = rect;
this.damage = 0.0f;
}
@@ -182,7 +186,7 @@ namespace Barotrauma
{
base.Move(amount);
for (int i = 0; i < sections.Count(); i++)
for (int i = 0; i < sections.Length; i++)
{
Rectangle r = sections[i].rect;
r.X += (int)amount.X;
@@ -209,6 +213,7 @@ namespace Barotrauma
: base(sp, submarine)
{
if (rectangle.Width == 0 || rectangle.Height == 0) return;
System.Diagnostics.Debug.Assert(rectangle.Width > 0 && rectangle.Height > 0);
rect = rectangle;
prefab = sp;
@@ -290,32 +295,39 @@ namespace Barotrauma
private void CreateSections()
{
int xsections = 1, ysections = 1;
int width, height;
int width = rect.Width, height = rect.Height;
if (!HasBody)
{
sections = new WallSection[1];
sections[0] = new WallSection(rect);
return;
}
{
if (flippedX && isHorizontal)
{
xsections = (int)Math.Ceiling((float)rect.Width / prefab.sprite.SourceRect.Width);
width = prefab.sprite.SourceRect.Width;
if (isHorizontal)
{
xsections = (int)Math.Ceiling((float)rect.Width / wallSectionSize);
}
else
{
xsections = 1;
ysections = 1;
}
sections = new WallSection[xsections];
width = (int)wallSectionSize;
height = rect.Height;
}
else
{
ysections = (int)Math.Ceiling((float)rect.Height / wallSectionSize);
sections = new WallSection[ysections];
width = rect.Width;
height = (int)wallSectionSize;
if (isHorizontal)
{
xsections = (int)Math.Ceiling((float)rect.Width / wallSectionSize);
sections = new WallSection[xsections];
width = (int)wallSectionSize;
}
else
{
ysections = (int)Math.Ceiling((float)rect.Height / wallSectionSize);
sections = new WallSection[ysections];
height = (int)wallSectionSize;
}
}
for (int x = 0; x < xsections; x++)
{
for (int y = 0; y < ysections; y++)
@@ -885,7 +897,7 @@ namespace Barotrauma
(int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," +
rect.Width + "," + rect.Height));
for (int i = 0; i < sections.Count(); i++)
for (int i = 0; i < sections.Length; i++)
{
if (sections[i].damage == 0.0f) continue;