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>
197 lines
3.2 KiB
C++
197 lines
3.2 KiB
C++
|
|
|
|
#include "TriggerEvent.h"
|
|
|
|
#include "BaseDataDefine.h"
|
|
#include "SoundBuffer.h"
|
|
#include "SoundManager.h"
|
|
#include <string.h>
|
|
#include <stdexcept>
|
|
|
|
|
|
//ÀÌÆåÆ® Ãâ·Â
|
|
#include "SceneManager.h"
|
|
#include <CEffScript.h>
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
//
|
|
|
|
ITriggerEvent::ITriggerEvent()
|
|
: m_pszArg( 0 )
|
|
{
|
|
}
|
|
|
|
ITriggerEvent::~ITriggerEvent()
|
|
{
|
|
ITriggerEvent::Destroy();
|
|
}
|
|
|
|
void ITriggerEvent::Create( const char * szArg )
|
|
{
|
|
SetArgument( szArg );
|
|
}
|
|
|
|
void ITriggerEvent::Destroy()
|
|
{
|
|
delete [] m_pszArg;
|
|
m_pszArg = 0;
|
|
}
|
|
|
|
void ITriggerEvent::SetArgument( const char * szArg )
|
|
{
|
|
if( m_pszArg )
|
|
delete [] m_pszArg;
|
|
|
|
int size = strlen( szArg );
|
|
m_pszArg = new char[ size + 1 ];
|
|
|
|
strcpy( m_pszArg, szArg );
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
//
|
|
|
|
|
|
CEvent_MusicPlay::CEvent_MusicPlay()
|
|
: m_pSoundBuffer( NULL )
|
|
{
|
|
}
|
|
|
|
CEvent_MusicPlay::~CEvent_MusicPlay()
|
|
{
|
|
Destroy();
|
|
|
|
m_pSoundBuffer = 0;
|
|
}
|
|
|
|
void CEvent_MusicPlay::Create( const char * szFilename )
|
|
{
|
|
try
|
|
{
|
|
CSoundManager & sndManager = CSoundManager::GetInstance();
|
|
|
|
char szArg[1024];
|
|
strcpy( szArg, SOUNDFILEPATH );
|
|
strcpy( szArg + strlen( szArg ), szFilename );
|
|
|
|
ITriggerEvent::Create( szArg );
|
|
ISoundObject & sndBuf = sndManager.GetBuffer( szArg, false, true, 2 );
|
|
|
|
m_pSoundBuffer = &sndBuf;
|
|
}
|
|
catch( std::exception & e )
|
|
{
|
|
MessageBox( NULL, e.what(), "Error!!", MB_OK );
|
|
}
|
|
}
|
|
|
|
void CEvent_MusicPlay::Destroy()
|
|
{
|
|
ITriggerEvent::Destroy();
|
|
}
|
|
|
|
void CEvent_MusicPlay::Begin()
|
|
{
|
|
try
|
|
{
|
|
m_pSoundBuffer->Play( 0, true );
|
|
}
|
|
catch( std::exception & e )
|
|
{
|
|
MessageBox( NULL, e.what(), "Error!!", MB_OK );
|
|
}
|
|
}
|
|
|
|
void CEvent_MusicPlay::End()
|
|
{
|
|
try
|
|
{
|
|
m_pSoundBuffer->Stop( 0 );
|
|
m_pSoundBuffer->Reset( 0 );
|
|
}
|
|
catch( std::exception & e )
|
|
{
|
|
MessageBox( NULL, e.what(), "Error!!", MB_OK );
|
|
}
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
//
|
|
|
|
CEvent_MusicPlayOnce::CEvent_MusicPlayOnce()
|
|
: CEvent_MusicPlay()
|
|
{
|
|
}
|
|
|
|
void CEvent_MusicPlayOnce::Begin()
|
|
{
|
|
try
|
|
{
|
|
if( !m_pSoundBuffer->IsPlaying( 0 ) )
|
|
{
|
|
m_pSoundBuffer->Reset( 0 );
|
|
m_pSoundBuffer->Play( 0, false );
|
|
}
|
|
}
|
|
catch( std::exception & e )
|
|
{
|
|
MessageBox( NULL, e.what(), "Error!!", MB_OK );
|
|
}
|
|
}
|
|
|
|
void CEvent_MusicPlayOnce::End()
|
|
{
|
|
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
//
|
|
|
|
#include <windows.h>
|
|
|
|
//staticº¯¼ö Á¤ÀÇ
|
|
CEvent_ShowMessage::FUNC_SHOWMSG CEvent_ShowMessage::ShowMessageFunction = NULL;
|
|
|
|
void CEvent_ShowMessage::Begin()
|
|
{
|
|
if( ShowMessageFunction )
|
|
(*ShowMessageFunction)( m_pszArg );
|
|
MessageBox( NULL, m_pszArg, "TriggerEvent", MB_OK );
|
|
|
|
}
|
|
|
|
void CEvent_ShowMessage::End()
|
|
{
|
|
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
//
|
|
|
|
CEvent_ShowEffect::CEvent_ShowEffect()
|
|
: m_pEffectScript( NULL )
|
|
{
|
|
|
|
}
|
|
|
|
void CEvent_ShowEffect::Begin()
|
|
{
|
|
if( m_pEffectScript == NULL )
|
|
{
|
|
m_pEffectScript = new CEffScript;
|
|
m_pEffectScript->SetInterfaceSet(true);
|
|
m_pEffectScript->GetScriptBinData((char*)m_pszArg);
|
|
CSceneManager::m_EffectManager.AddInterfaceScript(m_pEffectScript);
|
|
|
|
}
|
|
}
|
|
|
|
void CEvent_ShowEffect::End()
|
|
{
|
|
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|