Hide selection decorations when spectators zoom too far out.

This commit is contained in:
Paul Chote
2020-05-02 15:08:28 +01:00
committed by atlimit8
parent 0ae58ff0ea
commit f03841c4e4
2 changed files with 10 additions and 7 deletions

View File

@@ -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

View File

@@ -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<DeveloperMode>().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<DeveloperMode>().PathDebug)
yield return new TargetLineRenderable(ActivityTargetPath(self), Color.Green);
}
IEnumerable<IRenderable> ISelectionDecorations.RenderSelectionAnnotations(Actor self, WorldRenderer worldRenderer, Color color)