Changed the way slopes are set up in the config

This commit is contained in:
MascaraSnake 2016-01-15 15:21:53 +01:00
parent 057a5b16c3
commit 89b6b878e8
4 changed files with 106 additions and 117 deletions

View file

@ -2228,32 +2228,32 @@ linedeftypes
{
title = "Slope Frontside Floor";
prefix = "(700)";
slope = true;
slopetype = 5;
slope = "regular";
slopeargs = 1;
}
701
{
title = "Slope Frontside Ceiling";
prefix = "(701)";
slope = true;
slopetype = 9;
slope = "regular";
slopeargs = 2;
}
702
{
title = "Slope Frontside Floor & Ceiling";
prefix = "(702)";
slope = true;
slopetype = 13;
slope = "regular";
slopeargs = 3;
}
703
{
title = "Slope Frontside Floor and Backside Ceiling";
prefix = "(703)";
slope = true;
slopetype = 37;
slope = "regular";
slopeargs = 9;
}
704
@ -2261,8 +2261,8 @@ linedeftypes
title = "Slope Frontside Floor by 3 Tagged Vertex Things";
prefix = "(704)";
flags8192text = "[13] Use tag and offsets";
slope = true;
slopetype = 7;
slope = "vertex";
slopeargs = 0;
}
705
@ -2270,40 +2270,40 @@ linedeftypes
title = "Slope Frontside Ceiling by 3 Tagged Vertex Things";
prefix = "(705)";
flags8192text = "[13] Use tag and offsets";
slope = true;
slopetype = 11;
slope = "vertex";
slopeargs = 1;
}
710
{
title = "Slope Backside Floor";
prefix = "(710)";
slope = true;
slopetype = 17;
slope = "regular";
slopeargs = 4;
}
711
{
title = "Slope Backside Ceiling";
prefix = "(711)";
slope = true;
slopetype = 33;
slope = "regular";
slopeargs = 8;
}
712
{
title = "Slope Backside Floor & Ceiling";
prefix = "(712)";
slope = true;
slopetype = 49;
slope = "regular";
slopeargs = 12;
}
713
{
title = "Slope Backside Floor & Frontside Ceiling";
prefix = "(713)";
slope = true;
slopetype = 25;
slope = "regular";
slopeargs = 6;
}
714
@ -2311,8 +2311,8 @@ linedeftypes
title = "Slope Backside Floor by 3 Tagged Vertex Things";
prefix = "(714)";
flags8192text = "[13] Use tag and offsets";
slope = true;
slopetype = 19;
slope = "vertex";
slopeargs = 2;
}
715
@ -2320,32 +2320,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;
slope = "vertex";
slopeargs = 3;
}
720
{
title = "Copy Frontside Floor Slope from Line Tag";
prefix = "(720)";
slope = "copy";
slopeargs = 1;
}
721
{
title = "Copy Frontside Ceiling Slope from Line Tag";
prefix = "(721)";
slope = true;
slopetype = 6;
slope = "copy";
slopeargs = 2;
}
722
{
title = "Copy Frontside Floor & Ceiling Slope from Line Tag";
prefix = "(722)";
slope = true;
slopetype = 14;
slope = "copy";
slopeargs = 3;
}
}

View file

@ -46,8 +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;
private readonly string slope;
private readonly int slopeargs;
private readonly bool threedfloor;
private readonly bool threedfloorcustom;
private readonly int threedfloorflags;
@ -68,11 +68,10 @@ 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; } }
public bool IsRegularSlope { get { return slope == "regular"; } }
public bool IsCopySlope { get { return slope == "copy"; } }
public bool IsVertexSlope { get { return slope == "vertex"; } }
public int SlopeArgs { get { return slopeargs; } }
public bool ThreeDFloor { get { return threedfloor; } }
public bool ThreeDFloorCustom { get { return threedfloorcustom; } }
public int ThreeDFloorFlags { get { return threedfloorflags; } }
@ -101,8 +100,8 @@ namespace CodeImp.DoomBuilder.Config
this.title = this.title.Trim();
this.flags = new Dictionary<string, string>(ac.Flags);
ReadLinedefSpecificFlags(cfg);
this.slope = cfg.ReadSetting(actionsetting + ".slope", false);
this.slopetype = cfg.ReadSetting(actionsetting + ".slopetype", 0);
this.slope = cfg.ReadSetting(actionsetting + ".slope", "");
this.slopeargs = cfg.ReadSetting(actionsetting + ".slopeargs", 0);
this.threedfloor = cfg.ReadSetting(actionsetting + ".3dfloor", false);
this.threedfloorcustom = cfg.ReadSetting(actionsetting + ".3dfloorcustom", false);
try { this.threedfloorflags = Convert.ToInt32(cfg.ReadSetting(actionsetting + ".3dfloorflags", "0"), 16); }
@ -136,8 +135,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.slope = "";
this.slopeargs = 0;
this.threedfloor = false;
this.threedfloorcustom = false;
this.threedfloorflags = 0;

View file

@ -839,12 +839,12 @@ namespace CodeImp.DoomBuilder.Map
//Set slope arguments for SRB2-style slopes. See http://zdoom.org/wiki/Plane_Align.
public void SetSlopeArgs()
{
//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;
//+1 = frontside floor, +2 = frontside ceiling, +4 = backside floor, +8 = backside ceiling
int slopeargs = General.Map.Config.GetLinedefActionInfo(Action).SlopeArgs;
bool frontfloor = (slopeargs & 0x1) == 0x1;
bool frontceiling = (slopeargs & 0x2) == 0x2;
bool backfloor = (slopeargs & 0x4) == 0x4;
bool backceiling = (slopeargs & 0x8) == 0x8;
Args[0] = frontfloor ? 1 : (backfloor ? 2 : 0); //floor
Args[1] = frontceiling ? 1 : (backceiling ? 2 : 0); //ceiling
Args[2] = 0; //lineid (irrelevant for SRB2)
@ -857,17 +857,12 @@ namespace CodeImp.DoomBuilder.Map
foreach (KeyValuePair<int, LinedefActionInfo> type in General.Map.Config.LinedefActions)
{
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;
//+1 = frontside floor, +2 = frontside ceiling, +4 = backside floor, +8 = backside ceiling
int slopeargs = type.Value.SlopeArgs;
bool frontfloor = (slopeargs & 0x1) == 0x1;
bool frontceiling = (slopeargs & 0x2) == 0x2;
bool backfloor = (slopeargs & 0x4) == 0x4;
bool backceiling = (slopeargs & 0x8) == 0x8;
int args0 = frontfloor ? 1 : (backfloor ? 2 : 0);
int args1 = frontceiling ? 1 : (backceiling ? 2 : 0);
@ -882,12 +877,12 @@ namespace CodeImp.DoomBuilder.Map
//Set slope arguments for SRB2-style copy slopes. See http://zdoom.org/wiki/Plane_Copy.
public void SetSlopeCopyArgs()
{
//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;
//+1 = frontside floor, +2 = frontside ceiling, +4 = backside floor, +8 = backside ceiling
int slopeargs = General.Map.Config.GetLinedefActionInfo(Action).SlopeArgs;
bool frontfloor = (slopeargs & 0x1) == 0x1;
bool frontceiling = (slopeargs & 0x2) == 0x2;
bool backfloor = (slopeargs & 0x4) == 0x4;
bool backceiling = (slopeargs & 0x8) == 0x8;
if (frontfloor) Args[0] = Tag; //front floor
if (frontceiling) Args[1] = Tag; //front ceiling
if (backfloor) Args[2] = Tag; //back floor
@ -896,18 +891,10 @@ namespace CodeImp.DoomBuilder.Map
}
//Set slope arguments for SRB2-style vertex slopes. These are fake arguments I invented to make their handling easier.
//Args[0]: 0 = slope front sector, 1 = slope back sector
//Args[1]: 0 = slope floor, 1 = slope ceiling
//Args[0]: 0 = frontside floor, 1 = frontside ceiling, 2 = backside floor, 3 = backside ceiling
public void SetVertexSlopeArgs()
{
//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;
Args[0] = General.Map.Config.GetLinedefActionInfo(Action).SlopeArgs;
}
//Set translucent line arguments for SRB2-style translucent walls. See http://zdoom.org/wiki/TranslucentLine.

View file

@ -1041,51 +1041,54 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (l.IsVertexSlope)
{
l.SetVertexSlopeArgs();
bool slopefloor = l.Args[1] == 0;
List<Thing> slopevertices = new List<Thing>(3);
Sector s = (l.Args[0] == 0) ? l.Front.Sector : l.Back.Sector;
//If NOKNUCKLES is set, use tag, X offset and Y offset to search for slope vertices.
if (l.IsFlagSet("8192"))
if (l.Args[0] >= 0 && l.Args[0] <= 3)
{
bool foundtag = false;
bool foundxoffset = false;
bool foundyoffset = false;
foreach (Thing t in General.Map.Map.Things)
bool slopefloor = l.Args[0] == 0 || l.Args[0] == 2;
List<Thing> slopevertices = new List<Thing>(3);
Sector s = (l.Args[0] == 0 || l.Args[0] == 1) ? l.Front.Sector : l.Back.Sector;
//If NOKNUCKLES is set, use tag, X offset and Y offset to search for slope vertices.
if (l.IsFlagSet("8192"))
{
if (t.IsSlopeVertex)
bool foundtag = false;
bool foundxoffset = false;
bool foundyoffset = false;
foreach (Thing t in General.Map.Map.Things)
{
if (!foundtag && (int)t.AngleDoom == l.Tag)
if (t.IsSlopeVertex)
{
slopevertices.Add(t);
foundtag = true;
}
if (!foundxoffset && (int)t.AngleDoom == l.Front.OffsetX)
{
slopevertices.Add(t);
foundxoffset = true;
}
if (!foundyoffset && (int)t.AngleDoom == l.Front.OffsetY)
{
slopevertices.Add(t);
foundyoffset = true;
if (!foundtag && (int)t.AngleDoom == l.Tag)
{
slopevertices.Add(t);
foundtag = true;
}
if (!foundxoffset && (int)t.AngleDoom == l.Front.OffsetX)
{
slopevertices.Add(t);
foundxoffset = true;
}
if (!foundyoffset && (int)t.AngleDoom == l.Front.OffsetY)
{
slopevertices.Add(t);
foundyoffset = true;
}
}
}
}
}
//Otherwise, just use tag.
else
{
foreach (Thing t in General.Map.Map.Things)
{
if (t.IsSlopeVertex && (int)t.AngleDoom == l.Tag) slopevertices.Add(t);
}
}
if (slopevertices.Count >= 3)
{
SectorData sd = GetSectorData(s);
sd.AddEffectSRB2ThingVertexSlope(slopevertices, slopefloor, blockmap, bsp);
//Otherwise, just use tag.
else
{
foreach (Thing t in General.Map.Map.Things)
{
if (t.IsSlopeVertex && (int)t.AngleDoom == l.Tag) slopevertices.Add(t);
}
}
if (slopevertices.Count >= 3)
{
SectorData sd = GetSectorData(s);
sd.AddEffectSRB2ThingVertexSlope(slopevertices, slopefloor, blockmap, bsp);
}
}
}
}