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
@@ -9,14 +9,6 @@ namespace Barotrauma
{
partial class PhysicsBody
{
private float bodyShapeTextureScale;
private Texture2D bodyShapeTexture;
public Texture2D BodyShapeTexture
{
get { return bodyShapeTexture; }
}
public void Draw(DeformableSprite deformSprite, Camera cam, Vector2 scale, Color color, bool invert = false)
{
if (!Enabled) { return; }
@@ -79,78 +71,30 @@ namespace Barotrauma
new Vector2(DrawPosition.X, -DrawPosition.Y),
Color.Cyan, 0, 5);
}
if (bodyShapeTexture == null && IsValidShape(Radius, Height, Width))
if (IsValidShape(Radius, Height, Width))
{
float radius = ConvertUnits.ToDisplayUnits(Radius);
float height = ConvertUnits.ToDisplayUnits(Height);
float width = ConvertUnits.ToDisplayUnits(Width);
switch (BodyShape)
{
case Shape.Rectangle:
{
float maxSize = Math.Max(ConvertUnits.ToDisplayUnits(Width), ConvertUnits.ToDisplayUnits(Height));
if (maxSize > 128.0f)
{
bodyShapeTextureScale = 128.0f / maxSize;
}
else
{
bodyShapeTextureScale = 1.0f;
}
bodyShapeTexture = GUI.CreateRectangle(
(int)ConvertUnits.ToDisplayUnits(Width * bodyShapeTextureScale),
(int)ConvertUnits.ToDisplayUnits(Height * bodyShapeTextureScale));
break;
}
GUI.DrawRectangle(spriteBatch, DrawPosition.FlipY(), new Vector2(width, height), new Vector2(width, height) / 2, -DrawRotation, color);
break;
case Shape.Capsule:
GUI.DrawCapsule(spriteBatch, DrawPosition.FlipY(), height, radius, -DrawRotation - MathHelper.PiOver2, color);
break;
case Shape.HorizontalCapsule:
{
float maxSize = Math.Max(ConvertUnits.ToDisplayUnits(Radius), ConvertUnits.ToDisplayUnits(Math.Max(Height, Width)));
if (maxSize > 128.0f)
{
bodyShapeTextureScale = 128.0f / maxSize;
}
else
{
bodyShapeTextureScale = 1.0f;
}
bodyShapeTexture = GUI.CreateCapsule(
(int)ConvertUnits.ToDisplayUnits(Radius * bodyShapeTextureScale),
(int)ConvertUnits.ToDisplayUnits(Math.Max(Height, Width) * bodyShapeTextureScale));
break;
}
GUI.DrawCapsule(spriteBatch, DrawPosition.FlipY(), width, radius, -DrawRotation, color);
break;
case Shape.Circle:
if (ConvertUnits.ToDisplayUnits(Radius) > 128.0f)
{
bodyShapeTextureScale = 128.0f / ConvertUnits.ToDisplayUnits(Radius);
}
else
{
bodyShapeTextureScale = 1.0f;
}
bodyShapeTexture = GUI.CreateCircle((int)ConvertUnits.ToDisplayUnits(Radius * bodyShapeTextureScale));
GUI.DrawDonutSection(spriteBatch, DrawPosition.FlipY(), new Range<float>(radius - 0.5f, radius + 0.5f), MathHelper.TwoPi, color, 0, -DrawRotation);
break;
default:
throw new NotImplementedException();
}
}
float rot = -DrawRotation;
if (bodyShape == Shape.HorizontalCapsule)
{
rot -= MathHelper.PiOver2;
}
if (bodyShapeTexture != null)
{
spriteBatch.Draw(
bodyShapeTexture,
new Vector2(DrawPosition.X, -DrawPosition.Y),
null,
color,
rot,
new Vector2(bodyShapeTexture.Width / 2, bodyShapeTexture.Height / 2),
1.0f / bodyShapeTextureScale, SpriteEffects.None, 0.0f);
}
}
public PosInfo ClientRead(IReadMessage msg, float sendingTime, string parentDebugName)
@@ -210,14 +154,5 @@ namespace Barotrauma
null :
new PosInfo(newPosition, newRotation, newVelocity, newAngularVelocity, sendingTime);
}
partial void DisposeProjSpecific()
{
if (bodyShapeTexture != null)
{
bodyShapeTexture.Dispose();
bodyShapeTexture = null;
}
}
}
}