Single_Game.cpp
上传用户:may_xy
上传日期:2007-08-09
资源大小:1519k
文件大小:16k
源码类别:

游戏

开发平台:

C/C++

  1. // Single_Game.cpp: implementation of the CSingleGame class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "斗地主.h"
  6. #include "MainFrm.h"
  7. #include "My_DirectInput.h"
  8. #include "my_directdraw.h"
  9. #include "Playing_Cards.h"
  10. #include "Game.h"
  11. #include "Draw_Item_Engine.h"
  12. #include "Draw_Cards_Engine.h"
  13. #include "Single_Game.h"
  14. #ifdef _DEBUG
  15. #undef THIS_FILE
  16. static char THIS_FILE[]=__FILE__;
  17. #define new DEBUG_NEW
  18. #endif
  19. //////////////////////////////////////////////////////////////////////
  20. // Construction/Destruction
  21. //////////////////////////////////////////////////////////////////////
  22. CSingleGame::CSingleGame()
  23. {
  24. }
  25. CSingleGame::~CSingleGame()
  26. {
  27. }
  28. //决定地主 ;
  29. int CSingleGame::DecideLord()
  30. {
  31. //产生地主;
  32. m_nDefaultLord = rand()%3;
  33. // m_nDefaultLord = 2;
  34. pDrawItem->BringRandLord(m_nDefaultLord);
  35. m_nCurrentLord = m_nDefaultLord;
  36. int High = -1;
  37. int My_Cards_Value = pCenterCards->AccountCardsValue();
  38. int Left_Cards_Value = pLeftCards->AccountCardsValue();
  39. int Right_Cards_Value = pRightCards->AccountCardsValue();
  40. if( My_Cards_Value >= Right_Cards_Value )
  41. {
  42. if( My_Cards_Value >= Left_Cards_Value)
  43. {
  44. High = 1;
  45. }
  46. else
  47. {
  48. High = 0;
  49. }
  50. }
  51. else
  52. {
  53. if( Right_Cards_Value >= Left_Cards_Value )
  54. {
  55. High = 2;
  56. }
  57. else
  58. {
  59. High = 0;
  60. }
  61. }  //end if;
  62. // char info[50];
  63. // sprintf(info,"Left:%d Center:%d Right:%dn",
  64. // Left_Cards_Value,My_Cards_Value,Right_Cards_Value);
  65. // AfxMessageBox(info);
  66. // Sleep(10000);
  67. // pDraw->DebugText(info,1000);
  68. int counter = 0;
  69. while(1)
  70. {
  71. if( m_nCurrentLord ==1 )
  72. {
  73. while(1)
  74. {
  75. pDrawItem->ChooseLord();
  76. if( pInput->IsLButtonDown(m_cYES_RECT) )  //要
  77. {
  78. //相关处理;
  79. PlaySound(MAKEINTRESOURCE(IDR_CHOSE),AfxGetResourceHandle(),
  80. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  81. pDrawItem->GameInfo(m_nCurrentLord,0);
  82. Sleep(500);   //产生一个延时;
  83. goto out;
  84. }
  85. else if( pInput->IsLButtonDown(m_cNO_RECT) )  //不要
  86. {
  87. //相关处理;
  88. PlaySound(MAKEINTRESOURCE(IDR_CHOSE),AfxGetResourceHandle(),
  89. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  90. counter++;
  91. if( counter == 3 )
  92. {
  93. m_nCurrentLord = m_nDefaultLord;
  94. pDrawItem->GameInfo(m_nDefaultLord,2);
  95. goto out;
  96. }
  97. pDrawItem->GameInfo(m_nCurrentLord,1);
  98. Sleep(500);   //产生一个延时;
  99. m_nCurrentLord = 2;
  100. break;
  101. }
  102. Sleep(50);   //产生一个延时;
  103. }
  104. }
  105. else if( m_nCurrentLord == 0 )
  106. {
  107. //根据当前牌决定是否当地主;
  108. if( High == 0 )   //当
  109. {
  110. pDrawItem->GameInfo(m_nCurrentLord,0);
  111. goto out;
  112. }
  113. else  //不当;
  114. {
  115. counter++;
  116. if( counter == 3 )
  117. {
  118. m_nCurrentLord = m_nDefaultLord;
  119. pDrawItem->GameInfo(m_nDefaultLord,2);
  120. goto out;
  121. }
  122. pDrawItem->GameInfo(m_nCurrentLord,1);
  123. Sleep(500);   //产生一个延时;
  124. m_nCurrentLord = 1;
  125. }
  126. }
  127. else if( m_nCurrentLord == 2 )
  128. {
  129. //根据当前牌决定是否当地主;
  130. if( High == 2 )   //当
  131. {
  132. pDrawItem->GameInfo(m_nCurrentLord,0);
  133. goto out;
  134. }
  135. else  //不当;
  136. {
  137. counter++;
  138. if( counter == 3 )
  139. {
  140. m_nCurrentLord = m_nDefaultLord;
  141. pDrawItem->GameInfo(m_nDefaultLord,2);
  142. goto out;
  143. }
  144. pDrawItem->GameInfo(m_nCurrentLord,1);
  145. Sleep(500);   //产生一个延时;
  146. m_nCurrentLord = 0;
  147. }
  148. }
  149. }//end while;
  150. out:
  151. return 1;
  152. }
  153. //int CSingleGame::Bring_Rand_Lord()
  154. int CSingleGame::Run()
  155. {
  156. //开始新的牌局;
  157. NewGame();    
  158. //显示局数;
  159. pDrawItem->GameCounter(m_nGameCounter);  
  160. //洗牌;
  161. ShuffleCards();
  162. //发牌;
  163. pDrawCards->Dealing();   
  164. pLeftCards->ScanToTable();
  165. pRightCards->ScanToTable();
  166. //决定地主;
  167. DecideLord();    
  168. pDrawCards->DealingLord(m_nCurrentLord); //发地主牌;
  169. m_bOperate  = TRUE;
  170. //开始循环;
  171. if(m_nCurrentLord == 0)
  172. {
  173. LeftDoing();
  174. ::SetTimer(hWnd,20,50,NULL);
  175. }
  176. else if(m_nCurrentLord == 1)
  177. {
  178. ::SetTimer(hWnd,20,50,NULL);
  179. }
  180. else if(m_nCurrentLord == 2)
  181. {
  182. RightDoing();
  183. LeftDoing();
  184. ::SetTimer(hWnd,20,50,NULL);
  185. }
  186. return 1;
  187. }
  188. //左边玩家(电脑)思考,并决定要出的牌;
  189. int CSingleGame::LeftDoing()
  190. {
  191. if( m_nRoundCounter == 3 )  //说明已经出了牌;
  192. {
  193. //把已经出的牌回退;
  194. if(pLeftCards->m_nDiscardingCounter != 0)
  195. pDrawCards->LeftBacking();
  196. if(pCenterCards->m_nDiscardingCounter != 0)
  197. pDrawCards->CenterBacking();
  198. if(pRightCards->m_nDiscardingCounter != 0)
  199. pDrawCards->RightBacking();
  200. m_nRoundCounter = 0;   //新的一圈;
  201. }
  202. m_nRoundCounter++;
  203. if( m_nLordLock == 0 )
  204. {
  205. return -1;
  206. }
  207. if(pRightCards->m_cDiscardingType.m_nTypeNum == 0 &&
  208. pCenterCards->m_cDiscardingType.m_nTypeNum == 0)
  209. {
  210. m_nLordLock = -1;   //解锁;
  211. //开始新的一回合,选择一种牌型出;
  212. pLeftCards->DirectChoose();
  213. if( pLeftCards->m_cDiscardingType.m_nTypeNum == 4 )
  214. {
  215. m_nBombCounter++;//加分;
  216. }
  217. pLeftCards->CleanUp();
  218. pDrawCards->LeftDiscarding();
  219. ::RedrawGame();
  220. if( pLeftCards->m_nCardsCounter == 0 )
  221. {
  222. //打印结束信息;
  223. if(m_nCurrentLord == 2 )
  224. {
  225. PlaySound(MAKEINTRESOURCE(IDR_WIN),AfxGetResourceHandle(),
  226. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  227. }
  228. else
  229. {
  230. PlaySound(MAKEINTRESOURCE(IDR_LOSE),AfxGetResourceHandle(),
  231. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  232. }
  233. pDrawCards->m_bVisual = TRUE;
  234. AccountScore(0);
  235. ::SetTimer(hWnd,0,0,NULL);   //开始游戏;
  236. return 0;
  237. }
  238. return 1;
  239. }
  240. //1.两者都不能大牌,我是最大;
  241. //2.新的一回合开始,我先出;
  242. if(pRightCards->m_cDiscardingType.m_nTypeNum != 0 )
  243. {
  244. //如果同伙出了比较大的牌,则不跟;
  245. if( m_nCurrentLord == 1 && 
  246. m_nLordLock == 1  &&
  247. pRightCards->m_cDiscardingType.m_nTypeValue > 13 )
  248. {
  249. //不要;
  250. pLeftCards->m_cDiscardingType.m_nTypeNum = 0;
  251. pDraw->TextGDI("过牌!-",250,200,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  252. //补丁:地主一旦过牌,本轮内都不能再出牌;
  253. Sleep(300);
  254. return 1;
  255. }
  256. if( pLeftCards->CompareChoose(pRightCards->m_cDiscardingType) )
  257. {
  258. if( pLeftCards->m_cDiscardingType.m_nTypeNum == 4 )
  259. {
  260. m_nBombCounter++;//加分;
  261. }
  262. pLeftCards->CleanUp();
  263. pDrawCards->LeftDiscarding();
  264. ::RedrawGame();
  265. if( pLeftCards->m_nCardsCounter == 0 )
  266. {
  267. //打印结束信息;
  268. if(m_nCurrentLord == 2 )
  269. {
  270. PlaySound(MAKEINTRESOURCE(IDR_WIN),AfxGetResourceHandle(),
  271. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  272. }
  273. else
  274. {
  275. PlaySound(MAKEINTRESOURCE(IDR_LOSE),AfxGetResourceHandle(),
  276. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  277. }
  278. pDrawCards->m_bVisual = TRUE;
  279. AccountScore(0);
  280. ::SetTimer(hWnd,0,0,NULL);   //开始游戏;
  281. return 0;
  282. }
  283. }
  284. else
  285. {
  286. //补丁:地主一旦过牌,本轮内都不能再出牌;
  287. if( m_nCurrentLord == 0 )
  288. {
  289. m_nLordLock = 0;
  290. }
  291. //不要;
  292. pLeftCards->m_cDiscardingType.m_nTypeNum = 0;
  293. pDraw->TextGDI("过牌!-",250,200,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  294. Sleep(300);
  295. }
  296. }
  297. else
  298. {
  299. //如果同伙出了比较大的牌,则不跟;
  300. if( m_nCurrentLord == 2 && 
  301. m_nLordLock == 2 &&
  302. pCenterCards->m_cDiscardingType.m_nTypeValue > 13 )
  303. {
  304. //不要;
  305. pLeftCards->m_cDiscardingType.m_nTypeNum = 0;
  306. pDraw->TextGDI("过牌!-",250,200,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  307. Sleep(300);
  308. return 1;
  309. }
  310. //如果上家没出牌,则根据上上家决定出牌;
  311. if( pLeftCards->CompareChoose(pCenterCards->m_cDiscardingType) )
  312. {
  313. if( pLeftCards->m_cDiscardingType.m_nTypeNum == 4 )
  314. {
  315. m_nBombCounter++;//加分;
  316. }
  317. pLeftCards->CleanUp();
  318. pDrawCards->LeftDiscarding();
  319. ::RedrawGame();
  320. if( pLeftCards->m_nCardsCounter == 0 )
  321. {
  322. //打印结束信息;
  323. if(m_nCurrentLord == 2 )
  324. {
  325. PlaySound(MAKEINTRESOURCE(IDR_WIN),AfxGetResourceHandle(),
  326. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  327. }
  328. else
  329. {
  330. PlaySound(MAKEINTRESOURCE(IDR_LOSE),AfxGetResourceHandle(),
  331. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  332. }
  333. pDrawCards->m_bVisual = TRUE;
  334. AccountScore(0);
  335. ::SetTimer(hWnd,0,0,NULL);   //开始游戏;
  336. return 0;
  337. }
  338. }
  339. else
  340. {
  341. if( m_nCurrentLord == 0 )
  342. {
  343. m_nLordLock = 0;
  344. }
  345. //不要;
  346. pLeftCards->m_cDiscardingType.m_nTypeNum = 0;
  347. pDraw->TextGDI("-过牌!",250,200,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  348. Sleep(300);
  349. }
  350. }
  351. return 1;
  352. }
  353. //本机(中间)玩家的出牌处理;
  354. int CSingleGame::CenterDoing()
  355. {
  356. if( m_nLordLock == 1 )
  357. {
  358. if( m_nRoundCounter == 3 )  //说明已经出了牌;
  359. {
  360. //把已经出的牌回退;
  361. if(pCenterCards->m_nDiscardingCounter != 0)
  362. pDrawCards->CenterBacking();
  363. if(pRightCards->m_nDiscardingCounter != 0)
  364. pDrawCards->RightBacking();
  365. if(pLeftCards->m_nDiscardingCounter != 0)
  366. pDrawCards->LeftBacking();
  367. m_nRoundCounter = 0;   //新的一圈;
  368. }
  369. m_nRoundCounter++;
  370. return -1;  //表示当前是地主,上次轮过牌,现在则不能出牌;
  371. }
  372. //如果没有选择牌;
  373. if( pCardsMap->m_nUpCounter == 0 )
  374. {
  375. //当不是第一个出牌的时候才可以过牌;
  376. if( pLeftCards->m_cDiscardingType.m_nTypeNum != 0 || 
  377. pRightCards->m_cDiscardingType.m_nTypeNum != 0 )
  378. {
  379. pDraw->TextGDI("过牌!",470,400,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  380. Sleep(500);
  381. if( m_nRoundCounter == 3 )  //说明已经出了牌;
  382. {
  383. //把已经出的牌回退;
  384. if(pCenterCards->m_nDiscardingCounter != 0)
  385. pDrawCards->CenterBacking();
  386. if(pRightCards->m_nDiscardingCounter != 0)
  387. pDrawCards->RightBacking();
  388. if(pLeftCards->m_nDiscardingCounter != 0)
  389. pDrawCards->LeftBacking();
  390. m_nRoundCounter = 0;   //新的一圈;
  391. }
  392. m_nRoundCounter++;
  393. pCenterCards->m_cDiscardingType.m_nTypeNum = 0; //将出的牌值设为空;
  394. if( m_nCurrentLord == 1 )
  395. {
  396. m_nLordLock = 1;
  397. }
  398. return 1;
  399. }
  400. else
  401. {
  402. return 0;
  403. }
  404. }
  405. pCenterCards->m_nChoosingCardsCounter = 0;
  406. //将要出的牌加入到m_cDiscarding[20]数组中,m_nDiscardingCounter计数增加;
  407. for(int i=0;i<pCenterCards->m_nCardsCounter;i++)
  408. {
  409. if(pCardsMap->Center0[i].m_nY== Center_y0 - Card_Up)
  410. {
  411. pCenterCards->m_cChoosingCards[pCenterCards->m_nChoosingCardsCounter] = pCenterCards->m_cCards[i];
  412. pCenterCards->m_nChoosingCardsCounter++;
  413. }
  414. }
  415. //判断出牌的合法性,
  416. if( pCenterCards->CheckChoosing() )
  417. {
  418. //大小判断;
  419. if( CompareCards() == 0 )
  420. {
  421. for(int j=0;j<pCenterCards->m_nCardsCounter;j++)
  422. {
  423. if(pCardsMap->Center0[j].m_nY== Center_y0 - Card_Up)
  424. {
  425. pCardsMap->Center0[j].m_nY+= Card_Up;
  426. }
  427. }
  428. pCardsMap->m_nUpCounter = 0;  //提起牌数为0;
  429. ::RedrawGame();
  430. m_bButton = 0;   //延时锁;
  431. Sleep(400);
  432. m_bButton = 1;   //延时锁;
  433. return 0;
  434. }
  435. if( m_nRoundCounter == 3 )  //说明已经出了牌;
  436. {
  437. //把已经出的牌回退;
  438. if(pCenterCards->m_nDiscardingCounter != 0)
  439. pDrawCards->CenterBacking();
  440. if(pRightCards->m_nDiscardingCounter != 0)
  441. pDrawCards->RightBacking();
  442. if(pLeftCards->m_nDiscardingCounter != 0)
  443. pDrawCards->LeftBacking();
  444. m_nRoundCounter = 0;   //新的一圈;
  445. }
  446. m_nRoundCounter++;
  447. //将要出的牌加入到m_cDiscarding[20]数组中,m_nDiscardingCounter计数增加;
  448. for(int i=0;i<pCenterCards->m_nCardsCounter;i++)
  449. {
  450. if(pCardsMap->Center0[i].m_nY== Center_y0 - Card_Up)
  451. {
  452. pCenterCards->m_cDiscarding[pCenterCards->m_nDiscardingCounter] = pCenterCards->m_cCards[i];
  453. pCenterCards->m_nDiscardingCounter++;
  454. }
  455. }
  456. if( pCenterCards->m_cDiscardingType.m_nTypeNum == 4 )
  457. {
  458. m_nBombCounter++;//加分;
  459. }
  460. pDrawCards->CenterDiscarding();      //本机玩家出牌;
  461. if( pCenterCards->m_nCardsCounter == 0 )
  462. {
  463. //打印结束信息;
  464. PlaySound(MAKEINTRESOURCE(IDR_WIN),AfxGetResourceHandle(),
  465. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  466. pDrawCards->m_bVisual = TRUE;
  467. AccountScore(1);
  468. ::SetTimer(hWnd,0,0,NULL);   //开始游戏;
  469. return 2;
  470. }
  471. }
  472. else
  473. {
  474. for(int j=0;j<pCenterCards->m_nCardsCounter;j++)
  475. {
  476. if(pCardsMap->Center0[j].m_nY== Center_y0 - Card_Up)
  477. {
  478. pCardsMap->Center0[j].m_nY+= Card_Up;
  479. }
  480. }
  481. pCardsMap->m_nUpCounter = 0;  //提起牌数为0;
  482. ::RedrawGame();
  483. m_bButton = 0;   //延时锁;
  484. Sleep(400);
  485. m_bButton = 1;   //延时锁;
  486. return 0;
  487. }
  488. return 1;
  489. }
  490. //右边电脑思考,并决定要出的牌;
  491. int CSingleGame::RightDoing()
  492. {
  493. if( m_nRoundCounter == 3 )  //说明已经出了牌;
  494. {
  495. //把已经出的牌回退;
  496. if(pRightCards->m_nDiscardingCounter != 0)
  497. pDrawCards->RightBacking();
  498. if(pCenterCards->m_nDiscardingCounter != 0)
  499. pDrawCards->CenterBacking();
  500. if(pLeftCards->m_nDiscardingCounter != 0)
  501. pDrawCards->LeftBacking();
  502. m_nRoundCounter = 0;   //新的一圈;
  503. }
  504. m_nRoundCounter++;
  505. if( m_nLordLock == 2 )
  506. {
  507. return -1;
  508. }
  509. if(pCenterCards->m_cDiscardingType.m_nTypeNum == 0 &&
  510. pLeftCards->m_cDiscardingType.m_nTypeNum == 0)
  511. {
  512. m_nLordLock = -1;
  513. //开始新的一回合,选择一种牌型出;
  514. pRightCards->DirectChoose();
  515. if( pRightCards->m_cDiscardingType.m_nTypeNum == 4 )
  516. {
  517. m_nBombCounter++;//加分;
  518. }
  519. pRightCards->CleanUp();
  520. pDrawCards->RightDiscarding();
  521. ::RedrawGame();
  522. if( pRightCards->m_nCardsCounter == 0 )
  523. {
  524. //打印结束信息;
  525. if( m_nCurrentLord == 0 )
  526. {
  527. PlaySound(MAKEINTRESOURCE(IDR_WIN),AfxGetResourceHandle(),
  528. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  529. }
  530. else
  531. {
  532. PlaySound(MAKEINTRESOURCE(IDR_LOSE),AfxGetResourceHandle(),
  533. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  534. }
  535. pDrawCards->m_bVisual = TRUE;
  536. AccountScore(2);
  537. ::SetTimer(hWnd,0,0,NULL);   //开始游戏;
  538. return 0;
  539. }
  540. return 1;
  541. }
  542. //1.两者都不能大牌,我是最大;
  543. //2.新的一回合开始,我先出;
  544. if(pCenterCards->m_cDiscardingType.m_nTypeNum != 0)
  545. {
  546. //如果上家出了牌,则根据上家决定出牌;
  547. if( m_nCurrentLord == 0 && 
  548. m_nLordLock == 0 &&
  549. pCenterCards->m_cDiscardingType.m_nTypeValue > 13 )
  550. {
  551. //不要;
  552. pRightCards->m_cDiscardingType.m_nTypeNum = 0;
  553. pDraw->TextGDI("过牌!-",600,200,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  554. Sleep(300);
  555. return 1;
  556. }
  557. //如果上家出了牌,则根据上家决定出牌;
  558. if( pRightCards->CompareChoose(pCenterCards->m_cDiscardingType) )
  559. {
  560. if( pRightCards->m_cDiscardingType.m_nTypeNum == 4 )
  561. {
  562. m_nBombCounter++;//加分;
  563. }
  564. pRightCards->CleanUp();
  565. pDrawCards->RightDiscarding();
  566. ::RedrawGame();
  567. if( pRightCards->m_nCardsCounter == 0 )
  568. {
  569. //打印结束信息;
  570. if(m_nCurrentLord == 0 )
  571. {
  572. PlaySound(MAKEINTRESOURCE(IDR_WIN),AfxGetResourceHandle(),
  573. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  574. }
  575. else
  576. {
  577. PlaySound(MAKEINTRESOURCE(IDR_LOSE),AfxGetResourceHandle(),
  578. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  579. }
  580. pDrawCards->m_bVisual = TRUE;
  581. AccountScore(2);
  582. ::SetTimer(hWnd,0,0,NULL);   //开始游戏;
  583. return 0;
  584. }
  585. }
  586. else
  587. {
  588. //不要;
  589. pRightCards->m_cDiscardingType.m_nTypeNum = 0;
  590. pDraw->TextGDI("过牌!-",600,200,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  591. if( m_nCurrentLord == 2 )
  592. {
  593. m_nLordLock = 2;
  594. }
  595. Sleep(300);
  596. }
  597. }
  598. else
  599. {
  600. //如果上家出了牌,则根据上家决定出牌;
  601. if( m_nCurrentLord == 1 && 
  602. m_nLordLock == 1 &&
  603. pLeftCards->m_cDiscardingType.m_nTypeValue > 13 )
  604. {
  605. //不要;
  606. pRightCards->m_cDiscardingType.m_nTypeNum = 0;
  607. pDraw->TextGDI("过牌!-",600,200,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  608. //补丁:地主一旦过牌,本轮内都不能再出牌;
  609. Sleep(300);
  610. return 1;
  611. }
  612. //如果上家没出牌,则根据上上家决定出牌;
  613. if( pRightCards->CompareChoose(pLeftCards->m_cDiscardingType) )
  614. {
  615. if( pRightCards->m_cDiscardingType.m_nTypeNum == 4 )
  616. {
  617. m_nBombCounter++;//加分;
  618. }
  619. pRightCards->CleanUp();
  620. pDrawCards->RightDiscarding();
  621. ::RedrawGame();
  622. if( pRightCards->m_nCardsCounter == 0 )
  623. {
  624. //打印结束信息;
  625. if(m_nCurrentLord == 0 )
  626. {
  627. PlaySound(MAKEINTRESOURCE(IDR_WIN),AfxGetResourceHandle(),
  628. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  629. }
  630. else
  631. {
  632. PlaySound(MAKEINTRESOURCE(IDR_LOSE),AfxGetResourceHandle(),
  633. SND_ASYNC|SND_RESOURCE|SND_NODEFAULT );  //
  634. }
  635.       pDrawCards->m_bVisual = TRUE;
  636. AccountScore(2);
  637. ::SetTimer(hWnd,0,0,NULL);   //开始游戏;
  638. return 0;
  639. }
  640. }
  641. else
  642. {
  643. //不要;
  644. pRightCards->m_cDiscardingType.m_nTypeNum = 0;
  645. pDraw->TextGDI("过牌!-",600,200,RGB(255,0,0),400,"华文新魏",lpddsprimary);
  646. if( m_nCurrentLord == 2 )
  647. {
  648. m_nLordLock = 2;
  649. }
  650. Sleep(300);
  651. }
  652. }
  653. return 1;
  654. }