Merge remote-tracking branch 'refs/remotes/barotrauma/master'

Conflicts:
	Subsurface/Properties/AssemblyInfo.cs
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/GUI/GUI.cs
	Subsurface/Source/GameMain.cs
	Subsurface/Source/GameSettings.cs
	Subsurface/Source/Items/CharacterInventory.cs
	Subsurface/Source/Items/Components/ItemComponent.cs
	Subsurface/Source/Items/Components/Machines/Pump.cs
	Subsurface/Source/Items/Components/Machines/Radar.cs
	Subsurface/Source/Items/Components/Machines/Steering.cs
	Subsurface/Source/Items/Components/Power/PowerContainer.cs
	Subsurface/Source/Items/Inventory.cs
	Subsurface/Source/Items/Item.cs
	Subsurface/Source/Items/ItemSpawner.cs
	Subsurface/Source/Map/Levels/WaterRenderer.cs
	Subsurface/Source/Map/LinkedSubmarine.cs
	Subsurface/Source/Map/Map/Map.cs
	Subsurface/Source/Map/Structure.cs
	Subsurface/Source/Map/Submarine.cs
	Subsurface/Source/Map/WayPoint.cs
	Subsurface/Source/Networking/GameClient.cs
	Subsurface/Source/Networking/GameServer.cs
	Subsurface/Source/Physics/PhysicsBody.cs
	Subsurface/Source/Screens/GameScreen.cs
This commit is contained in:
juanjp600
2016-10-11 20:19:25 -03:00
130 changed files with 4428 additions and 67178 deletions
@@ -341,7 +341,7 @@ namespace Barotrauma
{
wallAttackPos = Vector2.Zero;
limb.AttackTimer = 0.0f;
if (Vector2.Distance(limb.SimPosition, attackPosition)<5.0) coolDownTimer = attackCoolDown;
coolDownTimer = attackCoolDown;
}
}
@@ -180,8 +180,8 @@ namespace Barotrauma
{
if (selectedAiTarget != null)
{
GUI.DrawLine(spriteBatch,
new Vector2(Character.WorldPosition.X, -Character.WorldPosition.Y),
GUI.DrawLine(spriteBatch,
new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),
new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red);
}
@@ -189,16 +189,16 @@ namespace Barotrauma
if (pathSteering == null || pathSteering.CurrentPath == null || pathSteering.CurrentPath.CurrentNode==null) return;
GUI.DrawLine(spriteBatch,
new Vector2(Character.WorldPosition.X, -Character.WorldPosition.Y),
new Vector2(pathSteering.CurrentPath.CurrentNode.WorldPosition.X, -pathSteering.CurrentPath.CurrentNode.WorldPosition.Y),
new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),
new Vector2(pathSteering.CurrentPath.CurrentNode.DrawPosition.X, -pathSteering.CurrentPath.CurrentNode.DrawPosition.Y),
Color.LightGreen);
for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++)
{
GUI.DrawLine(spriteBatch,
new Vector2(pathSteering.CurrentPath.Nodes[i].WorldPosition.X, -pathSteering.CurrentPath.Nodes[i].WorldPosition.Y),
new Vector2(pathSteering.CurrentPath.Nodes[i - 1].WorldPosition.X, -pathSteering.CurrentPath.Nodes[i-1].WorldPosition.Y),
new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y),
new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y),
Color.LightGreen);
}
}
+2 -2
View File
@@ -64,9 +64,9 @@ namespace Barotrauma
aiController.Update(deltaTime);
}
public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch,Camera cam)
{
base.DrawFront(spriteBatch);
base.DrawFront(spriteBatch,cam);
if (GameMain.DebugDraw && !isDead) aiController.DebugDraw(spriteBatch);
}
@@ -426,7 +426,11 @@ namespace Barotrauma
float volume = stairs == null ? impact / 5.0f : impact;
volume = Math.Min(impact, 1.0f);
if (impact > 0.8f && l.HitSound != null && l.soundTimer <= 0.0f) l.HitSound.Play(volume, impact * 100.0f, l.WorldPosition);
if (impact > 0.5f && l.HitSound != null && l.soundTimer <= 0.0f)
{
l.soundTimer = Limb.SoundInterval;
l.HitSound.Play(volume, impact * 250.0f, l.WorldPosition);
}
if (impact > l.impactTolerance)
{
@@ -464,7 +468,7 @@ namespace Barotrauma
if (limb.pullJoint != null)
{
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA);
if (currentHull != null) pos += currentHull.Submarine.Position;
if (currentHull != null) pos += currentHull.Submarine.DrawPosition;
pos.Y = -pos.Y;
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f);
@@ -492,7 +496,7 @@ namespace Barotrauma
if (limb.body.TargetPosition != Vector2.Zero)
{
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.body.TargetPosition);
if (currentHull != null) pos += currentHull.Submarine.Position;
if (currentHull != null) pos += currentHull.Submarine.DrawPosition;
pos.Y = -pos.Y;
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X - 10, (int)pos.Y - 10, 20, 20), Color.Cyan, false, 0.01f);
+49 -14
View File
@@ -72,6 +72,9 @@ namespace Barotrauma
}
}
public Hull PreviousHull = null;
public Hull CurrentHull = null;
public readonly bool IsNetworkPlayer;
private bool networkUpdateSent;
@@ -92,7 +95,9 @@ namespace Barotrauma
private Item selectedConstruction;
private Item[] selectedItems;
public byte TeamID = 0;
public AnimController AnimController;
private Vector2 cursorPosition;
@@ -833,19 +838,39 @@ namespace Barotrauma
attackPos,
AnimController.Limbs.Select(l => l.body.FarseerBody).ToList(),
Physics.CollisionCharacter | Physics.CollisionWall);
IDamageable attackTarget = null;
if (body != null)
{
if (body.UserData is IDamageable)
{
attackTarget = (IDamageable)body.UserData;
}
else if (body.UserData is Limb)
{
attackTarget = ((Limb)body.UserData).character;
}
attackPos = Submarine.LastPickedPosition;
if (body != null && body.UserData is Submarine)
{
var sub = ((Submarine)body.UserData);
body = Submarine.PickBody(
attackLimb.SimPosition - ((Submarine)body.UserData).SimPosition,
attackPos - ((Submarine)body.UserData).SimPosition,
AnimController.Limbs.Select(l => l.body.FarseerBody).ToList(),
Physics.CollisionWall);
if (body != null)
{
attackPos = Submarine.LastPickedPosition + sub.SimPosition;
attackTarget = body.UserData as IDamageable;
}
}
else
{
if (body.UserData is IDamageable)
{
attackTarget = (IDamageable)body.UserData;
}
else if (body.UserData is Limb)
{
attackTarget = ((Limb)body.UserData).character;
}
}
}
attackLimb.UpdateAttack(deltaTime, attackPos, attackTarget);
@@ -1195,6 +1220,10 @@ namespace Barotrauma
{
if (!Enabled) return;
PreviousHull = CurrentHull;
CurrentHull = Hull.FindHull(WorldPosition, CurrentHull, true);
//if (PreviousHull != CurrentHull && Character.Controlled == this) Hull.DetectItemVisibility(this); //WIP item culling
speechBubbleTimer = Math.Max(0.0f, speechBubbleTimer - deltaTime);
obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f);
@@ -1406,7 +1435,7 @@ namespace Barotrauma
CharacterHUD.Draw(spriteBatch, this, cam);
}
public virtual void DrawFront(SpriteBatch spriteBatch)
public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam)
{
if (!Enabled) return;
@@ -1424,9 +1453,15 @@ namespace Barotrauma
if (info != null)
{
Vector2 namePos = new Vector2(pos.X, pos.Y - 120.0f) - GUI.Font.MeasureString(Info.Name) * 0.5f;
spriteBatch.DrawString(GUI.Font, Info.Name, namePos - new Vector2(1.0f, 1.0f), Color.Black);
spriteBatch.DrawString(GUI.Font, Info.Name, namePos, Color.White);
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f/cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;
Color nameColor = Color.White;
if (Character.Controlled != null && TeamID!=Character.Controlled.TeamID)
{
nameColor = Color.Red;
}
spriteBatch.DrawString(GUI.Font, Info.Name, namePos + new Vector2(1.0f/cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f,Vector2.Zero, 1.0f / cam.Zoom,SpriteEffects.None,0.001f);
spriteBatch.DrawString(GUI.Font, Info.Name, namePos, nameColor, 0.0f, Vector2.Zero, 1.0f/cam.Zoom, SpriteEffects.None, 0.0f);
if (GameMain.DebugDraw)
{
+4 -3
View File
@@ -462,14 +462,14 @@ namespace Barotrauma
Vector2 normal = new Vector2(-line.Y, line.X);
normal = Vector2.Normalize(-normal);
float dragDot = Vector2.Dot(normal, velDir);
float dragDot = Math.Abs(Vector2.Dot(normal, velDir));
Vector2 dragForce = Vector2.Zero;
if (dragDot > 0)
{
float vel = LinearVelocity.Length()*2.0f;
float drag = dragDot * vel * vel
* ConvertUnits.ToSimUnits(sprite.size.Y);
dragForce = drag * -velDir;
dragForce = Math.Min(drag, Mass*1000.0f) * -velDir;
//if (dragForce.Length() > 100.0f) { }
}
@@ -499,7 +499,8 @@ namespace Barotrauma
float dist = ConvertUnits.ToDisplayUnits(Vector2.Distance(SimPosition, attackPosition));
AttackTimer += deltaTime;
body.ApplyTorque(Mass * character.AnimController.Dir * attack.Torque);
body.ApplyTorque(Mass * character.AnimController.Dir * attack.Torque);
if (dist < attack.Range * 0.5f)
{