#ifndef D_THROW_COMPLEX_SPRITE
#include "cpa_std.h"
 
#include "acp_base.h"
 
#include "mth.h"
#include "GEO.h"
#include "gmt.h"
#include "mec.h"
 
 
/**********************************************************************************************/
/* Name: GEO_xCreateSprite */
/* Goal: create a sprite =:-)*/
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void 
GEO_vCreateRotativSprite ( ACP_tdxHandleOfSprite *p_hSprite , ACP_tdxIndex xNbAngles)
{
	long liCount;
 
   MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeRotativeSprite , 0 );
 
   GEO_M_CPAMalloc (
        *p_hSprite ,
        GEO_tdstSprite * ,
	    sizeof ( GEO_tdstSprite ) ,
		E_uwGEONotEnoughtMemory );
 
   GEO_M_CPAMalloc (
        (*p_hSprite) -> d_xThresholds ,
        MTH_tdxReal  * ,
	    sizeof ( MTH_tdxReal ) * xNbAngles ,
		E_uwGEONotEnoughtMemory );
 
   GEO_M_CPAMalloc (
        (*p_hSprite) -> d_xSpriteDrawMode ,
        short * ,
	    sizeof ( short ) * xNbAngles,
		E_uwGEONotEnoughtMemory );
 
   GEO_M_CPAMalloc (
        (*p_hSprite) -> d_hMaterial ,
        /*ACP_tdxHandleOfMaterial*/ GMT_tdxHandleToGameMaterial * ,
	    sizeof ( /*ACP_tdxHandleOfMaterial*/ GMT_tdxHandleToGameMaterial ) * xNbAngles,
		E_uwGEONotEnoughtMemory );
 
   GEO_M_CPAMalloc (
        (*p_hSprite) -> d_xSizeOfSprite ,
        MTH2D_tdstVector  *,
	    sizeof ( MTH2D_tdstVector ) * xNbAngles ,
		E_uwGEONotEnoughtMemory );
 
   GEO_M_CPAMalloc (
        (*p_hSprite) -> d_xDisplacementOfSprite ,
        MTH2D_tdstVector  * ,
	    sizeof ( MTH2D_tdstVector ) * xNbAngles ,
		E_uwGEONotEnoughtMemory );
 
    MMG_fn_vEndMemoryInfo();
 
  	for (liCount = 0; liCount < xNbAngles ; liCount ++)
	{
		(*p_hSprite) -> d_hMaterial [liCount] = NULL;
		(*p_hSprite) -> d_xSpriteDrawMode [liCount] =
 	    GEO_C_lSpriteDrawMode2DRotativ ;
	    (*p_hSprite) -> d_xSizeOfSprite [liCount] . xX = 1.00f;
	    (*p_hSprite) -> d_xSizeOfSprite [liCount] . xY = 1.00f;
	    (*p_hSprite) -> d_xDisplacementOfSprite [liCount] . xX = 0.0f;
	    (*p_hSprite) -> d_xDisplacementOfSprite [liCount] . xY = 0.0f;
	}
 
	(*p_hSprite) -> xNbSprites = xNbAngles ;
 
}
 
/**********************************************************************************************/
/* Name: GEO_xSetMaterialOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/* Modif:Alain Robin : Use game material*/
/**********************************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void 
GEO_vSetMaterialOfSprite ( ACP_tdxHandleOfSprite hSprite , 
						   ACP_tdxHandleOfMaterial hMaterial ,
						   ACP_tdxIndex xSpriteNumber)
{
	GMT_fn_vSetVisualMaterial(hSprite -> d_hMaterial [ xSpriteNumber ],hMaterial);
}
/**********************************************************************************************/
/* Name: GEO_xGetMaterialOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/* Modif:A.R. : Use GMT*/
/**********************************************************************************************/
void 
GEO_vGetMaterialOfSprite ( ACP_tdxHandleOfSprite hSprite , 
						   ACP_tdxHandleOfMaterial *p_hMaterial ,
						   ACP_tdxIndex xSpriteNumber)
{
	*p_hMaterial  = GMT_fn_hGetVisualMaterial(hSprite -> d_hMaterial [ xSpriteNumber ]) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
/**********************************************************************************************/
/* Name: GEO_xSetGameMaterialOfSprite */
/* Goal: */
/* Code: A.R. / 1.0*/
/**********************************************************************************************/
void 
GEO_vSetGameMaterialOfSprite ( ACP_tdxHandleOfSprite hSprite , 
						   GMT_tdxHandleToGameMaterial hMaterial ,
						   ACP_tdxIndex xSpriteNumber)
{
	hSprite -> d_hMaterial [ xSpriteNumber ] = hMaterial ; 
}
/**********************************************************************************************/
/* Name: GEO_xGetGameMaterialOfSprite */
/* Goal: */
/* Code: A.R. / 1.0*/
/**********************************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void 
GEO_vGetGameMaterialOfSprite ( ACP_tdxHandleOfSprite hSprite , 
						   GMT_tdxHandleToGameMaterial *p_hMaterial ,
						   ACP_tdxIndex xSpriteNumber)
{
	*p_hMaterial  = hSprite -> d_hMaterial [ xSpriteNumber ] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
/**********************************************************************************************/
/* Name: GEO_xSetThresholdOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void 
GEO_vSetThresholdOfSprite ( ACP_tdxHandleOfSprite hSprite , 
						     MTH_tdxReal xThresholds,
						   ACP_tdxIndex xSpriteNumber)
{
	hSprite -> d_xThresholds [ xSpriteNumber ] = xThresholds;
}
/**********************************************************************************************/
/* Name: GEO_xGetThresholdOfSprite*/
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void 
GEO_vGetThresholdOfSprite ( ACP_tdxHandleOfSprite hSprite ,
						    MTH_tdxReal *p_xThresholds,
						   ACP_tdxIndex xSpriteNumber)
{
	*p_xThresholds = hSprite -> d_xThresholds [ xSpriteNumber ] ;
}
/**********************************************************************************************/
/* Name: GEO_xGetModeOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void 
GEO_vGetModeOfSprite ( ACP_tdxHandleOfSprite hSprite , 
					   short *p_sMode,
					   ACP_tdxIndex xSpriteNumber)
{
	*p_sMode  = hSprite -> d_xSpriteDrawMode [ xSpriteNumber ] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
/**********************************************************************************************/
/* Name: GEO_xSetModeOfSprite */
/* Goal: See "ACP_sprites.doc"*/
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void 
GEO_vSetModeOfSprite ( ACP_tdxHandleOfSprite hSprite , 
					   short sMode,
					   ACP_tdxIndex xSpriteNumber)
{
	hSprite -> d_xSpriteDrawMode [ xSpriteNumber ] = sMode  ;
}
/**********************************************************************************************/
/* Name: GEO_xGetModeOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void 
GEO_vGetSizeOfSprite ( ACP_tdxHandleOfSprite hSprite , 
					   MTH2D_tdstVector *p_stSize,
					   ACP_tdxIndex xSpriteNumber)
{
	*p_stSize = hSprite -> d_xSizeOfSprite[ xSpriteNumber ] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
/**********************************************************************************************/
/* Name: GEO_xSetModeOfSprite */
/* Goal: See "ACP_sprites.doc"*/
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void 
GEO_vSetSizeOfSprite ( ACP_tdxHandleOfSprite hSprite , 
					   MTH2D_tdstVector *p_stSize,
					   ACP_tdxIndex xSpriteNumber)
{
	hSprite -> d_xSizeOfSprite[ xSpriteNumber ] = *p_stSize;
}
/**********************************************************************************************/
/* Name: GEO_xGetDisplacementOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
 
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void 
GEO_vGetDisplacementOfSprite ( ACP_tdxHandleOfSprite hSprite , 
					   MTH2D_tdstVector *p_stDis,
					   ACP_tdxIndex xSpriteNumber)
{
	*p_stDis = hSprite -> d_xDisplacementOfSprite [ xSpriteNumber ] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
 
 
/**********************************************************************************************/
/* Name: GEO_xGetDisplacementOfSprite */
/* Goal: See "ACP_sprites.doc"*/
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void 
GEO_vSetDisplacementOfSprite ( ACP_tdxHandleOfSprite hSprite , 
					   MTH2D_tdstVector *p_stDis,
					   ACP_tdxIndex xSpriteNumber)
{
	hSprite -> d_xDisplacementOfSprite [ xSpriteNumber ] = *p_stDis;
}
 
#endif /* D_THROW_COMPLEX_SPRITE */
