Added availability check and fixed preview image lookup for sprites of custom Things.

This commit is contained in:
MascaraSnake 2016-04-06 12:52:47 +02:00
parent e501646989
commit cd54edc410
2 changed files with 15 additions and 2 deletions

View file

@ -440,6 +440,12 @@ namespace CodeImp.DoomBuilder.Config
if (this.radius < 4f) this.radius = 8f;
if (this.hangs && this.absolutez) this.hangs = false; //mxd
// Make long name for sprite lookup
if (this.sprite.Length <= 8)
this.spritelongname = Lump.MakeLongName(this.sprite);
else
this.spritelongname = long.MaxValue;
// We have no destructor
GC.SuppressFinalize(this);
}

View file

@ -150,8 +150,15 @@ namespace CodeImp.DoomBuilder.SRB2
if (String.IsNullOrEmpty(line) || line.StartsWith("\n")) break;
if (line.StartsWith("#$Sprite "))
{
sprite = line.Substring(9);
continue;
string spritename = line.Substring(9);
if (((spritename.Length > DataManager.INTERNAL_PREFIX.Length) &&
spritename.ToLowerInvariant().StartsWith(DataManager.INTERNAL_PREFIX)) ||
General.Map.Data.GetSpriteExists(spritename))
{
sprite = spritename;
continue;
}
ReportError("The sprite \"" + spritename + "\" assigned by the \"$sprite\" property does not exist");
}
if (line.StartsWith("#")) continue;
line = RemoveComments(line);