Add UseClassicFacingFudge flag for TD/RA.
This commit is contained in:
@@ -48,6 +48,30 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
public static WPos BetweenCells(World w, CPos from, CPos to)
|
||||
{
|
||||
return WPos.Lerp(w.Map.CenterOfCell(from), w.Map.CenterOfCell(to), 1, 2);
|
||||
|
||||
Reference in New Issue
Block a user