2016-04-27 09:13:07 +00:00
|
|
|
|
|
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
|
|
|
|
#region ================== Namespaces
|
2014-12-03 23:15:26 +00:00
|
|
|
|
|
2012-07-12 22:34:12 +00:00
|
|
|
|
using System.Collections.Generic;
|
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
|
|
|
|
using CodeImp.DoomBuilder.Config;
|
2016-04-27 09:13:07 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Data;
|
2012-07-12 22:34:12 +00:00
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder.Data;
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2012-07-12 22:34:12 +00:00
|
|
|
|
//mxd. Modeldef parser used to create ScriptItems for use in script editor's navigator
|
2015-12-17 10:07:28 +00:00
|
|
|
|
//Should be parse model definitions even from invalid MODELDEF and should never fail parsing
|
2016-04-27 09:13:07 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.ZDoom.Scripting
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
|
|
|
|
internal sealed class ModeldefParserSE : ZDTextParser
|
|
|
|
|
{
|
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
|
|
|
|
internal override ScriptType ScriptType { get { return ScriptType.MODELDEF; } }
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private readonly List<ScriptItem> models;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
internal List<ScriptItem> Models { get { return models; } }
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public ModeldefParserSE()
|
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
models = new List<ScriptItem>();
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
public override bool Parse(TextResourceData data, bool clearerrors)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
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
|
|
|
|
//mxd. Already parsed?
|
|
|
|
|
if(!base.AddTextResource(data))
|
|
|
|
|
{
|
|
|
|
|
if(clearerrors) ClearError();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cannot process?
|
|
|
|
|
if(!base.Parse(data, clearerrors)) return false;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
|
|
|
|
// Continue until at the end of the stream
|
2015-12-17 10:07:28 +00:00
|
|
|
|
while(SkipWhitespace(true))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
string token = ReadToken();
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(string.IsNullOrEmpty(token) || token.ToUpperInvariant() != "MODEL") continue;
|
|
|
|
|
|
|
|
|
|
SkipWhitespace(true);
|
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
|
|
|
|
int startpos = (int)datastream.Position;
|
2015-12-17 10:07:28 +00:00
|
|
|
|
string modelname = ReadToken();
|
|
|
|
|
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = ReadToken(); //this should be "{"
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(token == "{")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ScriptItem i = new ScriptItem(modelname, startpos, false);
|
|
|
|
|
models.Add(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while(SkipWhitespace(true))
|
|
|
|
|
{
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
if(string.IsNullOrEmpty(token) || token == "}") break;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
// Sort nodes
|
2013-09-11 09:47:53 +00:00
|
|
|
|
models.Sort(ScriptItem.SortByName);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-07-12 22:34:12 +00:00
|
|
|
|
}
|