Use a lookup table for fvecs.

This commit is contained in:
Paul Chote
2011-01-27 12:05:13 +13:00
parent 9db41f5638
commit 0bd466a9e9

View File

@@ -31,9 +31,6 @@ namespace OpenRA.Traits
return ( facing - rot ) & 0xFF;
}
static int2[] fvecs = Graphics.Util.MakeArray<int2>( 32,
i => (-1024*float2.FromAngle( i / 16.0f * (float)Math.PI ) * new float2( 1f, 1.3f )).ToInt2() );
public static int GetFacing( int2 d, int currentFacing )
{
if (d == int2.Zero)
@@ -146,5 +143,40 @@ namespace OpenRA.Traits
}
}
static int2[] fvecs =
{
new int2( 0, -1331 ),
new int2( -199, -1305 ),
new int2( -391, -1229 ),
new int2( -568, -1106 ),
new int2( -724, -941 ),
new int2( -851, -739 ),
new int2( -946, -509 ),
new int2( -1004, -259 ),
new int2( -1024, 0 ),
new int2( -1004, 259 ),
new int2( -946, 509 ),
new int2( -851, 739 ),
new int2( -724, 941 ),
new int2( -568, 1106 ),
new int2( -391, 1229 ),
new int2( -199, 1305 ),
new int2( 0, 1331 ),
new int2( 199, 1305 ),
new int2( 391, 1229 ),
new int2( 568, 1106 ),
new int2( 724, 941 ),
new int2( 851, 739 ),
new int2( 946, 509 ),
new int2( 1004, 259 ),
new int2( 1024, 0 ),
new int2( 1004, -259 ),
new int2( 946, -509 ),
new int2( 851, -739 ),
new int2( 724, -941 ),
new int2( 568, -1106 ),
new int2( 391, -1229 ),
new int2( 199, -1305 )
};
}
}