diff --git a/OpenRA.Mods.RA/Effects/NukeLaunch.cs b/OpenRA.Mods.RA/Effects/NukeLaunch.cs index ac13568f77..e0c9657f8f 100755 --- a/OpenRA.Mods.RA/Effects/NukeLaunch.cs +++ b/OpenRA.Mods.RA/Effects/NukeLaunch.cs @@ -19,13 +19,12 @@ namespace OpenRA.Mods.RA.Effects { readonly Player firedBy; Animation anim; - PPos pos; + WPos pos; CPos targetLocation; - int altitude; bool goingUp = true; string weapon; - public NukeLaunch(Player firedBy, Actor silo, string weapon, PVecInt spawnOffset, CPos targetLocation) + public NukeLaunch(Player firedBy, Actor silo, string weapon, WPos launchPos, CPos targetLocation) { this.firedBy = firedBy; this.targetLocation = targetLocation; @@ -33,18 +32,14 @@ namespace OpenRA.Mods.RA.Effects anim = new Animation(weapon); anim.PlayRepeating("up"); + pos = launchPos; if (silo == null) - { - altitude = firedBy.World.Map.Bounds.Height*Game.CellSize; StartDescent(firedBy.World); - } - else - pos = silo.CenterLocation + spawnOffset; } void StartDescent(World world) { - pos = OpenRA.Traits.Util.CenterOfCell(targetLocation); + pos = targetLocation.CenterPosition + new WVec(0, 0, 1024*firedBy.World.Map.Bounds.Height); anim.PlayRepeating("down"); goingUp = false; } @@ -53,16 +48,17 @@ namespace OpenRA.Mods.RA.Effects { anim.Tick(); + var delta = new WVec(0,0,427); if (goingUp) { - altitude += 10; - if (altitude >= world.Map.Bounds.Height*Game.CellSize) + pos += delta; + if (pos.Z >= world.Map.Bounds.Height*1024) StartDescent(world); } else { - altitude -= 10; - if (altitude <= 0) + pos -= delta; + if (pos.Z <= 0) Explode(world); } } @@ -70,8 +66,8 @@ namespace OpenRA.Mods.RA.Effects void Explode(World world) { world.AddFrameEndTask(w => w.Remove(this)); - Combat.DoExplosion(firedBy.PlayerActor, weapon, pos, 0); - world.WorldActor.Trait().AddEffect(20, pos.ToFloat2(), 5); + Combat.DoExplosion(firedBy.PlayerActor, weapon, PPos.FromWPos(pos), pos.Z * Game.CellSize / 1024); + world.WorldActor.Trait().AddEffect(20, PPos.FromWPos(pos).ToFloat2(), 5); foreach (var a in world.ActorsWithTrait()) a.Trait.Enable(); @@ -79,8 +75,7 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render(WorldRenderer wr) { - yield return new SpriteRenderable(anim.Image, pos.ToFloat2() - new float2(0, altitude), - wr.Palette("effect"), (int)pos.Y); + yield return new SpriteRenderable(anim.Image, pos, 0, wr.Palette("effect"), 1f); } } } diff --git a/OpenRA.Mods.RA/SupportPowers/NukePower.cs b/OpenRA.Mods.RA/SupportPowers/NukePower.cs index 633dced27a..cb7b9b5ea7 100755 --- a/OpenRA.Mods.RA/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/NukePower.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA { [WeaponReference] public readonly string MissileWeapon = ""; - public readonly int2 SpawnOffset = int2.Zero; + public readonly WVec SpawnOffset = WVec.Zero; public override object Create(ActorInitializer init) { return new NukePower(init.self, this); } } @@ -39,10 +39,10 @@ namespace OpenRA.Mods.RA Sound.Play(Info.LaunchSound); var npi = Info as NukePowerInfo; - - self.Trait().PlayCustomAnim(self, "active"); + var rb = self.Trait(); + rb.PlayCustomAnim(self, "active"); self.World.AddFrameEndTask(w => w.Add( - new NukeLaunch(self.Owner, self, npi.MissileWeapon, (PVecInt)npi.SpawnOffset, order.TargetLocation))); + new NukeLaunch(self.Owner, self, npi.MissileWeapon, self.CenterPosition + rb.LocalToWorld(npi.SpawnOffset), order.TargetLocation))); } } } diff --git a/mods/d2k/rules/harkonnen.yaml b/mods/d2k/rules/harkonnen.yaml index c770778be2..3438615f23 100644 --- a/mods/d2k/rules/harkonnen.yaml +++ b/mods/d2k/rules/harkonnen.yaml @@ -73,7 +73,7 @@ PALACEH: SelectTargetSound: LaunchSound: MissileWeapon: atomic - SpawnOffset: 28,12 + SpawnOffset:-512,1c171,0 CanPowerDown: RequiresPower: SupportPowerChargeBar: diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 1d11b87df7..e7a4e9200f 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -34,7 +34,7 @@ MSLO: SelectTargetSound: slcttgt1.aud LaunchSound: alaunch1.aud MissileWeapon: atomic - SpawnOffset: 10,0 + SpawnOffset: 0,427,0 CanPowerDown: RequiresPower: SupportPowerChargeBar: