734 lines
27 KiB
C
734 lines
27 KiB
C
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
extern
|
|
#ifdef _DEBUG
|
|
"C"
|
|
#endif
|
|
unsigned long fn_ulDetermineUsefulDT();
|
|
|
|
#define D_CineInfo_StructureDefine
|
|
|
|
#include "AIUseCPA.h"
|
|
#include "AIMacros.h"
|
|
|
|
#include "StrIntel.h"
|
|
#include "Intell.h"
|
|
#include "ActParam.h"
|
|
#include "Action.h"
|
|
#include "Convert.h"
|
|
#include "EnumAct.h"
|
|
|
|
#include "Gam.h"
|
|
|
|
#include "specif/AITools.h"
|
|
#include "CAM_Base.h"
|
|
#include "CAM_Tool.h"
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
void fnv_MoveAToB
|
|
(
|
|
HIE_tdxHandleToSuperObject p_SuperObjPerso,
|
|
MTH3D_tdstVector *_p_stSource,
|
|
MTH3D_tdstVector *_p_stDest,
|
|
MTH3D_tdstVector *_p_stCurrent,
|
|
int _iTime,
|
|
int _iAccel
|
|
)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MTH_tdxReal xDist, xActDist, xSpeed, xTemp;
|
|
long lTime;
|
|
MTH3D_tdstVector stTempVector;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/* Total dist to move */
|
|
MTH3D_M_vSubVector(&stTempVector, _p_stDest, _p_stSource);
|
|
xDist = MTH3D_M_xNormVector(&stTempVector);
|
|
|
|
/* Dist already moved */
|
|
MTH3D_M_vSubVector(&stTempVector, _p_stCurrent, _p_stSource);
|
|
xActDist = MTH3D_M_xNormVector(&stTempVector);
|
|
|
|
/* Max speed depending on total time and distance */
|
|
xSpeed = MTH_M_xDiv(xDist, MTH_M_xLongToReal(_iTime));
|
|
|
|
/* Time elapsed since beginning */
|
|
lTime = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount - fn_lGetActionParamlValue(5, p_SuperObjPerso);
|
|
|
|
/* Accel */
|
|
if(lTime < _iAccel)
|
|
{
|
|
xSpeed = MTH_M_xMul(MTH_M_xDiv(xSpeed, MTH_M_xLongToReal(_iAccel)), lTime);
|
|
}
|
|
|
|
/* Decel */
|
|
if(lTime > _iTime - _iAccel)
|
|
{
|
|
xTemp = MTH_M_xMul(MTH_M_xLongToReal(lTime), -MTH_M_xDiv(xSpeed, MTH_M_xLongToReal(_iAccel)));
|
|
xSpeed = MTH_M_xAdd(xTemp, MTH_M_xDiv(MTH_M_xMul(MTH_M_xLongToReal(_iTime), xSpeed), MTH_M_xFloatToReal(_iAccel)));
|
|
}
|
|
|
|
/* New pos */
|
|
MTH3D_M_vSubVector(&stTempVector, _p_stDest, _p_stSource);
|
|
MTH3D_M_vNormalizeVector(&stTempVector, &stTempVector);
|
|
|
|
xSpeed = MTH_M_xMul(xSpeed, fn_ulDetermineUsefulDT());
|
|
MTH3D_M_vMulScalarVector(&stTempVector, xSpeed, &stTempVector);
|
|
MTH3D_M_vAddVector(_p_stDest, &stTempVector, _p_stCurrent);
|
|
}
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
void fnv_TurnAWithB
|
|
(
|
|
HIE_tdxHandleToSuperObject p_SuperObjPerso,
|
|
MTH3D_tdstVector *_p_stSource,
|
|
MTH3D_tdstVector *_p_stPointAxis,
|
|
MTH3D_tdstVector *_p_stAxis,
|
|
MTH3D_tdstVector *_p_stCurrent,
|
|
MTH_tdxReal _xAngle,
|
|
int _iTime,
|
|
int _iAccel
|
|
)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MTH_tdxReal xActAngle, xSpeed, xTemp;
|
|
long lTime;
|
|
MTH3D_tdstVector stTempVector, stTempVector1;
|
|
MTH_tdstRotation stRotation;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/* Angle already move */
|
|
MTH3D_M_vSubVector(&stTempVector, _p_stCurrent, _p_stPointAxis);
|
|
CAM_fn_vComputeProjection(&stTempVector, &stTempVector, _p_stAxis);
|
|
MTH3D_M_vSubVector(&stTempVector1, _p_stSource, _p_stPointAxis);
|
|
CAM_fn_vComputeProjection(&stTempVector1, &stTempVector1, _p_stAxis);
|
|
|
|
xActAngle = CAM_fn_xComputeRotation(&stTempVector1, &stTempVector, NULL);
|
|
|
|
/* Max speed depending on total time and distance */
|
|
xSpeed = MTH_M_xDiv(_xAngle, MTH_M_xLongToReal(_iTime));
|
|
|
|
/* Time elapsed since beginning */
|
|
lTime = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount - fn_lGetActionParamlValue(5, p_SuperObjPerso);
|
|
|
|
/* Accel */
|
|
if(lTime < _iAccel)
|
|
{
|
|
xSpeed = MTH_M_xMul(MTH_M_xDiv(xSpeed, MTH_M_xLongToReal(_iAccel)), lTime);
|
|
}
|
|
|
|
/* Decel */
|
|
if(lTime > _iTime - _iAccel)
|
|
{
|
|
xTemp = MTH_M_xMul(MTH_M_xLongToReal(lTime), -MTH_M_xDiv(xSpeed, MTH_M_xLongToReal(_iAccel)));
|
|
xSpeed = MTH_M_xAdd(xTemp, MTH_M_xDiv(MTH_M_xMul(MTH_M_xLongToReal(_iTime), xSpeed), MTH_M_xFloatToReal(_iAccel)));
|
|
}
|
|
|
|
/* New pos */
|
|
MTH3D_M_vCopyVector(&stRotation.m_stAxis, _p_stAxis);
|
|
xSpeed = MTH_M_xMul(xSpeed, fn_ulDetermineUsefulDT());
|
|
stRotation.m_xAngle = xSpeed;
|
|
MTH3D_M_vSubVector(&stTempVector, _p_stCurrent, _p_stPointAxis);
|
|
MTH_p_stRotationMulVector(&stRotation, &stTempVector, _p_stSource);
|
|
MTH3D_M_vAddVector(_p_stSource, _p_stSource, _p_stPointAxis);
|
|
}
|
|
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
|
|
tdstNodeInterpret *fn_p_stCamCineInit(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
MTH3D_tdstVector stTempVector;
|
|
enum tdeMetaActionId_ eMetaActionId = M_eMetaActionIdInterpret(p_stTree-1);
|
|
tdstGetSetParam stParam;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* No meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits |= 0x8000;
|
|
|
|
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
switch(eMetaActionId)
|
|
{
|
|
case eMetaAction_CamCineMoveAToBTgtC:
|
|
case eMetaAction_CamCineMoveAToBTgtAC:
|
|
case eMetaAction_CamCinePosAMoveTgtBToC:
|
|
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamp_stVertex(1, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamp_stVertex(2, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamlValue(3, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamlValue(4, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
|
|
|
|
fn_vSetActionParamlValue(5, p_SuperObjPerso, g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
|
|
if(eMetaActionId == eMetaAction_CamCinePosAMoveTgtBToC)
|
|
{
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
|
|
/* To remember actual target */
|
|
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
}
|
|
else
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), &stTempVector);
|
|
break;
|
|
|
|
case eMetaAction_CamCinePosATgtB:
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamp_stVertex(1, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamlValue(2, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
|
|
|
|
fn_vSetActionParamlValue(3, p_SuperObjPerso, g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
|
|
break;
|
|
|
|
case eMetaAction_CamCinePosATgtBTurnPosH:
|
|
case eMetaAction_CamCinePosATgtBTurnTgtH:
|
|
case eMetaAction_CamCinePosATgtBTurnPosV:
|
|
case eMetaAction_CamCinePosATgtBTurnTgtV:
|
|
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamp_stVertex(1, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamxValue(2, p_SuperObjPerso, M_GetSetParam_xValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamlValue(3, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
|
|
M_EvalNextParameter(&stParam);
|
|
fn_vSetActionParamlValue(4, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
|
|
|
|
fn_vSetActionParamlValue(5, p_SuperObjPerso, g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
|
|
if((eMetaActionId == eMetaAction_CamCinePosATgtBTurnTgtH) || (eMetaActionId == eMetaAction_CamCinePosATgtBTurnTgtV))
|
|
{
|
|
/* To remember actual target */
|
|
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return p_stTree;
|
|
}
|
|
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
|
|
/*
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
|
|
tducActionReturn fn_ucCamCineMoveAToBTgtC(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
MTH3D_tdstVector stTempVector, stCurrentCameraPos;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Test end of meta action */
|
|
if
|
|
(
|
|
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
|
|
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
|
|
)
|
|
{
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), &stTempVector);
|
|
/* Meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
|
|
return C_DefaultMetaActionFinished;
|
|
}
|
|
|
|
/* Actual camera pos */
|
|
POS_fn_vGetTranslationVector
|
|
(
|
|
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
|
|
&stCurrentCameraPos
|
|
);
|
|
|
|
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
fnv_MoveAToB
|
|
(
|
|
p_SuperObjPerso,
|
|
fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso),
|
|
&stTempVector,
|
|
&stCurrentCameraPos,
|
|
fn_lGetActionParamlValue(3, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(4, p_SuperObjPerso)
|
|
);
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, &stTempVector);
|
|
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), &stTempVector);
|
|
|
|
return C_DefaultMetaActionNotFinished;
|
|
}
|
|
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tducActionReturn fn_ucCamCineMoveAToBTgtAC(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
MTH3D_tdstVector stTempVector, stTempVector1, stCurrentCameraPos;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Test end of meta action */
|
|
if
|
|
(
|
|
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
|
|
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
|
|
)
|
|
{
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
MTH3D_M_vSubVector(&stTempVector1, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
|
|
MTH3D_M_vAddVector(&stTempVector1, &stTempVector1, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector1, &stTempVector);
|
|
/* Meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
|
|
return C_DefaultMetaActionFinished;
|
|
}
|
|
|
|
/* Actual camera pos */
|
|
POS_fn_vGetTranslationVector
|
|
(
|
|
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
|
|
&stCurrentCameraPos
|
|
);
|
|
|
|
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
fnv_MoveAToB
|
|
(
|
|
p_SuperObjPerso,
|
|
fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso),
|
|
&stTempVector,
|
|
&stCurrentCameraPos,
|
|
fn_lGetActionParamlValue(3, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(4, p_SuperObjPerso)
|
|
);
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, &stTempVector);
|
|
|
|
MTH3D_M_vSubVector(&stTempVector1, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
|
|
MTH3D_M_vAddVector(&stTempVector1, &stTempVector1, &stTempVector);
|
|
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector1, &stTempVector);
|
|
|
|
return C_DefaultMetaActionNotFinished;
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tducActionReturn fn_ucCamCinePosATgtB(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Test end of meta action */
|
|
if
|
|
(
|
|
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
|
|
((unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(2, p_SuperObjPerso))
|
|
)
|
|
{
|
|
/* Meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
|
|
return C_DefaultMetaActionFinished;
|
|
}
|
|
|
|
return C_DefaultMetaActionNotFinished;
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tducActionReturn fn_ucCamCinePosAMoveTgtBToC(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
MTH3D_tdstVector stTempVector, stTempVector1, stCurrentTarget;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Test end of meta action */
|
|
if
|
|
(
|
|
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
|
|
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
|
|
)
|
|
{
|
|
MTH3D_M_vSetVectorElements(&stTempVector1, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), &stTempVector1);
|
|
/* Meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
|
|
return C_DefaultMetaActionFinished;
|
|
}
|
|
|
|
/* Current target */
|
|
MTH3D_M_vCopyVector(&stCurrentTarget, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
|
|
|
|
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso));
|
|
fnv_MoveAToB
|
|
(
|
|
p_SuperObjPerso,
|
|
fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso),
|
|
&stTempVector,
|
|
&stCurrentTarget,
|
|
fn_lGetActionParamlValue(3, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(4, p_SuperObjPerso)
|
|
);
|
|
MTH3D_M_vSetVectorElements(&stTempVector1, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector, &stTempVector1);
|
|
|
|
/* Remember actual target */
|
|
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &stTempVector);
|
|
|
|
return C_DefaultMetaActionNotFinished;
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tducActionReturn fn_ucCamCinePosATgtBTurnPosH(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
MTH3D_tdstVector stTempVector, stCurrentCameraPos, stAxis;
|
|
POS_tdstCompletePosition *p_stPersoGlobalMatrix;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Test end of meta action */
|
|
if
|
|
(
|
|
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
|
|
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
|
|
)
|
|
{
|
|
/* Meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
|
|
return C_DefaultMetaActionFinished;
|
|
}
|
|
|
|
/* Actual camera pos */
|
|
POS_fn_vGetTranslationVector
|
|
(
|
|
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
|
|
&stCurrentCameraPos
|
|
);
|
|
|
|
/* Rotation axis is camera Z */
|
|
p_stPersoGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso);
|
|
POS_fn_vGetRotationMatrix(p_stPersoGlobalMatrix, &stTempVector, &stTempVector, &stAxis);
|
|
|
|
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
|
|
fnv_TurnAWithB
|
|
(
|
|
p_SuperObjPerso,
|
|
&stTempVector,
|
|
fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso),
|
|
&stAxis,
|
|
&stCurrentCameraPos,
|
|
fn_xGetActionParamxValue(2, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(3, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(4, p_SuperObjPerso)
|
|
);
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, &stTempVector);
|
|
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
|
|
|
|
return C_DefaultMetaActionNotFinished;
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tducActionReturn fn_ucCamCinePosATgtBTurnPosV(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
MTH3D_tdstVector stTempVector, stCurrentCameraPos, stAxis;
|
|
POS_tdstCompletePosition *p_stPersoGlobalMatrix;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Test end of meta action */
|
|
if
|
|
(
|
|
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
|
|
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
|
|
)
|
|
{
|
|
/* Meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
|
|
return C_DefaultMetaActionFinished;
|
|
}
|
|
|
|
/* Actual camera pos */
|
|
POS_fn_vGetTranslationVector
|
|
(
|
|
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
|
|
&stCurrentCameraPos
|
|
);
|
|
|
|
/* Rotation axis is camera X */
|
|
p_stPersoGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso);
|
|
POS_fn_vGetRotationMatrix(p_stPersoGlobalMatrix, &stAxis, &stTempVector, &stTempVector);
|
|
|
|
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
|
|
fnv_TurnAWithB
|
|
(
|
|
p_SuperObjPerso,
|
|
&stTempVector,
|
|
fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso),
|
|
&stAxis,
|
|
&stCurrentCameraPos,
|
|
fn_xGetActionParamxValue(2, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(3, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(4, p_SuperObjPerso)
|
|
);
|
|
CAM_fn_vForceCameraPos(p_SuperObjPerso, &stTempVector);
|
|
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
|
|
|
|
return C_DefaultMetaActionNotFinished;
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tducActionReturn fn_ucCamCinePosATgtBTurnTgtH(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
MTH3D_tdstVector stCurrentCameraPos, stTempVector, stTempVector1, stAxis;
|
|
POS_tdstCompletePosition *p_stPersoGlobalMatrix;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Test end of meta action */
|
|
if
|
|
(
|
|
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
|
|
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
|
|
)
|
|
{
|
|
/* Meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
|
|
return C_DefaultMetaActionFinished;
|
|
}
|
|
|
|
/* Actual camera pos */
|
|
POS_fn_vGetTranslationVector
|
|
(
|
|
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
|
|
&stCurrentCameraPos
|
|
);
|
|
|
|
/* Rotation axis is camera Z */
|
|
p_stPersoGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso);
|
|
POS_fn_vGetRotationMatrix(p_stPersoGlobalMatrix, &stTempVector, &stTempVector, &stAxis);
|
|
|
|
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
fnv_TurnAWithB
|
|
(
|
|
p_SuperObjPerso,
|
|
&stTempVector,
|
|
&stCurrentCameraPos,
|
|
&stAxis,
|
|
fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso),
|
|
fn_xGetActionParamxValue(2, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(3, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(4, p_SuperObjPerso)
|
|
);
|
|
MTH3D_M_vSetVectorElements(&stTempVector1, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector, &stTempVector1);
|
|
|
|
/* Remember actual target */
|
|
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &stTempVector);
|
|
|
|
return C_DefaultMetaActionNotFinished;
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*
|
|
*=================================================================================================
|
|
*=================================================================================================
|
|
*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tducActionReturn fn_ucCamCinePosATgtBTurnTgtV(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
MS_tdxHandleToCineinfo hCineinfo;
|
|
MTH3D_tdstVector stCurrentCameraPos, stTempVector, stTempVector1, stAxis;
|
|
POS_tdstCompletePosition *p_stPersoGlobalMatrix;
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
|
|
#if defined(__DEBUG_AI__)
|
|
if (hCineinfo == NULL)
|
|
M_AIFatalError(E_uwAIFatalNotMSCamera);
|
|
#endif
|
|
|
|
/* Test end of meta action */
|
|
if
|
|
(
|
|
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
|
|
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
|
|
)
|
|
{
|
|
/* Meca */
|
|
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
|
|
return C_DefaultMetaActionFinished;
|
|
}
|
|
|
|
/* Actual camera pos */
|
|
POS_fn_vGetTranslationVector
|
|
(
|
|
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
|
|
&stCurrentCameraPos
|
|
);
|
|
|
|
/* Rotation axis is camera X */
|
|
p_stPersoGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso);
|
|
POS_fn_vGetRotationMatrix(p_stPersoGlobalMatrix, &stAxis, &stTempVector, &stTempVector);
|
|
|
|
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
|
|
fnv_TurnAWithB
|
|
(
|
|
p_SuperObjPerso,
|
|
&stTempVector,
|
|
&stCurrentCameraPos,
|
|
&stAxis,
|
|
fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso),
|
|
fn_xGetActionParamxValue(2, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(3, p_SuperObjPerso),
|
|
fn_lGetActionParamlValue(4, p_SuperObjPerso)
|
|
);
|
|
MTH3D_M_vSetVectorElements(&stTempVector1, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
|
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector, &stTempVector1);
|
|
|
|
/* Remember actual target */
|
|
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &stTempVector);
|
|
|
|
return C_DefaultMetaActionNotFinished;
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|