diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index 0c13edef5..20f9cf499 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -314,6 +314,13 @@ Designer PreserveNewest + + PreserveNewest + + + Designer + PreserveNewest + PreserveNewest @@ -881,6 +888,15 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Subsurface/Content/Characters/Endworm/endworm.png b/Subsurface/Content/Characters/Endworm/endworm.png new file mode 100644 index 000000000..759135da6 Binary files /dev/null and b/Subsurface/Content/Characters/Endworm/endworm.png differ diff --git a/Subsurface/Content/Characters/Endworm/endworm.xml b/Subsurface/Content/Characters/Endworm/endworm.xml new file mode 100644 index 000000000..cad1443fa --- /dev/null +++ b/Subsurface/Content/Characters/Endworm/endworm.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +s + + + + + diff --git a/Subsurface/Content/Characters/Endworm/endwormattack1.ogg b/Subsurface/Content/Characters/Endworm/endwormattack1.ogg new file mode 100644 index 000000000..317844df9 Binary files /dev/null and b/Subsurface/Content/Characters/Endworm/endwormattack1.ogg differ diff --git a/Subsurface/Content/Characters/Endworm/endwormattack2.ogg b/Subsurface/Content/Characters/Endworm/endwormattack2.ogg new file mode 100644 index 000000000..3ca5def8d Binary files /dev/null and b/Subsurface/Content/Characters/Endworm/endwormattack2.ogg differ diff --git a/Subsurface/Content/Characters/Endworm/endwormidle.ogg b/Subsurface/Content/Characters/Endworm/endwormidle.ogg new file mode 100644 index 000000000..26fb8b15b Binary files /dev/null and b/Subsurface/Content/Characters/Endworm/endwormidle.ogg differ diff --git a/Subsurface/Source/Camera.cs b/Subsurface/Source/Camera.cs index c17ff9d94..2102d9cad 100644 --- a/Subsurface/Source/Camera.cs +++ b/Subsurface/Source/Camera.cs @@ -117,7 +117,11 @@ namespace Barotrauma public Vector2 TargetPos { get { return targetPos; } - set { targetPos = value; } + set { + targetPos = value; + System.Diagnostics.Debug.WriteLine(value); + + } } // Auxiliary function to move the camera diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs index ef24f98d1..431692602 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs @@ -29,6 +29,7 @@ namespace Barotrauma protected override void Act(float deltaTime) { + if (character.AnimController.CurrentHull == null) return; currenthullSafety = OverrideCurrentHullSafety == null ? GetHullSafety(character.AnimController.CurrentHull) : (float)OverrideCurrentHullSafety; @@ -36,7 +37,6 @@ namespace Barotrauma if (character.AnimController.CurrentHull == null || currenthullSafety > MinSafety) { character.AIController.SteeringManager.SteeringSeek(character.AnimController.CurrentHull.SimPosition); - character.AIController.SelectTarget(null); goToObjective = null; diff --git a/Subsurface/Source/Characters/AICharacter.cs b/Subsurface/Source/Characters/AICharacter.cs index 6f500ffbb..8eb8acad8 100644 --- a/Subsurface/Source/Characters/AICharacter.cs +++ b/Subsurface/Source/Characters/AICharacter.cs @@ -42,7 +42,7 @@ namespace Barotrauma public AICharacter(string file, Vector2 position, CharacterInfo characterInfo = null, bool isNetworkPlayer = false) : base(file, position, characterInfo, isNetworkPlayer) { - soundInterval = Rand.Range(0.0f, soundInterval); + soundTimer = Rand.Range(0.0f, soundInterval); } public void SetAI(AIController aiController) diff --git a/Subsurface/Source/Characters/Animation/Ragdoll.cs b/Subsurface/Source/Characters/Animation/Ragdoll.cs index 513b08e6a..0ef960ab9 100644 --- a/Subsurface/Source/Characters/Animation/Ragdoll.cs +++ b/Subsurface/Source/Characters/Animation/Ragdoll.cs @@ -196,6 +196,8 @@ namespace Barotrauma this.character = character; dir = Direction.Right; + + float scale = ToolBox.GetAttributeFloat(element, "scale", 1.0f); //int limbAmount = ; Limbs = new Limb[element.Elements("limb").Count()]; @@ -217,7 +219,7 @@ namespace Barotrauma case "limb": byte ID = Convert.ToByte(subElement.Attribute("id").Value); - Limb limb = new Limb(character, subElement); + Limb limb = new Limb(character, subElement, scale); limb.body.FarseerBody.OnCollision += OnLimbCollision; @@ -229,10 +231,10 @@ namespace Barotrauma Byte limb1ID = Convert.ToByte(subElement.Attribute("limb1").Value); Byte limb2ID = Convert.ToByte(subElement.Attribute("limb2").Value); - Vector2 limb1Pos = ToolBox.GetAttributeVector2(subElement, "limb1anchor", Vector2.Zero); + Vector2 limb1Pos = ToolBox.GetAttributeVector2(subElement, "limb1anchor", Vector2.Zero) * scale; limb1Pos = ConvertUnits.ToSimUnits(limb1Pos); - Vector2 limb2Pos = ToolBox.GetAttributeVector2(subElement, "limb2anchor", Vector2.Zero); + Vector2 limb2Pos = ToolBox.GetAttributeVector2(subElement, "limb2anchor", Vector2.Zero) * scale; limb2Pos = ConvertUnits.ToSimUnits(limb2Pos); RevoluteJoint joint = new RevoluteJoint(Limbs[limb1ID].body.FarseerBody, Limbs[limb2ID].body.FarseerBody, limb1Pos, limb2Pos); @@ -296,6 +298,8 @@ namespace Barotrauma public bool OnLimbCollision(Fixture f1, Fixture f2, Contact contact) { Structure structure = f2.Body.UserData as Structure; + + if (f2.Body.UserData as SubmarineBody != null) return true; //always collides with bodies other than structures if (structure == null) diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 6563a8ad3..2191914d0 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -869,8 +869,16 @@ namespace Barotrauma Submarine = AnimController.CurrentHull == null ? null : Submarine.Loaded; obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f); - - AnimController.SimplePhysicsEnabled = (Character.controlled != this && Vector2.Distance(cam.WorldViewCenter, WorldPosition) > 5000.0f); + + float dist = Vector2.Distance(cam.WorldViewCenter, WorldPosition); + if (dist > 8000.0f) + { + AnimController.SimplePhysicsEnabled = true; + } + else if (dist < 7000.0f) + { + AnimController.SimplePhysicsEnabled = false; + } if (isDead) return; diff --git a/Subsurface/Source/Characters/Limb.cs b/Subsurface/Source/Characters/Limb.cs index 15ae58311..974531362 100644 --- a/Subsurface/Source/Characters/Limb.cs +++ b/Subsurface/Source/Characters/Limb.cs @@ -149,6 +149,8 @@ namespace Barotrauma set { burnt = MathHelper.Clamp(value,0.0f,100.0f); } } + private float scale; + //public float Damage //{ // get { return damage; } @@ -182,7 +184,7 @@ namespace Barotrauma set { wearingItemSprite = value; } } - public Limb (Character character, XElement element) + public Limb (Character character, XElement element, float scale = 1.0f) { this.character = character; @@ -190,7 +192,9 @@ namespace Barotrauma doesFlip = ToolBox.GetAttributeBool(element, "flip", false); - body = new PhysicsBody(element); + this.scale = scale; + + body = new PhysicsBody(element, scale); if (ToolBox.GetAttributeBool(element, "ignorecollisions", false)) { @@ -225,10 +229,10 @@ namespace Barotrauma } - Vector2 jointPos = ToolBox.GetAttributeVector2(element, "pullpos", Vector2.Zero); + Vector2 jointPos = ToolBox.GetAttributeVector2(element, "pullpos", Vector2.Zero) * scale; jointPos = ConvertUnits.ToSimUnits(jointPos); - stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.Zero); + stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.Zero) * scale; stepOffset = ConvertUnits.ToSimUnits(stepOffset); refJointIndex = ToolBox.GetAttributeInt(element, "refjoint", -1); @@ -455,7 +459,7 @@ namespace Barotrauma if (wearingItem == null || !wearingItemSprite.HideLimb) { - body.Draw(spriteBatch, sprite, color); + body.Draw(spriteBatch, sprite, color, null, scale); } else { @@ -484,7 +488,7 @@ namespace Barotrauma new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), color, origin, -body.DrawRotation, - 1.0f, spriteEffect, depth); + scale, spriteEffect, depth); } if (damage>0.0f && damagedSprite!=null) diff --git a/Subsurface/Source/Physics/PhysicsBody.cs b/Subsurface/Source/Physics/PhysicsBody.cs index ccb60628d..f73ee51fe 100644 --- a/Subsurface/Source/Physics/PhysicsBody.cs +++ b/Subsurface/Source/Physics/PhysicsBody.cs @@ -178,8 +178,8 @@ namespace Barotrauma set { body.CollidesWith = value; } } - public PhysicsBody(XElement element) - : this(element, Vector2.Zero) + public PhysicsBody(XElement element, float scale = 1.0f) + : this(element, Vector2.Zero, scale) { } @@ -194,11 +194,11 @@ namespace Barotrauma list.Add(this); } - public PhysicsBody(XElement element, Vector2 position) + public PhysicsBody(XElement element, Vector2 position, float scale=1.0f) { - float radius = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "radius", 0.0f)); - float height = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "height", 0.0f)); - float width = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "width", 0.0f)); + float radius = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "radius", 0.0f)) * scale; + float height = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "height", 0.0f)) * scale; + float width = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "width", 0.0f)) * scale; density = ToolBox.GetAttributeFloat(element, "density", 10.0f); @@ -307,7 +307,7 @@ namespace Barotrauma drawRotation = Physics.Interpolate(prevRotation, body.Rotation); } - public void Draw(SpriteBatch spriteBatch, Sprite sprite, Color color, float? depth = null) + public void Draw(SpriteBatch spriteBatch, Sprite sprite, Color color, float? depth = null, float scale = 1.0f) { if (!body.Enabled) return; @@ -320,7 +320,7 @@ namespace Barotrauma color = Color.Blue; } - sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), color, -drawRotation, 1.0f, spriteEffect, depth); + sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), color, -drawRotation, scale, spriteEffect, depth); } diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index e285d77aa..c1b7e4855 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -74,7 +74,7 @@ namespace Barotrauma if (PlayerInput.KeyDown(Keys.J)) targetMovement.X -= 1.0f; if (PlayerInput.KeyDown(Keys.L)) targetMovement.X += 1.0f; - GameMain.GameSession.Submarine.ApplyForce(targetMovement * 1000000.0f); + GameMain.GameSession.Submarine.ApplyForce(targetMovement * 100000.0f); } #endif @@ -134,10 +134,10 @@ namespace Barotrauma public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { - if (Character.Controlled != null) - { - cam.TargetPos = Character.Controlled.WorldPosition; - } + //if (Character.Controlled != null) + //{ + // cam.TargetPos = Character.Controlled.WorldPosition; + //} cam.UpdateTransform(); diff --git a/Subsurface/Source/Sounds/SoundPlayer.cs b/Subsurface/Source/Sounds/SoundPlayer.cs index 05d088ac5..d29b38138 100644 --- a/Subsurface/Source/Sounds/SoundPlayer.cs +++ b/Subsurface/Source/Sounds/SoundPlayer.cs @@ -228,7 +228,7 @@ namespace Barotrauma } List suitableMusic = null; - if (Submarine.Loaded!=null && Submarine.Loaded.Position.Y<0.0f) + if (Submarine.Loaded!=null && Submarine.Loaded.Position.Y x != null && x.type == "deep").ToList(); } diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index f44bde1cb..3ef76c980 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ