Clean up SRB2 effect rendering code a bit

This commit is contained in:
spherallic 2023-05-14 13:51:38 +02:00
parent 6576ed7408
commit 09b2402fea

View file

@ -1523,10 +1523,9 @@ namespace CodeImp.DoomBuilder.Rendering
} }
public void RenderSRB2Extras() public void RenderSRB2Extras()
{ {
if (!(General.Settings.RenderNiGHTSPath || General.Settings.RenderZoomtubes || General.Settings.RenderPolyPreview)) return; if (!(General.Settings.RenderNiGHTSPath || General.Settings.RenderZoomtubes || General.Settings.RenderPolyPreview)) return;
ICollection<Thing> things = General.Map.Map.Things;
axes = new List<Thing>(); axes = new List<Thing>();
axistransferlines = new List<Thing>(); axistransferlines = new List<Thing>();
@ -1536,18 +1535,17 @@ namespace CodeImp.DoomBuilder.Rendering
firstlines = new List<Linedef>(); firstlines = new List<Linedef>();
// Collect relevant things // Collect relevant things
foreach (Thing t in things) foreach (Thing t in General.Map.Map.Things)
{ {
int type = t.Type; if (General.Settings.RenderNiGHTSPath && t.Type == General.Map.FormatInterface.AxisType)
if (General.Settings.RenderNiGHTSPath && type == General.Map.FormatInterface.AxisType)
axes.Add(t); 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); 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); waypoints.Add(t);
if (General.Settings.RenderPolyPreview && type == 760) else if (General.Settings.RenderPolyPreview && t.Type == 760)
polyanchors.Add(t); 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); polyspawns.Add(t);
} }
@ -1677,7 +1675,7 @@ namespace CodeImp.DoomBuilder.Rendering
spawnlabel.Text = polyspawns[j].AngleDoom.ToString(); spawnlabel.Text = polyspawns[j].AngleDoom.ToString();
spawnlabel.Location = polyspawns[j].Position; spawnlabel.Location = polyspawns[j].Position;
spawnlabel.Color = PixelColor.FromColor(Color.Red); spawnlabel.Color = PixelColor.FromColor(Color.Red);
RenderText(spawnlabel); RenderText((ITextLabel)spawnlabel);
j++; j++;
} }
@ -1699,7 +1697,7 @@ namespace CodeImp.DoomBuilder.Rendering
spawnlabel.Text = polyspawns[j].AngleDoom.ToString(); spawnlabel.Text = polyspawns[j].AngleDoom.ToString();
spawnlabel.Location = polyspawns[j].Position; spawnlabel.Location = polyspawns[j].Position;
RenderText(spawnlabel); RenderText((ITextLabel)spawnlabel);
} }
else else
{ {
@ -1709,7 +1707,7 @@ namespace CodeImp.DoomBuilder.Rendering
anchorlabel.Text = polyanchors[i].AngleDoom.ToString(); anchorlabel.Text = polyanchors[i].AngleDoom.ToString();
anchorlabel.Location = polyanchors[i].Position; anchorlabel.Location = polyanchors[i].Position;
RenderText(anchorlabel); RenderText((ITextLabel)anchorlabel);
i++; i++;
} }