mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
fixed the way sprites are loaded from the data readers
This commit is contained in:
parent
e706e18c3b
commit
50c9a15408
2 changed files with 22 additions and 14 deletions
|
@ -861,28 +861,18 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// This loads the sprites
|
||||
private int LoadSprites()
|
||||
{
|
||||
Stream spritedata = null;
|
||||
SpriteImage image;
|
||||
|
||||
// Go for all things
|
||||
foreach(ThingTypeInfo ti in General.Map.Config.Things)
|
||||
{
|
||||
// Sprite not added to collection yet?
|
||||
if(!sprites.ContainsKey(ti.SpriteLongName) && (ti.Sprite.Length <= 8))
|
||||
{
|
||||
// Go for all opened containers
|
||||
for(int i = containers.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// This contain provides this sprite?
|
||||
spritedata = containers[i].GetSpriteData(ti.Sprite);
|
||||
if(spritedata != null) break;
|
||||
}
|
||||
|
||||
// Found anything?
|
||||
// Find sprite data
|
||||
Stream spritedata = GetSpriteData(ti.Sprite);
|
||||
if(spritedata != null)
|
||||
{
|
||||
// Make new sprite image
|
||||
image = new SpriteImage(ti.Sprite);
|
||||
SpriteImage image = new SpriteImage(ti.Sprite);
|
||||
|
||||
// Add to collection
|
||||
sprites.Add(ti.SpriteLongName, image);
|
||||
|
@ -896,6 +886,24 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Output info
|
||||
return sprites.Count;
|
||||
}
|
||||
|
||||
// This returns a specific patch stream
|
||||
internal Stream GetSpriteData(string pname)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(pname))
|
||||
{
|
||||
// Go for all opened containers
|
||||
for(int i = containers.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// This contain provides this patch?
|
||||
Stream spritedata = containers[i].GetSpriteData(pname);
|
||||
if(spritedata != null) return spritedata;
|
||||
}
|
||||
}
|
||||
|
||||
// No such patch found
|
||||
return null;
|
||||
}
|
||||
|
||||
// This loads the internal sprites
|
||||
private void LoadInternalSprites()
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
lock(this)
|
||||
{
|
||||
// Get the lump data stream
|
||||
lumpdata = General.Map.Data.GetPatchData(Name);
|
||||
lumpdata = General.Map.Data.GetSpriteData(Name);
|
||||
if(lumpdata != null)
|
||||
{
|
||||
// Copy lump data to memory
|
||||
|
|
Loading…
Reference in a new issue