2015-04-14 11:33:57 +00:00
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
2014-02-26 14:11:06 +00:00
|
|
|
|
using System.IO;
|
2012-05-22 22:56:42 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
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;
|
|
|
|
|
using CodeImp.DoomBuilder.Data;
|
2012-06-01 10:17:47 +00:00
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder.Data;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
|
using CodeImp.DoomBuilder.IO;
|
2018-02-03 20:31:34 +00:00
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder;
|
2012-05-22 22:56:42 +00:00
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
#endregion
|
2012-05-22 22:56:42 +00:00
|
|
|
|
|
2016-04-27 09:13:07 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.ZDoom
|
2015-01-20 12:20:35 +00:00
|
|
|
|
{
|
2015-04-14 11:33:57 +00:00
|
|
|
|
internal sealed class GldefsParser : ZDTextParser
|
2015-01-20 12:20:35 +00:00
|
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
|
#region ================== Constants
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
Added, Visual mode, GLDEFS, GLOOME: subtractive glow is now supported.
Changed, Visual mode: changed thing fog calculation logic. Should be closer to GZDoom now.
Fixed, GLDEFS parser: "height" texture parameter was not treated as optional.
Fixed, text lump parsers: in some cases incorrect line number was displayed in error and warning messages.
Fixed, Visual mode: glow effect was not applied to sectors with 3 sidedefs.
Fixed, Visual mode: in some cases glow effect was not updated when replacing textures.
Fixed, general interface: "Full Brightness" button state was not updated during map loading.
Fixed, Drag Linedefs/Vertices/Sectors/Things modes: positions of line length labels were not updated while panning the view.
Cosmetic: added a bunch of new icons.
Cosmetic: changed Visual mode crosshair.
2015-08-27 20:46:49 +00:00
|
|
|
|
private const int DEFAULT_GLOW_HEIGHT = 64;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Structs
|
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
private struct GldefsLightType
|
|
|
|
|
{
|
|
|
|
|
public const string POINT = "pointlight";
|
|
|
|
|
public const string PULSE = "pulselight";
|
|
|
|
|
public const string FLICKER = "flickerlight";
|
|
|
|
|
public const string FLICKER2 = "flickerlight2";
|
|
|
|
|
public const string SECTOR = "sectorlight";
|
|
|
|
|
|
2020-01-25 21:28:27 +00:00
|
|
|
|
public static readonly Dictionary<string, GZGeneral.LightModifier> GLDEFS_TO_GZDOOM_LIGHT_TYPE = new Dictionary<string, GZGeneral.LightModifier>(StringComparer.OrdinalIgnoreCase) {
|
|
|
|
|
{ POINT, GZGeneral.LightModifier.NORMAL },
|
|
|
|
|
{ PULSE, GZGeneral.LightModifier.PULSE },
|
|
|
|
|
{ FLICKER, GZGeneral.LightModifier.FLICKER },
|
|
|
|
|
{ FLICKER2, GZGeneral.LightModifier.FLICKERRANDOM },
|
|
|
|
|
{ SECTOR, GZGeneral.LightModifier.SECTOR }
|
|
|
|
|
};
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Delegates
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
2015-12-18 10:16:53 +00:00
|
|
|
|
public delegate void IncludeDelegate(GldefsParser parser, string includefile, bool clearerrors);
|
2013-09-11 09:47:53 +00:00
|
|
|
|
public IncludeDelegate OnInclude;
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
private readonly Dictionary<string, DynamicLightData> lightsbyname; //LightName, light definition
|
2015-03-21 19:41:54 +00:00
|
|
|
|
private readonly Dictionary<string, string> objects; //ClassName, LightName
|
2015-04-14 11:33:57 +00:00
|
|
|
|
private readonly Dictionary<long, GlowingFlatData> glowingflats;
|
2016-01-11 13:00:52 +00:00
|
|
|
|
private readonly Dictionary<string, SkyboxInfo> skyboxes;
|
2015-12-21 14:17:47 +00:00
|
|
|
|
private readonly HashSet<string> parsedlumps;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Properties
|
2012-06-01 10:17:47 +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
|
|
|
|
internal override ScriptType ScriptType { get { return ScriptType.GLDEFS; } }
|
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
internal Dictionary<string, DynamicLightData> LightsByName { get { return lightsbyname; } }
|
|
|
|
|
internal Dictionary<string, string> Objects { get { return objects; } }
|
2015-04-14 11:33:57 +00:00
|
|
|
|
internal Dictionary<long, GlowingFlatData> GlowingFlats { get { return glowingflats; } }
|
2016-01-11 13:00:52 +00:00
|
|
|
|
internal Dictionary<string, SkyboxInfo> Skyboxes { get { return skyboxes; } }
|
2012-06-01 10:17:47 +00:00
|
|
|
|
|
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 ================== Constructor
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public GldefsParser()
|
|
|
|
|
{
|
2015-04-14 11:33:57 +00:00
|
|
|
|
// Syntax
|
|
|
|
|
whitespace = "\n \t\r\u00A0";
|
|
|
|
|
specialtokens = ",{}\n";
|
|
|
|
|
|
2015-12-21 14:17:47 +00:00
|
|
|
|
parsedlumps = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
lightsbyname = new Dictionary<string, DynamicLightData>(StringComparer.OrdinalIgnoreCase); //LightName, Light params
|
|
|
|
|
objects = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); //ClassName, LightName
|
2015-04-14 11:33:57 +00:00
|
|
|
|
glowingflats = new Dictionary<long, GlowingFlatData>(); // Texture name hash, Glowing Flat Data
|
2016-01-11 13:00:52 +00:00
|
|
|
|
skyboxes = new Dictionary<string, SkyboxInfo>(StringComparer.OrdinalIgnoreCase);
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Parsing
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
// Keep local data
|
|
|
|
|
Stream localstream = datastream;
|
|
|
|
|
string localsourcename = sourcename;
|
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 localsourcelumpindex = sourcelumpindex;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
BinaryReader localreader = datareader;
|
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
|
|
|
|
DataLocation locallocation = datalocation;
|
|
|
|
|
string localtextresourcepath = textresourcepath;
|
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
|
|
|
|
{
|
2016-04-06 22:54:04 +00:00
|
|
|
|
string token = ReadToken().ToLowerInvariant();
|
|
|
|
|
if(string.IsNullOrEmpty(token)) continue;
|
2015-12-27 00:13:31 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
switch(token)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
case GldefsLightType.POINT: case GldefsLightType.PULSE: case GldefsLightType.SECTOR:
|
|
|
|
|
case GldefsLightType.FLICKER: case GldefsLightType.FLICKER2:
|
|
|
|
|
if(!ParseLight(token)) return false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "object":
|
|
|
|
|
if(!ParseObject()) return false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "glow":
|
|
|
|
|
if(!ParseGlowingFlats()) return false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "skybox":
|
|
|
|
|
if(!ParseSkybox()) return false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "#include":
|
|
|
|
|
if(!ParseInclude(clearerrors)) return false;
|
|
|
|
|
|
|
|
|
|
// Set our buffers back to continue parsing
|
|
|
|
|
datastream = localstream;
|
|
|
|
|
datareader = localreader;
|
|
|
|
|
sourcename = localsourcename;
|
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
|
|
|
|
sourcelumpindex = localsourcelumpindex;
|
|
|
|
|
datalocation = locallocation;
|
|
|
|
|
textresourcepath = localtextresourcepath;
|
2016-01-11 13:00:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "$gzdb_skip": return !this.HasError;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
// Unknown structure!
|
|
|
|
|
SkipStructure();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// All done
|
|
|
|
|
return !this.HasError;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool ParseLight(string lighttype)
|
|
|
|
|
{
|
2020-01-25 21:28:27 +00:00
|
|
|
|
DynamicLightData light = new DynamicLightData(new GZGeneral.LightData(GldefsLightType.GLDEFS_TO_GZDOOM_LIGHT_TYPE[lighttype], GZGeneral.LightRenderStyle.NORMAL));
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
// Find classname
|
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
string lightname = StripQuotes(ReadToken());
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
if(string.IsNullOrEmpty(lightname))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected " + lighttype + " name");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now find opening brace
|
|
|
|
|
if(!NextTokenIs("{", false))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected opening brace");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Read gldefs light structure
|
|
|
|
|
while(SkipWhitespace(true))
|
|
|
|
|
{
|
|
|
|
|
string token = ReadToken().ToLowerInvariant();
|
|
|
|
|
if(string.IsNullOrEmpty(token)) continue;
|
|
|
|
|
|
|
|
|
|
switch(token)
|
|
|
|
|
{
|
|
|
|
|
case "color":
|
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(!float.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out light.Color.Red))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Red color value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(!float.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out light.Color.Green))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Green color value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(!float.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out light.Color.Blue))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Blue color value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-08-23 08:07:04 +00:00
|
|
|
|
|
|
|
|
|
// Check the value
|
|
|
|
|
if(light.Color.Red == 0.0f && light.Color.Green == 0.0f && light.Color.Blue == 0.0f)
|
|
|
|
|
{
|
2016-08-29 11:32:31 +00:00
|
|
|
|
LogWarning("\"" + lightname + "\" light Color value is "
|
2016-08-23 08:07:04 +00:00
|
|
|
|
+ light.Color.Red + "," + light.Color.Green + "," + light.Color.Blue
|
|
|
|
|
+ ". It won't be shown in GZDoom");
|
|
|
|
|
}
|
|
|
|
|
else if(light.Color.Red > 1.0f || light.Color.Green > 1.0f || light.Color.Blue > 1.0f ||
|
|
|
|
|
light.Color.Red < 0.0f || light.Color.Green < 0.0f || light.Color.Blue < 0.0f)
|
|
|
|
|
{
|
|
|
|
|
// Clamp values
|
|
|
|
|
light.Color.Red = General.Clamp(light.Color.Red, 0.0f, 1.0f);
|
|
|
|
|
light.Color.Green = General.Clamp(light.Color.Green, 0.0f, 1.0f);
|
|
|
|
|
light.Color.Blue = General.Clamp(light.Color.Blue, 0.0f, 1.0f);
|
|
|
|
|
|
|
|
|
|
// Notify user
|
2016-08-29 11:32:31 +00:00
|
|
|
|
LogWarning("\"" + lightname + "\" light Color value was clamped. Color values must be in [0.0 .. 1.0] range");
|
2016-08-23 08:07:04 +00:00
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
break;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
case "size":
|
|
|
|
|
if(lighttype != GldefsLightType.SECTOR)
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out light.PrimaryRadius))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Size value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-08-23 08:07:04 +00:00
|
|
|
|
|
|
|
|
|
if(light.PrimaryRadius < 0)
|
|
|
|
|
{
|
|
|
|
|
ReportError("Size value should be positive, but is \"" + light.PrimaryRadius + "\"");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
light.PrimaryRadius *= 2;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
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
|
|
|
|
ReportError("\"" + token + "\" is not valid property for " + lighttype);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "offset":
|
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(!ReadSignedFloat(token, ref light.Offset.X))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Offset X value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(!ReadSignedFloat(token, ref light.Offset.Z))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Offset Y value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(!ReadSignedFloat(token, ref light.Offset.Y))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Offset Z value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-02-03 20:31:34 +00:00
|
|
|
|
break;
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
case "subtractive":
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
int i;
|
|
|
|
|
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out i))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("expected Subtractive value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-03 20:31:34 +00:00
|
|
|
|
light.Type.SetRenderStyle((i == 1) ? GZGeneral.LightRenderStyle.SUBTRACTIVE : GZGeneral.LightRenderStyle.NORMAL);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2017-01-19 22:27:36 +00:00
|
|
|
|
case "attenuate":
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
int i;
|
|
|
|
|
if (!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out i))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
|
|
|
|
ReportError("expected Attenuate value, but got \"" + token + "\"");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-03 20:31:34 +00:00
|
|
|
|
light.Type.SetRenderStyle((i == 1) ? GZGeneral.LightRenderStyle.ATTENUATED : GZGeneral.LightRenderStyle.NORMAL);
|
|
|
|
|
break;
|
2017-01-19 22:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case "dontlightself":
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
int i;
|
|
|
|
|
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out i))
|
|
|
|
|
{
|
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected DontLightSelf value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
light.DontLightSelf = (i == 1);
|
2015-12-27 00:13:31 +00:00
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
break;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
case "interval":
|
|
|
|
|
if(lighttype == GldefsLightType.PULSE || lighttype == GldefsLightType.FLICKER2)
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-08-23 08:07:04 +00:00
|
|
|
|
float interval = 0f;
|
|
|
|
|
if(!ReadSignedFloat(token, ref interval))
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Interval value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-23 08:07:04 +00:00
|
|
|
|
if(interval <= 0)
|
|
|
|
|
{
|
|
|
|
|
ReportError("Interval value should be greater than zero, but is \"" + interval + "\"");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
//I wrote logic for dynamic lights animation first, so here I modify gldefs settings to fit in existing logic
|
|
|
|
|
if(lighttype == GldefsLightType.PULSE)
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
light.Interval = (int)(interval * 35); //measured in tics (35 per second) in PointLightPulse, measured in seconds in gldefs' PulseLight
|
|
|
|
|
}
|
|
|
|
|
else //FLICKER2. Seems like PointLightFlickerRandom to me
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
light.Interval = (int)(interval * 350); //0.1 is one second for FlickerLight2
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
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
|
|
|
|
ReportError("\"" + token + "\" is not valid property for " + lighttype);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "secondarysize":
|
|
|
|
|
if(lighttype == GldefsLightType.PULSE || lighttype == GldefsLightType.FLICKER || lighttype == GldefsLightType.FLICKER2)
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-08-23 08:07:04 +00:00
|
|
|
|
if(!ReadSignedInt(token, ref light.SecondaryRadius))
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected SecondarySize value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-23 08:07:04 +00:00
|
|
|
|
if(light.SecondaryRadius < 0)
|
|
|
|
|
{
|
|
|
|
|
ReportError("SecondarySize value should be positive, but is \"" + light.SecondaryRadius + "\"");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
light.SecondaryRadius *= 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
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
|
|
|
|
ReportError("\"" + token + "\" is not valid property for " + lighttype);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "chance":
|
|
|
|
|
if(lighttype == GldefsLightType.FLICKER)
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-08-23 08:07:04 +00:00
|
|
|
|
float chance = 0f;
|
|
|
|
|
if(!ReadSignedFloat(token, ref chance))
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Chance value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-23 08:07:04 +00:00
|
|
|
|
// Check range
|
|
|
|
|
if(chance > 1.0f || chance < 0.0f)
|
|
|
|
|
{
|
|
|
|
|
ReportError("Chance must be in [0.0 .. 1.0] range, but is " + chance);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Transforming from 0.0 .. 1.0 to 0 .. 359 to fit in existing logic
|
|
|
|
|
light.Interval = (int)(chance * 359.0f);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
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
|
|
|
|
ReportError("\"" + token + "\" is not valid property for " + lighttype);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "scale":
|
|
|
|
|
if(lighttype == GldefsLightType.SECTOR)
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = ReadToken();
|
2016-08-23 08:07:04 +00:00
|
|
|
|
float scale = 0f;
|
|
|
|
|
if(!ReadSignedFloat(token, ref scale))
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Not numeric!
|
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
|
|
|
|
ReportError("Expected Scale value, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-23 08:07:04 +00:00
|
|
|
|
// Check range
|
|
|
|
|
if(scale > 1.0f || scale < 0.0f)
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-08-23 08:07:04 +00:00
|
|
|
|
ReportError("Scale must be in [0.0 .. 1.0] range, but is " + scale);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2015-12-27 00:13:31 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
//sector light doesn't have animation, so we will store it's size in Interval
|
|
|
|
|
//transforming from 0.0 .. 1.0 to 0 .. 10 to preserve value.
|
|
|
|
|
light.Interval = (int)(scale * 10.0f);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
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
|
|
|
|
ReportError("\"" + token + "\" is not valid property for " + lighttype);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2015-12-27 00:13:31 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
case "}":
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2016-08-23 08:07:04 +00:00
|
|
|
|
bool skip = (light.Color.Red == 0.0f && light.Color.Green == 0.0f && light.Color.Blue == 0.0f);
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Light-type specific checks
|
2018-02-03 20:31:34 +00:00
|
|
|
|
if(light.Type.LightModifier == GZGeneral.LightModifier.NORMAL && light.PrimaryRadius == 0)
|
2016-01-11 13:00:52 +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
|
|
|
|
LogWarning("\"" + lightname + "\" light Size is 0. It won't be shown in GZDoom");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
skip = true;
|
|
|
|
|
}
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
2018-02-03 20:31:34 +00:00
|
|
|
|
if(light.Type.LightAnimated)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(light.PrimaryRadius == 0 && light.SecondaryRadius == 0)
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-08-23 08:07:04 +00:00
|
|
|
|
LogWarning("\"" + lightname + "\" light Size and SecondarySize are 0. It won't be shown in GZDoom");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
skip = true;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
// Add to the collection?
|
|
|
|
|
if(!skip) lightsbyname[lightname] = light;
|
|
|
|
|
|
|
|
|
|
// Break out of this parsing loop
|
|
|
|
|
return true;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
2015-12-27 00:13:31 +00:00
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// All done here
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool ParseObject()
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
|
|
|
|
|
// Read object class
|
2016-04-06 22:54:04 +00:00
|
|
|
|
string objectclass = StripQuotes(ReadToken());
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
if(string.IsNullOrEmpty(objectclass))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected object class");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-06 22:54:04 +00:00
|
|
|
|
// Check if actor exists
|
2017-01-17 04:53:20 +00:00
|
|
|
|
if(General.Map.Data.GetZDoomActor(objectclass) == null)
|
2016-04-23 23:15:43 +00:00
|
|
|
|
LogWarning("DECORATE class \"" + objectclass + "\" does not exist");
|
2016-04-06 22:54:04 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Now find opening brace
|
|
|
|
|
if(!NextTokenIs("{", false))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected opening brace");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int bracescount = 1;
|
|
|
|
|
bool foundlight = false;
|
|
|
|
|
bool foundframe = false;
|
|
|
|
|
|
|
|
|
|
// Read frames structure
|
|
|
|
|
while(SkipWhitespace(true))
|
|
|
|
|
{
|
2016-04-06 22:54:04 +00:00
|
|
|
|
string token = ReadToken().ToLowerInvariant();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(string.IsNullOrEmpty(token)) continue;
|
|
|
|
|
|
|
|
|
|
if(!foundlight && !foundframe && token == "frame")
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = ReadToken().ToLowerInvariant(); // Should be frame name
|
|
|
|
|
|
|
|
|
|
// Use this frame if it's 4 characters long or it's the first frame
|
|
|
|
|
foundframe = (token.Length == 4 || (token.Length > 4 && token[4] == 'a'));
|
|
|
|
|
}
|
|
|
|
|
else if(!foundlight && foundframe && token == "light") // Just use first light and be done with it
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
token = StripQuotes(ReadToken()); // Should be light name
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(token))
|
2015-04-14 11:33:57 +00:00
|
|
|
|
{
|
2016-04-06 22:54:04 +00:00
|
|
|
|
objects[objectclass] = token;
|
|
|
|
|
foundlight = true;
|
2015-12-27 00:13:31 +00:00
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
}
|
|
|
|
|
else if(token == "{") // Continue in this loop until object structure ends
|
|
|
|
|
{
|
|
|
|
|
bracescount++;
|
|
|
|
|
}
|
|
|
|
|
else if(token == "}")
|
|
|
|
|
{
|
|
|
|
|
if(--bracescount < 1) break; // This was Cave Johnson. And we are done here.
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// All done here
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool ParseGlowingFlats()
|
|
|
|
|
{
|
|
|
|
|
// Next sould be opening brace
|
|
|
|
|
if(!NextTokenIs("{", false))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected opening brace");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse inner blocks
|
|
|
|
|
while(SkipWhitespace(true))
|
|
|
|
|
{
|
|
|
|
|
string token = ReadToken().ToLowerInvariant();
|
|
|
|
|
if(token == "}") break; // End of Glow structure
|
|
|
|
|
|
|
|
|
|
switch(token)
|
|
|
|
|
{
|
|
|
|
|
case "walls":
|
|
|
|
|
case "flats":
|
|
|
|
|
if(!NextTokenIs("{", false))
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-01-11 13:00:52 +00:00
|
|
|
|
ReportError("Expected opening brace");
|
|
|
|
|
return false;
|
2015-12-27 00:13:31 +00:00
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
while(SkipWhitespace(true))
|
2015-04-14 11:33:57 +00:00
|
|
|
|
{
|
2016-11-09 10:07:21 +00:00
|
|
|
|
token = StripQuotes(ReadToken(false));
|
|
|
|
|
if(string.IsNullOrEmpty(token)) continue;
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(token == "}") break;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2016-11-09 10:07:21 +00:00
|
|
|
|
// Add glow data. Hash the name exactly as given.
|
|
|
|
|
long flatnamehash = Lump.MakeLongName(token, true);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
glowingflats[flatnamehash] = new GlowingFlatData
|
|
|
|
|
{
|
|
|
|
|
Height = DEFAULT_GLOW_HEIGHT * 2,
|
|
|
|
|
Fullbright = true,
|
|
|
|
|
Color = new PixelColor(255, 255, 255, 255),
|
|
|
|
|
CalculateTextureColor = true
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
break;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
case "texture":
|
|
|
|
|
{
|
2016-11-09 10:07:21 +00:00
|
|
|
|
PixelColor color = new PixelColor();
|
2016-01-11 13:00:52 +00:00
|
|
|
|
int glowheight = DEFAULT_GLOW_HEIGHT;
|
2016-11-09 10:07:21 +00:00
|
|
|
|
string texturename;
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
2016-11-09 10:07:21 +00:00
|
|
|
|
if(!ReadTextureName(out texturename)) return false;
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(string.IsNullOrEmpty(texturename))
|
2015-12-27 00:13:31 +00:00
|
|
|
|
{
|
2016-11-09 10:07:21 +00:00
|
|
|
|
ReportError("Expected " + token + " name");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-12-27 00:13:31 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Now we should find a comma
|
|
|
|
|
if(!NextTokenIs(",", false))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected a comma");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Next is color
|
|
|
|
|
SkipWhitespace(true);
|
2016-11-09 10:07:21 +00:00
|
|
|
|
token = ReadToken(false);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
2018-02-04 03:16:52 +00:00
|
|
|
|
if(!GetColorFromString(token, out color))
|
2016-01-11 13:00:52 +00:00
|
|
|
|
{
|
2016-11-09 10:07:21 +00:00
|
|
|
|
ReportError("Expected glow color value, but got \"" + token + "\"");
|
|
|
|
|
return false;
|
2016-01-11 13:00:52 +00:00
|
|
|
|
}
|
2015-12-27 00:13:31 +00:00
|
|
|
|
|
2016-11-09 10:07:21 +00:00
|
|
|
|
// The glow data is valid at thispoint. Hash the name exactly as given.
|
|
|
|
|
long texturehash = Lump.MakeLongName(texturename, true);
|
Added, Visual mode, GLDEFS, GLOOME: subtractive glow is now supported.
Changed, Visual mode: changed thing fog calculation logic. Should be closer to GZDoom now.
Fixed, GLDEFS parser: "height" texture parameter was not treated as optional.
Fixed, text lump parsers: in some cases incorrect line number was displayed in error and warning messages.
Fixed, Visual mode: glow effect was not applied to sectors with 3 sidedefs.
Fixed, Visual mode: in some cases glow effect was not updated when replacing textures.
Fixed, general interface: "Full Brightness" button state was not updated during map loading.
Fixed, Drag Linedefs/Vertices/Sectors/Things modes: positions of line length labels were not updated while panning the view.
Cosmetic: added a bunch of new icons.
Cosmetic: changed Visual mode crosshair.
2015-08-27 20:46:49 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Now we can find a comma
|
|
|
|
|
if(!NextTokenIs(",", false))
|
|
|
|
|
{
|
|
|
|
|
// Add glow data
|
|
|
|
|
glowingflats[texturehash] = new GlowingFlatData
|
|
|
|
|
{
|
|
|
|
|
Height = glowheight * 2,
|
2016-11-09 10:07:21 +00:00
|
|
|
|
Color = color.WithAlpha(255),
|
2016-01-11 13:00:52 +00:00
|
|
|
|
CalculateTextureColor = false
|
|
|
|
|
};
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Can be glow height
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
|
|
|
|
|
int h;
|
|
|
|
|
if(int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out h))
|
|
|
|
|
{
|
|
|
|
|
// Can't pass glowheight directly cause TryParse will unconditionally set it to 0
|
|
|
|
|
glowheight = h;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2015-12-27 00:13:31 +00:00
|
|
|
|
// Now we can find a comma
|
|
|
|
|
if(!NextTokenIs(",", false))
|
|
|
|
|
{
|
|
|
|
|
// Add glow data
|
2016-01-11 13:00:52 +00:00
|
|
|
|
glowingflats[texturehash] = new GlowingFlatData
|
|
|
|
|
{
|
|
|
|
|
Height = glowheight * 2,
|
2016-11-09 10:07:21 +00:00
|
|
|
|
Color = color.WithAlpha(255),
|
2016-01-11 13:00:52 +00:00
|
|
|
|
CalculateTextureColor = false
|
|
|
|
|
};
|
2015-12-27 00:13:31 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2015-04-14 11:33:57 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Read the flag
|
2015-12-27 00:13:31 +00:00
|
|
|
|
SkipWhitespace(true);
|
2016-01-11 13:00:52 +00:00
|
|
|
|
token = ReadToken().ToLowerInvariant();
|
|
|
|
|
}
|
Added, Visual mode, GLDEFS, GLOOME: subtractive glow is now supported.
Changed, Visual mode: changed thing fog calculation logic. Should be closer to GZDoom now.
Fixed, GLDEFS parser: "height" texture parameter was not treated as optional.
Fixed, text lump parsers: in some cases incorrect line number was displayed in error and warning messages.
Fixed, Visual mode: glow effect was not applied to sectors with 3 sidedefs.
Fixed, Visual mode: in some cases glow effect was not updated when replacing textures.
Fixed, general interface: "Full Brightness" button state was not updated during map loading.
Fixed, Drag Linedefs/Vertices/Sectors/Things modes: positions of line length labels were not updated while panning the view.
Cosmetic: added a bunch of new icons.
Cosmetic: changed Visual mode crosshair.
2015-08-27 20:46:49 +00:00
|
|
|
|
|
2016-11-09 10:07:21 +00:00
|
|
|
|
// Next must be "fullbright" flag
|
|
|
|
|
if(token != "fullbright")
|
2016-01-11 13:00:52 +00:00
|
|
|
|
{
|
2016-11-09 10:07:21 +00:00
|
|
|
|
ReportError("Expected \"fullbright\" flag, but got \"" + token + "\"");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
// Add glow data
|
|
|
|
|
glowingflats[texturehash] = new GlowingFlatData
|
|
|
|
|
{
|
|
|
|
|
Height = glowheight * 2,
|
2016-11-09 10:07:21 +00:00
|
|
|
|
Fullbright = true,
|
|
|
|
|
Color = color.WithAlpha(255),
|
2016-01-11 13:00:52 +00:00
|
|
|
|
CalculateTextureColor = false
|
|
|
|
|
};
|
2015-04-14 11:33:57 +00:00
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
break;
|
2015-12-27 00:13:31 +00:00
|
|
|
|
}
|
2016-01-11 13:00:52 +00:00
|
|
|
|
}
|
2015-12-27 00:13:31 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// All done here
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2015-12-17 10:07:28 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
private bool ParseSkybox()
|
|
|
|
|
{
|
|
|
|
|
SkipWhitespace(true);
|
2016-11-09 10:07:21 +00:00
|
|
|
|
string name;
|
2016-01-01 18:10:16 +00:00
|
|
|
|
|
2016-11-09 10:07:21 +00:00
|
|
|
|
if(!ReadTextureName(out name)) return false;
|
2016-01-11 13:00:52 +00:00
|
|
|
|
if(string.IsNullOrEmpty(name))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected skybox name");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-12-17 10:07:28 +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
|
|
|
|
if(skyboxes.ContainsKey(name)) LogWarning("Skybox \"" + name + "\" is double defined");
|
2015-12-17 10:07:28 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
SkyboxInfo info = new SkyboxInfo(name.ToUpperInvariant());
|
|
|
|
|
|
|
|
|
|
// FlipTop / opening brace
|
|
|
|
|
SkipWhitespace(true);
|
|
|
|
|
string token = ReadToken();
|
|
|
|
|
if(token.ToLowerInvariant() == "fliptop")
|
|
|
|
|
{
|
|
|
|
|
info.FlipTop = true;
|
|
|
|
|
if(!NextTokenIs("{")) return false;
|
|
|
|
|
}
|
|
|
|
|
else if(token != "{")
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected opening brace or \"fliptop\" keyword");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-12-17 10:07:28 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Read skybox texture names
|
|
|
|
|
while(SkipWhitespace(true))
|
|
|
|
|
{
|
|
|
|
|
token = ReadToken();
|
|
|
|
|
if(token == "}") break;
|
|
|
|
|
info.Textures.Add(token);
|
|
|
|
|
}
|
2015-12-21 14:17:47 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Sanity check. Should have 3 or 6 textrues
|
|
|
|
|
if(info.Textures.Count != 3 && info.Textures.Count != 6)
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected 3 or 6 skybox textures");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-12-17 10:07:28 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Add to collection
|
|
|
|
|
skyboxes[name] = info;
|
2015-12-21 14:17:47 +00:00
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// All done here
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool ParseInclude(bool clearerrors)
|
|
|
|
|
{
|
|
|
|
|
//INFO: GZDoom GLDEFS include paths can't be relative ("../glstuff.txt")
|
|
|
|
|
//or absolute ("d:/project/glstuff.txt")
|
|
|
|
|
//or have backward slashes ("info\glstuff.txt")
|
|
|
|
|
//include paths are relative to the first parsed entry, not the current one
|
|
|
|
|
//also include paths may or may not be quoted
|
|
|
|
|
SkipWhitespace(true);
|
2016-04-06 22:54:04 +00:00
|
|
|
|
string includelump = StripQuotes(ReadToken(false)); // Don't skip newline
|
2016-01-11 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
// Sanity checks
|
|
|
|
|
if(string.IsNullOrEmpty(includelump))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Expected file name to include");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check invalid path chars
|
|
|
|
|
if(!CheckInvalidPathChars(includelump)) return false;
|
|
|
|
|
|
|
|
|
|
// Absolute paths are not supported...
|
|
|
|
|
if(Path.IsPathRooted(includelump))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Absolute include paths are not supported by GZDoom");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Relative paths are not supported
|
|
|
|
|
if(includelump.StartsWith(RELATIVE_PATH_MARKER) || includelump.StartsWith(CURRENT_FOLDER_PATH_MARKER) ||
|
|
|
|
|
includelump.StartsWith(ALT_RELATIVE_PATH_MARKER) || includelump.StartsWith(ALT_CURRENT_FOLDER_PATH_MARKER))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Relative include paths are not supported by GZDoom");
|
|
|
|
|
return false;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-01-11 13:00:52 +00:00
|
|
|
|
// Backward slashes are not supported
|
|
|
|
|
if(includelump.Contains(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture)))
|
|
|
|
|
{
|
|
|
|
|
ReportError("Only forward slashes are supported by GZDoom");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Already parsed?
|
|
|
|
|
if(parsedlumps.Contains(includelump))
|
|
|
|
|
{
|
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
|
|
|
|
ReportError("Already parsed \"" + includelump + "\". Check your #include directives");
|
2016-01-11 13:00:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add to collection
|
|
|
|
|
parsedlumps.Add(includelump);
|
|
|
|
|
|
|
|
|
|
// Callback to parse this file
|
|
|
|
|
if(OnInclude != null) OnInclude(this, includelump, clearerrors);
|
|
|
|
|
|
|
|
|
|
// All done here
|
2015-12-27 00:13:31 +00:00
|
|
|
|
return !this.HasError;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2015-01-20 12:20:35 +00:00
|
|
|
|
|
2015-04-14 11:33:57 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
2015-01-20 12:20:35 +00:00
|
|
|
|
internal void ClearIncludesList()
|
|
|
|
|
{
|
2015-04-14 11:33:57 +00:00
|
|
|
|
parsedlumps.Clear();
|
2015-01-20 12:20:35 +00:00
|
|
|
|
}
|
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
|
|
|
|
}
|