2015-04-14 11:33:57 +00:00
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
using System;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
2012-06-01 10:17:47 +00:00
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using SlimDX;
|
|
|
|
|
using CodeImp.DoomBuilder.ZDoom;
|
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder.Data;
|
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|
|
|
|
{
|
|
|
|
|
internal sealed class MapinfoParser : ZDTextParser
|
|
|
|
|
{
|
|
|
|
|
#region ================== Delegates
|
|
|
|
|
|
|
|
|
|
public delegate void IncludeDelegate(MapinfoParser parser, string includefile);
|
|
|
|
|
public IncludeDelegate OnInclude;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
|
|
private MapInfo mapinfo;
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
private string mapname;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
private readonly Dictionary<int, string> spawnnums;
|
|
|
|
|
private readonly Dictionary<int, string> doomednums; // <DoomEdNum, <lowercase classname, List of default arguments>>
|
2015-12-17 10:07:28 +00:00
|
|
|
|
private readonly HashSet<string> parsedlumps;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
|
|
public MapInfo MapInfo { get { return mapinfo; } }
|
|
|
|
|
public Dictionary<int, string> SpawnNums { get { return spawnnums; } }
|
|
|
|
|
public Dictionary<int, string> DoomEdNums { get { return doomednums; } }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Constructor
|
|
|
|
|
|
|
|
|
|
public MapinfoParser()
|
|
|
|
|
{
|
2015-04-29 08:36:10 +00:00
|
|
|
|
// Syntax
|
|
|
|
|
whitespace = "\n \t\r\u00A0";
|
2015-05-18 18:49:15 +00:00
|
|
|
|
specialtokens = ",{}=\n";
|
2015-04-29 08:36:10 +00:00
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo = new MapInfo();
|
|
|
|
|
spawnnums = new Dictionary<int, string>();
|
|
|
|
|
doomednums = new Dictionary<int, string>();
|
2015-12-17 10:07:28 +00:00
|
|
|
|
parsedlumps = new HashSet<string>();
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
#region ================== Parsing
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
|
|
|
|
|
override public bool Parse(Stream stream, string sourcefilename)
|
|
|
|
|
{
|
|
|
|
|
if(string.IsNullOrEmpty(mapname)) throw new NotSupportedException("MapName is required!");
|
|
|
|
|
return Parse(stream, sourcefilename, mapname);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
public bool Parse(Stream stream, string sourcefilename, string mapname)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
base.Parse(stream, sourcefilename);
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
this.mapname = mapname.ToLowerInvariant();
|
2015-12-17 10:07:28 +00:00
|
|
|
|
parsedlumps.Add(sourcefilename);
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
while(SkipWhitespace(true))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
string token = ReadToken();
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(token))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
token = token.ToLowerInvariant();
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
if(ParseBlock(token)) break;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//check values
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
if(mapinfo.FadeColor.Red > 0 || mapinfo.FadeColor.Green > 0 || mapinfo.FadeColor.Blue > 0)
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.HasFadeColor = true;
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
if(mapinfo.OutsideFogColor.Red > 0 || mapinfo.OutsideFogColor.Green > 0 || mapinfo.OutsideFogColor.Blue > 0)
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.HasOutsideFogColor = true;
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//Cannot fail here
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//returns true if parsing is finished
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
private bool ParseBlock(string token)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-04-14 11:33:57 +00:00
|
|
|
|
// Keep local data
|
|
|
|
|
Stream localstream = datastream;
|
|
|
|
|
string localsourcename = sourcename;
|
|
|
|
|
BinaryReader localreader = datareader;
|
|
|
|
|
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
if(token == "map" || token == "defaultmap" || token == "adddefaultmap")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-03-21 19:41:54 +00:00
|
|
|
|
switch(token)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-03-21 19:41:54 +00:00
|
|
|
|
case "map":
|
|
|
|
|
//get map name
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = ReadToken().ToLowerInvariant();
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
if(token != mapname) return false; //not finished, search for next "map", "defaultmap" or "adddefaultmap" block
|
2015-03-21 19:41:54 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "defaultmap":
|
|
|
|
|
//reset MapInfo
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo = new MapInfo();
|
2015-03-21 19:41:54 +00:00
|
|
|
|
break;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
2015-08-23 23:32:12 +00:00
|
|
|
|
// Track brace level
|
|
|
|
|
int bracelevel = 0;
|
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//search for required keys
|
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
|
|
|
|
token = ReadToken().ToLowerInvariant();
|
2013-09-11 08:49:45 +00:00
|
|
|
|
//sky1 or sky2
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(token == "sky1" || token == "sky2")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
string skyType = token;
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = StripTokenQuotes(ReadToken()).ToLowerInvariant();
|
|
|
|
|
|
|
|
|
|
//new format
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(token == "=")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
|
|
|
|
//should be sky texture name
|
|
|
|
|
token = StripTokenQuotes(ReadToken());
|
|
|
|
|
bool gotComma = (token.IndexOf(",") != -1);
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(gotComma) token = token.Replace(",", "");
|
2013-09-11 09:47:53 +00:00
|
|
|
|
string skyTexture = StripTokenQuotes(token).ToLowerInvariant();
|
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(skyTexture))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(skyType == "sky1")
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.Sky1 = skyTexture;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
else
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.Sky2 = skyTexture;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
|
|
|
|
//check if we have scrollspeed
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = StripTokenQuotes(ReadToken());
|
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!gotComma && token == ",")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
gotComma = true;
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(gotComma)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
float scrollSpeed = 0;
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!ReadSignedFloat(token, ref scrollSpeed))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
// Not numeric!
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("expected " + skyType + " scroll speed value, but got '" + token + "'");
|
|
|
|
|
return false;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(skyType == "sky1")
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.Sky1ScrollSpeed = scrollSpeed;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
else
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.Sky2ScrollSpeed = scrollSpeed;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
datastream.Seek(-token.Length - 1, SeekOrigin.Current); //step back and try parsing this token again
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("expected " + skyType + " texture name");
|
|
|
|
|
return false;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
//old format
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//token should be sky1/2 name
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(token))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(skyType == "sky1")
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.Sky1 = token;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
else
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.Sky2 = token;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
|
|
|
|
//try to read scroll speed
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = StripTokenQuotes(ReadToken());
|
|
|
|
|
|
|
|
|
|
float scrollSpeed = 0;
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!ReadSignedFloat(token, ref scrollSpeed))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
// Not numeric!
|
|
|
|
|
datastream.Seek(-token.Length - 1, SeekOrigin.Current); //step back and try parsing this token again
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(skyType == "sky1")
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.Sky1ScrollSpeed = scrollSpeed;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
else
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.Sky2ScrollSpeed = scrollSpeed;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("expected " + skyType + " texture name");
|
|
|
|
|
return false;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
2013-09-11 08:49:45 +00:00
|
|
|
|
//fade or outsidefog
|
2015-12-17 10:07:28 +00:00
|
|
|
|
else if(token == "fade" || token == "outsidefog")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
string fadeType = token;
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = StripTokenQuotes(ReadToken()).ToLowerInvariant();
|
|
|
|
|
|
2013-09-12 09:51:56 +00:00
|
|
|
|
//new format?
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(token == "=")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = ReadToken();
|
2013-09-12 09:51:56 +00:00
|
|
|
|
}
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2013-09-12 09:51:56 +00:00
|
|
|
|
//get the color value
|
|
|
|
|
string colorVal = StripTokenQuotes(token).ToLowerInvariant().Replace(" ", "");
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(colorVal))
|
|
|
|
|
{
|
2013-09-12 09:51:56 +00:00
|
|
|
|
Color4 color = new Color4();
|
|
|
|
|
//try to get the color...
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(GetColor(colorVal, ref color))
|
|
|
|
|
{
|
2013-09-12 09:51:56 +00:00
|
|
|
|
if(fadeType == "fade")
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.FadeColor = color;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
else
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.OutsideFogColor = color;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else //...or not
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("failed to parse " + fadeType + " value from string '" + colorVal + "'");
|
|
|
|
|
return false;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("expected " + fadeType + " color value");
|
|
|
|
|
return false;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
2013-09-11 08:49:45 +00:00
|
|
|
|
//vertwallshade or horizwallshade
|
2015-12-17 10:07:28 +00:00
|
|
|
|
else if(token == "vertwallshade" || token == "horizwallshade")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 08:49:45 +00:00
|
|
|
|
string shadeType = token;
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = StripTokenQuotes(ReadToken());
|
|
|
|
|
|
|
|
|
|
//new format
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(token == "=")
|
|
|
|
|
{
|
2013-09-11 08:49:45 +00:00
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = StripTokenQuotes(ReadToken());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int val = 0;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(!ReadSignedInt(token, ref val))
|
|
|
|
|
{
|
2013-09-11 08:49:45 +00:00
|
|
|
|
// Not numeric!
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("expected " + shadeType + " value, but got '" + token + "'");
|
|
|
|
|
return false;
|
2013-09-11 08:49:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(shadeType == "vertwallshade")
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.VertWallShade = General.Clamp(val, -255, 255);
|
2013-09-11 08:49:45 +00:00
|
|
|
|
else
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.HorizWallShade = General.Clamp(val, -255, 255);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
2013-09-11 08:49:45 +00:00
|
|
|
|
//fogdensity or outsidefogdensity
|
2014-12-03 23:15:26 +00:00
|
|
|
|
else if(token == "fogdensity" || token == "outsidefogdensity")
|
|
|
|
|
{
|
2013-09-11 08:49:45 +00:00
|
|
|
|
string densityType = token;
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = StripTokenQuotes(ReadToken());
|
|
|
|
|
|
|
|
|
|
//new format
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(token == "=")
|
|
|
|
|
{
|
2013-09-11 08:49:45 +00:00
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = StripTokenQuotes(ReadToken());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int val;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out val))
|
|
|
|
|
{
|
2013-09-11 08:49:45 +00:00
|
|
|
|
// Not numeric!
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("expected " + densityType + " value, but got '" + token + "'");
|
|
|
|
|
return false;
|
2013-09-11 08:49:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(densityType == "fogdensity")
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.FogDensity = (int)(1024 * (256.0f / val));
|
2014-12-03 23:15:26 +00:00
|
|
|
|
else
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.OutsideFogDensity = (int)(1024 * (256.0f / val));
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
//doublesky
|
2015-12-17 10:07:28 +00:00
|
|
|
|
else if(token == "doublesky")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.DoubleSky = true;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
2013-09-11 08:49:45 +00:00
|
|
|
|
//evenlighting
|
2015-12-17 10:07:28 +00:00
|
|
|
|
else if(token == "evenlighting")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.EvenLighting = true;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
2013-09-11 08:49:45 +00:00
|
|
|
|
//smoothlighting
|
2014-12-03 23:15:26 +00:00
|
|
|
|
else if (token == "smoothlighting")
|
|
|
|
|
{
|
2015-04-14 11:33:57 +00:00
|
|
|
|
mapinfo.SmoothLighting = true;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
//block end
|
2015-12-17 10:07:28 +00:00
|
|
|
|
else if(token == "}")
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
return ParseBlock(token);
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2015-08-23 23:32:12 +00:00
|
|
|
|
//child block
|
|
|
|
|
else if(token == "{")
|
|
|
|
|
{
|
|
|
|
|
// Skip inner properties
|
|
|
|
|
bracelevel++;
|
|
|
|
|
if(bracelevel > 1)
|
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
if(token == "{") bracelevel++;
|
|
|
|
|
else if(token == "}") bracelevel--;
|
|
|
|
|
} while(!string.IsNullOrEmpty(token) && bracelevel > 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
else if(token == "include")
|
2015-04-14 11:33:57 +00:00
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
2015-12-17 10:07:28 +00:00
|
|
|
|
string includelump = StripTokenQuotes(ReadToken(false)).ToLowerInvariant(); // Don't skip newline
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(includelump))
|
2015-04-14 11:33:57 +00:00
|
|
|
|
{
|
|
|
|
|
// Callback to parse this file
|
|
|
|
|
if(OnInclude != null)
|
2015-12-17 10:07:28 +00:00
|
|
|
|
OnInclude(this, includelump.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
|
|
|
|
// Set our buffers back to continue parsing
|
|
|
|
|
datastream = localstream;
|
|
|
|
|
datareader = localreader;
|
|
|
|
|
sourcename = localsourcename;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("got include directive with missing or incorrect path: '" + includelump + "'");
|
|
|
|
|
return false;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
2015-05-23 21:40:21 +00:00
|
|
|
|
}
|
|
|
|
|
else if(token == "gameinfo")
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!NextTokenIs("{")) return false; // Finished with this file
|
2015-05-23 21:40:21 +00:00
|
|
|
|
|
|
|
|
|
while(SkipWhitespace(true))
|
|
|
|
|
{
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
if(string.IsNullOrEmpty(token))
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("failed to find the end of GameInfo block");
|
|
|
|
|
return false; // Finished with this file
|
2015-05-23 21:40:21 +00:00
|
|
|
|
}
|
|
|
|
|
if(token == "}") break;
|
|
|
|
|
|
|
|
|
|
if(token == "skyflatname")
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!NextTokenIs("=")) return false; // Finished with this file
|
2015-05-23 21:40:21 +00:00
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
string skyflatname = StripTokenQuotes(ReadToken());
|
|
|
|
|
if(string.IsNullOrEmpty(skyflatname))
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("unable to get SkyFlatName value");
|
|
|
|
|
return false; // Finished with this file
|
2015-05-23 21:40:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
General.Map.Config.SkyFlatName = skyflatname.ToUpperInvariant();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-14 11:33:57 +00:00
|
|
|
|
else if(token == "doomednums")
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!NextTokenIs("{")) return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
|
|
|
|
while(SkipWhitespace(true))
|
|
|
|
|
{
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
if(string.IsNullOrEmpty(token))
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("failed to find the end of DoomEdNums block");
|
|
|
|
|
return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
if(token == "}") break;
|
|
|
|
|
|
|
|
|
|
// First must be a number
|
|
|
|
|
int id;
|
|
|
|
|
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out id))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("expected DoomEdNums entry number, but got '" + token + "'");
|
|
|
|
|
return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Then "="
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!NextTokenIs("=")) return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
|
|
|
|
// Then actor class
|
|
|
|
|
SkipWhitespace(false);
|
|
|
|
|
string classname = StripTokenQuotes(ReadToken());
|
|
|
|
|
if(string.IsNullOrEmpty(classname))
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("unable to get DoomEdNums entry class definition");
|
|
|
|
|
return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-29 08:36:10 +00:00
|
|
|
|
// Possible special and args. We'll skip them
|
2015-12-17 10:07:28 +00:00
|
|
|
|
for(int i = 0; i < 6; i++)
|
2015-04-14 11:33:57 +00:00
|
|
|
|
{
|
2015-04-29 08:36:10 +00:00
|
|
|
|
if(!NextTokenIs(",", false)) break;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2015-04-29 08:36:10 +00:00
|
|
|
|
// Read special name or arg value
|
|
|
|
|
if(!SkipWhitespace(true) || string.IsNullOrEmpty(ReadToken())) return false;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add to collection?
|
|
|
|
|
if(id != 0) doomednums[id] = classname.ToLowerInvariant();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(token == "spawnnums")
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!NextTokenIs("{")) return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
while(SkipWhitespace(true))
|
2015-04-14 11:33:57 +00:00
|
|
|
|
{
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
if(string.IsNullOrEmpty(token))
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("failed to find the end of SpawnNums block");
|
|
|
|
|
return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
if(token == "}") break;
|
|
|
|
|
|
|
|
|
|
// First must be a number
|
|
|
|
|
int id;
|
|
|
|
|
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out id))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("expected SpawnNums number, but got '" + token + "'");
|
|
|
|
|
return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Then "="
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(!NextTokenIs("=")) return false; // Finished with this file
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
|
|
|
|
// Then actor class
|
|
|
|
|
SkipWhitespace(false);
|
|
|
|
|
token = StripTokenQuotes(ReadToken());
|
|
|
|
|
if(string.IsNullOrEmpty(token))
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
ReportError("unable to get SpawnNums entry class definition");
|
|
|
|
|
return false;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add to collection
|
|
|
|
|
spawnnums[id] = token.ToLowerInvariant();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(token == "$gzdb_skip")
|
|
|
|
|
{
|
|
|
|
|
return true; // Finished with this file
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
|
|
|
|
return false; // Not done yet
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private static bool GetColor(string name, ref Color4 color)
|
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(name == "black") return true;
|
2013-09-11 08:49:45 +00:00
|
|
|
|
|
|
|
|
|
//probably it's a hex color (like FFCC11)?
|
|
|
|
|
int ci;
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(int.TryParse(name, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out ci))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 08:49:45 +00:00
|
|
|
|
color = new Color4(ci) {Alpha = 1.0f};
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
2013-09-11 08:49:45 +00:00
|
|
|
|
//probably it's a color name?
|
2013-09-11 09:47:53 +00:00
|
|
|
|
Color c = Color.FromName(name); //should be similar to C++ color name detection, I suppose
|
2015-12-17 10:07:28 +00:00
|
|
|
|
if(c.IsKnownColor)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
color = new Color4(c);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2015-12-17 10:07:28 +00:00
|
|
|
|
protected override string GetLanguageType()
|
|
|
|
|
{
|
|
|
|
|
return "MAPINFO";
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
#endregion
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2012-06-01 10:17:47 +00:00
|
|
|
|
}
|