///////////////////////////////////////////////// // _Actors.cpp // // Implementation file - Actors DLL Object // // Programmation : YB ///////////////////////////////////////////////// #include "StdAfx.h" #include "_AInterf.hpp" #include "IncGAM.h" #include "TFa.h" #include "DPT.h" #include "EDACStrg.hpp" #include "EDACInst.hpp" #include "EDACModl.hpp" #include "EDACVwAc.hpp" #include "EDACDgIf.hpp" #include "EDACDgQu.hpp" #include "Defines.hpp" //-----------------IR------------------------- #include "EdIRStrg.hpp" #include "EdIRFrm.hpp" #include "EdIRDVVw.hpp" #include "EdIRBeEn.hpp" //BEGIN ROMTEAM Cristi Petrescu 98-05- #include "ai_intf.hpp" //END ROMTEAM Cristi Petrescu 98-05- //-------------------------------------------- #include "EDACActr.hpp" #include "OPD.h" #include "OGd.h" #include "ErO.h" #undef CPA_WANTS_IMPORT #undef CPA_EXPORT #define CPA_WANTS_EXPORT //-----------------IR------------------------- #include "EdIRIRD.hpp" //-------------------------------------------- #include "_Actors.hpp" #undef CPA_WANTS_EXPORT #define CPA_WANTS_IMPORT static const CString s_g_c_csAntiSlash = "\\"; #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif //****************************************************************************** //****************************************************************************** DeclareTemplateStatic(EdActors_tdhHandleToActor); //****************************************************************************** //****************************************************************************** // Del function //****************************************************************************** void fn_vDelete(EdActors_tdhHandleToActor hObj) { // !!!! For actors, deletion is made in Editor's objects !!!! } //CPA2 Stegaru Cristian 98-06 CString CPA_Actor::m_csINIFileName = "Objects\\Actors\\Actors.ini"; CString CPA_Actor::m_csHideVariableSection = "HideVariableSection"; //End CPA2 Stegaru Cristian 98-06 //****************************************************************************** void CPA_Actor::StaticInit() { CPA_EdMot::Init(NULL, NULL, fn_vDelete); SCR_fn_v_RdL0_RegisterCallback( M_MAKECHAR(g_c_csActorScriptModelSectionName), EdActors_MyDocument::m_fn_tdeCallBackLoadModel, SCR_CRC_c_RdL0_ForSection); SCR_fn_v_RdL0_RegisterCallback( M_MAKECHAR(g_c_csMSSection), EdActors_ActorMiniStructure::m_fn_tdeCallBackLoad, SCR_CRC_c_RdL0_ForSection); //For fields in Watch ("elv" file) SCR_fn_v_RdL0_RegisterCallback( M_MAKECHAR(g_c_csEdActors_ActorInWatchSectionName), EdActors_MyDocument::m_fn_tdeCallBackLoadFieldsInWatch, SCR_CRC_c_RdL0_ForSection); } //****************************************************************************** //****************************************************************************** // CPA_Actor normal constructor //****************************************************************************** //****************************************************************************** CPA_Actor::CPA_Actor( EdActors_tdhHandleToActor hObj, EdActors_EditorActor *pclEditorActor, CString csType, CPA_Actor *pclBaseModel, CPA_Family *pclBaseFamily, CPA_SuperObject *_p_oSuperObject, CString csName, BOOL _bActorIsAvailable /*= TRUE*/ ) : CPA_SaveObject( g_pclInterface, csType, E_ss_Responsible ), CPA_EdMot(hObj) { //////////////////// // Specific inits // //////////////////// // Init members // //To be able to save m_bIsAnAlways = FALSE; m_bIsAGenDoor = FALSE; m_bDisplayZone = FALSE; m_pclIsolatedSuperObject = NULL; m_pclSectionSubObject = NULL; m_pri_pclCurrentObjectTable = NULL; m_pri_pclInitialObjectTable = NULL; m_pri_pclCurrentAction = NULL; m_pri_pclInitialAction = NULL; m_pri_pclCurrentState = NULL; m_pri_pclInitialState = NULL; m_pclSuperObject = NULL; m_pri_pclFamily = pclBaseFamily; m_bIsAnInstance = ( csType.Compare(g_c_csActorType) == 0 ); m_pri_bIsCommon = FALSE; m_pri_bIsInFix = FALSE; m_pri_bIsAlwaysActive = FALSE; // ANNECY MT - 19/11/98 { m_pri_bIsInAllSubMaps = FALSE; // END ANNECY MT } m_pri_bHasBeenModified = FALSE; m_bCheckZonesAgainstBV = TRUE; //////////////// // Base inits // //////////////// //Section object SetSectionData(this); SetCallBackSave(s_m_fn_vCallBackSaveActor); SetDataPath((char *)LPCTSTR(g_pclInterface->m_clDocument.m_pub_csCommonDataPath)); //Base objet CPA_SaveObject *pclActorsOwner = NULL; if ( csType.CompareNoCase(g_c_csActorType) == 0 ) pclActorsOwner = (CPA_SaveObject *)pclBaseModel; else if ( csType.CompareNoCase(g_c_csActorModelType) == 0 ) pclActorsOwner = (CPA_SaveObject *)pclBaseFamily; fn_bSetOwner(pclActorsOwner); //Name if (fn_eRename(csName) != E_mc_None ) SetDefaultValidName(); m_bHideVariable = FALSE; mfn_vLoadFromINI (); if ( _p_oSuperObject != NULL ) { m_pub_fn_vSetSuperObject(_p_oSuperObject); _p_oSuperObject->SetObject(this); } //***************************** //** Creation of an Instance ** //***************************** if ( csType.Compare(g_c_csActorType) == 0 ) { EdActors_EditorActorInstance *pclNewEditorInstance = new EdActors_EditorActorInstance(pclBaseModel, this, hObj, _p_oSuperObject); //Adds in the List g_pclInterface->m_clDocument.m_clInstancesList.fn_bAddObject(this); if ( pclBaseModel != NULL ) m_bIsAGenDoor = pclBaseModel->m_fn_bIsAGenDoor(); } //************************* //** Creation of a Model ** //************************* else if ( csType.Compare(g_c_csActorModelType) == 0 ) { //Creates Editor's Model EdActors_EditorActorModel *pclNewEditorModel = NULL; if ( pclBaseFamily != NULL ) pclNewEditorModel = new EdActors_EditorActorModel(pclBaseFamily,this); else pclNewEditorModel = new EdActors_EditorActorModel(this); ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Creation of a Model", "CPA_Actor::CPA_Actor(...)", E_ERROR_GRAVITY_FATAL, "Editor Model has not been created (Pointer is NULL)"); ERROR_ASSERT( pclNewEditorModel != NULL ); //Sets internal Pointer m_pclEditorActor = pclNewEditorModel; EdActors_tdhHandleToActor hActor = (EdActors_tdhHandleToActor)(pclNewEditorModel->m_fn_ptdstGetMotorActor()); fn_vUpdateData(hActor); SetEngineStruct(hActor); //Adds in the List g_pclInterface->m_clDocument.m_clModelsList.fn_bAddObject(this); if (!g_pclInterface->m_clDocument.m_pLoadedModel) g_pclInterface->m_clDocument.m_pLoadedModel = this; //Tells Material Editor about the Model creation CPA_DLLBase *p_clGameMaterialDLL = g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLMaterialName); if( p_clGameMaterialDLL != NULL ) p_clGameMaterialDLL->OnQueryAction(g_pclInterface, (WPARAM)C_cCreateNewGameMaterial, 0); } //For Object Tables m_pub_fn_vConstructEnumDescriptorForObjectsTables(); //Updates List Dialog // g_pclInterface->m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList); fn_vUpdateSectionName(); //First notification if ( m_fn_bIsAModel() ) { //If Model is loaded from a file if ( pclBaseFamily == NULL ) SetExistingSection(TRUE); else SetExistingSection(FALSE); } else { //If Instance is loaded from a file if ( hObj != NULL ) SetExistingSection(TRUE); else SetExistingSection(FALSE); } //Internal Section Object m_pclSectionSubObject = new CPA_SectionObject("", (char *)LPCTSTR(g_pclInterface->m_clDocument.m_pub_csCommonDataPath), s_m_fn_vCallBackSaveActor, this, fn_bSectionExists()); if ( pclBaseFamily != NULL ) m_pclSectionSubObject->SetReferencedSectionName(m_pri_fn_csComputeReferencedFileName()); if ( ( fn_bCanBeNotified() ) && ( !fn_bSectionExists() ) && ( _bActorIsAvailable ) ) fn_vNotifySave(); // !! Bidon !! //Sets Inital OT /* if ( m_fn_bIsAModel() && _bActorIsAvailable ) { //m_pub_fn_vConstructEnumDescriptorForObjectsTables(); EditorObjectTable *pclOT = NULL; CString csOTName; if ( m_pub_fn_pclGetEnumDescriptorForObjectsTables()->GetCount() > 0 ) { CString csOTName = m_pub_fn_pclGetEnumDescriptorForObjectsTables()->GetHead()->m_pub_fn_csGetString(); pclOT = (EditorObjectTable *)g_pclInterface->GetMainWorld()->fn_p_oFindObject(csOTName, C_szObjectTableTypeName); } m_pub_fn_vSetInitialObjectTable(pclOT); } */ // !! End Bidon !! } //****************************************************************************** //****************************************************************************** // CPA_Actor Copy constrcutor //****************************************************************************** //****************************************************************************** // !! Only works with Models !! //****************************************************************************** CPA_Actor::CPA_Actor(CPA_Actor *_pclSourceActor, CPA_SuperObject *_p_oSuperObject, CString _csName) : CPA_SaveObject( g_pclInterface, _pclSourceActor->GetType(), E_ss_Responsible ), CPA_EdMot((EdActors_tdhHandleToActor)NULL) { //////////////////// // Specific inits // //////////////////// // Init members // //To be able to save m_bIsAnAlways = _pclSourceActor->m_bIsAnAlways; m_bIsAGenDoor = FALSE; //An init function will be called m_bDisplayZone = FALSE; m_pclIsolatedSuperObject = NULL; m_pclSectionSubObject = NULL; m_pri_pclCurrentObjectTable = _pclSourceActor->m_pri_pclCurrentObjectTable; m_pri_pclInitialObjectTable = _pclSourceActor->m_pri_pclInitialObjectTable; m_pri_pclCurrentAction = _pclSourceActor->m_pri_pclCurrentAction; m_pri_pclInitialAction = _pclSourceActor->m_pri_pclInitialAction; m_pri_pclCurrentState = _pclSourceActor->m_pri_pclCurrentState; m_pri_pclInitialState = _pclSourceActor->m_pri_pclInitialState; m_pclSuperObject = NULL; m_pri_pclFamily = _pclSourceActor->m_pub_fn_pclGetFamily(); m_bIsAnInstance = _pclSourceActor->m_bIsAnInstance; m_pri_bIsCommon = FALSE; m_pri_bIsInFix = FALSE; m_pri_bIsAlwaysActive = FALSE; // ANNECY MT - 19/11/98 { m_pri_bIsInAllSubMaps = FALSE; // END ANNECY MT } m_pri_bHasBeenModified = FALSE; //////////////// // Base inits // //////////////// //Section object SetSectionData(this); SetCallBackSave(s_m_fn_vCallBackSaveActor); SetDataPath((char *)LPCTSTR(g_pclInterface->m_clDocument.m_pub_csCommonDataPath)); //Base objet CPA_SaveObject *pclActorsOwner = NULL; // if ( m_bIsAnInstance ) // pclActorsOwner = (CPA_SaveObject *)_pclSourceActor->m_pub_fn_pclGetModel(); // else pclActorsOwner = (CPA_SaveObject *)m_pri_pclFamily; fn_bSetOwner(pclActorsOwner); //Name if ( fn_eRename(_csName) != E_mc_None ) SetDefaultValidName(); if ( _p_oSuperObject != NULL ) m_pub_fn_vSetSuperObject(_p_oSuperObject); //************************* //** Copy of an Instance ** //************************* if ( _pclSourceActor->GetType().Compare(g_c_csActorType) == 0 ) { /* EdActors_EditorActorInstance *pclNewEditorInstance = new EdActors_EditorActorInstance(pclBaseModel, this, hObj, _p_oSuperObject); //Adds in the List g_pclInterface->m_clDocument.m_clInstancesList.fn_bAddObject(this); if ( pclBaseModel != NULL ) m_bIsAGenDoor = pclBaseModel->m_fn_bIsAGenDoor(); */ } //********************* //** Copy of a Model ** //********************* else if ( _pclSourceActor->GetType().Compare(g_c_csActorModelType) == 0 ) { //Creates Editor's Model EdActors_EditorActorModel *pclNewEditorModel = NULL; //Calls the copy contructor pclNewEditorModel = new EdActors_EditorActorModel(_pclSourceActor->m_fn_pclGetEditorModel(), this); ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Copy of a Model", "CPA_Actor::CPA_Actor(...) ", E_ERROR_GRAVITY_FATAL, "Editor Model has not been created (returned Pointer is NULL)"); ERROR_ASSERT( pclNewEditorModel != NULL ); //Sets internal Pointer m_pclEditorActor = pclNewEditorModel; EdActors_tdhHandleToActor hActor = (EdActors_tdhHandleToActor)(pclNewEditorModel->m_fn_ptdstGetMotorActor()); fn_vUpdateData(hActor); SetEngineStruct(hActor); //Adds in the List g_pclInterface->m_clDocument.m_clModelsList.fn_bAddObject(this); //Tells Material Editor about the Model creation // CPA_DLLBase *p_clGameMaterialDLL = g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLMaterialName); // if( p_clGameMaterialDLL != NULL ) // p_clGameMaterialDLL->OnQueryAction(g_pclInterface, (WPARAM)C_cCreateNewGameMaterial, 0); } //For Object Tables m_pub_fn_vConstructEnumDescriptorForObjectsTables(); //Updates List Dialog // g_pclInterface->m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList); fn_vUpdateSectionName(); //First notification //Is never loaded SetExistingSection(FALSE); //Internal Section Object m_pclSectionSubObject = new CPA_SectionObject("", (char *)LPCTSTR(g_pclInterface->m_clDocument.m_pub_csCommonDataPath), s_m_fn_vCallBackSaveActor, this, fn_bSectionExists()); m_pclSectionSubObject->SetReferencedSectionName(m_pri_fn_csComputeReferencedFileName()); if ( ( fn_bCanBeNotified() ) && ( !fn_bSectionExists() ) ) fn_vNotifySave(); } //****************************************************************************** CPA_Actor::~CPA_Actor() { // ANNECY MT 13-02-98 { // Destroy from Coherence Manager g_oCoherenceManager.m_fn_vDestroyObject(this); // END ANNECY MT } //Deletes Editor Actor delete m_pclEditorActor; } //****************************************************************************** void CPA_Actor::SetEngineStruct(EdActors_tdhHandleToActor hObj) { SetStruct(hObj); //Sets internal data m_pclEditorActor->m_fn_vSetMotorActor(hObj); } // Specific ///////////// //****************************************************************************** CPA_Actor *CPA_Actor::m_fn_pclGetModel() { if ( m_fn_bIsAnInstance() ) return ( (CPA_Actor *)GetOwner() ); else return NULL; } //****************************************************************************** BOOL CPA_Actor::m_fn_bIsAnInstance() { return ( m_bIsAnInstance ); } //****************************************************************************** BOOL CPA_Actor::m_fn_bIsAModel() { return ( !m_bIsAnInstance ); } //****************************************************************************** EdActors_EditorActor *CPA_Actor::m_fn_pclGetEditorActor() { return m_pclEditorActor; } //****************************************************************************** void CPA_Actor::m_fn_vSetEditorActor(EdActors_EditorActor *p_clEditorActor) { m_pclEditorActor = p_clEditorActor; } //****************************************************************************** EdActors_EditorActorModel *CPA_Actor::m_fn_pclGetEditorModel() { if ( m_fn_bIsAModel() ) return (EdActors_EditorActorModel *)m_pclEditorActor; else return NULL; } //****************************************************************************** EdActors_EditorActorInstance *CPA_Actor::m_fn_pclGetEditorInstance() { if ( m_fn_bIsAnInstance() ) return (EdActors_EditorActorInstance *)m_pclEditorActor; else return NULL; } //****************************************************************************** //To set a new name for an Actor BOOL CPA_Actor::m_fn_bRename(CString _csNewName) { BOOL bReturn = TRUE; CString csNewName = _csNewName; BOOL bIsLoadingWorld = g_pclInterface->GetInterface()->fn_bIsLoadingWorld(); if ( m_pub_fn_bCanBeRenamed() ) { //ANNECY Shaitan RenameAlways (03.04.98) { if (m_bIsAnAlways) { CString csPrefix = csNewName.Left(4); if (!bIsLoadingWorld && (csPrefix.CompareNoCase("ALW_") != 0)) { // if necessary, remove user prefix, and set always prefix if (csPrefix.Compare(g_pclInterface->GetInterface()->GetUserPrefix()) == 0) csNewName = "ALW_" + _csNewName.Mid(4); else csNewName = "ALW_" + _csNewName; // rename actor while (fn_eCheckValidity(csNewName) != E_mc_None) csNewName = csNewName + "1"; } } //ENDANNECY Shaitan RenameAlways } //Renames Object if ( csNewName.Compare(GetName()) != 0 ) { //For Level to be changed (deletes old section) g_pclInterface->m_clDocument.m_fn_vNotifyLevel(this, FALSE); if (m_bIsAnAlways && !bIsLoadingWorld) g_pclInterface->GetInterface()->SetLoadingWorld(TRUE); bReturn = ( fn_eRename(csNewName) == E_mc_None ); g_pclInterface->GetInterface()->SetLoadingWorld(bIsLoadingWorld); } if ( bReturn ) { //Motor changes if ( m_fn_bIsAnInstance() ) { MS_tdxHandleToStandardGame h_StdGame = m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor()->h_StandardGame; tdObjectType otPersonalType = fn_otStandardGameGetPersonalType(h_StdGame); fn_vChangePersonalTypeNameOfPersonalType(otPersonalType, (char *)LPCTSTR(csNewName)); } //Editor's display update g_pclInterface->m_clDocument.m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList); g_pclInterface->m_clDocument.m_pclActorsView->m_fn_vUpdateActorName(); } //For Level to be saved (adds new section) g_pclInterface->m_clDocument.m_fn_vNotifyLevel(this, TRUE); //Saves modifications in Watch Description //if ( m_fn_bIsAnInstance() ) // g_pclInterface->m_clDocument.m_pri_fn_bSaveFieldsInWatch(); } else { CString csMessage = CString("Actor '") + GetName() + "' can not be renamed !"; EdActors_InformationDialog InfoDial(&g_oBaseFrame, csMessage); InfoDial.DoModal(); bReturn = FALSE; } return bReturn; } //****************************************************************************** //To finish loading a Model void CPA_Actor::m_fn_vFinishLoading() { ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Trying to load an incomplete Model", "CPA_Actor::m_fn_vFinishLoading(...)", E_ERROR_GRAVITY_FATAL, "Actor must be a Model, but is an Instance"); ERROR_ASSERT( m_fn_bIsAModel() ); CString csCompleteName = m_fn_csGetFamilyName() + '\\' + GetName() + '\\' + GetName(); g_pclInterface->m_clDocument.m_fn_pclLoadModel(csCompleteName, this); SetAvailable(TRUE); //Updates display g_pclInterface->m_clDocument.m_fn_vDisplayActor(m_pclEditorActor, ED_ACTORS_eModeOfActorSelection_Unknown); } //****************************************************************************** CString CPA_Actor::m_fn_csGetFamilyName() { return m_csFamilyName; } //****************************************************************************** void CPA_Actor::m_fn_vSetFamilyName(CString csNewFamilyName) { m_csFamilyName = csNewFamilyName; } //****************************************************************************** // Sets the Actor as an Always void CPA_Actor::m_fn_vMakeAlways(BOOL bIsAnAlways /*= TRUE*/) { BOOL bIsLoadingWorld; CString csName, csPrefix; if (!m_fn_bCanBeAnAlways()) { CString csMessage; csMessage.Format("Actor %s cannot be set as always", GetName()); ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Modifying Always Status of Actor", "CPA_Actor::m_fn_vMakeAlways", E_ERROR_GRAVITY_WARNING, csMessage); ERROR_ASSERT( FALSE ); } else { if ( bIsAnAlways != m_bIsAnAlways ) { m_bIsAnAlways = bIsAnAlways; if ( m_bIsAnAlways ) { //Adds it to the (internal) list of Always g_pclInterface->m_clDocument.m_clAlwaysList.fn_bAddObject(this); //Removes from Instances list g_pclInterface->m_clDocument.m_clInstancesList.fn_bRemoveObject(this); //ANNECY Shaitan RenameAlways (03.04.98) { csPrefix = GetName().Left(4); bIsLoadingWorld = g_pclInterface->GetInterface()->fn_bIsLoadingWorld(); if (!bIsLoadingWorld && (csPrefix.CompareNoCase("ALW_") != 0)) { g_pclInterface->GetInterface()->SetLoadingWorld(TRUE); // if necessary, remove user prefix, and set always prefix if (csPrefix.Compare(g_pclInterface->GetInterface()->GetUserPrefix()) == 0) csName = "ALW_" + GetName().Mid(4); else csName = "ALW_" + GetName(); // rename actor while (fn_eRename(csName) != E_mc_None) csName = csName + "1"; g_pclInterface->GetInterface()->SetLoadingWorld(bIsLoadingWorld); } //ENDANNECY Shaitan RenameAlways } //Makes the motor modifications if( !fn_ucIsAnAlwaysModel(m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor()) ) { fn_vAddAnAlwaysModel(m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor()); // fn_v3dDataInit(m_fn_pclGetEditorActor()->m_fn_ptdstGetMotorActor(), OTI_AlwaysCreated); } //Removes from hierarchy if (!bIsLoadingWorld) ERROR_VERIFY( g_pclInterface->GetInterface()->fn_bDeleteObjectInHierarchy(m_pub_fn_pclGetSuperObject(), FALSE) ); } else { //Adds it to the (internal) list of Instances g_pclInterface->m_clDocument.m_clInstancesList.fn_bAddObject(this); //Removes from Always list g_pclInterface->m_clDocument.m_clAlwaysList.fn_bRemoveObject(this); //ANNECY Shaitan RenameAlways (03.04.98) { csPrefix = GetName().Left(4); bIsLoadingWorld = g_pclInterface->GetInterface()->fn_bIsLoadingWorld(); if (!bIsLoadingWorld && (csPrefix.Compare(g_pclInterface->GetInterface()->GetUserPrefix()) != 0)) { g_pclInterface->GetInterface()->SetLoadingWorld(TRUE); // if necessary, remove user prefix, and set always prefix if (csPrefix.CompareNoCase("ALW_") == 0) csName = g_pclInterface->GetInterface()->GetUserPrefix() + GetName().Mid(4); else csName = g_pclInterface->GetInterface()->GetUserPrefix() + GetName(); // rename actor while (fn_eRename(csName) != E_mc_None) csName = csName + "1"; g_pclInterface->GetInterface()->SetLoadingWorld(bIsLoadingWorld); } //ENDANNECY Shaitan RenameAlways } //Removes from hierarchy ERROR_VERIFY( g_pclInterface->GetInterface()->fn_bInsertObjectInHierarchy(m_pub_fn_pclGetSuperObject(), g_pclInterface->GetInterface()->GetSpecificInterface()->GetDynamicRoot(), FALSE) ); } } } } //****************************************************************************** BOOL CPA_Actor::m_fn_bIsAnAlways() { return m_bIsAnAlways; } //****************************************************************************** BOOL CPA_Actor::m_fn_bCanBeAnAlways() { if ( m_fn_bIsTheCurrentMotorCamera() || m_fn_bIsAPrincipalActor() /*|| m_fn_bIsTheWorldActor()*/ /* || m_fn_bIsAGenDoor()*/ ) return FALSE; if (!g_pclInterface->GetInterface()->fn_bIsLoadingWorld()) { EdActors_EditorActorModel * pModel = m_fn_pclGetModel()->m_fn_pclGetEditorModel(); EdActors_EditorActorInstance * pInstance; POSITION pos = pModel->m_clInstancesList.GetHeadPosition(); while (pos != NULL) { pInstance = pModel->m_clInstancesList.GetNext(pos); if (pInstance->m_pclActor->m_fn_bIsAnAlways() && (pInstance->m_pclActor != this)) return FALSE; } } return TRUE; } //****************************************************************************** //Get/Set for pointer on the SO isolated before engine mode //Only useful for GenDoors type Actors //****************************************************************************** CPA_SuperObject *CPA_Actor::m_fn_pclGetIsolatedSuperObject() { ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Gets an isolated SuperObject", "CPA_Actor::m_fn_pclGetIsolatedSuperObject(...)", E_ERROR_GRAVITY_FATAL, "Actor must be an Instance, but is a Model"); ERROR_ASSERT( m_fn_bIsAnInstance() ); return m_pclIsolatedSuperObject; } //****************************************************************************** void CPA_Actor::m_fn_vSetIsolatedSuperObject(CPA_SuperObject *pclNewIsolatedSO) { ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Sets an isolated SuperObject", "CPA_Actor::m_fn_vSetIsolatedSuperObject(...)", E_ERROR_GRAVITY_FATAL, "Actor must be an Instance, but is a Model"); ERROR_ASSERT( m_fn_bIsAnInstance() ); m_pclIsolatedSuperObject = pclNewIsolatedSO; } //****************************************************************************** void CPA_Actor::m_fn_vMakeGenDoor(BOOL bIsAGenDoor /*= TRUE*/) { m_bIsAGenDoor = bIsAGenDoor; } //****************************************************************************** BOOL CPA_Actor::m_fn_bIsAGenDoor() { return m_bIsAGenDoor; } //Always active //****************************************************************************** BOOL CPA_Actor::m_pub_fn_bIsAlwaysActive() { return m_pri_bIsAlwaysActive; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetAlwaysActive(BOOL _bAlwaysActive, BOOL _bIsLoading /*= FALSE*/) { m_pri_bIsAlwaysActive = _bAlwaysActive; //Notifies Level if ( !_bIsLoading ) { //Updates Motor if ( m_pri_bIsAlwaysActive ) fn_vAddCharacterInAlwaysActiveCharacterList(m_pub_fn_hGetMotorSuperObject()); else fn_vRemoveCharacterFromAlwaysActiveCharacterList(m_pub_fn_hGetMotorSuperObject()); //Notifies g_pclInterface->m_clDocument.m_fn_vNotifyLevel(this, TRUE); } } // ANNECY MT - 19/11/98 { //In all SubMaps //****************************************************************************** BOOL CPA_Actor::m_pub_fn_bIsInAllSubMaps() { return m_pri_bIsInAllSubMaps; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetInAllSubMaps(BOOL _bInAllSubMaps, BOOL _bIsLoading /*= FALSE*/) { m_pri_bIsInAllSubMaps = _bInAllSubMaps; //Notifies Level if ( !_bIsLoading ) { //Updates Motor fn_vStdGameSetInAllSubMaps( M_GetMSHandle(m_pub_fn_hGetMotorSuperObject(), StandardGame) , m_pri_bIsInAllSubMaps); //Notifies g_pclInterface->m_clDocument.m_fn_vNotifyLevel(this, TRUE); } } // END ANNECY MT } //****************************************************************************** BOOL CPA_Actor::m_fn_bIsTheCurrentMotorCamera() { // struct GLI_tdstCamera_ *p_stCamera; return ( CAM_fn_hGetActiveCamera(CAM_e_MainViewport) == m_pub_fn_hGetMotorSuperObject() ); } //****************************************************************************** BOOL CPA_Actor::m_fn_bIsAPrincipalActor() { return ( MC_fn_ucIsCharacterInMainCharacterList(m_pub_fn_hGetMotorSuperObject()) == 1 ); } //****************************************************************************** /*BOOL CPA_Actor::m_fn_bIsTheWorldActor() { EdActors_ActorMiniStructure *pclWorldAMS = m_fn_pclGetEditorActor()->m_clListOfAMSLists.m_fn_pclGetAMSFromName("World"); if ( pclWorldAMS != NULL ) return (pclWorldAMS->m_fn_bIsAllocated()); else return FALSE; }*/ //****************************************************************************** void CPA_Actor::m_pub_fn_vAddChildsFromEngineChilds() { ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Adding childs to Actor, from engine objects", "CPA_Actor::m_pub_fn_vAddChildsFromEngineChilds(...)", E_ERROR_GRAVITY_FATAL, "Actor must be an Instance, but is a Model"); ERROR_ASSERT( m_fn_bIsAnInstance() ); //Gets the motor SuperObject's childs, and creates the associated Editor objects CPA_SuperObject *pclEdSo = m_pub_fn_pclGetSuperObject(); ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Adding childs to Actor, from engine objects", "CPA_Actor::m_pub_fn_vAddChildsFromEngineChilds(...)", E_ERROR_GRAVITY_FATAL, "Actor has no Editor Super Object"); ERROR_ASSERT( pclEdSo != NULL ); //To respect Animation hierarchy m_pri_fn_vBuildChildOfOneLevel(pclEdSo); } //****************************************************************************** void CPA_Actor::m_pri_fn_vBuildChildOfOneLevel(CPA_SuperObject *_pclEditorSoFather) { HIE_tdxHandleToSuperObject hMotorSOFather = (HIE_tdxHandleToSuperObject)_pclEditorSoFather->GetStruct(); long c_lI; HIE_tdxHandleToSuperObject hChild; HIE_M_ForEachChildOf(hMotorSOFather, hChild, c_lI) { CPA_SuperObject *pclNewModule = NULL; if ( hChild->ulTypeOfLinkedObject == HIE_C_ulPO ) { POInterface *p_oPODLL = (POInterface *)GetMainWorld()->GetObjectDLLWithName(C_szDLLPhysicalObjectName); ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Adding a module child to Actor, from engine objects", "CPA_Actor::m_pri_fn_vBuildChildOfOneLevel(...)", E_ERROR_GRAVITY_FATAL, "Physical Objects DLL has not been found"); ERROR_ASSERT( p_oPODLL != NULL ); pclNewModule = p_oPODLL->GetNewEditorInstance( hChild ); pclNewModule->SetTypeSO(C_Protected); } else if ( hChild->ulTypeOfLinkedObject == HIE_C_ulSuperObject ) { pclNewModule = g_pclInterface->GetInterface()->GetNewSuperObject( hChild, E_ss_NoSave, C_Protected, "", ""); } if ( pclNewModule != NULL ) { //Adds graphical SuperObject as Actor's child _pclEditorSoFather->AddTail(pclNewModule, FALSE); //Indicates that Module is Actor's property //Modified by YB for Alexis (31/10/97) pclNewModule->SetSuperObjectOwner(m_pub_fn_pclGetSuperObject()); //pclNewModule->SetSuperObjectOwner(_pclEditorSoFather); pclNewModule->SetEditProtected(TRUE); //Recursively adding curent father's childs m_pri_fn_vBuildChildOfOneLevel(pclNewModule); } } } //****************************************************************************** void CPA_Actor::m_pub_fn_vAddChildsForGenDoors() { ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Adding childs to Actor, for a Gen Doors type object", "CPA_Actor::m_pub_fn_vAddChildsForGenDoors(...)", E_ERROR_GRAVITY_FATAL, "Actor must be an Instance, but is a Model"); ERROR_ASSERT( m_fn_bIsAnInstance() ); //Loads the ".MOD" CString csModFileName = ((EdActors_EditorActorModel *)m_fn_pclGetModel()->m_fn_pclGetEditorActor())->m_fn_csGetBitmapName(); csModFileName = csModFileName.Left(csModFileName.GetLength() - 3) + "mod"; csModFileName = CString("EDT_Data\\") + g_pclInterface->m_clDocument.m_csModelsBitmapsPathForGenDoors + csModFileName; //Loads the motor geometric object SCR_tdst_Cxt_Values *p_stValues; p_stValues = SCR_fnp_st_RdL0_AnalyseSection((char *)LPCTSTR(csModFileName), SCR_CDF_uw_Anl_Normal); GLI_tdstGeometricInfo *p_xGeometricInFile = (GLI_tdstGeometricInfo *)p_stValues->a_ulValues[0]; void *p_vMotorGeometricModuleLoaded = (void *)p_xGeometricInFile->hObject; //Creates the editor Object and SO CPA_ObjectDLLBase *p_cl3DGeomDLL = GetMainWorld()->GetObjectDLLWithName(C_szDLLGeometryName); ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Adding childs to Actor, for a Gen Doors type object", "CPA_Actor::m_pub_fn_vAddChildsForGenDoors(...)", E_ERROR_GRAVITY_FATAL, "3DGeom DLL can't be found"); ERROR_ASSERT( p_cl3DGeomDLL != NULL ); ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Adding childs to Actor, for a Gen Doors type object", "CPA_Actor::m_pub_fn_vAddChildsForGenDoors(...)", E_ERROR_GRAVITY_FATAL, "The motor Geometric object for a Gen Door is not correct"); ERROR_ASSERT( p_vMotorGeometricModuleLoaded != NULL ); long lReturnedValue = p_cl3DGeomDLL->OnQueryAction( g_pclInterface, (WPARAM)C_uiCreateGeometricObject, (LPARAM)p_vMotorGeometricModuleLoaded); Geometry3D *pclGeometricObject = (Geometry3D *)lReturnedValue; ERROR_PREPARE_M(g_c_csActorModuleNameForErrors, "Adding childs to Actor, for a Gen Doors type object", "CPA_Actor::m_pub_fn_vAddChildsForGenDoors(...)", E_ERROR_GRAVITY_FATAL, "The Geometric object for a Gen Door is not correctly loaded"); ERROR_ASSERT( pclGeometricObject != NULL ); // pclGeometricObject->fn_bSetResponsibilityLevel(CPA_NoModif); CPA_SuperObject *pclNewModule = g_pclInterface->GetInterface()->GetNewSuperObject(E_ss_NoSave, C_Protected, "", ""); pclNewModule->SetObject(pclGeometricObject); CPA_SuperObject *pclEdSo = m_pub_fn_pclGetSuperObject(); //Adds SuperObject as Actor's child pclEdSo->AddTail(pclNewModule/*, FALSE*/); //Indicates that Module is Actor's property pclNewModule->SetSuperObjectOwner(pclEdSo); pclNewModule->SetEditProtected(TRUE); //Internal m_fn_vSetIsolatedSuperObject(pclNewModule); } //****************************************************************************** //To remove editor childs void CPA_Actor::m_pub_fn_vRemoveAllEditorChilds() { //Inits the recursive suppression m_pri_fn_vRemoveAllChildsForOneSO(m_pclSuperObject); } //****************************************************************************** //To remove (recursively) editor childs of one SuperObject void CPA_Actor::m_pri_fn_vRemoveAllChildsForOneSO(CPA_SuperObject *_pclEditorSoFather) { //Removes all childs... CPA_SuperObject *pclCurrentEditorChild = _pclEditorSoFather->GetSuperObjectFirstChild(); CPA_SuperObject *pclNextEditorChild = pclCurrentEditorChild; while ( pclNextEditorChild != NULL ) { //Gets next before Isolate pclNextEditorChild = _pclEditorSoFather->GetSuperObjectNextChild(pclCurrentEditorChild); //Removes childs m_pri_fn_vRemoveAllChildsForOneSO(pclCurrentEditorChild); //Removes from Editor SO Childs pclCurrentEditorChild->Isolate(FALSE); pclCurrentEditorChild->fn_bUnValidate(); pclCurrentEditorChild = pclNextEditorChild; } } //****************************************************************************** //To compare the two hierarchies (motor and editor) when back from motor mode // returns TRUE only if hierarchies are the same BOOL CPA_Actor::m_pub_fn_bCompareEditorAndMotorChilds() { //Inits recursive comparison return ( m_pri_fn_bCompareOneLevelOfEditorAndMotorChilds(m_pclSuperObject)); } //****************************************************************************** //To compare (recursively) editor and motor childs of ONE SuperObject BOOL CPA_Actor::m_pri_fn_bCompareOneLevelOfEditorAndMotorChilds(CPA_SuperObject *_pclFatherSO) { BOOL bReturn = TRUE; HIE_tdxHandleToSuperObject hMotorSO = (HIE_tdxHandleToSuperObject)_pclFatherSO->GetStruct(); CPA_SuperObject *pclCurrentEditorChild; long c_lI; HIE_tdxHandleToSuperObject hMotorChild; HIE_tdxHandleToSuperObject hEditorChild; pclCurrentEditorChild = _pclFatherSO->GetSuperObjectFirstChild(); HIE_M_ForEachChildOf(hMotorSO, hMotorChild, c_lI) { //Compares to Editor SO if ( pclCurrentEditorChild != NULL ) { hEditorChild = (HIE_tdxHandleToSuperObject)pclCurrentEditorChild->GetStruct(); if ( ( hEditorChild != hMotorChild ) || ( hMotorChild->ulTypeOfLinkedObject != pclCurrentEditorChild->GetObjectType() ) ) //At least one child is different bReturn = FALSE; } else //There are more childs for Motor Actor bReturn = FALSE; bReturn = ( bReturn && m_pri_fn_bCompareOneLevelOfEditorAndMotorChilds(pclCurrentEditorChild) ); pclCurrentEditorChild = _pclFatherSO->GetSuperObjectNextChild(pclCurrentEditorChild); } if ( pclCurrentEditorChild != NULL ) //There are more childs in Editor SO bReturn = FALSE; return bReturn; } //****************************************************************************** BOOL CPA_Actor::m_pub_fn_bCanBeRenamed() { return ( /*( !m_fn_bIsAModel() ) //No Model can be renamed &&*/ ( !m_fn_bIsTheCurrentMotorCamera() ) && ( !m_fn_bIsAPrincipalActor() ) /*&& ( !m_fn_bIsTheWorldActor() )*/ ); } //Object Tables //****************************************************************************** CTL_Editor_EnumDescriptor *CPA_Actor::m_pub_fn_pclGetEnumDescriptorForObjectsTables() { return m_fn_pclGetEditorActor()->m_pub_fn_pclGetEnumDescriptorForObjectsTables(); } //****************************************************************************** EditorObjectTable *CPA_Actor::m_pub_fn_pclGetCurrentObjectTable() { return m_pri_pclCurrentObjectTable; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetCurrentObjectTable(EditorObjectTable *pclNewOT) { m_pri_pclCurrentObjectTable = pclNewOT; } //****************************************************************************** EditorObjectTable *CPA_Actor::m_pub_fn_pclGetInitialObjectTable() { return m_pri_pclInitialObjectTable; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetInitialObjectTable(EditorObjectTable *pclNewOT) { // Shaitan => optimisation lists in the level // set modification flag in the corresponding family if (m_pri_pclInitialObjectTable && (pclNewOT != m_pri_pclInitialObjectTable)) ((CPA_Family *) pclNewOT->GetOwner())->mfn_vSetModifiedPOList(); // End Shaitan => optimisation lists in the level m_pri_pclInitialObjectTable = pclNewOT; } //****************************************************************************** void CPA_Actor::m_pub_fn_vConstructEnumDescriptorForObjectsTables() { if ( m_pub_fn_pclGetFamily() != NULL ) { ERROR_ASSERT(m_pub_fn_pclGetEnumDescriptorForObjectsTables() != NULL); //First adds the OT which has the Family's name... short wIndex; BOOL bFound = FALSE; EditorObjectTable *pclCurrentOT; POSITION pos = m_pub_fn_pclGetFamily()->m_oListOfObjectTables.GetHeadPosition(); while ( (pos != NULL) && (!bFound) ) { pclCurrentOT = m_pub_fn_pclGetFamily()->m_oListOfObjectTables.GetNext(pos); //Searches for Family name CString csOTName = pclCurrentOT->GetName(); wIndex = csOTName.Find('.'); if ( wIndex != -1 ) csOTName = csOTName.Left(wIndex); bFound = ( csOTName.CompareNoCase(m_pub_fn_pclGetFamily()->GetName()) == 0 ); } if ( bFound ) m_pub_fn_pclGetEnumDescriptorForObjectsTables()->m_fn_pclAddElement(pclCurrentOT->GetName(), (long)pclCurrentOT->GetData()); //...then adds the other OT pos = m_pub_fn_pclGetFamily()->m_oListOfObjectTables.GetHeadPosition(); while ( pos != NULL ) { pclCurrentOT = m_pub_fn_pclGetFamily()->m_oListOfObjectTables.GetNext(pos); //Searches for Family name CString csOTName = pclCurrentOT->GetName(); wIndex = csOTName.Find('.'); if ( wIndex != -1 ) csOTName = csOTName.Left(wIndex); if ( csOTName.CompareNoCase(m_pub_fn_pclGetFamily()->GetName()) != 0 ) m_pub_fn_pclGetEnumDescriptorForObjectsTables()->m_fn_pclAddElement(pclCurrentOT->GetName(), (long)pclCurrentOT->GetData()); } //Add a reference for NULL Object Table if ( m_pub_fn_pclGetEnumDescriptorForObjectsTables()->GetCount() == 0 ) m_pub_fn_pclGetEnumDescriptorForObjectsTables()->m_fn_pclAddElement("No Object Table", 0L); } } //Action //****************************************************************************** CPA_Action *CPA_Actor::m_pub_fn_pclGetCurrentAction() { return m_pri_pclCurrentAction; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetCurrentAction(CPA_Action *_pclNewAction) { m_pri_pclCurrentAction = _pclNewAction; } //****************************************************************************** CPA_Action *CPA_Actor::m_pub_fn_pclGetInitialAction() { return m_pri_pclInitialAction; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetInitialAction(CPA_Action *_pclNewAction) { // Shaitan => optimisation lists in the level // set modification flag in the corresponding family if (m_pri_pclInitialAction && (_pclNewAction != m_pri_pclInitialAction)) ((CPA_Family *) _pclNewAction->GetOwner())->mfn_vSetModifiedStateList(); // End Shaitan => optimisation lists in the level m_pri_pclInitialAction = _pclNewAction; } //State //****************************************************************************** CPA_State *CPA_Actor::m_pub_fn_pclGetCurrentState() { return m_pri_pclCurrentState; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetCurrentState(CPA_State *_pclNewState) { m_pri_pclCurrentState = _pclNewState; if ( ( m_fn_bIsAnInstance() ) && ( _pclNewState != NULL ) && ( !(g_pclInterface->GetInterface()->fn_bIsLoadingWorld()) ) ) { tdxHandleToState hDefaultState = (tdxHandleToState)_pclNewState->GetData(); if ( ( hDefaultState != NULL ) && ( M_bEditorsActive() ) ) { fn_v3dDataSetCurrentState(M_GetMSHandle(m_pub_fn_hGetMotorSuperObject(), 3dData), hDefaultState); // PLA_fn_vInitNewState( m_pub_fn_hGetMotorSuperObject(), // hDefaultState); } } } //****************************************************************************** CPA_State *CPA_Actor::m_pub_fn_pclGetInitialState() { return m_pri_pclInitialState; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetInitialState(CPA_State *_pclNewState, BOOL _bMustNotifyLevel /*= FALSE*/) { m_pri_pclInitialState = _pclNewState; //Notifies Level when initial state has been changed if ( ( _bMustNotifyLevel ) && ( m_fn_bIsAnInstance() ) && ( !(g_pclInterface->GetInterface()->fn_bIsLoadingWorld()) ) ) g_pclInterface->m_clDocument.m_fn_vNotifyLevel(this); } //****************************************************************************** void CPA_Actor::m_pub_fn_vUpdateObjectTablesList(EditorObjectTable *pclOT /* NULL*/) { if ( pclOT != NULL ) { CTL_Editor_EnumElement *pclCurrentElement; POSITION pos = m_pub_fn_pclGetEnumDescriptorForObjectsTables()->GetHeadPosition(); while ( pos != NULL ) { pclCurrentElement = m_pub_fn_pclGetEnumDescriptorForObjectsTables()->GetNext(pos); if ( pclCurrentElement->m_pub_fn_csGetElementName() == pclOT->GetName() ) pclCurrentElement->m_pub_fn_vSetValue((long)pclOT->GetData()); } } } //****************************************************************************** HIE_tdxHandleToSuperObject CPA_Actor::m_pub_fn_hGetMotorSuperObject() { ERROR_ASSERT( m_fn_bIsAnInstance() ); if ( m_pclSuperObject != NULL ) return (HIE_tdxHandleToSuperObject)m_pclSuperObject->GetData(); else { //Tries to get Motor Super Object from Motor data MS_tdxHandleToStandardGame h_StdGame = ((struct tdstEngineObject_ *)GetData())->h_StandardGame; HIE_tdxHandleToSuperObject hHandleToReturn = fn_h_StandardGameGetSuperObject(h_StdGame); return hHandleToReturn; } } //****************************************************************************** CPA_SuperObject *CPA_Actor::m_pub_fn_pclGetSuperObject() { return m_pclSuperObject; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetSuperObject(CPA_SuperObject *pclNewSO) { m_pclSuperObject = pclNewSO; } //****************************************************************************** CPA_Family *CPA_Actor::m_pub_fn_pclGetFamily() { return m_pri_pclFamily; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetFamily(CPA_Family *pclNewFamily) { if ( ( m_pri_pclFamily == NULL ) && ( pclNewFamily != NULL ) ) { m_pri_pclFamily = pclNewFamily; //For a Model, sets the Family as Model's owner if ( !m_fn_bIsAnInstance() ) fn_bSetOwner((CPA_SaveObject *)pclNewFamily); //For Object Tables edition if ( pclNewFamily->fn_bIsAvailable() ) m_pub_fn_vConstructEnumDescriptorForObjectsTables(); //Updates section name SetReferencedSectionName(m_pri_fn_csComputeReferencedSectionName()); if ( m_pclSectionSubObject != NULL ) m_pclSectionSubObject->SetReferencedSectionName(m_pri_fn_csComputeReferencedFileName()); } } /*//****************************************************************************** //Returns the name of a Designer Variable, knowing its ID // ... For IAD ... CString CPA_Actor::m_pub_fn_csGetDsgVarNameFromID(long _lID) { //-----------------IR------------------------- ERROR_ASSERT( m_fn_bIsAnInstance() ); return m_fn_pclGetModel()->m_fn_pclGetEditorModel()->m_pclBrain->m_fn_csGetDsgVarName(_lID); #else return "Error in OAc (-->YB)"; //-------------------------------------------- } //****************************************************************************** //Displays the IA editor with the good behaviour // ... For IAD ... void CPA_Actor::m_pub_fn_vShowBehaviour(struct tdstNodeInterpret_ *_pstNode) { //-----------------IR------------------------- ERROR_ASSERT( m_fn_bIsAnInstance() ); m_fn_pclGetModel()->m_fn_pclGetEditorModel()->m_pclBrain->m_fn_vShowBehaviour(_pstNode); //-------------------------------------------- }*/ //****************************************************************************** CPA_tdoNameList *CPA_Actor::m_pub_fn_pclGetNameList(CString _csName) { return m_fn_pclGetEditorActor()->m_fn_p_oGetNameList(_csName); } //****************************************************************************** BOOL CPA_Actor::m_pub_fn_bCanBeInstantiated() { ERROR_ASSERT( m_fn_bIsAModel() ); return ( TRUE/*!m_fn_bIsTheWorldActor()*/ ); } //****************************************************************************** BOOL CPA_Actor::m_pub_fn_bIsCommon() { ERROR_ASSERT( m_fn_bIsAnInstance() ); return m_pri_bIsCommon; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetCommon(BOOL _bCommon /*= TRUE*/, BOOL _bIsLoading /*= FALSE*/) { ERROR_ASSERT( m_fn_bIsAnInstance() ); if ( m_pri_bIsCommon != _bCommon ) { //Notifies previous Section if ( !_bIsLoading ) fn_vNotifyUnSave(); //Changes section name m_pri_bIsCommon = _bCommon; if ( m_pclSectionSubObject != NULL ) m_pclSectionSubObject->SetReferencedSectionName(m_pri_fn_csComputeReferencedFileName()); fn_vUpdateSectionName(); //Notifies new Section if ( !_bIsLoading ) fn_vNotifySave(); if ( !_bIsLoading ) { g_pclInterface->m_clDocument.m_fn_vNotifyLevel(this, TRUE); //An actor which is not in Common cannot be in Fix if ( !m_pri_bIsCommon ) { if ( m_pub_fn_bIsInFix() ) m_pub_fn_vSetInFix(FALSE); } } } } // //****************************************************************************** BOOL CPA_Actor::m_pub_fn_bIsInFix() { ERROR_ASSERT( m_fn_bIsAnInstance() ); return m_pri_bIsInFix; } //****************************************************************************** void CPA_Actor::m_pub_fn_vSetInFix(BOOL _bIsInFix /*= TRUE*/, BOOL _bIsLoading /*= FALSE*/) { ERROR_ASSERT( m_fn_bIsAnInstance() ); if ( m_pri_bIsInFix != _bIsInFix ) { //Changes and notifies new section m_pri_bIsInFix = _bIsInFix; //Notifies FIX file if ( !_bIsLoading ) g_pclInterface->m_clDocument.m_fn_vNotifyFixFile(); } } //****************************************************************************** //Returns the number of Instances of a Model, and -1 for an Instance long CPA_Actor::m_pub_fn_lGetNumberOfInstances() { long lValueToReturn = -1; if ( m_fn_bIsAModel() ) lValueToReturn = m_fn_pclGetEditorModel()->m_clInstancesList.GetCount(); return lValueToReturn; } //****************************************************************************** //Checks Model before Instanciation BOOL CPA_Actor::m_pub_fn_bCheckModelForInstanciation() { BOOL bReturn = TRUE; if ( m_fn_bIsAModel() ) { if ( !m_fn_bIsAGenDoor() ) { CString csMessage; CString csAction = "Instanciation of Model '"; csAction += GetName() + "'\n"; //Checks the Initial Action of the Model if ( m_pub_fn_pclGetInitialAction() == NULL ) { csMessage = csAction + "This Model has no Initial Action !\n(Check this in Group_1 >> 3dData MS)\nDo you want to continue anyway ?"; EdActors_QuestionDialog QuestionDial(&g_oBaseFrame, csMessage); bReturn = ( QuestionDial.DoModal() == IDYES ); } //Checks the Initial state of the Model else { if ( m_pub_fn_pclGetInitialAction()->m_p_oDefaultState == NULL ) { csMessage = csAction + "This Model has no Initial State !\n(Check this in Group_1 >> 3dData MS)\nDo you want to continue anyway ?"; EdActors_QuestionDialog QuestionDial(&g_oBaseFrame, csMessage); bReturn = ( QuestionDial.DoModal() == IDYES ); } } //Checks the Initial Objects Table of the Model if ( bReturn ) { if ( m_pub_fn_pclGetInitialObjectTable() == NULL ) { csMessage = csAction + "This Model has no Initial Object Table !\n(Check this in Group_1 >> 3dData MS)\nDo you want to continue anyway ?"; EdActors_QuestionDialog QuestionDial(&g_oBaseFrame, csMessage); bReturn = ( QuestionDial.DoModal() == IDYES ); } } } } else bReturn = FALSE; return bReturn; } //****************************************************************************** //Indicates whether this Actor must be saved or not BOOL CPA_Actor::m_pub_fn_bHasBeenModified() { return m_pri_bHasBeenModified; } //****************************************************************************** //To re-init the Actor as if it was in its intial state void CPA_Actor::m_pub_fn_vReInitActor() { } //****************************************************************************** CString CPA_Actor::fn_csComputeReferencedSectionName(const CString csNewName) { return m_pri_fn_csComputeReferencedSectionName(csNewName); } //****************************************************************************** CString CPA_Actor::m_pri_fn_csComputeReferencedSectionName(CString csName /*= ""*/, CPA_Family *pclFamily /*= NULL*/) { CString csUsedName = ( csName.IsEmpty() ) ? GetName() : csName; CPA_Family *pclUsedFamily = ( pclFamily == NULL ) ? m_pub_fn_pclGetFamily() : pclFamily; CString csFamilyName = ( pclUsedFamily == NULL ) ? "No_Family" : pclUsedFamily->GetName(); CString csFileName; if ( m_fn_bIsAnInstance() ) csFileName = csUsedName + g_csInstanceExtension; else csFileName = csUsedName + g_csModelExtension; CString csTrueFileName; if ( m_fn_bIsAnInstance() ) { if ( m_pub_fn_bIsCommon() ) csTrueFileName = CString("_Common\\Families\\") + csFamilyName + s_g_c_csAntiSlash + m_fn_pclGetModel()->GetName() + s_g_c_csAntiSlash + C_ScriptCharacterDirectory + s_g_c_csAntiSlash + csFileName; else csTrueFileName = g_pclInterface->m_clDocument.m_fn_csGetLevelName() + s_g_c_csAntiSlash + CString("Families\\") + csFamilyName + s_g_c_csAntiSlash + m_fn_pclGetModel()->GetName() + s_g_c_csAntiSlash + C_ScriptCharacterDirectory + s_g_c_csAntiSlash + csFileName; } else csTrueFileName = CString("_Common\\Families\\") + csFamilyName + s_g_c_csAntiSlash + csUsedName + s_g_c_csAntiSlash + csFileName; CString csAction; if ( m_fn_bIsAnInstance() ) csAction = C_SectionOneCharacters; else csAction = g_c_csActorScriptModelSectionName; CString csReferencedSectioName = csTrueFileName + '^' + csAction + ':' + csUsedName; return csReferencedSectioName; } //****************************************************************************** CString CPA_Actor::m_pri_fn_csComputeCompleteSectionName(CString csName /*= ""*/, CPA_Family *pclFamily /*= NULL*/) { CString csUsedName = ( csName.IsEmpty() ) ? GetName() : csName; CPA_Family *pclUsedFamily = ( pclFamily == NULL ) ? m_pub_fn_pclGetFamily() : pclFamily; CString csFamilyName = ( pclUsedFamily == NULL ) ? "No_Family" : pclUsedFamily->GetName(); CString csFileName; if ( m_fn_bIsAnInstance() ) csFileName = csUsedName + g_csInstanceExtension; else csFileName = csUsedName + g_csModelExtension; CString csTrueFileName; if ( m_fn_bIsAnInstance() ) csTrueFileName = g_pclInterface->m_clDocument.m_pub_csLevelDataPath + m_pri_fn_csComputeReferencedSectionName(csUsedName, pclUsedFamily); else csTrueFileName = g_pclInterface->m_clDocument.m_pub_csCommonDataPath + m_pri_fn_csComputeReferencedSectionName(csUsedName, pclUsedFamily); CString csAction; if ( m_fn_bIsAnInstance() ) csAction = C_SectionOneCharacters; else csAction = g_c_csActorScriptModelSectionName; CString csCompleteSectioName = csTrueFileName + '^' + csAction + ':' + csUsedName; return csCompleteSectioName; } //****************************************************************************** CString CPA_Actor::m_pri_fn_csComputeCompleteFileName(void) { CString csFileName = m_pri_fn_csComputeCompleteSectionName(); //Extracts File Name short wIndex = csFileName.Find('^'); if ( wIndex != -1 ) csFileName = csFileName.Left(wIndex); return csFileName; } //****************************************************************************** CString CPA_Actor::m_pri_fn_csComputeReferencedFileName(void) { CString csFileName = m_pri_fn_csComputeReferencedSectionName(); //Extracts File Name short wIndex = csFileName.Find('^'); if ( wIndex != -1 ) csFileName = csFileName.Left(wIndex); return csFileName; } //For Save //****************************************************************************** void CPA_Actor::fn_vNotifySave(void) { if ( m_pclSectionSubObject != NULL ) { m_pclSectionSubObject->fn_vWriteSection(); if ( !m_pri_bHasBeenModified ) { m_pri_bHasBeenModified = TRUE; g_pclInterface->m_clDocument.m_pclActorsView->m_pub_fn_vUpdateActorNameForModif(this); } } } //****************************************************************************** void CPA_Actor::fn_vNotifyUnSave(void) { if ( m_pclSectionSubObject != NULL ) { m_pclSectionSubObject->fn_vDeleteSection(); if ( m_pri_bHasBeenModified ) { m_pri_bHasBeenModified = FALSE; g_pclInterface->m_clDocument.m_pclActorsView->m_pub_fn_vUpdateActorNameForModif(this); } } } //****************************************************************************** void CPA_Actor::fn_vNotifyRestore(void) { if ( m_pclSectionSubObject != NULL ) { m_pclSectionSubObject->fn_vRestoreSection(); if ( !m_pri_bHasBeenModified ) { m_pri_bHasBeenModified = TRUE; g_pclInterface->m_clDocument.m_pclActorsView->m_pub_fn_vUpdateActorNameForModif(this); } } } //****************************************************************************** void CPA_Actor::fn_vNotifyRename(void) { if ( m_pclSectionSubObject != NULL ) { m_pclSectionSubObject->fn_vRenameSection(m_pri_fn_csComputeReferencedFileName()); if ( !m_pri_bHasBeenModified ) { m_pri_bHasBeenModified = TRUE; g_pclInterface->m_clDocument.m_pclActorsView->m_pub_fn_vUpdateActorNameForModif(this); } } //Update of main section name SetReferencedSectionName(m_pri_fn_csComputeReferencedSectionName()); } //****************************************************************************** void CPA_Actor::s_m_fn_vCallBackSaveActor(SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction) { CPA_Actor *p_clActor = (CPA_Actor *)_p_vData ; switch ( _eAction ) { case SCR_EA_Ntfy_AddSection: case SCR_EA_Ntfy_AddOrModifySection: case SCR_EA_Ntfy_AddOrRebuildSection: case SCR_EA_Ntfy_RebuildSection: case SCR_EA_Ntfy_ModifySection: if ( p_clActor == NULL ) { //Saves Motor Level g_pclInterface->m_clDocument.m_fn_vSaveMotorLevel(_p_stFile, _p_szSectionName, _eAction); } else { //Saves Model if ( p_clActor->m_fn_bIsAModel() ) { //... p_clActor->m_fn_pclGetEditorActor()->m_fn_vSaveActor(_p_stFile); } else //For Instances, saves only motor Actor (in Motor File) { //Calls motor function g_pclInterface->m_clDocument.m_fn_vSaveMotorInstance(_p_stFile, p_clActor); } p_clActor->m_pclSectionSubObject->fn_vSectionSaved(); } break ; case SCR_EA_Ntfy_DeleteIfExists: case SCR_EA_Ntfy_DeleteSection: if ( p_clActor != NULL ) p_clActor->m_pclSectionSubObject->fn_vSectionDeleted(); } if ( p_clActor != NULL ) { p_clActor->m_pri_bHasBeenModified = FALSE; g_pclInterface->m_clDocument.m_pclActorsView->m_pub_fn_vUpdateActorNameForModif(p_clActor); } } //****************************************************************************** //Virtual functions //****************************************************************************** long CPA_Actor::GetDataType() { return HIE_C_ulActor; } //****************************************************************************** void *CPA_Actor::GetData() { return GetStruct(); } // Shaitan Correction { //****************************************************************************** void CPA_Actor::fn_vSetExistingSectionSubObject (BOOL bExist) { m_pclSectionSubObject->SetExistingSection(bExist); } //End Shaitan Correction } //BEGIN ROMTEAM Cristi Petrescu 98-05- /* CPA_EdIR_DebugInfo *CPA_Actor::m_fn_pGetDebugInfo (tdstNodeInterpret *_pstNode) { EdActors_EditorActorModel *pModel = m_fn_pclGetEditorModel (); ASSERT (pModel); CPA_EdIR_Brain *pBrain = pModel -> m_pclBrain; ASSERT (pBrain); return pBrain -> m_clDebugInfoList . m_fn_pclGetDebugInfo (_pstNode); }*/ //****************************************************************************** void CPA_Actor::m_fn_vMustBuildDebugInfo (BOOL bBuild) { CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName)); if(pclIADLL!=NULL) { tdstActorsIACom stCom; stCom.pvThis = this; stCom.pvData = & bBuild; pclIADLL -> OnQueryAction (g_pclInterface, C_uiAI_MustBuildDebugInfo, (long) (& stCom)); } } //****************************************************************************** CString CPA_Actor::m_fn_csGetBehaviourName (tdstNodeInterpret *_pstNode) { CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName)); if(pclIADLL!=NULL) { tdstActorsIACom stCom; stCom.pvThis = this; stCom.pvData = _pstNode; pclIADLL -> OnQueryAction (g_pclInterface, C_uiAI_GetBehaviourName, (long) (& stCom)); return stCom . csData; } return _T(""); } //****************************************************************************** void CPA_Actor::m_fn_vClearExecutedNodes (CString csBehaviourName) { CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName)); if(pclIADLL!=NULL) { tdstActorsIACom stCom; stCom.pvThis = this; stCom.pvData = & csBehaviourName; pclIADLL -> OnQueryAction (g_pclInterface, C_uiAI_ClearExecutedNodes, (long) (& stCom)); } } //****************************************************************************** void CPA_Actor::m_fn_vSetOneExecutedNode (tdstNodeInterpret *_pstNode) { CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName)); if(pclIADLL!=NULL) { tdstActorsIACom stCom; stCom.pvThis = this; stCom.pvData = _pstNode; pclIADLL -> OnQueryAction (g_pclInterface, C_uiAI_SetOneExecutedNode, (long) (& stCom)); } } //****************************************************************************** void CPA_Actor::m_fn_vShowBehaviour (tdstNodeInterpret *_pstNode) { CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName)); if(pclIADLL!=NULL) { tdstActorsIACom stCom; stCom.pvThis = this; stCom.pvData = _pstNode; pclIADLL -> OnQueryAction (g_pclInterface, C_uiAI_ShowBehaviourByEngineNode, (long) (& stCom)); } } //****************************************************************************** void CPA_Actor::m_fn_vShowBehaviour (CString csBehaviourName) { CPA_DLLBase *pclIADLL=(CPA_DLLBase*)(g_pclInterface->GetMainWorld()->GetToolDLLWithName(C_szDLLAIEditorName)); if(pclIADLL!=NULL) { tdstActorsIACom stCom; stCom.pvThis = this; stCom.pvData = & csBehaviourName; pclIADLL -> OnQueryAction (g_pclInterface, C_uiAI_ShowBehaviourByName, (long) (& stCom)); } } //END ROMTEAM Cristi Petrescu 98-05- //****************************************************************************** void CPA_Actor::m_fn_vSetModelDefaultValues (void) { EdActors_EditorActorModel * pclEditorModel; CTL_Editor_BooleanData * pclBooleanData; CTL_Editor_IntegerData * pclIntegerData; // check if it is a model if (!m_fn_bIsAModel()) return; pclEditorModel = m_fn_pclGetEditorModel(); // set default values for hit points pclIntegerData = (CTL_Editor_IntegerData *) pclEditorModel->m_fn_p_oFindDataByName("Initial_Hit_Points"); pclIntegerData->mfn_lSetCurrentValue (3); pclIntegerData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0); pclIntegerData = (CTL_Editor_IntegerData *) pclEditorModel->m_fn_p_oFindDataByName("Initial_Hit_Points_Max"); pclIntegerData->mfn_lSetCurrentValue (3); pclIntegerData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0); pclIntegerData = (CTL_Editor_IntegerData *) pclEditorModel->m_fn_p_oFindDataByName("Hit_Points_Max_Max"); pclIntegerData->mfn_lSetCurrentValue (3); pclIntegerData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0); // set default values for transparency zone pclIntegerData = (CTL_Editor_IntegerData *) pclEditorModel->m_fn_p_oFindDataByName("Transparency_Zone_Min"); pclIntegerData->mfn_lSetCurrentValue (20); pclIntegerData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0); pclIntegerData = (CTL_Editor_IntegerData *) pclEditorModel->m_fn_p_oFindDataByName("Transparency_Zone_Max"); pclIntegerData->mfn_lSetCurrentValue (30); pclIntegerData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0); // set default values for custom bits pclBooleanData = (CTL_Editor_BooleanData *) pclEditorModel->m_fn_p_oFindDataByName("Initial_CustomBit_1"); pclBooleanData->mfn_bSetCurrentState (TRUE); pclBooleanData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0); pclBooleanData = (CTL_Editor_BooleanData *) pclEditorModel->m_fn_p_oFindDataByName("Initial_CustomBit_13"); pclBooleanData->mfn_bSetCurrentState (TRUE); pclBooleanData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0); pclBooleanData = (CTL_Editor_BooleanData *) pclEditorModel->m_fn_p_oFindDataByName("Initial_CustomBit_22"); pclBooleanData->mfn_bSetCurrentState (TRUE); pclBooleanData->m_fn_vUpdateMotorData(CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER, 0); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : mfn_vSaveToINI // Date : 98-06 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void CPA_Actor::mfn_vSaveToINI () { if (!m_fn_bIsAModel()) return; CString csKeyValue = m_bHideVariable? "TRUE":"FALSE"; CString csINIFileName = M_GetMainApp()->m_csEditorDataPath + m_csINIFileName; WritePrivateProfileString (m_csHideVariableSection, GetName (), csKeyValue, csINIFileName); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : mfn_vLoadFromINI // Date : 98-06 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void CPA_Actor::mfn_vLoadFromINI () { if (!m_fn_bIsAModel()) return; char szKeyValue [10]; CString csINIFileName = M_GetMainApp()->m_csEditorDataPath + m_csINIFileName; GetPrivateProfileString (m_csHideVariableSection, GetName (), "FALSE", szKeyValue, sizeof (szKeyValue), csINIFileName); if (szKeyValue == CString ("TRUE")) m_bHideVariable = TRUE; else m_bHideVariable = FALSE; } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : mfn_bIsHideVarChecked // Date : 98-06 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL CPA_Actor::mfn_bIsHideVarChecked () { if (m_fn_bIsAModel()) return m_bHideVariable; else { CPA_Actor *pModel = m_fn_pclGetModel(); if (pModel) return pModel->mfn_bIsHideVarChecked (); else return FALSE; } } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : mfn_vCheckHideVar // Date : 98-06 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void CPA_Actor::mfn_vCheckHideVar (BOOL bHideVar) { if (m_fn_bIsAModel()) { m_bHideVariable = bHideVar; mfn_vSaveToINI (); } else { CPA_Actor *pModel = m_fn_pclGetModel(); if (pModel) pModel->mfn_vCheckHideVar (bHideVar); else TRACE0 ("This actor doesn't have a model!\n"); } } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : fn_eCheckValidity // Date : 98-06 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : // Author : Stegaru Cristian - CPA ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// tdeMissingCriteria CPA_Actor::fn_eCheckValidity (const CString csNewName) { tdeMissingCriteria eResult = CPA_SaveObject::fn_eCheckValidity (csNewName); if (eResult != E_mc_None) return eResult; // test here if the name is used for an unloaded always //CPA2 Stegaru Cristian 98-06 //check unicity against the UnloadedAlwyas object's list CPA_BaseObjectList * p_oBaseObjectList = GetEditor ()->GetBaseObjectList(g_c_csUnloadedAlwaysType); if (p_oBaseObjectList) { CPA_Interface *pInterface = GetEditor()->GetInterface(); long lNbObjects = p_oBaseObjectList->fn_lFindObjects(NULL, csNewName, g_c_csUnloadedAlwaysType); if (lNbObjects > 0) //name conflict return E_mc_CustomValidity; } // name is valid return E_mc_None; } //SHAITAN void CPA_Actor::mfn_vUpdateAIModel (AI_tdstAIModel *p_stAIModel) { CAR_EDIT_TDSTACTOR *p_tdstActor = (CAR_EDIT_TDSTACTOR *) GetStruct(); p_tdstActor->h_Brain->p_stMind->p_stAIModel = p_stAIModel; EdActors_ActorMiniStructure *pclModelMS = m_fn_pclGetEditorActor()->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))); } void CPA_Actor::mfn_vUpdateAllInstancesForFastC (void) { if (!m_fn_bIsAModel()) return; EdActors_EditorActorModel * pclEditorModel = m_fn_pclGetEditorModel(); // update model editor values CTL_Editor_Data * pclData = pclEditorModel->m_fn_p_oFindDataByName("FastC_Run"); pclData->m_fn_vGetMotorData(); pclData = pclEditorModel->m_fn_p_oFindDataByName("FastC_Index"); pclData->m_fn_vGetMotorData(); // update all instances editor values EdActors_EditorActorInstance *pclCurrentInstance; POSITION InstancesPos = pclEditorModel->m_clInstancesList.GetHeadPosition(); while ( InstancesPos != NULL ) { pclCurrentInstance = pclEditorModel->m_clInstancesList.GetNext(InstancesPos); pclData = pclCurrentInstance->m_fn_p_oFindDataByName("FastC_Run"); pclData->m_fn_vGetMotorData(); pclData = pclCurrentInstance->m_fn_p_oFindDataByName("FastC_Index"); pclData->m_fn_vGetMotorData(); } } //SHAITAN //****************************************************************************** //MakeAlways //****************************************************************************** CPA_MakeAlways::CPA_MakeAlways (EdActors_MyDocument *pDocument, CPA_List *pSOActors, BOOL bMakeAlways) : CPA_Modif (0, "Make Always", FALSE) { CPA_SuperObject *pSupObj; CPA_Actor *pActor; POSITION pos; m_pDocument = pDocument; m_bMakeAlways = bMakeAlways; // CPA2 ASilvescu 98-04-24 m_bIsCommon = FALSE; // End CPA2 ASilvescu 98-04-24 pos = pSOActors->GetHeadPosition(); while (pos) { pSupObj = pSOActors->GetNext(pos); pActor = (CPA_Actor *)pSupObj->GetObject(); m_lstActors.AddTail(pActor); } } CPA_MakeAlways::CPA_MakeAlways (EdActors_MyDocument *pDocument, CPA_Actor *pActor, BOOL bMakeAlways) : CPA_Modif (0, "Make Always", FALSE) { m_pDocument = pDocument; m_bMakeAlways = bMakeAlways; m_lstActors.AddTail(pActor); } CPA_MakeAlways::~CPA_MakeAlways (void) { } BOOL CPA_MakeAlways::Do (void) { CPA_Actor *pActor; POSITION pos = m_lstActors.GetHeadPosition(); while (pos) { pActor = m_lstActors.GetNext(pos); //Notifies Level m_pDocument->m_fn_vNotifyLevel(pActor, FALSE); // make always pActor->m_fn_vMakeAlways(m_bMakeAlways); // CPA2 ASilvescu 98-04-24 m_bIsCommon = pActor->m_pub_fn_bIsCommon(); pActor->m_pub_fn_vSetCommon(m_bMakeAlways); // End CPA2 ASilvescu 98-04-24 //Notifies Level m_pDocument->m_fn_vNotifyLevel(pActor, TRUE); // update dialog m_pDocument->m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList); } return TRUE; } BOOL CPA_MakeAlways::Undo (void) { CPA_Actor *pActor; POSITION pos = m_lstActors.GetHeadPosition(); while (pos) { pActor = m_lstActors.GetNext(pos); //Notifies Level m_pDocument->m_fn_vNotifyLevel(pActor, FALSE); // make always pActor->m_fn_vMakeAlways(!m_bMakeAlways); // CPA2 ASilvescu 98-04-24 pActor->m_pub_fn_vSetCommon(m_bIsCommon); // End CPA2 ASilvescu 98-04-24 //Notifies Level m_pDocument->m_fn_vNotifyLevel(pActor, TRUE); // update dialog m_pDocument->m_pclDialogList->fn_vUpdateSelection(E_lrm_ReinitList); } return TRUE; }