mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 13:51:40 +00:00
Fixed: inheritance from game configuration for dynamic lights; Fixed: visual representation of inherited lights (reported by Nash); Fixed: inherited thing arguments from game configuration; Added: //$ClearArgs for clearing inherited arguments.
This commit is contained in:
parent
125844b308
commit
748fe9e2e5
15 changed files with 288 additions and 114 deletions
|
@ -16,6 +16,7 @@ gzdoom_lights
|
|||
9800
|
||||
{
|
||||
title = "Light";
|
||||
class = "PointLight";
|
||||
arg0
|
||||
{
|
||||
title = "Red";
|
||||
|
@ -40,6 +41,7 @@ gzdoom_lights
|
|||
9801
|
||||
{
|
||||
title = "Pulse Light";
|
||||
class = "PointLightPulse";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -70,6 +72,7 @@ gzdoom_lights
|
|||
9802
|
||||
{
|
||||
title = "Flicker Light";
|
||||
class = "PointLightFlicker";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -100,6 +103,7 @@ gzdoom_lights
|
|||
9803
|
||||
{
|
||||
title = "Sector Light";
|
||||
class = "SectorPointLight";
|
||||
arg0
|
||||
{
|
||||
title = "Red";
|
||||
|
@ -124,6 +128,7 @@ gzdoom_lights
|
|||
9804
|
||||
{
|
||||
title = "Random Light";
|
||||
class = "PointLightFlickerRandom";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -154,6 +159,7 @@ gzdoom_lights
|
|||
9810
|
||||
{
|
||||
title = "Additive Light";
|
||||
class = "PointLightAdditive";
|
||||
arg0
|
||||
{
|
||||
title = "Red";
|
||||
|
@ -178,6 +184,7 @@ gzdoom_lights
|
|||
9811
|
||||
{
|
||||
title = "Additive Pulse Light";
|
||||
class = "PointLightPulseAdditive";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -208,6 +215,7 @@ gzdoom_lights
|
|||
9812
|
||||
{
|
||||
title = "Additive Flicker Light";
|
||||
class = "PointLightFlickerAdditive";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -238,6 +246,7 @@ gzdoom_lights
|
|||
9813
|
||||
{
|
||||
title = "Additive Sector Light";
|
||||
class = "SectorPointLightAdditive";
|
||||
arg0
|
||||
{
|
||||
title = "Red";
|
||||
|
@ -262,6 +271,7 @@ gzdoom_lights
|
|||
9814
|
||||
{
|
||||
title = "Additive Random Light";
|
||||
class = "PointLightFlickerRandomAdditive";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -292,6 +302,7 @@ gzdoom_lights
|
|||
9820
|
||||
{
|
||||
title = "Subtractive Light";
|
||||
class = "PointLightSubtractive";
|
||||
arg0
|
||||
{
|
||||
title = "Red";
|
||||
|
@ -316,6 +327,7 @@ gzdoom_lights
|
|||
9821
|
||||
{
|
||||
title = "Subtractive Pulse Light";
|
||||
class = "PointLightPulseSubtractive";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -346,6 +358,7 @@ gzdoom_lights
|
|||
9822
|
||||
{
|
||||
title = "Subtractive Flicker Light";
|
||||
class = "PointLightFlickerSubtractive";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -376,6 +389,7 @@ gzdoom_lights
|
|||
9823
|
||||
{
|
||||
title = "Subtractive Sector Light";
|
||||
class = "SectorPointLightSubtractive";
|
||||
arg0
|
||||
{
|
||||
title = "Red";
|
||||
|
@ -400,6 +414,7 @@ gzdoom_lights
|
|||
9824
|
||||
{
|
||||
title = "Subtractive Random Light";
|
||||
class = "PointLightFlickerRandomSubtractive";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -431,6 +446,7 @@ gzdoom_lights
|
|||
9830
|
||||
{
|
||||
title = "Attenuated Light";
|
||||
class = "PointLightAttenuated";
|
||||
arg0
|
||||
{
|
||||
title = "Red";
|
||||
|
@ -455,6 +471,7 @@ gzdoom_lights
|
|||
9831
|
||||
{
|
||||
title = "Attenuated Pulse Light";
|
||||
class = "PointLightPulseAttenuated";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -485,6 +502,7 @@ gzdoom_lights
|
|||
9832
|
||||
{
|
||||
title = "Attenuated Flicker Light";
|
||||
class = "PointLightFlickerAttenuated";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -515,6 +533,7 @@ gzdoom_lights
|
|||
9833
|
||||
{
|
||||
title = "Attenuated Sector Light";
|
||||
class = "SectorPointLightAttenuated";
|
||||
arg0
|
||||
{
|
||||
title = "Red";
|
||||
|
@ -539,6 +558,7 @@ gzdoom_lights
|
|||
9834
|
||||
{
|
||||
title = "Attenuated Random Light";
|
||||
class = "PointLightFlickerRandomAttenuated";
|
||||
fixedrotation = true;
|
||||
arg0
|
||||
{
|
||||
|
@ -569,6 +589,7 @@ gzdoom_lights
|
|||
1502
|
||||
{
|
||||
title = "Vavoom Light";
|
||||
class = "VavoomLightWhite";
|
||||
arg0
|
||||
{
|
||||
title = "Radius";
|
||||
|
@ -578,6 +599,7 @@ gzdoom_lights
|
|||
1503
|
||||
{
|
||||
title = "Vavoom Light Color";
|
||||
class = "VavoomLightColor";
|
||||
arg0
|
||||
{
|
||||
title = "Radius";
|
||||
|
|
|
@ -242,10 +242,42 @@ namespace CodeImp.DoomBuilder.Config
|
|||
}
|
||||
|
||||
//mxd. Constructor for an argument info defined in DECORATE
|
||||
internal ArgumentInfo(string actorname, string argtitle, string tooltip, string renderstyle, string rendercolor,
|
||||
string minrange, string minrangecolor, string maxrange, string maxrangecolor, string targetclasses,
|
||||
int type, int defaultvalue, string enumstr, IDictionary<string, EnumList> enums, bool str, string argtitlestr)
|
||||
{
|
||||
// [ZZ] Constructor for an argument info defined in DECORATE/ZScript. reworked.
|
||||
internal ArgumentInfo(ActorStructure actor, int i)
|
||||
{
|
||||
if(!actor.HasPropertyWithValue("$arg" + i))
|
||||
{
|
||||
used = false;
|
||||
return;
|
||||
}
|
||||
|
||||
string argtitle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i));
|
||||
string tooltip = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "tooltip").Replace("\\n", Environment.NewLine));
|
||||
int type = actor.GetPropertyValueInt("$arg" + i + "type", 0);
|
||||
string targetclasses = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "targetclasses"));
|
||||
int defaultvalue = actor.GetPropertyValueInt("$arg" + i + "default", 0);
|
||||
string enumstr = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "enum"));
|
||||
string renderstyle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "renderstyle"));
|
||||
string rendercolor, minrange, maxrange, minrangecolor, maxrangecolor;
|
||||
bool str = (actor.HasProperty("$arg" + i + "str"));
|
||||
string argtitlestr = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "str"));
|
||||
if (string.IsNullOrEmpty(argtitlestr)) argtitlestr = argtitle;
|
||||
if (!string.IsNullOrEmpty(renderstyle))
|
||||
{
|
||||
rendercolor = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "rendercolor"));
|
||||
minrange = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "minrange"));
|
||||
minrangecolor = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "minrangecolor"));
|
||||
maxrange = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "maxrange"));
|
||||
maxrangecolor = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "maxrangecolor"));
|
||||
}
|
||||
else
|
||||
{
|
||||
rendercolor = string.Empty; minrange = string.Empty; maxrange = string.Empty; minrangecolor = string.Empty; maxrangecolor = string.Empty;
|
||||
}
|
||||
|
||||
string actorname = actor.ClassName;
|
||||
IDictionary<string, EnumList> enums = General.Map.Config.Enums;
|
||||
|
||||
this.used = true;
|
||||
this.title = argtitle;
|
||||
this.tooltip = tooltip;
|
||||
|
|
|
@ -27,6 +27,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.ZDoom;
|
||||
using CodeImp.DoomBuilder.GZBuilder;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -96,6 +97,10 @@ namespace CodeImp.DoomBuilder.Config
|
|||
|
||||
//mxd. Ambinent sound info
|
||||
private AmbientSoundInfo ambientsound;
|
||||
|
||||
// [ZZ] GZDoom inheritance data (DECORATE and ZScript). used for dynamic lighting.
|
||||
private int dynamiclighttype = -1;
|
||||
private List<ActorStructure> actorstructures = new List<ActorStructure>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -143,12 +148,16 @@ namespace CodeImp.DoomBuilder.Config
|
|||
//mxd. Ambinent sound info
|
||||
public AmbientSoundInfo AmbientSound { get { return ambientsound; } internal set { ambientsound = value; } }
|
||||
|
||||
#endregion
|
||||
// [ZZ] GZDoom inheritance data
|
||||
public int DynamicLightType { get { return dynamiclighttype; } set { if (dynamiclighttype < 0) dynamiclighttype = value; } }
|
||||
public List<ActorStructure> ActorStructures { get { return actorstructures; } internal set { actorstructures = value; } }
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
#endregion
|
||||
|
||||
// Constructor
|
||||
internal ThingTypeInfo(int index)
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
internal ThingTypeInfo(int index)
|
||||
{
|
||||
// Initialize
|
||||
this.index = index;
|
||||
|
@ -253,9 +262,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
|
||||
//mxd. Create sprite frame
|
||||
this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } };
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
|
@ -299,8 +308,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
//mxd. Create sprite frame
|
||||
this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } };
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
|
@ -344,9 +353,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
|
||||
//mxd. Create sprite frame
|
||||
this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } };
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
//mxd. Constructor
|
||||
|
@ -392,8 +401,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
//mxd. Create sprite frame
|
||||
this.spriteframe = new[] { new SpriteFrameInfo { Sprite = sprite, SpriteLongName = Lump.MakeLongName(sprite, true) } };
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
|
@ -438,8 +447,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.rollsprite = other.rollsprite;
|
||||
this.rollcenter = other.rollcenter;
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
//
|
||||
this.dynamiclighttype = other.dynamiclighttype;
|
||||
this.actorstructures = other.actorstructures;
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -475,34 +488,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
//mxd. Custom argument titles?
|
||||
for(int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if(!actor.HasPropertyWithValue("$arg" + i)) continue;
|
||||
string argtitle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i));
|
||||
string argtooltip = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "tooltip").Replace("\\n", Environment.NewLine));
|
||||
int argtype = actor.GetPropertyValueInt("$arg" + i + "type", 0);
|
||||
string targetclasses = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "targetclasses"));
|
||||
int defaultvalue = actor.GetPropertyValueInt("$arg" + i + "default", 0);
|
||||
string argenum = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "enum"));
|
||||
string argrenderstyle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "renderstyle"));
|
||||
string argrendercolor, minrange, maxrange, minrangecolor, maxrangecolor;
|
||||
bool argstr = (actor.HasProperty("$arg" + i + "str"));
|
||||
string argtitlestr = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "str"));
|
||||
if (string.IsNullOrEmpty(argtitlestr)) argtitlestr = argtitle;
|
||||
if (!string.IsNullOrEmpty(argrenderstyle))
|
||||
{
|
||||
argrendercolor = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "rendercolor"));
|
||||
minrange = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "minrange"));
|
||||
minrangecolor = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "minrangecolor"));
|
||||
maxrange = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "maxrange"));
|
||||
maxrangecolor = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "maxrangecolor"));
|
||||
}
|
||||
else
|
||||
{
|
||||
argrendercolor = string.Empty; minrange = string.Empty; maxrange = string.Empty; minrangecolor = string.Empty; maxrangecolor = string.Empty;
|
||||
}
|
||||
|
||||
args[i] = new ArgumentInfo(title, argtitle, argtooltip, argrenderstyle, argrendercolor,
|
||||
minrange, minrangecolor, maxrange, maxrangecolor, targetclasses,
|
||||
argtype, defaultvalue, argenum, General.Map.Config.Enums, argstr, argtitlestr);
|
||||
ArgumentInfo arg = actor.GetArgumentInfo(i);
|
||||
if (arg != null)
|
||||
args[i] = arg;
|
||||
}
|
||||
|
||||
//mxd. Some SLADE compatibility
|
||||
|
@ -605,6 +593,20 @@ namespace CodeImp.DoomBuilder.Config
|
|||
|
||||
//mxd
|
||||
if(blocking > THING_BLOCKING_NONE) errorcheck = THING_ERROR_INSIDE_STUCK;
|
||||
|
||||
// [ZZ] add parent doomednums if any. (and this one as well)
|
||||
actorstructures.Clear();
|
||||
ActorStructure p = actor;
|
||||
while (p != null)
|
||||
{
|
||||
actorstructures.Add(p);
|
||||
|
||||
int light_doomednumtype = GZGeneral.GetGZLightTypeByClass(p.ClassName);
|
||||
if (light_doomednumtype != 0)
|
||||
DynamicLightType = light_doomednumtype;
|
||||
|
||||
p = p.BaseClass;
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. This tries to find all possible sprite rotations. Returns true when voxel substitute exists
|
||||
|
|
|
@ -539,7 +539,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
const int linealpha = 128;
|
||||
foreach(Thing t in things)
|
||||
{
|
||||
int lightid = Array.IndexOf(GZGeneral.GZ_LIGHTS, t.Type);
|
||||
int lightid = GZGeneral.GetGZLightTypeByThing(t);
|
||||
if(lightid == -1) continue;
|
||||
|
||||
// TODO: this basically duplicates VisualThing.UpdateLight()...
|
||||
|
@ -554,7 +554,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
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.Type - 9800 - n);
|
||||
DynamicLightType lightType = (DynamicLightType)(t.DynamicLightType - 9800 - n);
|
||||
|
||||
if(lightType == DynamicLightType.SECTOR)
|
||||
{
|
||||
|
@ -584,7 +584,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
}
|
||||
else
|
||||
{
|
||||
switch(t.Type)
|
||||
switch(t.DynamicLightType)
|
||||
{
|
||||
case 1502: // Vavoom light
|
||||
color = new PixelColor(linealpha, 255, 255, 255);
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#region ================== Namespaces
|
||||
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using System;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -8,7 +11,7 @@ namespace CodeImp.DoomBuilder.GZBuilder
|
|||
{
|
||||
//mxd. should get rid of this class one day...
|
||||
public static class GZGeneral
|
||||
{
|
||||
{
|
||||
#region ================== Properties
|
||||
|
||||
//gzdoom light types
|
||||
|
@ -28,7 +31,35 @@ namespace CodeImp.DoomBuilder.GZBuilder
|
|||
private static readonly int[] acsSpecials = { 80, 81, 82, 83, 84, 85, 226 };
|
||||
public static int[] ACS_SPECIALS { get { return acsSpecials; } }
|
||||
|
||||
#endregion
|
||||
// [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(string classname)
|
||||
{
|
||||
int idx = Array.IndexOf(gzLightClasses, classname.ToLowerInvariant());
|
||||
if (idx >= 0)
|
||||
return gzLights[idx];
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int GetGZLightTypeByThing(Thing t)
|
||||
{
|
||||
int type = Array.IndexOf(gzLights, t.DynamicLightType);
|
||||
if (type >= 0)
|
||||
return type;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
|
@ -56,6 +56,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
// Properties
|
||||
private int type;
|
||||
private int dynamiclighttype;
|
||||
private Vector3D pos;
|
||||
private int angledoom; // Angle as entered / stored in file
|
||||
private float anglerad; // Angle in radians
|
||||
|
@ -89,6 +90,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 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!
|
||||
|
@ -223,6 +225,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
// Copy properties
|
||||
t.type = type;
|
||||
t.dynamiclighttype = dynamiclighttype;
|
||||
t.anglerad = anglerad;
|
||||
t.angledoom = angledoom;
|
||||
t.roll = roll; //mxd
|
||||
|
@ -520,8 +523,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
// Lookup settings
|
||||
ThingTypeInfo ti = General.Map.Data.GetThingInfo(type);
|
||||
|
||||
// Apply size
|
||||
|
||||
// Apply size
|
||||
dynamiclighttype = (Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, type)!=-1) ? type : ti.DynamicLightType;
|
||||
size = ti.Radius;
|
||||
height = ti.Height; //mxd
|
||||
fixedsize = ti.FixedSize;
|
||||
|
|
|
@ -542,11 +542,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(t.Selected) return General.Colors.Selection;
|
||||
|
||||
//mxd. If thing is light, set it's color to light color:
|
||||
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Type) != -1)
|
||||
if(GZBuilder.GZGeneral.GetGZLightTypeByThing(t) != -1)
|
||||
{
|
||||
if(t.Type == 1502) //vavoom light
|
||||
if(t.DynamicLightType == 1502) //vavoom light
|
||||
return new PixelColor(255, 255, 255, 255);
|
||||
if(t.Type == 1503) //vavoom colored light
|
||||
if(t.DynamicLightType == 1503) //vavoom colored light
|
||||
return new PixelColor(255, (byte)t.Args[1], (byte)t.Args[2], (byte)t.Args[3]);
|
||||
return new PixelColor(255, (byte)t.Args[0], (byte)t.Args[1], (byte)t.Args[2]);
|
||||
}
|
||||
|
|
|
@ -895,7 +895,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = CreateThingPositionMatrix(t);
|
||||
|
||||
//mxd. If current thing is light - set it's color to light color
|
||||
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Thing.Type) != -1 && !fullbrightness)
|
||||
if(GZBuilder.GZGeneral.GetGZLightTypeByThing(t.Thing) != -1 && !fullbrightness)
|
||||
{
|
||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||
vertexcolor = t.LightColor;
|
||||
|
@ -1205,7 +1205,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = CreateThingPositionMatrix(t);
|
||||
|
||||
//mxd. If current thing is light - set it's color to light color
|
||||
if(Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, t.Thing.Type) != -1 && !fullbrightness)
|
||||
if(GZBuilder.GZGeneral.GetGZLightTypeByThing(t.Thing) != -1 && !fullbrightness)
|
||||
{
|
||||
wantedshaderpass += 4; // Render using one of passes, which uses World3D.VertexColor
|
||||
vertexcolor = t.LightColor;
|
||||
|
|
|
@ -611,9 +611,9 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
//mxd
|
||||
protected void CheckLightState()
|
||||
{
|
||||
//mxd. Check if thing is light
|
||||
int light_id = Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, thing.Type);
|
||||
if(light_id != -1)
|
||||
//mxd. Check if thing is light
|
||||
int light_id = GZBuilder.GZGeneral.GetGZLightTypeByThing(thing);
|
||||
if (light_id != -1)
|
||||
{
|
||||
isGldefsLight = false;
|
||||
lightInterval = -1;
|
||||
|
@ -644,8 +644,8 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
//mxd. Used in ColorPicker to update light
|
||||
public void UpdateLight()
|
||||
{
|
||||
int light_id = Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, thing.Type);
|
||||
if(light_id != -1)
|
||||
int light_id = GZBuilder.GZGeneral.GetGZLightTypeByThing(thing);
|
||||
if (light_id != -1)
|
||||
{
|
||||
UpdateLight(light_id);
|
||||
UpdateBoundingBox(lightRadius, lightRadius * 2);
|
||||
|
@ -695,7 +695,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
thing.Args[1] / DYNLIGHT_INTENSITY_SCALER,
|
||||
thing.Args[2] / DYNLIGHT_INTENSITY_SCALER);
|
||||
}
|
||||
lightType = (DynamicLightType)(thing.Type - 9800 - n);
|
||||
lightType = (DynamicLightType)(thing.DynamicLightType - 9800 - n);
|
||||
|
||||
if(lightType == DynamicLightType.SECTOR)
|
||||
{
|
||||
|
@ -712,7 +712,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
else //it's one of vavoom lights
|
||||
{
|
||||
lightRenderStyle = DynamicLightRenderStyle.VAVOOM;
|
||||
lightType = (DynamicLightType)thing.Type;
|
||||
lightType = (DynamicLightType)thing.DynamicLightType;
|
||||
if(lightType == DynamicLightType.VAVOOM_COLORED)
|
||||
{
|
||||
lightColor = new Color4((float)lightRenderStyle / 100.0f,
|
||||
|
|
|
@ -58,6 +58,9 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
//mxd. Categories
|
||||
internal DecorateCategoryInfo catinfo;
|
||||
|
||||
// [ZZ] direct ArgumentInfos (from game configuration), or own ArgumentInfos (from props)
|
||||
internal ArgumentInfo[] args = new ArgumentInfo[5];
|
||||
|
||||
// States
|
||||
internal Dictionary<string, StateStructure> states;
|
||||
|
||||
|
@ -300,6 +303,31 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
//mxd. No dice...
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method parses $argN into argumentinfos.
|
||||
/// </summary>
|
||||
public void ParseCustomArguments()
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (HasProperty("$arg" + i))
|
||||
args[i] = new ArgumentInfo(this, i);
|
||||
else args[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public ArgumentInfo GetArgumentInfo(int idx)
|
||||
{
|
||||
if (args[idx] != null)
|
||||
return args[idx];
|
||||
// if we have $clearargs, don't inherit anything!
|
||||
if (props.ContainsKey("$clearargs"))
|
||||
return null;
|
||||
if (baseclass != null)
|
||||
return baseclass.GetArgumentInfo(idx);
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Types;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -392,8 +393,11 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
previoustoken = token;
|
||||
}
|
||||
|
||||
// parsing done, process thing arguments
|
||||
ParseCustomArguments();
|
||||
|
||||
//mxd. Check if baseclass is valid
|
||||
if (inheritclass.ToLowerInvariant() != "actor" && doomednum > -1 && baseclass == null)
|
||||
if (inheritclass.ToLowerInvariant() != "actor" && doomednum > -1)
|
||||
{
|
||||
//check if this class inherits from a class defined in game configuration
|
||||
Dictionary<int, ThingTypeInfo> things = General.Map.Config.GetThingTypes();
|
||||
|
@ -404,28 +408,48 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
if (!string.IsNullOrEmpty(ti.Value.ClassName) && ti.Value.ClassName.ToLowerInvariant() == inheritclasscheck)
|
||||
{
|
||||
//states
|
||||
// [ZZ] allow internal prefix here. it can inherit MapSpot, light, or other internal stuff.
|
||||
if (states.Count == 0 && !string.IsNullOrEmpty(ti.Value.Sprite))
|
||||
states.Add("spawn", new StateStructure(ti.Value.Sprite.Substring(0, 5)));
|
||||
states.Add("spawn", new StateStructure(ti.Value.Sprite.StartsWith(DataManager.INTERNAL_PREFIX) ? ti.Value.Sprite : ti.Value.Sprite.Substring(0, 5)));
|
||||
|
||||
//flags
|
||||
if (ti.Value.Hangs && !flags.ContainsKey("spawnceiling"))
|
||||
flags["spawnceiling"] = true;
|
||||
if (baseclass == null)
|
||||
{
|
||||
//flags
|
||||
if (ti.Value.Hangs && !flags.ContainsKey("spawnceiling"))
|
||||
flags["spawnceiling"] = true;
|
||||
|
||||
if (ti.Value.Blocking > 0 && !flags.ContainsKey("solid"))
|
||||
flags["solid"] = true;
|
||||
if (ti.Value.Blocking > 0 && !flags.ContainsKey("solid"))
|
||||
flags["solid"] = true;
|
||||
|
||||
//properties
|
||||
if (!props.ContainsKey("height"))
|
||||
props["height"] = new List<string> { ti.Value.Height.ToString() };
|
||||
//properties
|
||||
if (!props.ContainsKey("height"))
|
||||
props["height"] = new List<string> { ti.Value.Height.ToString() };
|
||||
|
||||
if (!props.ContainsKey("radius"))
|
||||
props["radius"] = new List<string> { ti.Value.Radius.ToString() };
|
||||
if (!props.ContainsKey("radius"))
|
||||
props["radius"] = new List<string> { ti.Value.Radius.ToString() };
|
||||
}
|
||||
|
||||
// [ZZ] inherit arguments from game configuration
|
||||
//
|
||||
if (!props.ContainsKey("$clearargs"))
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (args[i] != null)
|
||||
continue; // don't touch it if we already have overrides
|
||||
|
||||
ArgumentInfo arg = ti.Value.Args[i];
|
||||
if (arg != null && arg.Used)
|
||||
args[i] = arg;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
parser.LogWarning("Unable to find \"" + inheritclass + "\" class to inherit from, while parsing \"" + classname + ":" + doomednum + "\"");
|
||||
if (baseclass == null)
|
||||
parser.LogWarning("Unable to find \"" + inheritclass + "\" class to inherit from, while parsing \"" + classname + ":" + doomednum + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -673,6 +673,9 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// parsing done, process thing arguments
|
||||
ParseCustomArguments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -896,20 +896,32 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
{
|
||||
actor.baseclass = GetArchivedActorByName(cls.ParentName, true);
|
||||
string inheritclass = cls.ParentName;
|
||||
if (actor.baseclass == null)
|
||||
|
||||
//check if this class inherits from a class defined in game configuration
|
||||
string inheritclasscheck = inheritclass.ToLowerInvariant();
|
||||
|
||||
// inherit args from base class
|
||||
if (actor.baseclass != null)
|
||||
{
|
||||
//check if this class inherits from a class defined in game configuration
|
||||
string inheritclasscheck = inheritclass.ToLowerInvariant();
|
||||
|
||||
bool thingfound = false;
|
||||
foreach (KeyValuePair<int, ThingTypeInfo> ti in things)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ti.Value.ClassName) && ti.Value.ClassName.ToLowerInvariant() == inheritclasscheck)
|
||||
{
|
||||
//states
|
||||
if (actor.states.Count == 0 && !string.IsNullOrEmpty(ti.Value.Sprite))
|
||||
actor.states.Add("spawn", new StateStructure(ti.Value.Sprite.Substring(0, 5)));
|
||||
if (actor.args[i] == null)
|
||||
actor.args[i] = actor.baseclass.args[i];
|
||||
}
|
||||
}
|
||||
|
||||
bool thingfound = false;
|
||||
foreach (KeyValuePair<int, ThingTypeInfo> ti in things)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ti.Value.ClassName) && ti.Value.ClassName.ToLowerInvariant() == inheritclasscheck)
|
||||
{
|
||||
//states
|
||||
// [ZZ] allow internal prefix here. it can inherit MapSpot, light, or other internal stuff.
|
||||
if (actor.states.Count == 0 && !string.IsNullOrEmpty(ti.Value.Sprite))
|
||||
actor.states.Add("spawn", new StateStructure(ti.Value.Sprite.StartsWith(DataManager.INTERNAL_PREFIX) ? ti.Value.Sprite : ti.Value.Sprite.Substring(0, 5)));
|
||||
|
||||
if (actor.baseclass == null)
|
||||
{
|
||||
//flags
|
||||
if (ti.Value.Hangs && !actor.flags.ContainsKey("spawnceiling"))
|
||||
actor.flags["spawnceiling"] = true;
|
||||
|
@ -923,13 +935,29 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
|
||||
if (!actor.props.ContainsKey("radius"))
|
||||
actor.props["radius"] = new List<string> { ti.Value.Radius.ToString() };
|
||||
|
||||
thingfound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// [ZZ] inherit arguments from game configuration
|
||||
//
|
||||
if (!actor.props.ContainsKey("$clearargs"))
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (actor.args[i] != null)
|
||||
continue; // don't touch it if we already have overrides
|
||||
|
||||
ArgumentInfo arg = ti.Value.Args[i];
|
||||
if (arg != null && arg.Used)
|
||||
actor.args[i] = arg;
|
||||
}
|
||||
}
|
||||
|
||||
thingfound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!thingfound) LogWarning("Unable to find \"" + inheritclass + "\" class to inherit from, while parsing \"" + cls.ClassName + "\"");
|
||||
if (actor.baseclass == null && !thingfound)
|
||||
LogWarning("Unable to find \"" + inheritclass + "\" class to inherit from, while parsing \"" + cls.ClassName + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ButtonGroup = "000_editing",
|
||||
UseByDefault = true,
|
||||
SafeStartMode = true)]
|
||||
|
||||
|
||||
public class ThingsMode : BaseClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
|
||||
private static bool RELATIVE_MODE;
|
||||
|
||||
private static readonly int[] LIGHT_USES_ANGLE_VALUE = { 9801, 9802, 9804, 9811, 9812, 9814, 9821, 9822, 9824 };
|
||||
private static readonly int[] LIGHT_USES_ANGLE_VALUE = { 9801, 9802, 9804, 9811, 9812, 9814, 9821, 9822, 9824, 9831, 9832, 9834 };
|
||||
|
||||
private List<Thing> selection;
|
||||
private List<VisualThing> visualSelection;
|
||||
|
@ -102,7 +102,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
|
||||
foreach(VisualThing t in selectedVisualThings)
|
||||
{
|
||||
if(Array.IndexOf(GZGeneral.GZ_LIGHTS, t.Thing.Type) != -1)
|
||||
if(GZGeneral.GetGZLightTypeByThing(t.Thing) != -1)
|
||||
{
|
||||
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(Array.IndexOf(GZGeneral.GZ_LIGHTS, t.Type) != -1)
|
||||
if(GZGeneral.GetGZLightTypeByThing(t) != -1)
|
||||
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.Type);
|
||||
ThingTypeInfo typeInfo = General.Map.Data.GetThingInfoEx(referenceThing.DynamicLightType);
|
||||
int firstArg = 3;
|
||||
if(referenceThing.Type == 1502 || referenceThing.Type == 1503)
|
||||
if(referenceThing.DynamicLightType == 1502 || referenceThing.DynamicLightType == 1503)
|
||||
firstArg = 0;
|
||||
|
||||
//first slider is always used
|
||||
|
@ -134,7 +134,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
colorPickerSlider1.OnValueChanged += OnSliderValueChanged;
|
||||
|
||||
//either both of them or none are used
|
||||
if(Array.IndexOf(LIGHT_USES_ANGLE_VALUE, referenceThing.Type) != -1)
|
||||
if(Array.IndexOf(LIGHT_USES_ANGLE_VALUE, referenceThing.DynamicLightType) != -1)
|
||||
{
|
||||
showAllControls = true;
|
||||
colorPickerSlider2.Label = typeInfo.Args[4].Title + ":";
|
||||
|
@ -170,13 +170,13 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
|
||||
//size
|
||||
int firstArg = 3;
|
||||
if(referenceThing.Type == 1502 || referenceThing.Type == 1503)
|
||||
if(referenceThing.DynamicLightType == 1502 || referenceThing.DynamicLightType == 1503)
|
||||
firstArg = 0;
|
||||
|
||||
lightProps.PrimaryRadius = referenceThing.Args[firstArg];
|
||||
|
||||
//either both of them or none are used
|
||||
if(showAllControls && Array.IndexOf(LIGHT_USES_ANGLE_VALUE, referenceThing.Type) != -1)
|
||||
if(showAllControls && Array.IndexOf(LIGHT_USES_ANGLE_VALUE, referenceThing.DynamicLightType) != -1)
|
||||
{
|
||||
lightProps.SecondaryRadius = referenceThing.Args[4];
|
||||
lightProps.Interval = referenceThing.AngleDoom;
|
||||
|
@ -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.Type == 1503) //Vavoom Light Color
|
||||
if(t.DynamicLightType == 1503) //Vavoom Light Color
|
||||
{
|
||||
t.Args[1] = lightProps.Red;
|
||||
t.Args[2] = lightProps.Green;
|
||||
t.Args[3] = lightProps.Blue;
|
||||
}
|
||||
else if(t.Type != 1502) //vavoom light has no color settings
|
||||
else if(t.DynamicLightType != 1502) //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.Type == 1502 || t.Type == 1503) firstArg = 0;
|
||||
if(t.DynamicLightType == 1502 || t.DynamicLightType == 1503) firstArg = 0;
|
||||
|
||||
//update radius and intensity
|
||||
if(RELATIVE_MODE)
|
||||
|
@ -241,7 +241,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
t.Args[firstArg] = fixedVal.PrimaryRadius + lightProps.PrimaryRadius;
|
||||
if(t.Args[firstArg] < 0) t.Args[firstArg] = 0;
|
||||
|
||||
if(showAllControls && Array.IndexOf(LIGHT_USES_ANGLE_VALUE, t.Type) != -1)
|
||||
if(showAllControls && Array.IndexOf(LIGHT_USES_ANGLE_VALUE, t.DynamicLightType) != -1)
|
||||
{
|
||||
t.Args[4] = fixedVal.SecondaryRadius + lightProps.SecondaryRadius;
|
||||
if(t.Args[4] < 0) t.Args[4] = 0;
|
||||
|
@ -254,7 +254,7 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
if(lightProps.PrimaryRadius != -1)
|
||||
t.Args[firstArg] = lightProps.PrimaryRadius;
|
||||
|
||||
if(showAllControls && Array.IndexOf(LIGHT_USES_ANGLE_VALUE, t.Type) != -1)
|
||||
if(showAllControls && Array.IndexOf(LIGHT_USES_ANGLE_VALUE, t.DynamicLightType) != -1)
|
||||
{
|
||||
t.Args[4] = lightProps.SecondaryRadius;
|
||||
t.Rotate(General.ClampAngle(lightProps.Interval));
|
||||
|
@ -322,8 +322,8 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
//this is called only once
|
||||
private static Color GetThingColor(Thing thing)
|
||||
{
|
||||
if(thing.Type == 1502) return Color.White; //vavoom light
|
||||
if(thing.Type == 1503) return Color.FromArgb((byte)thing.Args[1], (byte)thing.Args[2], (byte)thing.Args[3]); //vavoom colored light
|
||||
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
|
||||
return Color.FromArgb((byte)thing.Args[0], (byte)thing.Args[1], (byte)thing.Args[2]);
|
||||
}
|
||||
|
||||
|
@ -337,11 +337,11 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows
|
|||
Thing t = selection[i];
|
||||
LightProps lp = new LightProps();
|
||||
int firstArg = 3;
|
||||
if(t.Type == 1502 || t.Type == 1503) firstArg = 0;
|
||||
if(t.DynamicLightType == 1502 || t.DynamicLightType == 1503) firstArg = 0;
|
||||
lp.PrimaryRadius = t.Args[firstArg];
|
||||
|
||||
//either both of them or none are used
|
||||
if(showAllControls && Array.IndexOf(LIGHT_USES_ANGLE_VALUE, t.Type) != -1)
|
||||
if(showAllControls && Array.IndexOf(LIGHT_USES_ANGLE_VALUE, t.DynamicLightType) != -1)
|
||||
{
|
||||
lp.SecondaryRadius = t.Args[4];
|
||||
lp.Interval = t.AngleDoom;
|
||||
|
|
Loading…
Reference in a new issue