Minor optimizations: GUITextBlocks don't reposition and wrap the text when only the position of the text block changes (almost killed my laptop by spamming a bit too many messages to the debug console), less unnecessary floor raycasts
This commit is contained in:
@@ -853,13 +853,19 @@ namespace Barotrauma
|
|||||||
inWater = false;
|
inWater = false;
|
||||||
headInWater = false;
|
headInWater = false;
|
||||||
|
|
||||||
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
|
inWater = false;
|
||||||
|
if (inWater = currentHull.Volume > currentHull.FullVolume * 0.95f)
|
||||||
float floorY = GetFloorY();
|
{
|
||||||
|
|
||||||
if (currentHull.Volume > currentHull.FullVolume * 0.95f ||
|
|
||||||
(waterSurface - floorY > HeadPosition * 0.95f && Collider.SimPosition.Y < waterSurface))
|
|
||||||
inWater = true;
|
inWater = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
|
||||||
|
if (Collider.SimPosition.Y < waterSurface && waterSurface - GetFloorY() > HeadPosition * 0.95f)
|
||||||
|
{
|
||||||
|
inWater = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flowForce.LengthSquared() > 0.001f)
|
if (flowForce.LengthSquared() > 0.001f)
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ namespace Barotrauma
|
|||||||
get { return text; }
|
get { return text; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (Text == value) return;
|
||||||
|
|
||||||
text = value;
|
text = value;
|
||||||
wrappedText = value;
|
wrappedText = value;
|
||||||
SetTextPos();
|
SetTextPos();
|
||||||
@@ -68,8 +70,12 @@ namespace Barotrauma
|
|||||||
child.Rect = new Rectangle(child.Rect.X + value.X - rect.X, child.Rect.Y + value.Y - rect.Y, child.Rect.Width, child.Rect.Height);
|
child.Rect = new Rectangle(child.Rect.X + value.X - rect.X, child.Rect.Y + value.Y - rect.Y, child.Rect.Width, child.Rect.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value.Width != rect.Width || value.Height != rect.Height)
|
||||||
|
{
|
||||||
|
SetTextPos();
|
||||||
|
}
|
||||||
|
|
||||||
rect = value;
|
rect = value;
|
||||||
SetTextPos();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user