Refactor per-player shrouds & fix shellmap shroud.

This commit is contained in:
Paul Chote
2013-04-10 00:35:39 +12:00
parent 66eff85aa4
commit c428cad70c
33 changed files with 146 additions and 120 deletions

View File

@@ -139,7 +139,7 @@ namespace OpenRA.Graphics
foreach (var t in world.ActorsWithTrait<IRadarSignature>())
{
if (!world.RenderedShroud.IsVisible(t.Actor))
if (world.ShroudObscures(t.Actor))
continue;
var color = t.Trait.RadarSignatureColor(t.Actor);
@@ -158,7 +158,7 @@ namespace OpenRA.Graphics
var map = world.Map;
var size = Exts.NextPowerOf2(Math.Max(map.Bounds.Width, map.Bounds.Height));
var bitmap = new Bitmap(size, size);
if (world.RenderedShroud.Disabled)
if (world.RenderPlayer == null)
return bitmap;
var bitmapData = bitmap.LockBits(bitmap.Bounds(),
@@ -174,11 +174,10 @@ namespace OpenRA.Graphics
for (var x = 0; x < map.Bounds.Width; x++)
for (var y = 0; y < map.Bounds.Height; y++)
{
var mapX = x + map.Bounds.Left;
var mapY = y + map.Bounds.Top;
if (!world.RenderedShroud.IsExplored(mapX, mapY))
var p = new CPos(x + map.Bounds.Left, y + map.Bounds.Top);
if (world.ShroudObscures(p))
*(c + (y * bitmapData.Stride >> 2) + x) = shroud;
else if (!world.RenderedShroud.IsVisible(mapX,mapY))
else if (world.FogObscures(p))
*(c + (y * bitmapData.Stride >> 2) + x) = fog;
}
}