Visual Mode: correct-enough slope skewing on FOF sides, with thanks to Monster Iestyn!

This commit is contained in:
sphere 2021-10-24 22:33:25 +02:00
parent 03c008a174
commit 650b5aae88
2 changed files with 12 additions and 39 deletions

View File

@ -197,7 +197,7 @@ namespace CodeImp.DoomBuilder.Windows
this.label2.Size = new System.Drawing.Size(262, 65); this.label2.Size = new System.Drawing.Size(262, 65);
this.label2.TabIndex = 16; this.label2.TabIndex = 16;
this.label2.Text = "developed by: \r\nMascaraSnake, toaster, sphere\r\n\r\n" + this.label2.Text = "developed by: \r\nMascaraSnake, toaster, sphere\r\n\r\n" +
"With contributions from:\r\nJustburner, boris, ZZYZX"; "With contributions from:\r\nJustburner, Monster Iestyn, boris, ZZYZX";
// //
// version // version
// //

View File

@ -167,44 +167,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
float topheight = skew ? extrafloor.Ceiling.plane.GetZ(vl) : sourcetopheight; float topheight = skew ? extrafloor.Ceiling.plane.GetZ(vl) : sourcetopheight;
float bottomheight = skew ? extrafloor.Floor.plane.GetZ(vl) : sourcebottomheight; float bottomheight = skew ? extrafloor.Floor.plane.GetZ(vl) : sourcebottomheight;
float floorbias = (topheight == bottomheight) ? 1.0f : 0.0f; float topheight2 = skew ? extrafloor.Ceiling.plane.GetZ(vr) : sourcetopheight;
float bottomheight2 = skew ? extrafloor.Floor.plane.GetZ(vr) : sourcebottomheight;
//float floorbias = (topheight == bottomheight) ? 1.0f : 0.0f;
//float floorbias2 = (topheight2 == bottomheight2) ? 1.0f : 0.0f;
tlt.x = tlb.x = 0; tlt.x = tlb.x = 0;
trt.x = trb.x = Sidedef.Line.Length; trt.x = trb.x = Sidedef.Line.Length;
tlt.y = trt.y = 0; tlt.y = IsLowerUnpegged() ? 0 : -(topheight - bottomheight);
tlb.y = trb.y = (topheight - bottomheight) + floorbias; trt.y = IsLowerUnpegged() ? 0 : -(topheight2 - bottomheight2);
tlb.y = !IsLowerUnpegged() ? 0 : (topheight - bottomheight);
float topheight2 = skew ? topheight : sourcetopheight; trb.y = !IsLowerUnpegged() ? 0 : (topheight2 - bottomheight2);
float bottomheight2 = skew ? bottomheight : sourcebottomheight;
// Correct to account for slopes
if (General.Map.SRB2)
{
float slant;
float texturevpeg;
if (!skew)
{
slant = 0;
texturevpeg = 0;
}
else if (!IsLowerUnpegged())
{
slant = extrafloor.Floor.plane.GetZ(vr) - extrafloor.Floor.plane.GetZ(vl);
texturevpeg = (sourcetopheight - sourcebottomheight) % Math.Abs(tsz.y);
}
else
{
slant = extrafloor.Ceiling.plane.GetZ(vr) - extrafloor.Ceiling.plane.GetZ(vl);
texturevpeg = 0;
}
topheight2 = topheight + slant;
bottomheight2 = bottomheight + slant;
tlt.y = trt.y = texturevpeg;
tlb.y = trb.y = texturevpeg + (topheight - bottomheight) + floorbias;
}
// Apply texture offset // Apply texture offset
tlt += tof; tlt += tof;
@ -219,10 +192,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
trt /= tsz; trt /= tsz;
// Geometry coordinates // Geometry coordinates
vlt = new Vector3D(vl.x, vl.y, topheight + floorbias); vlt = new Vector3D(vl.x, vl.y, topheight);
vlb = new Vector3D(vl.x, vl.y, bottomheight + floorbias); vlb = new Vector3D(vl.x, vl.y, bottomheight);
vrb = new Vector3D(vr.x, vr.y, bottomheight2); vrb = new Vector3D(vr.x, vr.y, bottomheight2);
vrt = new Vector3D(vr.x, vr.y, topheight2 + floorbias); vrt = new Vector3D(vr.x, vr.y, topheight2);
TexturePlane tp = new TexturePlane(); TexturePlane tp = new TexturePlane();
tp.tlt = IsLowerUnpegged() ? tlb : tlt; tp.tlt = IsLowerUnpegged() ? tlb : tlt;