mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Added, DECORATE: added "//$ArgNRenderStyle" special comment. It allows to specify a rendering shape to display the value of given argument. Supported values are "circle" and "rectangle".
Added, DECORATE: added "//$ArgNRenderColor" special comment. It allows to specify a color used by the rendering shape. Updated documentation.
This commit is contained in:
parent
662725090b
commit
9a6d3ea84c
6 changed files with 203 additions and 34 deletions
|
@ -91,7 +91,19 @@ arg0
|
||||||
</pre>
|
</pre>
|
||||||
Enums can be also set in <a href="gc_decoratekeys.html#argenum">DECORATE</a>.<br />
|
Enums can be also set in <a href="gc_decoratekeys.html#argenum">DECORATE</a>.<br />
|
||||||
|
|
||||||
<p><b class="fat">flags</b> (structure or string) - <span class="red">GZDB only</span><br />
|
<p><b class="fat">renderstyle</b> (string) - <span class="red">GZDB only</span><br />
|
||||||
|
Allows to specify a rendering shape to display the value of this argument. Supported values are:<br />
|
||||||
|
<ul>
|
||||||
|
<li>"<strong>Rectangle</strong>". The argument value is used as rectangle size.</li>
|
||||||
|
<li>"<strong>Circle</strong>". The argument value is used as circle radius.</li>
|
||||||
|
</ul>
|
||||||
|
Rendering shapes can be toggled using "<strong><a href="gzdb/features/general/rendering_toolbar.html">Toggle Event Lines</a></strong>" action/menu button.<br />
|
||||||
|
Currently rendering shapes are supported only for Thing arguments.<br />Currently rendering shapes are shown only in Classic modes.</p>
|
||||||
|
<p><b class="fat">rendercolor</b> (integer) - <span class="red">GZDB only</span><br />
|
||||||
|
Allows to specify a color used by rendering shape. Supported values are hex color (like "<strong>FF0000</strong>"), HTML-formatted hex color (like "<strong>#F00</strong>" or "<strong>#FF0000</strong>") or color name (like "<strong>Red</strong>").<br />
|
||||||
|
By default rendering shapes will use Event line <a href="w_preferences.html">editor color</a>.<br />
|
||||||
|
This property must be used in conjunction with the "<b class="fat">renderstyle</b>" property.</p>
|
||||||
|
<p><b class="fat">flags</b> (structure or string) - <span class="red">GZDB only</span><br />
|
||||||
Provides a list of predefined bit flag values to display for this argument. Used only when argument <strong>type</strong> is 26.<br />
|
Provides a list of predefined bit flag values to display for this argument. Used only when argument <strong>type</strong> is 26.<br />
|
||||||
The value can be either a name of a predefined enum or an explicit definition.<br />
|
The value can be either a name of a predefined enum or an explicit definition.<br />
|
||||||
<strong>Example:</strong>
|
<strong>Example:</strong>
|
||||||
|
|
|
@ -48,17 +48,35 @@
|
||||||
Allows to override default argument names for this actor.<br />
|
Allows to override default argument names for this actor.<br />
|
||||||
<br />
|
<br />
|
||||||
<strong><a name="argdefault" id="argdefault"></a>//$ArgNDefault <integer></strong> - <span class="red">GZDB only</span>.<br />
|
<strong><a name="argdefault" id="argdefault"></a>//$ArgNDefault <integer></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 "<strong>//$ArgN</strong>" property.<br />
|
Allows to set the default value for this argument. This property must be used in conjunction with the "<strong>//$ArgN</strong>" property.<br />
|
||||||
<br />
|
<br />
|
||||||
<strong><a name="argtooltip" id="argtooltip"></a>//$ArgNTooltip <text></strong> - <span class="red">GZDB only</span>.<br />
|
<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>" property.<br />
|
Allows to specify a tooltip text displayed for this argument. Newline character ("\n") can be used to format the text. This property must be used in conjunction with the "<strong>//$ArgN</strong>" 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 <integer></strong> - <span class="red">GZDB only</span>.<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. This property can only be used in conjunction with "<strong>//$ArgN</strong>" property.<br />
|
Allows to specify an <a href="gc_argumentsettings.html#argtype">argument type</a> for this argument. This property must be used in conjunction with the "<strong>//$ArgN</strong>" property.<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<strong><a name="argrenderstyle" id="argrenderstyle"></a>//$ArgNRenderStyle <string></strong> - <span class="red">GZDB only</span>.<br />
|
||||||
|
Allows to specify a rendering shape to display the value of this argument. Supported values are:<br />
|
||||||
|
<ul>
|
||||||
|
<li>"<strong>Rectangle</strong>". The argument value is used as rectangle size.</li>
|
||||||
|
<li>"<strong>Circle</strong>". The argument value is used as circle radius.</li>
|
||||||
|
</ul>
|
||||||
|
Rendering shapes can be toggled using "<strong><a href="gzdb/features/general/rendering_toolbar.html">Toggle Event Lines</a></strong>" action/menu button.<br />
|
||||||
|
Currently rendering shapes are shown only in Classic modes.<br />
|
||||||
|
This property must be used in conjunction with the "<strong>//$ArgN</strong>" property.<br />
|
||||||
|
<br />
|
||||||
|
<strong><a name="argrendercolor" id="argrendercolor"></a>//$ArgNRenderColor <integer></strong> - <span class="red">GZDB only</span>.<br />
|
||||||
|
Allows to specify a color used by rendering shape. Supported values are hex color (like "<strong>FF0000</strong>"), HTML-formatted hex color (like "<strong>#F00</strong>" or "<strong>#FF0000</strong>") or color name (like "<strong>Red</strong>").<br />
|
||||||
|
By default rendering shapes will use Event line <a href="w_preferences.html">editor color</a>.<br />
|
||||||
|
This property must be used in conjunction with "<strong>//$ArgN</strong>" and "<strong>//$ArgNRenderStyle</strong>" properties.<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
<strong><a name="argenum" id="argenum"></a>//$ArgNEnum <string or structure></strong> - <span class="red">GZDB only</span>.<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. This property can only be used in conjunction with "<strong>//$ArgN</strong>" property.<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 must be used in conjunction with the "<strong>//$ArgN</strong>" property.<br />
|
||||||
<br />
|
<br />
|
||||||
<strong><a name="color" id="color"></a>//$Color <color index></strong> - <span class="red">GZDB only</span>.<br />
|
<strong><a name="color" id="color"></a>//$Color <color index></strong> - <span class="red">GZDB only</span>.<br />
|
||||||
Allows to override category color for this actor. Possible values are:
|
Allows to override category color for this actor. Possible values are:
|
||||||
|
@ -117,6 +135,8 @@ Actor ChexShield : ResistanceRune replaces ResistanceRune 5104
|
||||||
//$Arg3 "Radius"
|
//$Arg3 "Radius"
|
||||||
//$Arg3Type 23
|
//$Arg3Type 23
|
||||||
//$Arg3Default 32
|
//$Arg3Default 32
|
||||||
|
//$Arg3RenderStyle "Circle"
|
||||||
|
//$Arg3RenderColor #ff00ff
|
||||||
|
|
||||||
//$Arg4 "Height"
|
//$Arg4 "Height"
|
||||||
//$Arg4Type 24
|
//$Arg4Type 24
|
||||||
|
@ -142,7 +162,7 @@ actor SuperGiantImpBall : DoomImpBall
|
||||||
Damage 30
|
Damage 30
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<span class="big">Category definitions (GZDB only):</span><br />
|
<span class="big">Category definitions (GZDB only):</span><br />
|
||||||
<br />
|
<br />
|
||||||
Thing categories can be defined in DECORATE using <strong>#region</strong> / <strong>#endregion</strong> blocks. Region name is used as thing category title. "<strong>//$Category</strong>" actor block definition overrides these. Additional information can be conveyed with keys in the form of special comments inserted within <strong>#region</strong> / <strong>#endregion</strong> block (these keys replicate Game Configuration <a href="gc_thingsettings.html#catdefs">thing category properties</a> with a slightly different syntax):<br />
|
Thing categories can be defined in DECORATE using <strong>#region</strong> / <strong>#endregion</strong> blocks. Region name is used as thing category title. "<strong>//$Category</strong>" actor block definition overrides these. Additional information can be conveyed with keys in the form of special comments inserted within <strong>#region</strong> / <strong>#endregion</strong> block (these keys replicate Game Configuration <a href="gc_thingsettings.html#catdefs">thing category properties</a> with a slightly different syntax):<br />
|
||||||
|
@ -163,7 +183,6 @@ Thing categories can be defined in DECORATE using <strong>#region</strong> / <st
|
||||||
<b class="fat">//$Error</b> (integer) [0 .. 2]<br />
|
<b class="fat">//$Error</b> (integer) [0 .. 2]<br />
|
||||||
Sets the stuck things error checking mode to use on this thing. <br />
|
Sets the stuck things error checking mode to use on this thing. <br />
|
||||||
Possible values are:
|
Possible values are:
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>0 - Don't check this thing.</li>
|
<li>0 - Don't check this thing.</li>
|
||||||
<li>1 - Check if the thing is outside of map geometry.</li>
|
<li>1 - Check if the thing is outside of map geometry.</li>
|
||||||
|
|
|
@ -21,7 +21,9 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using CodeImp.DoomBuilder.IO;
|
using CodeImp.DoomBuilder.IO;
|
||||||
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using CodeImp.DoomBuilder.Types;
|
using CodeImp.DoomBuilder.Types;
|
||||||
|
using CodeImp.DoomBuilder.ZDoom;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -31,6 +33,19 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
{
|
{
|
||||||
#region ================== Constants
|
#region ================== Constants
|
||||||
|
|
||||||
|
private const int HELPER_SHAPE_ALPHA = 192; //mxd
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ================== Enums (mxd)
|
||||||
|
|
||||||
|
public enum ArgumentRenderStyle
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
CIRCLE,
|
||||||
|
RECTANGLE,
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
@ -43,6 +58,8 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
private EnumList flagslist; //mxd
|
private EnumList flagslist; //mxd
|
||||||
private readonly object defaultvalue; //mxd
|
private readonly object defaultvalue; //mxd
|
||||||
private readonly HashSet<string> targetclasses; //mxd
|
private readonly HashSet<string> targetclasses; //mxd
|
||||||
|
private readonly ArgumentRenderStyle renderstyle; //mxd
|
||||||
|
private readonly PixelColor rendercolor; //mxd
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -56,6 +73,8 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
public EnumList Enum { get { return enumlist; } internal set { enumlist = value; } }
|
public EnumList Enum { get { return enumlist; } internal set { enumlist = value; } }
|
||||||
public EnumList Flags { get { return flagslist; } internal set { flagslist = value; } } //mxd
|
public EnumList Flags { get { return flagslist; } internal set { flagslist = value; } } //mxd
|
||||||
public object DefaultValue { get { return defaultvalue; } } //mxd
|
public object DefaultValue { get { return defaultvalue; } } //mxd
|
||||||
|
public ArgumentRenderStyle RenderStyle { get { return renderstyle; } } //mxd
|
||||||
|
public PixelColor RenderColor { get { return rendercolor; } } //mxd
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -72,6 +91,44 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
this.type = cfg.ReadSetting(argspath + ".arg" + istr + ".type", 0);
|
this.type = cfg.ReadSetting(argspath + ".arg" + istr + ".type", 0);
|
||||||
this.defaultvalue = cfg.ReadSetting(argspath + ".arg" + istr + ".default", 0); //mxd
|
this.defaultvalue = cfg.ReadSetting(argspath + ".arg" + istr + ".default", 0); //mxd
|
||||||
|
|
||||||
|
//mxd. Get rendering hint settings
|
||||||
|
string renderstyle = cfg.ReadSetting(argspath + ".arg" + istr + ".renderstyle", string.Empty);
|
||||||
|
switch(renderstyle.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "circle":
|
||||||
|
this.renderstyle = ArgumentRenderStyle.CIRCLE;
|
||||||
|
break;
|
||||||
|
case "rectangle":
|
||||||
|
this.renderstyle = ArgumentRenderStyle.RECTANGLE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.renderstyle = ArgumentRenderStyle.NONE;
|
||||||
|
if(!string.IsNullOrEmpty(renderstyle))
|
||||||
|
General.ErrorLogger.Add(ErrorType.Error, "\"" + argspath + ".arg" + istr + "\": action argument \"" + this.title + "\" has unknown renderstyle \"" + renderstyle + "\"!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.renderstyle != ArgumentRenderStyle.NONE)
|
||||||
|
{
|
||||||
|
string rendercolor = cfg.ReadSetting(argspath + ".arg" + istr + ".rendercolor", string.Empty);
|
||||||
|
if(!string.IsNullOrEmpty(rendercolor))
|
||||||
|
{
|
||||||
|
if(!ZDTextParser.GetColorFromString(rendercolor, ref this.rendercolor))
|
||||||
|
{
|
||||||
|
General.ErrorLogger.Add(ErrorType.Error, "\"" + argspath + ".arg" + istr + "\": action argument \"" + this.title + "\": unable to get rendercolor from value \"" + rendercolor + "\"!");
|
||||||
|
this.rendercolor = General.Colors.InfoLine.WithAlpha(HELPER_SHAPE_ALPHA);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.rendercolor.a = HELPER_SHAPE_ALPHA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.rendercolor = General.Colors.InfoLine.WithAlpha(HELPER_SHAPE_ALPHA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//mxd. Check for TargetClass?
|
//mxd. Check for TargetClass?
|
||||||
this.targetclasses = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
this.targetclasses = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
if(this.type == (int)UniversalType.ThingTag)
|
if(this.type == (int)UniversalType.ThingTag)
|
||||||
|
@ -138,7 +195,8 @@ 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, int defaultvalue, string enumstr, IDictionary<string, EnumList> enums)
|
internal ArgumentInfo(string actorname, string argtitle, string tooltip, string renderstyle, string rendercolor,
|
||||||
|
int type, int defaultvalue, string enumstr, IDictionary<string, EnumList> enums)
|
||||||
{
|
{
|
||||||
this.used = true;
|
this.used = true;
|
||||||
this.title = argtitle;
|
this.title = argtitle;
|
||||||
|
@ -146,6 +204,38 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
this.defaultvalue = defaultvalue;
|
this.defaultvalue = defaultvalue;
|
||||||
this.flagslist = new EnumList(); //mxd
|
this.flagslist = new EnumList(); //mxd
|
||||||
|
|
||||||
|
// Get rendering hint settings
|
||||||
|
switch(renderstyle.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "circle": this.renderstyle = ArgumentRenderStyle.CIRCLE; break;
|
||||||
|
case "rectangle": this.renderstyle = ArgumentRenderStyle.RECTANGLE; break;
|
||||||
|
default:
|
||||||
|
this.renderstyle = ArgumentRenderStyle.NONE;
|
||||||
|
if(!string.IsNullOrEmpty(renderstyle))
|
||||||
|
General.ErrorLogger.Add(ErrorType.Error, actorname + ": action argument \"" + argtitle + "\" has unknown renderstyle \"" + renderstyle + "\"!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.renderstyle != ArgumentRenderStyle.NONE)
|
||||||
|
{
|
||||||
|
if(!string.IsNullOrEmpty(rendercolor))
|
||||||
|
{
|
||||||
|
if(!ZDTextParser.GetColorFromString(rendercolor, ref this.rendercolor))
|
||||||
|
{
|
||||||
|
General.ErrorLogger.Add(ErrorType.Error, actorname + ": action argument \"" + argtitle + "\": unable to get rendercolor from value \"" + rendercolor + "\"!");
|
||||||
|
this.rendercolor = General.Colors.InfoLine.WithAlpha(HELPER_SHAPE_ALPHA);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.rendercolor.a = HELPER_SHAPE_ALPHA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.rendercolor = General.Colors.InfoLine.WithAlpha(HELPER_SHAPE_ALPHA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get argument type
|
// Get argument type
|
||||||
if(System.Enum.IsDefined(typeof(UniversalType), type))
|
if(System.Enum.IsDefined(typeof(UniversalType), type))
|
||||||
{
|
{
|
||||||
|
|
|
@ -443,7 +443,9 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
int argtype = actor.GetPropertyValueInt("$arg" + i + "type", 0);
|
int argtype = actor.GetPropertyValueInt("$arg" + i + "type", 0);
|
||||||
int defaultvalue = actor.GetPropertyValueInt("$arg" + i + "default", 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, defaultvalue, argenum, General.Map.Config.Enums);
|
string argrenderstyle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "renderstyle"));
|
||||||
|
string argrendercolor = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "rendercolor"));
|
||||||
|
args[i] = new ArgumentInfo(title, argtitle, argtooltip, argrenderstyle, argrendercolor, argtype, defaultvalue, argenum, General.Map.Config.Enums);
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. Some SLADE compatibility
|
//mxd. Some SLADE compatibility
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using CodeImp.DoomBuilder.Config;
|
using CodeImp.DoomBuilder.Config;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
using CodeImp.DoomBuilder.VisualModes;
|
using CodeImp.DoomBuilder.VisualModes;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.GZBuilder.Data
|
namespace CodeImp.DoomBuilder.GZBuilder.Data
|
||||||
|
@ -71,6 +73,39 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<Line3D> MakeCircleLines(Vector2D pos, PixelColor color, float radius, int numsides)
|
||||||
|
{
|
||||||
|
List<Line3D> result = new List<Line3D>(numsides);
|
||||||
|
Vector2D start = new Vector2D(pos.x, pos.y + radius);
|
||||||
|
float anglestep = Angle2D.PI2 / numsides;
|
||||||
|
|
||||||
|
for(int i = 1; i < numsides + 1; i++)
|
||||||
|
{
|
||||||
|
Vector2D end = pos + new Vector2D((float)Math.Sin(anglestep * i) * radius, (float)Math.Cos(anglestep * i) * radius);
|
||||||
|
result.Add(new Line3D(start, end, color, false));
|
||||||
|
start = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<Line3D> MakeRectangleLines(Vector2D pos, PixelColor color, float size)
|
||||||
|
{
|
||||||
|
float halfsize = size / 2;
|
||||||
|
Vector2D tl = new Vector2D(pos.x - halfsize, pos.y - halfsize);
|
||||||
|
Vector2D tr = new Vector2D(pos.x + halfsize, pos.y - halfsize);
|
||||||
|
Vector2D bl = new Vector2D(pos.x - halfsize, pos.y + halfsize);
|
||||||
|
Vector2D br = new Vector2D(pos.x + halfsize, pos.y + halfsize);
|
||||||
|
|
||||||
|
return new List<Line3D>
|
||||||
|
{
|
||||||
|
new Line3D(tl, tr, color, false),
|
||||||
|
new Line3D(tr, br, color, false),
|
||||||
|
new Line3D(bl, br, color, false),
|
||||||
|
new Line3D(bl, tl, color, false),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static List<Line3D> GetThingLinks(IEnumerable<Thing> things) { return GetThingLinks(things, null); }
|
public static List<Line3D> GetThingLinks(IEnumerable<Thing> things) { return GetThingLinks(things, null); }
|
||||||
public static List<Line3D> GetThingLinks(IEnumerable<Thing> things, VisualBlockMap blockmap)
|
public static List<Line3D> GetThingLinks(IEnumerable<Thing> things, VisualBlockMap blockmap)
|
||||||
{
|
{
|
||||||
|
@ -367,6 +402,34 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Process arg helpers
|
||||||
|
const int numsides = 24;
|
||||||
|
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
|
||||||
|
{
|
||||||
|
if(t.Action != 0) continue;
|
||||||
|
ThingTypeInfo tti = General.Map.Data.GetThingInfoEx(t.Type);
|
||||||
|
if(tti == null) continue;
|
||||||
|
|
||||||
|
for(int i = 0; i < t.Args.Length; i++)
|
||||||
|
{
|
||||||
|
if(t.Args[i] != 0 && tti.Args[i].RenderStyle != ArgumentInfo.ArgumentRenderStyle.NONE)
|
||||||
|
{
|
||||||
|
switch(tti.Args[i].RenderStyle)
|
||||||
|
{
|
||||||
|
case ArgumentInfo.ArgumentRenderStyle.CIRCLE:
|
||||||
|
lines.AddRange(MakeCircleLines(t.Position, tti.Args[i].RenderColor, t.Args[i], numsides));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ArgumentInfo.ArgumentRenderStyle.RECTANGLE:
|
||||||
|
lines.AddRange(MakeRectangleLines(t.Position, tti.Args[i].RenderColor, t.Args[i]));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: throw new NotImplementedException("Unknown ArgumentRenderStyle");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1115,31 +1115,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
// Add lines if visible
|
// Add lines if visible
|
||||||
const int numsides = 24;
|
const int numsides = 24;
|
||||||
if(primaryradius > 0) circles.AddRange(MakeCircleLines(t.Position, color, primaryradius, numsides));
|
if(primaryradius > 0) circles.AddRange(LinksCollector.MakeCircleLines(t.Position, color, primaryradius, numsides));
|
||||||
if(secondaryradius > 0) circles.AddRange(MakeCircleLines(t.Position, color, secondaryradius, numsides));
|
if(secondaryradius > 0) circles.AddRange(LinksCollector.MakeCircleLines(t.Position, color, secondaryradius, numsides));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
return circles;
|
return circles;
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
|
||||||
private static IEnumerable<Line3D> MakeCircleLines(Vector2D pos, PixelColor color, float radius, int numsides)
|
|
||||||
{
|
|
||||||
List<Line3D> result = new List<Line3D>(numsides);
|
|
||||||
Vector2D start = new Vector2D(pos.x, pos.y + radius);
|
|
||||||
float anglestep = Angle2D.PI2 / numsides;
|
|
||||||
|
|
||||||
for(int i = 1; i < numsides + 1; i++)
|
|
||||||
{
|
|
||||||
Vector2D end = pos + new Vector2D((float)Math.Sin(anglestep * i) * radius, (float)Math.Cos(anglestep * i) * radius);
|
|
||||||
result.Add(new Line3D(start, end, color, false));
|
|
||||||
start = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Actions
|
#region ================== Actions
|
||||||
|
|
Loading…
Reference in a new issue