/******************************************************************************
 * CFast_3.hpp : passage de l'ia en C, 3eme passe
 * auteur : Jean-Marc Drouaud
 ******************************************************************************/
#ifndef _CFast_3_Header_
#define _CFast_3_Header_

#include "ai.h"
#include "EdIRIRD.hpp"
#include "CFast_1.hpp"

#define CFast_szParamVarName      "CFast_g_a_stParam"
#define CFast_szPseudoTreeVarName "CFast_g_a_stPseudoTree"
#define CFast_szCondVarName       "CFast_g_a_lLong" 
#define CFast_szBoolMetaRflxName  "CFast_g_bMetaActionInRfx"
//#define CFast_szCFastPath         "x:\\cpa\\exe\\main\\gamedata\\world\\levels\\_common\\cfast\\"
#define CFast_szCFastPath         "gamedata\\world\\levels\\_common\\cfast\\"

BOOL CFast_ThirdPassInit ( CPA_EdIR_Brain *p_oBrain, char *szEngineSectionName, char *szModelName, char *szFamilyName ) ;
BOOL CFast_ThirdPassAddSubroutine ( CPA_EdIR_Brain *p_oBrain, CFast_tdstComportTree *p_stTree, tdstMacro *_p_stMacro, unsigned long ulReflexe ) ;
BOOL CFast_ThirdPassAddRfx ( CPA_EdIR_Brain *p_oBrain, CFast_tdstComportTree *p_stTree, unsigned long ulReflexe ) ;
BOOL CFast_ThirdPassAddCmp ( CPA_EdIR_Brain *p_oBrain, CFast_tdstComportTree *p_stTree, unsigned long ulComportement ) ;
BOOL CFast_ThirdPassFinish ( CPA_EdIR_Brain *p_oBrain ) ;

void ThirdPassInitPseudoTree( long lIndex ) ;

void CFast_ThirdPassInitMacro ( AI_tdstMind *p_stMind ) ;
void CFast_ThirdPassCreateAllMacro (CFast_tdstNode *p_stNode, unsigned long ulNbNode, char *szDecl) ;
void CFast_ThirdPassCreateMacro (CFast_tdstNode *p_stNode, CFast_tdstNode *p_stLastNode) ;
long CFast_ThirdPassAddMacro ( void *vMacroId )  ;
long CFast_ThirdPassIsMacroCreate(void *vMacroId) ;
long CFast_ThirdPassIsMacroExist(void *vMacroId) ;

void CFast_ThirdPassInitSubr ( AI_tdstMind *p_stMind ) ;
void CFast_ThirdPassCreateSubr (CFast_tdstNode *p_stNode, CFast_tdstNode *p_stLastNode) ;
long CFast_ThirdPassAddSubs ( void *vSubrId )  ;
long CFast_ThirdPassIsSubrExist(void *vSubrId) ;

void CFast_ThirdPassPush ( CFast_tdstNode *p_stNode ) ;
CFast_tdstNode *CFast_ThirdPassPop ( void ) ;
long CFast_ThirdPassPopAllParam ( unsigned long ulNbParam, BOOL bRecursiveCall ) ;
CFast_tdstNode *CFast_ThirdPassPopParam ( void ) ;
void CFast_ThirdPassPushParam ( CFast_tdstNode *p_stNode ) ;

void CFast_ThirdPassAddKeyWord (CFast_tdstNode *p_stNode, BOOL bAddVar) ;
void CFast_ThirdPassAddCondition (CFast_tdstNode *p_stNode) ;
void CFast_ThirdPassAddOperator (CFast_tdstNode *p_stNode, BOOL bAddVar) ;
void CFast_ThirdPassAddFunction (CFast_tdstNode *p_stNode) ;
void CFast_ThirdPassAddProcedure (CFast_tdstNode *p_stNode)  ;
void CFast_ThirdPassAddMetaAction (CFast_tdstNode *p_stNode) ;
void CFast_ThirdPassAddField (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddReal (CFast_tdstNode *p_stNode)  ;
void CFast_ThirdPassAddConstant (CFast_tdstNode *p_stNode)  ;
void CFast_ThirdPassAddButton (CFast_tdstNode *p_stCurrentNode);
void CFast_ThirdPassAddMask (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddModule (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddString (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddLipsSynchro (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddFamily (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddPerso (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddAction (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddObject (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddWP (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddComport (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddModule (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddSoundEvent (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddObjectTable (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddGameMaterial (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddParticleGenerator (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddColor (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddModel (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddLight (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddCaps (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddGraph (CFast_tdstNode *p_stCurrentNode) ;
void CFast_ThirdPassAddOptimisedNode (CFast_tdstNode *p_stNode)  ;
void CFast_ThirdPassAddStackNode (CFast_tdstNode *p_stNode, unsigned long ulDepth ) ;
CFast_tdstNode *CFast_ThirdPassParseNode ( CFast_tdstNode *p_stNode, BOOL bAddVar)  ;
BOOL CFast_ThirdPassParseTree ( CFast_tdstNode *p_stNode, unsigned long ulNbNode ) ;
CFast_tdstNode *CFast_ThirdPassSkipNode ( CFast_tdstNode *p_stNode ) ;
void CFast_ThirdPassAddUltraNode (void) ;

long CFast_ThirdPassMakeStaticTree ( CFast_tdstNode *p_stNode) ;
void CFast_ThirdPassAddStaticNode ( CFast_tdstNode *p_stNode) ;

char CFast_Get1Param(char *psz_Temp, CFast_tdstNode *p_stParam, char *cForFloat, char *cForVector, int iIndex) ;
char CFast_ThirdPassAddComp(CFast_tdstNode *p_stNode);

void change_mon_cmp (int) ;
void change_mon_rfx (int) ;

void CFast_vMakeFileNameFromModel (char *, char *);

CFast_tdstNode *CFast_ThirdPassProcessTernOperators ( CFast_tdstNode *p_stNode ) ;

#endif /* _CFast_3_Header_ */
