/*=========================================================================
* MSPrtSrc.h : MSPrtSrc's functions
*
*
*         MSPrtSrc MUST BE REPLACE BY THE HEADER FILENAME
*
*
* Version              1.0
* Creation date        01/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
 
#ifndef D_THROW_PRT
 
#if !defined(__MSPrtSrc_H__)
#define __MSPrtSrc_H__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000*/
/******************************************/
 
struct tdstEngineObject_;
#include "GAM/Header.h"
 
#include "GAM/InitEnum.h"
#undef EXTERN
#undef extern
#if !defined(D_MSPrtSrc_VariableDefine)
#define EXTERN extern
#else
#define EXTERN
#endif /* D_MSPrtSrc_VariableDefine */
 
/*--------------------------------------------------------------------
 * Environment masks
 *--------------------------------------------------------------------*/
#define C_lAllEnvironments       0xFFFFFFFF
#define C_lEnvironmentWater      1
#define C_lEnvironmentAir        2
 
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
 
#if defined(D_MSPrtSrc_StructureDefine)
 
/*--------------------------------------------------------------------
 * Structures definitions
 *--------------------------------------------------------------------*/
typedef struct tdstParticleGenerator_
{
   PRT_tdstParticlesSource *        p_stPrtSrc;
   PRT_tdstParticlesSystem *        p_stPrtSys;
   PRT_tdstParticlesEnvironment *   p_stPrtEnv;
   long                             lEnvironmentMask;
   MTH3D_tdstVector                 stMinPoint;
   MTH3D_tdstVector                 stMaxPoint;
   unsigned char                    ucLinkedToEnvironment;
 
	/*ANNECY VL PRT 18/03/98{*/
	unsigned long					ulLinkedPrtGenMask;
	struct tdstParticleGenerator_	*p_stLinkedPrtGen;
	/*ENDANNECY VL}*/
 
} tdstParticleGenerator;
 
struct tdstMSPrtSrc_
{
   tdstParticleGenerator *          p_stParticleGenerator;
   /* Add on for water streak actualisation */
   GAM_tdxHandleToWaterStreakEffect hWaterStreakGenerator;
   unsigned char                    ucGeneratorActivation;
   unsigned char                    ucCanGenerate;
   /*ANNECY VL 25/11/97{*/
   /* add on for footpath effect*/
   GAM_tdxHandleToFootPathEffect	hFootPath;
   /*ENDANNECY VL }*/
 
};
 
#endif /* D_MSPrtSrc_StructureDefine */
 
/***********************/
/**** Handle define ****/
/***********************/
typedef struct tdstMSPrtSrc_ * MS_tdxHandleToMSPrtSrc;
/*--------------------------------------------------------------------
 * MSPrtSrc scripts 
 *--------------------------------------------------------------------*/
#define C_SectionMSPrtSrcDescription            "MSPrtSrc"
 
#define C_EntryMSPrtSrcGeneratorActivation      "GeneratorActivation"
#define C_EntryMSPrtSrcParticleGenerator        "ParticleGenerator"
#define C_EntryMSPrtSrcWaterStreakGenerator     "WaterStreakGenerator"
/*ANNECY VL 25/11/97{*/
#define C_EntryMSPrtSrcFootPathGenerator		"FootPathEffect"
/*ENDANNECY VL }*/
 
/*--------------------------------------------------------------------
 * Particle Generator scripts 
 *--------------------------------------------------------------------*/
#define C_SectionParticleGenerator              "ParticleGenerator"
 
#define C_EntryPrtGenLinkedToEnvironment        "LinkedToEnvironment"
#define C_EntryPrtGenEnvironmentMask			"EnvironmentMask"
#define C_EntryPrtGenLoadParticleSystem         "LoadParticleSystem"
#define C_EntryPrtGenLoadParticleEnvironment    "LoadParticleEnvironment"
#define C_EntryPrtGenLoadParticleSource		    "LoadParticleSource"
/*ANNECY VL PRT 18/03/98{*/
#define C_EntryPrtGenLinkedPrtGenMask			"LinkedPrtGenMask"
#define C_EntryPrtGenLinkedPrtGen				"LinkedPrtGen"
/*ENDANNECY VL}*/
 
#define C_szLinkedToEnvironment					"Yes"
#define C_szNotLinkedToEnvironment				"No"
/*--------------------------------------------------------------------
 * Particle Source scripts 
 *--------------------------------------------------------------------*/
#define C_SectionParticleSource					"PrtSrc"
 
#define C_EntryPrtSrcGenerationMode             "GenerationMode"
#define C_EntryPrtSrcGenerationProbability      "GenerationProbability"
#define C_EntryPrtSrcCrenelGeneration           "CrenelGeneration"
#define C_EntryPrtSrcNbParticlesToGenerateMode  "NbParticlesToGenerateMode"
#define C_EntryPrtSrcNbParticlesToGenerate      "NbParticlesToGenerate"
#define C_EntryPrtSrcNbMinMax                   "NbMinMax"
#define C_EntryPrtSrcGeometryMode               "GeometryMode"
#define C_EntryPrtSrcQuad                       "Quad"
#define C_EntryPrtSrcPoint                       "Point"
#define C_EntryPrtSrcLinkMode                   "LinkMode"
#define C_EntryPrtSrcSpeedAndRange              "SpeedAndRange"
/* JO 10/12/97*/
#define C_EntryPrtSrcNoLifeTime						"NoLifeTime"
#define C_EntryPrtSrcConstantLifeTime				"ConstantLifeTime"
#define C_EntryPrtSrcProbabilistLifeTime			"ProbabilistLifeTime"
 
#define C_szNoGeneration						"NoGeneration"
#define C_szContinuousGeneration				"ContinuousGeneration"
#define C_szProbabilistGeneration				"ProbabilistGeneration"
#define C_szCrenelGeneration					"CrenelGeneration"
#define C_szConstantNb							"ConstantNb"
#define C_szProbabilistNb						"ProbabilistNb"
#define C_szPoint								"Point"
#define C_szQuad								"Quad"
#define C_szRotationLink						"RotationLink"
#define C_szTranslationLink						"TranslationLink"
#define C_szRotationAndTranslationLink			"RotationAndTranslationLink"
/*--------------------------------------------------------------------
 * Particle System scripts 
 *--------------------------------------------------------------------*/
#define C_SectionPrtSysDescription                 "PrtSys"
 
#define C_EntryPrtSysCreatePoint                   "CreatePoint"
#define C_EntryPrtSysCreateSegment                 "CreateSegment"
#define C_EntryPrtSysCreateSprite                  "CreateSprite"
/*--------------------------------------------------------------------
 * Particle Environment scripts 
 *--------------------------------------------------------------------*/
#define C_SectionPrtEnvDescription                 "PrtEnv"
 
#define C_EntryPrtEnvType                          "Type"
#define C_EntryPrtEnvMinMaxPoint                   "MinMaxPoint"
#define C_EntryPrtEnvSphere                        "Sphere"
#define C_EntryPrtEnvAcceleration                  "Acceleration"
 
#define C_szAlignedBox							   "AlignedBox"
#define C_szSphere								   "Sphere"
/*ANNECY VL 25/11/97{*/
/*--------------------------------------------------------------------
 * FootPath effect scripts 
 *--------------------------------------------------------------------*/
#define C_szSectionFootPathEffectDescription        "FootPathEffect"
#define C_szEntryNumberOfAlphaLevels				"NumberOfAlphaLevels"
#define C_szEntryNumberOfPointsByAlpha				"NumberOfPointsByAlpha"
#define C_szEntryAlpha								"AlphaColor"
#define C_szEntryFootPrintOffsets					"FootPrintOffsets"
#define C_szEntryFootPrintGameMaterial				"FootPrintGameMaterial"
#define C_szEntryFootPrintDimension					"FootPrintDimension"
#define C_szEntryMaterialMask						"MaterialMask"
/*ENDANNECY VL }*/
 
/*--------------------------------------------------------------------
 *
 *--------------------------------------------------------------------*/
 
/**** Put here all globals variables : ****/
/****    EXTERN typeofvar  variable;   ****/
 
/*******************************/
/**** Base functions define ****/
/*******************************/
#if !defined(U64)
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_eMSPrtSrcScriptCallback(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_ePrtSysScriptCallback(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_ePrtEnvScriptCallback(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_ePrtGeneratorScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_ePrtSrcScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
/*ANNECY VL 25/11/97{*/
extern CPA_EXPORT SCR_tde_Anl_ReturnValue fn_eFootPathScriptCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action	_eAction);
/*ENDANNECY VL }*/
#endif /* U64 */
/*extern CPA_EXPORT void fn_vMSPrtSrcSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject);*/
extern CPA_EXPORT unsigned long fn_ulMSPrtSrcSizeOf();
extern CPA_EXPORT void fn_vMSPrtSrcAlloc(struct tdstEngineObject_ *p_stObject);
extern CPA_EXPORT MS_tdxHandleToMSPrtSrc fn_h_MSPrtSrcRealAlloc();
extern CPA_EXPORT void fn_vMSPrtSrcFree(struct tdstEngineObject_ *p_stObject);
extern CPA_EXPORT void fn_vMSPrtSrcInit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit);
extern CPA_EXPORT void fn_vMSPrtSrcDesinit(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjectInit);
extern CPA_EXPORT void fn_vMSPrtSrcCopyClone(struct tdstEngineObject_ * _p_stObjectDest,struct tdstEngineObject_ * _p_stObjectSrc);
/*********************************/
/**** Access functions define ****/
/*********************************/
extern CPA_EXPORT tdxHandleToParticleGenerator fn_p_stMSPrtSrcGetGenerator(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_p_stMSPrtSrcSetGenerator(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT unsigned char fn_ucMSPrtSrcGetGeneratorActivation(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcSetGeneratorActivation(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,unsigned char _ucGeneratorActivation);
extern CPA_EXPORT GAM_tdxHandleToWaterStreakEffect fn_hMSPrtSrcGetWaterStreakGenerator(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcSetWaterStreakGenerator(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,GAM_tdxHandleToWaterStreakEffect _hWaterStreakGenerator);
/*ANNECY VL 26/11/97{*/
extern CPA_EXPORT GAM_tdxHandleToFootPathEffect fn_hMSPrtSrcGetFootPath(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcSetFootPath(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,GAM_tdxHandleToFootPathEffect _hfootPath );
/*ENDANNECY VL }*/
 
/**********************************************
 *** Special functions for AI manipulations ***
 **********************************************/
/* Generation Mode*/
extern CPA_EXPORT void fn_vMSPrtSrcSetGenerationModeNone(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcSetGenerationModeContinuous(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcSetGenerationModeCrenel(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,ACP_tdxIndex _xNb1,ACP_tdxIndex _xNb2);
extern CPA_EXPORT void fn_vMSPrtSrcSetGenerationModeProbability(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,MTH_tdxReal _xProbability);
/* Generation number*/
extern CPA_EXPORT void fn_vMSPrtSrcSetGenerationNumberConstant(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,ACP_tdxIndex _xNumber);
extern CPA_EXPORT void fn_vMSPrtSrcSetGenerationNumberProbabilist(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,ACP_tdxIndex _xMin,ACP_tdxIndex _xMax);
/* Speed, acceleration and range*/
extern CPA_EXPORT void fn_vMSPrtSrcSetGenerationSpeedAndSpeedRange(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,MTH_tdxReal _xSpeed,MTH_tdxReal _xSpeedRange);
extern CPA_EXPORT void fn_vMSPrtSrcSetAccelerationOfEnvironment(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,MTH3D_tdstVector * _p_stAcceleration,MTH_tdxReal _xAccelerationRange);
/* Generation Geometry*/
extern CPA_EXPORT void fn_vMSPrtSrcSetMiddlePointOfEnvironment(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,MTH3D_tdstVector * _p_stMiddlePoint);
extern CPA_EXPORT void fn_vMSPrtSrcSetRadiusOfSphereEnvironment(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,MTH_tdxReal _xRadius);
extern CPA_EXPORT void fn_vMSPrtSrcSetDimensionsOfBoxEnvironment(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,MTH_tdxReal _xXSemiLength,MTH_tdxReal _xYSemiLength,MTH_tdxReal _xZSemiLength);
/* Particles life time*/
extern CPA_EXPORT void fn_vMSPrtSrcSetParticlesInfiniteLifeTime(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcSetParticlesConstantLifeTime(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,MTH_tdxReal _xLifeTime);
extern CPA_EXPORT void fn_vMSPrtSrcSetParticlesProbabilistLifeTime(MS_tdxHandleToMSPrtSrc h_MSPrtSrc,MTH_tdxReal _xMinTime,MTH_tdxReal _xMaxTime);
 
/*************************************************/
/**** Access functions for particle generator ****/
/*************************************************/
extern CPA_EXPORT PRT_tdstParticlesSource * fn_p_stPrtGenGetSrc(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetSrc(tdxHandleToParticleGenerator _hPrtGenerator,PRT_tdstParticlesSource * _p_stSrc);
extern CPA_EXPORT PRT_tdstParticlesSystem * fn_p_stPrtGenGetPrtSys(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetPrtSys(tdxHandleToParticleGenerator _hPrtGenerator,PRT_tdstParticlesSystem * _p_stPrtSys);
extern CPA_EXPORT PRT_tdstParticlesEnvironment * fn_p_stPrtGenGetPrtEnv(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetPrtEnv(tdxHandleToParticleGenerator _hPrtGenerator,PRT_tdstParticlesEnvironment * _p_stPrtEnv);
extern CPA_EXPORT MTH3D_tdstVector * fn_p_stPrtGenGetMinPoint(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetMinPoint(tdxHandleToParticleGenerator _hPrtGenerator,MTH3D_tdstVector * _p_stMinPoint);
extern CPA_EXPORT MTH3D_tdstVector * fn_p_stPrtGenGetMaxPoint(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetMaxPoint(tdxHandleToParticleGenerator _hPrtGenerator,MTH3D_tdstVector * _p_stMaxPoint);
extern CPA_EXPORT unsigned char fn_ucPrtGenGetLinkValue(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetLinkValue(tdxHandleToParticleGenerator _hPrtGenerator,unsigned char _ucLinkValue);
extern CPA_EXPORT long fn_lPrtGenGetEnvironmentMask(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetEnvironmentMask(tdxHandleToParticleGenerator _hPrtGenerator,long _lEnvironmentMask);
/*ANNECY VL PRT 24/03/98{*/
extern CPA_EXPORT long fn_lPrtGenGetLinkedGenMask(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetLinkedGenMask(tdxHandleToParticleGenerator _hPrtGenerator,long _lLinkedGenMask);
extern CPA_EXPORT tdxHandleToParticleGenerator fn_hPrtGenGetLinkedGen(tdxHandleToParticleGenerator _hPrtGenerator);
extern CPA_EXPORT void fn_vPrtGenSetLinkedGen(tdxHandleToParticleGenerator _hPrtGenerator, tdxHandleToParticleGenerator _hLinkedGen);
/*ENDANNECY VL}*/
/**********************************/
/**** Special functions define ****/
/**********************************/
extern CPA_EXPORT void fn_vMSPrtSrcSourceGenerateParticles(HIE_tdxHandleToSuperObject _hCharacter);
extern CPA_EXPORT void fn_vMSPrtSrcInitMinMaxPoints(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcUpdateLinkedEnvironment(HIE_tdxHandleToSuperObject _hCharacter,MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vRegisterAllGamParticlesCallBacks(void);
extern CPA_EXPORT void fn_vMSPrtSysPreDrawAllParticlesSystemsForCharacter(HIE_tdxHandleToSuperObject _hCharacter);
extern CPA_EXPORT void fn_vMSPrtSysTreatAllParticlesSystemsForCharacter(HIE_tdxHandleToSuperObject _hCharacter);
 
extern CPA_EXPORT void GAM_fn_vTreatAllParticlesGeneratorInActiveSector(HIE_tdxHandleToSuperObject _hSector);
extern CPA_EXPORT void GAM_fn_vPreDrawAllParticlesGeneratorInActiveSector(HIE_tdxHandleToSuperObject _hSector);
 
extern CPA_EXPORT tdxHandleToParticleGenerator fn_hParticleGeneratorAllocation(void);
/* JO 29/11/97*/
extern CPA_EXPORT tdxHandleToParticleGenerator fn_hParticleGeneratorCopyClone(tdxHandleToParticleGenerator _hPrtGen);
 
extern CPA_EXPORT void fn_vSetFactorForParticlesGeneration(float _fFactor);
extern CPA_EXPORT float fn_fGetFactorForParticlesGeneration(void);
/**********************/
/**** SAI function ****/
/**********************/
extern CPA_EXPORT void fn_vMSPrtSrcInitValueSAI(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcSavedValueSAI(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
extern CPA_EXPORT void fn_vMSPrtSrcFreeInitValueSAI(MS_tdxHandleToMSPrtSrc h_MSPrtSrc);
 
/*************************************/
/**** Access functions for Editor ****/
/*************************************/
#if defined(ACTIVE_EDITOR)
#endif /* ACTIVE_EDITOR */
 
/*NZO 25/09/97*/
#ifdef BIN_SaveBin
extern CPA_EXPORT unsigned long MSPtrSrc_fn_ulWriteBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer);
#endif
/*No read function necessary.*/
 
      /*PRT_fn_vCreateParticlesSource(&h_MSPrtSrc->p_stPrtSrc);*/
 
#if defined(__cplusplus)
}
#endif /* __cplusplus */
 
#endif /* __MSPrtSrc_H__ */
 
#endif /* D_THROW_PRT */
