diff --git a/OpenRA.Mods.RA/Combat.cs b/OpenRA.Mods.RA/Combat.cs index 37e9ea0263..b21034c93b 100755 --- a/OpenRA.Mods.RA/Combat.cs +++ b/OpenRA.Mods.RA/Combat.cs @@ -208,18 +208,18 @@ namespace OpenRA.Mods.RA return false; } - static float2 GetRecoil(Actor self, float recoil) + static PVecFloat GetRecoil(Actor self, float recoil) { if (!self.HasTrait()) - return float2.Zero; + return PVecFloat.Zero; var facing = self.Trait().turretFacing; var localRecoil = new float2(0, recoil); // vector in turret-space. - return Util.RotateVectorByFacing(localRecoil, facing, .7f); + return (PVecFloat)Util.RotateVectorByFacing(localRecoil, facing, .7f); } - public static PVecInt GetTurretPosition(Actor self, IFacing facing, Turret turret) + public static PVecFloat GetTurretPosition(Actor self, IFacing facing, Turret turret) { if (facing == null) return turret.ScreenSpacePosition; /* things that don't have a rotating base don't need the turrets repositioned */ @@ -228,23 +228,23 @@ namespace OpenRA.Mods.RA var bodyFacing = facing.Facing; var quantizedFacing = Util.QuantizeFacing(bodyFacing, numDirs) * (256 / numDirs); - return (PVecInt) ((PVecFloat)(Util.RotateVectorByFacing(turret.UnitSpacePosition.ToFloat2(), quantizedFacing, .7f) - + GetRecoil(self, turret.Recoil)) - + turret.ScreenSpacePosition); + return (PVecFloat)Util.RotateVectorByFacing(turret.UnitSpacePosition.ToFloat2(), quantizedFacing, .7f) + + GetRecoil(self, turret.Recoil) + + (PVecFloat)turret.ScreenSpacePosition.ToFloat2(); } - static PVecInt GetUnitspaceBarrelOffset(Actor self, IFacing facing, Turret turret, Barrel barrel) + static PVecFloat GetUnitspaceBarrelOffset(Actor self, IFacing facing, Turret turret, Barrel barrel) { var turreted = self.TraitOrDefault(); if (turreted == null && facing == null) - return PVecInt.Zero; + return PVecFloat.Zero; var turretFacing = turreted != null ? turreted.turretFacing : facing.Facing; - return (PVecInt)(PVecFloat)Util.RotateVectorByFacing(barrel.TurretSpaceOffset.ToFloat2(), turretFacing, .7f); + return (PVecFloat)Util.RotateVectorByFacing(barrel.TurretSpaceOffset.ToFloat2(), turretFacing, .7f); } // gets the screen-space position of a barrel. - public static PVecInt GetBarrelPosition(Actor self, IFacing facing, Turret turret, Barrel barrel) + public static PVecFloat GetBarrelPosition(Actor self, IFacing facing, Turret turret, Barrel barrel) { return GetTurretPosition(self, facing, turret) + barrel.ScreenSpaceOffset + GetUnitspaceBarrelOffset(self, facing, turret, barrel); diff --git a/OpenRA.Mods.RA/Effects/Contrail.cs b/OpenRA.Mods.RA/Effects/Contrail.cs index 170da8bdc3..1fa6602b5c 100755 --- a/OpenRA.Mods.RA/Effects/Contrail.cs +++ b/OpenRA.Mods.RA/Effects/Contrail.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA public void Tick(Actor self) { - history.Tick(self.CenterLocation - new PVecInt(0, move.Altitude) - Combat.GetTurretPosition(self, facing, contrailTurret)); + history.Tick(self.CenterLocation - new PVecInt(0, move.Altitude) - (PVecInt)Combat.GetTurretPosition(self, facing, contrailTurret).ToInt2()); } public void RenderAfterWorld(WorldRenderer wr, Actor self) { history.Render(self); } diff --git a/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs b/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs index df6ac6f6bb..70419e5d24 100644 --- a/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs +++ b/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA { var facing = self.Trait(); var altitude = new PVecInt(0, move.Altitude); - position = (self.CenterLocation - Combat.GetTurretPosition(self, facing, smokeTurret)); + position = (self.CenterLocation - (PVecInt)Combat.GetTurretPosition(self, facing, smokeTurret).ToInt2()); if (self.World.RenderedShroud.IsVisible(position.ToCPos())) self.World.AddFrameEndTask( diff --git a/OpenRA.Mods.RA/Weapon.cs b/OpenRA.Mods.RA/Weapon.cs index a22ae8c82f..606df63f75 100644 --- a/OpenRA.Mods.RA/Weapon.cs +++ b/OpenRA.Mods.RA/Weapon.cs @@ -126,7 +126,7 @@ namespace OpenRA.Mods.RA firedBy = self, target = target, - src = (self.CenterLocation + Combat.GetBarrelPosition(self, facing, Turret, barrel)), + src = (self.CenterLocation + (PVecInt)Combat.GetBarrelPosition(self, facing, Turret, barrel).ToInt2()), srcAltitude = move != null ? move.Altitude : 0, dest = target.CenterLocation, destAltitude = destMove != null ? destMove.Altitude : 0,