(3b3130a00) Added an option to disable mouselook, let camera zoom further when controlling a large monster
This commit is contained in:
@@ -8,11 +8,14 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public static bool FollowSub = true;
|
public static bool FollowSub = true;
|
||||||
|
|
||||||
private float defaultZoom = 1.3f;
|
private float? defaultZoom;
|
||||||
public float DefaultZoom
|
public float DefaultZoom
|
||||||
{
|
{
|
||||||
get { return defaultZoom; }
|
get { return defaultZoom ?? (GameMain.Config == null || GameMain.Config.EnableMouseLook ? 1.3f : 1.0f); }
|
||||||
set { defaultZoom = MathHelper.Clamp(value, 0.5f, 2.0f); }
|
set
|
||||||
|
{
|
||||||
|
defaultZoom = MathHelper.Clamp(value, 0.5f, 2.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float zoomSmoothness = 8.0f;
|
private float zoomSmoothness = 8.0f;
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ namespace Barotrauma
|
|||||||
keys[i].SetState();
|
keys[i].SetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float targetOffsetAmount = 0.0f;
|
||||||
if (moveCam)
|
if (moveCam)
|
||||||
{
|
{
|
||||||
if (needsAir &&
|
if (needsAir &&
|
||||||
@@ -180,12 +181,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (IsHumanoid)
|
if (IsHumanoid)
|
||||||
{
|
{
|
||||||
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, 250.0f, deltaTime);
|
cam.OffsetAmount = 250.0f;// MathHelper.Lerp(cam.OffsetAmount, 250.0f, deltaTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//increased visibility range when controlling large a non-humanoid
|
//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);
|
Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition);
|
||||||
if (GUI.PauseMenuOpen)
|
if (GUI.PauseMenuOpen)
|
||||||
{
|
{
|
||||||
|
targetOffsetAmount = 0.0f;
|
||||||
cam.OffsetAmount = 0.0f;
|
cam.OffsetAmount = 0.0f;
|
||||||
}
|
}
|
||||||
else if (SelectedConstruction != null && ViewTarget == null &&
|
else if (SelectedConstruction != null && ViewTarget == null &&
|
||||||
SelectedConstruction.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this)))
|
SelectedConstruction.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this)))
|
||||||
{
|
{
|
||||||
|
targetOffsetAmount = 0.0f;
|
||||||
cam.OffsetAmount = 0.0f;
|
cam.OffsetAmount = 0.0f;
|
||||||
cursorPosition =
|
cursorPosition =
|
||||||
SelectedConstruction.Position +
|
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
|
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)
|
else if (Lights.LightManager.ViewTarget == this && Vector2.DistanceSquared(AnimController.Limbs[0].SimPosition, mouseSimPos) > 1.0f)
|
||||||
{
|
{
|
||||||
if (GUI.PauseMenuOpen || IsUnconscious)
|
if (GUI.PauseMenuOpen || IsUnconscious)
|
||||||
{
|
{
|
||||||
if (deltaTime > 0.0f) cam.OffsetAmount = 0.0f;
|
if (deltaTime > 0.0f)
|
||||||
|
{
|
||||||
|
targetOffsetAmount = 0.0f;
|
||||||
|
cam.OffsetAmount = 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Body body = Submarine.CheckVisibility(AnimController.Limbs[0].SimPosition, mouseSimPos);
|
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;
|
float sightDist = Submarine.LastPickedFraction;
|
||||||
if (body?.UserData is Structure && !((Structure)body.UserData).CastShadow)
|
if (body?.UserData is Structure && !((Structure)body.UserData).CastShadow)
|
||||||
{
|
{
|
||||||
sightDist = 1.0f;
|
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 (SelectedConstruction != null && SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null && HUD.CloseHUD(ic.GuiFrame.Rect)))
|
||||||
{
|
{
|
||||||
if (GameMain.Client != null)
|
if (GameMain.Client != null)
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ namespace Barotrauma
|
|||||||
muteOnFocusLostBox.OnSelected = (tickBox) =>
|
muteOnFocusLostBox.OnSelected = (tickBox) =>
|
||||||
{
|
{
|
||||||
MuteOnFocusLost = tickBox.Selected;
|
MuteOnFocusLost = tickBox.Selected;
|
||||||
|
UnsavedSettings = true;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -593,7 +593,39 @@ namespace Barotrauma
|
|||||||
|
|
||||||
/// Controls tab -------------------------------------------------------------
|
/// Controls tab -------------------------------------------------------------
|
||||||
var controlsLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), tabs[(int)Tab.Controls].RectTransform, Anchor.Center))
|
var controlsLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), tabs[(int)Tab.Controls].RectTransform, Anchor.Center))
|
||||||
{ RelativeSpacing = 0.01f };
|
{ RelativeSpacing = 0.03f, Stretch = true };
|
||||||
|
|
||||||
|
GUITextBlock aimAssistText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform), TextManager.Get("AimAssist"))
|
||||||
|
{
|
||||||
|
ToolTip = TextManager.Get("AimAssistToolTip")
|
||||||
|
};
|
||||||
|
GUIScrollBar aimAssistSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform),
|
||||||
|
barSize: 0.05f)
|
||||||
|
{
|
||||||
|
UserData = aimAssistText,
|
||||||
|
BarScroll = MathUtils.InverseLerp(0.0f, 5.0f, AimAssistAmount),
|
||||||
|
ToolTip = TextManager.Get("AimAssistToolTip"),
|
||||||
|
OnMoved = (scrollBar, scroll) =>
|
||||||
|
{
|
||||||
|
ChangeSliderText(scrollBar, scroll);
|
||||||
|
AimAssistAmount = MathHelper.Lerp(0.0f, 5.0f, scroll);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
Step = 0.1f
|
||||||
|
};
|
||||||
|
aimAssistSlider.OnMoved(aimAssistSlider, aimAssistSlider.BarScroll);
|
||||||
|
|
||||||
|
new GUITickBox(new RectTransform(new Vector2(0.5f, 0.05f), controlsLayoutGroup.RectTransform), TextManager.Get("EnableMouseLook"))
|
||||||
|
{
|
||||||
|
ToolTip = TextManager.Get("EnableMouseLookToolTip"),
|
||||||
|
Selected = EnableMouseLook,
|
||||||
|
OnSelected = (tickBox) =>
|
||||||
|
{
|
||||||
|
EnableMouseLook = tickBox.Selected;
|
||||||
|
UnsavedSettings = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var inputFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.8f), controlsLayoutGroup.RectTransform))
|
var inputFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.8f), controlsLayoutGroup.RectTransform))
|
||||||
{ Stretch = true };
|
{ Stretch = true };
|
||||||
@@ -631,6 +663,9 @@ namespace Barotrauma
|
|||||||
//spacing
|
//spacing
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
||||||
|
|
||||||
|
//spacing
|
||||||
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft),
|
new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft),
|
||||||
TextManager.Get("Cancel"), style: "GUIButtonLarge")
|
TextManager.Get("Cancel"), style: "GUIButtonLarge")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ namespace Barotrauma
|
|||||||
set { aimAssistAmount = MathHelper.Clamp(value, 0.0f, 5.0f); }
|
set { aimAssistAmount = MathHelper.Clamp(value, 0.0f, 5.0f); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool EnableMouseLook { get; set; } = true;
|
||||||
|
|
||||||
private bool unsavedSettings;
|
private bool unsavedSettings;
|
||||||
public bool UnsavedSettings
|
public bool UnsavedSettings
|
||||||
{
|
{
|
||||||
@@ -737,6 +739,7 @@ namespace Barotrauma
|
|||||||
EnableSplashScreen = doc.Root.GetAttributeBool("enablesplashscreen", EnableSplashScreen);
|
EnableSplashScreen = doc.Root.GetAttributeBool("enablesplashscreen", EnableSplashScreen);
|
||||||
|
|
||||||
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
|
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
|
||||||
|
EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook);
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
@@ -920,7 +923,8 @@ namespace Barotrauma
|
|||||||
new XAttribute("quickstartsub", QuickStartSubmarineName),
|
new XAttribute("quickstartsub", QuickStartSubmarineName),
|
||||||
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
||||||
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
|
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
|
||||||
new XAttribute("aimassistamount", aimAssistAmount));
|
new XAttribute("aimassistamount", aimAssistAmount),
|
||||||
|
new XAttribute("enablemouselook", EnableMouseLook));
|
||||||
|
|
||||||
if (!ShowUserStatisticsPrompt)
|
if (!ShowUserStatisticsPrompt)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private float blinkTimer;
|
private float blinkTimer;
|
||||||
|
|
||||||
|
private bool itemLoaded;
|
||||||
|
|
||||||
|
private float blinkTimer;
|
||||||
|
|
||||||
public PhysicsBody ParentBody;
|
public PhysicsBody ParentBody;
|
||||||
|
|
||||||
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
||||||
|
|||||||
Reference in New Issue
Block a user