Files
Client/GameTools/CHARACTERACTIONCONTROL/Creature.h
LGram16 dd97ddec92 Restructure repository to include all source folders
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>
2025-11-29 20:17:20 +09:00

416 lines
12 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Creature.h: interface for the CCreature class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CREATURE_H__0C16A3E3_6308_4E72_AFF8_1CFE85324B6D__INCLUDED_)
#define AFX_CREATURE_H__0C16A3E3_6308_4E72_AFF8_1CFE85324B6D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Z3DGeneralChrModel.h"
#include "List.h"
#include "SceneManager.h"
using namespace std;
const unsigned long CA_WAIT = 0;
const unsigned long CA_RUN = 1;
const unsigned long CA_ATTACK = 2;
const unsigned long CA_MOVEATTACK = 3;
const unsigned long CA_WALKBACK = 4;
const unsigned long CA_WALKLEFT = 5;
const unsigned long CA_WALKRIGHT = 6;
const unsigned long CA_BASH = 7;
const unsigned long CA_WALK = 8;
const unsigned long CA_FALLDOWN = 9;
const unsigned long CA_REST = 10;
const unsigned long CA_SITDOWN = 11;
const unsigned long CA_STANDUP = 12;
const unsigned long CA_ATTACKADVANCE = 13;
const unsigned long CA_ATTACKLEFT = 14;
const unsigned long CA_ATTACKRIGHT = 15;
const unsigned long CA_ATTACKRETREAT = 16;
const unsigned long CA_ATTACK2 = 17;
const unsigned long CA_ATTACK3 = 18;
const unsigned long CA_ATTACK4 = 19;
const unsigned long CA_RESPAWN = 20;
const unsigned long CA_JUMP = 21;
const unsigned long CA_LEFTDASH = 22;
const unsigned long CA_RIGHTDASH = 23;
const unsigned long CA_CASTING = 24;
const unsigned long CA_FIRE1 = 25;
const unsigned long CA_FIRE2 = 26;
const unsigned long CA_COMBINATIONBLOW = 27;
const unsigned long CA_BACKSTAB = 28;
const unsigned long CA_AIMEDSHOT2 = 29;
const unsigned long CA_ATTACK5 = 30;
const unsigned long CA_ATTACK6 = 31;
const unsigned long CA_BACKDASH = 32;
const unsigned long CA_AIMEDSHOT1 = 33;
const unsigned long CA_JUMPATTACK = 34;
const unsigned long CA_JUMPATTACK2 = 35;
const unsigned long CA_FRONTDASH = 36;
const unsigned long CA_LAND = 37;
const unsigned long CA_FORWARDJUMP = 38;
const unsigned long CA_BACKJUMP = 40;
const unsigned long CA_SHOT = 41;
const unsigned long CA_JUMPSHOT = 42;
const unsigned long CA_OVERBASH1 = 43;
const unsigned long CA_OVERBASH2 = 44;
const unsigned long CA_OVERBASH3 = 45;
const unsigned long CA_OVERBASH4 = 46;
const unsigned long CA_OVERBASH5 = 47;
const unsigned long CA_POWERDRAIN = 48;
const unsigned long CA_TURNPUNCH1 = 49;
const unsigned long CA_TURNPUNCH2 = 50;
const unsigned long CA_TURNPUNCH3 = 51;
const unsigned long CA_JUMPATTACK3 = 52;
const unsigned long CA_AIMEDSHOT3 = 53;
const unsigned long CA_STUN = 54;
const unsigned long CA_ROUNDSWING = 55;
const unsigned long CA_SWIM = 100;
const float RUN_INTERVAL = 255.0f;
const long PACKET_LIFETIME = 10000;
typedef struct ChrActionNode
{
unsigned long m_dwLowerChrAction;
unsigned long m_dwUpperChrAction;
float m_fDirection;
vector3 m_vecNextPosition;
float m_fVec;
unsigned short m_wAniNum;
unsigned short m_wAniNumCount;
unsigned long m_dwFrame;
} ChrActionNode;
typedef struct stDamage
{
short sLifeTime;
long lValue;
unsigned short wMode;
float fScale;
} stDamage;
class CCreature
{
public:
int GetChrTitle( int nClass, int nMerits );
void SetChantEffect(unsigned long dwChant, BOOL bToggle, BOOL bSelf);
void SetChantEffect(unsigned long dwChant, BOOL bSelf);
BOOL GetSkillMotion(void);
class CCreatureArrow {
public:
CEffScript *m_ArrowEsf;
char m_PivotName[256];
CCreatureArrow() {
m_ArrowEsf = NULL;
memset(m_PivotName,0,sizeof(char) * 256);
}
~CCreatureArrow() {
if(m_ArrowEsf != NULL) {
if(!CSceneManager::m_EffectManager.CheckNullScript(m_ArrowEsf)) {
CSceneManager::m_EffectManager.DeleteEndScript(m_ArrowEsf);
}
}
}
};
class CCreatureEffect { //creature <20><><EFBFBD><EFBFBD> <20>ٴ<EFBFBD> effect class
public:
CEffScript *m_Effect; // esf
bool m_bPivotRot;
int m_PivotIndex;
char m_PivotName[50];
char m_EffName[50];
bool m_EffValue;
unsigned long m_EffId;
D3DXVECTOR3 m_EffPos;
CCreatureEffect() {
m_Effect = NULL;
m_bPivotRot = false;
m_PivotIndex= -1;
memset(m_PivotName,0,sizeof(char) * 50);
memset(m_EffName,0,sizeof(char) * 50);
m_EffValue = false;
m_EffPos.x = m_EffPos.y = m_EffPos.z = 0.0f;
m_EffId = 0;
}
~CCreatureEffect() {
if(m_Effect != NULL) {
if(!CSceneManager::m_EffectManager.CheckNullScript(m_Effect)) {
m_Effect->SetAllLoopOff();
m_Effect->SetVisibility(false);
//CSceneManager::m_EffectManager.DeleteEndScript(m_Effect);
m_Effect = NULL;
}
}
}
};
class CWeaponEffect { //Weapon<6F><6E> <20>ٴ<EFBFBD> effect
public:
int m_nWeaponEffectNum; //effect<63><74> <20><><EFBFBD><EFBFBD>
int m_nWeaponPosNum; //effect<63><74> <20><><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD> <20><> effect <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ
char m_strEffect[50];
CEffScript *m_pEffect;
CWeaponEffect()
{
m_nWeaponEffectNum = 0;
m_nWeaponPosNum = 0;
memset(m_strEffect,sizeof(int),50);
m_pEffect = NULL;
}
~CWeaponEffect()
{
if(m_pEffect != NULL) {
if(!CSceneManager::m_EffectManager.CheckNullScript(m_pEffect)) {
//CSceneManager::m_EffectManager.DeleteEndScript(m_pEffect);
m_pEffect->SetAllLoopOff();
m_pEffect->SetVisibility(false);
m_pEffect = NULL;
}
}
}
};
class CWeaponLine { // Weapon Line Setting Class
public:
LPDIRECT3DTEXTURE8 m_lpLineTexture; // Texture
int m_iColor[3]; // Color
int m_iBlend; // Blend Mode
CWeaponLine() {
m_lpLineTexture = NULL;
m_iColor[0] = m_iColor[1] = m_iColor[2] = 255;
m_iBlend = 0;
}
~CWeaponLine() {
if(m_lpLineTexture != NULL) {
m_lpLineTexture->Release();
m_lpLineTexture = NULL;
}
}
};
BOOL Casting(unsigned long dwUpperAni = 0xFFFFFFFF, unsigned long dwLowerAni = 0xFFFFFFFF);
void CancelSkill(void);
void InitWeapon(unsigned long dwEquip);
DWORD m_dwLastUpdateActionTimer;
/* char m_strWeaponType[256];
static void LoadMotionSheet(char *strFilename);
static char m_strWeaponMotionSheet[MAX_WEAPONTABLE][256];
static char m_strWeapon[MAX_WEAPONTABLE][256];*/
float m_fScale;
void EndSkill(char *strMotion);
void BeginCast(char *strMotion);
BOOL Dash(int nDir);
BOOL Jump();
void SkillAttack(unsigned long dwUpperAni, unsigned int dwLowerAni);
void SetShape(char strShape[15][256]);
void Respawn(void);
void InitChrAction(void);
BOOL IsCancelAction(unsigned long dwPart);
void SetMotionString(unsigned long *dwAction, char *strAction);
void SetMotionString(unsigned long dwAction, char *strAction);
BOOL Attack(unsigned long dwUpperAni = 0xFFFFFFFF, unsigned long dwLowerAni = 0xFFFFFFFF);
void Dead(void);
void Wait(void);
BOOL SetAction(char *strUpperAction, char *strLowerAction);
BOOL SetAction(unsigned long dwUpperAni, unsigned long dwLowerAni);
void CrouchAndStandup(void);
void WalkBack(void);
void WalkRight(void);
void WalkLeft(void);
void Run(float fRunFactor);
CZ3DGeneralChrModel *m_lpChrModel;
char m_strGCMDSName[MAX_PATH];
char m_strFaceType[MAX_PATH];
char m_strHairStyle[MAX_PATH];
unsigned short m_wShape[15];
char m_strShape[15][256]; // <20><><EFBFBD>߿<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
unsigned char m_cSex;
unsigned char m_cNation;
unsigned char m_cLevel;
unsigned short m_wClass;
unsigned long m_dwPartyID;
unsigned long m_dwWeaponPos;
short m_sDamage;
long m_sCurrHP;
long m_sCurrMP;
unsigned short m_wMaxHP;
unsigned short m_wMaxMP;
float m_fDeadTimer;
unsigned long m_dwAttackCombo;
unsigned long m_dwSkillComboCount;
BOOL m_bSkillCombo;
vector3 m_vecPos;
float m_fDirection;
unsigned long m_dwChrID;
float m_fSelfChrLens;
int m_ChrNodeID;
float m_fRunFactor;
char m_strName[MAX_PATH];
BOOL m_bSitMode;
BOOL m_bUsed;
BOOL m_bFlying;
BOOL m_bFlyFirstCheck;
BOOL m_bStillCasting;
BOOL m_bNoneComboAttackMode;
BOOL m_bFirstPositionSend;
vector3 m_vecJumpAttackVector;
unsigned long m_dwChant;
char m_strStreetStallName[32];
bool m_bPeaceMode;
unsigned long m_dwSpendTime[6];
ChrActionNode m_ChrAction;
float m_fFixAngle;
List<ChrActionNode> m_lstActionData;
List<stDamage> m_lstDamageNumber;
char m_strChatMessage[MAX_PATH];
float m_fChatTimer;
BOOL m_bCharDead;
BOOL m_bUpperAble;
BOOL m_bLowerAble;
unsigned long m_dwLowerChrAction;
unsigned long m_dwUpperChrAction;
BOOL m_bUpperAnimating;
BOOL m_bLowerAnimating;
//arrow
vector<CCreatureArrow *> m_Arrow;
bool m_bArrowExist;
//body effect
vector<CCreatureEffect *> m_BodyEffect;
bool m_bBodyEffect;
//Weapon effect
vector<CWeaponEffect *> m_WeaponEffect;
bool m_bWeaponEffect;
// slide character <20><><EFBFBD><EFBFBD>
CEffScript::CEffExt6 m_SlideValue;
bool m_bSlide;
CWeaponLine *m_pWeaponLine;
bool m_bWeaponLine;
DWORD m_dwTargetId; // Target Id (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> ó<><C3B3>)
void SetSlideValue(CEffScript::CEffExt6 );
void PlaySlide();
void RenderSlide(float bx,float by,float bz,float nx,float ny,float nz,float unitsize);
//
CCreature();
virtual ~CCreature();
void ArrowUpdate();
void ArrowUpdate(int );
void AddArrow(char *pivot_name,D3DXQUATERNION rot,int div = 0);
void DeleteArrow(int );
// WeaponLine
void SetWeaponLine(LPDIRECT3DTEXTURE8 lpTexture,int iColor[3],int iBlend);
void DeleteWeaponLine();
void WeaponLineUpdate();
///////////body effect///////////
// ij<><C4B3> pos <20><> effect <20><><EFBFBD>ϰ<EFBFBD><CFB0><EFBFBD>
void AddBodyEffect(char *esfname,unsigned long effid = 0,bool mine = true,bool bVisibility = true);
// pivot <20>߿<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ϰ<EFBFBD> num <20><><EFBFBD><EFBFBD> <20><>ŭ effect <20><><EFBFBD><EFBFBD> (num <20><><EFBFBD><EFBFBD> -1<≯<EFBFBD> <20><> pivot <20><> <20><> <20><><EFBFBD><EFBFBD>)
void AddBodyEffect(char *file = NULL,bool rot = false,unsigned long effid = 0,int num = -1);
// pivot <20>ϳ<EFBFBD><CFB3><EFBFBD> effect <20><><EFBFBD><EFBFBD>
void AddBodyEffect(char *file = NULL,char *pivot = NULL,bool rot = false,unsigned long effid = 0);
void AddBodyEffect(char *file = NULL,int pivotindex = -1,bool rot = false,unsigned long effid = 0);
//<2F><><EFBFBD><EFBFBD> body effect list<73>ȿ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20>ϴ<EFBFBD><CFB4><EFBFBD> <20>˻<EFBFBD>
bool CheckInBodyEffect(char *file);
void RenderSnap(float bx,float by,float bz,float nx,float ny,float nz,float unitsize,char *effname);
void DeleteBodyEffect(); // <20><> effect delete
void DeleteBodyEffect(char *pivot); // <20><> pivot<6F><74> <20><><EFBFBD><EFBFBD> effect delete
void DeleteBodyEffectName(char *effectname); //effect script <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD> delete
void DeleteBodyEffect(unsigned long id); //effect id<69><64> delete
void BodyEffectUpdate(int index);
void BodyEffectUpdate();
void SetEffect(); // monster <20><><EFBFBD><EFBFBD> GCMDS<44><53><EFBFBD><EFBFBD> effect <20>ҷ<EFBFBD> <20><><EFBFBD>̴<EFBFBD> <20>ڵ<EFBFBD>
//////////Weapon Effect////////
void AddWeaponEffect(char *esfname,int effectnum);
void DeleteWeaponEffect(); //<2F><> weapon effect delete
void DeleteWeaponEffect(char *esfname,int iEffNum); //esfname<6D><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> effect delete
void WeaponEffectUpdate();
////////////////////////////////
// Visibility <20><><EFBFBD><EFBFBD> //
////////////////////////////////
void SetEffectVisibility(bool vis);
void SetPosition(float fPosX, float fPosY, float fPosZ)
{
m_vecPos.x = fPosX; m_vecPos.y = fPosY; m_vecPos.z = fPosZ;
if(m_lpChrModel)
m_lpChrModel->SetPosition(m_vecPos.x, m_vecPos.y, m_vecPos.z);
}
void SetPosition(vector3 &vecPos)
{
m_vecPos = vecPos;
if(m_lpChrModel)
m_lpChrModel->SetPosition(m_vecPos.x, m_vecPos.y, m_vecPos.z);
}
vector3 *GetPosition(void)
{
if(m_lpChrModel)
m_lpChrModel->GetPosition(m_vecPos);
return &m_vecPos;
}
void SetDirection(float fDirection)
{
m_fDirection=fDirection;
if(m_lpChrModel)
m_lpChrModel->SetDirection(fDirection);
}
float GetDirection(void)
{
if(m_lpChrModel)
m_fDirection=m_lpChrModel->GetDirection();
return m_fDirection;
}
void SetAlphaLevel(float fAlphaFactor) { m_lpChrModel->SetAlphaLevel(fAlphaFactor); }
BOOL GetChantFlag(unsigned long dwChantKind)
{
if(0 < dwChantKind && dwChantKind < 33)
{
if(m_dwChant & (0x00000001 << (dwChantKind - 1))) return TRUE; else return FALSE;
}
return FALSE;
}
};
#endif // !defined(AFX_CREATURE_H__0C16A3E3_6308_4E72_AFF8_1CFE85324B6D__INCLUDED_)