/* ***********************************************************************************/
/* * "a3x_mem.h"																	**/
/* * Written by :	Sébastien Rubens												**/
/* * Tabulations :	4 char															**/
/* ***********************************************************************************/
#ifndef A3X_MEM_H
#define A3X_MEM_H
 
#include "a3x_glob.h"
 
/* ***********************************************************************************/
/*																			Defines*/
 
enum
{	eStackA3dGENERAL,
	eStackVertexes,
	eStackQuaternions,
	eStackHierarchies,
	eStackNTTO,
	eStackOnlyFrames,
	eStackChannels,
	eStackFrames,
	eStackFramesKF,
	eStackKeyFrames,
	eStackEvents,
	eStackMorphData,
	/* the following stack are not affected by fn_v_UnclearPreviousLoadedAnims*/
	/*eStackFrame3d,	*/
	/*eStackElement3d,*/
	eStackNbMax
};
 
 
 
/* ***********************************************************************************/
/*																		Defines*/
#define	M_v_ResetOneStack( uwNumStack )												\
	tdstStacks[ (uwNumStack) ].ulPosAlloc=											\
		tdstStacks[ (uwNumStack) ].ulStackPos=										\
		tdstStacks[ (uwNumStack) ].ulResetPos
 
 
 
/* ***********************************************************************************/
/*																		Externs*/
 
extern	tdstStackInfos				tdstStacks[];
/*extern	tdstAnimLights				stAnimLights;*/
 
extern	tdstA3dGENERAL				*p_stA3dGENERAL;
extern	tdxVector3					*p_a3_xVectors;
extern	tdxSShortQuater4			*p_a4_xQuaternions;
extern	tdstHierarchy				*p_stHierarchies;
extern	tdstNTTO					*p_stNTTO;
extern	tdstOnlyFrame				*p_stOnlyFrames;
extern	tdstChannel					*p_stChannels;
extern	tdstFrame					*p_stFrames;
extern	tdstFrameKF					*p_stFramesKF;
extern	tdstKeyFrame				*p_stKeyFrames;
extern	tdstEvent					*p_stEvents;
extern	tdstMorphData				*p_stMorphData; /*AR9803*/
 
/*extern	tdstFrame3d					*p_stFrame3d;*/
/*extern	tdstElement3d				**p_p_stElement3d;*/
extern	MTH3D_tdstMatrix			*p_stAngularSpeedMatrix;
extern	tdstPLA_Hierarchy			*p_stHierarchy;
extern	tdstElement3d				*p_stElement3d;
extern	POS_tdstCompletePosition	*p_stPosMatrix;
 
#ifdef U64
extern	tdstCuttedAnim				*p_stCuttedAnim;
#endif
 
 
#ifndef A3X_MEM_C
/* ***********************************************************************************/
extern	unsigned long	fn_ul_GetStackAlloc(	unsigned short	_uwNumStack );
extern	unsigned long	fn_ul_GetStackPos(		unsigned short	_uwNumStack );
extern	void			fn_v_AllocateOnStack(	unsigned short	uwNumStack,
												unsigned short	uwWantedSize );
extern	unsigned long	fn_ul_AllocateOnStack(	unsigned short	_uwNumStack,
												unsigned short	_uwWantedSize );
extern	void			fn_v_DeAllocateOnStack(	unsigned short	_uwNumStack,
												unsigned short	_uwSize );
 
/* ************************************************** fn_v_UnclearPreviousLoadedAnims*/
/*	Allow to keep the N First Anims when clear*/
/*	Must be call after loading the N anims*/
/*	03/07/98 Carlos Torres*/
/* ***********************************************************************************/
extern void fn_v_UnclearPreviousLoadedAnims( void );
 
/* ************************************************************ fn_v_ClearLoadedAnims*/
/*	Clear Loaded Anims depending on parameter ucClearAll*/
/*		False : Until the position set by fn_v_UnclearPreviousLoadedAnims*/
/*		True : ALL anims*/
/*	03/07/98 Carlos Torres*/
/* ***********************************************************************************/
extern void fn_v_ClearLoadedAnims(unsigned char ucClearAll);
 
/* **************************************************************** fn_v_InitInterpol*/
/*	Make allocation and init structure for anim management*/
/*	Must be called only once*/
/*	03/07/98 Carlos Torres*/
/* ***********************************************************************************/
extern void fn_v_InitInterpol( void );
 
/* **************************************************************** fn_vSetStackSize*/
/*	Set the stack size */
/*	Must be called only once for all stack to configure it*/
/**/
/*	27/10/98 Carlos Torres*/
/* ***********************************************************************************/
extern void fn_vSetStackSize(unsigned short uwNumStack,unsigned long ulSize);
 
#ifndef RETAIL
/* ***************************************************************** fn_vAnimStackLog*/
/*	Make a log of Memory used for each stack in an open file*/
/**/
/*	11/12/98 Carlos Torres*/
/* ***********************************************************************************/
extern void fn_vAnimStackLog(FILE * fLogFile);
#endif /* RETAIL */
 
/* ***********************************************************************************/
#endif
 
#endif
