changed ResourceLayer to work the same as BibLayer

This commit is contained in:
Chris Forbes
2010-04-18 17:52:34 +12:00
parent 1f3f25de87
commit 9dbed9ed50
2 changed files with 12 additions and 13 deletions

View File

@@ -86,19 +86,17 @@ namespace OpenRA.Traits
public void Render()
{
var tl = world.Map.TopLeft;
var br = world.Map.BottomRight;
for (int x = tl.X; x < br.X; x++)
for (int y = tl.Y; y < br.Y; y++)
var br = world.Map.BottomRight;
for (int x = tl.X; x < br.X; x++)
for (int y = tl.Y; y < br.Y; y++)
{
var t = new int2(x, y);
if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.IsExplored(t) || tiles[x,y].type == 0) continue;
spriteRenderer.DrawSprite(bibSprites[tiles[x,y].type- 1][tiles[x,y].image],
if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.IsExplored(t) || tiles[x,y].type == 0) continue;
spriteRenderer.DrawSprite(bibSprites[tiles[x, y].type - 1][tiles[x, y].image],
Game.CellSize * (float2)t, "terrain");
}
spriteRenderer.Flush();
}
}

View File

@@ -47,8 +47,11 @@ namespace OpenRA.Traits
{
var map = world.Map;
for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
for (int x = map.XOffset; x < map.XOffset + map.Width; x++)
var tl = world.Map.TopLeft;
var br = world.Map.BottomRight;
for (int x = tl.X; x < br.X; x++)
for (int y = tl.Y; y < br.Y; y++)
{
if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.IsExplored(new int2(x, y))) continue;
@@ -58,8 +61,6 @@ namespace OpenRA.Traits
Game.CellSize * new int2(x, y),
c.type.info.Palette);
}
sr.Flush();
}
public void WorldLoaded(World w)