diff --git a/Help/default.css b/Help/default.css index 1fdf8557..60f9ebb7 100644 --- a/Help/default.css +++ b/Help/default.css @@ -54,7 +54,7 @@ pre { background: #f4f4f4; color: #515151; - width: 500px; + width: 600px; margin: 10px 0px 10px 20px; font: 100% Courier New,Courier,sans-serif; text-align: left; diff --git a/Help/gc_decoratekeys.html b/Help/gc_decoratekeys.html index bdd86ace..d814d801 100644 --- a/Help/gc_decoratekeys.html +++ b/Help/gc_decoratekeys.html @@ -18,7 +18,7 @@
- Doom Builder 2 includes a DECORATE parser used to obtain relevant information (such as editor number, Radius, Height, Scale, and so on) from custom actors. Additional information can be conveyed with keys in the form of special comments inserted within an actor's declaration block: + Doom Builder 2 includes a DECORATE parser used to obtain relevant information (such as editor number, Radius, Height, Scale, and so on) from custom actors. Additional information can be conveyed with keys in the form of special comments inserted within an actor's declaration block:
//$Category <category>
Specifies in which category (Monsters, Weapons, etc.) it should be sorted. By default, a custom actor not identified in a configuration file will be put in the Decorate category.
//$Sprite <sprite>
@@ -29,14 +29,18 @@
//$Title <title>
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.
+ //$ArgN <name> (GZDoom Builder only)
+ Allows to override default argument names for this actor.
+
+
//$Color <color index> (GZDoom Builder only)
Allows to override category color for this actor. Possible values:
Actor ChexShield : ResistanceRune replaces ResistanceRune 5104 { - //$Category powerups - //$Sprite ARMXA0 - //$Title "Chex Shield" - //$Color 12 - Height 44 - Radius 26 - Inventory.PickupMessage "Picked up the energized Chex armor!" - - States - { - Spawn: - ARMX A 1 - Loop - } + //$Category powerups + //$Sprite ARMXA0 + //$Title "Chex Shield" + //$Arg0 "Respawn Delay" + //$Arg1 "Armor Ammount" + //$Color 12 + + Height 44 + Radius 26 + Inventory.PickupMessage "Picked up the energized Chex armor!" + + States + { + Spawn: + ARMX A 1 + Loop + } }diff --git a/Source/Core/Config/ArgumentInfo.cs b/Source/Core/Config/ArgumentInfo.cs index f0010ac0..124b6400 100644 --- a/Source/Core/Config/ArgumentInfo.cs +++ b/Source/Core/Config/ArgumentInfo.cs @@ -91,10 +91,19 @@ namespace CodeImp.DoomBuilder.Config if (this.enumlist == null) this.enumlist = new EnumList(); //mxd } + //mxd. Constructor for an argument info defined in DECORATE + internal ArgumentInfo(int argindex, string title) + { + this.used = true; + this.title = title; + this.type = 0; + this.enumlist = new EnumList(); + this.defaultvalue = 0; + } + // Constructor for unknown argument info internal ArgumentInfo(int argindex) { - // Read this.used = false; this.title = "Argument " + (argindex + 1); this.type = 0; diff --git a/Source/Core/Config/ThingTypeInfo.cs b/Source/Core/Config/ThingTypeInfo.cs index 872565d2..d83350ee 100644 --- a/Source/Core/Config/ThingTypeInfo.cs +++ b/Source/Core/Config/ThingTypeInfo.cs @@ -45,28 +45,26 @@ namespace CodeImp.DoomBuilder.Config #region ================== Variables // Properties - private int index; + private readonly int index; private string title; private string sprite; private ActorStructure actor; + private readonly string classname; //mxd private long spritelongname; private int color; - private bool arrow; + private readonly bool arrow; private float radius; private float height; private bool hangs; private int blocking; private int errorcheck; - private bool fixedsize; - private bool fixedrotation; //mxd - private ThingCategory category; - private ArgumentInfo[] args; - private bool isknown; - private bool absolutez; + private readonly bool fixedsize; + private readonly bool fixedrotation; //mxd + private readonly ThingCategory category; + private readonly ArgumentInfo[] args; + private readonly bool isknown; + private readonly bool absolutez; private SizeF spritescale; - - //mxd - private string classname; #endregion @@ -284,9 +282,16 @@ namespace CodeImp.DoomBuilder.Config color = (ci == 0 || ci > 19 ? 18 : ci) ; } + //mxd. Custom argument titles? + for(int i = 0; i < args.Length; i++) + { + if(!actor.HasPropertyWithValue("$arg" + i)) continue; + string argtitle = actor.GetPropertyAllValues("$arg" + i); + args[i] = new ArgumentInfo(i, ZDTextParser.StripQuotes(argtitle)); + } + // Remove doublequotes from title - if((title.Length > 2) && title.StartsWith("\"") && title.EndsWith("\"")) - title = title.Substring(1, title.Length - 2); + title = ZDTextParser.StripQuotes(title); //mxd // Set sprite string suitablesprite = actor.FindSuitableSprite(); diff --git a/Source/Core/ZDoom/ZDTextParser.cs b/Source/Core/ZDoom/ZDTextParser.cs index 5a5252c0..a0f5d146 100644 --- a/Source/Core/ZDoom/ZDTextParser.cs +++ b/Source/Core/ZDoom/ZDTextParser.cs @@ -99,13 +99,13 @@ namespace CodeImp.DoomBuilder.ZDoom } // This returns true if the given character is whitespace - protected internal bool IsWhitespace(char c) + private bool IsWhitespace(char c) { return (whitespace.IndexOf(c) > -1); } // This returns true if the given character is a special token - protected internal bool IsSpecialToken(char c) + private bool IsSpecialToken(char c) { return (specialtokens.IndexOf(c) > -1); } @@ -116,9 +116,15 @@ namespace CodeImp.DoomBuilder.ZDoom if(s.Length > 0) return (specialtokens.IndexOf(s[0]) > -1); return false; } + + //mxd. This removes beginning and ending quotes from a token + protected internal string StripTokenQuotes(string token) + { + return StripQuotes(token); + } // This removes beginning and ending quotes from a token - protected internal string StripTokenQuotes(string token) + internal static string StripQuotes(string token) { // Remove first character, if it is a quote if(!string.IsNullOrEmpty(token) && (token[0] == '"'))