(bbd192053) Rebind Select and Use keys. Refactor GameSettings to support legacy bindings, when they are set. That is, if the new "deselect" and "shoot" keys are not defined, but the player config file is found, use the "select" and the "use" keys instead of the defaults.

This commit is contained in:
Joonas Rikkonen
2019-04-04 11:08:02 +03:00
parent 79ea41e6c9
commit 7491b06a5d
55 changed files with 594 additions and 584 deletions
@@ -5,25 +5,30 @@ namespace Barotrauma
{
partial class DeformableSprite
{
private Sprite sprite;
public Vector2 Size
{
get { return Sprite.size; }
get { return sprite.size; }
}
public Vector2 Origin
{
get { return Sprite.Origin; }
set { Sprite.Origin = value; }
get { return sprite.Origin; }
set { sprite.Origin = value; }
}
public Sprite Sprite { get; private set; }
public DeformableSprite(XElement element, int? subdivisionsX = null, int? subdivisionsY = null, string filePath = "", bool lazyLoad = false)
public Sprite Sprite
{
Sprite = new Sprite(element, file: filePath, lazyLoad: lazyLoad);
InitProjSpecific(element, subdivisionsX, subdivisionsY, lazyLoad);
get { return sprite; }
}
partial void InitProjSpecific(XElement element, int? subdivisionsX, int? subdivisionsY, bool lazyLoad = false);
public DeformableSprite(XElement element, int? subdivisionsX = null, int? subdivisionsY = null, string filePath = "")
{
sprite = new Sprite(element, file: filePath);
InitProjSpecific(element, subdivisionsX, subdivisionsY);
}
partial void InitProjSpecific(XElement element, int? subdivisionsX, int? subdivisionsY);
}
}
@@ -103,9 +103,8 @@ namespace Barotrauma
partial void LoadTexture(ref Vector4 sourceVector, ref bool shouldReturn, bool premultiplyAlpha = true);
partial void CalculateSourceRect();
public Sprite(XElement element, string path = "", string file = "", bool? preMultiplyAlpha = null, bool lazyLoad = false)
public Sprite(XElement element, string path = "", string file = "")
{
this.lazyLoad = lazyLoad;
SourceElement = element;
if (file == "")
{
@@ -128,12 +127,8 @@ namespace Barotrauma
Name = SourceElement.GetAttributeString("name", null);
Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
preMultipliedAlpha = preMultiplyAlpha ?? SourceElement.GetAttributeBool("premultiplyalpha", true);
bool shouldReturn = false;
if (!lazyLoad)
{
LoadTexture(ref sourceVector, ref shouldReturn, preMultipliedAlpha);
}
LoadTexture(ref sourceVector, ref shouldReturn, SourceElement.GetAttributeBool("premultiplyalpha", true));
if (shouldReturn) return;
sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
size = SourceElement.GetAttributeVector2("size", Vector2.One);