942 lines
32 KiB
C++
942 lines
32 KiB
C++
/* Private functions */
|
|
/*
|
|
BOOL fn_bIsObstacleTypeOfGMT(HIE_tdxHandleToSuperObject p_SuperObjPerso, GMT_tdxMask xTestMask)
|
|
{
|
|
DNM_tdstReport *p_stDynamReport;
|
|
|
|
if ((p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso)) == NULL)
|
|
return FALSE;
|
|
return fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetObstacle(p_stDynamReport)), xTestMask);
|
|
}
|
|
|
|
BOOL fn_bIsWallTypeOfGMT(HIE_tdxHandleToSuperObject p_SuperObjPerso, GMT_tdxMask xTestMask)
|
|
{
|
|
DNM_tdstReport *p_stDynamReport;
|
|
|
|
if ((p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso)) == NULL)
|
|
return FALSE;
|
|
return fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetWall(p_stDynamReport)), xTestMask);
|
|
}
|
|
|
|
BOOL fn_bIsGroundTypeOfGMT(HIE_tdxHandleToSuperObject p_SuperObjPerso, GMT_tdxMask xTestMask)
|
|
{
|
|
DNM_tdstReport *p_stDynamReport;
|
|
|
|
if ((p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso)) == NULL)
|
|
return FALSE;
|
|
return fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetGround(p_stDynamReport)), xTestMask);
|
|
}
|
|
|
|
BOOL fn_bIsCeilingTypeOfGMT(HIE_tdxHandleToSuperObject p_SuperObjPerso, GMT_tdxMask xTestMask)
|
|
{
|
|
DNM_tdstReport *p_stDynamReport;
|
|
|
|
if ((p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso)) == NULL)
|
|
return FALSE;
|
|
return fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetCeil(p_stDynamReport)), xTestMask);
|
|
}
|
|
*/
|
|
|
|
|
|
/******************************************************************
|
|
* Condition : ZDMCollideWithObstacle *
|
|
* Use : ZDMCollisionAvecObstacle ("Type de matériau") *
|
|
* Use for : Return the collide type with OBSTACLES *
|
|
* Author : Jacques Thénoz *
|
|
* Date of last modification: 31/10/97 *
|
|
******************************************************************/
|
|
tdstNodeInterpret *fn_p_stZDMCollideWithObstacle(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
tdstGetSetParam stParam;
|
|
GMT_tdxMask xTestMask;
|
|
unsigned long ulSurfState;
|
|
DNM_tdstReport *p_stDynamReport;
|
|
|
|
enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
|
|
|
|
|
|
M_EvalNextParameter(&stParam);
|
|
|
|
if ((p_stDynamReport=fn_pstGetDNMReport(p_SuperObjPerso))==NULL)
|
|
{
|
|
*p_lValue = (long)FALSE;
|
|
return p_stTree;
|
|
}
|
|
|
|
ulSurfState = DNM_M_ulReportGetSurfaceState(p_stDynamReport);
|
|
|
|
xTestMask = (GMT_tdxMask) M_GetSetParam_xMaskValue(&stParam);
|
|
*p_lValue = FALSE;
|
|
|
|
|
|
switch (eCondId)
|
|
{
|
|
case eCond_IsZDMCollideWithObstacle :
|
|
if (ulSurfState!=C_WOT_ulNoObstacle)
|
|
/**p_lValue = fn_bIsObstacleTypeOfGMT(p_SuperObjPerso, xTestMask);*/
|
|
*p_lValue = (long)fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetObstacle(p_stDynamReport)), xTestMask);
|
|
break;
|
|
|
|
case eCond_IsZDMCollideWithWall :
|
|
if (ulSurfState & C_WOT_ulWall)
|
|
/**p_lValue = fn_bIsWallTypeOfGMT(p_SuperObjPerso, xTestMask);*/
|
|
*p_lValue = (long)fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetWall(p_stDynamReport)), xTestMask);
|
|
break;
|
|
|
|
case eCond_IsZDMCollideWithGround :
|
|
if (ulSurfState & (C_WOT_ulGround/*|C_WOT_ulSlope*/))
|
|
/**p_lValue = fn_bIsGroundTypeOfGMT(p_SuperObjPerso, xTestMask);*/
|
|
*p_lValue = (long)fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetGround(p_stDynamReport)), xTestMask);
|
|
break;
|
|
|
|
case eCond_IsZDMCollideWithCeiling :
|
|
if (ulSurfState & (/*C_WOT_ulAttic|*/C_WOT_ulCeiling))
|
|
/**p_lValue = fn_bIsCeilingTypeOfGMT(p_SuperObjPerso, xTestMask);*/
|
|
*p_lValue = (long)fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetCeil(p_stDynamReport)), xTestMask);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return(p_stTree);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
* Condition : Cond_IsCustomBitSet *
|
|
* : Cond_IsCurrentStateCustomBitSet *
|
|
* Use : ACT_TestCustomBit(numero_de_bit) *
|
|
* : ACT_TestCustomBitDEtatCourant(numero_de_bit) *
|
|
* Use for : Return the state of the bit *
|
|
* Author : B. Germain *
|
|
* Date of last modification: 25/11/98 MT *
|
|
******************************************************************/
|
|
/* ANNECY MT - 24/11/98 {*/
|
|
tdstNodeInterpret *fn_p_stCustomBitsCond(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
tdstGetSetParam stParam;
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
|
|
/*read the custom bit identifier*/
|
|
M_EvalNextParameter(&stParam);
|
|
|
|
switch ( eCondId )
|
|
{
|
|
case eCond_IsCustomBitSet:
|
|
{
|
|
unsigned long ulMask = (1 << (M_GetSetParam_lValue(&stParam) - 1));
|
|
*p_lValue = (fn_ulStandardGameGetCustomBits(M_GetMSHandle(hNewSuperObjPerso,StandardGame)) & ulMask) ? TRUE : FALSE;
|
|
}
|
|
break;
|
|
|
|
case eCond_IsCurrentStateCustomBitSet:
|
|
{
|
|
unsigned long ulMask;
|
|
tdxHandleToState h_State;
|
|
|
|
ulMask = (unsigned long)M_GetSetParam_CapsValue(&stParam);
|
|
|
|
#ifdef _DEBUG
|
|
SAF_M_AssertWithMsg(ulMask < 256, "Le masque est trop grand")
|
|
#endif
|
|
h_State = fn_h3dDataGetCurrentState(M_GetMSHandle(hNewSuperObjPerso,3dData));
|
|
*p_lValue = ( (h_State && (fn_ucGetStateCustomBits(h_State) & ulMask)) ? TRUE : FALSE);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
*p_lValue = FALSE;
|
|
break;
|
|
}
|
|
|
|
return p_stTree;
|
|
}
|
|
/* END ANNECY MT }*/
|
|
|
|
|
|
|
|
|
|
/*=====================================================================================================================================
|
|
Name: CollisionWP( Perso, WP )
|
|
Author: yann le tensorer
|
|
Created: October 12,1998 (completely rewriten for optimisations)
|
|
Last modified:
|
|
=====================================================================================================================================*/
|
|
/*extern void fn_vRegisterTextToDraw (char * _szTextToDraw , long _lX , long _lY);*/
|
|
|
|
tdstNodeInterpret *fn_p_stCollisionWP(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
tdstGetSetParam stParam;
|
|
HIE_tdxHandleToSuperObject hPerso;
|
|
WP_tdhWayPoint hWP;
|
|
MTH3D_tdstVector stPosWP;
|
|
/*
|
|
static char init=0;
|
|
static char text[100];
|
|
|
|
|
|
unsigned long ulTimerValue;
|
|
|
|
if (init==0)
|
|
{
|
|
init=1;
|
|
fn_vRegisterTextToDraw(text,10,450);
|
|
}
|
|
ulTimerValue = TMR_fn_ulFastGetInternalCounter();
|
|
*/
|
|
|
|
|
|
/* Get first parameter that is a type Perso*/
|
|
M_EvalNextParameter( &stParam );
|
|
hPerso = (HIE_tdxHandleToSuperObject) M_GetSetParam_p_stSupObjValue( &stParam );
|
|
|
|
/* Get second parameter that is a Waypoint*/
|
|
M_EvalNextParameter( &stParam );
|
|
hWP = M_GetSetParam_WayPointValue( &stParam );
|
|
|
|
/* if bad wp or perso given, ther is surely no collision !*/
|
|
if ((hPerso==0) || (hWP==0))
|
|
{
|
|
*p_lValue=FALSE;
|
|
return(p_stTree);
|
|
}
|
|
|
|
|
|
|
|
if (hWP->m_hSuperObject) /* does the waypoint have a superobject ?*/
|
|
{
|
|
WP_fnv_WayPoint_ComputeLocation(hWP,&stPosWP);
|
|
/*get vector between WP and Perso*/
|
|
MTH3D_M_vSubVector(&stPosWP,&stPosWP,&hPerso->hGlobalMatrix->stTranslationVector);
|
|
}
|
|
else
|
|
/* what almost always happens...*/
|
|
MTH3D_M_vSubVector(&stPosWP,&hWP->m_stVertex,&hPerso->hGlobalMatrix->stTranslationVector);
|
|
|
|
|
|
/*compare the square of its norm with the square of the radius*/
|
|
|
|
if MTH_M_bGreaterZero(MTH_M_xSub(MTH3D_M_xSqrVector(&stPosWP),MTH_M_xSqr(hWP->m_xRadius)))
|
|
*p_lValue=FALSE;
|
|
else
|
|
*p_lValue=TRUE;
|
|
/*
|
|
ulTimerValue=TMR_fn_ulFastGetInternalCounter()-ulTimerValue-30;
|
|
sprintf(text,"%ul",ulTimerValue);
|
|
*/
|
|
|
|
return(p_stTree);
|
|
}
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
* Condition: IsGiBlock *
|
|
* Use : bool := GiBloque *
|
|
* true if Gi mechanic prevents Rayman from going out a Gi *
|
|
* collide set material *
|
|
* false *
|
|
* Author : Christophe Giraud *
|
|
* Date of last modification: 25/11/97 *
|
|
**********************************************************************/
|
|
/*tdstNodeInterpret *fn_p_stMechanicBlock(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
|
|
|
|
switch ( eCondId )
|
|
{
|
|
case eCond_IsGiBlock:
|
|
case eCond_IsMechanicBlock:
|
|
{
|
|
DNM_tdstReport *p_stDynamReport;
|
|
BOOL bGiBlock = FALSE;
|
|
|
|
if ( (p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso))!=NULL )
|
|
{
|
|
bGiBlock = DNM_M_bReportCollision(p_stDynamReport);
|
|
DNM_M_bReportSetCollisionFlagToFalse(p_stDynamReport);
|
|
}
|
|
|
|
*p_lValue = bGiBlock?TRUE:FALSE;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
*p_lValue = FALSE;
|
|
break;
|
|
}
|
|
return(p_stTree);
|
|
}*/
|
|
|
|
|
|
/**********************************************************************
|
|
* Condition: IsVectorNul *
|
|
* Use : bool := VecteurNul ( vecteur ) *
|
|
* almost true if ||vecteur|| < epsilon *
|
|
* Author : Jacques Thénoz *
|
|
* Date of last modification: 22/04/98 *
|
|
* - no more BOOL variable *
|
|
* - epsilon changed from 1e-15 to 1e-5 *
|
|
* - test modified so that as soon as one compoent is too large, *
|
|
* the others are ignored *
|
|
**********************************************************************/
|
|
tdstNodeInterpret *fn_p_stNullVector(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
tdstGetSetParam stParam;
|
|
/*
|
|
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
|
|
|
|
switch ( eCondId )
|
|
{
|
|
case eCond_IsNullVector:
|
|
{
|
|
*/
|
|
MTH3D_tdstVector *p_stVector;
|
|
|
|
/* read vector */
|
|
M_EvalNextParameter(&stParam);
|
|
p_stVector=&M_GetSetParam_stVectorValue(&stParam);
|
|
|
|
*p_lValue = ( MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetXofVector(p_stVector), MTH_M_xDoubleToReal(1.0e-5)) && MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetYofVector(p_stVector), MTH_M_xDoubleToReal(1.0e-5)) && MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetZofVector(p_stVector), MTH_M_xDoubleToReal(1.0e-5)) )
|
|
? TRUE
|
|
: FALSE;
|
|
/* }
|
|
break;
|
|
|
|
default:
|
|
*p_lValue = FALSE;
|
|
break;
|
|
}
|
|
*/
|
|
return(p_stTree);
|
|
}
|
|
|
|
/**********************************************************************
|
|
* Condition: OptionTruc *
|
|
* Use : bool := OptionTruc () *
|
|
* true if Truc option is active in current mechanic *
|
|
* Author : Jacques Thénoz *
|
|
* Date of last modification: 16/12/97 *
|
|
**********************************************************************/
|
|
tdstNodeInterpret *fn_p_stMechanicOption(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
struct DNM_stDynamics* pstDynamic;
|
|
MS_tdxHandleToDynam h_Dynam;
|
|
|
|
BOOL bOption;
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
|
|
|
|
/* Get Dynamics structure*/
|
|
h_Dynam = M_GetMSHandle(hNewSuperObjPerso,Dynam);
|
|
if (!h_Dynam)
|
|
{
|
|
#if (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)
|
|
#if !defined(U64_AIDEBUG) /* Oliv' - 23/11/1998*/
|
|
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, E_uwAIWarningScriptError , C_lErmNoDebugData,
|
|
C_ucErmOpenInfoWindow, C_ucNeverStopForDebug,
|
|
"You must allocate Dynamics.");
|
|
Erm_fn_iMessageBox ("You must allocate Dynamics.","STOP",MB_OK|MB_ICONERROR);
|
|
Erm_M_ClearLastError(C_ucErmDefaultChannel);
|
|
fn_vSetStopAIEngineFlag();
|
|
#endif /* !defined(U64_AIDEBUG) */
|
|
#endif /* (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG) */
|
|
|
|
*p_lValue = FALSE;
|
|
return(p_stTree);
|
|
}
|
|
pstDynamic = fn_p_stDynamGetDynamics(h_Dynam);
|
|
|
|
switch ( eCondId )
|
|
{
|
|
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eCond_IsMechanicAnimation :
|
|
bOption=DNM_M_bDynamicsIsAnimation (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicCollide :
|
|
bOption=DNM_M_bDynamicsIsCollide (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicGravity :
|
|
bOption=DNM_M_bDynamicsIsGravity (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicTilt :
|
|
bOption=DNM_M_bDynamicsIsTilt (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicGi :
|
|
bOption=DNM_M_bDynamicsIsGi (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicClimb :
|
|
bOption=DNM_M_bDynamicsIsClimb (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicOnGround :
|
|
bOption=DNM_M_bDynamicsIsOnGround (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicSpider :
|
|
bOption=DNM_M_bDynamicsIsSpider (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicShoot :
|
|
bOption=DNM_M_bDynamicsIsShoot (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicSwim :
|
|
bOption=DNM_M_bDynamicsIsShoot (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicNeverFall :
|
|
bOption=DNM_M_bDynamicsIsNeverFall (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicCollisionControl:
|
|
bOption=DNM_M_bDynamicsIsCollisionControl (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicKeepSpeedZ:
|
|
bOption=DNM_M_bDynamicsIsKeepWallSpeedZ (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicSpeedLimit:
|
|
bOption=DNM_M_bDynamicsIsSpeedLimit (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicInertia:
|
|
bOption=DNM_M_bDynamicsIsInertia (pstDynamic);
|
|
break;
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
case eCond_IsMechanicStream:
|
|
bOption=DNM_M_bDynamicsIsStream (pstDynamic);
|
|
break;
|
|
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eCond_IsMechanicStickOnPlatform:
|
|
bOption=DNM_M_bDynamicsIsStickOnPlatform (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicPatformCrash:
|
|
bOption=DNM_M_bDynamicsIsPlatformCrash (pstDynamic);
|
|
break;
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
case eCond_CanFall:
|
|
/* if true, we store the fall direction in the specified vector dsgvar*/
|
|
if ( (bOption = DNM_M_bDynamicsIsCanFall (pstDynamic)) != 0 ) /*VOLUNTARY ASSIGNMENT!!!*/
|
|
{
|
|
tdstGetSetParam stParam;
|
|
AI_tdstMind *p_stMind; /* Mind of the dsgvar owning perso (used to return paramaters to dsgVars)*/
|
|
unsigned char ucVectorId; /* id of the vector dsgvar*/
|
|
|
|
/* get the vector identification in the argument*/
|
|
M_vEvalNextVarId(p_stMind, ucVectorId);
|
|
|
|
/*put the vector found in the mechanics into the dsgvar*/
|
|
M_GetSetParam_stVertexValue(&stParam) = *DNM_M_pDynamicsGetFallTranslation(pstDynamic);
|
|
M_GetSetParam_Type(&stParam) = E_vt_Vector;
|
|
ucVectorId = fn_ucSetDsgVar(ucVectorId, 0, p_stMind, &stParam);
|
|
SAF_M_AssertWithMsg(ucVectorId != C_INVALID_SET, "L'argument n'est pas de type vecteur!");
|
|
}
|
|
else /* no need to store the vector -> do not evaluate its id*/
|
|
p_stTree = fn_p_stSkipThisArgument(p_stTree);
|
|
break;
|
|
|
|
case eCond_IsGiBlock:
|
|
case eCond_IsMechanicBlock:
|
|
bOption=DNM_M_bDynamicsIsStop (pstDynamic);
|
|
DNM_M_vDynamicsSetStop (pstDynamic,FALSE);
|
|
break;
|
|
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eCond_IsMechanicScale:
|
|
bOption = DNM_M_bDynamicsIsScale (pstDynamic);
|
|
break;
|
|
|
|
case eCond_IsMechanicExec:
|
|
bOption = DNM_M_bDynamicsIsExec (pstDynamic);
|
|
DNM_M_vDynamicsSetExec (pstDynamic,FALSE);
|
|
break;
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
case eCond_IsMechanicCrash:
|
|
bOption = DNM_M_bDynamicsIsCrash (pstDynamic);
|
|
break;
|
|
|
|
default:
|
|
bOption = FALSE;
|
|
break;
|
|
}
|
|
|
|
*p_lValue = bOption ? TRUE : FALSE;
|
|
|
|
return(p_stTree);
|
|
}
|
|
|
|
|
|
/*ANNECY CT 06/02/98{*/
|
|
/**********************************************************************
|
|
* Function: ANI_TestFinAnim *
|
|
* Function: ACT_TestFinAction *
|
|
* Use : Booleen = ANI_TestFinAnim() ou Perso.ANI_TestFinAnim() *
|
|
* Use : Booleen = ACT_TestFinAction() ou Perso.ACT_TestFinAction() *
|
|
* *
|
|
* Author : Carlos Torres *
|
|
* Date of last modification: 16/02/98 *
|
|
**********************************************************************/
|
|
tdstNodeInterpret * fn_p_stCheckAnimEnd(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue) {
|
|
enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
|
|
if (eCondId == eCond_CheckAnimEnd) {
|
|
*p_lValue=PLA_fn_bTestIfEndOfAnim(hNewSuperObjPerso);
|
|
return (p_stTree);
|
|
}
|
|
else if (eCondId == eCond_CheckActionEnd) {
|
|
*p_lValue=PLA_fn_bTestIfEndOfAction(hNewSuperObjPerso);
|
|
return (p_stTree);
|
|
}
|
|
|
|
M_AIFatalError(E_uwAIFatalNotValidCondition);
|
|
return(p_stTree);
|
|
}
|
|
|
|
|
|
/*ENDANNECY CT}*/
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
* Condition: HIER_EstFils_acteur ( toto ) *
|
|
* true if actor is a son of toto *
|
|
* Author : Jacques Thénoz *
|
|
* Date of last modification: 10/02/98 *
|
|
**********************************************************************/
|
|
tdstNodeInterpret *fn_p_stHierarchySon (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
tdstGetSetParam stParam;
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
HIE_tdxHandleToSuperObject hFather;
|
|
HIE_tdxHandleToSuperObject hChild;
|
|
int i;
|
|
struct DNM_stDynamics* pstDynamic;
|
|
MS_tdxHandleToDynam h_Dynam;
|
|
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
*p_lValue = FALSE;
|
|
|
|
M_EvalNextParameter( &stParam );
|
|
hFather = (HIE_tdxHandleToSuperObject) M_GetSetParam_p_stSupObjValue( &stParam );
|
|
|
|
SAF_M_AssertWithMsg(hFather, "l'acteur spécifié est nul");
|
|
|
|
h_Dynam = M_GetMSHandle(hNewSuperObjPerso,Dynam);
|
|
if (h_Dynam)
|
|
{
|
|
pstDynamic = fn_p_stDynamGetDynamics(h_Dynam);
|
|
if (DNM_M_bDynamicsIsComplexSize(pstDynamic))
|
|
{
|
|
if (DNM_M_hDynamicsGetPlatformSO(pstDynamic)==hFather) *p_lValue = TRUE;
|
|
return p_stTree;
|
|
}
|
|
}
|
|
|
|
HIE_M_ForEachChildOf (hFather,hChild,i)
|
|
{
|
|
if (hChild==hNewSuperObjPerso)
|
|
{
|
|
*p_lValue = TRUE;
|
|
return p_stTree;
|
|
}
|
|
}
|
|
|
|
return(p_stTree);
|
|
}
|
|
|
|
|
|
/*ANNECY Bart#01 13/02/98 {*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : *fn_p_stCheckCapabilities
|
|
|
|
p_SuperObjPerso ->
|
|
p_stTree ->
|
|
p_lValue ->
|
|
Returns (tdstNodeInterpret )
|
|
----------------------------------------------------------------------------------------
|
|
Author : Fred 'Bart#01' Compagnon
|
|
Date : 13/02/98
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
tdstNodeInterpret *fn_p_stCheckCapabilities(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
|
|
tdstGetSetParam stParam;
|
|
|
|
unsigned long ubf32CapabilityToTest = 0;
|
|
unsigned long ubf32BitOfCapability = 0;
|
|
unsigned char ucBitNumber;
|
|
struct tdstEngineObject_ * hEngineObj; /* there's no "tdhEngineObject" ? ? ? ? ? ? ! ! !*/
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
|
|
*p_lValue = FALSE;
|
|
|
|
switch(eCondId)
|
|
{
|
|
case eCond_HasTheCapability:
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eCond_HasOneOfTheCapabilities:
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
{
|
|
M_EvalNextParameter(&stParam);
|
|
ubf32CapabilityToTest = M_GetSetParam_CapsValue(&stParam);
|
|
|
|
M_EvalNextParameter(&stParam);
|
|
ubf32BitOfCapability = M_GetSetParam_CapsValue(&stParam);
|
|
break;
|
|
}
|
|
case eCond_HasTheCapabilityNumber:
|
|
{
|
|
M_EvalNextParameter(&stParam);
|
|
ubf32CapabilityToTest = M_GetSetParam_CapsValue(&stParam);
|
|
|
|
M_EvalNextParameter(&stParam);
|
|
ucBitNumber = (unsigned char) M_GetSetParam_lValue(&stParam);
|
|
|
|
if (ucBitNumber >= 32)
|
|
{
|
|
return(p_stTree); /* *p_lValue = FALSE;*/
|
|
break;
|
|
}
|
|
ubf32BitOfCapability = 1<<ucBitNumber;
|
|
break;
|
|
}
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
case eCond_PersoHasTheCapability:
|
|
case eCond_PersoHasOneOfTheCapabilities:
|
|
{
|
|
/* get perso capacity */
|
|
hEngineObj = M_GetEngineObject(hNewSuperObjPerso);
|
|
ubf32CapabilityToTest = fn_ulGetCapabilities(hEngineObj);
|
|
|
|
M_EvalNextParameter(&stParam);
|
|
ubf32BitOfCapability = M_GetSetParam_CapsValue(&stParam);
|
|
break;
|
|
}
|
|
case eCond_PersoHasTheCapabilityNumber:
|
|
{
|
|
/* get perso capacity */
|
|
hEngineObj = M_GetEngineObject(hNewSuperObjPerso);
|
|
ubf32CapabilityToTest = fn_ulGetCapabilities(hEngineObj);
|
|
|
|
M_EvalNextParameter(&stParam);
|
|
ucBitNumber = (unsigned char) M_GetSetParam_lValue(&stParam);
|
|
|
|
if (ucBitNumber >= 32)
|
|
{
|
|
return(p_stTree); /* *p_lValue = FALSE;*/
|
|
break;
|
|
}
|
|
ubf32BitOfCapability = 1<<ucBitNumber;
|
|
break;
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
default:
|
|
break;
|
|
}
|
|
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
if ( (eCondId == eCond_HasOneOfTheCapabilities) || (eCondId == eCond_PersoHasOneOfTheCapabilities) )
|
|
*p_lValue = ((ubf32CapabilityToTest & ubf32BitOfCapability) != 0);
|
|
else
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
*p_lValue = ((ubf32CapabilityToTest & ubf32BitOfCapability) == ubf32BitOfCapability);
|
|
|
|
return(p_stTree);
|
|
}
|
|
|
|
/*ENDANNECY Bart#01 }*/
|
|
|
|
/*ANNECY CT 02/03/98{*/
|
|
/**********************************************************************
|
|
* Function: ACT_EstActif *
|
|
* Use : Booleen = ACT_EstActif(perso) *
|
|
* *
|
|
* Author : Carlos Torres *
|
|
* Date of last modification: 04/03/98 *
|
|
**********************************************************************/
|
|
tdstNodeInterpret * fn_p_stIsPersoActive(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
/* enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
|
|
|
|
|
|
if (eCondId == eCond_IsPersoActive)
|
|
{
|
|
*/
|
|
tdstGetSetParam stParam;
|
|
M_EvalNextParameter(&stParam);
|
|
|
|
if ( M_GetSetParam_p_stEngineObjValue(&stParam)->h_StandardGame )
|
|
{
|
|
p_SuperObjPerso = M_GetSetParam_p_stSupObjValue(&stParam);
|
|
SAF_M_AssertWithMsg(p_SuperObjPerso, "l'acteur spécifié est nul");
|
|
*p_lValue = GAM_fn_bIsCharacterActive(p_SuperObjPerso);
|
|
}
|
|
else
|
|
*p_lValue = 0; /* when actor is an always, its MS pointers are cleard when is is destroyed*/
|
|
return (p_stTree);
|
|
/* }
|
|
|
|
M_AIFatalError(E_uwAIFatalNotValidCondition);
|
|
return(p_stTree);
|
|
*/
|
|
}
|
|
/*ENDANNECY CT}*/
|
|
|
|
/**********************************************************************
|
|
* Condition: ACT_NEstPasEnCollisionAvecMap () *
|
|
* Condition: ACT_NEstPasEnCollisionAvecProjectiles () *
|
|
* Condition: ACT_NEstPasEnCollisionAvecActeursSecondaires () *
|
|
* Condition: ACT_NEstPasEnCollisionAvecActeurPrincipal () *
|
|
* true according Collision Flag in CollisionSet MS *
|
|
* *
|
|
* Author : Marc Trabucato *
|
|
* Date of last modification: 17/03/98 *
|
|
**********************************************************************/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
|
|
tdstNodeInterpret *fn_p_stIsCollisionFlag (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
|
|
MS_tdxHandleToCollSet hCollSet;
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
|
|
hCollSet = M_GetMSHandle(hNewSuperObjPerso,CollSet);
|
|
switch( eCondId )
|
|
{
|
|
case eCond_NEstPasEnCollisionAvecMap:
|
|
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithMap( hCollSet );
|
|
break;
|
|
|
|
case eCond_NEstPasEnCollisionAvecProjectile:
|
|
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithProjectile( hCollSet );
|
|
break;
|
|
|
|
case eCond_NEstPasEnCollisionAvecSecondCharact:
|
|
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithSecondaryCharacter( hCollSet );
|
|
break;
|
|
|
|
case eCond_NEstPasEnCollisionAvecMainCharact:
|
|
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithMainCharacter( hCollSet );
|
|
break;
|
|
|
|
case eCond_NEstPasEnCollisionAvecAutresSecteurs:
|
|
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithOtherSectors( hCollSet );
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return(p_stTree);
|
|
}
|
|
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/**********************************************************************
|
|
* Function: ACT_EstDe *
|
|
* Use : Booleen = ULTRA.ACT_EstDeFamille(Famille) *
|
|
* Use : Booleen = ULTRA.ACT_EstDeModele(Modele) *
|
|
* *
|
|
* Author : Yann Le Guyader *
|
|
* Date of last modification: 24/03/98 *
|
|
**********************************************************************/
|
|
tdstNodeInterpret * fn_p_stIsOf(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue) {
|
|
enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
tdstGetSetParam stParam;
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
|
|
M_EvalNextParameter(&stParam);
|
|
switch( eCondId )
|
|
{
|
|
case eCond_IsInFamily:
|
|
{
|
|
*p_lValue=(fn_h3dDataGetFamily(M_GetMSHandle(hNewSuperObjPerso,3dData)) == M_GetSetParam_hFamily(&stParam));
|
|
return (p_stTree);
|
|
break;
|
|
}
|
|
case eCond_IsInModel:
|
|
{
|
|
MS_tdxHandleToBrain hBrain = M_GetMSHandle(hNewSuperObjPerso,Brain);
|
|
*p_lValue=(
|
|
hBrain
|
|
&& (AI_M_p_stGetAIModel(M_pstGetMindOfBrain(hBrain)) == M_GetSetParam_p_stModel(&stParam))
|
|
);
|
|
|
|
return (p_stTree);
|
|
break;
|
|
}
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
M_AIFatalError(E_uwAIFatalNotValidCondition);
|
|
return(p_stTree);
|
|
}
|
|
/**********************************************************************
|
|
* Function: IPT_AJoypadIsConnected
|
|
**********************************************************************/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 07/06/99 { */
|
|
tdstNodeInterpret * fn_p_stAJoypadIsConnected(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
#ifdef USE_IPT_DX5
|
|
*p_lValue= IPT_fn_bIsJoystickControlAvailable();
|
|
#else /* USE_IPT_WIN */
|
|
*p_lValue= IPT_fn_bAJoypadConnected();
|
|
#endif /* USE_IPT_WIN */
|
|
return(p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
|
|
/**********************************************************************
|
|
* Function: IPT_AKeyJustPressed
|
|
**********************************************************************/
|
|
tdstNodeInterpret * fn_p_stAKeyJustPressed(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
/* LOL*/
|
|
#ifndef U64
|
|
*p_lValue= IPT_fn_bAKeyJustPressed();
|
|
#else
|
|
M_PrintfStopErrorN64(("Condition fn_p_stAKeyJustPressed invalidate for N64"));
|
|
#endif
|
|
return(p_stTree);
|
|
|
|
}
|
|
/**********************************************************************
|
|
* Function: IPT_AButtonPadJustPressed
|
|
**********************************************************************/
|
|
tdstNodeInterpret * fn_p_stAButtonPadJustPressed(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
*p_lValue= IPT_fn_bAButtonPadJustPressed();
|
|
return(p_stTree);
|
|
|
|
}
|
|
|
|
/*HP 101298*/
|
|
/**********************************************************************
|
|
* Function fn_p_stDemoCondition
|
|
**********************************************************************/
|
|
tdstNodeInterpret * fn_p_stDemoCondition(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
*p_lValue=g_stEngineStructure.xDemoMode;
|
|
return(p_stTree);
|
|
}
|
|
/**********************************************************************
|
|
* Function fn_p_stIsStereoMode
|
|
* Parameters:
|
|
* Return TRUE if stereo
|
|
**********************************************************************/
|
|
tdstNodeInterpret * fn_p_stIsInStereoMode(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
*p_lValue = SND_fn_bGetStereoSound();
|
|
return(p_stTree);
|
|
}
|
|
|
|
/**********************************************************************
|
|
* Function fn_p_stMusicPlaying
|
|
* Parameters:
|
|
* Return TRUE if there's a music now playing
|
|
**********************************************************************/
|
|
tdstNodeInterpret * fn_p_stIsMusicPlaying(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
*p_lValue = SND_fn_bIsMusicPlayingSound();
|
|
return(p_stTree);
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* Function fn_p_stIsIsShapnessMax
|
|
**********************************************************************/
|
|
#ifdef U64
|
|
extern unsigned char g_bSharpnessValue;
|
|
extern char g_bMustSwitchResolution;
|
|
extern int SCREEN_WD;
|
|
|
|
tdstNodeInterpret * fn_p_stIsIsShapnessMax(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
if (((SCREEN_WD==300) || (g_bMustSwitchResolution == 1)) && (g_bMustSwitchResolution != 2))
|
|
{
|
|
*p_lValue = g_bSharpnessValue;
|
|
}
|
|
else
|
|
{
|
|
*p_lValue = 1;
|
|
}
|
|
|
|
return(p_stTree);
|
|
}
|
|
#endif
|
|
|
|
|
|
tdstNodeInterpret *fn_p_stIsSlotDataCorrupt(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
*p_lValue = 0;
|
|
return (p_stTree);
|
|
}
|
|
|
|
tdstNodeInterpret *fn_p_stIsCheatMenu(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
*p_lValue = 0;
|
|
return (p_stTree);
|
|
}
|
|
tdstNodeInterpret *fn_p_stIsUSBuild(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
|
|
{
|
|
*p_lValue = TRUE;
|
|
return (p_stTree);
|
|
}
|