From 49f55120adb11b273c0e5fcf2427e6c13d6c7c2b Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Fri, 20 Jan 2017 00:27:36 +0200 Subject: [PATCH] Added: GLDEFS support for 'attenuate 1' keyword --- Source/Core/GZBuilder/Data/DynamicLight.cs | 5 +++-- Source/Core/Properties/AssemblyInfo.cs | 4 ++-- Source/Core/VisualModes/VisualThing.cs | 4 ++-- Source/Core/ZDoom/GldefsParser.cs | 21 +++++++++++++++++-- .../BuilderModes/Properties/AssemblyInfo.cs | 2 +- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Source/Core/GZBuilder/Data/DynamicLight.cs b/Source/Core/GZBuilder/Data/DynamicLight.cs index 0e82d2f8..86a299b2 100755 --- a/Source/Core/GZBuilder/Data/DynamicLight.cs +++ b/Source/Core/GZBuilder/Data/DynamicLight.cs @@ -10,11 +10,12 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data public int SecondaryRadius; public int Interval; public Vector3 Offset; - public bool Subtractive; - public bool DontLightSelf; + public DynamicLightRenderStyle Style; + public bool DontLightSelf; public DynamicLightData() { + Style = DynamicLightRenderStyle.NORMAL; Color = new Color3(); Offset = new Vector3(); } diff --git a/Source/Core/Properties/AssemblyInfo.cs b/Source/Core/Properties/AssemblyInfo.cs index 15bfa90e..341f95f8 100755 --- a/Source/Core/Properties/AssemblyInfo.cs +++ b/Source/Core/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ using CodeImp.DoomBuilder; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.2836")] +[assembly: AssemblyVersion("2.3.0.2837")] [assembly: NeutralResourcesLanguageAttribute("en")] -[assembly: AssemblyHash("819ef64")] +[assembly: AssemblyHash("30a5edf")] diff --git a/Source/Core/VisualModes/VisualThing.cs b/Source/Core/VisualModes/VisualThing.cs index 6ce7aa66..d17e64a7 100755 --- a/Source/Core/VisualModes/VisualThing.cs +++ b/Source/Core/VisualModes/VisualThing.cs @@ -736,8 +736,8 @@ namespace CodeImp.DoomBuilder.VisualModes { DynamicLightData light = General.Map.Data.GldefsEntries[thing.Type]; - //apply settings - lightRenderStyle = light.Subtractive ? DynamicLightRenderStyle.NEGATIVE : DynamicLightRenderStyle.NORMAL; + //apply settings + lightRenderStyle = light.Style; lightColor = new Color4((float)lightRenderStyle / 100.0f, light.Color.Red, light.Color.Green, light.Color.Blue); Vector2D o = new Vector2D(light.Offset.X, light.Offset.Y).GetRotated(thing.Angle - Angle2D.PIHALF); lightOffset = new Vector3(o.x, o.y, light.Offset.Z); diff --git a/Source/Core/ZDoom/GldefsParser.cs b/Source/Core/ZDoom/GldefsParser.cs index 99e3dc6a..e461db0a 100755 --- a/Source/Core/ZDoom/GldefsParser.cs +++ b/Source/Core/ZDoom/GldefsParser.cs @@ -303,11 +303,28 @@ namespace CodeImp.DoomBuilder.ZDoom return false; } - light.Subtractive = (i == 1); + if (i == 1) light.Style = DynamicLightRenderStyle.NEGATIVE; } break; - case "dontlightself": + 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; + } + + if (i == 1) light.Style = DynamicLightRenderStyle.ATTENUATED; + } + break; + + case "dontlightself": { SkipWhitespace(true); diff --git a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs index 4b023511..6652ddd6 100755 --- a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs +++ b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Resources; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.2836")] +[assembly: AssemblyVersion("2.3.0.2837")] [assembly: NeutralResourcesLanguageAttribute("en")]