226 lines
11 KiB
C
226 lines
11 KiB
C
|
|
/**********************************************************
|
|
* *
|
|
* ProcMorph.c *
|
|
* *
|
|
* This file contains all the AI procedures and *
|
|
* conditions for the morphing *
|
|
* *
|
|
* Author : Ubi China - Alexis Vaisse *
|
|
* *
|
|
**********************************************************/
|
|
|
|
|
|
#include "AIUseCPA.h"
|
|
|
|
#include "specif/AIOption.h"
|
|
#include "AIMacros.h"
|
|
#include "AI_Erm.h"
|
|
|
|
#include "Intell.h"
|
|
#include "Action.h"
|
|
#include "StrIntel.h"
|
|
#include "DsgMem.h"
|
|
#include "EnumProc.h"
|
|
#include "specif/AITools.h"
|
|
|
|
#include "Operator.h"
|
|
|
|
#include "Convert.h"
|
|
#define PO_FRIEND
|
|
#include "PO.h"
|
|
#include "mor.h"
|
|
|
|
|
|
#if !defined(OPTIMIZED_COMMAND)
|
|
/* Procedure prototypes*/
|
|
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) struct tdstNodeInterpret_ *##d(HIE_tdxHandleToSuperObject, struct tdstNodeInterpret_ *);
|
|
#include "DefProc.h"
|
|
#undef M_DEFINE_PROCEDURE
|
|
#endif /* !OPTIMIZED_COMMAND*/
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Name : fn_p_stPrepareMorph
|
|
*-----------------------------------------------------------------------------
|
|
* Description : the "MOD_PrepareMorph" AI procedure
|
|
*-----------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tdstNodeInterpret * fn_p_stPrepareMorph (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret * p_stTree)
|
|
{
|
|
ACP_tdxIndex xStartIndexInObjectTable;
|
|
ACP_tdxIndex xEndIndexInObjectTable;
|
|
int iNbMillisecond;
|
|
unsigned char ucMorphType;
|
|
ACP_tdxIndex xChannelIndex;
|
|
tdstGetSetParam stValue [5];
|
|
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
enum tdeProcedureId_ eProcId=M_eProcedureIdInterpret(p_stTree-1);
|
|
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
fn_vGetUltraOperatorPerso (fn_ucGetProcedureUltraOperator(eProcId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
/********************************************************************************/
|
|
|
|
M_EvalNextParameter(&stValue[0]);
|
|
M_EvalNextParameter(&stValue[1]);
|
|
M_EvalNextParameter(&stValue[2]);
|
|
M_EvalNextParameter(&stValue[3]);
|
|
M_EvalNextParameter(&stValue[4]);
|
|
|
|
xStartIndexInObjectTable = M_GetSetParam_lValue(&stValue[0]); /* First parameter : index of the 'start' object in the object table*/
|
|
xEndIndexInObjectTable = M_GetSetParam_lValue(&stValue[1]); /* Second parameter : index of the 'end' object in the object table*/
|
|
iNbMillisecond = M_GetSetParam_lValue(&stValue[2]); /* Third parameter : number of milisecond for the morphing*/
|
|
ucMorphType = M_GetSetParam_lValue(&stValue[3]); /* Fourth parameter : morphing type (can be 1, 2 or 3)*/
|
|
xChannelIndex = M_GetSetParam_lModuleValue(&stValue[4]); /* Fifth parameter : the channel number*/
|
|
|
|
if (MOR_fn_xPrepareMorph (p_SuperObjPerso, xStartIndexInObjectTable, xEndIndexInObjectTable,
|
|
iNbMillisecond, 0, iNbMillisecond, ucMorphType, xChannelIndex) == -1)
|
|
{
|
|
//XB 10/08/99
|
|
/* Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, E_uwAIWarningScriptError , C_lErmNoDebugData,
|
|
C_ucErmOpenInfoWindow, C_ucNeverStopForDebug,
|
|
"Morphing requires two objects with the same number of points");
|
|
Erm_M_ClearLastError(C_ucErmDefaultChannel);*/
|
|
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, "Morphing requires two objects with the same number of points")
|
|
//End XB 10/08/99
|
|
/*XB*/
|
|
#if (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)
|
|
#if !defined(U64_AIDEBUG) /* Oliv' - 23/11/1998*/
|
|
fn_vSetStopAIEngineFlag();
|
|
#endif /* !defined(U64_AIDEBUG)*/
|
|
#endif /* (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)*/
|
|
/*End XB*/
|
|
}
|
|
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Name : fn_p_stStopMorph
|
|
*-----------------------------------------------------------------------------
|
|
* Description : the "MOD_StopMorph" AI procedure
|
|
*-----------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tdstNodeInterpret * fn_p_stStopMorph (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret * p_stTree)
|
|
{
|
|
tdstGetSetParam stValue;
|
|
ACP_tdxIndex xChannelIndex;
|
|
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
enum tdeProcedureId_ eProcId=M_eProcedureIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
fn_vGetUltraOperatorPerso (fn_ucGetProcedureUltraOperator(eProcId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
/********************************************************************************/
|
|
|
|
M_EvalNextParameter (& stValue);
|
|
xChannelIndex = M_GetSetParam_lModuleValue (& stValue); /* Parameter : the channel number*/
|
|
|
|
MOR_fn_xStopMorph(p_SuperObjPerso , xChannelIndex);
|
|
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Name : fn_p_stIsMorphing
|
|
*-----------------------------------------------------------------------------
|
|
* Description : the "MOD_MorphingEnCours" AI condition
|
|
*-----------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tdstNodeInterpret *fn_p_stIsMorphing (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret * p_stTree, long * p_lValue)
|
|
{
|
|
tdstGetSetParam stValue;
|
|
ACP_tdxIndex xChannelIndex;
|
|
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
fn_vGetUltraOperatorPerso (fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
/********************************************************************************/
|
|
|
|
M_EvalNextParameter (& stValue);
|
|
xChannelIndex = M_GetSetParam_lModuleValue (& stValue); /* Parameter : the channel number*/
|
|
|
|
/* Ask the morphing module to know if the channel contains an morphed object*/
|
|
* p_lValue = MOR_fn_bIsChannelMorphed (p_SuperObjPerso, xChannelIndex);
|
|
|
|
return(p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Name : fn_p_stMorphiong
|
|
*-----------------------------------------------------------------------------
|
|
* Description : the "MOD_Morphing" AI procedure
|
|
*-----------------------------------------------------------------------------*/
|
|
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
|
|
tdstNodeInterpret * fn_p_stMorphing (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret * p_stTree)
|
|
{
|
|
ACP_tdxIndex xStartIndexInObjectTable;
|
|
ACP_tdxIndex xEndIndexInObjectTable;
|
|
ACP_tdxIndex xRatio; /* between 0 and 100*/
|
|
ACP_tdxIndex xChannelIndex;
|
|
tdstGetSetParam stValue [4];
|
|
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
enum tdeProcedureId_ eProcId=M_eProcedureIdInterpret(p_stTree-1);
|
|
|
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
|
|
|
/********************************************************************************/
|
|
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
|
|
/********************************************************************************/
|
|
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
|
|
fn_vGetUltraOperatorPerso (fn_ucGetProcedureUltraOperator(eProcId),p_SuperObjPerso,&hNewSuperObjPerso);
|
|
/********************************************************************************/
|
|
|
|
M_EvalNextParameter(&stValue[0]);
|
|
M_EvalNextParameter(&stValue[1]);
|
|
M_EvalNextParameter(&stValue[2]);
|
|
M_EvalNextParameter(&stValue[3]);
|
|
|
|
xStartIndexInObjectTable = M_GetSetParam_lValue(&stValue[0]); /* First parameter : index of the 'start' object in the object table*/
|
|
xEndIndexInObjectTable = M_GetSetParam_lValue(&stValue[1]); /* Second parameter : index of the 'end' object in the object table*/
|
|
xRatio = M_GetSetParam_lValue(&stValue[2]); /* Third parameter : morphing ratio between 0 and 100*/
|
|
xChannelIndex = M_GetSetParam_lModuleValue(&stValue[3]); /* Fourth parameter : the channel number*/
|
|
|
|
if (MOR_fn_xMorphing (p_SuperObjPerso, (ACP_tdxIndex)(xStartIndexInObjectTable-1), (ACP_tdxIndex)(xEndIndexInObjectTable-1), xRatio, xChannelIndex) == -1)
|
|
{
|
|
//XB 10/08/99
|
|
/* Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, E_uwAIWarningScriptError , C_lErmNoDebugData,
|
|
C_ucErmOpenInfoWindow, C_ucNeverStopForDebug,
|
|
"Morphing requires two objects with the same number of points");
|
|
Erm_M_ClearLastError(C_ucErmDefaultChannel);*/
|
|
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, "Morphing requires two objects with the same number of points")
|
|
//End XB 10/08/99
|
|
|
|
/*XB*/
|
|
#if (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)
|
|
#if !defined(U64_AIDEBUG) /* Oliv' - 23/11/1998*/
|
|
fn_vSetStopAIEngineFlag();
|
|
#endif /* !defined(U64_AIDEBUG)*/
|
|
#endif /* (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)*/
|
|
/*End XB*/
|
|
}
|
|
|
|
return (p_stTree);
|
|
}
|
|
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
|