1081 lines
29 KiB
C++
1081 lines
29 KiB
C++
#include "stdafx.h"
|
|
#include "SGameOtherEffect.h"
|
|
#include "KViewport.h"
|
|
#include "KSeqModel.h"
|
|
#include "SGameLocalPlayer.h"
|
|
#include "KRenderObjectEtc.h"
|
|
#include "GameDefine.h"
|
|
#include "KSeqAvatarEx.h"
|
|
#include "KRenderObjectMesh.h"
|
|
|
|
#include "SSkillDB.h"
|
|
#include "SMotionDB.h"
|
|
|
|
//#include "SGameMessageUI.h"
|
|
#include "SUISysMsgDefine.h"
|
|
|
|
#include "SSoundResourceDB.h"
|
|
#include "SGameMessage.h" // sonador 3.10.2 PC 방 혜택 관련 라크 획득 시스템 메시지 변경
|
|
#include "SDebug_Util.h"
|
|
|
|
extern const char * pEP_Name[];
|
|
extern const char * pEffectAniKey[];
|
|
|
|
SGameOtherEffect::SGameOtherEffect( AR_HANDLE hCaster, AR_HANDLE hTarget, SGameObject * pMsgHandler )
|
|
{
|
|
m_pEffect = NULL;
|
|
m_pMotionSet = NULL;
|
|
|
|
m_hCaster = 0;
|
|
m_hTarget = 0;
|
|
|
|
m_pCaster = NULL;
|
|
m_pTarget = NULL;
|
|
|
|
m_pCasterEPMatrix = NULL;
|
|
m_pTargetEPMatrix = NULL;
|
|
|
|
m_dwTime = 0;
|
|
m_dwOldTime = 0;
|
|
m_fSpeed = 0.f;
|
|
m_nStep = STEP_00;
|
|
m_bIsEnd = false;
|
|
|
|
m_fAcceleration = 0.f;
|
|
|
|
m_bEndEffect = false;
|
|
|
|
m_nFxID = 0;
|
|
|
|
m_vPosition = K3DVector( 0.f, 0.f, 0.f );
|
|
|
|
SetMessageHandler( pMsgHandler );
|
|
|
|
m_nSoundId = -1;
|
|
m_strSoundName = "";
|
|
}
|
|
|
|
SGameOtherEffect::~SGameOtherEffect()
|
|
{
|
|
SAFE_DELETE( m_pEffect );
|
|
|
|
m_pMotionSet = NULL;
|
|
}
|
|
|
|
bool SGameOtherEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool SGameOtherEffect::Render( unsigned long uRenderBitVector, class KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool SGameOtherEffect::CheckCaster()
|
|
{
|
|
m_pCaster = (SGameAvatarEx *)GetGameObject( m_hCaster );
|
|
if( m_pCaster == NULL)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
bool SGameOtherEffect::CheckTarget()
|
|
{
|
|
m_pTarget = (SGameAvatarEx *)GetGameObject( m_hTarget );
|
|
if( m_pTarget == NULL)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void SGameOtherEffect::SetMotionSetData( int nFxSetID )
|
|
{
|
|
m_pMotionSet = GetMotionFxSetDB().GetFXSet( nFxSetID ); //스킬 데이터
|
|
if( m_pMotionSet == NULL )
|
|
{
|
|
SetEnd( true );
|
|
_oprint( "Data Error: %d - Skill data not found\n", nFxSetID );
|
|
assert( 0 && "Data Error: %d - Skill data not found");
|
|
return;
|
|
}
|
|
|
|
SetAnimation();
|
|
}
|
|
|
|
const K3DMatrix* SGameOtherEffect::GetBoneFxMat( class SGameAvatarEx * pAvatar, int nFxPos )
|
|
{
|
|
assert( nFxPos <= EFFECT_POS_MAX && "The effect position is outdated" );
|
|
|
|
_CID( REQ_EVPOINT );
|
|
KMsgREQ_EVPOINT effect_pos_msg;
|
|
pAvatar->Perform( ANIPART_BIPED, id_REQ_EVPOINT, effect_pos_msg );
|
|
KEventPointSeq * pEv = NULL;
|
|
for( int i(0); effect_pos_msg.GetPointCount()>i; i++ )
|
|
{
|
|
pEv = effect_pos_msg.GetPoint(i);
|
|
const char * pName = pEv->GetName();
|
|
if( strlen(pName) && _stricmp( pName, pEP_Name[nFxPos] ) == 0 )
|
|
return &pEv->GetPoint();
|
|
}
|
|
|
|
//_oprint( "Data Error : 뼈 못 찾음 %d\n", iFxPos );
|
|
return NULL;
|
|
}
|
|
//최종 매트릭스 구하기
|
|
void SGameOtherEffect::ResultMatrix( K3DMatrix& vOut, SGameAvatarEx* pAvatar, const K3DMatrix* pMatrix )
|
|
{
|
|
if( pMatrix && pAvatar )
|
|
K3DMatrixMultiply( vOut, *pMatrix, *pAvatar->GetTransform() );
|
|
else if( pAvatar )
|
|
vOut = *pAvatar->GetTransform();
|
|
else
|
|
K3DMatrixIdentity( vOut );
|
|
|
|
}
|
|
//이동 속도 구하기
|
|
void SGameOtherEffect::ResultAcc( const K3DVector* vStart, const K3DVector* vEnd, float fSpeed )
|
|
{
|
|
float fLength = K3DVectorLength( (*vStart) - (*vEnd) );
|
|
m_fSpeed = ( fLength / GameRule::DEFAULT_UNIT_SIZE ) * fSpeed;
|
|
}
|
|
|
|
//렌더 끄기
|
|
void SGameOtherEffect::SetRenderFlagOff( KSeqModel* pSeqModel )
|
|
{
|
|
_CID( SETFORCERENDER_FLAG );
|
|
pSeqModel->Perform( id_SETFORCERENDER_FLAG, KArg() );
|
|
pSeqModel->PlayAnimation( 0, "NOT_FOUND" );
|
|
}
|
|
|
|
float SGameOtherEffect::RandomNumber(float fMin, float fMax)
|
|
{
|
|
if (fMin == fMax) return(fMin);
|
|
float fRandom = (float)rand() / (float)RAND_MAX;
|
|
return((fRandom * (float)fabs(fMax-fMin))+fMin);
|
|
};
|
|
|
|
K3DVector SGameOtherEffect::RandomNumber(K3DVector vMin, K3DVector vMax)
|
|
{
|
|
float x = RandomNumber(vMin.x, vMax.x);
|
|
float y = RandomNumber(vMin.y, vMax.y);
|
|
float z = RandomNumber(vMin.z, vMax.z);
|
|
return(K3DVector(x,y,z));
|
|
};
|
|
|
|
void SGameOtherEffect::PlaySoundFx( SGameAvatarEx* pCaster, struct _MOTION_FX_SET* pFxSet, int nPlayStep, K3DVector* vPosition )
|
|
{
|
|
if( m_nSoundId != -1 )
|
|
{
|
|
StopSound( m_strSoundName.c_str(), m_nSoundId );
|
|
m_nSoundId = -1;
|
|
m_strSoundName = "";
|
|
}
|
|
|
|
if( pFxSet )
|
|
{
|
|
if( nPlayStep == 0 && pFxSet->IsSound[nPlayStep] )
|
|
{
|
|
m_strSoundName = GetResourceDB().GetSoundResourceName( pFxSet->sound_start_file_ID );
|
|
m_nSoundId = StartSound( pCaster, m_strSoundName.c_str(), *vPosition, false, pFxSet->nSound_volumn, false, pFxSet->sound_option );
|
|
}
|
|
else if( nPlayStep == 1 && pFxSet->IsSound[nPlayStep] )
|
|
{
|
|
m_strSoundName = GetResourceDB().GetSoundResourceName( pFxSet->sound_middle_file_ID );
|
|
m_nSoundId = StartSound( pCaster, m_strSoundName.c_str(), *vPosition, false, pFxSet->nSound_volumn, true, pFxSet->sound_option );
|
|
}
|
|
else if( nPlayStep == 2 && pFxSet->IsSound[nPlayStep] )
|
|
{
|
|
m_strSoundName = GetResourceDB().GetSoundResourceName( pFxSet->sound_end_file_ID );
|
|
m_nSoundId = StartSound( pCaster, m_strSoundName.c_str(), *vPosition, false, pFxSet->nSound_volumn, false, pFxSet->sound_option );
|
|
}
|
|
}
|
|
}
|
|
|
|
void SGameOtherEffect::SetEnd( bool bEnd )
|
|
{
|
|
PlaySoundFx( NULL, NULL, 0, NULL );
|
|
m_bIsEnd = bEnd;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////혼돈의 잔재 이펙트
|
|
///////
|
|
SGameChaosEffect::SGameChaosEffect( AR_HANDLE hCaster, AR_HANDLE hTarget, SGameObject* pMsgHandler ) : SGameOtherEffect( hCaster, hTarget, pMsgHandler )
|
|
{
|
|
m_hCaster = hCaster;
|
|
m_hTarget = hTarget;
|
|
|
|
K3DMatrixIdentity( m_matCaster );
|
|
K3DMatrixIdentity( m_matTarget );
|
|
|
|
m_vPathPosition = K3DVector( 0.f, 0.f, 0.f );
|
|
m_vRandomPathPosition = K3DVector( 0.f, 0.f, 0.f );
|
|
|
|
m_nMaxMoveCount = 3;
|
|
m_nMoveCount = 0;
|
|
|
|
m_fSpeed = 50.f; //디비에서 읽던지 하자
|
|
m_fAcceleration = 10.f; //디비에서 읽던지 하자
|
|
|
|
m_pThrowFx = NULL;
|
|
m_pHittingFx = NULL;
|
|
m_pDrainHittingFx = NULL;
|
|
|
|
m_pThrowFxSet = NULL;
|
|
m_pHittingFxSet = NULL;
|
|
m_pDrainHittingFxSet = NULL;
|
|
|
|
m_nLakSize = 0;
|
|
}
|
|
|
|
SGameChaosEffect::~SGameChaosEffect()
|
|
{
|
|
SAFE_DELETE( m_pThrowFx );
|
|
SAFE_DELETE( m_pHittingFx );
|
|
SAFE_DELETE( m_pDrainHittingFx );
|
|
}
|
|
|
|
void SGameChaosEffect::SetLakSize( int nSize )
|
|
{
|
|
m_nLakSize = nSize;
|
|
}
|
|
|
|
void SGameChaosEffect::SetMotionSetData( int nFxSetID )
|
|
{
|
|
m_pThrowFxSet = GetMotionFxSetDB().GetFXSet( nFxSetID );
|
|
m_pHittingFxSet = GetMotionFxSetDB().GetFXSet( 5090 );
|
|
m_pDrainHittingFxSet = GetMotionFxSetDB().GetFXSet( 4042 );
|
|
|
|
if( m_pThrowFxSet == NULL ||
|
|
m_pHittingFxSet == NULL ||
|
|
m_pDrainHittingFxSet == NULL )
|
|
{
|
|
SetEnd( true );
|
|
assert( 0 && "Data Error : 스킬 데이타 없음");
|
|
return;
|
|
}
|
|
|
|
SetAnimation();
|
|
}
|
|
|
|
void SGameChaosEffect::SetAnimation()
|
|
{
|
|
m_pThrowFx = new KSeqModel;
|
|
m_pHittingFx = new KSeqModel;
|
|
m_pDrainHittingFx = new KSeqModel;
|
|
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
m_pThrowFx->AddAnimation( pEffectAniKey[1], GetResourceDB().GetEffectResourceName( m_pThrowFxSet->graphic_effect_middle_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pHittingFx->AddAnimation( pEffectAniKey[0], GetResourceDB().GetEffectResourceName( m_pHittingFxSet->graphic_effect_start_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pDrainHittingFx->AddAnimation( pEffectAniKey[0], GetResourceDB().GetEffectResourceName( m_pDrainHittingFxSet->graphic_effect_start_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
|
|
bool SGameChaosEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
if( IsEnd() ) return true;
|
|
|
|
int nStep = GetStep();
|
|
if( !CheckCaster() || !CheckTarget() )
|
|
{
|
|
if( STEP_00 == nStep || STEP_01 == nStep ) //step이 0이나 1이면 그냥 끝낸다
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
else if( STEP_02 == nStep ) //step이 2면 바로 거리 계산후 step3 호출
|
|
{
|
|
if( m_pCaster == NULL )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
else
|
|
CallNextStep( dwTime );
|
|
}
|
|
else
|
|
{
|
|
if( m_pCaster == NULL )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
//시체에서 나타나는 이펙트 출력
|
|
if( nStep == STEP_00 )
|
|
{
|
|
//타겟 이벤트 포인트 구하기
|
|
m_pTargetEPMatrix = GetBoneFxMat( m_pTarget, EFFECT_POS_BOTTOM );
|
|
m_pHittingFx->PlayAnimation( dwTime, pEffectAniKey[0] );
|
|
|
|
ResultMatrix( m_matTarget, m_pTarget, m_pTargetEPMatrix );
|
|
PlaySoundFx( m_pCaster, m_pHittingFxSet, 0, &K3DVector( m_matTarget._41, m_matTarget._42, m_matTarget._43 ) );
|
|
|
|
SetStep( STEP_01 );
|
|
}
|
|
//시체 이펙트가 끝났다면 날아 오는 이펙트 시작
|
|
else if( nStep == STEP_01 )
|
|
{
|
|
//타겟 위치 구하기
|
|
m_pHittingFx->SetTransform( m_matTarget );
|
|
m_pHittingFx->Process( dwTime );
|
|
|
|
//타겟 이펙트 발동이 끝났다면
|
|
if( !m_pHittingFx->IsPlaying() )
|
|
{
|
|
SetRenderFlagOff(m_pHittingFx);
|
|
|
|
m_pThrowFx->PlayAnimation( dwTime, pEffectAniKey[1], SEQTYPE_LOOP );
|
|
PlaySoundFx( m_pCaster, m_pThrowFxSet, 1, &K3DVector( m_matTarget._41, m_matTarget._42, m_matTarget._43 ) );
|
|
|
|
m_dwOldTime = dwTime;
|
|
m_dwTime = dwTime;
|
|
|
|
m_vPathPosition = K3DVector( 0.f, 0.f, 0.f );
|
|
m_vRandomPathPosition = RandomNumber( K3DVector( -1.0f, -1.0f, 1.0f ), K3DVector( 1.0f, 1.0f, 1.0f ) ) * 20.f;
|
|
ResultAcc( &m_vPathPosition, &m_vRandomPathPosition, 800.0f );
|
|
|
|
SetStep( STEP_02 );
|
|
}
|
|
}
|
|
//일정시간 만큼 허공을 떠돈다
|
|
else if( nStep == STEP_02 )
|
|
{
|
|
m_pThrowFx->Process( dwTime );
|
|
|
|
K3DVector vTemp;
|
|
K3DVectorLerp( vTemp, m_vPathPosition, m_vRandomPathPosition, (float)(dwTime - m_dwOldTime) / m_fSpeed );
|
|
if( (float)(dwTime - m_dwOldTime) < m_fSpeed )
|
|
{
|
|
m_dwTime = dwTime;
|
|
}
|
|
else
|
|
{
|
|
m_vPathPosition = vTemp;
|
|
m_vRandomPathPosition += RandomNumber( K3DVector( -1.0f, -1.0f, -0.5f ), K3DVector( 1.0f, 1.0f, 1.0f ) ) * 20.f;
|
|
m_dwOldTime = dwTime;
|
|
|
|
ResultAcc( &m_vPathPosition, &m_vRandomPathPosition, 800.0f );
|
|
|
|
m_nMoveCount++;
|
|
//혼돈
|
|
if( m_nMoveCount == m_nMaxMoveCount )
|
|
{
|
|
//다섯번 정도 왔다리 갔다리 했다면 끝낸다
|
|
CallNextStep( dwTime );
|
|
}
|
|
}
|
|
|
|
if( m_nMoveCount != m_nMaxMoveCount )
|
|
{
|
|
K3DMatrix matTrans;
|
|
K3DMatrixTranslation( matTrans, vTemp.x, vTemp.y, vTemp.z );
|
|
matTrans = matTrans * m_matTarget;
|
|
|
|
//지형 밑으로 들어가면 안된다
|
|
float z = 0.f;
|
|
WORD wTile=0;
|
|
GetHeight( matTrans._41, matTrans._42, z,wTile );
|
|
if( m_nMoveCount != 0 && matTrans._43 < z + 5.0f )
|
|
matTrans._43 = z + 5.0f;
|
|
|
|
m_pThrowFx->SetTransform( matTrans );
|
|
}
|
|
}
|
|
//일정 시간이 지나면 캐스터에게 빨려들어간다
|
|
else if( nStep == STEP_03 )
|
|
{
|
|
m_pThrowFx->Process( dwTime );
|
|
|
|
ResultMatrix( m_matCaster, m_pCaster, m_pCasterEPMatrix );
|
|
K3DVector vCaster = K3DVector( m_matCaster._41, m_matCaster._42, m_matCaster._43 );
|
|
|
|
float fLength = K3DVectorLength( vCaster - m_vPosition );
|
|
float fTime = (fLength / m_fSpeed) * 1000.f;
|
|
|
|
K3DVectorLerp( m_vPosition, m_vPosition, vCaster, (float)(dwTime - m_dwOldTime) / fTime );
|
|
if( (float)(dwTime - m_dwOldTime) < fTime )
|
|
{
|
|
m_pThrowFx->SetPosition( m_vPosition );
|
|
}
|
|
else
|
|
{
|
|
if( m_pCaster->IsLocalPlayer() )
|
|
{
|
|
// sonador 3.10.2 PC 방 혜택 관련 라크 획득 시스템 메시지 변경
|
|
int nTotalLak = 0, nTotalBonusLak = 0, nBonusLakPercentage = 0;
|
|
char nBonusLakType = 0;
|
|
if( ((SGameLocalPlayer*)m_pCaster)->AbsorbLak( m_nLakSize, nTotalLak, nTotalBonusLak, nBonusLakPercentage, nBonusLakType ) )
|
|
{
|
|
if( nTotalLak > 0 )
|
|
{
|
|
SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_GET_LAK, nTotalLak ) );
|
|
if( nTotalBonusLak > -1 )
|
|
{
|
|
if( nBonusLakType == SMSG_GET_CHAOS::CHAOS_BONUS_TYPE::CHAOS_BONUS_PCBANG )
|
|
SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_BONUS03, nBonusLakPercentage, nTotalBonusLak ) );
|
|
else if( nBonusLakType == SMSG_GET_CHAOS::CHAOS_BONUS_TYPE::CHAOS_BONUS_PREMIUM_PCBANG )
|
|
SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_BONUS_DOUBLE02, nBonusLakPercentage, nTotalBonusLak ) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//흡수 이펙트 시작
|
|
SetRenderFlagOff(m_pThrowFx);
|
|
|
|
m_pDrainHittingFx->PlayAnimation( dwTime, pEffectAniKey[0] );
|
|
PlaySoundFx( m_pCaster, m_pDrainHittingFxSet, 0, m_pCaster->GetPosition() );
|
|
|
|
SetStep( STEP_04 );
|
|
}
|
|
|
|
//20초동안 안끝났다면 끝낸다
|
|
if( (dwTime - m_dwOldTime) > 20000 )
|
|
{
|
|
if( m_pCaster->IsLocalPlayer() )
|
|
{
|
|
// sonador 3.10.2 PC 방 혜택 관련 라크 획득 시스템 메시지 변경
|
|
int nTotalLak = 0, nTotalBonusLak = 0, nBonusLakPercentage = 0;
|
|
char nBonusLakType = 0;
|
|
if( ((SGameLocalPlayer*)m_pCaster)->AbsorbLak( m_nLakSize, nTotalLak, nTotalBonusLak, nBonusLakPercentage, nBonusLakType ) )
|
|
{
|
|
if( nTotalLak > 0 )
|
|
{
|
|
SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_GET_LAK, nTotalLak ) );
|
|
if( nTotalBonusLak > -1 )
|
|
{
|
|
if( nBonusLakType == SMSG_GET_CHAOS::CHAOS_BONUS_TYPE::CHAOS_BONUS_PCBANG )
|
|
SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_BONUS03, nBonusLakPercentage, nTotalBonusLak ) );
|
|
else if( nBonusLakType == SMSG_GET_CHAOS::CHAOS_BONUS_TYPE::CHAOS_BONUS_PREMIUM_PCBANG )
|
|
SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_BONUS_DOUBLE02, nBonusLakPercentage, nTotalBonusLak ) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//흡수 이펙트 시작
|
|
SetRenderFlagOff(m_pThrowFx);
|
|
|
|
m_pDrainHittingFx->PlayAnimation( dwTime, pEffectAniKey[0] );
|
|
PlaySoundFx( m_pCaster, m_pDrainHittingFxSet, 0, m_pCaster->GetPosition() );
|
|
|
|
SetStep( STEP_04 );
|
|
}
|
|
}
|
|
//끝낸다
|
|
else if( nStep == STEP_04 )
|
|
{
|
|
m_pDrainHittingFx->SetTransform( *m_pCaster->GetTransform() );
|
|
m_pDrainHittingFx->Process( dwTime );
|
|
|
|
if( !m_pDrainHittingFx->IsPlaying() )
|
|
{
|
|
SetEnd( true );
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
void SGameChaosEffect::CallNextStep( DWORD dwTime )
|
|
{
|
|
K3DMatrix matTrans;
|
|
//마지막으로 이동한 곳과 타겟 위치를 계산한다
|
|
K3DMatrixTranslation( matTrans, m_vPathPosition.x, m_vPathPosition.y, m_vPathPosition.z );
|
|
m_matTarget = matTrans * m_matTarget;
|
|
m_vPosition = K3DVector( m_matTarget._41, m_matTarget._42, m_matTarget._43 );
|
|
|
|
//캐스터의 이벤트 포인트를 가져온후 계산한다
|
|
m_pCasterEPMatrix = GetBoneFxMat( m_pCaster, EFFECT_POS_DAMAGE );
|
|
m_dwOldTime = dwTime;
|
|
m_fSpeed = 30;
|
|
|
|
SetStep( STEP_03 );
|
|
}
|
|
|
|
bool SGameChaosEffect::Render( unsigned long uRenderBitVector, class KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
for(int vit = 0; vit < nViewportCount; ++vit)
|
|
{
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_GAME)
|
|
{
|
|
m_pThrowFx->Render( ppViewportList[vit] );
|
|
m_pHittingFx->Render( ppViewportList[vit] );
|
|
m_pDrainHittingFx->Render( ppViewportList[vit] );
|
|
}
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_WATER)
|
|
{
|
|
m_pThrowFx->Render( ppViewportList[vit] );
|
|
m_pHittingFx->Render( ppViewportList[vit] );
|
|
m_pDrainHittingFx->Render( ppViewportList[vit] );
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////크리처 진화 이펙트
|
|
///////
|
|
SGameCreatureEVEffect::SGameCreatureEVEffect( AR_HANDLE hCaster, AR_HANDLE hTarget, SGameObject* pMsgHandler ) : SGameOtherEffect( hCaster, hTarget, pMsgHandler )
|
|
{
|
|
m_pRevolutionFx = NULL;
|
|
m_hCaster = hCaster;
|
|
m_hTarget = hTarget;
|
|
}
|
|
|
|
SGameCreatureEVEffect::~SGameCreatureEVEffect()
|
|
{
|
|
SAFE_DELETE( m_pRevolutionFx );
|
|
}
|
|
|
|
void SGameCreatureEVEffect::SetAnimation()
|
|
{
|
|
if( m_pMotionSet )
|
|
{
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
m_pRevolutionFx = new KSeqModel;
|
|
m_pRevolutionFx->AddAnimation( pEffectAniKey[0], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_start_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pRevolutionFx->AddAnimation( pEffectAniKey[1], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_middle_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pRevolutionFx->AddAnimation( pEffectAniKey[2], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_end_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
else
|
|
{
|
|
SetEnd( true );
|
|
}
|
|
}
|
|
|
|
bool SGameCreatureEVEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
if( IsEnd() ) return true;
|
|
|
|
if( !CheckTarget() )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
|
|
int nStep = GetStep();
|
|
if( nStep == STEP_00 )
|
|
{
|
|
m_vPosition = *m_pTarget->GetPosition();
|
|
m_pRevolutionFx->PlayAnimation( dwTime, pEffectAniKey[0] );
|
|
PlaySoundFx( m_pTarget, m_pMotionSet, 0, &m_vPosition );
|
|
|
|
SetStep( STEP_01 );
|
|
}
|
|
else if( nStep == STEP_01 )
|
|
{
|
|
if( !m_pRevolutionFx->IsPlaying() )
|
|
{
|
|
m_pRevolutionFx->PlayAnimation( dwTime, pEffectAniKey[1], SEQTYPE_LOOP );
|
|
PlaySoundFx( m_pTarget, m_pMotionSet, 1, &m_vPosition );
|
|
|
|
m_dwOldTime = dwTime;
|
|
SetStep( STEP_02 );
|
|
}
|
|
}
|
|
else if( nStep == STEP_02 )
|
|
{
|
|
//로딩이 완료됐다면
|
|
if( m_pTarget->IsInit() )
|
|
{
|
|
//연출을 위해 5초정도는 플레이 시켜주자
|
|
if( (dwTime - m_dwOldTime) > 5000 )
|
|
{
|
|
m_pRevolutionFx->PlayAnimation( dwTime, pEffectAniKey[2] );
|
|
PlaySoundFx( m_pTarget, m_pMotionSet, 2, &m_vPosition );
|
|
|
|
SetStep( STEP_03 );
|
|
}
|
|
}
|
|
}
|
|
else if( nStep == STEP_03 )
|
|
{
|
|
if( !m_pRevolutionFx->IsPlaying() )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
}
|
|
|
|
m_pRevolutionFx->SetPosition( m_vPosition.x, m_vPosition.y, m_vPosition.z );
|
|
m_pRevolutionFx->Process( dwTime );
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameCreatureEVEffect::Render( unsigned long uRenderBitVector, class KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
for(int vit = 0; vit < nViewportCount; ++vit)
|
|
{
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_GAME)
|
|
m_pRevolutionFx->Render( ppViewportList[vit] );
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_WATER)
|
|
m_pRevolutionFx->Render( ppViewportList[vit] );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////크리처 캐스팅 소환 이펙트
|
|
///////
|
|
SGameCastingSummonCreatureEffect::SGameCastingSummonCreatureEffect( AR_HANDLE hCaster, AR_HANDLE hTarget, SGameObject * pMsgHandler ) : SGameOtherEffect( hCaster, hTarget, pMsgHandler )
|
|
{
|
|
m_pSummonEffect = NULL;
|
|
m_hCaster = hCaster;
|
|
m_hTarget = hTarget;
|
|
m_dwVisibleTime = 0;
|
|
m_dwCatingTime = 0;
|
|
}
|
|
|
|
SGameCastingSummonCreatureEffect::~SGameCastingSummonCreatureEffect()
|
|
{
|
|
SAFE_DELETE( m_pSummonEffect );
|
|
}
|
|
|
|
void SGameCastingSummonCreatureEffect::SetAnimation()
|
|
{
|
|
if( m_pMotionSet )
|
|
{
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
m_pSummonEffect = new KSeqModel;
|
|
m_pSummonEffect->AddAnimation( pEffectAniKey[0], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_start_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pSummonEffect->AddAnimation( pEffectAniKey[1], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_middle_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pSummonEffect->AddAnimation( pEffectAniKey[2], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_end_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
else
|
|
{
|
|
SetEnd( true );
|
|
}
|
|
}
|
|
|
|
void SGameCastingSummonCreatureEffect::SetCastingTime( DWORD dwCastingTime )
|
|
{
|
|
m_dwCatingTime = dwCastingTime;
|
|
}
|
|
|
|
void SGameCastingSummonCreatureEffect::SetPosition( const K3DVector* vPos )
|
|
{
|
|
m_vPosition = *vPos;
|
|
WORD wTile=0;
|
|
GetHeight( m_vPosition.x, m_vPosition.y, m_vPosition.z, wTile );
|
|
}
|
|
|
|
void SGameCastingSummonCreatureEffect::EndEffect()
|
|
{
|
|
m_bEndEffect = true;
|
|
}
|
|
|
|
bool SGameCastingSummonCreatureEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
if( !CheckCaster() )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
|
|
int nStep = GetStep();
|
|
if( nStep == STEP_00 )
|
|
{
|
|
_CID( GETMESH_ANIINFO );
|
|
KMsgGET_MESHANI_INFO msg;
|
|
msg.strFindName = GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_middle_file_ID );
|
|
|
|
m_pSummonEffect->PlayAnimation( dwTime, pEffectAniKey[1] );
|
|
m_pSummonEffect->Perform( id_GETMESH_ANIINFO, msg );
|
|
|
|
if( msg.nStart != -1 && msg.nEnd != -1 )
|
|
{
|
|
float fPlayRate = (float)((msg.nEnd-msg.nStart) * 4.8f) / (float)((m_dwCatingTime*10)*4.8f);
|
|
m_pSummonEffect->SetTimeRate( fPlayRate );
|
|
}
|
|
else
|
|
SetEnd( true );
|
|
|
|
PlaySoundFx( m_pCaster, m_pMotionSet, 1, &m_vPosition );
|
|
|
|
SetStep( STEP_01 );
|
|
}
|
|
else if( nStep == STEP_01 )
|
|
{
|
|
if( m_bEndEffect )
|
|
{
|
|
m_pSummonEffect->PlayAnimation( dwTime, pEffectAniKey[2] );
|
|
PlaySoundFx( m_pCaster, m_pMotionSet, 2, &m_vPosition );
|
|
|
|
SetStep( STEP_02 );
|
|
}
|
|
}
|
|
else if( nStep == STEP_02 )
|
|
{
|
|
if( !m_pSummonEffect->IsPlaying() )
|
|
{
|
|
SetEnd( true );
|
|
}
|
|
}
|
|
|
|
m_pSummonEffect->SetPosition( m_vPosition.x, m_vPosition.y, m_vPosition.z );
|
|
m_pSummonEffect->Process( dwTime );
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameCastingSummonCreatureEffect::Render( unsigned long uRenderBitVector, class KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
for(int vit = 0; vit < nViewportCount; ++vit)
|
|
{
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_GAME)
|
|
m_pSummonEffect->Render( ppViewportList[vit] );
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_WATER)
|
|
m_pSummonEffect->Render( ppViewportList[vit] );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////크리처 소환 이펙트
|
|
///////
|
|
SGameSummonCreatureEffect::SGameSummonCreatureEffect( AR_HANDLE hCaster, AR_HANDLE hTarget, SGameObject * pMsgHandler ) : SGameOtherEffect( hCaster, hTarget, pMsgHandler )
|
|
{
|
|
m_hCaster = hCaster;
|
|
m_hTarget = hTarget;
|
|
m_dwVisibleTime = 1500;
|
|
m_dwOldTime = 0;
|
|
m_dwLeftTime = 0;
|
|
}
|
|
|
|
SGameSummonCreatureEffect::~SGameSummonCreatureEffect()
|
|
{
|
|
if( CheckTarget() )
|
|
{
|
|
m_pTarget->SetIng( false );
|
|
m_pTarget->SetVisibility( 1.f );
|
|
}
|
|
}
|
|
|
|
bool SGameSummonCreatureEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
if( !CheckTarget() )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
|
|
int nStep = GetStep();
|
|
if( nStep == STEP_00 )
|
|
{
|
|
m_pTarget->SetIng( true );
|
|
m_pTarget->SetVisibility( 0.f );
|
|
m_dwLeftTime = dwTime;
|
|
|
|
SetStep( STEP_01 );
|
|
}
|
|
else if( nStep == STEP_01 )
|
|
{
|
|
if( m_pTarget->IsInit() && m_pTarget->Activate() )
|
|
{
|
|
m_dwOldTime = dwTime;
|
|
SetStep( STEP_02 );
|
|
}
|
|
}
|
|
else if( nStep == STEP_02 )
|
|
{
|
|
if( (dwTime - m_dwOldTime) > m_dwVisibleTime )
|
|
{
|
|
m_pTarget->SetIng( false );
|
|
m_pTarget->SetVisibility( 1.f );
|
|
SetEnd( true );
|
|
}
|
|
else
|
|
{
|
|
m_pTarget->SetVisibility( (float)(dwTime-m_dwOldTime) / m_dwVisibleTime );
|
|
}
|
|
}
|
|
|
|
if( ( dwTime - m_dwLeftTime) > 20000 )
|
|
{
|
|
SetEnd( true );
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameSummonCreatureEffect::Render( unsigned long uRenderBitVector, class KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////크리처 역소환 이펙트
|
|
///////
|
|
SGameUnSummonCreatureEffect::SGameUnSummonCreatureEffect( AR_HANDLE hCaster, AR_HANDLE hTarget, SGameObject * pMsgHandler ) : SGameOtherEffect( hCaster, hTarget, pMsgHandler )
|
|
{
|
|
m_pUnSummonEffect = NULL;
|
|
m_hCaster = hCaster;
|
|
m_hTarget = hTarget;
|
|
m_dwVisibleTime = 1500;
|
|
m_dwOldTime = 0;
|
|
m_dwLeftTime = 0;
|
|
}
|
|
|
|
SGameUnSummonCreatureEffect::~SGameUnSummonCreatureEffect()
|
|
{
|
|
if( CheckTarget() )
|
|
{
|
|
m_pTarget->Deactivate();
|
|
m_pTarget->SetReservation( false );
|
|
}
|
|
|
|
SAFE_DELETE( m_pUnSummonEffect );
|
|
}
|
|
|
|
void SGameUnSummonCreatureEffect::SetAnimation()
|
|
{
|
|
// TODO : 디비에 추가되면 수정하자
|
|
if( m_pMotionSet )
|
|
{
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
m_pUnSummonEffect = new KSeqModel;
|
|
m_pUnSummonEffect->AddAnimation( pEffectAniKey[0], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_start_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pUnSummonEffect->AddAnimation( pEffectAniKey[1], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_middle_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pUnSummonEffect->AddAnimation( pEffectAniKey[2], GetResourceDB().GetEffectResourceName( m_pMotionSet->graphic_effect_end_file_ID ), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
else
|
|
{
|
|
SetEnd( true );
|
|
}
|
|
}
|
|
|
|
bool SGameUnSummonCreatureEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
if( !CheckTarget() )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
|
|
int nStep = GetStep();
|
|
if( nStep == STEP_00 )
|
|
{
|
|
m_pTarget->Activate();
|
|
m_dwLeftTime = dwTime;
|
|
m_dwOldTime = dwTime;
|
|
SetStep( STEP_02 );
|
|
|
|
//이펙트 출력은 잠시 보류
|
|
/* m_pTarget->Activate();
|
|
|
|
m_vPosition = *m_pTarget->GetPosition();
|
|
|
|
m_pUnSummonEffect->PlayAnimation( dwTime, pEffectAniKey[0] );
|
|
PlaySoundFx( m_pMotionSet, 0, &m_vPosition );
|
|
|
|
m_dwLeftTime = dwTime;
|
|
|
|
SetStep( STEP_01 );*/
|
|
}
|
|
else if( nStep == STEP_01 )
|
|
{
|
|
//이펙트 출력은 잠시 보류
|
|
/* if( !m_pUnSummonEffect->IsPlaying() )
|
|
{
|
|
m_pUnSummonEffect->PlayAnimation( dwTime, pEffectAniKey[1], SEQTYPE_LOOP );
|
|
PlaySoundFx( m_pMotionSet, 1, &m_vPosition );
|
|
|
|
m_dwOldTime = dwTime;
|
|
|
|
SetStep( STEP_02 );
|
|
}*/
|
|
}
|
|
else if( nStep == STEP_02 )
|
|
{
|
|
if( (dwTime - m_dwOldTime) > m_dwVisibleTime )
|
|
{
|
|
//이펙트 출력은 잠시 보류
|
|
/* m_pUnSummonEffect->PlayAnimation( dwTime, pEffectAniKey[2] );
|
|
PlaySoundFx( m_pMotionSet, 2, &m_vPosition );*/
|
|
|
|
m_pTarget->Deactivate();
|
|
m_pTarget->SetReservation( false );
|
|
m_pTarget->SetVisibility( 0.f );
|
|
|
|
SetEnd( true );
|
|
return true;
|
|
|
|
//이펙트 출력은 잠시 보류
|
|
// SetStep( STEP_03 );
|
|
}
|
|
else
|
|
{
|
|
m_pTarget->SetVisibility( 1.f - ((float)(dwTime-m_dwOldTime)/m_dwVisibleTime) );
|
|
}
|
|
|
|
}
|
|
//이펙트 출력은 잠시 보류
|
|
/* else if( nStep == STEP_03 )
|
|
{
|
|
if( !m_pUnSummonEffect->IsPlaying() )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
}*/
|
|
|
|
//이펙트 출력은 잠시 보류
|
|
/* m_pUnSummonEffect->SetPosition( m_vPosition.x, m_vPosition.y, m_vPosition.z );
|
|
m_pUnSummonEffect->Process( dwTime );*/
|
|
|
|
if( ( dwTime - m_dwLeftTime) > 20000 )
|
|
{
|
|
SetEnd( true );
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameUnSummonCreatureEffect::Render( unsigned long uRenderBitVector, class KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
//이펙트 출력은 잠시 보류
|
|
/* for(int vit = 0; vit < nViewportCount; ++vit)
|
|
{
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_GAME)
|
|
m_pUnSummonEffect->Render( ppViewportList[vit] );
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_WATER)
|
|
m_pUnSummonEffect->Render( ppViewportList[vit] );
|
|
}*/
|
|
return true;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////크리처 테이밍 이펙트
|
|
///////
|
|
SGameTamingEffect::SGameTamingEffect( AR_HANDLE hCaster, AR_HANDLE hTarget, SGameObject * pMsgHandler ) : SGameOtherEffect( hCaster, hTarget, pMsgHandler )
|
|
{
|
|
m_pTamingEffect = NULL;
|
|
|
|
m_hCaster = hCaster;
|
|
m_hTarget = hTarget;
|
|
|
|
SetAnimation();
|
|
}
|
|
|
|
SGameTamingEffect::~SGameTamingEffect()
|
|
{
|
|
SAFE_DELETE( m_pTamingEffect );
|
|
}
|
|
|
|
void SGameTamingEffect::SetAnimation()
|
|
{
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
m_pTamingEffect = new KSeqModel;
|
|
m_pTamingEffect->AddAnimation( pEffectAniKey[0], "rcfx_ch_skill_darkbuffer_lv01.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pTamingEffect->AddAnimation( pEffectAniKey[1], "rcfx_ch_skill_darkbuffer_loop_lv01.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
m_pTamingEffect->AddAnimation( pEffectAniKey[2], "rcfx_taming_intangible_lv01.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
|
|
void SGameTamingEffect::EndEffect()
|
|
{
|
|
SetEnd( true );
|
|
}
|
|
|
|
void SGameTamingEffect::SetNextStepEffect()
|
|
{
|
|
SetStep( STEP_02 );
|
|
m_bEndEffect = true;
|
|
}
|
|
|
|
bool SGameTamingEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
int nStep = GetStep();
|
|
|
|
if( !CheckTarget() )
|
|
{
|
|
if( nStep == STEP_00 )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
else if( nStep == STEP_01 )
|
|
{
|
|
SetStep( STEP_02 );
|
|
m_bEndEffect = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_vPosition = *m_pTarget->GetPosition();
|
|
}
|
|
|
|
m_pCaster = (SGameAvatarEx *)GetGameObject( m_hCaster );
|
|
|
|
if( nStep == STEP_00 )
|
|
{
|
|
m_pTamingEffect->PlayAnimation( dwTime, pEffectAniKey[0] );
|
|
PlaySoundFx( m_pCaster, m_pMotionSet, 0, &m_vPosition );
|
|
|
|
SetStep( STEP_01 );
|
|
}
|
|
else if( nStep == STEP_01 )
|
|
{
|
|
if( !m_pTamingEffect->IsPlaying() )
|
|
{
|
|
m_pTamingEffect->PlayAnimation( dwTime, pEffectAniKey[1], SEQTYPE_LOOP );
|
|
PlaySoundFx( m_pCaster, m_pMotionSet, 1, &m_vPosition );
|
|
|
|
SetStep( STEP_02 );
|
|
}
|
|
}
|
|
else if( nStep == STEP_02 )
|
|
{
|
|
if( m_bEndEffect )
|
|
{
|
|
m_pTamingEffect->PlayAnimation( dwTime, pEffectAniKey[2] );
|
|
PlaySoundFx( m_pCaster, m_pMotionSet, 2, &m_vPosition );
|
|
|
|
SetStep( STEP_03 );
|
|
}
|
|
}
|
|
else if( nStep == STEP_03 )
|
|
{
|
|
if( !m_pTamingEffect->IsPlaying() )
|
|
{
|
|
SetEnd( true );
|
|
return true;
|
|
}
|
|
}
|
|
|
|
m_pTamingEffect->SetPosition( m_vPosition.x, m_vPosition.y, m_vPosition.z );
|
|
m_pTamingEffect->Process( dwTime );
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameTamingEffect::Render( unsigned long uRenderBitVector, class KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
for(int vit = 0; vit < nViewportCount; ++vit)
|
|
{
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_GAME)
|
|
m_pTamingEffect->Render( ppViewportList[vit] );
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_WATER)
|
|
m_pTamingEffect->Render( ppViewportList[vit] );
|
|
}
|
|
|
|
return true;
|
|
}
|