Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,455 @@
/***************************/
/* DNMDynam.Cpp */
/***************************/
/* Date 6-11-96 */
/* Modification 1996-12-11 */
/***************************/
#include "cpa_std.h"
#include "MEC/MecInc.h"
#include "MEC/DNMSurSt.h"
#include "MEC/DNMDynam.h"
#include "MEC/MECBase.h"
#include "MEC/MECTools.h"
#include "MEC/mBase.h"
#include "extheade.h"
#include "GAM/InitEnum.h"
#include "GAM/Actions/Dynam.h"
#if defined(ACTIVE_EDITOR)
extern void fn_vForceEditor (void);
/*extern ACP_tdxBool fn_bTestIfEditorRunning (void);*/
#endif /* ACTIVE_EDITOR */
extern HIE_tdxHandleToSuperObject gp_stInactiveDynamicWorld;
/*FB030898 for C optimisation*/
extern POS_tdstCompletePosition *POS_g_p_stIdentityMatrix;
/*END FB*/
extern HIE_tdxHandleToSuperObject gp_stDynamicWorld;
/*--- Global data ----*/
#ifdef MEC_CHECK_ACCESS
/* char g_a_TmpBuffer [1000]; /* > size of largest structure that can be return */
HIE_tdxHandleToSuperObject g_hLastActorErrorInAdvancedCheck = NULL;
HIE_tdxHandleToSuperObject g_hLastActorErrorInComplexCheck = NULL;
HIE_tdxHandleToSuperObject g_hLastActorErrorInCollisionCheck = NULL;
/* Oliv' - remove wNumRom - 22/06/1999
#ifdef U64
short fn_wGet3dDataNumRom(struct tdstEngineObject_ * p_stEngineObject);
#define M_GetEngineObject(p_stSuperObject) ((HIE_fn_ulGetSuperObjectType(p_stSuperObject) != HIE_C_ulActor)?NULL:((struct tdstEngineObject_ *)(HIE_fn_hGetSuperObjectObject(p_stSuperObject))))
#endif
*/
/*--------------------------------------- Check functions --------------------------------*/
void DNM_fn_vDisplayErrorMessage ( char* szMessage, HIE_tdxHandleToSuperObject hSupObj )
{
char szBuffer [500];
#ifndef U64
if (hSupObj)
{
char szFamilyName [500];
char szTypeName [10];
char szTypeNames [10];
char* pszActorName;
char* pszFamilyName;
pszActorName = AI_fn_pszGetActorName (hSupObj);
pszFamilyName = AI_fn_pszGetFamilyName (hSupObj,szFamilyName);
if (fn_ucIsAnAlwaysObject(HIE_fn_hGetSuperObjectObject(hSupObj)))
{
strcpy ( szTypeName, "always" );
strcpy ( szTypeNames, "always" );
}
else
{
strcpy ( szTypeName, "actor" );
strcpy ( szTypeNames, "actors" );
}
if (pszActorName && pszFamilyName)
sprintf ( szBuffer, "%s\nto %s : %s\nof family : %s", szMessage, szTypeName, pszActorName, pszFamilyName );
else if (pszActorName)
sprintf ( szBuffer, "%s\nto %s : %s", szMessage, szTypeName, pszActorName );
else if (pszFamilyName)
sprintf ( szBuffer, "%s\nto %s of the family : %s .", szMessage, szTypeNames, pszFamilyName );
else
sprintf ( szBuffer, "%s\nto an unknown %s.", szMessage, szTypeName );
}
else
sprintf ( szBuffer, "%s\nto someone.", szMessage );
Erm_fn_iMessageBox (szBuffer,"Mechanic Allocation Error",MB_OK|MB_ICONERROR);
#else
if (hSupObj)
{
/* Oliv' - remove wNumRom - 22/06/1999 */
/* short wNumRom = fn_wGet3dDataNumRom(M_GetEngineObject(hSupObj)); */
short wNumRom = fn_otStandardGameGetPersonalType( M_GetMSHandle(hSupObj,StandardGame) );
sprintf(szBuffer, "%s for Perso : %ld\n", szMessage, wNumRom);
/* EndOfOliv' */
}
else
sprintf(szBuffer, "%s\n", szMessage);
M_PrintfStopErrorN64((szBuffer));
#endif
#if defined(ACTIVE_EDITOR)
fn_vForceEditor ();
#else
/* Can't continue. You must allocate good mechanic to actor.*/
*(long *)0x00000000 = 5;
#endif
}
DNM_tdstDynamicsBaseBlock* DNM_fn_pstGetBaseBlockWithAdvancedCheckAccess (DNM_tdstDynamics *p_stDynamic)
{
HIE_tdxHandleToSuperObject hSupObj;
if (!DNM_M_bDynamicsIsAdvancedSize(p_stDynamic))
{
hSupObj = DNM_fn_pstGetActorWithDynamic (p_stDynamic);
if (hSupObj!=g_hLastActorErrorInAdvancedCheck)
{
g_hLastActorErrorInAdvancedCheck = hSupObj;
DNM_fn_vDisplayErrorMessage ( "You must allocate an advanced mechanic", hSupObj );
}
/* return (DNM_tdstDynamicsBaseBlock*)g_a_TmpBuffer;*/
}
return &(p_stDynamic->m_tdstDynamicsBaseBlock);
}
DNM_tdstDynamicsBaseBlock* DNM_fn_pstGetBaseBlockWithComplexCheckAccess (DNM_tdstDynamics *p_stDynamic)
{
HIE_tdxHandleToSuperObject hSupObj;
if (!DNM_M_bDynamicsIsComplexSize(p_stDynamic))
{
hSupObj = DNM_fn_pstGetActorWithDynamic (p_stDynamic);
if (hSupObj!=g_hLastActorErrorInComplexCheck)
{
g_hLastActorErrorInComplexCheck = hSupObj;
DNM_fn_vDisplayErrorMessage ( "You must allocate complex mechanic", hSupObj );
}
/* return (DNM_tdstDynamicsBaseBlock*)g_a_TmpBuffer;*/
}
return &(p_stDynamic->m_tdstDynamicsBaseBlock);
}
DNM_tdstDynamicsAdvancedBlock* DNM_fn_pstGetAdvancedBlockWithCheckAccess (DNM_tdstDynamics *p_stDynamic)
{
HIE_tdxHandleToSuperObject hSupObj;
if (!DNM_M_bDynamicsIsAdvancedSize(p_stDynamic))
{
hSupObj = DNM_fn_pstGetActorWithDynamic (p_stDynamic);
if (hSupObj!=g_hLastActorErrorInAdvancedCheck)
{
g_hLastActorErrorInAdvancedCheck = hSupObj;
DNM_fn_vDisplayErrorMessage ( "You must allocate an advanced mechanic", hSupObj );
}
/* return (DNM_tdstDynamicsAdvancedBlock*)g_a_TmpBuffer;*/
}
return &(p_stDynamic->m_tdstDynamicsAdvancedBlock);
}
DNM_tdstDynamicsComplexBlock* DNM_fn_pstGetComplexBlockWithCheckAccess (DNM_tdstDynamics *p_stDynamic)
{
HIE_tdxHandleToSuperObject hSupObj;
if (!DNM_M_bDynamicsIsComplexSize(p_stDynamic))
{
hSupObj = DNM_fn_pstGetActorWithDynamic (p_stDynamic);
if (hSupObj!=g_hLastActorErrorInComplexCheck)
{
g_hLastActorErrorInComplexCheck = hSupObj;
DNM_fn_vDisplayErrorMessage ( "You must allocate a complex mechanic", hSupObj );
}
/* return (DNM_tdstDynamicsComplexBlock*)g_a_TmpBuffer;*/
}
return &(p_stDynamic->m_tdstDynamicsComplexBlock);
}
DNM_tdstReport* DNM_fn_pstGetReportWithCheckAccess (DNM_tdstDynamics *p_stDynamic)
{
HIE_tdxHandleToSuperObject hSupObj;
if (!DNM_M_bDynamicsIsCollisionReport(p_stDynamic))
{
hSupObj = DNM_fn_pstGetActorWithDynamic (p_stDynamic);
if (hSupObj!=g_hLastActorErrorInCollisionCheck)
{
g_hLastActorErrorInCollisionCheck = hSupObj;
DNM_fn_vDisplayErrorMessage ( "You must allocate collision", hSupObj );
}
/* return (DNM_tdstReport*)g_a_TmpBuffer;*/
}
return DNM_M_pstGetBaseBlock(p_stDynamic)->m_pstReport;
}
HIE_tdxHandleToSuperObject DNM_fn_pstGetActorWithDynamic (DNM_tdstDynamics *p_stDynamic)
{
HIE_tdxHandleToSuperObject hCharacter,hNextCharacter;
DNM_tdstDynamics *p_stCharacterDynamic;
long i;
HIE_M_ForEachMovingChildOf(gp_stDynamicWorld,hCharacter,hNextCharacter,i)
{
/* actor or platform */
if ( HIE_fn_ulGetSuperObjectType(hCharacter)==HIE_C_ulActor )
{
p_stCharacterDynamic = fn_p_stDynamGetDynamicsSO (hCharacter);
if (p_stCharacterDynamic==p_stDynamic) return hCharacter;
}
}
HIE_M_ForEachChildOf(gp_stInactiveDynamicWorld,hCharacter,i)
/* actor or platform */
if ( HIE_fn_ulGetSuperObjectType(hCharacter)==HIE_C_ulActor )
{
p_stCharacterDynamic = fn_p_stDynamGetDynamicsSO (hCharacter);
if (p_stCharacterDynamic==p_stDynamic) return hCharacter;
}
return NULL;
}
#endif /* MEC_CHECK_ACCESS*/
void DNM_fn_vDynamicsInitDefault(DNM_tdstDynamics *p_stDynamic)
{
#ifdef DNM_DEBUG
if(p_stDynamics == NULL)
return;
#endif
DNM_tdstReport* p_stReport = NULL;
unsigned long ulEndFlags = 0;
/*XB981020*/
#ifdef MEC_CHECK_ACCESS
g_hLastActorErrorInAdvancedCheck = NULL;
g_hLastActorErrorInComplexCheck = NULL;
g_hLastActorErrorInCollisionCheck = NULL;
#endif /* MEC_CHECK_ACCESS */
/*End XB*/
/* Init global report */
memset ( &g_stReport, 0, sizeof(DNM_tdstMecReport) );
/* Init BitFields */
p_stDynamic->m_tdstDynamicsBaseBlock.ulFlags = 0;
p_stDynamic->m_tdstDynamicsBaseBlock.ulEndFlags &= (DNM_C_CollisionReport|DNM_C_Always|0xF);
ulEndFlags = p_stDynamic->m_tdstDynamicsBaseBlock.ulEndFlags;
/* Initialisation of the report */
#ifdef ACTIVE_EDITOR
p_stReport = DNM_M_p_stDynamicsGetReportWithoutCheckAccess (p_stDynamic);
DNM_p_stReportDefaultInit (p_stReport);
#else
if (DNM_M_bDynamicsIsCollisionReport(p_stDynamic))
{
p_stReport = DNM_M_p_stDynamicsGetReport (p_stDynamic);
DNM_p_stReportDefaultInit (p_stReport);
}
#endif /* ACTIVE_EDITOR*/
/* clean all */
#ifndef ACTIVE_EDITOR
if (DNM_M_bDynamicsIsComplexSize(p_stDynamic)) memset ( p_stDynamic, 0, sizeof(DNM_tdstComplexDynamics) );
else if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamic)) memset ( p_stDynamic, 0, sizeof(DNM_tdstAdvancedDynamics) );
else memset ( p_stDynamic, 0, sizeof(DNM_tdstBaseDynamics) );
#else /* ACTIVE_EDITOR*/
memset ( p_stDynamic, 0, sizeof(DNM_tdstComplexDynamics) );
#endif /* ACTIVE_EDITOR*/
/* restore values */
p_stDynamic->m_tdstDynamicsBaseBlock.ulEndFlags = ulEndFlags;
if (p_stReport)
DNM_M_DynamicsSetReport(p_stDynamic,p_stReport);
/* Init no null fields */
DNM_M_vDynamicsSetInit (p_stDynamic,TRUE);
/*--- Base init ---*/
DNM_M_vDynamicsSetNbFrame(p_stDynamic,1);
/*--- Advanced init ---*/
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamic))
{
DNM_M_vDynamicsSetStreamFactor (p_stDynamic,MTH_C_ONE);
}
/*--- Complex init ---*/
if (DNM_M_bDynamicsIsComplexSize(p_stDynamic))
{
HIE_fn_vInvalidateSuperObject (&DNM_M_hDynamicsGetPlatformSO(p_stDynamic));
}
memset(&g_stReport,0,sizeof(DNM_tdstMecReport)); //AR9906 Init of global report (See with Jacques)
}
/* Init function*/
void DNM_fn_vInitBaseMechanic (DNM_tdstDynamics *p_stDynamic)
{
DNM_fn_vDynamicsInitDefault (p_stDynamic);
}
void DNM_fn_vInitDynamic (DNM_tdstDynamics *p_stDynamic, DNM_tdxHandleToMecIdentityCard hIdCard)
{
DNM_tdstMecBaseIdCard* p_IdCard = (DNM_tdstMecBaseIdCard*)hIdCard;
/*--- Base ---*/
DNM_M_vDynamicsSetAnimation(p_stDynamic,DNM_M_bBaseIdCardIsAnimation(p_IdCard));
DNM_M_vDynamicsSetCollide(p_stDynamic,DNM_M_bBaseIdCardIsCollide(p_IdCard));
DNM_M_vDynamicsSetGravity(p_stDynamic,DNM_M_bBaseIdCardIsGravity(p_IdCard));
DNM_M_vDynamicsSetTilt(p_stDynamic,DNM_M_bBaseIdCardIsTilt(p_IdCard));
DNM_M_vDynamicsSetGi(p_stDynamic,DNM_M_bBaseIdCardIsGi(p_IdCard));
DNM_M_vDynamicsSetOnGround(p_stDynamic,DNM_M_bBaseIdCardIsOnGround(p_IdCard));
DNM_M_vDynamicsSetClimb(p_stDynamic,DNM_M_bBaseIdCardIsClimb(p_IdCard));
DNM_M_vDynamicsSetSpider(p_stDynamic,DNM_M_bBaseIdCardIsSpider(p_IdCard));
DNM_M_vDynamicsSetShoot(p_stDynamic,DNM_M_bBaseIdCardIsShoot(p_IdCard));
DNM_M_vDynamicsSetSwim(p_stDynamic,DNM_M_bBaseIdCardIsSwim(p_IdCard));
DNM_M_vDynamicsSetCollisionControl(p_stDynamic,DNM_M_bBaseIdCardIsCollisionControl(p_IdCard));
DNM_M_vDynamicsSetKeepWallSpeedZ(p_stDynamic,DNM_M_bBaseIdCardIsKeepWallSpeedZ(p_IdCard));
DNM_M_vDynamicsSetSpeedLimit(p_stDynamic,DNM_M_bBaseIdCardIsSpeedLimit(p_IdCard));
DNM_M_vDynamicsSetInertia(p_stDynamic,DNM_M_bBaseIdCardIsInertia(p_IdCard));
DNM_M_vDynamicsSetStream(p_stDynamic,DNM_M_bBaseIdCardIsStream(p_IdCard));
DNM_M_vDynamicsSetStickOnPlatform(p_stDynamic,DNM_M_bBaseIdCardIsStickOnPlatform(p_IdCard));
DNM_M_vDynamicsSetScaleOption(p_stDynamic,DNM_M_bBaseIdCardIsScale(p_IdCard));
DNM_M_vDynamicsSetGravityFactor(p_stDynamic,DNM_M_xBaseIdCardGetGravityFactor(p_IdCard));
DNM_M_vDynamicsSetSlopeLimit(p_stDynamic,DNM_M_xBaseIdCardGetSlopeLimit(p_IdCard));
DNM_M_bDynamicsSetMechanicChange(p_stDynamic,TRUE);
DNM_M_vDynamicsSetNeverFall(p_stDynamic,FALSE);
DNM_M_vDynamicsSetForceSafeWalk ( p_stDynamic, FALSE );
/* Optimization */
MEC_fn_vComputeSlopeLimit (p_stDynamic);
/*--- Advanced ---*/
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamic))
{
DNM_M_vDynamicsSetSlide(p_stDynamic,DNM_M_xBaseIdCardGetSlide(p_IdCard));
DNM_M_vDynamicsSetRebound(p_stDynamic,DNM_M_xBaseIdCardGetRebound(p_IdCard));
DNM_M_vDynamicsSetInertiaFactorX(p_stDynamic,DNM_M_xBaseIdCardGetInertiaFactorX(p_IdCard));
DNM_M_vDynamicsSetInertiaFactorY(p_stDynamic,DNM_M_xBaseIdCardGetInertiaFactorY(p_IdCard));
DNM_M_vDynamicsSetInertiaFactorZ(p_stDynamic,DNM_M_xBaseIdCardGetInertiaFactorZ(p_IdCard));
DNM_M_vDynamicsSetMaxSpeed(p_stDynamic,DNM_M_pBaseIdCardGetMaxSpeed(p_IdCard));
/* collision matrix */
MEC_fn_vRegisterCollisionTranslation (p_stDynamic,DNM_M_p_stDynamicsGetCurrentMatrix(p_stDynamic));
}
/*--- Complex ---*/
else if (DNM_M_bDynamicsIsComplexSize(p_stDynamic))
{
DNM_M_vDynamicsSetTiltIntensity(p_stDynamic,DNM_M_xBaseIdCardGetTiltIntensity(p_IdCard));
DNM_M_vDynamicsSetTiltInertia(p_stDynamic,DNM_M_xBaseIdCardGetTiltInertia(p_IdCard));
DNM_M_vDynamicsSetTiltOrigin(p_stDynamic,DNM_M_xBaseIdCardGetTiltOrigin(p_IdCard));
}
}
/* Inform that Id Card has changed */
/* Author : j Th<54>noz */
/* Date : 1997-12-15 */
/* Version : 1.01 */
void DNM_fn_vChangeIdCard (DNM_tdstDynamics *_p_stDynamics,DNM_tdxHandleToMecIdentityCard _hNewIdCard)
{
#if defined(MEC_DEBUG)
#ifndef U64
HIE_tdxHandleToSuperObject hSupObj;
char szMessage [500];
char* pszName;
if (!_hNewIdCard)
{
hSupObj = DNM_fn_pstGetActorWithDynamic (_p_stDynamics);
pszName = AI_fn_pszGetActorName (hSupObj);
sprintf ( szMessage, "You must select a mechanic in action editor\nto actor : %s .", pszName );
Erm_fn_iMessageBox (szMessage,"Mechanic error",MB_OK|MB_ICONERROR);
#else
if (!_hNewIdCard)
{
/* Oliv' - remove wNumRom - 22/06/1999 */
/* short wNumRom = fn_wGet3dDataNumRom(M_GetEngineObject(hSupObj)); */
short wNumRom = fn_otStandardGameGetPersonalType( M_GetMSHandle(hSupObj,StandardGame) );
M_PrintfStopErrorN64(("You must select a mechanic for Perso : %ld\n", wNumRom));
/* EndOfOliv' */
#endif /* U64*/
#if defined(ACTIVE_EDITOR)
fn_vForceEditor ();
#endif /* ACTIVE_EDITOR*/
Erm_M_ClearLastError(C_ucErmDefaultChannel);
return;
}
#endif
#ifdef DNM_DEBUG
if (DNM_fn_eIdentityCardGetType(_hNewIdCard)==DNM_eBase)
#else
if (DNM_M_eBaseIdCardGetIdentity((DNM_tdstMecBaseIdCard*)(_hNewIdCard)) == DNM_eBase)
#endif
DNM_fn_vInitDynamic (_p_stDynamics, _hNewIdCard);
DNM_M_vDynamicsSetCurrentIdCard(_p_stDynamics,_hNewIdCard);
}
/* clone dynamic structure */
void DNM_fn_vDynamicsCopyClone ( DNM_tdstDynamics *_p_stDst, DNM_tdstDynamics *_p_stSrc )
{
DNM_tdstReport* p_stReport=NULL;
if (DNM_M_bDynamicsIsCollisionReport(_p_stDst))
{
/* store destination report */
p_stReport = DNM_M_p_stDynamicsGetReport (_p_stDst);
}
/* copy */
if (DNM_M_bDynamicsIsComplexSize(_p_stSrc)) memcpy ( _p_stDst, _p_stSrc, sizeof(DNM_tdstComplexDynamics) );
else if (DNM_M_bDynamicsIsAdvancedSize(_p_stSrc)) memcpy ( _p_stDst, _p_stSrc, sizeof(DNM_tdstAdvancedDynamics) );
else memcpy ( _p_stDst, _p_stSrc, sizeof(DNM_tdstBaseDynamics) );
if (p_stReport)
{
DNM_M_DynamicsSetReport ( _p_stDst, p_stReport );
if (DNM_M_bDynamicsIsCollisionReport(_p_stSrc))
memcpy ( p_stReport, DNM_M_p_stDynamicsGetReport(_p_stSrc), sizeof(DNM_tdstReport) );
}
}

View File

@@ -0,0 +1,274 @@
/*
*=======================================================================================
* Name : DNMMTH.c
* Author : CB / YLG / VL
* Description :
*=======================================================================================
*/
#include "MEC/DNMMTH.h"
#include "MTH.h"
/*
**************************************************************************************************
**************************************************************************************************
TOOLS
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
Projection of a vector on a plane
Beware : ||_p_stPlaneNorm|| = ||_p_stProjDirection)|| = 1
*=================================================================================================
*/
void MTH_fn_vVectorPlaneProjection(
MTH3D_tdstVector *_p_stResult,
MTH3D_tdstVector *_p_stSource,
MTH3D_tdstVector *_p_stPlaneNorm,
MTH3D_tdstVector *_p_stProjDirection
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH3D_tdstVector a_stVector[1];
MTH3D_tdstVector *p_stTmp = a_stVector;
MTH_tdxReal xAlpha;
MTH_tdxReal xDotProduct;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if(_p_stProjDirection != _p_stPlaneNorm)
xDotProduct = MTH3D_M_xDotProductVector(_p_stProjDirection,_p_stPlaneNorm);
else
xDotProduct = MTH_C_ONE;
if(!MTH_M_bEqualZero(xDotProduct))
{
xAlpha = MTH_M_xNeg(MTH3D_M_xDotProductVector(_p_stSource,_p_stPlaneNorm));
xAlpha = MTH_M_xDiv(xAlpha,xDotProduct);
MTH3D_M_vCopyVector(p_stTmp,_p_stProjDirection);
MTH3D_M_vMulScalarVector(p_stTmp, xAlpha, p_stTmp);
if(_p_stResult != _p_stSource)
MTH3D_M_vCopyVector(_p_stResult,_p_stSource);
MTH3D_M_vAddVector(_p_stResult,_p_stResult,p_stTmp);
}
}
/*
*=================================================================================================
Compute a rotation thanks a source vector and an image vector
||_p_stSrcUnitVector|| = ||_p_stImaUnitVector|| = 1
*=================================================================================================
*/
MTH_tdstRotation *MTH_p_stRotationComputeRotationWith2Vectors(MTH_tdstRotation *_p_stResult,
MTH3D_tdstVector *_p_stSrcUnitVector,
MTH3D_tdstVector *_p_stImaUnitVector)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH3D_tdstVector *p_stAxis;
MTH_tdxReal xCos;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#ifdef DNM_DEBUG
if(_p_stResult == NULL)
return NULL;
if(_p_stSrcUnitVector == NULL)
return NULL;
if(_p_stImaUnitVector == NULL)
return NULL;
#endif
p_stAxis = MTH_M_p_stRotationGetAxis(_p_stResult);
MTH3D_M_vCrossProductVectorWithoutBuffer(p_stAxis,_p_stSrcUnitVector,_p_stImaUnitVector);
if
(
MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetXofVector(p_stAxis), MTH_M_xDoubleToReal(1.0e-5))
&& MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetYofVector(p_stAxis), MTH_M_xDoubleToReal(1.0e-5))
&& MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetZofVector(p_stAxis), MTH_M_xDoubleToReal(1.0e-5))
)
{
/*CB
if(MTH_M_xSign(MTH3D_M_xGetXofVector(_p_stSrcUnitVector)) != MTH_M_xSign(MTH3D_M_xGetXofVector(_p_stImaUnitVector)))
{
MTH_M_xRotationSetAngle(_p_stResult,MTH_C_Pi);
}
else if(MTH_M_xSign(MTH3D_M_xGetYofVector(_p_stSrcUnitVector)) != MTH_M_xSign(MTH3D_M_xGetYofVector(_p_stImaUnitVector)))
{
MTH_M_xRotationSetAngle(_p_stResult,MTH_C_Pi);
}
else if(MTH_M_xSign(MTH3D_M_xGetZofVector(_p_stSrcUnitVector)) != MTH_M_xSign(MTH3D_M_xGetZofVector(_p_stImaUnitVector)))
{
MTH_M_xRotationSetAngle(_p_stResult,MTH_C_Pi);
}
else
{
MTH_M_RotationSetNull(_p_stResult);
}
*/
if
(
MTH_M_bEqualWithEpsilon(MTH3D_M_xGetXofVector(_p_stSrcUnitVector), MTH3D_M_xGetXofVector(_p_stImaUnitVector), MTH_M_xDoubleToReal(1.0e-5))
&& MTH_M_bEqualWithEpsilon(MTH3D_M_xGetYofVector(_p_stSrcUnitVector), MTH3D_M_xGetYofVector(_p_stImaUnitVector), MTH_M_xDoubleToReal(1.0e-5))
&& MTH_M_bEqualWithEpsilon(MTH3D_M_xGetZofVector(_p_stSrcUnitVector), MTH3D_M_xGetZofVector(_p_stImaUnitVector), MTH_M_xDoubleToReal(1.0e-5))
)
{
MTH_M_RotationSetNull(_p_stResult);
}
else
{
MTH_M_xRotationSetAngle(_p_stResult,MTH_C_Pi);
}
}
else
{
MTH3D_M_vNormalizeVector(p_stAxis, p_stAxis);
xCos = MTH3D_M_xDotProductVector(_p_stSrcUnitVector,_p_stImaUnitVector);
if( MTH_M_bLessEqual(xCos, MTH_C_MinusONE))
{
MTH_M_xRotationSetAngle(_p_stResult,MTH_C_Pi);
}
else if ( MTH_M_bGreaterEqual(xCos, MTH_C_ONE))
{
MTH_M_RotationSetNull(_p_stResult);
}
else
{
MTH_M_xRotationSetAngle(_p_stResult,MTH_M_xACos(xCos));
}
}
return _p_stResult;
}
/*
*=================================================================================================
Rotation(Vector/Point)
*=================================================================================================
*/
MTH3D_tdstVector *MTH_p_stRotationMulVector
(
MTH_tdstRotation *_p_stRotation,
MTH3D_tdstVector *_p_stSource,
MTH3D_tdstVector *_p_stResult
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH3D_tdstVector stTmp0,stTmp1;
MTH3D_tdstVector *p_stAxis;
MTH_tdxReal xCos,xSin,xValue, xAngle;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#ifdef DNM_DEBUG
if(_p_stRotation == NULL)
return NULL;
if(_p_stSource == NULL)
return NULL;
if(_p_stResult == NULL)
return NULL;
#endif
/* R(r) = (cosq)r + (1 - cosq)n(n<>r) + (sinq)n^r */
xAngle = MTH_M_xRotationGetAngle(_p_stRotation);
xCos = MTH_M_xCos(xAngle);
xSin = MTH_M_xSin(xAngle);
p_stAxis = MTH_M_p_stRotationGetAxis(_p_stRotation);
MTH3D_M_vCrossProductVector(&stTmp0,p_stAxis,_p_stSource);
MTH3D_M_vMulScalarVector(&stTmp0, xSin, &stTmp0);
xValue = MTH_M_xMul(MTH3D_M_xDotProductVector(p_stAxis,_p_stSource),MTH_M_xSub(MTH_C_ONE,xCos));
MTH3D_M_vCopyVector(&stTmp1,p_stAxis);
MTH3D_M_vMulScalarVector(&stTmp1, xValue, &stTmp1);
if(_p_stSource != _p_stResult)
MTH3D_M_vCopyVector(_p_stResult,_p_stSource);
MTH3D_M_vMulScalarVector(_p_stResult, xCos, _p_stResult);
MTH3D_M_vAddVector(_p_stResult, _p_stResult, &stTmp1);
MTH3D_M_vAddVector(_p_stResult, _p_stResult, &stTmp0);
return _p_stResult;
}
/*
*=================================================================================================
Matrix -> Rotation
*=================================================================================================
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
MTH_tdstRotation *MTH_p_stRotationFromMatrix
(
MTH_tdstRotation *_p_stResult,
MTH3D_tdstMatrix *_p_stRotationMatrix
)
{
static MTH_tdxReal s_xLimit = MTH_M_xDoubleToReal(2.999999);
MTH3D_tdstVector *p_stAxis;
MTH_tdxReal xTrace, xCos,xSin;
MTH3D_tdstVector stI, stJ, stK;
#ifdef DNM_DEBUG
if(_p_stResult == NULL)
return NULL;
if(_p_stRotationMatrix == NULL)
return NULL;
#endif
xTrace = MTH3D_M_xTraceMatrix( _p_stRotationMatrix);
if (MTH_M_bLess(xTrace,s_xLimit))
{
MTH3D_M_vGetVectorsInMatrix ( &stI, &stJ, &stK, _p_stRotationMatrix );
p_stAxis = MTH_M_p_stRotationGetAxis(_p_stResult);
MTH3D_M_vSetXofVector ( p_stAxis, MTH_M_xSub ( MTH3D_M_xGetZofVector(&stJ), MTH3D_M_xGetYofVector(&stK) ) );
MTH3D_M_vSetYofVector ( p_stAxis, MTH_M_xSub ( MTH3D_M_xGetXofVector(&stK), MTH3D_M_xGetZofVector(&stI) ) );
MTH3D_M_vSetZofVector ( p_stAxis, MTH_M_xSub ( MTH3D_M_xGetYofVector(&stI), MTH3D_M_xGetXofVector(&stJ) ) );
if (MTH3D_M_bIsNullVector(p_stAxis))
{
if (MTH_M_bEqual (MTH3D_M_xGetXofVector(&stI),MTH_C_ONE))
{
MTH3D_M_vSetBaseIVector (p_stAxis);
MTH_M_xRotationSetAngle(_p_stResult,MTH_C_Pi);
}
else if (MTH_M_bEqual (MTH3D_M_xGetYofVector(&stJ),MTH_C_ONE))
{
MTH3D_M_vSetBaseJVector (p_stAxis);
MTH_M_xRotationSetAngle(_p_stResult,MTH_C_Pi);
}
else if (MTH_M_bEqual (MTH3D_M_xGetZofVector(&stK),MTH_C_ONE))
{
MTH3D_M_vSetBaseKVector (p_stAxis);
MTH_M_xRotationSetAngle(_p_stResult,MTH_C_Pi);
}
}
else
{
MTH3D_M_vNormalizeVector (p_stAxis,p_stAxis);
xCos = MTH_M_xMul ( MTH_M_xSub(xTrace,MTH_C_ONE) , MTH_C_Inv2 );
xSin = MTH_M_xAdd3(MTH3D_M_xGetXofVector(&stJ),MTH3D_M_xGetXofVector(&stK),MTH3D_M_xGetYofVector(&stK));
if (MTH_M_bLessEqual( xCos, MTH_C_MinusONE)) MTH_M_xRotationSetAngle ( _p_stResult, MTH_C_Pi);
else if (MTH_M_bGreaterEqual( xCos, MTH_C_ONE)) MTH_M_xRotationSetAngle ( _p_stResult, MTH_C_ZERO );
else
MTH_M_xRotationSetAngle (_p_stResult,MTH_M_bGreaterEqualZero(xSin)?MTH_M_xNeg(MTH_M_xACos(xCos)):MTH_M_xACos(xCos));
}
}
else MTH_M_RotationSetNull(_p_stResult);
return _p_stResult;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,48 @@
#include "MEC/hmecmatc.h"
#include "GMT.h"
#include "MEC/DNMSurSt.h"
#include "MEC/DNMRepor.h"
/*#ifdef U64*/
/*#include "DNM/DNMVecto.h"*/
/*#endif /* U64 */
/* Main globla report */
DNM_tdstMecReport g_stReport;
/* Default initialisation */
/* Author : JM Soudagne */
/* Date : 1996-12-26 */
/* Version : 1.02 */
/* Modify : 1997-02-13 */
DNM_tdstReport *DNM_p_stReportDefaultInit(DNM_tdstReport *_p_stReport)
{
#ifdef DNM_DEBUG
if(_p_stReport == NULL)
return NULL;
#endif
/* Initialisation of the obstacle */
/* DNM_M_vObstacleSetCollidedMaterial (DNM_M_p_stReportGetObstacle(_p_stReport), NULL);// YLG*/
/* DNM_M_vObstacleSetCollidedMaterial (DNM_M_p_stReportGetGround(_p_stReport), NULL);*/
/* DNM_M_vObstacleSetCollidedMaterial (DNM_M_p_stReportGetWall(_p_stReport), NULL);*/
/* DNM_M_vObstacleSetCollidedMaterial (DNM_M_p_stReportGetCharacter(_p_stReport), NULL);*/
/* DNM_M_vObstacleSetCollidedMaterial (DNM_M_p_stReportGetWater(_p_stReport), NULL);*/
/* DNM_M_vObstacleSetCollidedMaterial (DNM_M_p_stReportGetCeil(_p_stReport), NULL);*/
/* Kinetic values */
/* MTH_M_MoveSetNull(DNM_M_p_stReportGetAbsolutePrevSpeed(_p_stReport));*/
/* MTH_M_MoveSetNull(DNM_M_p_stReportGetAbsoluteCurrSpeed(_p_stReport));*/
/* MTH_M_MoveSetNull(DNM_M_p_stReportGetAbsolutePrevPosition(_p_stReport));*/
/* MTH_M_MoveSetNull(DNM_M_p_stReportGetAbsoluteCurrPosition(_p_stReport));*/
/* DNM_M_bReportSetWallFlagToFalse(_p_stReport);*/
/* DNM_M_bReportSetCharFlagToFalse(_p_stReport);*/
memset ( _p_stReport, 0, sizeof(DNM_tdstReport) );
return _p_stReport;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,844 @@
/*
*=======================================================================================
* Name : MecCol.c
* Author : J Th<54>noz Date : 01/05/98
* Description : Mechanic collision functions
*=======================================================================================
*/
#include "cpa_expt.h"
#include "ACP_Base.h"
#include "MEC/MECInc.h"
#include "MEC/DnmDynam.h"
#include "MEC/ParsData.h"
#include "MEC/DNMSurSt.h"
#include "MEC/mbase.h"
#include "Extheade.h"
#include "COL.h"
#include "MEC/MecDef.h"
#include "MEC/MECCol.h"
#include "MEC/MECTools.h"
#include "PCS.h" /* Physical Collide Set */
#include "SCT.h" /* SeCTor*/
#include "FIL.h" /* SeCTor*/
#include "PRT.h" /* PaRTicules*/
#include "GAM.h" /* GAMe*/
//DNM_tdstMecObstacle g_a_stObstacle [COL_C_xMaxNumberOfCollisions];
DNM_tdstMecObstacle *g_a_stObstacle = (DNM_tdstMecObstacle *) COL_g_stCollisionCase;
ACP_tdxBool g_bWaterNoCollide;
ACP_tdxBool MEC_fn_bCollision ( long* p_lObstacle, DNM_tdstMecObstacle *p_stObstacle, struct DNM_stDynamics* p_stDynamic, HIE_tdxHandleToSuperObject p_stSupObj, POS_tdstCompletePosition *p_stStartPosition, POS_tdstCompletePosition *p_stEndPosition, ACP_tdxBool bBackFace )
{
long lCounter;
DNM_tdstMecObstacle *p_stTmpObstacle;
DNM_tdstMecObstacle stHandObstacle;
POS_tdxHandleToPosition hSupObjMatrix;
MTH3D_tdstVector stMove, stVector;
MTH3D_tdstVector *p_stStartTranslation, *p_stEndTranslation;
MTH3D_tdstVector *p_stX, *p_stY, *p_stZ;
/* XB 05/05/99 */
/* ACP_tdxBool bIndexedTriangles = FALSE; */
/* End XB 05/05/99 */
ACP_tdxBool bObstacleOk = FALSE;
MTH_tdxReal xDotProd;
ACP_tdxBool bWaterFace = FALSE;
MTH_tdxReal xDotProdMax;
*p_lObstacle = 0;
xDotProdMax = MTH_C_MinusONE;
*p_lObstacle = COL_lHaveITakeSThgIntoTheMug (p_stObstacle, p_stSupObj, p_stStartPosition, p_stEndPosition);
/* delete back faces */
if (!bBackFace) MEC_fn_vDeleteBaseBackFace ( *p_lObstacle,p_stObstacle, p_stDynamic );
MEC_fn_vDeleteNoCollidedGroundFace (*p_lObstacle,p_stObstacle,p_stDynamic);
if (*p_lObstacle<=0) return FALSE;
if (DNM_M_bDynamicsIsHanging(p_stDynamic))
MEC_fn_vDeleteHangingObstacle (*p_lObstacle,p_stObstacle,p_stDynamic);
p_stStartTranslation = POS_fn_p_stGetTranslationVector (p_stStartPosition);
p_stEndTranslation = POS_fn_p_stGetTranslationVector (p_stEndPosition);
MTH3D_M_vSubVector ( &stMove, p_stStartTranslation, p_stEndTranslation );
MEC_fn_vComputeCollisionTranslation (*p_lObstacle,p_stObstacle,&stMove);
hSupObjMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_stSupObj);
POS_fn_vGetRotationVector ( hSupObjMatrix, &p_stX, &p_stY, &p_stZ );
for (lCounter=0; lCounter<*p_lObstacle; lCounter++)
{
p_stTmpObstacle = p_stObstacle+lCounter;
if (MEC_fn_bIsObstacleValid(p_stTmpObstacle))
{
ACP_tdxBool bCollisionOk = TRUE;
/* hands */
if (MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetMyMaterial(p_stTmpObstacle),C_xDNM_HAND_TYPE_GAME_MATERIAL))
{
bCollisionOk = FALSE;
if (MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_HANG_TYPE_GAME_MATERIAL) )
{
/* collide only hand with ground */
if (MEC_fn_bGroundObstacle(p_stDynamic,p_stTmpObstacle))
{
/* choose best hand obstacle */
MTH3D_M_vSubVector (&stVector,DNM_M_p_stObstacleGetContact(p_stTmpObstacle),POS_fn_p_stGetTranslationVector(hSupObjMatrix));
if (!MEC_fn_bIsNullVector(&stVector))
MTH3D_M_vNormalizeVector (&stVector,&stVector);
xDotProd = MTH_M_xAbs(MTH3D_M_xDotProductVector (p_stY,&stVector));
if (xDotProd>xDotProdMax)
{
xDotProdMax = xDotProd;
DNM_M_MecObstacleCopyClone ( &stHandObstacle, p_stTmpObstacle );
}
}
}
}
/* water */
else if (MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_WATER_TYPE_GAME_MATERIAL))
{
if (MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetMyMaterial(p_stTmpObstacle),C_xDNM_WATER_TYPE_GAME_MATERIAL))
{
if (!bWaterFace)
{
/* delete water back face */
xDotProd = MTH3D_M_xDotProductVector ( DNM_M_p_stObstacleGetNorm(p_stTmpObstacle),DNM_M_pObstacleGetZoneMove(p_stTmpObstacle) );
if ( MTH_M_bGreater ( MTH_M_xAbs ( MTH3D_M_xGetZofVector (DNM_M_pObstacleGetZoneMove(p_stTmpObstacle))), 0.03 ) )
{
if ( MTH_M_bLess(xDotProd, MTH_C_ZERO) )
{
MEC_fn_vReportCollision (p_stDynamic, p_stSupObj, 1, p_stTmpObstacle, 0);
/* the obstacle is used for repositionning only if required*/
bCollisionOk = fn_bBrainWaterCollideSO(p_stSupObj);
if (!bCollisionOk)
g_bWaterNoCollide = TRUE;
bWaterFace = TRUE;
}
else
bCollisionOk = FALSE;
}
else
{
MTH3D_M_vSubVector ( &stVector, DNM_M_p_stObstacleGetContact(p_stTmpObstacle), DNM_M_pObstacleGetZonePosition(p_stTmpObstacle) );
MTH3D_M_vAddVector ( &stVector, &stVector, DNM_M_pObstacleGetZoneMove(p_stTmpObstacle) );
xDotProd = MTH3D_M_xDotProductVector ( DNM_M_p_stObstacleGetNorm(p_stTmpObstacle),&stVector );
if (MTH_M_bLessEqual(xDotProd,MTH_C_ZERO))
{
MEC_fn_vReportCollision (p_stDynamic, p_stSupObj, 1, p_stTmpObstacle, 0);
bCollisionOk = fn_bBrainWaterCollideSO(p_stSupObj);
if (!bCollisionOk)
g_bWaterNoCollide = TRUE;
bWaterFace = TRUE;
}
else
bCollisionOk = FALSE;
}
if (MTH_M_bGreater(MTH3D_M_xGetZofVector(DNM_M_p_stObstacleGetNorm(p_stTmpObstacle)),MTH_C_ZERO))
bCollisionOk = FALSE;
}
else
{
bCollisionOk = FALSE;
}
}
else /*we do not report the collision because it does not exist: do not use the obstable for repositionning*/
bCollisionOk = FALSE;
}
else
{
/* No collision faces */
if (MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_NO_COLLISION_TYPE_GAME_MATERIAL))
{
/* Climb faces */
if (MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_CLIMB_TYPE_GAME_MATERIAL))
bCollisionOk = DNM_M_bDynamicsIsClimb(p_stDynamic);
/* Gi faces */
else if (MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_GI_TYPE_GAME_MATERIAL))
bCollisionOk = DNM_M_bDynamicsIsGi(p_stDynamic);
/* Other faces */
else if (MEC_fn_bTestMaskGameMaterial(DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_COLLISION_REPORT_MASK))
{
bCollisionOk=FALSE;
MEC_fn_vReportCollision (p_stDynamic, p_stSupObj, 1, p_stTmpObstacle, 0);
}
/* no report */
else bCollisionOk=FALSE;
}
}
if (!bCollisionOk) MEC_fn_vInvalidateObstacle(p_stTmpObstacle);
else bObstacleOk=TRUE;
}
}
/* report hand obstacle */
if (xDotProdMax != MTH_C_MinusONE)
MEC_fn_vReportCollision (p_stDynamic, p_stSupObj, 1, &stHandObstacle, 0);
return bObstacleOk;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool MEC_fn_bInCollision ( struct DNM_stDynamics *p_stDynamic, HIE_tdxHandleToSuperObject hSupObj )
{
/* DNM_tdstMecObstacle a_stObstacle[COL_C_xMaxNumberOfCollisions];*/
POS_tdxHandleToPosition hCurrentMatrix;
POS_tdxHandleToPosition hPreviousMatrix;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
return COL_lHaveITakeSThgIntoTheMug (g_a_stObstacle, hSupObj, hPreviousMatrix, hCurrentMatrix) > 0;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* report collide actor */
void MEC_fn_vReportCollideActor (HIE_tdxHandleToSuperObject hCollideSupObj,DNM_tdstMecObstacle* p_stCollideObstacle)
{
struct DNM_stDynamics* p_stDynamic;
DNM_tdstObstacle* p_stObstacle;
MTH3D_tdstVector stVector;
HIE_tdxHandleToSuperObject hSupObj;
hSupObj = DNM_M_p_stObstacleGetObject (p_stCollideObstacle);
if (!HIE_fn_bIsSuperObjectValid(hSupObj)) return;
hSupObj = MEC_fn_hGetFatherActor (hSupObj);
p_stDynamic= fn_p_stDynamGetDynamicsSO (hSupObj);
if (!p_stDynamic) return;
/* no report so nothing to do here */
if (!DNM_M_bDynamicsIsCollisionReport(p_stDynamic)) return;
/* flag */
DNM_M_ulReportAddSurfaceState (DNM_M_p_stDynamicsGetReport(p_stDynamic),C_WOT_ulForceMobile);
/* obstacle */
p_stObstacle = DNM_M_p_stReportGetCharacter ( DNM_M_p_stDynamicsGetReport(p_stDynamic) );
DNM_M_xObstacleSetRate (p_stObstacle,0);
MTH3D_M_vNegVector (&stVector,DNM_M_p_stObstacleGetNorm(p_stCollideObstacle));
DNM_M_ObstacleSetNorm (p_stObstacle,&stVector);
DNM_M_ObstacleSetContact (p_stObstacle,DNM_M_p_stObstacleGetContact(p_stCollideObstacle));
DNM_M_p_stObstacleSetObject (p_stObstacle,hCollideSupObj);
DNM_M_vObstacleSetCollidedMaterial (p_stObstacle,DNM_M_hObstacleGetMyMaterial(p_stCollideObstacle));
DNM_M_vObstacleSetMyMaterial (p_stObstacle,DNM_M_hObstacleGetCollidedMaterial(p_stCollideObstacle));
}
/* report collision */
void MEC_fn_vReportCollision
(
struct DNM_stDynamics* p_stDynamic,
HIE_tdxHandleToSuperObject hSupObj,
long lNbObstacle,
DNM_tdstMecObstacle a_stObstacle[COL_C_xMaxNumberOfCollisions],
long lObstacle
)
{
MTH_tdxReal xDotProduct;
MTH_tdxReal xPreviousRate, xCurrentRate;
MTH3D_tdstVector stVerticalVector;
MTH3D_tdstVector* p_stNormalVector;
DNM_tdstMecObstacle* p_stTmpObstacle = NULL;
long lCounter;
ACP_tdxBool bStop = FALSE;
ACP_tdxBool bHurt = FALSE;
ACP_tdxBool bObstacle = FALSE;
ACP_tdxBool bCeil = FALSE;
ACP_tdxBool bWall = FALSE;
ACP_tdxBool bGround = FALSE;
ACP_tdxBool bActor = FALSE;
ACP_tdxBool bWater = FALSE;
ACP_tdxBool bObstacleEdge;
ACP_tdxBool bCeilEdge;
ACP_tdxBool bWallEdge;
ACP_tdxBool bGroundEdge;
ACP_tdxBool bActorEdge;
ACP_tdxBool bWaterEdge;
ACP_tdxBool bEdge;
MTH3D_M_vSetVectorElements (&stVerticalVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
xPreviousRate = MTH_C_2;
for (lCounter=0; lCounter<lNbObstacle && !bStop; lCounter++)
{
p_stTmpObstacle = a_stObstacle + lCounter;
if (MEC_fn_bIsObstacleValid(p_stTmpObstacle))
{
xCurrentRate = DNM_M_xObstacleGetRate (p_stTmpObstacle);
if ( lCounter<=lObstacle || MTH_M_bEqual(xPreviousRate,xCurrentRate) )
{
p_stNormalVector = DNM_M_p_stObstacleGetNorm (p_stTmpObstacle);
bEdge = MEC_fn_bIsEdge (p_stTmpObstacle);
xPreviousRate = xCurrentRate;
/* obstacle */
if (!bObstacle)
{
DNM_M_MecReportSetObstacle (&g_stReport, p_stTmpObstacle);
bObstacleEdge = bEdge;
bObstacle = TRUE;
}
else if (bObstacleEdge && !bEdge)
{
DNM_M_MecReportSetObstacle (&g_stReport, p_stTmpObstacle);
bObstacleEdge = FALSE;
}
/* actor */
if
(
((DNM_M_eObstacleGetType(p_stTmpObstacle) & DNM_ObsType_Mobile) == DNM_ObsType_Mobile )
|| ((DNM_M_eObstacleGetType(p_stTmpObstacle) & DNM_ObsType_MobileWall) == DNM_ObsType_MobileWall )
)
{
if (!bActor)
{
DNM_M_MecReportSetCharacter (&g_stReport,p_stTmpObstacle);
bActorEdge = bEdge;
bActor = TRUE;
}
else if (bActorEdge && !bEdge)
{
DNM_M_MecReportSetCharacter (&g_stReport,p_stTmpObstacle);
bActorEdge = FALSE;
}
}
/* water */
if
(
(
MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_WATER_TYPE_GAME_MATERIAL)
&& MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetMyMaterial(p_stTmpObstacle),C_xDNM_WATER_TYPE_GAME_MATERIAL)
)
||
(
MEC_fn_bTypeOfGameMaterial (DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_NO_COLLISION_TYPE_GAME_MATERIAL)
&& MEC_fn_bTestMaskGameMaterial(DNM_M_hObstacleGetCollidedMaterial(p_stTmpObstacle),C_xDNM_COLLISION_REPORT_MASK)
)
)
{
/* water and no_collionable material are reported as water obstacles */
if (!bWater)
{
DNM_M_MecReportSetWater (&g_stReport,p_stTmpObstacle);
bWaterEdge = bEdge;
bWater = TRUE;
}
else if (bWaterEdge && !bEdge)
{
DNM_M_MecReportSetWater (&g_stReport,p_stTmpObstacle);
bWaterEdge = FALSE;
}
}
else
{
/* search collision type : wall or ground ? */
xDotProduct = MTH3D_M_xDotProductVector ( p_stNormalVector, &stVerticalVector );
if (xDotProduct>MEC_fn_xGroundLimit(p_stDynamic) )
{
/* ground */
if (!bGround)
{
DNM_M_MecReportSetGround (&g_stReport,p_stTmpObstacle);
bGroundEdge = bEdge;
bGround = TRUE;
}
else if (bGroundEdge && !bEdge)
{
DNM_M_MecReportSetGround (&g_stReport,p_stTmpObstacle);
bGroundEdge = FALSE;
}
}
else if (xDotProduct>MEC_fn_xWallLimit(p_stDynamic))
{
/* wall */
if (!bWall)
{
DNM_M_MecReportSetWall (&g_stReport,p_stTmpObstacle);
bWallEdge = bEdge;
bWall = TRUE;
}
else if (bWallEdge && !bEdge)
{
DNM_M_MecReportSetWall (&g_stReport,p_stTmpObstacle);
bWallEdge = FALSE;
}
}
else
{
/* ceil */
if (!bCeil)
{
DNM_M_MecReportSetCeil (&g_stReport,p_stTmpObstacle);
bCeilEdge = bEdge;
bCeil = TRUE;
}
else if (bCeilEdge && !bEdge)
{
DNM_M_MecReportSetCeil (&g_stReport,p_stTmpObstacle);
bCeilEdge = FALSE;
}
}
}
}
else bStop=TRUE;
}
}
if (bActor)
{
DNM_M_ulReportAddSurfaceState (&g_stReport,C_WOT_ulMobile);
MEC_fn_vReportCollideActor (hSupObj,DNM_M_p_stReportGetCharacter(&g_stReport));
}
if (bWater)
DNM_M_ulReportAddSurfaceState (&g_stReport,C_WOT_ulWater);
if (bGround)
{
DNM_M_ulReportAddSurfaceState (&g_stReport,C_WOT_ulGround);
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamic)) DNM_M_vDynamicsSetGroundNormal (p_stDynamic,DNM_M_p_stObstacleGetNorm(DNM_M_p_stReportGetGround(&g_stReport)));
}
if (bWall)
{
DNM_M_ulReportAddSurfaceState (&g_stReport,C_WOT_ulWall);
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamic)) DNM_M_vDynamicsSetWallNormal (p_stDynamic,DNM_M_p_stObstacleGetNorm(DNM_M_p_stReportGetWall(&g_stReport)));
}
if (bCeil)
DNM_M_ulReportAddSurfaceState (&g_stReport,C_WOT_ulCeiling);
}
void MEC_fn_vFillCollisionReport
(
struct DNM_stDynamics* p_stDynamic
)
{
DNM_tdstReport* p_stReport;
if (!DNM_M_bDynamicsIsCollisionReport(p_stDynamic)) return;
if (DNM_M_ulReportGetSurfaceState(&g_stReport)==0) return;
p_stReport = DNM_M_p_stDynamicsGetReport (p_stDynamic);
DNM_M_ReportSetObstacle ( p_stReport, DNM_M_p_stReportGetObstacle(&g_stReport) );
if ( DNM_M_ulReportGetSurfaceState(&g_stReport) & C_WOT_ulMobile )
{
DNM_M_ulReportAddSurfaceState (p_stReport,C_WOT_ulMobile);
DNM_M_ReportSetCharacter ( p_stReport, DNM_M_p_stReportGetCharacter(&g_stReport) );
}
if ( DNM_M_ulReportGetSurfaceState(&g_stReport) & C_WOT_ulWater )
{
DNM_M_ulReportAddSurfaceState (p_stReport,C_WOT_ulWater);
DNM_M_ReportSetWater ( p_stReport, DNM_M_p_stReportGetWater(&g_stReport) );
}
if ( DNM_M_ulReportGetSurfaceState(&g_stReport) & C_WOT_ulGround )
{
DNM_M_ulReportAddSurfaceState (p_stReport,C_WOT_ulGround);
DNM_M_ReportSetGround ( p_stReport, DNM_M_p_stReportGetGround(&g_stReport) );
}
if ( DNM_M_ulReportGetSurfaceState(&g_stReport) & C_WOT_ulWall )
{
DNM_M_ulReportAddSurfaceState (p_stReport,C_WOT_ulWall);
DNM_M_ReportSetWall ( p_stReport, DNM_M_p_stReportGetWall(&g_stReport) );
}
if ( DNM_M_ulReportGetSurfaceState(&g_stReport) & C_WOT_ulCeiling )
{
DNM_M_ulReportAddSurfaceState (p_stReport,C_WOT_ulCeiling);
DNM_M_ReportSetCeil ( p_stReport, DNM_M_p_stReportGetCeil(&g_stReport) );
}
}
ACP_tdxBool MEC_fn_vComputeAdjustVector (MTH3D_tdstVector *p_stAdjustVector, struct DNM_stDynamics* p_stDynamic, long lObstacle, DNM_tdstMecObstacle *p_stObstacle, long lObstacleMin)
{
long lCounter;
DNM_tdeObstacleType xObstacleType;
ACP_tdxBool bAdjustVector = FALSE;
/* XB 05/05/99 */
/* ACP_tdxBool bJustOneDynamic = TRUE; */
/* End XB 05/05/99 */
ACP_tdxBool bContinue;
ACP_tdxBool bConflict = FALSE;
/* XB 05/05/99 */
/* ACP_tdxBool bMobileWall = FALSE; */
/* End XB 05/05/99 */
DNM_tdstMecObstacle* p_stTmpObstacle, *p_stWaterObstacle;
MTH_tdxReal xDotProd;
MTH3D_tdstVector stNormalAdjustVector, stTangentAdjustVector, stVector;
MTH3D_tdstVector stAdjustAxis;
p_stWaterObstacle = NULL;
MTH3D_M_vNullVector (p_stAdjustVector);
for (lCounter=0; lCounter<lObstacle && !p_stWaterObstacle; lCounter++)
{
p_stTmpObstacle = p_stObstacle+lCounter;
if (MEC_fn_bIsObstacleValid(p_stTmpObstacle) && MEC_fn_bIsWater(p_stTmpObstacle))
p_stWaterObstacle = p_stTmpObstacle;
}
for (xObstacleType=DNM_ObsType_Scenery; xObstacleType<=DNM_ObsType_Mobile; xObstacleType++)
{
bContinue=TRUE;
for (lCounter=0; lCounter<lObstacle && bContinue; lCounter++)
{
p_stTmpObstacle = p_stObstacle+lCounter;
if ( (DNM_M_eObstacleGetType(p_stTmpObstacle) & xObstacleType) == xObstacleType )
{
if ( lCounter<=lObstacleMin || MEC_fn_bIsCollide(p_stTmpObstacle) )
{
if ( MEC_fn_bIsObstacleValid(p_stTmpObstacle) && !MEC_fn_bIsWater(p_stTmpObstacle) /*&& MTH_M_bDifferentZero(DNM_M_xObstacleGetRate(p_stTmpObstacle))*/ )
{
if (bAdjustVector)
{
MTH3D_M_vCopyVector (&stVector,DNM_M_xObstacleGetTranslation(p_stTmpObstacle));
if (!MEC_fn_bIsNullVector(p_stAdjustVector)) MTH3D_M_vNormalizeVector (&stAdjustAxis,p_stAdjustVector)
else MTH3D_M_vCopyVector (&stAdjustAxis,p_stAdjustVector);
xDotProd = MTH3D_M_xDotProductVector (&stAdjustAxis,&stVector);
// if (MTH_M_bLess(xDotProd,MTH_C_ZERO))
// if (MTH_M_bLess(xDotProd,MTH_C_MinusInv2))
// bConflict = TRUE;
// if (MTH_M_bGreater(xDotProd,MTH_C_MinusInv2))
if (MTH_M_bGreater(xDotProd,MTH_C_ZERO))
{
if (MTH_M_bLess(xDotProd,MTH3D_M_xNormVector(p_stAdjustVector)))
{
MTH3D_M_vMulScalarVector (&stNormalAdjustVector,xDotProd,&stAdjustAxis);
MTH3D_M_vSubVector (&stTangentAdjustVector,&stVector,&stNormalAdjustVector);
MTH3D_M_vAddVector (p_stAdjustVector, p_stAdjustVector, &stTangentAdjustVector );
}
else
{
MTH3D_M_vCopyVector (p_stAdjustVector,&stVector);
}
}
else
{
bConflict = TRUE;
if (xObstacleType==DNM_ObsType_Scenery)
{
MTH3D_M_vMulScalarVector (&stNormalAdjustVector,xDotProd,&stAdjustAxis);
MTH3D_M_vSubVector (&stTangentAdjustVector,&stVector,&stNormalAdjustVector);
MTH3D_M_vAddVector (p_stAdjustVector, p_stAdjustVector, &stTangentAdjustVector );
}
}
}
else
{
MTH3D_M_vCopyVector (p_stAdjustVector,DNM_M_xObstacleGetTranslation(p_stTmpObstacle));
bAdjustVector = TRUE;
}
}
}
else bContinue=FALSE;
}
}
}
/* adjust actor position under water*/
if (p_stWaterObstacle)
{
MTH3D_M_vNormalizeVector (&stAdjustAxis,DNM_M_p_stObstacleGetNorm(p_stWaterObstacle));
xDotProd = MTH3D_M_xDotProductVector ( &stAdjustAxis, p_stAdjustVector );
MTH3D_M_vMulScalarVector (&stNormalAdjustVector,MTH_M_xSub(xDotProd,MTH_M_xDoubleToReal(0.01)),&stAdjustAxis);
MTH3D_M_vSubVector (p_stAdjustVector,p_stAdjustVector,&stNormalAdjustVector);
MTH3D_M_vAddVector (p_stAdjustVector,p_stAdjustVector,DNM_M_xObstacleGetTranslation(p_stWaterObstacle));
}
return !bConflict;
}
void MEC_fn_vEdgeAnalysis ( struct DNM_stDynamics *p_stDynamic, long lObstacle, DNM_tdstMecObstacle *p_stObstacle, DNM_tdstMecObstacle *p_stGround )
{
long lCounter;
MTH3D_tdstVector stContact, stVector, stEdgeVector, stVector1;
DNM_tdstMecObstacle *p_stTmpObstacle;
DNM_tdstMecObstacle *p_stNotGround = NULL;
/* XB 05/05/99 */
/* ACP_tdxBool bGround = FALSE; */
/* End XB 05/05/99 */
ACP_tdxBool bNotGround = FALSE;
long lGround = 0;
MTH_tdxReal xDotProd;
/* XB 05/05/99 */
/* ACP_tdxBool bCanFall = FALSE; */
/* End XB 05/05/99 */
DNM_M_bDynamicsSetCanFall (p_stDynamic,FALSE);
/* no ground*/
if ( !p_stGround )
{
/* there is no ground pass to the function, so we continue as we have always done */
/* if there is no ground edge in the obstacles, we cannot fall (but what about no ground obstacle at all ?)*/
for
(
lCounter = 0, p_stTmpObstacle = p_stObstacle;
lCounter < lObstacle && !p_stGround;
lCounter ++, p_stTmpObstacle ++
)
{
if ( MEC_fn_bIsObstacleValid(p_stTmpObstacle) && MEC_fn_bGroundObstacle(p_stDynamic,p_stTmpObstacle) )
{
if ( MEC_fn_bIsEdge(p_stTmpObstacle) )
{
p_stGround = p_stTmpObstacle; /*record the obstacle we found too...*/
}
else return;
}
}
if (!p_stGround)
return;
}
else
{
/* we can only fall if current ground obsacle is an edge */
if ( !MEC_fn_bIsEdge(p_stGround) )
return;
}
/* ground is a double-edge*/
if (MEC_fn_bIsDoubleEdge(p_stGround)) return;
/*keep the contact position on an edge we found */
MTH3D_M_vCopyVector (&stContact,DNM_M_p_stObstacleGetContact(p_stGround));
/*compute the normed vector from the contact point to the center of the terminal zone position*/
MTH3D_M_vAddVector (&stVector1, DNM_M_pObstacleGetZonePosition(p_stGround), DNM_M_xObstacleGetTranslation(p_stGround));
MTH3D_M_vSubVector (&stVector1, &stVector1, &stContact);
MTH3D_M_vNormalizeVector (&stVector1,&stVector1);
for
(
lCounter = 0, p_stTmpObstacle = p_stObstacle;
lCounter < lObstacle;
lCounter ++, p_stTmpObstacle ++
)
{
if ( MEC_fn_bIsObstacleValid(p_stTmpObstacle) )
{
if ( MEC_fn_bGroundObstacle(p_stDynamic,p_stTmpObstacle) ) /*this one is a ground*/
{
if ( MEC_fn_bIsEdge(p_stTmpObstacle) )
{
/* same contact point ?*/
MTH3D_M_vSubVector (&stVector,&stContact,DNM_M_p_stObstacleGetContact(p_stTmpObstacle));
if ( MEC_fn_bIsNullVector(&stVector) ) lGround++;
}
else return; /*if any other obstacle is a non-edge, we cannot fall*/
}
else /*we find a non-ground edge*/
{
if (MEC_fn_bIsLowEdge(p_stTmpObstacle))
{
/*it is an edge, account for it in the number of different edge contact points*/
MTH3D_M_vSubVector (&stVector,&stContact,DNM_M_p_stObstacleGetContact(p_stTmpObstacle));
if ( MEC_fn_bIsNullVector(&stVector) ) /*at the same contact point than the ground edge*/
{
if ( MTH_M_bGreater(DNM_M_xDynamicsGetPreviousSlide (p_stDynamic),MTH_M_xDoubleToReal(0.5)) )
{
xDotProd = MTH3D_M_xDotProductVector ( DNM_M_p_stObstacleGetNorm(p_stGround), DNM_M_p_stObstacleGetNorm(p_stTmpObstacle) );
if (MTH_M_bGreater(xDotProd,MTH_M_xDoubleToReal(0.707)))
return;
}
xDotProd = MTH3D_M_xDotProductVector ( DNM_M_p_stObstacleGetNorm(p_stTmpObstacle), &stVector1 );
if ( !p_stNotGround && MTH_M_bGreaterZero(xDotProd) )
{
bNotGround = TRUE;
p_stNotGround = p_stTmpObstacle;
}
}
}
else if (MEC_fn_bWallObstacle(p_stDynamic,p_stTmpObstacle) && !MEC_fn_bIsHighEdge(p_stTmpObstacle))
{
MTH3D_M_vSubVector (&stVector,&stContact,DNM_M_p_stObstacleGetContact(p_stTmpObstacle));
xDotProd = MTH3D_M_xDotProductVector ( DNM_M_p_stObstacleGetNorm(p_stGround), &stVector );
if (MTH_M_bLessZero(xDotProd))
{
/* check we are on the ground side */
xDotProd = MTH3D_M_xDotProductVector ( DNM_M_p_stObstacleGetNorm(p_stTmpObstacle), &stVector );
if (MTH_M_bLess(xDotProd,MTH_M_xDoubleToReal(-1e-3)))
return;
}
}
}
}
}
if (lGround>=2) return;
/*here either we have a ground/non-ground obstable pair, or we have only a ground obstacle (bGround is true in either case)*/
/*compute the normed vector from the contact point to the center of the terminal zone position*/
// MTH3D_M_vAddVector (&stVector, DNM_M_pObstacleGetZonePosition(p_stGround), DNM_M_xObstacleGetTranslation(p_stGround));
// MTH3D_M_vSubVector (&stVector, &stVector, &stContact);
// MTH3D_M_vNormalizeVector (&stVector,&stVector);
if ( bNotGround )
{
MTH3D_M_vAddVector (&stEdgeVector,DNM_M_p_stObstacleGetNorm(p_stGround),DNM_M_p_stObstacleGetNorm(p_stNotGround));
bNotGround = !MEC_fn_bIsNullVector(&stEdgeVector); /*if the vector is null, we have only one edge normal (backface)*/
}
if ( bNotGround ) /*we have 2 edge normals*/
{
MTH_tdxReal xDotProd;
MTH3D_M_vNormalizeVector (&stEdgeVector,&stEdgeVector);
xDotProd = MTH3D_M_xDotProductVector (&stVector1,&stEdgeVector);
if ( MTH_M_bLessZero(xDotProd) )
return;
}
if ( MTH_M_bLess(MTH3D_M_xGetZofVector(&stVector1), C_xDNM_EDGE_GROUND_LIMIT) )
{
DNM_M_bDynamicsSetCanFall(p_stDynamic,TRUE);
/* compute fall translation */
if (DNM_M_bDynamicsIsComplexSize(p_stDynamic) )
{
MTH3D_M_vSetZofVector ( &stVector1, MTH_C_ZERO );
if (!MEC_fn_bIsNullVector(&stVector1)) MTH3D_M_vNormalizeVector (&stVector1,&stVector1)
else MTH3D_M_vNullVector (&stVector1);
DNM_M_vDynamicsSetFallTranslation (p_stDynamic,&stVector1);
}
}
}
/* is the actor */
void MEC_fn_vCrashAnalysis
(
struct DNM_stDynamics *p_stDynamic,
long lObstacle,
DNM_tdstMecObstacle *p_stObstacle
)
{
long lCounter;
DNM_tdstMecObstacle *p_stTmpObstacle;
DNM_tdstMecObstacle *p_stGroundObstacle, *p_stCeilObstacle;
p_stGroundObstacle = NULL;
p_stCeilObstacle = NULL;
DNM_M_vDynamicsSetCrash(p_stDynamic,FALSE);
p_stTmpObstacle = p_stObstacle;
for (lCounter=0; lCounter<lObstacle; lCounter++)
{
if ( MEC_fn_bIsObstacleValid(p_stTmpObstacle) )
{
if (!p_stGroundObstacle && MEC_fn_bGroundObstacle(p_stDynamic,p_stTmpObstacle))
p_stGroundObstacle = p_stTmpObstacle;
if (!p_stCeilObstacle && MEC_fn_bCeilObstacle(p_stDynamic,p_stTmpObstacle))
p_stCeilObstacle = p_stTmpObstacle;
}
p_stTmpObstacle++;
}
if (!p_stCeilObstacle || !p_stGroundObstacle)
return;
if
(
(
(DNM_M_eObstacleGetType(p_stGroundObstacle) & DNM_ObsType_Mobile)
&& MEC_fn_bCanCrashActor(p_stGroundObstacle)
)
||
(
(DNM_M_eObstacleGetType(p_stCeilObstacle) & DNM_ObsType_Mobile)
&& MEC_fn_bCanCrashActor(p_stCeilObstacle)
)
)
DNM_M_vDynamicsSetCrash(p_stDynamic,TRUE);
}

View File

@@ -0,0 +1,564 @@
/*
*=======================================================================================
* Name : MecOpt.c
* Author : J Th<54>noz Date : 01/05/98
* Description : Mechanic options
*=======================================================================================
*/
#include "MEC/MECInc.h"
#include "MEC/DnmDynam.h"
#include "MEC/ParsData.h"
#include "MEC/DNMSurSt.h"
#include "MEC/mbase.h"
#include "Extheade.h"
#include "COL.h"
#include "MEC/MecDef.h"
#include "MEC/MECOpt.h"
#include "MEC/MECTools.h"
/* private*/
/* Inertia */
void MEC_fn_vInertiaCoeff
(
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDT,
MTH_tdxReal xInertiaX,
MTH_tdxReal xInertiaY,
MTH_tdxReal xInertiaZ,
POS_tdxHandleToPosition hMatrix,
POS_tdxHandleToPosition hInvMatrix
)
{
MTH3D_tdstVector stTranslation, stPreviousTranslation, stMove;
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH3D_tdstVector *p_stCurrentPosition, *p_stPreviousPosition;
MTH3D_tdstVector *p_stSpeed;
MTH_tdxReal Ux, Uy, Uz;
MTH_tdxReal Vx, Vy, Vz;
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
p_stCurrentPosition = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
p_stPreviousPosition = POS_fn_p_stGetTranslationVector ( hPreviousMatrix );
MTH3D_M_vSubVector (&stTranslation, p_stCurrentPosition, p_stPreviousPosition);
MEC_fn_vInvertMatrix (p_stDynamic,hInvMatrix,hMatrix);
p_stSpeed = DNM_M_pDynamicsGetPreviousSpeed ( p_stDynamic );
MTH3D_M_vMulScalarVector (&stPreviousTranslation,xDT,p_stSpeed);
/* sub translation part without inertia */
if (!DNM_M_bDynamicsIsMechanicChange(p_stDynamic))
MTH3D_M_vSubVector (&stPreviousTranslation, &stPreviousTranslation, DNM_M_pDynamicsGetInertiaTranslation(p_stDynamic));
POS_fn_vRotateVector ( &stTranslation, hInvMatrix, &stTranslation );
POS_fn_vRotateVector ( &stPreviousTranslation, hInvMatrix, &stPreviousTranslation );
MTH3D_M_vGetVectorElements ( &Ux, &Uy, &Uz, &stTranslation );
MTH3D_M_vGetVectorElements ( &Vx, &Vy, &Vz, &stPreviousTranslation );
Vx = MTH_M_xAdd ( MTH_M_xMul(xInertiaX,MTH_M_xSub(Vx,Ux)),Ux);
Vy = MTH_M_xAdd ( MTH_M_xMul(xInertiaY,MTH_M_xSub(Vy,Uy)),Uy);
Vz = MTH_M_xAdd ( MTH_M_xMul(xInertiaZ,MTH_M_xSub(Vz,Uz)),Uz);
MTH3D_M_vSetVectorElements ( &stMove, Vx, Vy, Vz );
POS_fn_vRotateVector ( &stMove, hMatrix, &stMove );
MEC_fn_vRoundVector (&stMove,C_xDNM_REAL_PRECISION);
MTH3D_M_vAddVector ( p_stCurrentPosition, p_stPreviousPosition, &stMove );
}
/* Gravity */
void MEC_fn_vGravitySpeed
(
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDT
)
{
MTH_tdxReal xGravity = DNM_M_xDynamicsGetGravityFactor(p_stDynamic);
MTH3D_tdstVector *p_stPreviousTranslation, *p_stCurrentTranslation;
MTH3D_tdstVector *p_stSpeed;
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH_tdxReal xZ;
/* if gravity option is on and there's an obstacle and no slide -> no gravity */
if (DNM_M_bDynamicsIsNoGravity(p_stDynamic)) return;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
p_stPreviousTranslation = POS_fn_p_stGetTranslationVector ( hPreviousMatrix );
p_stCurrentTranslation = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
p_stSpeed = DNM_M_pDynamicsGetPreviousSpeed ( p_stDynamic );
xGravity = MTH_M_xMul ( xGravity, MTH_C_MinusONE );
xGravity = MTH_M_xMul ( xGravity, xDT );
xGravity = MTH_M_xAdd ( xGravity, MTH3D_M_xGetZofVector(p_stSpeed) );
xGravity = MTH_M_xMul ( xGravity, xDT );
/*
if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamic))
{
xGravity = MTH_M_xSub ( xGravity, MTH3D_M_xGetZofVector(DNM_M_pDynamicsGetInertiaTranslation(p_stDynamic)) );
}
*/
xZ = MTH_M_xAdd (MTH3D_M_xGetZofVector(p_stPreviousTranslation),xGravity);
MTH3D_M_vSetZofVector ( p_stCurrentTranslation, xZ );
}
/* inertia */
void MEC_fn_vInertia
(
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDT,
POS_tdxHandleToPosition hMatrix,
POS_tdxHandleToPosition hInvMatrix
)
{
if (DNM_M_bDynamicsIsInertia(p_stDynamic))
{
MTH_tdxReal xInertiaX = MEC_fn_xConvertScale(DNM_M_xDynamicsGetInertiaFactorX(p_stDynamic));
MTH_tdxReal xInertiaY = MEC_fn_xConvertScale(DNM_M_xDynamicsGetInertiaFactorY(p_stDynamic));
MTH_tdxReal xInertiaZ = MEC_fn_xConvertScale(DNM_M_xDynamicsGetInertiaFactorZ(p_stDynamic));
MEC_fn_vInertiaCoeff (p_stDynamic,xDT,xInertiaX,xInertiaY,xInertiaZ,hMatrix,hInvMatrix);
}
/* we are walking on a sliding ground -> slide by inertia */
if (DNM_M_bDynamicsIsOnGround (p_stDynamic))
{
if (DNM_M_bDynamicsIsSlidingGround(p_stDynamic))
{
MTH_tdxReal xSlide = DNM_M_xDynamicsGetPreviousSlide (p_stDynamic);
MTH_tdxReal xSildeFactorX, xSildeFactorY, xSildeFactorZ;
xSlide = MEC_fn_xConvertScale (xSlide);
xSildeFactorX = MTH_M_xMul ( xSlide, MEC_fn_xConvertScale (DNM_M_xDynamicsGetSlideFactorX(p_stDynamic)) );
xSildeFactorY = MTH_M_xMul ( xSlide, MEC_fn_xConvertScale (DNM_M_xDynamicsGetSlideFactorY(p_stDynamic)) );
xSildeFactorZ = MTH_M_xMul ( xSlide, MEC_fn_xConvertScale (DNM_M_xDynamicsGetSlideFactorZ(p_stDynamic)) );
MEC_fn_vInertiaCoeff (p_stDynamic,xDT,xSildeFactorX,xSildeFactorY,xSildeFactorZ,hMatrix,hInvMatrix);
}
}
}
/* Tilt */
void MEC_fn_vAddTiltSpeed
(
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDt
)
{
MTH3D_tdstVector *p_stPreviousI, *p_stPreviousJ, *p_stPreviousK;
MTH3D_tdstVector *p_stCurrentI, *p_stCurrentJ, *p_stCurrentK;
MTH3D_tdstVector stInitialTranslation, stVector;
MTH3D_tdstVector stOriginTranslation;
MTH3D_tdstVector *p_stCurrentTranslation;
MTH3D_tdstVector *p_stPreviousTranslation;
MTH_tdxReal xDotProd, xAngle;
MTH_tdxReal xTiltAngle, xInitTiltAngle;
MTH_tdxReal xInertia;
POS_tdxHandleToPosition hCurrentMatrix;
POS_tdxHandleToPosition hPreviousMatrix;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
xInertia = DNM_M_xDynamicsGetTiltInertia ( p_stDynamic );
POS_fn_vGetRotationVector ( hPreviousMatrix, &p_stPreviousI, &p_stPreviousJ, &p_stPreviousK);
POS_fn_vGetRotationVector ( hCurrentMatrix, &p_stCurrentI, &p_stCurrentJ, &p_stCurrentK);
xDotProd = MTH3D_M_xDotProductVector ( p_stPreviousI, p_stCurrentJ );
xAngle = MTH_M_xMul ( MTH_M_xMul ( xDotProd, DNM_M_xDynamicsGetTiltIntensity(p_stDynamic)) , MTH3D_M_xNormVector(DNM_M_pDynamicsGetPreviousSpeed(p_stDynamic)) );
xAngle = MTH_M_xDiv ( xAngle, MTH_M_xDoubleToReal(10) );
xTiltAngle = DNM_M_xDynamicsGetTiltAngle(p_stDynamic);
xInitTiltAngle = xTiltAngle;
xTiltAngle = MTH_M_xAdd ( MTH_M_xMul(xTiltAngle,xInertia), MTH_M_xMul(xAngle,MTH_M_xSub(MTH_C_ONE,xInertia)) );
xAngle = MTH_M_xSub ( xTiltAngle, xInitTiltAngle );
if (MTH_M_bDifferent ( xAngle, MTH_C_ZERO ) )
{
DNM_M_vDynamicsSetTiltAngle ( p_stDynamic, xTiltAngle );
MTH3D_M_vSetBaseJVector ( &stVector );
MTH3D_M_vMulScalarVector ( &stOriginTranslation, DNM_M_xDynamicsGetTiltOrigin(p_stDynamic), p_stCurrentK );
p_stCurrentTranslation = POS_fn_p_stGetTranslationVector (hCurrentMatrix);
p_stPreviousTranslation = POS_fn_p_stGetTranslationVector (hPreviousMatrix);
MTH3D_M_vCopyVector (&stInitialTranslation,p_stCurrentTranslation);
MTH3D_M_vCopyVector (p_stCurrentTranslation,&stOriginTranslation);
POS_fn_vRotatePositionAroundAxis (hCurrentMatrix, &stVector, xAngle);
MTH3D_M_vSubVector (&stVector, p_stCurrentTranslation, &stOriginTranslation);
MTH3D_M_vAddVector (p_stCurrentTranslation, &stInitialTranslation, &stVector);
}
}
void MEC_fn_vCancelTilt ( struct DNM_stDynamics *p_stDynamic )
{
MTH3D_tdstVector stInitialTranslation, stVector;
MTH3D_tdstVector *p_stCurrentI, *p_stCurrentJ, *p_stCurrentK;
MTH3D_tdstVector stOriginTranslation;
MTH3D_tdstVector *p_stTranslation;
POS_tdxHandleToPosition hCurrentMatrix;
MTH_tdxReal xAngle;
xAngle = DNM_M_xDynamicsGetTiltAngle(p_stDynamic);
if (MTH_M_bEqual(xAngle,MTH_C_ZERO)) return;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
POS_fn_vGetRotationVector ( hCurrentMatrix, &p_stCurrentI, &p_stCurrentJ, &p_stCurrentK);
p_stTranslation = POS_fn_p_stGetTranslationVector (hCurrentMatrix);
MTH3D_M_vSetBaseJVector ( &stVector );
MTH3D_M_vMulScalarVector ( &stOriginTranslation, DNM_M_xDynamicsGetTiltOrigin(p_stDynamic), p_stCurrentK );
MTH3D_M_vCopyVector (&stInitialTranslation,p_stTranslation);
MTH3D_M_vSubVector (p_stTranslation, p_stTranslation, &stOriginTranslation);
POS_fn_vRotatePositionAroundAxis (hCurrentMatrix, &stVector, MTH_M_xNeg(xAngle));
POS_fn_vSetTranslationVector (hCurrentMatrix,&stInitialTranslation);
DNM_M_vDynamicsSetTiltAngle (p_stDynamic,MTH_C_ZERO);
}
void MEC_fn_vImposeSpeed
(
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDT,
POS_tdxHandleToPosition hMatrix,
POS_tdxHandleToPosition hInvMatrix
)
{
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH3D_tdstVector *p_stPreviousPosition, *p_stCurrentPosition;
MTH3D_tdstVector stTranslation;
MTH3D_tdstVector* pstImposeSpeed;
MTH3D_tdstVector stImposeMove;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
pstImposeSpeed = DNM_M_pDynamicsGetImposeSpeed ( p_stDynamic );
MTH3D_M_vMulScalarVector ( &stImposeMove, xDT, pstImposeSpeed );
p_stPreviousPosition = POS_fn_p_stGetTranslationVector ( hPreviousMatrix );
p_stCurrentPosition = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
MTH3D_M_vSubVector ( &stTranslation, p_stCurrentPosition, p_stPreviousPosition);
if (DNM_M_bDynamicsIsRelativeImposeSpeed(p_stDynamic) && !MTH3D_M_bIsNullVector(&stTranslation))
{
MEC_fn_vInvertMatrix (p_stDynamic,hInvMatrix,hMatrix);
POS_fn_vRotateVector ( &stTranslation, hInvMatrix, &stTranslation );
}
if (DNM_M_bDynamicsIsImposeSpeedX(p_stDynamic)) MTH3D_M_vSetXofVector (&stTranslation,MTH3D_M_xGetXofVector(&stImposeMove));
if (DNM_M_bDynamicsIsImposeSpeedY(p_stDynamic)) MTH3D_M_vSetYofVector (&stTranslation,MTH3D_M_xGetYofVector(&stImposeMove));
if (DNM_M_bDynamicsIsImposeSpeedZ(p_stDynamic)) MTH3D_M_vSetZofVector (&stTranslation,MTH3D_M_xGetZofVector(&stImposeMove));
if (DNM_M_bDynamicsIsRelativeImposeSpeed(p_stDynamic) && !MTH3D_M_bIsNullVector(&stTranslation)) POS_fn_vRotateVector ( &stTranslation, hMatrix, &stTranslation );
MTH3D_M_vAddVector ( p_stCurrentPosition, p_stPreviousPosition, &stTranslation );
}
/*add speed*/
void MEC_fn_vAddSpeed
(
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDT,
POS_tdxHandleToPosition hMatrix,
POS_tdxHandleToPosition hInvMatrix
)
{
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH3D_tdstVector *p_stPreviousPosition, *p_stCurrentPosition;
MTH3D_tdstVector stTranslation;
MTH3D_tdstVector* pstAddSpeed;
MTH3D_tdstVector stAddMove;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
pstAddSpeed = DNM_M_pDynamicsGetAddSpeed ( p_stDynamic );
MTH3D_M_vMulScalarVector ( &stAddMove, xDT, pstAddSpeed );
p_stPreviousPosition = POS_fn_p_stGetTranslationVector ( hPreviousMatrix );
p_stCurrentPosition = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
MTH3D_M_vSubVector ( &stTranslation, p_stCurrentPosition, p_stPreviousPosition);
if (DNM_M_bDynamicsIsRelativeAddSpeed(p_stDynamic) && !MTH3D_M_bIsNullVector(&stTranslation))
{
MEC_fn_vInvertMatrix (p_stDynamic,hInvMatrix,hMatrix);
POS_fn_vRotateVector ( &stTranslation, hInvMatrix, &stTranslation );
}
if (DNM_M_bDynamicsIsAddSpeedX(p_stDynamic)) MTH3D_M_vSetXofVector (&stTranslation,MTH_M_xAdd(MTH3D_M_xGetXofVector(&stTranslation),MTH3D_M_xGetXofVector(&stAddMove)));
if (DNM_M_bDynamicsIsAddSpeedY(p_stDynamic)) MTH3D_M_vSetYofVector (&stTranslation,MTH_M_xAdd(MTH3D_M_xGetYofVector(&stTranslation),MTH3D_M_xGetYofVector(&stAddMove)));
if (DNM_M_bDynamicsIsAddSpeedZ(p_stDynamic)) MTH3D_M_vSetZofVector (&stTranslation,MTH_M_xAdd(MTH3D_M_xGetZofVector(&stTranslation),MTH3D_M_xGetZofVector(&stAddMove)));
if (DNM_M_bDynamicsIsRelativeAddSpeed(p_stDynamic) && !MTH3D_M_bIsNullVector(&stTranslation)) POS_fn_vRotateVector ( &stTranslation, hMatrix, &stTranslation );
MTH3D_M_vAddVector ( p_stCurrentPosition, p_stPreviousPosition, &stTranslation );
}
/* propose speed*/
void MEC_fn_vProposeSpeed
(
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDT,
POS_tdxHandleToPosition hMatrix,
POS_tdxHandleToPosition hInvMatrix
)
{
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH3D_tdstVector *p_stPreviousPosition, *p_stCurrentPosition;
MTH3D_tdstVector stTranslation;
MTH3D_tdstVector* pstProposeSpeed;
MTH3D_tdstVector stProposeMove;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
pstProposeSpeed = DNM_M_pDynamicsGetProposeSpeed ( p_stDynamic );
MTH3D_M_vMulScalarVector ( &stProposeMove, xDT, pstProposeSpeed );
p_stPreviousPosition = POS_fn_p_stGetTranslationVector ( hPreviousMatrix );
p_stCurrentPosition = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
MTH3D_M_vSubVector ( &stTranslation, p_stCurrentPosition, p_stPreviousPosition);
if (DNM_M_bDynamicsIsRelativeProposeSpeed(p_stDynamic) && !MTH3D_M_bIsNullVector(&stTranslation))
{
MEC_fn_vInvertMatrix (p_stDynamic,hInvMatrix,hMatrix);
POS_fn_vRotateVector ( &stTranslation, hInvMatrix, &stTranslation );
}
if (DNM_M_bDynamicsIsProposeSpeedX(p_stDynamic)) MTH3D_M_vSetXofVector (&stTranslation,MTH3D_M_xGetXofVector(&stProposeMove));
if (DNM_M_bDynamicsIsProposeSpeedY(p_stDynamic)) MTH3D_M_vSetYofVector (&stTranslation,MTH3D_M_xGetYofVector(&stProposeMove));
if (DNM_M_bDynamicsIsProposeSpeedZ(p_stDynamic)) MTH3D_M_vSetZofVector (&stTranslation,MTH3D_M_xGetZofVector(&stProposeMove));
if (DNM_M_bDynamicsIsRelativeProposeSpeed(p_stDynamic) && !MTH3D_M_bIsNullVector(&stTranslation)) POS_fn_vRotateVector ( &stTranslation, hMatrix, &stTranslation );
MTH3D_M_vAddVector ( p_stCurrentPosition, p_stPreviousPosition, &stTranslation );
}
/* stream speed*/
void MEC_fn_vAddStream (
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDT,
ACP_tdxBool bSlide
)
{
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH3D_tdstVector *p_stCurrentPosition;
MTH3D_tdstVector stTranslation;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
MEC_fn_vComputeStream ( &stTranslation, p_stDynamic, xDT, bSlide);
p_stCurrentPosition = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
MTH3D_M_vAddVector ( p_stCurrentPosition, p_stCurrentPosition, &stTranslation );
}
/* impose rotation matrix*/
void MEC_fn_vImposeRotation ( struct DNM_stDynamics *p_stDynamic )
{
MTH3D_tdstMatrix* p_stImposeRotationMatrix;
POS_tdxHandleToPosition hCurrentMatrix;
MTH3D_tdstVector stI, stJ, stK;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
p_stImposeRotationMatrix = DNM_M_p_stDynamicsGetImposeRotationMatrix (p_stDynamic);
/* rotation */
MTH3D_M_vGetVectorsInMatrix ( &stI, &stJ, &stK, p_stImposeRotationMatrix );
POS_fn_vSetRotationMatrix ( hCurrentMatrix, &stI, &stJ, &stK );
}
void MEC_fn_vAdditionnalTranslation ( struct DNM_stDynamics *p_stDynamic )
{
POS_tdxHandleToPosition hCurrentMatrix;
MTH3D_tdstVector *p_stTranslation;
MTH3D_tdstVector* p_stAdditionnalTranslation;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
p_stAdditionnalTranslation = DNM_M_pDynamicsGetAddTranslation (p_stDynamic);
p_stTranslation = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
MTH3D_M_vAddVector ( p_stTranslation, p_stTranslation, p_stAdditionnalTranslation);
}
void MEC_fn_vPositionLimit ( struct DNM_stDynamics *p_stDynamic, MTH3D_tdstVector* p_stSafePreviousPosition )
{
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH3D_tdstVector *p_stPreviousPosition, *p_stCurrentPosition;
if (!DNM_M_bDynamicsIsLimit(p_stDynamic)) return;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
p_stPreviousPosition = POS_fn_p_stGetTranslationVector ( hPreviousMatrix );
p_stCurrentPosition = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
if (DNM_M_bDynamicsIsLimitX(p_stDynamic))
{
MTH_tdxReal xXMin, xXMax, xX;
xXMin = MTH_M_xMin ( MTH3D_M_xGetXofVector (p_stPreviousPosition), MTH3D_M_xGetXofVector (p_stCurrentPosition) );
xXMax = MTH_M_xMax ( MTH3D_M_xGetXofVector (p_stPreviousPosition), MTH3D_M_xGetXofVector (p_stCurrentPosition) );
xX = MTH3D_M_xGetXofVector ( DNM_M_pDynamicsGetLimit(p_stDynamic) );
if ( MTH_M_bLessEqual(xXMin,xX) && MTH_M_bLess(xX,xXMax) )
{
MTH3D_M_vSetXofVector (p_stCurrentPosition,MTH3D_M_xGetXofVector(p_stSafePreviousPosition));
}
}
if (DNM_M_bDynamicsIsLimitY(p_stDynamic))
{
MTH_tdxReal xYMin, xYMax, xY;
xYMin = MTH_M_xMin ( MTH3D_M_xGetYofVector (p_stPreviousPosition), MTH3D_M_xGetYofVector (p_stCurrentPosition) );
xYMax = MTH_M_xMax ( MTH3D_M_xGetYofVector (p_stPreviousPosition), MTH3D_M_xGetYofVector (p_stCurrentPosition) );
xY = MTH3D_M_xGetYofVector ( DNM_M_pDynamicsGetLimit(p_stDynamic) );
if ( MTH_M_bLessEqual (xYMin,xY) && MTH_M_bLess (xY,xYMax) )
{
MTH3D_M_vSetYofVector (p_stCurrentPosition,MTH3D_M_xGetYofVector(p_stSafePreviousPosition));
}
}
if (DNM_M_bDynamicsIsLimitZ(p_stDynamic))
{
MTH_tdxReal xZMin, xZMax, xZ;
xZMin = MTH_M_xMin ( MTH3D_M_xGetZofVector (p_stPreviousPosition), MTH3D_M_xGetZofVector (p_stCurrentPosition) );
xZMax = MTH_M_xMax ( MTH3D_M_xGetZofVector (p_stPreviousPosition), MTH3D_M_xGetZofVector (p_stCurrentPosition) );
xZ = MTH3D_M_xGetZofVector ( DNM_M_pDynamicsGetLimit(p_stDynamic) );
if ( MTH_M_bLessEqual(xZMin,xZ) && MTH_M_bLess(xZ,xZMax) )
{
MTH3D_M_vSetZofVector (p_stCurrentPosition,MTH3D_M_xGetZofVector(p_stSafePreviousPosition));
}
}
}
/* speed limit */
void MEC_fn_vSpeedLimit
(
struct DNM_stDynamics *p_stDynamic,
MTH_tdxReal xDT,
POS_tdxHandleToPosition hMatrix,
POS_tdxHandleToPosition hInvMatrix
)
{
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH3D_tdstVector *p_stPreviousPosition, *p_stCurrentPosition;
MTH3D_tdstVector stMove;
MTH3D_tdstVector stCorrectMove;
MTH3D_tdstVector stMaxMove;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
/* global axis */
p_stPreviousPosition = POS_fn_p_stGetTranslationVector ( hPreviousMatrix );
p_stCurrentPosition = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
MTH3D_M_vSubVector ( &stMove, p_stCurrentPosition, p_stPreviousPosition );
/* local axis */
MEC_fn_vInvertMatrix (p_stDynamic,hInvMatrix,hMatrix);
POS_fn_vRotateVector ( &stMove, hInvMatrix, &stMove );
MTH3D_M_vCopyVector ( &stMaxMove, DNM_M_pDynamicsGetMaxSpeed(p_stDynamic) );
MTH3D_M_vMulScalarVector ( &stMaxMove, xDT, &stMaxMove );
MTH3D_M_vCopyVector ( &stCorrectMove, &stMove );
if (MTH_M_bGreater(MTH_M_xAbs(MTH3D_M_xGetXofVector(&stMove)),MTH3D_M_xGetXofVector(&stMaxMove)))
MTH3D_M_vSetXofVector ( &stCorrectMove, MTH_M_xMul ( MTH3D_M_xGetXofVector(&stMaxMove), MTH_M_xSign(MTH3D_M_xGetXofVector(&stMove))) );
if (MTH_M_bGreater(MTH_M_xAbs(MTH3D_M_xGetYofVector(&stMove)),MTH3D_M_xGetYofVector(&stMaxMove)))
MTH3D_M_vSetYofVector ( &stCorrectMove, MTH_M_xMul ( MTH3D_M_xGetYofVector(&stMaxMove), MTH_M_xSign(MTH3D_M_xGetYofVector(&stMove))) );
if (MTH_M_bGreater(MTH_M_xAbs(MTH3D_M_xGetZofVector(&stMove)),MTH3D_M_xGetZofVector(&stMaxMove)))
MTH3D_M_vSetZofVector ( &stCorrectMove, MTH_M_xMul ( MTH3D_M_xGetZofVector(&stMaxMove), MTH_M_xSign(MTH3D_M_xGetZofVector(&stMove))) );
/* global axis */
POS_fn_vRotateVector ( &stCorrectMove, hMatrix, &stCorrectMove );
MTH3D_M_vAddVector ( p_stCurrentPosition, p_stPreviousPosition, &stCorrectMove );
}
void MEC_fn_vAdjustScaleData
(
struct DNM_stDynamics *p_stDynamic,
POS_tdxHandleToPosition hMatrix,
POS_tdxHandleToPosition hInvMatrix
)
{
POS_tdxHandleToPosition hPreviousMatrix, hCurrentMatrix;
MTH3D_tdstVector *p_stPreviousPosition, *p_stCurrentPosition;
MTH3D_tdstVector stTranslation;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
hPreviousMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
/* invert matrix */
MEC_fn_vInvertMatrix (p_stDynamic,hInvMatrix,hMatrix);
/* animation */
p_stPreviousPosition = POS_fn_p_stGetTranslationVector ( hPreviousMatrix );
p_stCurrentPosition = POS_fn_p_stGetTranslationVector ( hCurrentMatrix );
MTH3D_M_vSubVector ( &stTranslation, p_stCurrentPosition, p_stPreviousPosition);
POS_fn_vRotateVector ( &stTranslation, hInvMatrix, &stTranslation );
MEC_fn_vAdjustScaleVector ( p_stDynamic, &stTranslation );
POS_fn_vRotateVector ( &stTranslation, hMatrix, &stTranslation );
MTH3D_M_vAddVector ( p_stCurrentPosition, p_stPreviousPosition, &stTranslation );
/* impose */
MTH3D_M_vCopyVector ( &stTranslation, DNM_M_pDynamicsGetImposeSpeed(p_stDynamic) );
if (!DNM_M_bDynamicsIsRelativeImposeSpeed(p_stDynamic)) POS_fn_vRotateVector ( &stTranslation, hInvMatrix, &stTranslation );
MEC_fn_vAdjustScaleVector ( p_stDynamic, &stTranslation );
if (!DNM_M_bDynamicsIsRelativeImposeSpeed(p_stDynamic)) POS_fn_vRotateVector ( &stTranslation, hMatrix, &stTranslation );
DNM_M_vDynamicsSetImposeSpeed (p_stDynamic,&stTranslation)
/* propose */
MTH3D_M_vCopyVector ( &stTranslation, DNM_M_pDynamicsGetProposeSpeed(p_stDynamic) );
if (!DNM_M_bDynamicsIsRelativeProposeSpeed(p_stDynamic)) POS_fn_vRotateVector ( &stTranslation, hInvMatrix, &stTranslation );
MEC_fn_vAdjustScaleVector ( p_stDynamic, &stTranslation );
if (!DNM_M_bDynamicsIsRelativeImposeSpeed(p_stDynamic)) POS_fn_vRotateVector ( &stTranslation, hMatrix, &stTranslation );
DNM_M_vDynamicsSetProposeSpeed (p_stDynamic,&stTranslation)
/* add */
MTH3D_M_vCopyVector ( &stTranslation, DNM_M_pDynamicsGetAddSpeed(p_stDynamic) );
if (!DNM_M_bDynamicsIsRelativeAddSpeed(p_stDynamic)) POS_fn_vRotateVector ( &stTranslation, hInvMatrix, &stTranslation );
MEC_fn_vAdjustScaleVector ( p_stDynamic, &stTranslation );
if (!DNM_M_bDynamicsIsRelativeImposeSpeed(p_stDynamic)) POS_fn_vRotateVector ( &stTranslation, hMatrix, &stTranslation );
DNM_M_vDynamicsSetAddSpeed (p_stDynamic,&stTranslation)
}

View File

@@ -0,0 +1,214 @@
/*
*=======================================================================================
* Name : MecPfm.c
* Author : J Th<54>noz Date : 01/05/98
* Description : Mechanic platform functions
*=======================================================================================
*/
#include "cpa_expt.h"
#include "ACP_Base.h"
#include "MEC/MECInc.h"
#include "MEC/DnmDynam.h"
#include "MEC/ParsData.h"
#include "MEC/DNMSurSt.h"
#include "MEC/mbase.h"
#include "Extheade.h"
#include "COL.h"
#include "MEC/MecDef.h"
#include "MEC/MECPfm.h"
#include "MEC/MECTools.h"
#include "PCS.h" /* Physical Collide Set */
#include "SCT.h" /* SeCTor*/
#include "FIL.h" /* SeCTor*/
#include "PRT.h" /* PaRTicules*/
#include "GAM.h" /* GAMe*/
void MEC_fn_vUpdatePlatform (DNM_tdstDynamics *p_stDynamic, HIE_tdxHandleToSuperObject hSupObj, POS_tdxHandleToPosition hPreviousReferenceMatrix, POS_tdxHandleToPosition hInvPreviousReferenceMatrix )
{
POS_tdxHandleToPosition hCurrentMatrix;
HIE_tdxHandleToSuperObject hChild;
DNM_tdxHandleToMecIdentityCard hIdCard;
ACP_tdxIndex i;
hCurrentMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
HIE_M_ForEachChildOf (hSupObj,hChild,i)
{
DNM_tdstDynamics* p_stChildDynamic;
/* child is an actor ? */
if (HIE_fn_ulGetSuperObjectType(hChild)==HIE_C_ulActor)
{
/* only if son has a base mechanic */
p_stChildDynamic = fn_p_stDynamGetDynamicsSO (hChild);
if (p_stChildDynamic)
{
hIdCard = DNM_M_pDynamicsGetCurrentIdCard (p_stChildDynamic);
if (hIdCard)
{
if (DNM_fn_eIdentityCardGetType(hIdCard)==DNM_eBase)
MEC_fn_vDynamicComputeAbsoluteMatrix (p_stChildDynamic,hChild,hPreviousReferenceMatrix,hInvPreviousReferenceMatrix,hCurrentMatrix);
}
}
}
}
}
ACP_tdxBool MEC_fn_vBasePlatformManagement ( struct DNM_stDynamics *p_stDynamic, HIE_tdxHandleToSuperObject hSupObj )
{
DNM_tdstMecObstacle* p_stObstacle;
HIE_tdxHandleToSuperObject hGeomSuperObject;
HIE_tdxHandleToSuperObject hObstacleSuperObject;
/* only for base mechanic */
if (!MEC_fn_bIsBaseMechanic(p_stDynamic)) return FALSE;
if ( DNM_M_ulReportGetSurfaceState (&g_stReport) & C_WOT_ulMobile )
{
p_stObstacle = DNM_M_p_stReportGetCharacter (&g_stReport);
hGeomSuperObject = DNM_M_p_stObstacleGetObject (p_stObstacle);
/* GI -> ceil Climb -> wall else -> ground */
if (DNM_M_bDynamicsIsGi(p_stDynamic))
{
if (!MEC_fn_bCeilObstacle(p_stDynamic,p_stObstacle)) return FALSE;
}
else if (DNM_M_bDynamicsIsClimb(p_stDynamic))
{
if (!MEC_fn_bWallObstacle(p_stDynamic,p_stObstacle) ) return FALSE;
}
else if (!MEC_fn_bGroundObstacle (p_stDynamic,p_stObstacle)) return FALSE;
if (HIE_fn_bIsSuperObjectValid(hGeomSuperObject))
{
hObstacleSuperObject = MEC_fn_hGetFatherActor (hGeomSuperObject);
if (HIE_fn_bIsSuperObjectValid(hObstacleSuperObject))
{
if (fn_bStandardGameIsAPlatform(hObstacleSuperObject))
{
if (fn_bStandardGameIsAPlatform(hSupObj) /* && ( fn_ucCollSetGetColliderPrioritySO(hSupObj) < fn_ucCollSetGetColliderPrioritySO(hObstacleSuperObject) )*/ ) return FALSE;
if (MEC_fn_bIsPlatform(p_stDynamic))
{
if (DNM_M_hDynamicsGetPlatformSO(p_stDynamic)==hObstacleSuperObject) return FALSE;
MEC_fn_vCutPlatformLink (p_stDynamic,hSupObj);
MEC_fn_vSetPlatformLink (p_stDynamic,hSupObj,hObstacleSuperObject);
return TRUE;
}
MEC_fn_vSetPlatformLink (p_stDynamic,hSupObj,hObstacleSuperObject);
return TRUE;
}
}
}
}
if (MEC_fn_bIsPlatform(p_stDynamic))
{
MEC_fn_vCutPlatformLink (p_stDynamic,hSupObj);
return TRUE;
}
return FALSE;
}
void MEC_fn_vSetPlatformLink (struct DNM_stDynamics *p_stDynamic, HIE_tdxHandleToSuperObject hSupObj, HIE_tdxHandleToSuperObject hFatherSupObj)
{
if (DNM_M_bDynamicsIsLockPlatform (p_stDynamic)) return;
DNM_M_vDynamicsSetPlatformSO (p_stDynamic,hFatherSupObj);
HIE_M_vIsolate(hSupObj); /* make sure its current father is no longer there*/
HIE_fn_vSuperObjectAddTail(hFatherSupObj, hSupObj); /* this is not a platform, so addtail*/
}
void MEC_fn_vCutPlatformLink (struct DNM_stDynamics *p_stDynamic, HIE_tdxHandleToSuperObject hSupObj)
{
if (DNM_M_bDynamicsIsLockPlatform (p_stDynamic)) return;
HIE_fn_vInvalidateSuperObject (&DNM_M_hDynamicsGetPlatformSO (p_stDynamic));
fn_vReputCharacterSuperObjectAtTheWorld (hSupObj);
}
void MEC_fn_vForcePlatformLink (struct DNM_stDynamics *p_stDynamic, HIE_tdxHandleToSuperObject hSupObj, HIE_tdxHandleToSuperObject hFatherSupObj)
{
MEC_fn_vSetPlatformLink ( p_stDynamic, hSupObj, hFatherSupObj);
DNM_M_bDynamicsSetLockPlatform (p_stDynamic, TRUE);
}
void MEC_fn_vFreePlatformLink (struct DNM_stDynamics *p_stDynamic, HIE_tdxHandleToSuperObject hSupObj )
{
DNM_M_bDynamicsSetLockPlatform (p_stDynamic, FALSE);
MEC_fn_vCutPlatformLink ( p_stDynamic, hSupObj );
}
/* Compute dynamics matrix when father move */
/* Author bq: J Th<54>noz */
/* Date : 1998-01-22 */
/* Version : 1.b00 */
/* Modify : yyyy-mm-dd */
void MEC_fn_vDynamicComputeAbsoluteMatrix
(
struct DNM_stDynamics *p_stDynamic,
HIE_tdxHandleToSuperObject hSupObj,
POS_tdxHandleToPosition hPreviousMatrix,
POS_tdxHandleToPosition hInvPreviousMatrix,
POS_tdxHandleToPosition hCurrentMatrix
)
{
POS_tdstCompletePosition stMatrix;
POS_tdxHandleToPosition hMatrix;
POS_tdxHandleToPosition hPreviousDynamicMatrix, hCurrentDynamicMatrix;
MTH3D_tdstVector stVector;
MTH3D_tdstVector *p_stI, *p_stJ, *p_stK;
MTH3D_tdstVector *p_stContact;
hPreviousDynamicMatrix = DNM_M_p_stDynamicsGetPreviousMatrix (p_stDynamic);
hCurrentDynamicMatrix = DNM_M_p_stDynamicsGetCurrentMatrix (p_stDynamic);
/* compute hMatrix to pass from previous reference of the platform to the current reference */
hMatrix = (POS_tdxHandleToPosition)&stMatrix;
POS_fn_vMulMatrixMatrix (hMatrix, hCurrentMatrix, hInvPreviousMatrix);
/* compute Z of actor in platform reference */
p_stContact = DNM_M_pDynamicsGetContact (p_stDynamic);
POS_fn_vGetTranslationVector ( hCurrentDynamicMatrix, &stVector );
MTH3D_M_vSubVector (&stVector,&stVector,p_stContact);
MTH3D_M_vSetXofVector ( &stVector, MTH_C_ZERO );
MTH3D_M_vSetYofVector ( &stVector, MTH_C_ZERO );
/* compute previous and current matrix of the actor due to platform move */
POS_fn_vMulMatrixMatrix ( hPreviousDynamicMatrix, hMatrix, hPreviousDynamicMatrix );
POS_fn_vMulMatrixMatrix ( hCurrentDynamicMatrix, hMatrix, hCurrentDynamicMatrix );
/* if option 'stick on platform' is not active, we correct rotation matrix of actor because we wants him to stay vertical */
if (!DNM_M_bDynamicsIsStickOnPlatform(p_stDynamic) && !MEC_fn_bIsEqualRotationMatrix (hPreviousMatrix,hCurrentMatrix) )
{
POS_fn_vGetRotationVector ( hPreviousDynamicMatrix, &p_stI, &p_stJ, &p_stK );
MTH3D_M_vSetZofVector ( p_stJ, MTH_C_ZERO );
MTH3D_M_vNormalizeVector ( p_stJ, p_stJ );
MTH3D_M_vSetBaseKVector( p_stK );
MTH3D_M_vCrossProductVectorWithoutBuffer(p_stI, p_stJ, p_stK);
MTH3D_M_vNormalizeVector ( p_stI, p_stI );
MEC_fn_vUpdateMatrix ( p_stDynamic, hPreviousDynamicMatrix );
POS_fn_vGetRotationVector ( hCurrentDynamicMatrix, &p_stI, &p_stJ, &p_stK );
MTH3D_M_vSetZofVector ( p_stJ, MTH_C_ZERO );
MTH3D_M_vNormalizeVector ( p_stJ, p_stJ );
MTH3D_M_vSetBaseKVector( p_stK );
MTH3D_M_vCrossProductVectorWithoutBuffer(p_stI, p_stJ, p_stK);
MTH3D_M_vNormalizeVector ( p_stI, p_stI );
MEC_fn_vUpdateMatrix ( p_stDynamic, hCurrentDynamicMatrix );
}
/* Update object matrix */
POS_fn_vCopyMatrix ( HIE_fn_hGetSuperObjectGlobalMatrix (hSupObj), hCurrentDynamicMatrix );
HIE_fn_vComputeNewRelativeMatrix (hSupObj);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,331 @@
# Microsoft Developer Studio Project File - Name="MEC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=MEC - Win32 Debug with Editors
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Mec.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Mec.mak" CFG="MEC - Win32 Debug with Editors"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "MEC - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "MEC - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "MEC - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE "MEC - Win32 Debug with Editors" (based on\
"Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/MEC", NICAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "MEC - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /I "x:\cpa\public\mec" /D "NDEBUG" /D "USE_PROFILER" /D "MEC_DEBUG" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\lib\MECP5_vr.lib"
!ELSEIF "$(CFG)" == "MEC - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "X:\CPA\Lib"
# PROP Intermediate_Dir "Tmp\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "X:\CPA\Public" /I "x:\cpa\public\mec" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "MEC_DEBUG" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\MECP5_vd.lib"
!ELSEIF "$(CFG)" == "MEC - Win32 Retail"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "MEC___Wi"
# PROP BASE Intermediate_Dir "MEC___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MD /W3 /GX /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "CPA_WANTS_EXPORT" /D "VISUAL" /D "RAYII" /D "RAY2EGYPTE" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /I "x:\cpa\public\mec" /D "NDEBUG" /D "RETAIL" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\lib\MECP5_vr.lib"
# ADD LIB32 /nologo /out:"X:\CPA\lib\MECP5_vf.lib"
!ELSEIF "$(CFG)" == "MEC - Win32 Debug with Editors"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "MEC___Wi"
# PROP BASE Intermediate_Dir "MEC___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "MEC___Wi"
# PROP Intermediate_Dir "MEC___Wi"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /W3 /GX /Z7 /Od /I "X:\CPA\Public" /D "_DEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /D "MEC_DEBUG" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "x:\cpa\public\mec" /I "X:\CPA\Public" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /D "MEC_DEBUG" /D "ACTIVE_EDITOR" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\Lib\MECP5_vd.lib"
# ADD LIB32 /nologo /out:"X:\CPA\Lib\MECP5Evd.lib"
!ENDIF
# Begin Target
# Name "MEC - Win32 Release"
# Name "MEC - Win32 Debug"
# Name "MEC - Win32 Retail"
# Name "MEC - Win32 Debug with Editors"
# Begin Group "Include"
# PROP Default_Filter ".h"
# Begin Source File
SOURCE=..\..\public\MEC\dnmcame.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\dnmdynam.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\dnmldmat.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\DNMLinkI.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\dnmlkmat.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\DNMLoadI.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\dnmmecid.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\DNMMth.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\DNMObsta.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\DNMObsTy.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\DNMRepor.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\DNMSLAVE.H
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\DNMSurSt.h
# End Source File
# Begin Source File
SOURCE=.\extheade.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\hIdCard.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\hMecMatC.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\macdpid.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\mbase.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MCAMIC.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MecBase.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MecBhv.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MecCol.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MECDef.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MecInc.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MecMatCa.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MECOpt.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MECPfm.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\MecTools.h
# End Source File
# Begin Source File
SOURCE=..\..\public\MEC\ParsData.h
# End Source File
# End Group
# Begin Group "Source"
# PROP Default_Filter "*.c"
# Begin Source File
SOURCE=.\DNMCame.c
# End Source File
# Begin Source File
SOURCE=.\DNMDynam.c
# End Source File
# Begin Source File
SOURCE=.\specif\dnmldmat.c
# End Source File
# Begin Source File
SOURCE=.\specif\DNMLinkI.c
# End Source File
# Begin Source File
SOURCE=.\dnmlkmat.c
# End Source File
# Begin Source File
SOURCE=.\specif\DNMLoadI.c
# End Source File
# Begin Source File
SOURCE=.\DNMMTH.c
# End Source File
# Begin Source File
SOURCE=.\DNMRepor.c
# End Source File
# Begin Source File
SOURCE=.\hidcard.c
# End Source File
# Begin Source File
SOURCE=.\hMecMatC.c
# End Source File
# Begin Source File
SOURCE=.\mbase.c
# End Source File
# Begin Source File
SOURCE=.\MECBase.c
# End Source File
# Begin Source File
SOURCE=.\MECBhv.c
# End Source File
# Begin Source File
SOURCE=.\MECCol.c
# End Source File
# Begin Source File
SOURCE=.\MecMatCa.c
# End Source File
# Begin Source File
SOURCE=.\MECOpt.c
# End Source File
# Begin Source File
SOURCE=.\MECPfm.c
# End Source File
# Begin Source File
SOURCE=.\MECTools.c
# End Source File
# End Group
# Begin Source File
SOURCE=.\Mec.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,947 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="MEC"
ProjectGUID="{F4F60039-2EF5-4449-8AD1-8D1BF5E20247}"
SccProjectName="&quot;$/cpa/tempgrp/MEC&quot;, NICAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="X:\CPA\Libd"
IntermediateDirectory=".\Tmp\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public,x:\cpa\public\mec"
PreprocessorDefinitions="_DEBUG;USE_PROFILER;MTH_CHECK;MEC_DEBUG;VISUAL;WIN32"
RuntimeLibrary="5"
PrecompiledHeaderFile=".\Tmp\Debug/Mec.pch"
AssemblerListingLocation=".\Tmp\Debug/"
ObjectFile=".\Tmp\Debug/"
ProgramDataBaseFileName=".\Tmp\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Libd\MECP5_vd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public,x:\cpa\public\mec"
PreprocessorDefinitions="NDEBUG;USE_PROFILER;MEC_DEBUG;VISUAL;WIN32"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Tmp\Release/Mec.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\lib\MECP5_vr.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug with Editors|Win32"
OutputDirectory=".\MEC___Wi"
IntermediateDirectory=".\MEC___Wi"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\cpa\public\mec,X:\CPA\Public"
PreprocessorDefinitions="_DEBUG;USE_PROFILER;MTH_CHECK;MEC_DEBUG;ACTIVE_EDITOR;VISUAL;WIN32;CPA_WANTS_EXPORT"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\MEC___Wi/Mec.pch"
AssemblerListingLocation=".\MEC___Wi/"
ObjectFile=".\MEC___Wi/"
ProgramDataBaseFileName=".\MEC___Wi/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Libd\MECP5Evd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Retail|Win32"
OutputDirectory="x:/cpa/lib"
IntermediateDirectory=".\tmp/retail"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public,x:\cpa\public\mec"
PreprocessorDefinitions="NDEBUG;RETAIL;VISUAL;WIN32"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\tmp/retail/Mec.pch"
AssemblerListingLocation=".\tmp/retail/"
ObjectFile=".\tmp/retail/"
ProgramDataBaseFileName=".\tmp/retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\lib\MECP5_vf.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Include"
Filter=".h">
<File
RelativePath="..\..\public\MEC\dnmcame.h">
</File>
<File
RelativePath="..\..\public\MEC\dnmdynam.h">
</File>
<File
RelativePath="..\..\public\MEC\dnmldmat.h">
</File>
<File
RelativePath="..\..\public\MEC\DNMLinkI.h">
</File>
<File
RelativePath="..\..\public\MEC\dnmlkmat.h">
</File>
<File
RelativePath="..\..\public\MEC\DNMLoadI.h">
</File>
<File
RelativePath="..\..\public\MEC\dnmmecid.h">
</File>
<File
RelativePath="..\..\public\MEC\DNMMth.h">
</File>
<File
RelativePath="..\..\public\MEC\DNMObsta.h">
</File>
<File
RelativePath="..\..\public\MEC\DNMObsTy.h">
</File>
<File
RelativePath="..\..\public\MEC\DNMRepor.h">
</File>
<File
RelativePath="..\..\public\MEC\DNMSLAVE.H">
</File>
<File
RelativePath="..\..\public\MEC\DNMSurSt.h">
</File>
<File
RelativePath="extheade.h">
</File>
<File
RelativePath="..\..\public\MEC\hIdCard.h">
</File>
<File
RelativePath="..\..\public\MEC\hMecMatC.h">
</File>
<File
RelativePath="..\..\public\MEC\macdpid.h">
</File>
<File
RelativePath="..\..\public\MEC\mbase.h">
</File>
<File
RelativePath="..\..\public\MEC\MCAMIC.h">
</File>
<File
RelativePath="..\..\public\MEC\MecBase.h">
</File>
<File
RelativePath="..\..\public\MEC\MecBhv.h">
</File>
<File
RelativePath="..\..\public\MEC\MecCol.h">
</File>
<File
RelativePath="..\..\public\MEC\MECDef.h">
</File>
<File
RelativePath="..\..\public\MEC\MecInc.h">
</File>
<File
RelativePath="..\..\public\MEC\MecMatCa.h">
</File>
<File
RelativePath="..\..\public\MEC\MECOpt.h">
</File>
<File
RelativePath="..\..\public\MEC\MECPfm.h">
</File>
<File
RelativePath="..\..\public\MEC\MecTools.h">
</File>
<File
RelativePath="..\..\public\MEC\ParsData.h">
</File>
</Filter>
<Filter
Name="Source"
Filter="*.c">
<File
RelativePath="DNMCame.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="DNMDynam.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="specif\dnmldmat.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="specif\DNMLinkI.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="dnmlkmat.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="specif\DNMLoadI.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="DNMMTH.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="DNMRepor.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="hidcard.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="hMecMatC.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="mbase.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MECBase.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MECBhv.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MECCol.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MecMatCa.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MECOpt.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MECPfm.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="MECTools.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<File
RelativePath="Mec.mak">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,29 @@
#include "MEC/MecMatCa.h"
/* Give handle a semantic */
/* Author : JM Soudagne */
/* Date : 1996-12-27 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
DNM_tdstMecMatCharacteristics *DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(DNM_tdxHandleToMecMatCharacteristics _hMatCharacteristics)
{
return (DNM_tdstMecMatCharacteristics *)_hMatCharacteristics;
}
/* Default initialisation (Recommended !!!) */
/* Author : JM Soudagne */
/* Date : 1997-03-18 */
/* Version : 1.01 */
/* Modify : 1997-05-28 */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void DNM_fn_vMecMatCharacteristicsInitDefault(DNM_tdstMecMatCharacteristics *_p_stMecMatCharacteristics)
{
static MTH_tdxReal s_xSlide = MTH_M_xDoubleToReal(0.);
static MTH_tdxReal s_xRebound = MTH_M_xDoubleToReal(0.);
DNM_M_xMatCharacteristicsSetSlide(_p_stMecMatCharacteristics,s_xSlide);
DNM_M_xMatCharacteristicsSetRebound(_p_stMecMatCharacteristics,s_xRebound);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,107 @@
#include "MEC/dnmlkmat.h"
#include "acp_base.h"
/*#include "BIN.h"*/
/* Private Link Table */
#if !defined(U64)
SCR_tdst_Link_Table stLinkTableOfMecMatCharacteristics;
#endif /* U64 */
/*----------------------*/
/* Init Functions */
/*----------------------*/
/* Author : Jean-Marc Soudagne */
/* Date : 1997-04-08 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
void DNM_fn_vInitLinkTableOfMecMatCharacteristics()
{
#if !defined(U64)
SCR_fn_v_Link_InitTable(&stLinkTableOfMecMatCharacteristics);
#endif /* U64 */
}
/*----------------------*/
/* Create an Entry */
/*----------------------*/
/* Author : Jean-Marc Soudagne */
/* Date : 1997-04-08 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
void DNM_fn_vSetValueInLinkTableOfMecMatCharacteristics( char *_p_szKey,unsigned long _ulValue)
{
#if !defined(U64)
SCR_fnp_st_Link_SetValue(&stLinkTableOfMecMatCharacteristics,_p_szKey,_ulValue);
#endif /* U64 */
}
/*----------------------*/
/* Find Handle with Key */
/*----------------------*/
/* Author : Jean-Marc Soudagne */
/* Date : 1997-04-08 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
unsigned long DNM_fn_ulLink_SearchKeyInLinkTableOfMecMatCharacteristics( char *_p_szKey)
{
#if !defined(U64)
return SCR_M_ul_Link_GetValue(SCR_fnp_st_Link_SearchKey(&stLinkTableOfMecMatCharacteristics,_p_szKey));
#else
/* XB 05/05/99 */
/* unsigned long ul; */
/* return ul; */
return 0L;
/* End XB 05/05/99 */
#endif /* U64 */
}
/*----------------------*/
/* Find Key with Handle */
/*----------------------*/
/* Author : Jean-Marc Soudagne */
/* Date : 1997-04-08 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
char * DNM_fn_p_cSearchValueInLinkTableOfMecMatCharacteristics( unsigned long _ulValue)
{
#if !defined(U64)
return SCR_M_p_sz_Link_GetKey(SCR_fnp_st_Link_SearchValue(&stLinkTableOfMecMatCharacteristics,_ulValue));
#else
/* XB 05/05/99 */
/* char *pChar; */
/* return pChar; */
return NULL;
/* End XB 05/05/99 */
#endif /* U64 */
}
/*----------------------*/
/* Get the Table */
/*----------------------*/
/* Author : Benoit Germain */
/* Date : 1997-04-28 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
#if !defined(U64)
SCR_tdst_Link_Table *DNM_fn_p_stGetLinkTableOfMecMatCharacteristics()
{
return &stLinkTableOfMecMatCharacteristics;
}
#endif /* U64 */
/*---------------------------------------*/
/* Prepare the Table for the binary save */
/*---------------------------------------*/
/* Author : Alain Robin */
/* Date : 1997-08-04 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
/*
void DNM_fn_vPrepareSaveMaterialBinaryBloc()
{
#if !defined (U64)
BIN_fn_vCreateBinaryIds(DNM_fn_p_stGetLinkTableOfMecMatCharacteristics(),BIN_C_MMTID);
#endif // U64
}
*/

View File

@@ -0,0 +1,61 @@
#ifndef __EXTHEADE_H__
#define __EXTHEADE_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Return the number of collisions */
/*extern long COL_lHaveITakeSThgIntoTheMug(
DNM_tdstObstacle *_p_stResultObstacle,
HIE_tdxHandleToSuperObject _hSupObj,
POS_tdstCompletePosition *_p_stAbsoluteStartPosition,
POS_tdstCompletePosition *_p_stAbsoluteEndSPosition);
*/
extern ACP_tdxBool COL_fn_bHaveITakeSThgIntoTheMugStatic (
DNM_tdstMecObstacle *_p_stResultObstacle,
HIE_tdxHandleToSuperObject _p_stSupObj,
struct POS_stCompletePosition *_p_stPosition );
/* Average velocity */
/*extern void fn_vAverageSpeed(HIE_tdxHandleToSuperObject p_stSuperObj,MTH_tdxReal xTimeWindow,MTH3D_tdstVector *p_result);*/
/* break the FSL link */
/*void fn_vReputCharacterSuperObjectAtTheWorld(HIE_tdxHandleToSuperObject h_SupObject);*/
/*extern void fn_vReputCharacterSuperObjectAtTheWorld(HIE_tdxHandleToSuperObject p_stSupObject);*/
/*extern void GAM_fn_vChangeFather(HIE_tdxHandleToSuperObject _hSprObj, HIE_tdxHandleToSuperObject _hNewFather);*/
/* To compute Fluid Speed due to Streams in sector */
extern MTH3D_tdstVector *ComputeStreamSpeedForActiveSector(HIE_tdxHandleToSuperObject hChar,HIE_tdxHandleToSuperObject hActiveSector,MTH3D_tdstVector *p_stFinalSpeed);
extern CPA_EXPORT HIE_tdxHandleToSuperObject GAM_fn_hGetCurrentSector(HIE_tdxHandleToSuperObject);
/*extern ACP_tdxBool fn_bStandardGameIsAPlatform (HIE_tdxHandleToSuperObject hSupObj);*/
/*extern struct DNM_stDynamics* fn_p_stDynamGetDynamicsSO (HIE_tdxHandleToSuperObject hSupObj);*/
extern CPA_EXPORT unsigned long fn_ulStandardGameGetCustomBitsSO (HIE_tdxHandleToSuperObject hSupObj);
/*extern CPA_EXPORT ACP_tdxBool fn_bBrainWaterCollideSO (HIE_tdxHandleToSuperObject hSupObj);*/
extern CPA_EXPORT unsigned char fn_ucCollSetGetCollComputeFrequencySO(HIE_tdxHandleToSuperObject hSuperObj);
extern CPA_EXPORT long COL_fn_lFindNormal (HIE_tdxHandleToSuperObject _hSuperObject,MTH3D_tdstVector *_p_stPoint,MTH3D_tdstVector *_p_a2_stNormal);
extern CPA_EXPORT ACP_tdxBool fn_bGetCharacterNoCollisionWithMap (HIE_tdxHandleToSuperObject _hSuperObject);
extern CPA_EXPORT ACP_tdxBool fn_bGetCharacterForceCollisionWhenNotMoving (HIE_tdxHandleToSuperObject _hSuperObject);
extern CPA_EXPORT void fn_vSetCharacterNoCollisionWithMap (HIE_tdxHandleToSuperObject _hSuperObject, ACP_tdxBool _bValue);
extern CPA_EXPORT unsigned char fn_ucCollSetGetColliderPrioritySO (HIE_tdxHandleToSuperObject _hSuperObject);
extern CPA_EXPORT char* AI_fn_pszGetActorName (HIE_tdxHandleToSuperObject hSupObj);
extern CPA_EXPORT char* AI_fn_pszGetFamilyName (HIE_tdxHandleToSuperObject hSupObj, char* szBuffer);
extern CPA_EXPORT unsigned char fn_ucIsAnAlwaysObject(struct tdstEngineObject_ *p_stEngineObject);
/* XB 05/05/99 : it is an inline function !!! */
#ifndef U64
extern CPA_EXPORT tdxHandleToState fn_h3dDataGetInitialStateSO (HIE_tdxHandleToSuperObject hSuperObj);
#endif /* U64 */
/* End XB 05/05/99 */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,155 @@
#include "cpa_std.h"
#include "MEC/MecMatCa.h"
#include "MMG.h"
/*--------------------------------------*/
/* Memory management of Geometry Module */
/*--------------------------------------*/
#include "GEO.h"
/* Invalidate the handle */
/* Author : JM Soudagne */
/* Date : 1996-01-07 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
void DNM_fn_vInvalidateMatCharacteristics(DNM_tdxHandleToMecMatCharacteristics *_p_hMatCharacteristics)
{
#ifdef DNM_DEBUG
if(_p_hMatCharacteristics == NULL)
return ;
#endif
*_p_hMatCharacteristics = NULL;
}
/* Handle is valid ? */
/* Author : JM Soudagne */
/* Date : 1996-01-07 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
CPA_EXPORT ACP_tdxBool DNM_fn_bIsMatCharacteristicsValid(DNM_tdxHandleToMecMatCharacteristics _hMatCharacteristics)
{
return _hMatCharacteristics != NULL;
}
/*----------------------*/
/* Create a handle */
/*----------------------*/
/* Author : JM Soudagne */
/* Date : 1996-01-17 */
/* Version : 1.01 */
/* Modify : 1997-05-12 */
/*----------------------*/
DNM_tdxHandleToMecMatCharacteristics DNM_fn_xMatCharacteristicsCreate()
{
void *p_stResult = NULL;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeMEC , MMG_C_lSubTypeMecMatCharacteristic , NULL);
GEO_M_CPAMalloc(p_stResult, void * , sizeof(DNM_tdstMecMatCharacteristics),E_uwGEONotEnoughtMemory);
return (DNM_tdxHandleToMecMatCharacteristics)p_stResult;
}
/*----------------------*/
/* Destroy a handle */
/*----------------------*/
/* Author : JM Soudagne */
/* Date : 1996-01-17 */
/* Version : 1.00 */
/* Modify : 1997-02-10 */
/*----------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void DNM_fn_vMatCharacteristicsDestroy(DNM_tdxHandleToMecMatCharacteristics _hOld)
{
GEO_M_CPAFree((void *)_hOld);
}
/* Copy a handle */
/* Author : JM Soudagne */
/* Date : 1996-01-17 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
void DNM_fn_vMatCharacteristicsCopy(DNM_tdxHandleToMecMatCharacteristics _hDst,DNM_tdxHandleToMecMatCharacteristics _hSrc)
{
/*FB030898 */
/*DNM_M_MatCharacteristicsCopyClone(DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(_hDst),DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(_hSrc));*/
DNM_M_MatCharacteristicsCopyClone((DNM_tdstMecMatCharacteristics *)(_hDst),(DNM_tdstMecMatCharacteristics *)(_hSrc));
/*END FB*/
}
/* Accessor */
/* Author : J Th<54>noz */
/* Date : 1997-31-12 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
MTH_tdxReal DNM_fn_xMatCharacteristicsGetSlide (DNM_tdxHandleToMecMatCharacteristics _hMatCharacteristics)
{
#ifdef DNM_DEBUG
if(!DNM_fn_bIsMatCharacteristicsValid(_hMatCharacteristics))
return MTH_M_xDoubleToReal(0.); /* Default value */
#endif
/*FB030898*/
/*return DNM_M_xMatCharacteristicsGetSlide(DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(_hMatCharacteristics));*/
return DNM_M_xMatCharacteristicsGetSlide((DNM_tdstMecMatCharacteristics *)(_hMatCharacteristics));
/*END FB*/
}
/* Accessor */
/* Author : J Th<54>noz */
/* Date : 1997-31-12 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
MTH_tdxReal DNM_fn_xMatCharacteristicsSetSlide(DNM_tdxHandleToMecMatCharacteristics _hMatCharacteristics,
MTH_tdxReal _xValue)
{
#ifdef DNM_DEBUG
if(!DNM_fn_bIsMatCharacteristicsValid(_hMatCharacteristics))
return MTH_M_xDoubleToReal(0.); /* Default value */
#endif
/*FB030898*/
/*return DNM_M_xMatCharacteristicsSetSlide(DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(_hMatCharacteristics),_xValue);*/
return DNM_M_xMatCharacteristicsSetSlide((DNM_tdstMecMatCharacteristics *)(_hMatCharacteristics),_xValue);
/*END FB*/
}
/* Accessor */
/* Author : J Th<54>noz */
/* Date : 1997-31-12 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
MTH_tdxReal DNM_fn_xMatCharacteristicsGetRebound (DNM_tdxHandleToMecMatCharacteristics _hMatCharacteristics)
{
#ifdef DNM_DEBUG
if(!DNM_fn_bIsMatCharacteristicsValid(_hMatCharacteristics))
return MTH_M_xDoubleToReal(1.); /* Default value */
#endif
/*FB030898*/
/*return DNM_M_xMatCharacteristicsGetRebound(DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(_hMatCharacteristics));*/
return DNM_M_xMatCharacteristicsGetRebound((DNM_tdstMecMatCharacteristics *)(_hMatCharacteristics));
/*END FB*/
}
/* Accessor */
/* Author : J Th<54>noz */
/* Date : 1997-31-12 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
MTH_tdxReal DNM_fn_xMatCharacteristicsSetRebound(DNM_tdxHandleToMecMatCharacteristics _hMatCharacteristics,
MTH_tdxReal _xValue)
{
#ifdef DNM_DEBUG
if(!DNM_fn_bIsMatCharacteristicsValid(_hMatCharacteristics))
return MTH_M_xDoubleToReal(1.); /* Default value */
#endif
/*FB030898*/
/*return DNM_M_xMatCharacteristicsSetRebound(DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(_hMatCharacteristics),_xValue);*/
return DNM_M_xMatCharacteristicsSetRebound((DNM_tdstMecMatCharacteristics *)(_hMatCharacteristics),_xValue);
/*END FB*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,63 @@
#include "cpa_std.h"
#include "MEC/mcamic.h" /* IdCard of Camera */
#include "MEC/mbase.h" /* Base */
#include "hidcard.h"
#include "GEO.h"
/* Accessors */
/* Author : JM Soudagne */
/* Date : 1996-01-30 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
DNM_tdeMechanicsID DNM_fn_eIdentityCardGetType(DNM_tdxHandleToMecIdentityCard _hCurrent)
{
#ifdef DNM_DEBUG
if(!DNM_fn_bIsIdentityCardValid(_hCurrent))
return DNM_eMIC_Error;
#endif
/* This field is shared by all identity card structure */
/* return Walk identification for instance */
return DNM_M_eBaseIdCardGetIdentity((DNM_tdstMecBaseIdCard*)(_hCurrent));
}
/*----------------------*/
/* Create a handle */
/*----------------------*/
/* Author : JM Soudagne */
/* Date : 1996-01-30 */
/* Version : 1.05 */
/* Modify : 1997-10-22 */
/* By : JMS */
/*----------------------*/
DNM_tdxHandleToMecIdentityCard DNM_fn_xIdentityCardCreate(DNM_tdeMechanicsID _eType)
{
void *p_stResult=NULL;
switch(_eType)
{
case DNM_eCamera:
{
MMG_fn_vAddMemoryInfo (MMG_C_lTypeMEC , MMG_C_lSubTypeMecCameraCard , NULL);
GEO_M_CPAMalloc( p_stResult, void * , sizeof(DNM_tdstMecCameraIdCard),E_uwGEONotEnoughtMemory);
DNM_M_eCameraIdCardSetIdentity((DNM_tdstMecCameraIdCard *)p_stResult,DNM_eCamera);
}
break;
case DNM_eBase:
{
MMG_fn_vAddMemoryInfo (MMG_C_lTypeMEC , MMG_C_lSubTypeMecBaseCard , NULL);
GEO_M_CPAMalloc( p_stResult, void * , sizeof(DNM_tdstMecBaseIdCard),E_uwGEONotEnoughtMemory);
DNM_M_eBaseIdCardSetIdentity((DNM_tdstMecBaseIdCard *)p_stResult,DNM_eBase);
}
break;
default : return NULL;
}
return (DNM_tdxHandleToMecIdentityCard)p_stResult;
}

View File

@@ -0,0 +1,14 @@
#include "MEC/mbase.h"
/* Give handle a semantic */
/* Author : J Th<54>noz */
/* Date : 1997-10-10 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
DNM_tdstMecBaseIdCard *DNM_fn_p_stMecBaseIdCardGiveBackSemantic(DNM_tdxHandleToMecIdentityCard _hBaseIdCard)
{
return (DNM_tdstMecBaseIdCard *)_hBaseIdCard;
}

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[Mec.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project

View File

@@ -0,0 +1,127 @@
/*----------------------*/
/* DNMLinkT.c */
/*----------------------*/
/* (c) Ubi R&D 1997 */
/*----------------------*/
#include "MEC/DNMLinkI.h"
/* Private Link Table */
#if !defined(U64)
SCR_tdst_Link_Table stLinkTableOfIdCard;
SCR_tdst_Link_Table* g_a_p_stIdCardsLinkTables[2];
#endif /* U64 */
/*----------------------*/
/* Init Functions */
/*----------------------*/
/* Author : S Leroy */
/* Date : 1997-04-02 */
/* Version : 0.10 */
/* Modify : 1997-04-02 */
/* By : S Leroy */
/* (c) Ubi R&D 1997 */
/*----------------------*/
void DNM_fn_vInitLinkTableOfIdCard()
{
#if !defined(U64)
SCR_fn_v_Link_InitTable(&stLinkTableOfIdCard);
#ifdef _DNM_BINARISER
/* For Binarisation purposes */
g_a_p_stIdCardsLinkTables[2]=&stLinkTableOfMecCameraIdCard;
#endif /*_DNM_BINARISER*/
#endif /* U64 */
}
/*----------------------------*/
/* Gives the link Table */
/*----------------------------*/
/* Author : S Leroy */
/* Date : 1997-04-02 */
/* Version : 1.00 */
/* Modify : 1997-07-31 */
/* By : S Leroy */
/* (c) Ubi R&D 1997 */
/*----------------------*/
#if !defined(U64)
SCR_tdst_Link_Table * DNM_fn_p_stGetIdCardLinkTable()
{
return (&stLinkTableOfIdCard) ;
}
#endif /* U64 */
/*----------------------*/
/* Create an Entry */
/*----------------------*/
/* Author : S Leroy */
/* Date : 1997-04-02 */
/* Version : 0.10 */
/* Modify : 1997-04-02 */
/* By : S Leroy */
/* (c) Ubi R&D 1997 */
/*----------------------*/
void DNM_fn_v_SetValueInLinkTableOfIdCard( char *_p_szKey,unsigned long _ulValue)
{
#if !defined(U64)
SCR_fnp_st_Link_SetValue(&stLinkTableOfIdCard,_p_szKey,_ulValue);
#endif /* U64 */
}
/*----------------------*/
/* Find Handle with Key */
/*----------------------*/
/* Author : S Leroy */
/* Date : 1997-04-02 */
/* Version : 0.10 */
/* Modify : 1997-04-02 */
/* By : S Leroy */
/* (c) Ubi R&D 1997 */
/*----------------------*/
unsigned long DNM_fn_ulLink_SearchKeyInLinkTableOfIdCard( char *_p_szKey)
{
#if !defined(U64)
return SCR_M_ul_Link_GetValue(SCR_fnp_st_Link_SearchKey(&stLinkTableOfIdCard,_p_szKey));
#else
unsigned long ul;
return ul;
#endif /* U64 */
}
/*----------------------*/
/* Find Key with Handle */
/*----------------------*/
/* Author : S Leroy */
/* Date : 1997-04-02 */
/* Version : 0.10 */
/* Modify : 1997-04-02 */
/* By : S Leroy */
/* (c) Ubi R&D 1997 */
/*----------------------*/
char * DNM_fn_p_cSearchValueInLinkTableOfIdCard( unsigned long _ulValue)
{
#if !defined(U64)
return SCR_M_p_sz_Link_GetKey(SCR_fnp_st_Link_SearchValue(&stLinkTableOfIdCard,_ulValue));
#else
char *pChar;
return pChar;
#endif /* U64 */
}
/*----------------------*/
/* Find Key with Handle */
/*----------------------*/
/* Author : Yves B. */
/* Date : 1997-05-12 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
/* (c) Ubi R&D 1997 */
/*----------------------*/
#if !defined(U64)
SCR_tdst_Link_Table *DNM_fn_p_stGetLinkTableOfIdCard(void)
{
return &stLinkTableOfIdCard;
}
#endif /* U64 */

View File

@@ -0,0 +1,492 @@
/*----------------------*/
/* DNMLoadI.c */
/*----------------------*/
/* Author : F Bourbon */
/* Date : 1997-01-30 */
/* Version : 0.10 */
/* Modify : 1997-08-04 */
/* By : S Leroy */
/* (c) Ubi R&D 1997 */
/*----------------------*/
#if !defined(U64)
#include "ACP_Base.h"
#include "cpa_std.h"
#include "MTH.h"
#include "SCR.h"
#include "MEC.h"
#include "DPT.h"
#include "LST.h"
#include "MEC/DNMLoadI.h"
#include "MEC/mbase.h"
/*ANNECY jt {*/
/* ---- must be report in bin/binproto */
#define BIN_C_DNMMecBaseIdCardID 64
/*ENDANNECY jt }*/
/* Macro for initializing a CallBack and*/
/* initializing the associated LinkTable*/
/* for binarization purpose*/
#define DNMi_M_Register(Type) \
SCR_fn_v_RdL0_RegisterCallback( \
C_SectionIdCard##Type##, \
DNM_fn_eScriptCallBack##Type##IdCard, \
SCR_CRC_c_RdL0_ForSection);
/* Macro for Reading the script file describing an Identity Card*/
/* and defining a LinkTable for this type of struct for*/
/* binarization purpose */
#define DNMi_M_CallBack(Type, Struct, Parse) \
SCR_tde_Anl_ReturnValue DNM_fn_eScriptCallBack##Type##IdCard( \
SCR_tdst_File_Description *_p_stFile, \
char *_p_szName, \
char *_ap_szParams[], \
SCR_tde_Anl_Action _eAction ) \
{ SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn; \
DNM_tdxHandleToMecIdentityCard h_IdCard; \
char a255_cLongName[255]; \
\
if (_eAction == SCR_EA_Anl_BeginSection) \
{ h_IdCard = DNM_fn_xIdentityCardCreate(##Struct##); \
SCR_M_RdL0_SetSectionLong(0, 0, (unsigned long)(h_IdCard)); \
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName); \
SCR_M_v_Link_SetAdditionalLong \
( SCR_fnp_st_Link_SetValue \
( DNM_fn_p_stGetIdCardLinkTable(), \
a255_cLongName, \
(unsigned long)h_IdCard \
), \
1, \
strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)) \
); \
} \
else if (_eAction == SCR_EA_Anl_Entry) \
{ SCR_M_RdL0_GetSectionLong(0, 0, DNM_tdxHandleToMecIdentityCard, h_IdCard); \
return Parse##(h_IdCard, _p_szName, _ap_szParams, _eAction); \
} \
return(eReturnValue); \
}
/*-----------------------------
| Camera |
| Script, WriteBloc, CallBack |
-----------------------------*/
/* Script Parsing */
SCR_tde_Anl_ReturnValue DNM_fn_eScriptFillCameraIdentityCard
(
DNM_tdxHandleToMecIdentityCard h_IdCard,
char *_p_szName,
char *_ap_szParams[],
SCR_tde_Anl_Action _eAction
)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
MTH_tdxReal xTmp;
if(!strcmp(_p_szName,C_EntryAngularSpeed))
{
xTmp = MTH_M_xDoubleToReal(atof(_ap_szParams[0]));
DNM_M_xCameraIdCardSetAngularSpeed((DNM_tdstMecCameraIdCard *)h_IdCard,MTH_M_xDegToRad(xTmp));
}
else if(!strcmp(_p_szName,C_EntryLinearSpeed))
{
xTmp = MTH_M_xDoubleToReal(atof(_ap_szParams[0]));
DNM_M_xCameraIdCardSetLinearSpeed((DNM_tdstMecCameraIdCard *)h_IdCard,xTmp);
}
else if(!strcmp(_p_szName,C_EntrySpeedingUp))
{
xTmp = MTH_M_xDoubleToReal(atof(_ap_szParams[0]));
DNM_M_xCameraIdCardSetSpeedingUp((DNM_tdstMecCameraIdCard *)h_IdCard,xTmp);
}
return(eReturnValue);
}
/* CallBack */
DNMi_M_CallBack(
Camera,
DNM_eCamera,
DNM_fn_eScriptFillCameraIdentityCard)
/*-----------------------------
| Base |
| Script, WriteBloc, CallBack |
-----------------------------*/
/* Script Parsing */
SCR_tde_Anl_ReturnValue DNM_fn_eScriptFillBaseIdentityCard(
DNM_tdxHandleToMecIdentityCard h_IdCard,
char *_p_szName,
char *_ap_szParams[],
SCR_tde_Anl_Action _eAction)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
DNM_tdstMecBaseIdCard *p_stBaseIdCard;
/* Gives back the semantic of the handle */
p_stBaseIdCard = DNM_fn_p_stMecBaseIdCardGiveBackSemantic(h_IdCard);
/* Default Values */
if( strcmp(_p_szName,C_EntryBaseAnimation)==0 )
{
DNM_M_vBaseIdCardSetAnimation
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseCollide)==0 )
{
DNM_M_vBaseIdCardSetCollide
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseGravity)==0 )
{
DNM_M_vBaseIdCardSetGravity
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseGi)==0 )
{
DNM_M_vBaseIdCardSetGi
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseClimb)==0 )
{
DNM_M_vBaseIdCardSetClimb
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseOnGround)==0 )
{
DNM_M_vBaseIdCardSetOnGround
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseSpider)==0 )
{
DNM_M_vBaseIdCardSetSpider
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseShoot)==0 )
{
DNM_M_vBaseIdCardSetShoot
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseSwim)==0 )
{
DNM_M_vBaseIdCardSetSwim
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseTilt)==0 )
{
DNM_M_vBaseIdCardSetTilt
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseCollisionControl)==0 )
{
DNM_M_vBaseIdCardSetCollisionControl
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseKeepWallSpeedZ)==0 )
{
DNM_M_vBaseIdCardSetKeepWallSpeedZ
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseSpeedLimit)==0 )
{
DNM_M_vBaseIdCardSetSpeedLimit
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseInertia)==0 )
{
DNM_M_vBaseIdCardSetInertia
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseStream)==0 )
{
DNM_M_vBaseIdCardSetStream
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseStickOnPlatform)==0 )
{
DNM_M_vBaseIdCardSetStickOnPlatform
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseUseScale)==0 )
{
DNM_M_vBaseIdCardSetScale
(
p_stBaseIdCard,
atoi(_ap_szParams[0])
);
}
if( strcmp(_p_szName,C_EntryBaseGravityFactor)==0 )
{
DNM_M_vBaseIdCardSetGravityFactor
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseSlide)==0 )
{
DNM_M_vBaseIdCardSetSlide
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseRebound)==0 )
{
DNM_M_vBaseIdCardSetRebound
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseSlopeLimit)==0 )
{
DNM_M_vBaseIdCardSetSlopeLimit
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseInertiaFactorX)==0 )
{
DNM_M_vBaseIdCardSetInertiaFactorX
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseInertiaFactorY)==0 )
{
DNM_M_vBaseIdCardSetInertiaFactorY
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseInertiaFactorZ)==0 )
{
DNM_M_vBaseIdCardSetInertiaFactorZ
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseTiltIntensity)==0 )
{
DNM_M_vBaseIdCardSetTiltIntensity
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseTiltInertia)==0 )
{
DNM_M_vBaseIdCardSetTiltInertia
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseTiltOrigin)==0 )
{
DNM_M_vBaseIdCardSetTiltOrigin
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(_ap_szParams[0]))
);
}
if( strcmp(_p_szName,C_EntryBaseMaxSpeed)==0 )
{
MTH3D_tdstVector stVector;
MTH3D_M_vSetVectorElements
(
&stVector,
MTH_M_xDoubleToReal((double)atof(_ap_szParams[0])),
MTH_M_xDoubleToReal((double)atof(_ap_szParams[1])),
MTH_M_xDoubleToReal((double)atof(_ap_szParams[2]))
);
DNM_M_vBaseIdCardSetMaxSpeed
(
p_stBaseIdCard,
&stVector
);
}
return(eReturnValue);
}
/* CallBack */
DNMi_M_CallBack(
Base,
DNM_eBase,
DNM_fn_eScriptFillBaseIdentityCard)
#endif /* U64 */
/*-----------------------------------------------------------------------------
* Description : Init the load of IdCard
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 19/02/97 Author : S Leroy
*-----------------------------------------------------------------------------
* Modification date :01/04/97 Modification Author : S Leroy
* Modifications :
*---------------------------------------------------------------------------*/
void DNM_fn_vInitLoadIdCard()
{
DNM_fn_vInitLinkTableOfIdCard();
#if !defined(U64)
/* Camera */
DNMi_M_Register(Camera)
/* Base */
DNMi_M_Register(Base)
#endif /* U64 */
}

View File

@@ -0,0 +1,226 @@
#include "cpa_std.h"
#include "MEC/mecmatca.h"
#include "MEC/dnmldmat.h"
#include "MEC/dnmlkmat.h"
#include "DPT.h"
#include "GEO.h"
/* Fills in a MecMatCharacteristics */
/* Private method */
/* Author : JM Soudagne */
/* Date : 1997-04-01 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
SCR_tde_Anl_ReturnValue fn_eScriptFillMecMatCharacteristics(
DNM_tdxHandleToMecMatCharacteristics _h_MecEnvironment,
char *_p_szName,
char *_ap_szPars[],
SCR_tde_Anl_Action _eAction
)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
double dfTmp;
DNM_tdstMecMatCharacteristics *p_stMecMatCharacteristics;
p_stMecMatCharacteristics = DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(_h_MecEnvironment);
if(strcmp(_p_szName,C_EntrySlide) == 0){
/* slide */
dfTmp = atof(_ap_szPars[0]);
DNM_M_xMatCharacteristicsSetSlide(p_stMecMatCharacteristics,MTH_M_xDoubleToReal(dfTmp));
}
else if(strcmp(_p_szName,C_EntryRebound) == 0){
/* rebound */
dfTmp = atof(_ap_szPars[0]);
DNM_M_xMatCharacteristicsSetRebound(p_stMecMatCharacteristics,MTH_M_xDoubleToReal(dfTmp));
}
return(eReturnValue);
}
/* Reads the script file describing a MecMatCharacteristics */
/* Author : JM Soudagne */
/* Date : 1997-04-01 */
/* Version : 1.00 */
/* Modify : 1997-05-14 */
/* Add of complete name in link table */
SCR_tde_Anl_ReturnValue fn_eScriptCallBackMecMatCharacteristics(
SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_szPars[],
SCR_tde_Anl_Action _eAction)
{
DNM_tdxHandleToMecMatCharacteristics hMecMatCharacteristics;
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
char szLinkTableKey[_MAX_PATH];
if(_eAction==SCR_EA_Anl_BeginSection)
{
/* If a section is detected */
hMecMatCharacteristics = DNM_fn_xMatCharacteristicsCreate();
SCR_M_RdL0_SetSectionLong(0,0,(unsigned long)(hMecMatCharacteristics));
strcpy(szLinkTableKey,SCR_M_RdL0_GetCompleteSectionNameR(0));
DNM_fn_vSetValueInLinkTableOfMecMatCharacteristics(szLinkTableKey,(unsigned long)(hMecMatCharacteristics));
}
else if(_eAction==SCR_EA_Anl_Entry)
{
/* Fills the MecMatCharacteristics */
SCR_M_RdL0_GetSectionLong(0,0,DNM_tdxHandleToMecMatCharacteristics,hMecMatCharacteristics);
fn_eScriptFillMecMatCharacteristics(hMecMatCharacteristics,
_p_szName,
_ap_szPars,
_eAction);
}
return(eReturnValue);
}
/* Init the load of mechanical material */
/* Author : JM Soudagne */
/* Date : 1997-04-01 */
/* Version : 1.00 */
/* Modify : yyyy-mm-dd */
void DNM_fn_vInitLoadMecMatCharacteristics()
{
SCR_fn_v_RdL0_RegisterCallback(
C_SectionMecMatCharacteristics,
fn_eScriptCallBackMecMatCharacteristics,
SCR_CRC_c_RdL0_ForSection
);
}
/*----------------------------------------------------------------------------
// Description : DNM_fn_ulWriteMMTBinaryBloc
//----------------------------------------------------------------------------
// Methods : Write the binary bloc for the mecanical material
//----------------------------------------------------------------------------
// Input : _ulStructAdress : Address of the structure to be written
// _p_cDestBuffer : Output buffer
// Output : The length of the data written
//----------------------------------------------------------------------------
// Creation date : Aug 97 Author: Alain Robin
//----------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
/*
unsigned long DNM_fn_ulWriteMMTBinaryBloc(unsigned long _ulStructAdress,
char* _p_cDestBuffer)
{
char* p_cBufferPointer=_p_cDestBuffer;
DNM_tdstMecMatCharacteristics* p_stMecMat;
p_stMecMat=(DNM_tdstMecMatCharacteristics*)_ulStructAdress;
p_cBufferPointer=BIN_fn_p_cPutReal(p_cBufferPointer,p_stMecMat->m_xSlide);
p_cBufferPointer=BIN_fn_p_cPutReal(p_cBufferPointer,p_stMecMat->m_xRebound);
return p_cBufferPointer-_p_cDestBuffer;
}
*/
/*----------------------------------------------------------------------------
// Description : DNM_fn_vWriteAllMMTBinaryBlocs
//----------------------------------------------------------------------------
// Methods : Write all the binary bloc for the mecanical material
//----------------------------------------------------------------------------
// Input : _szBinaryFileName
// Output :
//----------------------------------------------------------------------------
// Creation date : Aug 97 Author: Alain Robin
//----------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
/*
void DNM_fn_vWriteAllMMTBinaryBlocs(char* _szBinaryFileName)
{
DNM_fn_vPrepareSaveMaterialBinaryBloc();
BIN_fn_vPutBinaryDataIntoFileFromLinkTable(_szBinaryFileName,DNM_fn_p_stGetLinkTableOfMecMatCharacteristics(),
sizeof(DNM_tdstMecMatCharacteristics),DNM_fn_ulWriteMMTBinaryBloc);
}
*/
/*----------------------------------------------------------------------------
// Description : DNM_fn_ulReadMMTBinaryBloc
//----------------------------------------------------------------------------
// Methods : Read a the binary bloc for the mecanical material
//----------------------------------------------------------------------------
// Input : _p_cLoadedBuffer : Input buffer
// _ulLoadedBufferSize : Size of the loaded buffer
// Output : The address of the allocated bloc
//----------------------------------------------------------------------------
// Creation date : Aug 97 Author: Alain Robin
//----------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
/*
unsigned long DNM_fn_ulReadMMTBinaryBloc(char* _p_cLoadedBuffer,unsigned long _ulLoadedBufferSize)
{
DNM_tdxHandleToMecMatCharacteristics hNewMecMaterial=NULL;
hNewMecMaterial = DNM_fn_xMatCharacteristicsCreate();
memcpy((char*)hNewMecMaterial,_p_cLoadedBuffer,_ulLoadedBufferSize);
return (unsigned long)hNewMecMaterial;
}
*/
/*----------------------------------------------------------------------------
// Description : DNM_fn_vReadAllMMTBinaryBlocs
//----------------------------------------------------------------------------
// Methods : Read all the binary blocs for the mecanical material
//----------------------------------------------------------------------------
// Input : _szBinaryFileName : The binary file name
// Output :
//----------------------------------------------------------------------------
// Creation date : Aug 97 Author: Alain Robin
//----------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
/*
void DNM_fn_vReadAllMMTBinaryBlocs(char* _szBinaryFileName)
{
BIN_fn_vReadDataFromLinkTable(DNM_fn_p_stGetLinkTableOfMecMatCharacteristics(),DNM_fn_ulReadMMTBinaryBloc,
sizeof(DNM_tdstMecMatCharacteristics), _szBinaryFileName);
}
char* DNM_fn_p_cGeneralAllocateFunction(unsigned long _ulSize)
{
char* p_cBuffer;
GEO_M_CPAMalloc(p_cBuffer,char*,_ulSize,E_uwGEONotEnoughtMemory);
return p_cBuffer;
}
*/
/*----------------------------------------------------------------------------
// Description : DNM_fn_vReadAllMMTBinaryBlocs2
//----------------------------------------------------------------------------
// Methods : Read all the binary blocs for the mecanical material
//----------------------------------------------------------------------------
// Input : _szBinaryFileName : The binary file name
// Output :
//----------------------------------------------------------------------------
// Creation date : Aug 97 Author: Alain Robin
//----------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
/*
void DNM_fn_vReadAllMMTBinaryBlocs2(char* _szBinaryFileName)
{
BIN_fn_vReadDataFromLinkTableWithoutAllocation(DNM_fn_p_stGetLinkTableOfMecMatCharacteristics(),NULL,
sizeof(DNM_tdstMecMatCharacteristics), _szBinaryFileName,
DNM_fn_p_cGeneralAllocateFunction);
}
*/

View File

@@ -0,0 +1,70 @@
#include "cpa_std.h"
#include "MEC/mecmatca.h"
#include "MEC/dnmldmat.h"
#include "MEC/dnmlkmat.h"
#include "DPT.h"
#include "GEO.h"
#include "ldt.h"
#define lTagBaseSlide 'dilS'
#define lTagBaseRebound 'obeR'
int fn_iCreateMecMatCharacteristics( LDT_tdst_Link *pLink )
{
DNM_tdxHandleToMecMatCharacteristics hMecMatCharacteristics = DNM_fn_xMatCharacteristicsCreate();
pLink->pObject = (void*)hMecMatCharacteristics;
return 0;
}
int fn_iLoadMecMatCharacteristics( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
DNM_tdxHandleToMecMatCharacteristics hMecMatCharacteristics = (DNM_tdxHandleToMecMatCharacteristics)pLink->pObject;
char szLinkTableKey[_MAX_PATH];
DNM_tdstMecMatCharacteristics *p_stMecMatCharacteristics;
LDT_ComputeSectionName( pLink , szLinkTableKey);
DNM_fn_vSetValueInLinkTableOfMecMatCharacteristics(szLinkTableKey,(unsigned long)(hMecMatCharacteristics));
p_stMecMatCharacteristics = DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(hMecMatCharacteristics);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+4))
{
case lTagBaseSlide : /* */
{
DNM_M_xMatCharacteristicsSetSlide(p_stMecMatCharacteristics, (float)atof(LDT_szGetParam(1)));
}
break;
case lTagBaseRebound : /* */
{
DNM_M_xMatCharacteristicsSetRebound(p_stMecMatCharacteristics, (float)atof(LDT_szGetParam(1)));
}
break;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,514 @@
#if !defined(U64)
#include "ACP_Base.h"
#include "cpa_std.h"
#include "MTH.h"
#include "SCR.h"
#include "MEC.h"
#include "DPT.h"
#include "LST.h"
#include "MEC/DNMLoadI.h"
#include "MEC/mbase.h"
#include "ldt.h"
#include <crtdbg.h>
/* ---- must be report in bin/binproto */
#define BIN_C_DNMMecBaseIdCardID 64
#define lTagAngularSpeed 'ugnA'
#define lTagLinearSpeed 'eniL'
#define lTagSpeedingUp 'eepS'
#define lTagGi 'iG'
#define lTagIx 'xI'
#define lTagIy 'yI'
#define lTagIz 'zI'
#define lTagAnimation 'minA'
#define lTagGravity 'varG'
#define lTagTilt 'tliT'
/*#define lTagTiltIntensity 13*/
/*#define lTagTiltInertia 11*/
/*#define lTagTiltOrigin 10*/
#define lTagClimb 'milC'
#define lTagOnGround 'rGnO'
#define lTagSpider 'dipS'
#define lTagShoot 'oohS'
#define lTagCollide 'lloC'
#define lTagKeepSpeedZ 'peeK'
#define lTagSpeedLimit 'eepS'
#define lTagInertia 'renI'
#define lTagStream 'ertS'
#define lTagStickOnPlatform 'citS'
#define lTagSlide 'dilS'
#define lTagScale 'lacS'
#define lTagRebound 'obeR'
#define lTagSlopeLimit 'polS'
#define lTagMaxSpeed 'SxaM'
/* Macro for initializing a CallBack and*/
/* initializing the associated LinkTable*/
/* for binarization purpose*/
#define DNMi_M_RegisterLDT(Type) \
LDT_RegisterType(C_SectionIdCard##Type##, CreateIdCard##Type##, LoadIdCard##Type##, LDT_REG_SECTION);
/* Macro for Reading the script file describing an Identity Card*/
/* and defining a LinkTable for this type of struct for*/
/* binarization purpose */
#define DNMi_M_CallBackLDT(Type, Struct, Parse) \
int CreateIdCard##Type##( LDT_tdst_Link* pLink ) \
{ \
DNM_tdxHandleToMecIdentityCard h_IdCard; \
\
h_IdCard = DNM_fn_xIdentityCardCreate(##Struct##); \
pLink->pObject = (void *)h_IdCard; \
return 0; \
} \
int LoadIdCard##Type##( LDT_tdst_Link* pLink ) \
{ \
int nLen;\
char a255_cLongName[255]; \
DNM_tdxHandleToMecIdentityCard h_IdCard = pLink->pObject; \
nLen = LDT_ComputeSectionName(pLink, a255_cLongName); \
SCR_M_v_Link_SetAdditionalLong( SCR_fnp_st_Link_SetValue (DNM_fn_p_stGetIdCardLinkTable(), a255_cLongName, (unsigned long)h_IdCard ), 1, nLen); \
return Parse##(h_IdCard, pLink); \
}
/* -> OS : THIS CODE SHOULD BE DELETED 25-Aug-98*/
/* _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_WNDW ); \*/
/* _RPT2( _CRT_WARN, "Name:%s.\nnLen=%d ", a255_cLongName, nLen); \*/
/* DebugBreak(); \*/
/* <- OS : THIS CODE SHOULD BE DELETED 25-Aug-98*/
/*-----------------------------
| Camera |
| Script, WriteBloc, CallBack |
-----------------------------*/
/* Script Parsing */
/*****************************************************************
Function name : DNM_fn_eLDTFillCameraIdentityCard
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 14-Oct-98
Modified :
Return type : int
Argument : DNM_tdxHandleToMecIdentityCard h_IdCard
Argument : LDT_tdst_Link* pLink
*****************************************************************/
int DNM_fn_eLDTFillCameraIdentityCard( DNM_tdxHandleToMecIdentityCard h_IdCard, LDT_tdst_Link* pLink)
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MTH_tdxReal xTmp;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagAngularSpeed : /* AngularSpeed */
{
xTmp = MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)));
DNM_M_xCameraIdCardSetAngularSpeed((DNM_tdstMecCameraIdCard *)h_IdCard,MTH_M_xDegToRad(xTmp));
}
break;
case lTagLinearSpeed : /* LinearSpeed */
{
xTmp = MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)));
DNM_M_xCameraIdCardSetLinearSpeed((DNM_tdstMecCameraIdCard *)h_IdCard,xTmp);
}
break;
case lTagSpeedingUp : /* SpeedingUp */
{
xTmp = MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)));
DNM_M_xCameraIdCardSetSpeedingUp((DNM_tdstMecCameraIdCard *)h_IdCard,xTmp);
}
break;
}
}
}
}
return 0;
}
/* CallBack */
DNMi_M_CallBackLDT(
Camera,
DNM_eCamera,
DNM_fn_eLDTFillCameraIdentityCard)
/*-----------------------------
| Base |
| Script, WriteBloc, CallBack |
-----------------------------*/
/* Script Parsing */
/*****************************************************************
Function name : DNM_fn_eLDTFillBaseIdentityCard
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 14-Oct-98
Modified :
Return type : int
Argument : DNM_tdxHandleToMecIdentityCard h_IdCard
Argument : LDT_tdst_Link* pLink
*****************************************************************/
int DNM_fn_eLDTFillBaseIdentityCard( DNM_tdxHandleToMecIdentityCard h_IdCard, LDT_tdst_Link* pLink)
{
LDT_tdeParseResult result=ParseResult_BeginSection;
DNM_tdstMecBaseIdCard *p_stBaseIdCard;
/* Gives back the semantic of the handle */
p_stBaseIdCard = DNM_fn_p_stMecBaseIdCardGiveBackSemantic(h_IdCard);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
if (strlen(szEntry) == 1) /* G*/
{
DNM_M_vBaseIdCardSetGravityFactor
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
break;
}
if (strlen(szEntry) == 2)
{
switch (*(short*)szEntry)
{
case lTagGi : /* */
{
DNM_M_vBaseIdCardSetGi
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagIx : /* */
{
DNM_M_vBaseIdCardSetInertiaFactorX
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
case lTagIy : /* */
{
DNM_M_vBaseIdCardSetInertiaFactorY
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
case lTagIz : /* */
{
DNM_M_vBaseIdCardSetInertiaFactorZ
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
}
break;
}
switch (*(long*)szEntry)
{
case lTagAnimation : /* */
{
DNM_M_vBaseIdCardSetAnimation
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagCollide : /* Collide, CollisionControl*/
{
if (strlen(szEntry)==7) /* Collide*/
{
DNM_M_vBaseIdCardSetCollide
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
else /* CollisionControl*/
{
DNM_M_vBaseIdCardSetCollisionControl
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
}
break;
case lTagGravity : /* */
{
DNM_M_vBaseIdCardSetGravity
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagTilt : /* */
{
switch (strlen(szEntry))
{
case 4: /* Tilt*/
{
DNM_M_vBaseIdCardSetTilt
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case 10: /*TiltOrigin*/
{
DNM_M_vBaseIdCardSetTiltOrigin
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
case 11: /*TiltInertia*/
{
DNM_M_vBaseIdCardSetTiltInertia
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
case 13: /*TiltIntensity*/
{
DNM_M_vBaseIdCardSetTiltIntensity
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
}
}
break;
case lTagClimb : /* */
{
DNM_M_vBaseIdCardSetClimb
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagOnGround : /* */
{
DNM_M_vBaseIdCardSetOnGround
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagSpider : /* */
{
DNM_M_vBaseIdCardSetSpider
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagShoot : /* */
{
DNM_M_vBaseIdCardSetShoot
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagKeepSpeedZ : /* */
{
DNM_M_vBaseIdCardSetKeepWallSpeedZ
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagSpeedLimit : /* */
{
DNM_M_vBaseIdCardSetSpeedLimit
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagInertia : /* */
{
DNM_M_vBaseIdCardSetInertia
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagStream : /* */
{
DNM_M_vBaseIdCardSetStream
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagStickOnPlatform : /* */
{
DNM_M_vBaseIdCardSetStickOnPlatform
(
p_stBaseIdCard,
atoi(LDT_szGetParam(1))
);
}
break;
case lTagSlide : /* */
{
DNM_M_vBaseIdCardSetSlide
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
case lTagRebound : /* */
{
DNM_M_vBaseIdCardSetRebound
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
case lTagSlopeLimit : /* */
{
DNM_M_vBaseIdCardSetSlopeLimit
(
p_stBaseIdCard,
MTH_M_xDoubleToReal(atof(LDT_szGetParam(1)))
);
}
break;
case lTagMaxSpeed : /* */
{
MTH3D_tdstVector stVector;
MTH3D_M_vSetVectorElements
(
&stVector,
MTH_M_xDoubleToReal((double)atof(LDT_szGetParam(1))),
MTH_M_xDoubleToReal((double)atof(LDT_szGetParam(2))),
MTH_M_xDoubleToReal((double)atof(LDT_szGetParam(3)))
);
DNM_M_vBaseIdCardSetMaxSpeed
(
p_stBaseIdCard,
&stVector
);
}
break;
}
}
}
}
return 0;
}
/* CallBack */
DNMi_M_CallBackLDT(
Base,
DNM_eBase,
DNM_fn_eLDTFillBaseIdentityCard)
#endif /* U64 */
/*#define LDT_REG_SECTION 0 /* registers section callbacks */
/*#define LDT_REG_FILE 1 /* registers file callbacks */
/*-----------------------------------------------------------------------------
* Description : Init the load of IdCard
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*---------------------------------------------------------------------------*/
void DNM_fn_vInitLoadIdCardLDT()
{
DNM_fn_vInitLinkTableOfIdCard();
#if !defined(U64)
/* Camera */
DNMi_M_RegisterLDT(Camera)
/* Base */
DNMi_M_RegisterLDT(Base)
#endif /* U64 */
}