/* Module Allowing the Communication of Datas from the Player or the Intelligence to the Dynamics */
 
#ifndef __MACDPID_H__
#define __MACDPID_H__
 
#include "acp_base.h"
#include "mth.h"
 
#ifdef __cplusplus
extern "C" {
#endif
 
/* Define the structure stMACDPID */
typedef struct stMACDPID
{
	MTH_tdxReal			m_xData0;
	MTH3D_tdstVector	m_stData1;
	MTH3D_tdstVector	m_stData2;
	MTH3D_tdstVector	m_stData3;
	MTH_tdxReal			m_xData3;
	MTH_tdxReal			m_xData4;
	MTH_tdxReal			m_xData5;
	struct 
	{
		MTH_tdxReal			m_xAngle;
		MTH3D_tdstVector	m_stAxis;
	} m_stData6;
	struct 
	{
		MTH_tdxReal			m_xAngle;
		MTH3D_tdstVector	m_stAxis;
	} m_stData7;
	char				m_cData8;
	unsigned short		m_uwData9;		  
	MTH3D_tdstVector	m_stData10;
	MTH_tdxReal			m_xData11;
	MTH3D_tdstVector	m_stData12;
	MTH_tdxReal			m_xData13;
	ACP_tdxBool			m_bData14;
} tdstMACDPID;
 
/* For stone dynamics */
#define M_xMACDPIDGetStiffness(_p_stMACDPID) M_xMACDPIDGetImpetus(_p_stMACDPID)
#define M_xMACDPIDSetStiffness(_p_stMACDPID,_xValue) M_xMACDPIDSetImpetus(_p_stMACDPID,_xValue)
#define M_p_stMACDPIDGetCenteredForce(_p_stMACDPID) M_p_stMACDPIDGetTranslation(_p_stMACDPID)
#define M_vMACDPIDSetCenteredForce(_p_stMACDPID,_p_stVector) M_vMACDPIDSetTranslation(_p_stMACDPID,_p_stVector)
/* End stone dynamics */
 
/* For shooting dynamics */
#define M_xMACDPIDGetHeight(_p_stMACDPID) M_xMACDPIDGetImpetus(_p_stMACDPID)
#define M_xMACDPIDSetHeight(_p_stMACDPID,_xValue) M_xMACDPIDSetImpetus(_p_stMACDPID,_xValue)
/* End shooting dynamics */
 
#define M_p_stMACDPIDGetTrackingDirection(_p_stMACDPID) (&(_p_stMACDPID)->m_stData3)
#define M_vMACDPIDSetTrackingDirection(_p_stMACDPID,_p_stVector) MTH3D_M_vCopyVector(M_p_stMACDPIDGetTrackingDirection(_p_stMACDPID),_p_stVector)
 
#define M_p_stMACDPIDGetStartPoint(_p_stMACDPID) (&(_p_stMACDPID)->m_stData1)
#define M_vMACDPIDSetStartPoint(_p_stMACDPID,_p_stVector) MTH3D_M_vCopyVector(M_p_stMACDPIDGetStartPoint(_p_stMACDPID),_p_stVector)
 
#define M_p_stMACDPIDGetArrivalPoint(_p_stMACDPID) (&(_p_stMACDPID)->m_stData2)
#define M_vMACDPIDSetArrivalPoint(_p_stMACDPID,_p_stVector) MTH3D_M_vCopyVector(M_p_stMACDPIDGetArrivalPoint(_p_stMACDPID),_p_stVector)
 
#define M_xMACDPIDGetAlphaAngle(_p_stMACDPID) ((_p_stMACDPID)->m_xData11)
#define M_xMACDPIDSetAlphaAngle(_p_stMACDPID,_xValue) (M_xMACDPIDGetAlphaAngle(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetThetaAngle(_p_stMACDPID) ((_p_stMACDPID)->m_xData4)
#define M_xMACDPIDSetThetaAngle(_p_stMACDPID,_xValue) (M_xMACDPIDGetThetaAngle(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetImpetus(_p_stMACDPID) ((_p_stMACDPID)->m_xData0)
#define M_xMACDPIDSetImpetus(_p_stMACDPID,_xValue) (M_xMACDPIDGetImpetus(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetType(_p_stMACDPID) ((_p_stMACDPID)->m_xData4)
#define M_xMACDPIDSetType(_p_stMACDPID,_xValue) (M_xMACDPIDGetType(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetDistance(_p_stMACDPID) ((_p_stMACDPID)->m_xData0)
#define M_xMACDPIDSetDistance(_p_stMACDPID,_xValue) (M_xMACDPIDGetDistance(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetScalar(_p_stMACDPID) ((_p_stMACDPID)->m_xData0)
#define M_xMACDPIDSetScalar(_p_stMACDPID,_xValue) (M_xMACDPIDGetDistance(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetSpeedIntensity(_p_stMACDPID) ((_p_stMACDPID)->m_xData3)
#define M_xMACDPIDSetSpeedIntensity(_p_stMACDPID,_xValue) (M_xMACDPIDGetSpeedIntensity(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetCoef(_p_stMACDPID) ((_p_stMACDPID)->m_xData0)
#define M_xMACDPIDSetCoef(_p_stMACDPID,_xValue) (M_xMACDPIDGetCoef(_p_stMACDPID) = (_xValue))
 
#define M_p_stMACDPIDGetTranslation(_p_stMACDPID) (&(_p_stMACDPID)->m_stData1)
#define M_vMACDPIDSetTranslation(_p_stMACDPID,_p_stVector) MTH3D_M_vCopyVector(M_p_stMACDPIDGetTranslation(_p_stMACDPID),_p_stVector)
 
#define M_p_stMACDPIDGetSpeed(_p_stMACDPID) (&(_p_stMACDPID)->m_stData2)
#define M_vMACDPIDSetSpeed(_p_stMACDPID,_p_stVector) MTH3D_M_vCopyVector(M_p_stMACDPIDGetSpeed(_p_stMACDPID),_p_stVector)
 
#define M_xMACDPIDGetEulerAngleI(_p_stMACDPID) ((_p_stMACDPID)->m_xData3)
#define M_xMACDPIDSetEulerAngleI(_p_stMACDPID,_xValue) (M_xMACDPIDGetEulerAngleI(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetEulerAngleJ(_p_stMACDPID) ((_p_stMACDPID)->m_xData4)
#define M_xMACDPIDSetEulerAngleJ(_p_stMACDPID,_xValue) (M_xMACDPIDGetEulerAngleJ(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetEulerAngleK(_p_stMACDPID) ((_p_stMACDPID)->m_xData5)
#define M_xMACDPIDSetEulerAngleK(_p_stMACDPID,_xValue) (M_xMACDPIDGetEulerAngleK(_p_stMACDPID) = (_xValue))
 
#define M_xMACDPIDGetOrientationAngle(_p_stMACDPID) ((_p_stMACDPID)->m_stData6.m_xAngle)
#define M_p_stMACDPIDGetOrientationAxis(_p_stMACDPID) (&(_p_stMACDPID)->m_stData6.m_stAxis)
#define M_vMACDPIDSetOrientation(_p_stMACDPID,_xAngle,_p_stAxis) \
	(M_xMACDPIDGetOrientationAngle(_p_stMACDPID) = (_xAngle),\
	memcpy(M_p_stMACDPIDGetOrientationAxis(_p_stMACDPID),_p_stAxis, sizeof(MTH3D_tdstVector)))
 
#define M_xMACDPIDGetSpeedAngle(_p_stMACDPID) ((_p_stMACDPID)->m_stData7.m_xAngle)
#define M_p_stMACDPIDGetSpeedAxis(_p_stMACDPID) (&(_p_stMACDPID)->m_stData7.m_stAxis)
#define M_vMACDPIDSetSpeedOrientation(_p_stMACDPID,_xAngle,_p_stAxis) \
	(M_xMACDPIDGetSpeedAngle(_p_stMACDPID) = (_xAngle),\
	memcpy(M_p_stMACDPIDGetSpeedAxis(_p_stMACDPID), _p_stAxis, sizeof(MTH3D_tdstVector)))
 
 
#define M_cMACDPIDGetMode(_p_stMACDPID) ((_p_stMACDPID)->m_cData8)
#define M_cMACDPIDSetMode(_p_stMACDPID,_ucValue) (M_cMACDPIDGetMode(_p_stMACDPID) = (_ucValue))
	
	
/* 
 * Camera 
 *----------------
 */
#define M_xMACDPIDGetTheta(_p_stMACDPID)								((_p_stMACDPID)->m_xData0)
#define M_xMACDPIDSetTheta(_p_stMACDPID,_xValue)						(M_xMACDPIDGetImpetus(_p_stMACDPID) = (_xValue))
 
#define M_p_stMACDPIDGetTarget(_p_stMACDPID)							(&(_p_stMACDPID)->m_stData1)
#define M_vMACDPIDSetTarget(_p_stMACDPID,_p_stVector)					{MTH3D_M_vCopyVector(M_p_stMACDPIDGetTarget(_p_stMACDPID),_p_stVector)}
#define M_xMACDPIDGetTargetSpeed(_p_stMACDPID)							((_p_stMACDPID)->m_stData3.xX)
#define M_xMACDPIDGetTargetIncreaseSpeed(_p_stMACDPID)					((_p_stMACDPID)->m_stData3.xY)
#define M_xMACDPIDGetTargetDecreaseSpeed(_p_stMACDPID)					((_p_stMACDPID)->m_stData3.xZ)
 
#define M_p_stMACDPIDGetMovePos(_p_stMACDPID)							(&(_p_stMACDPID)->m_stData2)
#define M_xMACDPIDGetLinearSpeed(_p_stMACDPID)							((_p_stMACDPID)->m_stData6.m_stAxis.xX)
#define M_xMACDPIDGetLinearIncreaseSpeed(_p_stMACDPID)					((_p_stMACDPID)->m_stData6.m_stAxis.xY)
#define M_xMACDPIDGetLinearDecreaseSpeed(_p_stMACDPID)					((_p_stMACDPID)->m_stData6.m_stAxis.xZ)
#define M_xMACDPIDGetAngularSpeed(_p_stMACDPID)							((_p_stMACDPID)->m_stData7.m_stAxis.xX)
#define M_xMACDPIDGetAngularIncreaseSpeed(_p_stMACDPID)					((_p_stMACDPID)->m_stData7.m_stAxis.xY)
#define M_xMACDPIDGetAngularDecreaseSpeed(_p_stMACDPID)					((_p_stMACDPID)->m_stData7.m_stAxis.xZ)
 
#define M_uwMACDPIDGetFlags(_p_stMACDPID)								((_p_stMACDPID)->m_uwData9)
 
#define M_p_stMACDPIDGetPosReferencePoint(_p_stMACDPID)					(&(_p_stMACDPID)->m_stData10)
#define M_xMACDPIDGetCutAngleFactorPos(_p_stMACDPID)					((_p_stMACDPID)->m_xData11)
#define M_p_stMACDPIDGetRefAxisZ(_p_stMACDPID)							(&(_p_stMACDPID)->m_stData12)
#define M_xMACDPIDGetCutAngleFactorTgt(_p_stMACDPID)					((_p_stMACDPID)->m_xData13)
/*
 * End for camera
 *----------------
 */
 
/* Public clone */
#define M_vMACDPIDCopyClone(_p_stDst,_p_stSrc) memcpy(_p_stDst,_p_stSrc,sizeof(tdstMACDPID))
 
#ifdef __cplusplus
}
#endif
 
#endif
