Render translucent walls in Visual Mode

This commit is contained in:
MascaraSnake 2016-01-04 20:26:34 +01:00
parent 13316bab39
commit a3f2f131a1
8 changed files with 39 additions and 4 deletions

View file

@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes;
protected Dictionary<int, int[]> vertexSlopeTypes;
protected Dictionary<int, float> translucentLineTypes;
#endregion
#region ================== Constructor / Disposer
@ -50,13 +51,14 @@ namespace CodeImp.DoomBuilder.IO
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 } };
}
#endregion
#endregion
#region ================== Properties
#region ================== Properties
public override int MaxSidedefs { get { return ushort.MaxValue; } }
public override int MaxSidedefs { get { return ushort.MaxValue; } }
public override int MaxVertices { get { return ushort.MaxValue; } }
public override int MaxLinedefs { get { return ushort.MaxValue; } }
public override int MaxSectors { get { return ushort.MaxValue; } }
@ -102,6 +104,7 @@ namespace CodeImp.DoomBuilder.IO
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
public override Dictionary<int, int[]> VertexSlopeTypes { get { return vertexSlopeTypes; } }
public override Dictionary<int, float> TranslucentLineTypes { get { return translucentLineTypes; } }
public override int SlopeVertexType { get { return 9500; } }
public override int Custom3DFloorType { get { return 160; } }
public override int ColormapType { get { return -1; } }

View file

@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes;
protected Dictionary<int, int[]> vertexSlopeTypes;
protected Dictionary<int, float> translucentLineTypes;
#endregion
#region ================== Constructor / Disposer
@ -50,6 +51,7 @@ namespace CodeImp.DoomBuilder.IO
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 } };
}
#endregion
@ -102,6 +104,7 @@ namespace CodeImp.DoomBuilder.IO
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
public override Dictionary<int, int[]> VertexSlopeTypes { get { return vertexSlopeTypes; } }
public override Dictionary<int, float> TranslucentLineTypes { get { return translucentLineTypes; } }
public override int SlopeVertexType { get { return 9500; } }
public override int Custom3DFloorType { get { return 160; } }
public override int ColormapType { get { return -1; } }

View file

@ -74,6 +74,7 @@ namespace CodeImp.DoomBuilder.IO
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; }
int ColormapType { get; }

View file

@ -95,6 +95,7 @@ namespace CodeImp.DoomBuilder.IO
public abstract Dictionary<int, int[]> SlopeTypes { get; }
public abstract Dictionary<int, int[]> SlopeCopyTypes { get; }
public abstract Dictionary<int, int[]> VertexSlopeTypes { get; }
public abstract Dictionary<int, float> TranslucentLineTypes { get; }
public abstract int SlopeVertexType { get; }
public abstract int Custom3DFloorType { get; }
public abstract int ColormapType { get; }

View file

@ -130,6 +130,19 @@ namespace CodeImp.DoomBuilder.IO
{ 714, new int[2] { 1, 0 } },
{ 715, new int[2] { 1, 1 } },
};
translucentLineTypes = new Dictionary<int, float>() {
{ 900, 0.9f },
{ 901, 0.8f },
{ 902, 0.7f },
{ 903, 0.6f },
{ 904, 0.5f },
{ 905, 0.4f },
{ 906, 0.3f },
{ 907, 0.2f },
{ 908, 0.1f },
};
}
#endregion

View file

@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes;
protected Dictionary<int, int[]> vertexSlopeTypes;
protected Dictionary<int, float> translucentLineTypes;
#endregion
#region ================== Constructor / Disposer
@ -55,6 +56,7 @@ namespace CodeImp.DoomBuilder.IO
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 } };
// Make configuration
Configuration config = new Configuration();
@ -152,6 +154,7 @@ namespace CodeImp.DoomBuilder.IO
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
public override Dictionary<int, int[]> VertexSlopeTypes { get { return vertexSlopeTypes; } }
public override Dictionary<int, float> TranslucentLineTypes { get { return translucentLineTypes; } }
public override int SlopeVertexType { get { return 9500; } }
public override int Custom3DFloorType { get { return 160; } }
public override int ColormapType { get { return -1; } }

View file

@ -95,6 +95,7 @@ namespace CodeImp.DoomBuilder.Map
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 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; } }
public int Tag { get { return tags[0]; } set { BeforePropsChange(); tags[0] = value; if((value < General.Map.FormatInterface.MinTag) || (value > General.Map.FormatInterface.MaxTag)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } } //mxd
@ -895,6 +896,15 @@ namespace CodeImp.DoomBuilder.Map
Args[1] = settings[1];
}
//Set translucent line arguments for SRB2-style translucent walls. See http://zdoom.org/wiki/TranslucentLine.
public void SetTranslucentLineArgs()
{
Args[0] = 0; //lineid (irrelevant for SRB2)
Args[1] = (int)(General.Map.FormatInterface.TranslucentLineTypes[Action]*255); //amount
Args[2] = 0; //additive
Args[3] = 0; //moreflags (irrelevant for SRB2)
}
// This checks and returns a flag without creating it
public bool IsFlagSet(string flagname)
{

View file

@ -104,8 +104,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
bool canhavealpha = (this is VisualMiddleDouble || this is VisualMiddle3D || this is VisualMiddleBack); //mxd
// From TranslucentLine action
if(Sidedef.Line.Action == 208)
if(Sidedef.Line.IsTranslucentLine)
{
if (!General.Map.FormatInterface.HasLinedefParameters) Sidedef.Line.SetTranslucentLineArgs();
alpha = (byte)General.Clamp(Sidedef.Line.Args[1], 0, 255);
if(canhavealpha && Sidedef.Line.Args[2] == 1)