Files
reman3/Rayman_X/cpa/tempgrp/OIT/src/edit_cla.cpp
2024-09-18 02:33:44 +08:00

162 lines
5.4 KiB
C++

/*
*=======================================================================================
* Name :edit_cla.cpp
*
* Author : Vincent Lhullier Date :30/06/97
*
* Description : Editor classe object
*=======================================================================================
* Modification -> Author : Date :
* Description :
*=======================================================================================
*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include "stdafx.h"
#include "acp_base.h"
#include "ITF.h"
#include "DPT.h"
#include "Edit_Cla.hpp"
#include "OPD.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
----------------------------------------------------------------------------------------
Description : constructor
p_oDLL -> owner dll
p_oMainWorld -> main world that contain EditorPO object
hObj -> handle on engine structure
csName -> name of object
csFileName -> file name were object is stored
csSectionName -> section name for object
----------------------------------------------------------------------------------------
*/
EditorPOClass::EditorPOClass
(
char *_szName,
CPA_EditorBase *_pEditor,
CPA_BaseObject *_pOwner /*= NULL*/,
BOOL _bAvailable /*= FALSE*/
)
:CPA_BaseObject
(
_pEditor,
C_szPhysicalObjectClassTypeName,
_pOwner,
_bAvailable
)
{
// name
fn_eRename( _szName );
};
/*
----------------------------------------------------------------------------------------
Description : Destructor
----------------------------------------------------------------------------------------
*/
EditorPOClass::~EditorPOClass()
{
}
/*
----------------------------------------------------------------------------------------
Description : callback to analyse PO section
----------------------------------------------------------------------------------------
*/
SCR_tde_Anl_ReturnValue fn_eCallbackForPhySection(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
EditorPOClass *p_oClass;
SCR_M_RdL0_GetContextLong( 0, 0, EditorPOClass *, p_oClass );
switch (cType)
{
case SCR_EA_Anl_BeginSection:
{
CPA_ObjectDLLBase *p_oPODll;
char szFileName[ 255 ];
p_oPODll = p_oClass->GetMainWorld()->GetObjectDLLWithName( C_szDLLPhysicalObjectName );
strcpy( szFileName, SCR_M_RdL0_GetCompleteSectionNameR(0) );
p_oPODll->OnQueryAction( (CPA_EditorBase *) p_oClass, OPD_ActionCreateEmptyPO, (LPARAM) szFileName );
}
return SCR_ERV_Anl_TerminateCurrentSection;
}
return SCR_ERV_Anl_NormalReturn;
}
/*
----------------------------------------------------------------------------------------
Description : load editor po contained in class
----------------------------------------------------------------------------------------
*/
BOOL EditorPOClass::fn_bLoadEditorPO( void )
{
SCR_tdst_Anl_Callback *p_stCallBack;
SCR_tdpfn_Anl_Callback pfn_eOldCallBack;
char szFileName[ _MAX_PATH ];
BOOL bIsLoadingWorld;
p_stCallBack = SCR_fnp_st_RdL0_GetRegisterCallback( C_Section_POGeneral, SCR_CRC_c_RdL0_ForSection );
pfn_eOldCallBack = p_stCallBack->pfn_eCallback;
p_stCallBack->pfn_eCallback = fn_eCallbackForPhySection;
bIsLoadingWorld = GetEditor()->GetInterface()->fn_bIsLoadingWorld();
GetEditor()->GetInterface()->SetLoadingWorld( TRUE );
SCR_M_RdL0_SetContextLong( 2, 0, (long ) this );
sprintf( szFileName, "%s\\%s\\%s.phy", fn_szGetGraphicsClassesDataPath(), GetName(), GetName() );
SCR_fnp_st_RdL0_AnalyseSection( szFileName, SCR_CDF_uw_Anl_Normal);
GetEditor()->GetInterface()->SetLoadingWorld(bIsLoadingWorld);
SCR_fn_v_RdL0_DeleteOpenSection( szFileName, SCR_CDR_c_RdL0_Contains );
p_stCallBack->pfn_eCallback = pfn_eOldCallBack;
SetAvailable( TRUE );
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_vLoadITEditorPO
// Date : 98-04
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void EditorPOClass::mfn_vLoadITEditorPO (CString csITName)
{
SCR_tdst_Anl_Callback *p_stCallBack;
SCR_tdpfn_Anl_Callback pfn_eOldCallBack;
char szSectionName[2 * _MAX_PATH ];
BOOL bIsLoadingWorld;
p_stCallBack = SCR_fnp_st_RdL0_GetRegisterCallback( C_Section_POGeneral, SCR_CRC_c_RdL0_ForSection );
pfn_eOldCallBack = p_stCallBack->pfn_eCallback;
p_stCallBack->pfn_eCallback = fn_eCallbackForPhySection;
bIsLoadingWorld = GetEditor()->GetInterface()->fn_bIsLoadingWorld();
GetEditor()->GetInterface()->SetLoadingWorld( TRUE );
SCR_M_RdL0_SetContextLong( 1, 0, (long ) this );
sprintf (szSectionName, "%s\\%s\\%s.phy^PHY:%s", fn_szGetLevelsDataPath (), fn_p_szGetLevelName () , fn_p_szGetLevelName (), csITName);
SCR_fnp_st_RdL0_AnalyseSection (szSectionName, SCR_CDF_uw_Anl_Normal);
GetEditor()->GetInterface()->SetLoadingWorld(bIsLoadingWorld);
SCR_fn_v_RdL0_DeleteOpenSection (szSectionName, SCR_CDR_c_RdL0_Contains);
p_stCallBack->pfn_eCallback = pfn_eOldCallBack;
SetAvailable( TRUE );
}