From a0ef5209b78d2d51fb659752be3268ad86743292 Mon Sep 17 00:00:00 2001 From: ZZYZX <zzyzx@virtual> Date: Sun, 4 Feb 2018 09:18:02 +0200 Subject: [PATCH] Fixed light color picker to work with spotlights --- Source/Core/Properties/AssemblyInfo.cs | 4 ++-- .../BuilderModes/Properties/AssemblyInfo.cs | 2 +- .../ColorPicker/Windows/LightColorPicker.cs | 21 +++++++++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Source/Core/Properties/AssemblyInfo.cs b/Source/Core/Properties/AssemblyInfo.cs index 51eda47dc..e5953202c 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.3001")] +[assembly: AssemblyVersion("2.3.0.3002")] [assembly: NeutralResourcesLanguageAttribute("en")] -[assembly: AssemblyHash("4462224")] +[assembly: AssemblyHash("f97b0b2")] diff --git a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs index b5a132517..ec73e5d4a 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.3001")] +[assembly: AssemblyVersion("2.3.0.3002")] [assembly: NeutralResourcesLanguageAttribute("en")] diff --git a/Source/Plugins/ColorPicker/Windows/LightColorPicker.cs b/Source/Plugins/ColorPicker/Windows/LightColorPicker.cs index a07ca3929..6b951b4e8 100755 --- a/Source/Plugins/ColorPicker/Windows/LightColorPicker.cs +++ b/Source/Plugins/ColorPicker/Windows/LightColorPicker.cs @@ -8,6 +8,7 @@ using CodeImp.DoomBuilder.Windows; using CodeImp.DoomBuilder.GZBuilder; using CodeImp.DoomBuilder.VisualModes; using CodeImp.DoomBuilder.ColorPicker.Controls; +using CodeImp.DoomBuilder.Rendering; namespace CodeImp.DoomBuilder.ColorPicker.Windows { @@ -216,7 +217,13 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows //update color if(colorChanged) //need this check to allow relative mode to work properly { - if (t.DynamicLightType.LightDef == GZGeneral.LightDef.VAVOOM_COLORED) //Vavoom Light Color + if (t.DynamicLightType.LightType == GZGeneral.LightType.SPOT) + { + int c = ((int)lightProps.Red << 16) | ((int)lightProps.Green << 8) | lightProps.Blue; + t.Args[0] = 0; + t.Fields["arg0str"] = new UniValue(Types.UniversalType.String, c.ToString("X6")); + } + else if (t.DynamicLightType.LightDef == GZGeneral.LightDef.VAVOOM_COLORED) //Vavoom Light Color { t.Args[1] = lightProps.Red; t.Args[2] = lightProps.Green; @@ -324,7 +331,17 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows { if (thing.DynamicLightType.LightDef == GZGeneral.LightDef.VAVOOM_GENERIC) return Color.White; //vavoom light if (thing.DynamicLightType.LightDef == GZGeneral.LightDef.VAVOOM_COLORED) return Color.FromArgb((byte)thing.Args[1], (byte)thing.Args[2], (byte)thing.Args[3]); //vavoom colored light - if (thing.DynamicLightType.LightType == GZGeneral.LightType.SPOT) return Color.FromArgb((int)((thing.Args[0] & 0xFFFFFF) | 0xFF000000)); + if (thing.DynamicLightType.LightType == GZGeneral.LightType.SPOT) + { + if (thing.Fields.ContainsKey("arg0str")) + { + PixelColor pc; + ZDoom.ZDTextParser.GetColorFromString(thing.Fields["arg0str"].Value.ToString(), out pc); + return Color.FromArgb(255, pc.r, pc.g, pc.b); + } + + return Color.FromArgb((int)((thing.Args[0] & 0xFFFFFF) | 0xFF000000)); + } return Color.FromArgb((byte)thing.Args[0], (byte)thing.Args[1], (byte)thing.Args[2]); } -- GitLab