@@ -44,6 +44,25 @@ namespace OpenRA
|
||||
return a + ((PVecInt)(b - a) * mul / div);
|
||||
}
|
||||
|
||||
public static PPos Average(params PPos[] list)
|
||||
{
|
||||
if (list == null || list.Length == 0)
|
||||
throw new ArgumentException("PPos: Cannot calculate average of empty list.");
|
||||
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
foreach(var pos in list)
|
||||
{
|
||||
x += pos.X;
|
||||
y += pos.Y;
|
||||
}
|
||||
|
||||
x /= list.Length;
|
||||
y /= list.Length;
|
||||
|
||||
return new PPos(x,y);
|
||||
}
|
||||
|
||||
public float2 ToFloat2() { return new float2(X, Y); }
|
||||
public int2 ToInt2() { return new int2(X, Y); }
|
||||
public CPos ToCPos() { return new CPos((int)(1f / Game.CellSize * X), (int)(1f / Game.CellSize * Y)); }
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public readonly int[] ContrailOffset = {0, 0};
|
||||
|
||||
public readonly int TrailLength = 20;
|
||||
public readonly int TrailLength = 25;
|
||||
public readonly Color Color = Color.White;
|
||||
public readonly bool UsePlayerColor = true;
|
||||
|
||||
@@ -86,10 +86,10 @@ namespace OpenRA.Mods.RA
|
||||
Color trailStart = Color;
|
||||
Color trailEnd = Color.FromArgb(trailStart.A - 255 / TrailLength, trailStart.R, trailStart.G, trailStart.B);
|
||||
|
||||
for (int i = positions.Count - 1 - StartSkip; i >= 1; --i)
|
||||
for (int i = positions.Count - 1 - StartSkip; i >= 4; --i)
|
||||
{
|
||||
var conPos = positions[i];
|
||||
var nextPos = positions[i - 1];
|
||||
var conPos = PPos.Average(positions[i], positions[i-1], positions[i-2], positions[i-3]);
|
||||
var nextPos = PPos.Average(positions[i-1], positions[i-2], positions[i-3], positions[i-4]);
|
||||
|
||||
if (self.World.RenderedShroud.IsVisible(conPos.ToCPos()) ||
|
||||
self.World.RenderedShroud.IsVisible(nextPos.ToCPos()))
|
||||
|
||||
Reference in New Issue
Block a user