(d9829ac) v0.9.4.0

This commit is contained in:
Regalis
2019-10-24 18:05:42 +02:00
parent 9aa12bcac2
commit b39922a074
319 changed files with 12516 additions and 6815 deletions
@@ -5,6 +5,7 @@ using System.Xml.Linq;
using System.Linq;
using Barotrauma.Extensions;
using System.IO;
using SpriteParams = Barotrauma.RagdollParams.SpriteParams;
namespace Barotrauma
{
@@ -36,7 +37,7 @@ namespace Barotrauma
//the size of the drawn sprite, if larger than the source,
//the sprite is tiled to fill the target size
public Vector2 size;
public Vector2 size = Vector2.One;
public float rotation;
@@ -100,6 +101,7 @@ namespace Barotrauma
public string Name { get; set; }
partial void LoadTexture(ref Vector4 sourceVector, ref bool shouldReturn, bool premultiplyAlpha = true);
partial void CalculateSourceRect();
private static void AddToList(Sprite elem)
@@ -128,7 +130,7 @@ namespace Barotrauma
{
LoadTexture(ref sourceVector, ref shouldReturn, preMultipliedAlpha);
}
if (shouldReturn) return;
if (shouldReturn) { return; }
sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
size = SourceElement.GetAttributeVector2("size", Vector2.One);
size.X *= sourceRect.Width;
@@ -149,7 +151,6 @@ namespace Barotrauma
Origin = new Vector2(sourceRect.Width - origin.X, origin.Y);
}
depth = spriteParams.Depth;
// TODO: size?
}
public Sprite(string newFile, Vector2 newOrigin, bool preMultiplyAlpha = true)
@@ -229,7 +230,7 @@ namespace Barotrauma
return;
}
var doc = XMLExtensions.TryLoadXml(path);
if (doc == null || doc.Root == null) { return; }
if (doc == null) { return; }
if (string.IsNullOrWhiteSpace(Name) && string.IsNullOrWhiteSpace(EntityID)) { return; }
var spriteElements = doc.Descendants("sprite").Concat(doc.Descendants("Sprite"));
var sourceElements = spriteElements.Where(e => e.GetAttributeString("name", null) == Name);