305 lines
8.2 KiB
C++
305 lines
8.2 KiB
C++
#include "stdafx.h"
|
|
#include "SGameOtherEffectMng.h"
|
|
#include "SGameOtherEffect.h"
|
|
|
|
#include "SGame.h"
|
|
#include "SActionMgr.h"
|
|
#include "SGameMessage.h"
|
|
|
|
#include "SGameOption.h"
|
|
|
|
#include "SDebug_Util.h"
|
|
|
|
SGameOtherEffectMng::SGameOtherEffectMng( SGame * pGame )
|
|
{
|
|
m_pGame = pGame;
|
|
|
|
m_nNewFxID = 0;
|
|
|
|
while( !m_RecycleID.empty() )
|
|
m_RecycleID.pop();
|
|
}
|
|
|
|
SGameOtherEffectMng::~SGameOtherEffectMng()
|
|
{
|
|
AllDelOtherEffect();
|
|
|
|
m_pGame = NULL;
|
|
}
|
|
|
|
void SGameOtherEffectMng::AllDelOtherEffect()
|
|
{
|
|
std::vector< SGameOtherEffect*>::iterator iter = m_vOtherEffectList.begin();
|
|
for( ; iter != m_vOtherEffectList.end(); )
|
|
{
|
|
SAFE_DELETE( (*iter) );
|
|
iter = m_vOtherEffectList.erase(iter);
|
|
}
|
|
m_vOtherEffectList.clear();
|
|
|
|
while( !m_RecycleID.empty() )
|
|
m_RecycleID.pop();
|
|
}
|
|
|
|
void SGameOtherEffectMng::CheckEffect()
|
|
{
|
|
std::vector< SGameOtherEffect* >::iterator itOtherFx = m_vOtherEffectList.begin();
|
|
while( itOtherFx != m_vOtherEffectList.end() )
|
|
{
|
|
if( (*itOtherFx)->IsEnd() )
|
|
{
|
|
if( (*itOtherFx)->GetFxID() != 0 )
|
|
m_RecycleID.push( (*itOtherFx)->GetFxID() );
|
|
|
|
delete (*itOtherFx);
|
|
itOtherFx = m_vOtherEffectList.erase( itOtherFx );
|
|
}
|
|
else
|
|
itOtherFx++;
|
|
}
|
|
}
|
|
|
|
void SGameOtherEffectMng::Process( DWORD dwTime )
|
|
{
|
|
CheckEffect();
|
|
|
|
std::vector< SGameOtherEffect* >::iterator itOtherFx = m_vOtherEffectList.begin();
|
|
for( ; itOtherFx != m_vOtherEffectList.end(); itOtherFx++ )
|
|
{
|
|
if( !(*itOtherFx)->IsEnd() )
|
|
(*itOtherFx)->Process( dwTime );
|
|
}
|
|
}
|
|
|
|
void SGameOtherEffectMng::Render( unsigned long uRenderBitVector, class KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
std::vector< SGameOtherEffect* >::iterator itOtherFx = m_vOtherEffectList.begin();
|
|
for( ; itOtherFx != m_vOtherEffectList.end(); itOtherFx++ )
|
|
{
|
|
if( !(*itOtherFx)->IsEnd() )
|
|
(*itOtherFx)->Render( uRenderBitVector, ppViewportList, nViewportCount );
|
|
}
|
|
}
|
|
|
|
int SGameOtherEffectMng::GetOtherEffectRecycleID()
|
|
{
|
|
//제어가 필요한것만 아이디를 갖는다
|
|
int nRecycleID = -1;
|
|
if( !m_RecycleID.empty() )
|
|
{
|
|
nRecycleID = m_RecycleID.front();
|
|
m_RecycleID.pop();
|
|
}
|
|
|
|
if( nRecycleID == -1 )
|
|
return ++m_nNewFxID;
|
|
|
|
return nRecycleID;
|
|
}
|
|
|
|
void SGameOtherEffectMng::SetNextStepOtherEffect( int nFxID )
|
|
{
|
|
SGameOtherEffect* pSelectEffect = GetSelectEffect( nFxID );
|
|
if( pSelectEffect ) pSelectEffect->SetNextStepEffect();
|
|
}
|
|
|
|
void SGameOtherEffectMng::SetNextStepOtherEffect( AR_HANDLE hHandle, int nFxType, bool bCheckTargetHandle )
|
|
{
|
|
SGameOtherEffect* pSelectEffect = GetSelectEffect( hHandle, nFxType, bCheckTargetHandle );
|
|
if( pSelectEffect ) pSelectEffect->SetNextStepEffect();
|
|
}
|
|
|
|
void SGameOtherEffectMng::EndOtherEffect( int nFxID )
|
|
{
|
|
SGameOtherEffect* pSelectEffect = GetSelectEffect( nFxID );
|
|
if( pSelectEffect ) pSelectEffect->EndEffect();
|
|
}
|
|
|
|
void SGameOtherEffectMng::EndOtherEffect( AR_HANDLE hHandle, int nFxType, bool bCheckTargetHandle )
|
|
{
|
|
SGameOtherEffect* pSelectEffect = GetSelectEffect( hHandle, nFxType, bCheckTargetHandle );
|
|
if( pSelectEffect ) pSelectEffect->EndEffect();
|
|
}
|
|
|
|
void SGameOtherEffectMng::DelOtherEffect( AR_HANDLE hHandle, int nFxType, bool bCheckTargetHandle )
|
|
{
|
|
SGameOtherEffect* pSelectEffect = GetSelectEffect( hHandle, nFxType, bCheckTargetHandle );
|
|
if( pSelectEffect )
|
|
{
|
|
pSelectEffect->EndEffect();
|
|
pSelectEffect->SetEnd( true );
|
|
CheckEffect();
|
|
}
|
|
}
|
|
|
|
SGameOtherEffect* SGameOtherEffectMng::GetSelectEffect( int nFxID )
|
|
{
|
|
std::vector< SGameOtherEffect* >::iterator itOtherFx = m_vOtherEffectList.begin();
|
|
for( ; itOtherFx != m_vOtherEffectList.end(); itOtherFx++ )
|
|
{
|
|
if( (*itOtherFx)->GetFxID() == nFxID )
|
|
{
|
|
return (*itOtherFx);
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
SGameOtherEffect* SGameOtherEffectMng::GetSelectEffect( AR_HANDLE hHandle, int nFxType, bool bCheckTargetHandle )
|
|
{
|
|
std::vector< SGameOtherEffect* >::iterator itOtherFx = m_vOtherEffectList.begin();
|
|
for( ; itOtherFx != m_vOtherEffectList.end(); itOtherFx++ )
|
|
{
|
|
if( bCheckTargetHandle )
|
|
{
|
|
if( (*itOtherFx)->GetTargetHandle() == hHandle && (*itOtherFx)->GetFxType() == nFxType )
|
|
{
|
|
return (*itOtherFx);
|
|
}
|
|
}
|
|
else if( (*itOtherFx)->GetCasterHandle() == hHandle && (*itOtherFx)->GetFxType() == nFxType )
|
|
{
|
|
return (*itOtherFx);
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
int SGameOtherEffectMng::AddChaosEffect( SMSG_GET_CHAOS* pMsg )
|
|
{
|
|
int nMFxID = 6031;
|
|
int nMChaos = 0;
|
|
|
|
int nSFxID = 6031;
|
|
int nSChaos = 0;
|
|
|
|
if( GetGameOption().IsDetailRak() == 0 )
|
|
{
|
|
SGameChaosEffect* pChaosEffect = new SGameChaosEffect( pMsg->hPlayer, pMsg->hCorpse, m_pGame );
|
|
pChaosEffect->SetMotionSetData( nSFxID );
|
|
pChaosEffect->SetLakSize( pMsg->nChaos );
|
|
m_vOtherEffectList.push_back( pChaosEffect );
|
|
}
|
|
else
|
|
{
|
|
// TODO : 설정된 옵션을 알아내자
|
|
if( /*(혼돈 연출 옵션 == 간단히 표현)*/0 )
|
|
{
|
|
nMChaos = 1;
|
|
if( pMsg->nChaos >= 0 && pMsg->nChaos <= 4 ) nMFxID = 6031; //소형
|
|
else if( pMsg->nChaos >= 5 && pMsg->nChaos <= 29 ) nMFxID = 6032; //중형
|
|
else if( pMsg->nChaos >= 30 ) nMFxID = 6033; //대형
|
|
}
|
|
else if( /*(혼돈 연출 옵션 == 화려한 표현)*/1 )
|
|
{
|
|
if( pMsg->nChaos >= 0 && pMsg->nChaos <= 9 )
|
|
{
|
|
nSFxID = 6031; //소형
|
|
nSChaos = ( pMsg->nChaos % 10 );
|
|
}
|
|
else if( pMsg->nChaos >= 10 )
|
|
{
|
|
nSFxID = 6031; //소형
|
|
nSChaos = ( pMsg->nChaos % 10 );
|
|
|
|
nMFxID = 6033; //대형
|
|
nMChaos = ( pMsg->nChaos / 10 );
|
|
}
|
|
|
|
/* if( pMsg->nChaos >= 0 && pMsg->nChaos <= 4 )
|
|
{
|
|
nFxID = 6031; //소형
|
|
nChaos = ( pMsg->nChaos % 5 );
|
|
}
|
|
else if( pMsg->nChaos >= 5 && pMsg->nChaos <= 29 )
|
|
{
|
|
nFxID = 6032; //중형
|
|
nChaos = ( pMsg->nChaos % 30 ) / 5;
|
|
}
|
|
else if( pMsg->nChaos >= 30 )
|
|
{
|
|
nFxID = 6033; //대형
|
|
nChaos = ( pMsg->nChaos / 30 );
|
|
}*/
|
|
|
|
|
|
}
|
|
|
|
for( int nCount = 0; nCount < nMChaos; ++nCount )
|
|
{
|
|
SGameChaosEffect* pChaosEffect = new SGameChaosEffect( pMsg->hPlayer, pMsg->hCorpse, m_pGame );
|
|
pChaosEffect->SetMotionSetData( nMFxID );
|
|
pChaosEffect->SetLakSize( 10 );
|
|
m_vOtherEffectList.push_back( pChaosEffect );
|
|
}
|
|
|
|
for( int nCount = 0; nCount < nSChaos; ++nCount )
|
|
{
|
|
SGameChaosEffect* pChaosEffect = new SGameChaosEffect( pMsg->hPlayer, pMsg->hCorpse, m_pGame );
|
|
pChaosEffect->SetMotionSetData( nSFxID );
|
|
pChaosEffect->SetLakSize( 1 );
|
|
m_vOtherEffectList.push_back( pChaosEffect );
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int SGameOtherEffectMng::AddCreatureEvolutionEffect( int nFxType, OtherFxData* fxdata )
|
|
{
|
|
SGameCreatureEVEffect* pEvolutionEffect = new SGameCreatureEVEffect( fxdata->hCaster, fxdata->hTarget, m_pGame );
|
|
pEvolutionEffect->SetMotionSetData( fxdata->nFxID );
|
|
pEvolutionEffect->SetFxType( nFxType );
|
|
|
|
m_vOtherEffectList.push_back( pEvolutionEffect );
|
|
|
|
return 0;
|
|
}
|
|
|
|
int SGameOtherEffectMng::AddCastSummoningCreatureEffect( int nFxType, OtherFxData* fxdata )
|
|
{
|
|
int nFXID = GetOtherEffectRecycleID();
|
|
SGameCastingSummonCreatureEffect* pCastSummoningEffect = new SGameCastingSummonCreatureEffect( fxdata->hCaster, fxdata->hTarget, m_pGame );
|
|
pCastSummoningEffect->SetMotionSetData( fxdata->nFxID );
|
|
pCastSummoningEffect->SetCastingTime( fxdata->dwCatingTime );
|
|
pCastSummoningEffect->SetPosition( fxdata->vPos );
|
|
pCastSummoningEffect->SetFxID( nFXID );
|
|
pCastSummoningEffect->SetFxType( nFxType );
|
|
|
|
m_vOtherEffectList.push_back( pCastSummoningEffect );
|
|
|
|
return nFXID;
|
|
}
|
|
|
|
int SGameOtherEffectMng::AddSummoningCreatureEffect( int nFxType, OtherFxData* fxdata )
|
|
{
|
|
SGameSummonCreatureEffect* pSummoningEffect = new SGameSummonCreatureEffect( fxdata->hCaster, fxdata->hTarget, m_pGame );
|
|
// pSummoningEffect->SetMotionSetData( fxdata->nFxID );
|
|
|
|
m_vOtherEffectList.push_back( pSummoningEffect );
|
|
|
|
return 0;
|
|
}
|
|
|
|
int SGameOtherEffectMng::AddUnSummoningCreatureEffect( int nFxType, OtherFxData* fxdata )
|
|
{
|
|
SGameUnSummonCreatureEffect* pUnSummoningEffect = new SGameUnSummonCreatureEffect( fxdata->hCaster, fxdata->hTarget, m_pGame );
|
|
pUnSummoningEffect->SetFxType( nFxType );
|
|
// pUnSummoningEffect->SetMotionSetData( fxdata->nFxID );
|
|
|
|
m_vOtherEffectList.push_back( pUnSummoningEffect );
|
|
|
|
return 0;
|
|
}
|
|
|
|
int SGameOtherEffectMng::AddMonsterTamingEffect( int nFxType, OtherFxData* fxdata )
|
|
{
|
|
SGameTamingEffect* pTamingEffect = new SGameTamingEffect( 0, fxdata->hTarget, m_pGame );
|
|
// pSummoningEffect->SetMotionSetData( fxdata->nFxID );
|
|
pTamingEffect->SetFxType( nFxType );
|
|
|
|
m_vOtherEffectList.push_back( pTamingEffect );
|
|
|
|
return 0;
|
|
} |