v1.6.17.0 (Unto the Breach update)

This commit is contained in:
Regalis11
2024-10-22 17:29:04 +03:00
parent e74b3cdb17
commit 6e6c17e100
417 changed files with 17166 additions and 5870 deletions
@@ -1,4 +1,4 @@
using Barotrauma.Extensions;
using Barotrauma.Extensions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
@@ -245,7 +245,7 @@ namespace Barotrauma.Lights
}
set
{
if (!needsRecalculation && value)
if (value)
{
foreach (ConvexHullList chList in convexHullsInRange)
{
@@ -550,7 +550,6 @@ namespace Barotrauma.Lights
chList.List.Clear();
foreach (var convexHull in fullChList.List)
{
if (!convexHull.Enabled) { continue; }
if (!MathUtils.CircleIntersectsRectangle(lightPos, TextureRange, convexHull.BoundingBox)) { continue; }
if (lightSourceParams.Directional)
{
@@ -572,6 +571,7 @@ namespace Barotrauma.Lights
chList.List.Add(convexHull);
}
chList.IsHidden.RemoveWhere(ch => !chList.List.Contains(ch));
chList.HasBeenVisible.RemoveWhere(ch => !chList.List.Contains(ch));
HullsUpToDate.Add(sub);
}
@@ -604,7 +604,8 @@ namespace Barotrauma.Lights
foreach (var ch in chList.List)
{
if (ch.LastVertexChangeTime > LastRecalculationTime && !chList.IsHidden.Contains(ch))
if (ch.LastVertexChangeTime > LastRecalculationTime &&
(!chList.IsHidden.Contains(ch) || chList.HasBeenVisible.Contains(ch)))
{
NeedsRecalculation = true;
break;
@@ -712,8 +713,8 @@ namespace Barotrauma.Lights
{
foreach (ConvexHull hull in chList.List)
{
if (hull.IsInvalid) { continue; }
if (!chList.IsHidden.Contains(hull))
if (hull.IsInvalid || !hull.Enabled) { continue; }
if (!chList.IsHidden.Contains(hull) || chList.HasBeenVisible.Contains(hull))
{
//find convexhull segments that are close enough and facing towards the light source
lock (mutex)
@@ -732,7 +733,17 @@ namespace Barotrauma.Lights
}
foreach (ConvexHull hull in chList.List)
{
chList.IsHidden.Add(hull);
if (!hull.Enabled)
{
//if the hull is not enabled, we cannot determine if it's visible or hidden from the point of view of the light source
//so let's not mark it as hidden, but instead consider it as something that has been visible, so we know to recalculate if/when it becomes enabled again
chList.IsHidden.Remove(hull);
chList.HasBeenVisible.Add(hull);
continue;
}
//mark convex hulls as hidden at this point, they're removed if we find any of the segments to be visible
chList.IsHidden.Add(hull);
}
}
@@ -1411,14 +1422,7 @@ namespace Barotrauma.Lights
{
if (conditionals.None()) { return; }
if (conditionalTarget == null) { return; }
if (logicalOperator == PropertyConditional.LogicalOperatorType.And)
{
Enabled = conditionals.All(c => c.Matches(conditionalTarget));
}
else
{
Enabled = conditionals.Any(c => c.Matches(conditionalTarget));
}
Enabled = PropertyConditional.CheckConditionals(conditionalTarget, conditionals, logicalOperator);
}
public void DebugDrawVertices(SpriteBatch spriteBatch)
@@ -1501,6 +1505,7 @@ namespace Barotrauma.Lights
foreach (var convexHullList in convexHullsInRange)
{
convexHullList.IsHidden.Remove(visibleConvexHull);
convexHullList.HasBeenVisible.Add(visibleConvexHull);
}
}