diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs index 4045c7af59..965c6d8d33 100755 --- a/OpenRA.Game/WorldUtils.cs +++ b/OpenRA.Game/WorldUtils.cs @@ -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(); diff --git a/OpenRA.Mods.RA/TeslaZapRenderable.cs b/OpenRA.Mods.RA/TeslaZapRenderable.cs index 0bdf0186ce..0e6d883147 100755 --- a/OpenRA.Mods.RA/TeslaZapRenderable.cs +++ b/OpenRA.Mods.RA/TeslaZapRenderable.cs @@ -101,8 +101,8 @@ namespace OpenRA.Mods.RA var renderables = new List(); 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)); diff --git a/OpenRA.Mods.RA/ThrowsParticle.cs b/OpenRA.Mods.RA/ThrowsParticle.cs index 7f7360d264..0bf3b1a36e 100644 --- a/OpenRA.Mods.RA/ThrowsParticle.cs +++ b/OpenRA.Mods.RA/ThrowsParticle.cs @@ -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);