2024-12-21 10:04:04 +08:00
# include "StdAfx.h"
# include "DnActor.h"
# include "DnPartialPlayProcessor.h"
# include "DnStateBlow.h"
# if defined( PRE_FIX_71333 )
# include "DnMonsterActor.h"
# endif
# ifdef _DEBUG
# define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
# endif
CDnPartialPlayProcessor : : CDnPartialPlayProcessor ( )
: m_fMoveSpeed ( 0.0f )
, m_iTime ( 0 )
, m_iNowActionState ( 0 )
, m_fStartActionLength ( 0.0f )
, m_fLoopActionLength ( 0.0f )
, m_fElapsedTime ( 0.0f )
, m_fLoopActionElapsedTime ( 0.0f )
, m_bPlayEnd ( false )
# ifdef PRE_FIX_71333
, m_bLoopActionEnd ( false )
# endif // PRE_FIX_71333
# ifdef PRE_FIX_68898
, m_isSkipEndAction ( false )
# endif // PRE_FIX_68898
{
m_iType = PARTIAL_PLAY_ANI ;
m_fTimeLength = 0.0f ;
}
CDnPartialPlayProcessor : : CDnPartialPlayProcessor ( DnActorHandle hActor ,
const char * pStartActionName , const char * pLoopActionName ,
const char * pEndActionName ,
int iTime , float fMoveSpeed ) : IDnSkillProcessor ( hActor ) ,
m_strStartActionName ( pStartActionName ) ,
m_strLoopActionName ( pLoopActionName ) ,
m_strEndActionName ( pEndActionName ) ,
m_iTime ( iTime ) ,
m_fMoveSpeed ( fMoveSpeed ) ,
//m_bStartedLastAction( false ),
m_iNowActionState ( - 1 ) ,
m_fLoopActionLength ( 0.0f ) ,
m_fElapsedTime ( 0.0f ) ,
m_fStartActionLength ( 0.0f ) ,
m_fLoopActionElapsedTime ( 0.0f ) ,
m_bPlayEnd ( false )
# if defined(PRE_FIX_68898)
, m_isSkipEndAction ( false )
# endif // PRE_FIX_68898
# if defined( PRE_FIX_71333 )
, m_bLoopActionEnd ( false )
# endif
{
m_iType = PARTIAL_PLAY_ANI ;
}
CDnPartialPlayProcessor : : ~ CDnPartialPlayProcessor ( void )
{
}
void CDnPartialPlayProcessor : : _UpdatePlayTime ( void )
{
CEtActionBase : : ActionElementStruct * pStartActionInfo = m_hHasActor - > GetElement ( m_strStartActionName . c_str ( ) ) ;
CEtActionBase : : ActionElementStruct * pEndActionInfo = m_hHasActor - > GetElement ( m_strEndActionName . c_str ( ) ) ;
if ( pStartActionInfo & & pEndActionInfo )
{
// StartAction <20> <> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ӿ<EFBFBD> <20> <> <EFBFBD> 缭 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ؾ<EFBFBD> <D8BE> Ѵ <EFBFBD> .
float fFPS = m_hHasActor - > CDnActionBase : : GetFPS ( ) ;
m_fStartActionLength = ( float ) pStartActionInfo - > dwLength / fFPS ;
m_fLoopActionLength = ( float ) m_iTime / 1000.0f ;
m_fTimeLength = m_fStartActionLength + m_fLoopActionLength + ( float ) pEndActionInfo - > dwLength / fFPS ;
}
else
{
// Note <20> ѱ<EFBFBD> : CBT 2<> <32> <EFBFBD> <EFBFBD> pStartActionInfo <20> <> ã<> <C3A3> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> ̽<EFBFBD> <CCBD> <EFBFBD> <20> ־ <20> <EFBFBD> <20> <> Ȳ<EFBFBD> <C8B2> <EFBFBD> <EFBFBD> <20> <> ų<EFBFBD> <C5B3> <20> ƿ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ų<EFBFBD> <C5B2> .
// <20> Ϲ <EFBFBD> <CFB9> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> Ȳ<EFBFBD> <C8B2> <20> ƴϰ<C6B4> ij<> <C4B3> <EFBFBD> Ͱ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> Ǹ<EFBFBD> <20> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> ٲ<EFBFBD> <D9B2> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <EFBFBD> <D7BC> <EFBFBD> <20> <> ã<EFBFBD> <C3A3> <20> Ǵµ<C7B4> ,,
// <20> <> <EFBFBD> <EFBFBD> ij<> <C4B3> <EFBFBD> Ͱ<EFBFBD> <20> <> ų <20> <> <EFBFBD> ٰ<EFBFBD> <20> <> Ŷ<EFBFBD> <C5B6> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> ̹<EFBFBD> <20> <> <EFBFBD> <EFBFBD> ij<> <C4B3> <EFBFBD> <EFBFBD> <20> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> (<28> <> Ȱ<EFBFBD> <C8B0> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> . <20> ƴ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> 2<> <32> <20> <> <EFBFBD> <EFBFBD> <20> Ŀ<EFBFBD> <20> <> ų <20> <> <20> <> Ŷ<EFBFBD> <C5B6> <20> <> <EFBFBD> ų<EFBFBD> .)<29> <> <20> ǰڴ<C7B0> .
m_iNowActionState = END_ACTION ;
m_hHasActor - > ReserveFinishSkill ( m_hHasActor - > GetProcessSkill ( ) ) ;
}
}
void CDnPartialPlayProcessor : : CopyFrom ( IDnSkillProcessor * pProcessor )
{
if ( NULL = = pProcessor )
return ;
if ( GetType ( ) ! = pProcessor - > GetType ( ) )
return ;
CDnPartialPlayProcessor * pSource = static_cast < CDnPartialPlayProcessor * > ( pProcessor ) ;
m_strStartActionName = pSource - > m_strStartActionName ;
m_strLoopActionName = pSource - > m_strLoopActionName ;
m_strEndActionName = pSource - > m_strEndActionName ;
m_fMoveSpeed = pSource - > m_fMoveSpeed ;
m_iTime = pSource - > m_iTime ;
# if defined(PRE_FIX_68898)
m_isSkipEndAction = pSource - > m_isSkipEndAction ;
# endif // PRE_FIX_68898
# if defined(PRE_FIX_71333 )
if ( m_hParentSkill & & ( m_hParentSkill - > GetClassID ( ) = = 33175 | | m_hParentSkill - > GetClassID ( ) = = 33176 ) )
{
g_Log . Log ( LogType : : _PROFESSORK_SKILL , L " [CDnPartialPlayProcessor::CopyFrom -> Skill Probelm] SkillID:%d CurrentAction:%S Source->m_iTiem:%d \r \n " , m_hParentSkill - > GetClassID ( ) , m_hHasActor - > GetCurrentAction ( ) , pSource - > m_iTime ) ;
}
if ( pSource - > m_iTime - m_iTime > 6000 )
{
g_Log . Log ( LogType : : _PROFESSORK_SKILL , L " [CDnPartialPlayProcessor::CopyFrom -> Time Problem] SkillID:%d CurrentAction:%S Source->m_iTiem:%d \r \n " , m_hParentSkill - > GetClassID ( ) , m_hHasActor - > GetCurrentAction ( ) , pSource - > m_iTime ) ;
}
# endif
}
void CDnPartialPlayProcessor : : OnBegin ( LOCAL_TIME LocalTime , float fDelta , DnSkillHandle hParentSkill )
{
if ( m_hHasActor )
{
m_iNowActionState = START_ACTION ;
m_fElapsedTime = 0.0f ;
m_fStartActionLength = 0.0f ;
m_fLoopActionLength = 0.0f ;
m_fLoopActionElapsedTime = 0.0f ;
m_bPlayEnd = false ;
m_hHasActor - > SetMovable ( false ) ;
m_hHasActor - > SetActionQueue ( m_strStartActionName . c_str ( ) ) ;
_UpdatePlayTime ( ) ;
# if defined(PRE_FIX_68898)
m_isSkipEndAction = false ;
# endif // PRE_FIX_68898
# if defined( PRE_FIX_71333 )
m_bLoopActionEnd = false ;
# endif
}
}
void CDnPartialPlayProcessor : : Process ( LOCAL_TIME LocalTime , float fDelta )
{
if ( ! m_hHasActor )
return ;
if ( m_bPlayEnd )
return ;
// <20> <> <EFBFBD> ۰ <EFBFBD> <20> <> <20> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> ؾ<EFBFBD> <D8BE> Ϲ Ƿ<CFB9> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> 濡 <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> ӽð<D3BD> <C3B0> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ó<> <C3B3> <EFBFBD> ؾ<EFBFBD> <D8BE> Ѵ <EFBFBD> .
if ( m_iNowActionState = = START_ACTION | |
m_iNowActionState = = END_ACTION )
{
float fFPS = m_hHasActor - > CDnActionBase : : GetFPS ( ) ;
m_fElapsedTime + = fDelta * ( fFPS / 60.0f ) ;
}
else
{
m_fElapsedTime + = fDelta ;
}
_UpdatePlayTime ( ) ;
// <20> <> <EFBFBD> <EFBFBD> <20> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <EFBFBD> <D7BC> <EFBFBD> <EFBFBD> <EFBFBD> <20> Ѿ
switch ( m_iNowActionState )
{
case START_ACTION :
if ( m_fElapsedTime > = m_fStartActionLength )
m_iNowActionState = LOOP_ACTION ;
break ;
// <20> <> <EFBFBD> <EFBFBD> <20> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Z <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> ̵<EFBFBD> <20> <> Ű<EFBFBD> <C5B0> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD>
case LOOP_ACTION :
//m_fLoopActionLength -= fDelta;
//m_fLoopActionElapsedTime += fDelta * (fFPS/60.0f);
m_fLoopActionElapsedTime + = fDelta ; // <20> <> <EFBFBD> <EFBFBD> <20> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> frame <20> <> <EFBFBD> 濡 <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> ʵ<EFBFBD> <CAB5> <EFBFBD> ó<> <C3B3> . #
// #24949
if ( 0 = = m_hHasActor - > GetCantXZMoveSEReferenceCount ( ) )
{
m_hHasActor - > MoveZ ( m_fMoveSpeed * fDelta ) ;
}
//if( m_fLoopActionLength <= 0.0f )
if ( m_fLoopActionLength < m_fLoopActionElapsedTime )
{
//m_fLoopActionLength = 0.0f;
if ( false = = m_hHasActor - > IsDie ( ) )
{
m_hHasActor - > SetMovable ( false ) ;
# if defined(PRE_FIX_68898)
# if defined( PRE_FIX_71333 )
if ( m_isSkipEndAction = = false )
{
m_bLoopActionEnd = m_hHasActor - > SetActionQueue ( m_strEndActionName . c_str ( ) ) ;
# if defined( _GAMESERVER )
if ( ! m_bLoopActionEnd )
{
if ( m_hHasActor - > IsMonsterActor ( ) )
{
CDnMonsterActor * pMonster = ( CDnMonsterActor * ) m_hHasActor . GetPointer ( ) ;
if ( pMonster - > GetGrade ( ) > = CDnMonsterState : : Boss )
g_Log . Log ( LogType : : _PROFESSORK_SKILL , L " [CDnPartialPlayProcessor::Process] Loop Action SetActionQueue Fail MonsterID:%d StartActionName:%S EndActionName:%S CurrentAction:%S \r \n " , pMonster - > GetMonsterClassID ( ) , m_strStartActionName . c_str ( ) , m_strEndActionName . c_str ( ) , m_hHasActor - > GetCurrentAction ( ) ) ;
}
}
# endif // #if defined( _GAMESERVER )
}
else
{
m_bLoopActionEnd = true ;
# if defined( _GAMESERVER )
if ( m_hHasActor - > IsMonsterActor ( ) )
{
CDnMonsterActor * pMonster = ( CDnMonsterActor * ) m_hHasActor . GetPointer ( ) ;
g_Log . Log ( LogType : : _PROFESSORK_SKILL , L " [CDnPartialPlayProcessor::Process] m_isSkipEndAction Error MonsterID:%d StartActionName:%S EndActionName:%S CurrentAction:%S \r \n " , pMonster - > GetMonsterClassID ( ) , m_strStartActionName . c_str ( ) , m_strEndActionName . c_str ( ) , m_hHasActor - > GetCurrentAction ( ) ) ;
}
# endif // #if defined( _GAMESERVER )
}
# else // #if defined( PRE_FIX_71333 )
if ( m_isSkipEndAction = = false )
m_hHasActor - > SetActionQueue ( m_strEndActionName . c_str ( ) ) ;
# endif // #if defined( PRE_FIX_71333 )
# else // #if defined(PRE_FIX_68898)
m_hHasActor - > SetActionQueue ( m_strEndActionName . c_str ( ) ) ;
# endif // PRE_FIX_68898
m_iNowActionState = END_ACTION ;
}
}
break ;
case END_ACTION :
// <20> <> <EFBFBD> <EFBFBD> <20> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> ...
if ( m_fTimeLength < m_fElapsedTime )
{
m_bPlayEnd = true ;
m_fTimeLength = 0.0 ;
}
break ;
}
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> 쿣 <20> ߴ ܽ<DFB4> Ų<EFBFBD> <C5B2> .
// <20> <> <EFBFBD> ĵ<EFBFBD> <20> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> ȿ<EFBFBD> <C8BF> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> loop <20> ߿<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> ʴ´ <CAB4> .
if ( false = = m_hHasActor - > GetStateBlow ( ) - > IsApplied ( STATE_BLOW : : BLOW_121 ) )
{
if ( false = = m_hHasActor - > IsAttack ( ) )
{
m_bPlayEnd = true ;
m_fTimeLength = 0.0f ;
}
}
}
void CDnPartialPlayProcessor : : OnEnd ( LOCAL_TIME LocalTime , float fDelta )
{
// <20> ߰<EFBFBD> <DFB0> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Ʈ <20> <EFBFBD> <20> ׳ <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> .
if ( END_ACTION ! = m_iNowActionState )
{
if ( m_hHasActor & & ! m_hHasActor - > IsDie ( ) )
{
// <20> ൿ <20> Ұ<EFBFBD> <D2B0> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> , <20> <> ų<EFBFBD> <C5B3> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> ⼭ <20> ӽ÷<D3BD> <20> <> <EFBFBD> <EFBFBD> <20> ߴ ٰ<DFB4> <20> ٽ<EFBFBD> <20> ɾ<EFBFBD> <C9BE> ֵ<EFBFBD> <D6B5> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> .
bool bCantAction = false ;
if ( ( m_hHasActor - > GetStateEffect ( ) & CDnActorState : : Cant_AttackAction ) = = CDnActorState : : Cant_AttackAction )
{
bCantAction = true ;
m_hHasActor - > SetStateEffect ( m_hHasActor - > GetStateEffect ( ) & ~ CDnActorState : : Cant_AttackAction ) ;
}
// <20> ¾<EFBFBD> <C2BE> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> ׳ <EFBFBD> <20> <> Ʈ <20> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
if ( false = = m_hHasActor - > IsHit ( ) )
{
m_hHasActor - > SetMovable ( false ) ;
# if defined(PRE_FIX_68898)
# if defined( PRE_FIX_71333 )
if ( m_isSkipEndAction = = false )
{
m_bLoopActionEnd = m_hHasActor - > SetActionQueue ( m_strEndActionName . c_str ( ) ) ;
if ( ! m_bLoopActionEnd )
{
// <20> <> <EFBFBD> <EFBFBD> <20> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ε<EFBFBD> <20> <> <EFBFBD> а <EFBFBD> <20> Ǹ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> ȳ<EFBFBD> <C8B3> <EFBFBD> <EFBFBD> <EFBFBD> <20> ǹǷ<C7B9> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŵ
m_hHasActor - > SetAction ( m_strEndActionName . c_str ( ) , 0 , 3 ) ;
}
# if defined( _GAMESERVER )
if ( ! m_bLoopActionEnd )
{
if ( m_hHasActor - > IsMonsterActor ( ) )
{
CDnMonsterActor * pMonster = ( CDnMonsterActor * ) m_hHasActor . GetPointer ( ) ;
if ( pMonster - > GetGrade ( ) > = CDnMonsterState : : Boss )
g_Log . Log ( LogType : : _PROFESSORK_SKILL , L " [CDnPartialPlayProcessor::OnEnd] End Action SetActionQueue Fail MonsterID:%d StartActionName:%S EndActionName:%S CurrentAction:%S \r \n " , pMonster - > GetMonsterClassID ( ) , m_strStartActionName . c_str ( ) , m_strEndActionName . c_str ( ) , m_hHasActor - > GetCurrentAction ( ) ) ;
}
}
# endif // #if defined( _GAMESERVER )
}
# if defined( _GAMESERVER )
else
{
if ( m_hHasActor - > IsMonsterActor ( ) )
{
CDnMonsterActor * pMonster = ( CDnMonsterActor * ) m_hHasActor . GetPointer ( ) ;
g_Log . Log ( LogType : : _PROFESSORK_SKILL , L " [CDnPartialPlayProcessor::Process] m_isSkipEndAction Error MonsterID:%d StartActionName:%S EndActionName:%S CurrentAction:%S \r \n " , pMonster - > GetMonsterClassID ( ) , m_strStartActionName . c_str ( ) , m_strEndActionName . c_str ( ) , m_hHasActor - > GetCurrentAction ( ) ) ;
}
}
# endif // #if defined( _GAMESERVER )
# else
if ( m_isSkipEndAction = = false )
m_hHasActor - > SetActionQueue ( m_strEndActionName . c_str ( ) ) ;
m_isSkipEndAction = false ;
# endif
# else
m_hHasActor - > SetActionQueue ( m_strEndActionName . c_str ( ) ) ;
# endif // PRE_FIX_68898
}
if ( bCantAction )
{
m_hHasActor - > SetStateEffect ( m_hHasActor - > GetStateEffect ( ) | CDnActorState : : Cant_AttackAction ) ;
}
}
}
# if defined( PRE_FIX_71333 )
if ( END_ACTION = = m_iNowActionState )
{
if ( ! m_bLoopActionEnd )
{
// <20> <> <EFBFBD> <EFBFBD> <20> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ε<EFBFBD> <20> <> <EFBFBD> а <EFBFBD> <20> Ǹ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> ȳ<EFBFBD> <C8B3> <EFBFBD> <EFBFBD> <EFBFBD> <20> ǹǷ<C7B9> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <D7BC> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŵ
m_hHasActor - > SetAction ( m_strEndActionName . c_str ( ) , 0 , 3 ) ;
}
}
m_bLoopActionEnd = false ;
# endif
}