Slope types are now handled via the config

This commit is contained in:
MascaraSnake 2016-01-15 00:47:32 +01:00
parent 16d8bb39c6
commit cbb210e1ae
14 changed files with 106 additions and 80 deletions

View file

@ -2072,24 +2072,32 @@ linedeftypes
{
title = "Slope Frontside Floor";
prefix = "(700)";
slope = true;
slopetype = 5;
}
701
{
title = "Slope Frontside Ceiling";
prefix = "(701)";
slope = true;
slopetype = 9;
}
702
{
title = "Slope Frontside Floor & Ceiling";
prefix = "(702)";
slope = true;
slopetype = 13;
}
703
{
title = "Slope Frontside Floor and Backside Ceiling";
prefix = "(703)";
slope = true;
slopetype = 37;
}
704
@ -2097,6 +2105,8 @@ linedeftypes
title = "Slope Frontside Floor by 3 Tagged Vertex Things";
prefix = "(704)";
flags8192text = "[13] Use tag and offsets";
slope = true;
slopetype = 7;
}
705
@ -2104,30 +2114,40 @@ linedeftypes
title = "Slope Frontside Ceiling by 3 Tagged Vertex Things";
prefix = "(705)";
flags8192text = "[13] Use tag and offsets";
slope = true;
slopetype = 11;
}
710
{
title = "Slope Backside Floor";
prefix = "(710)";
slope = true;
slopetype = 17;
}
711
{
title = "Slope Backside Ceiling";
prefix = "(711)";
slope = true;
slopetype = 33;
}
712
{
title = "Slope Backside Floor & Ceiling";
prefix = "(712)";
slope = true;
slopetype = 49;
}
713
{
title = "Slope Backside Floor & Frontside Ceiling";
prefix = "(713)";
slope = true;
slopetype = 25;
}
714
@ -2135,6 +2155,8 @@ linedeftypes
title = "Slope Backside Floor by 3 Tagged Vertex Things";
prefix = "(714)";
flags8192text = "[13] Use tag and offsets";
slope = true;
slopetype = 19;
}
715
@ -2142,24 +2164,32 @@ linedeftypes
title = "Slope Backside Ceiling by 3 Tagged Vertex Things";
prefix = "(715)";
flags8192text = "[13] Use tag and offsets";
slope = true;
slopetype = 35;
}
721
{
title = "Copy Frontside Ceiling Slope from Line Tag";
prefix = "(720)";
slope = true;
slopetype = 10;
}
720
{
title = "Copy Frontside Floor Slope from Line Tag";
prefix = "(721)";
slope = true;
slopetype = 6;
}
722
{
title = "Copy Frontside Floor & Ceiling Slope from Line Tag";
prefix = "(722)";
slope = true;
slopetype = 14;
}
}

View file

@ -46,6 +46,8 @@ namespace CodeImp.DoomBuilder.Config
private readonly bool isknown;
private readonly bool requiresactivation; //mxd
private IDictionary<string, string> flags;
private readonly bool slope;
private readonly int slopetype;
#endregion
@ -63,6 +65,11 @@ namespace CodeImp.DoomBuilder.Config
public bool RequiresActivation { get { return requiresactivation; } } //mxd
public ArgumentInfo[] Args { get { return args; } }
public IDictionary<string, string> Flags { get { return flags; } }
public bool Slope { get { return slope; } }
public int SlopeType { get { return slopetype; } }
public bool IsRegularSlope { get { return slope && (slopetype & 0x3) == 1; } }
public bool IsCopySlope { get { return slope && (slopetype & 0x3) == 2; } }
public bool IsVertexSlope { get { return slope && (slopetype & 0x3) == 3; } }
#endregion
@ -88,6 +95,8 @@ namespace CodeImp.DoomBuilder.Config
this.title = this.prefix + " " + this.name;
this.title = this.title.Trim();
this.flags = new Dictionary<string, string>(ac.Flags);
this.slope = cfg.ReadSetting(actionsetting + ".slope", false);
this.slopetype = cfg.ReadSetting(actionsetting + ".slopetype", 0);
ReadLinedefSpecificFlags(cfg);
// Read the args
@ -107,6 +116,8 @@ namespace CodeImp.DoomBuilder.Config
this.requiresactivation = true; //mxd. Unused, set for consistency sake.
this.title = title;
this.flags = new Dictionary<string, string>();
this.slope = false;
this.slopetype = 0;
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
for(int i = 0; i < Linedef.NUM_ARGS; i++)
this.args[i] = new ArgumentInfo(i);

View file

@ -43,9 +43,6 @@ namespace CodeImp.DoomBuilder.IO
public DoomMapSetIO(WAD wad, MapManager manager) : base(wad, manager)
{
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
startTypes = new List<int>();
}

View file

@ -43,9 +43,6 @@ namespace CodeImp.DoomBuilder.IO
public HexenMapSetIO(WAD wad, MapManager manager) : base(wad, manager)
{
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
startTypes = new List<int>();
}

View file

@ -71,9 +71,6 @@ namespace CodeImp.DoomBuilder.IO
string GetElementName(MapElementType elementtype); //mxd
MapElementType GetElementType(string elementname); //mxd
Dictionary<int, int[]> ThreeDFloorTypes { get; }
Dictionary<int,int[]> SlopeTypes { get; }
Dictionary<int, int[]> SlopeCopyTypes { get; }
Dictionary<int, int[]> VertexSlopeTypes { get; }
Dictionary<int, float> TranslucentLineTypes { get; }
int SlopeVertexType { get; }
int Custom3DFloorType { get; }

View file

@ -46,9 +46,6 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<MapElementType, Dictionary<string, UniversalType>> uifields;
protected Dictionary<int, int[]> threeDFloorTypes;
protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes;
protected Dictionary<int, int[]> vertexSlopeTypes;
protected Dictionary<int, float> translucentLineTypes;
protected List<int> startTypes;
#endregion
@ -98,9 +95,6 @@ namespace CodeImp.DoomBuilder.IO
public abstract int MinThingAngle { get; }
public abstract Dictionary<MapElementType, Dictionary<string, UniversalType>> UIFields { get; } //mxd
public Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
public Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
public Dictionary<int, int[]> VertexSlopeTypes { get { return vertexSlopeTypes; } }
public Dictionary<int, float> TranslucentLineTypes { get { return translucentLineTypes; } }
public abstract int SlopeVertexType { get; }
public abstract int Custom3DFloorType { get; }

View file

@ -102,35 +102,6 @@ namespace CodeImp.DoomBuilder.IO
{ 259, new int[4] { 1, 0, 2, 0} }
};
//Dictionary contents: floor, ceiling (0 = no slope, 1 = slope front, 2 = slope back)
slopeTypes = new Dictionary<int, int[]>() {
{ 700, new int[2] { 1, 0 } },
{ 701, new int[2] { 0, 1 } },
{ 702, new int[2] { 1, 1 } },
{ 703, new int[2] { 1, 2 } },
{ 710, new int[2] { 2, 0 } },
{ 711, new int[2] { 0, 2 } },
{ 712, new int[2] { 2, 2 } },
{ 713, new int[2] { 2, 1 } }
};
//Dictionary contents: floor, ceiling (0 = no slope, 1 = slope front, 2 = slope back)
slopeCopyTypes = new Dictionary<int, int[]>() {
{ 720, new int[2] { 1, 0 } },
{ 721, new int[2] { 0, 1 } },
{ 722, new int[2] { 1, 1 } },
};
//Dictionary contents:
//1. 0 = slope front, 1 = slope back
//2. 0 = slope floor, 1 = slope ceiling
vertexSlopeTypes = new Dictionary<int, int[]>() {
{ 704, new int[2] { 0, 0 } },
{ 705, new int[2] { 0, 1 } },
{ 714, new int[2] { 1, 0 } },
{ 715, new int[2] { 1, 1 } },
};
translucentLineTypes = new Dictionary<int, float>() {
{ 900, 0.9f },
{ 901, 0.8f },

View file

@ -48,9 +48,6 @@ namespace CodeImp.DoomBuilder.IO
if((manager != null) && (manager.Config != null))
{
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
translucentLineTypes = new Dictionary<int, float>() { { 208, -1.0f } };
startTypes = new List<int>();

View file

@ -92,9 +92,9 @@ namespace CodeImp.DoomBuilder.Map
public int Action { get { return action; } set { BeforePropsChange(); action = value; UpdateColorPreset(); } }
public int Activate { get { return activate; } set { BeforePropsChange(); activate = value; UpdateColorPreset(); } }
public bool Is3DFloor { get { return General.Map.FormatInterface.ThreeDFloorTypes.ContainsKey(Action); } }
public bool IsSlope { get { return General.Map.FormatInterface.SlopeTypes.ContainsKey(Action); } }
public bool IsSlopeCopy { get { return General.Map.FormatInterface.SlopeCopyTypes.ContainsKey(Action); } }
public bool IsVertexSlope { get { return General.Map.FormatInterface.VertexSlopeTypes.ContainsKey(Action); } }
public bool IsRegularSlope { get { return (!General.Map.SRB2 && Action == 181) || General.Map.Config.GetLinedefActionInfo(Action).IsRegularSlope; } }
public bool IsCopySlope { get { return (!General.Map.SRB2 && Action == 118) || General.Map.Config.GetLinedefActionInfo(Action).IsCopySlope; } }
public bool IsVertexSlope { get { return General.Map.Config.GetLinedefActionInfo(Action).IsVertexSlope; } }
public bool IsTranslucentLine { get { return General.Map.FormatInterface.TranslucentLineTypes.ContainsKey(Action); } }
public bool IsColormap { get { return Action == General.Map.FormatInterface.ColormapType; } }
public bool IsFlatAlignment { get { return Action == General.Map.FormatInterface.FlatAlignmentType; } }
@ -861,20 +861,42 @@ namespace CodeImp.DoomBuilder.Map
//Set slope arguments for SRB2-style slopes. See http://zdoom.org/wiki/Plane_Align.
public void SetSlopeArgs()
{
int[] settings = General.Map.FormatInterface.SlopeTypes[Action];
Args[0] = settings[0]; //floor
Args[1] = settings[1]; //ceiling
//0 = set from args, 1 = normal, 2 = copy, 3 = vertices, +4 = frontside floor, +8 = frontside ceiling, +16 = backside floor, +32 = backside ceiling
int slopevalue = General.Map.Config.GetLinedefActionInfo(Action).SlopeType;
bool frontfloor = (slopevalue & 0x4) == 0x4;
bool frontceiling = (slopevalue & 0x8) == 0x8;
bool backfloor = (slopevalue & 0x10) == 0x10;
bool backceiling = (slopevalue & 0x20) == 0x20;
Args[0] = frontfloor ? 1 : (backfloor ? 2 : 0); //floor
Args[1] = frontceiling ? 1 : (backceiling ? 2 : 0); //ceiling
Args[2] = 0; //lineid (irrelevant for SRB2)
}
//Finds the appropriate slope type for the current arguments. Sadly there's no better way to do this generically than to iterate over all types. Oh well.
//Finds the appropriate slope type for the current arguments. Sadly there's no better way to do this generically than to iterate over all linedef types. Oh well.
public void SetSlopeTypeFromArgs()
{
foreach (KeyValuePair<int, int[]> type in General.Map.FormatInterface.SlopeTypes)
if (!General.Map.SRB2) Action = 181;
foreach (KeyValuePair<int, LinedefActionInfo> type in General.Map.Config.LinedefActions)
{
if ((type.Value[0] == Args[0] && type.Value[1] == Args[1]) || (type.Value[0] == -1 && type.Value[1] == -1)) {
Action = type.Key;
return;
if (!type.Value.IsRegularSlope) continue;
//0 = set from args, 1 = normal, 2 = copy, 3 = vertices, +4 = frontside floor, +8 = frontside ceiling, +16 = backside floor, +32 = backside ceiling
int slopevalue = type.Value.SlopeType;
if (slopevalue == 0)
{
Action = type.Key;
return;
}
bool frontfloor = (slopevalue & 0x4) == 0x4;
bool frontceiling = (slopevalue & 0x8) == 0x8;
bool backfloor = (slopevalue & 0x10) == 0x10;
bool backceiling = (slopevalue & 0x20) == 0x20;
int args0 = frontfloor ? 1 : (backfloor ? 2 : 0);
int args1 = frontceiling ? 1 : (backceiling ? 2 : 0);
if (Args[0] == args0 && Args[1] == args1)
{
Action = type.Key;
return;
}
}
}
@ -882,11 +904,16 @@ namespace CodeImp.DoomBuilder.Map
//Set slope arguments for SRB2-style copy slopes. See http://zdoom.org/wiki/Plane_Copy.
public void SetSlopeCopyArgs()
{
int[] settings = General.Map.FormatInterface.SlopeCopyTypes[Action];
if (settings[0] == 1) Args[0] = Tag; //front floor
if (settings[0] == 2) Args[2] = Tag; //back floor
if (settings[1] == 1) Args[1] = Tag; //front ceiling
if (settings[1] == 2) Args[3] = Tag; //back ceiling
//0 = set from args, 1 = normal, 2 = copy, 3 = vertices, +4 = frontside floor, +8 = frontside ceiling, +16 = backside floor, +32 = backside ceiling
int slopevalue = General.Map.Config.GetLinedefActionInfo(Action).SlopeType;
bool frontfloor = (slopevalue & 0x4) == 0x4;
bool frontceiling = (slopevalue & 0x8) == 0x8;
bool backfloor = (slopevalue & 0x10) == 0x10;
bool backceiling = (slopevalue & 0x20) == 0x20;
if (frontfloor) Args[0] = Tag; //front floor
if (frontceiling) Args[1] = Tag; //front ceiling
if (backfloor) Args[2] = Tag; //back floor
if (backceiling) Args[3] = Tag; //back ceiling
Args[4] = 0; //share (irrelevant for SRB2)
}
@ -895,9 +922,14 @@ namespace CodeImp.DoomBuilder.Map
//Args[1]: 0 = slope floor, 1 = slope ceiling
public void SetVertexSlopeArgs()
{
int[] settings = General.Map.FormatInterface.VertexSlopeTypes[Action];
Args[0] = settings[0];
Args[1] = settings[1];
//0 = set from args, 1 = normal, 2 = copy, 3 = vertices, +4 = frontside floor, +8 = frontside ceiling, +16 = backside floor, +32 = backside ceiling
int slopevalue = General.Map.Config.GetLinedefActionInfo(Action).SlopeType;
bool frontfloor = (slopevalue & 0x4) == 0x4;
bool frontceiling = (slopevalue & 0x8) == 0x8;
bool backfloor = (slopevalue & 0x10) == 0x10;
bool backceiling = (slopevalue & 0x20) == 0x20;
Args[0] = (frontfloor || frontceiling) ? 0 : 1;
Args[1] = (frontfloor || backfloor) ? 0 : 1;
}
//Set translucent line arguments for SRB2-style translucent walls. See http://zdoom.org/wiki/TranslucentLine.

View file

@ -671,7 +671,7 @@ namespace CodeImp.DoomBuilder.Map
{
// Carbon copy of EffectLineSlope class here...
// MascaraSnake: Handle slopes
if(side.Line.IsSlope && ((side.Line.Args[0] == 1 && side == side.Line.Front) || side.Line.Args[0] == 2) && side.Other != null)
if(side.Line.IsRegularSlope && ((side.Line.Args[0] == 1 && side == side.Line.Front) || side.Line.Args[0] == 2) && side.Other != null)
{
Linedef l = side.Line;
@ -752,7 +752,7 @@ namespace CodeImp.DoomBuilder.Map
{
// Carbon copy of EffectLineSlope class here...
// MascaraSnake: Handle slopes
if(side.Line.IsSlope && ((side.Line.Args[1] == 1 && side == side.Line.Front) || side.Line.Args[1] == 2) && side.Other != null)
if(side.Line.IsRegularSlope && ((side.Line.Args[1] == 1 && side == side.Line.Front) || side.Line.Args[1] == 2) && side.Other != null)
{
Linedef l = side.Line;

View file

@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(sd.HighRequired() && sd.HighTexture == "-")
{
// MascaraSnake: Slope handling
if(sd.Line.IsSlope && sd.Line.Args[1] > 0) continue; //mxd. Ceiling slopes doesn't require upper texture
if(sd.Line.IsRegularSlope && sd.Line.Args[1] > 0) continue; //mxd. Ceiling slopes doesn't require upper texture
if(sd.Other != null && sd.Other.Sector.CeilTexture != General.Map.Config.SkyFlatName)
{
SubmitResult(new ResultMissingTexture(sd, SidedefPart.Upper));
@ -79,7 +79,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(sd.LowRequired() && sd.LowTexture == "-")
{
// MascaraSnake: Slope handling
if (sd.Line.IsSlope && sd.Line.Args[0] > 0) continue; //mxd. Floor slopes doesn't require lower texture
if (sd.Line.IsRegularSlope && sd.Line.Args[0] > 0) continue; //mxd. Floor slopes doesn't require lower texture
if(sd.Other != null && sd.Other.Sector.FloorTexture != General.Map.Config.SkyFlatName)
{
SubmitResult(new ResultMissingTexture(sd, SidedefPart.Lower));

View file

@ -902,7 +902,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
// MascaraSnake: Slope handling
// ========== Plane Align (see http://zdoom.org/wiki/Plane_Align) ==========
if (l.IsSlope)
if (l.IsRegularSlope)
{
if (!General.Map.FormatInterface.HasLinedefParameters) l.SetSlopeArgs();
if (((l.Args[0] == 1) || (l.Args[1] == 1)) && (l.Front != null))
@ -919,7 +919,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// MascaraSnake: Slope handling
// ========== Plane Copy (mxd) (see http://zdoom.org/wiki/Plane_Copy) ==========
if (l.IsSlopeCopy)
if (l.IsCopySlope)
{
if (!General.Map.FormatInterface.HasLinedefParameters) l.SetSlopeCopyArgs();
//check the flags...
@ -3748,12 +3748,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(vg.GeometryType == VisualGeometryType.WALL_LOWER)
{
// MascaraSnake: Slope handling
if(vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.IsSlope && vg.Sidedef.Line.Args[0] == 0))
if(vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.IsRegularSlope && vg.Sidedef.Line.Args[0] == 0))
{
//check if the sector already has floor slopes
foreach(Sidedef side in vg.Sidedef.Sector.Sidedefs)
{
if(side == vg.Sidedef || !side.Line.IsSlope) continue;
if(side == vg.Sidedef || !side.Line.IsRegularSlope) continue;
int arg = (side == side.Line.Front ? 1 : 2);
@ -3778,12 +3778,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
else if(vg.GeometryType == VisualGeometryType.WALL_UPPER)
{
// MascaraSnake: Slope handling
if (vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.IsSlope && vg.Sidedef.Line.Args[1] == 0))
if (vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.IsRegularSlope && vg.Sidedef.Line.Args[1] == 0))
{
//check if the sector already has ceiling slopes
foreach(Sidedef side in vg.Sidedef.Sector.Sidedefs)
{
if (side == vg.Sidedef || !side.Line.IsSlope) continue;
if (side == vg.Sidedef || !side.Line.IsRegularSlope) continue;
int arg = (side == side.Line.Front ? 1 : 2);
@ -3811,7 +3811,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sidedef side in vg.Sector.Sector.Sidedefs)
{
// MascaraSnake: Slope handling
if (!side.Line.IsSlope) continue;
if (!side.Line.IsRegularSlope) continue;
int arg = (side == side.Line.Front ? 1 : 2);
@ -3835,7 +3835,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sidedef side in vg.Sector.Sector.Sidedefs)
{
// MascaraSnake: Slope handling
if (!side.Line.IsSlope) continue;
if (!side.Line.IsRegularSlope) continue;
int arg = (side == side.Line.Front ? 1 : 2);

View file

@ -577,7 +577,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sidedef side in Sector.Sector.Sidedefs)
{
// MascaraSnake: Slope handling
if(side.Line.IsSlope)
if(side.Line.IsRegularSlope)
{
if(side.Line.Args[1] == 1 && side.Line.Front != null && side.Line.Front == side)
{

View file

@ -543,7 +543,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sidedef side in Sector.Sector.Sidedefs)
{
// MascaraSnake: Slope handling
if(side.Line.IsSlope)
if(side.Line.IsRegularSlope)
{
if(side.Line.Args[0] == 1 && side.Line.Front != null && side.Line.Front == side)
{