Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
6388 lines
196 KiB
C++
6388 lines
196 KiB
C++
// CharacterControl.cpp: implementation of the CCharacterControl class.
|
||
//
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
#include "FrameTimer.h"
|
||
#include "WinInput.h"
|
||
#include <mmsystem.h>
|
||
|
||
#include "CharacterControl.h"
|
||
#include "SceneManager.h"
|
||
#include "BaseGraphicsLayer.h"
|
||
#include "CameraControl.h"
|
||
#include "..\\Effect\\CEffscript.h"
|
||
#include "profile.h"
|
||
#include "SceneStateMgr.h"
|
||
|
||
//////////////////////////////////////////////////////////////////////
|
||
// Construction/Destruction
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
int MAXCHRLOAD=350;
|
||
|
||
const float fDeleteChrLens=10000.0f;
|
||
|
||
#define ATTACKABLE_RANGE 150.0f
|
||
#define TARGETNEAR_RANGE 100.0f
|
||
#define PLAYERTARGETNEAR_RANGE 1000.0f
|
||
|
||
//#define ConvertRotation(fRot) ( -(fRot+3.14159f/2.0f) )
|
||
|
||
#define KeyPressed( key ) HIBYTE( GetAsyncKeyState( key ) )
|
||
#include "DeviceInput.h"
|
||
|
||
bool (*CCharacterControl::IsExistToList)(unsigned short List_In, DWORD CharID_In) = NULL;
|
||
bool (*CCharacterControl::CharAddressRequireInfo)(DWORD SenderID_In, DWORD CharID_In) = NULL;
|
||
BOOL (*CCharacterControl::SendMovingPacket)(unsigned long dwUpperAni, unsigned long dwLowerAni, float fDir, vector3 &vecMove) = NULL;
|
||
BOOL (*CCharacterControl::SendCharRespawn)(unsigned long dwChrID) = NULL;
|
||
BOOL (*CCharacterControl::SendMoveUpdatePacket)(float fDir, vector3 &vecPosition) = NULL;
|
||
BOOL (*CCharacterControl::SendCharAttack)(vector3 &vecPos, float fDir, unsigned short wType, unsigned char cSkillLock, unsigned char cSkillLevel, unsigned char cAtCount, unsigned short wDefenserNum, unsigned long dwDefenser[10]) = NULL;
|
||
void (*CCharacterControl::PickItem)(DWORD nItemID) = NULL;
|
||
char *(*CCharacterControl::GetMotionSheet)(char *strWeaponName, char *strShieldName, unsigned short wClass) = NULL;
|
||
unsigned long (*CCharacterControl::GetWeaponType)(char *strWeaponName) = NULL;
|
||
void (*CCharacterControl::CheckTargetforSkill)(unsigned long &dwTargetID, BOOL bCheckLength) = NULL;
|
||
BOOL (*CCharacterControl::CheckSkillStart)(BOOL bDown) = NULL;
|
||
BOOL (*CCharacterControl::CheckStillCasting)(unsigned long &dwFunction) = NULL;
|
||
void (*CCharacterControl::SetAutoRun)(BOOL bAutoRun) = NULL;
|
||
BOOL (*CCharacterControl::GetAutoRun)(void) = NULL;
|
||
void (*CCharacterControl::ChangeWeapon)(void) = NULL;
|
||
void (*CCharacterControl::SetChangeWeapon)(BOOL bChangeWeapon) = NULL;
|
||
vector3 (*CCharacterControl::GetMonsterMinBox)(unsigned long dwChrID) = NULL;
|
||
vector3 (*CCharacterControl::GetMonsterMaxBox)(unsigned long dwChrID) = NULL;
|
||
void (*CCharacterControl::SetKillCounter)(long lKillCounter) = NULL;
|
||
char CCharacterControl::m_WCharMotion[50];
|
||
|
||
//bool CCharacterControl::m_bSlide;
|
||
//CEffScript::CEffExt6 CCharacterControl::m_SlideValue;
|
||
//CEffScript * CCharacterControl::m_SlideEffect;
|
||
|
||
//BOOL (*CCharacterControl::StartSkill)(void) = NULL;
|
||
|
||
CCharacterControl::CCharacterControl()
|
||
{
|
||
m_nFocusCharacter=-1;
|
||
|
||
//m_fCameraRotX = FLOAT_PHI / 2.0f;
|
||
//m_fCameraRotY = 0.0f;
|
||
//m_fInterCharacterCamera = 300.0f;
|
||
|
||
m_nChrCounter=0;
|
||
|
||
m_lpDuelReady = NULL;
|
||
m_lpButtonNormal = NULL;
|
||
m_bComboSuccess = FALSE;
|
||
|
||
m_dwDuelTargetID = 0;
|
||
m_dwPreDuelTargetID = 0;
|
||
|
||
m_MouseClickMode=0;
|
||
m_bSkillExecuted = FALSE;
|
||
m_vecPrePosition = vector3(0.0f, 0.0f, 0.0f);
|
||
m_nCameraAnimation=0;
|
||
m_bClientUsed=false;
|
||
m_bClickMove=false;
|
||
m_dwMaxCombo = 4;
|
||
m_bAttackable = TRUE;
|
||
m_bAttackResult = TRUE;
|
||
|
||
m_bClickAttack=false;
|
||
m_dwClickModeAttackTargetID = 0xFFFFFFFF;
|
||
m_dwNormalTargetID = 0xFFFFFFFF;
|
||
m_dwSpecialTargetID = 0xFFFFFFFF;
|
||
m_dwNormalTargetMonsterID = 0xFFFFFFFF;
|
||
m_fSkillLength = 0.0f;
|
||
|
||
m_lAutoRunCounter = 0;
|
||
m_fRunSpeed = 600.0f;
|
||
m_fWalkSpeed = 250.0f;
|
||
|
||
m_bAutoTargetAttack=false;
|
||
m_dwAutoTargetID = 0xFFFFFFFF;
|
||
m_bSkillAttack=false;
|
||
// m_lstCharData.allocate(1000);
|
||
//m_ChrCashList.allocate(1000);
|
||
|
||
// m_pCharacterSelectEff=NULL;
|
||
// m_pEnemyAttackEff=NULL;
|
||
|
||
m_nSelectItem=0xffffffff;
|
||
m_SimpleHumanTexture[0]=NULL;
|
||
m_SimpleHumanTexture[1]=NULL;
|
||
m_SimpleHumanTexture[2]=NULL;
|
||
m_SimpleHumanTexture[3]=NULL;
|
||
|
||
m_SkillAttackValue = 0;
|
||
// m_bSlide = false;
|
||
m_dwSlideTick = timeGetTime();
|
||
// m_SlideEffect = NULL;
|
||
m_Effect = NULL;
|
||
memset(m_TextEsf,0,sizeof(char) * 256);
|
||
memset(m_TextEsfInterface,0,sizeof(char) * 256);
|
||
|
||
|
||
}
|
||
|
||
CCharacterControl::~CCharacterControl()
|
||
{
|
||
if(m_SimpleHumanTexture[3]) { delete m_SimpleHumanTexture[3]; m_SimpleHumanTexture[3] = NULL; }
|
||
if(m_SimpleHumanTexture[2]) { delete m_SimpleHumanTexture[2]; m_SimpleHumanTexture[2] = NULL; }
|
||
if(m_SimpleHumanTexture[1]) { delete m_SimpleHumanTexture[1]; m_SimpleHumanTexture[1] = NULL; }
|
||
if(m_SimpleHumanTexture[0]) { delete m_SimpleHumanTexture[0]; m_SimpleHumanTexture[0] = NULL; }
|
||
|
||
DeleteAllCharacter();
|
||
}
|
||
|
||
void CCharacterControl::Create()
|
||
{
|
||
m_dwRunFactorTimer = CFrameTimer::Regist(200.0f);
|
||
m_nCharMovingPacketTimerID = CFrameTimer::Regist(4.0f);
|
||
m_nCharMoveUpdatePacketTimerID = CFrameTimer::Regist(1.0f);
|
||
|
||
if(m_bClientUsed==false)
|
||
CCameraControl::m_nCameraAnimationTimer=CFrameTimer::Regist(30.0f);
|
||
else
|
||
CCameraControl::m_nCameraAnimationTimer=CFrameTimer::Regist(100.0f);
|
||
|
||
// CCreature::LoadMotionSheet("");
|
||
|
||
// if(m_pEnemyAttackEff==NULL)
|
||
{
|
||
// m_pEnemyAttackEff=new CEffScript;
|
||
|
||
// CSceneManager::AddEffectScript(m_pEnemyAttackEff);
|
||
// m_pEnemyAttackEff->GetScriptData("inter-enemyattack.esf");
|
||
// m_pEnemyAttackEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyAttackEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
}
|
||
|
||
// if(m_pCharacterSelectEff==NULL)
|
||
{
|
||
// m_pCharacterSelectEff=new CEffScript;
|
||
// CSceneManager::AddEffectScript(m_pCharacterSelectEff);
|
||
// m_pCharacterSelectEff->GetScriptData("mark.esf");
|
||
// m_pCharacterSelectEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pCharacterSelectEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
|
||
// m_pEnemyCharacterSelectEff=new CEffScript;
|
||
// CSceneManager::AddEffectScript(m_pEnemyCharacterSelectEff);
|
||
|
||
// m_pEnemyCharacterSelectEff->GetScriptData("inter_mark_enemy.esf");
|
||
// m_pEnemyCharacterSelectEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyCharacterSelectEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
|
||
}
|
||
|
||
if(m_SimpleHumanTexture[0]==NULL)
|
||
{
|
||
CTexture::SetPath(INTERFACETEXTUREPATH);
|
||
|
||
|
||
m_SimpleHumanTexture[0]=new CTexture();
|
||
m_SimpleHumanTexture[0]->Load("SimpleHumanFront.dds");
|
||
m_SimpleHumanTexture[1]=new CTexture();
|
||
m_SimpleHumanTexture[1]->Load("SimpleHumanBack.dds");
|
||
m_SimpleHumanTexture[2]=new CTexture();
|
||
m_SimpleHumanTexture[2]->Load("SimpleHumanLeft.dds");
|
||
m_SimpleHumanTexture[3]=new CTexture();
|
||
m_SimpleHumanTexture[3]->Load("SimpleHumanRight.dds");
|
||
|
||
/**/
|
||
|
||
}
|
||
|
||
|
||
|
||
//m_pCharacterSelectEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
//m_pCharacterSelectEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
|
||
|
||
}
|
||
|
||
void CCharacterControl::DeleteAllCharacter(void)
|
||
{
|
||
/*
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
if(m_lstCharData[cChr]->m_lpChrModel)
|
||
{
|
||
CSceneManager::DeleteCharacter(m_lstCharData[cChr]->m_lpChrModel);
|
||
m_lstCharData[cChr]->m_lpChrModel = NULL;
|
||
}
|
||
}
|
||
m_lstCharData.num = 0;
|
||
*/
|
||
for(int cChr=0;cChr<m_ChrCashList.num;cChr++)
|
||
{
|
||
if(m_ChrCashList[cChr].m_lpChrModel)
|
||
{
|
||
CSceneManager::DeleteCharacter(m_ChrCashList[cChr].m_lpChrModel);
|
||
m_ChrCashList[cChr].m_lpChrModel=NULL;
|
||
}
|
||
|
||
}
|
||
m_ChrCashList.num=0;
|
||
|
||
for(cChr=0;cChr<m_lstCharData.num;cChr++)
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel=NULL;
|
||
delete m_lstCharData[cChr];
|
||
}
|
||
m_lstCharData.num=0;
|
||
|
||
}
|
||
|
||
int CCharacterControl::AddCharacter(unsigned long dwChrID, const char *strName, char *strGCMDSName, vector3 vecChrPos, float fDirection)
|
||
{
|
||
CCreature *lpCreature = GetCreature(dwChrID);
|
||
if(lpCreature) return lpCreature->m_ChrNodeID;
|
||
|
||
CCreature *AddNode;
|
||
|
||
AddNode = new CCreature;
|
||
|
||
AddNode->m_dwSpendTime[1] = AddNode->m_dwSpendTime[2] =
|
||
AddNode->m_dwSpendTime[3] = AddNode->m_dwSpendTime[4] = AddNode->m_dwSpendTime[5] = GetTickCount();
|
||
|
||
AddNode->m_dwChrID = dwChrID;
|
||
AddNode->m_bUsed = TRUE;
|
||
strcpy(AddNode->m_strName, strName);
|
||
AddNode->m_vecPos = vecChrPos;
|
||
AddNode->m_fDirection = fDirection;
|
||
m_nChrCounter++;
|
||
AddNode->m_ChrNodeID = m_nChrCounter;
|
||
strcpy(AddNode->m_strGCMDSName, strGCMDSName);
|
||
strcpy(AddNode->m_strFaceType, "FACE01");
|
||
strcpy(AddNode->m_strHairStyle, "HAIR01");
|
||
AddNode->m_dwLastUpdateActionTimer=GetTickCount();
|
||
|
||
for(int i=0;i<15;i++)
|
||
{
|
||
strcpy(AddNode->m_strShape[i],"");
|
||
}
|
||
|
||
if(m_ChrCashList.num < MAXCHRLOAD)
|
||
{
|
||
//CZ3DGeneralChrModel *pAddChrmodel = AllocCharacter(strGCMDSName, "FACE01", "HAIR01", m_nChrCounter, AddNode.m_strShape);
|
||
CZ3DGeneralChrModel *pAddChrmodel = AllocCharacter(strGCMDSName, "FACE01", "HAIR01", m_nChrCounter, AddNode->m_strShape);
|
||
pAddChrmodel->SetPosition(vecChrPos);
|
||
pAddChrmodel->SetDirection(fDirection);
|
||
// pAddChrmodel->SetMotion("WAIT");
|
||
pAddChrmodel->SetLODLevel(0);
|
||
AddNode->m_lpChrModel = pAddChrmodel;
|
||
switch(GetClientType(dwChrID))
|
||
{
|
||
case CT_PC:
|
||
/*
|
||
if(m_lstCharData.num==0)
|
||
CSceneManager::CharacterCollisionDetectType(pAddChrmodel,CDT_FULL);
|
||
else
|
||
*/
|
||
CSceneManager::CharacterCollisionDetectType(pAddChrmodel,CDT_NONE);
|
||
break;
|
||
case CT_NPC:
|
||
{
|
||
CCharacterLightShadowManager::CCharacterDataNode CheckNode;
|
||
CheckNode=CSceneManager::GetCharacterDataNode(pAddChrmodel);
|
||
CheckNode.m_CollisionType=CT_NONE;
|
||
CSceneManager::SetCharacterDataNode(CheckNode);
|
||
|
||
CSceneManager::CharacterCollisionDetectType(pAddChrmodel,CDT_FIRSTBOTTOM);
|
||
}
|
||
vecChrPos.y-=30.0f;
|
||
pAddChrmodel->SetPosition(vecChrPos);
|
||
break;
|
||
case CT_MONSTER:
|
||
{
|
||
CCharacterLightShadowManager::CCharacterDataNode CheckNode;
|
||
CheckNode=CSceneManager::GetCharacterDataNode(pAddChrmodel);
|
||
CheckNode.m_CollisionType=CT_NONE;
|
||
CSceneManager::SetCharacterDataNode(CheckNode);
|
||
|
||
CSceneManager::CharacterCollisionDetectType(pAddChrmodel,CDT_FIRSTBOTTOM);
|
||
}
|
||
vecChrPos.y-=30.0f;
|
||
pAddChrmodel->SetPosition(vecChrPos);
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
AddNode->m_lpChrModel = NULL;
|
||
}/**/
|
||
|
||
AddNode->m_dwSpendTime[4] = GetTickCount();
|
||
|
||
m_lstCharData.Add(AddNode);
|
||
|
||
//////////// Monster Effect
|
||
const char **ppstrEffect = NULL;
|
||
int iEffectNum = 0;
|
||
|
||
AddNode->m_lpChrModel->ApplySTMode();
|
||
|
||
iEffectNum = AddNode->m_lpChrModel->GetEffectInfoList(ppstrEffect);
|
||
if((iEffectNum > 0) && (ppstrEffect != NULL))
|
||
{
|
||
for( int cEff = 0; cEff < iEffectNum; cEff++ )
|
||
{
|
||
MonsterEffectProcess(m_lstCharData.num -1,(char *)ppstrEffect[cEff],1);
|
||
}
|
||
}
|
||
///////////////
|
||
|
||
return AddNode->m_ChrNodeID;
|
||
}
|
||
|
||
int CCharacterControl::AddCharacter(unsigned long dwChrID, unsigned char cNation, const char *strName, char *strGCMDSName, char *strFaceType, char *strHairStyle, vector3 vecChrPos, float fDirection, char strShape[15][256])
|
||
{
|
||
CCreature *lpCreature = GetCreature(dwChrID);
|
||
if(lpCreature) return lpCreature->m_ChrNodeID;
|
||
|
||
CCreature *AddNode;
|
||
|
||
AddNode = new CCreature;
|
||
AddNode->m_dwChrID = dwChrID;
|
||
strcpy(AddNode->m_strName, strName);
|
||
AddNode->m_vecPos = vecChrPos;
|
||
AddNode->m_fDirection = fDirection;
|
||
AddNode->m_cNation = cNation;
|
||
m_nChrCounter++;
|
||
AddNode->m_ChrNodeID = m_nChrCounter;
|
||
strcpy(AddNode->m_strGCMDSName, strGCMDSName);
|
||
strcpy(AddNode->m_strFaceType, strFaceType);
|
||
strcpy(AddNode->m_strHairStyle, strHairStyle);
|
||
AddNode->m_dwLastUpdateActionTimer=GetTickCount();
|
||
|
||
if(m_ChrCashList.num < MAXCHRLOAD)
|
||
{
|
||
CZ3DGeneralChrModel *pAddChrmodel = AllocCharacter(strGCMDSName, strFaceType, strHairStyle, m_nChrCounter, strShape);
|
||
pAddChrmodel->SetPosition(vecChrPos);
|
||
pAddChrmodel->SetDirection(fDirection);
|
||
// pAddChrmodel->SetMotion("WAIT");
|
||
pAddChrmodel->SetLODLevel(0);
|
||
AddNode->m_lpChrModel = pAddChrmodel;
|
||
AddNode->SetShape(strShape);
|
||
|
||
switch(GetClientType(dwChrID))
|
||
{
|
||
case CT_PC:
|
||
/*
|
||
if(m_lstCharData.num==0)
|
||
CSceneManager::CharacterCollisionDetectType(pAddChrmodel,CDT_FULL);
|
||
else
|
||
*/
|
||
CSceneManager::CharacterCollisionDetectType(pAddChrmodel,CDT_NONE);
|
||
break;
|
||
case CT_NPC:
|
||
CSceneManager::CharacterCollisionDetectType(pAddChrmodel,CDT_FIRSTBOTTOM);
|
||
//vecChrPos.y-=50.0f;
|
||
pAddChrmodel->SetPosition(vecChrPos);
|
||
break;
|
||
case CT_MONSTER:
|
||
CSceneManager::CharacterCollisionDetectType(pAddChrmodel,CDT_FIRSTBOTTOM);
|
||
//vecChrPos.y-=50.0f;
|
||
pAddChrmodel->SetPosition(vecChrPos);
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
AddNode->m_lpChrModel = NULL;
|
||
}/**/
|
||
|
||
m_lstCharData.Add(AddNode);
|
||
AddNode->m_lpChrModel->ApplySTMode();
|
||
|
||
//////////// Monster Effect
|
||
const char **ppstrEffect = NULL;
|
||
int iEffectNum = 0;
|
||
|
||
iEffectNum = AddNode->m_lpChrModel->GetEffectInfoList(ppstrEffect);
|
||
if((iEffectNum > 0) && (ppstrEffect != NULL))
|
||
{
|
||
for( int cEff = 0; cEff < iEffectNum; cEff++ )
|
||
{
|
||
MonsterEffectProcess(m_lstCharData.num -1,(char *)ppstrEffect[cEff],1);
|
||
}
|
||
}
|
||
///////////////
|
||
|
||
return AddNode->m_ChrNodeID;
|
||
}
|
||
|
||
int ChrLensCompare(const void *elem1, const void *elem2)
|
||
{
|
||
float d1, d2;
|
||
CCreature* p1, *p2;
|
||
p1 = *((CCreature **)elem1);
|
||
p2 = *((CCreature **)elem2);
|
||
d1 = p1->m_fSelfChrLens;
|
||
d2 = p2->m_fSelfChrLens;
|
||
|
||
if( d1 < d2 )
|
||
return -1;
|
||
if( d1 > d2 )
|
||
return 1;
|
||
return 0;
|
||
}
|
||
|
||
void CCharacterControl::Update(float fUpdateTime)
|
||
{
|
||
|
||
|
||
if(m_lstCharData.num == 0) return;
|
||
|
||
vector3 vecViewPos = CSceneManager::GetCamera()->GetMatPosition()->GetLoc();
|
||
vector3 vecChrPos, vecLens;
|
||
float fInterLens;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_fSelfChrLens = 0.0f;
|
||
|
||
float fCameraDir = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
|
||
vector3 vecCameraInterPos;
|
||
vecCameraInterPos.x = cosf(fCameraDir);
|
||
vecCameraInterPos.z = sinf(fCameraDir);
|
||
vecCameraInterPos.y = 0.0f;
|
||
vecCameraInterPos.Normalize();
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecChrPos);
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos = vecChrPos;
|
||
|
||
|
||
|
||
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
|
||
|
||
/*
|
||
if(!m_lstCharData[cChr]->m_bUsed)
|
||
{
|
||
vecLens = m_lstCharData[m_nFocusCharacter]->m_vecPos - m_lstCharData[cChr]->m_vecPos;
|
||
fInterLens = vecLens.GetLens();
|
||
vecLens = m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
m_lstCharData[cChr]->m_fSelfChrLens = vecLens.GetLens();
|
||
|
||
continue;
|
||
}
|
||
*/
|
||
|
||
if(m_lstCharData[cChr]->m_lpChrModel)
|
||
{
|
||
if(m_lstCharData[cChr]->m_bCharDead==FALSE)
|
||
CSceneManager::CharacterCollisionAble(m_lstCharData[cChr]->m_lpChrModel,true);
|
||
else
|
||
CSceneManager::CharacterCollisionAble(m_lstCharData[cChr]->m_lpChrModel,false);
|
||
|
||
if(cChr!=m_nFocusCharacter)
|
||
{
|
||
if(GetClientType(m_lstCharData[cChr]->m_dwChrID)==CT_PC)
|
||
CSceneManager::CharacterGravityAble(m_lstCharData[cChr]->m_lpChrModel,false);
|
||
else
|
||
CSceneManager::CharacterGravityAble(m_lstCharData[cChr]->m_lpChrModel,true);
|
||
switch(GetClientType(m_lstCharData[cChr]->m_dwChrID))
|
||
{
|
||
case CT_PC:
|
||
CSceneManager::CharacterCollisionDetectType(m_lstCharData[cChr]->m_lpChrModel,CDT_NONE);
|
||
break;
|
||
case CT_NPC:
|
||
CSceneManager::CharacterCollisionDetectType(m_lstCharData[cChr]->m_lpChrModel,CDT_FIRSTBOTTOM);
|
||
break;
|
||
case CT_MONSTER:
|
||
CSceneManager::CharacterCollisionDetectType(m_lstCharData[cChr]->m_lpChrModel,CDT_FIRSTBOTTOM);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if(m_lstCharData[cChr]->m_lpChrModel==NULL)
|
||
{
|
||
vecLens = m_lstCharData[m_nFocusCharacter]->m_vecPos - m_lstCharData[cChr]->m_vecPos;
|
||
fInterLens = vecLens.GetLens();
|
||
vecLens = m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
m_lstCharData[cChr]->m_fSelfChrLens = vecLens.GetLens();
|
||
/*
|
||
f*oat fAngle = vecCameraInterPos * vecLens;
|
||
fAngle = acosf(fAngle);
|
||
fAngle = fabsf(fAngle);
|
||
|
||
if(fAngle <= FLOAT_PHI / 3.0f)
|
||
{
|
||
m_lstCharData[cChr]->m_fSelfChrLens *= 0.1f;
|
||
}
|
||
*/
|
||
continue;
|
||
}
|
||
|
||
m_lstCharData[cChr]->m_vecPos = m_lstCharData[cChr]->m_lpChrModel->GetPosition();
|
||
m_lstCharData[cChr]->m_fDirection = m_lstCharData[cChr]->m_lpChrModel->GetDirection();
|
||
|
||
if(cChr == m_nFocusCharacter) continue;
|
||
|
||
vecChrPos = m_lstCharData[cChr]->m_vecPos;
|
||
vecLens = m_lstCharData[m_nFocusCharacter]->m_vecPos - vecChrPos;
|
||
fInterLens = vecLens.GetLens();
|
||
vecLens = vecChrPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
m_lstCharData[cChr]->m_fSelfChrLens = vecLens.GetLens();
|
||
if(m_lstCharData[cChr]->m_fSelfChrLens < 500.0f)
|
||
{
|
||
//m_lstCharData[cChr]->m_fSelfChrLens = 0.5f;
|
||
}
|
||
vecLens.y = 0.0f;
|
||
vecLens.Normalize();
|
||
|
||
float fAngle = vecCameraInterPos * vecLens;
|
||
fAngle = acosf(fAngle);
|
||
fAngle = fabsf(fAngle);
|
||
|
||
if(fAngle <= FLOAT_PHI / 3.0f)
|
||
{
|
||
m_lstCharData[cChr]->m_fSelfChrLens *= 0.1f;
|
||
}
|
||
|
||
if(fInterLens <= fCHARACTERLODLEVELDIST[0])
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->SetLODLevel(0);
|
||
}
|
||
else if(fInterLens <= fCHARACTERLODLEVELDIST[1])
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->SetLODLevel(2);
|
||
}
|
||
else if(fInterLens <= fCHARACTERLODLEVELDIST[2])
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->SetLODLevel(2);
|
||
}
|
||
else
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->SetLODLevel(3);
|
||
}
|
||
if(strcmp(m_lstCharData[cChr]->m_strGCMDSName,"MON_Yang.GCMDS")==0)
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->SetLODLevel(3);
|
||
}
|
||
if(cChr == 0) {
|
||
m_lstCharData[cChr]->m_lpChrModel->SetLODLevel(0);
|
||
}
|
||
}
|
||
|
||
qsort(&(m_lstCharData.element[1]), m_lstCharData.num - 1, sizeof(CCreature*), ChrLensCompare);
|
||
|
||
/* if(!m_lstCharData[m_nFocusCharacter]->m_lpChrModel)
|
||
{
|
||
int abc = 0;
|
||
}*/
|
||
|
||
for(int i = MAXCHRLOAD; i < m_lstCharData.num; i++)
|
||
{
|
||
//if(m_lstCharData[i]->m_bUsed && m_lstCharData[i]->m_lpChrModel)
|
||
if(m_lstCharData[i]->m_lpChrModel)
|
||
{
|
||
for(int j = 0; j < m_lstCharData[i]->m_lstActionData.num;)
|
||
{
|
||
m_lstCharData[i]->m_lstActionData.DelIndex(0);
|
||
}
|
||
m_lstCharData[i]->m_lstActionData.num = 0;
|
||
|
||
for(j = 0; j < m_lstCharData[i]->m_lstDamageNumber.num;)
|
||
{
|
||
m_lstCharData[i]->m_lstDamageNumber.DelIndex(0);
|
||
}
|
||
m_lstCharData[i]->m_lstDamageNumber.num = 0;
|
||
|
||
UnloadCash(m_lstCharData[i]->m_lpChrModel);
|
||
m_lstCharData[i]->m_lpChrModel=NULL;
|
||
m_lstCharData[i]->m_wMaxHP = 0;
|
||
m_lstCharData[i]->m_sCurrHP = -1;
|
||
m_lstCharData[i]->m_wMaxMP = 0;
|
||
m_lstCharData[i]->m_sCurrMP = -1;
|
||
|
||
/*
|
||
m_lstCharData[i]->m_lpChrModel = NULL;
|
||
for(int j = 0; j < m_lstCharData[i]->m_lstActionData.num; j++)
|
||
{
|
||
m_lstCharData[i]->m_lstActionData.DelIndex(0);
|
||
}
|
||
|
||
for(int cCash = 0; cCash < m_ChrCashList.num; cCash++)
|
||
{
|
||
if(m_ChrCashList[cCash].m_nUsedChrID == m_lstCharData[i]->m_ChrNodeID)
|
||
{
|
||
m_ChrCashList[cCash].m_nUsedChrID = -1;
|
||
break;
|
||
}
|
||
}
|
||
*/
|
||
}
|
||
}
|
||
|
||
|
||
for(i = 0; i < MAXCHRLOAD && i < m_lstCharData.num; i++)
|
||
{
|
||
if(i == m_nFocusCharacter)
|
||
continue;
|
||
|
||
//if(m_lstCharData[i]->m_bUsed && !m_lstCharData[i]->m_lpChrModel)
|
||
if(!m_lstCharData[i]->m_lpChrModel)
|
||
{
|
||
if(m_lstCharData[i]->m_bUsed)
|
||
{
|
||
m_lstCharData[i]->m_dwSpendTime[1] = m_lstCharData[i]->m_dwSpendTime[2] =
|
||
m_lstCharData[i]->m_dwSpendTime[3] = m_lstCharData[i]->m_dwSpendTime[4] = m_lstCharData[i]->m_dwSpendTime[5] = GetTickCount();
|
||
|
||
m_lstCharData[i]->m_lpChrModel = AllocCharacter(m_lstCharData[i]->m_strGCMDSName,
|
||
m_lstCharData[i]->m_strFaceType, m_lstCharData[i]->m_strHairStyle,
|
||
m_lstCharData[i]->m_ChrNodeID, m_lstCharData[i]->m_strShape);
|
||
// m_lstCharData[i]->SetShape(&m_lstCharData[i]->m_wShape[0]);
|
||
if(i == m_nFocusCharacter)
|
||
m_lstCharData[i]->SetChantEffect(m_lstCharData[i]->m_dwChant, TRUE);
|
||
else
|
||
m_lstCharData[i]->SetChantEffect(m_lstCharData[i]->m_dwChant, FALSE);
|
||
|
||
if(GetClientType(m_lstCharData[i]->m_dwChrID)==CT_NPC)
|
||
{
|
||
m_lstCharData[i]->m_lpChrModel->SetPosition(m_lstCharData[i]->m_vecPos+vector3(0.0,-50.0f,0.0f));
|
||
|
||
CCharacterLightShadowManager::CCharacterDataNode CheckNode;
|
||
CheckNode=CSceneManager::GetCharacterDataNode(m_lstCharData[i]->m_lpChrModel);
|
||
CheckNode.m_CollisionType=CT_NONE;
|
||
CSceneManager::SetCharacterDataNode(CheckNode);
|
||
|
||
CSceneManager::CharacterCollisionDetectType(m_lstCharData[i]->m_lpChrModel,CDT_FIRSTBOTTOM);
|
||
}
|
||
else
|
||
{
|
||
m_lstCharData[i]->m_lpChrModel->SetPosition(m_lstCharData[i]->m_vecPos);
|
||
}
|
||
|
||
m_lstCharData[i]->m_lpChrModel->SetScale(m_lstCharData[i]->m_fScale);
|
||
m_lstCharData[i]->m_lpChrModel->SetDirection(m_lstCharData[i]->m_fDirection);
|
||
|
||
m_lstCharData[i]->m_dwSpendTime[4] = GetTickCount();
|
||
}
|
||
}
|
||
}/**/
|
||
|
||
// for(cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
for(cChr = 0; cChr < MAXCHRLOAD && cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
//if(cChr == m_nFocusCharacter || !m_lstCharData[cChr]->m_bUsed) continue;
|
||
if(cChr == m_nFocusCharacter)
|
||
continue;
|
||
|
||
if(GetClientType(m_lstCharData[cChr]->m_dwChrID) == CT_MONSTER)
|
||
{
|
||
UpdateMonster(cChr, fUpdateTime);
|
||
} else if(GetClientType(m_lstCharData[cChr]->m_dwChrID) == CT_PC)
|
||
{
|
||
UpdatePlayer(cChr, fUpdateTime);
|
||
} else if(GetClientType(m_lstCharData[cChr]->m_dwChrID) == CT_NPC)
|
||
{
|
||
UpdateMonster(cChr, fUpdateTime);
|
||
}
|
||
}/**/
|
||
/* for(cChr = 0;cChr <m_lstCharData.num;cChr++) {
|
||
/// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȭ<><C8AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
|
||
m_lstCharData[cChr]->ArrowUpdate();
|
||
/// ij<><C4B3><EFBFBD>Ϳ<EFBFBD> <20>ٴ<EFBFBD> effect <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
|
||
m_lstCharData[cChr]->BodyEffectUpdate();
|
||
/// weapon effect update
|
||
m_lstCharData[cChr]->WeaponEffectUpdate();
|
||
m_lstCharData[cChr]->WeaponLineUpdate();
|
||
|
||
///
|
||
}
|
||
unsigned long CurrentSlideTick = timeGetTime();
|
||
int slidenum = (CurrentSlideTick - m_dwSlideTick) / DEFAULTESTICK;
|
||
for(int slc = 0; slc <slidenum;slc++) {
|
||
m_dwSlideTick = CurrentSlideTick;
|
||
for(cChr = 0;cChr <m_lstCharData.num;cChr++)
|
||
m_lstCharData[cChr]->PlaySlide();
|
||
}
|
||
*/
|
||
}
|
||
|
||
void CCharacterControl::UnLoadChr(unsigned long dwUID)
|
||
{
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
if(dwUID == m_lstCharData[cChr]->m_dwChrID)
|
||
{
|
||
CCreature *lpCreature = m_lstCharData[cChr];
|
||
if(lpCreature->m_lpChrModel)
|
||
{
|
||
lpCreature->Respawn();
|
||
UnloadCash(lpCreature->m_lpChrModel);
|
||
//CSceneManager::DeleteCharacter(lpCreature->m_lpChrModel);
|
||
lpCreature->m_lpChrModel = NULL;
|
||
}
|
||
|
||
m_lstCharData.DelIndex(cChr);
|
||
delete lpCreature;
|
||
}
|
||
}
|
||
}
|
||
|
||
void CCharacterControl::UpdateSelfCharacter(BOOL bKeyAble, BOOL bEdge, int MouseX,int MouseY)
|
||
{
|
||
if(m_nFocusCharacter == -1) return;
|
||
|
||
//MouseModeChange();
|
||
|
||
if(m_MouseClickMode==0)
|
||
{
|
||
MouseClickModeSelfCharacterUpdate(bKeyAble, bEdge, MouseX, MouseY);
|
||
return;
|
||
}
|
||
|
||
CCharacterLightShadowManager::CCharacterDataNode CheckNode;
|
||
|
||
CSceneManager::CharacterCollisionDetectType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,CDT_FULL);
|
||
|
||
float fAngle=m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
|
||
fAngle-=m_lstCharData[m_nFocusCharacter]->m_fFixAngle;
|
||
m_lstCharData[m_nFocusCharacter]->m_fFixAngle=0.0f;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fAngle);
|
||
|
||
vector3 vecChrPos = m_lstCharData[m_nFocusCharacter]->m_vecPos = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition();
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_fDirection = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
vecChrPos += vector3(0.0f, 150.0f, 0.0f);
|
||
fChrDir = -fChrDir;
|
||
fChrDir -= FLOAT_PHI / 2.0f;
|
||
|
||
vector3 vecChrToward;
|
||
vecChrToward.x = cosf(fChrDir);
|
||
vecChrToward.z = sinf(fChrDir);
|
||
vecChrToward.y = 0.0f;
|
||
vecChrToward.Normalize();
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20>븻
|
||
vector3 vecChrLeft;
|
||
vecChrLeft.x = cosf(fChrDir + FLOAT_PHI / 2.0f);
|
||
vecChrLeft.z = sinf(fChrDir + FLOAT_PHI / 2.0f);
|
||
vecChrLeft.y = 0.0f;
|
||
static int weapon = 0;
|
||
if(KeyPressed('Z')) {
|
||
weapon = 0;
|
||
}
|
||
/*if(KeyPressed('C')) {
|
||
weapon = 1;
|
||
}*/
|
||
/*if(KeyPressed('V')) {
|
||
weapon = 2;
|
||
}
|
||
/*if(KeyPressed('B')) {
|
||
weapon = 3;
|
||
}*/
|
||
/*if(KeyPressed('N')) {
|
||
weapon = 4;
|
||
}
|
||
if(KeyPressed('M')) {
|
||
weapon = 5;
|
||
}*/
|
||
if(KeyPressed('K')) {
|
||
weapon = 6;
|
||
//g_CameraScript->CreateSpline();
|
||
|
||
}
|
||
|
||
switch(weapon) {
|
||
case 0:
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetMotionSheet("WEAPON_ONE_HAND");
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetAttachmentSlot("WEAPON", "broad_sword");
|
||
|
||
break;
|
||
case 1:
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetMotionSheet("WEAPON_TWO_HAND");
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetAttachmentSlot("WEAPON","ancient_sword");
|
||
break;
|
||
case 2:
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetMotionSheet("WEAPON_BLUNT");
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetAttachmentSlot("WEAPON","grand_spiked_maul");
|
||
break;
|
||
case 3:
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetMotionSheet("WEAPON_STAFF");
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetAttachmentSlot("WEAPON", "bone_staff");
|
||
break;
|
||
case 4:
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetMotionSheet("WEAPON_BOW");
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetAttachmentSlot("WEAPON", "composite_bow");
|
||
break;
|
||
case 5:
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetMotionSheet("WEAPON_DAGGER");
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetAttachmentSlot("WEAPON", "dagger");
|
||
break;
|
||
case 6:
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetMotionSheet("WEAPON_CROSSBOW");
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetAttachmentSlot("WEAPON", "Heavy_crossbow");
|
||
break;
|
||
|
||
}
|
||
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetAttachmentHolder("WEAPON", 1);
|
||
/*m_lstCharData[m_nFocusCharacter]->m_lpChrModel->BeginOutfitSetting();
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetOutfitSlot("SKILL", "HAND_OF_JAMADHAR");
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->EndOutfitSetting();
|
||
*/
|
||
|
||
/*
|
||
|
||
W-><3E><EFBFBD><DEB8><EFBFBD>
|
||
|
||
Click->Attack
|
||
*/
|
||
/* static bool m_bMoving = false;
|
||
static bool m_bAttackAble = true;
|
||
static int m_nAttackCombo = 0;
|
||
static int m_nMove = 0;
|
||
|
||
bool m_bAttackSuc = false;
|
||
|
||
/* if(CSceneManager::GetCharacterEvent(m_lstCharData[m_nFocusCharacter].m_lpChrModel, Z3D_ES_HIT))
|
||
{
|
||
if(MakeAttackInfo())
|
||
{
|
||
//m_lstCharData[m_nFocusCharacter].m_lpChrModel-
|
||
CSceneManager::AddDelayTimer(m_lstCharData[m_nFocusCharacter].m_lpChrModel, 3);
|
||
if(m_lstCharData[m_nFocusCharacter].m_dwUpperChrAction == CA_ATTACK)
|
||
{
|
||
if(++m_nAttackCombo > 3)
|
||
{
|
||
m_nAttackCombo = 0;
|
||
}
|
||
if(m_nAttackCombo > 0)
|
||
{
|
||
m_bAttackSuc = true;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
m_nAttackCombo = 0;
|
||
}
|
||
}*/
|
||
|
||
/* static bool m_bAttackSuc=false;
|
||
int nResult = CSceneManager::GetCharacterEvent(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, EVENT_CANCEL);
|
||
if(nResult && m_bAttackSuc)
|
||
{
|
||
if(KeyPressed(VK_LBUTTON)) // Ÿ<>̹<EFBFBD><CCB9><EFBFBD> <20>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
//CSceneManager::AddDelayTimer(m_lstCharDawwwwwwwta[m_nFocusCharacter].m_lpChrModel, 3);
|
||
if( m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_ATTACK ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_ATTACK2 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_ATTACK3 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_ATTACK4)
|
||
{
|
||
if(++m_lstCharData[m_nFocusCharacter]->m_dwAttackCombo > 3)
|
||
m_lstCharData[m_nFocusCharacter]->m_dwAttackCombo = 0;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction = CA_WAIT;
|
||
m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction = CA_WAIT;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
bKeyAble = TRUE;
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bNoneComboAttackMode==TRUE)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_dwAttackCombo = 0;
|
||
}
|
||
}
|
||
else
|
||
m_lstCharData[m_nFocusCharacter]->m_dwAttackCombo = 0;
|
||
}
|
||
else
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_dwAttackCombo = 0;
|
||
}
|
||
}
|
||
|
||
|
||
if(!m_bClientUsed && CSceneManager::GetCharacterEvent(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, EVENT_HIT))
|
||
{
|
||
float fAttackRotation[4];
|
||
fAttackRotation[0]=-55.0f;
|
||
fAttackRotation[1]=30.0f;
|
||
fAttackRotation[2]=-10.0f;
|
||
fAttackRotation[3]=-10.0f;
|
||
|
||
float fAttackRate[4];
|
||
fAttackRate[0]=0.0f;
|
||
fAttackRate[1]=0.0f;
|
||
fAttackRate[2]=0.0f;
|
||
fAttackRate[3]=20.0f;
|
||
|
||
/* char *strWeapon;
|
||
|
||
if(GetMotionSheet)
|
||
{
|
||
strWeapon = GetMotionSheet(m_lstCharData[m_nFocusCharacter]->m_strShape[11 + m_lstCharData[m_nFocusCharacter]->m_dwWeaponPos]);
|
||
}
|
||
else
|
||
{
|
||
|
||
}
|
||
if(strcpy(strWeapon, "WEAPON_BOW") == 0)
|
||
{
|
||
vector3 vecChrPos;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecChrPos);
|
||
|
||
vecChrPos+=vector3(0.0f,100.0f,0.0f);
|
||
CEffScript *pBowShotEff;
|
||
pBowShotEff=new CEffScript;
|
||
CSceneManager::AddEffectScript(pBowShotEff);
|
||
|
||
pBowShotEff->GetScriptData("point.esf");
|
||
pBowShotEff->SetStartPos(vecChrPos.x, vecChrPos.y,vecChrPos.y);
|
||
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
|
||
fChrDir = -fChrDir;
|
||
fChrDir -= FLOAT_PHI / 2.0f;
|
||
|
||
vector3 vecChrToward;
|
||
vecChrToward.x = cosf(fChrDir);
|
||
vecChrToward.z = sinf(fChrDir);
|
||
vecChrToward.y = 0.0f;
|
||
vecChrToward.Normalize();
|
||
|
||
pBowShotEff->SetEndPos(vecChrPos.x+vecChrToward.x*1000.0f, vecChrPos.y,vecChrPos.z+vecChrToward.z*1000.0f);
|
||
|
||
pBowShotEff->SetChrFwd(-vecChrToward.x, -vecChrToward.y, -vecChrToward.z);
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
if(MakeAttackInfo(fAttackRotation[m_lstCharData[m_nFocusCharacter]->m_dwAttackCombo],
|
||
fAttackRate[m_lstCharData[m_nFocusCharacter]->m_dwAttackCombo]))
|
||
{
|
||
m_bAttackSuc=true;
|
||
|
||
} else
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_dwAttackCombo = 0;
|
||
m_bAttackSuc=false;
|
||
}
|
||
}
|
||
*/
|
||
// }
|
||
|
||
CheckAttackedTiming();
|
||
CheckCameraShakeTiming();
|
||
|
||
BOOL bInit = TRUE;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bFlying)
|
||
{
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
int nJump = CSceneManager::GetCharacterEvent(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, EVENT_JUMP);
|
||
|
||
if(nJump && m_lstCharData[m_nFocusCharacter]->m_bFlyFirstCheck==FALSE) // <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_bFlyFirstCheck=TRUE;
|
||
}
|
||
|
||
if(CT == CT_NONE)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = TRUE;
|
||
|
||
bInit = FALSE;
|
||
} else if(CT == CT_TERRAIN || CT == CT_BOTTOM || CT == CT_WATER)
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bFlyFirstCheck)
|
||
{
|
||
|
||
//Jump <20><><EFBFBD><EFBFBD>sound//
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bFlying) {
|
||
if(CT != CT_WATER) //<2F><><EFBFBD><EFBFBD> <20>ƴҶ<C6B4>
|
||
PlaySound(200,m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
/////////////
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_bFlying=FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bFlyFirstCheck=FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_vecJumpAttackVector = vector3(0.0f, 0.0f, 0.0f);
|
||
CCameraControl::m_fJumpRate=0.01f;
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_JUMPATTACK2)
|
||
{
|
||
if(m_lpButtonNormal)
|
||
{
|
||
CSceneManager::m_EffectManager.DeleteInterfaceScript(m_lpButtonNormal);
|
||
m_lpButtonNormal = NULL;
|
||
m_bComboSuccess = FALSE;
|
||
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
test_script->SetInterfaceSet(true);
|
||
test_script->GetScriptData("inter_fasthit_button_4.esf");
|
||
CSceneManager::m_EffectManager.AddInterfaceScript(test_script);
|
||
}
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->m_wClass == 2 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_wClass == 7 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_wClass == 24) // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
{
|
||
if(!KeyPressed(VK_SPACE))
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(CA_LAND, CA_LAND);
|
||
WrapSendMovingPacket(CA_LAND, CA_LAND, m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
} else
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(CA_LAND, CA_LAND);
|
||
WrapSendMovingPacket(CA_LAND, CA_LAND, m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
} else if(m_lstCharData[m_nFocusCharacter]->m_wClass == 20)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(CA_JUMPATTACK3, CA_JUMPATTACK3);
|
||
WrapSendMovingPacket(CA_JUMPATTACK3, CA_JUMPATTACK3, m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if(bInit)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->InitChrAction();
|
||
if(ChangeWeapon) ChangeWeapon();
|
||
}
|
||
|
||
bool m_bKeyPress = false;
|
||
float fRunFactor = CFrameTimer::GetUpdateTimer(m_dwRunFactorTimer);
|
||
|
||
/*
|
||
CheckNode=CSceneManager::GetCharacterDataNode(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
if(CheckNode.m_DelayTimer>0)
|
||
{
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vector3(0.0f,0.0f,0.0f));
|
||
return;
|
||
}
|
||
*/
|
||
|
||
if(bKeyAble && !m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
{
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
bool bSpace = false;
|
||
|
||
CheckNode=CSceneManager::GetCharacterDataNode(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
// <20><>ų <20><><EFBFBD><EFBFBD>
|
||
unsigned long dwFunction;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bStillCasting && CheckStillCasting(dwFunction))
|
||
{
|
||
m_bKeyPress = true;
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->Casting())
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
|
||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// <20><>ų <20>ߵ<EFBFBD>
|
||
if(!m_bKeyPress && CT != CT_WATER && !m_lstCharData[m_nFocusCharacter]->m_bSitMode)
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
if(CheckSkillStart && CheckSkillStart(TRUE) &&
|
||
(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_LEFTDASH && m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_RIGHTDASH && m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_BACKDASH))
|
||
{
|
||
m_bKeyPress = true;
|
||
m_lstCharData[m_nFocusCharacter]->m_bStillCasting = TRUE;
|
||
|
||
// <20><> <20><>ų<EFBFBD><C5B3> <20>ν<EFBFBD><CEBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>ٷ<EFBFBD> <20>ߵ<EFBFBD> <20>ȴ<EFBFBD>.
|
||
m_dwStartSkillTick = timeGetTime();
|
||
m_dwCastingSkillTick = 0;
|
||
m_dwCastingSkillGrade = 0;
|
||
}
|
||
}
|
||
}
|
||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
||
if(!m_bKeyPress)
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(25) && !m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
if(KeyPressed('W') && KeyPressed('A'))
|
||
{
|
||
m_bKeyPress = true;
|
||
m_lstCharData[m_nFocusCharacter]->Run(fRunFactor);
|
||
|
||
vecChrToward = vecChrToward + vecChrLeft;
|
||
vecChrToward.Normalize();
|
||
m_lstCharData[m_nFocusCharacter]->m_fFixAngle = -FLOAT_PHI / 4.0f;
|
||
fAngle += -FLOAT_PHI / 4.0f;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fAngle);
|
||
} else if(KeyPressed('W') && KeyPressed('D'))
|
||
{
|
||
m_bKeyPress = true;
|
||
m_lstCharData[m_nFocusCharacter]->Run(fRunFactor);
|
||
vecChrToward = vecChrToward - vecChrLeft;
|
||
vecChrToward.Normalize();
|
||
m_lstCharData[m_nFocusCharacter]->m_fFixAngle = FLOAT_PHI / 4.0f;
|
||
fAngle += FLOAT_PHI / 4.0f;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fAngle);
|
||
} else if(KeyPressed('W'))
|
||
{
|
||
m_bKeyPress = true;
|
||
m_lstCharData[m_nFocusCharacter]->Run(fRunFactor);
|
||
}else if(KeyPressed('S') && KeyPressed('A'))
|
||
{
|
||
m_bKeyPress = true;
|
||
vecChrToward = vecChrToward - vecChrLeft;
|
||
vecChrToward.Normalize();
|
||
m_lstCharData[m_nFocusCharacter]->m_fFixAngle = FLOAT_PHI / 4.0f;
|
||
fAngle += FLOAT_PHI / 4.0f;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fAngle);
|
||
m_lstCharData[m_nFocusCharacter]->WalkBack();
|
||
}else if(KeyPressed('S') && KeyPressed('D'))
|
||
{
|
||
m_bKeyPress = true;
|
||
vecChrToward = vecChrToward + vecChrLeft;
|
||
vecChrToward.Normalize();
|
||
m_lstCharData[m_nFocusCharacter]->m_fFixAngle = -FLOAT_PHI / 4.0f;
|
||
fAngle += -FLOAT_PHI / 4.0f;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fAngle);
|
||
|
||
m_lstCharData[m_nFocusCharacter]->WalkBack();
|
||
}else if(KeyPressed('S'))
|
||
{
|
||
m_bKeyPress = true;
|
||
m_lstCharData[m_nFocusCharacter]->WalkBack();
|
||
} else if(KeyPressed('A'))
|
||
{
|
||
m_bKeyPress = true;
|
||
m_lstCharData[m_nFocusCharacter]->WalkLeft();
|
||
} else if(KeyPressed('D'))
|
||
{
|
||
m_bKeyPress = true;
|
||
m_lstCharData[m_nFocusCharacter]->WalkRight();
|
||
}
|
||
|
||
static bool bx = false;
|
||
static bool by = false;
|
||
static bool bz = false;
|
||
static bool bg = false;
|
||
|
||
/* if(KeyPressed('F')) {
|
||
|
||
if(bx == false) {
|
||
char tmp_char[50]={0};
|
||
strncpy(tmp_char,m_WCharMotion,49);
|
||
strcat(tmp_char,"1");
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(tmp_char,tmp_char);
|
||
bx = true;
|
||
}
|
||
else {
|
||
char tmp_char[50]={0};
|
||
strncpy(tmp_char,m_WCharMotion,49);
|
||
strcat(tmp_char,"2");
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(tmp_char,tmp_char);
|
||
|
||
}
|
||
if(m_Effect == NULL) {
|
||
m_Effect = new CEffScript;
|
||
CSceneManager::AddEffectScript(m_Effect);
|
||
m_Effect->GetScriptData("ready.esf");
|
||
|
||
CZ3DObject *snappoint = NULL;
|
||
float body_scale = 0.0f;
|
||
vector3 r_foot;
|
||
|
||
snappoint = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetSkeletonPartObject("L_HAND");
|
||
body_scale = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetScale();
|
||
|
||
if(snappoint != NULL) {
|
||
|
||
vector3 snaptm;
|
||
snappoint->GetPosition(snaptm);
|
||
|
||
r_foot.x = snaptm.x;
|
||
r_foot.y = snaptm.y;
|
||
r_foot.z = snaptm.z;
|
||
|
||
r_foot *= body_scale;
|
||
}
|
||
|
||
m_Effect->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x + r_foot.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y+ r_foot.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z+ r_foot.z);
|
||
m_Effect->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
m_Effect->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
m_Effect->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_fDirection;
|
||
fChrDir = -fChrDir;
|
||
fChrDir -= FLOAT_PHI / 2.0f;
|
||
|
||
vector3 vecChrToward;
|
||
vecChrToward.x = cosf(fChrDir);
|
||
vecChrToward.z = sinf(fChrDir);
|
||
vecChrToward.y = 0.0f;
|
||
vecChrToward.Normalize();
|
||
|
||
m_Effect->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
}
|
||
else {
|
||
CZ3DObject *snappoint = NULL;
|
||
float body_scale = 0.0f;
|
||
vector3 r_foot;
|
||
|
||
snappoint = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetSkeletonPartObject("L_HAND");
|
||
body_scale = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetScale();
|
||
|
||
if(snappoint != NULL) {
|
||
|
||
vector3 snaptm;
|
||
snappoint->GetPosition(snaptm);
|
||
|
||
r_foot.x = snaptm.x;
|
||
r_foot.y = snaptm.y;
|
||
r_foot.z = snaptm.z;
|
||
|
||
r_foot *= body_scale;
|
||
}
|
||
if(m_Effect != NULL) {
|
||
m_Effect->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x + r_foot.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y+ r_foot.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z+ r_foot.z);
|
||
|
||
m_Effect->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
m_Effect->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_fDirection;
|
||
fChrDir = -fChrDir;
|
||
fChrDir -= FLOAT_PHI / 2.0f;
|
||
|
||
vector3 vecChrToward;
|
||
vecChrToward.x = cosf(fChrDir);
|
||
vecChrToward.z = sinf(fChrDir);
|
||
vecChrToward.y = 0.0f;
|
||
vecChrToward.Normalize();
|
||
|
||
m_Effect->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
}
|
||
}
|
||
|
||
}
|
||
else {
|
||
if(bx == true) {
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
|
||
char tmp_char[50]={0};
|
||
strncpy(tmp_char,m_WCharMotion,49);
|
||
strcat(tmp_char,"3");
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(tmp_char,tmp_char);
|
||
CSceneManager::m_EffectManager.DeleteEndScript(m_Effect);
|
||
m_Effect = NULL;
|
||
if(strlen(m_TextEsf) >1) {
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
test_script->GetScriptData(m_TextEsf);
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
test_script->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
test_script->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
|
||
}
|
||
}
|
||
bx = false;
|
||
}*/
|
||
{
|
||
PROFILE("Effect Script FileLoad");
|
||
if(KeyPressed('G')) {
|
||
if(by == false) {
|
||
by = true;
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(m_WCharMotion,m_WCharMotion);
|
||
|
||
/*
|
||
if(g_CameraScript != NULL) {
|
||
matrix *matPos= CSceneManager::GetCamera()->GetMatPosition();
|
||
vector3 vecCameraToward = CSceneManager::GetCamera()->GetViewTowardVector();
|
||
vector3 vecCameraUp = CSceneManager::GetCamera()->GetViewUpVector();
|
||
|
||
D3DXVECTOR3 vecCameraSPos = D3DXVECTOR3(matPos->_41,matPos->_42,matPos->_43);
|
||
D3DXVECTOR3 vecCameraSLook = D3DXVECTOR3(vecCameraSPos.x + vecCameraToward.x * 50.0f,vecCameraSPos.y + vecCameraToward.y* 50.0f,vecCameraSPos.z + vecCameraToward.z* 50.0f);
|
||
D3DXVECTOR3 vecCameraSUp = D3DXVECTOR3(vecCameraUp.x,vecCameraUp.y,vecCameraUp.z);
|
||
|
||
g_CameraScript->InsertEvent(vecCameraSPos,vecCameraSLook,vecCameraSUp,0,1);
|
||
|
||
}*/
|
||
if(strlen(m_TextEsf) >1) {
|
||
//m_lstCharData[m_nFocusCharacter]->AddBodyEffect(m_TextEsf,(unsigned long)0,true,true);
|
||
//m_lstCharData[m_nFocusCharacter]->AddArrow("CHEST",D3DXQUATERNION(0.0f,0.0f,0.0f,1.0f),0);
|
||
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
((CEffScript *)CSceneManager::m_pEsfCasher->GetCashData(m_TextEsf))->Clone(test_script);
|
||
|
||
CSceneManager::AddEffectScript(test_script);
|
||
//hti & delete testing
|
||
//test_script->GetScriptBinData(m_TextEsf);
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
test_script->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
test_script->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
else {
|
||
by = false;
|
||
}
|
||
static CEffScript *test_script2 = NULL;
|
||
if(KeyPressed('H')) {
|
||
if(bz == false) {
|
||
bz = true;
|
||
CSceneManager::m_bCharacterLightOp = (CSceneManager::m_bCharacterLightOp) ? false : true;
|
||
|
||
}
|
||
|
||
}
|
||
else {
|
||
bz = false;
|
||
}
|
||
if(KeyPressed('J')) {
|
||
if(bg == false) {
|
||
bg = true;
|
||
CSceneManager::m_EffectManager.DeleteAllEffectScript();
|
||
//m_lstCharData[m_nFocusCharacter]->DeleteBodyEffectName(m_TextEsf);
|
||
//m_lstCharData[m_nFocusCharacter]->DeleteArrow(0);
|
||
}
|
||
|
||
}
|
||
else {
|
||
bg = false;
|
||
}
|
||
|
||
}
|
||
|
||
static bool fasthit[6] = {0,0,0,0,0,0};
|
||
if(KeyPressed('1')) {
|
||
if(fasthit[0] == false) {
|
||
fasthit[0] = true;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetAction("OVER_BASH1","OVER_BASH1");
|
||
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
|
||
test_script->GetScriptData("A_FASTHIT1.esf");
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
test_script->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
test_script->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
|
||
|
||
}
|
||
|
||
}
|
||
else {
|
||
fasthit[0] = false;
|
||
}
|
||
if(KeyPressed('2')) {
|
||
if(fasthit[1] == false) {
|
||
fasthit[1] = true;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetAction("OVER_BASH2","OVER_BASH2");
|
||
|
||
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
|
||
test_script->GetScriptData("A_FASTHIT2.esf");
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
test_script->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
test_script->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
|
||
|
||
|
||
}
|
||
|
||
}
|
||
else {
|
||
fasthit[1] = false;
|
||
}
|
||
if(KeyPressed('3')) {
|
||
if(fasthit[2] == false) {
|
||
fasthit[2] = true;
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetAction("OVER_BASH3","OVER_BASH3");
|
||
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
|
||
test_script->GetScriptData("A_FASTHIT3.esf");
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
test_script->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
test_script->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
|
||
|
||
}
|
||
|
||
}
|
||
else {
|
||
fasthit[2] = false;
|
||
}
|
||
if(KeyPressed('4')) {
|
||
if(fasthit[3] == false) {
|
||
fasthit[3] = true;
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetAction("OVER_BASH4","OVER_BASH4");
|
||
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
|
||
test_script->GetScriptData("A_FASTHIT3.esf");
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
test_script->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
test_script->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
|
||
|
||
}
|
||
|
||
}
|
||
else {
|
||
fasthit[3] = false;
|
||
}
|
||
if(KeyPressed('5')) {
|
||
if(fasthit[5] == false) {
|
||
fasthit[5] = true;
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetAction("OVER_BASH5","OVER_BASH5");
|
||
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
|
||
test_script->GetScriptData("A_FASTHIT3.esf");
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
test_script->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
test_script->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
|
||
|
||
}
|
||
|
||
}
|
||
else {
|
||
fasthit[5] = false;
|
||
}
|
||
if(KeyPressed('X')) {
|
||
if(fasthit[4] == false) {
|
||
fasthit[4] = true;
|
||
if(strlen(m_TextEsfInterface) > 1) {
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
test_script->SetInterfaceSet(true);
|
||
|
||
test_script->GetScriptData(m_TextEsfInterface);
|
||
CSceneManager::m_EffectManager.AddInterfaceScript(test_script);
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
fasthit[4] = false;
|
||
}
|
||
|
||
// effect pos update
|
||
|
||
for(int ktt = 0 ;ktt <CSceneManager::m_EffectManager.GetScriptNum();ktt++) {
|
||
if(m_Effect != NULL) {
|
||
if(CSceneManager::m_EffectManager.m_lstScript[ktt] == m_Effect)
|
||
continue;
|
||
}
|
||
if(CSceneManager::m_EffectManager.m_lstScript[ktt] == NULL)
|
||
continue;
|
||
|
||
CSceneManager::m_EffectManager.m_lstScript[ktt]->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
CSceneManager::m_EffectManager.m_lstScript[ktt]->SetEndPos(m_lstCharData[1]->m_vecPos.x,m_lstCharData[1]->m_vecPos.y,m_lstCharData[1]->m_vecPos.z);
|
||
|
||
CSceneManager::m_EffectManager.m_lstScript[ktt]->SetPlayer(m_lstCharData[m_nFocusCharacter],m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
|
||
CSceneManager::m_EffectManager.m_lstScript[ktt]->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
CSceneManager::m_EffectManager.m_lstScript[ktt]->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
|
||
}
|
||
|
||
//
|
||
|
||
if(!CSceneManager::m_CollisionDetection.m_bHeightGradient && KeyPressed(VK_SPACE) && KeyPressed('A') && !bSpace && CT!=CT_WATER && CheckNode.m_DelayTimer==0)
|
||
{
|
||
m_bKeyPress = true;
|
||
bSpace=true;
|
||
if(m_lstCharData[m_nFocusCharacter]->Dash(0))
|
||
{
|
||
const char *strMotionSheet = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetCurrentMotionSheetName();
|
||
|
||
if(strMotionSheet &&
|
||
(!strcmp(strMotionSheet, "CLASS_ROGUE") || !strcmp(strMotionSheet, "WEAPON_SHADOW_OFF") ||
|
||
!strcmp(strMotionSheet, "WEAPON_2CLAW") || !strcmp(strMotionSheet, "WEAPON_2DA")))
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
vecChrLeft * (1365.0f / 4.0f) + m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
} else
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
vecChrLeft * (1050.0f / 4.0f) + m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
}
|
||
if(!CSceneManager::m_CollisionDetection.m_bHeightGradient && KeyPressed(VK_SPACE) && KeyPressed('D') && !bSpace && CT!=CT_WATER && CheckNode.m_DelayTimer==0)
|
||
{
|
||
m_bKeyPress = true;
|
||
bSpace=true;
|
||
if(m_lstCharData[m_nFocusCharacter]->Dash(1))
|
||
{
|
||
const char *strMotionSheet = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetCurrentMotionSheetName();
|
||
|
||
if(strMotionSheet &&
|
||
(!strcmp(strMotionSheet, "CLASS_ROGUE") || !strcmp(strMotionSheet, "WEAPON_SHADOW_OFF") ||
|
||
!strcmp(strMotionSheet, "WEAPON_2CLAW") || !strcmp(strMotionSheet, "WEAPON_2DA")))
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
vecChrLeft * -(1365.0f / 4.0f) + m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
} else
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
vecChrLeft * -(1050.0f / 4.0f) + m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
}
|
||
if(!CSceneManager::m_CollisionDetection.m_bHeightGradient && KeyPressed(VK_SPACE) && KeyPressed('S') && !bSpace && CT!=CT_WATER && CheckNode.m_DelayTimer==0)
|
||
{
|
||
const char *strMotionSheet = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetCurrentMotionSheetName();
|
||
|
||
if(strMotionSheet &&
|
||
(!strcmp(strMotionSheet, "CLASS_ROGUE") || !strcmp(strMotionSheet, "WEAPON_SHADOW_OFF") ||
|
||
!strcmp(strMotionSheet, "WEAPON_2CLAW") || !strcmp(strMotionSheet, "WEAPON_2DA")))
|
||
{
|
||
m_bKeyPress = true;
|
||
bSpace=true;
|
||
if(m_lstCharData[m_nFocusCharacter]->Dash(2))
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
vecChrToward * -(1365.0f / 4.0f) + m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
}
|
||
// if(g_DeviceInput.KeyHold(VK_SPACE) && !bSpace)// && CT!=CT_WATER)// && CheckNode.m_DelayTimer==0)
|
||
// if(KeyPressed(VK_SPACE) && !bSpace)// && CT!=CT_WATER)// && CheckNode.m_DelayTimer==0)
|
||
if(!CSceneManager::m_CollisionDetection.m_bHeightGradient && KeyPressed(VK_SPACE) && !bSpace && CT!=CT_WATER && CheckNode.m_DelayTimer==0)
|
||
{
|
||
if(CT!=CT_NONE && CT!=CT_CHRSIDE)
|
||
{
|
||
m_bKeyPress = true;
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->Jump())
|
||
{
|
||
if(g_DeviceInput.KeyHold('W'))
|
||
m_lstCharData[m_nFocusCharacter]->m_vecJumpAttackVector = vecChrToward * (m_fRunSpeed / 35.0f);
|
||
else if(g_DeviceInput.KeyHold('S'))
|
||
m_lstCharData[m_nFocusCharacter]->m_vecJumpAttackVector = vecChrToward * -(150.0f / 35.0f);
|
||
else
|
||
m_lstCharData[m_nFocusCharacter]->m_vecJumpAttackVector = vector3(0.0f, 0.0f, 0.0f);
|
||
}
|
||
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
//if(g_DeviceInput.GetIsLeftMousePress() && CT != CT_WATER)
|
||
if(m_bClientUsed==false && KeyPressed(VK_LBUTTON) && CT != CT_WATER)
|
||
{
|
||
m_bKeyPress = true;
|
||
|
||
// m_lstCharData[m_nFocusCharacter]->Attack();
|
||
if(m_lstCharData[m_nFocusCharacter]->Attack())
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
|
||
if(m_bClientUsed == true && m_bAttackable && g_DeviceInput.GetIsLeftMousePress() && CT != CT_WATER)
|
||
{
|
||
if(m_bAttackable)
|
||
{
|
||
m_bKeyPress = true;
|
||
m_bAttackResult = TRUE;
|
||
|
||
// m_lstCharData[m_nFocusCharacter]->Attack();
|
||
if(m_lstCharData[m_nFocusCharacter]->Attack())
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
} else
|
||
{
|
||
m_bAttackResult = FALSE;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->GetChantFlag(25) || m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
if(SetAutoRun) SetAutoRun(FALSE);
|
||
}
|
||
|
||
if(!m_bKeyPress)
|
||
{
|
||
PlayerProcessOperation(bKeyAble);
|
||
if(GetAutoRun && GetAutoRun())
|
||
{
|
||
m_bKeyPress = true;
|
||
m_lstCharData[m_nFocusCharacter]->Run(fRunFactor);
|
||
SetKillCounter(0);
|
||
}
|
||
} /*else
|
||
{
|
||
SetKillCounter(0);
|
||
if(SetAutoRun) SetAutoRun(FALSE);
|
||
}*/
|
||
|
||
// <20><>ų <20><><EFBFBD><EFBFBD>
|
||
unsigned long dwFunction;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bStillCasting && !CheckStillCasting(dwFunction))
|
||
{
|
||
m_bSkillExecuted = TRUE;
|
||
}
|
||
|
||
if(!m_bKeyPress)
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
}
|
||
}
|
||
|
||
if(!GetAttacking())
|
||
{
|
||
if(SetChangeWeapon) SetChangeWeapon(FALSE);
|
||
}
|
||
|
||
switch(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction)
|
||
{
|
||
case CA_WALK:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * (m_fWalkSpeed / 35.0f));
|
||
break;
|
||
|
||
case CA_FORWARDJUMP:
|
||
case CA_FRONTDASH:
|
||
case CA_RUN:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * (m_fRunSpeed/ 35.0f));
|
||
break;
|
||
|
||
case CA_WALKBACK:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * -(m_fWalkSpeed / 35.0f));
|
||
break;
|
||
|
||
case CA_BACKJUMP:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * -(150.0f / 35.0f));
|
||
break;
|
||
|
||
case CA_WALKLEFT:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrLeft * (m_fWalkSpeed / 35.0f));
|
||
break;
|
||
|
||
case CA_WALKRIGHT:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrLeft * -(m_fWalkSpeed / 35.0f));
|
||
break;
|
||
|
||
case CA_ATTACK2:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vector3(0.0f,0.0f,0.0f));
|
||
break;
|
||
case CA_ATTACK3:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vector3(0.0f,0.0f,0.0f));
|
||
break;
|
||
case CA_ATTACK4:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vector3(0.0f,0.0f,0.0f));
|
||
break;
|
||
case CA_ATTACK5:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vector3(0.0f,0.0f,0.0f));
|
||
break;
|
||
case CA_ATTACK6:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vector3(0.0f,0.0f,0.0f));
|
||
break;
|
||
|
||
case CA_JUMPATTACK2:
|
||
case CA_JUMPATTACK:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, m_lstCharData[m_nFocusCharacter]->m_vecJumpAttackVector);
|
||
break;
|
||
|
||
case CA_LEFTDASH:
|
||
{
|
||
const char *strMotionSheet = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetCurrentMotionSheetName();
|
||
|
||
if(strMotionSheet &&
|
||
(!strcmp(strMotionSheet, "CLASS_ROGUE") || !strcmp(strMotionSheet, "WEAPON_SHADOW_OFF") ||
|
||
!strcmp(strMotionSheet, "WEAPON_2CLAW") || !strcmp(strMotionSheet, "WEAPON_2DA")))
|
||
{
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrLeft * (1365.0f / 35.0f) ,-1.1f);
|
||
} else
|
||
{
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrLeft * (1050.0f / 35.0f) ,-1.1f);
|
||
}
|
||
}
|
||
break;
|
||
case CA_RIGHTDASH:
|
||
{
|
||
const char *strMotionSheet = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetCurrentMotionSheetName();
|
||
|
||
if(strMotionSheet &&
|
||
(!strcmp(strMotionSheet, "CLASS_ROGUE") || !strcmp(strMotionSheet, "WEAPON_SHADOW_OFF") ||
|
||
!strcmp(strMotionSheet, "WEAPON_2CLAW") || !strcmp(strMotionSheet, "WEAPON_2DA")))
|
||
{
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrLeft * -(1365.0f / 35.0f) ,-1.1f);
|
||
} else
|
||
{
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrLeft * -(1050.0f / 35.0f) ,-1.1f);
|
||
}
|
||
}
|
||
break;
|
||
case CA_BACKDASH:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * -(1365.0f / 35.0f) ,-1.1f);
|
||
break;
|
||
|
||
default:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vector3(0.0f, 0.0f, 0.0f));
|
||
break;
|
||
}
|
||
|
||
|
||
if(CFrameTimer::GetUpdateTimer(m_nCharMovingPacketTimerID) >= 1.0f)// && m_lstCharData[m_nFocusCharacter]->IsCancelAction(2))
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WALK ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_RUN ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WALKBACK ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WALKLEFT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WALKRIGHT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_REST ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WAIT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_FIRE1 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_FIRE2 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_SHOT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_JUMPSHOT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_FORWARDJUMP ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_BACKJUMP ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_JUMP ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_FRONTDASH ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_JUMPATTACK ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_JUMPATTACK2)
|
||
{
|
||
vecChrToward.Normalize();
|
||
vecChrLeft.Normalize();
|
||
|
||
vector3 vecMove;
|
||
switch(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction)
|
||
{
|
||
case CA_FORWARDJUMP:
|
||
case CA_FRONTDASH:
|
||
case CA_RUN:
|
||
vecMove = vecChrToward * (m_fRunSpeed / 4.0f);
|
||
break;
|
||
|
||
case CA_WALKBACK:
|
||
vecMove = vecChrToward * -(m_fWalkSpeed / 4.0f);
|
||
break;
|
||
|
||
case CA_WALKLEFT:
|
||
vecMove = vecChrLeft * (m_fWalkSpeed / 4.0f);
|
||
break;
|
||
|
||
case CA_WALKRIGHT:
|
||
vecMove = vecChrLeft * -(m_fWalkSpeed / 4.0f);
|
||
break;
|
||
|
||
case CA_WALK:
|
||
vecMove = vecChrToward * (m_fWalkSpeed / 4.0f);
|
||
break;
|
||
|
||
case CA_JUMPATTACK:
|
||
case CA_JUMPATTACK2:
|
||
vecMove = m_lstCharData[m_nFocusCharacter]->m_vecJumpAttackVector;
|
||
break;
|
||
|
||
case CA_BACKJUMP:
|
||
vecMove = vecChrToward * -(150.0f / 4.0f);
|
||
break;
|
||
|
||
default:
|
||
vecMove = vector3(0.0f, 0.0f, 0.0f);
|
||
break;
|
||
}
|
||
|
||
vecMove += m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
if(CT == CT_WATER)
|
||
{
|
||
WrapSendMovingPacket(CA_SWIM, CA_SWIM, m_lstCharData[m_nFocusCharacter]->m_fDirection, vecMove);
|
||
} else
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection, vecMove);
|
||
}
|
||
}
|
||
}
|
||
Z3DTOK TokEffect;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_lpChrModel->CheckEvent("EFFECT",&TokEffect))
|
||
{
|
||
const char* strEffectName = g_TokEventName.GetString(TokEffect);
|
||
m_lstCharData[m_nFocusCharacter]->m_dwTargetId = 340;
|
||
MonsterEffectProcess(m_nFocusCharacter,(char *)strEffectName,1);
|
||
|
||
}
|
||
|
||
}
|
||
|
||
unsigned long CCharacterControl::GetScreenPosChr(POINT &Point, int nMode, float fLength)
|
||
{
|
||
/* CSceneManager::PickMakeRay(Point.x, Point.y, BaseGraphicsLayer::m_lScreenSx, BaseGraphicsLayer::m_lScreenSy);
|
||
|
||
vector3 vecChrPos;
|
||
|
||
float fRad = 50.0f;
|
||
float fNearestInterval = 100.0f;
|
||
|
||
vector3 vecMousePos;
|
||
vecMousePos.x = Point.x;
|
||
vecMousePos.y = Point.y;
|
||
vecMousePos.z = 0.0f;
|
||
|
||
vector3 vecLens, vecResult;
|
||
vector3 vecViewPos = *CSceneManager::GetCamera()->GetPosition();
|
||
float fW;
|
||
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
vecChrPos = *m_lstCharData[cChr]->GetPosition();
|
||
vecChrPos.y += 100.0f;
|
||
|
||
if(BaseGraphicsLayer::TransformVector(vecChrPos, vecResult, fW))
|
||
{
|
||
if(vecResult.z < 0.0f || vecResult.z > 1.0f) continue;
|
||
|
||
vecLens = vecViewPos - vecChrPos;
|
||
float fInterCamera = vecLens.GetLens();
|
||
float fZRate = -(fInterCamera / 10000.0f) + 1;
|
||
vecResult.z = 0.0f;
|
||
vecLens = vecMousePos - vecResult;
|
||
|
||
if(vecLens.GetLens() <= fRad * fZRate)
|
||
{
|
||
CCreature *lpCreature = GetCreature(m_lstCharData[cChr]->m_dwChrID);
|
||
if(!lpCreature) return 0xFFFFFFFF;
|
||
|
||
if(m_dwMyChrID == lpCreature->m_dwChrID) continue;
|
||
|
||
unsigned dwResult = GetClientType(lpCreature->m_dwChrID);
|
||
/* switch(nMode)
|
||
{
|
||
case Skill::Target::MELEE:
|
||
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) continue;
|
||
break;
|
||
|
||
case Skill::Target::FRIEND:
|
||
if(dwResult != CT_PC || lpCreature->m_bCharDead) continue;
|
||
break;
|
||
|
||
case Skill::Target::ENEMY:
|
||
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) continue;
|
||
break;
|
||
|
||
case Skill::Target::DEAD_FRIEND:
|
||
if(dwResult != CT_PC || !lpCreature->m_bCharDead) continue;
|
||
break;
|
||
|
||
case Skill::Target::DEAD_ENEMY:
|
||
if(dwResult != CT_MONSTER || !lpCreature->m_bCharDead) continue;
|
||
break;
|
||
|
||
case Skill::Target::FRIEND_OBJECT:
|
||
if(dwResult != CT_PC || lpCreature->m_bCharDead) continue;
|
||
break;
|
||
|
||
case Skill::Target::ENEMY_OBJECT:
|
||
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) continue;
|
||
break;
|
||
|
||
case Skill::Target::PARTY:
|
||
return m_dwMyChrID;
|
||
|
||
case Skill::Target::FRIEND_EXCEPT_SELF:
|
||
if(dwResult != CT_PC || lpCreature->m_bCharDead || lpCreature->m_dwChrID == m_dwMyChrID) continue;
|
||
break;
|
||
|
||
case Skill::Target::LINE_ENEMY:
|
||
if(dwResult != CT_MONSTER || lpCreature->m_bCharDead) continue;
|
||
break;
|
||
|
||
case TARGET_SELECTCHAR:
|
||
return lpCreature->m_dwChrID;
|
||
|
||
default:
|
||
if(lpCreature->m_bCharDead) continue;
|
||
break;
|
||
}*/
|
||
|
||
/* vector3 vecPos = lpCreature->m_vecPos;
|
||
vecPos.y = 0.0f;
|
||
vector3 vecSelf = m_lstCharData[g_CharacterData.m_nFocusCharacter]->m_vecPos;
|
||
vecSelf.y = 0.0f;
|
||
vecSelf -= vecPos;
|
||
|
||
if(vecSelf.GetLens() <= fLength) return lpCreature->m_dwChrID;
|
||
}
|
||
}
|
||
}
|
||
/*
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
if(!m_lstCharData[cChr]->m_lpChrModel)
|
||
continue;
|
||
if(cChr == m_nFocusCharacter)
|
||
continue;
|
||
|
||
vector3 vecChrPos = m_lstCharData[cChr]->m_vecPos + vector3(0.0f, 150.0f, 0.0f);
|
||
if(BaseGraphicsLayer::TransformVector(vecChrPos, vecResult, w))
|
||
{
|
||
vecResult.z = 0.0f;
|
||
vecResult = vecResult - vecPoint;
|
||
if(vecResult.GetLens() < 150.0f)
|
||
{
|
||
if(nMode == TARGET_SELECTCHAR)
|
||
{
|
||
return m_lstCharData[cChr]->m_dwChrID;
|
||
} else
|
||
{
|
||
//if(m_nFocusCharacter!=0xffffffff)
|
||
{
|
||
vecNear = m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
|
||
if(vecNear.GetLens() < fLength)
|
||
{
|
||
vector3 vecEffPos=m_lstCharData[cChr]->m_vecPos;
|
||
vecEffPos.y+=20.0f;
|
||
// m_pCharacterSelectEff->SetStartPos(vecEffPos.x,vecEffPos.y,vecEffPos.z);
|
||
// m_pCharacterSelectEff->SetEndPos(vecEffPos.x,vecEffPos.y,vecEffPos.z);
|
||
|
||
return m_lstCharData[cChr]->m_dwChrID;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
*/
|
||
return 0xFFFFFFFF;
|
||
}
|
||
|
||
void CCharacterControl::MouseMove(int MouseX, int MouseY)
|
||
{
|
||
|
||
}
|
||
|
||
void CCharacterControl::Render(LPDIRECT3DDEVICE8 pd3dDevice)
|
||
{
|
||
WORD wIndices[12];
|
||
|
||
wIndices[0]=0;
|
||
wIndices[1]=1;
|
||
wIndices[2]=2;
|
||
|
||
wIndices[3]=1;
|
||
wIndices[4]=3;
|
||
wIndices[5]=2;
|
||
|
||
wIndices[6]=4;
|
||
wIndices[7]=5;
|
||
wIndices[8]=6;
|
||
|
||
wIndices[9]=5;
|
||
wIndices[10]=7;
|
||
wIndices[11]=6;
|
||
|
||
LVertex pVertex[8];
|
||
|
||
float ChrWidth=50.0f;
|
||
float ChrHeight=200.0f;
|
||
|
||
memset(pVertex,0,sizeof(LVertex)*8);
|
||
|
||
pVertex[0].v=vector3(-ChrWidth,ChrHeight,0.0f);
|
||
pVertex[0].tu=0.0f;
|
||
pVertex[0].tv=0.0f;
|
||
|
||
pVertex[1].v=vector3(-ChrWidth,0.0f,0.0f);
|
||
pVertex[1].tu=0.0f;
|
||
pVertex[1].tv=1.0f;
|
||
|
||
pVertex[2].v=vector3(ChrWidth,ChrHeight,0.0f);
|
||
pVertex[2].tu=1.0f;
|
||
pVertex[2].tv=0.0f;
|
||
|
||
pVertex[3].v=vector3(ChrWidth,0.0f,0.0f);
|
||
pVertex[3].tu=1.0f;
|
||
pVertex[3].tv=1.0f;
|
||
|
||
|
||
|
||
pVertex[4].v=vector3(0.0f,ChrHeight,-ChrWidth);
|
||
pVertex[4].tu=0.0f;
|
||
pVertex[4].tv=0.0f;
|
||
|
||
pVertex[5].v=vector3(0.0f,0.0f,-ChrWidth);
|
||
pVertex[5].tu=0.0f;
|
||
pVertex[5].tv=1.0f;
|
||
|
||
pVertex[6].v=vector3(0.0f,ChrHeight,ChrWidth);
|
||
pVertex[6].tu=1.0f;
|
||
pVertex[6].tv=0.0f;
|
||
|
||
pVertex[7].v=vector3(0.0f,0.0f,ChrWidth);
|
||
pVertex[7].tu=1.0f;
|
||
pVertex[7].tv=1.0f;
|
||
|
||
pd3dDevice->SetVertexShader(LVERTEXFVF);
|
||
|
||
matrix matChrPos;
|
||
|
||
CSceneStateMgr::_SetD3DRenderState(D3DRS_CULLMODE,D3DCULL_NONE);
|
||
|
||
CSceneStateMgr::_SetD3DTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
|
||
CSceneStateMgr::_SetD3DTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||
CSceneStateMgr::_SetD3DTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
|
||
|
||
CSceneStateMgr::_SetD3DTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||
|
||
CSceneStateMgr::_SetD3DTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
|
||
CSceneStateMgr::_SetD3DTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||
CSceneStateMgr::_SetD3DTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
|
||
|
||
pd3dDevice->SetTexture(0,NULL);
|
||
pd3dDevice->SetTexture(1,NULL);
|
||
|
||
CSceneStateMgr::_SetD3DRenderState( D3DRS_ALPHABLENDENABLE,TRUE);
|
||
CSceneStateMgr::_SetD3DRenderState( D3DRS_ALPHATESTENABLE,TRUE);
|
||
|
||
CSceneStateMgr::_SetD3DRenderState( D3DRS_FOGENABLE,FALSE);
|
||
CSceneStateMgr::_SetD3DRenderState( D3DRS_ZENABLE,D3DZB_TRUE);
|
||
CSceneStateMgr::_SetD3DRenderState( D3DRS_ZWRITEENABLE,TRUE);
|
||
|
||
|
||
|
||
for(int cChr=0;cChr<m_lstCharData.num;cChr++)
|
||
{
|
||
if(!m_lstCharData[cChr]->m_lpChrModel && GetClientType(m_lstCharData[cChr]->m_dwChrID)==CT_PC)
|
||
{
|
||
|
||
matChrPos.YRotation(m_lstCharData[cChr]->GetDirection());
|
||
//matChrPos.Translation(m_lstCharData[cChr]->m_vecPos);
|
||
matChrPos._41=m_lstCharData[cChr]->m_vecPos.x;
|
||
matChrPos._42=m_lstCharData[cChr]->m_vecPos.y;
|
||
matChrPos._43=m_lstCharData[cChr]->m_vecPos.z;
|
||
|
||
pd3dDevice->SetTransform(D3DTS_WORLD,matChrPos);
|
||
|
||
pd3dDevice->SetTexture(0,m_SimpleHumanTexture[0]->GetTexture());
|
||
CSceneStateMgr::_SetD3DRenderState(D3DRS_CULLMODE,D3DCULL_CCW);
|
||
pd3dDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST,0,8,2,wIndices,D3DFMT_INDEX16,pVertex,sizeof(LVertex));
|
||
pd3dDevice->SetTexture(0,m_SimpleHumanTexture[1]->GetTexture());
|
||
CSceneStateMgr::_SetD3DRenderState(D3DRS_CULLMODE,D3DCULL_CW);
|
||
pd3dDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST,0,8,2,wIndices,D3DFMT_INDEX16,pVertex,sizeof(LVertex));
|
||
|
||
pd3dDevice->SetTexture(0,m_SimpleHumanTexture[2]->GetTexture());
|
||
CSceneStateMgr::_SetD3DRenderState(D3DRS_CULLMODE,D3DCULL_CCW);
|
||
pd3dDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST,0,8,2,wIndices+6,D3DFMT_INDEX16,pVertex,sizeof(LVertex));
|
||
pd3dDevice->SetTexture(0,m_SimpleHumanTexture[3]->GetTexture());
|
||
CSceneStateMgr::_SetD3DRenderState(D3DRS_CULLMODE,D3DCULL_CW);
|
||
pd3dDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST,0,8,2,wIndices+6,D3DFMT_INDEX16,pVertex,sizeof(LVertex));
|
||
|
||
}
|
||
}
|
||
CSceneStateMgr::_SetD3DRenderState(D3DRS_CULLMODE,D3DCULL_CCW);
|
||
CSceneStateMgr::_SetD3DRenderState( D3DRS_ZENABLE,D3DZB_FALSE);
|
||
CSceneStateMgr::_SetD3DRenderState( D3DRS_ZWRITEENABLE,FALSE);
|
||
}
|
||
|
||
CZ3DGeneralChrModel* CCharacterControl::AllocCharacter(char *strGCMDSName, char *strFaceType, char *strHairStyle, int nChrID, char strShape[15][256])
|
||
{
|
||
for(int cChr = 0; cChr < m_ChrCashList.num; cChr++)
|
||
{
|
||
if(m_ChrCashList[cChr].m_nUsedChrID == -1)
|
||
{
|
||
if(strcmp(m_ChrCashList[cChr].m_strGCMDSName, strGCMDSName) == 0)
|
||
{
|
||
m_ChrCashList[cChr].m_nUsedChrID = nChrID;
|
||
CCharacterLightShadowManager::CCharacterDataNode CheckNode;
|
||
|
||
CheckNode=CSceneManager::GetCharacterDataNode(m_ChrCashList[cChr].m_lpChrModel);
|
||
CheckNode.m_bRender=true;
|
||
CSceneManager::SetCharacterDataNode(CheckNode);
|
||
CSceneManager::CharacterMovementVector(m_ChrCashList[cChr].m_lpChrModel, vector3(0.0f, 0.0f, 0.0f));
|
||
return m_ChrCashList[cChr].m_lpChrModel;
|
||
}
|
||
}
|
||
}
|
||
|
||
if(m_ChrCashList.num >= MAXCHRLOAD)
|
||
{
|
||
for(cChr = 0; cChr < m_ChrCashList.num; cChr++)
|
||
{
|
||
if(m_ChrCashList[cChr].m_nUsedChrID == -1)
|
||
{
|
||
CSceneManager::DeleteCharacter(m_ChrCashList[cChr].m_lpChrModel);
|
||
m_ChrCashList[cChr].m_lpChrModel = NULL;
|
||
m_ChrCashList.DelIndex(cChr);
|
||
break;
|
||
}
|
||
}
|
||
} /**/
|
||
|
||
CZ3DGeneralChrModel *pAddChrmodel = CSceneManager::AddCharacter(strGCMDSName, strFaceType, strHairStyle);
|
||
ChrCashNode AddCashNode;
|
||
strcpy(AddCashNode.m_strGCMDSName, strGCMDSName);
|
||
AddCashNode.m_nUsedChrID = nChrID;
|
||
AddCashNode.m_lpChrModel = pAddChrmodel;
|
||
if(pAddChrmodel)
|
||
{
|
||
SetShape(pAddChrmodel, strShape);
|
||
pAddChrmodel->SetAnimationSpeed(1.0f);
|
||
CSceneManager::CharacterMovementVector(pAddChrmodel, vector3(0.0f, 0.0f, 0.0f));
|
||
}
|
||
m_ChrCashList.Add(AddCashNode);
|
||
|
||
return pAddChrmodel;
|
||
}
|
||
|
||
void CCharacterControl::SetShape(CZ3DGeneralChrModel *pChrmodel, char strShape[15][256])
|
||
{
|
||
if(pChrmodel==NULL)
|
||
return;
|
||
pChrmodel->BeginOutfitSetting();
|
||
pChrmodel->SetOutfitSlot("HEAD", strShape[0]);
|
||
|
||
pChrmodel->SetOutfitSlot("BODY", strShape[1]);
|
||
pChrmodel->SetOutfitSlot("BODY", strShape[2]);
|
||
pChrmodel->SetOutfitSlot("BODY", strShape[3]);
|
||
|
||
pChrmodel->SetOutfitSlot("HAND", strShape[4]);
|
||
pChrmodel->SetOutfitSlot("FOOT", strShape[5]);/**/
|
||
|
||
pChrmodel->SetAttachmentSlot("SHIELD", strShape[9]);
|
||
pChrmodel->SetAttachmentSlot("WEAPON", strShape[11]);
|
||
|
||
// pChrmodel->SetAttachmentSlot("WEAPON", strShape[6]);
|
||
// pChrmodel->SetAttachmentSlot("SHIELD", strShape[7]);
|
||
|
||
pChrmodel->EndOutfitSetting();
|
||
}
|
||
|
||
/*void CCharacterControl::SetAction(int nActionType, int nAction)
|
||
{
|
||
switch(nActionType)
|
||
{
|
||
case 1:
|
||
m_lstCharData[m_nFocusCharacter].m_dwUpperChrAction=nAction;
|
||
break;
|
||
case 2:
|
||
m_lstCharData[m_nFocusCharacter].m_dwLowerChrAction=nAction;
|
||
break;
|
||
case 3:
|
||
m_lstCharData[m_nFocusCharacter].m_dwUpperChrAction=nAction;
|
||
m_lstCharData[m_nFocusCharacter].m_dwLowerChrAction=nAction;
|
||
break;
|
||
}
|
||
}*/
|
||
|
||
void CCharacterControl::MakeShake(int nChrID)
|
||
{
|
||
|
||
}
|
||
|
||
|
||
bool LineArcIntersection(vector3 vecPlaneNormal,vector3 vecPlaneOrigin,vector3 vecOrigin,vector3 vecNormal,float fAngleArc,float fRad)
|
||
{
|
||
float fD=CIntersection::PointFromPlane(vecPlaneNormal,vecPlaneOrigin,vecOrigin);
|
||
|
||
float fAngleTheta=acos(fD/fRad);
|
||
float fAngleInter=vecPlaneNormal*vecNormal;
|
||
|
||
if( (fAngleTheta+fAngleArc) > fAngleInter)
|
||
return true;
|
||
return false;
|
||
|
||
}
|
||
|
||
bool BoxIn(vector3 vecPos,vector3 vecMax,vector3 vecMin,float fRad)
|
||
{
|
||
if( vecMin.x <= vecPos.x &&
|
||
|
||
vecMin.z <= vecPos.z &&
|
||
vecMax.x >= vecPos.x &&
|
||
|
||
vecMax.z >= vecPos.z )
|
||
{
|
||
return true;
|
||
}
|
||
return false;
|
||
|
||
}
|
||
bool BoxOut(vector3 vecPos,vector3 vecMax,vector3 vecMin,float fRad)
|
||
{
|
||
if( vecMax.x+fRad <= vecPos.x ||
|
||
|
||
vecMax.z+fRad <= vecPos.z ||
|
||
|
||
vecMin.x-fRad >= vecPos.x ||
|
||
|
||
vecMin.z-fRad >= vecPos.z )
|
||
{
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
|
||
bool CylinderOBBIntersection(vector3 vecPos,vector3 vecDir,float fArcAngle,vector3 vecMax,vector3 vecMin,float fRad)
|
||
{
|
||
if(BoxIn(vecPos,vecMax,vecMin,fRad))
|
||
{
|
||
return true;
|
||
}
|
||
else if(BoxOut(vecPos,vecMax,vecMin,fRad))
|
||
{
|
||
return false;
|
||
}
|
||
|
||
if(LineArcIntersection(vector3(0.0f,0.0f,-1.0f),vecMax,vecPos,vecDir,fArcAngle,fRad))
|
||
return true;
|
||
if(LineArcIntersection(vector3(0.0f,0.0f,1.0f),vecMin,vecPos,vecDir,fArcAngle,fRad))
|
||
return true;
|
||
if(LineArcIntersection(vector3(1.0f,0.0f,0.0f),vecMin,vecPos,vecDir,fArcAngle,fRad))
|
||
return true;
|
||
if(LineArcIntersection(vector3(-1.0f,0.0f,0.0f),vecMax,vecPos,vecDir,fArcAngle,fRad))
|
||
return true;
|
||
return false;
|
||
}
|
||
|
||
bool CCharacterControl::MakeAttackInfo(unsigned short wSkill, unsigned char cSkillLock, unsigned char cSkillLevel, unsigned char cAtCount, float fAttackAngle, float fAttackRate, BOOL bAngle)
|
||
{
|
||
vector3 vecSelfDir,vecEnemyDir;
|
||
float fAngle = (-m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection()) - FLOAT_PHI / 2.0f;
|
||
float fEnemyDirection;
|
||
vecSelfDir.x = cosf(fAngle);
|
||
vecSelfDir.y = 0.0f;
|
||
vecSelfDir.z = sinf(fAngle);
|
||
|
||
vector3 vecLens;
|
||
float fInterLens;
|
||
|
||
matrix matSelfChrPos;
|
||
matSelfChrPos.MakeIdent();
|
||
matSelfChrPos._41 = m_lstCharData[m_nFocusCharacter]->m_vecPos.x;
|
||
matSelfChrPos._43 = m_lstCharData[m_nFocusCharacter]->m_vecPos.z;
|
||
|
||
vector3 vecFirstAttackPos;
|
||
|
||
unsigned long dwDefenser[10];
|
||
ZeroMemory(&dwDefenser, sizeof(unsigned long) * 10);
|
||
int nAttackCount = 0;
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
if(cChr == m_nFocusCharacter) continue;
|
||
if(!m_lstCharData[cChr]->m_lpChrModel) continue;
|
||
if(m_lstCharData[cChr]->m_bCharDead) continue;
|
||
|
||
if(GetClientType(m_lstCharData[cChr]->m_dwChrID) == CT_NPC || GetClientType(m_lstCharData[cChr]->m_dwChrID, TRUE) == CT_PC)
|
||
continue;
|
||
|
||
// if(m_lstCharData[cChr].m_bUsed==false) continue;
|
||
|
||
vecLens = m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecLens.y = 0.0f;
|
||
fInterLens = vecLens.GetLens();
|
||
|
||
if(fInterLens <= 200.0f)
|
||
{
|
||
float fEnemyAngle = m_lstCharData[cChr]->m_lpChrModel->GetDirection() - FLOAT_PHI;
|
||
vector3 vecDir;
|
||
vecDir.x = cosf(fEnemyAngle);
|
||
vecDir.z = sinf(fEnemyAngle);
|
||
vecDir.y = 0.0f;
|
||
|
||
vecDir.x = cosf(fAngle);
|
||
vecDir.z = sinf(fAngle);
|
||
vecDir.y = 0.0f;
|
||
|
||
matrix matDirChr;
|
||
matDirChr = matSelfChrPos;
|
||
matDirChr._41 += vecDir.x;
|
||
matDirChr._43 += vecDir.z;
|
||
|
||
matrix matPos, matInv, matResult;
|
||
matPos.YRotation(fEnemyAngle);
|
||
matPos._41 = m_lstCharData[cChr]->m_vecPos.x;
|
||
matPos._43 = m_lstCharData[cChr]->m_vecPos.z;
|
||
|
||
matInv.Inverse(matPos);
|
||
matResult = matSelfChrPos * matInv;
|
||
matDirChr = matDirChr * matInv;
|
||
|
||
vecDir = matDirChr.GetLoc() - matResult.GetLoc();
|
||
|
||
vector3 vecMin = vector3(-35.0f, 0.0f, -55.0f);
|
||
vector3 vecMax = vector3(35.0f, 0.0f, 65.0f);
|
||
|
||
if(GetMonsterMinBox) vecMin = GetMonsterMinBox(m_lstCharData[cChr]->m_dwChrID);
|
||
if(GetMonsterMaxBox) vecMax = GetMonsterMaxBox(m_lstCharData[cChr]->m_dwChrID);
|
||
|
||
if(!bAngle || (bAngle && CylinderOBBIntersection(matResult.GetLoc(), vecDir, FLOAT_PHI / 3.0f, vecMax, vecMin, 200.0f)))
|
||
{
|
||
//fEnemyDirection=(-m_lstCharData[cChr]->m_lpChrModel->GetDirection()) - FLOAT_PHI / 2.0f;
|
||
|
||
if(nAttackCount==0)
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->GetPosition(vecFirstAttackPos);
|
||
}
|
||
|
||
vecEnemyDir=vecLens.Normalized();
|
||
|
||
float fInterAngle=vecEnemyDir*vecSelfDir;
|
||
|
||
fInterAngle=acosf(fInterAngle);
|
||
|
||
if(bAngle && fInterAngle > FLOAT_PHI/3.0f)
|
||
continue;
|
||
|
||
float fAttackActionRate=rand()%6;
|
||
fAttackActionRate+=0.3f;
|
||
fAttackActionRate*=0.1f;
|
||
|
||
if(fAttackActionRate > 0.5f) fAttackActionRate = 0.5f;
|
||
// fAttackActionRate = 0.9f;
|
||
if(m_lstCharData[cChr]->m_lpChrModel->IsAddonActionFinished(1))
|
||
m_lstCharData[cChr]->m_lpChrModel->AddMotion("ATTACKED", 3, fAttackActionRate);
|
||
|
||
CSceneManager::CharacterRandomPos(m_lstCharData[cChr]->m_lpChrModel, 10, vecSelfDir * 50.0f);
|
||
|
||
vector3 vecTargetLightPos=m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecTargetLightPos.Normalize();
|
||
vecTargetLightPos=m_lstCharData[m_nFocusCharacter]->m_vecPos+vecTargetLightPos*60.0f;
|
||
CSceneManager::AddChrLight(m_lstCharData[cChr]->m_lpChrModel, vecTargetLightPos+ vector3(0.0f, 100.0f, 0.0f), 0xffff2200, 400.0f, 6);
|
||
|
||
vector3 vecEffectPos=vecTargetLightPos+vector3(0.0f, 120.0f, 0.0f);
|
||
/* CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
|
||
test_script->GetScriptData("c:\\roundswing.esf");
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter].m_vecPos.x,m_lstCharData[m_nFocusCharacter].m_vecPos.y,m_lstCharData[m_nFocusCharacter].m_vecPos.z);
|
||
// test_script->SetEndPos((D3DXVECTOR3 *)&(m_lstCharData[cChr].m_vecPos),1);
|
||
|
||
CSceneManager::AddEffectScript(test_script);
|
||
*/
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
if(fAttackRate>=1.0f || m_SkillAttackValue) {
|
||
test_script->GetScriptData("attack2.esf");
|
||
}
|
||
else {
|
||
test_script->GetScriptData("attack1.esf");
|
||
}
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
//particle
|
||
CX3DEffect *pEffect;
|
||
pEffect=new CX3DEffect;
|
||
CSceneManager::AddEffect(pEffect);
|
||
if(fAttackRate>=1.0f || m_SkillAttackValue)
|
||
{
|
||
pEffect->Load(EFFECTPATH,"attack2_particle.eff");
|
||
if(m_SkillAttackValue >0)
|
||
m_SkillAttackValue--;
|
||
}
|
||
else
|
||
{
|
||
pEffect->Load(EFFECTPATH,"attack1_particle.eff");
|
||
}
|
||
pEffect->SetLoop(FALSE);
|
||
|
||
pEffect->SetAxis(0.0f,-((180.0f*fAngle)/3.14159f)+90.0f+fAttackAngle,0.0f);
|
||
|
||
pEffect->SetCenter(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
|
||
dwDefenser[nAttackCount++] = m_lstCharData[cChr]->m_dwChrID;
|
||
if(nAttackCount >= 10) break;
|
||
}
|
||
}
|
||
}
|
||
/*
|
||
|
||
CEffScript *pRespawnEff;
|
||
pRespawnEff=new CEffScript;
|
||
CSceneManager::AddEffectScript(pRespawnEff);
|
||
|
||
char strEffect[256];
|
||
sprintf(strEffect,"%s\\respawn.esf",EFFECTPATH);
|
||
|
||
pRespawnEff->GetScriptData(strEffect);
|
||
pRespawnEff->SetStartPos(m_lstCharData[0]->m_vecPos.x,m_lstCharData[0]->m_vecPos.y,m_lstCharData[0]->m_vecPos.z);
|
||
|
||
pRespawnEff->SetEndPos((D3DXVECTOR3 *)&(m_lstCharData[0]->m_vecPos),1);
|
||
*/
|
||
|
||
|
||
if(nAttackCount > 0 || wSkill & 0x8000)
|
||
{
|
||
//CNetwork::SendCharAttack(m_lstCharData[m_nFocusCharacter].m_vecPos, m_lstCharData[m_nFocusCharacter].m_fDirection - FLOAT_PHI / 2.0f, 0, a, &AtList);
|
||
//AtNode AtList;
|
||
//memcpy(&AtList.m_dwDefenser[0], &dwDefenser[0], sizeof(unsigned long) * 10);
|
||
PlaySound(wSkill, vecFirstAttackPos);
|
||
WrapSendCharAttack(m_lstCharData[m_nFocusCharacter]->m_vecPos,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection - FLOAT_PHI / 2.0f,
|
||
wSkill, cSkillLock, cSkillLevel, cAtCount, nAttackCount, dwDefenser);
|
||
return true;
|
||
}
|
||
return false;
|
||
|
||
/* vector3 vecSelfDir;
|
||
float fAngle=-m_lstCharData[0].m_lpChrModel->GetDirection()-3.14169f/2.0f;
|
||
vecSelfDir.x=cosf(fAngle);
|
||
vecSelfDir.z=sinf(fAngle);
|
||
vecSelfDir.y=0.0f;
|
||
|
||
vector3 vecLens;
|
||
float fInterLens;
|
||
|
||
matrix matSelfChrPos;
|
||
matSelfChrPos.MakeIdent();
|
||
matSelfChrPos._41=m_lstCharData[0].m_vecPos.x;
|
||
matSelfChrPos._43=m_lstCharData[0].m_vecPos.z;
|
||
|
||
bool bAttacked=false;
|
||
|
||
for(int cChr=1;cChr<m_lstCharData.num;cChr++)
|
||
{
|
||
if(!m_lstCharData[cChr].m_lpChrModel)
|
||
continue;
|
||
|
||
vecLens=m_lstCharData[cChr].m_vecPos-m_lstCharData[0].m_vecPos;
|
||
vecLens.y=0.0f;
|
||
fInterLens=vecLens.GetLens();
|
||
|
||
if(fInterLens<=1300.0f)
|
||
{
|
||
float fEnemyAngle=m_lstCharData[cChr].m_lpChrModel->GetDirection()-3.14169f;
|
||
vector3 vecDir;
|
||
vecDir.x=cosf(fEnemyAngle);
|
||
vecDir.z=sinf(fEnemyAngle);
|
||
vecDir.y=0.0f;
|
||
|
||
vecDir.x=cosf(fAngle);
|
||
vecDir.z=sinf(fAngle);
|
||
vecDir.y=0.0f;
|
||
|
||
matrix matDirChr;
|
||
matDirChr=matSelfChrPos;
|
||
matDirChr._41+=vecDir.x;
|
||
matDirChr._43+=vecDir.z;
|
||
|
||
matrix matPos,matInv,matResult;
|
||
matPos.YRotation(fEnemyAngle);
|
||
matPos._41=m_lstCharData[cChr].m_vecPos.x;
|
||
matPos._43=m_lstCharData[cChr].m_vecPos.z;
|
||
|
||
matInv.Inverse(matPos);
|
||
matResult=matSelfChrPos*matInv;
|
||
matDirChr=matDirChr*matInv;
|
||
|
||
vecDir=matDirChr.GetLoc()-matResult.GetLoc();
|
||
|
||
vector3 vecMin=vector3(-20.0f,0.0f,-20.0f);
|
||
vector3 vecMax=vector3(20.0f,0.0f,20.0f);
|
||
/*
|
||
|
||
vector3 vecMin=CGameData::m_DataTable.vecMonsterMinBox[GetMonsterKind(m_CharDataSetList[cChr]->m_dwChrID)];
|
||
vector3 vecMax=CGameData::m_DataTable.vecMonsterMaxBox[GetMonsterKind(m_CharDataSetList[cChr]->m_dwChrID)];
|
||
*/
|
||
/*
|
||
if(CylinderOBBIntersection(matResult.GetLoc(),vecDir,3.14159f/3.0f,vecMax,vecMin,200.0f))
|
||
{
|
||
float fEnemyAngle=-m_lstCharData[cChr].m_lpChrModel->GetDirection()-3.14169f/2.0f;
|
||
vector3 vecEnemyDir;
|
||
vecEnemyDir.x=cosf(fEnemyAngle);
|
||
vecEnemyDir.z=sinf(fEnemyAngle);
|
||
vecEnemyDir.y=0.0f;
|
||
|
||
vector3 vecEnemyPos;
|
||
m_lstCharData[cChr].m_lpChrModel->GetPosition(vecEnemyPos);
|
||
vecEnemyPos+=vecEnemyDir*100.0f;
|
||
|
||
CSceneManager::CharacterRandomPos(m_lstCharData[cChr].m_lpChrModel,10,vecSelfDir*50.0f);
|
||
CSceneManager::AddChrLight(m_lstCharData[cChr].m_lpChrModel,vecEnemyPos+vector3(0.0f,100.0f,0.0f),0xffff4444,400.0f,6);
|
||
CSceneManager::AddChrLight(m_lstCharData[0].m_lpChrModel,vecSelfDir+vector3(0.0f,100.0f,0.0f),0xffff6666,400.0f,6);
|
||
|
||
m_lstCharData[cChr].m_lpChrModel->SetMotion("ATTACKED");
|
||
bAttacked=true;
|
||
}
|
||
}
|
||
}
|
||
return bAttacked;*/
|
||
}
|
||
|
||
void CCharacterControl::SetCamera(int dx, int dy, int dz)
|
||
{
|
||
// ī<><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
if(m_nCameraAnimation!=0)
|
||
{
|
||
//ī<><EFBFBD> <20>ִϸ<D6B4><CFB8>̼<EFBFBD><CCBC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>׳<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ
|
||
|
||
return;
|
||
}
|
||
// m_MouseClickMode<64><65> 1<>϶<EFBFBD><CFB6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if(m_bClientUsed)
|
||
{
|
||
dx=-dx;
|
||
dy=-dy;
|
||
if(dx)
|
||
{
|
||
if(m_MouseClickMode == 1)
|
||
{
|
||
if(KeyPressed(VK_MBUTTON))
|
||
{
|
||
m_Camera.m_fCameraRotX += (-dx) / 300.0f;
|
||
} else
|
||
{
|
||
float fMoveDir = dx / 300.0f;
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
m_Camera.m_fCameraRotX -= fMoveDir;
|
||
fChrDir += fMoveDir;
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fChrDir);
|
||
}
|
||
} else
|
||
{
|
||
m_Camera.m_fCameraRotX += (-dx) / 300.0f;
|
||
}
|
||
/* if(m_MouseClickMode == 0)
|
||
{
|
||
m_Camera.m_fCameraRotX += (-dx) / 300.0f;
|
||
}*/
|
||
}
|
||
|
||
if(dy)
|
||
{
|
||
if(m_MouseClickMode == 1)
|
||
{
|
||
m_Camera.m_fBattleCameraRotY += dy / 300.0f;
|
||
} else
|
||
{
|
||
m_Camera.m_fCameraRotY += dy / 300.0f;
|
||
}
|
||
}
|
||
|
||
if(dz)
|
||
{
|
||
if(m_MouseClickMode == 1)
|
||
{
|
||
m_Camera.m_fBattleInterCharacterCamera += dz * 20.0f;
|
||
if(m_Camera.m_fBattleInterCharacterCamera < 100.0f) m_Camera.m_fBattleInterCharacterCamera = 100.0f;
|
||
if(m_Camera.m_fBattleInterCharacterCamera > 1000.0f) m_Camera.m_fBattleInterCharacterCamera = 1000.0f;
|
||
} else
|
||
{
|
||
m_Camera.m_fMouseClickInterCharacterCamera += dz * 20.0f;
|
||
if(m_Camera.m_fMouseClickInterCharacterCamera < 100.0f) m_Camera.m_fMouseClickInterCharacterCamera = 100.0f;
|
||
if(m_Camera.m_fMouseClickInterCharacterCamera > 1000.0f) m_Camera.m_fMouseClickInterCharacterCamera = 1000.0f;
|
||
}
|
||
}
|
||
/* if(dx)
|
||
{
|
||
if(m_MouseClickMode == 1)
|
||
{
|
||
float fMoveDir = dx / 300.0f;
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter].m_lpChrModel->GetDirection();
|
||
m_Camera.m_fCameraRotX -= fMoveDir;
|
||
fChrDir += fMoveDir;
|
||
if(!m_lstCharData[m_nFocusCharacter].m_bCharDead)
|
||
m_lstCharData[m_nFocusCharacter].m_lpChrModel->SetDirection(fChrDir);
|
||
}
|
||
}
|
||
if(dy)
|
||
{
|
||
if(m_MouseClickMode == 1)
|
||
{
|
||
m_Camera.m_fBattleCameraRotY += dy / 300.0f;
|
||
}
|
||
}*/
|
||
} else/**/
|
||
{
|
||
if(dx)
|
||
{
|
||
if(m_MouseClickMode == 1)
|
||
{
|
||
if(KeyPressed(VK_MBUTTON))
|
||
{
|
||
m_Camera.m_fCameraRotX += (-dx) / 300.0f;
|
||
} else
|
||
{
|
||
float fMoveDir = dx / 300.0f;
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
m_Camera.m_fCameraRotX -= fMoveDir;
|
||
fChrDir += fMoveDir;
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fChrDir);
|
||
}
|
||
} else
|
||
{
|
||
m_Camera.m_fCameraRotX += (-dx) / 300.0f;
|
||
}
|
||
|
||
//m_Camera.m_fCameraRotX += (-dx) / 300.0f;
|
||
}
|
||
if(dy)
|
||
{
|
||
if(m_MouseClickMode==1)
|
||
{
|
||
m_Camera.m_fBattleCameraRotY += (-dy) / 300.0f;
|
||
}
|
||
else
|
||
{
|
||
m_Camera.m_fCameraRotY += (-dy) / 300.0f;
|
||
}
|
||
}
|
||
//if(g_DeviceInput.m_lMMoveZ) m_Camera.m_fInterCharacterCamera += g_DeviceInput.m_lMMoveZ * 10.0f;
|
||
|
||
if(m_Camera.m_nCameraMode==0)
|
||
m_Camera.m_fBattleInterCharacterCamera += g_DeviceInput.m_lMMoveZ * 10.0f;
|
||
else
|
||
m_Camera.m_fMouseClickInterCharacterCamera += g_DeviceInput.m_lMMoveZ * 10.0f;
|
||
|
||
if(dx)
|
||
{
|
||
float fMoveDir = dx/ 300.0f;
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
//m_fCameraRotX -= fMoveDir;
|
||
fChrDir += fMoveDir;
|
||
if(m_MouseClickMode==1)
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fChrDir);
|
||
}
|
||
}
|
||
/*
|
||
if(dy)
|
||
{
|
||
m_Camera.m_fCameraRotY += (-dy) / 300.0f;
|
||
}
|
||
*/
|
||
}
|
||
vector3 vecChrPos;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecChrPos);
|
||
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
|
||
//m_Camera.m_fCameraRotX-=m_lstCharData[m_nFocusCharacter]->m_fFixAngle;
|
||
|
||
fChrDir-=m_lstCharData[m_nFocusCharacter]->m_fFixAngle;
|
||
|
||
if(m_MouseClickMode==1)
|
||
{
|
||
if(KeyPressed(VK_MBUTTON))
|
||
{
|
||
fChrDir = -m_Camera.m_fCameraRotX;
|
||
m_Camera.UpdateBattleCharacter(vecChrPos, fChrDir);
|
||
} else
|
||
{
|
||
fChrDir -= FLOAT_PHI / 2.0f;
|
||
m_Camera.UpdateBattleCharacter(vecChrPos, fChrDir);
|
||
}
|
||
}
|
||
else
|
||
m_Camera.UpdateClickMode(vecChrPos);
|
||
}
|
||
|
||
void CCharacterControl::AddActionData(unsigned long dwChrID, unsigned long dwUpperAni, unsigned long dwLowerAni, float fDirection, vector3 &vecNextPosition, float fVec, unsigned short wAniNum, unsigned long dwFrame)
|
||
{
|
||
if(m_nFocusCharacter==0xffffffff)
|
||
return;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_dwChrID == dwChrID)
|
||
return; // <20><EFBFBD>Ʈ<EFBFBD>Ҷ<EFBFBD> <20><><EFBFBD>´<EFBFBD>.
|
||
|
||
/* if(GetClientType(dwChrID) == CT_PC && !GetCreature(dwChrID))
|
||
// if(GetClientType(dwChrID) == CT_PC && IsExistToList && !(*IsExistToList )(1, dwChrID) && !GetCreature(dwChrID))
|
||
{
|
||
AddCharacter(dwChrID); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
//CNetwork::m_pSocket->CharRequireInfo(m_lstCharData[m_nFocusCharacter].m_dwChrID, dwChrID, ClientSocket::Require_UDPInfo);
|
||
if(CharAddressRequireInfo)
|
||
{
|
||
(*CharAddressRequireInfo)(m_lstCharData[m_nFocusCharacter]->m_dwChrID, dwChrID);
|
||
}
|
||
return;
|
||
}*/
|
||
|
||
CCreature *pCreature=GetCreature(dwChrID);
|
||
if(pCreature)
|
||
{
|
||
if(pCreature->m_lpChrModel)
|
||
{
|
||
switch(GetClientType(dwChrID))
|
||
{
|
||
case CT_PC:
|
||
if(m_lstCharData.num==0)
|
||
CSceneManager::CharacterCollisionDetectType(pCreature->m_lpChrModel,CDT_FULL);
|
||
else
|
||
CSceneManager::CharacterCollisionDetectType(pCreature->m_lpChrModel,CDT_NONE);
|
||
break;
|
||
|
||
case CT_NPC:
|
||
CSceneManager::CharacterCollisionDetectType(pCreature->m_lpChrModel,CDT_FIRSTBOTTOM);
|
||
break;
|
||
|
||
case CT_MONSTER:
|
||
CSceneManager::CharacterCollisionDetectType(pCreature->m_lpChrModel,CDT_FIRSTBOTTOM);
|
||
if(pCreature->GetChantFlag(26))
|
||
{
|
||
dwUpperAni = CA_STUN;
|
||
dwLowerAni = CA_STUN;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
ChrActionNode AddNode;
|
||
AddNode.m_dwUpperChrAction = dwUpperAni;
|
||
AddNode.m_dwLowerChrAction = dwLowerAni;
|
||
|
||
AddNode.m_fDirection = fDirection;
|
||
AddNode.m_vecNextPosition = vecNextPosition;
|
||
AddNode.m_fVec = fVec;
|
||
AddNode.m_wAniNum = AddNode.m_wAniNumCount = wAniNum;
|
||
AddNode.m_dwFrame = dwFrame;
|
||
|
||
if(GetClientType(dwChrID) == CT_MONSTER)
|
||
{
|
||
if(pCreature->m_lpChrModel)
|
||
{
|
||
vector3 vecChrPos;
|
||
pCreature->m_lpChrModel->GetPosition(vecChrPos);
|
||
AddNode.m_vecNextPosition.y = vecChrPos.y;
|
||
pCreature->m_lpChrModel->SetPosition(AddNode.m_vecNextPosition);
|
||
CSceneManager::CharacterCollisionDetectType(pCreature->m_lpChrModel,CDT_FIRSTBOTTOM);
|
||
} else
|
||
{
|
||
vector3 vecMove;
|
||
vecMove.x = cosf((-AddNode.m_fDirection) - FLOAT_PHI / 2.0f);
|
||
vecMove.y = 0.0f;
|
||
vecMove.z = sinf((-AddNode.m_fDirection) - FLOAT_PHI / 2.0f);
|
||
vecMove *= AddNode.m_fVec;
|
||
vecMove *= AddNode.m_dwFrame;
|
||
vecMove *= 100.0f;
|
||
vecMove *= AddNode.m_wAniNum;
|
||
|
||
pCreature->m_vecPos = AddNode.m_vecNextPosition + vecMove;
|
||
pCreature->m_fDirection = AddNode.m_fDirection;
|
||
pCreature->m_dwUpperChrAction = AddNode.m_dwUpperChrAction;
|
||
pCreature->m_dwLowerChrAction = AddNode.m_dwLowerChrAction;
|
||
|
||
return;
|
||
}
|
||
} else
|
||
{
|
||
if(!pCreature->m_lpChrModel)
|
||
{
|
||
//MessageBox(NULL, "asd", "Asd", MB_OK);
|
||
pCreature->m_vecPos = AddNode.m_vecNextPosition;
|
||
pCreature->m_fDirection = AddNode.m_fDirection;
|
||
pCreature->m_dwUpperChrAction = AddNode.m_dwUpperChrAction;
|
||
pCreature->m_dwLowerChrAction = AddNode.m_dwLowerChrAction;
|
||
|
||
return;
|
||
}
|
||
}
|
||
|
||
pCreature->m_lstActionData.Add(AddNode);
|
||
|
||
for(int cChr2 = 1; cChr2 < m_lstCharData.num; cChr2++)
|
||
{
|
||
for(int i = 0; i < m_lstCharData[cChr2]->m_lstActionData.num;)
|
||
{
|
||
if(m_lstCharData[cChr2]->m_lstActionData[i].m_dwLowerChrAction >= CA_SWIM)
|
||
{
|
||
m_lstCharData[cChr2]->m_lstActionData.DelIndex(i);
|
||
} else
|
||
{
|
||
i++;
|
||
}
|
||
}
|
||
}/**/
|
||
}
|
||
}
|
||
|
||
BOOL CCharacterControl::GetIsExistChar(unsigned long dwChrID)
|
||
{
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
// <20>ӽÿ<D3BD>
|
||
// if(cChr == m_nFocusCharacter) continue;
|
||
|
||
if(m_lstCharData[cChr]->m_dwChrID == dwChrID)
|
||
{
|
||
return TRUE;
|
||
}
|
||
}
|
||
|
||
return FALSE;
|
||
}
|
||
|
||
void CCharacterControl::UpdatePlayer(unsigned long cChr, float fUpdateTime)
|
||
{
|
||
ChrActionNode ActionNode;
|
||
|
||
if(m_lstCharData[cChr]->m_lpChrModel)
|
||
{
|
||
m_lstCharData[cChr]->InitChrAction();
|
||
|
||
if(m_lstCharData[cChr]->m_lpChrModel->IsActionFinished(0))
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwLowerChrAction != CA_FORWARDJUMP &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_BACKJUMP &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMP &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_FRONTDASH &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMPATTACK &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMPATTACK2)
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vector3(0.0f, 0.0f, 0.0f));
|
||
}
|
||
if(m_lstCharData[cChr]->m_dwLowerChrAction != CA_FORWARDJUMP &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_BACKJUMP &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMP &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_FRONTDASH &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMPATTACK &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMPATTACK2 &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_FALLDOWN)
|
||
m_lstCharData[cChr]->SetAction(m_lstCharData[cChr]->m_dwUpperChrAction, m_lstCharData[cChr]->m_dwLowerChrAction);
|
||
|
||
if(m_lstCharData[cChr]->m_lstActionData.num)
|
||
{
|
||
ActionNode = m_lstCharData[cChr]->m_lstActionData[0];
|
||
m_lstCharData[cChr]->m_lstActionData.DelIndex(0);
|
||
|
||
m_lstCharData[cChr]->m_fDirection = ActionNode.m_fDirection;
|
||
m_lstCharData[cChr]->m_lpChrModel->SetDirection(m_lstCharData[cChr]->m_fDirection);
|
||
|
||
if(ActionNode.m_dwUpperChrAction == CA_REST)
|
||
{
|
||
m_lstCharData[cChr]->m_bSitMode = TRUE;
|
||
} else if(ActionNode.m_dwUpperChrAction != CA_STANDUP && ActionNode.m_dwUpperChrAction != CA_SITDOWN)
|
||
{
|
||
m_lstCharData[cChr]->m_bSitMode = FALSE;
|
||
}
|
||
|
||
if(ActionNode.m_dwUpperChrAction != CA_CASTING &&
|
||
ActionNode.m_dwUpperChrAction != CA_AIMEDSHOT1 && ActionNode.m_dwUpperChrAction != CA_AIMEDSHOT2 &&
|
||
ActionNode.m_dwUpperChrAction != CA_TURNPUNCH1 && ActionNode.m_dwUpperChrAction != CA_TURNPUNCH2)
|
||
{
|
||
m_lstCharData[cChr]->m_bStillCasting = FALSE;
|
||
}
|
||
|
||
if(ActionNode.m_dwLowerChrAction == CA_RUN)
|
||
{
|
||
if(m_lstCharData[cChr]->m_fRunFactor < 255.0f) m_lstCharData[cChr]->m_fRunFactor += CFrameTimer::GetUpdateTimer(m_dwRunFactorTimer);
|
||
} else
|
||
{
|
||
m_lstCharData[cChr]->m_fRunFactor = 0.0f;
|
||
}
|
||
|
||
if(ActionNode.m_dwLowerChrAction == CA_RESPAWN)
|
||
{
|
||
m_lstCharData[cChr]->Respawn();
|
||
}
|
||
|
||
vector3 vecDistance = ActionNode.m_vecNextPosition - m_lstCharData[cChr]->m_vecPos;
|
||
if(vecDistance.GetLens() > 1000.0f)
|
||
{
|
||
m_lstCharData[cChr]->m_vecPos = ActionNode.m_vecNextPosition;
|
||
m_lstCharData[cChr]->m_lpChrModel->SetPosition(m_lstCharData[cChr]->m_vecPos);
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vector3(0.0f, 0.0f, 0.0f));
|
||
} else
|
||
{
|
||
vector3 vecMove = vecDistance / (35.0f / 4.0f);
|
||
switch(ActionNode.m_dwLowerChrAction)
|
||
{
|
||
case CA_SWIM:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vecMove);
|
||
break;
|
||
|
||
case CA_JUMPATTACK2:
|
||
case CA_JUMPATTACK:
|
||
case CA_FORWARDJUMP:
|
||
case CA_FRONTDASH:
|
||
case CA_RUN:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vecMove);
|
||
break;
|
||
|
||
case CA_LEFTDASH:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vecMove ,-1.1f);
|
||
break;
|
||
case CA_RIGHTDASH:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vecMove ,-1.1f);
|
||
break;
|
||
case CA_BACKDASH:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vecMove ,-1.1f);
|
||
break;
|
||
|
||
case CA_BACKJUMP:
|
||
case CA_WALK:
|
||
case CA_WALKBACK:
|
||
case CA_WALKLEFT:
|
||
case CA_WALKRIGHT:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vecMove);
|
||
break;
|
||
|
||
default:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vector3(0.0f, 0.0f, 0.0f));
|
||
m_lstCharData[cChr]->m_lpChrModel->SetPosition(ActionNode.m_vecNextPosition);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if(!m_lstCharData[cChr]->m_bCharDead)
|
||
{
|
||
if(ActionNode.m_dwUpperChrAction == CA_ATTACK || ActionNode.m_dwUpperChrAction == CA_ATTACK2 ||
|
||
ActionNode.m_dwUpperChrAction == CA_ATTACK3 || ActionNode.m_dwUpperChrAction == CA_ATTACK4 ||
|
||
ActionNode.m_dwUpperChrAction == CA_ATTACK5 || ActionNode.m_dwUpperChrAction == CA_ATTACK6 ||
|
||
ActionNode.m_dwUpperChrAction == CA_ATTACKADVANCE || ActionNode.m_dwUpperChrAction == CA_ATTACKLEFT ||
|
||
ActionNode.m_dwUpperChrAction == CA_ATTACKRIGHT || ActionNode.m_dwUpperChrAction == CA_ATTACKRETREAT)
|
||
{
|
||
if(ActionNode.m_dwUpperChrAction == CA_ATTACK || ActionNode.m_dwUpperChrAction == CA_ATTACK2 ||
|
||
ActionNode.m_dwUpperChrAction == CA_ATTACK3 || ActionNode.m_dwUpperChrAction == CA_ATTACK4 ||
|
||
ActionNode.m_dwUpperChrAction == CA_ATTACK5 || ActionNode.m_dwUpperChrAction == CA_ATTACK6)
|
||
{
|
||
m_lstCharData[cChr]->m_dwLowerChrAction = CA_WAIT;
|
||
m_lstCharData[cChr]->m_dwUpperChrAction = CA_WAIT;
|
||
m_lstCharData[cChr]->m_bUpperAble = TRUE;
|
||
m_lstCharData[cChr]->m_bLowerAble = TRUE;
|
||
m_lstCharData[cChr]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[cChr]->m_bLowerAnimating = FALSE;
|
||
}
|
||
m_lstCharData[cChr]->Attack(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
} else if(ActionNode.m_dwUpperChrAction == CA_STANDUP || ActionNode.m_dwUpperChrAction == CA_SITDOWN)
|
||
{
|
||
m_lstCharData[cChr]->CrouchAndStandup();
|
||
} else if(ActionNode.m_dwUpperChrAction == CA_FALLDOWN)
|
||
{
|
||
m_lstCharData[cChr]->Dead();
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_LEFTDASH)
|
||
{
|
||
m_lstCharData[cChr]->Dash(0);
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_RIGHTDASH)
|
||
{
|
||
m_lstCharData[cChr]->Dash(1);
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_BACKDASH)
|
||
{
|
||
m_lstCharData[cChr]->Dash(2);
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_CASTING ||
|
||
ActionNode.m_dwLowerChrAction == CA_AIMEDSHOT1 || ActionNode.m_dwLowerChrAction == CA_AIMEDSHOT2 ||
|
||
ActionNode.m_dwLowerChrAction == CA_TURNPUNCH1 || ActionNode.m_dwLowerChrAction == CA_TURNPUNCH2)
|
||
{
|
||
m_lstCharData[cChr]->Casting(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_JUMPATTACK)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMPATTACK)
|
||
{
|
||
m_lstCharData[cChr]->m_bUpperAble = TRUE;
|
||
m_lstCharData[cChr]->m_bLowerAble = TRUE;
|
||
m_lstCharData[cChr]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[cChr]->m_bLowerAnimating = FALSE;
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_JUMPATTACK2)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMPATTACK2)
|
||
{
|
||
m_lstCharData[cChr]->m_bUpperAble = TRUE;
|
||
m_lstCharData[cChr]->m_bLowerAble = TRUE;
|
||
m_lstCharData[cChr]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[cChr]->m_bLowerAnimating = FALSE;
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_JUMP)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwLowerChrAction != CA_JUMP)
|
||
{
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_FRONTDASH)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwLowerChrAction != CA_FRONTDASH)
|
||
{
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_FORWARDJUMP)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwLowerChrAction != CA_FORWARDJUMP)
|
||
{
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
} else if(ActionNode.m_dwLowerChrAction == CA_BACKJUMP)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwLowerChrAction != CA_BACKJUMP)
|
||
{
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
} else
|
||
{
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
if(m_lstCharData[cChr]->m_lstActionData.num)
|
||
{
|
||
ActionNode = m_lstCharData[cChr]->m_lstActionData[0];
|
||
m_lstCharData[cChr]->m_lstActionData.DelIndex(0);
|
||
|
||
m_lstCharData[cChr]->m_fDirection = ActionNode.m_fDirection;
|
||
m_lstCharData[cChr]->m_vecPos = ActionNode.m_vecNextPosition;
|
||
|
||
if(!m_lstCharData[cChr]->m_bCharDead)
|
||
{
|
||
if(ActionNode.m_dwUpperChrAction == CA_FALLDOWN)
|
||
{
|
||
m_lstCharData[cChr]->Dead();
|
||
} else
|
||
{
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// Monster Effect Process
|
||
|
||
void CCharacterControl::MonsterEffectProcess(int iChrIndex,char *strFileName,int iEffectValue)
|
||
{
|
||
int i;
|
||
if(iEffectValue == 0) // Attack <20><><EFBFBD><EFBFBD> effect
|
||
{
|
||
if((iChrIndex < 0 )|| (iChrIndex >= m_lstCharData.num))
|
||
return;
|
||
if((strFileName == NULL) || (strlen(strFileName) <= 1))
|
||
return;
|
||
|
||
DWORD dwTarget = m_lstCharData[iChrIndex]->m_dwTargetId;
|
||
int iTargetIndex = -1;
|
||
|
||
if(dwTarget == 0xffffffff)
|
||
{
|
||
return;
|
||
}
|
||
|
||
for( i = 0; i < m_lstCharData.num; i++ )
|
||
{
|
||
if(m_lstCharData[i]->m_dwChrID == dwTarget)
|
||
{
|
||
iTargetIndex = i;
|
||
// <20>ʱ<EFBFBD>ȭ
|
||
m_lstCharData[iChrIndex]->m_dwTargetId = 0xffffffff;
|
||
break;
|
||
}
|
||
}
|
||
if(iTargetIndex == -1)
|
||
{
|
||
m_lstCharData[iChrIndex]->m_dwTargetId = 0xffffffff;
|
||
return;
|
||
}
|
||
// ij<><C4B3> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
float fChrDir = m_lstCharData[iChrIndex]->m_fDirection;
|
||
fChrDir = -fChrDir;
|
||
fChrDir -= FLOAT_PHI / 2.0f;
|
||
|
||
vector3 vecChrToward;
|
||
|
||
vecChrToward.x = cosf(fChrDir);
|
||
vecChrToward.z = sinf(fChrDir);
|
||
vecChrToward.y = 0.0f;
|
||
vecChrToward.Normalize();
|
||
|
||
CEffScript *pInputEffect = new CEffScript;
|
||
|
||
pInputEffect->GetScriptData(strFileName);//,true);
|
||
pInputEffect->SetStartPos(m_lstCharData[iChrIndex]->m_vecPos.x,m_lstCharData[iChrIndex]->m_vecPos.y,m_lstCharData[iChrIndex]->m_vecPos.z);
|
||
pInputEffect->SetEndPos((D3DXVECTOR3 *)&(m_lstCharData[iTargetIndex]->m_vecPos), 1);
|
||
pInputEffect->SetPlayer(m_lstCharData[iChrIndex],m_lstCharData[iChrIndex]->m_dwChrID);
|
||
pInputEffect->SetChr(m_lstCharData[iChrIndex]->m_lpChrModel,m_lstCharData[iTargetIndex]->m_lpChrModel);
|
||
pInputEffect->SetChrFwd(-vecChrToward.x,-vecChrToward.y,-vecChrToward.z);
|
||
pInputEffect->SetMine(true);
|
||
|
||
CSceneManager::m_EffectManager.AddEffScript(pInputEffect);
|
||
|
||
|
||
}
|
||
else if(iEffectValue == 1) // Attack <20>̿<EFBFBD><CCBF><EFBFBD> <20>̺<EFBFBD>Ʈ <20>ÿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> effect
|
||
{
|
||
if((iChrIndex < 0 )|| (iChrIndex >= m_lstCharData.num))
|
||
return;
|
||
if((strFileName == NULL) || (strlen(strFileName) <= 1))
|
||
return;
|
||
// AddBodyEffect <20><><EFBFBD>뵵 <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>.
|
||
m_lstCharData[iChrIndex]->AddBodyEffect(strFileName,(unsigned long)0,true);
|
||
|
||
}
|
||
}
|
||
|
||
void CCharacterControl::UpdateMonster(unsigned long cChr, float fUpdateTime)
|
||
{
|
||
if(m_lstCharData[cChr]->m_lpChrModel)
|
||
{
|
||
if(m_lstCharData[cChr]->m_fDeadTimer >= 0.0f)
|
||
{
|
||
m_lstCharData[cChr]->m_fDeadTimer -= 0.01f;
|
||
if(m_lstCharData[cChr]->m_fDeadTimer <= 0.0f)
|
||
{
|
||
UnLoadChr(m_lstCharData[cChr]->m_dwChrID);
|
||
cChr--;
|
||
return;
|
||
}
|
||
|
||
m_lstCharData[cChr]->m_lpChrModel->SetAlphaLevel(m_lstCharData[cChr]->m_fDeadTimer);
|
||
return;
|
||
}
|
||
|
||
m_lstCharData[cChr]->InitChrAction();
|
||
|
||
ChrActionNode ActionNode;
|
||
ActionNode.m_wAniNumCount = 0;
|
||
|
||
|
||
|
||
if(m_lstCharData[cChr]->m_lpChrModel->IsActionFinished(0))
|
||
{
|
||
unsigned int iRandAction = rand() % 56;
|
||
|
||
m_lstCharData[cChr]->SetAction(iRandAction,iRandAction);
|
||
if(!m_lstCharData[cChr]->m_lstActionData.num)
|
||
{
|
||
if(m_lstCharData[cChr]->m_ChrAction.m_wAniNumCount)
|
||
{
|
||
ActionNode = m_lstCharData[cChr]->m_ChrAction;
|
||
} else
|
||
{
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vector3(0.0f, 0.0f, 0.0f));
|
||
m_lstCharData[cChr]->SetAction(m_lstCharData[cChr]->m_dwUpperChrAction, m_lstCharData[cChr]->m_dwLowerChrAction);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(m_lstCharData[cChr]->m_lstActionData.num || ActionNode.m_wAniNumCount)
|
||
{
|
||
if(m_lstCharData[cChr]->m_lstActionData.num)
|
||
{
|
||
ActionNode = m_lstCharData[cChr]->m_lstActionData[0];
|
||
m_lstCharData[cChr]->m_lstActionData.DelIndex(0);
|
||
|
||
m_lstCharData[cChr]->m_ChrAction = ActionNode;
|
||
}
|
||
|
||
m_lstCharData[cChr]->m_fDirection = ActionNode.m_fDirection;
|
||
m_lstCharData[cChr]->m_lpChrModel->SetDirection(m_lstCharData[cChr]->m_fDirection);
|
||
|
||
if(ActionNode.m_dwLowerChrAction == CA_ATTACK)
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->AddMotion("ATTACK",0,0.7f);
|
||
m_lstCharData[cChr]->m_ChrAction.m_wAniNumCount--;
|
||
///////////////// Monster EventEffect
|
||
Z3DTOK TokEffect;
|
||
if(m_lstCharData[cChr]->m_lpChrModel->CheckEvent("EFFECT",&TokEffect))
|
||
{
|
||
const char* strEffectName = g_TokFileName.GetString(TokEffect);
|
||
MonsterEffectProcess(cChr,(char *)strEffectName,0);
|
||
}
|
||
//////////////////
|
||
return;
|
||
}
|
||
else // Attack <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
{
|
||
//////////////////// Monster Event Effect ó<><C3B3> <20>κ<EFBFBD>
|
||
|
||
Z3DTOK TokEffect;
|
||
if(m_lstCharData[cChr]->m_lpChrModel->CheckEvent("EFFECT",&TokEffect))
|
||
{
|
||
const char* strEffectName = g_TokFileName.GetString(TokEffect);
|
||
MonsterEffectProcess(cChr,(char *)strEffectName,1);
|
||
}
|
||
|
||
///////////////////
|
||
}
|
||
|
||
vector3 vecMove;
|
||
vecMove.x = cosf((-ActionNode.m_fDirection) - FLOAT_PHI / 2.0f);
|
||
vecMove.y = 0.0f;
|
||
vecMove.z = sinf((-ActionNode.m_fDirection) - FLOAT_PHI / 2.0f);
|
||
vecMove *= ActionNode.m_fVec;
|
||
vecMove *= 100.0f;
|
||
|
||
switch(ActionNode.m_dwLowerChrAction)
|
||
{
|
||
case CA_RUN:
|
||
case CA_WALK:
|
||
case CA_WALKBACK:
|
||
case CA_WALKLEFT:
|
||
case CA_WALKRIGHT:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vecMove);
|
||
//m_lstCharData[cChr]->m_lpChrModel->SetPosition(ActionNode.m_vecNextPosition);
|
||
break;
|
||
|
||
default:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[cChr]->m_lpChrModel, vector3(0.0f, 0.0f, 0.0f));
|
||
m_lstCharData[cChr]->m_lpChrModel->SetPosition(ActionNode.m_vecNextPosition);
|
||
break;
|
||
}
|
||
|
||
if(!m_lstCharData[cChr]->m_bCharDead)
|
||
{
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
|
||
m_lstCharData[cChr]->m_ChrAction.m_wAniNumCount--;
|
||
}
|
||
} else
|
||
{
|
||
if(m_lstCharData[cChr]->m_lstActionData.num || m_lstCharData[cChr]->m_ChrAction.m_wAniNumCount)
|
||
{
|
||
ChrActionNode ActionNode;
|
||
if(m_lstCharData[cChr]->m_lstActionData.num)
|
||
{
|
||
ActionNode = m_lstCharData[cChr]->m_lstActionData[0];
|
||
m_lstCharData[cChr]->m_lstActionData.DelIndex(0);
|
||
} else
|
||
{
|
||
ActionNode = m_lstCharData[cChr]->m_ChrAction;
|
||
}
|
||
|
||
vector3 vecMove;
|
||
vecMove.x = cosf((-ActionNode.m_fDirection) - FLOAT_PHI / 2.0f);
|
||
vecMove.y = 0.0f;
|
||
vecMove.z = sinf((-ActionNode.m_fDirection) - FLOAT_PHI / 2.0f);
|
||
vecMove *= ActionNode.m_fVec;
|
||
vecMove *= ActionNode.m_dwFrame;
|
||
vecMove *= 100.0f;
|
||
vecMove *= ActionNode.m_wAniNum;
|
||
|
||
m_lstCharData[cChr]->m_fDirection = ActionNode.m_fDirection;
|
||
m_lstCharData[cChr]->m_vecPos = ActionNode.m_vecNextPosition + vecMove;
|
||
|
||
if(!m_lstCharData[cChr]->m_bCharDead)
|
||
{
|
||
m_lstCharData[cChr]->SetAction(ActionNode.m_dwUpperChrAction, ActionNode.m_dwLowerChrAction);
|
||
}
|
||
|
||
m_lstCharData[cChr]->m_ChrAction.m_wAniNum = 0;
|
||
m_lstCharData[cChr]->m_ChrAction.m_wAniNumCount = 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
unsigned long CCharacterControl::GetClientType(unsigned long dwChrID, BOOL bNation)
|
||
{
|
||
if(dwChrID & 0x80000000)
|
||
{
|
||
return CT_MONSTER;
|
||
} else if(dwChrID & 0x40000000)
|
||
{
|
||
return CT_NPC;
|
||
} else
|
||
{
|
||
unsigned long dwResult = CT_PC;
|
||
|
||
if(bNation && m_nFocusCharacter != 0xFFFFFFFF)
|
||
{
|
||
if(m_dwDuelTargetID && dwChrID == m_dwDuelTargetID)
|
||
{
|
||
dwResult = CT_MONSTER;
|
||
}
|
||
else
|
||
{
|
||
for(int i = 0; i < m_lstCharData.num; i++)
|
||
{
|
||
if(i == m_nFocusCharacter) continue;
|
||
|
||
if(m_lstCharData[i]->m_dwChrID == dwChrID)
|
||
{
|
||
if(m_lstCharData[i]->m_cNation != m_lstCharData[m_nFocusCharacter]->m_cNation)
|
||
// if(m_lstCharData[i]->m_bUsed && m_lstCharData[i]->m_cNation != m_lstCharData[m_nFocusCharacter]->m_cNation)
|
||
dwResult = CT_MONSTER;
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return dwResult;
|
||
}
|
||
}
|
||
|
||
CCreature *CCharacterControl::GetCreature(unsigned long dwChrID)
|
||
{
|
||
// for(int i = 1; i < m_lstCharData.num; i++) // <20>ӽÿ<D3BD>
|
||
for(int i = 0; i < m_lstCharData.num; i++)
|
||
{
|
||
if(dwChrID == m_lstCharData[i]->m_dwChrID)
|
||
{
|
||
return m_lstCharData[i];
|
||
}
|
||
}
|
||
|
||
return NULL;
|
||
}
|
||
|
||
void CCharacterControl::WrapSendMovingPacket(DWORD dwUpperAction, DWORD dwLowerAction, float fDir, vector3 vecPos)
|
||
{
|
||
if(SendMovingPacket)
|
||
{
|
||
(*SendMovingPacket)(dwUpperAction,dwLowerAction,fDir,vecPos);
|
||
}
|
||
//BOOL CNetwork::SendMovingPacket(unsigned long dwUpperAni, unsigned long dwLowerAni, float fDir, vector3 &vecMove)
|
||
}
|
||
|
||
void CCharacterControl::WrapSendCharRespawn(DWORD dwChrID)
|
||
{
|
||
if(SendCharRespawn)
|
||
{
|
||
(*SendCharRespawn)(dwChrID);
|
||
}
|
||
//BOOL CNetwork::SendCharRespawn(unsigned long dwChrID)
|
||
}
|
||
|
||
void CCharacterControl::WrapSendMoveUpdatePacket(float fDir, vector3 vecPos)
|
||
{
|
||
if(SendMoveUpdatePacket)
|
||
{
|
||
(*SendMoveUpdatePacket)(fDir,vecPos);
|
||
}
|
||
//BOOL CNetwork::SendMoveUpdatePacket(float fDir, vector3 &vecPosition)
|
||
}
|
||
|
||
void CCharacterControl::WrapSendCharAttack(vector3 &vecPos, float fDir, unsigned short wAtType, unsigned char cSkillLock, unsigned char cSkillLevel, unsigned char cAtCount, unsigned short wDefenserNum,unsigned long lpAtNode[])
|
||
{
|
||
if(SendCharAttack)
|
||
{
|
||
(*SendCharAttack)(vecPos,fDir,wAtType,cSkillLock, cSkillLevel, cAtCount, wDefenserNum,lpAtNode);
|
||
}
|
||
//BOOL CNetwork::SendCharAttack(vector3 &vecPos, float fDir, unsigned short wAtType, unsigned short wDefenserNum, LPAtNode lpAtNode)
|
||
}
|
||
|
||
//DEL void CCharacterControl::SkillAttack(unsigned long dwUpperAni, unsigned int dwLowerAni)
|
||
//DEL {
|
||
//DEL
|
||
//DEL }
|
||
|
||
void CCharacterControl::MouseModeChange()
|
||
{
|
||
/*
|
||
{
|
||
m_Camera.m_nCameraMode=2;
|
||
m_Camera.m_nPrepareCameraMode=100;
|
||
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
|
||
//fChrDir=-fChrDir+3.14159f/2.0f;
|
||
|
||
vector3 vecChrPos;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecChrPos);
|
||
vecChrPos+=vector3(0.0f,150.0f,0.0f);
|
||
|
||
|
||
vector3 vecStart,vecEnd;
|
||
|
||
m_Camera.CalcCameraPosition(vecChrPos,-m_Camera.m_fCameraRotX,
|
||
m_Camera.m_fCameraRotY,
|
||
m_Camera.m_fMouseClickInterCharacterCamera,
|
||
vecStart);
|
||
|
||
m_Camera.CalcCameraPosition(vecChrPos,fChrDir+3.14159f/2.0f,
|
||
0.0f,
|
||
300.0f,vecEnd);
|
||
|
||
|
||
m_Camera.m_vecStartPosition=vecStart;
|
||
m_Camera.m_vecEndPosition=vecEnd;
|
||
m_Camera.m_vecNowPosition=vecStart;
|
||
m_Camera.m_vecTargetCameraPosition=vecChrPos;
|
||
|
||
vector3 vecDir=vecEnd-vecStart;
|
||
vecDir.Normalize();
|
||
m_Camera.m_vecVelocity=vector3(0.0f,0.0f,0.0f);
|
||
m_Camera.m_vecAccelate=vecDir*0.16f;// 30/sec Adder
|
||
m_Camera.m_fTotalTimeInterval=60.0f*10.0f;
|
||
m_Camera.m_fTime=0.0f;
|
||
|
||
m_MouseClickMode=3;
|
||
return;
|
||
}
|
||
*/
|
||
|
||
if(m_MouseClickMode==0)
|
||
{
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
m_MouseClickMode=1;
|
||
|
||
|
||
//m_lstCharData[m_nFocusCharacter].m_lpChrModel->SetDirection(-m_Camera.m_fCameraRotX+3.14159f/2.0f);
|
||
//m_Camera.m_nCameraMode=1;
|
||
m_Camera.m_nCameraMode=2;
|
||
m_Camera.m_nPrepareCameraMode=1;
|
||
//m_nCameraAnimation=1;
|
||
|
||
/*
|
||
float fDir=m_lstCharData[m_nFocusCharacter].m_lpChrModel->GetDirection();
|
||
|
||
vector3 vecChrPos;
|
||
|
||
m_lstCharData[m_nFocusCharacter].m_lpChrModel->GetPosition(vecChrPos);
|
||
|
||
vecChrPos+=vector3(0.0f,150.0f,0.0f);
|
||
|
||
vector3 vecStart,vecEnd;
|
||
|
||
m_Camera.CalcCameraPosition(vecChrPos,fDir,
|
||
m_Camera.m_fBattleCameraRotY,
|
||
m_Camera.m_fBattleInterCharacterCamera,vecEnd);
|
||
|
||
m_Camera.CalcCameraPosition(vecChrPos,-m_Camera.m_fCameraRotX,
|
||
m_Camera.m_fCameraRotY,
|
||
m_Camera.m_fMouseClickInterCharacterCamera,
|
||
vecStart);
|
||
|
||
m_Camera.m_vecStartPosition=vecStart;
|
||
m_Camera.m_vecEndPosition=vecEnd;
|
||
m_Camera.m_vecNowPosition=vecStart;
|
||
m_Camera.m_vecTargetCameraPosition=vecChrPos;
|
||
|
||
vector3 vecDir=vecEnd-vecStart;
|
||
vecDir.Normalize();
|
||
m_Camera.m_vecVelocity=vector3(0.0f,0.0f,0.0f);
|
||
m_Camera.m_vecAccelate=vecDir*0.3f;// 30/sec Adder
|
||
m_Camera.m_fTotalTimeInterval=30.0f*10.0f;
|
||
m_Camera.m_fTime=0.0f;
|
||
*/
|
||
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(-m_Camera.m_fCameraRotX+3.14159f/2.0f);
|
||
//m_Camera.m_nCameraMode=1;
|
||
m_Camera.m_nCameraMode=2;
|
||
m_Camera.m_nPrepareCameraMode=1;
|
||
//m_nCameraAnimation=1;
|
||
|
||
vector3 vecChrPos;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecChrPos);
|
||
|
||
vecChrPos+=vector3(0.0f,150.0f,0.0f);
|
||
|
||
vector3 vecStart,vecEnd;
|
||
|
||
m_Camera.CalcCameraPosition(vecChrPos,-m_Camera.m_fCameraRotX,
|
||
m_Camera.m_fBattleCameraRotY,
|
||
m_Camera.m_fBattleInterCharacterCamera,vecEnd);
|
||
m_Camera.CalcCameraPosition(vecChrPos,-m_Camera.m_fCameraRotX,
|
||
m_Camera.m_fCameraRotY,
|
||
m_Camera.m_fMouseClickInterCharacterCamera,
|
||
vecStart);
|
||
|
||
m_Camera.m_vecStartPosition=vecStart;
|
||
m_Camera.m_vecEndPosition=vecEnd;
|
||
m_Camera.m_vecNowPosition=vecStart;
|
||
m_Camera.m_vecTargetCameraPosition=vecChrPos;
|
||
|
||
vector3 vecDir=vecEnd-vecStart;
|
||
vecDir.Normalize();
|
||
m_Camera.m_vecVelocity=vector3(0.0f,0.0f,0.0f);
|
||
m_Camera.m_vecAccelate=vecDir*0.16f;// 30/sec Adder
|
||
m_Camera.m_fTotalTimeInterval=60.0f*10.0f;
|
||
m_Camera.m_fTime=0.0f;
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
//<2F><><EFBFBD>콺 Ŭ<><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
|
||
m_Camera.m_fCameraRotX=-fChrDir+3.14159f/2.0f;
|
||
|
||
vector3 vecChrPos;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecChrPos);
|
||
|
||
vecChrPos+=vector3(0.0f,150.0f,0.0f);
|
||
|
||
vector3 vecStart,vecEnd;
|
||
|
||
m_Camera.CalcCameraPosition(vecChrPos,-m_Camera.m_fCameraRotX,
|
||
m_Camera.m_fBattleCameraRotY,
|
||
m_Camera.m_fBattleInterCharacterCamera,vecStart);
|
||
|
||
m_Camera.CalcCameraPosition(vecChrPos,-m_Camera.m_fCameraRotX,
|
||
m_Camera.m_fCameraRotY,
|
||
m_Camera.m_fMouseClickInterCharacterCamera,vecEnd);
|
||
|
||
m_Camera.m_vecStartPosition=vecStart;
|
||
m_Camera.m_vecEndPosition=vecEnd;
|
||
m_Camera.m_vecNowPosition=vecStart;
|
||
m_Camera.m_vecTargetCameraPosition=vecChrPos;
|
||
|
||
vector3 vecDir=vecEnd-vecStart;
|
||
vecDir.Normalize();
|
||
m_Camera.m_vecVelocity=vector3(0.0f,0.0f,0.0f);
|
||
m_Camera.m_vecAccelate=vecDir*0.16f;// 30/sec Adder
|
||
m_Camera.m_fTotalTimeInterval=60.0f*10.0f;
|
||
m_Camera.m_fTime=0.0f;
|
||
|
||
m_MouseClickMode=0;
|
||
m_Camera.m_nCameraMode=0;
|
||
m_Camera.m_nCameraMode=2;
|
||
m_Camera.m_nPrepareCameraMode=0;
|
||
//m_Camera.m_vecNowPosition=vecStart;
|
||
//m_nCameraAnimation=1;
|
||
}
|
||
}
|
||
|
||
int CCharacterControl::AddCharacter(unsigned long dwChrID, vector3 vecChrPos)
|
||
{
|
||
CCreature *lpCreature = GetCreature(dwChrID);
|
||
if(lpCreature) return lpCreature->m_ChrNodeID;
|
||
|
||
CCreature *AddNode;
|
||
|
||
AddNode = new CCreature;
|
||
AddNode->m_dwChrID = dwChrID;
|
||
strcpy(AddNode->m_strName, "");
|
||
AddNode->m_vecPos = vecChrPos;
|
||
AddNode->m_fDirection = 0.0f;
|
||
m_nChrCounter++;
|
||
AddNode->m_ChrNodeID = m_nChrCounter;
|
||
strcpy(AddNode->m_strGCMDSName, "");
|
||
strcpy(AddNode->m_strFaceType, "");
|
||
strcpy(AddNode->m_strHairStyle, "");
|
||
AddNode->m_lpChrModel = NULL;
|
||
AddNode->m_dwLastUpdateActionTimer=GetTickCount();
|
||
AddNode->m_bFirstPositionSend = FALSE;
|
||
|
||
AddNode->m_dwSpendTime[0] = AddNode->m_dwSpendTime[1] = AddNode->m_dwSpendTime[2] =
|
||
AddNode->m_dwSpendTime[3] = AddNode->m_dwSpendTime[4] = AddNode->m_dwSpendTime[5] = GetTickCount();
|
||
|
||
for(int i = 0; i < 15; i++)
|
||
{
|
||
strcpy(AddNode->m_strShape[i], "");
|
||
}
|
||
|
||
m_lstCharData.Add(AddNode);
|
||
AddNode->m_lpChrModel->ApplySTMode();
|
||
|
||
//////////// Monster Effect
|
||
const char **ppstrEffect = NULL;
|
||
int iEffectNum = 0;
|
||
|
||
iEffectNum = AddNode->m_lpChrModel->GetEffectInfoList(ppstrEffect);
|
||
if((iEffectNum > 0) && (ppstrEffect != NULL))
|
||
{
|
||
for( int cEff = 0; cEff < iEffectNum; cEff++ )
|
||
{
|
||
MonsterEffectProcess(m_lstCharData.num -1,(char *)ppstrEffect[cEff],1);
|
||
}
|
||
}
|
||
///////////////
|
||
|
||
return AddNode->m_ChrNodeID;
|
||
}
|
||
|
||
vector3 *CCharacterControl::GetFindChrPos(unsigned long dwChrID)
|
||
{
|
||
for(int i = 0; i < m_lstCharData.num; i++)
|
||
{
|
||
if(m_lstCharData[i]->m_dwChrID == dwChrID)
|
||
{
|
||
return &m_lstCharData[i]->m_vecPos;
|
||
}
|
||
}
|
||
|
||
return NULL;
|
||
}
|
||
|
||
bool CCharacterControl::MakeSkillAttackInfo(unsigned long dwTargetID, unsigned short wSkill, unsigned char cSkillLock, unsigned char cSkillLevel, unsigned char cAtCount)
|
||
{
|
||
unsigned long dwDefenser[10];
|
||
int nAttackCount = 0;
|
||
ZeroMemory(dwDefenser, sizeof(unsigned long) * 4);
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
// if(cChr == m_nFocusCharacter) continue;
|
||
if(!m_lstCharData[cChr]->m_lpChrModel) continue;
|
||
if(m_lstCharData[cChr]->m_bCharDead) continue;
|
||
|
||
if(m_lstCharData[cChr]->m_dwChrID == dwTargetID)
|
||
{
|
||
if(wSkill == 3 || wSkill == 4) // Ȱ
|
||
{
|
||
vector3 vecChrPos;
|
||
|
||
float fAttackActionRate=rand()%6;
|
||
fAttackActionRate*=0.1f;
|
||
fAttackActionRate+=0.3f;
|
||
|
||
if(fAttackActionRate > 0.5f) fAttackActionRate = 0.5f;
|
||
// fAttackActionRate = 0.9f;
|
||
if(m_lstCharData[cChr]->m_lpChrModel->IsAddonActionFinished(1))
|
||
m_lstCharData[cChr]->m_lpChrModel->AddMotion("ATTACKED", 3, fAttackActionRate);
|
||
|
||
m_lstCharData[cChr]->m_lpChrModel->GetPosition(vecChrPos);
|
||
CSceneManager::AddChrLight(m_lstCharData[cChr]->m_lpChrModel, vecChrPos + vector3(0.0f,200.0f,0.0f), 0xffff2200, 400.0f, 6);
|
||
|
||
vector3 vecEffectPos;
|
||
vecEffectPos=vecChrPos;
|
||
vecEffectPos.y += 120.0f;
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
|
||
|
||
test_script->GetScriptData("attack1.esf");
|
||
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[cChr]->m_lpChrModel);
|
||
//particle
|
||
CX3DEffect *pEffect;
|
||
pEffect=new CX3DEffect;
|
||
CSceneManager::AddEffect(pEffect);
|
||
|
||
|
||
pEffect->Load(EFFECTPATH,"attack1_particle.eff");
|
||
|
||
pEffect->SetLoop(FALSE);
|
||
|
||
|
||
|
||
pEffect->SetCenter(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
PlaySound(wSkill, vecEffectPos);
|
||
|
||
|
||
/* vector3 vecTargetLightPos = m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecTargetLightPos.Normalize();
|
||
vecTargetLightPos = m_lstCharData[m_nFocusCharacter]->m_vecPos + vecTargetLightPos * 60.0f;
|
||
CSceneManager::AddChrLight(m_lstCharData[cChr]->m_lpChrModel, vecTargetLightPos + vector3(0.0f, 100.0f, 0.0f), 0xffff2200, 400.0f, 6);
|
||
|
||
vector3 vecEffectPos = vecTargetLightPos + vector3(0.0f, 120.0f, 0.0f);
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos.y, m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(vecEffectPos.x, vecEffectPos.y, vecEffectPos.z);
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, m_lstCharData[cChr]->m_lpChrModel);
|
||
|
||
//particle
|
||
CX3DEffect *pEffect;
|
||
pEffect=new CX3DEffect;
|
||
CSceneManager::AddEffect(pEffect);
|
||
pEffect->Load(EFFECTPATH, "attack1_particle.eff");
|
||
|
||
float fAttackAngle = 0.0f;
|
||
pEffect->SetLoop(FALSE);
|
||
pEffect->SetAxis(0.0f, -((180.0f * -55.0f) / FLOAT_PHI) + 90.0f + fAttackAngle, 0.0f);
|
||
pEffect->SetCenter(vecEffectPos.x, vecEffectPos.y, vecEffectPos.z);
|
||
|
||
PlaySound(wSkill, vecEffectPos);*/
|
||
}
|
||
|
||
dwDefenser[nAttackCount++] = m_lstCharData[cChr]->m_dwChrID;
|
||
}
|
||
|
||
if(nAttackCount >= 10) break;
|
||
}/**/
|
||
|
||
if(nAttackCount > 0)
|
||
{
|
||
//CNetwork::SendCharAttack(m_lstCharData[m_nFocusCharacter].m_vecPos, m_lstCharData[m_nFocusCharacter].m_fDirection - FLOAT_PHI / 2.0f, 0, a, &AtList);
|
||
//AtNode AtList;
|
||
//memcpy(&AtList.m_dwDefenser[0], &dwDefenser[0], sizeof(unsigned long) * 10);
|
||
WrapSendCharAttack(m_lstCharData[m_nFocusCharacter]->m_vecPos,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection - FLOAT_PHI / 2.0f,
|
||
wSkill, cSkillLock, cSkillLevel, cAtCount, nAttackCount, dwDefenser);
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
void CCharacterControl::MakeAttacked(DWORD dwChrID, unsigned long dwWeaponType)
|
||
{
|
||
for(int cChr=0;cChr<m_lstCharData.num;cChr++)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwChrID==dwChrID)
|
||
{
|
||
if(m_lstCharData[cChr]->m_lpChrModel)
|
||
{
|
||
float fAttackActionRate=rand()%6;
|
||
fAttackActionRate*=0.1f;
|
||
fAttackActionRate+=0.3f;
|
||
|
||
if(!m_lstCharData[cChr]->GetSkillMotion() && m_lstCharData[cChr]->m_dwLowerChrAction != CA_REST &&
|
||
m_lstCharData[cChr]->m_dwLowerChrAction != CA_SITDOWN && m_lstCharData[cChr]->m_dwLowerChrAction != CA_STANDUP)
|
||
{
|
||
if(fAttackActionRate > 0.5f) fAttackActionRate = 0.5f;
|
||
// fAttackActionRate = 0.9f;
|
||
if(m_lstCharData[cChr]->m_lpChrModel->IsAddonActionFinished(1))
|
||
m_lstCharData[cChr]->m_lpChrModel->AddMotion("ATTACKED", 3, fAttackActionRate);
|
||
}
|
||
//CSceneManager::CharacterRandomPos(m_lstCharData[cChr]->m_lpChrModel, 10,vector3(0.0f,0.0f,0.0f));
|
||
|
||
vector3 vecChrPos;
|
||
|
||
m_lstCharData[cChr]->m_lpChrModel->GetPosition(vecChrPos);
|
||
CSceneManager::AddChrLight(m_lstCharData[cChr]->m_lpChrModel, vecChrPos+vector3(0.0f,200.0f,0.0f), 0xffff2200, 400.0f, 6);
|
||
|
||
vector3 vecEffectPos;
|
||
vecEffectPos=vecChrPos;
|
||
vecEffectPos.y += 120.0f;
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
|
||
|
||
test_script->GetScriptData("attack1.esf");
|
||
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
//particle
|
||
CX3DEffect *pEffect;
|
||
pEffect=new CX3DEffect;
|
||
CSceneManager::AddEffect(pEffect);
|
||
|
||
|
||
pEffect->Load(EFFECTPATH,"attack1_particle.eff");
|
||
|
||
pEffect->SetLoop(FALSE);
|
||
|
||
|
||
|
||
pEffect->SetCenter(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
PlaySound(dwWeaponType, vecEffectPos);
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
void CCharacterControl::RegistAttacked(DWORD dwSrcChrID, DWORD dwTarChrID, unsigned long dwWeaponType)
|
||
{
|
||
for(int cNode=0;cNode<m_AttackedList.num;cNode++)
|
||
{
|
||
if( m_AttackedList[cNode].m_dwSrcChrID==dwSrcChrID &&
|
||
m_AttackedList[cNode].m_dwTarChrID==dwTarChrID)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
CAttackedNode AddNode;
|
||
AddNode.m_dwSrcChrID=dwSrcChrID;
|
||
AddNode.m_dwTarChrID=dwTarChrID;
|
||
AddNode.m_dwWeaponType = dwWeaponType;
|
||
m_AttackedList.Add(AddNode);
|
||
}
|
||
|
||
void CCharacterControl::CheckAttackedTiming()
|
||
{
|
||
for(int i=m_AttackedList.num-1;i>=0;i--)
|
||
{
|
||
CCreature *lpCreature=NULL;
|
||
lpCreature = GetCreature(m_AttackedList[i].m_dwSrcChrID);
|
||
if(lpCreature && lpCreature->m_lpChrModel)
|
||
{
|
||
int nResult = CSceneManager::GetCharacterEvent(lpCreature->m_lpChrModel, EVENT_HIT);
|
||
if(nResult)
|
||
{
|
||
MakeAttacked(m_AttackedList[i].m_dwTarChrID, m_AttackedList[i].m_dwWeaponType);
|
||
m_AttackedList.DelIndex(i);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
m_AttackedList.DelIndex(i);
|
||
}
|
||
}
|
||
}
|
||
|
||
void CCharacterControl::CheckCameraShakeTiming()
|
||
{
|
||
for(int cChr=0;cChr<m_lstCharData.num;cChr++)
|
||
{
|
||
if(m_lstCharData[cChr]->m_lpChrModel)
|
||
{
|
||
int nResult = CSceneManager::GetCharacterEvent(m_lstCharData[cChr]->m_lpChrModel,EVENT_WALK);
|
||
if(nResult)
|
||
{
|
||
if(m_nFocusCharacter==cChr)
|
||
continue;
|
||
if(strcmp(m_lstCharData[cChr]->m_strGCMDSName,"MON_Yang.GCMDS")!=0)
|
||
continue;
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->m_lpChrModel)
|
||
{
|
||
vector3 vecSelfPos,vecTarPos;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecSelfPos);
|
||
m_lstCharData[cChr]->m_lpChrModel->GetPosition(vecTarPos);
|
||
|
||
vector3 vecLens=vecSelfPos-vecTarPos;
|
||
|
||
float fShakeRate=0.0f;
|
||
float fInter=vecLens.GetLens();
|
||
|
||
if(fInter<1000.0f)
|
||
{
|
||
fShakeRate=20.0f;
|
||
}
|
||
else if(fInter>6000.0f)
|
||
{
|
||
fShakeRate=0.0f;
|
||
}
|
||
else
|
||
{
|
||
/*
|
||
fInter-=500.0f;
|
||
fShakeRate=-fInter/250.0f+40.0f;
|
||
*/
|
||
fInter-=1000.0f;
|
||
fShakeRate=-(fInter*20.0f)/5000.0f+20.0f;
|
||
}
|
||
|
||
CCameraControl::m_fCameraShakeRateTime=5.0f;
|
||
CCameraControl::m_fCameraShakeNowTime=0.0f;
|
||
CCameraControl::m_vecCameraShakeLength=vector3(fShakeRate,fShakeRate,fShakeRate);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
static BOOL bEdit = TRUE;
|
||
void CCharacterControl::MouseClickModeSelfCharacterUpdate(BOOL bKeyAble, BOOL bEdge, int MouseX, int MouseY)
|
||
{
|
||
if(bEdit)
|
||
{
|
||
if(m_lstCharData.num == 0) return;
|
||
|
||
if(m_bClientUsed)
|
||
{
|
||
MouseX = g_DeviceInput.GetMousePosition()->x;
|
||
MouseY = g_DeviceInput.GetMousePosition()->y;
|
||
}
|
||
|
||
CCharacterLightShadowManager::CCharacterDataNode CheckNode;
|
||
CSceneManager::CharacterCollisionDetectType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,CDT_FULL);
|
||
|
||
float fAngle = m_lstCharData[m_nFocusCharacter]->m_fDirection = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
vector3 vecChrPos = m_lstCharData[m_nFocusCharacter]->m_vecPos = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition();
|
||
vector3 vecChrToward = vector3(0.0f, 0.0f, 0.0f);
|
||
vector3 vecChrLeft = vector3(0.0f, 0.0f, 0.0f);
|
||
|
||
CheckAttackedTiming();
|
||
CheckCameraShakeTiming();
|
||
|
||
bool m_bKeyPress = false;
|
||
float fRunFactor = CFrameTimer::GetUpdateTimer(m_dwRunFactorTimer);
|
||
BOOL bAvailableTarget = FALSE;
|
||
CCreature *lpCreature = NULL, *lpSpecialCreature = NULL;
|
||
|
||
static BOOL bLeftMousePress = FALSE;
|
||
static BOOL bRightMousePress = FALSE;
|
||
|
||
static BOOL bClickPlayerAndNpc = FALSE;
|
||
static BOOL bClickSkill = FALSE;
|
||
|
||
static unsigned long dwNormalTargetID = 0xFFFFFFFF;
|
||
static unsigned long dwSpecialTargetID = 0xFFFFFFFF;
|
||
|
||
unsigned long dwFunction;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bStillCasting && !CheckStillCasting(dwFunction))
|
||
{
|
||
m_bSkillExecuted = TRUE;
|
||
}
|
||
|
||
if(!bEdge && bKeyAble && m_lAutoRunCounter && g_DeviceInput.GetIsLeftMousePress())
|
||
{
|
||
m_lAutoRunCounter -= fRunFactor * 5;
|
||
if(m_lAutoRunCounter < 0)
|
||
{
|
||
m_lAutoRunCounter = 0;
|
||
SetAutoRun(TRUE);
|
||
}
|
||
}
|
||
|
||
BOOL bInit = TRUE;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bFlying)
|
||
{
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
int nJump = CSceneManager::GetCharacterEvent(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, EVENT_JUMP);
|
||
|
||
if(nJump && m_lstCharData[m_nFocusCharacter]->m_bFlyFirstCheck==FALSE) // <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_bFlyFirstCheck=TRUE;
|
||
}
|
||
|
||
if(CT == CT_NONE)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAble = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = TRUE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAble = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = TRUE;
|
||
|
||
bInit = FALSE;
|
||
} else if(CT == CT_TERRAIN || CT == CT_BOTTOM || CT == CT_WATER)
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bFlyFirstCheck)
|
||
{
|
||
//Jump <20><><EFBFBD><EFBFBD>sound//
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bFlying) {
|
||
if(CT != CT_WATER) //<2F><><EFBFBD><EFBFBD> <20>ƴҶ<C6B4>
|
||
PlaySound(200,m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
|
||
}
|
||
/////////////
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_bFlying=FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bFlyFirstCheck=FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bUpperAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating = FALSE;
|
||
m_lstCharData[m_nFocusCharacter]->m_vecJumpAttackVector = vector3(0.0f, 0.0f, 0.0f);
|
||
CCameraControl::m_fJumpRate=0.01f;
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_JUMPATTACK2)
|
||
{
|
||
if(m_lpButtonNormal)
|
||
{
|
||
CSceneManager::m_EffectManager.DeleteInterfaceScript(m_lpButtonNormal);
|
||
m_lpButtonNormal = NULL;
|
||
m_bComboSuccess = FALSE;
|
||
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
test_script->SetInterfaceSet(true);
|
||
test_script->GetScriptData("inter_fasthit_button_4.esf");
|
||
CSceneManager::m_EffectManager.AddInterfaceScript(test_script);
|
||
}
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->m_wClass == 2 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_wClass == 7 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_wClass == 24) // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
{
|
||
if(!KeyPressed(VK_SPACE))
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(CA_LAND, CA_LAND);
|
||
WrapSendMovingPacket(CA_LAND, CA_LAND, m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
} else
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(CA_LAND, CA_LAND);
|
||
WrapSendMovingPacket(CA_LAND, CA_LAND, m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
} else if(m_lstCharData[m_nFocusCharacter]->m_wClass == 20)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->SetAction(CA_JUMPATTACK3, CA_JUMPATTACK3);
|
||
WrapSendMovingPacket(CA_JUMPATTACK3, CA_JUMPATTACK3, m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(bInit)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->InitChrAction();
|
||
if(ChangeWeapon) ChangeWeapon();
|
||
}
|
||
|
||
// <20><>ų <20><><EFBFBD><EFBFBD>
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bStillCasting && CheckStillCasting(dwFunction))
|
||
{
|
||
m_bKeyPress = true;
|
||
SetKillCounter(0);
|
||
bKeyAble = FALSE;
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->Casting())
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
|
||
if(!bEdge && bKeyAble && !m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
{
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
CheckNode = CSceneManager::GetCharacterDataNode(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
// Ÿ<><C5B8> ó<><C3B3>
|
||
CZ3DGeneralChrModel *pSelectChr = NULL;
|
||
pSelectChr = CSceneManager::PickingCharacter(MouseX, MouseY);
|
||
|
||
if(pSelectChr) lpCreature = GetCreature(pSelectChr);
|
||
|
||
|
||
if(CheckSkillStart && CheckSkillStart(TRUE))
|
||
{
|
||
unsigned long dwFunction;
|
||
CheckStillCasting(dwFunction);
|
||
if(dwFunction != 0xFFFFFFFF)
|
||
{
|
||
lpCreature = GetCreature(dwFunction);
|
||
}
|
||
}
|
||
|
||
|
||
if(lpCreature)
|
||
{
|
||
bAvailableTarget = TRUE;
|
||
|
||
if(dwSpecialTargetID == 0xFFFFFFFF)
|
||
{
|
||
m_dwSpecialTargetID = lpCreature->m_dwChrID;
|
||
if(CheckTargetforSkill)
|
||
{
|
||
CheckTargetforSkill(m_dwSpecialTargetID, TRUE);
|
||
}
|
||
}
|
||
|
||
if(bLeftMousePress && g_DeviceInput.GetIsLeftMousePress())
|
||
{
|
||
if(dwNormalTargetID != 0xFFFFFFFF)
|
||
{
|
||
vector3 vecResult, vecTargetMonsterPos;
|
||
float fW;
|
||
|
||
lpCreature = GetCreature(dwNormalTargetID);
|
||
if(lpCreature)
|
||
{
|
||
vecTargetMonsterPos = *lpCreature->GetPosition();
|
||
vecTargetMonsterPos = vecTargetMonsterPos + vector3(0.0f, 100.0f, 0.0f);
|
||
BaseGraphicsLayer::TransformVector(vecTargetMonsterPos, vecResult, fW);
|
||
g_DeviceInput.SetCursorPos((int)vecResult.x, (int)vecResult.y);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(bRightMousePress && g_DeviceInput.GetIsRightMousePress())
|
||
{
|
||
if(dwSpecialTargetID != 0xFFFFFFFF)
|
||
{
|
||
vector3 vecResult, vecTargetMonsterPos;
|
||
float fW;
|
||
|
||
lpSpecialCreature = GetCreature(dwSpecialTargetID);
|
||
if(lpSpecialCreature)
|
||
{
|
||
vecTargetMonsterPos = *lpSpecialCreature->GetPosition();
|
||
vecTargetMonsterPos = vecTargetMonsterPos + vector3(0.0f, 100.0f, 0.0f);
|
||
BaseGraphicsLayer::TransformVector(vecTargetMonsterPos, vecResult, fW);
|
||
g_DeviceInput.SetCursorPos((int)vecResult.x, (int)vecResult.y);
|
||
}
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
if(dwSpecialTargetID == 0xFFFFFFFF)
|
||
{
|
||
m_dwSpecialTargetID = 0xFFFFFFFF;
|
||
}
|
||
}
|
||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>콺 <20><>ư
|
||
if(CheckSkillStart && CheckSkillStart(TRUE))
|
||
{
|
||
bRightMousePress = TRUE;
|
||
SetAutoRun(FALSE);
|
||
m_bKeyPress = true;
|
||
|
||
if(lpCreature)
|
||
{
|
||
dwNormalTargetID = 0xFFFFFFFF;
|
||
dwSpecialTargetID = lpCreature->m_dwChrID;
|
||
if(dwSpecialTargetID != m_dwAutoTargetID)
|
||
{
|
||
m_bAutoTargetAttack = false;
|
||
m_dwAutoTargetID = 0xFFFFFFFF;
|
||
}
|
||
|
||
if(CheckTargetforSkill)
|
||
{
|
||
CheckTargetforSkill(dwSpecialTargetID, FALSE);
|
||
}
|
||
|
||
if(dwSpecialTargetID != 0xFFFFFFFF)
|
||
{
|
||
lpSpecialCreature = GetCreature(dwSpecialTargetID);
|
||
if(!lpSpecialCreature)
|
||
{
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
dwNormalTargetID = 0xFFFFFFFF;
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
m_bAutoTargetAttack = false;
|
||
m_dwAutoTargetID = 0xFFFFFFFF;
|
||
|
||
CEffScript *pMousePointEff;
|
||
pMousePointEff = new CEffScript;
|
||
CSceneManager::AddEffectScript(pMousePointEff);
|
||
|
||
vector3 vecMovePos = CSceneManager::PickMousePos(MouseX, MouseY);
|
||
pMousePointEff->GetScriptData("point.esf");
|
||
pMousePointEff->SetStartPos(vecMovePos.x, vecMovePos.y + 30.0f, vecMovePos.z);
|
||
pMousePointEff->SetEndPos(vecMovePos.x, vecMovePos.y + 30.0f, vecMovePos.z);
|
||
}
|
||
} else if(CheckSkillStart && CheckSkillStart(FALSE))
|
||
{
|
||
bRightMousePress = FALSE;
|
||
SetAutoRun(FALSE);
|
||
m_bKeyPress = true;
|
||
|
||
if(m_bAutoTargetAttack)
|
||
{
|
||
if(dwSpecialTargetID != 0xFFFFFFFF)
|
||
{
|
||
dwNormalTargetID = dwSpecialTargetID;
|
||
}
|
||
|
||
m_bClickMove = false;
|
||
m_bClickAttack = true;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
}
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD>콺 <20><>ư
|
||
if(g_DeviceInput.GetIsLeftMouseDown())
|
||
{
|
||
bLeftMousePress = TRUE;
|
||
m_bKeyPress = true;
|
||
SetAutoRun(FALSE);
|
||
|
||
if(lpCreature)
|
||
{
|
||
if(g_DeviceInput.KeyHold(VK_CONTROL))
|
||
{
|
||
m_bAutoTargetAttack = true;
|
||
m_dwAutoTargetID = lpCreature->m_dwChrID;
|
||
} else
|
||
{
|
||
m_bAutoTargetAttack = false;
|
||
m_dwAutoTargetID = 0xFFFFFFFF;
|
||
}
|
||
dwNormalTargetID = lpCreature->m_dwChrID;
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
} else
|
||
{
|
||
m_nSelectItem = CSceneManager::MouseOnCheckInstanceObject(MouseX, MouseY);
|
||
dwNormalTargetID = 0xFFFFFFFF;
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
m_bAutoTargetAttack = false;
|
||
m_dwAutoTargetID = 0xFFFFFFFF;
|
||
|
||
if(m_nSelectItem == 0xFFFFFFFF)
|
||
{
|
||
m_lAutoRunCounter = 3000;
|
||
|
||
CEffScript *pMousePointEff;
|
||
pMousePointEff = new CEffScript;
|
||
CSceneManager::AddEffectScript(pMousePointEff);
|
||
|
||
vector3 vecMovePos = CSceneManager::PickMousePos(MouseX, MouseY);
|
||
pMousePointEff->GetScriptData("point.esf");
|
||
pMousePointEff->SetStartPos(vecMovePos.x, vecMovePos.y + 30.0f, vecMovePos.z);
|
||
pMousePointEff->SetEndPos(vecMovePos.x, vecMovePos.y + 30.0f, vecMovePos.z);
|
||
}
|
||
}
|
||
} else if(g_DeviceInput.GetIsLeftMouseUp())
|
||
{
|
||
// m_dwNormalTargetMonsterID = 0xFFFFFFFF;
|
||
bLeftMousePress = FALSE;
|
||
} else if(g_DeviceInput.GetIsLeftMousePress())
|
||
{
|
||
if(dwSpecialTargetID != 0xFFFFFFFF)
|
||
{
|
||
dwNormalTargetID = dwSpecialTargetID;
|
||
}
|
||
}
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
|
||
|
||
if(!lpCreature && dwNormalTargetID != 0xFFFFFFFF)
|
||
{
|
||
lpCreature = GetCreature(dwNormalTargetID);
|
||
if(lpCreature)
|
||
{
|
||
bAvailableTarget = TRUE;
|
||
}
|
||
else
|
||
{
|
||
dwNormalTargetID = 0xFFFFFFFF;
|
||
}
|
||
}
|
||
|
||
if(!lpSpecialCreature && dwSpecialTargetID != 0xFFFFFFFF)
|
||
{
|
||
lpSpecialCreature = GetCreature(dwSpecialTargetID);
|
||
if(!lpSpecialCreature)
|
||
{
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
}
|
||
}
|
||
|
||
if(lpCreature)
|
||
{
|
||
if(lpCreature->m_bCharDead || lpCreature->m_dwChrID == m_lstCharData[m_nFocusCharacter]->m_dwChrID)
|
||
{
|
||
dwNormalTargetID = 0xFFFFFFFF;
|
||
lpCreature = NULL;
|
||
bAvailableTarget = FALSE;
|
||
}
|
||
}
|
||
|
||
if(m_bAutoTargetAttack)
|
||
{
|
||
CCreature *lpTarget = GetCreature(m_dwAutoTargetID);
|
||
if(lpTarget)
|
||
{
|
||
if(lpTarget->m_bCharDead)
|
||
{
|
||
m_bAutoTargetAttack = false;
|
||
m_dwAutoTargetID = 0xFFFFFFFF;
|
||
}
|
||
} else
|
||
{
|
||
m_bAutoTargetAttack = false;
|
||
m_dwAutoTargetID = 0xFFFFFFFF;
|
||
}
|
||
|
||
if(m_dwAutoTargetID != 0xFFFFFFFF) dwNormalTargetID = m_dwAutoTargetID;
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
|
||
unsigned long dwFunction;
|
||
if((g_DeviceInput.GetIsLeftMousePress() && bLeftMousePress) || (g_DeviceInput.GetIsRightMousePress() && bRightMousePress) || (CheckStillCasting && CheckStillCasting(dwFunction)))
|
||
{
|
||
if((g_DeviceInput.GetIsLeftMousePress() && bLeftMousePress) || (g_DeviceInput.GetIsRightMousePress() && bRightMousePress))
|
||
{
|
||
CSceneManager::PickMakeRay(MouseX, MouseY, BaseGraphicsLayer::m_lScreenSx, BaseGraphicsLayer::m_lScreenSy);
|
||
vector3 vecStart = CSceneManager::m_vecPickRayStart;
|
||
vector3 vecEnd = CSceneManager::m_vecPickRayStart + 1000000.0f * CSceneManager::m_vecPickRayDir;
|
||
|
||
vector3 vecPoly[4];
|
||
float fSize = 1000000.0f;
|
||
vecPoly[0] = vecChrPos + vector3(-fSize, 0.0f, -fSize);
|
||
vecPoly[1] = vecChrPos + vector3(fSize, 0.0f, -fSize);
|
||
vecPoly[2] = vecChrPos + vector3(-fSize, 0.0f, fSize);
|
||
vecPoly[3] = vecChrPos + vector3(fSize, 0.0f, fSize);
|
||
|
||
float fInter;
|
||
if(CIntersection::PolygonRay(vecStart, vecEnd, vecPoly, fInter))
|
||
{
|
||
m_vecClickPos = vecStart + (fInter * CSceneManager::m_vecPickRayDir);
|
||
}
|
||
else if(CIntersection::PolygonRay(vecStart, vecEnd, &vecPoly[1], fInter))
|
||
{
|
||
m_vecClickPos = vecStart + (fInter * CSceneManager::m_vecPickRayDir);
|
||
} else
|
||
{
|
||
m_vecClickPos = CSceneManager::PickMousePos(MouseX, MouseY);
|
||
}
|
||
}
|
||
|
||
if(lpCreature)
|
||
{
|
||
if(lpCreature->m_lpChrModel)
|
||
m_vecClickPos = lpCreature->m_lpChrModel->GetPosition();
|
||
else
|
||
m_vecClickPos = lpCreature->m_vecPos;
|
||
|
||
vector3 vecLen = m_vecClickPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecLen.y = 0.0f;
|
||
|
||
float fTargetLength = vecLen.GetLens();
|
||
|
||
if(g_DeviceInput.GetIsLeftMousePress())// && dwNormalTargetID != 0xFFFFFFFF)
|
||
{
|
||
switch(GetClientType(lpCreature->m_dwChrID, TRUE))
|
||
{
|
||
case CT_PC:
|
||
// <20>̵<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||
if(dwNormalTargetID != 0xFFFFFFFF)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = TRUE;
|
||
} else
|
||
{
|
||
m_bClickMove = true;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
break;
|
||
|
||
case CT_NPC:
|
||
// <20>̵<EFBFBD> <20><> <20><>ȭ
|
||
if(dwNormalTargetID != 0xFFFFFFFF)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = TRUE;
|
||
} else
|
||
{
|
||
m_bClickMove = true;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
break;
|
||
|
||
case CT_MONSTER:
|
||
if(g_DeviceInput.GetIsLeftMouseDown())
|
||
{
|
||
if(m_bAttackable)
|
||
m_bAttackResult = TRUE;
|
||
else
|
||
m_bAttackResult = FALSE;
|
||
}
|
||
|
||
// <20>̵<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||
if(m_bAttackable)
|
||
{
|
||
if(dwNormalTargetID != 0xFFFFFFFF)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = true;
|
||
bClickPlayerAndNpc = FALSE;
|
||
} else
|
||
{
|
||
m_bClickMove = true;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
} else
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
if(lpSpecialCreature)
|
||
{
|
||
/////////// <20><>ų <20><><EFBFBD><EFBFBD>
|
||
unsigned long dwFunction;
|
||
if(CheckStillCasting(dwFunction))
|
||
{
|
||
// Ÿ<><C5B8> <20><><EFBFBD><EFBFBD> üũ
|
||
|
||
switch(GetClientType(lpSpecialCreature->m_dwChrID, TRUE))
|
||
{
|
||
case CT_PC:
|
||
// <20>̵<EFBFBD> <20><> <20><>ų
|
||
if(dwSpecialTargetID != 0xFFFFFFFF)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
bClickSkill = TRUE;
|
||
} else
|
||
{
|
||
m_bClickMove = true;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
bClickSkill = FALSE;
|
||
}
|
||
break;
|
||
|
||
/* case CT_NPC:
|
||
// <20>̵<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||
break;*/
|
||
|
||
case CT_MONSTER:
|
||
// <20>̵<EFBFBD> <20><> <20><>ų (Ÿ<><C5B8><EFBFBD><EFBFBD> <20><> <20>Ǹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.)
|
||
if(dwSpecialTargetID != 0xFFFFFFFF)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
bClickSkill = TRUE;
|
||
} else
|
||
{
|
||
m_bClickMove = true;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
bClickSkill = FALSE;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
if((g_DeviceInput.GetIsLeftMousePress() && bLeftMousePress) || (g_DeviceInput.GetIsRightMousePress() && bRightMousePress))
|
||
{
|
||
if(!lpCreature && !lpSpecialCreature)
|
||
{
|
||
vector3 vecLen = m_vecClickPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecLen.y = 0.0f;
|
||
|
||
if(vecLen.GetLens() <= TARGETNEAR_RANGE)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
} else
|
||
{
|
||
// <20>̵<EFBFBD>
|
||
m_bClickMove = true;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if(dwNormalTargetID != 0xFFFFFFFF || dwSpecialTargetID != 0xFFFFFFFF)
|
||
{
|
||
SetAutoRun(FALSE);
|
||
}
|
||
|
||
if(!m_bKeyPress)
|
||
{
|
||
if(GetAutoRun && GetAutoRun())
|
||
{
|
||
SetKillCounter(0);
|
||
|
||
if(bKeyAble && !bEdge && !g_DeviceInput.GetIsMiddleMousePress())
|
||
{
|
||
CSceneManager::PickMakeRay(MouseX, MouseY, BaseGraphicsLayer::m_lScreenSx, BaseGraphicsLayer::m_lScreenSy);
|
||
vector3 vecStart = CSceneManager::m_vecPickRayStart;
|
||
vector3 vecEnd = CSceneManager::m_vecPickRayStart + 1000000.0f * CSceneManager::m_vecPickRayDir;
|
||
|
||
vector3 vecPoly[4];
|
||
float fSize = 1000000.0f;
|
||
vecPoly[0] = vecChrPos + vector3(-fSize, 0.0f, -fSize);
|
||
vecPoly[1] = vecChrPos + vector3(fSize, 0.0f, -fSize);
|
||
vecPoly[2] = vecChrPos + vector3(-fSize, 0.0f, fSize);
|
||
vecPoly[3] = vecChrPos + vector3(fSize, 0.0f, fSize);
|
||
|
||
float fInter;
|
||
if(CIntersection::PolygonRay(vecStart, vecEnd, vecPoly, fInter))
|
||
{
|
||
m_vecClickPos = vecStart + (fInter * CSceneManager::m_vecPickRayDir);
|
||
}
|
||
else if(CIntersection::PolygonRay(vecStart, vecEnd, &vecPoly[1], fInter))
|
||
{
|
||
m_vecClickPos = vecStart + (fInter * CSceneManager::m_vecPickRayDir);
|
||
} else
|
||
{
|
||
m_vecClickPos = CSceneManager::PickMousePos(MouseX, MouseY);
|
||
}
|
||
} else
|
||
{
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->m_fDirection;
|
||
fChrDir = -fChrDir;
|
||
fChrDir -= FLOAT_PHI / 2.0f;
|
||
|
||
vector3 vecToward;
|
||
vecToward.x = cosf(fChrDir);
|
||
vecToward.z = sinf(fChrDir);
|
||
vecToward.y = 0.0f;
|
||
vecToward.Normalize();
|
||
vecToward *= 100.0f;
|
||
m_vecClickPos = m_lstCharData[m_nFocusCharacter]->m_vecPos + vecToward;
|
||
}
|
||
|
||
m_bClickMove = true;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
} else
|
||
{
|
||
SetAutoRun(FALSE);
|
||
}
|
||
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
{
|
||
////////////////////////////////////////////////////////////
|
||
/////////Ŭ<><C5AC><EFBFBD>ؼ<EFBFBD> <20>̵<EFBFBD>
|
||
////////////////////////////////////////////////////////////
|
||
if(m_bClickMove)
|
||
{
|
||
SetKillCounter(0);
|
||
|
||
vecChrToward = m_vecClickPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecChrToward.y = 0.0f;
|
||
|
||
if(m_nSelectItem != 0xFFFFFFFF)
|
||
{
|
||
if(vecChrToward.GetLens() <= 300.0f)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
|
||
if(PickItem) PickItem(m_nSelectItem);
|
||
m_nSelectItem = 0xFFFFFFFF;
|
||
} else
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(25) && !m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
SetDirectionforMouse(vecChrToward);
|
||
m_lstCharData[m_nFocusCharacter]->Run(0.0f);
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
if(GetAutoRun && !GetAutoRun() && vecChrToward.GetLens() <= TARGETNEAR_RANGE)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
} else
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(25) && !m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
SetDirectionforMouse(vecChrToward);
|
||
m_lstCharData[m_nFocusCharacter]->Run(0.0f);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////////////////
|
||
/////////Ŭ<><C5AC><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20>ִ<EFBFBD><D6B4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||
////////////////////////////////////////////////////////////
|
||
if(m_bClickAttack)
|
||
{
|
||
SetKillCounter(0);
|
||
|
||
CCreature *lpTargetCreature = GetCreature(dwNormalTargetID);
|
||
|
||
if(lpTargetCreature)
|
||
{
|
||
vecChrToward = lpTargetCreature->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecChrToward.y = 0.0f;
|
||
|
||
unsigned long dwType = GetWeaponType(m_lstCharData[m_nFocusCharacter]->m_strShape[11 + m_lstCharData[m_nFocusCharacter]->m_dwWeaponPos]);
|
||
|
||
float fLength = 1800.0f;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_wClass == 8) fLength += 600.0f; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD>
|
||
|
||
if(m_bAttackable && (((dwType == 12 || dwType == 13) && vecChrToward.GetLens() <= fLength) || vecChrToward.GetLens() <= ATTACKABLE_RANGE))
|
||
{
|
||
m_dwNormalTargetMonsterID = lpTargetCreature->m_dwChrID;
|
||
|
||
if(!m_bAutoTargetAttack)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
SetDirectionforMouse(vecChrToward);
|
||
|
||
if(m_lstCharData[m_nFocusCharacter]->Attack())
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(25) && !m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
SetDirectionforMouse(vecChrToward);
|
||
m_lstCharData[m_nFocusCharacter]->Run(0.0f);
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
dwNormalTargetID = 0xFFFFFFFF;
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////////////////
|
||
/////////Ŭ<><C5AC><EFBFBD>ؼ<EFBFBD> <20><>ȭ / <20><><EFBFBD><EFBFBD>
|
||
////////////////////////////////////////////////////////////
|
||
if(bClickPlayerAndNpc)
|
||
{
|
||
SetKillCounter(0);
|
||
|
||
CCreature *lpTargetCreature = GetCreature(dwNormalTargetID);
|
||
|
||
if(lpTargetCreature)
|
||
{
|
||
vecChrToward = lpTargetCreature->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecChrToward.y = 0.0f;
|
||
|
||
if(vecChrToward.GetLens() <= PLAYERTARGETNEAR_RANGE)
|
||
{
|
||
switch(GetClientType(lpTargetCreature->m_dwChrID, TRUE))
|
||
{
|
||
case CT_PC:
|
||
if(g_DeviceInput.KeyHold(VK_SHIFT))
|
||
{
|
||
m_bCharacterTargetNear = TRUE;
|
||
m_dwNormalTargetID = dwNormalTargetID;
|
||
}
|
||
break;
|
||
|
||
case CT_NPC:
|
||
{
|
||
m_bCharacterTargetNear = TRUE;
|
||
m_dwNormalTargetID = dwNormalTargetID;
|
||
}
|
||
break;
|
||
}
|
||
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
dwNormalTargetID = 0xFFFFFFFF;
|
||
SetDirectionforMouse(vecChrToward);
|
||
} else
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(25) && !m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
SetDirectionforMouse(vecChrToward);
|
||
m_lstCharData[m_nFocusCharacter]->Run(0.0f);
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
dwNormalTargetID = 0xFFFFFFFF;
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////////////////
|
||
/////////Ŭ<><C5AC><EFBFBD>ؼ<EFBFBD> <20><>ų
|
||
////////////////////////////////////////////////////////////
|
||
if(bClickSkill)
|
||
{
|
||
SetKillCounter(0);
|
||
|
||
CCreature *lpTargetCreature = GetCreature(dwSpecialTargetID);
|
||
|
||
if(lpTargetCreature)
|
||
{
|
||
vecChrToward = lpTargetCreature->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecChrToward.y = 0.0f;
|
||
|
||
if(vecChrToward.GetLens() <= m_fSkillLength)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
bClickSkill = FALSE;
|
||
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
SetDirectionforMouse(vecChrToward);
|
||
|
||
// <20><>ų ij<><C4B3><EFBFBD><EFBFBD>
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
if(CT != CT_WATER && !m_lstCharData[m_nFocusCharacter]->m_bSitMode)
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_LEFTDASH && m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_RIGHTDASH && m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_BACKDASH)
|
||
{
|
||
m_dwSpecialTargetID = dwSpecialTargetID;
|
||
m_lstCharData[m_nFocusCharacter]->m_bStillCasting = TRUE;
|
||
|
||
// <20><> <20><>ų<EFBFBD><C5B3> <20>ν<EFBFBD><CEBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>ٷ<EFBFBD> <20>ߵ<EFBFBD> <20>ȴ<EFBFBD>.
|
||
m_dwStartSkillTick = timeGetTime();
|
||
m_dwCastingSkillTick = 0;
|
||
m_dwCastingSkillGrade = 0;
|
||
}
|
||
} else
|
||
{
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
}
|
||
} else
|
||
{
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
}
|
||
} else
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(25) && !m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
SetDirectionforMouse(vecChrToward);
|
||
m_lstCharData[m_nFocusCharacter]->Run(0.0f);
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
dwSpecialTargetID = 0xFFFFFFFF;
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
bClickPlayerAndNpc = FALSE;
|
||
bClickSkill = FALSE;
|
||
}
|
||
}
|
||
|
||
if(!m_bClickMove && !m_bClickAttack && !bClickPlayerAndNpc && !bClickSkill)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
}
|
||
}/**/
|
||
|
||
if(!GetAttacking())
|
||
{
|
||
if(SetChangeWeapon) SetChangeWeapon(FALSE);
|
||
}
|
||
|
||
vecChrToward.Normalize();
|
||
switch(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction)
|
||
{
|
||
case CA_RUN:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * (m_fRunSpeed / 35.0f));
|
||
break;
|
||
|
||
case CA_WALK:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * (m_fWalkSpeed / 35.0f));
|
||
break;
|
||
|
||
default:
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vector3(0.0f, 0.0f, 0.0f));
|
||
break;
|
||
}
|
||
|
||
if(bAvailableTarget && lpCreature && lpCreature->m_lpChrModel) // <20>ڽ<EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> Ÿ<><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>½
|
||
{
|
||
vector3 vecLightChrPos = *lpCreature->GetPosition();
|
||
CSceneManager::AddChrLight(lpCreature->m_lpChrModel, vecLightChrPos + vector3(0.0f, 200.0f, 0.0f), 0xff0022ff, 400.0f, 6);
|
||
}
|
||
|
||
PlayerProcessOperation(bKeyAble);
|
||
|
||
if(CFrameTimer::GetUpdateTimer(m_nCharMovingPacketTimerID) >= 1.0f && m_lstCharData[m_nFocusCharacter]->IsCancelAction(2))
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WALK ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_RUN ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WALKBACK ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WALKLEFT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WALKRIGHT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_REST ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WAIT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_SHOT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_JUMPSHOT ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_FIRE1 ||
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_FIRE2)
|
||
{
|
||
vecChrToward.Normalize();
|
||
vecChrLeft.Normalize();
|
||
|
||
vector3 vecMove;
|
||
switch(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction)
|
||
{
|
||
case CA_WALK:
|
||
vecMove = vecChrToward * (m_fWalkSpeed / 4.0f);
|
||
break;
|
||
|
||
case CA_RUN:
|
||
vecMove = vecChrToward * (m_fRunSpeed / 4.0f);
|
||
break;
|
||
|
||
default:
|
||
vecMove = vector3(0.0f, 0.0f, 0.0f);
|
||
break;
|
||
}
|
||
|
||
vecMove += m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
if(CT == CT_WATER)
|
||
{
|
||
WrapSendMovingPacket(CA_SWIM, CA_SWIM, m_lstCharData[m_nFocusCharacter]->m_fDirection, vecMove);
|
||
} else
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection, vecMove);
|
||
}
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
if(m_nFocusCharacter == -1)
|
||
return;
|
||
|
||
if(m_lstCharData.num==0)
|
||
return;
|
||
|
||
CSceneManager::CharacterCollisionDetectType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,CDT_FULL);
|
||
|
||
float fAngle = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection();
|
||
vector3 vecChrPos = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition();
|
||
|
||
// if(m_pEnemyAttackEff==NULL)
|
||
{
|
||
// m_pEnemyAttackEff=new CEffScript;
|
||
|
||
// CSceneManager::AddEffectScript(m_pEnemyAttackEff);
|
||
// m_pEnemyAttackEff->GetScriptData("inter-enemyattack.esf");
|
||
// m_pEnemyAttackEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyAttackEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
}
|
||
|
||
////////////////// <20><><EFBFBD>콺 <20><><EFBFBD><EFBFBD> <20><>ư <20><><EFBFBD><EFBFBD>
|
||
static bool bMouseLeftButtonStateChange = false;
|
||
static bool m_bMouseLeftButtonStatePress = false;
|
||
static bool bMouseRightButtonStateChange = false;
|
||
static bool m_bMouseRightButtonStatePress= false;
|
||
static int m_nSkillType=0;//0 Ÿ<>ݱ<EFBFBD> 1 <20><><EFBFBD>Ÿ<EFBFBD> 2 <20><><EFBFBD><EFBFBD>
|
||
|
||
if(KeyPressed(VK_LBUTTON))
|
||
{
|
||
if(m_bMouseLeftButtonStatePress)
|
||
bMouseLeftButtonStateChange = false;
|
||
else
|
||
bMouseLeftButtonStateChange = false;
|
||
m_bMouseLeftButtonStatePress = true;
|
||
}
|
||
else
|
||
{
|
||
if(m_bMouseLeftButtonStatePress)
|
||
bMouseLeftButtonStateChange = true;
|
||
else
|
||
bMouseLeftButtonStateChange = false;
|
||
m_bMouseLeftButtonStatePress = false;
|
||
}
|
||
|
||
if(KeyPressed(VK_RBUTTON))
|
||
{
|
||
if(m_bMouseRightButtonStatePress)
|
||
bMouseRightButtonStateChange = true;
|
||
else
|
||
bMouseRightButtonStateChange = false;
|
||
m_bMouseRightButtonStatePress = false;
|
||
|
||
}
|
||
//////////////////////////////////////////////////////////////
|
||
|
||
if(m_bClientUsed)
|
||
{
|
||
MouseX = g_DeviceInput.GetMousePosition()->x;
|
||
MouseY = g_DeviceInput.GetMousePosition()->y;
|
||
}
|
||
|
||
unsigned long dwFunction;
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bStillCasting && !CheckStillCasting(dwFunction))
|
||
{
|
||
m_bSkillExecuted = TRUE;
|
||
}
|
||
m_lstCharData[m_nFocusCharacter]->InitChrAction();
|
||
|
||
CheckAttackedTiming();
|
||
CheckCameraShakeTiming();
|
||
|
||
vector3 vecChrToward = vector3(0.0f, 0.0f, 0.0f);
|
||
if(bKeyAble)
|
||
{
|
||
bool m_bKeyPress = false;
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
// <20><>ų <20><><EFBFBD><EFBFBD>
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bStillCasting && g_DeviceInput.GetIsRightMousePress())
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->Casting())
|
||
{
|
||
m_bKeyPress = true;
|
||
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
|
||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||
// <20><>ų <20>ߵ<EFBFBD>
|
||
if(CT != CT_WATER && !m_lstCharData[m_nFocusCharacter]->m_bSitMode)
|
||
{
|
||
if(g_DeviceInput.GetIsRightMouseDown() &&
|
||
(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_LEFTDASH && m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_RIGHTDASH && m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction != CA_BACKDASH))
|
||
{
|
||
m_bKeyPress = true;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_bStillCasting = TRUE;
|
||
|
||
// <20><> <20><>ų<EFBFBD><C5B3> <20>ν<EFBFBD><CEBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>ٷ<EFBFBD> <20>ߵ<EFBFBD> <20>ȴ<EFBFBD>.
|
||
m_dwStartSkillTick = timeGetTime();
|
||
m_dwCastingSkillTick = 0;
|
||
m_dwCastingSkillGrade = 0;
|
||
}
|
||
}
|
||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
||
if(!m_bKeyPress)
|
||
{
|
||
///////////////////////////////////////////// <20><><EFBFBD>콺<EFBFBD><ECBDBA> <20><>ŷ<EFBFBD><C5B7> ij<><C4B3> ã<><C3A3>
|
||
CZ3DGeneralChrModel *pSelectChr = NULL;
|
||
pSelectChr = CSceneManager::PickingCharacter(MouseX, MouseY);
|
||
|
||
if(pSelectChr)
|
||
{
|
||
CCreature *lpCreature = GetCreature(pSelectChr);
|
||
|
||
if(lpCreature)
|
||
{
|
||
if(lpCreature->m_bCharDead == TRUE)
|
||
{
|
||
lpCreature = NULL;
|
||
}
|
||
}
|
||
|
||
if(lpCreature)
|
||
{
|
||
if(lpCreature->m_lpChrModel != m_lstCharData[m_nFocusCharacter]->m_lpChrModel)
|
||
{
|
||
vector3 vecLightChrPos;
|
||
lpCreature->m_lpChrModel->GetPosition(vecLightChrPos);
|
||
CSceneManager::AddChrLight(lpCreature->m_lpChrModel, vecLightChrPos + vector3(0.0f, 200.0f, 0.0f), 0xff0022ff, 400.0f, 6);
|
||
if(( GetClientType(lpCreature->m_dwChrID, TRUE)==CT_MONSTER || GetClientType(lpCreature->m_dwChrID)==CT_NPC )&& m_bClientUsed && (m_bMouseLeftButtonStatePress || KeyPressed(VK_RBUTTON)) )
|
||
{
|
||
vector3 vecResult,vecTargetMonsterPos;
|
||
float fW;
|
||
|
||
lpCreature->m_lpChrModel->GetPosition(vecTargetMonsterPos);
|
||
vecTargetMonsterPos=vecTargetMonsterPos+vector3(0.0f,100.0f,0.0f);
|
||
BaseGraphicsLayer::TransformVector(vecTargetMonsterPos,vecResult,fW);
|
||
g_DeviceInput.SetCursorPos((int)vecResult.x,(int)vecResult.y);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
//////////////////////////////////////////////////////////////
|
||
//////// <20><>Ʈ<EFBFBD><C6AE> Ű<><C5B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڸ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
//////////////////////////////////////////////////////////////
|
||
if(bMouseLeftButtonStateChange==false && KeyPressed(VK_LBUTTON) && KeyPressed(VK_CONTROL))
|
||
{
|
||
CSceneManager::PickMakeRay(MouseX, MouseY, BaseGraphicsLayer::m_lScreenSx, BaseGraphicsLayer::m_lScreenSy);
|
||
vector3 vecStart = CSceneManager::m_vecPickRayStart;
|
||
vector3 vecEnd = CSceneManager::m_vecPickRayStart + 10000.0f * CSceneManager::m_vecPickRayDir;
|
||
|
||
vector3 vecPoly[4];
|
||
float fSize = 10000.0f;
|
||
vecPoly[0] = vecChrPos + vector3(-fSize, 0.0f, -fSize);
|
||
vecPoly[1] = vecChrPos + vector3(fSize, 0.0f, -fSize);
|
||
vecPoly[2] = vecChrPos + vector3(-fSize, 0.0f, fSize);
|
||
vecPoly[3] = vecChrPos + vector3(fSize, 0.0f, fSize);
|
||
|
||
float fInter;
|
||
|
||
vector3 vecMovePos;
|
||
if(CIntersection::PolygonRay(vecStart, vecEnd, vecPoly, fInter))
|
||
{
|
||
vecMovePos = vecStart + (fInter * CSceneManager::m_vecPickRayDir);
|
||
}
|
||
else if(CIntersection::PolygonRay(vecStart, vecEnd, &vecPoly[1], fInter))
|
||
{
|
||
vecMovePos = vecStart + (fInter * CSceneManager::m_vecPickRayDir);
|
||
}
|
||
|
||
vector3 vecMoveDirection = vecMovePos - vecChrPos;
|
||
SetDirectionforMouse(vecMoveDirection);
|
||
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->Attack())
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
|
||
m_bClickMove=false;
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////////////////
|
||
/////////Ŭ<><C5AC><EFBFBD>ؼ<EFBFBD> <20>̵<EFBFBD>
|
||
////////////////////////////////////////////////////////////
|
||
if(m_bClickMove)
|
||
{
|
||
vecChrToward = m_vecClickPos - vecChrPos;
|
||
vecChrToward.y = 0.0f;
|
||
|
||
if(vecChrToward.GetLens() <= TARGETNEAR_RANGE)
|
||
{
|
||
m_bClickMove = false;
|
||
|
||
if(m_nSelectItem!=0xffffffff)
|
||
{
|
||
if(PickItem)
|
||
PickItem(m_nSelectItem);
|
||
m_nSelectItem=0xffffffff;
|
||
}
|
||
return;
|
||
}
|
||
SetDirectionforMouse(vecChrToward);
|
||
m_lstCharData[m_nFocusCharacter]->Run(0.0f);
|
||
if(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_RUN)
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * (14.0f));
|
||
} else if(m_bClickAttack)
|
||
{
|
||
////////////////////////////////////////////////////////////
|
||
/////////Ŭ<><C5AC><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD> ( <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20>ִ<EFBFBD><D6B4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
////////////////////////////////////////////////////////////
|
||
CCreature *pCreature = GetCreature(m_dwClickModeAttackTargetID);
|
||
if(pCreature == NULL)
|
||
{
|
||
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
// m_pEnemyAttackEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyAttackEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
return;
|
||
}
|
||
vector3 vecTargetPos;
|
||
if(pCreature->m_lpChrModel==NULL)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
}
|
||
else
|
||
{
|
||
vecTargetPos=pCreature->m_lpChrModel->GetPosition();
|
||
}
|
||
|
||
vecChrToward = vecTargetPos - vecChrPos;
|
||
vecChrToward.y = 0.0f;
|
||
|
||
if(vecChrToward.GetLens() <= ATTACKABLE_RANGE)
|
||
{
|
||
m_bClickMove = false;
|
||
m_bClickAttack = false;
|
||
|
||
switch(GetClientType(pCreature->m_dwChrID, TRUE))
|
||
{
|
||
case CT_PC:
|
||
if(g_DeviceInput.KeyHold(VK_SHIFT))
|
||
m_bCharacterTargetNear = TRUE;
|
||
break;
|
||
|
||
case CT_NPC:
|
||
m_bCharacterTargetNear = TRUE;
|
||
break;
|
||
}
|
||
|
||
if(m_nSkillType==0 && KeyPressed(VK_RBUTTON) && !m_lstCharData[m_nFocusCharacter]->m_bStillCasting)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_bStillCasting = TRUE;
|
||
m_dwStartSkillTick = timeGetTime();
|
||
m_dwCastingSkillTick = 0;
|
||
m_dwCastingSkillGrade = 0;
|
||
}
|
||
}
|
||
|
||
SetDirectionforMouse(vecChrToward);
|
||
m_lstCharData[m_nFocusCharacter]->Run(0.0f);
|
||
if(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_RUN)
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward * (14.0f));
|
||
} else
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
}
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward);
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////////////////
|
||
/////////<2F>ڵ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
////////////////////////////////////////////////////////////
|
||
if(m_bAutoTargetAttack)
|
||
{
|
||
CCreature *pAutoTargetChr = GetCreature(m_dwClickModeAttackTargetID);
|
||
|
||
if(pAutoTargetChr && pAutoTargetChr->m_bCharDead==TRUE)
|
||
{
|
||
m_dwClickModeAttackTargetID = 0xFFFFFFFF;
|
||
m_bClickAttack=false;
|
||
m_bClickMove=false;
|
||
// m_pEnemyAttackEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyAttackEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
}
|
||
|
||
if(pAutoTargetChr && pAutoTargetChr->m_lpChrModel && pAutoTargetChr->m_lpChrModel!=m_lstCharData[m_nFocusCharacter]->m_lpChrModel && pAutoTargetChr->m_bCharDead==FALSE)
|
||
{
|
||
vector3 vecTargetChrPos,vecLens;
|
||
pAutoTargetChr->m_lpChrModel->GetPosition(vecTargetChrPos);
|
||
vecLens=vecTargetChrPos-vecChrPos;
|
||
|
||
// m_pEnemyAttackEff->SetStartPos(vecTargetChrPos.x,vecTargetChrPos.y,vecTargetChrPos.z);
|
||
// m_pEnemyAttackEff->SetEndPos(vecTargetChrPos.x,vecTargetChrPos.y,vecTargetChrPos.z);
|
||
|
||
|
||
if(vecLens.GetLens() < ATTACKABLE_RANGE)
|
||
{
|
||
vector3 vecMoveDirection;
|
||
vecMoveDirection=vecTargetChrPos-vecChrPos;
|
||
SetDirectionforMouse(vecMoveDirection);
|
||
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->Attack())
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
|
||
m_bClickAttack=false;
|
||
m_bClickMove=false;
|
||
|
||
// m_pEnemyAttackEff->SetStartPos(vecTargetChrPos.x,vecTargetChrPos.y+30.0f,vecTargetChrPos.z);
|
||
// m_pEnemyAttackEff->SetEndPos(vecTargetChrPos.x,vecTargetChrPos.y+30.0f,vecTargetChrPos.z);
|
||
}
|
||
else
|
||
{
|
||
m_dwClickModeAttackTargetID = pAutoTargetChr->m_dwChrID;
|
||
m_bClickAttack=true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
m_dwClickModeAttackTargetID = 0xFFFFFFFF;
|
||
m_bClickAttack=false;
|
||
m_bClickMove=false;
|
||
}
|
||
}
|
||
|
||
|
||
///////////////////////////////////////////////////
|
||
///////////////
|
||
///////////////////////////////////////////////////
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead && (bMouseLeftButtonStateChange || KeyPressed(VK_LBUTTON) || KeyPressed(VK_RBUTTON)))
|
||
{
|
||
vector3 vecMovePos;
|
||
if(bMouseLeftButtonStateChange)
|
||
{ // <20><><EFBFBD>콺 <20><><EFBFBD><EFBFBD> <20><>ư<EFBFBD><C6B0> Click<63><6B><EFBFBD><EFBFBD> <20><>
|
||
vecMovePos = CSceneManager::PickMousePos(MouseX,MouseY);
|
||
if(vecMovePos.GetLens()<=10.0f)
|
||
return;
|
||
|
||
CEffScript *pMousePointEff;
|
||
pMousePointEff=new CEffScript;
|
||
CSceneManager::AddEffectScript(pMousePointEff);
|
||
|
||
pMousePointEff->GetScriptData("point.esf");
|
||
pMousePointEff->SetStartPos(vecMovePos.x, vecMovePos.y + 30.0f, vecMovePos.z);
|
||
pMousePointEff->SetEndPos(vecMovePos.x, vecMovePos.y + 30.0f,vecMovePos.z);
|
||
|
||
POINT *ptMousePos = g_DeviceInput.GetMousePosition();
|
||
m_nSelectItem = CSceneManager::MouseOnCheckInstanceObject(ptMousePos->x, ptMousePos->y);
|
||
}
|
||
else if(KeyPressed(VK_LBUTTON))
|
||
{ // <20><><EFBFBD>콺 <20><><EFBFBD><EFBFBD> <20><>ư<EFBFBD><C6B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
CSceneManager::PickMakeRay(MouseX, MouseY, BaseGraphicsLayer::m_lScreenSx, BaseGraphicsLayer::m_lScreenSy);
|
||
vector3 vecStart = CSceneManager::m_vecPickRayStart;
|
||
vector3 vecEnd = CSceneManager::m_vecPickRayStart + 10000.0f * CSceneManager::m_vecPickRayDir;
|
||
|
||
vector3 vecPoly[4];
|
||
float fSize = 10000.0f;
|
||
vecPoly[0] = vecChrPos + vector3(-fSize, 0.0f, -fSize);
|
||
vecPoly[1] = vecChrPos + vector3(fSize, 0.0f, -fSize);
|
||
vecPoly[2] = vecChrPos + vector3(-fSize, 0.0f, fSize);
|
||
vecPoly[3] = vecChrPos + vector3(fSize, 0.0f, fSize);
|
||
|
||
float fInter;
|
||
if(CIntersection::PolygonRay(vecStart, vecEnd, vecPoly, fInter))
|
||
{
|
||
vecMovePos = vecStart + (fInter * CSceneManager::m_vecPickRayDir);
|
||
}
|
||
else if(CIntersection::PolygonRay(vecStart, vecEnd, &vecPoly[1], fInter))
|
||
{
|
||
vecMovePos = vecStart + (fInter * CSceneManager::m_vecPickRayDir);
|
||
}
|
||
}
|
||
|
||
float fMaxLens = 200.0f;
|
||
m_dwClickModeAttackTargetID = 0xFFFFFFFF;
|
||
m_vecClickPos = vecMovePos;
|
||
|
||
if(pSelectChr)
|
||
{
|
||
CCreature *lpCreature = GetCreature(pSelectChr);
|
||
|
||
if(lpCreature && lpCreature->m_lpChrModel != m_lstCharData[m_nFocusCharacter]->m_lpChrModel && lpCreature->m_bCharDead==FALSE) // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><>ŷ<EFBFBD><C5B7> <20>Ǿ<EFBFBD><C7BE><EFBFBD> <20><>
|
||
{
|
||
vector3 vecTargetChrPos, vecLens;
|
||
pSelectChr->GetPosition(vecTargetChrPos);
|
||
vecLens = vecTargetChrPos - vecChrPos;
|
||
|
||
if(vecLens.GetLens() < ATTACKABLE_RANGE )
|
||
{
|
||
vector3 vecMoveDirection;
|
||
vecMoveDirection = vecTargetChrPos - vecChrPos;
|
||
SetDirectionforMouse(vecMoveDirection);
|
||
|
||
if(KeyPressed(VK_LBUTTON))
|
||
{
|
||
if(m_lstCharData[m_nFocusCharacter]->Attack())
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
}
|
||
}
|
||
else if(KeyPressed(VK_RBUTTON) && !m_lstCharData[m_nFocusCharacter]->m_bStillCasting)
|
||
{
|
||
if(m_nSkillType==0 || m_nSkillType==1)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_bStillCasting = TRUE;
|
||
m_dwStartSkillTick = timeGetTime();
|
||
m_dwCastingSkillTick = 0;
|
||
m_dwCastingSkillGrade = 0;
|
||
}
|
||
}
|
||
|
||
m_bClickAttack = false;
|
||
m_bClickMove = false;
|
||
|
||
// m_pEnemyAttackEff->SetStartPos(vecTargetChrPos.x,vecTargetChrPos.y+30.0f,vecTargetChrPos.z);
|
||
// m_pEnemyAttackEff->SetEndPos(vecTargetChrPos.x,vecTargetChrPos.y+30.0f,vecTargetChrPos.z);
|
||
}
|
||
else
|
||
{
|
||
if(KeyPressed(VK_RBUTTON) && m_nSkillType==1 && !m_lstCharData[m_nFocusCharacter]->m_bStillCasting)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->m_bStillCasting = TRUE;
|
||
m_dwStartSkillTick = timeGetTime();
|
||
m_dwCastingSkillTick = 0;
|
||
m_dwCastingSkillGrade = 0;
|
||
} else
|
||
{
|
||
m_dwClickModeAttackTargetID = lpCreature->m_dwChrID;
|
||
m_bCharacterTargetNear=FALSE;
|
||
m_bClickAttack = true;
|
||
m_bClickMove = false;
|
||
}
|
||
}
|
||
|
||
if(KeyPressed(VK_CONTROL)) // <20><><EFBFBD><EFBFBD> Ÿ<><C5B8><EFBFBD><EFBFBD>
|
||
{
|
||
m_dwClickModeAttackTargetID = lpCreature->m_dwChrID;
|
||
m_bCharacterTargetNear=FALSE;
|
||
m_bAutoTargetAttack = true;
|
||
m_dwAutoTargetID = m_dwClickModeAttackTargetID;
|
||
}
|
||
else
|
||
{
|
||
m_bAutoTargetAttack = false;
|
||
m_dwAutoTargetID = 0xFFFFFFFF;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
m_dwClickModeAttackTargetID = 0xFFFFFFFF;
|
||
m_bClickAttack = false;
|
||
m_bClickMove = true;
|
||
|
||
// m_pEnemyAttackEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyAttackEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
m_dwClickModeAttackTargetID = 0xFFFFFFFF;
|
||
m_bClickAttack = false;
|
||
// m_pEnemyAttackEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyAttackEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
|
||
if(KeyPressed(VK_RBUTTON))
|
||
m_bClickMove = false;
|
||
else
|
||
m_bClickMove = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(m_bAutoTargetAttack==false)
|
||
{
|
||
// m_pEnemyAttackEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyAttackEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
}
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
// Ű<>Է<EFBFBD><D4B7><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead)
|
||
{
|
||
m_lstCharData[m_nFocusCharacter]->Wait();
|
||
}
|
||
CSceneManager::CharacterMovementVector(m_lstCharData[m_nFocusCharacter]->m_lpChrModel, vecChrToward);
|
||
|
||
// m_pEnemyAttackEff->SetStartPos(0.0f,0.0f,0.0f);
|
||
// m_pEnemyAttackEff->SetEndPos(0.0f,0.0f,0.0f);
|
||
|
||
m_dwClickModeAttackTargetID = 0xFFFFFFFF;
|
||
m_bClickAttack = false;
|
||
m_bClickMove = false;
|
||
// bMouseLeftButtonStateChange = false;
|
||
// m_bMouseLeftButtonStatePress = false;
|
||
}
|
||
|
||
PlayerProcessOperation(bKeyAble);
|
||
|
||
if(CFrameTimer::GetUpdateTimer(m_nCharMovingPacketTimerID) >= 1.0f && m_lstCharData[m_nFocusCharacter]->IsCancelAction(2))
|
||
{
|
||
vector3 vecMove;
|
||
switch(m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction)
|
||
{
|
||
case CA_WALK:
|
||
vecMove = vecChrToward * (m_fWalkSpeed / 4.0f);
|
||
break;
|
||
|
||
case CA_RUN:
|
||
vecMove = vecChrToward * (m_fRunSpeed / 4.0f);
|
||
break;
|
||
|
||
default:
|
||
vecMove = vector3(0.0f, 0.0f, 0.0f);
|
||
break;
|
||
}
|
||
|
||
vecMove += m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
|
||
CollisionType CT = CSceneManager::GetCharacterCollisionType(m_lstCharData[m_nFocusCharacter]->m_lpChrModel);
|
||
|
||
if(CT == CT_WATER)
|
||
{
|
||
WrapSendMovingPacket(CA_SWIM, CA_SWIM, m_lstCharData[m_nFocusCharacter]->m_fDirection, vecMove);
|
||
} else
|
||
{
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection, vecMove);
|
||
}
|
||
}
|
||
/* if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead && CFrameTimer::GetUpdateTimer(m_nCharMoveUpdatePacketTimerID) >= 1.0f)
|
||
{
|
||
float fDir = m_lstCharData[m_nFocusCharacter]->m_fDirection - (FLOAT_PHI / 2.0f);
|
||
vector3 vecPos;
|
||
vecPos.x = m_lstCharData[m_nFocusCharacter]->m_vecPos.x / 100.0f;
|
||
vecPos.y = m_lstCharData[m_nFocusCharacter]->m_vecPos.y / 100.0f;
|
||
vecPos.z = m_lstCharData[m_nFocusCharacter]->m_vecPos.z / 100.0f;
|
||
//CNetwork::SendMoveUpdatePacket(fDir, vecPos);
|
||
WrapSendMoveUpdatePacket(fDir, vecPos);
|
||
}*/
|
||
}
|
||
}
|
||
|
||
CCreature* CCharacterControl::GetCreature(CZ3DGeneralChrModel *pChrmodel)
|
||
{
|
||
for(int cChr=0;cChr<m_lstCharData.num;cChr++)
|
||
{
|
||
if(m_lstCharData[cChr]->m_lpChrModel==pChrmodel)
|
||
{
|
||
return m_lstCharData[cChr];
|
||
}
|
||
}
|
||
return NULL;
|
||
}
|
||
|
||
void CCharacterControl::SetDirectionforMouse(vector3 &vecDirection)
|
||
{
|
||
vecDirection.Normalize();
|
||
vector3 vecZero = vector3(1.0f, 0.0f, 0.0f);
|
||
float fMoveDirection = vecDirection * vecZero;
|
||
|
||
if(fMoveDirection >= 1.0f) fMoveDirection = 1.0f;
|
||
if(fMoveDirection <= -1.0f) fMoveDirection = -1.0f;
|
||
fMoveDirection = acosf(fMoveDirection);
|
||
|
||
if(vecDirection.z < 0.0f)
|
||
{
|
||
fMoveDirection = fMoveDirection;
|
||
} else
|
||
{
|
||
fMoveDirection = (FLOAT_PHI * 2.0f) - fMoveDirection;
|
||
}
|
||
fMoveDirection -= FLOAT_PHI / 2.0f;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->SetDirection(fMoveDirection);
|
||
}
|
||
|
||
void CCharacterControl::PlayerProcessOperation(BOOL bKeyAble)
|
||
{
|
||
if(!bKeyAble) return;
|
||
|
||
if(!m_lstCharData[m_nFocusCharacter]->GetChantFlag(25) && !m_lstCharData[m_nFocusCharacter]->GetChantFlag(26))
|
||
{
|
||
if(!m_lstCharData[m_nFocusCharacter]->m_bCharDead && g_DeviceInput.KeyDown('C'))
|
||
{
|
||
InitGlobalAction();
|
||
m_lstCharData[m_nFocusCharacter]->CrouchAndStandup();
|
||
SetKillCounter(0);
|
||
|
||
WrapSendMovingPacket(m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
|
||
return;
|
||
}
|
||
}
|
||
|
||
/// if(m_lstCharData[m_nFocusCharacter]->m_bCharDead && g_DeviceInput.GetIsLeftMouseDown())
|
||
if(m_lstCharData[m_nFocusCharacter]->m_bCharDead && !m_lstCharData[m_nFocusCharacter]->m_bLowerAnimating && g_DeviceInput.GetIsLeftMouseDown())
|
||
{
|
||
InitGlobalAction();
|
||
SetKillCounter(0);
|
||
|
||
WrapSendCharRespawn(m_lstCharData[m_nFocusCharacter]->m_dwChrID);
|
||
WrapSendMovingPacket(CA_RESPAWN, CA_RESPAWN, m_lstCharData[m_nFocusCharacter]->m_fDirection,
|
||
m_lstCharData[m_nFocusCharacter]->m_vecPos);
|
||
|
||
return;
|
||
}
|
||
}
|
||
|
||
void CCharacterControl::PlaySound(int nMethod,vector3 vecPos)
|
||
{
|
||
char strSoundFilename[256];
|
||
switch(nMethod)
|
||
{
|
||
case 3:
|
||
case 4:
|
||
sprintf(strSoundFilename, "%s%s%d.wav", SOUNDFILEPATH, "Bowhit", rand() % 4);
|
||
break;
|
||
case 200: // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
sprintf(strSoundFilename, "%s%s",SOUNDFILEPATH,"jump2.wav");
|
||
break;
|
||
default:
|
||
sprintf(strSoundFilename, "%s%s%d.mnd", SOUNDFILEPATH, "Attacked", rand() % 5);
|
||
break;
|
||
}
|
||
try
|
||
{
|
||
CSoundManager &sm = CSoundManager::GetInstance();
|
||
ISoundObject &sb = sm.GetBuffer(strSoundFilename, true);
|
||
int nBuffer=sb.Play(false);
|
||
sb.SetPosition(nBuffer,vecPos.x,vecPos.y,vecPos.z);
|
||
switch(nMethod)
|
||
{
|
||
case 3:
|
||
case 4:
|
||
sb.SetDistance(nBuffer, 2000.0f, 2500.0f);
|
||
break;
|
||
case 200:
|
||
sb.SetDistance(nBuffer, 1000.0f, 2000.0f);
|
||
break;
|
||
default:
|
||
sb.SetDistance(nBuffer, 1000.0f, 2000.0f);
|
||
break;
|
||
}
|
||
}
|
||
catch(exception &e)
|
||
{
|
||
static bool bFirstShowMessage=false;
|
||
if(bFirstShowMessage==false)
|
||
{
|
||
MessageBox(NULL,e.what(),0,0);
|
||
bFirstShowMessage=true;
|
||
}
|
||
}
|
||
//sb.Play(false);
|
||
}
|
||
|
||
void CCharacterControl::MakeAttackInfo(DWORD dwEnemyChrID)
|
||
{
|
||
vector3 vecSelfDir,vecEnemyDir;
|
||
float fAngle = (-m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection()) - FLOAT_PHI / 2.0f;
|
||
float fEnemyDirection;
|
||
vecSelfDir.x = cosf(fAngle);
|
||
vecSelfDir.y = 0.0f;
|
||
vecSelfDir.z = sinf(fAngle);
|
||
|
||
vector3 vecLens;
|
||
float fInterLens;
|
||
|
||
matrix matSelfChrPos;
|
||
matSelfChrPos.MakeIdent();
|
||
matSelfChrPos._41 = m_lstCharData[m_nFocusCharacter]->m_vecPos.x;
|
||
matSelfChrPos._43 = m_lstCharData[m_nFocusCharacter]->m_vecPos.z;
|
||
|
||
vector3 vecFirstAttackPos;
|
||
|
||
unsigned long dwDefenser[10];
|
||
ZeroMemory(&dwDefenser, sizeof(unsigned long) * 10);
|
||
int nAttackCount = 0;
|
||
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwChrID==dwEnemyChrID && m_lstCharData[cChr]->m_lpChrModel)
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->GetPosition(vecFirstAttackPos);
|
||
|
||
float fAttackActionRate=rand()%6;
|
||
fAttackActionRate*=0.1f;
|
||
fAttackActionRate+=0.3f;
|
||
|
||
if(fAttackActionRate > 0.5f) fAttackActionRate = 0.5f;
|
||
// fAttackActionRate = 0.9f;
|
||
if(m_lstCharData[cChr]->m_lpChrModel->IsAddonActionFinished(1))
|
||
m_lstCharData[cChr]->m_lpChrModel->AddMotion("ATTACKED", 3, fAttackActionRate);
|
||
|
||
CSceneManager::CharacterRandomPos(m_lstCharData[cChr]->m_lpChrModel, 10, vecSelfDir * 50.0f);
|
||
|
||
CSceneManager::AddChrLight(m_lstCharData[cChr]->m_lpChrModel,vecFirstAttackPos+vector3(0.0f, 100.0f, 0.0f), 0xffff2200, 400.0f, 6);
|
||
|
||
vector3 vecEffectPos=vecFirstAttackPos+vector3(0.0f, 120.0f, 0.0f);
|
||
/* CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
|
||
test_script->GetScriptData("c:\\roundswing.esf");
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter].m_vecPos.x,m_lstCharData[m_nFocusCharacter].m_vecPos.y,m_lstCharData[m_nFocusCharacter].m_vecPos.z);
|
||
// test_script->SetEndPos((D3DXVECTOR3 *)&(m_lstCharData[cChr].m_vecPos),1);
|
||
|
||
CSceneManager::AddEffectScript(test_script);
|
||
*/
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
test_script->GetScriptData("attack1.esf");
|
||
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
//particle
|
||
CX3DEffect *pEffect;
|
||
pEffect=new CX3DEffect;
|
||
CSceneManager::AddEffect(pEffect);
|
||
pEffect->Load(EFFECTPATH,"attack1_particle.eff");
|
||
|
||
pEffect->SetLoop(FALSE);
|
||
|
||
float fAttackAngle=m_lstCharData[cChr]->m_lpChrModel->GetDirection();
|
||
|
||
pEffect->SetAxis(0.0f,-((180.0f*fAngle)/3.14159f)+90.0f+fAttackAngle,0.0f);
|
||
|
||
pEffect->SetCenter(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
|
||
dwDefenser[nAttackCount++] = m_lstCharData[cChr]->m_dwChrID;
|
||
break;
|
||
}
|
||
}
|
||
if(nAttackCount)
|
||
{
|
||
PlaySound(0,vecFirstAttackPos);
|
||
/*
|
||
WrapSendCharAttack(m_lstCharData[m_nFocusCharacter]->m_vecPos,
|
||
m_lstCharData[m_nFocusCharacter]->m_fDirection - FLOAT_PHI / 2.0f,
|
||
wSkill, cSkillLock, cSkillLevel, cAtCount, nAttackCount, dwDefenser);
|
||
*/
|
||
}
|
||
}
|
||
|
||
void CCharacterControl::GetSendCharacterList(List<DWORD> &SendCharacterList)
|
||
{
|
||
/* vector3 vecSelfChrPos,vecChrPos,vecLens;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecSelfChrPos);
|
||
m_lstCharData[m_nFocusCharacter]->m_fSelfChrLens=0.0f;
|
||
for(int i=0;i<m_lstCharData.num;i++)
|
||
{
|
||
if(i == m_nFocusCharacter) continue;
|
||
|
||
if(m_lstCharData[i]->m_lpChrModel)
|
||
{
|
||
m_lstCharData[i]->m_lpChrModel->GetPosition(vecChrPos);
|
||
}
|
||
else
|
||
{
|
||
vecChrPos=m_lstCharData[i]->m_vecPos;
|
||
}
|
||
vecLens=vecSelfChrPos-vecChrPos;
|
||
vecLens.y=0.0f;
|
||
m_lstCharData[i]->m_fSelfChrLens=vecLens.GetLens();
|
||
}
|
||
|
||
qsort(&(m_lstCharData.element[1]), m_lstCharData.num - 1, sizeof(CCreature*), ChrLensCompare);*/
|
||
|
||
static int nTick = 0;
|
||
nTick++;
|
||
|
||
if(nTick >= 4) nTick = 0;
|
||
|
||
if(nTick && (m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_WAIT || m_lstCharData[m_nFocusCharacter]->m_dwLowerChrAction == CA_REST))
|
||
{
|
||
return;
|
||
}
|
||
|
||
int nSendCharacter = 0;
|
||
|
||
List<unsigned long> lstPlayer;
|
||
List<unsigned long> lstParty;
|
||
BOOL bInsert;
|
||
for(int i = 0; i < m_lstCharData.num; i++)
|
||
{
|
||
if(i == m_nFocusCharacter) continue;
|
||
|
||
if(GetClientType(m_lstCharData[i]->m_dwChrID) == CT_PC)
|
||
{
|
||
bInsert = FALSE;
|
||
if(!m_lstCharData[i]->m_bFirstPositionSend)
|
||
{
|
||
bInsert = TRUE;
|
||
SendCharacterList.Add(m_lstCharData[i]->m_dwChrID);
|
||
m_lstCharData[i]->m_bFirstPositionSend = TRUE;
|
||
} else
|
||
{
|
||
lstPlayer.Add(m_lstCharData[i]->m_dwChrID);
|
||
}
|
||
|
||
if(!nTick && m_lstCharData[m_nFocusCharacter]->m_dwPartyID == m_lstCharData[i]->m_dwPartyID && !bInsert)
|
||
{
|
||
lstParty.Add(m_lstCharData[i]->m_dwChrID);
|
||
}
|
||
}
|
||
}
|
||
|
||
int X, Y, y, j;
|
||
|
||
if(30 < lstPlayer.num)
|
||
{
|
||
if(30 < lstPlayer.num && lstPlayer.num <= 100)
|
||
{
|
||
X = ((lstPlayer.num - 21) / 10) * 3;
|
||
Y = 30 - X;
|
||
y = (lstPlayer.num - Y) / X;
|
||
} else
|
||
{
|
||
X = 21;
|
||
Y = 9;
|
||
y = 4;
|
||
}
|
||
|
||
for(i = 0; i < Y; i++)
|
||
{
|
||
SendCharacterList.Add(lstPlayer[i]);
|
||
for(j = 0; j < lstParty.num; j++)
|
||
{
|
||
if(lstPlayer[i] == lstParty[j])
|
||
{
|
||
lstParty.DelIndex(j);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
int A = Y + (nTick % y);
|
||
for(i = 0; i < X; i++)
|
||
{
|
||
if(lstPlayer.num > A)
|
||
{
|
||
SendCharacterList.Add(lstPlayer[A]);
|
||
for(j = 0; j < lstParty.num; j++)
|
||
{
|
||
if(lstPlayer[A] == lstParty[j])
|
||
{
|
||
lstParty.DelIndex(j);
|
||
break;
|
||
}
|
||
}
|
||
A += y;
|
||
} else break;
|
||
}
|
||
} else
|
||
{
|
||
for(i = 0; i < lstPlayer.num; i++)
|
||
{
|
||
SendCharacterList.Add(lstPlayer[i]);
|
||
for(j = 0; j < lstParty.num; j++)
|
||
{
|
||
if(lstPlayer[i] == lstParty[j])
|
||
{
|
||
lstParty.DelIndex(j);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
for(i = 0; i < lstParty.num; i++)
|
||
{
|
||
SendCharacterList.Add(lstParty[i]);
|
||
}
|
||
/* for(i = 0; i < m_lstCharData.num; i++)
|
||
{
|
||
if(m_lstCharData[i]->m_dwChrID == m_lstCharData[m_nFocusCharacter]->m_dwChrID) continue;
|
||
|
||
if(GetClientType(m_lstCharData[i]->m_dwChrID)==CT_PC)
|
||
{
|
||
if(nSendCharacter >= 0 && nSendCharacter < 5)
|
||
{
|
||
SendCharacterList.Add(m_lstCharData[i]->m_dwChrID);
|
||
}
|
||
else if( nSendCharacter >= 5 && nSendCharacter <20 && (nSendCharacter%4)==0)
|
||
{
|
||
SendCharacterList.Add(m_lstCharData[i]->m_dwChrID);
|
||
}
|
||
else if( nSendCharacter >= 20 && (nSendCharacter%40)==0)
|
||
{
|
||
SendCharacterList.Add(m_lstCharData[i]->m_dwChrID);
|
||
}
|
||
else if( m_lstCharData[i]->m_bFirstPositionSend==FALSE )
|
||
{
|
||
SendCharacterList.Add(m_lstCharData[i]->m_dwChrID);
|
||
m_lstCharData[i]->m_bFirstPositionSend=TRUE;
|
||
m_lstCharData[i]->m_dwSpendTime[2] =
|
||
m_lstCharData[i]->m_dwSpendTime[3] = m_lstCharData[i]->m_dwSpendTime[4] = m_lstCharData[i]->m_dwSpendTime[5] = GetTickCount();
|
||
}
|
||
nSendCharacter++;
|
||
}
|
||
}*/
|
||
}
|
||
|
||
void CCharacterControl::GetSendCharacterChatList(List<DWORD> &SendCharacterList)
|
||
{
|
||
vector3 vecSelfChrPos, vecChrPos, vecLens;
|
||
m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetPosition(vecSelfChrPos);
|
||
m_lstCharData[m_nFocusCharacter]->m_fSelfChrLens = 0.0f;
|
||
for(int i = 0; i < m_lstCharData.num; i++)
|
||
{
|
||
if(m_lstCharData[i]->m_dwChrID == m_lstCharData[m_nFocusCharacter]->m_dwChrID) continue;
|
||
|
||
if(m_lstCharData[i]->m_lpChrModel)
|
||
{
|
||
m_lstCharData[i]->m_lpChrModel->GetPosition(vecChrPos);
|
||
}
|
||
else
|
||
{
|
||
vecChrPos = m_lstCharData[i]->m_vecPos;
|
||
}
|
||
|
||
vecLens = vecSelfChrPos - vecChrPos;
|
||
vecLens.y = 0.0f;
|
||
|
||
m_lstCharData[i]->m_fSelfChrLens = vecLens.GetLens();
|
||
|
||
if(m_lstCharData[i]->m_fSelfChrLens <= 6400.0)
|
||
{
|
||
if(GetClientType(m_lstCharData[i]->m_dwChrID) == CT_PC)
|
||
{
|
||
SendCharacterList.Add(m_lstCharData[i]->m_dwChrID);
|
||
}
|
||
} else if(m_lstCharData[i]->m_bFirstPositionSend == FALSE)
|
||
{
|
||
if(GetClientType(m_lstCharData[i]->m_dwChrID) == CT_PC)
|
||
{
|
||
SendCharacterList.Add(m_lstCharData[i]->m_dwChrID);
|
||
m_lstCharData[i]->m_bFirstPositionSend = TRUE;
|
||
m_lstCharData[i]->m_dwSpendTime[2] =
|
||
m_lstCharData[i]->m_dwSpendTime[3] = m_lstCharData[i]->m_dwSpendTime[4] = m_lstCharData[i]->m_dwSpendTime[5] = GetTickCount();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
void CCharacterControl::UnloadCash(CZ3DGeneralChrModel *pChrmodel)
|
||
{
|
||
for(int cChr=0;cChr<m_ChrCashList.num;cChr++)
|
||
{
|
||
if(m_ChrCashList[cChr].m_lpChrModel==pChrmodel)
|
||
{
|
||
m_ChrCashList[cChr].m_nUsedChrID=-1;
|
||
|
||
CCharacterLightShadowManager::CCharacterDataNode CheckNode;
|
||
|
||
CheckNode=CSceneManager::GetCharacterDataNode(m_ChrCashList[cChr].m_lpChrModel);
|
||
CheckNode.m_bRender=false;
|
||
CSceneManager::SetCharacterDataNode(CheckNode);
|
||
return;
|
||
}
|
||
}
|
||
MessageBox(NULL,"Error CharacterCash",0,0);
|
||
}
|
||
|
||
void CCharacterControl::MakeVisualAttackInfo()
|
||
{
|
||
vector3 vecSelfDir,vecEnemyDir;
|
||
float fAngle = (-m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection()) - FLOAT_PHI / 2.0f;
|
||
float fEnemyDirection;
|
||
vecSelfDir.x = cosf(fAngle);
|
||
vecSelfDir.y = 0.0f;
|
||
vecSelfDir.z = sinf(fAngle);
|
||
|
||
vector3 vecLens;
|
||
float fInterLens;
|
||
|
||
matrix matSelfChrPos;
|
||
matSelfChrPos.MakeIdent();
|
||
matSelfChrPos._41 = m_lstCharData[m_nFocusCharacter]->m_vecPos.x;
|
||
matSelfChrPos._43 = m_lstCharData[m_nFocusCharacter]->m_vecPos.z;
|
||
|
||
vector3 vecFirstAttackPos;
|
||
|
||
unsigned long dwDefenser[10];
|
||
ZeroMemory(&dwDefenser, sizeof(unsigned long) * 10);
|
||
int nAttackCount = 0;
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
if(cChr == m_nFocusCharacter) continue;
|
||
if(!m_lstCharData[cChr]->m_lpChrModel) continue;
|
||
if(m_lstCharData[cChr]->m_bCharDead) continue;
|
||
|
||
if(GetClientType(m_lstCharData[cChr]->m_dwChrID) == CT_NPC || GetClientType(m_lstCharData[cChr]->m_dwChrID, TRUE) == CT_PC)
|
||
continue;
|
||
|
||
// if(m_lstCharData[cChr].m_bUsed==false) continue;
|
||
|
||
vecLens = m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecLens.y = 0.0f;
|
||
fInterLens = vecLens.GetLens();
|
||
|
||
if(fInterLens <= 1300.0f)
|
||
{
|
||
float fEnemyAngle = m_lstCharData[cChr]->m_lpChrModel->GetDirection() - FLOAT_PHI;
|
||
vector3 vecDir;
|
||
vecDir.x = cosf(fEnemyAngle);
|
||
vecDir.z = sinf(fEnemyAngle);
|
||
vecDir.y = 0.0f;
|
||
|
||
vecDir.x = cosf(fAngle);
|
||
vecDir.z = sinf(fAngle);
|
||
vecDir.y = 0.0f;
|
||
|
||
matrix matDirChr;
|
||
matDirChr = matSelfChrPos;
|
||
matDirChr._41 += vecDir.x;
|
||
matDirChr._43 += vecDir.z;
|
||
|
||
matrix matPos, matInv, matResult;
|
||
matPos.YRotation(fEnemyAngle);
|
||
matPos._41 = m_lstCharData[cChr]->m_vecPos.x;
|
||
matPos._43 = m_lstCharData[cChr]->m_vecPos.z;
|
||
|
||
matInv.Inverse(matPos);
|
||
matResult = matSelfChrPos * matInv;
|
||
matDirChr = matDirChr * matInv;
|
||
|
||
vecDir = matDirChr.GetLoc() - matResult.GetLoc();
|
||
|
||
vector3 vecMin = vector3(-35.0f, 0.0f, -55.0f);
|
||
vector3 vecMax = vector3(35.0f, 0.0f, 65.0f);
|
||
|
||
if(GetMonsterMinBox) vecMin = GetMonsterMinBox(m_lstCharData[cChr]->m_dwChrID);
|
||
if(GetMonsterMaxBox) vecMax = GetMonsterMaxBox(m_lstCharData[cChr]->m_dwChrID);
|
||
|
||
if(CylinderOBBIntersection(matResult.GetLoc(), vecDir, FLOAT_PHI / 3.0f, vecMax, vecMin, 200.0f))
|
||
{
|
||
//fEnemyDirection=(-m_lstCharData[cChr]->m_lpChrModel->GetDirection()) - FLOAT_PHI / 2.0f;
|
||
|
||
if(nAttackCount==0)
|
||
{
|
||
m_lstCharData[cChr]->m_lpChrModel->GetPosition(vecFirstAttackPos);
|
||
}
|
||
|
||
vecEnemyDir=vecLens.Normalized();
|
||
|
||
float fInterAngle=vecEnemyDir*vecSelfDir;
|
||
|
||
fInterAngle=acosf(fInterAngle);
|
||
|
||
if(fInterAngle > FLOAT_PHI/3.0f)
|
||
continue;
|
||
|
||
float fAttackActionRate=rand()%6;
|
||
fAttackActionRate*=0.1f;
|
||
fAttackActionRate+=0.3f;
|
||
|
||
if(fAttackActionRate > 0.5f) fAttackActionRate = 0.5f;
|
||
// fAttackActionRate = 0.9f;
|
||
if(m_lstCharData[cChr]->m_lpChrModel->IsAddonActionFinished(1))
|
||
m_lstCharData[cChr]->m_lpChrModel->AddMotion("ATTACKED", 3, fAttackActionRate);
|
||
|
||
CSceneManager::CharacterRandomPos(m_lstCharData[cChr]->m_lpChrModel, 10, vecSelfDir * 50.0f);
|
||
|
||
vector3 vecTargetLightPos=m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecTargetLightPos.Normalize();
|
||
vecTargetLightPos=m_lstCharData[m_nFocusCharacter]->m_vecPos+vecTargetLightPos*60.0f;
|
||
CSceneManager::AddChrLight(m_lstCharData[cChr]->m_lpChrModel, vecTargetLightPos+ vector3(0.0f, 100.0f, 0.0f), 0xffff2200, 400.0f, 6);
|
||
|
||
vector3 vecEffectPos=vecTargetLightPos+vector3(0.0f, 120.0f, 0.0f);
|
||
/* CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
|
||
test_script->GetScriptData("c:\\roundswing.esf");
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter].m_vecPos.x,m_lstCharData[m_nFocusCharacter].m_vecPos.y,m_lstCharData[m_nFocusCharacter].m_vecPos.z);
|
||
// test_script->SetEndPos((D3DXVECTOR3 *)&(m_lstCharData[cChr].m_vecPos),1);
|
||
|
||
CSceneManager::AddEffectScript(test_script);
|
||
*/
|
||
CEffScript *test_script;
|
||
test_script = new CEffScript;
|
||
CSceneManager::AddEffectScript(test_script);
|
||
|
||
if(m_SkillAttackValue) {
|
||
test_script->GetScriptData("attack2.esf");
|
||
}
|
||
else {
|
||
test_script->GetScriptData("attack1.esf");
|
||
}
|
||
|
||
test_script->SetStartPos(m_lstCharData[m_nFocusCharacter]->m_vecPos.x,m_lstCharData[m_nFocusCharacter]->m_vecPos.y,m_lstCharData[m_nFocusCharacter]->m_vecPos.z);
|
||
test_script->SetEndPos(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
test_script->SetChr(m_lstCharData[m_nFocusCharacter]->m_lpChrModel,m_lstCharData[1]->m_lpChrModel);
|
||
//particle
|
||
CX3DEffect *pEffect;
|
||
pEffect=new CX3DEffect;
|
||
CSceneManager::AddEffect(pEffect);
|
||
|
||
if(m_SkillAttackValue)
|
||
{
|
||
pEffect->Load(EFFECTPATH,"attack2_particle.eff");
|
||
if(m_SkillAttackValue >0)
|
||
m_SkillAttackValue--;
|
||
}
|
||
else
|
||
{
|
||
pEffect->Load(EFFECTPATH,"attack1_particle.eff");
|
||
}
|
||
|
||
pEffect->SetLoop(FALSE);
|
||
float fAttackAngle=0.0f;
|
||
pEffect->SetAxis(0.0f,-((180.0f*fAngle)/3.14159f)+90.0f+fAttackAngle,0.0f);
|
||
|
||
pEffect->SetCenter(vecEffectPos.x,vecEffectPos.y,vecEffectPos.z);
|
||
|
||
dwDefenser[nAttackCount++] = m_lstCharData[cChr]->m_dwChrID;
|
||
PlaySound(0,vecFirstAttackPos);
|
||
if(nAttackCount >= 10) break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
BOOL CCharacterControl::CheckMonsterForward()
|
||
{
|
||
float fAngle = (-m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetDirection()) - FLOAT_PHI / 2.0f;
|
||
|
||
vector3 vecLens, vecSelfDir;
|
||
vecSelfDir.x = cosf(fAngle);
|
||
vecSelfDir.z = sinf(fAngle);
|
||
vecSelfDir.y = 0.0f;
|
||
|
||
matrix matSelfChrPos;
|
||
matSelfChrPos.MakeIdent();
|
||
matSelfChrPos._41 = m_lstCharData[m_nFocusCharacter]->m_vecPos.x;
|
||
matSelfChrPos._43 = m_lstCharData[m_nFocusCharacter]->m_vecPos.z;
|
||
|
||
for(int cChr = 0; cChr < m_lstCharData.num; cChr++)
|
||
{
|
||
if(cChr == m_nFocusCharacter) continue;
|
||
if(!m_lstCharData[cChr]->m_lpChrModel) continue;
|
||
if(m_lstCharData[cChr]->m_bCharDead) continue;
|
||
if(GetClientType(m_lstCharData[cChr]->m_dwChrID) == CT_NPC || GetClientType(m_lstCharData[cChr]->m_dwChrID, TRUE) == CT_PC)
|
||
continue;
|
||
|
||
vecLens = m_lstCharData[cChr]->m_vecPos - m_lstCharData[m_nFocusCharacter]->m_vecPos;
|
||
vecLens.y = 0.0f;
|
||
|
||
if(vecLens.GetLens() <= 400.0f)
|
||
{
|
||
vecLens.Normalize();
|
||
float fDot = vecSelfDir * vecLens;
|
||
float fDot2 = acosf(fDot);
|
||
|
||
if(fabs(fDot2) <= (FLOAT_PHI / 4.0f))
|
||
{
|
||
return TRUE;
|
||
}
|
||
/* matrix matDirChr;
|
||
matDirChr = matSelfChrPos;
|
||
matDirChr._41 += vecDir.x;
|
||
matDirChr._43 += vecDir.z;
|
||
|
||
matrix matPos, matInv, matResult;
|
||
matPos.YRotation(fEnemyAngle);
|
||
matPos._41 = m_lstCharData[cChr]->m_vecPos.x;
|
||
matPos._43 = m_lstCharData[cChr]->m_vecPos.z;
|
||
|
||
matInv.Inverse(matPos);
|
||
matResult = matSelfChrPos * matInv;
|
||
matDirChr = matDirChr * matInv;
|
||
|
||
vecDir = matDirChr.GetLoc() - matResult.GetLoc();
|
||
|
||
vector3 vecMin = m_CreatureSize.vecMonsterMinBox[1];
|
||
vector3 vecMax = m_CreatureSize.vecMonsterMaxBox[1];
|
||
|
||
if(CylinderOBBIntersection(matResult.GetLoc(), vecDir, FLOAT_PHI / 3.0f, vecMax, vecMin, 200.0f))
|
||
{
|
||
return TRUE;
|
||
}*/
|
||
}
|
||
}
|
||
|
||
return FALSE;
|
||
}
|
||
|
||
BOOL CCharacterControl::GetAttacking(void)
|
||
{
|
||
if(m_nFocusCharacter != 0xFFFFFFFF)
|
||
{
|
||
unsigned dwUpper = m_lstCharData[m_nFocusCharacter]->m_dwUpperChrAction;
|
||
if(dwUpper == CA_ATTACK || dwUpper == CA_ATTACK2 || dwUpper == CA_ATTACK3 ||
|
||
dwUpper == CA_ATTACK4 || dwUpper == CA_ATTACK5 || dwUpper == CA_ATTACK6 ||
|
||
dwUpper == CA_ATTACKADVANCE || dwUpper == CA_ATTACKLEFT || dwUpper == CA_ATTACKRIGHT ||
|
||
dwUpper == CA_ATTACKRETREAT || dwUpper == CA_MOVEATTACK || dwUpper == CA_SHOT || dwUpper == CA_JUMPSHOT ||
|
||
dwUpper == CA_JUMPATTACK || dwUpper == CA_JUMPATTACK2 || dwUpper == CA_JUMPATTACK3 ||
|
||
dwUpper == CA_CASTING || dwUpper == CA_FIRE1 || dwUpper == CA_FIRE2 ||
|
||
dwUpper == CA_AIMEDSHOT1 || dwUpper == CA_AIMEDSHOT2 || dwUpper == CA_AIMEDSHOT3 ||
|
||
dwUpper == CA_OVERBASH1 || dwUpper == CA_OVERBASH2 || dwUpper == CA_OVERBASH3 || dwUpper == CA_OVERBASH4 || dwUpper == CA_OVERBASH5 ||
|
||
dwUpper == CA_TURNPUNCH1 || dwUpper == CA_TURNPUNCH2 || dwUpper == CA_TURNPUNCH3 ||
|
||
dwUpper == CA_COMBINATIONBLOW || dwUpper == CA_BACKSTAB || dwUpper == CA_POWERDRAIN || dwUpper == CA_BASH ||
|
||
dwUpper == CA_ROUNDSWING)
|
||
{
|
||
return TRUE;
|
||
}
|
||
}
|
||
|
||
return FALSE;
|
||
}
|
||
/*
|
||
void CCharacterControl::SetSlideValue(CEffScript *ptr,CEffScript::CEffExt6 value){
|
||
if(ptr != NULL) {
|
||
m_SlideEffect = ptr;
|
||
}
|
||
m_SlideValue = value;
|
||
m_bSlide = true;
|
||
}
|
||
|
||
void CCharacterControl::PlaySlide() {
|
||
|
||
if(m_bSlide && (m_nFocusCharacter != -1)) {
|
||
float fChrDir = m_lstCharData[m_nFocusCharacter]->GetDirection();
|
||
|
||
fChrDir = -fChrDir;
|
||
fChrDir -= FLOAT_PHI / 2.0f;
|
||
|
||
vector3 vecChrToward;
|
||
|
||
vecChrToward.x = cosf(fChrDir);
|
||
vecChrToward.z = sinf(fChrDir);
|
||
vecChrToward.y = 0.0f;
|
||
vecChrToward.Normalize();
|
||
|
||
vector3 tmp;
|
||
vector3 *char_pos;
|
||
float tmp_length;
|
||
|
||
if(m_SlideValue.m_CurrentSlideLength < m_SlideValue.m_SlideLength) {
|
||
tmp = vecChrToward * (m_SlideValue.m_SlideSpeed);
|
||
tmp *= (-1.0f);
|
||
m_SlideValue.m_SlideSpeed += m_SlideValue.m_SlideAccel;
|
||
if(m_SlideValue.m_SlideSpeed < m_SlideValue.m_LimitSpeed)
|
||
m_SlideValue.m_SlideSpeed = m_SlideValue.m_LimitSpeed;
|
||
}
|
||
else {
|
||
tmp.x = 0.0f;
|
||
tmp.y = 0.0f;
|
||
tmp.z = 0.0f;
|
||
m_bSlide = false;
|
||
}
|
||
tmp_length = tmp.GetLens();
|
||
m_SlideValue.m_CurrentSlideLength += tmp_length;
|
||
|
||
vector3 before_pos;
|
||
|
||
char_pos = m_lstCharData[m_nFocusCharacter]->GetPosition();
|
||
|
||
before_pos.x = char_pos->x;
|
||
before_pos.y = char_pos->y;
|
||
before_pos.z = char_pos->z;
|
||
|
||
m_lstCharData[m_nFocusCharacter]->SetPosition(char_pos->x + tmp.x,char_pos->y,char_pos->z + tmp.z);
|
||
// slide <20><><EFBFBD><EFBFBD> render
|
||
if(m_bSlide && (!m_lstCharData[m_nFocusCharacter]->m_bFlying))
|
||
//RenderSlide(before_pos.x - tmp.x,before_pos.y,before_pos.z - tmp.x,char_pos->x - tmp.x,char_pos->y,char_pos->z - tmp.x,30.0f);
|
||
RenderSlide(before_pos.x,before_pos.y,before_pos.z,char_pos->x,char_pos->y,char_pos->z,30.0f);
|
||
|
||
if(m_SlideEffect != NULL && m_bSlide) { //snap
|
||
if(!CSceneManager::m_EffectManager.CheckNullScript(m_SlideEffect)) {
|
||
m_SlideEffect->SetSnapPos(char_pos->x + tmp.x,char_pos->y,char_pos->z + tmp.z);
|
||
}
|
||
else
|
||
m_SlideEffect = NULL;
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
void CCharacterControl::RenderSlide(float beforex,float beforey,float beforez,float nowx,float nowy,float nowz,float unitsize) {
|
||
//unitsize : <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
float vec_length = 0.0f;
|
||
int unitcount = 0;
|
||
|
||
D3DXVECTOR3 tmp_vec;
|
||
D3DXVECTOR3 tmp_vec2(0.0f,0.0f,0.0f);
|
||
|
||
D3DXVECTOR3 r_foot;
|
||
D3DXVECTOR3 l_foot;
|
||
|
||
tmp_vec.x = nowx - beforex;
|
||
tmp_vec.y = nowy - beforey;
|
||
tmp_vec.z = nowz - beforez;
|
||
|
||
vec_length = D3DXVec3Length(&tmp_vec);
|
||
D3DXVec3Normalize(&tmp_vec,&tmp_vec);
|
||
|
||
CZ3DObject *snappoint = NULL;
|
||
float body_scale = 0.0f;
|
||
//rfoot
|
||
snappoint = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetSkeletonPartObject("R_FOOT");
|
||
body_scale = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetScale();
|
||
|
||
if(snappoint != NULL) {
|
||
|
||
vector3 snaptm;
|
||
snappoint->GetPosition(snaptm);
|
||
|
||
r_foot.x = snaptm.x;
|
||
r_foot.y = snaptm.y;
|
||
r_foot.z = snaptm.z;
|
||
|
||
/*matrix *snaptm = snappoint->GetTM();
|
||
r_foot.x = snaptm->_41;
|
||
r_foot.y = snaptm->_42;
|
||
r_foot.z = snaptm->_43;
|
||
*/
|
||
/* r_foot *= body_scale;
|
||
}
|
||
//lfoot
|
||
snappoint = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetSkeletonPartObject("L_FOOT");
|
||
body_scale = m_lstCharData[m_nFocusCharacter]->m_lpChrModel->GetScale();
|
||
|
||
if(snappoint != NULL) {
|
||
vector3 snaptm;
|
||
snappoint->GetPosition(snaptm);
|
||
|
||
l_foot.x = snaptm.x;
|
||
l_foot.y = snaptm.y;
|
||
l_foot.z = snaptm.z;
|
||
/*
|
||
matrix *snaptm = snappoint->GetTM();
|
||
l_foot.x = snaptm->_41;
|
||
l_foot.y = snaptm->_42;
|
||
l_foot.z = snaptm->_43;
|
||
*/
|
||
/* l_foot *= body_scale;
|
||
}
|
||
|
||
while(vec_length > D3DXVec3Length(&tmp_vec2)) {
|
||
|
||
D3DXVECTOR3 effectpos(nowx,nowy,nowz);
|
||
|
||
tmp_vec2 += tmp_vec * unitsize;
|
||
//rfoot
|
||
CX3DEffect *pEffect = NULL;
|
||
pEffect=new CX3DEffect;
|
||
CSceneManager::AddEffect(pEffect);
|
||
pEffect->Load(EFFECTPATH,"smoke.eff");
|
||
pEffect->SetLoop(FALSE);
|
||
pEffect->SetAxis(0.0f,0.0f,0.0f);
|
||
pEffect->SetCenter(effectpos.x - tmp_vec2.x + r_foot.x,
|
||
effectpos.y - tmp_vec2.y + r_foot.y + 20.0f,
|
||
effectpos.z - tmp_vec2.z + r_foot.z);
|
||
pEffect->SetFrame((float)(unitcount * 2.0f));
|
||
|
||
//lfoot
|
||
CX3DEffect *pEffect2 = NULL;
|
||
pEffect2=new CX3DEffect;
|
||
CSceneManager::AddEffect(pEffect2);
|
||
pEffect2->Load(EFFECTPATH,"smoke.eff");
|
||
pEffect2->SetLoop(FALSE);
|
||
pEffect2->SetAxis(0.0f,0.0f,0.0f);
|
||
pEffect2->SetCenter(effectpos.x - tmp_vec2.x + l_foot.x,
|
||
effectpos.y - tmp_vec2.y + l_foot.y + 20.0f,
|
||
effectpos.z - tmp_vec2.z + l_foot.z);
|
||
pEffect2->SetFrame((float)(unitcount * 2.0f));
|
||
|
||
unitcount++;
|
||
}
|
||
}
|
||
*/
|
||
|
||
void CCharacterControl::InitGlobalAction()
|
||
{
|
||
SetAutoRun(FALSE);
|
||
m_bAutoTargetAttack = false;
|
||
m_dwAutoTargetID = 0xFFFFFF;
|
||
m_dwClickModeAttackTargetID = 0xFFFFFFFF;
|
||
m_bClickAttack = false;
|
||
m_bClickMove = false;
|
||
m_lAutoRunCounter = 0;
|
||
}
|
||
|
||
char * CCharacterControl::GetCreatureName(unsigned long dwChrID)
|
||
{
|
||
for(int cChr=0;cChr<m_lstCharData.num;cChr++)
|
||
{
|
||
if(m_lstCharData[cChr]->m_dwChrID == dwChrID)
|
||
{
|
||
return m_lstCharData[cChr]->m_strName;
|
||
}
|
||
}
|
||
|
||
return NULL;
|
||
}
|