Use FogObscures(WPos).

This commit is contained in:
Paul Chote
2015-06-07 19:28:39 +01:00
parent 66dd3c553c
commit 3994e1eec9
11 changed files with 13 additions and 24 deletions

View File

@@ -65,20 +65,17 @@ namespace OpenRA.Mods.Common.Graphics
// Start of the first line segment is the tail of the list - don't smooth it.
var curPos = trail[Index(next - skip - 1)];
var curCell = wr.World.Map.CellContaining(curPos);
var curColor = color;
for (var i = 0; i < length - skip - 4; i++)
{
var j = next - skip - i - 2;
var nextPos = Average(trail[Index(j)], trail[Index(j - 1)], trail[Index(j - 2)], trail[Index(j - 3)]);
var nextCell = wr.World.Map.CellContaining(nextPos);
var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);
if (!world.FogObscures(curCell) && !world.FogObscures(nextCell))
if (!world.FogObscures(curPos) && !world.FogObscures(nextPos))
wlr.DrawLine(wr.ScreenPosition(curPos), wr.ScreenPosition(nextPos), curColor, nextColor);
curPos = nextPos;
curCell = nextCell;
curColor = nextColor;
}