// **********************************************************************************
// * "l_global_v6.h"																*
// * Written by :	Sébastien Rubens												*
// * Tabulations :	4 char															*
// **********************************************************************************
#ifndef L_GLOBAL_V6_H
#define L_GLOBAL_V6_H

#include "a3x_glob.h"

// **********************************************************************************
//																Enumerates values
enum
{	eNoKey,
	eSimpleKey,
	eDoubleKey
};

enum
{	eStackBinStrings,
	eStackBinVertexes,
	eStackBinQuaternions,
	eStackBinA3dGENERAL,
	eStackBinChannels,
	eStackBinFrames,
	eStackBinOnlyFrames,
	eStackBinHierarchies,
	eStackBinChannelNames,

	eStackSavedVertexes,
	eStackSavedQuaternions,
	eStackSavedNTTO,

	eStackFileA3dAnimationGENERAL,
	eStackFileVertexes,
	eStackFileQuaternions,
	eStackFileHierarchy,
	eStackFileNTTO,
	eStackFileOnlyFrame,
	eStackFileKeyFrame,
	eStackFileFrame,
	eStackFileChannel,
	eStackFileEvent,
	eStackBinMorphInformation,

	eStackBinSndEventIdList,
	eStackBinEvent,

	eStackBinNbMax
};



// **********************************************************************************
//                                                               Constant definitions
#define	MaxInFileA3dAnimationGENERALTab	 2000
#define	MaxInFileVertexesTab			30000
#define	MaxInFileQuaternionsTab			30000
#define	MaxInFileHierarchyTab			 1000
#define	MaxInFileNTTOTab				10000
#define	MaxInFileEventTab				 2000
#define	MaxInFileOnlyFrameTab			 2000
#define	MaxInFileChannelTab				 1000
#define	MaxInFileFrameTab				20000
#define	MaxInFileKeyFrameTab			15000
#define	MaxInSndEventIdTab				10000
#define	MaxInEventTab					 8000
#define	MaxInFileEventTab				 2000
#define MaxInFileMorphTab				20000

#define	NombreDanimationsParDirectory	 1000

// **********************************************************************************
//																Macros definitions

#define D_BINSCR_LogOld 0
#define D_BINSCR_LogNew 1

#define	M_GetStackAlloc( NumStack )	(tdstStacks[(NumStack)].slPosAlloc)
#define	M_GetStackPos( NumStack )	(tdstStacks[(NumStack)].slStackPos)

#define	ReadUChar( Num )	( (unsigned char)	atoi(_ap_SzParam[(Num)]) )
#define	ReadSChar( Num )	( (signed char)		atoi(_ap_SzParam[(Num)]) )
#define	ReadUShort( Num )	( (unsigned short)	atoi(_ap_SzParam[(Num)]) )
#define	ReadSShort( Num )	( (signed short)	atoi(_ap_SzParam[(Num)]) )
#define	ReadULong( Num )	( (unsigned long)	atol(_ap_SzParam[(Num)]) )
#define	ReadSLong( Num )	( (signed long)		atol(_ap_SzParam[(Num)]) )
#define	ReadFloat( Num )	( (float)			atof(_ap_SzParam[(Num)]) )
#define	ReadDouble( Num )	( (double)			atof(_ap_SzParam[(Num)]) )
#define	ReadSebReal( Num )	( (SEB_xReal)		atof(_ap_SzParam[(Num)]) )


// **********************************************************************************
//																Types definitions

typedef struct tdstBinStackInfos_
{
	signed long	slPosAlloc;
	signed long	slStackPos;
	signed long	slAllocNeeded;
	signed long	slMaxPos;
}	tdstBinStackInfos;



typedef struct tdstSndEventId_
{
	char			sName[200];
	unsigned long	ulVal1;
	unsigned long	ulVal2;
}	tdstSndEventId;



// **********************************************************************************
//															Extern datas definitions
extern	tdstBinStackInfos			tdstStacks				[];
extern	tdFileName					ax_xStrings				[];
extern	tdxVector3					axa3_xVertexes			[];
extern	tdxQuater4					axa4_xBinQuaternions	[];
extern	tdstBinA3dAnimationGENERAL	ax_tdstA3dGENERAL		[];
extern	tdstBinChannel				ax_tdstChannels			[];
extern	tdstBinFrame				ax_tdstFrames			[];
extern	tdstBinOnlyFrame			ax_tdstOnlyFrames		[];
extern	tdstBinHierarchy			ax_tdstHierarchies		[];
extern	tdFileName					ax_xChannelNames		[];
extern	tdstSndEventId				ax_tdstSndEventId		[];
extern	tdstBinEvent				ax_tdstEvents			[];
extern	tdstBinMorphData			ax_tdstBinMorphInfos	[];

extern	tdxVector3					ax_tdxSavedVertexes		[];
extern	tdxQuater4					ax_tdxSavedQuaternions	[];
extern	tdstNTTO					ax_tdstSavedNTTO		[];

extern	tdstFileA3dAnimationGENERAL	ax_tdstFileA3dGENERAL	[];
extern	tdxULongVector3				ax_tdxFileVertexes		[];
extern	tdxSShortQuater4			ax_tdxFileQuaternions	[];
extern	tdstFileHierarchy			ax_tdstFileHierarchy	[];
extern	tdstNTTO					ax_tdstFileNTTO			[];
extern	tdstFileOnlyFrame			ax_tdstFileOnlyFrame	[];
extern	tdstFileKeyFrame			ax_tdstFileKeyFrame		[];
extern	tdstFileFrame				ax_tdstFileFrame		[];
extern	tdstFileChannel				ax_tdstFileChannel		[];
extern	tdstFileEvent				ax_tdstFileEvent		[];
extern	tdstFileMorphData			ax_tdstFileMorphInfos	[]; //AR980305

extern	unsigned short	uwOkAnimationFile;					// Flag

extern	tdxVector3	a3_xVector0;
extern	tdxVector3	a3_xVector1;
extern	tdxQuater4	a4_xQuater0;
extern	FILE		*ErrorFile, *WarningFile, *SizeOut, *EventFile;



#ifndef L_GLOBAL_V6_C
// **********************************************************************************
//														Extern fonctions definitions
extern	void	fn_v_AllocateOnStack(	unsigned short	uwNumStack,
										signed long		slWantedSize );
extern	void	fn_v_DeAllocateOnStack(	unsigned short	uwNumStack,
										signed long		slSize );
extern	void	fn_v_ResetStacks( void );

extern	void	fn_vCheckStacks( void );

extern	void	fn_v_LogSectionBegin(	int		_bFlagNew,
										char	*_szType,
										char	*_szString );
extern	void	fn_v_LogSectionEnd( void );

extern	void	fn_v_InitMemV6i( void );
extern	void	fn_v_KillMem( void );



// **********************************************************************************
#endif

#endif