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

301 lines
9.3 KiB
C

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