facings for bullets, where appropriate.
This commit is contained in:
@@ -46,10 +46,11 @@ namespace OpenRa.Effects
|
||||
|
||||
if (Projectile.Image != null && Projectile.Image != "none")
|
||||
{
|
||||
anim = new Animation(Projectile.Image);
|
||||
if (Projectile.Rotates)
|
||||
Traits.Util.PlayFacing(anim, "idle", () => Traits.Util.GetFacing((dest - src).ToFloat2(), 0));
|
||||
anim = new Animation(Projectile.Image, () => Traits.Util.GetFacing((dest - src).ToFloat2(), 0));
|
||||
else
|
||||
anim = new Animation(Projectile.Image);
|
||||
|
||||
anim.PlayRepeating("idle");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +35,11 @@ namespace OpenRa.Effects
|
||||
|
||||
if (Projectile.Image != null && Projectile.Image != "none")
|
||||
{
|
||||
if (Projectile.Rotates)
|
||||
anim = new Animation(Projectile.Image, () => Facing);
|
||||
else
|
||||
anim = new Animation(Projectile.Image);
|
||||
|
||||
if (Projectile.Rotates)
|
||||
Traits.Util.PlayFacing(anim, "idle", () => Facing);
|
||||
else
|
||||
anim.PlayRepeating("idle");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,13 +43,6 @@ namespace OpenRa.Traits
|
||||
return highest * 8;
|
||||
}
|
||||
|
||||
public static void PlayFacing(this Animation anim, string sequenceName, Func<int> facing)
|
||||
{
|
||||
anim.PlayFetchIndex(sequenceName,
|
||||
() => Traits.Util.QuantizeFacing(facing(),
|
||||
anim.CurrentSequence.Length));
|
||||
}
|
||||
|
||||
public static int GetNearestFacing( int facing, int desiredFacing )
|
||||
{
|
||||
var turn = desiredFacing - facing;
|
||||
@@ -87,7 +80,7 @@ namespace OpenRa.Traits
|
||||
if (rut == null) return float2.Zero;
|
||||
|
||||
var facing = self.traits.Get<Turreted>().turretFacing;
|
||||
var quantizedFacing = QuantizeFacing(facing, rut.anim.CurrentSequence.Length) * (256 / rut.anim.CurrentSequence.Length);
|
||||
var quantizedFacing = QuantizeFacing(facing, rut.anim.CurrentSequence.Facings) * (256 / rut.anim.CurrentSequence.Length);
|
||||
|
||||
return RotateVectorByFacing(new float2(0, recoil * self.Info.Traits.Get<AttackBaseInfo>().Recoil), quantizedFacing, .7f);
|
||||
}
|
||||
@@ -107,7 +100,7 @@ namespace OpenRa.Traits
|
||||
if( unit == null ) return int2.Zero; /* things that don't have a rotating base don't need the turrets repositioned */
|
||||
|
||||
var ru = self.traits.GetOrDefault<RenderUnit>();
|
||||
var numDirs = (ru != null) ? ru.anim.CurrentSequence.Length : 8;
|
||||
var numDirs = (ru != null) ? ru.anim.CurrentSequence.Facings : 8;
|
||||
var bodyFacing = unit.Facing;
|
||||
var quantizedFacing = QuantizeFacing(bodyFacing, numDirs) * (256 / numDirs);
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@
|
||||
<sequence name="unload" start="35" length="1" />
|
||||
</unit>
|
||||
<unit name="v2">
|
||||
<sequence name="idle" start="0" length="32" />
|
||||
<sequence name="idle" start="0" facings="32" />
|
||||
</unit>
|
||||
<unit name="flagfly">
|
||||
<sequence name="idle" start="0" length="14" />
|
||||
@@ -606,7 +606,7 @@
|
||||
<sequence name="idle" start="0" length="1" />
|
||||
</unit>
|
||||
<unit name="dragon">
|
||||
<sequence name="idle" start="0" length="32" />
|
||||
<sequence name="idle" start="0" facings="32" />
|
||||
</unit>
|
||||
<unit name="smokey">
|
||||
<sequence name="idle" start="0" length="7" />
|
||||
@@ -639,7 +639,7 @@
|
||||
<sequence name="die6" start="0" length="17" src="electdog" />
|
||||
</unit>
|
||||
<unit name="missile">
|
||||
<sequence name="idle" start="0" length="32" />
|
||||
<sequence name="idle" start="0" facings="32" />
|
||||
</unit>
|
||||
<unit name="spy">
|
||||
<sequence name="stand" start="0" facings="8" />
|
||||
|
||||
Reference in New Issue
Block a user