Allow all sprites to use interpolated facings.
This commit is contained in:
@@ -84,16 +84,17 @@ namespace OpenRA.Mods.Common
|
||||
return new WAngle(a % step - step / 2);
|
||||
}
|
||||
|
||||
public static WAngle GetInterpolatedFacing(WAngle facing, int facings, int interpolatedFacings)
|
||||
/// <summary>Returns the angle that the closest facing sprite should be rotated by to achieve the closest interpolated facing.</summary>
|
||||
public static WAngle GetInterpolatedFacingRotation(WAngle facing, int facings, int interpolatedFacings)
|
||||
{
|
||||
var step = 1024 / interpolatedFacings;
|
||||
return new WAngle(AngleDiffToStep(facing, facings).Angle / step * step);
|
||||
}
|
||||
|
||||
/// <summary>Rounds the given facing value to the nearest quantized step.</summary>
|
||||
public static WAngle QuantizeFacing(WAngle facing, int steps)
|
||||
/// <summary>Rounds the given facing value to the nearest quantized facing.</summary>
|
||||
public static WAngle QuantizeFacing(WAngle facing, int facings)
|
||||
{
|
||||
return new WAngle(IndexFacing(facing, steps) * (1024 / steps));
|
||||
return new WAngle(IndexFacing(facing, facings) * (1024 / facings));
|
||||
}
|
||||
|
||||
/// <summary>Wraps an arbitrary integer facing value into the range 0 - 255</summary>
|
||||
|
||||
Reference in New Issue
Block a user