v1.0.21.0 (summer patch hotfix)

This commit is contained in:
Regalis11
2023-06-21 16:14:31 +03:00
parent f95be0511c
commit d6a886bf6b
29 changed files with 241 additions and 136 deletions
@@ -201,9 +201,9 @@ namespace Barotrauma
keys[(int)InputType.Use].Held = useInput;
keys[(int)InputType.Use].SetState(false, useInput);
bool crouching = msg.ReadBoolean();
if (AnimController is HumanoidAnimController)
{
bool crouching = msg.ReadBoolean();
keys[(int)InputType.Crouch].Held = crouching;
keys[(int)InputType.Crouch].SetState(false, crouching);
}
@@ -269,7 +269,34 @@ namespace Barotrauma
if (readStatus)
{
ReadStatus(msg);
AIController?.ClientRead(msg);
bool isEnemyAi = msg.ReadBoolean();
if (isEnemyAi)
{
byte aiState = msg.ReadByte();
if (AIController is EnemyAIController enemyAi)
{
enemyAi.State = (AIState)aiState;
}
else
{
DebugConsole.AddWarning($"Received enemy AI data for a character with no {nameof(EnemyAIController)}. Ignoring...");
}
bool isPet = msg.ReadBoolean();
if (isPet)
{
byte happiness = msg.ReadByte();
byte hunger = msg.ReadByte();
if ((AIController as EnemyAIController)?.PetBehavior is PetBehavior petBehavior)
{
petBehavior.Happiness = (float)happiness / byte.MaxValue * petBehavior.MaxHappiness;
petBehavior.Hunger = (float)hunger / byte.MaxValue * petBehavior.MaxHunger;
}
else
{
DebugConsole.AddWarning($"Received pet AI data for a character with no {nameof(PetBehavior)}. Ignoring...");
}
}
}
}
msg.ReadPadBits();
@@ -111,7 +111,7 @@ namespace Barotrauma
/// </summary>
public static float AspectRatioAdjustment => HorizontalAspectRatio < 1.4f ? (1.0f - (1.4f - HorizontalAspectRatio)) : 1.0f;
public static bool IsUltrawide => HorizontalAspectRatio > 2.0f;
public static bool IsUltrawide => HorizontalAspectRatio > 2.3f;
public static int UIWidth
{
@@ -2438,13 +2438,15 @@ namespace Barotrauma
var pauseMenuInner = new GUIFrame(new RectTransform(new Vector2(0.13f, 0.3f), PauseMenu.RectTransform, Anchor.Center) { MinSize = new Point(250, 300) });
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.7f, 0.6f), pauseMenuInner.RectTransform, Anchor.Center))
float padding = 0.06f;
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.7f, 0.8f), pauseMenuInner.RectTransform, Anchor.BottomCenter) { RelativeOffset = new Vector2(0.0f, padding) })
{
Stretch = true,
RelativeSpacing = 0.05f
};
new GUIButton(new RectTransform(new Vector2(0.1f, 0.1f), pauseMenuInner.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point((int)(15 * GUI.Scale)) },
new GUIButton(new RectTransform(new Vector2(0.1f, 0.07f), pauseMenuInner.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(padding) },
"", style: "GUIBugButton")
{
IgnoreLayoutGroups = true,
@@ -2520,6 +2522,13 @@ namespace Barotrauma
}
GUITextBlock.AutoScaleAndNormalize(buttonContainer.Children.Where(c => c is GUIButton).Select(c => ((GUIButton)c).TextBlock));
//scale to ensure there's enough room for all the buttons
pauseMenuInner.RectTransform.MinSize = new Point(
pauseMenuInner.RectTransform.MinSize.X,
Math.Max(
(int)(buttonContainer.Children.Sum(c => c.Rect.Height + buttonContainer.Rect.Height * buttonContainer.RelativeSpacing)),
pauseMenuInner.RectTransform.MinSize.X));
}
void CreateButton(string textTag, GUIComponent parent, Action action, string verificationTextTag = null)
@@ -160,8 +160,9 @@ namespace Barotrauma
int crewAreaY = ButtonAreaTop.Bottom + Padding;
int crewAreaHeight = ObjectiveAnchor.Top - Padding - crewAreaY;
float crewAreaWidthMultiplier = GUI.IsUltrawide ? GUI.HorizontalAspectRatio : 1.0f;
CrewArea = new Rectangle(Padding, crewAreaY, (int)(Math.Max(400 * GUI.Scale, 220) * crewAreaWidthMultiplier), crewAreaHeight);
CrewArea = new Rectangle(Padding, crewAreaY,
(int)MathHelper.Clamp(400 * GUI.Scale, 220, GameMain.GraphicsHeight * 0.4f),
crewAreaHeight);
InventoryAreaLower = new Rectangle(ChatBoxArea.Right + Padding * 7, inventoryTopY, GameMain.GraphicsWidth - Padding * 9 - ChatBoxArea.Width, GameMain.GraphicsHeight - inventoryTopY);
int healthWindowWidth = (int)(GameMain.GraphicsWidth * 0.5f);
@@ -95,6 +95,7 @@ namespace Barotrauma
{
CanBeFocused = false
};
crewArea.RectTransform.NonScaledSize = HUDLayoutSettings.CrewArea.Size;
// AbsoluteOffset is set in UpdateProjectSpecific based on crewListOpenState
crewList = new GUIListBox(new RectTransform(Vector2.One, crewArea.RectTransform), style: null, isScrollBarOnDefaultSide: false)
@@ -561,7 +561,7 @@ namespace Barotrauma.Lights
if (IsSegmentFacing(losVertices[0].Pos, losVertices[1].Pos, lightSourcePos))
{
Array.Reverse(ShadowVertices);
Array.Reverse(ShadowVertices, 0, ShadowVertexCount);
}
CalculateLosPenumbraVertices(lightSourcePos);
@@ -482,7 +482,7 @@ namespace Barotrauma.Lights
{
foreach (MapEntity e in (Submarine.VisibleEntities ?? MapEntity.mapEntityList))
{
if (e is Item item && item.GetComponent<Wire>() is Wire wire)
if (e is Item item && !item.HiddenInGame && item.GetComponent<Wire>() is Wire wire)
{
wire.DebugDraw(spriteBatch, alpha: 0.4f);
}
@@ -719,6 +719,7 @@ namespace Barotrauma.Lights
{
foreach (var ch in convexHulls)
{
if (!ch.Enabled) { continue; }
Vector2 currentViewPos = pos;
Vector2 defaultViewPos = ViewTarget.DrawPosition;
if (ch.ParentEntity?.Submarine != null)
@@ -742,10 +743,13 @@ namespace Barotrauma.Lights
{
if (!convexHull.Enabled || !convexHull.Intersects(camView)) { continue; }
Vector2 relativeLightPos = pos;
if (convexHull.ParentEntity?.Submarine != null) { relativeLightPos -= convexHull.ParentEntity.Submarine.Position; }
Vector2 relativeViewPos = pos;
if (convexHull.ParentEntity?.Submarine != null)
{
relativeViewPos -= convexHull.ParentEntity.Submarine.DrawPosition;
}
convexHull.CalculateLosVertices(relativeLightPos);
convexHull.CalculateLosVertices(relativeViewPos);
for (int i = 0; i < convexHull.ShadowVertexCount; i++)
{
@@ -206,6 +206,8 @@ namespace Barotrauma.Lights
private readonly List<ConvexHullList> convexHullsInRange;
private readonly HashSet<ConvexHull> visibleConvexHulls = new HashSet<ConvexHull>();
public Texture2D texture;
public SpriteEffects LightSpriteEffect;
@@ -717,6 +719,8 @@ namespace Barotrauma.Lights
public void RayCastTask(Vector2 drawPos, float rotation)
{
visibleConvexHulls.Clear();
Vector2 drawOffset = Vector2.Zero;
float boundsExtended = TextureRange;
if (OverrideLightTexture != null)
@@ -904,17 +908,12 @@ namespace Barotrauma.Lights
bool isPoint1 = MathUtils.LineToPointDistanceSquared(seg1.Start.WorldPos, seg1.End.WorldPos, p.WorldPos) < 25.0f;
bool isPoint2 = MathUtils.LineToPointDistanceSquared(seg2.Start.WorldPos, seg2.End.WorldPos, p.WorldPos) < 25.0f;
bool markAsVisible = false;
if (isPoint1 && isPoint2)
{
//hit at the current segmentpoint -> place the segmentpoint into the list
verts.Add(p.WorldPos);
foreach (ConvexHullList hullList in convexHullsInRange)
{
hullList.IsHidden.Remove(p.ConvexHull);
hullList.IsHidden.Remove(seg1.ConvexHull);
hullList.IsHidden.Remove(seg2.ConvexHull);
}
markAsVisible = true;
}
else if (intersection1.index != intersection2.index)
{
@@ -922,13 +921,13 @@ namespace Barotrauma.Lights
//we definitely want to generate new geometry here
verts.Add(isPoint1 ? p.WorldPos : intersection1.pos);
verts.Add(isPoint2 ? p.WorldPos : intersection2.pos);
foreach (ConvexHullList hullList in convexHullsInRange)
{
hullList.IsHidden.Remove(p.ConvexHull);
hullList.IsHidden.Remove(seg1.ConvexHull);
hullList.IsHidden.Remove(seg2.ConvexHull);
}
markAsVisible = true;
}
if (markAsVisible)
{
visibleConvexHulls.Add(p.ConvexHull);
visibleConvexHulls.Add(seg1.ConvexHull);
visibleConvexHulls.Add(seg2.ConvexHull);
}
//if neither of the conditions above are met, we just assume
//that the raycasts both resulted on the same segment
@@ -1396,6 +1395,14 @@ namespace Barotrauma.Lights
return;
}
foreach (var visibleConvexHull in visibleConvexHulls)
{
foreach (var convexHullList in convexHullsInRange)
{
convexHullList.IsHidden.Remove(visibleConvexHull);
}
}
CalculateLightVertices(verts);
LastRecalculationTime = (float)Timing.TotalTime;