Add rayman2 source files
This commit is contained in:
58
Rayman_X/cpa/tempgrp/TFa/src/CPACHANL.cpp
Normal file
58
Rayman_X/cpa/tempgrp/TFa/src/CPACHANL.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/*=============================================================================
|
||||
*
|
||||
* Filename: CPAChanl.cpp
|
||||
* Version: 1.0
|
||||
* Date: 03/11/97
|
||||
* Author: Marc Trabucato
|
||||
*
|
||||
* Description: implementation of CPA_Channel class (decendant of CPA_SaveObject)
|
||||
* that contains description of a channel
|
||||
*
|
||||
*===========================================================================*/
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
|
||||
#include "stdafx.h"
|
||||
// ALX
|
||||
#include "ACP_Base.h"
|
||||
#include "TFA.h"
|
||||
#include "x:\cpa\main\inc\_editid.h"
|
||||
|
||||
/*=============================================================================
|
||||
* class CPA_Channel
|
||||
=============================================================================*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : constructor (call CPA_SaveObject constructor)
|
||||
*---------------------------------------------------------------------------*/
|
||||
CPA_Channel::CPA_Channel(CPA_EditorBase *_p_oEditor, CPA_Family *_p_oOwnerFamily, char *_szChannelName, long _lChannelNumber)
|
||||
:CPA_SaveObject(_p_oEditor, C_szChannelTypeName, E_ss_NoSave, _p_oOwnerFamily, TRUE, NULL, NULL)
|
||||
{
|
||||
// Section init & File Section Init
|
||||
char szReferencedSectionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
strcat( szReferencedSectionName, _p_oOwnerFamily -> fn_p_szGetName() );
|
||||
strcat( szReferencedSectionName, "-" );
|
||||
strcat( szReferencedSectionName, _szChannelName );
|
||||
|
||||
SetReferencedSectionName( szReferencedSectionName );
|
||||
SetSectionData( NULL );
|
||||
// Name
|
||||
if( fn_eRename( _szChannelName ? _szChannelName : "" ) != E_mc_None )
|
||||
SetDefaultValidName();
|
||||
|
||||
// init data
|
||||
m_lChannelNumber = _lChannelNumber;
|
||||
}
|
||||
|
||||
/* -----------------03/11/97 10:27-------------------
|
||||
*
|
||||
* --------------------------------------------------*/
|
||||
CString CPA_Channel::fn_csComputeReferencedSectionName(const CString csNewName)
|
||||
{
|
||||
CString csSectionName;
|
||||
|
||||
csSectionName = GetOwner() -> GetName() + "-" + csNewName;
|
||||
return csSectionName;
|
||||
}
|
||||
|
||||
#endif /* ACTIVE_EDITOR */
|
497
Rayman_X/cpa/tempgrp/TFa/src/CPAFAMIL.cpp
Normal file
497
Rayman_X/cpa/tempgrp/TFa/src/CPAFAMIL.cpp
Normal file
@@ -0,0 +1,497 @@
|
||||
/*=============================================================================
|
||||
*
|
||||
* Filename: CPAFamil.cpp
|
||||
* Version: 1.0
|
||||
* Date: 30/12/96
|
||||
* Author: Marc Trabucato & Vincent Lhullier
|
||||
*
|
||||
* Description: implementation of CPA_Family class
|
||||
* that contains description of a family (name, anims, actions )
|
||||
*
|
||||
*===========================================================================*/
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
|
||||
#include "stdafx.h"
|
||||
// ALX
|
||||
#include "ACP_Base.h"
|
||||
#include "TAC.h"
|
||||
#include "OZO.h"
|
||||
#include "DPT.h"
|
||||
// End ALX
|
||||
#include "TFA.h"
|
||||
#include "x:\cpa\main\inc\_editid.h"
|
||||
#include "FAInterf.hpp"
|
||||
|
||||
#define M_Char(string) (char*)(LPCTSTR)(string)
|
||||
#define M_FileExists(szFileName) ( ! _access( szFileName, 0 ) )
|
||||
|
||||
//
|
||||
static CPA_EditorBase *gs_p_oAnimationDLL;
|
||||
static CPA_EditorBase *gs_p_oMecaDLL;
|
||||
static CPA_EditorBase *gs_p_oTGMDLL;
|
||||
static CPA_EditorBase *gs_p_oActionDLL;
|
||||
static CPA_EditorBase *gs_p_oActorDLL;
|
||||
static CPA_EditorBase *gs_p_oObjectTableDLL;
|
||||
static CPA_EditorBase *gs_p_oZDxDLL;
|
||||
|
||||
/*=============================================================================
|
||||
* class CPA_Family
|
||||
=============================================================================*/
|
||||
void del(tdxHandleToFamilyList h)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
DeclareTemplateStatic(tdxHandleToFamilyList);
|
||||
|
||||
void CPA_Family::Init()
|
||||
{
|
||||
// register section for SCRIPT analysis
|
||||
// SCR_fn_v_RdL0_RegisterCallback( "A3dChannelNames", CPA_Family::fn_CallBackChannelsSection, SCR_CRC_c_RdL0_ForSection );
|
||||
CPA_EdMot<tdxHandleToFamilyList>::Init(NULL,NULL,del);
|
||||
}
|
||||
|
||||
void CPA_Family::InitStatic(CPA_MainWorld *_p_oMainWorld)
|
||||
{
|
||||
gs_p_oAnimationDLL = _p_oMainWorld -> GetToolDLLWithName(C_szDLLAnimationName);
|
||||
gs_p_oMecaDLL = _p_oMainWorld -> GetToolDLLWithName(C_szDLLMecaName);
|
||||
gs_p_oTGMDLL = _p_oMainWorld -> GetToolDLLWithName(C_szDLLMaterialName);
|
||||
gs_p_oActionDLL = _p_oMainWorld -> GetToolDLLWithName(C_szDLLActionName);
|
||||
gs_p_oActorDLL = _p_oMainWorld -> GetObjectDLLWithName(C_szDLLActorName);
|
||||
gs_p_oObjectTableDLL = _p_oMainWorld -> GetToolDLLWithName(C_szDLLObjectTableName);
|
||||
gs_p_oZDxDLL = _p_oMainWorld -> GetObjectDLLWithName(C_szDLLZDxName);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : constructor (call CPA_ReachableObject constructor)
|
||||
*---------------------------------------------------------------------------*/
|
||||
CPA_Family::CPA_Family(CPA_EditorBase *_p_oEditor, tdxHandleToFamilyList _hEngineFamily, char *_szFamilyName /*=NULL*/)
|
||||
:CPA_SaveObject(_p_oEditor, C_szFamilyTypeName, E_ss_Responsible, NULL, FALSE, fn_szGetFamiliesDataPath(), CPA_Family::mfn_vCallBackSave),
|
||||
CPA_EdMot<tdxHandleToFamilyList>(_hEngineFamily)
|
||||
{
|
||||
// Section init & File Section Init
|
||||
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szCompleteFileName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szReferencedSectionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
strcpy( szFileName, _szFamilyName );
|
||||
strcat( szFileName, "\\" );
|
||||
strcat( szFileName, _szFamilyName );
|
||||
strcat( szFileName, ".bdv" );
|
||||
|
||||
SCR_fn_v_RdL0_ComputeSectionName( szReferencedSectionName, szFileName, "SetBoundingVolume", NULL);
|
||||
SetReferencedSectionName( szReferencedSectionName );
|
||||
SetSectionData( this );
|
||||
// Shaitan Correction {
|
||||
// get complete file name (including datapath)
|
||||
strcpy(szCompleteFileName, fn_szGetFamiliesDataPath());
|
||||
strcat(szCompleteFileName, "\\");
|
||||
strcat(szCompleteFileName, szFileName);
|
||||
// check existence
|
||||
if( ! M_FileExists( szCompleteFileName ) )
|
||||
//End Shaitan Correction }
|
||||
SetExistingSection( FALSE );
|
||||
else
|
||||
SetExistingSection( SCR_fn_c_RdL0_IsSectionExists( (char*)(LPCTSTR)GetCompleteSectionName() ) );
|
||||
// Name
|
||||
if( fn_eRename( _szFamilyName ? _szFamilyName : "" ) != E_mc_None )
|
||||
SetDefaultValidName();
|
||||
// fn_vUpdateSectionName();
|
||||
|
||||
// reset content of all list
|
||||
m_oListOfActions . RemoveAll () ;
|
||||
// Shaitan => state list in the level
|
||||
m_oListOfUsedActions . RemoveAll () ;
|
||||
// End Shaitan => state list in the level
|
||||
m_oListOfAnimations . RemoveAll () ;
|
||||
m_oListOfObjectTables.RemoveAll ();
|
||||
// Shaitan => module list in the level
|
||||
m_oListOfUsedPOs . RemoveAll () ;
|
||||
m_oListOfUsedObjectTables . RemoveAll () ;
|
||||
// End Shaitan => module list in the level
|
||||
//
|
||||
m_oListOfStates . SetEngineAnchor ( GetStruct() ? & GetStruct() -> hForStateArray : NULL ) ;
|
||||
m_p_oInitialAction = NULL;
|
||||
m_p_oZDxBoundingVolume = NULL;
|
||||
//
|
||||
m_bIsABaseFamily = FALSE;
|
||||
// Shaitan => optimisation lists in the level
|
||||
m_bMustUpdateStateList = FALSE;
|
||||
m_bMustUpdatePOList = FALSE;
|
||||
// End Shaitan => optimisation list in the level
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : destructor
|
||||
*---------------------------------------------------------------------------*/
|
||||
CPA_Family::~CPA_Family()
|
||||
{
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : set engine struct
|
||||
*---------------------------------------------------------------------------*/
|
||||
void CPA_Family::SetStruct( tdxHandleToFamilyList _hFamily)
|
||||
{
|
||||
CPA_EdMot<tdxHandleToFamilyList>::SetStruct( _hFamily );
|
||||
|
||||
m_oListOfStates . SetEngineAnchor ( GetStruct() ? & GetStruct() -> hForStateArray : NULL ) ;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Description : load family
|
||||
// ----------------------------------------------------------------------------
|
||||
void CPA_Family::mfn_vLoad(void)
|
||||
{
|
||||
if( ! fn_bIsAvailable() )
|
||||
{
|
||||
char *szFamilyName = fn_p_szGetName();
|
||||
char szName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
CPA_Interface *p_oInterface = GetMainWorld() -> GetInterface();
|
||||
BOOL bPreviousLoadingWorld = p_oInterface -> fn_bIsLoadingWorld();
|
||||
|
||||
tdObjectType otFamily = fn_otFindOrAddFamilyTypeOfFamilyTypeName( szFamilyName );
|
||||
tdxHandleToFamilyList hFamily = fn_hFindOrAddFAmily(otFamily);
|
||||
|
||||
fn_vUpdateData( hFamily );
|
||||
SetStruct( hFamily );
|
||||
|
||||
p_oInterface -> SetLoadingWorld( TRUE );
|
||||
|
||||
// update mechanics & GameMaterial (when load new Family)
|
||||
if( ! ((TFamily_Interface*)GetEditor()) -> m_bLevelLoad )
|
||||
{
|
||||
// Load animations
|
||||
if (gs_p_oAnimationDLL != NULL)
|
||||
gs_p_oAnimationDLL->OnQueryAction(GetEditor() , C_cLoadAllAnimsAction, (LPARAM) this);
|
||||
|
||||
// send message to TME
|
||||
if (gs_p_oMecaDLL != NULL)
|
||||
gs_p_oMecaDLL->OnQueryAction(GetEditor() , Cw_TME_Query_updateAfterLoading, (LPARAM) 0);
|
||||
|
||||
// send Textures to 3D Card
|
||||
GLI_vEndofGeometricLoad();
|
||||
|
||||
// send message to TGM (GameMaterial Tool)
|
||||
if( gs_p_oTGMDLL )
|
||||
gs_p_oTGMDLL -> OnQueryAction( (CPA_DLLBase*)this, (WPARAM)C_cCreateNewGameMaterial, 0);
|
||||
}
|
||||
|
||||
// Load Actions
|
||||
if (gs_p_oActionDLL != NULL)
|
||||
gs_p_oActionDLL->OnQueryAction(GetEditor() , C_uiLoadAllActions, (LPARAM) this);
|
||||
|
||||
// Load all the lists of names of the family
|
||||
if (gs_p_oActorDLL != NULL)
|
||||
gs_p_oActorDLL->OnQueryAction(GetEditor() , C_uiActor_LoadNamesList , (LPARAM) this);
|
||||
|
||||
// Update All ZAList
|
||||
if (gs_p_oActionDLL != NULL)
|
||||
gs_p_oActionDLL->OnQueryAction(GetEditor() , C_uiUpdateZAList, (LPARAM) this);
|
||||
|
||||
// Load all table object of the family
|
||||
if (gs_p_oObjectTableDLL != NULL)
|
||||
gs_p_oObjectTableDLL->OnQueryAction(GetEditor() , C_uiLoadFamilyObjectTables, (LPARAM) this);
|
||||
|
||||
// get Bounding volume
|
||||
if( GetStruct() )
|
||||
{
|
||||
ACP_tdxHandleOfObject hBdVl = fn_vGetGeometricSphereOfFamily( GetStruct() );
|
||||
SCR_tdst_Link_Table *p_LinkTable = GLI_p_stGetLinkTableOfGeometric();
|
||||
SCR_tdst_Link_Value *p_LinkValue = hBdVl ? SCR_fnp_st_Link_SearchValue(p_LinkTable,(unsigned long)hBdVl) : NULL;
|
||||
char *szLinkName = p_LinkValue ? SCR_M_p_sz_Link_GetKey( p_LinkValue ) : NULL;
|
||||
|
||||
if( hBdVl && gs_p_oZDxDLL && szLinkName )
|
||||
{
|
||||
tdstCreateZoneMess stZoneMess;
|
||||
|
||||
SCR_fn_v_RdL0_SplitSectionName( szLinkName , NULL, NULL, szName );
|
||||
stZoneMess . csTypeName = C_szBoundingVolumeName;
|
||||
stZoneMess . hEngineZone = hBdVl;
|
||||
stZoneMess . csName = szName;
|
||||
stZoneMess . pOwner = this;
|
||||
stZoneMess . szDataPath = GetDataPath();
|
||||
stZoneMess . csReferenceSectionName = szLinkName + strlen( stZoneMess . szDataPath ) + 1;
|
||||
|
||||
m_p_oZDxBoundingVolume = (CPA_BaseObject*)gs_p_oZDxDLL -> OnQueryAction( GetEditor(), C_uiQueryCreateZDxObject, (LPARAM) & stZoneMess );
|
||||
}
|
||||
}
|
||||
// load Channels Names
|
||||
mfn_vFillChannelNamesList();
|
||||
// ACZ file
|
||||
mfn_vInitACZFile();
|
||||
p_oInterface -> SetLoadingWorld( bPreviousLoadingWorld );
|
||||
}
|
||||
SetAvailable( TRUE );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Description : return animation of given name
|
||||
// ----------------------------------------------------------------------------
|
||||
CPA_Animation* CPA_Family::mfn_p_oGetAnimation( CString _csAnimName )
|
||||
{
|
||||
CPA_Animation *p_oResult = NULL;
|
||||
POSITION stPos = m_oListOfAnimations . GetHeadPosition();
|
||||
while( stPos )
|
||||
{
|
||||
CPA_Animation *p_oAnimation = m_oListOfAnimations . GetNext ( stPos ) ;
|
||||
if( ! _csAnimName . CompareNoCase( p_oAnimation -> GetName() ) )
|
||||
{
|
||||
p_oResult = p_oAnimation;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return p_oResult;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Description : return action of given name
|
||||
// ----------------------------------------------------------------------------
|
||||
CPA_Action* CPA_Family::mfn_p_oGetAction( CString _csActionName )
|
||||
{
|
||||
CPA_Action *p_oResult = NULL;
|
||||
POSITION stPos = m_oListOfActions . GetHeadPosition();
|
||||
while( stPos )
|
||||
{
|
||||
CPA_Action *p_oAction = m_oListOfActions . GetNext ( stPos ) ;
|
||||
if( ! p_oAction -> GetName() . CompareNoCase( _csActionName ) )
|
||||
{
|
||||
p_oResult = p_oAction;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return p_oResult;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Description : return state of given name
|
||||
// ----------------------------------------------------------------------------
|
||||
CPA_State* CPA_Family::mfn_p_oGetState( CString _csStateName )
|
||||
{
|
||||
CPA_State *p_oResult = NULL;
|
||||
POSITION stPos = m_oListOfStates . GetHeadPosition();
|
||||
while( stPos )
|
||||
{
|
||||
CPA_State *p_oState = m_oListOfStates . GetNext ( stPos ) ;
|
||||
if( ! p_oState -> GetName() . CompareNoCase ( _csStateName ) )
|
||||
{
|
||||
p_oResult = p_oState;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return p_oResult;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Description : return objecttable of given name
|
||||
// ----------------------------------------------------------------------------
|
||||
EditorObjectTable* CPA_Family::mfn_p_oGetObjectTable( CString _csObjectTableName )
|
||||
{
|
||||
EditorObjectTable *p_oResult = NULL;
|
||||
POSITION stPos = m_oListOfObjectTables . GetHeadPosition();
|
||||
while( stPos )
|
||||
{
|
||||
EditorObjectTable *p_oObjectTable = m_oListOfObjectTables . GetNext ( stPos ) ;
|
||||
if( ! p_oObjectTable -> GetName() . CompareNoCase( _csObjectTableName ) )
|
||||
{
|
||||
p_oResult = p_oObjectTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return p_oResult;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : save Bounding Volume on SCRIPT File .bdv
|
||||
*---------------------------------------------------------------------------*/
|
||||
void CPA_Family::mfn_vCallBackSave( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName,
|
||||
void *_p_vData, SCR_tde_Ntfy_Action _eAction)
|
||||
{
|
||||
CPA_Family *p_oFamily = (CPA_Family*)_p_vData;
|
||||
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szSectionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
|
||||
switch ( _eAction )
|
||||
{
|
||||
case SCR_EA_Ntfy_AddSection:
|
||||
case SCR_EA_Ntfy_RebuildSection:
|
||||
if( p_oFamily -> m_p_oZDxBoundingVolume != NULL )
|
||||
{
|
||||
SCR_fn_v_RdL0_SplitSectionName( _p_szSectionName, NULL, szActionName, NULL );
|
||||
// compute Section name
|
||||
SCR_fn_v_RdL0_ComputeSectionName(szSectionName, NULL, szActionName, NULL );
|
||||
// save begin section
|
||||
SCR_M_SvL0_SaveBeginSection( _p_stFile, szSectionName, SCR_CC_C_Cfg_EOL );
|
||||
// save entry
|
||||
SCR_M_SvL0_SaveEntry( _p_stFile, "BoundingVolume", SCR_CC_C_Cfg_NoChar );
|
||||
SCR_fn_v_RdL0_ComputeSectionName( szSectionName, "*" , "Geometric", p_oFamily -> m_p_oZDxBoundingVolume -> fn_p_szGetName() );
|
||||
SCR_fn_v_SvL0_SaveParameters_MP( _p_stFile, SCR_EF_SvL0_Normal, 1, szSectionName );
|
||||
// End Section
|
||||
SCR_M_SvL0_SaveEndSection( _p_stFile, SCR_CC_C_Cfg_EOL ) ;
|
||||
SCR_M_SvL0_SaveBlankLine( _p_stFile ) ;
|
||||
// update existing section
|
||||
p_oFamily -> fn_vSectionSaved();
|
||||
}
|
||||
break;
|
||||
case SCR_EA_Ntfy_DeleteSection:
|
||||
p_oFamily -> fn_vSectionDeleted();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : load callback for "BaseFamily" section in .ACE file
|
||||
*---------------------------------------------------------------------------*/
|
||||
SCR_tde_Anl_ReturnValue CPA_Family::mfn_CallbackLoadBaseFamilySection
|
||||
( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction )
|
||||
{
|
||||
CPA_Family * p_oFamily;
|
||||
SCR_M_RdL0_GetContextLong(0, 0, CPA_Family*, p_oFamily);
|
||||
|
||||
switch (_eAction)
|
||||
{
|
||||
case SCR_EA_Anl_BeginSection: if (_p_szName && stricmp (_p_szName , "TRUE" ) == 0) p_oFamily -> m_bIsABaseFamily = TRUE;
|
||||
else
|
||||
if (_p_szName && stricmp (_p_szName , "FALSE") == 0) p_oFamily -> m_bIsABaseFamily = FALSE;
|
||||
else ASSERT (0);
|
||||
break;
|
||||
}
|
||||
|
||||
return SCR_ERV_Anl_NormalReturn;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description :
|
||||
*---------------------------------------------------------------------------*/
|
||||
void CPA_Family::mfn_vFillChannelNamesList(void)
|
||||
{
|
||||
unsigned int uiPos;
|
||||
unsigned int uiChannelNumber;
|
||||
SCR_tdst_Link_Value *p_stValue;
|
||||
char szEntry[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char *p_cChannel;
|
||||
char *p_cCurrentFamilyName = fn_p_szGetName();
|
||||
|
||||
m_oListOfChannelsName . RemoveAll();
|
||||
|
||||
uiPos = 0;
|
||||
uiChannelNumber = 0;
|
||||
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray( & CHL_g_stLinkTable ) );
|
||||
while ( p_stValue )
|
||||
{
|
||||
if( SCR_M_e_Link_GetState( p_stValue ) == SCR_ELS_Link_Initialized)
|
||||
{
|
||||
strcpy( szEntry, SCR_M_p_sz_Link_GetKey( p_stValue ) );
|
||||
p_cChannel = strchr( szEntry, '-' );
|
||||
if ( p_cChannel )
|
||||
{
|
||||
*p_cChannel = 0;
|
||||
p_cChannel++;
|
||||
if( ! strcmpi( szEntry, p_cCurrentFamilyName ) )
|
||||
{
|
||||
CPA_Channel *p_oChannel = new CPA_Channel( GetEditor(), this, p_cChannel, SCR_M_ul_Link_GetValue( p_stValue ) );
|
||||
m_oListOfChannelsName . AddTail( CString( p_cChannel ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
uiPos++;
|
||||
SCR_M_DyAr_GetNextElement( SCR_tdst_Link_Value, uiPos, p_stValue, SCR_M_st_Link_GetDynamicArray( & CHL_g_stLinkTable ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description :
|
||||
*---------------------------------------------------------------------------*/
|
||||
void CPA_Family::mfn_vInitACZFile()
|
||||
{
|
||||
BOOL bACZFileExists = FALSE;
|
||||
BOOL bZASectionExists = FALSE;
|
||||
BOOL bZAListSectionExists = FALSE;
|
||||
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szZASectionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szZAListSectionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
|
||||
if (gs_p_oActionDLL != NULL)
|
||||
{
|
||||
CPA_BaseObjectList *p_oList = NULL;
|
||||
Position lPos;
|
||||
// search ZA
|
||||
p_oList = gs_p_oActionDLL -> GetBaseObjectList( C_szZATypeName );
|
||||
lPos = p_oList -> GetHeadPosition();
|
||||
while( lPos )
|
||||
{
|
||||
if( p_oList -> GetNext( lPos ) -> GetOwner() -> GetOwner() == (CPA_BaseObject*)this )
|
||||
{
|
||||
bZASectionExists = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// search ZAList
|
||||
p_oList = gs_p_oActionDLL -> GetBaseObjectList( C_szZAListTypeName );
|
||||
lPos = p_oList -> GetHeadPosition();
|
||||
while( lPos )
|
||||
{
|
||||
if( p_oList -> GetNext( lPos ) -> GetOwner() -> GetOwner() == (CPA_BaseObject*)this )
|
||||
{
|
||||
bZAListSectionExists = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bACZFileExists = ( bZASectionExists || bZASectionExists );
|
||||
}
|
||||
//
|
||||
sprintf( szFileName, "%s\\%s\\%s.acz", fn_szGetFamiliesDataPath(), fn_p_szGetName(), fn_p_szGetName() );
|
||||
SCR_fn_v_RdL0_ComputeSectionName( szZASectionName, szFileName, "ActivationZone", NULL);
|
||||
SCR_fn_v_RdL0_ComputeSectionName( szZAListSectionName, szFileName, "ArrayOfZoneSet", NULL);
|
||||
//
|
||||
|
||||
if( bACZFileExists || M_FileExists( szFileName ) )
|
||||
{
|
||||
// ZA section
|
||||
if( ! bZASectionExists && ! SCR_fn_c_RdL0_IsSectionExists( szZASectionName ) )
|
||||
{
|
||||
// add section
|
||||
SCR_fn_v_SvL1_RegisterNotify( szZASectionName, mfn_vCallBackSaveEmptySection, this, SCR_EA_Ntfy_AddSection );
|
||||
}
|
||||
// ZAList section
|
||||
if( ! bZAListSectionExists && ! SCR_fn_c_RdL0_IsSectionExists( szZAListSectionName ) )
|
||||
{
|
||||
// add section
|
||||
SCR_fn_v_SvL1_RegisterNotify( szZAListSectionName, mfn_vCallBackSaveEmptySection, this, SCR_EA_Ntfy_AddSection );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// add ZA section
|
||||
SCR_fn_v_SvL1_RegisterNotify( szZASectionName, mfn_vCallBackSaveEmptySection, this, SCR_EA_Ntfy_AddSection );
|
||||
// add ZAList section
|
||||
SCR_fn_v_SvL1_RegisterNotify( szZAListSectionName, mfn_vCallBackSaveEmptySection, this, SCR_EA_Ntfy_AddSection );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : create empty section
|
||||
*---------------------------------------------------------------------------*/
|
||||
void CPA_Family::mfn_vCallBackSaveEmptySection( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName,
|
||||
void *_p_vData, SCR_tde_Ntfy_Action _eAction )
|
||||
{
|
||||
CPA_Family *p_oFamily = (CPA_Family*)_p_vData;
|
||||
char szSection[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szAction[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szId[SCR_CV_ui_Cfg_MaxLenName];
|
||||
unsigned int uiLastIndent = SCR_g_ui_SvL0_IndentationLevel;
|
||||
|
||||
SCR_g_ui_SvL0_IndentationLevel = 0;
|
||||
if( _eAction == SCR_EA_Ntfy_AddSection )
|
||||
{
|
||||
SCR_fn_v_RdL0_SplitSectionName( _p_szSectionName, NULL, szAction, szId);
|
||||
SCR_fn_v_RdL0_ComputeSectionName( szSection, NULL, szAction, szId);
|
||||
SCR_M_SvL0_SaveBeginSection(_p_stFile, szSection, SCR_CC_C_Cfg_EOL );
|
||||
SCR_M_SvL0_SaveEndSection(_p_stFile, SCR_CC_C_Cfg_EOL );
|
||||
SCR_M_SvL0_SaveBlankLine( _p_stFile );
|
||||
}
|
||||
SCR_g_ui_SvL0_IndentationLevel = uiLastIndent;
|
||||
}
|
||||
|
||||
#endif //ACTIVE_EDITOR
|
210
Rayman_X/cpa/tempgrp/TFa/src/CPATstPt.cpp
Normal file
210
Rayman_X/cpa/tempgrp/TFa/src/CPATstPt.cpp
Normal file
@@ -0,0 +1,210 @@
|
||||
/*=============================================================================
|
||||
*
|
||||
* Filename: CPATstPt.cpp
|
||||
* Version: 2.0 (VSS5)
|
||||
* Date: 28/07/97
|
||||
* Author: Marc Trabucato
|
||||
*
|
||||
* Description: implementation of CPA_TestPoint class
|
||||
*
|
||||
*===========================================================================*/
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
|
||||
#include "stdafx.h"
|
||||
// ALX
|
||||
#include "ACP_Base.h"
|
||||
#include "TFA.h"
|
||||
#include "DPT.h"
|
||||
|
||||
#include "x:\cpa\main\inc\_EditID.h"
|
||||
|
||||
/*=============================================================================
|
||||
* class CPA_TestPointNode:
|
||||
=============================================================================*/
|
||||
|
||||
DeclareTemplateStatic(tdxHandleToTestPointNode);
|
||||
|
||||
void delnode(tdxHandleToTestPointNode h)
|
||||
{}
|
||||
|
||||
void CPA_TestPointNode::Init()
|
||||
{
|
||||
CPA_EdMot<tdxHandleToTestPointNode>::Init(fn_hCreateTestPointNode,NULL,delnode);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : constructor
|
||||
*---------------------------------------------------------------------------*/
|
||||
CPA_TestPointNode::CPA_TestPointNode( CPA_TestPointsList *_p_oList, tdxHandleToTestPointNode _hTestPointNode /*=NULL*/ )
|
||||
:CPA_EdMot<tdxHandleToTestPointNode>(_hTestPointNode)
|
||||
{
|
||||
ASSERT( _p_oList );
|
||||
|
||||
SetOwnerList( _p_oList );
|
||||
SetZdxObject( NULL );
|
||||
// add point on editor list
|
||||
if( _hTestPointNode == NULL )
|
||||
SetStruct( fn_hCreateTestPointNode() );
|
||||
// and on engine list only if created point
|
||||
_p_oList -> m_oListOfTestPoints . AddTail( this, ( _hTestPointNode == NULL ) );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : destructor
|
||||
*---------------------------------------------------------------------------*/
|
||||
CPA_TestPointNode::~CPA_TestPointNode(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
* class CPA_TestPointsList:
|
||||
=============================================================================*/
|
||||
|
||||
DeclareTemplateStatic(tdxHandleToTestPointsList);
|
||||
|
||||
void dellist(tdxHandleToTestPointsList h)
|
||||
{}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description :
|
||||
*---------------------------------------------------------------------------*/
|
||||
void CPA_TestPointsList::Init()
|
||||
{
|
||||
CPA_EdMot<tdxHandleToTestPointsList>::Init(fn_hCreateTestPointsList,NULL,dellist);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : constructor
|
||||
*---------------------------------------------------------------------------*/
|
||||
CPA_TestPointsList::CPA_TestPointsList(CPA_EditorBase *_p_oDLL, CPA_BaseObject *_p_oOwnerFamily, tdxHandleToTestPointsList _hTestPointsList /*=NULL*/,
|
||||
CString _csListName /*=""*/)
|
||||
:CPA_SaveObject(_p_oDLL, C_szTestPointsListTypeName, E_ss_Responsible, _p_oOwnerFamily, FALSE, fn_szGetFamiliesDataPath(), CPA_TestPointsList::fn_vCallBackSave),
|
||||
CPA_EdMot<tdxHandleToTestPointsList>(_hTestPointsList)
|
||||
{
|
||||
|
||||
// Section init & File Section Init
|
||||
char *p_szFamilyName = _p_oOwnerFamily -> fn_p_szGetName();
|
||||
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szReferencedSectionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
|
||||
sprintf( szFileName, "%s\\%s.tpe", p_szFamilyName, p_szFamilyName );
|
||||
|
||||
SCR_fn_v_RdL0_ComputeSectionName( szReferencedSectionName, szFileName, "TestPointsList", NULL);
|
||||
SetReferencedSectionName( szReferencedSectionName );
|
||||
SetSectionData( this );
|
||||
|
||||
SetExistingSection( _hTestPointsList != NULL );
|
||||
|
||||
// data
|
||||
if( _hTestPointsList == NULL )
|
||||
SetStruct( fn_hCreateTestPointsList() );
|
||||
|
||||
// Name
|
||||
if( fn_eRename( _csListName ) != E_mc_None )
|
||||
SetDefaultValidName();
|
||||
fn_vUpdateSectionName();
|
||||
// data
|
||||
m_oListOfTestPoints . SetEngineAnchor( GetStruct() ? & GetStruct() -> hForTestPointArray : NULL );
|
||||
|
||||
if( _hTestPointsList == NULL )
|
||||
{
|
||||
fn_vNotifySave();
|
||||
}
|
||||
else
|
||||
{
|
||||
// fill TPList List
|
||||
CPA_TestPointNode *p_oNode;
|
||||
tdxHandleToTestPointNode hNode;
|
||||
int iIndex = 0;
|
||||
|
||||
LST2_M_StaticForEachElementOf( & GetStruct() -> hForTestPointArray, hNode, iIndex)
|
||||
{
|
||||
p_oNode = new CPA_TestPointNode( this, hNode );
|
||||
}
|
||||
// construct ZdxObject
|
||||
CPA_EditorBase *p_oZDxEditor = GetMainWorld() -> GetObjectDLLWithName( C_szDLLZDxName );
|
||||
if( p_oZDxEditor )
|
||||
p_oZDxEditor -> OnQueryAction( GetEditor(), C_uiQueryCreateZDxTestPoints, (long)this );
|
||||
}
|
||||
((CPA_Family *) _p_oOwnerFamily) -> mfn_vAddTestPointsList( this );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : destructor
|
||||
*---------------------------------------------------------------------------*/
|
||||
CPA_TestPointsList::~CPA_TestPointsList(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : save TestPointsList
|
||||
*---------------------------------------------------------------------------*/
|
||||
void CPA_TestPointsList::fn_vCallBackSave( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction)
|
||||
{
|
||||
// ANNECY AV CLEAN_MEC {
|
||||
/*
|
||||
CPA_TestPointsList *p_oList = (CPA_TestPointsList*)_p_vData;
|
||||
CPA_TestPointNode *p_oNode = NULL;
|
||||
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szIdName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
char szSectionName[SCR_CV_ui_Cfg_MaxLenName];
|
||||
POSITION xPos;
|
||||
MTH3D_tdstVector stPosition;
|
||||
|
||||
switch ( _eAction )
|
||||
{
|
||||
case SCR_EA_Ntfy_AddSection:
|
||||
case SCR_EA_Ntfy_RebuildSection:
|
||||
// construct section name
|
||||
SCR_fn_v_RdL0_SplitSectionName( _p_szSectionName, NULL, szActionName, szIdName );
|
||||
SCR_fn_v_RdL0_ComputeSectionName( szSectionName, NULL, szActionName, szIdName );
|
||||
// save begin section
|
||||
SCR_M_SvL0_SaveBeginSection( _p_stFile, szSectionName, SCR_CC_C_Cfg_EOL );
|
||||
// entries
|
||||
xPos = p_oList -> m_oListOfTestPoints . GetHeadPosition();
|
||||
while ( xPos )
|
||||
{
|
||||
p_oNode = p_oList -> m_oListOfTestPoints . GetNext( xPos );
|
||||
p_oNode -> mfn_vGetPosition( & stPosition );
|
||||
|
||||
SCR_M_SvL0_SaveEntry( _p_stFile, "AddTestPoint", SCR_CC_C_Cfg_NoChar );
|
||||
SCR_fn_v_SvL0_SaveParameters_MP(_p_stFile, SCR_EF_SvL0_Scanf, 1, "%.6f,%.6f,%.6f,%s"
|
||||
,MTH3D_M_xGetXofVector( &stPosition )
|
||||
,MTH3D_M_xGetYofVector( &stPosition )
|
||||
,MTH3D_M_xGetZofVector( &stPosition )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
,(char*)(LPCTSTR)p_oList -> GetKindOfPointName( p_oNode -> mfn_eGetKindOfPoint() ) );
|
||||
}
|
||||
// End Section
|
||||
SCR_M_SvL0_SaveEndSection( _p_stFile, SCR_CC_C_Cfg_EOL ) ;
|
||||
SCR_M_SvL0_SaveBlankLine( _p_stFile ) ;
|
||||
// update Section name
|
||||
p_oList -> fn_vSectionSaved();
|
||||
break;
|
||||
case SCR_EA_Ntfy_DeleteSection:
|
||||
p_oList -> fn_vSectionDeleted();
|
||||
break;
|
||||
}
|
||||
*/
|
||||
// END ANNECY AV }
|
||||
}
|
||||
|
||||
#endif // ACTIVE_EDITOR
|
194
Rayman_X/cpa/tempgrp/TFa/src/DlgLoad.cpp
Normal file
194
Rayman_X/cpa/tempgrp/TFa/src/DlgLoad.cpp
Normal file
@@ -0,0 +1,194 @@
|
||||
// DlgLoad.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <AFXTEMPL.h>
|
||||
#include "ACP_Base.h"
|
||||
#include "incITF.h"
|
||||
#include "dlgload.hpp"
|
||||
|
||||
#include "..\Main\Inc\_EditID.h"
|
||||
#include "TUT.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define M_LB() ( (CListBox*) GetDlgItem(IDC_LB_FAMILIES) )
|
||||
#define M_BTLoad() ( (CButton*) GetDlgItem(IDOK) )
|
||||
|
||||
#define C_iBorderSize 15
|
||||
|
||||
#define M_GetClientRect( pWnd, poRect ) \
|
||||
(pWnd) -> GetWindowRect( poRect ); \
|
||||
ScreenToClient( poRect );
|
||||
|
||||
#define M_GetClientRectId( Id, poRect ) M_GetClientRect( GetDlgItem( Id ), poRect )
|
||||
|
||||
#define M_SetClientRect( pWnd, poRect ) (pWnd) -> MoveWindow( poRect )
|
||||
#define M_SetClientRectId( Id, poRect ) M_SetClientRect( GetDlgItem( Id ), poRect )
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDlgLoad dialog
|
||||
|
||||
|
||||
CDlgLoad::CDlgLoad(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CDlgLoad::IDD, pParent)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98-06
|
||||
m_pActorDLL = NULL;
|
||||
//End CPA2 Stegaru Cristian 98-06
|
||||
//{{AFX_DATA_INIT(CDlgLoad)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CDlgLoad::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDlgLoad)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDlgLoad, CDialog)
|
||||
//{{AFX_MSG_MAP(CDlgLoad)
|
||||
ON_WM_SIZE()
|
||||
ON_LBN_SELCHANGE(IDC_LB_FAMILIES, OnSelchangeLbFamilies)
|
||||
ON_WM_GETMINMAXINFO()
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDlgLoad message handlers
|
||||
|
||||
BOOL CDlgLoad::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CListBox *pLB = M_LB();
|
||||
|
||||
pLB -> ResetContent();
|
||||
M_BTLoad() -> EnableWindow( FALSE );
|
||||
// fill ListBox
|
||||
Position xPos = m_p_oListOfFamilies -> GetHeadPosition();
|
||||
while( xPos )
|
||||
{
|
||||
CPA_BaseObject *p_oFamily = m_p_oListOfFamilies -> GetNext( xPos );
|
||||
if( ! p_oFamily -> fn_bIsAvailable() )
|
||||
{
|
||||
int iIndex = pLB -> AddString( p_oFamily -> GetName() );
|
||||
if( iIndex != LB_ERR )
|
||||
pLB -> SetItemData( iIndex, (DWORD) p_oFamily );
|
||||
}
|
||||
}
|
||||
pLB -> SetCurSel( -1 );
|
||||
|
||||
// register control for TUT module
|
||||
TUT_M_vGetTutDll();
|
||||
TUT_M_vRegisterControlID( IDC_LB_FAMILIES , "TFA_LOAD_LIST", TUT_e_ListBox );
|
||||
TUT_M_vRegisterControlID( IDOK , "TFA_LOAD_OK", TUT_e_Button );
|
||||
TUT_M_vRegisterControlID( IDCANCEL , "TFA_LOAD_CANCEL",TUT_e_Button );
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CDlgLoad::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CDialog::OnSize(nType, cx, cy);
|
||||
|
||||
if( GetDlgItem( IDOK) )
|
||||
{
|
||||
CRect oRectDlg, oRectLoad, oRectCancel, oRectLB, oRectText;
|
||||
CSize oSize;
|
||||
|
||||
// get positions
|
||||
M_GetClientRect( this, &oRectDlg );
|
||||
M_GetClientRectId( IDOK, &oRectLoad );
|
||||
M_GetClientRectId( IDCANCEL, &oRectCancel );
|
||||
M_GetClientRectId( IDC_TEXT, &oRectText );
|
||||
M_GetClientRectId( IDC_LB_FAMILIES, &oRectLB );
|
||||
|
||||
// place BT Cancel
|
||||
oSize = oRectCancel . Size();
|
||||
oRectCancel . bottom = oRectDlg . bottom - C_iBorderSize;
|
||||
oRectCancel . top = oRectCancel . bottom - oSize . cy;
|
||||
// place BT OK
|
||||
oSize = oRectCancel . Size();
|
||||
oRectLoad . bottom = oRectCancel . bottom;
|
||||
oRectLoad . top = oRectCancel . top;
|
||||
oRectLoad . right = oRectDlg . right - C_iBorderSize;
|
||||
oRectLoad . left = oRectLoad . right - oSize . cx;
|
||||
// place LB
|
||||
oRectLB . right = oRectLoad . right;
|
||||
oRectLB . bottom = oRectCancel . top - C_iBorderSize;
|
||||
// place Text
|
||||
oRectText . right = oRectLoad . right;
|
||||
|
||||
// set positions
|
||||
M_SetClientRectId( IDOK, &oRectLoad );
|
||||
M_SetClientRectId( IDCANCEL, &oRectCancel );
|
||||
M_SetClientRectId( IDC_TEXT, &oRectText );
|
||||
M_SetClientRectId( IDC_LB_FAMILIES, &oRectLB );
|
||||
}
|
||||
}
|
||||
|
||||
void CDlgLoad::OnOK()
|
||||
{
|
||||
CListBox *pLB = M_LB();
|
||||
int iNbSelected = pLB -> GetSelCount();
|
||||
|
||||
m_oListOfLoadedFamilies . RemoveAll();
|
||||
|
||||
if( iNbSelected )
|
||||
{
|
||||
int *ai_SelIdx = (int*) malloc( iNbSelected * sizeof(int) );
|
||||
pLB -> GetSelItems( iNbSelected, ai_SelIdx );
|
||||
for( int Idx = 0; Idx < iNbSelected ; Idx++ )
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98-06
|
||||
//m_oListOfLoadedFamilies . AddTail( (CPA_BaseObject*)pLB -> GetItemData( ai_SelIdx[Idx] ) );
|
||||
CPA_BaseObject *pObject = (CPA_BaseObject*)pLB -> GetItemData( ai_SelIdx[Idx] );
|
||||
m_oListOfLoadedFamilies . AddTail (pObject);
|
||||
if (m_pActorDLL != NULL)
|
||||
m_pActorDLL->OnQueryAction(NULL, C_uiActor_LoadFamilyModels, (LPARAM)pObject);
|
||||
//End CPA2 Stegaru Cristian 98-06
|
||||
}
|
||||
free( ai_SelIdx );
|
||||
}
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CDlgLoad::OnSelchangeLbFamilies()
|
||||
{
|
||||
CListBox *pLB = M_LB();
|
||||
int iNbSelected = pLB -> GetSelCount();
|
||||
|
||||
M_BTLoad() -> EnableWindow( (BOOL)iNbSelected );
|
||||
}
|
||||
|
||||
void CDlgLoad::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
|
||||
{
|
||||
// limit min size
|
||||
lpMMI -> ptMinTrackSize . x = 200;
|
||||
lpMMI -> ptMinTrackSize . y = 300;
|
||||
|
||||
CDialog::OnGetMinMaxInfo(lpMMI);
|
||||
}
|
||||
|
||||
void CDlgLoad::OnDestroy()
|
||||
{
|
||||
// unregister control for TUT module
|
||||
TUT_M_vGetTutDll();
|
||||
TUT_M_vUnregisterControlID( IDC_LB_FAMILIES );
|
||||
TUT_M_vUnregisterControlID( IDOK );
|
||||
TUT_M_vUnregisterControlID( IDCANCEL );
|
||||
|
||||
CDialog::OnDestroy();
|
||||
}
|
560
Rayman_X/cpa/tempgrp/TFa/src/FAinterf.cpp
Normal file
560
Rayman_X/cpa/tempgrp/TFa/src/FAinterf.cpp
Normal file
@@ -0,0 +1,560 @@
|
||||
//#################################################################################
|
||||
//
|
||||
// BASE CLASS OF YOUR DLL interface
|
||||
//
|
||||
//#################################################################################
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ACP_Base.h"
|
||||
|
||||
#include "DPT.h"
|
||||
|
||||
#include "TAC.h"
|
||||
#include "TAN.h"
|
||||
#include "TFA.h"
|
||||
|
||||
#include "ITF.h"
|
||||
|
||||
#include "FAinterf.hpp"
|
||||
#include "DlgLoad.hpp"
|
||||
#include "x:\cpa\main\inc\_editid.h"
|
||||
|
||||
// infos
|
||||
static CString g_csTFAName = "Family";
|
||||
static CString g_csTFAAuthor = "Marc Trabucato";
|
||||
static CString g_csTFAVersion = "V 6.0.1 30/03/98";
|
||||
static CString g_csTFAFrenchHelpFile = "";
|
||||
static CString g_csTFAEnglishHelpFile = "";
|
||||
|
||||
/*=============================================================================
|
||||
* constants
|
||||
=============================================================================*/
|
||||
#define C_uiTFAPopupLoad 10
|
||||
#define C_uiTFAPopupPreLoad 11
|
||||
|
||||
/*=============================================================================
|
||||
* macros
|
||||
=============================================================================*/
|
||||
#define M_TFAStatusBar(szText) M_GetMainWnd()->UpdateStatus(szText, C_STATUSPANE_INFOS, C_STATUS_WARNING)
|
||||
#define M_TFAMessage(szText) M_GetMainWnd()->UpdateStatus(szText, C_STATUSPANE_INFOS, C_STATUS_NORMAL)
|
||||
|
||||
/*=============================================================================
|
||||
* the DLL global definition
|
||||
=============================================================================*/
|
||||
tdstDLLIdentity g_stTFamilyIdentity;
|
||||
|
||||
static CPA_EditorBase *gs_p_oActionDLL;
|
||||
static CPA_EditorBase *gs_p_oAnimationDLL;
|
||||
|
||||
/*=============================================================================
|
||||
*
|
||||
* TFamily_Interface implementation
|
||||
*
|
||||
=============================================================================*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*---------------------------------------------------------------------------*/
|
||||
TFamily_Interface::TFamily_Interface(void)
|
||||
{
|
||||
// ************************** private internal
|
||||
m_p_stDLLIdentity = &g_stTFamilyIdentity;
|
||||
|
||||
// Does your DLL can output in main game view ?
|
||||
m_stBaseDLLDefinition.bCanOutputIn3DView = FALSE;
|
||||
|
||||
// Does your DLL can be refresh by engine ?
|
||||
m_stBaseDLLDefinition.bCanBeRefreshedByEngine = FALSE;
|
||||
|
||||
// Editor Info
|
||||
SetEditorInfo(g_csTFAName, g_csTFAAuthor, g_csTFAVersion, g_csTFAFrenchHelpFile, g_csTFAEnglishHelpFile);
|
||||
//
|
||||
m_lNbUnloadedFamilies = 0;
|
||||
m_bLevelLoad = FALSE;
|
||||
m_bCompleteLoad = FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* ACP MEssages Functions overload
|
||||
******************************************************************************/
|
||||
|
||||
void TFamily_Interface::fn_vJustAfterRegistered(void)
|
||||
{
|
||||
CString a_csType[] = { C_szFamilyTypeName, C_szChannelTypeName};
|
||||
fn_vRegisterObjectsType ( a_csType , 2 ) ;
|
||||
|
||||
CPA_Family::Init();
|
||||
|
||||
// register section for SCRIPT analysis
|
||||
SCR_fn_v_RdL0_RegisterCallback( "BaseFamily", CPA_Family::mfn_CallbackLoadBaseFamilySection, SCR_CRC_c_RdL0_ForSection );
|
||||
// load preferences on .ini
|
||||
mfn_vLoadPreferences();
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Construct
|
||||
*---------------------------------------------------------------------------*/
|
||||
void TFamily_Interface::fn_vConstruct(void)
|
||||
{
|
||||
CPA_Family::InitStatic( GetMainWorld() );
|
||||
gs_p_oActionDLL = GetMainWorld()->GetToolDLLWithName( C_szDLLActionName );
|
||||
gs_p_oAnimationDLL = GetMainWorld()->GetToolDLLWithName( C_szDLLAnimationName );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* load editor families once
|
||||
*---------------------------------------------------------------------------*/
|
||||
void TFamily_Interface::fn_vLevelChanges(void)
|
||||
{
|
||||
m_bLevelLoad = TRUE;
|
||||
|
||||
// create objects for loaded families
|
||||
mfn_vCreateLoadedFamilies();
|
||||
// create objects for unloaded families if needed
|
||||
if( m_bCompleteLoad )
|
||||
mfn_vCreateUnloadedFamilies();
|
||||
|
||||
m_bLevelLoad = FALSE;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* load given object
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL TFamily_Interface::fn_bLoadBaseObject(CPA_BaseObject *p_oObject)
|
||||
{
|
||||
if( ! p_oObject -> fn_bIsAvailable() )
|
||||
{
|
||||
CPA_Family *p_oFamily = (CPA_Family*)p_oObject;
|
||||
p_oFamily -> mfn_vLoad();
|
||||
if( p_oFamily -> fn_bIsAvailable() )
|
||||
{
|
||||
m_lNbUnloadedFamilies--;
|
||||
if (gs_p_oActionDLL!= NULL)
|
||||
gs_p_oActionDLL -> OnQueryAction(this , C_uiUpdateFamiliesList, (LPARAM) 0);
|
||||
|
||||
// update actor editor
|
||||
CPA_EditorBase *pActorDLL = GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName);
|
||||
if (pActorDLL)
|
||||
{
|
||||
pActorDLL->OnQueryAction(NULL, C_uiActor_LoadFamilyModels, (LPARAM)p_oFamily);
|
||||
pActorDLL->OnQueryAction (this, C_uiActor_UpdateTreeView, (LPARAM)0);
|
||||
}
|
||||
}
|
||||
if( ! m_bLevelLoad )
|
||||
{
|
||||
// update mechanics
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* tool dll functions overload
|
||||
******************************************************************************/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* OnQueryAction
|
||||
*---------------------------------------------------------------------------*/
|
||||
long TFamily_Interface::OnQueryAction(CPA_EditorBase *p_oSender, WPARAM _wParam, LPARAM _lParam)
|
||||
{
|
||||
char *szFamilyName;
|
||||
CPA_Family *p_oFamily = NULL;
|
||||
|
||||
switch( _wParam )
|
||||
{
|
||||
case C_uiSaveFamilies:
|
||||
ASSERT(0);
|
||||
break;
|
||||
case C_uiLoadAFamily:
|
||||
szFamilyName = (char*)_lParam;
|
||||
p_oFamily = (CPA_Family*)GetBaseObject( CString(szFamilyName), C_szFamilyTypeName );
|
||||
if( p_oFamily )
|
||||
{
|
||||
// load family
|
||||
fn_bLoadBaseObject( p_oFamily );
|
||||
}
|
||||
return (long)p_oFamily;
|
||||
break;
|
||||
case C_uiGetUnLoadedFamiliesList:
|
||||
ASSERT(0);
|
||||
break;
|
||||
case C_uiSetCompleteLoadModeTFA:
|
||||
m_bCompleteLoad = (BOOL) _lParam;
|
||||
mfn_vSavePreferences();
|
||||
break;
|
||||
case C_uiUpdateFamilies:
|
||||
mfn_vCreateUnloadedFamilies();
|
||||
break;
|
||||
case C_uiGetChannel:
|
||||
return mfn_lGetChannel( (tdstChannelInfoSearch*)_lParam );
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* OnQueryInfo
|
||||
*---------------------------------------------------------------------------*/
|
||||
long TFamily_Interface::OnQueryInfos(CPA_EditorBase *p_oSender, WPARAM _wParam, LPARAM _lParam)
|
||||
{
|
||||
switch( _wParam )
|
||||
{
|
||||
case C_uiGetCompleteLoadModeTFA:
|
||||
return (long)m_bCompleteLoad;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
* Menus methods
|
||||
=============================================================================*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : Add entry in editor menu
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL TFamily_Interface::fn_bDefineSubMenu(EDT_SubMenu *_p_oEDTSubMenu)
|
||||
{
|
||||
//ANNECY Shaitan NewInterface 24/03/98 {
|
||||
if (_p_oEDTSubMenu->GetSubMenuType() == C_SubMenuLoad)
|
||||
//ENDANNECY Shaitan NewInterface }
|
||||
{
|
||||
_p_oEDTSubMenu->AddAnEntry(this, "Load Some Families", C_uiTFAPopupLoad, FALSE, m_lNbUnloadedFamilies > 0 );
|
||||
_p_oEDTSubMenu->AddAnEntry(this, "PreLoad All Families", C_uiTFAPopupPreLoad );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : Manage choice of Action entry in editor menu
|
||||
*---------------------------------------------------------------------------*/
|
||||
void TFamily_Interface::_OnSubMenuCommand(EDT_SubMenu *_p_oEDTSubMenu,UINT uiMsgID)
|
||||
{
|
||||
//ANNECY Shaitan NewInterface 24/03/98 {
|
||||
if( _p_oEDTSubMenu->GetSubMenuType() == C_SubMenuLoad )
|
||||
//ENDANNECY Shaitan NewInterface }
|
||||
{
|
||||
switch( uiMsgID )
|
||||
{
|
||||
case C_uiTFAPopupLoad:
|
||||
mfn_vLoadFamilies();
|
||||
break;
|
||||
case C_uiTFAPopupPreLoad:
|
||||
mfn_vCreateUnloadedFamilies();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : Open Unloaded families DialogList and load selected families
|
||||
*---------------------------------------------------------------------------*/
|
||||
void TFamily_Interface::mfn_vLoadFamilies(void)
|
||||
{
|
||||
HINSTANCE hOldInst = AfxGetResourceHandle();
|
||||
AfxSetResourceHandle( m_p_stDLLIdentity->hModule );
|
||||
|
||||
CDlgLoad *pDlg = new CDlgLoad();
|
||||
|
||||
//CPA2 Stegaru Cristian 98-06
|
||||
CPA_EditorBase *pActorDLL = GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName);
|
||||
if (pDlg)
|
||||
pDlg->mfn_vSetActorDLL (pActorDLL);
|
||||
//End CPA2 Stegaru Cristian 98-06
|
||||
|
||||
pDlg -> fn_vSetFamilyList( GetBaseObjectList( C_szFamilyTypeName ) );
|
||||
|
||||
if( pDlg -> DoModal() == IDOK )
|
||||
{
|
||||
CPA_List<CPA_BaseObject> *p_oListOfSelectedFamilies = pDlg -> fn_p_oGetListOfSelectedFamilies();
|
||||
|
||||
POSITION xPos = p_oListOfSelectedFamilies -> GetHeadPosition();
|
||||
while( xPos )
|
||||
{
|
||||
// load family
|
||||
CPA_BaseObject *p_oFamily = (CPA_Family*)p_oListOfSelectedFamilies -> GetNext( xPos );
|
||||
if( p_oFamily )
|
||||
{
|
||||
// load family
|
||||
fn_bLoadBaseObject( p_oFamily );
|
||||
}
|
||||
}
|
||||
if( p_oListOfSelectedFamilies -> GetCount() )
|
||||
{
|
||||
CPA_DLLBase *p_oActionDLL = GetMainWorld()->GetToolDLLWithName( C_szDLLActionName );
|
||||
if (p_oActionDLL != NULL)
|
||||
p_oActionDLL->OnQueryAction(this , C_uiUpdateFamiliesList, (LPARAM) 0);
|
||||
|
||||
//CPA2 Stegaru Cristian 98-06
|
||||
if (pActorDLL)
|
||||
pActorDLL->OnQueryAction (this, C_uiActor_UpdateTreeView, (LPARAM)0);
|
||||
//End CPA2 Stegaru Cristian 98-06
|
||||
}
|
||||
}
|
||||
delete pDlg;
|
||||
|
||||
AfxSetResourceHandle( hOldInst );
|
||||
}
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Description : search index channel with given datas
|
||||
*---------------------------------------------------------------------------*/
|
||||
long TFamily_Interface::mfn_lGetChannel(tdstChannelInfoSearch *_p_stChannelInfo)
|
||||
{
|
||||
/*
|
||||
// search on given family
|
||||
if( _p_stChannelInfo -> p_oFamily )
|
||||
{
|
||||
POSITION xPos = _p_stChannelInfo -> p_oFamily -> m_oListOfChannelsName . GetHeadPosition();
|
||||
long lIndex = 0;
|
||||
while ( xPos )
|
||||
{
|
||||
CString csChannelName = _p_stChannelInfo -> p_oFamily -> m_oListOfChannelsName . GetNext( xPos );
|
||||
if( ! csChannelName . CompareNoCase( _p_stChannelInfo -> szChannel ) )
|
||||
{
|
||||
// find channel
|
||||
_p_stChannelInfo -> lIndexOfChannel = lIndex;
|
||||
return 1;
|
||||
}
|
||||
lIndex++;
|
||||
}
|
||||
}
|
||||
// search channel on all families
|
||||
long lFounded = 0;
|
||||
_p_stChannelInfo -> p_oFamily = NULL;
|
||||
CPA_BaseObjectList *p_oListOfFamilies = GetBaseObjectList( C_szFamilyTypeName );
|
||||
Position xPosFA = p_oListOfFamilies -> GetHeadPosition();
|
||||
while ( xPosFA )
|
||||
{
|
||||
CPA_Family *p_oFamily = (CPA_Family*)p_oListOfFamilies -> GetNext( xPosFA );
|
||||
// search channel on current family
|
||||
POSITION xPos = p_oFamily -> m_oListOfChannelsName . GetHeadPosition();
|
||||
long lIndex = 0;
|
||||
while ( xPos )
|
||||
{
|
||||
CString csChannelName = p_oFamily -> m_oListOfChannelsName . GetNext( xPos );
|
||||
if( ! csChannelName . CompareNoCase( _p_stChannelInfo -> szChannel ) )
|
||||
{
|
||||
// find channel, update '_p_stChannelInfo'
|
||||
_p_stChannelInfo -> p_oFamily = p_oFamily;
|
||||
_p_stChannelInfo -> lIndexOfChannel = lIndex;
|
||||
lFounded++;
|
||||
if( lFounded == 2 )
|
||||
{
|
||||
// too many channel founded, error
|
||||
_p_stChannelInfo -> p_oFamily = NULL;
|
||||
_p_stChannelInfo -> lIndexOfChannel = 0;
|
||||
return lFounded;
|
||||
}
|
||||
}
|
||||
lIndex++;
|
||||
}
|
||||
}
|
||||
return lFounded;
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CPA_List<CPA_BaseObject> oList;
|
||||
long lNbFound;
|
||||
|
||||
if( _p_stChannelInfo -> p_oFamily )
|
||||
{
|
||||
// search on given family
|
||||
lNbFound = fn_lFindObjects( &oList, _p_stChannelInfo -> szChannel, C_szChannelTypeName, _p_stChannelInfo -> p_oFamily );
|
||||
if( lNbFound == 1 )
|
||||
{
|
||||
_p_stChannelInfo -> p_oChannel = (CPA_Channel*)oList . GetHead();
|
||||
_p_stChannelInfo -> lIndexOfChannel = (long)_p_stChannelInfo -> p_oChannel -> GetData();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// search on all families
|
||||
lNbFound = fn_lFindObjects( &oList, _p_stChannelInfo -> szChannel, C_szChannelTypeName );
|
||||
if( lNbFound == 1 )
|
||||
{
|
||||
_p_stChannelInfo -> p_oChannel = (CPA_Channel*)oList . GetHead();
|
||||
_p_stChannelInfo -> p_oFamily = (CPA_Family*)_p_stChannelInfo -> p_oChannel -> GetOwner();
|
||||
_p_stChannelInfo -> lIndexOfChannel = (long)_p_stChannelInfo -> p_oChannel -> GetData();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// no channel found or too much channels ofund
|
||||
_p_stChannelInfo -> p_oChannel = NULL;
|
||||
_p_stChannelInfo -> p_oFamily = NULL;
|
||||
_p_stChannelInfo -> lIndexOfChannel = 0;
|
||||
return lNbFound;
|
||||
}
|
||||
|
||||
/* -----------------02/10/97 17:42-------------------
|
||||
* create editor objects for loaded families
|
||||
* --------------------------------------------------*/
|
||||
void TFamily_Interface::mfn_vCreateLoadedFamilies()
|
||||
{
|
||||
tdObjectType otType = 0;
|
||||
char* szFamilyName = fn_szFindFamilyTypeNameOfFamilyType( otType++ );
|
||||
char szMessage[255];
|
||||
char* szBeginFamily;
|
||||
CPA_Family *p_oFamily;
|
||||
CPA_List<CPA_Family> oListOfFamilies;
|
||||
POSITION xPos;
|
||||
BOOL bPreviousLoadingWorld = GetInterface() -> fn_bIsLoadingWorld();
|
||||
|
||||
// no prefix
|
||||
GetInterface() -> SetLoadingWorld( TRUE );
|
||||
strcpy( szMessage, "PreLoad All Families" );
|
||||
g_oBaseFrame.mfnv_UpdateTitle(szMessage);
|
||||
// M_TFAMessage( szMessage );
|
||||
|
||||
while ( szFamilyName )
|
||||
{
|
||||
// create editor object
|
||||
p_oFamily = new CPA_Family( this, NULL, szFamilyName );
|
||||
oListOfFamilies . AddTail( p_oFamily );
|
||||
// get next family name
|
||||
szFamilyName = fn_szFindFamilyTypeNameOfFamilyType( otType++ );
|
||||
}
|
||||
// update StatusBar
|
||||
// strcat( szMessage, " >>> 100% Completed" );
|
||||
// M_TFAMessage( szMessage );
|
||||
|
||||
// load all animations
|
||||
if( gs_p_oAnimationDLL )
|
||||
gs_p_oAnimationDLL -> OnQueryAction( this, C_cLoadAllAnimations, 0 );
|
||||
|
||||
// load families
|
||||
strcpy( szMessage, "Load Family : " );
|
||||
szBeginFamily = szMessage + strlen( szMessage );
|
||||
|
||||
xPos = oListOfFamilies . GetHeadPosition();
|
||||
while( xPos )
|
||||
{
|
||||
p_oFamily = oListOfFamilies . GetNext( xPos );
|
||||
|
||||
// update StatusBar
|
||||
strcpy( szBeginFamily, p_oFamily -> fn_p_szGetName() );
|
||||
g_oBaseFrame.mfnv_UpdateTitle(szMessage);
|
||||
// M_TFAMessage( szMessage );
|
||||
// link with engine object
|
||||
p_oFamily -> mfn_vLoad();
|
||||
p_oFamily -> mfn_vSetOnLevel( TRUE );
|
||||
// update StatusBar
|
||||
// strcat( szMessage, " >>> 100% Completed" );
|
||||
// M_TFAMessage( szMessage );
|
||||
}
|
||||
oListOfFamilies . RemoveAll();
|
||||
// restore prefix use
|
||||
GetInterface() -> SetLoadingWorld( bPreviousLoadingWorld );
|
||||
// M_TFAMessage( "" );
|
||||
}
|
||||
|
||||
/* -----------------02/10/97 17:58-------------------
|
||||
* create editor objects for unloaded families
|
||||
* --------------------------------------------------*/
|
||||
void TFamily_Interface::mfn_vCreateUnloadedFamilies()
|
||||
{
|
||||
WIN32_FIND_DATA stWFD; // structure for searching file
|
||||
HANDLE hFD; // handle for searching file
|
||||
char szSearchName[MAX_PATH]; // name of searched file (including relative path to family dir)
|
||||
CPA_Family *p_oFamily; // created family
|
||||
char szMessage[255];
|
||||
char* szBeginFamily;
|
||||
BOOL bPreviousLoadingWorld = GetInterface() -> fn_bIsLoadingWorld();
|
||||
|
||||
strcpy( szMessage, "Load Family : " );
|
||||
szBeginFamily = szMessage + strlen( szMessage );
|
||||
|
||||
// no prefix
|
||||
GetInterface() -> SetLoadingWorld( TRUE );
|
||||
|
||||
// initialize searching loop (search all file in family directory)
|
||||
strcpy( szSearchName, fn_szGetFamiliesDataPath() );
|
||||
strcat( szSearchName, "\\*");
|
||||
hFD = FindFirstFile( szSearchName, &stWFD );
|
||||
|
||||
m_lNbUnloadedFamilies = 0;
|
||||
|
||||
// stop load if no file found or if an error occurs
|
||||
if ( hFD == INVALID_HANDLE_VALUE )
|
||||
return;
|
||||
|
||||
do
|
||||
{
|
||||
if ((stWFD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (stWFD.cFileName[0] != '.') )
|
||||
{
|
||||
// current founded file is a directory and isn't current('.') or parent ('..') dir
|
||||
// it correspond to a family which name is the same as the directory name
|
||||
|
||||
// existing family ???
|
||||
p_oFamily = (CPA_Family*)GetBaseObject( CString(stWFD.cFileName), C_szFamilyTypeName );
|
||||
if( p_oFamily == NULL )
|
||||
{
|
||||
// new family
|
||||
// update StatusBar
|
||||
strcpy( szBeginFamily, stWFD.cFileName );
|
||||
M_TFAMessage( szMessage );
|
||||
p_oFamily = new CPA_Family( this, NULL, stWFD.cFileName );
|
||||
// family not loaded and not on current level
|
||||
p_oFamily -> mfn_vSetOnLevel( FALSE );
|
||||
m_lNbUnloadedFamilies++;
|
||||
// update StatusBar
|
||||
strcat( szMessage, " >>> 100% Completed" );
|
||||
M_TFAMessage( szMessage );
|
||||
}
|
||||
else if( ! p_oFamily -> fn_bIsAvailable() )
|
||||
{
|
||||
m_lNbUnloadedFamilies++;
|
||||
}
|
||||
}
|
||||
} while (FindNextFile( hFD, &stWFD) );
|
||||
|
||||
// clear StatusBar
|
||||
M_TFAMessage( "" );
|
||||
// close FindData handle
|
||||
FindClose(hFD);
|
||||
// restore prefix use
|
||||
GetInterface() -> SetLoadingWorld( bPreviousLoadingWorld );
|
||||
//
|
||||
if( gs_p_oActionDLL )
|
||||
gs_p_oActionDLL -> OnQueryAction( this, C_uiUpdateFamiliesList, 0 );
|
||||
}
|
||||
|
||||
/* -----------------02/10/97 18:16-------------------
|
||||
* save preferneces on .ini
|
||||
* --------------------------------------------------*/
|
||||
void TFamily_Interface::mfn_vSavePreferences()
|
||||
{
|
||||
CString csFileName;
|
||||
CString csDimension;
|
||||
|
||||
csFileName = M_GetMainApp()->m_csEditorDataPath + "Tools\\Family\\Family.ini";
|
||||
char *p_szFileName = (char*)(LPCSTR)csFileName;
|
||||
|
||||
// CompleteLoad mode
|
||||
WritePrivateProfileString( "Preference", "Complete Load", m_bCompleteLoad ? "YES" : "NO" , p_szFileName );
|
||||
|
||||
// write on file
|
||||
WritePrivateProfileString( NULL, NULL, NULL , p_szFileName );
|
||||
}
|
||||
|
||||
/* -----------------02/10/97 18:16-------------------
|
||||
* load preferneces on .ini
|
||||
* --------------------------------------------------*/
|
||||
void TFamily_Interface::mfn_vLoadPreferences()
|
||||
{
|
||||
CString csFileName;
|
||||
char szText[256];
|
||||
|
||||
csFileName = M_GetMainApp()->m_csEditorDataPath + "Tools\\Family\\Family.ini";
|
||||
char *p_szFileName = (char*)(LPCSTR)csFileName;
|
||||
|
||||
// CompleteLoad mode
|
||||
GetPrivateProfileString ("Preference", "Complete Load", "YES", szText, 256, p_szFileName);
|
||||
m_bCompleteLoad = !strcmpi( szText, "YES" );
|
||||
}
|
10
Rayman_X/cpa/tempgrp/TFa/src/Family.def
Normal file
10
Rayman_X/cpa/tempgrp/TFa/src/Family.def
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
LIBRARY
|
||||
EXPORTS
|
||||
fn_p_szGetCPAVersion
|
||||
fn_p_stGetDLLIdentity
|
||||
fn_p_oGetDLL
|
||||
fn_vInitDll
|
||||
SECTIONS
|
||||
.data READ WRITE
|
6
Rayman_X/cpa/tempgrp/TFa/src/StdAfx.cpp
Normal file
6
Rayman_X/cpa/tempgrp/TFa/src/StdAfx.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// ACPProject.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
118
Rayman_X/cpa/tempgrp/TFa/src/dllcom.cpp
Normal file
118
Rayman_X/cpa/tempgrp/TFa/src/dllcom.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
//
|
||||
// Common functions for Object DLL capabilities
|
||||
// C. Beaudet
|
||||
//
|
||||
|
||||
//MFC
|
||||
#include "stdafx.h"
|
||||
#include "afxdllx.h"
|
||||
//Interface
|
||||
#include "ACP_Base.h"
|
||||
// ALX
|
||||
#include "TAC.h"
|
||||
// End ALX
|
||||
#include "ITF.h"
|
||||
//local
|
||||
#include "FAinterf.hpp"
|
||||
#include "X:\Cpa\Main\Inc\_EditID.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Global vars
|
||||
static char *gs_p_szCPAVersion = C_szCPAVersion;
|
||||
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
|
||||
|
||||
#ifdef DLL_ONLY_ONE_INSTANCE
|
||||
static TFamily_Interface *gs_p_oTFamilyInterface = NULL;
|
||||
#endif
|
||||
|
||||
static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// functions that are present in all DLL :
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//========================================================================
|
||||
// Get current CPA version
|
||||
//========================================================================
|
||||
extern "C" char __declspec(dllexport) *fn_p_szGetCPAVersion(void)
|
||||
{
|
||||
return gs_p_szCPAVersion;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Get type of this DLL
|
||||
//========================================================================
|
||||
extern "C" tdstDLLIdentity __declspec(dllexport) *fn_p_stGetDLLIdentity(void)
|
||||
{
|
||||
g_stTFamilyIdentity . eType = TOOL_DLL;
|
||||
g_stTFamilyIdentity . csName = C_szDLLFamilyName;
|
||||
g_stTFamilyIdentity . hModule = NULL;
|
||||
g_stTFamilyIdentity . p_oListOfInstances = &g_oListOfInstances;
|
||||
return &g_stTFamilyIdentity;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// DLL int function
|
||||
//========================================================================
|
||||
extern "C" void __declspec(dllexport) fn_vInitDll(void)
|
||||
{
|
||||
new CDynLinkLibrary(extensionDLL);
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// DLL entry point
|
||||
//========================================================================
|
||||
extern "C" int __stdcall DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
if (!AfxInitExtensionModule(extensionDLL, hInstance))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Get the DLL
|
||||
//========================================================================
|
||||
extern "C" CPA_DLLBase __declspec(dllexport) *fn_p_oGetDLL(long lKey)
|
||||
{
|
||||
#ifdef DLL_ONLY_ONE_INSTANCE
|
||||
|
||||
switch(lKey)
|
||||
{
|
||||
case 0: // the game world
|
||||
if (gs_p_oTFamilyInterface == NULL)
|
||||
{
|
||||
gs_p_oTFamilyInterface = new TFamily_Interface();
|
||||
ASSERT(gs_p_oTFamilyInterface != NULL);
|
||||
}
|
||||
return gs_p_oTFamilyInterface;
|
||||
break;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else //DLL_ONLY_ONE_INSTANCE
|
||||
|
||||
switch(lKey)
|
||||
{
|
||||
case 0: // the game world
|
||||
return new TFamily_Interface();
|
||||
break;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif //DLL_ONLY_ONE_INSTANCE
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// functions that are present in this type of DLL only :
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
#undef DLL_ONLY_ONE_INSTANCE
|
Reference in New Issue
Block a user