hu_stuff.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. // Emacs style mode select -*- C++ -*-
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // $Log:$
  18. //
  19. // DESCRIPTION: Heads-up displays
  20. //
  21. //-----------------------------------------------------------------------------
  22. static const char
  23. rcsid[] = "$Id: hu_stuff.c,v 1.4 1997/02/03 16:47:52 b1 Exp $";
  24. #include <ctype.h>
  25. #include "doomdef.h"
  26. #include "z_zone.h"
  27. #include "m_swap.h"
  28. #include "hu_stuff.h"
  29. #include "hu_lib.h"
  30. #include "w_wad.h"
  31. #include "s_sound.h"
  32. #include "doomstat.h"
  33. // Data.
  34. #include "dstrings.h"
  35. #include "sounds.h"
  36. //
  37. // Locally used constants, shortcuts.
  38. //
  39. #define HU_TITLE (mapnames[(gameepisode-1)*9+gamemap-1])
  40. #define HU_TITLE2 (mapnames2[gamemap-1])
  41. #define HU_TITLEP (mapnamesp[gamemap-1])
  42. #define HU_TITLET (mapnamest[gamemap-1])
  43. #define HU_TITLEHEIGHT 1
  44. #define HU_TITLEX 0
  45. #define HU_TITLEY (167 - SHORT(hu_font[0]->height))
  46. #define HU_INPUTTOGGLE 't'
  47. #define HU_INPUTX HU_MSGX
  48. #define HU_INPUTY (HU_MSGY + HU_MSGHEIGHT*(SHORT(hu_font[0]->height) +1))
  49. #define HU_INPUTWIDTH 64
  50. #define HU_INPUTHEIGHT 1
  51. char* chat_macros[] =
  52. {
  53. HUSTR_CHATMACRO0,
  54. HUSTR_CHATMACRO1,
  55. HUSTR_CHATMACRO2,
  56. HUSTR_CHATMACRO3,
  57. HUSTR_CHATMACRO4,
  58. HUSTR_CHATMACRO5,
  59. HUSTR_CHATMACRO6,
  60. HUSTR_CHATMACRO7,
  61. HUSTR_CHATMACRO8,
  62. HUSTR_CHATMACRO9
  63. };
  64. char* player_names[] =
  65. {
  66. HUSTR_PLRGREEN,
  67. HUSTR_PLRINDIGO,
  68. HUSTR_PLRBROWN,
  69. HUSTR_PLRRED
  70. };
  71. char chat_char; // remove later.
  72. static player_t* plr;
  73. patch_t* hu_font[HU_FONTSIZE];
  74. static hu_textline_t w_title;
  75. boolean chat_on;
  76. static hu_itext_t w_chat;
  77. static boolean always_off = false;
  78. static char chat_dest[MAXPLAYERS];
  79. static hu_itext_t w_inputbuffer[MAXPLAYERS];
  80. static boolean message_on;
  81. boolean message_dontfuckwithme;
  82. static boolean message_nottobefuckedwith;
  83. static hu_stext_t w_message;
  84. static int message_counter;
  85. extern int showMessages;
  86. extern boolean automapactive;
  87. static boolean headsupactive = false;
  88. //
  89. // Builtin map names.
  90. // The actual names can be found in DStrings.h.
  91. //
  92. char* mapnames[] = // DOOM shareware/registered/retail (Ultimate) names.
  93. {
  94. HUSTR_E1M1,
  95. HUSTR_E1M2,
  96. HUSTR_E1M3,
  97. HUSTR_E1M4,
  98. HUSTR_E1M5,
  99. HUSTR_E1M6,
  100. HUSTR_E1M7,
  101. HUSTR_E1M8,
  102. HUSTR_E1M9,
  103. HUSTR_E2M1,
  104. HUSTR_E2M2,
  105. HUSTR_E2M3,
  106. HUSTR_E2M4,
  107. HUSTR_E2M5,
  108. HUSTR_E2M6,
  109. HUSTR_E2M7,
  110. HUSTR_E2M8,
  111. HUSTR_E2M9,
  112. HUSTR_E3M1,
  113. HUSTR_E3M2,
  114. HUSTR_E3M3,
  115. HUSTR_E3M4,
  116. HUSTR_E3M5,
  117. HUSTR_E3M6,
  118. HUSTR_E3M7,
  119. HUSTR_E3M8,
  120. HUSTR_E3M9,
  121. HUSTR_E4M1,
  122. HUSTR_E4M2,
  123. HUSTR_E4M3,
  124. HUSTR_E4M4,
  125. HUSTR_E4M5,
  126. HUSTR_E4M6,
  127. HUSTR_E4M7,
  128. HUSTR_E4M8,
  129. HUSTR_E4M9,
  130. "NEWLEVEL",
  131. "NEWLEVEL",
  132. "NEWLEVEL",
  133. "NEWLEVEL",
  134. "NEWLEVEL",
  135. "NEWLEVEL",
  136. "NEWLEVEL",
  137. "NEWLEVEL",
  138. "NEWLEVEL"
  139. };
  140. char* mapnames2[] = // DOOM 2 map names.
  141. {
  142. HUSTR_1,
  143. HUSTR_2,
  144. HUSTR_3,
  145. HUSTR_4,
  146. HUSTR_5,
  147. HUSTR_6,
  148. HUSTR_7,
  149. HUSTR_8,
  150. HUSTR_9,
  151. HUSTR_10,
  152. HUSTR_11,
  153. HUSTR_12,
  154. HUSTR_13,
  155. HUSTR_14,
  156. HUSTR_15,
  157. HUSTR_16,
  158. HUSTR_17,
  159. HUSTR_18,
  160. HUSTR_19,
  161. HUSTR_20,
  162. HUSTR_21,
  163. HUSTR_22,
  164. HUSTR_23,
  165. HUSTR_24,
  166. HUSTR_25,
  167. HUSTR_26,
  168. HUSTR_27,
  169. HUSTR_28,
  170. HUSTR_29,
  171. HUSTR_30,
  172. HUSTR_31,
  173. HUSTR_32
  174. };
  175. char* mapnamesp[] = // Plutonia WAD map names.
  176. {
  177. PHUSTR_1,
  178. PHUSTR_2,
  179. PHUSTR_3,
  180. PHUSTR_4,
  181. PHUSTR_5,
  182. PHUSTR_6,
  183. PHUSTR_7,
  184. PHUSTR_8,
  185. PHUSTR_9,
  186. PHUSTR_10,
  187. PHUSTR_11,
  188. PHUSTR_12,
  189. PHUSTR_13,
  190. PHUSTR_14,
  191. PHUSTR_15,
  192. PHUSTR_16,
  193. PHUSTR_17,
  194. PHUSTR_18,
  195. PHUSTR_19,
  196. PHUSTR_20,
  197. PHUSTR_21,
  198. PHUSTR_22,
  199. PHUSTR_23,
  200. PHUSTR_24,
  201. PHUSTR_25,
  202. PHUSTR_26,
  203. PHUSTR_27,
  204. PHUSTR_28,
  205. PHUSTR_29,
  206. PHUSTR_30,
  207. PHUSTR_31,
  208. PHUSTR_32
  209. };
  210. char *mapnamest[] = // TNT WAD map names.
  211. {
  212. THUSTR_1,
  213. THUSTR_2,
  214. THUSTR_3,
  215. THUSTR_4,
  216. THUSTR_5,
  217. THUSTR_6,
  218. THUSTR_7,
  219. THUSTR_8,
  220. THUSTR_9,
  221. THUSTR_10,
  222. THUSTR_11,
  223. THUSTR_12,
  224. THUSTR_13,
  225. THUSTR_14,
  226. THUSTR_15,
  227. THUSTR_16,
  228. THUSTR_17,
  229. THUSTR_18,
  230. THUSTR_19,
  231. THUSTR_20,
  232. THUSTR_21,
  233. THUSTR_22,
  234. THUSTR_23,
  235. THUSTR_24,
  236. THUSTR_25,
  237. THUSTR_26,
  238. THUSTR_27,
  239. THUSTR_28,
  240. THUSTR_29,
  241. THUSTR_30,
  242. THUSTR_31,
  243. THUSTR_32
  244. };
  245. const char* shiftxform;
  246. const char french_shiftxform[] =
  247. {
  248. 0,
  249. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
  250. 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
  251. 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
  252. 31,
  253. ' ', '!', '"', '#', '$', '%', '&',
  254. '"', // shift-'
  255. '(', ')', '*', '+',
  256. '?', // shift-,
  257. '_', // shift--
  258. '>', // shift-.
  259. '?', // shift-/
  260. '0', // shift-0
  261. '1', // shift-1
  262. '2', // shift-2
  263. '3', // shift-3
  264. '4', // shift-4
  265. '5', // shift-5
  266. '6', // shift-6
  267. '7', // shift-7
  268. '8', // shift-8
  269. '9', // shift-9
  270. '/',
  271. '.', // shift-;
  272. '<',
  273. '+', // shift-=
  274. '>', '?', '@',
  275. 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
  276. 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  277. '[', // shift-[
  278. '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
  279. ']', // shift-]
  280. '"', '_',
  281. '\'', // shift-`
  282. 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
  283. 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  284. '{', '|', '}', '~', 127
  285. };
  286. const char english_shiftxform[] =
  287. {
  288. 0,
  289. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
  290. 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
  291. 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
  292. 31,
  293. ' ', '!', '"', '#', '$', '%', '&',
  294. '"', // shift-'
  295. '(', ')', '*', '+',
  296. '<', // shift-,
  297. '_', // shift--
  298. '>', // shift-.
  299. '?', // shift-/
  300. ')', // shift-0
  301. '!', // shift-1
  302. '@', // shift-2
  303. '#', // shift-3
  304. '$', // shift-4
  305. '%', // shift-5
  306. '^', // shift-6
  307. '&', // shift-7
  308. '*', // shift-8
  309. '(', // shift-9
  310. ':',
  311. ':', // shift-;
  312. '<',
  313. '+', // shift-=
  314. '>', '?', '@',
  315. 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
  316. 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  317. '[', // shift-[
  318. '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
  319. ']', // shift-]
  320. '"', '_',
  321. '\'', // shift-`
  322. 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
  323. 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  324. '{', '|', '}', '~', 127
  325. };
  326. char frenchKeyMap[128]=
  327. {
  328. 0,
  329. 1,2,3,4,5,6,7,8,9,10,
  330. 11,12,13,14,15,16,17,18,19,20,
  331. 21,22,23,24,25,26,27,28,29,30,
  332. 31,
  333. ' ','!','"','#','$','%','&','%','(',')','*','+',';','-',':','!',
  334. '0','1','2','3','4','5','6','7','8','9',':','M','<','=','>','?',
  335. '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
  336. 'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^','_',
  337. '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
  338. 'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^',127
  339. };
  340. char ForeignTranslation(unsigned char ch)
  341. {
  342. return ch < 128 ? frenchKeyMap[ch] : ch;
  343. }
  344. void HU_Init(void)
  345. {
  346. int i;
  347. int j;
  348. char buffer[9];
  349. if (french)
  350. shiftxform = french_shiftxform;
  351. else
  352. shiftxform = english_shiftxform;
  353. // load the heads-up font
  354. j = HU_FONTSTART;
  355. for (i=0;i<HU_FONTSIZE;i++)
  356. {
  357. sprintf(buffer, "STCFN%.3d", j++);
  358. hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC);
  359. }
  360. }
  361. void HU_Stop(void)
  362. {
  363. headsupactive = false;
  364. }
  365. void HU_Start(void)
  366. {
  367. int i;
  368. char* s;
  369. if (headsupactive)
  370. HU_Stop();
  371. plr = &players[consoleplayer];
  372. message_on = false;
  373. message_dontfuckwithme = false;
  374. message_nottobefuckedwith = false;
  375. chat_on = false;
  376. // create the message widget
  377. HUlib_initSText(&w_message,
  378. HU_MSGX, HU_MSGY, HU_MSGHEIGHT,
  379. hu_font,
  380. HU_FONTSTART, &message_on);
  381. // create the map title widget
  382. HUlib_initTextLine(&w_title,
  383. HU_TITLEX, HU_TITLEY,
  384. hu_font,
  385. HU_FONTSTART);
  386. switch ( gamemode )
  387. {
  388. case shareware:
  389. case registered:
  390. case retail:
  391. s = HU_TITLE;
  392. break;
  393. /* FIXME
  394. case pack_plut:
  395. s = HU_TITLEP;
  396. break;
  397. case pack_tnt:
  398. s = HU_TITLET;
  399. break;
  400. */
  401. case commercial:
  402. default:
  403. s = HU_TITLE2;
  404. break;
  405. }
  406. while (*s)
  407. HUlib_addCharToTextLine(&w_title, *(s++));
  408. // create the chat widget
  409. HUlib_initIText(&w_chat,
  410. HU_INPUTX, HU_INPUTY,
  411. hu_font,
  412. HU_FONTSTART, &chat_on);
  413. // create the inputbuffer widgets
  414. for (i=0 ; i<MAXPLAYERS ; i++)
  415. HUlib_initIText(&w_inputbuffer[i], 0, 0, 0, 0, &always_off);
  416. headsupactive = true;
  417. }
  418. void HU_Drawer(void)
  419. {
  420. HUlib_drawSText(&w_message);
  421. HUlib_drawIText(&w_chat);
  422. if (automapactive)
  423. HUlib_drawTextLine(&w_title, false);
  424. }
  425. void HU_Erase(void)
  426. {
  427. HUlib_eraseSText(&w_message);
  428. HUlib_eraseIText(&w_chat);
  429. HUlib_eraseTextLine(&w_title);
  430. }
  431. void HU_Ticker(void)
  432. {
  433. int i, rc;
  434. char c;
  435. // tick down message counter if message is up
  436. if (message_counter && !--message_counter)
  437. {
  438. message_on = false;
  439. message_nottobefuckedwith = false;
  440. }
  441. if (showMessages || message_dontfuckwithme)
  442. {
  443. // display message if necessary
  444. if ((plr->message && !message_nottobefuckedwith)
  445. || (plr->message && message_dontfuckwithme))
  446. {
  447. HUlib_addMessageToSText(&w_message, 0, plr->message);
  448. plr->message = 0;
  449. message_on = true;
  450. message_counter = HU_MSGTIMEOUT;
  451. message_nottobefuckedwith = message_dontfuckwithme;
  452. message_dontfuckwithme = 0;
  453. }
  454. } // else message_on = false;
  455. // check for incoming chat characters
  456. if (netgame)
  457. {
  458. for (i=0 ; i<MAXPLAYERS; i++)
  459. {
  460. if (!playeringame[i])
  461. continue;
  462. if (i != consoleplayer
  463. && (c = players[i].cmd.chatchar))
  464. {
  465. if (c <= HU_BROADCAST)
  466. chat_dest[i] = c;
  467. else
  468. {
  469. if (c >= 'a' && c <= 'z')
  470. c = (char) shiftxform[(unsigned char) c];
  471. rc = HUlib_keyInIText(&w_inputbuffer[i], c);
  472. if (rc && c == KEY_ENTER)
  473. {
  474. if (w_inputbuffer[i].l.len
  475. && (chat_dest[i] == consoleplayer+1
  476. || chat_dest[i] == HU_BROADCAST))
  477. {
  478. HUlib_addMessageToSText(&w_message,
  479. player_names[i],
  480. w_inputbuffer[i].l.l);
  481. message_nottobefuckedwith = true;
  482. message_on = true;
  483. message_counter = HU_MSGTIMEOUT;
  484. if ( gamemode == commercial )
  485. S_StartSound(0, sfx_radio);
  486. else
  487. S_StartSound(0, sfx_tink);
  488. }
  489. HUlib_resetIText(&w_inputbuffer[i]);
  490. }
  491. }
  492. players[i].cmd.chatchar = 0;
  493. }
  494. }
  495. }
  496. }
  497. #define QUEUESIZE 128
  498. static char chatchars[QUEUESIZE];
  499. static int head = 0;
  500. static int tail = 0;
  501. void HU_queueChatChar(char c)
  502. {
  503. if (((head + 1) & (QUEUESIZE-1)) == tail)
  504. {
  505. plr->message = HUSTR_MSGU;
  506. }
  507. else
  508. {
  509. chatchars[head] = c;
  510. head = (head + 1) & (QUEUESIZE-1);
  511. }
  512. }
  513. char HU_dequeueChatChar(void)
  514. {
  515. char c;
  516. if (head != tail)
  517. {
  518. c = chatchars[tail];
  519. tail = (tail + 1) & (QUEUESIZE-1);
  520. }
  521. else
  522. {
  523. c = 0;
  524. }
  525. return c;
  526. }
  527. boolean HU_Responder(event_t *ev)
  528. {
  529. static char lastmessage[HU_MAXLINELENGTH+1];
  530. char* macromessage;
  531. boolean eatkey = false;
  532. static boolean shiftdown = false;
  533. static boolean altdown = false;
  534. unsigned char c;
  535. int i;
  536. int numplayers;
  537. static char destination_keys[MAXPLAYERS] =
  538. {
  539. HUSTR_KEYGREEN,
  540. HUSTR_KEYINDIGO,
  541. HUSTR_KEYBROWN,
  542. HUSTR_KEYRED
  543. };
  544. static int num_nobrainers = 0;
  545. numplayers = 0;
  546. for (i=0 ; i<MAXPLAYERS ; i++)
  547. numplayers += playeringame[i];
  548. if (ev->data1 == KEY_RSHIFT)
  549. {
  550. shiftdown = ev->type == ev_keydown;
  551. return false;
  552. }
  553. else if (ev->data1 == KEY_RALT || ev->data1 == KEY_LALT)
  554. {
  555. altdown = ev->type == ev_keydown;
  556. return false;
  557. }
  558. if (ev->type != ev_keydown)
  559. return false;
  560. if (!chat_on)
  561. {
  562. if (ev->data1 == HU_MSGREFRESH)
  563. {
  564. message_on = true;
  565. message_counter = HU_MSGTIMEOUT;
  566. eatkey = true;
  567. }
  568. else if (netgame && ev->data1 == HU_INPUTTOGGLE)
  569. {
  570. eatkey = chat_on = true;
  571. HUlib_resetIText(&w_chat);
  572. HU_queueChatChar(HU_BROADCAST);
  573. }
  574. else if (netgame && numplayers > 2)
  575. {
  576. for (i=0; i<MAXPLAYERS ; i++)
  577. {
  578. if (ev->data1 == destination_keys[i])
  579. {
  580. if (playeringame[i] && i!=consoleplayer)
  581. {
  582. eatkey = chat_on = true;
  583. HUlib_resetIText(&w_chat);
  584. HU_queueChatChar(i+1);
  585. break;
  586. }
  587. else if (i == consoleplayer)
  588. {
  589. num_nobrainers++;
  590. if (num_nobrainers < 3)
  591. plr->message = HUSTR_TALKTOSELF1;
  592. else if (num_nobrainers < 6)
  593. plr->message = HUSTR_TALKTOSELF2;
  594. else if (num_nobrainers < 9)
  595. plr->message = HUSTR_TALKTOSELF3;
  596. else if (num_nobrainers < 32)
  597. plr->message = HUSTR_TALKTOSELF4;
  598. else
  599. plr->message = HUSTR_TALKTOSELF5;
  600. }
  601. }
  602. }
  603. }
  604. }
  605. else
  606. {
  607. c = ev->data1;
  608. // send a macro
  609. if (altdown)
  610. {
  611. c = c - '0';
  612. if (c > 9)
  613. return false;
  614. // fprintf(stderr, "got here\n");
  615. macromessage = chat_macros[c];
  616. // kill last message with a '\n'
  617. HU_queueChatChar(KEY_ENTER); // DEBUG!!!
  618. // send the macro message
  619. while (*macromessage)
  620. HU_queueChatChar(*macromessage++);
  621. HU_queueChatChar(KEY_ENTER);
  622. // leave chat mode and notify that it was sent
  623. chat_on = false;
  624. strcpy(lastmessage, chat_macros[c]);
  625. plr->message = lastmessage;
  626. eatkey = true;
  627. }
  628. else
  629. {
  630. if (french)
  631. c = ForeignTranslation(c);
  632. if (shiftdown || (c >= 'a' && c <= 'z'))
  633. c = shiftxform[c];
  634. eatkey = HUlib_keyInIText(&w_chat, c);
  635. if (eatkey)
  636. {
  637. // static unsigned char buf[20]; // DEBUG
  638. HU_queueChatChar(c);
  639. // sprintf(buf, "KEY: %d => %d", ev->data1, c);
  640. // plr->message = buf;
  641. }
  642. if (c == KEY_ENTER)
  643. {
  644. chat_on = false;
  645. if (w_chat.l.len)
  646. {
  647. strcpy(lastmessage, w_chat.l.l);
  648. plr->message = lastmessage;
  649. }
  650. }
  651. else if (c == KEY_ESCAPE)
  652. chat_on = false;
  653. }
  654. }
  655. return eatkey;
  656. }