From 09b2402fea6e99576e245c95b59d167bd3044e53 Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 14 May 2023 13:51:38 +0200 Subject: [PATCH] Clean up SRB2 effect rendering code a bit --- Source/Core/Rendering/Renderer2D.cs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs index 1a538d2..6d68c00 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -1523,10 +1523,9 @@ namespace CodeImp.DoomBuilder.Rendering } - public void RenderSRB2Extras() - { - if (!(General.Settings.RenderNiGHTSPath || General.Settings.RenderZoomtubes || General.Settings.RenderPolyPreview)) return; - ICollection things = General.Map.Map.Things; + public void RenderSRB2Extras() + { + if (!(General.Settings.RenderNiGHTSPath || General.Settings.RenderZoomtubes || General.Settings.RenderPolyPreview)) return; axes = new List(); axistransferlines = new List(); @@ -1536,18 +1535,17 @@ namespace CodeImp.DoomBuilder.Rendering firstlines = new List(); // Collect relevant things - foreach (Thing t in things) + foreach (Thing t in General.Map.Map.Things) { - int type = t.Type; - if (General.Settings.RenderNiGHTSPath && type == General.Map.FormatInterface.AxisType) + if (General.Settings.RenderNiGHTSPath && t.Type == General.Map.FormatInterface.AxisType) axes.Add(t); - if (General.Settings.RenderNiGHTSPath && type == General.Map.FormatInterface.AxisTransferLineType) + else if (General.Settings.RenderNiGHTSPath && t.Type == General.Map.FormatInterface.AxisTransferLineType) axistransferlines.Add(t); - if (General.Settings.RenderZoomtubes && type == General.Map.FormatInterface.WaypointType) + else if (General.Settings.RenderZoomtubes && t.Type == General.Map.FormatInterface.WaypointType) waypoints.Add(t); - if (General.Settings.RenderPolyPreview && type == 760) + else if (General.Settings.RenderPolyPreview && t.Type == 760) polyanchors.Add(t); - if (General.Settings.RenderPolyPreview && (type == 761 || type == 762)) + else if (General.Settings.RenderPolyPreview && (t.Type == 761 || t.Type == 762)) polyspawns.Add(t); } @@ -1677,7 +1675,7 @@ namespace CodeImp.DoomBuilder.Rendering spawnlabel.Text = polyspawns[j].AngleDoom.ToString(); spawnlabel.Location = polyspawns[j].Position; spawnlabel.Color = PixelColor.FromColor(Color.Red); - RenderText(spawnlabel); + RenderText((ITextLabel)spawnlabel); j++; } @@ -1699,7 +1697,7 @@ namespace CodeImp.DoomBuilder.Rendering spawnlabel.Text = polyspawns[j].AngleDoom.ToString(); spawnlabel.Location = polyspawns[j].Position; - RenderText(spawnlabel); + RenderText((ITextLabel)spawnlabel); } else { @@ -1709,7 +1707,7 @@ namespace CodeImp.DoomBuilder.Rendering anchorlabel.Text = polyanchors[i].AngleDoom.ToString(); anchorlabel.Location = polyanchors[i].Position; - RenderText(anchorlabel); + RenderText((ITextLabel)anchorlabel); i++; }