//=============================================================================
// Unreal Tournament SDK //
//-------------------------
// sdkCore //
//-----------
// Unreal Tournament SDK (c) Copyright 2007-2011 Stephan "Shadow" Nagel, 
// Under Artistic License 2.0
//
// UnSDKGlobal.h
//
// Header by: Shadow
//
// Description:
// Global Interface Header for the UnSDKCoreSrc.cpp Functions
//=============================================================================

/*-----------------------------------------------------------------------------
	C++-UScript-Wrapper Functions.
-----------------------------------------------------------------------------*/

AActor* Trace(AActor* Tracing,
		     FVector& HitLocation,
		     FVector& HitNormal,
		     FVector TraceEnd,
		     FVector TraceStart,
		     UBOOL bTraceActors);

AActor* TraceAndExt(AActor* Tracing,
		     	   FVector& HitLocation,
		     	   FVector& HitNormal,
		           FVector TraceEnd,
		     	   FVector TraceStart,
		     	   UBOOL bTraceActors,
		     	   FVector Extent);

inline DWORD StyleToPolyFlags(BYTE Style)
{
	DWORD PolyFlags = PF_TwoSided;

	switch(Style)
	{
	case 0: PolyFlags = PF_TwoSided; break;
	case 1: PolyFlags = PF_TwoSided; break;
	case 2: PolyFlags = PF_Masked; break;
	case 3: PolyFlags = PF_Translucent; break;
	case 4: PolyFlags = PF_Modulated; break;
	};

	return PolyFlags;
}

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

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

FString GetClassName(UObject* O);
FName GetPackageName(UObject* O);


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

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

UObject* GetIndexedObj(UObject* O, INT idx);
INT GetObjIndex(UObject* O);
UObject* FindObject(UObject* O, FName ObjName, class UClass* ObjClass);

inline FString ConsoleCommand(AActor* A, FString Command, UBOOL bLog)
{
	if (bLog)
	{
		A->XLevel->Engine->Exec(*Command, *GLog);
		return FString(TEXT(""));
	}
	else
	{
		FStringOutputDevice StrOut;
		A->XLevel->Engine->Exec(*Command, StrOut);

		return *StrOut;
	}

}

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

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

FName GetOS(AActor* A);
UBOOL Win32_64(AActor* A);


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

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

FName GetFunctionName(FFrame &Stack, UObject* O);
UBOOL IsCurrentFunction(FFrame &Stack, UObject* O, FName FunctionName);


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

UBOOL HasFunction(UObject* O, FName FunctionName);
INT GetFuncParmCount(UObject* O, FName FunctionName);
FName GetFunctionType(UObject* O, FName FunctionName);
UBOOL HasState(FName StateName, UObject* O);
FName GetStateType(FName StateName, UObject* O);
INT GetEnumCount(UObject* O, FName EnumName);

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

UBOOL IsInState(UObject* O, FName StateName);

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

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

#include "UnSDKTime.h"


//=============================================================================
// Render / Render Driver Related Functions.

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

FString GetGraphicsCard(AActor* A);
FString GetGFXCardConcern(AActor* A);
FString GetRenderDriver(AActor* A);
FString GetRender(AActor* A);
FString IsDirectXRender(AActor* A);
FString IsOpenGLRender(AActor* A);
UBOOL IsGlideRender(AActor* A);
UBOOL IsSoftwareRender(AActor* A);

