mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
Did some maxcode refactoring about dynamic lights; added initial spotlight support (at least they are recognized as lights now)
This commit is contained in:
parent
8375ece252
commit
d8bee559dc
15 changed files with 691 additions and 218 deletions
|
@ -586,6 +586,206 @@ gzdoom_lights
|
|||
default = 64;
|
||||
}
|
||||
}
|
||||
9840
|
||||
{
|
||||
title = "Spotlight";
|
||||
class = "SpotLight";
|
||||
arg0
|
||||
{
|
||||
title = "Color";
|
||||
default = 16777215;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Start intensity";
|
||||
default = 8;
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "End intensity";
|
||||
default = 32;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
title = "Radius";
|
||||
default = 128;
|
||||
}
|
||||
}
|
||||
9843
|
||||
{
|
||||
title = "Sector Spotlight";
|
||||
class = "SectorSpotLight";
|
||||
arg0
|
||||
{
|
||||
title = "Color";
|
||||
default = 16777215;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Start intensity";
|
||||
default = 8;
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "End intensity";
|
||||
default = 32;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
title = "Intensity scale";
|
||||
default = 4;
|
||||
}
|
||||
}
|
||||
9850
|
||||
{
|
||||
title = "Additive Spotlight";
|
||||
class = "SpotLightAdditive";
|
||||
arg0
|
||||
{
|
||||
title = "Color";
|
||||
default = 16777215;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Start intensity";
|
||||
default = 8;
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "End intensity";
|
||||
default = 32;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
title = "Radius";
|
||||
default = 128;
|
||||
}
|
||||
}
|
||||
9853
|
||||
{
|
||||
title = "Additive Sector Spotlight";
|
||||
class = "SectorSpotLightAdditive";
|
||||
arg0
|
||||
{
|
||||
title = "Color";
|
||||
default = 16777215;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Start intensity";
|
||||
default = 8;
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "End intensity";
|
||||
default = 32;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
title = "Intensity scale";
|
||||
default = 4;
|
||||
}
|
||||
}
|
||||
9860
|
||||
{
|
||||
title = "Subtractive Spotlight";
|
||||
class = "SpotLightSubtractive";
|
||||
arg0
|
||||
{
|
||||
title = "Color";
|
||||
default = 16777215;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Start intensity";
|
||||
default = 8;
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "End intensity";
|
||||
default = 32;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
title = "Radius";
|
||||
default = 128;
|
||||
}
|
||||
}
|
||||
9863
|
||||
{
|
||||
title = "Subtractive Sector Spotlight";
|
||||
class = "SectorSpotLightSubtractive";
|
||||
arg0
|
||||
{
|
||||
title = "Color";
|
||||
default = 16777215;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Start intensity";
|
||||
default = 8;
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "End intensity";
|
||||
default = 32;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
title = "Intensity scale";
|
||||
default = 4;
|
||||
}
|
||||
}
|
||||
9870
|
||||
{
|
||||
title = "Attenuated Spotlight";
|
||||
class = "SpotLightAttenuated";
|
||||
arg0
|
||||
{
|
||||
title = "Color";
|
||||
default = 16777215;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Start intensity";
|
||||
default = 8;
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "End intensity";
|
||||
default = 32;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
title = "Radius";
|
||||
default = 128;
|
||||
}
|
||||
}
|
||||
9873
|
||||
{
|
||||
title = "Attenuated Sector Spotlight";
|
||||
class = "SectorSpotLightAttenuated";
|
||||
arg0
|
||||
{
|
||||
title = "Color";
|
||||
default = 16777215;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Start intensity";
|
||||
default = 8;
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "End intensity";
|
||||
default = 32;
|
||||
}
|
||||
arg3
|
||||
{
|
||||
title = "Intensity scale";
|
||||
default = 4;
|
||||
}
|
||||
}
|
||||
1502
|
||||
{
|
||||
title = "Vavoom Light";
|
||||
|
|
|
@ -102,12 +102,18 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.title = cfg.ReadSetting(argspath + ".arg" + istr + ".title", "Argument " + (argindex + 1));
|
||||
this.tooltip = cfg.ReadSetting(argspath + ".arg" + istr + ".tooltip", string.Empty); //mxd
|
||||
this.type = cfg.ReadSetting(argspath + ".arg" + istr + ".type", 0);
|
||||
this.defaultvalue = cfg.ReadSetting(argspath + ".arg" + istr + ".default", 0); //mxd
|
||||
this.str = cfg.ReadSetting(argspath + ".arg" + istr + ".str", false);
|
||||
this.titlestr = cfg.ReadSetting(argspath + ".arg" + istr + ".titlestr", this.title);
|
||||
|
||||
//mxd. Get rendering hint settings
|
||||
string renderstyle = cfg.ReadSetting(argspath + ".arg" + istr + ".renderstyle", string.Empty);
|
||||
string dv = cfg.ReadSetting(argspath + ".arg" + istr + ".default", string.Empty);
|
||||
int dvi;
|
||||
if (int.TryParse(dv, out dvi))
|
||||
this.defaultvalue = dvi;
|
||||
else if (this.str) this.defaultvalue = dv;
|
||||
else this.defaultvalue = 0;
|
||||
|
||||
//mxd. Get rendering hint settings
|
||||
string renderstyle = cfg.ReadSetting(argspath + ".arg" + istr + ".renderstyle", string.Empty);
|
||||
switch(renderstyle.ToLowerInvariant())
|
||||
{
|
||||
case "circle":
|
||||
|
|
|
@ -26,6 +26,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Plugins;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Types;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -669,7 +670,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
ThingTypeInfo tti = General.Map.Data.GetThingInfoEx(t.Type);
|
||||
if(tti != null)
|
||||
{
|
||||
t.Args[0] = (int)tti.Args[0].DefaultValue;
|
||||
if (tti.Args[0].DefaultValue is string)
|
||||
t.Fields["arg0str"] = new UniValue(UniversalType.String, (string)tti.Args[0].DefaultValue);
|
||||
else t.Args[0] = (int)tti.Args[0].DefaultValue;
|
||||
t.Args[1] = (int)tti.Args[1].DefaultValue;
|
||||
t.Args[2] = (int)tti.Args[2].DefaultValue;
|
||||
t.Args[3] = (int)tti.Args[3].DefaultValue;
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private AmbientSoundInfo ambientsound;
|
||||
|
||||
// [ZZ] GZDoom inheritance data (DECORATE and ZScript). used for dynamic lighting.
|
||||
private int dynamiclighttype = -1;
|
||||
private GZGeneral.LightData dynamiclighttype = null;
|
||||
|
||||
// [ZZ] optional thing is a thing that can have nonexistent sprite. this is currently only used for Skulltag things.
|
||||
private bool optional;
|
||||
|
@ -151,7 +151,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public AmbientSoundInfo AmbientSound { get { return ambientsound; } internal set { ambientsound = value; } }
|
||||
|
||||
// [ZZ] GZDoom inheritance data
|
||||
public int DynamicLightType { get { return dynamiclighttype; } set { if (dynamiclighttype < 0) dynamiclighttype = value; } }
|
||||
public GZGeneral.LightData DynamicLightType { get { return dynamiclighttype; } set { if (dynamiclighttype == null) dynamiclighttype = value; } }
|
||||
|
||||
// [ZZ]
|
||||
public bool Optional { get { return optional; } }
|
||||
|
@ -271,6 +271,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
// [ZZ] optional thing sprite.
|
||||
this.optional = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".optional", cat.Optional);
|
||||
|
||||
// [ZZ] generate internal light data
|
||||
this.dynamiclighttype = GZGeneral.GetLightDataByNum(index);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
|
|
@ -4,43 +4,19 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
{
|
||||
public sealed class DynamicLightData
|
||||
{
|
||||
public DynamicLightType Type; //holds DynamicLightType
|
||||
public GZGeneral.LightData Type; //holds DynamicLightType
|
||||
public Color3 Color;
|
||||
public int PrimaryRadius;
|
||||
public int SecondaryRadius;
|
||||
public int Interval;
|
||||
public Vector3 Offset;
|
||||
public DynamicLightRenderStyle Style;
|
||||
public bool DontLightSelf;
|
||||
|
||||
public DynamicLightData()
|
||||
public DynamicLightData(GZGeneral.LightData type)
|
||||
{
|
||||
Style = DynamicLightRenderStyle.NORMAL;
|
||||
Type = type;
|
||||
Color = new Color3();
|
||||
Offset = new Vector3();
|
||||
}
|
||||
}
|
||||
|
||||
public enum DynamicLightType
|
||||
{
|
||||
NONE = -1,
|
||||
NORMAL = 0,
|
||||
PULSE = 1,
|
||||
FLICKER = 2,
|
||||
SECTOR = 3,
|
||||
RANDOM = 4,
|
||||
VAVOOM = 1502,
|
||||
VAVOOM_COLORED = 1503,
|
||||
}
|
||||
|
||||
//divide these by 100 to get light color alpha
|
||||
public enum DynamicLightRenderStyle
|
||||
{
|
||||
NEGATIVE = 100,
|
||||
NORMAL = 99,
|
||||
ATTENUATED = 98,
|
||||
VAVOOM = 50,
|
||||
ADDITIVE = 25,
|
||||
NONE = 0,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -539,24 +539,18 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
const int linealpha = 128;
|
||||
foreach(Thing t in things)
|
||||
{
|
||||
int lightid = GZGeneral.GetGZLightTypeByThing(t);
|
||||
if(lightid == -1) continue;
|
||||
GZGeneral.LightData ld = t.DynamicLightType;
|
||||
if (ld == null) continue;
|
||||
|
||||
// TODO: this basically duplicates VisualThing.UpdateLight()...
|
||||
// Determine light radiii
|
||||
int primaryradius;
|
||||
int secondaryradius = 0;
|
||||
|
||||
if(lightid < GZGeneral.GZ_LIGHT_TYPES[3]) //if it's gzdoom light
|
||||
if (ld.LightDef != GZGeneral.LightDef.VAVOOM_GENERIC &&
|
||||
ld.LightDef != GZGeneral.LightDef.VAVOOM_COLORED) //if it's gzdoom light
|
||||
{
|
||||
int n;
|
||||
if (lightid < GZGeneral.GZ_LIGHT_TYPES[0]) n = 0;
|
||||
else if (lightid < GZGeneral.GZ_LIGHT_TYPES[1]) n = 10;
|
||||
else if (lightid < GZGeneral.GZ_LIGHT_TYPES[2]) n = 20;
|
||||
else n = 30;
|
||||
DynamicLightType lightType = (DynamicLightType)(t.DynamicLightType - 9800 - n);
|
||||
|
||||
if(lightType == DynamicLightType.SECTOR)
|
||||
if(ld.LightModifier == GZGeneral.LightModifier.SECTOR)
|
||||
{
|
||||
if(t.Sector == null) t.DetermineSector();
|
||||
int scaler = (t.Sector != null ? t.Sector.Brightness / 4 : 2);
|
||||
|
@ -565,7 +559,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
else
|
||||
{
|
||||
primaryradius = t.Args[3] * 2; //works... that.. way in GZDoom
|
||||
if(lightType > 0) secondaryradius = t.Args[4] * 2;
|
||||
if (ld.LightAnimated) secondaryradius = t.Args[4] * 2;
|
||||
}
|
||||
}
|
||||
else //it's one of vavoom lights
|
||||
|
@ -584,22 +578,29 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
}
|
||||
else
|
||||
{
|
||||
switch(t.DynamicLightType)
|
||||
switch(t.DynamicLightType.LightDef)
|
||||
{
|
||||
case 1502: // Vavoom light
|
||||
case GZGeneral.LightDef.VAVOOM_GENERIC: // Vavoom light
|
||||
color = new PixelColor(linealpha, 255, 255, 255);
|
||||
break;
|
||||
|
||||
case 1503: // Vavoom colored light
|
||||
case GZGeneral.LightDef.VAVOOM_COLORED: // Vavoom colored light
|
||||
color = new PixelColor(linealpha, (byte)t.Args[1], (byte)t.Args[2], (byte)t.Args[3]);
|
||||
break;
|
||||
|
||||
case GZGeneral.LightDef.SPOT_NORMAL:
|
||||
case GZGeneral.LightDef.SPOT_ADDITIVE:
|
||||
case GZGeneral.LightDef.SPOT_SUBTRACTIVE:
|
||||
case GZGeneral.LightDef.SPOT_ATTENUATED:
|
||||
color = new PixelColor(linealpha, (byte)((t.Args[0] & 0xFF0000) >> 16), (byte)((t.Args[0] & 0x00FF00) >> 8), (byte)((t.Args[0] & 0x0000FF)));
|
||||
break;
|
||||
|
||||
default:
|
||||
color = new PixelColor(linealpha, (byte)t.Args[0], (byte)t.Args[1], (byte)t.Args[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add lines if visible
|
||||
if(primaryradius > 0) circles.AddRange(MakeCircleLines(t.Position, color, primaryradius, CIRCLE_SIDES));
|
||||
if(secondaryradius > 0) circles.AddRange(MakeCircleLines(t.Position, color, secondaryradius, CIRCLE_SIDES));
|
||||
|
|
|
@ -5,6 +5,9 @@ using CodeImp.DoomBuilder.GZBuilder.Data;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.ZDoom;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -13,20 +16,320 @@ namespace CodeImp.DoomBuilder.GZBuilder
|
|||
//mxd. should get rid of this class one day...
|
||||
public static class GZGeneral
|
||||
{
|
||||
#region ================== Properties
|
||||
#region ================== Properties
|
||||
|
||||
//gzdoom light types
|
||||
private static readonly int[] gzLights = {
|
||||
/* normal lights */ 9800, 9801, 9802, 9803, 9804,
|
||||
/* additive lights */ 9810, 9811, 9812, 9813, 9814,
|
||||
/* negative lights */ 9820, 9821, 9822, 9823, 9824,
|
||||
/* attenuated lights */ 9830, 9831, 9832, 9833, 9834,
|
||||
/* vavoom lights */ 1502, 1503};
|
||||
public static int[] GZ_LIGHTS { get { return gzLights; } }
|
||||
private static readonly int[] gzLightTypes = { 5, 10, 15, 20 }; //these are actually offsets in gz_lights
|
||||
public static int[] GZ_LIGHT_TYPES { get { return gzLightTypes; } }
|
||||
private static readonly DynamicLightType[] gzAnimatedLightTypes = { DynamicLightType.FLICKER, DynamicLightType.RANDOM, DynamicLightType.PULSE };
|
||||
public static DynamicLightType[] GZ_ANIMATED_LIGHT_TYPES { get { return gzAnimatedLightTypes; } }
|
||||
//gzdoom light types
|
||||
|
||||
public class LightDefNum : Attribute
|
||||
{
|
||||
public int[] DoomEdNums { get; private set; }
|
||||
|
||||
public LightDefNum(params int[] doomEdNums)
|
||||
{
|
||||
DoomEdNums = doomEdNums;
|
||||
}
|
||||
}
|
||||
|
||||
public class LightDefClass : Attribute
|
||||
{
|
||||
public string[] Classes { get; private set; }
|
||||
|
||||
public LightDefClass(params string[] clses)
|
||||
{
|
||||
Classes = clses;
|
||||
}
|
||||
}
|
||||
|
||||
public class LightDefModifier : Attribute
|
||||
{
|
||||
public LightModifier[] Modifiers { get; private set; }
|
||||
|
||||
public LightDefModifier(params LightModifier[] mods)
|
||||
{
|
||||
Modifiers = mods;
|
||||
}
|
||||
}
|
||||
|
||||
public class LightDefRenderStyle : Attribute
|
||||
{
|
||||
public LightRenderStyle RenderStyle { get; private set; }
|
||||
|
||||
public LightDefRenderStyle(LightRenderStyle rs)
|
||||
{
|
||||
RenderStyle = rs;
|
||||
}
|
||||
}
|
||||
|
||||
public enum LightDef
|
||||
{
|
||||
[LightDefRenderStyle(LightRenderStyle.NORMAL)]
|
||||
[LightDefNum(9800, 9801, 9802, 9803, 9804)]
|
||||
[LightDefClass("pointlight", "pointlightpulse", "pointlightflicker", "sectorpointlight", "pointlightflickerrandom")]
|
||||
[LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.SECTOR, LightModifier.FLICKERRANDOM)]
|
||||
POINT_NORMAL,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.ADDITIVE)]
|
||||
[LightDefNum(9810, 9811, 9812, 9813, 9814)]
|
||||
[LightDefClass("pointlightadditive", "pointlightpulseadditive", "pointlightflickeradditive", "sectorpointlightadditive", "pointlightflickerrandomadditive")]
|
||||
[LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.SECTOR, LightModifier.FLICKERRANDOM)]
|
||||
POINT_ADDITIVE,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.SUBTRACTIVE)]
|
||||
[LightDefNum(9820, 9821, 9822, 9823, 9824)]
|
||||
[LightDefClass("pointlightsubtractive", "pointlightpulsesubtractive", "pointlightflickersubtractive", "sectorpointlightsubtractive", "pointlightflickerrandomsubtractive")]
|
||||
[LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.SECTOR, LightModifier.FLICKERRANDOM)]
|
||||
POINT_SUBTRACTIVE,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.ATTENUATED)]
|
||||
[LightDefNum(9830, 9831, 9832, 9833, 9834)]
|
||||
[LightDefClass("pointlightattenuated", "pointlightpulseattenuated", "pointlightflickerattenuated", "sectorpointlightattenuated", "pointlightflickerrandomattenuated")]
|
||||
[LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.SECTOR, LightModifier.FLICKERRANDOM)]
|
||||
POINT_ATTENUATED,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.NORMAL)]
|
||||
[LightDefNum(9840, 9841, 9842, 9843, 8944)]
|
||||
[LightDefClass("spotlight", "spotlightpulse", "spotlightflicker", "sectorspotlight", "spotlightflickerrandom")]
|
||||
[LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.SECTOR, LightModifier.FLICKERRANDOM)]
|
||||
SPOT_NORMAL,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.ADDITIVE)]
|
||||
[LightDefNum(9850, 9851, 9852, 9853, 8954)]
|
||||
[LightDefClass("spotlightadditive", "spotlightpulseadditive", "spotlightflickeradditive", "sectorspotlightadditive", "spotlightflickerrandomadditive")]
|
||||
[LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.SECTOR, LightModifier.FLICKERRANDOM)]
|
||||
SPOT_ADDITIVE,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.SUBTRACTIVE)]
|
||||
[LightDefNum(9860, 9861, 9862, 9863, 8964)]
|
||||
[LightDefClass("spotlightsubtractive", "spotlightpulsesubtractive", "spotlightflickersubtractive", "sectorspotlightsubtractive", "spotlightflickerrandomsubtractive")]
|
||||
[LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.SECTOR, LightModifier.FLICKERRANDOM)]
|
||||
SPOT_SUBTRACTIVE,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.ATTENUATED)]
|
||||
[LightDefNum(9870, 9871, 9872, 9873, 8974)]
|
||||
[LightDefClass("spotlightattenuated", "spotlightpulseattenuated", "spotlightflickerattenuated", "sectorspotlightattenuated", "spotlightflickerrandomattenuated")]
|
||||
[LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.SECTOR, LightModifier.FLICKERRANDOM)]
|
||||
SPOT_ATTENUATED,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.VAVOOM)]
|
||||
[LightDefNum(1502)]
|
||||
[LightDefClass("vavoomlightwhite")]
|
||||
VAVOOM_GENERIC,
|
||||
|
||||
[LightDefRenderStyle(LightRenderStyle.VAVOOM)]
|
||||
[LightDefNum(1503)]
|
||||
[LightDefClass("vavoomlightcolor")]
|
||||
VAVOOM_COLORED,
|
||||
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
// divide these by 100 to get light color alpha
|
||||
// this, sadly, has to duplicate the enum in GZGeneral because it's shader-specific
|
||||
public enum LightRenderStyle
|
||||
{
|
||||
SUBTRACTIVE = 100,
|
||||
NORMAL = 99,
|
||||
ATTENUATED = 98,
|
||||
VAVOOM = 50,
|
||||
ADDITIVE = 25,
|
||||
NONE = 0,
|
||||
}
|
||||
|
||||
public enum LightModifier
|
||||
{
|
||||
NORMAL,
|
||||
PULSE,
|
||||
FLICKER,
|
||||
SECTOR,
|
||||
FLICKERRANDOM
|
||||
}
|
||||
|
||||
public enum LightType
|
||||
{
|
||||
POINT,
|
||||
SPOT,
|
||||
VAVOOM
|
||||
}
|
||||
|
||||
public static LightDefNum GetLightDefNum(LightDef d)
|
||||
{
|
||||
FieldInfo fi = typeof(LightDef).GetField(d.ToString());
|
||||
LightDefNum[] attrs = (LightDefNum[])fi.GetCustomAttributes(typeof(LightDefNum), false);
|
||||
if (attrs.Length != 0)
|
||||
return attrs[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LightDefClass GetLightDefClass(LightDef d)
|
||||
{
|
||||
FieldInfo fi = typeof(LightDef).GetField(d.ToString());
|
||||
LightDefClass[] attrs = (LightDefClass[])fi.GetCustomAttributes(typeof(LightDefClass), false);
|
||||
if (attrs.Length != 0)
|
||||
return attrs[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LightDefModifier GetLightDefModifier(LightDef d)
|
||||
{
|
||||
FieldInfo fi = typeof(LightDef).GetField(d.ToString());
|
||||
LightDefModifier[] attrs = (LightDefModifier[])fi.GetCustomAttributes(typeof(LightDefModifier), false);
|
||||
if (attrs.Length != 0)
|
||||
return attrs[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LightDefRenderStyle GetLightDefRenderStyle(LightDef d)
|
||||
{
|
||||
FieldInfo fi = typeof(LightDef).GetField(d.ToString());
|
||||
LightDefRenderStyle[] attrs = (LightDefRenderStyle[])fi.GetCustomAttributes(typeof(LightDefRenderStyle), false);
|
||||
if (attrs.Length != 0)
|
||||
return attrs[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
public class LightData
|
||||
{
|
||||
public LightDef LightDef { get; private set; }
|
||||
private LightDefNum LightDefNum;
|
||||
private LightDefClass LightDefClass;
|
||||
private LightDefModifier LightDefModifier;
|
||||
private LightDefRenderStyle LightDefRenderStyle;
|
||||
public string LightClass { get; private set; }
|
||||
public int LightNum { get; private set; }
|
||||
public LightModifier LightModifier { get; private set; }
|
||||
public LightRenderStyle LightRenderStyle { get; private set; }
|
||||
public bool LightAnimated { get; private set; }
|
||||
public bool LightInternal { get; private set; }
|
||||
public bool LightVavoom { get; private set; }
|
||||
public LightType LightType { get; private set; }
|
||||
|
||||
private void UpdateLightType()
|
||||
{
|
||||
switch (LightDef)
|
||||
{
|
||||
default:
|
||||
case LightDef.POINT_NORMAL:
|
||||
case LightDef.POINT_ADDITIVE:
|
||||
case LightDef.POINT_SUBTRACTIVE:
|
||||
case LightDef.POINT_ATTENUATED:
|
||||
LightType = LightType.POINT;
|
||||
break;
|
||||
case LightDef.SPOT_NORMAL:
|
||||
case LightDef.SPOT_ADDITIVE:
|
||||
case LightDef.SPOT_SUBTRACTIVE:
|
||||
case LightDef.SPOT_ATTENUATED:
|
||||
LightType = LightType.SPOT;
|
||||
break;
|
||||
case LightDef.VAVOOM_GENERIC:
|
||||
case LightDef.VAVOOM_COLORED:
|
||||
LightType = LightType.VAVOOM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public LightData(LightDef d, int num)
|
||||
{
|
||||
LightDef = d;
|
||||
LightNum = num;
|
||||
LightDefNum = GetLightDefNum(LightDef);
|
||||
LightDefClass = GetLightDefClass(LightDef);
|
||||
LightDefModifier = GetLightDefModifier(LightDef);
|
||||
LightDefRenderStyle = GetLightDefRenderStyle(LightDef);
|
||||
LightClass = LightDefClass.Classes[Array.IndexOf(LightDefNum.DoomEdNums, LightNum)];
|
||||
if (LightDefModifier != null)
|
||||
LightModifier = LightDefModifier.Modifiers[Array.IndexOf(LightDefNum.DoomEdNums, LightNum)];
|
||||
else LightModifier = LightModifier.NORMAL;
|
||||
if (LightDefRenderStyle != null)
|
||||
LightRenderStyle = LightDefRenderStyle.RenderStyle;
|
||||
else LightRenderStyle = LightRenderStyle.NONE;
|
||||
LightAnimated = (LightModifier == LightModifier.PULSE || LightModifier == LightModifier.FLICKER || LightModifier == LightModifier.FLICKERRANDOM);
|
||||
LightInternal = true;
|
||||
UpdateLightType();
|
||||
LightVavoom = (LightType == LightType.VAVOOM);
|
||||
}
|
||||
|
||||
public LightData(LightDef d, string cls)
|
||||
{
|
||||
LightDef = d;
|
||||
LightClass = cls;
|
||||
LightDefNum = GetLightDefNum(LightDef);
|
||||
LightDefClass = GetLightDefClass(LightDef);
|
||||
LightDefModifier = GetLightDefModifier(LightDef);
|
||||
LightDefRenderStyle = GetLightDefRenderStyle(LightDef);
|
||||
LightNum = LightDefNum.DoomEdNums[Array.IndexOf(LightDefClass.Classes, cls)];
|
||||
if (LightDefModifier != null)
|
||||
LightModifier = LightDefModifier.Modifiers[Array.IndexOf(LightDefClass.Classes, cls)];
|
||||
else LightModifier = LightModifier.NORMAL;
|
||||
if (LightDefRenderStyle != null)
|
||||
LightRenderStyle = LightDefRenderStyle.RenderStyle;
|
||||
else LightRenderStyle = LightRenderStyle.NONE;
|
||||
LightAnimated = (LightModifier == LightModifier.PULSE || LightModifier == LightModifier.FLICKER || LightModifier == LightModifier.FLICKERRANDOM);
|
||||
LightInternal = true;
|
||||
LightVavoom = (LightDef == LightDef.VAVOOM_GENERIC || LightDef == LightDef.VAVOOM_COLORED);
|
||||
UpdateLightType();
|
||||
LightVavoom = (LightType == LightType.VAVOOM);
|
||||
}
|
||||
|
||||
public LightData(LightModifier mod = LightModifier.NORMAL, LightRenderStyle rs = LightRenderStyle.NONE)
|
||||
{
|
||||
LightDef = LightDef.UNKNOWN;
|
||||
LightClass = null;
|
||||
LightNum = -1;
|
||||
LightModifier = mod;
|
||||
LightRenderStyle = rs;
|
||||
LightAnimated = (LightModifier == LightModifier.PULSE || LightModifier == LightModifier.FLICKER || LightModifier == LightModifier.FLICKERRANDOM);
|
||||
LightInternal = false;
|
||||
LightVavoom = false;
|
||||
LightType = LightType.POINT; // always point in GLDEFS
|
||||
}
|
||||
|
||||
public void SetRenderStyle(LightRenderStyle rs)
|
||||
{
|
||||
if (LightInternal)
|
||||
return;
|
||||
LightRenderStyle = rs;
|
||||
}
|
||||
}
|
||||
|
||||
static IEnumerable<LightDef> _gldbn_ldefs;
|
||||
public static LightData GetLightDataByNum(int doomednum)
|
||||
{
|
||||
if (_gldbn_ldefs == null)
|
||||
_gldbn_ldefs = Enum.GetValues(typeof(LightDef)).Cast<LightDef>();
|
||||
foreach (LightDef ldef in _gldbn_ldefs)
|
||||
{
|
||||
//
|
||||
FieldInfo fi = typeof(LightDef).GetField(ldef.ToString());
|
||||
LightDefNum[] attrs = (LightDefNum[])fi.GetCustomAttributes(typeof(LightDefNum), false);
|
||||
if (attrs.Length == 0) continue;
|
||||
//
|
||||
LightDefNum attr = attrs[0];
|
||||
if (Array.IndexOf(attr.DoomEdNums, doomednum) != -1)
|
||||
return new LightData(ldef, doomednum);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LightData GetLightDataByClass(string cls)
|
||||
{
|
||||
cls = cls.ToLowerInvariant();
|
||||
if (_gldbn_ldefs == null)
|
||||
_gldbn_ldefs = Enum.GetValues(typeof(LightDef)).Cast<LightDef>();
|
||||
foreach (LightDef ldef in _gldbn_ldefs)
|
||||
{
|
||||
//
|
||||
FieldInfo fi = typeof(LightDef).GetField(ldef.ToString());
|
||||
LightDefClass[] attrs = (LightDefClass[])fi.GetCustomAttributes(typeof(LightDefClass), false);
|
||||
if (attrs.Length == 0) continue;
|
||||
//
|
||||
LightDefClass attr = attrs[0];
|
||||
if (Array.IndexOf(attr.Classes, cls) != -1)
|
||||
return new LightData(ldef, cls);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//asc script action specials
|
||||
private static readonly int[] acsSpecials = { 80, 81, 82, 83, 84, 85, 226 };
|
||||
|
@ -34,57 +337,40 @@ namespace CodeImp.DoomBuilder.GZBuilder
|
|||
|
||||
// [ZZ] this is for proper inheritance of lights.
|
||||
// technically this can be found by parsing gzdoom.pk3/mapinfo/common.txt, but I wouldn't do that without a good reason for now.
|
||||
private static readonly string[] gzLightClasses =
|
||||
{
|
||||
/* normal lights */ "pointlight", "pointlightpulse", "pointlightflicker", "sectorpointlight", "pointlightflickerrandom",
|
||||
/* additive lights */ "pointlightadditive", "pointlightpulseadditive", "pointlightflickeradditive", "sectorpointlightadditive", "pointlightflickerrandomadditive",
|
||||
/* subtractive lights */ "pointlightsubtractive", "pointlightpulsesubtractive", "pointlightflickersubtractive", "sectorpointlightsubtractive", "pointlightflickerrandomsubtractive",
|
||||
/* attenuated lights */ "pointlightattenuated", "pointlightpulseattenuated", "pointlightflickerattenuated", "sectorpointlightattenuated", "pointlightflickerrandomattenuated",
|
||||
/* vavoom lights */ "vavoomlightwhite", "vavoomlightcolor"
|
||||
};
|
||||
|
||||
public static int GetGZLightTypeByClass(ActorStructure actor)
|
||||
public static LightData GetGZLightTypeByClass(ActorStructure actor)
|
||||
{
|
||||
int idx = -1;
|
||||
ActorStructure p = actor;
|
||||
while (p != null)
|
||||
{
|
||||
idx = Array.IndexOf(gzLightClasses, p.ClassName.ToLowerInvariant());
|
||||
if (idx != -1)
|
||||
// found dynamic light type. alter it by actor flags.
|
||||
// +MISSILEMORE makes it additive.
|
||||
// +MISSILEEVENMORE makes it subtractive.
|
||||
// +INCOMBAT makes it attenuated.
|
||||
LightData ld = GetLightDataByClass(actor.ClassName);
|
||||
if (ld != null)
|
||||
{
|
||||
// found dynamic light type. alter it by actor flags.
|
||||
// +MISSILEMORE makes it additive.
|
||||
// +MISSILEEVENMORE makes it subtractive.
|
||||
// +INCOMBAT makes it attenuated.
|
||||
int light = gzLights[idx];
|
||||
if (idx < GZ_LIGHT_TYPES[3])
|
||||
if (ld.LightDef != LightDef.VAVOOM_GENERIC && ld.LightDef != LightDef.VAVOOM_COLORED) // not vavoom
|
||||
{
|
||||
int baseType = light % 10;
|
||||
int dispType = light - baseType;
|
||||
int baseType = ld.LightNum % 10;
|
||||
int dispType = ld.LightNum - baseType;
|
||||
if (actor.GetFlagValue("MISSILEMORE", false) || actor.GetFlagValue("DYNAMICLIGHT.ADDITIVE", false))
|
||||
dispType = 9810;
|
||||
else if (actor.GetFlagValue("MISSILEEVENMORE", false) || actor.GetFlagValue("DYNAMICLIGHT.SUBTRACTIVE", false))
|
||||
dispType = 9820;
|
||||
else if (actor.GetFlagValue("INCOMBAT", false) || actor.GetFlagValue("DYNAMICLIGHT.ATTENUATE", false))
|
||||
dispType = 9830;
|
||||
return dispType + baseType;
|
||||
if (actor.GetFlagValue("DYNAMICLIGHT.SPOT", false))
|
||||
dispType += 40;
|
||||
return GetLightDataByNum(dispType + baseType);
|
||||
}
|
||||
else return light;
|
||||
else return ld;
|
||||
}
|
||||
|
||||
p = p.BaseClass;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int GetGZLightTypeByThing(Thing t)
|
||||
{
|
||||
int type = Array.IndexOf(gzLights, t.DynamicLightType);
|
||||
if (type >= 0)
|
||||
return type;
|
||||
|
||||
return -1;
|
||||
return null;
|
||||
}
|
||||
|
||||
// this is here so that I can see all dirty patches by listing references to this method.
|
||||
|
|
|
@ -26,6 +26,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Types;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using CodeImp.DoomBuilder.GZBuilder;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -56,7 +57,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
// Properties
|
||||
private int type;
|
||||
private int dynamiclighttype;
|
||||
private GZGeneral.LightData dynamiclighttype;
|
||||
private Vector3D pos;
|
||||
private int angledoom; // Angle as entered / stored in file
|
||||
private float anglerad; // Angle in radians
|
||||
|
@ -90,7 +91,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
public MapSet Map { get { return map; } }
|
||||
public int Type { get { return type; } set { BeforePropsChange(); type = value; } } //mxd
|
||||
public int DynamicLightType { get { return dynamiclighttype; } internal set { BeforePropsChange(); dynamiclighttype = value; } }
|
||||
public GZGeneral.LightData DynamicLightType { get { return dynamiclighttype; } internal set { BeforePropsChange(); dynamiclighttype = value; } }
|
||||
public Vector3D Position { get { return pos; } }
|
||||
public float ScaleX { get { return scaleX; } } //mxd. This is UDMF property, not actual scale!
|
||||
public float ScaleY { get { return scaleY; } } //mxd. This is UDMF property, not actual scale!
|
||||
|
@ -526,7 +527,10 @@ namespace CodeImp.DoomBuilder.Map
|
|||
ThingTypeInfo ti = General.Map.Data.GetThingInfo(type);
|
||||
|
||||
// Apply size
|
||||
dynamiclighttype = (Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, type)!=-1) ? type : ti.DynamicLightType;
|
||||
dynamiclighttype = GZGeneral.GetGZLightTypeByClass(ti.Actor);
|
||||
if (dynamiclighttype == null)
|
||||
dynamiclighttype = ti.DynamicLightType;
|
||||
//General.ErrorLogger.Add(ErrorType.Warning, string.Format("thing dynamiclighttype is {0}; class is {1}", dynamiclighttype, ti.Actor.ClassName));
|
||||
size = ti.Radius;
|
||||
height = ti.Height; //mxd
|
||||
fixedsize = ti.FixedSize;
|
||||
|
|
|
@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2993")]
|
||||
[assembly: AssemblyVersion("2.3.0.2994")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
[assembly: AssemblyHash("1d36d3f")]
|
||||
[assembly: AssemblyHash("8375ece")]
|
||||
|
|
|
@ -27,6 +27,7 @@ using CodeImp.DoomBuilder.Data;
|
|||
using CodeImp.DoomBuilder.Editing;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Data; //mxd
|
||||
using CodeImp.DoomBuilder.Config; //mxd
|
||||
using CodeImp.DoomBuilder.GZBuilder;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -542,12 +543,14 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(t.Selected) return General.Colors.Selection;
|
||||
|
||||
//mxd. If thing is light, set it's color to light color:
|
||||
if(GZBuilder.GZGeneral.GetGZLightTypeByThing(t) != -1)
|
||||
if(t.DynamicLightType != null)
|
||||
{
|
||||
if(t.DynamicLightType == 1502) //vavoom light
|
||||
if (t.DynamicLightType.LightDef == GZGeneral.LightDef.VAVOOM_GENERIC) //vavoom light
|
||||
return new PixelColor(255, 255, 255, 255);
|
||||
if(t.DynamicLightType == 1503) //vavoom colored light
|
||||
if (t.DynamicLightType.LightDef == GZGeneral.LightDef.VAVOOM_COLORED) //vavoom colored light
|
||||
return new PixelColor(255, (byte)t.Args[1], (byte)t.Args[2], (byte)t.Args[3]);
|
||||
if (t.DynamicLightType.LightType == GZGeneral.LightType.SPOT)
|
||||
return new PixelColor(255, (byte)((t.Args[0] & 0xFF0000) >> 16), (byte)((t.Args[0] & 0x00FF00) >> 8), (byte)((t.Args[0] & 0x0000FF)));
|
||||
return new PixelColor(255, (byte)t.Args[0], (byte)t.Args[1], (byte)t.Args[2]);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using SlimDX;
|
||||
using SlimDX.Direct3D9;
|
||||
using CodeImp.DoomBuilder.GZBuilder;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -576,18 +577,18 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
lightthings = tl;
|
||||
|
||||
// Sort things by light render style
|
||||
lightthings.Sort((t1, t2) => Math.Sign(t1.LightRenderStyle - t2.LightRenderStyle));
|
||||
lightthings.Sort((t1, t2) => Math.Sign(t1.LightType.LightRenderStyle - t2.LightType.LightRenderStyle));
|
||||
lightOffsets = new int[4];
|
||||
|
||||
foreach(VisualThing t in lightthings)
|
||||
{
|
||||
//add light to apropriate array.
|
||||
switch(t.LightRenderStyle)
|
||||
switch(t.LightType.LightRenderStyle)
|
||||
{
|
||||
case DynamicLightRenderStyle.NORMAL:
|
||||
case DynamicLightRenderStyle.VAVOOM: lightOffsets[0]++; break;
|
||||
case DynamicLightRenderStyle.ADDITIVE: lightOffsets[2]++; break;
|
||||
case DynamicLightRenderStyle.NEGATIVE: lightOffsets[3]++; break;
|
||||
case GZGeneral.LightRenderStyle.NORMAL:
|
||||
case GZGeneral.LightRenderStyle.VAVOOM: lightOffsets[0]++; break;
|
||||
case GZGeneral.LightRenderStyle.ADDITIVE: lightOffsets[2]++; break;
|
||||
case GZGeneral.LightRenderStyle.SUBTRACTIVE: lightOffsets[3]++; break;
|
||||
default: lightOffsets[1]++; break; // attenuated
|
||||
}
|
||||
}
|
||||
|
@ -911,7 +912,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = CreateThingPositionMatrix(t);
|
||||
|
||||
//mxd. If current thing is light - set it's color to light color
|
||||
if(GZBuilder.GZGeneral.GetGZLightTypeByThing(t.Thing) != -1 && !fullbrightness)
|
||||
if(t.LightType != null && t.LightType.LightInternal && !fullbrightness)
|
||||
{
|
||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||
vertexcolor = t.LightColor;
|
||||
|
@ -1219,7 +1220,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = CreateThingPositionMatrix(t);
|
||||
|
||||
//mxd. If current thing is light - set it's color to light color
|
||||
if(GZBuilder.GZGeneral.GetGZLightTypeByThing(t.Thing) != -1 && !fullbrightness)
|
||||
if(t.LightType != null && t.LightType.LightInternal && !fullbrightness)
|
||||
{
|
||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||
vertexcolor = t.LightColor;
|
||||
|
@ -1771,7 +1772,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
float radiusSquared = lt.LightRadius * lt.LightRadius;
|
||||
if(distSquared < radiusSquared)
|
||||
{
|
||||
int sign = (lt.LightRenderStyle == DynamicLightRenderStyle.NEGATIVE ? -1 : 1);
|
||||
int sign = (lt.LightType.LightRenderStyle == GZGeneral.LightRenderStyle.SUBTRACTIVE ? -1 : 1);
|
||||
float scaler = 1 - distSquared / radiusSquared * lt.LightColor.Alpha;
|
||||
litColor.Red += lt.LightColor.Red * scaler * sign;
|
||||
litColor.Green += lt.LightColor.Green * scaler * sign;
|
||||
|
@ -1854,12 +1855,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
public void AddThingGeometry(VisualThing t)
|
||||
{
|
||||
//mxd. Gather lights
|
||||
if (General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && t.LightType != DynamicLightType.NONE)
|
||||
if (General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && t.LightType != null && t.LightType.LightInternal)
|
||||
{
|
||||
t.UpdateLightRadius();
|
||||
if (t.LightRadius > 0)
|
||||
{
|
||||
if (Array.IndexOf(GZBuilder.GZGeneral.GZ_ANIMATED_LIGHT_TYPES, t.LightType) != -1)
|
||||
if (t.LightType != null && t.LightType.LightAnimated)
|
||||
t.UpdateBoundingBox();
|
||||
lightthings.Add(t);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ using CodeImp.DoomBuilder.Rendering;
|
|||
using SlimDX;
|
||||
using SlimDX.Direct3D9;
|
||||
using Plane = CodeImp.DoomBuilder.Geometry.Plane;
|
||||
using CodeImp.DoomBuilder.GZBuilder;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -81,8 +82,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
protected float thingheight;
|
||||
|
||||
//mxd. light properties
|
||||
private DynamicLightType lightType;
|
||||
private DynamicLightRenderStyle lightRenderStyle;
|
||||
private GZGeneral.LightData lightType;
|
||||
private Color4 lightColor;
|
||||
private float lightRadius; //current radius. used in light animation
|
||||
private float lightPrimaryRadius;
|
||||
|
@ -121,7 +121,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
get
|
||||
{
|
||||
if (isGldefsLight) return position_v3 + lightOffset;
|
||||
else if (GZBuilder.GZGeneral.GetGZLightTypeByThing(Thing) >= 0) return position_v3; // fixes GZDoomBuilder-Bugfix#137
|
||||
else if (Thing.DynamicLightType != null) return position_v3; // fixes GZDoomBuilder-Bugfix#137
|
||||
return new Vector3(position_v3.X, position_v3.Y, position_v3.Z + thingheight / 2f);
|
||||
}
|
||||
}
|
||||
|
@ -131,9 +131,8 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
public Vector3D[] BoundingBox { get { return boundingBox; } }
|
||||
|
||||
//mxd. light properties
|
||||
public DynamicLightType LightType { get { return lightType; } }
|
||||
public GZGeneral.LightData LightType { get { return lightType; } }
|
||||
public float LightRadius { get { return lightRadius; } }
|
||||
public DynamicLightRenderStyle LightRenderStyle { get { return lightRenderStyle; } }
|
||||
public Color4 LightColor { get { return lightColor; } }
|
||||
|
||||
// [ZZ]
|
||||
|
@ -176,9 +175,8 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
this.renderpass = RenderPass.Mask;
|
||||
this.position = Matrix.Identity;
|
||||
|
||||
//mxd
|
||||
lightType = DynamicLightType.NONE;
|
||||
lightRenderStyle = DynamicLightRenderStyle.NONE;
|
||||
//mxd
|
||||
lightType = null;
|
||||
lightPrimaryRadius = -1;
|
||||
lightSecondaryRadius = -1;
|
||||
lightInterval = -1;
|
||||
|
@ -267,7 +265,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
updatecage = true; //mxd
|
||||
|
||||
//mxd. update bounding box?
|
||||
if(lightType != DynamicLightType.NONE && lightRadius > thing.Size)
|
||||
if (lightType != null && lightRadius > thing.Size)
|
||||
{
|
||||
UpdateBoundingBox(lightRadius, lightRadius * 2);
|
||||
}
|
||||
|
@ -619,13 +617,11 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
protected void CheckLightState()
|
||||
{
|
||||
//mxd. Check if thing is light
|
||||
int light_id = GZBuilder.GZGeneral.GetGZLightTypeByThing(thing);
|
||||
if (light_id != -1)
|
||||
if (thing.DynamicLightType != null)
|
||||
{
|
||||
isGldefsLight = false;
|
||||
lightInterval = -1;
|
||||
UpdateLight(light_id);
|
||||
UpdateBoundingBox(lightRadius, lightRadius * 2);
|
||||
UpdateLight();
|
||||
}
|
||||
//check if we have light from GLDEFS
|
||||
else if(General.Map.Data.GldefsEntries.ContainsKey(thing.Type))
|
||||
|
@ -638,73 +634,65 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
UpdateBoundingBox((int)thing.Size, thingheight);
|
||||
|
||||
lightType = DynamicLightType.NONE;
|
||||
lightType = null;
|
||||
lightRadius = -1;
|
||||
lightPrimaryRadius = -1;
|
||||
lightSecondaryRadius = -1;
|
||||
lightRenderStyle = DynamicLightRenderStyle.NONE;
|
||||
lightInterval = -1;
|
||||
isGldefsLight = false;
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Used in ColorPicker to update light
|
||||
public void UpdateLight()
|
||||
{
|
||||
int light_id = GZBuilder.GZGeneral.GetGZLightTypeByThing(thing);
|
||||
if (light_id != -1)
|
||||
{
|
||||
UpdateLight(light_id);
|
||||
UpdateBoundingBox(lightRadius, lightRadius * 2);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Update light info
|
||||
private void UpdateLight(int lightId)
|
||||
public void UpdateLight()
|
||||
{
|
||||
if(lightId < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[3]) //if it's gzdoom light
|
||||
{
|
||||
int n;
|
||||
if(lightId < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[0]) // normal
|
||||
{
|
||||
n = 0;
|
||||
lightRenderStyle = DynamicLightRenderStyle.NORMAL;
|
||||
//lightColor.Alpha used in shader to perform some calculations based on light type
|
||||
lightColor = new Color4((float)lightRenderStyle / 100.0f,
|
||||
thing.Args[0] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[1] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[2] / DYNLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
else if(lightId < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[1]) // additive
|
||||
{
|
||||
n = 10;
|
||||
lightRenderStyle = DynamicLightRenderStyle.ADDITIVE;
|
||||
lightColor = new Color4((float)lightRenderStyle / 100.0f,
|
||||
thing.Args[0] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[1] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[2] / DYNLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
else if (lightId < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[2]) // negative
|
||||
{
|
||||
n = 20;
|
||||
lightRenderStyle = DynamicLightRenderStyle.NEGATIVE;
|
||||
lightColor = new Color4((float)lightRenderStyle / 100.0f,
|
||||
thing.Args[0] / SUBLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[1] / SUBLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[2] / SUBLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
lightType = thing.DynamicLightType;
|
||||
if (lightType == null)
|
||||
return;
|
||||
GZGeneral.LightData ld = lightType;
|
||||
if (ld.LightDef != GZGeneral.LightDef.VAVOOM_GENERIC &&
|
||||
ld.LightDef != GZGeneral.LightDef.VAVOOM_COLORED) //if it's gzdoom light
|
||||
{
|
||||
if (ld.LightType == GZGeneral.LightType.POINT)
|
||||
{
|
||||
if (ld.LightDef != GZGeneral.LightDef.POINT_SUBTRACTIVE) // normal, additive, attenuated
|
||||
{
|
||||
//lightColor.Alpha used in shader to perform some calculations based on light type
|
||||
lightColor = new Color4((float)ld.LightRenderStyle / 100.0f,
|
||||
thing.Args[0] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[1] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[2] / DYNLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
else // negative
|
||||
{
|
||||
lightColor = new Color4((float)ld.LightRenderStyle / 100.0f,
|
||||
thing.Args[0] / SUBLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[1] / SUBLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[2] / SUBLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
n = 30;
|
||||
lightRenderStyle = DynamicLightRenderStyle.ATTENUATED;
|
||||
lightColor = new Color4((float)lightRenderStyle / 100.0f,
|
||||
thing.Args[0] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[1] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[2] / DYNLIGHT_INTENSITY_SCALER);
|
||||
int c1 = (thing.Args[0] & 0xFF0000) >> 16;
|
||||
int c2 = (thing.Args[0] & 0x00FF00) >> 8;
|
||||
int c3 = (thing.Args[0] & 0x0000FF);
|
||||
if (ld.LightDef != GZGeneral.LightDef.SPOT_SUBTRACTIVE)
|
||||
{
|
||||
lightColor = new Color4((float)ld.LightRenderStyle / 100.0f,
|
||||
c1 / DYNLIGHT_INTENSITY_SCALER,
|
||||
c2 / DYNLIGHT_INTENSITY_SCALER,
|
||||
c3 / DYNLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
else
|
||||
{
|
||||
lightColor = new Color4((float)ld.LightRenderStyle / 100.0f,
|
||||
c1 / SUBLIGHT_INTENSITY_SCALER,
|
||||
c2 / SUBLIGHT_INTENSITY_SCALER,
|
||||
c3 / SUBLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
}
|
||||
lightType = (DynamicLightType)(thing.DynamicLightType - 9800 - n);
|
||||
|
||||
if(lightType == DynamicLightType.SECTOR)
|
||||
if(lightType.LightModifier == GZGeneral.LightModifier.SECTOR)
|
||||
{
|
||||
int scaler = 1;
|
||||
if(thing.Sector != null) scaler = thing.Sector.Brightness / 4;
|
||||
|
@ -713,44 +701,44 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
else
|
||||
{
|
||||
lightPrimaryRadius = (thing.Args[3] * 2); //works... that.. way in GZDoom
|
||||
if(lightType > 0) lightSecondaryRadius = (thing.Args[4] * 2);
|
||||
if (lightType.LightAnimated)
|
||||
lightSecondaryRadius = (thing.Args[4] * 2);
|
||||
}
|
||||
}
|
||||
else //it's one of vavoom lights
|
||||
{
|
||||
lightRenderStyle = DynamicLightRenderStyle.VAVOOM;
|
||||
lightType = (DynamicLightType)thing.DynamicLightType;
|
||||
if(lightType == DynamicLightType.VAVOOM_COLORED)
|
||||
if(lightType.LightDef == GZGeneral.LightDef.VAVOOM_COLORED)
|
||||
{
|
||||
lightColor = new Color4((float)lightRenderStyle / 100.0f,
|
||||
lightColor = new Color4((float)ld.LightRenderStyle / 100.0f,
|
||||
thing.Args[1] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[2] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[3] / DYNLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
else
|
||||
{
|
||||
lightColor = new Color4((float)lightRenderStyle / 100.0f, 0.5f, 0.5f, 0.5f);
|
||||
lightColor = new Color4((float)ld.LightRenderStyle / 100.0f, 0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
lightPrimaryRadius = (thing.Args[0] * 8);
|
||||
}
|
||||
|
||||
UpdateLightRadius();
|
||||
}
|
||||
UpdateBoundingBox(lightRadius, lightRadius * 2);
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void UpdateGldefsLight()
|
||||
{
|
||||
DynamicLightData light = General.Map.Data.GldefsEntries[thing.Type];
|
||||
GZGeneral.LightData ld = light.Type;
|
||||
|
||||
//apply settings
|
||||
lightRenderStyle = light.Style;
|
||||
lightColor = new Color4((float)lightRenderStyle / 100.0f, light.Color.Red, light.Color.Green, light.Color.Blue);
|
||||
lightColor = new Color4((float)ld.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);
|
||||
lightType = light.Type;
|
||||
|
||||
if(lightType == DynamicLightType.SECTOR)
|
||||
if(ld.LightModifier == GZGeneral.LightModifier.SECTOR)
|
||||
{
|
||||
lightPrimaryRadius = light.Interval * thing.Sector.Brightness / 5.0f;
|
||||
}
|
||||
|
@ -773,9 +761,9 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
//mxd
|
||||
private void UpdateLightRadius(int interval)
|
||||
{
|
||||
if(lightType == DynamicLightType.NONE) return;
|
||||
if(lightType == null) return;
|
||||
|
||||
if(General.Settings.GZDrawLightsMode == LightRenderMode.ALL || Array.IndexOf(GZBuilder.GZGeneral.GZ_ANIMATED_LIGHT_TYPES, lightType) == -1)
|
||||
if(General.Settings.GZDrawLightsMode == LightRenderMode.ALL || !lightType.LightAnimated)
|
||||
{
|
||||
lightRadius = lightPrimaryRadius;
|
||||
return;
|
||||
|
@ -791,14 +779,14 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
float rMax = Math.Max(lightPrimaryRadius, lightSecondaryRadius);
|
||||
float diff = rMax - rMin;
|
||||
|
||||
switch(lightType)
|
||||
switch(lightType.LightModifier)
|
||||
{
|
||||
case DynamicLightType.PULSE:
|
||||
case GZGeneral.LightModifier.PULSE:
|
||||
lightDelta = ((float)Math.Sin(Clock.CurrentTime / (interval * 4.0f)) + 1.0f) / 2.0f; //just playing by the eye here... in [0.0 ... 1.0] interval
|
||||
lightRadius = rMin + diff * lightDelta;
|
||||
break;
|
||||
|
||||
case DynamicLightType.FLICKER:
|
||||
case GZGeneral.LightModifier.FLICKER:
|
||||
float fdelta = (float)Math.Sin(Clock.CurrentTime / 0.1f); //just playing by the eye here...
|
||||
if(Math.Sign(fdelta) != Math.Sign(lightDelta))
|
||||
{
|
||||
|
@ -807,7 +795,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
}
|
||||
break;
|
||||
|
||||
case DynamicLightType.RANDOM:
|
||||
case GZGeneral.LightModifier.FLICKERRANDOM:
|
||||
float rdelta = (float)Math.Sin(Clock.CurrentTime / (interval * 9.0f)); //just playing by the eye here...
|
||||
if(Math.Sign(rdelta) != Math.Sign(lightDelta))
|
||||
{
|
||||
|
@ -821,7 +809,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
//mxd. update bounding box
|
||||
public void UpdateBoundingBox()
|
||||
{
|
||||
if(lightType != DynamicLightType.NONE && lightRadius > thing.Size)
|
||||
if(lightType != null && lightRadius > thing.Size)
|
||||
UpdateBoundingBox(lightRadius, lightRadius * 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ using CodeImp.DoomBuilder.Data;
|
|||
using CodeImp.DoomBuilder.GZBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.GZBuilder;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -33,7 +34,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
public const string FLICKER2 = "flickerlight2";
|
||||
public const string SECTOR = "sectorlight";
|
||||
|
||||
public static readonly Dictionary<string, DynamicLightType> GLDEFS_TO_GZDOOM_LIGHT_TYPE = new Dictionary<string, DynamicLightType>(StringComparer.Ordinal) { { POINT, DynamicLightType.NORMAL }, { PULSE, DynamicLightType.PULSE }, { FLICKER, DynamicLightType.FLICKER }, { FLICKER2, DynamicLightType.RANDOM }, { SECTOR, DynamicLightType.SECTOR } };
|
||||
public static readonly Dictionary<string, GZGeneral.LightModifier> GLDEFS_TO_GZDOOM_LIGHT_TYPE = new Dictionary<string, GZGeneral.LightModifier>(StringComparer.Ordinal) { { POINT, GZGeneral.LightModifier.NORMAL }, { PULSE, GZGeneral.LightModifier.PULSE }, { FLICKER, GZGeneral.LightModifier.FLICKER }, { FLICKER2, GZGeneral.LightModifier.FLICKERRANDOM }, { SECTOR, GZGeneral.LightModifier.SECTOR } };
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -157,7 +158,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
|
||||
private bool ParseLight(string lighttype)
|
||||
{
|
||||
DynamicLightData light = new DynamicLightData { Type = GldefsLightType.GLDEFS_TO_GZDOOM_LIGHT_TYPE[lighttype] };
|
||||
DynamicLightData light = new DynamicLightData(new GZGeneral.LightData(GldefsLightType.GLDEFS_TO_GZDOOM_LIGHT_TYPE[lighttype]));
|
||||
|
||||
// Find classname
|
||||
SkipWhitespace(true);
|
||||
|
@ -288,7 +289,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
ReportError("Expected Offset Z value, but got \"" + token + "\"");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case "subtractive":
|
||||
{
|
||||
|
@ -303,9 +304,9 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
return false;
|
||||
}
|
||||
|
||||
light.Style = (i == 1) ? DynamicLightRenderStyle.NEGATIVE : DynamicLightRenderStyle.NORMAL;
|
||||
}
|
||||
break;
|
||||
light.Type.SetRenderStyle((i == 1) ? GZGeneral.LightRenderStyle.SUBTRACTIVE : GZGeneral.LightRenderStyle.NORMAL);
|
||||
break;
|
||||
}
|
||||
|
||||
case "attenuate":
|
||||
{
|
||||
|
@ -320,9 +321,9 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
return false;
|
||||
}
|
||||
|
||||
light.Style = (i == 1) ? DynamicLightRenderStyle.ATTENUATED : DynamicLightRenderStyle.NORMAL;
|
||||
light.Type.SetRenderStyle((i == 1) ? GZGeneral.LightRenderStyle.ATTENUATED : GZGeneral.LightRenderStyle.NORMAL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "dontlightself":
|
||||
{
|
||||
|
@ -474,13 +475,13 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
bool skip = (light.Color.Red == 0.0f && light.Color.Green == 0.0f && light.Color.Blue == 0.0f);
|
||||
|
||||
// Light-type specific checks
|
||||
if(light.Type == DynamicLightType.NORMAL && light.PrimaryRadius == 0)
|
||||
if(light.Type.LightModifier == GZGeneral.LightModifier.NORMAL && light.PrimaryRadius == 0)
|
||||
{
|
||||
LogWarning("\"" + lightname + "\" light Size is 0. It won't be shown in GZDoom");
|
||||
skip = true;
|
||||
}
|
||||
|
||||
if(light.Type == DynamicLightType.FLICKER || light.Type == DynamicLightType.PULSE || light.Type == DynamicLightType.RANDOM)
|
||||
if(light.Type.LightAnimated)
|
||||
{
|
||||
if(light.PrimaryRadius == 0 && light.SecondaryRadius == 0)
|
||||
{
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Resources;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2993")]
|
||||
[assembly: AssemblyVersion("2.3.0.2994")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
|
||||
foreach(VisualThing t in selectedVisualThings)
|
||||
{
|
||||
if(GZGeneral.GetGZLightTypeByThing(t.Thing) != -1)
|
||||
if (t.LightType != null && t.LightType.LightInternal)
|
||||
{
|
||||
selection.Add(t.Thing);
|
||||
visualSelection.Add(t);
|
||||
|
@ -114,7 +114,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
ICollection<Thing> list = General.Map.Map.GetSelectedThings(true);
|
||||
foreach(Thing t in list)
|
||||
{
|
||||
if(GZGeneral.GetGZLightTypeByThing(t) != -1)
|
||||
if (t.DynamicLightType != null)
|
||||
selection.Add(t);
|
||||
}
|
||||
}
|
||||
|
@ -124,9 +124,9 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
//this is called only once
|
||||
private void SetupSliders(Thing referenceThing)
|
||||
{
|
||||
ThingTypeInfo typeInfo = General.Map.Data.GetThingInfoEx(referenceThing.DynamicLightType);
|
||||
ThingTypeInfo typeInfo = General.Map.Data.GetThingInfoEx(referenceThing.DynamicLightType.LightNum);
|
||||
int firstArg = 3;
|
||||
if(referenceThing.DynamicLightType == 1502 || referenceThing.DynamicLightType == 1503)
|
||||
if(referenceThing.DynamicLightType.LightVavoom)
|
||||
firstArg = 0;
|
||||
|
||||
//first slider is always used
|
||||
|
@ -170,7 +170,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
|
||||
//size
|
||||
int firstArg = 3;
|
||||
if(referenceThing.DynamicLightType == 1502 || referenceThing.DynamicLightType == 1503)
|
||||
if (referenceThing.DynamicLightType.LightVavoom)
|
||||
firstArg = 0;
|
||||
|
||||
lightProps.PrimaryRadius = referenceThing.Args[firstArg];
|
||||
|
@ -216,13 +216,13 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
//update color
|
||||
if(colorChanged) //need this check to allow relative mode to work properly
|
||||
{
|
||||
if(t.DynamicLightType == 1503) //Vavoom Light Color
|
||||
if (t.DynamicLightType.LightDef == GZGeneral.LightDef.VAVOOM_COLORED) //Vavoom Light Color
|
||||
{
|
||||
t.Args[1] = lightProps.Red;
|
||||
t.Args[2] = lightProps.Green;
|
||||
t.Args[3] = lightProps.Blue;
|
||||
}
|
||||
else if(t.DynamicLightType != 1502) //vavoom light has no color settings
|
||||
else if (t.DynamicLightType.LightDef != GZGeneral.LightDef.VAVOOM_GENERIC) //vavoom light has no color settings
|
||||
{
|
||||
t.Args[0] = lightProps.Red;
|
||||
t.Args[1] = lightProps.Green;
|
||||
|
@ -231,7 +231,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
}
|
||||
|
||||
int firstArg = 3;
|
||||
if(t.DynamicLightType == 1502 || t.DynamicLightType == 1503) firstArg = 0;
|
||||
if (t.DynamicLightType.LightVavoom) firstArg = 0;
|
||||
|
||||
//update radius and intensity
|
||||
if(RELATIVE_MODE)
|
||||
|
@ -322,8 +322,9 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
//this is called only once
|
||||
private static Color GetThingColor(Thing thing)
|
||||
{
|
||||
if(thing.DynamicLightType == 1502) return Color.White; //vavoom light
|
||||
if(thing.DynamicLightType == 1503) return Color.FromArgb((byte)thing.Args[1], (byte)thing.Args[2], (byte)thing.Args[3]); //vavoom colored light
|
||||
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));
|
||||
return Color.FromArgb((byte)thing.Args[0], (byte)thing.Args[1], (byte)thing.Args[2]);
|
||||
}
|
||||
|
||||
|
@ -337,7 +338,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
Thing t = selection[i];
|
||||
LightProps lp = new LightProps();
|
||||
int firstArg = 3;
|
||||
if(t.DynamicLightType == 1502 || t.DynamicLightType == 1503) firstArg = 0;
|
||||
if (t.DynamicLightType.LightVavoom) firstArg = 0;
|
||||
lp.PrimaryRadius = t.Args[firstArg];
|
||||
|
||||
//either both of them or none are used
|
||||
|
|
Loading…
Reference in a new issue