mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
DECORATE: added "//$ArgNType" special comment. It can be used to specify argument type.
DECORATE: added "//$ArgNEnum" special comment. It can be used to specify an enum to use with the argument. Documentation: updated "Action Argument Settings" and "DECORATE keys" pages.
This commit is contained in:
parent
35cd4068ff
commit
f832fb85f9
5 changed files with 78 additions and 13 deletions
|
@ -223,8 +223,8 @@ Field data types:
|
|||
1 = float
|
||||
2 = string
|
||||
3 = bool
|
||||
4 = linedeftype (integer) *
|
||||
5 = sectoreffect (integer) *
|
||||
4 = linedef action (integer) *
|
||||
5 = sector effect (integer) *
|
||||
6 = texture (string)
|
||||
7 = flat (string)
|
||||
8 = angle in degrees (integer)
|
||||
|
|
|
@ -29,12 +29,14 @@
|
|||
<span class="blue">tooltip = "Polyobject that will mirror\nthis one's movements.";</span>
|
||||
}</pre>
|
||||
<br />
|
||||
<b class="fat">type</b> (integer)<br />
|
||||
Sets the type of this argument. This changes the behaviour of Argument inputs in <a href="w_linedefedit.html">Linedef</a> and <a href="w_thingedit.html">Thing Edit</a> windows. Supported values are:<br />
|
||||
<b class="fat"><a name="argtype" id="argtype"></a>type</b> (integer)<br />
|
||||
Sets the type of this argument. This changes the behaviour of Argument inputs in <a href="w_linedefedit.html">Linedef</a> and <a href="w_thingedit.html">Thing Edit</a> windows.<br />
|
||||
Argument type can be also set in <a href="gc_decoratekeys.html#argtype">DECORATE</a>.<br />
|
||||
<strong>Supported values are:</strong><br />
|
||||
<br />
|
||||
<ul style="list-style-type:none">
|
||||
<li>0 = Integer (default)</li>
|
||||
<li>4 = Linedeftype</li>
|
||||
<li>4 = Action special</li>
|
||||
<li>5 = Sector effect</li>
|
||||
<li>8 = Angle in degrees</li>
|
||||
<li>10 = XXRRGGBB color</li>
|
||||
|
@ -72,6 +74,7 @@ arg0
|
|||
}</span>
|
||||
}
|
||||
</pre>
|
||||
Enums can be also set in <a href="gc_decoratekeys.html#argenum">DECORATE</a>.<br />
|
||||
<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 />
|
||||
|
|
|
@ -36,6 +36,12 @@
|
|||
<strong><a name="argtooltip" id="argtooltip"></a>//$ArgNTooltip <text></strong> - <span class="red">GZDB only</span>.<br />
|
||||
Allows to specify a tooltip text displayed for this argument. Newline character ("\n") can be used to format the text. This property can only be used in conjunction with "<strong>$ArgN</strong>".<br />
|
||||
Argument tooltips can be also set for <a href="gc_argumentsettings.html#argtooltip">things and linedefs</a> in a Game Configuration.<br />
|
||||
<br />
|
||||
<strong><a name="argtype" id="argtype"></a>//$ArgNType <integer></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 />
|
||||
<br />
|
||||
<strong><a name="argenum" id="argenum"></a>//$ArgNEnum <string or structure></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 />
|
||||
<br />
|
||||
<strong>//$Color <color index></strong> - <span class="red">GZDB only</span>.<br />
|
||||
Allows to override category color for this actor. Possible values:
|
||||
|
@ -75,10 +81,26 @@ Actor ChexShield : ResistanceRune replaces ResistanceRune 5104
|
|||
//$Category powerups
|
||||
//$Sprite ARMXA0
|
||||
//$Title "Chex Shield"
|
||||
//$Color 12
|
||||
|
||||
//$Arg0 "Respawn Delay"
|
||||
//$Arg0ToolTip "Positive values specify delay in tics.\nNegative - in seconds."
|
||||
//$Arg1 "Armor Amount"
|
||||
//$Color 12
|
||||
|
||||
//$Arg1 "Enum Example 1"
|
||||
//$Arg1ToolTip "Config enum example"
|
||||
//$Arg1Type 11
|
||||
//$Arg1Enum "keys"
|
||||
|
||||
//$Arg2 "Enum Example 2"
|
||||
//$Arg2ToolTip "Explicit enum example"
|
||||
//$Arg2Type 11
|
||||
//$Arg2Enum { 1 = "First option"; 2 = "Second option"; 667 = "Option 667"; }
|
||||
|
||||
//$Arg3 "Radius"
|
||||
//$Arg3Type 23
|
||||
|
||||
//$Arg4 "Height"
|
||||
//$Arg4Type 24
|
||||
|
||||
Height 44
|
||||
Radius 26
|
||||
|
|
|
@ -20,6 +20,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Types;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -95,13 +96,49 @@ namespace CodeImp.DoomBuilder.Config
|
|||
}
|
||||
|
||||
//mxd. Constructor for an argument info defined in DECORATE
|
||||
internal ArgumentInfo(string title, string tooltip)
|
||||
internal ArgumentInfo(string actorname, string argtitle, string tooltip, int type, string enumstr, IDictionary<string, EnumList> enums)
|
||||
{
|
||||
this.used = true;
|
||||
this.title = title;
|
||||
this.title = argtitle;
|
||||
this.tooltip = tooltip;
|
||||
this.type = 0;
|
||||
this.enumlist = new EnumList();
|
||||
|
||||
// Get argument type
|
||||
if(System.Enum.IsDefined(typeof(UniversalType), type))
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
else
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, actorname + ": action argument \"" + argtitle + "\" has unknown type " + type + "!");
|
||||
this.type = 0;
|
||||
}
|
||||
|
||||
// Get or create enum
|
||||
if(!string.IsNullOrEmpty(enumstr))
|
||||
{
|
||||
if(enums.ContainsKey(enumstr.ToLowerInvariant()))
|
||||
{
|
||||
this.enumlist = enums[enumstr.ToLowerInvariant()];
|
||||
}
|
||||
else
|
||||
{
|
||||
Configuration cfg = new Configuration();
|
||||
if(cfg.InputConfiguration("enum" + enumstr, true))
|
||||
{
|
||||
IDictionary argdic = cfg.ReadSetting("enum", new Hashtable());
|
||||
if(argdic.Keys.Count > 0)
|
||||
this.enumlist = new EnumList(argdic);
|
||||
else
|
||||
General.ErrorLogger.Add(ErrorType.Error, actorname + ": unable to parse explicit enum structure for argument \"" + argtitle + "\"!");
|
||||
}
|
||||
else
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, actorname + ": unable to parse enum structure for argument \"" + argtitle + "\"!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.enumlist == null) this.enumlist = new EnumList();
|
||||
this.defaultvalue = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -358,8 +358,11 @@ namespace CodeImp.DoomBuilder.Config
|
|||
for(int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if(!actor.HasPropertyWithValue("$arg" + i)) continue;
|
||||
string argtitle = actor.GetPropertyAllValues("$arg" + i);
|
||||
args[i] = new ArgumentInfo(ZDTextParser.StripQuotes(argtitle), ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "tooltip").Replace("\\n", Environment.NewLine)));
|
||||
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 argenum = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "enum"));
|
||||
args[i] = new ArgumentInfo(title, argtitle, argtooltip, argtype, argenum, General.Map.Config.Enums);
|
||||
}
|
||||
|
||||
// Remove doublequotes from title
|
||||
|
|
Loading…
Reference in a new issue