1224 lines
49 KiB
C++
1224 lines
49 KiB
C++
/*
|
|
=======================================================================================
|
|
Name : TPGMyDoc.cpp
|
|
Author : David Reizer
|
|
Description : Document class for Particle Generator editor Tool DLL
|
|
=======================================================================================
|
|
Modification -> Author : Vincent Lhullier
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
#include "StdAfx.h"
|
|
|
|
#include "SCR.h"
|
|
#include "CTL.h"
|
|
|
|
#include "TPGMyDoc.hpp"
|
|
#include "TPG_View.hpp"
|
|
#include "TPG_Strg.hpp"
|
|
#include "TPG_ClBk.hpp"
|
|
|
|
#include "_Minterf.hpp"
|
|
|
|
#include "x:\cpa\main\inc\_EditID.h"
|
|
|
|
#include "ErO.h"
|
|
#include "Dpt.h"
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
/*
|
|
=======================================================================================
|
|
CPA_PartGen_MyDocument class
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : constructor
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
CPA_PartGen_MyDocument::CPA_PartGen_MyDocument()
|
|
{
|
|
// AfxEnableMemoryTracking(TRUE);
|
|
|
|
//Editor's Setup var. Init.
|
|
m_ulListViewHeight = 170;
|
|
m_ulControlViewHeight = 250;
|
|
m_ulEditorWidth = 260;
|
|
|
|
m_pub_p_clCurrentGenerator = NULL;
|
|
m_pub_p_clCurrentSystem = NULL;
|
|
m_pub_p_clCurrentSource = NULL;
|
|
m_pub_p_clCurrentEnv = NULL;
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : destructor
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
CPA_PartGen_MyDocument::~CPA_PartGen_MyDocument()
|
|
{
|
|
}
|
|
|
|
|
|
//*** Return the view on the document *******************
|
|
TPG_View * CPA_PartGen_MyDocument::m_pub_fn_p_clGetView()
|
|
{
|
|
return g_pclInterface->m_pub_p_clView;
|
|
}
|
|
|
|
|
|
/*
|
|
=======================================================================================
|
|
Search loaded or unloaded object
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : Search in link table for loaded ParticlesGenerators
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vSearchForLoadedGenerators()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
SCR_tdst_Link_Table *p_stLinkTable;
|
|
unsigned int uiPos;
|
|
SCR_tdst_Link_Value *p_stValue;
|
|
tdxHandleToParticleGenerator hGenerator;
|
|
char szName[256];
|
|
CPA_PartGen_Generator *p_oPrtGen;
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
/*
|
|
* get PrtGen link table
|
|
*/
|
|
p_stLinkTable = &(g_st3DOSLinkTable.stPrtGenLinkTable);
|
|
|
|
//*** Get first element of array
|
|
uiPos = 0;
|
|
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray(p_stLinkTable) )
|
|
|
|
while( p_stValue != NULL )
|
|
{
|
|
/* Test current retrieved value */
|
|
if( SCR_M_e_Link_GetState(p_stValue) == SCR_ELS_Link_Initialized )
|
|
{
|
|
//*** get engine pointer ***************
|
|
hGenerator = (tdxHandleToParticleGenerator)SCR_M_ul_Link_GetValue(p_stValue);
|
|
|
|
//*** Get the Name for the generator ******************
|
|
SCR_fn_v_RdL0_SplitSectionName(SCR_M_p_sz_Link_GetKey(p_stValue), NULL, NULL, szName);
|
|
|
|
//*** Create editor object ********
|
|
p_oPrtGen = (CPA_PartGen_Generator *) g_pclInterface->GetMainWorld()->fn_p_oFindObject(szName, C_szPartGenGeneratorName);
|
|
if (p_oPrtGen == NULL )
|
|
{
|
|
new CPA_PartGen_Generator( szName, hGenerator );
|
|
}
|
|
else
|
|
{
|
|
if( p_oPrtGen->m_pub_fn_hGetGenerator() == NULL )
|
|
p_oPrtGen->m_pub_fn_vSetGenerator( hGenerator );
|
|
}
|
|
}
|
|
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray(p_stLinkTable) )
|
|
}
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : Search in link table for loaded ParticlesSource
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vSearchForLoadedSources()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
SCR_tdst_Link_Table *p_stLinkTable;
|
|
unsigned int uiPos;
|
|
SCR_tdst_Link_Value *p_stValue;
|
|
PRT_tdstParticlesSource *p_stPrtSrc;
|
|
char szName[256];
|
|
CPA_PartGen_Source *p_oPrtSrc;
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
/*
|
|
* Get ParticleSource link table
|
|
*/
|
|
p_stLinkTable = &(g_st3DOSLinkTable.stPrtSrcLinkTable);
|
|
|
|
//*** Get first element of array
|
|
uiPos = 0;
|
|
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray(p_stLinkTable) )
|
|
|
|
while( p_stValue != NULL )
|
|
{
|
|
/* Test current retrieved value */
|
|
if( SCR_M_e_Link_GetState(p_stValue) == SCR_ELS_Link_Initialized )
|
|
{
|
|
//*** get engine pointer ***************
|
|
p_stPrtSrc = (PRT_tdstParticlesSource *) SCR_M_ul_Link_GetValue( p_stValue );
|
|
|
|
//*** Get the Name for the particle source ******************
|
|
SCR_fn_v_RdL0_SplitSectionName(SCR_M_p_sz_Link_GetKey(p_stValue), NULL, NULL, szName);
|
|
|
|
//*** Create editor object ********
|
|
p_oPrtSrc = (CPA_PartGen_Source *) g_pclInterface->GetMainWorld()->fn_p_oFindObject(szName, C_szPartGenSourceName);
|
|
if (p_oPrtSrc == NULL )
|
|
{
|
|
new CPA_PartGen_Source( szName, p_stPrtSrc );
|
|
}
|
|
else
|
|
{
|
|
if( p_oPrtSrc->m_pub_fn_p_stGetSource() == NULL )
|
|
p_oPrtSrc->m_pub_fn_vSetSource( p_stPrtSrc );
|
|
}
|
|
}
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray(p_stLinkTable) )
|
|
}
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : Search in link table for loaded ParticlesSystem
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vSearchForLoadedSystems()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
SCR_tdst_Link_Table *p_stLinkTable;
|
|
unsigned int uiPos;
|
|
SCR_tdst_Link_Value *p_stValue;
|
|
PRT_tdstParticlesSystem *p_stSystem;
|
|
CPA_PartGen_System *p_clSystem;
|
|
char szName[256];
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
/*
|
|
* Get ParticleSystem link table
|
|
*/
|
|
p_stLinkTable = &(g_st3DOSLinkTable.stPrtSysLinkTable);
|
|
|
|
/* Get first element of array */
|
|
uiPos = 0;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray(p_stLinkTable) )
|
|
|
|
while( p_stValue != NULL )
|
|
{
|
|
/* Test current retrieved value */
|
|
if( SCR_M_e_Link_GetState(p_stValue) == SCR_ELS_Link_Initialized )
|
|
{
|
|
// get engine object
|
|
p_stSystem = (PRT_tdstParticlesSystem*)SCR_M_ul_Link_GetValue(p_stValue);
|
|
|
|
// get engine object short name
|
|
SCR_fn_v_RdL0_SplitSectionName( SCR_M_p_sz_Link_GetKey(p_stValue), NULL, NULL, szName);
|
|
|
|
// create associated editor object if it doesn't exist
|
|
p_clSystem = (CPA_PartGen_System*) g_pclInterface->GetMainWorld()->fn_p_oFindObject(szName, C_szPartGenSystemName);
|
|
if (p_clSystem == NULL )
|
|
{
|
|
new CPA_PartGen_System( szName, p_stSystem );
|
|
}
|
|
else
|
|
{
|
|
if( p_clSystem->m_pub_fn_p_stGetSystem() == NULL )
|
|
p_clSystem->m_pub_fn_vSetSystem( p_stSystem );
|
|
}
|
|
}
|
|
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray(p_stLinkTable) )
|
|
}
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : Search in link table for loaded ParticlesSource
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vSearchForLoadedEnvironments()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
SCR_tdst_Link_Table *p_stLinkTable;
|
|
unsigned int uiPos;
|
|
SCR_tdst_Link_Value *p_stValue;
|
|
PRT_tdstParticlesEnvironment *p_stEnv;
|
|
CPA_PartGen_Environment *p_clEnv;
|
|
char szName[256];
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
/*
|
|
* Get ParticleEnvironment link table
|
|
*/
|
|
p_stLinkTable = &(g_st3DOSLinkTable.stPrtEnvLinkTable);
|
|
|
|
/* Get first element of array */
|
|
uiPos = 0;
|
|
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray(p_stLinkTable) )
|
|
|
|
while( p_stValue != NULL )
|
|
{
|
|
/* Test current retrieved value */
|
|
if( SCR_M_e_Link_GetState(p_stValue) == SCR_ELS_Link_Initialized )
|
|
{
|
|
p_stEnv = (PRT_tdstParticlesEnvironment*)SCR_M_ul_Link_GetValue(p_stValue);
|
|
|
|
//Gets the Name for the Card
|
|
SCR_fn_v_RdL0_SplitSectionName(SCR_M_p_sz_Link_GetKey(p_stValue), NULL, NULL, szName);
|
|
|
|
p_clEnv = (CPA_PartGen_Environment*) g_pclInterface->GetMainWorld()->fn_p_oFindObject(szName, C_szPartGenEnvName);
|
|
if( p_clEnv == NULL )
|
|
{
|
|
new CPA_PartGen_Environment( szName, p_stEnv );
|
|
}
|
|
else
|
|
{
|
|
if( p_clEnv->m_pub_fn_p_stGetEnv() == NULL )
|
|
p_clEnv->m_pub_fn_vSetEnv( p_stEnv );
|
|
}
|
|
}
|
|
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray(p_stLinkTable) )
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : Parse generator script file to find all unloaded generators and source
|
|
(script section for particles generators and sources are for now
|
|
in the same script file )
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vSearchForUnLoadedGeneratorsAndSources()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
char szFileName[ _MAX_PATH ];
|
|
SCR_tdst_File_Open *p_stFile;
|
|
unsigned int uiPos;
|
|
SCR_tdst_Anl_SectionDes_ *p_stValue;
|
|
CPA_PartGen_Generator *p_oPrtGen;
|
|
CPA_PartGen_Source *p_oPrtSrc;
|
|
BOOL bIsNotLoaded;
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
//*** get file name ******************
|
|
sprintf( szFileName, "%s\\%s", C_szEffectPath, C_szGeneratorAndSourceFileName );
|
|
|
|
if ( _access( szFileName, 4) != 0 )
|
|
return;
|
|
|
|
//Gets all the sections in the corresponding file
|
|
SCR_fn_v_RdL0_OpenFile( szFileName );
|
|
|
|
//*** Gets a pointer on the file ****************************************
|
|
p_stFile = SCR_fnp_st_RdL0_GetOpenFile( szFileName );
|
|
|
|
//**** Get first element of array *****************
|
|
uiPos = 0;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Anl_SectionDes_, uiPos, p_stValue, p_stFile->stSectionsDes )
|
|
|
|
while( p_stValue != NULL ) /* p_sValue is NULL at the end of the array */
|
|
{
|
|
/*
|
|
* source section
|
|
*/
|
|
if (stricmp( p_stValue->stBuffers.p_szBufferName, C_SectionParticleSource) == 0)
|
|
{
|
|
bIsNotLoaded = g_pclInterface->GetMainWorld()->fn_p_oFindObject(p_stValue->stBuffers.p_szBufferNameExt, C_szPartGenSourceName) == NULL;
|
|
if (bIsNotLoaded)
|
|
p_oPrtSrc = new CPA_PartGen_Source( p_stValue->stBuffers.p_szBufferNameExt, NULL, FALSE );
|
|
}
|
|
/*
|
|
* generator section
|
|
*/
|
|
else if (stricmp( p_stValue->stBuffers.p_szBufferName, C_SectionParticleGenerator ) == 0 )
|
|
{
|
|
bIsNotLoaded = g_pclInterface->GetMainWorld()->fn_p_oFindObject(p_stValue->stBuffers.p_szBufferNameExt, C_szPartGenGeneratorName) == NULL;
|
|
if (bIsNotLoaded)
|
|
p_oPrtGen = new CPA_PartGen_Generator( p_stValue->stBuffers.p_szBufferNameExt, NULL, FALSE );
|
|
}
|
|
|
|
/* Get next element */
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Anl_SectionDes_, uiPos, p_stValue, p_stFile->stSectionsDes )
|
|
}
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : Parse system script file to find all unloaded systems
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vSearchForUnLoadedSystems()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
char szFileName[ _MAX_PATH ];
|
|
SCR_tdst_File_Open *p_stFile;
|
|
unsigned int uiPos;
|
|
SCR_tdst_Anl_SectionDes_ *p_stValue;
|
|
BOOL bIsNotLoaded;
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
sprintf( szFileName, "%s\\%s", C_szEffectPath, C_szSystemFileName );
|
|
|
|
if ( _access( szFileName, 4) != 0 )
|
|
return;
|
|
|
|
//Gets all the sections in the corresponding file
|
|
SCR_fn_v_RdL0_OpenFile(szFileName);
|
|
|
|
//Gets a pointer on the file
|
|
p_stFile = SCR_fnp_st_RdL0_GetOpenFile( szFileName );
|
|
|
|
// Get first element of array
|
|
uiPos = 0;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Anl_SectionDes_, uiPos, p_stValue, p_stFile->stSectionsDes )
|
|
|
|
while( p_stValue != NULL )
|
|
{
|
|
if (stricmp( p_stValue->stBuffers.p_szBufferName, C_SectionPrtSysDescription) == 0)
|
|
{
|
|
bIsNotLoaded = g_pclInterface->GetMainWorld()->fn_p_oFindObject(p_stValue->stBuffers.p_szBufferNameExt, C_szPartGenSystemName) == NULL;
|
|
if (bIsNotLoaded)
|
|
new CPA_PartGen_System( p_stValue->stBuffers.p_szBufferNameExt, NULL, FALSE );
|
|
}
|
|
|
|
/* Get next element */
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Anl_SectionDes_, uiPos, p_stValue, p_stFile->stSectionsDes )
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : Parse environment script file to find all unloaded environments
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vSearchForUnLoadedEnvironments()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
char szFileName[ _MAX_PATH ];
|
|
SCR_tdst_File_Open *p_stFile;
|
|
unsigned int uiPos;
|
|
SCR_tdst_Anl_SectionDes_ *p_stValue;
|
|
BOOL bIsNotLoaded;
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
sprintf( szFileName, "%s\\%s", C_szEffectPath, C_szEnvironmentFileName );
|
|
|
|
if ( _access( szFileName, 4) != 0 )
|
|
return;
|
|
|
|
//Gets all the sections in the corresponding file
|
|
SCR_fn_v_RdL0_OpenFile(szFileName);
|
|
|
|
//Gets a pointer on the file
|
|
p_stFile = SCR_fnp_st_RdL0_GetOpenFile( szFileName );
|
|
|
|
// Get first element of array
|
|
uiPos = 0;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Anl_SectionDes_, uiPos, p_stValue, p_stFile->stSectionsDes )
|
|
|
|
while( p_stValue != NULL )
|
|
{
|
|
if (stricmp( p_stValue->stBuffers.p_szBufferName, C_SectionPrtEnvDescription) == 0)
|
|
{
|
|
bIsNotLoaded = g_pclInterface->GetMainWorld()->fn_p_oFindObject(p_stValue->stBuffers.p_szBufferNameExt, C_szPartGenEnvName) == NULL;
|
|
if (bIsNotLoaded)
|
|
new CPA_PartGen_Environment( p_stValue->stBuffers.p_szBufferNameExt, NULL, FALSE );
|
|
}
|
|
|
|
/* Get next element */
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Anl_SectionDes_, uiPos, p_stValue, p_stFile->stSectionsDes )
|
|
}
|
|
}
|
|
|
|
/*
|
|
=======================================================================================
|
|
Update and Display Functions
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : select a new generator and display it
|
|
_p_clGenerator -> new selected generator
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vUpdateGenerator( CPA_PartGen_Generator *_p_clGenerator )
|
|
{
|
|
m_pub_p_clCurrentGenerator = _p_clGenerator;
|
|
|
|
if( (_p_clGenerator != NULL) && (_p_clGenerator->fn_bIsAvailable()) )
|
|
{
|
|
m_pub_clGeneratorControlList.m_pub_fn_vUpdateControlsWithListOfData( &(m_pub_p_clCurrentGenerator->m_pub_clGeneratorDataList) );
|
|
|
|
m_pri_fn_vUpdateSource ( m_pub_p_clCurrentGenerator->m_pub_fn_p_clGetSource() );
|
|
m_pri_fn_vUpdateSystem ( m_pub_p_clCurrentGenerator->m_pub_fn_p_clGetSystem() );
|
|
m_pri_fn_vUpdateEnv ( m_pub_p_clCurrentGenerator->m_pub_fn_p_clGetEnv() );
|
|
}
|
|
m_pub_fn_vDisplayCurrentGenerator();
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : select a new source
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vUpdateSource( CPA_PartGen_Source *_p_oPrtSrc )
|
|
{
|
|
m_pub_p_clCurrentSource = _p_oPrtSrc;
|
|
|
|
if( _p_oPrtSrc == NULL )
|
|
return;
|
|
|
|
if( _p_oPrtSrc->fn_bIsAvailable() )
|
|
m_pub_clSourceControlList.m_pub_fn_vUpdateControlsWithListOfData( &(m_pub_p_clCurrentSource->m_pub_clDataList) );
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : select a new source and display it
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vUpdateSource( CPA_PartGen_Source *_oPrtSrc )
|
|
{
|
|
m_pri_fn_vUpdateSource( _oPrtSrc );
|
|
m_pub_fn_vDisplayCurrentGenerator();
|
|
}
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : select a new system
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vUpdateSystem( CPA_PartGen_System *_p_clSystem )
|
|
{
|
|
m_pub_p_clCurrentSystem = _p_clSystem;
|
|
|
|
if( _p_clSystem == NULL )
|
|
return;
|
|
|
|
if( _p_clSystem->fn_bIsAvailable() )
|
|
m_pub_clSystemControlList.m_pub_fn_vUpdateControlsWithListOfData( &(m_pub_p_clCurrentSystem->m_pub_clDataList) );
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : select a new system and display it
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vUpdateSystem( CPA_PartGen_System *_p_clSystem )
|
|
{
|
|
m_pri_fn_vUpdateSystem( _p_clSystem );
|
|
m_pub_fn_vDisplayCurrentGenerator();
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : select a new environment
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vUpdateEnv( CPA_PartGen_Environment *_p_clEnv )
|
|
{
|
|
m_pub_p_clCurrentEnv = _p_clEnv;
|
|
|
|
if( _p_clEnv == NULL )
|
|
return;
|
|
|
|
if( _p_clEnv->fn_bIsAvailable() )
|
|
m_pub_clEnvControlList.m_pub_fn_vUpdateControlsWithListOfData( &(m_pub_p_clCurrentEnv->m_pub_clDataList) );
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : select a new environment and display it
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vUpdateEnv( CPA_PartGen_Environment *_p_clEnv )
|
|
{
|
|
m_pri_fn_vUpdateEnv( _p_clEnv );
|
|
m_pub_fn_vDisplayCurrentGenerator();
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : display current paticles generator/source/system and environement
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vDisplayCurrentGenerator()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
CRect oRect;
|
|
CPoint oTopLeft;
|
|
CPoint oTopRight;
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
if( m_pub_fn_p_clGetView() == NULL )
|
|
return;
|
|
|
|
m_pub_fn_p_clGetView()->GetWindowRect( &oRect );
|
|
m_pub_fn_p_clGetView()->ScreenToClient( &oRect );
|
|
|
|
oTopLeft = oRect.TopLeft();
|
|
oTopLeft.Offset( 20, 20 - m_pub_fn_p_clGetView()->GetScrollPosition().y );
|
|
oTopRight = oRect.BottomRight();
|
|
oTopRight.x -= 20;
|
|
oTopRight.y = oTopLeft.y;
|
|
|
|
/*
|
|
* display generators controls and data
|
|
*/
|
|
m_pub_fn_p_clGetView()->m_pub_fn_vDisplayGeneratorInZone( m_pub_p_clCurrentGenerator, &oTopLeft, &oTopRight );
|
|
|
|
if( m_pub_p_clCurrentGenerator != NULL )
|
|
m_pub_clGeneratorControlList.m_pub_fn_vDisplayControlsInZone( oTopLeft, oTopRight );
|
|
else
|
|
m_pub_clGeneratorControlList.m_pub_fn_vHideAllControls();
|
|
|
|
oTopLeft.y += 20;
|
|
oTopRight.y = oTopLeft.y;
|
|
|
|
/*
|
|
* display source controls and data
|
|
*/
|
|
m_pub_fn_p_clGetView()->m_pub_fn_vDisplaySourceInZone( m_pub_p_clCurrentSource, &oTopLeft, &oTopRight );
|
|
|
|
if( m_pub_p_clCurrentSource != NULL )
|
|
m_pub_clSourceControlList.m_pub_fn_vDisplayControlsInZone( oTopLeft, oTopRight );
|
|
else
|
|
m_pub_clSourceControlList.m_pub_fn_vHideAllControls();
|
|
|
|
oTopLeft.y += 20;
|
|
oTopRight.y = oTopLeft.y;
|
|
|
|
/*
|
|
* display system controls and data
|
|
*/
|
|
m_pub_fn_p_clGetView()->m_pub_fn_vDisplaySystemInZone( m_pub_p_clCurrentSystem, &oTopLeft, &oTopRight );
|
|
|
|
if( m_pub_p_clCurrentSystem != NULL )
|
|
m_pub_clSystemControlList.m_pub_fn_vDisplayControlsInZone( oTopLeft, oTopRight );
|
|
else
|
|
m_pub_clSystemControlList.m_pub_fn_vHideAllControls();
|
|
|
|
oTopLeft.y += 20;
|
|
oTopRight.y = oTopLeft.y;
|
|
|
|
/*
|
|
* display environment controls and data
|
|
*/
|
|
m_pub_fn_p_clGetView()->m_pub_fn_vDisplayEnvInZone( m_pub_p_clCurrentEnv, &oTopLeft, &oTopRight );
|
|
|
|
if( m_pub_p_clCurrentEnv != NULL )
|
|
m_pub_clEnvControlList.m_pub_fn_vDisplayControlsInZone( oTopLeft, oTopRight );
|
|
else
|
|
m_pub_clEnvControlList.m_pub_fn_vHideAllControls();
|
|
|
|
m_pub_fn_p_clGetView()->m_fn_vSetViewHeight( (unsigned short) oTopLeft.y + m_pub_fn_p_clGetView()->GetScrollPosition().y + 10 );
|
|
}
|
|
|
|
|
|
/*
|
|
=======================================================================================
|
|
Delete functions
|
|
=======================================================================================
|
|
*/
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : delete generator
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vDeleteGenerator()
|
|
{
|
|
if( m_pub_p_clCurrentGenerator != NULL )
|
|
{
|
|
delete m_pub_p_clCurrentGenerator;
|
|
m_pub_fn_vUpdateGenerator( NULL );
|
|
}
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : delete source
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vDeleteSource()
|
|
{
|
|
if( m_pub_p_clCurrentSource == NULL )
|
|
return;
|
|
|
|
if( m_pub_p_clCurrentGenerator != NULL )
|
|
if( m_pub_p_clCurrentGenerator->m_pub_fn_p_clGetSource() == m_pub_p_clCurrentSource )
|
|
m_pub_p_clCurrentGenerator->m_pub_fn_vSetSource( NULL );
|
|
|
|
delete m_pub_p_clCurrentSource;
|
|
m_pub_p_clCurrentSource = NULL;
|
|
|
|
m_pub_fn_vUpdateChangingEnumDescriptors();
|
|
m_pub_fn_vUpdateGenerator( m_pub_p_clCurrentGenerator );
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : delete system
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vDeleteSystem()
|
|
{
|
|
if( m_pub_p_clCurrentSystem == NULL )
|
|
return;
|
|
|
|
if( m_pub_p_clCurrentGenerator != NULL )
|
|
if( m_pub_p_clCurrentGenerator->m_pub_fn_p_clGetSystem() == m_pub_p_clCurrentSystem )
|
|
m_pub_p_clCurrentGenerator->m_pub_fn_vSetSystem( NULL );
|
|
|
|
delete m_pub_p_clCurrentSystem;
|
|
m_pub_p_clCurrentSystem = NULL;
|
|
|
|
m_pub_fn_vUpdateChangingEnumDescriptors();
|
|
m_pub_fn_vUpdateGenerator( m_pub_p_clCurrentGenerator );
|
|
}
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : delete environment
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vDeleteEnv()
|
|
{
|
|
if( m_pub_p_clCurrentEnv == NULL )
|
|
return;
|
|
|
|
if( m_pub_p_clCurrentGenerator != NULL )
|
|
if( m_pub_p_clCurrentGenerator->m_pub_fn_p_clGetEnv() == m_pub_p_clCurrentEnv )
|
|
m_pub_p_clCurrentGenerator->m_pub_fn_vSetEnv( NULL );
|
|
|
|
delete m_pub_p_clCurrentEnv;
|
|
m_pub_p_clCurrentEnv = NULL;
|
|
|
|
m_pub_fn_vUpdateChangingEnumDescriptors();
|
|
m_pub_fn_vUpdateGenerator( m_pub_p_clCurrentGenerator );
|
|
}
|
|
|
|
|
|
/*
|
|
=======================================================================================
|
|
function to Build all the controls used by the editor
|
|
=======================================================================================
|
|
*/
|
|
|
|
///// Fill Controls Lists /////////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vFillControlLists()
|
|
{
|
|
m_pri_fn_vFillGeneratorControlList();
|
|
m_pri_fn_vFillSourceControlList();
|
|
m_pri_fn_vFillSystemControlList();
|
|
m_pri_fn_vFillEnvControlList();
|
|
}
|
|
|
|
///// Build controls for generator ////////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vFillGeneratorControlList()
|
|
{
|
|
//*** source associated with generator
|
|
m_pub_clGeneratorControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Source", TRUE, 0 );
|
|
|
|
//*** System associated with generator
|
|
m_pub_clGeneratorControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "System" , TRUE, 0); //ANNECY BBB
|
|
|
|
//*** Environment associated with generator
|
|
m_pub_clGeneratorControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Environment" , TRUE, 0); //ANNECY BBB
|
|
|
|
//*** Environment Mask
|
|
m_pub_clGeneratorControlList.m_fn_pclAddMaskedControl( TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Environment Mask" , TRUE, 0 ); //ANNECY BBB
|
|
|
|
//*** Link To Environment
|
|
m_pub_clGeneratorControlList.m_fn_pclAddBooleanControl( TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Link To Environment" , TRUE, 0 ); //ANNECY BBB
|
|
|
|
//*** Linked generator Mask
|
|
m_pub_clGeneratorControlList.m_fn_pclAddMaskedControl( TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Linked generator Mask", TRUE, 0 );
|
|
|
|
//*** Linked generator
|
|
m_pub_clGeneratorControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Linked Generator", TRUE, 0 );
|
|
|
|
|
|
CTL_fn_vSetModuleInfo("TPG", "Generator");
|
|
m_pri_fn_vCreateControl( &m_pub_clGeneratorControlList );
|
|
CTL_fn_vResetModuleInfo();
|
|
}
|
|
|
|
///// Build controls for source ////////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vFillSourceControlList()
|
|
{
|
|
//*** Generation Mode ********************
|
|
m_pub_clSourceControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Generation Mode" , TRUE, 0); //ANNECY BBB
|
|
//****** Probability **********
|
|
CTL_Editor_Control *p_clControl = m_pub_clSourceControlList.m_fn_pclAddDecimalControl( 0., 1., sizeof(MTH_tdxReal), TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Probability" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceProbability );
|
|
//****** Nb No Generation *******
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddIntegerControl(0, LONG_MAX, sizeof(ACP_tdxIndex), TPG_UNSIGNED, TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Nb Frames No Generation" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceNbFrames );
|
|
//****** Nb Generation **********
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddIntegerControl(0, LONG_MAX, sizeof(ACP_tdxIndex), TPG_UNSIGNED, TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Nb Frames Generation" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceNbFrames );
|
|
|
|
//*** Nb particles to generate mode ******
|
|
m_pub_clSourceControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Nb Particles to Generate Mode" , TRUE, 0); //ANNECY BBB
|
|
//****** Nb particles ***********
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddIntegerControl(0, LONG_MAX, sizeof(ACP_tdxIndex), TPG_UNSIGNED, TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Nb Particles" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceNbParticles );
|
|
//****** Nb particles min *******
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddIntegerControl(0, LONG_MAX, sizeof(ACP_tdxIndex), TPG_UNSIGNED, TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Nb Particles min" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceNbParticlesMinMax );
|
|
//****** Nb particles max *******
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddIntegerControl(0, LONG_MAX, sizeof(ACP_tdxIndex), TPG_UNSIGNED, TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Nb Particles max" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceNbParticlesMinMax );
|
|
|
|
//*** Geometry Mode **********************
|
|
m_pub_clSourceControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Geometry Mode" , TRUE, 0); //ANNECY BBB
|
|
//****** Point ******************
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddVectorControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, "Point 1" , TRUE, 0); //ANNECY BBB
|
|
//****** Quad *******************
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddVectorControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, "Point 2" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceGeometryQuad );
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddVectorControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, "Point 3" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceGeometryQuad );
|
|
|
|
//*** Link Mode **************************
|
|
m_pub_clSourceControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Link Mode" , TRUE, 0); //ANNECY BBB
|
|
|
|
//*** Speed and Range
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddDecimalControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Speed" , TRUE, 0); //ANNECY BBB
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddDecimalControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Speed Range" , TRUE, 0); //ANNECY BBB
|
|
|
|
//*** Life Mode
|
|
m_pub_clSourceControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Life Mode", TRUE, 0 );
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddDecimalControl( 0., MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Life time (in sec)", TRUE, 0 );
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceConstantLifeTime );
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddDecimalControl( 0., MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Min Life time (in sec)", TRUE, 0 );
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceProbabilistLifeTime );
|
|
p_clControl = m_pub_clSourceControlList.m_fn_pclAddDecimalControl( 0., MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Max Life time (in sec)", TRUE, 0 );
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSourceProbabilistLifeTime );
|
|
|
|
|
|
CTL_fn_vSetModuleInfo("TPG", "Source");
|
|
m_pri_fn_vCreateControl( &m_pub_clSourceControlList );
|
|
CTL_fn_vResetModuleInfo();
|
|
}
|
|
|
|
///// Build controls for system //////////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vFillSystemControlList()
|
|
{
|
|
//*** Nb Particles ********************************
|
|
m_pub_clSystemControlList.m_fn_pclAddIntegerControl(0, LONG_MAX, sizeof(ACP_tdxIndex), TPG_UNSIGNED, TPG_READONLY, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Nb Particles" , TRUE, 0); //ANNECY BBB
|
|
|
|
//*** Objects Type *****************************
|
|
m_pub_clSystemControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Particles Type" , TRUE, 0); //ANNECY BBB
|
|
|
|
//*** Objects GameMaterial *********************
|
|
CTL_Editor_Control *p_clControl = m_pub_clSystemControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Game Material" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSystemGameMaterials );
|
|
|
|
//*** Objects Sprites
|
|
p_clControl = m_pub_clSystemControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Sprites" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedSystemSprites );
|
|
|
|
CTL_fn_vSetModuleInfo("TPG", "System");
|
|
m_pri_fn_vCreateControl( &m_pub_clSystemControlList );
|
|
CTL_fn_vResetModuleInfo();
|
|
}
|
|
|
|
///// Build controls for environment ////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vFillEnvControlList()
|
|
{
|
|
//*** environment type **********************
|
|
m_pub_clEnvControlList.m_fn_pclAddEnumControl( TPG_READWRITE, "Environment Type" , TRUE, 0); //ANNECY BBB
|
|
|
|
//*** Box Min Max **************
|
|
CTL_Editor_Control * p_clControl = m_pub_clEnvControlList.m_fn_pclAddVectorControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, "Min" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedEnvBox );
|
|
|
|
p_clControl = m_pub_clEnvControlList.m_fn_pclAddVectorControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, "Max" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedEnvBox );
|
|
|
|
//*** Sphere Center ****************
|
|
p_clControl = m_pub_clEnvControlList.m_fn_pclAddVectorControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, "Center" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedEnvSphere );
|
|
|
|
//*** Sphere radius ******************************************
|
|
p_clControl = m_pub_clEnvControlList.m_fn_pclAddDecimalControl( 0., MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Radius" , TRUE, 0); //ANNECY BBB
|
|
p_clControl->m_pub_fn_vSetControlCanBeDisplayedCallBack( &g_fn_bCallBackCanBeDisplayedEnvSphere );
|
|
|
|
//*** Acceleration ****************************
|
|
m_pub_clEnvControlList.m_fn_pclAddVectorControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, "Acceleration" , TRUE, 0); //ANNECY BBB
|
|
|
|
//*** Acceleration range ***********************
|
|
m_pub_clEnvControlList.m_fn_pclAddDecimalControl( MTH_C_InfinitMinus, MTH_C_InfinitPlus, sizeof(MTH_tdxReal), TPG_READWRITE, CTL_SPACING_TYPE__SINGLE_LINE, TPG_NOCHANGE, "Range" , TRUE, 0); //ANNECY BBB
|
|
|
|
CTL_fn_vSetModuleInfo("TPG", "Environment");
|
|
m_pri_fn_vCreateControl( &m_pub_clEnvControlList );
|
|
CTL_fn_vResetModuleInfo();
|
|
}
|
|
|
|
|
|
///// Realy create all controls ////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vCreateControl( CTL_Editor_ControlList * _p_clControlList )
|
|
{
|
|
CTL_Editor_Control *p_clControl = NULL;
|
|
POSITION pos = _p_clControlList->GetHeadPosition();
|
|
|
|
while( pos != NULL )
|
|
{
|
|
p_clControl = _p_clControlList->GetNext( pos );
|
|
p_clControl->m_fn_bCreateControl( m_pub_fn_p_clGetView() );
|
|
//ROMTEAM Bugs Correction (Cristian Stegaru 24/03/98)
|
|
if (CTL_DATA_TYPE__ENUM == p_clControl->m_pub_fn_tdeGetDataType())
|
|
{
|
|
((CTL_Editor_EnumControl *)p_clControl)->m_fn_iSetCanISelect_CallBack (g_fnCanISelectThisItemCallBack);
|
|
}
|
|
//ENDROMTEAM Bugs Correction (Cristian Stegaru)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
=======================================================================================
|
|
function to Manage all EnumDescriptors and Masks
|
|
=======================================================================================
|
|
*/
|
|
|
|
///// General function ////////////////////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vBuildAllEnumDescriptors()
|
|
{
|
|
m_pri_fn_vBuildChangingEnumDescriptors();
|
|
m_pri_fn_vBuildConstantEnumDescriptors();
|
|
m_pri_fn_vBuildConstantMasks();
|
|
}
|
|
|
|
///// Build changing EnumDescriptors ////////////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vBuildChangingEnumDescriptors()
|
|
{
|
|
//*** Generator : associated source **************
|
|
CTL_Editor_EnumDescriptor *p_clEnumGeneratorSource = new CTL_Editor_EnumDescriptor( "Generator_Source", sizeof(long) );
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumGeneratorSource );
|
|
|
|
//*** Generator : associated system **************
|
|
CTL_Editor_EnumDescriptor *p_clEnumGeneratorSystem = new CTL_Editor_EnumDescriptor( "Generator_System", sizeof(long) );
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumGeneratorSystem );
|
|
|
|
//*** Generator : associated environment ******
|
|
CTL_Editor_EnumDescriptor *p_clEnumGeneratorEnv = new CTL_Editor_EnumDescriptor( "Generator_Env", sizeof(long) );
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumGeneratorEnv );
|
|
|
|
//*** Generator : linked generator **************
|
|
CTL_Editor_EnumDescriptor *p_clEnumGeneratorLinkedGenerator = new CTL_Editor_EnumDescriptor( "Generator_LinkedGenerator", sizeof(long) );
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumGeneratorLinkedGenerator );
|
|
|
|
//*** System : GameMaterials ********************************
|
|
CTL_Editor_EnumDescriptor *p_clEnumSystemObjectsGameMaterials = new CTL_Editor_EnumDescriptor( "System_ObjectsGameMaterials", sizeof(long) );
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumSystemObjectsGameMaterials );
|
|
|
|
//*** System : Sprites *************************
|
|
CTL_Editor_EnumDescriptor *p_clEnumSystemSprites = new CTL_Editor_EnumDescriptor( "System_Sprites", sizeof(long) );
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumSystemSprites );
|
|
|
|
m_pub_fn_vUpdateChangingEnumDescriptors();
|
|
}
|
|
|
|
///// Update the changing EnumDescriptors //////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vUpdateChangingEnumDescriptors()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
CTL_Editor_EnumDescriptor *p_clEnumDescriptor;
|
|
CPA_BaseObjectList *p_clList;
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
//*** Generator : associated source *********
|
|
p_clEnumDescriptor = m_pri_clEnumDescriptorList.m_fn_pclGetEnumDescriptorByName( "Generator_Source" );
|
|
p_clList = g_pclInterface->GetMainWorld()->fn_p_oGetOriginalObjectList( C_szPartGenSourceName );
|
|
m_pri_fn_vFillEnumDescriptorWithBaseObjectList( p_clEnumDescriptor, p_clList );
|
|
|
|
//*** Generator : associated system *********
|
|
p_clEnumDescriptor = m_pri_clEnumDescriptorList.m_fn_pclGetEnumDescriptorByName( "Generator_System" );
|
|
p_clList = g_pclInterface->GetMainWorld()->fn_p_oGetOriginalObjectList( C_szPartGenSystemName );
|
|
m_pri_fn_vFillEnumDescriptorWithBaseObjectList( p_clEnumDescriptor, p_clList );
|
|
|
|
//*** Generator : associated environment ******
|
|
p_clEnumDescriptor = m_pri_clEnumDescriptorList.m_fn_pclGetEnumDescriptorByName( "Generator_Env" );
|
|
p_clList = g_pclInterface->GetMainWorld()->fn_p_oGetOriginalObjectList( C_szPartGenEnvName );
|
|
m_pri_fn_vFillEnumDescriptorWithBaseObjectList( p_clEnumDescriptor, p_clList );
|
|
|
|
//*** Generator : linked generator ******
|
|
p_clEnumDescriptor = m_pri_clEnumDescriptorList.m_fn_pclGetEnumDescriptorByName( "Generator_LinkedGenerator" );
|
|
p_clList = g_pclInterface->GetMainWorld()->fn_p_oGetOriginalObjectList( C_szPartGenGeneratorName );
|
|
m_pri_fn_vFillEnumDescriptorWithBaseObjectList( p_clEnumDescriptor, p_clList );
|
|
|
|
//*** System : GameMaterials ******************
|
|
p_clEnumDescriptor = m_pri_clEnumDescriptorList.m_fn_pclGetEnumDescriptorByName( "System_ObjectsGameMaterials" );
|
|
m_pri_fn_vFillEnumDescriptorWithLinkTable( p_clEnumDescriptor, GMT_fn_p_stGetLinkTable() );
|
|
|
|
//*** System : Sprites ************************
|
|
p_clEnumDescriptor = m_pri_clEnumDescriptorList.m_fn_pclGetEnumDescriptorByName( "System_Sprites" );
|
|
m_pri_fn_vFillEnumDescriptorWithList( p_clEnumDescriptor, &m_pub_clListOfSprites );
|
|
}
|
|
|
|
///// Build Constant EnumDescriptors //////////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vBuildConstantEnumDescriptors()
|
|
{
|
|
//*** Source : Generation Mode ************************
|
|
CTL_Editor_EnumDescriptor *p_clEnumSourceGenerationMode = new CTL_Editor_EnumDescriptor( "Source_GenerationMode", 1 );
|
|
p_clEnumSourceGenerationMode->m_fn_pclAddElement( "No Generation", PRT_C_ucNoGeneration, C_szNoGeneration);
|
|
p_clEnumSourceGenerationMode->m_fn_pclAddElement( "Continous", PRT_C_ucContinousGeneration, C_szContinuousGeneration);
|
|
p_clEnumSourceGenerationMode->m_fn_pclAddElement( "Probabilist", PRT_C_ucProbabilistGeneration, C_szProbabilistGeneration);
|
|
p_clEnumSourceGenerationMode->m_fn_pclAddElement( "Crenel", PRT_C_ucCrenelGeneration, C_szCrenelGeneration);
|
|
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumSourceGenerationMode );
|
|
|
|
//*** Source : Nb Particles to Generate Mode ***********
|
|
CTL_Editor_EnumDescriptor *p_clEnumSourceNbParticlesMode = new CTL_Editor_EnumDescriptor( "Source_NbParticlesMode", 1 );
|
|
p_clEnumSourceNbParticlesMode->m_fn_pclAddElement( "Constant", PRT_C_ucConstantNb, C_szConstantNb);
|
|
p_clEnumSourceNbParticlesMode->m_fn_pclAddElement( "Probabilist", PRT_C_ucProbabilistNb, C_szProbabilistNb);
|
|
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumSourceNbParticlesMode );
|
|
|
|
//*** Source : Geometry Mode ************************
|
|
CTL_Editor_EnumDescriptor *p_clEnumSourceGeometryMode = new CTL_Editor_EnumDescriptor( "Source_GeometryMode", 1 );
|
|
p_clEnumSourceGeometryMode->m_fn_pclAddElement( "Point", PRT_C_ucPoint, C_szPoint);
|
|
p_clEnumSourceGeometryMode->m_fn_pclAddElement( "Quad", PRT_C_ucQuad, C_szQuad);
|
|
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumSourceGeometryMode );
|
|
|
|
//*** Source : Link Mode ************************
|
|
CTL_Editor_EnumDescriptor *p_clEnumSourceLinkMode = new CTL_Editor_EnumDescriptor( "Source_LinkMode", 1 );
|
|
p_clEnumSourceLinkMode->m_fn_pclAddElement( "Rotation", PRT_C_ucRotationLink, C_szRotationLink);
|
|
p_clEnumSourceLinkMode->m_fn_pclAddElement( "Translation", PRT_C_ucTranslationLink, C_szTranslationLink);
|
|
p_clEnumSourceLinkMode->m_fn_pclAddElement( "Rotation and Translation", PRT_C_ucRotAndTransLink, C_szRotationAndTranslationLink);
|
|
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumSourceLinkMode );
|
|
|
|
//*** Source : Life Mode ************************
|
|
CTL_Editor_EnumDescriptor *p_clEnumSourceLifeMode = new CTL_Editor_EnumDescriptor( "Source_LifeMode", 1 );
|
|
p_clEnumSourceLifeMode->m_fn_pclAddElement( "Infinit", PRT_C_ucNoLifeTime, C_EntryPrtSrcNoLifeTime);
|
|
p_clEnumSourceLifeMode->m_fn_pclAddElement( "Constant", PRT_C_ucConstantLifeTime, C_EntryPrtSrcConstantLifeTime);
|
|
p_clEnumSourceLifeMode->m_fn_pclAddElement( "Probabilist", PRT_C_ucProbabilistLifeTime, C_EntryPrtSrcProbabilistLifeTime);
|
|
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumSourceLifeMode );
|
|
|
|
//*** System : Objects Type ************************
|
|
CTL_Editor_EnumDescriptor *p_clEnumSystemObjectsType = new CTL_Editor_EnumDescriptor( "System_ObjectsType", sizeof(ACP_tdxIndex) );
|
|
p_clEnumSystemObjectsType->m_fn_pclAddElement( "Null", PRT_C_xNullParticles, "" );
|
|
p_clEnumSystemObjectsType->m_fn_pclAddElement( "Bubble", PRT_C_xBubbleParticles, "" );
|
|
p_clEnumSystemObjectsType->m_fn_pclAddElement( "Point", PRT_C_xPointParticles, C_EntryPrtSysCreatePoint );
|
|
p_clEnumSystemObjectsType->m_fn_pclAddElement( "Segment", PRT_C_xSegmentParticles, C_EntryPrtSysCreateSegment );
|
|
p_clEnumSystemObjectsType->m_fn_pclAddElement( "Sprite", PRT_C_xSpriteParticles, C_EntryPrtSysCreateSprite );
|
|
p_clEnumSystemObjectsType->m_fn_pclAddElement( "Triangle", PRT_C_xTriangleParticles, "" );
|
|
p_clEnumSystemObjectsType->m_fn_pclAddElement( "Rectangle", PRT_C_xRectangleParticles, "" );
|
|
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumSystemObjectsType );
|
|
|
|
|
|
//*** Environment Type ****************
|
|
CTL_Editor_EnumDescriptor *p_clEnumEnvType = new CTL_Editor_EnumDescriptor( "Env_Type", sizeof(long) );
|
|
p_clEnumEnvType->m_fn_pclAddElement( "Box", PRT_C_ulAlignedBoxEnv, C_szAlignedBox );
|
|
p_clEnumEnvType->m_fn_pclAddElement( "Sphere", PRT_C_ulSphereEnv, C_szSphere );
|
|
|
|
m_pri_clEnumDescriptorList.AddTail( p_clEnumEnvType );
|
|
}
|
|
|
|
///// Build Constant Masks //////////////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vBuildConstantMasks()
|
|
{
|
|
CTL_Editor_MaskDescriptor *p_clMaskDescriptor;
|
|
|
|
//*** Generator : environment mask
|
|
p_clMaskDescriptor = new CTL_Editor_MaskDescriptor ( "Generator_Mask_Env" );
|
|
p_clMaskDescriptor->m_pub_fn_pclAddMask( "Water", C_lEnvironmentWater );
|
|
p_clMaskDescriptor->m_pub_fn_pclAddMask( "Air", C_lEnvironmentAir );
|
|
m_pri_clMaskDescriptorList.AddTail( p_clMaskDescriptor );
|
|
|
|
p_clMaskDescriptor = new CTL_Editor_MaskDescriptor ( "Generator_Mask_LinkedGen" );
|
|
p_clMaskDescriptor->m_pub_fn_pclAddMask( "Reset speed", 1 );
|
|
m_pri_clMaskDescriptorList.AddTail( p_clMaskDescriptor );
|
|
}
|
|
|
|
///// Find an EnumDescriptor using a name ////////
|
|
CTL_Editor_EnumDescriptor * CPA_PartGen_MyDocument::m_pub_fn_p_clGetEnumDescriptorByName( CString _csName )
|
|
{
|
|
return m_pri_clEnumDescriptorList.m_fn_pclGetEnumDescriptorByName( _csName );
|
|
}
|
|
|
|
///// Find a mask using a name ///////////////////
|
|
CTL_Editor_MaskDescriptor * CPA_PartGen_MyDocument::m_pub_fn_p_clGetMaskDescriptorByName( CString _csName )
|
|
{
|
|
return m_pri_clMaskDescriptorList.m_fn_pclGetMaskDescriptorByName( _csName );
|
|
}
|
|
|
|
|
|
///// Fill an EnumDescriptor using a BaseObjectList ///////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vFillEnumDescriptorWithBaseObjectList
|
|
(
|
|
CTL_Editor_EnumDescriptor *_p_clEnumDescriptor,
|
|
CPA_BaseObjectList * _p_clList
|
|
)
|
|
{
|
|
CPA_BaseObject *p_clObj = NULL;
|
|
Position pos = _p_clList->GetHeadPosition();
|
|
|
|
_p_clEnumDescriptor->m_fn_vEmptyList();
|
|
|
|
_p_clEnumDescriptor->m_fn_pclAddElement( "No Element", NULL );
|
|
while( pos != NULL )
|
|
{
|
|
p_clObj = _p_clList->GetNext( pos );
|
|
_p_clEnumDescriptor->m_fn_pclAddElement( p_clObj->GetName(), (long)p_clObj->GetData(), "", (void*)p_clObj );
|
|
}
|
|
}
|
|
|
|
///// Fill an EnumDescriptor using a LinkTable ///////////////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vFillEnumDescriptorWithLinkTable( CTL_Editor_EnumDescriptor *_p_clEnumDescriptor, SCR_tdst_Link_Table *_p_stLinkTable )
|
|
{
|
|
unsigned int uiPos = 0;
|
|
SCR_tdst_Link_Value *p_stValue;
|
|
|
|
//*** reset combo *********
|
|
_p_clEnumDescriptor->m_fn_vEmptyList();
|
|
|
|
//*** Get first element
|
|
SCR_M_DyAr_GetNextElement
|
|
(
|
|
SCR_tdst_Link_Value,
|
|
uiPos,
|
|
p_stValue,
|
|
SCR_M_st_Link_GetDynamicArray(_p_stLinkTable)
|
|
)
|
|
|
|
_p_clEnumDescriptor->m_fn_pclAddElement( "No Element", NULL );
|
|
while( p_stValue != NULL ) //p_sValue is NULL at the end of the array
|
|
{
|
|
/* Test current retrieved value */
|
|
if( SCR_M_e_Link_GetState(p_stValue) == SCR_ELS_Link_Initialized )
|
|
{
|
|
void *p_vEntry = (void*)SCR_M_ul_Link_GetValue(p_stValue);
|
|
|
|
//*** Gets the Name for the Card ***********************
|
|
CString csObjectName(SCR_M_p_sz_Link_GetKey(p_stValue));
|
|
|
|
char a_256cFileName[256];
|
|
char a_256cActionName[256];
|
|
char a_256cName[256];
|
|
SCR_fn_v_RdL0_SplitSectionName((char *)LPCTSTR(csObjectName), a_256cFileName, a_256cActionName, a_256cName);
|
|
|
|
csObjectName = a_256cName;
|
|
|
|
//*** fills combo ******************************
|
|
_p_clEnumDescriptor->m_fn_pclAddElement( csObjectName, (long)p_vEntry );
|
|
}
|
|
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement
|
|
(
|
|
SCR_tdst_Link_Value,
|
|
uiPos,
|
|
p_stValue,
|
|
SCR_M_st_Link_GetDynamicArray(_p_stLinkTable)
|
|
)
|
|
}
|
|
}
|
|
|
|
///// Fill an EnumDescriptor using a list of sprites ////////////
|
|
void CPA_PartGen_MyDocument::m_pri_fn_vFillEnumDescriptorWithList( CTL_Editor_EnumDescriptor *_p_clEnumDescriptor, CList<TPG_Sprite*,TPG_Sprite*>*_p_ListOfSprite )
|
|
{
|
|
_p_clEnumDescriptor->m_fn_vEmptyList();
|
|
|
|
POSITION pos = _p_ListOfSprite->GetHeadPosition();
|
|
|
|
_p_clEnumDescriptor->m_fn_pclAddElement( "No Sprite", NULL, "", NULL );
|
|
while( pos != NULL ) //pos is null at the end
|
|
{
|
|
TPG_Sprite *p_Sprite = _p_ListOfSprite->GetNext( pos );
|
|
_p_clEnumDescriptor->m_fn_pclAddElement( p_Sprite->m_pub_fn_csGetName(), (long)p_Sprite->m_pub_fn_hGetSprite(), "", (void*)p_Sprite );
|
|
}
|
|
}
|
|
|
|
/*
|
|
=======================================================================================
|
|
function to Fill internal data
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : parse Sprites particle script to find all sprites
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void CPA_PartGen_MyDocument::m_pub_fn_vFillListOfSprites()
|
|
{
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
char szFileName[ _MAX_PATH ];
|
|
SCR_tdst_File_Open *p_stFile;
|
|
unsigned int uiPos;
|
|
SCR_tdst_Anl_SectionDes_ *p_stValue;
|
|
ACP_tdxHandleOfSprite hSprite;
|
|
SCR_tdst_Link_Value *p_stLink;
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
sprintf( szFileName, "%s\\%s", C_szEffectPath, C_szSpritesFileName );
|
|
|
|
if ( _access( szFileName, 4) != 0 )
|
|
return; // file doesn't have read attirubutes, so stop parse operation
|
|
|
|
//Gets all the sections in the corresponding file
|
|
SCR_fn_v_RdL0_OpenFile(szFileName);
|
|
|
|
//Gets a pointer on the file
|
|
p_stFile = SCR_fnp_st_RdL0_GetOpenFile( szFileName );
|
|
|
|
// Get first element of array
|
|
uiPos = 0;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Anl_SectionDes_, uiPos, p_stValue, p_stFile->stSectionsDes )
|
|
|
|
while( p_stValue != NULL )
|
|
{
|
|
if (stricmp( p_stValue->stBuffers.p_szBufferName, GLI_C_SectionSprite) == 0)
|
|
{
|
|
/*
|
|
* compute sprite full name and search it in sprite link table
|
|
*/
|
|
sprintf( szFileName, "%s\\%s", C_szEffectPath, p_stValue->stBuffers.p_szBufferName );
|
|
p_stLink = SCR_fnp_st_Link_SearchKey( GLI_p_stGetLinkTableOfSprite(), szFileName );
|
|
|
|
if( p_stLink != NULL )
|
|
hSprite = (ACP_tdxHandleOfSprite) SCR_M_ul_Link_GetValue ( p_stLink );
|
|
else
|
|
hSprite = NULL;
|
|
|
|
m_pub_clListOfSprites.AddTail( new TPG_Sprite( p_stValue->stBuffers.p_szBufferNameExt, hSprite ) );
|
|
}
|
|
|
|
/* Get next element */
|
|
uiPos++;
|
|
SCR_M_DyAr_GetNextElement(SCR_tdst_Anl_SectionDes_, uiPos, p_stValue, p_stFile->stSectionsDes )
|
|
}
|
|
}
|