DECORATE: added "//$ArgNDefault" special comment. It can be used to specify the default argument value.

Visual mode, 3d floors: sloped 3d floors are now always rendered as opaque (just like in GZDoom).
Fixed a crash when creating a new unknown thing (introduced in r2324).
Documentation: updated "Action Argument Settings" and "DECORATE keys" pages.
This commit is contained in:
MaxED 2015-05-31 21:11:21 +00:00
parent f832fb85f9
commit 1843ffc5a7
10 changed files with 37 additions and 14 deletions

View file

@ -18,6 +18,7 @@
<div id="contents"> <div id="contents">
<p> <b class="fat">title</b> (string)<br /> <p> <b class="fat">title</b> (string)<br />
Sets the title of this argument.<br /> Sets the title of this argument.<br />
Argument title can be also set in <a href="gc_decoratekeys.html#argtitle">DECORATE</a>.<br />
<br /> <br />
<b class="fat"><a name="argtooltip" id="argtooltip"></a>tooltip</b> (string) - <span class="red">GZDB only</span>.<br /> <b class="fat"><a name="argtooltip" id="argtooltip"></a>tooltip</b> (string) - <span class="red">GZDB only</span>.<br />
Allows to specify a tooltip text displayed for a <a href="gc_thingsettings.html#argtooltip">Thing</a> or Linedef argument definition. Newline character ("\n") can be used to format the text.<br /> Allows to specify a tooltip text displayed for a <a href="gc_thingsettings.html#argtooltip">Thing</a> or Linedef argument definition. Newline character ("\n") can be used to format the text.<br />
@ -78,6 +79,7 @@ arg0
<br /> <br />
<b class="fat">default</b> (integer) - <span class="red">GZDB only</span>.<br /> <b class="fat">default</b> (integer) - <span class="red">GZDB only</span>.<br />
Sets the default value for a Thing or Linedef argument definition.<br /> Sets the default value for a Thing or Linedef argument definition.<br />
Default value can be also set in <a href="gc_decoratekeys.html#argdefault">DECORATE</a>.<br />
<strong>Example:</strong> <strong>Example:</strong>
</p> </p>
<pre>9038 <pre>9038

View file

@ -30,18 +30,21 @@
<strong>//$Title &lt;title&gt;</strong><br /> <strong>//$Title &lt;title&gt;</strong><br />
Specifies which name to give to the actor. By default, a custom actor not identified in a configuration file will use the Tag property, and if not present, will default to the class name.<br /> Specifies which name to give to the actor. By default, a custom actor not identified in a configuration file will use the Tag property, and if not present, will default to the class name.<br />
<br /> <br />
<strong>//$ArgN &lt;name&gt;</strong> - <span class="red">GZDB only</span>.<br /> <strong><a name="argtitle" id="argtitle"></a>//$ArgN &lt;name&gt;</strong> - <span class="red">GZDB only</span>.<br />
Allows to override default argument names for this actor.<br /> Allows to override default argument names for this actor.<br />
<br />
<strong><a name="argdefault" id="argdefault"></a>//$ArgNDefault &lt;integer&gt;</strong> - <span class="red">GZDB only</span>.<br />
Allows to set the default value for this argument. This property can only be used in conjunction with &quot;<strong>//$ArgN</strong>&quot; property.<br />
<br /> <br />
<strong><a name="argtooltip" id="argtooltip"></a>//$ArgNTooltip &lt;text&gt;</strong> - <span class="red">GZDB only</span>.<br /> <strong><a name="argtooltip" id="argtooltip"></a>//$ArgNTooltip &lt;text&gt;</strong> - <span class="red">GZDB only</span>.<br />
Allows to specify a tooltip text displayed for this argument. Newline character (&quot;\n&quot;) can be used to format the text. This property can only be used in conjunction with &quot;<strong>$ArgN</strong>&quot;.<br /> Allows to specify a tooltip text displayed for this argument. Newline character (&quot;\n&quot;) can be used to format the text. This property can only be used in conjunction with &quot;<strong>//$ArgN</strong>&quot; property.<br />
Argument tooltips can be also set for <a href="gc_argumentsettings.html#argtooltip">things and linedefs</a> in a Game Configuration.<br /> Argument tooltips can be also set for <a href="gc_argumentsettings.html#argtooltip">things and linedefs</a> in a Game Configuration.<br />
<br /> <br />
<strong><a name="argtype" id="argtype"></a>//$ArgNType &lt;integer&gt;</strong> - <span class="red">GZDB only</span>.<br /> <strong><a name="argtype" id="argtype"></a>//$ArgNType &lt;integer&gt;</strong> - <span class="red">GZDB only</span>.<br />
Allows to specify an <a href="gc_argumentsettings.html#argtype">argument type</a> for this argument.<br /> Allows to specify an <a href="gc_argumentsettings.html#argtype">argument type</a> for this argument. This property can only be used in conjunction with &quot;<strong>//$ArgN</strong>&quot; property.<br />
<br /> <br />
<strong><a name="argenum" id="argenum"></a>//$ArgNEnum &lt;string or structure&gt;</strong> - <span class="red">GZDB only</span>.<br /> <strong><a name="argenum" id="argenum"></a>//$ArgNEnum &lt;string or structure&gt;</strong> - <span class="red">GZDB only</span>.<br />
Allows to specify an enum for this argument. This can be either a name of an enum defined in the Game Configuration, or an explicit enum definition.<br /> Allows to specify an enum for this argument. This can be either a name of an enum defined in the Game Configuration, or an explicit enum definition. This property can only be used in conjunction with &quot;<strong>//$ArgN</strong>&quot; property.<br />
<br /> <br />
<strong>//$Color &lt;color index&gt;</strong> - <span class="red">GZDB only</span>.<br /> <strong>//$Color &lt;color index&gt;</strong> - <span class="red">GZDB only</span>.<br />
Allows to override category color for this actor. Possible values: Allows to override category color for this actor. Possible values:

View file

@ -96,11 +96,12 @@ namespace CodeImp.DoomBuilder.Config
} }
//mxd. Constructor for an argument info defined in DECORATE //mxd. Constructor for an argument info defined in DECORATE
internal ArgumentInfo(string actorname, string argtitle, string tooltip, int type, string enumstr, IDictionary<string, EnumList> enums) internal ArgumentInfo(string actorname, string argtitle, string tooltip, int type, int defaultvalue, string enumstr, IDictionary<string, EnumList> enums)
{ {
this.used = true; this.used = true;
this.title = argtitle; this.title = argtitle;
this.tooltip = tooltip; this.tooltip = tooltip;
this.defaultvalue = defaultvalue;
// Get argument type // Get argument type
if(System.Enum.IsDefined(typeof(UniversalType), type)) if(System.Enum.IsDefined(typeof(UniversalType), type))
@ -139,7 +140,6 @@ namespace CodeImp.DoomBuilder.Config
} }
if(this.enumlist == null) this.enumlist = new EnumList(); if(this.enumlist == null) this.enumlist = new EnumList();
this.defaultvalue = 0;
} }
// Constructor for unknown argument info // Constructor for unknown argument info

View file

@ -361,8 +361,9 @@ namespace CodeImp.DoomBuilder.Config
string argtitle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i)); string argtitle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i));
string argtooltip = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "tooltip").Replace("\\n", Environment.NewLine)); string argtooltip = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "tooltip").Replace("\\n", Environment.NewLine));
int argtype = actor.GetPropertyValueInt("$arg" + i + "type", 0); int argtype = actor.GetPropertyValueInt("$arg" + i + "type", 0);
int defaultvalue = actor.GetPropertyValueInt("$arg" + i + "default", 0);
string argenum = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "enum")); string argenum = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "enum"));
args[i] = new ArgumentInfo(title, argtitle, argtooltip, argtype, argenum, General.Map.Config.Enums); args[i] = new ArgumentInfo(title, argtitle, argtooltip, argtype, defaultvalue, argenum, General.Map.Config.Enums);
} }
// Remove doublequotes from title // Remove doublequotes from title

View file

@ -831,7 +831,7 @@ namespace CodeImp.DoomBuilder.IO
// This includes another file // This includes another file
private void FunctionInclude(IDictionary cs, ArrayList args, ref string file, int line) private void FunctionInclude(IDictionary cs, List<object> args, ref string file, int line)
{ {
string data; string data;
@ -933,7 +933,7 @@ namespace CodeImp.DoomBuilder.IO
private void ParseFunction(IDictionary cs, ref string file, ref string data, ref int pos, ref int line, ref string functionname) private void ParseFunction(IDictionary cs, ref string file, ref string data, ref int pos, ref int line, ref string functionname)
{ {
// We now parse arguments, separated by commas, until we reach the end of the function // We now parse arguments, separated by commas, until we reach the end of the function
ArrayList args = new ArrayList(); List<object> args = new List<object>();
object val; object val;
while((pos < data.Length) && !cpErrorResult) while((pos < data.Length) && !cpErrorResult)
{ {

View file

@ -503,6 +503,7 @@ namespace CodeImp.DoomBuilder.Map
//mxd. Apply radius and height overrides? //mxd. Apply radius and height overrides?
for(int i = 0; i < ti.Args.Length; i++) for(int i = 0; i < ti.Args.Length; i++)
{ {
if(ti.Args[i] == null) continue;
if(ti.Args[i].Type == (int)UniversalType.ThingRadius && args[i] > 0) if(ti.Args[i].Type == (int)UniversalType.ThingRadius && args[i] > 0)
size = args[i]; size = args[i];
else if(ti.Args[i].Type == (int)UniversalType.ThingHeight && args[i] > 0) else if(ti.Args[i].Type == (int)UniversalType.ThingHeight && args[i] > 0)

View file

@ -1,6 +1,7 @@
#region === Copyright (c) 2010 Pascal van der Heiden === #region === Copyright (c) 2010 Pascal van der Heiden ===
using System; using System;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Rendering;
@ -27,6 +28,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. Translucent 3d-floor? //mxd. Translucent 3d-floor?
private bool renderinside; private bool renderinside;
//mxd. Dirty hack to emulate GZDoom behaviour?
private bool sloped3dfloor;
//mxd. Ignore Bottom Height? //mxd. Ignore Bottom Height?
private bool ignorebottomheight; private bool ignorebottomheight;
@ -38,6 +42,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public bool VavoomType { get { return vavoomtype; } } public bool VavoomType { get { return vavoomtype; } }
public bool RenderInside { get { return renderinside; } } //mxd public bool RenderInside { get { return renderinside; } } //mxd
public bool IgnoreBottomHeight { get { return ignorebottomheight; } } //mxd public bool IgnoreBottomHeight { get { return ignorebottomheight; } } //mxd
public bool Sloped3dFloor { get { return sloped3dfloor; } } //mxd
//mxd. 3D-Floor Flags //mxd. 3D-Floor Flags
[Flags] [Flags]
@ -135,6 +140,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply alpha // Apply alpha
floor.alpha = alpha; floor.alpha = alpha;
ceiling.alpha = alpha; ceiling.alpha = alpha;
//mxd. Check slopes, cause GZDoom can't handle sloped translucent 3d floors...
sloped3dfloor = (alpha < 255 &&
(Angle2D.RadToDeg(ceiling.plane.Normal.GetAngleZ()) != 270 ||
Angle2D.RadToDeg(floor.plane.Normal.GetAngleZ()) != 90));
// Do not adjust light? (works only for non-vavoom types) // Do not adjust light? (works only for non-vavoom types)
if(!vavoomtype) if(!vavoomtype)

View file

@ -156,9 +156,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Determine render pass // Determine render pass
if(extrafloor != null) if(extrafloor != null)
{ {
if ((extrafloor.Linedef.Args[2] & (int)Effect3DFloor.Flags.RenderAdditive) != 0) //mxd if(extrafloor.Sloped3dFloor) //mxd
this.RenderPass = RenderPass.Mask;
else if((extrafloor.Linedef.Args[2] & (int)Effect3DFloor.Flags.RenderAdditive) != 0) //mxd
this.RenderPass = RenderPass.Additive; this.RenderPass = RenderPass.Additive;
else if (level.alpha < 255) else if(level.alpha < 255)
this.RenderPass = RenderPass.Alpha; this.RenderPass = RenderPass.Alpha;
else else
this.RenderPass = RenderPass.Mask; this.RenderPass = RenderPass.Mask;

View file

@ -158,7 +158,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Determine render pass // Determine render pass
if(extrafloor != null) if(extrafloor != null)
{ {
if((extrafloor.Linedef.Args[2] & (int)Effect3DFloor.Flags.RenderAdditive) != 0) //mxd if(extrafloor.Sloped3dFloor) //mxd
this.RenderPass = RenderPass.Mask;
else if((extrafloor.Linedef.Args[2] & (int)Effect3DFloor.Flags.RenderAdditive) != 0) //mxd
this.RenderPass = RenderPass.Additive; this.RenderPass = RenderPass.Additive;
else if(level.alpha < 255) else if(level.alpha < 255)
this.RenderPass = RenderPass.Alpha; this.RenderPass = RenderPass.Alpha;

View file

@ -266,9 +266,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
List<WorldVertex> verts = CreatePolygonVertices(polygons, tp, sd, lightvalue, lightabsolute); List<WorldVertex> verts = CreatePolygonVertices(polygons, tp, sd, lightvalue, lightabsolute);
if (verts.Count > 2) if (verts.Count > 2)
{ {
if ((extrafloor.Linedef.Args[2] & (int) Effect3DFloor.Flags.RenderAdditive) != 0) //mxd if(extrafloor.Sloped3dFloor) //mxd
this.RenderPass = RenderPass.Mask;
else if((extrafloor.Linedef.Args[2] & (int) Effect3DFloor.Flags.RenderAdditive) != 0) //mxd
this.RenderPass = RenderPass.Additive; this.RenderPass = RenderPass.Additive;
else if (extrafloor.Alpha < 255) else if(extrafloor.Alpha < 255)
this.RenderPass = RenderPass.Alpha; this.RenderPass = RenderPass.Alpha;
else else
this.RenderPass = RenderPass.Mask; this.RenderPass = RenderPass.Mask;