Convert QuantizeFacing to WAngle facings.
This commit is contained in:
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var sequence = a.Info.MuzzleSequence;
|
||||
|
||||
if (a.Info.MuzzleSplitFacings > 0)
|
||||
sequence += Util.IndexFacing(muzzleFacing, a.Info.MuzzleSplitFacings).ToString();
|
||||
sequence += Util.IndexFacing(targetYaw, a.Info.MuzzleSplitFacings).ToString();
|
||||
|
||||
var muzzleFlash = new AnimationWithOffset(muzzleAnim,
|
||||
() => PortOffset(self, port),
|
||||
|
||||
@@ -44,13 +44,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return orientation;
|
||||
|
||||
// Map yaw to the closest facing
|
||||
var facing = QuantizeFacing(orientation.Yaw.Angle / 4, facings);
|
||||
var facing = QuantizeFacing(orientation.Yaw, facings);
|
||||
|
||||
// Roll and pitch are always zero if yaw is quantized
|
||||
return new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing));
|
||||
return WRot.FromYaw(facing);
|
||||
}
|
||||
|
||||
public virtual int QuantizeFacing(int facing, int facings)
|
||||
public virtual WAngle QuantizeFacing(WAngle facing, int facings)
|
||||
{
|
||||
return Util.QuantizeFacing(facing, facings);
|
||||
}
|
||||
@@ -106,12 +106,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return info.QuantizeOrientation(orientation, quantizedFacings.Value);
|
||||
}
|
||||
|
||||
public int QuantizeFacing(int facing)
|
||||
public WAngle QuantizeFacing(WAngle facing)
|
||||
{
|
||||
return info.QuantizeFacing(facing, quantizedFacings.Value);
|
||||
}
|
||||
|
||||
public int QuantizeFacing(int facing, int facings)
|
||||
public WAngle QuantizeFacing(WAngle facing, int facings)
|
||||
{
|
||||
return info.QuantizeFacing(facing, facings);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
var sequence = a.Info.MuzzleSequence;
|
||||
if (a.Info.MuzzleSplitFacings > 0)
|
||||
sequence += Util.IndexFacing(getFacing().Facing, a.Info.MuzzleSplitFacings).ToString();
|
||||
sequence += Util.IndexFacing(getFacing(), a.Info.MuzzleSplitFacings).ToString();
|
||||
|
||||
visible[barrel] = true;
|
||||
anims[barrel].Animation.PlayThen(sequence, () => visible[barrel] = false);
|
||||
|
||||
@@ -222,8 +222,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Quantize orientation to match a rendered sprite
|
||||
// Implies no pitch or yaw
|
||||
var facing = body.QuantizeFacing(world.Yaw.Angle / 4, QuantizedFacings);
|
||||
return new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing));
|
||||
return WRot.FromYaw(body.QuantizeFacing(world.Yaw, QuantizedFacings));
|
||||
}
|
||||
|
||||
public void ModifyDeathActorInit(Actor self, TypeDictionary init)
|
||||
|
||||
Reference in New Issue
Block a user