diff --git a/OpenRA.Game/Graphics/TargetLineRenderable.cs b/OpenRA.Game/Graphics/TargetLineRenderable.cs index a177d9cfae..7d6c3647cf 100644 --- a/OpenRA.Game/Graphics/TargetLineRenderable.cs +++ b/OpenRA.Game/Graphics/TargetLineRenderable.cs @@ -48,13 +48,29 @@ namespace OpenRA.Graphics foreach (var b in waypoints.Skip(1).Select(pos => wr.ScreenPxPosition(pos))) { Game.Renderer.WorldLineRenderer.DrawLine(a, b, color); - wr.DrawTargetMarker(color, b); + DrawTargetMarker(wr, color, b); a = b; } - wr.DrawTargetMarker(color, first); + DrawTargetMarker(wr, color, first); } + public static void DrawTargetMarker(WorldRenderer wr, Color c, float2 location) + { + var miz = -1 / wr.Viewport.Zoom; + var tl = new float2(miz, miz); + var br = -tl; + var bl = new float2(tl.X, br.Y); + var tr = new float2(br.X, tl.Y); + + var wlr = Game.Renderer.WorldLineRenderer; + wlr.DrawLine(location + tl, location + tr, c); + wlr.DrawLine(location + tr, location + br, c); + wlr.DrawLine(location + br, location + bl, c); + wlr.DrawLine(location + bl, location + tl, c); + } + + public void RenderDebugGeometry(WorldRenderer wr) { } public Rectangle ScreenBounds(WorldRenderer wr) { return Rectangle.Empty; } } diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 8ca852a7db..1c2bdf7b9a 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -210,20 +210,6 @@ namespace OpenRA.Graphics new SelectionBarsRenderable(unit, true, true).Render(this); } - public void DrawTargetMarker(Color c, float2 location) - { - var tl = new float2(-1 / Viewport.Zoom, -1 / Viewport.Zoom); - var br = new float2(1 / Viewport.Zoom, 1 / Viewport.Zoom); - var bl = new float2(tl.X, br.Y); - var tr = new float2(br.X, tl.Y); - - var wlr = Game.Renderer.WorldLineRenderer; - wlr.DrawLine(location + tl, location + tr, c); - wlr.DrawLine(location + tr, location + br, c); - wlr.DrawLine(location + br, location + bl, c); - wlr.DrawLine(location + bl, location + tl, c); - } - public void RefreshPalette() { palette.ApplyModifiers(World.WorldActor.TraitsImplementing()); diff --git a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs index 784188b35a..5b5b87319b 100644 --- a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs @@ -61,8 +61,8 @@ namespace OpenRA.Mods.Common.Traits var ha = wr.ScreenPosition(self.CenterPosition); var hb = wr.ScreenPosition(self.CenterPosition + height); wlr.DrawLine(ha, hb, hc); - wr.DrawTargetMarker(hc, ha); - wr.DrawTargetMarker(hc, hb); + TargetLineRenderable.DrawTargetMarker(wr, hc, ha); + TargetLineRenderable.DrawTargetMarker(wr, hc, hb); } // No armaments to draw @@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits var sm = wr.ScreenPosition(muzzle); var sd = wr.ScreenPosition(muzzle + dirOffset); wlr.DrawLine(sm, sd, c); - wr.DrawTargetMarker(c, sm); + TargetLineRenderable.DrawTargetMarker(wr, c, sm); } } }