mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-18 10:01:48 +00:00
DECORATE: added "$argN" special comment. It can be used to specify default argument names.
Updated documentation.
This commit is contained in:
parent
dc6076496a
commit
e4d872536a
5 changed files with 64 additions and 37 deletions
|
@ -54,7 +54,7 @@ pre
|
||||||
{
|
{
|
||||||
background: #f4f4f4;
|
background: #f4f4f4;
|
||||||
color: #515151;
|
color: #515151;
|
||||||
width: 500px;
|
width: 600px;
|
||||||
margin: 10px 0px 10px 20px;
|
margin: 10px 0px 10px 20px;
|
||||||
font: 100% Courier New,Courier,sans-serif;
|
font: 100% Courier New,Courier,sans-serif;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<div id="contents">
|
<div id="contents">
|
||||||
<p>
|
<p>
|
||||||
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:
|
||||||
<p><strong>//$Category <category></strong><br />
|
<p><strong>//$Category <category></strong><br />
|
||||||
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.
|
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.
|
||||||
<p> <strong>//$Sprite <sprite></strong><br />
|
<p> <strong>//$Sprite <sprite></strong><br />
|
||||||
|
@ -29,14 +29,18 @@
|
||||||
<strong>//$Title <title></strong><br />
|
<strong>//$Title <title></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 <name></strong> (GZDoom Builder only)<br />
|
||||||
|
Allows to override default argument names for this actor.<br />
|
||||||
|
|
||||||
|
<br />
|
||||||
<strong>//$Color <color index></strong> (GZDoom Builder only)<br />
|
<strong>//$Color <color index></strong> (GZDoom Builder only)<br />
|
||||||
Allows to override category color for this actor. Possible values:
|
Allows to override category color for this actor. Possible values:
|
||||||
<ul>
|
<ul>
|
||||||
<li>0 - Dark Gray;</li>
|
<li>0 - Dark Gray;</li>
|
||||||
<li> 1 - Blue;</li>
|
<li>1 - Blue;</li>
|
||||||
<li> 2 - Green;</li>
|
<li>2 - Green;</li>
|
||||||
<li> 3 - Cyan;</li>
|
<li>3 - Cyan;</li>
|
||||||
<li> 4 - Red;</li>
|
<li>4 - Red;</li>
|
||||||
<li>5 - Magenta;</li>
|
<li>5 - Magenta;</li>
|
||||||
<li>6 - Brown;</li>
|
<li>6 - Brown;</li>
|
||||||
<li>7 - Gray;</li>
|
<li>7 - Gray;</li>
|
||||||
|
@ -59,20 +63,23 @@
|
||||||
<pre>
|
<pre>
|
||||||
Actor ChexShield : ResistanceRune replaces ResistanceRune 5104
|
Actor ChexShield : ResistanceRune replaces ResistanceRune 5104
|
||||||
{
|
{
|
||||||
//$Category powerups
|
//$Category powerups
|
||||||
//$Sprite ARMXA0
|
//$Sprite ARMXA0
|
||||||
//$Title "Chex Shield"
|
//$Title "Chex Shield"
|
||||||
//$Color 12
|
//$Arg0 "Respawn Delay"
|
||||||
Height 44
|
//$Arg1 "Armor Ammount"
|
||||||
Radius 26
|
//$Color 12
|
||||||
Inventory.PickupMessage "Picked up the energized Chex armor!"
|
|
||||||
|
Height 44
|
||||||
States
|
Radius 26
|
||||||
{
|
Inventory.PickupMessage "Picked up the energized Chex armor!"
|
||||||
Spawn:
|
|
||||||
ARMX A 1
|
States
|
||||||
Loop
|
{
|
||||||
}
|
Spawn:
|
||||||
|
ARMX A 1
|
||||||
|
Loop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -91,10 +91,19 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
if (this.enumlist == null) this.enumlist = new EnumList(); //mxd
|
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
|
// Constructor for unknown argument info
|
||||||
internal ArgumentInfo(int argindex)
|
internal ArgumentInfo(int argindex)
|
||||||
{
|
{
|
||||||
// Read
|
|
||||||
this.used = false;
|
this.used = false;
|
||||||
this.title = "Argument " + (argindex + 1);
|
this.title = "Argument " + (argindex + 1);
|
||||||
this.type = 0;
|
this.type = 0;
|
||||||
|
|
|
@ -45,28 +45,26 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
private int index;
|
private readonly int index;
|
||||||
private string title;
|
private string title;
|
||||||
private string sprite;
|
private string sprite;
|
||||||
private ActorStructure actor;
|
private ActorStructure actor;
|
||||||
|
private readonly string classname; //mxd
|
||||||
private long spritelongname;
|
private long spritelongname;
|
||||||
private int color;
|
private int color;
|
||||||
private bool arrow;
|
private readonly bool arrow;
|
||||||
private float radius;
|
private float radius;
|
||||||
private float height;
|
private float height;
|
||||||
private bool hangs;
|
private bool hangs;
|
||||||
private int blocking;
|
private int blocking;
|
||||||
private int errorcheck;
|
private int errorcheck;
|
||||||
private bool fixedsize;
|
private readonly bool fixedsize;
|
||||||
private bool fixedrotation; //mxd
|
private readonly bool fixedrotation; //mxd
|
||||||
private ThingCategory category;
|
private readonly ThingCategory category;
|
||||||
private ArgumentInfo[] args;
|
private readonly ArgumentInfo[] args;
|
||||||
private bool isknown;
|
private readonly bool isknown;
|
||||||
private bool absolutez;
|
private readonly bool absolutez;
|
||||||
private SizeF spritescale;
|
private SizeF spritescale;
|
||||||
|
|
||||||
//mxd
|
|
||||||
private string classname;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -284,9 +282,16 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
color = (ci == 0 || ci > 19 ? 18 : ci) ;
|
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
|
// Remove doublequotes from title
|
||||||
if((title.Length > 2) && title.StartsWith("\"") && title.EndsWith("\""))
|
title = ZDTextParser.StripQuotes(title); //mxd
|
||||||
title = title.Substring(1, title.Length - 2);
|
|
||||||
|
|
||||||
// Set sprite
|
// Set sprite
|
||||||
string suitablesprite = actor.FindSuitableSprite();
|
string suitablesprite = actor.FindSuitableSprite();
|
||||||
|
|
|
@ -99,13 +99,13 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
}
|
}
|
||||||
|
|
||||||
// This returns true if the given character is whitespace
|
// 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);
|
return (whitespace.IndexOf(c) > -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This returns true if the given character is a special token
|
// 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);
|
return (specialtokens.IndexOf(c) > -1);
|
||||||
}
|
}
|
||||||
|
@ -116,9 +116,15 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
if(s.Length > 0) return (specialtokens.IndexOf(s[0]) > -1);
|
if(s.Length > 0) return (specialtokens.IndexOf(s[0]) > -1);
|
||||||
return false;
|
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
|
// 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
|
// Remove first character, if it is a quote
|
||||||
if(!string.IsNullOrEmpty(token) && (token[0] == '"'))
|
if(!string.IsNullOrEmpty(token) && (token[0] == '"'))
|
||||||
|
|
Loading…
Reference in a new issue