Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Barotrauma.IO;
@@ -10,7 +10,19 @@ namespace Barotrauma
{
public partial class Sprite
{
public Identifier Identifier { get; private set; }
private Identifier identifier;
public Identifier Identifier
{
get
{
if (identifier.IsEmpty)
{
identifier = GetIdentifier(SourceElement);
}
return identifier;
}
}
public static IEnumerable<Sprite> LoadedSprites
{
get
@@ -71,8 +83,6 @@ namespace Barotrauma
}
}
private string disposeStackTrace;
public bool Loaded
{
get { return texture != null && !cannotBeLoaded; }
@@ -288,24 +298,27 @@ namespace Barotrauma
/// Last version of the game that had broken handling of sprites that were scaled, flipped and offset
/// </summary>
public static readonly Version LastBrokenTiledSpriteGameVersion = new Version(major: 1, minor: 2, build: 7, revision: 0);
public void DrawTiled(ISpriteBatch spriteBatch, Vector2 position, Vector2 targetSize, float rotation = 0f, Vector2? origin = null, Color? color = null, Vector2? startOffset = null, Vector2? textureScale = null, float? depth = null)
{
DrawTiled(spriteBatch, position, targetSize, effects, rotation, origin, color, startOffset, textureScale, depth);
}
public void DrawTiled(ISpriteBatch spriteBatch,
Vector2 position,
Vector2 targetSize,
SpriteEffects spriteEffects,
float rotation = 0f,
Vector2? origin = null,
Color? color = null,
Vector2? startOffset = null,
Vector2? textureScale = null,
float? depth = null,
SpriteEffects? spriteEffects = null)
float? depth = null)
{
if (Texture == null) { return; }
spriteEffects ??= effects;
bool flipHorizontal = spriteEffects.Value.HasFlag(SpriteEffects.FlipHorizontally);
bool flipVertical = spriteEffects.Value.HasFlag(SpriteEffects.FlipVertically);
bool flipHorizontal = (spriteEffects & SpriteEffects.FlipHorizontally) == SpriteEffects.FlipHorizontally; // optimized from spriteEffects.HasFlag(SpriteEffects.FlipHorizontally)
bool flipVertical = (spriteEffects & SpriteEffects.FlipVertically) == SpriteEffects.FlipVertically; // optimized from spriteEffects.HasFlag(SpriteEffects.FlipVertically)
float addedRotation = rotation + this.rotation;
if (flipHorizontal != flipVertical) { addedRotation = -addedRotation; }
@@ -344,7 +357,7 @@ namespace Barotrauma
rotation: addedRotation,
origin: Vector2.Zero,
scale: scale,
effects: spriteEffects.Value,
effects: spriteEffects,
layerDepth: depth ?? this.depth);
}
@@ -419,7 +432,6 @@ namespace Barotrauma
partial void DisposeTexture()
{
disposeStackTrace = Environment.StackTrace;
if (texture != null)
{
//check if another sprite is using the same texture