34 lines
2.1 KiB
C++
34 lines
2.1 KiB
C++
#ifndef D_THROW_ANIM_EFFECT
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
void fn_vDoAnimEffect(
|
|
MS_tdxHandleToAnimEffect _hAnimEffect,
|
|
HIE_tdxHandleToSuperObject _p_stActorSuperObject,
|
|
unsigned long _ulChannelId,
|
|
HIE_tdxHandleToSuperObject _hModuleSuperObject
|
|
)
|
|
{
|
|
{
|
|
MTH3D_tdstVector stShift, stPosition, stShiftPhase, stShiftPlus, stShiftMax;
|
|
MTH_tdxReal xCurrentTime = (MTH_tdxReal) (g_stEngineStructure.stEngineTimer.ulCurrentTimerCount / 1000.0);
|
|
GEO_tdxHandleToMatrix hModuleLocalMatrix = HIE_fn_hGetSuperObjectMatrix(_hModuleSuperObject);
|
|
|
|
/*get the sinus phase: a phase for the time, plus an offset for each channel in the anim, all ponderated by the user coefs*/
|
|
stShiftPhase = fn_stAnimEffectGetShiftPhase(_hAnimEffect);
|
|
stShiftPlus = fn_stAnimEffectGetShiftPlus(_hAnimEffect);
|
|
MTH3D_M_vSetXofVector(&stShift, MTH_C_2Pi * (xCurrentTime / MTH3D_M_xGetXofVector(&stShiftPhase) + _ulChannelId / MTH3D_M_xGetXofVector(&stShiftPlus)));
|
|
MTH3D_M_vSetYofVector(&stShift, MTH_C_2Pi * (xCurrentTime / MTH3D_M_xGetYofVector(&stShiftPhase) + _ulChannelId / MTH3D_M_xGetYofVector(&stShiftPlus)));
|
|
MTH3D_M_vSetZofVector(&stShift, MTH_C_2Pi * (xCurrentTime / MTH3D_M_xGetZofVector(&stShiftPhase) + _ulChannelId / MTH3D_M_xGetZofVector(&stShiftPlus)));
|
|
/*now compute the displacement, ponderated by the user coefs. It is expressed in the actor's local coordinates*/
|
|
stShiftMax = fn_stAnimEffectGetShiftMax(_hAnimEffect);
|
|
MTH3D_M_vSetXofVector(&stShift, MTH_M_xSin(MTH3D_M_xGetXofVector(&stShift)) * MTH3D_M_xGetXofVector(&stShiftMax));
|
|
MTH3D_M_vSetYofVector(&stShift, MTH_M_xSin(MTH3D_M_xGetYofVector(&stShift)) * MTH3D_M_xGetYofVector(&stShiftMax));
|
|
MTH3D_M_vSetZofVector(&stShift, MTH_M_xSin(MTH3D_M_xGetZofVector(&stShift)) * MTH3D_M_xGetZofVector(&stShiftMax));
|
|
/*now move the object: modify the global translation matrix of the module*/
|
|
POS_fn_vGetTranslationVector(hModuleLocalMatrix, &stPosition);
|
|
MTH3D_M_vAddVector(&stPosition, &stPosition, &stShift);
|
|
POS_fn_vSetTranslationVector(hModuleLocalMatrix, &stPosition);
|
|
}
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
#endif /* D_THROW_ANIM_EFFECT */
|