www.pudn.com > notWow.rar > Char.h
#pragma once #include "Model.h" #include "Math.h" #include#include using namespace std; #include // X-axis is 0 dgree, Z-axis is -90 dgree class IObjectBase { public: IObjectBase() : m_bRender(false) { } bool m_bValid; ObjectID m_ObjectID; short m_SignID; char m_Name[32]; ScriptID m_ScriptID; ModelID m_ModelID; bool m_bRender; float m_fViewZ; float m_fPosX,m_fPosY,m_fPosZ; short m_Dir; }; class WorldObject : public IObjectBase { public: D3DXVECTOR3 m_vMin,m_vMax; void Render(D3DXMATRIX* pViewProj,bool bFar = false); }; class ObjectPtr { public: WorldObject* Ptr; bool operator < (const ObjectPtr& Oth) const; }; class Item : public IObjectBase { public: void Render(D3DXMATRIX* pViewProj); int m_Position; }; class ICharBase; struct Attack { ICharBase* pChar; CHARSKILL Skill; }; class ICharBase : public IObjectBase { public: TextureID m_TexturesID[6]; char m_Geosets[16]; list - m_Items; deque
m_AttackQueue; }; struct State { CHARSTATE CharState; ICharBase* pAimChar; int DestX,DestZ; int DestDir; }; class Char : public ICharBase { public: static int s_ShuffleDgreeFixed; static int s_TimeFixed; float m_fWalkSpeed; float m_fRunSpeed; int m_MaxHP; int m_HP; int m_Defence; int m_Offence; int m_SDefence; int m_SOffence; int m_DestX,m_DestZ,m_DestDir; ICharBase* m_pAimChar; CHARSTATE m_State; ACTION m_Act; int m_Anim; int m_Time; bool m_bActChange; bool m_bStateOver; short m_StartSign,m_EndSign; short m_Offensive; bool m_bBattle; deque m_StateQueue; public: Char() : m_Act(ACT_STAND),m_bActChange(true),m_bStateOver(true), m_State(CS_IDLE), m_Time(0),m_Anim(0), m_MaxHP(100),m_HP(100), m_fWalkSpeed(2.5),m_fRunSpeed(5.0), m_Defence(0), m_Offence(1), m_SDefence(0), m_SOffence(1), m_pAimChar(NULL), m_bBattle(false),m_Offensive(0),m_StartSign(0),m_EndSign(0) { memset(m_Geosets,0,sizeof(m_Geosets)); memset(m_TexturesID,-1,sizeof(m_TexturesID)); m_bValid = false; } ~Char() { m_Items.clear(); } void Render(D3DXMATRIX* pViewProj); void Update(float fTime); void Idle(); void Run(int x,int z); void Walk(int x,int z); void Turn(int x,int z); void Run(ICharBase* pChar); void Walk(ICharBase* pChar); void Turn(ICharBase* pChar); void Attack(ICharBase* pChar); void Talk(ICharBase* pChar); D3DXMATRIX GetMatrix(); void SetBattle(bool Battle); void SetItem(const char* Name){} protected: bool CalDir(int x,int z,int &dir); int CalDistSqr(int x,int z); void OnIdle(float fTime); void OnRun(float fTime); void OnWalk(float fTime); void OnAttack(float fTime); void OnTalk(float fTime); void OnTurn(float fTime); };