/*=========================================================================
* MBASE.h : MecBaseIdCard's functions
*
* Version              1.0
* Creation date        14/10/97
* Revision date
*
* (c) Ubi Studios 1997
*=======================================================================*/
 
#if !defined(__MecBaseIdCard_TYPES__)
#define __MecBaseIdCard_TYPES__
 
#include <string.h>
#include "DNMMecId.h"
#include "acp_base.h"
 
#include "hidcard.h"
 
#if !defined(ONLY_TYPES)
#define ONLY_TYPES
#define _MecBaseIdCard_UNDEF
#endif /* ONLY_TYPES */
 
#if defined(_MecBaseIdCard_UNDEF)
#undef _MecBaseIdCard_UNDEF
#undef ONLY_TYPES
#endif /* MecBaseIdCard_UNDEF */
 
#ifdef __cplusplus
extern "C" {
#endif
 
/***************************************/
#if !defined(CPA_EXPORT)
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif /* CPA_WANTS_IMPORT || CPA_WANTS_EXPORT */
#endif /* CPA_EXPORT */
 
/***************************************/
 
/* Bit Field */
#define DNM_Card_C_Animation			0x00000001		/* animation speed ? */
#define DNM_Card_C_Collide				0x00000002		/* collide with the map ? */
#define DNM_Card_C_Gravity				0x00000004		/* gravity on ? */
#define DNM_Card_C_Tilt					0x00000008		/* tilt in turn */
#define DNM_Card_C_Gi					0x00000010		/* gi */
#define DNM_Card_C_OnGround				0x00000020		/* put on ground */
#define DNM_Card_C_Climb				0x00000040		/* climb */
#define DNM_Card_C_Spider				0x00000080		/* Spider  */
#define DNM_Card_C_Shoot				0x00000100		/* Shoot  */
#define DNM_Card_C_CollisionControl		0x00000200		/* use dynamics parameters when collide */
#define DNM_Card_C_KeepWallSpeedZ		0x00000400		/* keep z speed when collide a wall */
#define DNM_Card_C_SpeedLimit			0x00000800		/* limit speed ? */
#define DNM_Card_C_Inertia				0x00001000		/* inertia ? */
#define DNM_Card_C_Stream				0x00002000		/* stream ? */
#define DNM_Card_C_StickOnPlatform		0x00004000		/* stick on platform ? */
#define DNM_Card_C_Scale				0x00008000		/* use scale ? */
#define DNM_Card_C_PlatForm				0x00010000		/* Platform ? */
#define DNM_Card_C_Swim					0x00020000		/* Swim ? */
 
 
 
typedef struct DNM_stMecBaseIdCard
{
	/* Identity */
	DNM_tdeMechanicsID	m_eIdentity;	
	unsigned long		ulFlags;		/* Bit field */
 
	MTH_tdxReal m_xGravity;				/* gravity factor */
	MTH_tdxReal m_xSlide;				/* slide parameter for collision control */
	MTH_tdxReal m_xRebound;				/* rebound parameter for collision control */
	MTH_tdxReal m_xSlopeLimit;			/* slope limit */
	MTH_tdxReal m_xInertiaX;			/* x inertia */
	MTH_tdxReal m_xInertiaY;			/* y inertia */
	MTH_tdxReal m_xInertiaZ;			/* z inertia */
	MTH_tdxReal m_xTiltIntensity;		/* tilt intensity */
	MTH_tdxReal m_xTiltInertia;			/* tilt inertia   ( 0-1 ) */
	MTH_tdxReal m_xTiltOrigin;			/* tilt rotation origin on Z axis */
	MTH3D_tdstVector m_stMaxSpeed;		/* max speed limit */
} DNM_tdstMecBaseIdCard;
 
 
/* Put here all macro-accessors */
#define DNM_M_eBaseIdCardGetIdentity(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_eIdentity)
#define DNM_M_bBaseIdCardIsAnimation(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Animation ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsPlatform(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Platform ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsCollide(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Collide ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsGravity(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Gravity ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsTilt(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Tilt ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsGi(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Gi ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsOnGround(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_OnGround ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsClimb(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Climb ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsSpider(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Spider ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsShoot(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Shoot ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsCollisionControl(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_CollisionControl ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsKeepWallSpeedZ(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_KeepWallSpeedZ ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsSpeedLimit(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_SpeedLimit ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsInertia(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Inertia ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsStream(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Stream ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsStickOnPlatform(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_StickOnPlatform ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsScale(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Scale ? TRUE : FALSE)
#define DNM_M_bBaseIdCardIsSwim(_p_stBaseIdCard) ((_p_stBaseIdCard)->ulFlags & DNM_Card_C_Swim ? TRUE : FALSE)
 
#define DNM_M_xBaseIdCardGetGravityFactor(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xGravity)
#define DNM_M_xBaseIdCardGetSlide(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xSlide)
#define DNM_M_xBaseIdCardGetRebound(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xRebound)
#define DNM_M_xBaseIdCardGetSlopeLimit(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xSlopeLimit)
#define DNM_M_xBaseIdCardGetInertiaFactorX(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xInertiaX)
#define DNM_M_xBaseIdCardGetInertiaFactorY(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xInertiaY)
#define DNM_M_xBaseIdCardGetInertiaFactorZ(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xInertiaZ)
#define DNM_M_xBaseIdCardGetTiltIntensity(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xTiltIntensity)
#define DNM_M_xBaseIdCardGetTiltInertia(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xTiltInertia)
#define DNM_M_xBaseIdCardGetTiltOrigin(_p_stBaseIdCard) ((_p_stBaseIdCard)->m_xTiltOrigin)
#define DNM_M_pBaseIdCardGetMaxSpeed(_p_stBaseIdCard) (&(_p_stBaseIdCard)->m_stMaxSpeed)
 
 
#define DNM_M_vBaseIdCardSetAnimation(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Animation) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Animation)))
#define DNM_M_vBaseIdCardSetPlatform(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Platform) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Platform)))
#define DNM_M_vBaseIdCardSetCollide(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Collide) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Collide)))
#define DNM_M_vBaseIdCardSetGravity(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Gravity) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Gravity)))
#define DNM_M_vBaseIdCardSetTilt(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Tilt) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Tilt)))
#define DNM_M_vBaseIdCardSetGi(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Gi) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Gi)))
#define DNM_M_vBaseIdCardSetOnGround(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_OnGround) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_OnGround)))
#define DNM_M_vBaseIdCardSetClimb(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Climb) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Climb)))
#define DNM_M_vBaseIdCardSetSpider(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Spider) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Spider)))
#define DNM_M_vBaseIdCardSetShoot(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Shoot) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Shoot)))
#define DNM_M_vBaseIdCardSetCollisionControl(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_CollisionControl) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_CollisionControl)))
#define DNM_M_vBaseIdCardSetKeepWallSpeedZ(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_KeepWallSpeedZ) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_KeepWallSpeedZ)))
#define DNM_M_vBaseIdCardSetSpeedLimit(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_SpeedLimit) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_SpeedLimit)))
#define DNM_M_vBaseIdCardSetInertia(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Inertia) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Inertia)))
#define DNM_M_vBaseIdCardSetStream(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Stream) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Stream)))
#define DNM_M_vBaseIdCardSetStickOnPlatform(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_StickOnPlatform) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_StickOnPlatform)))
#define DNM_M_vBaseIdCardSetScale(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Scale) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Scale)))
#define DNM_M_vBaseIdCardSetSwim(_p_stBaseIdCard,_bValue) ((_p_stBaseIdCard)->ulFlags = ((_bValue) ? ((_p_stBaseIdCard)->ulFlags |= DNM_Card_C_Swim) : ((_p_stBaseIdCard)->ulFlags &= ~DNM_Card_C_Swim)))
 
 
#define DNM_M_vBaseIdCardSetGravityFactor(_p_stBaseIdCard,xGravity) ((_p_stBaseIdCard)->m_xGravity = xGravity)
#define DNM_M_vBaseIdCardSetSlide(_p_stBaseIdCard,xSlide) ((_p_stBaseIdCard)->m_xSlide = xSlide)
#define DNM_M_vBaseIdCardSetRebound(_p_stBaseIdCard,xRebound) ((_p_stBaseIdCard)->m_xRebound = xRebound)
#define DNM_M_vBaseIdCardSetSlopeLimit(_p_stBaseIdCard,xSlopeLimit) ((_p_stBaseIdCard)->m_xSlopeLimit = xSlopeLimit)
#define DNM_M_vBaseIdCardSetInertiaFactorX(_p_stBaseIdCard,xInertiaX) ((_p_stBaseIdCard)->m_xInertiaX = xInertiaX)
#define DNM_M_vBaseIdCardSetInertiaFactorY(_p_stBaseIdCard,xInertiaY) ((_p_stBaseIdCard)->m_xInertiaY = xInertiaY)
#define DNM_M_vBaseIdCardSetInertiaFactorZ(_p_stBaseIdCard,xInertiaZ) ((_p_stBaseIdCard)->m_xInertiaZ = xInertiaZ)
#define DNM_M_vBaseIdCardSetTiltIntensity(_p_stBaseIdCard,xTiltIntensity) ((_p_stBaseIdCard)->m_xTiltIntensity = xTiltIntensity)
#define DNM_M_vBaseIdCardSetTiltInertia(_p_stBaseIdCard,xTiltInertia) ((_p_stBaseIdCard)->m_xTiltInertia = xTiltInertia)
#define DNM_M_vBaseIdCardSetTiltOrigin(_p_stBaseIdCard,xTiltOrigin) ((_p_stBaseIdCard)->m_xTiltOrigin = xTiltOrigin)
#define DNM_M_vBaseIdCardSetMaxSpeed(_p_stBaseIdCard,pstSpeedLimit) MTH3D_M_vCopyVector ( DNM_M_pBaseIdCardGetMaxSpeed(_p_stBaseIdCard), pstSpeedLimit )
 
 
/* Private */
#define DNM_M_eBaseIdCardSetIdentity(_p_stBaseIdCard,_eValue) (DNM_M_eBaseIdCardGetIdentity(_p_stBaseIdCard) = _eValue)
 
/* Give handle a semantic */
DNM_tdstMecBaseIdCard *DNM_fn_p_stMecBaseIdCardGiveBackSemantic(DNM_tdxHandleToMecIdentityCard _hBaseIdCard);
 
#ifdef __cplusplus
}
#endif
 
#endif /* !__MecBaseIdCard_TYPES__ */
