UltimateZoneBuilder/Source/Core/GZBuilder/GZDoom/ModeldefParserSE.cs
MaxED 0f7aa9f827 Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value. 
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00

71 lines
1.8 KiB
C#

using CodeImp.DoomBuilder.Data;
#region ================== Namespaces
using System.Collections.Generic;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.GZBuilder.Data;
using CodeImp.DoomBuilder.ZDoom;
#endregion
//mxd. Modeldef parser used to create ScriptItems for use in script editor's navigator
//Should be parse model definitions even from invalid MODELDEF and should never fail parsing
namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
{
internal sealed class ModeldefParserSE : ZDTextParser
{
internal override ScriptType ScriptType { get { return ScriptType.MODELDEF; } }
private readonly List<ScriptItem> models;
internal List<ScriptItem> Models { get { return models; } }
public ModeldefParserSE()
{
models = new List<ScriptItem>();
}
public override bool Parse(TextResourceData data, bool clearerrors)
{
//mxd. Already parsed?
if(!base.AddTextResource(data))
{
if(clearerrors) ClearError();
return true;
}
// Cannot process?
if(!base.Parse(data, clearerrors)) return false;
// Continue until at the end of the stream
while(SkipWhitespace(true))
{
string token = ReadToken();
if(string.IsNullOrEmpty(token) || token.ToUpperInvariant() != "MODEL") continue;
SkipWhitespace(true);
int startpos = (int)datastream.Position;
string modelname = ReadToken();
SkipWhitespace(true);
token = ReadToken(); //this should be "{"
if(token == "{")
{
ScriptItem i = new ScriptItem(modelname, startpos, false);
models.Add(i);
}
while(SkipWhitespace(true))
{
token = ReadToken();
if(string.IsNullOrEmpty(token) || token == "}") break;
}
}
// Sort nodes
models.Sort(ScriptItem.SortByName);
return true;
}
}
}