Files
2026-06-01 12:46:52 +02:00

151 lines
3.5 KiB
C++

#include "stdafx.h"
#include "SGame.h"
#include "SActionMgr.h"
#include "SGameMessage.h"
#include "SAction.h"
#include "SDebug_Util.h"
//////////////////////////////////////////////////////////////////////////
//SGameActionMgr
extern float g_fEffectSpeed;
SGameActionMgr::SGameActionMgr( SGame * pGame )
{
m_pGame = pGame;
m_fSpeed = 0.f;
}
SGameActionMgr::~SGameActionMgr()
{
std::vector< SGameAction* >::iterator it = m_ActExList.begin();
while( it != m_ActExList.end() )
{
delete (*it);
it = m_ActExList.erase( it );
}
}
void SGameActionMgr::Render( unsigned long uRenderBitVector, KViewportObject** ppViewportList, int nViewportCount )
{
if( m_ActExList.empty() ) return;
std::vector< SGameAction* >::iterator it = m_ActExList.begin();
while( it != m_ActExList.end() )
{
if( (*it)->IsEnd() )
{
delete (*it);
it = m_ActExList.erase( it );
}
else
it++;
}
for( unsigned int i(0); m_ActExList.size()>i; i++ )
m_ActExList[i]->Render( uRenderBitVector, ppViewportList, nViewportCount);
}
void SGameActionMgr::Process( DWORD dwTime )
{
if( m_ActExList.empty() ) return;
for( unsigned int i(0); m_ActExList.size()>i; i++ )
m_ActExList[i]->Process(dwTime);
}
void SGameActionMgr::Test( SGameMessage* pMsg )
{
//SMSG_SKILL_EVENT* pSkillEvent = static_cast<SMSG_SKILL_EVENT*>(pMsg);
//SkillBaseEx * pSkill = GetSkillDB().GetSkillData( pSkillEvent->skill_id );
//if( !pSkill ) return;
//SActMagicArrow * pAct = new SActMagicArrow( pSkillEvent->caster, pSkillEvent->target, pSkill );
//pAct->SetMessageHandler( m_pGame );
//m_ActExList.push_back(pAct);
}
void SGameActionMgr::AddAction( SGameMessage* pMsg )
{
g_fEffectSpeed = m_fSpeed;
switch( pMsg->nType )
{
case MSG_ATTACK : ActiveAttack ( static_cast<SMSG_ATTACK*>(pMsg) ); break;
case MSG_CMD_RESULT : ActiveCmd ( static_cast<SMSG_CMD_RESULT*>(pMsg) ); break;
case MSG_SKILL_EVENT : ActiveSkill ( static_cast<SMSG_SKILL_EVENT*>(pMsg) ); break;
// case MSG_SKILL_EFFECT : ActiveSkillEff( static_cast<SMSG_SKILL_EFFECT*>(pMsg) ); break;
}
}
void SGameActionMgr::AddTestAction( SGameMessage* pMsg )
{
SGameAction * pAct = NULL;
switch( pMsg->nType )
{
case SKILL_LIGHTNING:
{
SActionLightningFx* pLightningFx = new SActionLightningFx;
pAct = new SFireActMng( pLightningFx, static_cast<SMSG_SKILL_EVENT*>(pMsg), m_pGame );
}
break;
case SKILL_HEALINGWAVE:
{
SActionHealingWaveFx* pHealingWaveFx = new SActionHealingWaveFx;
pAct = new SFireActMng( pHealingWaveFx, static_cast<SMSG_SKILL_EVENT*>(pMsg), m_pGame );
break;
}
case SKILL_BLESSINGHAMMER:
{
SActionBlessingHammer* pBlessingHammer = new SActionBlessingHammer;
pAct = new SFireActMng( pBlessingHammer, static_cast<SMSG_SKILL_EVENT*>(pMsg), m_pGame );
break;
}
}
if( pAct )
m_ActExList.push_back(pAct);
}
void SGameActionMgr::ActiveAttack ( SMSG_ATTACK* pMsg )
{
//활 발사~, 석궁..
FireAttack( pMsg );
}
void SGameActionMgr::ActiveCmd( SMSG_CMD_RESULT* pMsg )
{
//기본 명령어 하기
}
//void SGameActionMgr::ActiveSkillEff( SMSG_SKILL_EFFECT* pMsg )
//{
//// FireSkill( pMsg );
//}
void SGameActionMgr::ActiveSkill( SMSG_SKILL_EVENT* pMsg )
{
FireSkill( pMsg );
}
#include <math.h>
void SGameActionMgr::FireSkill( SMSG_SKILL_EVENT* pMsg )
{
SGameAction * pAct = NULL;
pAct = new SFireActMng( pMsg, m_pGame );
m_ActExList.push_back(pAct);
}
void SGameActionMgr::FireAttack( SMSG_ATTACK* pMsg )
{
SGameAction * pAct = NULL;
pAct = new SFireActMng( pMsg, m_pGame );
m_ActExList.push_back(pAct);
}