(3b3130a00) Added an option to disable mouselook, let camera zoom further when controlling a large monster

This commit is contained in:
Joonas Rikkonen
2019-04-03 16:23:23 +03:00
parent d66a49bb7c
commit 98cf26178f
5 changed files with 71 additions and 11 deletions
@@ -165,6 +165,7 @@ namespace Barotrauma
keys[i].SetState();
}
float targetOffsetAmount = 0.0f;
if (moveCam)
{
if (needsAir &&
@@ -180,12 +181,12 @@ namespace Barotrauma
if (IsHumanoid)
{
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, 250.0f, deltaTime);
cam.OffsetAmount = 250.0f;// MathHelper.Lerp(cam.OffsetAmount, 250.0f, deltaTime);
}
else
{
//increased visibility range when controlling large a non-humanoid
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, MathHelper.Clamp(Mass, 250.0f, 800.0f), deltaTime);
cam.OffsetAmount = MathHelper.Clamp(Mass, 250.0f, 1500.0f);
}
}
@@ -198,36 +199,49 @@ namespace Barotrauma
Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition);
if (GUI.PauseMenuOpen)
{
targetOffsetAmount = 0.0f;
cam.OffsetAmount = 0.0f;
}
else if (SelectedConstruction != null && ViewTarget == null &&
SelectedConstruction.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this)))
{
targetOffsetAmount = 0.0f;
cam.OffsetAmount = 0.0f;
cursorPosition =
SelectedConstruction.Position +
new Vector2(cursorPosition.X % 10.0f, cursorPosition.Y % 10.0f); //apply a little bit of movement to the cursor pos to prevent AFK kicking
}
else if (!GameMain.Config.EnableMouseLook)
{
targetOffsetAmount = 0.0f;
cam.OffsetAmount = 0.0f;
}
else if (Lights.LightManager.ViewTarget == this && Vector2.DistanceSquared(AnimController.Limbs[0].SimPosition, mouseSimPos) > 1.0f)
{
if (GUI.PauseMenuOpen || IsUnconscious)
{
if (deltaTime > 0.0f) cam.OffsetAmount = 0.0f;
if (deltaTime > 0.0f)
{
targetOffsetAmount = 0.0f;
cam.OffsetAmount = 0.0f;
}
}
else
{
Body body = Submarine.CheckVisibility(AnimController.Limbs[0].SimPosition, mouseSimPos);
Structure structure = body == null ? null : body.UserData as Structure;
Structure structure = body?.UserData as Structure;
float sightDist = Submarine.LastPickedFraction;
if (body?.UserData is Structure && !((Structure)body.UserData).CastShadow)
{
sightDist = 1.0f;
}
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, Math.Max(250.0f, sightDist * 500.0f), 0.05f);
targetOffsetAmount = Math.Max(250.0f, sightDist * 500.0f);
}
}
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, targetOffsetAmount, 0.05f);
if (SelectedConstruction != null && SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null && HUD.CloseHUD(ic.GuiFrame.Rect)))
{
if (GameMain.Client != null)