123 lines
3.1 KiB
C
123 lines
3.1 KiB
C
|
|
/*******************************************************/
|
|
/**** For the structures and variables declarations ****/
|
|
/*******************************************************/
|
|
#define D_Brain_StructureDefine
|
|
#define D_Brain_VariableDefine
|
|
|
|
#include "InitEnum.h"
|
|
#include "ToolsCPA.h"
|
|
|
|
#include "Options/Options.h"
|
|
#include "Macros.h"
|
|
|
|
#include "Actions/AllActs.h"
|
|
|
|
#include "Structur/MemGame.h"
|
|
#include "Structur/EngMode.h"
|
|
#include "Structur/ErrGame.h"
|
|
#include "Structur/Objects.h"
|
|
#include "Structur/GameScpt.h"
|
|
#include "Structur/StdObjSt.h"
|
|
|
|
#include "Basic.h"
|
|
#include "ObjInit.h"
|
|
#include "ZeMem.h"
|
|
#include "ObjType.h"
|
|
#include "ToolCam.h"
|
|
#include "LoadBin.h"
|
|
|
|
/* For BIN*/
|
|
#ifdef GAM_USE_SNA
|
|
#include "sna.h"
|
|
#endif /* GAM_USE_SNA */
|
|
|
|
|
|
#include "ldt.h"
|
|
|
|
HREF g_hRefBrain;
|
|
|
|
enum{
|
|
iEndCreateVariables,
|
|
iEndIntellModel,
|
|
iEndReflexModel,
|
|
iEndAIModel,
|
|
iEndInitVariables,
|
|
iEndComportIntell,
|
|
iEndComportReflex
|
|
};
|
|
|
|
|
|
/*****************************************************************
|
|
Name:
|
|
Description: Create callback for LDT
|
|
Author: Mircea Petrescu
|
|
Date: 8/24/98
|
|
Modified:
|
|
*****************************************************************/
|
|
int fn_iCreateBrain( LDT_tdst_Link *pLink )
|
|
{
|
|
MS_tdxHandleToBrain h_Brain;
|
|
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
|
|
|
|
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeBrain , p_stEngineObject);
|
|
h_Brain = fn_h_BrainRealAlloc();
|
|
MMG_fn_vEndMemoryInfo ();
|
|
|
|
p_stEngineObject->h_Brain=h_Brain;
|
|
|
|
|
|
pLink->pObject=(void *)h_Brain;
|
|
return 0;
|
|
}
|
|
|
|
int fn_iLoadBrain( LDT_tdst_Link *pLink )
|
|
{
|
|
LDT_tdeParseResult result=ParseResult_BeginSection;
|
|
|
|
MS_tdxHandleToBrain h_Brain = (MS_tdxHandleToBrain)pLink->pObject;
|
|
AI_tdstMind *p_stMind;
|
|
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pObject;
|
|
|
|
char szIntellFileName[_MAX_PATH];
|
|
char *szModelName;
|
|
char *szFamilyName;
|
|
|
|
p_stMind = M_pstGetMindOfBrain(h_Brain);
|
|
|
|
szModelName = fn_szFindModelTypeNameOfModelType(M_ObjectGetModelType(p_stEngineObject));
|
|
szFamilyName = fn_szFindFamilyTypeNameOfFamilyType(M_ObjectGetFamilyType(p_stEngineObject));
|
|
|
|
|
|
AI_M_SetPersoName(p_stMind, fn_szFindPersonalTypeNameOfPersonalType(M_ObjectGetPersonalType(p_stEngineObject)));
|
|
LDT_SetLinkValue( pLink, (unsigned long)p_stMind );
|
|
|
|
do{
|
|
result=LDT_GetNextEntry();
|
|
if( result== ParseResult_BeginSection )
|
|
LDT_LoadSection( NULL );
|
|
}while ( result!=ParseResult_EndSection );
|
|
|
|
sprintf(szIntellFileName,"%s\\%s\\%s.ai",szFamilyName,szModelName,szModelName);
|
|
/* read an .ai file */
|
|
fn_vReadAI(p_stMind, szIntellFileName,p_stEngineObject );
|
|
|
|
/* alloc intelligence and link it with its script*/
|
|
LDT_AddToRefsTable( g_hRefBrain, pLink, iEndAIModel, 0 );
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* LoadBrain =>Default*/
|
|
/* fn_vReadAI => ai\aibase\specif\readrule.c fn_vReadAIModel */
|
|
/* OS Note : fn_vReadAIModel > this function need to be changed for reading of .ai files with LDT instead of SCR*/
|
|
void AI_PostProcessLDT( HREF );
|
|
|
|
void fn_vBrainPostProcessLDT( HREF hRef )
|
|
{
|
|
AI_PostProcessLDT(hRef);
|
|
}
|
|
|
|
|