reman3/Rayman_X/cpa/tempgrp/AI/AIGame/Procedur.c

4124 lines
130 KiB
C

/*---------------------------------------------------------------------------*/
/* Procedure.c : Definition of general Procedure.*/
/* auteur : Olivier Didelot.*/
/* date : 10/04/1997*/
/* modify : Olivier Couvreur*/
/* date : 21/05/1997 HitPoints support*/
/* modify : Olivier Couvreur*/
/* date : 06/06/1997 Function List transfered here*/
/*---------------------------------------------------------------------------*/
#define D_CineInfo_StructureDefine
extern
#ifdef _DEBUG
"C"
#endif
void fn_vAskToDisplayVignette(char *szName);
#define HieFriend /*to have all access macros for superobjects*/
/* For access to state structure (for debug) */
#ifdef ACTIVE_EDITOR
#define D_State_Define
#endif
#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 "specif/ActTable.h"
#include "Operator.h"
#include "EnumOper.h"
#include "Convert.h"
/*XB*/
#include <ctype.h> /*for toupper*/
/*End XB*/
#if defined( ACTIVE_AIDEBUG )
#include "AID_Erm.h"
#include "specif/AID_Trac.h"
#endif /*ACTIVE_AIDEBUG*/
#include "WPWayPt.h" /* for draw WP.*/
#define _WP_D_DEFINE_WAYPOINTS_
#define _WP_D_DEFINE_WAYS_
#include "WP_Handl.h"
#include "WP_Func.h"
#undef _WP_D_DEFINES_WAYS_
#undef _WP_D_DEFINE_WAYPOINTS_
/* noch eine grosse bidouille for ChangeComportProcedure */
#include "AI_Struc.h"
#include "TypePtr.h"
void fn_vSetProcedureActionReturn(tducActionReturn ucActionReturn);
#include "GAM.h" /*for option access procedures*/
#include "safe.h" /*BART*/
/* ANNECY AV DEMO {*/
#ifndef U64
#include "GAM/Specif/Demos.h"
#include "PTC.h"
#endif
/* END ANNECY AV }*/
/*FB261198 (sinon, ça mâche pôo....)*/
#include "ago.h"
/* the two global variables are set by an AI function (PAD_JoyAnalogiqueFixeAxes) at the start of the game*/
IPT_tdxHandleToEntryElement g_xJoystickAxeX=0;
IPT_tdxHandleToEntryElement g_xJoystickAxeY=0;
/* YLT, 6 global variables here for joystick calibration, (only used in AI functions, that's why they are here)
the initials values are set to -50 or 50. No problem if no calibration is done before starting the game,
an auto calibration is performed at real time during the game (except for center position)
These variables are used by AI and saved in options\current.cfg */
#define C_Pad_DefaultXMinCalibration -50
#define C_Pad_DefaultXMaxCalibration 50
#define C_Pad_DefaultYMinCalibration -50
#define C_Pad_DefaultYMaxCalibration 50
#ifdef __cplusplus
extern "C" {
#endif
signed char g_cJoystickXmin = C_Pad_DefaultXMinCalibration;
signed char g_cJoystickXmax = C_Pad_DefaultXMaxCalibration;
signed char g_cJoystickYmin = C_Pad_DefaultYMinCalibration;
signed char g_cJoystickYmax = C_Pad_DefaultYMaxCalibration;
#ifndef U64
signed char g_cJoystickXcenter = 0;
signed char g_cJoystickYcenter = 0;
#endif /* !U64 */
#ifdef __cplusplus
}
#endif
struct stPadOutputDsgvars_
{
MTH3D_tdstVector *p_stPadVector;
short *p_wAxisValueX;
short *p_wAxisValueY;
MTH_tdxReal *p_xAnalogForce;
MTH_tdxReal *p_xTrueAnalogForce;
MTH_tdxReal *p_xRotationAngle;
short *p_wDirectionSector;
} g_stPadOutputDsgvars = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
/* YLT, 5 global variables here for specific PC keyboard support in ModeAnalogiqueMario IA function */
#ifndef U64
IPT_tdxHandleToEntryElement g_xKeyUp=0;
IPT_tdxHandleToEntryElement g_xKeyDown=0;
IPT_tdxHandleToEntryElement g_xKeyLeft=0;
IPT_tdxHandleToEntryElement g_xKeyRight=0;
IPT_tdxHandleToEntryElement g_xKeySpeedUp=0;
ACP_tdxBool g_bCancelKeyboardInertia = FALSE;
#endif
/*variable used and declared in functio1.cxx, but modified by a procedure in this file*/
extern unsigned long g_ulOverRideRayTraceSpoMask;
#ifdef __cplusplus
extern "C"
{
#endif
extern int iNumLoop; /* used in GAM, so we must declare it as a C variable!*/
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef U64
/*********** FPerez ***********/
extern long fn_lGetNbAvailableSlotsPc();
/**********************************/
#endif // ! 64
#ifdef __cplusplus
}
#endif
/*extern int iNumLoop;*/
/* HitPoints*/
/****************************************************************************
* Set HitPoints of a perso
*****************************************************************************
* 2 Parameters: PERSO CONSTANT
* 1: perso
* 2: value to set hitpoints
*****************************************************************************/
static tdstNodeInterpret *fn_p_stSetHitPoints(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstEngineObject *p_stObject)
{
tdstGetSetParam stParam;
unsigned char ucValue;
M_EvalNextParameter(&stParam);
SAF_M_AssertWithMsg(M_ReturnParam_lValue(&stParam) >= 0, "Un perso ne peut avoir un nombre négatif de points de vie!");
ucValue = (unsigned char) M_ReturnParam_lValue(&stParam);
fn_vSetHitPoints(p_stObject,ucValue);
return p_stTree;
}
/****************************************************************************
* Add HitPoints to a perso
*****************************************************************************
* 2 Parameters: PERSO CONSTANT
* 1: perso
* 2: value to add to hitpoints
*****************************************************************************/
static tdstNodeInterpret *fn_p_stAddHitPoints(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstEngineObject *p_stObject)
{
tdstGetSetParam stParam;
unsigned char ucValue;
M_EvalNextParameter(&stParam);
SAF_M_AssertWithMsg(M_ReturnParam_lValue(&stParam) >= 0, "Il est interdit d'ajouter une nombre de points de vie négatif!");
ucValue = (unsigned char) M_ReturnParam_lValue(&stParam);
fn_vAddHitPoints(p_stObject,ucValue);
return p_stTree;
}
/****************************************************************************
* Sub HitPoints to a perso
*****************************************************************************
* 2 Parameters: PERSO CONSTANT
* 1: perso
* 2: value to sub to hitpoints
*****************************************************************************/
static tdstNodeInterpret *fn_p_stSubHitPoints(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstEngineObject *p_stObject)
{
tdstGetSetParam stParam;
unsigned char ucValue;
M_EvalNextParameter(&stParam);
SAF_M_AssertWithMsg(M_ReturnParam_lValue(&stParam) >= 0, "Il est interdit de retirer une nombre de points de vie négatif!");
ucValue = (unsigned char) M_ReturnParam_lValue(&stParam);
(void) fn_ucSubHitPoints(p_stObject,ucValue);
return p_stTree;
}
/* HitPointsMax*/
/****************************************************************************
* Set HitPoints Max of a perso
*****************************************************************************
* 2 Parameters: PERSO CONSTANT
* 1: perso
* 2: value to set hitpoints
*****************************************************************************/
static tdstNodeInterpret *fn_p_stSetHitPointsMax(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstEngineObject *p_stObject)
{
tdstGetSetParam stParam;
unsigned char ucValue;
M_EvalNextParameter(&stParam);
SAF_M_AssertWithMsg(M_ReturnParam_lValue(&stParam) >= 0, "Un perso ne peut avoir un nombre négatif de points de vie max!");
ucValue = (unsigned char) M_ReturnParam_lValue(&stParam);
fn_vSetHitPointsMax(p_stObject,ucValue);
return p_stTree;
}
/****************************************************************************
* Add HitPoints Max to a perso
*****************************************************************************
* 2 Parameters: PERSO CONSTANT
* 1: perso
* 2: value to add to hitpoints
*****************************************************************************/
static tdstNodeInterpret *fn_p_stAddHitPointsMax(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstEngineObject *p_stObject)
{
tdstGetSetParam stParam;
unsigned char ucValue;
M_EvalNextParameter(&stParam);
SAF_M_AssertWithMsg(M_ReturnParam_lValue(&stParam) >= 0, "Il est interdit d'ajouter une nombre de points de vie max négatif!");
ucValue = (unsigned char) M_ReturnParam_lValue(&stParam);
fn_vAddHitPointsMax(p_stObject,ucValue);
return p_stTree;
}
/****************************************************************************
* Sub HitPoints Max to a perso
*****************************************************************************
* 2 Parameters: PERSO CONSTANT
* 1: perso
* 2: value to sub to hitpoints
*****************************************************************************/
static tdstNodeInterpret *fn_p_stSubHitPointsMax(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstEngineObject *p_stObject)
{
tdstGetSetParam stParam;
unsigned char ucValue;
M_EvalNextParameter(&stParam);
SAF_M_AssertWithMsg(M_ReturnParam_lValue(&stParam) >= 0, "Il est interdit de retirer une nombre de points de vie max négatif!");
ucValue = (unsigned char) M_ReturnParam_lValue(&stParam);
(void) fn_ucSubHitPointsMax(p_stObject,ucValue);
return p_stTree;
}
/*****************************************************************************
* Eval a Procedure and return the tree after evaluation.
******************************************************************************
* Parameters:
* - p_SuperObjPerso : SuperObject.
* - p_stTree : The tree.
* - p_stValue : Value return by the evaluation of Tree.
******************************************************************************/
/************************************************************************************/
/* HERE IS THE BEGINNING */
/************************************************************************************/
#if !defined(OPTIMIZED_COMMAND)
#if defined(__DEBUG_AI__)
tdstNodeInterpret *fn_p_stDefaultProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
p_SuperObjPerso=p_SuperObjPerso;
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif /* __DEBUG_AI__*/
return(p_stTree);
}
#endif /* _DEBUG_AI__*/
#endif /* OPTIMIZED_COMMAND*/
/************************************************************************************/
/* Misc ULTRA*/
tdstNodeInterpret *fn_p_stMiscUltraProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
switch(eProcedureId)
{
case eProc_SetCharacterPriority :
{
M_EvalNextParameter(&stParam);
SAF_M_AssertWithMsg(M_GetMSHandle(hNewSuperObjPerso, CollSet), "la MS CollSet est nécessaire pour cet appel" ) ;
CS_fn_vSetCharacterPriority(M_GetMSHandle(hNewSuperObjPerso, CollSet), (unsigned char) M_ReturnParam_lValue(&stParam));
}
return(p_stTree);
break; /*anti-bug GCC N64*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_EraseLastGoThroughMaterial:
M_vSetLastCollidedGoThroughMaterialOfBrain(M_GetMSHandle(hNewSuperObjPerso,Brain), GMT_C_ulInvalidHandle);
return p_stTree;
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_FactorAnimationFrameRate:
M_EvalNextParameter(&stParam);
SAF_M_AssertWithMsg(M_ReturnParam_lValue(&stParam) >= 0, "Une vitesse d'animation ne peut être négative!");
fn_v3dDataFactorFrameRate(((struct tdstEngineObject_ *)(HIE_fn_hGetSuperObjectObject(hNewSuperObjPerso)))->h_3dData,M_ReturnParam_lValue(&stParam));
return(p_stTree);
break; /*anti-bug GCC N64*/
case eProc_SetGoThroughMechanicsHandling:
{
ACP_tdxBool bFlag;
M_EvalNextParameter(&stParam);
bFlag = M_GetSetParam_lValue(&stParam);
M_vSetWarnMechanicsFlagOfBrain(M_GetMSHandle(hNewSuperObjPerso,Brain), bFlag);
}
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif /* __DEBUG_AI__*/
return(p_stTree);
}
/* Misc Not ULTRA*/
/*
tdstNodeInterpret *fn_p_stMiscProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
switch(eProcedureId)
{
case eProc_SetMainActor:
{
tdstGetSetParam stValue;
M_EvalNextParameter(&stValue);
MC_fn_vSetNewMainCharacter(MC_fn_hGetFirstMainCharNode(), M_GetSetParam_p_stSupObjValue(&stValue));
}
return p_stTree;
break;
case eProc_ActivateObject:
return(fn_p_stActivateObject(p_SuperObjPerso, p_stTree));
break;
case eProc_ActivateObjectOnPosition:
return(fn_p_stActivateObjectOnPosition(p_SuperObjPerso, p_stTree));
break;
case eProc_DesactivateObject:
return(fn_p_stDesactivateObject(p_SuperObjPerso, p_stTree));
break;
case eProc_ChangeMap :
return(fn_p_stChangeMap(p_SuperObjPerso, p_stTree));
break;
case eProc_ChangeMapAtPosition :
return(fn_p_stChangeMapAtPosition(p_SuperObjPerso, p_stTree));
break;
case eProc_SetActionReturn :
return(fn_p_stSetActionReturn(p_SuperObjPerso, p_stTree));
break;
case eProc_FactorAnimationFrameRate:
{
tdstGetSetParam stValue;
M_EvalNextParameter(&stValue);
fn_v3dDataFactorFrameRate(((struct tdstEngineObject_ *)(HIE_fn_hGetSuperObjectObject(p_SuperObjPerso)))->h_3dData,M_ReturnParam_lValue(&stValue));
}
return(p_stTree);
break;
case eProc_KillPerso:
{
tdstGetSetParam stValue;
tdstEngineObject *hKilledObject;
M_EvalNextParameter(&stValue);
// get the brain of the perso to be killed
hKilledObject=M_GetSetParam_p_stEngineObjValue(&stValue);
// Kill the object :
fn_vKillEngineObjectOrAlwaysByPointer(hKilledObject);
fn_vBoolAddRequest(p_SuperObjPerso,LRM_eRequest_NoAction);
if (hKilledObject == M_GetEngineObject(p_SuperObjPerso))
{
fn_vSetProcedureActionReturn(C_ACTION_ENGINE_STOP);
}
}
return(p_stTree);
break;
case eProc_PlayerIsDead:
fn_vSnifThePlayerIsDead();
return(p_stTree);
break;
case eProc_PlayerIsDeadWithOption:
{
tdstGetSetParam stValue;
M_EvalNextParameter(&stValue);
fn_vSnifThePlayerIsDeadWithOption((M_ReturnParam_lValue(&stValue)?1:0));
}
return(p_stTree);
break;
case eProc_PlayerIsDeadWithPlacement:
{
tdstGetSetParam stValue;
HIE_tdxHandleToSuperObject hPerso1,hPerso2;
M_EvalNextParameter(&stValue);
hPerso1 = M_GetSetParam_p_stSupObjValue(&stValue);
M_EvalNextParameter(&stValue);
hPerso2 = M_GetSetParam_p_stSupObjValue(&stValue);
fn_vSnifThePlayerIsDeadWithResurrectionAt(hPerso1,hPerso2);
}
return(p_stTree);
break;
case eProc_RandomFrame:
return p_stTree;
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif // __DEBUG_AI__
return(p_stTree);
}
*/
/*
=======================================================================================
=======================================================================================
*/
tdstNodeInterpret *fn_p_stMiscNoProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
switch(eProcedureId)
{
case eProc_IgnoreTraceFlagForNextPicking:
g_ulOverRideRayTraceSpoMask = 0;
return p_stTree;
break;
case eProc_BreakAI:
{
//tdstIntelligence *p_stIntelligence = AI_M_p_stGetIntelligence(AI_M_stGetMindOfSuperObj(p_SuperObjPerso));
tdstIntelligence *p_stIntelligence = M_GetIntellOrReflex(AI_M_stGetMindOfSuperObj(p_SuperObjPerso));
tdstComport *p_stComport = M_GetCurrentComport(p_stIntelligence);
/* reinit the various action tables so that next frame we start at the beginning of the comport*/
fn_vInitActionTable(p_stIntelligence);
if (M_GetComportSchedule(p_stComport) == NULL)
{
M_GetCurrentSchedule(p_stIntelligence) = NULL;
}
else
{
M_GetCurrentSchedule(p_stIntelligence) = M_GetTreeComportSchedule(p_stComport);
}
/* reset loop counter, in case we break while in a loop*/
iNumLoop = 0;
/*tell the AI engine to stop the execution*/
fn_vSetProcedureActionReturn(C_ACTION_ENGINE_STOP | C_ACTION_ENGINE_STOP_RULE | C_ACTION_CHANGE_COMPORT);
}
return p_stTree;
break; /*anti-bug gcc N64*/
case eProc_ResetDynamicsWithCard:
{
MS_tdxHandleToDynam h_Dynam = M_GetMSHandle(p_SuperObjPerso,Dynam);
if ( h_Dynam )
{
struct DNM_stDynamics *p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam);
/* tell the dynamics to reinit all its parameters with its current ID card*/
if (p_stDynamics)
{
/* the first frame, the dynamics does not know its id card -> get it from the current state instead*/
DNM_tdxHandleToMecIdentityCard hMecIdCard = fn_h_GetCurrentDNMIdCard(p_SuperObjPerso);
if ( hMecIdCard )
{
DNM_fn_vChangeIdCard(p_stDynamics, hMecIdCard);
}
}
}
}
return(p_stTree);
break; /*anti-bug gcc N64*/
case eProc_PlayerIsDead:
fn_vSnifThePlayerIsDead();
return(p_stTree);
break; /*anti-bug gcc N64*/
default:
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif /* __DEBUG_AI__*/
break;
}
return(p_stTree);
}
/*
=======================================================================================
=======================================================================================
*/
tdstNodeInterpret *fn_p_stKillPersoAndClearVariableProcedure ( HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree )
{
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
tdstEngineObject * hKilledObject ;
tdstGetSetParam stParam ;
AI_tdstMind * p_stMind ; /* Mind of perso (used to return paramaters to dsgVars)*/
unsigned char ucVarId ;
switch ( eProcedureId )
{
case eProc_KillPersoAndClearVariable :
M_vEvalNextVarId ( p_stMind , ucVarId ) ;
SAF_M_AssertWithMsg ( ( fn_GetDsgVarType ( M_GetDsgVarType ( p_stMind , ucVarId ) ) == E_vt_Perso ) , "La variable designer n'est pas un perso" ) ;
if ( fn_ucGetDsgVar ( ucVarId , ( unsigned char ) 0 , p_stMind , & stParam ) == C_VALID_GET )
{
/* get the perso to be killed */
hKilledObject = M_GetSetParam_p_stEngineObjValue ( & stParam ) ;
/* check that the perso still exists */
SAF_M_AssertWithMsg ( hKilledObject && hKilledObject -> h_StandardGame , "Tentative de destruction d'un acteur non valide (probablement un always déjà détruit)!" ) ;
/* Kill the object :*/
fn_vKillEngineObjectOrAlwaysByPointer ( hKilledObject ) ;
/* if I destroyed myself, tell the IA engine to stop immediately */
if ( hKilledObject == M_GetEngineObject ( p_SuperObjPerso ) )
{
fn_vSetProcedureActionReturn(C_ACTION_ENGINE_STOP | C_ACTION_ENGINE_STOP_RULE);
}
/* do not forget to clear the dsgvar that referenced the destroyed object */
M_GetSetParam_p_stEngineObjValue ( & stParam ) = NULL ;
ucVarId = fn_ucSetDsgVar(ucVarId, 0, p_stMind, &stParam ) ;
SAF_M_AssertWithMsg ( ucVarId != C_INVALID_SET , "erreur interne ? l'annulation de la référence s'est mal passée");
}
return p_stTree ;
break ;
case eProc_KillPerso:
{
M_EvalNextParameter ( & stParam ) ;
/* get the brain of the perso to be killed*/
hKilledObject = M_GetSetParam_p_stEngineObjValue ( & stParam ) ;
/* check that the perso still exists*/
SAF_M_AssertWithMsg ( hKilledObject && hKilledObject->h_StandardGame, "Tentative de destruction d'un acteur non valide (probablement un always déjà détruit)!" ) ;
/* Kill the object :*/
fn_vKillEngineObjectOrAlwaysByPointer(hKilledObject);
/*MODIF YLG fn_vBoolAddRequest(p_SuperObjPerso,LRM_eRequest_NoAction);*/
/* if I destroyed myself, tell the IA engine to stop immediately*/
if ( hKilledObject == M_GetEngineObject ( p_SuperObjPerso ) )
{
fn_vSetProcedureActionReturn ( C_ACTION_ENGINE_STOP | C_ACTION_ENGINE_STOP_RULE ) ;
}
}
return ( p_stTree ) ;
break ; /*anti-bug GCC N64*/
default :
break ;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif /* __DEBUG_AI__*/
return(p_stTree);
}
/* Modif 03/09/98 : Save/load Clock when Freeze/Unfreeze the engine - Carlos Torres*/
tdstNodeInterpret *fn_p_stMiscProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stValue;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
M_EvalNextParameter(&stValue);
switch ( eProcedureId )
{
case eProc_ForcePersoHandling:
{
tdstEngineObject *p_stObj = M_GetSetParam_p_stEngineObjValue(&stValue);
/* if the object was already treated during the current frame, clear its flag so that*/
/* it can be treated again. WARNING: this will work only if the perso is moved in the*/
/* hierarchy so that it will be encountered again!*/
if ( M_ObjectIsAlreadyTreated(p_stObj) )
{
/* mark the object as not handled*/
fn_vStandardGameSetLastTrame ( p_stObj->h_StandardGame , g_stEngineStructure . stEngineTimer . ulTrameNumber - 1 ) ;
/* and recursively mark its matrixes as not valid*/
HIE_fn_vInvalidateHierarchy(M_GetSuperObject(p_stObj));
}
}
return p_stTree;
break;
case eProc_HierFreezeEngine:
{
ACP_tdxBool bFreeze = M_GetSetParam_lValue(&stValue);
if ( bFreeze )
{
fn_vSaveEngineClock();
SAF_M_AssertWithMsg(
(fn_ulStandardGameGetCustomBits(M_GetMSHandle(p_SuperObjPerso,StandardGame)) & GAM_C_CustBitUnfreezable) != 0,
"Gel du moteur par acteur non protégé avec le CustomBit 21"
);
}
else
{
fn_vLoadEngineClock();
}
g_stEngineStructure.bEngineFrozen = bFreeze;
}
return p_stTree;
break; /*anti-bug GCC N64*/
case eProc_HierSetPlatformType:
{
MS_tdxHandleToStandardGame hStdGame = M_GetMSHandle(p_SuperObjPerso,StandardGame);
ACP_tdxBool bPlatform = (ACP_tdxBool) M_GetSetParam_lValue(&stValue), bPrevPlatform = fn_ucStandardGameGetPlatFormType(hStdGame);
/* move the objet properly in the hierarchy list*/
if ( bPrevPlatform != bPlatform )
{
/* if I was a platform with children, they no longer are, because this is forbidden!*/
if ( bPrevPlatform )
{
int i;
HIE_tdxHandleToSuperObject hChild;
HIE_M_ForEachChildOf(p_SuperObjPerso,hChild,i)
{
if ( HIE_fn_ulGetSuperObjectType(hChild) == HIE_C_ulActor )
{
MS_tdxHandleToDynam hDynam = M_GetMSHandle(hChild, Dynam);
if ( hDynam )
{
struct DNM_stDynamics *p_stDynamic = fn_p_stDynamGetDynamics(hDynam);
if ( p_stDynamic && MEC_fn_bIsBaseMechanic(p_stDynamic) )
{
/* -> I cut the mechanics platform link*/
MEC_fn_vFreePlatformLink(p_stDynamic, hChild);
}
}
/* and the child can no longer be child!*/
fn_vReputCharacterSuperObjectAtTheWorld(hChild);
}
}
}
/*now change the platform type*/
fn_ucStandardGameSetPlatFormType(hStdGame, bPlatform);
/* the father remains the same, but we get to the head of the list if we are a platform, of the tail if we are not!*/
HIE_fn_vChangeFather(p_SuperObjPerso, HIE_M_hGetSuperObjectFather(p_SuperObjPerso), bPlatform);
}
}
return p_stTree;
break; /*anti-bug GCC N64*/
case eProc_SetMainActor:
MC_fn_vSetNewMainCharacter(MC_fn_hGetFirstMainCharNode(), M_GetSetParam_p_stSupObjValue(&stValue));
return p_stTree;
break; /*anti-bug GCC N64*/
case eProc_ActivateObject:
{
tdstEngineObject *p_stActivateObject;
p_stActivateObject = M_GetSetParam_p_stEngineObjValue(&stValue);
fn_vForceActiveAnObject(p_stActivateObject);
}
return p_stTree;
break; /*anti-bug GCC N64*/
case eProc_DesactivateObject:
fn_vDesactiveAnObject(M_GetSetParam_p_stEngineObjValue(&stValue));
return p_stTree;
break; /*anti-bug GCC N64*/
case eProc_ChangeMapNoAutosave :
case eProc_ChangeMap :
GAM_fn_vAskToChangeLevel(fn_szGetStringFromTextOrStringParam(&stValue), ( ACP_tdxBool ) ( eProcedureId == eProc_ChangeMap ) );
return p_stTree;
break; /*anti-bug GCC N64*/
case eProc_SetActionReturn :
/* fn_vSetNewActionReturnValue((unsigned char) M_GetSetParam_lValue(&stValue));*/
g_ucNewActionReturn = (unsigned char) M_GetSetParam_lValue(&stValue);
/* fn_vSetUseDefaultActionReturnValue(TRUE);*/
g_ucUseDefaultActionReturn = TRUE;/* g_ucNewActionReturn can't be used for the action SetActionReturn but for the next one.*/
return p_stTree;
break; /*anti-bug GCC N64*/
/*case eProc_PlayerIsDeadWithOption:
M_EvalNextParameter(&stValue);
fn_vSnifThePlayerIsDeadWithOption((ACP_tdxBool)(M_ReturnParam_lValue(&stValue)?1:0));
return(p_stTree);
break;*/
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif /* __DEBUG_AI__*/
return(p_stTree);
}
/*
=======================================================================================
=======================================================================================
*/
tdstNodeInterpret *fn_p_stMiscMoreProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam1, stParam2;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
/*we accept to be given a NULL actor as a result, so dont piss us off!!!*/
#if defined(__DEBUG_AI__)
fn_vSetDontCheckNULLFlag(1);
#endif /* __DEBUG_AI__ */
M_EvalNextTwoParameter();
#if defined(__DEBUG_AI__)
fn_vSetDontCheckNULLFlag(-1);
#endif /* __DEBUG_AI__ */
switch(eProcedureId)
{
/*case eProc_ChangeMapAtPosition :
{
tdstGetSetParam stParam3;
M_EvalNextParameter(&stParam3);
GAM_fn_vAskToChangeLevelWithPosition(
fn_szGetStringFromTextOrStringParam(&stParam1),
fn_szGetStringFromTextOrStringParam(&stParam2),
fn_szGetStringFromTextOrStringParam(&stParam3)
);
}
return p_stTree;
break;*/
case eProc_PlayerIsDeadWithPlacement:
fn_vSnifThePlayerIsDeadWithResurrectionAt(
M_GetSetParam_p_stEngineObjValue(&stParam1) ? M_GetSetParam_p_stSupObjValue(&stParam1) : NULL,
M_GetSetParam_p_stEngineObjValue(&stParam2) ? M_GetSetParam_p_stSupObjValue(&stParam2) : NULL
);
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif /* __DEBUG_AI__*/
return(p_stTree);
}
/***************************************/
/* Dynamic procedures*/
/***************************************/
tdstNodeInterpret *fn_p_stDynamProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=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(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
switch(eProcedureId)
{
case eProc_ForcePersoAveragePosition:
{
/* ANNECY MT - 30/10/98 {*/
if(g_stEngineStructure.h_StdCamCaracter)
{
MS_tdxHandleToCineinfo hCineinfo = M_GetMSHandle(g_stEngineStructure.h_StdCamCaracter, Cineinfo);
if(CAM_fn_hCineInfoGetSuperObjectTargeted(hCineinfo->hCurrent) == hNewSuperObjPerso)
{
unsigned long ulIndex;
MTH_tdxReal xBaseTime;
MTH3D_tdstVector *p_stVectorPos;
/* all previous recorded positions are set to the current one,*/
p_stVectorPos = POS_fn_p_stGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(hNewSuperObjPerso));
xBaseTime = MTH_M_xFloatToReal(0.03f);
for ( ulIndex = 0; ulIndex < C_ucNbOfCheckedSpeeds; ulIndex ++ )
{
hCineinfo->AveragePosition.a_CheckedTime[ulIndex] = xBaseTime;
/* all previous recorded positions are set to immobility*/
MTH3D_M_vNullVector(&(hCineinfo ->AveragePosition.a_CheckedSpeed[ulIndex]));
MTH3D_M_vCopyVector(&(hCineinfo ->AveragePosition.a_CheckedPos[ulIndex]),p_stVectorPos);
}
}
}
/* END ANNECY MT }*/
}
return p_stTree;
break;
/*ANNECY jt {*/
/* case eProc_AllowDynamLOD :*/
/* fn_vDynamSetDistantObject(h_Dynam);*/
/* return p_stTree;*/
/* break;*/
/* case eProc_ForbidDynamLOD :*/
/* fn_vDynamSetNearObject(h_Dynam);*/
/* return p_stTree;*/
/* break;*/
/*ENDANNECY jt }*/
default:
break;
}
return p_stTree;
}
/*
=======================================================================================
=======================================================================================
*/
tdstNodeInterpret *fn_p_stHitPointsProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
M_EvalNextParameter(&stParam);
#if defined(__DEBUG_AI__)
M_VerifyTypeOfParamAction(&stParam, E_vt_Perso);
#endif
switch ( eProcedureId )
{
case eProc_SetHitPoints :
return(fn_p_stSetHitPoints(p_SuperObjPerso, p_stTree, M_GetSetParam_p_stEngineObjValue(&stParam)));
break;
case eProc_SetHitPointsInit :
{
tdstEngineObject * hPerso = M_GetSetParam_p_stEngineObjValue(&stParam) ;
M_EvalNextParameter(&stParam);
fn_vSetHitPointsInit ( hPerso, ( unsigned char ) M_GetSetParam_lValue(&stParam)) ;
}
return p_stTree;
break;
case eProc_SetHitPointsToInitValue :
fn_vSetHitPointsToInitValue(M_GetSetParam_p_stEngineObjValue(&stParam));
return p_stTree;
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_SetHitPointsToMaxValue :
fn_vSetHitPointsToMaxValue(M_GetSetParam_p_stEngineObjValue(&stParam));
return p_stTree;
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_AddHitPoints :
return(fn_p_stAddHitPoints(p_SuperObjPerso, p_stTree, M_GetSetParam_p_stEngineObjValue(&stParam)));
break;
case eProc_SubHitPoints :
return(fn_p_stSubHitPoints(p_SuperObjPerso, p_stTree, M_GetSetParam_p_stEngineObjValue(&stParam)));
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif /* __DEBUG_AI__*/
return(p_stTree);
}
/*
=======================================================================================
=======================================================================================
*/
tdstNodeInterpret *fn_p_stHitPointsMaxProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
M_EvalNextParameter(&stParam);
#if defined(__DEBUG_AI__)
M_VerifyTypeOfParamAction(&stParam, E_vt_Perso);
#endif /* __DEBUG_AI__*/
switch(eProcedureId)
{
case eProc_SetHitPointsMax :
return(fn_p_stSetHitPointsMax(p_SuperObjPerso, p_stTree, M_GetSetParam_p_stEngineObjValue(&stParam)));
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_SetHitPointsMaxToInitValue :
fn_vSetHitPointsMaxToInitValue(M_GetSetParam_p_stEngineObjValue(&stParam));
return p_stTree;
break;
case eProc_SetHitPointsMaxToMaxValue :
fn_vSetHitPointsMaxToMaxValue(M_GetSetParam_p_stEngineObjValue(&stParam));
return p_stTree;
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_AddHitPointsMax :
return(fn_p_stAddHitPointsMax(p_SuperObjPerso, p_stTree, M_GetSetParam_p_stEngineObjValue(&stParam)));
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_SubHitPointsMax :
return(fn_p_stSubHitPointsMax(p_SuperObjPerso, p_stTree, M_GetSetParam_p_stEngineObjValue(&stParam)));
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif /* __DEBUG_AI__*/
return(p_stTree);
}
/***********************************************************************************************************************/
/*LISTES*/
/***********************************************************************************************************************/
/*---------------------------------------------------------------------------------------------------------------------*/
tdstNodeInterpret *fn_p_stListZDDZDEProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stValue;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstList *p_stList=NULL;
M_EvalNextParameter(&stValue);
p_stList=(tdstList *) M_GetSetParam_Dsg_List(&stValue);
/* replace the content of the list by the list of the perso whose one of all the ZDEs of a given type (xOthersMask) is in collision with one of the ZDEs of a given type (xPersoMask) of the current perso*/
/* ***************** WARNING *********************/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/* ***************** WARNING *********************/
/* if you remove this code, then you can remove the*/
/* fn_vThisTypeVsThisType() and fn_vAffectTypeZdeWithTypeZdeInList() functions too*/
if (eProcedureId==eProc_ListAffectTypeZDEWithTypeZDE)
{
GMT_tdxMask xPersoMask,xOthersMask;
M_EvalNextParameter(&stValue);
xPersoMask=M_GetSetParam_xMaskValue(&stValue);
M_EvalNextParameter(&stValue);
xOthersMask=M_GetSetParam_xMaskValue(&stValue);
fn_vAffectTypeZdeWithTypeZdeInList(p_stList,p_SuperObjPerso,xPersoMask,xOthersMask);
}
else
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
{
ACP_tdxIndex xIndex;
M_EvalNextParameter(&stValue);
xIndex=(ACP_tdxIndex) M_GetSetParam_lValue(&stValue);
/* replace the content of the list by the list of the perso that are in the given Zdd*/
if (eProcedureId==eProc_ListAffectPersoZDD)
{
fn_vAffectZddInList(p_stList,p_SuperObjPerso, AI_ZDX_CHARACTER,xIndex);
}
else
if (eProcedureId==eProc_ListAffectModuleZDD)
{
fn_vAffectZddInList(p_stList,p_SuperObjPerso, AI_ZDX_MODULE, xIndex);
}
else
{
GMT_tdxMask xMask;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/* replace the content of the list by the list of the perso that are in the given Zde of a given type*/
if ( (eProcedureId==eProc_ListAffectPersoZDE)
||
(eProcedureId==eProc_ListAffectModuleZDE)
)
{
GMT_fn_vResetEntireMask(&xMask);
}
else /* eProc_ListAffectPersoTypeZDE or eProc_ListAffectModuleTypeZDE*/
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
{
M_EvalNextParameter(&stValue);
xMask=M_GetSetParam_xMaskValue(&stValue);
}
if (
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 08/06/99 { */
(eProcedureId==eProc_ListAffectPersoZDE)
||
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
(eProcedureId==eProc_ListAffectPersoTypeZDE)
)
{
fn_vAffectZdeInList(p_stList, p_SuperObjPerso, AI_ZDX_CHARACTER, xIndex, xMask);
}
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
else
if ( (eProcedureId==eProc_ListAffectModuleZDE)
||
(eProcedureId==eProc_ListAffectModuleTypeZDE)
)
{
fn_vAffectZdeInList(p_stList, p_SuperObjPerso, AI_ZDX_MODULE, xIndex, xMask);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
else
{
M_AIFatalError(E_uwAIFatalNotValidProcedure);
}
#endif
}
}
return(p_stTree);
}
/* Oliv' - Portage v15 - not the right solution*/
/*#pragma warning (disable : 4706) // There are some voluntary assignment inside this function*/
/* EndOfOliv'*/
/*---------------------------------------------------------------------------------------------------------------------*/
tdstNodeInterpret *fn_p_stListProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam1,stParam2;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstList *p_stList;
M_EvalNextParameter(&stParam1);
p_stList=(tdstList *) M_GetSetParam_Dsg_List(&stParam1);
switch(eProcedureId)
{
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_AddPersoInList :
M_EvalNextParameter(&stParam1);
SAF_M_AssertWithMsg(M_GetSetParam_p_stSupObjValue(&stParam1), "l'acteur spécifié est nul");
fn_vPutInList(p_stList, M_GetSetParam_p_stSupObjValue(&stParam1));
return(p_stTree);
break;
case eProc_AddPersoInListAt :
M_EvalNextTwoParameter();
SAF_M_AssertWithMsg(M_GetSetParam_p_stSupObjValue(&stParam1), "l'acteur spécifié est nul");
fn_vInsertPersoAtPositionInList(p_stList,M_GetSetParam_p_stSupObjValue(&stParam1),(unsigned char) M_GetSetParam_lValue(&stParam2));
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_DeletePersoAtInList :
M_EvalNextParameter(&stParam1);
fn_vDeletePersoAtPositionInList(p_stList,(unsigned char)M_GetSetParam_lValue(&stParam1));
return(p_stTree);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_FindPersoAndDeleteInList :
M_EvalNextParameter(&stParam1);
SAF_M_AssertWithMsg(M_GetSetParam_p_stSupObjValue(&stParam1), "l'acteur spécifié est nul");
(void)fn_bFindPersoAndDeleteInList(p_stList,M_GetSetParam_p_stSupObjValue(&stParam1)); /*(void) for lint*/
return(p_stTree);
break;
case eProc_ListSelect:
return(fn_p_stListSelect(p_stList,0, p_stTree));
break;
case eProc_ListUnSelect:
return(fn_p_stListSelect(p_stList,1, p_stTree));
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_ListSort:
M_EvalNextTwoParameter();
return( fn_p_stListSort(p_stList,(unsigned char)M_GetSetParam_lValue(&stParam1),(char)M_GetSetParam_lValue(&stParam2),p_stTree) );
break;
case eProc_ListSortByFamily:
M_EvalNextParameter(&stParam1);
fn_vSortListByFamily(p_stList, M_GetSetParam_hFamily(&stParam1));
return p_stTree;
break;
case eProc_ListSortByModel:
M_EvalNextParameter(&stParam1);
fn_vSortListByModel(p_stList, M_GetSetParam_p_stModel(&stParam1));
return p_stTree;
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_FillListWithAllPersoOfAFamily:
{
HIE_tdxHandleToSuperObject hChild, hBrother;
tdxHandleToFamilyList hFamily;
M_ClearList(p_stList); /* Bart ?*/
M_EvalNextParameter(&stParam2);
hFamily=M_GetSetParam_hFamily(&stParam2);
for ( hChild = HIE_fn_hGetSuperObjectFirstChild(gp_stDynamicWorld); HIE_fn_bIsSuperObjectValid(hChild); hChild = HIE_fn_hGetSuperObjectFirstChild(hChild) )
{
/* For each brother of First Child.*/
for ( hBrother = hChild; HIE_fn_bIsSuperObjectValid(hBrother); hBrother = HIE_fn_hGetSuperObjectNextBrother(hBrother) )
{
if
(
(HIE_fn_ulGetSuperObjectType(hBrother) == HIE_C_ulActor)
&& (fn_h3dDataGetFamily(M_GetMSHandle(hBrother,3dData)) == hFamily)
)
{
/* si la liste est déjà remplie*/
if (M_ucNbEltInList(p_stList)<M_ucGetMaxSizeOfList(p_stList))
fn_vPutInList(p_stList, hBrother);
else
break; /* we are done, so break the loop*/
}
}
}
}
return(p_stTree);
break;
case eProc_FillListWithAllPersoOfAModel:
{
HIE_tdxHandleToSuperObject hChild, hBrother;
AI_tdstAIModel *p_stModel;
M_ClearList(p_stList);
M_EvalNextParameter(&stParam2);
p_stModel=M_GetSetParam_p_stModel(&stParam2);
for ( hChild = HIE_fn_hGetSuperObjectFirstChild(gp_stDynamicWorld); HIE_fn_bIsSuperObjectValid(hChild); hChild = HIE_fn_hGetSuperObjectFirstChild(hChild) )
{
/* For each brother of First Child.*/
for ( hBrother = hChild; HIE_fn_bIsSuperObjectValid(hBrother); hBrother = HIE_fn_hGetSuperObjectNextBrother(hBrother) )
{
MS_tdxHandleToBrain hBrain;
if
(
(HIE_fn_ulGetSuperObjectType(hBrother) == HIE_C_ulActor)
&& ((hBrain = M_GetMSHandle(hBrother,Brain)) != 0) /*VOLUNTARY ASSIGNMENT!*/
&& (AI_M_p_stGetAIModel(M_pstGetMindOfBrain(hBrain)) == p_stModel)
)
{
/* si la liste est déjà remplie*/
if (M_ucNbEltInList(p_stList)<M_ucGetMaxSizeOfList(p_stList))
fn_vPutInList(p_stList, hBrother);
else
break; /* we are done so break the loop*/
}
}
}
}
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_DeleteFamilyInList:
{
HIE_tdxHandleToSuperObject hPerso;
tdxHandleToFamilyList hFamily;
unsigned char ucPos = 0;
M_EvalNextParameter(&stParam2);
hFamily=M_GetSetParam_hFamily(&stParam2);
hPerso = fn_p_stGetPersoInList(p_stList, ucPos);
while(hPerso)
{
if(fn_h3dDataGetFamily(M_GetMSHandle(hPerso,3dData)) == hFamily)
fn_vDeletePersoAtPositionInList(p_stList, ucPos);
else
ucPos++;
hPerso = fn_p_stGetPersoInList(p_stList, ucPos);
}
}
return(p_stTree);
break;
case eProc_DeleteModelInList:
{
HIE_tdxHandleToSuperObject hPerso;
AI_tdstAIModel *p_stModel;
unsigned char ucPos = 0;
M_EvalNextParameter(&stParam2);
p_stModel=M_GetSetParam_p_stModel(&stParam2);
hPerso = fn_p_stGetPersoInList(p_stList, ucPos);
while(hPerso)
{
MS_tdxHandleToBrain hBrain;
if
(
((hBrain = M_GetMSHandle(hPerso,Brain)) != 0) /*VLUNTARY ASSIGNMENT!*/
&& (AI_M_p_stGetAIModel(M_pstGetMindOfBrain(hBrain)) == p_stModel)
)
fn_vDeletePersoAtPositionInList(p_stList, ucPos);
else
ucPos++;
hPerso = fn_p_stGetPersoInList(p_stList, ucPos);
}
}
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/* Oliv' - Portage v15 - not the right solution*/
/*#pragma warning (default : 4706)*/
/* EndOfOliv'*/
/*---------------------------------------------------------------------------------------------------------------------*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 08/06/99 { */
tdstNodeInterpret *fn_p_stListEnsembleProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stValue;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstList *p_stListA,*p_stListB,*p_stListC;
M_EvalNextParameter(&stValue);
p_stListA=(tdstList *) M_GetSetParam_Dsg_List(&stValue);
M_EvalNextParameter(&stValue);
p_stListB=(tdstList *) M_GetSetParam_Dsg_List(&stValue);
if (eProcedureId==eProc_ListAdd)
{
fn_vAddList(p_stListA,p_stListB);
}
else
{
M_EvalNextParameter(&stValue);
p_stListC=(tdstList *) M_GetSetParam_Dsg_List(&stValue);
switch(eProcedureId)
{
case eProc_ListUnion :
fn_vUnionList(p_stListA,p_stListB,p_stListC);
return(p_stTree);
break;
case eProc_ListInter :
fn_vInterList(p_stListA,p_stListB,p_stListC);
return(p_stTree);
break;
case eProc_ListDiff :
fn_vDiffList(p_stListA,p_stListB,p_stListC);
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
}
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stLinkTableProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
unsigned char ucObj1;
M_EvalNextParameter(&stParam);
switch(eProcedureId)
{
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_SwapLinkTableObjects :
ucObj1=M_GetSetParam_ucValue(&stParam);
M_EvalNextParameter(&stParam);
fn_vExchangeTwoObjectsInCurrentObjectsTable(p_SuperObjPerso,ucObj1,M_GetSetParam_ucValue(&stParam));
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_ChangeCurrentObjectTable :
fn_v3dDataSetCurrentObjectsTable(M_GetMSHandle(p_SuperObjPerso,3dData),M_GetSetParam_hObjectTable(&stParam));
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/* -----------------10/03/98 15:04-------------------
parameters are:
eProc_BuildObjectTableFromTableAndString
-> source object table
-> formatted string
eProc_BuildObjectTableFromFormattedString
-> formatted string
-> screen width
-> start index in string
-> end index in string (-1 if full string is handled)
--------------------------------------------------*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *fn_p_stBuildObjectTableFromTableAndStringProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree - 1);
char *pszChar;
M_EvalNextParameter(&stParam);
switch ( eProcedureId )
{
case eProc_BuildObjectTableFromFormattedString:
{
MTH_tdxReal xScreenWidth;
long lStart, lEnd;
tdstTfmtStatus stStatus;
pszChar = fn_szGetStringFromTextOrStringParam(&stParam);
M_EvalNextParameter(&stParam);
xScreenWidth = M_ReturnParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
lStart = M_ReturnParam_lValue(&stParam);
M_EvalNextParameter(&stParam);
lEnd = M_ReturnParam_lValue(&stParam);
/*just to be sure*/
if (lStart < 0 )
lStart = 0;
/*now do it!*/
(void) TFMT_wPositionModulesAccordingToText(&stStatus, p_SuperObjPerso, pszChar, lStart, lEnd, xScreenWidth, NULL, -1);
}
return p_stTree;
break;
case eProc_BuildObjectTableFromTableAndString:
{
short wNbObjectsInTargetTable = 0, wNbObjectsInSourceTable = 0;
short wTargetObject = 0;
/*we copy objet references from this object table*/
tdxHandleToObjectsTablesList hSourceObjectTable = M_GetSetParam_hObjectTable(&stParam);
/*into our current object table*/
tdxHandleToObjectsTablesList hTargetObjectTable = fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_SuperObjPerso,3dData));
wNbObjectsInTargetTable = fn_uwGetObjectTableNumberOfelements(hTargetObjectTable);
wNbObjectsInSourceTable = fn_uwGetObjectTableNumberOfelements(hSourceObjectTable);
/*read the string that we will use*/
M_EvalNextParameter(&stParam);
pszChar = fn_szGetStringFromTextOrStringParam(&stParam);
/*now for each character in the string*/
while ( (*pszChar) && (wTargetObject < wNbObjectsInTargetTable) )
{
/*use the ASCII code as an index in the source object table*/
short wSourceObject = toupper(*pszChar) - ' ';
if ( wSourceObject < 0 || wSourceObject >= wNbObjectsInSourceTable )
wSourceObject = 0;
/*and copy incrementally the source object of the source table in the target table*/
fn_vCopyObjectFromObjectTabletoAnother(hTargetObjectTable, hSourceObjectTable, wTargetObject, wSourceObject);
/*go to next source and target object*/
pszChar ++;
wTargetObject ++;
}
/*now fill the rest of the target object table with spaces*/
while ( wTargetObject < wNbObjectsInTargetTable )
{
/*and copy incrementally the source object of the source table in the target table*/
fn_vCopyObjectFromObjectTabletoAnother(hTargetObjectTable, hSourceObjectTable, wTargetObject, 0);
/*go to next source and target object*/
wTargetObject ++;
}
}
return p_stTree;
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/***********************************************************************************************************************/
/***********************************************************************************************************************/
#ifdef D_USE_LIPSYNC
tdstNodeInterpret *fn_p_stLipsSynchroProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdxHandleOfLipsSynchroTable hST1;
M_EvalNextParameter(&stParam);
switch(eProcedureId)
{
case eProc_StartSpeech :
hST1=M_GetSetParam_hLipsSynchro(&stParam);
fn_vStartLipsSynchro(p_SuperObjPerso,hST1);
return(p_stTree);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_StopSpeech :
fn_vStopLipsSynchro(p_SuperObjPerso);
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
#endif /* D_USE_LIPSYNC*/
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stModuleControlProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam1;
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
long lModuleId;
/*GEO_tdxHandleToMatrix hSupObjMatrix;*/
/*MTH3D_tdstVector stRotationAnglesVertex;*/
/* not all calls have a parameter!!!*/
if ( eProcedureId != eProc_ReleaseAllModulesControl )
M_EvalNextParameter(&stParam1);
switch(eProcedureId)
{
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_TakeManyModulesControl:
lModuleId = M_GetSetParam_lValue(&stParam1);
for ( lModuleId --; lModuleId >= 0; lModuleId -- )
{
/*no need to test that the max value passed exists, because this function will do it anyway*/
fn_vTakeControlOfChannel((tdstEngineObject *)HIE_fn_hGetSuperObjectObject(p_SuperObjPerso), (unsigned short) lModuleId, TRUE);
/*
// Control on translation has no effect.
MTH3D_M_vSetVectorElements(&stRotationAnglesVertex,MTH_C_InfinitPlus,MTH_C_InfinitPlus,MTH_C_InfinitPlus);
fn_vSetUCCTranslationVector(p_SuperObjPerso,uwModuleId,stRotationAnglesVertex);
// Control on Rotation has no effect.
fn_vSetUCCAngleX(p_SuperObjPerso,uwModuleId,MTH_C_InfinitPlus);
fn_vSetUCCAngleY(p_SuperObjPerso,uwModuleId,MTH_C_InfinitPlus);
fn_vSetUCCAngleZ(p_SuperObjPerso,uwModuleId,MTH_C_InfinitPlus);
*/
}
/*force the allocated matrix to replace the channel matrix immediately for all controled modules*/
/*fn_vUpdateMatrixOfControledChannels((tdstEngineObject *)HIE_fn_hGetSuperObjectObject(p_SuperObjPerso));*/
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_TakeModuleControl :
lModuleId = M_GetSetParam_lModuleValue(&stParam1);
fn_vTakeControlOfChannel((tdstEngineObject *)HIE_fn_hGetSuperObjectObject(p_SuperObjPerso), (unsigned short)lModuleId, TRUE);
/*
// Control on translation has no effect.
MTH3D_M_vSetVectorElements(&stRotationAnglesVertex,MTH_C_InfinitPlus,MTH_C_InfinitPlus,MTH_C_InfinitPlus);
fn_vSetUCCTranslationVector(p_SuperObjPerso,uwModuleId,stRotationAnglesVertex);
// Control on Rotation has no effect.
fn_vSetUCCAngleX(p_SuperObjPerso,uwModuleId,MTH_C_InfinitPlus);
fn_vSetUCCAngleY(p_SuperObjPerso,uwModuleId,MTH_C_InfinitPlus);
fn_vSetUCCAngleZ(p_SuperObjPerso,uwModuleId,MTH_C_InfinitPlus);
*/
/*force the allocated matrix to replace the channel matrix immediately for all controled modules*/
/*fn_vUpdateMatrixOfControledChannels((tdstEngineObject *)HIE_fn_hGetSuperObjectObject(p_SuperObjPerso));*/
return(p_stTree);
break;
case eProc_ReleaseModuleControl :
lModuleId = M_GetSetParam_lModuleValue(&stParam1);
fn_vTakeControlOfChannel((tdstEngineObject *)HIE_fn_hGetSuperObjectObject(p_SuperObjPerso), (unsigned short)lModuleId, FALSE);
return(p_stTree);
break;
case eProc_ReleaseAllModulesControl:
fn_vTakeControlOfChannel((tdstEngineObject *)HIE_fn_hGetSuperObjectObject(p_SuperObjPerso), (unsigned short) -1, FALSE);
return(p_stTree);
break;
/*
case eProc_InitModuleControlWithAnimTranslation :
uwModuleId = (unsigned short)M_GetSetParam_lModuleValue(&stParam1);
hSupObjMatrix = HIE_fn_hGetSuperObjectMatrix(fn_hGetSuperObjectInChannel(fn_h3dDataGetChannelSOList(M_GetMSHandle(p_SuperObjPerso,3dData)),uwModuleId));
POS_fn_vGetTranslationVector(hSupObjMatrix,&stRotationAnglesVertex);
MTH3D_M_vSetVectorElements(&stRotationAnglesVertex,MTH_C_InfinitPlus,MTH_C_InfinitPlus,MTH_C_InfinitPlus);
fn_vSetUCCTranslationVector(p_SuperObjPerso,uwModuleId,stRotationAnglesVertex);
return(p_stTree);
break;
case eProc_InitModuleControlWithAnimRotation :
uwModuleId = (unsigned short)M_GetSetParam_lModuleValue(&stParam1);
fn_vGetEulerAngles(p_SuperObjPerso,uwModuleId,&stRotationAnglesVertex);
fn_vVectorModuloAround(MTH_C_ZERO,MTH_C_2Pi,&stRotationAnglesVertex);
fn_vSetUCCRotationVector(p_SuperObjPerso, uwModuleId,stRotationAnglesVertex);
return(p_stTree);
break;
*/
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stSaveGameProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
/*
#if defined(__DEBUG_AI__)
M_VerifyTypeOfParamAction(&stParam,E_vt_Text);
#endif
*/
switch ( eProcedureId )
{
case eProc_QuitGame:
fn_vChangeEngineMode(EM_ModeStoppingProgram);
/*stop execution right now!*/
fn_vSetProcedureActionReturn(C_ACTION_ENGINE_STOP | C_ACTION_ENGINE_STOP_RULE);
/* #if defined(PRESS_DEMO)
TerminateProcess(GetCurrentProcess(),0);
#endif*/
break;
/*case eProc_IncHistoryAndSaveGame:*/
/*fn_vIncPlayerSavedNumber();*/
/* No break here !!!*/
#if 0 /* passage en fonction */
case eProc_SaveGame:
case eProc_LoadGame:
case eProc_EraseGame:
{
long lSlotId;
tdstGetSetParam stParam;
M_EvalNextParameter(&stParam);
lSlotId = M_GetSetParam_lValue(&stParam);
#ifndef U64
SAF_M_AssertWithMsg((lSlotId >= 1 && lSlotId <= (long)fn_lGetNbAvailableSlotsPc() ), "Slot de sauvegarde inexistant");
#else
SAF_M_AssertWithMsg((lSlotId >= 1 && lSlotId <= g_ucNbSaveGameSlots, "Slot de sauvegarde inexistant");
#endif // !U64
switch ( eProcedureId )
{
case eProc_SaveGame:
/*before we save the whole game status, force the current level to save itself, so that it is coherent with the rest*/
fn_bLevelSaveGameAll();
/*make the player date save themselves as well for the same reason*/
fn_bPlayerSaveGameAll();
/*now copy the current game status in the specified slot*/
fn_bSaveGameInSlot(lSlotId);
break;
case eProc_LoadGame:
fn_bLoadGameFromSlot(lSlotId);
break;
case eProc_EraseGame:
fn_bEraseGameInSlot(lSlotId);
#ifdef U64
memset(g_stGameOptions.a_szSlotNames[lSlotId-1] , 0 , C_ucSaveGameSlotNameLength);
#else // PC
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if( Version == 1 /* N64 */) memset(g_stGameOptions.a_szSlotNames[lSlotId-1] , 0 , C_ucSaveGameSlotNameLength);
#endif // EDITOR
#endif // U64
break;
default:
break;
}
}
break;
#endif /* 0 */
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_CopyGame:
{
long lSrcSlotId, lDstSlotId;
tdstGetSetParam stParam;
M_EvalNextParameter(&stParam);
lDstSlotId = M_GetSetParam_lValue(&stParam);
#ifdef U64
SAF_M_AssertWithMsg((lDstSlotId >= 1 && lDstSlotId <= C_ucNbSaveGameSlots),"Slot de sauvegarde inexistant");
#else
SAF_M_AssertWithMsg(( lDstSlotId >= 1 && lDstSlotId <= (long) fn_lGetNbAvailableSlotsPc() ),"Slot de sauvegarde inexistant");
#endif
M_EvalNextParameter(&stParam);
lSrcSlotId = M_GetSetParam_lValue(&stParam);
}
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
default:
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
break;
}
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stChangeActivationChannelProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
unsigned short uwChannelNumber;
enum tdeProcedureId_ eProcedureId=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(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
/* BEWARE ULTRA */
M_EvalNextParameter ( & stParam ) ;
uwChannelNumber = ( unsigned short ) M_GetSetParam_lModuleValue ( & stParam ) ;
switch ( eProcedureId )
{
case eProc_ActivateChannel:
fn_vActivateChannel ( hNewSuperObjPerso , uwChannelNumber , TRUE ) ;
return p_stTree ;
break ;
case eProc_DeactivateChannel :
fn_vActivateChannel ( hNewSuperObjPerso , uwChannelNumber , FALSE ) ;
return p_stTree ;
break ;
default :
break ;
}
#if defined ( __DEBUG_AI__ )
M_AIFatalError ( E_uwAIFatalNotValidProcedure ) ;
#endif
return ( p_stTree ) ;
}
#ifdef U64
extern char GLI_cGlobalForceFogIsOn;
#endif
/*
*=================================================================================================
*=================================================================================================
*/
tdstNodeInterpret *fn_p_stFogProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
static char cGlobalFogIsOn;
switch(eProcedureId)
{
case eProc_FogActivate:
{
unsigned char ucValue;
M_EvalNextParameter(&stParam);
ucValue = (unsigned char) M_ReturnParam_lValue(&stParam);
#ifdef U64
if (ucValue)
GLI_cGlobalForceFogIsOn=1;
else
GLI_cGlobalForceFogIsOn=0;
#else
if(ucValue)
GLI_cGlobalFogIsOn = 1;
else
GLI_cGlobalFogIsOn = 0;
#endif
}
return(p_stTree);
break;
case eProc_SetFogColor:
{
GEO_tdstColor stColor;
M_EvalNextParameter(&stParam);
fn_vConvertParamToColor(&stParam,&stColor);
memcpy(&GLI_stFogColor, &stColor, sizeof(GEO_tdstColor));
}
return(p_stTree);
break;
case eProc_SetFogNearFarInf:
{
MTH_tdxReal xDist;
M_EvalNextParameter(&stParam);
xDist=M_ReturnParam_xValue(&stParam);
GLI_xFogNear = xDist;
M_EvalNextParameter(&stParam);
xDist=M_ReturnParam_xValue(&stParam);
GLI_xFogFar = xDist;
M_EvalNextParameter(&stParam);
xDist=M_ReturnParam_xValue(&stParam);
#ifndef U64
GLI_xFogInfinite = xDist;
#endif
}
return(p_stTree);
break;
case eProc_SetFogBlend:
{
MTH_tdxReal xDist;
M_EvalNextParameter(&stParam);
xDist=M_ReturnParam_xValue(&stParam);
GLI_xFogBlendNear = xDist;
M_EvalNextParameter(&stParam);
xDist=M_ReturnParam_xValue(&stParam);
GLI_xFogBlendFar = xDist;
}
return(p_stTree);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 08/06/99 { */
case eProc_RestoreFog:
{
if (GLI_g_bSaveFog)
{
#ifndef U64
memcpy(&GLI_stFogColor, &GLI_g_stSaveFog.stColor, sizeof(GEO_tdstColor));
GLI_xFogNear = GLI_g_stSaveFog.xDepthStart;
GLI_xFogFar = GLI_g_stSaveFog.xDepthEnd;
GLI_xFogInfinite = GLI_g_stSaveFog.xInfinite;
GLI_xFogBlendNear = GLI_g_stSaveFog.xBlendStart;
GLI_xFogBlendFar = GLI_g_stSaveFog.xBlendEnd;
#endif
GLI_g_bSaveFog = FALSE;
GLI_cGlobalFogIsOn = cGlobalFogIsOn;
}
}
return(p_stTree);
break;
case eProc_SaveFog:
{
if (!GLI_g_bSaveFog)
{
#ifndef U64
memcpy(&GLI_g_stSaveFog.stColor,&GLI_stFogColor, sizeof(GEO_tdstColor));
GLI_g_stSaveFog.xDepthStart = GLI_xFogNear;
GLI_g_stSaveFog.xDepthEnd = GLI_xFogFar;
GLI_g_stSaveFog.xInfinite = GLI_xFogInfinite;
GLI_g_stSaveFog.xBlendStart = GLI_xFogBlendNear;
GLI_g_stSaveFog.xBlendEnd = GLI_xFogBlendFar;
#endif
GLI_g_bSaveFog = TRUE;
cGlobalFogIsOn = GLI_cGlobalFogIsOn;
}
}
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stPersoLightProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
MS_tdxHandleToMSLight h_MSLight=NULL;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
/* BEWARE_ULTRA */
h_MSLight=M_GetEngineObject(hNewSuperObjPerso)->h_MSLight;
if (h_MSLight==NULL)
{
return(fn_p_stSwapNextParameter2(p_stTree));
}
else
{
tdstGetSetParam stParam;
switch(eProcedureId)
{
case eProc_PersoLightOn:
fn_vMSLightSetOnOff(h_MSLight,1);
return(p_stTree);
break;
case eProc_PersoLightOff:
fn_vMSLightSetOnOff(h_MSLight,0);
return(p_stTree);
break;
case eProc_SetPersoLightNearFar:
{
MTH_tdxReal xNear,xFar;
M_EvalNextParameter(&stParam);
xNear=M_ReturnParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
xFar=M_ReturnParam_xValue(&stParam);
fn_vMSLightSetNearFar(h_MSLight,xNear,xFar);
}
return(p_stTree);
break;
case eProc_SetPersoLightColor:
{
GEO_tdstColor stColor;
M_EvalNextParameter(&stParam);
fn_vConvertParamToColor(&stParam,&stColor);
fn_vMSLightSetColorRGBA(h_MSLight,stColor.xR,stColor.xG,stColor.xB,stColor.xA);
}
return(p_stTree);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_SetPersoLightLittleBigAlpha:
{
MTH_tdxReal xAlpha;
M_EvalNextParameter(&stParam);
xAlpha=M_ReturnParam_xValue(&stParam);
fn_vMSLightSetLittleAlpha(h_MSLight,xAlpha);
M_EvalNextParameter(&stParam);
xAlpha=M_ReturnParam_xValue(&stParam);
fn_vMSLightSetBigAlpha(h_MSLight,xAlpha);
}
return(p_stTree);
break;
case eProc_SetPersoLightGyrophare:
{
MTH_tdxReal xStep;
ACP_tdxBool bOnOff;
M_EvalNextParameter(&stParam);
bOnOff=(ACP_tdxBool) M_GetSetParam_lValue(&stParam)?TRUE:FALSE;
M_EvalNextParameter(&stParam);
xStep=M_ReturnParam_xValue(&stParam);
fn_vMSLightSetGiroPhare(h_MSLight,(unsigned char) bOnOff,xStep);
}
return(p_stTree);
break;
case eProc_SetPersoLightPulse:
{
MTH_tdxReal xStep,xMaxRange;
ACP_tdxBool bOnOff;
M_EvalNextParameter(&stParam);
bOnOff=(ACP_tdxBool) M_GetSetParam_lValue(&stParam)?TRUE:FALSE;
M_EvalNextParameter(&stParam);
xStep=M_ReturnParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
xMaxRange=M_ReturnParam_xValue(&stParam);
fn_vMSLightSetPulse(h_MSLight,(unsigned char) bOnOff,xStep,xMaxRange);
}
return(p_stTree);
break;
case eProc_SetPersoLightParalleleType:
fn_vMSLightSetTypeOfLight(h_MSLight,1);
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_SetPersoLightSphericalType:
fn_vMSLightSetTypeOfLight(h_MSLight,2);
return(p_stTree);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_SetPersoLightHotSpotType:
fn_vMSLightSetTypeOfLight(h_MSLight,3);
return(p_stTree);
break;
case eProc_SetPersoLightAmbientType:
fn_vMSLightSetTypeOfLight(h_MSLight,4);
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stSoundProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
SND_tduRefEvt uRefEvt;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
M_EvalNextParameter(&stParam);
uRefEvt.pstPtr=M_GetSetParam_SoundEvent(&stParam);
switch(eProcedureId)
{
case eProc_SendSoundRequest:
/* BEWARE_ULTRA */
SND_fn_lSendRequestSound((long) hNewSuperObjPerso,g_lSoundObjectTypeAnim,uRefEvt,0,NULL);
return(p_stTree);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
#ifdef D_USE_LIPSYNC
case eProc_SendVoiceRequest:
/* BEWARE_ULTRA */
SND_fn_lSendRequestSound((long) hNewSuperObjPerso,g_lSoundObjectTypeLipsSynchro,uRefEvt,0,NULL);
return(p_stTree);
break;
#endif
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_SendMusicRequest:
SND_fn_lSendRequestSound((long) SND_C_OBJET_FANTOME,g_lSoundObjectTypeMusic,uRefEvt,0,NULL);
return(p_stTree);
break;
case eProc_SendAmbianceRequest:
SND_fn_lSendRequestSound((long) SND_C_OBJET_FANTOME,g_lSoundObjectTypeAnim,uRefEvt,0,NULL);
return(p_stTree);
break;
case eProc_SendMenuSndRequest:
SND_fn_lSendRequestSound((long) SND_C_OBJET_FANTOME,g_lSoundObjectTypeMenu,uRefEvt,0,NULL);
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/*
=======================================================================================
Particule generator general function
=======================================================================================
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
#ifndef D_THROW_PRT
tdstNodeInterpret *fn_p_stParticleGeneratorProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
enum tdeProcedureId_ eProcedureId = M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
tdxHandleToParticleGenerator hPrtGen;
MS_tdxHandleToMSPrtSrc hMSPrtSrc;
MTH_tdxReal xReal;
ACP_tdxIndex xIndex;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
if ( (hMSPrtSrc = M_GetMSHandle(hNewSuperObjPerso,MSPrtSrc)) == NULL )
return (p_stTree);
switch(eProcedureId)
{
/* activate generator */
case eProc_PRT_SetGeneratorOn:
fn_vMSPrtSrcSetGeneratorActivation(hMSPrtSrc,1);
return(p_stTree);
break;
/* desactivate generator */
case eProc_PRT_SetGeneratorOff:
fn_vMSPrtSrcSetGeneratorActivation(hMSPrtSrc,0);
return(p_stTree);
break;
/* change generator */
case eProc_PRT_SetGenerator:
M_EvalNextParameter(&stParam);
hPrtGen = M_GetSetParam_hParticleGenerator(&stParam);
fn_p_stMSPrtSrcSetGenerator(hMSPrtSrc,hPrtGen);
return(p_stTree);
break;
/* Set generation to none */
case eProc_PRT_SetModeNone:
fn_vMSPrtSrcSetGenerationModeNone(hMSPrtSrc);
return(p_stTree);
break;
/* Set continuous generation (certain number of particule each engine loop) */
case eProc_PRT_SetModeContinuous:
fn_vMSPrtSrcSetGenerationModeContinuous(hMSPrtSrc);
return(p_stTree);
break;
/* Set crenel generation ( generate particule a certain time then no generation and loop) */
case eProc_PRT_SetModeCrenel:
M_EvalNextParameter(&stParam);
xIndex = (ACP_tdxIndex)M_GetSetParam_lValue(&stParam);
M_EvalNextParameter(&stParam);
fn_vMSPrtSrcSetGenerationModeCrenel(hMSPrtSrc, xIndex, (ACP_tdxIndex)M_GetSetParam_lValue(&stParam) );
return(p_stTree);
break;
/* set probabilist generation (generate particule if randon value is below probabilist value) */
case eProc_PRT_SetModeProbability:
M_EvalNextParameter(&stParam);
fn_vMSPrtSrcSetGenerationModeProbability(hMSPrtSrc, M_GetSetParam_xValue(&stParam));
return(p_stTree);
break;
/* set constant generate number */
case eProc_PRT_SetNumberConstant:
M_EvalNextParameter(&stParam);
fn_vMSPrtSrcSetGenerationNumberConstant(hMSPrtSrc,(ACP_tdxIndex) M_GetSetParam_lValue(&stParam));
return(p_stTree);
break;
/* set probabilist generate number */
case eProc_PRT_SetNumberProbabilist:
M_EvalNextParameter(&stParam);
xIndex = (ACP_tdxIndex)M_GetSetParam_lValue(&stParam);
M_EvalNextParameter(&stParam);
fn_vMSPrtSrcSetGenerationNumberProbabilist(hMSPrtSrc,xIndex, (ACP_tdxIndex)M_GetSetParam_lValue(&stParam));
return(p_stTree);
break;
/* set infinit life time */
case eProc_PRT_SetInfiniteLifeTime:
fn_vMSPrtSrcSetParticlesInfiniteLifeTime(hMSPrtSrc);
return(p_stTree);
break;
/* set constant life time */
case eProc_PRT_SetConstantLifeTime:
M_EvalNextParameter(&stParam);
fn_vMSPrtSrcSetParticlesConstantLifeTime(hMSPrtSrc,M_GetSetParam_xValue(&stParam));
return(p_stTree);
break;
/* set probabilist life time (random value between min and max) */
case eProc_PRT_SetPobabilistLifeTime:
M_EvalNextParameter(&stParam);
xReal = M_GetSetParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
fn_vMSPrtSrcSetParticlesProbabilistLifeTime(hMSPrtSrc,xReal,M_GetSetParam_xValue(&stParam));
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
#endif /* D_THROW_PRT */
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stKeyboardProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stValue;
IPT_tdxHandleToEntryElement IPT_xHandle;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
/* get button handle*/
M_EvalNextParameter(&stValue);
IPT_xHandle=(IPT_tdxHandleToEntryElement) M_GetSetParam_lValue(&stValue);
switch(eProcedureId)
{
case eProc_DeactivateBut :
IPT_fn_vDesactivateEntryElement(IPT_xHandle);
break;
case eProc_ActivateBut :
IPT_fn_vActivateEntryElement(IPT_xHandle);
break;
default:
break;
}
return p_stTree;
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stNoneProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
#ifdef U64_AIDEBUG
/* Pas pour Rayman*/
if( (fn_ulStandardGameGetCustomBits(M_GetMSHandle(p_SuperObjPerso,StandardGame)) & GAM_C_CustBitRayman) == 0 )
{
AIDebug_fn_vSetEnable( AI_M_stGetMindOfSuperObj(p_SuperObjPerso), 1 );
}
#else
p_SuperObjPerso=p_SuperObjPerso;
#endif
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
static void fn_vInternalChangeComportProcedure(
tdstIntelligence *p_stAimedPersoIntelligenceOrReflex,
tdstComport *p_stComport,
ACP_tdxBool _bContinueExecution /* if true, the change does not interrupt the one comport that initiates it */
)
{
if ( M_GetCurrentComport(p_stAimedPersoIntelligenceOrReflex) == p_stComport )
{
#if defined(__DEBUG_AI__)
M_AIWarningErrorAndNeverStopForDebug(E_uwAIWarningChangeToCurrentComport, C_ucErmNoOpenInfoWindow,M_GetNameComport(p_stComport));
#endif
return;
}
if ( !fn_ucChangeComportIntell(p_stAimedPersoIntelligenceOrReflex, p_stComport) )
return;
if ( !_bContinueExecution )
{
/* the current comport is interrupted: simulate a loop 'break' in case we were in a loop */
iNumLoop = 0;
/* it also means the interpreter has to be warned that the comport being executed is no longer valid */
fn_vSetProcedureActionReturn(C_ACTION_CHANGE_COMPORT);
}
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
#ifdef ACTIVE_EDITOR
static ACP_tdxBool s_fn_bCheckForUnreachableCode(tdstNodeInterpret *_p_stTree, unsigned char _ucInitialDepth)
{
ACP_tdxBool bNoUnReachableCode = FALSE;
/*
* if the end of tree is beyond the change, there is no problem.
* if there is code at a different depth, we assume the change comport is inside a test that might be false some time,
* hence the code beyond is not unreachable
*/
if ( M_IsTheEndOfTree(_p_stTree) || (M_DepthInterpret(_p_stTree) != _ucInitialDepth) )
{
bNoUnReachableCode = TRUE;
}
else /* there is a node at the same depth here */
{
/* if it is an endmacro, check the node after that one */
if ( M_GetTypeInterpret(_p_stTree) == E_ti_EndMacro )
bNoUnReachableCode = s_fn_bCheckForUnreachableCode(_p_stTree + 1, _ucInitialDepth);
}
return bNoUnReachableCode;
}
#endif /* ACTIVE_EDITOR */
tdstNodeInterpret *fn_p_stChangeComportIntelligenceProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
HIE_tdxHandleToSuperObject p_stAimedObject;
ACP_tdxBool bTest;
AI_tdstMind *p_stMind ;
#ifdef ACTIVE_EDITOR
unsigned char ucDepth = M_DepthInterpret(p_stTree-1);
#endif /* ACTIVE_EDITOR */
M_EvalNextParameter(&stParam);
p_stAimedObject=M_GetSetParam_p_stSupObjValue(&stParam);
SAF_M_AssertWithMsg(p_stAimedObject, "l'acteur spécifié est nul");
p_stMind = AI_M_stGetMindOfSuperObj(p_stAimedObject) ;
M_EvalNextParameter(&stParam);
/* if the comport does not belong to the caller, or it is not the one being executed, it is not interrupted */
bTest = (p_stAimedObject != p_SuperObjPerso) || !AI_M_bGetDoingIntel(p_stMind);
/*
* if bTest is FALSE, it means the current comport is interrupted.
* we have to make sure that this cannot lead to unreachable code in the current comport!
* some code might be unreachable if the next node is of the same depth, and is not an end-of-comport...
*/
#ifdef ACTIVE_EDITOR
if ( !bTest )
{
SAF_M_AssertWithMsg(
s_fn_bCheckForUnreachableCode(p_stTree, ucDepth),
"Il y a du code inaccessible après cet appel!"
);
}
#endif /* ACTIVE_EDITOR */
fn_vInternalChangeComportProcedure(AI_M_p_stGetIntelligence(p_stMind),M_GetSetParam_pComport(&stParam),bTest);
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
p_stMind->CFast_lCmpMetaActionForMacro = 0;
p_stMind->CFast_lCmpMetaAction = 0;
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stChangeComportReflexProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
HIE_tdxHandleToSuperObject p_stAimedObject;
ACP_tdxBool bTest;
AI_tdstMind *p_stMind ;
#ifdef ACTIVE_EDITOR
unsigned char ucDepth = M_DepthInterpret(p_stTree-1);
#endif /* ACTIVE_EDITOR */
M_EvalNextParameter(&stParam);
p_stAimedObject = M_GetSetParam_p_stSupObjValue(&stParam);
SAF_M_AssertWithMsg(p_stAimedObject, "l'acteur spécifié est nul");
p_stMind = AI_M_stGetMindOfSuperObj(p_stAimedObject) ;
M_EvalNextParameter(&stParam);
/* do I interrupt the reflex currently being executed (hence mine) */
bTest = (p_stAimedObject != p_SuperObjPerso) || AI_M_bGetDoingIntel(p_stMind);
/*
* if bTest is FALSE, it means the current reflex is interrupted.
* we have to make sure that this cannot lead to unreachable code!
* some code might be unreachable if the next node is of the same depth, and is not an end-of-comport...
*/
#ifdef ACTIVE_EDITOR
if ( !bTest )
{
SAF_M_AssertWithMsg(
s_fn_bCheckForUnreachableCode(p_stTree, ucDepth),
"Il y a du code inaccessible après cet appel!"
);
}
#endif /* ACTIVE_EDITOR */
fn_vInternalChangeComportProcedure(AI_M_p_stGetReflex(p_stMind),M_GetSetParam_pComport(&stParam),bTest);
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
p_stMind->CFast_lRfxMetaActionForMacro = 0;
p_stMind->CFast_lRfxMetaAction = 0;
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stChangeMyComportIntelligenceProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
AI_tdstMind *p_stMind = AI_M_stGetMindOfSuperObj(p_SuperObjPerso);
#ifdef ACTIVE_EDITOR
unsigned char ucDepth = M_DepthInterpret(p_stTree-1);
#endif /* ACTIVE_EDITOR */
M_EvalNextParameter(&stParam);
/*
* if bTest is FALSE, it means the current comport is interrupted.
* we have to make sure that this cannot lead to unreachable code in the current comport!
* some code might be unreachable if the next node is of the same depth, and is not an end-of-comport...
*/
#ifdef ACTIVE_EDITOR
/* I change my own comport while executing it -> I have to check! */
if ( AI_M_bGetDoingIntel(p_stMind) )
{
SAF_M_AssertWithMsg(
s_fn_bCheckForUnreachableCode(p_stTree, ucDepth),
"Il y a du code inaccessible après cet appel!"
);
}
#endif /* ACTIVE_EDITOR */
fn_vInternalChangeComportProcedure(AI_M_p_stGetIntelligence(p_stMind),M_GetSetParam_pComport(&stParam),(ACP_tdxBool)!AI_M_bGetDoingIntel(p_stMind));
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
p_stMind->CFast_lCmpMetaActionForMacro = 0;
p_stMind->CFast_lCmpMetaAction = 0;
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stChangeMyComportReflexProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
AI_tdstMind *p_stMind=AI_M_stGetMindOfSuperObj(p_SuperObjPerso);
#ifdef ACTIVE_EDITOR
unsigned char ucDepth = M_DepthInterpret(p_stTree-1);
#endif /* ACTIVE_EDITOR */
M_EvalNextParameter(&stParam);
/*
* if bTest is FALSE, it means the current comport is interrupted.
* we have to make sure that this cannot lead to unreachable code in the current comport!
* some code might be unreachable if the next node is of the same depth, and is not an end-of-comport...
*/
#ifdef ACTIVE_EDITOR
/* I change my own comport while executing it -> I have to check the test! */
if ( !AI_M_bGetDoingIntel(p_stMind) )
{
SAF_M_AssertWithMsg(
s_fn_bCheckForUnreachableCode(p_stTree, ucDepth),
"Il y a du code inaccessible après cet appel!"
);
}
#endif /* ACTIVE_EDITOR */
fn_vInternalChangeComportProcedure(AI_M_p_stGetReflex(p_stMind),M_GetSetParam_pComport(&stParam),AI_M_bGetDoingIntel(p_stMind));
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
p_stMind->CFast_lRfxMetaActionForMacro = 0;
p_stMind->CFast_lRfxMetaAction = 0;
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stChangeMyComportIntelligenceAndReflexProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
AI_tdstMind *p_stMind=AI_M_stGetMindOfSuperObj(p_SuperObjPerso);
tdstComport **pp_stComport = &M_GetSetParam_pComport(&stParam), *p_stIntell, *p_stReflex;
#ifdef ACTIVE_EDITOR
unsigned char ucDepth = M_DepthInterpret(p_stTree-1);
#endif /* ACTIVE_EDITOR */
/*get the intelligence*/
M_EvalNextParameter(&stParam); /* *pp_stComport has the value! */
p_stIntell = *pp_stComport;
/*get the reflex*/
M_EvalNextParameter(&stParam);
p_stReflex = *pp_stComport;
/*
* since I change both my reflex and my comport, either one being executed now is interrupted.
* we have to make sure that this cannot lead to unreachable code!
* some code might be unreachable if the next node is of the same depth, and is not an end-of-comport...
*/
#ifdef ACTIVE_EDITOR
/* I change my own comport and reflex while executing either one -> I have to check the test! */
SAF_M_AssertWithMsg(
s_fn_bCheckForUnreachableCode(p_stTree, ucDepth),
"Il y a du code inaccessible après cet appel!"
);
#endif /* ACTIVE_EDITOR */
fn_vInternalChangeComportProcedure(AI_M_p_stGetIntelligence(p_stMind), p_stIntell, FALSE);
fn_vInternalChangeComportProcedure(AI_M_p_stGetReflex(p_stMind), p_stReflex, FALSE);
//XB 05/08/99
#ifndef D_THROW_CFAST_AI
//End XB
p_stMind->CFast_lCmpMetaActionForMacro = 0;
p_stMind->CFast_lCmpMetaAction = 0;
p_stMind->CFast_lRfxMetaActionForMacro = 0;
p_stMind->CFast_lRfxMetaAction = 0;
//XB 05/08/99
#endif /* D_THROW_CFAST_AI */
//End XB
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stTurnProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
MTH_tdxReal xAngle;
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
struct DNM_stDynamics *p_stDynamics;
MS_tdxHandleToDynam hDynam;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
/* BEWARE ULTRA */
M_EvalNextParameter(&stParam);
xAngle=M_ReturnParam_xValue(&stParam);
hDynam = M_GetMSHandle(hNewSuperObjPerso,Dynam);
if (hDynam)
{
p_stDynamics = fn_p_stDynamGetDynamics(hDynam);
if (p_stDynamics)
{
switch(eProcedureId)
{
case eProc_Turn:
xAngle=MTH_M_xDegToRad(xAngle);
xAngle =MTH_M_xMul(xAngle,MTH_M_xMul(g_stEngineStructure.stEngineTimer.ulUsefulDeltaTime,MTH_M_xFloatToReal(0.001f)));
MEC_vTurnAroundZAxis ( p_stDynamics,xAngle );
break;
case eProc_Turn2:
xAngle=MTH_M_xDegToRad(xAngle);
MEC_vTurnAroundZAxis ( p_stDynamics,xAngle );
break;
default:
break;
}
}
}
/* if (!fn_ucInternalTurn(hNewSuperObjPerso,xAngle))*/
/* {*/
/* fn_vSetProcedureActionReturn(C_ACTION_ENGINE_STOP);*/
/* }*/
return(p_stTree);
}
/*XB*/
#include "Procedu1.cxx"
/*End XB*/
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stTurnPersoProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
/* MTH_tdxReal xRealAngle;*/
/* tdstMACDPID *p_stMACDPID;*/
MS_tdxHandleToDynam h_Dynam;
struct DNM_stDynamics *p_stDynamic;
HIE_tdxHandleToSuperObject p_stAimedObject;
MTH3D_tdstVector stVertexDirection,stVertex1;
enum tdeProcedureId_ eProcedureId=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(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
/* BEWARE ULTRA */
M_EvalNextParameter(&stParam);
/* aimed perso*/
p_stAimedObject=M_GetSetParam_p_stSupObjValue(&stParam);
SAF_M_AssertWithMsg(p_stAimedObject, "l'acteur spécifié est nul");
h_Dynam = M_GetMSHandle(hNewSuperObjPerso,Dynam);
if (h_Dynam)
{
p_stDynamic = fn_p_stDynamGetDynamics(h_Dynam);
if (p_stDynamic)
{
/* get the vector*/
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(hNewSuperObjPerso),&stVertex1);
switch(eProcedureId)
{
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
/* Action Turn in the direction of a perso : four parameters : perso,dx,dy,dz*/
case eProc_DeltaTurnPerso:
{
MTH_tdxReal xDX,xDY,xDZ;
M_EvalNextParameter(&stParam);
xDX=M_ReturnParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
xDY=M_ReturnParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
xDZ=M_ReturnParam_xValue(&stParam);
MTH3D_M_vSetVectorElements(&stVertexDirection, xDX, xDY, xDZ);
POS_fn_vMulMatrixVertex(&stVertexDirection,HIE_fn_hGetSuperObjectGlobalMatrix(p_stAimedObject),&stVertexDirection);
}
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/* Action Turn in the direction of a perso : one parameter : perso*/
case eProc_TurnPerso:
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(p_stAimedObject),&stVertexDirection);
break;
default:
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
MTH3D_M_vSubVector(&stVertexDirection, &stVertexDirection, &stVertex1);
MEC_vTurnAbsolute (p_stDynamic,&stVertexDirection);
}
}
return (p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stChangeActionProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
tdxHandleToState h_WantedState;
ACP_tdxBool bHandleSkippedEventsIfRelevant ;
/*ANNECY CHRISTOPHE MODIFICATIONS CF OLIVIER COUVREUR {*/
enum tdeProcedureId_ eProcedureId = 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(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
/*ANNECY END CHRISTOPHE MODIFICATIONS CF OLIVIER COUVREUR }*/
M_EvalNextParameter(&stParam);
h_WantedState=M_GetSetParam_ActionValue(&stParam);
#if defined(ACTIVE_EDITOR) && defined(__DEBUG_AI__)
/* GuS : verify that new state is in the tables of perso */
{
struct tdstEngineObject_ *p_stObject = (struct tdstEngineObject_ *)(HIE_fn_hGetSuperObjectObject(hNewSuperObjPerso));
tdxHandleToFamilyList hFamily = fn_h3dDataGetFamily( p_stObject->h_3dData );
tdxHandleToState hState;
int i;
ACP_tdxBool bFound = FALSE;
LST2_M_StaticForEachElementOf(&hFamily->hForStateArray, hState, i)
{
if( hState == h_WantedState )
{
bFound = TRUE;
break;
}
}
if( !bFound )
{
char szMessage[256];
char *p_szPersoName;
if (p_stObject->h_Brain && p_stObject->h_Brain->p_stMind)
p_szPersoName = AI_M_szGetPersoName( p_stObject->h_Brain->p_stMind);
else
p_szPersoName = "**No Name**";
sprintf(
szMessage,
"Erreur dans un ChangeAction:\nl'action désirée (%s) n'appartient pas au perso %s.",
h_WantedState->szStateName, p_szPersoName );
SAF_M_AssertWithMsg( 0, szMessage );
}
}
#endif
if ( eProcedureId == eProc_ChangeActionWithEvents )
{
M_EvalNextParameter ( & stParam ) ;
bHandleSkippedEventsIfRelevant = M_GetSetParam_lValue ( & stParam ) ;
}
else
bHandleSkippedEventsIfRelevant = FALSE ;
if ( PLA_fn_bSetNewState ( hNewSuperObjPerso , h_WantedState , ( ACP_tdxBool ) ( eProcedureId == eProc_ChangeActionForce ) , bHandleSkippedEventsIfRelevant ) )
{
MS_tdxHandleToDynam h_Dynam = M_GetMSHandle(hNewSuperObjPerso,Dynam);
/*ANNECY END CHRISTOPHE MODIFICATIONS CF OLIVIER COUVREUR }*/
if ( h_Dynam )
{
struct DNM_stDynamics *p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam);
if ( p_stDynamics )
{
DNM_tdxHandleToMecIdentityCard hIdCard = fn_hGetStateMechanicsIdCard (h_WantedState);
if ( DNM_M_pDynamicsGetCurrentIdCard(p_stDynamics) != hIdCard )
{
DNM_fn_vChangeIdCard(p_stDynamics, hIdCard);
}
}
}
}
else
{
fn_vSetProcedureActionReturn(C_ACTION_ENGINE_STOP_RULE);
}
/*ANNECY jt {*/
/*ANNECY CHRISTOPHE MODIFICATIONS CF OLIVIER COUVREUR {*/
/* ANNECY MT - 22/09/98 {*/
/*fn_vUpdateCurrentActivationForCharacter(p_SuperObjPerso);*/
/* END ANNECY MT }*/
/*ENDANNECY jt }*/
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stChangeActionRandomProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
tdxHandleToState h_WantedState;
M_EvalNextParameter(&stParam);
h_WantedState=M_GetSetParam_ActionValue(&stParam);
if ( PLA_fn_bSetNewStateWithRandom(p_SuperObjPerso, h_WantedState) )
{
MS_tdxHandleToDynam h_Dynam = M_GetMSHandle(p_SuperObjPerso,Dynam);
/*ANNECY END CHRISTOPHE MODIFICATIONS CF OLIVIER COUVREUR }*/
if ( h_Dynam )
{
struct DNM_stDynamics *p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam);
if ( p_stDynamics )
{
DNM_tdxHandleToMecIdentityCard hIdCard = fn_hGetStateMechanicsIdCard (h_WantedState);
if ( DNM_M_pDynamicsGetCurrentIdCard(p_stDynamics) != hIdCard )
{
DNM_fn_vChangeIdCard(p_stDynamics, hIdCard);
}
}
}
}
else
{
fn_vSetProcedureActionReturn(C_ACTION_ENGINE_STOP_RULE);
}
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *fn_p_stDisplayProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
/* tdstGetSetParam stParam;*/
long lValue;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
switch(eProcedureId)
{
case eProc_DefaultDisplay :
lValue = HIE_fn_lGetSuperObjectDrawMask(hNewSuperObjPerso);
lValue = (lValue | GLI_C_lIsNotGrided);
fn_v3dDataSetDrawMask(M_GetMSHandle(hNewSuperObjPerso,3dData), lValue);
HIE_fn_vSetSuperObjectDrawMask(hNewSuperObjPerso, lValue);
break;
default:
break;
}
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT 08/06/99 { */
#ifdef U64
/* FQ FADE*/
/***********************************************************************************************************************/
void fn_vFadeIn(void);
void fn_vFadeOut(void);
tdstNodeInterpret *fn_p_stFadeProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=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(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);*/
/********************************************************************************/
switch(eProcedureId)
{
case eProc_FadeIn :
M_PrintfN64(("FadeIn triggered by AI\n"));
fn_vFadeIn();
break;
case eProc_FadeOut :
M_PrintfN64(("FadeOut triggered by AI\n"));
fn_vFadeOut();
break;
default:
break;
}
return(p_stTree);
}
/* END FQ FADE*/
#endif
#endif /* _AI_EXCLUDE_NEVER_USED_ } */
/**********************************************************************************
TRANSPARENCY PROCEDURES
************************************************************************************/
tdstNodeInterpret *fn_p_stTransparenceProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
MTH_tdxReal xValue;
long lValue;
long lMode;
ACP_tdxBool bModule= FALSE;
/********************************************************************************/
/* BEWARE THE ULTRA OPERATOR : Must be at the beginning and respect this syntax */
/********************************************************************************/
HIE_tdxHandleToSuperObject hNewSuperObjPerso;
HIE_tdxHandleToSuperObject hModule = NULL;
fn_vGetUltraOperatorPerso(fn_ucGetProcedureUltraOperator(eProcedureId),p_SuperObjPerso,&hNewSuperObjPerso);
/********************************************************************************/
M_EvalNextParameter(&stParam);
switch(eProcedureId)
{
case eProc_SetModuleTransparency:
case eProc_SetModuleTransparency2:
{
CHN_tdxHandleToChannelArray hChannelArray;
unsigned short uwChannelNumber;
/* Get a Channel parameter or a long parameter ?*/
if ( eProcedureId == eProc_SetModuleTransparency )
{
uwChannelNumber = (unsigned short) M_GetSetParam_lModuleValue(&stParam);
}
else
{
uwChannelNumber = (unsigned short) M_GetSetParam_lValue(&stParam);
}
M_EvalNextParameter(&stParam);
/* ANNECY AV DEMO {*/
#ifndef U64
#ifndef RETAIL
if (g_DEMO_KeybTest == DEMO_RECORD)
{
MTH_tdxReal xTransparencyValue = MTH_M_xMax (MTH_C_ZERO , MTH_M_xMin (MTH_M_xFloatToReal (255.0f) , M_GetSetParam_xValue (& stParam)));
DEMO_fn_vSaveModuleTransparencyValue (hNewSuperObjPerso , (unsigned char) uwChannelNumber , xTransparencyValue);
}
#endif /* RETAIL */
#endif
/* END ANNECY AV }*/
hChannelArray = fn_h3dDataGetChannelSOList(M_GetMSHandle(hNewSuperObjPerso, 3dData));
if (hChannelArray == NULL)
break;
else
{
hNewSuperObjPerso = fn_hGetSuperObjectInChannel(hChannelArray,uwChannelNumber);
if (hNewSuperObjPerso==NULL)
break;
}
HIE_fn_SO_vSetFlags(hNewSuperObjPerso, HIE_fn_SO_ulGetFlags(hNewSuperObjPerso) | HIE_C_Flag_ModuleTransparency);
}
case eProc_SetTransparency :
{
xValue = M_ReturnParam_xValue(&stParam);
if (MTH_M_bLessZero(xValue))
xValue = MTH_C_ZERO;
else
if (MTH_M_bGreater(xValue,MTH_M_xFloatToReal(255.0f)))
xValue = MTH_M_xFloatToReal(255.0f);
HIE_fn_vSetSuperObjectTransparenceLevel(hNewSuperObjPerso, xValue);
if (eProcedureId== eProc_SetTransparency)
{
//fn_v3dDataSetAnimMatrixHasChanged(M_GetMSHandle(hNewSuperObjPerso, 3dData));
/* for text-generated channels, there is no anim -> the player is not done -> we have to apply the tranparency ourselves */
/*if (fn_p_stGetAnimInState(fn_h3dDataGetCurrentState(M_GetMSHandle(hNewSuperObjPerso,3dData))) == NULL)
{
long i;
HIE_tdxHandleToSuperObject hCharacter;
HIE_M_ForEachChildOf(hNewSuperObjPerso,hCharacter,i)
{
if ((HIE_fn_SO_ulGetFlags(hCharacter) & HIE_C_Flag_ModuleTransparency) != HIE_C_Flag_ModuleTransparency)
{
HIE_fn_vSetSuperObjectTransparenceLevel(hCharacter, xValue);
}
}
}
else*/
PLA_fn_vUpdateTransparencyForModules(hNewSuperObjPerso);
}
}
break;
case eProc_ModuleTransparentDisplay:
case eProc_ModuleTransparentDisplay2:
{
CHN_tdxHandleToChannelArray hChannelArray;
unsigned short uwChannelNumber;
/* Get a Channel parameter or a long parameter ?*/
if ( eProcedureId == eProc_ModuleTransparentDisplay )
{
uwChannelNumber = (unsigned short) M_GetSetParam_lModuleValue(&stParam);
}
else
{
uwChannelNumber = (unsigned short) M_GetSetParam_lValue(&stParam);
}
M_EvalNextParameter(&stParam);
/* ANNECY AV DEMO {*/
#ifndef U64
#ifndef RETAIL
if (g_DEMO_KeybTest == DEMO_RECORD)
{
DEMO_fn_vSaveActivateModuleTransparency (hNewSuperObjPerso , (unsigned char) uwChannelNumber , M_GetSetParam_lValue (& stParam));
}
#endif /* RETAIL */
#endif
/* END ANNECY AV }*/
hChannelArray = fn_h3dDataGetChannelSOList(M_GetMSHandle(hNewSuperObjPerso, 3dData));
if (hChannelArray == NULL)
break;
else
{
hModule = fn_hGetSuperObjectInChannel(hChannelArray,uwChannelNumber);
if (hModule==NULL)
break;
}
bModule = TRUE;
}
case eProc_TransparentDisplay :
{
lValue = HIE_fn_lGetSuperObjectDrawMask(hNewSuperObjPerso);
lMode = M_GetSetParam_lValue(&stParam);
if (lMode)
{
lValue = (lValue & ~GLI_C_lIsNotGrided);
}
else
{
lValue = (lValue | GLI_C_lIsNotGrided);
if (bModule)
HIE_fn_SO_vSetFlags(hModule, HIE_fn_SO_ulGetFlags(hModule) & ~HIE_C_Flag_ModuleTransparency);
}
if (!bModule)
{
fn_v3dDataSetDrawMask(M_GetMSHandle(hNewSuperObjPerso,3dData), lValue);
HIE_fn_vSetSuperObjectDrawMask(hNewSuperObjPerso, lValue);
}
else
{
HIE_fn_vSetSuperObjectDrawMask(hModule, lValue);
}
}
break;
default:
break;
}
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stVisualGameMaterialProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
GMT_tdxHandleToGameMaterial hGameMaterial;
ACP_tdxHandleOfMaterial hVisualMaterial=NULL;
tdstNodeInterpret *p_stTreeOrg=p_stTree;
/* Oliv' - Portage v14*/
#ifndef CONST_VMT
GEO_tdstColor stColor;
long lValue=0;
#endif
/* EndOfOliv'*/
M_EvalNextParameter(&stParam);
hGameMaterial=M_GetSetParam_hGameMaterial(&stParam);
if (hGameMaterial!=NULL)
{
hVisualMaterial=GMT_fn_hGetVisualMaterial(hGameMaterial);
}
if (hVisualMaterial==NULL)
{
return(fn_p_stSwapNextParameter2(p_stTreeOrg));
}
switch(eProcedureId)
{
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_SetVisualGMTColor:
M_EvalNextParameter(&stParam);
#ifndef CONST_VMT
fn_vConvertParamToColor(&stParam,&stColor);
GLI_xSetMaterialColor(hVisualMaterial,&stColor);
#endif
return(p_stTree);
break;
case eProc_SetVisualGMTSpecularExponent:
M_EvalNextParameter(&stParam);
#ifndef CONST_VMT
GLI_xGetMaterialSpecularCoef(hVisualMaterial,&lValue,&stColor);
lValue=M_ReturnParam_lValue(&stParam);
GLI_xSetMaterialSpecularCoef(hVisualMaterial,lValue,&stColor) ;
#endif
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_SetVisualGMTSpecularCoef:
M_EvalNextParameter(&stParam);
#ifndef CONST_VMT
GLI_xGetMaterialSpecularCoef(hVisualMaterial,&lValue,&stColor);
fn_vConvertParamToColor(&stParam,&stColor);
GLI_xSetMaterialSpecularCoef(hVisualMaterial,lValue,&stColor) ;
#endif
return(p_stTree);
break;
case eProc_SetVisualGMTDiffuseCoef:
M_EvalNextParameter(&stParam);
#ifndef CONST_VMT
fn_vConvertParamToColor(&stParam,&stColor);
GLI_xSetMaterialDiffuseCoef(hVisualMaterial,&stColor) ;
#endif
return(p_stTree);
break;
case eProc_SetVisualGMTAmbientCoef:
M_EvalNextParameter(&stParam);
#ifndef CONST_VMT
fn_vConvertParamToColor(&stParam,&stColor);
GLI_xSetMaterialAmbientCoef(hVisualMaterial, &stColor) ;
#endif
return(p_stTree);
break;
case eProc_SetVisualGMTAsChromed:
M_EvalNextParameter(&stParam);
GLI_vSetMaterialAsChromed(hVisualMaterial, M_GetSetParam_lValue(&stParam));
return(p_stTree);
break;
case eProc_SetVisualGMTTextureScrollingCoef:
{
float fUSpeed,fVSpeed; /* % / 60Hz => si jeu dans la trame et 1, il ne se passe rien*/
M_EvalNextParameter(&stParam);
fUSpeed=MTH_M_xRealToFloat(M_ReturnParam_xValue(&stParam));
M_EvalNextParameter(&stParam);
fVSpeed=MTH_M_xRealToFloat(M_ReturnParam_xValue(&stParam));
GLI_xSetMaterialTextureScrollingCoef(hVisualMaterial, 0 /* UNUSED_FOR_THE_MOMENT */ , 1 , fUSpeed , fVSpeed) ;
}
return(p_stTree);
break;
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
case eProc_LockVisualGMT:
M_EvalNextParameter(&stParam);
GLI_vLockAnimatedTexture(hVisualMaterial);
return(p_stTree);
break;
case eProc_UnlockVisualGMT:
GLI_vUnLockAnimatedTexture(hVisualMaterial);
return(p_stTree);
break;
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
case eProc_SetVisualGMTFrame:
M_EvalNextParameter(&stParam);
/*GMT_fn_vSetCurrentFrameOfAnimatedTexturesFromGameMaterial(hGameMaterial, M_ReturnParam_lValue(&stParam));*/
GLI_vSetCurrentAnimatedTextureNumber(hVisualMaterial,M_ReturnParam_lValue(&stParam));
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/***********************************************************************************************************************/
/***********************************************************************************************************************/
tdstNodeInterpret *fn_p_stMenuAndVignetteProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
char *p_szString;
switch(eProcedureId)
{
case eProc_DisplayVignette:
M_EvalNextParameter(&stParam);
p_szString = fn_szGetStringFromTextOrStringParam(&stParam);
#ifndef _FIRE_DEADCODE_U64_
fn_vAskToDisplayVignette(p_szString);
#endif
return(p_stTree);
break ;
case eProc_DeleteVignette:
#ifndef _FIRE_DEADCODE_U64_
fn_vAskToDisplayVignette(NULL);
#endif
return(p_stTree);
break ;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/*ANNECY VL 26/11/97{*/
/*
----------------------------------------------------------------------------------------
Description : add a foot print in perso footpath.
Input : CONSTANT_PARAM -> type of foot print (0 : left, 1 : right )
----------------------------------------------------------------------------------------
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdstNodeInterpret *fn_p_st_FootPath_AddFootPrint(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstGetSetParam stParam;
ACP_tdxIndex lFPType;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
M_EvalNextParameter(&stParam);
lFPType = (ACP_tdxIndex) M_GetSetParam_lValue(&stParam);
fn_v_FootPath_Add( p_SuperObjPerso, lFPType );
return(p_stTree);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
----------------------------------------------------------------------------------------
Description : add a foot print in perso footpath.
Input : CONSTANT_PARAM -> type of foot print (0 : left, 1 : right )
----------------------------------------------------------------------------------------
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
#ifndef D_THROW_PRT
tdstNodeInterpret *fn_p_st_FootPath_Clear(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
MS_tdxHandleToMSPrtSrc hMSPrtSrc;
GAM_tdxHandleToFootPathEffect hFootPath;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* retrieve footpath information */
hMSPrtSrc = M_GetMSHandle(p_SuperObjPerso,MSPrtSrc);
if (hMSPrtSrc != NULL)
{
hFootPath = fn_hMSPrtSrcGetFootPath( hMSPrtSrc );
if (hFootPath != NULL)
fn_v_FootPath_ReInit( hFootPath );
}
return(p_stTree);
}
#endif /* D_THROW_PRT */
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
----------------------------------------------------------------------------------------
Description : change sinus effect ferquence
Input : CONSTANT_PARAM -> X Frequence
CONSTANT_PARAM -> Y Frequence
----------------------------------------------------------------------------------------
*/
tdstNodeInterpret *fn_p_st_SinusEffect_SetFreq(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
long lXFreq, lYFreq, lZFreq;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
M_EvalNextParameter(&stParam);
lXFreq = (ACP_tdxIndex) M_GetSetParam_lValue(&stParam);
M_EvalNextParameter(&stParam);
lYFreq = (ACP_tdxIndex) M_GetSetParam_lValue(&stParam);
lZFreq = 0 ;
if ( eProcedureId == eProc_SinEffect_SetFreq3D ) {
M_EvalNextParameter(&stParam);
lZFreq = (ACP_tdxIndex) M_GetSetParam_lValue(&stParam);
}
GLI_fn_SinusEffect_vSetFreq( lXFreq, lYFreq, lZFreq );
return(p_stTree);
}
/*
----------------------------------------------------------------------------------------
Description : change amlpitude of sinus effect
Input : VECTOR_PARAM -> new amplitude
----------------------------------------------------------------------------------------
*/
tdstNodeInterpret *fn_p_st_SinusEffect_SetAmplitude(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstGetSetParam stParam;
MTH3D_tdstVector *p_stAmp ;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
M_EvalNextParameter(&stParam);
p_stAmp = &M_GetSetParam_stVertexValue(&stParam) ;
p_stAmp->xX = MTH_M_xMul( p_stAmp->xX, 0.1f) ;
p_stAmp->xY = MTH_M_xMul( p_stAmp->xY, 0.1f) ;
p_stAmp->xZ = MTH_M_xMul( p_stAmp->xZ, 0.1f) ;
GLI_fn_SinusEffect_vSetAmplitude( p_stAmp );
return(p_stTree);
}
/*
----------------------------------------------------------------------------------------
Description : change amlpitude of sinus effect
Input : VECTOR_PARAM -> new amplitude
----------------------------------------------------------------------------------------
*/
tdstNodeInterpret *fn_p_st_SinusEffect_SetRLIParams(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
MTH_tdxReal xRed, xGreen, xBlue ;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
M_EvalNextParameter(&stParam) ;
xRed = M_GetSetParam_xValue(&stParam) ;
M_EvalNextParameter(&stParam) ;
xGreen = M_GetSetParam_xValue(&stParam) ;
M_EvalNextParameter(&stParam) ;
xBlue = M_GetSetParam_xValue(&stParam) ;
if ( eProcedureId == eProc_SinEffect_SetRLIBase ) {
GLI_vSetSinusEffectOnRLIBase(xRed, xGreen, xBlue) ;
}
else if ( eProcedureId == eProc_SinEffect_SetRLIAmplitude) {
GLI_vSetSinusEffectOnRLIAmp(xRed, xGreen, xBlue) ;
}
return(p_stTree);
}
/*
----------------------------------------------------------------------------------------
Description : change sinus effect ferquence
Input : CONSTANT_PARAM -> X Frequence
CONSTANT_PARAM -> Y Frequence
----------------------------------------------------------------------------------------
*/
tdstNodeInterpret *fn_p_st_SinusEffect_SetState(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstGetSetParam stParam;
char cState;
char cFlag;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
M_EvalNextParameter(&stParam);
cState = (ACP_tdxIndex) M_GetSetParam_lValue(&stParam);
if (cState < 64)
GLI_fn_SinusEffect_vSetState( cState );
else
{
cFlag = GLI_fn_SinusEffect_vGetFlag();
switch (cState)
{
case 64: cFlag &= ~C_SinusEffect_cAffectSecondViewPort; break;
case 65: cFlag |= C_SinusEffect_cAffectSecondViewPort; break;
case 66: cFlag &= ~C_SinusEffect_cUseZFactor; break;
case 67: cFlag |= C_SinusEffect_cUseZFactor; break;
}
GLI_fn_SinusEffect_vSetFlag( cFlag );
}
return(p_stTree);
}
/*
----------------------------------------------------------------------------------------
Description : IA function to change Draw mask flag
Parameters
USE_SUPEROBJECT_PARAM : super object to change flag to
USE_CONSTANT_PARAM : bit to change
USE_CONSTANT_PARAM : type of operation
0 : set bit to 0
1 : set bit to 1
2 : inverse bit
others : no change
----------------------------------------------------------------------------------------
*/
tdstNodeInterpret *fn_p_st_SPO_SetDrawFlag(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstGetSetParam stParam;
HIE_tdxHandleToSuperObject hSpo;
long lBit;
long lMask;
long lType;
long lDrawMask;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* get the function parameters*/
M_EvalNextParameter(&stParam);
hSpo=M_GetSetParam_SuperObjectValue(&stParam);
M_EvalNextParameter(&stParam);
lBit = M_GetSetParam_lValue(&stParam);
M_EvalNextParameter(&stParam);
lType = M_GetSetParam_lValue(&stParam);
if ( (hSpo != NULL) && (lBit >= 0) && (lBit <= 31 ) )
{
lMask = 1 << lBit;
/* get super object parameters*/
/*lReturnedDrawMask = (HIE_fn_lGetSuperObjectDrawMask( hSpo ) & lMask) ? 1 : 0;*/
lDrawMask = HIE_fn_lGetSuperObjectDrawMask( hSpo );
if (lType == 2)
lType = (lDrawMask & lMask) ? 0 : 1;
switch (lType )
{
case 0: /* set all bit to 0 */
lDrawMask &= ~lMask;
break;
case 1: /* set all bit to 1 */
lDrawMask |= lMask;
break;
default:
break;
}
HIE_fn_vSetSuperObjectDrawMask( hSpo, lDrawMask );
}
return(p_stTree);
}
/*
----------------------------------------------------------------------------------------
Description : IA function to change Engine display mode flag
Parameters
USE_CONSTANT_PARAM : bit to change
USE_CONSTANT_PARAM : type of operation
0 : set bit to 0
1 : set bit to 1
2 : inverse bit
others : no change
----------------------------------------------------------------------------------------
*/
#if !defined(_AI_EXCLUDE_NEVER_USED_) /* MT {*/
tdstNodeInterpret *fn_p_st_SPO_SetEngineDisplayModeFlag(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstGetSetParam stParam;
long lBit;
long lMask;
long lType;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* get the function parameters*/
M_EvalNextParameter(&stParam);
lBit = M_GetSetParam_lValue(&stParam);
M_EvalNextParameter(&stParam);
lType = M_GetSetParam_lValue(&stParam);
if ( (lBit >= 0) && (lBit <= 31 ) )
{
lMask = 1 << lBit;
if (lType == 2)
lType = (g_stEngineStructure.ulDisplayMode & lMask) ? 0 : 1;
switch (lType )
{
case 0: /* set all bit to 0 */
g_stEngineStructure.ulDisplayMode &= ~lMask;
break;
case 1: /* set all bit to 1 */
g_stEngineStructure.ulDisplayMode |= lMask;
break;
default:
break;
}
}
return(p_stTree);
}
#endif /* _AI_EXCLUDE_NEVER_USED_ }*/
/*
----------------------------------------------------------------------------------------
Description : IA function to change Draw mask flag of a character
Parameters
USE_PERSO_CONSTANT_PARAM: character to change flag to
USE_CONSTANT_PARAM : bit to change
USE_CONSTANT_PARAM : type of operation
0 : set bit to 0
1 : set bit to 1
2 : inverse bit
others : no change
----------------------------------------------------------------------------------------
*/
tdstNodeInterpret *fn_p_st_ACT_SetDrawFlag(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstGetSetParam stParam;
HIE_tdxHandleToSuperObject hCharact;
long lBit;
long lMask;
long lType;
long lDrawMask;
MS_tdxHandleTo3dData h3dData;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* get the function parameters*/
M_EvalNextParameter(&stParam);
hCharact = M_GetSetParam_p_stSupObjValue(&stParam);
M_EvalNextParameter(&stParam);
lBit = M_GetSetParam_lValue(&stParam);
M_EvalNextParameter(&stParam);
lType = M_GetSetParam_lValue(&stParam);
if ( (hCharact != NULL) && (lBit >= 0) && (lBit <= 31 ) )
{
h3dData = M_GetMSHandle(hCharact,3dData);
lMask = 1 << lBit;
/* get super object parameters*/
/*lReturnedDrawMask = (HIE_fn_lGetSuperObjectDrawMask( hSpo ) & lMask) ? 1 : 0;*/
lDrawMask = fn_l3dDataGetDrawMask( h3dData );
if (lType == 2)
lType = (lDrawMask & lMask) ? 0 : 1;
switch (lType )
{
case 0: /* set all bit to 0 */
lDrawMask &= ~lMask;
break;
case 1: /* set all bit to 1 */
lDrawMask |= lMask;
break;
default:
break;
}
HIE_fn_vSetSuperObjectDrawMask( hCharact, lDrawMask );
fn_v3dDataSetDrawMask(h3dData, lDrawMask );
}
return(p_stTree);
}
/*ENDANNECY VL }*/
#define GlobalLoopMax 50
int GlobalLoopCpt[GlobalLoopMax];
tdstNodeInterpret *GlobalLoopTree[GlobalLoopMax];
tdstNodeInterpret *GlobalLoopInit[GlobalLoopMax];
#ifdef __cplusplus
extern "C"
{
#endif
int iNumLoop = 0; /* used in GAM, so we must declare it as a C variable!*/
#ifdef __cplusplus
}
#endif
/*int iNumLoop = 0;*/
tdstNodeInterpret *fn_p_stSkipLoop(tdstNodeInterpret *p_stTreeInit)
{
register int iLevel = 0;
register tdstNodeInterpret *p_stTree = 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
{
#endif
while( !M_IsTheEndOfTree(p_stTree) )
{
if ( M_GetTypeInterpret(p_stTree) == E_ti_Procedure )
{
if ( M_eProcedureIdInterpret(p_stTree) == eKeyWord_Boucle )
{
iLevel ++;
}
else if ( M_eProcedureIdInterpret(p_stTree) == eKeyWord_FinBoucle )
{
iLevel --;
if(iLevel <= 0)
{
p_stTree ++;
break;
}
}
}
p_stTree ++;
}
#if defined(OPTIMIZE_SWAP_PARAMETER)
M_NodeToSkip(p_stTreeInit)=(unsigned short) (p_stTree-p_stTreeInit);
}
#endif /* OPTIMIZE_SWAP_PARAMETER*/
return p_stTree;
}
tdstNodeInterpret *fn_p_stLoopKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstNodeInterpret *p_stTreeInit = p_stTree-1;
tdstGetSetParam stValue;
SAF_M_AssertWithMsg(iNumLoop < GlobalLoopMax," vous avez plus de 50 boucles imbriquees dans l'IA...\nle moteur a ete limite a 50 !");
GlobalLoopInit[iNumLoop] = p_stTreeInit; /* Remember tree for loop node */
M_EvalNextParameter(&stValue);
GlobalLoopCpt[iNumLoop] = M_GetSetParam_lValue(&stValue);
if(GlobalLoopCpt[iNumLoop] == 0)
return fn_p_stSkipLoop(p_stTreeInit);
GlobalLoopTree[iNumLoop] = p_stTree;
iNumLoop++;
return p_stTree;
}
tdstNodeInterpret *fn_p_stEndLoopKeyWord(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
if(iNumLoop == 0)
return p_stTree;
GlobalLoopCpt[iNumLoop - 1]--;
if(GlobalLoopCpt[iNumLoop - 1] > 0)
return GlobalLoopTree[iNumLoop - 1];
iNumLoop--;
return p_stTree;
}
tdstNodeInterpret *fn_p_stBreakKeyword(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stValue;
long lValue;
M_EvalNextParameter(&stValue);
lValue = M_GetSetParam_lValue(&stValue);
if(lValue > iNumLoop - 1)
lValue = iNumLoop - 1;
p_stTree = fn_p_stSkipLoop(GlobalLoopInit[iNumLoop - lValue - 1]);
iNumLoop -= (lValue + 1);
return p_stTree;
}
/*********************************************************/
/* DUMMY PROCEDURE FOR N64*/
/*********************************************************/
/* FQ IAenC*/
tdstNodeInterpret *fn_p_stDummy(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
#ifdef U64
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
M_PrintfStopErrorN64(("ProcedureDummy %d, spo=0x%x!!", eProcedureId, p_SuperObjPerso));
#endif /* U64 */
return(p_stTree);
}
/*/////////////////////////////////////////////////////////////////////////////////////*/
/* Animations Graphiques Optimisées*/
/*/////////////////////////////////////////////////////////////////////////////////////*/
/* #define AGO_VERBOSE*/
tdstNodeInterpret *fn_p_stAGOProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
GMT_tdxHandleToGameMaterial hGameMaterial;
ACP_tdxHandleOfMaterial hVisualMaterial=NULL;
MTH3D_tdstVector *p_stPosition, *p_stDirection;
MTH3D_tdstVector stPosition, stDirection;
unsigned long PartType;
MTH_tdxReal xParameter;
switch(eProcedureId)
{
case eProc_LaunchAGO:
/* Launches a simple particle instead of generating an always*/
/* for clouds, weapons fake particles, etc...*/
M_EvalNextParameter(&stParam); /* Particle type*/
PartType=M_GetSetParam_ulValue(&stParam);
/*//////////////////////////////////////////////////////////////////*/
M_EvalNextParameter(&stParam); /* Position*/
p_stPosition = &M_GetSetParam_stVertexValue(&stParam);
stPosition.xX=p_stPosition->xX;
stPosition.xY=p_stPosition->xY;
stPosition.xZ=p_stPosition->xZ;
/*//////////////////////////////////////////////////////////////////*/
M_EvalNextParameter(&stParam); /* Initial Direction*/
p_stDirection = &M_GetSetParam_stVertexValue(&stParam);
stDirection.xX=p_stDirection->xX;
stDirection.xY=p_stDirection->xY;
stDirection.xZ=p_stDirection->xZ;
/*//////////////////////////////////////////////////////////////////*/
M_EvalNextParameter(&stParam); /* Game Material*/
hGameMaterial=M_GetSetParam_hGameMaterial(&stParam);
hVisualMaterial=NULL;
if (hGameMaterial!=NULL)
{
hVisualMaterial=GMT_fn_hGetVisualMaterial(hGameMaterial);
}
/*///////////////////////////////////////////////////////////////////*/
M_EvalNextParameter(&stParam); /* Optional Real Parameter*/
xParameter = M_ReturnParam_xValue(&stParam);
/*///////////////////////////////////////////////////////////////////*/
#ifdef AGO_VERBOSE
osSyncPrintf("Called eProc_LaunchAGO :\n");
osSyncPrintf("\t%lu\n",PartType);
osSyncPrintf("\t%f %f %f\n",stPosition.xX,stPosition.xY, stPosition.xZ);
osSyncPrintf("\t%f %f %f\n",stDirection.xX,stDirection.xY, stDirection.xZ);
osSyncPrintf("\t%p\n",hVisualMaterial);
osSyncPrintf("\t%f\n",xParameter);
#endif
AGO_vAddParticle(PartType,&stPosition,&stDirection,hVisualMaterial,xParameter);
#ifndef U64
#ifndef RETAIL
DEMO_fn_vSaveGenerateAGO(PartType,&stPosition,&stDirection,hGameMaterial,xParameter);
#endif /* RETAIL */
#endif
return(p_stTree);
break ;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/*
Note pour l'equipe PC : Sur N64, lorsqu'on est en menu "InGame",
on n'affiche plus la map, ni les persos (sauf ceux qui ont le Custom Bit 21)...
Cependant, je ne peux pas utiliser g_stEngineStructure.bEngineFrozen, car
le menu principal utilise une map spécifique en "toile de fond", avec quelques persos...
Donc maintenant, le designer des menus, pourra me dire de ne pas afficher la map et les persos
grace à cette fonction...
Le code dans SCT\Sectdraw.c correspondant à la suppression de l'affichage de la map et des persos
est, pour l'instant, entre #ifdef U64... Il faudra certainement le mettre sur PC aussi pour que le
designer s'y retrouve ;-)
*/
#ifdef __cplusplus
extern "C"
{
#endif
ACP_tdxBool g_bInGameMenu=FALSE;
#ifdef __cplusplus
}
#endif
tdstNodeInterpret *fn_p_stInGameMenuProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
switch(eProcedureId)
{
case eProc_SetInGameMenu:
M_EvalNextParameter(&stParam);
if (M_GetSetParam_ulValue(&stParam)) g_bInGameMenu=TRUE; else g_bInGameMenu=FALSE;
return(p_stTree);
break ;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
/*
New : Texts without always generation
*/
#ifdef __cplusplus
extern "C"
{
#endif
void JFFTXT_vAddText(int StringNumber, MTH3D_tdstVector *p_stPosition, char *pszString, float xParameter);
void JFFTXT_vExtendText(int StringNumber, int ID, float xParameter);
void JFFTXT_vModifyCaracter(int StringNumber, int Position, int newcar);
#ifdef __cplusplus
}
#endif
tdstNodeInterpret *fn_p_stJFFTXTProcedure(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
enum tdeProcedureId_ eProcedureId=M_eProcedureIdInterpret(p_stTree-1);
tdstGetSetParam stParam;
int StringNumber;
MTH3D_tdstVector *p_stPosition;
MTH3D_tdstVector stPosition;
float xParameter;
int ID;
char *pszString;
switch(eProcedureId)
{
case eProc_JffTxt_Affiche:
M_EvalNextParameter(&stParam);
StringNumber=M_GetSetParam_ulValue(&stParam);
M_EvalNextParameter(&stParam); /* Position*/
p_stPosition = &M_GetSetParam_stVertexValue(&stParam);
stPosition.xX=p_stPosition->xX;
stPosition.xY=p_stPosition->xY;
stPosition.xZ=p_stPosition->xZ;
M_EvalNextParameter(&stParam);
pszString = (char *)fn_szGetStringFromTextOrStringParam(&stParam);
M_EvalNextParameter(&stParam);
xParameter = M_ReturnParam_xValue(&stParam);
JFFTXT_vAddText( StringNumber, &stPosition, pszString, xParameter);
return(p_stTree);
break ;
case eProc_JffTxt_Extend:
M_EvalNextParameter(&stParam);
StringNumber=M_GetSetParam_ulValue(&stParam);
M_EvalNextParameter(&stParam);
ID=M_GetSetParam_ulValue(&stParam);
M_EvalNextParameter(&stParam);
xParameter = M_ReturnParam_xValue(&stParam);
JFFTXT_vExtendText( StringNumber, ID, xParameter);
return(p_stTree);
break ;
case eProc_JffTxt_Modify:
{
int Position;
int NewCar;
M_EvalNextParameter(&stParam);
StringNumber=M_GetSetParam_ulValue(&stParam);
M_EvalNextParameter(&stParam);
Position=M_GetSetParam_ulValue(&stParam);
M_EvalNextParameter(&stParam);
NewCar=M_GetSetParam_ulValue(&stParam);
JFFTXT_vModifyCaracter(StringNumber,Position,NewCar);
}
return(p_stTree);
break;
default:
break;
}
#if defined(__DEBUG_AI__) || (defined(U64) && defined(D_CHECK_AI_FPCO))
M_AIFatalError(E_uwAIFatalNotValidProcedure);
#endif
return(p_stTree);
}
tdstNodeInterpret *fn_p_stHUDSetLumsCount(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
int iNumLums, iMaxLums;
M_EvalNextParameter(&stParam);
iNumLums = M_GetSetParam_ulValue(&stParam);
M_EvalNextParameter(&stParam);
iMaxLums = M_GetSetParam_ulValue(&stParam);
#if defined(NITRO)
HUD_SetLumsCount(iNumLums, iMaxLums);
#endif
return (p_stTree);
}
tdstNodeInterpret *fn_p_stHUDSetCagesCount(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
int iNumCages, iMaxCages;
M_EvalNextParameter(&stParam);
iNumCages = M_GetSetParam_ulValue(&stParam);
M_EvalNextParameter(&stParam);
iMaxCages = M_GetSetParam_ulValue(&stParam);
#if defined(NITRO)
HUD_SetCagesCount(iNumCages, iMaxCages);
#endif
return (p_stTree);
}
tdstNodeInterpret *fn_p_stHUDSetHealthGauge(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
MTH_tdxReal xHealth, xHealthMax, xTransparency;
M_EvalNextParameter(&stParam);
xHealth = M_GetSetParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
xHealthMax = M_GetSetParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
xTransparency = M_GetSetParam_xValue(&stParam);
#if defined(NITRO)
HUD_SetPlayerHealth(xHealth, xHealthMax);
#endif
return (p_stTree);
}
tdstNodeInterpret *fn_p_stHUDSetSwimGauge(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
MTH_tdxReal xBreath, xTransparency;
M_EvalNextParameter(&stParam);
xBreath = M_GetSetParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
xTransparency = M_GetSetParam_xValue(&stParam);
#if defined(NITRO)
HUD_SetPlayerBreath(xBreath);
#endif
return (p_stTree);
}
tdstNodeInterpret *fn_p_stHUDSetEnemyHealthGauge(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
MTH_tdxReal xHealth, xTransparency;
int iIconIndex;
M_EvalNextParameter(&stParam);
xHealth = M_GetSetParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
xTransparency = M_GetSetParam_xValue(&stParam);
M_EvalNextParameter(&stParam);
iIconIndex = M_GetSetParam_lValue(&stParam);
#if defined(NITRO)
HUD_SetEnemyHealth(xHealth, xTransparency);
#endif
return (p_stTree);
}
tdstNodeInterpret *fn_vDoCheatMenu(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
// Dummy for editor
return p_stTree;
}
tdstNodeInterpret *fn_vSetBacklight(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
tdstGetSetParam stParam;
int iWhichLight, iOnOff;
M_EvalNextParameter(&stParam);
iWhichLight = M_GetSetParam_lValue(&stParam);
M_EvalNextParameter(&stParam);
iOnOff = M_GetSetParam_lValue(&stParam);
return p_stTree;
}
tdstNodeInterpret *fn_vBeginAnalogCalibration(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
return p_stTree;
}
tdstNodeInterpret *fn_vEndAnalogCalibration(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
return p_stTree;
}
/************************************************************************************************************************************************/
/*KWN : begin***********************************************************************************************************************************************/
tdstNodeInterpret *fn_p_SetScreenDSActif (HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree)
{
return p_stTree;
}
/*KWN : End***********************************************************************************************************************************************/
/************************************************************************************************************************************************/
/************************************************************************************/
/* HERE IS THE END */
/************************************************************************************/
/****************************************************************************************/
/* to call once before anything else related to Procedure */
/****************************************************************************************/
#if !defined(OPTIMIZED_COMMAND)
#include "ProtProc.h"
void fn_vInitProcedureEntries(void)
{
/* Init*/
#if defined(__DEBUG_AI__)
fn_vInitProcedureTable(fn_p_stDefaultProcedure);
#endif /* __DEBUG_AI__*/
/* Procedure definitions*/
#define M_DEFINE_PROCEDURE(a,b,english,c,d,e,f) \
fn_vDefineProcedureEntry(M_PROCEDURE_ENTRY(a,b,english,c,d,e)); \
fn_vSetProcedureUltraOperator(a,f);
#include "DefProc.h"
#undef M_DEFINE_PROCEDURE
/* Check*/
#if defined(__DEBUG_AI__)
fn_vCheckProcedureTable(fn_p_stDefaultProcedure);
#endif /* __DEBUG_AI__*/
}
#endif /* OPTIMIZED_COMMAND*/