home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / vmsnet / sources / games / 450 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  14.2 KB

  1. Path: sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!cs.ubc.ca!bcsystems!spruce.pfc.forestry.ca!news.u.washington.edu!raven.alaska.edu!acad2.alaska.edu!asdmf
  2. Newsgroups: vmsnet.sources.games
  3. Subject: Vmsnetrek 38/47
  4. Message-ID: <1992Nov20.203919.1@acad2.alaska.edu>
  5. From: asdmf@acad2.alaska.edu
  6. Date: Sat, 21 Nov 1992 00:39:19 GMT
  7. Sender: news@raven.alaska.edu (USENET News System)
  8. Organization: University of Alaska
  9. Nntp-Posting-Host: acad2.alaska.edu
  10. Lines: 628
  11.  
  12. -+-+-+-+-+-+-+-+ START OF PART 38 -+-+-+-+-+-+-+-+
  13. X    0.3599,
  14. X    0.3827,
  15. X    0.4052,
  16. X    0.4275,
  17. X    0.4496,
  18. X    0.4714,
  19. X    0.4929,
  20. X    0.5141,
  21. X    0.5350,
  22. X    0.5556,
  23. X    0.5758,
  24. X    0.5957,
  25. X    0.6152,
  26. X    0.6344,
  27. X    0.6532,
  28. X    0.6715,
  29. X    0.6895,
  30. X    0.7071,
  31. X    0.7242,
  32. X    0.7409,
  33. X    0.7572,
  34. X    0.7730,
  35. X    0.7883,
  36. X    0.8032,
  37. X    0.8176,
  38. X    0.8315,
  39. X    0.8448,
  40. X    0.8577,
  41. X    0.8701,
  42. X    0.8819,
  43. X    0.8932,
  44. X    0.9040,
  45. X    0.9142,
  46. X    0.9239,
  47. X    0.9330,
  48. X    0.9415,
  49. X    0.9495,
  50. X    0.9569,
  51. X    0.9638,
  52. X    0.9700,
  53. X    0.9757,
  54. X    0.9808,
  55. X    0.9853,
  56. X    0.9892,
  57. X    0.9925,
  58. X    0.9952,
  59. X    0.9973,
  60. X    0.9988,
  61. X    0.9997,
  62. X    1.0000,
  63. X    0.9997,
  64. X    0.9988,
  65. X    0.9973,
  66. X    0.9952,
  67. X    0.9925,
  68. X    0.9892,
  69. X    0.9853,
  70. X    0.9808,
  71. X    0.9757,
  72. X    0.9700,
  73. X    0.9638,
  74. X    0.9570,
  75. X    0.9495,
  76. X    0.9416,
  77. X    0.9330,
  78. X    0.9239,
  79. X    0.9142,
  80. X    0.9040,
  81. X    0.8933,
  82. X    0.8819,
  83. X    0.8701,
  84. X    0.8578,
  85. X    0.8449,
  86. X    0.8315,
  87. X    0.8176,
  88. X    0.8032,
  89. X    0.7884,
  90. X    0.7731,
  91. X    0.7573,
  92. X    0.7410,
  93. X    0.7243,
  94. X    0.7072,
  95. X    0.6896,
  96. X    0.6716,
  97. X    0.6532,
  98. X    0.6344,
  99. X    0.6153,
  100. X    0.5958,
  101. X    0.5759,
  102. X    0.5556,
  103. X    0.5351,
  104. X    0.5142,
  105. X    0.4930,
  106. X    0.4715,
  107. X    0.4497,
  108. X    0.4276,
  109. X    0.4053,
  110. X    0.3828,
  111. X    0.3600,
  112. X    0.3370,
  113. X    0.3138,
  114. X    0.2904,
  115. X    0.2668,
  116. X    0.2431,
  117. X    0.2192,
  118. X    0.1952,
  119. X    0.1710,
  120. X    0.1468,
  121. X    0.1225,
  122. X    0.0981,
  123. X    0.0737,
  124. X    0.0492,
  125. X    0.0246,
  126. X    0.0001,
  127. X    -0.0244,
  128. X    -0.0490,
  129. X    -0.0735,
  130. X    -0.0979,
  131. X    -0.1223,
  132. X    -0.1466,
  133. X    -0.1709,
  134. X    -0.1950,
  135. X    -0.2190,
  136. X    -0.2429,
  137. X    -0.2666,
  138. X    -0.2902,
  139. X    -0.3136,
  140. X    -0.3368,
  141. X    -0.3598,
  142. X    -0.3826,
  143. X    -0.4051,
  144. X    -0.4275,
  145. X    -0.4495,
  146. X    -0.4713,
  147. X    -0.4928,
  148. X    -0.5140,
  149. X    -0.5349,
  150. X    -0.5555,
  151. X    -0.5757,
  152. X    -0.5956,
  153. X    -0.6151,
  154. X    -0.6343,
  155. X    -0.6531,
  156. X    -0.6715,
  157. X    -0.6895,
  158. X    -0.7070,
  159. X    -0.7242,
  160. X    -0.7409,
  161. X    -0.7571,
  162. X    -0.7729,
  163. X    -0.7883,
  164. X    -0.8031,
  165. X    -0.8175,
  166. X    -0.8314,
  167. X    -0.8448,
  168. X    -0.8577,
  169. X    -0.8700,
  170. X    -0.8819,
  171. X    -0.8932,
  172. X    -0.9039,
  173. X    -0.9142,
  174. X    -0.9238,
  175. X    -0.9329,
  176. X    -0.9415,
  177. X    -0.9495,
  178. X    -0.9569,
  179. X    -0.9637,
  180. X    -0.9700,
  181. X    -0.9757,
  182. X    -0.9808,
  183. X    -0.9853,
  184. X    -0.9892,
  185. X    -0.9925,
  186. X    -0.9952,
  187. X    -0.9973,
  188. X    -0.9988,
  189. X    -0.9997,
  190. X    -1.0000,
  191. X    -0.9997,
  192. X    -0.9988,
  193. X    -0.9973,
  194. X    -0.9952,
  195. X    -0.9925,
  196. X    -0.9892,
  197. X    -0.9853,
  198. X    -0.9808,
  199. X    -0.9757,
  200. X    -0.9701,
  201. X    -0.9638,
  202. X    -0.9570,
  203. X    -0.9496,
  204. X    -0.9416,
  205. X    -0.9330,
  206. X    -0.9239,
  207. X    -0.9143,
  208. X    -0.9041,
  209. X    -0.8933,
  210. X    -0.8820,
  211. X    -0.8702,
  212. X    -0.8578,
  213. X    -0.8449,
  214. X    -0.8316,
  215. X    -0.8177,
  216. X    -0.8033,
  217. X    -0.7884,
  218. X    -0.7731,
  219. X    -0.7573,
  220. X    -0.7411,
  221. X    -0.7244,
  222. X    -0.7072,
  223. X    -0.6897,
  224. X    -0.6717,
  225. X    -0.6533,
  226. X    -0.6345,
  227. X    -0.6154,
  228. X    -0.5958,
  229. X    -0.5759,
  230. X    -0.5557,
  231. X    -0.5351,
  232. X    -0.5142,
  233. X    -0.4930,
  234. X    -0.4715,
  235. X    -0.4498,
  236. X    -0.4277,
  237. X    -0.4054,
  238. X    -0.3828,
  239. X    -0.3601,
  240. X    -0.3371,
  241. X    -0.3138,
  242. X    -0.2905,
  243. X    -0.2669,
  244. X    -0.2432,
  245. X    -0.2193,
  246. X    -0.1953,
  247. X    -0.1711,
  248. X    -0.1469,
  249. X    -0.1226,
  250. X    -0.0982,
  251. X    -0.0737,
  252. X    -0.0493,
  253. X    -0.0247
  254. X`125;
  255. $ CALL UNPACK SINTAB.C;1 323794660
  256. $ create/nolog 'f'
  257. X/*
  258. X * smessage.c
  259. X */
  260. X#include "copyright.h"
  261. X
  262. X#include <stdio.h>
  263. X#include <math.h>
  264. X#include <signal.h>
  265. X#include <ctype.h>
  266. X#include "Wlib.h"
  267. X#include "defs.h"
  268. X#include "struct.h"
  269. X#include "data.h"
  270. X
  271. X#define ADDRLEN 10
  272. X
  273. X#define BLANKCHAR(col, n) W_ClearArea(messagew, 5+W_Textwidth*(col), 5, \
  274. X    W_Textwidth * (n), W_Textheight, backColor);
  275. X#define DRAWCURSOR(col) W_WriteText(messagew, 5+W_Textwidth*(col), 5, \
  276. X    textColor, &cursor, 1, W_RegularFont);
  277. X
  278. Xstatic int lcount;
  279. Xstatic char buf`09180`093;
  280. Xstatic char cursor = '_';
  281. X
  282. Xchar *getaddr(), *getaddr2();
  283. X
  284. Xsmessage(ichar)
  285. X    char ichar;
  286. X`123
  287. X    register int i;
  288. X    char *getaddr();
  289. X    char twochar`0912`093;
  290. X    static char addr, *addr_str;
  291. X
  292. X    if (messpend == 0) `123
  293. X`009messpend = 1;
  294. X`009if (mdisplayed) `123
  295. X`009    BLANKCHAR(0, lastcount);
  296. X`009    mdisplayed = 0;
  297. X`009`125
  298. X`009/* Put the proper recipient in the window */
  299. X`009if ((ichar == 't') `124`124 (ichar == 'T'))
  300. X`009    addr = teamlet`091me->p_team`093;
  301. X`009else
  302. X`009    addr = ichar;
  303. X`009addr_str = getaddr(addr);
  304. X`009if (addr_str == 0) `123
  305. X`009    /* print error message */
  306. X`009    messpend = 0;
  307. X`009    W_WarpPointer(NULL);`009/* ATM - msg warp */
  308. X`009    return;
  309. X`009`125
  310. X`009W_WriteText(messagew, 5, 5, textColor, addr_str, strlen(addr_str),
  311. X`009    W_RegularFont);
  312. X`009lcount = ADDRLEN;
  313. X`009DRAWCURSOR(ADDRLEN);
  314. X`009return;
  315. X    `125
  316. X    switch ((unsigned char)ichar & `126(0x80)) `123
  317. X`009case '\b':`009/* character erase */
  318. X`009case '\177':
  319. X`009    if (--lcount < ADDRLEN) `123
  320. X`009`009lcount = ADDRLEN;
  321. X`009`009break;
  322. X`009    `125
  323. X`009    BLANKCHAR(lcount + 1, 1);
  324. X`009    DRAWCURSOR(lcount);
  325. X`009    break;
  326. X
  327. X`009case '\027':`009/* word erase */
  328. X`009    i = 0;
  329. X`009    /* back up over blanks */
  330. X`009    while (--lcount >= ADDRLEN &&
  331. X`009`009isspace((unsigned char)buf`091lcount - ADDRLEN`093 & `126(0x80)))
  332. X`009`009i++;
  333. X`009    lcount++;
  334. X`009    /* back up over non-blanks */
  335. X`009    while (--lcount >= ADDRLEN &&
  336. X`009`009!isspace((unsigned char)buf`091lcount - ADDRLEN`093 & `126(0x80)))
  337. X`009`009i++;
  338. X`009    lcount++;
  339. X
  340. X`009    if (i > 0) `123
  341. X`009`009BLANKCHAR(lcount, i + 1);
  342. X`009`009DRAWCURSOR(lcount);
  343. X`009    `125
  344. X`009    break;
  345. X
  346. X`009case '\025':`009/* kill line */
  347. X`009case '\030':
  348. X`009    if (lcount > ADDRLEN) `123
  349. X`009`009BLANKCHAR(ADDRLEN, lcount - ADDRLEN + 1);
  350. X`009`009lcount = ADDRLEN;
  351. X`009`009DRAWCURSOR(ADDRLEN);
  352. X`009    `125
  353. X`009    break;
  354. X
  355. X`009case '\033':`009/* abort message */
  356. X`009    BLANKCHAR(0, lcount + 1);
  357. X`009    mdisplayed = 0;
  358. X`009    messpend = 0;
  359. X`009    W_WarpPointer(NULL);`009/* ATM - msg warp */
  360. X`009    break;
  361. X
  362. X`009case '\r':`009/* send message */
  363. X`009    buf`091lcount - ADDRLEN`093 = '\0';
  364. X`009    messpend = 0;
  365. X`009    switch (addr) `123
  366. X`009`009case 'A':
  367. X`009`009    pmessage(buf, 0, MALL);
  368. X`009`009    break;
  369. X`009`009case 'G':
  370. X`009`009    pmessage(buf, me->p_mapchars`0911`093 - '0', MGOD);
  371. X`009`009    break;
  372. X`009`009case 'F':
  373. X`009`009    pmessage(buf, FED, MTEAM);
  374. X`009`009    break;
  375. X`009`009case 'R':
  376. X`009`009    pmessage(buf, ROM, MTEAM);
  377. X`009`009    break;
  378. X`009`009case 'K':
  379. X`009`009    pmessage(buf, KLI, MTEAM);
  380. X`009`009    break;
  381. X`009`009case 'O':
  382. X`009`009    pmessage(buf, ORI, MTEAM);
  383. X`009`009    break;
  384. X`009`009case '0':
  385. X`009`009case '1':
  386. X`009`009case '2':
  387. X`009`009case '3':
  388. X`009`009case '4':
  389. X`009`009case '5':
  390. X`009`009case '6':
  391. X`009`009case '7':
  392. X`009`009case '8':
  393. X`009`009case '9':
  394. X`009`009    pmessage(buf, addr - '0', MINDIV);
  395. X`009`009    break;
  396. X`009`009case 'a': case 'b': case 'c': case 'd':
  397. X`009`009case 'e': case 'f': case 'g': case 'h':
  398. X`009`009case 'i': case 'j': case 'k': case 'l':
  399. X`009`009case 'm': case 'n': case 'o': case 'p':
  400. X`009`009case 'q': case 'r': case 's': case 't':`032
  401. X`009`009case 'u': case 'v': case 'w': case 'x':`032
  402. X`009`009case 'y': case 'z':
  403. X`009`009    pmessage(buf, addr - 'a' + 10, MINDIV);
  404. X`009`009    break;
  405. X`009`009default:
  406. X`009`009    warning("Not legal recipient");
  407. X`009    `125
  408. X`009    BLANKCHAR(0, lcount + 1);
  409. X`009    mdisplayed = 0;
  410. X`009    lcount = 0;
  411. X`009    break;
  412. X
  413. X`009default:`009/* add character */
  414. X`009    if (lcount >= 80) `123
  415. X`009`009W_Beep();
  416. X`009`009break;
  417. X`009    `125
  418. X`009    if (iscntrl((unsigned char )ichar & `126(0x80)))
  419. X`009`009break;
  420. X`009    twochar`0910`093 = ichar;
  421. X`009    twochar`0911`093 = cursor;
  422. X`009    W_WriteText(messagew, 5 + W_Textwidth * lcount, 5, textColor,
  423. X`009`009twochar, 2, W_RegularFont);
  424. X`009    buf`091(lcount++) - ADDRLEN`093 = ichar;
  425. X`009    break;
  426. X    `125
  427. X`125
  428. X
  429. Xpmessage(str, recip, group)
  430. Xchar *str;
  431. Xint recip;
  432. Xint group;
  433. X`123
  434. X    char newbuf`091100`093;
  435. X
  436. X    sendMessage(str, group, recip);
  437. X    if ((group==MTEAM && recip!=me->p_team) `124`124`032
  438. X`009(group==MINDIV && recip!=me->p_no)) `123
  439. X`009sprintf(newbuf, "%s  %s", getaddr2(group, recip), str);
  440. X`009newbuf`09179`093=0;
  441. X`009dmessage(newbuf, group, me->p_no, recip);
  442. X    `125
  443. X    W_WarpPointer(NULL);`009`009/* ATM - msg warp */
  444. X`125
  445. X
  446. Xchar *getaddr(who)
  447. Xchar who;
  448. X`123
  449. X    switch (who) `123
  450. X    case 'A':
  451. X`009return(getaddr2(MALL, 0));
  452. X    case 'F':
  453. X`009return(getaddr2(MTEAM, FED));
  454. X    case 'R':
  455. X`009return(getaddr2(MTEAM, ROM));
  456. X    case 'K':
  457. X`009return(getaddr2(MTEAM, KLI));
  458. X    case 'O':
  459. X`009return(getaddr2(MTEAM, ORI));
  460. X    case 'G':
  461. X`009return(getaddr2(MGOD, 0));
  462. X    case '0':
  463. X    case '1':
  464. X    case '2':
  465. X    case '3':
  466. X    case '4':
  467. X    case '5':
  468. X    case '6':
  469. X    case '7':
  470. X    case '8':
  471. X    case '9':
  472. X`009if (isAlive(&players`091who - '0'`093)) `123
  473. X`009    return(getaddr2(MINDIV, who-'0'));
  474. X`009`125
  475. X`009else `123
  476. X`009    warning("Player is not in game");
  477. X`009    return(0);
  478. X`009`125
  479. X`009break;
  480. X    case 'a': case 'b': case 'c': case 'd':
  481. X    case 'e': case 'f': case 'g': case 'h':
  482. X    case 'i': case 'j': case 'k': case 'l':
  483. X    case 'm': case 'n': case 'o': case 'p':
  484. X    case 'q': case 'r': case 's': case 't':`032
  485. X    case 'u': case 'v': case 'w': case 'x':`032
  486. X    case 'y': case 'z':
  487. X`009if (who-'a'+10 > MAXPLAYER) `123
  488. X`009    warning("Player is not in game");
  489. X`009    return(0);
  490. X`009`125
  491. X`009if (isAlive(&players`091who - 'a' + 10`093)) `123
  492. X`009    return(getaddr2(MINDIV, who-'a'+10));
  493. X`009`125
  494. X`009else `123
  495. X`009    warning("Player is not in game");
  496. X`009    return(0);
  497. X`009`125
  498. X`009break;
  499. X    default:
  500. X`009warning("Not legal recipient");
  501. X`009return(0);
  502. X    `125
  503. X`125
  504. X
  505. Xchar *getaddr2(flags, recip)`032
  506. Xint flags;
  507. Xint recip;
  508. X`123
  509. X    static char addrmesg`091ADDRLEN`093;
  510. X
  511. X    (void) sprintf(addrmesg, " %c%c->", teamlet`091me->p_team`093, shipnos`0
  512. V91me->p_no`093);
  513. X    switch(flags) `123
  514. X    case MALL:
  515. X`009(void) sprintf(&addrmesg`0915`093, "ALL");
  516. X`009break;
  517. X    case MGOD:
  518. X`009(void) sprintf(&addrmesg`0915`093, "GOD");
  519. X`009break;
  520. X    case MTEAM:
  521. X`009(void) sprintf(&addrmesg`0915`093, teamshort`091recip`093);
  522. X`009break;
  523. X    case MINDIV:
  524. X`009(void) sprintf(&addrmesg`0915`093, "%c%c ",
  525. X`009    teamlet`091players`091recip`093.p_team`093, shipnos`091recip`093);
  526. X`009break;
  527. X    `125
  528. X    return(addrmesg);
  529. X`125
  530. X
  531. X/* Send an emergency signal out to everyone. */
  532. X
  533. Xemergency()
  534. X`123
  535. X    char addrbuf`091ADDRLEN`093;
  536. X    char ebuf`09180`093;
  537. X
  538. X    if (myship->s_type==STARBASE) `123
  539. X`009sprintf(ebuf,`032
  540. X`009    "Distress Call from %c%c (Starbase!):  %d%% damage, %d%% shields, %d
  541. V armies!",
  542. X`009    teamlet`091me->p_team`093, shipnos`091me->p_no`093,
  543. X`009    (100*me->p_damage)/me->p_ship.s_maxdamage,
  544. X`009    (100*me->p_shield)/me->p_ship.s_maxshield,
  545. X`009    me->p_armies);
  546. X    `125 else `123
  547. X`009sprintf(ebuf,`032
  548. X`009    "Distress Call from %c%c:  %d%% damage, %d%% shields, %d armies!",
  549. X`009    teamlet`091me->p_team`093, shipnos`091me->p_no`093,
  550. X`009    (100*me->p_damage)/me->p_ship.s_maxdamage,
  551. X`009    (100*me->p_shield)/me->p_ship.s_maxshield,
  552. X`009    me->p_armies);
  553. X    `125
  554. X    pmessage(ebuf, me->p_team, MTEAM);
  555. X`125
  556. $ CALL UNPACK SMESSAGE.C;1 1182574212
  557. $ create/nolog 'f'
  558. X/*
  559. X * Socket.c
  560. X *
  561. X * Kevin P. Smith 1/29/89
  562. X * UDP stuff v1.0 by Andy McFadden  Feb-Apr 1992
  563. X *
  564. X * UDP protocol v1.0
  565. X *
  566. X * Routines to allow connection to the xtrek server.
  567. X */
  568. X#include "copyright2.h"
  569. X
  570. X#ifndef GATEWAY
  571. X# define USE_PORTSWAP`009`009/* instead of using recvfrom() */
  572. X#endif
  573. X
  574. X#include <stdio.h>
  575. X#include <errno.h>
  576. X#include "TWG$TCP:`091NETDIST.INCLUDE.SYS`093types.h"
  577. X#define  ECONNREFUSED 61
  578. X#include <socket.h>
  579. X#include <time.h>
  580. X#include <in.h>
  581. X#include <netdb.h>
  582. X#include "Wlib.h"
  583. X#include "defs.h"
  584. X#include "struct.h"
  585. X#include "data.h"
  586. X#include "packets.h"
  587. X
  588. X#ifdef VMS
  589. X#include "vmsutils.h"
  590. X#endif
  591. X
  592. X#define INCLUDE_SCAN`009`009/* include Amdahl scanning beams */
  593. X#define INCLUDE_VISTRACT`009/* include visible tractor beams */
  594. X
  595. X#ifdef GATEWAY
  596. X/*
  597. X * (these values are now defined in "main.c":)
  598. X * char *gw_mach`009= "charon";`009`124client gateway; strcmp(serverName)
  599. X * int   gw_serv_port`009= 5000;`009`009`124what to tell the server to use
  600. X * int   gw_port`009= 5001;`009`009`124where we will contact gw
  601. X * int   gw_local_port`009= 5100;`009`009`124where we expect gw to contact u
  602. Vs
  603. X *
  604. X * The client binds to "5100" and sends "5000" to the server (TCP).  The
  605. X * server sees that and sends a UDP packet to gw on port udp5000, which pass
  606. Ves
  607. X * it through to port udp5100 on the client.  The client-gw gets the server'
  608. Vs
  609. X * host and port from recvfrom.  (The client can't use the same method since
  610. X * these sockets are one-way only, so it connect()s to gw_port (udp5001)
  611. X * on the gateway machine regardless of what the server sends.)
  612. X *
  613. X * So all we need in .gwrc is:
  614. X *`009udp 5000 5001 tde.uts 5100
  615. X *
  616. X * assuming the client is on tde.uts.  Note that a UDP declaration will
  617. X * work for ANY server, but you need one per player, and the client has to
  618. X * have the port numbers in advance.
  619. X *
  620. X * If we're using a standard server, we're set.  If we're running through a
  621. X * gatewayed server, we have to do some unpleasant work on the server side..
  622. V.
  623. X */
  624. X#endif
  625. X
  626. Xint handleMessage(), handlePhaser(), handlePlyrInfo();
  627. Xint handlePlayer(), handleSelf(), handleStatus();
  628. Xint handleWarning(), handleTorp(), handleTorpInfo();
  629. Xint handlePlanet(), handleQueue(), handlePickok(), handleLogin();
  630. Xint handlePlasmaInfo(), handlePlasma();
  631. Xint handleKills(), handleFlags(), handlePStatus();
  632. Xint handleMotd(), handleMask();
  633. Xint handleBadVersion(), handlePlanetLoc();
  634. Xint handleHostile(), handleStats(), handlePlyrLogin();
  635. Xint handleReserved();
  636. X#ifdef INCLUDE_SCAN
  637. Xint handleScan();
  638. X#endif
  639. +-+-+-+-+-+-+-+-  END  OF PART 38 +-+-+-+-+-+-+-+-
  640.