5062 lines
182 KiB
C++
5062 lines
182 KiB
C++
// EdIR2Eng.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
|
|
#define D_ZdxStuff_StructureDefine
|
|
|
|
#include "Defines.hpp"
|
|
|
|
#ifdef D_ED_IR_ACTIVE
|
|
|
|
#include "EdIR2Eng.hpp"
|
|
|
|
#include "EdIRBis.hpp"
|
|
#include "EdIRStrg.hpp"
|
|
#include "EdIRMacL.hpp"
|
|
#include "EdIRDVLs.hpp"
|
|
#include "EdIRFrm.hpp"
|
|
#include "EdIRDvVw.hpp"
|
|
#include "EdIRIRD.hpp"
|
|
#include "EdIRBeEn.hpp"
|
|
#include "EdIRBeha.hpp"
|
|
#include "EdIRGlob.hpp"
|
|
#include "EdIRIAGl.hpp"
|
|
#include "EdIRICLs.hpp"
|
|
#include "EdIRCtl.hpp"
|
|
#include "EdIRDat.hpp"
|
|
|
|
#include "EdIRSave.hpp"
|
|
|
|
#include "EdIRIAWd.hpp"
|
|
|
|
#include <limits.h>
|
|
#include <float.h>
|
|
|
|
#include "ai_intf.hpp"
|
|
|
|
#include "EDACModl.hpp"
|
|
#include "EDACInst.hpp"
|
|
#include "EDACDoc.hpp"
|
|
|
|
#include "Ctl.h"
|
|
#include "CPA_NLL.hpp"
|
|
|
|
#include "ITF.h"
|
|
|
|
#include "incAI.h"
|
|
|
|
#include "incGAM.h"
|
|
|
|
#include "TFA.h"
|
|
|
|
#include "DPT.h"
|
|
#include "x:\cpa\main\inc\_EditID.h"
|
|
#include "TLS/LPSconst.hpp"
|
|
|
|
|
|
#include "_Actors.hpp"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
extern FILE *gh_CRRFile;
|
|
extern char gcGenerateOneRule ;
|
|
|
|
//Constants
|
|
#define C_WITH_NO_MACRO_INFO FALSE
|
|
|
|
#define C_ADD_LAST_BUT_ONE 1
|
|
#define C_ADD_ANTEPENULTIMATE 2
|
|
|
|
// CPA2 ASilvescu 98-05-21
|
|
void fn_vAddOneDependency(CPA_EdIR_MainBehaviour *pclMainBehaviour, CPA_BaseObject *pclFather,CPA_BaseObject *pclChild);
|
|
|
|
class CTL_Editor_DsgVarEnumControl : public CTL_Editor_EnumControl
|
|
{
|
|
|
|
CPA_BaseObject *last;
|
|
public:
|
|
CTL_Editor_DsgVarEnumControl(BOOL bReadOnly, CTL_Editor_ControlList *_pclParentList, CString _csControlName, BOOL _bAcceptNameFromData, /*Stefan Dumitrean 20-07(OAC buttons)*/unsigned char ucInitialCurrentPair)
|
|
: CTL_Editor_EnumControl(bReadOnly, _pclParentList, _csControlName, _bAcceptNameFromData, /*Stefan Dumitrean 20-07(OAC buttons)*/ucInitialCurrentPair){last = NULL;}
|
|
void m_fn_vUpdateCurrentValue();
|
|
};
|
|
|
|
void CTL_Editor_DsgVarEnumControl::m_fn_vUpdateCurrentValue()
|
|
{
|
|
CTL_Editor_EnumControl::m_fn_vUpdateCurrentValue();
|
|
if ( m_pclComboBox != NULL )
|
|
{
|
|
short wIndex = m_pclComboBox->GetCurSel();
|
|
if ( wIndex != CB_ERR )
|
|
{
|
|
CTL_Editor_EnumElement *pclNewSelectedElement = (CTL_Editor_EnumElement *)(m_pclComboBox->GetItemDataPtr(wIndex));
|
|
CPA_List<CPA_BaseObject> list;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&list,"Variables designer",C_szIABehaviourTypeName);
|
|
CPA_BaseObject *beha = list.GetHeadElement();
|
|
if(beha)
|
|
{
|
|
list.RemoveAll();
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&list,pclNewSelectedElement->m_pub_fn_csGetElementName(),C_szWayPointTypeName);
|
|
if(last) g_oCoherenceManager.m_fn_vRemoveALink(beha, last);
|
|
CPA_BaseObject *pclWayPoint = list.GetHeadElement();
|
|
if(pclWayPoint)
|
|
{
|
|
last = pclWayPoint;
|
|
fn_vAddOneDependency((CPA_EdIR_MainBehaviour *)beha, beha, pclWayPoint);
|
|
}
|
|
else last = NULL;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// End CPA2 ASilvescu 98-05-21
|
|
|
|
|
|
//Macros for saving
|
|
#define M_SAVEBEGINSECTION(a,b,c) SCR_M_SvL0_SaveBeginSection(p_tdstFile, \
|
|
M_MAKECHAR(a), \
|
|
SCR_CC_C_Cfg_NoChar); \
|
|
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, \
|
|
SCR_EF_SvL0_Normal, \
|
|
2, \
|
|
M_MAKECHAR(b), \
|
|
M_MAKECHAR(c))
|
|
|
|
#define M_SAVEENTRY1PARM(a,b) SCR_g_ui_SvL0_IndentationLevel+=atoi(M_MAKECHAR(b))-1; \
|
|
SCR_M_SvL0_SaveEntry(p_tdstFile, \
|
|
M_MAKECHAR(a), \
|
|
SCR_CC_C_Cfg_NoChar); \
|
|
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, \
|
|
SCR_EF_SvL0_Normal, \
|
|
1, \
|
|
M_MAKECHAR(b)); \
|
|
SCR_g_ui_SvL0_IndentationLevel-=atoi(M_MAKECHAR(b))-1
|
|
|
|
#define M_SAVEENTRY2PARMS(a,b,c) SCR_g_ui_SvL0_IndentationLevel+=atoi(M_MAKECHAR(c))-1; \
|
|
SCR_M_SvL0_SaveEntry(p_tdstFile, \
|
|
M_MAKECHAR(a), \
|
|
SCR_CC_C_Cfg_NoChar); \
|
|
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, \
|
|
SCR_EF_SvL0_Normal, \
|
|
2, \
|
|
M_MAKECHAR(b), \
|
|
M_MAKECHAR(c)); \
|
|
SCR_g_ui_SvL0_IndentationLevel-=atoi(M_MAKECHAR(c))-1
|
|
|
|
#define M_SAVEENTRY4DSGVAR(a,b,c,d) SCR_M_SvL0_SaveEntry(p_tdstFile, \
|
|
M_MAKECHAR(a), \
|
|
SCR_CC_C_Cfg_NoChar); \
|
|
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, \
|
|
SCR_EF_SvL0_Normal, \
|
|
3, \
|
|
M_MAKECHAR(b), \
|
|
M_MAKECHAR(c), \
|
|
M_MAKECHAR(d))
|
|
|
|
#define M_SAVEENTRY3PARMS(a,b,c,d) SCR_g_ui_SvL0_IndentationLevel+=atoi(M_MAKECHAR(d))-1; \
|
|
M_SAVEENTRY4DSGVAR(a,b,c,d) \
|
|
SCR_g_ui_SvL0_IndentationLevel-=atoi(M_MAKECHAR(d))-1
|
|
|
|
#define M_SAVEENTRY4PARMS(a,b,c,d,e) SCR_g_ui_SvL0_IndentationLevel+=atoi(M_MAKECHAR(e))-1; \
|
|
SCR_M_SvL0_SaveEntry(p_tdstFile, \
|
|
M_MAKECHAR(a), \
|
|
SCR_CC_C_Cfg_NoChar); \
|
|
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, \
|
|
SCR_EF_SvL0_Normal, \
|
|
4, \
|
|
M_MAKECHAR(b), \
|
|
M_MAKECHAR(c), \
|
|
M_MAKECHAR(d), \
|
|
M_MAKECHAR(e)); \
|
|
SCR_g_ui_SvL0_IndentationLevel-=atoi(M_MAKECHAR(e))-1
|
|
|
|
#define M_SAVEENTRY4VECTOR(a,b,c,d,e,f) SCR_M_SvL0_SaveEntry(p_tdstFile, \
|
|
M_MAKECHAR(a), \
|
|
SCR_CC_C_Cfg_NoChar); \
|
|
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile, \
|
|
SCR_EF_SvL0_Normal, \
|
|
5, \
|
|
M_MAKECHAR(b), \
|
|
M_MAKECHAR(c), \
|
|
M_MAKECHAR(d), \
|
|
M_MAKECHAR(e), \
|
|
M_MAKECHAR(f))
|
|
|
|
//Macros for processing
|
|
#define M_ADDNODE(macrotype,value,type) M_ClearNodeInterpret(pstNode); \
|
|
macrotype(pstNode)=value; \
|
|
M_SetTypeInterpret(pstNode,type); \
|
|
M_DepthInterpret(pstNode)=pclIntermediateCode->m_fn_ucGetDepth();\
|
|
pclDebugInfoList->AddTail( \
|
|
new CPA_EdIR_DebugInfo(pstNode, \
|
|
0L, \
|
|
0L, \
|
|
pclIntermediateCode->m_fn_lGetOffset(), \
|
|
csBehaviourName)); \
|
|
pclIntermediateCode->pstRefNode = pstNode;\
|
|
pstNode++
|
|
|
|
|
|
//Macros for control creation
|
|
#define C_OWNER_CURRENT_CONTROL_PARMS OAC_DATA_LEVEL_3, \
|
|
EDCAR_DATA_VISI_ONLY_INSTANCES
|
|
#define C_OWNER_CURRENT_CONTROL_PARMS_FOR_ARRAY OAC_DATA_LEVEL_3, \
|
|
EDCAR_DATA_VISI_ONLY_INSTANCES
|
|
|
|
#define C_OWNER_INIT_CONTROL_PARMS OAC_DATA_LEVEL_2, \
|
|
EDCAR_DATA_VISI_ONLY_INSTANCES
|
|
#define C_OWNER_INIT_CONTROL_PARMS_FOR_ARRAY OAC_DATA_LEVEL_2, \
|
|
EDCAR_DATA_VISI_DUAL
|
|
|
|
#define C_CONTROL_PARMS READ_WRITE, \
|
|
CTL_SPACING_TYPE__SINGLE_LINE, \
|
|
FALSE
|
|
|
|
#define C_CONTROL_ENUM_PARMS READ_WRITE
|
|
|
|
#define C_CONTROL_VECTOR_PARMS READ_WRITE
|
|
|
|
#define C_BOOLEAN_CONTROL_PARMS C_CONTROL_PARMS
|
|
|
|
#define C_SIGNED_CHAR_CONTROL_PARMS SCHAR_MIN, \
|
|
SCHAR_MAX, \
|
|
CHAR_INT, \
|
|
TRUE, \
|
|
C_CONTROL_PARMS
|
|
|
|
#define C_UNSIGNED_CHAR_CONTROL_PARMS 0, \
|
|
UCHAR_MAX, \
|
|
CHAR_INT, \
|
|
FALSE, \
|
|
C_CONTROL_PARMS
|
|
|
|
#define C_SIGNED_SHORT_CONTROL_PARMS SHRT_MIN, \
|
|
SHRT_MAX, \
|
|
SHORT_INT, \
|
|
TRUE, \
|
|
C_CONTROL_PARMS
|
|
|
|
#define C_UNSIGNED_SHORT_CONTROL_PARMS 0, \
|
|
USHRT_MAX, \
|
|
SHORT_INT, \
|
|
FALSE, \
|
|
C_CONTROL_PARMS
|
|
|
|
#define C_SIGNED_LONG_CONTROL_PARMS LONG_MIN, \
|
|
LONG_MAX, \
|
|
LONG_INT, \
|
|
TRUE, \
|
|
C_CONTROL_PARMS
|
|
|
|
#define C_UNSIGNED_LONG_CONTROL_PARMS 0, \
|
|
ULONG_MAX, \
|
|
LONG_INT, \
|
|
FALSE, \
|
|
C_CONTROL_PARMS
|
|
|
|
#define C_FLOAT_CONTROL_PARMS -FLT_MAX, \
|
|
FLT_MAX, \
|
|
sizeof(MTH_tdxReal), \
|
|
C_CONTROL_PARMS
|
|
|
|
#define C_WAYPOINT_CONTROL_PARMS C_CONTROL_ENUM_PARMS
|
|
|
|
#define C_GRAPH_CONTROL_PARMS C_CONTROL_ENUM_PARMS
|
|
|
|
#define C_CAPS_CONTROL_PARMS C_CONTROL_PARMS
|
|
|
|
#define C_PERSO_CONTROL_PARMS C_CONTROL_ENUM_PARMS
|
|
|
|
#define C_SUPEROBJECT_CONTROL_PARMS C_CONTROL_ENUM_PARMS
|
|
|
|
#define C_BEHAVIOUR_CONTROL_PARMS C_CONTROL_ENUM_PARMS
|
|
|
|
#define C_ACTION_CONTROL_PARMS C_CONTROL_ENUM_PARMS
|
|
|
|
#define C_TEXT_CONTROL_PARMS C_CONTROL_ENUM_PARMS
|
|
|
|
#define C_GMT_CONTROL_PARMS C_CONTROL_ENUM_PARMS
|
|
|
|
#define C_LIST_CONTROL_PARMS 0, \
|
|
UCHAR_MAX, \
|
|
CHAR_INT, \
|
|
FALSE, \
|
|
C_CONTROL_PARMS
|
|
|
|
#define C_VECTOR_CONTROL_PARMS -FLT_MAX, \
|
|
FLT_MAX, \
|
|
sizeof(MTH_tdxReal), \
|
|
C_CONTROL_VECTOR_PARMS
|
|
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
#define C_ARRAY_CONTROL_PARMS C_CONTROL_PARMS
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
|
|
//Macros for data creation
|
|
#define C_BOOLEAN_DATA_PARMS
|
|
|
|
#define C_SIGNED_CHAR_DATA_PARMS CHAR_INT,TRUE,
|
|
|
|
#define C_UNSIGNED_CHAR_DATA_PARMS CHAR_INT,FALSE,
|
|
|
|
#define C_SIGNED_SHORT_DATA_PARMS SHORT_INT,TRUE,
|
|
|
|
#define C_UNSIGNED_SHORT_DATA_PARMS SHORT_INT,FALSE,
|
|
|
|
#define C_SIGNED_LONG_DATA_PARMS LONG_INT,TRUE,
|
|
|
|
#define C_UNSIGNED_LONG_DATA_PARMS LONG_INT,FALSE,
|
|
|
|
#define C_FLOAT_DATA_PARMS sizeof(MTH_tdxReal),
|
|
|
|
#define C_WAYPOINT_DATA_PARMS pclEnumList,
|
|
|
|
#define C_GRAPH_DATA_PARMS pclEnumList,
|
|
|
|
#define C_CAPS_DATA_PARMS pclMaskList,
|
|
|
|
#define C_PERSO_DATA_PARMS pclEnumList,
|
|
|
|
#define C_SUPEROBJECT_DATA_PARMS pclEnumList,
|
|
|
|
#define C_BEHAVIOUR_DATA_PARMS pclEnumList,
|
|
|
|
#define C_ACTION_DATA_PARMS pclEnumList,
|
|
|
|
#define C_TEXT_DATA_PARMS pclEnumList,
|
|
|
|
#define C_GMT_DATA_PARMS pclEnumList,
|
|
|
|
#define C_LIST_DATA_PARMS CHAR_INT,FALSE,
|
|
|
|
#define C_VECTOR_DATA_PARMS sizeof(MTH_tdxReal),
|
|
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
#define C_ARRAY_DATA_PARMS
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
|
|
//ANNECY BBB: arg supplementaire des les constructeurs de controles
|
|
#define M_ADD_ONE_DSG_VAR(TypeControl,ParmsControl,TypeData,ParmsData,bMustUpdate) \
|
|
/* Creates init control */ \
|
|
TypeControl *pclInitCtrl=new TypeControl(ParmsControl,pclListOfDesignerVariableControl, \
|
|
pclModel->GetName()+" "+csDsgVarName+g_c_csDsgVarInitText, TRUE, /*Stefan Dumitrean 20-07(OAC buttons)*/0); \
|
|
pclInitCtrl->m_pub_fn_vSetControlCanBeDisplayedCallBack(fn_bMustDisplay); \
|
|
if(bArray) \
|
|
{ \
|
|
/* BEGIN ROMTEAM Cristi Petrescu 98-06- */ \
|
|
fn_vAddOwnerData(pclInitCtrl,C_OWNER_INIT_CONTROL_PARMS_FOR_ARRAY, eDataQualifier); \
|
|
/*END ROMTEAM Cristi Petrescu 98-06- */ \
|
|
} \
|
|
else \
|
|
{ \
|
|
/* BEGIN ROMTEAM Cristi Petrescu 98-06- */ \
|
|
fn_vAddOwnerData(pclInitCtrl,C_OWNER_INIT_CONTROL_PARMS, eDataQualifier); \
|
|
/* END ROMTEAM Cristi Petrescu 98-06- */ \
|
|
} \
|
|
pclListOfDesignerVariableControl->AddTail(pclInitCtrl); \
|
|
\
|
|
if (bMustUpdate) \
|
|
pclDsgVarView->m_fn_vUpdateControls(pclListOfDesignerVariableControl); \
|
|
\
|
|
/* Creates init data for model */ \
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType; \
|
|
pclListOfDesignerVariableType=pclModel->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType; \
|
|
\
|
|
TypeData *pclData=new TypeData(ParmsData csDsgVarName+g_c_csDsgVarInitText,pclListOfDesignerVariableType); \
|
|
fn_vAddOwnerData(pclData,pclModel->m_fn_pclGetEditorActor()); \
|
|
pclData->m_pub_fn_vSetDataChangedCallBackFunction(fn_vNotifyInitialValue); \
|
|
pclData->m_pub_fn_vSetDataChangedSpecialCallBackFunction(fn_vUpdateWatchData); \
|
|
/* only for array type */ \
|
|
if(bArray) \
|
|
{ \
|
|
CPA_List<CPA_BaseObject> clInstancesList; \
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel); \
|
|
\
|
|
if(!clInstancesList.IsEmpty()) \
|
|
{ \
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetHead()); \
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct(); \
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain; \
|
|
\
|
|
if(hBrain!=NULL) \
|
|
{ \
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain); \
|
|
\
|
|
void *pvEngineData=M_GetDsgVarAddrDefault(pstMind,lIndexOfDsgVar); \
|
|
tdstArray *pstArray=(tdstArray *)pvEngineData; \
|
|
pclData->m_fn_vSetMotorDataPtr(M_ARRAY_ELEMENT(pstArray,0)); \
|
|
fn_vSetBaseAddress(pclData,pvEngineData); \
|
|
} \
|
|
} \
|
|
else \
|
|
/* For a model without any instance */ \
|
|
{ \
|
|
if (bMyArray) \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_stArrayDummyData); \
|
|
else \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData); \
|
|
} \
|
|
} \
|
|
else \
|
|
{ \
|
|
if (bMyArray) \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_stArrayDummyData); \
|
|
else \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData); \
|
|
} \
|
|
pclListOfDesignerVariableType->AddTail(pclData); \
|
|
pclInitCtrl->m_fn_vSetEditedData(pclData); \
|
|
pclData->m_fn_vGetMotorData(); \
|
|
\
|
|
/* Creates init data for instances */ \
|
|
CPA_List<CPA_BaseObject> clInstancesList; \
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel); \
|
|
\
|
|
POSITION pos=clInstancesList.GetHeadPosition(); \
|
|
while(pos!=NULL) \
|
|
{ \
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetNext(pos)); \
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct(); \
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain; \
|
|
\
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType; \
|
|
pclListOfDesignerVariableType=pclInstance->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType; \
|
|
\
|
|
TypeData *pclData=new TypeData(ParmsData csDsgVarName+g_c_csDsgVarInitText,pclListOfDesignerVariableType); \
|
|
fn_vAddOwnerData(pclData,pclInstance->m_fn_pclGetEditorActor()); \
|
|
pclData->m_pub_fn_vSetDataChangedCallBackFunction(fn_vNotifyInitialValue); \
|
|
pclData->m_pub_fn_vSetDataChangedSpecialCallBackFunction(fn_vUpdateWatchData); \
|
|
\
|
|
if(hBrain!=NULL) \
|
|
{ \
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain); \
|
|
if (M_GetDsgMem(pstMind) != NULL) \
|
|
{ \
|
|
void *pvEngineData=M_GetDsgVarAddrInit(pstMind,lIndexOfDsgVar); \
|
|
pclData->m_fn_vSetMotorDataPtr(pvEngineData); \
|
|
\
|
|
/* only for array type */ \
|
|
if(bArray) \
|
|
{ \
|
|
tdstArray *pstArray=(tdstArray *)pvEngineData; \
|
|
pclData->m_fn_vSetMotorDataPtr(M_ARRAY_ELEMENT(pstArray,0)); \
|
|
fn_vSetBaseAddress(pclData,pvEngineData); \
|
|
} \
|
|
} \
|
|
else \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData); \
|
|
} \
|
|
else \
|
|
/* For a new instance without hBrain */ \
|
|
{ \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData); \
|
|
} \
|
|
\
|
|
pclListOfDesignerVariableType->AddTail(pclData); \
|
|
pclInitCtrl->m_fn_vSetEditedData(pclData); \
|
|
pclData->m_fn_vGetMotorData(); \
|
|
} \
|
|
\
|
|
/* Creates control */ \
|
|
TypeControl *pclCtrl=new TypeControl(ParmsControl,pclListOfDesignerVariableControl, \
|
|
pclModel->GetName()+" "+csDsgVarName, TRUE, /*Stefan Dumitrean 20-07(OAC buttons)*/0); \
|
|
pclCtrl->m_pub_fn_vSetControlCanBeDisplayedCallBack(fn_bMustDisplay); \
|
|
if(bArray) \
|
|
{ \
|
|
/* BEGIN ROMTEAM Cristi Petrescu 98-06- */ \
|
|
fn_vAddOwnerData(pclCtrl,C_OWNER_CURRENT_CONTROL_PARMS_FOR_ARRAY, eDataQualifier); \
|
|
/* END ROMTEAM Cristi Petrescu 98-06- */ \
|
|
} \
|
|
else \
|
|
{ \
|
|
/* BEGIN ROMTEAM Cristi Petrescu 98-06- */ \
|
|
fn_vAddOwnerData(pclCtrl,C_OWNER_CURRENT_CONTROL_PARMS, eDataQualifier); \
|
|
/* END ROMTEAM Cristi Petrescu 98-06- */ \
|
|
} \
|
|
pclListOfDesignerVariableControl->AddTail(pclCtrl); \
|
|
\
|
|
if (bMustUpdate) \
|
|
pclDsgVarView->m_fn_vUpdateControls(pclListOfDesignerVariableControl); \
|
|
\
|
|
/* Creates data for model */ \
|
|
pclData=new TypeData(ParmsData csDsgVarName,pclListOfDesignerVariableType); \
|
|
fn_vAddOwnerData(pclData,pclModel->m_fn_pclGetEditorActor()); \
|
|
pclData->m_pub_fn_vSetDataChangedSpecialCallBackFunction(fn_vUpdateWatchData); \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData); \
|
|
pclListOfDesignerVariableType->AddTail(pclData); \
|
|
pclCtrl->m_fn_vSetEditedData(pclData); \
|
|
pclData->m_fn_vGetMotorData(); \
|
|
\
|
|
/* Creates data for instances */ \
|
|
pos=clInstancesList.GetHeadPosition(); \
|
|
while(pos!=NULL) \
|
|
{ \
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetNext(pos)); \
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct(); \
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain; \
|
|
\
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType; \
|
|
pclListOfDesignerVariableType=pclInstance->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType; \
|
|
\
|
|
TypeData *pclData=new TypeData(ParmsData csDsgVarName,pclListOfDesignerVariableType); \
|
|
fn_vAddOwnerData(pclData,pclInstance->m_fn_pclGetEditorActor()); \
|
|
pclData->m_pub_fn_vSetDataChangedSpecialCallBackFunction(fn_vUpdateWatchData); \
|
|
\
|
|
if(hBrain!=NULL) \
|
|
{ \
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain); \
|
|
\
|
|
if (M_GetDsgMem(pstMind) != NULL) \
|
|
{ \
|
|
void *pvEngineData=M_GetDsgVarAddr(pstMind,lIndexOfDsgVar); \
|
|
pclData->m_fn_vSetMotorDataPtr(pvEngineData); \
|
|
\
|
|
/* only for array type */ \
|
|
if(bArray) \
|
|
{ \
|
|
tdstArray *pstArray=(tdstArray *)pvEngineData; \
|
|
pclData->m_fn_vSetMotorDataPtr(M_ARRAY_ELEMENT(pstArray,0)); \
|
|
fn_vSetBaseAddress(pclData,pvEngineData); \
|
|
} \
|
|
} \
|
|
else \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData); \
|
|
} \
|
|
else \
|
|
/* For a new instance without hBrain */ \
|
|
{ \
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData); \
|
|
} \
|
|
\
|
|
pclListOfDesignerVariableType->AddTail(pclData); \
|
|
pclCtrl->m_fn_vSetEditedData(pclData); \
|
|
pclData->m_fn_vGetMotorData(); \
|
|
}
|
|
|
|
static long gs_lDummyData = 0;
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
static tdstArray gs_stArrayDummyData = {eDsgVarType_Boolean,0};
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
|
|
/*************************************************************************/
|
|
void fn_vCreateControlForSaving(CString csDsgVarName,long lIndexOfDsgVar, BOOL bUpdate)
|
|
{
|
|
CPA_EdIR_Frame *pclIRMainFrame=g_pclAIInterface->m_pclIRMainFrame;
|
|
CPA_Actor *pclModel=pclIRMainFrame->m_fn_pclGetModel();
|
|
|
|
CPA_List<CPA_BaseObject> clInstancesList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel);
|
|
|
|
POSITION pos=clInstancesList.GetHeadPosition();
|
|
if(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetAt(pos));
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
|
|
if(hBrain!=NULL)
|
|
{
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain);
|
|
|
|
if(pstMind!=NULL)
|
|
{
|
|
CTL_Editor_ControlList *pclListOfDesignerVariableControl=&(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_clListOfDesignerVariableControl);
|
|
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
|
|
CPA_EdIR_DesignerVariablesView *pclDsgVarView=(CPA_EdIR_DesignerVariablesView *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetDesignerVariablesView,0);
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType=pclModel->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
|
|
|
|
/* Creates enum descriptor list whith the different save type */
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
|
|
unsigned char ucSaveTypeNumber=fn_ucGetSaveTypeNumber();
|
|
for(unsigned char ucIndex=0;ucIndex<ucSaveTypeNumber;ucIndex++)
|
|
{
|
|
pclEnumList->m_fn_pclAddElement(fn_csGetDsgVarSaveTypeEditorNameFromId(ucIndex),
|
|
(long)fn_eFindSaveTypeFromSaveTypeNumber(ucIndex));
|
|
}
|
|
|
|
/* Creates control in order to know when this dsgvar must be saved */
|
|
CTL_Editor_EnumControl *pclCtrl=new CTL_Editor_EnumControl(READ_WRITE,
|
|
pclListOfDesignerVariableControl,
|
|
pclModel->GetName()+" "+csDsgVarName, TRUE, /*Stefan Dumitrean 20-07(OAC buttons)*/0); //ANNECY BBB
|
|
pclCtrl->m_pub_fn_vSetControlCanBeDisplayedCallBack(fn_bMustDisplay);
|
|
fn_vAddOwnerData(pclCtrl,OAC_DATA_LEVEL_3,EDCAR_DATA_VISI_ONLY_MODELS);
|
|
pclListOfDesignerVariableControl->AddTail(pclCtrl);
|
|
|
|
if (bUpdate)
|
|
pclDsgVarView->m_fn_vUpdateControls(pclListOfDesignerVariableControl);
|
|
|
|
|
|
/* Creates data in order to know when this dsgvar must be saved for model */
|
|
CTL_Editor_EnumData *pclData=new CTL_Editor_EnumData(pclEnumList,csDsgVarName,pclListOfDesignerVariableType);
|
|
fn_vAddOwnerData(pclData,pclModel->m_fn_pclGetEditorActor());
|
|
pclData->m_pub_fn_vSetDataChangedCallBackFunction(fn_vNotifyInitialValue);
|
|
pclData->m_pub_fn_vSetDataChangedSpecialCallBackFunction(fn_vUpdateWatchData); \
|
|
|
|
if (M_GetDsgMem(pstMind) != NULL)
|
|
pclData->m_fn_vSetMotorDataPtr(&M_GetDsgVarSaveType(pstMind,lIndexOfDsgVar));
|
|
else
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData);
|
|
pclListOfDesignerVariableType->AddTail(pclData);
|
|
pclCtrl->m_fn_vSetEditedData(pclData);
|
|
pclData->m_fn_vGetMotorData();
|
|
|
|
/* Creates data in order to know when this dsgvar must be saved for instances */
|
|
POSITION pos=clInstancesList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetNext(pos));
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType;
|
|
pclListOfDesignerVariableType=pclInstance->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
|
|
|
|
CTL_Editor_EnumData *pclData=new CTL_Editor_EnumData(pclEnumList,csDsgVarName,pclListOfDesignerVariableType);
|
|
fn_vAddOwnerData(pclData,pclInstance->m_fn_pclGetEditorActor());
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData);
|
|
pclListOfDesignerVariableType->AddTail(pclData);
|
|
pclCtrl->m_fn_vSetEditedData(pclData);
|
|
pclData->m_fn_vGetMotorData();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void fn_vCreateControlForInitialization(CString csDsgVarName,long lIndexOfDsgVar, BOOL bUpdate)
|
|
{
|
|
CPA_EdIR_Frame *pclIRMainFrame=g_pclAIInterface->m_pclIRMainFrame;
|
|
CPA_Actor *pclModel=pclIRMainFrame->m_fn_pclGetModel();
|
|
|
|
CPA_List<CPA_BaseObject> clInstancesList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel);
|
|
|
|
POSITION pos=clInstancesList.GetHeadPosition();
|
|
if(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetAt(pos));
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
|
|
if(hBrain!=NULL)
|
|
{
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain);
|
|
|
|
if(pstMind!=NULL)
|
|
{
|
|
CTL_Editor_ControlList *pclListOfDesignerVariableControl=&(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_clListOfDesignerVariableControl);
|
|
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
|
|
CPA_EdIR_DesignerVariablesView *pclDsgVarView=(CPA_EdIR_DesignerVariablesView *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetDesignerVariablesView,0);
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType=pclModel->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
|
|
|
|
/* Creates enum descriptor list whith the different init type */
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
|
|
unsigned char ucInitTypeNumber=fn_ucGetInitTypeNumber();
|
|
for(unsigned char ucIndex=0;ucIndex<ucInitTypeNumber;ucIndex++)
|
|
{
|
|
pclEnumList->m_fn_pclAddElement(fn_csGetDsgVarInitTypeEditorNameFromId(ucIndex),
|
|
(long)fn_eFindInitTypeFromInitTypeNumber(ucIndex));
|
|
}
|
|
|
|
/* Creates control in order to know when this dsgvar must be initialized */
|
|
CTL_Editor_EnumControl *pclCtrl=new CTL_Editor_EnumControl(READ_WRITE,
|
|
pclListOfDesignerVariableControl,
|
|
pclModel->GetName()+" "+csDsgVarName, TRUE, /*Stefan Dumitrean 20-07(OAC buttons)*/0); //ANNECY BBB
|
|
pclCtrl->m_pub_fn_vSetControlCanBeDisplayedCallBack(fn_bMustDisplay);
|
|
fn_vAddOwnerData(pclCtrl,OAC_DATA_LEVEL_3,EDCAR_DATA_VISI_ONLY_MODELS);
|
|
pclListOfDesignerVariableControl->AddTail(pclCtrl);
|
|
|
|
if (bUpdate)
|
|
pclDsgVarView->m_fn_vUpdateControls(pclListOfDesignerVariableControl);
|
|
|
|
|
|
/* Creates data in order to know when this dsgvar must be initialized for model */
|
|
CTL_Editor_EnumData *pclData=new CTL_Editor_EnumData(pclEnumList,csDsgVarName,pclListOfDesignerVariableType);
|
|
fn_vAddOwnerData(pclData,pclModel->m_fn_pclGetEditorActor());
|
|
pclData->m_pub_fn_vSetDataChangedCallBackFunction(fn_vNotifyInitialValue);
|
|
pclData->m_pub_fn_vSetDataChangedSpecialCallBackFunction(fn_vUpdateWatchData); \
|
|
|
|
if (M_GetDsgMem(pstMind) != NULL)
|
|
pclData->m_fn_vSetMotorDataPtr(&M_GetDsgVarInitType(pstMind,lIndexOfDsgVar));
|
|
else
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData);
|
|
|
|
pclListOfDesignerVariableType->AddTail(pclData);
|
|
pclCtrl->m_fn_vSetEditedData(pclData);
|
|
pclData->m_fn_vGetMotorData();
|
|
|
|
/* Creates data in order to know when this dsgvar must be initialized for instances */
|
|
POSITION pos=clInstancesList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetNext(pos));
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType;
|
|
pclListOfDesignerVariableType=pclInstance->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
|
|
|
|
CTL_Editor_EnumData *pclData=new CTL_Editor_EnumData(pclEnumList,csDsgVarName,pclListOfDesignerVariableType);
|
|
fn_vAddOwnerData(pclData,pclInstance->m_fn_pclGetEditorActor());
|
|
pclData->m_fn_vSetMotorDataPtr(&gs_lDummyData);
|
|
pclListOfDesignerVariableType->AddTail(pclData);
|
|
pclCtrl->m_fn_vSetEditedData(pclData);
|
|
pclData->m_fn_vGetMotorData();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*************************************************************************/
|
|
//For fn_vCreateIndexControlForArray
|
|
void fn_vAddControlBeforeTail(CTL_Editor_ControlList *pclControlList,CTL_Editor_Control *pclControl,long lIndex)
|
|
{
|
|
if((lIndex==C_ADD_LAST_BUT_ONE) || (lIndex==C_ADD_ANTEPENULTIMATE))
|
|
{
|
|
POSITION pos=pclControlList->GetTailPosition();
|
|
if(pos!=NULL)
|
|
{
|
|
if(lIndex==C_ADD_ANTEPENULTIMATE)
|
|
pclControlList->GetPrev(pos);
|
|
|
|
if(pos!=NULL)
|
|
pclControlList->InsertBefore(pos,pclControl);
|
|
else
|
|
ASSERT(FALSE);
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
|
|
/*************************************************************************/
|
|
//For fn_vCreateIndexControlForArray
|
|
void fn_vAddDataBeforeTail(CTL_Editor_DataList *pclDataList,CTL_Editor_Data *pclData,long lIndex)
|
|
{
|
|
if((lIndex==C_ADD_LAST_BUT_ONE) || (lIndex==C_ADD_ANTEPENULTIMATE))
|
|
{
|
|
POSITION pos=pclDataList->GetTailPosition();
|
|
if(pos!=NULL)
|
|
{
|
|
if(lIndex==C_ADD_ANTEPENULTIMATE)
|
|
pclDataList->GetPrev(pos);
|
|
|
|
if(pos!=NULL)
|
|
pclDataList->InsertBefore(pos,pclData);
|
|
else
|
|
ASSERT(FALSE);
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void fn_vCreateIndexControlForArray(CString csDsgVarName,long lIndexOfDsgVar,
|
|
OAC_tdeDataLevel eDataLevel,CTL_Editor_Control *pclArrayControl,
|
|
long lIndex)
|
|
{
|
|
CPA_EdIR_Frame *pclIRMainFrame=g_pclAIInterface->m_pclIRMainFrame;
|
|
CPA_Actor *pclModel=pclIRMainFrame->m_fn_pclGetModel();
|
|
|
|
CPA_List<CPA_BaseObject> clInstancesList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel);
|
|
|
|
POSITION pos=clInstancesList.GetHeadPosition();
|
|
if(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetAt(pos));
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
|
|
if(hBrain!=NULL)
|
|
{
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain);
|
|
|
|
if(pstMind!=NULL)
|
|
{
|
|
CTL_Editor_ControlList *pclListOfDesignerVariableControl=&(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_clListOfDesignerVariableControl);
|
|
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
|
|
CPA_EdIR_DesignerVariablesView *pclDsgVarView=(CPA_EdIR_DesignerVariablesView *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetDesignerVariablesView,0);
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType=pclModel->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
|
|
|
|
/* Creates index control */
|
|
tdstArray *pstArray=(tdstArray *)M_GetDsgVarAddrDefault(pstMind,lIndexOfDsgVar);
|
|
long lNbElt=M_ARRAY_SIZE(pstArray)-1;
|
|
CTL_Editor_IntegerControl *pclCtrl=new CTL_Editor_IntegerControl(0,lNbElt,1,
|
|
FALSE,READ_WRITE,
|
|
CTL_SPACING_TYPE__SINGLE_LINE,FALSE,
|
|
pclListOfDesignerVariableControl,
|
|
pclModel->GetName()+" "+g_c_csDsgVarIndexText+csDsgVarName, TRUE, /*Stefan Dumitrean 20-07(OAC buttons)*/0); //ANNECY BBB
|
|
pclCtrl->m_pub_fn_vSetControlCanBeDisplayedCallBack(fn_bMustDisplay);
|
|
fn_vAddOwnerData(pclCtrl,eDataLevel,EDCAR_DATA_VISI_DUAL);
|
|
fn_vAddControlBeforeTail(pclListOfDesignerVariableControl,pclCtrl,lIndex);
|
|
|
|
pclDsgVarView->m_fn_vUpdateControls(pclListOfDesignerVariableControl);
|
|
|
|
/* Creates index data for model */
|
|
CTL_Editor_IntegerData *pclData=new CTL_Editor_IntegerData(1,FALSE,g_c_csDsgVarIndexText+csDsgVarName,pclListOfDesignerVariableType);
|
|
fn_vAddOwnerData(pclData,pclModel->m_fn_pclGetEditorActor());
|
|
fn_vSetAssociatedControl(pclData,pclArrayControl);
|
|
pclData->m_pub_fn_vSetDataChangedCallBackFunction(fn_vIndexHasChanged);
|
|
pclData->m_pub_fn_vSetDataChangedSpecialCallBackFunction(fn_vUpdateWatchData); \
|
|
|
|
char *pcIndex=new char;
|
|
*pcIndex=0;
|
|
pclData->m_fn_vSetMotorDataPtr(pcIndex);
|
|
fn_vAddDataBeforeTail(pclListOfDesignerVariableType,pclData,lIndex);
|
|
pclCtrl->m_fn_vSetEditedData(pclData);
|
|
pclData->m_fn_vGetMotorData();
|
|
|
|
/* Creates index data for instances */
|
|
POSITION pos=clInstancesList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetNext(pos));
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType;
|
|
pclListOfDesignerVariableType=pclInstance->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
|
|
|
|
CTL_Editor_IntegerData *pclData=new CTL_Editor_IntegerData(1,FALSE,g_c_csDsgVarIndexText+csDsgVarName,pclListOfDesignerVariableType);
|
|
fn_vAddOwnerData(pclData,pclInstance->m_fn_pclGetEditorActor());
|
|
fn_vSetAssociatedControl(pclData,pclArrayControl);
|
|
pclData->m_pub_fn_vSetDataChangedCallBackFunction(fn_vIndexHasChanged);
|
|
pclData->m_pub_fn_vSetDataChangedSpecialCallBackFunction(fn_vUpdateWatchData); \
|
|
|
|
char *pcIndex=new char;
|
|
*pcIndex=0;
|
|
pclData->m_fn_vSetMotorDataPtr(pcIndex);
|
|
fn_vAddDataBeforeTail(pclListOfDesignerVariableType,pclData,lIndex);
|
|
pclCtrl->m_fn_vSetEditedData(pclData);
|
|
pclData->m_fn_vGetMotorData();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*************************************************************************/
|
|
BOOL fn_bIsANode(tdeNodeType eNodeType, BOOL _bForSave)
|
|
{
|
|
if
|
|
(
|
|
(
|
|
(
|
|
eNodeType == eBeginMacro ||
|
|
eNodeType == eEndMacro
|
|
)
|
|
&& !_bForSave // the nodes above are not generated when saving
|
|
) ||
|
|
eNodeType==eKeyWord ||
|
|
eNodeType==eCondition ||
|
|
eNodeType==eMetaAction ||
|
|
eNodeType==eProcedure ||
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
eNodeType==eSubrRef ||
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
eNodeType==eField ||
|
|
eNodeType==eConstant ||
|
|
eNodeType==eMyRfxBehaviour ||
|
|
eNodeType==eMyIABehaviour ||
|
|
eNodeType==eRfxBehaviour ||
|
|
eNodeType==eIABehaviour ||
|
|
eNodeType==eOperator ||
|
|
eNodeType==eFunction ||
|
|
eNodeType==eDsgVar ||
|
|
eNodeType==eConstantInt ||
|
|
eNodeType==eConstantReal ||
|
|
eNodeType==ePerso ||
|
|
eNodeType==eReal ||
|
|
eNodeType==eZdd ||
|
|
eNodeType==eZde ||
|
|
eNodeType==eZdm ||
|
|
eNodeType==eZdr ||
|
|
eNodeType==eVector ||
|
|
eNodeType==eAction ||
|
|
eNodeType==eState ||
|
|
eNodeType==eWayPoint ||
|
|
eNodeType==eModule ||
|
|
eNodeType==eKeyButton ||
|
|
eNodeType==eMaskType ||
|
|
eNodeType==ePower ||
|
|
eNodeType==eSurface ||
|
|
eNodeType==eEnvironment ||
|
|
eNodeType==eSector ||
|
|
eNodeType==eSuperObject ||
|
|
eNodeType==eLipSynchro ||
|
|
eNodeType==eObjectTable ||
|
|
eNodeType==eFamily ||
|
|
eNodeType==eModel ||
|
|
eNodeType==eSoundEvent ||
|
|
eNodeType==eString ||
|
|
eNodeType==eText ||
|
|
eNodeType==eFont ||
|
|
eNodeType==eGameMaterial ||
|
|
eNodeType==eLight ||
|
|
eNodeType==eCaps ||
|
|
eNodeType==eGraph ||
|
|
eNodeType==eParticleGenerator
|
|
)
|
|
return TRUE;
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
/*************************************************************************/
|
|
long fn_lGetNbNodes(CPA_EdIR_IntermediateCodeList *pclIntermediateCodeList, POSITION pos, BOOL _bForSave)
|
|
{
|
|
POSITION p=pos;
|
|
BOOL bEnd=FALSE;
|
|
long lNbNodes=0;
|
|
while(p!=NULL && !bEnd)
|
|
{
|
|
CPA_EdIR_IntermediateCode *pclIntermediateCode=pclIntermediateCodeList->GetNext(p);
|
|
|
|
if ( fn_bIsANode(pclIntermediateCode->m_fn_tdeGetNodeType(), _bForSave) )
|
|
lNbNodes ++;
|
|
|
|
if(pclIntermediateCode->m_fn_tdeGetNodeType()==eCreateRule)
|
|
bEnd=(pclIntermediateCode->m_fn_ucGetDepth()==1);
|
|
|
|
if( p && bEnd && !_bForSave && (pclIntermediateCodeList->GetAt(p)->m_fn_tdeGetNodeType()==eEndMacro))
|
|
lNbNodes++;
|
|
}
|
|
|
|
return lNbNodes;
|
|
}
|
|
|
|
/*************************************************************************/
|
|
CString fn_csLongToString(long l)
|
|
{
|
|
CString csString;
|
|
|
|
csString.Format("%ld",l);
|
|
|
|
return csString;
|
|
}
|
|
|
|
/*************************************************************************/
|
|
#define ADDCHAR()\
|
|
{ if(lDest+5 >= lSize) {lSize += 4000; lpdest = (char *) realloc(lpdest, lSize);}\
|
|
/*Stefan Dumitrean 14-05-98*/\
|
|
cCurrent = tolower(lpin[lStartIndex++]);\
|
|
lpdest[lDest++]=cCurrent;\
|
|
if( cCurrent == ';' ) bInComment = TRUE;\
|
|
else if( cCurrent == '\n' ) bInComment = FALSE;}
|
|
/*End Stefan Dumitrean*/\
|
|
#define _memcpy_(d,s,size) {int len = 0; while(len < size) {(d)[len] = tolower((s)[len]);len++;}}
|
|
|
|
/*************************************************************************/
|
|
CString fn_csExpandMacro(CString &csIn, BOOL bWithMacroInfo=TRUE)
|
|
{
|
|
unsigned char * lpin = (unsigned char *)LPCTSTR(csIn);
|
|
long lStartIndex = 0, lDest = 0,lMemDest;
|
|
CString csWord;
|
|
long lSize = csIn.GetLength()+1;
|
|
char *lpdest = (char *) malloc(lSize);
|
|
long lLen = strlen(g_c_csBeginMacro), lLen1;
|
|
char *pszmac;
|
|
//Stefan Dumitrean 14-05-98
|
|
char cCurrent;
|
|
BOOL bInComment = FALSE;
|
|
//End Stefan Dumitrean
|
|
CString csOut;
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-09-
|
|
//char *pszMacroName;
|
|
// END ROMTEAM Cristi Petrescu 98-09-
|
|
|
|
while(lpin[lStartIndex])
|
|
{
|
|
while(lpin[lStartIndex] && !isalnum(lpin[lStartIndex])) ADDCHAR();
|
|
lMemDest = lDest;
|
|
while(lpin[lStartIndex] && (isalnum(lpin[lStartIndex])||(lpin[lStartIndex]=='_'))) ADDCHAR();
|
|
lpdest[lDest] = '\0';
|
|
//Stefan Dumitrean 14-05-98
|
|
if( !bInComment )
|
|
{ pszmac = g_clMacroList.m_fn_bIsAMacro(lpdest + lMemDest);
|
|
//End Stefan Dumitrean
|
|
if(pszmac)
|
|
{
|
|
if(bWithMacroInfo)
|
|
{
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-09-
|
|
//pszMacroName = lpdest + lMemDest;
|
|
// END ROMTEAM Cristi Petrescu 98-09-
|
|
lLen1 = strlen(lpdest+lMemDest);
|
|
while(lDest+lLen1+50 >= lSize)
|
|
{
|
|
lSize += 4000;
|
|
lpdest = (char *) realloc(lpdest, lSize);
|
|
}
|
|
_memcpy_(lpdest+lMemDest, g_c_csBeginMacro, lLen);
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-09-
|
|
// BEGIN ROMTEAM Cristi Petrescu 99-1 debug
|
|
sprintf(lpdest+lMemDest+lLen,"(%ld,%ld)\r\n",lLen1,(long)pszmac);
|
|
// BEGIN ROMTEAM Cristi Petrescu 99-1 debug
|
|
//sprintf(lpdest+lMemDest+lLen,"(%ld,%ld,%s)\n",lLen1,(long)pszmac,pszMacroName);
|
|
// END ROMTEAM Cristi Petrescu 98-09-
|
|
lDest = (strchr(lpdest + lMemDest + lLen, '\n') + 1) - lpdest;
|
|
}
|
|
else
|
|
lDest = lMemDest;
|
|
|
|
lLen1 = strlen(pszmac);
|
|
while(lDest+lLen1+50 >= lSize)
|
|
{
|
|
lSize += 4000;
|
|
lpdest = (char *) realloc(lpdest, lSize);
|
|
}
|
|
_memcpy_(lpdest+lDest,pszmac,lLen1);
|
|
lDest += lLen1;
|
|
// BEGIN ROMTEAM Cristi Petrescu 99-1 debug
|
|
lpdest[lDest++] = '\r';
|
|
lpdest[lDest++] = '\n';
|
|
// BEGIN ROMTEAM Cristi Petrescu 99-1 debug
|
|
|
|
if(bWithMacroInfo)
|
|
{
|
|
lLen1 = strlen(g_c_csEndMacro);
|
|
while(lDest+lLen1+50 >= lSize)
|
|
{
|
|
lSize += 4000;
|
|
lpdest = (char *) realloc(lpdest, lSize);
|
|
}
|
|
_memcpy_(lpdest+lDest,g_c_csEndMacro,lLen1);
|
|
lDest += lLen1;
|
|
}
|
|
}
|
|
//Stefan Dumitrean 14-05-98
|
|
}
|
|
//End Stefan Dumitrean
|
|
}
|
|
lpdest[lDest] = '\0';
|
|
csOut = lpdest;
|
|
free(lpdest);
|
|
return csOut;
|
|
}
|
|
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-08-
|
|
void fn_vPostProcessIA (CString csText, CString csRealText, CPA_EdIR_DebugInfoList *pclDebugInfoList, BOOL bRes, long &lErrorIndex)
|
|
{
|
|
// we need to adjust the debug info to account for macros
|
|
LPCSTR lpText = (LPCSTR) csText;
|
|
long lIndex = 0;
|
|
long lSize;
|
|
|
|
LPCSTR lpRealText = (LPCSTR) csRealText;
|
|
long lRealIndex = 0;
|
|
char *pszMacroName = NULL;
|
|
long lMacroIndex;
|
|
|
|
CPA_EdIR_DebugInfo *pclDebugInfo;
|
|
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-09-
|
|
if (! bRes)
|
|
pclDebugInfoList -> AddTail (new CPA_EdIR_DebugInfo (NULL, 0, 0, lErrorIndex, (CString) ""));
|
|
// END ROMTEAM Cristi Petrescu 98-09-
|
|
|
|
POSITION pos = pclDebugInfoList -> GetHeadPosition ();
|
|
while (pos)
|
|
{
|
|
// get one node
|
|
pclDebugInfo = pclDebugInfoList -> GetNext (pos);
|
|
|
|
|
|
while (pclDebugInfo -> m_fn_lGetIndex () > lIndex)
|
|
{
|
|
// never should get the end of text...
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-09-
|
|
// no more crashes, but something is rotten
|
|
if (! lpText [lIndex])
|
|
break;
|
|
// END ROMTEAM Cristi Petrescu 98-09-
|
|
|
|
// advance text pointer
|
|
|
|
if (! strnicmp (lpText + lIndex, (LPCSTR) g_c_csBeginMacro, strlen ((LPCSTR) g_c_csBeginMacro)))
|
|
{
|
|
// we encountered an begin macro
|
|
// get it
|
|
lSize = 0;
|
|
while (isalnum (lpRealText [lRealIndex + lSize]) || lpRealText [lRealIndex + lSize] == '_')
|
|
lSize ++;
|
|
// no macro in macro
|
|
ASSERT (! pszMacroName);
|
|
pszMacroName = (char *) malloc ((lSize + 1) * sizeof (char));
|
|
strncpy (pszMacroName, lpRealText + lRealIndex, lSize);
|
|
pszMacroName [lSize] = 0;
|
|
lMacroIndex = 0;
|
|
|
|
// skip "beginmacro(int,int)"
|
|
while (lpText [lIndex] != ')')
|
|
lIndex ++;
|
|
}
|
|
|
|
if (! strnicmp (lpText + lIndex, (LPCSTR) g_c_csEndMacro, strlen ((LPCSTR) g_c_csEndMacro)))
|
|
{
|
|
// we encountered an end macro
|
|
// never end without begin
|
|
ASSERT (pszMacroName);
|
|
|
|
lRealIndex += strlen (pszMacroName);
|
|
lIndex += strlen (g_c_csEndMacro);
|
|
|
|
free (pszMacroName);
|
|
pszMacroName = NULL;
|
|
}
|
|
|
|
if (! pszMacroName)
|
|
lRealIndex ++;
|
|
else
|
|
lMacroIndex ++;
|
|
|
|
lIndex ++;
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-09-
|
|
if (! bRes && lIndex >= lErrorIndex)
|
|
{
|
|
lErrorIndex = lRealIndex;
|
|
delete pclDebugInfoList -> RemoveTail ();
|
|
return;
|
|
}
|
|
// END ROMTEAM Cristi Petrescu 98-09-
|
|
}
|
|
|
|
// adjust the debug info
|
|
pclDebugInfo -> m_fn_vSetIndex (lRealIndex);
|
|
if (pszMacroName)
|
|
{
|
|
pclDebugInfo -> m_fn_vSetMacroIndex (lMacroIndex);
|
|
pclDebugInfo -> m_fn_vSetMacroName (CString (pszMacroName));
|
|
}
|
|
}
|
|
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-09-
|
|
if (! bRes)
|
|
{
|
|
// be sure
|
|
delete pclDebugInfoList -> RemoveTail ();
|
|
}
|
|
// END ROMTEAM Cristi Petrescu 98-09-
|
|
}
|
|
// END ROMTEAM Cristi Petrescu 98-08-
|
|
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfWayPoints(CTL_Editor_Control *,CTL_Editor_EnumDescriptor *pclEnumList)
|
|
{
|
|
//Gets WayPoints List
|
|
CPA_List<CPA_BaseObject> clWayPointList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clWayPointList,"",C_szWayPointTypeName);
|
|
|
|
//First empties the enums list
|
|
pclEnumList->RemoveAll();
|
|
|
|
//Second fills the enums list for the WayPoints list
|
|
POSITION pos=clWayPointList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_BaseObject *pclWayPoint=clWayPointList.GetNext(pos);
|
|
|
|
pclEnumList->m_fn_pclAddElement(pclWayPoint->GetName(),(long)pclWayPoint->GetData());
|
|
}
|
|
|
|
pclEnumList->m_fn_pclAddElement(fn_csGetKeyWordEditorNameFromId(eKeyWord_Nowhere),(long)NULL);
|
|
}
|
|
|
|
//ANNECY Bart#02 23/04/98 {
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfGraph(CTL_Editor_Control *,CTL_Editor_EnumDescriptor *pclEnumList)
|
|
{
|
|
//Gets WayPoints List
|
|
CPA_List<CPA_BaseObject> clGraphHandleList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clGraphHandleList,"", C_szGraphTypeName);
|
|
|
|
//First empties the enums list
|
|
pclEnumList->RemoveAll();
|
|
|
|
//Second fills the enums list for the WayPoints list
|
|
POSITION pos=clGraphHandleList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_BaseObject* pclGraphHandle = clGraphHandleList.GetNext(pos);
|
|
|
|
pclEnumList->m_fn_pclAddElement(pclGraphHandle->GetName(), (long)pclGraphHandle->GetData());
|
|
}
|
|
|
|
pclEnumList->m_fn_pclAddElement(fn_csGetKeyWordEditorNameFromId(eKeyWord_NoGraph),(long)NULL);
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfCaps(CTL_Editor_Control *, CTL_Editor_MaskDescriptor *pclAddedMaskDesc)
|
|
{
|
|
//Adds strings to describe Mask
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Translater", 0x1);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Marcher", 0x2);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Courir", 0x4);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Reculer", 0x8);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Sauter", 0x10);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Voler", 0x20);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Accrocher", 0x40);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Suspendre", 0x80);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Nager", 0x100);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Balancer", 0x200);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Bloquer", 0x400);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Teleporter", 0x800);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Glisser", 0x1000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Aspirer", 0x2000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Pause", 0x4000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_15", 0x8000);
|
|
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_16", 0x10000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_17", 0x20000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_18", 0x40000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_19", 0x80000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_20", 0x100000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_21", 0x200000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_22", 0x400000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_23", 0x800000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_24", 0x1000000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_25", 0x2000000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_26", 0x4000000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_27", 0x8000000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_28", 0x10000000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_29", 0x20000000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("custom_30", 0x40000000);
|
|
pclAddedMaskDesc->m_pub_fn_pclAddMask("Has_All_Capabilities", 0x80000000);
|
|
}
|
|
|
|
//ENDANNECY Bart#02 }
|
|
|
|
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfPersos(CTL_Editor_Control *,CTL_Editor_EnumDescriptor *pclEnumList)
|
|
{
|
|
//Gets Persos List
|
|
CPA_List<CPA_BaseObject> clPersoList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clPersoList,"",C_szActorInstanceTypeName);
|
|
|
|
//First empties the enums list
|
|
pclEnumList->RemoveAll();
|
|
|
|
//Second fills the enums list for the Persos list
|
|
POSITION pos=clPersoList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclPerso=(CPA_Actor *)clPersoList.GetNext(pos);
|
|
|
|
if(pclPerso->m_fn_bIsAnAlways()==FALSE)
|
|
pclEnumList->m_fn_pclAddElement(pclPerso->GetName(),(long)M_GetSuperObject((tdstEngineObject *)pclPerso->GetData()));
|
|
}
|
|
|
|
pclEnumList->m_fn_pclAddElement(fn_csGetKeyWordEditorNameFromId(eKeyWord_Nobody),(long)NULL);
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfSuperObjects(CTL_Editor_Control *,CTL_Editor_EnumDescriptor *pclEnumList)
|
|
{
|
|
//Gets Persos List
|
|
CPA_BaseObjectList *p_clObjectList;
|
|
p_clObjectList = g_pclAIInterface->GetMainWorld()->fn_p_oGetOriginalObjectList(C_szSuperObjectTypeName);
|
|
|
|
//First empties the enums list
|
|
pclEnumList->RemoveAll();
|
|
|
|
//Second fills the enums list for the Persos list
|
|
Position pos=p_clObjectList -> GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_BaseObject *p_oObject = p_clObjectList -> GetNext (pos);
|
|
|
|
pclEnumList->m_fn_pclAddElement(p_oObject->GetName(),(long)p_oObject->GetData());
|
|
}
|
|
|
|
pclEnumList->m_fn_pclAddElement(fn_csGetKeyWordEditorNameFromId(eKeyWord_NoSuperObject),(long)NULL);
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfBehaviours(CTL_Editor_Control *,CTL_Editor_EnumDescriptor *pclEnumList)
|
|
{
|
|
//Gets Behaviours List
|
|
CPA_List<CPA_BaseObject> clBehaviourList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clBehaviourList,"",C_szIABehaviourTypeName);
|
|
|
|
//First empties the enums list
|
|
pclEnumList->RemoveAll();
|
|
|
|
//Second fills the enums list for the Behaviours list
|
|
POSITION pos=clBehaviourList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclBehaviour=(CPA_EdIR_MainBehaviour *)clBehaviourList.GetNext(pos);
|
|
|
|
//Be carefull, save editor pointer instead of motor pointer
|
|
pclEnumList->m_fn_pclAddElement(pclBehaviour->GetName(),(long)pclBehaviour);
|
|
}
|
|
|
|
pclEnumList->m_fn_pclAddElement(fn_csGetKeyWordEditorNameFromId(eKeyWord_NoComport),(long)NULL);
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfActions(CTL_Editor_Control *,CTL_Editor_EnumDescriptor *pclEnumList)
|
|
{
|
|
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
|
|
CPA_Actor *pclSelectedActor=(CPA_Actor *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetSelectedActor,0);
|
|
|
|
if (!pclSelectedActor)
|
|
return;
|
|
|
|
if(pclSelectedActor->m_fn_bIsAnInstance())
|
|
pclSelectedActor=pclSelectedActor->m_fn_pclGetModel();
|
|
|
|
CPA_Family *pclFamily=pclSelectedActor->m_pub_fn_pclGetFamily();
|
|
|
|
//Gets Actions List
|
|
CPA_List<CPA_BaseObject> clActionList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clActionList,"",C_szActionTypeName,pclFamily);
|
|
|
|
//First empties the enums list
|
|
pclEnumList->RemoveAll();
|
|
|
|
//Second fills the enums list for the Actions list
|
|
POSITION pos=clActionList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_Action *pclAction=(CPA_Action *)clActionList.GetNext(pos);
|
|
|
|
pclEnumList->m_fn_pclAddElement(pclAction->GetName(),(long)pclAction->mfn_p_oGetDefaultState()->GetData());
|
|
}
|
|
|
|
pclEnumList->m_fn_pclAddElement(fn_csGetKeyWordEditorNameFromId(eKeyWord_NoAction),(long)NULL);
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfTexts(CTL_Editor_Control *,CTL_Editor_EnumDescriptor *pclEnumList)
|
|
{
|
|
//Gets Texts List
|
|
|
|
//First empties the enums list
|
|
pclEnumList->RemoveAll();
|
|
|
|
//Second fills the enums list for the Texts list
|
|
// Inserts known texts: scan the FON link table and get all keys
|
|
{
|
|
SCR_tdst_Link_Value *p_stTextEntry;
|
|
SCR_tdst_Link_Table *p_stTextLinkTable = FON_fn_p_stGetLinkTable();
|
|
unsigned int uiTextPos = 0;
|
|
SCR_M_DyAr_GetNextElement(
|
|
SCR_tdst_Link_Value,
|
|
uiTextPos,
|
|
p_stTextEntry,
|
|
p_stTextLinkTable->stLinkArray
|
|
);
|
|
/* while there are entries in the list */
|
|
while ( p_stTextEntry )
|
|
{
|
|
pclEnumList->m_fn_pclAddElement(SCR_M_p_sz_Link_GetKey(p_stTextEntry),SCR_M_ul_Link_GetValue(p_stTextEntry));
|
|
|
|
uiTextPos ++;
|
|
SCR_M_DyAr_GetNextElement(
|
|
SCR_tdst_Link_Value,
|
|
uiTextPos,
|
|
p_stTextEntry,
|
|
p_stTextLinkTable->stLinkArray
|
|
);
|
|
}
|
|
}
|
|
|
|
pclEnumList->m_fn_pclAddElement("Invalid",(long)FON_C_xInvalidTextHandle);
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void m_fn_vConstructListOfGameMaterials(CTL_Editor_Control *,CTL_Editor_EnumDescriptor *pclEnumList)
|
|
{
|
|
//Gets GameMaterials List
|
|
CPA_List<CPA_BaseObject> clGameMaterialList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clGameMaterialList,"",C_szGameMaterialTypeName);
|
|
|
|
//First empties the enums list
|
|
pclEnumList->RemoveAll();
|
|
|
|
//Second fills the enums list for the GameMaterials list
|
|
POSITION pos=clGameMaterialList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_BaseObject *pclGameMaterial=clGameMaterialList.GetNext(pos);
|
|
|
|
pclEnumList->m_fn_pclAddElement(pclGameMaterial->GetName(),(long)pclGameMaterial->GetData());
|
|
}
|
|
|
|
//pclEnumList->m_fn_pclAddElement(fn_csGetKeyWordEditorNameFromId(eKeyWord_Nobody),(long)NULL);
|
|
}
|
|
|
|
/*************************************************************************/
|
|
//ANNECY CB
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
void fn_vCreateDsgVarControl(CString &csDsgVarType, CString &csDsgVarName, long lIndexOfDsgVar, BOOL bIsPrivate, BOOL bUpdate)
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
//void fn_vCreateDsgVarControl(CString csDsgVarType, CString csDsgVarName, long lIndexOfDsgVar)
|
|
//END
|
|
{
|
|
CPA_EdIR_Frame *pclIRMainFrame=g_pclAIInterface->m_pclIRMainFrame;
|
|
CPA_Actor *pclModel=pclIRMainFrame->m_fn_pclGetModel();
|
|
CTL_Editor_ControlList *pclListOfDesignerVariableControl=&(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_clListOfDesignerVariableControl);
|
|
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
|
|
CPA_EdIR_DesignerVariablesView *pclDsgVarView=(CPA_EdIR_DesignerVariablesView *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetDesignerVariablesView,0);
|
|
|
|
//Only for array (see M_ADD_ONE_DSG_VAR macro)
|
|
BOOL bArray=FALSE;
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
BOOL bMyArray = FALSE;
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
// get the qualifier value
|
|
OAC_eDataQualifier eDataQualifier = bIsPrivate ? OAC_DATA_PRIVATE : OAC_DATA_PUBLIC;
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
|
|
//Adds a new control for this designer variable
|
|
tdeDsgVarTypeId lDsgVarTypeId;
|
|
lDsgVarTypeId=fn_eFindDsgVarTypeIdFromScriptName(M_MAKECHAR(csDsgVarType));
|
|
switch(lDsgVarTypeId)
|
|
{
|
|
case eDsgVarType_Boolean:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_BooleanControl,C_BOOLEAN_CONTROL_PARMS,
|
|
CTL_Editor_BooleanData,C_BOOLEAN_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType__128To127:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_IntegerControl,C_SIGNED_CHAR_CONTROL_PARMS,
|
|
CTL_Editor_IntegerData,C_SIGNED_CHAR_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_0To255:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_IntegerControl,C_UNSIGNED_CHAR_CONTROL_PARMS,
|
|
CTL_Editor_IntegerData,C_UNSIGNED_CHAR_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType__32768To32767:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_IntegerControl,C_SIGNED_SHORT_CONTROL_PARMS,
|
|
CTL_Editor_IntegerData,C_SIGNED_SHORT_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_0To65535:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_IntegerControl,C_UNSIGNED_SHORT_CONTROL_PARMS,
|
|
CTL_Editor_IntegerData,C_UNSIGNED_SHORT_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_Integer:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_IntegerControl,C_SIGNED_LONG_CONTROL_PARMS,
|
|
CTL_Editor_IntegerData,C_SIGNED_LONG_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_PositiveInteger:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_IntegerControl,C_UNSIGNED_LONG_CONTROL_PARMS,
|
|
CTL_Editor_IntegerData,C_UNSIGNED_LONG_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_Float:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_DecimalControl,C_FLOAT_CONTROL_PARMS,
|
|
CTL_Editor_DecimalData,C_FLOAT_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
//ANNECY Bart#02 23/04/98 {
|
|
case eDsgVarType_Caps :
|
|
{
|
|
CTL_Editor_MaskDescriptor *pclMaskList = new CTL_Editor_MaskDescriptor(csDsgVarName);
|
|
m_fn_vConstructListOfCaps(NULL, pclMaskList);
|
|
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_MaskedControl,C_CAPS_CONTROL_PARMS,
|
|
CTL_Editor_MaskedData,C_CAPS_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
case eDsgVarType_Graph :
|
|
{
|
|
//Constructs the enums list for the Graph list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfGraph(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_GRAPH_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_GRAPH_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfGraph);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfGraph);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
//ENDANNECY Bart#02 }
|
|
case eDsgVarType_WayPoint:
|
|
{
|
|
//Constructs the enums list for the WayPoints list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfWayPoints(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
// CPA2 ASilvescu 98-05-21
|
|
// M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_WAYPOINT_CONTROL_PARMS,
|
|
// CTL_Editor_EnumData,C_WAYPOINT_DATA_PARMS);
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_DsgVarEnumControl,C_WAYPOINT_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_WAYPOINT_DATA_PARMS,bUpdate);
|
|
// End CPA2 ASilvescu 98-05-21
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfWayPoints);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfWayPoints);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_Perso:
|
|
{
|
|
//Constructs the enums list for the characters list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfPersos(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_PERSO_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_PERSO_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfPersos);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfPersos);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_SuperObject:
|
|
{
|
|
//Constructs the enums list for the characters list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfSuperObjects(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_SUPEROBJECT_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_SUPEROBJECT_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfSuperObjects);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfSuperObjects);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_List:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_IntegerControl,C_LIST_CONTROL_PARMS,
|
|
CTL_Editor_IntegerData,C_LIST_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_Vector:
|
|
{
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_VectorControl,C_VECTOR_CONTROL_PARMS,
|
|
CTL_Editor_VectorData,C_VECTOR_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_Comport:
|
|
{
|
|
//Constructs the enums list for the behaviours list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfBehaviours(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_BEHAVIOUR_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_BEHAVIOUR_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfBehaviours);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfBehaviours);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_Action:
|
|
{
|
|
//Constructs the enums list for the actions list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfActions(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_ACTION_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_ACTION_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfActions);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfActions);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_Text:
|
|
{
|
|
//Constructs the enums list for the texts list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfTexts(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_TEXT_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_TEXT_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfTexts);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfTexts);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_GameMaterial:
|
|
{
|
|
//Constructs the enums list for the game materials characters list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfGameMaterials(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_GMT_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_GMT_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfGameMaterials);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfGameMaterials);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_PersoArray:
|
|
{
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
//Creates one dsg var (init and current)
|
|
bMyArray = TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_ArrayEnumControl,C_ARRAY_CONTROL_PARMS,
|
|
CTL_Editor_ArrayData,C_ARRAY_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfPersos);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfPersos);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
/*
|
|
{
|
|
//Constructs the enums list for the characters list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfPersos(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
bArray=TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_PERSO_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_PERSO_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfPersos);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfPersos);
|
|
|
|
//Creates index for array
|
|
fn_vCreateIndexControlForArray(csDsgVarName+g_c_csDsgVarInitText,lIndexOfDsgVar,OAC_DATA_LEVEL_2,pclInitCtrl,C_ADD_ANTEPENULTIMATE);
|
|
fn_vCreateIndexControlForArray(csDsgVarName,lIndexOfDsgVar,OAC_DATA_LEVEL_3,pclCtrl,C_ADD_LAST_BUT_ONE);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
*/
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_VectorArray:
|
|
{
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
//Creates one dsg var (init and current)
|
|
bMyArray = TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_ArrayVectorControl,C_ARRAY_CONTROL_PARMS,
|
|
CTL_Editor_ArrayData,C_ARRAY_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
/*
|
|
{
|
|
bArray=TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_VectorControl,C_VECTOR_CONTROL_PARMS,
|
|
CTL_Editor_VectorData,C_VECTOR_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateIndexControlForArray(csDsgVarName+g_c_csDsgVarInitText,lIndexOfDsgVar,OAC_DATA_LEVEL_2,pclInitCtrl,C_ADD_ANTEPENULTIMATE);
|
|
fn_vCreateIndexControlForArray(csDsgVarName,lIndexOfDsgVar,OAC_DATA_LEVEL_3,pclCtrl,C_ADD_LAST_BUT_ONE);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
*/
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_FloatArray:
|
|
{
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
//Creates one dsg var (init and current)
|
|
bMyArray = TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_ArrayFloatControl,C_ARRAY_CONTROL_PARMS,
|
|
CTL_Editor_ArrayData,C_ARRAY_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
/*
|
|
{
|
|
bArray=TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_DecimalControl,C_FLOAT_CONTROL_PARMS,
|
|
CTL_Editor_DecimalData,C_FLOAT_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateIndexControlForArray(csDsgVarName+g_c_csDsgVarInitText,lIndexOfDsgVar,OAC_DATA_LEVEL_2,pclInitCtrl,C_ADD_ANTEPENULTIMATE);
|
|
fn_vCreateIndexControlForArray(csDsgVarName,lIndexOfDsgVar,OAC_DATA_LEVEL_3,pclCtrl,C_ADD_LAST_BUT_ONE);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
*/
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_IntegerArray:
|
|
{
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
//Creates one dsg var (init and current)
|
|
bMyArray = TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_ArrayIntegerControl,C_ARRAY_CONTROL_PARMS,
|
|
CTL_Editor_ArrayData,C_ARRAY_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
/*
|
|
{
|
|
bArray=TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_IntegerControl,C_SIGNED_LONG_CONTROL_PARMS,
|
|
CTL_Editor_IntegerData,C_SIGNED_LONG_DATA_PARMS,bUpdate);
|
|
|
|
fn_vCreateIndexControlForArray(csDsgVarNaSme+g_c_csDsgVarInitText,lIndexOfDsgVar,OAC_DATA_LEVEL_2,pclInitCtrl,C_ADD_ANTEPENULTIMATE);
|
|
fn_vCreateIndexControlForArray(csDsgVarName,lIndexOfDsgVar,OAC_DATA_LEVEL_3,pclCtrl,C_ADD_LAST_BUT_ONE);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
*/
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_WayPointArray:
|
|
{
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
//Creates one dsg var (init and current)
|
|
bMyArray = TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_ArrayEnumControl,C_ARRAY_CONTROL_PARMS,
|
|
CTL_Editor_ArrayData,C_ARRAY_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfWayPoints);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfWayPoints);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
/*
|
|
{
|
|
//Constructs the enums list for the WayPoints list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfWayPoints(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
bArray=TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_WAYPOINT_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_WAYPOINT_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfWayPoints);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfWayPoints);
|
|
|
|
//Creates index for array
|
|
fn_vCreateIndexControlForArray(csDsgVarName+g_c_csDsgVarInitText,lIndexOfDsgVar,OAC_DATA_LEVEL_2,pclInitCtrl,C_ADD_ANTEPENULTIMATE);
|
|
fn_vCreateIndexControlForArray(csDsgVarName,lIndexOfDsgVar,OAC_DATA_LEVEL_3,pclCtrl,C_ADD_LAST_BUT_ONE);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
*/
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
}
|
|
break;
|
|
|
|
case eDsgVarType_TextArray:
|
|
{
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-11-
|
|
//Creates one dsg var (init and current)
|
|
bMyArray = TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_ArrayEnumControl,C_ARRAY_CONTROL_PARMS,
|
|
CTL_Editor_ArrayData,C_ARRAY_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfTexts);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfTexts);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
/*
|
|
{
|
|
//Constructs the enums list for the texts list
|
|
CTL_Editor_EnumDescriptor *pclEnumList=new CTL_Editor_EnumDescriptor(csDsgVarName,4);
|
|
m_fn_vConstructListOfTexts(NULL,pclEnumList);
|
|
|
|
//Creates one dsg var (init and current)
|
|
bArray=TRUE;
|
|
M_ADD_ONE_DSG_VAR(CTL_Editor_EnumControl,C_TEXT_CONTROL_PARMS,
|
|
CTL_Editor_EnumData,C_TEXT_DATA_PARMS,bUpdate);
|
|
|
|
//Sets call back function in order to update the combo box
|
|
pclInitCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfTexts);
|
|
pclCtrl->m_pub_fn_vSetBuildEnumDesciptor_CallBack(m_fn_vConstructListOfTexts);
|
|
|
|
//Creates index for array
|
|
fn_vCreateIndexControlForArray(csDsgVarName+g_c_csDsgVarInitText,lIndexOfDsgVar,OAC_DATA_LEVEL_2,pclInitCtrl,C_ADD_ANTEPENULTIMATE);
|
|
fn_vCreateIndexControlForArray(csDsgVarName,lIndexOfDsgVar,OAC_DATA_LEVEL_3,pclCtrl,C_ADD_LAST_BUT_ONE);
|
|
|
|
fn_vCreateControlForSaving(csDsgVarName+g_c_csDsgVarSaveTypeText,lIndexOfDsgVar, bUpdate);
|
|
fn_vCreateControlForInitialization(csDsgVarName+g_c_csDsgVarInitTypeText,lIndexOfDsgVar, bUpdate);
|
|
}
|
|
*/
|
|
// END ROMTEAM Cristi Petrescu 98-11-
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
/*************************************************************************/
|
|
//ANNECY CB
|
|
void fn_vUpdateDsgVarControl(CString &csDsgVarType, CString &csDsgVarName, long lIndexOfDsgVar)
|
|
//void fn_vUpdateDsgVarControl(CString csDsgVarType, CString csDsgVarName, long lIndexOfDsgVar)
|
|
//END
|
|
{
|
|
CPA_EdIR_Frame *pclIRMainFrame=g_pclAIInterface->m_pclIRMainFrame;
|
|
CPA_Actor *pclModel=pclIRMainFrame->m_fn_pclGetModel();
|
|
CPA_List<CPA_BaseObject> clInstancesList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel);
|
|
|
|
//Updates Data Pointer for models
|
|
POSITION pos=clInstancesList.GetHeadPosition();
|
|
if(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetAt(pos));
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
|
|
|
|
if(hBrain!=NULL)
|
|
{
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain);
|
|
|
|
if(pstMind!=NULL)
|
|
{
|
|
if(M_GetDsgMem(pstMind)!=NULL)
|
|
{
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType;
|
|
pclListOfDesignerVariableType=pclModel->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
|
|
|
|
//Sets address of the engine data
|
|
if(lIndexOfDsgVar<M_GetNbDsgVar(pstMind))
|
|
{
|
|
//Initial value for array
|
|
tdeDsgVarTypeId eDsgVarTypeId=fn_eFindDsgVarTypeIdFromScriptName(M_MAKECHAR(csDsgVarType));
|
|
tdeVariableType eVariableType=fn_GetDsgVarType(eDsgVarTypeId);
|
|
if(eVariableType==E_vt_Array)
|
|
{
|
|
CTL_Editor_Data *pclData=pclListOfDesignerVariableType->m_fn_pclGetDataFromName(csDsgVarName+g_c_csDsgVarInitText);
|
|
if(pclData!=NULL)
|
|
{
|
|
void *pvEngineData=M_GetDsgVarAddrDefault(pstMind,lIndexOfDsgVar);
|
|
tdstArray *pstArray=(tdstArray *)pvEngineData;
|
|
pclData->m_fn_vSetMotorDataPtr(M_ARRAY_ELEMENT(pstArray,0));
|
|
}
|
|
}
|
|
|
|
//Save Type
|
|
CTL_Editor_Data *pclData=pclListOfDesignerVariableType->m_fn_pclGetDataFromName(csDsgVarName+g_c_csDsgVarSaveTypeText);
|
|
if(pclData!=NULL)
|
|
{
|
|
void *pvEngineData=&M_GetDsgVarSaveType(pstMind,lIndexOfDsgVar);
|
|
pclData->m_fn_vSetMotorDataPtr(pvEngineData);
|
|
}
|
|
|
|
//Init Type
|
|
pclData=pclListOfDesignerVariableType->m_fn_pclGetDataFromName(csDsgVarName+g_c_csDsgVarInitTypeText);
|
|
if(pclData!=NULL)
|
|
{
|
|
void *pvEngineData=&M_GetDsgVarInitType(pstMind,lIndexOfDsgVar);
|
|
pclData->m_fn_vSetMotorDataPtr(pvEngineData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//Updates Data Pointer for instances
|
|
pos=clInstancesList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetNext(pos));
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
|
|
|
|
if(hBrain!=NULL)
|
|
{
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain);
|
|
|
|
if(pstMind!=NULL)
|
|
{
|
|
if(M_GetDsgMem(pstMind)!=NULL)
|
|
{
|
|
CTL_Editor_DataList *pclListOfDesignerVariableType;
|
|
pclListOfDesignerVariableType=pclInstance->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
|
|
|
|
//Sets address of the engine data
|
|
if(lIndexOfDsgVar<M_GetNbDsgVar(pstMind))
|
|
{
|
|
//Initial value
|
|
CTL_Editor_Data *pclData=pclListOfDesignerVariableType->m_fn_pclGetDataFromName(csDsgVarName+g_c_csDsgVarInitText);
|
|
if(pclData!=NULL)
|
|
{
|
|
void *pvEngineData=M_GetDsgVarAddrInit(pstMind,lIndexOfDsgVar);
|
|
|
|
tdeDsgVarTypeId eDsgVarTypeId=fn_eFindDsgVarTypeIdFromScriptName(M_MAKECHAR(csDsgVarType));
|
|
tdeVariableType eVariableType=fn_GetDsgVarType(eDsgVarTypeId);
|
|
if(eVariableType==E_vt_Array)
|
|
{
|
|
tdstArray *pstArray=(tdstArray *)pvEngineData;
|
|
|
|
void *pvDefaultEngineData=M_GetDsgVarAddrDefault(pstMind,lIndexOfDsgVar);
|
|
tdstArray *pstDefaultArray=(tdstArray *)pvDefaultEngineData;
|
|
|
|
M_ARRAY_TYPE(pstArray) = M_ARRAY_TYPE(pstDefaultArray);
|
|
M_ARRAY_SIZE(pstArray) = M_ARRAY_SIZE(pstDefaultArray);
|
|
|
|
pclData->m_fn_vSetMotorDataPtr(pstArray);
|
|
}
|
|
else
|
|
{
|
|
pclData->m_fn_vSetMotorDataPtr(pvEngineData);
|
|
}
|
|
}
|
|
|
|
//Current value
|
|
pclData=pclListOfDesignerVariableType->m_fn_pclGetDataFromName(csDsgVarName);
|
|
if(pclData!=NULL)
|
|
{
|
|
void *pvEngineData=M_GetDsgVarAddr(pstMind,lIndexOfDsgVar);
|
|
|
|
tdeDsgVarTypeId eDsgVarTypeId=fn_eFindDsgVarTypeIdFromScriptName(M_MAKECHAR(csDsgVarType));
|
|
tdeVariableType eVariableType=fn_GetDsgVarType(eDsgVarTypeId);
|
|
if(eVariableType==E_vt_Array)
|
|
{
|
|
tdstArray *pstArray=(tdstArray *)pvEngineData;
|
|
|
|
void *pvDefaultEngineData=M_GetDsgVarAddrDefault(pstMind,lIndexOfDsgVar);
|
|
tdstArray *pstDefaultArray=(tdstArray *)pvDefaultEngineData;
|
|
|
|
M_ARRAY_TYPE(pstArray) = M_ARRAY_TYPE(pstDefaultArray);
|
|
M_ARRAY_SIZE(pstArray) = M_ARRAY_SIZE(pstDefaultArray);
|
|
|
|
pclData->m_fn_vSetMotorDataPtr(pstArray);
|
|
}
|
|
else
|
|
{
|
|
pclData->m_fn_vSetMotorDataPtr(pvEngineData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*************************************************************************/
|
|
CString fn_csGetCodeWithoutComments(CString &csIn)
|
|
{
|
|
CString csOut;
|
|
LPCSTR lpsz = (LPCSTR) csIn;
|
|
long lIndex = 0, lDest = 0;
|
|
char *lpdest = (char *) malloc(csIn.GetLength() + 1);
|
|
|
|
while(lpsz[lIndex])
|
|
{
|
|
while(lpsz[lIndex] && lpsz[lIndex] != ';') lpdest[lDest++]=lpsz[lIndex++];
|
|
while(lpsz[lIndex] && lpsz[lIndex] != '\xA') lIndex++;
|
|
if(lpsz[lIndex])
|
|
lpdest[lDest++]='\xA';
|
|
}
|
|
lpdest[lDest] = '\0';
|
|
csOut = lpdest;
|
|
free(lpdest);
|
|
return csOut;
|
|
}
|
|
|
|
/*************************************************************************/
|
|
// SHAITAN => CORRECTION SUBR
|
|
long fn_lGetNbRules(CString &csIn)
|
|
{
|
|
//First erase comments
|
|
CString csCode=fn_csGetCodeWithoutComments(csIn);
|
|
|
|
//Expand Macro
|
|
csCode=fn_csExpandMacro(csCode,C_WITH_NO_MACRO_INFO);
|
|
|
|
//Counts rules
|
|
long lNbRules=0;
|
|
long lid;
|
|
long lIndex=0;
|
|
CString csWord=fn_csGetNextWord(csCode,lIndex);
|
|
long lDepth=1;
|
|
BOOL bIsIntoAnITRulesSection=FALSE;
|
|
while(!csWord.IsEmpty())
|
|
|
|
{
|
|
lid = fn_lGetKeyWordIdFromEditorName(csWord);
|
|
if(!bIsIntoAnITRulesSection && lid==eKeyWord_InterruptRule)
|
|
{
|
|
bIsIntoAnITRulesSection=TRUE;
|
|
}
|
|
|
|
if((lid==eKeyWord_If)||(lid==eKeyWord_If2)||(lid==eKeyWord_If4)||(lid==eKeyWord_If8)||(lid==eKeyWord_If16)||(lid==eKeyWord_IfNot)||(lid==eKeyWord_IfDebug)||(lid==eKeyWord_IfNotU64))
|
|
lDepth++;
|
|
else if(lid==eKeyWord_Endif)
|
|
{
|
|
lDepth--;
|
|
if(lDepth==1 && bIsIntoAnITRulesSection)
|
|
lNbRules++;
|
|
}
|
|
|
|
csWord=fn_csGetNextWord(csCode,lIndex);
|
|
if(bIsIntoAnITRulesSection && csWord.IsEmpty() && lid!=eKeyWord_Endif)
|
|
{
|
|
lNbRules++;
|
|
|
|
}
|
|
}
|
|
/* the comport is generated in one single rule */
|
|
if ( gcGenerateOneRule && lNbRules )
|
|
lNbRules = 1;
|
|
return lNbRules;
|
|
}
|
|
|
|
/*************************************************************************/
|
|
/*
|
|
long fn_lGetNbRules ( CString & csIn )
|
|
{
|
|
//First erase comments
|
|
CString csCode = fn_csGetCodeWithoutComments ( csIn ) ;
|
|
|
|
//Expand Macro
|
|
csCode = fn_csExpandMacro ( csCode , C_WITH_NO_MACRO_INFO ) ;
|
|
|
|
//Counts rules
|
|
long lNbRules = 0 ;
|
|
long lid ;
|
|
long lIndex = 0 ;
|
|
CString csWord = fn_csGetNextWord ( csCode , lIndex ) ;
|
|
long lDepth = 1 ;
|
|
BOOL bIsIntoAnITRulesSection = FALSE , bPrevWordWasAMacroRef = FALSE ;
|
|
|
|
while ( ! csWord . IsEmpty ( ) )
|
|
{
|
|
lid = fn_lGetKeyWordIdFromEditorName ( csWord ) ;
|
|
if( ! bIsIntoAnITRulesSection && lid == eKeyWord_InterruptRule )
|
|
{
|
|
bIsIntoAnITRulesSection = TRUE ;
|
|
}
|
|
|
|
if ( bIsIntoAnITRulesSection )
|
|
{
|
|
if
|
|
(
|
|
( lid == eKeyWord_If )
|
|
|| ( lid == eKeyWord_If2 )
|
|
|| ( lid == eKeyWord_If4 )
|
|
|| ( lid == eKeyWord_If8 )
|
|
|| ( lid == eKeyWord_If16 )
|
|
|| ( lid == eKeyWord_IfNot )
|
|
|| ( lid ==eKeyWord_IfDebug )
|
|
|| ( lid == eKeyWord_IfNotU64 )
|
|
)
|
|
{
|
|
lDepth ++ ;
|
|
}
|
|
else if ( lid == eKeyWord_Endif )
|
|
{
|
|
lDepth -- ;
|
|
if ( lDepth == 1 )
|
|
lNbRules ++ ;
|
|
}
|
|
else if ( lDepth == 1 )
|
|
{
|
|
if ( g_pclListOfSubrs -> m_fn_bIsInList (csWord) ) // a macroref adds a rule to contain it
|
|
{
|
|
bPrevWordWasAMacroRef = TRUE ;
|
|
lNbRules ++ ;
|
|
}
|
|
else
|
|
{
|
|
bPrevWordWasAMacroRef = FALSE ;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bPrevWordWasAMacroRef = FALSE ;
|
|
}
|
|
|
|
csWord = fn_csGetNextWord ( csCode , lIndex ) ;
|
|
if ( csWord.IsEmpty ( ) && lid != eKeyWord_Endif && ! bPrevWordWasAMacroRef )
|
|
{
|
|
lNbRules ++ ;
|
|
}
|
|
}
|
|
}
|
|
// the comport is generated in one single rule
|
|
if ( gcGenerateOneRule && lNbRules )
|
|
lNbRules = 1 ;
|
|
|
|
return lNbRules ;
|
|
}
|
|
*/
|
|
// SHAITAN => END CORRECTION SUBR
|
|
|
|
/*************************************************************************/
|
|
CPA_SaveObject *fn_pclGetReachableObject(long lHandle,CString csType/*=""*/)
|
|
{
|
|
return (CPA_SaveObject *)g_pclAIInterface->GetMainWorld()->fn_p_oFindObjectWithEngine((void *)lHandle,M_MAKECHAR(csType));
|
|
}
|
|
|
|
/*************************************************************************/
|
|
void fn_vAddOneDependency(CPA_EdIR_MainBehaviour *pclMainBehaviour,
|
|
CPA_BaseObject *pclFather,CPA_BaseObject *pclChild)
|
|
{
|
|
g_oCoherenceManager.m_fn_vAddALink(pclFather,pclChild);
|
|
|
|
pclMainBehaviour->m_clListOfDependencies.AddTail(pclChild);
|
|
}
|
|
|
|
/*************************************************************************/
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-05-
|
|
BOOL fn_bCheckIA(CPA_EdIR_MainBehaviour *pclMainBehaviour, tdeTypeText eTypeText,CString csIn,long &lIndexError, CString csBehaviourName)
|
|
//END ROMTEAM Cristi Petrescu 98-05-
|
|
{
|
|
CString csOut;
|
|
|
|
if(eTypeText==DsgVarText)
|
|
g_clDsgVarList.m_fn_vDestroyAndRemoveAllEntries();
|
|
|
|
if(eTypeText==MacroText)
|
|
// BEGIN CPA2 Cristi Petrescu 98-03-
|
|
// hopefully this is called only by CPA_EdIR_Behaviour::fn_bCheckIA, so move it there
|
|
{
|
|
// g_clTempMacroList . m_fn_vCopyMacros (g_clMacroList);
|
|
g_clMacroList.m_fn_vDestroyAndRemoveAllEntries();
|
|
}
|
|
// END CPA2 Cristi Petrescu 98-03-
|
|
|
|
// BEGIN ROMTEAM CPA2 Cristi Petrescu 98-04-
|
|
if((eTypeText==DsgVarText)||(eTypeText==MacroText)||(eTypeText == Macro_2_Text))
|
|
// END ROMTEAM CPA2 Cristi Petrescu 98-04-
|
|
{
|
|
csOut = csIn;
|
|
csOut.MakeLower();
|
|
}
|
|
else
|
|
csOut=fn_csExpandMacro(csIn);
|
|
|
|
// CPA_EdIR_IntermediateCodeList clIntermediateCodeList;
|
|
// BOOL bRes=fn_bAnalysesText(csOut,eTypeText,lIndexError,&clIntermediateCodeList);
|
|
CPA_EdIR_IntermediateCodeList *pclIntermediateCodeList=&(pclMainBehaviour->m_pclBehaviour->m_clIntermediateCodeList);
|
|
pclIntermediateCodeList->m_fn_vDestroyAndRemoveAllEntries();
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-05-
|
|
BOOL bRes=fn_bAnalysesText(csOut,eTypeText,lIndexError,pclIntermediateCodeList, csBehaviourName);
|
|
//END ROMTEAM Cristi Petrescu 98-05-
|
|
if(bRes)
|
|
pclMainBehaviour->m_pclBehaviour->m_fn_vSetIntermediateCodeList(TRUE);
|
|
// clIntermediateCodeList.m_fn_vDestroyAndRemoveAllEntries();
|
|
|
|
return bRes;
|
|
}
|
|
|
|
|
|
/****************************************************************************/
|
|
CString fn_csGetFamilyName(CPA_Actor *pclModel)
|
|
{
|
|
CPA_Family *pclFamily=pclModel->m_pub_fn_pclGetFamily();
|
|
|
|
return pclFamily->GetName();
|
|
}
|
|
|
|
/****************************************************************************/
|
|
CString fn_csGetModelName(CPA_Actor *pclModel)
|
|
{
|
|
return pclModel->GetName();
|
|
}
|
|
|
|
/****************************************************************************/
|
|
CString fn_csGetFamilyName(CPA_EdIR_MainBehaviour *pclMainBehaviour)
|
|
{
|
|
return fn_csGetFamilyName((CPA_Actor *)pclMainBehaviour->GetOwner());
|
|
}
|
|
|
|
/****************************************************************************/
|
|
CString fn_csGetModelName(CPA_EdIR_MainBehaviour *pclMainBehaviour)
|
|
{
|
|
return fn_csGetModelName((CPA_Actor *)pclMainBehaviour->GetOwner());
|
|
}
|
|
|
|
/*************************************************************************/
|
|
char gasz_ArrayRefs[300][255];
|
|
int gi_ActualRefNode = 0;
|
|
int gi_ActualRefStr = 0;
|
|
struct
|
|
{
|
|
tdstNodeInterpret *pstNode;
|
|
int iFirst;
|
|
} gapst_ArrayNodeRefs[5000];
|
|
|
|
char CFast_IsAReference(tdstNodeInterpret *_pst_Node, int *pi_Indice)
|
|
{
|
|
int i;
|
|
for(i = 0; i < gi_ActualRefNode; i++)
|
|
{
|
|
if(gapst_ArrayNodeRefs[i].pstNode == _pst_Node)
|
|
{
|
|
*pi_Indice = gapst_ArrayNodeRefs[i].iFirst;
|
|
return 1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
void CRR_fprintf(FILE *h, LPCSTR p, char autorise, CString &csDepth, tdstNodeInterpret *_pst_Node)
|
|
{
|
|
if(autorise)
|
|
{
|
|
gapst_ArrayNodeRefs[gi_ActualRefNode].pstNode = _pst_Node;
|
|
for(int i = 0; i < gi_ActualRefStr; i++)
|
|
{
|
|
if(!strcmpi(gasz_ArrayRefs[i], (char*)p))
|
|
{
|
|
gapst_ArrayNodeRefs[gi_ActualRefNode++].iFirst = i;
|
|
return;
|
|
}
|
|
}
|
|
gapst_ArrayNodeRefs[gi_ActualRefNode++].iFirst = gi_ActualRefStr;
|
|
fprintf(h, "\t");
|
|
strcpy(gasz_ArrayRefs[gi_ActualRefStr++], (char*)p);
|
|
fprintf(h, (char*)p);
|
|
fprintf(h, csDepth+")\n");
|
|
}
|
|
}
|
|
|
|
/*************************************************************************/
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-05-
|
|
BOOL fn_bProcessIA
|
|
(
|
|
BOOL bProcessAll,CPA_EdIR_MainBehaviour *pclMainBehaviour,BOOL bCreateControl,AI_tdstMind *pstMind,tdstComport *pstComport,tdstTreeInterpret *pstRule,
|
|
tdeTypeText eTypeText,CString csIn,long &lIndexError,CPA_EdIR_DebugInfoList *pclDebugInfoList, CString csBehaviourName
|
|
)
|
|
//END ROMTEAM Cristi Petrescu 98-05-
|
|
{
|
|
CString csOut;
|
|
char autorise = 1;
|
|
CString csRef;
|
|
|
|
if(eTypeText != CRRGeneration)
|
|
{
|
|
autorise = 0;
|
|
}
|
|
|
|
if(
|
|
(
|
|
(pclMainBehaviour->m_pclBehaviour->m_fn_bIntermediateCodeListIsGood()==FALSE)
|
|
||
|
|
(bProcessAll==TRUE)
|
|
)
|
|
&&
|
|
(eTypeText==DsgVarText)
|
|
)
|
|
g_clDsgVarList.m_fn_vDestroyAndRemoveAllEntries();
|
|
|
|
if(
|
|
(
|
|
(pclMainBehaviour->m_pclBehaviour->m_fn_bIntermediateCodeListIsGood()==FALSE)
|
|
||
|
|
(bProcessAll==TRUE)
|
|
)
|
|
&&
|
|
(eTypeText==MacroText)
|
|
)
|
|
g_clMacroList.m_fn_vDestroyAndRemoveAllEntries();
|
|
//ANNECY CB
|
|
// BEGIN ROMTEAM CPA2 Cristi Petrescu 98-04-
|
|
if((eTypeText==DsgVarText)||(eTypeText==MacroText)||(eTypeText == Macro_2_Text))
|
|
// END ROMTEAM CPA2 Cristi Petrescu 98-04-
|
|
{
|
|
csOut = csIn;
|
|
csOut.MakeLower();
|
|
}
|
|
else
|
|
csOut=fn_csExpandMacro(csIn);
|
|
// csOut.MakeLower();
|
|
//END
|
|
|
|
ASSERT(pclMainBehaviour!=NULL);
|
|
ASSERT(pclMainBehaviour->m_pclBehaviour!=NULL);
|
|
|
|
CPA_EdIR_IntermediateCodeList *pclIntermediateCodeList=&(pclMainBehaviour->m_pclBehaviour->m_clIntermediateCodeList);
|
|
BOOL bRes=TRUE;
|
|
if(eTypeText != CRRGeneration)
|
|
{
|
|
if((pclMainBehaviour->m_pclBehaviour->m_fn_bIntermediateCodeListIsGood()==FALSE) ||
|
|
(bProcessAll==TRUE))
|
|
{
|
|
pclIntermediateCodeList->m_fn_vDestroyAndRemoveAllEntries();
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-05-
|
|
bRes=fn_bAnalysesText(csOut,eTypeText,lIndexError,pclIntermediateCodeList, csBehaviourName);
|
|
//END ROMTEAM Cristi Petrescu 98-05-
|
|
}
|
|
}
|
|
|
|
if(bRes)
|
|
{
|
|
CString csBehaviourName=pclMainBehaviour->GetName();
|
|
|
|
tdstTreeInterpret *pstSchedule=NULL;
|
|
tdstNodeInterpret *pstNode=NULL;
|
|
|
|
long lCurrentDsgVar=0;
|
|
unsigned long ulNextOffset=0;
|
|
BOOL bInScheduleSection=FALSE;
|
|
BOOL bInITRulesSection=FALSE;
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
BOOL bInSubr = FALSE;
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
POSITION pos=pclIntermediateCodeList->GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_EdIR_IntermediateCode *pclIntermediateCode=pclIntermediateCodeList->GetNext(pos);
|
|
|
|
switch(pclIntermediateCode->m_fn_tdeGetNodeType())
|
|
{
|
|
case eBeginMacro:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_lValueInterpret,pclIntermediateCode->m_fn_lGetIndex(),E_ti_BeginMacro);
|
|
}
|
|
break;
|
|
case eEndMacro:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_lValueInterpret,pclIntermediateCode->m_fn_lGetIndex(),E_ti_EndMacro);
|
|
}
|
|
break;
|
|
|
|
case eCreateRule:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lDepth=pclIntermediateCode->m_fn_ucGetDepth();
|
|
if(lDepth==1)
|
|
{
|
|
if(pos && pclIntermediateCodeList->GetAt(pos)->m_fn_tdeGetNodeType() == eEndMacro)
|
|
{
|
|
pclIntermediateCode=pclIntermediateCodeList->GetNext(pos);
|
|
M_ADDNODE(M_lValueInterpret,pclIntermediateCode->m_fn_lGetIndex(),E_ti_EndMacro);
|
|
}
|
|
|
|
if(bInScheduleSection)
|
|
{
|
|
//Add a dummy node
|
|
fn_vInitNodeInterpret(pstNode,0,E_ti_EndTree,0);
|
|
|
|
bInScheduleSection=FALSE;
|
|
}
|
|
|
|
if(bInITRulesSection)
|
|
{
|
|
//Add a dummy node
|
|
fn_vInitNodeInterpret(pstNode,0,E_ti_EndTree,0);
|
|
|
|
pstRule++;
|
|
|
|
bInITRulesSection=FALSE;
|
|
}
|
|
|
|
long lNbNodes=fn_lGetNbNodes(pclIntermediateCodeList,pos, FALSE);
|
|
|
|
if(lNbNodes!=0 && pstRule)
|
|
{
|
|
// allocate nodes
|
|
pstNode=fn_p_stAllocNodeInterpret(lNbNodes+1);
|
|
|
|
M_GetNodeInterpret(pstRule)=pstNode;
|
|
M_GetNbNodeInterpret(pstRule)=lNbNodes+1;
|
|
|
|
bInITRulesSection=TRUE;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
case eSubrRef:
|
|
if(autorise == 1) break;
|
|
{
|
|
/*
|
|
* yo! let's store the editor pointer in there, because parsing order may cause a subroutine to reference
|
|
* one that is not yet parsed, hence the engine info is not updated, hence it crashes! wqe have to store the
|
|
* editor pointer, and convert it into an engine pointer when we go into engine mode, and back into an editor
|
|
* pointer when we get back in editor mode
|
|
*/
|
|
CPA_EdIR_MainBehaviour * pclSubrMainBehaviour = ( CPA_EdIR_MainBehaviour * ) pclIntermediateCode -> m_fn_lGetIndex ( ) ;
|
|
M_ADDNODE ( M_p_stMacroInterpret , ( tdstMacro * ) pclSubrMainBehaviour , E_ti_MacroRef ) ;
|
|
/* don't forget to say that this subroutine is referenced, hence we cannot delete it until we ahev removed all the calls */
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclSubrMainBehaviour);
|
|
}
|
|
break;
|
|
|
|
case eCreateSubr:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lDepth = pclIntermediateCode -> m_fn_ucGetDepth ();
|
|
if( lDepth == 1)
|
|
{
|
|
long lNbNodes = fn_lGetNbNodes (pclIntermediateCodeList ,pos, FALSE);
|
|
|
|
if(lNbNodes >= 0)
|
|
{
|
|
// allocate nodes
|
|
fn_vAllocNodeMacro ((tdstMacro *) pstRule, (unsigned short) lNbNodes + 1);
|
|
|
|
//Gets first node of subr
|
|
pstNode=M_GetNodeInterpretN(((tdstMacro *) pstRule) -> p_stInitTree, 0);
|
|
|
|
// remind for subr refferences
|
|
pclMainBehaviour -> m_lInfo = (long) pstRule;
|
|
|
|
// and, of course, add the End node...
|
|
bInSubr = TRUE;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
|
|
case eCreateSchedule:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lNbNodes=fn_lGetNbNodes(pclIntermediateCodeList,pos, FALSE);
|
|
|
|
if(lNbNodes!=0)
|
|
{
|
|
// allocate schedule
|
|
pstSchedule=fn_p_stAllocSchedule(lNbNodes+1);
|
|
|
|
// connect schedule to comport
|
|
M_GetComportSchedule(pstComport)=pstSchedule;
|
|
M_GetNbNodeInterpret(pstSchedule)=lNbNodes+1;
|
|
|
|
//Gets first node of schedule
|
|
pstNode=M_GetNodeInterpretN(pstSchedule,0);
|
|
|
|
bInScheduleSection=TRUE;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eKeyWord:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lKeyWordIndex=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
M_ADDNODE(M_eKeyWordIdInterpret,(tdeKeyWordId)lKeyWordIndex,E_ti_KeyWord);
|
|
}
|
|
break;
|
|
|
|
case eCondition:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_eCondIdInterpret,(tdeCondId)pclIntermediateCode->m_fn_lGetIndex(),E_ti_Condition);
|
|
}
|
|
break;
|
|
|
|
case eMetaAction:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_eMetaActionIdInterpret,(tdeMetaActionId)pclIntermediateCode->m_fn_lGetIndex(),E_ti_MetaAction);
|
|
}
|
|
break;
|
|
|
|
case eProcedure:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_eProcedureIdInterpret,(tdeProcedureId)pclIntermediateCode->m_fn_lGetIndex(),E_ti_Procedure);
|
|
}
|
|
break;
|
|
|
|
case eField:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_eFieldIdInterpret,(tdeFieldId)pclIntermediateCode->m_fn_lGetIndex(),E_ti_Field);
|
|
}
|
|
break;
|
|
|
|
case eConstant:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_lValueInterpret,pclIntermediateCode->m_fn_lGetIndex(),E_ti_Constant);
|
|
}
|
|
break;
|
|
|
|
case eConstantInt:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_lValueInterpret,pclIntermediateCode->m_fn_lGetIndex(),E_ti_Constant);
|
|
}
|
|
break;
|
|
|
|
case eConstantReal:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_xValueInterpret,MTH_M_xDoubleToReal(pclIntermediateCode->m_fn_dfGetValue()),E_ti_Real);
|
|
}
|
|
break;
|
|
|
|
case eMyRfxBehaviour:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclRfxMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_ComportInterpret,(tdstComport *)pclRfxMainBehaviour,E_ti_ComportRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclRfxMainBehaviour);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclRfxMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
CString csFamilyName=g_pclCurrentModel->m_pub_fn_pclGetFamily()->GetName();
|
|
CString csModelName=g_pclCurrentModel->GetName();
|
|
CString csBehaviourName=pclRfxMainBehaviour->GetName();
|
|
|
|
csRef =
|
|
g_c_csComport+"("+
|
|
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRfxFileExtension+"^"+
|
|
g_c_csRfxSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eMyIABehaviour:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclIAMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_ComportInterpret,(tdstComport *)pclIAMainBehaviour,E_ti_ComportRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclIAMainBehaviour);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclIAMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
CString csFamilyName=g_pclCurrentModel->m_pub_fn_pclGetFamily()->GetName();
|
|
CString csModelName=g_pclCurrentModel->GetName();
|
|
CString csBehaviourName=pclIAMainBehaviour->GetName();
|
|
|
|
csRef =
|
|
g_c_csComport+"("+
|
|
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRulFileExtension+"^"+
|
|
g_c_csRulSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eRfxBehaviour:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclRfxMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_ComportInterpret,(tdstComport *)pclRfxMainBehaviour,E_ti_ComportRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclRfxMainBehaviour);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclRfxMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
CString csFamilyName=fn_csGetFamilyName(pclRfxMainBehaviour);
|
|
CString csModelName=fn_csGetModelName(pclRfxMainBehaviour);
|
|
CString csBehaviourName=pclRfxMainBehaviour->GetName();
|
|
|
|
csRef =
|
|
g_c_csComport+"("+
|
|
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRfxFileExtension+"^"+
|
|
g_c_csRulSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eIABehaviour:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclIAMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_ComportInterpret,(tdstComport *)pclIAMainBehaviour,E_ti_ComportRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclIAMainBehaviour);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclIAMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
CString csFamilyName=fn_csGetFamilyName(pclIAMainBehaviour);
|
|
CString csModelName=fn_csGetModelName(pclIAMainBehaviour);
|
|
CString csBehaviourName=pclIAMainBehaviour->GetName();
|
|
|
|
csRef =
|
|
g_c_csComport+"("+
|
|
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRulFileExtension+"^"+
|
|
g_c_csRulSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eOperator:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_eOperatorIdInterpret,(tdeOperatorId)pclIntermediateCode->m_fn_lGetIndex(),E_ti_Operator);
|
|
}
|
|
break;
|
|
|
|
case eFunction:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_eFuncIdInterpret,(tdeFuncId)pclIntermediateCode->m_fn_lGetIndex(),E_ti_Function);
|
|
}
|
|
break;
|
|
|
|
case eDsgVar:
|
|
{
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_lValueInterpret,pclIntermediateCode->m_fn_lGetIndex(),E_ti_DsgVarRef);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
CPA_Actor *pclModel=pclIntermediateCode->m_fn_pclGetModel();
|
|
CString csFamilyName=fn_csGetFamilyName(pclModel);
|
|
CString csModelName=fn_csGetModelName(pclModel);
|
|
CString csDsgVarRef=csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIDecFileExtension+"^"+C_CreateVariables_String+":";
|
|
CString csDsgVarName=pclIntermediateCode->m_fn_csGetString();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
if(pclModel != g_pclCurrentModel)
|
|
{
|
|
csRef =
|
|
g_c_csDsgVarRef+"("+
|
|
csDsgVarRef+csDsgVarName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case ePerso:
|
|
{
|
|
long lPersoHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lPersoHandle,C_szActorInstanceTypeName);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_p_stPersoRefInterpret,(tdstEngineObject *)lPersoHandle,E_ti_PersoRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,g_pclCurrentModel,pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szActorInstanceTypeName);
|
|
CString csPersoRef=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csPerso+"("+
|
|
csPersoRef
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eReal:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_xValueInterpret,MTH_M_xDoubleToReal(pclIntermediateCode->m_fn_dfGetValue()),E_ti_Real);
|
|
}
|
|
break;
|
|
|
|
case eZdd:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lZddHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
M_ADDNODE(M_lValueInterpret,lZddHandle,E_ti_Constant);
|
|
|
|
//fn_vAddOneDependency(pclMainBehaviour,pclObject);
|
|
}
|
|
break;
|
|
|
|
case eZde:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lZdeHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
M_ADDNODE(M_lValueInterpret,lZdeHandle,E_ti_Constant);
|
|
|
|
//fn_vAddOneDependency(pclMainBehaviour,pclObject);
|
|
}
|
|
break;
|
|
|
|
case eZdm:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lZdmHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
M_ADDNODE(M_lValueInterpret,lZdmHandle,E_ti_Constant);
|
|
|
|
//fn_vAddOneDependency(pclMainBehaviour,pclObject);
|
|
}
|
|
break;
|
|
|
|
case eZdr:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lZdrHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
M_ADDNODE(M_lValueInterpret,lZdrHandle,E_ti_Constant);
|
|
|
|
//fn_vAddOneDependency(pclMainBehaviour,pclObject);
|
|
}
|
|
break;
|
|
|
|
case eVector:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_lValueInterpret,0L,E_ti_Vector);
|
|
}
|
|
break;
|
|
|
|
case eAction:
|
|
{
|
|
long lStateHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_State *pclState=(CPA_State *)fn_pclGetReachableObject(lStateHandle,C_szStateTypeName);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_ActionInterpret,(tdxHandleToState)lStateHandle,E_ti_ActionRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,g_pclCurrentModel,pclState->mfn_p_oGetAction());
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szStateTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csAction+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eState:
|
|
{
|
|
long lStateHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_State *pclState=(CPA_State *)fn_pclGetReachableObject(lStateHandle,C_szStateTypeName);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
//M_ADDNODE(M_ActionInterpret,(tdxHandleToState)lStateHandle,E_ti_ActionRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,g_pclCurrentModel,pclState);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szStateTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csState+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eWayPoint:
|
|
{
|
|
long lWayPointHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lWayPointHandle,C_SectionWayPointDescription);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_lWayPointInterpret,(struct WP_tdstWayPoint_ *)lWayPointHandle,E_ti_WayPointRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szWayPointTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csWayPoint+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eModule:
|
|
{
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_lModuleInterpret,pclIntermediateCode->m_fn_lGetIndex(),E_ti_Module);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
CString csModule=pclIntermediateCode->m_fn_csGetValue();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csModule+"("+
|
|
csModule
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eSector:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lSectorHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lSectorHandle);
|
|
|
|
M_ADDNODE(M_SuperObjectInterpret,(HIE_tdxHandleToSuperObject)lSectorHandle,E_ti_SuperObjectRef);
|
|
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
break;
|
|
|
|
case eSuperObject:
|
|
{
|
|
long lSuperObjectHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lSuperObjectHandle);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_SuperObjectInterpret,(HIE_tdxHandleToSuperObject)lSuperObjectHandle,E_ti_SuperObjectRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csSuperObject+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eLipSynchro:
|
|
{
|
|
long lLipSynchroHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lLipSynchroHandle,C_szLipSyncTypeName);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_hLipSynchroHandleIdInterpret,(tdxHandleOfLipsSynchroTable)lLipSynchroHandle,E_ti_LipsSynchroRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szLipSyncTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csLipSynchro+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eObjectTable:
|
|
{
|
|
long lObjectTableHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lObjectTableHandle,C_szObjectTableTypeName);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_ObjectTableInterpret,(tdxHandleToObjectsTablesList)lObjectTableHandle,E_ti_ObjectTableRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szObjectTableTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csObjectTable+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eFamily:
|
|
{
|
|
long lFamilyHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lFamilyHandle,C_szFamilyTypeName);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_hFamilyHandleIdInterpret,(tdxHandleToFamilyList)lFamilyHandle,E_ti_FamilyRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szFamilyTypeName);
|
|
CString csReferencedSectionName=pclObject->GetName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csFamily+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eModel:
|
|
{
|
|
CPA_Actor *pclModel=(CPA_Actor *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_p_stModelInterpret,(AI_tdstAIModel *)pclModel,E_ti_ModelRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclModel);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
CPA_Actor *pclModel=(CPA_Actor *)pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csFamilyName=fn_csGetFamilyName(pclModel);
|
|
CString csModelName=fn_csGetModelName(pclModel);
|
|
CString csModelRef=csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIFileExtension+"^"+C_CreateAIModel_String;
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csModel+"("+
|
|
csModelRef
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eSoundEvent:
|
|
if(autorise == 0) {
|
|
long lSoundEventHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lSoundEventHandle,C_szSoundEventTypeName);
|
|
|
|
M_ADDNODE(M_SoundEventInterpret,(SND_tdstBlockEvent *)lSoundEventHandle,E_ti_SoundEventRef);
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//A CHANGER
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
//In order to warn Sound Dll about a new link between IA and snd event
|
|
SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csReferencedSectionName),SCR_CDF_uw_Anl_Normal);
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
else {
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szSoundEventTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef = g_c_csSoundEvent + "(" + csReferencedSectionName + "," ;
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise, csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
break;
|
|
|
|
case eGameMaterial:
|
|
{
|
|
long lGameMaterialHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lGameMaterialHandle,C_szGameMaterialTypeName);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_GameMaterialInterpret,(GMT_tdxHandleToGameMaterial)lGameMaterialHandle,E_ti_GameMaterialRef);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szGameMaterialTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csGameMaterial+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eLight:
|
|
{
|
|
long lLightHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lLightHandle,C_szLightTypeName);
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_p_stLightInterpret,(GLI_tdxHandleToLight)lLightHandle,E_ti_Light);
|
|
fn_vAddOneDependency(pclMainBehaviour,pclMainBehaviour,pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szLightTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csLight+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eCaps:
|
|
if(autorise == 1) break;
|
|
{
|
|
long lCaps=pclIntermediateCode->m_fn_lGetIndex();
|
|
M_ADDNODE(M_ulCapsInterpret,(unsigned long)lCaps,E_ti_Caps);
|
|
|
|
//CPA_SaveObject *pclObject=fn_pclGetReachableObject(lCaps, C_szCapsTypeName);
|
|
//fn_vAddOneDependency(pclMainBehaviour, pclMainBehaviour, pclObject);
|
|
}
|
|
break;
|
|
case eGraph:
|
|
{
|
|
long lGraphHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_p_stGraphInterpret,(WP_tdHandleOfGraph)lGraphHandle,E_ti_Graph);
|
|
//CPA_SaveObject *pclObject=fn_pclGetReachableObject(lGraphHandle, C_szGraphTypeName);
|
|
//fn_vAddOneDependency(pclMainBehaviour, pclMainBehaviour, pclObject);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
CString csGraph;
|
|
if (pclIntermediateCode->m_fn_tdeGetNodeType() == eKeyWord)
|
|
{
|
|
csGraph = szFindKeyWordScriptNameFromId(eKeyWord_NoGraph); // "NoGraph" ? ? ?
|
|
}
|
|
else
|
|
{
|
|
WP_tdHandleOfGraph lGraphHandle = (WP_tdHandleOfGraph) pclIntermediateCode->m_fn_lGetIndex();
|
|
if (lGraphHandle != NULL)
|
|
csGraph = lGraphHandle->m_szNameOfGraph;
|
|
else
|
|
csGraph = szFindKeyWordScriptNameFromId(eKeyWord_NoGraph); // "NoGraph" ? ? ?
|
|
}
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csGraph+"("+
|
|
csGraph
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eKeyButton:
|
|
{
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_hInputHandleIdInterpret,(IPT_tdxHandleToEntryElement)pclIntermediateCode->m_fn_lGetIndex(),E_ti_Button);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lButton=pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csButton=IPT_fn_szGetEntryActionName(IPT_tdxHandleToEntryElement(lButton));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csKeyButton+"("+
|
|
csButton
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eMaskType:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_xMaskInterpret,(unsigned short)pclIntermediateCode->m_fn_lGetIndex(),E_ti_Mask);
|
|
}
|
|
break;
|
|
|
|
case ePower:
|
|
if(autorise == 1) break;
|
|
{
|
|
M_ADDNODE(M_lValueInterpret,pclIntermediateCode->m_fn_lGetIndex(),E_ti_Constant);
|
|
}
|
|
break;
|
|
|
|
case eString:
|
|
if(autorise == 1) break;
|
|
{
|
|
char *pcString=M_MAKECHAR(pclIntermediateCode->m_fn_csGetString());
|
|
|
|
//Init Node
|
|
M_ClearNodeInterpret(pstNode);
|
|
fn_vCreateNodeString(pstNode,pcString);
|
|
//free(pcString);
|
|
M_DepthInterpret(pstNode)=pclIntermediateCode->m_fn_ucGetDepth();
|
|
pclDebugInfoList->AddTail(new CPA_EdIR_DebugInfo(pstNode,0L,0L,pclIntermediateCode->m_fn_lGetOffset(),csBehaviourName));
|
|
pstNode++;
|
|
}
|
|
break;
|
|
|
|
case eText:
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_TextInterpret, (FON_tdxHandleOfText) pclIntermediateCode->m_fn_lGetIndex(),E_ti_TextRef);
|
|
}
|
|
if(autorise == 1)
|
|
{
|
|
long lText=pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csText=FON_fn_szGetNameOfTextHandle((FON_tdxHandleOfText)lText);
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csTextRef+"("+
|
|
csText
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise, csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
break;
|
|
|
|
case eParticleGenerator:
|
|
{
|
|
if(autorise == 0)
|
|
{
|
|
M_ADDNODE(M_ParticleGeneratorInterpret,(tdxHandleToParticleGenerator)pclIntermediateCode->m_fn_lGetIndex(),E_ti_ParticleGenerator);
|
|
}
|
|
|
|
if(autorise == 1)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szPartGenGeneratorName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
csRef =
|
|
g_c_csParticleGenerator+"("+
|
|
csReferencedSectionName
|
|
+",";
|
|
CRR_fprintf(gh_CRRFile, (LPCSTR) csRef, autorise,csDepth, pclIntermediateCode->pstRefNode);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eCreateDsgVar:
|
|
{
|
|
if(bCreateControl)
|
|
{
|
|
//Gets type info
|
|
tdeDsgVarTypeId eDsgVarTypeId=tdeDsgVarTypeId(pclIntermediateCode->m_fn_lGetIndex());
|
|
CString csDsgVarType=szFindDsgVarTypeScriptNameFromId(eDsgVarTypeId);
|
|
CString csDepth=(char)pclIntermediateCode->m_fn_ucGetDepth();
|
|
|
|
//Gets name
|
|
pclIntermediateCode=pclIntermediateCodeList->GetNext(pos);
|
|
CString csDsgVarName=pclIntermediateCode->m_fn_csGetString();
|
|
|
|
//Gets initial value
|
|
pclIntermediateCode=pclIntermediateCodeList->GetNext(pos);
|
|
|
|
//Adds one dsg var in engine structure (for model)
|
|
long lIndexOfDsgVar=g_clDsgVarList.m_fn_lGetIndexOfADesignerVariable(csDsgVarName);
|
|
//A CHANGER mauvaise interface !!!
|
|
// au lieu de szParams mettre la valeur intiale (sous forme de chaine)
|
|
CString csFirstValue;
|
|
CString csSecondValue;
|
|
CString csThirdValue;
|
|
char *szParams[5]={NULL,NULL,NULL,NULL,NULL};
|
|
if((eDsgVarTypeId==eDsgVarType_Perso) ||
|
|
(eDsgVarTypeId==eDsgVarType_WayPoint) ||
|
|
(eDsgVarTypeId==eDsgVarType_Action))
|
|
{
|
|
if((pclIntermediateCode->m_fn_lGetIndex()!=eKeyWord_Nobody) &&
|
|
(pclIntermediateCode->m_fn_lGetIndex()!=eKeyWord_Nowhere) &&
|
|
(pclIntermediateCode->m_fn_lGetIndex()!=eKeyWord_NoAction))
|
|
{
|
|
CString csType;
|
|
switch(eDsgVarTypeId)
|
|
{
|
|
case eDsgVarType_Perso:
|
|
csType=C_szActorInstanceTypeName;
|
|
break;
|
|
|
|
case eDsgVarType_WayPoint:
|
|
csType=C_szWayPointTypeName;
|
|
break;
|
|
|
|
case eDsgVarType_Action:
|
|
csType=C_szStateTypeName;
|
|
break;
|
|
|
|
default:
|
|
csType="";
|
|
}
|
|
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,csType);
|
|
csFirstValue=pclObject->GetReferencedSectionName();
|
|
|
|
szParams[2]=(char *)LPCTSTR(csFirstValue);
|
|
}
|
|
//else
|
|
//{
|
|
// szParams[2]=NULL;
|
|
//}
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_SuperObject)
|
|
{
|
|
if(pclIntermediateCode->m_fn_lGetIndex()!=eKeyWord_NoSuperObject)
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szSuperObjectTypeName);
|
|
csFirstValue=pclObject->GetReferencedSectionName();
|
|
|
|
szParams[2]=(char *)LPCTSTR(csFirstValue);
|
|
}
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_Vector)
|
|
{
|
|
MTH3D_tdstVector tdstVector=pclIntermediateCode->m_fn_tdstGetVector();
|
|
|
|
//Gets X value
|
|
csFirstValue.Format("%f",MTH3D_M_xGetXofVector(&tdstVector));
|
|
szParams[2]=(char *)LPCTSTR(csFirstValue);
|
|
|
|
//Gets Y value
|
|
csSecondValue.Format("%f",MTH3D_M_xGetYofVector(&tdstVector));
|
|
szParams[3]=(char *)LPCTSTR(csSecondValue);
|
|
|
|
//Gets Z value
|
|
csThirdValue.Format("%f",MTH3D_M_xGetZofVector(&tdstVector));
|
|
szParams[4]=(char *)LPCTSTR(csThirdValue);
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_Float)
|
|
{
|
|
csFirstValue.Format("%f",pclIntermediateCode->m_fn_dfGetValue());
|
|
szParams[2]=(char *)LPCTSTR(csFirstValue);
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_Caps)
|
|
{
|
|
if ( pclIntermediateCode->m_fn_tdeGetNodeType() == eKeyWord)
|
|
{
|
|
if (pclIntermediateCode->m_fn_lGetIndex() != eKeyWord_CapsNull) // !
|
|
{
|
|
// error !
|
|
szParams[2] = szParams[2]; // to test !
|
|
}
|
|
// szParams[2]=NULL;
|
|
szParams[2] = szParams[2]; // to test !
|
|
}
|
|
else
|
|
{
|
|
char sz255Temp[255];
|
|
ltoa( pclIntermediateCode->m_fn_lGetIndex(), sz255Temp, 2);
|
|
csFirstValue = sz255Temp;
|
|
|
|
szParams[2]=(char *)LPCTSTR(csFirstValue);
|
|
}
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_Graph)
|
|
{
|
|
if ( pclIntermediateCode->m_fn_tdeGetNodeType() == eKeyWord)
|
|
{
|
|
if (pclIntermediateCode->m_fn_lGetIndex() != eKeyWord_NoGraph) // !
|
|
{
|
|
// error !
|
|
szParams[2] = szParams[2]; // to test !
|
|
}
|
|
// szParams[2]=NULL;
|
|
szParams[2] = szParams[2]; // to test !
|
|
}
|
|
else
|
|
{
|
|
WP_tdHandleOfGraph lHandle = (WP_tdHandleOfGraph) pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csReferencedSectionName;
|
|
if(lHandle!=NULL)
|
|
{
|
|
csFirstValue = lHandle->m_szNameOfGraph;
|
|
}
|
|
else
|
|
csFirstValue = szFindKeyWordScriptNameFromId(eKeyWord_NoGraph);
|
|
|
|
szParams[2]=(char *)LPCTSTR(csFirstValue);
|
|
}
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_Text)
|
|
{
|
|
csFirstValue = pclIntermediateCode->m_fn_csGetString();
|
|
szParams[2] = (char *)LPCTSTR(csFirstValue);
|
|
}
|
|
else
|
|
{
|
|
csFirstValue.Format("%ld",pclIntermediateCode->m_fn_lGetIndex());
|
|
szParams[2]=(char *)LPCTSTR(csFirstValue);
|
|
}
|
|
|
|
M_GetDsgVarOffset(pstMind,lCurrentDsgVar)=ulNextOffset;
|
|
|
|
M_SetDsgVarName(pstMind,lCurrentDsgVar,M_MAKECHAR(csDsgVarName));
|
|
|
|
fn_vInitDsgVarDefault(pstMind,(unsigned char)lIndexOfDsgVar,eDsgVarTypeId,szParams);
|
|
|
|
ulNextOffset+=fn_ulSizeOfDsgVar(eDsgVarTypeId,(szParams[2]!=NULL)?((unsigned char) atoi(szParams[2])):0);
|
|
|
|
lCurrentDsgVar++;
|
|
|
|
//Creates or updates one control for this dsr var
|
|
if((pclMainBehaviour->m_pclBehaviour->m_fn_bIntermediateCodeListIsGood()==FALSE) ||
|
|
(bProcessAll==TRUE))
|
|
{
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
BOOL bIsPrivate = g_clDsgVarList . m_fn_bIsPrivateDesignerVariable (csDsgVarName);
|
|
fn_vCreateDsgVarControl(csDsgVarType,csDsgVarName,lIndexOfDsgVar,bIsPrivate, FALSE);
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
}
|
|
else
|
|
{
|
|
fn_vUpdateDsgVarControl(csDsgVarType,csDsgVarName,lIndexOfDsgVar);
|
|
}
|
|
}
|
|
else
|
|
if(pstMind==NULL)
|
|
{
|
|
//Do nothing
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("Non Reachable Code !!!");
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
break;
|
|
|
|
default:
|
|
{
|
|
AfxMessageBox("Default code in EdIR2Eng.c/ProcessIA !!");
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
}
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
if(autorise == 0){
|
|
if(bInScheduleSection || bInITRulesSection || bInSubr)
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
{
|
|
//Add a dummy node
|
|
fn_vInitNodeInterpret(pstNode,0,E_ti_EndTree,0);
|
|
}
|
|
pclMainBehaviour->m_pclBehaviour->m_fn_vSetIntermediateCodeList(TRUE);}
|
|
}
|
|
else if(autorise == 0){
|
|
pclMainBehaviour->m_pclBehaviour->m_fn_vSetIntermediateCodeList(FALSE);}
|
|
|
|
// BEGIN ROMTEAM Cristi Petrescu 98-08-
|
|
if (eTypeText == IntelligenceText || eTypeText == ReflexText)
|
|
//bRes && ((eTypeText==DsgVarText)||(eTypeText==MacroText)||(eTypeText == Macro_2_Text)||(eTypeText == CRRGeneration)))
|
|
fn_vPostProcessIA (csOut, csIn, pclDebugInfoList, bRes, lIndexError);
|
|
// END ROMTEAM Cristi Petrescu 98-08-
|
|
|
|
return bRes;
|
|
}
|
|
|
|
/*************************************************************************/
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
BOOL fn_bSaveIA(SCR_tdst_File_Description *p_tdstFile,AI_tdstMind *pstMind,
|
|
tdeTypeText eTypeText,CString csIn,long &lIndexError,
|
|
CString csInfo, CString csBehaviourName)
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
{
|
|
char autorise = 1;
|
|
CString csRef;
|
|
|
|
if(eTypeText != CRRGeneration)
|
|
{
|
|
autorise = 0;
|
|
}
|
|
|
|
if(eTypeText==DsgVarText)
|
|
{
|
|
g_clDsgVarList.m_fn_vDestroyAndRemoveAllEntries();
|
|
}
|
|
|
|
if(eTypeText==MacroText)
|
|
{
|
|
g_clMacroList.m_fn_vDestroyAndRemoveAllEntries();
|
|
}
|
|
|
|
CString csOut=fn_csExpandMacro(csIn);
|
|
//ANNECY CB
|
|
// csOut.MakeLower();
|
|
//END
|
|
|
|
CPA_EdIR_IntermediateCodeList clIntermediateCodeList;
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-05-
|
|
BOOL bRes=fn_bAnalysesText(csOut,eTypeText,lIndexError,&clIntermediateCodeList, csBehaviourName);
|
|
//END ROMTEAM Cristi Petrescu 98-05-
|
|
|
|
if(bRes)
|
|
{
|
|
long lOldIndentationLevel=SCR_g_ui_SvL0_IndentationLevel;
|
|
long lCurrentRules=1;
|
|
long lCurrentDsgVar=0;
|
|
BOOL bInScheduleSection=FALSE;
|
|
BOOL bInITRulesSection=FALSE;
|
|
POSITION pos=clIntermediateCodeList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_EdIR_IntermediateCode *pclIntermediateCode=clIntermediateCodeList.GetNext(pos);
|
|
|
|
switch(pclIntermediateCode->m_fn_tdeGetNodeType())
|
|
{
|
|
case eBeginMacro:
|
|
case eEndMacro:
|
|
//these 2 nodes may exist but do not need to be saved
|
|
break;
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
case eSubrRef:
|
|
{
|
|
CString csDepth = fn_csLongToString (pclIntermediateCode -> m_fn_ucGetDepth ());
|
|
|
|
CPA_EdIR_MainBehaviour *pclMainBehaviour = (CPA_EdIR_MainBehaviour *) pclIntermediateCode -> m_fn_lGetIndex ();
|
|
CString csFamilyName = fn_csGetFamilyName (pclMainBehaviour);
|
|
CString csModelName = fn_csGetModelName (pclMainBehaviour);
|
|
CString csSubr = pclMainBehaviour -> GetName ();
|
|
|
|
M_SAVEENTRY2PARMS (g_c_csSubrRef,
|
|
csFamilyName + "\\" +
|
|
csModelName + "\\" +
|
|
csModelName + g_c_csAISubrFileExtension + "^" +
|
|
g_c_csEngSubrSectionName + "^" +
|
|
g_c_csCreateSubr + ":" +
|
|
csSubr,
|
|
csDepth);
|
|
}
|
|
break;
|
|
case eCreateSubr:
|
|
{
|
|
long lDepth=pclIntermediateCode->m_fn_ucGetDepth();
|
|
if(lDepth==1)
|
|
{
|
|
// really need this? CP
|
|
//SCRIPT_vSaveEndSection(p_tdstFile);
|
|
|
|
long lNbNodes=fn_lGetNbNodes(&(clIntermediateCodeList),pos, TRUE);
|
|
|
|
CString csSubrName;
|
|
int dPos = csInfo . Find (" ");
|
|
csSubrName = csInfo . Left (dPos);
|
|
csInfo = csInfo . Right (csInfo . GetLength () - dPos - 1);
|
|
|
|
if(lNbNodes!=0)
|
|
{
|
|
M_SAVEBEGINSECTION(g_c_csCreateSubr+":"+csSubrName,
|
|
csInfo,
|
|
fn_csLongToString(lNbNodes));
|
|
|
|
lCurrentRules++;
|
|
bInITRulesSection=TRUE;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
|
|
case eCreateSchedule:
|
|
{
|
|
long lNbNodes=fn_lGetNbNodes(&(clIntermediateCodeList),pos, TRUE);
|
|
|
|
if(lNbNodes!=0)
|
|
{
|
|
M_SAVEBEGINSECTION(g_c_csCreateSchedule+":",
|
|
"1",//there is only one schedule
|
|
fn_csLongToString(lNbNodes));
|
|
|
|
bInScheduleSection=TRUE;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eCreateRule:
|
|
{
|
|
long lDepth=pclIntermediateCode->m_fn_ucGetDepth();
|
|
if(lDepth==1)
|
|
{
|
|
if(bInScheduleSection)
|
|
{
|
|
SCRIPT_vSaveEndSection(p_tdstFile);
|
|
|
|
bInScheduleSection=FALSE;
|
|
}
|
|
|
|
if(bInITRulesSection)
|
|
{
|
|
SCRIPT_vSaveEndSection(p_tdstFile);
|
|
|
|
bInITRulesSection=FALSE;
|
|
}
|
|
|
|
long lNbNodes=fn_lGetNbNodes(&(clIntermediateCodeList),pos, TRUE);
|
|
|
|
if(lNbNodes!=0)
|
|
{
|
|
M_SAVEBEGINSECTION(g_c_csCreateRule+":",
|
|
fn_csLongToString(lCurrentRules),
|
|
fn_csLongToString(lNbNodes));
|
|
|
|
lCurrentRules++;
|
|
bInITRulesSection=TRUE;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case eKeyWord:
|
|
{
|
|
long lKeyWordIndex=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csKeyWord=szFindKeyWordScriptNameFromId(tdeKeyWordId(lKeyWordIndex));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csKeyWord,csKeyWord,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eCondition:
|
|
{
|
|
long lConditionId=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csCondition=szFindConditionScriptNameFromId(tdeCondId(lConditionId));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csCondition,csCondition,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eMetaAction:
|
|
{
|
|
long lMetaActionId=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csMetaAction=szFindMetaActionScriptNameFromId(tdeMetaActionId(lMetaActionId));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csMetaAction,csMetaAction,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eProcedure:
|
|
{
|
|
long lProcedureId=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csProcedure=szFindProcedureScriptNameFromId(tdeProcedureId(lProcedureId));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csProcedure,csProcedure,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eField:
|
|
{
|
|
long lFieldId=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csField=szFindFieldScriptNameFromId(tdeFieldId(lFieldId));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csField,csField,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eConstant:
|
|
{
|
|
CString csConstant=pclIntermediateCode->m_fn_csGetValue();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csConstant,csConstant,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eConstantInt:
|
|
{
|
|
CString csConstantIntName=pclIntermediateCode->m_fn_csGetString();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
CString csConstantIntRef=g_c_csAIDefineFileName+"^"+g_c_csAIDefineSectionName+":"+csConstantIntName;
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csConstantRef,csConstantIntRef,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eConstantReal:
|
|
{
|
|
CString csConstantRealName=pclIntermediateCode->m_fn_csGetString();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
CString csConstantRealRef=g_c_csAIDefineFileName+"^"+g_c_csAIDefineSectionName+":"+csConstantRealName;
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csRealRef,csConstantRealRef,csDepth);
|
|
}
|
|
break;
|
|
|
|
|
|
case eMyRfxBehaviour:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclRfxMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
CString csFamilyName=g_pclCurrentModel->m_pub_fn_pclGetFamily()->GetName();
|
|
CString csModelName=g_pclCurrentModel->GetName();
|
|
|
|
CString csBehaviourName=pclRfxMainBehaviour->GetName();
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csComport,
|
|
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRfxFileExtension+"^"+
|
|
g_c_csRfxSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName,
|
|
csDepth);
|
|
}
|
|
break;
|
|
|
|
case eMyIABehaviour:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclIAMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
CString csFamilyName=g_pclCurrentModel->m_pub_fn_pclGetFamily()->GetName();
|
|
CString csModelName=g_pclCurrentModel->GetName();
|
|
|
|
CString csBehaviourName=pclIAMainBehaviour->GetName();
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csComport,
|
|
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRulFileExtension+"^"+
|
|
g_c_csRulSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName,
|
|
csDepth);
|
|
}
|
|
break;
|
|
|
|
case eRfxBehaviour:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclRfxMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
CString csFamilyName=fn_csGetFamilyName(pclRfxMainBehaviour);
|
|
CString csModelName=fn_csGetModelName(pclRfxMainBehaviour);
|
|
|
|
CString csBehaviourName=pclRfxMainBehaviour->GetName();
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csComport,
|
|
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRfxFileExtension+"^"+
|
|
g_c_csRulSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName,
|
|
csDepth);
|
|
}
|
|
break;
|
|
|
|
case eIABehaviour:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclIAMainBehaviour=(CPA_EdIR_MainBehaviour *)pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
CString csFamilyName=fn_csGetFamilyName(pclIAMainBehaviour);
|
|
CString csModelName=fn_csGetModelName(pclIAMainBehaviour);
|
|
|
|
CString csBehaviourName=pclIAMainBehaviour->GetName();
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csComport,
|
|
csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRulFileExtension+"^"+
|
|
g_c_csRulSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName,
|
|
csDepth);
|
|
}
|
|
break;
|
|
|
|
case eOperator:
|
|
{
|
|
long lOperatorId=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csOperator=szFindOperatorScriptNameFromId(tdeOperatorId(lOperatorId));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csOperator,csOperator,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eFunction:
|
|
{
|
|
long lFunctionId=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csFunction=szFindFunctionScriptNameFromId(tdeFuncId(lFunctionId));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csFunction,csFunction,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eDsgVar:
|
|
{
|
|
CString csDsgVar=pclIntermediateCode->m_fn_csGetValue();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
CPA_Actor *pclModel=pclIntermediateCode->m_fn_pclGetModel();
|
|
CString csFamilyName=fn_csGetFamilyName(pclModel);
|
|
CString csModelName=fn_csGetModelName(pclModel);
|
|
CString csDsgVarRef=csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIDecFileExtension+"^"+C_CreateVariables_String+":";
|
|
CString csDsgVarName=pclIntermediateCode->m_fn_csGetString();
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csDsgVarRef,csDsgVarRef+csDsgVarName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case ePerso:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szActorInstanceTypeName);
|
|
CString csPersoRef=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csPerso,csPersoRef,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eReal:
|
|
{
|
|
CString csReal=pclIntermediateCode->m_fn_csGetValue();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csReal,csReal,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eZdd:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csZdd=fn_csLongToString(lHandle);
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csConstant,csZdd,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eZde:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csZde=fn_csLongToString(lHandle);
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csConstant,csZde,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eZdm:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csZdm=fn_csLongToString(lHandle);
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csConstant,csZdm,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eZdr:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csZdr=fn_csLongToString(lHandle);
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csConstant,csZdr,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eVector:
|
|
{
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csVector,CString("Unused"),csDepth);
|
|
}
|
|
break;
|
|
|
|
case eAction:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szStateTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csAction,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eState:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szStateTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csState,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eWayPoint:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szWayPointTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csWayPoint,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eSector:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csSector,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eSuperObject:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csSuperObject,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eLipSynchro:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szLipSyncTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csLipSynchro,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eObjectTable:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szObjectTableTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csObjectTable,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eFamily:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szFamilyTypeName);
|
|
CString csReferencedSectionName=pclObject->GetName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csFamily,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eModel:
|
|
{
|
|
CPA_Actor *pclModel=(CPA_Actor *)pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csFamilyName=fn_csGetFamilyName(pclModel);
|
|
CString csModelName=fn_csGetModelName(pclModel);
|
|
CString csModelRef=csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIFileExtension+"^"+C_CreateAIModel_String;
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csModel,csModelRef,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eSoundEvent:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szSoundEventTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csSoundEvent,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eGameMaterial:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szGameMaterialTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csGameMaterial,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eLight:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szLightTypeName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csLight,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eCaps:
|
|
{
|
|
CString csCaps; //=pclIntermediateCode->m_fn_csGetValue();
|
|
if ( pclIntermediateCode->m_fn_tdeGetNodeType() == eKeyWord)
|
|
{
|
|
csCaps = szFindKeyWordScriptNameFromId(eKeyWord_CapsNull); // "CapaNull" ? ? ?
|
|
}
|
|
else
|
|
{
|
|
long lCaps = pclIntermediateCode->m_fn_lGetIndex();
|
|
char sz255Temp[255];
|
|
ltoa( lCaps, sz255Temp, 2);
|
|
csCaps = sz255Temp;
|
|
}
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csCaps, csCaps, csDepth);
|
|
}
|
|
break;
|
|
|
|
case eGraph:
|
|
{
|
|
CString csGraph; //=pclIntermediateCode->m_fn_csGetValue();
|
|
if (pclIntermediateCode->m_fn_tdeGetNodeType() == eKeyWord)
|
|
{
|
|
csGraph = szFindKeyWordScriptNameFromId(eKeyWord_NoGraph); // "NoGraph" ? ? ?
|
|
}
|
|
else
|
|
{
|
|
WP_tdHandleOfGraph lGraphHandle = (WP_tdHandleOfGraph) pclIntermediateCode->m_fn_lGetIndex();
|
|
if (lGraphHandle != NULL)
|
|
csGraph = lGraphHandle->m_szNameOfGraph;
|
|
else
|
|
csGraph = szFindKeyWordScriptNameFromId(eKeyWord_NoGraph); // "NoGraph" ? ? ?
|
|
}
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csGraph, csGraph, csDepth);
|
|
}
|
|
break;
|
|
|
|
case eModule:
|
|
{
|
|
CString csModule=pclIntermediateCode->m_fn_csGetValue();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csModule,csModule,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eKeyButton:
|
|
{
|
|
long lButton=pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csButton=IPT_fn_szGetEntryActionName(IPT_tdxHandleToEntryElement(lButton));
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csKeyButton,csButton,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eMaskType:
|
|
{
|
|
CString csMask=pclIntermediateCode->m_fn_csGetValue();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csMaskType,csMask,csDepth);
|
|
}
|
|
break;
|
|
|
|
case ePower:
|
|
{
|
|
CString csConstant=pclIntermediateCode->m_fn_csGetValue();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csPower,csConstant,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eString:
|
|
{
|
|
CString csString=pclIntermediateCode->m_fn_csGetString();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csString,csString,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eText:
|
|
{
|
|
FON_tdxHandleOfText hText = (FON_tdxHandleOfText) pclIntermediateCode->m_fn_lGetIndex();
|
|
|
|
CString csText = FON_fn_szGetNameOfTextHandle(hText);
|
|
CString csDepth = fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csTextRef,csText,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eParticleGenerator:
|
|
{
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,C_szPartGenGeneratorName);
|
|
CString csReferencedSectionName=pclObject->GetReferencedSectionName();
|
|
CString csDepth=fn_csLongToString(pclIntermediateCode->m_fn_ucGetDepth());
|
|
|
|
M_SAVEENTRY2PARMS(g_c_csParticleGenerator,csReferencedSectionName,csDepth);
|
|
}
|
|
break;
|
|
|
|
case eCreateDsgVar:
|
|
{
|
|
//Gets type info
|
|
tdeDsgVarTypeId eDsgVarTypeId=tdeDsgVarTypeId(pclIntermediateCode->m_fn_lGetIndex());
|
|
tdeVariableType eVariableType=fn_GetDsgVarType(eDsgVarTypeId);
|
|
CString csDsgVarType=szFindDsgVarTypeScriptNameFromId(eDsgVarTypeId);
|
|
CString csDepth=(char)pclIntermediateCode->m_fn_ucGetDepth();
|
|
|
|
//Gets name
|
|
pclIntermediateCode=clIntermediateCodeList.GetNext(pos);
|
|
CString csDsgVarName=pclIntermediateCode->m_fn_csGetString();
|
|
|
|
//Gets initial value
|
|
pclIntermediateCode=clIntermediateCodeList.GetNext(pos);
|
|
|
|
//For Array (get init value from ai engine)
|
|
if(eVariableType==E_vt_Array)
|
|
{
|
|
//Saves Declaration
|
|
long lEditorNbElt=pclIntermediateCode->m_fn_lGetIndex();
|
|
M_SAVEENTRY4DSGVAR(csDsgVarType,fn_csLongToString(lCurrentDsgVar),csDsgVarName,fn_csLongToString(lEditorNbElt));
|
|
|
|
if(pstMind!=NULL)
|
|
{
|
|
//Checks editor and engine coherence
|
|
|
|
//Checks type
|
|
tdeDsgVarTypeId eEngineDsgVarTypeId=M_GetDsgVarType(pstMind,lCurrentDsgVar);
|
|
if(eEngineDsgVarTypeId==eDsgVarTypeId)
|
|
{
|
|
tdstArray *pstArray=(tdstArray *)M_GetDsgVarAddrDefault(pstMind,lCurrentDsgVar);
|
|
|
|
//Checks Nb Elt
|
|
long lEgineNbElt=M_ARRAY_SIZE(pstArray);
|
|
if(lEgineNbElt==lEditorNbElt)
|
|
{
|
|
//Checks name
|
|
CString csEngineName=M_GetDsgVarName(pstMind,lCurrentDsgVar);
|
|
if(csEngineName==csDsgVarName)
|
|
{
|
|
//Saves Values
|
|
SCR_g_ui_SvL0_IndentationLevel++;
|
|
|
|
unsigned long ulEntrySize=fn_ulSizeOfDsgVar(M_ARRAY_TYPE(pstArray),0);
|
|
|
|
CString csDsgVarSubType=szFindDsgVarTypeScriptNameFromId(M_ARRAY_TYPE(pstArray));
|
|
for(long lIndex=0;lIndex<lEgineNbElt;lIndex++)
|
|
{
|
|
tduGetSetParam stGetSetParam;
|
|
M_tduGetSetParam_Clear(&stGetSetParam);
|
|
|
|
//Don't save if null
|
|
if(memcmp(&stGetSetParam,M_ARRAY_ELEMENT(pstArray,lIndex),ulEntrySize)!=0)
|
|
{
|
|
CString csIndex;
|
|
csIndex.Format("%ld",lIndex);
|
|
|
|
CString csInitDsgVarValue=EdIR_fn_csGetInitialValue(M_ARRAY_ELEMENT(pstArray,lIndex),M_ARRAY_TYPE(pstArray));
|
|
|
|
if(eDsgVarTypeId==eDsgVarType_Vector)
|
|
{
|
|
long lTmpIndex=0;
|
|
CString csX=fn_csGetNextWord(csInitDsgVarValue,lTmpIndex);
|
|
CString csY=fn_csGetNextWord(csInitDsgVarValue,lTmpIndex);
|
|
CString csZ=fn_csGetNextWord(csInitDsgVarValue,lTmpIndex);
|
|
|
|
M_SAVEENTRY4VECTOR(csDsgVarSubType,csIndex,"\"@"+csDsgVarName+"\"",csX,csY,csZ);
|
|
}
|
|
else
|
|
{
|
|
M_SAVEENTRY4DSGVAR(csDsgVarSubType,csIndex,"\"@"+csDsgVarName+"\"",csInitDsgVarValue);
|
|
}
|
|
}
|
|
}
|
|
|
|
SCR_g_ui_SvL0_IndentationLevel--;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
//For single value (get init value from text)
|
|
{
|
|
CString csDsgVarValue;
|
|
|
|
if((eDsgVarTypeId==eDsgVarType_Perso) ||
|
|
(eDsgVarTypeId==eDsgVarType_WayPoint) ||
|
|
(eDsgVarTypeId==eDsgVarType_Action) ||
|
|
(eDsgVarTypeId==eDsgVarType_SuperObject))
|
|
{
|
|
if((pclIntermediateCode->m_fn_lGetIndex()!=eKeyWord_Nobody) &&
|
|
(pclIntermediateCode->m_fn_lGetIndex()!=eKeyWord_Nowhere) &&
|
|
(pclIntermediateCode->m_fn_lGetIndex()!=eKeyWord_NoAction) &&
|
|
(pclIntermediateCode->m_fn_lGetIndex()!=eKeyWord_NoSuperObject))
|
|
{
|
|
CString csType;
|
|
switch(eDsgVarTypeId)
|
|
{
|
|
case eDsgVarType_Perso:
|
|
csType=C_szActorInstanceTypeName;
|
|
break;
|
|
|
|
case eDsgVarType_WayPoint:
|
|
csType=C_szWayPointTypeName;
|
|
break;
|
|
|
|
case eDsgVarType_Action:
|
|
csType=C_szStateTypeName;
|
|
break;
|
|
|
|
case eDsgVarType_SuperObject:
|
|
csType=C_szSuperObjectTypeName;
|
|
break;
|
|
|
|
default:
|
|
csType="";
|
|
}
|
|
|
|
long lHandle=pclIntermediateCode->m_fn_lGetIndex();
|
|
CPA_SaveObject *pclObject=fn_pclGetReachableObject(lHandle,csType);
|
|
|
|
csDsgVarValue=pclObject->GetReferencedSectionName();
|
|
}
|
|
else
|
|
{
|
|
csDsgVarValue=szFindKeyWordScriptNameFromId(tdeKeyWordId(pclIntermediateCode->m_fn_lGetIndex()));
|
|
}
|
|
|
|
M_SAVEENTRY4DSGVAR(csDsgVarType,fn_csLongToString(lCurrentDsgVar),csDsgVarName,csDsgVarValue);
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_Vector)
|
|
{
|
|
MTH3D_tdstVector tdstVector=pclIntermediateCode->m_fn_tdstGetVector();
|
|
|
|
//Gets X value
|
|
CString csX;
|
|
csX.Format("%f",MTH3D_M_xGetXofVector(&tdstVector));
|
|
|
|
//Gets Y value
|
|
CString csY;
|
|
csY.Format("%f",MTH3D_M_xGetYofVector(&tdstVector));
|
|
|
|
//Gets Z value
|
|
CString csZ;
|
|
csZ.Format("%f",MTH3D_M_xGetZofVector(&tdstVector));
|
|
|
|
M_SAVEENTRY4VECTOR(csDsgVarType,fn_csLongToString(lCurrentDsgVar),csDsgVarName,csX,csY,csZ);
|
|
}
|
|
else if (eDsgVarTypeId==eDsgVarType_Caps)
|
|
{
|
|
if ( pclIntermediateCode->m_fn_tdeGetNodeType() == eKeyWord)
|
|
{
|
|
if (pclIntermediateCode->m_fn_lGetIndex() != eKeyWord_CapsNull)
|
|
{
|
|
// error !
|
|
}
|
|
|
|
csDsgVarValue = szFindKeyWordScriptNameFromId(eKeyWord_CapsNull); // "CapaNull"
|
|
}
|
|
else
|
|
{
|
|
char sz255Temp[255];
|
|
ltoa( pclIntermediateCode->m_fn_lGetIndex(), sz255Temp, 2);
|
|
csDsgVarValue = sz255Temp;
|
|
}
|
|
|
|
M_SAVEENTRY4DSGVAR(csDsgVarType, fn_csLongToString(lCurrentDsgVar), csDsgVarName, csDsgVarValue);
|
|
}
|
|
else if (eDsgVarTypeId==eDsgVarType_Graph)
|
|
{
|
|
if ( pclIntermediateCode->m_fn_tdeGetNodeType() == eKeyWord)
|
|
{
|
|
if (pclIntermediateCode->m_fn_lGetIndex() != eKeyWord_NoGraph)
|
|
{
|
|
// error !
|
|
}
|
|
|
|
csDsgVarValue = szFindKeyWordScriptNameFromId(eKeyWord_NoGraph); // "NoGraph"
|
|
}
|
|
else
|
|
{
|
|
WP_tdHandleOfGraph lHandle = (WP_tdHandleOfGraph) pclIntermediateCode->m_fn_lGetIndex();
|
|
CString csReferencedSectionName;
|
|
if(lHandle!=NULL)
|
|
{
|
|
csReferencedSectionName = lHandle->m_szNameOfGraph;
|
|
}
|
|
else
|
|
csReferencedSectionName=szFindKeyWordScriptNameFromId(eKeyWord_NoGraph);
|
|
|
|
csDsgVarValue = csReferencedSectionName;
|
|
}
|
|
|
|
M_SAVEENTRY4DSGVAR(csDsgVarType, fn_csLongToString(lCurrentDsgVar), csDsgVarName, csDsgVarValue);
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_Text)
|
|
{
|
|
csDsgVarValue = pclIntermediateCode->m_fn_csGetString();
|
|
M_SAVEENTRY4DSGVAR(csDsgVarType,fn_csLongToString(lCurrentDsgVar),csDsgVarName,csDsgVarValue);
|
|
}
|
|
else
|
|
if(eDsgVarTypeId==eDsgVarType_Float)
|
|
{
|
|
csDsgVarValue.Format("%f",pclIntermediateCode->m_fn_dfGetValue());
|
|
|
|
M_SAVEENTRY4DSGVAR(csDsgVarType,fn_csLongToString(lCurrentDsgVar),csDsgVarName,csDsgVarValue);
|
|
}
|
|
else
|
|
{
|
|
csDsgVarValue.Format("%ld",pclIntermediateCode->m_fn_lGetIndex());
|
|
|
|
M_SAVEENTRY4DSGVAR(csDsgVarType,fn_csLongToString(lCurrentDsgVar),csDsgVarName,csDsgVarValue);
|
|
}
|
|
}
|
|
|
|
lCurrentDsgVar++;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
{
|
|
AfxMessageBox("Default code in EdIR2Eng.c/SaveIA !!");
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(bInScheduleSection || bInITRulesSection)
|
|
{
|
|
SCRIPT_vSaveEndSection(p_tdstFile);
|
|
}
|
|
|
|
SCR_g_ui_SvL0_IndentationLevel=lOldIndentationLevel;
|
|
}
|
|
|
|
clIntermediateCodeList.m_fn_vDestroyAndRemoveAllEntries();
|
|
|
|
return bRes;
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertPointerToIndexForModel(tdstScriptAI *pstScriptAI)
|
|
{
|
|
if(pstScriptAI!=NULL)
|
|
{
|
|
unsigned long ulIndex=(unsigned long)((tdstComport *)(M_GetScriptAINoComportInitDefault(pstScriptAI))-M_GetScriptAIComport(pstScriptAI));
|
|
M_GetScriptAINoComportInitDefault(pstScriptAI)=ulIndex;
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertPointerToIndexForModel(AI_tdstAIModel *pstAIModel)
|
|
{
|
|
if(pstAIModel!=NULL)
|
|
{
|
|
tdstScriptAI *pstScriptAIIntell=AI_M_p_stGetIntelligenceScriptAIModel(pstAIModel);
|
|
tdstScriptAI *pstScriptAIReflex=AI_M_p_stGetReflexScriptAIModel(pstAIModel);
|
|
|
|
if(pstScriptAIIntell!=NULL)
|
|
fn_vConvertPointerToIndexForModel(pstScriptAIIntell);
|
|
|
|
if(pstScriptAIReflex!=NULL)
|
|
fn_vConvertPointerToIndexForModel(pstScriptAIReflex);
|
|
}
|
|
}
|
|
/****************************************************************************/
|
|
void fn_vConvertIndexToPointerForModel(tdstScriptAI *pstScriptAI)
|
|
{
|
|
if(pstScriptAI!=NULL)
|
|
{
|
|
unsigned long ulIndex=M_GetScriptAINoComportInitDefault(pstScriptAI);
|
|
M_GetScriptAINoComportInitDefault(pstScriptAI)=(unsigned long)(M_GetScriptAIComportN(pstScriptAI,ulIndex));
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertIndexToPointerForModel(AI_tdstAIModel *pstAIModel)
|
|
{
|
|
if(pstAIModel!=NULL)
|
|
{
|
|
tdstScriptAI *pstScriptAIIntell=AI_M_p_stGetIntelligenceScriptAIModel(pstAIModel);
|
|
tdstScriptAI *pstScriptAIReflex=AI_M_p_stGetReflexScriptAIModel(pstAIModel);
|
|
|
|
if(pstScriptAIIntell!=NULL)
|
|
fn_vConvertIndexToPointerForModel(pstScriptAIIntell);
|
|
|
|
if(pstScriptAIReflex!=NULL)
|
|
fn_vConvertIndexToPointerForModel(pstScriptAIReflex);
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertPointerToIndexForInstance(tdstScriptAI *pstScriptAI,tdstIntelligence *pstIntell)
|
|
{
|
|
if((pstIntell!=NULL) &&
|
|
(pstScriptAI!=NULL))
|
|
{
|
|
tdstComport *pstComport=M_GetScriptAIComport(pstScriptAI);
|
|
unsigned long ulIndex=(unsigned long)((tdstComport *)(M_GetNoComportInit(pstIntell))-pstComport);
|
|
M_GetNoComportInit(pstIntell)=ulIndex;
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertPointerToIndexForInstance(AI_tdstMind *pstMind)
|
|
{
|
|
if(pstMind!=NULL)
|
|
{
|
|
AI_tdstAIModel *pstAIModel=AI_M_p_stGetAIModel(pstMind);
|
|
|
|
if(pstAIModel!=NULL)
|
|
{
|
|
tdstIntelligence *pstIntell=AI_M_p_stGetIntelligence(pstMind);
|
|
tdstScriptAI *pstScriptAIIntell=AI_M_p_stGetIntelligenceScriptAIModel(pstAIModel);
|
|
if((pstIntell!=NULL) &&
|
|
(pstScriptAIIntell!=NULL))
|
|
{
|
|
fn_vConvertPointerToIndexForInstance(pstScriptAIIntell,pstIntell);
|
|
}
|
|
|
|
tdstIntelligence *pstReflex=AI_M_p_stGetReflex(pstMind);
|
|
tdstScriptAI *pstScriptAIReflex=AI_M_p_stGetReflexScriptAIModel(pstAIModel);
|
|
if((pstReflex!=NULL) &&
|
|
(pstScriptAIReflex!=NULL))
|
|
{
|
|
fn_vConvertPointerToIndexForInstance(pstScriptAIReflex,pstReflex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertIndexToPointerForInstance(tdstScriptAI *pstScriptAI,tdstIntelligence *pstIntell)
|
|
{
|
|
if((pstIntell!=NULL) &&
|
|
(pstScriptAI!=NULL))
|
|
{
|
|
unsigned long ulIndex=(unsigned long)M_GetNoComportInit(pstIntell);
|
|
M_GetNoComportInit(pstIntell)=(unsigned long)M_GetScriptAIComportN(pstScriptAI,ulIndex);
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertIndexToPointerForInstance(AI_tdstMind *pstMind)
|
|
{
|
|
if(pstMind!=NULL)
|
|
{
|
|
AI_tdstAIModel *pstAIModel=AI_M_p_stGetAIModel(pstMind);
|
|
|
|
if(pstAIModel!=NULL)
|
|
{
|
|
tdstIntelligence *pstIntell=AI_M_p_stGetIntelligence(pstMind);
|
|
tdstScriptAI *pstScriptAIIntell=AI_M_p_stGetIntelligenceScriptAIModel(pstAIModel);
|
|
if((pstIntell!=NULL) &&
|
|
(pstScriptAIIntell!=NULL))
|
|
{
|
|
fn_vConvertIndexToPointerForInstance(pstScriptAIIntell,pstIntell);
|
|
}
|
|
|
|
tdstIntelligence *pstReflex=AI_M_p_stGetReflex(pstMind);
|
|
tdstScriptAI *pstScriptAIReflex=AI_M_p_stGetReflexScriptAIModel(pstAIModel);
|
|
if((pstReflex!=NULL) &&
|
|
(pstScriptAIReflex!=NULL))
|
|
{
|
|
fn_vConvertIndexToPointerForInstance(pstScriptAIReflex,pstReflex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tdstMacro * fn_p_stGetMacroRefFromEditorPointer ( CPA_EdIR_MainBehaviour * _p_stEditorSubroutine )
|
|
{
|
|
if ( _p_stEditorSubroutine != NULL )
|
|
{
|
|
CPA_Actor * pclModel = ( CPA_Actor * ) _p_stEditorSubroutine -> GetOwner ( ) ;
|
|
EdActors_EditorActorModel * pclEditorModel = pclModel -> m_fn_pclGetEditorModel ( ) ;
|
|
CPA_EdIR_Brain * pclBrain = pclEditorModel -> m_pclBrain ;
|
|
|
|
CPA_List<CPA_BaseObject> clInstancesList ;
|
|
g_pclAIInterface -> GetMainWorld ( ) -> fn_lFindObjects ( & clInstancesList , "" , C_szActorInstanceTypeName , pclModel ) ;
|
|
if ( ! clInstancesList . IsEmpty ( ) )
|
|
{
|
|
CPA_Actor * pclInstance = ( CPA_Actor * ) ( clInstancesList . GetHead ( ) ) ;
|
|
tdstEngineObject * pstEngineObject = (tdstEngineObject * ) pclInstance -> GetStruct ( ) ;
|
|
MS_tdxHandleToBrain hBrain = pstEngineObject -> h_Brain ;
|
|
|
|
if ( hBrain != NULL )
|
|
{
|
|
AI_tdstMind * pstMind = M_pstGetMindOfBrain ( hBrain ) ;
|
|
|
|
if ( pstMind != NULL )
|
|
{
|
|
AI_tdstAIModel * pstAIModel = AI_M_p_stGetAIModel ( pstMind ) ;
|
|
|
|
if ( pstAIModel != NULL )
|
|
{
|
|
long lBehaviourIndex = -1 ;
|
|
CPA_EdIR_MainBehaviourList * pclBehaviourList = NULL ;
|
|
if ( pclBrain -> m_clListOfSubrs . m_fn_bIsInList ( _p_stEditorSubroutine -> GetName ( ) ) )
|
|
{
|
|
lBehaviourIndex = pclBrain -> m_clListOfSubrs . m_fn_lGetIndexOfABehaviour ( _p_stEditorSubroutine -> GetName ( ) ) ;
|
|
|
|
return M_GetMacroN ( AI_M_p_stGetListOfMacroAIModel ( pstAIModel ) , lBehaviourIndex ) ;
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("fn_vConvertEditorPointerIntoEnginePointer: can't convert the editor subroutine (" + _p_stEditorSubroutine -> GetName ( ) + ") in a motor subroutine !!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("fn_vConvertEditorPointerIntoEnginePointer: editor and engine data are not coherent (AI) !!");
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("[DEV]fn_vConvertEditorPointerIntoEnginePointer: pb editor subroutine is NULL!!\nThe editor and engine intelligence are not coherent\nTry to compile the intelligence or get a coherent version of the scripts files");
|
|
}
|
|
return NULL ;
|
|
}
|
|
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertEditorPointerIntoEnginePointer ( tdstTreeInterpret * pstTree )
|
|
{
|
|
if ( pstTree != NULL )
|
|
{
|
|
tdstNodeInterpret * pstNode ;
|
|
long lIndex ;
|
|
|
|
for ( lIndex = 0 ; lIndex < M_GetNbNodeInterpret ( pstTree ) ; lIndex ++ )
|
|
{
|
|
pstNode = M_GetNodeInterpretN ( pstTree , lIndex ) ;
|
|
|
|
switch(M_GetTypeInterpret(pstNode))
|
|
{
|
|
case E_ti_MacroRef :
|
|
M_p_stMacroInterpret ( pstNode ) = fn_p_stGetMacroRefFromEditorPointer ( ( CPA_EdIR_MainBehaviour * ) M_p_stMacroInterpret ( pstNode ) ) ;
|
|
break ;
|
|
|
|
case E_ti_ModelRef:
|
|
{
|
|
CPA_Actor * pclModel = ( CPA_Actor * ) M_p_stModelInterpret ( pstNode ) ;
|
|
|
|
CPA_List<CPA_BaseObject> clInstancesList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel);
|
|
if(!clInstancesList.IsEmpty())
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetHead());
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
|
|
|
|
if(hBrain!=NULL)
|
|
{
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain);
|
|
|
|
if(pstMind!=NULL)
|
|
{
|
|
AI_tdstAIModel *pstAIModel=AI_M_p_stGetAIModel(pstMind);
|
|
|
|
if(pstAIModel!=NULL)
|
|
M_p_stModelInterpret(pstNode)=pstAIModel;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case E_ti_ComportRef:
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclMainBehaviour=(CPA_EdIR_MainBehaviour *)M_ComportInterpret(pstNode);
|
|
|
|
if(pclMainBehaviour!=NULL)
|
|
{
|
|
CPA_Actor *pclModel=(CPA_Actor *)pclMainBehaviour->GetOwner();
|
|
EdActors_EditorActorModel *pclEditorModel=pclModel->m_fn_pclGetEditorModel();
|
|
CPA_EdIR_Brain * pclBrain = pclEditorModel -> m_pclBrain ;
|
|
|
|
CPA_List<CPA_BaseObject> clInstancesList ;
|
|
g_pclAIInterface -> GetMainWorld ( ) -> fn_lFindObjects ( & clInstancesList , "" , C_szActorInstanceTypeName , pclModel ) ;
|
|
if ( ! clInstancesList . IsEmpty ( ) )
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetHead());
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
|
|
|
|
if(hBrain!=NULL)
|
|
{
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain);
|
|
|
|
if(pstMind!=NULL)
|
|
{
|
|
AI_tdstAIModel *pstAIModel=AI_M_p_stGetAIModel(pstMind);
|
|
|
|
if(pstAIModel!=NULL)
|
|
{
|
|
long lBehaviourIndex=-1;
|
|
CPA_EdIR_MainBehaviourList *pclBehaviourList=NULL;
|
|
tdstScriptAI *pstScriptAI=NULL;
|
|
if(pclBrain->m_clListOfIntelligenceBehaviours.m_fn_bIsInList(pclMainBehaviour->GetName()))
|
|
{
|
|
pclBehaviourList=&(pclBrain->m_clListOfIntelligenceBehaviours);
|
|
pstScriptAI=AI_M_p_stGetIntelligenceScriptAIModel(pstAIModel);
|
|
}
|
|
else
|
|
if(pclBrain->m_clListOfReflexBehaviours.m_fn_bIsInList(pclMainBehaviour->GetName()))
|
|
{
|
|
pclBehaviourList=&(pclBrain->m_clListOfReflexBehaviours);
|
|
pstScriptAI=AI_M_p_stGetReflexScriptAIModel(pstAIModel);
|
|
}
|
|
|
|
if((pclBehaviourList!=NULL) && (pstScriptAI!=NULL))
|
|
{
|
|
lBehaviourIndex=pclBehaviourList->m_fn_lGetIndexOfABehaviour(pclMainBehaviour->GetName());
|
|
|
|
M_ComportInterpret(pstNode)=M_GetScriptAIComportN(pstScriptAI,lBehaviourIndex);
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("fn_vConvertEditorPointerIntoEnginePointer: can't convert the editor behaviour ("+pclMainBehaviour->GetName()+") in a motor behaviour !!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("fn_vConvertEditorPointerIntoEnginePointer: editor and engine data are not coherent (AI) !!");
|
|
ASSERT(FALSE);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("[DEV]fn_vConvertEditorPointerIntoEnginePointer: pb editor behaviour is NULL!!\nThe editor and engine intelligence are not coherent\nTry to compile the intelligence or get a coherent version of the scripts files");
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertEditorPointerIntoEnginePointer(tdstScriptAI *pstScriptAI)
|
|
{
|
|
if(pstScriptAI!=NULL)
|
|
{
|
|
//Converts tree
|
|
tdstComport *pstComport;
|
|
unsigned long ulIndexForComport;
|
|
for(ulIndexForComport=0;ulIndexForComport<M_GetScriptAINbComport(pstScriptAI);ulIndexForComport++)
|
|
{
|
|
pstComport=M_GetScriptAIComportN(pstScriptAI,ulIndexForComport);
|
|
|
|
//Only one schedule
|
|
fn_vConvertEditorPointerIntoEnginePointer(M_GetComportSchedule(pstComport));
|
|
|
|
unsigned long ulIndexForRule;
|
|
for(ulIndexForRule=0;ulIndexForRule<M_GetComportNbRules(pstComport);ulIndexForRule++)
|
|
fn_vConvertEditorPointerIntoEnginePointer(M_GetComportRuleN(pstComport,ulIndexForRule));
|
|
}
|
|
}
|
|
}
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
/****************************************************************************/
|
|
void fn_vConvertEditorPointerIntoEnginePointer(tdstListOfMacro *pstListOfMacro)
|
|
{
|
|
if (pstListOfMacro != NULL)
|
|
{
|
|
//Converts tree
|
|
tdstMacro *pstMacro;
|
|
unsigned long ulIndexForMacro;
|
|
for (ulIndexForMacro = 0; ulIndexForMacro < M_GetNbMacro (pstListOfMacro); ulIndexForMacro++)
|
|
{
|
|
pstMacro = M_GetMacroN (pstListOfMacro, ulIndexForMacro);
|
|
|
|
//the trees
|
|
fn_vConvertEditorPointerIntoEnginePointer (M_GetMacroInitTree (pstMacro));
|
|
}
|
|
}
|
|
}
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertEditorPointerIntoEnginePointer(AI_tdstAIModel *pstAIModel)
|
|
{
|
|
if(pstAIModel!=NULL)
|
|
{
|
|
tdstScriptAI *pstScriptAIIntell=AI_M_p_stGetIntelligenceScriptAIModel(pstAIModel);
|
|
tdstScriptAI *pstScriptAIReflex=AI_M_p_stGetReflexScriptAIModel(pstAIModel);
|
|
|
|
if(pstScriptAIIntell!=NULL)
|
|
fn_vConvertEditorPointerIntoEnginePointer(pstScriptAIIntell);
|
|
|
|
if(pstScriptAIReflex!=NULL)
|
|
fn_vConvertEditorPointerIntoEnginePointer(pstScriptAIReflex);
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
tdstListOfMacro *pstListOfMacro = AI_M_p_stGetListOfMacroAIModel (pstAIModel);
|
|
|
|
if (pstListOfMacro != NULL)
|
|
fn_vConvertEditorPointerIntoEnginePointer (pstListOfMacro);
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
CPA_Actor *fn_pclGetModel(AI_tdstAIModel *pstAIModel)
|
|
{
|
|
CPA_List<CPA_BaseObject> clModelsList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clModelsList,"",C_szActorModelTypeName,NO_CRITERIA);
|
|
|
|
POSITION pos=clModelsList.GetHeadPosition();
|
|
while(pos!=NULL)
|
|
{
|
|
CPA_Actor *pclModel=(CPA_Actor *)(clModelsList.GetNext(pos));
|
|
|
|
//Converts model
|
|
CPA_List<CPA_BaseObject> clInstancesList;
|
|
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel);
|
|
if(!clInstancesList.IsEmpty())
|
|
{
|
|
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetHead());
|
|
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
|
|
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
|
|
|
|
if(hBrain!=NULL)
|
|
{
|
|
AI_tdstMind *pstMind=M_pstGetMindOfBrain(hBrain);
|
|
|
|
if(pstMind!=NULL && AI_M_p_stGetAIModel(pstMind)==pstAIModel)
|
|
return pclModel;
|
|
}
|
|
}
|
|
}
|
|
|
|
AfxMessageBox("[DEV]EdIR2Eng::fn_pclGetModel : Unknown pstAIModel !!");
|
|
|
|
return NULL;
|
|
}
|
|
|
|
/****************************************************************************/
|
|
CPA_EdIR_MainBehaviour *fn_pclGetBehaviour(tdstComport *pstComport)
|
|
{
|
|
CString csBehaviourSectionName=M_GetNameComport(pstComport);
|
|
CString csErrorMsg="[DEV]EdIR2Eng::fn_pclGetBehaviour : there is no editor behaviour with this name : "+csBehaviourSectionName+" !!";
|
|
|
|
if(csBehaviourSectionName!="")
|
|
{
|
|
//Extracts BehaviourName
|
|
long lIndex=csBehaviourSectionName.ReverseFind(':');
|
|
if(lIndex!=-1)
|
|
{
|
|
CString csBehaviourName=csBehaviourSectionName.Right(csBehaviourSectionName.GetLength()-lIndex-1);
|
|
|
|
//Extracts Model Name
|
|
lIndex=csBehaviourSectionName.Find('\\');
|
|
if(lIndex!=-1)
|
|
{
|
|
CString csModelName=csBehaviourSectionName.Right(csBehaviourSectionName.GetLength()-lIndex-1);
|
|
|
|
lIndex=csModelName.Find('\\');
|
|
if(lIndex!=-1)
|
|
{
|
|
csModelName=csModelName.Left(lIndex);
|
|
|
|
CPA_BaseObject *pclModel=g_pclAIInterface->GetMainWorld()->fn_p_oFindObject(csModelName,C_szActorModelTypeName);
|
|
|
|
if(pclModel!=NULL)
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclMainBehaviour=(CPA_EdIR_MainBehaviour *)g_pclAIInterface->GetMainWorld()->fn_p_oFindObject(csBehaviourName,C_szIABehaviourTypeName,pclModel);
|
|
|
|
if(pclMainBehaviour!=NULL)
|
|
return pclMainBehaviour;
|
|
else
|
|
csErrorMsg="[DEV]EdIR2Eng::fn_pclGetBehaviour : there is no editor behaviour ("+csBehaviourName+") in the model "+csModelName+" !!";
|
|
}
|
|
else
|
|
{
|
|
csErrorMsg="[DEV]EdIR2Eng::fn_pclGetBehaviour : there is no editor model with this name : "+csModelName+" !!";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
AfxMessageBox(csErrorMsg);
|
|
|
|
return NULL;
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("[DEV]EdIR2Eng::fn_pclGetBehaviour : pstComport has no name !!");
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
/****************************************************************************/
|
|
CPA_EdIR_MainBehaviour * fn_pclGetSubroutine ( tdstMacro * pstMacro )
|
|
{
|
|
CString csBehaviourSectionName=M_GetNameMacro(pstMacro);
|
|
CString csErrorMsg = "[DEV]EdIR2Eng::fn_pclGetSubroutine : there is no editor subroutine with this name : "+csBehaviourSectionName+" !!";
|
|
|
|
if(csBehaviourSectionName!="")
|
|
{
|
|
//Extracts BehaviourName
|
|
long lIndex=csBehaviourSectionName.ReverseFind(':');
|
|
if(lIndex!=-1)
|
|
{
|
|
CString csBehaviourName=csBehaviourSectionName.Right(csBehaviourSectionName.GetLength()-lIndex-1);
|
|
|
|
//Extracts Model Name
|
|
lIndex=csBehaviourSectionName.Find('\\');
|
|
if(lIndex!=-1)
|
|
{
|
|
CString csModelName=csBehaviourSectionName.Right(csBehaviourSectionName.GetLength()-lIndex-1);
|
|
|
|
lIndex=csModelName.Find('\\');
|
|
if(lIndex!=-1)
|
|
{
|
|
csModelName=csModelName.Left(lIndex);
|
|
|
|
CPA_BaseObject *pclModel=g_pclAIInterface->GetMainWorld()->fn_p_oFindObject(csModelName,C_szActorModelTypeName);
|
|
|
|
if(pclModel!=NULL)
|
|
{
|
|
CPA_EdIR_MainBehaviour *pclMainBehaviour=(CPA_EdIR_MainBehaviour *)g_pclAIInterface->GetMainWorld()->fn_p_oFindObject(csBehaviourName,C_szIABehaviourTypeName,pclModel);
|
|
|
|
if(pclMainBehaviour!=NULL)
|
|
return pclMainBehaviour;
|
|
else
|
|
csErrorMsg="[DEV]EdIR2Eng::fn_pclGetSubroutine : there is no editor behaviour ("+csBehaviourName+") in the model "+csModelName+" !!";
|
|
}
|
|
else
|
|
{
|
|
csErrorMsg="[DEV]EdIR2Eng::fn_pclGetSubroutine : there is no editor model with this name : "+csModelName+" !!";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
AfxMessageBox(csErrorMsg);
|
|
|
|
return NULL;
|
|
}
|
|
else
|
|
{
|
|
AfxMessageBox("[DEV]EdIR2Eng::fn_pclGetSubroutine : pstMacro has no name !!");
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertEnginePointerIntoEditorPointer(tdstTreeInterpret *pstTree)
|
|
{
|
|
if(pstTree!=NULL)
|
|
{
|
|
tdstNodeInterpret *pstNode;
|
|
long lIndex;
|
|
|
|
for(lIndex=0;lIndex<M_GetNbNodeInterpret(pstTree);lIndex++)
|
|
{
|
|
pstNode=M_GetNodeInterpretN(pstTree,lIndex);
|
|
|
|
switch(M_GetTypeInterpret(pstNode))
|
|
{
|
|
case E_ti_ModelRef :
|
|
{
|
|
AI_tdstAIModel *pstAIModel=M_p_stModelInterpret(pstNode);
|
|
|
|
M_p_stModelInterpret(pstNode)=(AI_tdstAIModel *)fn_pclGetModel(pstAIModel);
|
|
}
|
|
break;
|
|
|
|
case E_ti_ComportRef :
|
|
{
|
|
tdstComport *pstComport=M_ComportInterpret(pstNode);
|
|
|
|
M_ComportInterpret(pstNode)=(tdstComport *)fn_pclGetBehaviour(pstComport);
|
|
}
|
|
break;
|
|
|
|
case E_ti_MacroRef :
|
|
{
|
|
// g_pclListOfSubrs = & m_pclBrain -> m_clListOfSubrs;
|
|
tdstMacro * p_stMacro = M_p_stMacroInterpret ( pstNode ) ;
|
|
/* look for the editor subroutine that has this engine subroutine */
|
|
M_p_stMacroInterpret ( pstNode ) = ( tdstMacro * ) fn_pclGetSubroutine ( p_stMacro ) ;
|
|
}
|
|
break ;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertEnginePointerIntoEditorPointer(tdstScriptAI *pstScriptAI)
|
|
{
|
|
if(pstScriptAI!=NULL)
|
|
{
|
|
//Converts tree
|
|
tdstComport *pstComport;
|
|
unsigned long ulIndexForComport;
|
|
for(ulIndexForComport=0;ulIndexForComport<M_GetScriptAINbComport(pstScriptAI);ulIndexForComport++)
|
|
{
|
|
pstComport=M_GetScriptAIComportN(pstScriptAI,ulIndexForComport);
|
|
|
|
//Only one schedule
|
|
fn_vConvertEnginePointerIntoEditorPointer(M_GetComportSchedule(pstComport));
|
|
|
|
unsigned long ulIndexForRule;
|
|
for(ulIndexForRule=0;ulIndexForRule<M_GetComportNbRules(pstComport);ulIndexForRule++)
|
|
fn_vConvertEnginePointerIntoEditorPointer(M_GetComportRuleN(pstComport,ulIndexForRule));
|
|
}
|
|
}
|
|
}
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
/****************************************************************************/
|
|
void fn_vConvertEnginePointerIntoEditorPointer(tdstListOfMacro *pstListOfMacro)
|
|
{
|
|
if (pstListOfMacro != NULL)
|
|
{
|
|
//Converts tree
|
|
tdstMacro *pstMacro;
|
|
unsigned long ulIndexForMacro;
|
|
for (ulIndexForMacro = 0; ulIndexForMacro < M_GetNbMacro (pstListOfMacro); ulIndexForMacro++)
|
|
{
|
|
pstMacro = M_GetMacroN (pstListOfMacro, ulIndexForMacro);
|
|
|
|
//the trees
|
|
fn_vConvertEnginePointerIntoEditorPointer (M_GetMacroInitTree (pstMacro));
|
|
}
|
|
}
|
|
}
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
|
|
/****************************************************************************/
|
|
void fn_vConvertEnginePointerIntoEditorPointer(AI_tdstAIModel *pstAIModel)
|
|
{
|
|
if(pstAIModel!=NULL)
|
|
{
|
|
tdstScriptAI *pstScriptAIIntell=AI_M_p_stGetIntelligenceScriptAIModel(pstAIModel);
|
|
tdstScriptAI *pstScriptAIReflex=AI_M_p_stGetReflexScriptAIModel(pstAIModel);
|
|
|
|
if(pstScriptAIIntell!=NULL)
|
|
fn_vConvertEnginePointerIntoEditorPointer(pstScriptAIIntell);
|
|
|
|
if(pstScriptAIReflex!=NULL)
|
|
fn_vConvertEnginePointerIntoEditorPointer(pstScriptAIReflex);
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-04-
|
|
tdstListOfMacro *pstListOfMacro = AI_M_p_stGetListOfMacroAIModel (pstAIModel);
|
|
|
|
if (pstListOfMacro != NULL)
|
|
fn_vConvertEnginePointerIntoEditorPointer (pstListOfMacro);
|
|
//END ROMTEAM Cristi Petrescu 98-04-
|
|
}
|
|
}
|
|
|
|
#endif //D_ED_IR_ACTIVE
|