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,120 @@
/*=========================================================================
*
* dllcom.cpp : DLL definition
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "acp_base.h"
#include "afxdllx.h"
#include "SECTint.hpp"
//------------------------------------------------------------------------
// Global vars
static char *gs_p_szCPAVersion = C_szCPAVersion;
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
#ifdef DLL_ONLY_ONE_INSTANCE
static Sector_Interface *gs_p_oSectorInterface = NULL;
#endif
// list of instances
static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
//------------------------------------------------------------------------
// functions that are present in all DLL :
//------------------------------------------------------------------------
//========================================================================
// Get current CPA version
//========================================================================
extern "C" char __declspec(dllexport) *fn_p_szGetCPAVersion(void)
{
return gs_p_szCPAVersion;
}
//========================================================================
// Get type of this DLL
//========================================================================
extern "C" tdstDLLIdentity __declspec(dllexport) *fn_p_stGetDLLIdentity(void)
{
g_stSectorIdentity.eType = OBJECT_DLL;
g_stSectorIdentity.csName = C_szDLLSectorName;
g_stSectorIdentity.hModule = NULL;
g_stSectorIdentity.p_oListOfInstances = &g_oListOfInstances;
return &g_stSectorIdentity;
}
//========================================================================
// 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_oSectorInterface == NULL)
{
gs_p_oSectorInterface = new Sector_Interface();
ASSERT(gs_p_oSectorInterface != NULL);
}
return gs_p_oSectorInterface;
break;
default:
return NULL;
}
#else //DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
return new Sector_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

View File

@@ -0,0 +1,369 @@
/*=========================================================================
*
* SECTelem.cpp : Implementation of Editor Elements
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "DPT.h"
//#################################################################################
// Element Base
//#################################################################################
SECT_ElementBase::SECT_ElementBase (Sector_Object *pOwnerSector)
: CPA_SectionObject ("", fn_szGetLevelsDataPath(), SECT_ElementBase::CallBackSaveSectorsLink,
pOwnerSector, pOwnerSector->fn_bHasSectorsLinkSection())
{
// init owner
m_pOwnerSector = pOwnerSector;
// init section name
SetReferencedSectionName(m_pOwnerSector->GetSectorsLinkSection());
}
/*===========================================================================
* Description: callback for save
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void SECT_ElementBase::CallBackSaveSectorsLink (SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
{
SECT_SoundEventElement *pSoundEventElem;
SECT_SndEvtEngineElem *pEngineElem;
SECT_CollisionElement *pCollisionElem;
SECT_ActivityElement *pActivityElem;
SECT_GraphicElement *pGraphicElem;
SECT_SoundElement *pSoundElem;
SECT_ElementBase *pElem;
Sector_Object *pSector;
POSITION pos, pos1;
CString csReference, csSoundEvent;
char szNewSectionName[SCR_CV_ui_Cfg_MaxLenName];
int iSaveIndentLevel;
// get sector
pSector = (Sector_Object *) p_vData;
switch (eAction)
{
case SCR_EA_Ntfy_AddSection:
case SCR_EA_Ntfy_RebuildSection:
// indent level
iSaveIndentLevel = SCR_g_ui_SvL0_IndentationLevel;
SCR_g_ui_SvL0_IndentationLevel = 1;
// save begin section
SCR_fn_v_RdL0_ComputeSectionName(szNewSectionName, NULL, C_szSectorsLinkSubSection, " ");
SCR_M_SvL0_SaveBeginSection(p_stFile, szNewSectionName, SCR_CC_C_Cfg_EOL);
// virtual
if (pSector->fn_bIsVirtual())
{
SCR_M_SvL0_SaveEntry(p_stFile, "Virtual", SCR_CC_C_Cfg_EOL);
}
pSector->GetVirtualSection()->fn_vSectionSaved();
// Zfar clipping
if (pSector->GetZfarInSector() > MTH_C_ZERO)
{
SCR_M_SvL0_SaveEntry(p_stFile, "ZFar", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%f", GLI_M_ValueToFloat(pSector->GetZfarInSector()));
}
// camera type
SCR_M_SvL0_SaveEntry(p_stFile, "CameraType", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%d", (int) pSector->GetCameraType());
pSector->GetCameraSection()->fn_vSectionSaved();
// priority
SCR_M_SvL0_SaveEntry(p_stFile, "Priority", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%d", (int) pSector->GetPriority());
pSector->GetPrioritySection()->fn_vSectionSaved();
// graphic list
for (pGraphicElem = pSector->GetGraphicList()->GetHeadElement(pos); pGraphicElem;
pGraphicElem = pSector->GetGraphicList()->GetNextElement(pos))
{
csReference = pGraphicElem->GetSector()->GetReferencedSectionName();
SCR_M_SvL0_SaveEntry(p_stFile, "AddLstGraphic", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%s,%d,%d",
(char *) (LPCSTR) csReference, pGraphicElem->GetGraphicLevel(), pGraphicElem->GetGraphicMode());
pGraphicElem->fn_vSectionSaved();
}
// collision list
for (pCollisionElem = pSector->GetCollisionList()->GetHeadElement(pos); pCollisionElem;
pCollisionElem = pSector->GetCollisionList()->GetNextElement(pos))
{
csReference = pCollisionElem->GetSector()->GetReferencedSectionName();
SCR_M_SvL0_SaveEntry(p_stFile, "AddLstCollision", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%s,0",
(char *) (LPCSTR) csReference);
pCollisionElem->fn_vSectionSaved();
}
// activity list
for (pActivityElem = pSector->GetActivityList()->GetHeadElement(pos); pActivityElem;
pActivityElem = pSector->GetActivityList()->GetNextElement(pos))
{
csReference = pActivityElem->GetSector()->GetReferencedSectionName();
SCR_M_SvL0_SaveEntry(p_stFile, "AddLstActivity", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%s,0",
(char *) (LPCSTR) csReference);
pActivityElem->fn_vSectionSaved();
}
// sound list
for (pSoundElem = pSector->GetSoundList()->GetHeadElement(pos); pSoundElem;
pSoundElem = pSector->GetSoundList()->GetNextElement(pos))
{
csReference = pSoundElem->GetSector()->GetReferencedSectionName();
SCR_M_SvL0_SaveEntry(p_stFile, "AddLstSound", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%s,%d,0",
(char *) (LPCSTR) csReference, pSoundElem->GetSoundLevel());
pSoundElem->fn_vSectionSaved();
}
// sound event list
for (pElem = pSector->GetSoundEventList()->GetHeadElementBase(pos); pElem;
pElem = pSector->GetSoundEventList()->GetNextElementBase(pos))
{
// get sound event element
pSoundEventElem = (SECT_SoundEventElement *) pElem;
if (pSoundEventElem->GetSector())
csReference = pSoundEventElem->GetSector()->GetReferencedSectionName();
else
csReference = "FromAllSectors";
// save all sound events
for (pEngineElem = pSoundEventElem->GetSndEvtList()->GetHeadElement(pos1); pEngineElem;
pEngineElem = pSoundEventElem->GetSndEvtList()->GetNextElement(pos1))
{
// get references
csSoundEvent = pEngineElem->GetSoundEventReference();
// save element
SCR_M_SvL0_SaveEntry(p_stFile, "AddLstSoundEvent", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%s,%s",
(char *) (LPCSTR) csReference, (char *) (LPCSTR) csSoundEvent);
}
pSoundEventElem->fn_vSectionSaved();
}
// end section
SCR_M_SvL0_SaveEndSection (p_stFile, SCR_CC_C_Cfg_EOL);
if (eAction == SCR_EA_Ntfy_AddSection)
SCR_M_SvL0_SaveBlankLine (p_stFile);
// indent level
SCR_g_ui_SvL0_IndentationLevel = iSaveIndentLevel;
// reinit super-object
pSector->SetExistingSectorsLinkSection(TRUE);
break;
case SCR_EA_Ntfy_DeleteSection:
// reinit super-object
pSector->SetExistingSectorsLinkSection(FALSE);
// virtual
pSector->GetVirtualSection()->fn_vSectionDeleted();
// camera
pSector->GetCameraSection()->fn_vSectionDeleted();
// priority
pSector->GetPrioritySection()->fn_vSectionDeleted();
// graphic list
for (pGraphicElem = pSector->GetGraphicList()->GetHeadElement(pos); pGraphicElem;
pGraphicElem = pSector->GetGraphicList()->GetNextElement(pos))
pGraphicElem->fn_vSectionDeleted();
// collision list
for (pCollisionElem = pSector->GetCollisionList()->GetHeadElement(pos); pCollisionElem;
pCollisionElem = pSector->GetCollisionList()->GetNextElement(pos))
pCollisionElem->fn_vSectionDeleted();
// activity list
for (pActivityElem = pSector->GetActivityList()->GetHeadElement(pos); pActivityElem;
pActivityElem = pSector->GetActivityList()->GetNextElement(pos))
pActivityElem->fn_vSectionDeleted();
// sound list
for (pSoundElem = pSector->GetSoundList()->GetHeadElement(pos); pSoundElem;
pSoundElem = pSector->GetSoundList()->GetNextElement(pos))
pSoundElem->fn_vSectionDeleted();
// sound event list
for (pElem = pSector->GetSoundEventList()->GetHeadElementBase(pos); pElem;
pElem = pSector->GetSoundEventList()->GetNextElementBase(pos))
{
// get sound event element
pSoundEventElem = (SECT_SoundEventElement *) pElem;
pSoundEventElem->fn_vSectionDeleted();
}
break;
}
}
//#################################################################################
// List Base
//#################################################################################
SECT_ListBase::SECT_ListBase (void)
{
// init owner
m_pOwnerSector = NULL;
// init nb elements
m_lNbElements = 0;
}
/*===========================================================================
Add Element
===========================================================================*/
BOOL SECT_ListBase::fn_bAddAnElement (SECT_ElementBase *pNewElem, BOOL bUpdateEngine)
{
// check owner sector
if (pNewElem->GetOwnerSector() != m_pOwnerSector)
return FALSE;
// check linked sector
if (pNewElem->GetSector() && (pNewElem->GetSector()->GetObject() == m_pOwnerSector))
return FALSE;
// update nb elements
m_lNbElements++;
// update links
g_oCoherenceManager.m_fn_vAddALink(m_pOwnerSector, pNewElem->GetSector());
return TRUE;
}
/*===========================================================================
Remove Element
===========================================================================*/
void SECT_ListBase::fn_vRemoveAnElement (SECT_ElementBase *pOldElem, BOOL bUpdateEngine)
{
// update nb elements
m_lNbElements--;
// update links
g_oCoherenceManager.m_fn_vRemoveALink(m_pOwnerSector, pOldElem->GetSector());
}
/*===========================================================================
Remove All Elements
===========================================================================*/
void SECT_ListBase::fn_vRemoveAllElements (BOOL bUpdateEngine)
{
// update nb elements
m_lNbElements = 0;
}
/*===========================================================================
Get Element With Sector
===========================================================================*/
SECT_ElementBase * SECT_ListBase::GetElementWithSector (CPA_SuperObject *pSector)
{
SECT_ElementBase *pElem;
POSITION pos;
// search all element in list
for (pElem = GetHeadElementBase(pos); pElem; pElem = GetNextElementBase(pos))
{
if (pElem->GetSector() == pSector)
return pElem;
}
// sector was not found
return NULL;
}
//#################################################################################
// Environment Element Base
//#################################################################################
/*
SECT_EnvElementBase::SECT_EnvElementBase (Sector_Object *pOwnerSector)
: CPA_SectionObject ("", fn_szGetLevelsDataPath(), SECT_EnvElementBase::CallBackSaveEnvAndSurf,
pOwnerSector, pOwnerSector->fn_bHasEnvAndSurfSection())
{
// init owner
m_pOwnerSector = pOwnerSector;
// init section name
SetReferencedSectionName(m_pOwnerSector->GetEnvAndSurfSection());
}
*/
/*===========================================================================
* Description: callback for save
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_EnvElementBase::CallBackSaveEnvAndSurf (SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
{
Sector_Object *pSector;
SECT_SurfElem *pSurfElem;
SECT_EnvElem *pEnvElem;
POSITION pos;
CString csReference;
char szNewSectionName[SCR_CV_ui_Cfg_MaxLenName];
int iSaveIndentLevel;
// get sector
pSector = (Sector_Object *) p_vData;
switch (eAction)
{
case SCR_EA_Ntfy_AddSection:
case SCR_EA_Ntfy_RebuildSection:
// indent level
iSaveIndentLevel = SCR_g_ui_SvL0_IndentationLevel;
SCR_g_ui_SvL0_IndentationLevel = 1;
// save begin section
SCR_fn_v_RdL0_ComputeSectionName(szNewSectionName, NULL, C_szEnvAndSurfSubSection, " ");
SCR_M_SvL0_SaveBeginSection(p_stFile, szNewSectionName, SCR_CC_C_Cfg_EOL);
// environment list
for (pEnvElem = pSector->GetEnvironmentList()->GetHeadElement(pos); pEnvElem;
pEnvElem = pSector->GetEnvironmentList()->GetNextElement(pos))
{
csReference = pEnvElem->GetEnvironment()->GetReferencedSectionName();
SCR_M_SvL0_SaveEntry(p_stFile, "AddLstEnvironment", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%s",
(char *) (LPCSTR) csReference);
pEnvElem->fn_vSectionSaved();
}
// surface list
for (pSurfElem = pSector->GetSurfaceList()->GetHeadElement(pos); pSurfElem;
pSurfElem = pSector->GetSurfaceList()->GetNextElement(pos))
{
csReference = pSurfElem->GetSurface()->GetReferencedSectionName();
SCR_M_SvL0_SaveEntry(p_stFile, "AddLstSurface", SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%s",
(char *) (LPCSTR) csReference);
pSurfElem->fn_vSectionSaved();
}
// end section
SCR_M_SvL0_SaveEndSection (p_stFile, SCR_CC_C_Cfg_EOL);
if (eAction == SCR_EA_Ntfy_AddSection)
SCR_M_SvL0_SaveBlankLine (p_stFile);
// indent level
SCR_g_ui_SvL0_IndentationLevel = iSaveIndentLevel;
// reinit super-object
pSector->SetExistingEnvAndSurfSection(TRUE);
break;
case SCR_EA_Ntfy_DeleteSection:
// reinit super-object
pSector->SetExistingEnvAndSurfSection(FALSE);
// environment list
for (pEnvElem = pSector->GetEnvironmentList()->GetHeadElement(pos); pEnvElem;
pEnvElem = pSector->GetEnvironmentList()->GetNextElement(pos))
pEnvElem->fn_vSectionDeleted();
// surface list
for (pSurfElem = pSector->GetSurfaceList()->GetHeadElement(pos); pSurfElem;
pSurfElem = pSector->GetSurfaceList()->GetNextElement(pos))
pSurfElem->fn_vSectionDeleted();
break;
}
}
*/

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,462 @@
/*=========================================================================
*
* SECTsurf.cpp : Implementation of Editor Surface Lists
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
/*
#include "stdafx.h"
#include "acp_base.h"
#define SRF_FRIEND
#define SRF_MAIN
#include "SECTint.hpp"
#include "DPT.h"
#undef SRF_MAIN
#undef SRF_FRIEND
#include "SRF\SRF_Fct.h"
DeclareTemplateStatic(SCT_tdxHandleOfElementLstSurface);
DeclareTemplateStatic(SRF_tdxHandleToSurface);
static long NbSurf = 0;
//#################################################################################
// Surface
//#################################################################################
/===========================================================================
Default Constructor
===========================================================================/
SECT_Surface::SECT_Surface (Sector_Interface *p_oDLL,
SRF_tdxHandleToSurface hSurface, BOOL bAvailable,
CString csName, CString csFileName)
: CPA_SaveObject(p_oDLL, C_szSurfaceTypeName, E_ss_Responsible, NULL, bAvailable,
fn_szGetLevelsDataPath(), SECT_Surface::CallBackSaveSurfaceMatrix),
CPA_EdMot<SRF_tdxHandleToSurface>(hSurface)
{
ACP_tdxHandleOfObject hVisual;
CPA_DLLBase *pGeomDLL;
CString csVisualName, csSuperObjectName;
char szSectionName[SCR_CV_ui_Cfg_MaxLenName];
// section object
SetSectionData(this);
// section name
SCR_fn_v_RdL0_ComputeSectionName(szSectionName, (char *)(LPCSTR)csFileName, C_szSurfaceActionName, " ");
SetReferencedSectionName(szSectionName);
// matrix section
m_pMatrixSection = new CPA_SectionObject (GetMatrixSectionName(), fn_szGetLevelsDataPath(),
SECT_Surface::CallBackSaveSurfaceMatrix,
this, TRUE);
// create editor visual
hVisual = SRF_M_hGetVisualOfSurface(GetStruct());
pGeomDLL = p_oDLL->GetMainWorld()->GetObjectDLLWithName(C_szDLLGeometryName);
m_pVisualSurface = (CPA_BaseObject *) pGeomDLL->OnQueryAction(p_oDLL, C_uiCreateGeometricObject, (long) hVisual);
// create visual super-object
csVisualName = "SPO_Visual" + csName;
m_pVisualSuperObject = p_oDLL->GetInterface()->GetNewSuperObject(E_ss_NoSave, C_Dynamic, csVisualName, "");
m_pVisualSuperObject->SetObject(m_pVisualSurface);
HIE_fn_vSetSuperObjectMatrix(m_pVisualSuperObject->GetStruct(), SRF_M_hGetPositionOfSurface(GetStruct()));
// name
if (fn_eRename(csName ) != E_mc_None)
SetDefaultValidName();
fn_vUpdateSectionName();
// create super-object
csSuperObjectName = "SPO_" + GetName();
m_pSuperObject = p_oDLL->GetInterface()->GetNewSuperObject(E_ss_NoSave, C_Dynamic, csSuperObjectName, "");
m_pSuperObject->SetObject(this);
// update hierarchy
m_pSuperObject->AddANewChild(m_pVisualSuperObject);
m_pVisualSuperObject->SetSuperObjectOwner(m_pSuperObject);
// existence
SetExistingSection(TRUE);
}
/===========================================================================
Destructor
===========================================================================/
SECT_Surface::~SECT_Surface (void)
{
}
/===========================================================================
Matrix
===========================================================================/
CString SECT_Surface::GetMatrixSectionName (void)
{
CString csSectionName;
char szSectionName[SCR_CV_ui_Cfg_MaxLenName];
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
char szName[SCR_CV_ui_Cfg_MaxLenName];
// get corresponding section
SCR_fn_v_RdL0_SplitSectionName((char*)(LPCSTR) GetReferencedSectionName(), szFileName, szActionName, szName);
SCR_fn_v_RdL0_ComputeSectionName(szSectionName, szFileName, "Matrix", szName);
csSectionName = szSectionName;
return csSectionName;
}
/===========================================================================
Height (Get)
===========================================================================/
MTH_tdxReal SECT_Surface::GetHeight (void)
{
// get engine height
return SRF_fn_xGetSurfaceHeight(GetStruct());
}
/===========================================================================
Height (Set)
===========================================================================/
void SECT_Surface::SetHeight (MTH_tdxReal xNewHeight)
{
MTH3D_tdstVector stSurfacePos;
// update engine height
SRF_fn_vSetSurfaceHeight(GetStruct(), xNewHeight);
// set initial height
POS_fn_vGetTranslationVector(SRF_M_hGetPositionOfSurface(GetStruct()), &stSurfacePos);
POS_fn_vSetTranslationVector(SRF_M_hGetInitPositionOfSurface(GetStruct()), &stSurfacePos);
// update visual super-object
HIE_fn_vSetSuperObjectMatrix(m_pVisualSuperObject->GetStruct(), SRF_M_hGetPositionOfSurface(GetStruct()));
// notify the change
fn_vNotifySave();
}
//#################################################################################
// Save
//#################################################################################
/===========================================================================
Update Section Name
=========================================================================/
void SECT_Surface::fn_vUpdateSectionName (void)
{
// update main section
CPA_SaveObject::fn_vUpdateSectionName();
// update matrix section
m_pMatrixSection->SetReferencedSectionName(GetMatrixSectionName());
}
/===========================================================================
Notifications
=========================================================================/
void SECT_Surface::fn_vNotifySave (void)
{
// matrix section
m_pMatrixSection->fn_vWriteSection();
}
//===========================================================================
void SECT_Surface::fn_vNotifyUnSave (void)
{
// matrix section
m_pMatrixSection->fn_vDeleteSection();
}
//===========================================================================
void SECT_Surface::fn_vNotifyRestore (void)
{
// matrix section
m_pMatrixSection->fn_vRestoreSection();
}
//===========================================================================
void SECT_Surface::fn_vNotifyRename (void)
{
// matrix section
m_pMatrixSection->fn_vRenameSection(GetMatrixSectionName());
}
/*===========================================================================
* Description: CallBack Save for matrix
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_Surface::CallBackSaveSurfaceMatrix (SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction)
{
GEO_tdxHandleToMatrix hMatrix;
MTH3D_tdstVector stVecI,stVecJ,stVecK;
SECT_Surface *pSurface;
CString csName;
double dUnit;
char szNewSectionName[SCR_CV_ui_Cfg_MaxLenName];
char szMatrixName[SCR_CV_ui_Cfg_MaxLenName];
char szName[SCR_CV_ui_Cfg_MaxLenName];
// get parameters
pSurface = (SECT_Surface *) p_vData;
dUnit = GLI_dGetUnitInMeterInFile(NULL);
if (dUnit == 0)
dUnit = 1;
switch (eAction)
{
case SCR_EA_Ntfy_RebuildSection:
// corresponding matrix
hMatrix = SRF_M_hGetPositionOfSurface(pSurface->GetStruct());
// get section name
SCR_fn_v_RdL0_SplitSectionName(szSectionName, NULL, szNewSectionName, szName);
strcpy(szMatrixName, szName);
// save begin section
SCR_fn_v_RdL0_ComputeSectionName(szNewSectionName, NULL, "Matrix", szMatrixName);
SCR_M_SvL0_SaveBeginSection(p_stFile, szNewSectionName, SCR_CC_C_Cfg_EOL);
// save translation
SCR_M_SvL0_SaveEntry(p_stFile, "MatrixTranslation", SCR_CC_C_Cfg_NoChar);
POS_fn_vGetTranslationVector(hMatrix,&stVecI);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1,
"%f,%f,%f",
GLI_M_ValueToFloat(MTH3D_M_xGetXofVector(&stVecI)) / dUnit,
GLI_M_ValueToFloat(MTH3D_M_xGetYofVector(&stVecI)) / dUnit,
GLI_M_ValueToFloat(MTH3D_M_xGetZofVector(&stVecI)) / dUnit);
// save scale
SCR_M_SvL0_SaveEntry(p_stFile, "MatrixScale", SCR_CC_C_Cfg_NoChar);
POS_fn_vGetScaleMatrix(hMatrix,&stVecI,&stVecJ,&stVecK);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1,
"%f,%f,%f,%f,%f,%f,%f,%f,%f",
GLI_M_ValueToFloat(MTH3D_M_xGetXofVector(&stVecI)),
GLI_M_ValueToFloat(MTH3D_M_xGetYofVector(&stVecI)),
GLI_M_ValueToFloat(MTH3D_M_xGetZofVector(&stVecI)),
GLI_M_ValueToFloat(MTH3D_M_xGetXofVector(&stVecJ)),
GLI_M_ValueToFloat(MTH3D_M_xGetYofVector(&stVecJ)),
GLI_M_ValueToFloat(MTH3D_M_xGetZofVector(&stVecJ)),
GLI_M_ValueToFloat(MTH3D_M_xGetXofVector(&stVecK)),
GLI_M_ValueToFloat(MTH3D_M_xGetYofVector(&stVecK)),
GLI_M_ValueToFloat(MTH3D_M_xGetZofVector(&stVecK)));
// save rotation
SCR_M_SvL0_SaveEntry(p_stFile, "MatrixRotation", SCR_CC_C_Cfg_NoChar);
POS_fn_vGetRotationMatrix (hMatrix,&stVecI,&stVecJ,&stVecK);
SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1,
"%f,%f,%f,%f,%f,%f,%f,%f,%f",
GLI_M_ValueToFloat(MTH3D_M_xGetXofVector(&stVecI)),
GLI_M_ValueToFloat(MTH3D_M_xGetYofVector(&stVecI)),
GLI_M_ValueToFloat(MTH3D_M_xGetZofVector(&stVecI)),
GLI_M_ValueToFloat(MTH3D_M_xGetXofVector(&stVecJ)),
GLI_M_ValueToFloat(MTH3D_M_xGetYofVector(&stVecJ)),
GLI_M_ValueToFloat(MTH3D_M_xGetZofVector(&stVecJ)),
GLI_M_ValueToFloat(MTH3D_M_xGetXofVector(&stVecK)),
GLI_M_ValueToFloat(MTH3D_M_xGetYofVector(&stVecK)),
GLI_M_ValueToFloat(MTH3D_M_xGetZofVector(&stVecK)));
// save end section
SCR_M_SvL0_SaveEndSection (p_stFile, SCR_CC_C_Cfg_EOL);
// update section object
pSurface->fn_vSectionSaved();
pSurface->GetMatrixSection()->fn_vSectionSaved();
break;
}
}
//#################################################################################
// Surface Element
//#################################################################################
/===========================================================================
Default Constructor
===========================================================================/
SECT_SurfElem::SECT_SurfElem (SCT_tdxHandleOfElementLstSurface hSurfElem, Sector_Object *pOwnerSector)
: CPA_EdMot<SCT_tdxHandleOfElementLstSurface>(hSurfElem),
SECT_EnvElementBase (pOwnerSector)
{
SRF_tdxHandleToSurface hSurface;
// init environment
hSurface = SCT_GetSurfaceInList(hSurfElem);
m_pSurface = pOwnerSector->GetSectorInterface()->GetOrBuildSurface(hSurface);
}
/===========================================================================
New Constructor
===========================================================================/
SECT_SurfElem::SECT_SurfElem (SECT_Surface *pSurface, Sector_Object *pOwnerSector)
: CPA_EdMot<SCT_tdxHandleOfElementLstSurface>(),
SECT_EnvElementBase (pOwnerSector)
{
// init environment
m_pSurface = pSurface;
SCT_fn_vSetHandleOfSurfaceInSurfaceList(GetStruct(), m_pSurface->GetStruct());
}
/===========================================================================
Destructor
===========================================================================/
SECT_SurfElem::~SECT_SurfElem (void)
{
}
/===========================================================================
Surface
===========================================================================/
void SECT_SurfElem::SetSurface (SECT_Surface *pSurface)
{
// if there was a surface, warn coherence manager
if ((m_pSurface)&&(m_pOwnerSector))
g_oCoherenceManager.m_fn_vRemoveALink(m_pOwnerSector, m_pSurface);
// set environment
m_pSurface = pSurface;
// update engine element
SCT_fn_vSetHandleOfSurfaceInSurfaceList(GetStruct(), m_pSurface->GetStruct());
// warn coherence manager
if (m_pOwnerSector)
g_oCoherenceManager.m_fn_vAddALink(m_pOwnerSector, m_pSurface);
// notify modif
if (g_bCanSave)
fn_vWriteSection();
}
//#################################################################################
// Surface List
//#################################################################################
/===========================================================================
Add Surface Element
===========================================================================/
BOOL SECT_SurfaceList::fn_bAddAnElement (SECT_SurfElem *pNewElem, SECT_SurfElem *pPreviousElem, BOOL bUpdateEngine)
{
POSITION pos;
// check element owner
if (pNewElem->GetOwnerSector() != m_pOwnerSector)
return FALSE;
// no previous element => add head
if (!pPreviousElem)
AddHead(pNewElem, bUpdateEngine);
// previous element => add at corresponding position
else
{
pos = Find(pPreviousElem, NULL);
InsertAfter(pos, pNewElem, bUpdateEngine);
}
// warn coherence manager
g_oCoherenceManager.m_fn_vAddALink(m_pOwnerSector, pNewElem->GetSurface());
return TRUE;
}
/===========================================================================
Remove Surface Element
===========================================================================/
void SECT_SurfaceList::fn_vRemoveAnElement (SECT_SurfElem *pOldElem, BOOL bUpdateEngine)
{
POSITION pos;
// add element to the list
pos = Find(pOldElem, NULL);
if (pos)
RemoveAt(pos, bUpdateEngine);
// warn coherence manager
g_oCoherenceManager.m_fn_vRemoveALink(m_pOwnerSector, pOldElem->GetSurface());
}
/===========================================================================
Remove All Elements
===========================================================================/
void SECT_SurfaceList::fn_vRemoveAllElements (BOOL bUpdateEngine)
{
SECT_SurfElem *pElem;
while (GetCount() > 0)
{
pElem = RemoveTail(bUpdateEngine);
g_oCoherenceManager.m_fn_vRemoveALink(m_pOwnerSector, pElem->GetSurface());
}
}
/===========================================================================
Find Surface Element
===========================================================================/
SECT_SurfElem * SECT_SurfaceList::GetElementWithSurface (SECT_Surface *pSurface)
{
SECT_SurfElem *pElem;
POSITION pos;
// check every element
for (pElem = GetHeadElement(pos); pElem; pElem = GetNextElement(pos))
{
if (pElem->GetSurface() == pSurface)
return pElem;
}
// element was not found
return NULL;
}
/===========================================================================
Find Previous Surface Element
===========================================================================/
long SECT_SurfaceList::GetInsertPosition (SECT_SurfElem *pSurfElem)
{
SECT_SurfElem *pElem;
POSITION pos;
long lPosition = 0;
// check every element
for (pElem = GetHeadElement(pos); pElem; pElem = GetNextElement(pos))
{
if (pElem->GetSurface()->GetHeight() <= pSurfElem->GetSurface()->GetHeight())
return lPosition;
lPosition++;
}
// element was not found
return GetCount();
}
/===========================================================================
Find Surface Element
===========================================================================/
long SECT_SurfaceList::GetCurrentPosition (SECT_SurfElem *pSurfElem)
{
SECT_SurfElem *pElem;
POSITION pos;
long lPosition = 0;
// check every element
for (pElem = GetHeadElement(pos); pElem; pElem = GetNextElement(pos))
{
if (pElem == pSurfElem)
return lPosition;
lPosition++;
}
// element was not found
return -1;
}
*/

View File

@@ -0,0 +1,113 @@
/*=========================================================================
*
* SECdDist.cpp : Distance dialog - Implementation file
*
*
* Version 1.0
* Creation date 16/08/97
* Revision date 18/08/97
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "acp_base.h"
#include "SECdDist.hpp"
#include "SECTint.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
//#################################################################################
// SECT_DialogReplace dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
SECT_DialogDistance::SECT_DialogDistance(CWnd* pParent /*=NULL*/)
: CDialog(SECT_DialogDistance::IDD, pParent)
{
// init editor
m_pSectorInterface = NULL;
m_lLinkDistance = 1;
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogDistance::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogDistance)
DDX_Control(pDX, SECT_IDC_DISTANCE, m_cEditDistance);
//}}AFX_DATA_MAP
}
/*----------------------------------------
----------------------------------------*/
BEGIN_MESSAGE_MAP(SECT_DialogDistance, CDialog)
//{{AFX_MSG_MAP(SECT_DialogDistance)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//#################################################################################
// SECT_DialogDistance message handlers
//#################################################################################
/*----------------------------------------
----------------------------------------*/
BOOL SECT_DialogDistance::OnInitDialog (void)
{
CString csText;
CDialog::OnInitDialog();
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_cEditDistance.m_hWnd, "OSC_DDIST_EDIT_DISTANCE", TUT_e_TextEdit);
// END TUTORIAL
// Init Distance
csText.Format("%ld", m_lLinkDistance);
m_cEditDistance.SetWindowText(csText);
return TRUE;
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogDistance::OnOK (void)
{
char szText[15];
// get distance
m_cEditDistance.GetWindowText(szText, 15);
m_lLinkDistance = atol(szText);
CDialog::OnOK();
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogDistance::fn_vInitSectorInterface (Sector_Interface *pInterface)
{
m_pSectorInterface = pInterface;
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogDistance::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_cEditDistance.m_hWnd);
// END TUTORIAL
CDialog::OnDestroy();
}

View File

@@ -0,0 +1,560 @@
/*=========================================================================
*
* SECdEdit.cpp : Edited Sector Dialog - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SECdEdit.hpp"
#include "SECmodif.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
#define C_xMinZfar 10.0
#define C_MinPriorityLevel C_SectorMinPriority - C_SectorNormalPriority + 1
#define C_MaxPriorityLevel C_SectorMaxPriority - C_SectorNormalPriority - 1
//#################################################################################
// SECT_DialogEdit dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
SECT_DialogEdit::SECT_DialogEdit(CWnd* pParent)
: CFormView(SECT_DialogEdit::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogEdit)
//}}AFX_DATA_INIT
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogEdit)
DDX_Control(pDX, SECT_IDC_EDITEDSECTOR, m_cComboSector);
DDX_Control(pDX, SECT_IDC_EDITVIRTUAL, m_cVirtual);
DDX_Control(pDX, SECT_IDC_ZMAXCHECK, m_cZmaxCheck);
DDX_Control(pDX, SECT_IDC_ZMAXVALUE, m_cZmaxEdit);
DDX_Control(pDX, SECT_IDC_ZFARCHECK, m_cZfarCheck);
DDX_Control(pDX, SECT_IDC_ZFARVALUE, m_cZfarEdit);
DDX_Control(pDX, SECT_IDC_ZMAXDEFAULT, m_cDefault);
DDX_Control(pDX, SECT_IDC_CAMERATYPE, m_cCamTypeEdit);
DDX_Control(pDX, SECT_IDC_PRIORITY, m_cPriorityEdit);
DDX_Control(pDX, SECT_IDC_PSPIN, m_cPrioritySpin);
//}}AFX_DATA_MAP
}
/*----------------------------------------
----------------------------------------*/
BEGIN_MESSAGE_MAP(SECT_DialogEdit, CFormView)
//{{AFX_MSG_MAP(SECT_DialogEdit)
ON_WM_SIZE()
ON_WM_DESTROY()
ON_CBN_SELCHANGE(SECT_IDC_EDITEDSECTOR, OnSelChangeComboSector)
ON_BN_CLICKED(SECT_IDC_EDITVIRTUAL, OnVirtual)
ON_BN_CLICKED(SECT_IDC_ZMAXCHECK, OnZmaxCheck)
ON_EN_KILLFOCUS(SECT_IDC_ZMAXVALUE, OnEditZmax)
ON_BN_CLICKED(SECT_IDC_ZFARCHECK, OnZfarCheck)
ON_EN_KILLFOCUS(SECT_IDC_ZFARVALUE, OnEditZfar)
ON_BN_CLICKED(SECT_IDC_ZMAXDEFAULT, OnDefault)
ON_EN_KILLFOCUS(SECT_IDC_CAMERATYPE, OnEditCamType)
// ON_EN_KILLFOCUS(SECT_IDC_PRIORITY, OnEditPriority)
ON_NOTIFY(UDN_DELTAPOS, SECT_IDC_PSPIN, OnPrioritySpin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//#################################################################################
// SECT_DialogEdit Inits
//#################################################################################
/*===========================================================================
* Description: Init dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void SECT_DialogEdit::fn_vInitDialog (Sector_Interface *p_oDLL, CWnd *pParent, const CString csTag)
{
// create the dialog
m_bInitialised = FALSE;
m_pSectorInterface = p_oDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_cComboSector.m_hWnd, "OSC_DEDIT"+ csTag + "_COMBO_EDITEDSECTOR", TUT_e_ComboBox);
TUT_M_vRegisterControl(m_cVirtual.m_hWnd, "OSC_DEDIT"+ csTag + "_CHECK_VIRTUALSECTOR", TUT_e_Button );
TUT_M_vRegisterControl(m_cZmaxCheck.m_hWnd, "OSC_DEDIT"+ csTag + "_CHECK_ZMAXSECTOR", TUT_e_Button );
TUT_M_vRegisterControl(m_cZmaxEdit.m_hWnd, "OSC_DEDIT"+ csTag + "_EDIT_ZMAXSECTOR", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cZfarCheck.m_hWnd, "OSC_DEDIT"+ csTag + "_CHECK_ZFARSECTOR", TUT_e_Button );
TUT_M_vRegisterControl(m_cZfarEdit.m_hWnd, "OSC_DEDIT"+ csTag + "_EDIT_ZFARSECTOR", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cCamTypeEdit.m_hWnd, "OSC_DEDIT"+ csTag + "_EDIT_CAMERASECTOR", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cPrioritySpin.m_hWnd, "OSC_DEDIT"+ csTag + "_SPIN_PRIORITYSECTOR", TUT_e_Spin);
// END TUTORIAL
// inti spin parameters
m_cPrioritySpin.SetBuddy(&m_cPriorityEdit);
m_cPrioritySpin.SetRange(C_MinPriorityLevel, C_MaxPriorityLevel);
m_cPrioritySpin.SetPos(0);
// init all controls
fn_vReinitDialog(NULL);
m_bInitialised = TRUE;
}
/*===========================================================================
* Description: Init all controls
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void SECT_DialogEdit::fn_vReinitDialog (CPA_SuperObject *pSector)
{
CPA_BaseObjectList *pListObject;
CPA_BaseObject *pElem;
Sector_Object *pSectObj;
Position pos;
CString csText;
BOOL bZmax;
BOOL bZfar;
int iInd;
// init sector
m_pEditedSector = pSector;
// reinit combo
m_cComboSector.ResetContent();
pListObject = m_pSectorInterface->GetBaseObjectList(C_szSectorTypeName);
if (pListObject->GetCount() > 0)
{
for (pElem = pListObject->GetHeadElement(pos); pElem; pElem = pListObject->GetNextElement(pos))
m_cComboSector.AddString(pElem->GetName());
}
// select current sector
if (!m_pEditedSector)
{
strcpy(m_szName, "");
m_cComboSector.SetCurSel(-1);
// virtual
m_cVirtual.SetCheck(0);
m_cVirtual.EnableWindow(FALSE);
// zmax
m_cZmaxCheck.SetCheck(0);
m_cZmaxCheck.EnableWindow(FALSE);
m_cZmaxEdit.SetWindowText("");
m_cZmaxEdit.EnableWindow(FALSE);
// zfar
m_cZfarCheck.SetCheck(0);
m_cZfarCheck.EnableWindow(FALSE);
m_cZfarEdit.SetWindowText("");
m_cZfarEdit.EnableWindow(FALSE);
// camera
m_cCamTypeEdit.SetWindowText("");
m_cCamTypeEdit.EnableWindow(FALSE);
// priority
m_cPrioritySpin.SetPos(0);
m_cPrioritySpin.EnableWindow(FALSE);
}
else
{
pSectObj = (Sector_Object *) m_pEditedSector->GetObject();
// sector
strcpy(m_szName, pSectObj->GetName());
iInd = m_cComboSector.FindStringExact(-1,m_szName);
m_cComboSector.SetCurSel(iInd);
// vitual
m_cVirtual.SetCheck(pSectObj->fn_bIsVirtual());
m_cVirtual.EnableWindow(TRUE);
// Zmax
m_cZmaxCheck.EnableWindow(TRUE);
bZmax = (pSectObj->GetZmaxOfBorder() != MTH_C_InfinitMinus);
m_cZmaxCheck.SetCheck(bZmax);
m_cZmaxEdit.EnableWindow(bZmax);
if (bZmax)
csText.Format("%5.2f", (float) pSectObj->GetZmaxOfBorder());
else
csText = "";
m_cZmaxEdit.SetWindowText(csText);
// Zfar
m_cZfarCheck.EnableWindow(TRUE);
bZfar = (pSectObj->GetZfarInSector() != MTH_C_ZERO );
m_cZfarCheck.SetCheck(bZfar);
m_cZfarEdit.EnableWindow(bZfar);
if (bZfar)
csText.Format("%5.2f", (float) pSectObj->GetZfarInSector());
else
csText = "";
m_cZfarEdit.SetWindowText(csText);
// camera type
m_cCamTypeEdit.EnableWindow(TRUE);
csText.Format("%d", (int) pSectObj->GetCameraType());
m_cCamTypeEdit.SetWindowText(csText);
// priority
m_cPrioritySpin.EnableWindow(TRUE);
m_cPrioritySpin.SetPos(pSectObj->GetPriority() - C_SectorNormalPriority);
//csText.Format("%d", (int) pSectObj->GetPriority());
//m_cPriorityEdit.SetWindowText(csText);
}
}
//#################################################################################
// SECT_DialogEdit Messages
//#################################################################################
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnSize (UINT nFlags, int cx, int cy)
{
RECT WindowPosition;
int ecx;
if (!m_bInitialised)
return;
// calculate name position
GetWindowRect(&WindowPosition);
ecx = WindowPosition.right - WindowPosition.left - 10;
ecx = (ecx < 60) ? 60 : ecx;
// move name
m_cComboSector.MoveWindow(5, 5, ecx-55, 20);
m_cVirtual.MoveWindow(ecx-45, 5, 50, 20);
// move Zmax
m_cZmaxCheck.MoveWindow(5, 30, 100, 20);
m_cZmaxEdit.MoveWindow(110, 30, 50, 20);
// move Zfar
m_cZfarCheck.MoveWindow(5, 50, 100, 20);
m_cZfarEdit.MoveWindow(110, 50, 50, 20);
// move camera
GetDlgItem(SECT_IDC_STATICCAM)->MoveWindow(5, 70, 100, 20);
m_cCamTypeEdit.MoveWindow(110, 70, 50, 20);
// move priority
GetDlgItem(SECT_IDC_STATICPRIORITY)->MoveWindow(5, 90, 100, 20);
m_cPriorityEdit.MoveWindow(110, 90, 30, 20);
m_cPrioritySpin.MoveWindow(140, 90, 20, 20);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnSelChangeComboSector (void)
{
char szName[256];
if (!m_bInitialised)
return;
// name was changed ?
m_cComboSector.GetLBText(m_cComboSector.GetCurSel(), szName);
m_pEditedSector = m_pSectorInterface->GetSectorWithName(szName);
m_pSectorInterface->fn_vReinitEditor(m_pEditedSector);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnVirtual (void)
{
SECT_ModifVirtualSector *pModif;
Sector_Object *pSector;
pSector = (Sector_Object *) m_pEditedSector->GetObject();
// check if virtual status can be changed
if (m_pSectorInterface->fn_bCanChangeVirtual(m_pEditedSector, m_cVirtual.GetCheck()))
{
pModif = new SECT_ModifVirtualSector(m_pSectorInterface, E_tm_VirtualStatus,
m_pEditedSector, m_cVirtual.GetCheck());
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
else
m_cVirtual.SetCheck(((Sector_Object *)m_pEditedSector->GetObject())->fn_bIsVirtual());
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnZmaxCheck (void)
{
Sector_Object *pSector;
MTH_tdxReal xZmax;
CString csText;
pSector = (Sector_Object *) m_pEditedSector->GetObject();
// update sector
xZmax = pSector->GetZmaxOfSector();
pSector->SetZmaxOfBorder(xZmax);
// cancel Zmax
if (!m_cZmaxCheck.GetCheck())
{
// update sector
pSector->SetZmaxOfBorder(MTH_C_InfinitMinus);
// update dialog
m_cZmaxEdit.SetWindowText("");
m_cZmaxEdit.EnableWindow(FALSE);
}
// init Zmax
else
{
// update dialog
m_cZmaxEdit.EnableWindow(TRUE);
csText.Format("%5.2f", (float) pSector->GetZmaxOfBorder());
m_cZmaxEdit.SetWindowText(csText);
}
m_pSectorInterface->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnEditZmax()
{
Sector_Object *pSector;
MTH_tdxReal xNewZmax;
char szVal[15];
pSector = (Sector_Object *) m_pEditedSector->GetObject();
if (m_cZmaxEdit.GetModify())
{
m_cZmaxEdit.GetWindowText(szVal, 15);
xNewZmax = (float) atof(szVal);
pSector->SetZmaxOfBorder(xNewZmax);
}
m_pSectorInterface->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnZfarCheck (void)
{
Sector_Object *pSector;
CString csText;
pSector = (Sector_Object *) m_pEditedSector->GetObject();
// cancel Zmax
if (!m_cZfarCheck.GetCheck())
{
// update sector
pSector->SetZfarInSector(MTH_C_ZERO);
// update dialog
m_cZfarEdit.SetWindowText("");
m_cZfarEdit.EnableWindow(FALSE);
}
// init Zmax
else
{
// update dialog
m_cZfarEdit.EnableWindow(TRUE);
pSector->SetZfarInSector(C_xMinZfar);
csText.Format("%5.2f", (float) pSector->GetZfarInSector());
m_cZfarEdit.SetWindowText(csText);
}
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnEditZfar()
{
Sector_Object *pSector;
MTH_tdxReal xNewZfar;
CString csText;
char szVal[15];
pSector = (Sector_Object *) m_pEditedSector->GetObject();
if (m_cZfarEdit.GetModify())
{
m_cZfarEdit.GetWindowText(szVal, 15);
xNewZfar = (float) atof(szVal);
if (xNewZfar >= C_xMinZfar)
pSector->SetZfarInSector(xNewZfar);
else
{
csText.Format("%5.2f", (float) pSector->GetZfarInSector());
m_cZfarEdit.SetWindowText(csText);
}
}
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnEditCamType()
{
Sector_Object *pSector;
char szVal[15];
int iNewType;
pSector = (Sector_Object *) m_pEditedSector->GetObject();
if (m_cCamTypeEdit.GetModify())
{
m_cCamTypeEdit.GetWindowText(szVal, 15);
iNewType = (int) atoi(szVal);
pSector->SetCameraType((char) iNewType);
}
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnPrioritySpin (NMHDR * pNMHDR, LRESULT * pResult)
{
Sector_Object *pSectObj = NULL;
LPNM_UPDOWN pUpDown;
int iFinalPos;
int iNewPriority;
// get action code
pUpDown = (LPNM_UPDOWN)pNMHDR;
if (pUpDown->hdr.code != UDN_DELTAPOS)
return;
// get parameters
pSectObj = (Sector_Object *) m_pEditedSector->GetObject();
// get final pos
iFinalPos = pUpDown->iPos + pUpDown->iDelta;
iNewPriority = iFinalPos + C_SectorNormalPriority;
// update sector
pSectObj->SetPriority((char) iNewPriority);
}
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEdit::OnEditPriority()
{
Sector_Object *pSector;
CString csText;
char szVal[15];
int iNewPriority;
pSector = (Sector_Object *) m_pEditedSector->GetObject();
if (m_cPriorityEdit.GetModify())
{
// get value
m_cPriorityEdit.GetWindowText(szVal, 15);
iNewPriority = (int) atoi(szVal);
// check limits
if (iNewPriority > C_SectorMaxPriority)
{
iNewPriority = C_SectorMaxPriority;
csText.Format("%d", iNewPriority);
m_cPriorityEdit.SetWindowText(csText);
}
if (iNewPriority < C_SectorMinPriority)
{
iNewPriority = C_SectorMinPriority;
csText.Format("%d", iNewPriority);
m_cPriorityEdit.SetWindowText(csText);
}
pSector->SetPriority((char) iNewPriority);
}
}
*/
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnDefault()
{
if (m_cZmaxEdit.GetModify())
{
OnEditZmax();
m_pSectorInterface->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
m_cZmaxEdit.SetFocus();
}
if (m_cZfarEdit.GetModify())
{
OnEditZfar();
m_cZfarEdit.SetFocus();
}
if (m_cCamTypeEdit.GetModify())
{
OnEditCamType();
m_cCamTypeEdit.SetFocus();
}
/*
if (m_cPriorityEdit.GetModify())
{
OnEditPriority();
m_cPriorityEdit.SetFocus();
}
*/
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogEdit::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_cComboSector.m_hWnd);
TUT_M_vUnregisterControl(m_cVirtual.m_hWnd);
TUT_M_vUnregisterControl(m_cZmaxCheck.m_hWnd);
TUT_M_vUnregisterControl(m_cZmaxEdit.m_hWnd);
TUT_M_vUnregisterControl(m_cZfarCheck.m_hWnd);
TUT_M_vUnregisterControl(m_cZfarEdit.m_hWnd);
TUT_M_vUnregisterControl(m_cCamTypeEdit.m_hWnd);
TUT_M_vUnregisterControl(m_cPrioritySpin.m_hWnd);
// END TUTORIAL
CFormView::OnDestroy();
}

View File

@@ -0,0 +1,946 @@
/*=========================================================================
*
* SECTdEnv.cpp : Environment dialog - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
/*
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SECdEnv.hpp"
#include "SECmodif.hpp"
#include "SECdMec.hpp"
#include "SECdVis.hpp"
#include "SEClEnvs.hpp"
#include "SECdEnvs.hpp"
#include "SECdSrfs.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
SECT_MecEnvironment *g_pClickedMecEnv;
SECT_VisEnvironment *g_pClickedVisEnv;
//#################################################################################
// SECT_DialogEnv dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_DialogEnv::SECT_DialogEnv(CWnd* pParent)
: CFormView(SECT_DialogEnv::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogEnv)
//}}AFX_DATA_INIT
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogEnv)
DDX_Control(pDX, SECT_IDC_ENVNAME, m_cName);
DDX_Control(pDX, SECT_IDC_ENVDEFAULT, m_cDefault);
DDX_Control(pDX, SECT_IDC_ENVCANCEL, m_cCancel);
DDX_Control(pDX, SECT_IDC_ENVSAVE, m_cSave);
DDX_Control(pDX, SECT_IDC_MECLISTBOX, m_cMecListBox);
DDX_Control(pDX, SECT_IDC_EDITMEC, m_cEditMec);
DDX_Control(pDX, SECT_IDC_NEWMEC, m_cNewMec);
DDX_Control(pDX, SECT_IDC_VISLISTBOX, m_cVisListBox);
DDX_Control(pDX, SECT_IDC_EDITVIS, m_cEditVis);
DDX_Control(pDX, SECT_IDC_NEWVIS, m_cNewVis);
DDX_Control(pDX, SECT_IDC_SOUNDLIST, m_cSndListBox);
//}}AFX_DATA_MAP
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BEGIN_MESSAGE_MAP(SECT_DialogEnv, CFormView)
//{{AFX_MSG_MAP(SECT_DialogEnv)
ON_WM_SIZE()
ON_WM_DESTROY()
ON_EN_KILLFOCUS(SECT_IDC_ENVNAME, OnChangeName)
ON_BN_CLICKED(SECT_IDC_ENVDEFAULT, OnDefault)
ON_BN_CLICKED(SECT_IDC_ENVCANCEL, OnCancel)
ON_BN_CLICKED(SECT_IDC_ENVSAVE, OnSave)
ON_NOTIFY(LVN_ITEMCHANGED, SECT_IDC_MECLISTBOX, OnSelChangeMecListBox)
ON_NOTIFY(NM_DBLCLK, SECT_IDC_MECLISTBOX, OnDblClkMecListBox)
ON_BN_CLICKED(SECT_IDC_EDITMEC, OnEditMec)
ON_BN_CLICKED(SECT_IDC_NEWMEC, OnNewMec)
ON_NOTIFY(LVN_ITEMCHANGED, SECT_IDC_VISLISTBOX, OnSelChangeVisListBox)
ON_NOTIFY(NM_DBLCLK, SECT_IDC_VISLISTBOX, OnDblClkVisListBox)
ON_BN_CLICKED(SECT_IDC_EDITVIS, OnEditVis)
ON_BN_CLICKED(SECT_IDC_NEWVIS, OnNewVis)
ON_CBN_SELCHANGE(SECT_IDC_SOUNDLIST, OnSelChangeSndListBox)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
*/
//#################################################################################
// SECT_DialogEnv Inits
//#################################################################################
/*===========================================================================
* Description: Init dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vInitDialog (Sector_Interface *p_oDLL, CWnd *pParent)
{
// create the dialog
m_bInitialised = FALSE;
m_pSectorInterface = p_oDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// FOR TUTORIAL
TUT_M_vGetTutDll();
// environment
TUT_M_vRegisterControl(m_cName.m_hWnd, "OSC_DENV_EDIT_NAME", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cDefault.m_hWnd, "OSC_DENV_BUTTON_DEFAULT", TUT_e_Button);
TUT_M_vRegisterControl(m_cCancel.m_hWnd, "OSC_DENV_BUTTON_CANCEL", TUT_e_Button);
TUT_M_vRegisterControl(m_cSave.m_hWnd, "OSC_DENV_BUTTON_SAVE", TUT_e_Button);
// mechanic environment
TUT_M_vRegisterControl(m_cMecListBox.m_hWnd, "OSC_DENV_LIST_MECENVS", TUT_e_ListBox);
TUT_M_vRegisterControl(m_cEditMec.m_hWnd, "OSC_DENV_BUTTON_EDITMEC", TUT_e_Button);
TUT_M_vRegisterControl(m_cNewMec.m_hWnd, "OSC_DENV_BUTTON_NEWMEC", TUT_e_Button);
// visual environment
TUT_M_vRegisterControl(m_cVisListBox.m_hWnd, "OSC_DENV_LIST_VISENVS", TUT_e_ListBox);
TUT_M_vRegisterControl(m_cEditVis.m_hWnd, "OSC_DENV_BUTTON_EDITVIS", TUT_e_Button);
TUT_M_vRegisterControl(m_cNewVis.m_hWnd, "OSC_DENV_BUTTON_NEWVIS", TUT_e_Button);
// sound environment
TUT_M_vRegisterControl(m_cSndListBox.m_hWnd, "OSC_DENV_LIST_SOUNDENVS", TUT_e_ListBox);
// END TUTORIAL
// init all controls
m_pDefaultEnv = NULL;
fn_vInitEnvironment(NULL, FALSE);
// init lists
m_cMecListBox.fn_vInitParameters(this, m_pSectorInterface, E_te_MecEnvironment);
m_cVisListBox.fn_vInitParameters(this, m_pSectorInterface, E_te_VisEnvironment);
m_bInitialised = TRUE;
}
*/
/*===========================================================================
* Description: Init environment and controls
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vInitEnvironment (SECT_Environment *pEnv, BOOL bNewEnv)
{
// no environment and controls enabled => new environment
if ((!pEnv) && bNewEnv)
m_pEnvironment = m_pDefaultEnv;
else
m_pEnvironment = pEnv;
// update controls state
fn_vInitControls(TRUE);
// update parameters
m_csName = (m_pEnvironment) ? m_pEnvironment->GetName() : "";
// update controls
m_cName.SetWindowText(m_csName);
fn_vSelectMechanic((m_pEnvironment) ? m_pEnvironment->GetMecEnvironment() : NULL);
fn_vSelectVisual((m_pEnvironment) ? m_pEnvironment->GetVisEnvironment() : NULL);
fn_vSelectSound((m_pEnvironment) ? m_pEnvironment->GetSndEnvironment() : NULL);
// sound
m_cSndListBox.EnableWindow((m_pEnvironment != NULL));
}
*/
/*===========================================================================
* Description: Init controls
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vInitControls (BOOL bEnable)
{
m_cCancel.EnableWindow(bEnable&&(m_pEnvironment == m_pDefaultEnv));
m_cSave.EnableWindow(bEnable&&(m_pEnvironment == m_pDefaultEnv));
m_cName.EnableWindow(bEnable&&(m_pEnvironment != NULL));
m_cDefault.EnableWindow(bEnable&&(m_pEnvironment != NULL));
// mec
m_cMecListBox.EnableWindow(bEnable);
m_cEditMec.EnableWindow(bEnable);
m_cNewMec.EnableWindow(bEnable);
// vis
m_cVisListBox.EnableWindow(bEnable);
m_cEditVis.EnableWindow(bEnable);
m_cNewVis.EnableWindow(bEnable);
// snd => only if Sound DLL present
if (m_pSectorInterface->GetSoundEnvList())
m_cSndListBox.EnableWindow(bEnable);
else
m_cSndListBox.EnableWindow(FALSE);
}
*/
/*===========================================================================
* Description: Reinit dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vReinitDialog (void)
{
// init default environment
if (!m_pDefaultEnv)
{
m_pDefaultEnv = new SECT_Environment(m_pSectorInterface, NULL, NULL, NULL, "");
m_pDefaultEnv->fn_bUnValidate();
m_pDefaultEnv->fn_vNotifyUnSave();
}
// init mechanic
fn_vInitMecListBox();
// init mechanic
fn_vInitVisListBox();
// init sound
fn_vInitSndListBox();
}
*/
/*===========================================================================
* Description: Init mechanic listbox
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vInitMecListBox (void)
{
// init style
m_cMecListBox.SetOrder(E_lo_Alpha, FALSE, FALSE);
// reinit list
m_cMecListBox.SetSortedList(m_pSectorInterface->GetBaseObjectList(C_szMecEnvironmentTypeName));
// current selection => none
m_cMecListBox.SetSelectedItem(-1);
}
*/
/*===========================================================================
* Description: update mechanic selection
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vSelectMechanic (SECT_MecEnvironment *pMecEnv, BOOL bUpdateEnv)
{
SECT_MecEnvironment *pOldSelect, *pOldCurrent = NULL;
SECT_ModifEnvParams *pModif;
int iInd;
// update mechanic
pOldSelect = m_pMecEnvironment;
m_pMecEnvironment = pMecEnv;
// update mechanic dialog
if (m_pSectorInterface->GetDialogMec())
m_pSectorInterface->GetDialogMec()->fn_vInitMecEnvironment(m_pMecEnvironment, FALSE);
// update environment
if ((bUpdateEnv)&&(m_pEnvironment))
{
pOldCurrent = m_pEnvironment->GetMecEnvironment();
if ((m_pMecEnvironment)&&(m_pMecEnvironment != pOldCurrent))
{
if (m_pEnvironment != m_pDefaultEnv)
{
pModif = new SECT_ModifEnvParams(m_pSectorInterface, E_mt_ChangeMecEnv,
m_pEnvironment, m_pMecEnvironment, NULL, NULL);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
else
m_pEnvironment->SetMecEnvironment(m_pMecEnvironment, FALSE);
}
}
// redraw previous element
if (pOldSelect != m_pMecEnvironment)
{
iInd = m_cMecListBox.GetCorrespondingIndex((DWORD) pOldSelect);
m_cMecListBox.RedrawItems(iInd, iInd);
}
// redraw previous element
if ((pOldCurrent)&&(pOldCurrent != pOldSelect))
{
iInd = m_cMecListBox.GetCorrespondingIndex((DWORD) pOldCurrent);
m_cMecListBox.RedrawItems(iInd, iInd);
}
// update selection
iInd = m_cMecListBox.GetCorrespondingIndex((DWORD) m_pMecEnvironment);
m_cMecListBox.RedrawItems(iInd, iInd);
// update button
m_cEditMec.EnableWindow(m_pMecEnvironment != NULL);
m_cMecListBox.UpdateWindow();
}
*/
/*===========================================================================
* Description: Init visual listbox
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vInitVisListBox (void)
{
// init style
m_cVisListBox.SetOrder(E_lo_Alpha, FALSE, FALSE);
// reinit list
m_cVisListBox.SetSortedList(m_pSectorInterface->GetBaseObjectList(C_szVisEnvironmentTypeName));
// m_cVisListBox selection => none
m_cVisListBox.SetSelectedItem(-1);
}
*/
/*===========================================================================
* Description: update visual selection
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vSelectVisual (SECT_VisEnvironment *pVisEnv, BOOL bUpdateEnv)
{
SECT_VisEnvironment *pOldSelect, *pOldCurrent = NULL;
SECT_ModifEnvParams *pModif;
int iInd;
// update mechanic
pOldSelect = m_pVisEnvironment;
m_pVisEnvironment = pVisEnv;
// update mechanic dialog
if (m_pSectorInterface->GetDialogVis())
m_pSectorInterface->GetDialogVis()->fn_vInitVisEnvironment(m_pVisEnvironment, FALSE);
// update environment
if ((bUpdateEnv)&&(m_pEnvironment))
{
pOldCurrent = m_pEnvironment->GetVisEnvironment();
if (m_pVisEnvironment != pOldCurrent)
{
if (m_pEnvironment != m_pDefaultEnv)
{
pModif = new SECT_ModifEnvParams(m_pSectorInterface, E_mt_ChangeVisEnv,
m_pEnvironment, NULL, m_pVisEnvironment, NULL);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
else
m_pEnvironment->SetVisEnvironment(m_pVisEnvironment, FALSE);
}
}
// redraw previous element
if (pOldSelect != m_pVisEnvironment)
{
iInd = m_cVisListBox.GetCorrespondingIndex((DWORD) pOldSelect);
m_cVisListBox.RedrawItems(iInd, iInd);
}
// redraw previous element
if ((pOldCurrent)&&(pOldCurrent != pOldSelect))
{
iInd = m_cVisListBox.GetCorrespondingIndex((DWORD) pOldCurrent);
m_cVisListBox.RedrawItems(iInd, iInd);
}
// update selection
iInd = m_cVisListBox.GetCorrespondingIndex((DWORD) m_pVisEnvironment);
m_cVisListBox.RedrawItems(iInd, iInd);
// update button
m_cEditVis.EnableWindow(m_pVisEnvironment != NULL);
m_cVisListBox.UpdateWindow();
}
*/
/*===========================================================================
* Description: Init sound listbox
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vInitSndListBox (void)
{
CPA_BaseObjectList *pListObject;
CPA_BaseObject *pElem;
Position pos;
int iInd;
// RAZ
m_cSndListBox.ResetContent();
pListObject = m_pSectorInterface->GetSoundEnvList();
if (!pListObject)
return;
// init content
for (pElem = pListObject->GetHeadElement(pos); pElem;
pElem = pListObject->GetNextElement(pos))
{
// reinit list
iInd = m_cSndListBox.AddString(pElem->GetName());
m_cSndListBox.SetItemData(iInd, (DWORD) pElem);
}
// current selection => none
m_cSndListBox.SetCurSel(-1);
}
*/
/*===========================================================================
* Description: update sound selection
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnv::fn_vSelectSound (SECT_SndEnvironment *pSndEnv, BOOL bUpdateEnv)
{
SECT_SndEnvironment *pOldSelect, *pOldCurrent = NULL;
SECT_ModifEnvParams *pModif;
int iInd;
// update mechanic
pOldSelect = m_pSndEnvironment;
m_pSndEnvironment = pSndEnv;
// update sound
if ((bUpdateEnv)&&(m_pEnvironment)&&(m_pEnvironment != m_pDefaultEnv))
{
pOldCurrent = m_pEnvironment->GetSndEnvironment();
if ((m_pSndEnvironment)&&(m_pSndEnvironment != pOldCurrent))
{
pModif = new SECT_ModifEnvParams(m_pSectorInterface, E_mt_ChangeSndEnv,
m_pEnvironment, NULL, NULL, m_pSndEnvironment);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
}
// update selection
iInd = GetSoundIndex((DWORD) m_pSndEnvironment);
m_cSndListBox.SetCurSel(iInd);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
int SECT_DialogEnv::GetSoundIndex (DWORD pElem)
{
DWORD pData;
int iIndex;
for (iIndex = 0; iIndex < m_cSndListBox.GetCount(); iIndex++)
{
pData = m_cSndListBox.GetItemData(iIndex);
if (pData == pElem)
return iIndex;
}
return -1;
}
*/
//#################################################################################
// Messages
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnSize(UINT, int, int)
{
RECT WindowPosition;
int ecx, ecy;
if (!m_bInitialised)
return;
// calculate name position
GetWindowRect(&WindowPosition);
ecx = WindowPosition.right - WindowPosition.left - 10;
ecx = (ecx < 100) ? 100 : ecx;
ecy = WindowPosition.bottom - WindowPosition.top - 10;
ecy = (ecy < 140) ? 140 : ecy;
// buttons
m_cCancel.MoveWindow(5, 7, 40, 16);
m_cSave.MoveWindow(ecx-35, 7, 40, 16);
// save
m_cName.MoveWindow(50, 5, ecx-90, 20);
// mechanic
GetDlgItem(SECT_IDC_STATICMEC)->MoveWindow(5, 30, ecx/3, ecy-25);
m_cMecListBox.MoveWindow(10, 45, ecx/3-10, ecy-75);
m_cEditMec.MoveWindow(15, ecy-20, 25, 18);
m_cNewMec.MoveWindow(ecx/3-30, ecy-20, 25, 18);
// visual
GetDlgItem(SECT_IDC_STATICVIS)->MoveWindow(ecx/3+5, 30, ecx/3, ecy-25);
m_cVisListBox.MoveWindow(ecx/3+10, 45, ecx/3-10, ecy-75);
m_cEditVis.MoveWindow(ecx/3+15, ecy-20, 25, 18);
m_cNewVis.MoveWindow(2*ecx/3-30, ecy-20, 25, 18);
// sound
GetDlgItem(SECT_IDC_STATICSOUND)->MoveWindow(2*ecx/3+5, 30, ecx/3, ecy-25);
m_cSndListBox.MoveWindow(2*ecx/3+10, 45, ecx/3-10, ecy-45);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
// environment
TUT_M_vUnregisterControl(m_cName.m_hWnd);
TUT_M_vUnregisterControl(m_cDefault.m_hWnd);
TUT_M_vUnregisterControl(m_cCancel.m_hWnd);
TUT_M_vUnregisterControl(m_cSave.m_hWnd);
// mechanic environment
TUT_M_vUnregisterControl(m_cMecListBox.m_hWnd);
TUT_M_vUnregisterControl(m_cEditMec.m_hWnd);
TUT_M_vUnregisterControl(m_cNewMec.m_hWnd);
// visual environment
TUT_M_vUnregisterControl(m_cVisListBox.m_hWnd);
TUT_M_vUnregisterControl(m_cEditVis.m_hWnd);
TUT_M_vUnregisterControl(m_cNewVis.m_hWnd);
// sound environment
TUT_M_vUnregisterControl(m_cSndListBox.m_hWnd);
// END TUTORIAL
CFormView::OnDestroy();
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnChangeName()
{
CString csFinalName;
char szNewName[256];
// no environment => no modif
if ((!m_pEnvironment)||(!m_cName.GetModify()))
return;
// get corresponding name
m_cName.GetWindowText(szNewName, 255);
if (!strcmp(szNewName, ""))
{
m_cName.SetWindowText(m_csName);
return;
}
// get prefixed name
csFinalName = m_pSectorInterface->GetInterface()->GetPrefixedName(szNewName);
// check name validity
if (m_pEnvironment->fn_eCheckValidity(csFinalName) == E_mc_None)
m_csName = csFinalName;
// update window
m_cName.SetWindowText(m_csName);
// update name
if ((m_pEnvironment != m_pDefaultEnv)&&(m_csName != m_pEnvironment->GetName()))
{
m_pEnvironment->fn_eRename(m_csName);
m_pSectorInterface->GetDialogEnvs()->fn_vInitEnvListBox();
}
// update flag
m_cName.SetModify(FALSE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnDefault()
{
if (m_cName.GetModify())
{
OnChangeName();
m_cName.SetFocus();
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnCancel()
{
// default env => cancel
if (m_pEnvironment == m_pDefaultEnv)
m_pEnvironment = NULL;
// reinit controls
fn_vInitEnvironment(m_pEnvironment, FALSE);
// enable previous dialog
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnSave()
{
// default env => create it
if (m_pEnvironment == m_pDefaultEnv)
{
m_pEnvironment = new SECT_Environment(m_pSectorInterface, m_pMecEnvironment,
m_pVisEnvironment, m_pSndEnvironment, m_csName);
m_pEnvironment->fn_vNotifySave();
m_pSectorInterface->GetDialogEnvs()->fn_vInitEnvListBox();
}
// enable previous dialog
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvs()->fn_vSelectEnv(m_pEnvironment);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnSelChangeMecListBox(NMHDR* pNMHDR, LRESULT* pResult)
{
SECT_MecEnvironment *pMecEnv = NULL;
LPNM_LISTVIEW pNMListView = (LPNM_LISTVIEW)pNMHDR;
BOOL bOldSelect, bNewSelect;
int iIndex;
// update param
*pResult = 0;
if ((pNMListView->uChanged != LVIF_STATE)||(m_cMecListBox.fn_bIsSelecting()))
return;
bOldSelect = (pNMListView->uOldState & LVIS_SELECTED);
bNewSelect = (pNMListView->uNewState & LVIS_SELECTED);
// get corresponding sector
iIndex = pNMListView->iItem;
pMecEnv = (SECT_MecEnvironment *) m_cMecListBox.GetItemData(iIndex);
g_pClickedMecEnv = pMecEnv;
m_cMecListBox.SetSelectedItem(-1);
if (bOldSelect != bNewSelect)
{
// no env or unavailable env => invalid
if ((!pMecEnv)||(!pMecEnv->fn_bIsAvailable()))
fn_vSelectMechanic(m_pMecEnvironment, FALSE);
else if (pMecEnv != m_pMecEnvironment)
fn_vSelectMechanic(pMecEnv, FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnDblClkMecListBox(NMHDR* pNMHDR, LRESULT* pResult)
{
SECT_MecEnvironment *pMecEnv = NULL;
// update param
*pResult = 0;
// get corresponding sector
pMecEnv = g_pClickedMecEnv;
g_pClickedMecEnv = NULL;
// no env or unavailable env => invalid
if ((!pMecEnv)||(!pMecEnv->fn_bIsAvailable()))
fn_vSelectMechanic(m_pMecEnvironment);
else
fn_vSelectMechanic(pMecEnv);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnEditMec()
{
// no mecenv => no edition
if (!m_pMecEnvironment)
return;
// disable dialog
fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(FALSE);
// update mechanic dialog
m_pSectorInterface->GetDialogMec()->fn_vInitMecEnvironment(m_pMecEnvironment, TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnNewMec()
{
// disable dialog
fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(FALSE);
// set selection
m_cMecListBox.SetSelectedItem(-1);
m_pSectorInterface->GetDialogMec()->fn_vInitMecEnvironment(NULL, TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnSelChangeVisListBox(NMHDR* pNMHDR, LRESULT* pResult)
{
SECT_VisEnvironment *pVisEnv = NULL;
LPNM_LISTVIEW pNMListView = (LPNM_LISTVIEW)pNMHDR;
BOOL bOldSelect, bNewSelect;
int iIndex;
// update param
*pResult = 0;
if ((pNMListView->uChanged != LVIF_STATE)||(m_cVisListBox.fn_bIsSelecting()))
return;
bOldSelect = (pNMListView->uOldState & LVIS_SELECTED);
bNewSelect = (pNMListView->uNewState & LVIS_SELECTED);
// get corresponding sector
iIndex = pNMListView->iItem;
pVisEnv = (SECT_VisEnvironment *) m_cVisListBox.GetItemData(iIndex);
g_pClickedVisEnv = pVisEnv;
m_cVisListBox.SetSelectedItem(-1);
if (bOldSelect != bNewSelect)
{
// no env or unavailable env => invalid
if ((!pVisEnv)||(!pVisEnv->fn_bIsAvailable()))
fn_vSelectVisual(m_pVisEnvironment, FALSE);
else if (pVisEnv != m_pVisEnvironment)
fn_vSelectVisual(pVisEnv, FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnDblClkVisListBox(NMHDR* pNMHDR, LRESULT* pResult)
{
SECT_VisEnvironment *pVisEnv = NULL;
// update param
*pResult = 0;
// get corresponding sector
pVisEnv = g_pClickedVisEnv;
g_pClickedVisEnv = NULL;
// no env or unavailable env => invalid
if ((pVisEnv)&&(!pVisEnv->fn_bIsAvailable()))
fn_vSelectVisual(m_pVisEnvironment);
else
fn_vSelectVisual(pVisEnv);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnEditVis()
{
// no visenv => no edition
if (!m_pVisEnvironment)
return;
// disable dialog
fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(FALSE);
// update mechanic dialog
m_pSectorInterface->GetDialogVis()->fn_vInitVisEnvironment(m_pVisEnvironment, TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnNewVis()
{
// disable dialog
fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(FALSE);
// set selection
m_cVisListBox.SetSelectedItem(-1);
m_pSectorInterface->GetDialogVis()->fn_vInitVisEnvironment(NULL, TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnv::OnSelChangeSndListBox()
{
SECT_SndEnvironment *pSndEnv = NULL;
int iInd;
// no sound DLL => no change in sound environment
if (!m_pSectorInterface->GetSoundEnvList())
return;
// get corresponding element
iInd = m_cSndListBox.GetCurSel();
if (iInd !=-1)
pSndEnv = (SECT_SndEnvironment *) m_cSndListBox.GetItemData(iInd);
// no env or unavailable env => invalid
if ((pSndEnv)&&(!pSndEnv->fn_bIsAvailable()))
fn_vSelectSound(m_pSndEnvironment);
else if (pSndEnv != m_pSndEnvironment)
fn_vSelectSound(pSndEnv);
}
*/
//#################################################################################
// SECT_EnvParamListBox
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_EnvParamListBox::SECT_EnvParamListBox (void)
{
}
*/
/*----------------------------------------
----------------------------------------*/
/*
SECT_EnvParamListBox::~SECT_EnvParamListBox (void)
{
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_EnvParamListBox::fn_bIsCurrentElement (CPA_BaseObject *pElem)
{
SECT_Environment *pEnv;
// no dialog => no current element
if (!m_pDialog)
return FALSE;
// init parameters
pEnv = ((SECT_DialogEnv *) m_pDialog)->GetCurrentEnv();
switch (m_eType)
{
case E_te_MecEnvironment:
return ((pEnv)&&(pElem == pEnv->GetMecEnvironment()));
case E_te_VisEnvironment:
return ((pEnv)&&(pElem == pEnv->GetVisEnvironment()));
case E_te_SndEnvironment:
return ((pEnv)&&(pElem == pEnv->GetSndEnvironment()));
case E_te_NoType:
return FALSE;
}
return FALSE;
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_EnvParamListBox::fn_bIsSelectedElement (CPA_BaseObject *pElem)
{
// no dialog => no selected element
if (!m_pDialog)
return FALSE;
switch (m_eType)
{
case E_te_MecEnvironment:
return (pElem == ((SECT_DialogEnv *) m_pDialog)->GetSelectedMecEnv());
case E_te_VisEnvironment:
return (pElem == ((SECT_DialogEnv *) m_pDialog)->GetSelectedVisEnv());
case E_te_SndEnvironment:
return (pElem == ((SECT_DialogEnv *) m_pDialog)->GetSelectedSndEnv());
case E_te_NoType:
return FALSE;
}
return FALSE;
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_EnvParamListBox::fn_bIsAlreadyUsed (CPA_BaseObject *pElem)
{
return FALSE;
}
*/

View File

@@ -0,0 +1,443 @@
/*=========================================================================
*
* SECdEnvs.cpp : Environments List Dialog - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
/*
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SECdEnvs.hpp"
#include "SECmodif.hpp"
#include "SECdEnv.hpp"
#include "SEClEnvs.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
SECT_Environment *g_pClickedEnv;
*/
//#################################################################################
// SECT_DialogEnvElem dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_DialogEnvs::SECT_DialogEnvs(CWnd* pParent)
: CFormView(SECT_DialogEnvs::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogEnvs)
//}}AFX_DATA_INIT
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvs::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogEnvs)
// env elem
DDX_Control(pDX, SECT_IDC_ENVLISTBOX, m_cEnvListBox);
DDX_Control(pDX, SECT_IDC_NEWENV, m_cNewEnv);
DDX_Control(pDX, SECT_IDC_REPLACE, m_cReplace);
//}}AFX_DATA_MAP
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BEGIN_MESSAGE_MAP(SECT_DialogEnvs, CFormView)
//{{AFX_MSG_MAP(SECT_DialogEnvs)
ON_WM_SIZE()
ON_WM_DESTROY()
// env elem
ON_NOTIFY(LVN_ITEMCHANGED, SECT_IDC_ENVLISTBOX, OnSelChangeEnvListBox)
ON_NOTIFY(NM_DBLCLK, SECT_IDC_ENVLISTBOX, OnDblClkEnvListBox)
ON_BN_CLICKED(SECT_IDC_NEWENV, OnNewEnv)
ON_BN_CLICKED(SECT_IDC_REPLACE, OnReplace)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
*/
//#################################################################################
// SECT_DialogEdit Inits
//#################################################################################
/*===========================================================================
* Description: Init dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvs::fn_vInitDialog (Sector_Interface *p_oDLL, CWnd *pParent)
{
// create the dialog
m_bInitialised = FALSE;
m_pSectorInterface = p_oDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_cEnvListBox.m_hWnd, "OSC_DLISTENV_LIST_ENVS", TUT_e_ListBox);
TUT_M_vRegisterControl(m_cNewEnv.m_hWnd, "OSC_DLISTENV_BUTTON_NEW", TUT_e_Button);
TUT_M_vRegisterControl(m_cReplace.m_hWnd, "OSC_DLISTENV_BUTTON_REP", TUT_e_Button);
// END TUTORIAL
// init all controls
fn_vInitEnvElem(-1);
m_bInitialised = TRUE;
// init listbox
m_cEnvListBox.fn_vInitParameters(this, m_pSectorInterface, E_te_Environment);
}
*/
/*===========================================================================
* Description: Reinit dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvs::fn_vReinitDialog (void)
{
fn_vInitEnvListBox();
}
*/
/*===========================================================================
* Description: Init controls state
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvs::fn_vInitControls (BOOL bEnable)
{
m_cEnvListBox.EnableWindow(bEnable);
m_cNewEnv.EnableWindow(bEnable);
}
*/
/*===========================================================================
* Description: Reinit environment list
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvs::fn_vInitEnvElem (long lEnvElem)
{
Sector_Object *pSector;
// find corresponding element
if (lEnvElem != -1)
pSector = (Sector_Object *) m_pSectorInterface->GetEditedSector()->GetObject();
else
pSector = NULL;
// update edited element
m_lEnvElem = lEnvElem;
m_pEnvElem = (pSector) ? pSector->GetEnvironment(m_lEnvElem) : NULL;
// update infos
fn_vSelectEnv((m_pEnvElem) ? m_pEnvElem->GetEnvironment() : NULL);
m_cEnvListBox.fn_vReinitListObjects();
}
*/
/*===========================================================================
* Description: Init listbox with all available environments
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvs::fn_vInitEnvListBox (void)
{
// set list style
m_cEnvListBox.SetOrder(E_lo_Alpha, FALSE, FALSE);
// reinit list
m_cEnvListBox.SetSortedList(m_pSectorInterface->GetBaseObjectList(C_szEnvironmentTypeName));
// current selection => none
m_cEnvListBox.SetSelectedItem(-1);
}
*/
/*===========================================================================
* Description: update dialog when selection changes
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvs::fn_vSelectEnv (SECT_Environment *pEnvironment, BOOL bUpdateEnvElem)
{
SECT_Environment *pOldSelect, *pOldCurrent = NULL;
SECT_ModifEnvElem *pModif;
int iInd;
// update current environment
pOldSelect = m_pEnvironment;
m_pEnvironment = pEnvironment;
// update corresponding env elem
if ((bUpdateEnvElem)&&(m_pEnvElem))
{
pOldCurrent = m_pEnvElem->GetEnvironment();
if ((m_pEnvironment)&&(m_pEnvironment != pOldCurrent))
{
pModif = new SECT_ModifEnvElem(m_pSectorInterface, E_mt_ChangeEnv,
m_pEnvElem, m_pEnvironment, m_lEnvElem);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
}
// redraw previous element
if (pOldSelect != m_pEnvironment)
{
iInd = m_cEnvListBox.GetCorrespondingIndex((DWORD) pOldSelect);
m_cEnvListBox.RedrawItems(iInd, iInd);
}
// redraw previous element
if ((pOldCurrent)&&(pOldCurrent != pOldSelect))
{
iInd = m_cEnvListBox.GetCorrespondingIndex((DWORD) pOldCurrent);
m_cEnvListBox.RedrawItems(iInd, iInd);
}
// update selection
iInd = m_cEnvListBox.GetCorrespondingIndex((DWORD) m_pEnvironment);
m_cEnvListBox.RedrawItems(iInd, iInd);
m_cEnvListBox.EnsureVisible(iInd, TRUE);
m_cEnvListBox.UpdateWindow();
// update env list
if ((bUpdateEnvElem)&&(m_pEnvElem))
m_pSectorInterface->GetDialogEnvList()->fn_vUpdateEnvElem();
// update env dialog
if (m_pSectorInterface->GetDialogEnv())
m_pSectorInterface->GetDialogEnv()->fn_vInitEnvironment(m_pEnvironment, FALSE);
}
*/
//#################################################################################
// SECT_DialogEdit Messages
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvs::OnSize (UINT nFlags, int cx, int cy)
{
RECT WindowPosition;
int ecx, ecy;
if (!m_bInitialised)
return;
// calculate name position
GetWindowRect(&WindowPosition);
ecx = WindowPosition.right - WindowPosition.left;
ecx = (ecx < 70) ? 70 : ecx;
ecy = WindowPosition.bottom - WindowPosition.top - 10;
ecy = (ecy < 100) ? 100 : ecy;
// mechanic
GetDlgItem(SECT_IDC_TEXTENVELEM)->MoveWindow(5, 5, ecx-10, ecy);
m_cEnvListBox.MoveWindow(10, 25, ecx-20, ecy-50);
m_cNewEnv.MoveWindow(5, ecy-20, 30, 18);
m_cReplace.MoveWindow(ecx-38, ecy-20, 30, 18);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvs::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
// environment
TUT_M_vUnregisterControl(m_cEnvListBox.m_hWnd);
TUT_M_vUnregisterControl(m_cNewEnv.m_hWnd);
TUT_M_vUnregisterControl(m_cReplace.m_hWnd);
// END TUTORIAL
CFormView::OnDestroy();
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvs::OnSelChangeEnvListBox (NMHDR* pNMHDR, LRESULT* pResult)
{
SECT_Environment *pEnv = NULL;
LPNM_LISTVIEW pNMListView = (LPNM_LISTVIEW)pNMHDR;
BOOL bOldSelect, bNewSelect;
int iIndex;
// update param
*pResult = 0;
if ((pNMListView->uChanged != LVIF_STATE)||(m_cEnvListBox.fn_bIsSelecting()))
return;
bOldSelect = (pNMListView->uOldState & LVIS_SELECTED);
bNewSelect = (pNMListView->uNewState & LVIS_SELECTED);
// get corresponding sector
iIndex = pNMListView->iItem;
pEnv = (SECT_Environment *) m_cEnvListBox.GetItemData(iIndex);
g_pClickedEnv = pEnv;
m_cEnvListBox.SetSelectedItem(-1);
if (bOldSelect != bNewSelect)
{
// select corresponding environment
if ((!pEnv)||(!pEnv->fn_bIsAvailable()))
fn_vSelectEnv((m_pEnvElem) ? m_pEnvElem->GetEnvironment() : NULL, FALSE);
else
fn_vSelectEnv((pEnv != m_pEnvironment) ? pEnv : NULL, FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvs::OnDblClkEnvListBox (NMHDR* pNMHDR, LRESULT* pResult)
{
SECT_Environment *pEnv = NULL;
// update param
*pResult = 0;
// get corresponding sector
pEnv = g_pClickedEnv;
g_pClickedEnv = NULL;
// select corresponding environment
if ((!pEnv)||(!pEnv->fn_bIsAvailable()))
fn_vSelectEnv((m_pEnvElem) ? m_pEnvElem->GetEnvironment() : NULL);
else
fn_vSelectEnv(pEnv);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvs::OnNewEnv (void)
{
// update env dialog
fn_vSelectEnv(NULL);
m_pSectorInterface->GetDialogEnv()->fn_vInitEnvironment(NULL, TRUE);
// disable dialog
fn_vInitControls(FALSE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(FALSE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvs::OnReplace (void)
{
m_oDialogReplace.fn_vInitSectorInterface(m_pSectorInterface);
m_oDialogReplace.DoModal();
}
*/
//#################################################################################
// SECT_EnvElemListBox
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_EnvElemListBox::SECT_EnvElemListBox (void)
{
}
*/
/*----------------------------------------
----------------------------------------*/
/*
SECT_EnvElemListBox::~SECT_EnvElemListBox (void)
{
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_EnvElemListBox::fn_bIsCurrentElement (CPA_BaseObject *pElem)
{
SECT_EnvElem *pEnvElem;
// no dialog => no current element
if (!m_pDialog)
return FALSE;
// init parameters
pEnvElem = ((SECT_DialogEnvs *) m_pDialog)->GetCurrentEnvElem();
return ((pEnvElem)&&(pElem == pEnvElem->GetEnvironment()));
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_EnvElemListBox::fn_bIsSelectedElement (CPA_BaseObject *pElem)
{
// no dialog => no selected element
if (!m_pDialog)
return FALSE;
return (pElem == ((SECT_DialogEnvs *) m_pDialog)->GetSelectedEnvironment());
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_EnvElemListBox::fn_bIsAlreadyUsed (CPA_BaseObject *pElem)
{
return FALSE;
}
*/

View File

@@ -0,0 +1,635 @@
/*=========================================================================
*
* SECTdMec.cpp : Mechanic Environment dialog - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
/*
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SECdMec.hpp"
#include "SECmodif.hpp"
#include "SECdEnv.hpp"
#include "SEClEnvs.hpp"
#include "SECdEnvs.hpp"
#include "SECdSrfs.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
*/
//#################################################################################
// SECT_DialogMec dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_DialogMec::SECT_DialogMec(CWnd* pParent)
: CFormView(SECT_DialogMec::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogMec)
//}}AFX_DATA_INIT
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogMec)
DDX_Control(pDX, SECT_IDC_MECSAVE, m_cSave);
DDX_Control(pDX, SECT_IDC_MECCANCEL, m_cCancel);
DDX_Control(pDX, SECT_IDC_MECNAME, m_cName);
DDX_Control(pDX, SECT_IDC_MECDEFAULT, m_cDefault);
DDX_Control(pDX, SECT_IDC_GRAVITY, m_cGravity);
DDX_Control(pDX, SECT_IDC_VERTICALX, m_cVectorX);
DDX_Control(pDX, SECT_IDC_VERTICALY, m_cVectorY);
DDX_Control(pDX, SECT_IDC_VERTICALZ, m_cVectorZ);
DDX_Control(pDX, SECT_IDC_VISCOSITY, m_cViscosity);
DDX_Control(pDX, SECT_IDC_DENSITY, m_cDensity);
DDX_Control(pDX, SECT_IDC_LEVEL, m_cLevel);
DDX_Control(pDX, SECT_IDC_STREAMX, m_cStreamX);
DDX_Control(pDX, SECT_IDC_STREAMY, m_cStreamY);
DDX_Control(pDX, SECT_IDC_STREAMZ, m_cStreamZ);
DDX_Control(pDX, SECT_IDC_VOLUMIC, m_cVolumic);
//}}AFX_DATA_MAP
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BEGIN_MESSAGE_MAP(SECT_DialogMec, CFormView)
//{{AFX_MSG_MAP(SECT_DialogMec)
ON_WM_SIZE()
ON_WM_DESTROY()
ON_BN_CLICKED(SECT_IDC_MECSAVE, OnSave)
ON_BN_CLICKED(SECT_IDC_MECCANCEL, OnCancel)
ON_EN_KILLFOCUS(SECT_IDC_MECNAME, OnChangeName)
ON_BN_CLICKED(SECT_IDC_MECDEFAULT, OnDefault)
ON_EN_KILLFOCUS(SECT_IDC_GRAVITY, OnChangeGravity)
ON_EN_KILLFOCUS(SECT_IDC_VERTICALX, OnChangeVectorX)
ON_EN_KILLFOCUS(SECT_IDC_VERTICALY, OnChangeVectorY)
ON_EN_KILLFOCUS(SECT_IDC_VERTICALZ, OnChangeVectorZ)
ON_EN_KILLFOCUS(SECT_IDC_VISCOSITY, OnChangeViscosity)
ON_EN_KILLFOCUS(SECT_IDC_DENSITY, OnChangeDensity)
ON_EN_KILLFOCUS(SECT_IDC_LEVEL, OnChangeLevel)
ON_EN_KILLFOCUS(SECT_IDC_STREAMX, OnChangeStreamX)
ON_EN_KILLFOCUS(SECT_IDC_STREAMY, OnChangeStreamY)
ON_EN_KILLFOCUS(SECT_IDC_STREAMZ, OnChangeStreamZ)
ON_CBN_SELCHANGE(SECT_IDC_VOLUMIC, OnSelChangeComboVolumic)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
*/
//#################################################################################
// SECT_DialogMec Inits
//#################################################################################
/*===========================================================================
* Description: Init dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogMec::fn_vInitDialog (Sector_Interface *p_oDLL, CWnd *pParent)
{
// create the dialog
m_bInitialised = FALSE;
m_pSectorInterface = p_oDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// FOR TUTORIAL
TUT_M_vGetTutDll();
// environment
TUT_M_vRegisterControl(m_cName.m_hWnd, "OSC_DMEC_EDIT_NAME", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cDefault.m_hWnd, "OSC_DMEC_BUTTON_DEFAULT", TUT_e_Button);
TUT_M_vRegisterControl(m_cCancel.m_hWnd, "OSC_DMEC_BUTTON_CANCEL", TUT_e_Button);
TUT_M_vRegisterControl(m_cSave.m_hWnd, "OSC_DMEC_BUTTON_SAVE", TUT_e_Button);
// gravity
TUT_M_vRegisterControl(m_cGravity.m_hWnd, "OSC_DMEC_EDIT_GRAVITY", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cVectorX.m_hWnd, "OSC_DMEC_EDIT_VECTORX", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cVectorY.m_hWnd, "OSC_DMEC_EDIT_VECTORY", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cVectorZ.m_hWnd, "OSC_DMEC_EDIT_VECTORZ", TUT_e_TextEdit);
// fluid
TUT_M_vRegisterControl(m_cViscosity.m_hWnd, "OSC_DMEC_EDIT_VISCOSITY", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cDensity.m_hWnd, "OSC_DMEC_EDIT_DENSITY", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cLevel.m_hWnd, "OSC_DMEC_EDIT_LEVEL", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cStreamX.m_hWnd, "OSC_DMEC_EDIT_STREAMX", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cStreamY.m_hWnd, "OSC_DMEC_EDIT_STREAMY", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cStreamZ.m_hWnd, "OSC_DMEC_EDIT_STREAMZ", TUT_e_TextEdit);
// volumic environment
TUT_M_vRegisterControl(m_cVolumic.m_hWnd, "OSC_DMEC_COMBO_VOLUMIC", TUT_e_ComboBox);
// END TUTORIAL
// init volumic combo
m_cVolumic.ResetContent();
m_cVolumic.AddString(C_EntryVolumicAir);
m_cVolumic.AddString(C_EntryVolumicWater);
m_cVolumic.AddString(C_EntryVolumicLava);
// init environment values
m_pDefaultMecEnv = NULL;
fn_vInitMecEnvironment(NULL, FALSE);
m_bInitialised = TRUE;
}
*/
/*===========================================================================
* Description: Init default mec env
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogMec::fn_vReinitDialog (void)
{
if (!m_pDefaultMecEnv)
{
m_pDefaultMecEnv = new SECT_MecEnvironment(m_pSectorInterface, "");
m_pDefaultMecEnv->fn_bUnValidate();
m_pDefaultMecEnv->fn_vNotifyUnSave();
}
}
*/
/*===========================================================================
* Description: Init all control state
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogMec::fn_vInitControls (BOOL bEnable)
{
// init button states
m_cSave.EnableWindow(bEnable);
m_cCancel.EnableWindow(bEnable);
// init name
m_cName.SetReadOnly(!bEnable);
m_cDefault.EnableWindow(bEnable);
// init gravity controls
m_cGravity.SetReadOnly(!bEnable);
m_cVectorX.SetReadOnly(!bEnable);
m_cVectorY.SetReadOnly(!bEnable);
m_cVectorZ.SetReadOnly(!bEnable);
// init fluid controls
m_cDensity.SetReadOnly(!bEnable);
m_cViscosity.SetReadOnly(!bEnable);
m_cLevel.SetReadOnly(!bEnable);
m_cStreamX.SetReadOnly(!bEnable);
m_cStreamY.SetReadOnly(!bEnable);
m_cStreamZ.SetReadOnly(!bEnable);
// init volumic control
m_cVolumic.EnableWindow(bEnable);
}
*/
/*===========================================================================
* Description: register initial values
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogMec::fn_vInitMecEnvironment (SECT_MecEnvironment *pMecEnv, BOOL bEnable)
{
int iInd;
char szVal[256];
// update or create mec env
if ((!pMecEnv) && bEnable)
m_pMecEnv = m_pDefaultMecEnv;
else
m_pMecEnv = pMecEnv;
// update all controls
fn_vInitControls(bEnable);
// init name
m_csName = (m_pMecEnv) ? m_pMecEnv->GetName() : "";
// init gravity
m_xGravity = (m_pMecEnv) ? (float) m_pMecEnv->GetGravity() : (float) 0.0;
m_pVertical = (m_pMecEnv) ? m_pMecEnv->GetVertical() : NULL;
// init fluid
m_xViscosity = (m_pMecEnv) ? (float) m_pMecEnv->GetFluidViscosity() : (float) 0.0;
m_xDensity = (m_pMecEnv) ? (float) m_pMecEnv->GetFluidDensity() : (float) 0.0;
m_xLevel = (m_pMecEnv) ? (float) m_pMecEnv->GetFluidLevel() : (float) 0.0;
m_pStream = (m_pMecEnv) ? m_pMecEnv->GetFluidStream() : NULL;
// init volumic
m_csVolumic = (m_pMecEnv) ? m_pMecEnv->GetVolumicEnvironment() : "";
// init text
if (!m_pMecEnv)
{
m_cName.SetWindowText("");
m_cGravity.SetWindowText("");
m_cVectorX.SetWindowText("");
m_cVectorY.SetWindowText("");
m_cVectorZ.SetWindowText("");
m_cDensity.SetWindowText("");
m_cViscosity.SetWindowText("");
m_cLevel.SetWindowText("");
m_cStreamX.SetWindowText("");
m_cStreamY.SetWindowText("");
m_cStreamZ.SetWindowText("");
m_cVolumic.SetCurSel(-1);
}
else
{
// name
m_cName.SetWindowText(m_csName);
// gravity
sprintf(szVal, "%5.2f", m_xGravity);
m_cGravity.SetWindowText(szVal);
sprintf(szVal, "%5.2f", m_pVertical->m_xX);
m_cVectorX.SetWindowText(szVal);
sprintf(szVal, "%5.2f", m_pVertical->m_xY);
m_cVectorY.SetWindowText(szVal);
sprintf(szVal, "%5.2f", m_pVertical->m_xZ);
m_cVectorZ.SetWindowText(szVal);
// fluid
sprintf(szVal, "%5.2f", m_xDensity);
m_cDensity.SetWindowText(szVal);
sprintf(szVal, "%5.2f", m_xViscosity);
m_cViscosity.SetWindowText(szVal);
sprintf(szVal, "%5.2f", m_xLevel);
m_cLevel.SetWindowText(szVal);
sprintf(szVal, "%5.2f", m_pStream->m_xX);
m_cStreamX.SetWindowText(szVal);
sprintf(szVal, "%5.2f", m_pStream->m_xY);
m_cStreamY.SetWindowText(szVal);
sprintf(szVal, "%5.2f", m_pStream->m_xZ);
m_cStreamZ.SetWindowText(szVal);
// volumic
iInd = m_cVolumic.FindStringExact(-1, m_csVolumic);
m_cVolumic.SetCurSel(iInd);
}
}
*/
//#################################################################################
// Specific Parameters
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeName (void)
{
CString csFinalName;
char szNewName[256];
// no mec env => no changes
if ((!m_pMecEnv)||(!m_cName.GetModify()))
return;
// get corresponding name
m_cName.GetWindowText(szNewName, 255);
if (!strcmp(szNewName, ""))
{
m_cName.SetWindowText(m_csName);
return;
}
// get prefixed name
csFinalName = m_pSectorInterface->GetInterface()->GetPrefixedName(szNewName);
// check name validity
if (m_pMecEnv->fn_eCheckValidity(csFinalName) == E_mc_None)
m_csName = csFinalName;
// update window
m_cName.SetWindowText(m_csName);
m_cName.SetModify(FALSE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeGravity (void)
{
char szVal[15];
if (m_cGravity.GetModify())
{
m_cGravity.GetWindowText(szVal, 15);
m_xGravity = (float) atof(szVal);
m_cGravity.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeVectorX (void)
{
char szVal[15];
if (m_cVectorX.GetModify())
{
m_cVectorX.GetWindowText(szVal, 15);
m_pVertical->m_xX = (float) atof(szVal);
m_cVectorX.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeVectorY (void)
{
char szVal[15];
if (m_cVectorY.GetModify())
{
m_cVectorY.GetWindowText(szVal, 15);
m_pVertical->m_xY = (float) atof(szVal);
m_cVectorY.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeVectorZ (void)
{
char szVal[15];
if (m_cVectorZ.GetModify())
{
m_cVectorZ.GetWindowText(szVal, 15);
m_pVertical->m_xZ = (float) atof(szVal);
m_cVectorZ.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeViscosity (void)
{
char szVal[15];
if (m_cViscosity.GetModify())
{
m_cViscosity.GetWindowText(szVal, 15);
m_xViscosity = (float) atof(szVal);
m_cViscosity.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeDensity (void)
{
char szVal[15];
if (m_cDensity.GetModify())
{
m_cDensity.GetWindowText(szVal, 15);
m_xDensity = (float) atof(szVal);
m_cDensity.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeLevel (void)
{
char szVal[15];
if (m_cLevel.GetModify())
{
m_cLevel.GetWindowText(szVal, 15);
m_xLevel = (float) atof(szVal);
m_cLevel.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeStreamX (void)
{
char szVal[15];
if (m_cStreamX.GetModify())
{
m_cStreamX.GetWindowText(szVal, 15);
m_pStream->m_xX = (float) atof(szVal);
m_cStreamX.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeStreamY (void)
{
char szVal[15];
if (m_cStreamY.GetModify())
{
m_cStreamY.GetWindowText(szVal, 15);
m_pStream->m_xY = (float) atof(szVal);
m_cStreamY.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnChangeStreamZ (void)
{
char szVal[15];
if (m_cStreamZ.GetModify())
{
m_cStreamZ.GetWindowText(szVal, 15);
m_pStream->m_xZ = (float) atof(szVal);
m_cStreamZ.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnSelChangeComboVolumic (void)
{
char szText[256];
// get corresponding environment
m_cVolumic.GetLBText(m_cVolumic.GetCurSel(), szText);
// update value
m_csVolumic = szText;
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnSave()
{
SECT_ModifMecEnvParams *pModif;
// no mec env => no changes
if (!m_pMecEnv)
return;
// default mec env => create new one
if (m_pMecEnv == m_pDefaultMecEnv)
m_pMecEnv = new SECT_MecEnvironment(m_pSectorInterface, m_csName);
// modif
pModif = new SECT_ModifMecEnvParams(m_pSectorInterface, E_tm_ModifMecEnv, m_pMecEnv,
m_csName, m_xGravity, m_pVertical, m_xViscosity,
m_xDensity, m_xLevel, m_pStream, m_csVolumic);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
// give controtl to dialog env & update combo meca
m_pSectorInterface->GetDialogEnv()->fn_vInitMecListBox();
m_pSectorInterface->GetDialogEnv()->fn_vSelectMechanic(m_pMecEnv);
m_pSectorInterface->GetDialogEnv()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnCancel()
{
// new mec env => cancel
if (m_pMecEnv == m_pDefaultMecEnv)
m_pMecEnv = NULL;
// reinit controls
fn_vInitMecEnvironment(m_pMecEnv, FALSE);
// give controtl to dialog env
m_pSectorInterface->GetDialogEnv()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnDefault()
{
if (m_cName.GetModify())
{
OnChangeName();
m_cName.SetFocus();
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnSize(UINT, int, int)
{
RECT WindowPosition;
int ecx, ecy;
if (!m_bInitialised)
return;
// calculate name position
GetWindowRect(&WindowPosition);
ecx = WindowPosition.right - WindowPosition.left;
ecx = (ecx < 310) ? 0 : ecx-300;
ecy = WindowPosition.bottom - WindowPosition.top;
ecy = (ecy < 180) ? 0 : ecy-180;
// buttons
m_cCancel.MoveWindow(ecx/2, 7, 40, 16);
m_cSave.MoveWindow(ecx/2+260, 7, 40, 16);
// name
m_cName.MoveWindow(ecx/2+50, 5, 200, 20);
// Volumic environment
GetDlgItem(SECT_IDC_TEXTVOLUMIC)->MoveWindow(ecx/2, 30, 147, 40);
m_cVolumic.MoveWindow(ecx/2+10, 45, 130, 20);
// Gravity parameters
GetDlgItem(SECT_IDC_TEXTGRAVITY)->MoveWindow(ecx/2, 75, 147, 90);
GetDlgItem(SECT_IDC_TEXTCOEFF)->MoveWindow(ecx/2+10, 91, 60, 18);
m_cGravity.MoveWindow(ecx/2+80, 90, 60, 20);
GetDlgItem(SECT_IDC_TEXTVERTICAL)->MoveWindow(ecx/2+10, 115, 70, 18);
m_cVectorX.MoveWindow(ecx/2+5, 135, 43, 20);
m_cVectorY.MoveWindow(ecx/2+50, 135, 43, 20);
m_cVectorZ.MoveWindow(ecx/2+95, 135, 43, 20);
// mechanic
GetDlgItem(SECT_IDC_TEXTFLUID)->MoveWindow(ecx/2+152, 30, 147, 135);
GetDlgItem(SECT_IDC_TEXTVISCOSITY)->MoveWindow(ecx/2+162, 46, 60, 18);
m_cViscosity.MoveWindow(ecx/2+232, 45, 60, 20);
GetDlgItem(SECT_IDC_TEXTDENSITY)->MoveWindow(ecx/2+162, 68, 60, 18);
m_cDensity.MoveWindow(ecx/2+232, 67, 60, 20);
GetDlgItem(SECT_IDC_TEXTLEVEL)->MoveWindow(ecx/2+162, 90, 60, 18);
m_cLevel.MoveWindow(ecx/2+232, 89, 60, 20);
GetDlgItem(SECT_IDC_TEXTSTREAM)->MoveWindow(ecx/2+162, 115, 70, 18);
m_cStreamX.MoveWindow(ecx/2+157, 135, 43, 20);
m_cStreamY.MoveWindow(ecx/2+202, 135, 43, 20);
m_cStreamZ.MoveWindow(ecx/2+247, 135, 43, 20);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogMec::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
// environment
TUT_M_vUnregisterControl(m_cName.m_hWnd);
TUT_M_vUnregisterControl(m_cDefault.m_hWnd);
TUT_M_vUnregisterControl(m_cCancel.m_hWnd);
TUT_M_vUnregisterControl(m_cSave.m_hWnd);
// gravity
TUT_M_vUnregisterControl(m_cGravity.m_hWnd);
TUT_M_vUnregisterControl(m_cVectorX.m_hWnd);
TUT_M_vUnregisterControl(m_cVectorY.m_hWnd);
TUT_M_vUnregisterControl(m_cVectorZ.m_hWnd);
// fluid
TUT_M_vUnregisterControl(m_cViscosity.m_hWnd);
TUT_M_vUnregisterControl(m_cDensity.m_hWnd);
TUT_M_vUnregisterControl(m_cLevel.m_hWnd);
TUT_M_vUnregisterControl(m_cStreamX.m_hWnd);
TUT_M_vUnregisterControl(m_cStreamY.m_hWnd);
TUT_M_vUnregisterControl(m_cStreamZ.m_hWnd);
// volumic environment
TUT_M_vUnregisterControl(m_cVolumic.m_hWnd);
// END TUTORIAL
CFormView::OnDestroy();
}
*/

View File

@@ -0,0 +1,232 @@
/*=========================================================================
*
* SECdMode.cpp : display mode dialog - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SECdMode.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
//#################################################################################
// SECT_DialogMode dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
SECT_DialogMode::SECT_DialogMode(CWnd* pParent)
: CFormView(SECT_DialogMode::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogMode)
//}}AFX_DATA_INIT
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogMode::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogMode)
DDX_Control(pDX, SECT_IDC_EDITSECTOR, m_cSector);
DDX_Control(pDX, SECT_IDC_EDITLIST, m_cList);
//Shaitan Clean Env
// DDX_Control(pDX, SECT_IDC_EDITENV, m_cEnv);
DDX_Control(pDX, SECT_IDC_SECTORTEXT, m_cSectorText);
DDX_Control(pDX, SECT_IDC_LISTTEXT, m_cListText);
//Shaitan Clean Env
// DDX_Control(pDX, SECT_IDC_ENVTEXT, m_cEnvText);
DDX_Control(pDX, SECT_IDC_MODESYM, m_cModeSym);
//}}AFX_DATA_MAP
}
/*----------------------------------------
----------------------------------------*/
BEGIN_MESSAGE_MAP(SECT_DialogMode, CFormView)
//{{AFX_MSG_MAP(SECT_DialogMode)
ON_WM_SIZE()
ON_WM_DESTROY()
ON_BN_CLICKED(SECT_IDC_EDITSECTOR, OnSectors)
ON_BN_CLICKED(SECT_IDC_EDITLIST, OnList)
//Shaitan Clean Env
// ON_BN_CLICKED(SECT_IDC_EDITENV, OnEnv)
ON_BN_CLICKED(SECT_IDC_MODESYM, OnModeSym)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//#################################################################################
// SECT_DialogMode Inits
//#################################################################################
/*===========================================================================
* Description: Init dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void SECT_DialogMode::fn_vInitDialog (Sector_Interface *pOwnerDLL, CWnd *pParent, BOOL bShowSymetric, const CString csTag)
{
// create the dialog
m_bInitialised = FALSE;
m_pOwnerDLL = pOwnerDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_cModeSym.m_hWnd, "OSC_DMODE" + csTag + "_BUTTON_SYMETRIC", TUT_e_Button);
TUT_M_vRegisterControl(m_cSector.m_hWnd, "OSC_DMODE" + csTag + "_BUTTON_SECTOR", TUT_e_Button);
TUT_M_vRegisterControl(m_cList.m_hWnd, "OSC_DMODE" + csTag + "_BUTTON_LIST", TUT_e_Button);
//Shaitan Clean Env
// TUT_M_vRegisterControl(m_cEnv.m_hWnd, "OSC_DMODE" + csTag + "_BUTTON_ENV", TUT_e_Button);
// END TUTORIAL
// update mode
m_bShowSymetric = bShowSymetric;
m_cModeSym.EnableWindow(bShowSymetric);
m_cModeSym.ShowWindow(bShowSymetric);
m_cModeSym.SetCheck(m_pOwnerDLL->fn_bSymetricMode());
fn_vUpdateEditMode();
m_bInitialised = TRUE;
}
/*===========================================================================
* Description: update dialog when selection changes
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void SECT_DialogMode::fn_vUpdateEditMode (void)
{
tdeEditMode eEditMode;
eEditMode = m_pOwnerDLL->GetEditMode();
// reinit buttons
m_cSector.SetCheck(eEditMode == E_em_EditSector);
m_cList.SetCheck(eEditMode == E_em_EditList);
//Shaitan Clean Env
// m_cEnv.SetCheck(eEditMode == E_em_EditEnv);
}
//#################################################################################
// SECT_DialogMode Messages
//#################################################################################
/*----------------------------------------
----------------------------------------*/
void SECT_DialogMode::OnSize (UINT nFlags, int cx, int cy)
{
RECT WindowPosition;
int wcx, mcx, scx, mpy;
if (!m_bInitialised)
return;
GetWindowRect(&WindowPosition);
// calculate position
wcx = WindowPosition.right - WindowPosition.left - 20;
//Shaitan Clean Env
mcx = (wcx > 0) ? wcx / 2/*3*/ : 0;
scx = (wcx < 20) ? 20 : wcx-20;
// if necessary, move symetric
if (m_bShowSymetric)
{
m_cModeSym.MoveWindow(20, 2, scx, 18);
mpy = 20;
}
else
mpy = 0;
// move text
m_cSectorText.MoveWindow(5, mpy+5, mcx, 20);
m_cListText.MoveWindow(mcx+10, mpy+5, mcx, 20);
//Shaitan Clean Env
// m_cEnvText.MoveWindow(2*mcx + 15, mpy+5, mcx, 20);
// move radio buttons
m_cSector.MoveWindow(mcx/2, mpy+25, 20, 17);
m_cList.MoveWindow(3*mcx/2 + 5, mpy+25, 20, 17);
//Shaitan Clean Env
// m_cEnv.MoveWindow(5*mcx/2 + 10, mpy+25, 20, 17);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogMode::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_cModeSym.m_hWnd);
TUT_M_vUnregisterControl(m_cSector.m_hWnd);
TUT_M_vUnregisterControl(m_cList.m_hWnd);
//Shaitan Clean Env
// TUT_M_vUnregisterControl(m_cEnv.m_hWnd);
// END TUTORIAL
CFormView::OnDestroy();
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogMode::OnSectors (void)
{
if (m_cSector.GetCheck())
m_pOwnerDLL->SetEditMode(E_em_EditSector);
else
m_pOwnerDLL->SetEditMode(E_em_EditList);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogMode::OnList (void)
{
if (m_cList.GetCheck())
m_pOwnerDLL->SetEditMode(E_em_EditList);
else
m_pOwnerDLL->SetEditMode(E_em_EditSector/*E_em_EditEnv*/);
}
/*----------------------------------------
----------------------------------------*/
//Shaitan Clean Env
/*
void SECT_DialogMode::OnEnv (void)
{
if (m_cEnv.GetCheck())
m_pOwnerDLL->SetEditMode(E_em_EditEnv);
else
m_pOwnerDLL->SetEditMode(E_em_EditSector);
}
*/
/*----------------------------------------
----------------------------------------*/
void SECT_DialogMode::OnModeSym (void)
{
m_pOwnerDLL->SetSymetricMode(m_cModeSym.GetCheck());
}

View File

@@ -0,0 +1,184 @@
/*=========================================================================
*
* SECdRep.cpp : Replace dialog - Implementation file
*
*
* Version 1.0
* Creation date 16/08/97
* Revision date 18/08/97
*
* Shaitan
*=======================================================================*/
/*
#include "stdafx.h"
#include "acp_base.h"
#include "SECdRep.hpp"
#include "SECTint.hpp"
#include "SECmodif.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
*/
//#################################################################################
// SECT_DialogReplace dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_DialogReplace::SECT_DialogReplace(CWnd* pParent)
: CDialog(SECT_DialogReplace::IDD, pParent)
{
// init editor
m_pSectorInterface = NULL;
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogReplace::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogReplace)
DDX_Control(pDX, SECT_IDC_CINITENV, m_cInitEnv);
DDX_Control(pDX, SECT_IDC_CNEWENV, m_cNewEnv);
DDX_Control(pDX, SECT_IDC_CURRENT, m_cEdit);
DDX_Control(pDX, SECT_IDC_SELECT, m_cSelect);
DDX_Control(pDX, SECT_IDC_ALL, m_cAll);
//}}AFX_DATA_MAP
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BEGIN_MESSAGE_MAP(SECT_DialogReplace, CDialog)
//{{AFX_MSG_MAP(SECT_DialogReplace)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
*/
//#################################################################################
// SECT_DialogReplace message handlers
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_DialogReplace::OnInitDialog (void)
{
CPA_BaseObjectList *pListObjects;
CPA_BaseObject *pObject;
Position pos;
int iIndex;
CDialog::OnInitDialog();
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_cInitEnv.m_hWnd, "OSC_DREP_COMBO_OLDENV", TUT_e_ComboBox);
TUT_M_vRegisterControl(m_cNewEnv.m_hWnd, "OSC_DREP_COMBO_NEWENV", TUT_e_ComboBox);
TUT_M_vRegisterControl(m_cEdit.m_hWnd, "OSC_DREP_BUTTON_EDITED", TUT_e_Button);
TUT_M_vRegisterControl(m_cSelect.m_hWnd, "OSC_DREP_BUTTON_SELECTED", TUT_e_Button);
TUT_M_vRegisterControl(m_cAll.m_hWnd, "OSC_DREP_BUTTON_ALLSECTORS", TUT_e_Button);
// END TUTORIAL
// RAZ
m_cInitEnv.ResetContent();
m_cNewEnv.ResetContent();
// init combos
pListObjects = m_pSectorInterface->GetBaseObjectList(C_szEnvironmentTypeName);
for (pObject = pListObjects->GetHeadElement(pos); pObject;
pObject = pListObjects->GetNextElement(pos))
{
// initial environment
iIndex = m_cInitEnv.AddString(pObject->GetNameToDraw());
m_cInitEnv.SetItemData(iIndex, (DWORD) pObject);
// new environment
iIndex = m_cNewEnv.AddString(pObject->GetNameToDraw());
m_cNewEnv.SetItemData(iIndex, (DWORD) pObject);
}
// init radio buttons
m_cEdit.SetCheck(TRUE);
m_cSelect.SetCheck(FALSE);
m_cAll.SetCheck(FALSE);
return TRUE;
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogReplace::OnOK (void)
{
SECT_ModifReplaceEnvironment *pModif;
CPA_List<CPA_SuperObject> oListSectors;
CPA_List<CPA_SuperObject> *pListSectors;
SECT_Environment *pInitEnv, *pNewEnv;
int iIndex;
// init sector list
oListSectors.RemoveAll();
oListSectors.AddTail(m_pSectorInterface->GetEditedSector());
// get initial environment
iIndex = m_cInitEnv.GetCurSel();
pInitEnv = (iIndex != -1) ? (SECT_Environment *) m_cInitEnv.GetItemData(iIndex) : NULL;
// get final environment
iIndex = m_cNewEnv.GetCurSel();
pNewEnv = (iIndex != -1) ? (SECT_Environment *) m_cNewEnv.GetItemData(iIndex) : NULL;
// no replace => can't close dialog
if ((!pInitEnv)||(!pNewEnv)||(pInitEnv == pNewEnv))
return;
// get sector list
if (m_cEdit.GetCheck())
pListSectors = &oListSectors;
else if (m_cSelect.GetCheck())
pListSectors = m_pSectorInterface->GetSelectList();
else
pListSectors = NULL;
// ask for modif
pModif = new SECT_ModifReplaceEnvironment(m_pSectorInterface, E_tm_Replace, pInitEnv, pNewEnv, pListSectors);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
CDialog::OnOK();
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogReplace::fn_vInitSectorInterface (Sector_Interface *pInterface)
{
m_pSectorInterface = pInterface;
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogReplace::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_cInitEnv.m_hWnd);
TUT_M_vUnregisterControl(m_cNewEnv.m_hWnd);
TUT_M_vUnregisterControl(m_cEdit.m_hWnd);
TUT_M_vUnregisterControl(m_cSelect.m_hWnd);
TUT_M_vUnregisterControl(m_cAll.m_hWnd);
// END TUTORIAL
CDialog::OnDestroy();
}
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,504 @@
/*=========================================================================
*
* SEClEnvs.cpp : Environment List Sector Dialog - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
/*
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SECdSrfs.hpp"
#include "SECmodif.hpp"
#include "SECdEnv.hpp"
#include "SEClEnvs.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
SECT_Surface *g_pClickedSrf;
*/
//#################################################################################
// SECT_DialogEnvElem dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_DialogSrf::SECT_DialogSrf(CWnd* pParent)
: CFormView(SECT_DialogSrf::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogEnvElem)
//}}AFX_DATA_INIT
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogSrf::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogSrf)
// surf elem
DDX_Control(pDX, SECT_IDC_SURFLISTBOX, m_cSurfListBox);
DDX_Control(pDX, SECT_IDC_VIEWSURF, m_cViewSurf);
DDX_Control(pDX, SECT_IDC_SURFHEIGHT, m_cSurfHeight);
// control
DDX_Control(pDX, SECT_IDC_SRFDEFAULT, m_cDefault);
//}}AFX_DATA_MAP
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BEGIN_MESSAGE_MAP(SECT_DialogSrf, CFormView)
//{{AFX_MSG_MAP(SECT_DialogSrf)
ON_WM_SIZE()
ON_WM_DESTROY()
// surf elem
ON_NOTIFY(LVN_ITEMCHANGED, SECT_IDC_SURFLISTBOX, OnSelChangeSurfListBox)
ON_NOTIFY(NM_DBLCLK, SECT_IDC_SURFLISTBOX, OnDblClkSurfListBox)
ON_EN_KILLFOCUS(SECT_IDC_SURFHEIGHT, OnChangeHeight)
ON_BN_CLICKED(SECT_IDC_VIEWSURF, OnViewSurf)
// default
ON_BN_CLICKED(SECT_IDC_SRFDEFAULT, OnDefault)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
*/
//#################################################################################
// SECT_DialogSrf Inits
//#################################################################################
/*===========================================================================
* Description: Init dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogSrf::fn_vInitDialog (Sector_Interface *p_oDLL, CWnd *pParent)
{
// create the dialog
m_bInitialised = FALSE;
m_pSectorInterface = p_oDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_cSurfListBox.m_hWnd, "OSC_DSRF_LIST_SURFACES", TUT_e_ListBox);
TUT_M_vRegisterControl(m_cViewSurf.m_hWnd, "OSC_DSRF_BUTTON_VIEW", TUT_e_Button);
TUT_M_vRegisterControl(m_cSurfHeight.m_hWnd, "OSC_DSRF_EDIT_HEIGHT", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cDefault.m_hWnd, "OSC_DSRF_BUTTON_DEFAULT", TUT_e_Button);
// END TUTORIAL
// init all controls
m_bViewSurface = FALSE;
m_cViewSurf.SetCheck(0);
fn_vInitEnvElem(-1);
m_bInitialised = TRUE;
// init listbox
m_cSurfListBox.fn_vInitParameters(this, m_pSectorInterface, E_te_Surface);
}
*/
/*===========================================================================
* Description: Reinit dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogSrf::fn_vReinitDialog (void)
{
fn_vInitSurfListBox();
}
*/
/*===========================================================================
* Description: Init controls state
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogSrf::fn_vInitControls (BOOL bEnable)
{
m_cSurfListBox.EnableWindow(bEnable);
m_cViewSurf.EnableWindow(bEnable);
m_cSurfHeight.EnableWindow((m_pSurface != NULL)&&bEnable);
}
*/
/*===========================================================================
* Description: reinit environment list
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogSrf::fn_vInitEnvElem (long lEnvElem)
{
Sector_Object *pSector;
// find corresponding element
if (lEnvElem != -1)
pSector = (Sector_Object *) m_pSectorInterface->GetEditedSector()->GetObject();
else
pSector = NULL;
// update edited element
m_lEnvElem = lEnvElem;
m_pSurfElem = (pSector) ? pSector->GetSurface(m_lEnvElem) : NULL;
// update infos
fn_vSelectSurf((m_pSurfElem) ? m_pSurfElem->GetSurface() : m_pSectorInterface->GetSurfaceToDraw());
m_cSurfListBox.fn_vReinitListObjects();
}
*/
/*===========================================================================
* Description: Init combo with all available surfaces
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogSrf::fn_vInitSurfListBox (void)
{
// set list style
m_cSurfListBox.SetOrder(E_lo_Edited, FALSE, FALSE);
m_cSurfListBox.SetDragDropRight(FALSE);
// reinit list
m_cSurfListBox.SetSortedList(m_pSectorInterface->GetBaseObjectList(C_szSurfaceTypeName));
// current selection => none
m_cSurfListBox.SetSelectedItem(-1);
}
*/
/*===========================================================================
* Description: update dialog when selection changes
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogSrf::fn_vSelectSurf (SECT_Surface *pSurface, BOOL bUpdateSurfElem)
{
SECT_Surface *pOldSelect, *pOldCurrent;
SECT_ModifSurfElem *pModif;
CString csText;
int iInd;
// update current environment
pOldSelect = m_pSurface;
m_pSurface = pSurface;
// update selection
iInd = m_cSurfListBox.GetCorrespondingIndex((DWORD) m_pSurface);
m_cSurfListBox.RedrawItems(iInd, iInd);
// update env list
if ((bUpdateSurfElem)&&(m_pSurfElem))
{
pOldCurrent = m_pSurfElem->GetSurface();
if ((m_pSurface)&&(!m_cSurfListBox.fn_bIsAlreadyUsed(m_pSurface)))
{
// update sector lists
pModif = new SECT_ModifSurfElem(m_pSectorInterface, E_mt_ChangeSrf,
m_pSurfElem, m_pSurface, m_lEnvElem);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
}
// update height control
m_cSurfHeight.EnableWindow((m_pSurface != NULL));
if (m_pSurface)
csText.Format("%5.2f", m_pSurface->GetHeight());
else
csText = "";
m_cSurfHeight.SetWindowText(csText);
// redraw previous element
if (pOldSelect != m_pSurface)
{
iInd = m_cSurfListBox.GetCorrespondingIndex((DWORD) pOldSelect);
m_cSurfListBox.RedrawItems(iInd, iInd);
}
// redraw previous element
if ((pOldCurrent)&&(pOldCurrent != pOldSelect))
{
iInd = m_cSurfListBox.GetCorrespondingIndex((DWORD) pOldCurrent);
m_cSurfListBox.RedrawItems(iInd, iInd);
}
// update selection
iInd = m_cSurfListBox.GetCorrespondingIndex((DWORD) m_pSurface);
m_cSurfListBox.RedrawItems(iInd, iInd);
m_cSurfListBox.EnsureVisible(iInd, TRUE);
m_cSurfListBox.UpdateWindow();
// update drawing
if (m_bViewSurface)
m_pSectorInterface->SetSurfaceToDraw(m_pSurface);
}
*/
//#################################################################################
// SECT_DialogEdit Messages
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogSrf::OnSize (UINT nFlags, int cx, int cy)
{
RECT WindowPosition;
int ecx, ecy;
if (!m_bInitialised)
return;
// calculate name position
GetWindowRect(&WindowPosition);
ecx = WindowPosition.right - WindowPosition.left - 10;
ecx = (ecx < 50) ? 50 : ecx;
ecy = WindowPosition.bottom - WindowPosition.top - 10;
ecy = (ecy < 100) ? 100 : ecy;
// mechanic
GetDlgItem(SECT_IDC_TEXTSURFELEM)->MoveWindow(5, 5, ecx, ecy);
m_cSurfListBox.MoveWindow(10, 25, ecx-10, ecy-50);
m_cViewSurf.MoveWindow(ecx-35, ecy-20, 30, 18);
m_cSurfHeight.MoveWindow(15, ecy-20, ecx-50, 18);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogSrf::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_cSurfListBox.m_hWnd);
TUT_M_vUnregisterControl(m_cViewSurf.m_hWnd);
TUT_M_vUnregisterControl(m_cSurfHeight.m_hWnd);
TUT_M_vUnregisterControl(m_cDefault.m_hWnd);
// END TUTORIAL
CFormView::OnDestroy();
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogSrf::OnSelChangeSurfListBox(NMHDR* pNMHDR, LRESULT* pResult)
{
SECT_Surface *pSurf = NULL;
LPNM_LISTVIEW pNMListView = (LPNM_LISTVIEW)pNMHDR;
BOOL bOldSelect, bNewSelect;
int iIndex;
// update param
*pResult = 0;
if ((pNMListView->uChanged != LVIF_STATE)||(m_cSurfListBox.fn_bIsSelecting()))
return;
bOldSelect = (pNMListView->uOldState & LVIS_SELECTED);
bNewSelect = (pNMListView->uNewState & LVIS_SELECTED);
// get corresponding sector
iIndex = pNMListView->iItem;
pSurf = (SECT_Surface *) m_cSurfListBox.GetItemData(iIndex);
g_pClickedSrf = pSurf;
m_cSurfListBox.SetSelectedItem(-1);
if (bOldSelect != bNewSelect)
{
// select corresponding environment
if ((!pSurf)||(!pSurf->fn_bIsAvailable()))
fn_vSelectSurf((m_pSurfElem) ? m_pSurfElem->GetSurface() : NULL, FALSE);
else
fn_vSelectSurf((pSurf != m_pSurface) ? pSurf : NULL, FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogSrf::OnDblClkSurfListBox(NMHDR* pNMHDR, LRESULT* pResult)
{
SECT_Surface *pSurf = NULL;
// update param
*pResult = 0;
// get corresponding sector
pSurf = g_pClickedSrf;
g_pClickedSrf = NULL;
// select corresponding environment
if ((!pSurf)||(!pSurf->fn_bIsAvailable()))
fn_vSelectSurf((m_pSurfElem) ? m_pSurfElem->GetSurface() : NULL);
else
fn_vSelectSurf(pSurf);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogSrf::OnViewSurf()
{
// update draw flag
m_bViewSurface = m_cViewSurf.GetCheck();
// update drawing
m_pSectorInterface->SetSurfaceToDraw((m_bViewSurface) ? m_pSurface : NULL);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogSrf::OnChangeHeight()
{
SECT_ModifSrfParams *pModif;
MTH_tdxReal xHeight;
char szVal[15];
// no surface => no modif
if ((!m_pSurface)||(!m_cSurfHeight.GetModify()))
return;
// get new height
m_cSurfHeight.GetWindowText(szVal, 15);
xHeight = (float) atof(szVal);
// if necessary, update height
if (m_pSurface->GetHeight() != xHeight)
{
// update surface
pModif = new SECT_ModifSrfParams(m_pSectorInterface, E_mt_ChangeSrfHeight, m_pSurface, xHeight);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
// update drawing
m_cSurfListBox.fn_vReinitListObjects();
if (m_bViewSurface)
m_pSectorInterface->GetInterface()->fn_vUpdateAll(E_mc_JustDraw);
}
// update flag
m_cSurfHeight.SetModify(FALSE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogSrf::OnDefault()
{
if (m_cSurfHeight.GetModify())
{
OnChangeHeight();
m_cSurfHeight.SetFocus();
}
}
*/
//#################################################################################
// SECT_SrfElemListBox
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_SrfElemListBox::SECT_SrfElemListBox (void)
{
}
*/
/*----------------------------------------
----------------------------------------*/
/*
SECT_SrfElemListBox::~SECT_SrfElemListBox (void)
{
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_SrfElemListBox::fn_bIsCurrentElement (CPA_BaseObject *pElem)
{
SECT_SurfElem *pSurfElem;
// no dialog => no current element
if (!m_pDialog)
return FALSE;
// init parameters
pSurfElem = ((SECT_DialogSrf *) m_pDialog)->GetCurrentSurfElem();
return ((pSurfElem)&&(pElem == pSurfElem->GetSurface()));
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_SrfElemListBox::fn_bIsSelectedElement (CPA_BaseObject *pElem)
{
// no dialog => no selected element
if (!m_pDialog)
return FALSE;
return (pElem == ((SECT_DialogSrf *) m_pDialog)->GetSelectedSurface());
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BOOL SECT_SrfElemListBox::fn_bIsAlreadyUsed (CPA_BaseObject *pElem)
{
Sector_Object *pSector;
// no edited sector => no used element
if (!m_pSectorInterface->GetEditedSector())
return FALSE;
pSector = (Sector_Object *) m_pSectorInterface->GetEditedSector()->GetObject();
return (pSector->GetSurfaceList()->GetElementWithSurface((SECT_Surface *)pElem) != NULL);
}
*/

View File

@@ -0,0 +1,663 @@
/*=========================================================================
*
* SECTdVis.cpp : Visual Environment dialog - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
/*
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SECdVis.hpp"
#include "SECmodif.hpp"
#include "SECdEnv.hpp"
#include "SEClEnvs.hpp"
#include "SECdEnvs.hpp"
#include "SECdSrfs.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
*/
//#################################################################################
// SECT_DialogVis dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_DialogVis::SECT_DialogVis(CWnd* pParent)
: CFormView(SECT_DialogVis::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogVis)
//}}AFX_DATA_INIT
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogVis)
DDX_Control(pDX, SECT_IDC_VISNAME, m_cName);
DDX_Control(pDX, SECT_IDC_VISDEFAULT, m_cDefault);
DDX_Control(pDX, SECT_IDC_VISSAVE, m_cSave);
DDX_Control(pDX, SECT_IDC_VISCANCEL, m_cCancel);
DDX_Control(pDX, SECT_IDC_NEAR, m_cNear);
DDX_Control(pDX, SECT_IDC_FAR, m_cFar);
DDX_Control(pDX, SECT_IDC_BLENDNEAR, m_cBlendNear);
DDX_Control(pDX, SECT_IDC_BLENDFAR, m_cBlendFar);
DDX_Control(pDX, SECT_IDC_INFINITE, m_cInfinite);
DDX_Control(pDX, SECT_IDC_COLOR, m_cColor);
DDX_Control(pDX, SECT_IDC_REDSLIDER, m_cRSlider);
DDX_Control(pDX, SECT_IDC_GREENSLIDER, m_cGSlider);
DDX_Control(pDX, SECT_IDC_BLUESLIDER, m_cBSlider);
//}}AFX_DATA_MAP
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BEGIN_MESSAGE_MAP(SECT_DialogVis, CFormView)
//{{AFX_MSG_MAP(SECT_DialogVis)
ON_WM_SIZE()
ON_WM_DESTROY()
ON_WM_DRAWITEM()
ON_BN_CLICKED(SECT_IDC_VISSAVE, OnSave)
ON_BN_CLICKED(SECT_IDC_VISCANCEL, OnCancel)
ON_EN_KILLFOCUS(SECT_IDC_VISNAME, OnChangeName)
ON_BN_CLICKED(SECT_IDC_VISDEFAULT, OnDefault)
ON_EN_KILLFOCUS(SECT_IDC_NEAR, OnChangeNear)
ON_EN_KILLFOCUS(SECT_IDC_FAR, OnChangeFar)
ON_EN_KILLFOCUS(SECT_IDC_INFINITE, OnChangeInfinite)
ON_WM_VSCROLL()
ON_WM_HSCROLL()
ON_BN_DOUBLECLICKED(SECT_IDC_COLOR, OnEditColor)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
*/
//#################################################################################
// SECT_DialogVis Inits
//#################################################################################
/*===========================================================================
* Description: Init dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogVis::fn_vInitDialog (Sector_Interface *p_oDLL, CWnd *pParent)
{
// create the dialog
m_bInitialised = FALSE;
m_pSectorInterface = p_oDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// FOR TUTORIAL
TUT_M_vGetTutDll();
// visual environment
TUT_M_vRegisterControl(m_cName.m_hWnd, "OSC_DVIS_EDIT_VISENV", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cDefault.m_hWnd, "OSC_DVIS_BUTTON_DEFAULT", TUT_e_Button);
TUT_M_vRegisterControl(m_cCancel.m_hWnd, "OSC_DVIS_BUTTON_CANCEL", TUT_e_Button);
TUT_M_vRegisterControl(m_cSave.m_hWnd, "OSC_DVIS_BUTTON_SAVE", TUT_e_Button);
// parameters
TUT_M_vRegisterControl(m_cNear.m_hWnd, "OSC_DVIS_EDIT_NEAR", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cFar.m_hWnd, "OSC_DVIS_EDIT_FAR", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cInfinite.m_hWnd, "OSC_DVIS_EDIT_INFINITE", TUT_e_TextEdit);
TUT_M_vRegisterControl(m_cBlendNear.m_hWnd, "OSC_DVIS_EDIT_BLENDNEAR", TUT_e_Slider);
TUT_M_vRegisterControl(m_cBlendFar.m_hWnd, "OSC_DVIS_EDIT_BLENDFAR", TUT_e_Slider);
// color
TUT_M_vRegisterControl(m_cRSlider.m_hWnd, "OSC_DVIS_SLIDER_RED", TUT_e_Slider);
TUT_M_vRegisterControl(m_cGSlider.m_hWnd, "OSC_DVIS_SLIDER_GREEN", TUT_e_Slider);
TUT_M_vRegisterControl(m_cBSlider.m_hWnd, "OSC_DVIS_SLIDER_BLUE", TUT_e_Slider);
TUT_M_vRegisterControl(m_cColor.m_hWnd, "OSC_DVIS_BUTTON_COLOR", TUT_e_Button);
// END TUTORIAL
// init blend
m_cBlendNear.SetRange(0, 255);
m_cBlendFar.SetRange(0, 255);
// init range
m_cRSlider.SetRange(0, 254);
m_cGSlider.SetRange(0, 254);
m_cBSlider.SetRange(0, 254);
// init environment values
m_pDefaultVisEnv = NULL;
fn_vInitVisEnvironment(NULL, FALSE);
m_bInitialised = TRUE;
}
*/
/*===========================================================================
* Description: Init default vis env
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogVis::fn_vReinitDialog (void)
{
if (!m_pDefaultVisEnv)
{
m_pDefaultVisEnv = new SECT_VisEnvironment(m_pSectorInterface, "");
m_pDefaultVisEnv->fn_bUnValidate();
m_pDefaultVisEnv->fn_vNotifyUnSave();
}
}
*/
/*===========================================================================
* Description: Init controls
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogVis::fn_vInitControls (BOOL bEnable)
{
// init button states
m_cSave.EnableWindow(bEnable);
m_cCancel.EnableWindow(bEnable);
// init name
m_cName.SetReadOnly(!bEnable);
m_cDefault.EnableWindow(bEnable);
// init fog controls
m_cNear.SetReadOnly(!bEnable);
m_cFar.SetReadOnly(!bEnable);
m_cBlendNear.EnableWindow(bEnable);
m_cBlendFar.EnableWindow(bEnable);
m_cInfinite.SetReadOnly(!bEnable);
// init color controls
m_cRSlider.EnableWindow(bEnable);
m_cGSlider.EnableWindow(bEnable);
m_cBSlider.EnableWindow(bEnable);
}
*/
/*===========================================================================
* Description: register initial values
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogVis::fn_vInitVisEnvironment (SECT_VisEnvironment *pVisEnv, BOOL bEnable)
{
char szVal[256];
int iRValue, iGValue, iBValue;
// update or create mec env
if ((!pVisEnv) && bEnable)
m_pVisEnv = m_pDefaultVisEnv;
else
m_pVisEnv = pVisEnv;
// update all controls
fn_vInitControls(bEnable);
// init name
m_csName = (m_pVisEnv) ? m_pVisEnv->GetName() : "";
// init fog parameters
m_xNear = (m_pVisEnv) ? m_pVisEnv->GetFogNear() : 0;
m_xFar = (m_pVisEnv) ? m_pVisEnv->GetFogFar() : 0;
m_xBlendNear = (m_pVisEnv) ? m_pVisEnv->GetFogBlendNear() : 0;
m_xBlendFar = (m_pVisEnv) ? m_pVisEnv->GetFogBlendFar() : 0;
m_xInfinite = (m_pVisEnv) ? m_pVisEnv->GetFogInfinite() : 0;
// init fog color
iRValue = (m_pVisEnv) ? (int) (254 * m_pVisEnv->GetFogColor()->xR) : 0;
iGValue = (m_pVisEnv) ? (int) (254 * m_pVisEnv->GetFogColor()->xG) : 0;
iBValue = (m_pVisEnv) ? (int) (254 * m_pVisEnv->GetFogColor()->xB) : 0;
m_stColor = RGB(iRValue, iGValue, iBValue);
// init controls
if (!m_pVisEnv)
{
m_cName.SetWindowText("");
m_cNear.SetWindowText("");
m_cFar.SetWindowText("");
m_cBlendNear.SetPos((int) m_xBlendNear);
m_cBlendFar.SetPos((int) m_xBlendFar);
m_cInfinite.SetWindowText("");
fn_vUpdateSliders();
fn_vUpdateColor();
}
else
{
// name
m_cName.SetWindowText(m_csName);
// near
sprintf(szVal, "%5.2f", m_xNear);
m_cNear.SetWindowText(szVal);
// far
sprintf(szVal, "%5.2f", m_xFar);
m_cFar.SetWindowText(szVal);
// blend near
m_cBlendNear.SetPos((int) m_xBlendNear);
// blend far
m_cBlendFar.SetPos((int) m_xBlendFar);
// infinite
sprintf(szVal, "%5.2f", m_xInfinite);
m_cInfinite.SetWindowText(szVal);
// color
fn_vUpdateSliders();
fn_vUpdateColor();
}
}
*/
/*===========================================================================
* Description: Update sliders
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogVis::fn_vUpdateSliders (void)
{
m_cRSlider.SetPos(254 - GetRValue(m_stColor));
m_cGSlider.SetPos(254 - GetGValue(m_stColor));
m_cBSlider.SetPos(254 - GetBValue(m_stColor));
}
*/
/*===========================================================================
* Description: Update Color
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogVis::fn_vUpdateColor (void)
{
RECT rColor;
CDC *pColorDC;
// get controls parameters
pColorDC = m_cColor.GetDC();
m_cColor.GetClientRect(&rColor);
// fill control
pColorDC->FillSolidRect(&rColor, m_stColor);
}
*/
//#################################################################################
// SECT_DialogVis Messages
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnChangeName (void)
{
CString csFinalName;
char szNewName[256];
// no mec env => no changes
if ((!m_pVisEnv)||(!m_cName.GetModify()))
return;
// get corresponding name
m_cName.GetWindowText(szNewName, 255);
if (!strcmp(szNewName, ""))
{
m_cName.SetWindowText(m_csName);
return;
}
// get prefixed name
csFinalName = m_pSectorInterface->GetInterface()->GetPrefixedName(szNewName);
// check name validity
if (m_pVisEnv->fn_eCheckValidity(csFinalName) == E_mc_None)
m_csName = csFinalName;
// update window
m_cName.SetWindowText(m_csName);
m_cName.SetModify(FALSE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnChangeNear (void)
{
float xNear;
char szVal[15];
if (m_cNear.GetModify())
{
m_cNear.GetWindowText(szVal, 15);
xNear = (float) atof(szVal);
if ((xNear <= m_xFar) && (xNear <= m_xInfinite) && (xNear >= 0))
m_xNear = xNear;
else
{
sprintf(szVal, "%5.2f", m_xNear);
m_cNear.SetWindowText(szVal);
}
m_cNear.SetModify(FALSE);
}
}
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnChangeFar (void)
{
float xFar;
char szVal[15];
if (m_cFar.GetModify())
{
m_cFar.GetWindowText(szVal, 15);
xFar = (float) atof(szVal);
if ((xFar >= m_xNear) && (xFar <= m_xInfinite) && (xFar >= 0))
m_xFar = xFar;
else
{
sprintf(szVal, "%5.2f", m_xFar);
m_cFar.SetWindowText(szVal);
}
m_cFar.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnChangeInfinite (void)
{
float xInfinite;
char szVal[15];
if (m_cInfinite.GetModify())
{
m_cInfinite.GetWindowText(szVal, 15);
xInfinite = (float) atof(szVal);
if ((xInfinite >= m_xNear) && (xInfinite >= m_xFar) && (xInfinite >= 0))
m_xInfinite = xInfinite;
else
{
sprintf(szVal, "%5.2f", m_xInfinite);
m_cInfinite.SetWindowText(szVal);
}
m_cInfinite.SetModify(FALSE);
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
int iRValue, iGValue, iBValue;
// color
if ((pScrollBar == (void*) &m_cRSlider) ||
(pScrollBar == (void*) &m_cGSlider) ||
(pScrollBar == (void*) &m_cBSlider))
{
// update color
iRValue = 254 - m_cRSlider.GetPos();
iGValue = 254 - m_cGSlider.GetPos();
iBValue = 254 - m_cBSlider.GetPos();
m_stColor = RGB(iRValue, iGValue, iBValue);
// update control
fn_vUpdateColor();
}
CFormView::OnVScroll(nSBCode, nPos, pScrollBar);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if (pScrollBar == (void*) &m_cBlendNear)
{
// get new near value
m_xBlendNear = (float) m_cBlendNear.GetPos();
// if necessary, update far value
if (m_xBlendFar < m_xBlendNear)
{
m_xBlendFar = m_xBlendNear + 1;
m_cBlendFar.SetPos((int)m_xBlendFar);
}
}
if (pScrollBar == (void*) &m_cBlendFar)
{
// get new far value
m_xBlendFar = (float) m_cBlendFar.GetPos();
// if necessary, update near value
if (m_xBlendFar < m_xBlendNear)
{
m_xBlendNear = m_xBlendFar - 1;
m_cBlendNear.SetPos((int)m_xBlendNear);
}
}
CFormView::OnHScroll(nSBCode, nPos, pScrollBar);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnEditColor ()
{
CColorDialog oColorDialog;
// display color dialog
if (oColorDialog.DoModal() == IDOK)
{
// get selected color
m_stColor = oColorDialog.GetColor();
// update controls
fn_vUpdateSliders();
fn_vUpdateColor();
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnSave()
{
SECT_ModifVisEnvParams *pModif;
GLI_tdstColor stColor;
int iRValue, iGValue, iBValue;
// no mec env => no changes
if (!m_pVisEnv)
return;
// default mec env => create new one
if (m_pVisEnv == m_pDefaultVisEnv)
m_pVisEnv = new SECT_VisEnvironment(m_pSectorInterface, m_csName);
// get real color
iRValue = GetRValue(m_stColor);
iGValue = GetGValue(m_stColor);
iBValue = GetBValue(m_stColor);
stColor.xR = ((float) iRValue) / ((float) 254.0);
stColor.xG = ((float) iGValue) / ((float) 254.0);
stColor.xB = ((float) iBValue) / ((float) 254.0);
// modif
pModif = new SECT_ModifVisEnvParams(m_pSectorInterface, E_tm_ModifVisEnv, m_pVisEnv,
m_csName, m_xNear, m_xFar, m_xBlendNear,
m_xBlendFar, m_xInfinite, &stColor);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
// give controtl to dialog env & update combo meca
m_pSectorInterface->GetDialogEnv()->fn_vInitVisListBox();
m_pSectorInterface->GetDialogEnv()->fn_vSelectVisual(m_pVisEnv);
m_pSectorInterface->GetDialogEnv()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnCancel()
{
// new mec env => cancel
if (m_pVisEnv == m_pDefaultVisEnv)
m_pVisEnv = NULL;
// reinit controls
fn_vInitVisEnvironment(m_pVisEnv, FALSE);
// give controtl to dialog env
m_pSectorInterface->GetDialogEnv()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogSrf()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvs()->fn_vInitControls(TRUE);
m_pSectorInterface->GetDialogEnvList()->fn_vInitControls(TRUE);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnDefault()
{
if (m_cName.GetModify())
{
OnChangeName();
m_cName.SetFocus();
}
if (m_cNear.GetModify())
{
OnChangeNear();
m_cNear.SetFocus();
}
if (m_cFar.GetModify())
{
OnChangeFar();
m_cFar.SetFocus();
}
if (m_cInfinite.GetModify())
{
OnChangeInfinite();
m_cInfinite.SetFocus();
}
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnSize(UINT, int, int)
{
RECT WindowPosition;
int ecx, ecy;
if (!m_bInitialised)
return;
// calculate name position
GetWindowRect(&WindowPosition);
ecx = WindowPosition.right - WindowPosition.left;
ecx = (ecx < 160) ? 10 : ecx - 150;
ecy = WindowPosition.bottom - WindowPosition.top;
ecy = (ecy < 180) ? 0 : ecy-180;
// buttons
m_cCancel.MoveWindow(ecx/2, 5, 40, 16);
m_cSave.MoveWindow(ecx/2+110, 5, 40, 16);
// name
m_cName.MoveWindow(ecx/2, 25, 150, 20);
// Fog
GetDlgItem(SECT_IDC_STATICFOG)->MoveWindow(ecx/2, 50, 150, 120);
// parameters
GetDlgItem(SECT_IDC_STATICINFINITE)->MoveWindow(ecx/2+5, 65, 40, 15);
GetDlgItem(SECT_IDC_STATICNEAR)->MoveWindow(ecx/2+5, 80, 40 , 15);
GetDlgItem(SECT_IDC_STATICFAR)->MoveWindow(ecx/2+5, 95, 40, 15);
m_cInfinite.MoveWindow(ecx/2+50, 65, 45, 15);
m_cNear.MoveWindow(ecx/2+50, 80, 45, 15);
m_cFar.MoveWindow(ecx/2+50, 95, 45, 15);
GetDlgItem(SECT_IDC_STATICBLEND)->MoveWindow(ecx/2+100, 65, 45 , 15);
m_cBlendNear.MoveWindow(ecx/2+100, 80, 45, 15);
m_cBlendFar.MoveWindow(ecx/2+100, 95, 45, 15);
// color
GetDlgItem(SECT_IDC_STATICCOLOR)->MoveWindow(ecx/2+5, 133, 40, 15);
m_cColor.MoveWindow(ecx/2+100, 117, 40, 40);
m_cRSlider.MoveWindow(ecx/2+50, 123, 15, 40);
m_cGSlider.MoveWindow(ecx/2+67, 123, 15, 40);
m_cBSlider.MoveWindow(ecx/2+84, 123, 15, 40);
// update
fn_vUpdateColor();
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnDrawItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
// not interested => default handling
if ((lpDIS->itemID == LB_ERR) || (nIDCtl != SECT_IDC_COLOR))
return;
// draw item
fn_vUpdateColor();
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogVis::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
// visual environment
TUT_M_vUnregisterControl(m_cName.m_hWnd);
TUT_M_vUnregisterControl(m_cDefault.m_hWnd);
TUT_M_vUnregisterControl(m_cCancel.m_hWnd);
TUT_M_vUnregisterControl(m_cSave.m_hWnd);
// parameters
TUT_M_vUnregisterControl(m_cNear.m_hWnd);
TUT_M_vUnregisterControl(m_cFar.m_hWnd);
TUT_M_vUnregisterControl(m_cInfinite.m_hWnd);
// color
TUT_M_vUnregisterControl(m_cRSlider.m_hWnd);
TUT_M_vUnregisterControl(m_cGSlider.m_hWnd);
TUT_M_vUnregisterControl(m_cBSlider.m_hWnd);
TUT_M_vUnregisterControl(m_cColor.m_hWnd);
// END TUTORIAL
CFormView::OnDestroy();
}
*/

View File

@@ -0,0 +1,757 @@
/*=========================================================================
*
* SEClDias.cpp : List Dialogs - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SEClDias.hpp"
#include "SECmodif.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
#define C_uiCopyEntry 1
#define C_uiPasteEntry 2
//#################################################################################
// DIALOGBASE
//#################################################################################
/*----------------------------------------
----------------------------------------*/
SECT_DialogBase::SECT_DialogBase(CWnd* pParent)
: CFormView(SECT_DialogBase::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogBase)
//}}AFX_DATA_INIT
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogBase::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogBase)
DDX_Control(pDX, SECT_IDC_SYMETRIC, m_cSymetric);
DDX_Control(pDX, SECT_IDC_LISTPARAMS, m_cListParams);
//}}AFX_DATA_MAP
}
/*----------------------------------------
----------------------------------------*/
BEGIN_MESSAGE_MAP(SECT_DialogBase, CFormView)
//{{AFX_MSG_MAP(SECT_DialogBase)
ON_LBN_SELCHANGE(SECT_IDC_SORTEDLISTBOX, OnSelchangeSectorList)
ON_LBN_DBLCLK(SECT_IDC_SORTEDLISTBOX, OnDblClkSectorList)
ON_BN_CLICKED(SECT_IDC_SYMETRIC, OnSymetric)
ON_WM_DRAWITEM()
ON_WM_SIZE()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*===========================================================================
*=========================================================================*/
void SECT_DialogBase::fn_vInitDialog (Sector_Interface *p_oDLL, CWnd *pParent, const CString csTag, BOOL bShowListParams)
{
// create the dialog
m_bInitialised = FALSE;
m_pSectorInterface = p_oDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vRegisterControl (m_cSymetric.m_hWnd, "OSC_DLIST" + csTag + "_BUTTON_SYMETRIC", TUT_e_Button);
TUT_M_vRegisterControl (m_cListParams.m_hWnd, "OSC_DLIST" + csTag + "_LIST_PARAMS", TUT_e_ListBox);
TUT_M_vRegisterControlID(SECT_IDC_SORTEDLISTBOX, "OSC_DLIST" + csTag + "_LIST_SECTORS", TUT_e_ListBox);
// END TUTORIAL
m_pSectorList = NULL;
m_pSelectedElem = NULL;
// init list params
m_bShowListParams = bShowListParams;
m_cListParams.EnableWindow(m_bShowListParams);
m_cListParams.ShowWindow((m_bShowListParams) ? SW_SHOW : SW_HIDE);
m_bInitialised = TRUE;
}
/*===========================================================================
*=========================================================================*/
void SECT_DialogBase::fn_vReinitDialog (SECT_ListBase *pSectorList)
{
// init list
m_pSectorList = pSectorList;
// init sorted listbox
fn_vInitSectorList(pSectorList);
m_cListParams.EnableWindow(m_bShowListParams);
m_cListParams.ShowWindow(m_bShowListParams ? SW_SHOW : SW_HIDE);
}
/*===========================================================================
*=========================================================================*/
void SECT_DialogBase::fn_vInitSectorList (SECT_ListBase *pSectorList)
{
GetSectorList()->fn_vInitSectorList(pSectorList);
// init selection
m_pSelectedElem = NULL;
// update list params
fn_vReinitListParams();
}
/*===========================================================================
*=========================================================================*/
void SECT_DialogBase::fn_vUpdateSelection (CPA_SuperObject *pSector)
{
int iIndex;
// no list => no change
if (!m_pSectorList)
return;
// get coresponding element
m_pSelectedElem = m_pSectorList->GetElementWithSector(pSector);
// set selection
iIndex = GetSectorList()->GetCorrespondingIndex((DWORD) m_pSelectedElem);
GetSectorList()->SetCurSel(iIndex);
// update list params
fn_vReinitListParams();
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogBase::OnSelchangeSectorList()
{
int iIndex;
// select the object corresponding to the choice in the list box
iIndex = GetSectorList()->GetCurSel();
if (iIndex > -1)
m_pSelectedElem = (SECT_ElementBase *) GetSectorList()->GetItemData(iIndex);
else
m_pSelectedElem = NULL;
// update editor
if ((m_pSelectedElem)&&(m_pSectorInterface->GetEditMode() == E_em_EditSector))
m_pSectorInterface->fn_vSelectNewSector(m_pSelectedElem->GetSector());
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogBase::OnDblClkSectorList()
{
int iIndex;
// select the object corresponding to the choice in the list box
iIndex = GetSectorList()->GetCurSel();
if (iIndex > -1)
m_pSelectedElem = (SECT_ElementBase *) GetSectorList()->GetItemData(iIndex);
else
m_pSelectedElem = NULL;
// update selection in editor
if ((m_pSelectedElem)&&(m_pSectorInterface->GetEditMode() == E_em_EditSector))
m_pSectorInterface->fn_vSelectNewSector(m_pSelectedElem->GetSector());
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogBase::OnSymetric()
{
SECT_ModifSymetricLinks *pModif;
pModif = new SECT_ModifSymetricLinks(m_pSectorInterface, E_tm_SymetricLinks,
m_pSectorInterface->GetEditedSector(), m_eType);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogBase::OnSize (UINT nFlags, int cx, int cy)
{
RECT WindowPosition;
int lcx, lcy;
if (!m_bInitialised)
return;
GetWindowRect(&WindowPosition);
// calculate list position
lcx = WindowPosition.right - WindowPosition.left - 10;
lcy = WindowPosition.bottom - WindowPosition.top - 25;
lcx = (lcx < 50) ? 50 : lcx;
lcy = (lcy < 0) ? 0 : lcy;
m_cSymetric.MoveWindow(lcx-40, 2, 45, 16);
if (m_bShowListParams)
{
lcx = lcx - 10;
GetSectorList()->MoveWindow(5, 20, lcx/2, lcy);
m_cListParams.MoveWindow(lcx/2+10, 20, lcx/2, lcy);
}
else
GetSectorList()->MoveWindow(5, 20, lcx, lcy);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogBase::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl (m_cSymetric.m_hWnd);
TUT_M_vUnregisterControl (m_cListParams.m_hWnd);
TUT_M_vUnregisterControlID (SECT_IDC_SORTEDLISTBOX);
// END TUTORIAL
CFormView::OnDestroy();
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogBase::OnDrawItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
// not interested => default handling
if (lpDIS->itemID == LB_ERR)
return;
if (nIDCtl == SECT_IDC_SORTEDLISTBOX)
{
if ((!GetSectorList())||(!GetSectorList()->IsWindowEnabled()))
return;
// draw item
GetSectorList()->fn_vDrawListItem(nIDCtl, lpDIS);
}
}
//#################################################################################
// SORTED LIST BOX
//#################################################################################
BEGIN_MESSAGE_MAP(SECT_CustomListBox, CListBox)
ON_WM_RBUTTONDOWN()
ON_WM_KEYDOWN()
END_MESSAGE_MAP()
/*----------------------------------------
----------------------------------------*/
SECT_CustomListBox::SECT_CustomListBox (void)
{
// init dialog parameters
m_pDialog = NULL;
m_pSectorInterface = NULL;
}
/*----------------------------------------
----------------------------------------*/
void SECT_CustomListBox::fn_vInitDialogParameters (SECT_DialogBase *pDialog)
{
m_pDialog = pDialog;
m_pSectorInterface = m_pDialog->GetSectorInterface();
}
/*----------------------------------------
----------------------------------------*/
void SECT_CustomListBox::OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
{
m_pSectorInterface->fn_vOnKeyDownInSectorList(m_pDialog, nChar);
}
/*----------------------------------------
----------------------------------------*/
void SECT_CustomListBox::OnRButtonDown (UINT nFlags, CPoint point)
{
BOOL bCopy;
ClientToScreen( &point );
// create popup menu
CMenu oMenu;
oMenu.CreatePopupMenu();
// check if there is already a copy
bCopy = (m_pSectorInterface->GetCopyOfSectorList()->GetCount() > 0);
// Add Entry
oMenu.AppendMenu(MF_STRING | MF_ENABLED, C_uiCopyEntry, "Copy List");
oMenu.AppendMenu(MF_STRING | (bCopy) ? MF_ENABLED : MF_GRAYED, C_uiPasteEntry, "Paste List");
oMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
// destroy menus
oMenu.DestroyMenu();
}
/*----------------------------------------
----------------------------------------*/
BOOL SECT_CustomListBox::OnCommand (WPARAM wParam, LPARAM lParam)
{
// command from a menu ?
if (HIWORD(wParam) == 0)
{
// ID of menu item ?
switch (LOWORD(wParam))
{
// column headers
case C_uiCopyEntry:
m_pSectorInterface->fn_vCopySectorList(m_pSectorInterface->GetEditedSector(), m_pDialog->GetListType());
break;
case C_uiPasteEntry:
m_pSectorInterface->fn_vPasteSectorList(m_pSectorInterface->GetEditedSector(), m_pDialog->GetListType());
break;
}
}
return CListBox::OnCommand(wParam, lParam);
}
/*----------------------------------------
----------------------------------------*/
void SECT_CustomListBox::fn_vInitSectorList (SECT_ListBase *pSectorList)
{
SECT_ElementBase *pElem;
POSITION pos;
CString csText;
int iPos;
// RAZ
ResetContent();
if (!pSectorList)
return;
// add items to list
for (pElem = pSectorList->GetHeadElementBase(pos); pElem;
pElem = pSectorList->GetNextElementBase(pos))
{
csText = (pElem->GetSector() != NULL) ? pElem->GetSector()->GetName() : "All Sectors";
iPos = AddString(csText);
SetItemData(iPos, (DWORD)pElem);
}
}
/*----------------------------------------
----------------------------------------*/
int SECT_CustomListBox::GetCorrespondingIndex (DWORD pElem)
{
DWORD pData;
int iIndex;
for (iIndex = 0; iIndex < GetCount(); iIndex++)
{
pData = GetItemData(iIndex);
if (pData == pElem)
return iIndex;
}
return -1;
}
//#################################################################################
// ACTIVITY
//#################################################################################
/*----------------------------------------
----------------------------------------*/
void SECT_ActivityListBox::fn_vDrawListItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
SECT_ActivityElement *pElem;
COLORREF cTextColor;
COLORREF cRectColor;
BOOL bSelected;
CDC *pDC;
if (!m_pDialog)
return;
// init parameters
pElem = (SECT_ActivityElement *) GetItemData(lpDIS->itemID);
bSelected = (lpDIS->itemState & ODS_SELECTED);
// drawing rect
pDC = CDC::FromHandle(lpDIS->hDC);
// selected sector => blue
if (bSelected)
{
cRectColor = RGB (0, 0, 200);
cTextColor = RGB (254, 254, 254);
}
// normal sector => black
else
{
cRectColor = GetSysColor(COLOR_WINDOW);
cTextColor = RGB (0, 0, 0);
}
// draw item
pDC->FillSolidRect(&lpDIS->rcItem, cRectColor);
pDC->SetBkMode(TRANSPARENT);
lpDIS->rcItem.left += 2;
pDC->SetTextColor(cTextColor);
pDC->DrawText(pElem->GetSector()->GetNameToDraw(), &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
}
/*===========================================================================
*=========================================================================*/
SECT_DialogActiv::SECT_DialogActiv (CWnd* pParent)
{
m_eType = E_Activity;
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogActiv::DoDataExchange(CDataExchange* pDX)
{
SECT_DialogBase::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogList)
DDX_Control(pDX, SECT_IDC_SORTEDLISTBOX, m_cSectorList);
//}}AFX_DATA_MAP
m_cSectorList.fn_vInitDialogParameters(this);
}
//#################################################################################
// COLLISION
//#################################################################################
/*----------------------------------------
----------------------------------------*/
void SECT_CollisionListBox::fn_vDrawListItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
SECT_CollisionElement *pElem;
COLORREF cTextColor;
COLORREF cRectColor;
BOOL bSelected;
CDC *pDC;
if (!m_pDialog)
return;
// init parameters
pElem = (SECT_CollisionElement *) GetItemData(lpDIS->itemID);
bSelected = (lpDIS->itemState & ODS_SELECTED);
// drawing rect
pDC = CDC::FromHandle(lpDIS->hDC);
// selected sector => blue
if (bSelected)
{
cRectColor = RGB (0, 0, 200);
cTextColor = RGB (254, 254, 254);
}
// normal sector => black
else
{
cRectColor = GetSysColor(COLOR_WINDOW);
cTextColor = RGB (0, 0, 0);
}
// draw item
pDC->FillSolidRect(&lpDIS->rcItem, cRectColor);
pDC->SetBkMode(TRANSPARENT);
lpDIS->rcItem.left += 2;
pDC->SetTextColor(cTextColor);
pDC->DrawText(pElem->GetSector()->GetNameToDraw(), &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
}
/*===========================================================================
*=========================================================================*/
SECT_DialogColls::SECT_DialogColls (CWnd* pParent)
{
m_eType = E_Collision;
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogColls::DoDataExchange(CDataExchange* pDX)
{
SECT_DialogBase::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogList)
DDX_Control(pDX, SECT_IDC_SORTEDLISTBOX, m_cSectorList);
//}}AFX_DATA_MAP
m_cSectorList.fn_vInitDialogParameters(this);
}
//#################################################################################
// GRAPHIC
//#################################################################################
/*----------------------------------------
----------------------------------------*/
void SECT_GraphicListBox::fn_vDrawListItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
SECT_GraphicElement *pGraphicElem;
COLORREF cTextColor;
COLORREF cRectColor;
CString csText;
BOOL bSelected;
CDC *pDC;
long lWidth;
if (!m_pDialog)
return;
// init parameters
pGraphicElem = (SECT_GraphicElement *) GetItemData(lpDIS->itemID);
bSelected = (lpDIS->itemState & ODS_SELECTED);
lWidth = (lpDIS->rcItem.right < lpDIS->rcItem.left + 24) ? 0 : 22;
// drawing rect
pDC = CDC::FromHandle(lpDIS->hDC);
// selected sector => blue
if (bSelected)
{
cRectColor = RGB (0, 0, 200);
cTextColor = RGB (254, 254, 254);
}
// normal sector => black
else
{
cRectColor = GetSysColor(COLOR_WINDOW);
cTextColor = RGB (0, 0, 0);
}
// draw rect
pDC->FillSolidRect(&lpDIS->rcItem, cRectColor);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(cTextColor);
// draw sector name
lpDIS->rcItem.left += 1;
lpDIS->rcItem.right -= lWidth;
pDC->DrawText(pGraphicElem->GetSector()->GetNameToDraw(), &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
// draw level
lpDIS->rcItem.left = lpDIS->rcItem.right + 1;
lpDIS->rcItem.right = lpDIS->rcItem.left + lWidth / 2;
csText.Format("%d", pGraphicElem->GetGraphicLevel());
pDC->DrawText(csText, &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
// draw mode
lpDIS->rcItem.left = lpDIS->rcItem.right + 1;
lpDIS->rcItem.right = lpDIS->rcItem.left + lWidth / 2;
csText = (pGraphicElem->GetGraphicMode() == C_SECT_ModeLookOnly) ? "L" : " ";
pDC->DrawText(csText, &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
}
/*===========================================================================
*=========================================================================*/
SECT_DialogGraph::SECT_DialogGraph (CWnd* pParent)
{
m_eType = E_Graphic;
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogGraph::DoDataExchange(CDataExchange* pDX)
{
SECT_DialogBase::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogList)
DDX_Control(pDX, SECT_IDC_SORTEDLISTBOX, m_cSectorList);
//}}AFX_DATA_MAP
m_cSectorList.fn_vInitDialogParameters(this);
}
//#################################################################################
// SOUND
//#################################################################################
/*----------------------------------------
----------------------------------------*/
void SECT_SoundListBox::fn_vDrawListItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
SECT_SoundElement *pSoundElem;
COLORREF cTextColor;
COLORREF cRectColor;
CString csText;
BOOL bSelected;
CDC *pDC;
long lWidth;
if (!m_pDialog)
return;
// init parameters
pSoundElem = (SECT_SoundElement *) GetItemData(lpDIS->itemID);
bSelected = (lpDIS->itemState & ODS_SELECTED);
lWidth = (lpDIS->rcItem.right < lpDIS->rcItem.left + 22) ? 0 : 21;
// drawing rect
pDC = CDC::FromHandle(lpDIS->hDC);
// selected sector => blue
if (bSelected)
{
cRectColor = RGB (0, 0, 200);
cTextColor = RGB (254, 254, 254);
}
// normal sector => black
else
{
cRectColor = GetSysColor(COLOR_WINDOW);
cTextColor = RGB (0, 0, 0);
}
// draw item
pDC->FillSolidRect(&lpDIS->rcItem, cRectColor);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(cTextColor);
// draw sector name
lpDIS->rcItem.left += 1;
lpDIS->rcItem.right -= lWidth;
pDC->DrawText(pSoundElem->GetSector()->GetNameToDraw(), &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
// draw level
lpDIS->rcItem.left = lpDIS->rcItem.right + 1;
lpDIS->rcItem.right = lpDIS->rcItem.left + lWidth;
csText.Format("%d", pSoundElem->GetSoundLevel());
pDC->DrawText(csText, &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
}
/*===========================================================================
*=========================================================================*/
SECT_DialogSound::SECT_DialogSound (CWnd* pParent)
{
m_eType = E_Sound;
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogSound::DoDataExchange(CDataExchange* pDX)
{
SECT_DialogBase::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogList)
DDX_Control(pDX, SECT_IDC_SORTEDLISTBOX, m_cSectorList);
//}}AFX_DATA_MAP
m_cSectorList.fn_vInitDialogParameters(this);
}
//#################################################################################
// SOUND EVENT
//#################################################################################
/*----------------------------------------
----------------------------------------*/
void SECT_SoundEventListBox::fn_vDrawListItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
SECT_SoundEventElement *pElem;
COLORREF cTextColor;
COLORREF cRectColor;
CString csText;
BOOL bSelected;
CDC *pDC;
if (!m_pDialog)
return;
// init parameters
pElem = (SECT_SoundEventElement *) GetItemData(lpDIS->itemID);
bSelected = (lpDIS->itemState & ODS_SELECTED);
// drawing rect
pDC = CDC::FromHandle(lpDIS->hDC);
// selected sector => blue
if (bSelected)
{
cRectColor = RGB (0, 0, 200);
cTextColor = RGB (254, 254, 254);
}
// normal sector => black
else
{
cRectColor = GetSysColor(COLOR_WINDOW);
cTextColor = RGB (0, 0, 0);
}
// draw item
pDC->FillSolidRect(&lpDIS->rcItem, cRectColor);
pDC->SetBkMode(TRANSPARENT);
lpDIS->rcItem.left += 2;
pDC->SetTextColor(cTextColor);
csText = (pElem->GetSector() != NULL) ? pElem->GetSector()->GetNameToDraw() : "All Sectors";
pDC->DrawText(csText, &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
}
/*===========================================================================
*=========================================================================*/
SECT_DialogSoundEvent::SECT_DialogSoundEvent (CWnd* pParent)
{
m_eType = E_SoundEvent;
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogSoundEvent::DoDataExchange(CDataExchange* pDX)
{
SECT_DialogBase::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogList)
DDX_Control(pDX, SECT_IDC_SORTEDLISTBOX, m_cSectorList);
//}}AFX_DATA_MAP
m_cSectorList.fn_vInitDialogParameters(this);
}
/*----------------------------------------
----------------------------------------*/
void SECT_DialogSoundEvent::fn_vReinitListParams (void)
{
SECT_SoundEventElement *pSoundEventElem;
SECT_SndEvtEngineElem *pElem;
SECT_SoundEvent *pSoundEvent;
POSITION pos;
int iInd;
// RAZ
m_cListParams.ResetContent();
if (!m_pSelectedElem)
return;
pSoundEventElem = (SECT_SoundEventElement *) m_pSelectedElem;
// fill list with sector sound events
for (pElem = pSoundEventElem->GetSndEvtList()->GetHeadElement(pos); pElem;
pElem = pSoundEventElem->GetSndEvtList()->GetNextElement(pos))
{
pSoundEvent = pElem->GetSoundEvent();
if (pSoundEvent)
iInd = m_cListParams.AddString(pSoundEvent->GetName());
else
iInd = m_cListParams.AddString("Unknown");
m_cListParams.SetItemData(iInd, (DWORD) pSoundEvent);
}
// current selection => none
m_cListParams.SetCurSel(-1);
}

View File

@@ -0,0 +1,506 @@
/*=========================================================================
*
* SEClEnvs.cpp : Environment List Sector Dialog - Implementation file
*
*
* Version 1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
/*
#include "stdafx.h"
#include "acp_base.h"
#include "SECTint.hpp"
#include "SEClEnvs.hpp"
#include "SECdEnvs.hpp"
#include "SECdSrfs.hpp"
#include "SECmodif.hpp"
#include "SECdEnv.hpp"
//#include "SECdList.hpp"
#include "..\Main\Inc\_EditID.h"
#include "TUT.h"
*/
//#################################################################################
// SECT_DialogEdit dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
SECT_DialogEnvList::SECT_DialogEnvList(CWnd* pParent)
: CFormView(SECT_DialogEnvList::IDD)
{
//{{AFX_DATA_INIT(SECT_DialogEnvList)
//}}AFX_DATA_INIT
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SECT_DialogEnvList)
// env list
DDX_Control(pDX, SECT_IDC_ENVLIST, m_cEnvList);
DDX_Control(pDX, SECT_IDC_ADDENVELEM, m_cAddElem);
DDX_Control(pDX, SECT_IDC_DELENVELEM, m_cDelElem);
// apply controls
DDX_Control(pDX, SECT_IDC_APPLYALL, m_cApplyAll);
DDX_Control(pDX, SECT_IDC_APPLYSELECT, m_cApplySelect);
DDX_Control(pDX, SECT_IDC_CANCELSELECT, m_cCancelSelect);
//}}AFX_DATA_MAP
}
*/
/*----------------------------------------
----------------------------------------*/
/*
BEGIN_MESSAGE_MAP(SECT_DialogEnvList, CFormView)
//{{AFX_MSG_MAP(SECT_DialogEnvList)
ON_WM_SIZE()
ON_WM_DESTROY()
ON_WM_DRAWITEM()
// env list
ON_LBN_SELCHANGE(SECT_IDC_ENVLIST, OnSelChangeEnvList)
ON_BN_CLICKED(SECT_IDC_ADDENVELEM, OnAddElem)
ON_BN_CLICKED(SECT_IDC_DELENVELEM, OnDelElem)
// keydown
ON_WM_VKEYTOITEM()
// apply
ON_BN_CLICKED(SECT_IDC_APPLYALL, OnApplyAll)
ON_BN_CLICKED(SECT_IDC_APPLYSELECT, OnApplySelect)
ON_BN_CLICKED(SECT_IDC_CANCELSELECT, OnCancelSelect)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
*/
//#################################################################################
// SECT_DialogEdit Inits
//#################################################################################
/*===========================================================================
* Description: Init dialog
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvList::fn_vInitDialog (Sector_Interface *p_oDLL, CWnd *pParent)
{
// create the dialog
m_bInitialised = FALSE;
m_pSectorInterface = p_oDLL;
CFormView::Create(NULL, "", AFX_WS_DEFAULT_VIEW, CRect(0,0,120,180), pParent, AFX_IDW_PANE_FIRST, NULL);
// init data for dialog
CFormView::UpdateData(FALSE);
// init all controls
fn_vInitEnvList(NULL);
// FOR TUTORIAL
TUT_M_vGetTutDll();
// envlist
TUT_M_vRegisterControl (m_cEnvList.m_hWnd, "OSC_DELEM_LIST_ENVELEMS", TUT_e_ListBox);
TUT_M_vRegisterControl (m_cAddElem.m_hWnd, "OSC_DELEM_BUTTON_ADDELEM", TUT_e_Button);
TUT_M_vRegisterControl (m_cDelElem.m_hWnd, "OSC_DELEM_BUTTON_DELELEM", TUT_e_Button);
// apply
TUT_M_vRegisterControl (m_cApplyAll.m_hWnd, "OSC_DELEM_BUTTON_APPLYALL", TUT_e_Button);
TUT_M_vRegisterControl (m_cApplySelect.m_hWnd, "OSC_DELEM_BUTTON_APPLYSEL", TUT_e_Button);
TUT_M_vRegisterControl (m_cCancelSelect.m_hWnd, "OSC_DELEM_BUTTON_CANCELSEL", TUT_e_Button);
// END TUTORIAL
m_bInitialised = TRUE;
}
*/
/*===========================================================================
* Description: Init controls state
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvList::fn_vInitControls (BOOL bEnable)
{
m_cEnvList.EnableWindow(bEnable);
m_cAddElem.EnableWindow(bEnable);
m_cDelElem.EnableWindow(bEnable && (m_lEnvElem != -1));
}
*/
/*===========================================================================
* Description: Init environment list
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvList::fn_vInitEnvList (CPA_SuperObject *pEditedSector)
{
Sector_Object *pSector;
SECT_EnvElem *pEnvElem;
SECT_SurfElem *pSurfElem;
SECT_Surface *pSurface;
CString csName;
long lNumEnv = 0;
int iPos;
// update edited sector
m_pEditedSector = pEditedSector;
// reinit env list
m_cEnvList.ResetContent();
m_lEnvElem = -1;
// update controls
m_cEnvList.EnableWindow((m_pEditedSector != NULL));
m_cAddElem.EnableWindow((m_pEditedSector != NULL));
m_cDelElem.EnableWindow(FALSE);
// update apply
m_cApplyAll.EnableWindow((m_pEditedSector != NULL));
m_cApplySelect.EnableWindow((m_pEditedSector != NULL));
// no edited sector => no list
if (!m_pEditedSector)
return;
// fill env list
pSector = (Sector_Object *) m_pEditedSector->GetObject();
pEnvElem = pSector->GetEnvironment(lNumEnv);
pSurfElem = pSector->GetSurface(lNumEnv);
// fill list with all environments
while (pEnvElem)
{
if (pSurfElem)
{
pSurface = pSurfElem->GetSurface();
csName = pSurface->GetName();
}
else
csName ="NoSurface";
iPos = m_cEnvList.AddString(csName);
lNumEnv++;
pEnvElem = pSector->GetEnvironment(lNumEnv);
pSurfElem = pSector->GetSurface(lNumEnv);
}
// update controls
fn_vInitEnvElem(-1);
}
*/
/*===========================================================================
* Description: reinit environment list
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvList::fn_vInitEnvElem (long lEnvElem)
{
// update edited element
m_lEnvElem = lEnvElem;
// update selection
m_cEnvList.SetCurSel(m_lEnvElem);
// update env list controls
m_cDelElem.EnableWindow((m_lEnvElem != -1));
// update env elem controls
m_pSectorInterface->GetDialogEnvs()->fn_vInitEnvElem(m_lEnvElem);
m_pSectorInterface->GetDialogSrf()->fn_vInitEnvElem(m_lEnvElem);
}
*/
/*===========================================================================
* Description: reinit environment list
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvList::fn_vUpdateEnvElem (void)
{
// update selection
m_cEnvList.SetCurSel(m_lEnvElem);
}
*/
/*===========================================================================
* Description: draw item in envlist
* Creation date:
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
/*
void SECT_DialogEnvList::fn_vDrawEnvListItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
// draw item
Sector_Object *pSector;
SECT_SurfElem *pSurfElem;
SECT_EnvElem *pEnvElem;
COLORREF cColor;
CString csText;
BOOL bSelected;
CDC *pDC;
long lWidth, lLeft;
// init parameters
pDC = CDC::FromHandle(lpDIS->hDC);
bSelected = (lpDIS->itemState & ODS_SELECTED);
lWidth = lpDIS->rcItem.right - lpDIS->rcItem.left - 2;
lLeft = lpDIS->rcItem.left;
// fill drawing rect
cColor = RGB (254, 254, 254);
pDC->FillSolidRect(&lpDIS->rcItem, cColor);
pSector = (Sector_Object *) m_pEditedSector->GetObject();
pEnvElem = pSector->GetEnvironment(lpDIS->itemID);
pSurfElem = pSector->GetSurface(lpDIS->itemID);
// draw env
lpDIS->rcItem.left += 1;
lpDIS->rcItem.right = lpDIS->rcItem.left + lWidth/2;
cColor = (m_cEnvList.IsWindowEnabled()) ? RGB (128, 0, 0) : RGB (128, 128, 128);
pDC->SetTextColor(cColor);
csText = pEnvElem->GetEnvironment()->GetNameToDraw();
pDC->DrawText(csText, &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
// draw surface
if (pSurfElem)
{
lpDIS->rcItem.left = lpDIS->rcItem.right + 1;
lpDIS->rcItem.right = lpDIS->rcItem.left + lWidth/2;
cColor = (m_cEnvList.IsWindowEnabled()) ? RGB (100, 0, 0) : RGB (128, 128, 128);
pDC->SetTextColor(cColor);
csText = pSurfElem->GetSurface()->GetNameToDraw();
pDC->DrawText(csText, &lpDIS->rcItem, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
}
// selection
if (bSelected)
{
lpDIS->rcItem.left = lLeft;
lpDIS->rcItem.right = lLeft + lWidth + 2;
pDC->InvertRect(&lpDIS->rcItem);
}
}
*/
//#################################################################################
// SECT_DialogEdit Messages
//#################################################################################
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnSize (UINT nFlags, int cx, int cy)
{
RECT WindowPosition;
int ecx, ecy;
if (!m_bInitialised)
return;
// calculate name position
GetWindowRect(&WindowPosition);
ecx = WindowPosition.right - WindowPosition.left - 20;
ecy = WindowPosition.bottom - WindowPosition.top - 105;
ecy = (ecy < 50) ? 50 : ecy;
ecx = (ecx < 80) ? 80 : ecx;
// move list
m_cEnvList.MoveWindow(10, 5, ecx, ecy);
// move list controls
m_cAddElem.MoveWindow(ecx/2 - 40, ecy+10, 30, 16);
m_cDelElem.MoveWindow(ecx/2 + 30, ecy+10, 30, 16);
// move apply controls
GetDlgItem(SECT_IDC_SEPARATOR)->MoveWindow(5, ecy+35, ecx+10, 5);
m_cApplyAll.MoveWindow(10, ecy+45, ecx, 15);
m_cApplySelect.MoveWindow(10, ecy+65, ecx, 15);
m_cCancelSelect.MoveWindow(10, ecy+85, ecx, 15);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnDestroy (void)
{
// FOR TUTORIAL
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl (m_cEnvList.m_hWnd);
TUT_M_vUnregisterControl (m_cAddElem.m_hWnd);
TUT_M_vUnregisterControl (m_cDelElem.m_hWnd);
// apply
TUT_M_vUnregisterControl (m_cApplyAll.m_hWnd);
TUT_M_vUnregisterControl (m_cApplySelect.m_hWnd);
TUT_M_vUnregisterControl (m_cCancelSelect.m_hWnd);
// END TUTORIAL
CFormView::OnDestroy();
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnDrawItem (int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
// invalid item => default handling
if (lpDIS->itemID == LB_ERR)
return;
// env list => draw item
if (nIDCtl == SECT_IDC_ENVLIST)
fn_vDrawEnvListItem(nIDCtl, lpDIS);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnSelChangeEnvList()
{
SECT_EnvElem *pEnvElem = NULL;
int iInd;
// get corresponding element
iInd = m_cEnvList.GetCurSel();
// select it and update dialog
if (iInd != m_lEnvElem)
fn_vInitEnvElem(iInd);
else
fn_vInitEnvElem(-1);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnAddElem()
{
SECT_ModifEnvAndSrf *pModif;
SECT_Environment *pDefaultEnv;
SECT_Surface *pDefaultSurf;
Sector_Object *pSector;
// no sector => no modif
if (!m_pEditedSector)
return;
pSector = (Sector_Object *) m_pEditedSector->GetObject();
// test if there is a surface available
pDefaultSurf = m_pSectorInterface->GetDefaultSurface(pSector);
if (!pDefaultSurf)
return;
// get default environment
pDefaultEnv = m_pSectorInterface->GetDefaultEnvironment();
// create new environment elements
pModif = new SECT_ModifEnvAndSrf(m_pSectorInterface, E_mt_AddEnvAndSrf,
m_pEditedSector, -1, pDefaultEnv, pDefaultSurf);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnDelElem()
{
SECT_ModifEnvAndSrf *pModif;
// no sector or no environment => no modif
if ((!m_pEditedSector)||(m_lEnvElem == -1))
return;
// get parameters
pModif = new SECT_ModifEnvAndSrf(m_pSectorInterface, E_mt_DelEnvAndSrf,
m_pEditedSector, m_lEnvElem, NULL, NULL);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
int SECT_DialogEnvList::OnVKeyToItem (UINT nKey, CWnd *pListBox, UINT nIndex)
{
// no sector or no environment => no modif
if ((!m_pEditedSector)||(m_lEnvElem == -1))
return -2;
// interface handling
m_pSectorInterface->fn_vOnKeyDownInEnvList (m_pEditedSector, m_lEnvElem, nKey);
return -2;
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnApplyAll()
{
SECT_ModifApplyToSectors *pModif;
pModif = new SECT_ModifApplyToSectors(m_pSectorInterface, E_tm_ApplyToSectors,
m_pEditedSector, NULL);
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnApplySelect()
{
SECT_ModifApplyToSectors *pModif;
pModif = new SECT_ModifApplyToSectors(m_pSectorInterface, E_tm_ApplyToSectors,
m_pEditedSector, m_pSectorInterface->GetSelectList());
m_pSectorInterface->M_GetEditManager()->AskFor(pModif);
}
*/
/*----------------------------------------
----------------------------------------*/
/*
void SECT_DialogEnvList::OnCancelSelect()
{
// remove all selected sectors
m_pSectorInterface->GetSelectList()->RemoveAll();
// update drawing
m_pSectorInterface->fn_vShowSelection();
// udpate sector list
// m_pSectorInterface->GetDialogList()->fn_vReinitSectorList();
m_pSectorInterface->GetDialogList()->fn_vUpdateSelection(E_lrm_ReinitList);
}
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// ACPProject.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

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