END WORM, fixed camera pos "twitching" when exiting/entering the sub, character scaling

This commit is contained in:
Regalis
2015-12-19 02:05:10 +02:00
parent eb0e08c8ee
commit 4234aa2094
16 changed files with 144 additions and 28 deletions
+16
View File
@@ -314,6 +314,13 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Characters\Endworm\endworm.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Characters\Endworm\endworm.xml">
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Characters\Human\damagedhead.png"> <Content Include="Content\Characters\Human\damagedhead.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@@ -881,6 +888,15 @@
<None Include="Content\Characters\Crawler\idle2.ogg"> <None Include="Content\Characters\Crawler\idle2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Characters\Endworm\endwormattack1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Endworm\endwormattack2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Endworm\endwormidle.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Moloch\attack1.ogg"> <None Include="Content\Characters\Moloch\attack1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 KiB

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8" ?>
<Character name ="endworm" humanoid="false" health="10000.0">
<sound file="Content/Characters/Endworm/endwormidle.ogg" state="None" range="8000" />
<sound file="Content/Characters/Endworm/endwormattack1.ogg" state="Attack" range="8000" />
<sound file="Content/Characters/Endworm/endwormattack2.ogg" state="Attack" range="8000" />
<ragdoll waveamplitude="100.0" wavelength="1000" speed="1.5" scale ="2.0">
<!-- head -->
<limb id = "0" width="600" height="450" type="Head" steerforce="3.0">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,478,720,546" depth="0.05"/>
</limb>
<!-- body -->
<limb id = "1" width="600" height="400" type="Torso">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.01" origin="0.5,0.5"/>
</limb>
<!-- body -->
<limb id = "2" width="600" height="400" type="Torso">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.02" origin="0.5,0.5"/>
</limb>
<limb id = "3" width="600" height="400" type="Torso">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.03" origin="0.5,0.5"/>
</limb>
<limb id = "4" width="600" height="400" type="Tail">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.04" origin="0.5,0.5"/>
</limb>
<limb id = "5" width="600" height="400" type="Tail">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.05" origin="0.5,0.5"/>
</limb>
<limb id = "6" width="600" height="400" type="Tail">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.06" origin="0.5,0.5"/>
</limb>
<limb id = "7" width="300" height="400" type="Tail">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="704,0,320,400" depth="0.07" origin="0.5,0.5"/>
</limb>
<limb id = "8" width="100" height="450">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="755,552,137,470" depth="0.08" origin="0.5,0.5"/>
</limb>
<limb id = "9" width="100" height="450">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="892,552,137,470" depth="0.08" origin="0.6,0.5"/>
</limb>
<!-- head to body -->
<joint limb1="0" limb1anchor="0,-80" limb2="1" limb2anchor="0,170" lowerlimit="-10" upperlimit="10"/>
<joint limb1="1" limb1anchor="0,-160" limb2="2" limb2anchor="0,160" lowerlimit="-30" upperlimit="30"/>
<joint limb1="2" limb1anchor="0,-160" limb2="3" limb2anchor="0,160" lowerlimit="-30" upperlimit="30"/>
<joint limb1="3" limb1anchor="0,-160" limb2="4" limb2anchor="0,160" lowerlimit="-30" upperlimit="30"/>
<joint limb1="4" limb1anchor="0,-160" limb2="5" limb2anchor="0,160" lowerlimit="-30" upperlimit="30"/>
<joint limb1="5" limb1anchor="0,-160" limb2="6" limb2anchor="0,160" lowerlimit="-30" upperlimit="30"/>
<joint limb1="6" limb1anchor="0,-160" limb2="7" limb2anchor="100,0" lowerlimit="80" upperlimit="100"/>
<joint limb1="0" limb1anchor="-160,50" limb2="8" limb2anchor="0,-200" lowerlimit="-20" upperlimit="50"/>
<joint limb1="0" limb1anchor="160,50" limb2="9" limb2anchor="0,-200" lowerlimit="-50" upperlimit="20"/>
s
</ragdoll>
<ai attackhumans="100" attackrooms="50.0" attackweaker="50" attackstronger="-30" sight="0.5" hearing="1.0"/>
</Character>
+5 -1
View File
@@ -117,7 +117,11 @@ namespace Barotrauma
public Vector2 TargetPos public Vector2 TargetPos
{ {
get { return targetPos; } get { return targetPos; }
set { targetPos = value; } set {
targetPos = value;
System.Diagnostics.Debug.WriteLine(value);
}
} }
// Auxiliary function to move the camera // Auxiliary function to move the camera
@@ -29,6 +29,7 @@ namespace Barotrauma
protected override void Act(float deltaTime) protected override void Act(float deltaTime)
{ {
if (character.AnimController.CurrentHull == null) return;
currenthullSafety = OverrideCurrentHullSafety == null ? currenthullSafety = OverrideCurrentHullSafety == null ?
GetHullSafety(character.AnimController.CurrentHull) : (float)OverrideCurrentHullSafety; GetHullSafety(character.AnimController.CurrentHull) : (float)OverrideCurrentHullSafety;
@@ -36,7 +37,6 @@ namespace Barotrauma
if (character.AnimController.CurrentHull == null || currenthullSafety > MinSafety) if (character.AnimController.CurrentHull == null || currenthullSafety > MinSafety)
{ {
character.AIController.SteeringManager.SteeringSeek(character.AnimController.CurrentHull.SimPosition); character.AIController.SteeringManager.SteeringSeek(character.AnimController.CurrentHull.SimPosition);
character.AIController.SelectTarget(null); character.AIController.SelectTarget(null);
goToObjective = null; goToObjective = null;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Barotrauma
public AICharacter(string file, Vector2 position, CharacterInfo characterInfo = null, bool isNetworkPlayer = false) public AICharacter(string file, Vector2 position, CharacterInfo characterInfo = null, bool isNetworkPlayer = false)
: base(file, position, characterInfo, isNetworkPlayer) : base(file, position, characterInfo, isNetworkPlayer)
{ {
soundInterval = Rand.Range(0.0f, soundInterval); soundTimer = Rand.Range(0.0f, soundInterval);
} }
public void SetAI(AIController aiController) public void SetAI(AIController aiController)
@@ -197,6 +197,8 @@ namespace Barotrauma
dir = Direction.Right; dir = Direction.Right;
float scale = ToolBox.GetAttributeFloat(element, "scale", 1.0f);
//int limbAmount = ; //int limbAmount = ;
Limbs = new Limb[element.Elements("limb").Count()]; Limbs = new Limb[element.Elements("limb").Count()];
limbJoints = new RevoluteJoint[element.Elements("joint").Count()]; limbJoints = new RevoluteJoint[element.Elements("joint").Count()];
@@ -217,7 +219,7 @@ namespace Barotrauma
case "limb": case "limb":
byte ID = Convert.ToByte(subElement.Attribute("id").Value); 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; limb.body.FarseerBody.OnCollision += OnLimbCollision;
@@ -229,10 +231,10 @@ namespace Barotrauma
Byte limb1ID = Convert.ToByte(subElement.Attribute("limb1").Value); Byte limb1ID = Convert.ToByte(subElement.Attribute("limb1").Value);
Byte limb2ID = Convert.ToByte(subElement.Attribute("limb2").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); 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); limb2Pos = ConvertUnits.ToSimUnits(limb2Pos);
RevoluteJoint joint = new RevoluteJoint(Limbs[limb1ID].body.FarseerBody, Limbs[limb2ID].body.FarseerBody, limb1Pos, limb2Pos); RevoluteJoint joint = new RevoluteJoint(Limbs[limb1ID].body.FarseerBody, Limbs[limb2ID].body.FarseerBody, limb1Pos, limb2Pos);
@@ -297,6 +299,8 @@ namespace Barotrauma
{ {
Structure structure = f2.Body.UserData as Structure; Structure structure = f2.Body.UserData as Structure;
if (f2.Body.UserData as SubmarineBody != null) return true;
//always collides with bodies other than structures //always collides with bodies other than structures
if (structure == null) if (structure == null)
{ {
+9 -1
View File
@@ -870,7 +870,15 @@ namespace Barotrauma
obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f); 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; if (isDead) return;
+10 -6
View File
@@ -149,6 +149,8 @@ namespace Barotrauma
set { burnt = MathHelper.Clamp(value,0.0f,100.0f); } set { burnt = MathHelper.Clamp(value,0.0f,100.0f); }
} }
private float scale;
//public float Damage //public float Damage
//{ //{
// get { return damage; } // get { return damage; }
@@ -182,7 +184,7 @@ namespace Barotrauma
set { wearingItemSprite = value; } set { wearingItemSprite = value; }
} }
public Limb (Character character, XElement element) public Limb (Character character, XElement element, float scale = 1.0f)
{ {
this.character = character; this.character = character;
@@ -190,7 +192,9 @@ namespace Barotrauma
doesFlip = ToolBox.GetAttributeBool(element, "flip", false); doesFlip = ToolBox.GetAttributeBool(element, "flip", false);
body = new PhysicsBody(element); this.scale = scale;
body = new PhysicsBody(element, scale);
if (ToolBox.GetAttributeBool(element, "ignorecollisions", false)) 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); jointPos = ConvertUnits.ToSimUnits(jointPos);
stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.Zero); stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.Zero) * scale;
stepOffset = ConvertUnits.ToSimUnits(stepOffset); stepOffset = ConvertUnits.ToSimUnits(stepOffset);
refJointIndex = ToolBox.GetAttributeInt(element, "refjoint", -1); refJointIndex = ToolBox.GetAttributeInt(element, "refjoint", -1);
@@ -455,7 +459,7 @@ namespace Barotrauma
if (wearingItem == null || !wearingItemSprite.HideLimb) if (wearingItem == null || !wearingItemSprite.HideLimb)
{ {
body.Draw(spriteBatch, sprite, color); body.Draw(spriteBatch, sprite, color, null, scale);
} }
else else
{ {
@@ -484,7 +488,7 @@ namespace Barotrauma
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
color, origin, color, origin,
-body.DrawRotation, -body.DrawRotation,
1.0f, spriteEffect, depth); scale, spriteEffect, depth);
} }
if (damage>0.0f && damagedSprite!=null) if (damage>0.0f && damagedSprite!=null)
+8 -8
View File
@@ -178,8 +178,8 @@ namespace Barotrauma
set { body.CollidesWith = value; } set { body.CollidesWith = value; }
} }
public PhysicsBody(XElement element) public PhysicsBody(XElement element, float scale = 1.0f)
: this(element, Vector2.Zero) : this(element, Vector2.Zero, scale)
{ {
} }
@@ -194,11 +194,11 @@ namespace Barotrauma
list.Add(this); 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 radius = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "radius", 0.0f)) * scale;
float height = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "height", 0.0f)); float height = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "height", 0.0f)) * scale;
float width = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "width", 0.0f)); float width = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "width", 0.0f)) * scale;
density = ToolBox.GetAttributeFloat(element, "density", 10.0f); density = ToolBox.GetAttributeFloat(element, "density", 10.0f);
@@ -307,7 +307,7 @@ namespace Barotrauma
drawRotation = Physics.Interpolate(prevRotation, body.Rotation); 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; if (!body.Enabled) return;
@@ -320,7 +320,7 @@ namespace Barotrauma
color = Color.Blue; 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);
} }
+5 -5
View File
@@ -74,7 +74,7 @@ namespace Barotrauma
if (PlayerInput.KeyDown(Keys.J)) targetMovement.X -= 1.0f; if (PlayerInput.KeyDown(Keys.J)) targetMovement.X -= 1.0f;
if (PlayerInput.KeyDown(Keys.L)) 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 #endif
@@ -134,10 +134,10 @@ namespace Barotrauma
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
{ {
if (Character.Controlled != null) //if (Character.Controlled != null)
{ //{
cam.TargetPos = Character.Controlled.WorldPosition; // cam.TargetPos = Character.Controlled.WorldPosition;
} //}
cam.UpdateTransform(); cam.UpdateTransform();
+1 -1
View File
@@ -228,7 +228,7 @@ namespace Barotrauma
} }
List<BackgroundMusic> suitableMusic = null; List<BackgroundMusic> suitableMusic = null;
if (Submarine.Loaded!=null && Submarine.Loaded.Position.Y<0.0f) if (Submarine.Loaded!=null && Submarine.Loaded.Position.Y<SubmarineBody.DamageDepth+10000.0f)
{ {
suitableMusic = musicClips.Where(x => x != null && x.type == "deep").ToList(); suitableMusic = musicClips.Where(x => x != null && x.type == "deep").ToList();
} }
Binary file not shown.