Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -120,6 +120,7 @@ namespace Barotrauma
private readonly GameTime fixedTime;
public Option<ConnectCommand> ConnectCommand = Option<ConnectCommand>.None();
private string clientName;
private static SpriteBatch spriteBatch;
@@ -252,6 +253,16 @@ namespace Barotrauma
try
{
ConnectCommand = Barotrauma.Networking.ConnectCommand.Parse(ConsoleArguments);
string clientNameFlagArg = args.FirstOrDefault(arg => arg.StartsWith("-username"));
if (clientNameFlagArg != null)
{
int nextIndex = args.IndexOf(clientNameFlagArg) + 1;
if (nextIndex < args.Length)
{
clientName = args[nextIndex];
}
}
}
catch (IndexOutOfRangeException e)
{
@@ -313,6 +324,8 @@ namespace Barotrauma
GameSettings.SetCurrentConfig(config);
}
int display = GameSettings.CurrentConfig.Graphics.Display;
GraphicsWidth = GameSettings.CurrentConfig.Graphics.Width;
GraphicsHeight = GameSettings.CurrentConfig.Graphics.Height;
@@ -340,7 +353,7 @@ namespace Barotrauma
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color;
GraphicsDeviceManager.PreferMultiSampling = false;
GraphicsDeviceManager.SynchronizeWithVerticalRetrace = GameSettings.CurrentConfig.Graphics.VSync;
SetWindowMode(GameSettings.CurrentConfig.Graphics.DisplayMode);
SetWindowMode(GameSettings.CurrentConfig.Graphics.DisplayMode, display);
defaultViewport = new Viewport(0, 0, GraphicsWidth, GraphicsHeight);
@@ -353,8 +366,17 @@ namespace Barotrauma
ResolutionChanged?.Invoke();
}
public void SetWindowMode(WindowMode windowMode)
public void SetWindowMode(WindowMode windowMode, int display)
{
// We can't move the monitor while the window is fullscreen because of a restriction in SDL2, so as a workaround we switch to windowed mode first
var prevDisplayMode = WindowMode;
if (Window.TargetDisplay != display && prevDisplayMode != WindowMode.Windowed)
{
GraphicsDeviceManager.IsFullScreen = false;
GraphicsDeviceManager.ApplyChanges();
}
Window.TargetDisplay = display;
WindowMode = windowMode;
GraphicsDeviceManager.HardwareModeSwitch = windowMode != WindowMode.BorderlessWindowed;
GraphicsDeviceManager.IsFullScreen = windowMode == WindowMode.Fullscreen || windowMode == WindowMode.BorderlessWindowed;
@@ -723,7 +745,7 @@ namespace Barotrauma
fixedTime.IsRunningSlowly = gameTime.IsRunningSlowly;
TimeSpan addTime = new TimeSpan(0, 0, 0, 0, 16);
fixedTime.ElapsedGameTime = addTime;
fixedTime.TotalGameTime.Add(addTime);
fixedTime.TotalGameTime = fixedTime.TotalGameTime.Add(addTime);
base.Update(fixedTime);
PlayerInput.Update(Timing.Step);
@@ -779,7 +801,7 @@ namespace Barotrauma
{
try
{
SaveUtil.LoadGame(saveFiles.OrderBy(file => file.SaveTime).Last().FilePath);
SaveUtil.LoadGame(CampaignDataPath.CreateRegular(saveFiles.OrderBy(file => file.SaveTime).Last().FilePath));
}
catch (Exception e)
{
@@ -804,19 +826,28 @@ namespace Barotrauma
}
MainMenuScreen.Select();
string clientNameString = clientName ?? MultiplayerPreferences.Instance.PlayerName.FallbackNullOrEmpty(SteamManager.GetUsername());
if (connectCommand.SteamLobbyIdOption.TryUnwrap(out var lobbyId))
{
SteamManager.JoinLobby(lobbyId.Value, joinServer: true);
}
else if (connectCommand.NameAndP2PEndpointsOption.TryUnwrap(out var nameAndEndpoint)
&& nameAndEndpoint is { ServerName: var serverName, Endpoints: var endpoints })
else if ((connectCommand.NameAndP2PEndpointsOption.TryUnwrap(out var nameAndEndpoint) && nameAndEndpoint is { ServerName: var serverName, Endpoints: var endpoints }))
{
Client = new GameClient(MultiplayerPreferences.Instance.PlayerName.FallbackNullOrEmpty(SteamManager.GetUsername()),
Client = new GameClient(clientNameString,
endpoints.Cast<Endpoint>().ToImmutableArray(),
string.IsNullOrWhiteSpace(serverName) ? endpoints.First().StringRepresentation : serverName,
Option<int>.None());
}
else if ((connectCommand.NameAndLidgrenEndpointOption.TryUnwrap(out var nameAndLidgrenEndpoint) && nameAndLidgrenEndpoint is { ServerName: var lidgrenServerName, Endpoint: var endpoint }))
{
Client = new GameClient(
clientNameString,
endpoint,
string.IsNullOrWhiteSpace(lidgrenServerName) ? endpoint.StringRepresentation : lidgrenServerName,
Option<int>.None());
}
ConnectCommand = Option<ConnectCommand>.None();
}
@@ -1145,7 +1176,7 @@ namespace Barotrauma
}
GameSession.Campaign?.End();
SaveUtil.SaveGame(GameSession.SavePath);
SaveUtil.SaveGame(GameSession.DataPath);
}
if (Client != null)
@@ -1162,11 +1193,12 @@ namespace Barotrauma
GameSession.GameMode?.Preset.Identifier.Value ?? "none",
GameSession.RoundDuration);
string eventId = "QuitRound:" + (GameSession.GameMode?.Preset.Identifier.Value ?? "none") + ":";
GameAnalyticsManager.AddDesignEvent(eventId + "EventManager:CurrentIntensity", GameSession.EventManager.CurrentIntensity);
//disabled to reduce the amount of data we collect through GA
/*GameAnalyticsManager.AddDesignEvent(eventId + "EventManager:CurrentIntensity", GameSession.EventManager.CurrentIntensity);
foreach (var activeEvent in GameSession.EventManager.ActiveEvents)
{
GameAnalyticsManager.AddDesignEvent(eventId + "EventManager:ActiveEvents:" + activeEvent.Prefab.Identifier);
}
}*/
GameSession.LogEndRoundStats(eventId);
if (GameSession.GameMode is TutorialMode tutorialMode)
{