(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
@@ -55,28 +55,6 @@ namespace Barotrauma
if (sourceVector.W == 0.0f) sourceVector.W = texture.Height;
}
public void EnsureLazyLoaded()
{
if (!lazyLoad || texture != null) { return; }
Vector4 sourceVector = Vector4.Zero;
bool temp2 = false;
LoadTexture(ref sourceVector, ref temp2, preMultipliedAlpha);
if (sourceRect.Width == 0 && sourceRect.Height == 0)
{
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;
size.Y *= sourceRect.Height;
RelativeOrigin = SourceElement.GetAttributeVector2("origin", new Vector2(0.5f, 0.5f));
}
foreach (Sprite s in list)
{
if (s == this) { continue; }
if (s.FullPath == FullPath && s.texture != null) { s.texture = texture; }
}
}
public void ReloadTexture()
{
var sprites = LoadedSprites.Where(s => s.Texture == texture).ToList();
@@ -98,12 +76,11 @@ namespace Barotrauma
public static Texture2D LoadTexture(string file, bool preMultiplyAlpha = true)
{
if (string.IsNullOrWhiteSpace(file)) { return new Texture2D(GameMain.GraphicsDeviceManager.GraphicsDevice, 1, 1); }
file = Path.GetFullPath(file);
foreach (Sprite s in list)
{
if (s.FullPath == file && s.texture != null) { return s.texture; }
if (s.FullPath == file) return s.texture;
}
if (File.Exists(file))