699 lines
24 KiB
C++
699 lines
24 KiB
C++
|
|
// SectorInfoPaneView.cpp : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#include "stdafx.h"
|
|||
|
|
#include "EtWorldPainter.h"
|
|||
|
|
#include "SectorInfoPaneView.h"
|
|||
|
|
#include "UserMessage.h"
|
|||
|
|
#include "TEtWorld.h"
|
|||
|
|
#include "TEtWorldSector.h"
|
|||
|
|
#include "PaneDefine.h"
|
|||
|
|
#include "MainFrm.h"
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// CSectorInfoPaneView
|
|||
|
|
PropertyGridBaseDefine g_SectorInfoPropertyDefine[] = {
|
|||
|
|
{ "Terrain", "Height Multiply", CUnionValueProperty::Float, "<EFBFBD><EFBFBD><EFBFBD≯<EFBFBD> <20><><EFBFBD><EFBFBD>(1=1cm)", TRUE },
|
|||
|
|
{ "Terrain", "TileSize", CUnionValueProperty::Float, "Ÿ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(Unit:cm)", FALSE },
|
|||
|
|
{ "Terrain", "Sector Block Count", CUnionValueProperty::Vector2, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ī<><C4AB>Ʈ(Unit:Count)", FALSE },
|
|||
|
|
{ "Terrain", "Sector Block Size", CUnionValueProperty::Vector2, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(Unit:m)", FALSE },
|
|||
|
|
{ "Terrain", "Show Side Sector", CUnionValueProperty::Boolean, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>", TRUE },
|
|||
|
|
{ "Shader", "Shader Type", CUnionValueProperty::String_FileOpen, "<EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD> Ÿ<><C5B8>", TRUE },
|
|||
|
|
{ "Block Parameter", "Layer 4 Anti Stretch", CUnionValueProperty::Boolean, "4<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>þ <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Use Detail Texture", CUnionValueProperty::Boolean, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 1 Distance", CUnionValueProperty::Float, "1<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 2 Distance", CUnionValueProperty::Float, "2<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 3 Distance", CUnionValueProperty::Float, "3<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 4 Distance", CUnionValueProperty::Float, "4<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 5 Distance", CUnionValueProperty::Float, "5<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 6 Distance", CUnionValueProperty::Float, "6<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 7 Distance", CUnionValueProperty::Float, "7<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 8 Distance", CUnionValueProperty::Float, "8<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 1 Rotation", CUnionValueProperty::Float, "1<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> ȸ<><C8B8><EFBFBD><EFBFBD>|0.f|360.f|0.1f", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 2 Rotation", CUnionValueProperty::Float, "2<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> ȸ<><C8B8><EFBFBD><EFBFBD>|0.f|360.f|0.1f", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 3 Rotation", CUnionValueProperty::Float, "3<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> ȸ<><C8B8><EFBFBD><EFBFBD>|0.f|360.f|0.1f", FALSE },
|
|||
|
|
{ "Block Parameter", "Layer 4 Rotation", CUnionValueProperty::Float, "4<EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD> ȸ<><C8B8><EFBFBD><EFBFBD>|0.f|360.f|0.1f", FALSE },
|
|||
|
|
{ NULL },
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
IMPLEMENT_DYNCREATE(CSectorInfoPaneView, CFormView)
|
|||
|
|
|
|||
|
|
CSectorInfoPaneView::CSectorInfoPaneView()
|
|||
|
|
: CFormView(CSectorInfoPaneView::IDD)
|
|||
|
|
{
|
|||
|
|
m_bActivate = false;
|
|||
|
|
m_dwShaderParamCount = 0;
|
|||
|
|
m_pVecPropertyList.clear();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CSectorInfoPaneView::~CSectorInfoPaneView()
|
|||
|
|
{
|
|||
|
|
ResetPropertyGrid();
|
|||
|
|
SAFE_DELETE_PVEC( m_pVecPropertyList );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CSectorInfoPaneView::DoDataExchange(CDataExchange* pDX)
|
|||
|
|
{
|
|||
|
|
CFormView::DoDataExchange(pDX);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
BEGIN_MESSAGE_MAP(CSectorInfoPaneView, CFormView)
|
|||
|
|
ON_WM_SIZE()
|
|||
|
|
ON_MESSAGE( UM_REFRESH_PANE_VIEW, OnRefresh )
|
|||
|
|
ON_MESSAGE(XTPWM_PROPERTYGRID_NOTIFY, OnGridNotify)
|
|||
|
|
END_MESSAGE_MAP()
|
|||
|
|
|
|||
|
|
|
|||
|
|
// CSectorInfoPaneView <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
|
|||
|
|
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
void CSectorInfoPaneView::AssertValid() const
|
|||
|
|
{
|
|||
|
|
CFormView::AssertValid();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#ifndef _WIN32_WCE
|
|||
|
|
void CSectorInfoPaneView::Dump(CDumpContext& dc) const
|
|||
|
|
{
|
|||
|
|
CFormView::Dump(dc);
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
#endif //_DEBUG
|
|||
|
|
|
|||
|
|
|
|||
|
|
// CSectorInfoPaneView <20><EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
|
|||
|
|
|
|||
|
|
void CSectorInfoPaneView::OnInitialUpdate()
|
|||
|
|
{
|
|||
|
|
CFormView::OnInitialUpdate();
|
|||
|
|
|
|||
|
|
// TODO: <20><><EFBFBD> Ư<><C6AF>ȭ<EFBFBD><C8AD> <20>ڵ带 <20>߰<EFBFBD> <20><>/<2F>Ǵ<EFBFBD> <20>⺻ Ŭ<><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȣ<><C8A3><EFBFBD>մϴ<D5B4>.
|
|||
|
|
if( m_bActivate == true ) return;
|
|||
|
|
m_bActivate = true;
|
|||
|
|
|
|||
|
|
CRect rcRect;
|
|||
|
|
GetClientRect( &rcRect );
|
|||
|
|
m_PropertyGrid.Create( rcRect, this, 0 );
|
|||
|
|
m_PropertyGrid.SetCustomColors( RGB(200, 200, 200), 0, RGB(182, 210, 189), RGB(247, 243, 233), 0 );
|
|||
|
|
|
|||
|
|
SendMessage( UM_REFRESH_PANE_VIEW );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CSectorInfoPaneView::OnSize(UINT nType, int cx, int cy)
|
|||
|
|
{
|
|||
|
|
__super::OnSize(nType, cx, cy);
|
|||
|
|
|
|||
|
|
// TODO: <20><><EFBFBD> <20><EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
|
|||
|
|
if( m_PropertyGrid ) {
|
|||
|
|
m_PropertyGrid.SetWindowPos( NULL, 0, 0, cx, cy, SWP_FRAMECHANGED );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
LRESULT CSectorInfoPaneView::OnRefresh( WPARAM wParam, LPARAM lParam )
|
|||
|
|
{
|
|||
|
|
ResetPropertyGrid();
|
|||
|
|
/*
|
|||
|
|
m_dwShaderParamCount = 0;
|
|||
|
|
SAFE_DELETE_PVEC( m_pVecPropertyList );
|
|||
|
|
CUnionValueProperty *pVariable;
|
|||
|
|
// Default <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
|
for( DWORD i=0; ; i++ ) {
|
|||
|
|
if( g_SectorInfoPropertyDefine[i].szCategory == NULL ) break;
|
|||
|
|
pVariable = new CUnionValueProperty( g_SectorInfoPropertyDefine[i].Type );
|
|||
|
|
pVariable->SetDescription( g_SectorInfoPropertyDefine[i].szStr );
|
|||
|
|
pVariable->SetSubDescription( g_SectorInfoPropertyDefine[i].szDescription );
|
|||
|
|
pVariable->SetCategory( g_SectorInfoPropertyDefine[i].szCategory );
|
|||
|
|
pVariable->SetDefaultEnable( g_SectorInfoPropertyDefine[i].bEnable );
|
|||
|
|
m_pVecPropertyList.push_back( pVariable );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
RefreshPropertyGrid( &m_pVecPropertyList );
|
|||
|
|
*/
|
|||
|
|
RefreshPropertyGrid( g_SectorInfoPropertyDefine );
|
|||
|
|
return S_OK;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void CSectorInfoPaneView::OnSetValue( CUnionValueProperty *pVariable, DWORD dwIndex )
|
|||
|
|
{
|
|||
|
|
switch( dwIndex ) {
|
|||
|
|
case 0: // Multiply
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector != -1 ) {
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
pVariable->SetVariable( pSector->GetHeightMultiply() );
|
|||
|
|
}
|
|||
|
|
SetReadOnly( pVariable, !CGlobalValue::GetInstance().IsCheckOutMe() );
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 1:
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector != -1 ) {
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
pVariable->SetVariable( pSector->GetTileSize() );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 2:
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector != -1 ) {
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
int nX, nY;
|
|||
|
|
pSector->GetBlockCount( nX, nY );
|
|||
|
|
pVariable->SetVariable( EtVector2( (float)nX, (float)nY ) );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 3:
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector != -1 ) {
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
int nX, nY;
|
|||
|
|
pSector->GetBlockSize( nX, nY );
|
|||
|
|
nX *= (int)( pSector->GetTileSize() / 100.f );
|
|||
|
|
nY *= (int)( pSector->GetTileSize() / 100.f );
|
|||
|
|
pVariable->SetVariable( EtVector2( (float)nX, (float)nY ) );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 4: // Show Side Sector
|
|||
|
|
{
|
|||
|
|
pVariable->SetVariable( CGlobalValue::GetInstance().m_bLockSideHeight );
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 5: // Shader Name
|
|||
|
|
pVariable->SetVariable( "LayeredTerrain.fx" );
|
|||
|
|
break;
|
|||
|
|
case 6: // Stretch
|
|||
|
|
{
|
|||
|
|
std::vector<int> *pVecList = &CGlobalValue::GetInstance().m_nVecEditBlockList;
|
|||
|
|
if( pVecList->size() == 0 ) pVariable->SetDefaultEnable( FALSE );
|
|||
|
|
else pVariable->SetDefaultEnable( TRUE );
|
|||
|
|
|
|||
|
|
if( pVecList->size() > 0 ) {
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector == -1 ) break;
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( pSector == NULL ) break;
|
|||
|
|
|
|||
|
|
int nTrue = 0;
|
|||
|
|
int nFalse = 0;
|
|||
|
|
for( DWORD i=0; i<pVecList->size(); i++ ) {
|
|||
|
|
int nBlockType = pSector->GetBlockType( (*pVecList)[i] );
|
|||
|
|
if( nBlockType == TT_NORMAL || nBlockType == TT_DETAILNORMAL ) nFalse++;
|
|||
|
|
else nTrue++;
|
|||
|
|
}
|
|||
|
|
if( nTrue >= nFalse )
|
|||
|
|
pVariable->SetVariable( true );
|
|||
|
|
else pVariable->SetVariable( false );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 7: // Detail Texture
|
|||
|
|
{
|
|||
|
|
std::vector<int> *pVecList = &CGlobalValue::GetInstance().m_nVecEditBlockList;
|
|||
|
|
if( pVecList->size() == 0 ) pVariable->SetDefaultEnable( FALSE );
|
|||
|
|
else pVariable->SetDefaultEnable( TRUE );
|
|||
|
|
|
|||
|
|
if( pVecList->size() > 0 ) {
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector == -1 ) break;
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( pSector == NULL ) break;
|
|||
|
|
|
|||
|
|
int nTrue = 0;
|
|||
|
|
int nFalse = 0;
|
|||
|
|
for( DWORD i=0; i<pVecList->size(); i++ ) {
|
|||
|
|
int nBlockType = pSector->GetBlockType( (*pVecList)[i] );
|
|||
|
|
if( nBlockType == TT_NORMAL || nBlockType == TT_CLIFF ) nFalse++;
|
|||
|
|
else nTrue++;
|
|||
|
|
}
|
|||
|
|
if( nTrue >= nFalse )
|
|||
|
|
pVariable->SetVariable( true );
|
|||
|
|
else pVariable->SetVariable( false );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 8:
|
|||
|
|
case 9:
|
|||
|
|
case 10:
|
|||
|
|
case 11:
|
|||
|
|
case 12:
|
|||
|
|
case 13:
|
|||
|
|
case 14:
|
|||
|
|
case 15:
|
|||
|
|
{
|
|||
|
|
std::vector<int> *pVecList = &CGlobalValue::GetInstance().m_nVecEditBlockList;
|
|||
|
|
if( pVecList->size() == 0 ) pVariable->SetDefaultEnable( FALSE );
|
|||
|
|
else pVariable->SetDefaultEnable( TRUE );
|
|||
|
|
|
|||
|
|
if( pVecList->size() > 0 ) {
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector == -1 ) break;
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( pSector == NULL ) break;
|
|||
|
|
|
|||
|
|
float fDistance = 0.f;
|
|||
|
|
int nCount = 0;
|
|||
|
|
int nFalse = 0;
|
|||
|
|
for( DWORD i=0; i<pVecList->size(); i++ ) {
|
|||
|
|
if( (int)dwIndex - 8 >= pSector->GetTextureCount( (*pVecList)[i] ) ) {
|
|||
|
|
pVariable->SetDefaultEnable( FALSE );
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
fDistance += pSector->GetTextureDistance( (*pVecList)[i], dwIndex - 8 );
|
|||
|
|
nCount++;
|
|||
|
|
}
|
|||
|
|
if( nCount > 0 ) fDistance /= nCount;
|
|||
|
|
pVariable->SetVariable( fDistance );
|
|||
|
|
}
|
|||
|
|
SetReadOnly( dwIndex, !pVariable->IsDefaultEnable() );
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 16:
|
|||
|
|
case 17:
|
|||
|
|
case 18:
|
|||
|
|
case 19:
|
|||
|
|
{
|
|||
|
|
std::vector<int> *pVecList = &CGlobalValue::GetInstance().m_nVecEditBlockList;
|
|||
|
|
if( pVecList->size() == 0 ) pVariable->SetDefaultEnable( FALSE );
|
|||
|
|
else pVariable->SetDefaultEnable( TRUE );
|
|||
|
|
|
|||
|
|
if( pVecList->size() > 0 ) {
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector == -1 ) break;
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( pSector == NULL ) break;
|
|||
|
|
|
|||
|
|
float fRotation = 0.f;
|
|||
|
|
int nCount = 0;
|
|||
|
|
for( DWORD i=0; i<pVecList->size(); i++ ) {
|
|||
|
|
if( (int)dwIndex - 16 >= pSector->GetTextureCount( (*pVecList)[i] ) ) {
|
|||
|
|
pVariable->SetDefaultEnable( FALSE );
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
fRotation += pSector->GetTextureRotation( (*pVecList)[i], dwIndex - 16 );
|
|||
|
|
nCount++;
|
|||
|
|
}
|
|||
|
|
if( nCount > 0 ) fRotation /= nCount;
|
|||
|
|
pVariable->SetVariable( fRotation );
|
|||
|
|
}
|
|||
|
|
SetReadOnly( dwIndex, !pVariable->IsDefaultEnable() );
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Shader Param
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CSectorInfoPaneView::OnChangeValue( CUnionValueProperty *pVariable, DWORD dwIndex )
|
|||
|
|
{
|
|||
|
|
switch( dwIndex ) {
|
|||
|
|
case 0:
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector != -1 ) {
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( MessageBox( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲܷ<D9B2>?", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD>", MB_YESNO ) == IDYES ) {
|
|||
|
|
CActionElementModifyHeightMultiply *pAction = new CActionElementModifyHeightMultiply( pSector );
|
|||
|
|
pAction->ModifyHeightMultiply( pVariable->GetVariableFloat() );
|
|||
|
|
|
|||
|
|
pSector->SetHeightMultiply( pVariable->GetVariableFloat() );
|
|||
|
|
|
|||
|
|
pAction->AddAction();
|
|||
|
|
|
|||
|
|
CGlobalValue::GetInstance().SetModify();
|
|||
|
|
}
|
|||
|
|
else pVariable->SetVariable( pSector->GetHeightMultiply() );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 4: // Show Side Sector
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector != -1 ) {
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
SectorIndex SideSector[8];
|
|||
|
|
SideSector[0] = SectorIndex( Sector.nX - 1, Sector.nY - 1 );
|
|||
|
|
SideSector[1] = SectorIndex( Sector.nX, Sector.nY - 1 );
|
|||
|
|
SideSector[2] = SectorIndex( Sector.nX + 1, Sector.nY - 1 );
|
|||
|
|
SideSector[3] = SectorIndex( Sector.nX - 1, Sector.nY );
|
|||
|
|
SideSector[4] = SectorIndex( Sector.nX + 1, Sector.nY );
|
|||
|
|
SideSector[5] = SectorIndex( Sector.nX - 1, Sector.nY + 1 );
|
|||
|
|
SideSector[6] = SectorIndex( Sector.nX, Sector.nY + 1 );
|
|||
|
|
SideSector[7] = SectorIndex( Sector.nX + 1, Sector.nY + 1 );
|
|||
|
|
|
|||
|
|
for( int i=0; i<8; i++ ) {
|
|||
|
|
if( SideSector[i].nX < 0 || SideSector[i].nX >= (int)CTEtWorld::GetInstance().GetGridX() ) continue;
|
|||
|
|
if( SideSector[i].nY < 0 || SideSector[i].nY >= (int)CTEtWorld::GetInstance().GetGridY() ) continue;
|
|||
|
|
|
|||
|
|
CTEtWorldSector *pSideSector = CTEtWorld::GetInstance().GetSector( SideSector[i] );
|
|||
|
|
if( pSideSector->IsEmpty() ) continue;
|
|||
|
|
if( pVariable->GetVariableBool() == true ) {
|
|||
|
|
CGlobalValue::GetInstance().m_bLockSideHeight = true;
|
|||
|
|
if( pSideSector->LoadSector( CTEtWorldSector::SRL_TERRAIN ) == true ) {
|
|||
|
|
pSideSector->Show( true );
|
|||
|
|
if( !CGlobalValue::GetInstance().IsCheckOutMe() ) continue;
|
|||
|
|
CRect rcRect = CRect( -1, -1, -1, -1 );
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>̵<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
|
|||
|
|
switch(i) {
|
|||
|
|
case 1: // <20><>
|
|||
|
|
case 6: // <20>Ʒ<EFBFBD>
|
|||
|
|
{
|
|||
|
|
int nSourceCount = pSector->GetTileWidthCount();
|
|||
|
|
int nTargetCount = pSideSector->GetTileWidthCount();
|
|||
|
|
|
|||
|
|
short *pSourceHeight = pSector->GetHeightPtr();
|
|||
|
|
short *pTargetHeight = pSideSector->GetHeightPtr();
|
|||
|
|
float fRatio = pSideSector->GetTileHeightCount() / (float)pSector->GetTileHeightCount();
|
|||
|
|
float fMultiplyRatio = pSideSector->GetHeightMultiply() / pSector->GetHeightMultiply();
|
|||
|
|
|
|||
|
|
if( i == 1 ) {
|
|||
|
|
for( int i=0; i<nSourceCount; i++ ) {
|
|||
|
|
int nSourceIndex = i;
|
|||
|
|
int nTargetIndex = (int)( ( pSideSector->GetTileHeightCount() - 1 ) * pSideSector->GetTileWidthCount() + ( i * fRatio ) );
|
|||
|
|
int nValue = (int)( pTargetHeight[ nTargetIndex ] * fMultiplyRatio );
|
|||
|
|
if( nValue < -32767 ) nValue = -32767;
|
|||
|
|
else if( nValue > 32767 ) nValue = 32767;
|
|||
|
|
pSourceHeight[ nSourceIndex ] = nValue;
|
|||
|
|
}
|
|||
|
|
rcRect = CRect( 0, 0, pSector->GetTileWidthCount(), 1 );
|
|||
|
|
}
|
|||
|
|
else if( i == 6 ) {
|
|||
|
|
for( int i=0; i<nSourceCount; i++ ) {
|
|||
|
|
int nSourceIndex = ( pSector->GetTileHeightCount() - 1 ) * pSector->GetTileWidthCount() + i ;
|
|||
|
|
int nTargetIndex = (int)( i * fRatio );
|
|||
|
|
int nValue = (int)( pTargetHeight[ nTargetIndex ] * fMultiplyRatio );
|
|||
|
|
if( nValue < -32767 ) nValue = -32767;
|
|||
|
|
else if( nValue > 32767 ) nValue = 32767;
|
|||
|
|
pSourceHeight[ nSourceIndex ] = nValue;
|
|||
|
|
}
|
|||
|
|
rcRect = CRect( 0, pSector->GetTileHeightCount() - 1, pSector->GetTileWidthCount(), pSector->GetTileHeightCount() );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 3: // <20><><EFBFBD><EFBFBD>
|
|||
|
|
case 4: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{
|
|||
|
|
int nSourceCount = pSector->GetTileHeightCount();
|
|||
|
|
int nTargetCount = pSideSector->GetTileHeightCount();
|
|||
|
|
|
|||
|
|
short *pSourceHeight = pSector->GetHeightPtr();
|
|||
|
|
short *pTargetHeight = pSideSector->GetHeightPtr();
|
|||
|
|
float fRatio = pSideSector->GetTileWidthCount() / (float)pSector->GetTileWidthCount();
|
|||
|
|
float fMultiplyRatio = pSideSector->GetHeightMultiply() / pSector->GetHeightMultiply();
|
|||
|
|
|
|||
|
|
if( i == 3 ) {
|
|||
|
|
for( int i=0; i<nSourceCount; i++ ) {
|
|||
|
|
int nSourceIndex = i * pSector->GetTileWidthCount() ;
|
|||
|
|
int nTargetIndex = (int)( ( i * fRatio ) * (float)pSideSector->GetTileWidthCount() + ( pSideSector->GetTileWidthCount() - 1 ) );
|
|||
|
|
int nValue = (int)( pTargetHeight[ nTargetIndex ] * fMultiplyRatio );
|
|||
|
|
if( nValue < -32767 ) nValue = -32767;
|
|||
|
|
else if( nValue > 32767 ) nValue = 32767;
|
|||
|
|
pSourceHeight[ nSourceIndex ] = nValue;
|
|||
|
|
}
|
|||
|
|
rcRect = CRect( 0, 0, 1, pSector->GetTileHeightCount() );
|
|||
|
|
}
|
|||
|
|
else if( i == 4 ) {
|
|||
|
|
for( int i=0; i<nSourceCount; i++ ) {
|
|||
|
|
int nSourceIndex = i * pSector->GetTileWidthCount() + ( pSector->GetTileWidthCount() - 1 );
|
|||
|
|
int nTargetIndex = (int)( ( i * fRatio ) * (float)pSideSector->GetTileWidthCount() );
|
|||
|
|
int nValue = (int)( pTargetHeight[ nTargetIndex ] * fMultiplyRatio );
|
|||
|
|
if( nValue < -32767 ) nValue = -32767;
|
|||
|
|
else if( nValue > 32767 ) nValue = 32767;
|
|||
|
|
pSourceHeight[ nSourceIndex ] = nValue;
|
|||
|
|
}
|
|||
|
|
rcRect = CRect( pSector->GetTileWidthCount() - 1, 0, pSector->GetTileWidthCount(), pSector->GetTileHeightCount() );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
pSector->UpdateHeight( rcRect );
|
|||
|
|
pSector->SetLastUpdateRect( rcRect );
|
|||
|
|
pSector->ResetUpdateInfo();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
CGlobalValue::GetInstance().m_bLockSideHeight = false;
|
|||
|
|
pSideSector->FreeSector( CTEtWorldSector::SRL_TERRAIN );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 6: // Stretch
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector == -1 ) break;
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( pSector == NULL ) break;
|
|||
|
|
|
|||
|
|
std::vector<int> *pVecList = &CGlobalValue::GetInstance().m_nVecEditBlockList;
|
|||
|
|
if( pVecList->size() == 0 ) break;
|
|||
|
|
|
|||
|
|
CActionElementChangeBlockType *pAction = new CActionElementChangeBlockType( pSector );
|
|||
|
|
CString szStr;
|
|||
|
|
szStr.Format( "%s Anti Layer4 Stretch", pVariable->GetVariableBool() == true ? "Enable" : "False" );
|
|||
|
|
pAction->SetDesc( szStr );
|
|||
|
|
|
|||
|
|
TerrainType Type;
|
|||
|
|
if( pVariable->GetVariableBool() == true ) Type = TT_CLIFF;
|
|||
|
|
else Type = TT_NORMAL;
|
|||
|
|
|
|||
|
|
std::vector<int> nVecBlockType;
|
|||
|
|
std::vector<int> nVecPrevBlockType;
|
|||
|
|
for( DWORD i=0; i<pVecList->size(); i++ ) {
|
|||
|
|
int nBlockType = pSector->GetBlockType( (*pVecList)[i] );
|
|||
|
|
nVecPrevBlockType.push_back( nBlockType );
|
|||
|
|
|
|||
|
|
if( nBlockType == TT_DETAILNORMAL || nBlockType == TT_DETAILCLIFF )
|
|||
|
|
pSector->ChangeBlockType( (*pVecList)[i], (TerrainType)( 2 + Type ) );
|
|||
|
|
else pSector->ChangeBlockType( (*pVecList)[i], Type );
|
|||
|
|
|
|||
|
|
nVecBlockType.push_back( pSector->GetBlockType( (*pVecList)[i] ) );
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
pAction->ChangeBlockType( (*pVecList), nVecBlockType, nVecPrevBlockType );
|
|||
|
|
pAction->AddAction();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
CGlobalValue::GetInstance().SetModify();
|
|||
|
|
CGlobalValue::GetInstance().RefreshRender();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 7: // Detail Texture
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector == -1 ) break;
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( pSector == NULL ) break;
|
|||
|
|
|
|||
|
|
std::vector<int> *pVecList = &CGlobalValue::GetInstance().m_nVecEditBlockList;
|
|||
|
|
if( pVecList->size() == 0 ) break;
|
|||
|
|
|
|||
|
|
CActionElementChangeBlockType *pAction = new CActionElementChangeBlockType( pSector );
|
|||
|
|
CString szStr;
|
|||
|
|
szStr.Format( "%s Detail Texture", pVariable->GetVariableBool() == true ? "Enable" : "False" );
|
|||
|
|
pAction->SetDesc( szStr );
|
|||
|
|
|
|||
|
|
TerrainType Type;
|
|||
|
|
if( pVariable->GetVariableBool() == true ) Type = TT_DETAILNORMAL;
|
|||
|
|
else Type = TT_NORMAL;
|
|||
|
|
|
|||
|
|
std::vector<int> nVecBlockType;
|
|||
|
|
std::vector<int> nVecPrevBlockType;
|
|||
|
|
for( DWORD i=0; i<pVecList->size(); i++ ) {
|
|||
|
|
int nBlockType = pSector->GetBlockType( (*pVecList)[i] );
|
|||
|
|
nVecPrevBlockType.push_back( nBlockType );
|
|||
|
|
|
|||
|
|
if( nBlockType == TT_CLIFF || nBlockType == TT_DETAILCLIFF )
|
|||
|
|
pSector->ChangeBlockType( (*pVecList)[i], (TerrainType)( 1 + Type ) );
|
|||
|
|
else pSector->ChangeBlockType( (*pVecList)[i], Type );
|
|||
|
|
|
|||
|
|
nVecBlockType.push_back( pSector->GetBlockType( (*pVecList)[i] ) );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
pAction->ChangeBlockType( (*pVecList), nVecBlockType, nVecPrevBlockType );
|
|||
|
|
pAction->AddAction();
|
|||
|
|
|
|||
|
|
CGlobalValue::GetInstance().SetModify();
|
|||
|
|
CGlobalValue::GetInstance().RefreshRender();
|
|||
|
|
|
|||
|
|
// Layer Prev â<><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Refresh <20><><EFBFBD>ش<EFBFBD>.
|
|||
|
|
CWnd *pWnd = GetPaneWnd( LAYER_PANE );
|
|||
|
|
if( pWnd ) pWnd->SendMessage( UM_REFRESH_PANE_VIEW, 1 );
|
|||
|
|
|
|||
|
|
// Layer Distance <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD>ش<EFBFBD>.
|
|||
|
|
RefreshPropertyGridVariable();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 8:
|
|||
|
|
case 9:
|
|||
|
|
case 10:
|
|||
|
|
case 11:
|
|||
|
|
case 12:
|
|||
|
|
case 13:
|
|||
|
|
case 14:
|
|||
|
|
case 15:
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector == -1 ) break;
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( pSector == NULL ) break;
|
|||
|
|
|
|||
|
|
std::vector<int> *pVecList = &CGlobalValue::GetInstance().m_nVecEditBlockList;
|
|||
|
|
if( pVecList->size() == 0 ) break;
|
|||
|
|
|
|||
|
|
for( DWORD i=0; i<pVecList->size(); i++ ) {
|
|||
|
|
int nBlockType = pSector->GetBlockType( (*pVecList)[i] );
|
|||
|
|
pSector->ChangeTextureDistance( (*pVecList)[i], dwIndex - 8, pVariable->GetVariableFloat() );
|
|||
|
|
|
|||
|
|
// Layer 4 <20><> Cliff <20><> <20><><EFBFBD><EFBFBD>Update <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
|
|||
|
|
if( dwIndex == 11 ) {
|
|||
|
|
if( nBlockType == TT_CLIFF || nBlockType == TT_DETAILCLIFF ) {
|
|||
|
|
int nBlockX, nBlockY;
|
|||
|
|
int nBlockSizeX, nBlockSizeY;
|
|||
|
|
pSector->GetBlockCount( nBlockX, nBlockY );
|
|||
|
|
pSector->GetBlockSize( nBlockSizeX, nBlockSizeY );
|
|||
|
|
int nX = ( (*pVecList)[i] % nBlockY ) * nBlockSizeX;
|
|||
|
|
int nY = ( (*pVecList)[i] / nBlockY ) * nBlockSizeY;
|
|||
|
|
pSector->UpdateTextureCoord( CRect( nX, nY, nX + nBlockSizeX, nY + nBlockSizeY ) );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CGlobalValue::GetInstance().SetModify();
|
|||
|
|
CGlobalValue::GetInstance().RefreshRender();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case 16:
|
|||
|
|
case 17:
|
|||
|
|
case 18:
|
|||
|
|
case 19:
|
|||
|
|
{
|
|||
|
|
SectorIndex Sector = CGlobalValue::GetInstance().m_SelectGrid;
|
|||
|
|
if( Sector == -1 ) break;
|
|||
|
|
CTEtWorldSector *pSector = CTEtWorld::GetInstance().GetSector( Sector );
|
|||
|
|
if( pSector == NULL ) break;
|
|||
|
|
|
|||
|
|
std::vector<int> *pVecList = &CGlobalValue::GetInstance().m_nVecEditBlockList;
|
|||
|
|
if( pVecList->size() == 0 ) break;
|
|||
|
|
|
|||
|
|
for( DWORD i=0; i<pVecList->size(); i++ ) {
|
|||
|
|
int nBlockType = pSector->GetBlockType( (*pVecList)[i] );
|
|||
|
|
pSector->ChangeTextureRotation( (*pVecList)[i], dwIndex - 16, pVariable->GetVariableFloat() );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CGlobalValue::GetInstance().SetModify();
|
|||
|
|
CGlobalValue::GetInstance().RefreshRender();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// Shader Param
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CSectorInfoPaneView::OnSelectChangeValue( CUnionValueProperty *pVariable, DWORD dwIndex )
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
LRESULT CSectorInfoPaneView::OnGridNotify(WPARAM wParam, LPARAM lParam)
|
|||
|
|
{
|
|||
|
|
return ProcessNotifyGrid( wParam, lParam );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
CActionElementModifyHeightMultiply::CActionElementModifyHeightMultiply( CTEtWorldSector *pSector )
|
|||
|
|
: CActionElement( &s_BrushActionCommander )
|
|||
|
|
{
|
|||
|
|
m_pSector = pSector;
|
|||
|
|
m_fHeight = m_fPrevHeight = 0.f;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CActionElementModifyHeightMultiply::~CActionElementModifyHeightMultiply()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CActionElementModifyHeightMultiply::Redo()
|
|||
|
|
{
|
|||
|
|
m_pSector->SetHeightMultiply( m_fHeight );
|
|||
|
|
CWnd *pWnd = GetPaneWnd( SECTOR_PANE );
|
|||
|
|
if( pWnd ) pWnd->SendMessage( UM_REFRESH_PANE_VIEW );
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CActionElementModifyHeightMultiply::Undo()
|
|||
|
|
{
|
|||
|
|
m_pSector->SetHeightMultiply( m_fPrevHeight );
|
|||
|
|
CWnd *pWnd = GetPaneWnd( SECTOR_PANE );
|
|||
|
|
if( pWnd ) pWnd->SendMessage( UM_REFRESH_PANE_VIEW );
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CActionElementModifyHeightMultiply::ModifyHeightMultiply( float fHeight )
|
|||
|
|
{
|
|||
|
|
m_fHeight = fHeight;
|
|||
|
|
m_fPrevHeight = m_pSector->GetHeightMultiply();
|
|||
|
|
|
|||
|
|
CString szStr;
|
|||
|
|
szStr.Format( "Height Multiply : %.2f->%.2f", m_fPrevHeight, m_fHeight );
|
|||
|
|
SetDesc( szStr );
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
CActionElementChangeBlockType::CActionElementChangeBlockType( CTEtWorldSector *pSector )
|
|||
|
|
: CActionElement( &s_BrushActionCommander )
|
|||
|
|
{
|
|||
|
|
m_pSector = pSector;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CActionElementChangeBlockType::~CActionElementChangeBlockType()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CActionElementChangeBlockType::Redo()
|
|||
|
|
{
|
|||
|
|
for( DWORD i=0; i<m_nVecBlockList.size(); i++ ) {
|
|||
|
|
m_pSector->ChangeBlockType( m_nVecBlockList[i], (TerrainType)m_nVecBlockType[i] );
|
|||
|
|
}
|
|||
|
|
CWnd *pWnd = GetPaneWnd( SECTOR_PANE );
|
|||
|
|
if( pWnd ) pWnd->SendMessage( UM_REFRESH_PANE_VIEW );
|
|||
|
|
pWnd = GetPaneWnd( LAYER_PANE );
|
|||
|
|
if( pWnd ) pWnd->SendMessage( UM_REFRESH_PANE_VIEW, 1 );
|
|||
|
|
CGlobalValue::GetInstance().RefreshRender();
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CActionElementChangeBlockType::Undo()
|
|||
|
|
{
|
|||
|
|
for( DWORD i=0; i<m_nVecBlockList.size(); i++ ) {
|
|||
|
|
m_pSector->ChangeBlockType( m_nVecBlockList[i], (TerrainType)m_nVecPrevBlockType[i] );
|
|||
|
|
}
|
|||
|
|
CWnd *pWnd = GetPaneWnd( SECTOR_PANE );
|
|||
|
|
if( pWnd ) pWnd->SendMessage( UM_REFRESH_PANE_VIEW );
|
|||
|
|
pWnd = GetPaneWnd( LAYER_PANE );
|
|||
|
|
if( pWnd ) pWnd->SendMessage( UM_REFRESH_PANE_VIEW, 1 );
|
|||
|
|
CGlobalValue::GetInstance().RefreshRender();
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CActionElementChangeBlockType::ChangeBlockType( std::vector<int> &nVecList, std::vector<int> &nVecTypeList, std::vector<int> &nVecPrevTypeList )
|
|||
|
|
{
|
|||
|
|
m_nVecBlockList = nVecList;
|
|||
|
|
m_nVecBlockType = nVecTypeList;
|
|||
|
|
m_nVecPrevBlockType = nVecPrevTypeList;
|
|||
|
|
}
|