Actor.h
上传用户:cydong117
上传日期:2009-11-10
资源大小:638k
文件大小:16k
源码类别:

模拟服务器

开发平台:

Visual C++

  1. #ifndef _CACTOR_H
  2. #define _CACTOR_H
  3. /******************************************************************************************************************
  4. CActor Class
  5. *******************************************************************************************************************/
  6. #pragma pack(1)
  7. typedef struct tagMESSAGEBODYWL
  8. {
  9. LONG lParam1;
  10. LONG lParam2;
  11. LONG nTag1; // 锭赴仇 ID.(SM_STRUCK老锭).
  12. LONG nTag2;
  13. }MESSAGEBODYWL, *LPMESSAGEBODYWL;
  14. typedef struct tagMESSAGEBODYW
  15. {
  16. WORD wParam1;
  17. WORD wParam2;
  18. WORD wTag1; // 锭赴仇 ID.(SM_STRUCK老锭).
  19. WORD wTag2;
  20. }MESSAGEBODYW, *LPMESSAGEBODYW;
  21. typedef struct tagCHARDESC
  22. {
  23. LONG nFeature;
  24. LONG nStatus;
  25. }CHARDESC, *LPCHARDESC;
  26. typedef struct tagFEATURE
  27. {
  28. BYTE bGender; 
  29. BYTE bWeapon;
  30. BYTE bDress; 
  31. BYTE bHair;
  32. }FEATURE, *LPFEATURE;
  33. #pragma pack(8)
  34. class CActor
  35. {
  36. private:
  37. public:
  38. DWORD m_dwIdentity; // ID Index From Server.
  39. CHAR m_szName[64]; // 某腐磐唱 阁胶磐狼 捞抚.
  40. CHAR m_szGuildName[64];
  41. FEATURE m_stFeature; // 某腐磐狼 寇屈阑 搬沥窿绰促.
  42. BYTE m_bActorImgIdx; // 泅犁 Actor啊 啊龙 捞固瘤备炼眉狼 锅龋.
  43. BYTE m_bEffectImgIdx; // 泅犁 Actor啊 啊龙 捞固瘤备炼眉狼 锅龋.
  44. CWHWilImageData* m_pxActorImage; // 捞固瘤甫 掘绢棵 器牢磐甸.
  45. RECT m_rcActor; // 泅犁 胶农赴惑狼Actor狼 荤阿 康开.
  46. RECT m_rcTargetRgn; // 泅犁 Actor狼 鸥百康开.
  47. DWORD m_dwFstFrame; // 泅犁 悼累狼 矫累 橇饭烙.
  48. DWORD m_dwEndFrame; // 泅犁 悼累狼 付瘤阜橇饭烙.
  49. WORD m_wDelay; // 泅犁 悼累俊 措茄 瘤楷矫埃.
  50. BYTE m_bCurrMtn; // 泅犁 悼累.
  51. BYTE m_bCurrDir; // 泅犁 规氢.
  52. BYTE m_bMoveDir; // 泅犁 规氢.
  53. DWORD m_dwCurrFrame; // 泅犁 橇饭烙.
  54. WORD m_wCurrDelay; // 泅犁 瘤楷矫埃.
  55. WORD m_wOldPosX; // 泅犁 青悼捞 乐扁傈狼 鸥老X谅钎.
  56. WORD m_wOldPosY;
  57. BYTE m_bOldDir; // 泅犁 青悼捞 乐扁傈狼 规氢.
  58. WORD m_wPosX; // 鸥老 X谅钎.
  59. WORD m_wPosY; // 鸥老 Y谅钎.
  60. SHORT m_shShiftPixelX; // 泅犁 磊脚狼 鸥老俊辑 X绵父怒 捞悼茄 侨伎狼 芭府.
  61. SHORT m_shShiftPixelY; // 泅犁 磊脚狼 鸥老俊辑 Y绵父怒 捞悼茄 侨伎狼 芭府.
  62. SHORT m_shShiftTileX; // 泅犁 磊脚狼 鸥老俊辑 X绵父怒 捞悼茄 鸥老狼 芭府.
  63. SHORT m_shShiftTileY; // 泅犁 磊脚狼 鸥老俊辑 Y绵父怒 捞悼茄 鸥老狼 芭府.
  64. SHORT m_shScrnPosX; // 吝缴痢阑 绊妨窍瘤 臼篮 拳搁惑狼 X谅钎.
  65. SHORT m_shScrnPosY; // 吝缴痢阑 绊妨窍瘤 臼篮 拳搁惑狼 Y谅钎.
  66. BYTE m_bMoveSpeed; // 捞悼加档.
  67. CWHQueue m_xPacketQueue; // Actor啊 贸府秦具瞪 皋矫瘤甫 历厘窍绊 乐绰 钮.
  68. BOOL m_bMsgHurryCheck; // 皋矫瘤啊 2俺捞惑 阶咯乐阑锭绰 橇饭烙阑 1橇饭烙究阑 扒呈囤促.
  69. BYTE m_bBackStepFrame;
  70. BYTE m_bBackStepFrameCnt;
  71. DWORD m_dwCurrEffectFrame; // 某腐磐 Effect泅犁 橇饭烙.
  72. DWORD m_dwFstEffectFrame; // 某腐磐 Effect贸澜 橇饭烙.
  73. DWORD m_dwEndEffectFrame; // 某腐磐 Effect付瘤阜 橇饭烙.
  74. BYTE m_bEffectFrame;
  75. BYTE m_bEffectFrameCnt;
  76. BYTE m_bLightRadius[2]; // 堡盔 呈厚.
  77. BYTE m_bLightColor [2][3]; // 堡盔 祸.
  78. BOOL m_bUseEffect; // 捞棋飘橇饭烙阑 荤侩.
  79. BOOL m_bUseSwordEffect; // 八过瓤苞 荤侩.
  80. BOOL m_bWarMode;
  81. DWORD m_dwWarModeTime;
  82. BYTE m_bHPPercent;
  83. WORD m_wMAXHP;
  84. WORD m_wHP;
  85. WORD m_wMP;
  86. BOOL m_bOpenHealth;
  87. BYTE m_bLightSize; // Actor林函狼 堡盔农扁.
  88. D3DVERTEX m_avBoard[4];
  89. WORD m_wABlendDelay;
  90. WORD m_wABlendCurrDelay;
  91. BOOL m_bABlendRev;
  92. BOOL m_bReverse;
  93. INT m_nState;
  94. WORD m_wStateClr;
  95. DWORD m_dwNameClr;
  96. BOOL m_bIsDead;
  97. FEATURE m_stHitter;
  98. BYTE m_bAppearState;
  99. BYTE m_bMoveNextFrmCnt;
  100. BOOL m_bIsMoved;
  101. BOOL m_bFstSoundPlayed;
  102. INT m_nDividedChatLine;
  103. DWORD m_wCurrChatDelay;
  104. CHAR m_szChatMsg[MAX_PATH]; // 盲泼皋矫瘤.
  105. CHAR m_szChatMsgArg[5][MAX_PATH]; // 盲泼皋矫瘤甫 5俺狼 胶飘傅栏肺 备盒茄巴.
  106. public:
  107. //---------------------------------------------------------------------------------------------------------------//
  108. // 积己磊 棺 家戈磊.
  109. CActor();
  110. ~CActor();
  111. virtual VOID InitActor();
  112. virtual VOID DestroyActor();
  113. //---------------------------------------------------------------------------------------------------------------//
  114. //---------------------------------------------------------------------------------------------------------------//
  115. // 积己.
  116. virtual BOOL Create(CImageHandler* pxImgHandler, FEATURE* pstFeature, BYTE bMtn, WORD bDir, WORD wPosX, WORD wPosY);
  117. //---------------------------------------------------------------------------------------------------------------//
  118. BOOL LoadEffect(CImageHandler* pxImgHandler, WORD wEffectNum, BYTE bDir = 0);
  119. VOID DrawWithEffected(INT nx, INT nY, INT nXSize, INT nYSize, WORD* pwSrc, WORD wChooseColor1 = 0XFFFF, WORD wChooseColor2 = 0XFFFF, BOOL bFocused = FALSE, BYTE bOpa = 50, WORD wState = _STATE_NOTUSED);
  120. //---------------------------------------------------------------------------------------------------------------//
  121. // 橇饭烙 汲沥包访.
  122. BOOL CheckFeatureValidate(FEATURE stFeature);
  123. BOOL ChangeFeature(FEATURE stFeature);
  124. virtual BOOL SetMotionFrame(BYTE bMtn, BYTE bDir);
  125. //---------------------------------------------------------------------------------------------------------------//
  126. //---------------------------------------------------------------------------------------------------------------//
  127. // 某腐磐 捞悼.
  128. VOID SetMoving();
  129. VOID SetBackStepMoving();
  130. VOID SetMoved();
  131. WORD GetCharState();
  132. //---------------------------------------------------------------------------------------------------------------//
  133. VOID ChatMsgAdd();
  134. VOID ShowMessage(INT nLoopTime);
  135. VOID StruckMsgReassign();
  136. virtual VOID PlayActSound();
  137. //---------------------------------------------------------------------------------------------------------------//
  138. // 悼累 柳青.
  139. virtual BOOL UpdatePacketState();
  140. virtual VOID UpdateMotionState(INT nLoopTime, BOOL bIsMoveTime);
  141. virtual BOOL UpdateMove(BOOL bIsMoveTime);
  142. // 蜡屈喊 菩哦惑怕利侩.
  143. virtual VOID OnCharDescPacket(LPPACKETMSG lpPacketMsg);
  144. virtual VOID OnUserName(LPPACKETMSG lpPacketMsg);
  145. virtual VOID OnChangeNameClr(LPPACKETMSG lpPacketMsg);
  146. virtual VOID OnChangeLight(LPPACKETMSG lpPacketMsg);
  147. virtual VOID OnOpenHealth(LPPACKETMSG lpPacketMsg);
  148. virtual VOID OnCloseHealth(LPPACKETMSG lpPacketMsg);
  149. virtual VOID OnFeatureChanged(LPPACKETMSG lpPacketMsg);
  150. virtual VOID OnHealthSpellChanged(LPPACKETMSG lpPacketMsg);
  151. virtual VOID OnWalk(LPPACKETMSG lpPacketMsg);
  152. virtual VOID OnTurn(LPPACKETMSG lpPacketMsg);
  153. virtual VOID OnDigup(LPPACKETMSG lpPacketMsg);
  154. virtual VOID OnDigDown(LPPACKETMSG lpPacketMsg);
  155. virtual VOID OnDeath(LPPACKETMSG lpPacketMsg);
  156. virtual VOID OnBackStep(LPPACKETMSG lpPacketMsg);
  157. virtual VOID OnStruck(LPPACKETMSG lpPacketMsg);
  158. virtual VOID OnHit(LPPACKETMSG lpPacketMsg);
  159. virtual VOID OnFlyAxe(LPPACKETMSG lpPacketMsg);
  160. virtual VOID OnLighting(LPPACKETMSG lpPacketMsg);
  161. //---------------------------------------------------------------------------------------------------------------//
  162. //---------------------------------------------------------------------------------------------------------------//
  163. // Rendering.
  164. virtual BOOL DrawActor(CMapHandler* pxMap, BOOL bFocused = FALSE, BOOL bShadowAblended = FALSE, 
  165.                    BOOL bUseScrnPos = TRUE, BOOL bDrawShadow = TRUE);
  166. virtual VOID DrawHPBar();
  167. virtual VOID DrawName();
  168. BOOL DrawEffect();
  169. //---------------------------------------------------------------------------------------------------------------//
  170. protected:
  171. public:
  172. };
  173. /******************************************************************************************************************
  174. CNPC Class
  175. *******************************************************************************************************************/
  176. class CNPC : public CActor
  177. {
  178. private:
  179. private:
  180. public:
  181. virtual VOID OnHit(LPPACKETMSG lpPacketMsg);
  182. virtual VOID OnTurn(LPPACKETMSG lpPacketMsg);
  183. virtual BOOL UpdatePacketState();
  184. virtual VOID UpdateMotionState(INT nLoopTime, BOOL bIsMoveTime);
  185. virtual BOOL DrawActor(CMapHandler* pxMap, BOOL bFocused = FALSE, BOOL bShadowAblended = FALSE, 
  186.                    BOOL bUseScrnPos = TRUE, BOOL bDrawShadow = TRUE);
  187. };
  188. /******************************************************************************************************************
  189. CHero Class
  190. *******************************************************************************************************************/
  191. #pragma pack(1)
  192. typedef struct tagFEATUREEX
  193. {
  194. BYTE bHorse;
  195. BYTE wHairColor;
  196. BYTE wDressColor;
  197. }FEATUREEX, *LPFEATUREEX;
  198. #pragma pack(8)
  199. class CHero : public CActor
  200. {
  201. private:
  202. public:
  203. FEATUREEX m_stFeatureEx;
  204. BYTE m_bWeaponImgIdx; // 泅犁 Actor 公扁啊 啊龙 捞固瘤备炼眉狼 锅龋.
  205. BYTE m_bHairImgIdx; // 泅犁 Actor 赣府啊 啊龙 捞固瘤备炼眉狼 锅龋.
  206. BYTE m_bHorseImgIdx; // 泅犁 Actor 富捞   啊龙 捞固瘤备炼眉狼 锅龋.
  207. BYTE m_bYedoCnt;
  208. BYTE m_bFireHitCnt;
  209. BOOL m_bUseBanwol;
  210. BOOL m_bUseErgum;
  211. RECT m_rcHair;
  212. RECT m_rcWeapon;
  213. RECT m_rcHorse;
  214. CWHWilImageData* m_pxHairImage;
  215. CWHWilImageData* m_pxWeaponImage;
  216. CWHWilImageData* m_pxHorseImage;
  217. DWORD m_dwCurrHairFrame;
  218. DWORD m_dwCurrWeaponFrame;
  219. DWORD m_dwCurrHorseFrame;
  220. BYTE m_bShieldCurrFrm;
  221. WORD m_wShieldCurrDelay;
  222. SHORT m_shHitSpeed;
  223. BOOL m_bIsMon;
  224. SHORT m_shCurrMagicID;
  225. protected:
  226. public:
  227. CHero();
  228. ~CHero();
  229. virtual VOID InitActor();
  230. virtual VOID DestroyActor();
  231. VOID ShowShield();
  232. VOID PlayMoveSound();
  233. virtual VOID PlayActSound();
  234. virtual BOOL ChangeFeature(FEATURE stFeature, FEATUREEX stFeatureEx);
  235. virtual BOOL Create(CImageHandler* pxImgHandler, BYTE bMtn, BYTE bDir, WORD wPosX, WORD wPosY, FEATURE* pstFeature, FEATUREEX* pstFeatureEx);
  236. virtual BOOL UpdatePacketState();
  237. virtual VOID UpdateMotionState(INT nLoopTime, BOOL bIsMoveTime);
  238. virtual BOOL UpdateMove(BOOL bIsMoveTime);
  239. virtual VOID OnRun(LPPACKETMSG lpPacketMsg);
  240. virtual VOID OnRush(LPPACKETMSG lpPacketMsg);
  241. virtual VOID OnMagicFire(LPPACKETMSG lpPacketMsg);
  242. virtual VOID OnSpell(LPPACKETMSG lpPacketMsg);
  243. virtual VOID OnCharDescPacket(LPPACKETMSG lpPacketMsg);
  244. virtual VOID OnFeatureChanged(LPPACKETMSG lpPacketMsg);
  245. virtual VOID OnCharStatusChanged(LPPACKETMSG lpPacketMsg);
  246. virtual VOID OnBackStep(LPPACKETMSG lpPacketMsg);
  247. virtual VOID OnDeath(LPPACKETMSG lpPacketMsg);
  248. virtual VOID OnWalk(LPPACKETMSG lpPacketMsg);
  249. virtual VOID OnTurn(LPPACKETMSG lpPacketMsg);
  250. virtual VOID OnStruck(LPPACKETMSG lpPacketMsg);
  251. virtual VOID OnHit(LPPACKETMSG lpPacketMsg);
  252. virtual VOID OnButch(LPPACKETMSG lpPacketMsg);
  253. virtual BOOL DrawActor(CMapHandler* pxMap, BOOL bFocused = FALSE, BOOL bShadowAblended = FALSE, 
  254.                    BOOL bUseScrnPos = TRUE, BOOL bDrawShadow = TRUE);
  255. };
  256. /******************************************************************************************************************
  257. CMyHero Class
  258. *******************************************************************************************************************/
  259. #pragma pack(1)
  260. typedef struct tagACTORABILITY
  261. {
  262.     WORD wAC;
  263.     WORD wMAC;
  264. WORD wDC;
  265.     WORD wMC;
  266.     WORD wSC;
  267. WORD wHP;
  268. WORD wMP;
  269.     WORD wMaxHP;
  270.     WORD wMaxMP;
  271. WORD wWeight;
  272.   BYTE bExpCount;
  273. BYTE bExpMaxCount;
  274. BYTE bLevel;
  275. BYTE bReserved1;
  276. BYTE bWearWeight;
  277. BYTE bMaxWearWeight;
  278.     BYTE bHandWeight;
  279.     BYTE bMaxHandWeight;
  280. DWORD dwExp;
  281. DWORD dwMaxExp;
  282. WORD wMaxWeight;
  283. }ACTORABILITY, *LPACTORABILITY;
  284. typedef struct tagACTORSUBABILITY
  285. {
  286. WORD wAntiMagic; // 付过雀乔.
  287. BYTE bHitPoint; // 沥犬.
  288. BYTE bSpeedPoint; // 刮酶.
  289. BYTE bAntiPoison; // 吝刀雀乔.
  290. BYTE bPoisonRecover; // 吝刀雀汗.
  291. BYTE bHealthRecover; // 眉仿雀汗.
  292. BYTE bSpellRecover; // 付仿雀汗.
  293. }ACTORSUBABILITY, *LPACTORSUBABILITY;
  294. #pragma pack(8)
  295. class CMyHero : public CHero
  296. {
  297. private:
  298. public:
  299. //---------------------------------------------------------------------------------------------------------------//
  300. //  某腐磐 焊沥侩 函荐.
  301. DWORD m_dwMotionLockTime;
  302. BOOL m_bInputLock; // 某腐磐啊 悼累登搁 绢恫涝仿档 罐瘤 臼绰促.
  303. BOOL m_bMotionLock; // 某腐磐狼 悼累捞 技泼登搁 辑滚俊辑 悼累铰牢捞 坷扁傈鳖柳 绢恫悼累档 罐瘤 臼绰促.
  304. //---------------------------------------------------------------------------------------------------------------//
  305. CMapHandler* m_pxMap;
  306. BOOL m_bCanRun;
  307. BYTE m_bAttackMode;
  308. ACTORABILITY    m_stAbility;
  309. ACTORSUBABILITY m_stSubAbility;
  310. BYTE     m_bJob;
  311. UINT m_nGlod;
  312. CWHQueue m_xPriorPacketQueue; // Actor啊 贸府秦具瞪 皋矫瘤甫 历厘窍绊 乐绰 钮.
  313. //---------------------------------------------------------------------------------------------------------------//
  314. //  某腐磐 Delay包访 函荐.
  315. DWORD m_dwLastHitTime; // 漠龙捞 甸绢艾阑锭狼 平 焊包蔼.
  316. DWORD m_dwLastSpellTime; // 付过捞 甸绢艾阑锭狼 平 焊包蔼.
  317. DWORD m_dwLastMagicTime; // 堪拳搬 矫傈饶狼 平焊包蔼.
  318. DWORD m_dwLastStruckTime; // 嘎疽阑锭狼 平 焊包蔼.
  319. DWORD m_dwLastPKStruckTime;
  320. DWORD m_dwLastRushTime; // 公怕焊 矫傈饶狼 平焊包蔼.
  321. DWORD m_dwLastFireHitTime; // 堪拳搬 矫傈饶狼 平焊包蔼.
  322. WORD m_wMagicPKDelayTime; // 付过栏肺 荤恩阑 傍拜沁阑锭狼 菩澄萍Delay.(叭扁客 顿扁俊 利侩等促.)
  323. WORD m_wMagicDelayTime; // 付过阑静绊 抄饶 促澜付过捞 甸绢哎锭鳖瘤狼 Delay.
  324. //---------------------------------------------------------------------------------------------------------------//
  325. protected:
  326. public:
  327. CMyHero();
  328. ~CMyHero();
  329. virtual VOID InitActor();
  330. virtual VOID DestroyActor();
  331. VOID  SetMotionState(BYTE bMtn, BYTE bDir, INT nMouseTargetID = NULL, BOOL bIsDead = FALSE, LPPOINT lpptPos = NULL, SHORT shSkill = -1);
  332. VOID  SetMapHandler(CMapHandler* pxMap);
  333. VOID  SetMagic(LPCLIENTMAGICRCD pstMagic, BYTE bKeyNum, BYTE bDir, INT nTargetID, FEATURE stTargetFeature, POINT ptTargetPos);
  334. BOOL  SetOldPosition();
  335. BOOL  CheckMyPostion();
  336. VOID  AdjustMyPostion();
  337. BYTE  CalcDirection(INT nTargetTileX, INT nTargetTileY);
  338. POINT GetPosMouseToTile(INT nXPos, INT nYPos);
  339. virtual BOOL Create(CImageHandler* pxImgHandler, BYTE bMtn, BYTE bDir, WORD wPosX, WORD wPosY, FEATURE* pstFeature, FEATUREEX* pstFeatureEx);
  340. virtual VOID OnHealthSpellChanged(LPPACKETMSG lpPacketMsg);
  341. virtual BOOL UpdatePacketState();
  342. virtual VOID UpdateMotionState(INT nLoopTime, BOOL bIsMoveTime);
  343. virtual BOOL UpdateMove(BOOL bIsMoveTime);
  344. virtual BOOL DrawActor(BOOL bFocused = FALSE, BOOL bShadowAblended = FALSE, 
  345.                    BOOL bUseScrnPos = FALSE, BOOL bDrawShadow = TRUE);
  346. __inline virtual BOOL ChangeFeature(FEATURE stFeature, FEATUREEX stFeatureEx)
  347. {
  348. if ( m_bIsMon )
  349. {
  350. if ( CActor::ChangeFeature(stFeature) ) return TRUE;
  351. }
  352. else
  353. {
  354. if ( CHero::ChangeFeature(stFeature, stFeatureEx) ) return TRUE;
  355. }
  356. return FALSE;
  357. }
  358. //---------------------------------------------------------------------------------------------------------------//
  359. //  某腐磐 Delay包访 窃荐.
  360. BOOL CanNextHit(); // 瘤陛 漠龙且荐 乐唱狼 咯何. 饭骇苞 馒侩公霸俊 蝶扼 崔扼柳促.
  361. BOOL CanWalk(); // Delay客 包访瘤绢辑 某腐磐啊 框流老荐 乐绰瘤狼 咯何.
  362. BOOL CanRun(); // Delay客 包访瘤绢辑 某腐磐啊 框流老荐 乐绰瘤狼 咯何.
  363. //---------------------------------------------------------------------------------------------------------------//
  364. //---------------------------------------------------------------------------------------------------------------//
  365. //  蜡历 涝仿窃荐.
  366. BOOL OnLButtonDown(POINT ptMouse, INT nTargetID = -1, BOOL bIsDead = FALSE, POINT* lpptTargetPos = NULL);
  367. BOOL OnRButtonDown(POINT ptMouse);
  368. BOOL OnKeyDown(WPARAM wParam, LPARAM lParam, POINT ptMouse, POINT ptTargetPos, INT nMosueTargetID, FEATURE stTargetFeature);
  369. //---------------------------------------------------------------------------------------------------------------//
  370. };
  371. #endif // _CACTOR_H