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:
reaperrr
2020-01-31 14:54:57 +01:00
committed by abcdefg30
parent bc9b3bef74
commit c10487d635
12 changed files with 237 additions and 51 deletions

View File

@@ -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)
{