101 lines
5.4 KiB
C
101 lines
5.4 KiB
C
#ifndef _DNMOBSTA_H_
|
|
#define _DNMOBSTA_H_
|
|
|
|
#include <string.h>
|
|
|
|
#include "MecMatCa.h"
|
|
#include "DNMObsTy.h"
|
|
/*#include "dnmlimty.h"*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Define the type DNM_tdstObstacle */
|
|
|
|
typedef struct DNM_stObstacle
|
|
{
|
|
MTH_tdxReal m_xRate;
|
|
MTH3D_tdstVector m_stNorm;
|
|
MTH3D_tdstVector m_stContact;
|
|
GMT_tdxHandleToGameMaterial hMyMaterial;
|
|
GMT_tdxHandleToGameMaterial hCollidedMaterial;
|
|
HIE_tdxHandleToSuperObject mp_stSupObj; /* Collided object */
|
|
} DNM_tdstObstacle;
|
|
|
|
|
|
typedef struct DNM_stMecObstacle
|
|
{
|
|
MTH_tdxReal m_xRate;
|
|
MTH3D_tdstVector m_stNorm;
|
|
MTH3D_tdstVector m_stContact;
|
|
GMT_tdxHandleToGameMaterial hMyMaterial;
|
|
GMT_tdxHandleToGameMaterial hCollidedMaterial;
|
|
HIE_tdxHandleToSuperObject mp_stSupObj; /* Collided object */
|
|
|
|
DNM_tdeObstacleType m_eType;
|
|
ACP_tdxIndex m_xMyEntity; /* type of element : segment, point, edge, ... */
|
|
ACP_tdxIndex m_xCollidedEntity; /* type of element : segment, point, edge, ... */
|
|
MTH3D_tdstVector m_stTranslation; /* translation to get the actor out of the obstacle */
|
|
MTH3D_tdstVector m_stZoneMove; /* zone movement */
|
|
MTH3D_tdstVector m_stZonePosition; /* zone position when collide */
|
|
MTH_tdxReal m_xZoneRadius; /* radius of the collide zone */
|
|
DNM_tdstMecMatCharacteristics m_stProperties; /* Material properties */
|
|
DNM_tdstMecMatCharacteristics m_stMyProperties; /* Material properties of mine */
|
|
} DNM_tdstMecObstacle;
|
|
|
|
|
|
/* Methods */
|
|
|
|
/* Accessors */
|
|
#define DNM_M_eObstacleGetType(_p_stObstacle) ((_p_stObstacle)->m_eType)
|
|
#define DNM_M_xObstacleGetRate(_p_stObstacle) ((_p_stObstacle)->m_xRate)
|
|
#define DNM_M_p_stObstacleGetNorm(_p_stObstacle) (&(_p_stObstacle)->m_stNorm)
|
|
#define DNM_M_p_stObstacleGetContact(_p_stObstacle) (&(_p_stObstacle)->m_stContact)
|
|
#define DNM_M_p_stObstacleGetProperties(_p_stObstacle) (&(_p_stObstacle)->m_stProperties)
|
|
#define DNM_M_p_stObstacleGetMyProperties(_p_stObstacle) (&(_p_stObstacle)->m_stMyProperties)
|
|
#define DNM_M_p_stObstacleGetObject(_p_stObstacle) ((_p_stObstacle)->mp_stSupObj)
|
|
#define DNM_M_hObstacleGetCollidedMaterial(_p_stObstacle) ((_p_stObstacle)->hCollidedMaterial)
|
|
#define DNM_M_hObstacleGetMyMaterial(_p_stObstacle) ((_p_stObstacle)->hMyMaterial)
|
|
#define DNM_M_xObstacleGetMyEntity(_p_stObstacle) ((_p_stObstacle)->m_xMyEntity)
|
|
#define DNM_M_xObstacleGetCollidedEntity(_p_stObstacle) ((_p_stObstacle)->m_xCollidedEntity)
|
|
#define DNM_M_xObstacleGetTranslation(_p_stObstacle) (& (_p_stObstacle)->m_stTranslation)
|
|
#define DNM_M_pObstacleGetZoneMove(_p_stObstacle) (& (_p_stObstacle)->m_stZoneMove)
|
|
#define DNM_M_pObstacleGetZonePosition(_p_stObstacle) (& (_p_stObstacle)->m_stZonePosition)
|
|
#define DNM_M_xObstacleGetZoneRadius(_p_stObstacle) ((_p_stObstacle)->m_xZoneRadius)
|
|
|
|
#define DNM_M_eObstacleSetType(_p_stObstacle,_eType) (DNM_M_eObstacleGetType(_p_stObstacle) = _eType)
|
|
#define DNM_M_xObstacleSetRate(_p_stObstacle,_xRate) ((_p_stObstacle)->m_xRate = _xRate)
|
|
#define DNM_M_ObstacleSetNorm(_p_stObstacle,_p_stVector) MTH3D_M_vCopyVector(DNM_M_p_stObstacleGetNorm(_p_stObstacle),_p_stVector)
|
|
#define DNM_M_ObstacleSetContact(_p_stObstacle,_p_stVector) MTH3D_M_vCopyVector(DNM_M_p_stObstacleGetContact(_p_stObstacle),_p_stVector)
|
|
#define DNM_M_ObstacleSetProperties(_p_stObstacle,_p_stPhyProperties) DNM_M_MatCharacteristicsCopyClone(&(_p_stObstacle)->m_stProperties,_p_stPhyProperties)
|
|
#define DNM_M_ObstacleSetMyProperties(_p_stObstacle,_p_stPhyProperties) DNM_M_MatCharacteristicsCopyClone(&(_p_stObstacle)->m_stMyProperties,_p_stPhyProperties)
|
|
#define DNM_M_p_stObstacleSetObject(_p_stObstacle,_p_stObject) (DNM_M_p_stObstacleGetObject(_p_stObstacle) = _p_stObject)
|
|
#define DNM_M_vObstacleSetCollidedMaterial(_p_stObstacle,_hMaterial) (DNM_M_hObstacleGetCollidedMaterial(_p_stObstacle) = _hMaterial)
|
|
#define DNM_M_vObstacleSetMyMaterial(_p_stObstacle,_hMaterial) (DNM_M_hObstacleGetMyMaterial(_p_stObstacle) = _hMaterial)
|
|
#define DNM_M_xObstacleSetMyEntity(_p_stObstacle,_xValue) (DNM_M_xObstacleGetMyEntity(_p_stObstacle) = (_xValue))
|
|
#define DNM_M_xObstacleSetCollidedEntity(_p_stObstacle,_xValue) (DNM_M_xObstacleGetCollidedEntity(_p_stObstacle) = (_xValue))
|
|
#define DNM_M_xObstacleSetTranslation(_p_stObstacle,_p_stVector) MTH3D_M_vCopyVector(DNM_M_xObstacleGetTranslation(_p_stObstacle), _p_stVector)
|
|
#define DNM_M_xObstacleSetZoneMove(_p_stObstacle,_p_stVector) MTH3D_M_vCopyVector(DNM_M_pObstacleGetZoneMove(_p_stObstacle), _p_stVector)
|
|
#define DNM_M_xObstacleSetZonePosition(_p_stObstacle,_p_stVector) MTH3D_M_vCopyVector(DNM_M_pObstacleGetZonePosition(_p_stObstacle), _p_stVector)
|
|
#define DNM_M_xObstacleSetZoneRadius(_p_stObstacle,_xRadius) (DNM_M_xObstacleGetZoneRadius(_p_stObstacle)=_xRadius)
|
|
|
|
/* Short cuts */
|
|
#define DNM_M_xObstacleGetSlide(_p_stObstacle) DNM_M_xMatCharacteristicsGetSlide(DNM_M_p_stObstacleGetProperties(_p_stObstacle))
|
|
#define DNM_M_xObstacleGetRebound(_p_stObstacle) DNM_M_xMatCharacteristicsGetRebound(DNM_M_p_stObstacleGetProperties(_p_stObstacle))
|
|
|
|
|
|
#define DNM_M_xObstacleSetSlide(_p_stObstacle,_xValue) DNM_M_xMatCharacteristicsSetSlide(DNM_M_p_stObstacleGetProperties(_p_stObstacle),_xValue)
|
|
#define DNM_M_xObstacleSetRebound(_p_stObstacle,_xValue) DNM_M_xMatCharacteristicsSetRebound(DNM_M_p_stObstacleGetProperties(_p_stObstacle),_xValue)
|
|
|
|
/* Clone */
|
|
#define DNM_M_ObstacleCopyClone(_p_stDst,_p_stSrc) memcpy(_p_stDst,_p_stSrc,sizeof(DNM_tdstObstacle))
|
|
#define DNM_M_MecObstacleCopyClone(_p_stDst,_p_stSrc) memcpy(_p_stDst,_p_stSrc,sizeof(DNM_tdstMecObstacle))
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|