Fix sprite overlap outside the map border.

This commit is contained in:
Paul Chote
2014-07-01 00:24:26 +12:00
parent 96c9de2b96
commit 0d625b6af6
3 changed files with 22 additions and 5 deletions

View File

@@ -197,11 +197,19 @@ namespace OpenRA.Mods.RA
public void WorldLoaded(World w, WorldRenderer wr)
{
// Initialize tile cache
foreach (var cell in map.Cells)
// Adds a 1-cell border around the border to cover any sprites peeking outside the map
foreach (var cell in CellRegion.Expand(w.Map.Cells, 1))
{
var screen = wr.ScreenPosition(w.Map.CenterOfCell(cell));
var variant = Game.CosmeticRandom.Next(info.ShroudVariants.Length);
tiles[cell] = new ShroudTile(cell, screen, variant);
// Set the cells outside the border so they don't need to be touched again
if (!map.Contains(cell))
{
var index = info.UseExtendedIndex ? 240 : 15;
tiles[cell].Shroud = shroudSprites[variant * variantStride + spriteMap[index]];
}
}
fogPalette = wr.Palette(info.FogPalette);
@@ -253,7 +261,7 @@ namespace OpenRA.Mods.RA
{
Update(shroud);
foreach (var cell in wr.Viewport.VisibleCells)
foreach (var cell in CellRegion.Expand(wr.Viewport.VisibleCells, 1))
{
var t = tiles[cell];