UltimateZoneBuilder/Source/Core/GZBuilder/GZDoom/ModeldefParserSE.cs
MaxED 5cd998b1fc Changed, Linedef/Thing Edit windows: when using ACS specials and choosing a script with arguments, appropriate action argument names are replaced with script argument names.
Changed, Linedef/Thing Info panel: when displaying a linedef/thing with an ACS special, which uses a script with arguments, appropriate action argument names are replaced with script argument names.
Changed, Sector/Linedef/Thing Edit windows, Comments tab: window is no longer closed when pressing Enter while editing a comment. Newline is inserted instead.
Changed: Script Editor window is now toggled to normal state when pressing "Show Script Editor" button if said window was already open, but minimized.
Fixed: in some cases action arguments were not cleared during setup when displaying multiple map elements with mixed argument values.
Internal: added ArgumentsControl.
2015-07-27 09:02:28 +00:00

58 lines
1.3 KiB
C#

#region ================== Namespaces
using System.IO;
using System.Collections.Generic;
using CodeImp.DoomBuilder.ZDoom;
using CodeImp.DoomBuilder.GZBuilder.Data;
#endregion
//mxd. Modeldef parser used to create ScriptItems for use in script editor's navigator
namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
{
internal sealed class ModeldefParserSE : ZDTextParser
{
private readonly List<ScriptItem> models;
internal List<ScriptItem> Models { get { return models; } }
public ModeldefParserSE()
{
models = new List<ScriptItem>();
}
public override bool Parse(Stream stream, string sourcefilename)
{
base.Parse(stream, sourcefilename);
// Continue until at the end of the stream
while (SkipWhitespace(true))
{
string token = ReadToken();
if (!string.IsNullOrEmpty(token))
{
token = token.ToUpperInvariant();
if(token == "MODEL")
{
SkipWhitespace(true);
int startPos = (int)stream.Position;
string modelName = ReadToken();
SkipWhitespace(true);
token = ReadToken(); //this should be "{"
if (token == "{")
{
ScriptItem i = new ScriptItem(modelName, startPos, false);
models.Add(i);
}
}
}
}
//sort nodes
models.Sort(ScriptItem.SortByName);
return true;
}
}
}