IN_LUDE.OLD 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  1. /*
  2. ========================
  3. =
  4. = IN_lude.c
  5. =
  6. ========================
  7. */
  8. #include "DoomDef.h"
  9. #include "soundst.h"
  10. typedef enum
  11. {
  12. SINGLE,
  13. COOPERATIVE,
  14. DEATHMATCH
  15. } gametype_t;
  16. // Public functions
  17. void IN_Start(void);
  18. void IN_Ticker(void);
  19. void IN_Drawer(void);
  20. boolean intermission;
  21. // Private functions
  22. void IN_WaitStop(void);
  23. void IN_Stop(void);
  24. void IN_LoadPics(void);
  25. void IN_UnloadPics(void);
  26. void IN_CheckForSkip(void);
  27. void IN_InitStats(void);
  28. void IN_InitDeathmatchStats(void);
  29. void IN_InitNetgameStats(void);
  30. void IN_DrawOldLevel(void);
  31. void IN_DrawYAH(void);
  32. void IN_DrawStatBack(void);
  33. void IN_DrawSingleStats(void);
  34. void IN_DrawCoopStats(void);
  35. void IN_DrawDMStats(void);
  36. void IN_DrawNumber(int val, int x, int y, int digits);
  37. void IN_DrawTime(int x, int y, int h, int m, int s);
  38. void IN_DrTextB(char *text, int x, int y);
  39. static boolean skipintermission;
  40. static int interstate = 0;
  41. static int intertime = -1;
  42. static int oldintertime = 0;
  43. static gametype_t gametype;
  44. static int cnt;
  45. static int time;
  46. static int hours;
  47. static int minutes;
  48. static int seconds;
  49. static int slaughterboy; // in DM, the player with the most kills
  50. static int killPercent[MAXPLAYERS];
  51. static int bonusPercent[MAXPLAYERS];
  52. static int secretPercent[MAXPLAYERS];
  53. static patch_t *patchINTERPIC;
  54. static patch_t *patchBEENTHERE;
  55. static patch_t *patchGOINGTHERE;
  56. static patch_t *FontBNumbers[10];
  57. static patch_t *FontBNegative;
  58. static patch_t *FontBSlash;
  59. static patch_t *FontBPercent;
  60. static int FontBLump;
  61. static int FontBLumpBase;
  62. static int patchFaceOkayBase;
  63. static int patchFaceDeadBase;
  64. static signed int totalFrags[MAXPLAYERS];
  65. static fixed_t dSlideX[MAXPLAYERS];
  66. static fixed_t dSlideY[MAXPLAYERS];
  67. static char *KillersText[] = { "K", "I", "L", "L", "E", "R", "S" };
  68. extern char *LevelNames[];
  69. typedef struct
  70. {
  71. int x;
  72. int y;
  73. } yahpt_t;
  74. static yahpt_t YAHspot[3][9] =
  75. {
  76. {
  77. { 172, 78 },
  78. { 86, 90 },
  79. { 73, 66 },
  80. { 159, 95 },
  81. { 148, 126 },
  82. { 132, 54 },
  83. { 131, 74 },
  84. { 208, 138 },
  85. { 52, 101 }
  86. },
  87. {
  88. { 218, 57 },
  89. { 137, 81 },
  90. { 155, 124 },
  91. { 171, 68 },
  92. { 250, 86 },
  93. { 136, 98 },
  94. { 203, 90 },
  95. { 220, 140 },
  96. { 279, 106 }
  97. },
  98. {
  99. { 86, 99 },
  100. { 124, 103 },
  101. { 154, 79 },
  102. { 202, 83 },
  103. { 178, 59 },
  104. { 142, 58 },
  105. { 219, 66 },
  106. { 247, 57 },
  107. { 107, 80 }
  108. }
  109. };
  110. //========================================================================
  111. //
  112. // IN_Start
  113. //
  114. //========================================================================
  115. extern void AM_Stop (void);
  116. void IN_Start(void)
  117. {
  118. I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE));
  119. IN_LoadPics();
  120. IN_InitStats();
  121. intermission = true;
  122. interstate = -1;
  123. skipintermission = false;
  124. intertime = 0;
  125. oldintertime = 0;
  126. AM_Stop();
  127. S_StartSong(mus_intr, true);
  128. }
  129. //========================================================================
  130. //
  131. // IN_WaitStop
  132. //
  133. //========================================================================
  134. void IN_WaitStop(void)
  135. {
  136. if(!--cnt)
  137. {
  138. IN_Stop();
  139. G_WorldDone();
  140. }
  141. }
  142. //========================================================================
  143. //
  144. // IN_Stop
  145. //
  146. //========================================================================
  147. void IN_Stop(void)
  148. {
  149. intermission = false;
  150. IN_UnloadPics();
  151. SB_state = -1;
  152. BorderNeedRefresh = true;
  153. }
  154. //========================================================================
  155. //
  156. // IN_InitStats
  157. //
  158. // Initializes the stats for single player mode
  159. //========================================================================
  160. void IN_InitStats(void)
  161. {
  162. int i;
  163. int j;
  164. signed int slaughterfrags;
  165. int posnum;
  166. int slaughtercount;
  167. int playercount;
  168. if(!netgame)
  169. {
  170. gametype = SINGLE;
  171. time = leveltime/35;
  172. hours = time/3600;
  173. time -= hours*3600;
  174. minutes = time/60;
  175. time -= minutes*60;
  176. seconds = time;
  177. }
  178. else if(netgame && !deathmatch)
  179. {
  180. gametype = COOPERATIVE;
  181. memset(killPercent, 0, MAXPLAYERS*sizeof(int));
  182. memset(bonusPercent, 0, MAXPLAYERS*sizeof(int));
  183. memset(secretPercent, 0, MAXPLAYERS*sizeof(int));
  184. for(i=0; i<MAXPLAYERS; i++)
  185. {
  186. if(playeringame[i])
  187. {
  188. if(totalkills)
  189. {
  190. killPercent[i] = players[i].killcount*100/totalkills;
  191. }
  192. if(totalitems)
  193. {
  194. bonusPercent[i] = players[i].itemcount*100/totalitems;
  195. }
  196. if(totalsecret)
  197. {
  198. secretPercent[i] = players[i].secretcount*100/totalsecret;
  199. }
  200. }
  201. }
  202. }
  203. else
  204. {
  205. gametype = DEATHMATCH;
  206. slaughterboy = 0;
  207. slaughterfrags = -9999;
  208. posnum = 0;
  209. playercount = 0;
  210. slaughtercount = 0;
  211. for(i=0; i<MAXPLAYERS; i++)
  212. {
  213. totalFrags[i] = 0;
  214. if(playeringame[i])
  215. {
  216. playercount++;
  217. for(j=0; j<MAXPLAYERS; j++)
  218. {
  219. if(playeringame[j])
  220. {
  221. totalFrags[i] += players[i].frags[j];
  222. }
  223. }
  224. dSlideX[i] = (43*posnum*FRACUNIT)/20;
  225. dSlideY[i] = (36*posnum*FRACUNIT)/20;
  226. posnum++;
  227. }
  228. if(totalFrags[i] > slaughterfrags)
  229. {
  230. slaughterboy = 1<<i;
  231. slaughterfrags = totalFrags[i];
  232. slaughtercount = 1;
  233. }
  234. else if(totalFrags[i] == slaughterfrags)
  235. {
  236. slaughterboy |= 1<<i;
  237. slaughtercount++;
  238. }
  239. }
  240. if(playercount == slaughtercount)
  241. { // don't do the slaughter stuff if everyone is equal
  242. slaughterboy = 0;
  243. }
  244. }
  245. }
  246. //========================================================================
  247. //
  248. // IN_LoadPics
  249. //
  250. //========================================================================
  251. void IN_LoadPics(void)
  252. {
  253. int i;
  254. switch(gameepisode)
  255. {
  256. case 1:
  257. patchINTERPIC = W_CacheLumpName("MAPE1", PU_STATIC);
  258. break;
  259. case 2:
  260. patchINTERPIC = W_CacheLumpName("MAPE2", PU_STATIC);
  261. break;
  262. case 3:
  263. patchINTERPIC = W_CacheLumpName("MAPE3", PU_STATIC);
  264. break;
  265. default:
  266. break;
  267. }
  268. patchBEENTHERE = W_CacheLumpName("IN_X", PU_STATIC);
  269. patchGOINGTHERE = W_CacheLumpName("IN_YAH", PU_STATIC);
  270. FontBLumpBase = W_GetNumForName("FONTB16");
  271. for(i=0; i<10; i++)
  272. {
  273. FontBNumbers[i] = W_CacheLumpNum(FontBLumpBase+i, PU_STATIC);
  274. }
  275. FontBLump = W_GetNumForName("FONTB_S")+1;
  276. FontBNegative = W_CacheLumpName("FONTB13", PU_STATIC);
  277. FontBSlash = W_CacheLumpName("FONTB15", PU_STATIC);
  278. FontBPercent = W_CacheLumpName("FONTB05", PU_STATIC);
  279. patchFaceOkayBase = W_GetNumForName("FACEA0");
  280. patchFaceDeadBase = W_GetNumForName("FACEB0");
  281. }
  282. //========================================================================
  283. //
  284. // IN_UnloadPics
  285. //
  286. //========================================================================
  287. void IN_UnloadPics(void)
  288. {
  289. int i;
  290. if(patchINTERPIC)
  291. {
  292. Z_ChangeTag(patchINTERPIC, PU_CACHE);
  293. }
  294. Z_ChangeTag(patchBEENTHERE, PU_CACHE);
  295. Z_ChangeTag(patchGOINGTHERE, PU_CACHE);
  296. for(i=0; i<10; i++)
  297. {
  298. Z_ChangeTag(FontBNumbers[i], PU_CACHE);
  299. }
  300. Z_ChangeTag(FontBNegative, PU_CACHE);
  301. Z_ChangeTag(FontBSlash, PU_CACHE);
  302. Z_ChangeTag(FontBPercent, PU_CACHE);
  303. }
  304. //========================================================================
  305. //
  306. // IN_Ticker
  307. //
  308. //========================================================================
  309. void IN_Ticker(void)
  310. {
  311. if(!intermission)
  312. {
  313. return;
  314. }
  315. if(interstate == 3)
  316. {
  317. IN_WaitStop();
  318. return;
  319. }
  320. IN_CheckForSkip();
  321. intertime++;
  322. if(oldintertime < intertime)
  323. {
  324. interstate++;
  325. switch(interstate)
  326. {
  327. case 0:
  328. oldintertime = intertime+300;
  329. break;
  330. case 1:
  331. oldintertime = intertime+200;
  332. break;
  333. case 2:
  334. oldintertime = MAXINT;
  335. break;
  336. case 3:
  337. cnt = 10;
  338. break;
  339. default:
  340. break;
  341. }
  342. }
  343. if(skipintermission)
  344. {
  345. if(interstate == 0 && intertime < 150)
  346. {
  347. intertime = 150;
  348. skipintermission = false;
  349. return;
  350. }
  351. else if(interstate < 2 && gameepisode < 4)
  352. {
  353. interstate = 2;
  354. skipintermission = false;
  355. return;
  356. }
  357. interstate = 3;
  358. cnt = 10;
  359. skipintermission = false;
  360. S_StartSound(NULL, sfx_dorcls);
  361. }
  362. }
  363. //========================================================================
  364. //
  365. // IN_CheckForSkip
  366. //
  367. // Check to see if any player hit a key
  368. //========================================================================
  369. void IN_CheckForSkip(void)
  370. {
  371. int i;
  372. player_t *player;
  373. for (i=0, player = players ; i<MAXPLAYERS ; i++, player++)
  374. {
  375. if (playeringame[i])
  376. {
  377. if (player->cmd.buttons&BT_ATTACK)
  378. {
  379. if (!player->attackdown)
  380. {
  381. skipintermission = 1;
  382. }
  383. player->attackdown = true;
  384. }
  385. else
  386. {
  387. player->attackdown = false;
  388. }
  389. if (player->cmd.buttons&BT_USE)
  390. {
  391. if (!player->usedown)
  392. {
  393. skipintermission = 1;
  394. }
  395. player->usedown = true;
  396. }
  397. else
  398. {
  399. player->usedown = false;
  400. }
  401. }
  402. }
  403. }
  404. //========================================================================
  405. //
  406. // IN_Drawer
  407. //
  408. //========================================================================
  409. void IN_Drawer(void)
  410. {
  411. static int oldinterstate;
  412. if(!intermission)
  413. {
  414. return;
  415. }
  416. if(interstate == 3)
  417. {
  418. return;
  419. }
  420. UpdateState |= I_FULLSCRN;
  421. if(oldinterstate != 2 && interstate == 2)
  422. {
  423. S_StartSound(NULL, sfx_pstop);
  424. }
  425. oldinterstate = interstate;
  426. switch(interstate)
  427. {
  428. case 0: // draw stats
  429. IN_DrawStatBack();
  430. switch(gametype)
  431. {
  432. case SINGLE:
  433. IN_DrawSingleStats();
  434. break;
  435. case COOPERATIVE:
  436. IN_DrawCoopStats();
  437. break;
  438. case DEATHMATCH:
  439. IN_DrawDMStats();
  440. break;
  441. }
  442. break;
  443. case 1: // leaving old level
  444. if(gameepisode < 4)
  445. {
  446. V_DrawPatch(0, 0, patchINTERPIC);
  447. IN_DrawOldLevel();
  448. }
  449. break;
  450. case 2: // going to the next level
  451. if(gameepisode < 4)
  452. {
  453. V_DrawPatch(0, 0, patchINTERPIC);
  454. IN_DrawYAH();
  455. }
  456. break;
  457. case 3: // waiting before going to the next level
  458. if(gameepisode < 4)
  459. {
  460. V_DrawPatch(0, 0, patchINTERPIC);
  461. }
  462. break;
  463. default:
  464. I_Error("IN_lude: Intermission state out of range.\n");
  465. break;
  466. }
  467. }
  468. //========================================================================
  469. //
  470. // IN_DrawStatBack
  471. //
  472. //========================================================================
  473. void IN_DrawStatBack(void)
  474. {
  475. int x;
  476. int y;
  477. byte *src;
  478. byte *dest;
  479. src = W_CacheLumpName ("FLOOR16", PU_CACHE);
  480. dest = screen;
  481. for (y=0 ; y<SCREENHEIGHT ; y++)
  482. {
  483. for (x=0 ; x<SCREENWIDTH/64 ; x++)
  484. {
  485. memcpy (dest, src+((y&63)<<6), 64);
  486. dest += 64;
  487. }
  488. if (SCREENWIDTH&63)
  489. {
  490. memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
  491. dest += (SCREENWIDTH&63);
  492. }
  493. }
  494. }
  495. //========================================================================
  496. //
  497. // IN_DrawOldLevel
  498. //
  499. //========================================================================
  500. void IN_DrawOldLevel(void)
  501. {
  502. int i;
  503. int x;
  504. x = 160-MN_TextBWidth(LevelNames[(gameepisode-1)*9+prevmap-1]+7)/2;
  505. IN_DrTextB(LevelNames[(gameepisode-1)*9+prevmap-1]+7, x, 3);
  506. x = 160-MN_TextAWidth("FINISHED")/2;
  507. MN_DrTextA("FINISHED", x, 25);
  508. if(prevmap == 9)
  509. {
  510. for(i=0; i<gamemap-1; i++)
  511. {
  512. V_DrawPatch(YAHspot[gameepisode-1][i].x, YAHspot[gameepisode-1][i].y,
  513. patchBEENTHERE);
  514. }
  515. if(!(intertime&16))
  516. {
  517. V_DrawPatch(YAHspot[gameepisode-1][8].x, YAHspot[gameepisode-1][8].y,
  518. patchBEENTHERE);
  519. }
  520. }
  521. else
  522. {
  523. for(i=0; i<prevmap-1; i++)
  524. {
  525. V_DrawPatch(YAHspot[gameepisode-1][i].x, YAHspot[gameepisode-1][i].y,
  526. patchBEENTHERE);
  527. }
  528. if(players[consoleplayer].didsecret)
  529. {
  530. V_DrawPatch(YAHspot[gameepisode-1][8].x, YAHspot[gameepisode-1][8].y,
  531. patchBEENTHERE);
  532. }
  533. if(!(intertime&16))
  534. {
  535. V_DrawPatch(YAHspot[gameepisode-1][prevmap-1].x, YAHspot[gameepisode-1][prevmap-1].y,
  536. patchBEENTHERE);
  537. }
  538. }
  539. }
  540. //========================================================================
  541. //
  542. // IN_DrawYAH
  543. //
  544. //========================================================================
  545. void IN_DrawYAH(void)
  546. {
  547. int i;
  548. int x;
  549. x = 160-MN_TextAWidth("NOW ENTERING:")/2;
  550. MN_DrTextA("NOW ENTERING:", x, 10);
  551. x = 160-MN_TextBWidth(LevelNames[(gameepisode-1)*9+gamemap-1]+7)/2;
  552. IN_DrTextB(LevelNames[(gameepisode-1)*9+gamemap-1]+7, x, 20);
  553. if(prevmap == 9)
  554. {
  555. prevmap = gamemap-1;
  556. }
  557. for(i=0; i<prevmap; i++)
  558. {
  559. V_DrawPatch(YAHspot[gameepisode-1][i].x, YAHspot[gameepisode-1][i].y,
  560. patchBEENTHERE);
  561. }
  562. if(players[consoleplayer].didsecret)
  563. {
  564. V_DrawPatch(YAHspot[gameepisode-1][8].x, YAHspot[gameepisode-1][8].y,
  565. patchBEENTHERE);
  566. }
  567. if(!(intertime&16) || interstate == 3)
  568. { // draw the destination 'X'
  569. V_DrawPatch(YAHspot[gameepisode-1][gamemap-1].x,
  570. YAHspot[gameepisode-1][gamemap-1].y, patchGOINGTHERE);
  571. }
  572. }
  573. //========================================================================
  574. //
  575. // IN_DrawSingleStats
  576. //
  577. //========================================================================
  578. void IN_DrawSingleStats(void)
  579. {
  580. int x;
  581. static int sounds;
  582. IN_DrTextB("KILLS", 50, 65);
  583. IN_DrTextB("ITEMS", 50, 90);
  584. IN_DrTextB("SECRETS", 50, 115);
  585. x = 160-MN_TextBWidth(LevelNames[(gameepisode-1)*9+prevmap-1]+7)/2;
  586. IN_DrTextB(LevelNames[(gameepisode-1)*9+prevmap-1]+7, x, 3);
  587. x = 160-MN_TextAWidth("FINISHED")/2;
  588. MN_DrTextA("FINISHED", x, 25);
  589. if(intertime < 30)
  590. {
  591. sounds = 0;
  592. return;
  593. }
  594. if(sounds < 1 && intertime >= 30)
  595. {
  596. S_StartSound(NULL, sfx_dorcls);
  597. sounds++;
  598. }
  599. IN_DrawNumber(players[consoleplayer].killcount, 200, 65, 3);
  600. V_DrawShadowedPatch(237, 65, FontBSlash);
  601. IN_DrawNumber(totalkills, 248, 65, 3);
  602. if(intertime < 60)
  603. {
  604. return;
  605. }
  606. if(sounds < 2 && intertime >= 60)
  607. {
  608. S_StartSound(NULL, sfx_dorcls);
  609. sounds++;
  610. }
  611. IN_DrawNumber(players[consoleplayer].itemcount, 200, 90, 3);
  612. V_DrawShadowedPatch(237, 90, FontBSlash);
  613. IN_DrawNumber(totalitems, 248, 90, 3);
  614. if(intertime < 90)
  615. {
  616. return;
  617. }
  618. if(sounds < 3 && intertime >= 90)
  619. {
  620. S_StartSound(NULL, sfx_dorcls);
  621. sounds++;
  622. }
  623. IN_DrawNumber(players[consoleplayer].secretcount, 200, 115, 3);
  624. V_DrawShadowedPatch(237, 115, FontBSlash);
  625. IN_DrawNumber(totalsecret, 248, 115, 3);
  626. if(intertime < 150)
  627. {
  628. return;
  629. }
  630. if(sounds < 4 && intertime >= 150)
  631. {
  632. S_StartSound(NULL, sfx_dorcls);
  633. sounds++;
  634. }
  635. if(!ExtendedWAD || gameepisode < 4)
  636. {
  637. IN_DrTextB("TIME", 85, 160);
  638. IN_DrawTime(155, 160, hours, minutes, seconds);
  639. }
  640. else
  641. {
  642. x = 160-MN_TextAWidth("NOW ENTERING:")/2;
  643. MN_DrTextA("NOW ENTERING:", x, 160);
  644. x = 160-MN_TextBWidth(LevelNames[(gameepisode-1)*9+gamemap-1]+7)/2;
  645. IN_DrTextB(LevelNames[(gameepisode-1)*9+gamemap-1]+7, x, 170);
  646. skipintermission = false;
  647. }
  648. }
  649. //========================================================================
  650. //
  651. // IN_DrawCoopStats
  652. //
  653. //========================================================================
  654. void IN_DrawCoopStats(void)
  655. {
  656. int i;
  657. int x;
  658. int ypos;
  659. static int sounds;
  660. IN_DrTextB("KILLS", 95, 35);
  661. IN_DrTextB("BONUS", 155, 35);
  662. IN_DrTextB("SECRET", 232, 35);
  663. x = 160-MN_TextBWidth(LevelNames[(gameepisode-1)*9+prevmap-1]+7)/2;
  664. IN_DrTextB(LevelNames[(gameepisode-1)*9+prevmap-1]+7, x, 3);
  665. x = 160-MN_TextAWidth("FINISHED")/2;
  666. MN_DrTextA("FINISHED", x, 25);
  667. ypos = 50;
  668. for(i=0; i<MAXPLAYERS; i++)
  669. {
  670. if(playeringame[i])
  671. {
  672. V_DrawShadowedPatch(25, ypos, W_CacheLumpNum(patchFaceOkayBase+i, PU_CACHE));
  673. if(intertime < 40)
  674. {
  675. sounds = 0;
  676. ypos += 37;
  677. continue;
  678. }
  679. else if(intertime >= 40 && sounds < 1)
  680. {
  681. S_StartSound(NULL, sfx_dorcls);
  682. sounds++;
  683. }
  684. IN_DrawNumber(killPercent[i], 85, ypos+10, 3);
  685. V_DrawShadowedPatch(121, ypos+10, FontBPercent);
  686. IN_DrawNumber(bonusPercent[i], 160, ypos+10, 3);
  687. V_DrawShadowedPatch(196, ypos+10, FontBPercent);
  688. IN_DrawNumber(secretPercent[i], 237, ypos+10, 3);
  689. V_DrawShadowedPatch(273, ypos+10, FontBPercent);
  690. ypos += 37;
  691. }
  692. }
  693. }
  694. //========================================================================
  695. //
  696. // IN_DrawDMStats
  697. //
  698. //========================================================================
  699. void IN_DrawDMStats(void)
  700. {
  701. int i;
  702. int j;
  703. int ypos;
  704. int xpos;
  705. int kpos;
  706. static int sounds;
  707. xpos = 90;
  708. ypos = 55;
  709. IN_DrTextB("TOTAL", 265, 30);
  710. MN_DrTextA("VICTIMS", 140, 8);
  711. for(i=0; i<7; i++)
  712. {
  713. MN_DrTextA(KillersText[i], 10, 80+9*i);
  714. }
  715. if(intertime < 20)
  716. {
  717. for(i=0; i<MAXPLAYERS; i++)
  718. {
  719. if(playeringame[i])
  720. {
  721. V_DrawShadowedPatch(40, ((ypos<<FRACBITS)+dSlideY[i]*intertime)
  722. >>FRACBITS, W_CacheLumpNum(patchFaceOkayBase+i, PU_CACHE));
  723. V_DrawShadowedPatch(((xpos<<FRACBITS)+dSlideX[i]*intertime)
  724. >>FRACBITS, 18, W_CacheLumpNum(patchFaceDeadBase+i, PU_CACHE));
  725. }
  726. }
  727. sounds = 0;
  728. return;
  729. }
  730. if(intertime >= 20 && sounds < 1)
  731. {
  732. S_StartSound(NULL, sfx_dorcls);
  733. sounds++;
  734. }
  735. if(intertime >= 100 && slaughterboy && sounds < 2)
  736. {
  737. S_StartSound(NULL, sfx_wpnup);
  738. sounds++;
  739. }
  740. for(i=0; i<MAXPLAYERS; i++)
  741. {
  742. if(playeringame[i])
  743. {
  744. if(intertime < 100 || i == consoleplayer)
  745. {
  746. V_DrawShadowedPatch(40, ypos, W_CacheLumpNum(patchFaceOkayBase+i, PU_CACHE));
  747. V_DrawShadowedPatch(xpos, 18, W_CacheLumpNum(patchFaceDeadBase+i, PU_CACHE));
  748. }
  749. else
  750. {
  751. V_DrawFuzzPatch(40, ypos, W_CacheLumpNum(patchFaceOkayBase+i, PU_CACHE));
  752. V_DrawFuzzPatch(xpos, 18, W_CacheLumpNum(patchFaceDeadBase+i, PU_CACHE));
  753. }
  754. kpos = 86;
  755. for(j=0; j<MAXPLAYERS; j++)
  756. {
  757. if(playeringame[j])
  758. {
  759. IN_DrawNumber(players[i].frags[j], kpos, ypos+10, 3);
  760. kpos += 43;
  761. }
  762. }
  763. if(slaughterboy&(1<<i))
  764. {
  765. if(!(intertime&16))
  766. {
  767. IN_DrawNumber(totalFrags[i], 263, ypos+10, 3);
  768. }
  769. }
  770. else
  771. {
  772. IN_DrawNumber(totalFrags[i], 263, ypos+10, 3);
  773. }
  774. ypos += 36;
  775. xpos += 43;
  776. }
  777. }
  778. }
  779. //========================================================================
  780. //
  781. // IN_DrawTime
  782. //
  783. //========================================================================
  784. void IN_DrawTime(int x, int y, int h, int m, int s)
  785. {
  786. if(h)
  787. {
  788. IN_DrawNumber(h, x, y, 2);
  789. IN_DrTextB(":", x+26, y);
  790. }
  791. x += 34;
  792. if(m || h)
  793. {
  794. IN_DrawNumber(m, x, y, 2);
  795. }
  796. x += 34;
  797. if(s)
  798. {
  799. IN_DrTextB(":", x-8, y);
  800. IN_DrawNumber(s, x, y, 2);
  801. }
  802. }
  803. //========================================================================
  804. //
  805. // IN_DrawNumber
  806. //
  807. //========================================================================
  808. void IN_DrawNumber(int val, int x, int y, int digits)
  809. {
  810. patch_t *patch;
  811. int xpos;
  812. int oldval;
  813. int realdigits;
  814. boolean neg;
  815. oldval = val;
  816. xpos = x;
  817. neg = false;
  818. realdigits = 1;
  819. if(val < 0)
  820. { //...this should reflect negative frags
  821. val = -val;
  822. neg = true;
  823. if(val > 99)
  824. {
  825. val = 99;
  826. }
  827. }
  828. if(val > 9)
  829. {
  830. realdigits++;
  831. if(digits < realdigits)
  832. {
  833. realdigits = digits;
  834. val = 9;
  835. }
  836. }
  837. if(val > 99)
  838. {
  839. realdigits++;
  840. if(digits < realdigits)
  841. {
  842. realdigits = digits;
  843. val = 99;
  844. }
  845. }
  846. if(val > 999)
  847. {
  848. realdigits++;
  849. if(digits < realdigits)
  850. {
  851. realdigits = digits;
  852. val = 999;
  853. }
  854. }
  855. if(digits == 4)
  856. {
  857. patch = FontBNumbers[val/1000];
  858. V_DrawShadowedPatch(xpos+6-patch->width/2-12, y, patch);
  859. }
  860. if(digits > 2)
  861. {
  862. if(realdigits > 2)
  863. {
  864. patch = FontBNumbers[val/100];
  865. V_DrawShadowedPatch(xpos+6-patch->width/2, y, patch);
  866. }
  867. xpos += 12;
  868. }
  869. val = val%100;
  870. if(digits > 1)
  871. {
  872. if(val > 9)
  873. {
  874. patch = FontBNumbers[val/10];
  875. V_DrawShadowedPatch(xpos+6-patch->width/2, y, patch);
  876. }
  877. else if(digits == 2 || oldval > 99)
  878. {
  879. V_DrawShadowedPatch(xpos, y, FontBNumbers[0]);
  880. }
  881. xpos += 12;
  882. }
  883. val = val%10;
  884. patch = FontBNumbers[val];
  885. V_DrawShadowedPatch(xpos+6-patch->width/2, y, patch);
  886. if(neg)
  887. {
  888. patch = FontBNegative;
  889. V_DrawShadowedPatch(xpos+6-patch->width/2-12*(realdigits), y, patch);
  890. }
  891. }
  892. //========================================================================
  893. //
  894. // IN_DrTextB
  895. //
  896. //========================================================================
  897. void IN_DrTextB(char *text, int x, int y)
  898. {
  899. char c;
  900. patch_t *p;
  901. while((c = *text++) != 0)
  902. {
  903. if(c < 33)
  904. {
  905. x += 8;
  906. }
  907. else
  908. {
  909. p = W_CacheLumpNum(FontBLump+c-33, PU_CACHE);
  910. V_DrawShadowedPatch(x, y, p);
  911. x += p->width-1;
  912. }
  913. }
  914. }