Make skywall rendering much more accurate to 2.2, and take horizon lines into account.

This commit is contained in:
sphere 2021-10-21 12:21:27 +02:00
parent 8ef05744f9
commit 0ac4ee5f0c
13 changed files with 61 additions and 21 deletions

View file

@ -95,7 +95,8 @@ namespace CodeImp.DoomBuilder.IO
public override int SlopeVertexType { get { return 9500; } }
public override int ColormapType { get { return -1; } }
public override int FlatAlignmentType { get { return -1; } }
public override int AxisType { get { return -1; } }
public override int HorizonLineType { get { return -1; } }
public override int AxisType { get { return -1; } }
public override int AxisTransferType { get { return -1; } }
public override int AxisTransferLineType { get { return -1; } }
public override int WaypointType { get { return -1; } }

View file

@ -95,7 +95,8 @@ namespace CodeImp.DoomBuilder.IO
public override int SlopeVertexType { get { return 9500; } }
public override int ColormapType { get { return -1; } }
public override int FlatAlignmentType { get { return -1; } }
public override int AxisType { get { return -1; } }
public override int HorizonLineType { get { return -1; } }
public override int AxisType { get { return -1; } }
public override int AxisTransferType { get { return -1; } }
public override int AxisTransferLineType { get { return -1; } }
public override int WaypointType { get { return -1; } }

View file

@ -74,7 +74,8 @@ namespace CodeImp.DoomBuilder.IO
int SlopeVertexType { get; }
int ColormapType { get; }
int FlatAlignmentType { get; }
int AxisType { get; }
int HorizonLineType { get; }
int AxisType { get; }
int AxisTransferType { get; }
int AxisTransferLineType { get; }
int WaypointType { get; }

View file

@ -97,7 +97,8 @@ namespace CodeImp.DoomBuilder.IO
public abstract int SlopeVertexType { get; }
public abstract int ColormapType { get; }
public abstract int FlatAlignmentType { get; }
public abstract int AxisType { get; }
public abstract int HorizonLineType { get; }
public abstract int AxisType { get; }
public abstract int AxisTransferType { get; }
public abstract int AxisTransferLineType { get; }
public abstract int WaypointType { get; }

View file

@ -64,6 +64,7 @@ namespace CodeImp.DoomBuilder.IO
public override int MinThingHeight { get { return 0; } }
public override int ColormapType { get { return 606; } }
public override int FlatAlignmentType { get { return 7; } }
public override int HorizonLineType { get { return 41; } }
public override int AxisType { get { return 1700; } }
public override int AxisTransferType { get { return 1701; } }
public override int AxisTransferLineType { get { return 1702; } }

View file

@ -146,7 +146,8 @@ namespace CodeImp.DoomBuilder.IO
public override int SlopeVertexType { get { return 9500; } }
public override int ColormapType { get { return -1; } }
public override int FlatAlignmentType { get { return -1; } }
public override int AxisType { get { return -1; } }
public override int HorizonLineType { get { return -1; } }
public override int AxisType { get { return -1; } }
public override int AxisTransferType { get { return -1; } }
public override int AxisTransferLineType { get { return -1; } }
public override int WaypointType { get { return -1; } }

View file

@ -99,7 +99,8 @@ namespace CodeImp.DoomBuilder.Map
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
public bool IsHorizonLine { get { return Action == General.Map.FormatInterface.HorizonLineType; } }
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
public List<int> Tags { get { return tags; } set { BeforePropsChange(); tags = value; } } //mxd
public float LengthSq { get { return lengthsq; } }
public float Length { get { return length; } }

View file

@ -439,7 +439,12 @@ namespace CodeImp.DoomBuilder.Map
// Texture is required when our start or end vertex is higher than on the other side.
if(thisstartz > otherstartz || thisendz > otherendz) return true;
}
if (General.Map.SRB2)
{
if (Other.sector.CeilTexture == General.Map.Config.SkyFlatName) return false;
}
// Texture is required when ceiling of other side is lower
return (Other.sector.CeilHeight < this.sector.CeilHeight);
}
@ -452,8 +457,11 @@ namespace CodeImp.DoomBuilder.Map
/// </summary>
public bool MiddleRequired()
{
// Texture is required when the line is singlesided
return (Other == null);
// Texture is required when the line is singlesided and not a horizon line
if (General.Map.SRB2)
return (Other == null && !(this.Line.IsHorizonLine));
else
return (Other == null);
}
/// <summary>
@ -502,6 +510,11 @@ namespace CodeImp.DoomBuilder.Map
if(thisstartz < otherstartz || thisendz < otherendz) return true;
}
if (General.Map.SRB2)
{
if (Other.sector.FloorTexture == General.Map.Config.SkyFlatName) return false;
}
// Texture is required when floor of other side is higher
return (Other.sector.FloorHeight > this.sector.FloorHeight);
}

View file

@ -206,8 +206,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
else if (parts.middlesingle != null) parts.middlesingle.UpdateSkyRenderFlag();
// On the other side as well...
if (side.Other != null && side.Other.Sector != null &&
side.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName)
if (side.Other != null && side.Other.Sector != null)
{
BaseVisualSector other = (BaseVisualSector)mode.GetVisualSector(side.Other.Sector);
if (other != null && other.Sides != null)

View file

@ -203,17 +203,29 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach (Sidedef side in level.sector.Sidedefs)
{
VisualSidedefParts parts = Sector.GetSidedefParts(side);
if (parts.middlesingle != null) parts.middlesingle.UpdateSkyRenderFlag();
}
if (parts.lower != null) parts.lower.UpdateSkyRenderFlag();
else if (parts.middlesingle != null) parts.middlesingle.UpdateSkyRenderFlag();
// On the other side as well...
if (side.Other != null && side.Other.Sector != null)
{
BaseVisualSector other = (BaseVisualSector)mode.GetVisualSector(side.Other.Sector);
if (other != null && other.Sides != null)
{
parts = other.GetSidedefParts(side.Other);
if (parts.lower != null) parts.lower.UpdateSkyRenderFlag();
}
}
}
}
}
}
#endregion
#endregion
#region ================== Methods
#region ================== Methods
// Return texture coordinates
protected override Point GetTextureOffset()
// Return texture coordinates
protected override Point GetTextureOffset()
{
return new Point { X = (int)Sector.Sector.Fields.GetValue("xpanningfloor", 0.0f),
Y = (int)Sector.Sector.Fields.GetValue("ypanningfloor", 0.0f) };

View file

@ -62,6 +62,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
Vector2D vl, vr;
UpdateSkyRenderFlag();
//mxd. lightfog flag support
int lightvalue;
bool lightabsolute;
@ -253,7 +255,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.SetVertices(null); //mxd
return false;
}
internal void UpdateSkyRenderFlag()
{
renderassky = (Sidedef.Other != null && Sidedef.Sector != null && Sidedef.Other.Sector != null &&
Sidedef.Other.Sector.FloorTexture == General.Map.Config.SkyFlatName &&
Sidedef.LongLowTexture == MapSet.EmptyLongName);
}
#endregion
#region ================== Methods

View file

@ -252,7 +252,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
internal void UpdateSkyRenderFlag()
{
renderassky = (Sidedef.LongMiddleTexture == MapSet.EmptyLongName && Sidedef.Sector != null && Sidedef.Sector.CeilTexture == General.Map.Config.SkyFlatName);
renderassky = (Sidedef.LongMiddleTexture == MapSet.EmptyLongName && Sidedef.Sector != null &&
Sidedef.Line.IsHorizonLine);
}
#endregion

View file

@ -255,7 +255,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
internal void UpdateSkyRenderFlag()
{
renderassky = (Sidedef.Other != null && Sidedef.Sector != null && Sidedef.Other.Sector != null &&
Sidedef.Sector.CeilTexture == General.Map.Config.SkyFlatName &&
Sidedef.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName);
}