mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-21 19:31:05 +00:00
DeHackEd: fixed a problem where only the last DEHACKED lump was parsed. Fixes #657
This commit is contained in:
parent
a9284f0cc6
commit
686cebd64d
4 changed files with 20 additions and 23 deletions
|
@ -1783,18 +1783,14 @@ namespace CodeImp.DoomBuilder.Data
|
|||
availablesprites.UnionWith(dr.GetSpriteNames());
|
||||
}
|
||||
|
||||
for(int i = containers.Count-1; i >= 0; i--)
|
||||
foreach(DataReader dr in containers)
|
||||
{
|
||||
DataReader dr = containers[i];
|
||||
List<TextResourceData> dehackedstreams = new List<TextResourceData>(dr.GetDehackedData());
|
||||
|
||||
List<TextResourceData> dehackedstreams = new List<TextResourceData>(dr.GetDehackedData("DEHACKED"));
|
||||
|
||||
if(dehackedstreams.Count > 0)
|
||||
foreach(TextResourceData trd in dehackedstreams)
|
||||
{
|
||||
dehackedstreams[0].Stream.Seek(0, SeekOrigin.Begin);
|
||||
dehacked.Parse(dehackedstreams[0], General.Map.Config.DehackedData, availablesprites);
|
||||
|
||||
break;
|
||||
trd.Stream.Seek(0, SeekOrigin.Begin);
|
||||
dehacked.Parse(trd, General.Map.Config.DehackedData, availablesprites);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== Decorate, Modeldef, Mapinfo, Gldefs, etc...
|
||||
|
||||
// When implemented, this returns DEHACKED lumps
|
||||
public abstract IEnumerable<TextResourceData> GetDehackedData(string pname);
|
||||
public abstract IEnumerable<TextResourceData> GetDehackedData();
|
||||
|
||||
// When implemented, this returns DECORATE lumps
|
||||
public abstract IEnumerable<TextResourceData> GetDecorateData(string pname);
|
||||
|
|
|
@ -487,25 +487,25 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== DEHACKED
|
||||
|
||||
// This finds and returns DEHACKED streams
|
||||
public override IEnumerable<TextResourceData> GetDehackedData(string pname)
|
||||
public override IEnumerable<TextResourceData> GetDehackedData()
|
||||
{
|
||||
// Error when suspended
|
||||
if (issuspended) throw new Exception("Data reader is suspended");
|
||||
|
||||
List<TextResourceData> result = new List<TextResourceData>();
|
||||
string[] allfilenames;
|
||||
|
||||
// Find in root directory
|
||||
string filename = Path.GetFileName(pname);
|
||||
string pathname = Path.GetDirectoryName(pname);
|
||||
// At least one of gldefs should be in the root folder
|
||||
List<string> files = new List<string>();
|
||||
|
||||
if (filename.IndexOf('.') > -1)
|
||||
allfilenames = GetFileAtPath(filename, pathname, "DEHACKED");
|
||||
else
|
||||
allfilenames = GetAllFilesWithTitle(pathname, filename, false);
|
||||
// Can be several entries
|
||||
files.AddRange(GetAllFilesWhichTitleStartsWith("", "DEHACKED", false));
|
||||
|
||||
if(allfilenames.Length > 0)
|
||||
result.Add(new TextResourceData(this, LoadFile(allfilenames[allfilenames.Length - 1]), allfilenames[allfilenames.Length - 1], true));
|
||||
// Add to collection
|
||||
foreach (string s in files)
|
||||
result.Add(new TextResourceData(this, LoadFile(s), s, true));
|
||||
|
||||
// Find in any of the wad files
|
||||
foreach (WADReader wr in wads) result.AddRange(wr.GetDehackedData());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1011,10 +1011,11 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
#region ================== Decorate, Gldefs, Mapinfo, etc...
|
||||
|
||||
public override IEnumerable<TextResourceData> GetDehackedData(string pname)
|
||||
public override IEnumerable<TextResourceData> GetDehackedData()
|
||||
{
|
||||
if (issuspended) throw new Exception("Data reader is suspended");
|
||||
return GetLastLumpData(pname);
|
||||
|
||||
return GetAllLumpsData("DEHACKED");
|
||||
}
|
||||
|
||||
// This finds and returns DECORATE streams
|
||||
|
|
Loading…
Reference in a new issue