Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
373 lines
10 KiB
C++
373 lines
10 KiB
C++
// PageGCMDSProperty.cpp : implementation file
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "worldcreator.h"
|
||
#include "PageGCMDSProperty.h"
|
||
|
||
#include "DlgDefaultAttachmentProperty.h"
|
||
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CPageGCMDSProperty property page
|
||
|
||
IMPLEMENT_DYNCREATE(CPageGCMDSProperty, CPropertyPage)
|
||
|
||
CPageGCMDSProperty::CPageGCMDSProperty() : CPropertyPage(CPageGCMDSProperty::IDD)
|
||
{
|
||
//{{AFX_DATA_INIT(CPageGCMDSProperty)
|
||
m_nMeshType = 1; // 1 = mesh type "TEXTURE"
|
||
//}}AFX_DATA_INIT
|
||
|
||
m_rpGCMDS = NULL;
|
||
}
|
||
|
||
CPageGCMDSProperty::~CPageGCMDSProperty()
|
||
{
|
||
}
|
||
|
||
void CPageGCMDSProperty::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CPropertyPage::DoDataExchange(pDX);
|
||
//{{AFX_DATA_MAP(CPageGCMDSProperty)
|
||
DDX_Control(pDX, IDC_EDIT_DEFAULTSCALE, m_ctrlDefaultScale);
|
||
DDX_Control(pDX, IDC_LIST_DEFAULTATTACHMENT, m_ctrlDefaultAttachment);
|
||
DDX_Control(pDX, IDC_EDIT_SKEYFILENAME, m_ctrlSkeyFileName);
|
||
DDX_Control(pDX, IDC_COMBO_DEFAULTOUTFIT, m_ctrlDefaultOutfit);
|
||
DDX_Control(pDX, IDC_COMBO_DEFAULTMOTIONSHEET, m_ctrlDefaultMotionSheet);
|
||
DDX_Control(pDX, IDC_COMBO_DEFAULTMOTION, m_ctrlDefaultMotion);
|
||
DDX_Radio(pDX, IDC_RADIO_MESHTYPETEXPIECE, m_nMeshType);
|
||
//}}AFX_DATA_MAP
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(CPageGCMDSProperty, CPropertyPage)
|
||
//{{AFX_MSG_MAP(CPageGCMDSProperty)
|
||
ON_CBN_SELCHANGE(IDC_COMBO_DEFAULTOUTFIT, OnSelchangeComboDefaultoutfit)
|
||
ON_EN_KILLFOCUS(IDC_EDIT_DEFAULTSCALE, OnKillfocusEditDefaultscale)
|
||
ON_CBN_SELCHANGE(IDC_COMBO_DEFAULTMOTIONSHEET, OnSelchangeComboDefaultmotionsheet)
|
||
ON_CBN_SELCHANGE(IDC_COMBO_DEFAULTMOTION, OnSelchangeComboDefaultmotion)
|
||
ON_WM_CONTEXTMENU()
|
||
ON_COMMAND(ID_MENUITEM_ADDITEM, OnMenuitemAdddefaultattachment)
|
||
ON_COMMAND(ID_MENUITEM_EDITITEM, OnMenuitemEditdefaultattachment)
|
||
ON_COMMAND(ID_MENUITEM_DELETEITEM, OnMenuitemDeletedefaultattachment)
|
||
ON_EN_SETFOCUS(IDC_EDIT_DEFAULTSCALE, OnSetfocusEditDefaultscale)
|
||
//}}AFX_MSG_MAP
|
||
END_MESSAGE_MAP()
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CPageGCMDSProperty message handlers
|
||
|
||
|
||
void CPageGCMDSProperty::UpdateDataByGCMDS( CZ3DGCMDS* pGCMDS )
|
||
{
|
||
m_rpGCMDS = pGCMDS;
|
||
|
||
if( NULL == pGCMDS )
|
||
{
|
||
return;
|
||
}
|
||
|
||
UpdateSkeyFileName();
|
||
UpdateMeshType();
|
||
UpdateDefaultOutfit();
|
||
UpdateDefaultMotion();
|
||
UpdateDefaultScale();
|
||
UpdateDefaultAttachment();
|
||
}
|
||
|
||
void CPageGCMDSProperty::UpdateSkeyFileName()
|
||
{
|
||
m_ctrlSkeyFileName.SetWindowText( m_rpGCMDS->GetSkeyFileName() );
|
||
}
|
||
|
||
void CPageGCMDSProperty::UpdateMeshType()
|
||
{
|
||
m_nMeshType = m_rpGCMDS->GetMeshType();
|
||
UpdateData( FALSE );
|
||
}
|
||
|
||
void CPageGCMDSProperty::UpdateDefaultOutfit()
|
||
{
|
||
int i, nCur;
|
||
std::map<Z3DTOK, Z3DOUTFITINFO*>* pvecTok2OutfitInfo;
|
||
std::map<Z3DTOK, Z3DOUTFITINFO*>::iterator itOutfit;
|
||
|
||
m_ctrlDefaultOutfit.ResetContent();
|
||
m_rpGCMDS->RetrieveOutfitList( pvecTok2OutfitInfo );
|
||
nCur = -1;
|
||
for(
|
||
i = 0, itOutfit = pvecTok2OutfitInfo->begin();
|
||
itOutfit != pvecTok2OutfitInfo->end();
|
||
++i, ++itOutfit
|
||
)
|
||
{
|
||
m_ctrlDefaultOutfit.AddString( g_TokOutfitName.GetString( itOutfit->first ) );
|
||
|
||
if( itOutfit->first == m_rpGCMDS->GetDefaultOutfit() )
|
||
{
|
||
nCur = i;
|
||
}
|
||
}
|
||
m_ctrlDefaultOutfit.SetCurSel( nCur );
|
||
}
|
||
|
||
void CPageGCMDSProperty::UpdateDefaultMotion()
|
||
{
|
||
int i, nCur;
|
||
std::map<Z3DTOK, Z3DMOTIONSHEET*>* pmapTok2MotionSheet;
|
||
std::map<Z3DTOK, Z3DMOTIONSHEET*>::iterator itMotionSheet;
|
||
Z3DMOTIONSHEET* pMotionSheet = NULL;
|
||
|
||
m_ctrlDefaultMotionSheet.ResetContent();
|
||
m_rpGCMDS->RetrieveMotionSheetList( pmapTok2MotionSheet );
|
||
nCur = -1;
|
||
for(
|
||
i = 0, itMotionSheet = pmapTok2MotionSheet->begin();
|
||
itMotionSheet != pmapTok2MotionSheet->end();
|
||
++i, ++itMotionSheet
|
||
)
|
||
{
|
||
m_ctrlDefaultMotionSheet.AddString(
|
||
g_TokSheetName.GetString( itMotionSheet->first ) );
|
||
|
||
if( itMotionSheet->first == m_rpGCMDS->GetDefaultMotionSheet() )
|
||
{
|
||
nCur = i;
|
||
pMotionSheet = itMotionSheet->second;
|
||
}
|
||
}
|
||
m_ctrlDefaultMotionSheet.SetCurSel( nCur );
|
||
|
||
std::map<Z3DTOK, Z3DMOTLET*>::iterator itMotlet;
|
||
nCur = -1;
|
||
for(
|
||
i = 0, itMotlet = pMotionSheet->mapTok2Motlet.begin();
|
||
itMotlet != pMotionSheet->mapTok2Motlet.end();
|
||
++i, ++itMotlet
|
||
)
|
||
{
|
||
m_ctrlDefaultMotion.AddString(
|
||
g_TokMotionName.GetString( itMotlet->first ) );
|
||
|
||
if( itMotlet->first == m_rpGCMDS->GetDefaultMotion() )
|
||
{
|
||
nCur = i;
|
||
}
|
||
}
|
||
m_ctrlDefaultMotion.SetCurSel( nCur );
|
||
}
|
||
|
||
void CPageGCMDSProperty::UpdateDefaultScale()
|
||
{
|
||
CString str;
|
||
str.Format( "%f", m_rpGCMDS->GetDefaultScale() );
|
||
m_ctrlDefaultScale.SetWindowText( str );
|
||
}
|
||
|
||
void CPageGCMDSProperty::UpdateDefaultAttachment()
|
||
{
|
||
std::vector<Z3DTOK_SLOT_ATTACHMENT>* pvec;
|
||
LVITEM lvitem;
|
||
lvitem.mask = LVIF_TEXT;
|
||
|
||
|
||
m_rpGCMDS->RetrieveDefaultAttachmentList( pvec );
|
||
|
||
m_ctrlDefaultAttachment.DeleteAllItems();
|
||
for( int i = 0; i < pvec->size(); ++i )
|
||
{
|
||
/*lvitem.iItem = i;
|
||
lvitem.iSubItem = 0;
|
||
lvitem.pszText = const_cast<char*>(g_TokSlotName.GetString( (*pvec)[i].tokSlot ));
|
||
m_ctrlDefaultAttachment.InsertItem( &lvitem );
|
||
|
||
lvitem.iItem = i;
|
||
lvitem.iSubItem = 1;
|
||
lvitem.pszText = const_cast<char*>(g_TokAttachmentName.GetString( (*pvec)[i].tokAttachment ));
|
||
m_ctrlDefaultAttachment.InsertItem( &lvitem );*/
|
||
m_ctrlDefaultAttachment.InsertItem( i, g_TokSlotName.GetString((*pvec)[i].tokSlot) );
|
||
m_ctrlDefaultAttachment.SetItemText( i, 1, g_TokAttachmentName.GetString((*pvec)[i].tokAttachment) );
|
||
}
|
||
}
|
||
|
||
|
||
BOOL CPageGCMDSProperty::OnInitDialog()
|
||
{
|
||
CPropertyPage::OnInitDialog();
|
||
|
||
// TODO: Add extra initialization here
|
||
DWORD dwExtStyle = m_ctrlDefaultAttachment.GetExtendedStyle();
|
||
dwExtStyle |= LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES;
|
||
m_ctrlDefaultAttachment.SetExtendedStyle( dwExtStyle );
|
||
|
||
m_ctrlDefaultAttachment.InsertColumn( 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> slot", LVCFMT_LEFT, 90, 0 );
|
||
m_ctrlDefaultAttachment.InsertColumn( 1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD>", LVCFMT_LEFT, 120, 1 );
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// EXCEPTION: OCX Property Pages should return FALSE
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnSelchangeComboDefaultoutfit()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
CString str;
|
||
m_ctrlDefaultOutfit.GetLBText( m_ctrlDefaultOutfit.GetCurSel(), str );
|
||
m_rpGCMDS->SetDefaultOutfit( g_TokOutfitName.GetTOK(str) );
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnKillfocusEditDefaultscale()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
CString str;
|
||
m_ctrlDefaultScale.GetWindowText( str );
|
||
float fScale = atof( str );
|
||
|
||
if( fScale <= 0.0f )
|
||
{
|
||
MessageBox( "0<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD> ū <20><><EFBFBD>̾<EFBFBD><CCBE><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
||
m_ctrlDefaultScale.SetFocus();
|
||
return;
|
||
}
|
||
|
||
m_rpGCMDS->SetDefaultScale( fScale );
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnSelchangeComboDefaultmotionsheet()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
CString str;
|
||
m_ctrlDefaultMotionSheet.GetLBText( m_ctrlDefaultMotionSheet.GetCurSel(), str );
|
||
m_rpGCMDS->SetDefaultMotionSheet( g_TokSheetName.GetTOK(str) );
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnSelchangeComboDefaultmotion()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
CString str;
|
||
m_ctrlDefaultMotion.GetLBText( m_ctrlDefaultMotion.GetCurSel(), str );
|
||
m_rpGCMDS->SetDefaultMotion( g_TokMotionName.GetTOK(str) );
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnContextMenu(CWnd* pWnd, CPoint point)
|
||
{
|
||
// TODO: Add your message handler code here
|
||
if( m_ctrlDefaultAttachment.GetSafeHwnd() == pWnd->GetSafeHwnd() )
|
||
{
|
||
OnDefaultAttachmentContextMenu( point );
|
||
return;
|
||
}
|
||
|
||
CPropertyPage::OnContextMenu( pWnd, point );
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnDefaultAttachmentContextMenu( CPoint point )
|
||
{
|
||
CMenu menuTmp;
|
||
CMenu* pContextMenu;
|
||
|
||
menuTmp.LoadMenu( IDR_MENU_GCMDS );
|
||
pContextMenu = menuTmp.GetSubMenu( 1 );
|
||
|
||
CPoint ptClient;
|
||
UINT uFlags;
|
||
ptClient = point;
|
||
m_ctrlDefaultAttachment.ScreenToClient( &ptClient );
|
||
int nHit = m_ctrlDefaultAttachment.HitTest( ptClient, &uFlags );
|
||
if( -1 == nHit )
|
||
{
|
||
pContextMenu->EnableMenuItem( ID_MENUITEM_ADDITEM, MF_ENABLED );
|
||
pContextMenu->EnableMenuItem( ID_MENUITEM_EDITITEM, MF_GRAYED );
|
||
pContextMenu->EnableMenuItem( ID_MENUITEM_DELETEITEM, MF_GRAYED );
|
||
}
|
||
else
|
||
{
|
||
pContextMenu->EnableMenuItem( ID_MENUITEM_ADDITEM, MF_ENABLED );
|
||
pContextMenu->EnableMenuItem( ID_MENUITEM_EDITITEM, MF_ENABLED );
|
||
pContextMenu->EnableMenuItem( ID_MENUITEM_DELETEITEM, MF_ENABLED );
|
||
}
|
||
|
||
pContextMenu->TrackPopupMenu( TPM_LEFTALIGN, point.x, point.y, this, NULL );
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnMenuitemAdddefaultattachment()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
std::vector<Z3DTOK_SLOT_ATTACHMENT>* pvec;
|
||
|
||
m_rpGCMDS->RetrieveDefaultAttachmentList(pvec);
|
||
|
||
CDlgDefaultAttachmentProperty dlg;
|
||
|
||
dlg.SetupDialog( m_rpGCMDS, "", "" );
|
||
if( IDCANCEL == dlg.DoModal() )
|
||
{
|
||
return;
|
||
}
|
||
|
||
Z3DTOK_SLOT_ATTACHMENT tokSlotNAttachment;
|
||
tokSlotNAttachment.tokSlot = dlg.GetSelectedAttachmentSlot();
|
||
tokSlotNAttachment.tokAttachment = dlg.GetSelectedAttachment();
|
||
|
||
pvec->push_back( tokSlotNAttachment );
|
||
|
||
UpdateDefaultAttachment();
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnMenuitemEditdefaultattachment()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
std::vector<Z3DTOK_SLOT_ATTACHMENT>* pvec;
|
||
|
||
m_rpGCMDS->RetrieveDefaultAttachmentList(pvec);
|
||
|
||
CDlgDefaultAttachmentProperty dlg;
|
||
|
||
POSITION pos = m_ctrlDefaultAttachment.GetFirstSelectedItemPosition();
|
||
int nIdx = (int)pos - 1;
|
||
dlg.SetupDialog( m_rpGCMDS, nIdx );
|
||
if( IDCANCEL == dlg.DoModal() )
|
||
{
|
||
return;
|
||
}
|
||
|
||
(*pvec)[nIdx].tokSlot = dlg.GetSelectedAttachmentSlot();
|
||
(*pvec)[nIdx].tokAttachment = dlg.GetSelectedAttachment();
|
||
|
||
UpdateDefaultAttachment();
|
||
}
|
||
|
||
|
||
void CPageGCMDSProperty::OnMenuitemDeletedefaultattachment()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
if( IDOK == MessageBox( "<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>?", "", MB_ICONQUESTION|MB_OKCANCEL ) )
|
||
{
|
||
std::vector<Z3DTOK_SLOT_ATTACHMENT>* pvec;
|
||
m_rpGCMDS->RetrieveDefaultAttachmentList(pvec);
|
||
|
||
POSITION pos = m_ctrlDefaultAttachment.GetFirstSelectedItemPosition();
|
||
int nIdx = (int)pos - 1;
|
||
|
||
for( int i = nIdx; i < (pvec->size()-1); ++i )
|
||
{
|
||
(*pvec)[i] = (*pvec)[i+1];
|
||
}
|
||
pvec->resize( pvec->size()-1 );
|
||
|
||
UpdateDefaultAttachment();
|
||
}
|
||
}
|
||
|
||
void CPageGCMDSProperty::OnSetfocusEditDefaultscale()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
m_ctrlDefaultScale.SetSel( 0, -1, TRUE );
|
||
}
|