removing a bunch of excessively low-level pixel -> cell conversions
This commit is contained in:
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var aircraft = self.traits.Get<Aircraft>();
|
||||
|
||||
self.CenterLocation += speed * -float2.FromAngle((float)angle);
|
||||
aircraft.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
||||
|
||||
unit.Altitude += Math.Sign(desiredAltitude - unit.Altitude);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (float2.WithinEpsilon(float2.Zero, dist, 2))
|
||||
{
|
||||
self.CenterLocation = Dest;
|
||||
aircraft.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
var rawSpeed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
self.CenterLocation += (rawSpeed / dist.Length) * dist;
|
||||
aircraft.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var angle = unit.Facing / 128f * Math.PI;
|
||||
|
||||
self.CenterLocation += speed * -float2.FromAngle((float)angle);
|
||||
aircraft.Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (rearmTarget == null)
|
||||
return new Wait(20);
|
||||
|
||||
return new Move(((1 / 24f) * rearmTarget.CenterLocation).ToInt2(), rearmTarget)
|
||||
return new Move(Util.CellContaining(rearmTarget.CenterLocation), rearmTarget)
|
||||
{ NextActivity = new Rearm() { NextActivity = new Repair(rearmTarget) { NextActivity = this } } };
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
world.AddFrameEndTask(w =>
|
||||
{
|
||||
w.Remove(this);
|
||||
int2 loc = ((1 / 24f) * location).ToInt2();
|
||||
var loc = Traits.Util.CellContaining(location);
|
||||
cargo.CancelActivity();
|
||||
if (cargo.traits.Contains<Mobile>())
|
||||
cargo.traits.Get<Mobile>().TeleportTo(cargo, loc);
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.RA
|
||||
offsetTicks = Info.InstabilityTicks;
|
||||
}
|
||||
|
||||
Location = ((1 / 24f) * self.CenterLocation).ToInt2();
|
||||
Location = Util.CellContaining(self.CenterLocation);
|
||||
}
|
||||
|
||||
const float Epsilon = .5f;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
self.World.AddFrameEndTask(w => w.Add(
|
||||
new Parachute(self.Owner, rs.anim.Name,
|
||||
Util.CenterOfCell((1 / 24f * self.CenterLocation).ToInt2()),
|
||||
Util.CenterOfCell(Util.CellContaining(self.CenterLocation)),
|
||||
self.traits.Get<Unit>().Altitude, a)));
|
||||
|
||||
Sound.Play("chute1.aud", self.CenterLocation);
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.RA
|
||||
var rp = order.TargetActor.traits.GetOrDefault<RallyPoint>();
|
||||
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new Move(((1 / 24f) * order.TargetActor.CenterLocation).ToInt2(), order.TargetActor));
|
||||
self.QueueActivity(new Move(Util.CellContaining(order.TargetActor.CenterLocation), order.TargetActor));
|
||||
self.QueueActivity(new Rearm());
|
||||
self.QueueActivity(new Repair(order.TargetActor));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user