diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 2dfaec4..11f03a8 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -818,6 +818,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } Dictionary> sectortags = new Dictionary>(); + List slopethings = new List(); sectordata = new Dictionary(General.Map.Map.Sectors.Count); thingdata = new Dictionary(General.Map.Map.Things.Count); @@ -847,6 +848,15 @@ namespace CodeImp.DoomBuilder.BuilderModes if (!General.Settings.GZDoomRenderingEffects) return; //mxd + if (General.Map.SRB2) + { + // Find all slope vertex things and store them + foreach (Thing t in General.Map.Map.Things) + { + if (t.IsSlopeVertex) slopethings.Add(t); + } + } + foreach (Sector s in General.Map.Map.Sectors) { // Find all sector whose tag is not 0 and hash them so that we can find them quickly @@ -1053,31 +1063,28 @@ namespace CodeImp.DoomBuilder.BuilderModes Sidedef side = (l.Args[0] == 0 || l.Args[0] == 1) ? l.Front : l.Back; Sector s = side.Sector; - //If NOKNUCKLES is set, use tag, X offset and Y offset to search for slope vertices. + //If Effect 6 is set, use tag, X offset and Y offset to search for slope vertices. if (l.IsFlagSet("8192")) { bool foundtag = false; bool foundxoffset = false; bool foundyoffset = false; - foreach (Thing t in General.Map.Map.Things) + foreach (Thing t in slopethings) { - if (t.IsSlopeVertex) + if (!foundtag && (int)t.AngleDoom == l.Tag) { - if (!foundtag && (int)t.AngleDoom == l.Tag) - { - slopevertices.Add(t); - foundtag = true; - } - if (!foundxoffset && (int)t.AngleDoom == side.OffsetX) - { - slopevertices.Add(t); - foundxoffset = true; - } - if (!foundyoffset && (int)t.AngleDoom == side.OffsetY) - { - slopevertices.Add(t); - foundyoffset = true; - } + slopevertices.Add(t); + foundtag = true; + } + if (!foundxoffset && (int)t.AngleDoom == side.OffsetX) + { + slopevertices.Add(t); + foundxoffset = true; + } + if (!foundyoffset && (int)t.AngleDoom == side.OffsetY) + { + slopevertices.Add(t); + foundyoffset = true; } } @@ -1085,9 +1092,9 @@ namespace CodeImp.DoomBuilder.BuilderModes //Otherwise, just use tag. else { - foreach (Thing t in General.Map.Map.Things) + foreach (Thing t in slopethings) { - if (t.IsSlopeVertex && (int)t.AngleDoom == l.Tag) slopevertices.Add(t); + if ((int)t.AngleDoom == l.Tag) slopevertices.Add(t); } } if (slopevertices.Count >= 3)