Camera twitching fixes (again), using character name for ingame chatmessages instead of NetworkMember name, disabled CrewCommander in multiplayer, hide healthbar when dead
This commit is contained in:
@@ -150,7 +150,7 @@ namespace Barotrauma
|
||||
|
||||
Sound.CameraPos = new Vector3(WorldViewCenter.X, WorldViewCenter.Y, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
public void MoveCamera(float deltaTime)
|
||||
{
|
||||
prevPosition = position;
|
||||
|
||||
@@ -274,8 +274,8 @@ namespace Barotrauma
|
||||
{
|
||||
|
||||
joint.BodyB.SetTransform(
|
||||
joint.BodyA.Position+joint.LocalAnchorA-joint.LocalAnchorB,
|
||||
(joint.LowerLimit+joint.UpperLimit)/2.0f);
|
||||
joint.BodyA.Position + (joint.LocalAnchorA - joint.LocalAnchorB)*0.1f,
|
||||
(joint.LowerLimit + joint.UpperLimit) / 2.0f);
|
||||
}
|
||||
|
||||
float startDepth = 0.1f;
|
||||
|
||||
@@ -995,6 +995,8 @@ namespace Barotrauma
|
||||
AnimController.DebugDraw(spriteBatch);
|
||||
}
|
||||
|
||||
if (isDead) return;
|
||||
|
||||
Vector2 healthBarPos = new Vector2(DrawPosition.X - 50, -DrawPosition.Y - 100.0f);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
|
||||
|
||||
@@ -120,7 +120,8 @@ namespace Barotrauma
|
||||
|
||||
if (PlayerInput.KeyHit(Microsoft.Xna.Framework.Input.Keys.C))
|
||||
{
|
||||
commander.ToggleGUIFrame();
|
||||
//only allow opening the command UI if there are AICharacters in the crew
|
||||
if (commander.IsOpen || characters.Any(c => c is AICharacter)) commander.ToggleGUIFrame();
|
||||
}
|
||||
|
||||
if (commander.Frame != null) commander.Frame.Update(deltaTime);
|
||||
|
||||
@@ -215,12 +215,13 @@ namespace Barotrauma
|
||||
//Vector2 targetSimPos = ConvertUnits.ToSimUnits((Vector2)targetPosition);
|
||||
|
||||
float dist = Vector2.Distance((Vector2)targetPosition, Position);
|
||||
System.Diagnostics.Debug.WriteLine(targetPosition + " -> " + Position + " - " + dist);
|
||||
if (dist > 1000.0f)
|
||||
{
|
||||
body.SetTransform(ConvertUnits.ToSimUnits((Vector2)targetPosition), 0.0f);
|
||||
Vector2 moveAmount = ConvertUnits.ToSimUnits((Vector2)targetPosition) - body.Position;
|
||||
|
||||
GameMain.GameScreen.Cam.Position = submarine.Position + Submarine.HiddenSubPosition;
|
||||
body.SetTransform(body.Position + moveAmount, 0.0f);
|
||||
|
||||
GameMain.GameScreen.Cam.Position += ConvertUnits.ToDisplayUnits(moveAmount);
|
||||
targetPosition = null;
|
||||
}
|
||||
else if (dist > 50.0f)
|
||||
@@ -228,11 +229,9 @@ namespace Barotrauma
|
||||
Vector2 moveAmount = Vector2.Normalize((Vector2)targetPosition - Position);
|
||||
moveAmount *= ConvertUnits.ToSimUnits(Math.Min(dist, 100.0f));
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("moveamount: "+moveAmount);
|
||||
|
||||
body.SetTransform(body.Position + moveAmount * deltaTime, 0.0f);
|
||||
|
||||
//GameMain.GameScreen.Cam.Position += ConvertUnits.ToDisplayUnits(moveAmount);
|
||||
GameMain.GameScreen.Cam.Position += ConvertUnits.ToDisplayUnits(moveAmount * deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -168,7 +168,9 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(message)) return false;
|
||||
|
||||
SendChatMessage(GameMain.NetworkMember.Name + ": " + message);
|
||||
string senderName = gameStarted && characterInfo != null ? characterInfo.Name : name;
|
||||
|
||||
SendChatMessage(senderName + ": " + message);
|
||||
|
||||
textBox.Deselect();
|
||||
|
||||
|
||||
@@ -134,12 +134,13 @@ namespace Barotrauma
|
||||
//Physics.accumulator = Physics.step;
|
||||
while (Physics.accumulator >= Physics.step)
|
||||
{
|
||||
cam.MoveCamera((float)Physics.step);
|
||||
if (Character.Controlled != null && Lights.LightManager.ViewTarget != null)
|
||||
{
|
||||
cam.TargetPos = Lights.LightManager.ViewTarget.WorldPosition;
|
||||
//Lights.LightManager.ViewPos = Character.Controlled.WorldPosition;
|
||||
}
|
||||
cam.MoveCamera((float)Physics.step);
|
||||
|
||||
|
||||
if (Submarine.Loaded != null) Submarine.Loaded.SetPrevTransform(Submarine.Loaded.Position);
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user