Fixed camera being placed at {-2147483647, -2147483647} when starting a round, fixed debugdraw crashing the game, moving spectator camera along with the closest sub in Submarine.ForceTranslate
This commit is contained in:
@@ -110,6 +110,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
viewMatrix =
|
viewMatrix =
|
||||||
Matrix.CreateTranslation(new Vector3(GameMain.GraphicsWidth / 2.0f, GameMain.GraphicsHeight / 2.0f, 0));
|
Matrix.CreateTranslation(new Vector3(GameMain.GraphicsWidth / 2.0f, GameMain.GraphicsHeight / 2.0f, 0));
|
||||||
|
|
||||||
|
UpdateTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 TargetPos
|
public Vector2 TargetPos
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ namespace Barotrauma
|
|||||||
GUI.DrawRectangle(spriteBatch,
|
GUI.DrawRectangle(spriteBatch,
|
||||||
new Vector2(drawRect.X, -drawRect.Y),
|
new Vector2(drawRect.X, -drawRect.Y),
|
||||||
new Vector2(rect.Width, rect.Height),
|
new Vector2(rect.Width, rect.Height),
|
||||||
Color.Blue,false,0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f));
|
Color.Blue,false,0, (int)Math.Max((1.5f / Screen.Selected.Cam.Zoom), 1.0f));
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch,
|
GUI.DrawRectangle(spriteBatch,
|
||||||
new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height),
|
new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height),
|
||||||
|
|||||||
@@ -268,16 +268,22 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Body.SetTransform(Body.Position + ConvertUnits.ToSimUnits(amount), 0.0f);
|
Body.SetTransform(Body.Position + ConvertUnits.ToSimUnits(amount), 0.0f);
|
||||||
|
|
||||||
if (Character.Controlled != null)
|
bool isClosestSub = false;
|
||||||
|
if (Character.Controlled == null)
|
||||||
{
|
{
|
||||||
Character.Controlled.CursorPosition += amount;
|
isClosestSub = Submarine.GetClosest(GameMain.GameScreen.Cam.WorldViewCenter) == submarine;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isClosestSub = Character.Controlled.Submarine == submarine;
|
||||||
|
|
||||||
if (Character.Controlled.Submarine == submarine ||
|
Character.Controlled.CursorPosition += amount;
|
||||||
(Character.Controlled == null && Submarine.GetClosest(GameMain.GameScreen.Cam.WorldViewCenter) == submarine))
|
}
|
||||||
{
|
|
||||||
GameMain.GameScreen.Cam.Position += amount;
|
if (isClosestSub)
|
||||||
if (GameMain.GameScreen.Cam.TargetPos != Vector2.Zero) GameMain.GameScreen.Cam.TargetPos += amount;
|
{
|
||||||
}
|
GameMain.GameScreen.Cam.Position += amount;
|
||||||
|
if (GameMain.GameScreen.Cam.TargetPos != Vector2.Zero) GameMain.GameScreen.Cam.TargetPos += amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public BackgroundCreatureManager BackgroundCreatureManager;
|
public BackgroundCreatureManager BackgroundCreatureManager;
|
||||||
|
|
||||||
public Camera Cam
|
public override Camera Cam
|
||||||
{
|
{
|
||||||
get { return cam; }
|
get { return cam; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user