Split Actor.Bounds into RenderBounds and SelectableBounds

Additionally, internally renamed VisualBounds to SelectionOverlayBounds to avoid confusion with RenderBounds.

This step was necessary to prevent actors with selectable area smaller than their graphics to be removed too early from ScreenMap even though part of the graphics should still be visible.
RA cruisers were a prime example, but to a lesser extent several other actors were affected as well.

This separation also serves as preparation to determine the final RenderBounds from multiple source bounds later, to fix the remaining ScreenMap issues (building 'bibs', aircraft shadows).
This commit is contained in:
reaperrr
2017-08-25 13:18:09 +02:00
committed by Pavel Penev
parent ca1448c7ba
commit be290cfabd
15 changed files with 52 additions and 33 deletions

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits.Render
{
[PaletteReference] public readonly string Palette = "chrome";
[Desc("Visual bounds for selection box. If null, it uses AutoSelectionSize.",
[Desc("Bounds for visual selection box. If null, it uses AutoSelectionSize.",
"The first two values define the bounds' size, the optional third and fourth",
"values specify the position relative to the actors' center. Defaults to selectable bounds.")]
public readonly int[] VisualBounds = null;
@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.Traits.Render
if (pipSources.Length == 0)
return Enumerable.Empty<IRenderable>();
var b = self.VisualBounds;
var b = self.SelectionOverlayBounds;
var pos = wr.ScreenPxPosition(self.CenterPosition);
var bl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Bottom));
var pal = wr.Palette(Info.Palette);
@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Traits.Render
var pipSize = pipImages.Image.Size.XY.ToInt2();
var pipxyBase = basePosition + new int2(1 - pipSize.X / 2, -(3 + pipSize.Y / 2));
var pipxyOffset = new int2(0, 0);
var width = self.VisualBounds.Width;
var width = self.SelectionOverlayBounds.Width;
foreach (var pips in pipSources)
{