This commit is contained in:
Evil Factory
2022-02-25 14:52:18 -03:00
15 changed files with 62 additions and 24 deletions
@@ -13,7 +13,7 @@ namespace Barotrauma
{ {
private static List<ScalableFont> FontList = new List<ScalableFont>(); private static List<ScalableFont> FontList = new List<ScalableFont>();
private static Library Lib = null; private static Library Lib = null;
private static object mutex = new object(); private readonly object mutex = new object();
private string filename; private string filename;
private Face face; private Face face;
@@ -256,10 +256,33 @@ namespace Barotrauma
} }
private void DynamicRenderAtlas(GraphicsDevice gd, uint character, int texDims = 1024, uint baseChar = 0x54) private void DynamicRenderAtlas(GraphicsDevice gd, uint character, int texDims = 1024, uint baseChar = 0x54)
=> DynamicRenderAtlas(gd, character.ToEnumerable(), texDims, baseChar); {
bool missingCharacterFound = false;
lock (mutex)
{
missingCharacterFound = !texCoords.ContainsKey(character);
}
if (!missingCharacterFound) { return; }
DynamicRenderAtlas(gd, character.ToEnumerable(), texDims, baseChar);
}
private void DynamicRenderAtlas(GraphicsDevice gd, string str, int texDims = 1024, uint baseChar = 0x54) private void DynamicRenderAtlas(GraphicsDevice gd, string str, int texDims = 1024, uint baseChar = 0x54)
=> DynamicRenderAtlas(gd, str.Distinct().Select(c => (uint)c), texDims, baseChar); {
bool missingCharacterFound = false;
var distinctChrs = str.Distinct().Select(c => (uint)c).ToArray();
lock (mutex)
{
foreach (var character in distinctChrs)
{
if (texCoords.ContainsKey(character)) { continue; }
missingCharacterFound = true;
break;
}
}
if (!missingCharacterFound) { return; }
DynamicRenderAtlas(gd, distinctChrs, texDims, baseChar);
}
private void DynamicRenderAtlas(GraphicsDevice gd, IEnumerable<uint> characters, int texDims = 1024, uint baseChar = 0x54) private void DynamicRenderAtlas(GraphicsDevice gd, IEnumerable<uint> characters, int texDims = 1024, uint baseChar = 0x54)
{ {
@@ -1299,7 +1299,7 @@ namespace Barotrauma
private bool CreateOrder(Order order, Hull targetHull = null) private bool CreateOrder(Order order, Hull targetHull = null)
{ {
var sub = Character.Controlled.Submarine; var sub = Character.Controlled?.Submarine;
if (sub == null || sub.TeamID != Character.Controlled.TeamID || sub.Info.IsWreck) { return false; } if (sub == null || sub.TeamID != Character.Controlled.TeamID || sub.Info.IsWreck) { return false; }
@@ -2995,6 +2995,8 @@ namespace Barotrauma.Networking
public void SetupLoadCampaign(string saveName) public void SetupLoadCampaign(string saveName)
{ {
if (clientPeer == null) { return; }
GameMain.NetLobbyScreen.CampaignSetupFrame.Visible = false; GameMain.NetLobbyScreen.CampaignSetupFrame.Visible = false;
GameMain.NetLobbyScreen.CampaignFrame.Visible = false; GameMain.NetLobbyScreen.CampaignFrame.Visible = false;
@@ -1743,6 +1743,7 @@ namespace Barotrauma
public void SetSpectate(bool spectate) public void SetSpectate(bool spectate)
{ {
if (GameMain.Client == null) { return; }
this.spectateBox.Selected = spectate; this.spectateBox.Selected = spectate;
if (spectate) if (spectate)
{ {
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.16.6.1</Version> <Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
+1 -1
View File
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.16.6.1</Version> <Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product> <Product>Barotrauma</Product>
<Version>0.16.6.1</Version> <Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName> <AssemblyName>Barotrauma</AssemblyName>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.16.6.1</Version> <Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
+1 -1
View File
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.16.6.1</Version> <Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace> <RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors> <Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product> <Product>Barotrauma Dedicated Server</Product>
<Version>0.16.6.1</Version> <Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright> <Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName> <AssemblyName>DedicatedServer</AssemblyName>
@@ -1030,7 +1030,7 @@ namespace Barotrauma
const int maxDist = 1000; const int maxDist = 1000;
if (level != null) if (level != null && !level.Removed)
{ {
foreach (var ruin in level.Ruins) foreach (var ruin in level.Ruins)
{ {
@@ -79,17 +79,18 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
bool sendOutput = true; bool state = true;
for (int i = 0; i < timeSinceReceived.Length; i++) for (int i = 0; i < timeSinceReceived.Length; i++)
{ {
if (timeSinceReceived[i] > timeFrame) { sendOutput = false; } if (timeSinceReceived[i] > timeFrame) { state = false; }
timeSinceReceived[i] += deltaTime; timeSinceReceived[i] += deltaTime;
} }
string signalOut = sendOutput ? output : falseOutput; string signalOut = state ? output : falseOutput;
if (string.IsNullOrEmpty(signalOut)) if (string.IsNullOrEmpty(signalOut))
{ {
IsActive = false; //deactivate the component if state is false and there's no false output (will be woken up by non-zero signals in ReceiveSignal)
if (!state) { IsActive = false; }
return; return;
} }
@@ -12,17 +12,18 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
bool sendOutput = false; bool state = false;
for (int i = 0; i < timeSinceReceived.Length; i++) for (int i = 0; i < timeSinceReceived.Length; i++)
{ {
if (timeSinceReceived[i] <= timeFrame) { sendOutput = true; } if (timeSinceReceived[i] <= timeFrame) { state = true; }
timeSinceReceived[i] += deltaTime; timeSinceReceived[i] += deltaTime;
} }
string signalOut = sendOutput ? output : falseOutput; string signalOut = state ? output : falseOutput;
if (string.IsNullOrEmpty(signalOut)) if (string.IsNullOrEmpty(signalOut))
{ {
IsActive = false; //deactivate the component if state is false and there's no false output (will be woken up by non-zero signals in ReceiveSignal)
if (!state) { IsActive = false; }
return; return;
} }
@@ -12,17 +12,19 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
int sendOutput = 0; int receivedInputs = 0;
for (int i = 0; i < timeSinceReceived.Length; i++) for (int i = 0; i < timeSinceReceived.Length; i++)
{ {
if (timeSinceReceived[i] <= timeFrame) { sendOutput += 1; } if (timeSinceReceived[i] <= timeFrame) { receivedInputs += 1; }
timeSinceReceived[i] += deltaTime; timeSinceReceived[i] += deltaTime;
} }
string signalOut = sendOutput == 1 ? output : falseOutput; bool state = receivedInputs == 1;
string signalOut = state ? output : falseOutput;
if (string.IsNullOrEmpty(signalOut)) if (string.IsNullOrEmpty(signalOut))
{ {
IsActive = false; //deactivate the component if state is false and there's no false output (will be woken up by non-zero signals in ReceiveSignal)
if (!state) { IsActive = false; }
return; return;
} }
@@ -1,3 +1,11 @@
---------------------------------------------------------------------------------------------------------
v0.16.7.0
---------------------------------------------------------------------------------------------------------
- Fixed excessive loading times when playing in Chinese, Japanese or Korean.
- Fixed certain logic components (and/or/xor with an empty output and non-empty false output) stopping to work altogether when they stop sending a signal.
- Fixes to crashes when trying to interact with certain elements in the server lobby while getting disconnected.
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.16.6.1 v0.16.6.1
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------