Files
Client/GameTools/WORLDCREATOR/DlgTriggerProperty.cpp
LGram16 dd97ddec92 Restructure repository to include all source folders
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>
2025-11-29 20:17:20 +09:00

156 lines
3.6 KiB
C++
Raw Blame History

// DlgTriggerProperty.cpp : implementation file
//
#include "stdafx.h"
#include "worldcreator.h"
#include "DlgTriggerProperty.h"
#include <BaseDataDefine.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//
const char * strEventMusicPlay = "Play Music";
const char * strEventMusicPlayOnce = "Play Music Once";
const char * strEventShowMessage = "Show Message";
const char * strEventShowEffect = "Show Effect";
/////////////////////////////////////////////////////////////////////////////
// CDlgTriggerProperty dialog
CDlgTriggerProperty::CDlgTriggerProperty(CWnd* pParent /*=NULL*/)
: CDialog(CDlgTriggerProperty::IDD, pParent)
, m_iCurSel( 0 )
, m_iEventType( -1 )
{
//{{AFX_DATA_INIT(CDlgTriggerProperty)
m_strEventArg = _T("");
//}}AFX_DATA_INIT
}
void CDlgTriggerProperty::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgTriggerProperty)
DDX_Control(pDX, IDC_COMBO_EVENTTYPE, m_EventType);
DDX_Text(pDX, IDC_EDIT_EVENTARG, m_strEventArg);
//}}AFX_DATA_MAP
}
int CDlgTriggerProperty::EventType()
{
int curSel = m_EventType.GetCurSel();
if( curSel == CB_ERR )
return -1;
CString str;
m_EventType.GetLBText( curSel, str );
if( str == strEventMusicPlay )
{
return 0;
}
else if( str == strEventShowMessage )
{
return 1;
}
else if( str == strEventMusicPlayOnce )
{
return 2;
}
else if( str == strEventShowEffect )
{
return 3;
}
else
return -1;
}
void CDlgTriggerProperty::SetEventType( int eventType )
{
m_iCurSel = eventType;
}
BEGIN_MESSAGE_MAP(CDlgTriggerProperty, CDialog)
//{{AFX_MSG_MAP(CDlgTriggerProperty)
ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnButtonBrowse)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgTriggerProperty message handlers
void CDlgTriggerProperty::ConfirmSoundDirectory( CString & strFilename, CString & strFilenameSrc )
{
char szPathName[256], szSoundFilePath[256];
strcpy( szPathName, strFilenameSrc );
strlwr( szPathName );
strcpy( szSoundFilePath, SOUNDFILEPATH );
strlwr( szSoundFilePath );
char * pFinded = strstr( szPathName, szSoundFilePath );
if( pFinded == NULL )
{
char szMsg[256];
sprintf( szMsg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȭ<><C8AD><EFBFBD><EFBFBD> %s<><73> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B8AE> <20>־<EFBFBD><D6BE>߸<EFBFBD> <20>մϴ<D5B4>.", szSoundFilePath );
MessageBox( szMsg );
}
else
{
pFinded += strlen( szSoundFilePath );
strFilename = pFinded;
}
}
void CDlgTriggerProperty::OnButtonBrowse()
{
const char * filter = "All Files (*.*)|*.*|Effect Script Files (*.esf)|*.esf|Wave Files (*.wav)|*.wav|OGG Files (*.ogg)|*.ogg||";
CFileDialog FileDlg( TRUE, "*.*", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter, this );
FileDlg.m_ofn.lpstrInitialDir = SOUNDFILEPATH;
if( FileDlg.DoModal() == IDOK )
{
CString ext = FileDlg.GetFileExt();
ext.MakeLower();
if( ext == "wav" || ext == "ogg" )
ConfirmSoundDirectory( m_strEventArg, FileDlg.GetPathName() );
else
m_strEventArg = FileDlg.GetFileName();
UpdateData( FALSE );
}
}
BOOL CDlgTriggerProperty::OnInitDialog()
{
CDialog::OnInitDialog();
m_EventType.AddString( strEventMusicPlay );
m_EventType.AddString( strEventShowMessage );
m_EventType.AddString( strEventMusicPlayOnce );
m_EventType.AddString( strEventShowEffect );
m_EventType.SetCurSel( m_iCurSel );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgTriggerProperty::OnOK()
{
m_iEventType = EventType();
CDialog::OnOK();
}