149 lines
5.5 KiB
C
149 lines
5.5 KiB
C
/*---------------------------------------------------------------------------*/
|
|
/* Action.cpp : Definition of general Action.*/
|
|
/* auteur : Olivier Didelot 15/10/1996*/
|
|
/* modify : Olivier Didelot 27/12/1996*/
|
|
/* modify : Olivier Couvreur 20/01/1997 Support for script and editor names + parameter types*/
|
|
/* modify : Fabien MORALES 21/01/1997 Blocking actions management*/
|
|
/* modify : Fabien MORALES 29/01/1997 Vertex param*/
|
|
/* modify : Olivier Couvreur 04/02/1997 Lint 0 warnings */
|
|
/* modify : Olivier Couvreur 10/02/1997 Great enhancement for automatic init support*/
|
|
/* modify : Fabien MORALES 12/02/1997 Module & DsgVarId param types*/
|
|
/* modify : Olivier Couvreur 21/02/1997 Handle uppercase and lowaercase type string for editor*/
|
|
/* modify : Olivier Couvreur 26/02/1997 Lint check + call to fn_vInitModuleAcionEntries + suppres fn_p_stFindObjectRec & fn_p_stFindObjectInWorld*/
|
|
/* modify : Olivier Couvreur 25/03/1997 ACTIVE_EDITOR support*/
|
|
/*---------------------------------------------------------------------------*/
|
|
#include "AIUseCPA.h"
|
|
|
|
#include "specif/AIOption.h"
|
|
#include "AIMacros.h"
|
|
#include "AI_Erm.h"
|
|
|
|
#include "StrIntel.h"
|
|
#include "ActParam.h"
|
|
|
|
#include "Intell.h"
|
|
#include "Convert.h"
|
|
#include "Action.h"
|
|
#include "EnumAct.h"
|
|
|
|
/*XB*/
|
|
#include <ctype.h> /*for toupper*/
|
|
/*End XB*/
|
|
|
|
/* Action Return : to block the next action*/
|
|
unsigned char g_ucNewActionReturn; /* to set the action type using the script*/
|
|
unsigned char g_ucUseDefaultActionReturn; /* the g_ucNewActionReturn is not taking into account*/
|
|
|
|
/****************************************************************************************/
|
|
/* ACTIONS */
|
|
/****************************************************************************************/
|
|
|
|
/* to handle meta-action parameters*/
|
|
tdstNodeInterpret *fn_p_stDefaultActionInit(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
|
|
{
|
|
char *szTypeParam=NULL;
|
|
unsigned char ucNbParam=0;
|
|
enum tdeMetaActionId_ eMetaActionId=M_eMetaActionIdInterpret(p_stTree-1);
|
|
szTypeParam=szGetMetaActionTypeInParamFromId(eMetaActionId);
|
|
ucNbParam= (unsigned char) strlen(szTypeParam);
|
|
|
|
/*Chiant pour la generation du C*/
|
|
/*#if defined(__DEBUG_AI__)*/
|
|
/* M_VerifyNbParamAction(p_stTree,ucNbParam);*/
|
|
/*#endif // __DEBUG_AI__*/
|
|
|
|
if (ucNbParam!=0)
|
|
{
|
|
tdstGetSetParam stParam;
|
|
char cType;
|
|
unsigned char ucParam=0;
|
|
|
|
for (ucParam=0;ucParam<ucNbParam;ucParam++)
|
|
{
|
|
M_EvalNextParameter(&stParam);
|
|
|
|
/* toupper important*/
|
|
cType=(char) toupper(szTypeParam[ucParam]);
|
|
|
|
/**************************/
|
|
/* Long action param*/
|
|
/************************* */
|
|
if (cType==STRING1_TO_CHAR(C_LONG_PARAM))
|
|
{
|
|
M_Verify2TypesOfParamAction(&stParam, E_vt_Integer,E_vt_Float);
|
|
fn_vSetActionParamlValue(ucParam, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
|
|
}
|
|
/**************************/
|
|
/* Real action param*/
|
|
/**************************/
|
|
else if (cType==STRING1_TO_CHAR(C_REAL_PARAM))
|
|
{
|
|
M_Verify2TypesOfParamAction(&stParam, E_vt_Integer,E_vt_Float);
|
|
fn_vSetActionParamxValue(ucParam, p_SuperObjPerso, M_ReturnParam_xValue(&stParam));
|
|
}
|
|
/**************************/
|
|
/* Vector action param*/
|
|
/**************************/
|
|
else if (cType==STRING1_TO_CHAR(C_VECTOR_PARAM))
|
|
{
|
|
M_VerifyTypeOfParamAction(&stParam, E_vt_Vector);
|
|
fn_vSetActionParamp_stVertex(ucParam, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
|
|
}
|
|
#ifdef D_USE_LIPSYNC
|
|
/******************************/
|
|
/* Lips Synchro param * CGHT **/
|
|
/******************************/
|
|
else if (cType==STRING1_TO_CHAR(C_LIPSYNCHRO_PARAM))
|
|
{
|
|
M_VerifyTypeOfParamAction(&stParam, E_vt_LipsSynchro);
|
|
fn_vSetActionParamhLipsSynchro(ucParam,p_SuperObjPerso, M_GetSetParam_hLipsSynchro(&stParam));
|
|
}
|
|
#endif /* D_USE_LIPSYNC */
|
|
/**************************/
|
|
/* Action action param*/
|
|
/**************************/
|
|
else if (cType==STRING1_TO_CHAR(C_ACTION_PARAM))
|
|
{
|
|
M_VerifyTypeOfParamAction(&stParam, E_vt_Action);
|
|
fn_vSetActionParamStateValue(ucParam, p_SuperObjPerso, M_GetSetParam_ActionValue(&stParam));
|
|
}
|
|
}
|
|
}
|
|
return p_stTree;
|
|
}
|
|
|
|
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
tducActionReturn fn_ucDefaultAction(HIE_tdxHandleToSuperObject p_SuperObjPerso)
|
|
{
|
|
p_SuperObjPerso=p_SuperObjPerso; /* for lint*/
|
|
return (C_ACTION_FINISHED | C_ACTION_ENGINE_CONTINUE);
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|
|
|
|
/****************************************************************************************/
|
|
/* to call once before anything else related to metaaction */
|
|
/****************************************************************************************/
|
|
#if !defined(OPTIMIZED_COMMAND)
|
|
#include "ProtAct.h"
|
|
|
|
void fn_vInitMetaActionEntries(void)
|
|
{
|
|
/* Init*/
|
|
#if defined(__DEBUG_AI__)
|
|
fn_vInitMetaActionTable(fn_p_stDefaultActionInit,fn_ucDefaultAction);
|
|
#endif /* __DEBUG_AI__*/
|
|
|
|
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) fn_vDefineMetaActionEntry(M_METAACTION_ENTRY(a,b,english,c,d,e,f));
|
|
#include "DefAct.h"
|
|
#undef M_DEFINE_METAACTION
|
|
|
|
#if defined(__DEBUG_AI__)
|
|
fn_vCheckMetaActionTable(fn_p_stDefaultActionInit,fn_ucDefaultAction);
|
|
#endif /* __DEBUG_AI__*/
|
|
}
|
|
#endif /* OPTIMIZED_COMMAND*/
|
|
|
|
|