diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 215bf7855e..ee6cd61b65 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -89,6 +89,8 @@ namespace OpenRA.Graphics } } + public float MinZoom { get { return minZoom; } } + public void AdjustZoom(float dz) { // Exponential ensures that equal positive and negative steps have the same effect diff --git a/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs b/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs index dc034c9065..13c700e12b 100644 --- a/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs +++ b/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs @@ -109,6 +109,14 @@ namespace OpenRA.Mods.Common.Traits.Render foreach (var r in RenderSelectionBars(self, wr, displayHealth, displayExtra)) yield return r; + if (selected && self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait().PathDebug) + yield return new TargetLineRenderable(ActivityTargetPath(self), Color.Green); + + // Hide decorations for spectators that zoom out further than the normal minimum level + // This avoids graphical glitches with pip rows and icons overlapping the selection box + if (wr.Viewport.Zoom < wr.Viewport.MinZoom) + yield break; + var renderDecorations = self.World.Selection.Contains(self) ? selectedDecorations : decorations; foreach (var kv in renderDecorations) { @@ -117,13 +125,6 @@ namespace OpenRA.Mods.Common.Traits.Render foreach (var rr in r.RenderDecoration(self, wr, pos)) yield return rr; } - - // Target lines and pips are always only displayed for selected allied actors - if (!selected || !self.Owner.IsAlliedWith(wr.World.RenderPlayer)) - yield break; - - if (self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait().PathDebug) - yield return new TargetLineRenderable(ActivityTargetPath(self), Color.Green); } IEnumerable ISelectionDecorations.RenderSelectionAnnotations(Actor self, WorldRenderer worldRenderer, Color color)