home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / vmstrek / part34 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  14.6 KB

  1. Path: 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 34/47
  4. Message-ID: <1992Nov20.200734.1@acad2.alaska.edu>
  5. From: asdmf@acad2.alaska.edu
  6. Date: Sat, 21 Nov 1992 00:07:34 GMT
  7. Sender: news@raven.alaska.edu (USENET News System)
  8. Organization: University of Alaska
  9. Nntp-Posting-Host: acad2.alaska.edu
  10. Lines: 401
  11. Xref: uunet vmsnet.sources.games:533
  12.  
  13. -+-+-+-+-+-+-+-+ START OF PART 34 -+-+-+-+-+-+-+-+
  14. X    if (mapmode) map();
  15. X
  16. X    local();`009/* redraw local window */
  17. X
  18. X    stline(0);
  19. X
  20. X    if (W_IsMapped(statwin))
  21. X`009updateStats(statwin);
  22. X`125
  23. X
  24. XW_Icon planetBitmap(p)
  25. Xregister struct planet *p;
  26. X`123
  27. X    int i;
  28. X
  29. X    if (showlocal==2) `123
  30. X`009return(bplanets`0910`093);
  31. X    `125 else if (p->pl_info & me->p_team) `123
  32. X`009if (showlocal==1) `123
  33. X`009    i=0;
  34. X`009    if (p->pl_armies > 4) i+=4;
  35. X`009    if (p->pl_flags & PLREPAIR) i+=2;
  36. X`009    if (p->pl_flags & PLFUEL) i+=1;
  37. X`009    return(bplanets2`091i`093);
  38. X`009`125 else `123
  39. X`009    return(bplanets`091remap`091p->pl_owner`093`093);
  40. X`009`125
  41. X    `125 else `123
  42. X`009return(bplanets`0915`093);
  43. X    `125
  44. X`125
  45. X
  46. X
  47. XW_Icon planetmBitmap(p)
  48. Xregister struct planet *p;
  49. X`123
  50. X    int i;
  51. X
  52. X    if (showgalactic==2) `123
  53. X`009return(mbplanets`0910`093);
  54. X    `125 else if (p->pl_info & me->p_team) `123
  55. X`009if (showgalactic==1) `123
  56. X`009    i=0;
  57. X`009    if (p->pl_armies > 4) i+=4;
  58. X`009    if (p->pl_flags & PLREPAIR) i+=2;
  59. X`009    if (p->pl_flags & PLFUEL) i+=1;
  60. X`009    return(mbplanets2`091i`093);
  61. X`009`125 else `123
  62. X`009    return(mbplanets`091remap`091p->pl_owner`093`093);
  63. X`009`125
  64. X    `125 else `123
  65. X`009return(mbplanets`0915`093);
  66. X    `125
  67. X`125
  68. X
  69. Xlocal()
  70. X`123
  71. X    register int h, i;
  72. X    register struct player *j;
  73. X    register struct torp *k;
  74. X    register struct planet *l;
  75. X    register struct phaser *php;
  76. X    register struct plasmatorp *pt;
  77. X
  78. X    int dx, dy;
  79. X    int view;
  80. X    char idbuf`0912`093;
  81. X    W_Icon (*ship_bits)`091VIEWS`093;
  82. X
  83. X    /* Kludge to try to fix missing ID chars on tactical (short range) displ
  84. Vay. */
  85. X    idbuf`0910`093 = '0';
  86. X    idbuf`0911`093 = '\0';
  87. X    /* Draw Planets */
  88. X    view = SCALE * WINSIDE / 2;
  89. X    for (i = 0, l = &planets`091i`093; i < MAXPLANETS; i++, l++) `123
  90. X`009dx = l->pl_x - me->p_x;
  91. X`009dy = l->pl_y - me->p_y;
  92. X`009if (dx > view `124`124 dx < -view `124`124 dy > view `124`124 dy < -view
  93. V)
  94. X`009    continue;
  95. X`009dx = dx / SCALE + WINSIDE / 2;
  96. X`009dy = dy / SCALE + WINSIDE / 2;
  97. X`009W_WriteBitmap(dx - (planet_width/2), dy - (planet_height/2),
  98. X`009    planetBitmap(l), planetColor(l));
  99. X`009if (namemode) `123
  100. X`009    W_MaskText(w, dx - (planet_width/2), dy + (planet_height/2),
  101. X`009`009planetColor(l), l->pl_name, l->pl_namelen,
  102. X`009`009planetFont(l));
  103. X`009    clearzone`0910`093`091clearcount`093 = dx - (planet_width/2);
  104. X`009    clearzone`0911`093`091clearcount`093 = dy + (planet_height/2);
  105. X`009    clearzone`0912`093`091clearcount`093 = W_Textwidth * l->pl_namelen;
  106. X`009    clearzone`0913`093`091clearcount`093 = W_Textheight;
  107. X`009    clearcount++;
  108. X`009`125
  109. X`009clearzone`0910`093`091clearcount`093 = dx - (planet_width/2);
  110. X`009clearzone`0911`093`091clearcount`093 = dy - (planet_height/2);
  111. X`009clearzone`0912`093`091clearcount`093 = planet_width;
  112. X`009clearzone`0913`093`091clearcount`093 = planet_height;
  113. X`009clearcount++;
  114. X    `125
  115. X
  116. X    /* Draw ships */
  117. X    nplayers = 0;
  118. X    view = SCALE * WINSIDE / 2;
  119. X    for (i = 0, j = &players`091i`093; i < MAXPLAYER; i++, j++) `123
  120. X        int tx, ty;
  121. X`009if ((j->p_status != PALIVE) && (j->p_status != PEXPLODE))
  122. X`009    continue;
  123. X`009nplayers++;
  124. X`009if (j->p_flags & PFCLOAK) `123
  125. X`009    if (j->p_cloakphase < (CLOAK_PHASES-1)) `123
  126. X`009`009j->p_cloakphase++;
  127. X`009    `125
  128. X`009`125 else `123
  129. X`009    if (j->p_cloakphase) `123
  130. X`009`009j->p_cloakphase--;
  131. X`009    `125
  132. X`009`125
  133. X`009dx = j->p_x - me->p_x;
  134. X`009dy = j->p_y - me->p_y;
  135. X`009if (dx > view `124`124 dx < -view `124`124 dy > view `124`124 dy < -view
  136. V)`032
  137. X`009    continue;
  138. X`009dx = dx / SCALE + WINSIDE / 2;
  139. X`009dy = dy / SCALE + WINSIDE / 2;
  140. X`009if (j->p_flags & PFCLOAK && (j->p_cloakphase == (CLOAK_PHASES-1))) `123
  141. X`009    if (myPlayer(j)) `123
  142. X`009`009W_WriteBitmap(dx - (cloak_width/2), dy - (cloak_height/2),
  143. X`009`009    cloakicon, myColor);
  144. X`009`009clearzone`0910`093`091clearcount`093 = dx - (shield_width/2);
  145. X`009`009clearzone`0911`093`091clearcount`093 = dy - (shield_height/2);
  146. X`009`009clearzone`0912`093`091clearcount`093 = shield_width;
  147. X`009`009clearzone`0913`093`091clearcount`093 = shield_height;
  148. X`009`009clearcount++;
  149. X`009    `125
  150. X`009    continue;
  151. X`009`125
  152. X`009if (j->p_status == PALIVE) `123
  153. X`009    switch (j->p_team) `123
  154. X`009`009case IND:
  155. X`009`009    ship_bits = ind_bitmaps;
  156. X`009`009    break;
  157. X`009`009case FED:
  158. X`009`009    ship_bits = fed_bitmaps;
  159. X`009`009    break;
  160. X`009`009case ROM:
  161. X`009`009    ship_bits = rom_bitmaps;
  162. X`009`009    break;
  163. X`009`009case KLI:
  164. X`009`009    ship_bits = kli_bitmaps;
  165. X`009`009    break;
  166. X`009`009case ORI:
  167. X`009`009default:
  168. X`009`009    ship_bits = ori_bitmaps;
  169. X`009`009    break;
  170. X`009    `125
  171. X
  172. X`009    clearzone`0910`093`091clearcount`093 = dx - (shield_width/2);
  173. X`009    clearzone`0911`093`091clearcount`093 = dy - (shield_height/2);
  174. X`009    clearzone`0912`093`091clearcount`093 = shield_width;
  175. X`009    clearzone`0913`093`091clearcount`093 = shield_height;
  176. X`009    clearcount++;
  177. X
  178. X`009    W_WriteBitmap(dx - (j->p_ship.s_width/2),
  179. X`009`009dy - (j->p_ship.s_height/2),
  180. X`009`009ship_bits`091j->p_ship.s_type`093`091rosette(j->p_dir)`093,
  181. X`009`009playerColor(j));
  182. X
  183. X            if (j->p_cloakphase > 0) `123
  184. X`009`009W_WriteBitmap(dx - (cloak_width/2),
  185. X`009`009    dy - (cloak_height/2), cloakicon, playerColor(j));
  186. X`009`009continue;
  187. X`009    `125
  188. X
  189. X`009    if (showShields && (j->p_flags & PFSHIELD)) `123
  190. X`009`009W_WriteBitmap(dx - (shield_width/2),
  191. X`009`009    dy - (shield_height/2), shield, playerColor(j));
  192. X`009    `125
  193. X
  194. X`009    idbuf`0910`093 = *(shipnos+j->p_no);
  195. X
  196. X`009    W_MaskText(w, dx + (j->p_ship.s_width/2),`032
  197. X`009`009dy - (j->p_ship.s_height/2), playerColor(j),
  198. X`009`009idbuf, 1, shipFont(j));
  199. X`009      `032
  200. X`009    clearzone`0910`093`091clearcount`093 = dx + (j->p_ship.s_width/2);
  201. X`009    clearzone`0911`093`091clearcount`093 = dy - (j->p_ship.s_height/2);
  202. X`009    clearzone`0912`093`091clearcount`093 = W_Textwidth;
  203. X`009    clearzone`0913`093`091clearcount`093 = W_Textheight;
  204. X`009    clearcount++;
  205. X`009`125
  206. X`009else if (j->p_status == PEXPLODE) `123
  207. X`009    int i;
  208. X
  209. X`009    i=j->p_explode;
  210. X`009    if (i<EX_FRAMES `124`124 (i<SBEXPVIEWS && j->p_ship.s_type==STARBASE
  211. V)) `123
  212. X
  213. X`009`009if (j->p_ship.s_type == STARBASE) `123
  214. X`009`009    W_WriteBitmap(dx - (sbexp_width/2),`032
  215. X`009`009`009dy - (sbexp_height/2), sbexpview`091i`093,`032
  216. X`009`009`009playerColor(j));
  217. X`009`009    clearzone`0910`093`091clearcount`093 = dx - (sbexp_width/2);
  218. X`009`009    clearzone`0911`093`091clearcount`093 = dy - (sbexp_height/2);
  219. X`009`009    clearzone`0912`093`091clearcount`093 = sbexp_width;
  220. X`009`009    clearzone`0913`093`091clearcount`093 = sbexp_height;
  221. X`009`009`125 else `123
  222. X`009`009    W_WriteBitmap(dx - (ex_width/2), dy - (ex_height/2),
  223. X`009`009`009expview`091i`093, playerColor(j));
  224. X`009`009    clearzone`0910`093`091clearcount`093 = dx - (ex_width/2);
  225. X`009`009    clearzone`0911`093`091clearcount`093 = dy - (ex_height/2);
  226. X`009`009    clearzone`0912`093`091clearcount`093 = ex_width;
  227. X`009`009    clearzone`0913`093`091clearcount`093 = ex_height;
  228. X`009`009`125
  229. X`009        clearcount++;
  230. X`009`009j->p_explode++;   `032
  231. X`009    `125
  232. X`009`125
  233. X`009/* Now draw his phaser (if it exists) */
  234. X`009php = &phasers`091j->p_no`093;
  235. X`009if (php->ph_status != PHFREE) `123
  236. X`009    if (php->ph_status == PHMISS) `123
  237. X`009`009/* Here I will have to compute end coordinate */
  238. X`009`009tx = j->p_x + PHASEDIST * j->p_ship.s_phaserdamage / 100 * Costab`09
  239. V1php->ph_dir`093;
  240. X`009`009ty = j->p_y + PHASEDIST * j->p_ship.s_phaserdamage / 100 * Sintab`09
  241. V1php->ph_dir`093;
  242. X`009`009tx = (tx - me->p_x) / SCALE + WINSIDE / 2;
  243. X`009`009ty = (ty - me->p_y) / SCALE + WINSIDE / 2;
  244. X`009`009php->ph_fuse = 0;
  245. X`009    `125 else if (php->ph_status == PHHIT2) `123
  246. X`009`009tx = (php->ph_x - me->p_x) / SCALE + WINSIDE / 2;
  247. X`009`009ty = (php->ph_y - me->p_y) / SCALE + WINSIDE / 2;
  248. X`009    `125 else `123 /* Start point is dx, dy */
  249. X`009`009tx = (players`091php->ph_target`093.p_x - me->p_x) /
  250. X`009`009    SCALE + WINSIDE / 2;
  251. X`009`009ty = (players`091php->ph_target`093.p_y - me->p_y) /
  252. X`009`009    SCALE + WINSIDE / 2;
  253. X`009    `125
  254. X
  255. X`009    /* Scott: 9/30/90: 5 lines */
  256. X`009    if ((php->ph_fuse % 2) == 1)
  257. X`009`009W_MakeLine(w, dx, dy, tx, ty, foreColor);
  258. X`009    else
  259. X`009`009W_MakeLine(w, dx, dy, tx, ty, shipCol`091remap`091j->p_team`093`093)
  260. V;
  261. X`009    php->ph_fuse++;
  262. X
  263. X`009    /* OLD: W_MakeLine(w,dx, dy, tx, ty,phaserColor(php)); */
  264. X
  265. X`009    clearline`0910`093`091clearlcount`093 = dx;
  266. X`009    clearline`0911`093`091clearlcount`093 = dy;
  267. X`009    clearline`0912`093`091clearlcount`093 = tx;
  268. X`009    clearline`0913`093`091clearlcount`093 = ty;
  269. X`009    clearlcount++;
  270. X`009`125
  271. X
  272. X`009/* ATM - visible tractor/pressor beams */
  273. X`009/* (for the standard client, I am allowing them for self ONLY) */
  274. X`009/* Since this is NOT a cyborg, I don't show anything if the server */
  275. X`009/* doesn't allow it. */
  276. X`009if (vissup >= 0 && j == me && isAlive(j) &&
  277. X`009`009`009`009`009(j->p_flags & (PFTRACT`124PFPRESS))) `123
  278. X`009    /* this keeps us from trying to show them on servers which */
  279. X`009    /* don't support visible tractor beams */
  280. X`009    if (j->p_tractor < 0) `123
  281. X`009`009vissup = -1;
  282. X`009`009goto notsup;
  283. X`009    `125 else
  284. X`009`009vissup = 1;
  285. X
  286. X`009    if (!showTractor) `123
  287. X`009`009/* don't use visible beams; use icons instead */
  288. X`009`009if (j->p_flags & PFPRESS)
  289. X                    W_WriteBitmap(dx - (shield_width/2) - 5,
  290. X                        dy + (shield_height/2) + 5, pressbits, playerColor(j
  291. V));
  292. X                else
  293. X                    W_WriteBitmap(dx - (shield_width/2) - 5,
  294. X                        dy + (shield_height/2) + 5, tractbits, playerColor(j
  295. V));
  296. X                clearzone`0910`093`091clearcount`093 = dx - (shield_width/2)
  297. V - 5;
  298. X                clearzone`0911`093`091clearcount`093 = dy + (shield_height/2
  299. V) + 5;
  300. X                clearzone`0912`093`091clearcount`093 = 5;
  301. X                clearzone`0913`093`091clearcount`093 = 5;
  302. X                clearcount++;
  303. X
  304. X`009    `125 else `123
  305. X`009`009/* use visible beams */
  306. X`009`009double theta;
  307. X`009`009unsigned char dir;
  308. X`009`009int lx`0912`093, ly`0912`093;
  309. X
  310. X`009`009tx = (players`091j->p_tractor`093.p_x - me->p_x) / SCALE + WINSIDE/2
  311. V;
  312. X`009`009ty = (players`091j->p_tractor`093.p_y - me->p_y) / SCALE + WINSIDE/2
  313. V;
  314. X
  315. X`009`009if (tx == dx && ty == dy)
  316. X`009`009    continue;`009/* this had better be last in for(..) */
  317. X
  318. X#define XPI`0093.1415926
  319. X`009`009theta = atan2((double) (tx - dx), (double) (dy - ty)) + XPI / 2.0;
  320. X`009`009dir = (unsigned char) (theta / XPI * 128.0);
  321. X
  322. X`009`009lx`0910`093 = tx + (Costab`091dir`093 * (shield_width/2));
  323. X`009`009ly`0910`093 = ty + (Sintab`091dir`093 * (shield_width/2));
  324. X`009`009lx`0911`093 = tx - (Costab`091dir`093 * (shield_width/2));
  325. X`009`009ly`0911`093 = ty - (Sintab`091dir`093 * (shield_width/2));
  326. X#undef XPI
  327. X`009`009W_MakeLine(w, dx, dy, lx`0910`093, ly`0910`093, foreColor);
  328. X`009`009W_MakeLine(w, dx, dy, lx`0911`093, ly`0911`093, foreColor);
  329. X
  330. X`009`009clearline`0910`093`091clearlcount`093 = dx;
  331. X`009`009clearline`0911`093`091clearlcount`093 = dy;
  332. X`009`009clearline`0912`093`091clearlcount`093 = lx`0910`093;
  333. X`009`009clearline`0913`093`091clearlcount`093 = ly`0910`093;
  334. X`009`009clearlcount++;
  335. X`009`009clearline`0910`093`091clearlcount`093 = dx;
  336. X`009`009clearline`0911`093`091clearlcount`093 = dy;
  337. X`009`009clearline`0912`093`091clearlcount`093 = lx`0911`093;
  338. X`009`009clearline`0913`093`091clearlcount`093 = ly`0911`093;
  339. X`009`009clearlcount++;
  340. X`009    `125
  341. X`009`125
  342. Xnotsup:`009j = j;`009`009/* lame compiler */
  343. X    `125
  344. X
  345. X    /* Draw torps */
  346. X    view = SCALE * WINSIDE / 2;
  347. X    for (i = 0, j = &players`091i`093; i < MAXPLAYER; i++, j++) `123
  348. X`009if (!j->p_ntorp)
  349. X`009    continue;
  350. X`009for (h = 0, k = &torps`091MAXTORP * i + h`093; h < MAXTORP; h++, k++) `1
  351. V23
  352. X`009    if (!k->t_status)
  353. X`009`009continue;
  354. X`009    dx = k->t_x - me->p_x;
  355. X`009    dy = k->t_y - me->p_y;
  356. X`009    if (dx > view `124`124 dx < -view `124`124 dy > view `124`124 dy < -
  357. Vview) `123
  358. X`009`009/* Call any torps off screen "free" (if owned by other) */
  359. X`009`009if (k->t_status==TEXPLODE && j!=me) `123
  360. X`009`009    k->t_status=TFREE;
  361. X`009`009    j->p_ntorp--;
  362. X`009`009`125
  363. X`009`009continue;
  364. X`009    `125
  365. X`009    dx = dx / SCALE + WINSIDE / 2;
  366. X`009    dy = dy / SCALE + WINSIDE / 2;
  367. X`009    if (k->t_status == TEXPLODE) `123
  368. X`009`009k->t_fuse--;
  369. X`009`009if (k->t_fuse <= 0) `123
  370. X`009`009    k->t_status=TFREE;
  371. X`009`009    j->p_ntorp--;
  372. X`009`009    continue;
  373. X`009`009`125
  374. X`009`009if (k->t_fuse>=NUMDETFRAMES) `123
  375. X`009`009    k->t_fuse=NUMDETFRAMES-1;
  376. X`009`009`125
  377. X`009`009W_WriteBitmap(dx - (cloud_width/2), dy - (cloud_height/2),
  378. X`009`009    cloud`091k->t_fuse`093, torpColor(k));
  379. X`009`009clearzone`0910`093`091clearcount`093 = dx - (cloud_width/2);
  380. X`009`009clearzone`0911`093`091clearcount`093 = dy - (cloud_height/2);
  381. X`009`009clearzone`0912`093`091clearcount`093 = cloud_width;
  382. X`009`009clearzone`0913`093`091clearcount`093 = cloud_height;
  383. X`009`009clearcount++;
  384. X`009    `125
  385. X`009    else if (k->t_owner != me->p_no && ((k->t_war & me->p_team) `124`124
  386. X`009`009      (players`091k->t_owner`093.p_team & (me->p_hostile `124 me->p_
  387. Vswar))))
  388. X`009    `123
  389. X`009`009W_WriteBitmap(dx - (etorp_width/2), dy - (etorp_height/2),
  390. X`009`009    etorp, torpColor(k));
  391. X`009`009clearzone`0910`093`091clearcount`093 = dx - (etorp_width/2);
  392. X`009`009clearzone`0911`093`091clearcount`093 = dy - (etorp_height/2);
  393. X`009`009clearzone`0912`093`091clearcount`093 = etorp_width;
  394. X`009`009clearzone`0913`093`091clearcount`093 = etorp_height;
  395. X`009`009clearcount++;
  396. X`009    `125
  397. X`009    else `123
  398. X`009`009W_WriteBitmap(dx - (mtorp_width/2), dy - (mtorp_height/2),
  399. X`009`009    mtorp, torpColor(k));
  400. X`009`009clearzone`0910`093`091clearcount`093 = dx - (mtorp_width/2);
  401. X`009`009clearzone`0911`093`091clearcount`093 = dy - (mtorp_height/2);
  402. X`009`009clearzone`0912`093`091clearcount`093 = mtorp_width;
  403. X`009`009clearzone`0913`093`091clearcount`093 = mtorp_height;
  404. X`009`009clearcount++;
  405. X`009    `125
  406. X`009`125
  407. X    `125
  408. X    /* Draw plasma torps */
  409. X    view = SCALE * WINSIDE / 2;
  410. X    for (i = 0, j = &players`091i`093; i < MAXPLAYER; i++, j++) `123
  411. X`009if (!j->p_nplasmatorp)
  412. X`009    continue;
  413. +-+-+-+-+-+-+-+-  END  OF PART 34 +-+-+-+-+-+-+-+-
  414.