From 7b81b9e806227489c3ef8f192ecfc60a32ea2386 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 30 May 2020 21:13:12 +0100 Subject: [PATCH] Bullet Facing -> WAngle. --- OpenRA.Mods.Common/Projectiles/Bullet.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs index 05137e7f69..1d8fd6923f 100644 --- a/OpenRA.Mods.Common/Projectiles/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Projectiles readonly BulletInfo info; readonly ProjectileArgs args; readonly Animation anim; - readonly int facing; + readonly WAngle facing; readonly WAngle angle; readonly WDist speed; readonly string trailPalette; @@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Projectiles if (info.AirburstAltitude > WDist.Zero) target += new WVec(WDist.Zero, WDist.Zero, info.AirburstAltitude); - facing = (target - pos).Yaw.Facing; + facing = (target - pos).Yaw; length = Math.Max((target - pos).Length / speed.Length, 1); if (!string.IsNullOrEmpty(info.Image)) @@ -184,14 +184,14 @@ namespace OpenRA.Mods.Common.Projectiles var at = (float)ticks / (length - 1); var attitude = angle.Tan() * (1 - 2 * at) / (4 * 1024); - var u = (facing % 128) / 128f; - var scale = 512 * u * (1 - u); + var u = (facing.Angle % 512) / 512f; + var scale = 2048 * u * (1 - u); - var effective = (int)(facing < 128 - ? facing - scale * attitude - : facing + scale * attitude); + var effective = (int)(facing.Angle < 512 + ? facing.Angle - scale * attitude + : facing.Angle + scale * attitude); - return WAngle.FromFacing(effective); + return new WAngle(effective); } public void Tick(World world)