//=============================================================================
// Unreal Tournament SDK //
//-------------------------
// sdkCore //
//-----------
// Unreal Tournament SDK (c) Copyright 2007-2011 Stephan "Shadow" Nagel, 
// Under Artistic License 2.0
//
// sdkObject.
//
// Class by: Shadow
//
// Description:
// Basic Unreal Tournament SDK Object, contains many new constants, structs
// and functions, this class shouldn't be modified
//
// -----------
// Change Log
// -----------
//
// -- Major Fix (Build 148) --
//
// For subclasses of sdkObject and sdkActor simply call the function without
// passing the calling object or actor, but if you use them in a class
// not deriving from sdkObject/Actor then use the following syntax :
//
// class'sdkObject'.static.<FunctionName>(<TheCallingObject>);
// class'sdkActor'.static.<FunctionName>(<TheCallingActor>);
//
// Example :
//
// in sdXPostProcessFX we may directly call : GetClassName();
//
// .. BUT, in let's in any other class, not deriving from sdkObject :
//
// class'sdkObject'.static.GetClassName(self);
//
// The pointing object/actor that is passed is optional in these functions, 
// thus "self" isn't necessary for subclasses, because we know the current
// derived subclass internally in C++ (see UnSDKObject.cpp and UnSDKActor.cpp)
//
//
// -- Major Update/Fix (Build 250) --
//
// - fixed: numerous false native function identifiers in the Macro
// "IMPLEMENT_FUNCTION(OBJECT,IDENTIFIER,execFUNCTIONAME);"
//
// - accelerated some functions (Radius/Distance Checks, to be faster for 
// the Particle Engine)
// 
// - fixed: some functions have been improved, removed or renamed
// - some new functions added
//
//
// -- Minor Update (Build 300) --
//
// - fixed: malfunctioning floating point scaling functions (FScale etc.)
// - new Color Functions
//=============================================================================
class sdkObject expands Object
	native
	abstract
	noexport;

//=============================================================================
// Constants.

const e=2.7182818284590452;	 
           
const DegreeToRad=0.017453292519943296; 	
const RadToDegree=57.295779513082321600;
	
const OneSpin=65536;				
const HSpin=32768;
const QSpin=16384;
const EtSpin=8192;

const GO=1.6180339887499;	            	
const dPI=6.2831853071795864;           	
const sinPI=0.054803665;	            
const cosPI=0.998497149;	            	
const tanPI=0.05488615;	
	            	
const AlphaDamp=0.9;    

// Build 161:
var(sdkObject) const editconst string SDKVersion;

    
//=============================================================================
// sdkObject Structs.

/*
 * Struct: Range
 *
 * Init Build: Build 100
 * Last Update: -
 *
 * Description: 
 * A float range value, from min to max 
*/
struct Range
{
	var() float Max, Min;
};

/*
 * Struct: Range
 *
 * Init Build: Build 100
 * Last Update: Build 250 (C++ functionality)
 *
 * Description: 
 * A 2D Vector with float X / Y Components
*/
struct Vector2D
{
	var() float X, Y;
};

/*
 * Struct: VectorRange
 *
 * Init Build: Build 100
 * Last Update: -
 *
 * Description: 
 * A 3D vector range value, from min to max
*/
struct VectorRange
{
	var() vector Max, Min;
};

/*
 * Struct: VectorRange2D
 *
 * Init Build: Build 100
 * Last Update: Build 250 (C++ functionality)
 *
 * Description: 
 * A 2D vector range value, from min to max
*/
struct VectorRange2D
{
	var() Vector2D Max, Min;
};

/*
 * Struct: RotatorRange
 *
 * Init Build: Build 100
 * Last Update: -
 *
 * Description: 
 * A rotator range value, from min to max
*/
struct RotatorRange
{
	var() rotator Max, Min;
};

/*
 * Struct: FloatRotator
 *
 * Init Build: Build 359
 * Last Update: -
 *
 * Description: 
 * A rotator made up by float components
*/
struct FloatRotator
{
	var() float Pitch;
	var() float Yaw;
	var() float Roll;
};


/*
 * Struct: Vector2DRel
 *
 * Init Build: Build 359
 * Last Update: -
 *
 * Description: 
 * A 2D vector with a relative scaler
*/
struct Vector2DRel
{
	var() float X;
	var() float Y;
	var() float Relative;
};


/*
 * Struct: FloatGenRange
 *
 * Init Build: Build 100
 * Last Update: Build 250
 *
 * Description: 
 * A floating point function generator (w/o base)
*/
struct FloatGenRange
{
	var() float X, Y, Mod;	

	var() enum eOperation
	{
	OP_Constant,
	OP_Increase,
	OP_Decrease,
	OP_Random,
	OP_Random2,
	OP_Square,
	OP_Exp,
	OP_Sin,
	OP_Cos,
	OP_Tan,
	OP_CoTan,
	OP_ASin,
	OP_ACos,
	OP_ATan,
	OP_Sec,
	OP_CoSec,
	OP_SecH,
	OP_ASecH,
	OP_SinH,
	OP_CosH,
	OP_TanH,
	OP_ASinH,
	OP_ACosH,
	OP_ATanH,
	OP_Sinc,
	OP_Tanc,
	OP_Unused
	}Operation;

	var() range Range;
};
/*
 * Struct: FloatGen
 *
 * Init Build: Build 100
 * Last Update: Build 250 (renamed)
 *
 * Description: 
 * A floating point function generator
*/
struct FloatGen extends FloatGenRange
{
	var() float Base;
};

/*
 * Struct: UVScale
 *
 * Init Build: Build 100
 * Last Update: Build 250 (renamed)
 *
 * Description: 
 * A floating point U/V Scale of a Texture or Material
*/
struct UVScale
{
	var() float U, V;
};

/*
 * Struct: UVScaleRelative
 *
 * Init Build: Build 100
 * Last Update: Build 250 (renamed)
 *
 * Description: 
 * A floating point U/V Scale of a Texture or Material, with relative Scaling
*/
struct UVScaleRel extends UVScale
{
	var() float Relative;
};

/*
 * Struct: UVScaleRange
 *
 * Init Build: Build 100
 * Last Update: Build 250 (renamed)
 *
 * Description: 
 * A ranged floating point U/V Scale of a Texture or Material, with relative Scaling
*/
struct UVScaleRange
{
	var() Range Relative, U, V;
};

/*
 * Struct: DynamicUVScale
 *
 * Init Build: Build 100
 * Last Update: Build 250 (renamed)
 *
 * Description: 
 * A generated floating point U/V Scale of a Texture or Material
*/
struct DynamicUVScale
{
	var() floatgen U, V;
};

/*
 * Struct: DynamicUVScaleRel
 *
 * Init Build: Build 100
 * Last Update: Build 250 (renamed)
 *
 * Description: 
 * A generated floating point U/V Scale of a Texture or Material, with relative Scaling
*/
struct DynamicUVScaleRel extends DynamicUVScale
{
	var() floatgen Relative;
};

/*
 * Struct: DynamicUVScale
 *
 * Init Build: Build 100
 * Last Update: Build 250 (renamed)
 *
 * Description: 
 * A generated floating point U/V Scale of a Texture or Material, with relative Scaling
*/
struct DynamicUVScaleRange
{
	var() floatgenrange Relative, U, V;
};

var enum eBlending
{
	Blend_None,					// STY_None
	Blend_Normal,					// STY_Normal
	Blend_Masked,					// STY_Masked
	Blend_Translucent,				// STY_Translucent
	Blend_Modulated,				// STY_Modulated
	Blend_Brighten,					// STY_Translucent, but super-bright
	Blend_Darken,					// STY_Translucent, but colors are darkened, Texture appears negative
	Blend_SubtleBrighten,				// like Blend_Brighten but more focussed and subtle	
	Blend_SubtleDarken,				// like Blend_Darken but more focussed and subtle
	Blend_ModBrighten,				// inverted STY_Modulated
	Blend_NegativeDarken,				// negative/inverted Blend_Darken
	Blend_Multiply,					// STY_Modulated, but darker
	Blend_Negative,					// Background is negative, the brighter the texture the more negative the background
	Blend_Inverted					// STY_Translucent, but white becomes black
}xBlending;

/*
 * Struct: Material
 *
 * Init Build: Build 100
 * Last Update: Build 250 (renamed)
 *
 * Description: 
 * An abstract material with dynamic size, alpha, color, blending and spin (Mesh Sprites)
*/
struct Material
{
	var() texture Diffuse;
	
	var() DynamicUVScaleRel TexScaler;
	var() floatgen TexAlpha;
	var() floatgen TexRotator;

	var() color TexColor;
	var() eBlending TexBlending;
};

//=============================================================================
// Variables.

var globalconfig string MusicDirectories[64];

var transient string NextSong;
var transient bool bLoopNextSong;


//=============================================================================
// Functions.

/*-----------------------------------------------------------------------------
	Bool Functions.
-----------------------------------------------------------------------------*/

// Build 100 ------------------------------------------------------------------

native(1870) static final function bool RandBool();


/*-----------------------------------------------------------------------------
	Byte Functions.
-----------------------------------------------------------------------------*/

// Build 100 ------------------------------------------------------------------

native(1871) static final function byte FloatToByte(float F, bool bSign);
native(1872) static final function float ByteToFloat(byte Input, optional bool bSign);


/*-----------------------------------------------------------------------------
	Integer Functions.
-----------------------------------------------------------------------------*/

// Build 100 ------------------------------------------------------------------

native(1873) static final function int Round(float X);
native(1874) static final function int iSign(int X);
native(1875) static final function int Rand2(int Max);
native(1876) static final function int RangeInt(int Max, int Min);
native(1877) static final function int RangeInt2(int Max, int Min);
native(1878) static final function SwapInt(out int A, out int B);

native(1879) static final function int nFac(int N);
native(1880) static final function bool nEven(int X);

native(1881) static final function int NextPowerOfTwo(coerce int In);
native(1882) static final function int PrevPowerOfTwo(coerce int In);

native(1883) static final function int iBiChain(int N);
native(1884) static final function int iOddChain(int N);


/*-----------------------------------------------------------------------------
	Float Functions.
-----------------------------------------------------------------------------*/

// Build 100 ------------------------------------------------------------------

native(1885) static final function float Ceil(float X);
native(1886) static final function float Floor(float X);
native(1887) static final function int Sign(float X);
native(1888) static final function SwapFloat(out float A, out float B);
native(1889) static final function float Frac(float X);

native(1890) static final function float BaseValue(float P, float V);
native(1891) static final function float Percentage(float V, float B);
native(1892) static final function float PercentValue(float B, float P);

native(1893) static final function float RangeFloat(float Max, float Min);
native(1894) static final function float RangeFloat2(float Max, float Min);
native(1895) static final function float FRand2(float Var, optional float Base);
native(1896) static final function float AdvRandRange(float Max, float Min, optional float Mod);
native(1897) static final function float RandFClamp(float Max, float Min, optional float Mod);

native(1898) static final function float LogB(float A);
native(1899) static final function float LogD(float A);
native(1900) static final function float LogAB(float A, float B);
native(1901) static final function float nRoot(float X, float N);
native(1902) static final function float nRoot2(float X, float N, float M);
native(1903) static final function float MetaRoot(float X, float N, float M);

native(1904) static final function float fGeoChainExplicite(float Base, float N, float Q);
native(1905) static final function float fArChainExplicite(float Base, float N, float D);
native(1906) static final function float fArChainExpInv(float InvBase, float Base, float N, float D);

native(1907) static final function float RadToDeg(float Rad);
native(1908) static final function float DegToRad(float Deg);
native(1909) static final function float dSin(float Angle);
native(1910) static final function float dCos(float Angle);

native(1911) static final function float CoTan(float X);

native(1912) static final function float Sec(float X);
native(1913) static final function float Csc(float X);
native(1914) static final function float SecH(float X);
native(1915) static final function float ASecH(float X);

native(1916) static final function float ASin(float X);
native(1917) static final function float ACos(float X);
native(1918) static final function float ATan2(float X, float Y);

native(1919) static final function float SinH(float X);
native(1920) static final function float CosH(float X);
native(1921) static final function float TanH(float X);
native(1922) static final function float ASinH(float X);
native(1923) static final function float ACosH(float X);
native(1924) static final function float ATanH(float X);

native(1925) static final function float Sinc(float X, optional bool bNormalized);
native(1926) static final function float Tanc(float X);

native(1927) static final function float Sig(float X);
native(1928) static final function float ASig(float X);

// Floating Point Function Generator Implementation
native(1929) static final function FScaleDirect(out float Result, float T, float Min, float Max, float X, bool bIncrease);	// fixed: Build 300
native(1930) static final function float FScale(float Base, float T, float Min, float Max, float X, bool bIncrease);	// fixed: Build 300

native(1931) static final function float FDistFunctionGen(float Base, vector A, vector B, int Factor, optional float Min, optional float Max);
native(1932) static final function float FMathFunctionGen(byte Mode, float T, float Amp, float Freq, float Min, float Max, float Damp, bool bAbs, optional float Base);

native(1933) static final function float FFunctionGen(byte Mode, float T, float Base, float Mod, float Min, float Max, float X, float Y);
native(1934) static final function float FFunctionGenMeshAlpha(byte Mode, float T, float Base, float Mod, float Min, float Max, float X, float Y);


/*-----------------------------------------------------------------------------
	Vector Functions.
-----------------------------------------------------------------------------*/

// Build 100 ------------------------------------------------------------------

native(1935) static final function bool VZero(vector V);
native(1936) static final function bool VApproxZero(vector V);
native(1937) static final function bool VUniform(vector V);
native(1938) static final function bool VApproxUniform(vector V);

native(1939) static final function vector Vect2(float X, float Y, float Z);
native(1940) static final function vector Vect2D(float X, float Y);

native(1941) static final function float VSizeSq(vector V);
native(1942) static final function float VSize2D(vector V);
native(1943) static final function float VSizeSq2D(vector V);

native(1944) static final function vector VMin(vector A, vector B);
native(1945) static final function vector VMax(vector A, vector B);
native(1946) static final function vector VClamp(vector V, vector Max, vector Min);
native(1947) static final function float VClamp2(vector V, float Max, float Min);
native(1948) static final function vector VRandRange(vector Max, vector Min);

native(1949) static final function float DotWOZ(vector A, vector B);
native(1950) static final function bool VOrthogonal(vector A, vector B);
native(1951) static final function bool VCollinear(vector A, vector B);
native(1952) static final function float VAngleCos(vector A, vector B);
native(1953) static final function float VAngle(vector A, vector B);

native(1954) static final function vector VProjectOnTo(vector A, vector B);

native(1955) static final function vector VSpat(vector A, vector B, vector C);
native(1956) static final function vector VDoubleCross(vector A, vector B, vector C);

native(1957) static final function vector VLerp(vector A, vector B, float Alpha);
native(1958) static final function vector VSmerp(vector A, vector B, float Alpha);
native(1959) static final function bool VInterpolate(vector A, vector B, out vector DeltaV, float DeltaT);

native(1960) static final function float GetDistance(vector A, vector B, optional int DFactor);
native(1961) static final function vector GetVDistance(vector A, vector B);

native(1962) static final function bool PointsAreNear(vector A, vector B, float Compare);	// BUild 250: faster now
native(1963) static final function bool IsPointOnLine(vector Point, vector Start, vector End);	// Build 250

/*-----------------------------------------------------------------------------
	Rotator Functions.
-----------------------------------------------------------------------------*/

// Build 100 ------------------------------------------------------------------

static final operator(16) rotator * (rotator A, rotator B)
{
	return rot2(a.pitch * b.pitch,a.yaw * b.yaw,a.roll * b.roll);
}

static final operator(16) rotator / (rotator A, rotator B)
{
	return rot2(a.pitch / b.pitch,a.yaw / b.yaw,a.roll / b.roll);
}

native(1964) static final function bool RZero(rotator R);
native(1965) static final function bool RApproxZero(rotator R);

native(1966) static final function rotator Rot2(int P, int Y,int R);
native(1967) static final function float RSize(rotator R);
native(1968) static final function float RSizeNRoll(rotator r);

native(1969) static final function rotator RMin(rotator A, rotator B);
native(1970) static final function rotator RMax(rotator A, rotator B);
native(1971) static final function rotator RClamp(rotator R, rotator Max, rotator Min);
native(1972) static final function rotator RRange(rotator Max, rotator Min);

native(1973) static final function rotator RLerp(rotator A, rotator B, float Alpha);
native(1974) static final function rotator RSmerp(rotator A, rotator B, float Alpha);
native(1975) static final function bool RInterpolate(rotator A, rotator B, out rotator DeltaR, float DeltaT);

native(1976) static final function int RFunctionGen(byte Mode, float T, float Base, float Mod, float Min, float Max, float X, float Y);


/*-----------------------------------------------------------------------------
	String Functions.
-----------------------------------------------------------------------------*/

// Build 100 ------------------------------------------------------------------

native(1977) static final function string ReplaceBoolValue(bool B, string TrueString, string FalseString);
native(1978) static final function string sDay(int index);


// Build 161 ------------------------------------------------------------------

native(1979) static final function string Repl(coerce string Src, coerce string ToReplace, coerce string With);


/*-----------------------------------------------------------------------------
	General Purpose / Misc Functions.
-----------------------------------------------------------------------------*/

//=============================================================================
// Dynamic Array Support.

// Build 172 ------------------------------------------------------------------

native(1980) static final function int ArrGetLength(ArrayProperty A);
native(1981) static final function ArrClear(ArrayProperty A);

native(1982) static final function bool ArrIdxValid(ArrayProperty A, int Idx);

native(1983) static final function ArrInsertIdx(ArrayProperty A, int Idx, optional int Count);
native(1984) static final function ArrRemoveIdx(ArrayProperty A, int Idx, optional int Count);


//=============================================================================
// Class/Package functions.

// Build 120 ------------------------------------------------------------------

native(1985) static final function string GetClassName(optional Object O);
native(1986) static final function name GetPackageName(optional Object O);


//=============================================================================
// Object functions.

// Build 148 ------------------------------------------------------------------

native(1987) static final function object GetIndexedObj(int Idx, optional Object O);
native(1988) static final function int GetObjIndex(optional Object O);
native(1989) static final function object FindObject(name ObjName, class ObjClass, optional Object O);


//=============================================================================
// Operations System related.

// Build 120 ------------------------------------------------------------------

native(2006) static final function name GetOS(Actor A);
native(2007) static final function bool Win32_64(Actor A);


//=============================================================================
// Render Info Functions.

// Build 161 ------------------------------------------------------------------

native(2008) static final function string GetGraphicsCard(Actor A);
native(2009) static final function string GetGFXCardConcern(Actor A);
native(2010) static final function string GetRender(Actor A);
native(2011) static final function string GetRenderDriver(Actor A);
native(2012) static final function string IsDirectXRender(Actor A);
native(2013) static final function string IsOpenGLRender(Actor A);
native(2014) static final function bool IsGlideRender(Actor A);
native(2015) static final function bool IsSoftwareRender(Actor A);


//=============================================================================
// Advanced Unreal Script Features.

// Build 120 ------------------------------------------------------------------

// Returns the currently executed Function in FName representation
native(2016) static final function name GetFunctionName(optional Object O);

// Returns whether the Function of the name "FunctionName" is currently executed (true) or not (false)
native(2017) static final function bool IsCurrentFunction(name FunctionName, optional Object O);


// Build 148 ------------------------------------------------------------------

// Does Object O (or self) have the Function "FunctionName" ?
native(2018) static final function bool HasFunction(name FunctionName, optional Object O);

// How many parameters does Function "FunctionName" have ?
native(2019) static final function int GetFuncParmCount(name FunctionName, optional Object O);

// Returns the type the function belongs to (final, simulated etc.)
native(2020) static final function name GetFunctionType(name FunctionName, optional Object O);

// Does Object O (or self) have the State "StateName" ?
native(2021) static final function bool HasState(name StateName, optional Object O);

// Returns the type the state belongs to (Auto, Editable etc.)
native(2022) static final function name GetStateType(name FunctionName, optional Object O);

// Returns how many Elements the Enum has
native(2023) static final function int GetEnumCount(name EnumName, optional Object O);


//=============================================================================
// Time-related Functions.

//Build 120: cDay is a reference string (out string) now
native(2024) static final function jThal(int day, int month, int year, out string cDay);
native(2025) static final function jThal2(int day,
				    int month,
				    int year,
				    out string cDay,
				    out string pDay,
				    out string nDay);

native(2026) static final function TimeSwap(float h,
				      out int xSec,
				      out int xMin,
				      out int xH,
				      out int xD);

native(2027) static final function int TimeSwap2(int xSec, int xMin, int xH, int xD);


//=============================================================================
// Quaternion Functions.
// NOTE: uses FPlane struct, but operations in the functions equals Quaternions!

native(2028) static final function plane QuatAdd(plane A, plane B);
native(2029) static final function plane QuatSub(plane A, plane B);
native(2030) static final function plane QuatInv(plane Q);

native(2031) static final function Plane QuatMult(plane A, plane B);
native(2032) static final function Plane QuatMultScalar(plane Q, float F);
native(2033) static final function Plane QuatMultScalarInc(plane Q, float F);

native(2034) static final function float QuatSize(plane Q);
native(2035) static final function float QuatSizeSq(plane Q);

native(2036) static final function plane QuatMakeFromAxis(vector Axis, float Angle);
native(2037) static final function plane QuatNormalize(plane Q);

native(2038) static final function vector QRotateVector(plane Q, vector V);
native(2039) static final function float QuatDot(plane A, plane B);

native(2040) static final function plane RotToQuat(rotator R);
native(2041) static final function rotator QuatToRot(plane Q);

native(2042) static final function AlignQuatWith(out plane A, out plane B);
native(2043) static final function plane QSlerp(plane A, plane B, float Alpha);
native(2044) static final function plane QuatFindBetween(vector A, vector B);

defaultproperties
{
	MusicDirectories(0)="../Music"
	SDKVersion="February 2012 UTSDK Beta (Build 359)"
}