#ifdef _MSC_VER
// Engine compatibility
#define c_import
typedef CObject Object;
typedef Fvector	Vector;
#define XREXPORT	static void export();
#define XRCALL		__cdecl
#else

// Script-side pure C compatibility
typedef void Object;
struct Vector {
	float x,y,z;
};
#define XREXPORT	
#define XRCALL
#endif

// Eye mode
typedef int EYE_mode;
#define	EYE_LookAround		0
#define EYE_LookForward		1
#define EYE_LookTarget		2

// Target class
typedef int TCLASS;
#define TCLASS_Primary		0
#define	TCLASS_Secondary	1
#define TCLASS_Optional		2

// Navigation mode
typedef int NAVI_mode;

#define NAVI_Stay			0
#define NAVI_TargetObject	1
#define NAVI_TargetPoint	2

// Visible objects
struct IQ_Visible 
{
	// detected
	Object*		nearestVisible;
	float		nearestVisible_DIST;
	Object*		nearestReachable;
	float		nearestReachable_DIST;

	// Customization
#ifdef _MSC_VER
	CLASS_ID	CLS_ID;
#else
	char		CLS_ID[8];
#endif
};

struct IQ_Timer 
{
	float		fTimeRemain;	// time to 'signal'
	char*		cProcedure;		// if NULL - timer inactive
};

// Main interface (note <*> means 'controlled' )
struct IQ_Brain 
{
	Object*		Parent;

	int			EyeMode;		// <*> look around, look forward, look target
	float		EyeHeight;		// <*> difference between vPosition and position of eye
	float		EyeFOV;			// <*> field-of-view
	float		EyeRange;		// <*> smaller - better performance
	float		EyeLookSpeed;	// <*> speed of look around

	Object*		Target;			// <*> selected target or NULL (default)
	Vector		TargetPoint;	// <*> for directed movements
	int			TargetGroup;	// group of target
	float		TargetCost;		// distance to target (only if target valid)

	int			NaviMode;		// <*> Navigation mode
	float		NaviPrediction;	// <*> 0..1  - coeff. of prediction of target movement
	float		NaviSpeed;		// <*> speed of movement
	float		NaviJumpPower;
	Vector		NaviDir;		// <*> direction of model. Only in NAVI_STAY mode

	float		AuralPerception;// <*> 0..1  - coeff. of aural perception

	// Subclasses
	IQ_Timer	Timers	[6];
	IQ_Visible	Visible	[4];	// 4 groups max (primary,secondary,optional)
};

c_import	void XRCALL iqVisible_set_clsid	(IQ_Visible *P, char* name);
c_import	void XRCALL	iqTimer_init_rand	(IQ_Timer *P, char* name, float min, float max);
c_import	void XRCALL	iqTimer_init_fixed	(IQ_Timer *P, char* name, float value);
c_import	void XRCALL	iqBrain_navi_jump	(IQ_Brain *P);
