Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,113 @@
//
// Common functions for Object DLL capabilities
//
#include "stdafx.h"
#include "afxdllx.h"
#include "ACP_Base.h"
#include "..\Main\Inc\_EditID.h"
#include "_zInterf.hpp"
// List of all the instances of the dll
static CList<CPA_DLLBase * , CPA_DLLBase *> g_oListOfInstances; //private internal
//------------------------------------------------------------------------
// Global vars
static char *gs_p_szCPAVersion = C_szCPAVersion;
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
#ifdef DLL_ONLY_ONE_INSTANCE
static ZDx_Interface * gs_p_oZDxInterface = NULL;
#endif
//------------------------------------------------------------------------
// functions that are present in all DLL :
//------------------------------------------------------------------------
//========================================================================
// Get current CPA version
//========================================================================
extern "C" char __declspec(dllexport) *fn_p_szGetCPAVersion(void)
{
return gs_p_szCPAVersion;
}
//========================================================================
// Get type of this DLL
//========================================================================
extern "C" tdstDLLIdentity __declspec(dllexport) *fn_p_stGetDLLIdentity(void)
{
g_stZDxDllIdentity . eType = OBJECT_DLL;
g_stZDxDllIdentity . csName = C_szDLLZDxName;
g_stZDxDllIdentity . hModule = NULL;
g_stZDxDllIdentity . p_oListOfInstances = & g_oListOfInstances;
return & g_stZDxDllIdentity;
}
//========================================================================
// DLL int function
//========================================================================
extern "C" void __declspec(dllexport) fn_vInitDll(void)
{
new CDynLinkLibrary(extensionDLL);
}
//========================================================================
// DLL entry point
//========================================================================
extern "C" int __stdcall DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (!AfxInitExtensionModule(extensionDLL, hInstance))
return 0;
}
return 1;
}
//========================================================================
// Get the DLL
//========================================================================
extern "C" CPA_DLLBase __declspec(dllexport) *fn_p_oGetDLL(long lKey)
{
#ifdef DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
if (gs_p_oZDxInterface == NULL)
{
gs_p_oZDxInterface = new ZDx_Interface();
ASSERT(gs_p_oZDxInterface != NULL);
}
return gs_p_oZDxInterface;
break;
default:
return NULL;
}
#else //DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
return new ZDx_Interface();
break;
default:
return NULL;
}
#endif //DLL_ONLY_ONE_INSTANCE
}
//------------------------------------------------------------------------
// functions that are present in this type of DLL only :
//------------------------------------------------------------------------
#undef DLL_ONLY_ONE_INSTANCE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,657 @@
//*****************************************************************************
//* _zModif.hpp *
//*****************************************************************************
//* *
//* This file contains the definitions of the modif classes *
//* *
//*****************************************************************************
//* Author : Alexis Vaisse *
//*****************************************************************************
// "standard" include
#include "stdafx.h"
#include "ACP_Base.h"
#include "TFA.h" // Family dll include
#include "..\Main\Inc\_EditID.h"
#include "ITF.h"
// personal include
#include "_zModif.hpp"
#include "_zObject.hpp"
#include "_zInterf.hpp"
#include "_zWList1.hpp"
#include "_zWList2.hpp"
#include "_zWEdit.hpp"
#include "OGD.h" // 3dGeom dll include
#include "OAC.h" // Actors dll include
//-----------------------------------------------------------------------------
// class ZDx_Modif - constructor
//-----------------------------------------------------------------------------
ZDx_Modif::ZDx_Modif (ZDx_Object * _pZDxObject , char * ModifName)
: CPA_Modif (0 , ModifName , FALSE)
{
m_BackupName = NULL;
m_pBackupData = NULL;
m_bIsDoingUndo = FALSE;
SetZDxObject (_pZDxObject);
m_bFirstTime = TRUE;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - destructor
//-----------------------------------------------------------------------------
ZDx_Modif::~ZDx_Modif ()
{
if (m_BackupName) free (m_BackupName);
if (m_pBackupData) delete m_pBackupData;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - BackupSphereData
// Make a copy of all the parameters of a sphere ZDx object
//-----------------------------------------------------------------------------
void ZDx_Modif::BackupSphereData ()
{
tdstBackupDataForSphere * pBackupData = new tdstBackupDataForSphere;
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Sphere3D * pSphere = (Sphere3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
pBackupData -> stCenter = pSphere -> GetCenter ();
pBackupData -> Radius = pSphere -> GetRadius ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
m_pBackupData = pBackupData;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - BackupBoxData
// Make a copy of all the parameters of a box ZDx object
//-----------------------------------------------------------------------------
void ZDx_Modif::BackupBoxData ()
{
tdstBackupDataForBox * pBackupData = new tdstBackupDataForBox;
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Box3D * pBox = (Box3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
pBackupData -> stMinPoint = pBox -> GetMinPoint ();
pBackupData -> stMaxPoint = pBox -> GetMaxPoint ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
m_pBackupData = pBackupData;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - BackupPointData
// Make a copy of all the parameters of a point ZDx object
//-----------------------------------------------------------------------------
void ZDx_Modif::BackupPointData ()
{
tdstBackupDataForPoint * pBackupData = new tdstBackupDataForPoint;
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Point3D * pPoint = (Point3D *)((ZDx_Point *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
pBackupData -> stPoint = pPoint -> GetPoint ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
m_pBackupData = pBackupData;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - BackupConeData
// Make a copy of all the parameters of a cone ZDx object
//-----------------------------------------------------------------------------
void ZDx_Modif::BackupConeData ()
{
tdstBackupDataForCone * pBackupData = new tdstBackupDataForCone;
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Cone3D * pCone = (Cone3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
pBackupData -> stTopPoint = pCone -> GetTopPoint ();
pBackupData -> stBasePoint = pCone -> GetBasePoint ();
pBackupData -> Radius = pCone -> GetRadius ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
m_pBackupData = pBackupData;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - Set_ZDx_Object
// set the ZDx object which will be modified and make a copy of its
// actual parameters for the Undo
//-----------------------------------------------------------------------------
void ZDx_Modif::SetZDxObject (ZDx_Object * _pZDxObject)
{
if (m_bIsDoingUndo) return;
m_pZDxObject = _pZDxObject; // we keep a pointer to the ZDx object which will be modified
if (m_BackupName) free (m_BackupName);
m_BackupName = strdup (_pZDxObject -> GetZDxName ()); // we make a copy of the ZDx name
if (m_pBackupData) delete (m_pBackupData);
switch (_pZDxObject -> GetZDxGeometricType ()) // we make a copy of the data, depending of the type of the ZDx
{
case eSphere : BackupSphereData (); break;
case eBox : BackupBoxData (); break;
case ePoint : BackupPointData (); break;
case eCone : BackupConeData (); break;
default : ASSERT (0); break;
}
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - ExchangeBackupSphereData
// exchange the actual and backuped data for a ZDx of type sphere
//-----------------------------------------------------------------------------
void ZDx_Modif::ExchangeBackupSphereData ()
{
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Sphere3D * pSphere = (Sphere3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
tdstBackupDataForSphere * pBackupData = (tdstBackupDataForSphere *) m_pBackupData;
// exchange the center
MTH3D_tdstVector Center = pSphere -> GetCenter ();
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
pSphere -> SetCenter (& pBackupData -> stCenter);
//ENDROMTEAM WorldEditor (Cristi Petrescu)
pBackupData -> stCenter = Center;
// exchange the radius
GLI_tdxValue Radius = pSphere -> GetRadius ();
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
pSphere -> SetRadius (& pBackupData -> Radius);
//ENDROMTEAM WorldEditor (Cristi Petrescu)
pBackupData -> Radius = Radius;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - ExchangeBackupBoxData
// exchange the actual and backuped data for a ZDx of type box
//-----------------------------------------------------------------------------
void ZDx_Modif::ExchangeBackupBoxData ()
{
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Box3D * pBox = (Box3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
tdstBackupDataForBox * pBackupData = (tdstBackupDataForBox *) m_pBackupData;
// exchange the min and the max point
MTH3D_tdstVector MinPoint = pBox -> GetMinPoint ();
MTH3D_tdstVector MaxPoint = pBox -> GetMaxPoint ();
MTH3D_tdstVector Dummy = pBackupData -> stMinPoint;
pBox -> SetMinPoint (& Dummy);
Dummy = pBackupData -> stMaxPoint;
pBox -> SetMaxPoint (& Dummy);
Dummy = pBackupData -> stMinPoint;
pBox -> SetMinPoint (& Dummy);
pBackupData -> stMinPoint = MinPoint;
pBackupData -> stMaxPoint = MaxPoint;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - ExchangeBackupPointData
// exchange the actual and backuped data for a ZDx of type point
//-----------------------------------------------------------------------------
void ZDx_Modif::ExchangeBackupPointData ()
{
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Point3D * pPoint = (Point3D *)((ZDx_Point *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
tdstBackupDataForPoint * pBackupData = (tdstBackupDataForPoint *) m_pBackupData;
// exchange the position of the point
MTH3D_tdstVector Point = pPoint -> GetPoint ();
pPoint -> SetPoint (& pBackupData -> stPoint);
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
// if (m_pZDxObject -> GetZDxType () == eTestPoint)
// ANNECY AV CLEAN_MEC {
// ((ZDx_Point *) m_pZDxObject -> GetZDxShape ()) -> UpdateTestPointPosition ();
// END ANNECY AV }
//ENDROMTEAM WorldEditor (Cristi Petrescu)
pBackupData -> stPoint = Point;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - ExchangeBackupConeData
// exchange the actual and backuped data for a ZDx of type cone
//-----------------------------------------------------------------------------
void ZDx_Modif::ExchangeBackupConeData ()
{
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Cone3D * pCone = (Cone3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
tdstBackupDataForCone * pBackupData = (tdstBackupDataForCone *) m_pBackupData;
// exchange the top and base point
MTH3D_tdstVector BasePoint = pCone -> GetBasePoint ();
MTH3D_tdstVector TopPoint = pCone -> GetTopPoint ();
MTH3D_tdstVector Dummy = pBackupData -> stBasePoint;
pCone -> SetBasePoint (& Dummy);
Dummy = pBackupData -> stTopPoint;
pCone -> SetTopPoint (& Dummy);
Dummy = pBackupData -> stBasePoint;
pCone -> SetBasePoint (& Dummy);
pBackupData -> stBasePoint = BasePoint;
pBackupData -> stTopPoint = TopPoint;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - Undo
// we cancel the modification by taking the previous datas which were saved
// in fact, we exchange the old and the actual datas (for the Redo)
//-----------------------------------------------------------------------------
ZDx_Modif::Undo (BOOL _bRefreshWindow)
{
m_bIsDoingUndo = TRUE;
ZDx_Interface * pZDxInterface = (ZDx_Interface *) m_pZDxObject -> GetEditor ();
pZDxInterface -> IWillRefreshDisplay (C_lModifZDx);
// we exchange old and actual ZDx names if they are different
if (strcmp (m_pZDxObject -> GetZDxName () , m_BackupName) != 0)
{
char TempString [255];
strcpy (TempString , m_BackupName);
free (m_BackupName);
m_BackupName = strdup (m_pZDxObject -> GetZDxName ());
m_pZDxObject -> SetZDxName (TempString);
}
switch (m_pZDxObject -> GetZDxGeometricType ())
{
case eSphere : ExchangeBackupSphereData (); break;
case eBox : ExchangeBackupBoxData (); break;
case ePoint : ExchangeBackupPointData (); break;
case eCone : ExchangeBackupConeData (); break;
default: ASSERT (0); break;
}
// Refresh the edit window if needed
if (_bRefreshWindow)
{
/*
if (m_pZDxObject -> GetZDxType () == eBoundingVolume)
pZDxInterface -> GetList2Window () -> CreateBoundingVolume (pZDxInterface -> GetList2Window () -> GetActorSuperObject () , m_pZDxObject);
else
*/
// ANNECY AV CLEAN_MEC {
/*
if (m_pZDxObject -> GetZDxType () == eTestPoint)
pZDxInterface -> GetList2Window () -> CreateListOfTestPoint (pZDxInterface -> GetList2Window () -> GetActorSuperObject () ,
pZDxInterface -> GetList2Window () -> GetListOfTestPoint () ,
TRUE);
else
*/
pZDxInterface -> GetList2Window () -> ReCreateListOfZDx (TRUE , FALSE);
// END ANNECY AV }
}
pZDxInterface -> RefreshDisplay (C_lModifZDx , _bRefreshWindow);
// We will have to save the geometric object
// ANNECY AV CLEAN_MEC {
/*
if (m_pZDxObject -> GetZDxType () == eTestPoint) pZDxInterface -> GetList2Window () -> GetListOfTestPoint () -> fn_vNotifySave ();
else
*/
m_pZDxObject -> fn_vNotifySave ();
// END ANNECY AV }
m_bIsDoingUndo = FALSE;
return TRUE;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - Undo
// The standard Undo : we refresh the window by default
//-----------------------------------------------------------------------------
ZDx_Modif::Undo ()
{
return Undo (TRUE);
}
//-----------------------------------------------------------------------------
// class ZDx_Modif - Do
// Do and Undo are exactly the same thing in this case, so we just call the Undo method
//-----------------------------------------------------------------------------
ZDx_Modif::Do ()
{
if (m_bFirstTime)
{
m_bFirstTime = FALSE;
return Undo (!((ZDx_Interface *) m_pZDxObject->GetEditor())->GetList1Window()->IsEditingBoundingVolume());
}
else
return Undo (TRUE);
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Exchange - constructor
//-----------------------------------------------------------------------------
ZDx_Modif_Exchange::ZDx_Modif_Exchange
(ZDx_Object * _pZDxObject1 , long _lIndexInList1 , EdtList * _pZDxList1 , CPA_SuperObject * _pActorSuperObject1 ,
ZDx_Object * _pZDxObject2 , long _lIndexInList2 , EdtList * _pZDxList2 , CPA_SuperObject * _pActorSuperObject2 ,
ZDx_Interface * _pZDxInterface)
: CPA_Modif (0 , "Exchange zones" , FALSE)
{
m_pZDxInterface = _pZDxInterface;
m_pZDxObject1 = _pZDxObject1;
m_pZDxObject2 = _pZDxObject2;
m_lIndexInList1 = _lIndexInList1;
m_lIndexInList2 = _lIndexInList2;
m_pZDxList1 = _pZDxList1;
m_pZDxList2 = _pZDxList2;
m_eTypeOfList1 = m_pZDxInterface -> ConvertListTypeToZDxType (m_pZDxList1 -> fn_csGetListType ());
m_eTypeOfList2 = m_pZDxInterface -> ConvertListTypeToZDxType (m_pZDxList2 -> fn_csGetListType ());
m_pActorSuperObject1 = _pActorSuperObject1;
m_pActorSuperObject2 = _pActorSuperObject2;
m_pActor1 = _pActorSuperObject1 -> GetObject ();
m_pActor2 = _pActorSuperObject2 -> GetObject ();
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Exchange - Do
// We exchange the two ZDx
//-----------------------------------------------------------------------------
BOOL ZDx_Modif_Exchange::Do ()
{
// Exchange the type of the ZDx objects
if (m_pZDxObject1) m_pZDxObject1 -> SetZDxType (m_eTypeOfList2);
if (m_pZDxObject2) m_pZDxObject2 -> SetZDxType (m_eTypeOfList1);
// Put the second object into the first list
m_pZDxInterface -> SetZDxObjectInList (m_pActor1 , m_eTypeOfList1 , m_lIndexInList1 , m_pZDxObject2);
// Now, look if the list has changed. If so, the list has been duplicated, so we must do the modification
// into the old and the new list.
EdtList * pNewList1 = m_pZDxInterface -> GetZDxList (m_pActor1 , m_eTypeOfList1);
if (pNewList1 != m_pZDxList1)
{
CPA_BaseObject * pActorUsingThisList = (CPA_BaseObject *) m_pActor1 -> GetEditor () ->
OnQueryAction (m_pZDxInterface , C_uiActor_GetFirstActorUsingThisList , (long) pNewList1);
m_pZDxInterface -> SetZDxObjectInList (pActorUsingThisList ,
m_eTypeOfList2 , m_lIndexInList2 , m_pZDxObject1 , eZDxModifyAllActors);
}
// Put the first object into the second list
m_pZDxInterface -> SetZDxObjectInList (m_pActor2 , m_eTypeOfList2 , m_lIndexInList2 , m_pZDxObject1 , eZDxModifyAllActors);
// Refresh the lists
m_pZDxInterface -> GetList1Window () -> ReCreateCurrentList ();
if (m_pZDxObject1) m_pZDxInterface -> GetList2Window () -> SelectZDx (m_pZDxObject1);
return TRUE;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Exchange - Undo
// We exchange the two ZDx
//-----------------------------------------------------------------------------
BOOL ZDx_Modif_Exchange::Undo ()
{
// Exchange the type of the ZDx objects
if (m_pZDxObject1) m_pZDxObject1 -> SetZDxType (m_eTypeOfList1);
if (m_pZDxObject2) m_pZDxObject2 -> SetZDxType (m_eTypeOfList2);
// Look if the list has changed. If so, we must delete the new list and put the old one
EdtList * pNewList1 = m_pZDxInterface -> GetZDxList (m_pActor1 , m_eTypeOfList1);
if (pNewList1 != m_pZDxList1)
{
m_pZDxInterface -> DeleteZDxList (m_pActor1 , m_eTypeOfList1);
m_pZDxInterface -> SetZDxList (m_pActor1 , m_eTypeOfList1 , m_pZDxList1);
}
EdtList * pNewList2 = m_pZDxInterface -> GetZDxList (m_pActor2 , m_eTypeOfList2);
if (pNewList2 != m_pZDxList2)
{
m_pZDxInterface -> DeleteZDxList (m_pActor2 , m_eTypeOfList2);
m_pZDxInterface -> SetZDxList (m_pActor2 , m_eTypeOfList2 , m_pZDxList2);
}
// Exchange the two ZDx objects
m_pZDxInterface -> SetZDxObjectInList (m_pActor1 , m_eTypeOfList1 , m_lIndexInList1 , m_pZDxObject1 , eZDxModifyAllActors);
m_pZDxInterface -> SetZDxObjectInList (m_pActor2 , m_eTypeOfList2 , m_lIndexInList2 , m_pZDxObject2 , eZDxModifyAllActors);
// Refresh the list
m_pZDxInterface -> GetList1Window () -> ReCreateCurrentList ();
if (m_pZDxObject1) m_pZDxInterface -> GetList2Window () -> SelectZDx (m_pZDxObject1);
return TRUE;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Delete - constructor
//-----------------------------------------------------------------------------
ZDx_Modif_Delete::ZDx_Modif_Delete
(CPA_SuperObject * _pZDxSuperObject , long _lIndexInList , EdtList * _pZDxList , CPA_SuperObject * _pModuleSuperObject ,
CPA_SuperObject * _pActorSuperObject , ZDx_Interface * _pZDxInterface)
: CPA_Modif (0 , "Delete zone" , FALSE)
{
// One and only one of the two pointers must be defined
ASSERT ((_pActorSuperObject != NULL) ^ (_pModuleSuperObject != NULL));
m_pZDxInterface = _pZDxInterface;
m_pZDxSuperObject = _pZDxSuperObject;
m_pZDxObject = (ZDx_Object *) _pZDxSuperObject -> GetObject ();
m_lIndexInList = _lIndexInList;
m_pZDxList = _pZDxList;
m_pActorSuperObject = _pActorSuperObject;
m_pActor = _pActorSuperObject ? _pActorSuperObject -> GetObject () : NULL;
m_pModuleSuperObject = _pModuleSuperObject;
m_pModule = (EditorPO *) (_pModuleSuperObject ? _pModuleSuperObject -> GetObject () : NULL);
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Delete - destructor
//-----------------------------------------------------------------------------
ZDx_Modif_Delete::~ZDx_Modif_Delete ()
{
// We do not delete the ZDx object, because it can be shared by several modules
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Delete - Do
// We delete the ZDx
//-----------------------------------------------------------------------------
BOOL ZDx_Modif_Delete::Do ()
{
m_pZDxInterface -> IWillRefreshDisplay (C_lModifDeleteDo);
if (m_pZDxObject -> GetZDxType () == eBoundingVolume)
{
// We get the family of the actor
CPA_Family * pFamily = (CPA_Family *) m_pActor -> GetOwner () -> GetOwner ();
// We set the reference of the bounding volume to NULL
pFamily -> mfn_vSetBoundingVolume (NULL);
// Remove the bounding volume from the hierarchy
m_pZDxInterface -> DeleteZDxObjectFromHierarchy (m_pZDxSuperObject);
m_pZDxInterface -> GetList2Window () -> CreateBoundingVolume (m_pActorSuperObject , NULL);
}
else
// ANNECY AV CLEAN_MEC {
/*
if (m_pZDxObject -> GetZDxType () == eTestPoint)
{
// We get the current list of test points
CPA_TestPointsList * pListOfTestPoint = m_pZDxInterface -> GetList2Window () -> GetListOfTestPoint ();
ASSERT (pListOfTestPoint);
// We find the test point of the list that have this ZDx object
POSITION PosTestPoint = pListOfTestPoint -> m_oListOfTestPoints . GetHeadPosition ();
CPA_TestPointNode * pTestPoint;
while (PosTestPoint)
{
pTestPoint = pListOfTestPoint -> m_oListOfTestPoints . GetAt (PosTestPoint);
if (pTestPoint -> mfn_p_oGetZdxObject () == m_pZDxObject) break;
pListOfTestPoint -> m_oListOfTestPoints . GetNext (PosTestPoint);
}
ASSERT (PosTestPoint); // PosTestPoint == NULL --> not found -> error
// Remove the test point from the list but do not delete it
pListOfTestPoint -> m_oListOfTestPoints . RemoveAt (PosTestPoint);
m_pZDxInterface -> GetList2Window () -> CreateListOfTestPoint (m_pActorSuperObject , pListOfTestPoint);
pListOfTestPoint -> fn_vNotifySave ();
}
else
*/
// END ANNECY AV }
{
// Remove the ZDx object from the list or from the physical object
if (m_pActor) m_pZDxInterface -> RemoveZDxFromList (m_pZDxList , m_pZDxObject , m_pActor , TRUE);
else m_pZDxInterface -> SetZDxOfPhysicalObject (m_pModule , NULL ,m_pZDxObject -> GetZDxType ());
// Delete the ZDx object from the hierarchy
m_pZDxInterface -> DeleteZDxObjectFromHierarchy (m_pZDxSuperObject);
// Refresh the list
m_pZDxInterface -> GetList2Window () -> ReCreateListOfZDx (TRUE , FALSE);
// We show the ZDx again
if (m_pActor) m_pZDxInterface -> ShowZDxOfActor (m_pActorSuperObject , m_pZDxInterface -> GetList2Window () -> GetZDxTypeToShow ());
else m_pZDxInterface -> ShowZDxOfModule (m_pModuleSuperObject , m_pZDxInterface -> GetList2Window () -> GetZDxTypeToShow ());
}
// Say that the section of the graphic object must be deleted
// ANNECY AV CLEAN_MEC {
/*
if (m_pZDxObject -> GetZDxType () == eTestPoint) m_pZDxInterface -> GetList2Window () -> GetListOfTestPoint () -> fn_vNotifySave ();
else
*/
m_pZDxObject -> fn_vNotifyUnSave ();
// END ANNECY AV }
m_pZDxInterface -> RefreshDisplay (C_lModifDeleteDo);
Done ();
return TRUE;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Delete - Undo
// We reinsert the ZDx
//-----------------------------------------------------------------------------
BOOL ZDx_Modif_Delete::Undo ()
{
m_pZDxInterface -> IWillRefreshDisplay (C_lModifDeleteUndo);
// Say that the section of the graphic object must not be deleted (must be done before it is inserted into the hierarchy)
// ANNECY AV CLEAN_MEC {
/*
if (m_pZDxObject -> GetZDxType () == eTestPoint) m_pZDxInterface -> GetList2Window () -> GetListOfTestPoint () -> fn_vNotifySave ();
else
*/
m_pZDxObject -> fn_vNotifyRestore ();
// END ANNECY AV }
if (m_pZDxObject -> GetZDxType () == eBoundingVolume)
{
// We get the family of the actor
CPA_Family * pFamily = (CPA_Family *) m_pActor -> GetOwner () -> GetOwner ();
// We set the reference to the new bounding volume
pFamily -> mfn_vSetBoundingVolume (m_pZDxObject);
// Show the bounding volume
// m_pZDxInterface -> ShowBoundingVolume (m_pActorSuperObject , m_pZDxObject , TRUE);
m_pZDxInterface -> GetList2Window () -> CreateBoundingVolume (m_pActorSuperObject , m_pZDxObject);
}
else
// ANNECY AV CLEAN_MEC {
/*
if (m_pZDxObject -> GetZDxType () == eTestPoint)
{
CPA_TestPointNode * pTestPoint = m_pZDxObject -> GetTestPoint ();
ASSERT (pTestPoint);
CPA_TestPointsList * pListOfTestPoint = pTestPoint -> mfn_p_oGetList ();
// Reinsert the test point into the list of test points
pListOfTestPoint -> m_oListOfTestPoints . AddTail (pTestPoint);
m_pZDxInterface -> GetList2Window () -> CreateListOfTestPoint (m_pActorSuperObject , pListOfTestPoint);
pListOfTestPoint -> fn_vNotifySave ();
}
else
*/
// END ANNECY AV }
{
// Reinsert the ZDx object into the hierarchy (must be done before it is inserted into the list (because of fn_bAcceptAsParent))
m_pZDxInterface -> InsertZDxObjectIntoHierarchy (m_pZDxSuperObject , m_pActorSuperObject ? m_pActorSuperObject : m_pModuleSuperObject);
// Reinsert the ZDx object into the list or into the physical object
if (m_pActor) m_pZDxInterface -> InsertZDxIntoList (m_pZDxList , m_pZDxObject , & m_lIndexInList , m_pActor , eZDxModifyAllActors);
else m_pZDxInterface -> SetZDxOfPhysicalObject (m_pModule , m_pZDxObject , m_pZDxObject -> GetZDxType ());
// Refresh the list
m_pZDxInterface -> GetList2Window () -> ReCreateListOfZDx (TRUE , FALSE);
// We show the ZDx again
if (m_pActorSuperObject) m_pZDxInterface -> ShowZDxOfActor (m_pActorSuperObject , m_pZDxInterface -> GetList2Window () -> GetZDxTypeToShow ());
else m_pZDxInterface -> ShowZDxOfModule (m_pModuleSuperObject , m_pZDxInterface -> GetList2Window () -> GetZDxTypeToShow ());
}
m_pZDxInterface -> RefreshDisplay (C_lModifDeleteUndo);
Undone ();
return TRUE;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Change_ZDx_List - constructor
//-----------------------------------------------------------------------------
ZDx_Modif_Change_ZDx_List::ZDx_Modif_Change_ZDx_List (ZDx_Interface * _pZDxInterface ,
CPA_SuperObject * _pActorSuperObject ,
tdeZDxType _eTypeOfList ,
EdtList * _pZDxList)
: CPA_Modif (0 , "Change list of zones" , FALSE)
{
m_pZDxInterface = _pZDxInterface;
m_pActorSuperObject = _pActorSuperObject;
m_pActor = _pActorSuperObject -> GetObject ();
m_eTypeOfList = _eTypeOfList;
m_pZDxList = _pZDxList;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Change_ZDx_List - Undo
// We exchange m_pZDxList and the current list
//-----------------------------------------------------------------------------
BOOL ZDx_Modif_Change_ZDx_List::Undo ()
{
// Hide the zone of the actor
m_pZDxInterface -> ShowZDxOfActor (m_pActorSuperObject , C_ucHideAllZDx);
// Exchange current and backuped ZDx list
EdtList * pCurrentList = m_pZDxInterface -> GetZDxList (m_pActor , m_eTypeOfList);
m_pZDxInterface -> SetZDxList (m_pActor , m_eTypeOfList , m_pZDxList);
m_pZDxList = pCurrentList;
// Refresh the lists
m_pZDxInterface -> GetList1Window () -> ReCreateCurrentList ();
m_pZDxInterface -> GetList2Window () -> SelectZDx (m_eTypeOfList , 0); // Select the first ZDx object of the same type as the list
return TRUE;
}
//-----------------------------------------------------------------------------
// class ZDx_Modif_Change_ZDx_List - Do
// Do and Undo are the same in this case, so we just call the Undo method
//-----------------------------------------------------------------------------
BOOL ZDx_Modif_Change_ZDx_List::Do ()
{
return Undo ();
}

View File

@@ -0,0 +1,651 @@
//*****************************************************************************
//* _zObject.cpp *
//*****************************************************************************
//* *
//* This file contains all the methods of the ZDx_Object class *
//* and its inherited classes *
//* *
//*****************************************************************************
//* Author : Alexis Vaisse *
//*****************************************************************************
// "standard" include
#include "stdafx.h"
#include "ACP_Base.h"
#include "TFA.h" // Family dll include
#define HieFriend
#include "IncGAM.h"
#include "IncITF.h"
#include "..\Main\Inc\_EditID.h"
#include "OGD.h" // 3dGeom dll include
#include "OAC.h" // Actor dll include
#include "OPD.h" // Physical object dll include
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
#include "ozo.h"
//ENDROMTEAM WorldEditor (Cristi Petrescu)
// personal include
#include "_zObject.hpp"
#include "_zInterf.hpp"
//*****************************************************************************
// class ZDx_Object
//*****************************************************************************
//DeclareTemplateStatic (ACP_tdxHandleOfObject);
//-----------------------------------------------------------------------------
// class ZDx_Object - GiveZDxID
// Give the ID of a ZDx object, depending on its type
//-----------------------------------------------------------------------------
long ZDx_Object::GiveZDxID (tdeZDxType _eZDxType)
{
switch (_eZDxType)
{
case eZdd : return C_lZDD;
case eZde : return C_lZDE;
case eZdm : return C_lZDM;
case eZdr : return C_lZDR;
case eBoundingVolume : return C_lBoundingVolume;
// ANNECY AV CLEAN_MEC {
// case eTestPoint : return C_lTestPoint;
// END ANNECY AV }
default : ASSERT (0);
return C_lZDD;
}
}
//-----------------------------------------------------------------------------
// class ZDx_Object - constructor
//-----------------------------------------------------------------------------
ZDx_Object::ZDx_Object (ZDx_Interface * _pZDxInterface , const CString _csZDxTypeName ,
tdeZDxType _eZDxType , tdeZDxGeometricType _eZDxGeometricType ,
CString _csZDxName , CPA_BaseObject * _pOwner ,
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Shape3D * _pGeometric3dObject /*, ACP_tdxHandleOfElement _hHandleOfElement*/)
//ENDROMTEAM WorldEditor (Cristi Petrescu)
// ANNECY AV CLEAN_MEC {
: CPA_SaveObject (_pZDxInterface , _csZDxTypeName , /* _eZDxType == eTestPoint ? E_ss_NoSave : */ E_ss_Responsible , _pOwner) ,
// END ANNECY AV }
CPA_EdMot<ACP_tdxHandleOfObject> ((ACP_tdxHandleOfObject) _pGeometric3dObject -> GetData ())
{
m_pZDxShape = 0; // Because it can be used by fn_csComputeReferencedSectionName called by fn_eRename
// Initialisation for base class
SetSectionData (this);
SetDataPath ("");
SetReferencedSectionName ("");
// Internal initialisation
SetZDxType (_eZDxType);
SetZDxGeometricType (_eZDxGeometricType);
m_eDisplayType = eNotDisplayed;
m_bMotorDisplay = TRUE;
m_lIndexInList = -1;
// ANNECY AV CLEAN_MEC {
// m_pTestPoint = NULL;
// END ANNECY AV }
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
// switch (_eZDxGeometricType)
// {
// case eSphere : m_pZDxShape = new ZDx_Shape (this , _pGeometric3dObject /*, _hHandleOfElement*/); break;
// case eBox : m_pZDxShape = new ZDx_Shape (this , _pGeometric3dObject /*, _hHandleOfElement*/); break;
// case ePoint : m_pZDxShape = new ZDx_Shape (this , _pGeometric3dObject /*, _hHandleOfElement*/); break;
// case eCone : m_pZDxShape = new ZDx_Shape (this , _pGeometric3dObject /*, _hHandleOfElement*/); break;
// default: ASSERT (0); break;
// }
m_pZDxShape = new ZDx_Shape (this , _pGeometric3dObject);
//ENDROMTEAM WorldEditor (Cristi Petrescu)
// Set the name
if (fn_eRename (_csZDxName) != E_mc_None) SetDefaultValidName ();
fn_vUpdateSectionName ();
}
//-----------------------------------------------------------------------------
// class ZDx_Object - copy constructor
//-----------------------------------------------------------------------------
ZDx_Object::ZDx_Object (ZDx_Object & _pZDxObjectToCopy)
: CPA_SaveObject (_pZDxObjectToCopy)
{
SetZDxType (_pZDxObjectToCopy . GetZDxType ());
SetZDxGeometricType (_pZDxObjectToCopy . GetZDxGeometricType ());
m_eDisplayType = eNotDisplayed;
m_bMotorDisplay = TRUE;
m_lIndexInList = -1;
// ANNECY AV CLEAN_MEC {
// m_pTestPoint = NULL;
// END ANNECY AV }
// Create a new geometric object
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
//ACP_tdxHandleOfElement HandleOfElement;
Shape3D * pGeometric3dObject = ((ZDx_Interface *) GetEditor ()) ->
CreateGraphicObject (_pZDxObjectToCopy . GetZDxGeometricType () /*, & HandleOfElement */, "" , ""); //??? Remplir DataPath et ReferenceSectionName
//ENDROMTEAM WorldEditor (Cristi Petrescu)
SetStruct ((ACP_tdxHandleOfObject) _pZDxObjectToCopy . GetEngineStruct ());
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
MTH3D_tdstVector stPoint;
GLI_tdxValue Length;
Shape3D *pShape3DToCopy = _pZDxObjectToCopy . GetZDxShape () -> GetGeometric3dObject ();
switch (m_eZDxGeometricType)
{
case eSphere :
m_pZDxShape = new ZDx_Shape (this , pGeometric3dObject);/*, HandleOfElement ,
(ZDx_Sphere *) _pZDxObjectToCopy . GetZDxShape ());*/
stPoint = ((Sphere3D *)pShape3DToCopy) -> GetCenter ();
((Sphere3D *) pGeometric3dObject) -> SetCenter (& stPoint);
Length = ((Sphere3D *)pShape3DToCopy) -> GetRadius ();
((Sphere3D *) pGeometric3dObject) -> SetRadius (& Length);
break;
case eBox :
m_pZDxShape = new ZDx_Shape (this , pGeometric3dObject); /*, HandleOfElement ,
(ZDx_Box *) _pZDxObjectToCopy . GetZDxShape ());*/
stPoint = ((Box3D *) pShape3DToCopy) -> GetMinPoint ();
((Box3D *) pGeometric3dObject) -> SetMinPoint (& stPoint);
stPoint = ((Box3D *) pShape3DToCopy) -> GetMaxPoint ();
((Box3D *) pGeometric3dObject) -> SetMaxPoint (& stPoint);
stPoint = ((Box3D *) pShape3DToCopy) -> GetMinPoint ();
((Box3D *) pGeometric3dObject) -> SetMinPoint (& stPoint); // To be sure it is copied (because we must have Min <= Max)
break;
case ePoint :
m_pZDxShape = new ZDx_Point (this , pGeometric3dObject /*, HandleOfElement */,
(ZDx_Point *) _pZDxObjectToCopy . GetZDxShape ());
break;
case eCone :
m_pZDxShape = new ZDx_Shape (this , pGeometric3dObject); /*, HandleOfElement ,
(ZDx_Cone *) _pZDxObjectToCopy . GetZDxShape ());*/
stPoint = ((Cone3D *) pShape3DToCopy) -> GetBasePoint ();
((Cone3D *) pGeometric3dObject) -> SetBasePoint (& stPoint);
stPoint = ((Cone3D *) pShape3DToCopy) -> GetTopPoint ();
((Cone3D *) pGeometric3dObject) -> SetTopPoint (& stPoint);
Length = ((Cone3D *) pShape3DToCopy) -> GetRadius ();
((Cone3D *) pGeometric3dObject) -> SetRadius (& Length);
break;
default: ASSERT (0);
break;
}
//ENDROMTEAM WorldEditor (Cristi Petrescu)
}
//-----------------------------------------------------------------------------
// class ZDx_Object - destructor
//-----------------------------------------------------------------------------
ZDx_Object::~ZDx_Object ()
{
delete m_pZDxShape -> GetGeometric3dObject (); // We delete the geometric object
delete m_pZDxShape; // and the ZDx shape object
// ANNECY AV CLEAN_MEC {
// if (m_pTestPoint) delete m_pTestPoint;
// END ANNECY AV }
}
//-----------------------------------------------------------------------------
// class ZDx_Object - InitZDxObject
// static initialization : this function must be called once to initialize the CPA_EdMot functions
//-----------------------------------------------------------------------------
void ZDx_Object::InitZDxObject ()
{
CPA_EdMot<ACP_tdxHandleOfObject>::Init (CreateZDxEngineStruct , CopyZDxEngineStruct , DeleteZDxEngineStruct);
}
//-----------------------------------------------------------------------------
// class ZDx_Object - CreateZDxEngineStruct
// When created, a ZDx_Object has no engine object
// It will be added later
//-----------------------------------------------------------------------------
ACP_tdxHandleOfObject ZDx_Object::CreateZDxEngineStruct ()
{
return NULL;
}
//-----------------------------------------------------------------------------
// class ZDx_Object - CopyZDxEngineStruct
// Copy a ZDx engine structure
//-----------------------------------------------------------------------------
void ZDx_Object::CopyZDxEngineStruct (ACP_tdxHandleOfObject _hDst , ACP_tdxHandleOfObject _hSrc)
{
// A ZDx can't be copied
_hDst = NULL;
}
//-----------------------------------------------------------------------------
// class ZDx_Object - DeleteZDxEngineStruct
// Delete a ZDx engine structure
//-----------------------------------------------------------------------------
void ZDx_Object::DeleteZDxEngineStruct (ACP_tdxHandleOfObject _hZDxEngineStruct)
{
// We do nothing
}
//-----------------------------------------------------------------------------
// class ZDx_Object - GetDataType
// Return the engine type of the ZDx object
//-----------------------------------------------------------------------------
long ZDx_Object::GetDataType ()
{
return GiveZDxID (m_eZDxType);
}
//-----------------------------------------------------------------------------
// class ZDx_Object - GetData
// Return the engine object of the ZDx object
//-----------------------------------------------------------------------------
void * ZDx_Object::GetData ()
{
return GetStruct ();
}
//-----------------------------------------------------------------------------
// class ZDx_Object - fn_eCheckUnicity
// Check if the given name is valid or not
//-----------------------------------------------------------------------------
tdeMissingCriteria ZDx_Object::fn_eCheckUnicity (const CString csNewName)
{
// Check unicity with owner
tdeMissingCriteria eResult = fn_eCheckUnicityWithOwner (csNewName);
if (eResult != E_mc_None) return eResult;
// Check unicity for geometric object name
ZDx_Shape * pZDxShape = GetZDxShape ();
if (! pZDxShape) return E_mc_None;
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Shape3D * pGeometric3dObject = pZDxShape -> GetGeometric3dObject ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
if (! pGeometric3dObject) return E_mc_None;
if (pGeometric3dObject -> GetName () . CompareNoCase (csNewName) == 0) return E_mc_None;
else return pGeometric3dObject -> fn_eCheckUnicity (csNewName);
}
//-----------------------------------------------------------------------------
// class ZDx_Object - fn_vNotifyRename
// Called when one renames the ZDx : we also rename the geometric object
//-----------------------------------------------------------------------------
void ZDx_Object::fn_vNotifyRename ()
{
SetReferencedSectionName (fn_csComputeReferencedSectionName (GetName ()));
tdeMissingCriteria eResult = GetZDxShape () -> GetGeometric3dObject () -> fn_eRename (GetName ());
ASSERT (eResult == E_mc_None);
}
//-----------------------------------------------------------------------------
// class ZDx_Object - GetZDxTypeName
// return the name of the type of the ZDx object
//-----------------------------------------------------------------------------
char * ZDx_Object::GetZDxTypeName ()
{
switch (m_eZDxType)
{
case eZdd : return C_szZddName;
case eZde : return C_szZdeName;
case eZdm : return C_szZdmName;
case eZdr : return C_szZdrName;
case eBoundingVolume : return C_szBoundingVolumeName;
// ANNECY AV CLEAN_MEC {
// case eTestPoint : return C_szTestPointName;
// END ANNECY AV }
default : ASSERT (0);
return "";
}
}
//-----------------------------------------------------------------------------
// class ZDx_Object - GetZDxName
// return the name of the ZDx object
//-----------------------------------------------------------------------------
char * ZDx_Object::GetZDxName ()
{
// return the name of the object
return (char *) LPCTSTR (GetName ());
}
//-----------------------------------------------------------------------------
// class ZDx_Object - SetZDxName
// set the name of the ZDx object
// return FALSE if the name already exists
//-----------------------------------------------------------------------------
BOOL ZDx_Object::SetZDxName (char * szNewName)
{
char * szOldName = GetZDxName ();
tdeMissingCriteria eResult = fn_eRename (szNewName);
if (eResult == E_mc_None) // If the name has changed
{
// We get the list of zone list
CPA_BaseObjectList * pListOfEdtList = GetEditor () -> GetMainWorld () -> fn_p_oGetOriginalObjectList (C_szEdtListTypeName);
for (int i = 0 ; i < pListOfEdtList -> GetCount () ; i ++)
{
EdtList * pEdtList = (EdtList *) pListOfEdtList -> GetObjectWithIndex (i);
// If the zone list contains this zone, we notify to save it
if (pEdtList -> Find (this)) pEdtList -> fn_vUpdateReference (this);
}
// We get the list of physical objects
CPA_BaseObjectList * pListOfPO = GetEditor () -> GetMainWorld () -> fn_p_oGetOriginalObjectList (C_szPhysicalObjectTypeName);
for (i = 0 ; i < pListOfPO -> GetCount () ; i ++)
{
EditorPO * pModule = (EditorPO *) pListOfPO -> GetObjectWithIndex (i);
// If the module contains this zone, we notify to save it
if (pModule -> GetZone (C_ucTypeZdd) == this ||
pModule -> GetZone (C_ucTypeZde) == this ||
pModule -> GetZone (C_ucTypeZdm) == this ||
pModule -> GetZone (C_ucTypeZdr) == this) pModule -> fn_vUpdateReference (this);
}
// We get the list of families
CPA_BaseObjectList * pListOfFamily = GetEditor () -> GetMainWorld () -> fn_p_oGetOriginalObjectList (C_szFamilyTypeName);
for (i = 0 ; i < pListOfFamily -> GetCount () ; i ++)
{
CPA_Family * pFamily = (CPA_Family *) pListOfFamily -> GetObjectWithIndex (i);
if (pFamily -> mfn_p_oGetBoundingVolume () == this) pFamily -> fn_vUpdateReference (this);
}
}
return eResult == E_mc_None;
}
//-----------------------------------------------------------------------------
// class ZDx_Object - CallbackToCreateZDxFile
// We must add one special line in a ZDx file
//-----------------------------------------------------------------------------
void ZDx_Object::CallbackToCreateZDxFile (SCR_tdst_File_Description * _pFile ,
char * _szSectionName ,
void * _pData ,
SCR_tde_Ntfy_Action _eAction)
{
switch (_eAction)
{
case SCR_EA_Ntfy_AddSection : // The ZDx file does not exist : we ad a special line
fn_v_SvL0_fputs (_pFile , "$SetCurrentFileDouble(1,1.0)\n");
break;
case SCR_EA_Ntfy_ModifySection : // The ZDx file already exists : we do nothing
break;
}
}
//-----------------------------------------------------------------------------
// class ZDx_Object - fn_vNotifySave
// Virtual function from the base class called to notify to save a ZDx object
//-----------------------------------------------------------------------------
void ZDx_Object::fn_vNotifySave ()
{
if (! fn_bCanBeNotified ()) return;
GetZDxShape () -> GetGeometric3dObject () -> fn_vNotifySave ();
// Register the file callback
char szFileName [SCR_CV_ui_Cfg_MaxLenName];
SCR_fn_v_RdL0_SplitSectionName ((char *) (LPCTSTR) GetZDxShape () -> GetGeometric3dObject () -> GetCompleteSectionName () , szFileName , NULL , NULL);
// If the file does not exist, register a callback on it
if (_access (szFileName , 0) == -1)
SCR_fn_v_SvL1_RegisterNotify (szFileName , CallbackToCreateZDxFile , NULL , SCR_EA_Ntfy_AddOrModifySection);
}
//-----------------------------------------------------------------------------
// class ZDx_Object - fn_vNotifyUnSave
// Virtual function from the base class called to notify to delete a ZDx object
//-----------------------------------------------------------------------------
void ZDx_Object::fn_vNotifyUnSave ()
{
if (! fn_bCanBeNotified ()) return;
// We notify to delete the ZDx object only if it is not shared by several modules
if (GetNumberOfModuleUsingThis () <= 1) GetZDxShape () -> GetGeometric3dObject () -> fn_vNotifyUnSave ();
}
//-----------------------------------------------------------------------------
// class ZDx_Object - fn_vNotifyRestore
// Virtual function from the base class called to notify to restore a deleted ZDx object
//-----------------------------------------------------------------------------
void ZDx_Object::fn_vNotifyRestore ()
{
if (! fn_bCanBeNotified ()) return;
// We notify to restore a deleted ZDx object only if it is not used by another module
if (GetNumberOfModuleUsingThis () == 0) GetZDxShape () -> GetGeometric3dObject () -> fn_vNotifyRestore ();
}
//-----------------------------------------------------------------------------
// class ZDx_Object : fn_csComputeReferencedSectionName
// Compte the referenced section name : use the function of the geometric 3d object
//-----------------------------------------------------------------------------
CString ZDx_Object::fn_csComputeReferencedSectionName (const CString _csNewName)
{
ZDx_Shape * pZDxShape = GetZDxShape ();
if (! pZDxShape) return "";
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
Shape3D * pGeometric3dObject = pZDxShape -> GetGeometric3dObject ();
//ENDROMTEAM WorldEditor (Cristi Petrescu)
if (! pGeometric3dObject) return "";
return pGeometric3dObject -> fn_csComputeReferencedSectionName (_csNewName);
}
//-----------------------------------------------------------------------------
// class ZDx_Object : GetNumberOfModuleUsingThis
// Get the number of modules using this ZDx object
//-----------------------------------------------------------------------------
long ZDx_Object::GetNumberOfModuleUsingThis ()
{
long lNumber = 0;
// We get the list of physical objects
CPA_BaseObjectList * pListOfPO = GetEditor () -> GetMainWorld () -> fn_p_oGetOriginalObjectList (C_szPhysicalObjectTypeName);
for (int i = 0 ; i < pListOfPO -> GetCount () ; i ++)
{
EditorPO * pModule = (EditorPO *) pListOfPO -> GetObjectWithIndex (i);
if (pModule -> GetZone (C_ucTypeZdd) == this ||
pModule -> GetZone (C_ucTypeZde) == this ||
pModule -> GetZone (C_ucTypeZdm) == this ||
pModule -> GetZone (C_ucTypeZdr) == this) lNumber++;
}
return lNumber;
}
//-----------------------------------------------------------------------------
// class ZDx_Object : RedrawZDxObject
// redraw the object (in fact, redraw the whole world)
//-----------------------------------------------------------------------------
void ZDx_Object::RedrawZDxObject ()
{
((ZDx_Interface *) GetEditor ()) -> IWillRefreshDisplay (C_lRedrawZDxObject);
((ZDx_Interface *) GetEditor ()) -> RefreshDisplay (C_lRedrawZDxObject);
}
//*****************************************************************************
// class ZDx_Shape
//
// The base class for the different shape of ZDx
// The inherited classes will contains methods to modify the geometric definition of the ZDx
//*****************************************************************************
//-----------------------------------------------------------------------------
// class ZDx_Shape - constructor
//-----------------------------------------------------------------------------
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
ZDx_Shape::ZDx_Shape (ZDx_Object * _pZDxObject , Shape3D * _pGeometric3dObject /*,
ACP_tdxHandleOfElement _HandleOfElement*/)
{
m_pZDxObject = _pZDxObject;
m_pGeometric3dObject = _pGeometric3dObject;
//m_hHandleOfElement = _HandleOfElement;
}
//ENDROMTEAM WorldEditor (Cristi Petrescu)
//-----------------------------------------------------------------------------
// class ZDx_Shape : RefreshData
// Recompute the center of the object from the position of the super object
//-----------------------------------------------------------------------------
void ZDx_Shape::RefreshData (CPA_SuperObject * _pSuperObject)
{
// Get the matrix of the super object
GEO_tdxHandleToMatrix hHandleToMatrix = HIE_fn_hGetSuperObjectMatrix (_pSuperObject -> GetStruct ());
// Get the translation vector
MTH3D_tdstVector TranslationVector;
POS_fn_vGetTranslationVector(hHandleToMatrix , & TranslationVector);
// Add this translation vector to the center of the object
MTH3D_tdstVector Center = GetCenter ();
MTH3D_M_vAddVector (& Center , & Center , & TranslationVector);
SetCenter (& Center);
// Set the translation vector to null;
MTH3D_M_vNullVector (& TranslationVector);
POS_fn_vSetTranslationVector(hHandleToMatrix , & TranslationVector);
}
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
//*****************************************************************************
// class ZDx_Point
//
// The class to modify the geometric aspect of a ZDx of type point
//*****************************************************************************
//-----------------------------------------------------------------------------
// class ZDx_Point : Constructor
//-----------------------------------------------------------------------------
ZDx_Point::ZDx_Point (ZDx_Object * _pZDxObject , Shape3D * _pGeometric3dObject /*,
ACP_tdxHandleOfElement HandleOfElement */,
ZDx_Point * _pZDxPointToCopy /* = NULL */)
: ZDx_Shape (_pZDxObject , _pGeometric3dObject /*, HandleOfElement*/)
{
if (_pZDxPointToCopy)
{
MTH3D_tdstVector stPoint = ((Point3D *) _pZDxPointToCopy -> GetGeometric3dObject ()) -> GetPoint ();
((Point3D *) _pGeometric3dObject) -> SetPoint (& stPoint);
// BEGIN CPA2 Cristi Petrescu 97-12-05
// if (_pZDxObject -> GetZDxType () == eTestPoint)
// ANNECY AV CLEAN_MEC {
// UpdateTestPointPosition ();
// END ANNECY AV }
// END CPA2 Cristi Petrescu 97-12-05
}
}
/*
//-----------------------------------------------------------------------------
// class ZDx_Point : GetPoint
// return the 3D coordinates of the point
//-----------------------------------------------------------------------------
MTH3D_tdstVector ZDx_Point::GetPoint ()
{
MTH3D_tdstVector stPoint;
GetGeometric3dObject () -> fn_vGetPoint (0 , & stPoint);
return stPoint;
}
//-----------------------------------------------------------------------------
// class ZDx_Point : SetPoint
// set the 3D coordinates of the point
//-----------------------------------------------------------------------------
void ZDx_Point::SetPoint (MTH3D_tdstVector * _pPoint)
{
GetGeometric3dObject () -> fn_vSetPoint (0 , _pPoint);
if (m_pZDxObject -> GetZDxType () == eTestPoint) UpdateTestPointPosition ();
}
//-----------------------------------------------------------------------------
// class ZDx_Point : SetPointX
// set the X coordinate of the point
//-----------------------------------------------------------------------------
void ZDx_Point::SetPointX (GLI_tdxValue _X)
{
MTH3D_tdstVector stPoint = GetPoint ();
MTH3D_M_vSetXofVector (& stPoint , _X);
SetPoint (& stPoint);
}
//-----------------------------------------------------------------------------
// class ZDx_Point : SetPointY
// set the Y coordinate of the point
//-----------------------------------------------------------------------------
void ZDx_Point::SetPointY (GLI_tdxValue _Y)
{
MTH3D_tdstVector stPoint = GetPoint ();
MTH3D_M_vSetYofVector (& stPoint , _Y);
SetPoint (& stPoint);
}
//-----------------------------------------------------------------------------
// class ZDx_Point : SetPointZ
// set the Z coordinate of the point
//-----------------------------------------------------------------------------
void ZDx_Point::SetPointZ (GLI_tdxValue _Z)
{
MTH3D_tdstVector stPoint = GetPoint ();
MTH3D_M_vSetZofVector (& stPoint , _Z);
SetPoint (& stPoint);
}
//-----------------------------------------------------------------------------
// Class ZDx_Point - SetColorOfPoint
// Set the color of the point : selected or not selected
//-----------------------------------------------------------------------------
void ZDx_Point::SetColorOfPoint (BOOL _bSelected)
{
GMT_tdxHandleToGameMaterial hGameMaterial = GEO_xGetGameMaterialOfElementPoints
((ACP_tdxHandleOfObject) m_pGeometric3dObject -> GetData () , m_hHandleOfElement);
ACP_tdxHandleOfMaterial hVisualMaterial = GMT_fn_hGetVisualMaterial (hGameMaterial);
GEO_tdstColor stColor;
if (_bSelected) // selected -> pink
{
stColor . xR = 1.0;
stColor . xG = 0.5;
stColor . xB = 1.0;
}
else // not selected -> white
{
stColor . xR = 1.0;
stColor . xG = 1.0;
stColor . xB = 1.0;
}
stColor . xA = 1.0;
GLI_xSetMaterialColor (hVisualMaterial , & stColor);
}
*/
//-----------------------------------------------------------------------------
// Class ZDx_Point - UpdateTestPointPosition
// Set the position of the test point with the position of the point
//-----------------------------------------------------------------------------
// ANNECY AV CLEAN_MEC {
/*
void ZDx_Point::UpdateTestPointPosition ()
{
if (m_pZDxObject -> GetZDxType () == eTestPoint)
{
MTH3D_tdstVector stPosition = ((Point3D *) GetGeometric3dObject ()) -> GetPoint ();
m_pZDxObject -> GetTestPoint () -> SetPosition (& stPosition);
}
}
*/
// END ANNECY AV }
//ENDROMTEAM WorldEditor (Cristi Petrescu)

View File

@@ -0,0 +1,10 @@
LIBRARY
EXPORTS
fn_p_szGetCPAVersion
fn_p_stGetDLLIdentity
fn_p_oGetDLL
fn_vInitDll
SECTIONS
.data READ WRITE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,121 @@
// checkzones.cpp : implementation file
//
#include "stdafx.h"
#include "ACP_Base.h"
#include "TFA.h" // Family dll include
#define HieFriend
#include "IncGAM.h"
#include "DPT.h"
#include "..\Main\Inc\_EditID.h"
// personal include
#include "ozo.h"
//#include "Ozo\_zQuery.hpp"
#include "_zInterf.hpp"
#include "_zObject.hpp"
#include "_zModif.hpp"
#include "_zWEdit.hpp"
#include "_zWList1.hpp"
#include "_zWList2.hpp"
#include "OGD.h" // 3dGeom dll include
#include "OAC.h" // Actors dll include
#include "OPD.h" // Physical Object dll include
#include "TUT.h" // Tutorial dll include
#include "..\inc\checkzones.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCheckZones dialog
CCheckZones::CCheckZones(CPA_Actor *pActor, CStringList *pZonesList, CWnd* pParent /*=NULL*/)
: CDialog(CCheckZones::IDD, pParent)
{
m_pActor = pActor;
m_pZonesList = pZonesList;
//{{AFX_DATA_INIT(CCheckZones)
//}}AFX_DATA_INIT
}
void CCheckZones::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCheckZones)
DDX_Control(pDX, IDC_LIST_ZONES, m_ctrlZonesList);
DDX_Control(pDX, IDC_CHECK_YES, m_ctrlYes);
DDX_Control(pDX, IDC_CHECK_ZONES, m_ctrlCheckZonesAgainstBV);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCheckZones, CDialog)
//{{AFX_MSG_MAP(CCheckZones)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCheckZones message handlers
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnOK
// Date : 98-06
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CCheckZones::OnOK()
{
UpdateData (TRUE);
m_pActor->mfn_bSet_CheckZonesAgainstBV (m_ctrlCheckZonesAgainstBV.GetCheck ());
if (m_ctrlYes.GetCheck ())
CDialog::OnOK();
else
CDialog::OnCancel ();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnInitDialog
// Date : 98-06
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CCheckZones::OnInitDialog()
{
if (!m_pActor || !m_pZonesList)
CDialog::OnCancel ();
CDialog::OnInitDialog();
POSITION pos = m_pZonesList->GetHeadPosition ();
while (pos)
{
CString csZoneName = m_pZonesList->GetNext (pos);
m_ctrlZonesList.AddString (csZoneName);
}
m_ctrlCheckZonesAgainstBV.SetCheck (m_pActor->mfn_bGet_CheckZonesAgainstBV ());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}