Remove palettes from base IRenderable.
This commit is contained in:
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.SelectMany(p => p.Render(wr, centerPosition));
|
||||
|
||||
if (palette != null)
|
||||
previewRenderables = previewRenderables.Select(a => a.IsDecoration ? a : a.WithPalette(palette));
|
||||
previewRenderables = previewRenderables.Select(a => !a.IsDecoration && a is IPalettedRenderable ? ((IPalettedRenderable)a).WithPalette(palette) : a);
|
||||
|
||||
if (info.FootprintUnderPreview != PlaceBuildingCellType.None)
|
||||
foreach (var r in RenderFootprint(wr, topLeft, footprint, info.FootprintUnderPreview))
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (palette == null)
|
||||
return r;
|
||||
else
|
||||
return r.Select(a => a.IsDecoration ? a : a.WithPalette(palette));
|
||||
return r.Select(a => !a.IsDecoration && a is IPalettedRenderable ? ((IPalettedRenderable)a).WithPalette(palette) : a);
|
||||
}
|
||||
else
|
||||
return SpriteRenderable.None;
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
yield return a;
|
||||
|
||||
if (!a.IsDecoration)
|
||||
yield return a.WithPalette(wr.Palette(Info.Palette))
|
||||
if (!a.IsDecoration && a is IPalettedRenderable)
|
||||
yield return ((IPalettedRenderable)a).WithPalette(wr.Palette(Info.Palette))
|
||||
.WithZOffset(a.ZOffset + 1)
|
||||
.AsDecoration();
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
// Contrails shouldn't cast shadows
|
||||
var height = self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length;
|
||||
var shadowSprites = r.Where(s => !s.IsDecoration)
|
||||
.Select(a => a.WithPalette(wr.Palette(info.Palette))
|
||||
var shadowSprites = r.Where(s => !s.IsDecoration && s is IPalettedRenderable)
|
||||
.Select(a => ((IPalettedRenderable)a).WithPalette(wr.Palette(info.Palette))
|
||||
.OffsetBy(info.Offset - new WVec(0, 0, height))
|
||||
.WithZOffset(a.ZOffset + (height + info.ZOffset))
|
||||
.AsDecoration());
|
||||
|
||||
@@ -118,8 +118,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Selected)
|
||||
{
|
||||
var highlight = worldRenderer.Palette("highlight");
|
||||
var overlay = items.Where(r => !r.IsDecoration)
|
||||
.Select(r => r.WithPalette(highlight));
|
||||
var overlay = items.Where(r => !r.IsDecoration && r is IPalettedRenderable)
|
||||
.Select(r => ((IPalettedRenderable)r).WithPalette(highlight));
|
||||
return items.Concat(overlay);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user