Remove fp from CenterLocation and aircraft.
This commit is contained in:
@@ -17,11 +17,11 @@ namespace OpenRA.Mods.RA.Air
|
||||
{
|
||||
public class Fly : CancelableActivity
|
||||
{
|
||||
public readonly float2 Pos;
|
||||
public readonly int2 Pos;
|
||||
|
||||
private Fly( float2 px ) { Pos = px; }
|
||||
private Fly( int2 px ) { Pos = px; }
|
||||
|
||||
public static Fly ToPx( float2 px ) { return new Fly( px ); }
|
||||
public static Fly ToPx( int2 px ) { return new Fly( px ); }
|
||||
public static Fly ToCell( int2 pos ) { return new Fly( Util.CenterOfCell( pos ) ); }
|
||||
|
||||
public override IActivity Tick(Actor self)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
bool isCalculated;
|
||||
Actor dest;
|
||||
|
||||
float2 w1, w2, w3; /* tangent points to turn circles */
|
||||
int2 w1, w2, w3; /* tangent points to turn circles */
|
||||
|
||||
public static Actor ChooseAirfield(Actor self)
|
||||
{
|
||||
@@ -74,9 +74,9 @@ namespace OpenRA.Mods.RA.Air
|
||||
|
||||
if (f.X > 0) f = -f;
|
||||
|
||||
w1 = c1 + f;
|
||||
w2 = c2 + f;
|
||||
w3 = approachStart;
|
||||
w1 = (c1 + f).ToInt2();
|
||||
w2 = (c2 + f).ToInt2();
|
||||
w3 = (approachStart).ToInt2();
|
||||
|
||||
isCalculated = true;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
srcAltitude = self.Trait<IMove>().Altitude,
|
||||
destAltitude = 0,
|
||||
src = self.CenterLocation.ToInt2(),
|
||||
dest = self.CenterLocation.ToInt2(),
|
||||
src = self.CenterLocation,
|
||||
dest = self.CenterLocation,
|
||||
facing = self.Trait<IFacing>().Facing,
|
||||
firedBy = self,
|
||||
weapon = weapon
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
if (!doneDamage)
|
||||
{
|
||||
if (args.target.IsValid)
|
||||
args.dest = args.target.CenterLocation.ToInt2();
|
||||
args.dest = args.target.CenterLocation;
|
||||
|
||||
Combat.DoImpacts(args);
|
||||
doneDamage = true;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
readonly ProjectileArgs Args;
|
||||
|
||||
int2 offset;
|
||||
float2 Pos;
|
||||
int2 Pos;
|
||||
readonly Animation anim;
|
||||
int Facing;
|
||||
int t;
|
||||
@@ -93,12 +93,13 @@ namespace OpenRA.Mods.RA.Effects
|
||||
var speed = Scale * Info.Speed * ((targetAltitude > 0 && Info.TurboBoost) ? 1.5f : 1f);
|
||||
|
||||
var angle = Facing / 128f * Math.PI;
|
||||
var move = speed * -float2.FromAngle((float)angle);
|
||||
// TODO: Replace float2.FromAngle with int2.FromFacing
|
||||
var move = (speed * -float2.FromAngle((float)angle)).ToInt2();
|
||||
Pos += move;
|
||||
|
||||
if (Info.Trail != null)
|
||||
world.AddFrameEndTask(w => w.Add(
|
||||
new Smoke(w, (Pos - 1.5f * move - new int2(0, Altitude)).ToInt2(), Info.Trail)));
|
||||
new Smoke(w, (Pos - 1.5f * move.ToFloat2() - new int2(0, Altitude)).ToInt2(), Info.Trail)));
|
||||
|
||||
if (Info.RangeLimit != 0 && t > Info.RangeLimit * 40)
|
||||
Explode(world);
|
||||
@@ -116,7 +117,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
void Explode(World world)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
Args.dest = Pos.ToInt2();
|
||||
Args.dest = Pos;
|
||||
if (t > Info.Arm * 40) /* don't blow up in our launcher's face! */
|
||||
Combat.DoImpacts(Args);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
if (!doneDamage)
|
||||
{
|
||||
if (Args.target.IsValid)
|
||||
Args.dest = Args.target.CenterLocation.ToInt2();
|
||||
Args.dest = Args.target.CenterLocation;
|
||||
|
||||
Combat.DoImpacts(Args);
|
||||
doneDamage = true;
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.RA
|
||||
+ Combat.GetTurretPosition(self, facing, Turret)
|
||||
+ Combat.GetBarrelPosition(self, facing, Turret, barrel)).ToInt2(),
|
||||
srcAltitude = move != null ? move.Altitude : 0,
|
||||
dest = target.CenterLocation.ToInt2(),
|
||||
dest = target.CenterLocation,
|
||||
destAltitude = destMove != null ? destMove.Altitude : 0,
|
||||
|
||||
facing = barrel.Facing +
|
||||
|
||||
Reference in New Issue
Block a user