From 650b5aae88099f533fa26ac096273da7c1f0cb4f Mon Sep 17 00:00:00 2001 From: sphere Date: Sun, 24 Oct 2021 22:33:25 +0200 Subject: [PATCH] Visual Mode: correct-enough slope skewing on FOF sides, with thanks to Monster Iestyn! --- Source/Core/Windows/AboutForm.Designer.cs | 2 +- .../VisualModes/VisualMiddle3D.cs | 49 +++++-------------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/Source/Core/Windows/AboutForm.Designer.cs b/Source/Core/Windows/AboutForm.Designer.cs index da4e577..e5aac4b 100644 --- a/Source/Core/Windows/AboutForm.Designer.cs +++ b/Source/Core/Windows/AboutForm.Designer.cs @@ -197,7 +197,7 @@ namespace CodeImp.DoomBuilder.Windows this.label2.Size = new System.Drawing.Size(262, 65); this.label2.TabIndex = 16; 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 // diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs index 8175bc0..ffd963f 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs @@ -167,44 +167,17 @@ namespace CodeImp.DoomBuilder.BuilderModes float topheight = skew ? extrafloor.Ceiling.plane.GetZ(vl) : sourcetopheight; 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; trt.x = trb.x = Sidedef.Line.Length; - tlt.y = trt.y = 0; - tlb.y = trb.y = (topheight - bottomheight) + floorbias; - - float topheight2 = skew ? topheight : sourcetopheight; - 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; - } + tlt.y = IsLowerUnpegged() ? 0 : -(topheight - bottomheight); + trt.y = IsLowerUnpegged() ? 0 : -(topheight2 - bottomheight2); + tlb.y = !IsLowerUnpegged() ? 0 : (topheight - bottomheight); + trb.y = !IsLowerUnpegged() ? 0 : (topheight2 - bottomheight2); // Apply texture offset tlt += tof; @@ -219,10 +192,10 @@ namespace CodeImp.DoomBuilder.BuilderModes trt /= tsz; // Geometry coordinates - vlt = new Vector3D(vl.x, vl.y, topheight + floorbias); - vlb = new Vector3D(vl.x, vl.y, bottomheight + floorbias); + vlt = new Vector3D(vl.x, vl.y, topheight); + vlb = new Vector3D(vl.x, vl.y, bottomheight); 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(); tp.tlt = IsLowerUnpegged() ? tlb : tlt;