Use PaletteReferences in ShroudRenderer.
This commit is contained in:
@@ -105,8 +105,17 @@ namespace OpenRA.Graphics
|
||||
return shadowBits[SpecialShroudTiles[u ^ uSides][v]];
|
||||
}
|
||||
|
||||
internal void Draw( WorldRenderer wr )
|
||||
bool initializePalettes = true;
|
||||
PaletteReference fogPalette, shroudPalette;
|
||||
internal void Draw(WorldRenderer wr)
|
||||
{
|
||||
if (initializePalettes)
|
||||
{
|
||||
fogPalette = wr.Palette("fog");
|
||||
shroudPalette = wr.Palette("shroud");
|
||||
initializePalettes = false;
|
||||
}
|
||||
|
||||
if (shroud != null && shroud.dirty)
|
||||
{
|
||||
shroud.dirty = false;
|
||||
@@ -120,14 +129,12 @@ namespace OpenRA.Graphics
|
||||
}
|
||||
|
||||
var clipRect = Game.viewport.WorldBounds(wr.world);
|
||||
DrawShroud( wr, clipRect, fogSprites, "fog" );
|
||||
DrawShroud( wr, clipRect, sprites, "shroud" );
|
||||
DrawShroud(wr, clipRect, fogSprites, fogPalette);
|
||||
DrawShroud(wr, clipRect, sprites, shroudPalette);
|
||||
}
|
||||
|
||||
void DrawShroud( WorldRenderer wr, Rectangle clip, Sprite[,] s, string pal )
|
||||
void DrawShroud(WorldRenderer wr, Rectangle clip, Sprite[,] s, PaletteReference pal)
|
||||
{
|
||||
var shroudPalette = wr.GetPaletteIndex(pal);
|
||||
|
||||
for (var j = clip.Top; j < clip.Bottom; j++)
|
||||
{
|
||||
var starti = clip.Left;
|
||||
@@ -142,14 +149,14 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
s[starti, j].DrawAt(
|
||||
Game.CellSize * new float2(starti, j),
|
||||
shroudPalette,
|
||||
pal.RowIndex(wr),
|
||||
new float2(Game.CellSize * (i - starti), Game.CellSize));
|
||||
starti = i + 1;
|
||||
}
|
||||
|
||||
s[i, j].DrawAt(
|
||||
Game.CellSize * new float2(i, j),
|
||||
shroudPalette);
|
||||
pal.RowIndex(wr));
|
||||
starti = i + 1;
|
||||
last = s[i, j];
|
||||
}
|
||||
@@ -157,7 +164,7 @@ namespace OpenRA.Graphics
|
||||
if (starti < clip.Right)
|
||||
s[starti, j].DrawAt(
|
||||
Game.CellSize * new float2(starti, j),
|
||||
shroudPalette,
|
||||
pal.RowIndex(wr),
|
||||
new float2(Game.CellSize * (clip.Right - starti), Game.CellSize));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user