diff --git a/Build/Configurations/Includes/ZDoom_misc.cfg b/Build/Configurations/Includes/ZDoom_misc.cfg
index 69b7e9e5..e6776d41 100644
--- a/Build/Configurations/Includes/ZDoom_misc.cfg
+++ b/Build/Configurations/Includes/ZDoom_misc.cfg
@@ -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)
diff --git a/Help/gc_argumentsettings.html b/Help/gc_argumentsettings.html
index 5db2a660..5778ad44 100644
--- a/Help/gc_argumentsettings.html
+++ b/Help/gc_argumentsettings.html
@@ -29,12 +29,14 @@
tooltip = "Polyobject that will mirror\nthis one's movements.";
}
- type (integer)
- Sets the type of this argument. This changes the behaviour of Argument inputs in Linedef and Thing Edit windows. Supported values are:
+ type (integer)
+ Sets the type of this argument. This changes the behaviour of Argument inputs in Linedef and Thing Edit windows.
+ Argument type can be also set in DECORATE.
+ Supported values are:
- 0 = Integer (default)
- - 4 = Linedeftype
+ - 4 = Action special
- 5 = Sector effect
- 8 = Angle in degrees
- 10 = XXRRGGBB color
@@ -72,6 +74,7 @@ arg0
}
}
+ Enums can be also set in DECORATE.
default (integer) - GZDB only.
Sets the default value for a Thing or Linedef argument definition.
diff --git a/Help/gc_decoratekeys.html b/Help/gc_decoratekeys.html
index d1cc7dd0..66e23a89 100644
--- a/Help/gc_decoratekeys.html
+++ b/Help/gc_decoratekeys.html
@@ -36,6 +36,12 @@
//$ArgNTooltip <text> - GZDB only.
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 "$ArgN".
Argument tooltips can be also set for things and linedefs in a Game Configuration.
+
+ //$ArgNType <integer> - GZDB only.
+ Allows to specify an argument type for this argument.
+
+ //$ArgNEnum <string or structure> - GZDB only.
+ 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.
//$Color <color index> - GZDB only.
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
diff --git a/Source/Core/Config/ArgumentInfo.cs b/Source/Core/Config/ArgumentInfo.cs
index 44b46a14..c5773dbb 100644
--- a/Source/Core/Config/ArgumentInfo.cs
+++ b/Source/Core/Config/ArgumentInfo.cs
@@ -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 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;
}
diff --git a/Source/Core/Config/ThingTypeInfo.cs b/Source/Core/Config/ThingTypeInfo.cs
index ec166fc5..1f9454c7 100644
--- a/Source/Core/Config/ThingTypeInfo.cs
+++ b/Source/Core/Config/ThingTypeInfo.cs
@@ -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