Remove obsolete Gauss1D/Gauss2D functions.

This commit is contained in:
Paul Chote
2013-07-22 20:21:23 +12:00
parent b374816fa1
commit bf9c737a11
3 changed files with 4 additions and 17 deletions

View File

@@ -138,19 +138,6 @@ namespace OpenRA
r.Next(w.Map.Bounds.Top, w.Map.Bounds.Bottom));
}
public static float Gauss1D(this Thirdparty.Random r, int samples)
{
return Exts.MakeArray(samples, _ => r.NextFloat() * 2 - 1f)
.Sum() / samples;
}
// Returns a random offset in the range [-1..1,-1..1] with a separable
// Gauss distribution with 'samples' values taken for each axis
public static float2 Gauss2D(this Thirdparty.Random r, int samples)
{
return new float2(Gauss1D(r, samples), Gauss1D(r, samples));
}
public static bool HasVoices(this Actor a)
{
var selectable = a.Info.Traits.GetOrDefault<SelectableInfo>();

View File

@@ -101,8 +101,8 @@ namespace OpenRA.Mods.RA
var renderables = new List<IRenderable>();
if (Game.CosmeticRandom.Next(2) != 0)
{
var p1 = from + (1 / 3f) * dist + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm;
var p2 = from + (2 / 3f) * dist + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm;
var p1 = from + (1 / 3f) * dist + WRange.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
var p2 = from + (2 / 3f) * dist + WRange.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
renderables.AddRange(DrawZap(wr, from, p1, s, out p1));
renderables.AddRange(DrawZap(wr, p1, p2, s, out p2));
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.RA
}
else
{
var p1 = from + (1 / 2f) * dist + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm;
var p1 = from + (1 / 2f) * dist + WRange.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
renderables.AddRange(DrawZap(wr, from, p1, s, out p1));
renderables.AddRange(DrawZap(wr, p1, to, s, out z));

View File

@@ -76,7 +76,7 @@ namespace OpenRA.Mods.RA
length = (finalPos - initialPos).Length / info.Velocity;
// Facing rotation
rotation = Game.CosmeticRandom.Gauss1D(2) * info.ROT;
rotation = WRange.FromPDF(Game.CosmeticRandom, 2).Range * info.ROT / 1024;
var anim = new Animation(rs.GetImage(self), () => (int)facing);
anim.PlayRepeating(info.Anim);