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

模拟服务器

开发平台:

Visual C++

  1. #include "StdAfx.h"
  2. extern CWHQueue PacketQ;
  3. char szBuff[8192];
  4. int nBuff = 0;
  5. void DevideScript(char *pszScript);
  6. /******************************************************************************************************************
  7. 霸烙 敲饭捞 包访 窃荐甸.
  8. *******************************************************************************************************************/
  9. /******************************************************************************************************************
  10. 窃荐疙 : CGameProcess::CGameProcess()
  11. 累己磊 : 
  12. 累己老 : 
  13. 格利   : 
  14. 免仿   : 
  15. [老磊][荐沥磊] : 荐沥郴侩
  16. *******************************************************************************************************************/
  17. CGameProcess::CGameProcess()
  18. {
  19. Init();
  20. }
  21. /******************************************************************************************************************
  22. 窃荐疙 : CGameProcess::~CGameProcess()
  23. 累己磊 : 
  24. 累己老 : 
  25. 格利   : 
  26. 免仿   : 
  27. [老磊][荐沥磊] : 荐沥郴侩
  28. *******************************************************************************************************************/
  29. CGameProcess::~CGameProcess()
  30. {
  31. DeleteProc();
  32. }
  33. VOID CGameProcess::Init()
  34. {
  35. m_bTileView = FALSE;
  36. m_bObj1View = FALSE;
  37. m_bObj2View = FALSE;
  38. m_bCellView = FALSE;
  39. m_bStatusView = FALSE;
  40. m_bStopPtView = FALSE;
  41. m_bRender = FALSE;
  42. m_bShowSnow = FALSE;
  43. m_bShowMist = FALSE;
  44. m_bShowRain = FALSE;
  45. m_bShadowABlend = FALSE;
  46. m_bShowFPS = FALSE;
  47. ZeroMemory(&m_ptMousePos, sizeof(POINT));
  48. ZeroMemory(&m_ptCurrTile, sizeof(POINT));
  49. ZeroMemory(m_stMemMappedID, sizeof(MEMMAPPEDID)*_VIEW_CELL_X_COUNT* _VIEW_CELL_Y_COUNT);
  50. m_bDayState = _DAYSTATE_DAY;
  51. m_bFogState = _FOGSTATE_DAY;
  52. m_pxMouseTargetActor = NULL; // 泅犁 付快胶啊 啊府虐绰 镑狼 鸥百咀磐.
  53. m_pxMouseOldTargetActor = NULL; // 历厘登绢乐绰 鸥百咀磐.
  54. m_pxSavedTargetActor = NULL;
  55. m_fTileLightRed = 255;
  56. m_fTileLightGreen = 230;
  57. m_fTileLightBlue = 180;
  58. m_fDarkRate = 255.0f;
  59. m_wInputDelayTime = 0;
  60. m_wCurrInputDelayTime = 0;
  61. m_wNPCWndPosX = 0;
  62. m_wNPCWndPosY = 0;
  63. ZeroMemory(m_wShadowClr, 800);
  64. m_bShowShine = FALSE;
  65. m_dwLastShineTick = timeGetTime();
  66. m_wShineCurrDelay = 0;
  67. m_bCurrShineFrame = 0;
  68. ZeroMemory(m_lpddsShineTextr, sizeof(LPDIRECTDRAWSURFACE7)*10);
  69.   D3DVECTOR vNorm(0, 0, -1);
  70. m_avBillboard[0]  = D3DVERTEX(D3DVECTOR(-0.5f, 0.5f, 0), vNorm, 0, 0);
  71. m_avBillboard[1]  = D3DVERTEX(D3DVECTOR(-0.5f,-0.5f, 0), vNorm, 0, 1);
  72. m_avBillboard[2]  = D3DVERTEX(D3DVECTOR( 0.5f, 0.5f, 0), vNorm, 1, 0);
  73. m_avBillboard[3]  = D3DVERTEX(D3DVECTOR( 0.5f,-0.5f, 0), vNorm, 1, 1);
  74. ZeroMemory(m_szMapName, MAX_PATH);
  75. m_xImage.InitAllImage();
  76. m_xInterface.Init();
  77. m_xMyHero.InitActor();
  78. m_xMap.InitMapHandler();
  79. m_xLightFog.Init(RGB(255, 255, 255));
  80. m_xMist.Init();
  81. m_xFlyingTail.InitSystem();
  82. m_xSmoke.InitSystem();
  83. m_xSnow.InitSystem();
  84. m_xRain.InitSystem();
  85. // m_xElec.InitElec();
  86. m_hBrush = CreateSolidBrush(RGB(200, 150, 100));
  87. }
  88. VOID CGameProcess::DeleteProc()
  89. {
  90. INT nCnt;
  91. SHORT shLeftMsgCnt;
  92. LPPACKETMSG lpPacketMsg;
  93. lpPacketMsg  = NULL;
  94. shLeftMsgCnt = m_xWaitPacketQueue.GetCount();
  95. // 阶咯乐绰 菩哦阑 瘤款促.
  96. if ( shLeftMsgCnt > 0 )
  97. {
  98. for ( nCnt = 0; nCnt < shLeftMsgCnt; nCnt++ )
  99. {
  100. lpPacketMsg = (LPPACKETMSG)m_xWaitPacketQueue.PopQ();
  101. if ( lpPacketMsg )
  102. {
  103. SAFE_DELETE(lpPacketMsg);
  104. }
  105. }
  106. }
  107. lpPacketMsg  = NULL;
  108. shLeftMsgCnt = m_xWaitDefaultPacketQueue.GetCount();
  109. // 阶咯乐绰 菩哦阑 瘤款促.
  110. if ( shLeftMsgCnt > 0 )
  111. {
  112. for ( nCnt = 0; nCnt < shLeftMsgCnt; nCnt++ )
  113. {
  114. lpPacketMsg = (LPPACKETMSG)m_xWaitDefaultPacketQueue.PopQ();
  115. if ( lpPacketMsg )
  116. {
  117. SAFE_DELETE(lpPacketMsg);
  118. }
  119. }
  120. }
  121. D3DWILTextr_InvalidateAllTextures();
  122. D3DWILTextr_DestroyAllTextures();
  123. DeleteObject(m_hBrush);
  124. m_xImage.DeleteAllImage();
  125. m_xMap.DestroyMapHandler();
  126. m_xInterface.Destroy();
  127. m_xMyHero.DestroyActor();
  128. m_xMist.Destory();
  129. m_xSnow.DestroySystem();
  130. m_xRain.DestroySystem();
  131. m_xActorList.ClearAllNodes();
  132. m_xMagicList.ClearAllNodes();
  133. m_xGroundMagicList.ClearAllNodes();
  134. m_stMapItemList.ClearAllNodes();
  135. g_xClientSocket.DisconnectToServer();
  136. Init();
  137. }
  138. /******************************************************************************************************************
  139. 窃荐疙 : CGameProcess::Load()
  140. 累己磊 : 
  141. 累己老 : 
  142. 格利   : 
  143. 免仿   : VOID 
  144. [老磊][荐沥磊] : 荐沥郴侩
  145. *******************************************************************************************************************/
  146. VOID CGameProcess::Load()
  147. {
  148. INT nCnt;
  149. g_xMainWnd.ResetDXG(800, 600, _SCREEN_BPP, _DXG_SCREENMODE_WINDOW, _DXG_DEVICEMODE_PRIMARY|_DXG_DEVICEMODE_D3D);
  150. // g_xMainWnd.ResetDXG(800, 600, _SCREEN_BPP, _DXG_SCREENMODE_FULLSCREEN, _DXG_DEVICEMODE_PRIMARY|_DXG_DEVICEMODE_D3D);
  151. /* CHAR szSetup[MAX_PATH];
  152. ZeroMemory(szSetup, MAX_PATH);
  153. jRegGetKey(_T("Software\WEMADE Entertainment\固福狼傈汲2"), _T("setup path"), (LPBYTE)szSetup);
  154. for ( nCnt = strlen(szSetup); nCnt >= 0; nCnt--)
  155. {
  156. if ( szSetup[nCnt] == '\' )
  157. {
  158. szSetup[nCnt+1] = NULL;
  159. break; 
  160. }
  161. }
  162. */
  163. Init();
  164. m_xLightFog.Init(RGB(255, 255, 255));
  165. m_xImage.LoadAllImage();
  166. m_xInterface.CreateInterface(&m_xImage);
  167. m_xNotice.Load(&m_xImage.m_xImageList[_IMAGE_INTER]);
  168. g_xClientSocket.ConnectToServer(g_xMainWnd.GetSafehWnd(), g_szServerIP, g_nServerPort);
  169. /* for ( nCnt = 0; nCnt < m_xImage.m_xImageList[_IMAGE_MAGIC].m_stNewWixImgaeInfo.nIndexCount; nCnt++)
  170. {
  171. if ( m_xImage.m_xImageList[_IMAGE_MAGIC].NewSetIndex(nCnt) )
  172. {
  173. D3DWILTextr_CreateEmptyTexture(m_xImage.m_xImageList[_IMAGE_MAGIC].m_szWilFileName, nCnt, 
  174.    m_xImage.m_xImageList[_IMAGE_MAGIC].m_lpstNewCurrWilImageInfo->shWidth,
  175.    m_xImage.m_xImageList[_IMAGE_MAGIC].m_lpstNewCurrWilImageInfo->shHeight,
  176.    (WORD*)m_xImage.m_xImageList[_IMAGE_MAGIC].m_pbCurrImage, D3DTEXTR_TRANSPARENTBLACK);
  177. }
  178. }
  179. for ( nCnt = 0; nCnt < m_xImage.m_xImageList[_IMAGE_MONMAGIC].m_stNewWixImgaeInfo.nIndexCount; nCnt++)
  180. {
  181. if ( m_xImage.m_xImageList[_IMAGE_MONMAGIC].NewSetIndex(nCnt) )
  182. {
  183. D3DWILTextr_CreateEmptyTexture(m_xImage.m_xImageList[_IMAGE_MONMAGIC].m_szWilFileName, nCnt, 
  184.    m_xImage.m_xImageList[_IMAGE_MONMAGIC].m_lpstNewCurrWilImageInfo->shWidth,
  185.    m_xImage.m_xImageList[_IMAGE_MONMAGIC].m_lpstNewCurrWilImageInfo->shHeight,
  186.    (WORD*)m_xImage.m_xImageList[_IMAGE_MONMAGIC].m_pbCurrImage, D3DTEXTR_TRANSPARENTBLACK);
  187. }
  188. }
  189. */
  190. /* // 酒捞袍 馆娄芭覆 咆胶苗.
  191. for ( nCnt = 0; nCnt < 10; nCnt++)
  192. {
  193. if ( m_xImage.m_xImageList[_IMAGE_PROGUSE].NewSetIndex(nCnt+40) )
  194. {
  195. D3DWILTextr_CreateEmptyTexture(m_xImage.m_xImageList[_IMAGE_PROGUSE].m_szWilFileName, nCnt+40, 
  196.    m_xImage.m_xImageList[_IMAGE_PROGUSE].m_lpstNewCurrWilImageInfo->shWidth,
  197.    m_xImage.m_xImageList[_IMAGE_PROGUSE].m_lpstNewCurrWilImageInfo->shHeight,
  198.    (WORD*)m_xImage.m_xImageList[_IMAGE_PROGUSE].m_pbCurrImage, D3DTEXTR_TRANSPARENTBLACK);
  199. m_lpddsShineTextr[nCnt] = D3DWILTextr_RestoreEx(m_xImage.m_xImageList[_IMAGE_PROGUSE].m_szWilFileName, nCnt+40, g_xMainWnd.Get3DDevice());
  200. }
  201. }
  202. */
  203. m_xMist.Create();
  204. m_xSnow.InitSystem();
  205. m_xSnow.SetupSystem();
  206. m_xRain.InitSystem();
  207. m_xRain.SetupSystem();
  208. m_xFlyingTail.InitSystem();
  209. m_xFlyingTail.SetupSystem();
  210. m_xSmoke.InitSystem();
  211. m_xSmoke.SetupSystem();
  212. // m_xElec.InitElec();
  213. // m_xElec.SetupElec();
  214. ZeroMemory(m_stMemMappedID, sizeof(MEMMAPPEDID)*_VIEW_CELL_X_COUNT* _VIEW_CELL_Y_COUNT);
  215. SendMessage(g_xChatEditBox.GetSafehWnd(),EM_SETPASSWORDCHAR, NULL, NULL);
  216. g_xChatEditBox.SetLimitText(90);
  217. WORD wShadowClr = g_xMainWnd.ConvertColor24To16(RGB(20, 20, 20));
  218. for ( nCnt = 0; nCnt < 800; nCnt++ )
  219. {
  220. m_wShadowClr[nCnt] = wShadowClr;
  221. }
  222. m_xMap.LoadMapImage(&m_xImage);
  223. SetTimer(g_xMainWnd.GetSafehWnd(), WM_USER + 5000, 10, NULL); // Temp
  224. }
  225. /******************************************************************************************************************
  226. 窃荐疙 : CGameProcess::LoadMapChanged()
  227. 累己磊 : 
  228. 累己老 :  
  229. 格利   : 甘捞 官差菌阑锭 皋葛府 秦力客 积己, 棺 单捞鸥 肺靛.
  230. 涝仿   : CHAR* szMap
  231. 免仿   : VOID 
  232. [老磊][荐沥磊] : 荐沥郴侩
  233. *******************************************************************************************************************/
  234. VOID CGameProcess::LoadMapChanged(CHAR* szMap)
  235. {
  236. m_xMap.LoadMapData(szMap);
  237. ZeroMemory(m_stMemMappedID, sizeof(MEMMAPPEDID)*_VIEW_CELL_X_COUNT* _VIEW_CELL_Y_COUNT);
  238. }
  239. VOID CGameProcess::SetNextProc()
  240. {
  241. DeleteProc();
  242. g_xClientSocket.m_pxDefProc = g_xMainWnd.m_pxDefProcess = &g_xLoginProc;
  243. g_xLoginProc.Load();
  244. g_bProcState = _LOGIN_PROC;
  245. /*  g_xMainWnd.m_pxDefProcess = &g_xChrSelProc;
  246. g_xChrSelProc.Load();
  247. g_bProcState = _CHAR_SEL_PROC; 
  248. g_xChrSelProc.OnBeforeSelectChar();
  249. */
  250. }
  251.  
  252. BOOL CGameProcess::TargetInLongAttack(BYTE bDir)
  253. {
  254. INT nCnt;
  255. POINT ptLongTarget;
  256. if ( !m_xMap.GetNextTileCanMove(m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, bDir, 2, &ptLongTarget) )
  257. {
  258. CActor* pxActor;
  259. m_xActorList.MoveCurrentToTop();
  260. for ( nCnt = 0; nCnt < m_xActorList.GetCounter(); nCnt++)
  261. {
  262. pxActor = m_xActorList.GetCurrentData();
  263. if ( pxActor->m_wPosX == ptLongTarget.x && pxActor->m_wPosY == ptLongTarget.y )
  264. {
  265. return TRUE;
  266. }
  267. m_xActorList.MoveNextNode();
  268. }
  269. }
  270. return FALSE;
  271. }
  272. VOID CGameProcess::CheckMappedData(INT nLoopTime, BOOL bIsMoveTime)
  273. {
  274. INT nCnt, nObjCnt;
  275. BOOL bIsSaveTargetExisted = FALSE;
  276. BOOL bFocused;
  277. ZeroMemory(m_stMemMappedID, sizeof(MEMMAPPEDID)*_VIEW_CELL_X_COUNT* _VIEW_CELL_Y_COUNT);
  278. CActor* pxActor = NULL;
  279. CActor* pxDeadTargetActor = NULL;
  280. m_xActorList.MoveCurrentToTop();
  281. for ( nCnt = 0; nCnt < m_xActorList.GetCounter(); )
  282. {
  283. pxActor = m_xActorList.GetCurrentData();
  284. if ( !pxActor )
  285. continue;
  286. switch ( pxActor->m_stFeature.bGender )
  287. {
  288. case _GENDER_MAN:
  289. case _GENDER_WOMAN:
  290. {
  291. CHero* pxHero;
  292. pxHero = (CHero*)pxActor;
  293. pxHero->UpdateMotionState(nLoopTime, bIsMoveTime);
  294. m_xActorList.MoveNextNode();
  295. nCnt++;
  296. }
  297. break;
  298. case _GENDER_NPC:
  299. {
  300. CNPC* pxNPC;
  301. pxNPC = (CNPC*)pxActor;
  302. pxNPC->UpdateMotionState(nLoopTime, bIsMoveTime);
  303. m_xActorList.MoveNextNode();
  304. nCnt++;
  305. }
  306. break;
  307. case _GENDER_MON:
  308. {
  309. pxActor->UpdateMotionState(nLoopTime, bIsMoveTime);
  310. if ( pxActor->m_bAppearState == _DIG_DOWNDEL )
  311. {
  312. m_xActorList.DeleteCurrentNodeEx();
  313. delete((CActor*)pxActor);
  314. pxActor = NULL;
  315. }
  316. else
  317. {
  318. m_xActorList.MoveNextNode();
  319. nCnt++;
  320. }
  321. }
  322. break;
  323. }
  324. if ( !pxActor )
  325. continue;
  326. if ( pxActor->m_wPosX >= m_xMap.m_shStartViewTileX && pxActor->m_wPosX < m_xMap.m_shStartViewTileX + _VIEW_CELL_X_COUNT && 
  327.  pxActor->m_wPosY >= m_xMap.m_shStartViewTileY && pxActor->m_wPosY < m_xMap.m_shStartViewTileY + _VIEW_CELL_Y_COUNT )  
  328. {
  329. for ( nObjCnt = 0; nObjCnt < _MAX_CELL_OBJ; nObjCnt++ )
  330. {
  331. if ( m_stMemMappedID[pxActor->m_wPosY - m_xMap.m_shStartViewTileY][pxActor->m_wPosX - m_xMap.m_shStartViewTileX].pxActor[nObjCnt] == NULL )
  332. {
  333. bFocused = FALSE;
  334. if ( pxActor == m_pxSavedTargetActor )
  335. {
  336. bIsSaveTargetExisted = TRUE;
  337. }
  338. // 弊覆狼 矫累谅钎, 器目胶惑怕, 弊覆磊 喉坊爹 惑怕甫 逞败霖促.
  339. if ( !m_pxMouseTargetActor /*&& !pxActor->m_bIsDead*/ )
  340. {
  341. if ( PtInRect(&pxActor->m_rcActor, m_ptMousePos) )
  342. {
  343. m_pxMouseTargetActor = pxActor;
  344. bFocused = TRUE;
  345. }
  346. }
  347. else
  348. {
  349. if ( PtInRect(&pxActor->m_rcTargetRgn, m_ptMousePos) )
  350. {
  351. if ( !pxActor->m_bIsDead )
  352. {
  353. m_pxMouseTargetActor = pxActor;
  354. bFocused = TRUE;
  355. }
  356. else
  357. {
  358. pxDeadTargetActor = pxActor;
  359. bFocused = TRUE;
  360. }
  361. }
  362. }
  363. // 磷篮 Actor绰 菊栏肺 动变促.
  364. if ( pxActor->m_bIsDead )
  365. {
  366. CActor* pxTempActor[_MAX_CELL_OBJ];
  367. ZeroMemory(pxTempActor, sizeof(CActor*)*_MAX_CELL_OBJ);
  368. pxTempActor[0] = pxActor;
  369. memcpy(&pxTempActor[1], m_stMemMappedID[pxActor->m_wPosY - m_xMap.m_shStartViewTileY][pxActor->m_wPosX - m_xMap.m_shStartViewTileX].pxActor, sizeof(CActor*)*(_MAX_CELL_OBJ-1));
  370. memcpy(m_stMemMappedID[pxActor->m_wPosY - m_xMap.m_shStartViewTileY][pxActor->m_wPosX - m_xMap.m_shStartViewTileX].pxActor, pxTempActor, sizeof(CActor*)*(_MAX_CELL_OBJ));
  371. /* switch ( pxActor->m_stFeature.bGender )
  372. {
  373. case _GENDER_MAN:
  374. case _GENDER_WOMAN:
  375. {
  376. CHero* pxHero;
  377. pxHero = (CHero*)pxActor;
  378. pxHero->DrawActor(&m_xMap, bFocused);
  379. }
  380. break;
  381. case _GENDER_NPC:
  382. {
  383. CNPC* pxNPC;
  384. pxNPC = (CNPC*)pxActor;
  385. pxNPC->DrawActor(&m_xMap, bFocused);
  386. }
  387. break;
  388. case _GENDER_MON:
  389. {
  390. pxActor->DrawActor(&m_xMap, bFocused);
  391. }
  392. break;
  393. }
  394. */
  395. }
  396. else
  397. m_stMemMappedID[pxActor->m_wPosY - m_xMap.m_shStartViewTileY][pxActor->m_wPosX - m_xMap.m_shStartViewTileX].pxActor[nObjCnt] = pxActor;
  398. break;
  399. }
  400. }
  401. }
  402. if ( !bIsSaveTargetExisted ) m_pxSavedTargetActor = NULL;
  403. if ( !m_pxMouseTargetActor && pxDeadTargetActor )
  404. {
  405. m_pxMouseTargetActor = pxDeadTargetActor;
  406. }
  407. CMagic* pxMagic;
  408. m_xGroundMagicList.MoveCurrentToTop();
  409. for ( nCnt = 0; nCnt < m_xGroundMagicList.GetCounter(); )
  410. {
  411. pxMagic = m_xGroundMagicList.GetCurrentData();
  412. if ( pxMagic->m_bMagicNum == _SKILL_HOLYSHIELD || pxMagic->m_bMagicNum == _SKILL_EARTHFIRE )
  413. {
  414. CRepeatMagic* pxRepeatMagic = (CRepeatMagic*)pxMagic;
  415. pxRepeatMagic->UpdateMagic(nLoopTime);
  416. if ( pxRepeatMagic->m_bActiveState == _MAGIC_FINISH )
  417. {
  418. m_xGroundMagicList.DeleteCurrentNodeEx();
  419. delete((CRepeatMagic*)pxRepeatMagic);
  420. pxRepeatMagic = NULL;
  421. }
  422. else
  423. {
  424. if ( pxMagic->m_shTargetTileX >= m_xMap.m_shStartViewTileX && pxMagic->m_shTargetTileX < m_xMap.m_shStartViewTileX  + _VIEW_CELL_X_COUNT && 
  425.  pxMagic->m_shTargetTileY >= m_xMap.m_shStartViewTileY && pxMagic->m_shTargetTileY < m_xMap.m_shStartViewTileY  + _VIEW_CELL_Y_COUNT )
  426. {
  427. for ( nObjCnt = 0; nObjCnt < _MAX_CELL_OBJ; nObjCnt++ )
  428. {
  429. if ( m_stMemMappedID[pxMagic->m_shTargetTileY - m_xMap.m_shStartViewTileY][pxMagic->m_shTargetTileX - m_xMap.m_shStartViewTileX].pxMagic[nObjCnt] == NULL )
  430. {
  431.   m_stMemMappedID[pxMagic->m_shTargetTileY - m_xMap.m_shStartViewTileY][pxMagic->m_shTargetTileX - m_xMap.m_shStartViewTileX].pxMagic[nObjCnt] = pxMagic;
  432. break;
  433. }
  434. }
  435. }
  436. m_xGroundMagicList.MoveNextNode();
  437. nCnt++;
  438. }
  439. }
  440. else if ( pxMagic->m_bMagicNum == _SKILL_FIRE )
  441. {
  442. CMagicStream* pxMagicStream = (CMagicStream*)pxMagic;
  443. pxMagicStream->UpdateMagic(nLoopTime);
  444. if ( pxMagicStream->m_bActiveState == _MAGIC_FINISH )
  445. {
  446. m_xGroundMagicList.DeleteCurrentNodeEx();
  447. delete((CMagicStream*)pxMagicStream);
  448. pxMagicStream = NULL;
  449. }
  450. else
  451. {
  452. if ( pxMagic->m_shTargetTileX >= m_xMap.m_shStartViewTileX && pxMagic->m_shTargetTileX < m_xMap.m_shStartViewTileX  + _VIEW_CELL_X_COUNT && 
  453.  pxMagic->m_shTargetTileY >= m_xMap.m_shStartViewTileY && pxMagic->m_shTargetTileY < m_xMap.m_shStartViewTileY  + _VIEW_CELL_Y_COUNT )
  454. {
  455. for ( nObjCnt = 0; nObjCnt < _MAX_CELL_OBJ; nObjCnt++ )
  456. {
  457. if ( m_stMemMappedID[pxMagic->m_shTargetTileY - m_xMap.m_shStartViewTileY][pxMagic->m_shTargetTileX - m_xMap.m_shStartViewTileX].pxMagic[nObjCnt] == NULL )
  458. {
  459. m_stMemMappedID[pxMagic->m_shTargetTileY - m_xMap.m_shStartViewTileY][pxMagic->m_shTargetTileX - m_xMap.m_shStartViewTileX].pxMagic[nObjCnt] = pxMagic;
  460. break;
  461. }
  462. }
  463. }
  464. m_xGroundMagicList.MoveNextNode();
  465. nCnt++;
  466. }
  467. }
  468. }
  469. LPGROUNDITEM pstItem;
  470. m_stMapItemList.MoveCurrentToTop();
  471. for ( nCnt = 0; nCnt < m_stMapItemList.GetCounter(); nCnt++ )
  472. {
  473. pstItem = m_stMapItemList.GetCurrentData();
  474. if ( pstItem->shTileX >= m_xMap.m_shStartViewTileX && pstItem->shTileX < m_xMap.m_shStartViewTileX  + _VIEW_CELL_X_COUNT && 
  475.  pstItem->shTileY >= m_xMap.m_shStartViewTileY && pstItem->shTileY < m_xMap.m_shStartViewTileY  + _VIEW_CELL_Y_COUNT )
  476. {
  477. for ( nObjCnt = 0; nObjCnt < _MAX_CELL_OBJ; nObjCnt++ )
  478. {
  479. if ( m_stMemMappedID[pstItem->shTileY - m_xMap.m_shStartViewTileY][pstItem->shTileX - m_xMap.m_shStartViewTileX].pstItem[nObjCnt] == NULL )
  480. {
  481. m_stMemMappedID[pstItem->shTileY - m_xMap.m_shStartViewTileY][pstItem->shTileX - m_xMap.m_shStartViewTileX].pstItem[nObjCnt] = pstItem;
  482. break;
  483. }
  484. }
  485. }
  486. m_stMapItemList.MoveNextNode();
  487. }
  488. }
  489. VOID CGameProcess::AutoTargeting()
  490. {
  491. static BYTE bLastDir = _DIRECTION_LIST_1;
  492. if ( !m_xMyHero.m_bMotionLock && !m_xMyHero.m_bInputLock && m_pxSavedTargetActor )
  493. {
  494. SHORT shLeftMsgCnt = m_xMyHero.m_xPacketQueue.GetCount();
  495. if ( shLeftMsgCnt > 0 )
  496. {
  497. if ( m_xMyHero.m_stFeatureEx.bHorse == _HORSE_NONE ) m_xMyHero.SetMotionState(_MT_STAND,      m_xMyHero.m_bCurrDir);
  498. else m_xMyHero.SetMotionState(_MT_HORSESTAND, m_xMyHero.m_bCurrDir);
  499. m_xMyHero.UpdatePacketState();
  500. return;
  501. }
  502. POINT ptTargetTile = {0, 0};
  503. BYTE bDir = m_xMyHero.CalcDirection(m_pxSavedTargetActor->m_wPosX, m_pxSavedTargetActor->m_wPosY);
  504. if ( m_pxSavedTargetActor->m_bIsDead )
  505. return;
  506. if ( (m_pxSavedTargetActor->m_stFeature.bGender == _GENDER_MON && m_pxSavedTargetActor->m_bCurrMtn == _MT_MON_DIE) ||
  507.  (m_pxSavedTargetActor->m_stFeature.bGender <= _GENDER_WOMAN && m_pxSavedTargetActor->m_bCurrMtn == _MT_DIE) )
  508.  return;
  509. if ( (INT)(sqrt((m_xMyHero.m_wPosX-m_pxSavedTargetActor->m_wPosX)*(m_xMyHero.m_wPosX-m_pxSavedTargetActor->m_wPosX) +  (m_xMyHero.m_wPosY-m_pxSavedTargetActor->m_wPosY)*(m_xMyHero.m_wPosY-m_pxSavedTargetActor->m_wPosY)))
  510.       < 2 )
  511. {
  512. if ( m_xMyHero.m_stFeatureEx.bHorse == _HORSE_NONE && !m_pxSavedTargetActor->m_bIsDead )
  513. {
  514. // 傍拜茄促.
  515. ptTargetTile.x = m_xMyHero.m_wPosX;
  516. ptTargetTile.y = m_xMyHero.m_wPosY;
  517. m_xMyHero.SetMotionState(_MT_ONEHSWING, bDir, m_pxSavedTargetActor->m_dwIdentity, m_pxSavedTargetActor->m_bIsDead, &ptTargetTile);
  518. }
  519. }
  520. // Actor啊 乐绰 规氢栏肺 捞悼 啊瓷茄啊?(甘加己眉农) 
  521. else if ( m_xMap.GetNextTileCanMove(m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, bDir, 1, &ptTargetTile) )
  522. {
  523. // 1鸥老 捞悼茄促.
  524. if ( m_xMyHero.m_stFeatureEx.bHorse == _HORSE_NONE )
  525. {
  526. m_xMyHero.SetMotionState(_MT_WALK, bDir);
  527. }
  528. else
  529. {
  530. m_xMyHero.SetMotionState(_MT_HORSEWALK, bDir);
  531. }
  532. bLastDir = bDir;
  533. }
  534. else if ( !m_xMap.GetNextTileCanMove(m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, bDir, 1, &ptTargetTile) )
  535. {
  536. BYTE bSelectedDirList[8] = {0, 0, 0, 0, 0, 0, 0, 0};
  537. INT nSeclectedDirCnt = -1;
  538. INT nLastDistance = 100;
  539. INT nCurrDistance;
  540. BYTE bInvDir;
  541. BYTE bSelectedDir = 255;
  542. if ( bLastDir < 4 ) bInvDir = bLastDir + 4;
  543. else bInvDir = bLastDir - 4;
  544. for ( INT nCnt = 0; nCnt < _MAX_DIRECTION; nCnt++ )
  545. {
  546. if ( m_xMap.GetNextTileCanMove(m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, nCnt, 1, &ptTargetTile) )
  547. {
  548. nCurrDistance = (INT)(sqrt((ptTargetTile.x-m_pxSavedTargetActor->m_wPosX)*(ptTargetTile.x-m_pxSavedTargetActor->m_wPosX) + (ptTargetTile.y-m_pxSavedTargetActor->m_wPosY)*(ptTargetTile.y-m_pxSavedTargetActor->m_wPosY)));
  549. if ( nCurrDistance <= nLastDistance && bInvDir != nCnt )
  550. {
  551. nLastDistance = nCurrDistance;
  552. nSeclectedDirCnt++;
  553. bSelectedDirList[nSeclectedDirCnt] = nCnt;
  554. }
  555. }
  556. }
  557. BYTE bDirOrderList[8][8] = 
  558. {
  559. {0, 7, 1, 6, 2, 5, 3, 4},
  560. {1, 0, 2, 7, 3, 6, 4, 5},
  561. {2, 1, 3, 0, 4, 7, 5, 6},
  562. {3, 2, 4, 1, 5, 0, 6, 7},
  563. {4, 5, 3, 6, 2, 7, 1, 0},
  564. {5, 6, 4, 7, 3, 0, 2, 1},
  565. {6, 7, 5, 0, 4, 1, 3, 2},
  566. {7, 0, 6, 1, 5, 2, 4, 3},
  567. };
  568. BYTE bOrderCnt = 0;
  569. for ( nCnt = 0; nCnt < nSeclectedDirCnt; nCnt++ )
  570. {
  571. while ( bSelectedDirList[nCnt] != bDirOrderList[bDir][bOrderCnt] || bOrderCnt < 8 ) bOrderCnt++;
  572. if ( bOrderCnt >= 8 ) bOrderCnt = 0;
  573. else
  574. { bSelectedDir = bLastDir = bSelectedDirList[nCnt]; break; }
  575. }
  576. if ( bSelectedDir == 255 ) bSelectedDir = bLastDir = bSelectedDirList[GetRandomNum(0, nSeclectedDirCnt+1)];
  577. if ( nSeclectedDirCnt != -1 )
  578. {
  579. // 1鸥老 捞悼茄促.
  580. m_xMap.GetNextTileCanMove(m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, bSelectedDir, 1, &ptTargetTile);
  581. if ( m_xMyHero.m_stFeatureEx.bHorse == _HORSE_NONE )
  582. {
  583. m_xMyHero.SetMotionState(_MT_WALK, bSelectedDir);
  584. }
  585. else
  586. {
  587. m_xMyHero.SetMotionState(_MT_HORSEWALK, bSelectedDir);
  588. }
  589. }
  590. else
  591. {
  592. if ( m_xMyHero.m_stFeatureEx.bHorse == _HORSE_NONE )
  593. {
  594. m_xMyHero.SetMotionState(_MT_STAND, bDir);
  595. }
  596. else
  597. {
  598. m_xMyHero.SetMotionState(_MT_HORSESTAND, bDir);
  599. }
  600. }
  601. }
  602. else
  603. {
  604. if ( m_xMyHero.m_stFeatureEx.bHorse == _HORSE_NONE )
  605. {
  606. m_xMyHero.SetMotionState(_MT_STAND, bDir);
  607. }
  608. else
  609. {
  610. m_xMyHero.SetMotionState(_MT_HORSESTAND, bDir);
  611. }
  612. }
  613. }
  614. }
  615. VOID CGameProcess::DropItemShow()
  616. {
  617. if ( m_stMapItemList.GetCounter() != 0 )
  618. {
  619. m_stMapItemList.MoveCurrentToTop();
  620. LPGROUNDITEM pstItem;
  621. for ( INT nCnt = 0; nCnt < m_stMapItemList.GetCounter(); nCnt++ )
  622. {
  623. pstItem = m_stMapItemList.GetCurrentData();
  624. if ( pstItem->shTileX == m_ptCurrTile.x && pstItem->shTileY == m_ptCurrTile.y )
  625. {
  626. SIZE sizeLen;
  627. sizeLen  = g_xMainWnd.GetStrLength(NULL, NULL, pstItem->szItemName);
  628. INT nCenterX = (pstItem->shTileX-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX+_CELL_WIDTH /2;
  629. INT nCenterY = (pstItem->shTileY-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY+_CELL_HEIGHT/2-12;
  630. RECT rcBack;
  631. SetRect(&rcBack, nCenterX-sizeLen.cx/2, nCenterY-7, nCenterX+sizeLen.cx/2, nCenterY+8);
  632. if ( g_xMainWnd.Get3DDevice() )
  633. {
  634. if( SUCCEEDED(g_xMainWnd.Get3DDevice()->BeginScene()) )
  635. {
  636. D3DVECTOR vTrans;
  637. D3DMATRIX matTrans;
  638. D3DMATRIX matScale;
  639. D3DMATRIX matWorld;
  640. D3DMATRIX matWorldOriginal;
  641. g_xMainWnd.Get3DDevice()->GetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
  642. D3DMATERIAL7 mtrl;
  643. vTrans.x = (FLOAT)rcBack.left-400+(rcBack.right-rcBack.left)/2-1;  
  644. vTrans.y = (FLOAT)-rcBack.top+300-4; 
  645. vTrans.z = 0;
  646. D3DUtil_SetTranslateMatrix(matTrans, vTrans);
  647. D3DUtil_SetScaleMatrix(matScale, (FLOAT)rcBack.right-rcBack.left, (FLOAT)rcBack.bottom-rcBack.top, 0.0f);
  648. D3DMath_MatrixMultiply(matWorld, matScale, matTrans);
  649. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
  650. D3DUtil_InitMaterial(mtrl, 
  651.  (FLOAT)100/255.0f,
  652.  (FLOAT)100/255.0f, 
  653.  (FLOAT)100/255.0f);
  654. mtrl.diffuse.a = 125/255.0f;
  655. g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
  656. g_xMainWnd.Get3DDevice()->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
  657. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, TRUE);
  658. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
  659. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP,   D3DTOP_MODULATE);
  660. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
  661. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
  662. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
  663. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
  664. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
  665. g_xMainWnd.Get3DDevice()->SetTexture(0, NULL);
  666. g_xMainWnd.Get3DDevice()->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX, m_avBillboard, 4, NULL);
  667. // 盔惑汗蓖.
  668. ZeroMemory(&mtrl, sizeof(mtrl));
  669. mtrl.diffuse.r = mtrl.diffuse.g = mtrl.diffuse.b = 0.1f;
  670. mtrl.ambient.r = mtrl.ambient.g = mtrl.ambient.b = 1.0f;
  671. g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
  672. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
  673. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_COLOROP,   D3DTOP_MODULATE);
  674. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
  675. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
  676. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1);
  677. g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
  678. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
  679. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, FALSE);
  680. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_SRCBLEND , D3DBLEND_ONE);
  681. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
  682. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
  683. g_xMainWnd.Get3DDevice()->EndScene();
  684. }
  685. }
  686. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), nCenterX-sizeLen.cx/2-1, nCenterY-7, RGB(  0,   0,   0), RGB(0, 0, 0), pstItem->szItemName);
  687. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), nCenterX-sizeLen.cx/2  , nCenterY-8, RGB(255, 255, 125), RGB(0, 0, 0), pstItem->szItemName);
  688. break;
  689. }
  690. m_stMapItemList.MoveNextNode();
  691. }
  692. }
  693. }
  694. VOID CGameProcess::RenderScene(INT nLoopTime)
  695. {
  696. BOOL  bIsMoveTime = FALSE;
  697. static WORD  wMoveTime = 0;
  698. static DWORD dwReceiveTime = 0;
  699. wMoveTime   += nLoopTime;
  700. m_wCurrInputDelayTime += nLoopTime;
  701. if ( nLoopTime < 10000 ) dwReceiveTime += nLoopTime;
  702. if ( m_wCurrInputDelayTime >= m_wInputDelayTime )
  703. {
  704. m_wCurrInputDelayTime = 0;
  705. m_wInputDelayTime = 0;
  706. }
  707. if ( wMoveTime > 100 )
  708. {
  709. bIsMoveTime = TRUE;
  710. wMoveTime = 0;
  711. }
  712. if ( !m_bRender && dwReceiveTime > 100000 )
  713. {
  714. MessageBox(g_xMainWnd.GetSafehWnd(), "肺弊柯 沥焊甫 罐绰单 角菩沁嚼聪促. 橇肺弊伐阑 辆丰钦聪促.", "", MB_OK);
  715. PostQuitMessage(NULL);
  716. dwReceiveTime = 0;
  717. }
  718. if ( m_bRender )
  719. {
  720. m_xLightFog.ClearSavedLightColor();
  721. m_xMyHero.UpdateMotionState(nLoopTime, bIsMoveTime);
  722. // 甘阑 弊赴促.
  723. // Clear(0);
  724. g_xMainWnd.DrawWithImagePerLineClipRgn(
  725. m_xMap.m_rcView.left+_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  726. m_xMap.m_rcView.top+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY,
  727. m_xMap.m_rcView.right-m_xMap.m_rcView.left,
  728. m_xMap.m_rcView.bottom-m_xMap.m_rcView.top,
  729. m_xMap.m_wSavedMapBuffer, _CLIP_WIDTH, _CLIP_HEIGHT);
  730. m_pxMouseTargetActor = NULL;
  731. CheckMappedData(nLoopTime, bIsMoveTime);
  732. AutoTargeting();
  733. RenderObject(nLoopTime);
  734. RenderMapTileGrid(); //For Debug
  735. CMagic* pxMagic;
  736. m_xMagicList.MoveCurrentToTop();
  737. for ( INT nCnt = 0; nCnt < m_xMagicList.GetCounter(); )
  738. {
  739. pxMagic = m_xMagicList.GetCurrentData();
  740. if ( pxMagic->m_bMagicNum == _SKILL_SHOOTLIGHTEN )
  741. {
  742. CElecMagic* pxElecMagic = (CElecMagic*)pxMagic;;
  743. pxElecMagic->UpdateMagic(nLoopTime);
  744. if ( pxElecMagic->m_bActiveState == _MAGIC_FINISH )
  745. {
  746. m_xMagicList.DeleteCurrentNodeEx();
  747. delete((CElecMagic*)pxElecMagic);
  748. pxElecMagic = NULL;
  749. }
  750. else
  751. {
  752. m_xMagicList.MoveNextNode();
  753. nCnt++;
  754. }
  755. }
  756. else
  757. {
  758. pxMagic->UpdateMagic(nLoopTime);
  759. if ( pxMagic->m_bActiveState == _MAGIC_FINISH )
  760. {
  761. m_xMagicList.DeleteCurrentNodeEx();
  762. delete((CMagic*)pxMagic);
  763. pxMagic = NULL;
  764. }
  765. else
  766. {
  767. m_xMagicList.MoveNextNode();
  768. nCnt++;
  769. }
  770. }
  771. }
  772. if ( m_bShowMist ) m_xMist.ProgressMist();
  773. if ( m_bShowSnow )
  774. {
  775. m_xSnow.UpdateSystem(nLoopTime);
  776. m_xSnow.RenderSystem(g_xMainWnd.Get3DDevice());
  777. }
  778. if ( m_bShowRain )
  779. {
  780. m_xRain.UpdateSystem(nLoopTime);
  781. m_xRain.RenderSystem(g_xMainWnd.Get3DDevice());
  782. }
  783. m_xFlyingTail.UpdateSystem(nLoopTime);
  784. m_xFlyingTail.RenderSystem(g_xMainWnd.Get3DDevice());
  785. m_xSmoke.UpdateSystem(nLoopTime);
  786. m_xSmoke.RenderSystem(g_xMainWnd.Get3DDevice());
  787. // m_xElec.UpdateElec(400, 300, 0, 0);
  788. // m_xElec.RenderElec(g_xMainWnd.Get3DDevice());
  789. m_xLightFog.ShowLightFog();
  790. m_xMyHero.ShowMessage(nLoopTime);
  791. m_xMyHero.DrawHPBar();
  792. if ( m_xActorList.GetCounter() != 0 )
  793. {
  794. m_xActorList.MoveCurrentToTop();
  795. CActor* pxActor;
  796. for ( INT nCnt = 0; nCnt < m_xActorList.GetCounter(); nCnt++ )
  797. {
  798. pxActor = m_xActorList.GetCurrentData();
  799. switch ( pxActor->m_stFeature.bGender )
  800. {
  801. case _GENDER_MAN:
  802. case _GENDER_WOMAN:
  803. {
  804. CHero* pxHero;
  805. pxHero = (CHero*)pxActor;
  806. pxHero->ShowMessage(nLoopTime);
  807. pxHero->DrawHPBar();
  808. }
  809. break;
  810. case _GENDER_NPC:
  811. case _GENDER_MON:
  812. {
  813. // pxActor->ShowMessage(nLoopTime);
  814. pxActor->DrawHPBar();
  815. }
  816. break;
  817. }
  818. m_xActorList.MoveNextNode();
  819. }
  820. }
  821. DropItemShow();
  822. // RenderShine(nLoopTime);
  823. if ( m_xMagicList.GetCounter() != 0 )
  824. {
  825. m_xMagicList.MoveCurrentToTop();
  826. CMagic* pxMagic;
  827. for ( INT nCnt = 0; nCnt < m_xMagicList.GetCounter(); nCnt++ )
  828. {
  829. pxMagic = m_xMagicList.GetCurrentData();
  830. if ( pxMagic->m_bMagicNum == _SKILL_SHOOTLIGHTEN )
  831. {
  832. CElecMagic* pxElecMagic = (CElecMagic*)pxMagic;
  833. pxElecMagic->DrawMagic();
  834. }
  835. else
  836. pxMagic->DrawMagic();
  837. m_xMagicList.MoveNextNode();
  838. }
  839. }
  840. if ( m_pxMouseTargetActor )
  841. {
  842. if ( m_pxMouseOldTargetActor != m_pxMouseTargetActor )
  843. {
  844. if ( !m_pxMouseTargetActor->m_szName[0] )
  845. g_xClientSocket.SendQueryName(m_pxMouseTargetActor->m_dwIdentity, m_pxMouseTargetActor->m_wPosX, m_pxMouseTargetActor->m_wPosY);
  846. }
  847. m_pxMouseOldTargetActor = m_pxMouseTargetActor;
  848. m_pxMouseTargetActor->DrawName();
  849. //m_pxMouseTargetActor->DrawHPBar();
  850. }
  851. if ( m_wNPCWndPosX && m_wNPCWndPosY && ( abs(m_wNPCWndPosX-m_xMyHero.m_wPosX) > 5 || abs(m_wNPCWndPosY-m_xMyHero.m_wPosY) > 5) )
  852. {
  853. CloseNPCWindow();
  854. }
  855. m_xInterface.RenderInterface(nLoopTime, m_ptMousePos);
  856. ShowStatus(0, 0);
  857. }
  858. else
  859. Clear(0);
  860. //g_xMainWnd.DrawWithGrayBackBuffer();
  861. m_xNotice.RenderMessageBox(nLoopTime);
  862. }
  863. VOID CGameProcess::CloseNPCWindow()
  864. {
  865. if ( m_xInterface.m_xNPCWnd.GetGameWndActive() )
  866. {
  867. m_xInterface.DeleteWindowToList(_WND_ID_NPCCHAT);
  868. m_xInterface.m_xNPCWnd.SetGameWndActive(FALSE);
  869. m_wNPCWndPosX = m_wNPCWndPosY = 0;
  870. }
  871. }
  872. BOOL CGameProcess::RenderShine(INT nLoopTime)
  873. {
  874. DWORD dwCurrTick = timeGetTime();
  875. if ( dwCurrTick - m_dwLastShineTick > 5000 )
  876. {
  877. m_bShowShine = TRUE;
  878. m_dwLastShineTick = dwCurrTick;
  879. m_wShineCurrDelay = 0;
  880. m_bCurrShineFrame = 0;
  881. }
  882. m_wShineCurrDelay += nLoopTime;
  883. if ( m_wShineCurrDelay > 120 )
  884. {
  885. m_bCurrShineFrame++;
  886. m_wShineCurrDelay = 0;
  887. if ( m_bCurrShineFrame > 9 )
  888. {
  889. m_bCurrShineFrame = 0;
  890. m_bShowShine = FALSE;
  891. }
  892. }
  893. if ( g_xMainWnd.Get3DDevice() && m_bShowShine )
  894. {
  895. if( SUCCEEDED(g_xMainWnd.Get3DDevice()->BeginScene()) )
  896. {
  897. D3DVECTOR vTrans;
  898. D3DMATRIX matTrans;
  899. D3DMATRIX matScale;
  900. D3DMATRIX matRot;
  901. D3DMATRIX matWorld;
  902. D3DMATRIX matTempWorld;
  903. D3DMATRIX matWorldOriginal;
  904. g_xMainWnd.Get3DDevice()->GetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
  905. D3DMATERIAL7 mtrl;
  906. CWHWilImageData* pxShineImg = &m_xImage.m_xImageList[_IMAGE_PROGUSE];
  907. if ( pxShineImg->NewSetIndex(m_bCurrShineFrame+40) )
  908. {
  909. if ( m_stMapItemList.GetCounter() != 0 )
  910. {
  911. m_stMapItemList.MoveCurrentToTop();
  912. LPGROUNDITEM pstItem;
  913. for ( INT nCnt = 0; nCnt < m_stMapItemList.GetCounter(); nCnt++ )
  914. {
  915. pstItem = m_stMapItemList.GetCurrentData();
  916. /* INT nCenterX = (pstItem->shTileX-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX;
  917. INT nCenterY = (pstItem->shTileY-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY;
  918. */ INT nCenterX = (pstItem->shTileX-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX+_CELL_WIDTH /2;
  919. INT nCenterY = (pstItem->shTileY-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY+_CELL_HEIGHT/2;
  920. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
  921. vTrans.x = (FLOAT) nCenterX-400; 
  922. vTrans.y = (FLOAT)-nCenterY+300; 
  923. vTrans.z = 0;
  924. D3DUtil_SetTranslateMatrix(matTrans, vTrans);
  925. D3DUtil_SetScaleMatrix(matScale, (FLOAT)pxShineImg->m_lpstNewCurrWilImageInfo->shWidth, (FLOAT)pxShineImg->m_lpstNewCurrWilImageInfo->shHeight, 0.0f);
  926. D3DMath_MatrixMultiply(matWorld, matScale, matTrans);
  927. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
  928. if ( m_lpddsShineTextr[m_bCurrShineFrame] )
  929. g_xMainWnd.Get3DDevice()->SetTexture(0, m_lpddsShineTextr[m_bCurrShineFrame]);
  930. D3DUtil_InitMaterial(mtrl, (FLOAT)255/255.0f, (FLOAT)255/255.0f, (FLOAT)255/255.0f);
  931. mtrl.diffuse.a = 1/255.0f;
  932. g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
  933. SetBlendRenderState(g_xMainWnd.Get3DDevice(), _BLEND_LIGHTINV, mtrl);
  934. g_xMainWnd.Get3DDevice()->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX, m_avBillboard, 4, NULL);
  935. // 盔惑汗蓖.
  936. ZeroMemory(&mtrl, sizeof(mtrl));
  937. mtrl.diffuse.r = mtrl.diffuse.g = mtrl.diffuse.b = 0.1f;
  938. mtrl.ambient.r = mtrl.ambient.g = mtrl.ambient.b = 1.0f;
  939. g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
  940. ResetBlendenderState(g_xMainWnd.Get3DDevice());
  941. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
  942. m_stMapItemList.MoveNextNode();
  943. }
  944. }
  945. }
  946. g_xMainWnd.Get3DDevice()->EndScene();
  947. return S_OK;
  948. }
  949. }
  950. return E_FAIL;
  951. }
  952. VOID CGameProcess::RenderObject(INT nLoopTime)
  953. {
  954. INT  nStartX, nStartY, nObjFileIdx, nImgIdx, nArrayNum, nObjCnt;
  955. BOOL bFocused = FALSE;
  956. BOOL bLongObj = FALSE;
  957. BOOL bBlend   = FALSE;
  958. BOOL bDrawShadow = TRUE;
  959. m_xMap.SetAniTileFrame(nLoopTime);
  960. // 48*32 鸥老屈 坷宏璃飘 弊府扁.
  961. for ( INT nYCnt = m_xMap.m_shStartViewTileY-4; nYCnt < m_xMap.m_shStartViewTileY+_VIEW_CELL_Y_COUNT+6; nYCnt++ )
  962. {
  963. for ( INT nXCnt = m_xMap.m_shStartViewTileX-4; nXCnt < m_xMap.m_shStartViewTileX+_VIEW_CELL_X_COUNT+6; nXCnt++ )
  964. {
  965. if ( nYCnt >= m_xMap.m_stMapFileHeader.shHeight )
  966. break;
  967. if ( nXCnt >= m_xMap.m_stMapFileHeader.shWidth || nXCnt < 0 || nYCnt < 0 )
  968. continue; 
  969. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  970. // Test : 堡盔阑 困秦辑 -4何磐 +5鳖瘤狼 康开阑 歹 棱绰促.
  971. LIGHTINFO stLight = m_xMap.GetTileLightInfo(nXCnt, nYCnt);
  972. if ( stLight.bIsLight )
  973. {
  974. m_xLightFog.SetLightRadiusWithCircle((nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH-m_xMap.m_shViewOffsetX+_VIEW_CELL_X_START,
  975.  (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT-m_xMap.m_shViewOffsetY+_VIEW_CELL_Y_START, 
  976.  12, m_fTileLightBlue, m_fTileLightGreen, m_fTileLightRed);
  977. }
  978. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  979. nArrayNum = nYCnt + nXCnt*m_xMap.m_stMapFileHeader.shHeight;
  980. // 坷宏璃飘啊 乐阑锭.
  981. if ( m_xMap.m_pstCellInfo[nArrayNum].bFileIdx != 255 )
  982. {
  983. // 坷宏璃飘1捞 乐阑锭.
  984. if ( m_xMap.m_pstCellInfo[nArrayNum].wObj1 != 65535 )
  985. {
  986. nObjFileIdx = (m_xMap.m_pstCellInfo[nArrayNum].bFileIdx & 0XF0) >> 4;
  987. nImgIdx = m_xMap.m_pstCellInfo[nArrayNum].wObj1;
  988. if ( nObjFileIdx > 2 && nObjFileIdx < 14 )
  989. {
  990. if ( m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx) )
  991. {
  992. if ( m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth == 48 &&
  993.     m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight == 32 )
  994. {
  995. bBlend = FALSE;
  996. nImgIdx += m_xMap.GetDoorImgIdx(nXCnt, nYCnt);
  997. // 局聪皋捞记 坷宏璃飘捞搁.
  998. if ( m_xMap.m_pstCellInfo[nArrayNum].bObj1Ani != 255 )
  999. {
  1000. BYTE  bTickType;
  1001. SHORT shAniCnt;
  1002. bTickType = (m_xMap.m_pstCellInfo[nArrayNum].bObj1Ani & 0X70) >> 4;
  1003. shAniCnt = m_xMap.m_pstCellInfo[nArrayNum].bObj1Ani & 0X0F;
  1004. if ( (m_xMap.m_pstCellInfo[nArrayNum].bObj1Ani & 0X80) >> 7 )
  1005. bBlend = TRUE;
  1006. nImgIdx += m_xMap.m_bAniTileFrame[bTickType][shAniCnt];
  1007. m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx);
  1008. }
  1009. if ( !bBlend )
  1010. g_xMainWnd.DrawWithImageForCompClipRgn(
  1011. (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  1012. (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY,
  1013. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth,
  1014. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight,
  1015. (WORD*)m_xMap.m_pxTileImg[nObjFileIdx]->m_pbCurrImage,
  1016. _CLIP_WIDTH, _CLIP_HEIGHT);
  1017. else
  1018. {
  1019. m_xImage.AddTextr(_TEXTR_FILE_MAP, nObjFileIdx, nImgIdx);
  1020. LPDIRECTDRAWSURFACE7 lpddsTextr = m_xImage.GetTextrImg(_TEXTR_FILE_MAP, nObjFileIdx, nImgIdx);
  1021. nStartX = (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX;
  1022. nStartY = -(nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY;
  1023. D3DMATERIAL7 mtrl;
  1024. D3DVECTOR vecTrans(nStartX, nStartY, 0);
  1025. D3DVECTOR vecScale(m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth, m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight, 1);
  1026. D3DUtil_InitMaterial(mtrl, (FLOAT)255/255.0f, (FLOAT)255/255.0f, (FLOAT)255/255.0f);
  1027. mtrl.diffuse.a = 1.0f/255.0f;
  1028. g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
  1029. m_xImage.DrawBillBoard(g_xMainWnd.Get3DDevice(), vecTrans, vecScale, mtrl, lpddsTextr);
  1030. }
  1031. }
  1032. }
  1033. }
  1034. }
  1035. // 坷宏璃飘2啊 乐阑锭.
  1036. if ( m_xMap.m_pstCellInfo[nArrayNum].wObj2 != 65535 )
  1037. {
  1038. nObjFileIdx = (m_xMap.m_pstCellInfo[nArrayNum].bFileIdx & 0X0F);
  1039. nImgIdx = m_xMap.m_pstCellInfo[nArrayNum].wObj2;
  1040. if ( nObjFileIdx > 2 && nObjFileIdx < 14 )
  1041. {
  1042. if ( m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx) )
  1043. {
  1044. if ( m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth == 48 &&
  1045.  m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight == 32 )
  1046. {
  1047. bBlend = FALSE;
  1048. nImgIdx += m_xMap.GetDoorImgIdx(nXCnt, nYCnt);
  1049. // 局聪皋捞记 坷宏璃飘捞搁.
  1050. if ( m_xMap.m_pstCellInfo[nArrayNum].bObj2Ani != 255 )
  1051. {
  1052. BYTE  bTickType;
  1053. SHORT shAniCnt;
  1054. bTickType = (m_xMap.m_pstCellInfo[nArrayNum].bObj2Ani & 0X70) >> 4;
  1055. shAniCnt = m_xMap.m_pstCellInfo[nArrayNum].bObj2Ani & 0X0F;
  1056. if ( (m_xMap.m_pstCellInfo[nArrayNum].bObj2Ani & 0X80) >> 7 )
  1057. bBlend = TRUE;
  1058. nImgIdx += m_xMap.m_bAniTileFrame[bTickType][shAniCnt];
  1059. m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx);
  1060. }
  1061. if ( !bBlend )
  1062. g_xMainWnd.DrawWithImageForCompClipRgn(
  1063. (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  1064. (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY,
  1065. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth,
  1066. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight,
  1067. (WORD*)m_xMap.m_pxTileImg[nObjFileIdx]->m_pbCurrImage,
  1068. _CLIP_WIDTH, _CLIP_HEIGHT);
  1069. else
  1070. {
  1071. m_xImage.AddTextr(_TEXTR_FILE_MAP, nObjFileIdx, nImgIdx);
  1072. LPDIRECTDRAWSURFACE7 lpddsTextr = m_xImage.GetTextrImg(_TEXTR_FILE_MAP, nObjFileIdx, nImgIdx);
  1073. nStartX = (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX;
  1074. nStartY = -(nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY;
  1075. D3DMATERIAL7 mtrl;
  1076. D3DVECTOR vecTrans(nStartX, nStartY, 0);
  1077. D3DVECTOR vecScale(m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth, m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight, 1);
  1078. D3DUtil_InitMaterial(mtrl, (FLOAT)255/255.0f, (FLOAT)255/255.0f, (FLOAT)255/255.0f);
  1079. mtrl.diffuse.a = 1.0f/255.0f;
  1080. g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
  1081. m_xImage.DrawBillBoard(g_xMainWnd.Get3DDevice(), vecTrans, vecScale, mtrl, lpddsTextr);
  1082. }
  1083. }
  1084. }
  1085. }
  1086. }
  1087. }
  1088. }
  1089. }
  1090. // 48*32啊 酒囱 辨捞啊 乐绰 鸥老屈 坷宏璃飘 弊府扁.
  1091. for ( nYCnt = m_xMap.m_shStartViewTileY; nYCnt < m_xMap.m_shStartViewTileY+_VIEW_CELL_Y_COUNT_FOR_OBJ; nYCnt++ )
  1092. {
  1093. for ( INT nXCnt = m_xMap.m_shStartViewTileX; nXCnt < m_xMap.m_shStartViewTileX+_VIEW_CELL_X_COUNT; nXCnt++ )
  1094. {
  1095. if ( nYCnt >= m_xMap.m_stMapFileHeader.shHeight )
  1096. break;
  1097. if ( nXCnt >= m_xMap.m_stMapFileHeader.shWidth || nXCnt < 0 || nYCnt < 0 )
  1098. continue; 
  1099. bLongObj = FALSE;
  1100. nArrayNum = nYCnt + nXCnt*m_xMap.m_stMapFileHeader.shHeight;
  1101. // 坷宏璃飘啊 乐阑锭.
  1102. if ( m_xMap.m_pstCellInfo[nArrayNum].bFileIdx != 255 )
  1103. {
  1104. // 坷宏璃飘1捞 乐阑锭.
  1105. if ( m_xMap.m_pstCellInfo[nArrayNum].wObj1 != 65535 )
  1106. {
  1107. nObjFileIdx = (m_xMap.m_pstCellInfo[nArrayNum].bFileIdx & 0XF0) >> 4;
  1108. nImgIdx = m_xMap.m_pstCellInfo[nArrayNum].wObj1;
  1109. if ( nObjFileIdx > 2 && nObjFileIdx < 14 )
  1110. {
  1111. if ( m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx) )
  1112. {
  1113. if ( !(m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth == 48 &&
  1114.    m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight == 32) )
  1115. {
  1116. bBlend = FALSE;
  1117. nImgIdx += m_xMap.GetDoorImgIdx(nXCnt, nYCnt);
  1118. // 局聪皋捞记 坷宏璃飘捞搁.
  1119. if ( m_xMap.m_pstCellInfo[nArrayNum].bObj1Ani != 255 )
  1120. {
  1121. BYTE  bTickType;
  1122. SHORT shAniCnt;
  1123. bTickType = (m_xMap.m_pstCellInfo[nArrayNum].bObj1Ani & 0X70) >> 4;
  1124. shAniCnt = m_xMap.m_pstCellInfo[nArrayNum].bObj1Ani & 0X0F;
  1125. if ( (m_xMap.m_pstCellInfo[nArrayNum].bObj1Ani & 0X80) >> 7 )
  1126. bBlend = TRUE;
  1127. nImgIdx += m_xMap.m_bAniTileFrame[bTickType][shAniCnt];
  1128. m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx);
  1129. }
  1130. if ( !bBlend )
  1131. g_xMainWnd.DrawWithImageForCompClipRgn(
  1132. (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  1133. (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY,
  1134. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth,
  1135. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight,
  1136. (WORD*)m_xMap.m_pxTileImg[nObjFileIdx]->m_pbCurrImage,
  1137. _CLIP_WIDTH, _CLIP_HEIGHT);
  1138. else
  1139. {
  1140. m_xImage.AddTextr(_TEXTR_FILE_MAP, nObjFileIdx, nImgIdx);
  1141. LPDIRECTDRAWSURFACE7 lpddsTextr = m_xImage.GetTextrImg(_TEXTR_FILE_MAP, nObjFileIdx, nImgIdx);
  1142. nStartX = (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX+m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shPX;
  1143. nStartY = (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY+m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shPY;
  1144. D3DMATERIAL7 mtrl;
  1145. D3DVECTOR vecTrans(nStartX, nStartY, 0);
  1146. D3DVECTOR vecScale(m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth, m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight, 1);
  1147. D3DUtil_InitMaterial(mtrl, (FLOAT)255/255.0f, (FLOAT)255/255.0f, (FLOAT)255/255.0f);
  1148. mtrl.diffuse.a = 0.0f/255.0f;
  1149. g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
  1150. m_xImage.DrawBillBoard(g_xMainWnd.Get3DDevice(), vecTrans, vecScale, mtrl, lpddsTextr);
  1151. }
  1152. bLongObj = TRUE;
  1153. }
  1154. }
  1155. }
  1156. }
  1157. // 坷宏璃飘2啊 乐阑锭.
  1158. if ( m_xMap.m_pstCellInfo[nArrayNum].wObj2 != 65535 )
  1159. {
  1160. nObjFileIdx = (m_xMap.m_pstCellInfo[nArrayNum].bFileIdx & 0X0F);
  1161. nImgIdx = m_xMap.m_pstCellInfo[nArrayNum].wObj2;
  1162. if ( nObjFileIdx > 2 && nObjFileIdx < 14 )
  1163. {
  1164. if ( m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx) )
  1165. {
  1166. if ( !(m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth == 48 &&
  1167.  m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight == 32) )
  1168. {
  1169. bBlend = FALSE;
  1170. nImgIdx += m_xMap.GetDoorImgIdx(nXCnt, nYCnt);
  1171. // 局聪皋捞记 坷宏璃飘捞搁.
  1172. if ( m_xMap.m_pstCellInfo[nArrayNum].bObj2Ani != 255 )
  1173. {
  1174. BYTE  bTickType;
  1175. SHORT shAniCnt;
  1176. bTickType = (m_xMap.m_pstCellInfo[nArrayNum].bObj2Ani & 0X70) >> 4;
  1177. shAniCnt = m_xMap.m_pstCellInfo[nArrayNum].bObj2Ani & 0X0F;
  1178. // if ( (m_xMap.m_pstCellInfo[nArrayNum].bObj2Ani & 0X80) >> 7 )
  1179. // bBlend = TRUE;
  1180. nImgIdx += m_xMap.m_bAniTileFrame[bTickType][shAniCnt];
  1181. m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx);
  1182. }
  1183. if ( !bBlend )
  1184. g_xMainWnd.DrawWithImageForCompClipRgn(
  1185. (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  1186. (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY,
  1187. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth,
  1188. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight,
  1189. (WORD*)m_xMap.m_pxTileImg[nObjFileIdx]->m_pbCurrImage,
  1190. _CLIP_WIDTH, _CLIP_HEIGHT);
  1191. else
  1192. {
  1193. m_xImage.AddTextr(_TEXTR_FILE_MAP, nObjFileIdx, nImgIdx);
  1194. LPDIRECTDRAWSURFACE7 lpddsTextr = m_xImage.GetTextrImg(_TEXTR_FILE_MAP, nObjFileIdx, nImgIdx);
  1195. nStartX = (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX;
  1196. nStartY = -(nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY;
  1197. D3DMATERIAL7 mtrl;
  1198. D3DVECTOR vecTrans(nStartX, nStartY, 0);
  1199. D3DVECTOR vecScale(m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth, m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight, 1);
  1200. D3DUtil_InitMaterial(mtrl, (FLOAT)255/255.0f, (FLOAT)255/255.0f, (FLOAT)255/255.0f);
  1201. mtrl.diffuse.a = 1.0f/255.0f;
  1202. g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
  1203. m_xImage.DrawBillBoard(g_xMainWnd.Get3DDevice(), vecTrans, vecScale, mtrl, lpddsTextr);
  1204. }
  1205.     bLongObj = TRUE;
  1206. }
  1207. }
  1208. }
  1209. }
  1210. }
  1211. // m_xMap.DrawOpenDoor(nXCnt, nYCnt);
  1212. INT  nMapViewX = 0;
  1213. INT  nMapViewY = 0;
  1214. BOOL bIsMapViewTime = FALSE;
  1215. if ( nXCnt >= m_xMap.m_shStartViewTileX && nXCnt < m_xMap.m_shStartViewTileX + _VIEW_CELL_X_COUNT && 
  1216.  nYCnt >= m_xMap.m_shStartViewTileY && nYCnt < m_xMap.m_shStartViewTileY + _VIEW_CELL_Y_COUNT )
  1217. {
  1218. bIsMapViewTime = TRUE;
  1219. nMapViewX = nXCnt - m_xMap.m_shStartViewTileX;
  1220. nMapViewY = nYCnt - m_xMap.m_shStartViewTileY;
  1221. }
  1222. // 官蹿酒捞袍 弊府扁.
  1223. if ( bIsMapViewTime )
  1224. {
  1225. for ( nObjCnt = 0; nObjCnt < _MAX_CELL_OBJ; nObjCnt++ )
  1226. {
  1227. LPGROUNDITEM pstItem = m_stMemMappedID[nMapViewY][nMapViewX].pstItem[nObjCnt];
  1228. if ( pstItem )
  1229. {
  1230. CWHWilImageData* pxItemImg = &g_xGameProc.m_xImage.m_xImageList[_IMAGE_ITEM_GROUND];
  1231. if ( pxItemImg->NewSetIndex(pstItem->wLooks) )
  1232. {
  1233. nStartX = (pstItem->shTileX-m_xMap.m_shStartViewTileX)*_CELL_WIDTH+_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX;
  1234. nStartY = (pstItem->shTileY-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY;
  1235. INT nX  = nStartX+_CELL_WIDTH/2-pxItemImg->m_lpstNewCurrWilImageInfo->shWidth/2;
  1236. INT nY  = nStartY+_CELL_HEIGHT/2-pxItemImg->m_lpstNewCurrWilImageInfo->shHeight/2;
  1237. g_xMainWnd.DrawWithShadowABlend(
  1238. nX+1, nY+1, 
  1239. pxItemImg->m_lpstNewCurrWilImageInfo->shWidth,
  1240. pxItemImg->m_lpstNewCurrWilImageInfo->shHeight,
  1241. (WORD*)pxItemImg->m_pbCurrImage, 
  1242. _CLIP_WIDTH, _CLIP_HEIGHT, m_wShadowClr, FALSE, 50);
  1243. if ( nXCnt == m_ptCurrTile.x && nYCnt == m_ptCurrTile.y )
  1244. g_xMainWnd.DrawWithImageForCompClipRgn(nX, nY, pxItemImg->m_lpstNewCurrWilImageInfo->shWidth,pxItemImg->m_lpstNewCurrWilImageInfo->shHeight,
  1245.    (WORD*)pxItemImg->m_pbCurrImage, _CLIP_WIDTH, _CLIP_HEIGHT, 0XFFFF, 0XFFFF, TRUE);
  1246. else
  1247. g_xMainWnd.DrawWithImageForCompClipRgn(nX, nY, pxItemImg->m_lpstNewCurrWilImageInfo->shWidth,pxItemImg->m_lpstNewCurrWilImageInfo->shHeight,
  1248.    (WORD*)pxItemImg->m_pbCurrImage, _CLIP_WIDTH, _CLIP_HEIGHT);
  1249. }
  1250. }
  1251. else
  1252. break;
  1253. }
  1254. }
  1255. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1256. // 郴某腐磐 弊府扁.
  1257. if ( nXCnt == m_xMyHero.m_wPosX && nYCnt == m_xMyHero.m_wPosY )
  1258. {
  1259. // 弊覆狼 矫累谅钎, 器目胶惑怕, 弊覆磊 喉坊爹 惑怕甫 逞败霖促.
  1260. if ( PtInRect(&m_xMyHero.m_rcActor, m_ptMousePos) && !m_pxMouseTargetActor )
  1261. {
  1262. bFocused  = TRUE;
  1263. m_pxMouseTargetActor = &m_xMyHero;
  1264. }
  1265. else
  1266. bFocused  = FALSE;
  1267. bDrawShadow = TRUE;
  1268. if ( m_bShadowABlend )
  1269. bDrawShadow = FALSE;
  1270. m_xMyHero.DrawActor(bFocused, m_bShadowABlend, FALSE, bDrawShadow);
  1271. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1272. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1273. // 促弗 某腐磐 弊府扁.
  1274. if ( bIsMapViewTime )
  1275. {
  1276. for ( nObjCnt = 0; nObjCnt < _MAX_CELL_OBJ; nObjCnt++ )
  1277. {
  1278. CActor* pxActor = m_stMemMappedID[nMapViewY][nMapViewX].pxActor[nObjCnt];
  1279. if ( pxActor )
  1280. {
  1281. BYTE bOpa = 50;
  1282. if ( pxActor->m_bIsDead )
  1283. bOpa = 30;
  1284. if ( pxActor == m_pxMouseTargetActor )
  1285. bFocused = TRUE;
  1286. else
  1287. bFocused = FALSE;
  1288. bDrawShadow = TRUE;
  1289. if ( pxActor == m_pxMouseTargetActor && m_bShadowABlend )
  1290. bDrawShadow = FALSE;
  1291. switch ( pxActor->m_stFeature.bGender )
  1292. {
  1293. case _GENDER_MAN:
  1294. case _GENDER_WOMAN:
  1295. {
  1296. CHero* pxHero;
  1297. pxHero = (CHero*)pxActor;
  1298. pxHero->DrawActor(&m_xMap, bFocused, m_bShadowABlend, TRUE, bDrawShadow);
  1299. }
  1300. break;
  1301. case _GENDER_NPC:
  1302. {
  1303. CNPC* pxNPC;
  1304. pxNPC = (CNPC*)pxActor;
  1305. pxNPC->DrawActor(&m_xMap, bFocused, m_bShadowABlend, TRUE, bDrawShadow);
  1306. }
  1307. break;
  1308. case _GENDER_MON:
  1309. {
  1310. pxActor->DrawActor(&m_xMap, bFocused, m_bShadowABlend, TRUE, bDrawShadow);
  1311. /* // 富老锭.
  1312. RECT rc, rcIntersect;
  1313. // if ( bLongObj && pxActor->m_wPosY <= nYCnt && pxActor->m_stFeature.bDress > 114 && pxActor->m_stFeature.bDress < 118 )
  1314. {
  1315. SetRect(&rc, 
  1316. (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX, 
  1317. (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY, 
  1318. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth  + (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX, 
  1319. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight + (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY);
  1320. // 富苞硅版.
  1321. if ( IntersectRect(&rcIntersect, &rc, &pxActor->m_rcActor) )
  1322. {
  1323. m_xImage.m_xImageList[pxActor->m_bActorImgIdx].NewSetIndex(pxActor->m_dwCurrFrame);
  1324.   g_xMainWnd.DrawWithABlendForIntersectCompData(
  1325. pxActor->m_rcActor.left, 
  1326. pxActor->m_rcActor.top,
  1327. m_xImage.m_xImageList[pxActor->m_bActorImgIdx].m_lpstNewCurrWilImageInfo->shWidth,
  1328. m_xImage.m_xImageList[pxActor->m_bActorImgIdx].m_lpstNewCurrWilImageInfo->shHeight,
  1329. (WORD*)m_xImage.m_xImageList[pxActor->m_bActorImgIdx].m_pbCurrImage,
  1330. rc.left,
  1331. rc.top,
  1332. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth,
  1333. m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight,
  1334. (WORD*)m_xMap.m_pxTileImg[nObjFileIdx]->m_pbCurrImage,
  1335. _CLIP_WIDTH, _CLIP_HEIGHT, 50, bFocused, 0XFFFF, 0XFFFF, 0XFFFF, 0XFFFF, m_xMyHero.m_wStateClr);
  1336. }
  1337. }
  1338. */ }
  1339. break;
  1340. }
  1341. bFocused = FALSE;
  1342. }
  1343. else
  1344. break;
  1345. }
  1346. }
  1347. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1348. if ( bIsMapViewTime )
  1349. {
  1350. for ( nObjCnt = 0; nObjCnt < _MAX_CELL_OBJ; nObjCnt++ )
  1351. {
  1352. CMagic* pxMagic = m_stMemMappedID[nMapViewY][nMapViewX].pxMagic[nObjCnt];
  1353. if ( pxMagic )
  1354. {
  1355. if ( pxMagic->m_bMagicNum == _SKILL_HOLYSHIELD || pxMagic->m_bMagicNum == _SKILL_EARTHFIRE )
  1356. {
  1357. CRepeatMagic* pxRepeatMagic = (CRepeatMagic*)pxMagic;
  1358. pxRepeatMagic->DrawMagic();
  1359. }
  1360. else if ( pxMagic->m_bMagicNum == _SKILL_FIRE )
  1361. {
  1362. CMagicStream* pxMagicStream = (CMagicStream*)pxMagic;
  1363. pxMagicStream->DrawMagic();
  1364. }
  1365. }
  1366. else
  1367. break;
  1368. }
  1369. }
  1370. }
  1371. }
  1372. bDrawShadow = FALSE;
  1373. if ( m_bShadowABlend )
  1374. bDrawShadow = TRUE;
  1375. m_xMyHero.m_wABlendDelay  = 10;
  1376. m_xMyHero.m_wABlendCurrDelay = 5;
  1377. m_xMyHero.DrawActor(FALSE, m_bShadowABlend, FALSE, bDrawShadow);
  1378. m_xMyHero.m_wABlendDelay  = 0;
  1379. m_xMyHero.m_wABlendCurrDelay = 0;
  1380. if ( m_pxMouseTargetActor && m_pxMouseTargetActor != &m_xMyHero /*&& !m_pxMouseTargetActor->m_bIsDead*/ )
  1381. {
  1382. m_pxMouseTargetActor->m_wABlendDelay  = 10;
  1383. m_pxMouseTargetActor->m_wABlendCurrDelay = 4;
  1384. m_pxMouseTargetActor->DrawActor(&m_xMap, FALSE, m_bShadowABlend, FALSE, bDrawShadow);
  1385. m_pxMouseTargetActor->m_wABlendDelay  = 0;
  1386. m_pxMouseTargetActor->m_wABlendCurrDelay = 0;
  1387. }
  1388. }
  1389. /******************************************************************************************************************
  1390. 皋矫瘤 包访 窃荐.
  1391. *******************************************************************************************************************/
  1392. LRESULT CGameProcess::OnDestroy(WPARAM wParam, LPARAM lParam)
  1393. {
  1394. m_xInterface.m_xInventoryWnd.SaveItemPos(m_xMyHero.m_szName);
  1395. return 0L;
  1396. }
  1397. LRESULT CGameProcess::OnTimer(WPARAM wParam, LPARAM lParam)
  1398. {
  1399. if ( wParam == _TIMER_ID )
  1400. {
  1401. DWORD dwFogColor;
  1402. FLOAT fDstDarkRate;
  1403. switch ( m_bFogState )
  1404. {
  1405. case _FOGSTATE_DAWN:
  1406. {
  1407. fDstDarkRate = 50;
  1408. }
  1409. break;
  1410. case _FOGSTATE_DAY:
  1411. {
  1412. fDstDarkRate = 255;
  1413. }
  1414. break;
  1415. case _FOGSTATE_NIGHT:
  1416. {
  1417. fDstDarkRate = 10;
  1418. }
  1419. break;
  1420. }
  1421. if ( m_fDarkRate > fDstDarkRate ) m_fDarkRate -= 0.5f;
  1422. else if ( m_fDarkRate < fDstDarkRate ) m_fDarkRate += 0.5f;
  1423. else
  1424. {
  1425. KillTimer(g_xMainWnd.GetSafehWnd(), _TIMER_ID);
  1426. }
  1427. dwFogColor = RGB(m_fDarkRate, m_fDarkRate, m_fDarkRate); 
  1428. m_xLightFog.ChangeLightColor(dwFogColor);
  1429. }
  1430. else // Temp
  1431. {
  1432. if (PacketQ.GetCount())
  1433. {
  1434. char *pszPacket = (char*)PacketQ.PopQ();
  1435. if (pszPacket)
  1436. {
  1437. strcpy(&szBuff[nBuff], pszPacket);
  1438. char *pszRemain = OnMessageReceive(szBuff);
  1439. if (pszRemain)
  1440. {
  1441. nBuff = strlen(pszRemain);
  1442. memcpy(szBuff, pszRemain, nBuff);
  1443. szBuff[nBuff] = '';
  1444. }
  1445. else
  1446. {
  1447. nBuff = 0;
  1448. ZeroMemory(szBuff, sizeof(szBuff));
  1449. }
  1450. delete [] pszPacket;
  1451. }
  1452. }
  1453. ProcessPacket();
  1454. ProcessDefaultPacket();
  1455. }
  1456. return 0L;
  1457. }
  1458. LRESULT CGameProcess::OnLButtonDoubleClick(WPARAM wParam, LPARAM lParam)
  1459. {
  1460. m_ptMousePos.x = LOWORD(lParam);
  1461. m_ptMousePos.y = HIWORD(lParam);
  1462. m_xInterface.OnLButtonDoubleClick(m_ptMousePos);
  1463. return 0L;
  1464. }
  1465. LRESULT CGameProcess::OnWheel(WPARAM wParam, LPARAM lParam)
  1466. {
  1467. INT nDelta;
  1468. nDelta = ( (INT)wParam < 0 ) ? -1 : 1;
  1469. if ( nDelta > 0 )
  1470. m_xInterface.OnScrollDown();
  1471. else
  1472. m_xInterface.OnScrollUp();
  1473. return 0L;
  1474. }
  1475. LRESULT CGameProcess::OnSysKeyDown(WPARAM wParam, LPARAM lParam)
  1476. {
  1477. if ( wParam == VK_RETURN )
  1478. {
  1479. m_bRender = FALSE;
  1480. g_xMainWnd.OnSysKeyDown(wParam, lParam);
  1481. SetFocus(g_xChatEditBox.GetSafehWnd());
  1482. SetFocus(g_xMainWnd.GetSafehWnd());
  1483. for ( INT nCnt = 0; nCnt < 10; nCnt++)
  1484. {
  1485. if ( m_xImage.m_xImageList[_IMAGE_PROGUSE].NewSetIndex(nCnt+40) )
  1486. {
  1487. D3DWILTextr_CreateEmptyTexture(m_xImage.m_xImageList[_IMAGE_PROGUSE].m_szWilFileName, nCnt+40, 
  1488.    m_xImage.m_xImageList[_IMAGE_PROGUSE].m_lpstNewCurrWilImageInfo->shWidth,
  1489.    m_xImage.m_xImageList[_IMAGE_PROGUSE].m_lpstNewCurrWilImageInfo->shHeight,
  1490.    (WORD*)m_xImage.m_xImageList[_IMAGE_PROGUSE].m_pbCurrImage, D3DTEXTR_TRANSPARENTBLACK);
  1491. m_lpddsShineTextr[nCnt] = D3DWILTextr_RestoreEx(m_xImage.m_xImageList[_IMAGE_PROGUSE].m_szWilFileName, nCnt+40, g_xMainWnd.Get3DDevice());
  1492. }
  1493. }
  1494. m_xImage.DelAllTextrFileList();
  1495. m_bRender = TRUE;
  1496. }
  1497. if ( wParam == VK_F10 )
  1498. {
  1499. m_xInterface.OnSysKeyDown();
  1500. }
  1501. return 0L;
  1502. }
  1503. LRESULT CGameProcess::OnSysKeyUp(WPARAM wParam, LPARAM lParam)
  1504. {
  1505. return 0L;
  1506. }
  1507. LRESULT CGameProcess::OnMove(WPARAM wParam, LPARAM lParam)
  1508. {
  1509. g_xMainWnd.OnMove(wParam, lParam);
  1510. MoveWindow(g_xChatEditBox.GetSafehWnd(), 
  1511.    g_xMainWnd.m_rcWindow.left+_INPUT_EDITWND_XPOS, 
  1512.    g_xMainWnd.m_rcWindow.top+_INPUT_EDITWND_YPOS, _INPUT_EDITWND_WIDTH, _INPUT_EDITWND_HEIGHT, TRUE);
  1513. return 0L;
  1514. }
  1515. LRESULT CGameProcess::OnMouseMove(WPARAM wParam, LPARAM lParam)
  1516. {
  1517. m_ptMousePos.x = LOWORD(lParam);
  1518. m_ptMousePos.y = HIWORD(lParam);
  1519. m_ptCurrTile.x = m_xMap.m_shStartViewTileX + (m_ptMousePos.x - _VIEW_CELL_X_START) / TILE_WIDTH;
  1520. m_ptCurrTile.y = m_xMap.m_shStartViewTileY + (m_ptMousePos.y - _VIEW_CELL_Y_START) / TILE_HEIGHT;
  1521. if(m_xNotice.IsActive())
  1522. {
  1523. m_xNotice.MoveWnd(m_ptMousePos);
  1524. }
  1525. else
  1526. {
  1527. m_xInterface.OnMouseMove(m_ptMousePos);
  1528. }
  1529. return 0L;
  1530. }
  1531. LRESULT CGameProcess::OnLButtonDown(WPARAM wParam, LPARAM lParam)
  1532. {
  1533. POINT ptTaretTilePos;
  1534. // 霸烙单捞鸥啊 肺靛登菌绰瘤...
  1535. if(m_xNotice.IsActive())
  1536. {
  1537. m_xNotice.OnButtonDown(m_ptMousePos);
  1538. }
  1539. if ( !m_bRender ) return 0L;
  1540. m_pxSavedTargetActor = NULL;
  1541. m_ptMousePos.x = LOWORD(lParam);
  1542. m_ptMousePos.y = HIWORD(lParam);
  1543. m_ptCurrTile.x = m_xMap.m_shStartViewTileX + (m_ptMousePos.x - _VIEW_CELL_X_START) / TILE_WIDTH;
  1544. m_ptCurrTile.y = m_xMap.m_shStartViewTileY + (m_ptMousePos.y - _VIEW_CELL_Y_START) / TILE_HEIGHT;
  1545. if ( !m_xInterface.OnLButtonDown(m_ptMousePos) )
  1546. {
  1547. // 牢磐其捞胶俊辑 窍绰老捞 绝阑锭.
  1548. // 1. 酒捞袍阑 冻绢哆府扁.
  1549. if ( m_xInterface.m_stCommonItem.bSetted && !m_xInterface.m_stCommonItem.bWaitResponse && !m_xInterface.m_stCommonItem.bIsEquipItem )
  1550. {
  1551. g_xClientSocket.SendItemIndex(CM_DROPITEM, m_xInterface.m_stCommonItem.xItem.m_stItemInfo.nMakeIndex, m_xInterface.m_stCommonItem.xItem.m_stItemInfo.stStdItem.szName);
  1552. m_xInterface.m_stCommonItem.bWaitResponse = TRUE;
  1553. return 0L;
  1554. }
  1555. // 2. 甘酒捞袍 凛扁.
  1556. if ( m_stMapItemList.GetCounter() != 0 )
  1557. {
  1558. m_stMapItemList.MoveCurrentToTop();
  1559. LPGROUNDITEM pstItem;
  1560. for ( INT nCnt = 0; nCnt < m_stMapItemList.GetCounter(); nCnt++ )
  1561. {
  1562. pstItem = m_stMapItemList.GetCurrentData();
  1563. if ( pstItem->shTileX == m_ptCurrTile.x && pstItem->shTileY == m_ptCurrTile.y && pstItem->shTileX == m_xMyHero.m_wPosX && pstItem->shTileY == m_xMyHero.m_wPosY )
  1564. {
  1565. g_xClientSocket.SendPickUp(pstItem->shTileX, pstItem->shTileY);
  1566. return 0L;
  1567. }
  1568. m_stMapItemList.MoveNextNode();
  1569. }
  1570. }
  1571. if ( m_pxMouseTargetActor )
  1572. {
  1573. if ( !m_pxMouseTargetActor->m_bIsDead )
  1574. {
  1575. // 傍拜措惑 Actor沥窍扁.
  1576. m_pxSavedTargetActor = m_pxMouseTargetActor;
  1577. }
  1578. ptTaretTilePos.x = m_pxMouseTargetActor->m_wPosX;
  1579. ptTaretTilePos.y = m_pxMouseTargetActor->m_wPosY;
  1580. if ( m_pxMouseTargetActor->m_stFeature.bGender == _GENDER_NPC )
  1581. {
  1582. g_xClientSocket.SendNPCClick(m_pxMouseTargetActor->m_dwIdentity);
  1583. m_pxSavedTargetActor = NULL;
  1584. }
  1585. else
  1586. {
  1587. m_xMyHero.OnLButtonDown(m_ptMousePos, m_pxMouseTargetActor->m_dwIdentity, m_pxMouseTargetActor->m_bIsDead, &ptTaretTilePos);
  1588. }
  1589. }
  1590. else
  1591. {
  1592. m_xMyHero.OnLButtonDown(m_ptMousePos);
  1593. }
  1594. }
  1595. return 0L;
  1596. }
  1597. LRESULT CGameProcess::OnRButtonDown(WPARAM wParam, LPARAM lParam)
  1598. {
  1599. m_ptMousePos.x = LOWORD(lParam);
  1600. m_ptMousePos.y = HIWORD(lParam);
  1601. m_ptCurrTile.x = m_xMap.m_shStartViewTileX + (m_ptMousePos.x - _VIEW_CELL_X_START) / TILE_WIDTH;
  1602. m_ptCurrTile.y = m_xMap.m_shStartViewTileY + (m_ptMousePos.y - _VIEW_CELL_Y_START) / TILE_HEIGHT;
  1603. m_pxSavedTargetActor = NULL;
  1604. m_xMyHero.OnRButtonDown(m_ptMousePos);
  1605. return 0L;
  1606. }
  1607. LRESULT CGameProcess::OnLButtonUp(WPARAM wParam, LPARAM lParam)
  1608. {
  1609. m_ptMousePos.x = LOWORD(lParam);
  1610. m_ptMousePos.y = HIWORD(lParam);
  1611. m_ptCurrTile.x = m_xMap.m_shStartViewTileX + (m_ptMousePos.x - _VIEW_CELL_X_START) / TILE_WIDTH;
  1612. m_ptCurrTile.y = m_xMap.m_shStartViewTileY + (m_ptMousePos.y - _VIEW_CELL_Y_START) / TILE_HEIGHT;
  1613. if(m_xNotice.IsActive())
  1614. {
  1615. if(m_xNotice.OnButtonUp(m_ptMousePos))
  1616. {
  1617. // OK Button Click
  1618. m_xNotice.HideMessageBox();
  1619. Clear(RGB(0,0,0));
  1620. // Start Game From Here
  1621. }
  1622. }
  1623. else
  1624. m_xInterface.OnLButtonUp(m_ptMousePos);
  1625. return 0L;
  1626. }
  1627. LRESULT CGameProcess::OnRButtonUp(WPARAM wParam, LPARAM lParam)
  1628. {
  1629. m_ptMousePos.x = LOWORD(lParam);
  1630. m_ptMousePos.y = HIWORD(lParam);
  1631. m_ptCurrTile.x = m_xMap.m_shStartViewTileX + (m_ptMousePos.x - _VIEW_CELL_X_START) / TILE_WIDTH;
  1632. m_ptCurrTile.y = m_xMap.m_shStartViewTileY + (m_ptMousePos.y - _VIEW_CELL_Y_START) / TILE_HEIGHT;
  1633. return 0L;
  1634. }
  1635. LRESULT CGameProcess::OnKeyUp(WPARAM wParam, LPARAM lParam)
  1636. {
  1637. m_xInterface.OnKeyUp(wParam, lParam);
  1638. return 0L;
  1639. }
  1640. LRESULT CGameProcess::OnKeyDown(WPARAM wParam, LPARAM lParam)
  1641. {
  1642. INT nTargetID;
  1643. POINT ptTaretTilePos;
  1644. FEATURE stFeature;
  1645. D3DMATRIX matTrans;
  1646. D3DMATRIX matScale;
  1647. D3DMATRIX matRot;
  1648. D3DMATRIX matView;
  1649. D3DMATRIX matTemp;
  1650. FLOAT   fRot = 0.0f;
  1651. D3DVECTOR vTrans  = D3DVECTOR(0.0f, 0.0f, 0.0f);
  1652. D3DVECTOR vRotate = D3DVECTOR(0.0f, 0.0f, 0.0f);
  1653. D3DVECTOR vScale  = D3DVECTOR(1.0f, 1.0f, 1.0f);
  1654. g_xMainWnd.Get3DDevice()->GetTransform(D3DTRANSFORMSTATE_VIEW, &matView);
  1655. if ( m_pxMouseTargetActor )
  1656. {
  1657. nTargetID = m_pxMouseTargetActor->m_dwIdentity;
  1658. ptTaretTilePos.x = m_pxMouseTargetActor->m_wPosX;
  1659. ptTaretTilePos.y = m_pxMouseTargetActor->m_wPosY;
  1660. stFeature = m_pxMouseTargetActor->m_stFeature;
  1661. }
  1662. else
  1663. {
  1664. nTargetID = 0;
  1665. ptTaretTilePos.x = 0;
  1666. ptTaretTilePos.y = 0;
  1667. ZeroMemory(&stFeature, sizeof(FEATURE));
  1668. }
  1669. if ( !m_xInterface.OnKeyDown(wParam, lParam) )
  1670. m_xMyHero.OnKeyDown(wParam, lParam, m_ptMousePos, ptTaretTilePos, nTargetID, stFeature);
  1671. switch ( wParam )
  1672. {
  1673. case 'L':
  1674. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_FILLMODE, D3DFILL_WIREFRAME);
  1675. break;
  1676. case 'M':
  1677. g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID);
  1678. break;
  1679. case 'N':
  1680. {
  1681. SetNextProc();
  1682. break;
  1683. }
  1684. case '6':
  1685. {
  1686. /* g_xSound.PlayActorWav(m_ptCurrTile.x, m_ptCurrTile.y, m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, 1);
  1687. */ break;
  1688. }
  1689. case '7':
  1690. {
  1691. /* g_xSound.StopSound(1);
  1692. */ break;
  1693. }
  1694. case VK_RETURN:
  1695. {
  1696. SetFocus(g_xChatEditBox.GetSafehWnd());
  1697. ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_SHOW);
  1698. OnMsgInputted(0, 0);
  1699. }
  1700. break;
  1701. case 'U':
  1702. {
  1703. DWORD dwFogColor;
  1704. m_bFogState++;
  1705. if ( m_bFogState > _FOGSTATE_DAWN ) m_bFogState = _FOGSTATE_DAY;
  1706. switch ( m_bFogState )
  1707. {
  1708. case _FOGSTATE_DAY:
  1709. {
  1710. m_fDarkRate = 255.0f;
  1711. dwFogColor = RGB(m_fDarkRate, m_fDarkRate, m_fDarkRate);
  1712. break;
  1713. }
  1714. case _FOGSTATE_NIGHT:
  1715. {
  1716. m_fDarkRate = 10.0f;
  1717. dwFogColor = RGB(m_fDarkRate, m_fDarkRate, m_fDarkRate);
  1718. break;
  1719. }
  1720. case _FOGSTATE_DAWN:
  1721. {
  1722. m_fDarkRate = 50.0f;
  1723. dwFogColor = RGB(m_fDarkRate, m_fDarkRate, m_fDarkRate);
  1724. break;
  1725. }
  1726. }
  1727. m_xLightFog.ChangeLightColor(dwFogColor);
  1728. }
  1729. break;
  1730. case VK_LEFT:
  1731. {
  1732. vTrans.x = -2.0f;
  1733. D3DUtil_SetTranslateMatrix(matTrans, vTrans);
  1734. D3DMath_MatrixMultiply(matTemp, matView, matTrans);
  1735. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1736. }
  1737. break;
  1738. case VK_RIGHT:
  1739. {
  1740. vTrans.x = 2.0f;
  1741. D3DUtil_SetTranslateMatrix(matTrans, vTrans);
  1742. D3DMath_MatrixMultiply(matTemp, matView, matTrans);
  1743. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1744. }
  1745. break;
  1746. case VK_UP:
  1747. {
  1748. vTrans.y = -2.0f;
  1749. D3DUtil_SetTranslateMatrix(matTrans, vTrans);
  1750. D3DMath_MatrixMultiply(matTemp, matView, matTrans);
  1751. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1752. }
  1753. break;
  1754. case VK_DOWN:
  1755. {
  1756. vTrans.y = 2.0f;
  1757. D3DUtil_SetTranslateMatrix(matTrans, vTrans);
  1758. D3DMath_MatrixMultiply(matTemp, matView, matTrans);
  1759. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1760. }
  1761. break;
  1762. case VK_INSERT:
  1763. vScale.x = 1.01f;
  1764. vScale.y = 1.01f;
  1765. vScale.z = 1.00f;
  1766. D3DUtil_SetScaleMatrix(matScale, vScale.x, vScale.y, vScale.z);
  1767. D3DMath_MatrixMultiply(matTemp, matView, matScale);
  1768. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1769. break;
  1770. case VK_DELETE:
  1771. vScale.x = 0.99f;
  1772. vScale.y = 0.99f;
  1773. vScale.z = 1.00f;
  1774. D3DUtil_SetScaleMatrix(matScale, vScale.x, vScale.y, vScale.z);
  1775. D3DMath_MatrixMultiply(matTemp, matView, matScale);
  1776. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1777. break;
  1778. case VK_NUMPAD1:
  1779. fRot = 0.01f;
  1780. D3DUtil_SetRotateYMatrix(matRot, fRot);
  1781. D3DMath_MatrixMultiply(matTemp, matView, matRot);
  1782. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1783. break;
  1784. case VK_NUMPAD7:
  1785. fRot = -0.01f;
  1786. D3DUtil_SetRotateYMatrix(matRot, fRot);
  1787. D3DMath_MatrixMultiply(matTemp, matView, matRot);
  1788. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1789. break;
  1790. case VK_NUMPAD4:
  1791. fRot = 0.01f;
  1792. D3DUtil_SetRotateZMatrix(matRot, fRot);
  1793. D3DMath_MatrixMultiply(matTemp, matView, matRot);
  1794. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1795. break;
  1796. case VK_NUMPAD6:
  1797. fRot = -0.01f;
  1798. D3DUtil_SetRotateZMatrix(matRot, fRot);
  1799. D3DMath_MatrixMultiply(matTemp, matView, matRot);
  1800. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1801. break;
  1802. case VK_NUMPAD2:
  1803. fRot = 0.01f;
  1804. D3DUtil_SetRotateXMatrix(matRot, fRot);
  1805. D3DMath_MatrixMultiply(matTemp, matView, matRot);
  1806. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1807. break;
  1808. case VK_NUMPAD8:
  1809. fRot = -0.01f;
  1810. D3DUtil_SetRotateXMatrix(matRot, fRot);
  1811. D3DMath_MatrixMultiply(matTemp, matView, matRot);
  1812. g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_VIEW, &matTemp);
  1813. break;
  1814. }
  1815. return 0L;
  1816. }
  1817. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1818. // 蜡历 叼颇牢 皋矫瘤包访 窃荐.
  1819. LRESULT CGameProcess::OnMsgInputted(WPARAM wParam, LPARAM lParam)
  1820. {
  1821. if ( m_xInterface.OnMsgInputted(wParam, lParam) )
  1822. {
  1823. return 0L;
  1824. }
  1825. if ( g_xChatEditBox.m_szInputMsg[0] == NULL )
  1826. return 0L;
  1827. // 目盖靛 皋矫瘤.
  1828. if ( wParam )
  1829. {
  1830. CommandAnalyze();
  1831. }
  1832. CHAR szCommand[MAX_PATH];
  1833. CHAR szArg1[MAX_PATH];
  1834. CHAR szArg2[MAX_PATH];
  1835. CHAR szArg3[MAX_PATH];
  1836. CHAR szArg4[MAX_PATH];
  1837. ZeroMemory(szCommand, MAX_PATH);
  1838. ZeroMemory(szArg1, MAX_PATH);
  1839. ZeroMemory(szArg2, MAX_PATH);
  1840. ZeroMemory(szArg3, MAX_PATH);
  1841. ZeroMemory(szArg4, MAX_PATH);
  1842. sscanf(g_xChatEditBox.m_szInputMsg, "%[^ ]%*c %[^ ]%*c %[^ ]%*c %[^ ]%*c %[^ ]%*c", szCommand, szArg1, szArg2, szArg3, szArg4);
  1843. INT nArg1; INT nArg2; INT nArg3; INT nArg4;
  1844. nArg1 = nArg2 = nArg3 = nArg4 = 0;
  1845. if ( !strcmp(szCommand, "@渴堪祸") )
  1846. {
  1847. nArg1 = atoi(szArg1);
  1848. nArg2 = atoi(szArg2);
  1849. nArg3 = atoi(szArg3);
  1850. WORD wColor = g_xMainWnd.ConvertColor24To16(RGB(nArg3, nArg2, nArg1));
  1851. sprintf(g_xChatEditBox.m_szInputMsg, "@渴堪祸 %d", wColor );
  1852. m_xMyHero.m_stFeatureEx.wDressColor = wColor;
  1853. }
  1854. else if ( !strcmp(szCommand, "@speed") )
  1855. {
  1856. nArg1 = atoi(szArg1);
  1857. m_xMyHero.m_shHitSpeed = nArg1;
  1858. }
  1859. else if ( !strcmp(szCommand, "@npc") )
  1860. {
  1861. static int nNPC = 0;
  1862. CActor* pxActor = NULL;
  1863. nArg1 = atoi(szArg1);
  1864. pxActor = new CNPC;
  1865. CNPC* pxNPC = (CNPC*)pxActor;
  1866. pxNPC->m_dwIdentity = nNPC;
  1867. FEATURE stFeature;
  1868. stFeature.bGender = _GENDER_NPC;
  1869. stFeature.bDress = nArg1;
  1870. stFeature.bHair = 0;
  1871. stFeature.bWeapon = 0;
  1872. if ( pxNPC->Create(&m_xImage, &stFeature, _MT_STAND, GetRandomNum(0, 7), m_xMyHero.m_wPosX, m_xMyHero.m_wPosY-1) )
  1873. m_xActorList.AddNode(pxActor);
  1874. pxNPC->m_wABlendCurrDelay = 0;
  1875. pxNPC->m_wABlendDelay   = 0;
  1876. nNPC++;
  1877. }
  1878. else if ( !strcmp(szCommand, "@蝴") )
  1879. {
  1880. m_fTileLightRed = atoi(szArg1);
  1881. m_fTileLightGreen = atoi(szArg2);
  1882. m_fTileLightBlue = atoi(szArg3);
  1883. }
  1884. else if ( !strcmp(szCommand, "@矫埃函拳") )
  1885. {
  1886. m_bDayState = atoi(szArg1);
  1887. m_bFogState = atoi(szArg2);
  1888. SetTimer(g_xMainWnd.GetSafehWnd(), _TIMER_ID, 50, NULL);
  1889. }
  1890. /* else if ( !strcmp(szCommand, "@哩镑") )
  1891. {
  1892. CHAR szTmp[MAX_PATH];
  1893. nArg2 = atoi(szArg2);
  1894. sprintf(szTmp, "%s %d %d %s %d", szCommand, m_ptCurrTile.x, m_ptCurrTile.y, szArg1, nArg2);
  1895. strcpy(g_xChatEditBox.m_szInputMsg, szTmp);
  1896. }*/
  1897. else if ( !strcmp(szCommand, "@弊覆磊") )
  1898. {
  1899. m_bShadowABlend = !m_bShadowABlend;
  1900. WORD wShadowClr;
  1901. if ( m_bShadowABlend )
  1902. {
  1903. wShadowClr = g_xMainWnd.ConvertColor24To16(RGB(0, 0, 0));
  1904. }
  1905. else
  1906. {
  1907. wShadowClr = g_xMainWnd.ConvertColor24To16(RGB(20, 20, 20));
  1908. }
  1909. for ( INT nCnt = 0; nCnt < 800; nCnt++ )
  1910. {
  1911. m_wShadowClr[nCnt] = wShadowClr;
  1912. }
  1913. }
  1914. else if ( !strcmp(szCommand, "@函脚") )
  1915. {
  1916. static FEATURE stLastCahrFeature;
  1917. FEATURE stFeature;
  1918. ZeroMemory(&stFeature, sizeof(FEATURE));
  1919. if ( !m_xMyHero.m_bIsMon ) stLastCahrFeature = m_xMyHero.m_stFeature;
  1920. if ( !strcmp(szArg1, "救窍扁") )
  1921. {
  1922. m_xMyHero.m_bIsMon = FALSE;
  1923. stFeature = stLastCahrFeature;
  1924. m_xMyHero.ChangeFeature(stFeature, m_xMyHero.m_stFeatureEx);
  1925. }
  1926. else
  1927. {
  1928. m_xMyHero.m_bIsMon = TRUE;
  1929. stFeature.bGender = _GENDER_MON;
  1930. stFeature.bDress = atoi(szArg1);
  1931. }
  1932. if ( !m_xMyHero.ChangeFeature(stFeature, m_xMyHero.m_stFeatureEx) )
  1933. {
  1934. strcpy(g_xChatEditBox.m_szInputMsg, "函脚且荐 绝绰 阁胶磐涝聪促.");
  1935. }
  1936. else
  1937. {
  1938. m_xMyHero.m_stFeature = stFeature;
  1939. }
  1940. }
  1941. else if ( !strcmp(szCommand, "@赣府堪祸") )
  1942. {
  1943. nArg1 = atoi(szArg1);
  1944. nArg2 = atoi(szArg2);
  1945. nArg3 = atoi(szArg3);
  1946. WORD wColor = g_xMainWnd.ConvertColor24To16(RGB(nArg3, nArg2, nArg1));
  1947. sprintf(g_xChatEditBox.m_szInputMsg, "@赣府堪祸 %d", wColor );
  1948. m_xMyHero.m_stFeatureEx.wHairColor = wColor;
  1949. }
  1950. else if ( !strcmp(szCommand, "@赣府葛剧") )
  1951. {
  1952. nArg1 = atoi(szArg1);
  1953. FEATURE stFeature = m_xMyHero.m_stFeature;
  1954. stFeature.bHair = nArg1;
  1955. if ( stFeature.bHair > 12 )
  1956. stFeature.bHair = _HAIR_NONE;
  1957. m_xMyHero.ChangeFeature(stFeature, m_xMyHero.m_stFeatureEx);
  1958. }
  1959. // 老馆皋矫瘤.
  1960. g_xClientSocket.SendSay(g_xChatEditBox.m_szInputMsg);
  1961. if ( g_xChatEditBox.m_szInputMsg[0] == '/' )
  1962. {
  1963. DWORD dwBack = GetChatColor(_CHAT_COLOR6);
  1964. DWORD dwFont = GetChatColor(_CHAT_COLOR3);
  1965. m_xInterface.MsgAdd(dwFont, dwBack, g_xChatEditBox.m_szInputMsg);
  1966. }
  1967. ZeroMemory(g_xChatEditBox.m_szInputMsg, sizeof(g_xChatEditBox.m_szInputMsg));
  1968. return 0L;
  1969. }
  1970. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1971. /******************************************************************************************************************
  1972. 扁鸥 窃荐棺 叼滚弊侩 窃荐.
  1973. *******************************************************************************************************************/
  1974. VOID CGameProcess::ShowStatus(INT nStartX, INT nStartY)
  1975. {
  1976. if ( m_bStatusView )
  1977. {
  1978. TCHAR szBuff[MAX_PATH];
  1979. sprintf(szBuff, "泅犁鸥老谅钎 x:%d, y:%d", m_ptCurrTile.x, m_ptCurrTile.y);
  1980. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), nStartX, nStartY+10, RGB(250, 250, 250), RGB(0, 0, 0), szBuff);
  1981. sprintf(szBuff, "立加辑滚锅龋 : %s", g_szServerIP);
  1982. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), nStartX, nStartY+25, RGB(250, 250, 250), RGB(0, 0, 0), szBuff);
  1983. sprintf(szBuff, "付快胶谅钎 x:%d, y:%d", m_ptMousePos.x, m_ptMousePos.y);
  1984. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), nStartX, nStartY+40, RGB(250, 250, 250), RGB(0, 0, 0), szBuff);
  1985. sprintf(szBuff, "MYIDNUM:%x, %d", m_xMyHero.m_dwIdentity, m_xWaitPacketQueue.GetCount());
  1986. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), nStartX, nStartY+55, RGB(250, 250, 250), RGB(0, 0, 0), szBuff);
  1987. m_xActorList.MoveCurrentToTop();
  1988. CActor* pxActor;
  1989. for ( INT nCnt = 0; nCnt < m_xActorList.GetCounter(); nCnt++ )
  1990. {
  1991. pxActor = m_xActorList.GetCurrentData();
  1992. sprintf(szBuff, "IDNUM:%d, X:%d, Y:%d, MSGCNT:%d", pxActor->m_dwIdentity, pxActor->m_wPosX, pxActor->m_wPosY, pxActor->m_xPacketQueue.GetCount());
  1993. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), pxActor->m_shScrnPosX, pxActor->m_shScrnPosY, RGB(250, 250, 250), RGB(0, 0, 0), szBuff);
  1994. m_xActorList.MoveNextNode();
  1995. }
  1996. g_xMainWnd.UsedAndFreeMemoryCheck();
  1997. sprintf(szBuff, "咆胶苗傈眉:%d, 咆胶苗咯蜡:%d, 荤侩茄咆胶苗:%d", g_xMainWnd.m_dwTextureTotal, g_xMainWnd.m_dwTextureFree, g_xMainWnd.m_dwTextureTotal-g_xMainWnd.m_dwTextureFree);
  1998. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), nStartX, nStartY+70, RGB(250, 250, 250), RGB(0, 0, 0), szBuff);
  1999. sprintf(szBuff, "厚叼坷伐傈眉:%d, 厚叼坷伐咯蜡:%d, 荤侩茄厚叼坷伐:%d", g_xMainWnd.m_dwVideoTotal, g_xMainWnd.m_dwVideoFree, g_xMainWnd.m_dwVideoTotal-g_xMainWnd.m_dwVideoFree);
  2000. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), nStartX, nStartY+85, RGB(250, 250, 250), RGB(0, 0, 0), szBuff);
  2001. }
  2002. if ( m_bShowFPS )
  2003. CWHDefProcess::ShowStatus(750, 0);
  2004. }
  2005. VOID CGameProcess::CommandAnalyze()
  2006. {
  2007. CHAR szCommand[MAX_PATH];
  2008. CHAR szArg1[MAX_PATH];
  2009. CHAR szArg2[MAX_PATH];
  2010. CHAR szArg3[MAX_PATH];
  2011. CHAR szArg4[MAX_PATH];
  2012. ZeroMemory(szCommand, MAX_PATH);
  2013. ZeroMemory(szArg1, MAX_PATH);
  2014. ZeroMemory(szArg2, MAX_PATH);
  2015. ZeroMemory(szArg3, MAX_PATH);
  2016. ZeroMemory(szArg4, MAX_PATH);
  2017. sscanf(g_xChatEditBox.m_szInputMsg, "%[^ ]%*c %[^ ]%*c %[^ ]%*c %[^ ]%*c %[^ ]%*c", szCommand, szArg1, szArg2, szArg3, szArg4);
  2018. INT nArg1; INT nArg2; INT nArg3; INT nArg4;
  2019. nArg1 = nArg2 = nArg3 = nArg4 = 0;
  2020. if ( !strcmp(szCommand, "@grid") )
  2021. {
  2022. nArg1 = atoi(szArg1);
  2023. switch ( nArg1 )
  2024. {
  2025. case 0:
  2026. m_bCellView= !m_bCellView;
  2027. break;
  2028. case 1:
  2029. m_bTileView = !m_bTileView;
  2030. break;
  2031. case 2:
  2032. m_bObj1View = !m_bObj1View;
  2033. break;
  2034. case 3:
  2035. m_bObj2View = !m_bObj2View;
  2036. break;
  2037. case 4:
  2038. m_bStopPtView = !m_bStopPtView;
  2039. break;
  2040. }
  2041. }
  2042. else if ( !strcmp(szCommand, "@fps") )
  2043. {
  2044. m_bShowFPS = !m_bShowFPS;
  2045. }
  2046. else if ( !strcmp(szCommand, "@show") )
  2047. {
  2048. if ( !strcmp(szArg1, "snow") )
  2049. {
  2050. m_bShowSnow = !m_bShowSnow;
  2051. }
  2052. else if ( !strcmp(szArg1, "rain") )
  2053. {
  2054. m_bShowRain = !m_bShowRain;
  2055. }
  2056. else if ( !strcmp(szArg1, "fog2") )
  2057. {
  2058. m_bShowMist = !m_bShowMist;
  2059. }
  2060. else if ( !strcmp(szArg1, "state") )
  2061. {
  2062. m_bStatusView = !m_bStatusView;
  2063. }
  2064. }
  2065. /* else if ( !strcmp(szCommand, "@捞悼") )
  2066. {
  2067. nArg1 = atoi(szArg1);
  2068. nArg2 = atoi(szArg2);
  2069. m_xMyHero.m_wPosX = nArg1+11;
  2070. m_xMyHero.m_wPosY = nArg2+11;
  2071. m_xMap.SetStartViewTile(nArg1, nArg2);
  2072. m_xMap.LoadNewMapBuffer();
  2073. }
  2074. else if ( !strcmp(szCommand, "@磊蜡捞悼") )
  2075. {
  2076. m_bRender = FALSE;
  2077. nArg2 = atoi(szArg2);
  2078. nArg3 = atoi(szArg3);
  2079. m_xMyHero.m_wPosX = nArg2+11;
  2080. m_xMyHero.m_wPosY = nArg3+11;
  2081. m_xMap.SetStartViewTile(nArg2, nArg3);
  2082. LoadMapChanged(szArg1);
  2083. Sleep(100);
  2084. m_bRender = TRUE;
  2085. }*/
  2086. else if ( !strcmp(szCommand, "@fix") )
  2087. {
  2088. if ( !strcmp(szArg1, "delay") )
  2089. {
  2090. nArg2 = atoi(szArg2);
  2091. m_xMyHero.m_wDelay = nArg2;
  2092. }
  2093. }
  2094. }
  2095. VOID CGameProcess::RenderMapTileGrid()
  2096. {
  2097. WORD bCanMove = FALSE;
  2098. INT nObjCnt1 = 0;
  2099. INT nObjCnt2 = 0;
  2100. INT nObjFileIdx;
  2101. INT nFileIdx;
  2102. INT nImgIdx;
  2103. RECT rc;
  2104. if ( m_bCellView || m_bTileView || m_bObj1View || m_bObj2View || m_bStopPtView )
  2105. {
  2106. for ( INT nXCnt = m_xMap.m_shStartViewTileX; nXCnt < m_xMap.m_shStartViewTileX+_VIEW_CELL_X_COUNT; nXCnt++ )
  2107. for ( INT nYCnt = m_xMap.m_shStartViewTileY; nYCnt < m_xMap.m_shStartViewTileY+_VIEW_CELL_Y_COUNT_FOR_OBJ; nYCnt++ )
  2108. {
  2109. if ( nXCnt >= m_xMap.m_stMapFileHeader.shWidth || nYCnt >= m_xMap.m_stMapFileHeader.shHeight || nXCnt < 0 || nYCnt < 0 )
  2110. continue; 
  2111. INT nArrayNum = nYCnt + nXCnt*m_xMap.m_stMapFileHeader.shHeight;
  2112. // Cell弊府靛 焊咯林扁.
  2113. if ( m_bCellView )
  2114. {
  2115. SetRect(&rc,
  2116.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2117.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY,
  2118.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START+_CELL_WIDTH -m_xMap.m_shViewOffsetX,
  2119.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START+_CELL_HEIGHT-m_xMap.m_shViewOffsetY);
  2120. g_xMainWnd.DrawWithGDI(rc, NULL, RGB(0, 255, 255), 1);
  2121. }
  2122. if ( m_bTileView )
  2123. {
  2124. // 鸥老弊府靛焊咯林扁.
  2125.   if( !( nXCnt % 2 ) && !( nYCnt % 2 ) && nYCnt < m_xMap.m_shStartViewTileY+_VIEW_CELL_Y_COUNT )
  2126.   {
  2127. nFileIdx= m_xMap.m_pstTileInfo[(nYCnt/2) + (nXCnt/2)*m_xMap.m_stMapFileHeader.shHeight/2].bFileIdx;
  2128. nImgIdx = m_xMap.m_pstTileInfo[(nYCnt/2) + (nXCnt/2)*m_xMap.m_stMapFileHeader.shHeight/2].wTileIdx;
  2129. if( nFileIdx != 255 && nImgIdx != 65535 )
  2130. {
  2131. m_xMap.m_pxTileImg[nFileIdx]->NewSetIndex(nImgIdx);
  2132. SetRect(&rc,
  2133.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2134.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY,
  2135.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START+m_xMap.m_pxTileImg[nFileIdx]->m_lpstNewCurrWilImageInfo->shWidth -m_xMap.m_shViewOffsetX,
  2136.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START+m_xMap.m_pxTileImg[nFileIdx]->m_lpstNewCurrWilImageInfo->shHeight-m_xMap.m_shViewOffsetY);
  2137. g_xMainWnd.DrawWithGDI(rc, NULL, RGB(255, 0, 0), 1);
  2138. }
  2139. }
  2140. }
  2141. if ( m_bObj1View )
  2142. {
  2143. // Obj1鸥老 弊府靛 焊咯林扁.
  2144. if ( m_xMap.m_pstCellInfo[nArrayNum].bFileIdx != 255 )
  2145. {
  2146. if ( m_xMap.m_pstCellInfo[nArrayNum].wObj1 != 255 )
  2147. {
  2148. nObjFileIdx = (m_xMap.m_pstCellInfo[nArrayNum].bFileIdx & 0XF0) >> 4;
  2149. nImgIdx = m_xMap.m_pstCellInfo[nArrayNum].wObj1;
  2150. if ( nObjFileIdx > 2 && nObjFileIdx < 14 )
  2151. {
  2152. m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx);
  2153. SetRect(&rc,
  2154.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2155.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY,
  2156.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START+m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth -m_xMap.m_shViewOffsetX,
  2157.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START+m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight-m_xMap.m_shViewOffsetY);
  2158. // if ( PtInRect(&rc, m_ptMousePos) )
  2159. {
  2160. nObjCnt1++;
  2161. g_xMainWnd.DrawWithGDI(rc, NULL, RGB(255, 0, 255), 1);
  2162. TCHAR szBuff[MAX_PATH];
  2163. sprintf(szBuff, "[%d]%d%d", nObjCnt1, nXCnt, nYCnt);
  2164. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), 
  2165.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2166.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY,
  2167.    RGB(255, 0, 255), RGB(0, 0, 0), szBuff);
  2168. }
  2169. }
  2170. }
  2171. }
  2172. }
  2173. if ( m_bObj2View )
  2174. {
  2175. // Obj2鸥老 弊府靛 焊咯林扁.
  2176. if ( m_xMap.m_pstCellInfo[nArrayNum].bFileIdx != 255 )
  2177. {
  2178. if ( m_xMap.m_pstCellInfo[nArrayNum].wObj2 != 65535 /*&& m_shObjTileViewState == 2*/ )
  2179. {
  2180. nObjFileIdx = (m_xMap.m_pstCellInfo[nArrayNum].bFileIdx & 0X0F);
  2181. nImgIdx = m_xMap.m_pstCellInfo[nArrayNum].wObj2;
  2182. if ( nObjFileIdx > 2 && nObjFileIdx < 14 )
  2183. {
  2184. m_xMap.m_pxTileImg[nObjFileIdx]->NewSetIndex(nImgIdx);
  2185. SetRect(&rc,
  2186.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2187.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY,
  2188.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START+m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shWidth -m_xMap.m_shViewOffsetX,
  2189.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START+_CELL_HEIGHT-m_xMap.m_shViewOffsetY);
  2190. // if ( PtInRect(&rc, m_ptMousePos) )
  2191. {
  2192. nObjCnt2++;
  2193. g_xMainWnd.DrawWithGDI(rc, NULL, RGB(0, 255, 255), 1);
  2194. TCHAR szBuff[MAX_PATH];
  2195. sprintf(szBuff, "[%d]%d%d", nObjCnt2, nXCnt, nYCnt);
  2196. g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(), 
  2197.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2198.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_pxTileImg[nObjFileIdx]->m_lpstNewCurrWilImageInfo->shHeight+_CELL_HEIGHT-m_xMap.m_shViewOffsetY,
  2199.    RGB(0, 255, 255), RGB(0, 0, 0), szBuff);
  2200. }
  2201. }
  2202. }
  2203. }
  2204. }
  2205. if ( m_bStopPtView )
  2206. {
  2207. bCanMove  = m_xMap.GetTileAttribute(nXCnt, nYCnt);
  2208. if ( bCanMove != _CAN_WALK && m_bStopPtView )
  2209. {
  2210. SetRect(&rc,
  2211.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2212.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY,
  2213.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START+_CELL_WIDTH -m_xMap.m_shViewOffsetX,
  2214.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START+_CELL_HEIGHT-m_xMap.m_shViewOffsetY);
  2215. g_xMainWnd.DrawWithGDI(rc, NULL, RGB(255, 255, 0), 1);
  2216. }
  2217. }
  2218. /* if ( ( m_xMap.m_pstCellInfo[nArrayNum].wLigntNEvent & 0X07 ) == 2 )
  2219. {
  2220. SetRect(&rc,
  2221.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2222.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY,
  2223.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START+_CELL_WIDTH -m_xMap.m_shViewOffsetX,
  2224.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START+_CELL_HEIGHT-m_xMap.m_shViewOffsetY);
  2225. g_xMainWnd.DrawWithGDI(rc, NULL, RGB(255, 255, 255), 2);
  2226. }
  2227. */
  2228. }
  2229. }
  2230. for ( INT nXCnt = m_xMap.m_shStartViewTileX; nXCnt < m_xMap.m_shStartViewTileX+_VIEW_CELL_X_COUNT; nXCnt++ )
  2231. for ( INT nYCnt = m_xMap.m_shStartViewTileY; nYCnt < m_xMap.m_shStartViewTileY+_VIEW_CELL_Y_COUNT_FOR_OBJ; nYCnt++ )
  2232. {
  2233. if ( nXCnt >= m_xMap.m_stMapFileHeader.shWidth || nYCnt >= m_xMap.m_stMapFileHeader.shHeight || nXCnt < 0 || nYCnt < 0 )
  2234. continue; 
  2235. // if ( m_xMap.GetDoor(nXCnt, nYCnt) )
  2236. if ( !m_xMap.IsDoorOpen(nXCnt, nYCnt) )
  2237. {
  2238. SetRect(&rc,
  2239.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START-m_xMap.m_shViewOffsetX,
  2240.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START-m_xMap.m_shViewOffsetY,
  2241.    (nXCnt-m_xMap.m_shStartViewTileX)*_CELL_WIDTH +_VIEW_CELL_X_START+_CELL_WIDTH -m_xMap.m_shViewOffsetX,
  2242.    (nYCnt-m_xMap.m_shStartViewTileY)*_CELL_HEIGHT+_VIEW_CELL_Y_START+_CELL_HEIGHT-m_xMap.m_shViewOffsetY);
  2243. g_xMainWnd.DrawWithGDI(rc, NULL, RGB(255, 255, 255), 1);
  2244. }
  2245. }
  2246. }
  2247. LRESULT CGameProcess::DefMainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  2248. {
  2249. switch ( uMsg )
  2250. {
  2251. case WM_CTLCOLOREDIT:
  2252. {
  2253. if ((HWND)lParam == g_xChatEditBox.GetSafehWnd())
  2254. {
  2255. SetBkColor((HDC)wParam, RGB(0, 125, 125));
  2256. SetTextColor((HDC)wParam, RGB(255, 255, 255));
  2257. UnrealizeObject(m_hBrush);
  2258. POINT pt;
  2259. SetBrushOrgEx((HDC)wParam, 0, 0, &pt);
  2260. return (LRESULT)m_hBrush;
  2261. }
  2262. break;
  2263. }
  2264. case WM_DESTROY:
  2265. OnDestroy(wParam, lParam);
  2266. break;
  2267. case WM_TIMER:
  2268. OnTimer(wParam, lParam);
  2269. break;
  2270. case WM_MOUSEMOVE:
  2271. OnMouseMove(wParam, lParam);
  2272. break;
  2273. case WM_LBUTTONDBLCLK:
  2274. OnLButtonDoubleClick(wParam, lParam);
  2275. break;
  2276. case WM_LBUTTONDOWN:
  2277. OnLButtonDown(wParam, lParam);
  2278. break;
  2279. case WM_RBUTTONDOWN:
  2280. OnRButtonDown(wParam, lParam);
  2281. break;
  2282. case WM_KEYDOWN:
  2283. OnKeyDown(wParam, lParam);
  2284. break;
  2285. case WM_KEYUP:
  2286. OnKeyUp(wParam, lParam);
  2287. break;
  2288. case WM_LBUTTONUP:
  2289. OnLButtonUp(wParam, lParam);
  2290. break;
  2291. case WM_RBUTTONUP:
  2292. OnRButtonUp(wParam, lParam);
  2293. break;
  2294. case WM_MOVE:
  2295. OnMove(wParam, lParam);
  2296. break;
  2297. case WM_SYSKEYDOWN:
  2298. return OnSysKeyDown(wParam, lParam);
  2299. case WM_SYSKEYUP:
  2300. return OnSysKeyUp(wParam, lParam);
  2301. case WM_MOUSEWHEEL:
  2302. return OnWheel(wParam,lParam);
  2303. case _WM_USER_MSG_INPUTTED:
  2304. return OnMsgInputted(wParam, lParam);
  2305. case ID_SOCKCLIENT_EVENT_MSG:
  2306. g_xClientSocket.OnSocketMessage(wParam, lParam);
  2307. break;
  2308. default:
  2309. break;
  2310. }
  2311. return CWHDefProcess::DefMainWndProc(hWnd, uMsg, wParam, lParam);
  2312. }
  2313. VOID CGameProcess::OnConnectToServer()
  2314. {
  2315. g_xClientSocket.SendRunLogin(g_szUserID, g_szCharName, g_nCertifyCode, g_nVersion);
  2316. }
  2317. char* CGameProcess::OnMessageReceive(CHAR* pszMessage)
  2318. {
  2319. char *pszFirst;
  2320. char *pszEnd;
  2321. int nCount = 0;
  2322. if (*pszMessage == '*')
  2323. {
  2324. pszFirst = pszMessage + 1;
  2325. send(g_xClientSocket.m_sockClient, "*", 1, 0);
  2326. }
  2327. else
  2328. pszFirst = pszMessage;
  2329. while (pszEnd = strchr(pszFirst, '!'))
  2330. {
  2331. *pszEnd++ = '';
  2332. OnSocketMessageRecieve(pszFirst + 1);
  2333. if (*pszEnd == '*')
  2334. {
  2335. send(g_xClientSocket.m_sockClient, "*", 1, 0);
  2336. pszEnd++;
  2337. }
  2338. if (*pszEnd == '#')
  2339. pszFirst = pszEnd;
  2340. else
  2341. return NULL;
  2342. }
  2343. return pszFirst;
  2344. }
  2345. void CGameProcess::OnProcPacketNotEncode(char *pszMsg)
  2346. {
  2347. static char pszGood[] = "GOOD";
  2348. static char pszFail[] = "FAIL";
  2349. static char pszLng[] = "LNG";
  2350. static char pszUlng[] = "ULNG";
  2351. static char pszWid[] = "WID";
  2352. static char pszUWid[] = "UWID";
  2353. static char pszFir[] = "FIR";
  2354. static char pszUFir[] = "UFIR";
  2355. static char pszUPwr[] = "PWR";
  2356. if ( memcmp(pszMsg, pszGood, strlen(pszGood)) == 0 )
  2357. m_xMyHero.m_bMotionLock = FALSE;
  2358.   else if( memcmp(pszMsg, pszFail, strlen(pszFail)) == 0 )
  2359. m_xMyHero.SetOldPosition();
  2360.   else if( memcmp(pszMsg, pszLng, strlen(pszLng)) == 0 )
  2361. m_xMyHero.m_bUseErgum  = TRUE;
  2362.   else if( memcmp(pszMsg, pszUlng, strlen(pszUlng)) == 0 )
  2363. m_xMyHero.m_bUseErgum  = FALSE;
  2364.   else if( memcmp(pszMsg, pszWid, strlen(pszWid)) == 0 )
  2365. m_xMyHero.m_bUseBanwol = TRUE;
  2366.   else if( memcmp(pszMsg, pszUWid, strlen(pszUWid)) == 0 )
  2367. m_xMyHero.m_bUseBanwol = FALSE;
  2368.   else if( memcmp(pszMsg, pszFir, strlen(pszFir)) == 0 )
  2369. m_xMyHero.m_bFireHitCnt  = 1;
  2370.   else if( memcmp(pszMsg, pszUFir, strlen(pszUFir)) == 0 )
  2371. m_xMyHero.m_bFireHitCnt  = 0;
  2372.   else if( memcmp(pszMsg, pszUPwr, strlen(pszUPwr)) == 0 )
  2373. m_xMyHero.m_bYedoCnt  = 1;
  2374. }
  2375. CActor* CGameProcess::FindActor(int nID) // gadget
  2376. {
  2377. CActor* pxActor = NULL;
  2378. m_xActorList.MoveCurrentToTop();
  2379. for ( INT nCnt = 0; nCnt < m_xActorList.GetCounter(); nCnt++ )
  2380. {
  2381. pxActor = m_xActorList.GetCurrentData();
  2382. if ( pxActor->m_dwIdentity == nID )
  2383. return pxActor;
  2384. m_xActorList.MoveNextNode();
  2385. }
  2386. return NULL;
  2387. }
  2388. void CGameProcess::OnSocketMessageRecieve(char *pszMsg)
  2389. {
  2390. if (*pszMsg == '+')
  2391. OnProcPacketNotEncode(pszMsg + 1);
  2392. else
  2393. {
  2394. int nPos = 0;
  2395. _TDEFAULTMESSAGE tdm;
  2396. fnDecodeMessage(&tdm, pszMsg);
  2397. switch (tdm.wIdent)
  2398. {
  2399. case SM_SENDNOTICE:
  2400. {
  2401. char szDecodeMsg[8192];
  2402. nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
  2403. szDecodeMsg[nPos] = '';
  2404. m_xNotice.ShowMessageBox(szDecodeMsg, _IDX_IMG_NOTICEBOX);
  2405. break;
  2406. }
  2407. case SM_NEWMAP:
  2408. OnSvrMsgNewMap(&tdm, (pszMsg + DEFBLOCKSIZE));
  2409. break;
  2410. case SM_LOGON:
  2411. OnSvrMsgLogon(&tdm, (pszMsg + DEFBLOCKSIZE));
  2412. break;
  2413. case SM_MAPDESCRIPTION:
  2414. nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), (char*)m_szMapName, sizeof(m_szMapName));
  2415. m_szMapName[nPos] = '';
  2416. break;
  2417. case SM_ABILITY:
  2418. {
  2419. m_xMyHero.m_nGlod = tdm.nRecog;
  2420. m_xMyHero.m_bJob = tdm.wParam;
  2421. fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), (char*)&m_xMyHero.m_stAbility, sizeof(ACTORABILITY));
  2422. break;
  2423. }
  2424. case SM_WINEXP:
  2425. {
  2426. CHAR szExp[MAX_PATH];
  2427. m_xMyHero.m_stAbility.dwExp = tdm.nRecog;
  2428. sprintf(szExp, "版氰摹甫 %d 掘菌嚼聪促.", tdm.wParam);
  2429. DWORD dwFont = GetChatColor(_CHAT_COLOR4);
  2430. DWORD dwBack = GetChatColor(_CHAT_COLOR3);
  2431. m_xInterface.MsgAdd(dwFont, dwBack, szExp);
  2432. break;
  2433. }
  2434. case SM_SUBABILITY:
  2435. {
  2436. m_xMyHero.m_stSubAbility.wAntiMagic = LOWORD(LOBYTE(tdm.nRecog));
  2437. m_xMyHero.m_stSubAbility.bHitPoint = LOBYTE(tdm.wParam);
  2438. m_xMyHero.m_stSubAbility.bSpeedPoint = HIBYTE(tdm.wParam);
  2439. m_xMyHero.m_stSubAbility.bAntiPoison = LOBYTE(tdm.wTag);
  2440. m_xMyHero.m_stSubAbility.bPoisonRecover = HIBYTE(tdm.wTag);
  2441. m_xMyHero.m_stSubAbility.bHealthRecover = LOBYTE(tdm.wSeries);
  2442. m_xMyHero.m_stSubAbility.bSpellRecover = HIBYTE(tdm.wSeries);
  2443. break;
  2444. }
  2445. case SM_SENDMYMAGIC:
  2446. {
  2447. SAFE_DELETE(m_xInterface.m_xStatusWnd.m_pstMyMagic);
  2448. m_xInterface.m_xStatusWnd.m_bMyMagicCnt = tdm.wSeries;
  2449. m_xInterface.m_xStatusWnd.m_pstMyMagic = new CLIENTMAGICRCD[m_xInterface.m_xStatusWnd.m_bMyMagicCnt];
  2450. ZeroMemory(m_xInterface.m_xStatusWnd.m_pstMyMagic, sizeof(CLIENTMAGICRCD) * m_xInterface.m_xStatusWnd.m_bMyMagicCnt);
  2451. char *pszMagic = (pszMsg + DEFBLOCKSIZE);
  2452. char *pszNextMagic;
  2453. for ( INT nLoop = 0; nLoop < m_xInterface.m_xStatusWnd.m_bMyMagicCnt; nLoop++ )
  2454. {
  2455. if (pszNextMagic = strchr(pszMagic, '/'))
  2456. {
  2457. *pszNextMagic = '';
  2458. fnDecode6BitBuf(pszMagic, (char*)&m_xInterface.m_xStatusWnd.m_pstMyMagic[nLoop], sizeof(CLIENTMAGICRCD));
  2459. pszMagic = pszNextMagic + 1;
  2460. }
  2461. }
  2462. break;
  2463. case SM_MAGIC_LVEXP:
  2464. {
  2465. for ( INT nLoop = 0; nLoop < m_xInterface.m_xStatusWnd.m_bMyMagicCnt; nLoop++ )
  2466. {
  2467. if ( m_xInterface.m_xStatusWnd.m_pstMyMagic[nLoop].stStdMagic.wMagicID == tdm.nRecog )
  2468. {
  2469. m_xInterface.m_xStatusWnd.m_pstMyMagic[nLoop].nCurrTrain = MAKELONG(tdm.wTag, tdm.wSeries);
  2470. m_xInterface.m_xStatusWnd.m_pstMyMagic[nLoop].bLevel = tdm.wParam;
  2471. break;
  2472. }
  2473. }
  2474. break;
  2475. }
  2476. case SM_BAGITEMS:
  2477. {
  2478. char *pszItem  = (pszMsg + DEFBLOCKSIZE);
  2479. char *pszNextItem;
  2480. int  nCount = 0;
  2481. CLIENTITEMRCD stReceivedItem;
  2482. CItem xItem;
  2483. m_xInterface.m_xInventoryWnd.DeleteAllInvenItem();
  2484. do
  2485. {
  2486. if (pszNextItem = strchr(pszItem, '/'))
  2487. {
  2488. *pszNextItem = '';
  2489. fnDecode6BitBuf(pszItem, (char*)&stReceivedItem, sizeof(CLIENTITEMRCD));
  2490. xItem.SetItem(stReceivedItem, 0);
  2491. m_xInterface.m_xInventoryWnd.AddInvenItem(xItem, 0, FALSE);
  2492. pszItem = pszNextItem + 1;
  2493. nCount++;
  2494. }
  2495. } while (nCount < tdm.wSeries && pszNextItem);
  2496. break;
  2497. }
  2498. case SM_SENDUSEITEMS:
  2499. {
  2500. CLIENTITEMRCD cItemRcd[9];
  2501. char *pszUseIndex = (pszMsg + DEFBLOCKSIZE);
  2502. char *pszItem;
  2503. char *pszNextItem;
  2504. ZeroMemory(cItemRcd, sizeof(CLIENTITEMRCD));
  2505. for (int i = 0; i < 9; i++)
  2506. {
  2507. if (pszItem = strchr(pszUseIndex, '/'))
  2508. {
  2509. *pszItem = '';
  2510. pszItem++;
  2511. if (pszNextItem = strchr(pszItem, '/'))
  2512. {
  2513. *pszNextItem = '';
  2514. fnDecode6BitBuf(pszItem, (char*)&cItemRcd[i], sizeof(CLIENTITEMRCD));
  2515. CItem xItem;
  2516. xItem.SetItem(cItemRcd[i], 0);
  2517. m_xInterface.m_xStatusWnd.m_stEquipItem[atoi(pszUseIndex)].xItem = xItem;
  2518. m_xInterface.m_xStatusWnd.m_stEquipItem[atoi(pszUseIndex)].bSetted = TRUE;
  2519. pszUseIndex = pszNextItem + 1;
  2520. }
  2521. else
  2522. break;
  2523. }
  2524. else
  2525. break;
  2526. }
  2527. break;
  2528. }
  2529. case SM_ADDITEM:
  2530. {
  2531. CLIENTITEMRCD stReceivedItem;
  2532. char *pszItem = (pszMsg + DEFBLOCKSIZE);
  2533. fnDecode6BitBuf(pszItem, (char*)&stReceivedItem, sizeof(CLIENTITEMRCD));
  2534. CItem xItem;
  2535. xItem.SetItem(stReceivedItem, 0);
  2536. m_xInterface.m_xInventoryWnd.AddInvenItem(xItem, 0, FALSE);
  2537. CHAR szSysMsg[MAX_PATH];
  2538. sprintf(szSysMsg, "%s阑 掘菌嚼聪促.", xItem.m_stItemInfo.stStdItem.szName);
  2539. m_xInterface.m_xClientSysMsg.AddSysMsg(szSysMsg);
  2540. break;
  2541. }
  2542. case SM_DELITEM:
  2543. {
  2544. CLIENTITEMRCD stReceivedItem;
  2545. char *pszItem = (pszMsg + DEFBLOCKSIZE);
  2546. fnDecode6BitBuf(pszItem, (char*)&stReceivedItem, sizeof(CLIENTITEMRCD));
  2547. m_xInterface.m_xInventoryWnd.DeleteInvenItem(stReceivedItem.nMakeIndex, stReceivedItem.stStdItem.szName);
  2548. m_xInterface.m_xStatusWnd.DeleteEquipItem(stReceivedItem.nMakeIndex, stReceivedItem.stStdItem.szName);
  2549. CHAR szSysMsg[MAX_PATH];
  2550. sprintf(szSysMsg, "%s酒捞袍捞 昏力登菌嚼聪促.", stReceivedItem.stStdItem.szName);
  2551. m_xInterface.m_xClientSysMsg.AddSysMsg(szSysMsg);
  2552. break;
  2553. }
  2554. case SM_DELITEMS:
  2555. {
  2556. CHAR szSysMsg[MAX_PATH];
  2557. char szItemName[64];
  2558. char szItemIndex[32];
  2559. char nItemIndex;
  2560. char *pszItem  = (pszMsg + DEFBLOCKSIZE);
  2561. char *pszItemIndex;
  2562. int  nCount = 0;
  2563. do
  2564. {
  2565. if (pszItemIndex = strchr(pszItem, '/'))
  2566. {
  2567. *pszItemIndex++ = '';
  2568. nPos = fnDecode6BitBuf(pszItem, (char*)&szItemName, sizeof(szItemName));
  2569. szItemName[nPos] = '';
  2570. if (pszItem = strchr(pszItemIndex, '/'))
  2571. {
  2572. *pszItem++ = '';
  2573. fnDecode6BitBuf(pszItem, (char*)&szItemIndex, sizeof(szItemIndex));
  2574. szItemIndex[nPos] = '';
  2575. nItemIndex = atoi(szItemIndex);
  2576. m_xInterface.m_xInventoryWnd.DeleteInvenItem(nItemIndex, szItemName);
  2577. m_xInterface.m_xStatusWnd.DeleteEquipItem(nItemIndex, szItemName);
  2578. sprintf(szSysMsg, "%s酒捞袍捞 昏力登菌嚼聪促.", szItemName);
  2579. m_xInterface.m_xClientSysMsg.AddSysMsg(szSysMsg);
  2580. nCount++;
  2581. }
  2582. }
  2583. } while (nCount < tdm.wSeries && pszItem);
  2584. break;
  2585. }
  2586. case SM_EAT_OK:
  2587. {
  2588. m_xInterface.m_xInventoryWnd.AddNewBeltItem(&m_xInterface.m_stCommonItem);
  2589. ZeroMemory(&m_xInterface.m_stCommonItem, sizeof(COMMONITEMSET));
  2590. break;
  2591. }
  2592. case SM_EAT_FAIL:
  2593. {
  2594. if ( m_xInterface.m_stCommonItem.bSetted )
  2595. {
  2596. if ( !m_xInterface.m_stCommonItem.bIsBeltItem )
  2597. m_xInterface.m_xInventoryWnd.AddInvenItem(m_xInterface.m_stCommonItem.xItem, m_xInterface.m_stCommonItem.xItem.m_shCellNum, TRUE);
  2598. else
  2599. m_xInterface.m_xInventoryWnd.AddBeltItem(m_xInterface.m_stCommonItem.xItem, m_xInterface.m_stCommonItem.xItem.m_shCellNum, TRUE);
  2600. }
  2601. ZeroMemory(&m_xInterface.m_stCommonItem, sizeof(COMMONITEMSET));
  2602. break;
  2603. }
  2604. case SM_ADDMAGIC:
  2605. {
  2606. m_xInterface.m_xStatusWnd.m_bMyMagicCnt++;
  2607. CLIENTMAGICRCD* pstMagicRCD;
  2608. pstMagicRCD = new CLIENTMAGICRCD[m_xInterface.m_xStatusWnd.m_bMyMagicCnt];
  2609. memcpy(pstMagicRCD, m_xInterface.m_xStatusWnd.m_pstMyMagic, sizeof(CLIENTMAGICRCD)*(m_xInterface.m_xStatusWnd.m_bMyMagicCnt-1));
  2610. fnDecode6BitBuf(&pszMsg[_DEFBLOCKSIZE], (char*)&pstMagicRCD[m_xInterface.m_xStatusWnd.m_bMyMagicCnt-1], sizeof(CLIENTMAGICRCD));
  2611. SAFE_DELETE(m_xInterface.m_xStatusWnd.m_pstMyMagic);
  2612. m_xInterface.m_xStatusWnd.m_pstMyMagic = pstMagicRCD;
  2613. break;
  2614. }
  2615. case SM_TAKEON_OK:
  2616. {
  2617. FEATURE stFeature;
  2618. memcpy(&stFeature, &tdm.nRecog, sizeof(LONG));
  2619. g_xGameProc.m_xMyHero.ChangeFeature(stFeature, g_xGameProc.m_xMyHero.m_stFeatureEx);
  2620. // 厘馒芒狼 馒侩酒捞袍(m_stTakeOnItemSet)阑 厘馒芒狼 嘎绰伎俊 利侩矫虐绊, 馒侩酒捞袍(m_stTakeOnItemSet)阑 瘤款促.
  2621. m_xInterface.m_xStatusWnd.SetEquipFromTakeOn();
  2622. // 父距 傍烹(付快胶)酒捞袍捞 乐促搁 牢亥配府扩档快狼 后伎俊 持绊, 傍烹(付快胶)酒捞袍阑 瘤款促.
  2623. if ( m_xInterface.m_stCommonItem.bSetted )
  2624. {
  2625. // m_xInterface.m_xInventoryWnd.AddInvenItem(m_xInterface.m_stCommonItem.xItem, 0, FALSE);
  2626. ZeroMemory(&m_xInterface.m_stCommonItem, sizeof(ITEMSET));
  2627. }
  2628. break;
  2629. }
  2630. case SM_TAKEON_FAIL:
  2631. {
  2632. // 厘馒芒狼 馒侩酒捞袍(m_stTakeOnItemSet)阑 促矫 牢亥配府俊 持绰促.
  2633. // 父距俊 傍烹(付快胶)酒捞袍捞 乐促搁 弊吧 馒侩伎俊 持绰促.
  2634. if ( m_xInterface.m_xStatusWnd.m_stTakeOnItemSet.bSetted )
  2635. {
  2636. m_xInterface.m_xInventoryWnd.AddInvenItem(m_xInterface.m_xStatusWnd.m_stTakeOnItemSet.xItem, 0, FALSE);
  2637. ZeroMemory(&m_xInterface.m_xStatusWnd.m_stTakeOnItemSet, sizeof(ITEMSET));
  2638. }
  2639. if ( m_xInterface.m_stCommonItem.bSetted )
  2640. {
  2641. m_xInterface.m_xStatusWnd.SetEquipFromCommon(m_xInterface.m_stCommonItem.xItem.m_shCellNum, &m_xInterface.m_stCommonItem);
  2642. // ZeroMemory(&m_xInterface.m_stCommonItem, sizeof(ITEMSET));
  2643. }
  2644. break;
  2645. }
  2646. case SM_TAKEOFF_OK:
  2647. {
  2648. FEATURE stFeature;
  2649. memcpy(&stFeature, &tdm.nRecog, sizeof(LONG));
  2650. g_xGameProc.m_xMyHero.ChangeFeature(stFeature, g_xGameProc.m_xMyHero.m_stFeatureEx);
  2651. // 哈阑妨绊 茄酒捞袍阑 牢亥配府俊 持绰促.
  2652. if ( m_xInterface.m_stCommonItem.bSetted )
  2653. {
  2654. // m_xInterface.m_xInventoryWnd.AddInvenItem(m_xInterface.m_stCommonItem.xItem, 0, FALSE);
  2655. ZeroMemory(&m_xInterface.m_stCommonItem, sizeof(ITEMSET));
  2656. }
  2657. break;
  2658. }
  2659. case SM_TAKEOFF_FAIL:
  2660. {
  2661. // 傍烹(付快胶)酒捞袍阑 促矫 馒侩伎俊 持绰促.
  2662. if ( m_xInterface.m_stCommonItem.bSetted )
  2663. {
  2664. m_xInterface.m_xStatusWnd.SetEquipFromCommon(m_xInterface.m_stCommonItem.xItem.m_shCellNum, &m_xInterface.m_stCommonItem);
  2665. // ZeroMemory(&m_xInterface.m_stCommonItem, sizeof(ITEMSET));
  2666. }
  2667. break;
  2668. }
  2669. case SM_ITEMSHOW:
  2670. {
  2671. BOOL bExisted = FALSE;
  2672. if ( m_stMapItemList.GetCounter() != 0 )
  2673. {
  2674. m_stMapItemList.MoveCurrentToTop();
  2675. LPGROUNDITEM pstItem;
  2676. for ( INT nCnt = 0; nCnt < m_stMapItemList.GetCounter(); nCnt++ )
  2677. {
  2678. pstItem = m_stMapItemList.GetCurrentData();
  2679. if ( pstItem->nRecog == tdm.nRecog )
  2680. bExisted = TRUE;
  2681. m_stMapItemList.MoveNextNode();
  2682. }
  2683. }
  2684. if ( !bExisted )
  2685. {
  2686. LPGROUNDITEM pstItem = new GROUNDITEM;
  2687. pstItem->nRecog  = tdm.nRecog;
  2688. pstItem->shTileX = tdm.wParam;
  2689. pstItem->shTileY = tdm.wTag;
  2690. pstItem->wLooks  = tdm.wSeries;
  2691. nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), (char*)pstItem->szItemName, sizeof(pstItem->szItemName));
  2692. pstItem->szItemName[nPos] = '';
  2693. m_stMapItemList.AddNode(pstItem);
  2694. }
  2695. break;
  2696. }
  2697. case SM_ITEMHIDE:
  2698. {
  2699. LPGROUNDITEM pstItem;
  2700. m_stMapItemList.MoveCurrentToTop();
  2701. for ( INT nCnt = 0; nCnt < m_stMapItemList.GetCounter(); nCnt++ )
  2702. {
  2703. pstItem = m_stMapItemList.GetCurrentData();
  2704. if ( pstItem->nRecog == tdm.nRecog )
  2705. {
  2706. m_stMapItemList.DeleteCurrentNodeEx();
  2707. SAFE_DELETE(pstItem);
  2708. break;
  2709. }
  2710. m_stMapItemList.MoveNextNode();
  2711. }
  2712. break;
  2713. }
  2714. case SM_SHOWEVENT:
  2715. {
  2716. BOOL bExisted = FALSE;
  2717. _TSHORTMSSEAGE stShortMsg;
  2718. fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), (char*)&stShortMsg, sizeof(_TSHORTMSSEAGE));
  2719. if ( m_xGroundMagicList.GetCounter() != 0 )
  2720. {
  2721. m_xGroundMagicList.MoveCurrentToTop();
  2722. CMagic* pxMagic;
  2723. for ( INT nCnt = 0; nCnt < m_xGroundMagicList.GetCounter(); nCnt++ )
  2724. {
  2725. pxMagic = m_xGroundMagicList.GetCurrentData();
  2726. switch ( pxMagic->m_bMagicNum )
  2727. {
  2728. case _SKILL_EARTHFIRE: 
  2729. case _SKILL_HOLYSHIELD:
  2730. {
  2731. CRepeatMagic* pxRepeatMagic = (CRepeatMagic*)pxMagic;
  2732. if ( pxRepeatMagic->m_nEventID == tdm.nRecog )
  2733. bExisted = TRUE;
  2734. break;
  2735. }
  2736. }
  2737. m_xGroundMagicList.MoveNextNode();
  2738. }
  2739. }
  2740. // 积己茄促.
  2741. if ( !bExisted )
  2742. {
  2743. BYTE bEffectNum = 0;
  2744. if ( tdm.wParam == _ET_FIRE )
  2745. {
  2746. bEffectNum = _SKILL_EARTHFIRE;
  2747. CRepeatMagic* pxRepeatMagic;
  2748. pxRepeatMagic = new CRepeatMagic;
  2749. pxRepeatMagic->CreateMagic(tdm.nRecog, bEffectNum, 0, 0, tdm.wTag, tdm.wSeries, 0XFFFFFFFF, NULL, NULL);
  2750. pxRepeatMagic->m_dwCurrFrame += GetRandomNum(1, 8);
  2751. g_xGameProc.m_xGroundMagicList.AddNode(pxRepeatMagic);
  2752. }
  2753. else if ( tdm.wParam == _ET_HOLYCURTAIN )
  2754. {
  2755. bEffectNum = _SKILL_HOLYSHIELD;
  2756. CRepeatMagic* pxRepeatMagic;
  2757. pxRepeatMagic = new CRepeatMagic;
  2758. pxRepeatMagic->CreateMagic(tdm.nRecog, bEffectNum, 0, 0, tdm.wTag, tdm.wSeries, 0XFFFFFFFF, NULL, NULL);
  2759. pxRepeatMagic->m_dwCurrFrame += GetRandomNum(1, 8);
  2760. g_xGameProc.m_xGroundMagicList.AddNode(pxRepeatMagic);
  2761. }
  2762. }
  2763. break;
  2764. }
  2765. case SM_HIDEEVENT:
  2766. {
  2767. if ( m_xGroundMagicList.GetCounter() != 0 )
  2768. {
  2769. m_xGroundMagicList.MoveCurrentToTop();
  2770. CMagic* pxMagic;
  2771. for ( INT nCnt = 0; nCnt < m_xGroundMagicList.GetCounter(); nCnt++ )
  2772. {
  2773. pxMagic = m_xGroundMagicList.GetCurrentData();
  2774. CRepeatMagic* pxRepeatMagic = NULL;
  2775. switch ( pxMagic->m_bMagicNum )
  2776. {
  2777. case _SKILL_EARTHFIRE: 
  2778. case _SKILL_HOLYSHIELD:
  2779. {
  2780. pxRepeatMagic = (CRepeatMagic*)pxMagic;
  2781. break;
  2782. }
  2783. }
  2784. if ( pxRepeatMagic && pxRepeatMagic->m_nEventID == tdm.nRecog )
  2785. {
  2786. pxRepeatMagic->m_dwMagiLifeTotal = 0;
  2787. break;
  2788. }
  2789. m_xGroundMagicList.MoveNextNode();
  2790. }
  2791. }
  2792. break;
  2793. }
  2794. case SM_LEVELUP:
  2795. {
  2796. m_xMyHero.m_stAbility.dwExp = tdm.nRecog;
  2797. m_xMyHero.m_stAbility.bLevel = tdm.wParam;
  2798. m_xInterface.m_xClientSysMsg.AddSysMsg("饭骇捞 棵耳嚼聪促");
  2799. break;
  2800. }
  2801. case SM_DAYCHANGING:
  2802. {
  2803. m_bDayState = tdm.wParam;
  2804. m_bFogState = tdm.wTag;
  2805. SetTimer(g_xMainWnd.GetSafehWnd(), _TIMER_ID, 50, NULL);
  2806. break;
  2807. }
  2808. case SM_AREASTATE:
  2809. {
  2810. break;
  2811. }
  2812. case SM_HEAR:
  2813. case SM_SYSMESSAGE:
  2814. case SM_GUILDMESSAGE:
  2815. case SM_CRY:
  2816. case SM_WHISPER:
  2817. case SM_GROUPMESSAGE:
  2818. // case SM_MONSTERSAY:
  2819. OnSvrMsgHear(&tdm, (pszMsg + DEFBLOCKSIZE));
  2820. break;
  2821. case SM_DISAPPEAR:
  2822. case SM_CLEAROBJECT:
  2823. {
  2824. _TDEFAULTMESSAGE* lpstDefMsg;
  2825. lpstDefMsg = new _TDEFAULTMESSAGE;
  2826. memcpy(lpstDefMsg, &tdm, sizeof(_TDEFAULTMESSAGE));
  2827. m_xWaitDefaultPacketQueue.PushQ((BYTE*)lpstDefMsg);
  2828. break;
  2829. }
  2830. case SM_MERCHANTSAY: // gadget
  2831. {
  2832. int nPos;
  2833. char szDecodeMsg[8192];
  2834. char *pszSay;
  2835. m_xInterface.m_xNPCWnd.ResetDialog();
  2836. m_wNPCWndPosX = m_xMyHero.m_wPosX;
  2837. m_wNPCWndPosY = m_xMyHero.m_wPosY;
  2838. // if (tdm.nRecog != m_xInterface.m_xNPCWnd.m_nNpcId)
  2839. // {
  2840. // }
  2841. nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
  2842. szDecodeMsg[nPos] = '';
  2843. if (pszSay = strchr(szDecodeMsg, '/'))
  2844. {
  2845. *pszSay++ = '';
  2846. if (pszSay)
  2847. DevideScript(pszSay);
  2848. }
  2849. if(!m_xInterface.m_xNPCWnd.GetGameWndActive())
  2850. {
  2851. m_xInterface.WindowActivate(_WND_ID_NPCCHAT);
  2852. m_xInterface.m_xNPCWnd.SetNPC(tdm.nRecog);
  2853. }
  2854. break;
  2855. }
  2856. case SM_MERCHANTDLGCLOSE:
  2857. {
  2858. CloseNPCWindow();
  2859. break;
  2860. }
  2861. case SM_SENDGOODSLIST:
  2862. case SM_SENDDETAILGOODSLIST:
  2863. case SM_BUYITEM_FAIL:
  2864. { // 惑痢芒 贸府 风凭
  2865. LPPACKETMSG lpPacketMsg = new PACKETMSG;
  2866. lpPacketMsg->stDefMsg = tdm;
  2867. lstrcpy(lpPacketMsg->szEncodeData, (pszMsg + DEFBLOCKSIZE));
  2868. m_xInterface.m_xStoreWnd.m_xPacketQueue.PushQ((BYTE*)lpPacketMsg); // Packet阑 Queue俊 持绰促.
  2869. if(!m_xInterface.m_xStoreWnd.GetGameWndActive())
  2870. {
  2871. m_xInterface.WindowActivate(_WND_ID_STORE);
  2872. m_xInterface.m_xStoreWnd.SetNPC(tdm.nRecog);
  2873. }
  2874. break;
  2875. }
  2876. case SM_DROPITEM_SCCESS: 
  2877. {
  2878. CHAR pszItemName[15];
  2879. if (m_xInterface.m_stCommonItem.bWaitResponse )
  2880. {
  2881. if ( m_xInterface.m_stCommonItem.bSetted && m_xInterface.m_stCommonItem.xItem.m_stItemInfo.nMakeIndex == tdm.nRecog )
  2882. {
  2883. nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), (char*)pszItemName, sizeof(pszItemName));
  2884. pszItemName[nPos] = '';
  2885. if ( !strcmp(pszItemName, m_xInterface.m_stCommonItem.xItem.m_stItemInfo.stStdItem.szName) )
  2886. {
  2887. ZeroMemory(&m_xInterface.m_stCommonItem, sizeof(COMMONITEMSET));
  2888. }
  2889. }
  2890. m_xInterface.m_stCommonItem.bWaitResponse = FALSE;
  2891. }
  2892. break;
  2893. }
  2894. case SM_DROPITEM_FAIL:
  2895. {
  2896. // 啊规俊 促矫 持绢滚赴促.
  2897. CHAR pszItemName[15];
  2898. if (m_xInterface.m_stCommonItem.bWaitResponse )
  2899. {
  2900. if ( m_xInterface.m_stCommonItem.bSetted && m_xInterface.m_stCommonItem.xItem.m_stItemInfo.nMakeIndex == tdm.nRecog )
  2901. {
  2902. nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), (char*)pszItemName, sizeof(pszItemName));
  2903. pszItemName[nPos] = '';
  2904. if ( !strcmp(pszItemName, m_xInterface.m_stCommonItem.xItem.m_stItemInfo.stStdItem.szName) )
  2905. {
  2906. if ( !m_xInterface.m_stCommonItem.bIsBeltItem )
  2907. m_xInterface.m_xInventoryWnd.AddInvenItem(m_xInterface.m_stCommonItem.xItem, m_xInterface.m_stCommonItem.xItem.m_shCellNum, TRUE);
  2908. else
  2909. m_xInterface.m_xInventoryWnd.AddBeltItem(m_xInterface.m_stCommonItem.xItem, m_xInterface.m_stCommonItem.xItem.m_shCellNum, TRUE);
  2910. ZeroMemory(&m_xInterface.m_stCommonItem, sizeof(COMMONITEMSET));
  2911. }
  2912. }
  2913. m_xInterface.m_stCommonItem.bWaitResponse = FALSE;
  2914. }
  2915. }
  2916. case SM_DURACHANGE:
  2917. {
  2918. if ( m_xInterface.m_xStatusWnd.m_stEquipItem[tdm.wParam].bSetted )
  2919. {
  2920. m_xInterface.m_xStatusWnd.m_stEquipItem[tdm.wParam].xItem.m_stItemInfo.nDura = tdm.nRecog;
  2921. m_xInterface.m_xStatusWnd.m_stEquipItem[tdm.wParam].xItem.m_stItemInfo.nDuraMax = MAKELONG(tdm.wTag, tdm.wSeries);
  2922. }
  2923. break;
  2924. }
  2925. case SM_GOLDCHANGE:
  2926. {
  2927. m_xMyHero.m_nGlod = tdm.nRecog;
  2928. break;
  2929. }
  2930. case SM_WEIGHTCHANGED:
  2931. {
  2932. m_xMyHero.m_stAbility.wWeight   = tdm.nRecog;
  2933. m_xMyHero.m_stAbility.bWearWeight = tdm.wParam;
  2934. m_xMyHero.m_stAbility.bHandWeight = tdm.wTag;
  2935. break;
  2936. }
  2937. case SM_RIDEHORSE:
  2938. {
  2939. m_xMyHero.m_stFeatureEx.bHorse = tdm.nRecog;
  2940. m_xMyHero.ChangeFeature(m_xMyHero.m_stFeature, m_xMyHero.m_stFeatureEx);
  2941. if ( m_xMyHero.m_stFeatureEx.bHorse != _HORSE_NONE )
  2942. m_xMyHero.SetMotionFrame(_MT_HORSESTAND, m_xMyHero.m_bCurrDir);
  2943. else
  2944. m_xMyHero.SetMotionFrame(_MT_STAND, m_xMyHero.m_bCurrDir);
  2945. break;
  2946. }
  2947. case SM_OPENDOOR_OK:
  2948. {
  2949. INT nIdx = m_xMap.GetDoor(tdm.wParam, tdm.wTag);
  2950. if ( nIdx )
  2951. {
  2952. m_xMap.OpenDoor(tdm.wParam, tdm.wTag, nIdx);
  2953. }
  2954. break;
  2955. }
  2956. case SM_OPENDOOR_LOCK:
  2957. {
  2958. m_xInterface.m_xClientSysMsg.AddSysMsg("巩捞 泪败廉 乐嚼聪促.");
  2959. break;
  2960. }
  2961. case SM_CLOSEDOOR:
  2962. {
  2963. INT nIdx = m_xMap.GetDoor(tdm.wParam, tdm.wTag);
  2964. if ( nIdx )
  2965. {
  2966. m_xMap.CloseDoor(tdm.wParam, tdm.wTag, nIdx);
  2967. }
  2968. break;
  2969. }
  2970. case SM_HEALTHSPELLCHANGED: // gadget
  2971. {
  2972. if ( tdm.nRecog == m_xMyHero.m_dwIdentity )
  2973. {
  2974. m_xMyHero.m_wHP = tdm.wParam;
  2975. m_xMyHero.m_wMP = tdm.wTag;
  2976. m_xMyHero.m_wMAXHP = tdm.wSeries;
  2977. FLOAT wHPRate = (FLOAT)((FLOAT)m_xMyHero.m_wHP/(FLOAT)m_xMyHero.m_wMAXHP);
  2978. m_xMyHero.m_bHPPercent  = wHPRate * 100;
  2979. #ifdef _DEBUG
  2980. _RPT2(_CRT_WARN, "HP:%d, MAXHP:%dn", tdm.wParam, tdm.wSeries);
  2981. #endif
  2982. }
  2983. else
  2984. {
  2985. CActor* pxActor = FindActor(tdm.nRecog);
  2986. if (pxActor)
  2987. {
  2988. pxActor->m_wHP = tdm.wParam;
  2989. pxActor->m_wMP = tdm.wTag;
  2990. pxActor->m_wMAXHP = tdm.wSeries;
  2991. FLOAT wHPRate = (FLOAT)((FLOAT)pxActor->m_wHP/(FLOAT)pxActor->m_wMAXHP);
  2992. pxActor->m_bHPPercent = wHPRate * 100;
  2993. }
  2994. }
  2995. break;
  2996. }
  2997. case SM_CREATEGROUP_OK:
  2998. {
  2999. //            changegroupmodetime := GetTickCount;
  3000. //            AllowGroup := TRUE;
  3001. break;
  3002. }
  3003. case SM_CREATEGROUP_FAIL:
  3004. {
  3005. //            changegroupmodetime := GetTickCount;
  3006. switch (tdm.nRecog)
  3007. {
  3008. case -1: 
  3009. //FrmDlg.DMessageDlg ('捞固 弊缝俊 啊涝登绢 乐嚼聪促.', [mbOk]);
  3010. break;
  3011. case -2: 
  3012. //FrmDlg.DMessageDlg ('弊缝俊 曼咯且 捞抚捞 官福瘤 臼嚼聪促.', [mbOk]);
  3013. break;
  3014. case -3: 
  3015. //FrmDlg.DMessageDlg ('窃膊 曼咯窍妨绰 荤恩捞 促弗 弊缝俊 曼咯吝涝聪促.', [mbOk]);
  3016. break;
  3017. case -4: 
  3018. //FrmDlg.DMessageDlg ('惑措规捞 弊缝芭何吝涝聪促.', [mbOk]);
  3019. break;
  3020. }
  3021. }
  3022. case SM_GROUPMEMBERS:
  3023. {
  3024. char szDecodeMsg[8192];
  3025. char *pszMembers, *pszNext;
  3026. m_xInterface.m_xGroupWnd.m_xGroupList.ClearAllNodes();
  3027. nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
  3028. szDecodeMsg[nPos] = '';
  3029. pszMembers = szDecodeMsg;
  3030. while (pszNext = strchr(pszMembers, '/'))
  3031. {
  3032. *pszNext++ = '';
  3033. CGroupMember* pGroupMember = new CGroupMember;
  3034. if (pGroupMember)
  3035. {
  3036. strcpy(pGroupMember->szMemberName, pszMembers);
  3037. m_xInterface.m_xGroupWnd.m_xGroupList.AddNode(pGroupMember);
  3038. }
  3039. pszMembers = pszNext;
  3040. }
  3041. break;
  3042. }
  3043. case SM_GROUPCANCEL:
  3044. {
  3045. m_xInterface.m_xGroupWnd.m_xGroupList.ClearAllNodes();
  3046. break;
  3047. }
  3048. case SM_BUILDGUILD_OK:
  3049. {
  3050. //         begin
  3051. //            FrmDlg.LastestClickTime := GetTickCount;
  3052. //          FrmDlg.DMessageDlg ('巩颇啊 父甸绢 脸嚼聪促.', [mbOk]);
  3053. //         end;
  3054. break;
  3055. }
  3056. case SM_BUILDGUILD_FAIL:
  3057. {
  3058. //         begin
  3059. //            FrmDlg.LastestClickTime := GetTickCount;
  3060. //            case msg.Recog of
  3061. //               -1: FrmDlg.DMessageDlg ('捞固 巩颇俊 啊涝秦 乐嚼聪促.', [mbOk]);
  3062. //               -2: FrmDlg.DMessageDlg ('殿废厚侩捞 何练钦聪促.', [mbOk]);
  3063. //               -3: FrmDlg.DMessageDlg ('鞘夸酒捞袍阑 葛滴 啊瘤绊 乐瘤 臼嚼聪促.', [mbOk]);
  3064. //            end;
  3065. //         end;
  3066. break;
  3067. }
  3068. case SM_OPENGUILDDLG:
  3069. {
  3070. char szDecodeMsg[8192];
  3071. INT nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
  3072. szDecodeMsg[nPos] = '';
  3073. m_xInterface.WindowActivate(_WND_ID_GUILDMASTER);
  3074. break;
  3075. }
  3076. /*case SM_DOOROPEN:
  3077. {
  3078. BOOL bIsOpen = stDefMsg.nRecog;
  3079. BYTE bDoorIdx = stDefMsg.wParam;
  3080. m_xMap.SetDoorState(bDoorIdx, bIsOpen);
  3081. break;
  3082. }*/
  3083. case SM_USERNAME:
  3084. {
  3085. char szDecodeMsg[1024];
  3086. char *pszGuildName;
  3087. INT nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
  3088. szDecodeMsg[nPos] = '';
  3089. if (pszGuildName = strchr(szDecodeMsg, '\'))
  3090. *pszGuildName++ = '';
  3091. if ( tdm.nRecog == m_xMyHero.m_dwIdentity )
  3092. {
  3093. m_xMyHero.m_dwNameClr = GetUserNameColor(tdm.wParam);
  3094. strcpy(m_xMyHero.m_szName, szDecodeMsg);
  3095. if (pszGuildName)
  3096. strcpy(m_xMyHero.m_szGuildName, pszGuildName);
  3097. }
  3098. else
  3099. {
  3100. CActor* pxActor = FindActor(tdm.nRecog);
  3101. if (pxActor)
  3102. {
  3103. pxActor->m_dwNameClr = GetUserNameColor(tdm.wParam);
  3104. strcpy(pxActor->m_szName, szDecodeMsg);
  3105. if (pszGuildName)
  3106. strcpy(pxActor->m_szGuildName, pszGuildName);
  3107. }
  3108. }
  3109. break;
  3110. }
  3111. case SM_CHANGEGUILDNAME:
  3112. {
  3113. char szDecodeMsg[1024];
  3114. char *pszGuildPos;
  3115. INT nPos = fnDecode6BitBuf((pszMsg + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
  3116. szDecodeMsg[nPos] = '';
  3117. if (pszGuildPos = strchr(szDecodeMsg, '/'))
  3118. {
  3119. *pszGuildPos = ' ';
  3120. strcpy(m_xMyHero.m_szGuildName, szDecodeMsg);
  3121. }
  3122. break;
  3123. }
  3124. default:
  3125. {
  3126. LPPACKETMSG lpPacketMsg = new PACKETMSG;
  3127. lpPacketMsg->stDefMsg = tdm;
  3128. lpPacketMsg->szEncodeData[0] = NULL;
  3129. if ( tdm.wIdent != SM_HIT && tdm.wIdent != SM_BACKSTEP && tdm.wIdent != SM_RUSH )
  3130.   lstrcpy(lpPacketMsg->szEncodeData, (pszMsg + DEFBLOCKSIZE));
  3131.   m_xWaitPacketQueue.PushQ((BYTE*)lpPacketMsg);
  3132. break;
  3133. }
  3134. }
  3135. }
  3136. }
  3137. VOID CGameProcess::ProcessDefaultPacket()
  3138. {
  3139. _TDEFAULTMESSAGE* lpstDefMsg;
  3140. for (int i = 0; i < m_xWaitDefaultPacketQueue.GetCount(); i++)
  3141. {
  3142. lpstDefMsg = (_TDEFAULTMESSAGE*)m_xWaitDefaultPacketQueue.PopQ();
  3143. if ( lpstDefMsg )
  3144. {
  3145. if ( lpstDefMsg->wIdent == SM_DISAPPEAR )
  3146. {
  3147. CActor* pxActor = NULL;
  3148. m_xActorList.MoveCurrentToTop();
  3149. for ( INT nCnt = 0; nCnt < m_xActorList.GetCounter(); nCnt++ )
  3150. {
  3151. pxActor = m_xActorList.GetCurrentData();
  3152. if ( pxActor->m_dwIdentity == lpstDefMsg->nRecog )
  3153. {
  3154. INT nPacketCnt = pxActor->m_xPacketQueue.GetCount();
  3155. for ( INT nLoopCnt = 0; nLoopCnt < nPacketCnt; nLoopCnt++ )
  3156. {
  3157. LPPACKETMSG lpObjPacketMsg = (LPPACKETMSG)pxActor->m_xPacketQueue.PopQ();
  3158. SAFE_DELETE(lpObjPacketMsg);
  3159. }
  3160. switch ( pxActor->m_stFeature.bGender )
  3161. {
  3162. case _GENDER_MAN:
  3163. case _GENDER_WOMAN:
  3164. {
  3165. m_xActorList.DeleteCurrentNodeEx();
  3166. CHero* pxHero = (CHero*)pxActor;
  3167. delete((CHero*)pxHero);
  3168. pxHero = NULL;
  3169. }
  3170. break;
  3171. case _GENDER_NPC:
  3172. {
  3173. m_xActorList.DeleteCurrentNodeEx();
  3174. CNPC* pxNPC = (CNPC*)pxActor;
  3175. delete((CNPC*)pxNPC);
  3176. pxNPC = NULL;
  3177. }
  3178. break;
  3179. case _GENDER_MON:
  3180. {
  3181. m_xActorList.DeleteCurrentNodeEx();
  3182. delete(pxActor);
  3183. pxActor = NULL;
  3184. }
  3185. break;
  3186. }
  3187. break; //for巩阑 狐廉唱埃促.
  3188. }
  3189. m_xActorList.MoveNextNode();
  3190. }
  3191. }
  3192. else if ( lpstDefMsg->wIdent == SM_CLEAROBJECT )
  3193. {
  3194. CActor* pxActor = NULL;
  3195. m_xActorList.MoveCurrentToTop();
  3196. for ( INT nCnt = 0; nCnt < m_xActorList.GetCounter(); )
  3197. {
  3198. pxActor = m_xActorList.GetCurrentData();
  3199. INT nPacketCnt = pxActor->m_xPacketQueue.GetCount();
  3200. for ( INT nLoopCnt = 0; nLoopCnt < nPacketCnt; nLoopCnt++ )
  3201. {
  3202. LPPACKETMSG lpObjPacketMsg = (LPPACKETMSG)pxActor->m_xPacketQueue.PopQ();
  3203. SAFE_DELETE(lpObjPacketMsg);
  3204. }
  3205. switch ( pxActor->m_stFeature.bGender )
  3206. {
  3207. case _GENDER_MAN:
  3208. case _GENDER_WOMAN:
  3209. {
  3210. m_xActorList.DeleteCurrentNodeEx();
  3211. CHero* pxHero = (CHero*)pxActor;
  3212. delete((CHero*)pxHero);
  3213. pxHero = NULL;
  3214. }
  3215. break;
  3216. case _GENDER_NPC:
  3217. {
  3218. m_xActorList.DeleteCurrentNodeEx();
  3219. CNPC* pxNPC = (CNPC*)pxActor;
  3220. delete((CNPC*)pxNPC);
  3221. pxNPC = NULL;
  3222. }
  3223. break;
  3224. case _GENDER_MON:
  3225. {
  3226. m_xActorList.DeleteCurrentNodeEx();
  3227. delete(pxActor);
  3228. pxActor = NULL;
  3229. }
  3230. break;
  3231. }
  3232. // m_xActorList.MoveNextNode();
  3233. }
  3234. }
  3235. }
  3236. SAFE_DELETE(lpstDefMsg);
  3237. }
  3238. }
  3239. VOID CGameProcess::ProcessPacket()
  3240. {
  3241. LPPACKETMSG lpPacketMsg;
  3242. for (int i = 0; i < m_xWaitPacketQueue.GetCount(); i++)
  3243. {
  3244. BOOL bExist = FALSE;
  3245. CActor* pxActor = NULL;
  3246. lpPacketMsg = (LPPACKETMSG)m_xWaitPacketQueue.PopQ();
  3247. if ( lpPacketMsg )
  3248. {
  3249. if ( lpPacketMsg->stDefMsg.nRecog == m_xMyHero.m_dwIdentity )
  3250. {
  3251. if ( lpPacketMsg->stDefMsg.wIdent == SM_NOWDEATH || lpPacketMsg->stDefMsg.wIdent == SM_DEATH )
  3252. {
  3253. m_xMyHero.m_xPriorPacketQueue.PushQ((BYTE*)lpPacketMsg);
  3254. }
  3255. else if ( lpPacketMsg->stDefMsg.wIdent == SM_CHANGEMAP )
  3256. {
  3257. DWORD dwFogColor;
  3258. m_xMyHero.SetMotionFrame(_MT_STAND, m_xMyHero.m_bCurrDir);
  3259. m_xMyHero.m_wPosX = lpPacketMsg->stDefMsg.wParam; // + GAPX_TILE_CHAR_MAP;
  3260. m_xMyHero.m_wPosY = lpPacketMsg->stDefMsg.wTag; // + GAPY_TILE_CHAR_MAP;
  3261. m_xMap.SetStartViewTile(m_xMyHero.m_wPosX - _GAPX_TILE_CHAR_MAP, m_xMyHero.m_wPosY - _GAPY_TILE_CHAR_MAP);
  3262. char szDecodeMsg[MAX_PATH];
  3263. int nPos = fnDecode6BitBuf(lpPacketMsg->szEncodeData, szDecodeMsg, sizeof(szDecodeMsg));
  3264. szDecodeMsg[nPos] = '';
  3265. LoadMapChanged(szDecodeMsg);
  3266. m_bFogState = LOBYTE(lpPacketMsg->stDefMsg.wSeries);
  3267. switch ( m_bFogState )
  3268. {
  3269. case _FOGSTATE_DAY:
  3270. {
  3271. dwFogColor = RGB(240, 240, 240);
  3272. break;
  3273. }
  3274. case _FOGSTATE_NIGHT:
  3275. {
  3276. dwFogColor = RGB(10, 10, 10);
  3277. break;
  3278. }
  3279. case _FOGSTATE_DAWN:
  3280. {
  3281. dwFogColor = RGB(50, 50, 50);
  3282. break;
  3283. }
  3284. }
  3285. m_xLightFog.ChangeLightColor(dwFogColor);
  3286. // gadget
  3287. m_wInputDelayTime = 2300;
  3288. m_wCurrInputDelayTime = 0;
  3289. m_xMyHero.m_wABlendCurrDelay = 0;
  3290. m_xMyHero.m_wABlendDelay = 2300;
  3291. CloseNPCWindow();
  3292. }
  3293. else
  3294. {
  3295. if ( lpPacketMsg->stDefMsg.wIdent == SM_STRUCK )
  3296. {
  3297. // m_xMyHero.StruckMsgReassign();
  3298. if ( timeGetTime() - m_xMyHero.m_dwLastStruckTime < 500 )
  3299. {
  3300. SAFE_DELETE(lpPacketMsg);
  3301. continue;
  3302. }
  3303. MESSAGEBODYWL stMsgBodyWl;
  3304. fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stMsgBodyWl, sizeof(MESSAGEBODYWL));
  3305. for ( INT nCnt = 0; nCnt < m_xActorList.GetCounter(); nCnt++ )
  3306. {
  3307. CActor* pxGaheja = m_xActorList.GetCurrentData();
  3308. if ( pxGaheja->m_dwIdentity == stMsgBodyWl.nTag1 )
  3309. {
  3310. m_xMyHero.m_stHitter = pxGaheja->m_stFeature;
  3311. break;
  3312. }
  3313. m_xActorList.MoveNextNode();
  3314. }
  3315. }
  3316. m_xMyHero.StruckMsgReassign();
  3317. m_xMyHero.m_xPacketQueue.PushQ((BYTE*)lpPacketMsg);
  3318. }
  3319. }
  3320. else
  3321. {
  3322. FEATURE stFeature;
  3323. // FEATUREEX stFeatureEx;
  3324.   fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stFeature, sizeof(FEATURE));
  3325. m_xActorList.MoveCurrentToTop();
  3326. for ( INT nCnt = 0; nCnt < m_xActorList.GetCounter(); nCnt++ )
  3327. {
  3328. pxActor = m_xActorList.GetCurrentData();
  3329. if ( pxActor->m_dwIdentity == lpPacketMsg->stDefMsg.nRecog )
  3330. {
  3331. bExist = TRUE;
  3332. break;
  3333. }
  3334. m_xActorList.MoveNextNode();
  3335. }
  3336. if ( !bExist )
  3337. {
  3338. if ( stFeature.bGender == _GENDER_MAN || stFeature.bGender == _GENDER_WOMAN ) 
  3339. {
  3340. pxActor = new CHero;
  3341. CHero* pxHero = (CHero*)pxActor;
  3342. pxHero->m_dwIdentity = lpPacketMsg->stDefMsg.nRecog;
  3343. if ( pxHero->Create(&m_xImage, _MT_STAND, _DIRECTION_LIST_1, lpPacketMsg->stDefMsg.wParam, lpPacketMsg->stDefMsg.wTag, &stFeature, NULL) )
  3344. {
  3345. m_xActorList.AddNode(pxActor);
  3346. pxHero->m_wABlendCurrDelay = 0;
  3347. pxHero->m_wABlendDelay  = 1500;
  3348. }
  3349. }
  3350. else if ( stFeature.bGender == _GENDER_NPC )
  3351. {
  3352. pxActor = new CNPC;
  3353. CNPC* pxNPC = (CNPC*)pxActor;
  3354. pxNPC->m_dwIdentity = lpPacketMsg->stDefMsg.nRecog;
  3355. if ( pxNPC->Create(&m_xImage, &stFeature, _MT_STAND, _DIRECTION_LIST_1, lpPacketMsg->stDefMsg.wParam, lpPacketMsg->stDefMsg.wTag) )
  3356. m_xActorList.AddNode(pxActor);
  3357. pxNPC->m_wABlendCurrDelay = 0;
  3358. pxNPC->m_wABlendDelay   = 0;
  3359. }
  3360. else
  3361. // else if ( stFeature.bGender == _GENDER_MON )
  3362. {
  3363. stFeature.bGender = _GENDER_MON;
  3364. // 利侩矫难具窃.
  3365. // if ( stFeature.bWeapon == 0 ) // 扁夯.
  3366. // if ( stFeature.bWeapon == 1 ) // SKELLEON.
  3367. pxActor = new CActor;
  3368. pxActor->m_dwIdentity = lpPacketMsg->stDefMsg.nRecog;
  3369. if ( pxActor->Create(&m_xImage, &stFeature, _MT_STAND, _DIRECTION_LIST_1, lpPacketMsg->stDefMsg.wParam, lpPacketMsg->stDefMsg.wTag) )
  3370. {
  3371. m_xActorList.AddNode(pxActor);
  3372. pxActor->m_wABlendCurrDelay = 0;
  3373. pxActor->m_wABlendDelay = 150;
  3374. }
  3375. }
  3376. }
  3377. if ( pxActor )
  3378. {
  3379. if ( lpPacketMsg->stDefMsg.wIdent == SM_STRUCK )
  3380. {
  3381. // pxActor->StruckMsgReassign();
  3382. MESSAGEBODYWL stMsgBodyWl;
  3383. fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stMsgBodyWl, sizeof(MESSAGEBODYWL));
  3384. for ( INT nCnt = 0; nCnt < m_xActorList.GetCounter(); nCnt++ )
  3385. {
  3386. CActor* pxGaheja = m_xActorList.GetCurrentData();
  3387. if ( pxGaheja->m_dwIdentity == stMsgBodyWl.nTag1 )
  3388. {
  3389. pxActor->m_stHitter = pxGaheja->m_stFeature;
  3390. break;
  3391. }
  3392. m_xActorList.MoveNextNode();
  3393. }
  3394. }
  3395. pxActor->StruckMsgReassign();
  3396. pxActor->m_xPacketQueue.PushQ((BYTE*)lpPacketMsg);
  3397. }
  3398. else
  3399. SAFE_DELETE(lpPacketMsg);
  3400. }
  3401. }
  3402. }
  3403. }
  3404. // **************************************************************************************
  3405. //
  3406. //  Packet Handling
  3407. //
  3408. // **************************************************************************************
  3409. VOID CGameProcess::OnSvrMsgNewMap(_TDEFAULTMESSAGE *ptdm, char *pszMapName)
  3410. {
  3411. DWORD dwFogColor;
  3412. char szMapName[32];
  3413. m_xMyHero.m_wPosX = ptdm->wParam;
  3414. m_xMyHero.m_wPosY = ptdm->wTag;
  3415. m_bDayState = LOBYTE(ptdm->wSeries);
  3416. int nPos = fnDecode6BitBuf(pszMapName, (char*)szMapName, sizeof(szMapName));
  3417. szMapName[nPos] = '';
  3418. m_xMap.SetStartViewTile(m_xMyHero.m_wPosX - _GAPY_TILE_CHAR_MAP, m_xMyHero.m_wPosY - _GAPY_TILE_CHAR_MAP);
  3419. m_xMap.LoadMapData(szMapName);
  3420. switch ( m_bFogState )
  3421. {
  3422. case _FOGSTATE_DAY:
  3423. {
  3424. m_fDarkRate = 255.0f;
  3425. dwFogColor = RGB(m_fDarkRate, m_fDarkRate, m_fDarkRate);
  3426. break;
  3427. }
  3428. case _FOGSTATE_NIGHT:
  3429. {
  3430. m_fDarkRate = 10.0f;
  3431. dwFogColor = RGB(m_fDarkRate, m_fDarkRate, m_fDarkRate);
  3432. break;
  3433. }
  3434. case _FOGSTATE_DAWN:
  3435. {
  3436. m_fDarkRate = 50.0f;
  3437. dwFogColor = RGB(m_fDarkRate, m_fDarkRate, m_fDarkRate);
  3438. break;
  3439. }
  3440. }
  3441. m_xLightFog.ChangeLightColor(dwFogColor);
  3442. /* g_xSound.PlayBkMusicMp3(TRUE, 0);
  3443. */
  3444. m_bRender = TRUE;
  3445. }
  3446. VOID CGameProcess::OnSvrMsgLogon(_TDEFAULTMESSAGE *ptdm, char *pszMsg)
  3447. {
  3448. MESSAGEBODYWL wl;
  3449. m_xMyHero.m_dwIdentity = ptdm->nRecog;
  3450. m_xMyHero.m_bLightSize = HIBYTE(ptdm->wSeries);
  3451. BYTE bDir = LOBYTE(ptdm->wSeries);
  3452. if ( bDir > 8 )
  3453. bDir = 0;
  3454. // 眠啊内靛
  3455. fnDecode6BitBuf(pszMsg, (char*)&wl, sizeof(wl));
  3456. // if ( stFeatureEx.bHorse == _HORSE_NONE )
  3457. m_xMyHero.Create(&m_xImage, _MT_STAND, bDir, ptdm->wParam/*x*/, ptdm->wTag/*y*/, (FEATURE *)&wl.lParam1, NULL);
  3458. // else
  3459. // m_xMyHero.Create(&m_xImage, _MT_HORSESTAND, bDir, m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, stFeature, stFeatureEx);
  3460. strcpy(g_xGameProc.m_xMyHero.m_szName, g_szCharName);
  3461. m_xMyHero.SetMapHandler(&m_xMap);
  3462. CMagic* pxMagic;
  3463. pxMagic = new CMagic;
  3464. pxMagic->CreateMagic(_SKILL_SPACEMOVE2, m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, m_xMyHero.m_wPosX, m_xMyHero.m_wPosY, NULL, m_xMyHero.m_dwIdentity);
  3465. m_xMagicList.AddNode(pxMagic);
  3466. m_wInputDelayTime = 2300;
  3467. m_wCurrInputDelayTime = 0;
  3468. m_xMyHero.m_wABlendCurrDelay = 0;
  3469. m_xMyHero.m_wABlendDelay = 2300;
  3470. g_xClientSocket.SendQueryMsg(CM_QUERYBAGITEMS);
  3471. }
  3472. VOID CGameProcess::OnSvrMsgHear(_TDEFAULTMESSAGE *ptdm, char *pszMsg)
  3473. {
  3474. // DWORD dwFontBackClr = m_xInterface.m_dwFontClrDfnList[ptdm->wParam];
  3475. // DWORD dwFontClr = m_xInterface.m_dwFontClrDfnList[ptdm->wTag];
  3476. char szDecodeMsg[MAX_PATH];
  3477. int nPos = fnDecode6BitBuf(pszMsg, szDecodeMsg, sizeof(szDecodeMsg));
  3478. szDecodeMsg[nPos] = '';
  3479. DWORD dwBack = GetChatColor(ptdm->wParam);
  3480. DWORD dwFont = GetChatColor(ptdm->wTag);
  3481. m_xInterface.MsgAdd(dwFont, dwBack, szDecodeMsg);
  3482. if ( ptdm->wIdent == SM_HEAR || ptdm->wIdent == SM_MONSTERSAY )
  3483. {
  3484. if ( ptdm->nRecog == m_xMyHero.m_dwIdentity )
  3485. {
  3486. strcpy(m_xMyHero.m_szChatMsg, szDecodeMsg);
  3487. m_xMyHero.ChatMsgAdd();
  3488. m_xMyHero.m_wCurrChatDelay = 0;
  3489. }
  3490. else
  3491. {
  3492. m_xActorList.MoveCurrentToTop();
  3493. CActor* pxActor;
  3494. if ( m_xActorList.GetCounter() != 0 )
  3495. {
  3496. for ( INT nCnt = 0; nCnt <= m_xActorList.GetCounter(); nCnt++ )
  3497. pxActor = m_xActorList.GetCurrentData();
  3498. if ( pxActor->m_dwIdentity == ptdm->nRecog )
  3499. {
  3500. strcpy(pxActor->m_szChatMsg, szDecodeMsg);
  3501. pxActor->ChatMsgAdd();
  3502. pxActor->m_wCurrChatDelay = 0;
  3503. }
  3504. m_xActorList.MoveNextNode();
  3505. }
  3506. }
  3507. }
  3508. }
  3509. }