1137 lines
31 KiB
C++
1137 lines
31 KiB
C++
#include "stdafx.h"
|
|
#include ".\sgameeffect.h"
|
|
|
|
#include "KViewport.h"
|
|
#include "KSeqModel.h"
|
|
#include "KResourceManager.h"
|
|
#include "KRenderObjectEtc.h"
|
|
#include "SkillBaseFile.h"
|
|
#include "SGame.h"
|
|
#include "SSkillStageType.h"
|
|
#include "SMotionDB.h"
|
|
#include "SSoundResourceDB.h"
|
|
|
|
#include "SDebug_Util.h"
|
|
|
|
extern const char * pEffectAniKey[];
|
|
|
|
SGamePreLoad::SGamePreLoad()
|
|
{
|
|
}
|
|
|
|
SGamePreLoad::~SGamePreLoad()
|
|
{
|
|
}
|
|
|
|
void SGamePreLoad::RequestThreadLoading( int nFXSet_ID, bool bNotCacheDelete/* = false*/ )
|
|
{
|
|
_loadFX( nFXSet_ID, bNotCacheDelete );
|
|
}
|
|
|
|
void SGamePreLoad::_loadFX( int nFXSet_ID, bool bNotCacheDelete )
|
|
{
|
|
_MOTION_FX_SET* pFX_SET = GetMotionFxSetDB().GetFXSet( nFXSet_ID );
|
|
|
|
//TODO : 외부에서 받거나, 옵션에서 얻어 올 수 있게 바꿔야 한다.
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
if( pFX_SET )
|
|
{
|
|
std::string strFileName;
|
|
if( pFX_SET->IsEffect[0] && pFX_SET->graphic_effect_start_file_ID > 0 )
|
|
{
|
|
strFileName = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_start_file_ID );
|
|
KNX3Manager::GetManager()->RequestThreadLoading( strFileName.c_str(), &loadpack );
|
|
if( bNotCacheDelete ) KNX3Manager::GetManager()->AddToExceptList( strFileName.c_str() );
|
|
}
|
|
if( pFX_SET->IsEffect[1] && pFX_SET->graphic_effect_middle_file_ID > 0 )
|
|
{
|
|
strFileName = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_middle_file_ID );
|
|
KNX3Manager::GetManager()->RequestThreadLoading( strFileName.c_str(), &loadpack );
|
|
if( bNotCacheDelete ) KNX3Manager::GetManager()->AddToExceptList( strFileName.c_str() );
|
|
}
|
|
if( pFX_SET->IsEffect[2] && pFX_SET->graphic_effect_end_file_ID > 0 )
|
|
{
|
|
strFileName = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_end_file_ID );
|
|
KNX3Manager::GetManager()->RequestThreadLoading( strFileName.c_str(), &loadpack );
|
|
if( bNotCacheDelete ) KNX3Manager::GetManager()->AddToExceptList( strFileName.c_str() );
|
|
}
|
|
}
|
|
}
|
|
|
|
void SGamePreLoad::_unloadFX( int nFXSet_ID )
|
|
{
|
|
_MOTION_FX_SET* pFX_SET = GetMotionFxSetDB().GetFXSet( nFXSet_ID );
|
|
|
|
if( pFX_SET )
|
|
{
|
|
std::string strFileName;
|
|
if( pFX_SET->IsEffect[0] && pFX_SET->graphic_effect_start_file_ID > 0 )
|
|
{
|
|
strFileName = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_start_file_ID );
|
|
KNX3Manager::GetManager()->RemoveFromExceptList( strFileName.c_str() );
|
|
}
|
|
if( pFX_SET->IsEffect[1] && pFX_SET->graphic_effect_middle_file_ID > 0 )
|
|
{
|
|
strFileName = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_middle_file_ID );
|
|
KNX3Manager::GetManager()->RemoveFromExceptList( strFileName.c_str() );
|
|
}
|
|
if( pFX_SET->IsEffect[2] && pFX_SET->graphic_effect_end_file_ID > 0 )
|
|
{
|
|
strFileName = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_end_file_ID );
|
|
KNX3Manager::GetManager()->RemoveFromExceptList( strFileName.c_str() );
|
|
}
|
|
}
|
|
}
|
|
|
|
void SGamePreLoad::Unload( struct _SKILL_FX* pSkill_fx )
|
|
{
|
|
if( pSkill_fx )
|
|
{
|
|
if( pSkill_fx->nStage_Type_Id == SS_TYPE_101 )
|
|
{
|
|
_unloadFX( pSkill_fx->nCasting_Fx_Set_Id );
|
|
_unloadFX( pSkill_fx->nFire_Fx_Set_Id );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_111 )
|
|
{
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_121 )
|
|
{
|
|
_unloadFX( pSkill_fx->nCasting_Fx_Set_Id );
|
|
_unloadFX( pSkill_fx->fStage_Data[5] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_122 )
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[2] );
|
|
_unloadFX( pSkill_fx->fStage_Data[4] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_151)
|
|
{
|
|
_unloadFX( pSkill_fx->nCasting_Fx_Set_Id );
|
|
_unloadFX( pSkill_fx->fStage_Data[1] );
|
|
_unloadFX( pSkill_fx->fStage_Data[3] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_171)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[2] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_201)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[2] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_212)
|
|
{
|
|
_unloadFX( pSkill_fx->nCasting_Fx_Set_Id );
|
|
_unloadFX( pSkill_fx->fStage_Data[2] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_251)
|
|
{
|
|
_unloadFX( pSkill_fx->nCasting_Fx_Set_Id );
|
|
_unloadFX( pSkill_fx->fStage_Data[2] );
|
|
_unloadFX( pSkill_fx->fStage_Data[6] );
|
|
_unloadFX( pSkill_fx->fStage_Data[8] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_401)
|
|
{
|
|
_unloadFX( pSkill_fx->nSub_Fire_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_402)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[1] );
|
|
_unloadFX( pSkill_fx->fStage_Data[3] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_403)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[1] );
|
|
_unloadFX( pSkill_fx->fStage_Data[3] );
|
|
_unloadFX( pSkill_fx->nSub_Fire_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_404)
|
|
{
|
|
_unloadFX( pSkill_fx->nSub_Fire_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_411)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[0] );
|
|
_unloadFX( pSkill_fx->nSub_Fire_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_501)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[0] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_502)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[0] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_503)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[0] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
/// 2011.03.23 - prodongi
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_504)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[0] );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_601)
|
|
{
|
|
_unloadFX( pSkill_fx->fStage_Data[0] );
|
|
_unloadFX( pSkill_fx->nSub_Fire_Fx_Set_Id );
|
|
_unloadFX( pSkill_fx->nHit_Fx_Set_Id );
|
|
}
|
|
}
|
|
}
|
|
|
|
void SGamePreLoad::RequestThreadLoading( struct _SKILL_FX* pSkill_fx, bool bNotCacheDelete/* = false*/ )
|
|
{
|
|
//TODO : 쓰레드 로딩으로 빼 놓긴 하였는데,
|
|
//문제는 기획팀에서 데이타를 바꿔 버리면, 이것도 다 고쳐야 한다. 좋지 않다.
|
|
//스킬_연출 DB가 바뀌었는지 체크 해야 한다.
|
|
if( pSkill_fx )
|
|
{
|
|
if( pSkill_fx->nStage_Type_Id == SS_TYPE_101 )
|
|
{
|
|
_loadFX( pSkill_fx->nCasting_Fx_Set_Id, bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nFire_Fx_Set_Id, bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_111 )
|
|
{
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_121 )
|
|
{
|
|
_loadFX( pSkill_fx->nCasting_Fx_Set_Id, bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[5], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_122 )
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[2], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[4], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_151)
|
|
{
|
|
_loadFX( pSkill_fx->nCasting_Fx_Set_Id, bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[1], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[3], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_171)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[2], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_201)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[2], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_212)
|
|
{
|
|
_loadFX( pSkill_fx->nCasting_Fx_Set_Id, bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[2], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_251)
|
|
{
|
|
_loadFX( pSkill_fx->nCasting_Fx_Set_Id, bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[2], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[6], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[8], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_401)
|
|
{
|
|
_loadFX( pSkill_fx->nSub_Fire_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_402)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[1], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[3], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_403)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[1], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->fStage_Data[3], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nSub_Fire_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_404)
|
|
{
|
|
_loadFX( pSkill_fx->nSub_Fire_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_411)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[0], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nSub_Fire_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_501)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[0], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_502)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[0], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_503)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[0], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
/// 2011.03.23 - prodongi
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_504)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[0], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
else if( pSkill_fx->nStage_Type_Id == SS_TYPE_601)
|
|
{
|
|
_loadFX( pSkill_fx->fStage_Data[0], bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nSub_Fire_Fx_Set_Id, bNotCacheDelete );
|
|
_loadFX( pSkill_fx->nHit_Fx_Set_Id, bNotCacheDelete );
|
|
}
|
|
}
|
|
}
|
|
|
|
//===============================================================================================================================================================
|
|
//===============================================================================================================================================================
|
|
//New============================================================================================================================================================
|
|
SGameEffectEx::SGameEffectEx( struct FX_DATA * pFX_data, struct _MOTION_FX_SET* pFX_SET )
|
|
{
|
|
// _oprint( "SGameEffectEx::SGameEffectEx\n" );
|
|
|
|
m_nMode = NORMAL_MODE;
|
|
m_arEndTime = 0;
|
|
m_fScaleAdjust = 1.0f;
|
|
|
|
m_bIsDir = false;
|
|
|
|
m_pParentMat = NULL;
|
|
m_pAttachMat = NULL;
|
|
m_pEvPointMatrix = NULL;
|
|
|
|
m_pSeq = new KSeqModel;
|
|
|
|
for( int i(0); EFFECT_FILE_MAX>i; i++ )
|
|
{
|
|
m_bIsEffect[i] = false;
|
|
m_bIsSound[i] = false;
|
|
}
|
|
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
|
|
//Effect
|
|
if( pFX_SET->IsEffect[EFFECT_START_FILE] )
|
|
{
|
|
m_bIsEffect[EFFECT_START_FILE] = true;
|
|
m_strEffectFileName[EFFECT_START_FILE] = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_start_file_ID );
|
|
m_pSeq->AddAnimation( pEffectAniKey[EFFECT_START_FILE], m_strEffectFileName[EFFECT_START_FILE].c_str(), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
if( pFX_SET->IsEffect[EFFECT_MIDDLE_FILE] )
|
|
{
|
|
m_bIsEffect[EFFECT_MIDDLE_FILE] = true;
|
|
m_strEffectFileName[EFFECT_MIDDLE_FILE] = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_middle_file_ID );
|
|
m_pSeq->AddAnimation( pEffectAniKey[EFFECT_MIDDLE_FILE], m_strEffectFileName[EFFECT_MIDDLE_FILE].c_str(), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
if( pFX_SET->IsEffect[EFFECT_END_FILE] )
|
|
{
|
|
m_bIsEffect[EFFECT_END_FILE] = true;
|
|
m_strEffectFileName[EFFECT_END_FILE] = GetResourceDB().GetEffectResourceName( pFX_SET->graphic_effect_end_file_ID );
|
|
m_pSeq->AddAnimation( pEffectAniKey[EFFECT_END_FILE], m_strEffectFileName[EFFECT_END_FILE].c_str(), KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
|
|
//Sound
|
|
if( pFX_SET->IsSound[EFFECT_START_FILE] )
|
|
{
|
|
m_bIsSound[EFFECT_START_FILE] = true;
|
|
m_strSoundFileName[EFFECT_START_FILE] = GetResourceDB().GetSoundResourceName( pFX_SET->sound_start_file_ID );
|
|
}
|
|
if( pFX_SET->IsSound[EFFECT_MIDDLE_FILE] )
|
|
{
|
|
m_bIsSound[EFFECT_MIDDLE_FILE] = true;
|
|
m_strSoundFileName[EFFECT_MIDDLE_FILE] = GetResourceDB().GetSoundResourceName( pFX_SET->sound_middle_file_ID );
|
|
}
|
|
if( pFX_SET->IsSound[EFFECT_END_FILE] )
|
|
{
|
|
m_bIsSound[EFFECT_END_FILE] = true;
|
|
m_strSoundFileName[EFFECT_END_FILE] = GetResourceDB().GetSoundResourceName( pFX_SET->sound_end_file_ID );
|
|
}
|
|
|
|
m_dwPlayTime = 0;
|
|
|
|
m_pFX_SET = pFX_SET;
|
|
|
|
m_pFX_DATA = new FX_DATA;
|
|
m_pFX_DATA->nFX_ID = pFX_data->nFX_ID;
|
|
m_pFX_DATA->owner = pFX_data->owner;
|
|
m_pFX_DATA->attack = pFX_data->attack;
|
|
m_pFX_DATA->target = pFX_data->target;
|
|
m_pFX_DATA->nEffPos = pFX_data->nEffPos;
|
|
m_pFX_DATA->nPlayID = pFX_data->nPlayID;
|
|
|
|
m_bEnd = false;
|
|
K3DMatrixIdentity( m_LocalMat );
|
|
K3DMatrixIdentity( m_ResultMat );
|
|
|
|
K3DMatrixIdentity( m_DirectionMat );
|
|
|
|
m_dwTime = 0;
|
|
|
|
// m_pEvPointSeq = NULL;
|
|
|
|
m_hOwner = 0;
|
|
|
|
m_nFxPlayState = PLAY_NORAML;
|
|
|
|
m_nSoundID = -1;
|
|
|
|
m_bIsWeaponEffectPos = false;
|
|
|
|
m_StateHandle = 0;
|
|
|
|
m_bIsSoundLoop = false;
|
|
|
|
m_bTargetSize = false;
|
|
|
|
K3DMatrixIdentity(m_matTransform);
|
|
|
|
m_target = 0; /// 2011.04.04
|
|
|
|
setStep( STEP00 );
|
|
}
|
|
|
|
SGameEffectEx::~SGameEffectEx()
|
|
{
|
|
SGameObject * pOwner = GetGameObject( m_hOwner );
|
|
if( pOwner )
|
|
pOwner->EffectDelRef();
|
|
|
|
/* by Testors
|
|
if( m_nSoundID != -1 )
|
|
StopSound( .c_str(), m_nSoundID );
|
|
*/
|
|
|
|
if( m_bIsSoundLoop && m_nSoundID != -1 )
|
|
StopSound( m_SoundName.c_str(), m_nSoundID );
|
|
|
|
SAFE_DELETE( m_pFX_DATA );
|
|
SAFE_DELETE( m_pSeq );
|
|
}
|
|
|
|
void SGameEffectEx::SetMode( int nMode )
|
|
{
|
|
m_nMode = nMode;
|
|
}
|
|
|
|
void SGameEffectEx::setSound( int nPlayRatio, const char *pSoundName, int nVol, bool bLoop, bool bSoundOption[SOUND_OP_MAX] )
|
|
{
|
|
// _oprint( "FX_Sound : %s\n", pSoundName );
|
|
|
|
//사운드가 루프가 돼있을지 모르니 멈춰둔다
|
|
if( m_nSoundID != -1 )
|
|
{
|
|
StopSound( m_SoundName.c_str(), m_nSoundID );
|
|
m_bIsSoundLoop = false;
|
|
}
|
|
|
|
if( nVol == 0 || nPlayRatio == 0 )
|
|
{
|
|
_oprint( "FX_Sound 이상하게 Play - Ratio:[%d], Volume:[%d], %s\n", nPlayRatio, nVol , pSoundName );
|
|
}
|
|
|
|
if( !m_pSeq ) return ;
|
|
|
|
SGameAvatarEx * pOwner = (SGameAvatarEx*)GetGameObject( m_pFX_DATA->owner );
|
|
SGameAvatarEx * pCaster = (SGameAvatarEx*)GetGameObject( m_pFX_DATA->attack );
|
|
|
|
if( pCaster )
|
|
{
|
|
if( pCaster->IsLocalPlayer() || pCaster->IsLocalCreature() )
|
|
pOwner = pCaster;
|
|
}
|
|
|
|
if( nPlayRatio != 100 )
|
|
{
|
|
int nRation = rand()%100;
|
|
if( nRation < nPlayRatio )
|
|
{
|
|
m_nSoundID = StartSound( pOwner, pSoundName, m_mTransform.GetPosVector(), true, nVol, bLoop, bSoundOption );
|
|
m_SoundName = pSoundName;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_nSoundID = StartSound( pOwner, pSoundName, m_mTransform.GetPosVector(), true, nVol, bLoop, bSoundOption );
|
|
m_SoundName = pSoundName;
|
|
}
|
|
|
|
m_bIsSoundLoop = bLoop;
|
|
}
|
|
|
|
void SGameEffectEx::PlayAnimation( DWORD time, int nAniType, float fPlayRate )
|
|
{
|
|
m_dwPlayTime = time;
|
|
m_nCurAniType = nAniType;
|
|
m_fCurPlayRate = fPlayRate;
|
|
|
|
if( m_bIsEffect[EFFECT_START_FILE] )
|
|
{
|
|
m_pSeq->PlayAnimation( time, pEffectAniKey[EFFECT_START_FILE], nAniType, fPlayRate );
|
|
}
|
|
|
|
if( m_bIsSound[EFFECT_START_FILE] )
|
|
{
|
|
setSound( m_pFX_SET->nSound_play_probability, m_strSoundFileName[EFFECT_START_FILE].c_str() , m_pFX_SET->nSound_volumn, false, m_pFX_SET->sound_option );
|
|
}
|
|
}
|
|
|
|
void SGameEffectEx::_processPlayAni( bool bIsEffect , int nIndex, int nNextIndex, int nNextStep, int nPlayAniType )
|
|
{
|
|
if( bIsEffect )
|
|
{
|
|
if( ( !m_pSeq->IsPlaying() && _stricmp( m_pSeq->GetCurrentAnimationName(), pEffectAniKey[nIndex] ) == 0 ) || m_nFxPlayState == PLAY_END )
|
|
{
|
|
if( m_bIsEffect[nNextIndex] )
|
|
{
|
|
if( nNextIndex == STEP01 && m_nFxPlayState == PLAY_LOOP ) //중간 단계고 반복되는 Fx라면
|
|
{
|
|
if(m_pSeq) m_pSeq->PlayAnimation( m_dwTime, pEffectAniKey[nNextIndex], SEQTYPE_LOOP, m_fCurPlayRate );
|
|
}
|
|
else
|
|
if(m_pSeq) m_pSeq->PlayAnimation( m_dwTime, pEffectAniKey[nNextIndex], nPlayAniType, m_fCurPlayRate );
|
|
}
|
|
|
|
if( nNextIndex == 0 )
|
|
{
|
|
if( m_bIsSound[nNextIndex] ) setSound( m_pFX_SET->nSound_play_probability, m_strSoundFileName[EFFECT_START_FILE].c_str() , m_pFX_SET->nSound_volumn, false, m_pFX_SET->sound_option );
|
|
}
|
|
else if( nNextIndex == 1 )
|
|
{
|
|
if( m_bIsSound[nNextIndex] ) setSound( m_pFX_SET->nSound_play_probability, m_strSoundFileName[EFFECT_MIDDLE_FILE].c_str(), m_pFX_SET->nSound_volumn, ( m_nFxPlayState == PLAY_LOOP ), m_pFX_SET->sound_option );
|
|
}
|
|
else if( nNextIndex == 2 )
|
|
{
|
|
if( m_bIsSound[nNextIndex] ) setSound( m_pFX_SET->nSound_play_probability, m_strSoundFileName[EFFECT_END_FILE].c_str(), m_pFX_SET->nSound_volumn, false, m_pFX_SET->sound_option );
|
|
}
|
|
|
|
setStep( nNextStep );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if( m_bIsEffect[nNextIndex] )
|
|
{
|
|
if( nNextIndex == STEP01 && m_nFxPlayState == PLAY_LOOP ) //중간 단계고 반복되는 Fx라면
|
|
{
|
|
if(m_pSeq) m_pSeq->PlayAnimation( m_dwTime, pEffectAniKey[nNextIndex], SEQTYPE_LOOP, m_fCurPlayRate );
|
|
}
|
|
else
|
|
if(m_pSeq) m_pSeq->PlayAnimation( m_dwTime, pEffectAniKey[nNextIndex], nPlayAniType, m_fCurPlayRate );
|
|
|
|
//if(m_pSeq) m_pSeq->PlayAnimation( m_dwTime, pEffectAniKey[nNextIndex], nPlayAniType, m_fCurPlayRate );
|
|
}
|
|
|
|
if( nNextIndex == 0 )
|
|
{
|
|
if( m_bIsSound[nNextIndex] ) setSound( m_pFX_SET->nSound_play_probability, m_strSoundFileName[EFFECT_START_FILE].c_str(), m_pFX_SET->nSound_volumn, false, m_pFX_SET->sound_option );
|
|
}
|
|
else if( nNextIndex == 1 )
|
|
{
|
|
if( m_bIsSound[nNextIndex] ) setSound( m_pFX_SET->nSound_play_probability, m_strSoundFileName[EFFECT_MIDDLE_FILE].c_str(), m_pFX_SET->nSound_volumn, false, m_pFX_SET->sound_option );
|
|
}
|
|
else if( nNextIndex == 2 )
|
|
{
|
|
if( m_bIsSound[nNextIndex] ) setSound( m_pFX_SET->nSound_play_probability, m_strSoundFileName[EFFECT_END_FILE].c_str(), m_pFX_SET->nSound_volumn, false, m_pFX_SET->sound_option );
|
|
}
|
|
|
|
setStep( nNextStep );
|
|
}
|
|
}
|
|
|
|
bool SGameEffectEx::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
if( IsEnd() ) return true;
|
|
|
|
m_dwTime = dwTime;
|
|
|
|
if( m_nMode == NORMAL_MODE )
|
|
{
|
|
if( getStep() == STEP00 )
|
|
{
|
|
_processPlayAni( m_bIsEffect[0], STEP00, STEP01, STEP01 );
|
|
}
|
|
else if( getStep() == STEP01 )
|
|
{
|
|
_processPlayAni( m_bIsEffect[1], STEP01, STEP02, STEP02 );
|
|
}
|
|
else if( getStep() == STEP02 )
|
|
{
|
|
if( m_bIsEffect[STEP02] )
|
|
{
|
|
if( _stricmp( m_pSeq->GetCurrentAnimationName(), pEffectAniKey[STEP02] ) == 0 && !m_pSeq->IsPlaying() )
|
|
{
|
|
SetEnd();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SetEnd();
|
|
}
|
|
}
|
|
}
|
|
else if( m_nMode == STATE_MODE )
|
|
{
|
|
//TODO : 상태 이상 모드, 시간 체크 해야 하고, 종료 되면, 효과 사라지는 것 자연 스럽게
|
|
if( getStep() == STEP00 )
|
|
{
|
|
_processPlayAni( m_bIsEffect[0], STEP00, STEP01, STEP01, SEQTYPE_LOOP );
|
|
}
|
|
else if( getStep() == STEP01 )
|
|
{
|
|
if( m_arEndTime > 0 )
|
|
{
|
|
if( GetArTime() >= m_arEndTime )
|
|
{
|
|
_processPlayAni( false, STEP01, STEP02, STEP02 );
|
|
}
|
|
}
|
|
}
|
|
else if( getStep() == STEP02 )
|
|
{
|
|
if( m_bIsEffect[STEP02] )
|
|
{
|
|
if( _stricmp( m_pSeq->GetCurrentAnimationName(), pEffectAniKey[STEP02] ) == 0 && !m_pSeq->IsPlaying() )
|
|
{
|
|
SetEnd();
|
|
_oprint( "!!!상태 이상 종료\n" );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SetEnd();
|
|
_oprint( "!!!상태 이상 종료\n" );
|
|
}
|
|
}
|
|
}
|
|
|
|
if( m_pSeq ) m_pSeq->Process( dwTime );
|
|
|
|
if( m_pFX_DATA->owner )
|
|
{
|
|
SGameObject * pOwner = GetGameObject( m_pFX_DATA->owner );
|
|
if( !pOwner )
|
|
{
|
|
SetEnd();
|
|
//따라 감
|
|
m_pParentMat = NULL;
|
|
}
|
|
}
|
|
|
|
procSyncTargetAdjustedScale(); /// 2011.04.04 - prodongi
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameEffectEx::Render( unsigned long uRenderBitVector, KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
if( IsEnd() ) return true;
|
|
|
|
|
|
K3DMatrix smat, tempParent;
|
|
|
|
if (m_pParentMat)
|
|
tempParent = *m_pParentMat;
|
|
else
|
|
K3DMatrixIdentity( tempParent );
|
|
|
|
K3DMatrixIdentity( smat );
|
|
K3DMatrixScaling( smat, m_fScaleAdjust, m_fScaleAdjust, m_fScaleAdjust );
|
|
K3DMatrixMultiply( tempParent, smat, tempParent );
|
|
|
|
|
|
K3DMatrixIdentity( m_ResultMat );
|
|
//계속 쫓아가지 못한다...
|
|
if( m_bIsWeaponEffectPos && m_pEvPointMatrix )
|
|
{
|
|
if( m_nFxPlayState == PLAY_END && getStep() == STEP02 ) return true;
|
|
|
|
if( m_pParentMat && m_pAttachMat )
|
|
{
|
|
K3DMatrixMultiply( m_ResultMat, *m_pAttachMat, tempParent );
|
|
K3DMatrixMultiply( m_ResultMat, *m_pEvPointMatrix, m_ResultMat );
|
|
}
|
|
else if( m_pParentMat )
|
|
{
|
|
//여기로 들어오면 버그네
|
|
K3DMatrixMultiply( m_ResultMat, *m_pEvPointMatrix, tempParent );
|
|
}
|
|
else
|
|
{
|
|
if(m_bTargetSize)
|
|
m_ResultMat = m_matTransform;
|
|
else
|
|
m_ResultMat = m_mTransform;
|
|
}
|
|
}
|
|
else if( m_pEvPointMatrix && m_pParentMat && m_pAttachMat )
|
|
{
|
|
K3DMatrixMultiply( m_ResultMat, *m_pAttachMat, tempParent );
|
|
K3DMatrixMultiply( m_ResultMat, *m_pEvPointMatrix, m_ResultMat );
|
|
}
|
|
else if( m_pEvPointMatrix && m_pParentMat )
|
|
{
|
|
K3DMatrixMultiply( m_ResultMat, *m_pEvPointMatrix, tempParent );
|
|
}
|
|
else if( m_pParentMat )
|
|
{
|
|
K3DMatrixMultiply( m_ResultMat, m_ResultMat, tempParent );
|
|
}
|
|
else
|
|
{
|
|
if(m_bTargetSize)
|
|
m_ResultMat = m_matTransform;
|
|
else
|
|
m_ResultMat = m_mTransform;
|
|
}
|
|
|
|
if( m_bIsDir )
|
|
{
|
|
// K3DMatrixMultiply( m_ResultMat, m_DirectionMat, m_ResultMat );
|
|
//방향이 설정 되어 있으면,
|
|
/* m_DirectionMat._41 = m_ResultMat._41;
|
|
m_DirectionMat._42 = m_ResultMat._42;
|
|
m_DirectionMat._43 = m_ResultMat._43;
|
|
m_ResultMat = m_DirectionMat;*/
|
|
}
|
|
|
|
if( m_pSeq )
|
|
{
|
|
if(m_bTargetSize)
|
|
{
|
|
SetTransform( m_ResultMat );
|
|
m_pSeq->SetTransform( m_mTransform );
|
|
}
|
|
else
|
|
m_pSeq->SetTransform( m_ResultMat );
|
|
|
|
for(int vit = 0; vit < nViewportCount; ++vit) {
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_GAME)
|
|
m_pSeq->Render( ppViewportList[vit] );//, KViewportObject::PTYPE_NOFOG_NOSHADER );
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_WATER)
|
|
m_pSeq->Render( ppViewportList[vit] );//, KViewportObject::PTYPE_NOFOG_NOSHADER );
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameEffectEx::IsPlaying()
|
|
{
|
|
if( m_pSeq )
|
|
{
|
|
return m_pSeq->IsPlaying();
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void SGameEffectEx::SetDirection( K3DVector &pos, K3DVector &target )
|
|
{
|
|
K3DMatrixIdentity( m_DirectionMat );
|
|
|
|
K3DVector xVector, yVector, zVector;
|
|
//높이는 무시 한다.
|
|
yVector = K3DVector(pos.x,pos.y,0.f)-K3DVector(target.x,target.y,0.f);
|
|
|
|
if( yVector.x == 0.000000f )
|
|
{
|
|
yVector.x = 1.0f;
|
|
}
|
|
if( yVector.y == 0.000000f )
|
|
{
|
|
yVector.y = 1.0f;
|
|
}
|
|
|
|
yVector.Normalize();
|
|
zVector = K3DVector( 0, 0, -1 );
|
|
|
|
K3DVectorCross( xVector, zVector, yVector );
|
|
xVector.Normalize();
|
|
K3DVectorCross( zVector, xVector, yVector );
|
|
zVector.Normalize();
|
|
|
|
//Z가 뒤집어 나와서, (-) 하였다. 좌표계 체크를 해야 할듯.
|
|
m_DirectionMat._11 = xVector.x; m_DirectionMat._12 = xVector.y; m_DirectionMat._13 = xVector.z;
|
|
m_DirectionMat._21 = yVector.x; m_DirectionMat._22 = yVector.y; m_DirectionMat._23 = yVector.z;
|
|
m_DirectionMat._31 = zVector.x; m_DirectionMat._32 = zVector.y; m_DirectionMat._33 = zVector.z;
|
|
|
|
m_bIsDir = true;
|
|
}
|
|
|
|
void SGameEffectEx::SetEventPointSequencer( class KEventPointSeq * pEvPointSeq )
|
|
{
|
|
// m_pEvPointSeq = pEvPointSeq;
|
|
}
|
|
|
|
void SGameEffectEx::SetTargetScale(float fSize, K3DMatrix & matTransform)
|
|
{
|
|
m_fScale = fSize;
|
|
m_bTargetSize = true;
|
|
m_matTransform = matTransform;
|
|
}
|
|
|
|
/// 2011.04.04 - prodongi
|
|
void SGameEffectEx::procSyncTargetAdjustedScale()
|
|
{
|
|
if (!m_target)
|
|
return ;
|
|
|
|
SGameAvatarEx* target = dynamic_cast<SGameAvatarEx*>(GetGameObject(m_target));
|
|
if (!target)
|
|
return ;
|
|
|
|
if (fabs(target->GetAdjustedScale() - m_fScaleAdjust) > FLT_EPSILON)
|
|
{
|
|
m_fScaleAdjust = target->GetAdjustedScale();
|
|
}
|
|
}
|
|
|
|
//===============================================================================================================================================================
|
|
//===============================================================================================================================================================
|
|
//Old============================================================================================================================================================
|
|
SGameEffect::SGameEffect(AR_HANDLE owner, AR_HANDLE state_handle, AR_TIME endtime )
|
|
{
|
|
// _oprint( "SGameEffect %d %d %d\n", owner, state_handle, endtime );
|
|
|
|
m_pSeq = new KSeqModel;
|
|
m_hOwner = owner;
|
|
|
|
m_StateHandle = state_handle; //상태 이상 핸들
|
|
m_arEndTime = endtime; //상태 이상 끝나는 시간
|
|
|
|
m_pAttachMat = NULL;
|
|
m_pParentMat = NULL;
|
|
|
|
m_Pos = K3DVector(0,0,0); //위치
|
|
m_Target = K3DVector(0,0,0); //타겟 위치
|
|
|
|
K3DMatrixIdentity( m_LocalMat );
|
|
K3DMatrixIdentity( m_ResultMat );
|
|
|
|
K3DMatrixIdentity( m_DirectionMat );
|
|
|
|
m_bEnd = FALSE;
|
|
m_arEndTime = 0;
|
|
|
|
m_dwTime = 0;
|
|
|
|
m_dwPlayTime = 0;
|
|
|
|
// m_pEvPointSeq = NULL;
|
|
|
|
m_pOwnerDirection = NULL;
|
|
|
|
m_bIsOwnerDir = false;
|
|
|
|
m_pEvPointMatrix = NULL;
|
|
m_pAttachMat = NULL;
|
|
m_pParentMat = NULL;
|
|
|
|
m_bTargetSize = false;
|
|
K3DMatrixIdentity(m_matTransform);
|
|
}
|
|
|
|
SGameEffect::~SGameEffect(void)
|
|
{
|
|
SGameObject * pOwner = GetGameObject( m_hOwner );
|
|
if( pOwner )
|
|
pOwner->EffectDelRef();
|
|
|
|
SAFE_DELETE( m_pSeq );
|
|
m_hOwner = 0;
|
|
}
|
|
|
|
void SGameEffect::SetEventPointSequencer( KEventPointSeq * pEvPointSeq )
|
|
{
|
|
// m_pEvPointSeq = pEvPointSeq;
|
|
}
|
|
|
|
void SGameEffect::SetOwner( AR_HANDLE hOwner )
|
|
{
|
|
m_hOwner = hOwner;
|
|
}
|
|
|
|
void SGameEffect::AddEffect( const char * pName )
|
|
{
|
|
// _oprint( "AddEffect : %s\n", pName );
|
|
#ifndef NDEBUG
|
|
m_strFileName = pName;
|
|
#endif
|
|
|
|
NX3LoadPack loadpack;
|
|
loadpack.Init();
|
|
m_pSeq->AddAnimation( "default", pName, KNX3Manager::SEQTYPE_ALL, &loadpack );
|
|
}
|
|
|
|
void SGameEffect::PlayAnimation( DWORD time, int nAniType, float fPlayRate )
|
|
{
|
|
m_dwPlayTime = time;
|
|
m_nCurAniType = nAniType;
|
|
m_fCurPlayRate = fPlayRate;
|
|
if(m_pSeq) m_pSeq->PlayAnimation( time, "default", m_nCurAniType, m_fCurPlayRate );
|
|
}
|
|
|
|
bool SGameEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
if( IsEnd() ) return true;
|
|
|
|
m_dwTime = dwTime;
|
|
|
|
if( m_dwPlayTime != 0 )
|
|
{
|
|
if(m_pSeq) m_pSeq->PlayAnimation( dwTime, "default", m_nCurAniType, m_fCurPlayRate );
|
|
// _oprint( "SGameEffect::Process-[%d]\n", dwTime-m_dwPlayTime );
|
|
m_dwPlayTime = 0;
|
|
}
|
|
|
|
if( m_pSeq ) m_pSeq->Process( dwTime );
|
|
|
|
if( m_hOwner )
|
|
{
|
|
SGameObject * pOwner = GetGameObject( m_hOwner );
|
|
if( !pOwner )
|
|
{
|
|
m_bEnd = TRUE;
|
|
if( m_nFlag == 1 )
|
|
{ //따라 감
|
|
m_pParentMat = NULL;
|
|
}
|
|
}
|
|
}
|
|
|
|
if( m_arEndTime > 0 )
|
|
{
|
|
if( GetArTime() >= m_arEndTime )
|
|
{
|
|
m_bEnd = TRUE;
|
|
m_pParentMat = NULL;
|
|
m_arEndTime = 0;
|
|
_oprint( "!!!상태 이상 종료\n" );
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameEffect::Render( unsigned long uRenderBitVector, KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
if( IsEnd() ) return true;
|
|
|
|
K3DMatrixIdentity( m_ResultMat );
|
|
if( m_pEvPointMatrix == NULL )
|
|
{
|
|
if( m_pAttachMat && m_pParentMat )
|
|
K3DMatrixMultiply( m_ResultMat, *m_pAttachMat, *m_pParentMat );
|
|
else if( m_pParentMat )
|
|
K3DMatrixMultiply( m_ResultMat, m_ResultMat, *m_pParentMat );
|
|
else
|
|
{
|
|
if(m_bTargetSize)
|
|
m_ResultMat = m_matTransform;
|
|
else
|
|
m_ResultMat = m_mTransform;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if( m_pAttachMat && m_pParentMat )
|
|
{
|
|
K3DMatrixMultiply( m_ResultMat, *m_pAttachMat, *m_pParentMat );
|
|
K3DMatrixMultiply( m_ResultMat, *m_pEvPointMatrix, m_ResultMat );
|
|
}
|
|
else if( m_pParentMat )
|
|
{
|
|
K3DMatrixMultiply( m_ResultMat, *m_pEvPointMatrix, *m_pParentMat );
|
|
}
|
|
else
|
|
{
|
|
if(m_bTargetSize)
|
|
m_ResultMat = m_matTransform;
|
|
else
|
|
m_ResultMat = m_mTransform;
|
|
}
|
|
|
|
}
|
|
|
|
if( m_pSeq )
|
|
{
|
|
if( m_bTargetSize )
|
|
{
|
|
SetTransform( m_ResultMat );
|
|
m_pSeq->SetTransform( m_mTransform );
|
|
}
|
|
else
|
|
m_pSeq->SetTransform( m_ResultMat );
|
|
|
|
for(int vit = 0; vit < nViewportCount; ++vit) {
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_GAME)
|
|
m_pSeq->Render( ppViewportList[vit] );//, KViewportObject::PTYPE_NOFOG_NOSHADER );
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_WATER)
|
|
m_pSeq->Render( ppViewportList[vit] );//, KViewportObject::PTYPE_NOFOG_NOSHADER );
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
void SGameEffect::SetDirection( K3DVector &pos, K3DVector &target )
|
|
{
|
|
K3DMatrixIdentity( m_DirectionMat );
|
|
|
|
K3DVector xVector, yVector, zVector;
|
|
//높이는 무시 한다.
|
|
yVector = K3DVector(pos.x,pos.y,0.f)-K3DVector(target.x,target.y,0.f);
|
|
yVector.Normalize();
|
|
zVector = K3DVector( 0, 0, -1 );
|
|
|
|
K3DVectorCross( xVector, zVector, yVector );
|
|
xVector.Normalize();
|
|
K3DVectorCross( zVector, xVector, yVector );
|
|
zVector.Normalize();
|
|
|
|
//Z가 뒤집어 나와서, (-) 하였다. 좌표계 체크를 해야 할듯.
|
|
m_DirectionMat._11 = xVector.x; m_DirectionMat._12 = xVector.y; m_DirectionMat._13 = xVector.z;
|
|
m_DirectionMat._21 = yVector.x; m_DirectionMat._22 = yVector.y; m_DirectionMat._23 = yVector.z;
|
|
m_DirectionMat._31 = zVector.x; m_DirectionMat._32 = zVector.y; m_DirectionMat._33 = zVector.z;
|
|
}
|
|
void SGameEffect::SetOwnerDirection( K3DMatrix* pParantMatrix, K3DVector* pDirection )
|
|
{
|
|
m_pParentMat = pParantMatrix;
|
|
m_pOwnerDirection = pDirection;
|
|
m_bIsOwnerDir = true;
|
|
}
|
|
|
|
void SGameEffect::SetTargetScale(float fSize, K3DMatrix & matTransform )
|
|
{
|
|
m_fScale = fSize;
|
|
m_bTargetSize = true;
|
|
m_matTransform = matTransform;
|
|
}
|
|
|
|
//void SGameEffect::SetPosition( K3DVector &pos, K3DVector &target, K3DMatrix *Detailmat )
|
|
//{
|
|
// K3DVector Out;
|
|
//
|
|
// m_Pos = pos;
|
|
// m_Target = target;
|
|
//
|
|
// //View Mat를 만들자~
|
|
// K3DVector view = m_Target - m_Pos;
|
|
// K3DVectorNomalize(&Out, &view);
|
|
//
|
|
// K3DMatrix mat;
|
|
// K3DMatrixIdentity(mat);
|
|
//
|
|
// float fLen = Magnitude( Out );
|
|
// if( fLen <= 0 )
|
|
// {
|
|
// //자신 뷰벡터로 설정.
|
|
// K3DVectorNomalize( &Out, &m_Pos );
|
|
// }
|
|
//
|
|
// mat._11 = -Out.y;
|
|
// mat._21 = -Out.x;
|
|
// mat._31 = 0;
|
|
// mat._12 = Out.x;
|
|
// mat._22 = -Out.y;
|
|
// mat._32 = 0;
|
|
// mat._41 = Detailmat->_41;
|
|
// mat._42 = Detailmat->_42;
|
|
// mat._43 = Detailmat->_43;
|
|
//
|
|
// m_ResultMat = mat;
|
|
//}
|
|
|
|
bool SGameEffect::IsPlaying()
|
|
{
|
|
if( m_pSeq )
|
|
{
|
|
bool bIsPlay = m_pSeq->IsPlaying();
|
|
if( bIsPlay == false )
|
|
{
|
|
m_bEnd = TRUE;
|
|
}
|
|
return bIsPlay;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////
|
|
//근접 공격 이펙트 전용
|
|
SGameAttackEffect::SGameAttackEffect()
|
|
{
|
|
m_pSeq = new KSeqModel;
|
|
|
|
K3DMatrixIdentity(m_mTransform);
|
|
K3DMatrixIdentity(m_ResultMat);
|
|
}
|
|
|
|
SGameAttackEffect::~SGameAttackEffect()
|
|
{
|
|
SAFE_DELETE(m_pSeq) ;
|
|
}
|
|
|
|
bool SGameAttackEffect::Process( DWORD dwTime, unsigned long uProcessBitVector )
|
|
{
|
|
if(IsEnd()) return true;
|
|
|
|
if(m_pSeq) m_pSeq->Process(dwTime);
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameAttackEffect::Render( unsigned long uRenderBitVector, KViewportObject** ppViewportList, int nViewportCount )
|
|
{
|
|
if(IsEnd()) return true;
|
|
|
|
if(m_pSeq)
|
|
{
|
|
if(m_bTargetSize)
|
|
{
|
|
SetTransform( m_ResultMat );
|
|
m_pSeq->SetTransform(m_mTransform);
|
|
}
|
|
else
|
|
m_pSeq->SetTransform(m_ResultMat);
|
|
|
|
for(int vit = 0; vit < nViewportCount; ++vit) {
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_GAME)
|
|
m_pSeq->Render( ppViewportList[vit] );//, KViewportObject::PTYPE_NOFOG_NOSHADER );
|
|
if(ppViewportList[vit]->GetAttributes() & KViewportObject::VIEWPORT_WATER)
|
|
m_pSeq->Render( ppViewportList[vit] );//, KViewportObject::PTYPE_NOFOG_NOSHADER );
|
|
}
|
|
}
|
|
|
|
return true;
|
|
} |