From 78e6f5b114d7fccd549fb2ea55226e7ae528848a Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 3 May 2023 01:28:05 +0200 Subject: [PATCH] Finally fix repeating midtexture selection in Visual Mode --- .../BuilderModes/VisualModes/VisualMiddleDouble.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs index 27506c4..2240922 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs @@ -39,6 +39,8 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Variables private bool repeatmidtex; + private bool srb2repeatfixed; + private Plane topclipplane; private Plane bottomclipplane; @@ -154,7 +156,7 @@ namespace CodeImp.DoomBuilder.BuilderModes repeatmidtex = srb2repeat || doomrepeat; //A little redundant, but having a separate boolean value for each case makes the code a little more readable - bool srb2repeatfixed = srb2repeat && Sidedef.OffsetX >= 4096; + srb2repeatfixed = srb2repeat && Sidedef.OffsetX >= 4096; bool srb2repeatindefinite = srb2repeat && !srb2repeatfixed; float topheight = !General.Map.SRB2 || Sidedef.Line.IsFlagSet("128") ? geotop : geoplanetop; @@ -384,7 +386,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // This performs a fast test in object picking public override bool PickFastReject(Vector3D from, Vector3D to, Vector3D dir) { - if(!repeatmidtex) + if(!repeatmidtex || srb2repeatfixed) { // When the texture is not repeated, leave when outside crop planes if((pickintersect.z < bottomclipplane.GetZ(pickintersect)) || @@ -409,7 +411,7 @@ namespace CodeImp.DoomBuilder.BuilderModes int ox = (int)Math.Floor((u * Sidedef.Line.Length * UniFields.GetFloat(Sidedef.Fields, "scalex_mid", 1.0f) / Texture.Scale.x + Sidedef.OffsetX + UniFields.GetFloat(Sidedef.Fields, "offsetx_mid")) % Texture.Width); int oy; - if(repeatmidtex) + if(repeatmidtex && !srb2repeatfixed) { if(IsLowerUnpegged()) zoffset = Sidedef.Sector.FloorHeight;