Move ClassicFacingFudge support to Mods.Cnc
This moves the TD/RA-specific re-mapping of sprite facings and coordinates to Mods.Cnc.
This commit is contained in:
@@ -53,30 +53,6 @@ namespace OpenRA.Mods.Common
|
||||
return a / step;
|
||||
}
|
||||
|
||||
public static int QuantizeFacing(int facing, int numFrames, bool useClassicFacingFudge)
|
||||
{
|
||||
if (!useClassicFacingFudge || numFrames != 32)
|
||||
return Util.QuantizeFacing(facing, numFrames);
|
||||
|
||||
// TD and RA divided the facing artwork into 3 frames from (north|south) to (north|south)-(east|west)
|
||||
// and then 5 frames from (north|south)-(east|west) to (east|west)
|
||||
var quadrant = ((facing + 31) & 0xFF) / 64;
|
||||
if (quadrant == 0 || quadrant == 2)
|
||||
{
|
||||
var frame = Util.QuantizeFacing(facing, 24);
|
||||
if (frame > 18)
|
||||
return frame + 6;
|
||||
if (frame > 4)
|
||||
return frame + 3;
|
||||
return frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
var frame = Util.QuantizeFacing(facing, 40);
|
||||
return frame < 20 ? frame - 3 : frame - 8;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Wraps an arbitrary integer facing value into the range 0 - 255</summary>
|
||||
public static int NormalizeFacing(int f)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user