Added, Game configurations: added "Polyobject number":25 argument type. When set, used polyobject numbers will be displayed in the action argument dropdown.

Added, Map Analysis mode: Polyobj_ExplicitLine action was not checked by "Check polyobjects" check. 
Updated ZDoom_linedefs.cfg and Hexen_linedefs.cfg (polyobject number linedef args now have type 25).
Updated documentation ("Game Configuration - Action Argument Settings").
This commit is contained in:
MaxED 2016-04-07 08:40:23 +00:00
parent 23e4a86a95
commit 1636be7be6
10 changed files with 152 additions and 56 deletions

View file

@ -11,22 +11,24 @@ misc
polyobj
{
title = "Polyobj";
title = "Polyobjects";
1
{
title = "Polyobj Start Line";
title = "Polyobject Start Line";
id = "Polyobj_StartLine";
requiresactivation = false;
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
{
title = "Mirror Polyobj Number";
title = "Mirror Polyobject Number";
type = 25;
}
arg2
@ -37,12 +39,13 @@ polyobj
2
{
title = "Polyobj Rotate Left";
title = "Polyobject Rotate Left";
id = "Polyobj_RotateLeft";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -63,12 +66,13 @@ polyobj
3
{
title = "Polyobj Rotate Right";
title = "Polyobject Rotate Right";
id = "Polyobj_RotateRight";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -89,12 +93,13 @@ polyobj
4
{
title = "Polyobj Move";
title = "Polyobject Move";
id = "Polyobj_Move";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -120,13 +125,14 @@ polyobj
5
{
title = "Polyobj Explicit Line";
title = "Polyobject Explicit Line";
id = "Polyobj_ExplicitLine";
requiresactivation = false;
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -136,7 +142,8 @@ polyobj
arg2
{
title = "Mirror Polyobj Number";
title = "Mirror Polyobject Number";
type = 25;
}
arg3
@ -147,12 +154,13 @@ polyobj
6
{
title = "Polyobj Move (* 8)";
title = "Polyobject Move (* 8)";
id = "Polyobj_MoveTimes8";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -178,12 +186,13 @@ polyobj
7
{
title = "Polyobj Door Swing";
title = "Polyobject Door Swing";
id = "Polyobj_DoorSwing";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -211,12 +220,13 @@ polyobj
8
{
title = "Polyobj Door Slide";
title = "Polyobject Door Slide";
id = "Polyobj_DoorSlide";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -250,12 +260,13 @@ polyobj
90
{
title = "Polyobj Rotate Left (override)";
title = "Polyobject Rotate Left (override)";
id = "Polyobj_OR_RotateLeft";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -276,12 +287,13 @@ polyobj
91
{
title = "Polyobj Rotate Right (override)";
title = "Polyobject Rotate Right (override)";
id = "Polyobj_OR_RotateRight";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -302,12 +314,13 @@ polyobj
92
{
title = "Polyobj Move (override)";
title = "Polyobject Move (override)";
id = "Polyobj_OR_Move";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
@ -333,12 +346,13 @@ polyobj
93
{
title = "Polyobj Move (8mu, override)";
title = "Polyobject Move (8mu, override)";
id = "Polyobj_OR_MoveTimes8";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1

View file

@ -460,15 +460,16 @@ zdoom
{
polyobj
{
title = "Polyobject";
title = "Polyobjects";
59
{
title = "Polyobj Move to Spot (override)";
title = "Polyobject Move to Spot (override)";
id = "Polyobj_OR_MoveToSpot";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
{
@ -486,11 +487,12 @@ zdoom
}
86
{
title = "Polyobj Move to Spot";
title = "Polyobject Move to Spot";
id = "Polyobj_MoveToSpot";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
{
@ -508,20 +510,22 @@ zdoom
}
87
{
title = "Polyobj Stop";
title = "Polyobject Stop";
id = "Polyobj_Stop";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
}
88
{
title = "Polyobj Move to";
title = "Polyobject Move to";
id = "Polyobj_MoveTo";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
{
@ -541,11 +545,12 @@ zdoom
}
89
{
title = "Polyobj Move to (override)";
title = "Polyobject Move to (override)";
id = "Polyobj_OR_MoveTo";
arg0
{
title = "Polyobj Number";
title = "Polyobject Number";
type = 25;
}
arg1
{
@ -4202,7 +4207,7 @@ hexen
}
polyobj
{
1 // Polyobj Start Line
1 // Polyobject Start Line
{
arg3
{
@ -4210,7 +4215,7 @@ hexen
type = 0;
}
}
5 // Polyobj Explicit Line
5 // Polyobject Explicit Line
{
arg4
{

View file

@ -47,8 +47,9 @@
<li>14 = Thing tag</li>
<li>15 = Linedef tag</li>
<li>22 = Byte angle (<span class="red">GZDB only</span>)</li>
<li>23 = Thing Radius (<span class="red">GZDB only</span>)</li>
<li>24 = Thing Height (<span class="red">GZDB only</span>)</li>
<li>23 = Thing radius (<span class="red">GZDB only</span>)</li>
<li>24 = Thing height (<span class="red">GZDB only</span>)</li>
<li>25 = Polyobject number (<span class="red">GZDB only</span>)</li>
</ul>
<p><b class="fat">targetclasses</b> (string) - <span class="red">GZDB only</span><br />
When set, only things of given classes will be shown in the argument dropdown list. Used only when argument <strong>type</strong> is 14.<br />

View file

@ -924,6 +924,7 @@
<Compile Include="Rendering\SurfaceManager.cs" />
<Compile Include="Rendering\SurfaceUpdate.cs" />
<Compile Include="Types\AngleByteHandler.cs" />
<Compile Include="Types\PolyobjectNumberHandler.cs" />
<Compile Include="Types\RandomFloatHandler.cs" />
<Compile Include="Types\RandomIntegerHandler.cs" />
<Compile Include="Types\ThingClassHandler.cs" />

View file

@ -29,7 +29,7 @@ namespace CodeImp.DoomBuilder.Types
{
#region ================== Setup
protected override EnumList CreateTagList()
protected override EnumList CreateEnumList()
{
//collect tags
List<int> tags = new List<int>();

View file

@ -0,0 +1,51 @@
#region ================== Namespaces
using System.Collections.Generic;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Types
{
[TypeHandler(UniversalType.PolyobjectNumber, "Polyobject Number", false)]
internal class PolyobjectNumberHandler : SectorTagHandler
{
#region ================== Setup
protected override EnumList CreateEnumList()
{
// Collect polyobjects
HashSet<int> ponums = new HashSet<int>();
EnumList polist = new EnumList();
foreach(Thing t in General.Map.Map.Things)
{
ThingTypeInfo info = General.Map.Data.GetThingInfoEx(t.Type);
if(info == null || info.ClassName.ToLowerInvariant() != "$polyanchor") continue;
ponums.Add(t.AngleDoom);
}
// Now sort them in descending order
List<int> ponumslist = new List<int>(ponums);
ponumslist.Sort((a, b) => -1 * a.CompareTo(b));
// Create enum items
foreach(int ponum in ponums)
polist.Add(new EnumItem(ponum.ToString(), ponum.ToString()));
return polist;
}
#endregion
#region ================== Methods
public override string GetStringValue()
{
return (this.value != null ? this.value.Title : "0: 0");
}
#endregion
}
}

View file

@ -32,7 +32,7 @@ namespace CodeImp.DoomBuilder.Types
#region ================== Variables
private EnumList list;
private EnumItem value;
protected EnumItem value;
private EnumItem defaultvalue;
#endregion
@ -52,7 +52,7 @@ namespace CodeImp.DoomBuilder.Types
base.SetupArgument(attr, arginfo);
// Create enum list reference
list = CreateTagList();
list = CreateEnumList();
// Add default value
list.Insert(0, defaultvalue);
@ -64,11 +64,11 @@ namespace CodeImp.DoomBuilder.Types
base.SetupField(attr, fieldinfo);
// Create enum list reference
list = CreateTagList();
list = CreateEnumList();
}
//mxd
protected virtual EnumList CreateTagList()
protected virtual EnumList CreateEnumList()
{
//collect tags
List<int> tags = new List<int>();

View file

@ -29,7 +29,7 @@ namespace CodeImp.DoomBuilder.Types
{
#region ================== Setup
protected override EnumList CreateTagList()
protected override EnumList CreateEnumList()
{
// Collect tags
List<int> tags = new List<int>();

View file

@ -47,5 +47,6 @@ namespace CodeImp.DoomBuilder.Types
AngleByte = 22, //mxd
ThingRadius = 23, //mxd
ThingHeight = 24, //mxd
PolyobjectNumber = 25, //mxd
}
}

View file

@ -37,6 +37,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
int progress = 0;
int stepprogress = 0;
const string Polyobj_StartLine = "Polyobj_StartLine";
const string Polyobj_ExplicitLine = "Polyobj_ExplicitLine";
// <Polyobj_Action, <Polyobj_number, Lines using this number>>
Dictionary<string, Dictionary<int, List<Linedef>>> polyobjlines = new Dictionary<string, Dictionary<int, List<Linedef>>>();
@ -44,14 +45,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
// All polyobject-related actions
HashSet<string> allactions = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
Polyobj_StartLine, "Polyobj_RotateLeft",
"Polyobj_RotateRight", "Polyobj_Move",
"Polyobj_MoveTimes8", "Polyobj_DoorSwing",
"Polyobj_DoorSlide", "Polyobj_OR_MoveToSpot",
"Polyobj_MoveToSpot", "Polyobj_Stop",
"Polyobj_MoveTo", "Polyobj_OR_MoveTo",
"Polyobj_OR_RotateLeft", "Polyobj_OR_RotateRight",
"Polyobj_OR_Move", "Polyobj_OR_MoveTimes8"
Polyobj_StartLine, Polyobj_ExplicitLine,
"Polyobj_RotateLeft", "Polyobj_RotateRight",
"Polyobj_Move", "Polyobj_MoveTimes8",
"Polyobj_DoorSwing", "Polyobj_DoorSlide",
"Polyobj_OR_MoveToSpot", "Polyobj_MoveToSpot",
"Polyobj_Stop", "Polyobj_MoveTo",
"Polyobj_OR_MoveTo", "Polyobj_OR_RotateLeft",
"Polyobj_OR_RotateRight", "Polyobj_OR_Move",
"Polyobj_OR_MoveTimes8",
};
Dictionary<int, List<Thing>> anchors = new Dictionary<int, List<Thing>>();
@ -136,6 +138,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
// Check Linedefs with Polyobj_ExplicitLine action. These can connect 1 - multiple.
// Polyobject number is arg0, Mirror polyobject number is arg2
if(polyobjlines.ContainsKey(Polyobj_ExplicitLine))
{
foreach(KeyValuePair<int, List<Linedef>> linesbytype in polyobjlines[Polyobj_ExplicitLine])
{
// Check if Mirror Polyobject Number exists
foreach(Linedef linedef in linesbytype.Value)
{
// The value of 0 can mean either "No mirror polyobj" or "Polyobj 0" here...
if(linedef.Args[2] > 0)
{
if(!startspots.ContainsKey(linedef.Args[2]))
SubmitResult(new ResultInvalidPolyobjectLines(new List<Linedef> { linedef }, "\"" + Polyobj_StartLine + "\" action have non-existing Mirror Polyobject Number assigned (" + linedef.Args[2] + "). It won't function correctly ingame."));
if(linedef.Args[2] == linedef.Args[0])
SubmitResult(new ResultInvalidPolyobjectLines(new List<Linedef> { linedef }, "\"" + Polyobj_StartLine + "\" action have the same Polyobject and Mirror Polyobject numbers assigned (" + linedef.Args[2] + "). It won't function correctly ingame."));
}
}
}
}
// Check Polyobject Anchors. These must connect 1 - 1.
foreach(KeyValuePair<int, List<Thing>> group in anchors)
{