3558 lines
125 KiB
C++
3558 lines
125 KiB
C++
//#################################################################################
|
||
//
|
||
// BASE CLASS OF YOUR DLL interface
|
||
//
|
||
//#################################################################################
|
||
#include "StdAfx.h"
|
||
|
||
#include <direct.h>
|
||
|
||
//External Modules
|
||
#include "ACP_Base.h"
|
||
#include "TAC.h"
|
||
#include "TFa.h"
|
||
#include "DPT.h"
|
||
// Begin Silviu Simen 06 August 1998 Update Sector Status
|
||
#include "GAM.h"
|
||
// End Silviu Simen 06 August 1998 Update Sector Status
|
||
//End of External Modules
|
||
|
||
#include "_AInterf.hpp"
|
||
|
||
#include "EDACCnst.hpp"
|
||
#include "EDACDgIf.hpp"
|
||
#include "EDACDgQu.hpp"
|
||
#include "EDACDgPI.hpp"
|
||
|
||
#include "EDACModl.hpp"
|
||
#include "EDACVwAc.hpp"
|
||
#include "EDACStrg.hpp"
|
||
#include "EDACVwMS.hpp"
|
||
#include "EDACGlob.hpp"
|
||
#include "EDACWatc.hpp"
|
||
|
||
#include "EdtList.hpp"
|
||
#include "CPA_DatO.hpp"
|
||
#include "CPA_NLL.hpp"
|
||
#include "EdAcDgMi.hpp"
|
||
|
||
#include "OGd.h"
|
||
|
||
//-----------------IR-------------------------
|
||
#include "EdIRFrm.hpp"
|
||
#include "EdIRBeEn.hpp"
|
||
#include "EdIRBeha.hpp"
|
||
#include "EDACQuer.hpp"
|
||
//--------------------------------------------
|
||
|
||
extern BOOL FirstLoad;
|
||
|
||
//External Modules
|
||
#include "TAn.h"
|
||
#include "ErO.h"
|
||
#include "IncTUT.h"
|
||
#include "WAW.h"
|
||
//CPA2 Corneliu Babiuc 27-04-1998
|
||
//for Query comunication with Zone editor
|
||
#include "OZO\_zQuery.hpp"
|
||
//END CPA2 Corneliu Babiuc 27-04-1998
|
||
//End of External Modules
|
||
|
||
//CPA2 Stegaru Cristian 98-04
|
||
#include "ozo.h"
|
||
//End CPA2 Stegaru Cristian 98-04
|
||
|
||
#undef CPA_WANTS_IMPORT
|
||
#undef CPA_EXPORT
|
||
#define CPA_WANTS_EXPORT
|
||
//-----------------IR-------------------------
|
||
#include "EdIRIRD.hpp"
|
||
//--------------------------------------------
|
||
#include "_Actors.hpp"
|
||
|
||
//ROMTEAM LoadAI (Cristi Petrescu 23/03/98)
|
||
#include "dlgldai.hpp"
|
||
#include "ITF/cpaproj.hpp"
|
||
//ENDROMTEAM LoadAI (Cristi Petrescu)
|
||
|
||
#undef CPA_WANTS_EXPORT
|
||
#define CPA_WANTS_IMPORT
|
||
|
||
//CPA2 Stegaru Cristian 98-05
|
||
#include "CharacterInfoDlg.h"
|
||
#include "moduleinfodlg.h"
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
|
||
CPA_Actor_Editor_Interface *g_pclInterface;
|
||
|
||
// infos
|
||
static CString g_csOACName = C_szDLLActorName;
|
||
static CString g_csOACAuthor = "Y.Babitch, X.Billault, A.Vaisse, B.Germain, C.Oury";
|
||
static CString g_csOACVersion = "V 5.0.4 30/03/99";
|
||
static CString g_csOACFrenchHelpFile = "Actors.hlp";
|
||
static CString g_csOACEnglishHelpFile = "";
|
||
|
||
BOOL g_bTipFirstTime = TRUE;
|
||
|
||
///////
|
||
#define C_B_CAN_COPY_INSTANCES FALSE
|
||
///////
|
||
|
||
//Menu Entries Id
|
||
#define C_EdActors_MenuID_OpenEditor 10
|
||
#define C_EdActors_MenuID_CloseEditor 11
|
||
|
||
#define C_EdActors_MenuID_SaveDimension 12
|
||
#define C_EdActors_MenuID_InternalSetup 13
|
||
|
||
#define C_EdActors_MenuID_LoadUnloadedModels 15
|
||
|
||
#define C_EdActors_MenuID_ShowActors 16
|
||
// Shaitan => state list in the level
|
||
#define C_EdActors_MenuID_BuildStatesLists 17
|
||
// End Shaitan => state list in the level
|
||
|
||
//Popup Entries Id
|
||
#define C_EdActors_PopupID_Edit_Instance 20
|
||
#define C_EdActors_PopupID_Exit_Editor 21
|
||
#define C_EdActors_PopupID_SetAsInitialPos 22
|
||
#define C_EdActors_PopupID_SetAsAnAlways 23
|
||
#define C_EdActors_PopupID_Edit_IA 24
|
||
|
||
// keyboard
|
||
#define C_EdActors_Keys_InitialPosition 50
|
||
#define C_EdActors_Keys_SetAsAlways 51
|
||
//CPA2 Stegaru Cristian 98-05
|
||
//----------- Keyboard mapping
|
||
#define KA_ACTOR_CHARACTER_INFO 1
|
||
#define KA_ACTOR_MODULE_INFO 2
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
// the DLL global definition
|
||
tdstDLLIdentity g_stActorEditorIdentity;
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
static tdstKeyboardActionDef g_OACKeyboardAction[] =
|
||
{
|
||
// position
|
||
{ "set as Initial position", C_EdActors_Keys_InitialPosition },
|
||
{ "set as Always", C_EdActors_Keys_SetAsAlways },
|
||
//CPA2 Stegaru Cristian 98-05
|
||
{ "Character info", KA_ACTOR_CHARACTER_INFO},
|
||
{ "Module info", KA_ACTOR_MODULE_INFO},
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
{ NULL, 0 }
|
||
};
|
||
|
||
|
||
//**************************************************************************************
|
||
//--------------------------------------------------------------------------------
|
||
// CONSTRUCTOR.
|
||
// You must put here all your DLL interface definitions.
|
||
//--------------------------------------------------------------------------------
|
||
CPA_Actor_Editor_Interface::CPA_Actor_Editor_Interface(void)
|
||
{
|
||
m_p_stDLLIdentity = &g_stActorEditorIdentity;
|
||
|
||
//Does your DLL can output in main game view ?
|
||
m_stBaseDLLDefinition.bCanOutputIn3DView = FALSE;
|
||
|
||
SetCurrent(FALSE);
|
||
|
||
//####################################
|
||
//Specific init.
|
||
m_pclCaracMainFrame = NULL;
|
||
|
||
m_pclFamilyFilter = NULL;
|
||
m_pclModelFilter = NULL;
|
||
m_pclSelectedInstance = NULL;
|
||
//ANNECY Shaitan Correction 02/03/98
|
||
m_pclSelectedActorForTreeView = NULL;
|
||
//ENDANNECY Shaitan Correction
|
||
//CPA2 Stegaru Cristian 98-05
|
||
m_pSelectedUnloadedAlways = NULL;
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
m_pcl3DSelectedActor = NULL;
|
||
// for actor display
|
||
m_bShowActors = FALSE;
|
||
m_pEngineModule = NULL;
|
||
|
||
m_csEditorVersion = "4.1.0 [" + CString(__DATE__) + "] <using CTL, ErO, and WAW>";
|
||
|
||
SetEditorInfo(g_csOACName, g_csOACAuthor, g_csOACVersion, g_csOACFrenchHelpFile, g_csOACEnglishHelpFile);
|
||
|
||
//For errors
|
||
ERROR_g_fn_vAddAModuleDescriptor( g_c_csActorModuleNameForErrors,
|
||
m_csEditorVersion,
|
||
"Yves BABITCH",
|
||
"01 48 18 53 32 (Montreuil)",
|
||
"ybabitch@ubisoft.fr",
|
||
"Daniel PALIX",
|
||
"04 50 51 26 63 (Annecy)",
|
||
"dpalix@ubisoft.fr",
|
||
"Alexis VAISSE",
|
||
"04 50 52 98 84 (Annecy)",
|
||
"avaisse@ubisoft.fr"
|
||
);
|
||
|
||
//For Watch Window
|
||
WAW_fn_hUserRegister("OAC_Module_for_WAW", OAC_CallBackForWatchWindow);
|
||
|
||
// Keys
|
||
m_p_oKeyboard = new CPA_KeyActionConfiguration("Objects\\Actors\\OACKeys.ini"/*C_szActorsIniFileName*/, g_OACKeyboardAction);
|
||
m_p_oKeyboard->mfn_vSetObjectName("Actor Editor");
|
||
|
||
// Shaitan => module list in the level
|
||
char szPrivate[5];
|
||
CString csINIFileName = M_GetMainApp()->m_csEditorDataPath + "Optim.INI";
|
||
GetPrivateProfileString ("Optimize", "CanGenerateOptimizedLevel", "FALSE", szPrivate, 5, csINIFileName);
|
||
m_bCanGenerateOptimizedLevel = !strcmp(szPrivate, "TRUE");
|
||
// End Shaitan => module list in the level
|
||
|
||
}
|
||
|
||
//**************************************************************************************
|
||
//--------------------------------------------------------------------------------
|
||
// DESTRUCTOR.
|
||
//--------------------------------------------------------------------------------
|
||
CPA_Actor_Editor_Interface::~CPA_Actor_Editor_Interface(void)
|
||
{
|
||
// Keys
|
||
delete m_p_oKeyboard;
|
||
m_p_oKeyboard = NULL;
|
||
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vJustAfterRegistered()
|
||
{
|
||
CString a_csTypes[] =
|
||
{
|
||
g_c_csActorType,
|
||
g_c_csActorModelType,
|
||
g_c_csObjectNameType,
|
||
g_c_csZDeNameListType,
|
||
g_c_csZDmNameListType,
|
||
g_c_csZDdNameListType,
|
||
g_c_csZDrNameListType,
|
||
g_c_csWayNameListType,
|
||
CString(C_szEdtListTypeName),
|
||
//CPA2 Stegaru Cristian 98-05
|
||
g_c_csUnloadedAlwaysType
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
};
|
||
|
||
//CPA2 Stegaru Cristian 98-05
|
||
fn_vRegisterObjectsType(a_csTypes, 10);
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
|
||
CPA_Actor::StaticInit();
|
||
CPA_tdoNameList::StaticInit();
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vConstruct()
|
||
{
|
||
//Windows constructions
|
||
#ifndef __INACTIVE_INTERFACE__
|
||
|
||
//Creates the Main Frame (Carac)
|
||
if ( m_pclCaracMainFrame == NULL )
|
||
{
|
||
m_pclCaracMainFrame = new CMainFrame;
|
||
|
||
m_pclCaracMainFrame->CreateBase("", 1, 2, GetInterface()->GetMainWorld() );
|
||
|
||
m_pclCaracMainFrame->m_iInitWidth = C_EDITOR_WIDTH + C_SCROLLBAR_WIDTH;
|
||
m_pclCaracMainFrame->m_bKeepPos = TRUE;
|
||
m_pclCaracMainFrame->mfn_vEnableCaption(FALSE);
|
||
|
||
m_pclCaracMainFrame->m_stWinRight.cLinkSame = FRM_C_MoveLeft;
|
||
}
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Constructing the Actors Editor",
|
||
"CPA_Actor_Editor_Interface::fn_vConstruct(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"The Dialog List has not been created");
|
||
ERROR_ASSERT( m_clDocument.m_pclDialogList != NULL );
|
||
|
||
m_clDocument.m_pclDialogList->fn_vInitAllLists();
|
||
m_clDocument.m_pclDialogList->fn_vReinitDialog();
|
||
|
||
//////////////
|
||
//////////////
|
||
//Registers for TUT Module
|
||
TUT_M_vGetTutDll();
|
||
|
||
TUT_M_vRegisterControl(m_pclCaracMainFrame->m_hWnd, "OAC_MainFrame", TUT_e_Window);
|
||
|
||
TUT_M_vRegisterDialogList(m_clDocument.m_pclDialogList, "OAC_DialogList_ListBox",
|
||
"OAC_DialogList_TreeControl",
|
||
"OAC_DialogList_ComboBox",
|
||
"OAC_DialogList_TestButton");
|
||
//End of Registers for TUT Module
|
||
//////////////
|
||
|
||
#endif //__INACTIVE_INTERFACE__
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vBeforeEngine(void)
|
||
{
|
||
//Hides all Gen Doors
|
||
m_clDocument.m_fn_vHideGenDoors();
|
||
|
||
// if necessary, hide inactive actors
|
||
if (m_bShowActors)
|
||
mfn_vUpdateDisplayOfAllActors(FALSE);
|
||
|
||
//Loads current Object Tables if necessary
|
||
m_clDocument.m_fn_vLoadObjectTables();
|
||
|
||
if ( fn_bIsCurrentEditor() )
|
||
m_fn_vHideEditor();
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vBeforeEditor(void)
|
||
{
|
||
//Shows all Gen Doors
|
||
m_clDocument.m_fn_vShowGenDoors();
|
||
// Begin Silviu Simen List by Sector and type
|
||
fn_AddDialogBySector();
|
||
// End Silviu Simen List by Sector and type
|
||
|
||
// if necessary, show inactive actors
|
||
if (m_bShowActors)
|
||
mfn_vUpdateDisplayOfAllActors(TRUE);
|
||
|
||
// update ministructures
|
||
m_clDocument.m_pclMiniStrucView->m_fn_vDisplayActor(m_clDocument.m_pclSelectedActor);
|
||
|
||
if ( fn_bIsCurrentEditor() )
|
||
m_fn_vShowEditor();
|
||
}
|
||
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptToRunEngine(void)
|
||
{
|
||
CPA_BaseObjectList *pListOfActor = GetMainWorld () -> fn_p_oGetOriginalObjectList (C_szActorInstanceTypeName);
|
||
CPA_Actor *pActor;
|
||
Position pos = pListOfActor->GetHeadPosition();
|
||
|
||
while ( pos != 0 )
|
||
{
|
||
pActor = (CPA_Actor *)pListOfActor->GetNext(pos);
|
||
|
||
EdActors_EditorActor * pEditorActor = pActor -> m_fn_pclGetEditorActor ();
|
||
CPA_Editor_ObjectListData * pObjectListData = (CPA_Editor_ObjectListData *) pEditorActor -> m_fn_p_oFindDataByName (C_szZdmName);
|
||
|
||
// Get the ZDM activating list
|
||
CPA_ZonesActivatingList * pZAList = pObjectListData -> m_p_oZAList;
|
||
// Get the ZDM list
|
||
EdtList * pEdtList = pObjectListData -> m_p_oObjectList;
|
||
|
||
if ((pZAList == NULL && pEdtList != NULL) ||
|
||
(pZAList != NULL && (pEdtList == NULL || pEdtList -> GetCount () == 0 || pEdtList -> GetHeadElement () == NULL)))
|
||
{
|
||
GetInterface () -> fn_vCancelCurrentSelection (FALSE);
|
||
GetInterface () -> fn_vAddSelectedObject (pActor -> m_pub_fn_pclGetSuperObject () , TRUE);
|
||
|
||
CString csInfoMessage = "Actor '" + pActor->GetName() + "' must have a ZDM and a ZDM activation list before you can run the game !";
|
||
EdActors_InformationDialog InfoDial(&g_oBaseFrame, csInfoMessage);
|
||
InfoDial.DoModal();
|
||
|
||
return FALSE;
|
||
}
|
||
}
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptToSave(void)
|
||
{
|
||
return TRUE;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vBeforeSaveAll()
|
||
{
|
||
// Shaitan => optimisation lists in the level
|
||
CPA_List<CPA_BaseObject> clListOfFamilies;
|
||
CPA_List<CPA_BaseObject> clListOfFamiliesToUpdate;
|
||
CPA_Family *pFamily;
|
||
POSITION pos;
|
||
CString csMessage;
|
||
UINT iResult;
|
||
char szSectionName[SCR_CV_ui_Cfg_MaxLenName];
|
||
|
||
// check all families
|
||
clListOfFamilies.RemoveAll();
|
||
GetMainWorld()->fn_lFindObjects(&clListOfFamilies, "", C_szFamilyTypeName);
|
||
pos = clListOfFamilies.GetHeadPosition();
|
||
while (pos)
|
||
{
|
||
pFamily = (CPA_Family *) clListOfFamilies.GetNext(pos);
|
||
if (pFamily->mfn_bMustUpdateStateList() || pFamily->mfn_bMustUpdatePOList())
|
||
clListOfFamiliesToUpdate.AddTail(pFamily);
|
||
}
|
||
// propose to update them
|
||
if (clListOfFamiliesToUpdate.GetCount() > 0)
|
||
{
|
||
csMessage = "The following families are optimized and were affected by your modifications : \n";
|
||
pos = clListOfFamiliesToUpdate.GetHeadPosition();
|
||
while (pos)
|
||
{
|
||
pFamily = (CPA_Family *) clListOfFamilies.GetNext(pos);
|
||
csMessage += pFamily->GetName() + "\n";
|
||
}
|
||
csMessage += "They must be updated to ensure the coherence of the optimized family. \n";
|
||
csMessage += "Do you want to update them now ? \n";
|
||
csMessage += "If you answer YES, the update may take some time.\n";
|
||
csMessage += "If you answer NO, the optimization files of the families will be deleted. \n";
|
||
|
||
iResult = AfxMessageBox (csMessage, MB_YESNO | MB_ICONQUESTION);
|
||
|
||
switch (iResult)
|
||
{
|
||
case IDNO:
|
||
// for all families to update
|
||
pos = clListOfFamiliesToUpdate.GetHeadPosition();
|
||
while (pos)
|
||
{
|
||
pFamily = (CPA_Family *) clListOfFamiliesToUpdate.GetNext(pos);
|
||
// delete STL file
|
||
sprintf(szSectionName,"%s\\%s\\Families\\%s\\%s.stl^%s",
|
||
fn_szGetLevelsDataPath(),
|
||
fn_p_szGetLevelName(),
|
||
pFamily->GetName(),
|
||
pFamily->GetName(),
|
||
C_SectionCreateListOfState);
|
||
SCR_fn_v_SvL1_RegisterNotify(szSectionName, NULL, pFamily, SCR_EA_Ntfy_DeleteIfExists);
|
||
// delete OTL file
|
||
sprintf(szSectionName,"%s\\%s\\Families\\%s\\%s.otl^%s",
|
||
fn_szGetLevelsDataPath(),
|
||
fn_p_szGetLevelName(),
|
||
pFamily->GetName(),
|
||
pFamily->GetName(),
|
||
C_SectionCreateListOfPOs);
|
||
SCR_fn_v_SvL1_RegisterNotify(szSectionName, NULL, pFamily, SCR_EA_Ntfy_DeleteIfExists);
|
||
// empty the lists
|
||
pFamily->m_oListOfUsedActions.RemoveAll();
|
||
pFamily->m_oListOfUsedPOs.RemoveAll();
|
||
pFamily->m_oListOfUsedObjectTables.RemoveAll();
|
||
}
|
||
break;
|
||
|
||
case IDYES:
|
||
// update actions references
|
||
m_clDocument.m_fn_vUpdateReferencesForAllActions();
|
||
|
||
// for all families to update
|
||
pos = clListOfFamiliesToUpdate.GetHeadPosition();
|
||
while (pos)
|
||
{
|
||
pFamily = (CPA_Family *) clListOfFamiliesToUpdate.GetNext(pos);
|
||
// update and notify the state list of the family
|
||
m_clDocument.m_fn_vUpdateListOfUsedActionsForFamily(pFamily);
|
||
// update the object table list of the family
|
||
m_clDocument.m_fn_vUpdateListOfUsedObjectTablesForFamily(pFamily);
|
||
// update and notify the PO list of the family
|
||
m_clDocument.m_fn_vUpdateListOfUsedPOsForFamily(pFamily);
|
||
// reinit flags
|
||
pFamily->m_bMustUpdateStateList = FALSE;
|
||
pFamily->m_bMustUpdatePOList = FALSE;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
// End Shaitan => optimisation lists in the level
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vAfterSaveAll()
|
||
{
|
||
CString csCurrentFileName;
|
||
POSITION pos = m_clDocument.m_clListOfFilesToDelete.GetHeadPosition();
|
||
while ( pos != NULL )
|
||
{
|
||
csCurrentFileName = m_clDocument.m_clListOfFilesToDelete.GetNext(pos);
|
||
|
||
//Deletes file
|
||
CFile cFile;
|
||
if ( cFile.Open(csCurrentFileName, CFile::modeRead) )
|
||
{
|
||
cFile.Close();
|
||
cFile.Remove(csCurrentFileName);
|
||
}
|
||
}
|
||
|
||
//destroy all EdtList and CPA_tdoNameList that have their existing section flag set to false
|
||
//Gets the current Family List
|
||
char *a_szNameListTypes[] =
|
||
{
|
||
C_szZdeName,
|
||
C_szZddName,
|
||
C_szZdmName,
|
||
C_szZdrName,
|
||
C_szWayName
|
||
};
|
||
for (int i = 0; i < sizeof(a_szNameListTypes) / sizeof(char *); i ++ )
|
||
{
|
||
CPA_List<CPA_BaseObject> oFoundNameLists;
|
||
|
||
GetMainWorld()->fn_lFindObjects( &oFoundNameLists,
|
||
"",
|
||
(char *) LPCTSTR(g_c_csGenericNameListType + a_szNameListTypes[i]),
|
||
NO_CRITERIA );
|
||
|
||
POSITION xPos = oFoundNameLists.GetHeadPosition();
|
||
while ( xPos )
|
||
{
|
||
CPA_tdoNameList *p_oNameList = (CPA_tdoNameList *) oFoundNameLists.GetNext(xPos);
|
||
if ( !p_oNameList->fn_bSectionExists() )
|
||
{
|
||
g_oCoherenceManager.m_fn_vRemoveAllLinks(p_oNameList, C_cLinkedAsChildAndFather);
|
||
delete p_oNameList;
|
||
}
|
||
}
|
||
//empty the list before we go for the next type
|
||
oFoundNameLists.RemoveAll();
|
||
}
|
||
|
||
CPA_List<CPA_BaseObject> oFoundEdtLists;
|
||
GetMainWorld()->fn_lFindObjects(
|
||
&oFoundEdtLists,
|
||
"", // obj name
|
||
C_szEdtListTypeName, //type
|
||
NO_CRITERIA // owner
|
||
);
|
||
POSITION xPos = oFoundEdtLists.GetHeadPosition();
|
||
while ( xPos )
|
||
{
|
||
EdtList *p_oObjectList = (EdtList *) oFoundEdtLists.GetNext(xPos);
|
||
if ( !p_oObjectList->fn_bSectionExists() )
|
||
{
|
||
g_oCoherenceManager.m_fn_vRemoveAllLinks(p_oObjectList, C_cLinkedAsChildAndFather);
|
||
delete p_oObjectList;
|
||
}
|
||
}
|
||
//empty the list before we go for the next type
|
||
oFoundEdtLists.RemoveAll();
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnModifyChild(CPA_BaseObject *pOwner, CPA_BaseObject *pReferencedObject, unsigned long _ulData)
|
||
{
|
||
((CPA_SaveObject *) pOwner)->fn_vNotifySave();
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bOnInvalidateLink(CPA_BaseObject *pOwner, CPA_BaseObject *pReferencedObject, BOOL bDestroyed)
|
||
{
|
||
BOOL bIsZAList = FALSE, bIsObjectList = FALSE;
|
||
if
|
||
(
|
||
(
|
||
(bIsZAList = pReferencedObject->GetType() == C_szZAListTypeName)
|
||
|| (bIsObjectList = pReferencedObject->GetType() == C_szEdtListTypeName)
|
||
)
|
||
&& (
|
||
pOwner->GetType() == C_szActorModelTypeName
|
||
|| pOwner->GetType() == C_szActorInstanceTypeName
|
||
)
|
||
) // if the object is a ZA list or an object list
|
||
{
|
||
CPA_Actor *p_oActor = (CPA_Actor *) pOwner;
|
||
//get the parent name list
|
||
CPA_tdoNameList *p_oNameList = (CPA_tdoNameList *) pReferencedObject->GetOwner();
|
||
//extract the data's name from the namelist's type
|
||
CString csDataName = p_oNameList->GetType().Mid(strlen(C_szGenericNameListType));
|
||
//find the data
|
||
CPA_Editor_ObjectListData *p_oObjectListData = (CPA_Editor_ObjectListData *)
|
||
(p_oActor->m_fn_pclGetEditorActor()->m_fn_p_oFindDataByName(csDataName));
|
||
//make the actor unselect its current ZA or object list if it is the unvalidated one
|
||
if ( bIsZAList )
|
||
{
|
||
ASSERT(p_oObjectListData->m_p_oZAList == pReferencedObject);
|
||
p_oObjectListData->m_p_oZAListKeptForUndo = p_oObjectListData->m_p_oZAList = NULL;
|
||
//set activation list
|
||
p_oObjectListData->m_vUpdateEngineZAList();
|
||
p_oActor->fn_vNotifySave();
|
||
}
|
||
if ( bIsObjectList )
|
||
{
|
||
ASSERT(p_oObjectListData->m_p_oObjectList == pReferencedObject);
|
||
p_oObjectListData->m_p_oObjectListKeptForUndo = p_oObjectListData->m_p_oObjectList = NULL;
|
||
//set object list
|
||
p_oObjectListData->m_vUpdateEngineObjectList();
|
||
p_oActor->fn_vNotifySave();
|
||
}
|
||
//actualiser l'affichage d'acteurs car le Redo() peut se faire m^qd acteurs est s<>lectionn<6E>e
|
||
if
|
||
(
|
||
fn_bIsCurrentEditor()
|
||
&& m_clDocument.m_pclSelectedActor == OAC_fn_pclGetParentActorOfData(p_oObjectListData)
|
||
)
|
||
{
|
||
//p_oObjectListData->m_fn_vLookIfDataHasBeenModified(); //m_bDataHasChanged = TRUE;
|
||
//m_clDocument.m_pclMiniStrucView->m_fn_vUpdateTree();
|
||
m_clDocument.m_pclSelectedActor = NULL;
|
||
m_clDocument.m_fn_vDisplayActor(OAC_fn_pclGetParentActorOfData(p_oObjectListData), ED_ACTORS_eModeOfActorSelection_Unknown);
|
||
//fn_vOnActivateEditor(NULL, FALSE);
|
||
}
|
||
}
|
||
return FALSE; //incoherence remains -> there is no incoherence now, but the link remains active
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnRestoreLink(CPA_BaseObject *pOwner, CPA_BaseObject *pReferencedObject)
|
||
{
|
||
BOOL bIsZAList = FALSE, bIsObjectList = FALSE;
|
||
if
|
||
(
|
||
(
|
||
(bIsZAList = pReferencedObject->GetType() == C_szZAListTypeName)
|
||
|| (bIsObjectList = pReferencedObject->GetType() == C_szEdtListTypeName)
|
||
)
|
||
&& (
|
||
pOwner->GetType() == C_szActorModelTypeName
|
||
|| pOwner->GetType() == C_szActorInstanceTypeName
|
||
)
|
||
) // if the object is a ZA list or an object list
|
||
{
|
||
CPA_Actor *p_oActor = (CPA_Actor *) pOwner;
|
||
//get the parent name list
|
||
CPA_tdoNameList *p_oNameList = (CPA_tdoNameList *) pReferencedObject->GetOwner();
|
||
//extract the data's name from the namelist's type
|
||
CString csDataName = p_oNameList->GetType().Mid(strlen(C_szGenericNameListType));
|
||
//find the data
|
||
CPA_Editor_ObjectListData *p_oObjectListData = (CPA_Editor_ObjectListData *)
|
||
(p_oActor->m_fn_pclGetEditorActor()->m_fn_p_oFindDataByName(csDataName));
|
||
//make the actor unselect its current ZA or object list if it is the unvalidated one
|
||
if ( bIsZAList )
|
||
{
|
||
ASSERT(!p_oObjectListData->m_p_oZAList);
|
||
p_oObjectListData->m_p_oZAListKeptForUndo = p_oObjectListData->m_p_oZAList = (CPA_ZonesActivatingList *) pReferencedObject;
|
||
}
|
||
if ( bIsObjectList )
|
||
{
|
||
ASSERT(!p_oObjectListData->m_p_oObjectList);
|
||
p_oObjectListData->m_p_oObjectListKeptForUndo = p_oObjectListData->m_p_oObjectList = (EdtList *) pReferencedObject;
|
||
|
||
}
|
||
//actualiser l'affichage d'acteurs car le Redo() peut se faire m^qd acteurs est s<>lectionn<6E>e
|
||
if
|
||
(
|
||
fn_bIsCurrentEditor()
|
||
&& m_clDocument.m_pclSelectedActor == OAC_fn_pclGetParentActorOfData(p_oObjectListData)
|
||
)
|
||
{
|
||
//p_oObjectListData->m_fn_vLookIfDataHasBeenModified(); //m_bDataHasChanged = TRUE;
|
||
//m_clDocument.m_pclMiniStrucView->m_fn_vUpdateTree();
|
||
m_clDocument.m_pclSelectedActor = NULL;
|
||
m_clDocument.m_fn_vDisplayActor(OAC_fn_pclGetParentActorOfData(p_oObjectListData), ED_ACTORS_eModeOfActorSelection_Unknown);
|
||
//fn_vOnActivateEditor(NULL, FALSE);
|
||
}
|
||
}
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vHasLostFocus(void)
|
||
{
|
||
//-----------------IR-------------------------
|
||
#ifdef D_ED_IR_ACTIVE
|
||
EDAC_fn_vOnLostFocusAIEditor();
|
||
#endif //D_ED_IR_ACTIVE
|
||
//--------------------------------------------
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bHasGainedFocus(void)
|
||
{
|
||
m_clDocument.m_pub_fn_vUpdateActorsEnumDescriptor();
|
||
m_clDocument.m_pub_fn_vUpdatePartGenEnumDescriptor();
|
||
m_clDocument.m_pub_fn_vUpdateGraphEnumDescriptor();
|
||
|
||
//CPA2 Stegaru Cristian 98-04
|
||
m_clDocument.m_fnUpdateWithExternData ();
|
||
//End CPA2 Stegaru Cristian 98-04
|
||
|
||
// display Tip of the Day
|
||
GetInterface()->fn_vDisplayTipOfDay("Actors", "OAC", g_bTipFirstTime);
|
||
g_bTipFirstTime = FALSE;
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
/*===========================================================================
|
||
Current Editor
|
||
=========================================================================*/
|
||
|
||
//**************************************************************************************
|
||
//Called to obtain permission to open another Editor when this one is opne
|
||
tdePermission CPA_Actor_Editor_Interface::fn_eAcceptNewEditor(CPA_EditorBase *pNewEditor)
|
||
{
|
||
return C_Allow;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanActivateEditor(CPA_List<CPA_SaveObject> *pParams)
|
||
{
|
||
#ifdef __INACTIVE_INTERFACE__
|
||
return FALSE;
|
||
#endif //__INACTIVE_INTERFACE__
|
||
|
||
return ( !fn_bIsCurrentEditor() );
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnActivateEditor(CPA_List<CPA_BaseObject> *pParams,
|
||
BOOL bBackActivated)
|
||
{
|
||
#ifndef __INACTIVE_INTERFACE__
|
||
//CPA2 Stegaru Cristian 98-05
|
||
//BUG0805
|
||
EdActors_EditorActor *pclSelectedEdActor = NULL;
|
||
if (M_GetWorld()->GetCountSelected() == 1)
|
||
{
|
||
CPA_SuperObject *pSelectedObject = M_GetWorld()->GetSingleSelection();
|
||
if (pSelectedObject && (pSelectedObject->GetRealTypeName() == g_c_csActorType))
|
||
{
|
||
m_pclSelectedActorForTreeView = (CPA_Actor *)pSelectedObject->GetObject ();
|
||
pclSelectedEdActor = m_pclSelectedActorForTreeView->m_fn_pclGetEditorActor();
|
||
}
|
||
}
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
|
||
if ( ( pParams != NULL ) && ( pParams->GetCount() > 0 ) )
|
||
{
|
||
CPA_BaseObject *pclBO = pParams->GetHead();
|
||
|
||
CPA_Actor *pclActor;
|
||
if ( pclBO->fn_bIsOfType(C_szActorInstanceTypeName) )
|
||
pclActor = (CPA_Actor *)pclBO;
|
||
else
|
||
pclActor = (CPA_Actor *)(((CPA_SuperObject *)pclBO)->GetObject());
|
||
|
||
m_clDocument.m_fn_vDisplayActor(pclActor->m_fn_pclGetEditorActor(), ED_ACTORS_eModeOfActorSelection_InHierarchy);
|
||
}
|
||
else if ( m_clDocument.m_pclSelectedActor != NULL ||
|
||
//CPA2 Stegaru Cristian 98-05
|
||
pclSelectedEdActor)
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
{
|
||
//force the redisplay and update of the current actor
|
||
//CPA2 Stegaru Cristian 98-05
|
||
EdActors_EditorActor *p_oSavedActor = NULL;
|
||
if (pclSelectedEdActor)
|
||
p_oSavedActor = pclSelectedEdActor;
|
||
else
|
||
p_oSavedActor = m_clDocument.m_pclSelectedActor;
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
|
||
m_clDocument.m_pclSelectedActor = NULL;
|
||
m_clDocument.m_fn_vDisplayActor(p_oSavedActor, ED_ACTORS_eModeOfActorSelection_Unknown);
|
||
}
|
||
|
||
m_fn_vShowEditor();
|
||
|
||
// check zone with BdV
|
||
if (m_clDocument.m_pclSelectedActor && m_clDocument.m_pclSelectedActor->m_fn_bIsAnInstance())
|
||
{
|
||
CPA_ObjectDLLBase *pZoneDll = GetMainWorld()->GetObjectDLLWithName(C_szDLLZDxName);
|
||
if (pZoneDll)
|
||
pZoneDll->OnQueryAction(this, C_uiQueryCheckZonesAgainstBV, (long)m_clDocument.m_pclSelectedActor->m_pclActor->m_pub_fn_pclGetSuperObject());
|
||
}
|
||
|
||
#endif //__INACTIVE_INTERFACE__
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanCloseEditor(void)
|
||
{
|
||
return ( fn_bIsCurrentEditor() );
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnCloseEditor(void)
|
||
{
|
||
|
||
}
|
||
|
||
//**************************************************************************************
|
||
/***********************************************************************
|
||
You MUST define this function !
|
||
|
||
- If there is only one available descriptor, this function must load
|
||
the corresponding file.
|
||
- If there are several possible descriptors, this function must give a choice
|
||
to the user (dialog box), and load the corresponding file.
|
||
|
||
In both case, initialize the parameters of the SuperObject (Type and TypeName).
|
||
************************************************************************/
|
||
void CPA_Actor_Editor_Interface::fn_vInitListsOfModels(void)
|
||
{
|
||
GetInterface()->fn_bAddANewModelList(g_c_csActorModelType, this);
|
||
}
|
||
|
||
//**************************************************************************************
|
||
/***********************************************************************
|
||
You MUST define this function
|
||
|
||
Init the type of objects the DLL can give to Hierarchy Editor
|
||
************************************************************************/
|
||
void CPA_Actor_Editor_Interface::fn_vInitListByType(CPA_World *pWorld)
|
||
{
|
||
pWorld->fn_vAddANewListByType(M_MAKECHAR(g_c_csActorType), this);
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanLoadNewModel(CString csListName)
|
||
{
|
||
return TRUE;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanDeleteModel(CString csListName)
|
||
{
|
||
// return TRUE;
|
||
return FALSE;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanChangeModelIcon(CString csListName)
|
||
{
|
||
return TRUE;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanSaveListModels(CString csListName)
|
||
{
|
||
BOOL bReturn = FALSE/*TRUE*/;
|
||
|
||
return bReturn;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanLoadListModels(void)
|
||
{
|
||
BOOL bReturn = FALSE/*TRUE*/;
|
||
|
||
return bReturn;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vSaveListModels(CString csListName,
|
||
CPA_List<EDT_Model> *pListModels)
|
||
{
|
||
|
||
}
|
||
|
||
//**************************************************************************************
|
||
CString CPA_Actor_Editor_Interface::fn_csLoadListModels(void)
|
||
{
|
||
CString csReturn("Essai");
|
||
|
||
return csReturn;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
CString CPA_Actor_Editor_Interface::fn_csChangeModelIcon (CString csListName, CString csModelName)
|
||
{
|
||
CPA_SuperObject *pclModel;
|
||
POSITION pos = m_stListModels.GetHeadPosition();
|
||
CString csCurrentModelName;
|
||
CString csBitmapName;
|
||
BOOL bModelFound = FALSE;
|
||
|
||
// find the corresponding model
|
||
while (pos && !bModelFound)
|
||
{
|
||
pclModel = m_stListModels.GetNext(pos);
|
||
csCurrentModelName = ((CPA_Actor *)pclModel->GetObject())->m_fn_pclGetEditorActor()->m_fn_csGetActorName();
|
||
bModelFound = ( csModelName.Compare(csCurrentModelName) == 0 );
|
||
}
|
||
if (!bModelFound)
|
||
return "";
|
||
|
||
|
||
// dialog to choose the bitmap
|
||
EdActors_ModelIconDialog dial(&g_oBaseFrame, pclModel);
|
||
|
||
if (dial.DoModal() == IDOK)
|
||
{
|
||
// get bitmap name
|
||
csBitmapName = dial.m_fn_csGetBitmapName();
|
||
|
||
// update EMA file
|
||
CPA_Actor *pclEdtModel = (CPA_Actor *)pclModel->GetObject();
|
||
EdActors_EditorActorModel *pclActorModel = (EdActors_EditorActorModel *)(pclEdtModel->m_fn_pclGetEditorActor());
|
||
pclActorModel->m_fn_vSetBitmapName(csBitmapName);
|
||
pclEdtModel->fn_vNotifySave();
|
||
|
||
// get real bitmap name
|
||
if (pclEdtModel->m_fn_bIsAGenDoor())
|
||
csBitmapName = m_clDocument.m_csModelsBitmapsPathForGenDoors + csBitmapName;
|
||
else
|
||
csBitmapName = m_clDocument.m_csModelsBitmapsPath + csBitmapName;
|
||
|
||
// return appropriate bitmap
|
||
return csBitmapName;
|
||
}
|
||
else
|
||
return "";
|
||
|
||
}
|
||
|
||
|
||
//**************************************************************************************
|
||
tdeTypeSO CPA_Actor_Editor_Interface::GetTypeInstance (CString csTypeName, CString csModelName)
|
||
{
|
||
return C_Dynamic;
|
||
}
|
||
|
||
//ANNECY Shaitan EmptySectors (25/02/98)
|
||
//**************************************************************************************
|
||
tdeSaveStatus CPA_Actor_Editor_Interface::GetStatusInstance (CString csTypeName, CString csModelName)
|
||
{
|
||
return E_ss_NoSave;
|
||
}
|
||
//ENDANNECY Shaitan EmptySectors
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bChooseInsertPosition (CPA_SuperObject *pNewInstance,
|
||
CPA_SuperObject *pParent,
|
||
tdstPosition *p_stPosition)
|
||
{
|
||
CPA_Actor *pclActor = (CPA_Actor *)pNewInstance->GetObject();
|
||
|
||
//Sets Sectors info for Actor (Motor function)
|
||
HIE_tdxHandleToSuperObject hActorSO = pNewInstance->GetStruct();
|
||
struct MTH3D_tdstVector_ *p_tdstVector = (struct MTH3D_tdstVector_ *)&(p_stPosition->stPos.stPos3D);
|
||
|
||
fn_vSectInfoInitForSingleCharacter(hActorSO, p_tdstVector);
|
||
|
||
return FALSE;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnCancelInsertion(CPA_SuperObject *pInstance)
|
||
{
|
||
|
||
}
|
||
|
||
// Bounding Volume : Compute bounding volume of an actor
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vComputeBoundingVolume(CPA_BaseObject *pObject)
|
||
{
|
||
//CPA2 Stegaru Cristian 98-04
|
||
|
||
CPA_Actor *_pActor = (CPA_Actor *)pObject;
|
||
MTH3D_tdstVector stFatherCenter;
|
||
MTH_tdxReal xFatherRadius;
|
||
MTH3D_tdstVector stCenter = {0,0,0};
|
||
MTH_tdxReal xRadius = 0.0;
|
||
|
||
|
||
|
||
if ( !((CPA_Actor *)_pActor)->m_fn_bIsAGenDoor() )
|
||
{
|
||
// Get the editor super object and the engine super object
|
||
CPA_SuperObject * pEditorSuperObject = _pActor->m_pub_fn_pclGetSuperObject();
|
||
HIE_tdxHandleToSuperObject hEngineSuperObject = _pActor->m_pub_fn_hGetMotorSuperObject();
|
||
GEO_tdxHandleToBoundingSphere hFatherBoundingSphere;
|
||
|
||
hFatherBoundingSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(hEngineSuperObject);
|
||
if (!hFatherBoundingSphere)
|
||
GEO_fn_vCreateBoundingSphere(&hFatherBoundingSphere);
|
||
|
||
// Compute bounding volume of all childs of the actor
|
||
for (CPA_SuperObject * pChildSuperObject = pEditorSuperObject -> GetSuperObjectFirstChild () ;
|
||
pChildSuperObject ;
|
||
pChildSuperObject = pEditorSuperObject -> GetSuperObjectNextChild (pChildSuperObject))
|
||
{
|
||
CPA_BaseObject * pChildObject;
|
||
CPA_ObjectDLLBase * pEditor;
|
||
ACP_tdxHandleOfObject hChildBdV;
|
||
|
||
pChildObject = pChildSuperObject -> GetObject ();
|
||
if (pChildObject)
|
||
{
|
||
pEditor = (CPA_ObjectDLLBase *) pChildObject -> GetEditor ();
|
||
pEditor -> fn_vComputeBoundingVolume (pChildObject);
|
||
|
||
hChildBdV = pEditor -> fn_hGetBoundingVolume (pChildObject);
|
||
GEO_fn_vAddObjectToSphere( hChildBdV, &stCenter, &xRadius);
|
||
GEO_fn_vSetBoundingSphere(hFatherBoundingSphere, &stCenter, xRadius);
|
||
}
|
||
}
|
||
/*--- We update the engine bounding volume ---*/
|
||
HIE_fn_vSetSuperObjectBoundingVolume(hEngineSuperObject, (void *)hFatherBoundingSphere);
|
||
MTH3D_M_vCopyVector(&stFatherCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hFatherBoundingSphere));
|
||
xFatherRadius = GEO_fn_xGetRadiusOfBoundingSphere(hFatherBoundingSphere);
|
||
|
||
HIE_fn_vComputeAllBoundingVolumes (hEngineSuperObject);
|
||
}
|
||
//End CPA2 Stegaru Cristian 98-04
|
||
|
||
}
|
||
|
||
// return bounding volume of an actor
|
||
//**************************************************************************************
|
||
ACP_tdxHandleOfObject CPA_Actor_Editor_Interface::fn_hGetBoundingVolume(CPA_BaseObject *_pObj)
|
||
{
|
||
CPA_Family *pFamily = (CPA_Family *)_pObj->GetOwner()->GetOwner();
|
||
ERROR_ASSERT( pFamily != NULL );
|
||
|
||
CPA_BaseObject *pBoundingVolumeOfFamily = pFamily->mfn_p_oGetBoundingVolume();
|
||
CPA_Actor *_pActor = (CPA_Actor *)_pObj;
|
||
|
||
if ( pBoundingVolumeOfFamily != NULL )
|
||
{
|
||
/*--- If the family of the actor has a bounding volume, we use it ---*/
|
||
return (ACP_tdxHandleOfObject)pBoundingVolumeOfFamily->GetData();
|
||
}
|
||
else
|
||
return (ACP_tdxHandleOfObject)NULL;
|
||
}
|
||
|
||
//#################################################################################
|
||
|
||
//**************************************************************************************
|
||
/***********************************************************************
|
||
You MUST define this function !
|
||
|
||
- If there is only one available descriptor, this function must load
|
||
the corresponding file.
|
||
- If there are several possible descriptors, this function must give a choice
|
||
to the user (dialog box), and load the corresponding file.
|
||
|
||
In both case, initialize the parameters of the SuperObject (Type and TypeName).
|
||
************************************************************************/
|
||
EDT_Model * CPA_Actor_Editor_Interface::GetNewModel(CString csListName)
|
||
{
|
||
//Checks the type of Models required
|
||
if ( ( csListName.Compare(g_c_csActorModelType) != 0 )
|
||
&& ( csListName.CompareNoCase("All Types") != 0 )
|
||
)
|
||
return NULL;
|
||
|
||
//Creates Editor's Model
|
||
CString csBitmapName;
|
||
CPA_SuperObject *pNewModel = m_clDocument.m_fn_pclCreateModel(csBitmapName);
|
||
EDT_Model *pclNewEDTModel = NULL;
|
||
|
||
if ( pNewModel != NULL )
|
||
{
|
||
//Adds to Models global list
|
||
m_stListModels.AddTail(pNewModel);
|
||
|
||
//Sets Model's Bitmap name
|
||
CPA_Actor *pclEdtModel = (CPA_Actor *)pNewModel->GetObject();
|
||
EdActors_EditorActorModel *pclModel = (EdActors_EditorActorModel *)(pclEdtModel->m_fn_pclGetEditorActor());
|
||
pclModel->m_fn_vSetBitmapName(csBitmapName);
|
||
|
||
if ( pclEdtModel->m_fn_bIsAGenDoor() )
|
||
csBitmapName = m_clDocument.m_csModelsBitmapsPathForGenDoors + csBitmapName;
|
||
else
|
||
csBitmapName = m_clDocument.m_csModelsBitmapsPath + csBitmapName;
|
||
|
||
pclNewEDTModel = new EDT_Model( this,
|
||
g_c_csActorModelType,
|
||
pNewModel->GetModelName(),
|
||
csBitmapName,
|
||
GetInterface()
|
||
);
|
||
|
||
if ( csListName.CompareNoCase("All Types") == 0 )
|
||
GetInterface()->fn_bAddANewModel(pclNewEDTModel, g_c_csActorModelType, this);
|
||
|
||
//Sends a notification for this new Model to be saved
|
||
pclEdtModel->SetExistingSection(FALSE);
|
||
pclEdtModel->fn_vNotifySave();
|
||
}
|
||
|
||
if ( csListName.CompareNoCase("All Types") == 0 )
|
||
return NULL;
|
||
else
|
||
return pclNewEDTModel;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
/***********************************************************************
|
||
You MUST define this function
|
||
|
||
Creates a copy of the object
|
||
************************************************************************/
|
||
CPA_SuperObject *CPA_Actor_Editor_Interface::GetNewInstance(CString csTypeName,
|
||
CString csModelName,
|
||
CPA_SuperObject *pParent)
|
||
{
|
||
CPA_SuperObject *pNewInstance = NULL;
|
||
CString csNewInstanceName;
|
||
CPA_Actor *pNewEditorInstance = NULL;
|
||
HIE_tdxHandleToSuperObject hMotorSO = NULL;
|
||
CPA_Actor *pclEdModel = NULL;
|
||
// Shaitan => optimisation lists in the level
|
||
BOOL bMustCheckReferences = FALSE;
|
||
// End Shaitan => optimisation lists in the level
|
||
|
||
|
||
//Checks Type name
|
||
if ( ( csTypeName.Compare(g_c_csActorModelType) != 0 )
|
||
&& ( csTypeName.Compare(g_c_csActorType) != 0 )
|
||
)
|
||
return NULL;
|
||
|
||
//---------------------------------------------------------
|
||
// Searches for the right Model
|
||
//---------------------------------------------------------
|
||
CPA_SuperObject *pclModel;
|
||
BOOL bModelFound = FALSE;
|
||
POSITION pos = m_stListModels.GetHeadPosition();
|
||
CString csCurrentModelName;
|
||
while ( ( pos != NULL ) && ( !bModelFound ) )
|
||
{
|
||
pclModel = m_stListModels.GetNext(pos);
|
||
|
||
csCurrentModelName = ((CPA_Actor *)pclModel->GetObject())->m_fn_pclGetEditorActor()->m_fn_csGetActorName();
|
||
|
||
bModelFound = ( csModelName.Compare(csCurrentModelName) == 0 );
|
||
}
|
||
|
||
//---------------------------------------------------------
|
||
// Checks the Model for Instanciation
|
||
//---------------------------------------------------------
|
||
BOOL bInstanciationChecked = FALSE;
|
||
|
||
if ( bModelFound )
|
||
{
|
||
pclEdModel = (CPA_Actor *)pclModel->GetObject();
|
||
|
||
// Shaitan => optimisation lists in the level
|
||
bMustCheckReferences = pclEdModel->m_fn_pclGetEditorModel()->m_clInstancesList.IsEmpty();
|
||
// End Shaitan => optimisation lists in the level
|
||
|
||
bInstanciationChecked = pclEdModel->m_pub_fn_bCheckModelForInstanciation();
|
||
}
|
||
|
||
//---------------------------------------------------------
|
||
// Instanciates the Model
|
||
//---------------------------------------------------------
|
||
if ( bInstanciationChecked )
|
||
{
|
||
//check that all name lists are specified before creating the instance...
|
||
#if defined ( D_DoNotInstanciateIncompleteModels )
|
||
if ( !((EdActors_EditorActorModel *) ((CPA_Actor *) pclModel->GetObject())->m_fn_pclGetEditorActor())->m_bAllListsAreSpecified() )
|
||
return NULL;
|
||
#endif /* D_DoNotInstanciateIncompleteModels */
|
||
|
||
//Creates Editor's Instance
|
||
ReleaseCapture(); //PROVISOIRE...
|
||
|
||
if ( m_clDocument.m_fn_bCanInstantiateModel(csModelName, csNewInstanceName) )
|
||
{
|
||
//Creates SuperObject
|
||
pNewInstance = GetInterface()->GetNewSuperObject( E_ss_NoSave,
|
||
C_Protected,
|
||
csNewInstanceName,
|
||
"");
|
||
|
||
//Creates Editor Object
|
||
pNewEditorInstance = new CPA_Actor( NULL,
|
||
NULL,
|
||
g_c_csActorType,
|
||
pclEdModel,
|
||
pclEdModel->m_pub_fn_pclGetFamily(), /* Family */
|
||
pNewInstance, /* Super Object */
|
||
csNewInstanceName);
|
||
|
||
pNewEditorInstance->m_fn_vMakeGenDoor(pclEdModel->m_fn_bIsAGenDoor());
|
||
pNewEditorInstance->m_pub_fn_vSetSuperObject(pNewInstance);
|
||
|
||
hMotorSO = (HIE_tdxHandleToSuperObject)pNewInstance->GetStruct();
|
||
|
||
AfxGetApp()->DoWaitCursor(1);
|
||
if ( !pNewEditorInstance->m_fn_bIsAGenDoor() )
|
||
{
|
||
//Loads the Animation for the first State (if it's not done)
|
||
|
||
//Gets the Initial State
|
||
tdxHandleToState hInitState = fn_h3dDataGetInitialState(M_GetMSHandle(hMotorSO,3dData));
|
||
CPA_State *p_clState = (CPA_State *)GetMainWorld()->fn_p_oFindObjectWithEngine(hInitState, C_szStateTypeName);
|
||
|
||
//Loads the correponding Animation
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an InstancQqqqqqqqqqqqe from Editor : getting the Editor State",
|
||
"CPA_Actor_Editor_Interface::GetNewInstance(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"No Editor Sqtate corresponding to Motor one, or invalid Motor State");
|
||
ERROR_ASSERT( p_clState != NULL );
|
||
|
||
CPA_Animation *p_clAnimation = p_clState->mfn_p_oGetAnimation();
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Instance from Editor : getting the animation for the State",
|
||
"CPA_Actor_Editor_Interface::GetNewInstance(...)",
|
||
E_ERROR_GRAVITY_WARNING,
|
||
"No Animation for the State");
|
||
ERROR_ASSERT( p_clAnimation != NULL );
|
||
|
||
if (!p_clAnimation)
|
||
{
|
||
fn_vSetAnimInState(hInitState, NULL);
|
||
}
|
||
else if (!p_clAnimation->fn_bIsAvailable())
|
||
{
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Instance from Editor",
|
||
"CPA_Actor_Editor_Interface::GetNewInstance(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Could not load the initial Animation");
|
||
ERROR_VERIFY( p_clAnimation->GetEditor()->fn_bLoadBaseObject(p_clAnimation) );
|
||
|
||
//Sets motor pointers
|
||
fn_vSetAnimInState(hInitState, (struct tdstAnim3d_ *)p_clAnimation->GetData());
|
||
}
|
||
|
||
//Sets the Object Table (as the Model's one)
|
||
tdxHandleToObjectsTablesList hObjectTable;
|
||
tdstEngineObject *pstEngineModel=(tdstEngineObject *)pclEdModel->GetData();
|
||
hObjectTable=fn_h3dDataGetInitialObjectsTable(pstEngineModel->h_3dData);
|
||
|
||
// If not found, use the default value of the family
|
||
if ( hObjectTable == NULL )
|
||
{
|
||
tdxHandleToFamilyList hFamily = (tdxHandleToFamilyList)(pclEdModel->m_pub_fn_pclGetFamily()->GetData());
|
||
hObjectTable = hFamily->h_DefaultObjectsTable;
|
||
}
|
||
|
||
fn_v3dDataSetCurrentObjectsTable(M_GetMSHandle(hMotorSO,3dData), hObjectTable);
|
||
fn_v3dDataSetInitialObjectsTable(M_GetMSHandle(hMotorSO,3dData), hObjectTable);
|
||
|
||
if (p_clAnimation)
|
||
{
|
||
CString csInfoMessage = CString("Actors Editor has loaded the following animation : ") + p_clAnimation->GetName();
|
||
EDACTORS_fn_vGiveProgressInfo(csInfoMessage);
|
||
}
|
||
}
|
||
|
||
AfxGetApp()->DoWaitCursor(-1);
|
||
|
||
//Changes the draw mask for the zones to be showed (Alexis)
|
||
HIE_fn_vSetSuperObjectDrawMask (pNewInstance->GetStruct(),
|
||
GLI_C_lAllIsEnable ^ GLI_C_lIsNotDrawCollideInformation);
|
||
//ANNECY Shaitan SPOFlags 20/02/98
|
||
// Actors have zoom instead of scale
|
||
// HIE_fn_SO_vSetFlags (pNewInstance->GetStruct(), HIE_C_Flag_ulZoomInsteadOfScale);
|
||
//ENDANNECY Shaitan SPOFlags
|
||
}
|
||
}
|
||
else
|
||
return NULL;
|
||
|
||
if ( pNewInstance != NULL )
|
||
{
|
||
pNewInstance->SetModelName(csModelName);
|
||
pNewInstance->SetTypeSO(C_Dynamic);
|
||
|
||
CPA_Actor *pclEdInst = (CPA_Actor *)pNewInstance->GetObject();
|
||
|
||
//Prepares Motor Actor
|
||
m_fn_vPrepareMotorActor(pclEdInst);
|
||
|
||
//Sets motor object's SO
|
||
EdActors_tdhHandleToActor hActor = pclEdInst->m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor();
|
||
M_SetSuperObject(hActor, hMotorSO);
|
||
|
||
//Motor MS initialization
|
||
fn_vAllSecondPassAreDone(hActor->h_StandardGame);
|
||
fn_vInitOneObject(hActor, OTI_MapLoaded);
|
||
|
||
//Sets the Motor SO's global Matrix as the 3DData's Matrix
|
||
HIE_fn_vSetSuperObjectMatrix(hMotorSO, fn_p_st3dDataGetMatrix(M_GetMSHandle(hMotorSO,3dData)));
|
||
GEO_M_vCopyMatrix(hMotorSO->hGlobalMatrix, hMotorSO->hLocalMatrix);
|
||
|
||
//Calls Motor function to add to this Instance its graphical Childs
|
||
fn_vAddChildToSuperObject(hMotorSO, //Motor SuperObject
|
||
M_MAKECHAR(pclEdInst->m_pub_fn_pclGetFamily()->GetName()),//Family Name
|
||
M_MAKECHAR(pclEdInst->m_fn_pclGetModel()->GetName()), //Model Name
|
||
M_MAKECHAR(pclEdInst->GetName())); //Perso. Name
|
||
|
||
if ( !pNewEditorInstance->m_fn_bIsAGenDoor() )
|
||
pNewEditorInstance->m_pub_fn_vAddChildsFromEngineChilds();
|
||
else
|
||
pNewEditorInstance->m_pub_fn_vAddChildsForGenDoors();
|
||
|
||
//Sends a notification for the Level to be saved
|
||
m_clDocument.m_fn_vNotifyLevel(pNewEditorInstance);
|
||
|
||
//-----------------IR-------------------------
|
||
//Process IA for this new instance
|
||
if(pNewEditorInstance!=NULL)
|
||
{
|
||
if(pNewEditorInstance->m_fn_pclGetModel()!=NULL)
|
||
{
|
||
//Process IA
|
||
// Shaitan => optimisation lists in the level
|
||
EDAC_fn_vProcessBrain(pNewEditorInstance->m_fn_pclGetModel(),pNewEditorInstance, bMustCheckReferences);
|
||
// End Shaitan => optimisation lists in the level
|
||
}
|
||
}
|
||
//--------------------------------------------
|
||
|
||
//Displays in Editor
|
||
//Moved in 'OnModifInsert' [20 / 01/ 98]
|
||
// m_clDocument.m_fn_vDisplayActor(pclEdInst->m_fn_pclGetEditorActor(), ED_ACTORS_eModeOfActorSelection_Unknown);
|
||
|
||
// Shaitan => optimisation lists in the level
|
||
// must update family lists
|
||
pNewEditorInstance->m_pub_fn_pclGetFamily()->mfn_vSetModifiedStateList();
|
||
pNewEditorInstance->m_pub_fn_pclGetFamily()->mfn_vSetModifiedPOList();
|
||
// End Shaitan => optimisation lists in the level
|
||
}
|
||
|
||
//CPA2 Stegaru Cristian 98-04
|
||
m_fn_vCheckFamilyBoundingVolume (pNewEditorInstance);
|
||
//End CPA2 Stegaru Cristian 98-04
|
||
//CPA2 Stegaru Cristian 98/07/16
|
||
m_clDocument.mfn_vCheckModelToUpdateAlwFile (pclEdModel);
|
||
//End CPA2 Stegaru Cristian 98/07/16
|
||
return pNewInstance;
|
||
}
|
||
|
||
|
||
/***********************************************************************
|
||
You MUST define this function
|
||
|
||
Create a copy of the object
|
||
************************************************************************/
|
||
CPA_Object *CPA_Actor_Editor_Interface::Duplicate(CPA_Object *pObject,
|
||
CPA_SuperObject *pNewSupObj)
|
||
{
|
||
///////////////////////////////
|
||
// ONLY WORKS FOR INSTANCES //
|
||
///////////////////////////////
|
||
/* CPA_Actor *pclNewInstance = NULL;
|
||
|
||
//PROVISOIRE...
|
||
pNewSupObj->GetStruct()->hLocalMatrix = (GEO_tdxHandleToMatrix)malloc(sizeof(POS_tdstCompletePosition));
|
||
POS_fn_vSetIdentityMatrix(pNewSupObj->GetStruct()->hLocalMatrix);
|
||
|
||
CPA_Actor *pclSourceObject = (CPA_Actor *)pObject;
|
||
|
||
//PROVISOIRE...
|
||
//Creates Editor's object
|
||
pclNewInstance = new CPA_Actor( g_pclInterface,
|
||
GetMainWorld(),
|
||
NULL,
|
||
NULL,
|
||
g_c_csActorType,
|
||
pclSourceObject->m_fn_pclGetModel(),
|
||
NULL,
|
||
NULL,
|
||
"");
|
||
|
||
//Prepares Motor Actor
|
||
m_fn_vPrepareMotorActor(pclNewInstance);
|
||
|
||
HIE_tdxHandleToSuperObject hMotorSO = (HIE_tdxHandleToSuperObject)pNewSupObj->GetStruct();
|
||
|
||
//Sets motor object's SO
|
||
EdActors_tdhHandleToActor hActor = pclNewInstance->m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor();
|
||
M_SetSuperObject(hActor, hMotorSO);
|
||
|
||
//Sets the Motor SO's global Matrix as the 3DData's Matrix
|
||
HIE_fn_vSetSuperObjectMatrix(hMotorSO, fn_p_st3dDataGetMatrix(M_GetMSHandle(hMotorSO,3dData)));
|
||
//HIE_fn_vInvalidateOneGlobalMatrix(hMotorSO);
|
||
GEO_M_vCopyMatrix(hMotorSO->hGlobalMatrix, hMotorSO->hLocalMatrix);
|
||
|
||
//Calls Motor function to add to this Instance its graphical Childs
|
||
fn_vAddChildToSuperObject(hMotorSO, //Motor SuperObject
|
||
M_MAKECHAR(pclNewInstance->m_pub_fn_pclGetFamily()->GetName()), //Family Name
|
||
M_MAKECHAR(pclNewInstance->m_fn_pclGetModel()->GetName()), //Model Name
|
||
M_MAKECHAR(pclNewInstance->GetName())); //Perso. Name
|
||
|
||
//Will be done in return of this function
|
||
pNewSupObj->SetObject(pclNewInstance);
|
||
}
|
||
|
||
return pclNewInstance;
|
||
*/
|
||
return NULL;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
CPA_SuperObject *CPA_Actor_Editor_Interface::GetCopyOfProtectedChild(CPA_SuperObject *pInitialChild,
|
||
CPA_SuperObject *pNewOwner)
|
||
{
|
||
/* unsigned short uwOriginCounter = 0;
|
||
unsigned short uwDestCounter = 0;
|
||
|
||
//Searches for the Index in Origin list
|
||
CPA_SuperObject *pclOldOwner = pInitialChild->GetSuperObjectFather();
|
||
CPA_SuperObject *pclModuleSO = pclOldOwner->GetSuperObjectFirstChild();
|
||
BOOL bFound = FALSE;
|
||
BOOL bMustContinue = TRUE;
|
||
while ( (!bFound) && (bMustContinue) )
|
||
{
|
||
bFound = ( pclModuleSO == pInitialChild );
|
||
|
||
if ( !bFound )
|
||
{
|
||
pclModuleSO = pclOldOwner->GetSuperObjectNextChild(pclModuleSO);
|
||
uwOriginCounter ++;
|
||
bMustContinue = ( pclModuleSO != NULL );
|
||
}
|
||
}
|
||
|
||
ASSERT (bMustContinue);
|
||
ASSERT (bFound);
|
||
|
||
//Searches for the right Motor SO in the list of pNewOwner,
|
||
//and creates the SO Copy
|
||
CPA_SuperObject *pclSuperObjectCopy = NULL;
|
||
long c_lI;
|
||
HIE_tdxHandleToSuperObject hMotorSO = (HIE_tdxHandleToSuperObject)pNewOwner->GetStruct();
|
||
HIE_tdxHandleToSuperObject hChild;
|
||
POInterface *p_oPODLL = (POInterface *)GetMainWorld()->GetObjectDLLWithName(C_szDLLPhysicalObjectName);
|
||
HIE_M_ForEachChildOf(hMotorSO, hChild, c_lI)
|
||
{
|
||
if ( hChild->lTypeOfLinkedObject == C_ucPhysicalObject )
|
||
{
|
||
pclSuperObjectCopy = p_oPODLL->GetNewEditorInstance( hChild );
|
||
|
||
pclSuperObjectCopy->SetTypeSO(C_Protected);
|
||
|
||
//Adds graphical SuperObject as Actor's child
|
||
pNewOwner->AddTail(pclSuperObjectCopy, FALSE);
|
||
//Indicates that Module is Actor's property
|
||
pclSuperObjectCopy->SetSuperObjectOwner(pNewOwner);
|
||
pclSuperObjectCopy->SetEditProtected(TRUE);
|
||
}
|
||
else if ( hChild->lTypeOfLinkedObject == C_ucSuperObject )
|
||
{
|
||
pclSuperObjectCopy = new CPA_SuperObject( GetMainWorld(),
|
||
hChild,
|
||
"",
|
||
"",
|
||
CPA_NoSave,
|
||
C_Protected);
|
||
|
||
//Adds SuperObject as Actor's child
|
||
pNewOwner->AddTail(pclSuperObjectCopy, FALSE);
|
||
//Indicates that Module is Actor's property
|
||
pclSuperObjectCopy->SetSuperObjectOwner(pNewOwner);
|
||
pclSuperObjectCopy->SetEditProtected(TRUE);
|
||
}
|
||
}
|
||
|
||
return pclSuperObjectCopy;
|
||
*/
|
||
return NULL;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnSelect(CPA_SuperObject *pEdObj,
|
||
tdeTypeModif eType,
|
||
tdeStatus eStatus)
|
||
{
|
||
#ifndef __INACTIVE_INTERFACE__
|
||
if ( (eStatus == C_AsConcernedDLL) && (eType == C_EDTDo) )
|
||
{
|
||
if ( pEdObj->GetObject()->GetDataType() == HIE_C_ulActor )
|
||
{
|
||
if ( fn_bIsCurrentEditor() )
|
||
{
|
||
//CPA2 Stegaru Cristian 98-06
|
||
if (!m_clDocument.m_bDisplayActor)
|
||
{
|
||
CPA_ObjectDLLBase *pZoneDll = GetMainWorld () -> GetObjectDLLWithName (C_szDLLZDxName);
|
||
if (pZoneDll)
|
||
pZoneDll->OnQueryAction (this, C_uiQueryCheckZonesAgainstBV, (long)pEdObj);
|
||
}
|
||
|
||
//End CPA2 Stegaru Cristian 98-06
|
||
CPA_Actor *pclActor = (CPA_Actor *)pEdObj->GetObject();
|
||
m_clDocument.m_fn_vDisplayActor(pclActor->m_fn_pclGetEditorActor(), ED_ACTORS_eModeOfActorSelection_InHierarchy);
|
||
}
|
||
}
|
||
}
|
||
#endif //__INACTIVE_INTERFACE__
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnModifInsert(CPA_SuperObject *pEdObj,
|
||
CPA_SuperObject *pParent,
|
||
tdstPosition *p_stPosition,
|
||
tdeTypeModif eType,
|
||
tdeStatus eStatus)
|
||
{
|
||
#ifndef __INACTIVE_INTERFACE__
|
||
if ( eStatus == C_AsConcernedDLL )
|
||
{
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Instance from Editor",
|
||
"CPA_Actor_Editor_Interface::fn_vOnModifInsert(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Object type is not the right one");
|
||
ERROR_ASSERT( pEdObj->GetObjectType() == HIE_C_ulActor );
|
||
|
||
CPA_Actor *pclActor = (CPA_Actor *)pEdObj->GetObject();
|
||
ERROR_ASSERT( pclActor != NULL );
|
||
|
||
if ( eType == C_EDTDo)
|
||
{
|
||
// check insertion
|
||
EdActors_EditorActorModel *pclEdModel = (EdActors_EditorActorModel *)pclActor->m_fn_pclGetModel()->m_fn_pclGetEditorActor();
|
||
EdActors_EditorActorInstance *pclEdInstance = (EdActors_EditorActorInstance *)pclActor->m_fn_pclGetEditorActor();
|
||
|
||
if (pclEdModel->m_clInstancesList.Find(pclEdInstance))
|
||
{
|
||
//Sets the Initial Matrix as the Current one (in motor Actor)
|
||
HIE_tdxHandleToSuperObject hActorSO = pEdObj->GetStruct();
|
||
//fn_v3dDataSetMatrixInit(M_GetMSHandle(hActorSO,3dData), fn_p_st3dDataGetMatrix(M_GetMSHandle(hActorSO,3dData)));
|
||
memcpy( fn_p_st3dDataGetMatrixInit(M_GetMSHandle(hActorSO,3dData)),
|
||
fn_p_st3dDataGetMatrix(M_GetMSHandle(hActorSO,3dData)),
|
||
sizeof(POS_tdstCompletePosition)
|
||
);
|
||
|
||
//Inits Dynamics
|
||
tdstEngineObject * p_stObject;
|
||
p_stObject = (tdstEngineObject *)HIE_fn_hGetSuperObjectObject(hActorSO);
|
||
if ( p_stObject->h_Dynam != NULL )
|
||
fn_vDynamInit(p_stObject, OTI_MapLoaded);
|
||
|
||
CPA_Actor *pclActor = (CPA_Actor *)pEdObj->GetObject();
|
||
if ( !pclActor->m_fn_bIsAGenDoor() )
|
||
{
|
||
MS_tdxHandleTo3dData h_Current3dData = M_GetMSHandle(hActorSO,3dData);
|
||
struct tdstState_ *p_stCurrentState = fn_h3dDataGetCurrentState(h_Current3dData);
|
||
//Inits Offset for the First Time for the Character
|
||
if (p_stCurrentState->p_stAnim != NULL)
|
||
PLA_fn_bDoOffsetFirstInitForCharacter(hActorSO);
|
||
}
|
||
|
||
//Displays in Editor
|
||
m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList);
|
||
m_clDocument.m_fn_vDisplayActor(pclActor->m_fn_pclGetEditorActor(), ED_ACTORS_eModeOfActorSelection_Unknown);
|
||
}
|
||
else
|
||
m_clDocument.m_fn_vUndeleteInstance(pclActor);
|
||
}
|
||
else if ( eType == C_EDTRedo )
|
||
{
|
||
m_clDocument.m_fn_vUndeleteInstance(pclActor);
|
||
}
|
||
else if ( eType == C_EDTUndo )
|
||
{
|
||
m_clDocument.m_fn_vDeleteInstance(pclActor);
|
||
}
|
||
}
|
||
#endif //__INACTIVE_INTERFACE__
|
||
}
|
||
|
||
// Moves
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnModifMove(CPA_List<EDT_SavePos> *pListObjects,
|
||
CPA_List<EDT_SaveGlobalPos> *pListConcerned,
|
||
tdeTypeModif eType,
|
||
tdeStatus eStatus)
|
||
{
|
||
//Re-inits Dynamics
|
||
if ( eStatus == C_AsConcernedDLL )
|
||
{
|
||
EDT_SavePos *pclEDTSavePos;
|
||
HIE_tdxHandleToSuperObject hMotorSO;
|
||
MTH3D_tdstVector stNewPos;
|
||
HIE_tdxHandleToSuperObject hNewSector;
|
||
|
||
POSITION pos = pListObjects->GetHeadPosition();
|
||
while ( pos != NULL )
|
||
{
|
||
pclEDTSavePos = pListObjects->GetNext(pos);
|
||
|
||
hMotorSO = (HIE_tdxHandleToSuperObject)pclEDTSavePos->m_pObject->GetData();
|
||
|
||
if (( eType == C_EDTDo ) || ( eType == C_EDTRedo ))
|
||
{
|
||
//Sets Matrix in Motor Actor
|
||
fn_v3dDataSetMatrix(M_GetMSHandle(hMotorSO,3dData), pclEDTSavePos->m_hFinalMatrix);
|
||
//Get new current sector
|
||
stNewPos = pclEDTSavePos->m_hFinalMatrix->stTranslationVector;
|
||
hNewSector = GetInterface()->GetSpecificInterface()->GetCurrentSectorFromPos(&stNewPos)->GetStruct();
|
||
}
|
||
else if (( eType == C_EDTUndo ) || ( eType == C_EDTCancel ))
|
||
{
|
||
//Sets Matrix in Motor Actor
|
||
fn_v3dDataSetMatrix(M_GetMSHandle(hMotorSO,3dData), pclEDTSavePos->m_hInitialMatrix);
|
||
//Get new current sector
|
||
stNewPos = pclEDTSavePos->m_hInitialMatrix->stTranslationVector;
|
||
hNewSector = GetInterface()->GetSpecificInterface()->GetCurrentSectorFromPos(&stNewPos)->GetStruct();
|
||
}
|
||
|
||
//Re-inits Dynamics
|
||
struct tdstEngineObject_ *p_stObject = (struct tdstEngineObject_ *)hMotorSO->hLinkedObject.p_Void;
|
||
|
||
//////////////////////////////////////////////////
|
||
// Begin Silviu Simen 06 August 1998 Update Sector Status
|
||
fn_vSectInfoSetCurrentSector(p_stObject->h_SectInfo,hNewSector);
|
||
// End Silviu Simen 06 August 1998 Update Sector Status
|
||
//////////////////////////////////////////////////
|
||
|
||
if ( M_GetMSHandle(hMotorSO,Dynam) != NULL )
|
||
fn_vDynamInit(p_stObject, OTI_MapLoaded);
|
||
|
||
//CPA2 (Corneliu Babiuc) 24-04-1998
|
||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||
//this code sequence is intended to provide a mechanism to Do/Undo a Move only Actor in Zone Editor
|
||
// It works like that (Note that this is the order of messages):
|
||
// - when Ozo Editor will receive OnModifMove message with status C_AsCurrentEditor it will
|
||
// set a global variable if the move was "Move Only Actor"
|
||
// - if we are C_AsConcernedDLL we ask Zone Editor to set for each zone the translation vector
|
||
// acording with local actor's translation. Zone Editor will set it only if global variable is set
|
||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
||
if (eType != C_EDTCancel)
|
||
{
|
||
MTH3D_tdstVector stInitial, stFinal;
|
||
tdstMoveZoneMess stMoveZone;
|
||
stMoveZone.pActorSuperObject = pclEDTSavePos->m_pObject;
|
||
|
||
POS_fn_vGetTranslationVector(pclEDTSavePos -> m_hInitialMatrix , & stInitial);
|
||
POS_fn_vGetTranslationVector(pclEDTSavePos -> m_hFinalMatrix , & stFinal);
|
||
if ( MTH3D_M_bEqualVector(&stFinal, &stInitial) ) return;
|
||
|
||
if ( eType == C_EDTUndo )
|
||
{MTH3D_M_vSubVector(&(stMoveZone.stTranslation), &stFinal, &stInitial);}
|
||
else
|
||
if ( eType == C_EDTCancel )
|
||
{MTH3D_M_vNullVector(&(stMoveZone.stTranslation));}
|
||
else //Do or ReDo
|
||
{MTH3D_M_vSubVector(&(stMoveZone.stTranslation), &stInitial, &stFinal);}
|
||
//call ZDx QueryAction to set the new translation
|
||
GetMainWorld () -> GetObjectDLLWithName (C_szDLLZDxName) ->
|
||
OnQueryAction (this, C_uiQueryActorWasMoved, (long) & stMoveZone);
|
||
}
|
||
//END CPA2 (Corneliu Babiuc) 24-04-1998
|
||
}
|
||
// Begin Silviu Simen List by Sector
|
||
m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList);
|
||
// End Silviu Simen List by Sector
|
||
}
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnAddModelToList(CPA_ObjectDLLBase *pOwnerDLL,
|
||
CString csListName,
|
||
CString csModelName,
|
||
tdeTypeModif eType)
|
||
{
|
||
if (pOwnerDLL == this )
|
||
{
|
||
//If Model must be deleted
|
||
//[ Confirmation has been asked in 'fn_bCanDeleteThisModel(...)' ]
|
||
if ( eType == C_EDTUndo )
|
||
{
|
||
CPA_Actor *pclModel = (CPA_Actor *)GetMainWorld()->fn_p_oFindObject(csModelName, C_szActorModelTypeName);;
|
||
ERROR_ASSERT( pclModel != NULL );
|
||
|
||
//Deletes Model
|
||
m_clDocument.m_fn_vDeleteModel(pclModel);
|
||
}
|
||
}
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanDeleteThisModel(CString csListName,
|
||
CString csModelType,
|
||
CString csModelName)
|
||
{
|
||
CPA_Actor *pclModel = (CPA_Actor *)GetMainWorld()->fn_p_oFindObject(csModelName, C_szActorModelTypeName);;
|
||
ERROR_ASSERT( pclModel != NULL );
|
||
|
||
CString csAlertMessage = "You are going to delete the Model '" + pclModel->GetName() + "'\n";
|
||
CString csInstancesText = "No Instance will be deleted.";
|
||
if ( pclModel->m_pub_fn_lGetNumberOfInstances() > 0 )
|
||
csInstancesText.Format("%i %s will be deleted too !", pclModel->m_pub_fn_lGetNumberOfInstances(),
|
||
(pclModel->m_pub_fn_lGetNumberOfInstances() > 1) ? "Instances" : "Instance");
|
||
csAlertMessage += csInstancesText + "\n";
|
||
csAlertMessage += "Do you want to continue ? (No Undo !)";
|
||
EdActors_QuestionDialog clQuestionDial(&g_oBaseFrame, csAlertMessage);
|
||
|
||
return ( clQuestionDial.DoModal() == IDYES );
|
||
}
|
||
|
||
//**************************************************************************************
|
||
tdeTypeAnswer CPA_Actor_Editor_Interface::fn_bAcceptSelect(CPA_SuperObject *pEdObj,
|
||
ACP_tdxIndex xIndex,
|
||
HIE_tdstPickInfo *pPicking,
|
||
tdeStatus eStatus)
|
||
{
|
||
if ( eStatus == C_AsConcernedDLL )
|
||
{
|
||
if ( pEdObj->GetObject()->GetDataType() == HIE_C_ulActor )
|
||
return C_Accept;
|
||
else
|
||
return C_Refuse;
|
||
}
|
||
|
||
return C_Accept;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
//**************************************************************************************
|
||
// Hierarchy
|
||
//**************************************************************************************
|
||
CPA_SuperObject *CPA_Actor_Editor_Interface::GetNewEditorInstance(HIE_tdxHandleToSuperObject pEngineInstance)
|
||
{
|
||
FirstLoad = TRUE;
|
||
|
||
//If we enter here, there must be an Editor file to describe the Model of this Instance
|
||
//So let's get the name of Actor
|
||
EdActors_tdhHandleToActor hActor = (EdActors_tdhHandleToActor)pEngineInstance->hLinkedObject.p_Void;
|
||
|
||
//Uses motor's LinkTable
|
||
SCR_tdst_Link_Table *p_stLT = &(g_st3DOSLinkTable.stCharacter);
|
||
SCR_tdst_Link_Value *p_stLinkValue = SCR_fnp_st_Link_SearchValue(p_stLT, (unsigned long)hActor);
|
||
CString csKey(SCR_M_p_sz_Link_GetKey(p_stLinkValue));
|
||
|
||
char a_cFile[SCR_CV_ui_Cfg_MaxLenName];
|
||
char a_cAction[SCR_CV_ui_Cfg_MaxLenName];
|
||
char a_cName[SCR_CV_ui_Cfg_MaxLenName];
|
||
SCR_fn_v_RdL0_SplitSectionName((char *)LPCTSTR(csKey), a_cFile, a_cAction, a_cName);
|
||
CString csActorName(a_cName);
|
||
|
||
//Gets Family
|
||
CString csFamilyName = fn_szFindFamilyTypeNameOfFamilyType(fn_otStandardGameGetFamilyType(hActor->h_StandardGame));
|
||
CPA_Family *pclFamily = (CPA_Family *)GetMainWorld()->fn_p_oFindObject(csFamilyName, C_szFamilyTypeName);
|
||
|
||
//Gets Model
|
||
CString csModelName = fn_szFindModelTypeNameOfModelType(fn_otStandardGameGetModelType(hActor->h_StandardGame));
|
||
csModelName = csFamilyName + "\\" + csModelName + "\\" + csModelName;
|
||
CPA_Actor *pclEdModel = m_clDocument.m_fn_pclLoadModel(csModelName);
|
||
|
||
// SHAITAN
|
||
|
||
if (hActor->h_Brain)
|
||
{
|
||
CAR_EDIT_TDSTACTOR *p_tdstActor = (CAR_EDIT_TDSTACTOR *) pclEdModel->GetStruct();
|
||
|
||
|
||
if (p_tdstActor->h_Brain->p_stMind->p_stAIModel != hActor->h_Brain->p_stMind->p_stAIModel)
|
||
{
|
||
|
||
p_tdstActor->h_Brain->p_stMind->p_stAIModel = hActor->h_Brain->p_stMind->p_stAIModel;
|
||
|
||
EdActors_ActorMiniStructure *pclModelMS = pclEdModel->m_fn_pclGetEditorModel()->m_clListOfAMSLists.m_fn_pclGetAMSFromName("Brain");
|
||
|
||
|
||
POSITION pos = pclModelMS->m_pclDataList->GetHeadPosition();
|
||
|
||
(pclModelMS->m_pclDataList->GetNext(pos))->m_fn_vSetMotorDataPtr((void *)(&(p_tdstActor->h_Brain->p_stMind->p_stAIModel->CFast_bIsC)));
|
||
(pclModelMS->m_pclDataList->GetNext(pos))->m_fn_vSetMotorDataPtr((void *)(&(p_tdstActor->h_Brain->p_stMind->p_stAIModel->CFast_lFunction)));
|
||
}
|
||
}
|
||
|
||
// SHAITAN
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Instance from Motor actor",
|
||
"CPA_Actor_Editor_Interface::GetNewEditorInstance(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Family is unknown");
|
||
ERROR_ASSERT( pclFamily != NULL );
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Instance from Motor actor",
|
||
"CPA_Actor_Editor_Interface::GetNewEditorInstance(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Model is not correct");
|
||
ERROR_ASSERT( pclEdModel != NULL );
|
||
|
||
//To "visually activate" unactivated Actors
|
||
//Calls Motor function to add to this Instance its graphical Childs
|
||
/*
|
||
fn_vAddChildToSuperObject(pEngineInstance, //Motor SuperObject
|
||
M_MAKECHAR(pclFamily->GetName()), //Family Name
|
||
M_MAKECHAR(pclEdModel->GetName()), //Model Name
|
||
M_MAKECHAR(csActorName)); //Perso. Name
|
||
*/
|
||
CPA_Actor *pclEdInstance = new CPA_Actor( hActor,
|
||
NULL,
|
||
g_c_csActorType,
|
||
pclEdModel,
|
||
pclFamily,
|
||
NULL,
|
||
csActorName);
|
||
|
||
pclEdInstance->m_pub_fn_vSetCommon(EDACTORS_fn_bIsFileInCommon(csKey), TRUE);
|
||
pclEdInstance->m_pub_fn_vSetAlwaysActive(fn_bGetIfCharacterIsInAlwaysActiveCharacterList(pEngineInstance), TRUE);
|
||
// ANNECY MT - 19/11/98 {
|
||
pclEdInstance->m_pub_fn_vSetInAllSubMaps(fn_bStdGameIsInAllSubMaps(M_GetMSHandle(pEngineInstance,StandardGame)), TRUE);
|
||
// END ANNECY MT }
|
||
pclEdInstance->m_pub_fn_vSetInFix(fn_bStdGameIsLoadedInFix(M_GetMSHandle(pEngineInstance,StandardGame)), TRUE);
|
||
|
||
//Creates a new SuperObject...
|
||
CPA_SuperObject *pclNewInstance = GetInterface()->GetNewSuperObject(pEngineInstance,
|
||
E_ss_NoSave,
|
||
C_Protected,
|
||
"",
|
||
"");
|
||
|
||
//Sets Object
|
||
pclNewInstance->SetObject(pclEdInstance);
|
||
pclNewInstance->SetTypeSO(C_Dynamic);
|
||
|
||
//Section exists
|
||
pclEdInstance->SetExistingSection(TRUE);
|
||
pclEdInstance->m_pub_fn_vSetSuperObject(pclNewInstance);
|
||
|
||
if ( !pclEdInstance->m_fn_bIsAGenDoor() )
|
||
pclEdInstance->m_pub_fn_vAddChildsFromEngineChilds();
|
||
else
|
||
pclEdInstance->m_pub_fn_vAddChildsForGenDoors();
|
||
|
||
////////////
|
||
//Because Actor has been loaded from a File :
|
||
//Verification of all MS in the Actor
|
||
pclEdInstance->m_fn_pclGetEditorInstance()->m_pub_fn_bCheckAllMSWithModel();
|
||
|
||
//Updates new Instance according to Model linked data
|
||
// pclEdModel->m_fn_pclGetEditorModel()->m_pub_fn_vUpdateLinkedDataInInstance(pclEdInstance);
|
||
////////////
|
||
|
||
//Sets the Initial State
|
||
HIE_tdxHandleToSuperObject hMotorSO = (HIE_tdxHandleToSuperObject)pclNewInstance->GetStruct();
|
||
tdxHandleToState hInitState = fn_h3dDataGetInitialState(M_GetMSHandle(hMotorSO,3dData));
|
||
|
||
CString csErrorMessage = CString("No initial (motor) State for the Actor '") + csActorName + "'... Check the 'CAR' file !";
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Editor Instance from an Engine Instance : getting the Engine Initial State",
|
||
"CPA_Actor_Editor_Interface::GetNewEditorInstance(...)",
|
||
E_ERROR_GRAVITY_INSTABLE,
|
||
csErrorMessage);
|
||
ERROR_CHECK( hInitState != NULL );
|
||
|
||
CPA_State *p_clState = (CPA_State *)GetMainWorld()->fn_p_oFindObjectWithEngine(hInitState, C_szStateTypeName);
|
||
|
||
csErrorMessage = CString("No Editor State corresponding to Motor one, or invalid Motor State for the Actor '") + csActorName;
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Editor Instance from an Engine Instance : getting the Editor Initial State",
|
||
"CPA_Actor_Editor_Interface::GetNewEditorInstance(...)",
|
||
E_ERROR_GRAVITY_INSTABLE,
|
||
csErrorMessage);
|
||
ERROR_ASSERT( p_clState != NULL );
|
||
|
||
//!!! Voir si utile !!!! YB 15/09/97
|
||
pclEdInstance->m_pub_fn_vSetInitialState(p_clState);
|
||
|
||
FirstLoad = FALSE;
|
||
|
||
return pclNewInstance;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vUpdateEditorInstance(CPA_SuperObject *pEditorInstance,
|
||
HIE_tdxHandleToSuperObject pEngineInstance)
|
||
{
|
||
CPA_Actor *pclActor = (CPA_Actor *)pEditorInstance->GetObject();
|
||
|
||
if ( !pclActor->m_fn_bIsAGenDoor() )
|
||
{
|
||
HIE_tdxHandleToSuperObject hMotorSO = (HIE_tdxHandleToSuperObject)pEditorInstance->GetStruct();
|
||
|
||
//Looks if Actor is still alive
|
||
//TO BE DONE....
|
||
// BOOL bActorIsAlive = fn_bf1StandardGameGetIsActive(M_GetMSHandle(hMotorSO,StandardGame));
|
||
BOOL bActorIsAlive = TRUE;
|
||
|
||
//if motor childs have changed
|
||
if ( !pclActor->m_pub_fn_bCompareEditorAndMotorChilds() )
|
||
{
|
||
//Removes editor childs...
|
||
pclActor->m_pub_fn_vRemoveAllEditorChilds();
|
||
|
||
//...and creates the new ones
|
||
pclActor->m_pub_fn_vAddChildsFromEngineChilds();
|
||
}
|
||
|
||
//If actors is dead, modifies its display type
|
||
if ( !bActorIsAlive )
|
||
{
|
||
//TO BE TESTED...
|
||
long lNewMask = HIE_fn_lGetSuperObjectDrawMask(hMotorSO) & (~GLI_C_lIsNotGrided);
|
||
|
||
HIE_fn_vSetSuperObjectDrawMask(hMotorSO, lNewMask);
|
||
}
|
||
}
|
||
|
||
//Updates edited datas
|
||
if ( fn_bIsCurrentEditor() )
|
||
if ( pclActor->m_fn_pclGetEditorActor() == m_clDocument.m_pclSelectedActor )
|
||
{
|
||
// m_clDocument.m_pclMiniStrucView->m_fn_vUpdateAllDatas();
|
||
m_clDocument.m_pclMiniStrucView->m_fn_vDisplayActor(m_clDocument.m_pclSelectedActor);
|
||
// if ( m_pclWatchWindow != NULL )
|
||
// if ( m_pclWatchWindow->m_bIsVisible )
|
||
// m_pclWatchWindow->m_fn_vUpdateAllDatas();
|
||
}
|
||
}
|
||
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bCanHandleThisType(long lEngineType)
|
||
{
|
||
return ( lEngineType == HIE_C_ulActor );
|
||
}
|
||
|
||
|
||
//**************************************************************************************
|
||
//Begin Mircea Dunka 31 Aug 1998 - DialogBar interface
|
||
void CPA_Actor_Editor_Interface::fn_vDefineDlgBarBtnIcon (tde_DlgBarCategory wCategory, tds_DlgBarBtn *_pDlgBarBtn)
|
||
{
|
||
if(wCategory == C_DlgBarCategoryEditor)
|
||
{
|
||
_pDlgBarBtn->hIcon = ::LoadIcon((HINSTANCE)(GetDLLIdentity()->hModule), MAKEINTRESOURCE(IDI_OAC_DLGBAR_ICON));
|
||
|
||
CString oCst;
|
||
oCst = "Actors";
|
||
if( (M_GetMainApp()) && (M_GetMainApp()->mp_oAppKeyboard) )
|
||
{
|
||
oCst += " (";
|
||
oCst += M_GetMainApp()->mp_oAppKeyboard->mfn_oConvertIniStringToKeyString((const CString*)&CString("Activate Actor Editor"));
|
||
oCst += ")";
|
||
}
|
||
strcpy(_pDlgBarBtn->szToolTip, (char*)(LPCTSTR)oCst);
|
||
_pDlgBarBtn->uID = (UINT)this;
|
||
}
|
||
}
|
||
//end Mircea Dunka 31 Aug 1998
|
||
|
||
//**************************************************************************************
|
||
//**************************************************************************************
|
||
// SubMenu
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bDefineSubMenu(EDT_SubMenu *_p_oEDTSubMenu)
|
||
{
|
||
if ( _p_oEDTSubMenu->GetSubMenuType() == C_SubMenuEditor )
|
||
{
|
||
CString csMenuDescString;
|
||
CString csMenuAccelString = M_GetMainApp()->mp_oAppKeyboard->mfn_oConvertIniStringToKeyString((const CString*)&CString("Activate Actor Editor"));
|
||
|
||
csMenuDescString.Format("%s\t%s", C_szDLLActorName, csMenuAccelString);
|
||
|
||
if ( fn_bIsCurrentEditor() )
|
||
_p_oEDTSubMenu->AddAnEntry(this, M_MAKECHAR(csMenuDescString), C_EdActors_MenuID_CloseEditor, TRUE);
|
||
else
|
||
_p_oEDTSubMenu->AddAnEntry(this, M_MAKECHAR(csMenuDescString), C_EdActors_MenuID_OpenEditor, FALSE);
|
||
}
|
||
else if ( _p_oEDTSubMenu->GetSubMenuType() == C_SubMenuPreference )
|
||
{
|
||
if ( fn_bIsCurrentEditor() )
|
||
{
|
||
//Adds a menu entry for dimensions and global preferences
|
||
_p_oEDTSubMenu->AddAnEntry(this, "Save config. (Actors)", C_EdActors_MenuID_SaveDimension, FALSE);
|
||
//Adds a menu entry for internal Setup
|
||
_p_oEDTSubMenu->AddAnEntry(this, "Internal Setup (Actors)", C_EdActors_MenuID_InternalSetup, FALSE);
|
||
}
|
||
}
|
||
else if ( _p_oEDTSubMenu->GetSubMenuType() == C_SubMenuTool )
|
||
{
|
||
//Adds a menu entry for actor display
|
||
_p_oEDTSubMenu->AddAnEntry(this, "Show all actors", C_EdActors_MenuID_ShowActors, m_bShowActors);
|
||
// Shaitan => state list in the level
|
||
//Adds a menu entry for list of states
|
||
// Shaitan => module list in the level
|
||
if (m_bCanGenerateOptimizedLevel)
|
||
_p_oEDTSubMenu->AddAnEntry(this, "Build lists of states and POs for all families", C_EdActors_MenuID_BuildStatesLists, FALSE);
|
||
// End Shaitan => module list in the level
|
||
// End Shaitan => state list in the level
|
||
}
|
||
else if ( _p_oEDTSubMenu->GetSubMenuType() == C_SubMenuLoad )
|
||
{
|
||
if ( !m_clDocument.m_pub_bUnloadedModelsArePrepared )
|
||
//Adds a menu entry for load of unloaded Models
|
||
_p_oEDTSubMenu->AddAnEntry(this, "PreLoad All Models", C_EdActors_MenuID_LoadUnloadedModels, FALSE);
|
||
}
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::_OnSubMenuCommand( EDT_SubMenu *_p_oEDTSubMenu,
|
||
UINT uiMsgID)
|
||
{
|
||
switch ( uiMsgID )
|
||
{
|
||
case C_EdActors_MenuID_OpenEditor:
|
||
if ( !fn_bIsCurrentEditor() )
|
||
GetMainWorld()->fn_bActivateEditor(this, NULL);
|
||
break;
|
||
|
||
case C_EdActors_MenuID_CloseEditor:
|
||
if ( fn_bIsCurrentEditor() )
|
||
GetMainWorld()->fn_bCloseEditor(this);
|
||
break;
|
||
|
||
case C_EdActors_MenuID_SaveDimension:
|
||
if ( fn_bIsCurrentEditor() )
|
||
m_clDocument.m_pri_fn_bSaveDimensions();
|
||
break;
|
||
|
||
case C_EdActors_MenuID_InternalSetup:
|
||
if ( fn_bIsCurrentEditor() )
|
||
m_clDocument.m_pclActorsView->OnButtonSetup();
|
||
break;
|
||
|
||
case C_EdActors_MenuID_LoadUnloadedModels:
|
||
m_clDocument.m_fn_vLoadUnloadedModels();
|
||
m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList);
|
||
break;
|
||
|
||
case C_EdActors_MenuID_ShowActors:
|
||
m_bShowActors = !m_bShowActors;
|
||
mfn_vUpdateDisplayOfAllActors(m_bShowActors);
|
||
break;
|
||
|
||
// Shaitan => state list in the level
|
||
case C_EdActors_MenuID_BuildStatesLists:
|
||
{
|
||
// Shaitan => module list in the level
|
||
if (m_bCanGenerateOptimizedLevel)
|
||
{
|
||
CPA_List<CPA_BaseObject> clListOfFamilies;
|
||
CPA_Family *pFamily;
|
||
POSITION pos;
|
||
|
||
// update actions references
|
||
m_clDocument.m_fn_vUpdateReferencesForAllActions();
|
||
|
||
// for all families
|
||
clListOfFamilies.RemoveAll();
|
||
GetMainWorld()->fn_lFindObjects(&clListOfFamilies, "", C_szFamilyTypeName);
|
||
pos = clListOfFamilies.GetHeadPosition();
|
||
while (pos)
|
||
{
|
||
pFamily = (CPA_Family *) clListOfFamilies.GetNext(pos);
|
||
// update and notify the state list of the family
|
||
m_clDocument.m_fn_vUpdateListOfUsedActionsForFamily(pFamily);
|
||
// update the object table list of the family
|
||
m_clDocument.m_fn_vUpdateListOfUsedObjectTablesForFamily(pFamily);
|
||
|
||
// update and notify the PO list of the family
|
||
m_clDocument.m_fn_vUpdateListOfUsedPOsForFamily(pFamily);
|
||
}
|
||
|
||
M_GetMainWnd()->UpdateStatus("Lists of states and POs updated for all families of this level", C_STATUSPANE_INFOS, C_STATUS_NORMAL);
|
||
}
|
||
// End Shaitan => module list in the level
|
||
break;
|
||
}
|
||
|
||
// End Shaitan => state list in the level
|
||
|
||
default:
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Answering to the a menu command",
|
||
"CPA_Actor_Editor_Interface::_OnSubMenuCommand(...)",
|
||
E_ERROR_GRAVITY_WARNING,
|
||
"Received an unknown command");
|
||
ERROR_ASSERT( FALSE );
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
//**************************************************************************************
|
||
//**************************************************************************************
|
||
// Popup
|
||
//**************************************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bDefinePopupMenu(EDT_PopUpMenu *pPopup,
|
||
CPA_List<CPA_SuperObject> *pSelection,
|
||
BOOL bIsAlone)
|
||
{
|
||
BOOL bReturn = FALSE;
|
||
|
||
if ( !bIsAlone )
|
||
{
|
||
if ( fn_bIsCurrentEditor() )
|
||
{
|
||
pPopup->AddAnEntry(this, "Exit Actor Editor", C_EdActors_PopupID_Exit_Editor);
|
||
|
||
bReturn = TRUE;
|
||
}
|
||
|
||
if ( pSelection->GetCount() > 0 )
|
||
{
|
||
CString csTypeName = pSelection->GetHead()->GetRealTypeName();
|
||
CString csText;
|
||
|
||
if ( csTypeName.CompareNoCase(g_c_csActorType) == 0 )
|
||
{
|
||
EDT_SubMenu * pSubMenu = pPopup -> fn_p_oGetNewSubMenu ("Edit Actor(s)");
|
||
|
||
if ( !fn_bIsCurrentEditor() )
|
||
{
|
||
m_pcl3DSelectedActor = ((CPA_Actor *)pSelection->GetHead()->GetObject())->m_fn_pclGetEditorActor();
|
||
|
||
//Proposes to edit first selected Actor
|
||
csText = "Edit Actor '" + m_pcl3DSelectedActor->m_fn_csGetActorName() + "'";
|
||
pSubMenu->AddAnEntry(this, M_MAKECHAR(csText), C_EdActors_PopupID_Edit_Instance);
|
||
|
||
//Proposes to edit IA of an Actor
|
||
csText = "Edit IA of Actor '" + m_pcl3DSelectedActor->m_fn_csGetActorName() + "'";
|
||
pSubMenu->AddAnEntry(this, M_MAKECHAR(csText), C_EdActors_PopupID_Edit_IA);
|
||
}
|
||
|
||
//Proposes to Set the initial position of all selected Actors as the Current pos.
|
||
csText.Format("Set as Initial position (%i selected)", pSelection->GetCount());
|
||
pSubMenu->AddAnEntry(this, M_MAKECHAR(csText), C_EdActors_PopupID_SetAsInitialPos);
|
||
|
||
//Proposes to Set all selected Actors as Always.
|
||
csText.Format("Set as Always (%i selected)", pSelection->GetCount());
|
||
pSubMenu->AddAnEntry(this, M_MAKECHAR(csText), C_EdActors_PopupID_SetAsAnAlways);
|
||
|
||
pPopup -> AddASubMenu (pSubMenu);
|
||
bReturn = TRUE;
|
||
}
|
||
}
|
||
}
|
||
|
||
return bReturn;
|
||
}
|
||
|
||
//**************************************************************************************
|
||
void CPA_Actor_Editor_Interface::_OnPopUpMenuCommand(UINT m_IDCmdMsg)
|
||
{
|
||
switch (m_IDCmdMsg)
|
||
{
|
||
//--------------------------------- Edit Instance ------------------------------------
|
||
case C_EdActors_PopupID_Edit_Instance:
|
||
if ( m_pcl3DSelectedActor != NULL )
|
||
{
|
||
if ( !fn_bIsCurrentEditor() )
|
||
GetMainWorld()->fn_bActivateEditor(this, NULL);
|
||
|
||
m_clDocument.m_fn_vDisplayActor(m_pcl3DSelectedActor, ED_ACTORS_eModeOfActorSelection_InHierarchy);
|
||
}
|
||
break;
|
||
|
||
//--------------------------------- Edit Instance ------------------------------------
|
||
case C_EdActors_PopupID_Edit_IA:
|
||
if ( m_pcl3DSelectedActor != NULL )
|
||
{
|
||
if ( !fn_bIsCurrentEditor() )
|
||
GetMainWorld()->fn_bActivateEditor(this, NULL);
|
||
|
||
m_clDocument.m_fn_vActivateIAEditor(TRUE);
|
||
m_clDocument.m_fn_vDisplayActor(m_pcl3DSelectedActor, ED_ACTORS_eModeOfActorSelection_InHierarchy);
|
||
}
|
||
break;
|
||
|
||
//--------------------------------- Exit editor ------------------------------------
|
||
case C_EdActors_PopupID_Exit_Editor:
|
||
if ( fn_bIsCurrentEditor() )
|
||
GetMainWorld()->fn_bCloseEditor(this);
|
||
break;
|
||
|
||
//--------------------------------- Initial Pos ------------------------------------
|
||
case C_EdActors_PopupID_SetAsInitialPos:
|
||
{
|
||
CPA_SuperObject *pclCurrentEdSO;
|
||
CPA_Actor *pclCurrentActor;
|
||
HIE_tdxHandleToSuperObject hActorSO;
|
||
CPA_List<CPA_SuperObject> *pclEdSOList = GetInterface()->GetSelectedObjects(this);
|
||
POSITION pos = pclEdSOList->GetHeadPosition();
|
||
while ( pos != NULL )
|
||
{
|
||
pclCurrentEdSO = pclEdSOList->GetNext(pos);
|
||
pclCurrentActor = (CPA_Actor *)pclCurrentEdSO->GetObject();
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Answering to the popup menu command : 'C_EdActors_PopupID_SetAsInitialPos'",
|
||
"CPA_Actor_Editor_Interface::_OnPopUpMenuCommand(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Received this command for an Object with a bad type (<> HIE_C_ulActor)");
|
||
ERROR_ASSERT( pclCurrentEdSO->GetObjectType() == HIE_C_ulActor );
|
||
|
||
hActorSO = pclCurrentEdSO->GetStruct();
|
||
m_clDocument.m_fn_vSetCurrentActorPositionAsInitial(pclCurrentActor);
|
||
}
|
||
}
|
||
break;
|
||
|
||
//--------------------------------- Always ------------------------------------
|
||
case C_EdActors_PopupID_SetAsAnAlways:
|
||
{
|
||
M_GetEditManager()->AskFor(new CPA_MakeAlways(&m_clDocument, GetInterface()->GetSelectedObjects(this), TRUE));
|
||
/* CPA_Actor *pclActor;
|
||
CPA_SuperObject *pclCurrentEdSO;
|
||
CPA_List<CPA_SuperObject> *pclEdSOList = GetInterface()->GetSelectedObjects(this);
|
||
POSITION pos = pclEdSOList->GetHeadPosition();
|
||
while ( pos != NULL )
|
||
{
|
||
pclCurrentEdSO = pclEdSOList->GetNext(pos);
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Answering to the popup menu command : 'C_EdActors_PopupID_SetAsAnAlways'",
|
||
"CPA_Actor_Editor_Interface::_OnPopUpMenuCommand(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Received this command for an Object with a bad type (<> HIE_C_ulActor)");
|
||
ERROR_ASSERT( pclCurrentEdSO->GetObjectType() == HIE_C_ulActor );
|
||
|
||
//Modifies and Notifies Actors
|
||
pclActor = (CPA_Actor *)pclCurrentEdSO->GetObject();
|
||
|
||
//Notifies Level
|
||
m_clDocument.m_fn_vNotifyLevel(pclActor, FALSE);
|
||
|
||
pclActor->m_fn_vMakeAlways();
|
||
|
||
//Notifies Level
|
||
m_clDocument.m_fn_vNotifyLevel(pclActor, TRUE);
|
||
}
|
||
*/
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
//**************************************************************************************
|
||
//Lists Dialog
|
||
//**************************************************************************************
|
||
//see in EDACLstD.cpp
|
||
////////
|
||
|
||
//***********************************************************************
|
||
CString CPA_Actor_Editor_Interface::m_fn_csGetEditorVersion()
|
||
{
|
||
return m_csEditorVersion;
|
||
}
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vRefreshDatas(void)
|
||
{
|
||
#ifndef __INACTIVE_INTERFACE__
|
||
if ( ((CButton *)m_clDocument.m_pclActorsView->GetDlgItem(IDC_CHECK_WATCH))->GetCheck() )
|
||
m_fn_vLookForModifiedDatas();
|
||
#endif //__INACTIVE_INTERFACE__
|
||
}
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vLevelChanges(void)
|
||
{
|
||
FirstLoad = TRUE;
|
||
m_clDocument.m_fn_vComputeDataPaths();
|
||
|
||
|
||
m_clDocument.m_pub_fn_vUpdateGameMaterialsEnumDescriptor();
|
||
|
||
m_clDocument.m_pub_fn_vUpdateSectorsEnumDescriptor();
|
||
FirstLoad = FALSE;
|
||
}
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vLevelHasChanged(void)
|
||
{
|
||
FirstLoad = TRUE;
|
||
m_clDocument.m_pub_fn_vConstructListOfAlways();
|
||
//CPA2 Stegaru Cristian 98-05
|
||
m_clDocument.m_fn_ConstructListOfUnloadedAlways ();
|
||
//End CPA2 Stegaru Cristian 98-05
|
||
|
||
if ( m_clDocument.m_bProposeUnloadedModels )
|
||
m_clDocument.m_fn_vLoadUnloadedModels();
|
||
|
||
m_clDocument.m_pub_fn_vUpdateActorsEnumDescriptor();
|
||
m_clDocument.m_pub_fn_vUpdatePartGenEnumDescriptor();
|
||
m_clDocument.m_pub_fn_vUpdateGraphEnumDescriptor();
|
||
|
||
m_clDocument.m_pri_fn_bLoadFieldsInWatch();
|
||
|
||
#ifndef __INACTIVE_INTERFACE__
|
||
//Refresshes DialogList
|
||
m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList);
|
||
#endif //__INACTIVE_INTERFACE__
|
||
FirstLoad = FALSE;
|
||
}
|
||
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bLoadBaseObject(CPA_BaseObject *p_oObject)
|
||
{
|
||
((CPA_Actor *)p_oObject)->m_fn_vFinishLoading();
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnModifDelete(CPA_List<EDT_SaveParents> *pListObjects,
|
||
tdeTypeModif eType,
|
||
tdeStatus eStatus)
|
||
{
|
||
if ( eStatus == C_AsConcernedDLL )
|
||
{
|
||
EDT_SaveParents *pclEDT_SaveParents = NULL;
|
||
if ( pListObjects->GetCount() > 0 )
|
||
pclEDT_SaveParents = pListObjects->GetHead();
|
||
|
||
if ( pclEDT_SaveParents != NULL )
|
||
{
|
||
CPA_SuperObject *pclSO = pclEDT_SaveParents->m_pChild;
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Deleting an Instance",
|
||
"CPA_Actor_Editor_Interface::_OnPopUpMenuCommand(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"The Actor SuperObject is not correct (Pointer is NULL)");
|
||
ERROR_ASSERT( pclSO != NULL );
|
||
|
||
CPA_Actor *pclActor = (CPA_Actor *)pclSO->GetObject();
|
||
|
||
// Shaitan => optimisation lists in the level
|
||
// must update family lists
|
||
pclActor->m_pub_fn_pclGetFamily()->mfn_vSetModifiedStateList();
|
||
pclActor->m_pub_fn_pclGetFamily()->mfn_vSetModifiedPOList();
|
||
// End Shaitan => optimisation lists in the level
|
||
|
||
if ( (eType == C_EDTDo) || (eType == C_EDTRedo) )
|
||
m_clDocument.m_fn_vDeleteInstance(pclActor);
|
||
else if ( eType == C_EDTUndo )
|
||
m_clDocument.m_fn_vUndeleteInstance(pclActor);
|
||
|
||
// Shaitan => optimisation lists in the level
|
||
if (pclActor->m_fn_pclGetModel()->m_fn_pclGetEditorModel()->m_clInstancesList.GetCount() == ((eType == C_EDTUndo) ? 1 : 0))
|
||
EDAC_fn_vProcessBrain(pclActor->m_fn_pclGetModel(),pclActor, TRUE);
|
||
// End Shaitan => optimisation lists in the level
|
||
}
|
||
}
|
||
}
|
||
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptModifDelete( CPA_List<CPA_SuperObject> *pListObjects,
|
||
tdeStatus eStatus)
|
||
{
|
||
BOOL bCanDeleteObjects = TRUE;
|
||
|
||
if ( eStatus == C_AsConcernedDLL )
|
||
{
|
||
CPA_SuperObject *pclEditorSO;
|
||
CPA_Actor *pclActor;
|
||
HIE_tdxHandleToSuperObject hMotorSO;
|
||
POSITION pos = pListObjects->GetHeadPosition();
|
||
while ( (pos != NULL) && (bCanDeleteObjects) )
|
||
{
|
||
pclEditorSO = pListObjects->GetNext(pos);
|
||
hMotorSO = (HIE_tdxHandleToSuperObject)pclEditorSO->GetData();
|
||
pclActor = (CPA_Actor *)pclEditorSO->GetObject();
|
||
|
||
//Deletion is not accepted...
|
||
//... if Object is the Active Camera (in Motor mode)
|
||
if ( pclActor->m_fn_bIsTheCurrentMotorCamera() )
|
||
{
|
||
bCanDeleteObjects = FALSE;
|
||
|
||
CString csMessage = CString("Actor '") + pclEditorSO->GetName() + "' cannot be deleted !\n";
|
||
csMessage += "It is the Active Camera in motor mode.";
|
||
EdActors_InformationDialog dial(&g_oBaseFrame, csMessage);
|
||
dial.DoModal();
|
||
}
|
||
|
||
//... if Object is the Principal Actor
|
||
if ( pclActor->m_fn_bIsAPrincipalActor() )
|
||
{
|
||
bCanDeleteObjects = FALSE;
|
||
|
||
CString csMessage = CString("Actor '") + pclEditorSO->GetName() + "' cannot be deleted !\n";
|
||
csMessage += "It is the Principal Actor.";
|
||
EdActors_InformationDialog dial(&g_oBaseFrame, csMessage);
|
||
dial.DoModal();
|
||
}
|
||
|
||
//... if Object is the World
|
||
/*if ( pclActor->m_fn_bIsTheWorldActor() )
|
||
{
|
||
bCanDeleteObjects = FALSE;
|
||
|
||
CString csMessage = CString("Actor '") + pclEditorSO->GetName() + "' cannot be deleted !\n";
|
||
csMessage += "It is the Actor representing the World.";
|
||
EdActors_InformationDialog dial(&g_oBaseFrame, csMessage);
|
||
dial.DoModal();
|
||
}*/
|
||
}
|
||
}
|
||
|
||
return bCanDeleteObjects;
|
||
}
|
||
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptModifCopy(CPA_List<CPA_SuperObject> *pListObjects,
|
||
tdeStatus eStatus)
|
||
{
|
||
// return TRUE;
|
||
return C_B_CAN_COPY_INSTANCES;
|
||
}
|
||
|
||
//ANNECY Shaitan correction 06/03/98
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptModifTranslate(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus)
|
||
{
|
||
if (eStatus == C_AsChildOwner)
|
||
return FALSE;
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptModifRotate(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus)
|
||
{
|
||
if (eStatus == C_AsChildOwner)
|
||
return FALSE;
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptModifScale(CPA_SuperObject *pEdObj, tdeStatus eStatus)
|
||
{
|
||
if (eStatus == C_AsChildOwner)
|
||
return FALSE;
|
||
|
||
return TRUE;
|
||
}
|
||
//ENDANNECY Shaitan correction
|
||
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptModifName(CPA_SuperObject *pEdObj,
|
||
tdeStatus eStatus)
|
||
{
|
||
//ANNECY Shaitan correction 19/02/98
|
||
if ( eStatus == C_AsConcernedDLL )
|
||
{
|
||
//ENDANNECY Shaitan correction
|
||
|
||
CPA_Actor *pclActor = (CPA_Actor *)pEdObj->GetObject();
|
||
|
||
return ( pclActor->m_pub_fn_bCanBeRenamed() );
|
||
|
||
//ANNECY Shaitan correction 19/02/98
|
||
}
|
||
else
|
||
return TRUE;
|
||
//ENDANNECY Shaitan correction
|
||
}
|
||
|
||
//ANNECY Shaitan SPOFlags 19/02/98
|
||
//***********************************************************************
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptModifFlag (CPA_SuperObject *pEdObj, unsigned long ulFlag)
|
||
{
|
||
switch (ulFlag)
|
||
{
|
||
case HIE_C_Flag_ulNotPickable:
|
||
case HIE_C_Flag_ulHidden:
|
||
case HIE_C_Flag_ulNoTransformationMatrix:
|
||
return TRUE;
|
||
|
||
case HIE_C_Flag_ulZoomInsteadOfScale:
|
||
return TRUE;
|
||
}
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnModifFlag (CPA_SuperObject *pEdObj, unsigned long ulOldFlag, unsigned long ulNewFlag)
|
||
{
|
||
// Notify Level
|
||
m_clDocument.m_fn_vNotifyLevel((CPA_Actor *)pEdObj->GetObject(), TRUE);
|
||
}
|
||
//ENDANNECY Shaitan SPOFlags
|
||
|
||
//ANNECY Shaitan Transparency (26/03/98) {
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnModifTransparency (CPA_SuperObject *pEdObj, float fNewLevel)
|
||
{
|
||
// Notify Level
|
||
m_clDocument.m_fn_vNotifyLevel((CPA_Actor *)pEdObj->GetObject(), TRUE);
|
||
}
|
||
//ENDANNECY Shaitan Transparency }
|
||
|
||
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::fn_vOnModifName(CPA_SuperObject *pEdObj,
|
||
CString csInitialName,
|
||
CString csFinalName,
|
||
tdeTypeModif eType,
|
||
tdeStatus eStatus)
|
||
{
|
||
if ( eStatus == C_AsConcernedDLL )
|
||
{
|
||
CPA_Actor *pclActor = (CPA_Actor *)pEdObj->GetObject();
|
||
|
||
if ( ( eType == C_EDTDo ) || ( eType == C_EDTRedo ) )
|
||
{
|
||
if ( csInitialName.Compare(csFinalName) != 0 )
|
||
{
|
||
//Notifies Level
|
||
m_clDocument.m_fn_vNotifyLevel(pclActor, FALSE, csInitialName);
|
||
|
||
pclActor->m_fn_bRename(csFinalName);
|
||
|
||
//Notifies Level
|
||
m_clDocument.m_fn_vNotifyLevel(pclActor, TRUE);
|
||
}
|
||
}
|
||
else if ( eType == C_EDTUndo )
|
||
{
|
||
if ( csInitialName.Compare(csFinalName) != 0 )
|
||
{
|
||
//Notifies Level
|
||
m_clDocument.m_fn_vNotifyLevel(pclActor, FALSE, csFinalName);
|
||
|
||
pclActor->m_fn_bRename(csInitialName);
|
||
|
||
//Notifies Level
|
||
m_clDocument.m_fn_vNotifyLevel(pclActor, TRUE);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
//-----------------------------------------------------------------------
|
||
//-----------------------------------------------------------------------
|
||
// (YB) Specific functions
|
||
//-----------------------------------------------------------------------
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::m_fn_vLookForModifiedDatas()
|
||
{
|
||
//Looks in the Watch Window's list of datas
|
||
// if ( m_pclWatchWindow != NULL )
|
||
// {
|
||
// m_pclWatchWindow->m_fn_vLookForModifiedDatas();
|
||
// m_pclWatchWindow->m_fn_vUpdateAllDatas();
|
||
// }
|
||
}
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::m_fn_vShowEditor()
|
||
{
|
||
g_oFrameGest.mfn_vSetRefresh(FALSE);
|
||
|
||
if ( m_pclCaracMainFrame != NULL )
|
||
{
|
||
g_oFrameGest.mfn_vActivateWindow(m_pclCaracMainFrame);
|
||
}
|
||
|
||
//-----------------IR-------------------------
|
||
EdActors_ActorsView *pclActorsView=m_clDocument.m_pclActorsView;
|
||
if(pclActorsView && ((CButton *)(pclActorsView->GetDlgItem(IDC_CHECK_IA)))->GetCheck())
|
||
{
|
||
EDAC_fn_vShowAIEditor();
|
||
|
||
if (m_clDocument.m_pclDesignerVariablesView)
|
||
EDAC_fn_vDesignerVariableView_UpdateState(m_clDocument.m_pclDesignerVariablesView, !((CButton *) pclActorsView->GetDlgItem(IDC_CHECK_VAR))->GetCheck());
|
||
|
||
if(((CButton *)(pclActorsView->GetDlgItem(IDC_CHECK_VAR)))->GetCheck())
|
||
|
||
if (m_clDocument.m_bAIFirstTime)
|
||
g_oFrameGest.ma_p_oWinArray[2][3]->mfn_vHeightWindow(m_clDocument.m_ulAIViewHeight);
|
||
m_clDocument.m_bAIFirstTime = FALSE;
|
||
}
|
||
else
|
||
{
|
||
g_oFrameGest.mfn_vActivateWindow(GetInterface()->GetModelFrame());
|
||
if (m_clDocument.m_bModelFirstTime)
|
||
GetInterface()->GetModelFrame()->mfn_vHeightWindow(m_clDocument.m_ulModelViewHeight);
|
||
m_clDocument.m_bModelFirstTime = FALSE;
|
||
}
|
||
//--------------------------------------------
|
||
|
||
g_oFrameGest.mfn_vSetRefresh(TRUE);
|
||
}
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::m_fn_vHideEditor()
|
||
{
|
||
g_oFrameGest.mfn_vSetRefresh(FALSE);
|
||
|
||
if ( m_pclCaracMainFrame != NULL )
|
||
g_oFrameGest.mfn_vDisactivateWindow(m_pclCaracMainFrame);
|
||
|
||
g_oFrameGest.mfn_vDisactivateWindow(GetInterface()->GetModelFrame());
|
||
|
||
g_oFrameGest.mfn_vSetRefresh(TRUE);
|
||
}
|
||
|
||
//***********************************************************************
|
||
void CPA_Actor_Editor_Interface::m_fn_vPrepareMotorActor(CPA_Actor *pclEdActor)
|
||
{
|
||
EdActors_tdhHandleToActor hActor = pclEdActor->m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor();
|
||
|
||
//Sets Family for Motor structure
|
||
CPA_Family *pclFamily = pclEdActor->m_pub_fn_pclGetFamily();
|
||
tdstFamily *p_tdstFamily = (tdstFamily *)pclFamily->GetData();
|
||
tdObjectType otFamilyType = p_tdstFamily->otObjectFamilyType;
|
||
fn_vStandardGameSetFamilyType(hActor->h_StandardGame, otFamilyType);
|
||
|
||
//Sets Model
|
||
fn_vStandardGameSetModelType(hActor->h_StandardGame, C_InvalidObjectType);
|
||
|
||
//Sets Personnal
|
||
tdObjectType otPersonalType = fn_otFindOrAddPersonalTypeOfPersonalTypeName(M_MAKECHAR(pclEdActor->GetName()));
|
||
fn_vStandardGameSetPersonalType(hActor->h_StandardGame, otPersonalType);
|
||
|
||
//Sets activation
|
||
fn_vStandardGameSetIsDesactivateAtAll(hActor->h_StandardGame, 0);
|
||
fn_vStandardGameSetIsActivable(hActor->h_StandardGame, 1);
|
||
fn_vStandardGameSetIsActive(hActor->h_StandardGame, 0);
|
||
|
||
//Sets Family for Motor structure
|
||
fn_v3dDataSetFamily(hActor->h_3dData, p_tdstFamily);
|
||
|
||
//Inits the Matrix
|
||
POS_tdstCompletePosition *hMatrix = fn_p_st3dDataGetMatrix(hActor->h_3dData);
|
||
POS_fn_vSetIdentityMatrix(hMatrix);
|
||
|
||
POS_tdstCompletePosition *hMatrixInit = fn_p_st3dDataGetMatrixInit(hActor->h_3dData);
|
||
POS_fn_vSetIdentityMatrix(hMatrixInit);
|
||
|
||
//PROVISOIRE...
|
||
if ( hActor->h_Dynam != NULL )
|
||
{
|
||
//Initialization
|
||
fn_vInitDynamicalFunctionPointer(hActor->h_Dynam);
|
||
}
|
||
}
|
||
|
||
//***********************************************************************
|
||
//***********************************************************************
|
||
// OnQueryAction : used to communicate with the dll
|
||
// lParam is a pointer to a tdstEdtListMess structure (see _edtList.hpp)
|
||
//***********************************************************************
|
||
//***********************************************************************
|
||
long CPA_Actor_Editor_Interface::OnQueryAction(CPA_EditorBase *CallingDll,
|
||
WPARAM wParam,
|
||
LPARAM lParam)
|
||
{
|
||
/////// Actions ///////
|
||
if( wParam == C_uiActor_ActionModif )
|
||
{
|
||
//The default state of an Action has been changed or renamed
|
||
CPA_Action *pclAction = (CPA_Action *)lParam;
|
||
ERROR_ASSERT( pclAction != NULL );
|
||
|
||
m_clDocument.m_pub_fn_vCheckAllInstancesForActionChange(pclAction);
|
||
|
||
return 0L;
|
||
}
|
||
|
||
/* if( wParam == C_uiActor_ActionDeleted )
|
||
{
|
||
|
||
return 0L;
|
||
}
|
||
|
||
if( wParam == C_uiActor_ActionRestored )
|
||
{
|
||
|
||
return 0L;
|
||
}
|
||
*/
|
||
/////// End Actions ///////
|
||
|
||
/////// Object Tables ///////
|
||
if( wParam == C_uiActor_ObjectsTableLoaded )
|
||
{
|
||
//The default state of an Action has been changed or renamed
|
||
EditorObjectTable *pclOTn = (EditorObjectTable *)lParam;
|
||
ERROR_ASSERT( pclOTn != NULL );
|
||
|
||
m_clDocument.m_pub_fn_vCheckAllActorsForObjectTableChange(pclOTn);
|
||
|
||
return 0L;
|
||
}
|
||
/////// End Object Tables ///////
|
||
|
||
if ( wParam == C_uiActor_DisplayActor )
|
||
{
|
||
EdActors_EditorActor *pclActor = (lParam) ? ((CPA_Actor *)lParam)->m_fn_pclGetEditorActor() : NULL ;
|
||
m_clDocument.m_fn_vDisplayActor(pclActor, ED_ACTORS_eModeOfActorSelection_Unknown);
|
||
|
||
return 1;
|
||
}
|
||
|
||
if ( wParam == C_uiActor_GetDesignerVariablesView )
|
||
{
|
||
//-----------------IR-------------------------
|
||
return (long)(m_clDocument.m_pclDesignerVariablesView);
|
||
//--------------------------------------------
|
||
}
|
||
|
||
if ( wParam == C_uiActor_GetIndexOfName )
|
||
{
|
||
stIndexOfNameInfo *pstIndexOfNameInfo=(stIndexOfNameInfo *)lParam;
|
||
|
||
return m_wGetIndexOfName(pstIndexOfNameInfo->csNameOfObject,
|
||
pstIndexOfNameInfo->pclModel,
|
||
pstIndexOfNameInfo->csObjectType);
|
||
}
|
||
|
||
if ( wParam == C_uiActor_GetSelectedActor )
|
||
{
|
||
if(m_clDocument.m_pclSelectedActor)
|
||
return (long)(m_clDocument.m_pclSelectedActor->m_pclActor);
|
||
else
|
||
return 0;
|
||
}
|
||
else if (wParam == C_uiActor_GetDocument )
|
||
{
|
||
return (long)(&m_clDocument);
|
||
}
|
||
|
||
if ( wParam == C_uiActor_GetFirstActorUsingThisList )
|
||
{
|
||
EdtList *p_oEdtList = (EdtList *) lParam;
|
||
return (long) p_oEdtList -> fn_oGetFirstActorUsingThisList();
|
||
}
|
||
|
||
if(wParam == C_uiActor_LoadNamesList )
|
||
{
|
||
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
|
||
CPA_SaveObject *p_oFamily = (CPA_SaveObject*)lParam;
|
||
|
||
SCR_M_RdL0_SetContextLong( 2, 0, p_oFamily);
|
||
|
||
sprintf( szFileName, "%s\\%s\\%s%s",
|
||
fn_szGetFamiliesDataPath(),
|
||
M_MAKECHAR( p_oFamily -> GetName() ),
|
||
M_MAKECHAR( p_oFamily -> GetName() ),
|
||
M_MAKECHAR( g_csNamesListExtension ) );
|
||
|
||
if (SCR_fn_c_RdL0_IsSectionExists (szFileName))
|
||
{
|
||
SCR_fnp_st_RdL0_AnalyseSection( szFileName, SCR_CDF_uw_Anl_Normal );
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
if (wParam == C_uiActor_GetANameList ||
|
||
wParam == C_uiActor_CreateANewObjectList ||
|
||
wParam == C_uiActor_DeleteAnObjectList ||
|
||
wParam == C_uiActor_GetAnObjectList ||
|
||
wParam == C_uiActor_SetAnObjectList ||
|
||
wParam == C_uiActor_SetAnObjectInObjectList)
|
||
{
|
||
tdstEdtListMess * pStruct = (tdstEdtListMess *) lParam;
|
||
|
||
// Get the model of the actor
|
||
CPA_Actor * pModel = ((CPA_Actor *) pStruct -> pActor) -> m_fn_pclGetModel ();
|
||
if (! pModel) return 0;
|
||
// Get the editor actor of the model
|
||
EdActors_EditorActor * pEditorActor = pModel -> m_fn_pclGetEditorActor ();
|
||
if (! pEditorActor) return 0;
|
||
// Get the object list data
|
||
CPA_Editor_ObjectListData * pObjectListData = (CPA_Editor_ObjectListData *) pEditorActor
|
||
->m_fn_p_oFindDataByName (pStruct->csListType);
|
||
if (! pObjectListData) return 0;
|
||
// Get the name list
|
||
CPA_tdoNameList * pNameList = pObjectListData -> m_p_oNameList;
|
||
if (! pNameList) return 0;
|
||
// Get the list handler
|
||
EdtListHandler * pEdtListHandler = pNameList -> m_pEdtListHandler;
|
||
if (! pEdtListHandler) return 0;
|
||
|
||
switch (wParam)
|
||
{
|
||
case C_uiActor_GetANameList : return (long) pNameList;
|
||
case C_uiActor_CreateANewObjectList : return (long) pEdtListHandler -> fn_poCreateEdtList (pStruct);
|
||
case C_uiActor_DeleteAnObjectList : return (long) pEdtListHandler -> fn_ucDeleteEdtList (pStruct);
|
||
case C_uiActor_GetAnObjectList : return (long) pEdtListHandler -> fn_poGetEdtList (pStruct);
|
||
case C_uiActor_SetAnObjectList : pEdtListHandler -> fn_vSetEdtList (pStruct); return 0;
|
||
case C_uiActor_SetAnObjectInObjectList : return (long) pEdtListHandler -> fn_ucModifyEdtList (pStruct);
|
||
default : ERROR_ASSERT (0); return 0;
|
||
}
|
||
}
|
||
|
||
if ( wParam == C_uiActor_IsAnInstance )
|
||
{
|
||
CPA_Actor* poActor = (CPA_Actor *)lParam;
|
||
return poActor->m_fn_bIsAnInstance () ? 1L : 0L;
|
||
}
|
||
|
||
if ( wParam == C_uiActor_AddDataInWatch )
|
||
return 0L;
|
||
|
||
if ( wParam == C_uiActor_RemoveDataFromWatch )
|
||
return 0L;
|
||
|
||
if (C_uiActor_LoadFamilyModels == wParam)
|
||
{
|
||
CPA_BaseObject *pObject = (CPA_BaseObject *)lParam;
|
||
CString csFamilyName;
|
||
if (pObject)
|
||
csFamilyName = pObject->GetName ();
|
||
|
||
m_clDocument.m_fn_vLoadFamilyModels (csFamilyName);
|
||
return 0L;
|
||
}
|
||
if (C_uiActor_UpdateTreeView == wParam)
|
||
m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList);
|
||
|
||
// For Anim Player
|
||
if( C_uiActor_GetAnActorInstance == wParam )
|
||
return (long)m_fn_pGetAnActorInstance( (CPA_BaseObject*)lParam );
|
||
|
||
if( C_uiActor_DeleteTempActorInstance == wParam )
|
||
{
|
||
m_fn_vDeleteTempActorInstance();
|
||
return 0L;
|
||
}
|
||
|
||
return 0L;
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Method : m_fn_vCheckFamilyBoundingVolume
|
||
// Date : 98-04
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Description : check if the actor's family has a bounding volume; if not create one
|
||
// Author : Stegaru Cristian - CPA2
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Modification :
|
||
// Date :
|
||
// By :
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
void CPA_Actor_Editor_Interface::m_fn_vCheckFamilyBoundingVolume (CPA_Actor *pclEdActor)
|
||
{
|
||
if (NULL == pclEdActor)
|
||
return;
|
||
|
||
CPA_Family *pFamily = pclEdActor->m_pub_fn_pclGetFamily ();
|
||
ASSERT (pFamily);
|
||
CPA_BaseObject *pBoundingVolume = pFamily->mfn_p_oGetBoundingVolume ();
|
||
if (NULL != pBoundingVolume)
|
||
return;
|
||
else if (IDNO == AfxMessageBox ("The actor's family doesn't have a bounding volume. Do you want to create one?", MB_YESNO | MB_ICONQUESTION))
|
||
return;
|
||
|
||
//create engine object
|
||
fn_vComputeBoundingVolume (pclEdActor);
|
||
//ANNECY TQ 30/06/98{
|
||
ACP_tdxHandleOfObject hBVolume = GEO_fn_hCreateGeometricSphere();
|
||
GEO_tdxHandleToBoundingSphere hBoundingSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume (pclEdActor->m_pub_fn_hGetMotorSuperObject());
|
||
if(hBoundingSphere)
|
||
GEO_fn_vUpdateGeometricSphere(hBVolume, hBoundingSphere);
|
||
//ENDANNECY TQ}
|
||
//create editor object
|
||
CString csRefName = pFamily->GetReferencedSectionName ();
|
||
int iNameSeparatorInx = csRefName.Find (SCR_CC_c_Cfg_NameSeparator);
|
||
ASSERT (-1 != iNameSeparatorInx); //the character should exist in the name
|
||
CString csBVRefName = csRefName.Left (iNameSeparatorInx + 1);
|
||
// Shaitan Correction {
|
||
// int iSectionMarkInx = csRefName.ReverseFind (SCR_CC_c_Cfg_SectionIdMark);
|
||
// ASSERT (-1 != iSectionMarkInx);
|
||
// CString csBVShortName = csRefName.Mid (iSectionMarkInx + 1);
|
||
CString csBVShortName = GetInterface()->GetUserPrefix();
|
||
//End Shaitan Correction }
|
||
csBVShortName += "BV";
|
||
csBVRefName += "Geometric:" + csBVShortName;
|
||
CPA_EditorBase *p_oZDxDLL = GetMainWorld ()->GetObjectDLLWithName(C_szDLLZDxName);
|
||
if (hBVolume && p_oZDxDLL)
|
||
{
|
||
tdstCreateZoneMess stZoneMess;
|
||
|
||
stZoneMess . csTypeName = C_szBoundingVolumeName;
|
||
stZoneMess . hEngineZone = hBVolume;
|
||
stZoneMess . csName = csBVShortName;
|
||
stZoneMess . pOwner = pFamily;
|
||
stZoneMess . szDataPath = pFamily->GetDataPath ();
|
||
stZoneMess . csReferenceSectionName = csBVRefName;
|
||
|
||
CPA_BaseObject *p_oZDxBoundingVolume = (CPA_BaseObject*)p_oZDxDLL->OnQueryAction (pFamily->GetEditor(), C_uiQueryCreateBoundingVolumeObject, (LPARAM) & stZoneMess );
|
||
ASSERT (p_oZDxBoundingVolume);
|
||
pFamily->mfn_vSetBoundingVolume (p_oZDxBoundingVolume);
|
||
|
||
if (IDNO == AfxMessageBox ("Do you want to edit the bounding volume?", MB_YESNO | MB_ICONQUESTION))
|
||
return;
|
||
|
||
tdstEdtListMess stMessage;
|
||
stMessage.csListType = C_szBoundingVolumeName;
|
||
stMessage.pActor = (CPA_SaveObject *) pclEdActor->m_pub_fn_pclGetSuperObject();
|
||
stMessage.ulIndexInList = -1;
|
||
stMessage.pObject = NULL;
|
||
stMessage.pList = NULL;
|
||
if (p_oZDxDLL)
|
||
p_oZDxDLL->OnQueryAction(this, C_uiQueryEditBoundingVolume, (long) &stMessage);
|
||
|
||
}
|
||
}
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Method : mfn_bDisplayInfo
|
||
// Date : 98-05
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Description :
|
||
// Author : Stegaru Cristian - CPA2
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Modification :
|
||
// Date :
|
||
// By :
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
BOOL CPA_Actor_Editor_Interface::mfn_bDisplayInfo (UINT uID)
|
||
{
|
||
ASSERT (KA_ACTOR_CHARACTER_INFO == uID || KA_ACTOR_MODULE_INFO == uID);
|
||
DEV_ViewPort3D *pViewPort = (DEV_ViewPort3D *)GetInterface ()->GetMultiDevice ()->GetFocusDevice ()->GetViewPort ();
|
||
if (!pViewPort)
|
||
return FALSE;
|
||
|
||
POINT ptCursor;
|
||
GetCursorPos (&ptCursor);
|
||
ScreenToClient (pViewPort->m_hWnd, &ptCursor);
|
||
|
||
HIE_tdxHandleToSuperObject hSupObject;
|
||
HIE_aDEF_stTabOfPickInfo a_stPickInfo;
|
||
ACP_tdxIndex xNbPicked;
|
||
tdstMousePos stMousePos;
|
||
|
||
xNbPicked = 0;
|
||
pViewPort->PointToMousePos(ptCursor, &stMousePos);
|
||
|
||
//try to pick an object
|
||
// m_pclSelectedInstance;
|
||
hSupObject = pViewPort->GetParentMultiDevice3D()->GetEngineWorld();
|
||
if (hSupObject != NULL)
|
||
{
|
||
xNbPicked = HIE_xIsSuperObjectPick(GLI_C_ModePickingFace,pViewPort->m_hDisplayDevice,
|
||
pViewPort->m_hDisplayViewport, &stMousePos.stPos2D, hSupObject, a_stPickInfo);
|
||
|
||
if (0 != xNbPicked)
|
||
{
|
||
CPA_SuperObject* psoSuperObject=NULL;
|
||
|
||
for (ACP_tdxIndex i=0; i < xNbPicked; i++)
|
||
{
|
||
CPA_SuperObject* pChild = GetInterface()->GetEditorObject(a_stPickInfo[i].hSprObject);
|
||
while (pChild )
|
||
{
|
||
if (KA_ACTOR_MODULE_INFO == uID && pChild && pChild->GetObjectType() == HIE_C_ulPO)
|
||
{
|
||
//info about modules
|
||
HINSTANCE hOldInstance = AfxGetResourceHandle();
|
||
AfxSetResourceHandle( g_stActorEditorIdentity.hModule );
|
||
CModuleInfoDlg dlg (pChild);
|
||
dlg.DoModal ();
|
||
AfxSetResourceHandle (hOldInstance);
|
||
return TRUE;
|
||
}
|
||
pChild = (CPA_SuperObject*)pChild->GetParent();
|
||
if (KA_ACTOR_CHARACTER_INFO == uID && pChild && pChild->GetObjectType() == HIE_C_ulActor)
|
||
{
|
||
HINSTANCE hOldInstance = AfxGetResourceHandle();
|
||
AfxSetResourceHandle( g_stActorEditorIdentity.hModule );
|
||
CCharacterInfoDlg dlg (pChild);
|
||
dlg.DoModal ();
|
||
AfxSetResourceHandle (hOldInstance);
|
||
return TRUE;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
AfxMessageBox ("No actor under the mouse cursor.\n Put the mouse cursor on an actor before to ask for infos!");
|
||
return FALSE;
|
||
}
|
||
/*===========================================================================
|
||
KeyDown
|
||
=========================================================================*/
|
||
BOOL CPA_Actor_Editor_Interface::_OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||
{
|
||
unsigned short uwAction = m_p_oKeyboard->mfn_uwKeyToAction(nChar);
|
||
switch (uwAction)
|
||
{
|
||
case KA_ACTOR_CHARACTER_INFO:
|
||
return mfn_bDisplayInfo (KA_ACTOR_CHARACTER_INFO);
|
||
case KA_ACTOR_MODULE_INFO:
|
||
return mfn_bDisplayInfo (KA_ACTOR_MODULE_INFO);
|
||
|
||
case C_EdActors_Keys_InitialPosition :
|
||
{
|
||
CPA_SuperObject *pclCurrentEdSO;
|
||
CPA_Actor *pclCurrentActor;
|
||
HIE_tdxHandleToSuperObject hActorSO;
|
||
CPA_List<CPA_SuperObject> *pclEdSOList = GetInterface()->GetSelectedObjects(this);
|
||
POSITION pos = pclEdSOList->GetHeadPosition();
|
||
while ( pos != NULL )
|
||
{
|
||
pclCurrentEdSO = pclEdSOList->GetNext(pos);
|
||
pclCurrentActor = (CPA_Actor *)pclCurrentEdSO->GetObject();
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Answering to the popup menu command : 'C_EdActors_PopupID_SetAsInitialPos'",
|
||
"CPA_Actor_Editor_Interface::_OnPopUpMenuCommand(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Received this command for an Object with a bad type (<> HIE_C_ulActor)");
|
||
ERROR_ASSERT( pclCurrentEdSO->GetObjectType() == HIE_C_ulActor );
|
||
|
||
hActorSO = pclCurrentEdSO->GetStruct();
|
||
m_clDocument.m_fn_vSetCurrentActorPositionAsInitial(pclCurrentActor);
|
||
}
|
||
return TRUE;
|
||
}
|
||
|
||
case C_EdActors_Keys_SetAsAlways :
|
||
if (GetInterface()->GetSelectedObjects(this)->GetCount() > 0)
|
||
M_GetEditManager()->AskFor(new CPA_MakeAlways(&m_clDocument, GetInterface()->GetSelectedObjects(this), TRUE));
|
||
return TRUE;
|
||
}
|
||
|
||
return FALSE;
|
||
}
|
||
|
||
|
||
// CPA2 ASilvescu 98-05-07
|
||
void CPA_Actor_Editor_Interface::m_fn_LoadWatchData()
|
||
{
|
||
CPA_List<CPA_BaseObject> clInstancesList;
|
||
GetInterface()->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,NO_CRITERIA);//pclModel);
|
||
POSITION pos = clInstancesList.GetHeadPosition();
|
||
while(pos!=NULL)
|
||
{
|
||
CPA_Actor *pclInstance = (CPA_Actor *)(clInstancesList.GetNext(pos));
|
||
EdActors_EditorActor *edActor = pclInstance->m_fn_pclGetEditorActor();
|
||
CString name = edActor->m_pclActor->GetName();
|
||
CString iniFileName = M_GetMainApp()->m_csEditorDataPath;
|
||
iniFileName += "watch.dat";
|
||
char var[16384], *c;
|
||
GetPrivateProfileSection(name, var, sizeof(var), iniFileName);
|
||
if (strlen(var) > 0)
|
||
{
|
||
m_clDocument.m_fn_vDisplayActor(edActor, ED_ACTORS_eModeOfActorSelection_Unknown);
|
||
}
|
||
for(c=var; *c; c+=lstrlen(c)+1)
|
||
{
|
||
CTL_Editor_Data *data = NULL;
|
||
char *d = strchr(c, '=');
|
||
if(d)
|
||
{
|
||
*d++ = 0;
|
||
if(!lstrcmpi(d, "Designer Variables"))
|
||
{
|
||
CTL_Editor_DataList *datalist = edActor->m_pclListOfDesignerVariableType;
|
||
data = datalist->m_fn_pclGetDataFromName(CString(c));
|
||
if(data)
|
||
{
|
||
CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName));
|
||
|
||
if (pclIADLL!=NULL)
|
||
pclIADLL->OnQueryAction(g_pclInterface,C_uiAI_AddVariableInWatch,(long)data);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
EdActors_AMSListList *mslist = &edActor->m_clListOfAMSLists;
|
||
data = mslist->m_fn_pclGetDataFromName(CString(c));
|
||
if(data) OAC_AddFieldInWatchWindow(data);
|
||
}
|
||
}
|
||
c = d;
|
||
}
|
||
}
|
||
}
|
||
// End CPA2 ASilvescu 98-05-07
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
||
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Method : mfn_vLoadAlways
|
||
// Date : 98-05
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Description :
|
||
// Author : Stegaru Cristian - CPA2
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Modification :
|
||
// Date :
|
||
// By :
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
void CPA_Actor_Editor_Interface::mfn_vLoadAlways (CPA_UnloadedAlways *pUAlways)
|
||
{
|
||
if (!pUAlways)
|
||
return;
|
||
|
||
//check first the list with the list of initialized always
|
||
Position pos = m_clDocument.m_clInitializedAlwaysList.GetHeadPosition ();
|
||
while (pos)
|
||
{
|
||
CPA_BaseObject *pActor = m_clDocument.m_clInitializedAlwaysList.GetNext (pos);
|
||
if (pActor && pUAlways->mfn_csGetUAlwaysName () == pActor->GetName ())
|
||
{
|
||
m_clDocument.m_clInitializedAlwaysList.fn_bRemoveObject (pActor);
|
||
fn_bAddObject (pActor);
|
||
m_clDocument.m_clAlwaysList.fn_bAddObject (pActor);
|
||
m_clDocument.m_fn_vNotifyLevel((CPA_Actor *)pActor, TRUE);
|
||
// update model's list of instances
|
||
CPA_Actor * pInstance = (CPA_Actor *)pActor;
|
||
CPA_Actor * pModel = pInstance->m_fn_pclGetModel();
|
||
pModel->m_fn_pclGetEditorModel()->m_fn_vAddToInstancesList(pInstance->m_fn_pclGetEditorInstance());
|
||
m_clDocument.mfn_vCheckModelToUpdateAlwFile(pModel);
|
||
return;
|
||
}
|
||
}
|
||
|
||
CString csSectionName = pUAlways->mfn_csGetAlwFile () + "^Character:" + pUAlways->mfn_csGetUAlwaysName ();
|
||
|
||
SCR_tdst_Cxt_Values *p_cxtValue;
|
||
if (SCR_fn_c_RdL0_IsSectionExists ((char *)(LPCSTR)csSectionName))
|
||
{
|
||
//load the engine object
|
||
p_cxtValue = SCR_fnp_st_RdL0_AnalyseSection ((char *)(LPCSTR)csSectionName, SCR_CDF_uw_Anl_Normal);
|
||
if (p_cxtValue)
|
||
{
|
||
tdstEngineObject *hAlwaysActor = (tdstEngineObject *)(p_cxtValue->a_ulValues[0]);
|
||
CString csAlwaysName(csSectionName);
|
||
// Shaitan Correction (to solve the problem for Save All) {
|
||
// We must initialize the engine structure
|
||
fn_vInitOneObject(hAlwaysActor, OTI_MapLoaded);
|
||
// End Shaitan Correction }
|
||
|
||
char a_256cFileName[256];
|
||
char a_256cActionName[256];
|
||
char a_256cName[256];
|
||
SCR_fn_v_RdL0_SplitSectionName((char *)LPCTSTR(csAlwaysName), a_256cFileName, a_256cActionName, a_256cName);
|
||
BOOL bIsLoadingWorld = GetInterface()->fn_bIsLoadingWorld();
|
||
GetInterface()->SetLoadingWorld(TRUE);
|
||
|
||
csAlwaysName = a_256cName;
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Creating an Editor Always from Motor actor",
|
||
"EdActors_MyDocument::m_pub_fn_vConstructListOfAlways()",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"No motor name for the Always");
|
||
ERROR_ASSERT( !csAlwaysName.IsEmpty() );
|
||
|
||
//Gets Family
|
||
CString csFamilyName = fn_szFindFamilyTypeNameOfFamilyType(fn_otStandardGameGetFamilyType(hAlwaysActor->h_StandardGame));
|
||
CPA_Family *pclBaseFamily = (CPA_Family *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csFamilyName, C_szFamilyTypeName);
|
||
|
||
//Gets Model
|
||
CString csModelName = fn_szFindModelTypeNameOfModelType(fn_otStandardGameGetModelType(hAlwaysActor->h_StandardGame));
|
||
CPA_Actor *pclModel = (CPA_Actor *) GetMainWorld()->fn_p_oFindObject(csModelName, C_szActorModelTypeName, NO_CRITERIA, E_rc_AllObjects);
|
||
csModelName = csFamilyName + "\\" + csModelName + "\\" + csModelName;
|
||
CPA_Actor *pclBaseModel = m_clDocument.m_fn_pclLoadModel(csModelName, pclModel);
|
||
pclBaseModel->SetAvailable(TRUE);
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Creating an Editor Always from Motor actor",
|
||
"EdActors_MyDocument::m_pub_fn_vConstructListOfAlways()",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Family is unknown");
|
||
ERROR_ASSERT( pclBaseFamily != NULL );
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,"Creating an Editor Always from Motor actor",
|
||
"EdActors_MyDocument::m_pub_fn_vConstructListOfAlways()",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Model is not correct");
|
||
ERROR_ASSERT( pclBaseModel != NULL );
|
||
|
||
// Shaitan Correction (To solve the problem for Always Selection) {
|
||
|
||
// We need the super-object in the constructor for engine initialisations
|
||
//Creates Editor Super Object
|
||
CPA_SuperObject *pclNewAlwaysSO = g_pclInterface->GetInterface()->GetNewSuperObject(E_ss_NoSave,
|
||
C_Protected,
|
||
"",
|
||
"");
|
||
|
||
// Some initialisations are done only when creating a new actor (no engine structure)
|
||
//Creates an Editor Actor
|
||
CPA_Actor *pclNewAlwaysActor = new CPA_Actor( NULL/*hAlwaysActor*/,
|
||
NULL,
|
||
g_c_csActorType,
|
||
pclBaseModel,
|
||
pclBaseFamily,
|
||
pclNewAlwaysSO,
|
||
csAlwaysName);
|
||
|
||
// This is necessary to cancel the Add notification
|
||
// that is automatically registered in the constructor
|
||
pclNewAlwaysActor->fn_vNotifyUnSave();
|
||
|
||
// This is necessary to re-sort the list of actor
|
||
pclNewAlwaysActor->fn_vUpdateData(hAlwaysActor);
|
||
// Associates the engine structure to the editor object
|
||
pclNewAlwaysActor->SetEngineStruct(hAlwaysActor);
|
||
|
||
// This is necessary to update the status of the actor
|
||
// so that the .car is notified with Rebuild (and not with Add)
|
||
pclNewAlwaysActor->SetExistingSection(TRUE);
|
||
pclNewAlwaysActor->fn_vSetExistingSectionSubObject(TRUE);
|
||
// End Shaitan Correction }
|
||
|
||
pclNewAlwaysActor->m_fn_vMakeAlways(TRUE);
|
||
|
||
//Is in common directory ?
|
||
CString csAlwaysCompleteName (csSectionName);
|
||
pclNewAlwaysActor->m_pub_fn_vSetCommon(EDACTORS_fn_bIsFileInCommon(csAlwaysCompleteName), TRUE);
|
||
//pclNewAlwaysActor->m_pub_fn_vSetAlwaysActive(fn_bGetIfCharacterIsInAlwaysActiveCharacterList(pEngineInstance), TRUE);
|
||
pclNewAlwaysActor->m_pub_fn_vSetInFix(fn_bStdGameIsLoadedInFix(hAlwaysActor->h_StandardGame), TRUE);
|
||
|
||
// Shaitan Correction (now it is done before actor creation) {
|
||
/*
|
||
//Creates Editor Super Object
|
||
//Creates a new SuperObject...
|
||
CPA_SuperObject *pclNewAlwaysSO = g_pclInterface->GetInterface()->GetNewSuperObject(E_ss_NoSave,
|
||
C_Protected,
|
||
"",
|
||
"");
|
||
*/
|
||
// End Shaitan Correction }
|
||
|
||
//Sets Object
|
||
pclNewAlwaysSO->SetObject(pclNewAlwaysActor);
|
||
pclNewAlwaysSO->SetTypeSO(C_Dynamic);
|
||
|
||
pclNewAlwaysActor->m_pub_fn_vSetSuperObject(pclNewAlwaysSO);
|
||
|
||
//Add graphical childs
|
||
//Calls motor functions
|
||
HIE_tdxHandleToSuperObject hMotorSO = (HIE_tdxHandleToSuperObject)pclNewAlwaysSO->GetData();
|
||
fn_vAddChildToSuperObject(hMotorSO, //Motor SuperObject
|
||
M_MAKECHAR(pclNewAlwaysActor->m_pub_fn_pclGetFamily()->GetName()),//Family Name
|
||
M_MAKECHAR(pclNewAlwaysActor->m_fn_pclGetModel()->GetName()), //Model Name
|
||
M_MAKECHAR(pclNewAlwaysActor->GetName())); //Perso. Name
|
||
|
||
//Builds editor objects
|
||
pclNewAlwaysActor->m_pub_fn_vAddChildsFromEngineChilds();
|
||
// Shaitan Correction (to solve the problem of engine mode) {
|
||
// we must initialise the always' AI from the model's AI
|
||
// Shaitan => optimisation lists in the level
|
||
EDAC_fn_vProcessBrain(pclNewAlwaysActor->m_fn_pclGetModel(),pclNewAlwaysActor, TRUE);
|
||
// End Shaitan => optimisation lists in the level
|
||
// End Shaitan Correction }
|
||
m_clDocument.m_fn_vNotifyLevel(pclNewAlwaysActor, TRUE);
|
||
|
||
m_clDocument.mfn_vCheckModelToUpdateAlwFile(pclNewAlwaysActor->m_fn_pclGetModel());
|
||
|
||
GetInterface()->SetLoadingWorld(bIsLoadingWorld);
|
||
}
|
||
}
|
||
}
|
||
|
||
// Begin Silviu Simen 18 August 1998 Cut/Paste Mechanism
|
||
BOOL CPA_Actor_Editor_Interface::fn_bAcceptModifCut( CPA_List<CPA_SuperObject> *pListObjects,
|
||
tdeStatus eStatus)
|
||
{
|
||
BOOL bCanCutObjects = TRUE;
|
||
|
||
if ( eStatus == C_AsConcernedDLL )
|
||
{
|
||
CPA_SuperObject *pclEditorSO;
|
||
CPA_Actor *pclActor;
|
||
POSITION pos = pListObjects->GetHeadPosition();
|
||
while ( (pos != NULL) && (bCanCutObjects) )
|
||
{
|
||
pclEditorSO = pListObjects->GetNext(pos);
|
||
pclActor = (CPA_Actor *)pclEditorSO->GetObject();
|
||
|
||
if ( pclActor->m_fn_bIsTheCurrentMotorCamera() )
|
||
bCanCutObjects = FALSE;
|
||
if ( pclActor->m_fn_bIsAPrincipalActor() )
|
||
bCanCutObjects = FALSE;
|
||
/*if ( pclActor->m_fn_bIsTheWorldActor() )
|
||
bCanCutObjects = FALSE;*/
|
||
}
|
||
}
|
||
|
||
return bCanCutObjects;
|
||
}
|
||
|
||
// End Silviu Simen 18 August 1998 Cut/Paste Mechanism
|
||
|
||
// For Anim Player
|
||
CPA_SuperObject* CPA_Actor_Editor_Interface::m_fn_pGetAnActorInstance( CPA_BaseObject *p_oFamily )
|
||
{
|
||
CPA_SuperObject * p_oSuperObjectModel;
|
||
|
||
if (!p_oFamily || !p_oFamily->fn_bIsAvailable())
|
||
return NULL;
|
||
|
||
//////////////////////////////
|
||
//Creates Editor's Actor
|
||
CPA_Actor *pclNewEditorActor = new CPA_Actor(NULL, NULL, g_c_csActorModelType, NULL, (CPA_Family*)p_oFamily, NULL, "dummy");
|
||
m_pTempActorModel = pclNewEditorActor;
|
||
|
||
pclNewEditorActor->m_fn_vMakeGenDoor(FALSE);
|
||
|
||
////////////////////////////////////////////////////////
|
||
//Creates a SuperObject to place in the hierarchy
|
||
p_oSuperObjectModel = g_pclInterface->GetInterface()->GetNewSuperObject( E_ss_NoSave, C_Protected, "", "");
|
||
m_pTempModelSO = p_oSuperObjectModel;
|
||
|
||
pclNewEditorActor->m_fn_vMakeGenDoor(FALSE);
|
||
pclNewEditorActor->m_pub_fn_vSetSuperObject(p_oSuperObjectModel);
|
||
|
||
p_oSuperObjectModel->SetModelName(pclNewEditorActor->GetName());
|
||
p_oSuperObjectModel->SetObject(pclNewEditorActor);
|
||
//PROVISOIRE...
|
||
p_oSuperObjectModel->GetStruct()->hLocalMatrix = (POS_tdstCompletePosition *)malloc(sizeof(POS_tdstCompletePosition));
|
||
POS_fn_vSetIdentityMatrix(p_oSuperObjectModel->GetStruct()->hLocalMatrix);
|
||
|
||
m_clDocument.m_fn_vDisplayActor(pclNewEditorActor->m_fn_pclGetEditorActor(), ED_ACTORS_eModeOfActorSelection_Unknown);
|
||
|
||
//**************************
|
||
HIE_tdxHandleToSuperObject hMotorSO = NULL;
|
||
CPA_SuperObject *pNewInstance = NULL;
|
||
CPA_Actor *pNewEditorInstance = NULL;
|
||
CPA_Actor *pclEdModel = NULL;
|
||
CString csNewInstanceName;
|
||
|
||
CPA_SuperObject *pclModel = p_oSuperObjectModel;
|
||
|
||
//---------------------------------------------------------
|
||
// Checks the Model for Instanciation
|
||
//---------------------------------------------------------
|
||
BOOL bInstanciationChecked = FALSE;
|
||
|
||
pclEdModel = (CPA_Actor *)pclModel->GetObject();
|
||
|
||
bInstanciationChecked = pclEdModel->m_pub_fn_bCheckModelForInstanciation();
|
||
|
||
//---------------------------------------------------------
|
||
// Instanciates the Model
|
||
//---------------------------------------------------------
|
||
if ( bInstanciationChecked )
|
||
{
|
||
|
||
//Creates SuperObject
|
||
pNewInstance = GetInterface()->GetNewSuperObject(E_ss_NoSave, C_Protected, "dummy_inst", "");
|
||
m_pTempInstanceSO = pNewInstance;
|
||
|
||
//Creates Editor Object
|
||
pNewEditorInstance = new CPA_Actor( NULL, NULL, g_c_csActorType, pclEdModel, pclEdModel->m_pub_fn_pclGetFamily(), pNewInstance,"dummy_inst");
|
||
m_pTempActorModelInstance = pNewEditorInstance;
|
||
|
||
pNewEditorInstance->m_fn_vMakeGenDoor(pclEdModel->m_fn_bIsAGenDoor());
|
||
pNewEditorInstance->m_pub_fn_vSetSuperObject(pNewInstance);
|
||
|
||
hMotorSO = (HIE_tdxHandleToSuperObject)pNewInstance->GetStruct();
|
||
|
||
AfxGetApp()->DoWaitCursor(1);
|
||
if (!pNewEditorInstance->m_fn_bIsAGenDoor())
|
||
{
|
||
//Loads the Animation for the first State (if it's not done)
|
||
|
||
//Gets the Initial State
|
||
tdxHandleToState hInitState = fn_h3dDataGetInitialState(M_GetMSHandle(hMotorSO,3dData));
|
||
CPA_State *p_clState = (CPA_State *)GetMainWorld()->fn_p_oFindObjectWithEngine(hInitState, C_szStateTypeName);
|
||
|
||
//Loads the correponding Animation
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Instance from Editor : getting the Editor State",
|
||
"CPA_Actor_Editor_Interface::GetNewInstance(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"No Editor State corresponding to Motor one, or invalid Motor State");
|
||
ERROR_ASSERT( p_clState != NULL );
|
||
|
||
CPA_Animation *p_clAnimation = p_clState->mfn_p_oGetAnimation();
|
||
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Instance from Editor : getting the animation for the State",
|
||
"CPA_Actor_Editor_Interface::GetNewInstance(...)",
|
||
E_ERROR_GRAVITY_WARNING,
|
||
"No Animation for the State");
|
||
ERROR_ASSERT( p_clAnimation != NULL );
|
||
|
||
if (!p_clAnimation)
|
||
{
|
||
fn_vSetAnimInState(hInitState, NULL);
|
||
}
|
||
else if (!p_clAnimation->fn_bIsAvailable())
|
||
{
|
||
ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
|
||
"Creating an Instance from Editor",
|
||
"CPA_Actor_Editor_Interface::GetNewInstance(...)",
|
||
E_ERROR_GRAVITY_FATAL,
|
||
"Could not load the initial Animation");
|
||
ERROR_VERIFY( p_clAnimation->GetEditor()->fn_bLoadBaseObject(p_clAnimation) );
|
||
|
||
//Sets motor pointers
|
||
fn_vSetAnimInState(hInitState, (struct tdstAnim3d_ *)p_clAnimation->GetData());
|
||
}
|
||
|
||
//Sets the Object Table (as the Model's one)
|
||
tdxHandleToObjectsTablesList hObjectTable;
|
||
tdstEngineObject *pstEngineModel=(tdstEngineObject *)pclEdModel->GetData();
|
||
hObjectTable=fn_h3dDataGetInitialObjectsTable(pstEngineModel->h_3dData);
|
||
|
||
// If not found, use the default value of the family
|
||
if (hObjectTable == NULL)
|
||
{
|
||
tdxHandleToFamilyList hFamily = (tdxHandleToFamilyList)(pclEdModel->m_pub_fn_pclGetFamily()->GetData());
|
||
hObjectTable = hFamily->h_DefaultObjectsTable;
|
||
}
|
||
|
||
fn_v3dDataSetCurrentObjectsTable(M_GetMSHandle(hMotorSO,3dData), hObjectTable);
|
||
fn_v3dDataSetInitialObjectsTable(M_GetMSHandle(hMotorSO,3dData), hObjectTable);
|
||
|
||
if (p_clAnimation)
|
||
{
|
||
CString csInfoMessage = CString("Actors Editor has loaded the following animation : ") + p_clAnimation->GetName();
|
||
EDACTORS_fn_vGiveProgressInfo(csInfoMessage);
|
||
}
|
||
}
|
||
|
||
AfxGetApp()->DoWaitCursor(-1);
|
||
|
||
//Changes the draw mask for the zones to be showed (Alexis)
|
||
HIE_fn_vSetSuperObjectDrawMask (pNewInstance->GetStruct(), GLI_C_lAllIsEnable ^ GLI_C_lIsNotDrawCollideInformation);
|
||
}
|
||
|
||
if (pNewInstance != NULL)
|
||
{
|
||
pNewInstance->SetModelName(pclModel->GetName());
|
||
pNewInstance->SetTypeSO(C_Dynamic);
|
||
|
||
CPA_Actor *pclEdInst = (CPA_Actor *)pNewInstance->GetObject();
|
||
|
||
//Prepares Motor Actor
|
||
m_fn_vPrepareMotorActor(pclEdInst);
|
||
|
||
//Sets motor object's SO
|
||
EdActors_tdhHandleToActor hActor = pclEdInst->m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor();
|
||
M_SetSuperObject(hActor, hMotorSO);
|
||
|
||
//Motor MS initialization
|
||
fn_vAllSecondPassAreDone(hActor->h_StandardGame);
|
||
fn_vInitOneObject(hActor, OTI_MapLoaded);
|
||
|
||
//Sets the Motor SO's global Matrix as the 3DData's Matrix
|
||
HIE_fn_vSetSuperObjectMatrix(hMotorSO, fn_p_st3dDataGetMatrix(M_GetMSHandle(hMotorSO,3dData)));
|
||
GEO_M_vCopyMatrix(hMotorSO->hGlobalMatrix, hMotorSO->hLocalMatrix);
|
||
|
||
//Calls Motor function to add to this Instance its graphical Childs
|
||
fn_vAddChildToSuperObject(hMotorSO, //Motor SuperObject
|
||
M_MAKECHAR(pclEdInst->m_pub_fn_pclGetFamily()->GetName()),//Family Name
|
||
M_MAKECHAR(pclEdInst->m_fn_pclGetModel()->GetName()), //Model Name
|
||
M_MAKECHAR(pclEdInst->GetName())); //Perso. Name
|
||
|
||
if ( !pNewEditorInstance->m_fn_bIsAGenDoor() )
|
||
pNewEditorInstance->m_pub_fn_vAddChildsFromEngineChilds();
|
||
else
|
||
pNewEditorInstance->m_pub_fn_vAddChildsForGenDoors();
|
||
|
||
}
|
||
|
||
return pNewInstance;
|
||
}
|
||
|
||
void CPA_Actor_Editor_Interface::m_fn_vDeleteTempActorInstance( )
|
||
{
|
||
if (m_pTempActorModel)
|
||
delete m_pTempActorModel;
|
||
if (m_pTempActorModelInstance)
|
||
delete m_pTempActorModelInstance;
|
||
if (m_pTempInstanceSO)
|
||
delete m_pTempInstanceSO;
|
||
if (m_pTempModelSO)
|
||
delete m_pTempModelSO;
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Method : mfn_vUpdateDisplayOfAllActors
|
||
// Date : 98-09
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Description :
|
||
// Author : shaitan
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// Modification :
|
||
// Date :
|
||
// By :
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
void CPA_Actor_Editor_Interface::mfn_vUpdateDisplayOfAllActors (BOOL bShowInactive)
|
||
{
|
||
GLI_tdstGeometricInfo *p_xGeometricInFile;
|
||
SCR_tdst_Cxt_Values *p_stValues;
|
||
CPA_BaseObjectList *pListOfActor;
|
||
CPA_SuperObject *pSupObj;
|
||
CPA_SuperObject *pclNewModule;
|
||
Geometry3D *pclGeometricObject;
|
||
CPA_Actor *pActor;
|
||
Position pos;
|
||
CString csModFileName;
|
||
|
||
if (m_pEngineModule == NULL)
|
||
{
|
||
//Loads the ".MOD"
|
||
csModFileName = "Ed.mod";
|
||
csModFileName = CString("EDT_Data\\") + g_pclInterface->m_clDocument.m_csModelsBitmapsPathForGenDoors + csModFileName;
|
||
|
||
//Loads the motor geometric object
|
||
p_stValues = SCR_fnp_st_RdL0_AnalyseSection((char *)LPCTSTR(csModFileName), SCR_CDF_uw_Anl_Normal);
|
||
p_xGeometricInFile = (GLI_tdstGeometricInfo *) p_stValues->a_ulValues[0];
|
||
m_pEngineModule = (void *) p_xGeometricInFile->hObject;
|
||
}
|
||
|
||
// get the geometry DLL
|
||
CPA_ObjectDLLBase *p_cl3DGeomDLL = GetMainWorld()->GetObjectDLLWithName(C_szDLLGeometryName);
|
||
|
||
// get list of instances
|
||
pListOfActor = GetMainWorld ()->fn_p_oGetOriginalObjectList(C_szActorInstanceTypeName);
|
||
pos = pListOfActor->GetHeadPosition();
|
||
|
||
while (pos)
|
||
{
|
||
pActor = (CPA_Actor *)pListOfActor->GetNext(pos);
|
||
pSupObj = pActor->m_pub_fn_pclGetSuperObject();
|
||
|
||
// check child
|
||
if (bShowInactive && !pSupObj->GetSuperObjectFirstChild() && !pActor->m_fn_bIsAGenDoor())
|
||
{
|
||
if (!pActor->m_fn_pclGetIsolatedSuperObject())
|
||
{
|
||
// Creates the editor Object and SO
|
||
pclGeometricObject = (Geometry3D *) p_cl3DGeomDLL->OnQueryAction(g_pclInterface, (WPARAM)C_uiCreateGeometricObject,(LPARAM)m_pEngineModule);
|
||
pclNewModule = g_pclInterface->GetInterface()->GetNewSuperObject(E_ss_NoSave, C_Protected, "", "");
|
||
pclNewModule->SetObject(pclGeometricObject);
|
||
//Indicates that Module is Actor's property
|
||
pclNewModule->SetSuperObjectOwner(pSupObj);
|
||
pclNewModule->SetEditProtected(TRUE);
|
||
//Internal
|
||
pActor->m_fn_vSetIsolatedSuperObject(pclNewModule);
|
||
}
|
||
|
||
//Adds SuperObject as Actor's child
|
||
pSupObj->AddTail(pActor->m_fn_pclGetIsolatedSuperObject());
|
||
}
|
||
else if (!bShowInactive && !pActor->m_fn_bIsAGenDoor() && pActor->m_fn_pclGetIsolatedSuperObject())
|
||
{
|
||
pActor->m_fn_pclGetIsolatedSuperObject()->Isolate(TRUE);
|
||
}
|
||
}
|
||
// update display and dialog
|
||
GetInterface()->fn_vUpdateAll(E_mc_UpdateDialog);
|
||
}
|
||
|
||
// Begin Silviu Simen List by Sector and type
|
||
void CPA_Actor_Editor_Interface::fn_AddDialogBySector (void)
|
||
{
|
||
CPA_List<CPA_SuperObject>* poList = GetInterface()->GetObjectListByType (C_szSectorTypeName);
|
||
CPA_SuperObject * p_sector;
|
||
POSITION pos;
|
||
|
||
ASSERT (poList);
|
||
for (p_sector = poList -> GetHeadElement(pos); p_sector; p_sector = poList -> GetNextElement(pos) )
|
||
{
|
||
m_clDocument.m_pclDialogList->fn_vAddANewList(p_sector -> GetName(),
|
||
M_GetMainWorld()->m_stListObjectsInSectors.GetListOfSectorByType(p_sector,HIE_C_ulActor));
|
||
}
|
||
m_clDocument.m_pclDialogList->fn_vReinitDialog();
|
||
m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList);
|
||
}
|
||
// End Silviu Simen List by Sector and type
|
||
|