(965c31410) v0.10.4.0

This commit is contained in:
Joonas Rikkonen
2020-07-30 13:00:09 +03:00
parent eeac247a8e
commit 4978af3d60
539 changed files with 45803 additions and 25359 deletions
@@ -140,7 +140,6 @@ namespace Barotrauma
split[1] = split[2];
split[2] = string.Empty;
}
split[1] = split[1].Replace("\"", ""); // Replaces quotation marks around data that are added when exporting via excel
xmlContent.Add($"<{split[0]}>{split[1]}</{split[0]}>");
}
else if (split[0].Contains(".") && !split[0].Any(char.IsUpper)) // An empty field
@@ -27,7 +27,7 @@ namespace Barotrauma
basicEffect = new BasicEffect(graphics) { TextureEnabled = true };
GameMain.Instance.OnResolutionChanged += () =>
GameMain.Instance.ResolutionChanged += () =>
{
InitVertexData();
};
@@ -212,6 +212,11 @@ namespace Barotrauma
}
}
if (((width & 0x03) != 0) || ((height & 0x03) != 0))
{
DebugConsole.AddWarning($"Cannot compress a texture because the dimensions are not a multiple of 4 (path: {path ?? "null"}, size: {width}x{height})");
}
Texture2D tex = null;
CrossThread.RequestExecutionOnMainThread(() =>
{
@@ -9,6 +9,52 @@ namespace Barotrauma
{
public static partial class ToolBox
{
/// <summary>
/// Checks if point is inside of a polygon
/// </summary>
/// <param name="point"></param>
/// <param name="verts"></param>
/// <param name="checkBoundingBox">Additional check to see if the point is within the bounding box before doing more complex math</param>
/// <remarks>
/// Note that the bounding box check can be more expensive than the vertex calculations in some cases.
/// <see href="https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html">Reference</see>
/// </remarks>
/// <returns></returns>
public static bool PointIntersectsWithPolygon(Vector2 point, Vector2[] verts, bool checkBoundingBox = true)
{
var (x, y) = point;
if (checkBoundingBox)
{
float minX = verts[0].X;
float maxX = verts[0].X;
float minY = verts[0].Y;
float maxY = verts[0].Y;
foreach (var (vertX, vertY) in verts)
{
minX = Math.Min(vertX, minX);
maxX = Math.Max(vertX, maxX);
minY = Math.Min(vertY, minY);
maxY = Math.Max(vertY, maxY);
}
if (x < minX || x > maxX || y < minY || y > maxY ) { return false; }
}
bool isInside = false;
for (int i = 0, j = verts.Length - 1; i < verts.Length; j = i++ )
{
if (verts[i].Y > y != verts[j].Y > y && x < (verts[j].X - verts[i].X) * (y - verts[i].Y) / (verts[j].Y - verts[i].Y) + verts[i].X )
{
isInside = !isInside;
}
}
return isInside;
}
// Convert an RGB value into an HLS value.
public static Vector3 RgbToHLS(this Color color)
{
@@ -251,5 +297,16 @@ namespace Barotrauma
UInt64.TryParse(args[1], out lobbyId);
}
}
public static bool VersionNewerIgnoreRevision(Version a, Version b)
{
if (b.Major > a.Major) { return true; }
if (b.Major < a.Major) { return false; }
if (b.Minor > a.Minor) { return true; }
if (b.Minor < a.Minor) { return false; }
if (b.Build > a.Build) { return true; }
if (b.Build < a.Build) { return false; }
return false;
}
}
}