/*=========================================================================
* Dynam.h : Dynam's functions
*
*
*         Dynam MUST BE REPLACE BY THE HEADER FILENAME
*
*
* Version              1.0
* Creation date        01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
 
#if !defined(__Dynam_H__)
#define __Dynam_H__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
#include "GAM/Header.h"
 
#undef EXTERN
#undef extern
#if !defined(D_Dynam_VariableDefine)
#define EXTERN extern
#else
#define EXTERN
#endif /* D_Dynam_VariableDefine */
 
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
 
#include "mec/dnmmecid.h"
 
 
/********************************************************************************/
/**** If we are int Dynam.c file, then, create the structures and variables ****/
/********************************************************************************/
#if defined(D_Dynam_StructureDefine)
 
/* MecEngDesc flags */
#define C_ulMecEngDesc_DEFAULT    0x00000000
#define C_ulMecEngDesc_PATHKNOWN  0x00000001
#define C_ulMecEngDesc_DISTANTOBJ 0x00010000
 
struct tdstDynam_
{
	/* Pointer on the DNM structure*/
	struct DNM_stDynamics *p_stDynamics;
	/*Datas used during the frame*/
	struct DNM_stParsingDatas *p_stParsingDatas;
	/*identifier on the kind of mechanics used*/
	DNM_tdeMechanicsID eUsedMechanics;
};
 
#endif /* D_Dynam_StructureDefine */
 
 
typedef enum eDynamicSize_
{
	eDynamicSizeBase,
	eDynamicSizeAdvanced,
	eDynamicSizeComplex
} eDynamicSize;
 
 
/***********************/
/**** Handle define ****/
/***********************/
typedef struct tdstDynam_ * MS_tdxHandleToDynam;
 
/**** Dynam scripts ****/
#define C_SectionDynamDescription               "Dynam"
 
#define C_EntryDynamType						"DynamicsType"
#define C_szSlideFactorX						"SlideFactorX"
#define C_szSlideFactorY						"SlideFactorY"
#define C_szSlideFactorZ						"SlideFactorZ"
 
#define C_szDynamicSizeBase						"Base"
#define C_szDynamicSizeAdvanced					"Advanced"
#define C_szDynamicSizeComplex					"Complex"
 
/**** Put here all globals variables : ****/
/****    EXTERN typeofvar  variable;   ****/
 
 
/*******************************/
/**** Base functions define ****/
/*******************************/
extern CPA_EXPORT void fn_vUpdateDynamicsMS(struct tdstEngineObject_ *p_stObject);
 
 
#if !defined(U64)
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_eDynamScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
#endif /* U64 */
 
extern CPA_EXPORT unsigned long fn_ulDynamSizeOf();
extern CPA_EXPORT void fn_vDynamAlloc(struct tdstEngineObject_ *p_stObject);
extern CPA_EXPORT MS_tdxHandleToDynam fn_h_DynamRealAlloc();
extern CPA_EXPORT void fn_vDynamFree(struct tdstEngineObject_ *p_stObject);
extern CPA_EXPORT void fn_vDynamInit(struct tdstEngineObject_ *p_stObject,tdeObjectTreeInit eObjectInit);
extern CPA_EXPORT void fn_vDynamDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit);
extern CPA_EXPORT void fn_vDynamCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc);
 
 
extern CPA_EXPORT void fn_v_DynamicAlloc ( MS_tdxHandleToDynam h_Dynam, eDynamicSize eSize, ACP_tdxBool bCollision, ACP_tdxBool bAlways );
extern CPA_EXPORT void fn_v_DynamicFree  ( MS_tdxHandleToDynam h_Dynam );
 
 
/*********************************/
/**** Access functions define ****/
/*********************************/
extern CPA_EXPORT struct DNM_stDynamics *fn_p_stDynamGetDynamics(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT struct DNM_stParsingDatas *fn_p_stDynamGetParsingDatas(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT DNM_tdeMechanicsID fn_eDynamGetUsedMechanics(MS_tdxHandleToDynam h_Dynam);
 
extern CPA_EXPORT ACP_tdxBool fn_b_DynamGetIfCanHangSmthgOn(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT ACP_tdxBool fn_b_DynamGetIfIsAMobile(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT unsigned char fn_uc_DynamGetObjectType(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT unsigned long fn_ulDynamGetMecEngDesc(MS_tdxHandleToDynam h_Dynam);
 
extern CPA_EXPORT void fn_vDynamSetDynamics(MS_tdxHandleToDynam h_Dynam,struct DNM_stDynamics *p_stDynam);
extern CPA_EXPORT void fn_vDynamSetParsingDatas(MS_tdxHandleToDynam h_Dynam,struct DNM_stParsingDatas *p_stParsingDatas);
extern CPA_EXPORT void fn_vDynamSetUsedMechanics(MS_tdxHandleToDynam h_Dynam,DNM_tdeMechanicsID eUsedMechanics);
 
/* Functions linked to the MecEngDesc data */
extern CPA_EXPORT void fn_vDynamSetDefaultMecEngDesc(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT void fn_vDynamSetPathKnown(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT void fn_vDynamSetPathUnknown(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT void fn_vDynamSetDistantObject(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT void fn_vDynamSetNearObject(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT ACP_tdxBool fn_bDynamIsPathKnown(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT ACP_tdxBool fn_bDynamIsObjectDistant(MS_tdxHandleToDynam h_Dynam);
 
/* Function linked to the boolean environment */
extern CPA_EXPORT ACP_tdxBool fn_bDynamTakeCareOfEnvironment(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT void fn_vDynamSetStableEnvironment(MS_tdxHandleToDynam h_Dynam);
extern CPA_EXPORT void fn_vDynamSetDynamicsEnvironment(MS_tdxHandleToDynam h_Dynam);
 
/**********************************/
/**** Special functions define ****/
/**********************************/
extern CPA_EXPORT void fn_vInitDynamicalFunctionPointer(struct tdstDynam_ *p_stDynam);
extern CPA_EXPORT void fn_v_DynamUpdateDNMObjectTypeFromMS(struct tdstDynam_ *p_stDynam);
 
 
#ifdef BIN_SaveBin
extern CPA_EXPORT unsigned long Dynam_fn_ulWriteBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer);
#endif
 
#ifdef BIN_LoadBin
extern CPA_EXPORT void Dynam_fn_vReadBinaryBloc(unsigned long _ulStructAddress);
#endif
 
extern CPA_EXPORT struct DNM_stDynamics* fn_p_stDynamGetDynamicsSO (HIE_tdxHandleToSuperObject hSupObj);
ACP_tdxBool fn_bSetPositionWithoutCollideTest(HIE_tdxHandleToSuperObject p_SuperObjPerso, struct MTH3D_tdstVector_ *p_stVertex); /*vient de AI\AITools.h*/
 
#if defined(__cplusplus)
}
#endif /* __cplusplus */
 
#endif /* __Dynam_H__ */
 
