From ab830ea15984d7aa5fa7deccc06aaf024d0ce203 Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 4 Sep 2023 18:36:03 +0200 Subject: [PATCH] Disable Visual Mode features that don't apply to SRB2 --- .../VisualModes/BaseVisualMode.cs | 229 +++++++++--------- 1 file changed, 121 insertions(+), 108 deletions(-) diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 080df7a5..45e7891c 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -1108,23 +1108,32 @@ namespace CodeImp.DoomBuilder.BuilderModes case "srb2_fofwater": case "srb2_fofsolidopaque": case "srb2_fofcrumbling": - case "srb2_foflight": - case "srb2_foffog": case "srb2_fofintangible": - case "srb2_fofintangibleinvisible": case "srb2_fofbustable": case "srb2_foflaser": case "srb2_fofcustom": - if (l.Front != null) + if (l.Front != null && sectortags.ContainsKey(l.Args[0])) { - if (sectortags.ContainsKey(l.Args[0])) + List sectors = sectortags[l.Args[0]]; + foreach (Sector s in sectors) { - List sectors = sectortags[l.Args[0]]; - foreach (Sector s in sectors) - { - SectorData sd = GetSectorData(s); - sd.AddEffect3DFloor(l); - } + SectorData sd = GetSectorData(s); + sd.AddEffect3DFloor(l); + } + } + break; + + case "srb2_foflight": + case "srb2_foffog": + case "srb2_fofintangibleinvisible": + if (l.Front != null && sectortags.ContainsKey(l.Args[0])) + { + List sectors = sectortags[l.Args[0]]; + foreach (Sector s in sectors) + { + SectorData sd = GetSectorData(s); + //sd.AddEffectBrightnessLevel(l); + sd.AddEffect3DFloor(l); } } break; @@ -1220,121 +1229,125 @@ namespace CodeImp.DoomBuilder.BuilderModes } } - // Find interesting things (such as sector slopes) - // Pass one of slope things, and determine which one are for pass two - //TODO: rewrite using classnames instead of numbers - foreach (Thing t in General.Map.Map.Things) + // Disable loops that are not relevant to SRB2 + if (false) { - switch (t.Type) + // Find interesting things (such as sector slopes) + // Pass one of slope things, and determine which one are for pass two + //TODO: rewrite using classnames instead of numbers + foreach (Thing t in General.Map.Map.Things) { - // ========== Copy slope ========== - case 9511: - case 9510: - slopethingpass[1].Add(t); - break; + switch (t.Type) + { + // ========== Copy slope ========== + case 9511: + case 9510: + slopethingpass[1].Add(t); + break; - // ========== Thing line slope ========== - case 9501: - case 9500: - if(linetags.ContainsKey(t.Args[0])) - { - // Only slope each sector once, even when multiple lines of the same sector are tagged. See https://github.com/jewalky/UltimateDoomBuilder/issues/491 - List slopedsectors = new List(); - - foreach(Linedef ld in linetags[t.Args[0]]) + // ========== Thing line slope ========== + case 9501: + case 9500: + if (linetags.ContainsKey(t.Args[0])) { - if (ld.Line.GetSideOfLine(t.Position) < 0.0f) + // Only slope each sector once, even when multiple lines of the same sector are tagged. See https://github.com/jewalky/UltimateDoomBuilder/issues/491 + List slopedsectors = new List(); + + foreach (Linedef ld in linetags[t.Args[0]]) { - if (ld.Front != null && !slopedsectors.Contains(ld.Front.Sector)) + if (ld.Line.GetSideOfLine(t.Position) < 0.0f) { - GetSectorData(ld.Front.Sector).AddEffectThingLineSlope(t, ld.Front); - slopedsectors.Add(ld.Front.Sector); + if (ld.Front != null && !slopedsectors.Contains(ld.Front.Sector)) + { + GetSectorData(ld.Front.Sector).AddEffectThingLineSlope(t, ld.Front); + slopedsectors.Add(ld.Front.Sector); + } + } + else if (ld.Back != null && !slopedsectors.Contains(ld.Back.Sector)) + { + GetSectorData(ld.Back.Sector).AddEffectThingLineSlope(t, ld.Back); + slopedsectors.Add(ld.Back.Sector); } } - else if (ld.Back != null && !slopedsectors.Contains(ld.Back.Sector)) + } + break; + + // ========== Thing slope ========== + case 9503: + case 9502: + t.DetermineSector(blockmap); + if (t.Sector != null) + { + SectorData sd = GetSectorData(t.Sector); + sd.AddEffectThingSlope(t); + } + break; + } + } + + // Pass two of slope things + //TODO: rewrite using classnames instead of numbers + foreach (Thing t in slopethingpass[1]) + { + switch (t.Type) + { + // ========== Copy slope ========== + case 9511: + case 9510: + t.DetermineSector(blockmap); + if (t.Sector != null) + { + SectorData sd = GetSectorData(t.Sector); + sd.AddEffectCopySlope(t); + } + break; + } + } + + // Find sectors with 3 vertices, because they can be sloped + foreach (Sector s in General.Map.Map.Sectors) + { + // ========== Thing vertex slope, vertices with UDMF vertex offsets ========== + if (s.Sidedefs.Count == 3) + { + if (General.Map.UDMF) GetSectorData(s).AddEffectVertexOffset(); //mxd + List slopeceilingthings = new List(3); + List slopefloorthings = new List(3); + + foreach (Sidedef sd in s.Sidedefs) + { + Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start; + + // Check if a thing is at this vertex + foreach (VisualBlockEntry block in blockmap.GetBlocks(v.Position)) + { + foreach (Thing t in block.Things) { - GetSectorData(ld.Back.Sector).AddEffectThingLineSlope(t, ld.Back); - slopedsectors.Add(ld.Back.Sector); + if ((Vector2D)t.Position == v.Position) + { + switch (t.Type) + { + case 1504: slopefloorthings.Add(t); break; + case 1505: slopeceilingthings.Add(t); break; + } + } } } } - break; - // ========== Thing slope ========== - case 9503: - case 9502: - t.DetermineSector(blockmap); - if (t.Sector != null) + // Slope any floor vertices? + if (slopefloorthings.Count > 0) { - SectorData sd = GetSectorData(t.Sector); - sd.AddEffectThingSlope(t); + SectorData sd = GetSectorData(s); + sd.AddEffectThingVertexSlope(slopefloorthings, true); } - break; - } - } - // Pass two of slope things - //TODO: rewrite using classnames instead of numbers - foreach (Thing t in slopethingpass[1]) - { - switch (t.Type) - { - // ========== Copy slope ========== - case 9511: - case 9510: - t.DetermineSector(blockmap); - if (t.Sector != null) + // Slope any ceiling vertices? + if (slopeceilingthings.Count > 0) { - SectorData sd = GetSectorData(t.Sector); - sd.AddEffectCopySlope(t); + SectorData sd = GetSectorData(s); + sd.AddEffectThingVertexSlope(slopeceilingthings, false); } - break; - } - } - - // Find sectors with 3 vertices, because they can be sloped - foreach (Sector s in General.Map.Map.Sectors) - { - // ========== Thing vertex slope, vertices with UDMF vertex offsets ========== - if (s.Sidedefs.Count == 3) - { - if (General.Map.UDMF) GetSectorData(s).AddEffectVertexOffset(); //mxd - List slopeceilingthings = new List(3); - List slopefloorthings = new List(3); - - foreach (Sidedef sd in s.Sidedefs) - { - Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start; - - // Check if a thing is at this vertex - foreach (VisualBlockEntry block in blockmap.GetBlocks(v.Position)) - { - foreach (Thing t in block.Things) - { - if ((Vector2D)t.Position == v.Position) - { - switch (t.Type) - { - case 1504: slopefloorthings.Add(t); break; - case 1505: slopeceilingthings.Add(t); break; - } - } - } - } - } - - // Slope any floor vertices? - if (slopefloorthings.Count > 0) - { - SectorData sd = GetSectorData(s); - sd.AddEffectThingVertexSlope(slopefloorthings, true); - } - - // Slope any ceiling vertices? - if (slopeceilingthings.Count > 0) - { - SectorData sd = GetSectorData(s); - sd.AddEffectThingVertexSlope(slopeceilingthings, false); } } }