diff --git a/Subsurface/Properties/AssemblyInfo.cs b/Subsurface/Properties/AssemblyInfo.cs index 09223bc74..2040cb113 100644 --- a/Subsurface/Properties/AssemblyInfo.cs +++ b/Subsurface/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.2.5.0")] -[assembly: AssemblyFileVersion("0.2.5.0")] +[assembly: AssemblyVersion("0.2.6.0")] +[assembly: AssemblyFileVersion("0.2.6.0")] diff --git a/Subsurface/Source/Characters/AI/EnemyAIController.cs b/Subsurface/Source/Characters/AI/EnemyAIController.cs index 87ec7a3b8..c692e491e 100644 --- a/Subsurface/Source/Characters/AI/EnemyAIController.cs +++ b/Subsurface/Source/Characters/AI/EnemyAIController.cs @@ -283,7 +283,6 @@ namespace Barotrauma case AttackType.PinchCCW: float dir = (limb.attack.Type == AttackType.PinchCW) ? 1.0f : -1.0f; - float dist = Vector2.Distance(limb.SimPosition, attackPosition); if (wallAttackPos != Vector2.Zero && targetEntity != null) { @@ -302,6 +301,7 @@ namespace Barotrauma break; } + float dist = Vector2.Distance(limb.SimPosition, damageTarget.SimPosition); if (dist < limb.attack.Range * 0.5f) { attackTimer += deltaTime; diff --git a/Subsurface/Source/ContentPackage.cs b/Subsurface/Source/ContentPackage.cs index d923e6a9c..b46003f20 100644 --- a/Subsurface/Source/ContentPackage.cs +++ b/Subsurface/Source/ContentPackage.cs @@ -143,10 +143,21 @@ namespace Barotrauma var md5 = MD5.Create(); foreach (ContentFile file in files) { - using (var stream = File.OpenRead(file.path)) + if (file.type == ContentType.Executable) continue; + + try { - hashes.Add(md5.ComputeHash(stream)); - } + using (var stream = File.OpenRead(file.path)) + { + hashes.Add(md5.ComputeHash(stream)); + } + } + + catch (Exception e) + { + DebugConsole.ThrowError("Error while calculating content package hash: ", e); + } + } //string str = sb.ToString(); @@ -157,7 +168,7 @@ namespace Barotrauma } //System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length); - md5Hash = new Md5Hash(bytes); + md5Hash = new Md5Hash(bytes); } public List GetFilesOfType(ContentType type) diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs index d5f9d2be1..ab3363973 100644 --- a/Subsurface/Source/DebugConsole.cs +++ b/Subsurface/Source/DebugConsole.cs @@ -80,6 +80,10 @@ namespace Barotrauma if (isOpen) { + + frame.Update(deltaTime); + + Character.DisableControls = true; if (PlayerInput.KeyHit(Keys.Up)) @@ -91,7 +95,7 @@ namespace Barotrauma SelectMessage(1); } - textBox.Update(deltaTime); + //textBox.Update(deltaTime); if (PlayerInput.GetKeyboardState.IsKeyDown(Keys.Enter) && textBox.Text != "") { @@ -122,8 +126,6 @@ namespace Barotrauma { if (!isOpen) return; - frame.Update(1.0f / 60.0f); - int margin = 5; //GUI.DrawRectangle(spriteBatch, diff --git a/Subsurface/Source/GUI/GUITextBlock.cs b/Subsurface/Source/GUI/GUITextBlock.cs index c43a43202..cff620746 100644 --- a/Subsurface/Source/GUI/GUITextBlock.cs +++ b/Subsurface/Source/GUI/GUITextBlock.cs @@ -205,7 +205,7 @@ namespace Barotrauma private Vector2 MeasureText(string text) { - if (string.IsNullOrEmpty(text) || Font==null) return Vector2.Zero; + if (Font==null) return Vector2.Zero; Vector2 size = Vector2.Zero; while (size == Vector2.Zero) diff --git a/Subsurface/Source/GUI/GUITextBox.cs b/Subsurface/Source/GUI/GUITextBox.cs index 427faf303..735e84a1c 100644 --- a/Subsurface/Source/GUI/GUITextBox.cs +++ b/Subsurface/Source/GUI/GUITextBox.cs @@ -196,9 +196,15 @@ namespace Barotrauma { string input = Text; Text = ""; - OnEnterPressed(this, input); - + OnEnterPressed(this, input); } +#if LINUX + else if (PlayerInput.KeyHit(Keys.Back) && Text.Length>0) + { + Text = Text.Substring(0, Text.Length-1); + } +#endif + } textBlock.Update(deltaTime); diff --git a/Subsurface/Source/Items/Components/Machines/Steering.cs b/Subsurface/Source/Items/Components/Machines/Steering.cs index 5462694bf..d938a96b9 100644 --- a/Subsurface/Source/Items/Components/Machines/Steering.cs +++ b/Subsurface/Source/Items/Components/Machines/Steering.cs @@ -21,7 +21,7 @@ namespace Barotrauma.Items.Components private SteeringPath steeringPath; - private static PathFinder pathFinder; + private PathFinder pathFinder; private float networkUpdateTimer; private bool valueChanged; diff --git a/Subsurface/Source/Map/Lights/LightManager.cs b/Subsurface/Source/Map/Lights/LightManager.cs index 3dc367e43..d24be6d67 100644 --- a/Subsurface/Source/Map/Lights/LightManager.cs +++ b/Subsurface/Source/Map/Lights/LightManager.cs @@ -199,6 +199,11 @@ namespace Barotrauma.Lights spriteBatch.Draw(lightMap, Vector2.Zero, Color.White); spriteBatch.End(); } + + public void ClearLights() + { + lights.Clear(); + } } diff --git a/Subsurface/Source/Map/Submarine.cs b/Subsurface/Source/Map/Submarine.cs index 5b09cdaa8..a05debddb 100644 --- a/Subsurface/Source/Map/Submarine.cs +++ b/Subsurface/Source/Map/Submarine.cs @@ -12,6 +12,7 @@ using System.IO; using System.Linq; using System.Reflection; using System.Xml.Linq; +using Barotrauma.Lights; namespace Barotrauma { @@ -666,6 +667,8 @@ namespace Barotrauma if (loaded == null) return; Sound.OnGameEnd(); + + if (GameMain.LightManager != null) GameMain.LightManager.ClearLights(); loaded.Remove(); diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index 89da7d9ce..380c79b5e 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -248,10 +248,17 @@ namespace Barotrauma spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), new Color(0.75f, 0.8f, 0.9f, 1.0f)); spriteBatch.End(); +#if LINUX spriteBatch.Begin(SpriteSortMode.Deferred, - BlendState.AlphaBlend, - null, DepthStencilState.Default, null, null, + BlendState.NonPremultiplied, + null, DepthStencilState.DepthRead, null, null, cam.Transform); +#else + spriteBatch.Begin(SpriteSortMode.Deferred, + BlendState.AlphaBlend, + null, DepthStencilState.DepthRead, null, null, + cam.Transform); +#endif GameMain.ParticleManager.Draw(spriteBatch, true, Particles.ParticleBlendState.AlphaBlend); spriteBatch.End(); @@ -270,11 +277,18 @@ namespace Barotrauma BlendState.Opaque); spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White); spriteBatch.End(); - +#if LINUX + spriteBatch.Begin(SpriteSortMode.Deferred, + BlendState.NonPremultiplied, + null, DepthStencilState.DepthRead, null, null, + cam.Transform); +#else spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform); +#endif + GameMain.ParticleManager.Draw(spriteBatch, false, Particles.ParticleBlendState.AlphaBlend); spriteBatch.End(); diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs index 45109e74a..897da2c8d 100644 --- a/Subsurface/Source/Screens/MainMenuScreen.cs +++ b/Subsurface/Source/Screens/MainMenuScreen.cs @@ -297,8 +297,16 @@ namespace Barotrauma GameMain.NetLobbyScreen = new NetLobbyScreen(); - GameMain.NetworkMember = new GameServer(name, port, isPublicBox.Selected, passwordBox.Text, useUpnpBox.Selected, int.Parse(maxPlayersBox.Text)); - + try + { + GameMain.NetworkMember = new GameServer(name, port, isPublicBox.Selected, passwordBox.Text, useUpnpBox.Selected, int.Parse(maxPlayersBox.Text)); + } + + catch (Exception e) + { + DebugConsole.ThrowError("Failed to start server", e); + } + GameMain.NetLobbyScreen.IsServer = true; //Game1.NetLobbyScreen.Select(); return true; diff --git a/Subsurface/Source/Screens/ServerListScreen.cs b/Subsurface/Source/Screens/ServerListScreen.cs index 904219bc4..16b7b5543 100644 --- a/Subsurface/Source/Screens/ServerListScreen.cs +++ b/Subsurface/Source/Screens/ServerListScreen.cs @@ -254,7 +254,21 @@ namespace Barotrauma if (response.StatusCode!= System.Net.HttpStatusCode.OK) { serverList.ClearChildren(); - DebugConsole.ThrowError("Error while connecting to master server (" +response.StatusCode+": "+response.StatusDescription+")"); + + switch (response.StatusCode) + { + case System.Net.HttpStatusCode.NotFound: + DebugConsole.ThrowError("Error while connecting to master server (404 - ''" + NetConfig.MasterServerUrl + "'' not found)"); + break; + case System.Net.HttpStatusCode.ServiceUnavailable: + DebugConsole.ThrowError("Error while connecting to master server (505 - Service Unavailable)"); + DebugConsole.ThrowError("The master server may be down for maintenance or temporarily overloaded. Please try again after in a few moments."); + break; + default: + DebugConsole.ThrowError("Error while connecting to master server (" +response.StatusCode+": "+response.StatusDescription+")"); + break; + } + return; } @@ -304,8 +318,17 @@ namespace Barotrauma selectedPassword = passwordBox.Text; } - GameMain.NetworkMember = new GameClient(clientNameBox.Text); - GameMain.Client.ConnectToServer(ip, selectedPassword); + try + { + GameMain.NetworkMember = new GameClient(clientNameBox.Text); + GameMain.Client.ConnectToServer(ip, selectedPassword); + } + + catch (Exception e) + { + DebugConsole.ThrowError("Failed to start the client", e); + } + yield return CoroutineStatus.Success; } diff --git a/Subsurface/changelog.txt b/Subsurface/changelog.txt index c4863a76f..2883ca794 100644 --- a/Subsurface/changelog.txt +++ b/Subsurface/changelog.txt @@ -1,3 +1,9 @@ +--------------------------------------------------------------------------------------------------------- +v0.2.6.1 +--------------------------------------------------------------------------------------------------------- + +- fixed a bug that caused characters to take bleeding damage for no apparent reason +- fixed autopilot not working when changing the map seed --------------------------------------------------------------------------------------------------------- v0.2.6 diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 620b8c7b6..4e4f6b017 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ