Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,227 @@
/*///////////////////*/
/* macro for Error //*/
/*///////////////////*/
#ifndef __AIMACROS_H__
#define __AIMACROS_H__
#if defined(__DEBUG_AI__)
#define D_MmgAITestBeforeFree
#endif
#ifdef __FATAL_ERR_AI__
/* This allow us to save about 600 Ko in the release lib
#define M_AIFatalError(FatalErrorNum) \
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, FatalErrorNum, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);
#define M_AIFatalErrorMsg(FatalErrorNum,szMsg) \
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, FatalErrorNum, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, szMsg);
*/
void fn_vOnAIErm_M_UpdateLastError(unsigned short FatalErrorNum,char *szMsg);
#define M_AIFatalErrorMsg(FatalErrorNum,szMsg) fn_vOnAIErm_M_UpdateLastError(FatalErrorNum,szMsg)
#define M_AIFatalError(FatalErrorNum) M_AIFatalErrorMsg(FatalErrorNum,NULL)
#else /*__FATAL_ERR_AI__*/
#define M_AIFatalError(FatalErrorNum) /*nothing to do*/
#define M_AIFatalErrorMsg(FatalErrorNum,szMsg) /*nothing to do*/
#endif /*__FATAL_ERR_AI__*/
#ifdef __WARNING_ERR_AI__
#define M_AIWarningError(ErrorNum, ucOpenInfoWindow)\
/* ----------------*/\
{ \
if (ErrorNum > E_uwAIStartOfWarning) \
{ \
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, ErrorNum, C_lErmNoDebugData, ucOpenInfoWindow, C_ucAllowStopForDebug, NULL);\
} \
else \
{ \
M_AIFatalError(E_uwAIFatalNotAFatalError);\
} \
}
#else /*__WARNING_ERR_AI__ */
//XB 10/08/99
#define M_AIWarningError(ErrorNum, uwOpenInfoWindow)/*\
{ \
if (ErrorNum < E_uwAIStartOfWarning) \
M_AIFatalError(E_uwAIFatalNotAFatalError);\
}*/
#endif /*__WARNING_ERR_AI__ */
#ifdef __WARNING_ERR_AI__
#define M_AIWarningErrorAndAllowStopForDebug(ErrorNum, ucOpenInfoWindow, szMytxt)\
/* ----------------*/\
{ \
if (ErrorNum > E_uwAIStartOfWarning) \
{ \
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, ErrorNum, C_lErmNoDebugData, ucOpenInfoWindow, C_ucAllowStopForDebug, szMytxt);\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
} \
else \
{ \
M_AIFatalError(E_uwAIFatalNotAFatalError);\
} \
}
#define M_AIWarningErrorAndNeverStopForDebug(ErrorNum, ucOpenInfoWindow, szMytxt)\
/* ----------------*/\
{ \
if (ErrorNum > E_uwAIStartOfWarning) \
{ \
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, ErrorNum, C_lErmNoDebugData, ucOpenInfoWindow, C_ucNeverStopForDebug, szMytxt);\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
} \
else \
{ \
M_AIFatalError(E_uwAIFatalNotAFatalError);\
} \
}
#else /*__WARNING_ERR_AI__ */
//XB 10/08/99
#define M_AIWarningErrorAndAllowStopForDebug(ErrorNum, uwOpenInfoWindow, szMytxt)/*\
{ \
if (ErrorNum < E_uwAIStartOfWarning) \
M_AIFatalError(E_uwAIFatalNotAFatalError);\
}*/
//XB 10/08/99
#define M_AIWarningErrorAndNeverStopForDebug(ErrorNum, uwOpenInfoWindow, szMytxt)/*\
{ \
if (ErrorNum < E_uwAIStartOfWarning) \
M_AIFatalError(E_uwAIFatalNotAFatalError);\
}*/
#endif /*__WARNING_ERR_AI__ */
#ifdef __FATAL_ERR_AI__
#define M_AIIfErrorUpdateFatalError(UsedModule, ErrorNum)\
/* ---------------------------*/\
if (Erm_M_uwCheckError(UsedModule, C_ucErmDefaultChannel)){\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
M_AIFatalError(ErrorNum);\
}
#else /*__FATAL_ERR_AI__ */
#define M_AIIfErrorUpdateFatalError(UsedModule, ErrorNum) /*nothing to do*/
#endif /*__FATAL_ERR_AI__*/
#ifdef __WARNING_ERR_AI__
#define M_AIIfErrorUpdateWarningError(UsedModule, ErrorNum, uwOpenInfoWindow)\
/* -----------------------------*/\
if (Erm_M_uwCheckError(UsedModule, C_ucErmDefaultChannel)){\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
M_AIWarningError(ErrorNum, uwOpenInfoWindow);\
}
#else /*__WARNING_ERR_AI__*/
#define M_AIIfErrorUpdateWarningError(UsedModule, ErrorNum, uwOpenInfoWindow) /*nothing to do*/
#endif /*__WARNING_ERR_AI__*/
/* ALB January 1997 */
#ifdef __DEBUG_AI__
#define M_AI_DEBUG_ASSERT(bCond,ErrorRaised)\
if(!(bCond))\
{\
M_AIFatalError(ErrorRaised);\
}
#define M_AI_DEBUG_ASSERT_WARNING(bCond,ErrorRaised)\
if(!(bCond))\
{\
M_AIWarningError(ErrorRaised, C_ucErmNoOpenInfoWindow); \
}
#define M_AI_MemSet(pBuffer,cCharToSet,ucSizeOfMem)\
if(pBuffer)\
{\
memset(pBuffer,cCharToSet,ucSizeOfMem);\
}
#else /*__DEBUG_AI__*/
#define M_AI_DEBUG_ASSERT(bCond,ErrorRaised)
#define M_AI_DEBUG_ASSERT_WARNING(bCond,ErrorRaised)
#define M_AI_MemSet(pBuffer,cCharToSet,ucSizeOfMem)
#endif /*__DEBUG_AI__*/
/* ALB END */
/*////////////////////*/
/* macro for Memory //*/
/*////////////////////*/
#define MODE_STATIC_MEM_FOR_AI
#ifdef MODE_STATIC_MEM_FOR_AI
#define M_AIChooseMemoryBlock() Mmg_M_SetModeAlloc4Ch(AI,(unsigned char)AI_g_ucMemoryBlockUsed,C_ucMmgDefaultChannel)
#else
#define M_AIChooseMemoryBlock() Mmg_M_SetModeAlloc4Ch(AI,E_ucDynamic,C_ucMmgDefaultChannel)
#endif /* MODE_STATIC_MEM_FOR_AI*/
void fn_vErrorOnAIAlloc(void);
/*M_AIIfErrorUpdateFatalError(Mmg, E_uwAIFatalFailedAllocationMem);*/
void fn_vErrorOnAIFree(void);
/*M_AIIfErrorUpdateWarningError (Mmg, E_uwAIWarningCanNotFree, C_ucErmOpenInfoWindow);*/
/* M_AIChooseMemoryBlock();*/
/* Var = (cast) Mmg_fn_p_vAlloc4Ch(ucSize,C_ucMmgDefaultChannel);*/
#ifndef U64
#define M_AIAlloc(Var, cast, ucSize)\
{\
Var = (cast)AI_fn_p_vTrueAlloc(ucSize);\
AI_fn_vMemoryLogFile(Var,AI_C_ActionMalloc,__FILE__,__LINE__); \
fn_vErrorOnAIAlloc(); \
}
#else /* !U64 */
#define M_AIAlloc(Var, cast, ucSize)\
{\
Var = (cast)AI_fn_p_vTrueAlloc(ucSize);\
fn_vErrorOnAIAlloc(); \
}
#endif /* !U64 */
/* M_AIChooseMemoryBlock();*/
/* Var = (cast) Mmg_fn_p_vRealloc4Ch(AdrScr,ucSize,C_ucMmgDefaultChannel);*/
#ifndef U64
#define M_AIReAlloc(Var,AdrScr,cast, ucSize)\
{\
Var = (cast) AI_fn_p_vTrueRealloc(AdrScr,ucSize);\
AI_fn_vMemoryLogFile(Var,AI_C_ActionRealloc,__FILE__,__LINE__); \
fn_vErrorOnAIAlloc(); \
}
#else /* !U64 */
#define M_AIReAlloc(Var,AdrScr,cast, ucSize)\
{\
Var = (cast) AI_fn_p_vTrueRealloc(AdrScr,ucSize);\
fn_vErrorOnAIAlloc(); \
}
#endif /* !U64 */
/* M_AIChooseMemoryBlock();*/
/* Mmg_fn_vFree4Ch(p_cAdr,C_ucMmgDefaultChannel);*/
#ifndef U64
#define M_AIFree(p_cAdr) \
{\
AI_fn_vMemoryLogFile(p_cAdr,AI_C_ActionFree,__FILE__,__LINE__); \
AI_fn_vTrueFree(p_cAdr);\
fn_vErrorOnAIFree(); \
p_cAdr=NULL; \
}
#else /* !U64 */
#define M_AIFree(p_cAdr) \
{\
AI_fn_vTrueFree(p_cAdr);\
fn_vErrorOnAIFree(); \
p_cAdr=NULL; \
}
#endif /* !U64 */
#endif /* __AIMACROS_H__*/

View File

@@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*/
/* AIUseCPA.h : CPA include for AI.*/
/* auteur : Olivier Didelot.*/
/* date : 28/01/1997*/
/*---------------------------------------------------------------------------*/
#ifndef __AIUSECPA_H__
#define __AIUSECPA_H__
/****************************************
* Here is the list of disabled WARNING *
****************************************/
#if defined(VISUAL)
/*#pragma warning(disable:4010) // single-line comment contains line-continuation character **/
/*#pragma warning(disable:4702) // unreachable code */
#pragma warning(disable:4244) /* conversion from 'type1' to 'type2', possible loss of data **/
#pragma warning(disable:4514) /* unreferenced inline function has been removed*/
#pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union*/
#pragma warning(disable:4127) /* conditional expression is constant*/
#pragma warning(disable:4214) /* nonstandard extension used : bit field types other than int*/
#pragma warning(disable:4115) /* named type definition in parentheses*/
#if !defined(__cplusplus)
#pragma warning(disable:4032) /* formal parameter 1 has different type when promoted*/
#endif
#pragma warning(disable:4206) /* nonstandard extension used : translation unit is empty*/
#endif /*VISUAL*/
#include "ACP_Base.h"
#include "GMT.h"
#include "MMG.h" /* MemoryManaGer*/
#include "ERM.h" /* ErrorManager*/
#include "SCR.h" /* SCRipt*/
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "SPO.h" /*"Hie.h"*/
#include "MEC.h" /* Mechanic*/
#include "LST.h" /* LiST*/
#ifdef USE_IPT_DX5
#include "IPT_DX5.h" /* InPuT (absolutely before GAM.h)*/
#else /* USE_IPT_WIN */
#include "IPT.h" /* InPuT (absolutely before GAM.h)*/
#endif /* USE_IPT_WIN */
#include "PCS.h" /* Physical Collide Set */
#include "RND.h" /* RaNDom*/
/*XB980428*/
/*#include "VIG.h" // Vignette*/
/*End XB*/
/* Shaitan Clean Env {*/
/*#include "SRF.h" // Surface*/
/* End Shaitan Clan Env }*/
/*#include "FON.h" // Font*/
#include "SND.h" /* SND*/
#define ENV_FRIEND
/* Shaitan Clean Env {*/
/*#include "ENV.h" // ENV*/
/* End Shaitan Clan Env }*/
#include "SCT.h" /* SeCTor*/
#include "FIL.h" /* SeCTor*/
/* in order to compile AI in C++ and link with GAM in C*/
#if defined(__cplusplus)
extern "C"
{
#endif
#ifndef D_THROW_PRT
#include "PRT.h"
#endif /* D_THROW_PRT */
#include "GAM.h" /* GAMe*/
#ifndef U64
#include "DPT.h" /* DataPaTh*/
#endif
#if defined(__cplusplus)
}
#endif
/*#ifdef AI_USE_BINARY*/
/*#include "BIN.h" */
/*#endif /* AI_USE_BINARY */
#include "HDL.h"
#include "SAI.h"
/*#include "cpa_std.h"*/
#undef EXTERN
#undef extern
#endif /* __AIUSECPA_H__*/

View File

@@ -0,0 +1,281 @@
/*///////////////////////////////////////////////////////////*/
/* //*/
/* Management of the Module : AI (Intelligence) //*/
/* //*/
/*///////////////////////////////////////////////////////////*/
/* //*/
/* abbreviation of the module-name. Used in macro is 'AI' //*/
/* //*/
/*///////////////////////////////////////////////////////////*/
#ifndef __ERRAI_H__
#define __ERRAI_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define C_szAIVersion "AI V5.0.0" /* The format is XXX Va.b.c with Xxx is the Tag of the module */
#define C_szAIFullName "Artificial Intelligence"/* the complete and clear name of the module */
#define C_szAIDate "Dec 5 1997" /*The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/
#ifndef __ERM_H__
#include "ERM.h"
#endif /*__ERM_H__*/
/*----------*/
/* Constant*/
/*----------*/
/* error of the AI Module*/
typedef enum e_uwAIErrNumber_{
E_uwAIFatalErr = 0,
#ifdef __FATAL_ERR_AI__
/* -----------------*/
E_uwAIFatalNotAFatalError,
E_uwAIFatalTooMuchCond,
E_uwAIFatalTooMuchAction,
E_uwAIFatalTooMuchParamCond,
E_uwAIFatalTooMuchParamAction,
E_uwAIFatalNoEltInStackCond,
E_uwAIFatalTooMuchEltInStackCond,
E_uwAIFatalWrongParamCond,
E_uwAIFatalWrongParamAction,
E_uwAIFatalNotValidField,
E_uwAIFatalInvalidAction,
E_uwAIFatalFailedAllocationMem,
E_uwAIFatalWrongTypeVar,
E_uwAIFatalPersoListFull,
E_uwAIFatalPbPersoListInsert,
E_uwAIFatalPbDeleteInPersoList,
E_uwAIFatalUnknownFieldName,
E_uwAIFatalUnknownFunc,
/*E_uwAIFatalUnknownFuncList,*/
E_uwAIFatalUnknownProcedure,
E_uwAIFatalUnknownCond,
E_uwAIFatalNotValidPriority,
E_uwAIFatalUnknownKeyWord,
E_uwAIFatalTooMuchNode,
E_uwAIActionTableTooSmall,
E_uwAIBadLeftInAffectation,
E_uwAIFatalBadComportNumber,
E_uwAIFatalBadNodeNumber,
E_uwAIFatalBadRuleNumber,
E_uwAIFatalNodeNotInRule,
E_uwAIFatalRuleNotInComport,
E_uwAIFatalComportNotInIntelligence,
E_uwAIFatalCantFindPerso,
E_uwAIFatalUnknownNode,
E_uwAIFatalInvalidAccessToField,
E_uwAIFatalInvalidAccessToDsgVar,
E_uwAIFatalInvalidAccessToFieldOrDsgVar,
E_uwAIFatalNotAGoodAction,
E_uwAIFatalWrongTypeParamAction,
E_uwAIFatalNotValidFunction,
E_uwAIFatalNotValidProcedure,
E_uwAIFatalNotValidDsgVarId,
E_uwAIFatalNotValidOperator,
E_uwAIFatalNotValidCondition,
E_uwAIFatalUnknownOperator,
E_uwAIFatalInvalidParameter,
E_uwAIFatalInvalidWPValue,
E_uwAIFatalArrayAlreadyFull,
E_uwAIFatalArrayEmpty,
E_uwAIFatalAssertionFailure,
E_uwAIFatalTypeLinkInvalid,
E_uwAIFatalDynTypeLinkInvalid,
E_uwAIFatalWayPositionInvalid,
E_uwAIFatalWayFirstLinkMustBeLine,
E_uwAIFatalNullVectorNotAllowed,
E_uwAIFatalBadEntryAIModel,
E_uwAIWrongOperatorInLeftAffect,
E_uwAIDivisionByZero,
E_uwAIFatalNoDynamics,
E_uwAIFatalUnknownButton,
E_uwAIFatalReferenceNotLoaded,
E_uwAIFatalScriptError,
E_uwAIFatalNotMSCamera,
E_uwAIFatalInvalidUseOfUltraOperator,
E_uwAIFatalInvalidModelCast,
E_uwAIFatalInvalidDsgvarSaveType,
#endif /*__FATAL_ERR_AI__*/
E_uwAIStartOfWarning,/* important constant, it allows to recognize if an error is fatal or not.*/
#ifdef __WARNING_ERR_AI__
/* -------------------*/
E_uwAIWarningCanNotFree,/*!!y*/
E_uwAIWarningTruncateAffectation,/*!!y*/
E_uwAIWarningBadType,
E_uwAIWarningChangeToCurrentComport,
E_uwAIWarningCycleComport,
E_uwAIWarningArrayCyclingComportTooSmall,
E_uwAIWarningExecuteActionInt,
E_uwAIWarningComportOfAnotherPerso,
E_uwAIDebugDynamicAllocation,
E_uwAIWarningScriptError,
E_uwAIWarningEngineGoto,
E_uwAIWarningChannelNotControlled, /*ANNECY BBB: is fatal for engine, but not in editor mode*/
#if defined(ACTIVE_EDITOR)
E_uwAIWarningUnknownCond,
E_uwAIWarningUnknownFieldName,
E_uwAIWarningUnknownOperator,
E_uwAIWarningUnknownFunc,
E_uwAIWarningUnknownProcedure,
E_uwAIWarningUnknownKeyWord,
E_uwAIWarningInvalidAction,
E_uwAIWarningUnknownNode,
E_uwAIWarningReferenceNotLoaded,
E_uwAIWarningWrongParamAction,
E_uwAIWarningInvalidUseOfUltraOperator,
E_uwAIWarningWrongTypeVar,
#endif
#endif /*__WARNING_ERR_AI__*/
E_uwAIErrNumber
} e_uwAIErrNumber;
/*------------------*/
/* Global Variables*/
/*------------------*/
#undef EXTERN_ERRAI
#undef extern
#ifndef __DeclareGlobalVariableErrAI_h__
#define EXTERN_ERRAI extern /*external declaration*/
#else /*__DeclareGlobalVariableErrAI_h__*/
#define EXTERN_ERRAI /*replace by nothing : we have to declare*/
#endif /*__DeclareGlobalVariableErrAI_h__*/
EXTERN_ERRAI unsigned char g_ucAIModuleId /*number of identification of the Erm module*/
#ifdef __DeclareGlobalVariableErrAI_h__
= C_ucModuleNotInitialized
#endif /*__DeclareGlobalVariableErrAI_h__*/
;
#ifdef __ERROR_STRINGS__
EXTERN_ERRAI char * g_a_szAIInformationModule []
#if defined(__DeclareGlobalVariableErrAI_h__) && !defined(CPA_WANTS_IMPORT)
= {C_szAIVersion, C_szAIFullName, C_szAIDate}
#endif /*__DeclareGlobalVariableErrAI_h__ && CPA_WANTS_IMPORT*/
;
EXTERN_ERRAI char * g_szAIModuleName /* Obliged syntax 'g_sz'+[Abbreviation of ModuleName]+'ModuleName'*/
#ifdef __DeclareGlobalVariableErrAI_h__
= "Module AI"
#endif /*__DeclareGlobalVariableErrAI_h__*/
;
EXTERN_ERRAI /*struct!!y!!*/ tdstErrorMsg/*_!!y!!*/ g_a_stAITabErr [] /* Obliged syntax 'g_a_st'+[Abbreviation of ModuleName]+'TabErr'*/
#ifdef __DeclareGlobalVariableErrAI_h__/*Call from main program*/
={
#ifdef __FATAL_ERR_AI__
/* -------------*/
E_uwAIFatalNotAFatalError, "This is not a valide AI fatal error",
E_uwAIFatalTooMuchCond, "Too much Conditions Loaded",
E_uwAIFatalTooMuchAction, "Too much Actions Loaded",
E_uwAIFatalTooMuchParamCond, "Too much parameters for the Condition",
E_uwAIFatalTooMuchParamAction, "Too much parameters for the Action",
E_uwAIFatalNoEltInStackCond, "There is no element in condition stack",
E_uwAIFatalTooMuchEltInStackCond, "Too much elements in condition stack",
E_uwAIFatalWrongParamCond, "Wrong number of parameter in the Condition",
E_uwAIFatalWrongParamAction, "Wrong number of parameter",
E_uwAIFatalNotValidField, "Wrong field in perso struct",
E_uwAIFatalInvalidAction, "Invalid action",
E_uwAIFatalFailedAllocationMem, "Problem during an allocation memory",
E_uwAIFatalWrongTypeVar, "Script Read Problem: The type of the variable is not valid",
E_uwAIFatalPersoListFull, "The Perso List is Full",
E_uwAIFatalPbPersoListInsert, "The insert position in the Perso List is not available",
E_uwAIFatalPbDeleteInPersoList, "Wrong specified position in the Perso list! Can not delete the perso",
E_uwAIFatalUnknownFieldName, "Unknown Field Name",
E_uwAIFatalUnknownFunc, "Unknown Function Name",
E_uwAIFatalUnknownProcedure, "Unknown Procedure name",
E_uwAIFatalUnknownCond, "Unknown Condition Name",
E_uwAIFatalNotValidPriority, "Priority of rule must be greater than 0",
E_uwAIFatalUnknownKeyWord, "Unknown KeyWord Name",
E_uwAIFatalTooMuchNode, "Too much Node Interpret Loaded",
E_uwAIActionTableTooSmall, "Action table is too small",
E_uwAIBadLeftInAffectation, "Bad Type for left operand in affectation",
E_uwAIFatalBadComportNumber,"Bad comportment number",
E_uwAIFatalBadNodeNumber,"Bad node number",
E_uwAIFatalBadRuleNumber,"Bad rule number",
E_uwAIFatalNodeNotInRule,"CreateNode section not in CreateRule section",
E_uwAIFatalRuleNotInComport,"CreateRule section not in CreateComport section",
E_uwAIFatalComportNotInIntelligence,"CreateComport section not in CreateIntelligence section",
E_uwAIFatalCantFindPerso, "Can't find perso",
E_uwAIFatalUnknownNode,"Unknown node",
E_uwAIFatalInvalidAccessToField, "Invalid access to field",
E_uwAIFatalInvalidAccessToDsgVar,"Invalid access to dsgvar",
E_uwAIFatalInvalidAccessToFieldOrDsgVar,"Invalid access to dsgvar or field",
E_uwAIFatalNotAGoodAction, "Not a good action to change to",
E_uwAIFatalWrongTypeParamAction, "Wrong type for action's parameter",
E_uwAIFatalNotValidFunction, "This is not a valid Function",
E_uwAIFatalNotValidProcedure, "This is not a valid Procedure",
E_uwAIFatalNotValidDsgVarId, "Wrong Variable Designer ID",
E_uwAIFatalNotValidOperator, "This is not a valid operator",
E_uwAIFatalNotValidCondition, "This is not a valid condition",
E_uwAIFatalUnknownOperator, "Unknown operator",
E_uwAIFatalInvalidParameter,"A function parameter is invalid",
E_uwAIFatalInvalidWPValue, "WP handle is invalid",
E_uwAIFatalArrayAlreadyFull,"Attempt to add an element to the array though it is already full",
E_uwAIFatalArrayEmpty,"Attempt to access to an element in the array though it is empty",
E_uwAIFatalAssertionFailure,"Assertion failure",
E_uwAIFatalTypeLinkInvalid,"The type of the link is invalid",
E_uwAIFatalDynTypeLinkInvalid,"The dynamic type of the link is invalid",
E_uwAIFatalWayPositionInvalid,"The position specified for the access of a WP or a link in the way is invalid",
E_uwAIFatalWayFirstLinkMustBeLine,"The first link must be a line (only for mode NbrOfLink = NbrOf WP)",
E_uwAIFatalNullVectorNotAllowed,"Null vector is not allowed for this function",
E_uwAIFatalBadEntryAIModel, "Bad entry in AIModel Script",
E_uwAIWrongOperatorInLeftAffect, "Wrong operator in left parameter of affect function",
E_uwAIDivisionByZero,"Division by zero",
E_uwAIFatalNoDynamics, "No Dynamics found",
E_uwAIFatalUnknownButton, "Button not defined",
E_uwAIFatalReferenceNotLoaded,"Reference not loaded",
E_uwAIFatalScriptError, "There was an error in the script",
E_uwAIFatalNotMSCamera, "Super Object is not a camera",
E_uwAIFatalInvalidUseOfUltraOperator, "Invalid use of Ultra operator",
E_uwAIFatalInvalidModelCast,"Invalid model cast",
E_uwAIFatalInvalidDsgvarSaveType,"Invalid save type for designer variable",
#endif /*__FATAL_ERR_AI__*/
#ifdef __WARNING_ERR_AI__
/* ----------------*/
E_uwAIWarningCanNotFree, "Memory problem for free",
E_uwAIWarningTruncateAffectation, "Strange a (out of range) designer variable has been truncated ",
E_uwAIWarningBadType,"Field or variable designer have not correct type to store the passed value",
E_uwAIWarningChangeToCurrentComport, "Change comport to the same comport",
E_uwAIWarningCycleComport, "Cycle in comportement changing",
E_uwAIWarningArrayCyclingComportTooSmall, "The array for cycling comport is too small",
E_uwAIWarningExecuteActionInt, "The execute action has interrupted",
E_uwAIWarningComportOfAnotherPerso,"This comport doesn't belong to perso",
E_uwAIDebugDynamicAllocation,"Debug version : dynamic allocation in bloc AI (don't forget to increase the bloc)",
E_uwAIWarningScriptError ,"This is a warning about AI script",
E_uwAIWarningEngineGoto,"Wrong use of EngineGoto",
E_uwAIWarningChannelNotControlled, "Call of a repositionning procedure on an uncontrolled channel",
#if defined(ACTIVE_EDITOR) /* usefull for ACTIVE_1STPASS_CHECKING*/
E_uwAIWarningUnknownCond ,"Unknown Condition Name",
E_uwAIWarningUnknownFieldName ,"Unknown Field Name",
E_uwAIWarningUnknownOperator ,"Unknown Operator Name",
E_uwAIWarningUnknownFunc ,"Unknown Function Name",
E_uwAIWarningUnknownProcedure ,"Unknown Procedure name",
E_uwAIWarningUnknownKeyWord ,"Unknown Keyword name",
E_uwAIWarningInvalidAction ,"Unknown Action name",
E_uwAIWarningUnknownNode ,"Unknown Node",
E_uwAIWarningReferenceNotLoaded,"Reference not loaded",
E_uwAIWarningWrongParamAction ,"Wrong number of parameter",
E_uwAIWarningInvalidUseOfUltraOperator,"Invalid use of Ultra operator",
E_uwAIWarningWrongTypeVar ,"Script Read Problem: The type of the variable is not valid",
#endif
#endif /*__WARNING_ERR_AI__*/
0xFFFF, "\0"/*fin*/
};
#endif /*__DeclareGlobalVariableErrAI_h__*/
;
#undef extern
#endif /*__ERROR_STRINGS__*/
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /*__ERRAI_H__*/

View File

@@ -0,0 +1,55 @@
/*---------------------------------------------------------------------------*/
/* AIFunct.c : */
/* author : Olivier Didelot.*/
/* date : 30/01/1997*/
/*---------------------------------------------------------------------------*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AI_Struc.h"
#include "AI_Funct.h"
char* AI_fn_pszGetActorName (HIE_tdxHandleToSuperObject hSupObj)
{
AI_tdxHandleToMind hMind;
if (!M_GetMSHandle((hSupObj), Brain)) return NULL;
hMind = AI_M_stGetMindOfSuperObj (hSupObj);
if (!hMind) return NULL;
return AI_M_szGetPersoName(hMind);
}
char* AI_fn_pszGetFamilyName (HIE_tdxHandleToSuperObject hSupObj, char* szBuffer)
{
MS_tdxHandleTo3dData h_3dData;
tdxHandleToState hInitialState;
char cCar;
long lCounter;
h_3dData = M_GetMSHandle(hSupObj,3dData);
if (!h_3dData) return NULL;
hInitialState = fn_h3dDataGetInitialState (h_3dData);
if (!hInitialState) return NULL;
strcpy ( szBuffer, fn_p_szGetStateName(hInitialState) );
for (lCounter=0 ;; lCounter++)
{
cCar = szBuffer[lCounter];
if (cCar==0) return NULL;
if (cCar==' ')
{
szBuffer[lCounter]=0;
return szBuffer;
}
}
return NULL;
}

View File

@@ -0,0 +1,51 @@
/*///////////////////////////////////////////////////////////*/
/* //*/
/* Memory Management of the Module : AI //*/
/* // */
/* File Name : MmgAI.h //*/
/* Date : 703/10/96 //*/
/* Author : First_Name Last_Name //*/
/* //*/
/*///////////////////////////////////////////////////////////*/
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
#ifndef __MmgAI_H__
#define __MmgAI_H__
enum e_ucAIStaticBlocks
{
E_ucAIBlockFix,
E_ucAIBlockLevel,
E_ucAIMaxBlocksNb /* maximum number of static block, You have to follow this syntax 'E_uc+ Abbreviation Module +MaxBlocksNb'*/
};
#undef EXTERN_MEMAI
#undef extern
#ifdef __DeclareGlobalVariableMmgAI_h__
#define EXTERN_MEMAI /*nothing*/
#else /* no __DeclareGlobalVariableMmgAI_h__*/
#define EXTERN_MEMAI extern
#endif /*__DeclareGlobalVariableMmgAI_h__*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
EXTERN_MEMAI CPA_EXPORT tdstBlockInfo g_a_stAIBlocksInfo[E_ucAIMaxBlocksNb];
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifdef __DYNAMIC_MALLOC_ALLOWED__
#ifdef __DEBUG_MALLOC_MODE__
EXTERN_MEMAI CPA_EXPORT tdstDynInfo g_stAIDynInfo;
#endif /*__DEBUG_MALLOC_MODE__*/
#endif /*__DYNAMIC_MALLOC_ALLOWED__*/
#endif /*__MmgAI_H__*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*/
/* Action parameters functions and macros for intelligence engine*/
/* author : Olivier Couvreur*/
/* date : 7/11/1996*/
/* modify : Fabien MORALES*/
/* date : 29/01/1997 Vertex param*/
/* modify : Olivier Couvreur*/
/* date : 03/02/1997 Lint 0 warnings*/
/* modify : Olivier Couvreur*/
/* date : 09/02/1997 error handling*/
/* modify : Olivier Couvreur 23/04/97 MMG + DIR*/
/*---------------------------------------------------------------------------*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "StrIntel.h"
#include "AI_Struc.h"
#include "specif/ActTable.h"
/* XB 20/05/1999 */
#ifndef D_THROW_COMPLEX_ACTION_TABLE
#define M_ActionParam(n) M_ActionTableParam((n),M_ActionTableCurrentEntry(n))
/* En Bref un truc du genre*/
/* M_ActionParam(p_stIntellOrReflex)*/
/* =*/
/* p_stIntelligence->stActionTable.a_stEntry[p_stIntelligence->stActionTable.ucCurrentEntry].stActionParam*/
#else /* D_THROW_COMPLEX_ACTION_TABLE */
#define M_ActionParam(n) M_ActionTableParam0((n))
#endif /* D_THROW_COMPLEX_ACTION_TABLE */
/* End XB 20/05/1999 */
#define M_InternalSetActionParam(p_SuperObjPerso, ucN, Value, AccesMacro) \
tdstIntelligence *p_stIntellOrReflex = M_GetIntellOrReflex(AI_M_stGetMindOfSuperObj((p_SuperObjPerso))); \
##AccesMacro(&M_ActionParam(p_stIntellOrReflex).a_uParam[(ucN)]) = (Value);
#if defined(__DEBUG_AI__)
#define M_SetActionParam(p_SuperObjPerso, ucN, Value, AccesMacro) \
if (ucN<C_MAX_NB_PARAM) \
{\
M_InternalSetActionParam(p_SuperObjPerso, ucN, Value, AccesMacro); \
}\
else\
{\
M_AIFatalError(E_uwAIFatalInvalidParameter);\
}
#else
#define M_SetActionParam(p_SuperObjPerso, ucN, Value, AccesMacro) M_InternalSetActionParam(p_SuperObjPerso, ucN, Value, AccesMacro);
#endif /* __DEBUG_AI__*/
#define M_InternalGetActionParam(p_SuperObjPerso, ucN, AccesMacro) \
tdstIntelligence *p_stIntellOrReflex = M_GetIntellOrReflex(AI_M_stGetMindOfSuperObj((p_SuperObjPerso))); \
return(##AccesMacro(&M_ActionParam(p_stIntellOrReflex).a_uParam[(ucN)]));
#if defined(__DEBUG_AI__)
#define M_GetActionParam(p_SuperObjPerso, ucN, DefaultReturnValue, AccesMacro) \
if (ucN<C_MAX_NB_PARAM) \
{\
M_InternalGetActionParam(p_SuperObjPerso, ucN, AccesMacro); \
}\
else\
{\
M_AIFatalError(E_uwAIFatalInvalidParameter);\
return DefaultReturnValue; \
}
#else
#define M_GetActionParam(p_SuperObjPerso, ucN, DefaultReturnValue, AccesMacro) M_InternalGetActionParam(p_SuperObjPerso, ucN, AccesMacro);
#endif /* __DEBUG_AI__*/
/****************************************************************************************/
/* ACCESS TO ACTION PARAMETERS */
/****************************************************************************************/
/* REAL_PARAM*/
void fn_vSetActionParamxValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH_tdxReal xValue)
{
M_SetActionParam(p_SuperObjPerso, ucN, xValue, M_tduGetSetParam_xValue);
}
MTH_tdxReal fn_xGetActionParamxValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
M_GetActionParam(p_SuperObjPerso, ucN, MTH_M_xLongToReal(0), M_tduGetSetParam_xValue);
}
/* CGHT */
/* LIPSYNCHRO_PARAM*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetActionParamhLipsSynchro(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso,tdxHandleOfLipsSynchroTable hLipsSynchro)
{
M_SetActionParam(p_SuperObjPerso, ucN, hLipsSynchro, M_tduGetSetParam_hLipsSynchro);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleOfLipsSynchroTable fn_p_stGetActionParamhLipsSynchro(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
M_GetActionParam(p_SuperObjPerso, ucN, NULL, M_tduGetSetParam_hLipsSynchro);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* CONSTANT_PARAM*/
void fn_vSetActionParamlValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso, long lValue)
{
M_SetActionParam(p_SuperObjPerso, ucN, lValue, M_tduGetSetParam_lValue);
}
long fn_lGetActionParamlValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
M_GetActionParam(p_SuperObjPerso, ucN, 0, M_tduGetSetParam_lValue);
}
/* ACTION_PARAM*/
void fn_vSetActionParamStateValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso, tdxHandleToState hState)
{
M_SetActionParam(p_SuperObjPerso, ucN, hState, M_tduGetSetParam_HandleToState);
}
tdxHandleToState fn_xGetActionParamStateValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
M_GetActionParam(p_SuperObjPerso, ucN, NULL, M_tduGetSetParam_HandleToState);
}
/* VERTEX_PARAM*/
void fn_vSetActionParamp_stVertex(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH3D_tdstVector *p_stVertex)
{
#if defined(__DEBUG_AI__)
if (ucN < C_MAX_NB_PARAM)
{
#endif
tdstIntelligence *p_stIntellOrReflex = M_GetIntellOrReflex(AI_M_stGetMindOfSuperObj(p_SuperObjPerso));
MTH3D_M_vCopyVector( &M_tduGetSetParam_stVertexValue(&M_ActionParam(p_stIntellOrReflex).a_uParam[ucN]), p_stVertex );
#if defined(__DEBUG_AI__)
}
else
{
M_AIFatalError(E_uwAIFatalInvalidParameter);
}
#endif
}
MTH3D_tdstVector *fn_p_stGetActionParamp_stVertex(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
tdstIntelligence *p_stIntellOrReflex = M_GetIntellOrReflex(AI_M_stGetMindOfSuperObj(p_SuperObjPerso));
#if defined(__DEBUG_AI__)
if (ucN < C_MAX_NB_PARAM)
{
#endif
return(&M_tduGetSetParam_stVertexValue(&M_ActionParam(p_stIntellOrReflex).a_uParam[ucN]) );
#if defined(__DEBUG_AI__)
}
else
{
M_AIFatalError(E_uwAIFatalInvalidParameter);
return(NULL);
}
#endif
}

View File

@@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*/
/* Action parameters functions and macros for intelligence engine*/
/* author : Olivier Couvreur*/
/* date : 7/11/1996*/
/* modify : Fabien MORALES*/
/* date : 29/01/1997 Vertex param*/
/* modify : Olivier COUVREUR*/
/* date : 10/02/1997 error handling + */
/* modify : Fabien MORALES*/
/* date : 05/02/1997 Several Vertex params*/
/* modify : Fabien MORALES*/
/* date : 12/02/1997 Several long params*/
/*---------------------------------------------------------------------------*/
#if !defined(__ACTPARAM_H__)
#define __ACTPARAM_H__
#include "Convert.h"
#include "Strintel.h"
typedef struct tdstActionParam_
{
tduGetSetParam a_uParam[C_MAX_NB_PARAM];
} tdstActionParam;
/* real*/
void fn_vSetActionParamxValue(unsigned char ucN,HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH_tdxReal xValue);
MTH_tdxReal fn_xGetActionParamxValue(unsigned char ucN,HIE_tdxHandleToSuperObject p_SuperObjPerso);
/* lips synchro CGHT*/
void fn_vSetActionParamhLipsSynchro(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso,tdxHandleOfLipsSynchroTable hLipsSynchro);
tdxHandleOfLipsSynchroTable fn_p_stGetActionParamhLipsSynchro(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso);
/* constant*/
void fn_vSetActionParamlValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso, long lValue);
long fn_lGetActionParamlValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso);
/* Vertex */
void fn_vSetActionParamp_stVertex(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH3D_tdstVector *p_stVertex);
MTH3D_tdstVector *fn_p_stGetActionParamp_stVertex(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso);
/* Action*/
void fn_vSetActionParamStateValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso, tdxHandleToState hState);
tdxHandleToState fn_xGetActionParamStateValue(unsigned char ucN, HIE_tdxHandleToSuperObject p_SuperObjPerso);
#endif

View File

@@ -0,0 +1,494 @@
/*---------------------------------------------------------------------------*/
/* Action table functions for intelligence engine*/
/* author : Olivier Couvreur*/
/* modify : 07/11/96 Olivier Couvreur */
/* modify : 03/02/97 Olivier Couvreur Lint 0 warnings */
/* modify : 26/02/97 Olivier Couvreur added Schedule support + Lint 0 warnings*/
/* modify : 05/03/97 Olivier Couvreur added Schedule function + Lint 0 warnings*/
/* modify : 25/03/97 Olivier Couvreur added REVERSE_RULES support + optimizations (not yet activated)*/
/*---------------------------------------------------------------------------*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "specif/ActTable.h"
#include "StrIntel.h"
#include "Action.h"
/*****************************************************************************************************/
/* here we can have more than one action in action table */
/* XB 20/05/1999 */
#ifndef D_THROW_COMPLEX_ACTION_TABLE
/* OPTIMIZE_ACTION_TABLE is defined in AIOption.h*/
/* check if a rule is in action table : return entry number*/
unsigned char fn_ucIsRuleInActionTable(tdstIntelligence *p_stIntelligence,unsigned char ucNumRule)
{
/* Modif YLG*/
unsigned char ucNbEntries;
ucNbEntries = M_ActionTableNbEntries(p_stIntelligence);
if (M_IsActionTableUsed(p_stIntelligence))
{
unsigned char ucCurrentEntry;
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntryN(p_stIntelligence, 0));
for (ucCurrentEntry=0;ucCurrentEntry<ucNbEntries;ucCurrentEntry++, p_stEntry++)
{
if (p_stEntry->bUsed)
{
if (p_stEntry->ucNumRule==ucNumRule)
{
return(ucCurrentEntry);
}
}
}
}
return (ucNbEntries);
}
/* check if a rule and a node are in action table : return entry number*/
unsigned char fn_ucIsRuleAndNodeInActionTable(tdstIntelligence *p_stIntelligence,unsigned char ucNumRule,tdstNodeInterpret *p_stNode)
{
/* Modif YLG*/
unsigned char ucNbEntries;
ucNbEntries = M_ActionTableNbEntries(p_stIntelligence);
if (M_IsActionTableUsed(p_stIntelligence))
{
unsigned char ucCurrentEntry;
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntryN(p_stIntelligence, 0));
for (ucCurrentEntry=0;ucCurrentEntry<ucNbEntries;ucCurrentEntry++, p_stEntry++)
{
/* if (M_ActionTableUseFlag(p_stIntelligence,ucCurrentEntry))*/
if (p_stEntry->bUsed)
{
/* if (M_ActionTableNumRule(p_stIntelligence,ucCurrentEntry)==ucNumRule)*/
if (p_stEntry->ucNumRule==ucNumRule)
{
/* if (M_ActionTableNumNode(p_stIntelligence,ucCurrentEntry)==p_stNode)*/
if (p_stEntry->p_stNode ==p_stNode)
{
return(ucCurrentEntry);
}
}
}
}
}
/* return(M_ActionTableNbEntries(p_stIntelligence));*/
return (ucNbEntries);
}
/* find a free entry in action table : return entry number*/
unsigned char fn_ucFindPlaceInActionTable(tdstIntelligence *p_stIntelligence)
{
/* Modif YLG*/
unsigned char ucCurrentEntry;
unsigned char ucNbEntries;
ucNbEntries = M_ActionTableNbEntries(p_stIntelligence);
/* if (M_ActionTableNbEntriesUsed(p_stIntelligence)<M_ActionTableNbEntries(p_stIntelligence))*/
if (M_ActionTableNbEntriesUsed(p_stIntelligence)<ucNbEntries)
{
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntryN(p_stIntelligence, 0));
/* for (ucCurrentEntry=0;ucCurrentEntry<M_ActionTableNbEntries(p_stIntelligence);ucCurrentEntry++)*/
for (ucCurrentEntry=0;ucCurrentEntry<ucNbEntries;ucCurrentEntry++,p_stEntry++)
{
/* if (!M_ActionTableUseFlag(p_stIntelligence,ucCurrentEntry))*/
if (!p_stEntry->bUsed)
{
return(ucCurrentEntry);
}
}
}
/* return(M_ActionTableNbEntries(p_stIntelligence));*/
return (ucNbEntries);
}
static void fn_vInitActionTableEntry(tdstIntelligence *p_stIntelligence,unsigned char ucNEntry,unsigned char ucNumRule,tdstNodeInterpret *p_stNode,unsigned char bfUsed)
{
/* modif YLG*/
M_ActionTableUseActionReturn(p_stIntelligence,ucNEntry) = g_ucUseDefaultActionReturn;
M_ActionTableNewActionReturn(p_stIntelligence,ucNEntry) = g_ucNewActionReturn;
M_ActionTableUseFlag(p_stIntelligence,ucNEntry)=bfUsed;
M_ActionTableNumNode(p_stIntelligence,ucNEntry)=p_stNode;
M_ActionTableNumRule(p_stIntelligence,ucNEntry)=ucNumRule;
memset(&(M_ActionTableParam(p_stIntelligence,ucNEntry)),0,sizeof(M_ActionTableParam(p_stIntelligence,ucNEntry)));
}
#if !defined(OPTIMIZE_ACTION_TABLE)
/* internal function*/
void fn_vUpdateActionTable(tdstIntelligence *p_stIntelligence)
{
unsigned char ucCurrentEntry;
M_ActionTableNbEntriesUsed(p_stIntelligence)=0;
for (ucCurrentEntry=0;ucCurrentEntry<M_ActionTableNbEntries(p_stIntelligence);ucCurrentEntry++)
{
if (M_ActionTableUseFlag(p_stIntelligence,ucCurrentEntry))
{
/*update NbEntriesUsed */
M_ActionTableNbEntriesUsed(p_stIntelligence)+=1;
}
}
}
#endif
/* use current entry in action table*/
void fn_vUseCurrentActionTableEntry(tdstIntelligence *p_stIntelligence,unsigned char ucNRule,tdstNodeInterpret *p_stNode)
{
#if defined(OPTIMIZE_ACTION_TABLE)
unsigned char ucCurrentEntry=M_ActionTableCurrentEntry(p_stIntelligence);
if (!M_ActionTableUseFlag(p_stIntelligence,ucCurrentEntry))
{
fn_vInitActionTableEntry(p_stIntelligence,ucCurrentEntry,ucNRule,p_stNode,1);
M_ActionTableNbEntriesUsed(p_stIntelligence)++;
}
#else
/* reinit current entry in action table*/
fn_vInitActionTableEntry(p_stIntelligence,M_ActionTableCurrentEntry(p_stIntelligence),ucNRule,p_stNode,1);
/* update action table*/
fn_vUpdateActionTable(p_stIntelligence);
#endif /* reinit current entry in action table*/
}
/* free current entry in action table*/
void fn_vUnuseCurrentActionTableEntry(tdstIntelligence *p_stIntelligence)
{
/* YLG Modif*/
#if defined(OPTIMIZE_ACTION_TABLE)
unsigned char ucCurrentEntry=M_ActionTableCurrentEntry(p_stIntelligence);
if (M_ActionTableUseFlag(p_stIntelligence,ucCurrentEntry))
{
fn_vInitActionTableEntry(p_stIntelligence,ucCurrentEntry,0,NULL,0);
M_ActionTableNbEntriesUsed(p_stIntelligence)--;
}
#else
/* reinit current entry in action table*/
fn_vInitActionTableEntry(p_stIntelligence,M_ActionTableCurrentEntry(p_stIntelligence),0,NULL,0);
/* update action table*/
fn_vUpdateActionTable(p_stIntelligence);
#endif
}
void fn_vUnuseAllRulesWhichHaveGreaterNumRule(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNumRule)
{
/* Modif YLG*/
unsigned char ucNbEntries;
ucNbEntries = M_ActionTableNbEntries(p_stIntelligence);
/* action table not used*/
if (M_IsActionTableUsed(p_stIntelligence))
{
unsigned char ucCurrentEntry;
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntryN(p_stIntelligence, 0));
for (ucCurrentEntry=0;ucCurrentEntry<ucNbEntries;ucCurrentEntry++, p_stEntry++)
{
/* if (M_ActionTableUseFlag(p_stIntelligence,ucCurrentEntry))*/
if (p_stEntry->bUsed)
{
if (
/* exclude rule from schedule*/
/* (M_ActionTableNumRule(p_stIntelligence,ucCurrentEntry)>0)*/
/* &&(M_ActionTableNumRule(p_stIntelligence,ucCurrentEntry)>ucNumRule)*/
p_stEntry -> ucNumRule > ucNumRule
)
{
fn_vInitActionTableEntry(p_stIntelligence,ucCurrentEntry,0,NULL,0);
M_ActionTableNbEntriesUsed(p_stIntelligence)--;
}
}
}
/* update action table*/
#if !defined(OPTIMIZE_ACTION_TABLE)
fn_vUpdateActionTable(p_stIntelligence);
#endif
}
}
void fn_vUnuseAllRulesFromSchedule(struct tdstIntelligence_ *p_stIntelligence)
{
/* Modif YLG*/
unsigned char ucNbEntries;
/* action table not used*/
if (M_IsActionTableUsed(p_stIntelligence))
{
unsigned char ucCurrentEntry;
struct tdstActionTableEntry_ *p_stEntry;
ucNbEntries = M_ActionTableNbEntries(p_stIntelligence);
p_stEntry = &(M_ActionTableEntryN(p_stIntelligence, 0));
/* for (ucCurrentEntry=0;ucCurrentEntry<M_ActionTableNbEntries(p_stIntelligence);ucCurrentEntry++)*/
for (ucCurrentEntry=0;ucCurrentEntry<ucNbEntries;ucCurrentEntry++, p_stEntry++)
{
/* if (M_ActionTableUseFlag(p_stIntelligence,ucCurrentEntry))*/
if (p_stEntry->bUsed)
{
/* only rule from schedule*/
/* if (M_ActionTableNumRule(p_stIntelligence,ucCurrentEntry)==0)*/
if (p_stEntry->ucNumRule==0)
{
fn_vInitActionTableEntry(p_stIntelligence,ucCurrentEntry,0,NULL,0);
/*M_ActionTableNbEntriesUsed(p_stIntelligence)--;*/
ucNbEntries --;
}
}
}
M_ActionTableNbEntriesUsed(p_stIntelligence) = ucNbEntries;
#if !defined(OPTIMIZE_ACTION_TABLE)
/* update action table*/
fn_vUpdateActionTable(p_stIntelligence);
#endif
}
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdstNodeInterpret *fn_p_stGetScheduleFromActionTableAndClearIt(tdstIntelligence *p_stIntelligence)
{
/* MOdif ylg*/
tdstNodeInterpret *p_stFoundSchedule=NULL;
unsigned char ucNbEntries;
/* action table not used*/
if (M_IsActionTableUsed(p_stIntelligence))
{
unsigned char ucCurrentEntry;
struct tdstActionTableEntry_ *p_stEntry;
ucNbEntries = M_ActionTableNbEntries(p_stIntelligence);
p_stEntry = &(M_ActionTableEntryN(p_stIntelligence, 0));
/* loop in action table*/
/* for (ucCurrentEntry=0;ucCurrentEntry<M_ActionTableNbEntries(p_stIntelligence);ucCurrentEntry++)*/
for (ucCurrentEntry=0;ucCurrentEntry<ucNbEntries;ucCurrentEntry++, p_stEntry++)
{
/* is this entry used ?*/
/* if (M_ActionTableUseFlag(p_stIntelligence,ucCurrentEntry))*/
if (p_stEntry->bUsed)
{
/* is this entry belonging to schedule (==0) ?*/
/*if (M_ActionTableNumRule(p_stIntelligence,ucCurrentEntry)==0)*/
if (p_stEntry->ucNumRule==0)
{
/* keep the first one found*/
/*
if (p_stFoundSchedule==NULL)
{
p_stFoundSchedule=M_ActionTableNumNode(p_stIntelligence,ucCurrentEntry);
}
*/
/* keep the first one found or the first one in the schedule*/
/* if ( (p_stFoundSchedule==NULL) || (M_ActionTableNumNode(p_stIntelligence,ucCurrentEntry)<p_stFoundSchedule) )*/
if ( (p_stFoundSchedule==NULL) || (p_stEntry->p_stNode<p_stFoundSchedule) )
{
/* p_stFoundSchedule=M_ActionTableNumNode(p_stIntelligence,ucCurrentEntry);*/
p_stFoundSchedule=p_stEntry->p_stNode;
}
/* clear schedule entry*/
fn_vInitActionTableEntry(p_stIntelligence,ucCurrentEntry,0,NULL,0);
/* M_ActionTableNbEntriesUsed(p_stIntelligence)--;*/
ucNbEntries --;
}
}
}
M_ActionTableNbEntriesUsed(p_stIntelligence) = ucNbEntries;
#if !defined(OPTIMIZE_ACTION_TABLE)
/* update action table*/
fn_vUpdateActionTable(p_stIntelligence);
#endif
}
return(p_stFoundSchedule);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* used by InitPerso*/
void fn_vInitActionTable(tdstIntelligence *p_stIntelligence)
{
/* Modif YLG*/
unsigned char ucNEntry;
unsigned char ucNbEntries;
M_ActionTableNbEntriesUsed(p_stIntelligence)=0;
M_ActionTableCurrentEntry(p_stIntelligence)=0;
ucNbEntries = M_ActionTableNbEntries(p_stIntelligence);
/* for (ucNEntry=0;ucNEntry<M_ActionTableNbEntries(p_stIntelligence);ucNEntry++)*/
for (ucNEntry=0;ucNEntry<ucNbEntries;ucNEntry++)
{
fn_vInitActionTableEntry(p_stIntelligence,ucNEntry,0,NULL,0);
}
}
tdstNodeInterpret *fn_p_stGetTableAction(tdstIntelligence *p_stIntelligence, unsigned char ucNEntry)
{
/* Modif YLG*/
/* fn_vSetUseDefaultActionReturnValue(M_ActionTableUseActionReturn(p_stIntelligence,ucNEntry));*/
g_ucUseDefaultActionReturn = M_ActionTableUseActionReturn(p_stIntelligence,ucNEntry);
/* fn_vSetNewActionReturnValue(M_ActionTableNewActionReturn(p_stIntelligence,ucNEntry));*/
g_ucNewActionReturn = M_ActionTableNewActionReturn(p_stIntelligence,ucNEntry);
return M_ActionTableNumNode(p_stIntelligence, ucNEntry);
}
/*****************************************************************************************************/
/* here only one action in action table */
#else /* D_THROW_COMPLEX_ACTION_TABLE */
/* check if a rule is in action table : return entry number*/
unsigned char fn_ucIsRuleInActionTable(tdstIntelligence *p_stIntelligence,unsigned char ucNumRule)
{
if(M_ActionTable(p_stIntelligence))
{
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntry0(p_stIntelligence));
if((p_stEntry->bUsed == TRUE) &&
(p_stEntry->ucNumRule == ucNumRule))
{
return 0;
}
}
return 1;
}
/* check if a rule and a node are in action table : return entry number*/
unsigned char fn_ucIsRuleAndNodeInActionTable(tdstIntelligence *p_stIntelligence,unsigned char ucNumRule,tdstNodeInterpret *p_stNode)
{
if(M_ActionTable(p_stIntelligence))
{
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntry0(p_stIntelligence));
if((p_stEntry->bUsed == TRUE) &&
(p_stEntry->ucNumRule == ucNumRule) &&
(p_stEntry->p_stNode == p_stNode))
{
return 0;
}
}
return 1;
}
/* find a free entry in action table : return entry number*/
unsigned char fn_ucFindPlaceInActionTable(tdstIntelligence *p_stIntelligence)
{
if(M_ActionTable(p_stIntelligence))
{
if(!(M_ActionTableUseFlag0(p_stIntelligence)))
{
return 0;
}
}
return 1;
}
static void fn_vInitActionTableEntry(tdstIntelligence *p_stIntelligence,unsigned char ucNumRule,tdstNodeInterpret *p_stNode,unsigned char bfUsed)
{
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntry0(p_stIntelligence));
p_stEntry->bUseDefaultActionReturn=g_ucUseDefaultActionReturn;
p_stEntry->ucNewActionReturn=g_ucNewActionReturn;
p_stEntry->bUsed=bfUsed;
p_stEntry->p_stNode=p_stNode;
p_stEntry->ucNumRule=ucNumRule;
memset(&(p_stEntry->stActionParam),0,sizeof(p_stEntry->stActionParam));
}
/* use current entry in action table*/
void fn_vUseCurrentActionTableEntry(tdstIntelligence *p_stIntelligence,unsigned char ucNRule,tdstNodeInterpret *p_stNode)
{
if(!M_ActionTableUseFlag0(p_stIntelligence))
{
fn_vInitActionTableEntry(p_stIntelligence,ucNRule,p_stNode,1);
}
}
/* free current entry in action table*/
void fn_vUnuseCurrentActionTableEntry(tdstIntelligence *p_stIntelligence)
{
if (M_ActionTableUseFlag0(p_stIntelligence))
{
fn_vInitActionTableEntry(p_stIntelligence,0,NULL,0);
}
}
void fn_vUnuseAllRulesWhichHaveGreaterNumRule(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNumRule)
{
if(M_ActionTable(p_stIntelligence))
{
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntry0(p_stIntelligence));
if((p_stEntry->bUsed) &&
(p_stEntry->ucNumRule>ucNumRule))
{
fn_vInitActionTableEntry(p_stIntelligence,0,NULL,0);
}
}
}
void fn_vUnuseAllRulesFromSchedule(struct tdstIntelligence_ *p_stIntelligence)
{
if (M_ActionTable(p_stIntelligence))
{
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntry0(p_stIntelligence));
/* only rule from schedule*/
if((p_stEntry->bUsed) &&
(p_stEntry->ucNumRule==0))
{
fn_vInitActionTableEntry(p_stIntelligence,0,NULL,0);
}
}
}
/* used by InitPerso*/
void fn_vInitActionTable(tdstIntelligence *p_stIntelligence)
{
if(M_ActionTable(p_stIntelligence))
{
fn_vInitActionTableEntry(p_stIntelligence,0,NULL,0);
}
}
tdstNodeInterpret *fn_p_stGetTableAction(tdstIntelligence *p_stIntelligence, unsigned char ucNEntry)
{
struct tdstActionTableEntry_ *p_stEntry;
p_stEntry = &(M_ActionTableEntry0(p_stIntelligence));
g_ucUseDefaultActionReturn = p_stEntry->bUseDefaultActionReturn;
g_ucNewActionReturn = p_stEntry->ucNewActionReturn;
return p_stEntry->p_stNode;
}
#endif /* D_THROW_COMPLEX_ACTION_TABLE */
/* End XB 20/05/1999 */

View File

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

View File

@@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*/
/* Array.c : Typed array for AI.*/
/* author : Olivier Couvreur 28/11/1997*/
/*---------------------------------------------------------------------------*/
/* included in DsgMem.c so excluded from build in VC project*/
#include "AIUseCPA.h"
#include "AI_Mmg.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "gsparam.h"
#include "Array.h"
#include "dsgmem.h"
/*XB*/
#if defined(AI_USE_SCRIPT)
/*End XB*/
extern void fn_vInitDsgVarValue(void *p_MyVarAddr,tdeDsgVarTypeId eDsgVarTypeId,char * szParams[]);
void fn_vInitArray(struct tdstArray_ *p_stArray,enum tdeDsgVarTypeId_ eDsgVarType,unsigned char ucNbElements,char *szParams[])
{
M_ARRAY_SIZE(p_stArray)=ucNbElements;
M_ARRAY_TYPE(p_stArray)=eDsgVarType;
M_ARRAY_CLEAR(p_stArray);
if (szParams!=NULL)
{
char ucIndex=0;
char *p_MyVarAddr;
char **ptr=szParams+1;
while(ptr[2]!=NULL)
{
if (ucIndex<ucNbElements)
{
p_MyVarAddr=(char*) M_ARRAY_ELEMENT(p_stArray,ucIndex);
fn_vInitDsgVarValue(p_MyVarAddr,eDsgVarType,ptr);
if (eDsgVarType==eDsgVarType_Vector)
{
/*ptr+=3;*/
ptr++;
if (ptr[2]!=NULL) ptr++;
if (ptr[2]!=NULL) ptr++;
}
else
{
ptr++;
}
ucIndex++;
}
else
{
break;
}
}
}
}
/*XB*/
#endif /* AI_USE_SCRIPT */
/*End XB*/

View File

@@ -0,0 +1,476 @@
#define D_Brain_StructureDefine
#include "AIUseCPA.h"
#include "TypePtr.h"
#include "CFast.h"
#include "EnumProc.h"
#include "EnumCond.h"
#include "EnumAct.h"
#include "EnumFunc.h"
#include "EnumFild.h"
#include "EnumOper.h"
#include "EnumKey.h"
#include "ActConst.h"
#include "DsgMem.h"
#include "DsgMemC.h"
#include "Specif\AItools.h"
#ifndef U64
#include "sna.h"
#endif
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
extern void fn_vSetUltraOperatorPerso(HIE_tdxHandleToSuperObject hCurrentSuperObjPerso,HIE_tdxHandleToSuperObject hNewCurrentSuperObjPerso);
extern tdstNodeInterpret *fn_p_stOperatorGetPerso(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, HIE_tdxHandleToSuperObject *hSuperObjPersoFound) ;
extern void fn_vSetProcedureActionReturn(tducActionReturn ucActionReturn);
extern tducActionReturn fn_ucGetProcedureActionReturn(void);
tdstGetSetParam CFast_g_a_stParam[CFast_lMaxTreeDepth] ;
tdstNodeInterpret CFast_g_a_stPseudoTree[7][CFast_lMaxTreeDepth] ;
/*long CFast_g_a_lLong[CFast_lMaxTreeDepth] ;*/
tdp_fn_p_stConditionFunctionPtr CFast_g_p_fn_CondPtr ;
tdp_fn_p_stOperatorFunctionPtr CFast_g_p_fn_OpPtr ;
tdp_fn_p_stProcedureFunctionPtr CFast_g_p_fn_ProcPtr ;
tdp_fn_p_stFunctionFunctionPtr CFast_g_p_fn_FuncPtr ;
tdp_fn_p_stKeyWordFunctionPtr CFast_g_p_fn_KeyWordPtr ;
tdp_fn_p_stMetaActionInitFunctionPtr CFast_g_p_fn_MetaInitPtr ;
tdp_fn_ucMetaActionFunctionPtr CFast_g_p_fn_MetaPtr ;
ACP_tdxBool CFast_g_bProcessReflex ;
ACP_tdxBool CFast_g_bMetaActionInRfx ;
tdeTypeInterpret CFast_g_aEvt2Eti[] = {
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Real,
E_ti_String,
E_ti_WayPointRef,
E_ti_PersoRef,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_Constant,
E_ti_ConstantVector,
E_ti_Module,
E_ti_DsgVarRef,
E_ti_ActionRef,
E_ti_Button,
E_ti_Mask,
E_ti_Constant,
E_ti_LipsSynchroRef,
E_ti_ObjectTableRef,
E_ti_SuperObjectRef,
E_ti_Constant,
E_ti_FamilyRef,
E_ti_SoundEventRef,
E_ti_ComportRef,
E_ti_Constant,
E_ti_Constant,
E_ti_ParticleGenerator,
E_ti_GameMaterialRef,
E_ti_Color,
E_ti_ModelRef,
E_ti_Constant,
E_ti_Light,
E_ti_Caps,
E_ti_Graph
} ;
/* Mind of current perso */
AI_tdstMind *p_stGlobalMind;
struct tdstNodeInterpret_ *gp_stRefTree;
struct tdstNodeInterpret_ *gp_stPseudoTree;
HIE_tdxHandleToSuperObject g_hSuperObjectPerso;
char *p_cGlobalDsgMemBuffer;
tdstDsgVarInfo *p_stGlobalDsgVarInfo;
#define M_LocalGetDsgVarAddr(mind, ind) (p_cLocalDsgMemBuffer + p_stLocalDsgVarInfo[ind].ulOffsetInDsgMem)
/*#define M_LocalGetDsgVarAddr(mind, ind) (p_cLocalVarsArray[ind])*/
#ifdef __DEBUG_AI__
#ifdef ACTIVE_EDITOR
#define CFast_M_MakeNode(val, type, skip, depth, bpt) { {{(enum tdeCondId_)val}}, (tdeTypeInterpret)type, skip, depth }
#else
#define CFast_M_MakeNode(val, type, skip, depth, bpt) { {{(enum tdeCondId_)val}}, (tdeTypeInterpret)type, skip, depth }
#endif /* ACTIVE_EDITOR */
#else
#define CFast_M_MakeNode(val, type, skip, depth, bpt) { val, skip, depth, type }
#endif /* __DEBUG_AI__ */
#ifdef U64
#define CFast_M_MakeRef(a, b, c, d) { b, c, d }
#else
#define CFast_M_MakeRef(a, b, c, d) { b }
#endif
#ifdef U64
void CFast_vCalcAllCodeSizes(void) {
/*
long i = 0 ;
while( CFast_gast_ArrayFunctions[i].ml_SizeOfTree != 0L )
{
CFast_gast_ArrayFunctions[i].ml_SizeOfCode -= (long)(CFast_gast_ArrayFunctions[i].mfnv_Function);
i++ ;
}
*/
}
#endif /* U64 */
/***************************************/
void CFast_fn_vSetUltraOperatorPersoRef(int i)
{
fn_vSetUltraOperatorPerso(g_hSuperObjectPerso, M_GetSuperObject(M_p_stPersoRefInterpret(gp_stRefTree + i))) ;
}
/***************************************/
void CFast_fn_vSetUltraOperatorMainActor(void) {
fn_vSetUltraOperatorPerso(g_hSuperObjectPerso, MC_fn_hGetCharacterInMainCharacterNode(MC_fn_hGetFirstMainCharNode())) ;
}
/***************************************/
/*void CFast_fn_vSetUltraOperatorWorld(void) {
fn_vSetUltraOperatorPerso(g_hSuperObjectPerso, g_stEngineStructure.h_WorldCaracter) ;
}*/
/***************************************/
void CFast_fn_vSetUltraOperatorPersoVar(int i)
{
HIE_tdxHandleToSuperObject hNewCurrentSuperObjPerso;
tdstNodeInterpret stTmpTree;
M_SetTypeInterpret(&stTmpTree, E_ti_DsgVarRef);
M_lValueInterpret(&stTmpTree) = i;
fn_p_stOperatorGetPerso(g_hSuperObjectPerso,&stTmpTree,&hNewCurrentSuperObjPerso);
fn_vSetUltraOperatorPerso(g_hSuperObjectPerso, hNewCurrentSuperObjPerso);
}
/***************************************/
void CFast_memcpy(int i, int j, int k)
{
long *pdest = (long *) &CFast_g_a_stPseudoTree[i][j], *psrc = (long *) (gp_stRefTree + k);
#if defined(__DEBUG_AI__)
memcpy(pdest, psrc, sizeof(tdstNodeInterpret));
#else
/* Size of tdstNodeInterpret in release is 8 */
*pdest++ = *psrc++;
*pdest++ = *psrc++;
#endif
}
/***************************************/
void CFast_CallFunction1_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[1]) ;
}
void CFast_CallFunction2_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[2]) ;
}
void CFast_CallFunction3_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[3]) ;
}
void CFast_CallFunction4_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[4]) ;
}
void CFast_CallFunction5_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[5]) ;
}
void CFast_CallFunction6_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[6]) ;
}
void CFast_CallFunction7_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[7]) ;
}
void CFast_CallFunction8_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[8]) ;
}
void CFast_CallFunction9_Static(int iInd)
{
a_stFunctionTable[M_eFuncIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[9]) ;
}
void CFast_CallFunction1_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[1]) ;
}
void CFast_CallFunction2_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[2]) ;
}
void CFast_CallFunction3_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[3]) ;
}
void CFast_CallFunction4_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[4]) ;
}
void CFast_CallFunction5_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[5]) ;
}
void CFast_CallFunction6_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[6]) ;
}
void CFast_CallFunction7_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[7]) ;
}
void CFast_CallFunction8_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[8]) ;
}
void CFast_CallFunction9_NoStatic(void)
{
a_stFunctionTable[M_eFuncIdInterpret(CFast_g_a_stPseudoTree[E_ti_Function])].p_fn_p_stFunctionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Function]+1, &CFast_g_a_stParam[9]) ;
}
/***************************************/
long CFast_CallCondition_Static(int iInd)
{
long temp;
a_stConditionTable[M_eCondIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stConditionFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &temp) ;
return temp;
}
long CFast_CallCondition_NoStatic(void)
{
long temp;
a_stConditionTable[M_eCondIdInterpret(CFast_g_a_stPseudoTree[E_ti_Condition])].p_fn_p_stConditionFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Condition]+1, &temp) ;
return temp;
}
/***************************************/
void CFast_CallVector0_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[0]) ;
}
void CFast_CallVector1_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[1]) ;
}
void CFast_CallVector2_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[2]) ;
}
void CFast_CallVector3_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[3]) ;
}
void CFast_CallVector4_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[4]) ;
}
void CFast_CallVector5_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[5]) ;
}
void CFast_CallVector6_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[6]) ;
}
void CFast_CallVector7_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[7]) ;
}
void CFast_CallVector8_Static (int iInd) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, gp_stPseudoTree+iInd, &CFast_g_a_stParam[8]) ;
}
void CFast_CallVector0_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[0]) ;
}
void CFast_CallVector1_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[1]) ;
}
void CFast_CallVector2_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[2]) ;
}
void CFast_CallVector3_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[3]) ;
}
void CFast_CallVector4_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[4]) ;
}
void CFast_CallVector5_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[5]) ;
}
void CFast_CallVector6_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[6]) ;
}
void CFast_CallVector7_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[7]) ;
}
void CFast_CallVector8_NoStatic (void) {
a_stTypeTable[E_ti_Vector].p_fn_p_stEvalTypePtr(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[6], &CFast_g_a_stParam[8]) ;
}
/***************************************/
void CFast_CallOperator0_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[0]) ;
}
void CFast_CallOperator1_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[1]) ;
}
void CFast_CallOperator2_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[2]) ;
}
void CFast_CallOperator3_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[3]) ;
}
void CFast_CallOperator4_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[4]) ;
}
void CFast_CallOperator5_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[5]) ;
}
void CFast_CallOperator6_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[6]) ;
}
void CFast_CallOperator7_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[7]) ;
}
void CFast_CallOperator8_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[8]) ;
}
void CFast_CallOperator9_Static(int iInd)
{
a_stOperatorTable[M_eOperatorIdInterpret(gp_stPseudoTree+iInd)].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, gp_stPseudoTree+iInd+1, &CFast_g_a_stParam[9]) ;
}
void CFast_CallOperator0_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[0]) ;
}
void CFast_CallOperator1_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[1]) ;
}
void CFast_CallOperator2_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[2]) ;
}
void CFast_CallOperator3_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[3]) ;
}
void CFast_CallOperator4_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[4]) ;
}
void CFast_CallOperator5_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[5]) ;
}
void CFast_CallOperator6_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[6]) ;
}
void CFast_CallOperator7_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[7]) ;
}
void CFast_CallOperator8_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[8]) ;
}
void CFast_CallOperator9_NoStatic(void)
{
a_stOperatorTable[M_eOperatorIdInterpret(CFast_g_a_stPseudoTree[E_ti_Operator])].p_fn_p_stOperatorFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Operator]+1, &CFast_g_a_stParam[9]) ;
}
/***************************************/
void CFast_CallProcedure_Static(int iInd)
{
a_stProcedureTable[M_eProcedureIdInterpret(gp_stPseudoTree + iInd)].p_fn_p_stProcedureFunction(g_hSuperObjectPerso, gp_stPseudoTree + iInd+1) ;
}
void CFast_CallProcedure_NoStatic(void)
{
a_stProcedureTable[M_eProcedureIdInterpret(CFast_g_a_stPseudoTree[E_ti_Procedure])].p_fn_p_stProcedureFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_Procedure]+1) ;
}
/***************************************/
void CFast_CallMetaActionInit_Static(int iInd)
{
a_stMetaActionTable[M_eMetaActionIdInterpret(gp_stPseudoTree + iInd)].p_fn_p_stMetaActionInitFunction(g_hSuperObjectPerso, gp_stPseudoTree + iInd+1) ;
}
void CFast_CallMetaActionInit_NoStatic(void)
{
a_stMetaActionTable[M_eMetaActionIdInterpret(CFast_g_a_stPseudoTree[E_ti_MetaAction])].p_fn_p_stMetaActionInitFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_MetaAction]+1) ;
}
/***************************************/
unsigned char CFast_CallMetaAction(int iFunc)
{
return a_stMetaActionTable[iFunc].p_fn_ucMetaActionFunction(g_hSuperObjectPerso) ;
}
/***************************************/
void CFast_CallKeyword_Static(int iInd, int iReturn)
{
a_stKeyWordTable[M_eKeyWordIdInterpret(gp_stPseudoTree + iInd)].p_fn_p_stKeyWordFunction(g_hSuperObjectPerso, gp_stPseudoTree + iInd + 1, &CFast_g_a_stParam[iReturn]) ;
}
void CFast_CallKeyword_NoStatic(int iReturn)
{
a_stKeyWordTable[M_eKeyWordIdInterpret(CFast_g_a_stPseudoTree[E_ti_KeyWord])].p_fn_p_stKeyWordFunction(g_hSuperObjectPerso, CFast_g_a_stPseudoTree[E_ti_KeyWord] + 1, &CFast_g_a_stParam[iReturn]) ;
}
void CFast_vInitStaticTree (struct tdstNodeInterpret_ *p_stStaticTree, long lSize,
struct tdstNodeInterpret_ *p_stRefTree ){
long i;
for ( i=0 ; i<lSize ; i++, p_stStaticTree++ ) {
if ( M_GetTypeInterpret(p_stStaticTree) == E_ti_Unknown ) {
memcpy ( p_stStaticTree,
&p_stRefTree[M_lValueInterpret(p_stStaticTree)],
sizeof(struct tdstNodeInterpret_) ) ;
#ifndef U64
/* special processing for sound, because the pointers points to dynamically allocated memory */
if( M_GetTypeInterpret(p_stStaticTree) == E_ti_SoundEventRef
&& SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT )
/* we save the id of the sound event and the pointer */
SNA_fn_vWriteSoundEntryInSoundTableFile(
SND_fn_ulGetEventBinIdFromPointer(M_SoundEventInterpret(p_stStaticTree)),
(unsigned long)&(M_SoundEventInterpret(p_stStaticTree)) );
#endif
}
}
}
/*
******************************************************************
* INCLUDE ALL ALL .CXX FOR MODELS
******************************************************************
*/
#ifndef U64
#define DEBUG_CFAST
#define U64_IA_EN_C
#else
/*#define U64_IA_EN_C*/
#endif
#ifndef CODEWARRIOR
#pragma warning(disable : 4101)
#endif
#include "CFastf.cxx"
#ifndef CODEWARRIOR
#pragma warning(default: 4101)
#endif
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,486 @@
/*---------------------------------------------------------------------------*/
/* DsgMemC.cpp : Definition of variables (Translation of AI in code C)*/
/* auteur : Yann Le GUYADER*/
/*---------------------------------------------------------------------------*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "AI_Struc.h"
/* not useful according to lint but i let it*/
#define _WP_D_DEFINE_WAYPOINTS_
#include "WP_Handl.h"
#include "WP_Func.h"
#undef _WP_D_DEFINE_WAYPOINTS_
#include "Intell.h" /* for the fn_lEvalTree declaration*/
#include "DsgMem.h"
#include "ReadRule.h"
#include "Convert.h"
#include "specif/AITools.h"
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
#include "DsgMemC.h"
extern AI_tdstMind *p_stGlobalMind;
/*******************************************************************************************************************/
/* Get Functions to access DsgVar */
/*******************************************************************************************************************/
/*
MTH_tdxReal CFast_fn_xGetDsgVarFloat(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return ((MTH_tdxReal) (*(MTH_tdxReal *)M_GetDsgVarAddr(p_stPerso,ucId)));
}
C_TypeOfPerso CFast_fn_hGetDsgVarPerso(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return ((C_TypeOfPerso) *(C_TypeOfPerso *)M_GetDsgVarAddr(p_stPerso,ucId));
}
// eDsgVarType_Vector
MTH3D_tdstVector *CFast_fn_p_stGetDsgVarVector(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return ((MTH3D_tdstVector *)(M_GetDsgVarAddr(p_stPerso,ucId)));
}
// eDsgVarType_Caps
unsigned long CFast_fn_ucGetDsgVarCaps(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return (*((unsigned long *)(M_GetDsgVarAddr(p_stPerso,ucId))));
}
// eDsgVarType_Graph
C_TypeOfGraph CFast_fn_hGetDsgVarGraph(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return(*((C_TypeOfGraph *)M_GetDsgVarAddr(p_stPerso,ucId)));
}
// eDsgVarType_WayPoint
C_TypeOfWayPoint CFast_fn_hGetDsgVarWayPoint(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return (*((C_TypeOfWayPoint *)M_GetDsgVarAddr(p_stPerso,ucId)));
}
// eDsgVarType_Action
C_TypeOfAction CFast_fn_xGetDsgVarAction(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return (*((C_TypeOfAction *)M_GetDsgVarAddr(p_stPerso,ucId)));
}
// eDsgVarType_Comport
C_TypeOfComport CFast_fn_xGetDsgVarComport(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return (*((C_TypeOfComport *)M_GetDsgVarAddr(p_stPerso,ucId)));
}
// eDsgVarType_List
C_TypeOfList1 * CFast_fn_p_xGetDsgVarList(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return((C_TypeOfList1 *)M_GetDsgVarAddr(p_stPerso,ucId));
}
// eDsgVarType_Boolean
long CFast_fn_lGetDsgVarBoolean(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return((long) (* ((C_TypeOfBoolean *)M_GetDsgVarAddr(p_stPerso,ucId))));
}
// eDsgVarType__128To127
long CFast_fn_lGetDsgVar_128To127(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return( (long) (* ((C_TypeOf_128To127 *)M_GetDsgVarAddr(p_stPerso,ucId)) ) );
}
// eDsgVarType_0To255
long CFast_fn_lGetDsgVar0To255(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return( (long) (* ((C_TypeOf0To255 *)M_GetDsgVarAddr(p_stPerso,ucId)) ) );
}
// eDsgVarType__32768To32767
long CFast_fn_lGetDsgVar_32768To32767(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return( (long) (* ((C_TypeOf_32768To32767 *)M_GetDsgVarAddr(p_stPerso,ucId)) ) );
}
// eDsgVarType_0To65535
long CFast_fn_lGetDsgVar0To65535(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return((long)(*((C_TypeOf0To65535 *)M_GetDsgVarAddr(p_stPerso,ucId))));
}
// eDsgVarType_Integer
long CFast_fn_lGetDsgVarInteger(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return ( (long) (* ((C_TypeOfInteger *)M_GetDsgVarAddr(p_stPerso,ucId)) ) );
}
// eDsgVarType_PositiveInteger
long CFast_fn_lGetDsgVarPositiveInteger(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return ( (long) (* ((C_TypeOfPositiveInteger *)M_GetDsgVarAddr(p_stPerso,ucId)) ) );
}
// eDsgVarType_GameMaterial
C_TypeOfGameMaterial CFast_fn_xGetDsgVarGameMaterial(unsigned char ucId, AI_tdstMind *p_stPerso)
{
return ( (C_TypeOfGameMaterial) ( *((C_TypeOfGameMaterial *)M_GetDsgVarAddr(p_stPerso,ucId)) ) );
}
*/
/* eDsgVarType_PersoArray*/
/* eDsgVarType_VectorArray*/
/* eDsgVarType_FloatArray*/
/* eDsgVarType_IntegerArray*/
/* eDsgVarType_WayPointArray*/
/* eDsgVarType_TextArray*/
HIE_tdxHandleToSuperObject CFast_fn_hGetDsgVarPersoArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex)
{
return(M_tduGetSetParam_hSuperObject((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex))));
}
MTH3D_tdstVector *CFast_fn_p_stGetDsgVarVectorArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex)
{
#if defined(OPTIMIZED_ARRAY)
return((MTH3D_tdstVector *)(M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)));
#else
return(&M_tduGetSetParam_stVertexValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex))));
#endif
}
MTH_tdxReal CFast_fn_xGetDsgVarFloatArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex)
{
return(M_tduGetSetParam_xValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex))));
}
long CFast_fn_lGetDsgVarIntegerArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex)
{
return(M_tduGetSetParam_lValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex))));
}
C_TypeOfWayPoint CFast_fn_hGetDsgVarWayPointArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex)
{
return(M_tduGetSetParam_hWayPoint((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex))));
}
char *CFast_fn_p_szGetDsgVarTextArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex)
{
return(M_tduGetSetParam_szString((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex))));
}
/*******************************************************************************************************************/
/* Set Functions to access DsgVar */
/*******************************************************************************************************************/
/* eDsgVarType_Float*/
void CFast_fn_vSetDsgVarFloat(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfFloat xValue)
{
*((C_TypeOfFloat *)M_GetDsgVarAddr(p_stPerso,ucId)) = ((C_TypeOfFloat) xValue);
}
void LocalCFast_fn_vSetDsgVarFloat(unsigned char ucId, C_TypeOfFloat xValue)
{
*((C_TypeOfFloat *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = ((C_TypeOfFloat) xValue);
}
/* eDsgVarType_Perso*/
void CFast_fn_vSetDsgVarPerso(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfPerso hPerso)
{
*(C_TypeOfPerso *)(M_GetDsgVarAddr(p_stPerso,ucId)) = hPerso;
}
void LocalCFast_fn_vSetDsgVarPerso(unsigned char ucId, C_TypeOfPerso hPerso)
{
*(C_TypeOfPerso *)(M_GetDsgVarAddr(p_stGlobalMind,ucId)) = hPerso;
}
/* eDsgVarType_Perso*/
void CFast_fn_vSetDsgVarPersoWithEngine(unsigned char ucId, AI_tdstMind *p_stPerso, struct tdstEngineObject_ *hPerso)
{
if (hPerso)
*(C_TypeOfPerso *)(M_GetDsgVarAddr(p_stPerso,ucId)) = (C_TypeOfPerso)M_GetSuperObject(hPerso);
else
*(C_TypeOfPerso *)(M_GetDsgVarAddr(p_stPerso,ucId)) = (C_TypeOfPerso) NULL;
}
void LocalCFast_fn_vSetDsgVarPersoWithEngine(unsigned char ucId, struct tdstEngineObject_ *hPerso)
{
if (hPerso)
*(C_TypeOfPerso *)(M_GetDsgVarAddr(p_stGlobalMind,ucId)) = (C_TypeOfPerso)M_GetSuperObject(hPerso);
else
*(C_TypeOfPerso *)(M_GetDsgVarAddr(p_stGlobalMind,ucId)) = (C_TypeOfPerso) NULL;
}
/* eDsgVarType_Action*/
void CFast_fn_vSetDsgVarAction(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfAction hAction)
{
*((C_TypeOfAction *)M_GetDsgVarAddr(p_stPerso,ucId))= hAction;
}
void LocalCFast_fn_vSetDsgVarAction(unsigned char ucId,C_TypeOfAction hAction)
{
*((C_TypeOfAction *)M_GetDsgVarAddr(p_stGlobalMind,ucId))= hAction;
}
/* eDsgVarType_Comport*/
void CFast_fn_vSetDsgVarComport(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfComport p_stComport)
{
*((C_TypeOfComport *)M_GetDsgVarAddr(p_stPerso,ucId)) = (C_TypeOfComport) p_stComport;
}
void LocalCFast_fn_vSetDsgVarComport(unsigned char ucId, C_TypeOfComport p_stComport)
{
*((C_TypeOfComport *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = (C_TypeOfComport) p_stComport;
}
/* eDsgVarType_Vector*/
void CFast_fn_vSetDsgVarVector(unsigned char ucId, AI_tdstMind *p_stPerso,MTH3D_tdstVector *p_stVertex)
{
MTH3D_M_vCopyVector(((C_TypeOfVector *)M_GetDsgVarAddr(p_stPerso,ucId)),p_stVertex);
}
void LocalCFast_fn_vSetDsgVarVector(unsigned char ucId, MTH3D_tdstVector *p_stVertex)
{
MTH3D_M_vCopyVector(((C_TypeOfVector *)M_GetDsgVarAddr(p_stGlobalMind,ucId)),p_stVertex);
}
/* eDsgVarType_Caps*/
void CFast_fn_vSetDsgVarCaps(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfCaps ulCaps)
{
*((C_TypeOfCaps *)M_GetDsgVarAddr(p_stPerso,ucId)) =ulCaps;
}
void LocalCFast_fn_vSetDsgVarCaps(unsigned char ucId, C_TypeOfCaps ulCaps)
{
*((C_TypeOfCaps *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) =ulCaps;
}
/* eDsgVarType_Graph*/
void CFast_fn_vSetDsgVarGraph(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfGraph hGraph)
{
*((C_TypeOfGraph *)M_GetDsgVarAddr(p_stPerso,ucId)) = hGraph;
}
void LocalCFast_fn_vSetDsgVarGraph(unsigned char ucId,C_TypeOfGraph hGraph)
{
*((C_TypeOfGraph *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = hGraph;
}
/* eDsgVarType_WayPoint*/
void CFast_fn_vSetDsgVarWayPoint(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfWayPoint hWayPoint)
{
*((C_TypeOfWayPoint *)M_GetDsgVarAddr(p_stPerso,ucId)) = hWayPoint;
}
void LocalCFast_fn_vSetDsgVarWayPoint(unsigned char ucId, C_TypeOfWayPoint hWayPoint)
{
*((C_TypeOfWayPoint *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = hWayPoint;
}
/* eDsgVarType_List*/
void CFast_fn_vSetDsgVarList(unsigned char ucId, AI_tdstMind *p_stPerso, tdstList *p_SrcList)
{
tdstList *p_TgtList = (tdstList *)M_GetDsgVarAddr(p_stPerso,ucId);
p_TgtList->ucNbElt = (unsigned char) M_Min(p_SrcList->ucNbElt, p_TgtList->ucMaxSize);
memcpy((void*) p_TgtList->d_TabElt,(void*) p_SrcList->d_TabElt,p_TgtList->ucNbElt*C_SizeOfPersoInList);
}
void LocalCFast_fn_vSetDsgVarList(unsigned char ucId, tdstList *p_SrcList)
{
tdstList *p_TgtList = (tdstList *)M_GetDsgVarAddr(p_stGlobalMind,ucId);
p_TgtList->ucNbElt = (unsigned char) M_Min(p_SrcList->ucNbElt, p_TgtList->ucMaxSize);
memcpy((void*) p_TgtList->d_TabElt,(void*) p_SrcList->d_TabElt,p_TgtList->ucNbElt*C_SizeOfPersoInList);
}
/* eDsgVarType_Boolean*/
void CFast_fn_vSetDsgVarBoolean(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfBoolean bValue)
{
*((C_TypeOfBoolean *)M_GetDsgVarAddr(p_stPerso,ucId)) = (C_TypeOfBoolean) bValue;
}
void LocalCFast_fn_vSetDsgVarBoolean(unsigned char ucId, C_TypeOfBoolean bValue)
{
*((C_TypeOfBoolean *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = (C_TypeOfBoolean) bValue;
}
/* eDsgVarType__128To127*/
void CFast_fn_vSetDsgVar_128To127(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue)
{
*((C_TypeOf_128To127 *)M_GetDsgVarAddr(p_stPerso,ucId)) = (C_TypeOf_128To127) lValue;
}
void LocalCFast_fn_vSetDsgVar_128To127(unsigned char ucId, long lValue)
{
*((C_TypeOf_128To127 *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = (C_TypeOf_128To127) lValue;
}
/* eDsgVarType_0To255*/
void CFast_fn_vSetDsgVar0To255(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue)
{
*((C_TypeOf0To255 *)M_GetDsgVarAddr(p_stPerso,ucId)) = (C_TypeOf0To255) lValue;
}
void LocalCFast_fn_vSetDsgVar0To255(unsigned char ucId, long lValue)
{
*((C_TypeOf0To255 *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = (C_TypeOf0To255) lValue;
}
/* eDsgVarType__32768To32767*/
void CFast_fn_vSetDsgVar_32768To32767(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue)
{
*((C_TypeOf_32768To32767 *)M_GetDsgVarAddr(p_stPerso,ucId)) = (C_TypeOf_32768To32767) lValue;
}
void LocalCFast_fn_vSetDsgVar_32768To32767(unsigned char ucId, long lValue)
{
*((C_TypeOf_32768To32767 *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = (C_TypeOf_32768To32767) lValue;
}
/* eDsgVarType_0To65535*/
void CFast_fn_vSetDsgVar0To65535(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue)
{
*((C_TypeOf0To65535 *)(M_GetDsgVarAddr(p_stPerso,ucId))) = (C_TypeOf0To65535) lValue;
}
void LocalCFast_fn_vSetDsgVar0To65535(unsigned char ucId, long lValue)
{
*((C_TypeOf0To65535 *)(M_GetDsgVarAddr(p_stGlobalMind,ucId))) = (C_TypeOf0To65535) lValue;
}
/* eDsgVarType_Integer*/
void CFast_fn_vSetDsgVarInteger(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue)
{
*((C_TypeOfInteger *)(M_GetDsgVarAddr(p_stPerso,ucId))) = (C_TypeOfInteger) lValue;
}
void LocalCFast_fn_vSetDsgVarInteger(unsigned char ucId, long lValue)
{
*((C_TypeOfInteger *)(M_GetDsgVarAddr(p_stGlobalMind,ucId))) = (C_TypeOfInteger) lValue;
}
/* eDsgVarType_PositiveInteger*/
void CFast_fn_vSetDsgVarPositiveInteger(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue)
{
*((C_TypeOfPositiveInteger *)(M_GetDsgVarAddr(p_stPerso,ucId))) = (C_TypeOfPositiveInteger) lValue;
}
void LocalCFast_fn_vSetDsgVarPositiveInteger(unsigned char ucId, long lValue)
{
*((C_TypeOfPositiveInteger *)(M_GetDsgVarAddr(p_stGlobalMind,ucId))) = (C_TypeOfPositiveInteger) lValue;
}
/* eDsgVarType_GameMaterial*/
void CFast_fn_vSetDsgVarGameMaterial(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfGameMaterial hGameMaterial)
{
*((C_TypeOfGameMaterial *)M_GetDsgVarAddr(p_stPerso,ucId)) = hGameMaterial;
}
void LocalCFast_fn_vSetDsgVarGameMaterial(unsigned char ucId, C_TypeOfGameMaterial hGameMaterial)
{
*((C_TypeOfGameMaterial *)M_GetDsgVarAddr(p_stGlobalMind,ucId)) = hGameMaterial;
}
/* eDsgVarType_PersoArray*/
void CFast_fn_vSetDsgVarPersoArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, C_TypeOfPerso hPerso)
{
( M_tduGetSetParam_hSuperObject((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)))) = hPerso;
}
void LocalCFast_fn_vSetDsgVarPersoArray(unsigned char ucId, unsigned char ucTabIndex, C_TypeOfPerso hPerso)
{
( M_tduGetSetParam_hSuperObject((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex)))) = hPerso;
}
void CFast_fn_vSetDsgVarPersoArrayWithEngine(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, struct tdstEngineObject_ *hPerso)
{
if (hPerso)
( M_tduGetSetParam_hSuperObject((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)))) = (C_TypeOfPerso)M_GetSuperObject(hPerso);
else
( M_tduGetSetParam_hSuperObject((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)))) = (C_TypeOfPerso) NULL;
}
void LocalCFast_fn_vSetDsgVarPersoArrayWithEngine(unsigned char ucId, unsigned char ucTabIndex, struct tdstEngineObject_ *hPerso)
{
if (hPerso)
( M_tduGetSetParam_hSuperObject((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex)))) = (C_TypeOfPerso)M_GetSuperObject(hPerso);
else
( M_tduGetSetParam_hSuperObject((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex)))) = (C_TypeOfPerso) NULL;
}
/* eDsgVarType_VectorArray*/
void CFast_fn_vSetDsgVarVectorArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, MTH3D_tdstVector *p_stVector)
{
#if defined(OPTIMIZED_ARRAY)
MTH3D_M_vCopyVector((MTH3D_tdstVector *)(M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)), p_stVector);
#else
MTH3D_M_vCopyVector((MTH3D_tdstVector *)(&M_tduGetSetParam_stVectorValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)))), p_stVector);
#endif
}
void LocalCFast_fn_vSetDsgVarVectorArray(unsigned char ucId, unsigned char ucTabIndex, MTH3D_tdstVector *p_stVector)
{
#if defined(OPTIMIZED_ARRAY)
MTH3D_M_vCopyVector((MTH3D_tdstVector *)(M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex)), p_stVector);
#else
MTH3D_M_vCopyVector((MTH3D_tdstVector *)(&M_tduGetSetParam_stVectorValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex)))), p_stVector);
#endif
}
/* eDsgVarType_FloatArray*/
void CFast_fn_vSetDsgVarFloatArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, MTH_tdxReal xValue)
{
*((MTH_tdxReal *)&M_tduGetSetParam_xValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)))) = xValue;
}
void LocalCFast_fn_vSetDsgVarFloatArray(unsigned char ucId, unsigned char ucTabIndex, MTH_tdxReal xValue)
{
*((MTH_tdxReal *)&M_tduGetSetParam_xValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex)))) = xValue;
}
/* eDsgVarType_IntegerArray*/
void CFast_fn_vSetDsgVarIntegerArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, long lValue)
{
*((long *)&M_tduGetSetParam_lValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)))) = lValue;
}
void LocalCFast_fn_vSetDsgVarIntegerArray(unsigned char ucId, unsigned char ucTabIndex, long lValue)
{
*((long *)&M_tduGetSetParam_lValue((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex)))) = lValue;
}
/* eDsgVarType_WayPointArray*/
void CFast_fn_vSetDsgVarWayPointArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, C_TypeOfWayPoint hWayPoint)
{
*((C_TypeOfWayPoint *)&M_tduGetSetParam_hWayPoint((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex))))= hWayPoint;
}
void LocalCFast_fn_vSetDsgVarWayPointArray(unsigned char ucId, unsigned char ucTabIndex, C_TypeOfWayPoint hWayPoint)
{
*((C_TypeOfWayPoint *)&M_tduGetSetParam_hWayPoint((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex))))= hWayPoint;
}
/* eDsgVarType_TextArray*/
void CFast_fn_vSetDsgVarTextArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, char *p_szString)
{
strcpy(((char *)M_tduGetSetParam_szString((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stPerso,ucId),ucTabIndex)))), p_szString);
}
void LocalCFast_fn_vSetDsgVarTextArray(unsigned char ucId, unsigned char ucTabIndex, char *p_szString)
{
strcpy(((char *)M_tduGetSetParam_szString((M_ARRAY_ELEMENT((tdstArray*)M_GetDsgVarAddr(p_stGlobalMind,ucId),ucTabIndex)))), p_szString);
}
/* A voir
unsigned char fn_ucSetDsgVarArray(void *pMyVarAddr,unsigned char ucIndex,tdstGetSetParam *p_stGetSetParam)
{
unsigned char ret=C_INVALID_SET;
tdstArray *p_stArray=(tdstArray*) pMyVarAddr;
tdeDsgVarTypeId eDsgVarTypeId=M_ARRAY_TYPE(p_stArray);
#if defined(__DEBUG_AI__)
if (M_GetSetParam_Type(p_stGetSetParam)==fn_GetDsgVarType(eDsgVarTypeId))
if (ucIndex<M_ARRAY_SIZE(p_stArray))
#endif
{
tdp_fn_ucSetDsgVarFunctionPtr p_fn_ucSetDsgVar=fn_p_fn_pGetDsgVarSetFunctionPtr(eDsgVarTypeId);
ret=p_fn_ucSetDsgVar((void *) M_ARRAY_ELEMENT(p_stArray,ucIndex),0,p_stGetSetParam);
}
return(ret);
}
*/
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB

View File

@@ -0,0 +1,240 @@
#ifndef D_DsgMemC
#define D_DsgMemC
/**************************************/
#if !defined(CPA_EXPORT)
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif /*CPA_WANTS_IMPORT || CPA_WANTS_EXPORT*/
#endif /*CPA_EXPORT*/
/**************************************/
#undef extern
#define EXTERN_AI_DLL extern
/*******************************************************************************/
/*******************************************************************************************************************/
/* Get the real indice of variable */
/*******************************************************************************************************************/
#define M_CFast_ucGetRealIndice(Indice1) (unsigned char)M_lDsgVarIdInterpret(p_stRefTree+Indice1)
#define M_CFast_hGetPersoRef(Indice) (HIE_tdxHandleToSuperObject)M_GetSuperObject(M_p_stPersoRefInterpret(p_stRefTree+Indice))
/*******************************************************************************************************************/
/* Get Functions to access DsgVar */
/*******************************************************************************************************************/
/*
MTH_tdxReal CFast_fn_xGetDsgVarFloat(unsigned char ucId, AI_tdstMind *p_stPerso);
C_TypeOfPerso CFast_fn_hGetDsgVarPerso(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_Vector
MTH3D_tdstVector *CFast_fn_p_stGetDsgVarVector(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_Caps
unsigned long CFast_fn_ucGetDsgVarCaps(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_Graph
C_TypeOfGraph CFast_fn_hGetDsgVarGraph(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_WayPoint
C_TypeOfWayPoint CFast_fn_hGetDsgVarWayPoint(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_Action
C_TypeOfAction CFast_fn_xGetDsgVarAction(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_Comport
C_TypeOfComport CFast_fn_xGetDsgVarComport(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_List
C_TypeOfList1 * CFast_fn_p_xGetDsgVarList(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_Boolean
long CFast_fn_lGetDsgVarBoolean(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType__128To127
long CFast_fn_lGetDsgVar_128To127(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_0To255
long CFast_fn_lGetDsgVar0To255(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType__32768To32767
long CFast_fn_lGetDsgVar_32768To32767(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_0To65535
long CFast_fn_lGetDsgVar0To65535(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_Integer
long CFast_fn_lGetDsgVarInteger(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_PositiveInteger
long CFast_fn_lGetDsgVarPositiveInteger(unsigned char ucId, AI_tdstMind *p_stPerso);
// eDsgVarType_GameMaterial
C_TypeOfGameMaterial CFast_fn_xGetDsgVarGameMaterial(unsigned char ucId, AI_tdstMind *p_stPerso);
*/
#define CFast_fn_xGetDsgVarFloat(ucId, p_stPerso) ((MTH_tdxReal) (*(MTH_tdxReal *)M_GetDsgVarAddr(p_stPerso,ucId)))
#define LocalCFast_fn_xGetDsgVarFloat(ucId) ((MTH_tdxReal) (*(MTH_tdxReal *)M_LocalGetDsgVarAddr(NULL,ucId)))
#define CFast_fn_hGetDsgVarPerso(ucId,p_stPerso) ((C_TypeOfPerso) *(C_TypeOfPerso *)M_GetDsgVarAddr(p_stPerso,ucId))
#define LocalCFast_fn_hGetDsgVarPerso(ucId) ((C_TypeOfPerso) *(C_TypeOfPerso *)M_LocalGetDsgVarAddr(NULL,ucId))
#define CFast_fn_p_stGetDsgVarVector(ucId,p_stPerso) ((MTH3D_tdstVector *)(M_GetDsgVarAddr(p_stPerso,ucId)))
#define LocalCFast_fn_p_stGetDsgVarVector(ucId) ((MTH3D_tdstVector *)(M_LocalGetDsgVarAddr(NULL,ucId)))
#define CFast_fn_ucGetDsgVarCaps(ucId, p_stPerso) (*((unsigned long *)(M_GetDsgVarAddr(p_stPerso,ucId))))
#define LocalCFast_fn_ucGetDsgVarCaps(ucId) (*((unsigned long *)(M_LocalGetDsgVarAddr(NULL,ucId))))
#define CFast_fn_hGetDsgVarGraph(ucId,p_stPerso) (*((C_TypeOfGraph *)M_GetDsgVarAddr(p_stPerso,ucId)))
#define LocalCFast_fn_hGetDsgVarGraph(ucId) (*((C_TypeOfGraph *)M_LocalGetDsgVarAddr(NULL,ucId)))
#define CFast_fn_hGetDsgVarWayPoint(ucId,p_stPerso) (*((C_TypeOfWayPoint *)M_GetDsgVarAddr(p_stPerso,ucId)))
#define LocalCFast_fn_hGetDsgVarWayPoint(ucId) (*((C_TypeOfWayPoint *)M_LocalGetDsgVarAddr(NULL,ucId)))
#define CFast_fn_xGetDsgVarAction(ucId,p_stPerso) (*((C_TypeOfAction *)M_GetDsgVarAddr(p_stPerso,ucId)))
#define LocalCFast_fn_xGetDsgVarAction(ucId) (*((C_TypeOfAction *)M_LocalGetDsgVarAddr(NULL,ucId)))
#define CFast_fn_xGetDsgVarComport(ucId,p_stPerso) (*((C_TypeOfComport *)M_GetDsgVarAddr(p_stPerso,ucId)))
#define LocalCFast_fn_xGetDsgVarComport(ucId) (*((C_TypeOfComport *)M_LocalGetDsgVarAddr(NULL,ucId)))
#define CFast_fn_p_xGetDsgVarList(ucId,p_stPerso) ((struct tdstList_ *)M_GetDsgVarAddr(p_stPerso,ucId))
#define LocalCFast_fn_p_xGetDsgVarList(ucId) ((struct tdstList_ *)M_LocalGetDsgVarAddr(NULL,ucId))
#define CFast_fn_lGetDsgVarBoolean(ucId,p_stPerso) ((long)(*((C_TypeOfBoolean *)M_GetDsgVarAddr(p_stPerso,ucId))))
#define LocalCFast_fn_lGetDsgVarBoolean(ucId) ((long)(*((C_TypeOfBoolean *)M_LocalGetDsgVarAddr(NULL,ucId))))
#define CFast_fn_lGetDsgVar_128To127(ucId,p_stPerso) ( (long)(*((C_TypeOf_128To127 *)M_GetDsgVarAddr(p_stPerso,ucId)) ) )
#define LocalCFast_fn_lGetDsgVar_128To127(ucId) ( (long)(*((C_TypeOf_128To127 *)M_LocalGetDsgVarAddr(NULL,ucId)) ) )
#define CFast_fn_lGetDsgVar0To255(ucId,p_stPerso) ((long)(*((C_TypeOf0To255 *)M_GetDsgVarAddr(p_stPerso,ucId)) ) )
#define LocalCFast_fn_lGetDsgVar0To255(ucId) ((long)(*((C_TypeOf0To255 *)M_LocalGetDsgVarAddr(NULL,ucId)) ) )
#define CFast_fn_lGetDsgVar_32768To32767(ucId,p_stPerso) ((long)(*((C_TypeOf_32768To32767 *)M_GetDsgVarAddr(p_stPerso,ucId)) ) )
#define LocalCFast_fn_lGetDsgVar_32768To32767(ucId) ((long)(*((C_TypeOf_32768To32767 *)M_LocalGetDsgVarAddr(NULL,ucId)) ) )
#define CFast_fn_lGetDsgVar0To65535(ucId,p_stPerso) ((long)(*((C_TypeOf0To65535 *)M_GetDsgVarAddr(p_stPerso,ucId))))
#define LocalCFast_fn_lGetDsgVar0To65535(ucId) ((long)(*((C_TypeOf0To65535 *)M_LocalGetDsgVarAddr(NULL,ucId))))
#define CFast_fn_lGetDsgVarInteger(ucId,p_stPerso) ((long)(*((C_TypeOfInteger *)M_GetDsgVarAddr(p_stPerso,ucId)) ) )
#define LocalCFast_fn_lGetDsgVarInteger(ucId) ((long)(*((C_TypeOfInteger *)M_LocalGetDsgVarAddr(NULL,ucId)) ) )
#define CFast_fn_lGetDsgVarPositiveInteger(ucId,p_stPerso) ((long)(*((C_TypeOfPositiveInteger *)M_GetDsgVarAddr(p_stPerso,ucId)) ) )
#define LocalCFast_fn_lGetDsgVarPositiveInteger(ucId) ((long)(*((C_TypeOfPositiveInteger *)M_LocalGetDsgVarAddr(NULL,ucId)) ) )
#define CFast_fn_xGetDsgVarGameMaterial(ucId,p_stPerso) ((C_TypeOfGameMaterial)(*((C_TypeOfGameMaterial *)M_GetDsgVarAddr(p_stPerso,ucId))))
#define LocalCFast_fn_xGetDsgVarGameMaterial(ucId) ((C_TypeOfGameMaterial)(*((C_TypeOfGameMaterial *)M_LocalGetDsgVarAddr(NULL,ucId))))
HIE_tdxHandleToSuperObject CFast_fn_hGetDsgVarPersoArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex);
HIE_tdxHandleToSuperObject LocalCFast_fn_hGetDsgVarPersoArray(unsigned char ucId, unsigned char ucTabIndex);
MTH3D_tdstVector *CFast_fn_p_stGetDsgVarVectorArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex);
MTH3D_tdstVector *LocalCFast_fn_p_stGetDsgVarVectorArray(unsigned char ucId, unsigned char ucTabIndex);
MTH_tdxReal CFast_fn_xGetDsgVarFloatArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex);
MTH_tdxReal LocalCFast_fn_xGetDsgVarFloatArray(unsigned char ucId, unsigned char ucTabIndex);
long CFast_fn_lGetDsgVarIntegerArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex);
long LocalCFast_fn_lGetDsgVarIntegerArray(unsigned char ucId, unsigned char ucTabIndex);
C_TypeOfWayPoint CFast_fn_hGetDsgVarWayPointArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex);
C_TypeOfWayPoint LocalCFast_fn_hGetDsgVarWayPointArray(unsigned char ucId, unsigned char ucTabIndex);
char *CFast_fn_p_szGetDsgVarTextArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex);
char *LocalCFast_fn_p_szGetDsgVarTextArray(unsigned char ucId, unsigned char ucTabIndex);
/*******************************************************************************************************************/
/* Set Functions to access DsgVar */
/*******************************************************************************************************************/
/* eDsgVarType_Float*/
void CFast_fn_vSetDsgVarFloat(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfFloat xValue);
void LocalCFast_fn_vSetDsgVarFloat(unsigned char ucId, C_TypeOfFloat xValue);
/* eDsgVarType_Perso*/
void CFast_fn_vSetDsgVarPerso(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfPerso hPerso);
void LocalCFast_fn_vSetDsgVarPerso(unsigned char ucId, C_TypeOfPerso hPerso);
void CFast_fn_vSetDsgVarPersoWithEngine(unsigned char ucId, AI_tdstMind *p_stPerso, struct tdstEngineObject_ *hPerso);
void LocalCFast_fn_vSetDsgVarPersoWithEngine(unsigned char ucId, struct tdstEngineObject_ *hPerso);
/* eDsgVarType_Action*/
void CFast_fn_vSetDsgVarAction(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfAction hAction);
void LocalCFast_fn_vSetDsgVarAction(unsigned char ucId, C_TypeOfAction hAction);
/* eDsgVarType_Comport*/
void CFast_fn_vSetDsgVarComport(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfComport p_stComport);
void LocalCFast_fn_vSetDsgVarComport(unsigned char ucId, C_TypeOfComport p_stComport);
/* eDsgVarType_Vector*/
void CFast_fn_vSetDsgVarVector(unsigned char ucId, AI_tdstMind *p_stPerso,MTH3D_tdstVector *p_stVertex);
void LocalCFast_fn_vSetDsgVarVector(unsigned char ucId,MTH3D_tdstVector *p_stVertex);
/* eDsgVarType_Caps*/
void CFast_fn_vSetDsgVarCaps(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfCaps ulCaps);
void LocalCFast_fn_vSetDsgVarCaps(unsigned char ucId, C_TypeOfCaps ulCaps);
/* eDsgVarType_Graph*/
void CFast_fn_vSetDsgVarGraph(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfGraph hGraph);
void LocalCFast_fn_vSetDsgVarGraph(unsigned char ucId, C_TypeOfGraph hGraph);
/* eDsgVarType_WayPoint*/
void CFast_fn_vSetDsgVarWayPoint(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfWayPoint hWayPoint);
void LocalCFast_fn_vSetDsgVarWayPoint(unsigned char ucId, C_TypeOfWayPoint hWayPoint);
/* eDsgVarType_List*/
void CFast_fn_vSetDsgVarList(unsigned char ucId, AI_tdstMind *p_stPerso, tdstList *p_SrcList);
void LocalCFast_fn_vSetDsgVarList(unsigned char ucId, tdstList *p_SrcList);
/* eDsgVarType_Boolean*/
void CFast_fn_vSetDsgVarBoolean(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfBoolean bValue);
void LocalCFast_fn_vSetDsgVarBoolean(unsigned char ucId, C_TypeOfBoolean bValue);
/* eDsgVarType__128To127*/
void CFast_fn_vSetDsgVar_128To127(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue);
void LocalCFast_fn_vSetDsgVar_128To127(unsigned char ucId, long lValue);
/* eDsgVarType_0To255*/
void CFast_fn_vSetDsgVar0To255(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue);
void LocalCFast_fn_vSetDsgVar0To255(unsigned char ucId, long lValue);
/* eDsgVarType__32768To32767*/
void CFast_fn_vSetDsgVar_32768To32767(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue);
void LocalCFast_fn_vSetDsgVar_32768To32767(unsigned char ucId, long lValue);
/* eDsgVarType_0To65535*/
void CFast_fn_vSetDsgVar0To65535(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue);
void LocalCFast_fn_vSetDsgVar0To65535(unsigned char ucId, long lValue);
/* eDsgVarType_Integer*/
void CFast_fn_vSetDsgVarInteger(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue);
void LocalCFast_fn_vSetDsgVarInteger(unsigned char ucId, long lValue);
/* eDsgVarType_PositiveInteger*/
void CFast_fn_vSetDsgVarPositiveInteger(unsigned char ucId, AI_tdstMind *p_stPerso, long lValue);
void LocalCFast_fn_vSetDsgVarPositiveInteger(unsigned char ucId, long lValue);
/* eDsgVarType_GameMaterial*/
void CFast_fn_vSetDsgVarGameMaterial(unsigned char ucId, AI_tdstMind *p_stPerso, C_TypeOfGameMaterial hGameMaterial);
void LocalCFast_fn_vSetDsgVarGameMaterial(unsigned char ucId, C_TypeOfGameMaterial hGameMaterial);
void CFast_fn_vSetDsgVarPersoArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, C_TypeOfPerso hPerso);
void CFast_fn_vSetDsgVarPersoArrayWithEngine(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, struct tdstEngineObject_ *hPerso) ;
void CFast_fn_vSetDsgVarVectorArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, MTH3D_tdstVector *p_stVector);
void CFast_fn_vSetDsgVarFloatArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, MTH_tdxReal xValue);
void CFast_fn_vSetDsgVarIntegerArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, long lValue);
void CFast_fn_vSetDsgVarWayPointArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, C_TypeOfWayPoint hWayPoint);
void CFast_fn_vSetDsgVarTextArray(unsigned char ucId, AI_tdstMind *p_stPerso, unsigned char ucTabIndex, char *p_szString);
void LocalCFast_fn_vSetDsgVarPersoArray(unsigned char ucId, unsigned char ucTabIndex, C_TypeOfPerso hPerso);
void LocalCFast_fn_vSetDsgVarPersoArrayWithEngine(unsigned char ucId, unsigned char ucTabIndex, struct tdstEngineObject_ *hPerso);
void LocalCFast_fn_vSetDsgVarVectorArray(unsigned char ucId, unsigned char ucTabIndex, MTH3D_tdstVector *p_stVector);
void LocalCFast_fn_vSetDsgVarFloatArray(unsigned char ucId, unsigned char ucTabIndex, MTH_tdxReal xValue);
void LocalCFast_fn_vSetDsgVarIntegerArray(unsigned char ucId, unsigned char ucTabIndex, long lValue);
void LocalCFast_fn_vSetDsgVarWayPointArray(unsigned char ucId, unsigned char ucTabIndex, C_TypeOfWayPoint hWayPoint);
void LocalCFast_fn_vSetDsgVarTextArray(unsigned char ucId, unsigned char ucTabIndex, char *p_szString);
/*******************************************************************************/
#undef EXTERN_AI_DLL
#endif /*D_DsgMem*/

View File

@@ -0,0 +1,320 @@
/*-----------------------------------------------------------------------------
* Description : AI - handle acces to field value in Perso structure
*-----------------------------------------------------------------------------
* Creation date : 23/10/96 Author : Olivier Couvreur
*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "AI_Struc.h"
#include "StrIntel.h"
#include "Convert.h"
#include "specif/AiTools.h"
/*
unsigned char fn_ucSetFieldValue(enum tdeFieldId_ eFieldId, HIE_tdxHandleToSuperObject hSuperObjPerso, struct tdstGetSetParam_ *p_stGetSetParam)
{
enum tdeVariableType_ eType;
tdstGetSetParam stTempGetSetParam;
tdp_fn_cSetFunctionPtr p_fn_cSetFieldFunction;
eType=fn_eGetFieldType(eFieldId);
switch (eType)
{
case E_vt_Float:
{
M_Full_GetSetParam_Float(&stTempGetSetParam,M_ReturnParam_xValue(p_stGetSetParam));
}
break;
case E_vt_Vector:
{
M_Full_GetSetParam_p_stVertex(&stTempGetSetParam,&M_GetSetParam_stVertexValue(p_stGetSetParam));
}
break;
case E_vt_Perso:
{
M_Full_GetSetParam_Perso(&stTempGetSetParam,M_GetSetParam_p_stSupObjValue(p_stGetSetParam));
}
break;
default:
{
M_Full_GetSetParam_Integer(&stTempGetSetParam,M_ReturnParam_lValue(p_stGetSetParam));
#if defined(__DEBUG_AI__)
{
unsigned char ucTruncated=(unsigned char) (M_GetSetParam_Type(p_stGetSetParam)==E_vt_Float);
long lValue=M_GetSetParam_lValue(&stTempGetSetParam);
switch (eType)
{
case E_vt__128To127:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<-128) || (lValue>127) );
break;
case E_vt_0To255:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>255) );
break;
case E_vt__32768To32767:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<-32768) || (lValue>32767) );
break;
case E_vt_0To65535:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>65535) );
break;
case E_vt_PositiveInteger:
if (!ucTruncated) ucTruncated = (unsigned char) (lValue<0);
break;
case E_vt_Boolean:
case E_vt_1bit:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>1) );
break;
case E_vt_2bit:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>3) );
break;
case E_vt_3bit:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>7) );
break;
case E_vt_4bit:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>15) );
break;
case E_vt_5bit:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>31) );
break;
case E_vt_6bit:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>63) );
break;
case E_vt_7bit:
if (!ucTruncated) ucTruncated = (unsigned char) ( (lValue<0) || (lValue>127) );
break;
case E_vt_None:
default:
break;
}
if (ucTruncated)
{
char MyMsg[100];
sprintf(MyMsg,"Field id %d from p_stMind %p (%s)\n",eFieldId,hSuperObjPerso,AI_M_szGetPersoName(AI_M_stGetMindOfSuperObj(hSuperObjPerso)) );
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningTruncateAffectation, C_ucErmNoOpenInfoWindow,MyMsg);
}
}
#endif
}
}
p_fn_cSetFieldFunction=fn_p_fn_pGetFieldSetFunctionPtr(eFieldId);
return(p_fn_cSetFieldFunction(hSuperObjPerso,&stTempGetSetParam));
}
*/
/*
unsigned char fn_ucGetFieldValue(enum tdeFieldId_ eFieldId, HIE_tdxHandleToSuperObject hSuperObjPerso, struct tdstGetSetParam_ *p_stGetSetParam)
{
enum tdeVariableType_ eType;
tdp_fn_cGetFunctionPtr p_fn_cGetFieldFunction;
char ret=C_INVALID_SET;
//extremly important
M_GetSetParam_Clear(p_stGetSetParam);
p_fn_cGetFieldFunction=fn_p_fn_pGetFieldGetFunctionPtr(eFieldId);
ret=p_fn_cGetFieldFunction(hSuperObjPerso,p_stGetSetParam);
eType=fn_eGetFieldType(eFieldId);
switch (eType)
{
case E_vt_Float:
{
MTH_tdxReal xValue=M_GetSetParam_xValue(p_stGetSetParam);
M_Full_GetSetParam_Float(p_stGetSetParam,xValue);
}
break;
case E_vt_Vector:
{
MTH3D_tdstVector *p_stVertex= &M_GetSetParam_stVertexValue(p_stGetSetParam);
M_Full_GetSetParam_p_stVertex(p_stGetSetParam,p_stVertex);
}
break;
case E_vt_Perso:
{
HIE_tdxHandleToSuperObject hTempSuperObjPerso;
hTempSuperObjPerso= M_GetSetParam_p_stSupObjValue(p_stGetSetParam);
M_Full_GetSetParam_Perso(p_stGetSetParam,hTempSuperObjPerso);
}
break;
default:
{
long lValue=0;
// important pour les valeurs sign<67>es qui ne remplissent pas la structure GetSetParam
switch(eType)
{
case E_vt__128To127:
lValue=(long) M_GetSetParam_cValue(p_stGetSetParam);
break;
case E_vt__32768To32767:
lValue=(long) M_GetSetParam_wValue(p_stGetSetParam);
break;
default:
lValue=M_GetSetParam_lValue(p_stGetSetParam);
break;
}
M_Full_GetSetParam_Integer(p_stGetSetParam,lValue);
}
}
return(ret);
}
*/
/* Set ****************************************/
#if defined(__DEBUG_AI__)
unsigned char g_ucFieldTruncated=0;
#define M_INIT_TRUNCATED_FIELD() g_ucFieldTruncated=0;
#define M_NONE(x,a,b) 0
#define M_INF(x,a,b) ((x)<(a))
#define M_SUP(x,a,b) ((x)>(a))
#define M_INF_SUP(x,a,b) ( M_INF(x,a,0) || M_SUP(x,b,0) )
#define M_TEST_TRUNCATED_FIELD(p_stGetSetParam,expression,a,b) \
g_ucFieldTruncated=fn_ucIsThereFloatIfYesConvertItToInteger(p_stGetSetParam); \
if (!g_ucFieldTruncated) \
{ \
long lValue=M_GetSetParam_lValue(p_stGetSetParam); \
g_ucFieldTruncated=##expression(lValue,a,b); \
}
#define M_CHECK_TRUNCATED_FIELD(eFieldId,p_stPerso) \
if (g_ucFieldTruncated) \
{ \
char MyMsg[200]; \
sprintf(MyMsg,"Field %d from p_stMind (%s)\n",(eFieldId),AI_M_szGetPersoName(AI_M_stGetMindOfSuperObj(p_stPerso)) ); \
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningTruncateAffectation, C_ucErmNoOpenInfoWindow,MyMsg); \
}
#else
#define M_INIT_TRUNCATED_FIELD()
#define M_TEST_TRUNCATED_FIELD(p_stGetSetParam,expression,a,b) (void) fn_ucIsThereFloatIfYesConvertItToInteger(p_stGetSetParam);
#define M_CHECK_TRUNCATED_FIELD(eFieldId,p_stPerso)
#endif
void fn_vSetFieldTypeComport(struct tdstGetSetParam_ *p_stGetSetParam)
{
#if defined(__DEBUG_AI__)
M_VerifyTypeOfParamAction(p_stGetSetParam,E_vt_Comport);
#endif
}
void fn_vSetFieldTypeVector(struct tdstGetSetParam_ *p_stGetSetParam)
{
#if defined(__DEBUG_AI__)
M_VerifyTypeOfParamAction(p_stGetSetParam,E_vt_Vector);
#endif
p_stGetSetParam=p_stGetSetParam;
}
void fn_vSetFieldTypeFloat(struct tdstGetSetParam_ *p_stGetSetParam)
{
if (!M_IsFloatType(p_stGetSetParam))
{
M_Full_GetSetParam_Float(p_stGetSetParam,MTH_M_xLongToReal(M_GetSetParam_lValue(p_stGetSetParam)));
}
}
void fn_vSetFieldTypeInteger(struct tdstGetSetParam_ *p_stGetSetParam)
{
fn_ucIsThereFloatIfYesConvertItToInteger(p_stGetSetParam);
}
void fn_vSetFieldType0To255(struct tdstGetSetParam_ *p_stGetSetParam)
{
M_TEST_TRUNCATED_FIELD(p_stGetSetParam, M_INF_SUP, 0, 255);
}
unsigned char fn_ucSetFieldValue(enum tdeFieldId_ eFieldId, HIE_tdxHandleToSuperObject hSuperObjPerso, struct tdstGetSetParam_ *p_stGetSetParam)
{
enum tdeFieldTypeId_ eFieldType=fn_eGetEngineFieldType(eFieldId);
tdp_fn_cSetFunctionPtr p_fn_cSetFieldFunction=fn_p_fn_pGetFieldSetFunctionPtr(eFieldId);
tdp_fn_vSetTypeFunctionPtr p_fn_vSetFieldTypeFunction=fn_p_fn_pGetFieldTypeSetFunctionPtr(eFieldType);
M_INIT_TRUNCATED_FIELD();
/* pre process*/
p_fn_vSetFieldTypeFunction(p_stGetSetParam);
M_CHECK_TRUNCATED_FIELD(eFieldId,hSuperObjPerso);
/* write field*/
return(p_fn_cSetFieldFunction(hSuperObjPerso,p_stGetSetParam));
}
/* Get ******************/
void fn_vGetFieldTypeComport(struct tdstGetSetParam_ *p_stGetSetParam)
{
#if defined(__DEBUG_AI__)
M_VerifyTypeOfParamAction(p_stGetSetParam,E_vt_Comport);
#endif
}
void fn_vGetFieldTypeVector(struct tdstGetSetParam_ *p_stGetSetParam)
{
#if defined(__DEBUG_AI__)
M_VerifyTypeOfParamAction(p_stGetSetParam,E_vt_Vector);
#endif
p_stGetSetParam=p_stGetSetParam;
}
void fn_vGetFieldTypeFloat(struct tdstGetSetParam_ *p_stGetSetParam)
{
if (!M_IsFloatType(p_stGetSetParam))
{
M_Full_GetSetParam_Float(p_stGetSetParam,MTH_M_xLongToReal(M_GetSetParam_lValue(p_stGetSetParam)));
}
}
void fn_vGetFieldTypeInteger(struct tdstGetSetParam_ *p_stGetSetParam)
{
if (M_IsFloatType(p_stGetSetParam))
{
M_Full_GetSetParam_Integer(p_stGetSetParam,MTH_M_xRealToLong(M_GetSetParam_xValue(p_stGetSetParam)));
}
}
void fn_vGetFieldType0To255(struct tdstGetSetParam_ *p_stGetSetParam)
{
if (M_IsFloatType(p_stGetSetParam))
{
M_Full_GetSetParam_Integer(p_stGetSetParam,MTH_M_xRealToLong(M_GetSetParam_xValue(p_stGetSetParam)));
}
}
unsigned char fn_ucGetFieldValue(enum tdeFieldId_ eFieldId, HIE_tdxHandleToSuperObject hSuperObjPerso, struct tdstGetSetParam_ *p_stGetSetParam)
{
enum tdeFieldTypeId_ eFieldType=fn_eGetEngineFieldType(eFieldId);
tdp_fn_cGetFunctionPtr p_fn_cGetFieldFunction=fn_p_fn_pGetFieldGetFunctionPtr(eFieldId);
tdp_fn_vGetTypeFunctionPtr p_fn_vGetFieldTypeFunction=fn_p_fn_pGetFieldTypeGetFunctionPtr(eFieldType);
char ret=C_INVALID_SET;
/*extremly important*/
M_GetSetParam_Clear(p_stGetSetParam);
/* read fields*/
ret=p_fn_cGetFieldFunction(hSuperObjPerso,p_stGetSetParam);
if (ret==C_VALID_GET)
{
/* post process*/
p_fn_vGetFieldTypeFunction(p_stGetSetParam);
}
return(ret);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*/
/* Intell.h : Test pour le module d'intelligence.*/
/* auteur : Olivier Didelot.*/
/* date : 07/08/1996*/
/* 970120 : fnc fn_vInterpretComportNPerso (Fabien Morales) */
/*---------------------------------------------------------------------------*/
#if !defined(__INTELL_H__)
#define __INTELL_H__
struct tdstGetSetParam_;
struct tdstIntelligence_;
#if defined(ACTIVE_EDITOR)
/* to active error intercepting while running : not finished yet*/
#define ACTIVE_EXEC_CHECKING
#if defined(ACTIVE_EXEC_CHECKING)
/*#pragma message("ACTIVE_EXEC_CHECKING is defined ==> editor will run automaticaly if an error occured in AI while running");*/
#endif
#endif
/*///////////////////////////////////////////////////////////////////////////*/
/* PLEASE Never use p_stEvalTree directly, but use theses macros instead ! //*/
/*///////////////////////////////////////////////////////////////////////////*/
/* Oliv' - 27/11/1998*/
#ifdef U64_AIDEBUG
struct AI_tdstMind_ *fn_p_stGetCurrentMind();
void fn_v_SetCurrentMind(struct AI_tdstMind_ *p_stMind);
#endif /* U64_AIDEBUG */
/* EndOfOliv'*/
/*** DR ***/
#if ( (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG) ) && !defined(U64_AIDEBUG)
void fn_vSetStopAIEngineFlag();
/*void fn_vReSetStopAIEngineFlag(); *** DR ****/
unsigned char fn_ucGetStopAIEngineFlag();
struct AI_tdstMind_ *fn_p_stGetCurrentMind();
void fn_v_SetCurrentMind(struct AI_tdstMind_ *p_stMind);
unsigned char fn_ucGetErrorFlag(HIE_tdxHandleToSuperObject p_SuperObjPerso);
#include "ActConst.h"
#include "AI_Struc.h"
#define M_EvalOneParameter(p_SuperObjPerso,p_stTreeOut,p_stTreeIn,p_stParam) \
if ( (!fn_ucGetErrorFlag(p_SuperObjPerso)) && (!fn_ucGetStopAIEngineFlag()) ) \
(p_stTreeOut) = fn_p_stEvalTree( (p_SuperObjPerso), (p_stTreeIn), (p_stParam) ); \
if ( (fn_ucGetErrorFlag(p_SuperObjPerso)) || fn_ucGetStopAIEngineFlag() ) \
{ \
M_Full_GetSetParam_ActionReturn((p_stParam), (C_ACTION_FINISHED | C_ACTION_ENGINE_STOP)); \
return((p_stTreeOut)); \
}
#else
#define M_EvalOneParameter(p_SuperObjPerso,p_stTreeOut,p_stTreeIn,p_stParam) \
(p_stTreeOut) = fn_p_stEvalTree( (p_SuperObjPerso), (p_stTreeIn), (p_stParam) );
#endif
#define M_EvalTwoParameters(p_SuperObjPerso,p_stTreeOut,p_stTreeIn,p_stParam1,p_stParam2) \
M_EvalOneParameter((p_SuperObjPerso),(p_stTreeOut),(p_stTreeIn),(p_stParam1)); \
M_EvalOneParameter((p_SuperObjPerso),(p_stTreeOut),(p_stTreeIn),(p_stParam2)); \
#define M_EvalNextParameter(p_stValue) \
M_EvalOneParameter(p_SuperObjPerso,p_stTree,p_stTree,(p_stValue)) \
#define M_EvalNextTwoParameter() \
M_EvalNextParameter(&stParam1); \
M_EvalNextParameter(&stParam2);
#define M_vEvalNextVarId(p_stResultMind, ucResultVarId) \
{ \
HIE_tdxHandleToSuperObject p_stResultOwnerPerso; \
if ( M_GetTypeInterpret(p_stTree) == E_ti_Operator ) /* if the dsgvar is passed through an ultra operator, parse it */ \
{ \
/* make sure it is an ultra operator */ \
SAF_M_AssertWithMsg((M_eOperatorIdInterpret(p_stTree) == eOperator_Dot),"the argument is not a dsgvar reference"); \
/* skip the operator node to go to the arguments */ \
p_stTree ++; \
/* get the perso argument of the ultra operator */ \
p_stTree = fn_p_stOperatorGetPerso(p_SuperObjPerso,p_stTree,&p_stResultOwnerPerso); \
} \
else \
/* the dsgvar reference is owned by the calling instance */ \
p_stResultOwnerPerso = p_SuperObjPerso; \
\
/* get the mind of the owning perso (where the dsgvar is stored */ \
p_stResultMind = AI_M_stGetMindOfSuperObj(p_stResultOwnerPerso); \
/* get the dsgvar index (the second argument of the ultra operator if relevant */ \
ucResultVarId = M_ucVarIdInterpret(p_stTree); \
p_stTree ++; \
}
struct tdstNodeInterpret_ *fn_p_stSwapNextParameter(struct tdstNodeInterpret_ *p_stTree);
struct tdstNodeInterpret_ *fn_p_stSwapNextParameter2(struct tdstNodeInterpret_ *p_stTree);
struct tdstNodeInterpret_ *fn_p_stSkipThisArgument(struct tdstNodeInterpret_ *p_stTree);
struct tdstNodeInterpret_ *fn_p_stEvalTree(HIE_tdxHandleToSuperObject p_SuperObjPerso, struct tdstNodeInterpret_ *p_stTree, struct tdstGetSetParam_ *p_stValue);
struct tdstNodeInterpret_ *fn_p_stIntelligenceEvalTreeEngine(HIE_tdxHandleToSuperObject p_SuperObjPerso, struct tdstNodeInterpret_ *p_stTree, struct tdstGetSetParam_ *p_stValue);
ACP_tdxBool fn_bIntelligenceEngine(HIE_tdxHandleToSuperObject p_SuperObjPerso, struct tdstIntelligence_ *p_stIntelligence);
#if defined(__DEBUG_AI__)
void fn_vTestGetDsgVarOrField(unsigned char choice,unsigned char ucVarId,unsigned char ucIndex,enum tdeFieldId_ eFieldId,HIE_tdxHandleToSuperObject p_SuperObjPerso ,struct tdstGetSetParam_ *p_stValue);
#endif
#include "TypePtr.h"
void fn_vSetProcedureActionReturn(tducActionReturn ucActionReturn);
tducActionReturn fn_ucGetProcedureActionReturn(void); /*AR980313*/
/*////////////////////*/
/* Global Variables //*/
/*////////////////////*/
#undef EXTERN
#undef extern
#if !defined(__DeclareGlobalVariableIntell_h__)
#define EXTERN extern
#else
#define EXTERN
#endif /*__DeclareGlobalVariableIntell_h__*/
EXTERN struct tdstIntelligence_ *g_p_stIntelligence;
EXTERN unsigned char g_ucNRule;
EXTERN ACP_tdxBool bSomethingDone;
#endif /* __INTELL_H__*/

View File

@@ -0,0 +1,595 @@
/*---------------------------------------------------------------------------*/
/* List.c : perso list for AI.*/
/* author : Olivier Couvreur 28/11/1997*/
/*---------------------------------------------------------------------------*/
/* included in DsgMem.c so excluded from build in VC project*/
#include "AIUseCPA.h"
#include "AI_Mmg.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "ai_struc.h"
#include "List.h"
/*XB*/
#include "Intell.h"
/*End XB*/
#include "gsparam.h"
/***********************************************************************************************************************/
/* LIST */
/***********************************************************************************************************************/
/* Body of functions for List of Perso*/
/*/////////////////////////////////////*/
void fn_vPutInList (tdstList *p_List, HIE_tdxHandleToSuperObject p_Perso)
/* -------------*/
/* add perso at the end.*/
{
if (p_List->ucNbElt < p_List->ucMaxSize){
p_List->d_TabElt[p_List->ucNbElt++]=p_Perso;
}
else {
M_AIFatalError(E_uwAIFatalPersoListFull);
}
}
void fn_vInsertPersoAtPositionInList (tdstList *p_List, HIE_tdxHandleToSuperObject p_Perso, unsigned char ucPosition)
/* -------------------------------*/
/*ucPosition belows [0,p_List->ucNbElt+1] & ucPosition < C_ucSizeOfMaximalList*/
{
unsigned char ucI;
ucPosition = (unsigned char) M_Min (p_List->ucNbElt+1, ucPosition);
if (p_List->ucNbElt < p_List->ucMaxSize){
/* shift back the all element from ucPosition to the of the list*/
for (ucI=p_List->ucNbElt; ucI>ucPosition; ucI--){
p_List->d_TabElt [ucI]= p_List->d_TabElt[ucI-1];
}
p_List->d_TabElt[ucPosition]=p_Perso;
p_List->ucNbElt++;
}
else {
M_AIFatalError(E_uwAIFatalPersoListFull);
}
}
Bool fn_bFindPersoInList(tdstList *p_List, HIE_tdxHandleToSuperObject p_Perso)
/* -------------------*/
/* return TRUE if the perso was found*/
/* return FALSE if the perso was not found*/
{
unsigned char ucPosition;
/* No element in list */
if (p_List->ucNbElt==0)
return 0;
for (ucPosition=0; (ucPosition < p_List->ucNbElt) && ( p_List->d_TabElt[ucPosition] != p_Perso); ucPosition++) {}; /*{} for lint */
/*if (ucPosition == p_List->ucNbElt)*/
/*return 0;*/
/*return ((Bool) (p_List->d_TabElt[ucPosition] == p_Perso) );*/
return ((Bool) (ucPosition < p_List->ucNbElt) );
}
/*
----------------------------------------------------------------------------------------
Description : fn_bFindModelInList
Returns (Bool ) TRUE if one perso of the model has been found in the list, else FALSE
----------------------------------------------------------------------------------------
Author : Fred 'Bart' Compagnon
Date : 07/05/98
----------------------------------------------------------------------------------------
*/
Bool fn_bFindModelInList(tdstList *p_List, AI_tdstAIModel *_p_stModel)
{
unsigned char ucPosition;
/* No element in list */
if (p_List->ucNbElt==0)
return 0;
for (
ucPosition=0;
(ucPosition < p_List->ucNbElt)
&& ( AI_M_p_stGetAIModel(M_pstGetMindOfBrain(M_GetMSHandle(p_List->d_TabElt[ucPosition],Brain))) != _p_stModel );
ucPosition++)
{}; /*{} for lint */
/*if (ucPosition == p_List->ucNbElt)*/
/*return 0;*/
/*return ((Bool) (AI_M_p_stGetAIModel(M_pstGetMindOfBrain(M_GetMSHandle(p_List->d_TabElt[ucPosition],Brain))) == _p_stModel) );*/
return ((Bool) (ucPosition < p_List->ucNbElt) );
}
/*
----------------------------------------------------------------------------------------
Description : fn_bFindFamilyInList
Returns (Bool ) TRUE if one perso of the family has been found in the list, else FALSE
----------------------------------------------------------------------------------------
Author : Fred 'Bart#02' Compagnon
Date : 07/05/98
----------------------------------------------------------------------------------------
*/
Bool fn_bFindFamilyInList(tdstList *p_List, tdxHandleToFamilyList hFamily)
{
unsigned char ucPosition;
/* No element in list */
if (p_List->ucNbElt==0)
return 0;
for (
ucPosition=0;
(ucPosition < p_List->ucNbElt)
&& ( fn_h3dDataGetFamily( M_GetMSHandle( p_List->d_TabElt[ucPosition], 3dData) ) != hFamily );
ucPosition++)
{}; /*{} for lint */
/*if (ucPosition == p_List->ucNbElt)*/
/*return 0;*/
/*return ((Bool) ( fn_h3dDataGetFamily( M_GetMSHandle( p_List->d_TabElt[ucPosition], 3dData) ) == hFamily ) );*/
return ((Bool) (ucPosition < p_List->ucNbElt) );
}
Bool fn_bFindPersoAndDeleteInList (tdstList *p_List, HIE_tdxHandleToSuperObject p_Perso)
/* ----------------------------*/
/* return TRUE if the perso was found and delete*/
/* return FALSE if the perso was not found*/
{
unsigned char ucI;
unsigned char ucPosition;
for (ucPosition=0; (ucPosition < p_List->ucNbElt) && (p_List->d_TabElt[ucPosition] != p_Perso); ucPosition++) {}; /*{} for lint*/
if (p_List->d_TabElt[ucPosition] == p_Perso){
/* shift back the all element from ucPosition to the of the list*/
for (ucI=ucPosition; ucI<=p_List->ucNbElt-2; ucI++){
p_List->d_TabElt[ucI]= p_List->d_TabElt[ucI+1];
}
p_List->ucNbElt--;
return 1; /*TRUE*/
}
else return 0; /*FALSE*/
}
void fn_vDeletePersoAtPositionInList (tdstList *p_List, unsigned char ucPosition)
/*ucPosition belows [0,p_List->ucNbElt-1] & ucPosition < C_ucSizeOfMaximalList
if ucPosition = C_ucEndOfList d*/
{
unsigned char ucI;
if (ucPosition == C_ucEndOfList) ucPosition = (unsigned char) (p_List->ucNbElt-1);
if (ucPosition <= p_List->ucNbElt-1){
/* shift back the all element from ucPosition to the of the list*/
for (ucI=ucPosition; ucI<=p_List->ucNbElt-2; ucI++){
p_List->d_TabElt[ucI]= p_List->d_TabElt[ucI+1];
}
p_List->ucNbElt--;
}
else{
#ifdef __FATAL_ERR_AI__
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, E_uwAIFatalPbDeleteInPersoList, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);
#endif /*__FATAL_ERR_AI__*/
}
}
void fn_vSortListByFamily(tdstList *p_List, tdxHandleToFamilyList hFamily)
{
unsigned char ucI, ucJ = 0;
HIE_tdxHandleToSuperObject a_hSupObjElt[C_ucSizeOfMaximalList],hSupObjElt;
tdxHandleToFamilyList hFamilyElt;
/* Find SupObj of the good family and put it in a_hSupObjElt.*/
for (ucI = 0; ucI < M_ucNbEltInList(p_List); ucI++)
{
hSupObjElt = p_List->d_TabElt[ucI];
hFamilyElt = fn_h3dDataGetFamily(M_GetMSHandle(hSupObjElt,3dData));
if (hFamilyElt == hFamily)
a_hSupObjElt[ucJ++] = hSupObjElt;
}
/* Keep in the List only SupObj in a_hSupObjElt.*/
M_ClearList(p_List);
for (ucI = 0; ucI < ucJ; ucI++)
{
fn_vPutInList(p_List, a_hSupObjElt[ucI]);
}
}
void fn_vSortListByModel(tdstList *p_stList, AI_tdstAIModel *_p_stModel)
{
HIE_tdxHandleToSuperObject hPerso;
unsigned char ucPos = 0;
HIE_tdxHandleToSuperObject a_hSupObjElt[C_ucSizeOfMaximalList];
unsigned char ucI, ucJ = 0;
hPerso = fn_p_stGetPersoInList(p_stList, ucPos);
while(hPerso)
{
if
(
(M_GetMSHandle(hPerso,Brain))
&& (AI_M_p_stGetAIModel(M_pstGetMindOfBrain(M_GetMSHandle(hPerso,Brain))) == _p_stModel)
)
a_hSupObjElt[ucJ++] = hPerso;
ucPos++;
hPerso = fn_p_stGetPersoInList(p_stList, ucPos);
}
/* Keep in the List only SupObj in a_hSupObjElt.*/
M_ClearList(p_stList);
for (ucI = 0; ucI < ucJ; ucI++)
{
fn_vPutInList(p_stList, a_hSupObjElt[ucI]);
}
}
void fn_vUnionList (tdstList *p_ListA, tdstList *p_ListB, tdstList *p_ListC)
/* -------------*/
/* A <- B U C*/
{
unsigned char ucI, ucJ;
HIE_tdxHandleToSuperObject p_Perso;
/* A <- B*/
for (ucI = 0; ucI < p_ListB->ucNbElt; ucI++)
{
fn_vPutInList(p_ListA, p_ListB->d_TabElt[ucI]);
}
/*A <- A + (C-B)*/
for (ucI = 0; ucI < p_ListC->ucNbElt; ucI++){
p_Perso = p_ListC->d_TabElt[ucI];
/* test if p_Perso is in ListB*/
for ( ucJ=0;
(ucJ< p_ListB->ucNbElt) && (p_ListB->d_TabElt[ucJ] != p_Perso);
ucJ++) {}; /*{} for lint*/
if (p_ListB->d_TabElt[ucJ] != p_Perso)
{
fn_vPutInList(p_ListA,p_Perso);
}
}
}
void fn_vInterList (tdstList *p_ListA, tdstList *p_ListB, tdstList *p_ListC)
/* -------------*/
/* A <- B inter C*/
{
unsigned char ucB, ucC;
HIE_tdxHandleToSuperObject p_Perso;
for (ucB=0; ucB<p_ListB->ucNbElt; ucB++)
{
p_Perso = p_ListB->d_TabElt[ucB];
for (ucC=0; ucC<p_ListC->ucNbElt; ucC++)
{
if (p_ListC->d_TabElt[ucC] == p_Perso)
{
fn_vPutInList(p_ListA,p_Perso);
break;
}
}
}
}
void fn_vDiffList (tdstList *p_ListA, tdstList *p_ListB, tdstList *p_ListC)
/* ------------*/
/* A <- B - C*/
{
unsigned char ucB, ucC;
HIE_tdxHandleToSuperObject p_Perso;
for (ucB=0; ucB<p_ListB->ucNbElt; ucB++)
{
p_Perso = p_ListB->d_TabElt[ucB];
for ( ucC=0;
(ucC< p_ListC->ucNbElt) && (p_ListC->d_TabElt[ucC] != p_Perso);
ucC++) {}; /*{} for lint*/
if (p_ListC->d_TabElt[ucC] != p_Perso)
{
fn_vPutInList(p_ListA,p_Perso);
}
}
}
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_vAddList*/
/* Add the content of the a listB in a ListA, without double*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Methods: A <- A + (B-A) */
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Input: HIE_tdxHandleToSuperObject p_SuperObjPerso*/
/* tdstNodeInterpret *p_stTree*/
/* tdstGetSetParam *p_stValue*/
/* Output: tdstNodeInterpret * : tree*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan.14, 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Modifications:*/
/* Modification date: Modification Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
void fn_vAddList (tdstList *p_ListA, tdstList *p_ListB)
{
unsigned char ucA, ucB, ucSizeA;
HIE_tdxHandleToSuperObject hPerso;
ucSizeA = p_ListA->ucNbElt;
for (ucB = 0; ucB < p_ListB->ucNbElt; ucB++)
{
hPerso = p_ListB->d_TabElt[ucB];
/* test if hPerso is already in List A*/
/* (ucSizeA) we consider that there is no double in listB */
for (ucA = 0; (ucA<ucSizeA) && p_ListA->d_TabElt[ucA] != hPerso; ucA++) {}; /*{} for lint*/
/* add it in List A*/
if (p_ListA->d_TabElt[ucA] != hPerso)
{
fn_vPutInList(p_ListA,hPerso);
}
}
}
HIE_tdxHandleToSuperObject g_a_hPersoInZone[C_ucSizeOfMaximalList];
void fn_vAffectZddInList(tdstList *p_List, HIE_tdxHandleToSuperObject p_stPerso,
unsigned char ucModulOrCharact, ACP_tdxIndex xZoneId)
{
unsigned short uwI, uwNbDetectedPerso;
M_ClearList(p_List);
uwNbDetectedPerso = M_ucGetMaxSizeOfList(p_List);
fn_vGetAllObjectsInZdd(p_stPerso, ucModulOrCharact, (unsigned char)xZoneId, g_a_hPersoInZone, &uwNbDetectedPerso);
for (uwI=0; uwI < uwNbDetectedPerso; uwI++)
fn_vPutInList(p_List, g_a_hPersoInZone[uwI]);
}
void fn_vAffectZdeInList(tdstList *p_List, HIE_tdxHandleToSuperObject p_stPerso,
unsigned char ucModulOrCharact, ACP_tdxIndex xZoneId, GMT_tdxMask xMask)
{
unsigned short uwI, uwNbDetectedPerso;
M_ClearList(p_List);
uwNbDetectedPerso = M_ucGetMaxSizeOfList(p_List);
fn_vGetAllCharactersInContactWithThisZde(p_stPerso, ucModulOrCharact, (unsigned char)xZoneId, g_a_hPersoInZone, &uwNbDetectedPerso, (unsigned short) xMask);
for (uwI=0; uwI < uwNbDetectedPerso; uwI++)
fn_vPutInList(p_List, g_a_hPersoInZone[uwI]);
}
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/* used only by 1 ia function that is not used...*/
void fn_vAffectTypeZdeWithTypeZdeInList(tdstList *p_List, HIE_tdxHandleToSuperObject p_stPerso, GMT_tdxMask xPersoMask, GMT_tdxMask xOthersMask)
{
unsigned short uwI, uwNbDetectedPerso;
M_ClearList(p_List);
uwNbDetectedPerso = M_ucGetMaxSizeOfList(p_List);
fn_vThisTypeVsThisType(p_stPerso,xPersoMask,xOthersMask,g_a_hPersoInZone,&uwNbDetectedPerso);
for (uwI=0; uwI < uwNbDetectedPerso; uwI++)
fn_vPutInList(p_List, g_a_hPersoInZone[uwI]);
}
#endif
unsigned char fn_ucAtLeastOnePersoInZdd(HIE_tdxHandleToSuperObject p_stPerso, unsigned char ucModulOrCharact, ACP_tdxIndex xZoneId)
{
unsigned short uwNbDetectedPerso = 1;
fn_vGetAllObjectsInZdd(p_stPerso, ucModulOrCharact, (unsigned char)xZoneId, g_a_hPersoInZone, &uwNbDetectedPerso);
return((unsigned char) (uwNbDetectedPerso!=0));
}
unsigned char fn_ucAtLeastOnePersoInZde(HIE_tdxHandleToSuperObject p_stPerso, unsigned char ucModulOrCharact, ACP_tdxIndex xZoneId, GMT_tdxMask xMask)
{
unsigned short uwNbDetectedPerso = 1;
fn_vGetAllCharactersInContactWithThisZde(p_stPerso, ucModulOrCharact, (unsigned char)xZoneId, g_a_hPersoInZone, &uwNbDetectedPerso, (unsigned short) xMask);
return((unsigned char) (uwNbDetectedPerso!=0));
}
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_p_stGetPersoInList*/
/* get the Perso pointer at the given position in the list*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Methods: */
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Input: tdstList *p_List*/
/* unsigned char ucPosition*/
/* Output: HIE_tdxHandleToSuperObject : return handle could be NULL */
/* if bad position is specified*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Modifications:*/
/* Modification date: Modification Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
HIE_tdxHandleToSuperObject fn_p_stGetPersoInList(tdstList *p_List, unsigned char ucPosition)
/* -------------------*/
{
/* empty list ?*/
if (p_List->ucNbElt==0)
return NULL;
/* Bad position in list ? */
if ((ucPosition>=p_List->ucNbElt) && (ucPosition!=C_ucEndOfList))
return NULL;
/* last elem ?*/
if (ucPosition==C_ucEndOfList)
return p_List->d_TabElt[p_List->ucNbElt-1];
else
return p_List->d_TabElt[ucPosition];
}
/* function to implement the ListSelect operator (with b_cInverse=0) and */
/* the ListUnselect operator (with b_cInverse=1).*/
struct tdstNodeInterpret_ * fn_p_stListSelect(tdstList * p_List, char b_cInverse, struct tdstNodeInterpret_ *p_stTree)
{
HIE_tdxHandleToSuperObject *p_p_stPerso;
tdstList stWorkList;
char b_cCondResult;
struct tdstNodeInterpret_ * p_stTreeSv = p_stTree;
tdstGetSetParam stParam;
M_InitScanList(p_List, p_p_stPerso);
M_ClearList (&stWorkList);
while (M_EndingCondScanList(p_List, p_p_stPerso)){
/* eval the condition*/
M_EvalOneParameter(*p_p_stPerso,p_stTree,p_stTreeSv,&stParam);
b_cCondResult = (char) M_GetSetParam_lValue(&stParam);
if (b_cCondResult ^ b_cInverse)
fn_vPutInList (&stWorkList, *p_p_stPerso);
M_GoNextScanList(p_List, p_p_stPerso);
}
/*copy the worklist into the p_List*/
memcpy (p_List, &stWorkList, sizeof (tdstList1) + (stWorkList.ucNbElt -1) * C_SizeOfPersoInList);
return (p_stTree);
}
/*
struct tdstNodeInterpret_ * fn_p_stListSort (tdstList * p_List, unsigned char ucWantedNbElt, char b_cIncrease, struct tdstNodeInterpret_ *p_stTree)
{
HIE_tdxHandleToSuperObject *p_p_stPerso;
HIE_tdxHandleToSuperObject p_stPerso;
unsigned char ucI, ucJ;
long a_lCriteraResult[C_ucSizeOfMaximalList];
long *p_lCriteraResult;
long lValue;
unsigned char ucId = 0;
struct tdstNodeInterpret_ * p_stTreeSv = p_stTree;
tdstGetSetParam stParam;
M_InitScanList(p_List, p_p_stPerso);
p_lCriteraResult = a_lCriteraResult;
// eval every critera
while (M_EndingCondScanList(p_List, p_p_stPerso)){
M_EvalOneParameter(*p_p_stPerso,p_stTree,p_stTreeSv,&stParam);
*(p_lCriteraResult++) = M_GetSetParam_lValue(&stParam);
M_GoNextScanList(p_List, p_p_stPerso);
}
if (b_cIncrease == 0){// sort for decrease case
lValue = 0;
for (ucI=0; (ucI < p_List->ucNbElt-1) && (ucI < ucWantedNbElt); ucI++){
for (ucJ = ucI; ucJ<p_List->ucNbElt; ucJ++){
if (a_lCriteraResult[ucJ]>lValue){
lValue = a_lCriteraResult[ucJ];
ucId = ucJ;
}
}
// permut in order to move up the max
a_lCriteraResult[ucId] = a_lCriteraResult[ucI];
//a_lCriteraResult[ucI] = lValue; // just for debug !!
p_stPerso = p_List->d_TabElt[ucId];
p_List->d_TabElt[ucId] = p_List->d_TabElt[ucI];
p_List->d_TabElt[ucI] = p_stPerso;
}
}
else{// sort for increase case
lValue = (long) 0xFFFFFFFF;
for (ucI=0; (ucI < p_List->ucNbElt-1) && (ucI < ucWantedNbElt); ucI++){
for (ucJ = ucI; ucJ<p_List->ucNbElt; ucJ++){
if (a_lCriteraResult[ucJ]<lValue){
lValue = a_lCriteraResult[ucJ];
ucId = ucJ;
}
}
// permut in order to move up the min
a_lCriteraResult[ucId] = a_lCriteraResult[ucI];
p_stPerso = p_List->d_TabElt[ucId];
p_List->d_TabElt[ucId] = p_List->d_TabElt[ucI];
p_List->d_TabElt[ucI] = p_stPerso;
}
}
p_List->ucNbElt = (unsigned char) M_Min(p_List->ucNbElt, ucWantedNbElt);
return (p_stTree);
}
*/
struct tdstNodeInterpret_ * fn_p_stListSort (tdstList * p_List, unsigned char ucWantedNbElt, char b_cIncrease, struct tdstNodeInterpret_ *p_stTree)
{
HIE_tdxHandleToSuperObject *p_p_stPerso;
HIE_tdxHandleToSuperObject p_stPerso;
unsigned char ucI, ucJ;
MTH_tdxReal a_xCriteraResult[C_ucSizeOfMaximalList];
MTH_tdxReal *p_xCriteraResult;
MTH_tdxReal xValue;
unsigned char ucId = 0;
struct tdstNodeInterpret_ * p_stTreeSv = p_stTree;
tdstGetSetParam stParam;
M_InitScanList(p_List, p_p_stPerso);
p_xCriteraResult = a_xCriteraResult;
/* eval every critera*/
while (M_EndingCondScanList(p_List, p_p_stPerso)){
M_EvalOneParameter(*p_p_stPerso,p_stTree,p_stTreeSv,&stParam);
*(p_xCriteraResult++) = M_ReturnParam_xValue(&stParam);
M_GoNextScanList(p_List, p_p_stPerso);
}
if (b_cIncrease == 0)
{/* sort for decrease case*/
xValue=MTH_C_InfinitMinus;
for (ucI=0; (ucI < p_List->ucNbElt-1) && (ucI < ucWantedNbElt); ucI++)
{
for (ucJ = ucI; ucJ<p_List->ucNbElt; ucJ++)
{
if (a_xCriteraResult[ucJ]>xValue)
{
xValue = a_xCriteraResult[ucJ];
ucId = ucJ;
}
}
/* permut in order to move up the max */
a_xCriteraResult[ucId] = a_xCriteraResult[ucI];
/*a_lCriteraResult[ucI] = lValue; // just for debug !!*/
p_stPerso = p_List->d_TabElt[ucId];
p_List->d_TabElt[ucId] = p_List->d_TabElt[ucI];
p_List->d_TabElt[ucI] = p_stPerso;
}
}
else
{/* sort for increase case*/
/*lValue = (long) 0xFFFFFFFF;*/
xValue= MTH_C_InfinitPlus;
for (ucI=0; (ucI < p_List->ucNbElt-1) && (ucI < ucWantedNbElt); ucI++)
{
for (ucJ = ucI; ucJ<p_List->ucNbElt; ucJ++)
{
if (a_xCriteraResult[ucJ]<xValue)
{
xValue = a_xCriteraResult[ucJ];
ucId = ucJ;
}
}
/* permut in order to move up the min*/
a_xCriteraResult[ucId] = a_xCriteraResult[ucI];
p_stPerso = p_List->d_TabElt[ucId];
p_List->d_TabElt[ucId] = p_List->d_TabElt[ucI];
p_List->d_TabElt[ucI] = p_stPerso;
}
}
p_List->ucNbElt = (unsigned char) M_Min(p_List->ucNbElt, ucWantedNbElt);
return (p_stTree);
}

View File

@@ -0,0 +1,108 @@
/*
------------------------------------------------------------------------------------------
HEADER FILE FOR :
Error definition file for mathematic module
------------------------------------------------------------------------------------------
File Name :
ErrMth.h
------------------------------------------------------------------------------------------
Creation :
* Date :
Feburary 18,1997
* Author :
Albert Pais
------------------------------------------------------------------------------------------
Contents :
This file contains definition for the error management concerning the mathematical
module
------------------------------------------------------------------------------------------
Modification :
* Date :
* Author :
* Modify :
------------------------------------------------------------------------------------------
*/
#ifndef __ERRMTH_H__
#define __ERRMTH_H__
#define C_szXxxVersion "MTH V5.0.0" /* The format is XXX Va.b.c with Xxx is the Tag of the module */
#define C_szXxxFullName "Module Mathematic for AI"/* the complete and clear name of the module */
#define C_szXxxDate __DATE__ /*The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/
/*----------*/
/* Constant */
/*----------*/
/* error of the MTH Module*/
typedef enum e_uwMTHErrNumber_{
E_uwMTHFatalErr = 0,
#ifdef __FATAL_ERR_MTH__
/* -----------------*/
E_uwMTHFatalNotAFatalError,
E_uwMTHFatalInvalidParameter,
E_uwMTHFatalAssertionFailure,
E_uwMTHFatalFailedAllocationMem,
#endif /*__FATAL_ERR_MTH__*/
E_uwMTHStartOfWarning,/* important constant, it allows to recognize if an error is fatal or not.*/
E_uwMTHWarningCanNotFree,
#ifdef __WARNING_ERR_MTH__
/* -------------------*/
#endif /*__WARNING_ERR_MTH__*/
E_uwMTHErrNumber
} e_uwMTHErrNumber;
/*------------------*/
/* Global Variables*/
/*------------------*/
#undef EXTERN
#undef extern
#ifndef __DeclareGlobalVariableErrMth_h__
#define EXTERN_ERRMTH extern /*external declaration*/
#else /*__DeclareGlobalVariableErrMth_h__*/
#define EXTERN_ERRMTH /*replace by nothing : we have to declare*/
#endif /*__DeclareGlobalVariableErrMth_h__*/
EXTERN_ERRMTH unsigned char g_ucMTHModuleId /*number of identification of the Erm module*/
#ifdef __DeclareGlobalVariableErrMth_h__
= C_ucModuleNotInitialized
#endif /*__DeclareGlobalVariableErrMth_h__*/
;
#ifdef __ERROR_STRINGS__
EXTERN_ERRMTH CPA_EXPORT char * g_a_szMTHInformationModule []
#if defined(__DeclareGlobalVariableErrMth_h__) && !defined(CPA_WANTS_IMPORT)
= {C_szXxxVersion, C_szXxxFullName, C_szXxxDate}
#endif /*__DeclareGlobalVariableErrMth_h__ && CPA_WANTS_IMPORT*/
;
EXTERN_ERRMTH char * g_szMTHModuleName /* Obliged syntax 'g_sz'+[Abbreviation of ModuleName]+'ModuleName'*/
#ifdef __DeclareGlobalVariableErrMth_h__
= "Module Mathematic"
#endif /*__DeclareGlobalVariableErrMth_h__*/
;
EXTERN_ERRMTH /*struct!!y!!*/ tdstErrorMsg/*_!!y!!*/ g_a_stMTHTabErr [] /* Obliged syntax 'g_a_st'+[Abbreviation of ModuleName]+'TabErr'*/
#ifdef __DeclareGlobalVariableErrMth_h__/*Call from main program*/
={
#ifdef __FATAL_ERR_MTH__
E_uwMTHFatalNotAFatalError,"This not a valid mth fatal error",
E_uwMTHFatalInvalidParameter,"One or more parameters are invalid",
E_uwMTHFatalAssertionFailure,"Assertions failed",
E_uwMTHFatalFailedAllocationMem,"Allocation failure in module MTH",
/* -------------*/
#endif /*__FATAL_ERR_MTH__*/
#ifdef __WARNING_ERR_MTH__
E_uwMTHWarningCanNotFree,"Free failure in module MTH",
/* ----------------*/
#endif /*__WARNING_ERR_MTH__*/
0xFFFF, "\0"/*fin*/
};
#endif /*__DeclareGlobalVariableErrMth_h__*/
;
#undef extern
#endif /*__ERROR_STRINGS__*/
#endif /*__ERRMTH_H__*/

View File

@@ -0,0 +1,216 @@
/*
------------------------------------------------------------------------------------------
HEADER FILE FOR :
Macros definition for mathematical module
------------------------------------------------------------------------------------------
File Name :
Mth_Macr.h
------------------------------------------------------------------------------------------
Creation :
* Date :
February 18,1997
* Author :
Albert PAIS
------------------------------------------------------------------------------------------
Contents :
This file defines somes macros used in MTH library
------------------------------------------------------------------------------------------
Modification :
* Date :
* Author :
* Modify :
------------------------------------------------------------------------------------------
*/
#if !defined(__MTHMACROS_TYPES__)
#define __MTHMACROS_TYPES__
#if !defined(ONLY_TYPES)
#define MTHMACROS_UNDEF
#define ONLY_TYPES
#endif /* !ONLY_TYPES */
/*
------------------------------------------------------------------------------------------
INCLUDE FILES :
------------------------------------------------------------------------------------------
*/
/*
----------------------------------------
File Name :
Mth_Opt.h
----------------------------------------
Required for :
Mathematical options.
----------------------------------------
*/
#include "Mth_Opt.h"
#if defined(MTHMACROS_UNDEF)
#undef ONLY_TYPES
#undef MTHMACROS_UNDEF
#endif /* !MTHMACROS_UNDEF */
/*
------------------------------------------------------------------------------------------
TYPE DEFINITION :
If enumerate :
M_BeginDeclareEnumerate(<type>)
M_EndDeclareEnumerate(<type>, <basic type>)
------------------------------------------------------------------------------------------
*/
#endif /* !__MTHMACROS_TYPES__ */
#if !defined(ONLY_TYPES)
#if !defined(__MTHMACROS_VARS__)
#define __MTHMACROS_VARS__
#undef EXTERN
#undef extern
#if !defined(GLOBALS)
#define EXTERN extern
#else /* !GLOBALS */
#define EXTERN
#endif /* !GLOBALS */
/*
------------------------------------------------------------------------------------------
MACROS-CONSTANT DECLARATION:
------------------------------------------------------------------------------------------
*/
#undef extern
#endif /* !__MTHMACROS_VARS__ */
#if !defined (__MTHMACROS_PROTOS__)
#define __MTHMACROS_PROTOS__
/*
------------------------------------------------------------------------------------------
MACROS-FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
/*////////////////////*/
/* macro for Error //*/
/*////////////////////*/
#ifdef __FATAL_ERR_MTH__
#define M_MTH_FatalError(FatalErrorNum) \
Erm_M_UpdateLastError(MTH, C_ucErmDefaultChannel, FatalErrorNum, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);
#else /*__FATAL_ERR_MTH__*/
#define M_MTH_FatalError(FatalErrorNum)
#endif /*__FATAL_ERR_MTH__*/
#ifdef __WARNING_ERR_MTH__
#define M_MTH_WarningError(ErrorNum, ucOpenInfoWindow)\
/* ----------------*/\
{ \
if (ErrorNum > E_uwMTHStartOfWarning) \
{ \
Erm_M_UpdateLastError(MTH, C_ucErmDefaultChannel, ErrorNum, C_lErmNoDebugData, ucOpenInfoWindow, C_ucAllowStopForDebug, NULL);\
} \
else \
{ \
M_MTH_FatalError(E_uwMTHFatalNotAFatalError);\
} \
}
#else /*__WARNING_ERR_MTH__*/
#define M_MTH_WarningError(ErrorNum, uwOpenInfoWindow)\
{ \
if (ErrorNum < E_uwMTHStartOfWarning) \
M_MTH_FatalError(E_uwMTHFatalNotAFatalError);\
}
#endif /*__WARNING_ERR_MTH__*/
#ifdef __FATAL_ERR_MTH__
#define M_MTH_IfErrorUpdateFatalError(UsedModule, ErrorNum)\
/* ---------------------------*/\
if (Erm_M_uwCheckError(UsedModule, C_ucErmDefaultChannel)){\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
M_MTH_FatalError(ErrorNum);\
}
#else /*__FATAL_ERR_MTH__*/
#define M_MTH_IfErrorUpdateFatalError(UsedModule, ErrorNum)
#endif /*__FATAL_ERR_MTH__*/
#ifdef __WARNING_ERR_MTH__
#define M_MTH_IfErrorUpdateWarningError(UsedModule, ErrorNum, uwOpenInfoWindow)\
/* -----------------------------*/\
if (Erm_M_uwCheckError(UsedModule, C_ucErmDefaultChannel)){\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
M_MTH_WarningError(ErrorNum, uwOpenInfoWindow);\
}
#else /*__WARNING_ERR_MTH__*/
#define M_MTH_IfErrorUpdateWarningError(UsedModule, ErrorNum, uwOpenInfoWindow)
#endif /*__WARNING_ERR_MTH__*/
/*////////////////////*/
/* macro for Memory //*/
/*////////////////////*/
#ifdef MODE_STATIC_MEM_FOR_MTH
#define M_MTH_InitMem() Mmg_M_SetModeAlloc4Ch(MTH, E_ucMTHBlock1,C_ucMmgDefaultChannel)
#else
#define M_MTH_InitMem() Mmg_M_SetModeAlloc4Ch(MTH, E_ucDynamic,C_ucMmgDefaultChannel)
#endif /* MODE_STATIC_MEM_FOR_MTH*/
#define M_MTH_Alloc(Var, cast, ucSize)\
{\
M_MTH_InitMem();\
Var = (cast) Mmg_fn_p_vAlloc4Ch(ucSize,C_ucMmgDefaultChannel);\
M_MTH_IfErrorUpdateFatalError(Mmg, E_uwMTHFatalFailedAllocationMem);\
}
#define M_MTH_AllocWithoutInitMem(Var, cast, ucSize)\
{\
Var = (cast) Mmg_fn_p_vAlloc4Ch(ucSize,C_ucMmgDefaultChannel);\
M_MTH_IfErrorUpdateFatalError(Mmg, E_uwMTHFatalFailedAllocationMem);\
}
#define M_MTHRealloc(Var, AdrSrc, cast, ucSize)\
{\
M_MTH_InitMem();\
Var = (cast) Mmg_fn_p_vRealloc4Ch(AdrSrc, ucSize,C_ucMmgDefaultChannel);\
M_MTH_IfErrorUpdateFatalError(Mmg, E_uwMTHFatalFailedAllocationMem);\
}
#define M_MTHReallocWithoutInitMem(Var, AdrSrc, cast, ucSize)\
{\
Var = (cast) Mmg_fn_p_vRealloc4Ch(AdrSrc, ucSize,C_ucMmgDefaultChannel);\
M_MTH_IfErrorUpdateFatalError(Mmg, E_uwMTHFatalFailedAllocationMem);\
}
#define M_MTHFree(p_cAdr) \
{\
M_MTH_InitMem();\
Mmg_fn_vFree4Ch(p_cAdr,C_ucMmgDefaultChannel);\
M_MTH_IfErrorUpdateWarningError(Mmg, E_uwMTHWarningCanNotFree, C_ucErmOpenInfoWindow);\
p_cAdr=NULL; \
}
#define M_MTHFreeWithoutInitMem(p_cAdr) \
{\
Mmg_fn_vFree4Ch(p_cAdr,C_ucMmgDefaultChannel);\
M_MTHIfErrorUpdateWarningError (Mmg, E_uwMTHWarningCanNotFree, C_ucErmOpenInfoWindow);\
p_cAdr=NULL; \
}
#ifdef MTH_M_DEBUG
#define MTH_M_ASSERT(_Expression,_eErrorCode)\
if(!(_Expression))\
{\
M_MTH_FatalError(_eErrorCode);\
}
#else /* MTH_M_DEBUG */
#define MTH_M_ASSERT(_Expression,_eErrorCode)
#endif /* MTH_M_DEBUG */
/*
------------------------------------------------------------------------------------------
FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
#endif /* !__MTHMACROS_PROTOS__ */
#endif /* !ONLY_TYPES */

View File

@@ -0,0 +1,134 @@
/*
------------------------------------------------------------------------------------------
IMPLEMENTATION FILE FOR :
Main file for mathematical module
------------------------------------------------------------------------------------------
File Name :
MthMain.c
------------------------------------------------------------------------------------------
Creation Date :
February 18,1997
Author :
Albert PAIS
------------------------------------------------------------------------------------------
Contents :
This file contains main implementation for mathematical module
------------------------------------------------------------------------------------------
Remarks :
At the creation date, it is used to implemant mathematical error and memory management
module only.
------------------------------------------------------------------------------------------
See Also :
ErrMth.h for error management definition
MemMth.h for memory management definition
------------------------------------------------------------------------------------------
*/
/*
------------------------------------------------------------------------------------------
INCLUDE FILES :
------------------------------------------------------------------------------------------
*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
/*
----------------------------------------
File Name :
Mth_Opt.h
----------------------------------------
Required for :
Definition of MTH module option
----------------------------------------
*/
#include "Mth_Opt.h"
/*
----------------------------------------
File Name :
Mth_Erm.h
----------------------------------------
Required for :
Error file definition
----------------------------------------
*/
#define __DeclareGlobalVariableErrMth_h__
#include "Mth_Erm.h"
#undef __DeclareGlobalVariableErrMth_h__
/*
----------------------------------------
File Name :
Mth_Mmg.h
----------------------------------------
Required for :
Memory file definition
----------------------------------------
*/
#define __DeclareGlobalVariableMemMth_h__
#include "Mth_Mmg.h"
#undef __DeclareGlobalVariableMemMth_h__
/*
----------------------------------------
File Name :
Mth_Misc.h
----------------------------------------
Required for :
Miscellaneous definition.
----------------------------------------
*/
#define MTH_MISC_GLOBALS
#include "Mth_Misc.h"
#undef MTH_MISC_GLOBALS
void MTH_fnv_InitModule(unsigned long _ulMemorySizePerBlock)
{
#ifdef MODE_STATIC_MEM_FOR_MTH
unsigned char c_ucCurrentBlock;
#else
_ulMemorySizePerBlock=_ulMemorySizePerBlock;
#endif /* MODE_STATIC_MEM_FOR_MTH */
/* Init error module :*/
Erm_M_InitErrMsg(MTH);
/* init memory module */
Mmg_M_InitMmg(MTH);
#ifdef MODE_STATIC_MEM_FOR_MTH
/* initialise blocks :*/
for
(
c_ucCurrentBlock = 0;
c_ucCurrentBlock<E_ucMTHMaxBlocksNb;
c_ucCurrentBlock++
)
{
Mmg_M_InitBlock(MTH,c_ucCurrentBlock,_ulMemorySizePerBlock*1024);
}
#endif /* MODE_STATIC_MEM_FOR_MTH */
}
void MTH_fnv_DesinitModule(void)
{
#ifdef MODE_STATIC_MEM_FOR_MTH
unsigned char c_ucCurrentBlock;
#endif /* MODE_STATIC_MEM_FOR_MTH */
/* desinit previous allocated blocks !*/
#ifdef MODE_STATIC_MEM_FOR_MTH
for(c_ucCurrentBlock=0;c_ucCurrentBlock;c_ucCurrentBlock++)
{
MTH_M_FreeBlock(MTH,c_ucCurrentBlock);
}
#endif /* MODE_STATIC_MEM_FOR_MTH */
}
#ifndef FINAL_VERSION
void MTH_PrintUsedStaticMemory()
{
Mmg_M_PrintUsedStaticMemoryInModule(MTH);
}
#endif /* FINAL_VERSION */

View File

@@ -0,0 +1,120 @@
/*
------------------------------------------------------------------------------------------
HEADER FILE FOR :
Miscellaneous definition for mathematical module
------------------------------------------------------------------------------------------
File Name :
Mth_Misc.h
------------------------------------------------------------------------------------------
Creation :
* Date :
February 28,1997
* Author :
Albert PAIS
------------------------------------------------------------------------------------------
Contents :
This file defines miscellaneous structure, macros and functions
of the mathematical module
------------------------------------------------------------------------------------------
Modification :
* Date :
* Author :
* Modify :
------------------------------------------------------------------------------------------
*/
#if !defined(__MTHMISC_TYPES__)
#define __MTHMISC_TYPES__
#if !defined(ONLY_TYPES)
#define MTHMISC_UNDEF
#define ONLY_TYPES
#endif /* !ONLY_TYPES */
/*
------------------------------------------------------------------------------------------
INCLUDE FILES :
------------------------------------------------------------------------------------------
*/
#if defined(MTHMISC_UNDEF)
#undef ONLY_TYPES
#undef MTHMISC_UNDEF
#endif /* !MTHMISC_UNDEF */
/*
------------------------------------------------------------------------------------------
TYPE DEFINITION :
If enumerate :
M_BeginDeclareEnumerate(<type>)
M_EndDeclareEnumerate(<type>, <basic type>)
------------------------------------------------------------------------------------------
*/
#endif /* !__MTHMISC_TYPES__ */
#if !defined(ONLY_TYPES)
#if !defined(__MTHMISC_VARS__)
#define __MTHMISC_VARS__
#undef MTH_MISC_EXTERN
#undef extern
#if !defined(MTH_MISC_GLOBALS)
#define MTH_MISC_EXTERN extern
#else /* !GLOBALS */
#define MTH_MISC_EXTERN
#endif /* !GLOBALS */
/*
------------------------------------------------------------------------------------------
VARIABLE DECLARATION :
<type> <variable name>
#if defined(GLOBALS)
= <initial values>
#endif
;
------------------------------------------------------------------------------------------
*/
/*
------------------------------------------------------------------------------------------
MACROS-CONSTANT DECLARATION:
------------------------------------------------------------------------------------------
*/
#endif /* !__MTHMISC_VARS__ */
#if !defined (__MTHMISC_PROTOS__)
#define __MTHMISC_PROTOS__
/* For DLLs who are using this module : */
#undef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
/*
------------------------------------------------------------------------------------------
MACROS-FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
/*
------------------------------------------------------------------------------------------
FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
MTH_MISC_EXTERN CPA_EXPORT void MTH_fnv_InitModule(unsigned long);
MTH_MISC_EXTERN CPA_EXPORT void MTH_fnv_DesinitModule(void);
MTH_MISC_EXTERN CPA_EXPORT void MTH_PrintUsedStaticMemory(void);
#endif /* !__MTHMISC_PROTOS__ */
#endif /* !ONLY_TYPES */

View File

@@ -0,0 +1,66 @@
/*
------------------------------------------------------------------------------------------
HEADER FILE FOR :
memory definition file for mathematic module
------------------------------------------------------------------------------------------
File Name :
MemMth.h
------------------------------------------------------------------------------------------
Creation :
* Date :
Feburary 18,1997
* Author :
Albert Pais
------------------------------------------------------------------------------------------
Contents :
This file contains definition for the memory management concerning the mathematical
module
------------------------------------------------------------------------------------------
Modification :
* Date :
* Author :
* Modify :
------------------------------------------------------------------------------------------
*/
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
#ifndef __MemMth_H__
#define __MemMth_H__
enum e_ucMthStaticBlocks{
E_ucMTHBlock1, /* Not used now*/
E_ucMTHMaxBlocksNb /* maximum number of static block, You have to follow this syntax 'E_uc+ Abbreviation Module +MaxBlocksNb'*/
};
#undef EXTERN
#undef extern
#ifdef __DeclareGlobalVariableMemMth_h__
#define EXTERN /*nothing*/
#else /* no __DeclareGlobalVariableMemMth_h__*/
#define EXTERN extern
#endif /*__DeclareGlobalVariableMemMth_h__*/
EXTERN CPA_EXPORT tdstBlockInfo g_a_stMTHBlocksInfo[E_ucMTHMaxBlocksNb];
#ifdef __DYNAMIC_MALLOC_ALLOWED__
#ifdef __DEBUG_MALLOC_MODE__
EXTERN CPA_EXPORT tdstDynInfo g_stMTHDynInfo;
#endif /*__DEBUG_MALLOC_MODE__*/
#endif /*__DYNAMIC_MALLOC_ALLOWED__*/
#undef extern
#endif /*__MemMth_H__*/

View File

@@ -0,0 +1,42 @@
/*
------------------------------------------------------------------------------------------
HEADER FILE FOR :
Option for MTH Module
------------------------------------------------------------------------------------------
File Name :
Mth_Opt.h
------------------------------------------------------------------------------------------
Creation :
* Date :
February 18,1997
* Author :
Albert Pais
------------------------------------------------------------------------------------------
Contents :
This files defines main option for the mathematical module
------------------------------------------------------------------------------------------
Modification :
* Date :
* Author :
* Modify :
------------------------------------------------------------------------------------------
*/
#if !defined(__MTHOPT_H__)
#define __MTHOPT_H__
/* For fatal errors :*/
#define __FATAL_ERR_MTH__
/* #undef __FATAL_ERR_MTH__*/
/* for warning errors :*/
#define __WARNING_ERR_MTH__
/*#undef __WARNING_ERR_MTH__*/
/* for static/dynamic memory management :*/
/*#define MODE_STATIC_MEM_FOR_MTH*/
#undef MODE_STATIC_MEM_FOR_MTH
/* debug/Ndebug mode :*/
#define MTH_M_DEBUG
/*#undef MTH_M_DEBUG*/
#endif

View File

@@ -0,0 +1,466 @@
//#include <Windows.h>
/*
INFORMATINOS SUR LES LECTEURS
*/
/* Renvoie le numero de serie crypte du lecteur passe en parametre */
#define M_SNCryptKey 13
#define M_CDSerialNumberWanted (long)((long)2183834492*(long)M_SNCryptKey)
long fn_lVolumeSerialNumber(char *_szFileName, tdstLoaderHandler *stHandler)
{
BY_HANDLE_FILE_INFORMATION stBHFI;
HANDLE hFile;
UINT uiMode;
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
hFile = stHandler->CreateFile(_szFileName, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
stHandler->SetErrorMode(uiMode);
if (hFile != INVALID_HANDLE_VALUE)
{
if (stHandler->GetFileInformationByHandle(hFile, &stBHFI))
{
stHandler->CloseHandle (hFile);
return (stBHFI.dwVolumeSerialNumber * M_SNCryptKey);
}
stHandler->CloseHandle (hFile);
}
return (long)2832043;
}
/* Renvoie le typde du lecteur passe en parametre */
#define M_CDDriveTypeWanted DRIVE_CDROM
long fn_lDriveType(char *_szFileName, tdstLoaderHandler *stHandler)
{
UINT uiMode;
long lResult;
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
lResult = stHandler->GetDriveType(_szFileName);
stHandler->SetErrorMode(uiMode);
return lResult;
}
/* Renvoie une valeur de hashage correspondant au label du lecteur passe en parametre */
#define M_CDLabelWanted -1323110684
long fn_lDriveLabel(char *_szFileName, tdstLoaderHandler *stHandler)
{
UINT uiMode;
char xBuffer[255], *pBuffer;
long lResult = 0;
pBuffer = xBuffer;
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
stHandler->GetVolumeInformation(_szFileName, pBuffer, 255, NULL, NULL, NULL, NULL, 0);
stHandler->SetErrorMode(uiMode);
/* Hash code du label... */
while (*pBuffer != 0)
{
lResult = (lResult << 5) + lResult + tolower(*pBuffer);
++pBuffer;
}
return lResult;
}
/* Renvoie le file systeme crypte du lecteur passe en parametre */
#define M_CDFSCryptKey 2759
#define M_CDFSWanted 1397113923L * M_CDFSCryptKey /* "CDFS"*/
long fn_lDriveFsType(char *_szFileName, tdstLoaderHandler *stHandler)
{
UINT uiMode;
char xBuffer[10];
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
stHandler->GetVolumeInformation(_szFileName, NULL, NULL, NULL, NULL, NULL, xBuffer, 10);
stHandler->SetErrorMode(uiMode);
return *((long *)xBuffer) * M_CDFSCryptKey;
}
/* Renvoie l'espace libre crypte en cluster du lecteur passe en parametre */
#define M_SFCryptKey 2533
#define M_CDFreeClusterWanted 0+M_SFCryptKey
long fn_lDriveFreeSpace(char *_szFileName, tdstLoaderHandler *stHandler)
{
UINT uiMode;
DWORD dwInfos[4];
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
stHandler->GetDiskFreeSpace(_szFileName, &dwInfos[0], &dwInfos[1], &dwInfos[2], &dwInfos[3]);
stHandler->SetErrorMode(uiMode);
return dwInfos[2] + M_SFCryptKey;
}
/* Renvoie le nombre de secteurs par cluster du lecteur passe en parametre */
#define M_SPCCryptKey 1937
#define M_CDSectorsPerClusterWanted 1*M_SPCCryptKey
long fn_lDriveSectorsPerCluster(char *_szFileName, tdstLoaderHandler *stHandler)
{
UINT uiMode;
DWORD dwInfos[4];
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
stHandler->GetDiskFreeSpace(_szFileName, &dwInfos[0], &dwInfos[1], &dwInfos[2], &dwInfos[3]);
stHandler->SetErrorMode(uiMode);
return dwInfos[0] * M_SPCCryptKey;
}
/* Renvoie le nombre de bytes par secteur du lecteur passe en parametre */
#define M_BPSCryptKey 9701
#define M_CDBytesPerSectorWanted 2048*M_BPSCryptKey
long fn_lDriveBytesPerSector(char *_szFileName, tdstLoaderHandler *stHandler)
{
UINT uiMode;
DWORD dwInfos[4];
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
stHandler->GetDiskFreeSpace(_szFileName, &dwInfos[0], &dwInfos[1], &dwInfos[2], &dwInfos[3]);
stHandler->SetErrorMode(uiMode);
return dwInfos[1] * M_BPSCryptKey;
}
/* Renvoie le nombre de clusters du lecteur passe en parametre */
#define M_NCCryptKey 10497
#define M_CDClustersWanted 186225*M_NCCryptKey
long fn_lDriveClusters(char *_szFileName, tdstLoaderHandler *stHandler)
{
UINT uiMode;
DWORD dwInfos[4];
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
stHandler->GetDiskFreeSpace(_szFileName, &dwInfos[0], &dwInfos[1], &dwInfos[2], &dwInfos[3]);
stHandler->SetErrorMode(uiMode);
return dwInfos[3] * M_NCCryptKey;
}
/*
INFORMATINOS SUR LES FICHIERS
*/
/* Renvoie les attributs cryptes du fichier passe en parametre */
#define M_FCACryptKey 57931
long fn_lFileChangeAttribut(char *_szFileName, tdstLoaderHandler *stHandler)
{
UINT uiMode;
long lResult;
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
stHandler->SetFileAttributes(_szFileName, FILE_ATTRIBUTE_NORMAL);
lResult = stHandler->GetFileAttributes(_szFileName);
stHandler->SetErrorMode(uiMode);
return lResult * M_FCACryptKey;
}
/* Test en ecriture le fichier et renvoie 1 en cas de succes (donc d'erreur pour le protection :)*/
long fn_lFileWriteable(char *_szFileName, tdstLoaderHandler *stHandler)
{
HANDLE hFile;
UINT uiMode;
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
hFile = stHandler->CreateFile(_szFileName , GENERIC_WRITE , 0 , NULL , CREATE_ALWAYS , FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL);
stHandler->SetErrorMode(uiMode);
if( hFile != INVALID_HANDLE_VALUE)
{
stHandler->CloseHandle (hFile);
return 1;
}
else
{
return 0;
}
}
/* Renvoie la taille cryptee du fichier passe en parametre */
#define M_FSCryptKey 53791
long fn_lFileSize(char *_szFileName, tdstLoaderHandler *stHandler)
{
DWORD iResult;
HANDLE hFile;
UINT uiMode;
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
hFile = stHandler->CreateFile(_szFileName, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
stHandler->SetErrorMode(uiMode);
if (hFile != INVALID_HANDLE_VALUE)
{
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
iResult = stHandler->GetFileSize(hFile, NULL);
stHandler->CloseHandle (hFile);
stHandler->SetErrorMode(uiMode);
return iResult*M_FSCryptKey;
}
return M_FSCryptKey;
}
/* Renvoie l'heure de derniere modification, cryptee, du fichier passe en parametre */
#define M_FTCryptKey 53791
long fn_lFileTime(char *_szFileName, tdstLoaderHandler *stHandler)
{
DWORD dwResult[2];
HANDLE hFile;
UINT uiMode;
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
hFile = stHandler->CreateFile(_szFileName, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
stHandler->SetErrorMode(uiMode);
if (hFile != INVALID_HANDLE_VALUE)
{
uiMode = stHandler->SetErrorMode(SEM_FAILCRITICALERRORS);
stHandler->GetFileTime(hFile, NULL, NULL, (LPFILETIME)dwResult);
--dwResult[0];
stHandler->SetFileTime(hFile, NULL, NULL, (LPFILETIME)dwResult);
stHandler->GetFileTime(hFile, NULL, NULL, (LPFILETIME)dwResult);
stHandler->SetErrorMode(uiMode);
return ((dwResult[0] * M_FTCryptKey) << 16) + dwResult[1];
}
return M_FTCryptKey;
}
/*
VERIFICATION DU SYSTEME
*/
#define M_SoftIceWanted 83
long fn_lSoftIcePresent(char *_szFileName, tdstLoaderHandler *stHandler)
{
HANDLE hFile = stHandler->CreateFile(_szFileName ,
GENERIC_READ,FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if( hFile != INVALID_HANDLE_VALUE )
{
stHandler->CloseHandle(hFile);
return M_SoftIceWanted-11;
}
return M_SoftIceWanted;
}
#define M_DHCryptKey 3036172749
long fn_lDllHooked(char *_szFunctionName, tdstLoaderHandler *stHandler)
{
return stHandler->SearchExportedFunctionInEveryDLL(_szFunctionName) * M_DHCryptKey;
}
#define M_FHCryptKey 3036172749
long fn_lFunctionHooked(char *_szFunctionName, tdstLoaderHandler *stHandler)
{
DWORD dwAddress;
return dwAddress = stHandler->SearchFunctionInImportedTableOfExe(_szFunctionName) + M_FHCryptKey;
}
/* Should be the last!!!!! */
long fn_lLAST_FUNCTION(char *_szFileName, tdstLoaderHandler *stHandler)
{
return 0;
}
/* ATTENTION : les fonction doivent etre declares dans le tableau DANS L'ORDRE d'apparition dans le fichier!!!!
En effet on utilise le pointeur suivant dans le tableau pour connaitre la taille de la fonction
precedante...
Ce n'est pas tres joli, mais c'est la seule maniere automatique :(
*/
ptrFunction g_ListOfProtectionFunctions[50] =
{
/*00*/ &fn_lVolumeSerialNumber,
/*01*/ &fn_lDriveType,
/*02*/ &fn_lDriveLabel,
/*03*/ &fn_lDriveFsType,
/*04*/ &fn_lDriveFreeSpace,
/*05*/ &fn_lDriveSectorsPerCluster,
/*06*/ &fn_lDriveBytesPerSector,
/*07*/ &fn_lDriveClusters,
/*08*/ &fn_lFileChangeAttribut,
/*09*/ &fn_lFileWriteable,
/*10*/ &fn_lFileSize,
/*11*/ &fn_lFileTime,
/*12*/ &fn_lSoftIcePresent,
/*13*/ &fn_lDllHooked,
/*14*/ &fn_lFunctionHooked,
/*15*/ &fn_lLAST_FUNCTION, /* Should be the last!!!!! */
NULL
};
/* Le tableau suivant contient la liste des fonctions associes a leur parametre et resultat voulu.
Le numero d'ordre correspond au type dans les modele de protection (+100 pour les actifs et +200
pour les passifs).
*/
#define M_FileAttributeRO FILE_ATTRIBUTE_READONLY*M_FCACryptKey
#include"PTC/PTC_abc.h" /* Pour les noms des fonctions dll cryptes */
tdstProtectionsInit g_ProtectionFunctions[100] =
{
/* Tests direct du CD */
/*00*/ &fn_lVolumeSerialNumber, M_CDSerialNumberWanted, "A:\\", 1,
/*01*/ &fn_lDriveType, M_CDDriveTypeWanted, "A:\\", 1,
/*02*/ &fn_lDriveLabel, M_CDLabelWanted, "A:\\", 1,
/*03*/ &fn_lDriveFsType, M_CDFSWanted, "A:\\", 1,
/*04*/ &fn_lDriveFreeSpace, M_CDFreeClusterWanted, "A:\\", 1,
/*05*/ &fn_lDriveSectorsPerCluster, M_CDSectorsPerClusterWanted, "A:\\", 1,
/*06*/ &fn_lDriveBytesPerSector, M_CDBytesPerSectorWanted, "A:\\", 1,
/*07*/ &fn_lDriveClusters, M_CDClustersWanted, "A:\\", 1,
/* Tests sur des fichiers presents sur le CD */
/*08*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\Rayman2.ico", 1,
/*09*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\Dll\\APMP5SVR.dll", 1,
/*10*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*11*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*12*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*13*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*14*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*15*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*16*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*17*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*18*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*19*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*20*/ &fn_lFileChangeAttribut, M_FileAttributeRO, "A:\\", 1,
/*21*/ &fn_lFileWriteable, 0, "A:\\BinData\\game.dsb", 1,
/*22*/ &fn_lFileWriteable, 0, "A:\\Setup.exe", 1,
/*23*/ &fn_lFileWriteable, 0, "A:\\Autorun.inf", 1,
/*24*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*25*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*26*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*27*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*28*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*29*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*30*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*31*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*32*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*33*/ &fn_lFileWriteable, 0, "A:\\", 1,
/*34*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\BinData\\textures.cnt", 1,
/*35*/ &fn_lFileSize, 729088*M_FSCryptKey, "A:\\SetupUbi.exe", 1,
/*36*/ &fn_lFileSize, 921644*M_FSCryptKey, "A:\\InstData\\Rayman.tga", 1,
/*37*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*38*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*39*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*40*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*41*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*42*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*43*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*44*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*45*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*46*/ &fn_lFileSize, 1812*M_FSCryptKey, "A:\\", 1,
/*47*/ &fn_lFileTime, 0, "A:\\Lisezmoi.txt", 1,
/*48*/ &fn_lFileTime, 0, "A:\\Dll\\GliDetectDll.dll", 1,
/*49*/ &fn_lFileTime, 0, "A:\\", 1,
/*50*/ &fn_lFileTime, 0, "A:\\", 1,
/*51*/ &fn_lFileTime, 0, "A:\\", 1,
/*52*/ &fn_lFileTime, 0, "A:\\", 1,
/*53*/ &fn_lFileTime, 0, "A:\\", 1,
/*54*/ &fn_lFileTime, 0, "A:\\", 1,
/*55*/ &fn_lFileTime, 0, "A:\\", 1,
/*56*/ &fn_lFileTime, 0, "A:\\", 1,
/*57*/ &fn_lFileTime, 0, "A:\\", 1,
/*58*/ &fn_lFileTime, 0, "A:\\", 1,
/*59*/ &fn_lFileTime, 0, "A:\\", 1,
/* Test de softice */
/*60*/ &fn_lSoftIcePresent, M_SoftIceWanted, "\\\\.\\SICE", 0,
/*61*/ &fn_lSoftIcePresent, M_SoftIceWanted, "\\\\.\\SIWVID", 0,
/* Tests des fonctions potentiellement hookee */
/*62*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_CreateFileAName, 0,
/*63*/ &fn_lFunctionHooked, 0, PTC_C_CreateFileAName, 0,
/*64*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_WriteFileName, 0,
/*65*/ &fn_lFunctionHooked, 0, PTC_C_WriteFileName, 0,
/*66*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_ReadFileName, 0,
/*67*/ &fn_lFunctionHooked, 0, PTC_C_ReadFileName, 0,
/*68*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_CloseHandleName, 0,
/*69*/ &fn_lFunctionHooked, 0, PTC_C_CloseHandleName, 0,
/*70/ &fn_lDllHooked, M_FHCryptKey, PTC_C_SetErrorModeName, 0,
/*71*/ &fn_lFunctionHooked, 0, PTC_C_SetErrorModeName, 0,
/*72*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_GetFileInformationByHandleName,0,
/*73*/ &fn_lFunctionHooked, 0, PTC_C_GetFileInformationByHandleName,0,
/*74*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_GetDiskFreeSpaceAName, 0,
/*75*/ &fn_lFunctionHooked, 0, PTC_C_GetDiskFreeSpaceAName, 0,
/*76*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_SetFileAttributsAName, 0,
/*77*/ &fn_lFunctionHooked, 0, PTC_C_SetFileAttributsAName, 0,
/*78*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_GetFileAttributsAName, 0,
/*79*/ &fn_lFunctionHooked, 0, PTC_C_GetFileAttributsAName, 0,
/*80*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_GetFileTimeName, 0,
/*81*/ &fn_lFunctionHooked, 0, PTC_C_GetFileTimeName, 0,
/*82*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_SetFileTimeName, 0,
/*83*/ &fn_lFunctionHooked, 0, PTC_C_SetFileTimeName, 0,
/*84*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_SetFilePointerName, 0,
/*85*/ &fn_lFunctionHooked, 0, PTC_C_SetFilePointerName, 0,
/*86*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_FlushFileBufferName, 0,
/*87*/ &fn_lFunctionHooked, 0, PTC_C_FlushFileBufferName, 0,
/*88*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_GetDriveTypeAName, 0,
/*89*/ &fn_lFunctionHooked, 0, PTC_C_GetDriveTypeAName, 0,
/*90*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_GetVolumeInformationAName,0,
/*91*/ &fn_lFunctionHooked, 0, PTC_C_GetVolumeInformationAName,0,
/*92*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_GetFileSizeName, 0,
/*93*/ &fn_lFunctionHooked, 0, PTC_C_GetFileSizeName, 0,
/*94*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_GetLogicalDriveStringsAName,0,
/*95*/ &fn_lFunctionHooked, 0, PTC_C_GetLogicalDriveStringsAName,0,
/*96*/ &fn_lDllHooked, M_FHCryptKey, PTC_C_LoadLibraryAName, 0,
/*97*/ &fn_lFunctionHooked, 0, PTC_C_LoadLibraryAName, 0,
};
/* &fn_lSoftIcePresent, M_SoftIceWanted, "\\\\.\\NTICE", 0,*/

View File

@@ -0,0 +1,997 @@
/*---------------------------------------------------------------------------*/
/* Strintel.cpp : Definition des fonctions utiles pour manipuler les structures*/
/* de donn<6E>e du module d'intelligence.*/
/* auhor : Olivier Didelot 08/08/96*/
/* modify : Olivier Didelot 21/10/96*/
/* .....???????????*/
/* modify : Olivier Couvreur 04/02/97 Lint 0 warnings excepted those specified at the end of AIMacros.h*/
/* modify : Olivier Couvreur 14/02/97 Creation of Deallocation functions*/
/* modify : Olivier Couvreur 18/02/97 CPA_EXPORT + new functions for editor*/
/* modify : Olivier Couvreur 05/03/97 Model can be gathered between several perso + Alloc and Free functions rewritten + Lint*/
/* modify : Olivier Couvreur 11/03/97 .dec can be gathered between several perso + Alloc and Free functions rewritten + Lint*/
/* modify : Olivier Couvreur 25/03/97 NbNode is not an unsigned char anymore + NoComportInit support + minor changes for editor*/
/* modify : Olivier Couvreur 29/04/97 Init Comport and .IAI support + DsgVar Perso*/
/*---------------------------------------------------------------------------*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Mmg.h"
#include "AI_Erm.h"
#include "AI_Struc.h"
#include "AI_Proto.h"
#include "DsgMem.h"
#include "specif/ActTable.h"
#include "StrIntel.h"
#include "Intell.h"
#include "Convert.h"
#if defined(ACTIVE_AIDEBUG) /*** DR ***/
#include "AID_Erm.h"
#include "specif/AID_Trac.h"
#endif /*ACTIVE_AIDEBUG*/
void fn_vOnAIErm_M_UpdateLastError(unsigned short FatalErrorNum,char *szMsg)
{
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, FatalErrorNum, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, szMsg);
}
void fn_vErrorOnAIAlloc()
{
M_AIIfErrorUpdateFatalError(Mmg, E_uwAIFatalFailedAllocationMem);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vErrorOnAIFree()
{
M_AIIfErrorUpdateWarningError (Mmg, E_uwAIWarningCanNotFree, C_ucErmOpenInfoWindow);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vReinitComport(tdstIntelligence *p_stIntelligence)
{
(void) fn_ucChangeComportIntell(p_stIntelligence, (tdstComport *)M_GetNoComportInit(p_stIntelligence));
M_GetPrevComport(p_stIntelligence) = M_GetCurrentComport(p_stIntelligence);
}
unsigned char fn_ucChangeComportIntell(tdstIntelligence *p_stIntelligence, tdstComport *p_stComport)
{
#if defined(__DEBUG_AI__)
long lComport=(p_stComport-M_GetComport(p_stIntelligence));
if ( (lComport<0) || (lComport>=(long) M_GetNbComport(p_stIntelligence)) )
{
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningComportOfAnotherPerso, C_ucErmOpenInfoWindow,M_GetNameComport(p_stComport));
#if defined(ACTIVE_EDITOR) && defined(ACTIVE_EXEC_CHECKING)
fn_vSetStopAIEngineFlag();
#endif
return(FALSE);
}
else
#endif
{
M_GetPrevComport(p_stIntelligence) = M_GetCurrentComport(p_stIntelligence);
M_GetCurrentComport(p_stIntelligence) = p_stComport;
fn_vInitActionTable(p_stIntelligence);
/* Update new schedule.*/
if (M_GetComportSchedule(p_stComport) == NULL)
M_GetCurrentSchedule(p_stIntelligence) = NULL;
else
M_GetCurrentSchedule(p_stIntelligence) = M_GetTreeComportSchedule(p_stComport);
#if defined(ACTIVE_AIDEBUG) /*** DR ***/
AIDebug_M_SetCurrentComport( fn_p_stGetCurrentMind(), p_stComport );
#endif /*ACTIVE_AIDEBUG*/
}
return(TRUE);
}
unsigned char fn_ucGetTreeNbParam(tdstNodeInterpret *p_stTree)
{
unsigned char ucNbParam=0;
unsigned char ucDepth = M_DepthInterpret(p_stTree-1);
while ( (M_DepthInterpret(p_stTree) > ucDepth)
&& (!M_IsTheEndOfTree(p_stTree)))
{
if (M_DepthInterpret(p_stTree)==ucDepth+1)
{
ucNbParam++;
}
p_stTree++;
}
return(ucNbParam);
}
#if defined(OPTIMIZE_NB_NODES)
unsigned short fn_uwGetNbNodeInterpret(struct tdstTreeInterpret_ *p_stTreeInterpret)
{
tdstNodeInterpret *p_stTree,*p_stTreeInit;
p_stTree=p_stTreeInit=M_GetNodeInterpret(p_stTreeInterpret);
if (p_stTree==NULL) return(0);
while(!M_IsTheEndOfTree(p_stTree)) p_stTree++;
p_stTree++;
return ((unsigned short) (p_stTree-p_stTreeInit) );
}
#endif /* OPTIMIZE_NB_NODES*/
/**************************************************************/
/* AI init functions used by allocations */
/**************************************************************/
//#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void fn_vInitMacro(tdstMacro *p_stMacro)
{
M_GetMacroInitTree(p_stMacro) = NULL;
M_GetMacroCurrentTree(p_stMacro) = M_GetMacroInitTree(p_stMacro);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vInitListOfMacro(tdstListOfMacro *p_stListOfMacro, unsigned char ucNbMacro)
{
M_GetMacro(p_stListOfMacro) = NULL;
M_GetNbMacro(p_stListOfMacro) = ucNbMacro;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vInitComport(tdstComport *p_stComport)
{
M_GetComportNbRules(p_stComport)=0;
M_GetComportRules(p_stComport) = NULL;
M_GetComportSchedule(p_stComport) = NULL;
}
void fn_vInitRule(tdstTreeInterpret *p_stRule)
{
M_SetNbNodeInterpret(p_stRule,0);
M_GetNodeInterpret(p_stRule)=NULL;
}
void fn_vInitNodeInterpret(tdstNodeInterpret *p_stNode, long lVal,
tdeTypeInterpret eTypeInterpret, unsigned char ucDepth)
{
M_ClearNodeInterpret(p_stNode);
M_DepthInterpret(p_stNode)=ucDepth;
M_lValueInterpret(p_stNode)=lVal;
M_SetTypeInterpret(p_stNode,eTypeInterpret);
#if defined(OPTIMIZE_SWAP_PARAMETER)
M_NodeToSkip(p_stNode)=0;
#endif
#if defined( ACTIVE_AIDEBUG )
M_SetBreakPoint(p_stNode,FALSE);
#endif /*ACTIVE_AIDEBUG*/
}
#ifdef ACTIVE_EDITOR
/**************************************************************/
/* AI desallocation functions : */
/**************************************************************/
char CFast_g_bNoNeedForFreeNodeContent = 0;
/*********************************************************************************************/
void fn_vFreeNodeContent(tdstNodeInterpret *p_stNode)
{
/* is there node ?*/
if (p_stNode!=NULL)
{
if (M_GetTypeInterpret(p_stNode) == E_ti_String)
{
if (M_szStringInterpret(p_stNode) != NULL)
{
M_AIFree(M_szStringInterpret(p_stNode));
}
}
else if (M_GetTypeInterpret(p_stNode) == E_ti_ConstantVector)
{
if (M_p_stVectorInterpret(p_stNode) != NULL)
{
M_AIFree(M_p_stVectorInterpret(p_stNode));
}
}
fn_vInitNodeInterpret(p_stNode,0,(tdeTypeInterpret) 0,0);
}
}
/* free an array of nodes */
void fn_vFreeNodeInterpretAll(tdstNodeInterpret **p_p_stNode,unsigned short uwNbNodes)
{
/* is there node ?*/
if (*p_p_stNode!=NULL)
{
unsigned short i;
/* free nodes content*/
if ( !CFast_g_bNoNeedForFreeNodeContent ) {
for (i=0;i<uwNbNodes;i++)
{
fn_vFreeNodeContent(&((*p_p_stNode)[i]));
}
}
/* free node itself*/
M_AIFree(*p_p_stNode);
*p_p_stNode=NULL;
}
}
/*********************************************************************************************/
/* free rule content*/
void fn_vFreeRuleContent(tdstTreeInterpret *p_stRules)
{
/* is there rule ?*/
if (p_stRules!=NULL)
{
/* free nodes*/
fn_vFreeNodeInterpretAll(&M_GetNodeInterpret(p_stRules),M_GetNbNodeInterpret(p_stRules));
fn_vInitRule(p_stRules);
}
}
/* free a rule and all its nodes*/
void fn_vFreeRuleAll(tdstTreeInterpret **p_p_stRules,unsigned char ucNbRules)
{
/* is there rule ?*/
if (*p_p_stRules!=NULL)
{
unsigned char i;
/* free rule content (nodes)*/
for(i=0;i<ucNbRules;i++)
{
fn_vFreeRuleContent(&((*p_p_stRules)[i]));
}
/* free rule itself*/
M_AIFree(*p_p_stRules);
*p_p_stRules=NULL;
}
}
/*********************************************************************************************/
/* free schedule content*/
void fn_vFreeScheduleContent(tdstTreeInterpret *p_stSchedule)
{
/* is there schedule ?*/
if (p_stSchedule!=NULL)
{
/* free nodes*/
fn_vFreeNodeInterpretAll(&M_GetNodeInterpret(p_stSchedule),M_GetNbNodeInterpret(p_stSchedule));
fn_vInitRule(p_stSchedule);
}
}
void fn_vFreeScheduleAll(tdstTreeInterpret **p_p_stSchedule)
{
/* is there schedule ?*/
if (*p_p_stSchedule!=NULL)
{
/* free Schedule content (nodes)*/
fn_vFreeScheduleContent(*p_p_stSchedule);
/* free schedule itself*/
M_AIFree(*p_p_stSchedule);
*p_p_stSchedule=NULL;
}
}
/*********************************************************************************************/
/* free a comport content, all its rules, and its schedule*/
void fn_vFreeComportContent(tdstComport *p_stComport)
{
if (p_stComport!=NULL)
{
/* free rules */
fn_vFreeRuleAll(&M_GetComportRules(p_stComport),M_GetComportNbRules(p_stComport));
/* free schedule */
fn_vFreeScheduleAll(&M_GetComportSchedule(p_stComport));
/* clear */
fn_vInitComport(p_stComport);
}
}
void fn_vFreeComportAll(tdstComport **p_p_stComport,unsigned long ulNbComport)
{
/* is there comport ?*/
if (*p_p_stComport!=NULL)
{
unsigned long i;
/* free comport content*/
for (i=0;i<ulNbComport;i++)
{
fn_vFreeComportContent(&((*p_p_stComport)[i]));
}
/* free comport itself*/
M_AIFree(*p_p_stComport);
*p_p_stComport=NULL;
}
}
/*********************************************************************************************/
void fn_vFreeSubroutineContent ( tdstMacro * p_stSubroutine )
{
if ( p_stSubroutine != NULL )
{
fn_vFreeRuleAll ( & M_GetMacroInitTree ( p_stSubroutine ) , 1 ) ;
}
}
/* free a list of Subroutines */
void fn_vFreeSubroutinesAll(tdstListOfMacro **p_stListSubroutines)
{
if ( * p_stListSubroutines != NULL )
{
int i ;
/* free the subroutines */
for ( i = 0 ; i < M_GetNbMacro ( ( * p_stListSubroutines ) ) ; i ++ )
fn_vFreeSubroutineContent ( M_GetMacroN ( * p_stListSubroutines , i) ) ;
/* and free the list itself */
M_AIFree ( * p_stListSubroutines ) ;
* p_stListSubroutines = NULL ;
}
}
/*********************************************************************************************/
void fn_vFreeScriptAIContent(tdstScriptAI *p_stScriptAI)
{
/* is there ScriptAI ?*/
if (p_stScriptAI!=NULL)
{
fn_vFreeComportAll(&M_GetScriptAIComport(p_stScriptAI),M_GetScriptAINbComport(p_stScriptAI));
}
}
/* free a ScriptAI and all its comport*/
void fn_vFreeScriptAIAll(tdstScriptAI **p_p_stScriptAI)
{
/* is there ScriptAI ?*/
if (*p_p_stScriptAI!=NULL)
{
/* free ScriptAI content (comport)*/
fn_vFreeScriptAIContent(*p_p_stScriptAI);
/* free ScriptAI itself*/
M_AIFree(*p_p_stScriptAI);
*p_p_stScriptAI=NULL;
}
}
/*********************************************************************************************/
/* free model content*/
void fn_vFreeAIModelContent(AI_tdstAIModel *p_stAIModel)
{
/* is there Model ?*/
if (p_stAIModel!=NULL)
{
/* free the intelligence */
fn_vFreeScriptAIAll(&AI_M_p_stGetIntelligenceScriptAIModel(p_stAIModel));
/* free the reflexes */
fn_vFreeScriptAIAll(&AI_M_p_stGetReflexScriptAIModel(p_stAIModel));
/* free the subroutines */
fn_vFreeSubroutinesAll(&AI_M_p_stGetListOfMacroAIModel(p_stAIModel)) ;
}
}
/* free a model and its 2 ScriptAI*/
void fn_vFreeAIModelAll(AI_tdstAIModel **p_p_stAIModel)
{
/* is there model ?*/
if (*p_p_stAIModel!=NULL)
{
/* free ScriptAI content (comport)*/
fn_vFreeAIModelContent(*p_p_stAIModel);
/* CFast, is there a RefTree*/
if ((*p_p_stAIModel)->CFast_dst_RefTreeArray != NULL) {
fn_vFreeNodeInterpretAll(&(*p_p_stAIModel)->CFast_dst_RefTreeArray, (*p_p_stAIModel)->uwNbNode) ;
}
/* CFast, is there a ParamTree*/
if ((*p_p_stAIModel)->CFast_dst_ParamArray != NULL) {
CFast_g_bNoNeedForFreeNodeContent = 1 ;
fn_vFreeNodeInterpretAll(&(*p_p_stAIModel)->CFast_dst_ParamArray, (*p_p_stAIModel)->uwNbParamNode) ;
CFast_g_bNoNeedForFreeNodeContent = 0 ;
}
/* free ScriptAI itself*/
M_AIFree(*p_p_stAIModel);
*p_p_stAIModel=NULL;
}
}
/*********************************************************************************************/
/* free action table entry content*/
void fn_vFreeActionTableEntryContent(tdstActionTableEntry *p_stActionTableEntry)
{
/* are there actiontable entries ?*/
if (p_stActionTableEntry!=NULL)
{
/* nothing to do */
}
}
void fn_vFreeActionTableEntryAll(tdstActionTableEntry **p_p_stActionTableEntry,unsigned ucActionTableNbEntry)
{
/* is there comport ?*/
if (*p_p_stActionTableEntry!=NULL)
{
unsigned char i;
/* free comport content*/
for (i=0;i<ucActionTableNbEntry;i++)
{
fn_vFreeActionTableEntryContent(&((*p_p_stActionTableEntry)[i]));
}
/* free comport itself*/
M_AIFree(*p_p_stActionTableEntry);
*p_p_stActionTableEntry=NULL;
}
}
/***************************************************************************/
void fn_vFreeActionTableContent(tdstActionTable *p_stActionTable)
{
/* is there action table ?*/
if (p_stActionTable!=NULL)
{
fn_vFreeActionTableEntryAll(&M_TableEntry(p_stActionTable),M_TableNbEntries(p_stActionTable));
}
}
/* free action table from intelligence*/
void fn_vFreeActionTableAll(tdstActionTable **p_p_stActionTable)
{
/* is there action table ?*/
if (*p_p_stActionTable!=NULL)
{
/* free action table content*/
fn_vFreeActionTableContent(*p_p_stActionTable);
/* free action table itself*/
M_AIFree(*p_p_stActionTable);
*p_p_stActionTable=NULL;
}
}
/*****************************************************************************/
/* free intelligence content*/
void fn_vFreeIntelligenceContent(tdstIntelligence *p_stIntelligence)
{
if (p_stIntelligence!=NULL)
{
fn_vFreeActionTableAll(&M_ActionTable(p_stIntelligence));
M_GetCurrentSchedule(p_stIntelligence)=NULL;
M_GetCurrentComport(p_stIntelligence)=NULL;
M_GetPrevComport(p_stIntelligence)=NULL;
p_stIntelligence->p_p_stScriptAI=NULL;
}
}
/* free intelligence*/
void fn_vFreeIntelligenceAll(tdstIntelligence **p_p_stIntelligence)
{
/* is there intelligence ?*/
if (*p_p_stIntelligence!=NULL)
{
fn_vFreeIntelligenceContent(*p_p_stIntelligence);
/* free intelligence itself*/
M_AIFree(*p_p_stIntelligence);
*p_p_stIntelligence=NULL;
}
}
/* free reflex*/
void fn_vFreeReflexAll(tdstIntelligence **p_p_stReflex)
{
fn_vFreeIntelligenceAll(p_p_stReflex);
}
/********************************************************************************************/
/* free mind content*/
void fn_vFreeMindContent(AI_tdstMind *p_stMind)
{
if (p_stMind!=NULL)
{
/* before model*/
/* free designer variable from mind*/
fn_vFreeDesignerVariable(p_stMind);
/* free AI model*/
/* fn_vFreeAIModelAll(&AI_M_p_stGetAIModel(p_stMind));*/
/* free intelligence from mind*/
fn_vFreeIntelligenceAll(&AI_M_p_stGetIntelligence(p_stMind));
/* free reflex from mind*/
fn_vFreeReflexAll(&AI_M_p_stGetReflex(p_stMind));
}
}
/* free mind all*/
void fn_vFreeMindAll(AI_tdstMind **p_p_stMind)
{
if (*p_p_stMind!=NULL)
{
/* free mind content*/
fn_vFreeMindContent(*p_p_stMind);
/* free mind itself*/
M_AIFree(*p_p_stMind);
*p_p_stMind=NULL;
}
}
#endif /* ACTIVE_EDITOR*/
/**************************************************************/
/* AI allocation functions : */
/**************************************************************/
/**************************************************************/
/* AI allocation functions for macros : */
/**************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdstListOfMacro *fn_p_stAllocListOfMacro(unsigned char ucNbMacro)
{
tdstListOfMacro *p_stListOfMacro=NULL;
/*XB980430*/
/* tdstMacro *p_stMacro=NULL;*/
/*End XB*/
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeMacro , NULL);
M_AIAlloc(p_stListOfMacro, tdstListOfMacro *, sizeof(tdstListOfMacro));
fn_vInitListOfMacro(p_stListOfMacro, ucNbMacro);
if (ucNbMacro!=0)
{
unsigned long i;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeMacro , NULL);
M_AIAlloc(M_GetMacro(p_stListOfMacro), tdstMacro *, ucNbMacro*sizeof(tdstMacro));
for (i=0;i<ucNbMacro;i++)
{
fn_vInitMacro(M_GetMacroN(p_stListOfMacro, i));
}
}
return(p_stListOfMacro);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vAllocListOfMacro(struct AI_tdstMind_ *p_stMind, unsigned char ucNbMacro)
{
AI_M_SetListOfMacroAIModel(AI_M_p_stGetAIModel(p_stMind), fn_p_stAllocListOfMacro(ucNbMacro));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vAllocNodeMacro(tdstMacro *p_stMacro, unsigned short uwNbNode)
{
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeNodeMacro , NULL);
M_AIAlloc(M_GetMacroInitTree(p_stMacro), tdstTreeInterpret *, sizeof(tdstTreeInterpret));
M_GetNodeInterpret(M_GetMacroInitTree(p_stMacro)) = fn_p_stAllocNodeInterpret(uwNbNode);;
M_SetNbNodeInterpret(M_GetMacroInitTree(p_stMacro),uwNbNode);
M_AIAlloc(M_GetMacroCurrentTree(p_stMacro), tdstTreeInterpret *, sizeof(tdstTreeInterpret))
M_GetNodeInterpret(M_GetMacroCurrentTree(p_stMacro)) = M_GetNodeInterpret(M_GetMacroInitTree(p_stMacro));
MMG_fn_vEndMemoryInfo ();
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
tdstComport *fn_p_stAllocComport(unsigned long ulNbComport)
{
tdstComport *p_stComport=NULL;
if (ulNbComport!=0)
{
unsigned long i;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeComport , NULL);
M_AIAlloc(p_stComport,tdstComport *,ulNbComport*sizeof(tdstComport));
for (i=0;i<ulNbComport;i++)
{
fn_vInitComport(&(p_stComport[i]));
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
p_stComport[i].CFast_lMyIndex = i;
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB
}
}
return(p_stComport);
}
tdstTreeInterpret *fn_p_stAllocRule(unsigned char ucNbRules)
{
tdstTreeInterpret *p_stRules=NULL;
if (ucNbRules!=0)
{
unsigned char i;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeRule , NULL);
M_AIAlloc(p_stRules, tdstTreeInterpret *,ucNbRules*sizeof(tdstTreeInterpret));
for (i=0;i<ucNbRules;i++)
{
fn_vInitRule(&(p_stRules[i]));
}
}
return(p_stRules);
}
tdstNodeInterpret *fn_p_stAllocNodeInterpret(unsigned short uwNbNode)
{
tdstNodeInterpret *p_stNodeInterpret=NULL;
if (uwNbNode!=0)
{
unsigned short i;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeNodeInterpret , NULL);
M_AIAlloc(p_stNodeInterpret, tdstNodeInterpret *, uwNbNode*sizeof(tdstNodeInterpret));
for (i=0;i<uwNbNode;i++)
{
fn_vInitNodeInterpret(&(p_stNodeInterpret[i]), 0, (tdeTypeInterpret)0, 0);
}
}
return(p_stNodeInterpret);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdstTreeInterpret *fn_p_stAllocSchedule(unsigned short uwNbNode)
{
tdstTreeInterpret *p_stSchedule=NULL;
/* allocate 1 rule*/
p_stSchedule=fn_p_stAllocRule(1);
/* allocate node*/
M_GetNodeInterpret(p_stSchedule)=fn_p_stAllocNodeInterpret(uwNbNode);
M_SetNbNodeInterpret(p_stSchedule,uwNbNode);
return(p_stSchedule);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* XB 20/05/1999 */
#ifndef D_THROW_COMPLEX_ACTION_TABLE
tdstActionTableEntry *fn_p_stAllocActionTableEntry(unsigned char ucActionTableNbEntry)
{
tdstActionTableEntry *p_stActionTableEntry=NULL;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeActionTableEntry , NULL);
M_AIAlloc(p_stActionTableEntry,tdstActionTableEntry *,ucActionTableNbEntry*sizeof(tdstActionTableEntry));
return(p_stActionTableEntry);
}
#endif /* D_THROW_COMPLEX_ACTION_TABLE */
/* End XB 20/05/1999 */
extern unsigned char g_ucUseDefaultActionReturn;
extern unsigned char g_ucNewActionReturn;
tdstActionTable *fn_p_stAllocActionTable(unsigned char ucActionTableNbEntry)
{
tdstActionTableEntry *p_stEntry;
tdstActionTable *p_stActionTable=NULL;
/* XB 20/05/1999 */
#ifndef D_THROW_COMPLEX_ACTION_TABLE
unsigned char ucNEntry;
#endif /* D_THROW_COMPLEX_ACTION_TABLE */
/* End XB 20/05/1999 */
/* XB 21/05/1999 */
#ifdef D_THROW_COMPLEX_ACTION_TABLE
if(ucActionTableNbEntry!=0)
{
#endif /* D_THROW_COMPLEX_ACTION_TABLE */
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeActionTable , NULL);
M_AIAlloc(p_stActionTable,tdstActionTable *,sizeof(tdstActionTable));
#ifdef D_THROW_COMPLEX_ACTION_TABLE
}
else
{
return NULL;
}
#endif /* D_THROW_COMPLEX_ACTION_TABLE */
/* End XB 21/05/1999 */
/* XB 20/05/1999 */
#ifndef D_THROW_COMPLEX_ACTION_TABLE
M_TableNbEntries(p_stActionTable)=ucActionTableNbEntry;
M_TableEntry(p_stActionTable)=fn_p_stAllocActionTableEntry(ucActionTableNbEntry);
/*//*/
/* ANNECY MT - 17/09/98 { initializes the table*/
p_stActionTable->ucNbEntriesUsed=0;
p_stActionTable->ucCurrentEntry=0;
/**/
for (ucNEntry=0,p_stEntry=M_TableEntry(p_stActionTable);ucNEntry<ucActionTableNbEntry;ucNEntry++,p_stEntry++)
{
p_stEntry -> bUseDefaultActionReturn = g_ucUseDefaultActionReturn;
p_stEntry -> ucNewActionReturn = g_ucNewActionReturn;
}
/* END ANNECY MT }*/
/*//*/
#else /* D_THROW_COMPLEX_ACTION_TABLE */
p_stEntry = &(p_stActionTable->stEntry);
p_stEntry->bUseDefaultActionReturn=g_ucUseDefaultActionReturn;
p_stEntry->ucNewActionReturn=g_ucNewActionReturn;
#endif /* D_THROW_COMPLEX_ACTION_TABLE */
/* End XB 20/05/1999 */
return(p_stActionTable);
}
AI_tdstAIModel *fn_p_stAllocAIModel()
{
AI_tdstAIModel *p_stAIModel=NULL;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeModel , NULL);
M_AIAlloc(p_stAIModel, AI_tdstAIModel *, sizeof(AI_tdstAIModel));
AI_M_SetIntelligenceScriptAIModel(p_stAIModel, NULL);
AI_M_SetReflexScriptAIModel(p_stAIModel, NULL);
AI_M_SetDsgVarAIModel(p_stAIModel,NULL);
#ifndef U64
AI_M_SetListOfMacroAIModel(p_stAIModel,NULL);
#endif /* U64 */
AI_M_SetSecondPassDone(p_stAIModel,0);
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
p_stAIModel->CFast_dst_RefTreeArray = NULL; /* BART ?*/
p_stAIModel->uwNbNode = 0; /* BART ?*/
p_stAIModel->CFast_dst_ParamArray = NULL ;
p_stAIModel->uwNbParamNode = 0 ;
p_stAIModel->CFast_lFunction = 0;
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB
return(p_stAIModel);
}
tdstScriptAI *fn_p_stAllocScriptAI(unsigned char ucActionTableNbEntry)
{
tdstScriptAI *p_stScriptAI=NULL;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeScriptAI , NULL);
M_AIAlloc(p_stScriptAI, tdstScriptAI *, sizeof(tdstScriptAI));
M_GetScriptAINbComport(p_stScriptAI)=0;
M_GetScriptAIComport(p_stScriptAI)=NULL;
M_GetScriptAIActionTableNbEntry(p_stScriptAI)=ucActionTableNbEntry;
M_GetScriptAINoComportInitDefault(p_stScriptAI)=0;
return(p_stScriptAI);
}
tdstIntelligence *fn_p_stAllocIntelligence(tdstScriptAI **p_p_stScriptAI,unsigned char ucActionTableNbEntry)
{
tdstIntelligence *p_stIntelligence=NULL;
if (M_GetScriptAINbComport(*p_p_stScriptAI)!=0)
{
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeIntelligence , NULL);
M_AIAlloc(p_stIntelligence, tdstIntelligence *, sizeof(tdstIntelligence));
/* link intelligence to its model*/
p_stIntelligence->p_p_stScriptAI=p_p_stScriptAI; /* faire macro*/
/* initialise with default comport*/
M_GetNoComportInit(p_stIntelligence)=M_GetScriptAINoComportInitDefault(*p_p_stScriptAI);
M_ActionTable(p_stIntelligence)=fn_p_stAllocActionTable(ucActionTableNbEntry);
/* ANNECY MT - 18/09/98 { fn_p_stAllocActionTable() initializes the table now*/
/*fn_vInitActionTable(p_stIntelligence);*/
/* END ANNECY MT }*/
}
return(p_stIntelligence);
}
#ifdef ACTIVE_EDITOR
/*********************/
/* DESIGNER VARAIBLE */
/*********************/
void fn_vFreeDsgVarInfoContent(tdstDsgVarInfo *p_stDsgVarInfo)
{
if (p_stDsgVarInfo!=NULL)
{
p_stDsgVarInfo->ulOffsetInDsgMem=0;
p_stDsgVarInfo->eDsgVarTypeId=eNbDsgVarType;
}
}
void fn_vFreeDsgVarInfoAll(tdstDsgVarInfo **p_p_stDsgVarInfo,unsigned char ucNbDsgVar)
{
if (*p_p_stDsgVarInfo!=NULL)
{
unsigned char i;
/* free DsgVarContent*/
for(i=0;i<ucNbDsgVar;i++)
{
fn_vFreeDsgVarInfoContent(&((*p_p_stDsgVarInfo)[i]));
}
/* free DsgVar itself*/
M_AIFree(*p_p_stDsgVarInfo);
*p_p_stDsgVarInfo=NULL;
}
}
void fn_vFreeDsgVarContent(tdstDsgVar *p_stDsgVar)
{
if (p_stDsgVar!=NULL)
{
fn_vFreeDsgMemBuffer(&(p_stDsgVar->p_cDsgMemDefaultInit));
fn_vFreeDsgVarInfoAll(&(p_stDsgVar->p_stDsgVarInfo),p_stDsgVar->ucNbDsgVar);
p_stDsgVar->ulSize=0;
p_stDsgVar->ucNbDsgVar=0;
}
}
void fn_vFreeDsgVarAll(tdstDsgVar **p_p_stDsgVar)
{
if (*p_p_stDsgVar!=NULL)
{
fn_vFreeDsgVarContent(*p_p_stDsgVar);
M_AIFree(*p_p_stDsgVar);
*p_p_stDsgVar=NULL;
}
}
void fn_vFreeDsgMemBuffer(char **p_p_cDsgMemBuffer)
{
if (*p_p_cDsgMemBuffer!=NULL)
{
M_AIFree(*p_p_cDsgMemBuffer);
*p_p_cDsgMemBuffer=NULL;
}
}
void fn_vFreeDsgMemContent(tdstDsgMem *p_stDsgMem)
{
if (p_stDsgMem!=NULL)
{
fn_vFreeDsgMemBuffer(&(p_stDsgMem->p_cDsgMemBufferInit));
fn_vFreeDsgMemBuffer(&(p_stDsgMem->p_cDsgMemBuffer));
}
}
void fn_vFreeDsgMemAll(tdstDsgMem **p_p_stDsgMem)
{
if (*p_p_stDsgMem!=NULL)
{
fn_vFreeDsgMemContent(*p_p_stDsgMem);
M_AIFree(*p_p_stDsgMem);
*p_p_stDsgMem=NULL;
}
}
void fn_vFreeDesignerVariable(AI_tdstMind *p_stMind)
{
if (M_GetDsgMem(p_stMind)!=NULL)
{
if(M_GetDsgVar(p_stMind)!=NULL)
{
fn_vFreeDsgVarAll(&M_GetDsgVar(p_stMind));
}
fn_vFreeDsgMemAll(&M_GetDsgMem(p_stMind));
}
}
#endif /* ACTIVE_EDITOR*/
tdstDsgVarInfo *fn_p_stAllocDsgVarInfo(unsigned char ucNbDsgVar)
{
unsigned char i;
tdstDsgVarInfo *p_stDsgVarInfo=NULL;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeDsgVarInfo , NULL);
M_AIAlloc(p_stDsgVarInfo,tdstDsgVarInfo *,ucNbDsgVar*sizeof(tdstDsgVarInfo));
for (i=0;i<ucNbDsgVar;i++)
{
p_stDsgVarInfo[i].ulOffsetInDsgMem=0;
p_stDsgVarInfo[i].eDsgVarTypeId=eNbDsgVarType;
p_stDsgVarInfo[i].eSaveType=fn_eFindSaveTypeFromSaveTypeNumber(fn_ucDefaultSaveTypeNumber());
p_stDsgVarInfo[i].eInitType=fn_eFindInitTypeFromInitTypeNumber(fn_ucDefaultInitTypeNumber());
}
return(p_stDsgVarInfo);
}
tdstDsgVar *fn_p_stAllocDsgVar(unsigned long ulSize,unsigned char ucNbDsgVar)
{
tdstDsgVar *p_stDsgVar=NULL;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeDsgVar , NULL);
M_AIAlloc(p_stDsgVar,tdstDsgVar *,sizeof(tdstDsgVar));
p_stDsgVar->p_cDsgMemDefaultInit=fn_p_cAllocDsgMemBuffer(ulSize);
p_stDsgVar->p_stDsgVarInfo=fn_p_stAllocDsgVarInfo(ucNbDsgVar);
p_stDsgVar->ulSize=ulSize;
p_stDsgVar->ucNbDsgVar=ucNbDsgVar;
return(p_stDsgVar);
}
char *fn_p_cAllocDsgMemBuffer(unsigned long ulSize)
{
char *p_cDsgMemBuffer=NULL;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeDsgMemBuffer , NULL);
M_AIAlloc(p_cDsgMemBuffer,char *,ulSize*sizeof(char));
/* memset(p_cDsgMemBuffer,0,ulSize); AR9904 Already done in the alloc function */
return(p_cDsgMemBuffer);
}
tdstDsgMem *fn_p_stAllocDsgMem(tdstDsgVar **p_p_stDsgVar,unsigned long ulSize)
{
tdstDsgMem *p_stDsgMem=NULL;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeDsgMem , NULL);
M_AIAlloc(p_stDsgMem,tdstDsgMem*,sizeof(tdstDsgMem));
/* link DsgMem to its model : dont forget it*/
p_stDsgMem->p_p_stDsgVar=p_p_stDsgVar;
/* no specific values by default */
p_stDsgMem->p_cDsgMemBufferInit=NULL;
/* zone which stores current DsgVarValues : Set during 2nd pass*/
p_stDsgMem->p_cDsgMemBuffer=fn_p_cAllocDsgMemBuffer(ulSize);
return(p_stDsgMem);
}
void fn_vAllocVariableDesigner(AI_tdstMind *p_stMind,unsigned long ulSizeDsgMem,unsigned char ucNbDsgVar)
{
if ( (ulSizeDsgMem!=0) && (ucNbDsgVar!=0) )
{
/* note : instruction order is important*/
/* obliged to use these macros instead of those defined in dsgmem.h*/
/* because at this moment p_p_stDsgVar in tdstDsgMem (in tdstMind) is not allocated yet*/
AI_M_p_stGetDsgVar(p_stMind)=fn_p_stAllocDsgVar(ulSizeDsgMem,ucNbDsgVar);
AI_M_p_stGetDsgMem(p_stMind)=fn_p_stAllocDsgMem(&AI_M_p_stGetDsgVar(p_stMind),ulSizeDsgMem);
}
else
{
AI_M_p_stGetDsgVar(p_stMind)=NULL;
AI_M_p_stGetDsgMem(p_stMind)=NULL;
}
}
void fn_vCreateNodeString(tdstNodeInterpret *p_stNode, char *szString)
{
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeNodeString , NULL);
/* don't forget +1 because of the terminal zero*/
M_AIAlloc(M_szStringInterpret(p_stNode), char *, (strlen(szString)+1)*sizeof(char));
strcpy(M_szStringInterpret(p_stNode), szString);
M_SetTypeInterpret(p_stNode,E_ti_String);
}
void fn_vCreateNodeVector(struct tdstNodeInterpret_ *p_stNode)
{
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeNodeVector , NULL);
M_AIAlloc(M_p_stVectorInterpret(p_stNode), MTH3D_tdstVector *, sizeof(MTH3D_tdstVector));
MTH3D_M_vNullVector(M_p_stVectorInterpret(p_stNode));
M_SetTypeInterpret(p_stNode,E_ti_ConstantVector);
}

View File

@@ -0,0 +1,293 @@
/*********************************************************/
/* Module used to display Waypoints in the Game engine*/
/* */
/* Author : Marc Fascia - Annecy*/
/* Date : 02 / 03 / 1998*/
/**/
/*********************************************************/
#define _WP_D_WAYPOINT_FRIEND_
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AIUseCPA.h"
#include "AI_Mmg.h"
#include "AI_Erm.h"
#include "AI_Proto.h"
#include "WPEngDsp.h"
#include "WPWayPt.h"
#include "WP_Handl.h"
#include "WP_Func.h"
#ifndef U64
static GEO_tdstGeometricObject * p_stGeoModel;
static GEO_tdstGeometricObject * p_stGeoCurr;
#endif
#ifdef __cplusplus
extern "C"{
#endif
#if !defined(PRESS_DEMO)
extern void DisplayPolices (char * _szText , long _lX , long _lY);
#else
#define DisplayPolices(a,b,c)
#endif /* PRESS_DEMO */
extern void GLI_vEndOfGeometricLoad( void );
/*bart990209 : extern void GLI_vDownLoadTexture( void );*/
#ifndef U64
/*static*/ unsigned char ucIsInitDone = 0;
#endif
#ifdef __cplusplus
}
#endif
#if !defined(U64) && !defined(RETAIL)
/***********************************************************************************************/
/* Name : WP_InitGeoModel*/
/* Description : Loads the Geo Obj used to display the WP from .mod file */
/* Author : Marc FASCIA*/
/* Date : 04/03/98*/
/***********************************************************************************************/
GEO_tdstGeometricObject * WP_InitGeoModel()
{
GEO_tdstGeometricObject * p_stLoaded;
p_stLoaded = (GEO_tdstGeometricObject *) SCR_M_ul_RdL0_ExtractLongValue(
SCR_fnp_st_RdL0_AnalyseSection( "GameData\\World\\Graphics\\Objects\\Banks\\Waypoints\\wp.mod^Geometric:Box01", SCR_CDF_uw_Anl_ForceAnalyse ),
0 );
return p_stLoaded;
}
/* LOL #endif*/
/***********************************************************************************************/
/* Name : WP_SendWaypointsToViewport*/
/* Description : Displays the Geo Objs for WP*/
/* Author : Marc FASCIA*/
/* Date : 04/03/98*/
/* Optimized ? : No*/
/***********************************************************************************************/
void WP_SendWaypointsToViewport( GLD_tdstViewportAttributes * p_stViewport, unsigned long ulDrawMask )
{
WP_tdstWayPoint * p_stWaypt;
ACP_tdxIndex xNbVertices;
unsigned int uiPos;
SCR_tdst_Link_Value * pLinkValue = NULL;
SCR_tdst_Link_Table * pLinkTable;
char szText[ 255 ];
/*--- First time we are here ??? ---*/
if( !ucIsInitDone )
{
/*--- Loading Goe Objs from file ---*/
p_stGeoModel = WP_InitGeoModel();
p_stGeoCurr = WP_InitGeoModel();
GLI_vEndofGeometricLoad();
ucIsInitDone = 1;
}
/*--- gettink back the Waypoints linktable*/
pLinkTable = WP_fnp_WayPoint_GetLinkTable();
/*--- First element*/
uiPos = 0;
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, pLinkValue, SCR_M_st_Link_GetDynamicArray(pLinkTable) )
while (pLinkValue)
{
/*--- Getting the Waypoint handle*/
p_stWaypt = (WP_tdstWayPoint *) SCR_M_ul_Link_GetValue( pLinkValue );
for( xNbVertices = 0 ; xNbVertices < p_stGeoCurr->xNbPoints ; xNbVertices++ )
{
/*--- Translates the current object at the waypoint position*/
MTH3D_M_vAddVector( &(p_stGeoCurr->d_stListOfPoints[ xNbVertices ]),
&(p_stGeoModel->d_stListOfPoints[ xNbVertices ]),
&(p_stWaypt->m_stVertex) );
}
/*--- Translates the center of BV of object*/
MTH3D_M_vAddVector( &p_stGeoCurr->xBoudingSphereCenter, &p_stGeoModel->xBoudingSphereCenter, &p_stWaypt->m_stVertex );
/*--- Sends the object to the Display Routines*/
GLI_xSendObjectToViewportWithLights( p_stViewport, p_stGeoCurr, ulDrawMask );
/*--- Next Linked Value*/
uiPos++;
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, pLinkValue, SCR_M_st_Link_GetDynamicArray(pLinkTable) )
}
sprintf( szText, "[P] Display Waypoints" );
DisplayPolices( (char *)szText, 450, 450 );
}
/* LOL */
#endif /* U64 */
/*--------------------------------------------------------------
-------------------- OLD VERSION -----------------------------
--------------------------------------------------------------
#include "SPO\HieSpObj.h"
static HIE_tdstSuperObject * p_stWaypointsSPO;
static unsigned char s_ucWPDisplayNotInitialized = 1;
//*********************************************************************************************
// Name : WP_InitWaypointSPO
// Description : Creates the SPO that will contain all the GEO Objs for the WP
// Author : Marc FASCIA
// Date : 04/03/98
// Optimized ? : No
//*********************************************************************************************
HIE_tdstSuperObject * WP_InitSPO()
{
MTH3D_tdstMatrix stIdMatrix;
MTH3D_tdstVector stZeroVector;
POS_stCompletePosition stCompletePos;
HIE_tdstSuperObject * p_stSPO;
//--- Creates the SPO in memory
p_stSPO = HIE_fn_hCreateSuperObject();
//--- Inits the Position ---
MTH3D_M_vNullVector( &stZeroVector );
MTH3D_M_vSetIdentityMatrix( &stIdMatrix );
POS_fn_vSetTransformMatrix( &stCompletePos, &stIdMatrix.stCol_0, &stIdMatrix.stCol_1, &stIdMatrix.stCol_2 );
POS_fn_vSetRotationMatrix( &stCompletePos, &stIdMatrix.stCol_0, &stIdMatrix.stCol_1, &stIdMatrix.stCol_2 );
POS_fn_vSetTranslationVector( &stCompletePos, &stZeroVector );
HIE_fn_vSetSuperObjectMatrix( p_stSPO, &stCompletePos );
return p_stSPO;
}
//*********************************************************************************************
// Name : WP_InitWPModel
// Description : Loads the GEO Obj primitive displayed for each WP
// Author : Marc FASCIA
// Date : 04/03/98
// Optimized ? : No
//*********************************************************************************************
GEO_tdstGeometricObject * WP_InitWPModel()
{
GEO_tdstGeometricObject * p_stLoaded;
p_stLoaded = (GEO_tdstGeometricObject *) SCR_M_ul_RdL0_ExtractLongValue(
SCR_fnp_st_RdL0_AnalyseSection( "GameData\\World\\Levels\\morbide\\morbide.mod^Geometric:Box01", SCR_CDF_uw_Anl_ForceAnalyse ),
0 );
return p_stLoaded;
}
//*********************************************************************************************
// Name : WP_FillWaypointsSPO
// Description : Links the Geo Objs with the WP SPO
// Author : Marc FASCIA
// Date : 04/03/98
// Optimized ? : No
//*********************************************************************************************
void WP_FillWaypointSPO()
{
WP_tdstWayPoint * p_stWaypt;
ACP_tdxIndex xNbVertices;
unsigned int uiPos;
SCR_tdst_Link_Value * pLinkValue;
SCR_tdst_Link_Table * pLinkTable;
GEO_tdstGeometricObject * p_stCurrGeoObj;
static HIE_tdstSuperObject * p_stCurrSPO;
//--- gettink back the Waypoints linktable
pLinkTable = WP_fnp_WayPoint_GetLinkTable();
//--- First element
uiPos = 0;
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, pLinkValue, SCR_M_st_Link_GetDynamicArray(pLinkTable) )
while (pLinkValue)
{
//--- Getting the Waypoint handle
p_stWaypt = (WP_tdstWayPoint *) SCR_M_ul_Link_GetValue( pLinkValue );
//--- Creates the Geo Obj and the SPO
p_stCurrGeoObj = WP_InitWPModel();
p_stCurrSPO = WP_InitSPO();
//--- Links it to its own SPO ---
HIE_fn_vSetSuperObjectObjectAndType( p_stWaypointsSPO, p_stCurrGeoObj, C_ucPhysical );
//--- Creates SPO hierarchy ---
HIE_fn_vSuperObjectAddTail( p_stWaypointsSPO, p_stCurrSPO );
for( xNbVertices = 0 ; xNbVertices < p_stCurrGeoObj->xNbPoints ; xNbVertices++ )
{
//--- Translates the Model object at the waypoint position
MTH3D_M_vAddVector( &(p_stCurrGeoObj->d_stListOfPoints[ xNbVertices ]),
&(p_stCurrGeoObj->d_stListOfPoints[ xNbVertices ]),
&(p_stWaypt->m_stVertex) );
}
//--- Sends the object to the Display Routines
// GLI_xSendObjectToViewportWithLights( p_stViewport, p_stCurrGeoObj, ulDrawMask );
//--- Next Linked Value
uiPos++;
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, pLinkValue, SCR_M_st_Link_GetDynamicArray(pLinkTable) )
}
}
//*********************************************************************************************
// Name : WP_WPAttachInHierarchy
// Description : Adds the WP SPO in the SPO hierarchy
// Author : Marc FASCIA
// Date : 04/03/98
// Optimized ? : No
//*********************************************************************************************
void WP_WPAttachInHierarchy( HIE_tdstSuperObject * p_stRootSPO )
{
//--- We need to load the Model the first time
if( s_ucWPDisplayNotInitialized )
{
//--- Init of the Waypoints root spo ---
p_stWaypointsSPO = WP_InitSPO();
HIE_fn_vSetSuperObjectObjectAndType( p_stWaypointsSPO, NULL, C_ucNoAction );
WP_FillWaypointSPO();
//--- Now the hierarchy has been built ---
s_ucWPDisplayNotInitialized = 0;
}
//--- Linking this branch to the static tree ---
HIE_fn_vSuperObjectAddTail( p_stRootSPO, p_stWaypointsSPO );
}
//*********************************************************************************************
// Name : WP_WPIsolateFromHierarchy
// Description : Removes the WP SPO in the SPO hierarchy
// Author : Marc FASCIA
// Date : 04/03/98
// Optimized ? : No
//*********************************************************************************************
void WP_WPIsolateFromHierarchy()
{
//--- Cutting the Waypoint branch from the static tree ---
HIE_fn_vIsolate( p_stWaypointsSPO );
}
*/

View File

@@ -0,0 +1,957 @@
#include "AIUseCPA.h"
#include "Mth.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Mmg.h"
#include "AI_Erm.h"
/* in order to compile AI in C++ and link with GAM in C*/
#include "AI_Proto.h"
#define _WP_D_DEFINE_WAYPOINTS_
#include "WP_Handl.h"
/* in order to compile AI in C++ and link with GAM in C*/
#include "WP_Func.h"
#undef _WP_D_DEFINE_WAYPOINTS_
#define _WP_D_WAYPOINT_FRIEND_
#define WP_D_WAYPOINT_GLOBALS_
#include "WPWayPt.h"
#undef WP_D_WAYPOINT_GLOBALS_
#undef _WP_D_WAYPOINT_FRIEND_
#include "WPgraphe.h"
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
#ifdef __cplusplus
extern "C"
{
#endif
extern float fScale;
extern FILE *dump;
#ifdef __cplusplus
}
#endif
#endif //U64CONVERTLOG
// } fin N64-format
/*
------------------------------------------------------------------------------------------
GLOBAL VARIABLES DECLARATION:
------------------------------------------------------------------------------------------
*/
#if defined(AI_USE_SCRIPT)
static SCR_tdst_Link_Table WP_gs_stWayPointLinkTable;
#endif /* AI_USE_SCRIPT */
#if defined(ACTIVE_EDITOR)
static unsigned long gs_Way_ulNbOfWarnings = 0;
static FILE *gs_fWpWarningsFile = NULL;
#endif
/*
------------------------------------------------------------------------------------------
FUNCTIONS AND MACROS-FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
#define WP_M_vWayPointMalloc(_Var,_Type,_Size) M_AIAlloc(_Var,_Type,_Size)
#define WP_M_vWayPointFree(_Var) M_AIFree(_Var)
#define WP_M_vWayPointMemset(_Var,_Char,_Size) M_AI_MemSet(_Var,_Char,_Size)
#define WP_M_vWayPointRealloc(_Var,_AdrSrc,_Type,_Size) M_AIRealloc(_Var,_AdrSrc,_Type,_Size)
#define WP_M_vWayPointAssert(_Expr,_Error) M_AI_DEBUG_ASSERT(_Expr,_Error)
#define WP_M_vWayPointFatalError(_Error) M_AIFatalError(_Error)
/* Bart:
#define WP_M_vWayPointWarningError(_Error) M_AIWarningError(_Error)
*/
/*ANNECY Bart 21/01/98 {*/
#define WP_M_vWayPointWarningError(_Error, _ucOpenInfoWindow) M_AIWarningError(_Error, _ucOpenInfoWindow)
/*ENDANNECY Bart }*/
#define WP_M_vWayPointIfErrorUpdateError(_Module,_NewError) M_AIIfErrorUpdateFatalError(_Module,_NewError)
WP_tdhWayPoint WP_fnh_WayPoint_Create(void)
{
WP_tdhWayPoint hNewWayPoint=NULL;
/* Allocate a new waypoint */
WP_M_vWayPointMalloc(hNewWayPoint,WP_tdhWayPoint,WP_M_uwWayPointSizeOf());
if(hNewWayPoint)
{
WP_M_vWayPointMemset(hNewWayPoint,0xa,WP_M_uwWayPointSizeOf());
/*WP_M_vWayPointSetUsedCount(hNewWayPoint,0);*/
WP_M_vWayPointSetSuperObject(hNewWayPoint,0);
return hNewWayPoint;
}
else
return WP_C_hWayPointInvalid;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_Destroy
(WP_tdhWayPoint _hOldWayPoint)
{
WP_M_vWayPointAssert(_hOldWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);
WP_M_vWayPointFree(_hOldWayPoint);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void WP_fnv_WayPoint_AddRef
(WP_tdhWayPoint _hWayPoint)
{
_hWayPoint = _hWayPoint;
/* WP_M_vWayPointAssert(_hWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);*/
/* WP_M_vWayPointSetUsedCount(_hWayPoint,(unsigned char) (WP_M_ucWayPointGetUsedCount(_hWayPoint)+1));*/
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_Release
(WP_tdhWayPoint _hWayPoint)
{
_hWayPoint = _hWayPoint;
/*WP_M_vWayPointAssert(_hWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);*/
/*WP_M_vWayPointSetUsedCount(_hWayPoint,(unsigned char) (WP_M_ucWayPointGetUsedCount(_hWayPoint)-1));*/
/*if(!WP_M_ucWayPointGetUsedCount(_hWayPoint))*/
/*{*/
/* WP_fnv_WayPoint_Destroy(_hWayPoint);*/
/*}*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
WP_tdhWayPoint WP_fnh_WayPoint_Build
(
MTH3D_tdstVector*_pstVector,
MTH_tdxReal _xRadius,
HIE_tdxHandleToSuperObject _hSuperObject
)
{
WP_tdhWayPoint hNewWayPoint;
hNewWayPoint = WP_fnh_WayPoint_Create();
if(hNewWayPoint!=WP_C_hWayPointInvalid)
{
WP_M_vWayPointSetVertex(hNewWayPoint,_pstVector);
WP_M_vWayPointSetRadius(hNewWayPoint,_xRadius);
WP_M_vWayPointSetSuperObject(hNewWayPoint,_hSuperObject);
return hNewWayPoint;
}
else
return WP_C_hWayPointInvalid;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
WP_tdhWayPoint WP_fnh_WayPoint_Duplicate
(WP_tdhWayPoint _hWayPointSrc)
{
MTH3D_tdstVector stVertex;
WP_M_vWayPointAssert(_hWayPointSrc!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);
WP_M_vWayPointGetVertex(_hWayPointSrc,&stVertex);
return WP_fnh_WayPoint_Build
(
&stVertex,
WP_M_xWayPointGetRadius(_hWayPointSrc),
WP_M_hWayPointGetSuperObject(_hWayPointSrc)
);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_Copy
(
WP_tdhWayPoint _hWayPointDest,
WP_tdhWayPoint _hWayPointSrc
)
{
MTH3D_tdstVector stVertex;
WP_M_vWayPointAssert
(
(_hWayPointDest!=WP_C_hWayPointInvalid)
&&(_hWayPointSrc!=WP_C_hWayPointInvalid),
E_uwAIFatalInvalidParameter
);
WP_M_vWayPointGetVertex(_hWayPointSrc,&stVertex);
WP_M_vWayPointSetVertex(_hWayPointDest,&stVertex);
WP_M_vWayPointSetRadius
(
_hWayPointDest,
WP_M_xWayPointGetRadius(_hWayPointSrc)
);
WP_M_vWayPointSetSuperObject
(
_hWayPointDest,
WP_M_hWayPointGetSuperObject(_hWayPointDest)
);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned short WP_fnuw_WayPoint_SizeOf(void)
{
/*
Using the macro makes it compulsory to define the function
with the _WP_D_WAYPOINT_FRIEND_ compilation directive, in order to
be sure that the structure is known at this level.
*/
return WP_M_uwWayPointSizeOf();
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void WP_fnv_WayPoint_GetVertex
(
WP_tdhWayPoint _hWayPoint,
MTH3D_tdstVector*_pstVector
)
{
WP_M_vWayPointAssert
(
(_hWayPoint!=WP_C_hWayPointInvalid)
&&(_pstVector),
E_uwAIFatalInvalidParameter
);
/*
Using the macro makes it compulsory to define the function
with the _WP_D_WAYPOINT_FRIEND_ compilation directive, in order to
be sure that the structure is known at this level.
*/
WP_M_vWayPointGetVertex(_hWayPoint,_pstVector);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_SetVertex
(
WP_tdhWayPoint _hWayPoint,
MTH3D_tdstVector*_pstNewVector
)
{
WP_M_vWayPointAssert
(
(_hWayPoint!=WP_C_hWayPointInvalid)
&&(_pstNewVector),
E_uwAIFatalInvalidParameter
);
/*
Using the macro makes it compulsory to define the function
with the _WP_D_WAYPOINT_FRIEND_ compilation directive, in order to
be sure that the structure is known at this level.
*/
WP_M_vWayPointSetVertex(_hWayPoint,_pstNewVector);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
MTH_tdxReal WP_fnx_WayPoint_GetRadius
(WP_tdhWayPoint _hWayPoint)
{
WP_M_vWayPointAssert(_hWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);
/*
Using the macro makes it compulsory to define the function
with the _WP_D_WAYPOINT_FRIEND_ compilation directive, in order to
be sure that the structure is known at this level.
*/
return WP_M_xWayPointGetRadius(_hWayPoint);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_SetRadius
(
WP_tdhWayPoint _hWayPoint,
MTH_tdxReal _xNewRadius
)
{
WP_M_vWayPointAssert(_hWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);
/*
Using the macro makes it compulsory to define the function
with the _WP_D_WAYPOINT_FRIEND_ compilation directive, in order to
be sure that the structure is known at this level.
*/
WP_M_vWayPointSetRadius(_hWayPoint,_xNewRadius);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
HIE_tdxHandleToSuperObject WP_fnh_WayPoint_GetSuperObject
(WP_tdhWayPoint _hWayPoint)
{
WP_M_vWayPointAssert(_hWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);
/*
Using the macro makes it compulsory to define the function
with the _WP_D_WAYPOINT_FRIEND_ compilation directive, in order to
be sure that the structure is known at this level.
*/
return WP_M_hWayPointGetSuperObject(_hWayPoint);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_SetSuperObject
(
WP_tdhWayPoint _hWayPoint,
HIE_tdxHandleToSuperObject _hNewSuperObject
)
{
WP_M_vWayPointAssert(_hWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);
/*
Using the macro makes it compulsory to define the function
with the _WP_D_WAYPOINT_FRIEND_ compilation directive, in order to
be sure that the structure is known at this level.
*/
WP_M_vWayPointSetSuperObject(_hWayPoint,_hNewSuperObject);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_Invalidate
(WP_tdhWayPoint*_p_hWayPoint)
{
WP_M_vWayPointAssert(_p_hWayPoint,E_uwAIFatalInvalidParameter);
*_p_hWayPoint = WP_C_hWayPointInvalid;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool WP_fnb_WayPoint_IsValid
(WP_tdhWayPoint _hWayPoint)
{
return _hWayPoint != WP_C_hWayPointInvalid;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool WP_fnb_WayPoint_IsInvalid
(WP_tdhWayPoint _hWayPoint)
{
return _hWayPoint == WP_C_hWayPointInvalid;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool WP_fnb_WayPoint_IsDynamic
(WP_tdhWayPoint _hWayPoint)
{
WP_M_vWayPointAssert(_hWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);
return WP_M_hWayPointGetSuperObject(_hWayPoint)!=(HIE_tdxHandleToSuperObject)0;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool WP_fnb_WayPoint_IsStatic
(WP_tdhWayPoint _hWayPoint)
{
WP_M_vWayPointAssert(_hWayPoint!=WP_C_hWayPointInvalid,E_uwAIFatalInvalidParameter);
return WP_M_hWayPointGetSuperObject(_hWayPoint)==(HIE_tdxHandleToSuperObject)0;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#undef extern
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vCreateGeoWayPoint(WP_tdstWayPoint *p_stWayPt)
{
p_stWayPt = p_stWayPt;
/*MTH3D_tdstVector stPosWP;
WP_M_vWayPointGetVertex(p_stWayPt, &stPosWP);
p_stWayPt->m_p_stGeoObj = fn_pCreateSphere(MTH3D_M_xGetXofVector(&stPosWP),MTH3D_M_xGetYofVector(&stPosWP),
MTH3D_M_xGetZofVector(&stPosWP),WP_M_xWayPointGetRadius(p_stWayPt));
*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vDrawWayPoint(WP_tdstWayPoint *p_stWayPt)
{
p_stWayPt = p_stWayPt;
/*POS_tdstCompletePosition stMatrix;
POS_fn_vSetIdentityMatrix(&stMatrix);
HIE_fn_bLoadMatrix(&stMatrix);
GLI_xSendObjectToViewport(&gs_stViewportAttr, p_stWayPt->m_p_stGeoObj,
gp_stLight, GLI_C_lAllIsEnable-GLI_C_lIsNotDrawCollideInformation);
HIE_fn_vPopMatrix();*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(AI_USE_SCRIPT)
SCR_tde_Anl_ReturnValue WP_fne_WayPoint_ScriptCallBackLoad
(
SCR_tdst_File_Description *_p_fFile,
char *_szAction,
char *_szParams[],
SCR_tde_Anl_Action _cType
)
{
/* ANNECY MT - 16/09/98 {*/
static struct tdstEngineObject_ *hObjectParent;
static MTH3D_tdstVector stVertex;
static MTH_tdxReal xRadius;
_p_fFile=_p_fFile;
switch (_cType)
{
case SCR_EA_Anl_BeginSection:
MTH3D_M_vNullVector(&stVertex);
xRadius = MTH_C_ZERO;
hObjectParent = NULL;
break;
case SCR_EA_Anl_Entry:
if (stricmp(_szAction,"Vertex")==0)
{
/* load the vertex*/
stVertex.xX = MTH_M_xFloatToReal((float) atof(_szParams[0]));
stVertex.xY = MTH_M_xFloatToReal((float) atof(_szParams[1]));
stVertex.xZ = MTH_M_xFloatToReal((float) atof(_szParams[2]));
}
else if (stricmp(_szAction,"Radius")==0)
{
xRadius = MTH_M_xFloatToReal((float) atof(_szParams[0]));
}
else if (stricmp(_szAction,"Father")==0)
{
char szForScript[256];
SCR_tdst_Link_Value *p_stValue;
strcpy(szForScript,fn_szGetLevelsDataPath());
strcat(szForScript,"\\");
strcat(szForScript,_szParams[0]);
p_stValue = SCR_fnp_st_Link_CreateOrGetLinkFromKey(&g_st3DOSLinkTable.stCharacter, szForScript);
if(SCR_M_e_Link_GetState(p_stValue)==SCR_ELS_Link_Initialized)
{
hObjectParent = (struct tdstEngineObject_*)SCR_M_ul_Link_GetValue(p_stValue);
}
#ifndef U64
#ifdef _DEBUG
if(hObjectParent==NULL)
{
char szText[255];
/* Oliv' - Portage v15 - Please don't let accentuated characters be the last one of a string ! gcc sucks !!!*/
/* So I added a space character at the end*/
/* sprintf(szText,"Le WayPoint %s a pour p<>re l'acteur %s non charg<72>" , SCR_M_RdL0_GetCompleteSectionNameR(0), _szParams[0]);*/
sprintf(szText,"Le WayPoint %s a pour p<>re l'acteur %s non charg<72> " , SCR_M_RdL0_GetCompleteSectionNameR(0), _szParams[0]);
/* EndOfOliv' - Thnx :-)*/
MessageBox(NULL , szText , "ERROR" , MB_OK+MB_ICONERROR);
}
#endif /*_DEBUG*/
#endif /* U64*/
}
break;
case SCR_EA_Anl_EndSection:
{
WP_tdhWayPoint hWaypoint;
char szCompleteName [255];
char szWaypointName[255];
MTH3D_tdstVector stAbsolutePosition;
HIE_tdxHandleToSuperObject h_SOSector;
HIE_tdxHandleToSuperObject hSuperObjParent;
/* compute absolute position usinf father position if needed*/
if(hObjectParent)
{
POS_tdxHandleToPosition hGlobalMatrix;
hSuperObjParent = M_GetSuperObject(hObjectParent);
hGlobalMatrix = fn_p_st3dDataGetMatrix (hObjectParent->h_3dData);
POS_fn_vMulMatrixVertex( &stAbsolutePosition, hGlobalMatrix, &stVertex );
}
else
{
MTH3D_M_vCopyVector( &stAbsolutePosition, &stVertex );
hSuperObjParent = NULL;
}
if(fn_lGetSubMapNumber() != 0)
{
/* is waypoint into map ???*/
h_SOSector=SECT_fn_hResearchInWhatSectorIAm(SECT_hFatherSector,&stAbsolutePosition);
if (SECT_fn_bIsThisSectorUniverse(h_SOSector))
{
#if defined(ACTIVE_EDITOR)
char szText[255];
sprintf(szText,"The WayPoint %s is in the sector Universe" , SCR_M_RdL0_GetCompleteSectionNameR(0));
gs_Way_ulNbOfWarnings++;
if(gs_Way_ulNbOfWarnings==1)
{
MessageBox(NULL , szText , "ERROR" , MB_OK+MB_ICONERROR);
}
else
{
if(!gs_fWpWarningsFile)
{
gs_fWpWarningsFile = fopen ("WpWarnings.log","at");
if( gs_fWpWarningsFile )
{
fprintf( gs_fWpWarningsFile,"==============================================================================\n");
fprintf( gs_fWpWarningsFile,"Map : %s Submap : %02d\n" , fn_p_szGetLevelName() , GAM_M_GetSubMap(fn_lGetSubMapNumber()) );
fprintf( gs_fWpWarningsFile,"==============================================================================\n");
}
}
if(gs_fWpWarningsFile)
{
fprintf (gs_fWpWarningsFile , "%s\n" , szText);
}
}
#endif
return(SCR_ERV_Anl_NormalReturn);
}
}
/* create waypoint*/
hWaypoint = WP_fnh_WayPoint_Create();
WP_fnv_WayPoint_AddRef(hWaypoint);
SCR_M_RdL0_SetSectionLong(0, 0, (unsigned long)hWaypoint);
/* update Link Table*/
strcpy(szWaypointName,SCR_M_RdL0_GetCompleteSectionNameR(0));
strcpy(szCompleteName,fn_szGetLevelsDataPath());
strcat(szCompleteName,"\\");
strcat(szCompleteName,szWaypointName);
SCR_fnp_st_Link_SetValue( &WP_gs_stWayPointLinkTable, szCompleteName, (unsigned long)hWaypoint );
/* Set father*/
WP_M_vWayPointSetSuperObject(hWaypoint,hSuperObjParent);
/* Set radius*/
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
xRadius = (float) (( (long)( (xRadius*fScale) + 0.5) ) / fScale);
stVertex.xX = (float) (( (long)( (stVertex.xX*fScale) + 0.5) ) / fScale);
stVertex.xY = (float) (( (long)( (stVertex.xY*fScale) + 0.5) ) / fScale);
stVertex.xZ = (float) (( (long)( (stVertex.xZ*fScale) + 0.5) ) / fScale);
fprintf(dump,"---------waypoint %s\nRadius: %f\nposition : %f,%f,%f\n",szWaypointName,xRadius,stVertex.xX,stVertex.xY,stVertex.xZ);
fflush(dump);
#endif //U64CONVERTLOG
// } fin N64-format
WP_M_vWayPointSetRadius(hWaypoint,xRadius);
/* Set position*/
WP_M_vWayPointSetVertex(hWaypoint, &stVertex);
fn_vCreateGeoWayPoint((WP_tdstWayPoint *)hWaypoint);
break;
}
case SCR_EA_Anl_AlreadyAnalysed:
{
WP_tdhWayPoint hWaypoint;
SCR_M_RdL0_GetSectionLong(0, 0, WP_tdhWayPoint, hWaypoint);
WP_fnv_WayPoint_AddRef(hWaypoint);
}
break;
}
return SCR_ERV_Anl_NormalReturn;
/* END ANNECY MT }*/
}
/*
----------------------------------------------------------------------------------------
Description : WP_fn_vReloadWPGraph
called by the command console to reinit one (or more) graph script
szNameOfGraph -> giving by the console, it's the name of the graph to reload
----------------------------------------------------------------------------------------
Author : Fred 'Bart' Compagnon
Date : 19/01/98
----------------------------------------------------------------------------------------
*/
/* script only*/
void WP_fn_vReloadWPGraph(char* szNameOfGraph)
{
char szLevelName[255];
char szWPSectionName[255];
char sz255Error[255];
/*WPG_fn_vDestroyAllGraph () ; // made in fn_vTreatCommandLine() cf. GAM\commands.c*/
strcpy(szLevelName, fn_p_szGetLevelName());
sprintf(szWPSectionName, "%s\\%s.%s^%s:%s", szLevelName, szLevelName, C_ScriptWayPointSuffixe, C_SectionWPGraphDescription, szNameOfGraph);
if (SCR_fn_c_RdL0_IsSectionExists(szWPSectionName))
{
SCR_fnp_st_RdL0_AnalyseSection(szWPSectionName, SCR_CDF_uw_Anl_ForceAnalyse);
}
else
{
sprintf(sz255Error, "unknown Name of WPGraph (%s) !", szNameOfGraph);
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
}
}
/*
----------------------------------------------------------------------------------------
Description : WP_fne_WPGraph_ScriptCallBackLoad
to read the WPGraph section in the script
----------------------------------------------------------------------------------------
Author : Fred 'Bart' Compagnon
Date : 19/01/98
----------------------------------------------------------------------------------------
*/
/* script only*/
SCR_tde_Anl_ReturnValue WP_fne_WPGraph_ScriptCallBackLoad(SCR_tdst_File_Description *_p_fFile, char *_szAction, char *_szParams[], SCR_tde_Anl_Action _cType)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
WP_tdHandleOfGraph hGraph = NULL;
char sz255Error[255];
switch (_cType)
{
case SCR_EA_Anl_BeginSection:
if (_szAction[0] == 0)
{
sprintf(sz255Error, "invalid Name for WPGraph !");
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
return SCR_ERV_Anl_TerminateCurrentSection;
}
if (strlen(_szParams[0]) == 0)
{
sprintf(sz255Error, "invalid Reference for WPGraph (%s) !", _szAction);
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
return SCR_ERV_Anl_TerminateCurrentSection;
}
hGraph = WPG_fn_hCreate(_szAction, _szParams[0]);
WPG_fn_vAddGlobalGraph(hGraph) ;
SCR_M_RdL0_SetSectionLong(0, 0, (unsigned long)hGraph);
break;
case SCR_EA_Anl_Entry:
SCR_M_RdL0_GetSectionLong(0, 0, WP_tdHandleOfGraph, hGraph);
break;
case SCR_EA_Anl_EndSection:
SCR_M_RdL0_GetSectionLong(0, 0, WP_tdHandleOfGraph, hGraph);
break;
case SCR_EA_Anl_AlreadyAnalysed:
SCR_M_RdL0_GetSectionLong(0, 0, WP_tdHandleOfGraph, hGraph);
break;
}
return eReturnValue;
}
/*
----------------------------------------------------------------------------------------
Description : GetWPFromName
_szName -> Name of the WayPoint
_hGraph -> handle to the graph
Returns (WP_tdhWayPoint ) handle to the WayPoint
----------------------------------------------------------------------------------------
Author : Fred 'Bart' Compagnon
Date : 19/01/98
----------------------------------------------------------------------------------------
*/
/* script only*/
WP_tdhWayPoint GetWPFromName(char* _szName, WP_tdHandleOfGraph _hGraph)
{
char szCompleteName[255];
WP_tdhWayPoint hWayPoint = NULL;
SCR_tdst_Link_Value *p_stLinkValue=NULL;
char sz255Error[255];
strcpy(szCompleteName, fn_szGetLevelsDataPath());
strcat(szCompleteName,"\\");
strcat(szCompleteName, _hGraph->m_szReferenceSection);
strcat(szCompleteName, _szName);
p_stLinkValue = SCR_fnp_st_Link_SearchKey(WP_fnp_WayPoint_GetLinkTable(), szCompleteName);
if ( (p_stLinkValue!=NULL) && (SCR_M_e_Link_GetState(p_stLinkValue)!=SCR_ELS_Link_NotInitialized) )
{
hWayPoint = (WP_tdhWayPoint)(p_stLinkValue->ulValue);
}
else
{
sprintf(sz255Error, "Invalid Link Table for WPGraphe : %s", szCompleteName);
if(fn_lGetSubMapNumber() == 0)
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
#if defined(ACTIVE_EDITOR)
if(gs_fWpWarningsFile != NULL)
fprintf (gs_fWpWarningsFile , "%s\n" , sz255Error);
#endif
}
return(hWayPoint);
}
/*
----------------------------------------------------------------------------------------
Description : WP_fne_WPSommet_ScriptCallBackLoad
to read the WPSommet section in the script
----------------------------------------------------------------------------------------
Author : Fred 'Bart' Compagnon
Date : 19/02/98
----------------------------------------------------------------------------------------
*/
/* script only*/
SCR_tde_Anl_ReturnValue WP_fne_WPSommet_ScriptCallBackLoad(SCR_tdst_File_Description *_p_fFile, char *_szAction, char *_szParams[], SCR_tde_Anl_Action _cType)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
WP_tdHandleOfGraph hGraph;
WP_tdhWayPoint hWayPoint, hDstWayPoint;
unsigned long ulCapability;
long lWeight, lTypeOfWP;
char sz255Error[255];
char* dummy;
switch (_cType)
{
case SCR_EA_Anl_BeginSection:
SCR_M_RdL0_GetSectionLong(-1, 0, WP_tdHandleOfGraph, hGraph);
hWayPoint = GetWPFromName(_szAction, hGraph);
if (!hWayPoint)
{
sprintf(sz255Error, "unknown WayPoint (%s) in WPGraph !", _szAction);
#if defined(ACTIVE_EDITOR)
if(gs_fWpWarningsFile != NULL)
fprintf (gs_fWpWarningsFile , "%s\n" , sz255Error);
#endif
if(fn_lGetSubMapNumber() == 0)
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
return SCR_ERV_Anl_TerminateCurrentSection;
}
WPG_fn_lAddWayPointIfNotExists(hGraph, hWayPoint, 0L);/* first ignore the Type Of WP*/
if (_szParams[0])
{ /* then change the Type Of WP, if one ! !*/
lTypeOfWP = (long) strtoul(_szParams[0], &dummy, 2);
WPG_fn_lChangeTypeOfWP (hGraph, hWayPoint, lTypeOfWP); /*BART*/
}
SCR_M_RdL0_SetSectionLong(0, 0, (unsigned long)hWayPoint);
break;
case SCR_EA_Anl_Entry:
SCR_M_RdL0_GetSectionLong(-1, 0, WP_tdHandleOfGraph, hGraph);
SCR_M_RdL0_GetSectionLong(0, 0, WP_tdhWayPoint, hWayPoint);
hDstWayPoint = GetWPFromName(_szAction, hGraph);
if (!hDstWayPoint)
{
sprintf(sz255Error, "unknown WayPoint (%s) in WPGraph !", _szAction);
#if defined(ACTIVE_EDITOR)
if(gs_fWpWarningsFile != NULL)
fprintf (gs_fWpWarningsFile , "%s\n" , sz255Error);
#endif
if(fn_lGetSubMapNumber() == 0)
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
return SCR_ERV_Anl_TerminateCurrentSection;
}
WPG_fn_lAddWayPointIfNotExists(hGraph, hDstWayPoint, 0L); /* ignore the Type Of WP*/
lWeight = atoi(_szParams[0]);
ulCapability = strtoul(_szParams[1], &dummy, 2);
WPG_fn_lAddArcToWayPoint (hGraph, hWayPoint, hDstWayPoint, lWeight, ulCapability);
break;
case SCR_EA_Anl_EndSection:
SCR_M_RdL0_GetSectionLong(0, 0, WP_tdhWayPoint, hWayPoint);
break;
case SCR_EA_Anl_AlreadyAnalysed:
SCR_M_RdL0_GetSectionLong(0, 0, WP_tdhWayPoint, hWayPoint);
break;
}
return eReturnValue;
}
/* script only*/
SCR_tde_Anl_ReturnValue WP_fne_WayPoint_ScriptSubSectionCallBackLoad
(
SCR_tdst_File_Description*_p_fFile,
char*_szAction,
char*_d_szParams[],
SCR_tde_Anl_Action _eAction
)
{
_p_fFile=_p_fFile;
_szAction=_szAction;
_d_szParams=_d_szParams;
_eAction=_eAction;
/* test just to export the function*/
return SCR_ERV_Anl_NormalReturn;
}
/* script only*/
SCR_tdst_Link_Value* WP_fnh_WayPoint_GetLoaded
(
char *_szWPRefName
)
{
/* check parameter validity :*/
WP_M_vWayPointAssert(_szWPRefName,E_uwAIFatalInvalidParameter);
return SCR_fnp_st_Link_CreateOrGetLinkFromKey
(
&WP_gs_stWayPointLinkTable,
_szWPRefName
);
}
#endif /* AI_USE_SCRIPT */
void WP_fnv_WayPoint_ComputeLocation( WP_tdhWayPoint _hWayPoint, MTH3D_tdstVector*_p_stVertex)
{
MTH3D_tdstVector stWPVertex;
POS_tdxHandleToPosition hGlobalMatrix;
WP_M_vWayPointAssert ( (_hWayPoint!=WP_C_hWayPointInvalid) && (_p_stVertex), E_uwAIFatalInvalidParameter );
/* cas des Waypoints dynamiques, c'est a dire qui bougent (rare...) */
if (WP_M_hWayPointGetSuperObject(_hWayPoint))
{
WP_M_vWayPointGetVertex(_hWayPoint,&stWPVertex);
hGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (WP_M_hWayPointGetSuperObject(_hWayPoint));
POS_fn_vMulMatrixVertex( _p_stVertex, HIE_fn_hGetSuperObjectGlobalMatrix (WP_M_hWayPointGetSuperObject(_hWayPoint)), &stWPVertex );
}
else
WP_M_vWayPointGetVertex(_hWayPoint,_p_stVertex);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_InitLinkTable(void)
{
#if defined(AI_USE_SCRIPT)
SCR_fn_v_Link_InitTable(&WP_gs_stWayPointLinkTable);
#endif /* AI_USE_SCRIPT */
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_CloseLinkTable(void)
{
#if defined(AI_USE_SCRIPT)
SCR_fn_v_Link_CloseTable(&WP_gs_stWayPointLinkTable);
#endif /* AI_USE_SCRIPT */
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(AI_USE_SCRIPT)
SCR_tdst_Link_Table* WP_fnp_WayPoint_GetLinkTable (void)
{
return &WP_gs_stWayPointLinkTable;
}
#endif /* AI_USE_SCRIPT */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_SecondPass(WP_tdhWayPoint _hWayPoint)
{
#if defined(AI_USE_SCRIPT)
if(WP_M_hWayPointGetSuperObject(_hWayPoint))
{
WP_M_vWayPointAssert
(
(SCR_M_e_Link_GetState((SCR_tdst_Link_Value *)
(WP_M_hWayPointGetSuperObject(_hWayPoint))) == SCR_ELS_Link_Initialized),
E_uwAIFatalReferenceNotLoaded
);
/* retrieve the father handle : */
WP_M_vWayPointSetSuperObject
(
_hWayPoint,
M_GetSuperObject(
(struct tdstEngineObject_*)
(SCR_M_ul_Link_GetValue((SCR_tdst_Link_Value *)
(WP_M_hWayPointGetSuperObject(_hWayPoint)))
)
)
);
}
#endif /* AI_USE_SCRIPT */
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(AI_USE_SCRIPT)
WP_tdhWayPoint WP_fnh_WayPoint_GetHandleFromLinkTable
(SCR_tdst_Link_Value*_p_stLinkValue)
{
WP_tdhWayPoint hWayPoint;
WP_M_vWayPointAssert
(
(SCR_M_e_Link_GetState(_p_stLinkValue) == SCR_ELS_Link_Initialized),
E_uwAIFatalReferenceNotLoaded
);
hWayPoint = (WP_tdhWayPoint)SCR_M_ul_Link_GetValue(_p_stLinkValue);
/* WP_fnv_WayPoint_SecondPass(hWayPoint); del by jt*/
return hWayPoint;
}
#endif /* AI_USE_SCRIPT */
/* add by jt*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WP_fnv_WayPoint_LinkTableSecondPass(void)
{
#if defined(ACTIVE_EDITOR)
if( (fn_lGetSubMapNumber() != 0) && gs_Way_ulNbOfWarnings > 1)
{
MessageBox(NULL , "Some Waypoints are in the Sector Universe.\n Please see the 'WpWarnings.log' file" , "ERROR" , MB_OK);
}
if(gs_fWpWarningsFile)
{
fprintf ( gs_fWpWarningsFile , "==============================================================================\n\n");
fclose (gs_fWpWarningsFile);
}
gs_fWpWarningsFile = NULL;
gs_Way_ulNbOfWarnings = 0;
#endif
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,398 @@
/*
----------------------------------------
File Name :
AIUseCPA.h
----------------------------------------
Required for :
ACP basic definitions.
----------------------------------------
*/
#include "AIUseCPA.h"
/*
----------------------------------------
File Name :
AIMacros.h
----------------------------------------
Required for :
AI main macros definitions.
----------------------------------------
*/
#include "AIMacros.h"
/* in order to compile AI in C++ and link with GAM in C*/
#include "AI_Proto.h"
#define _WP_D_DEFINE_WAYPOINTS_
#include "WP_Handl.h"
/* in order to compile AI in C++ and link with GAM in C*/
#include "WP_Func.h"
#undef _WP_D_DEFINE_WAYPOINTS_
#define _WP_D_WPARC_FREIND_
#include "WParc.h"
#undef _WP_D_WPARC_FREIND_
#define _WP_D_WAYPOINT_FRIEND_
#define WP_D_WAYPOINT_GLOBALS_
#include "WPWayPt.h"
#undef WP_D_WAYPOINT_GLOBALS_
#undef _WP_D_WAYPOINT_FRIEND_
/*****************************************************
* Function : WPARCLST_fn_hInit
* Description : initialise a WParc list to an empty
* list. it also allocate memory for the
* list.
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
WP_tdHandleOfListOfArc WPARCLST_fn_hInit (void)
{
WP_tdHandleOfListOfArc hList ;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeListOfArc , NULL);
#ifdef U64
/* on U64, AI is a block without free, so alloc in TMP*/
hList = (WP_tdHandleOfListOfArc) TMP_M_p_Malloc(sizeof(WP_tdstListOfArc));
#else
M_AIAlloc(hList, WP_tdHandleOfListOfArc, sizeof(WP_tdstListOfArc)) ;
#endif
if ( hList )
LST2_M_DynamicInitAnchor(&hList->m_hArc) ;
return (hList) ;
}
/*****************************************************
* Function : WPARCLST_fn_vDestroy
* Description : free memory allocated for the list
* and destroy each element of the list
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
void WPARCLST_fn_vDestroy (WP_tdHandleOfListOfArc hList)
{
WP_tdHandleOfArc hElement, hNextElement ;
int i ;
if ( hList )
{
LST2_M_DynamicForEachMovingElementOf(&hList->m_hArc, hElement, hNextElement, i)
{
LST2_M_DynamicIsolate(hElement) ;
WPARC_fn_vDestroyArc (hElement) ;
}
#ifdef U64
/* on U64, AI block is replaced by TMP block, so free in TMP*/
TMP_M_Free(hList);
#else
M_AIFree(hList);
#endif
hList = NULL; /* BART ?*/
}
}
/*****************************************************
* Function : WPARCLST_fn_vAdd
* Description : add a new element at the end of the
* list.
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
void WPARCLST_fn_vAdd (WP_tdHandleOfListOfArc hListOfArc, WP_tdhGraphNode hNode,
long lWeight, unsigned long ulCapability)
{
WP_tdHandleOfArc hNewArc ;
char bOK=0;
int i;
WP_tdHandleOfArc hElement;
if ( hListOfArc )
{
LST2_M_DynamicForEachElementOf(&hListOfArc->m_hArc, hElement, i) /* if already exists !*/
{
if (hElement->m_hNode == hNode)
{
hElement->m_ulCapabilityInit = ulCapability;
hElement->m_ulCapability = ulCapability;
hElement->m_lWeightInit = lWeight;
hElement->m_lWeight = lWeight;
bOK = 1;
break;
}
}
if (bOK == 0)
{
hNewArc = WPARC_CreateArc (hNode, lWeight, ulCapability) ;
if ( hNewArc ) {
LST2_M_DynamicAddTail( &hListOfArc->m_hArc, hNewArc ) ;
}
}
}
}
/*****************************************************
* Function : WPARCLST_fn_vRemove
* Description : remove an element from the list
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void WPARCLST_fn_vRemove (WP_tdHandleOfListOfArc hList, WP_tdhGraphNode hNode ) {
WP_tdHandleOfArc hElement, hNextElement ;
int i ;
if ( hList ) {
LST2_M_DynamicForEachMovingElementOf(&hList->m_hArc, hElement, hNextElement, i) {
if ( hElement->m_hNode == hNode ) {
LST2_M_DynamicIsolate(hElement) ;
WPARC_fn_vDestroyArc (hElement) ;
break ;
}
}
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*****************************************************
* Function : WPARCLST_fn_lChangeCapabilities
* Description : change the Capability of an existing arc
* return -1 if the link doesn't exist
* return 0 if the Capability has been change
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
long WPARCLST_fn_lChangeCapabilities (WP_tdHandleOfListOfArc hListOfArc, WP_tdhGraphNode hNode, unsigned long ulCapability, long lValue) {
WP_tdHandleOfArc hElement ;
int i ;
if ( hListOfArc && hNode ) {
LST2_M_DynamicForEachElementOf(&hListOfArc->m_hArc, hElement, i) {
if ( hElement->m_hNode == hNode ) {
switch (lValue)
{
case 0:
case 2:
hElement->m_ulCapability |= ulCapability; /* add the type*/
break;
case 1:
case 3:
hElement->m_ulCapability = ulCapability; /* change all the types field*/
break;
case 4:
hElement->m_ulCapability &= ~ulCapability;; /* sub the type*/
break;
case 5:
hElement->m_ulCapability = 0; /* erase all the types field*/
break;
}
return (0) ;
}
}
}
return (-1) ;
}
/*****************************************************
* Function : WPARCLST_fn_lGetCapabilities
* Description : get the Capabilities of an existing arc
* return -1 if the link doesn't exist
* return 0 otherwise
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
long WPARCLST_fn_lGetCapabilities (WP_tdHandleOfListOfArc hListOfArc,
WP_tdhGraphNode hNode, unsigned long* p_ulCapability) {
WP_tdHandleOfArc hElement ;
int i ;
if ( hListOfArc && hNode ) {
LST2_M_DynamicForEachElementOf(&hListOfArc->m_hArc, hElement, i) {
if ( hElement->m_hNode == hNode ) {
*p_ulCapability = hElement->m_ulCapability ;
return (0) ;
}
}
}
return (-1) ;
}
long WPARCLST_fn_lChangeWeight (WP_tdHandleOfListOfArc hListOfArc, WP_tdhGraphNode hNode, long lWeight) {
WP_tdHandleOfArc hElement ;
int i ;
if ( hListOfArc && hNode ) {
LST2_M_DynamicForEachElementOf(&hListOfArc->m_hArc, hElement, i) {
if ( hElement->m_hNode == hNode ) {
hElement->m_lWeight = lWeight;
return (0) ;
}
}
}
return (-1) ;
}
long WPARCLST_fn_lGetWeight (WP_tdHandleOfListOfArc hListOfArc,
WP_tdhGraphNode hNode, long *p_lWeight) {
WP_tdHandleOfArc hElement ;
int i ;
if ( hListOfArc && hNode ) {
LST2_M_DynamicForEachElementOf(&hListOfArc->m_hArc, hElement, i) {
if ( hElement->m_hNode == hNode ) {
*p_lWeight = hElement->m_lWeight ;
return (0) ;
}
}
}
return (-1) ;
}
/*****************************************************
* Function : WPARC_CreateArc
* Description : allocate memory for an Element and
* set his value
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
WP_tdHandleOfArc WPARC_CreateArc (WP_tdhGraphNode hNode, long lWeight, unsigned long ulCapability)
{
WP_tdHandleOfArc hNewArc ;
MMG_fn_vAddMemoryInfo (MMG_C_lTypeAI , MMG_C_lSubTypeArc , NULL);
#ifdef U64
/* on U64, AI is a block without free, so alloc in TMP*/
hNewArc = (WP_tdHandleOfArc) TMP_M_p_Malloc(sizeof(WP_tdstWayArc));
#else
M_AIAlloc ( hNewArc, WP_tdHandleOfArc, sizeof ( WP_tdstWayArc ) ) ;
#endif
if ( hNewArc )
{
LST2_M_DynamicInitElement(hNewArc) ;
hNewArc->m_hNode = hNode ;
hNewArc->m_ulCapabilityInit = ulCapability ;
hNewArc->m_ulCapability = ulCapability ;
hNewArc->m_lWeightInit = lWeight ;
hNewArc->m_lWeight = lWeight ;
}
return (hNewArc) ;
}
void WPARC_fn_vDestroyArc(WP_tdHandleOfArc hArc)
{
if ( hArc )
{
#ifdef U64
/* on U64, AI block is replaced by TMP block, so free in TMP*/
TMP_M_Free(hArc);
#else
M_AIFree(hArc) ;
#endif
hArc = NULL;
}
}
/*****************************************************
* Function : WPARC_fn_lSetWeight
* Description : access function, set the Weight
* field
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
long WPARC_fn_lSetWeight (WP_tdHandleOfArc hArc, long lWeight) {
if ( hArc ) {
hArc->m_lWeightInit = lWeight;
return ( !(hArc->m_lWeight = lWeight) ) ;
}
return (-1) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*****************************************************
* Function : WPARC_fn_lGetWeight
* Description : access function, get the Weight
* field
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
long WPARC_fn_lGetWeight (WP_tdHandleOfArc hArc) {
if ( hArc )
return (hArc->m_lWeight) ;
return (-1) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*****************************************************
* Function : WPARC_fn_lSetCapability
* Description : access function, set the Capability field
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
long WPARC_fn_lSetCapability (WP_tdHandleOfArc hArc, unsigned long ulCapability) {
if ( hArc ) {
hArc->m_ulCapabilityInit = ulCapability;
return ( !(hArc->m_ulCapability = ulCapability) ) ;
}
return (-1) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* Function : WPARC_fn_lAddCapability
//return ( !(hArc->m_ulCapability |= ulCapability) ) ;
hArc->m_ulCapability |= ulCapability;
*/
/* Function : WPARC_fn_lSubCapability
//return ( !(hArc->m_ulCapability ^=ulCapability) ) ;
hArc->m_ulCapability -= (hArc->m_ulCapability & ulCapability);
*/
/*****************************************************
* Function : WPARC_fn_ulGetCapability
* Description : access function, get the Capability field
*****************************************************
* Author : Jean-Marc Drouaud
* Date : 13/01/98
*****************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned long WPARC_fn_ulGetCapability (WP_tdHandleOfArc hArc) {
if ( hArc )
return ( hArc->m_ulCapability ) ;
return ((unsigned long)0) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,285 @@
/*BEGIN FS 10/8/98*/
#include "Ldt.h"
/*END FS 10/8/98*/
/*BEGIN FS 9/14/98*/
/*#if defined(AI_USE_SCRIPT)*/
/*----------------------------------------------------------------------
* Description: callback for WayPoint section from .WP script file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/14/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadWP_WayPoint( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
/* ANNECY MT - 16/09/98 {*/
WP_tdhWayPoint hWaypoint;
char szCompleteName [255];
/* char szWaypointName[255];*/
MTH3D_tdstVector stAbsolutePosition;
HIE_tdxHandleToSuperObject h_SOSector;
HIE_tdxHandleToSuperObject hSuperObjParent;
static struct tdstEngineObject_ *hObjectParent;
static MTH3D_tdstVector stVertex;
static MTH_tdxReal xRadius;
/*Working for BeginSection*/
MTH3D_M_vNullVector(&stVertex);
xRadius = MTH_C_ZERO;
hObjectParent = NULL;
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'treV': /*"Vertex"*/
/* load the vertex*/
stVertex.xX = MTH_M_xFloatToReal((float) atof(LDT_szGetParam(1)));
stVertex.xY = MTH_M_xFloatToReal((float) atof(LDT_szGetParam(2)));
stVertex.xZ = MTH_M_xFloatToReal((float) atof(LDT_szGetParam(3)));
break;
case 'idaR': /*"Radius"*/
/* load the radius */
xRadius = MTH_M_xFloatToReal((float) atof(LDT_szGetParam(1)));
break;
case 'htaF': /*"Father"*/
char szForScript[256];
SCR_tdst_Link_Value *p_stValue;
strcpy(szForScript,fn_szGetLevelsDataPath());
strcat(szForScript,"\\");
strcat(szForScript,LDT_szGetParam(1));
p_stValue = SCR_fnp_st_Link_CreateOrGetLinkFromKey(&g_st3DOSLinkTable.stCharacter, szForScript);
if(SCR_M_e_Link_GetState(p_stValue)==SCR_ELS_Link_Initialized)
hObjectParent = (struct tdstEngineObject_*)SCR_M_ul_Link_GetValue(p_stValue);
if(hObjectParent==NULL)
{
#ifdef _DEBUG
char szText[255],szSectionName[255];
LDT_ComputeSectionName(pLink,szSectionName);
sprintf(szText,"Le WayPoint %s a pour p<>re l'acteur %s non charg<72>",szSectionName,LDT_szGetParam(1));
MessageBox(NULL , szText , "ERROR" , MB_OK+MB_ICONERROR);
#endif
}
break;
}/*endswitch*/
result=LDT_GetNextEntry();
}/*endwhile*/
/*Working for EndSection*/
/* compute absolute position usinf father position if needed*/
if(hObjectParent)
{
POS_tdxHandleToPosition hGlobalMatrix;
hSuperObjParent = M_GetSuperObject(hObjectParent);
hGlobalMatrix = fn_p_st3dDataGetMatrix (hObjectParent->h_3dData);
POS_fn_vMulMatrixVertex( &stAbsolutePosition, hGlobalMatrix, &stVertex );
}
else
{
MTH3D_M_vCopyVector( &stAbsolutePosition, &stVertex );
hSuperObjParent = NULL;
}
/* is waypoint into map ???*/
h_SOSector=SECT_fn_hResearchInWhatSectorIAm(SECT_hFatherSector,&stAbsolutePosition);
if (SECT_fn_bIsThisSectorUniverse(h_SOSector))
{
#ifdef _DEBUG
char szText[255],szSectionName[255];
LDT_ComputeSectionName(pLink,szSectionName);
sprintf(szText,"Le WayPoint %s est dans le secteur Univers",szSectionName);
MessageBox(NULL , szText , "ERROR" , MB_OK+MB_ICONERROR);
#else
return 0;
#endif
}
/* create waypoint*/
hWaypoint = WP_fnh_WayPoint_Create();
WP_fnv_WayPoint_AddRef(hWaypoint);
/*!!! CE VREA AICI (CORELAT CU AlreadyAnalysed)*/
/* SCR_M_RdL0_SetSectionLong(0, 0, (unsigned long)hWaypoint);*/
/* update Link Table*/
LDT_ComputeSectionName(pLink,szCompleteName);
/*strcpy(szWaypointName,szCompleteName);*/
/*strcpy(szCompleteName,fn_szGetLevelsDataPath());*/
/*strcat(szCompleteName,"\\");*/
/*strcat(szCompleteName,szWaypointName);*/
SCR_fnp_st_Link_SetValue( &WP_gs_stWayPointLinkTable, szCompleteName, (unsigned long)hWaypoint );
/* Set father*/
WP_M_vWayPointSetSuperObject(hWaypoint,hSuperObjParent);
/* Set radius*/
WP_M_vWayPointSetRadius(hWaypoint,xRadius);
/* Set position*/
WP_M_vWayPointSetVertex(hWaypoint, &stVertex);
fn_vCreateGeoWayPoint((WP_tdstWayPoint *)hWaypoint);
return 0;
}
/*#endif /* AI_USE_SCRIPT */
/*END FS 9/14/98*/
/*BEGIN FS 9/14/98*/
/*#if defined(AI_USE_SCRIPT)*/
/*----------------------------------------------------------------------
* Description: callback for WPGraph section from .WP sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/14/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadWP_Graph( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szSectionName;
WP_tdHandleOfGraph hGraph = NULL;
char sz255Error[255];
szSectionName=LDT_szGetSectionName();
if (strlen(szSectionName)==0)
{
sprintf(sz255Error, "invalid Name for WPGraph !");
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
while( LDT_GetNextEntry()!=ParseResult_EndSection );
return -1;
}
if (LDT_iGetNbParams()<1)
{
sprintf(sz255Error, "invalid Reference for WPGraph (%s) !", szSectionName);
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
while( LDT_GetNextEntry()!=ParseResult_EndSection );
return -1;
}
hGraph = WPG_fn_hCreate(szSectionName,LDT_szGetParam(1));
WPG_fn_vAddGlobalGraph(hGraph) ;
pLink->pObject=hGraph;
/* read the next line in script file*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
/* Load WpSommet SubSection of WpGraph section*/
LDT_LoadSection(NULL);
result=LDT_GetNextEntry();
}
return 0;
}
/*#endif /* AI_USE_SCRIPT */
/*END FS 9/14/98*/
/*BEGIN FS 9/14/98*/
/*#if defined(AI_USE_SCRIPT)*/
/*----------------------------------------------------------------------
* Description: callback for ... of ... sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/14/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadWP_Sommet( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szSectionName, *szEntryName, *szParam1=NULL;
WP_tdHandleOfGraph hGraph;
WP_tdhWayPoint hWayPoint, hDstWayPoint;
long lCapacity, lValuation, lTypeOfWP;
char sz255Error[255];
char* dummy;
/*Working for BeginSection*/
hGraph=(WP_tdHandleOfGraph)pLink->pParent->pObject;
szSectionName=LDT_szGetSectionName();
hWayPoint = GetWPFromName(szSectionName, hGraph);
if (!hWayPoint)
{
sprintf(sz255Error, "unknown WayPoint (%s) in WPGraph !", szSectionName);
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
while( LDT_GetNextEntry()!=ParseResult_EndSection );
return -1;
}
WPG_fn_lAddWayPointIfNotExists(hGraph, hWayPoint, 0L);/* first ignore the Type Of WP*/
if (LDT_iGetNbParams()>1)
{ /* then change the Type Of WP, if one ! !*/
lTypeOfWP = (long) strtoul(LDT_szGetParam(1), &dummy, 2);
WPG_fn_lChangeTypeOfWP (hGraph, hWayPoint, lTypeOfWP); /*BART*/
}
/*Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
hDstWayPoint = GetWPFromName(szEntryName, hGraph);
if (!hDstWayPoint)
{
sprintf(sz255Error, "unknown WayPoint (%s) in WPGraph !", szEntryName);
M_AIWarningErrorAndAllowStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, sz255Error);
while( LDT_GetNextEntry()!=ParseResult_EndSection );
return -1;
}
WPG_fn_lAddWayPointIfNotExists(hGraph, hDstWayPoint, 0L); /* ignore the Type Of WP*/
lValuation = atoi(LDT_szGetParam(1));
lCapacity = (long) strtoul(LDT_szGetParam(2), &dummy, 2);
WPG_fn_lAddArcToWayPoint (hGraph, hWayPoint, hDstWayPoint, lValuation, lCapacity);
result=LDT_GetNextEntry();
}
return 0;
}
/*#endif /* AI_USE_SCRIPT */
/*END FS 9/14/98*/
/*BEGIN FS 9/14/98*/
/*----------------------------------------------------------------------
* Description: callback for Isolate and InWay sections from .WP sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/14/98
* Modif date:
*----------------------------------------------------------------------*/
/*#if defined(AI_USE_SCRIPT)*/
int LoadWP_Isolate_InWay( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
while((result=LDT_GetNextEntry())!=ParseResult_EndSection )
{
/* Load WayPoint SubSection of Isolate section*/
if(result == ParseResult_BeginSection)
LDT_LoadSection(NULL);
}
return 0;
}
/*#endif /* AI_USE_SCRIPT */
/*END FS 9/14/98*/

View File

@@ -0,0 +1,9 @@
/* Generated file. Do not modified.*/
#ifdef U64_IA_EN_C
#endif /* U64_IA_EN_C */
/*$*/
CFast_tdst_ArrayFunctions CFast_gast_ArrayFunctions[] =
{
CFast_M_MakeRef(NULL, NULL, 0, NULL),
CFast_M_MakeRef(NULL, NULL, 0, NULL)
};

View File

@@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*/
/* Action table functions and macros for intelligence engine*/
/* author : 22/12/96 Olivier Couvreur*/
/* modify : 07/11/96 Olivier Couvreur */
/* modify : 03/02/97 Olivier Couvreur Lint 0 warnings */
/* modify : 26/02/97 Olivier Couvreur added Schedule support + Lint 0 warnings*/
/* modify : 05/03/97 Olivier Couvreur added Schedule function + Lint 0 warnings*/
/* modify : 25/03/97 Olivier Couvreur added REVERSE_RULES support + optimizations (not yet activated)*/
/*---------------------------------------------------------------------------*/
#if !defined(__ACTTABLE_H__)
#define __ACTTABLE_H__
#define DEFAULT_ACTION_TABLE_NB_ENTRIES 3
#define MIN_ACTION_TABLE_NB_ENTRIES 2
#define MAX_ACTION_TABLE_NB_ENTRIES 5
#if defined(U64)
#include "AIUseCPA.h"
#include "StrIntel.h"
#endif
#include "ActParam.h"
typedef struct tdstActionTableEntry_
{
/* action parameter*/
struct tdstActionParam_ stActionParam;
/* action node pointer*/
struct tdstNodeInterpret_ *p_stNode;
/* 1 if entry is used*/
unsigned char bUsed;
/* rule number*/
unsigned char ucNumRule;
unsigned char bUseDefaultActionReturn;
unsigned char ucNewActionReturn;
} tdstActionTableEntry;
typedef struct tdstActionTable_
{
struct tdstActionTableEntry_ *p_stEntry;
/* nb possible actions*/
unsigned char ucNbEntries;
/* nb actions not immediate*/
unsigned char ucNbEntriesUsed;
/* for parameter acces : cf actparam.cpp*/
unsigned char ucCurrentEntry;
} tdstActionTable;
#define M_ActionTable(p_stInt) ((p_stInt)->p_stActionTable)
#define M_ActionTableCurrentEntry(p_stInt) (M_ActionTable(p_stInt)->ucCurrentEntry)
#define M_ActionTableNbEntriesUsed(p_stInt) (M_ActionTable(p_stInt)->ucNbEntriesUsed)
#define M_TableNbEntries(p_stTable) ((p_stTable)->ucNbEntries)
#define M_ActionTableNbEntries(p_stInt) (M_TableNbEntries(M_ActionTable(p_stInt)))
#define M_IsActionTableUsed(p_stInt) ((M_ActionTableNbEntriesUsed(p_stInt)!=0)?TRUE:FALSE)
#define M_TableEntry(p_stTable) ((p_stTable)->p_stEntry)
#define M_ActionTableEntry(p_stInt) (M_TableEntry(M_ActionTable(p_stInt)))
#define M_ActionTableEntryN(p_stInt, N) (M_TableEntry(M_ActionTable(p_stInt))[(N)])
#define M_ActionTableNumRule(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).ucNumRule)
#define M_ActionTableNumNode(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).p_stNode)
#define M_ActionTableUseFlag(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).bUsed)
#define M_ActionTableParam(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).stActionParam)
#define M_ActionTableUseActionReturn(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).bUseDefaultActionReturn)
#define M_ActionTableNewActionReturn(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).ucNewActionReturn)
unsigned char fn_ucIsRuleInActionTable(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNumRule);
unsigned char fn_ucIsRuleAndNodeInActionTable(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNumRule,struct tdstNodeInterpret_ *p_stNode);
unsigned char fn_ucFindPlaceInActionTable(struct tdstIntelligence_ *p_stIntelligence);
void fn_vUseCurrentActionTableEntry(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNRule,struct tdstNodeInterpret_ *p_stNode);
void fn_vUnuseCurrentActionTableEntry(struct tdstIntelligence_ *p_stIntelligence);
void fn_vUnuseAllRulesWhichHaveGreaterNumRule(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNumRule);
void fn_vUnuseAllRulesFromSchedule(struct tdstIntelligence_ *p_stIntelligence);
struct tdstNodeInterpret_ *fn_p_stGetScheduleFromActionTableAndClearIt(struct tdstIntelligence_ *p_stIntelligence);
struct tdstNodeInterpret_ *fn_p_stGetTableAction(struct tdstIntelligence_ *p_stIntelligence, unsigned char ucNEntry);
/**************************************/
#if !defined(CPA_EXPORT)
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif /*CPA_WANTS_IMPORT || CPA_WANTS_EXPORT*/
#endif /*CPA_EXPORT*/
/**************************************/
#undef extern
#define EXTERN_AI_DLL extern
/***********************************************************************/
EXTERN_AI_DLL CPA_EXPORT void fn_vInitActionTable(struct tdstIntelligence_ *p_stIntelligence);
/*******************************************************************************/
#undef EXTERN_AI_DLL
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
/*///////////////////////////////////////////////////////////*/
/**/
/* Management of the Module : AIDebug*/
/**/
/* File Name : ErrAIDebug.h*/
/* Date : 03/10/96*/
/* Author : First_Name Last_Name*/
/**/
/*///////////////////////////////////////////////////////////*/
/**/
/* abbreviation of the module-name. Used in macro is 'AIDebug'*/
/**/
/*///////////////////////////////////////////////////////////*/
#ifndef __ERRAIDEBUG_H__
#define __ERRAIDEBUG_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define C_szAIDebugVersion "AIDEBUG V5.0.0" /* The format is XXX Va.b.c with Xxx is the Tag of the module */
#define C_szAIDebugFullName "My AIDebug module"/* the complete and clear name of the module */
#define C_szAIDebugDate __DATE__ /*The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/
/* For DLLs who are using this module : */
#undef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#include "ERM.h"
#define __FATAL_ERR_AIDEBUG__
#define __WARNING1_ERR_AIDEBUG__
/*----------*/
/* Constant */
/*----------*/
/* error of the AIDebug Module*/
typedef enum e_uwAIDebugErrNumber_{
E_uwAIDebugFatalErr,
#ifdef __FATAL_ERR_AIDEBUG__
/* -----------------*/
E_uwAIDebugFatalNotAFatalError,
#endif /*__FATAL_ERR_AIDEBUG__*/
E_uwAIDebugStartOfWarning,/* important constant, it allows to recognize if an error is fatal or not.*/
#ifdef __WARNING1_ERR_AIDEBUG__
/* -------------------*/
E_uwAIDebugWarningInitFailureMem, /* memory error when initialisation */
E_uwAIDebugWarningDesInitFailureMem,/* memory failure when desinitialisation */
E_uwAIDebugWarningInvalidParameter,/* one parameter is invalid*/
E_uwAIDebugWarningNullPointer, /* try to ccess fields of a null pointer */
E_uwAIDebugWarningShouldNotHappen,/* should never happen, but....*/
#endif /*__WARNING1_ERR_AIDEBUG__*/
E_uwAIDebugErrNumber
} e_uwAIDebugErrNumber;
/*------------------*/
/* Global Variables*/
/*------------------*/
#undef __ERRAIDEBUG_EXTERN
#ifndef __DeclareGlobalVariableErrAIDebug_h__
#define __ERRAIDEBUG_EXTERN extern /*external declaration*/
#else /*__DeclareGlobalVariableErrAIDebug_h__*/
#define __ERRAIDEBUG_EXTERN /*replace by nothing : we have to declare*/
#endif /*__DeclareGlobalVariableErrAIDebug_h__*/
__ERRAIDEBUG_EXTERN CPA_EXPORT unsigned char g_ucAIDebugModuleId /*number of identification of the Erm module*/
#if defined(__DeclareGlobalVariableErrAIDebug_h__) && !defined(CPA_WANTS_IMPORT)
= C_ucModuleNotInitialized
#endif /*__DeclareGlobalVariableErrAIDebug_h__&& CPA_WANTS_IMPORT*/
;
#ifdef __ERROR_STRINGS__
__ERRAIDEBUG_EXTERN CPA_EXPORT char * g_a_szAIDebugInformationModule []
#if defined(__DeclareGlobalVariableErrAIDebug_h__) && !defined(CPA_WANTS_IMPORT)
= {C_szAIDebugVersion, C_szAIDebugFullName, C_szAIDebugDate}
#endif /*__DeclareGlobalVariableErrAIDebug_h__ && CPA_WANTS_IMPORT*/
;
__ERRAIDEBUG_EXTERN CPA_EXPORT struct tdstErrorMsg_ g_a_stAIDebugTabErr [] /* Mandatory syntax 'g_a_st'+[Abbreviation of ModuleName]+'TabErr'*/
#if defined(__DeclareGlobalVariableErrAIDebug_h__) && !defined(CPA_WANTS_IMPORT)
={
#ifdef __FATAL_ERR_AIDEBUG__
/* -------------*/
E_uwAIDebugFatalNotAFatalError, "This is not a valide AI Debug fatal error",
#endif /*__FATAL_ERR_AIDEBUG__*/
#ifdef __WARNING1_ERR_AIDEBUG__
/* ----------------*/
E_uwAIDebugWarningInitFailureMem,"Initialisation failure due to memory problem",
E_uwAIDebugWarningDesInitFailureMem,"Desinitialisation failure due to memory problem",
E_uwAIDebugWarningInvalidParameter, "One parameter of the function is invalid",
E_uwAIDebugWarningNullPointer, "Try to access fields of a null pointer",
E_uwAIDebugWarningShouldNotHappen,"This error should never happen!!!!",
#endif /*__WARNING1_ERR_AIDEBUG__*/
0xFFFF, "\0"/*fin*/
};
#endif /*__DeclareGlobalVariableErrAIDebug_h__ && CPA_WANTS_IMPORT*/
;
#endif /*__ERROR_STRINGS__*/
/*** WARNING THIS IS A PARTICULAR MACRO, FUTUR BUG :( ***/
/*#define M_bTestErrorOtherModule(ModuleName,_ChannelErrorNumber) \*/
/* (g_uc## ModuleName ##ModuleId != g_stErmTheLastErrorInfo[_ChannelErrorNumber].ucLastFailedModuleId) */
#define M_bTestErrorOtherModule(ModuleName,_ChannelErrorNumber) \
(Erm_M_uwCheckError(ModuleName,ChannelErrorNumber) != C_uwErmNoErr)
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /*__ERRAIDEBUG_H__*/

View File

@@ -0,0 +1,19 @@
/*
//////////////////////////////////////////////////////////////////////
AI Debugger Headers file
//////////////////////////////////////////////////////////////////////
File Name : AID_Head.h
Date : November 15, 1996
Author : Albert PAIS
//////////////////////////////////////////////////////////////////////
Purpose :
this file includes all headers relative to AIDebug modul
//////////////////////////////////////////////////////////////////////
*/
#undef extern
#include "specif/AID_Trac.h"
#include "AID_Main.h"
/*#include "AID_Misc.h"*/
/* error management :*/
#include "ErrAID.h"
#include "MemAID.h"

View File

@@ -0,0 +1,49 @@
/*
------------------------------------------------------------------------------------------
INCLUDE FILE :
------------------------------------------------------------------------------------------
*/
/*
memory and error management :
*/
#include "AIUseCpa.h"
#include "specif/AIOption.h"
#define __DeclareGlobalVariableMmgAIDebug_h__
#include "AID_Mmg.h"
#undef __DeclareGlobalVariableMmgAIDebug_h__
#define __DeclareGlobalVariableErrAIDebug_h__
#include "AID_Erm.h"
#undef __DeclareGlobalVariableErrAIDebug_h__
#include "Action.h"
#include "DsgMem.h"
#include "specif/ActTable.h"
#include "StrIntel.h"
#include "GetSet.h"
#include "AID_Main.h"
/*#include "AID_Eng.h"*/
/*#include "AID_Misc.h"*/
#ifdef ACTIVE_AIDEBUG /* For AI debugger*/
/* Oliv' - becoz'of codewarrior (compatible with gcc)*/
#ifdef U64_AIDEBUG
#include "AID_Trac.h"
extern tdstU64AIDebug g_stU64AIDebug;
#endif
void AIDebug_fnv_InitMain(void)
{
/* Init error module :*/
Erm_M_InitErrMsg(AIDebug);
Mmg_M_InitMmg(AIDebug);
/* Oliv' - becoz'of codewarrior (compatible with gcc)*/
#ifdef U64_AIDEBUG
g_stU64AIDebug.iU64AIDMaxIndex= D_SizeOfU64AIDBuffer;
g_stU64AIDebug.iU64AIDCurrentIndex=0;
memset( g_stU64AIDebug.a_stU64AIDBuffer, 0, D_SizeOfU64AIDBuffer*sizeof(AIDebug_tdstSectionEntry) );
#endif
}
#endif /* ACTIVE_AIDEBUG For AI debugger*/

View File

@@ -0,0 +1,178 @@
/*
//////////////////////////////////////////////////////////////////////
AI Debug main file
//////////////////////////////////////////////////////////////////////
File Name : AID_Main.h
Date : November 15, 1996
Author : Albert PAIS
//////////////////////////////////////////////////////////////////////
Purpose :
This file defines structures and prototypes used by differents
components of the AI debugger
//////////////////////////////////////////////////////////////////////
*/
#if !defined(__AIDMAIN_TYPES__)
#define __AIDMAIN_TYPES__
#if !defined(ONLY_TYPES)
#define AIDMAIN_UNDEF
#define ONLY_TYPES
#endif /* !ONLY_TYPES */
/*
------------------------------------------------------------------------------------------
INCLUDE FILES :
------------------------------------------------------------------------------------------
*/
#if defined(AIDMAIN_UNDEF)
#undef ONLY_TYPES
#undef AIDMAIN_UNDEF
#endif /* !AIDMAIN_UNDEF */
/*
------------------------------------------------------------------------------------------
TYPE DECLARATION :
------------------------------------------------------------------------------------------
*/
#endif /* !__AIDMAIN_TYPES__ */
#if !defined(ONLY_TYPES)
#if !defined(__AIDMAIN_VARS__)
#define __AIDMAIN_VARS__
#undef EXTERN
#undef extern
#if !defined(GLOBALS)
#define EXTERN extern
#else /* !GLOBALS */
#define EXTERN
#endif /* !GLOBALS */
/*
------------------------------------------------------------------------------------------
VARIABLES DEFINITION :
------------------------------------------------------------------------------------------
*/
#ifdef ACTIVE_AIDEBUG /* For AI debugger*/
#define AIDebug_C_ucIsReflex ((unsigned char)0)
#define AIDebug_C_ucIsAI ((unsigned char)1)
#endif /* ACTIVE_AIDEBUG For AI debugger*/
#endif /* !__AIDMAIN_VARS__ */
#if !defined (__AIDMAIN_PROTOS__)
#define __AIDMAIN_PROTOS__
/*
------------------------------------------------------------------------------------------
MACROS DECLARATION:
------------------------------------------------------------------------------------------
*/
#ifdef ACTIVE_AIDEBUG /* For AI debugger*/
/* getting a slot from a structure :*/
#define AIDebug_M_GetSlot(_p_stObject,_SlotName)\
((_p_stObject)->m_##_SlotName)
/* memory for AIDebug module :*/
#define AIDebug_M_xAlloc(_Var,_Type,_Size,_ErrorCode,_FailureDo)\
if(_Size)\
{\
Mmg_M_SetModeAlloc4Ch(AIDebug,E_ucDynamic,C_ucMmgDefaultChannel);\
_Var = (_Type)Mmg_fn_p_vAlloc4Ch(_Size,C_ucMmgDefaultChannel);\
if(Erm_M_uwCheckError(Mmg,C_ucErmDefaultChannel)) /*** DR Mmg instead of Mem ***/ \
{/* An error occured : initialisation failure*/ \
Erm_M_ClearLastError(C_ucErmDefaultChannel); \
Erm_M_UpdateLastError \
( \
AIDebug, /* Module 's name*/ \
C_ucErmDefaultChannel, /*mutli-thread channel*/ \
_ErrorCode, /* error code */ \
C_lErmNoDebugData, /* long for debugging data */\
C_ucErmOpenInfoWindow, /* open window ?*/ \
C_ucAllowStopForDebug,/* wether to stop or not for debugging */\
NULL \
); \
/* error ::*/ \
(_Var) = (_Type)NULL;\
_FailureDo;\
}\
}
#define AIDebug_M_xReAlloc(_Var,_Type,_Size,_ErrorCode,_FailureDo)\
if(_Size)\
{\
Mmg_M_SetModeAlloc4Ch(AIDebug,E_ucDynamic,C_ucMmgDefaultChannel);\
_Var = (_Type)Mmg_fn_p_vRealloc4Ch((void*)(_Var),_Size,C_ucMmgDefaultChannel);\
if(Erm_M_uwCheckError(Mmg,C_ucErmDefaultChannel))\
{/* An error occured : initialisation failure*/ \
Erm_M_ClearLastError(C_ucErmDefaultChannel); \
Erm_M_UpdateLastError \
( \
AIDebug, /* Module 's name*/ \
C_ucErmDefaultChannel, /*mutli-thread channel*/ \
_ErrorCode, /* error code */ \
C_lErmNoDebugData, /* long for debugging data */\
C_ucErmOpenInfoWindow, /* open window ?*/ \
C_ucAllowStopForDebug,/* wether to stop or not for debugging */\
NULL \
); \
/* error ::*/ \
(_Var) = (_Type)NULL;\
_FailureDo;\
}\
}
#define AIDebug_M_xFree(_Var,_Type,_ErrorCode,_FailureDo)\
if(_Var)\
{\
Mmg_M_SetModeAlloc4Ch(AIDebug,E_ucDynamic,C_ucMmgDefaultChannel);\
Mmg_fn_vFree4Ch((void*)(_Var),C_ucMmgDefaultChannel);\
(_Var) = (_Type)NULL;\
if(Erm_M_uwCheckError(Mmg,C_ucErmDefaultChannel))/*** DR Mmg instead of Mem ***/\
{\
/* handle error :*/\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
Erm_M_UpdateLastError\
(\
AIDebug, /* Module 's name*/\
C_ucErmDefaultChannel, /*mutli-thread channel*/\
_ErrorCode, /* error code */\
C_lErmNoDebugData, /* long for debugging data */\
C_ucErmOpenInfoWindow, /* open window ?*/\
C_ucAllowStopForDebug,/* wether to stop or not for debugging */\
NULL \
);\
_FailureDo;\
}\
}
#define AIDebug_M_MainInitialisation()\
AIDebug_fnv_InitMain();\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
/*
------------------------------------------------------------------------------------------
FUNCTIONS PROTOTYPES :
------------------------------------------------------------------------------------------
*/
/* main initialisation function*/
void AIDebug_fnv_InitMain(void);
#else /* ACTIVE_AIDEBUG For AI debugger*/
#define AIDebug_M_MainInitialisation()
#endif /* ACTIVE_AIDEBUG For AI debugger*/
#endif /* !__AIDMAIN_PROTOS__ */
#endif /* !ONLY_TYPES */

View File

@@ -0,0 +1,55 @@
/*///////////////////////////////////////////////////////////*/
/**/
/* Memory Management of the Module : AIDebug*/
/**/
/* File Name : MmgAIDebug.h*/
/* Date : 703/10/96*/
/* Author : First_Name Last_Name*/
/**/
/*///////////////////////////////////////////////////////////*/
#ifndef __MmgAIDebug_H__
#define __MmgAIDebug_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* For DLLs who are using this module : */
#undef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#include "MMG.h"
typedef enum e_ucAIDebugStaticBlocks_{
E_ucAIDebugBlock1, /* Not used now*/
E_ucAIDebugMaxBlocksNb /* maximum number of static block, You have to follow this syntax 'E_uc+ Abbreviation Module +MaxBlocksNb'*/
} e_ucAIDebugStaticBlocks;
#undef __MMGAIDEBUG_EXTERN
#ifdef __DeclareGlobalVariableMmgAIDebug_h__
#define __MMGAIDEBUG_EXTERN /*nothing*/
#else /* no __DeclareGlobalVariableMmgAIDebug_h__*/
#define __MMGAIDEBUG_EXTERN extern
#endif /*__DeclareGlobalVariableMmgAIDebug_h__*/
__MMGAIDEBUG_EXTERN CPA_EXPORT struct tdstBlockInfo_ g_a_stAIDebugBlocksInfo[E_ucAIDebugMaxBlocksNb];
#ifdef __DYNAMIC_MALLOC_ALLOWED__
#ifdef __DEBUG_MALLOC_MODE__
__MMGAIDEBUG_EXTERN CPA_EXPORT struct tdstDynInfo_ g_stAIDebugDynInfo;
#endif /*__DEBUG_MALLOC_MODE__*/
#endif /*__DYNAMIC_MALLOC_ALLOWED__*/
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif /*__MmgAIDebug_H__*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,183 @@
/****************************************************
BreakPoints for AI Debugger
implementation file
David Reizer December 1997
*****************************************************/
#include "AIUseCPA.h"
#include "StrIntel.h"
#include "EnumOper.h"
#include "AID_Erm.h"
#include "BreakPts.h"
#if defined(ACTIVE_AIDEBUG)
#define M_bIsBreakableOperator(_eId)\
( ((_eId) == eOperator_Affect) ||\
((_eId) == eOperator_PlusAffect) ||\
((_eId) == eOperator_MinusAffect) ||\
((_eId) == eOperator_MulAffect) ||\
((_eId) == eOperator_DivAffect) ||\
((_eId) == eOperator_VectorPlusVector) ||\
((_eId) == eOperator_VectorMinusVector) ||\
((_eId) == eOperator_VectorMulScalar) ||\
((_eId) == eOperator_VectorDivScalar) ||\
((_eId) == eOperator_SetVectorX) ||\
((_eId) == eOperator_SetVectorY) ||\
((_eId) == eOperator_SetVectorZ) )
/***
**** Return True if the Node accepts a breakpoint
***/
ACP_tdxBool fn_bIsBreakableNode( tdstNodeInterpret *_pstNode )
{
tdeTypeInterpret eType;
tdeOperatorId eId;
if( _pstNode == NULL )
{
Erm_M_UpdateLastError( AIDebug,
C_ucErmDefaultChannel,
E_uwAIDebugWarningNullPointer,
C_lErmNoDebugData,
C_ucErmOpenInfoWindow,
C_ucAllowStopForDebug,
NULL );
return FALSE;
}
eType = M_GetTypeInterpret(_pstNode);
eId = M_eOperatorIdInterpret(_pstNode);
return( (eType == E_ti_KeyWord) ||
(eType == E_ti_Procedure) ||
(eType == E_ti_MetaAction) ||
((eType == E_ti_Operator) && M_bIsBreakableOperator(eId)) );
}
/***
**** Find the tree containing a given node
***/
tdstTreeInterpret * fn_pstFindTreeWithNode( tdstScriptAI *_pstScript, unsigned long _ulNb, tdstNodeInterpret *_pstNode )
{
tdstComport *pstComport = NULL;
tdstTreeInterpret * pstTree = NULL;
int i = 0;
/*** first get the comport ***/
pstComport = M_GetScriptAIComportN( _pstScript, _ulNb );
if( pstComport == NULL )
{
Erm_M_UpdateLastError( AIDebug,
C_ucErmDefaultChannel,
E_uwAIDebugWarningNullPointer,
C_lErmNoDebugData,
C_ucErmOpenInfoWindow,
C_ucAllowStopForDebug,
"The comport is null" );
return NULL;
}
/*** Search in schedule ***/
pstTree = M_GetComportSchedule( pstComport );
if( pstTree == NULL )
{
Erm_M_UpdateLastError( AIDebug,
C_ucErmDefaultChannel,
E_uwAIDebugWarningNullPointer,
C_lErmNoDebugData,
C_ucErmOpenInfoWindow,
C_ucAllowStopForDebug,
"The schedule is null" );
}
else
if( ( M_GetNodeInterpret(pstTree) <= _pstNode ) && ( _pstNode < (M_GetNodeInterpret(pstTree) + M_GetNbNodeInterpret(pstTree)) ) )
return pstTree;
/*** Search in rules ***/
for( i=0; i < M_GetComportNbRules(pstComport); i++ )
{
pstTree = M_GetComportRuleN( pstComport, i );
if( pstTree == NULL )
{
Erm_M_UpdateLastError( AIDebug,
C_ucErmDefaultChannel,
E_uwAIDebugWarningNullPointer,
C_lErmNoDebugData,
C_ucErmOpenInfoWindow,
C_ucAllowStopForDebug,
"The rule is null" );
}
else
if( ( M_GetNodeInterpret(pstTree) <= _pstNode ) && ( _pstNode < (M_GetNodeInterpret(pstTree) + M_GetNbNodeInterpret(pstTree)) ) )
return pstTree;
}
return NULL;
}
/**************************************************************************************
* Set a breakpoint on the first breakable node before the one passed as a parameter
*
* Input : the proposed node for BreakPoint
* the script containing the node
* the number of the comport containing the node
*
* Output: the actual node with the breakpoint or NULL
*
*****************************************************************************************/
tdstNodeInterpret * fn_pstSetValidBreakPoint( tdstNodeInterpret *_pstNode, tdstScriptAI *_pstScript, unsigned long _ulNb )
{
tdstTreeInterpret *pstTree = NULL;
tdstNodeInterpret *pstTmpNode = NULL;
/*** if node accepts breakpoint then it is used ***/
if( fn_bIsBreakableNode( _pstNode ) )
{
M_SetBreakPoint( _pstNode, TRUE );
return _pstNode;
}
/*** else find the tree containing the node ***/
pstTree = fn_pstFindTreeWithNode( _pstScript, _ulNb, _pstNode );
if( pstTree == NULL )
{
Erm_M_UpdateLastError( AIDebug,
C_ucErmDefaultChannel,
E_uwAIDebugWarningNullPointer,
C_lErmNoDebugData,
C_ucErmOpenInfoWindow,
C_ucAllowStopForDebug,
"The found tree is null" );
return NULL;
}
/*** Serach for the previous breakable node ***/
pstTmpNode = _pstNode;
while( (pstTmpNode >= M_GetNodeInterpret(pstTree)) && !(fn_bIsBreakableNode( pstTmpNode )) )
pstTmpNode --;
/*** a node is found ***/
if( fn_bIsBreakableNode( pstTmpNode ) )
{
M_SetBreakPoint( pstTmpNode, TRUE );
return pstTmpNode;
}
/*** no node is found, the breakpoint is invalid ***/
else
return NULL;
}
#endif /*ACTIVE_AIDEBUG*/

View File

@@ -0,0 +1,668 @@
/*---------------------------------------------------------------------------*/
/* AITools.C : Some useful functions*/
/* author : Olivier Couvreur.*/
/* date : 05/05/1996*/
/*---------------------------------------------------------------------------*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "AI_Mmg.h"
#include "AI_Struc.h"
#include "WPWayPt.h"
#include "specif/AITools.h"
#include "StrIntel.h"
#include "safe.h"
/* in order to test NULL perso,waypoint,action,GMT, text, etc. */
#if defined(__DEBUG_AI__)
static unsigned char gs_ucDontCheckNULLFlag = 0;
void fn_vSetDontCheckNULLFlag(signed char _cValue)
{
gs_ucDontCheckNULLFlag += _cValue;
}
#endif /* __DEBUG_AI__*/
#ifdef ACTIVE_EDITOR
extern unsigned char g_ucIsEdInGhostMode;
void fn_vCheckModuleAccess(HIE_tdxHandleToSuperObject hPerso, ACP_tdxBool _bNextArgIsAChannel, void *_p_vChannelOrModuleHandle)
{
HIE_tdxHandleToSuperObject hModule;
unsigned char ucChannel;
if ( _bNextArgIsAChannel )
{
ucChannel = *(unsigned char *)_p_vChannelOrModuleHandle;
hModule = fn_hGetSuperObjectInChannel(fn_h3dDataGetChannelSOList(M_GetMSHandle(hPerso, 3dData)),(short) ucChannel);
}
else
{
ucChannel = C_ucUnknownChannel;
hModule = *(HIE_tdxHandleToSuperObject *)_p_vChannelOrModuleHandle;
}
/* if B mode, no check is done */
if (g_ucIsEdInGhostMode)
{
if (hModule)
hModule->llastComputeFrameForModule = HIE_gs_lCurrentFrame;
return;
}
/* if hModule is NULL, then there is an error : access to a valid channel number, but nothing in the channel !*/
if (hModule == NULL)
{
/* error !*/
char cText[512];
if (M_GetMSHandle(hPerso,Brain) && M_pstGetMindOfBrain(M_GetMSHandle(hPerso,Brain)))
{
sprintf(cText,"You try to access a module that does not exist at this moment !!!\n"
"this module belongs to : %s\nThe number of the channel you try to access is : %i\n",(M_pstGetMindOfBrain(M_GetMSHandle(hPerso,Brain)))->szPersoName,ucChannel);
}
else
{
sprintf(cText,"You try to access a module that does not exist at this moment !!!\n"
"this module belongs to <actor with no brain (current state is %s)>\nThe number of the channel you try to access is : %i\n",ucChannel, fn_p_szGetStateName(fn_h3dDataGetCurrentState(M_GetMSHandle(hPerso,3dData))));
}
SAF_M_AssertWithMsg(FALSE,cText);
}
else if (hModule->llastComputeFrameForModule < HIE_gs_lCurrentFrame-1)
{
/* error !*/
char cText[512];
if (M_GetMSHandle(hPerso,Brain) && M_pstGetMindOfBrain(M_GetMSHandle(hPerso,Brain)))
{
sprintf(cText,"You try to get a module position that is not up to date !!!\n"
"this module belongs to : %s\n",(M_pstGetMindOfBrain(M_GetMSHandle(hPerso,Brain)))->szPersoName);
}
else
{
sprintf(cText,"You try to get a module position that is not up to date !!!\n"
"this module belongs to <actor with no brain (current state is %s)>\n", fn_p_szGetStateName(fn_h3dDataGetCurrentState(M_GetMSHandle(hPerso,3dData))));
}
if (fn_ulStandardGameGetCustomBitsSO(hPerso) & GAM_C_CustBitNeedModuleMatrices)
{
strcat(cText,"This Perso already has the custombit 2 set, but it seems that the anim player has not\n"
"been played this time..., so check anim player related flags\n");
}
else
{
strcat(cText,"This perso does not have the custom bit 2 set, correct this and try again\n");
}
sprintf (cText + strlen(cText),"There is a difference of %i frames\n",HIE_gs_lCurrentFrame-hModule->llastComputeFrameForModule);
SAF_M_AssertWithMsg(FALSE,cText);
}
}
#endif
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
#if defined(__DEBUG_AI__)
unsigned char fn_ucGetDontCheckNULLFlag()
{
return gs_ucDontCheckNULLFlag;
}
#endif /* __DEBUG_AI__ */
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* CGHT*/
#if 0
/* MODIF YLG*/
ACP_tdxBool fn_bIsEndReached(MTH_tdxReal xStart,MTH_tdxReal xEnd,MTH_tdxReal xSpeed)
{
if(MTH_M_bGreaterZero(xSpeed))
{
return(MTH_M_bGreaterEqual(xStart,xEnd));
}
else if(MTH_M_bLessZero(xSpeed))
{
return(MTH_M_bLessEqual(xStart,xEnd));
}
return(TRUE);
}
#endif
char *fn_szGetStringFromTextOrStringParam(tdstGetSetParam *p_stValue)
{
char *pszString = NULL;
if ( M_GetSetParam_Type(p_stValue) == E_vt_String )
{
pszString = M_GetSetParam_szString(p_stValue);
}
else if ( M_GetSetParam_Type(p_stValue) == E_vt_Text )
{
pszString = FON_fn_szGetTextPointerForHandle(M_GetSetParam_hText(p_stValue));
}
return pszString;
}
void fn_vGetCenterOfBoundingVolume(HIE_tdxHandleToSuperObject hPerso,struct MTH3D_tdstVector_ *p_stVertex)
{
GEO_tdxHandleToBoundingSphere hBoundingSphere;
hBoundingSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(hPerso);
/* si il y a un bounding volume*/
if (hBoundingSphere!=NULL)
{
/* on renvoie le centre de la sph<70>re*/
MTH3D_M_vMulMatrixVector(p_stVertex, &(hPerso->hGlobalMatrix->stRotationMatrix), &(hBoundingSphere->stCenterPoint));
MTH3D_M_vAddVector (p_stVertex,p_stVertex,&(hPerso->hGlobalMatrix->stTranslationVector));
}
else
{
/* on renvoie l'origine du rep<65>re*/
MTH3D_M_vCopyVector(p_stVertex, &(hPerso->hGlobalMatrix->stTranslationVector));
}
}
MTH_tdxReal fn_xDistanceBetweenPersoAndWP(HIE_tdxHandleToSuperObject p_SuperObjPerso, WP_tdhWayPoint hWP)
{
MTH3D_tdstVector stVertex1, stVertex2;
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso), &stVertex1);
WP_fnv_WayPoint_ComputeLocation(hWP, &stVertex2);
MTH3D_M_vSubVector(&stVertex1, &stVertex1, &stVertex2);
return (MTH3D_M_xNormVector(&stVertex1));
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
MTH_tdxReal fn_xDistanceBetweenPerso(HIE_tdxHandleToSuperObject p_SuperObjPerso1, HIE_tdxHandleToSuperObject p_SuperObjPerso2)
{
MTH3D_tdstVector stVertex1, stVertex2;
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso1), &stVertex1);
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso2), &stVertex2);
MTH3D_M_vSubVector(&stVertex1, &stVertex1, &stVertex2);
return (MTH3D_M_xNormVector(&stVertex1));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
MTH_tdxReal fn_xInternalDistance(MTH3D_tdstVector *p_stVector,unsigned char ucFlags)
{
MTH_tdxReal xX,xY,xZ;
xX=MTH3D_M_xGetXofVector(p_stVector);
xY=MTH3D_M_xGetYofVector(p_stVector);
xZ=MTH3D_M_xGetZofVector(p_stVector);
switch (ucFlags)
{
/* signed distance */
case C_DISTANCE_X:
return(xX);
case C_DISTANCE_Y:
return(xY);
case C_DISTANCE_Z:
return(xZ);
/* unsigned distance */
case C_DISTANCE_XY:
return(MTH_M_xSqrt(MTH_M_xAdd(MTH_M_xSqr(xX),MTH_M_xSqr(xY))));
case C_DISTANCE_XZ:
return(MTH_M_xSqrt(MTH_M_xAdd(MTH_M_xSqr(xX),MTH_M_xSqr(xZ))));
case C_DISTANCE_YZ:
return(MTH_M_xSqrt(MTH_M_xAdd(MTH_M_xSqr(xY),MTH_M_xSqr(xZ))));
default:
return 0;
break;
case C_DISTANCE_XYZ:
return(MTH3D_M_xNormVector(p_stVector));
}
}
/* distance expressed in local of perso2 */
MTH_tdxReal fn_xExtendedDistanceBetweenPerso(HIE_tdxHandleToSuperObject p_SuperObjPerso1, HIE_tdxHandleToSuperObject p_SuperObjPerso2, unsigned char ucFlags)
{
MTH3D_tdstVector stVertex1, stVertex2;
/*XB980430*/
/* MTH_tdxReal xNorm2=MTH_C_ZERO;*/
/*End XB*/
POS_tdstCompletePosition stMatrix;
/* bounding volume center or origin*/
if (ucFlags & DISTANCE_TO_CENTER_OF_BOUNDING_VOLUME)
{
fn_vGetCenterOfBoundingVolume(p_SuperObjPerso1,&stVertex1);
fn_vGetCenterOfBoundingVolume(p_SuperObjPerso2,&stVertex2);
}
else
{
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso1), &stVertex1);
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso2), &stVertex2);
}
MTH3D_M_vSubVector(&stVertex1, &stVertex1, &stVertex2);
ucFlags &= C_DISTANCE_MASK;
if (ucFlags!=C_DISTANCE_MASK)
{
/* return to local coordinates*/
POS_fn_vInvertIsoMatrix(&stMatrix,HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso2));
POS_fn_vMulMatrixVector(&stVertex1,&stMatrix,&stVertex1);
}
return(fn_xInternalDistance(&stVertex1,ucFlags));
}
/* local in perso2 */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
MTH_tdxReal fn_xExtendedDistanceBetweenVertexAndPerso(MTH3D_tdstVector *p_stVertex1,HIE_tdxHandleToSuperObject p_SuperObjPerso2 , unsigned char ucFlags)
{
MTH3D_tdstVector stVertex2;
/*XB980430*/
/* MTH_tdxReal xNorm2=MTH_C_ZERO;*/
/*End XB*/
POS_tdstCompletePosition stMatrix;
/* bounding volume center or origin*/
if (ucFlags & DISTANCE_TO_CENTER_OF_BOUNDING_VOLUME)
{
fn_vGetCenterOfBoundingVolume(p_SuperObjPerso2,&stVertex2);
}
else
{
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso2), &stVertex2);
}
MTH3D_M_vSubVector(p_stVertex1,p_stVertex1,&stVertex2);
ucFlags &= C_DISTANCE_MASK;
if (ucFlags!=C_DISTANCE_MASK)
{
/* return to local coordinates*/
POS_fn_vInvertIsoMatrix(&stMatrix,HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso2));
POS_fn_vMulMatrixVector(p_stVertex1,&stMatrix,p_stVertex1);
}
return(fn_xInternalDistance(p_stVertex1,ucFlags));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
MTH_tdxReal fn_xComputeDirectionAngle(MTH3D_tdstVector *p_stVector)
{
MTH_tdxReal xRealX,xRealY,xAngle;
xRealX=MTH3D_M_xGetXofVector(p_stVector);
xRealY=MTH3D_M_xGetYofVector(p_stVector);
/* Arctan(y/x)*/
if (xRealX) xAngle=MTH_M_xATan(MTH_M_xDiv(xRealY , xRealX));
else if(MTH_M_bLess(xRealY ,MTH_C_ZERO)) xAngle=MTH_M_xNeg(MTH_C_PiBy2);
else xAngle=MTH_C_PiBy2;
/* correction !?!*/
if(MTH_M_bLess(xRealX ,MTH_C_ZERO)) xAngle=MTH_M_xAdd(xAngle,MTH_C_Pi);
if(MTH_M_bLess(xAngle,MTH_C_ZERO)) xAngle=MTH_M_xAdd(xAngle,MTH_C_2Pi);
/* correction if xAngle=0 (you go on the x axis), the angle of the perso is PI/2.*/
xAngle = MTH_M_xAdd(xAngle,MTH_C_PiBy2);
if(MTH_M_bGreater(xAngle,MTH_C_2Pi)) xAngle=MTH_M_xSub(xAngle,MTH_C_2Pi);
return(xAngle);
}
/* angle must be [in 0, 2pi[ : use xAngle=fn_xRealModuloAround(MTH_C_ZERO,MTH_C_2Pi,xAngle);*/
MTH_tdxReal fn_xComputeBestEcartDirectionAngle(MTH_tdxReal xAngleFollowed,MTH_tdxReal xAngleToFollow)
{
/* to be sure Abs(xDeltaAngle) is <=180 deg : so that it is the shortest angle */
MTH_tdxReal xDeltaAngle=MTH_M_xSub(xAngleToFollow,xAngleFollowed);
if (MTH_M_bGreater(xDeltaAngle,MTH_C_ZERO))
{
if (MTH_M_bGreater(xDeltaAngle,MTH_C_Pi))
{
xDeltaAngle=MTH_M_xSub(xDeltaAngle,MTH_C_2Pi);
}
}
else
{
if (MTH_M_bLess(xDeltaAngle,MTH_M_xNeg(MTH_C_Pi)))
{
xDeltaAngle=MTH_M_xAdd(xDeltaAngle,MTH_C_2Pi);
}
}
return(xDeltaAngle);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdstMACDPID *fn_p_stGetMACDPIDPointer(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
tdstMACDPID *p_stMACDPID=NULL;
MS_tdxHandleToDynam h_Dynam;
DNM_tdstDynamics *p_stDynamics;
if((h_Dynam = M_GetMSHandle(p_SuperObjPerso,Dynam)) != NULL )
{
if((p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam)) != NULL)
{
p_stMACDPID = DNM_M_p_stDynamicsGetExternalDatas(p_stDynamics);
}
}
if (p_stMACDPID==NULL)
{
M_AIFatalError(E_uwAIFatalNoDynamics);
}
return (p_stMACDPID);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
DNM_tdstReport *fn_pstGetDNMReport(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
MS_tdxHandleToDynam h_Dynam;
DNM_tdstDynamics *p_stDynamics;
if((h_Dynam = M_GetMSHandle(p_SuperObjPerso,Dynam)) == NULL )
return NULL;
if((p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam)) == NULL)
return NULL;
return DNM_M_p_stDynamicsGetReport(p_stDynamics);
}
/* round xValue so that it belongs to [xFrom,xFrom+xModulus[*/
MTH_tdxReal fn_xRealModuloAround(MTH_tdxReal xFrom,MTH_tdxReal xModulus,MTH_tdxReal xValue)
{
/* xValue -= xFrom;*/
xValue=MTH_M_xSub(xValue,xFrom);
/* while (xValue<0) xValue += xModulus;*/
while (MTH_M_bLess(xValue,MTH_C_ZERO))
{
xValue=MTH_M_xAdd(xValue,xModulus);
}
/* while (xValue>=xModulus) xValue -= xModulus;*/
while (MTH_M_bGreaterEqual(xValue,xModulus))
{
xValue=MTH_M_xSub(xValue,xModulus);
}
/* xValue += xFrom;*/
xValue=MTH_M_xAdd(xValue,xFrom);
/* that's all folks*/
return(xValue);
};
/* same but but for a vector (X,Y,Z)*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vVectorModuloAround(MTH_tdxReal xFrom,MTH_tdxReal xModulus,struct MTH3D_tdstVector_ *p_stRotationVector)
{
MTH3D_M_vSetXofVector(p_stRotationVector,fn_xRealModuloAround(xFrom,xModulus,MTH3D_M_xGetXofVector(p_stRotationVector)));
MTH3D_M_vSetYofVector(p_stRotationVector,fn_xRealModuloAround(xFrom,xModulus,MTH3D_M_xGetYofVector(p_stRotationVector)));
MTH3D_M_vSetZofVector(p_stRotationVector,fn_xRealModuloAround(xFrom,xModulus,MTH3D_M_xGetZofVector(p_stRotationVector)));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
;
/* make angular speed vector positive*/
/*
void fn_vMakeAngularSpeedVectorPositive(struct MTH3D_tdstVector_ *p_stRotationVector,struct MTH3D_tdstVector_ *p_stAngleVector,struct MTH3D_tdstVector_ *p_stAimAngleVector)
{
MTH_tdxReal xTemp;
// we must quarantee that RotationVector is >0, and that
// sgn(AimAngleVector-Anglevector)=sgn(RotationVector)
// if (RotationVector<0)
// {
// RotationVector=-RotationVector;
// if (Anglevector<AimAngleVector) AngleVector+=2Pi;
// }
// else
// {
// if (Anglevector>AimAngleVector) AngleVector-=2Pi;
// }
///
// X
if (MTH_M_bLess(xTemp=MTH3D_M_xGetXofVector(p_stRotationVector),MTH_C_ZERO))
{
MTH3D_M_vSetXofVector(p_stRotationVector,MTH_M_xNeg(xTemp));
xTemp=MTH3D_M_xGetXofVector(p_stAngleVector);
while (MTH_M_bLess(xTemp,MTH3D_M_xGetXofVector(p_stAimAngleVector)))
{
xTemp=MTH_M_xAdd(xTemp,MTH_C_2Pi);
}
MTH3D_M_vSetXofVector(p_stAngleVector,xTemp);
}
else
{
xTemp=MTH3D_M_xGetXofVector(p_stAngleVector);
while (MTH_M_bGreater(xTemp,MTH3D_M_xGetXofVector(p_stAimAngleVector)))
{
xTemp=MTH_M_xSub(xTemp,MTH_C_2Pi);
}
MTH3D_M_vSetXofVector(p_stAngleVector,xTemp);
}
// Y
if (MTH_M_bLess(xTemp=MTH3D_M_xGetYofVector(p_stRotationVector),MTH_C_ZERO))
{
MTH3D_M_vSetYofVector(p_stRotationVector,MTH_M_xNeg(xTemp));
xTemp=MTH3D_M_xGetYofVector(p_stAngleVector);
while (MTH_M_bLess(xTemp,MTH3D_M_xGetYofVector(p_stAimAngleVector)))
{
xTemp=MTH_M_xAdd(xTemp,MTH_C_2Pi);
}
MTH3D_M_vSetYofVector(p_stAngleVector,xTemp);
}
else
{
xTemp=MTH3D_M_xGetYofVector(p_stAngleVector);
while (MTH_M_bGreater(xTemp,MTH3D_M_xGetYofVector(p_stAimAngleVector)))
{
xTemp=MTH_M_xSub(xTemp,MTH_C_2Pi);
}
MTH3D_M_vSetYofVector(p_stAngleVector,xTemp);
}
// Z
if (MTH_M_bLess(xTemp=MTH3D_M_xGetZofVector(p_stRotationVector),MTH_C_ZERO))
{
MTH3D_M_vSetZofVector(p_stRotationVector,MTH_M_xNeg(xTemp));
xTemp=MTH3D_M_xGetZofVector(p_stAngleVector);
while (MTH_M_bLess(xTemp,MTH3D_M_xGetZofVector(p_stAimAngleVector)))
{
xTemp=MTH_M_xAdd(xTemp,MTH_C_2Pi);
}
MTH3D_M_vSetZofVector(p_stAngleVector,xTemp);
}
else
{
xTemp=MTH3D_M_xGetZofVector(p_stAngleVector);
if (MTH_M_bGreater(xTemp,MTH3D_M_xGetZofVector(p_stAimAngleVector)))
{
xTemp=MTH_M_xSub(xTemp,MTH_C_2Pi);
}
MTH3D_M_vSetZofVector(p_stAngleVector,xTemp);
}
}
*/
unsigned char fn_ucIsThereFloatIfYesConvertItToInteger(tdstGetSetParam *p_stParam)
{
unsigned char ucIsThereFloat=(unsigned char) M_IsFloatType(p_stParam);
if (ucIsThereFloat)
{
long lValue;
if((M_GetSetParam_xValue(p_stParam)<MTH_C_MAX_LONG)&&
(M_GetSetParam_xValue(p_stParam)>(-MTH_C_MAX_LONG)))/*AR980325 Antibug U64*/
lValue=MTH_M_xRealToLong(M_GetSetParam_xValue(p_stParam));
else if (M_GetSetParam_xValue(p_stParam)>0)
lValue=MTH_C_MAX_LONG;
else
lValue=-MTH_C_MAX_LONG;
M_Full_GetSetParam_Integer(p_stParam,lValue);
}
return(ucIsThereFloat);
}
unsigned char fn_ucAreThereFloatIfYesConvertThem(tdstGetSetParam *p_stParam1,tdstGetSetParam *p_stParam2)
{
unsigned char ucIsThereFloat=(unsigned char) M_IsFloatType(p_stParam1);
if (ucIsThereFloat)
{
if (!M_IsFloatType(p_stParam2))
{
M_GetSetParam_xValue(p_stParam2)=MTH_M_xLongToReal(M_GetSetParam_lValue(p_stParam2)) ;
}
}
else
{
ucIsThereFloat=(unsigned char) M_IsFloatType(p_stParam2);
if (ucIsThereFloat)
{
M_GetSetParam_xValue(p_stParam1)=MTH_M_xLongToReal(M_GetSetParam_lValue(p_stParam1));
}
}
return(ucIsThereFloat);
}
#if defined(__DEBUG_AI__)
char *fn_szGetPersoName(HIE_tdxHandleToSuperObject hPerso)
{
return AI_M_szGetPersoName(AI_M_stGetMindOfSuperObj(hPerso));
}
#endif
/*************************************************************************************
* Set the position of p_SuperObjPerso to p_stVertex. Make the mecanic collision test.
**************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool fn_bSetPositionWithCollideTest(HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH3D_tdstVector *p_stVertex)
{
/* MS_tdxHandleToDynam h_Dynam;
DNM_tdstDynamics *p_stDynamics;
if((h_Dynam = M_GetMSHandle(p_SuperObjPerso,Dynam)) == NULL )
return FALSE;
if((p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam)) == NULL)
return FALSE;*/
/* Break the son-father link.*/
fn_vReputCharacterSuperObjectAtTheWorld(p_SuperObjPerso);
/* Set the new position*/
POS_fn_vSetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),p_stVertex);
POS_fn_vSetTranslationVector(HIE_fn_hGetSuperObjectMatrix(p_SuperObjPerso),p_stVertex);
/* DNM_fn_vDynamicsSetFromHiePositionByTakingIntoAccountTheObstaclesOfTheWayCoveredByTheObject(p_stDynamics, p_SuperObjPerso);*/
/* LRM_fn_xBoolInitListOfRequests(fn_pDynamGetListOfRequests(h_Dynam));*/
return TRUE;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ANNECY BBB { parti dans GAM\actions\Dynam.c*/
/********************************************************************************************
* Set the position of p_SuperObjPerso to p_stVertex. Do not make the mecanic collision test.
*********************************************************************************************/
/*ACP_tdxBool fn_bSetPositionWithoutCollideTest(HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH3D_tdstVector *p_stVertex)*/
/*ANNECY BBB } parti dans GAM\actions\Dynam.c*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char fn_bGethDynamAndMACDPIDPointers(HIE_tdxHandleToSuperObject p_SuperObjPerso, MS_tdxHandleToDynam *p_h_Dynam, tdstMACDPID **p_p_stMACDPID)
{
DNM_tdstDynamics *p_stDynamics;
if((*p_h_Dynam = M_GetMSHandle(p_SuperObjPerso,Dynam)) != NULL )
{
if((p_stDynamics = fn_p_stDynamGetDynamics(*p_h_Dynam)) != NULL)
{
*p_p_stMACDPID = DNM_M_p_stDynamicsGetExternalDatas(p_stDynamics);
return(TRUE);
}
}
return(FALSE);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
unsigned char fn_ucInternalTurn(HIE_tdxHandleToSuperObject p_SuperObjPerso,MTH_tdxReal xAngle)
{
struct DNM_stDynamics* pstDynamic;
MS_tdxHandleToDynam h_Dynam;
/* Get Dynamics structure*/
h_Dynam = M_GetMSHandle(p_SuperObjPerso,Dynam);
if (h_Dynam)
{
pstDynamic = fn_p_stDynamGetDynamics(h_Dynam);
if (pstDynamic)
{
MEC_vTurnAroundZAxis ( pstDynamic, xAngle );
return TRUE;
}
}
return FALSE;
}
void fn_vConvertParamToColor(struct tdstGetSetParam_ *p_stParam,struct GEO_tdstColor_ *p_stColor)
{
/* don't use MTH because this is real float*/
float lValue;
float fValue=0.0f;
float fFactor=0.01f;
lValue=M_GetSetParam_RedValue(p_stParam);
if (lValue<0) fValue=0.0f; else if (lValue>100) fValue=1.0f; else fValue=lValue*fFactor;
p_stColor->xR=fValue;
lValue=M_GetSetParam_GreenValue(p_stParam);
if (lValue<0) fValue=0.0f; else if (lValue>100) fValue=1.0f; else fValue=lValue*fFactor;
p_stColor->xG=fValue;
lValue=M_GetSetParam_BlueValue(p_stParam);
if (lValue<0) fValue=0.0f; else if (lValue>100) fValue=1.0f; else fValue=lValue*fFactor;
p_stColor->xB=fValue;
lValue=M_GetSetParam_AlphaValue(p_stParam);
if (lValue<0) fValue=0.0f; else if (lValue>100) fValue=1.0f; else fValue=lValue*fFactor;
p_stColor->xA=fValue;
}
void fn_vConvertColorToParam(struct GEO_tdstColor_ *p_stColor,struct tdstGetSetParam_ *p_stParam)
{
M_GetSetParam_RedValue(p_stParam) =(unsigned char) (100*p_stColor->xR);
M_GetSetParam_GreenValue(p_stParam) =(unsigned char) (100*p_stColor->xG);
M_GetSetParam_BlueValue(p_stParam) =(unsigned char) (100*p_stColor->xB);
M_GetSetParam_AlphaValue(p_stParam) =(unsigned char) (100*p_stColor->xA);
M_GetSetParam_Type(p_stParam)=E_vt_Color;
}

View File

@@ -0,0 +1,188 @@
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "ActParam.h"
#include "Action.h"
#include "Intell.h"
#include "WPWayPt.h"
#include "specif/AITools.h"
#include "Procedur.h"
#include "EnumProc.h"
#include "safe.h"
/*
*=================================================================================================
*=================================================================================================
*/
tdstNodeInterpret *fn_p_stExecuteActionInit(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdxHandleToState h_WantedState;
p_stTree = fn_p_stDefaultActionInit(p_SuperObjPerso, p_stTree);
h_WantedState = fn_xGetActionParamStateValue(0, p_SuperObjPerso);
/* Force the state to be changed by setting it with a dummy value */
fn_v3dDataSetFirstStateOfAction(M_GetMSHandle(p_SuperObjPerso,3dData), NULL);
#if defined(__DEBUG_AI__)
if (!PLA_fn_bSetNewState(p_SuperObjPerso, h_WantedState, FALSE,FALSE))
{
fn_vSetActionParamlValue(0, p_SuperObjPerso, 0);
}
else
{
fn_vSetActionParamlValue(0, p_SuperObjPerso, 1);
}
#else
fn_vSetActionParamlValue(0, p_SuperObjPerso, (long) (PLA_fn_bSetNewState(p_SuperObjPerso, h_WantedState, FALSE,FALSE) ) );
#endif
/* Put the action in the stack parameters */
fn_vSetActionParamStateValue(1, p_SuperObjPerso, h_WantedState);
return(p_stTree);
}
/*===============================================================================================*/
tducActionReturn fn_ucExecuteAction(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
tdxHandleToState h_WantedState = fn_xGetActionParamStateValue(1, p_SuperObjPerso);
/* Test if SetNewState has work */
if (fn_lGetActionParamlValue(0, p_SuperObjPerso) == 0)
return C_DefaultMetaActionFinished;
/* Test if this the same action */
if (!PLA_fn_bTestCurrentAction(p_SuperObjPerso, h_WantedState))
{
#if defined(__DEBUG_AI__)
char MyMsg[100];
sprintf(MyMsg,"");
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningExecuteActionInt, C_ucErmNoOpenInfoWindow,MyMsg);
#endif
return C_DefaultMetaActionFinished;
}
/* Test if animation is finished */
if (PLA_fn_bTestIfEndOfAction(p_SuperObjPerso))
return C_DefaultMetaActionFinished;
return C_DefaultMetaActionNotFinished;
}
/*
*=================================================================================================
*=================================================================================================
*/
#ifdef D_USE_LIPSYNC
tdstNodeInterpret *fn_p_stSpeakAndWaitEndInit(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
p_stTree = fn_p_stDefaultActionInit(p_SuperObjPerso,p_stTree);
if(fn_bIsDiscussionOver(p_SuperObjPerso))
{
fn_vStartLipsSynchro(p_SuperObjPerso,fn_p_stGetActionParamhLipsSynchro(0, p_SuperObjPerso));
}
return p_stTree;
}
#endif /* D_USE_LIPSYNC*/
/*===============================================================================================*/
#ifdef D_USE_LIPSYNC
tducActionReturn fn_ucSpeakAndWaitEnd(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
if(fn_bIsDiscussionOver(p_SuperObjPerso))
return C_DefaultMetaActionFinished;
return C_DefaultMetaActionNotFinished;
}
#endif /* D_USE_LIPSYNC*/
/*
*=================================================================================================
*=================================================================================================
*/
tducActionReturn fn_ucWaitEndOfAction(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
if (PLA_fn_bTestIfEndOfAction(p_SuperObjPerso))
return C_DefaultMetaActionFinished;
return C_DefaultMetaActionNotFinished;
}
/*
*=================================================================================================
*=================================================================================================
*/
tducActionReturn fn_ucWaitEndOfAnim(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
if (PLA_fn_bTestIfEndOfAnim(p_SuperObjPerso))
return C_DefaultMetaActionFinished;
return C_DefaultMetaActionNotFinished;
}
/*
*=================================================================================================
*=================================================================================================
*/
#define D_FrozenWaitWarn 0
#define D_FrozenWaitForce 0
tdstNodeInterpret *fn_p_stFrozenWaitInit(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/* read the meta-action arguments */
p_stTree = fn_p_stDefaultActionInit(p_SuperObjPerso,p_stTree);
#if D_FrozenWaitWarn && defined(ACTIVE_EDITOR)
SAF_M_AssertWithMsg(
( fn_uc3dDataGetBrainComputationFrequency(M_GetMSHandle(p_SuperObjPerso,3dData)) == 1 )
|| M_IsTheEndOfTree(p_stTree)
||
(
( M_GetTypeInterpret(p_stTree) == E_ti_Procedure )
&&
(
( M_eProcedureIdInterpret(p_stTree) == eProc_ChangeMyComportAndMyReflex )
|| ( M_eProcedureIdInterpret(p_stTree) == ( AI_M_bGetDoingIntel(AI_M_stGetMindOfSuperObj(p_SuperObjPerso)) ? eProc_ChangeMyComport : eProc_ChangeMyComportReflex ) )
)
),
"il est fortement d<>conseill<6C> d'appeler cette m<>ta-action <20> l'int<6E>rieur d'un comportement\n"
"dans une IA qui n'est pas trait<69>e toutes les trames!"
);
#endif
#if D_FrozenWaitForce
/* remember the AI computation frequency */
fn_vSetActionParamlValue(
1,
p_SuperObjPerso,
fn_uc3dDataGetBrainComputationFrequency(M_GetMSHandle(p_SuperObjPerso,3dData))
);
/* and force it to 1, to make sure the meta action does not last longer than planned */
fn_v3dDataSetBrainComputationFrequency(M_GetMSHandle(p_SuperObjPerso,3dData), 1) ;
#endif
/*remember the time at which the metaaction is to end*/
fn_vSetActionParamlValue(
0,
p_SuperObjPerso,
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount + fn_lGetActionParamlValue(0, p_SuperObjPerso)
);
return p_stTree;
}
/*===============================================================================================*/
tducActionReturn fn_ucFrozenWait(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
tducActionReturn ucReturn ;
/*the meta action ends when the time is later than the specified one*/
ucReturn = (g_stEngineStructure.stEngineTimer.ulCurrentTimerCount < (unsigned long) fn_lGetActionParamlValue(0, p_SuperObjPerso))
? C_DefaultMetaActionNotFinished
: C_DefaultMetaActionFinished ;
#if D_FrozenWaitForce
/* if it is over, restore the brain computation frequency */
if ( ucReturn == C_DefaultMetaActionFinished )
{
fn_v3dDataSetBrainComputationFrequency(M_GetMSHandle(p_SuperObjPerso,3dData), fn_lGetActionParamlValue(1, p_SuperObjPerso)) ;
}
#endif
return ucReturn ;
}

View File

@@ -0,0 +1,733 @@
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
extern
#ifdef _DEBUG
"C"
#endif
unsigned long fn_ulDetermineUsefulDT();
#define D_CineInfo_StructureDefine
#include "AIUseCPA.h"
#include "AIMacros.h"
#include "StrIntel.h"
#include "Intell.h"
#include "ActParam.h"
#include "Action.h"
#include "Convert.h"
#include "EnumAct.h"
#include "Gam.h"
#include "specif/AITools.h"
#include "CAM_Base.h"
#include "CAM_Tool.h"
/*
*=================================================================================================
*=================================================================================================
*/
void fnv_MoveAToB
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
MTH3D_tdstVector *_p_stSource,
MTH3D_tdstVector *_p_stDest,
MTH3D_tdstVector *_p_stCurrent,
int _iTime,
int _iAccel
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH_tdxReal xDist, xActDist, xSpeed, xTemp;
long lTime;
MTH3D_tdstVector stTempVector;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* Total dist to move */
MTH3D_M_vSubVector(&stTempVector, _p_stDest, _p_stSource);
xDist = MTH3D_M_xNormVector(&stTempVector);
/* Dist already moved */
MTH3D_M_vSubVector(&stTempVector, _p_stCurrent, _p_stSource);
xActDist = MTH3D_M_xNormVector(&stTempVector);
/* Max speed depending on total time and distance */
xSpeed = MTH_M_xDiv(xDist, MTH_M_xLongToReal(_iTime));
/* Time elapsed since beginning */
lTime = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount - fn_lGetActionParamlValue(5, p_SuperObjPerso);
/* Accel */
if(lTime < _iAccel)
{
xSpeed = MTH_M_xMul(MTH_M_xDiv(xSpeed, MTH_M_xLongToReal(_iAccel)), lTime);
}
/* Decel */
if(lTime > _iTime - _iAccel)
{
xTemp = MTH_M_xMul(MTH_M_xLongToReal(lTime), -MTH_M_xDiv(xSpeed, MTH_M_xLongToReal(_iAccel)));
xSpeed = MTH_M_xAdd(xTemp, MTH_M_xDiv(MTH_M_xMul(MTH_M_xLongToReal(_iTime), xSpeed), MTH_M_xFloatToReal(_iAccel)));
}
/* New pos */
MTH3D_M_vSubVector(&stTempVector, _p_stDest, _p_stSource);
MTH3D_M_vNormalizeVector(&stTempVector, &stTempVector);
xSpeed = MTH_M_xMul(xSpeed, fn_ulDetermineUsefulDT());
MTH3D_M_vMulScalarVector(&stTempVector, xSpeed, &stTempVector);
MTH3D_M_vAddVector(_p_stDest, &stTempVector, _p_stCurrent);
}
/*
*=================================================================================================
*=================================================================================================
*/
void fnv_TurnAWithB
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
MTH3D_tdstVector *_p_stSource,
MTH3D_tdstVector *_p_stPointAxis,
MTH3D_tdstVector *_p_stAxis,
MTH3D_tdstVector *_p_stCurrent,
MTH_tdxReal _xAngle,
int _iTime,
int _iAccel
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH_tdxReal xActAngle, xSpeed, xTemp;
long lTime;
MTH3D_tdstVector stTempVector, stTempVector1;
MTH_tdstRotation stRotation;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* Angle already move */
MTH3D_M_vSubVector(&stTempVector, _p_stCurrent, _p_stPointAxis);
CAM_fn_vComputeProjection(&stTempVector, &stTempVector, _p_stAxis);
MTH3D_M_vSubVector(&stTempVector1, _p_stSource, _p_stPointAxis);
CAM_fn_vComputeProjection(&stTempVector1, &stTempVector1, _p_stAxis);
xActAngle = CAM_fn_xComputeRotation(&stTempVector1, &stTempVector, NULL);
/* Max speed depending on total time and distance */
xSpeed = MTH_M_xDiv(_xAngle, MTH_M_xLongToReal(_iTime));
/* Time elapsed since beginning */
lTime = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount - fn_lGetActionParamlValue(5, p_SuperObjPerso);
/* Accel */
if(lTime < _iAccel)
{
xSpeed = MTH_M_xMul(MTH_M_xDiv(xSpeed, MTH_M_xLongToReal(_iAccel)), lTime);
}
/* Decel */
if(lTime > _iTime - _iAccel)
{
xTemp = MTH_M_xMul(MTH_M_xLongToReal(lTime), -MTH_M_xDiv(xSpeed, MTH_M_xLongToReal(_iAccel)));
xSpeed = MTH_M_xAdd(xTemp, MTH_M_xDiv(MTH_M_xMul(MTH_M_xLongToReal(_iTime), xSpeed), MTH_M_xFloatToReal(_iAccel)));
}
/* New pos */
MTH3D_M_vCopyVector(&stRotation.m_stAxis, _p_stAxis);
xSpeed = MTH_M_xMul(xSpeed, fn_ulDetermineUsefulDT());
stRotation.m_xAngle = xSpeed;
MTH3D_M_vSubVector(&stTempVector, _p_stCurrent, _p_stPointAxis);
MTH_p_stRotationMulVector(&stRotation, &stTempVector, _p_stSource);
MTH3D_M_vAddVector(_p_stSource, _p_stSource, _p_stPointAxis);
}
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *fn_p_stCamCineInit(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
MTH3D_tdstVector stTempVector;
enum tdeMetaActionId_ eMetaActionId = M_eMetaActionIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* No meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits |= 0x8000;
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
switch(eMetaActionId)
{
case eMetaAction_CamCineMoveAToBTgtC:
case eMetaAction_CamCineMoveAToBTgtAC:
case eMetaAction_CamCinePosAMoveTgtBToC:
M_EvalNextParameter(&stParam);
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamp_stVertex(1, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamp_stVertex(2, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamlValue(3, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamlValue(4, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
fn_vSetActionParamlValue(5, p_SuperObjPerso, g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
if(eMetaActionId == eMetaAction_CamCinePosAMoveTgtBToC)
{
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
/* To remember actual target */
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
}
else
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), &stTempVector);
break;
case eMetaAction_CamCinePosATgtB:
M_EvalNextParameter(&stParam);
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamp_stVertex(1, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamlValue(2, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
fn_vSetActionParamlValue(3, p_SuperObjPerso, g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
break;
case eMetaAction_CamCinePosATgtBTurnPosH:
case eMetaAction_CamCinePosATgtBTurnTgtH:
case eMetaAction_CamCinePosATgtBTurnPosV:
case eMetaAction_CamCinePosATgtBTurnTgtV:
M_EvalNextParameter(&stParam);
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamp_stVertex(1, p_SuperObjPerso, &M_GetSetParam_stVertexValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamxValue(2, p_SuperObjPerso, M_GetSetParam_xValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamlValue(3, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
M_EvalNextParameter(&stParam);
fn_vSetActionParamlValue(4, p_SuperObjPerso, M_ReturnParam_lValue(&stParam));
fn_vSetActionParamlValue(5, p_SuperObjPerso, g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
if((eMetaActionId == eMetaAction_CamCinePosATgtBTurnTgtH) || (eMetaActionId == eMetaAction_CamCinePosATgtBTurnTgtV))
{
/* To remember actual target */
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
}
break;
default:
break;
}
return p_stTree;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tducActionReturn fn_ucCamCineMoveAToBTgtC(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
MTH3D_tdstVector stTempVector, stCurrentCameraPos;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* Test end of meta action */
if
(
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
)
{
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), &stTempVector);
/* Meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
return C_DefaultMetaActionFinished;
}
/* Actual camera pos */
POS_fn_vGetTranslationVector
(
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
&stCurrentCameraPos
);
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
fnv_MoveAToB
(
p_SuperObjPerso,
fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso),
&stTempVector,
&stCurrentCameraPos,
fn_lGetActionParamlValue(3, p_SuperObjPerso),
fn_lGetActionParamlValue(4, p_SuperObjPerso)
);
CAM_fn_vForceCameraPos(p_SuperObjPerso, &stTempVector);
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), &stTempVector);
return C_DefaultMetaActionNotFinished;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tducActionReturn fn_ucCamCineMoveAToBTgtAC(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
MTH3D_tdstVector stTempVector, stTempVector1, stCurrentCameraPos;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* Test end of meta action */
if
(
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
)
{
CAM_fn_vForceCameraPos(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
MTH3D_M_vSubVector(&stTempVector1, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
MTH3D_M_vAddVector(&stTempVector1, &stTempVector1, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector1, &stTempVector);
/* Meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
return C_DefaultMetaActionFinished;
}
/* Actual camera pos */
POS_fn_vGetTranslationVector
(
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
&stCurrentCameraPos
);
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
fnv_MoveAToB
(
p_SuperObjPerso,
fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso),
&stTempVector,
&stCurrentCameraPos,
fn_lGetActionParamlValue(3, p_SuperObjPerso),
fn_lGetActionParamlValue(4, p_SuperObjPerso)
);
CAM_fn_vForceCameraPos(p_SuperObjPerso, &stTempVector);
MTH3D_M_vSubVector(&stTempVector1, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
MTH3D_M_vAddVector(&stTempVector1, &stTempVector1, &stTempVector);
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector1, &stTempVector);
return C_DefaultMetaActionNotFinished;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tducActionReturn fn_ucCamCinePosATgtB(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* Test end of meta action */
if
(
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
((unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(2, p_SuperObjPerso))
)
{
/* Meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
return C_DefaultMetaActionFinished;
}
return C_DefaultMetaActionNotFinished;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tducActionReturn fn_ucCamCinePosAMoveTgtBToC(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
MTH3D_tdstVector stTempVector, stTempVector1, stCurrentTarget;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* Test end of meta action */
if
(
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
)
{
MTH3D_M_vSetVectorElements(&stTempVector1, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso), &stTempVector1);
/* Meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
return C_DefaultMetaActionFinished;
}
/* Current target */
MTH3D_M_vCopyVector(&stCurrentTarget, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(2,p_SuperObjPerso));
fnv_MoveAToB
(
p_SuperObjPerso,
fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso),
&stTempVector,
&stCurrentTarget,
fn_lGetActionParamlValue(3, p_SuperObjPerso),
fn_lGetActionParamlValue(4, p_SuperObjPerso)
);
MTH3D_M_vSetVectorElements(&stTempVector1, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector, &stTempVector1);
/* Remember actual target */
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &stTempVector);
return C_DefaultMetaActionNotFinished;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tducActionReturn fn_ucCamCinePosATgtBTurnPosH(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
MTH3D_tdstVector stTempVector, stCurrentCameraPos, stAxis;
POS_tdstCompletePosition *p_stPersoGlobalMatrix;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* Test end of meta action */
if
(
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
)
{
/* Meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
return C_DefaultMetaActionFinished;
}
/* Actual camera pos */
POS_fn_vGetTranslationVector
(
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
&stCurrentCameraPos
);
/* Rotation axis is camera Z */
p_stPersoGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso);
POS_fn_vGetRotationMatrix(p_stPersoGlobalMatrix, &stTempVector, &stTempVector, &stAxis);
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
fnv_TurnAWithB
(
p_SuperObjPerso,
&stTempVector,
fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso),
&stAxis,
&stCurrentCameraPos,
fn_xGetActionParamxValue(2, p_SuperObjPerso),
fn_lGetActionParamlValue(3, p_SuperObjPerso),
fn_lGetActionParamlValue(4, p_SuperObjPerso)
);
CAM_fn_vForceCameraPos(p_SuperObjPerso, &stTempVector);
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
return C_DefaultMetaActionNotFinished;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tducActionReturn fn_ucCamCinePosATgtBTurnPosV(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
MTH3D_tdstVector stTempVector, stCurrentCameraPos, stAxis;
POS_tdstCompletePosition *p_stPersoGlobalMatrix;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* Test end of meta action */
if
(
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
)
{
/* Meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
return C_DefaultMetaActionFinished;
}
/* Actual camera pos */
POS_fn_vGetTranslationVector
(
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
&stCurrentCameraPos
);
/* Rotation axis is camera X */
p_stPersoGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso);
POS_fn_vGetRotationMatrix(p_stPersoGlobalMatrix, &stAxis, &stTempVector, &stTempVector);
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso));
fnv_TurnAWithB
(
p_SuperObjPerso,
&stTempVector,
fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso),
&stAxis,
&stCurrentCameraPos,
fn_xGetActionParamxValue(2, p_SuperObjPerso),
fn_lGetActionParamlValue(3, p_SuperObjPerso),
fn_lGetActionParamlValue(4, p_SuperObjPerso)
);
CAM_fn_vForceCameraPos(p_SuperObjPerso, &stTempVector);
MTH3D_M_vSetVectorElements(&stTempVector, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso), &stTempVector);
return C_DefaultMetaActionNotFinished;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tducActionReturn fn_ucCamCinePosATgtBTurnTgtH(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
MTH3D_tdstVector stCurrentCameraPos, stTempVector, stTempVector1, stAxis;
POS_tdstCompletePosition *p_stPersoGlobalMatrix;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* Test end of meta action */
if
(
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
)
{
/* Meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
return C_DefaultMetaActionFinished;
}
/* Actual camera pos */
POS_fn_vGetTranslationVector
(
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
&stCurrentCameraPos
);
/* Rotation axis is camera Z */
p_stPersoGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso);
POS_fn_vGetRotationMatrix(p_stPersoGlobalMatrix, &stTempVector, &stTempVector, &stAxis);
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
fnv_TurnAWithB
(
p_SuperObjPerso,
&stTempVector,
&stCurrentCameraPos,
&stAxis,
fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso),
fn_xGetActionParamxValue(2, p_SuperObjPerso),
fn_lGetActionParamlValue(3, p_SuperObjPerso),
fn_lGetActionParamlValue(4, p_SuperObjPerso)
);
MTH3D_M_vSetVectorElements(&stTempVector1, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector, &stTempVector1);
/* Remember actual target */
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &stTempVector);
return C_DefaultMetaActionNotFinished;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tducActionReturn fn_ucCamCinePosATgtBTurnTgtV(HIE_tdxHandleToSuperObject p_SuperObjPerso)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo hCineinfo;
MTH3D_tdstVector stCurrentCameraPos, stTempVector, stTempVector1, stAxis;
POS_tdstCompletePosition *p_stPersoGlobalMatrix;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hCineinfo = M_GetMSHandle(p_SuperObjPerso, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* Test end of meta action */
if
(
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount >=
((unsigned long) fn_lGetActionParamlValue(5, p_SuperObjPerso)+(unsigned long) fn_lGetActionParamlValue(3, p_SuperObjPerso))
)
{
/* Meca */
M_GetMSHandle(p_SuperObjPerso, StandardGame)->ulCustomBits &= ~0x8000;
return C_DefaultMetaActionFinished;
}
/* Actual camera pos */
POS_fn_vGetTranslationVector
(
HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso),
&stCurrentCameraPos
);
/* Rotation axis is camera X */
p_stPersoGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(p_SuperObjPerso);
POS_fn_vGetRotationMatrix(p_stPersoGlobalMatrix, &stAxis, &stTempVector, &stTempVector);
MTH3D_M_vCopyVector(&stTempVector, fn_p_stGetActionParamp_stVertex(1,p_SuperObjPerso));
fnv_TurnAWithB
(
p_SuperObjPerso,
&stTempVector,
&stCurrentCameraPos,
&stAxis,
fn_p_stGetActionParamp_stVertex(0,p_SuperObjPerso),
fn_xGetActionParamxValue(2, p_SuperObjPerso),
fn_lGetActionParamlValue(3, p_SuperObjPerso),
fn_lGetActionParamlValue(4, p_SuperObjPerso)
);
MTH3D_M_vSetVectorElements(&stTempVector1, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
CAM_fn_vForceCameraTgt(p_SuperObjPerso, &stTempVector, &stTempVector1);
/* Remember actual target */
fn_vSetActionParamp_stVertex(0, p_SuperObjPerso, &stTempVector);
return C_DefaultMetaActionNotFinished;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
#ifndef __CAM_BASE_H__
#define __CAM_BASE_H__
extern char cLastCutAngleSens;
extern char cJustBetterPos;
/*
*************************************************************************************************
*************************************************************************************************
*************************************************************************************************
*************************************************************************************************
*/
/*
* Structure to update position of camera.
* The fileds of that structure are passed to meca parsing.
*/
typedef struct CAM_tdstComputedPosition_
{
MTH3D_tdstVector stTarget;
MTH3D_tdstVector stMovePos;
MTH3D_tdstVector stRefAxisZ;
MTH_tdxReal xLinearSpeed;
MTH_tdxReal xAngularSpeed;
MTH_tdxReal xTargetSpeed;
} CAM_tdstComputedPosition;
/*
* Structure to use for update actions of camera.
*/
typedef struct CAM_tdstUpdateCamera_
{
DNM_tdstReport *p_stReport;
DNM_tdstDynamics *p_stDynamics;
MS_tdxHandleToCineinfo hCineinfo;
MS_tdxHandleToInternalCineinfo hCineinfoWork;
MS_tdxHandleToInternalCineinfo hCineinfoCurrent;
MS_tdxHandleToInternalCineinfo hCineinfoInit;
MS_tdxHandleToInternalCineinfo hCineinfoVisibility;
HIE_tdxHandleToSuperObject hSuperObjCamera;
MTH3D_tdstVector stCurrentCameraPos;
MTH3D_tdstVector stWantedCameraPos;
MTH3D_tdstVector stRealWantedCameraPos;
MTH3D_tdstVector stTargetedPersoRealPos;
MTH3D_tdstVector stTargetedPersoPos;
MTH3D_tdstVector stSecondTargetedPersoRealPos;
MTH3D_tdstVector stSecondTargetedPersoPos;
char cHasCutAlpha;
MTH_tdxReal xAngleAlphaCut;
MTH_tdxReal xAngleDeltaAlphaCut;
char cTgtPersoIsMovingAbsolute;
MTH3D_tdstVector stTgtPersoMoveAbsolute;
char cTgtPersoIsMovingRelative;
MTH3D_tdstVector stTgtPersoMoveRelative;
CAM_tdstComputedPosition stCptPos;
} CAM_tdstUpdateCamera;
/*
*************************************************************************************************
*************************************************************************************************
*************************************************************************************************
*************************************************************************************************
*/
#define CONSTANT_CUT_COL (CAM_g_stCameraConstants.wFlags & 0x0001)
#define CONSTANT_RESETTEMP (CAM_g_stCameraConstants.wFlags & 0x0002)
#define CONSTANT_FORCEBESTPOS (CAM_g_stCameraConstants.wFlags & 0x0004)
#define CONSTANT_NOVISPROJ (CAM_g_stCameraConstants.wFlags & 0x0008)
#define CONSTANT_NORMALIFJOIN (CAM_g_stCameraConstants.wFlags & 0x0010)
#define CONSTANT_NOBETTERPOS (CAM_g_stCameraConstants.wFlags & 0x0020)
#define CONSTANT_NODISTVIS (CAM_g_stCameraConstants.wFlags & 0x0040)
/*
*************************************************************************************************
*************************************************************************************************
*************************************************************************************************
*************************************************************************************************
*/
extern void CAM_fn_vComputeRefAxis(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void CAM_fn_vComputeTargetedPersoPos(CAM_tdstUpdateCamera *, HIE_tdxHandleToSuperObject, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern void CAM_fn_vComputeReferencePoint(CAM_tdstUpdateCamera *);
extern void CAM_fn_vDynChangeTarget(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void CAM_fn_vComputeTarget(CAM_tdstUpdateCamera *);
extern void CAM_fn_vBoundAngleWithTolerance(CAM_tdstUpdateCamera *, MTH_tdxReal *, MTH_tdxReal *, MTH_tdxReal *, MTH_tdxReal, MTH_tdxReal);
extern void CAM_fn_vComputeCameraAxisAngles(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH3D_tdstVector *, MTH_tdxReal *, MTH_tdxReal *);
extern void CAM_fn_vRotateCameraAxis( MTH3D_tdstVector *, MTH_tdxReal, MTH_tdxReal, MTH3D_tdstVector *);
extern void CAM_fn_vComputeRealWantedPos(CAM_tdstUpdateCamera *);
extern char CAM_fn_cDynChangeTheta(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void CAM_fn_vTakeCareOfCameraAltitude(MS_tdxHandleToCineinfo, MTH3D_tdstVector *);
extern void CAM_fn_vComputeMovePos(CAM_tdstUpdateCamera *);
extern void CAM_fn_vComputeMovePosWithDynTheta(CAM_tdstUpdateCamera *);
extern void CAM_fn_vComputeSpeed(CAM_tdstUpdateCamera *);
extern void CAM_fn_vConstraintMoveAfterVisFailure(CAM_tdstUpdateCamera *);
extern void CAM_fn_vConstraintMove(CAM_tdstUpdateCamera *);
extern void CAM_fn_vUpdateGeneralCamera(CAM_tdstUpdateCamera *);
#endif /* __CAM_BASE_H__ */

View File

@@ -0,0 +1,184 @@
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
#define D_CineInfo_StructureDefine
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Intell.h"
#include "StrIntel.h"
#include "AI_Struc.h"
#include "EnumCond.h"
#include "Operator.h"
#include "Convert.h"
#include "CAM_Base.h"
#include "CAM_Tool.h"
#include "CAM_Vis.h"
/*
*=================================================================================================
* Is ... ?
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stIs(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
MS_tdxHandleToInternalCineinfo hIntCineInfo;
tdstGetSetParam stValue;
long lCurrentValue;
long lViewport;
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(&stValue);
lCurrentValue = M_GetSetParam_lValue(&stValue);
if (lCurrentValue == 1)
{
if (hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
{
hIntCineInfo = hCineInfo->hWork;
}
else
{
hIntCineInfo = hCineInfo->hCurrent;
}
}
else if(lCurrentValue == -1)
{
hIntCineInfo = hCineInfo->hInit;
}
else
{
if (hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
hIntCineInfo = hCineInfo->hVisibility;
else
hIntCineInfo = hCineInfo->hCurrent;
}
switch (eCondId)
{
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsActive :
*p_lValue=(long) hIntCineInfo->bIsActive;
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsViewportOwner :
M_EvalNextParameter(&stValue);
lViewport = M_GetSetParam_lValue(&stValue);
*p_lValue=(long) (lViewport == (long) hIntCineInfo->eTypeOfViewport);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoDynamicTarget :
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_NoDynamicTarget);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoAverageMoveTgtPerso:
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_NoAverageMoveTgtPerso);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoParseCutAngle :
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_NoParseCutAngle);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoVisibility :
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_NoVisibility);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoVisibilityWithDynHie :
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_NoVisibilityWithDynHie);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoDynChangeTheta :
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_NoDynChangeTheta);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoShiftUntilPosReached:
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_NoShiftUntilPosReached);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoDynSpeed:
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_NoDynSpeed);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoLinearParsing :
*p_lValue=(long) (hIntCineInfo->uwDNMFlags & DNM_CAM_C_NoLinearParsing);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoLinearInertia :
*p_lValue=(long) (hIntCineInfo->uwDNMFlags & DNM_CAM_C_NoLinearInertia);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoAngularParsing :
*p_lValue=(long) (hIntCineInfo->uwDNMFlags & DNM_CAM_C_NoAngularParsing);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoAngularInertia :
*p_lValue=(long) (hIntCineInfo->uwDNMFlags & DNM_CAM_C_NoAngularInertia);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoTargetParsing :
*p_lValue=(long) (hIntCineInfo->uwDNMFlags & DNM_CAM_C_NoTargetParsing);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoTargetInertia :
*p_lValue=(long) (hIntCineInfo->uwDNMFlags & DNM_CAM_C_NoTargetInertia);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagNoObstacle:
*p_lValue=(long) (hIntCineInfo->uwDNMFlags & DNM_CAM_C_NoObstacle);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagFixedOrientation :
*p_lValue=(long) (hIntCineInfo->uwDNMFlags & DNM_CAM_C_FixedOrientation);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagForcedTarget:
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_TargetIsAlreadyComputed);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eCond_Cam_IsFlagForcedAxis:
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_RefAxisIsAlreadyComputed);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eCond_Cam_IsFlagForcedPosition:
*p_lValue=(long) (hIntCineInfo->uwIAFlags & C_IAFlags_PositionIsAlreadyComputed);
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
default:
break;
}
M_AIFatalError(E_uwAIFatalNotValidCondition);
return p_stTree;
}

View File

@@ -0,0 +1,850 @@
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
#define D_CineInfo_StructureDefine
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Intell.h"
#include "StrIntel.h"
#include "AI_Struc.h"
#include "EnumFunc.h"
#include "Operator.h"
#include "Convert.h"
#include "CAM_Base.h"
#include "CAM_Tool.h"
#include "Cam_Vis.h"
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
* To retrieve a real.
* _lCurrentValue : -1 Initial
* 0 Actual current (current or visibility)
* 1 The actual one (current or work)
*=================================================================================================
*/
MTH_tdxReal CAM_fn_xGetARealParameter
(
MS_tdxHandleToCineinfo _hCineInfo,
MTH_tdxReal *_p_xInitialValue,
MTH_tdxReal *_p_xCurrentValue,
MTH_tdxReal *_p_xWorkValue,
MTH_tdxReal *_p_xVisValue,
long _lCurrentValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH_tdxReal xValue = MTH_C_ZERO;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if (_lCurrentValue == 1)
{
if (_hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
xValue = *_p_xWorkValue;
else
xValue = *_p_xCurrentValue;
}
else if (_lCurrentValue == -1)
{
xValue = *_p_xInitialValue;
}
else
{
if (_hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
xValue = *_p_xVisValue;
else
xValue = *_p_xCurrentValue;
}
return xValue;
}
/*
*=================================================================================================
* To retrieve a vector.
* _lCurrentValue : -1 Initial
* 0 Actual current (current or visibility)
* 1 The actual one (current or work)
*=================================================================================================
*/
MTH3D_tdstVector *CAM_fn_p_stGetAVectorParameter
(
MS_tdxHandleToCineinfo _hCineInfo,
MTH3D_tdstVector *_p_stInitialValue,
MTH3D_tdstVector *_p_stCurrentValue,
MTH3D_tdstVector *_p_stWorkValue,
MTH3D_tdstVector *_p_stVisValue,
long _lCurrentValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MTH3D_tdstVector *p_stValue = NULL;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if (_lCurrentValue == 1)
{
if (_hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
p_stValue = _p_stWorkValue;
else
p_stValue = _p_stCurrentValue;
}
else if (_lCurrentValue == -1)
{
p_stValue = _p_stInitialValue;
}
else
{
if (_hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
p_stValue = _p_stVisValue;
else
p_stValue = _p_stCurrentValue;
}
return p_stValue;
}
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
* Get a vector parameter.
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stGetVectorParameter(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
long lCurrentValue;
MTH3D_tdstVector *p_stInitialValue = NULL;
MTH3D_tdstVector *p_stCurrentValue = NULL;
MTH3D_tdstVector *p_stWorkValue = NULL;
MTH3D_tdstVector *p_stVisValue = NULL;
enum tdeFuncId_ eFuncId = M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(p_stValue);
lCurrentValue = M_GetSetParam_lValue(p_stValue);
switch(eFuncId)
{
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetShiftTarget:
p_stInitialValue = &(hCineInfo->hInit->stShiftTarget);
p_stCurrentValue = &(hCineInfo->hCurrent->stShiftTarget);
p_stWorkValue = &(hCineInfo->hWork->stShiftTarget);
p_stVisValue = &(hCineInfo->hVisibility->stShiftTarget);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetShiftPos:
p_stInitialValue = &(hCineInfo->hInit->stShiftPos);
p_stCurrentValue = &(hCineInfo->hCurrent->stShiftPos);
p_stWorkValue = &(hCineInfo->hWork->stShiftPos);
p_stVisValue = &(hCineInfo->hVisibility->stShiftPos);
break;
/*---------------------------------------------------------------------------------------*/
default:
break;
}
M_Full_GetSetParam_p_stVertex
(
p_stValue,
CAM_fn_p_stGetAVectorParameter
(
hCineInfo,
p_stInitialValue,
p_stCurrentValue,
p_stWorkValue,
p_stVisValue,
lCurrentValue
)
);
return(p_stTree);
}
/*
*=================================================================================================
* Get a Real Parameter.
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stGetRealParameter(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
long lCurrentValue;
MTH_tdxReal *p_xInitialValue = NULL;
MTH_tdxReal *p_xCurrentValue = NULL;
MTH_tdxReal *p_xWorkValue = NULL;
MTH_tdxReal *p_xVisValue = NULL;
enum tdeFuncId_ eFuncId = M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(p_stValue);
lCurrentValue = M_GetSetParam_lValue(p_stValue);
switch(eFuncId)
{
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetDistMin :
p_xInitialValue = &(hCineInfo->hInit->xDistMin);
p_xCurrentValue = &(hCineInfo->hCurrent->xDistMin);
p_xWorkValue = &(hCineInfo->hWork->xDistMin);
p_xVisValue = &(hCineInfo->hVisibility->xDistMin);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetDistMax :
p_xInitialValue = &(hCineInfo->hInit->xDistMax);
p_xCurrentValue = &(hCineInfo->hCurrent->xDistMax);
p_xWorkValue = &(hCineInfo->hWork->xDistMax);
p_xVisValue = &(hCineInfo->hVisibility->xDistMax);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetBoundDistMin :
p_xInitialValue = &(hCineInfo->hInit->xBoundDistMin);
p_xCurrentValue = &(hCineInfo->hCurrent->xBoundDistMin);
p_xWorkValue = &(hCineInfo->hWork->xBoundDistMin);
p_xVisValue = &(hCineInfo->hVisibility->xBoundDistMin);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetBoundDistMax :
p_xInitialValue = &(hCineInfo->hInit->xBoundDistMax);
p_xCurrentValue = &(hCineInfo->hCurrent->xBoundDistMax);
p_xWorkValue = &(hCineInfo->hWork->xBoundDistMax);
p_xVisValue = &(hCineInfo->hVisibility->xBoundDistMax);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngleAlpha :
p_xInitialValue = &(hCineInfo->hInit->xAngleAlpha);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleAlpha);
p_xWorkValue = &(hCineInfo->hWork->xAngleAlpha);
p_xVisValue = &(hCineInfo->hVisibility->xAngleAlpha);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngleShiftAlpha :
p_xInitialValue = &(hCineInfo->hInit->xAngleShiftAlpha);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleShiftAlpha);
p_xWorkValue = &(hCineInfo->hWork->xAngleShiftAlpha);
p_xVisValue = &(hCineInfo->hVisibility->xAngleShiftAlpha);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngleTheta :
p_xInitialValue = &(hCineInfo->hInit->xAngleTheta);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleTheta);
p_xWorkValue = &(hCineInfo->hWork->xAngleTheta);
p_xVisValue = &(hCineInfo->hVisibility->xAngleTheta);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngleShiftTheta :
p_xInitialValue = &(hCineInfo->hInit->xAngleShiftTheta);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngleShiftTheta);
p_xWorkValue = &(hCineInfo->hWork->xAngleShiftTheta);
p_xVisValue = &(hCineInfo->hVisibility->xAngleShiftTheta);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetLinearSpeed:
p_xInitialValue = &(hCineInfo->hInit->xLinearSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearSpeed);
p_xWorkValue = &(hCineInfo->hWork->xLinearSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xLinearSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetLinearIncreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xLinearIncreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearIncreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xLinearIncreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xLinearIncreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetLinearDecreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xLinearDecreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xLinearDecreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xLinearDecreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xLinearDecreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngularSpeed:
p_xInitialValue = &(hCineInfo->hInit->xAngularSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularSpeed);
p_xWorkValue = &(hCineInfo->hWork->xAngularSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xAngularSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngularIncreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xAngularIncreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularIncreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xAngularIncreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xAngularIncreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetAngularDecreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xAngularDecreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xAngularDecreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xAngularDecreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xAngularDecreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetTargetSpeed:
p_xInitialValue = &(hCineInfo->hInit->xTargetSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetSpeed);
p_xWorkValue = &(hCineInfo->hWork->xTargetSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xTargetSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetTargetIncreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xTargetIncreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetIncreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xTargetIncreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xTargetIncreaseSpeed);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetTargetDecreaseSpeed :
p_xInitialValue = &(hCineInfo->hInit->xTargetDecreaseSpeed);
p_xCurrentValue = &(hCineInfo->hCurrent->xTargetDecreaseSpeed);
p_xWorkValue = &(hCineInfo->hWork->xTargetDecreaseSpeed);
p_xVisValue = &(hCineInfo->hVisibility->xTargetDecreaseSpeed);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetFocal :
p_xInitialValue = &(hCineInfo->hInit->xFocal);
p_xCurrentValue = &(hCineInfo->hCurrent->xFocal);
p_xWorkValue = &(hCineInfo->hWork->xFocal);
p_xVisValue = &(hCineInfo->hVisibility->xFocal);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetZMin:
p_xInitialValue = &(hCineInfo->hInit->xZMin);
p_xCurrentValue = &(hCineInfo->hCurrent->xZMin);
p_xWorkValue = &(hCineInfo->hWork->xZMin);
p_xVisValue = &(hCineInfo->hVisibility->xZMin);
break;
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetZMax:
p_xInitialValue = &(hCineInfo->hInit->xZMax);
p_xCurrentValue = &(hCineInfo->hCurrent->xZMax);
p_xWorkValue = &(hCineInfo->hWork->xZMax);
p_xVisValue = &(hCineInfo->hVisibility->xZMax);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*---------------------------------------------------------------------------------------*/
default:
break;
}
M_Full_GetSetParam_Float
(
p_stValue,
CAM_fn_xGetARealParameter
(
hCineInfo,
p_xInitialValue,
p_xCurrentValue,
p_xWorkValue,
p_xVisValue,
lCurrentValue
)
);
return(p_stTree);
}
/*
*=================================================================================================
* Get Super Object Targeted.
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *CAM_fn_p_stGetTargetedSuperObject
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
HIE_tdxHandleToSuperObject hSuperObjectTargeted;
long lCurrentValue;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(p_stValue);
lCurrentValue = M_GetSetParam_lValue(p_stValue);
if (lCurrentValue == 1)
{
if (hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
hSuperObjectTargeted = hCineInfo->hWork->hSuperObjectTargeted;
else
hSuperObjectTargeted = hCineInfo->hCurrent->hSuperObjectTargeted;
}
else if(lCurrentValue == -1)
{
hSuperObjectTargeted = hCineInfo->hInit->hSuperObjectTargeted;
}
else
{
if (hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
hSuperObjectTargeted = hCineInfo->hVisibility->hSuperObjectTargeted;
else
hSuperObjectTargeted = hCineInfo->hCurrent->hSuperObjectTargeted;
}
M_Full_GetSetParam_Perso
(
p_stValue,
hSuperObjectTargeted
);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
* Get Type of Viewport.
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *CAM_fn_p_stGetTypeOfViewport
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
long lTypeOfViewport;
long lCurrentValue;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
M_EvalNextParameter(p_stValue);
lCurrentValue = M_GetSetParam_lValue(p_stValue);
if (lCurrentValue == 1)
{
if (hCineInfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
lTypeOfViewport = (long)(hCineInfo->hWork->eTypeOfViewport);
else
lTypeOfViewport = (long)(hCineInfo->hCurrent->eTypeOfViewport);
}
else if(lCurrentValue == -1)
{
lTypeOfViewport = (long)(hCineInfo->hInit->eTypeOfViewport);
}
else
{
if (hCineInfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)
lTypeOfViewport = (long)(hCineInfo->hVisibility->eTypeOfViewport);
else
lTypeOfViewport = (long)(hCineInfo->hCurrent->eTypeOfViewport);
}
M_Full_GetSetParam_Integer
(
p_stValue,
lTypeOfViewport
);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
* Get camera type in current camera sector.
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *CAM_fn_p_stGetSectorCameraType
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
long lType;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
MS_tdxHandleToSectInfo hCamCineinfo;
HIE_tdxHandleToSuperObject hCurrentSectorCamera;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCamCineinfo = M_GetMSHandle(hCamera, SectInfo);
hCurrentSectorCamera = fn_h_SectInfoGetCurrentSector(hCamCineinfo);
lType = (long) fn_cGetSectorCameraType(hCurrentSectorCamera);
M_Full_GetSetParam_Integer
(
p_stValue,
lType
);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
* Get the camera handle
* Parameter :
* Constant : Viewport number (1 : Main Viewport, ...)
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *CAM_fn_p_stGetCameraOfViewport
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
enum tdeFuncId_ eFuncId = M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
p_SuperObjPerso =p_SuperObjPerso;
switch(eFuncId)
{
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetCameraOfViewport :
M_EvalNextParameter(p_stValue);
M_Full_GetSetParam_Perso(p_stValue, CAM_fn_hGetActiveCamera(M_GetSetParam_lValue(p_stValue)));
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
case eFct_Cam_GetMainCamera :
M_Full_GetSetParam_Perso(p_stValue, CAM_fn_hGetActiveCamera(CAM_e_MainViewport));
return(p_stTree);
/*---------------------------------------------------------------------------------------*/
default :
break;
}
M_AIFatalError(E_uwAIFatalNotValidFunction);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
**************************************************************************************************
*/
/*
*=================================================================================================
* Compute the target
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stComputeTargetWithTgtPerso
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
CAM_tdstUpdateCamera stStruct;
enum tdeFuncId_ eFuncId = M_eFuncIdInterpret(p_stTree-1);
unsigned short uwMemoFlags;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/*
* Else we copy current to work (basic function to compute target took their
* parameters in work cineinfo) and initialise a temporary structure.
*/
CAM_fn_vSetCineinfoWorkFromCurrent(hCineInfo);
CAM_fn_vInitCameraStructure(hCamera, &stStruct);
/*
* If no perso, no target...
*/
if(stStruct.hCineinfoCurrent->hSuperObjectTargeted == NULL)
{
M_Full_GetSetParam_p_stVertex
(
p_stValue,
NULL
);
return (p_stTree);
}
/*
* We doesn't want dynamic target, and we inhibit force target to force
* function to compute target with the targeted perso.
*/
uwMemoFlags = stStruct.hCineinfoWork->uwIAFlags;
stStruct.hCineinfoWork->uwIAFlags |= C_IAFlags_NoDynamicTarget;
stStruct.hCineinfoWork->uwIAFlags &= ~C_IAFlags_TargetIsAlreadyComputed;
/*
* Compute target.
*/
CAM_fn_vComputeReferencePoint(&stStruct);
CAM_fn_vComputeTarget(&stStruct);
/*
* Restore flags.
*/
stStruct.hCineinfoWork->uwIAFlags = uwMemoFlags;
/*
* Return value.
*/
M_Full_GetSetParam_p_stVertex
(
p_stValue,
&stStruct.stCptPos.stTarget
);
return(p_stTree);
}
/*
*=================================================================================================
* Get the current target Position
* No Parameter.
*=================================================================================================
*/
tdstNodeInterpret *CAM_fn_p_stComputeCurrentTarget
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineInfo;
MS_tdxHandleToDynam h_Dynam;
DNM_tdstParsingDatas *p_stParsingDatas;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineInfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineInfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
if((h_Dynam = M_GetMSHandle(hCamera, Dynam)) == NULL )
return (p_stTree);
if((p_stParsingDatas = fn_p_stDynamGetParsingDatas(h_Dynam)) == NULL)
return (p_stTree);
M_Full_GetSetParam_p_stVertex
(
p_stValue,
DNM_M_p_stCPDGetTarget(p_stParsingDatas)
);
return(p_stTree);
}
/*
*=================================================================================================
* Get the best pos for a camera.
* No Parameter.
*=================================================================================================
*/
extern char cRefAxisIsAlreadyComputed;
extern char cNoDynChangeTheta;
extern char cCanTestStatic;
tdstNodeInterpret *CAM_fn_p_stGetBestPos
(
HIE_tdxHandleToSuperObject p_SuperObjPerso,
tdstNodeInterpret *p_stTree,
tdstGetSetParam *p_stValue
)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToCineinfo hCineinfo;
CAM_tdstUpdateCamera stStruct;
MTH3D_tdstVector stVec;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hCamera);
/********************************************************************************/
hCineinfo = M_GetMSHandle(hCamera, Cineinfo);
#if defined(__DEBUG_AI__)
if (hCineinfo == NULL)
M_AIFatalError(E_uwAIFatalNotMSCamera);
#endif
/* ANNECY MT - 12/07/99 { */
if (!hCineinfo->bCanDoBestPos)
{
M_Full_GetSetParam_p_stVertex
(
p_stValue,
&(hCamera->hGlobalMatrix->stTranslationVector)
);
return(p_stTree);
}
/* END ANNECY MT } */
/*
* To have the actual good camera parameters.
*/
CAM_fn_vSetCineinfoWorkFromCurrent(hCineinfo);
CAM_fn_vInitCameraStructure(hCamera, &stStruct);
cRefAxisIsAlreadyComputed = stStruct.hCineinfoWork->uwIAFlags & C_IAFlags_RefAxisIsAlreadyComputed ? 1 : 0;
cNoDynChangeTheta = stStruct.hCineinfoWork->uwIAFlags & C_IAFlags_NoDynChangeTheta ? 1 : 0;
cCanTestStatic = 1;
/*
* Compute target and real wanted camera pos (this is necessary
* for failure when we want a more correct position.
*/
CAM_fn_vComputeReferencePoint(&stStruct);
CAM_fn_vComputeTarget(&stStruct);
CAM_fn_vComputeRealWantedPos(&stStruct);
CAM_fn_vComputeMovePosWithDynTheta(&stStruct);
/*
* If no perso, can't do it.
*/
if(stStruct.hCineinfoCurrent->hSuperObjectTargeted == NULL)
return(p_stTree);
/*
* Force visibility failure.
*/
CAM_fn_vForceFailureVisibility(&stStruct);
if(stStruct.hCineinfo->eState == CAM_e_State_FailureVisibility)
{
MTH3D_M_vCopyVector(&stVec, &stStruct.hCineinfo->stLastFailedWanted);
/* ANNECY MT - 12/07/99 { */
hCineinfo->bCanDoBestPos = FALSE;
/* END ANNECY MT } */
}
else
{
MTH3D_M_vNullVector(&stVec);
}
stStruct.hCineinfo->eState = CAM_e_State_GoToOptimal;
M_Full_GetSetParam_p_stVertex
(
p_stValue,
&stVec
);
return(p_stTree);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
#ifndef __CAM_TOOL_H__
#define __CAM_TOOL_H__
/*
#undef EXTERN
#undef extern
#if !defined(D_StdGame_VariableDefine)
#define EXTERN extern
#else
#define EXTERN
#endif*/ /* D_StdGame_VariableDefine */
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
extern void CAM_fn_vSetResetInternalFlag(MS_tdxHandleToCineinfo,unsigned short *,unsigned short *,unsigned short *,long,long,unsigned short);
extern void CAM_fn_vForceCameraPos(HIE_tdxHandleToSuperObject, MTH3D_tdstVector *);
extern void CAM_fn_vForceCameraTgt(HIE_tdxHandleToSuperObject, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern ACP_tdxBool CAM_fn_bPersoIsMoving(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern ACP_tdxBool CAM_fn_bPersoIsTurning(HIE_tdxHandleToSuperObject, MTH_tdxReal *);
extern ACP_tdxBool CAM_fn_bPersoOnFace(HIE_tdxHandleToSuperObject, MTH3D_tdstVector *);
extern CPA_EXPORT HIE_tdxHandleToSuperObject CAM_fn_hGetFather(HIE_tdxHandleToSuperObject);
extern void CAM_fn_vComputeProjection(MTH3D_tdstVector *, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern MTH_tdxReal CAM_fn_xComputeRotation(MTH3D_tdstVector *, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern ACP_tdxBool CAM_fn_bEqualVectorWithEpsilon(MTH3D_tdstVector *, MTH3D_tdstVector *, MTH_tdxReal);
extern ACP_tdxBool CAM_fn_bPositionIsReached(HIE_tdxHandleToSuperObject, MTH3D_tdstVector *, MTH_tdxReal, MTH3D_tdstVector *);
extern void CAM_fn_vComputeAnglesBetweenTwoVectors(MS_tdxHandleToInternalCineinfo, MTH3D_tdstVector *, MTH3D_tdstVector *, MTH_tdxReal *, MTH_tdxReal *, MTH3D_tdstVector *);
extern MTH_tdxReal CAM_fn_xSetAngleInIntervalPiPi(MTH_tdxReal);
extern MTH_tdxReal CAM_fn_xSetAngleInInterval02Pi(MTH_tdxReal);
extern void CAM_fn_vGetPersoSightAxis(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern void CAM_fn_vInitCameraStructure(HIE_tdxHandleToSuperObject, CAM_tdstUpdateCamera *);
extern void CAM_fn_vSendParametersToParsing(CAM_tdstUpdateCamera *);
extern void Cam_fn_vComputeMovingOnRail(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH3D_tdstVector *, MTH3D_tdstVector *, MTH_tdxReal);
extern MTH_tdxReal Cam_fn_xComputeProjectionRail(MTH3D_tdstVector *,MTH3D_tdstVector *,MTH3D_tdstVector *);
extern CPA_EXPORT void CAM_fn_vForceBestPosition(HIE_tdxHandleToSuperObject _hCamera);
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif /* __CAM_TOOL_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
#ifndef __CAM_VIS_H__
#define __CAM_VIS_H__
/*
* For _cMode.
*/
#define C_mode_MUSTSEE 1
#define C_mode_MUSTGO 2
#define C_mode_FAILURE 4
#define C_mode_MORE_CORRECT 8
/*
* For cCantTest
*/
#define C_cantest_NOTEST_NORMAL 0
#define C_cantest_TEST_NORMAL 1
/*------------------------------------------------------------------------------------------*/
extern struct tdstInternalStructurCineinfo_ gst_Ideal;
/*------------------------------------------------------------------------------------------*/
extern char CAM_fn_cIsSectorInCollisionList(HIE_tdxHandleToSuperObject, HIE_tdxHandleToSuperObject);
extern char CAM_fn_cSendSegmentInDynamicWorld(MTH3D_tdstVector *, MTH3D_tdstVector *, HIE_tdxHandleToSuperObject, HIE_tdxHandleToSuperObject);
extern char CAM_fn_cSendSegment(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern char CAM_fn_cSendMultiSegment(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH3D_tdstVector *, MTH_tdxReal, MTH_tdxReal, long);
extern char CAM_fn_cCameraCantGo(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern char CAM_fn_cCameraCantSee(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH3D_tdstVector *);
extern char CAM_fn_cIsWantedPosIncorrect(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, char);
extern MTH_tdxReal CAM_fnx_ComputePosPound(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern char CAM_fnc_IsDirectionCorrect(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH_tdxReal, MTH_tdxReal, char);
extern void CAM_fn_vFillVectorArray(CAM_tdstUpdateCamera *, char);
extern int CAM_fni_ComparePosition(void *_pv_Elem1, void *_pv_Elem2);
extern char CAM_fn_cFindCorrectPosWithDir(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, MTH3D_tdstVector *, char);
extern char CAM_fn_cFindNewGoodIdealPos(CAM_tdstUpdateCamera *, MTH3D_tdstVector *, char);
extern void CAM_fn_vForceFailureVisibility(CAM_tdstUpdateCamera *);
extern void CAM_fn_vComputeFailureVisibility(CAM_tdstUpdateCamera *);
extern void CAM_fn_vTestBadDistance(CAM_tdstUpdateCamera *);
extern void CAM_fn_vTestBadVisibility(CAM_tdstUpdateCamera *);
extern void CAM_fn_vTestOppositeCollision(CAM_tdstUpdateCamera *);
extern void CAM_fn_vComputeCineinfoWorkForAPosition(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void CAM_fn_vComputeCineinfoCurrentForAPosition(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void CAM_fn_vMakeAsNewIdealPosition(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern char CAM_fn_cCanResetConstraintMoveVisFailure(CAM_tdstUpdateCamera *, MTH3D_tdstVector *);
extern void CAM_fn_vRestoreNormalState(CAM_tdstUpdateCamera *);
extern void CAM_fn_vCheckForABetterPos(CAM_tdstUpdateCamera *);
#endif /* __CAM_VIS_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
/*---------------------------------------------------------------------------*/
/* Cond.h : Definition of general Condition.*/
/* auteur : Olivier Didelot.*/
/* date : 07/10/1996*/
/* 970130 : O.C. conditions and keywords tables + beginning of Lint verification*/
/* modify : Olivier Couvreur*/
/* date : 18/02/1997 CPA_EXPORT + new functions for editor*/
/* modify : Olivier Couvreur*/
/* date : 21/02/1997 Add <= , >= conditions and some keywords for editor*/
/* modify : Olivier Couvreur*/
/* date : 03/04/1997 new button conditions*/
/*---------------------------------------------------------------------------*/
#if !defined(__CONDITION_H__)
#define __CONDITION_H__
ACP_tdxBool fn_bCanSwim(HIE_tdxHandleToSuperObject p_SuperObjPerso);
#include "specif/AiOption.h"
#if !defined(OPTIMIZED_COMMAND)
void fn_vInitConditionEntries(void);
#endif /* OPTIMIZED_COMMAND*/
#endif /* __CONDITION_H__*/

View File

@@ -0,0 +1,941 @@
/* Private functions */
/*
BOOL fn_bIsObstacleTypeOfGMT(HIE_tdxHandleToSuperObject p_SuperObjPerso, GMT_tdxMask xTestMask)
{
DNM_tdstReport *p_stDynamReport;
if ((p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso)) == NULL)
return FALSE;
return fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetObstacle(p_stDynamReport)), xTestMask);
}
BOOL fn_bIsWallTypeOfGMT(HIE_tdxHandleToSuperObject p_SuperObjPerso, GMT_tdxMask xTestMask)
{
DNM_tdstReport *p_stDynamReport;
if ((p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso)) == NULL)
return FALSE;
return fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetWall(p_stDynamReport)), xTestMask);
}
BOOL fn_bIsGroundTypeOfGMT(HIE_tdxHandleToSuperObject p_SuperObjPerso, GMT_tdxMask xTestMask)
{
DNM_tdstReport *p_stDynamReport;
if ((p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso)) == NULL)
return FALSE;
return fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetGround(p_stDynamReport)), xTestMask);
}
BOOL fn_bIsCeilingTypeOfGMT(HIE_tdxHandleToSuperObject p_SuperObjPerso, GMT_tdxMask xTestMask)
{
DNM_tdstReport *p_stDynamReport;
if ((p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso)) == NULL)
return FALSE;
return fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetCeil(p_stDynamReport)), xTestMask);
}
*/
/******************************************************************
* Condition : ZDMCollideWithObstacle *
* Use : ZDMCollisionAvecObstacle ("Type de mat<61>riau") *
* Use for : Return the collide type with OBSTACLES *
* Author : Jacques Th<54>noz *
* Date of last modification: 31/10/97 *
******************************************************************/
tdstNodeInterpret *fn_p_stZDMCollideWithObstacle(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
tdstGetSetParam stParam;
GMT_tdxMask xTestMask;
unsigned long ulSurfState;
DNM_tdstReport *p_stDynamReport;
enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
M_EvalNextParameter(&stParam);
if ((p_stDynamReport=fn_pstGetDNMReport(p_SuperObjPerso))==NULL)
{
*p_lValue = (long)FALSE;
return p_stTree;
}
ulSurfState = DNM_M_ulReportGetSurfaceState(p_stDynamReport);
xTestMask = (GMT_tdxMask) M_GetSetParam_xMaskValue(&stParam);
*p_lValue = FALSE;
switch (eCondId)
{
case eCond_IsZDMCollideWithObstacle :
if (ulSurfState!=C_WOT_ulNoObstacle)
/**p_lValue = fn_bIsObstacleTypeOfGMT(p_SuperObjPerso, xTestMask);*/
*p_lValue = (long)fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetObstacle(p_stDynamReport)), xTestMask);
break;
case eCond_IsZDMCollideWithWall :
if (ulSurfState & C_WOT_ulWall)
/**p_lValue = fn_bIsWallTypeOfGMT(p_SuperObjPerso, xTestMask);*/
*p_lValue = (long)fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetWall(p_stDynamReport)), xTestMask);
break;
case eCond_IsZDMCollideWithGround :
if (ulSurfState & (C_WOT_ulGround/*|C_WOT_ulSlope*/))
/**p_lValue = fn_bIsGroundTypeOfGMT(p_SuperObjPerso, xTestMask);*/
*p_lValue = (long)fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetGround(p_stDynamReport)), xTestMask);
break;
case eCond_IsZDMCollideWithCeiling :
if (ulSurfState & (/*C_WOT_ulAttic|*/C_WOT_ulCeiling))
/**p_lValue = fn_bIsCeilingTypeOfGMT(p_SuperObjPerso, xTestMask);*/
*p_lValue = (long)fn_bTestTypeOfGameMaterial(DNM_M_hObstacleGetCollidedMaterial(DNM_M_p_stReportGetCeil(p_stDynamReport)), xTestMask);
break;
default:
break;
}
return(p_stTree);
}
/******************************************************************
* Condition : Cond_IsCustomBitSet *
* : Cond_IsCurrentStateCustomBitSet *
* Use : ACT_TestCustomBit(numero_de_bit) *
* : ACT_TestCustomBitDEtatCourant(numero_de_bit) *
* Use for : Return the state of the bit *
* Author : B. Germain *
* Date of last modification: 25/11/98 MT *
******************************************************************/
/* ANNECY MT - 24/11/98 {*/
tdstNodeInterpret *fn_p_stCustomBitsCond(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
tdstGetSetParam stParam;
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
/*read the custom bit identifier*/
M_EvalNextParameter(&stParam);
switch ( eCondId )
{
case eCond_IsCustomBitSet:
{
unsigned long ulMask = (1 << (M_GetSetParam_lValue(&stParam) - 1));
*p_lValue = (fn_ulStandardGameGetCustomBits(M_GetMSHandle(hNewSuperObjPerso,StandardGame)) & ulMask) ? TRUE : FALSE;
}
break;
case eCond_IsCurrentStateCustomBitSet:
{
unsigned long ulMask;
tdxHandleToState h_State;
ulMask = (unsigned long)M_GetSetParam_CapsValue(&stParam);
#ifdef _DEBUG
SAF_M_AssertWithMsg(ulMask < 256, "Le masque est trop grand")
#endif
h_State = fn_h3dDataGetCurrentState(M_GetMSHandle(hNewSuperObjPerso,3dData));
*p_lValue = ( (h_State && (fn_ucGetStateCustomBits(h_State) & ulMask)) ? TRUE : FALSE);
}
break;
default:
*p_lValue = FALSE;
break;
}
return p_stTree;
}
/* END ANNECY MT }*/
/*=====================================================================================================================================
Name: CollisionWP( Perso, WP )
Author: yann le tensorer
Created: October 12,1998 (completely rewriten for optimisations)
Last modified:
=====================================================================================================================================*/
/*extern void fn_vRegisterTextToDraw (char * _szTextToDraw , long _lX , long _lY);*/
tdstNodeInterpret *fn_p_stCollisionWP(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
tdstGetSetParam stParam;
HIE_tdxHandleToSuperObject hPerso;
WP_tdhWayPoint hWP;
MTH3D_tdstVector stPosWP;
/*
static char init=0;
static char text[100];
unsigned long ulTimerValue;
if (init==0)
{
init=1;
fn_vRegisterTextToDraw(text,10,450);
}
ulTimerValue = TMR_fn_ulFastGetInternalCounter();
*/
/* Get first parameter that is a type Perso*/
M_EvalNextParameter( &stParam );
hPerso = (HIE_tdxHandleToSuperObject) M_GetSetParam_p_stSupObjValue( &stParam );
/* Get second parameter that is a Waypoint*/
M_EvalNextParameter( &stParam );
hWP = M_GetSetParam_WayPointValue( &stParam );
/* if bad wp or perso given, ther is surely no collision !*/
if ((hPerso==0) || (hWP==0))
{
*p_lValue=FALSE;
return(p_stTree);
}
if (hWP->m_hSuperObject) /* does the waypoint have a superobject ?*/
{
WP_fnv_WayPoint_ComputeLocation(hWP,&stPosWP);
/*get vector between WP and Perso*/
MTH3D_M_vSubVector(&stPosWP,&stPosWP,&hPerso->hGlobalMatrix->stTranslationVector);
}
else
/* what almost always happens...*/
MTH3D_M_vSubVector(&stPosWP,&hWP->m_stVertex,&hPerso->hGlobalMatrix->stTranslationVector);
/*compare the square of its norm with the square of the radius*/
if MTH_M_bGreaterZero(MTH_M_xSub(MTH3D_M_xSqrVector(&stPosWP),MTH_M_xSqr(hWP->m_xRadius)))
*p_lValue=FALSE;
else
*p_lValue=TRUE;
/*
ulTimerValue=TMR_fn_ulFastGetInternalCounter()-ulTimerValue-30;
sprintf(text,"%ul",ulTimerValue);
*/
return(p_stTree);
}
/**********************************************************************
* Condition: IsGiBlock *
* Use : bool := GiBloque *
* true if Gi mechanic prevents Rayman from going out a Gi *
* collide set material *
* false *
* Author : Christophe Giraud *
* Date of last modification: 25/11/97 *
**********************************************************************/
/*tdstNodeInterpret *fn_p_stMechanicBlock(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
switch ( eCondId )
{
case eCond_IsGiBlock:
case eCond_IsMechanicBlock:
{
DNM_tdstReport *p_stDynamReport;
BOOL bGiBlock = FALSE;
if ( (p_stDynamReport = fn_pstGetDNMReport(p_SuperObjPerso))!=NULL )
{
bGiBlock = DNM_M_bReportCollision(p_stDynamReport);
DNM_M_bReportSetCollisionFlagToFalse(p_stDynamReport);
}
*p_lValue = bGiBlock?TRUE:FALSE;
}
break;
default:
*p_lValue = FALSE;
break;
}
return(p_stTree);
}*/
/**********************************************************************
* Condition: IsVectorNul *
* Use : bool := VecteurNul ( vecteur ) *
* almost true if ||vecteur|| < epsilon *
* Author : Jacques Th<54>noz *
* Date of last modification: 22/04/98 *
* - no more BOOL variable *
* - epsilon changed from 1e-15 to 1e-5 *
* - test modified so that as soon as one compoent is too large, *
* the others are ignored *
**********************************************************************/
tdstNodeInterpret *fn_p_stNullVector(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
tdstGetSetParam stParam;
/*
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
switch ( eCondId )
{
case eCond_IsNullVector:
{
*/
MTH3D_tdstVector *p_stVector;
/* read vector */
M_EvalNextParameter(&stParam);
p_stVector=&M_GetSetParam_stVectorValue(&stParam);
*p_lValue = ( MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetXofVector(p_stVector), MTH_M_xDoubleToReal(1.0e-5)) && MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetYofVector(p_stVector), MTH_M_xDoubleToReal(1.0e-5)) && MTH_M_bIsNullWithEpsilon(MTH3D_M_xGetZofVector(p_stVector), MTH_M_xDoubleToReal(1.0e-5)) )
? TRUE
: FALSE;
/* }
break;
default:
*p_lValue = FALSE;
break;
}
*/
return(p_stTree);
}
/**********************************************************************
* Condition: OptionTruc *
* Use : bool := OptionTruc () *
* true if Truc option is active in current mechanic *
* Author : Jacques Th<54>noz *
* Date of last modification: 16/12/97 *
**********************************************************************/
tdstNodeInterpret *fn_p_stMechanicOption(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
struct DNM_stDynamics* pstDynamic;
MS_tdxHandleToDynam h_Dynam;
BOOL bOption;
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
/* Get Dynamics structure*/
h_Dynam = M_GetMSHandle(hNewSuperObjPerso,Dynam);
if (!h_Dynam)
{
#if (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)
#if !defined(U64_AIDEBUG) /* Oliv' - 23/11/1998*/
Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, E_uwAIWarningScriptError , C_lErmNoDebugData,
C_ucErmOpenInfoWindow, C_ucNeverStopForDebug,
"You must allocate Dynamics.");
Erm_fn_iMessageBox ("You must allocate Dynamics.","STOP",MB_OK|MB_ICONERROR);
Erm_M_ClearLastError(C_ucErmDefaultChannel);
fn_vSetStopAIEngineFlag();
#endif /* !defined(U64_AIDEBUG) */
#endif /* (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG) */
*p_lValue = FALSE;
return(p_stTree);
}
pstDynamic = fn_p_stDynamGetDynamics(h_Dynam);
switch ( eCondId )
{
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eCond_IsMechanicAnimation :
bOption=DNM_M_bDynamicsIsAnimation (pstDynamic);
break;
case eCond_IsMechanicCollide :
bOption=DNM_M_bDynamicsIsCollide (pstDynamic);
break;
case eCond_IsMechanicGravity :
bOption=DNM_M_bDynamicsIsGravity (pstDynamic);
break;
case eCond_IsMechanicTilt :
bOption=DNM_M_bDynamicsIsTilt (pstDynamic);
break;
case eCond_IsMechanicGi :
bOption=DNM_M_bDynamicsIsGi (pstDynamic);
break;
case eCond_IsMechanicClimb :
bOption=DNM_M_bDynamicsIsClimb (pstDynamic);
break;
case eCond_IsMechanicOnGround :
bOption=DNM_M_bDynamicsIsOnGround (pstDynamic);
break;
case eCond_IsMechanicSpider :
bOption=DNM_M_bDynamicsIsSpider (pstDynamic);
break;
case eCond_IsMechanicShoot :
bOption=DNM_M_bDynamicsIsShoot (pstDynamic);
break;
case eCond_IsMechanicSwim :
bOption=DNM_M_bDynamicsIsShoot (pstDynamic);
break;
case eCond_IsMechanicNeverFall :
bOption=DNM_M_bDynamicsIsNeverFall (pstDynamic);
break;
case eCond_IsMechanicCollisionControl:
bOption=DNM_M_bDynamicsIsCollisionControl (pstDynamic);
break;
case eCond_IsMechanicKeepSpeedZ:
bOption=DNM_M_bDynamicsIsKeepWallSpeedZ (pstDynamic);
break;
case eCond_IsMechanicSpeedLimit:
bOption=DNM_M_bDynamicsIsSpeedLimit (pstDynamic);
break;
case eCond_IsMechanicInertia:
bOption=DNM_M_bDynamicsIsInertia (pstDynamic);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eCond_IsMechanicStream:
bOption=DNM_M_bDynamicsIsStream (pstDynamic);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eCond_IsMechanicStickOnPlatform:
bOption=DNM_M_bDynamicsIsStickOnPlatform (pstDynamic);
break;
case eCond_IsMechanicPatformCrash:
bOption=DNM_M_bDynamicsIsPlatformCrash (pstDynamic);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eCond_CanFall:
/* if true, we store the fall direction in the specified vector dsgvar*/
if ( (bOption = DNM_M_bDynamicsIsCanFall (pstDynamic)) != 0 ) /*VOLUNTARY ASSIGNMENT!!!*/
{
tdstGetSetParam stParam;
AI_tdstMind *p_stMind; /* Mind of the dsgvar owning perso (used to return paramaters to dsgVars)*/
unsigned char ucVectorId; /* id of the vector dsgvar*/
/* get the vector identification in the argument*/
M_vEvalNextVarId(p_stMind, ucVectorId);
/*put the vector found in the mechanics into the dsgvar*/
M_GetSetParam_stVertexValue(&stParam) = *DNM_M_pDynamicsGetFallTranslation(pstDynamic);
M_GetSetParam_Type(&stParam) = E_vt_Vector;
ucVectorId = fn_ucSetDsgVar(ucVectorId, 0, p_stMind, &stParam);
SAF_M_AssertWithMsg(ucVectorId != C_INVALID_SET, "L'argument n'est pas de type vecteur!");
}
else /* no need to store the vector -> do not evaluate its id*/
p_stTree = fn_p_stSkipThisArgument(p_stTree);
break;
case eCond_IsGiBlock:
case eCond_IsMechanicBlock:
bOption=DNM_M_bDynamicsIsStop (pstDynamic);
DNM_M_vDynamicsSetStop (pstDynamic,FALSE);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eCond_IsMechanicScale:
bOption = DNM_M_bDynamicsIsScale (pstDynamic);
break;
case eCond_IsMechanicExec:
bOption = DNM_M_bDynamicsIsExec (pstDynamic);
DNM_M_vDynamicsSetExec (pstDynamic,FALSE);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eCond_IsMechanicCrash:
bOption = DNM_M_bDynamicsIsCrash (pstDynamic);
break;
default:
bOption = FALSE;
break;
}
*p_lValue = bOption ? TRUE : FALSE;
return(p_stTree);
}
/*ANNECY CT 06/02/98{*/
/**********************************************************************
* Function: ANI_TestFinAnim *
* Function: ACT_TestFinAction *
* Use : Booleen = ANI_TestFinAnim() ou Perso.ANI_TestFinAnim() *
* Use : Booleen = ACT_TestFinAction() ou Perso.ACT_TestFinAction() *
* *
* Author : Carlos Torres *
* Date of last modification: 16/02/98 *
**********************************************************************/
tdstNodeInterpret * fn_p_stCheckAnimEnd(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue) {
enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
if (eCondId == eCond_CheckAnimEnd) {
*p_lValue=PLA_fn_bTestIfEndOfAnim(hNewSuperObjPerso);
return (p_stTree);
}
else if (eCondId == eCond_CheckActionEnd) {
*p_lValue=PLA_fn_bTestIfEndOfAction(hNewSuperObjPerso);
return (p_stTree);
}
M_AIFatalError(E_uwAIFatalNotValidCondition);
return(p_stTree);
}
/*ENDANNECY CT}*/
/**********************************************************************
* Condition: HIER_EstFils_acteur ( toto ) *
* true if actor is a son of toto *
* Author : Jacques Th<54>noz *
* Date of last modification: 10/02/98 *
**********************************************************************/
tdstNodeInterpret *fn_p_stHierarchySon (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
tdstGetSetParam stParam;
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
HIE_tdxHandleToSuperObject hFather;
HIE_tdxHandleToSuperObject hChild;
int i;
struct DNM_stDynamics* pstDynamic;
MS_tdxHandleToDynam h_Dynam;
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
*p_lValue = FALSE;
M_EvalNextParameter( &stParam );
hFather = (HIE_tdxHandleToSuperObject) M_GetSetParam_p_stSupObjValue( &stParam );
SAF_M_AssertWithMsg(hFather, "l'acteur sp<73>cifi<66> est nul");
h_Dynam = M_GetMSHandle(hNewSuperObjPerso,Dynam);
if (h_Dynam)
{
pstDynamic = fn_p_stDynamGetDynamics(h_Dynam);
if (DNM_M_bDynamicsIsComplexSize(pstDynamic))
{
if (DNM_M_hDynamicsGetPlatformSO(pstDynamic)==hFather) *p_lValue = TRUE;
return p_stTree;
}
}
HIE_M_ForEachChildOf (hFather,hChild,i)
{
if (hChild==hNewSuperObjPerso)
{
*p_lValue = TRUE;
return p_stTree;
}
}
return(p_stTree);
}
/*ANNECY Bart#01 13/02/98 {*/
/*
----------------------------------------------------------------------------------------
Description : *fn_p_stCheckCapabilities
p_SuperObjPerso ->
p_stTree ->
p_lValue ->
Returns (tdstNodeInterpret )
----------------------------------------------------------------------------------------
Author : Fred 'Bart#01' Compagnon
Date : 13/02/98
----------------------------------------------------------------------------------------
*/
tdstNodeInterpret *fn_p_stCheckCapabilities(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
unsigned long ubf32CapabilityToTest = 0;
unsigned long ubf32BitOfCapability = 0;
unsigned char ucBitNumber;
struct tdstEngineObject_ * hEngineObj; /* there's no "tdhEngineObject" ? ? ? ? ? ? ! ! !*/
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
*p_lValue = FALSE;
switch(eCondId)
{
case eCond_HasTheCapability:
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eCond_HasOneOfTheCapabilities:
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
{
M_EvalNextParameter(&stParam);
ubf32CapabilityToTest = M_GetSetParam_CapsValue(&stParam);
M_EvalNextParameter(&stParam);
ubf32BitOfCapability = M_GetSetParam_CapsValue(&stParam);
break;
}
case eCond_HasTheCapabilityNumber:
{
M_EvalNextParameter(&stParam);
ubf32CapabilityToTest = M_GetSetParam_CapsValue(&stParam);
M_EvalNextParameter(&stParam);
ucBitNumber = (unsigned char) M_GetSetParam_lValue(&stParam);
if (ucBitNumber >= 32)
{
return(p_stTree); /* *p_lValue = FALSE;*/
break;
}
ubf32BitOfCapability = 1<<ucBitNumber;
break;
}
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eCond_PersoHasTheCapability:
case eCond_PersoHasOneOfTheCapabilities:
{
/* get perso capacity */
hEngineObj = M_GetEngineObject(hNewSuperObjPerso);
ubf32CapabilityToTest = fn_ulGetCapabilities(hEngineObj);
M_EvalNextParameter(&stParam);
ubf32BitOfCapability = M_GetSetParam_CapsValue(&stParam);
break;
}
case eCond_PersoHasTheCapabilityNumber:
{
/* get perso capacity */
hEngineObj = M_GetEngineObject(hNewSuperObjPerso);
ubf32CapabilityToTest = fn_ulGetCapabilities(hEngineObj);
M_EvalNextParameter(&stParam);
ucBitNumber = (unsigned char) M_GetSetParam_lValue(&stParam);
if (ucBitNumber >= 32)
{
return(p_stTree); /* *p_lValue = FALSE;*/
break;
}
ubf32BitOfCapability = 1<<ucBitNumber;
break;
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
default:
break;
}
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
if ( (eCondId == eCond_HasOneOfTheCapabilities) || (eCondId == eCond_PersoHasOneOfTheCapabilities) )
*p_lValue = ((ubf32CapabilityToTest & ubf32BitOfCapability) != 0);
else
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
*p_lValue = ((ubf32CapabilityToTest & ubf32BitOfCapability) == ubf32BitOfCapability);
return(p_stTree);
}
/*ENDANNECY Bart#01 }*/
/*ANNECY CT 02/03/98{*/
/**********************************************************************
* Function: ACT_EstActif *
* Use : Booleen = ACT_EstActif(perso) *
* *
* Author : Carlos Torres *
* Date of last modification: 04/03/98 *
**********************************************************************/
tdstNodeInterpret * fn_p_stIsPersoActive(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
/* enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
if (eCondId == eCond_IsPersoActive)
{
*/
tdstGetSetParam stParam;
M_EvalNextParameter(&stParam);
if ( M_GetSetParam_p_stEngineObjValue(&stParam)->h_StandardGame )
{
p_SuperObjPerso = M_GetSetParam_p_stSupObjValue(&stParam);
SAF_M_AssertWithMsg(p_SuperObjPerso, "l'acteur sp<73>cifi<66> est nul");
*p_lValue = GAM_fn_bIsCharacterActive(p_SuperObjPerso);
}
else
*p_lValue = 0; /* when actor is an always, its MS pointers are cleard when is is destroyed*/
return (p_stTree);
/* }
M_AIFatalError(E_uwAIFatalNotValidCondition);
return(p_stTree);
*/
}
/*ENDANNECY CT}*/
/**********************************************************************
* Condition: ACT_NEstPasEnCollisionAvecMap () *
* Condition: ACT_NEstPasEnCollisionAvecProjectiles () *
* Condition: ACT_NEstPasEnCollisionAvecActeursSecondaires () *
* Condition: ACT_NEstPasEnCollisionAvecActeurPrincipal () *
* true according Collision Flag in CollisionSet MS *
* *
* Author : Marc Trabucato *
* Date of last modification: 17/03/98 *
**********************************************************************/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *fn_p_stIsCollisionFlag (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
MS_tdxHandleToCollSet hCollSet;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
hCollSet = M_GetMSHandle(hNewSuperObjPerso,CollSet);
switch( eCondId )
{
case eCond_NEstPasEnCollisionAvecMap:
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithMap( hCollSet );
break;
case eCond_NEstPasEnCollisionAvecProjectile:
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithProjectile( hCollSet );
break;
case eCond_NEstPasEnCollisionAvecSecondCharact:
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithSecondaryCharacter( hCollSet );
break;
case eCond_NEstPasEnCollisionAvecMainCharact:
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithMainCharacter( hCollSet );
break;
case eCond_NEstPasEnCollisionAvecAutresSecteurs:
*p_lValue = fn_bCollSetGetCharacterNoCollisionWithOtherSectors( hCollSet );
break;
default:
break;
}
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/**********************************************************************
* Function: ACT_EstDe *
* Use : Booleen = ULTRA.ACT_EstDeFamille(Famille) *
* Use : Booleen = ULTRA.ACT_EstDeModele(Modele) *
* *
* Author : Yann Le Guyader *
* Date of last modification: 24/03/98 *
**********************************************************************/
tdstNodeInterpret * fn_p_stIsOf(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue) {
enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
tdstGetSetParam stParam;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
M_EvalNextParameter(&stParam);
switch( eCondId )
{
case eCond_IsInFamily:
{
*p_lValue=(fn_h3dDataGetFamily(M_GetMSHandle(hNewSuperObjPerso,3dData)) == M_GetSetParam_hFamily(&stParam));
return (p_stTree);
break;
}
case eCond_IsInModel:
{
MS_tdxHandleToBrain hBrain = M_GetMSHandle(hNewSuperObjPerso,Brain);
*p_lValue=(
hBrain
&& (AI_M_p_stGetAIModel(M_pstGetMindOfBrain(hBrain)) == M_GetSetParam_p_stModel(&stParam))
);
return (p_stTree);
break;
}
default:
break;
}
M_AIFatalError(E_uwAIFatalNotValidCondition);
return(p_stTree);
}
/**********************************************************************
* Function: IPT_AJoypadIsConnected
**********************************************************************/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 07/06/99 { */
tdstNodeInterpret * fn_p_stAJoypadIsConnected(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
#ifdef USE_IPT_DX5
*p_lValue= IPT_fn_bIsJoystickControlAvailable();
#else /* USE_IPT_WIN */
*p_lValue= IPT_fn_bAJoypadConnected();
#endif /* USE_IPT_WIN */
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
/**********************************************************************
* Function: IPT_AKeyJustPressed
**********************************************************************/
tdstNodeInterpret * fn_p_stAKeyJustPressed(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
/* LOL*/
#ifndef U64
*p_lValue= IPT_fn_bAKeyJustPressed();
#else
M_PrintfStopErrorN64(("Condition fn_p_stAKeyJustPressed invalidate for N64"));
#endif
return(p_stTree);
}
/**********************************************************************
* Function: IPT_AButtonPadJustPressed
**********************************************************************/
tdstNodeInterpret * fn_p_stAButtonPadJustPressed(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
*p_lValue= IPT_fn_bAButtonPadJustPressed();
return(p_stTree);
}
/*HP 101298*/
/**********************************************************************
* Function fn_p_stDemoCondition
**********************************************************************/
tdstNodeInterpret * fn_p_stDemoCondition(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
*p_lValue=g_stEngineStructure.xDemoMode;
return(p_stTree);
}
/**********************************************************************
* Function fn_p_stIsStereoMode
* Parameters:
* Return TRUE if stereo
**********************************************************************/
tdstNodeInterpret * fn_p_stIsInStereoMode(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
*p_lValue = SND_fn_bGetStereoSound();
return(p_stTree);
}
/**********************************************************************
* Function fn_p_stMusicPlaying
* Parameters:
* Return TRUE if there's a music now playing
**********************************************************************/
tdstNodeInterpret * fn_p_stIsMusicPlaying(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
*p_lValue = SND_fn_bIsMusicPlayingSound();
return(p_stTree);
}
/**********************************************************************
* Function fn_p_stIsIsShapnessMax
**********************************************************************/
#ifdef U64
extern unsigned char g_bSharpnessValue;
extern char g_bMustSwitchResolution;
extern int SCREEN_WD;
tdstNodeInterpret * fn_p_stIsIsShapnessMax(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
if (((SCREEN_WD==300) || (g_bMustSwitchResolution == 1)) && (g_bMustSwitchResolution != 2))
{
*p_lValue = g_bSharpnessValue;
}
else
{
*p_lValue = 1;
}
return(p_stTree);
}
#endif
tdstNodeInterpret *fn_p_stIsSlotDataCorrupt(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
*p_lValue = 0;
return (p_stTree);
}
tdstNodeInterpret *fn_p_stIsCheatMenu(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
*p_lValue = 0;
return (p_stTree);
}
tdstNodeInterpret *fn_p_stIsUSBuild(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
*p_lValue = TRUE;
return (p_stTree);
}

View File

@@ -0,0 +1,285 @@
#if defined(_AI_LIB_)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "EnumAct.h"
#if defined(OPTIMIZED_COMMAND)
#include "ProtAct.h"
#endif
#else
#include <string.h>
#include "specif/AIOption.h"
#include "ConvCst.h"
#include "EnumAct.h"
#include "ConvAct.h"
#endif /* _AI_LIB_ */
#define C_MAX_SIZE_META_ACTION_SCRIPT_NAME 37
#define C_MAX_SIZE_META_ACTION_EDITOR_NAME 80
#define C_MAX_NB_META_ACTION_PARAM C_MAX_NB_PARAM
typedef struct tdstMetaActionEntry_
{
#if defined(ACTIVE_EDITOR)
/* metaaction string used in editor*/
char szMetaActionEditorName[C_MAX_SIZE_META_ACTION_EDITOR_NAME+1];
char szMetaActionEditorName_En[C_MAX_SIZE_META_ACTION_EDITOR_NAME+1];
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
/* metaaction string used in script*/
char szMetaActionScriptName[C_MAX_SIZE_META_ACTION_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
/* pointer on metaaction INIT function*/
tdp_fn_p_stMetaActionInitFunctionPtr p_fn_p_stMetaActionInitFunction;
/* pointer on metaaction NEXT function*/
tdp_fn_ucMetaActionFunctionPtr p_fn_ucMetaActionFunction;
#endif /* _AI_LIB_*/
/* list of metaaction parameters (taken from szAutorizedTypeParam)*/
char szMetaActionTypeParam[C_MAX_NB_META_ACTION_PARAM+1];
} tdstMetaActionEntry;
tdstMetaActionEntry a_stMetaActionTable[eNbMetaAction]
#if defined(OPTIMIZED_COMMAND)
=
{
/* Procedure initialisation*/
#if defined (AI_USE_SCRIPT)
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) { b,english,c,d,e,f },
#else
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) { c,d,e,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) { b,english,c,f },
#else
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) { c,f },
#endif /* ACTIVE_EDITOR*/
#endif /* _AI_LIB_*/
#else /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) { b,english,d,e,f },
#else
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) { d,e,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) { b,english,f },
#else
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) { f },
#endif /* ACTIVE_EDITOR*/
#endif /* _AI_LIB_*/
#endif /* AI_USE_SCRIPT */
#include "DefAct.h"
#undef M_DEFINE_METAACTION
}
#endif /* OPTIMIZED_COMMAND*/
;
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeMetaActionId_ fn_eGetNbMetaAction()
{
return(eNbMetaAction);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
char *szGetMetaActionTypeInParamFromId(enum tdeMetaActionId_ eMetaActionId)
{
return( a_stMetaActionTable[eMetaActionId].szMetaActionTypeParam);
}
#if defined(ACTIVE_EDITOR)
char *szGetMetaActionTypeOutParamFromId(enum tdeMetaActionId_ eMetaActionId)
{
eMetaActionId=eMetaActionId; /* for lint*/
return(USE_NO_PARAM);
}
char *szGetMetaActionTypeParamFromId(enum tdeMetaActionId_ eMetaActionId)
{
return( a_stMetaActionTable[eMetaActionId].szMetaActionTypeParam);
}
enum tdeMetaActionId_ fn_eFindMetaActionIdFromEditorName(char *szMetaAction)
{
short wActionEntry;
for(wActionEntry=0;wActionEntry<fn_eGetNbMetaAction();wActionEntry++)
{
if (!stricmp(a_stMetaActionTable[wActionEntry].szMetaActionEditorName,szMetaAction))
{
return((enum tdeMetaActionId_) wActionEntry);
}
}
return(fn_eGetNbMetaAction());
}
char *szFindMetaActionEditorNameFromId(enum tdeMetaActionId_ eMetaActionId)
{
return( a_stMetaActionTable[eMetaActionId].szMetaActionEditorName);
}
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
char *szFindMetaActionScriptNameFromId(enum tdeMetaActionId_ eMetaActionId)
{
return( a_stMetaActionTable[eMetaActionId].szMetaActionScriptName);
}
enum tdeMetaActionId_ fn_eFindMetaActionIdFromScriptName(char *szMetaAction)
{
short wActionEntry;
for(wActionEntry=0;wActionEntry<fn_eGetNbMetaAction();wActionEntry++)
{
if (!stricmp(a_stMetaActionTable[wActionEntry].szMetaActionScriptName,szMetaAction))
{
return((enum tdeMetaActionId_) wActionEntry);
}
}
return(fn_eGetNbMetaAction());
}
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
tdp_fn_p_stMetaActionInitFunctionPtr fn_p_fn_pGetMetaActionInitFunctionPtr(enum tdeMetaActionId_ eMetaActionId)
{
return(a_stMetaActionTable[eMetaActionId].p_fn_p_stMetaActionInitFunction);
}
tdp_fn_ucMetaActionFunctionPtr fn_p_fn_pGetMetaActionFunctionPtr(enum tdeMetaActionId_ eMetaActionId)
{
return(a_stMetaActionTable[eMetaActionId].p_fn_ucMetaActionFunction);
}
#endif /* _AI_LIB_*/
/***************************************************************************************/
/* -------------------------*/
/* fn_vDefineMetaActionEntry*/
/* -------------------------*/
/* eMetaActionId : MetaAction identifier*/
/* szMetaActionEditorName : MetaAction string in Editor*/
/* szMetaActionScriptName : MetaAction string in Script*/
/* p_fn_p_stMetaActionInitFunction : function pointer on your INIT function*/
/* p_fn_ucMetaActionFunction : function pointer on your NEXT function*/
/* szMetaActionTypeParam : string of MetaActionParameters (cf szAutorizedTypeParam)*/
/***************************************************************************************/
#if !defined(OPTIMIZED_COMMAND)
#if defined(ACTIVE_EDITOR)
void fn_vDefineMetaActionEntry(enum tdeMetaActionId_ eMetaActionId,char *szMetaActionEditorName,char *szMetaActionEditorName_En,char *szMetaActionScriptName,tdp_fn_p_stMetaActionInitFunctionPtr p_fn_p_stMetaActionInitFunction,tdp_fn_ucMetaActionFunctionPtr p_fn_ucMetaActionFunction,char *szMetaActionTypeParam)
#else
void fn_vDefineMetaActionEntry(enum tdeMetaActionId_ eMetaActionId,char *szMetaActionScriptName,tdp_fn_p_stMetaActionInitFunctionPtr p_fn_p_stMetaActionInitFunction,tdp_fn_ucMetaActionFunctionPtr p_fn_ucMetaActionFunction,char *szMetaActionTypeParam)
#endif /* ACTIVE_EDITOR*/
{
if (
(eMetaActionId<fn_eGetNbMetaAction())
#if defined(ACTIVE_EDITOR)
&&(strlen(szMetaActionEditorName)<=C_MAX_SIZE_META_ACTION_EDITOR_NAME)
#endif /* ACTIVE_EDITOR*/
&&(strlen(szMetaActionScriptName)<=C_MAX_SIZE_META_ACTION_SCRIPT_NAME)
&&(strlen(szMetaActionTypeParam)<=C_MAX_NB_META_ACTION_PARAM)
&&(fn_ucCheckTypeParam(szMetaActionTypeParam))
)
{
#if defined(ACTIVE_EDITOR)
strcpy(a_stMetaActionTable[eMetaActionId].szMetaActionEditorName,szMetaActionEditorName);
#endif /* ACTIVE_EDITOR*/
strcpy(a_stMetaActionTable[eMetaActionId].szMetaActionScriptName,szMetaActionScriptName);
a_stMetaActionTable[eMetaActionId].p_fn_p_stMetaActionInitFunction=p_fn_p_stMetaActionInitFunction;
a_stMetaActionTable[eMetaActionId].p_fn_ucMetaActionFunction=p_fn_ucMetaActionFunction;
strcpy(a_stMetaActionTable[eMetaActionId].szMetaActionTypeParam,szMetaActionTypeParam);
}
else
{
char str[C_MAX_LENGTH_STRING];
sprintf(str,"Error while defining %s metaaction in %s\n",a_stMetaActionTable[eMetaActionId].szMetaActionScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalInvalidAction,str);
}
}
#endif /* OPTIMIZED_COMMAND*/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
void fn_vInitMetaActionTable(tdp_fn_p_stMetaActionInitFunctionPtr fn_p_stDefaultActionInitFunctionPointer,tdp_fn_ucMetaActionFunctionPtr fn_ucDefaultActionFunctionPointer)
{
short wActionEntry;
for(wActionEntry=0;wActionEntry<fn_eGetNbMetaAction();wActionEntry++)
{
fn_vDefineMetaActionEntry(M_METAACTION_ENTRY((enum tdeMetaActionId_) wActionEntry,"","","",fn_p_stDefaultActionInitFunctionPointer,fn_ucDefaultActionFunctionPointer,USE_NO_PARAM));
}
}
void fn_vCheckMetaActionTable(tdp_fn_p_stMetaActionInitFunctionPtr fn_p_stDefaultActionInitFunctionPointer,tdp_fn_ucMetaActionFunctionPtr fn_ucDefaultActionFunctionPointer)
{
short wActionEntry;
char str[C_MAX_LENGTH_STRING];
size_t lLen;
size_t lMaxLengthScriptName=0;
#if defined(ACTIVE_EDITOR)
size_t lMaxLengthEditorName=0;
#endif /* ACTIVE_EDITOR*/
size_t lMaxLengthParam=0;
for(wActionEntry=0;wActionEntry<fn_eGetNbMetaAction();wActionEntry++)
{
fn_p_stDefaultActionInitFunctionPointer=fn_p_stDefaultActionInitFunctionPointer;
if ( /*(fn_p_fn_pGetMetaActionInitFunctionPtr((enum tdeMetaActionId_) wActionEntry)==fn_p_stDefaultActionInitFunctionPointer) ||*/
(fn_p_fn_pGetMetaActionFunctionPtr((enum tdeMetaActionId_) wActionEntry)==fn_ucDefaultActionFunctionPointer)
)
{
sprintf(str,"Error while defining %s metaaction in %s\n",a_stMetaActionTable[wActionEntry].szMetaActionScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalInvalidAction,str);
}
if ((lLen=strlen(a_stMetaActionTable[wActionEntry].szMetaActionScriptName))>lMaxLengthScriptName)
{
lMaxLengthScriptName=lLen;
}
#if defined(ACTIVE_EDITOR)
if ((lLen=strlen(a_stMetaActionTable[wActionEntry].szMetaActionEditorName))>lMaxLengthEditorName)
{
lMaxLengthEditorName=lLen;
}
#endif /* ACTIVE_EDITOR*/
if ((lLen=strlen(a_stMetaActionTable[wActionEntry].szMetaActionTypeParam))>lMaxLengthParam)
{
lMaxLengthParam=lLen;
}
}
#if !defined(U64)
{
if (lMaxLengthScriptName<C_MAX_SIZE_META_ACTION_SCRIPT_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_META_ACTION_SCRIPT_NAME in %s to %d\n",__FILE__,lMaxLengthScriptName);
OutputDebugString(str);
}
#if defined(ACTIVE_EDITOR)
if (lMaxLengthEditorName<C_MAX_SIZE_META_ACTION_EDITOR_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_META_ACTION_EDITOR_NAME in %s to %d\n",__FILE__,lMaxLengthEditorName);
OutputDebugString(str);
}
#endif /* ACTIVE_EDITOR*/
if (lMaxLengthParam<C_MAX_NB_META_ACTION_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_NB_META_ACTION_PARAM in %s to %d\n",__FILE__,lMaxLengthParam);
OutputDebugString(str);
}
}
#endif /* U64*/
}
#endif /* __DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,384 @@
#if defined(_AI_LIB_)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "EnumCond.h"
#if defined(OPTIMIZED_COMMAND)
#include "ProtCond.h"
#endif
#else
#include <string.h>
#include "specif/AIOption.h"
#include "ConvCst.h"
#include "EnumCond.h"
#include "ConvCond.h"
#endif /* _AI_LIB_*/
#define C_MAX_SIZE_CONDITION_EDITOR_NAME 50
#define C_MAX_SIZE_CONDITION_SCRIPT_NAME 40
#define C_MAX_CONDITION_NB_PARAM 4
typedef struct tdstConditionEntry_
{
#if defined(ACTIVE_EDITOR)
/* Condition string used in editor*/
char szConditionEditorName[C_MAX_SIZE_CONDITION_EDITOR_NAME+1];
char szConditionEditorName_En[C_MAX_SIZE_CONDITION_EDITOR_NAME+1];
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
/* Condition string used in script*/
char szConditionScriptName[C_MAX_SIZE_CONDITION_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
/* pointer on Condition function*/
tdp_fn_p_stConditionFunctionPtr p_fn_p_stConditionFunction;
#endif /* _AI_LIB_*/
#if defined (AI_USE_SCRIPT) || defined (U64_AIDEBUG)
/* list of Condition parameters (taken from szAutorizedTypeParam) in parameter*/
char szConditionTypeInParam[C_MAX_CONDITION_NB_PARAM+1];
#endif /* AI_USE_SCRIPT */
unsigned char bUltraCondtionFlag;
#ifdef PROFILE_IA
unsigned long ulCallCtr;
unsigned long ulTimeCtr;
unsigned long ulOwnTimeCtr;
#endif /* PROFILE_IA*/
} tdstConditionEntry;
#ifdef PROFILE_IA
extern unsigned long ulIndice;
extern unsigned long p_ulTime[255];
extern FILE *file;
#endif /* PROFILE_IA*/
tdstConditionEntry a_stConditionTable[eNbCond]
#if defined(OPTIMIZED_COMMAND)
=
{
#ifdef U64_AIDEBUG
/* function pointers in DefCond.c, in params,ultra-able*/
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { d,e,f },
#include "DefCond.h"
}
#else /* U64_AIDEBUG*/
/* Conditions initialisation*/
#if defined (AI_USE_SCRIPT)
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { b,english,c,d,e,f },
#else
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { c,d,e,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { b,english,c,e,f },
#else
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { c,e,f },
#endif /* ACTIVE_EDITOR*/
#endif
#include "DefCond.h"
#undef M_DEFINE_CONDITION
}
#else /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { b,english,d,f },
#else
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { d,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { b,english,f },
#else
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) { f },
#endif /* ACTIVE_EDITOR*/
#endif
#include "DefCond.h"
#undef M_DEFINE_CONDITION
}
#endif /* AI_USE_SCRIPT */
#endif /* U64_AIDEBUG*/
#endif /* OPTIMIZED_COMMAND*/
;
#if ! defined(OPTIMIZED_COMMAND)
void fn_vSetConditionUltraOperator(enum tdeCondId_ eCondId,unsigned char bFlag)
{
a_stConditionTable[eCondId].bUltraCondtionFlag=bFlag;
}
#endif /* OPTIMIZED_COMMAND*/
unsigned char fn_ucGetConditionUltraOperator(enum tdeCondId_ eCondId)
{
return(a_stConditionTable[eCondId].bUltraCondtionFlag);
}
#if defined(_AI_LIB_)
tdp_fn_p_stConditionFunctionPtr fn_p_fn_pGetConditionFunctionPtr(enum tdeCondId_ eCondId)
{
return(a_stConditionTable[eCondId].p_fn_p_stConditionFunction);
}
#ifdef PROFILE_IA
void fn_vCondSaveTime(unsigned long ulTime, enum tdeCondId_ eCondId)
{
/* if level != 0, then stop time count of last function*/
if (ulIndice != 0)
{
p_ulTime[ulIndice - 1] = (ulTime - p_ulTime[ulIndice - 1]);
}
/* set time for this new function and add indice*/
p_ulTime[ulIndice++] = ulTime;
}
void fn_vCondComputeTime(unsigned long ulCurrentTime, unsigned long ulTime, enum tdeCondId_ eCondId)
{
/* compute total time for this function*/
a_stConditionTable[eCondId].ulCallCtr++;
a_stConditionTable[eCondId].ulTimeCtr += (ulCurrentTime - ulTime)/5;
/* compute own time for this function*/
ulIndice--;
/* compute the time for this function*/
a_stConditionTable[eCondId].ulOwnTimeCtr += ((ulCurrentTime - p_ulTime[ulIndice]) / 5);
p_ulTime[ulIndice] = 0;
if (ulIndice != 0)
{
/* level != 0, then restart previous function time*/
p_ulTime[ulIndice-1] = ulCurrentTime - p_ulTime[ulIndice-1];
}
}
void dumpCond()
{
int i;
char string[250];
strcpy(string,"x:\\cpa\\");
strcat(string,fn_p_szGetLevelName());
strcat(string,".txt");
file = fopen(string,"w");
if (file == NULL)
return;
fprintf(file,"name Count Time Own Time Rel Time Own Rel Time\n");
for (i=0;i<(long)eNbCond;i++)
{
if (a_stConditionTable[i].ulCallCtr)
{
fprintf(file,"%s %i %i %i %i %i\n",
a_stConditionTable[i].szConditionScriptName,
a_stConditionTable[i].ulCallCtr,
a_stConditionTable[i].ulTimeCtr,
a_stConditionTable[i].ulOwnTimeCtr,
a_stConditionTable[i].ulTimeCtr / a_stConditionTable[i].ulCallCtr,
a_stConditionTable[i].ulOwnTimeCtr / a_stConditionTable[i].ulCallCtr);
}
else
{
fprintf(file,"%s %i %i %i %i %i\n",
a_stConditionTable[i].szConditionScriptName,
0,
0,
0,
0,
0);
}
}
fclose(file);
}
void clearCond()
{
int i;
for (i=0;i<(long)eNbCond;i++)
{
a_stConditionTable[i].ulCallCtr = 0;
a_stConditionTable[i].ulTimeCtr = 0;
a_stConditionTable[i].ulOwnTimeCtr = 0;
}
ulIndice = 0;
}
#endif /* PROFILE_IA*/
#endif /* _AI_LIB_*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeCondId_ fn_eGetNbCond()
{
return(eNbCond);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(__DEBUG_AI__) || defined (U64_AIDEBUG)
char *szGetConditionTypeInParamFromId(enum tdeCondId_ eCondId)
{
return(a_stConditionTable[eCondId].szConditionTypeInParam);
}
#endif /* __DEBUG_AI__*/
#if defined(ACTIVE_EDITOR)
char *szGetConditionTypeOutParamFromId(enum tdeCondId_ eCondId)
{
eCondId=eCondId;
return(USE_BOOLEAN_PARAM);
}
enum tdeCondId_ fn_eFindConditionIdFromEditorName(char *szCondition)
{
short wConditionEntry;
for(wConditionEntry=0;wConditionEntry<fn_eGetNbCond();wConditionEntry++)
{
if (!stricmp(a_stConditionTable[wConditionEntry].szConditionEditorName,szCondition))
{
return((enum tdeCondId_) wConditionEntry);
}
}
return(fn_eGetNbCond());
}
char *szFindConditionEditorNameFromId(enum tdeCondId_ eCondId)
{
return(a_stConditionTable[eCondId].szConditionEditorName);
}
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
char *szFindConditionScriptNameFromId(enum tdeCondId_ eCondId)
{
return(a_stConditionTable[eCondId].szConditionScriptName);
}
enum tdeCondId_ fn_eFindConditionIdFromScriptName(char *szCondition)
{
short wConditionEntry;
for(wConditionEntry=0;wConditionEntry<fn_eGetNbCond();wConditionEntry++)
{
if (!stricmp(a_stConditionTable[wConditionEntry].szConditionScriptName,szCondition))
{
return((enum tdeCondId_) wConditionEntry);
}
}
return(fn_eGetNbCond());
}
#endif /* AI_USE_SCRIPT */
#if !defined(OPTIMIZED_COMMAND)
#if defined(ACTIVE_EDITOR)
void fn_vDefineConditionEntry(enum tdeCondId_ eCondId,char *szConditionEditorName,char *szConditionEditorName_En,char *szConditionScriptName,tdp_fn_p_stConditionFunctionPtr p_fn_p_stConditionFunction,char *szConditionTypeInParam)
#else
void fn_vDefineConditionEntry(enum tdeCondId_ eCondId,char *szConditionScriptName,tdp_fn_p_stConditionFunctionPtr p_fn_p_stConditionFunction,char *szConditionTypeInParam)
#endif /* ACTIVE_EDITOR*/
{
if (
(eCondId<fn_eGetNbCond())
#if defined(ACTIVE_EDITOR)
&&(strlen(szConditionEditorName)<=C_MAX_SIZE_CONDITION_EDITOR_NAME)
#endif /* ACTIVE_EDITOR*/
&&(strlen(szConditionScriptName)<=C_MAX_SIZE_CONDITION_SCRIPT_NAME)
&&(strlen(szConditionTypeInParam)<=C_MAX_CONDITION_NB_PARAM)
&&(fn_ucCheckTypeParam(szConditionTypeInParam))
)
{
#if defined(ACTIVE_EDITOR)
strcpy(a_stConditionTable[eCondId].szConditionEditorName,szConditionEditorName);
#endif /* ACTIVE_EDITOR*/
strcpy(a_stConditionTable[eCondId].szConditionScriptName,szConditionScriptName);
a_stConditionTable[eCondId].p_fn_p_stConditionFunction=p_fn_p_stConditionFunction;
strcpy(a_stConditionTable[eCondId].szConditionTypeInParam,szConditionTypeInParam);
}
else
{
char str[C_MAX_LENGTH_STRING];
sprintf(str,"Error while defining %s condition in %s\n",szConditionScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidCondition,str);
}
}
#endif /* OPTIMIZED_COMMAND*/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
void fn_vInitConditionTable(tdp_fn_p_stConditionFunctionPtr p_fn_p_stDefaultConditionFunctionPointer)
{
short wConditionEntry;
for(wConditionEntry=0;wConditionEntry<fn_eGetNbCond();wConditionEntry++)
{
fn_vDefineConditionEntry(M_CONDITION_ENTRY((enum tdeCondId_) wConditionEntry,"","","",p_fn_p_stDefaultConditionFunctionPointer,USE_NO_PARAM));
/* ULTRA OPERATOR USAGE : FALSE AS A DEFAULT*/
fn_vSetConditionUltraOperator((enum tdeCondId_) wConditionEntry,NOT_ULTRA_ABLE);
}
}
void fn_vCheckConditionTable(tdp_fn_p_stConditionFunctionPtr p_fn_p_stDefaultConditionFunctionPointer)
{
short wConditionEntry;
char str[C_MAX_LENGTH_STRING];
size_t lLen;
size_t lMaxLengthScriptName=0;
#if defined(ACTIVE_EDITOR)
size_t lMaxLengthEditorName=0;
#endif /* ACTIVE_EDITOR*/
size_t lMaxLengthInParam=0;
for(wConditionEntry=0;wConditionEntry<fn_eGetNbCond();wConditionEntry++)
{
if (fn_p_fn_pGetConditionFunctionPtr((enum tdeCondId_) wConditionEntry)==p_fn_p_stDefaultConditionFunctionPointer)
{
sprintf(str,"Error while defining %s condition in %s\n",a_stConditionTable[wConditionEntry].szConditionScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidCondition,str);
}
if ((lLen=strlen(a_stConditionTable[wConditionEntry].szConditionScriptName))>lMaxLengthScriptName)
{
lMaxLengthScriptName=lLen;
}
#if defined(ACTIVE_EDITOR)
if ((lLen=strlen(a_stConditionTable[wConditionEntry].szConditionEditorName))>lMaxLengthEditorName)
{
lMaxLengthEditorName=lLen;
}
#endif /* ACTIVE_EDITOR*/
if ((lLen=strlen(a_stConditionTable[wConditionEntry].szConditionTypeInParam))>lMaxLengthInParam)
{
lMaxLengthInParam=lLen;
}
}
#if !defined(U64)
{
if (lMaxLengthScriptName<C_MAX_SIZE_CONDITION_SCRIPT_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_CONDITION_SCRIPT_NAME in %s to %d\n",__FILE__,lMaxLengthScriptName);
OutputDebugString(str);
}
#if defined(ACTIVE_EDITOR)
if (lMaxLengthEditorName<C_MAX_SIZE_CONDITION_EDITOR_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_CONDITION_EDITOR_NAME in %s to %d\n",__FILE__,lMaxLengthEditorName);
OutputDebugString(str);
}
#endif /* ACTIVE_EDITOR*/
if (lMaxLengthInParam<C_MAX_CONDITION_NB_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_CONDITION_NB_PARAM in %s to %d\n",__FILE__,lMaxLengthInParam);
OutputDebugString(str);
}
}
#endif /* U64*/
}
#endif /* __DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,280 @@
#if defined(_AI_LIB_)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "EnumFild.h"
#include "VarType.h"
#include "ProtFild.h"
#else
#include <string.h>
#include "specif/AIOption.h"
#include "ConvCst.h"
#include "EnumFild.h"
#include "VarType.h"
#include "ConvFild.h"
#endif /* _AI_LIB_*/
#define C_MAX_SIZE_FIELD_SCRIPT_NAME 19
#define C_MAX_SIZE_FIELD_EDITOR_NAME 30
typedef struct tdstFieldEntry_
{
#if defined(ACTIVE_EDITOR)
char szFieldEditorName[C_MAX_SIZE_FIELD_EDITOR_NAME+1];
char szFieldEditorName_En[C_MAX_SIZE_FIELD_EDITOR_NAME+1];
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
char szFieldScriptName[C_MAX_SIZE_FIELD_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
enum tdeFieldTypeId_ eType;
#if defined(_AI_LIB_)
tdp_fn_cGetFunctionPtr p_fn_cGetFieldFunction;
tdp_fn_cSetFunctionPtr p_fn_cSetFieldFunction;
#endif /* _AI_LIB_*/
} tdstFieldEntry;
tdstFieldEntry a_stFieldTable[eNbField]
#if defined(OPTIMIZED_COMMAND)
=
{
/* Procedure initialisation */
#if defined (AI_USE_SCRIPT)
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) { b,english,c,d,e,f },
#else
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) { c,d,e,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) { b,english,c,d },
#else
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) { c,d },
#endif /* ACTIVE_EDITOR*/
#endif
#else /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) { b,english,d,e,f },
#else
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) { d,e,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) { b,english,d },
#else
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) { d },
#endif /* ACTIVE_EDITOR*/
#endif
#endif /* AI_USE_SCRIPT */
#include "DefFild.h"
#undef M_DEFINE_FIELD
}
#endif /* OPTIMIZED_COMMAND*/
;
typedef struct tdstFieldTypeEntry_
{
enum tdeVariableType_ eType;
#if defined(_AI_LIB_)
tdp_fn_vGetTypeFunctionPtr fn_p_fn_vGetTypeFunction;
tdp_fn_vSetTypeFunctionPtr fn_p_fn_vSetTypeFunction;
#endif
} tdstFieldTypeEntry;
tdstFieldTypeEntry a_stFieldTypeTable[eNbFieldType]=
{
#if defined(_AI_LIB_)
#define M_DEFINE_FIELD_TYPE(a,b,c,d) {b,c,d},
/*#define M_DEFINE_FIELD_TYPE(a,b,c,d) {b,NULL,NULL},*/
#else
#define M_DEFINE_FIELD_TYPE(a,b,c,d) {b,},
#endif
#include "FildType.h"
#undef M_DEFINE_FIELD_TYPE
};
#if defined(_AI_LIB_)
tdp_fn_vGetTypeFunctionPtr fn_p_fn_pGetFieldTypeGetFunctionPtr(enum tdeFieldTypeId_ eFieldTypeId)
{
return(a_stFieldTypeTable[eFieldTypeId].fn_p_fn_vGetTypeFunction);
}
tdp_fn_vSetTypeFunctionPtr fn_p_fn_pGetFieldTypeSetFunctionPtr(enum tdeFieldTypeId_ eFieldTypeId)
{
return(a_stFieldTypeTable[eFieldTypeId].fn_p_fn_vSetTypeFunction);
}
#endif
enum tdeFieldTypeId_ fn_eGetEngineFieldType(enum tdeFieldId_ eFieldId)
{
return(a_stFieldTable[eFieldId].eType);
}
/*tempo //#if defined(ACTIVE_EDITOR)*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeVariableType_ fn_eGetFieldType(enum tdeFieldId_ eFieldId)
{
return(a_stFieldTypeTable[a_stFieldTable[eFieldId].eType].eType);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*#endif*/
/**/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeFieldId_ fn_eGetNbField()
{
return(eNbField);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined (AI_USE_SCRIPT)
enum tdeFieldId_ fn_eFindFieldIdFromScriptName(char *szField)
{
short wFieldEntry;
for(wFieldEntry=0;wFieldEntry<fn_eGetNbField();wFieldEntry++)
{
if (!stricmp(a_stFieldTable[wFieldEntry].szFieldScriptName,szField))
{
return((enum tdeFieldId_) wFieldEntry);
}
}
return(fn_eGetNbField());
}
#endif /* AI_USE_SCRIPT */
#if defined(ACTIVE_EDITOR)
enum tdeFieldId_ fn_eFindFieldIdFromEditorName(char *szField)
{
short wFieldEntry;
for(wFieldEntry=0;wFieldEntry<fn_eGetNbField();wFieldEntry++)
{
if (!stricmp(a_stFieldTable[wFieldEntry].szFieldEditorName,szField))
{
return((enum tdeFieldId_) wFieldEntry);
}
}
return(fn_eGetNbField());
}
char *szFindFieldScriptNameFromId(enum tdeFieldId_ eFieldId)
{
return(a_stFieldTable[eFieldId].szFieldScriptName);
}
char *szFindFieldEditorNameFromId(enum tdeFieldId_ eFieldId)
{
return(a_stFieldTable[eFieldId].szFieldEditorName);
}
#endif /* ACTIVE_EDITOR*/
#if !defined(OPTIMIZED_COMMAND)
#if defined(ACTIVE_EDITOR)
void fn_vDefineFieldEntry(enum tdeFieldId_ eFieldId,char *szFieldEditorName,char *szFieldEditorName_En,char *szFieldScriptName,enum tdeFieldTypeId_ eType,tdp_fn_cGetFunctionPtr p_fn_cGetFieldFunction,tdp_fn_cSetFunctionPtr p_fn_cSetFieldFunction)
#else
void fn_vDefineFieldEntry(enum tdeFieldId_ eFieldId,char *szFieldScriptName,enum tdeFieldTypeId_ eType,tdp_fn_cGetFunctionPtr p_fn_cGetFieldFunction,tdp_fn_cSetFunctionPtr p_fn_cSetFieldFunction)
#endif /* ACTIVE_EDITOR*/
{
if (
(eFieldId<fn_eGetNbField())
#if defined(ACTIVE_EDITOR)
&&(strlen(szFieldEditorName)<=C_MAX_SIZE_FIELD_EDITOR_NAME)
#endif /* ACTIVE_EDITOR*/
&&(strlen(szFieldScriptName)<=C_MAX_SIZE_FIELD_SCRIPT_NAME)
&&(p_fn_cGetFieldFunction!=NULL)
&&(p_fn_cSetFieldFunction!=NULL)
)
{
#if defined(ACTIVE_EDITOR)
strcpy(a_stFieldTable[eFieldId].szFieldEditorName,szFieldEditorName);
#endif /* ACTIVE_EDITOR*/
strcpy(a_stFieldTable[eFieldId].szFieldScriptName,szFieldScriptName);
a_stFieldTable[eFieldId].p_fn_cSetFieldFunction=p_fn_cSetFieldFunction;
a_stFieldTable[eFieldId].p_fn_cGetFieldFunction=p_fn_cGetFieldFunction;
a_stFieldTable[eFieldId].eType=eType;
}
else
{
char str[C_MAX_LENGTH_STRING];
sprintf(str,"Error while defining %s field in %s\n",szFieldScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidField,str);
}
}
#endif /* OPTIMIZED_COMMAND*/
#if defined(_AI_LIB_)
tdp_fn_cGetFunctionPtr fn_p_fn_pGetFieldGetFunctionPtr(enum tdeFieldId_ eFieldId)
{
return(a_stFieldTable[eFieldId].p_fn_cGetFieldFunction);
}
tdp_fn_cSetFunctionPtr fn_p_fn_pGetFieldSetFunctionPtr(enum tdeFieldId_ eFieldId)
{
return(a_stFieldTable[eFieldId].p_fn_cSetFieldFunction);
}
#endif /* _AI_LIB_*/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
void fn_vInitFieldTable(tdp_fn_cGetFunctionPtr fn_cGetFieldDefaultFunctionPointer,tdp_fn_cSetFunctionPtr fn_cSetFieldDefaultFunctionPointer)
{
short wFieldEntry;
for(wFieldEntry=0;wFieldEntry<fn_eGetNbField();wFieldEntry++)
{
fn_vDefineFieldEntry(M_FIELD_ENTRY((enum tdeFieldId_) wFieldEntry,"","","",eFieldType_Integer,fn_cGetFieldDefaultFunctionPointer,fn_cSetFieldDefaultFunctionPointer));
}
}
void fn_vCheckFieldTable(tdp_fn_cGetFunctionPtr fn_cGetFieldDefaultFunctionPointer,tdp_fn_cSetFunctionPtr fn_cSetFieldDefaultFunctionPointer)
{
short wFieldEntry;
char str[C_MAX_LENGTH_STRING];
size_t lLen;
size_t lMaxLengthScriptName=0;
#if defined(ACTIVE_EDITOR)
size_t lMaxLengthEditorName=0;
#endif /* ACTIVE_EDITOR*/
for(wFieldEntry=0;wFieldEntry<fn_eGetNbField();wFieldEntry++)
{
if ((lLen=strlen(a_stFieldTable[wFieldEntry].szFieldScriptName))>lMaxLengthScriptName)
{
lMaxLengthScriptName=lLen;
}
#if defined(ACTIVE_EDITOR)
if ((lLen=strlen(a_stFieldTable[wFieldEntry].szFieldEditorName))>lMaxLengthEditorName)
{
lMaxLengthEditorName=lLen;
}
#endif /* ACTIVE_EDITOR*/
}
#if !defined(U64)
{
if (lMaxLengthScriptName<C_MAX_SIZE_FIELD_SCRIPT_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_FIELD_SCRIPT_NAME in %s to %d\n",__FILE__,lMaxLengthScriptName);
OutputDebugString(str);
}
#if defined(ACTIVE_EDITOR)
if (lMaxLengthEditorName<C_MAX_SIZE_FIELD_EDITOR_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_FIELD_EDITOR_NAME in %s to %d\n",__FILE__,lMaxLengthEditorName);
OutputDebugString(str);
}
#endif /* ACTIVE_EDITOR*/
}
#endif /* U64*/
}
#endif /* __DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,403 @@
#if defined(_AI_LIB_)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "EnumFunc.h"
#if defined(OPTIMIZED_COMMAND)
#include "ProtFunc.h"
#endif
#else
#include <string.h>
#include "specif/AIOption.h"
#include "ConvCst.h"
#include "EnumFunc.h"
#include "ConvFunc.h"
#endif /* _AI_LIB_*/
#define C_MAX_SIZE_FUNCTION_EDITOR_NAME 50
#define C_MAX_SIZE_FUNCTION_SCRIPT_NAME 41
#define C_MAX_FUNCTION_NB_IN_PARAM 7 /*ANNECY BBB 4 -> 7 */
#define C_MAX_FUNCTION_NB_OUT_PARAM 1
typedef struct tdstFunctionEntry_
{
#if defined(ACTIVE_EDITOR)
/* Function string used in editor*/
char szFunctionEditorName[C_MAX_SIZE_FUNCTION_EDITOR_NAME+1];
char szFunctionEditorName_En[C_MAX_SIZE_FUNCTION_EDITOR_NAME+1];
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
/* Function string used in script*/
char szFunctionScriptName[C_MAX_SIZE_FUNCTION_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
/* pointer on Function function*/
tdp_fn_p_stFunctionFunctionPtr p_fn_p_stFunctionFunction;
#endif /* _AI_LIB_*/
#if defined (AI_USE_SCRIPT) || defined (U64_AIDEBUG)
/* list of Function parameters (taken from szAutorizedTypeParam) in parameter*/
char szFunctionTypeInParam[C_MAX_FUNCTION_NB_IN_PARAM+1];
/* out parameter*/
char szFunctionTypeOutParam[C_MAX_FUNCTION_NB_OUT_PARAM+1];
#endif /* AI_USE_SCRIPT */
unsigned char bUltraFunctionFlag;
#ifdef PROFILE_IA
unsigned long ulCallCtr;
unsigned long ulTimeCtr;
unsigned long ulOwnTimeCtr;
#endif /* PROFILE_IA*/
} tdstFunctionEntry;
#ifdef PROFILE_IA
extern unsigned long ulIndice;
extern unsigned long p_ulTime[255];
extern FILE *file;
#endif /* PROFILE_IA*/
tdstFunctionEntry a_stFunctionTable[eNbFunc]
#if defined(OPTIMIZED_COMMAND)
=
{
#ifdef U64_AIDEBUG
/* function pointers in Function.c, in params, out param ,ultra-able*/
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { d,e,f,g },
#include "DefFunc.h"
}
#else /* U64_AIDEBUG*/
#if defined (AI_USE_SCRIPT)
/* Function initialisation*/
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { b,english,c,d,e,f,g },
#else
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { c,d,e,f,g },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { b,english,c,e,f,g },
#else
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { c,e,f,g },
#endif /* ACTIVE_EDITOR*/
#endif
#include "DefFunc.h"
#undef M_DEFINE_FUNCTION
}
#else /* AI_USE_SCRIPT */
/* Function initialisation*/
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { b,english,d,g },
#else
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { d,g },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { b,english,g },
#else
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) { g },
#endif /* ACTIVE_EDITOR*/
#endif
#include "DefFunc.h"
#undef M_DEFINE_FUNCTION
}
#endif /* AI_USE_SCRIPT */
#endif /* U64_AIDEBUG*/
#endif /* OPTIMIZED_COMMAND*/
;
#if ! defined(OPTIMIZED_COMMAND)
void fn_vSetFunctionUltraOperator(enum tdeFuncId_ eFuncId,unsigned char bFlag)
{
a_stFunctionTable[eFuncId].bUltraFunctionFlag=bFlag;
};
#endif /* OPTIMIZED_COMMAND*/
unsigned char fn_ucGetFunctionUltraOperator(enum tdeFuncId_ eFuncId)
{
return(a_stFunctionTable[eFuncId].bUltraFunctionFlag);
}
#if defined(_AI_LIB_)
tdp_fn_p_stFunctionFunctionPtr fn_p_fn_pGetFunctionFunctionPtr(enum tdeFuncId_ eFuncId)
{
return(a_stFunctionTable[eFuncId].p_fn_p_stFunctionFunction);
}
#ifdef PROFILE_IA
void fn_vFuncSaveTime(unsigned long ulTime, enum tdeFuncId_ eFuncId)
{
/* if level != 0, then stop time count of last function*/
if (ulIndice != 0)
{
p_ulTime[ulIndice - 1] = (ulTime - p_ulTime[ulIndice - 1]);
}
/* set time for this new function and add indice*/
p_ulTime[ulIndice++] = ulTime;
}
void fn_vFuncComputeTime(unsigned long ulCurrentTime, unsigned long ulTime, enum tdeFuncId_ eFuncId)
{
/* compute total time for this function*/
a_stFunctionTable[eFuncId].ulCallCtr++;
a_stFunctionTable[eFuncId].ulTimeCtr += (ulCurrentTime - ulTime)/5;
/* compute own time for this function*/
ulIndice--;
/* compute the time for this function*/
a_stFunctionTable[eFuncId].ulOwnTimeCtr += ((ulCurrentTime - p_ulTime[ulIndice]) / 5);
p_ulTime[ulIndice] = 0;
if (ulIndice != 0)
{
/* level != 0, then restart previous function time*/
p_ulTime[ulIndice-1] = ulCurrentTime - p_ulTime[ulIndice-1];
}
}
void dumpFunc()
{
int i;
char string[250];
strcpy(string,"x:\\cpa\\");
strcat(string,fn_p_szGetLevelName());
strcat(string,".txt");
file = fopen(string,"a+");
if (file == NULL)
return;
for (i=0;i<(long)eNbFunc;i++)
{
if (a_stFunctionTable[i].ulCallCtr)
{
fprintf(file,"%s %i %i %i %i %i\n",
a_stFunctionTable[i].szFunctionScriptName,
a_stFunctionTable[i].ulCallCtr,
a_stFunctionTable[i].ulTimeCtr,
a_stFunctionTable[i].ulOwnTimeCtr,
a_stFunctionTable[i].ulTimeCtr / a_stFunctionTable[i].ulCallCtr,
a_stFunctionTable[i].ulOwnTimeCtr / a_stFunctionTable[i].ulCallCtr);
}
else
{
fprintf(file,"%s %i %i %i %i %i\n",
a_stFunctionTable[i].szFunctionScriptName,
0,
0,
0,
0,
0);
}
}
fclose(file);
}
void clearFunc()
{
int i;
for (i=0;i<(long)eNbFunc;i++)
{
a_stFunctionTable[i].ulCallCtr = 0;
a_stFunctionTable[i].ulTimeCtr = 0;
a_stFunctionTable[i].ulOwnTimeCtr = 0;
}
}
#endif /* PROFILE_IA*/
#endif /* _AI_LIB_*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeFuncId_ fn_eGetNbFunc()
{
return(eNbFunc);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined (AI_USE_SCRIPT) || defined (U64_AIDEBUG)
char *szGetFunctionTypeInParamFromId(enum tdeFuncId_ eFuncId)
{
return(a_stFunctionTable[eFuncId].szFunctionTypeInParam);
}
#endif /* AI_USE_SCRIPT */
#if defined(__DEBUG_AI__) || defined(ACTIVE_EDITOR)
char *szFindFunctionScriptNameFromId(enum tdeFuncId_ eFuncId)
{
return(a_stFunctionTable[eFuncId].szFunctionScriptName);
}
#endif /* __DEBUG_AI__ ACTIVE_EDITOR*/
#if defined(ACTIVE_EDITOR) || defined (U64_AIDEBUG)
char *szGetFunctionTypeOutParamFromId(enum tdeFuncId_ eFuncId)
{
return(a_stFunctionTable[eFuncId].szFunctionTypeOutParam);
}
#endif /* ACTIVE_EDITOR */
#if defined(ACTIVE_EDITOR)
char *szFindFunctionEditorNameFromId(enum tdeFuncId_ eFuncId)
{
return(a_stFunctionTable[eFuncId].szFunctionEditorName);
}
enum tdeFuncId_ fn_eFindFunctionIdFromEditorName(char *szFunction)
{
short wFunctionEntry;
for(wFunctionEntry=0;wFunctionEntry<fn_eGetNbFunc();wFunctionEntry++)
{
if (!stricmp(a_stFunctionTable[wFunctionEntry].szFunctionEditorName,szFunction))
{
return((enum tdeFuncId_) wFunctionEntry);
}
}
return(fn_eGetNbFunc());
}
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
enum tdeFuncId_ fn_eFindFunctionIdFromScriptName(char *szFunction)
{
short wFunctionEntry;
for(wFunctionEntry=0;wFunctionEntry<fn_eGetNbFunc();wFunctionEntry++)
{
if (!stricmp(a_stFunctionTable[wFunctionEntry].szFunctionScriptName,szFunction))
{
return((enum tdeFuncId_) wFunctionEntry);
}
}
return(fn_eGetNbFunc());
}
#endif /* AI_USE_SCRIPT */
#if !defined(OPTIMIZED_COMMAND)
#if defined(ACTIVE_EDITOR)
void fn_vDefineFunctionEntry(enum tdeFuncId_ eFuncId,char *szFunctionEditorName,char *szFunctionEditorName_En,char *szFunctionScriptName,tdp_fn_p_stFunctionFunctionPtr p_fn_p_stFunctionFunction,char *szFunctionTypeInParam,char *szFunctionTypeOutParam)
#else
void fn_vDefineFunctionEntry(enum tdeFuncId_ eFuncId,char *szFunctionScriptName,tdp_fn_p_stFunctionFunctionPtr p_fn_p_stFunctionFunction,char *szFunctionTypeInParam,char *szFunctionTypeOutParam)
#endif /* ACTIVE_EDITOR*/
{
if (
(eFuncId<fn_eGetNbFunc())
#if defined(ACTIVE_EDITOR)
&&(strlen(szFunctionEditorName)<=C_MAX_SIZE_FUNCTION_EDITOR_NAME)
#endif /* ACTIVE_EDITOR*/
&&(strlen(szFunctionScriptName)<=C_MAX_SIZE_FUNCTION_SCRIPT_NAME)
&&(strlen(szFunctionTypeInParam)<=C_MAX_FUNCTION_NB_IN_PARAM)
&&(fn_ucCheckTypeParam(szFunctionTypeInParam))
&&(strlen(szFunctionTypeOutParam)<=C_MAX_FUNCTION_NB_OUT_PARAM)
&&(fn_ucCheckTypeParam(szFunctionTypeOutParam))
)
{
#if defined(ACTIVE_EDITOR)
strcpy(a_stFunctionTable[eFuncId].szFunctionEditorName,szFunctionEditorName);
#endif /* ACTIVE_EDITOR*/
strcpy(a_stFunctionTable[eFuncId].szFunctionScriptName,szFunctionScriptName);
a_stFunctionTable[eFuncId].p_fn_p_stFunctionFunction=p_fn_p_stFunctionFunction;
strcpy(a_stFunctionTable[eFuncId].szFunctionTypeInParam,szFunctionTypeInParam);
strcpy(a_stFunctionTable[eFuncId].szFunctionTypeOutParam,szFunctionTypeOutParam);
}
else
{
char str[C_MAX_LENGTH_STRING];
sprintf(str,"Error while defining %s function in %s\n",szFunctionScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidFunction,str);
}
}
#endif /* OPTIMIZED_COMMAND*/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
void fn_vInitFunctionTable(tdp_fn_p_stFunctionFunctionPtr fn_p_stDefaultFunctionFunctionPointer)
{
short wFunctionEntry;
for(wFunctionEntry=0;wFunctionEntry<fn_eGetNbFunc();wFunctionEntry++)
{
fn_vDefineFunctionEntry(M_FUNCTION_ENTRY((enum tdeFuncId_) wFunctionEntry,"","","",fn_p_stDefaultFunctionFunctionPointer,USE_NO_PARAM,USE_NO_PARAM));
/* ULTRA OPERATOR USAGE : FALSE AS A DEFAULT*/
fn_vSetFunctionUltraOperator((enum tdeFuncId_) wFunctionEntry,NOT_ULTRA_ABLE);
}
}
void fn_vCheckFunctionTable(tdp_fn_p_stFunctionFunctionPtr fn_p_stDefaultFunctionFunctionPointer)
{
short wFunctionEntry;
char str[C_MAX_LENGTH_STRING];
size_t lLen;
size_t lMaxLengthScriptName=0;
#if defined(ACTIVE_EDITOR)
size_t lMaxLengthEditorName=0;
#endif /* ACTIVE_EDITOR*/
size_t lMaxLengthInParam=0;
size_t lMaxLengthOutParam=0;
for(wFunctionEntry=0;wFunctionEntry<fn_eGetNbFunc();wFunctionEntry++)
{
if (fn_p_fn_pGetFunctionFunctionPtr((enum tdeFuncId_) wFunctionEntry)==fn_p_stDefaultFunctionFunctionPointer)
{
sprintf(str,"Error while defining %s function in %s\n",a_stFunctionTable[wFunctionEntry].szFunctionScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidFunction,str);
}
if ((lLen=strlen(a_stFunctionTable[wFunctionEntry].szFunctionScriptName))>lMaxLengthScriptName)
{
lMaxLengthScriptName=lLen;
}
#if defined(ACTIVE_EDITOR)
if ((lLen=strlen(a_stFunctionTable[wFunctionEntry].szFunctionEditorName))>lMaxLengthEditorName)
{
lMaxLengthEditorName=lLen;
}
#endif /* ACTIVE_EDITOR*/
if ((lLen=strlen(a_stFunctionTable[wFunctionEntry].szFunctionTypeInParam))>lMaxLengthInParam)
{
lMaxLengthInParam=lLen;
}
if ((lLen=strlen(a_stFunctionTable[wFunctionEntry].szFunctionTypeOutParam))>lMaxLengthOutParam)
{
lMaxLengthOutParam=lLen;
}
}
#if !defined(U64)
{
if (lMaxLengthScriptName<C_MAX_SIZE_FUNCTION_SCRIPT_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_FUNCTION_SCRIPT_NAME in %s to %d\n",__FILE__,lMaxLengthScriptName);
OutputDebugString(str);
}
#if defined(ACTIVE_EDITOR)
if (lMaxLengthEditorName<C_MAX_SIZE_FUNCTION_EDITOR_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_FUNCTION_EDITOR_NAME in %s to %d\n",__FILE__,lMaxLengthEditorName);
OutputDebugString(str);
}
#endif /* ACTIVE_EDITOR*/
if (lMaxLengthInParam<C_MAX_FUNCTION_NB_IN_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_FUNCTION_NB_IN_PARAM in %s to %d\n",__FILE__,lMaxLengthInParam);
OutputDebugString(str);
}
if (lMaxLengthOutParam<C_MAX_FUNCTION_NB_OUT_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_FUNCTION_NB_OUT_PARAM in %s to %d\n",__FILE__,lMaxLengthOutParam);
OutputDebugString(str);
}
}
#endif /* U64*/
}
#endif /* __DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,288 @@
#if defined(_AI_LIB_)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "EnumKey.h"
#if defined(OPTIMIZED_COMMAND)
#include "ProtKey.h"
#endif
#else
#include <string.h>
#include "specif/AIOption.h"
#include "ConvCst.h"
#include "EnumKey.h"
#include "ConvKey.h"
#endif /* _AI_LIB_*/
#define C_MAX_SIZE_KEYWORD_EDITOR_NAME 17
#define C_MAX_SIZE_KEYWORD_SCRIPT_NAME 14
#define C_MAX_KEYWORD_NB_IN_PARAM 3
#define C_MAX_KEYWORD_NB_OUT_PARAM 1
typedef struct tdstKeyWordEntry_
{
#if defined(ACTIVE_EDITOR)
/* KeyWord string used in editor*/
char szKeyWordEditorName[C_MAX_SIZE_KEYWORD_EDITOR_NAME+1];
char szKeyWordEditorName_En[C_MAX_SIZE_KEYWORD_EDITOR_NAME+1];
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
/* KeyWord string used in script*/
char szKeyWordScriptName[C_MAX_SIZE_KEYWORD_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
/* pointer on KeyWord function*/
tdp_fn_p_stKeyWordFunctionPtr p_fn_p_stKeyWordFunction;
#endif /* _AI_LIB_*/
#if defined (AI_USE_SCRIPT)
/* list of KeyWord parameters (taken from szAutorizedTypeParam) in parameter*/
char szKeyWordTypeInParam[C_MAX_KEYWORD_NB_IN_PARAM+1];
/* list of KeyWord parameters (taken from szAutorizedTypeParam) out parameter*/
char szKeyWordTypeOutParam[C_MAX_KEYWORD_NB_OUT_PARAM+1];
#endif /* AI_USE_SCRIPT */
} tdstKeyWordEntry;
tdstKeyWordEntry a_stKeyWordTable[eNbKeyWord]
#if defined(OPTIMIZED_COMMAND)
=
{
#if defined (AI_USE_SCRIPT)
/* KeyWords initialisation*/
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) { b,english,c,d,e,f },
#else
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) { c,d,e,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) { b,english,c,e,f },
#else
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) { c,e,f },
#endif
#endif /* _AI_LIB_ */
#include "DefKey.h"
#undef M_DEFINE_KEYWORD
}
#else /* AI_USE_SCRIPT */
/* KeyWords initialisation*/
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) { b,english,d },
#else
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) { d },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) { b,english },
#else
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) { },
#endif
#endif /* _AI_LIB_ */
#include "DefKey.h"
#undef M_DEFINE_KEYWORD
}
#endif /* AI_USE_SCRIPT */
#endif /* OPTIMIZED_COMMAND*/
;
#if defined(_AI_LIB_)
tdp_fn_p_stKeyWordFunctionPtr fn_p_fn_pGetKeyWordFunctionPtr(enum tdeKeyWordId_ eKeyWordId)
{
return(a_stKeyWordTable[eKeyWordId].p_fn_p_stKeyWordFunction);
}
#endif
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeKeyWordId_ fn_eGetNbKeyWord()
{
return(eNbKeyWord);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(ACTIVE_EDITOR)
char *szGetKeyWordTypeInParamFromId(enum tdeKeyWordId_ eKeyWordId)
{
return(a_stKeyWordTable[eKeyWordId].szKeyWordTypeInParam);
}
char *szGetKeyWordTypeOutParamFromId(enum tdeKeyWordId_ eKeyWordId)
{
return(a_stKeyWordTable[eKeyWordId].szKeyWordTypeOutParam);
}
/* modif : enum tdeKeyWordId_ fn_eFindKeyWordIdFromEditorName(char *szKeyWord, int langage)*/
enum tdeKeyWordId_ fn_eFindKeyWordIdFromEditorName(char *szKeyWord)
{
short wKeyWordEntry;
for(wKeyWordEntry=0;wKeyWordEntry<fn_eGetNbKeyWord();wKeyWordEntry++)
{
if (!stricmp(a_stKeyWordTable[wKeyWordEntry].szKeyWordEditorName,szKeyWord))
{
return((enum tdeKeyWordId_) wKeyWordEntry);
}
}
return(fn_eGetNbKeyWord());
}
char *szFindKeyWordScriptNameFromId(enum tdeKeyWordId_ eKeyWordId)
{
return(a_stKeyWordTable[eKeyWordId].szKeyWordScriptName);
}
/* modif : char *szFindKeyWordEditorNameFromId(enum tdeKeyWordId_ eKeyWordId, int langage)*/
char *szFindKeyWordEditorNameFromId(enum tdeKeyWordId_ eKeyWordId)
{
return(a_stKeyWordTable[eKeyWordId].szKeyWordEditorName);
}
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
enum tdeKeyWordId_ fn_eFindKeyWordIdFromScriptName(char *szKeyWord)
{
short wKeyWordEntry;
for(wKeyWordEntry=0;wKeyWordEntry<fn_eGetNbKeyWord();wKeyWordEntry++)
{
if (!stricmp(a_stKeyWordTable[wKeyWordEntry].szKeyWordScriptName,szKeyWord))
{
return((enum tdeKeyWordId_) wKeyWordEntry);
}
}
return(fn_eGetNbKeyWord());
}
#endif /* AI_USE_SCRIPT */
#if !defined(OPTIMIZED_COMMAND)
#if defined(ACTIVE_EDITOR)
void fn_vDefineKeyWordEntry(enum tdeKeyWordId_ eKeyWordId,char *szKeyWordEditorName,char *szKeyWordEditorName_En,char *szKeyWordScriptName,tdp_fn_p_stKeyWordFunctionPtr p_fn_p_stKeyWordFunction,char *szKeyWordTypeInParam,char *szKeyWordTypeOutParam)
#else
void fn_vDefineKeyWordEntry(enum tdeKeyWordId_ eKeyWordId,char *szKeyWordScriptName,tdp_fn_p_stKeyWordFunctionPtr p_fn_p_stKeyWordFunction,char *szKeyWordTypeInParam,char *szKeyWordTypeOutParam)
#endif /* ACTIVE_EDITOR*/
{
if (
(eKeyWordId<fn_eGetNbKeyWord())
#if defined(ACTIVE_EDITOR)
&&(strlen(szKeyWordEditorName)<=C_MAX_SIZE_KEYWORD_EDITOR_NAME)
/* &&(strlen(szKeyWordEditorName_En)<=C_MAX_SIZE_KEYWORD_EDITOR_NAME)*/
#endif /* ACTIVE_EDITOR*/
&&(strlen(szKeyWordScriptName)<=C_MAX_SIZE_KEYWORD_SCRIPT_NAME)
&&(fn_ucCheckTypeParam(szKeyWordTypeInParam))
&&(strlen(szKeyWordTypeInParam)<=C_MAX_KEYWORD_NB_IN_PARAM)
&&(fn_ucCheckTypeParam(szKeyWordTypeOutParam))
&&(strlen(szKeyWordTypeOutParam)<=C_MAX_KEYWORD_NB_OUT_PARAM)
)
{
#if defined(ACTIVE_EDITOR)
strcpy(a_stKeyWordTable[eKeyWordId].szKeyWordEditorName,szKeyWordEditorName);
/* strcpy(a_stKeyWordTable[eKeyWordId].szKeyWordEditorName_En,szKeyWordEditorName_En);*/
#endif /* ACTIVE_EDITOR*/
strcpy(a_stKeyWordTable[eKeyWordId].szKeyWordScriptName,szKeyWordScriptName);
a_stKeyWordTable[eKeyWordId].p_fn_p_stKeyWordFunction=p_fn_p_stKeyWordFunction;
strcpy(a_stKeyWordTable[eKeyWordId].szKeyWordTypeInParam,szKeyWordTypeInParam);
strcpy(a_stKeyWordTable[eKeyWordId].szKeyWordTypeOutParam,szKeyWordTypeOutParam);
}
else
{
char str[C_MAX_LENGTH_STRING];
sprintf(str,"Error while defining %s keyword in %s\n",szKeyWordScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalUnknownKeyWord,str);
}
}
#endif /* OPTIMIZED_COMMAND*/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
void fn_vInitKeyWordTable(tdp_fn_p_stKeyWordFunctionPtr fn_p_stDefaultKeyWordFunctionPointer)
{
short wKeyWordEntry;
for(wKeyWordEntry=0;wKeyWordEntry<fn_eGetNbKeyWord();wKeyWordEntry++)
{
fn_vDefineKeyWordEntry(M_KEYWORD_ENTRY((enum tdeKeyWordId_) wKeyWordEntry,"","","",fn_p_stDefaultKeyWordFunctionPointer,USE_NO_PARAM,USE_NO_PARAM));
}
}
void fn_vCheckKeyWordTable(tdp_fn_p_stKeyWordFunctionPtr fn_p_stDefaultKeyWordFunctionPointer)
{
char str[C_MAX_LENGTH_STRING];
short wKeyWordEntry;
size_t lLen;
size_t lMaxLengthScriptName=0;
#if defined(ACTIVE_EDITOR)
size_t lMaxLengthEditorName=0;
#endif /* ACTIVE_EDITOR*/
size_t lMaxLengthInParam=0;
size_t lMaxLengthOutParam=0;
for(wKeyWordEntry=0;wKeyWordEntry<fn_eGetNbKeyWord();wKeyWordEntry++)
{
if (fn_p_fn_pGetKeyWordFunctionPtr((enum tdeKeyWordId_) wKeyWordEntry)==fn_p_stDefaultKeyWordFunctionPointer)
{
sprintf(str,"Error while defining %s keyword in %s\n",a_stKeyWordTable[wKeyWordEntry].szKeyWordScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalUnknownKeyWord,str);
}
if ((lLen=strlen(a_stKeyWordTable[wKeyWordEntry].szKeyWordScriptName))>lMaxLengthScriptName)
{
lMaxLengthScriptName=lLen;
}
#if defined(ACTIVE_EDITOR)
if ((lLen=strlen(a_stKeyWordTable[wKeyWordEntry].szKeyWordEditorName))>lMaxLengthEditorName)
{
lMaxLengthEditorName=lLen;
}
/*
if ((lLen=strlen(a_stKeyWordTable[wKeyWordEntry].szKeyWordEditorName_En))>lMaxLengthEditorName)
{
lMaxLengthEditorName=lLen;
}
*/
if ((lLen=strlen(a_stKeyWordTable[wKeyWordEntry].szKeyWordTypeInParam))>lMaxLengthInParam)
{
lMaxLengthInParam=lLen;
}
if ((lLen=strlen(a_stKeyWordTable[wKeyWordEntry].szKeyWordTypeOutParam))>lMaxLengthOutParam)
{
lMaxLengthOutParam=lLen;
}
#endif /* ACTIVE_EDITOR*/
}
#if !defined(U64)
{
if (lMaxLengthScriptName<C_MAX_SIZE_KEYWORD_SCRIPT_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_KEYWORD_SCRIPT_NAME in %s to %d\n",__FILE__,lMaxLengthScriptName);
OutputDebugString(str);
}
#if defined(ACTIVE_EDITOR)
if (lMaxLengthEditorName<C_MAX_SIZE_KEYWORD_EDITOR_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_KEYWORD_EDITOR_NAME in %s to %d\n",__FILE__,lMaxLengthEditorName);
OutputDebugString(str);
}
if (lMaxLengthInParam<C_MAX_KEYWORD_NB_IN_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_KEYWORD_NB_IN_PARAM in %s to %d\n",__FILE__,lMaxLengthInParam);
OutputDebugString(str);
}
if (lMaxLengthOutParam<C_MAX_KEYWORD_NB_OUT_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_KEYWORD_NB_OUT_PARAM in %s to %d\n",__FILE__,lMaxLengthOutParam);
OutputDebugString(str);
}
#endif /* ACTIVE_EDITOR*/
}
#endif /* U64*/
}
#endif /* __DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,282 @@
#if defined(_AI_LIB_)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "EnumOper.h"
#if defined(OPTIMIZED_COMMAND)
#include "ProtOper.h"
#endif
#else
#include <string.h>
#include "specif/AIOption.h"
#include "ConvCst.h"
#include "EnumOper.h"
#include "ConvOper.h"
#endif /* _AI_LIB_*/
#define C_MAX_SIZE_OPERATOR_EDITOR_NAME 4
#define C_MAX_SIZE_OPERATOR_SCRIPT_NAME 26
#define C_MAX_OPERATOR_NB_IN_PARAM 2
#define C_MAX_OPERATOR_NB_OUT_PARAM 1
typedef struct tdstOperatorEntry_
{
#if defined(ACTIVE_EDITOR)
/* Operator string used in editor*/
char szOperatorEditorName[C_MAX_SIZE_OPERATOR_EDITOR_NAME+1];
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
/* Operator string used in script*/
char szOperatorScriptName[C_MAX_SIZE_OPERATOR_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
/* pointer on Operator function*/
tdp_fn_p_stOperatorFunctionPtr p_fn_p_stOperatorFunction;
#endif /* _AI_LIB_*/
#if defined(ACTIVE_EDITOR)
/* list of Operator parameters (taken from szAutorizedTypeParam) in parameter*/
char szOperatorTypeInParam[C_MAX_OPERATOR_NB_IN_PARAM+1];
/* out parameter*/
char szOperatorTypeOutParam[C_MAX_OPERATOR_NB_OUT_PARAM+1];
#endif /* ACTIVE_EDITOR*/
} tdstOperatorEntry;
tdstOperatorEntry a_stOperatorTable[eNbOperator]
#if defined(OPTIMIZED_COMMAND)
=
{
#if defined (AI_USE_SCRIPT)
/* Conditions initialisation*/
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) { b,c,d,e,f },
#else
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) { c,d },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) { b,c,e,f },
#else
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) { c },
#endif /* ACTIVE_EDITOR*/
#endif
#include "DefOper.h"
#undef M_DEFINE_OPERATOR
}
#else /* AI_USE_SCRIPT */
/* Conditions initialisation*/
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) { b,d },
#else
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) { d },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) { b },
#else
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) { },
#endif /* ACTIVE_EDITOR*/
#endif
#include "DefOper.h"
#undef M_DEFINE_OPERATOR
}
#endif /* AI_USE_SCRIPT */
#endif /* OPTIMIZED_COMMAND*/
;
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeOperatorId_ fn_eGetNbOperator()
{
return(eNbOperator);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(_AI_LIB_)
tdp_fn_p_stOperatorFunctionPtr fn_p_fn_pGetOperatorFunctionPtr(enum tdeOperatorId_ eOperatorId)
{
return(a_stOperatorTable[eOperatorId].p_fn_p_stOperatorFunction);
}
#endif /* _AI_LIB_*/
#if defined(ACTIVE_EDITOR)
char *szGetOperatorTypeInParamFromId(enum tdeOperatorId_ eOperatorId)
{
return(a_stOperatorTable[eOperatorId].szOperatorTypeInParam);
}
char *szGetOperatorTypeOutParamFromId(enum tdeOperatorId_ eOperatorId)
{
return(a_stOperatorTable[eOperatorId].szOperatorTypeOutParam);
}
enum tdeOperatorId_ fn_eFindOperatorIdFromEditorName(char *szOperator)
{
short wOperatorEntry;
for(wOperatorEntry=0;wOperatorEntry<fn_eGetNbOperator();wOperatorEntry++)
{
if (!stricmp(a_stOperatorTable[wOperatorEntry].szOperatorEditorName,szOperator))
{
return((enum tdeOperatorId_) wOperatorEntry);
}
}
return(fn_eGetNbOperator());
}
char *szFindOperatorEditorNameFromId(enum tdeOperatorId_ eOperatorId)
{
return(a_stOperatorTable[eOperatorId].szOperatorEditorName);
}
char *szFindOperatorScriptNameFromId(enum tdeOperatorId_ eOperatorId)
{
return(a_stOperatorTable[eOperatorId].szOperatorScriptName);
}
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
enum tdeOperatorId_ fn_eFindOperatorIdFromScriptName(char *szOperator)
{
short wOperatorEntry;
for(wOperatorEntry=0;wOperatorEntry<fn_eGetNbOperator();wOperatorEntry++)
{
if (!stricmp(a_stOperatorTable[wOperatorEntry].szOperatorScriptName,szOperator))
{
return((enum tdeOperatorId_) wOperatorEntry);
}
}
return(fn_eGetNbOperator());
}
#endif /* AI_USE_SCRIPT */
#if !defined(OPTIMIZED_COMMAND)
#if defined(ACTIVE_EDITOR)
void fn_vDefineOperatorEntry(enum tdeOperatorId_ eOperatorId,char *szOperatorEditorName,char *szOperatorScriptName,tdp_fn_p_stOperatorFunctionPtr p_fn_p_stOperatorFunction,char *szOperatorTypeInParam,char *szOperatorTypeOutParam)
#else
void fn_vDefineOperatorEntry(enum tdeOperatorId_ eOperatorId,char *szOperatorScriptName,tdp_fn_p_stOperatorFunctionPtr p_fn_p_stOperatorFunction,char *szOperatorTypeInParam,char *szOperatorTypeOutParam)
#endif /* ACTIVE_EDITOR*/
{
if (
(eOperatorId<fn_eGetNbOperator())
#if defined(ACTIVE_EDITOR)
&&(strlen(szOperatorEditorName)<=C_MAX_SIZE_OPERATOR_EDITOR_NAME)
#endif /* ACTIVE_EDITOR*/
&&(strlen(szOperatorScriptName)<=C_MAX_SIZE_OPERATOR_SCRIPT_NAME)
#if defined(ACTIVE_EDITOR)
&&(strlen(szOperatorTypeInParam)<=C_MAX_OPERATOR_NB_IN_PARAM)
&&(fn_ucCheckTypeParam(szOperatorTypeInParam))
&&(strlen(szOperatorTypeOutParam)<=C_MAX_OPERATOR_NB_OUT_PARAM)
&&(fn_ucCheckTypeParam(szOperatorTypeOutParam))
#endif /* ACTIVE_EDITOR*/
)
{
#if defined(ACTIVE_EDITOR)
strcpy(a_stOperatorTable[eOperatorId].szOperatorEditorName,szOperatorEditorName);
#endif /* ACTIVE_EDITOR*/
strcpy(a_stOperatorTable[eOperatorId].szOperatorScriptName,szOperatorScriptName);
a_stOperatorTable[eOperatorId].p_fn_p_stOperatorFunction=p_fn_p_stOperatorFunction;
#if defined(ACTIVE_EDITOR)
strcpy(a_stOperatorTable[eOperatorId].szOperatorTypeInParam,szOperatorTypeInParam);
strcpy(a_stOperatorTable[eOperatorId].szOperatorTypeOutParam,szOperatorTypeOutParam);
#else
szOperatorTypeInParam=szOperatorTypeInParam;
szOperatorTypeOutParam=szOperatorTypeOutParam;
#endif /* ACTIVE_EDITOR*/
}
else
{
char str[C_MAX_LENGTH_STRING];
sprintf(str,"Error while defining %s operator in %s\n",szOperatorScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidOperator,str);
}
}
#endif /* OPTIMIZED_COMMAND*/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
void fn_vInitOperatorTable(tdp_fn_p_stOperatorFunctionPtr fn_p_stDefaultOperatorFunctionPointer)
{
short wOperatorEntry;
for(wOperatorEntry=0;wOperatorEntry<fn_eGetNbOperator();wOperatorEntry++)
{
fn_vDefineOperatorEntry(M_OPERATOR_ENTRY((enum tdeOperatorId_) wOperatorEntry,"","",fn_p_stDefaultOperatorFunctionPointer,USE_NO_PARAM,USE_NO_PARAM));
}
}
void fn_vCheckOperatorTable(tdp_fn_p_stOperatorFunctionPtr fn_p_stDefaultOperatorFunctionPointer)
{
short wOperatorEntry;
char str[C_MAX_LENGTH_STRING];
size_t lLen;
size_t lMaxLengthScriptName=0;
#if defined(ACTIVE_EDITOR)
size_t lMaxLengthEditorName=0;
size_t lMaxLengthInParam=0;
size_t lMaxLengthOutParam=0;
#endif /* ACTIVE_EDITOR*/
for(wOperatorEntry=0;wOperatorEntry<fn_eGetNbOperator();wOperatorEntry++)
{
if (fn_p_fn_pGetOperatorFunctionPtr((enum tdeOperatorId_) wOperatorEntry)==fn_p_stDefaultOperatorFunctionPointer)
{
sprintf(str,"Error while defining %s operator in %s\n",a_stOperatorTable[wOperatorEntry].szOperatorScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidOperator,str);
}
if ((lLen=strlen(a_stOperatorTable[wOperatorEntry].szOperatorScriptName))>lMaxLengthScriptName)
{
lMaxLengthScriptName=lLen;
}
#if defined(ACTIVE_EDITOR)
if ((lLen=strlen(a_stOperatorTable[wOperatorEntry].szOperatorEditorName))>lMaxLengthEditorName)
{
lMaxLengthEditorName=lLen;
}
if ((lLen=strlen(a_stOperatorTable[wOperatorEntry].szOperatorTypeInParam))>lMaxLengthInParam)
{
lMaxLengthInParam=lLen;
}
if ((lLen=strlen(a_stOperatorTable[wOperatorEntry].szOperatorTypeOutParam))>lMaxLengthOutParam)
{
lMaxLengthOutParam=lLen;
}
#endif /* ACTIVE_EDITOR*/
}
#if !defined(U64)
{
if (lMaxLengthScriptName<C_MAX_SIZE_OPERATOR_SCRIPT_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_OPERATOR_SCRIPT_NAME in %s to %d\n",__FILE__,lMaxLengthScriptName);
OutputDebugString(str);
}
#if defined(ACTIVE_EDITOR)
if (lMaxLengthEditorName<C_MAX_SIZE_OPERATOR_EDITOR_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_OPERATOR_EDITOR_NAME in %s to %d\n",__FILE__,lMaxLengthEditorName);
OutputDebugString(str);
}
if (lMaxLengthInParam<C_MAX_OPERATOR_NB_IN_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_OPERATOR_NB_IN_PARAM in %s to %d\n",__FILE__,lMaxLengthInParam);
OutputDebugString(str);
}
if (lMaxLengthOutParam<C_MAX_OPERATOR_NB_OUT_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_OPERATOR_NB_OUT_PARAM in %s to %d\n",__FILE__,lMaxLengthOutParam);
OutputDebugString(str);
}
#endif /* ACTIVE_EDITOR*/
}
#endif /* U64*/
}
#endif /* __DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,390 @@
#if defined(_AI_LIB_)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Convert.h"
#include "EnumProc.h"
#if defined(OPTIMIZED_COMMAND)
#include "ProtProc.h"
#endif
#else
#include <string.h>
#include "specif/AIOption.h"
#include "ConvCst.h"
#include "EnumProc.h"
#include "ConvProc.h"
#endif /* _AI_LIB_*/
#define C_MAX_SIZE_PROCEDURE_EDITOR_NAME 50
#define C_MAX_SIZE_PROCEDURE_SCRIPT_NAME 40
#define C_MAX_PROCEDURE_NB_PARAM 8/*Ylt passage de 6 <20> 8 arguments*/
typedef struct tdstProcedureEntry_
{
#if defined(ACTIVE_EDITOR)
/* Procedure string used in editor*/
char szProcedureEditorName[C_MAX_SIZE_PROCEDURE_EDITOR_NAME+1];
char szProcedureEditorName_En[C_MAX_SIZE_PROCEDURE_EDITOR_NAME+1];
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
/* Procedure string used in script*/
char szProcedureScriptName[C_MAX_SIZE_PROCEDURE_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
/* pointer on Procedure function*/
tdp_fn_p_stProcedureFunctionPtr p_fn_p_stProcedureFunction;
#endif
#if defined (AI_USE_SCRIPT) || defined (U64_AIDEBUG)
/* list of Procedure parameters (taken from szAutorizedTypeParam) in parameter*/
char szProcedureTypeParam[C_MAX_PROCEDURE_NB_PARAM+1];
#endif /* AI_USE_SCRIPT */
unsigned char bUltraProcedureFlag;
#ifdef PROFILE_IA
unsigned long ulCallCtr;
unsigned long ulTimeCtr;
unsigned long ulOwnTimeCtr;
#endif /* PROFILE_IA*/
} tdstProcedureEntry;
#ifdef PROFILE_IA
extern unsigned long ulIndice;
extern unsigned long p_ulTime[255];
extern FILE *file;
#endif /* PROFILE_IA*/
tdstProcedureEntry a_stProcedureTable[eNbProcedure]
#if defined(OPTIMIZED_COMMAND)
=
{
#ifdef U64_AIDEBUG
/* function pointers in Procedure.c, in params,ultra-able*/
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { d,e,f },
#include "DefProc.h"
}
#else /* U64_AIDEBUG*/
#if defined (AI_USE_SCRIPT)
/* Procedure initialisation*/
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { b,english,c,d,e,f },
#else
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { c,d,e,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { b,english,c,e,f },
#else
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { c,e,f },
#endif /* ACTIVE_EDITOR*/
#endif /* _AI_LIB_*/
#include "DefProc.h"
#undef M_DEFINE_PROCEDURE
}
#else /* AI_USE_SCRIPT */
/* Procedure initialisation*/
#if defined(_AI_LIB_)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { b,english,d,f },
#else
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { d,f },
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { b,english,f },
#else
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) { f },
#endif /* ACTIVE_EDITOR*/
#endif /* _AI_LIB_*/
#include "DefProc.h"
#undef M_DEFINE_PROCEDURE
}
#endif /* AI_USE_SCRIPT */
#endif /* U64_AIDEBUG*/
#endif /* OPTIMIZED_COMMAND*/
;
#if ! defined(OPTIMIZED_COMMAND)
void fn_vSetProcedureUltraOperator(enum tdeProcedureId_ eProcId,unsigned char bFlag)
{
a_stProcedureTable[eProcId].bUltraProcedureFlag=bFlag;
};
#endif /* OPTIMIZED_COMMAND*/
unsigned char fn_ucGetProcedureUltraOperator(enum tdeProcedureId_ eProcId)
{
return(a_stProcedureTable[eProcId].bUltraProcedureFlag);
}
#if defined(_AI_LIB_)
tdp_fn_p_stProcedureFunctionPtr fn_p_fn_pGetProcedureFunctionPtr(enum tdeProcedureId_ eProcedureId)
{
return(a_stProcedureTable[eProcedureId].p_fn_p_stProcedureFunction);
}
#ifdef PROFILE_IA
void fn_vProcSaveTime(unsigned long ulTime, enum tdeProcedureId_ eProcedureId)
{
/* if level != 0, then stop time count of last function*/
if (ulIndice != 0)
{
p_ulTime[ulIndice - 1] = (ulTime - p_ulTime[ulIndice - 1]);
}
/* set time for this new function and add indice*/
p_ulTime[ulIndice++] = ulTime;
}
void fn_vProcComputeTime(unsigned long ulCurrentTime, unsigned long ulTime, enum tdeProcedureId_ eProcedureId)
{
/* compute total time for this function*/
a_stProcedureTable[eProcedureId].ulCallCtr++;
a_stProcedureTable[eProcedureId].ulTimeCtr += (ulCurrentTime - ulTime)/5;
/* compute own time for this function*/
ulIndice--;
/* compute the time for this function*/
a_stProcedureTable[eProcedureId].ulOwnTimeCtr += ((ulCurrentTime - p_ulTime[ulIndice]) / 5);
p_ulTime[ulIndice] = 0;
if (ulIndice != 0)
{
/* level != 0, then restart previous function time*/
p_ulTime[ulIndice-1] = ulCurrentTime - p_ulTime[ulIndice-1];
}
}
void dumpProc()
{
int i;
char string[250];
strcpy(string,"x:\\cpa\\");
strcat(string,fn_p_szGetLevelName());
strcat(string,".txt");
file = fopen(string,"a+");
if (file == NULL)
return;
for (i=0;i<(long)eNbProcedure;i++)
{
if (a_stProcedureTable[i].ulCallCtr)
{
fprintf(file,"%s %i %i %i %i %i\n",
a_stProcedureTable[i].szProcedureScriptName,
a_stProcedureTable[i].ulCallCtr,
a_stProcedureTable[i].ulTimeCtr,
a_stProcedureTable[i].ulOwnTimeCtr,
a_stProcedureTable[i].ulTimeCtr / a_stProcedureTable[i].ulCallCtr,
a_stProcedureTable[i].ulOwnTimeCtr / a_stProcedureTable[i].ulCallCtr);
}
else
{
fprintf(file,"%s %i %i %i %i %i\n",
a_stProcedureTable[i].szProcedureScriptName,
0,
0,
0,
0,
0);
}
}
fclose(file);
}
void clearProc()
{
int i;
for (i=0;i<(long)eNbProcedure;i++)
{
a_stProcedureTable[i].ulCallCtr = 0;
a_stProcedureTable[i].ulTimeCtr = 0;
a_stProcedureTable[i].ulOwnTimeCtr = 0;
}
}
#endif /* PROFILE_IA*/
#endif /* _AI_LIB_*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeProcedureId_ fn_eGetNbProcedure()
{
return(eNbProcedure);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(__DEBUG_AI__) || defined(ACTIVE_EDITOR) || defined(U64_AIDEBUG)
char *szGetProcedureTypeInParamFromId(enum tdeProcedureId_ eProcedureId)
{
return(a_stProcedureTable[eProcedureId].szProcedureTypeParam);
}
#endif /* __DEBUG_AI__ ACTIVE_EDITOR*/
#if defined(ACTIVE_EDITOR)
char *szGetProcedureTypeOutParamFromId(enum tdeProcedureId_ eProcedureId)
{
eProcedureId=eProcedureId;
return(USE_NO_PARAM);
}
enum tdeProcedureId_ fn_eFindProcedureIdFromEditorName(char *szProcedure)
{
short wProcedureEntry;
for(wProcedureEntry=0;wProcedureEntry<fn_eGetNbProcedure();wProcedureEntry++)
{
if (!stricmp(a_stProcedureTable[wProcedureEntry].szProcedureEditorName,szProcedure))
{
return((enum tdeProcedureId_) wProcedureEntry);
}
}
return(fn_eGetNbProcedure());
}
char *szFindProcedureEditorNameFromId(enum tdeProcedureId_ eProcedureId)
{
return(a_stProcedureTable[eProcedureId].szProcedureEditorName);
}
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
char *szFindProcedureScriptNameFromId(enum tdeProcedureId_ eProcedureId)
{
return(a_stProcedureTable[eProcedureId].szProcedureScriptName);
}
#endif /* AI_USE_SCRIPT */
#if defined (AI_USE_SCRIPT)
enum tdeProcedureId_ fn_eFindProcedureIdFromScriptName(char *szProcedure)
{
short wProcedureEntry;
for(wProcedureEntry=0;wProcedureEntry<fn_eGetNbProcedure();wProcedureEntry++)
{
if (!stricmp(a_stProcedureTable[wProcedureEntry].szProcedureScriptName,szProcedure))
{
return((enum tdeProcedureId_) wProcedureEntry);
}
}
return(fn_eGetNbProcedure());
}
#endif /* AI_USE_SCRIPT */
#if !defined(OPTIMIZED_COMMAND)
#if defined(ACTIVE_EDITOR)
void fn_vDefineProcedureEntry(enum tdeProcedureId_ eProcedureId,char *szProcedureEditorName,char *szProcedureEditorName_En,char *szProcedureScriptName,tdp_fn_p_stProcedureFunctionPtr p_fn_p_stProcedureFunction,char *szProcedureTypeParam)
#else
void fn_vDefineProcedureEntry(enum tdeProcedureId_ eProcedureId,char *szProcedureScriptName,tdp_fn_p_stProcedureFunctionPtr p_fn_p_stProcedureFunction,char *szProcedureTypeParam)
#endif /* ACTIVE_EDITOR*/
{
if (
(eProcedureId<fn_eGetNbProcedure())
#if defined(ACTIVE_EDITOR)
&&(strlen(szProcedureEditorName)<=C_MAX_SIZE_PROCEDURE_EDITOR_NAME)
#endif /* ACTIVE_EDITOR*/
&&(strlen(szProcedureScriptName)<=C_MAX_SIZE_PROCEDURE_SCRIPT_NAME)
&&(strlen(szProcedureTypeParam)<=C_MAX_PROCEDURE_NB_PARAM)
&&(fn_ucCheckTypeParam(szProcedureTypeParam))
)
{
#if defined(ACTIVE_EDITOR)
strcpy(a_stProcedureTable[eProcedureId].szProcedureEditorName,szProcedureEditorName);
#endif /* ACTIVE_EDITOR*/
strcpy(a_stProcedureTable[eProcedureId].szProcedureScriptName,szProcedureScriptName);
a_stProcedureTable[eProcedureId].p_fn_p_stProcedureFunction=p_fn_p_stProcedureFunction;
strcpy(a_stProcedureTable[eProcedureId].szProcedureTypeParam,szProcedureTypeParam);
}
else
{
char str[C_MAX_LENGTH_STRING];
sprintf(str,"Error while defining %s procedure in %s\n",szProcedureScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidProcedure,str);
}
}
#endif /* OPTIMIZED_COMMAND*/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
void fn_vInitProcedureTable(tdp_fn_p_stProcedureFunctionPtr fn_p_stDefaultProcedureFunctionPointer)
{
short wProcedureEntry;
for(wProcedureEntry=0;wProcedureEntry<fn_eGetNbProcedure();wProcedureEntry++)
{
fn_vDefineProcedureEntry(M_PROCEDURE_ENTRY((enum tdeProcedureId_) wProcedureEntry,"","","",fn_p_stDefaultProcedureFunctionPointer,USE_NO_PARAM));
/* ULTRA OPERATOR USAGE : FALSE AS A DEFAULT*/
fn_vSetProcedureUltraOperator((enum tdeProcedureId_) wProcedureEntry,NOT_ULTRA_ABLE);
}
}
void fn_vCheckProcedureTable(tdp_fn_p_stProcedureFunctionPtr fn_p_stDefaultProcedureFunctionPointer)
{
short wProcedureEntry;
char str[C_MAX_LENGTH_STRING];
size_t lLen;
size_t lMaxLengthScriptName=0;
#if defined(ACTIVE_EDITOR)
size_t lMaxLengthEditorName=0;
#endif /* ACTIVE_EDITOR*/
size_t lMaxLengthParam=0;
for(wProcedureEntry=0;wProcedureEntry<fn_eGetNbProcedure();wProcedureEntry++)
{
if (fn_p_fn_pGetProcedureFunctionPtr((enum tdeProcedureId_) wProcedureEntry)==fn_p_stDefaultProcedureFunctionPointer)
{
sprintf(str,"Error while defining %s procedure in %s\n",a_stProcedureTable[wProcedureEntry].szProcedureScriptName,__FILE__);
M_AIFatalErrorMsg(E_uwAIFatalNotValidProcedure,str);
}
if ((lLen=strlen(a_stProcedureTable[wProcedureEntry].szProcedureScriptName))>lMaxLengthScriptName)
{
lMaxLengthScriptName=lLen;
}
#if defined(ACTIVE_EDITOR)
if ((lLen=strlen(a_stProcedureTable[wProcedureEntry].szProcedureEditorName))>lMaxLengthEditorName)
{
lMaxLengthEditorName=lLen;
}
#endif /* ACTIVE_EDITOR*/
if ((lLen=strlen(a_stProcedureTable[wProcedureEntry].szProcedureTypeParam))>lMaxLengthParam)
{
lMaxLengthParam=lLen;
}
}
#if !defined(U64)
{
if (lMaxLengthScriptName<C_MAX_SIZE_PROCEDURE_SCRIPT_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_PROCEDURE_SCRIPT_NAME in %s to %d\n",__FILE__,lMaxLengthScriptName);
OutputDebugString(str);
}
#if defined(ACTIVE_EDITOR)
if (lMaxLengthEditorName<C_MAX_SIZE_PROCEDURE_EDITOR_NAME)
{
sprintf(str,"*** AI : You should reduce C_MAX_SIZE_PROCEDURE_EDITOR_NAME in %s to %d\n",__FILE__,lMaxLengthEditorName);
OutputDebugString(str);
}
#endif /* ACTIVE_EDITOR*/
if (lMaxLengthParam<C_MAX_PROCEDURE_NB_PARAM)
{
sprintf(str,"*** AI : You should reduce C_MAX_PROCEDURE_NB_PARAM in %s to %d\n",__FILE__,lMaxLengthParam);
OutputDebugString(str);
}
}
#endif /* U64*/
}
#endif /* __DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,610 @@
#if defined(_AI_LIB_)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
/* so that exported functions are effectively exported !*/
#include "Convert.h"
#include "ProtVar.h"
#include "EnumVar.h"
#include "VarType.h"
#else
#include <string.h>
#include "specif/AIOption.h"
#include "EnumVar.h"
#include "VarType.h"
#include "ConvVar.h"
#include "ConvCst.h"
#endif /* _AI_LIB_*/
/******************************************************************************/
/* dsgvar types */
/******************************************************************************/
#define C_MAX_SIZE_DSGVAR_NAME 20
#define NB_MAX_DSGVAR_PARAM 4
#define NB_MAX_DSGVAR_DEFAULT_PARAM 12
typedef struct tdstDsgVarTypeTableEntry_
{
/* string used in editor*/
#if defined(ACTIVE_EDITOR)
char szEditorName[C_MAX_SIZE_DSGVAR_NAME+1];
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
/* string used in script*/
char szScriptName[C_MAX_SIZE_DSGVAR_NAME+1];
#endif /* AI_USE_SCRIPT */
enum tdeVariableType_ eVariableType;
#if defined(ACTIVE_EDITOR)
char szParamType[2];
char szParamSubType[2];
#endif /* ACTIVE_EDITOR*/
#if defined(_AI_LIB_)
tdp_fn_ucGetDsgVarFunctionPtr p_fn_ucGetDsgVarFunction;
tdp_fn_ucSetDsgVarFunctionPtr p_fn_ucSetDsgVarFunction;
#endif /* _AI_LIB_ */
} tdstDsgVarTypeTableEntry;
/*
static tdstDsgVarTypeTableEntry a_stDsgVarTypeTable[eNbDsgVarType]=
{
#if defined(_AI_LIB_)
#if defined (AI_USE_SCRIPT)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h) {b,c,d,e,f},
#else
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h) {c,d,e,f},
#endif // ACTIVE_EDITOR
#else // AI_USE_SCRIPT
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h) {b,d,e,f},
#else
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h) {d,e,f},
#endif // ACTIVE_EDITOR
#endif // AI_USE_SCRIPT
#else
#if defined (AI_USE_SCRIPT)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h) {b,c,d},
#else
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h) {c,d},
#endif // ACTIVE_EDITOR
#else // AI_USE_SCRIPT
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h) {b,d},
#else
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h) {d},
#endif // ACTIVE_EDITOR
#endif // AI_USE_SCRIPT
#endif // _AI_LIB_
#include "DefVar.h"
#undef M_DEFINE_DSGVAR_TYPE
};
*/
static tdstDsgVarTypeTableEntry a_stDsgVarTypeTable[eNbDsgVarType]=
{
#if defined(_AI_LIB_)
#if defined (AI_USE_SCRIPT)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) {b,c,d,e,f,g,h},
#else
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) {c,d,g,h},
#endif /* ACTIVE_EDITOR*/
#else /* AI_USE_SCRIPT */
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) {b,d,e,f,g,h},
#else
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) {d,g,h},
#endif /* ACTIVE_EDITOR*/
#endif /* AI_USE_SCRIPT */
#else
#if defined (AI_USE_SCRIPT)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) {b,c,d,e,f},
#else
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) {c,d},
#endif /* ACTIVE_EDITOR*/
#else /* AI_USE_SCRIPT */
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) {b,d,e,f},
#else
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) {d},
#endif /* ACTIVE_EDITOR*/
#endif /* AI_USE_SCRIPT */
#endif /* _AI_LIB_ */
#include "DefVar.h"
#undef M_DEFINE_DSGVAR_TYPE
};
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
enum tdeDsgVarTypeId_ fn_eGetNbDsgVarType()
{
return(eNbDsgVarType);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(__DEBUG_AI__)
char *szFindDsgVarTypeScriptNameFromId(enum tdeDsgVarTypeId_ eDsgVarTypeId)
{
#if defined(__DEBUG_AI__)
if (!M_IsDsgVarTypeIdValid(eDsgVarTypeId))
return(NULL);
#endif
return(a_stDsgVarTypeTable[eDsgVarTypeId].szScriptName);
}
#endif
#if defined(_AI_LIB_)
tdp_fn_ucGetDsgVarFunctionPtr fn_p_fn_pGetDsgVarGetFunctionPtr(enum tdeDsgVarTypeId_ eDsgVarTypeId)
{
return(a_stDsgVarTypeTable[eDsgVarTypeId].p_fn_ucGetDsgVarFunction);
}
tdp_fn_ucSetDsgVarFunctionPtr fn_p_fn_pGetDsgVarSetFunctionPtr(enum tdeDsgVarTypeId_ eDsgVarTypeId)
{
return(a_stDsgVarTypeTable[eDsgVarTypeId].p_fn_ucSetDsgVarFunction);
}
#endif
#if defined(ACTIVE_EDITOR)
char *fn_szFindStringTypeFromVariableType(tdeVariableType eType)
{
int i;
for(i=0;i<fn_eGetNbDsgVarType();i++)
{
if (a_stDsgVarTypeTable[i].eVariableType==eType)
{
return(a_stDsgVarTypeTable[i].szParamType);
}
}
return(USE_NO_PARAM);
}
char *fn_szFindStringTypeFromDsgVarType(enum tdeDsgVarTypeId_ eDsgVarTypeId)
{
return(a_stDsgVarTypeTable[eDsgVarTypeId].szParamType);
}
char *fn_szFindStringSubTypeFromDsgVarType(enum tdeDsgVarTypeId_ eDsgVarTypeId)
{
return(a_stDsgVarTypeTable[eDsgVarTypeId].szParamSubType);
}
enum tdeDsgVarTypeId_ fn_eFindDsgVarTypeIdFromEditorName(char *szDsgVarType)
{
short wDsgVarTypeEntry;
for(wDsgVarTypeEntry=0;wDsgVarTypeEntry<fn_eGetNbDsgVarType();wDsgVarTypeEntry++)
{
if (!stricmp(a_stDsgVarTypeTable[wDsgVarTypeEntry].szEditorName,szDsgVarType))
{
return((enum tdeDsgVarTypeId_) wDsgVarTypeEntry);
}
}
return(fn_eGetNbDsgVarType());
}
char *szFindDsgVarTypeEditorNameFromId(enum tdeDsgVarTypeId_ eDsgVarTypeId)
{
#if defined(__DEBUG_AI__)
if (!M_IsDsgVarTypeIdValid(eDsgVarTypeId))
return(NULL);
#endif
return(a_stDsgVarTypeTable[eDsgVarTypeId].szEditorName);
}
#endif /* ACTIVE_EDITOR*/
/*#if defined(ACTIVE_EDITOR) */
enum tdeVariableType_ fn_GetDsgVarType(enum tdeDsgVarTypeId_ eDsgVarTypeId)
{
#if defined(__DEBUG_AI__)
if (!M_IsDsgVarTypeIdValid(eDsgVarTypeId))
return(E_vt_None);
#endif
return(a_stDsgVarTypeTable[eDsgVarTypeId].eVariableType);
}
/*#endif*/
#if defined (AI_USE_SCRIPT)
enum tdeDsgVarTypeId_ fn_eFindDsgVarTypeIdFromScriptName(char *szDsgVarType)
{
short wDsgVarTypeEntry;
for(wDsgVarTypeEntry=0;wDsgVarTypeEntry<fn_eGetNbDsgVarType();wDsgVarTypeEntry++)
{
if (!stricmp(a_stDsgVarTypeTable[wDsgVarTypeEntry].szScriptName,szDsgVarType))
{
return((enum tdeDsgVarTypeId_) wDsgVarTypeEntry);
}
}
return(fn_eGetNbDsgVarType());
}
#endif /* AI_USE_SCRIPT */
/******************************************************************************/
/* for SAI save types */
/******************************************************************************/
/******************************************************************************/
/* for SAI save types */
/******************************************************************************/
#if !defined(_AI_LIB_) && defined(__SAI_Enum_h__)
#define KNOW_SAI
#endif
#define MAX_LENGTH_SAVE_TYPE_EDITOR_NAME 20
#define MAX_LENGTH_SAVE_TYPE_SCRIPT_NAME 20
typedef struct tdstSaveTypeEntry_
{
#if defined(ACTIVE_EDITOR)
char szEditorName[MAX_LENGTH_SAVE_TYPE_EDITOR_NAME];
#endif
#if defined (AI_USE_SCRIPT)
char szScriptName[MAX_LENGTH_SAVE_TYPE_SCRIPT_NAME];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_) || defined(KNOW_SAI)
SAI_tdeFlags eFlags;
#endif /* _AI_LIB_ || KNOW_SAI */
} tdstSaveTypeEntry;
tdstSaveTypeEntry a_st_SaveTypeTable[] =
{
#if defined (AI_USE_SCRIPT)
#if defined(_AI_LIB_) || defined(KNOW_SAI)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) {a,b,c},
#else
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) {b,c},
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) {a,b},
#else
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) {b},
#endif /* ACTIVE_EDITOR*/
#endif
#else /* AI_USE_SCRIPT */
#if defined(_AI_LIB_) || defined(KNOW_SAI)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) {a,c},
#else
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) {c},
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) {a},
#else
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) { },
#endif /* ACTIVE_EDITOR*/
#endif
#endif /* AI_USE_SCRIPT */
#include "DefSAI.h"
#undef M_DEFINE_DSGVAR_SAVE_TYPE
};
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char fn_ucGetSaveTypeNumber()
{
return((unsigned char) (sizeof(a_st_SaveTypeTable)/sizeof(a_st_SaveTypeTable[0])));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
unsigned char fn_ucDefaultSaveTypeNumber()
{
return(DEFAULT_DSGVAR_SAVE_TYPE_ENTRY);
}
#if defined(_AI_LIB_) || defined(KNOW_SAI)
#if defined (AI_USE_SCRIPT)
#if defined(WIN32) && defined(_DEBUG) /* on PC, and in debug versions */
#ifdef __cplusplus
extern "C"
{
#endif
extern ACP_tdxBool g_bIsLoadingAnAlways ;
#ifdef __cplusplus
}
#endif
#endif /* WIN32 && _DEBUG */
SAI_tdeFlags fn_eFindSaveTypeFromScriptName(char *szSaveType, char *_p_szPersoName, unsigned char _ucVarId )
{
unsigned char i;
for (i=0;i<fn_ucGetSaveTypeNumber();i++)
{
if (!stricmp(a_st_SaveTypeTable[i].szScriptName,szSaveType))
{
/* it is strictly forbidden for an actor to jave a dsgvar saved in the general save file if it is not in the fix load block */
#if !defined ( ACTIVE_EDITOR )
if
(
( a_st_SaveTypeTable[i].eFlags & SAI_ePlayerSaveMask )
&& !GAM_fn_bIsEngineInFixMode()
)
{
char szErrorMsg[200];
sprintf(
szErrorMsg,
"Perso %s has dsgvar %d with a Player save type, but it is not loaded with the Fix block.",
_p_szPersoName,
_ucVarId
);
M_AIFatalErrorMsg(E_uwAIFatalInvalidDsgvarSaveType,szErrorMsg);
}
#if defined(WIN32) && defined(_DEBUG) /* on PC, and in debug versions */
else if
(
g_bIsLoadingAnAlways /* if loading an always */
&& ( a_st_SaveTypeTable[i].eFlags & SAI_eAllSaveMask ) /* and there is a save type */
)
{
char szErrorMsg[200];
sprintf(
szErrorMsg,
"Perso %s has dsgvar %d with a save type, but it is an always.",
_p_szPersoName,
_ucVarId
);
M_AIFatalErrorMsg(E_uwAIFatalInvalidDsgvarSaveType,szErrorMsg);
}
#endif /* WIN32 && _DEBUG */
#endif /* ! ACTIVE_EDITOR */
return(a_st_SaveTypeTable[i].eFlags);
}
}
return(a_st_SaveTypeTable[fn_ucDefaultSaveTypeNumber()].eFlags);
}
#endif /* AI_USE_SCRIPT */
SAI_tdeFlags fn_eFindSaveTypeFromSaveTypeNumber(unsigned char ucSaveTypeNumber)
{
return(a_st_SaveTypeTable[ucSaveTypeNumber].eFlags);
}
#endif /* _AI_LIB_ || KNOW_SAI */
#if defined (AI_USE_SCRIPT)
char *fn_szFindScriptNameFromSaveTypeNumber(unsigned char ucSaveTypeNumber)
{
return(a_st_SaveTypeTable[ucSaveTypeNumber].szScriptName);
}
#endif /* AI_USE_SCRIPT */
#if defined(ACTIVE_EDITOR)
char *fn_szFindEditorNameFromSaveTypeNumber(unsigned char ucSaveTypeNumber)
{
return(a_st_SaveTypeTable[ucSaveTypeNumber].szEditorName);
}
#if defined(_AI_LIB_) || defined(KNOW_SAI)
SAI_tdeFlags fn_eFindSaveTypeFromEditorName(char *szSaveType)
{
unsigned char i;
for (i=0;i<fn_ucGetSaveTypeNumber();i++)
{
if (!stricmp(a_st_SaveTypeTable[i].szEditorName,szSaveType))
{
return(a_st_SaveTypeTable[i].eFlags);
}
}
return(a_st_SaveTypeTable[fn_ucDefaultSaveTypeNumber()].eFlags);
}
char *fn_szFindEditorNameFromSaveType(SAI_tdeFlags eFlags)
{
unsigned char i;
for (i=0;i<fn_ucGetSaveTypeNumber();i++)
{
if (a_st_SaveTypeTable[i].eFlags==eFlags)
{
return(a_st_SaveTypeTable[i].szEditorName);
}
}
return(a_st_SaveTypeTable[fn_ucDefaultSaveTypeNumber()].szEditorName);
}
char *fn_szFindScriptNameFromSaveType(SAI_tdeFlags eFlags)
{
unsigned char i;
for (i=0;i<fn_ucGetSaveTypeNumber();i++)
{
if (a_st_SaveTypeTable[i].eFlags==eFlags)
{
return(a_st_SaveTypeTable[i].szScriptName);
}
}
return(a_st_SaveTypeTable[fn_ucDefaultSaveTypeNumber()].szScriptName);
}
unsigned char fn_ucFindSaveTypeNumberFromScriptName(char *szSaveType)
{
unsigned char i;
for (i=0;i<fn_ucGetSaveTypeNumber();i++)
{
if (!stricmp(a_st_SaveTypeTable[i].szScriptName,szSaveType))
{
return(i);
}
}
return(fn_ucGetSaveTypeNumber());
}
#endif /* _AI_LIB_ || KNOW_SAI*/
#endif /* ACTIVE_EDITOR*/
/******************************************************************************/
/* for OTI init types */
/******************************************************************************/
#if !defined(_AI_LIB_) && defined(__OBJINIT_h__)
#define KNOW_OTI
#endif
#define MAX_LENGTH_INIT_TYPE_EDITOR_NAME 20
#define MAX_LENGTH_INIT_TYPE_SCRIPT_NAME 20
typedef struct tdstInitTypeEntry_
{
#if defined(ACTIVE_EDITOR)
char szEditorName[MAX_LENGTH_INIT_TYPE_EDITOR_NAME];
#endif
#if defined (AI_USE_SCRIPT)
char szScriptName[MAX_LENGTH_INIT_TYPE_SCRIPT_NAME];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_) || defined(KNOW_OTI)
tdeObjectTreeInit eFlags;
#endif /* _AI_LIB_ || KNOW_OTI */
} tdstInitTypeEntry;
tdstInitTypeEntry a_st_InitTypeTable[] =
{
#if defined (AI_USE_SCRIPT)
#if defined(_AI_LIB_) || defined(KNOW_OTI)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) {a,b,c},
#else
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) {b,c},
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) {a,b},
#else
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) {b},
#endif /* ACTIVE_EDITOR*/
#endif
#else /* AI_USE_SCRIPT */
#if defined(_AI_LIB_) || defined(KNOW_OTI)
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) {a,c},
#else
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) {c},
#endif /* ACTIVE_EDITOR*/
#else
#if defined(ACTIVE_EDITOR)
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) {a},
#else
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) { },
#endif /* ACTIVE_EDITOR*/
#endif
#endif /* AI_USE_SCRIPT */
#include "DefOTI.h"
#undef M_DEFINE_DSGVAR_INIT_TYPE
};
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char fn_ucGetInitTypeNumber()
{
return((unsigned char) (sizeof(a_st_InitTypeTable)/sizeof(a_st_InitTypeTable[0])));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
unsigned char fn_ucDefaultInitTypeNumber()
{
return(DEFAULT_DSGVAR_INIT_TYPE_ENTRY);
}
#if defined(_AI_LIB_) || defined(KNOW_OTI)
#if defined (AI_USE_SCRIPT)
tdeObjectTreeInit fn_eFindInitTypeFromScriptName(char *szInitType)
{
unsigned char i;
for (i=0;i<fn_ucGetInitTypeNumber();i++)
{
if (!stricmp(a_st_InitTypeTable[i].szScriptName,szInitType))
{
return(a_st_InitTypeTable[i].eFlags);
}
}
return(a_st_InitTypeTable[fn_ucDefaultInitTypeNumber()].eFlags);
}
#endif /* AI_USE_SCRIPT */
tdeObjectTreeInit fn_eFindInitTypeFromInitTypeNumber(unsigned char ucInitTypeNumber)
{
return(a_st_InitTypeTable[ucInitTypeNumber].eFlags);
}
#endif /* _AI_LIB_ || KNOW_OTI*/
#if defined (AI_USE_SCRIPT)
char *fn_szFindScriptNameFromInitTypeNumber(unsigned char ucInitTypeNumber)
{
return(a_st_InitTypeTable[ucInitTypeNumber].szScriptName);
}
#endif /* AI_USE_SCRIPT */
#if defined(ACTIVE_EDITOR)
char *fn_szFindEditorNameFromInitTypeNumber(unsigned char ucInitTypeNumber)
{
return(a_st_InitTypeTable[ucInitTypeNumber].szEditorName);
}
#if defined(_AI_LIB_) || defined(KNOW_OTI)
tdeObjectTreeInit fn_eFindInitTypeFromEditorName(char *szInitType)
{
unsigned char i;
for (i=0;i<fn_ucGetInitTypeNumber();i++)
{
if (!stricmp(a_st_InitTypeTable[i].szEditorName,szInitType))
{
return(a_st_InitTypeTable[i].eFlags);
}
}
return(a_st_InitTypeTable[fn_ucDefaultInitTypeNumber()].eFlags);
}
char *fn_szFindEditorNameFromInitType(tdeObjectTreeInit eFlags)
{
unsigned char i;
for (i=0;i<fn_ucGetInitTypeNumber();i++)
{
if (a_st_InitTypeTable[i].eFlags==eFlags)
{
return(a_st_InitTypeTable[i].szEditorName);
}
}
return(a_st_InitTypeTable[fn_ucDefaultInitTypeNumber()].szEditorName);
}
char *fn_szFindScriptNameFromInitType(tdeObjectTreeInit eFlags)
{
unsigned char i;
for (i=0;i<fn_ucGetInitTypeNumber();i++)
{
if (a_st_InitTypeTable[i].eFlags==eFlags)
{
return(a_st_InitTypeTable[i].szScriptName);
}
}
return(a_st_InitTypeTable[fn_ucDefaultInitTypeNumber()].szScriptName);
}
unsigned char fn_ucFindInitTypeNumberFromScriptName(char *szInitType)
{
unsigned char i;
for (i=0;i<fn_ucGetInitTypeNumber();i++)
{
if (!stricmp(a_st_InitTypeTable[i].szScriptName,szInitType))
{
return(i);
}
}
return(fn_ucGetInitTypeNumber());
}
#endif /* _AI_LIB_ || KNOW_OTI*/
#endif /* ACTIVE_EDITOR*/

View File

@@ -0,0 +1,571 @@
/*---------------------------------------------------------------------------*/
/* Convert.c : Convert Id <-> string (mainly usefull for editor)*/
/* creation : 17/01/1997 (Olivier Couvreur)*/
/* modify : 29/01/1997 (Fabien Morales) Vertex param*/
/* modify : 31/01/1997 (Olivier Couvreur) lint verification*/
/* modify : 12/02/1997 (Fabien Morales) Module & DsgVarId param types*/
/* modify : 19/02/1997 (Olivier Couvreur) types checking functions (for editor)*/
/* modify : 26/02/1997 (Olivier Couvreur) new functions for editor type checking */
/* modify : 11/03/1997 (Olivier Couvreur) functions for editor transfered from several modules*/
/* modify : 25/03/1997 (Olivier Couvreur) ACTIVE_EDITOR support*/
/* modify : 21/05/1997 (Olivier Couvreur) HitPoints support*/
/* modify : 27/05/1997 (Olivier Couvreur) ZDD + ZDE stuff*/
/* modify : 27/06/1997 (Olivier Couvreur) Operators,Functions,Procedures,Conditions use functions pointers !*/
/*---------------------------------------------------------------------------*/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "GsParam.h"
/* so that exported functions are effectively exported !*/
#include "Convert.h"
#if defined(ACTIVE_EDITOR)
#include "specif/ActTable.h"
#endif /* ACTIVE_EDITOR*/
#if !defined(OPTIMIZED_COMMAND)
/**********************************************************************/
/* list of all allowed char for defining types*/
char szAutorizedTypeParam[]= \
C_LONG_PARAM \
C_REAL_PARAM \
C_PERSO_PARAM \
C_VECTOR_PARAM \
C_MODULE_PARAM \
C_WAYPOINT_PARAM \
C_LIST_PARAM \
C_BOOLEAN_PARAM \
C_ACTION_PARAM \
C_ZDE_PERSO_PARAM \
C_ZDD_PERSO_PARAM \
C_ZDM_PERSO_PARAM \
C_ZDE_MODULE_PARAM \
C_ZDD_MODULE_PARAM \
C_BUTTON_PARAM \
C_STRING_PARAM \
C_MAP_PARAM \
C_MASK_PARAM \
C_MASK_PARAM \
C_SURFACE_PARAM \
C_LIPSYNCHRO_PARAM \
C_OBJECTTABLE_PARAM \
C_SECTOR_PARAM \
C_ENV_PARAM \
C_FAMILY_PARAM \
C_COMPORT_PARAM \
C_MY_REFLEX_COMPORT_PARAM \
C_MY_INTELL_COMPORT_PARAM \
C_REFLEX_COMPORT_PARAM \
C_INTELL_COMPORT_PARAM \
C_SOUNDEVENT_PARAM \
C_ALWAYS_PARAM \
C_POWER_PARAM \
C_PERSO_PARAM_ONLY \
C_FONT_PARAM \
C_TEXT_PARAM \
C_PARTICLEGENERATOR_PARAM \
C_GMT_PARAM \
C_MODEL_PARAM \
C_ARRAY_PARAM \
C_SUPEROBJECT_PARAM \
/*ANNECY CT 22/01/98 {*/
C_LIGHT_PARAM \
/*ENANNECY CT}*/
/*ANNECY Bart 02/02/98 {*/
C_CAPS_PARAM \
C_GRAPH_PARAM \
/*ENDANNECY Bart }*/
C_ZDR_PERSO_PARAM
;
/* return a pointer on a string containing all valid chars to define types*/
char *fn_szGetAutorizedTypeParam(void)
{
return (&szAutorizedTypeParam[0]);
}
/* check if a string contains only valid chars*/
unsigned char fn_ucCheckTypeParam(char *szTypeParam)
{
unsigned char Ok=0;
if (strlen(szTypeParam)<=C_MAX_NB_PARAM)
{
unsigned char i;
Ok=1;
for (i=0;((i<strlen(szTypeParam)) && (Ok==1));i++)
{
Ok=(unsigned char) (strchr(fn_szGetAutorizedTypeParam(),toupper(szTypeParam[i]))!=NULL);
}
}
if (!Ok)
{
M_AIFatalError(E_uwAIFatalWrongParamAction);
}
return(Ok);
}
#endif /* !OPTIMIZED_COMMAND*/
/**********************************************************************/
#if defined(ACTIVE_EDITOR)
/* check if two types are compatible*/
/* c1=c2*/
/* c1=toupper(c2)*/
/* l|l*/
/* L|l,L*/
/* x|x,l*/
/* X|l,L,x,X*/
/* Perso_Only=Perso*/
/* My_XX=XX (where XX is rul or rfx)*/
ACP_tdxBool fn_bIsCompatibleType(char c1,char c2)
{
if ((c1==c2) || (c1==(char) toupper(c2)) )
{
return(TRUE);
}
else if
(
(toupper(c1)==STRING1_TO_CHAR(C_REAL_PARAM)) &&
(toupper(c2)==STRING1_TO_CHAR(C_LONG_PARAM))
)
{
if(
(c1==STRING1_TO_CHAR(C_REAL_PARAM)) ||
(c2==STRING1_TO_CHAR(C_ADDR_LONG_PARAM))
)
{
return TRUE;
}
}
else if
(
(c1==STRING1_TO_CHAR(C_PERSO_PARAM_ONLY)) &&
(c2==STRING1_TO_CHAR(C_PERSO_PARAM))
)
{
return TRUE;
}
else if
(
(c1==STRING1_TO_CHAR(C_REFLEX_COMPORT_PARAM)) &&
(c2==STRING1_TO_CHAR(C_MY_REFLEX_COMPORT_PARAM))
)
{
return TRUE;
}
else if
(
(c1==STRING1_TO_CHAR(C_INTELL_COMPORT_PARAM)) &&
(c2==STRING1_TO_CHAR(C_MY_INTELL_COMPORT_PARAM))
)
{
return TRUE;
}
else if
(
(toupper(c2)==STRING1_TO_CHAR(C_COMPORT_PARAM)) &&
(
(c1==STRING1_TO_CHAR(C_INTELL_COMPORT_PARAM)) ||
(c1==STRING1_TO_CHAR(C_MY_INTELL_COMPORT_PARAM)) ||
(c1==STRING1_TO_CHAR(C_REFLEX_COMPORT_PARAM)) ||
(c1==STRING1_TO_CHAR(C_MY_REFLEX_COMPORT_PARAM))
)
)
{
return(TRUE);
}
else if
(
(toupper(c1)==STRING1_TO_CHAR(C_STRING_PARAM)) &&
(toupper(c2)==STRING1_TO_CHAR(C_TEXT_PARAM))
)
{
return TRUE;
}
else if
(
(toupper(c1)==STRING1_TO_CHAR(C_TEXT_PARAM)) &&
(toupper(c2)==STRING1_TO_CHAR(C_STRING_PARAM))
)
{
return TRUE;
}
return(FALSE);
}
/* check if two types are compatible for affectation*/
ACP_tdxBool fn_bIsCompatibleTypeForAffect(char c1,char c2)
{
if (c1==tolower(c2))
{
return TRUE;
}
else if
(
(c1==STRING1_TO_CHAR(C_ADDR_REAL_PARAM))
&&(toupper(c2)==STRING1_TO_CHAR(C_LONG_PARAM))
)
{
return TRUE;
}
return FALSE;
}
/* check if two string type are compatible*/
ACP_tdxBool fn_bIsCompatibleStringType(char *szType1,char *szType2)
{
size_t l=strlen(szType1);
if (l!=strlen(szType2))
{
return(FALSE);
}
else
{
size_t i;
for (i=0;i<l;i++)
{
if (!fn_bIsCompatibleType(szType1[i],szType2[i]))
return(FALSE);
}
}
return(TRUE);
}
ACP_tdxBool fn_bIsCompatibleStringTypeForAffect(char *szType1,char *szType2)
{
size_t l=strlen(szType1);
if (l!=strlen(szType2))
{
return(FALSE);
}
else
{
size_t i;
for (i=0;i<l;i++)
{
if (!fn_bIsCompatibleTypeForAffect(szType1[i],szType2[i]))
return(FALSE);
}
}
return(TRUE);
}
/*/
// get compatible type (c1 left, c2 right)
char fn_cGetCompatibleType(char c1,char c2)
{
if (c1==c2)
{
return(c1);
}
else
{
if(
(c1==(char) (*((char *) C_REAL_PARAM)) )
||(c2==(char) (*((char *) C_REAL_PARAM)) )
)
{
return( (char) (*((char *) C_REAL_PARAM)) );
}
return(c1);
}
}
// idem for a string
#define C_MAX_SIZE_INFOPARAM_NAME 50
char g_szStringType[C_MAX_SIZE_INFOPARAM_NAME+1];
char *fn_szGetCompatibleStringType(char *szType1,char *szType2)
{
size_t l=strlen(szType1);
g_szStringType[0]=0;
g_szStringType[l]=0;
if (l==strlen(szType2) )
{
size_t i;
for (i=0;i<l;i++)
{
g_szStringType[i]=fn_cGetCompatibleType(szType1[i],szType2[i]);
}
}
return(&g_szStringType[0]);
}
*/
#endif /* ACTIVE_EDITOR*/
/**********************************************************************/
#if defined(ACTIVE_EDITOR)
unsigned char fn_ucGetDefaultActionTableNbEntries()
{
return(DEFAULT_ACTION_TABLE_NB_ENTRIES);
}
unsigned char fn_ucGetMinActionTableNbEntries()
{
return(MIN_ACTION_TABLE_NB_ENTRIES);
}
unsigned char fn_ucGetMaxActionTableNbEntries()
{
return(MAX_ACTION_TABLE_NB_ENTRIES);
}
#endif /* ACTIVE_EDITOR*/
/**********************************************************************/
#if defined(ACTIVE_EDITOR)
/*
typedef struct tdstTypeConversionTableEntry_
{
enum tdeVariableType_ eType;
char szStringType[2];
} tdstTypeConversionTableEntry;
static tdstTypeConversionTableEntry a_stTypeConversiontable[]=
{
{E_vt_None, C_NO_PARAM},
{E_vt_Boolean, C_ADDR_BOOLEAN_PARAM},
{E_vt__128To127, C_ADDR_LONG_PARAM},
{E_vt_0To255, C_ADDR_LONG_PARAM},
{E_vt__32768To32767, C_ADDR_LONG_PARAM},
{E_vt_0To65535, C_ADDR_LONG_PARAM},
{E_vt_Integer, C_ADDR_LONG_PARAM},
{E_vt_PositiveInteger, C_ADDR_LONG_PARAM},
{E_vt_Float, C_ADDR_REAL_PARAM},
{E_vt_WayPoint, C_ADDR_WAYPOINT_PARAM},
{E_vt_Way, C_ADDR_LONG_PARAM},
{E_vt_Perso, C_ADDR_PERSO_PARAM},
{E_vt_List, C_ADDR_LIST_PARAM},
//{E_vt_1bit, C_ADDR_LONG_PARAM},
//{E_vt_2bit, C_ADDR_LONG_PARAM},
//{E_vt_3bit, C_ADDR_LONG_PARAM},
//{E_vt_4bit, C_ADDR_LONG_PARAM},
//{E_vt_5bit, C_ADDR_LONG_PARAM},
//{E_vt_6bit, C_ADDR_LONG_PARAM},
//{E_vt_7bit, C_ADDR_LONG_PARAM},
{E_vt_MetaActionReturn, C_ADDR_LONG_PARAM},
{E_vt_Vector, C_ADDR_VECTOR_PARAM},
{E_vt_Module, C_ADDR_LONG_PARAM},
{E_vt_DsgVarId, C_ADDR_LONG_PARAM},
{E_vt_Button, C_BUTTON_PARAM},
{E_vt_Mask, C_MASK_PARAM},
{E_vt_Text, C_ADDR_TEXT_PARAM},
{E_vt_GameMaterial, C_ADDR_GMT_PARAM},
{E_vt_Action, C_ADDR_ACTION_PARAM},
//{E_vt_Comport, C_ADDR_COMPORT_PARAM}
{E_vt_Array, C_ADDR_ARRAY_PARAM}
};
int fn_TypeConversionSize()
{
return(sizeof(a_stTypeConversiontable)/sizeof(a_stTypeConversiontable[0]));
}
char *fn_szFindStringTypeFromVariableType(tdeVariableType eType)
{
int i;
for(i=0;i<fn_TypeConversionSize();i++)
{
if (a_stTypeConversiontable[i].eType==eType)
{
return(a_stTypeConversiontable[i].szStringType);
}
}
return(USE_NO_PARAM);
}
*/
ACP_tdxBool IsADDRType(char cType)
{
return((ACP_tdxBool) islower((int) cType) );
}
char fn_cConvertToADDRType(char cType)
{
return((char) tolower((int) cType) );
}
char fn_cConvertFromADDRType(char cType)
{
return((char) toupper((int) cType) );
}
#endif /* ACTIVE_EDITOR*/
/**********************************************************************************************************************/
/* for multilanguage support : old aiinfo.c */
#if defined(ACTIVE_EDITOR)
/* C'est pour virer Proc,Cond,Action etc...*/
static char *fn_szConvertString(char *str)
{
char *ptr;
if ((ptr=strchr(str,'_'))!=NULL)
{
ptr++;
}
else
{
ptr=str;
}
return(ptr);
}
/* C'est pour Xavier qui veut que les noms des conditions <> <= >= etc soit les m<>mes en anglais et en francais !!!*/
static char *fn_szConvertConditionString(char *str1,char *str2)
{
if (!isalpha(str2[0]))
{
return(fn_szConvertString(str2));
}
return(fn_szConvertString(str1));
}
/* C'est pour Xavier qui veut qu'il y ait bijection entre les mots cl<63>s et les types des variables designers*/
/* C'est pour Xavier qui veut que les noms des types des variables commencent par une lettre !!!*/
static char TempChar[200];
static char *fn_szConvertDsgVarString(char *str1,char *str2)
{
if (!strnicmp(str2,"Type",4))
{
sprintf(&TempChar[0],"%sType",str1);
return(fn_szConvertString(&TempChar[0]));
}
else if ((isdigit(str1[0])) || (str1[0]=='_') )
{
sprintf(&TempChar[0],"Integer%s",str1);
return(&TempChar[0]);
}
return(str1);
}
void fn_vWriteAILangue()
{
FILE *fp;
if ((fp=fopen(AI_MULTI_LANGUAGE_SCRIPT,"wt"))!=NULL)
{
#define M_BAR "------------------------------------------------------------------"
#define M_WRITE_ALL_COMMAND_START(title,nb) fprintf(fp,";%s\n;%s\n;%s\n{%s:(%d)\n",M_BAR,title,M_BAR,title,nb);
#define M_WRITE_ALL_COMMAND_END() fprintf(fp,"}\n\n");
#define M_WRITE_ONE_COMMAND(title,key,fr,gb) \
fprintf(fp,"\t{%s:%s\n",title,key); \
fprintf(fp,"\t\t%s(%s)\n",AI_FRENCH,fr); \
fprintf(fp,"\t\t%s(%s)\n",AI_ENGLISH,gb); \
fprintf(fp,"\t}\n\n");
/* MetaActions*/
#define M_WRITE_ALL_METAACTIONS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_METAACTIONS,nb)
#define M_WRITE_ONE_METAACTION(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_METAACTION,key,fr,gb)
M_WRITE_ALL_METAACTIONS(fn_eGetNbMetaAction())
/*#define M_DEFINE_METAACTION(a,b,c,d,e,f) M_WRITE_ONE_METAACTION(c,b,fn_szConvertString(c))*/
#define M_DEFINE_METAACTION(a,b,english,c,d,e,f) M_WRITE_ONE_METAACTION(c,b,english)
#include "DefAct.h"
#undef M_DEFINE_METAACTION
M_WRITE_ALL_COMMAND_END()
/* Procedures*/
#define M_WRITE_ALL_PROCEDURES(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_PROCEDURES,nb)
#define M_WRITE_ONE_PROCEDURE(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_PROCEDURE,key,fr,gb)
M_WRITE_ALL_PROCEDURES(fn_eGetNbProcedure())
/*#define M_DEFINE_PROCEDURE(a,b,c,d,e,f) M_WRITE_ONE_PROCEDURE(c,b,fn_szConvertString(c))*/
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) M_WRITE_ONE_PROCEDURE(c,b,english)
#include "DefProc.h"
#undef M_DEFINE_PROCEDURE
M_WRITE_ALL_COMMAND_END()
/* Functions*/
#define M_WRITE_ALL_FUNCTIONS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_FUNCTIONS,nb)
#define M_WRITE_ONE_FUNCTION(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_FUNCTION,key,fr,gb)
M_WRITE_ALL_FUNCTIONS(fn_eGetNbFunc())
/*#define M_DEFINE_FUNCTION(a,b,c,d,e,f,g) M_WRITE_ONE_FUNCTION(c,b,fn_szConvertString(c))*/
#define M_DEFINE_FUNCTION(a,b,english,c,d,e,f,g) M_WRITE_ONE_FUNCTION(c,b,english)
#include "DefFunc.h"
#undef M_DEFINE_FUNCTION
M_WRITE_ALL_COMMAND_END()
/* Conditions*/
#define M_WRITE_ALL_CONDITIONS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_CONDITIONS,nb)
#define M_WRITE_ONE_CONDITION(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_CONDITION,key,fr,gb)
M_WRITE_ALL_CONDITIONS(fn_eGetNbCond())
/*#define M_DEFINE_CONDITION(a,b,c,d,e,f) M_WRITE_ONE_CONDITION(c,b,fn_szConvertConditionString(c,b))*/
#define M_DEFINE_CONDITION(a,b,english,c,d,e,f) M_WRITE_ONE_CONDITION(c,b,english)
#include "DefCond.h"
#undef M_DEFINE_CONDITION
M_WRITE_ALL_COMMAND_END()
/* KeyWords*/
#define M_WRITE_ALL_KEYWORDS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_KEYWORDS,nb)
#define M_WRITE_ONE_KEYWORD(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_KEYWORD,key,fr,gb)
M_WRITE_ALL_KEYWORDS(fn_eGetNbKeyWord())
/*#define M_DEFINE_KEYWORD(a,b,c,d,e,f) M_WRITE_ONE_KEYWORD(c,b,fn_szConvertString(c))*/
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) M_WRITE_ONE_KEYWORD(c,b,english)
#include "DefKey.h"
#undef M_DEFINE_KEYWORD
M_WRITE_ALL_COMMAND_END()
/* Fields*/
#define M_WRITE_ALL_FIELDS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_FIELDS,nb)
#define M_WRITE_ONE_FIELD(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_FIELD,key,fr,gb)
M_WRITE_ALL_FIELDS(fn_eGetNbField())
/*#define M_DEFINE_FIELD(a,b,c,d,e,f) M_WRITE_ONE_FIELD(c,b,fn_szConvertString(c))*/
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) M_WRITE_ONE_FIELD(c,b,english)
#include "DefFild.h"
#undef M_DEFINE_FIELD
M_WRITE_ALL_COMMAND_END()
/* Designer variables*/
#define M_WRITE_ALL_DSGVAR_TYPES(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_DSGVAR_TYPES,nb)
#define M_WRITE_ONE_DSGVAR_TYPE(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_DSGVAR_TYPE,key,fr,gb)
M_WRITE_ALL_DSGVAR_TYPES(fn_eGetNbDsgVarType())
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) M_WRITE_ONE_DSGVAR_TYPE(c,b,fn_szConvertDsgVarString(c,b))
#include "DefVar.h"
#undef M_DEFINE_DSGVAR_TYPE
M_WRITE_ALL_COMMAND_END()
/* SAI Type*/
#define M_WRITE_ALL_DSGVAR_SAVE_TYPES(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_DSGVAR_SAVE_TYPES,nb)
#define M_WRITE_ONE_DSGVAR_SAVE_TYPE(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_DSGVAR_SAVE_TYPE,key,fr,gb)
M_WRITE_ALL_DSGVAR_SAVE_TYPES(fn_ucGetSaveTypeNumber())
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) M_WRITE_ONE_DSGVAR_SAVE_TYPE(b,a,b)
#include "DefSAI.h"
#undef M_DEFINE_DSGVAR_SAVE_TYPE
M_WRITE_ALL_COMMAND_END()
/* OTI Type*/
#define M_WRITE_ALL_DSGVAR_INIT_TYPES(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_DSGVAR_INIT_TYPES,nb)
#define M_WRITE_ONE_DSGVAR_INIT_TYPE(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_DSGVAR_INIT_TYPE,key,fr,gb)
M_WRITE_ALL_DSGVAR_INIT_TYPES(fn_ucGetInitTypeNumber())
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) M_WRITE_ONE_DSGVAR_INIT_TYPE(b,a,b)
#include "DefOTI.h"
#undef M_DEFINE_DSGVAR_INIT_TYPE
M_WRITE_ALL_COMMAND_END()
fclose(fp);
}
}
#endif /* ACTIVE_EDITOR*/

View File

@@ -0,0 +1,16 @@
/************************************************************************************************
* Name: DataRay2.c *
* Author: Christophe Giraud *
* (c) UBI Simulations Annecy *
************************************************************************************************/
/* prevent the message : unreferenced inline function has been removed*/
#pragma warning (disable : 4514)
#include "MTH.h"
#include "dataray2.h"
tdstExtendDatas4Ray stExtendDatas4Ray;

View File

@@ -0,0 +1,31 @@
/************************************************************************************************
* Name: DataRay2.h *
* Use : Datas structures for Rayman II *
* Author: Christophe Giraud *
* (c) UBI Simulations Annecy *
************************************************************************************************/
#ifndef _DATARAY2_H
#define _DATARAY2_H
/*ANNECY CG {*/
/*ANNECY VL 11/05/98{*/
/*#define C_MAXMAGICPOINTS 255*/
/*#define C_MAXAIRPOINTS 255*/
/*ENDANNECY VL}*/
typedef struct
{
int iMagicPoints4Ray;
int iMagicPointsMax4Ray;
/*ANNECY VL 11/05/98{*/
MTH_tdxReal xAirPoints4Ray;
MTH_tdxReal xAirPointsMax4Ray;
/*ENDANNECY VL}*/
} tdstExtendDatas4Ray;
extern tdstExtendDatas4Ray stExtendDatas4Ray;
/*ENDANNECY CG }*/
#endif /*_DATARAY2_H*/

View File

@@ -0,0 +1,477 @@
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "AI_Struc.h"
#include "StrIntel.h"
#if !defined(OPTIMIZED_COMMAND)
#include "EnumFild.h"
#include "Convert.h"
#endif
#include "specif/AITools.h"
/*************************************/
/* get set field default functions : */
/*************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char fn_ucGetFieldDefaultFunction(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
hSuperObjPerso=hSuperObjPerso;
p_stGetSetParam=p_stGetSetParam;
return(C_INVALID_GET);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
unsigned char fn_ucSetFieldDefaultFunction(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
hSuperObjPerso=hSuperObjPerso;
p_stGetSetParam=p_stGetSetParam;
return(C_INVALID_SET);
}
/***************************************************************************/
/* get set field functions : <20> completer en fonction de la structure perso */
/***************************************************************************/
unsigned char fn_ucGetFieldPrevComportIntell(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
tdstComport *p_stComport;
p_stComport = M_GetPrevComport(AI_M_p_stGetIntelligence(AI_M_stGetMindOfSuperObj(hSuperObjPerso)));
M_Full_GetSetParam_pComport(p_stGetSetParam, p_stComport);
return(C_VALID_GET);
}
unsigned char fn_ucGetFieldPrevComportReflex(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
tdstComport *p_stComport;
p_stComport = M_GetPrevComport(AI_M_p_stGetReflex(AI_M_stGetMindOfSuperObj(hSuperObjPerso)));
M_Full_GetSetParam_pComport(p_stGetSetParam, p_stComport);
return(C_VALID_GET);
}
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Field for Shadow Scale.*/
/*/////////////////////////////////////////////////////////////////////////////////*/
unsigned char fn_ucGetFieldShadowScaleX(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
M_Full_GetSetParam_Float(p_stGetSetParam, fn_x3dDataGetShadowScaleXFromSO(hSuperObjPerso));
return(C_VALID_GET);
}
unsigned char fn_ucSetFieldShadowScaleX(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
fn_v3dDataSetShadowScaleXInSO(hSuperObjPerso, M_GetSetParam_xValue(p_stGetSetParam));
return(C_VALID_SET);
}
unsigned char fn_ucGetFieldShadowScaleY(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
M_Full_GetSetParam_Float(p_stGetSetParam, fn_x3dDataGetShadowScaleYFromSO(hSuperObjPerso));
return(C_VALID_GET);
}
unsigned char fn_ucSetFieldShadowScaleY(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
fn_v3dDataSetShadowScaleYInSO(hSuperObjPerso, M_GetSetParam_xValue(p_stGetSetParam));
return(C_VALID_SET);
}
/* eField_Position*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_cSetFieldPosition*/
/* set the value of the field "Position"*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan.15, 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char fn_ucSetFieldPosition(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
hSuperObjPerso = hSuperObjPerso;
p_stGetSetParam = p_stGetSetParam;
return(C_INVALID_SET);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*=====================================================================================================================================
Name: fn_cGetFieldPosition( Perso, WP )
Author: yann le tensorer
Created: October 12,1998 (rewriten for optimisations)
Last modified:
=====================================================================================================================================*/
unsigned char fn_ucGetFieldPosition(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
/* we just return the position*/
M_Full_GetSetParam_p_stVertex(p_stGetSetParam,&(hSuperObjPerso->hGlobalMatrix->stTranslationVector));
return(C_VALID_GET);
/*
//GEO_tdxHandleToMatrix hTempMatrix;
MTH3D_tdstVector stVertex;
// get the vectex of the super object
//hTempMatrix= HIE_fn_hGetSuperObjectMatrix(hSuperObjPerso);
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectMatrix(hSuperObjPerso), &stVertex);
// and affect return value
//MTH3D_M_vCopyVector(&M_GetSetParam_stVertexValue(p_stGetSetParam),&stVertex);
M_Full_GetSetParam_p_stVertex(p_stGetSetParam,&stVertex);
*/
}
/* eField_Orientation*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_cSetFieldOrientation*/
/* Set the value of the field "Orientation"*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan.28, 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
unsigned char fn_ucSetFieldOrientation(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
/* GEO_tdxHandleToMatrix hPersoMatrix;
MTH3D_tdstVector *p_stOrientationVertex;
MTH_tdxReal xAngle,xRealX,xRealY;
// get the new position
p_stOrientationVertex= &M_GetSetParam_stVertexValue(p_stGetSetParam);
// compute the angle
xRealX=p_stOrientationVertex->xX;
xRealY=p_stOrientationVertex->xY;
if(xRealX)
xAngle=MTH_M_xATan(xRealY / xRealX);
else if(MTH_M_bLess(xRealY ,MTH_C_ZERO))
xAngle=MTH_M_xNeg(MTH_C_PiBy2);
else
xAngle=MTH_C_PiBy2;
if(MTH_M_bLess(xRealX ,MTH_C_ZERO))
xAngle=MTH_M_xAdd(xAngle,MTH_C_Pi);
if(MTH_M_bLess(xAngle,MTH_C_ZERO))
xAngle=MTH_M_xAdd(xAngle,MTH_C_2Pi);
// get the matrix of the super object
hPersoMatrix= HIE_fn_hGetSuperObjectMatrix(hSuperObjPerso);
// affect the matrix (Z-axis rotation)
fn_vSetRotationMatrixZ(hPersoMatrix, xAngle);
return(C_VALID_SET);
*/
hSuperObjPerso=hSuperObjPerso;
p_stGetSetParam=p_stGetSetParam;
return(C_INVALID_SET);
}
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_cGetFieldOrientation*/
/* Get the value of the field "Orientation"*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan.28, 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
unsigned char fn_ucGetFieldOrientation(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MTH3D_tdstVector stVertexDirection, stVertex;
/* Axe -Y in global reference*/
MTH3D_M_vSetVectorElements(&stVertexDirection, MTH_C_ZERO, MTH_C_MinusONE, MTH_C_ZERO);
POS_fn_vMulMatrixVertex(&stVertexDirection,HIE_fn_hGetSuperObjectGlobalMatrix(hSuperObjPerso),&stVertexDirection);
/* position of perso*/
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(hSuperObjPerso),&stVertex);
/* (stVertexDirection - stVertex1) -> stVertexDirection*/
MTH3D_M_vSubVector(&stVertexDirection, &stVertexDirection, &stVertex);
MTH3D_M_vNormalizeVector(&stVertexDirection,&stVertexDirection);
/* and affect return value*/
/*MTH3D_M_vCopyVector(&M_GetSetParam_stVertexValue(p_stGetSetParam),&stVertexDirection);*/
/*M_GetSetParam_Type(p_stGetSetParam) = E_vt_Vector;*/
M_Full_GetSetParam_p_stVertex(p_stGetSetParam,&stVertexDirection);
return(C_VALID_GET);
}
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_cGetFieldSpeed*/
/* Get the value of the field "Speed"*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Methods: Get the rotation matrix of the object*/
/* and compute the direction of the perso*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan.28, 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
unsigned char fn_ucGetFieldSpeed(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MS_tdxHandleToDynam h_Dynam;
MTH3D_tdstVector *p_stDest = &(M_GetSetParam_stVertexValue(p_stGetSetParam));
h_Dynam = M_GetMSHandle(hSuperObjPerso,Dynam);
M_GetSetParam_Type(p_stGetSetParam) = E_vt_Vector;
if ( h_Dynam )
{
struct DNM_stDynamics *p_stDynamic;
p_stDynamic = fn_p_stDynamGetDynamics(h_Dynam);
if ( p_stDynamic )
{
/*MTH_tdxReal xReal;*/
/*MTH3D_tdstVector *p_stCurrSpeed;*/
*p_stDest = *DNM_M_pDynamicsGetPreviousSpeed (p_stDynamic);
/*p_stCurrSpeed = DNM_M_pDynamicsGetPreviousSpeed (pstDynamic);
xReal=MTH3D_M_xGetXofVector(p_stCurrSpeed);
MTH3D_M_vSetXofVector(p_stDest,xReal);
xReal=MTH3D_M_xGetYofVector(p_stCurrSpeed);
MTH3D_M_vSetYofVector(p_stDest,xReal);
xReal=MTH3D_M_xGetZofVector(p_stCurrSpeed);
MTH3D_M_vSetZofVector(p_stDest,xReal);*/
return(C_VALID_GET);
}
}
MTH3D_M_vNullVector(p_stDest);
// return(C_INVALID_GET);
return(C_VALID_GET);
}
unsigned char fn_ucGetFieldNormSpeed(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MS_tdxHandleToDynam h_Dynam;
h_Dynam = M_GetMSHandle(hSuperObjPerso,Dynam);
M_GetSetParam_Type(p_stGetSetParam) = E_vt_Float;
if (h_Dynam!=NULL)
{
struct DNM_stDynamics* pstDynamic;
pstDynamic = fn_p_stDynamGetDynamics(h_Dynam);
if ( pstDynamic )
{
MTH3D_tdstVector *p_stCurrSpeed = DNM_M_pDynamicsGetPreviousSpeed (pstDynamic);
M_GetSetParam_xValue(p_stGetSetParam) = MTH3D_M_xNormVector(p_stCurrSpeed);
return(C_VALID_GET);
}
}
M_GetSetParam_xValue(p_stGetSetParam) = MTH_C_ZERO;
// return(C_INVALID_GET);
return(C_VALID_GET);
}
/*
unsigned char fn_ucGetFieldSightAxis(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MTH3D_tdstVector *p_V1,*p_V2;
MS_tdxHandleToDynam h_Dynam;
M_GetSetParam_Type(p_stGetSetParam) = E_vt_Vector;
if((h_Dynam = M_GetMSHandle(hSuperObjPerso,Dynam)) == NULL )
return(C_INVALID_GET);
p_V1 = fn_p_DynamGetSightAxis(h_Dynam);
p_V2 = &(M_GetSetParam_stVertexValue(p_stGetSetParam));
MTH3D_M_vCopyVector(p_V2,p_V1);
return(C_VALID_SET);
return(C_INVALID_GET);
}
unsigned char fn_ucGetFieldFirstCompAxis(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MTH3D_tdstVector *p_V1,*p_V2;
MS_tdxHandleToDynam h_Dynam;
M_GetSetParam_Type(p_stGetSetParam) = E_vt_Vector;
if((h_Dynam = M_GetMSHandle(hSuperObjPerso,Dynam)) == NULL )
return(C_INVALID_GET);
p_V1 = fn_p_DynamGetFirstComplementaryAxis(h_Dynam);
p_V2 = &(M_GetSetParam_stVertexValue(p_stGetSetParam));
MTH3D_M_vCopyVector(p_V2,p_V1);
return(C_VALID_GET);
return(C_INVALID_GET);
}
unsigned char fn_ucGetFieldSecondCompAxis(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MTH3D_tdstVector *p_V1,*p_V2;
MS_tdxHandleToDynam h_Dynam;
M_GetSetParam_Type(p_stGetSetParam) = E_vt_Vector;
if((h_Dynam = M_GetMSHandle(hSuperObjPerso,Dynam)) == NULL )
return(C_INVALID_GET);
p_V1 = fn_p_DynamGetSecondComplementaryAxis(h_Dynam);
p_V2 = &(M_GetSetParam_stVertexValue(p_stGetSetParam));
MTH3D_M_vCopyVector(p_V2,p_V1);
return(C_VALID_GET);
return(C_INVALID_GET);
}
unsigned char fn_ucSetFieldSightAxis(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MTH3D_tdstVector *p_V;
MS_tdxHandleToDynam h_Dynam;
if((h_Dynam = M_GetMSHandle(hSuperObjPerso,Dynam)) == NULL )
return(C_INVALID_SET);
p_V = &(M_GetSetParam_stVertexValue(p_stGetSetParam));
fn_vDynamSetSightAxis(h_Dynam,p_V);
return(C_VALID_SET);
return(C_INVALID_SET);
}
unsigned char fn_ucSetFieldFirstCompAxis(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MTH3D_tdstVector *p_V;
MS_tdxHandleToDynam h_Dynam;
if((h_Dynam = M_GetMSHandle(hSuperObjPerso,Dynam)) == NULL )
return(C_INVALID_SET);
p_V = &(M_GetSetParam_stVertexValue(p_stGetSetParam));
fn_vDynamSetFirstComplementaryAxis(h_Dynam,p_V);
return(C_VALID_SET);
return(C_INVALID_SET);
}
unsigned char fn_ucSetFieldSecondCompAxis(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MTH3D_tdstVector *p_V;
MS_tdxHandleToDynam h_Dynam;
if((h_Dynam = M_GetMSHandle(hSuperObjPerso,Dynam)) == NULL )
return(C_INVALID_SET);
p_V = &(M_GetSetParam_stVertexValue(p_stGetSetParam));
fn_vDynamSetSecondComplementaryAxis(h_Dynam,p_V);
return(C_VALID_SET);
return(C_INVALID_SET);
}
*/
unsigned char fn_ucGetFieldAbsoluteAxisX(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
/*MTH3D_tdstVector *p_V;*/
POS_tdstCompletePosition *p_stAbsolutePosition = NULL;
MTH3D_tdstVector *p_stI = NULL,*p_stJ = NULL,*p_stK = NULL;
p_stAbsolutePosition = HIE_fn_hGetSuperObjectGlobalMatrix(hSuperObjPerso);
POS_fn_vGetRotationMatrix(p_stAbsolutePosition ,p_stI,p_stJ,p_stK);
/*p_V = &(M_GetSetParam_stVertexValue(p_stGetSetParam));*/
/*MTH3D_M_vCopyVector(p_V,p_stI);*/
M_Full_GetSetParam_p_stVertex(p_stGetSetParam,p_stI);
return(C_VALID_GET);
}
unsigned char fn_ucGetFieldAbsoluteAxisY(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
/* MTH3D_tdstVector *p_V;*/
POS_tdstCompletePosition *p_stAbsoluteGliPosition = NULL;
MTH3D_tdstVector *p_stI = NULL,*p_stJ = NULL,*p_stK = NULL;
p_stAbsoluteGliPosition = HIE_fn_hGetSuperObjectGlobalMatrix(hSuperObjPerso);
POS_fn_vGetRotationMatrix(p_stAbsoluteGliPosition ,p_stI,p_stJ,p_stK);
/* p_V = &(M_GetSetParam_stVertexValue(p_stGetSetParam));*/
/* MTH3D_M_vCopyVector(p_V,p_stJ);*/
M_Full_GetSetParam_p_stVertex(p_stGetSetParam,p_stI);
return(C_VALID_GET);
}
unsigned char fn_ucGetFieldAbsoluteAxisZ(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
/* MTH3D_tdstVector *p_V;*/
POS_tdstCompletePosition *p_stAbsoluteGliPosition = NULL;
MTH3D_tdstVector *p_stI = NULL,*p_stJ = NULL,*p_stK = NULL;
p_stAbsoluteGliPosition = HIE_fn_hGetSuperObjectGlobalMatrix(hSuperObjPerso);
POS_fn_vGetRotationMatrix(p_stAbsoluteGliPosition ,p_stI,p_stJ,p_stK);
/* p_V = &(M_GetSetParam_stVertexValue(p_stGetSetParam));*/
/* MTH3D_M_vCopyVector(p_V,p_stK);*/
M_Full_GetSetParam_p_stVertex(p_stGetSetParam,p_stI);
return(C_VALID_GET);
}
/* JO 07/11/97*/
/* ANNECY AV {*/
/* These functions are not used anymore
unsigned char fn_ucSetFieldCollisionFlag(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MS_tdxHandleToCollSet hMSCollSet;
unsigned char ucCollisionFlag;
if((hMSCollSet = M_GetMSHandle(hSuperObjPerso,CollSet)) == NULL )
return(C_INVALID_SET);
ucCollisionFlag = M_GetSetParam_cValue(p_stGetSetParam);
fn_vCollSetSetCharacterCollisionFlag(hMSCollSet,ucCollisionFlag);
return(C_VALID_SET);
}
unsigned char fn_ucGetFieldCollisionFlag(HIE_tdxHandleToSuperObject hSuperObjPerso, tdstGetSetParam *p_stGetSetParam)
{
MS_tdxHandleToCollSet hMSCollSet;
// pas bon
// if((hMSCollSet = M_GetMSHandle(hSuperObjPerso,CollSet)) == NULL )
// return( C_INVALID_GET );
// M_GetSetParam_xValue(p_stGetSetParam) = fn_ucCollSetGetCharacterCollisionFlag(hMSCollSet);
// return(C_VALID_GET);
long lValue=0;
char ret=C_INVALID_GET;
if((hMSCollSet = M_GetMSHandle(hSuperObjPerso,CollSet)) != NULL )
{
lValue=(long) fn_ucCollSetGetCharacterCollisionFlag(hMSCollSet);
ret=C_VALID_GET;
}
M_Full_GetSetParam_Integer(p_stGetSetParam,lValue);
return(ret);
}
*/
/* END ANNECY AV }*/
/***********************************************************************************************/
#if !defined(OPTIMIZED_COMMAND)
void fn_vInitFieldEntries(void)
{
/* Init*/
#if defined(__DEBUG_AI__)
fn_vInitFieldTable(fn_ucGetFieldDefaultFunction,fn_ucSetFieldDefaultFunction);
#endif
/* Field definitions*/
#define M_DEFINE_FIELD(a,b,english,c,d,e,f) fn_vDefineFieldEntry(M_FIELD_ENTRY(a,b,english,c,d,e,f));
#include "DefFild.h"
#undef M_DEFINE_FIELD
#if defined(__DEBUG_AI__)
fn_vCheckFieldTable(fn_ucGetFieldDefaultFunction,fn_ucSetFieldDefaultFunction);
#endif
}
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,10 @@
#if !defined(__FIELDS_H__)
#define __FIELDS_H__
#include "specif/AiOption.h"
#if !defined(OPTIMIZED_COMMAND)
void fn_vInitFieldEntries(void);
#endif /* OPTIMIZED_COMMAND*/
#endif /*__FIELDS_H__*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
/*---------------------------------------------------------------------------*/
/* Function.h : Definition of general Function.*/
/* auteur : Olivier Didelot.*/
/* date : 05/11/1996*/
/* 970120 : AddList (Fabien Morales) */
/* 970123 : O.C.*/
/*---------------------------------------------------------------------------*/
#if !defined(__FUNCTION_H__)
#define __FUNCTION_H__
#include "specif/AiOption.h"
#if !defined(OPTIMIZED_COMMAND)
void fn_vInitFunctionEntries(void);
#endif /* OPTIMIZED_COMMAND*/
#endif /* __FUNCTION_H__*/

View File

@@ -0,0 +1,403 @@
/*---------------------------------------------------------------------------*/
/* KeyWord.c : Definition of general keyword.*/
/* auteur : Olivier Couvreur.*/
/* date : 19/08/1997*/
/*---------------------------------------------------------------------------*/
#ifdef _DEBUG
extern "C" char gcGlobAleat;
#else
extern char gcGlobAleat;
#endif
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "AI_Struc.h"
#include "StrIntel.h"
#include "Intell.h"
#include "EnumKey.h"
#include "ActConst.h"
#if defined(ACTIVE_AIDEBUG)
#include "specif/AID_Trac.h"
#include "AID_Erm.h"
#endif
/************************************************************************************/
/* HERE IS THE BEGINNING /
/************************************************************************************/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
tdstNodeInterpret *fn_p_stDefaultKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
p_SuperObjPerso=p_SuperObjPerso;
p_stValue=p_stValue;
#if defined(__DEBUG_AI__)
M_AIFatalError(E_uwAIFatalUnknownKeyWord);
#endif
return(p_stTree);
}
#endif /* _DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/
#if defined(ACTIVE_EDITOR)
tdstNodeInterpret *fn_p_stMiscKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
p_SuperObjPerso=p_SuperObjPerso;
p_stValue=p_stValue;
p_stTree=p_stTree;
#if defined(__DEBUG_AI__)
M_AIFatalError(E_uwAIFatalUnknownKeyWord);
#endif /* DEBUG_AI*/
return(p_stTree);
}
#endif /* ACTIVE_EDITOR*/
tdstNodeInterpret *fn_p_stNoActionKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_Full_GetSetParam_Action(p_stValue, NULL);
return(p_stTree);
}
tdstNodeInterpret *fn_p_stMeKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_GetSetParam_p_stEngineObjValue(p_stValue) = M_GetEngineObject(p_SuperObjPerso);
M_GetSetParam_Type(p_stValue) = E_vt_Perso;
return(p_stTree);
}
tdstNodeInterpret *fn_p_stMainActorKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_GetSetParam_p_stEngineObjValue(p_stValue) = M_GetEngineObject(MC_fn_hGetCharacterInMainCharacterNode(MC_fn_hGetFirstMainCharNode()));
M_GetSetParam_Type(p_stValue) = E_vt_Perso;
return(p_stTree);
}
/*tdstNodeInterpret *fn_p_stWorldKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_GetSetParam_p_stEngineObjValue(p_stValue) = M_GetEngineObject(g_stEngineStructure.h_WorldCaracter);
M_GetSetParam_Type(p_stValue) = E_vt_Perso;
return(p_stTree);
}*/
/* ANNECY OA - 13/08/99 { */
#ifndef U64
tdstNodeInterpret *fn_p_stNoSuperObjectKeyWord(HIE_tdxHandleToSuperObject p_SuperObj, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_GetSetParam_p_stEngineObjValue(p_stValue) = NULL;
M_GetSetParam_Type(p_stValue) = E_vt_SuperObject;
return(p_stTree);
}
#endif
/* END ANNECY OA } */
tdstNodeInterpret *fn_p_stNobodyKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_GetSetParam_p_stEngineObjValue(p_stValue) = NULL;
M_GetSetParam_Type(p_stValue) = E_vt_Perso;
return(p_stTree);
}
tdstNodeInterpret *fn_p_stNowhereKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_Full_GetSetParam_WayPoint(p_stValue,WP_C_hWayPointInvalid);
return(p_stTree);
}
tdstNodeInterpret *fn_p_stEmptyTextKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_Full_GetSetParam_hText(p_stValue, FON_C_xInvalidTextHandle);
return(p_stTree);
}
/*ANNECY Bart 06/02/98 {*/
tdstNodeInterpret *fn_p_stCapsNullKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_Full_GetSetParam_Caps(p_stValue, 0);
return(p_stTree);
}
tdstNodeInterpret *fn_p_stNoGraphKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
M_Full_GetSetParam_Graph(p_stValue, NULL); /* NULL ?*/
return(p_stTree);
}
/*ENDANNECY Bart }*/
static tdstNodeInterpret *fn_p_stSkipThenElseParameter(tdstNodeInterpret *p_stTree, tdstNodeInterpret *p_stTreeInit)
{
#if defined(OPTIMIZE_SWAP_PARAMETER)
if(M_NodeToSkip(p_stTreeInit))/*CBOPT p_stTree*/
{
return (p_stTreeInit+M_NodeToSkip(p_stTreeInit)); /* Swap "then/else" parameter.*/
}
else
{
p_stTree = fn_p_stSwapNextParameter(p_stTree + 1); /* Swap "then/else" parameter.*/
M_NodeToSkip(p_stTreeInit)=(unsigned short) (p_stTree-p_stTreeInit);
}
#else
p_stTree++; /* Swap Then/Else node.*/
p_stTree = fn_p_stSwapNextParameter(p_stTree); /* Swap "then/else" parameter.*/
#endif /* OPTIMIZE_SWAP_PARAMETER*/
return p_stTree;
}
tdstNodeInterpret *fn_p_stThenKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
return fn_p_stIntelligenceEvalTreeEngine(p_SuperObjPerso, p_stTree, p_stValue);
}
tdstNodeInterpret *fn_p_stElseKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
p_stTree--; /* Fixe tree on Else Node.*/
return fn_p_stSkipThenElseParameter(p_stTree, p_stTree);
}
#ifndef U64 /* AR9809*/
extern char gcGlobAleat;
#ifdef __DEBUG_AI__
__declspec(dllexport) char gcSimulateRelease = 0;
#else
__declspec(dllexport) char gcSimulateRelease = 1;
#endif
#else
char gcSimulateRelease = 1;
#endif /*U64*/
#ifndef U64 /* AR9809*/
__declspec(dllexport) char gcSimulateNotU64 = 0;
#else
char gcSimulateNotU64 = 1;
#endif /*U64*/
/************************************************************************************/
tdstNodeInterpret *fn_p_stIfDebug(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
enum tdeKeyWordId_ eKeyId=M_eKeyWordIdInterpret(p_stTree-1);
p_SuperObjPerso=p_SuperObjPerso;
p_stValue=p_stValue;
if((eKeyId == eKeyWord_IfDebug) && (gcSimulateRelease))
{
p_stTree = fn_p_stSkipThenElseParameter(p_stTree-1, p_stTree-1);
}
M_Full_GetSetParam_ActionReturn(p_stValue, C_ACTION_ENGINE_CONTINUE);
return(p_stTree);
}
/************************************************************************************/
tdstNodeInterpret *fn_p_stIfNotU64(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
enum tdeKeyWordId_ eKeyId=M_eKeyWordIdInterpret(p_stTree-1);
p_SuperObjPerso=p_SuperObjPerso;
p_stValue=p_stValue;
if((eKeyId == eKeyWord_IfNotU64) && (gcSimulateNotU64))
{
p_stTree = fn_p_stSkipThenElseParameter(p_stTree-1, p_stTree-1);
}
M_Full_GetSetParam_ActionReturn(p_stValue, C_ACTION_ENGINE_CONTINUE);
return(p_stTree);
}
/************************************************************************************/
tdstNodeInterpret *fn_p_stIfKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
tdstNodeInterpret *p_stTreeInit=p_stTree-1; /* p_stTreeInit link to If node.*/
char cMax = 0;
if(M_eKeyWordIdInterpret(p_stTreeInit) == eKeyWord_If)
{
M_EvalNextParameter(p_stValue);
}
else
{
switch(M_eKeyWordIdInterpret(p_stTreeInit))
{
case eKeyWord_If2:
cMax = gcGlobAleat & 0x01;
goto ComIf;
case eKeyWord_If4:
cMax = gcGlobAleat & 0x03;
goto ComIf;
case eKeyWord_If8:
cMax = gcGlobAleat & 0x07;
goto ComIf;
case eKeyWord_If16:
cMax = gcGlobAleat & 0x0F;
goto ComIf;
ComIf:
if(cMax)
{
M_GetSetParam_lValue(p_stValue) = 0;
/*
* bidouille pour <20>viter les plantages dans le cas d'un if - cond - then avec qu'un seul
* noeud au milieu.
* p_stTreeInit = If (profondeur n) , p_stTree = Cond (prof n+1)
* la ligne suivante recherche le then de m<>me niveau que le if (p_stTree + 2)
*/
p_stTree = fn_p_stSkipThenElseParameter(p_stTreeInit, p_stTree);
}
else
{
M_EvalNextParameter(p_stValue);
}
break;
case eKeyWord_IfNot:
M_EvalNextParameter(p_stValue);
M_GetSetParam_lValue(p_stValue) = M_GetSetParam_lValue(p_stValue) != 0 ? 0 : 1;
break;
/*XB(07/01/98)*/
default:
break;
/*End XB*/
}
}
/* Eval the condition*/
/*M_EvalNextParameter(p_stValue);*/
if (M_GetSetParam_lValue(p_stValue) != 0)
{ /* Condition is True.*/
#if defined(ACTIVE_AIDEBUG)
AIDebug_M_SetKeyWord
(
AI_M_stGetMindOfSuperObj(p_SuperObjPerso),
p_stValue,
p_stTree
);
#endif /*ACTIVE_AIDEBUG*/
p_stTree++; /* Swap Then node.*/
/*p_stTree = fn_p_stIntelligenceEvalTreeEngine(p_SuperObjPerso, p_stTree, p_stValue); // Eval "then" parameter.
if ( (M_GetTypeInterpret(p_stTree) == E_ti_KeyWord)
&& (M_eKeyWordIdInterpret(p_stTree) == eKeyWord_Else))
{ // There is Else node.
return fn_p_stSkipThenElseParameter(p_stTree, p_stTree);
}*/
}
else
{ /* Condition is False.*/
if (!M_IsTheEndOfTree(p_stTree))
p_stTree = fn_p_stSkipThenElseParameter(p_stTree, p_stTreeInit);
if (M_DepthInterpret(p_stTree) == M_DepthInterpret(p_stTreeInit))
{
if ( (M_GetTypeInterpret(p_stTree) == E_ti_KeyWord)
&& (M_eKeyWordIdInterpret(p_stTree) == eKeyWord_Else))
{
#if defined(ACTIVE_AIDEBUG)
AIDebug_M_SetKeyWord
(
AI_M_stGetMindOfSuperObj(p_SuperObjPerso),
p_stValue,
p_stTree
);
#endif /*ACTIVE_AIDEBUG*/
p_stTree++; /* Swap Else node.*/
}
/* Eval next parameter.*/
/*M_EvalNextParameter(p_stValue);*/
}
}
M_Full_GetSetParam_ActionReturn(p_stValue, C_ACTION_ENGINE_CONTINUE);
return(p_stTree);
}
tdstNodeInterpret *fn_p_stEngineGotoKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
char szForErrorString[200];
tdstNodeInterpret *p_stTempTree;
long lValue;
M_EvalNextParameter(p_stValue);
lValue = M_ReturnParam_lValue(p_stValue);
M_Full_GetSetParam_ActionReturn(p_stValue, C_ACTION_ENGINE_CONTINUE);
if (lValue == 0)
{
sprintf(szForErrorString,"parameter zero in %s", AI_M_szGetSuperObjectName(p_SuperObjPerso));
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningEngineGoto,C_ucErmOpenInfoWindow,szForErrorString);
}
else
if (lValue < 0)
{
tdstNodeInterpret *p_stBeginTree = M_GetNodeInterpret(M_GetRuleN(g_p_stIntelligence, g_ucNRule));
p_stTempTree = p_stTree+lValue;
if (p_stTempTree < p_stBeginTree)
{
sprintf(szForErrorString,"out of interpret tree (negative) in %s", AI_M_szGetSuperObjectName(p_SuperObjPerso));
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningEngineGoto,C_ucErmOpenInfoWindow,szForErrorString);
}
else
return p_stTempTree;
}
else
/* lValue > 0*/
{
long i;
p_stTempTree = p_stTree;
for (i = 0; i < lValue; i++)
{
if (M_IsTheEndOfTree(p_stTempTree))
{
sprintf(szForErrorString,"out of interpret tree (positive) in %s", AI_M_szGetSuperObjectName(p_SuperObjPerso));
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningEngineGoto,C_ucErmOpenInfoWindow,szForErrorString);
return p_stTree;
}
else
p_stTempTree++;
}
return p_stTempTree;
}
return(p_stTree);
}
/************************************************************************************/
/* HERE IS THE END */
/************************************************************************************/
/****************************************************************************************/
/* to call once before anything else related to KeyWord */
/****************************************************************************************/
#if !defined(OPTIMIZED_COMMAND)
#include "Convert.h"
#include "ProtCond.h"
void fn_vInitKeyWordEntries(void)
{
/* Init*/
#if defined(__DEBUG_AI__)
fn_vInitKeyWordTable(fn_p_stDefaultKeyWord);
#endif
/* KeyWord definition*/
#define M_DEFINE_KEYWORD(a,b,english,c,d,e,f) fn_vDefineKeyWordEntry(M_KEYWORD_ENTRY(a,b,english,c,d,e,f));
#include "DefKey.h"
#undef M_DEFINE_KEYWORD
/* Check*/
#if defined(__DEBUG_AI__)
fn_vCheckKeyWordTable(fn_p_stDefaultKeyWord);
#endif /* __DEBUG_AI__*/
}
#endif /* OPTIMIZED_COMMAND*/

View File

@@ -0,0 +1,15 @@
/*---------------------------------------------------------------------------*/
/* Keyword.h : Definition of general Keyword.*/
/* auteur : Olivier Couvreur*/
/* date : 19/08/1997*/
/*---------------------------------------------------------------------------*/
#if !defined(__KEYWORD_H__)
#define __KEYWORD_H__
#include "specif/AiOption.h"
#if !defined(OPTIMIZED_COMMAND)
void fn_vInitKeyWordEntries(void);
#endif /* OPTIMIZED_COMMAND*/
#endif /* __CONDITION_H__*/

View File

@@ -0,0 +1,300 @@
/*
*=======================================================================================
* Name :MGT_Proc.c
*
* Author : QiZeYu Date : Dec.18, 1997
*
* Description : All AI Functions for the magnet
*=======================================================================================
* Modification -> Author : Date :
* Description :
*=======================================================================================
*/
#ifndef D_THROW_MGT
#define D_CineInfo_StructureDefine
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Intell.h"
#include "StrIntel.h"
#include "EnumProc.h"
#include "EnumFunc.h"
#include "Convert.h"
#include "AI_Struc.h"
#include "DsgMem.h" /* for fn_bFindPersoInList*/
#include "specif/AITools.h"
#include "EnumCond.h"
#include "Operator.h"
#include "WPWayPt.h"
#include "GLI.h"
#include "GEO.h"
#include "PO.h"
/*XB980821*/
#ifndef D_THROW_IPO
#include "IPO.h"
#endif /* D_THROW_IPO */
/*End XB*/
#include "SPO.h"
#include "CAM_Base.h"
#include "CAM_Tool.h"
#include "CAM_Vis.h"
/*XB980429*/
/*#include "incGAM.h"*/
#include "scr.h"
#include "snd.h"
#include "pcs.h"
#include "geo.h"
#include "gld.h"
#include "gli.h"
#include "mec.h"
#include "lst.h"
#ifdef USE_IPT_DX5
#include "IPT_DX5.h" /* InPuT (absolutely before GAM.h)*/
#else /* USE_IPT_WIN */
#include "IPT.h" /* InPuT (absolutely before GAM.h)*/
#endif /* USE_IPT_WIN */
/* Shaitan Clean Env {*/
/*#include "srf.h"*/
/*#include "env.h"*/
/* End Shaitan Clan Env }*/
#include "sct.h"
#ifndef D_THROW_PRT
#include "PRT.h"
#endif /* D_THROW_PRT */
#include "gam.h"
/*End XB*/
#include "mgt.h"
#define _WP_D_DEFINE_WAYPOINTS_
#include "WP_Handl.h"
#include "WP_Func.h"
/*XB980821*/
#ifndef D_THROW_IPO
#include "ISI.h"
#endif /* D_THROW_IPO */
/*End XB*/
#undef _WP_D_DEFINE_WAYPOINTS_
/*
*=================================================================================================
* Procedure to turn the Magnet on
* parameters :
* PERSO : magnet reference
*
* Author : QiZeYu Date : Dec.18, 1997
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *MGT_fn_p_stActiveMagnet(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree - 1);
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
MGT_fn_vAddObjectToMagnetList(hNewSuperObjPerso);
return (p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
* Procedure to turn the Magnet off
* parameters :
* PERSO : magnet reference
*
* Author : QiZeYu Date : Dec.18, 1997
*=================================================================================================
*/
tdstNodeInterpret *MGT_fn_p_stDeactiveMagnet(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
MS_tdxHandleToMSMagnet hMagnet;
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree - 1);
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
hMagnet = M_GetMSHandle(hNewSuperObjPerso,MSMagnet);
if( hMagnet )
{
if( (fn_lMSMagnetGetStatus(hMagnet)==MAGNETGROWING)||(fn_lMSMagnetGetStatus(hMagnet)==MAGNETON) )
{
fn_vMSMagnetSetStatus(hMagnet, MAGNETRECOVERING);
}
}
return (p_stTree);
}
/*
*=================================================================================================
* Procedure to set the Magnet parameter
* parameters :
* PERSO : magnet reference
* REAL : Range
*
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *MGT_fn_p_stSetParam(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
MS_tdxHandleToMSMagnet hMagnet;
MTH_tdxReal xValue;
unsigned long ulDuration;
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree - 1);
tdstGetSetParam stValue;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
hMagnet = M_GetMSHandle(hNewSuperObjPerso,MSMagnet);
if( hMagnet )
{
M_EvalNextParameter( &stValue );
switch(eProcedureId)
{
case eProc_Magnet_SetStrength:
xValue = M_GetSetParam_xValue(&stValue);
fn_vMSMagnetSetStrength(hMagnet,xValue);
break;
case eProc_Magnet_SetFar:
xValue = M_GetSetParam_xValue(&stValue);
fn_vMSMagnetSetFar(hMagnet,xValue);
break;
case eProc_Magnet_SetNear:
xValue = M_GetSetParam_xValue(&stValue);
fn_vMSMagnetSetNear(hMagnet,xValue);
break;
case eProc_Magnet_SetDuration:
ulDuration = M_GetSetParam_lValue(&stValue);
fn_vMSMagnetSetDuration(hMagnet, ulDuration);
break;
default:
M_AIFatalError(E_uwAIFatalNotValidProcedure);
break;
}
}
return (p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
*=================================================================================================
* Get the information of the magnet
* Parameter :
* Perso : magnet handle
*=================================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *MGT_fn_p_stGetInfo(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue)
{
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
MS_tdxHandleToMSMagnet hMagnet;
MTH_tdxReal xNorm;
unsigned long ulDuration;
enum tdeFuncId_ eFuncId=M_eFuncIdInterpret(p_stTree-1);
tdstGetSetParam stValue;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetFunctionUltraOperator(eFuncId),p_SuperObjPerso,&hNewSuperObjPerso);
hMagnet = M_GetMSHandle(hNewSuperObjPerso,MSMagnet);
/* Get Magnet Handle */
if(hMagnet==NULL) return (p_stTree);
M_EvalNextParameter(&stValue);
switch(eFuncId)
{
case eFunc_GetMagnetStrength :
xNorm = fn_xMSMagnetGetStrength(hMagnet);
M_Full_GetSetParam_Float(p_stValue,xNorm);
break;
case eFunc_GetMagnetFar:
xNorm = fn_xMSMagnetGetFar(hMagnet);
M_Full_GetSetParam_Float(p_stValue,xNorm);
break;
case eFunc_GetMagnetNear:
xNorm = fn_xMSMagnetGetNear(hMagnet);
M_Full_GetSetParam_Float(p_stValue,xNorm);
break;
case eFunc_GetMagnetDuration:
ulDuration = fn_ulMSMagnetGetDuration(hMagnet);
M_Full_GetSetParam_Time(p_stValue,ulDuration);
default :
M_AIFatalError(E_uwAIFatalNotValidFunction);
break;
}
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/**********************************************************************
* Condition: Magnet_EstActif ( toto ) *
* true if actor's magnet is activated *
* Author : Marc Trabucato *
* Date of last modification: 13/03/98 *
**********************************************************************/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *fn_p_stMagnetActivated (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, long *p_lValue)
{
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
MS_tdxHandleToMSMagnet hMagnet;
enum tdeCondId_ eCondId = M_eCondIdInterpret(p_stTree-1);
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
fn_vGetUltraOperatorPerso(fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
hMagnet = M_GetMSHandle(hNewSuperObjPerso,MSMagnet);
if( hMagnet )
{
switch( fn_lMSMagnetGetStatus( hMagnet ) )
{
case MAGNETOFF:
case MAGNETRECOVERING:
*p_lValue = FALSE;
break;
case MAGNETON:
case MAGNETGROWING:
*p_lValue = TRUE;
break;
}
}
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
#endif /* D_THROW_MGT */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
/*---------------------------------------------------------------------------*/
/* Operator.h : Definition of Operators.*/
/* auteur : Olivier Didelot.*/
/* date : 21/01/1997*/
/* modify : 31/01/1997 (O.C) script & editor names + Lint*/
/* modify : Olivier Couvreur*/
/* date : 18/02/1997 CPA_EXPORT + new functions for editor*/
/* modify : Olivier Couvreur*/
/* date : 26/06/1997 Now, Operators are function pointers*/
/*---------------------------------------------------------------------------*/
#if !defined(__OPERATOR_H__)
#define __OPERATOR_H__
/* PLEASE DON'T USE THESE THREE FUNCTIONS WITHOUT CARE */
void fn_vSetUltraOperatorPerso(HIE_tdxHandleToSuperObject hCurrentSuperObjPerso,HIE_tdxHandleToSuperObject hNewCurrentSuperObjPerso);
void fn_vGetUltraOperatorPerso(unsigned char bYouHaveRightToUseThisFunction,HIE_tdxHandleToSuperObject hCurrentSuperObjPerso,HIE_tdxHandleToSuperObject *hNewCurrentSuperObjPerso);
tdstNodeInterpret *fn_p_stOperatorGetPerso(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, HIE_tdxHandleToSuperObject *hSuperObjPersoFound);
#include "specif/AiOption.h"
#if !defined(OPTIMIZED_COMMAND)
void fn_vInitOperatorEntries(void);
#endif
#endif /* __OPERATOR_H__*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
/*---------------------------------------------------------------------------*/
/* Procedur.h : Definition of general Procedure.*/
/* auteur : Olivier Didelot.*/
/* date : 10/04/1997*/
/*---------------------------------------------------------------------------*/
#if !defined(__PROCEDUR_H__)
#define __PROCEDUR_H__
/*
void fn_vSetDirectionSpeed(HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH3D_tdstVector *p_stVect);
void fn_vAddDirectionSpeed(HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH3D_tdstVector *p_stAddVect);
void fn_vSetImpulse(HIE_tdxHandleToSuperObject p_SuperObjPerso, MTH3D_tdstVector *p_stVect);
*/
#include "specif/AiOption.h"
#if !defined(OPTIMIZED_COMMAND)
void fn_vInitProcedureEntries(void);
#endif /* OPTIMIZED_COMMAND*/
#endif /* __PROCEDUR_H__*/

View File

@@ -0,0 +1,225 @@
/**********************************************************
* *
* ProcMorph.c *
* *
* This file contains all the AI procedures and *
* conditions for the morphing *
* *
* Author : Ubi China - Alexis Vaisse *
* *
**********************************************************/
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "Intell.h"
#include "Action.h"
#include "StrIntel.h"
#include "DsgMem.h"
#include "EnumProc.h"
#include "specif/AITools.h"
#include "Operator.h"
#include "Convert.h"
#define PO_FRIEND
#include "PO.h"
#include "mor.h"
#if !defined(OPTIMIZED_COMMAND)
/* Procedure prototypes*/
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) struct tdstNodeInterpret_ *##d(HIE_tdxHandleToSuperObject, struct tdstNodeInterpret_ *);
#include "DefProc.h"
#undef M_DEFINE_PROCEDURE
#endif /* !OPTIMIZED_COMMAND*/
/*-----------------------------------------------------------------------------
* Name : fn_p_stPrepareMorph
*-----------------------------------------------------------------------------
* Description : the "MOD_PrepareMorph" AI procedure
*-----------------------------------------------------------------------------*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret * fn_p_stPrepareMorph (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret * p_stTree)
{
ACP_tdxIndex xStartIndexInObjectTable;
ACP_tdxIndex xEndIndexInObjectTable;
int iNbMillisecond;
unsigned char ucMorphType;
ACP_tdxIndex xChannelIndex;
tdstGetSetParam stValue [5];
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
enum tdeProcedureId_ eProcId=M_eProcedureIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso (fn_ucGetProcedureUltraOperator(eProcId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
M_EvalNextParameter(&stValue[0]);
M_EvalNextParameter(&stValue[1]);
M_EvalNextParameter(&stValue[2]);
M_EvalNextParameter(&stValue[3]);
M_EvalNextParameter(&stValue[4]);
xStartIndexInObjectTable = M_GetSetParam_lValue(&stValue[0]); /* First parameter : index of the 'start' object in the object table*/
xEndIndexInObjectTable = M_GetSetParam_lValue(&stValue[1]); /* Second parameter : index of the 'end' object in the object table*/
iNbMillisecond = M_GetSetParam_lValue(&stValue[2]); /* Third parameter : number of milisecond for the morphing*/
ucMorphType = M_GetSetParam_lValue(&stValue[3]); /* Fourth parameter : morphing type (can be 1, 2 or 3)*/
xChannelIndex = M_GetSetParam_lModuleValue(&stValue[4]); /* Fifth parameter : the channel number*/
if (MOR_fn_xPrepareMorph (p_SuperObjPerso, xStartIndexInObjectTable, xEndIndexInObjectTable,
iNbMillisecond, 0, iNbMillisecond, ucMorphType, xChannelIndex) == -1)
{
//XB 10/08/99
/* Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, E_uwAIWarningScriptError , C_lErmNoDebugData,
C_ucErmOpenInfoWindow, C_ucNeverStopForDebug,
"Morphing requires two objects with the same number of points");
Erm_M_ClearLastError(C_ucErmDefaultChannel);*/
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, "Morphing requires two objects with the same number of points")
//End XB 10/08/99
/*XB*/
#if (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)
#if !defined(U64_AIDEBUG) /* Oliv' - 23/11/1998*/
fn_vSetStopAIEngineFlag();
#endif /* !defined(U64_AIDEBUG)*/
#endif /* (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)*/
/*End XB*/
}
return (p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*-----------------------------------------------------------------------------
* Name : fn_p_stStopMorph
*-----------------------------------------------------------------------------
* Description : the "MOD_StopMorph" AI procedure
*-----------------------------------------------------------------------------*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret * fn_p_stStopMorph (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret * p_stTree)
{
tdstGetSetParam stValue;
ACP_tdxIndex xChannelIndex;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
enum tdeProcedureId_ eProcId=M_eProcedureIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso (fn_ucGetProcedureUltraOperator(eProcId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
M_EvalNextParameter (& stValue);
xChannelIndex = M_GetSetParam_lModuleValue (& stValue); /* Parameter : the channel number*/
MOR_fn_xStopMorph(p_SuperObjPerso , xChannelIndex);
return (p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*-----------------------------------------------------------------------------
* Name : fn_p_stIsMorphing
*-----------------------------------------------------------------------------
* Description : the "MOD_MorphingEnCours" AI condition
*-----------------------------------------------------------------------------*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *fn_p_stIsMorphing (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret * p_stTree, long * p_lValue)
{
tdstGetSetParam stValue;
ACP_tdxIndex xChannelIndex;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
enum tdeCondId_ eCondId=M_eCondIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso (fn_ucGetConditionUltraOperator(eCondId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
M_EvalNextParameter (& stValue);
xChannelIndex = M_GetSetParam_lModuleValue (& stValue); /* Parameter : the channel number*/
/* Ask the morphing module to know if the channel contains an morphed object*/
* p_lValue = MOR_fn_bIsChannelMorphed (p_SuperObjPerso, xChannelIndex);
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*-----------------------------------------------------------------------------
* Name : fn_p_stMorphiong
*-----------------------------------------------------------------------------
* Description : the "MOD_Morphing" AI procedure
*-----------------------------------------------------------------------------*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret * fn_p_stMorphing (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret * p_stTree)
{
ACP_tdxIndex xStartIndexInObjectTable;
ACP_tdxIndex xEndIndexInObjectTable;
ACP_tdxIndex xRatio; /* between 0 and 100*/
ACP_tdxIndex xChannelIndex;
tdstGetSetParam stValue [4];
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
enum tdeProcedureId_ eProcId=M_eProcedureIdInterpret(p_stTree-1);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso (fn_ucGetProcedureUltraOperator(eProcId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
M_EvalNextParameter(&stValue[0]);
M_EvalNextParameter(&stValue[1]);
M_EvalNextParameter(&stValue[2]);
M_EvalNextParameter(&stValue[3]);
xStartIndexInObjectTable = M_GetSetParam_lValue(&stValue[0]); /* First parameter : index of the 'start' object in the object table*/
xEndIndexInObjectTable = M_GetSetParam_lValue(&stValue[1]); /* Second parameter : index of the 'end' object in the object table*/
xRatio = M_GetSetParam_lValue(&stValue[2]); /* Third parameter : morphing ratio between 0 and 100*/
xChannelIndex = M_GetSetParam_lModuleValue(&stValue[3]); /* Fourth parameter : the channel number*/
if (MOR_fn_xMorphing (p_SuperObjPerso, (ACP_tdxIndex)(xStartIndexInObjectTable-1), (ACP_tdxIndex)(xEndIndexInObjectTable-1), xRatio, xChannelIndex) == -1)
{
//XB 10/08/99
/* Erm_M_UpdateLastError(AI, C_ucErmDefaultChannel, E_uwAIWarningScriptError , C_lErmNoDebugData,
C_ucErmOpenInfoWindow, C_ucNeverStopForDebug,
"Morphing requires two objects with the same number of points");
Erm_M_ClearLastError(C_ucErmDefaultChannel);*/
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningScriptError, C_ucErmOpenInfoWindow, "Morphing requires two objects with the same number of points")
//End XB 10/08/99
/*XB*/
#if (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)
#if !defined(U64_AIDEBUG) /* Oliv' - 23/11/1998*/
fn_vSetStopAIEngineFlag();
#endif /* !defined(U64_AIDEBUG)*/
#endif /* (defined(ACTIVE_EXEC_CHECKING) && defined(ACTIVE_EDITOR)) || defined(ACTIVE_AIDEBUG)*/
/*End XB*/
}
return (p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/

View File

@@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------*/
/* AITools.h : Some useful functions*/
/* author : Olivier Couvreur.*/
/* date : 05/05/1996*/
/*---------------------------------------------------------------------------*/
#if !defined(__AITOOLS_H__)
#define __AITOOLS_H__
/* WARNING constant are bits */
#define DISTANCE_TO_ORIGIN 0x00
#define DISTANCE_TO_CENTER_OF_BOUNDING_VOLUME 0x80
#define C_DISTANCE_X 1
#define C_DISTANCE_Y 2
#define C_DISTANCE_Z 4
#define C_DISTANCE_XY 3
#define C_DISTANCE_XZ 5
#define C_DISTANCE_YZ 6
#define C_DISTANCE_XYZ 7
#define C_DISTANCE_MASK C_DISTANCE_XYZ
#if defined(U64)
#include "AIUseCPA.h"
#include "specif/AIOption.h"
#include "AIMacros.h"
#include "AI_Erm.h"
#include "WPWayPt.h"
#include "Strintel.h"
#endif
#include "GSParam.h"
/* CGHT*/
#if 0
/* MODIF YLG*/
ACP_tdxBool fn_bIsEndReached(MTH_tdxReal xStart,MTH_tdxReal xEnd,MTH_tdxReal xSpeed);
#endif
#ifdef ACTIVE_EDITOR
void fn_vCheckModuleAccess(HIE_tdxHandleToSuperObject hPerso, ACP_tdxBool _bNextArgIsAChannel, void *_p_vChannelOrModuleHandle);
#endif
char *fn_szGetStringFromTextOrStringParam(tdstGetSetParam *p_stValue);
MTH_tdxReal fn_xComputeDirectionAngle(struct MTH3D_tdstVector_ *p_stVector);
MTH_tdxReal fn_xComputeBestEcartDirectionAngle(MTH_tdxReal xAngleFollowed,MTH_tdxReal xAngleToFollow);
MTH_tdxReal fn_xDistanceBetweenPersoAndWP(HIE_tdxHandleToSuperObject p_SuperObjPerso, WP_tdhWayPoint hWP);
MTH_tdxReal fn_xDistanceBetweenPerso(HIE_tdxHandleToSuperObject p_SuperObjPerso1, HIE_tdxHandleToSuperObject p_SuperObjPerso2);
MTH_tdxReal fn_xExtendedDistanceBetweenPerso(HIE_tdxHandleToSuperObject p_SuperObjPerso1, HIE_tdxHandleToSuperObject p_SuperObjPerso2, unsigned char ucFlags);
MTH_tdxReal fn_xExtendedDistanceBetweenVertexAndPerso(MTH3D_tdstVector *p_stVertex1,HIE_tdxHandleToSuperObject p_SuperObjPerso2 , unsigned char ucFlags);
MTH_tdxReal fn_xRealModuloAround(MTH_tdxReal xFrom,MTH_tdxReal xModulus,MTH_tdxReal xValue);
void fn_vVectorModuloAround(MTH_tdxReal xFrom,MTH_tdxReal xModulus,struct MTH3D_tdstVector_ *p_stRotationVector);
/*void fn_vMakeAngularSpeedVectorPositive(struct MTH3D_tdstVector_ *p_stRotationVector,struct MTH3D_tdstVector_ *p_stAngleVector,struct MTH3D_tdstVector_ *p_stAimAngleVector);*/
struct stMACDPID *fn_p_stGetMACDPIDPointer(HIE_tdxHandleToSuperObject p_SuperObjPerso);
struct DNM_stReport *fn_pstGetDNMReport(HIE_tdxHandleToSuperObject p_SuperObjPerso);
unsigned char fn_ucIsThereFloatIfYesConvertItToInteger(struct tdstGetSetParam_ *p_stParam);
unsigned char fn_ucAreThereFloatIfYesConvertThem(struct tdstGetSetParam_ *p_stParam1,struct tdstGetSetParam_ *p_stParam2);
void fn_vGetCenterOfBoundingVolume(HIE_tdxHandleToSuperObject hPerso,struct MTH3D_tdstVector_ *p_stVertex);
void fn_vSetDontCheckNULLFlag(signed char _cValue);
unsigned char fn_ucGetDontCheckNULLFlag(void);
#if defined(__DEBUG_AI__)
char *fn_szGetPersoName(HIE_tdxHandleToSuperObject hPerso);
#endif
ACP_tdxBool fn_bSetPositionWithCollideTest(HIE_tdxHandleToSuperObject p_SuperObjPerso, struct MTH3D_tdstVector_ *p_stVertex);
/*ANNECY BBB { parti dans gam\actions\dynam.h*/
/*ACP_tdxBool fn_bSetPositionWithoutCollideTest(HIE_tdxHandleToSuperObject p_SuperObjPerso, struct MTH3D_tdstVector_ *p_stVertex);*/
/*ANNECY BBB } parti dans gam\actions\dynam.h*/
#if 0
/* YLG modif*/
void fn_vBoolAddRequest(HIE_tdxHandleToSuperObject p_SuperObjPerso,enum LRM_eKindOfRequest_ eRequest);
#endif
unsigned char fn_bGethDynamAndMACDPIDPointers(HIE_tdxHandleToSuperObject p_SuperObjPerso, MS_tdxHandleToDynam *p_h_Dynam, tdstMACDPID **p_p_stMACDPID);
unsigned char fn_ucInternalTurn(HIE_tdxHandleToSuperObject p_SuperObjPerso,MTH_tdxReal xAngle);
void fn_vConvertParamToColor(struct tdstGetSetParam_ *p_stParam,struct GEO_tdstColor_ *p_stColor);
void fn_vConvertColorToParam(struct GEO_tdstColor_ *p_stColor,struct tdstGetSetParam_ *p_stParam);
#endif /* __AITOOLS_H__*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,287 @@
#pragma warning(disable:4032) /* formal parameter 1 has different type when promoted */
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include "ConvCst.h"
#include "EnumKey.h"
#include "ConvKey.h"
#include "EnumCond.h"
#include "ConvCond.h"
#include "EnumFunc.h"
#include "ConvFunc.h"
#include "EnumOper.h"
#include "ConvOper.h"
#include "EnumProc.h"
#include "ConvProc.h"
#include "EnumAct.h"
#include "ConvAct.h"
#include "EnumFild.h"
#include "ConvFild.h"
#include "EnumVar.h"
#include "ConvVar.h"
#include "VarType.h"
#include "EnumType.h"
/* don't delete this function please !
void display()
{
#define M_DEFINE_KEYWORD(a,b,c,d,e,f) printf("%s (%s,%s)\n" "\t\"%s\"\n" "\t\"%s\"\n",#a,e,f,b,c);
#include "DefKey.h"
#undef M_DEFINE_KEYWORD
getch();
#define M_DEFINE_CONDITION(a,b,c,d,e,f) printf("%s (%s)\n" "\t\"%s\"\n" "\t\"%s\"\n",#a,e,b,c);
#include "DefCond.h"
#undef M_DEFINE_CONDITION
getch();
#define M_DEFINE_FUNCTION(a,b,c,d,e,f,g) printf("%s (%s,%s)\n" "\t\"%s\"\n" "\t\"%s\"\n",#a,e,f,b,c);
#include "DefFunc.h"
#undef M_DEFINE_FUNCTION
getch();
#define M_DEFINE_OPERATOR(a,b,c,d,e,f) printf("%s (%s,%s)\n" "\t\"%s\"\n" "\t\"%s\"\n",#a,e,f,b,c);
#include "DefOper.h"
#undef M_DEFINE_OPERATOR
getch();
#define M_DEFINE_PROCEDURE(a,b,c,d,e,f) printf("%s (%s)\n" "\t\"%s\"\n" "\t\"%s\"\n",#a,e,b,c);
#include "DefProc.h"
#undef M_DEFINE_PROCEDURE
getch();
#define M_DEFINE_METAACTION(a,b,c,d,e,f) printf("%s (%s)\n" "\t\"%s\"\n" "\t\"%s\"\n",#a,f,b,c);
#include "DefAct.h"
#undef M_DEFINE_METAACTION
getch();
#define M_DEFINE_FIELD(a,b,c,d,e,f) printf("%s (%s)\n" "\t\"%s\"\n" "\t\"%s\"\n",#a,#d,b,c);
#include "DefFild.h"
#undef M_DEFINE_FIELD
getch();
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) printf("%s (%s)\n" "\t\"%s\"\n" "\t\"%s\"\n" "\t\"%s\"\n" "\t\"%s\"\n",#a,#d,b,c,#g,#h);
#include "DefVar.h"
#undef M_DEFINE_DSGVAR_TYPE
getch();
#define M_DEFINE_TYPE_INTERPRET(a,b,c,d) printf("%s\n" "\t%s\n" "\t%s\n" "\t%s\n",#a,#b,#c,#d);
#include "DefType.h"
#undef M_DEFINE_TYPE_INTERPRET
getch();
#define M_DEFINE_NODE(a,b,c) printf("\"%s\"\n" "\t%s\n" "\t%s\n",a,#b,#c);
#include "DefNode.h"
#undef M_DEFINE_NODE
getch();
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) printf("\"%s\"\n" "\"%s\"\n" "%s\n\n",a,b,#c);
#include "DefSAI.h"
#undef M_DEFINE_DSGVAR_SAVE_TYPE
getch();
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) printf("\"%s\"\n\"%s\"\n%s\n\n",a,b,#c);
#include "DefOTI.h"
#undef M_DEFINE_DSGVAR_INIT_TYPE
getch();
}
*/
/* To generate the multilanguage file very soon used by XB */
#define AI_MULTI_LANGUAGE_SCRIPT "AILANGUE.TXT"
#define AI_ALL_METAACTIONS "CreateAllMetaActions"
#define AI_ONE_METAACTION "CreateOneMetaAction"
#define AI_ALL_PROCEDURES "CreateAllProcedures"
#define AI_ONE_PROCEDURE "CreateOneProcedure"
#define AI_ALL_FUNCTIONS "CreateAllFunctions"
#define AI_ONE_FUNCTION "CreateOneFunction"
#define AI_ALL_CONDITIONS "CreateAllConditions"
#define AI_ONE_CONDITION "CreateOneCondition"
#define AI_ALL_KEYWORDS "CreateAllKeyWords"
#define AI_ONE_KEYWORD "CreateOneKeyWord"
#define AI_ALL_FIELDS "CreateAllFields"
#define AI_ONE_FIELD "CreateOneField"
#define AI_ALL_DSGVAR_TYPES "CreateAllDsgVarTypes"
#define AI_ONE_DSGVAR_TYPE "CreateOneDsgVarType"
#define AI_ALL_DSGVAR_INIT_TYPES "CreateAllDsgVarInitTypes"
#define AI_ONE_DSGVAR_INIT_TYPE "CreateOneDsgVarInitType"
#define AI_ALL_DSGVAR_SAVE_TYPES "CreateAllDsgVarSaveTypes"
#define AI_ONE_DSGVAR_SAVE_TYPE "CreateOneDsgVarSaveType"
#define AI_FRENCH "French"
#define AI_ENGLISH "English"
/* C'est pour virer Proc,Cond,Action etc...*/
char *fn_szConvertString(char *str)
{
char *ptr;
if ((ptr=strchr(str,'_'))!=NULL)
{
ptr++;
}
else
{
ptr=str;
}
return(ptr);
}
/* C'est pour Xavier qui veut que les noms des conditions <> <= >= etc soit les m<>mes en anglais et en francais !!!*/
char *fn_szConvertConditionString(char *str1,char *str2)
{
if (!isalpha(str2[0]))
{
return(fn_szConvertString(str2));
}
return(fn_szConvertString(str1));
}
/* C'est pour Xavier qui veut qu'il y ait bijection entre les mots cl<63>s et les types des variables designers*/
/* C'est pour Xavier qui veut que les noms des types des variables commencent par une lettre !!!*/
char TempChar[200];
char *fn_szConvertDsgVarString(char *str1,char *str2)
{
if (!strnicmp(str2,"Type",4))
{
sprintf(&TempChar[0],"%sType",str1);
return(fn_szConvertString(&TempChar[0]));
}
else if ((isdigit(str1[0])) || (str1[0]=='_') )
{
sprintf(&TempChar[0],"Integer%s",str1);
return(&TempChar[0]);
}
return(str1);
}
void main()
{
FILE *fp;
if ((fp=fopen(AI_MULTI_LANGUAGE_SCRIPT,"wt"))!=NULL)
{
#define M_BAR "------------------------------------------------------------------"
#define M_WRITE_ALL_COMMAND_START(title,nb) fprintf(fp,";%s\n;%s\n;%s\n{%s:(%d)\n",M_BAR,title,M_BAR,title,nb);
#define M_WRITE_ALL_COMMAND_END() fprintf(fp,"}\n\n");
#define M_WRITE_ONE_COMMAND(title,key,fr,gb) \
fprintf(fp,"\t{%s:%s\n",title,key); \
fprintf(fp,"\t\t%s(%s)\n",AI_FRENCH,fr); \
fprintf(fp,"\t\t%s(%s)\n",AI_ENGLISH,gb); \
fprintf(fp,"\t}\n\n");
/* MetaActions*/
#define M_WRITE_ALL_METAACTIONS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_METAACTIONS,nb)
#define M_WRITE_ONE_METAACTION(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_METAACTION,key,fr,gb)
M_WRITE_ALL_METAACTIONS(fn_eGetNbMetaAction())
#define M_DEFINE_METAACTION(a,b,c,d,e,f) M_WRITE_ONE_METAACTION(c,b,fn_szConvertString(c))
#include "DefAct.h"
#undef M_DEFINE_METAACTION
M_WRITE_ALL_COMMAND_END()
/* Procedures*/
#define M_WRITE_ALL_PROCEDURES(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_PROCEDURES,nb)
#define M_WRITE_ONE_PROCEDURE(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_PROCEDURE,key,fr,gb)
M_WRITE_ALL_PROCEDURES(fn_eGetNbProcedure())
#define M_DEFINE_PROCEDURE(a,b,c,d,e,f) M_WRITE_ONE_PROCEDURE(c,b,fn_szConvertString(c))
#include "DefProc.h"
#undef M_DEFINE_PROCEDURE
M_WRITE_ALL_COMMAND_END()
/* Functions*/
#define M_WRITE_ALL_FUNCTIONS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_FUNCTIONS,nb)
#define M_WRITE_ONE_FUNCTION(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_FUNCTION,key,fr,gb)
M_WRITE_ALL_FUNCTIONS(fn_eGetNbFunc())
#define M_DEFINE_FUNCTION(a,b,c,d,e,f,g) M_WRITE_ONE_FUNCTION(c,b,fn_szConvertString(c))
#include "DefFunc.h"
#undef M_DEFINE_FUNCTION
M_WRITE_ALL_COMMAND_END()
/* Conditions*/
#define M_WRITE_ALL_CONDITIONS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_CONDITIONS,nb)
#define M_WRITE_ONE_CONDITION(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_CONDITION,key,fr,gb)
M_WRITE_ALL_CONDITIONS(fn_eGetNbCond())
#define M_DEFINE_CONDITION(a,b,c,d,e,f) M_WRITE_ONE_CONDITION(c,b,fn_szConvertConditionString(c,b))
#include "DefCond.h"
#undef M_DEFINE_CONDITION
M_WRITE_ALL_COMMAND_END()
/* KeyWords*/
#define M_WRITE_ALL_KEYWORDS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_KEYWORDS,nb)
#define M_WRITE_ONE_KEYWORD(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_KEYWORD,key,fr,gb)
M_WRITE_ALL_KEYWORDS(fn_eGetNbKeyWord())
#define M_DEFINE_KEYWORD(a,b,c,d,e,f) M_WRITE_ONE_KEYWORD(c,b,fn_szConvertString(c))
#include "DefKey.h"
#undef M_DEFINE_KEYWORD
M_WRITE_ALL_COMMAND_END()
/* Fields*/
#define M_WRITE_ALL_FIELDS(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_FIELDS,nb)
#define M_WRITE_ONE_FIELD(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_FIELD,key,fr,gb)
M_WRITE_ALL_FIELDS(fn_eGetNbField())
#define M_DEFINE_FIELD(a,b,c,d,e,f) M_WRITE_ONE_FIELD(c,b,fn_szConvertString(c))
#include "DefFild.h"
#undef M_DEFINE_FIELD
M_WRITE_ALL_COMMAND_END()
/* Designer variables*/
#define M_WRITE_ALL_DSGVAR_TYPES(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_DSGVAR_TYPES,nb)
#define M_WRITE_ONE_DSGVAR_TYPE(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_DSGVAR_TYPE,key,fr,gb)
M_WRITE_ALL_DSGVAR_TYPES(fn_eGetNbDsgVarType())
#define M_DEFINE_DSGVAR_TYPE(a,b,c,d,e,f,g,h,i,j) M_WRITE_ONE_DSGVAR_TYPE(c,b,fn_szConvertDsgVarString(c,b))
#include "DefVar.h"
#undef M_DEFINE_DSGVAR_TYPE
M_WRITE_ALL_COMMAND_END()
/* SAI Type*/
#define M_WRITE_ALL_DSGVAR_SAVE_TYPES(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_DSGVAR_SAVE_TYPES,nb)
#define M_WRITE_ONE_DSGVAR_SAVE_TYPE(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_DSGVAR_SAVE_TYPE,key,fr,gb)
M_WRITE_ALL_DSGVAR_SAVE_TYPES(fn_ucGetSaveTypeNumber())
#define M_DEFINE_DSGVAR_SAVE_TYPE(a,b,c) M_WRITE_ONE_DSGVAR_SAVE_TYPE(b,a,b)
#include "DefSAI.h"
#undef M_DEFINE_DSGVAR_SAVE_TYPE
M_WRITE_ALL_COMMAND_END()
/* OTI Type*/
#define M_WRITE_ALL_DSGVAR_INIT_TYPES(nb) M_WRITE_ALL_COMMAND_START(AI_ALL_DSGVAR_INIT_TYPES,nb)
#define M_WRITE_ONE_DSGVAR_INIT_TYPE(key,fr,gb) M_WRITE_ONE_COMMAND(AI_ONE_DSGVAR_INIT_TYPE,key,fr,gb)
M_WRITE_ALL_DSGVAR_INIT_TYPES(fn_ucGetInitTypeNumber())
#define M_DEFINE_DSGVAR_INIT_TYPE(a,b,c) M_WRITE_ONE_DSGVAR_INIT_TYPE(b,a,b)
#include "DefOTI.h"
#undef M_DEFINE_DSGVAR_INIT_TYPE
M_WRITE_ALL_COMMAND_END()
fclose(fp);
}
}

View File

@@ -0,0 +1,129 @@
# Microsoft Developer Studio Project File - Name="AiInfo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=AiInfo - AiInfo Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "AiInfo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "AiInfo.mak" CFG="AiInfo - AiInfo Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "AiInfo - AiInfo Win32 Release" (based on\
"Win32 (x86) Console Application")
!MESSAGE "AiInfo - AiInfo Win32 Debug" (based on\
"Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "AiInfo - AiInfo Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W4 /WX /GX /O1 /I "x:\cpa\TempGrp\Ai\AIBase" /I "x:\cpa\TempGrp\Ai\AIGame" /I "x:\cpa\TempGrp\Ai\AIDebug" /I "x:\cpa\public" /I "x:\cpa\public\AI" /I "x:\cpa\public\AI\AIBase" /I "x:\cpa\public\AI\AIGame" /I "x:\cpa\public\AI\AIDebug" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "ACTIVE_EDITOR" /D "_AI_EXTERNAL_" /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "AiInfo - AiInfo Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W4 /WX /Gm /GX /Zi /Od /I "x:\cpa\TempGrp\Ai\AIBase" /I "x:\cpa\TempGrp\Ai\AIGame" /I "x:\cpa\TempGrp\Ai\AIDebug" /I "x:\cpa\public" /I "x:\cpa\public\AI" /I "x:\cpa\public\AI\AIBase" /I "x:\cpa\public\AI\AIGame" /I "x:\cpa\public\AI\AIDebug" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "ACTIVE_EDITOR" /D "_AI_EXTERNAL_" /YX /FD /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "AiInfo - AiInfo Win32 Release"
# Name "AiInfo - AiInfo Win32 Debug"
# Begin Group "FromAi"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\AIGame\ConvAct.c
# End Source File
# Begin Source File
SOURCE=..\AIGame\ConvCond.c
# End Source File
# Begin Source File
SOURCE=..\AIGame\ConvFild.c
# End Source File
# Begin Source File
SOURCE=..\AIGame\ConvFunc.c
# End Source File
# Begin Source File
SOURCE=..\AIGame\ConvKey.c
# End Source File
# Begin Source File
SOURCE=..\AIGame\ConvOper.c
# End Source File
# Begin Source File
SOURCE=..\AIGame\ConvProc.c
# End Source File
# Begin Source File
SOURCE=..\AIGame\ConvVar.c
# End Source File
# End Group
# Begin Source File
SOURCE=X:\Cpa\TempGrp\AI\AiInfo\AiInfo.c
# End Source File
# Begin Source File
SOURCE=.\AILANGUE.TXT
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,5 @@
SCC = This is a Source Code Control file
[AiInfo.dsp]
SCC_Aux_Path = "\\srvprojets-ma\Rayman4_DS\Versions\Rayman4DS\Tools"
SCC_Project_Name = "$/CPA/tempgrp/AI/AiInfo", FQKAAAAA

View File

@@ -0,0 +1,976 @@
# Microsoft Developer Studio Project File - Name="ai" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=ai - Win32 Debug with Editors
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ai.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ai.mak" CFG="ai - Win32 Debug with Editors"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ai - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "ai - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "ai - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE "ai - Win32 Debug with Editors" (based on\
"Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/AI", EVBAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "ai - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /G5 /W4 /GX /O2 /I "x:\cpa\exe\main" /I "x:\cpa\public" /I "x:\cpa\public\AI" /I "x:\cpa\public\AI\AIBase" /I "x:\cpa\public\AI\AIGame" /I "x:\cpa\public\AI\AIDebug" /I "x:\cpa\TempGrp\Ai\AIBase" /I "x:\cpa\TempGrp\Ai\AIGame" /I "x:\cpa\TempGrp\Ai\AIDebug" /D "NDEBUG" /D "USE_PROFILER" /D "USE_IPT_DX5" /D "VISUAL" /D "WIN32" /D "_AI_LIB_" /YX /FD /c
# SUBTRACT CPP /WX /Fr
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\cpa\lib\Ai_P5_vr.lib"
!ELSEIF "$(CFG)" == "ai - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "tmp\debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W4 /GX /Z7 /Od /I "x:\cpa\exe\main" /I "x:\cpa\public" /I "x:\cpa\public\AI" /I "x:\cpa\public\AI\AIBase" /I "x:\cpa\public\AI\AIGame" /I "x:\cpa\public\AI\AIDebug" /I "x:\cpa\TempGrp\Ai\AIBase" /I "x:\cpa\TempGrp\Ai\AIGame" /I "x:\cpa\TempGrp\Ai\AIDebug" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "VISUAL" /D "WIN32" /D "_AI_LIB_" /YX /FD /c /Tp
# SUBTRACT CPP /WX /Fr
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\cpa\lib\Ai_P5_vd.lib"
!ELSEIF "$(CFG)" == "ai - Win32 Retail"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ai___Win"
# PROP BASE Intermediate_Dir "ai___Win"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /GX /Ot /Og /Oy /I "x:\cpa\public" /I "x:\cpa\public\AI" /I "x:\cpa\public\AI\AIBase" /I "x:\cpa\public\AI\AIGame" /I "x:\cpa\public\AI\AIDebug" /I "x:\cpa\TempGrp\Ai\AIBase" /I "x:\cpa\TempGrp\Ai\AIGame" /I "x:\cpa\TempGrp\Ai\AIDebug" /D "VISUAL" /D "WIN32" /D "_WINDOWS" /D "GAME_APP" /D "DNM_3DOS" /D "CPA_VISUAL" /D "WIN95" /D "VERSION_PENTIUM" /D "CPA_WANTS_EXPORT" /D "_MBCS" /D "_AI_LIB_" /FR /YX /FD /c
# SUBTRACT BASE CPP /WX /Ox
# ADD CPP /nologo /W4 /GX /O2 /I "x:\cpa\exe\main" /I "x:\cpa\public" /I "x:\cpa\public\AI" /I "x:\cpa\public\AI\AIBase" /I "x:\cpa\public\AI\AIGame" /I "x:\cpa\public\AI\AIDebug" /I "x:\cpa\TempGrp\Ai\AIBase" /I "x:\cpa\TempGrp\Ai\AIGame" /I "x:\cpa\TempGrp\Ai\AIDebug" /D "NDEBUG" /D "RETAIL" /D "USE_IPT_DX5" /D "VISUAL" /D "WIN32" /D "_AI_LIB_" /YX /FD /c
# SUBTRACT CPP /WX /Fr
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\cpa\lib\Ai_P5_vr.lib"
# ADD LIB32 /nologo /out:"x:\cpa\lib\Ai_P5_vf.lib"
!ELSEIF "$(CFG)" == "ai - Win32 Debug with Editors"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "ai___Win"
# PROP BASE Intermediate_Dir "ai___Win"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "tmp/debuged"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W4 /GX /Z7 /Od /I "x:\cpa\public" /I "x:\cpa\public\AI" /I "x:\cpa\public\AI\AIBase" /I "x:\cpa\public\AI\AIGame" /I "x:\cpa\public\AI\AIDebug" /I "x:\cpa\TempGrp\Ai\AIBase" /I "x:\cpa\TempGrp\Ai\AIGame" /I "x:\cpa\TempGrp\Ai\AIDebug" /D "CPA_DEBUG" /D "_AFXDLL" /D "ACTIVE_EDITOR" /D "MTH_CHECK" /D "WIN32" /D "_WINDOWS" /D "GAME_APP" /D "DNM_3DOS" /D "CPA_VISUAL" /D "WIN95" /D "VERSION_PENTIUM" /D "CPA_WANTS_EXPORT" /D "_MBCS" /D "_AI_LIB_" /D "USE_PROFILER" /FR /YX /FD /c /Tp
# ADD CPP /nologo /W4 /GX /Z7 /Od /I "x:\cpa\exe\main" /I "x:\cpa\public" /I "x:\cpa\public\AI" /I "x:\cpa\public\AI\AIBase" /I "x:\cpa\public\AI\AIGame" /I "x:\cpa\public\AI\AIDebug" /I "x:\cpa\TempGrp\Ai\AIBase" /I "x:\cpa\TempGrp\Ai\AIGame" /I "x:\cpa\TempGrp\Ai\AIDebug" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "ACTIVE_EDITOR" /D "CPA_WANTS_EXPORT" /D "VISUAL" /D "WIN32" /D "_AI_LIB_" /YX /FD /c /Tp
# SUBTRACT CPP /Fr
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\cpa\lib\Ai_P5Evd.lib"
# ADD LIB32 /nologo /out:"x:\cpa\lib\Ai_P5Evd.lib"
!ENDIF
# Begin Target
# Name "ai - Win32 Release"
# Name "ai - Win32 Debug"
# Name "ai - Win32 Retail"
# Name "ai - Win32 Debug with Editors"
# Begin Group "Text"
# PROP Default_Filter "txt"
# Begin Source File
SOURCE=..\..\Exe\Main\GameData\World\Levels\_Common\Families\Defines.ai
# End Source File
# Begin Source File
SOURCE=..\..\Journal.txt
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\link.txt
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\new.txt
# End Source File
# End Group
# Begin Group "Command"
# PROP Default_Filter ""
# Begin Group "Keyword"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\ConvKey.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvKey.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefKey.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\EnumKey.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\Keyword.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\Keyword.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ProtKey.h
# End Source File
# End Group
# Begin Group "Conditions"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\Cond.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\Cond.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\Cond1.cxx
!IF "$(CFG)" == "ai - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug with Editors"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\AIGame\ConvCond.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvCond.h
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\DefConCa.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefCond.h
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\DefCond1.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\EnumCond.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ProtCond.h
# End Source File
# End Group
# Begin Group "Functions"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\ConvFunc.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvFunc.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefFunc.h
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\DefFunc1.h
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\DefFunCa.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\EnumFunc.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\FuncRay2.cxx
!IF "$(CFG)" == "ai - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug with Editors"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\FuncRay2.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\Functio1.cxx
!IF "$(CFG)" == "ai - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug with Editors"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\AIGame\Function.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\Function.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ProtFunc.h
# End Source File
# End Group
# Begin Group "MetaActions"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\ActMain.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\ConvAct.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvAct.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefAct.h
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\DefActCa.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\EnumAct.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ProtAct.h
# End Source File
# End Group
# Begin Group "Procedures"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\ConvProc.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvProc.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefProc.h
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\DefProc1.h
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\DefProCa.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\EnumProc.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\Procedu1.cxx
!IF "$(CFG)" == "ai - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug with Editors"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\AIGame\Procedur.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\Procedur.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\Procray2.cxx
!IF "$(CFG)" == "ai - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug with Editors"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIGame\ProcRay2.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ProtProc.h
# End Source File
# End Group
# Begin Group "Operators"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\ConvOper.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvOper.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefOper.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\EnumOper.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\Operator.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\Operator.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ProtOper.h
# End Source File
# End Group
# Begin Group "Fields"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\ConvFild.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvFild.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefFild.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\EnumFild.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\Fields.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\Fields.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\FildType.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ProtFild.h
# End Source File
# End Group
# Begin Group "DsgVar"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\ConvVar.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvVar.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefOTI.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefSAI.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\DefVar.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\EnumVar.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ProtVar.h
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\ConvCst.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\Convert.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\Convert.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\MGT_Proc.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\procMorf.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIGame\TypePtr.h
# End Source File
# End Group
# Begin Group "Debugger"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIDebug\AID_Erm.h
# End Source File
# Begin Source File
SOURCE=.\AIDebug\AID_Head.h
# End Source File
# Begin Source File
SOURCE=.\AIDebug\AID_Main.c
# End Source File
# Begin Source File
SOURCE=.\AIDebug\AID_Main.h
# End Source File
# Begin Source File
SOURCE=.\AIDebug\AID_Mmg.h
# End Source File
# Begin Source File
SOURCE=.\AIDebug\AID_Trac.c
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIDebug\specif\AID_Trac.h
# End Source File
# End Group
# Begin Group "Way Points"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\WP_Func.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\WP_Handl.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\WParc.c
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIBase\WParc.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\WPEngDsp.c
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIBase\WPEngDsp.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\WPgraphe.c
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIBase\WPgraphe.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\WPWayPt.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\WPWayPt.h
# End Source File
# End Group
# Begin Group "Engine"
# PROP Default_Filter ""
# Begin Group "CFast"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIBase\CFast.c
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIBase\CFast.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\CFastf.cxx
!IF "$(CFG)" == "ai - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug with Editors"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\ActConst.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\Action.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\Action.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\ActParam.c
# End Source File
# Begin Source File
SOURCE=.\AIBase\ActParam.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\ActTable.c
# End Source File
# Begin Source File
SOURCE=.\AIBase\specif\ActTable.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AI_Edit.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\AI_Erm.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\AI_Funct.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\AI_Funct.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\AI_Handl.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\AI_Macro.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\AI_Mmg.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\AI_Proto.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\AI_Proto.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AI_Pub.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\AI_Struc.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\AIMacros.h
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIBase\specif\AIOption.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\AITools.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\specif\AITools.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\AIUseCPA.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\Array.c
!IF "$(CFG)" == "ai - Win32 Release"
!ELSEIF "$(CFG)" == "ai - Win32 Debug"
!ELSEIF "$(CFG)" == "ai - Win32 Retail"
# PROP BASE Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ai - Win32 Debug with Editors"
# PROP BASE Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\Array.h
# End Source File
# Begin Source File
SOURCE=.\AIDebug\BreakPts.c
# End Source File
# Begin Source File
SOURCE=..\..\public\AI\AIDebug\BreakPts.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\DataRay2.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\DataRay2.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\DefNode.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\DefType.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\DsgMem.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\DsgMem.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\DsgMemC.c
# End Source File
# Begin Source File
SOURCE=.\AIBase\DsgMemC.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\EnumType.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\Getset.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\Getset.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\GSParam.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\Intell.c
# End Source File
# Begin Source File
SOURCE=.\AIBase\Intell.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\List.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\List.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\Protections.cxx
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\AIBase\specif\ReadRule.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\ReadRule.h
# End Source File
# Begin Source File
SOURCE=.\AIBase\StrIntel.c
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\StrIntel.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\AI\AIBase\VarType.h
# End Source File
# End Group
# Begin Group "Camera"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AIGame\CAM_Act.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Base.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Base.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Cond.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Fnct.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Proc.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Tool.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Tool.h
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Vis.c
# End Source File
# Begin Source File
SOURCE=.\AIGame\CAM_Vis.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\ai.mak
# End Source File
# End Target
# End Project

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[ai.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project