Internal: started implementing ZScript parser. Nothing works for now, aside from the actual parsing code.

This commit is contained in:
ZZYZX 2017-01-16 00:00:45 +02:00
parent 96ffb78678
commit 38ffc861cb
8 changed files with 148 additions and 12 deletions

View file

@ -524,12 +524,56 @@ namespace CodeImp.DoomBuilder.Data
return result;
}
#endregion
#endregion
#region ================== VOXELDEF (mxd)
#region ================== ZSCRIPT
//mxd. This returns the list of voxels, which can be used without VOXELDEF definition
public override HashSet<string> GetVoxelNames()
// This finds and returns ZSCRIPT streams
public override IEnumerable<TextResourceData> GetZScriptData(string pname)
{
// 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);
if (filename.IndexOf('.') > -1)
{
string fullname = Path.Combine(pathname, filename);
if (FileExists(fullname))
{
allfilenames = new string[1];
allfilenames[0] = Path.Combine(pathname, filename);
}
else
{
allfilenames = new string[0];
General.ErrorLogger.Add(ErrorType.Warning, "Unable to load ZSCRIPT file \"" + fullname + "\"");
}
}
else
allfilenames = GetAllFilesWithTitle(pathname, filename, false);
foreach (string foundfile in allfilenames)
result.Add(new TextResourceData(this, LoadFile(foundfile), foundfile, true));
// Find in any of the wad files
for (int i = wads.Count - 1; i >= 0; i--)
result.AddRange(wads[i].GetZScriptData(pname));
return result;
}
#endregion
#region ================== VOXELDEF (mxd)
//mxd. This returns the list of voxels, which can be used without VOXELDEF definition
public override HashSet<string> GetVoxelNames()
{
// Error when suspended
if(issuspended) throw new Exception("Data reader is suspended");