reman3/Rayman_X/cpa/public/AI/AIDebug/specif/AID_Trac.h

414 lines
16 KiB
C

/*
//////////////////////////////////////////////////////////////////////
AI Debug trace file
//////////////////////////////////////////////////////////////////////
File Name : AID_Trac.h
Date : September 29, 1997
Author : David Reizer
//////////////////////////////////////////////////////////////////////
Purpose :
This file defines structures and prototypes for AI engine debug trace
//////////////////////////////////////////////////////////////////////
*/
#if !defined(__AID_TRACE_TYPES__)
#define __AID_TRACE_TYPES__
#if !defined(ONLY_TYPES)
#define AID_TRACE_UNDEF
#define ONLY_TYPES
#endif /* !ONLY_TYPES */
#if defined(AID_TRACE_UNDEF)
#undef ONLY_TYPES
#undef AID_TRACE_UNDEF
#endif /* AID_TRACE_UNDEF */
#if defined(ACTIVE_AIDEBUG)
#include "AI\AIBASE\GSParam.h"
/* Different types of SectionEntry */
typedef enum AIDebug_tdeSectionType_
{
AIDebug_E_SecTyp_EngineLoop,
AIDebug_E_SecTyp_ReflexOrAI,
AIDebug_E_SecTyp_CurrentComport,
AIDebug_E_SecTyp_Field,
AIDebug_E_SecTyp_Constant,
AIDebug_E_SecTyp_DsgVarId,
AIDebug_E_SecTyp_DsgVar,
AIDebug_E_SecTyp_Button,
AIDebug_E_SecTyp_EnvRef,
AIDebug_E_SecTyp_SectorRef,
AIDebug_E_SecTyp_SurfaceRef,
AIDebug_E_SecTyp_PersoRef,
AIDebug_E_SecTyp_ActionRef,
AIDebug_E_SecTyp_Real,
AIDebug_E_SecTyp_Vector,
AIDebug_E_SecTyp_ConstantVector,
AIDebug_E_SecTyp_WayPoint,
AIDebug_E_SecTyp_Module,
AIDebug_E_SecTyp_Mask,
AIDebug_E_SecTyp_String,
AIDebug_E_SecTyp_LipsSynchroRef,
AIDebug_E_SecTyp_SoundEventRef,
AIDebug_E_SecTyp_FamilyRef,
AIDebug_E_SecTyp_BeginMacro,
AIDebug_E_SecTyp_EndMacro,
AIDebug_E_SecTyp_Comport,
AIDebug_E_SecTyp_KeyWord,
AIDebug_E_SecTyp_Condition,
AIDebug_E_SecTyp_Function,
AIDebug_E_SecTyp_Operator,
AIDebug_E_SecTyp_Procedure,
AIDebug_E_SecTyp_MetaAction,
AIDebug_E_SecTyp_MacroRef,
AIDebug_E_SecTyp_BeginMetaAction,
AIDebug_E_SecTyp_TextRef,
AIDebug_E_SecTyp_FontRef,
AIDebug_E_SecTyp_ParticleGenerator,
AIDebug_E_SecTyp_ObjectTableRef,
AIDebug_E_SecTyp_GameMaterialRef,
AIDebug_E_SecTyp_NbOfSectionType
} AIDebug_tdeSectionType;
/*
* A Section Entry contains :
* a Type of Section
* a GetSetParam field (value and type of the data)
* an optional Id
* the depth in the Ai tree
* the optionnal adress of the corresponding node
*/
typedef struct AIDebug_tdstSectionEntry_
{
AIDebug_tdeSectionType m_eSectionType;
tdstGetSetParam m_stGetSetParam;
tdstNodeInterpret *m_p_stNode;
} AIDebug_tdstSectionEntry;
/*
* A trace contains :
* an array of SectionEntry
* a pointer to the position to insert a new SectionEntry
* a flag indicating if whole the array is used
* the number of EngineLoop
* the first EngineLoop recorded in the buffer
* a flag to enable/desable the trace for a perso
* an index for the exploitation of the trace
*/
typedef struct AIDebug_tdstTrace_
{
struct AIDebug_tdstSectionEntry_ *m_d_stBuffer ;
unsigned short m_uwSizeOfBuffer;
unsigned short m_uwCurrentIndex;
unsigned short m_b_uwBufferIsFull;
/* unsigned short m_uwCurrentEngineLoop;*/
/* unsigned short m_uwFirstEngineLoop;*/
unsigned short m_b_uwIsEnable;
unsigned short m_uwExplIndex;
} AIDebug_tdstTrace;
#endif /*ACTIVE_AIDEBUG*/
#endif /* !__AID_TRACE_TYPES__ */
#if !defined(ONLY_TYPES)
#if !defined(__AID_TRACE_VARS__)
#define __AID_TRACE_VARS__
#undef AID_TRACE_EXTERN
#undef extern
#if !defined(AID_TRACE_GLOBALS)
#define AID_TRACE_EXTERN extern
#else
#define AID_TRACE_EXTERN
#endif /* AID_TRACE_GLOBALS */
#if defined(ACTIVE_AIDEBUG)
#define AIDebug_C_uwInvalidPosition ((unsigned short)-1)
#define AIDebug_C_uwDefaultSizeOfBuffer ((unsigned short)10000)
#define AIDebug_C_ucMaxSectionNameLength ((unsigned char)250)
/*
* MACRO Declarations
*/
/* check a Section Type */
#define AIDebug_M_bIsValidSectionType(_eType)\
(\
((_eType)>=AIDebug_E_SecTyp_EngineLoop)\
&&((_eType)<AIDebug_E_SecTyp_NbOfSectionType)\
)
/* to access the fields of a trace */
#define AIDebug_M_d_stGetBuffer(_pstTrace) ((_pstTrace)->m_d_stBuffer)
#define AIDebug_M_uwGetSizeOfBuffer(_pstTrace) ((_pstTrace)->m_uwSizeOfBuffer)
#define AIDebug_M_uwGetCurrentIndex(_pstTrace) ((_pstTrace)->m_uwCurrentIndex)
#define AIDebug_M_bBufferIsFull(_pstTrace) ((_pstTrace)->m_b_uwBufferIsFull)
/*#define AIDebug_M_uwGetCurrentEngineLoop(_pstTrace) ((_pstTrace)->m_uwCurrentEngineLoop)*/
/*#define AIDebug_M_uwGetFirstEngineLoop(_pstTrace) ((_pstTrace)->m_uwFirstEngineLoop)*/
#define AIDebug_M_bIsEnable(_pstTrace) ((_pstTrace)->m_b_uwIsEnable)
#define AIDebug_M_uwGetExplIndex(_pstTrace) ((_pstTrace)->m_uwExplIndex)
#define AIDebug_M_bBufferIsEmpty(_p_stTrace)\
((!AIDebug_M_bBufferIsFull(_p_stTrace))&&(AIDebug_M_uwGetCurrentIndex(_p_stTrace)==0))
#define AIDebug_M_bIsValidIndex(_p_stTrace,_uwIndex)\
( (_uwIndex<AIDebug_M_uwGetCurrentIndex(_p_stTrace))\
||( (_uwIndex>=AIDebug_M_uwGetCurrentIndex(_p_stTrace))\
&&(AIDebug_M_bBufferIsFull(_p_stTrace))\
&&(_uwIndex<AIDebug_M_uwGetSizeOfBuffer(_p_stTrace)) ) )
#define AIDebug_M_uwGetPrevIndex(_p_stTrace,_uwIndex)\
((unsigned short)( _uwIndex == 0 ? (AIDebug_M_uwGetSizeOfBuffer(_p_stTrace) - 1) : (_uwIndex - 1)))
#define AIDebug_M_uwGetBeginData(_p_stTrace)\
(AIDebug_M_bBufferIsFull(_p_stTrace) ? AIDebug_M_uwGetCurrentIndex(_p_stTrace) : 0 )
/* to access the buffer */
#define AIDebug_M_eGetNSectionType(_pstTrace,_nb)\
(AIDebug_M_d_stGetBuffer(_pstTrace)[_nb].m_eSectionType)
#define AIDebug_M_stGetNGetSetParam(_pstTrace,_nb)\
(AIDebug_M_d_stGetBuffer(_pstTrace)[_nb].m_stGetSetParam)
#define AIDebug_M_p_stGetNNode(_pstTrace,_nb)\
(AIDebug_M_d_stGetBuffer(_pstTrace)[_nb].m_p_stNode)
/* initialize the trace */
#define AIDebug_M_InitTrace(_p_stMind)\
AIDebug_fn_vInitTrace(_p_stMind);\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
#define AIDebug_M_InitBuffer(_p_stMind)\
AIDebug_fn_vInitBuffer(_p_stMind);\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
#define AIDebug_M_FreeBuffer(_p_stMind)\
AIDebug_fn_vFreeBuffer(_p_stMind);\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
/* add inforamtions in the trace */
#define AIDebug_M_EnterEngineLoop(_p_stMind)\
AIDebug_fn_uwEnterEngineLoop(_p_stMind);\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
#define AIDebug_M_SetCurrentComport(_p_stMind,_p_stCurrentComport)\
AIDebug_fn_uwSetCurrentComport(_p_stMind,_p_stCurrentComport);\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
#define AIDebug_M_uwAddSectionEntry(_pstMind,_eSecTyp,_pGetSetParam,_p_stNode)\
AIDebug_fn_uwAddSectionEntry(_pstMind,_eSecTyp,_pGetSetParam,_p_stNode);\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
#define AIDebug_M_uwAddSectionEntryUsingLong(_pstMind,_eSecTyp,_lValue,_p_stNode)\
AIDebug_fn_uwAddSectionEntryUsingLong(_pstMind,_eSecTyp,_lValue,_p_stNode);\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
#define AIDebug_M_UpdateGetSetParam(_pstMind,_uwIndex,_pGetSetParam)\
AIDebug_fn_vUpdateGetSetParam(_pstMind,_uwIndex,_pGetSetParam);\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
#define AIDebug_M_SetReflexOrAI(_p_stMind,_uwReflexOrAI)\
AIDebug_M_uwAddSectionEntryUsingLong(_p_stMind,AIDebug_E_SecTyp_ReflexOrAI,(long)_uwReflexOrAI,0);
#define AIDebug_M_SetField(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Field,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetConstant(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Constant,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetDsgVar(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_DsgVar,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetButton(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Button,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetEnvironmentRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_EnvRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetSectorRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_SectorRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetSurfaceRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_SurfaceRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetPersoRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_PersoRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetActionRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_ActionRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetReal(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Real,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetVector(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Vector,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetConstantVector(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_ConstantVector,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetWayPoint(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_WayPoint,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetModule(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Module,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetDsgVarId(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_DsgVarId,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetMask(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Mask,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetString(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_String,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetLipsSynchroRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_LipsSynchroRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetSoundEventRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_SoundEventRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetFamilyRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_FamilyRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetBeginMacro(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_BeginMacro,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetEndMacro(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_EndMacro,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetComport(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Comport,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetKeyWord(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_KeyWord,_pGetSetParam,_p_stNode);
#define AIDebug_M_PrepareCondition(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Condition,_pGetSetParam,_p_stNode);
#define AIDebug_M_PrepareFunction(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Function,_pGetSetParam,_p_stNode);
#define AIDebug_M_PrepareOperator(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Operator,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetProcedure(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_Procedure,_pGetSetParam,_p_stNode);
#define AIDebug_M_PrepareMetaAction(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_MetaAction,_pGetSetParam,_p_stNode);
#define AIDebug_M_PrepareMacroRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_MacroRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_PrepareBeginMetaAction(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_BeginMetaAction,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetTextRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_TextRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetFontRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_FontRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetParticleGenerator(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_ParticleGenerator,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetObjectTableRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_ObjectTableRef,_pGetSetParam,_p_stNode);
#define AIDebug_M_SetGameMaterialRef(_p_stMind,_pGetSetParam,_p_stNode)\
AIDebug_M_uwAddSectionEntry(_p_stMind,AIDebug_E_SecTyp_GameMaterialRef,_pGetSetParam,_p_stNode);
#endif /*ACTIVE_AIDEBUG*/
#endif /* __AID_TRACE_VARS__ */
#if !defined (__AID_TRACE_PROTOS__)
#define __AID_TRACE_PROTOS__
#if defined(ACTIVE_AIDEBUG)
/**************************************/
#if !defined(CPA_EXPORT)
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif /*CPA_WANTS_IMPORT || CPA_WANTS_EXPORT*/
#endif /*CPA_EXPORT*/
/**************************************/
#undef extern
#define EXTERN_AI_DLL extern
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Initialisation */
void AIDebug_fn_vInitTrace( struct AI_tdstMind_* );
void AIDebug_fn_vInitBuffer( struct AI_tdstMind_* );
void AIDebug_fn_vFreeBuffer( struct AI_tdstMind_* );
unsigned short AIDebug_fn_uwAddSectionEntry( struct AI_tdstMind_*, AIDebug_tdeSectionType, tdstGetSetParam*, tdstNodeInterpret* );
/*unsigned short AIDebug_fn_uwPeekSectionEntry( struct AI_tdstMind_*, unsigned short, AIDebug_tdeSectionType*, tdstGetSetParam* );*/
unsigned short AIDebug_fn_uwAddSectionEntryUsingLong( struct AI_tdstMind_*, AIDebug_tdeSectionType, long, tdstNodeInterpret* );
unsigned short AIDebug_fn_uwEnterEngineLoop( struct AI_tdstMind_* );
unsigned short AIDebug_fn_uwSetCurrentComport( struct AI_tdstMind_*, tdstComport* );
void AIDebug_fn_vUpdateGetSetParam( struct AI_tdstMind_*, unsigned short, tdstGetSetParam* );
unsigned short AIDebug_fn_uwFindNextSection( AIDebug_tdstTrace*, unsigned short, AIDebug_tdeSectionType );
EXTERN_AI_DLL CPA_EXPORT unsigned short AIDebug_fn_bGetEnable( struct AI_tdstMind_* );
EXTERN_AI_DLL CPA_EXPORT void AIDebug_fn_vSetEnable( struct AI_tdstMind_*, unsigned short );
EXTERN_AI_DLL CPA_EXPORT unsigned short AIDebug_fn_bInitExploitation
(
struct AI_tdstMind_*,
AIDebug_tdeSectionType*,
long*,
tdstGetSetParam*,
unsigned char*,
tdstNodeInterpret**
);
EXTERN_AI_DLL CPA_EXPORT unsigned short AIDebug_fn_bGetNextEntry
(
struct AI_tdstMind_*,
AIDebug_tdeSectionType*,
long*,
tdstGetSetParam*,
unsigned char*,
tdstNodeInterpret**
);
EXTERN_AI_DLL CPA_EXPORT unsigned short AIDebug_fn_uwGetSizeOfTrace( struct AI_tdstMind_* );
EXTERN_AI_DLL CPA_EXPORT void AIDebug_fn_vResizeTrace( struct AI_tdstMind_*, unsigned short );
EXTERN_AI_DLL CPA_EXPORT void AIDebug_fn_vReinitTrace( struct AI_tdstMind_* );
#ifdef __cplusplus
};
#endif /* __cplusplus */
#undef EXTERN_AI_DLL
#endif /*ACTIVE_AIDEBUG*/
#endif /* !__AID_TRACE_PROTOS__ */
#endif /* !ONLY_TYPES */