home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume18 / xmpb / part03 < prev    next >
Encoding:
Internet Message Format  |  1993-07-11  |  54.9 KB

  1. Path: uunet!news.tek.com!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v18i003:  xmpb - multiplayer space combat for X, Part03/08
  5. Date: 26 Jun 1993 00:32:40 GMT
  6. Organization: Tektronix, Inc, Redmond, OR, USA
  7. Lines: 2281
  8. Approved: billr@saab.CNA.TEK.COM
  9. Message-ID: <20g5f8$6sm@ying.cna.tek.com>
  10. NNTP-Posting-Host: saab.cna.tek.com
  11. Xref: uunet comp.sources.games:1793
  12.  
  13. Submitted-by: ddp@deakin.edu.au (Damien De Paoli)
  14. Posting-number: Volume 18, Issue 3
  15. Archive-name: xmpb/Part03
  16. Environment: X11, Xlib
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 3 (of 8)."
  27. # Contents:  add_host.c bitmaps/bomb update_ships.c update_win.c
  28. #   weapon.c
  29. # Wrapped by billr@saab on Fri Jun 25 16:30:14 1993
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'add_host.c' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'add_host.c'\"
  33. else
  34. echo shar: Extracting \"'add_host.c'\" \(13587 characters\)
  35. sed "s/^X//" >'add_host.c' <<'END_OF_FILE'
  36. X/* add_host.c - *** Add a new host (i.e. player) to the game */
  37. X
  38. Xstatic char sccs_id[] = "@(#)add_host.c 1.41 93/03/29 XMPB";
  39. X
  40. X#include "player.h"
  41. X#include "save.h"
  42. X#include "bitmaps/title.bmp"
  43. X#include "bitmaps/stipple"
  44. X#include "bitmaps/jam25"
  45. X#include "bitmaps/jam50"
  46. X#include "bitmaps/jam75"
  47. X#include "bitmaps/jam100"
  48. X
  49. Xwinptr host[20];     /* 20 is hard coded, but I don't think it'll change */
  50. Xint no_hosts=0;        /* the number of players so far */
  51. Xint num_alive;        /* the number of alive players */
  52. Xint numnpcs = 0;
  53. Xint num_npcs_alive=0;
  54. Xint num_npcs_windows=0;
  55. Xextern winptr first_win;
  56. Xextern int euid;
  57. X
  58. X/*
  59. X** 
  60. X/*
  61. X*    Give the name of the host display and create the game on that display
  62. X*/
  63. Xadd_host(host_name,npc,npcwin, npcwinname)
  64. Xchar *host_name;
  65. Xint npc, npcwin;
  66. Xchar *npcwinname;
  67. X{
  68. X    char fn[100];
  69. X    FILE *fp;
  70. X
  71. X    XGCValues gcv;
  72. X    int i;
  73. X    XID    fid;
  74. X    Pixmap title;
  75. X    save *w;
  76. X    winptr temp;
  77. X
  78. X    /*
  79. X    *    Open the main window
  80. X    */
  81. X
  82. X    if(npc)
  83. X    {
  84. X        strcpy(fn, NPCDIR);
  85. X        fp = NULL;
  86. X        if(host_name)
  87. X        {
  88. X            strcat(fn,host_name);
  89. X            strcat(fn,".no");
  90. X
  91. Xseteuid(euid);
  92. X            fp = fopen(fn,"r");
  93. Xseteuid(getuid());
  94. X
  95. X        }
  96. X        if(!fp) 
  97. X        {
  98. X            fprintf(stderr, "Cannot find NPC: %s\n", host_name);
  99. X            return 0;
  100. X        }
  101. X        fclose(fp);
  102. X    }
  103. X
  104. X    if(!npc)
  105. X    {
  106. X        host[no_hosts] = xfe_open_window(host_name,0,0,PLAYW,PLAYH,
  107. X                            PLAYW,PLAYW,PLAYH,PLAYH,"xmpb");
  108. X        if(host[no_hosts]==NULL)
  109. X            return 0;
  110. X        host[no_hosts]->npc=0;
  111. X        host[no_hosts]->npcwin=0;
  112. X    }
  113. X    else
  114. X    {
  115. X        if(npcwin)
  116. X        {
  117. X            if(!npcwinname)
  118. X            {
  119. X                fprintf(stderr, "Cannot open a NULL hostname\n");
  120. X                return 0;
  121. X            }
  122. X            host[no_hosts] = xfe_open_window(npcwinname,0,0,PLAYW,PLAYH,
  123. X                            PLAYW,PLAYW,PLAYH,PLAYH,"xmpb");
  124. X            if(host[no_hosts]==NULL)
  125. X                return 0;
  126. X            host[no_hosts]->npcwin=1;
  127. X        }
  128. X        else
  129. X        {
  130. X            host[no_hosts] = (struct player *)malloc(sizeof(struct player));
  131. X            host[no_hosts]->next = first_win;
  132. X            host[no_hosts]->npcwin=0;
  133. X            first_win = host[no_hosts];
  134. X        }
  135. X        host[no_hosts]->npc=1;
  136. X    }
  137. X    if(host[no_hosts] == NULL)
  138. X        return 0;
  139. X
  140. X    if(!npc || npcwin)    
  141. X    {
  142. X
  143. X        /*
  144. X        *     Create the hidden buffer
  145. X        */
  146. X        host[no_hosts]->back_buffer = XCreatePixmap(host[no_hosts]->theDisplay,
  147. X                                  host[no_hosts]->theWindow,PLAYW+2*OFFSET,PLAYH+2*OFFSET,
  148. X                                  host[no_hosts]->thedepth);
  149. X    }
  150. X    /*
  151. X    *    Initialise the ship motion values
  152. X    */
  153. X    host[no_hosts]->xv = 0.0;
  154. X    host[no_hosts]->yv = 0.0;
  155. X    host[no_hosts]->angle = 0;
  156. X    host[no_hosts]->angle_v = 0;
  157. X    host[no_hosts]->max_angle_v = 125;
  158. X
  159. X/*  No longer used (I think)
  160. X    host[no_hosts]->max_accel = 3;
  161. X*/
  162. X
  163. X    /*
  164. X    *    turn mouse buttons off
  165. X    */
  166. X    host[no_hosts]->b1 = 0;
  167. X    host[no_hosts]->b2 = 0;
  168. X    host[no_hosts]->b3 = 0;
  169. X    host[no_hosts]->watching = NULL;
  170. X
  171. X    /*
  172. X    *     turn thruster off
  173. X    */
  174. X    host[no_hosts]->t2 = 0;
  175. X
  176. X/*  No longer used (I think)
  177. X    host[no_hosts]->px = PLAYW/2;
  178. X    host[no_hosts]->py = PLAYH/2;
  179. X    host[no_hosts]->last_pic = -1;
  180. X*/
  181. X    /*
  182. X    *    Set random starting point (90 is utterly rand, need 50 tho')
  183. X    */
  184. X
  185. XSETPOS:
  186. X    host[no_hosts]->sx = (rand()%(WORLDW-90)*2-WORLDW);
  187. X    host[no_hosts]->sy = (rand()%(WORLDH-90)*2-WORLDH);
  188. X    /* Check that we aint on each others posy */
  189. X
  190. X{
  191. X    winptr w;
  192. X    int xnear, ynear;
  193. X
  194. X    w=first_win;
  195. X
  196. X    while (w)
  197. X    {
  198. X        xnear=ynear=0;
  199. X        if(w->sx < host[no_hosts]->sx+50 && w->sx > host[no_hosts]->sx-50)
  200. X            xnear=1;    
  201. X        if(w->sy < host[no_hosts]->sy+50 && w->sx > host[no_hosts]->sy-50)
  202. X            ynear=1;
  203. X        if(xnear && ynear)
  204. X            goto SETPOS;
  205. X        w=w->next;
  206. X    }
  207. X}
  208. X
  209. X    /*
  210. X    *     Set turn thrusters off
  211. X    */
  212. X    host[no_hosts]->tl = 0;
  213. X    host[no_hosts]->tr = 0;
  214. X
  215. X    /*
  216. X    *    Not dead yet 
  217. X    */
  218. X    host[no_hosts]->exploding=0;
  219. X    host[no_hosts]->quitting=6; /* DONT EVEN ASK! */
  220. X    host[no_hosts]->damaged=0;
  221. X
  222. X    /*
  223. X    * Default is long range radar
  224. X    */
  225. X    host[no_hosts]->short_range_radar = 0;
  226. X
  227. X/* Not used
  228. X    host[no_hosts]->hp_curr=host[no_hosts]->hp_max=100;
  229. X*/
  230. X
  231. X    /*
  232. X    *     Default is regen on shields and no cloaking
  233. X    */
  234. X    host[no_hosts]->shield_regen=1;
  235. X    host[no_hosts]->cloaking=0;
  236. X
  237. X    /*
  238. X    *     Define the repair countdown which sets how fast repairs are done
  239. X    */
  240. X    host[no_hosts]->rep_count=REPAIR_RATE;
  241. X
  242. X    /*
  243. X    *     Set person and ship name
  244. X    * currently displayname
  245. X    */
  246. X    host[no_hosts]->Name[0]=0;
  247. X    host[no_hosts]->Ship[0]=0;
  248. X    host[no_hosts]->password[0]=0;
  249. X    host[no_hosts]->pass2[0]=0;
  250. X    /*host[no_hosts]->title[0]=0; /* used in input.c for passwd check! */
  251. X
  252. X    /*
  253. X    *     Starting credits
  254. X    *
  255. X    host[no_hosts]->credits = 10000; */
  256. X    host[no_hosts]->earned = 0;
  257. X
  258. X    /*
  259. X    *    Names for items
  260. X    *    these should be global
  261. X    */
  262. X    strcpy(host[no_hosts]->name[ENGINE],"Engine           ");
  263. X    strcpy(host[no_hosts]->name[CLOAK],"Jammer           ");
  264. X    strcpy(host[no_hosts]->name[SHORTRR],"Short Range Radar");
  265. X    strcpy(host[no_hosts]->name[LONGRR],"Long Range Radar ");
  266. X    strcpy(host[no_hosts]->name[TC],"TC               ");
  267. X    strcpy(host[no_hosts]->name[REPAIR],"Repair           ");
  268. X    strcpy(host[no_hosts]->name[SOLAR],"Solar            ");
  269. X    strcpy(host[no_hosts]->name[IDLE],"Idle                 "); 
  270. X
  271. X
  272. X    /*
  273. X    *    Set default item states
  274. X    *    
  275. X    host[no_hosts]->state[ENGINE]=100;
  276. X    host[no_hosts]->state[CLOAK]=100;
  277. X    host[no_hosts]->state[SHORTRR]=100;
  278. X    host[no_hosts]->state[LONGRR]=100;
  279. X    host[no_hosts]->state[TC]=100;
  280. X    host[no_hosts]->state[REPAIR]=100;
  281. X    host[no_hosts]->state[SOLAR]=100;
  282. X
  283. X    /* 
  284. X    *    Set default quality
  285. X    *    the radars have no associated qualities
  286. X    
  287. X    host[no_hosts]->quality[ENGINE]=3;
  288. X    host[no_hosts]->quality[REPAIR]=2;
  289. X    host[no_hosts]->quality[LONGRR]=0;
  290. X    host[no_hosts]->quality[SHORTRR]=0;
  291. X    host[no_hosts]->quality[TC]=0;
  292. X    host[no_hosts]->quality[CLOAK]=3;
  293. X    host[no_hosts]->quality[SOLAR]=2;
  294. X
  295. X    /*
  296. X    *    Set the probability of an item being hit
  297. X    *    Why is this here?
  298. X    */
  299. X    host[no_hosts]->prob[TC] = 300;
  300. X    host[no_hosts]->prob[ENGINE] = 600;
  301. X    host[no_hosts]->prob[CLOAK] = 1600;
  302. X    host[no_hosts]->prob[SOLAR] = 600;
  303. X    host[no_hosts]->prob[SHORTRR] = 1800;
  304. X    host[no_hosts]->prob[LONGRR] = 1400;
  305. X    host[no_hosts]->prob[REPAIR] = 400;
  306. X
  307. X    /*
  308. X    *     Not repairing anything or targeting anything yet
  309. X    */
  310. X    host[no_hosts]->rep_which = IDLE;
  311. X    host[no_hosts]->targeting = NULL;
  312. X    host[no_hosts]->star=0;
  313. X
  314. X    /*
  315. X    *     Did we change weapons last frame (NO)
  316. X    */
  317. X    host[no_hosts]->changed_last_frame = 0;
  318. X
  319. X
  320. X    /*
  321. X    *    Load all weapons
  322. X    */
  323. X    for(i=0;i<NO_WEAPONS;i++)
  324. X    {
  325. X        host[no_hosts]->load_status[i] = 0;
  326. X        host[no_hosts]->weap_on_status[i] = 1;
  327. X    }
  328. X
  329. X    /*
  330. X    *    Open the radar and stats windows
  331. X    */
  332. X    if(!npc || npcwin)
  333. X    {
  334. X        if(npcwin)
  335. X        {
  336. X            host[no_hosts]->radar=xfe_open_sub_window(npcwinname,"radar",200,200,665,0);
  337. X            host[no_hosts]->stats=xfe_open_sub_window(npcwinname,"stats",480,415,665,235);
  338. X        }
  339. X        else    
  340. X        {
  341. X            host[no_hosts]->radar=xfe_open_sub_window(host_name,"radar",200,200,665,0);
  342. X            host[no_hosts]->stats=xfe_open_sub_window(host_name,"stats",480,415,665,235);
  343. X        }
  344. X    }
  345. X    /*
  346. X    *    Set the initial pic (i.e facing up)
  347. X    *    this is required else SEGV
  348. X    */
  349. X    host[no_hosts]->pic = 0;
  350. X
  351. X    /*
  352. X    *    Remove all weapons from ship
  353. X    *
  354. X    for(i=0;i<NO_WEAPONS;i++)
  355. X        host[no_hosts]->does_have_weap[i] = 1;
  356. X
  357. X    /*
  358. X    *    Give only a pulse rifle by default
  359. X    *
  360. X    host[no_hosts]->does_have_weap[WEAP_PULSE] = 1;
  361. X
  362. X    /*
  363. X    *    Set that the shield graphs were not displayed last frame
  364. X    */
  365. X    host[no_hosts]->lls = host[no_hosts]->lrs = host[no_hosts]->lbs = host[no_hosts]->le = -1;
  366. X
  367. X    /*
  368. X    *    Read all the weapon bitmaps
  369. X    */
  370. X    if(!npc || npcwin)
  371. X        read_all_weaps(host[no_hosts]);
  372. X
  373. X    /*
  374. X    *    Clear the screen
  375. X    */
  376. X    if(!npc || npcwin)
  377. X        xfe_clear(host[no_hosts]);
  378. X    
  379. X    if(!npc || npcwin)
  380. X    {
  381. X        /*
  382. X        *    Initialise the hidden buffer GC
  383. X        */    
  384. X#ifdef NCD
  385. X        gcv.function = GXand;
  386. X#else
  387. X        gcv.function = GXxor;
  388. X#endif /* NCD */
  389. X        gcv.background = host[no_hosts]->theWhitePixel;
  390. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  391. X        gcv.graphics_exposures = False;
  392. X        host[no_hosts]->bbgc = 
  393. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  394. X                    (unsigned long)(GCFunction|GCForeground|GCBackground),&gcv);
  395. X    
  396. X        gcv.function = GXnor;
  397. X        gcv.background = host[no_hosts]->theWhitePixel;
  398. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  399. X        gcv.fill_style = FillStippled;
  400. X        gcv.stipple = XCreateBitmapFromData(host[no_hosts]->theDisplay,host[no_hosts]->theWindow,stipple_bits,stipple_width,stipple_height);
  401. X        gcv.graphics_exposures = False;
  402. X        host[no_hosts]->fillgc = 
  403. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  404. X                    (unsigned long)(GCFunction|GCForeground|GCBackground|GCFillStyle|GCStipple),&gcv);
  405. X
  406. X        gcv.function = GXnor;
  407. X        gcv.background = host[no_hosts]->theWhitePixel;
  408. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  409. X        gcv.fill_style = FillStippled;
  410. X        gcv.stipple = XCreateBitmapFromData(host[no_hosts]->theDisplay,host[no_hosts]->theWindow,jam25_bits,jam25_width,jam25_height);
  411. X        gcv.graphics_exposures = False;
  412. X        host[no_hosts]->jam25= 
  413. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  414. X                    (unsigned long)(GCFunction|GCForeground|GCBackground|GCFillStyle|GCStipple),&gcv);
  415. X    
  416. X        gcv.function = GXnor;
  417. X        gcv.background = host[no_hosts]->theWhitePixel;
  418. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  419. X        gcv.fill_style = FillStippled;
  420. X        gcv.stipple = XCreateBitmapFromData(host[no_hosts]->theDisplay,host[no_hosts]->theWindow,jam50_bits,jam50_width,jam50_height);
  421. X        gcv.graphics_exposures = False;
  422. X        host[no_hosts]->jam50= 
  423. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  424. X                    (unsigned long)(GCFunction|GCForeground|GCBackground|GCFillStyle|GCStipple),&gcv);
  425. X    
  426. X        gcv.function = GXnor;
  427. X        gcv.background = host[no_hosts]->theWhitePixel;
  428. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  429. X        gcv.fill_style = FillStippled;
  430. X        gcv.stipple = XCreateBitmapFromData(host[no_hosts]->theDisplay,host[no_hosts]->theWindow,jam75_bits,jam75_width,jam75_height);
  431. X        gcv.graphics_exposures = False;
  432. X        host[no_hosts]->jam75= 
  433. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  434. X                    (unsigned long)(GCFunction|GCForeground|GCBackground|GCFillStyle|GCStipple),&gcv);
  435. X    
  436. X        gcv.function = GXnor;
  437. X        gcv.background = host[no_hosts]->theWhitePixel;
  438. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  439. X        gcv.fill_style = FillStippled;
  440. X        gcv.stipple = XCreateBitmapFromData(host[no_hosts]->theDisplay,host[no_hosts]->theWindow,jam100_bits,jam100_width,jam100_height);
  441. X        gcv.graphics_exposures = False;
  442. X        host[no_hosts]->jam100= 
  443. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  444. X                    (unsigned long)(GCFunction|GCForeground|GCBackground|GCFillStyle|GCStipple),&gcv);
  445. X
  446. X        gcv.function = GXnor;
  447. X        gcv.background = host[no_hosts]->theWhitePixel;
  448. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  449. X        gcv.graphics_exposures = False;
  450. X        host[no_hosts]->bmgc = 
  451. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  452. X                    (unsigned long)(GCFunction|GCForeground|GCBackground),&gcv);
  453. X    
  454. X        gcv.function = GXset;
  455. X        gcv.background = host[no_hosts]->theWhitePixel;
  456. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  457. X        gcv.graphics_exposures = False;
  458. X    
  459. X        host[no_hosts]->bbcleargc = 
  460. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  461. X                    (unsigned long)(GCFunction|GCForeground|GCBackground),&gcv);
  462. X        /*
  463. X        *    Create the title bitmap from the included file
  464. X        */
  465. X        title = XCreateBitmapFromData(host[no_hosts]->theDisplay,host[no_hosts]->theWindow,title_bits,title_width,title_height);
  466. X    
  467. X        /*
  468. X        *    Create the GC for blitting the hidden buffer to the window
  469. X        */
  470. X        gcv.function = GXcopy;
  471. X        gcv.background = host[no_hosts]->theWhitePixel;
  472. X        gcv.foreground = host[no_hosts]->theBlackPixel;
  473. X        gcv.graphics_exposures = False;
  474. X        host[no_hosts]->blgc = 
  475. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->back_buffer,
  476. X                    (unsigned long)(GCFunction|GCForeground|GCBackground),&gcv);
  477. X
  478. X        gcv.function = GXcopy;     /* need diff GC, to draw black back, and white fore */
  479. X        gcv.foreground = host[no_hosts]->theWhitePixel;
  480. X        gcv.background = host[no_hosts]->theBlackPixel;
  481. X        gcv.graphics_exposures = False;
  482. X        host[no_hosts]->aGC = 
  483. X            XCreateGC(host[no_hosts]->theDisplay,host[no_hosts]->theWindow, 
  484. X                (unsigned long)(GCFunction|GCForeground |GCBackground),&gcv);
  485. X    
  486. X        /* Wait for the window to be mapped (kludgy I know) */
  487. X        sleep(1);
  488. X    
  489. X        /*
  490. X        *    Show the screen title
  491. X        */
  492. X        XCopyPlane(host[no_hosts]->theDisplay,title,host[no_hosts]->theWindow,
  493. X            host[no_hosts]->blgc,0,0,title_width,title_height,(PLAYW-title_width)/2,
  494. X            (PLAYH-title_height)/2,1);    
  495. X    
  496. X        /*
  497. X        *    Throw away the bitmap
  498. X        */
  499. X        XFreePixmap(host[no_hosts]->theDisplay,title);
  500. X        XSync(host[no_hosts]->theDisplay,False);
  501. X        /*
  502. X        *    Tell the server what events we would like
  503. X        */
  504. X        XSelectInput(host[no_hosts]->theDisplay,
  505. X            host[no_hosts]->theWindow,EVENTMASK);
  506. X    
  507. X        /*
  508. X        *    Read the ship, thrust and star bitmaps
  509. X        */
  510. X/*
  511. X    read_ship(host[no_hosts]);
  512. X    read_thrusts(host[no_hosts]);
  513. X*/
  514. X        read_stars(host[no_hosts]);
  515. X
  516. X        /*
  517. X        *    Set up random 2 planes of stars
  518. X        */
  519. X        init_stars(host[no_hosts]);
  520. X    
  521. X        /*
  522. X        *    Don't want graphics exposures when copying pixmaps, thank you
  523. X        */
  524. X        XSetGraphicsExposures(host[no_hosts]->theDisplay,host[no_hosts]->theGC,False);
  525. X        XSetGraphicsExposures(host[no_hosts]->theDisplay,host[no_hosts]->bbgc,False);
  526. X        XSetGraphicsExposures(host[no_hosts]->theDisplay,host[no_hosts]->blgc,False);
  527. X        XSetGraphicsExposures(host[no_hosts]->theDisplay,host[no_hosts]->aGC,False);
  528. X        /*
  529. X        *    get the font id of the default font
  530. X        */
  531. X        fid=(XID) XGContextFromGC(host[no_hosts]->bbgc);
  532. X        host[no_hosts]->xf=XQueryFont(host[no_hosts]->theDisplay,fid);
  533. X
  534. X        /*
  535. X        ** load the junk bitmaps
  536. X        */
  537. X        load_junkmaps(host[no_hosts]);
  538. X    }
  539. X    if(npc)
  540. X    {    
  541. X        if(load_npc(host[no_hosts],host_name))
  542. X        {
  543. X            numnpcs++;
  544. X            num_npcs_alive++;
  545. X        }
  546. X        host[no_hosts]->quitting = 0;
  547. X        if(host[no_hosts]->npcwin)
  548. X            num_npcs_windows++;
  549. X    }
  550. X    no_hosts++;
  551. X    num_alive=no_hosts;
  552. X    return 1;
  553. X}
  554. END_OF_FILE
  555. if test 13587 -ne `wc -c <'add_host.c'`; then
  556.     echo shar: \"'add_host.c'\" unpacked with wrong size!
  557. fi
  558. # end of 'add_host.c'
  559. fi
  560. if test -f 'bitmaps/bomb' -a "${1}" != "-c" ; then 
  561.   echo shar: Will not clobber existing file \"'bitmaps/bomb'\"
  562. else
  563. echo shar: Extracting \"'bitmaps/bomb'\" \(186 characters\)
  564. sed "s/^X//" >'bitmaps/bomb' <<'END_OF_FILE'
  565. X#define bomb_width 9
  566. X#define bomb_height 9
  567. Xstatic char bomb_bits[] = {
  568. X   0x38, 0x00, 0xee, 0x00, 0xf2, 0x00, 0xf1, 0x01, 0xf1, 0x01, 0xf1, 0x01,
  569. X   0xf2, 0x00, 0xee, 0x00, 0x38, 0x00};
  570. END_OF_FILE
  571. if test 186 -ne `wc -c <'bitmaps/bomb'`; then
  572.     echo shar: \"'bitmaps/bomb'\" unpacked with wrong size!
  573. fi
  574. # end of 'bitmaps/bomb'
  575. fi
  576. if test -f 'update_ships.c' -a "${1}" != "-c" ; then 
  577.   echo shar: Will not clobber existing file \"'update_ships.c'\"
  578. else
  579. echo shar: Extracting \"'update_ships.c'\" \(15776 characters\)
  580. sed "s/^X//" >'update_ships.c' <<'END_OF_FILE'
  581. X/* update_ships.c - *** Routines that update ships data each frame */
  582. X
  583. Xstatic char sccs_id[] = "@(#)update_ships.c 1.26 92/11/24 XMPB";
  584. X
  585. X#include <math.h>
  586. X#include "player.h"
  587. X
  588. X/*
  589. X*    How fast shields re-energize
  590. X*    Should be in plaer.h
  591. X*/
  592. X#define SHIELD_CHARGE 1
  593. X
  594. Xextern int mysintab[],mycostab[];
  595. Xextern junkptr first_junk;
  596. Xextern winptr first_win;
  597. X
  598. Xdouble line_2_linef();
  599. X
  600. X/*
  601. X*    Move all ships and check for collisions between ships and walls
  602. X*/
  603. Xupdate_ships()
  604. X{
  605. X    winptr t,w;
  606. X    junkptr j;
  607. X    int xa,ya;
  608. X    double q;
  609. X
  610. X    int rsh=0,bsh=0,lsh=0;
  611. X    int relx,rely,mom;
  612. X
  613. X    t = first_win;
  614. X    while(t)
  615. X    {
  616. X        /*
  617. X        ** set damaged so that we know to update stats window
  618. X        */
  619. X        t->damaged=1;
  620. X    
  621. X        /* 
  622. X        *    re-energize shields 
  623. X        */
  624. X        if(t->shield_regen && !t->exploding)
  625. X        {
  626. X            if(t->shield_cnt == 0)
  627. X            {
  628. X            if((t->ls_curr < t->ls_max) && (t->energy_curr >= SHIELD_CHARGE))
  629. X            {
  630. X                if(t->ls_max - t->ls_curr > SHIELD_CHARGE)
  631. X                {
  632. X                    t->ls_curr += SHIELD_CHARGE;
  633. X                    t->energy_curr -= SHIELD_CHARGE;
  634. X                }
  635. X                else
  636. X                {
  637. X                    t->energy_curr -= (t->ls_max - t->ls_curr);
  638. X                    t->ls_curr = t->ls_max;
  639. X                }
  640. X            }
  641. X            if((t->rs_curr < t->rs_max) && (t->energy_curr >= SHIELD_CHARGE))
  642. X            {
  643. X                if(t->rs_max - t->rs_curr > SHIELD_CHARGE)
  644. X                {
  645. X                    t->rs_curr += SHIELD_CHARGE;
  646. X                    t->energy_curr -= SHIELD_CHARGE;
  647. X                }
  648. X                else
  649. X                {
  650. X                    t->energy_curr -= (t->rs_max - t->rs_curr);
  651. X                    t->rs_curr = t->rs_max;
  652. X                }
  653. X            }
  654. X            if((t->bs_curr < t->bs_max) && (t->energy_curr >= SHIELD_CHARGE))
  655. X            {
  656. X                if((t->bs_max - t->bs_curr) > SHIELD_CHARGE)
  657. X                {
  658. X                    t->bs_curr += SHIELD_CHARGE;
  659. X                    t->energy_curr -= SHIELD_CHARGE;
  660. X                }
  661. X                else
  662. X                {
  663. X                    t->energy_curr -= (t->bs_max - t->bs_curr);
  664. X                    t->bs_curr = t->bs_max;
  665. X                }
  666. X            }
  667. X            t->shield_cnt = 3;
  668. X            }
  669. X            else
  670. X            {
  671. X                t->shield_cnt--;
  672. X            }
  673. X        }    
  674. X
  675. X        if(t->tl)
  676. X        {
  677. X            if(t->angle_v > -t->max_angle_v)
  678. X                t->angle_v--;
  679. X        }
  680. X        if(t->tr)
  681. X        {
  682. X            if(t->angle_v < t->max_angle_v)
  683. X                t->angle_v++;
  684. X        }
  685. X    
  686. X        /*
  687. X        *    If the ship can thrust & they button is pressed & the boxhead 
  688. X        *    has a working engine
  689. X        */        
  690. X        if(t->t2 && enough_e_to_thr(t) && t->state[ENGINE]>0)
  691. X        {
  692. X            /*
  693. X            *    Lose energy
  694. X            */
  695. X            t->energy_curr -= THRUST_E_USE;
  696. X
  697. X            /*
  698. X            *    Calc the acceleraation
  699. X            */
  700. X            xa = (t->quality[ENGINE]*t->state[ENGINE]/100*mysintab[(int)t->angle])/4;
  701. X            ya = (t->quality[ENGINE]*t->state[ENGINE]/100*mycostab[(int)t->angle])/4;
  702. X
  703. X            
  704. X            /*
  705. X            **  if decelelerating, make it 2 *
  706. X            */
  707. X#define diffsign(x,y)    (((x)> 0) ? ((y) < 0) ? 1 : 0 : ((y) < 0) ? 0 : 1)
  708. X#define IABS(x)            (((x)>0)?x:-x)
  709. X
  710. X            if(diffsign(xa,t->xv) && IABS(t->xv) > 5000) 
  711. X                xa=2*xa;
  712. X            if(diffsign(ya,t->yv) && IABS(t->yv) > 5000) 
  713. X                ya=2*ya;
  714. X
  715. X            /*
  716. X            *    Add to the velocity of the ship
  717. X            */
  718. X            t->xv += xa;
  719. X            t->yv += ya;
  720. X        }
  721. X        else  /* not enough energy to thrust, so turn off pic */
  722. X        {    
  723. X            t->t2 = 0;
  724. X        }
  725. X
  726. X        /*
  727. X        *    Move ship with current velocity
  728. X        */    
  729. X        t->sx += t->xv/32768;
  730. X        t->sy += t->yv/32768;
  731. X        if(t->exploding > 0 && t->exploding < 450)
  732. X        {    
  733. X            if(t->watching)
  734. X            {
  735. X                t->sx = t->watching->sx;
  736. X                t->sy = t->watching->sy;
  737. X            }
  738. X/*
  739. X            int x=0,y=0;
  740. X            int n=0;
  741. X
  742. X            winptr temp = first_win;
  743. X
  744. X            while(temp)
  745. X            {
  746. X                if(temp != t)
  747. X                {
  748. X                    x += temp->sx;
  749. X                    y += temp->sy;
  750. X                    n++;
  751. X                }
  752. X                temp = temp->next;
  753. X            }
  754. X            t->sx = x/n;
  755. X            t->sy = y/n;
  756. X*/
  757. X        }
  758. X        else if(t->exploding)
  759. X        {
  760. X            t->exploding--;
  761. X        }
  762. X            
  763. X    
  764. X        /*
  765. X        *    Re-energize from solar panels
  766. X        */    
  767. X        t->energy_curr+=(5*t->quality[SOLAR]*t->state[SOLAR]/200);
  768. X        if(t->energy_curr > t->energy_max)
  769. X             t->energy_curr = t->energy_max;
  770. X
  771. X        /*
  772. X        *    If enough energy left, repairs are made on selected item
  773. X        */
  774. X        if(t->rep_which != IDLE 
  775. X            && t->energy_curr >= 10 
  776. X            && t->state[t->rep_which] < 100 
  777. X            && t->state[t->rep_which] > 0)
  778. X        {
  779. X            /*
  780. X            *    Only repair if the countdown has reached below this level
  781. X            */
  782. X            if(t->rep_count < 0.1)
  783. X            {
  784. X                /*
  785. X                *    Fix the item a bit
  786. X                */
  787. X                t->state[t->rep_which] += 1;
  788. X
  789. X                /*
  790. X                *    Suck energy
  791. X                */
  792. X                t->energy_curr -= 50/t->quality[REPAIR];
  793. X
  794. X                /*
  795. X                *    If the item is fixed, turn off repair
  796. X                */
  797. X                if(t->state[t->rep_which] == 100)
  798. X                {
  799. X                    t->rep_which = IDLE;
  800. X                }
  801. X
  802. X                /*
  803. X                *    Start counter back at start
  804. X                */
  805. X                t->rep_count = 11.0 - (double)t->quality[REPAIR];
  806. X            }
  807. X            else  /* counter not counted down enough */
  808. X            {
  809. X                /*
  810. X                *    Dec counter by amount depending on repair state
  811. X                */
  812. X                t->rep_count -= ((float)t->state[REPAIR]/100.0);
  813. X            }    
  814. X        }
  815. X        /*
  816. X        *    If item destroyed while repairing, set repair to idle
  817. X        */
  818. X        if(t->state[t->rep_which] == 0)
  819. X        {
  820. X            t->rep_which = IDLE;
  821. X        }
  822. X
  823. X        t->angle += t->angle_v;
  824. X        if(t->angle > 359)
  825. X            t->angle -= 360;
  826. X        if(t->angle < 0)
  827. X            t->angle += 360;
  828. X        t->pic = ((int)(((double)t->angle+7.5)/15.0)%24);
  829. X
  830. X        /*    
  831. X        ** If cloaking then suck the energy
  832. X        */
  833. X        if(t->state[CLOAK]!=0 && t->cloaking && (t->energy_curr >= 25/t->quality[CLOAK])) 
  834. X        {
  835. X            t->energy_curr -= 25/t->quality[CLOAK];
  836. X            if(t->state[CLOAK] >= rand()%100+1)
  837. X                untarget(t);
  838. X        }
  839. X        else t->cloaking=0;
  840. X
  841. X        /*
  842. X        *    Move to 2 planes of stars
  843. X        */
  844. X        do_stars(t);
  845. X
  846. X        /*
  847. X        *    Do pics for thrusting
  848. X        */
  849. X        update_thrust(t);
  850. X
  851. X        /*
  852. X        *    Okay, do the next ship
  853. X        */    
  854. X        t = t->next;
  855. X    }
  856. X
  857. X    /*
  858. X    *     Pre calculate all the shield positions
  859. X    */
  860. X    precalc();
  861. X
  862. X    /*
  863. X    *    Now lets do collision detection
  864. X    */
  865. X    t = first_win;
  866. X    while(t)
  867. X    {
  868. X        /*
  869. X        *    If we're dead don't check for collisions
  870. X        */
  871. X        if(t->exploding) 
  872. X            goto KLUDGE;    
  873. X
  874. X        /*
  875. X        *    Check for collisions with the four walls
  876. X        */
  877. X        if(t->sx < (-WORLDW + 50) || t->sx > (WORLDW -50)) {
  878. X        int dam;
  879. X
  880. X            /*
  881. X            *    damage is dependent on velocity
  882. X            */
  883. X            t->xv=-t->xv;
  884. X            if(t->sx < 0)
  885. X            {
  886. X                t->sx = (-WORLDW + 55);
  887. X            }
  888. X            else
  889. X            {
  890. X                t->sx = (WORLDW - 55);
  891. X            }
  892. X            dam = t->xv/32768;
  893. X            dam = dam < 0 ? -3*dam : 3*dam;
  894. X            damage_ship(t,RSH,dam);
  895. X            damage_ship(t,LSH,dam);
  896. X            damage_ship(t,BSH,dam);
  897. X        }
  898. X        if(t->sy < (-WORLDH + 50) || t->sy > (WORLDH -50)) 
  899. X        {
  900. X        int dam;
  901. X
  902. X            t->yv=-t->yv;
  903. X            if(t->sy < 0)
  904. X            {
  905. X                t->sy = (-WORLDH + 55);
  906. X            }
  907. X            else
  908. X            {
  909. X                t->sy = (WORLDH - 55);
  910. X            }
  911. X            dam = t->xv/32768;
  912. X            dam = t->yv/32768;
  913. X            dam = dam < 0 ? -3*dam : 3*dam;
  914. X            damage_ship(t,RSH,dam);
  915. X            damage_ship(t,LSH,dam);
  916. X            damage_ship(t,BSH,dam);
  917. X        }
  918. X
  919. X        /*
  920. X        *    Start at the ship after this one to check for collision with
  921. X        */
  922. X        w = t->next;
  923. X        while(w)
  924. X        {
  925. X            /*
  926. X            *    Don't allow collisions with non-existent ships
  927. X            */
  928. X            if(w->exploding)
  929. X                goto kludge3;     /* twas the easiest way :-) */
  930. X
  931. X            /* 
  932. X            *    bounding rectangle check
  933. X            */
  934. X            if((w->sx < (t->sx+100)) && (w->sx > (t->sx-100)) && (w->sy < (t->sy+100)) && (w->sy > (t->sy-100)))
  935. X            {
  936. X                int p1x,p1y;
  937. X                int p2x,p2y;
  938. X                int p3x,p3y;
  939. X
  940. X                int w1x,w1y;
  941. X                int w2x,w2y;
  942. X                int w3x,w3y;
  943. X
  944. X                double trwb,trwl,trwr,tlwl,tlwr,tlwb,tbwr,tbwl,tbwb;
  945. X                double trhits,tlhits,tbhits,wbhits,wlhits,wrhits;
  946. X
  947. X                /*
  948. X                *    Calculate the points of the three shield lines
  949. X                *    for this ship
  950. X                */
  951. X                p1x = t->p1x;
  952. X                p1y = t->p1y;
  953. X                p2x = t->p2x;
  954. X                p2y = t->p2y;
  955. X                p3x = t->p3x;
  956. X                p3y = t->p3y;
  957. X
  958. X                /*
  959. X                *    And the other    
  960. X                */
  961. X                w1x = w->p1x;
  962. X                w1y = w->p1y;
  963. X                w2x = w->p2x;
  964. X                w2y = w->p2y;
  965. X                w3x = w->p3x;
  966. X                w3y = w->p3y;
  967. X
  968. X                /*
  969. X                *    test for intersection of the 9 lines
  970. X                */    
  971. X                trwr = line_2_linef(p1x,p1y,p2x,p2y,w1x,w1y,w2x,w2y);
  972. X                trwl = line_2_linef(p1x,p1y,p2x,p2y,w1x,w1y,w3x,w3y);
  973. X                trwb = line_2_linef(p1x,p1y,p2x,p2y,w3x,w3y,w2x,w2y);
  974. X
  975. X                tlwr = line_2_linef(p1x,p1y,p3x,p3y,w1x,w1y,w2x,w2y);
  976. X                tlwl = line_2_linef(p1x,p1y,p3x,p3y,w1x,w1y,w3x,w3y);
  977. X                tlwb = line_2_linef(p1x,p1y,p3x,p3y,w3x,w3y,w2x,w2y);
  978. X
  979. X                tbwr = line_2_linef(p3x,p3y,p2x,p2y,w1x,w1y,w2x,w2y);
  980. X                tbwl = line_2_linef(p3x,p3y,p2x,p2y,w1x,w1y,w3x,w3y);
  981. X                tbwb = line_2_linef(p3x,p3y,p2x,p2y,w3x,w3y,w2x,w2y);
  982. X                
  983. X                /*
  984. X                *    How many hits to w
  985. X                */    
  986. X                wrhits = trwr+tlwr+tbwr;
  987. X                wlhits = trwl+tlwl+tbwl;
  988. X                wbhits = trwb+tlwb+tbwb;
  989. X
  990. X                /*
  991. X                *     And hown may on t's shields
  992. X                */
  993. X                trhits = trwr+trwl+trwb;
  994. X                tlhits = tlwr+tlwl+tlwb;
  995. X                tbhits = tbwr+tbwl+tbwb;
  996. X
  997. X                /*    
  998. X                *    A value of -9.0 on a shield means that there were no
  999. X                *    hits to it, so if there are no hits to any of w's
  1000. X                *    shields, then there was no collision
  1001. X                */
  1002. X                if(wrhits > -9.0 || wlhits > -9.0 || wbhits > -9.0)
  1003. X                {
  1004. X                    int wtx,wty,twx,twy;
  1005. X                    double scale;
  1006. X
  1007. X                    /* 
  1008. X                    *    Ok the ships have hit 
  1009. X                    */
  1010. X
  1011. X                    int dam;
  1012. X                    long int temp;
  1013. X                    int relxv,relyv;
  1014. X                    int tdam,wdam,tcount,wcount;
  1015. X
  1016. X                    /*
  1017. X                    *    Find out the relative velocity, use to calc damage
  1018. X                    */
  1019. X                    relxv = (w->xv - t->xv)/32768;
  1020. X                    relyv = (w->yv - t->yv)/32768;
  1021. X
  1022. X                    dam = relxv*relxv+relyv*relyv;
  1023. X                    dam = 10*(int)(sqrt((double)(dam)));
  1024. X            
  1025. X                    /*
  1026. X                    *    Find out how many of each ships shields was hit
  1027. X                    *    to spread damage about
  1028. X                    */    
  1029. X                    wcount = 0;
  1030. X                    tcount = 0;
  1031. X                    if(wrhits > -9.0)
  1032. X                        wcount++;
  1033. X                    if(wlhits > -9.0)
  1034. X                        wcount++;
  1035. X                    if(wbhits > -9.0)
  1036. X                        wcount++;
  1037. X
  1038. X                    if(trhits > -9.0)
  1039. X                        tcount++;
  1040. X                    if(tlhits > -9.0)
  1041. X                        tcount++;
  1042. X                    if(tbhits > -9.0)
  1043. X                        tcount++;
  1044. X
  1045. X                    if(tcount)
  1046. X                        tdam = dam/tcount;
  1047. X                    else
  1048. X                        tdam = 0;
  1049. X                    if(wcount)
  1050. X                        wdam = dam/wcount;
  1051. X                    else 
  1052. X                        wdam = 0;
  1053. X
  1054. X                    /*
  1055. X                    *    Earned credits goes up with damage
  1056. X                    */
  1057. X                    scale=(double)(t->ship_value+t->earned)/(double)(w->ship_value+w->earned);
  1058. X
  1059. X                    if(scale > 10)
  1060. X                        scale=10;
  1061. X                    if(scale < 0.1)
  1062. X                        scale=0.1;
  1063. X                    t->earned += (int) (5.0*(double)dam*(1.0/scale));
  1064. X                    w->earned += (int) (5.0*(double)dam*scale);
  1065. X
  1066. X                    /*
  1067. X                    *    Now put the damage on the ship
  1068. X                    */
  1069. X                    if(wrhits > -9.0)
  1070. X                    {
  1071. X                        if(damage_ship(w,RSH,wdam))
  1072. X                        {
  1073. X                            t->kills++;
  1074. X                        }
  1075. X                    }
  1076. X                    if(wlhits > -9.0)
  1077. X                    {
  1078. X                        if(damage_ship(w,LSH,wdam))
  1079. X                        {
  1080. X                            t->kills++;
  1081. X                        }
  1082. X                    }
  1083. X                    if(wbhits > -9.0)
  1084. X                    {
  1085. X                        if(damage_ship(w,BSH,wdam))
  1086. X                        {
  1087. X                            t->kills++;
  1088. X                        }
  1089. X                    }
  1090. X
  1091. X                    if(trhits > -9.0)
  1092. X                    {
  1093. X                        if(damage_ship(t,RSH,tdam))
  1094. X                        {
  1095. X                            w->kills++;
  1096. X                        }
  1097. X                    }
  1098. X                    if(tlhits > -9.0)
  1099. X                    {
  1100. X                        if(damage_ship(t,LSH,tdam))
  1101. X                        {
  1102. X                            w->kills++;
  1103. X                        }
  1104. X                    }
  1105. X                    if(tbhits > -9.0)
  1106. X                    {
  1107. X                        if(damage_ship(t,BSH,tdam))
  1108. X                        {
  1109. X                            w->kills++;
  1110. X                        }
  1111. X                    }
  1112. X
  1113. X                    /*
  1114. X                    *    Swap velocities for quick and easy momentum
  1115. X                    */
  1116. X
  1117. X                    w->sx += t->xv/32768;
  1118. X                    w->sy += t->yv/32768;
  1119. X                    t->sx += w->xv/32768;
  1120. X                    t->sy += w->yv/32768;
  1121. X
  1122. X/* Old turn nose on bug ... */
  1123. X
  1124. X                    wtx = mycostab[(w->angle)%360]*w->angle_v/2;
  1125. X                    wty = mysintab[(w->angle)%360]*w->angle_v/2;
  1126. X                    twx = mycostab[(t->angle)%360]*t->angle_v/2;
  1127. X                    twy = mysintab[(t->angle)%360]*t->angle_v/2;
  1128. X
  1129. X                    temp = w->xv+wtx;
  1130. X                    w->xv = t->xv+twx;
  1131. X                    t->xv = temp;
  1132. X
  1133. X                    temp = w->yv+wty;
  1134. X                    w->yv = t->yv+twy;
  1135. X                    t->yv = temp;
  1136. X
  1137. X
  1138. X
  1139. X#define SGN(x)    ((x)>0?1:-1)
  1140. X
  1141. X
  1142. X/* YATNF */
  1143. X                    temp=t->angle_v;
  1144. X                    t->angle_v=-w->angle_v;
  1145. X                    w->angle_v=-temp;
  1146. X
  1147. X                
  1148. X/* New turn nose bug fix ... 
  1149. X
  1150. X                    w->yv = -SGN(w->yv)*327680+w->yv; 
  1151. X                    w->xv = -SGN(w->xv)*327680+w->xv; 
  1152. X
  1153. X                    t->xv = -SGN(t->xv)*327680+t->xv; 
  1154. X                    t->yv = -SGN(t->yv)*327680+t->yv; 
  1155. X
  1156. X                    temp = w->xv;
  1157. X                    w->xv = t->xv;
  1158. X                    t->xv = temp;
  1159. X
  1160. X                    temp = w->yv;
  1161. X                    w->yv = t->yv;
  1162. X                    t->yv = temp;
  1163. X
  1164. X                    w->sx +=w->xv/32768;
  1165. X                    w->sy +=w->yv/32768;
  1166. X
  1167. X                    t->sx +=t->xv/32768;
  1168. X                    t->sy +=t->yv/32768;
  1169. X*/
  1170. X                }
  1171. X            }
  1172. Xkludge3:
  1173. X            w = w->next;
  1174. X        }
  1175. X        /*
  1176. X        *    Check for collision with junk items
  1177. X        */
  1178. X
  1179. X        j = first_junk;
  1180. X        while(j)
  1181. X        {
  1182. X            if((j->type <= BIGROCK)&&(j->sx < (t->sx+75)) && (j->sx > (t->sx-75)) && (j->sy < (t->sy+75)) && (j->sy > (t->sy-75)))
  1183. X            {
  1184. X                int m2,c2,r2;
  1185. X                int z;
  1186. X
  1187. X                rsh=0;bsh=0;lsh=0;
  1188. X            
  1189. X                if(j->type == BIGROCK)
  1190. X                {
  1191. X                    r2 = 25;
  1192. X                    mom = 2;
  1193. X                }
  1194. X                else if(j->type == MEDROCK)
  1195. X                {
  1196. X                    r2 = 11;
  1197. X                    mom = 9;
  1198. X                }
  1199. X                else if(j->type == SMALLROCK)
  1200. X                {
  1201. X                    r2 = 5;
  1202. X                    mom = 125;
  1203. X                }
  1204. X                rsh = line_2_circle(t->p1x,t->p1y,t->p2x,t->p2y,j->sx,j->sy,r2);
  1205. X                lsh = line_2_circle(t->p1x,t->p1y,t->p3x,t->p3y,j->sx,j->sy,r2);
  1206. X                bsh = line_2_circle(t->p3x,t->p3y,t->p2x,t->p2y,j->sx,j->sy,r2);
  1207. XAARGH:
  1208. X                relx = t->xv - j->xv;
  1209. X                rely = t->yv - j->yv;
  1210. X                if(rsh)
  1211. X                {
  1212. X                    damage_ship(t,RSH,2*(int)sqrt((double)(relx/32768*relx/32768+rely/32768*rely/32768)/mom));
  1213. X                    if(mom < 5)
  1214. X                    {
  1215. X                        z = t->xv;
  1216. X                        t->xv = j->xv;
  1217. X                        j->xv = z;
  1218. X                        z = t->yv;
  1219. X                        t->yv = j->yv;
  1220. X                        j->yv = z;
  1221. X                    }
  1222. X                    else
  1223. X                    {
  1224. X                    t->xv = t->xv+(int)((double)-relx*(((double)2.0)/((double)mom+1.0)))/mom;
  1225. X                    t->yv = t->yv+(int)((double)-rely*(((double)2.0)/((double)mom+1.0)))/mom;
  1226. X                    j->xv = t->xv+(int)((double)-relx*((1.0-(double)mom)/((double)mom+1.0)));
  1227. X                    j->yv = t->yv+(int)((double)-rely*((1.0-(double)mom)/((double)mom+1.0)));
  1228. X                    }
  1229. X
  1230. X                    j->sx+=j->xv/32768;
  1231. X                    j->sy+=j->yv/32768;
  1232. X                    t->sx+=t->xv/32768;
  1233. X                    t->sy+=t->yv/32768;
  1234. X                }
  1235. X                else
  1236. X                if(lsh)
  1237. X                {
  1238. X                    damage_ship(t,LSH,2*(int)sqrt((double)(relx/32768*relx/32768+rely/32768*rely/32768)/mom));
  1239. X                    if(mom < 5)
  1240. X                    {
  1241. X                        z = t->xv;
  1242. X                        t->xv = j->xv;
  1243. X                        j->xv = z;
  1244. X                        z = t->yv;
  1245. X                        t->yv = j->yv;
  1246. X                        j->yv = z;
  1247. X                    }
  1248. X                    else
  1249. X                    {
  1250. X                    t->xv = t->xv+(int)((double)-relx*(((double)2.0)/((double)mom+1.0)))/mom;
  1251. X                    t->yv = t->yv+(int)((double)-rely*(((double)2.0)/((double)mom+1.0)))/mom;
  1252. X                    j->xv = t->xv+(int)((double)-relx*((1.0-(double)mom)/((double)mom+1.0)));
  1253. X                    j->yv = t->yv+(int)((double)-rely*((1.0-(double)mom)/((double)mom+1.0)));
  1254. X                    }
  1255. X                    /*t->xv -= relx/mom;
  1256. X                    t->yv -= rely/mom;
  1257. X                    j->xv += relx*2;
  1258. X                    j->yv += rely*2;
  1259. X*/
  1260. X
  1261. X                    j->sx+=j->xv/32768;
  1262. X                    j->sy+=j->yv/32768;
  1263. X                    t->sx+=t->xv/32768;
  1264. X                    t->sy+=t->yv/32768;
  1265. X                }
  1266. X                else
  1267. X                if(bsh)
  1268. X                {
  1269. X                    damage_ship(t,BSH,2*(int)sqrt((double)(relx/32768*relx/32768+rely/32768*rely/32768)/mom));
  1270. X                    if(mom < 5)
  1271. X                    {
  1272. X                        z = t->xv;
  1273. X                        t->xv = j->xv;
  1274. X                        j->xv = z;
  1275. X                        z = t->yv;
  1276. X                        t->yv = j->yv;
  1277. X                        j->yv = z;
  1278. X                    }
  1279. X                    else
  1280. X                    {
  1281. X                    t->xv = t->xv+(int)((double)-relx*(((double)2.0)/((double)mom+1.0)))/mom;
  1282. X                    t->yv = t->yv+(int)((double)-rely*(((double)2.0)/((double)mom+1.0)))/mom;
  1283. X                    j->xv = t->xv+(int)((double)-relx*((1.0-(double)mom)/((double)mom+1.0)));
  1284. X                    j->yv = t->yv+(int)((double)-rely*((1.0-(double)mom)/((double)mom+1.0)));
  1285. X                    }
  1286. X/*                    t->xv -= relx/mom;
  1287. X                    t->yv -= rely/mom;
  1288. X                    j->xv += relx*2;
  1289. X                    j->yv += rely*2;
  1290. X*/
  1291. X
  1292. X                    j->sx+=j->xv/32768;
  1293. X                    j->sy+=j->yv/32768;
  1294. X                    t->sx+=t->xv/32768;
  1295. X                    t->sy+=t->yv/32768;
  1296. X                }
  1297. X                else
  1298. X                {
  1299. X                    int nx,ny;
  1300. X                    double r,l,b;
  1301. X                    nx = j->sx+j->xv/32768;
  1302. X                    ny = j->sy+j->yv/32768;
  1303. X                    r = line_2_linef(j->sx,j->sy,nx,ny,t->p1x,t->p1y,t->p2x,t->p2y);
  1304. X                    b = line_2_linef(j->sx,j->sy,nx,ny,t->p3x,t->p3y,t->p2x,t->p2y);
  1305. X                    l = line_2_linef(j->sx,j->sy,nx,ny,t->p3x,t->p3y,t->p1x,t->p1y);
  1306. X
  1307. X
  1308. X                    if(r > b)
  1309. X                    {
  1310. X                        if(r > l)
  1311. X                            q = r;
  1312. X                        else
  1313. X                            q = l;
  1314. X                    }
  1315. X                    else
  1316. X                    {    
  1317. X                        if(b > l)
  1318. X                            q = b;
  1319. X                        else
  1320. X                            q = l;
  1321. X                    }
  1322. X    
  1323. X                    if(r == q && r > -3.0)
  1324. X                    {
  1325. X                        rsh = 1;
  1326. X                        goto AARGH;
  1327. X                    }
  1328. X                    else
  1329. X                    if(l == q && l > -3.0)
  1330. X                    {
  1331. X                        lsh = 1;
  1332. X                        goto AARGH;
  1333. X                    }
  1334. X                    else
  1335. X                    if(b == q && b > -3.0)
  1336. X                    {
  1337. X                        bsh = 1;
  1338. X                        goto AARGH;
  1339. X                    }
  1340. X                }
  1341. X            }
  1342. X/*
  1343. X            if(lsh || rsh || bsh)
  1344. X            {
  1345. X                int speed_coll;
  1346. X                junkptr jj;
  1347. X                speed_coll = (int)sqrt((double)(relx/32768*relx/32768+rely/32768*rely/32768));
  1348. X                if(j->type == BIGROCK && speed_coll > 10)
  1349. X                {
  1350. X                    int i;
  1351. X
  1352. X                    jj = j->next;
  1353. X                    add_junk(MEDROCK,j->sx,j->sy,j->xv,j->yv+40*32768);    
  1354. X                    add_junk(MEDROCK,j->sx,j->sy,j->xv+(33)*32768,j->yv+(-33)*32768);    
  1355. X                    add_junk(MEDROCK,j->sx,j->sy,j->xv+(-33)*32768,j->yv+(-33)*32768);    
  1356. X                    free_junk(j);
  1357. X                    j = jj;
  1358. X                }
  1359. X                else
  1360. X                if(j->type == MEDROCK && speed_coll > 100)
  1361. X                {
  1362. X                }    
  1363. X                else
  1364. X                    j = j->next;
  1365. X            }    
  1366. X            else
  1367. X*/
  1368. X                j = j->next;
  1369. X        }
  1370. XKLUDGE:
  1371. X        t = t->next;
  1372. X    }
  1373. X}
  1374. END_OF_FILE
  1375. if test 15776 -ne `wc -c <'update_ships.c'`; then
  1376.     echo shar: \"'update_ships.c'\" unpacked with wrong size!
  1377. fi
  1378. # end of 'update_ships.c'
  1379. fi
  1380. if test -f 'update_win.c' -a "${1}" != "-c" ; then 
  1381.   echo shar: Will not clobber existing file \"'update_win.c'\"
  1382. else
  1383. echo shar: Extracting \"'update_win.c'\" \(5068 characters\)
  1384. sed "s/^X//" >'update_win.c' <<'END_OF_FILE'
  1385. X/* update_win.c - ***  */
  1386. X
  1387. Xstatic char sccs_id[] = "@(#)update_win.c 1.18 92/11/11 XMPB";
  1388. X#include "player.h"
  1389. X
  1390. Xextern int mysintab[],mycostab[];
  1391. Xextern struct laser lasers[];
  1392. Xextern int no_lasers;
  1393. Xextern junkptr first_junk;
  1394. Xextern winptr first_win;
  1395. X
  1396. Xupdate_win_pics()
  1397. X{
  1398. X    int i,j,k;
  1399. X    int tx,ty;
  1400. X    junkptr junk;
  1401. X    winptr temp,t;
  1402. X    int otherx[MAXHOST],othery[MAXHOST];
  1403. X    char othername[MAXHOST][MAX_NAME_SIZE];
  1404. X    int other_vis,t1,t2,t3,op,opic[MAXHOST],ot1[MAXHOST],ot2[MAXHOST];
  1405. X    winptr otherptr[MAXHOST];
  1406. X    int ot3[MAXHOST];
  1407. X
  1408. X    temp = first_win;
  1409. X    while(temp != NULL)
  1410. X    {
  1411. X
  1412. X        if(temp->quitting || (temp->npc && !temp->npcwin) )
  1413. X            goto Kludge;
  1414. X        other_vis = 0;
  1415. X        i =0;
  1416. X        t = first_win;
  1417. X        while(t)
  1418. X        {
  1419. X            if(t != temp)
  1420. X            {
  1421. X                otherx[i] = (PLAYW/2 - temp->sx+t->sx);
  1422. X                othery[i] = (PLAYH/2 - t->sy+temp->sy);
  1423. X                if(!t->cloaking)
  1424. X                    strcpy(othername[i],t->Name); 
  1425. X                else
  1426. X                    strcpy(othername[i]," ");
  1427. X                ot1[i] = t->t1;
  1428. X                ot2[i] = t->t2;
  1429. X                ot3[i] = t->t3;
  1430. X                opic[i] = t->angle;
  1431. X                otherptr[i]=t;
  1432. X                if((otherx[i] < (PLAYW +OFFSET))&&(otherx[i] > -OFFSET) && (othery[i] < (PLAYH +OFFSET)) && (othery[i] > -OFFSET) && !t->exploding)
  1433. X                {
  1434. X                    other_vis = 1;
  1435. X                    i++;
  1436. X                }
  1437. X            }
  1438. X            t = t->next;
  1439. X        }
  1440. X        XFillRectangle(temp->theDisplay,temp->back_buffer,temp->bbcleargc,0,0,PLAYW+2*OFFSET,PLAYH+2*OFFSET);
  1441. X
  1442. X        if(temp->exploding==499)
  1443. X        {
  1444. X            temp->exploding--;
  1445. X            XFillRectangle(temp->theDisplay,temp->back_buffer,temp->bbgc,0,0,PLAYW+2*OFFSET,PLAYH+2*OFFSET);
  1446. X        }
  1447. X        if(!temp->exploding)    
  1448. X        {
  1449. X               disp_ship(temp,temp->angle,PLAYW/2,PLAYH/2,temp->t1,temp->t2,temp->t3, temp);
  1450. X/*
  1451. X            if((temp->rs_curr) > temp->rs_max/3 || (!(rand()%((temp->rs_max/3-temp->rs_curr)/40+1))))
  1452. X            XDrawLine(temp->theDisplay,temp->back_buffer,temp->bbgc,OFFSET+PLAYW/2+50*mysintab[temp->angle]/32768,OFFSET+PLAYH/2-50*mycostab[temp->angle]/32768,OFFSET+PLAYW/2+40*mysintab[(temp->angle+135)%360]/32768,OFFSET+PLAYH/2-40*mycostab[(temp->angle+135)%360]/32768);
  1453. X            if((temp->ls_curr) > temp->ls_max/3 || (!(rand()%((temp->ls_max/3-temp->ls_curr)/40+1))))
  1454. X            XDrawLine(temp->theDisplay,temp->back_buffer,temp->bbgc,OFFSET+PLAYW/2+50*mysintab[temp->angle]/32768,OFFSET+PLAYH/2-50*mycostab[temp->angle]/32768,OFFSET+PLAYW/2+40*mysintab[(temp->angle+225)%360]/32768,OFFSET+PLAYH/2-40*mycostab[(temp->angle+225)%360]/32768);
  1455. X            if((temp->bs_curr) > temp->bs_max/3 || (!(rand()%((temp->bs_max/3-temp->bs_curr)/40+1))))
  1456. X            XDrawLine(temp->theDisplay,temp->back_buffer,temp->bbgc,OFFSET+PLAYW/2+40*mysintab[(temp->angle+225)%360]/32768,OFFSET+PLAYH/2-40*mycostab[(temp->angle+225)%360]/32768,OFFSET+PLAYW/2+40*mysintab[(temp->angle+135)%360]/32768,OFFSET+PLAYH/2-40*mycostab[(temp->angle+135)%360]/32768);
  1457. X*/
  1458. X        }
  1459. X        disp_all_items(temp);
  1460. X
  1461. X        /*
  1462. X        *    Draw all of the junk items
  1463. X        */
  1464. X        junk = first_junk;
  1465. X        while(junk)
  1466. X        {
  1467. X            int x,y;
  1468. X
  1469. X            x = (PLAYW/2 - temp->sx+junk->sx);
  1470. X            x -= temp->j_w[junk->type]/2;
  1471. X            y = (PLAYH/2 - junk->sy+temp->sy);
  1472. X            y -= temp->j_h[junk->type]/2;
  1473. X            if(x < PLAYW+OFFSET && x > 0-OFFSET && y < PLAYH+OFFSET && y > -OFFSET)
  1474. X            {
  1475. X                /*
  1476. X                *    Ok its visible
  1477. X                */
  1478. X    
  1479. X                switch(junk->type)
  1480. X                {
  1481. X                    case DEBRIS1:
  1482. X                    case DEBRIS2:
  1483. X                    case DEBRIS3:
  1484. X                    case CLOUD1:
  1485. X                    case CLOUD2:
  1486. X                    case CLOUD3:
  1487. X                    case CLOUD4:
  1488. X                    case CLOUD5:
  1489. X                    case CLOUD6:
  1490. X                    case DEADDUDE:
  1491. X                    case SMALLROCK:
  1492. X                    case MEDROCK:
  1493. X                    case BIGROCK:
  1494. X                    {
  1495. X                        XCopyPlane(temp->theDisplay,temp->junk_pm[junk->type],
  1496. X                            temp->back_buffer,temp->bbgc,0,0,
  1497. X                            temp->j_w[junk->type],temp->j_h[junk->type],
  1498. X                            x+OFFSET,y+OFFSET,1);
  1499. X                    }
  1500. X                    break;
  1501. X                    default:
  1502. X                        xmpb_error("The programmers are gits!\n");
  1503. X                        break;
  1504. X                }
  1505. X            }
  1506. X            junk = junk->next;
  1507. X        }
  1508. X        for(j=0;j<i;j++)
  1509. X        {        
  1510. X            int dr, far, fdr;
  1511. X            XCharStruct or;
  1512. X            int tw; /* textwidth */
  1513. X
  1514. X            tx = otherx[j];
  1515. X            ty = othery[j];
  1516. X            t1 = ot1[j];
  1517. X            t2 = ot2[j];
  1518. X            t3 = ot3[j];
  1519. X            op = opic[j];
  1520. X
  1521. X            XTextExtents(temp->xf, othername[j], strlen(othername[j]),&dr,&far,&fdr,&or); 
  1522. X            tw=or.width / 2 - 1;
  1523. X            XDrawString(temp->theDisplay, temp->back_buffer, temp->bbgc, tx + OFFSET - tw, ty + OFFSET + 40, othername[j], strlen(othername[j]));
  1524. X            disp_ship(temp,op,tx,ty,t1,t2,t3,otherptr[j]);
  1525. X        }
  1526. X        if(!temp->exploding) {
  1527. X            draw_stars(temp);
  1528. X        }
  1529. X        do_stats(temp);
  1530. X
  1531. X        /*
  1532. X        *    Draw all the current laser beams on the screen
  1533. X        */
  1534. X        for(i=0;i<no_lasers;i++)
  1535. X        {
  1536. X            XDrawLine(temp->theDisplay, temp->back_buffer, temp->bbgc,
  1537. X                lasers[i].x1-temp->sx+PLAYW/2+OFFSET,temp->sy-lasers[i].y1+PLAYH/2+OFFSET,lasers[i].x2-temp->sx+PLAYW/2+OFFSET,temp->sy-lasers[i].y2+PLAYH/2+OFFSET);
  1538. X        }
  1539. X
  1540. X        XDrawRectangle(temp->theDisplay, temp->back_buffer, temp->bbgc, 
  1541. X            -1*WORLDW-temp->sx+PLAYW/2+OFFSET, -1*WORLDH+temp->sy+PLAYH/2+OFFSET, 
  1542. X            2*WORLDW, 2*WORLDH);
  1543. X        XCopyPlane(temp->theDisplay,temp->back_buffer,temp->theWindow,temp->theGC,OFFSET,
  1544. X                  OFFSET,PLAYW,PLAYH,0,0,1);
  1545. X        if(!temp->exploding) {
  1546. X            redo_radar(temp);
  1547. X            do_radar(temp);    
  1548. X        }
  1549. XKludge:
  1550. X        temp = temp->next;
  1551. X    }
  1552. X}
  1553. X
  1554. X
  1555. Xvoid synch_all()
  1556. X{
  1557. X    winptr t;
  1558. X
  1559. X    t = first_win;
  1560. X    while(t)
  1561. X    {
  1562. X        if(!t->npc || t->npcwin)    
  1563. X            XSync(t->theDisplay,False);
  1564. X        t = t->next;
  1565. X    }
  1566. X}
  1567. END_OF_FILE
  1568. if test 5068 -ne `wc -c <'update_win.c'`; then
  1569.     echo shar: \"'update_win.c'\" unpacked with wrong size!
  1570. fi
  1571. # end of 'update_win.c'
  1572. fi
  1573. if test -f 'weapon.c' -a "${1}" != "-c" ; then 
  1574.   echo shar: Will not clobber existing file \"'weapon.c'\"
  1575. else
  1576. echo shar: Extracting \"'weapon.c'\" \(16072 characters\)
  1577. sed "s/^X//" >'weapon.c' <<'END_OF_FILE'
  1578. X/* weapon.c - *** All the weapon routines */
  1579. Xstatic char sccs_id[] = "@(#)weapon.c 1.31 93/03/26 XMPB";
  1580. X
  1581. X#include "player.h"
  1582. X#include "weapon.h"
  1583. X
  1584. Xstruct laser lasers[MAXHOST];
  1585. Xint no_lasers;
  1586. X
  1587. Xextern int euid;
  1588. Xextern int mysintab[360],mycostab[360];
  1589. Xextern winptr first_win;
  1590. Xextern junkptr first_junk;
  1591. Xextern int installed;
  1592. X
  1593. Xwitemptr first_weap_item = NULL;
  1594. Xdouble line_2_linef();
  1595. X
  1596. Xadd_weapon_item(who,type,xv,yv,angle,targ,sx,sy)
  1597. Xwinptr who;
  1598. Xint type,xv,yv,angle;
  1599. Xwinptr targ;
  1600. Xint sx,sy;
  1601. X{
  1602. X    witemptr temp;
  1603. X
  1604. X    temp = (witemptr)malloc(sizeof(struct weapon_item));
  1605. X
  1606. X    temp->next = first_weap_item;
  1607. X    first_weap_item = temp;
  1608. X    temp->xv = xv;
  1609. X    temp->yv = yv;
  1610. X    temp->angle = angle;
  1611. X    temp->life = weap_maxlife[type];
  1612. X    temp->sx = sx;
  1613. X    temp->sy = sy;
  1614. X    temp->who = who;
  1615. X    temp->type = type;
  1616. X    temp->target = targ;
  1617. X}
  1618. X
  1619. Xfree_weap_item(w)
  1620. Xwitemptr w;
  1621. X{
  1622. X    witemptr t;
  1623. X
  1624. X    t = first_weap_item;
  1625. X
  1626. X    if(t == w)
  1627. X    {
  1628. X        first_weap_item = t->next;
  1629. X        free(t);
  1630. X        return;
  1631. X    }
  1632. X    if(t == NULL)
  1633. X    {
  1634. X        xmpb_error("Free from an empty weapon item list\n");
  1635. X    }
  1636. X    while(t->next != NULL && t->next != w)
  1637. X        t = t->next;
  1638. X    if(t->next == NULL)
  1639. X    {
  1640. X        xmpb_error("Free a non existing weapon item\n");
  1641. X    }
  1642. X    t->next = w->next;
  1643. X    free(w);
  1644. X}
  1645. X    
  1646. Xread_weap_pixmap(w,fn,pm)
  1647. Xwinptr w;
  1648. Xchar *fn;
  1649. XWeapon_Pixmap *pm;
  1650. X{
  1651. X    int xh,yh;
  1652. X    char *bitmapfile;
  1653. X    if(installed)
  1654. X    {
  1655. X        bitmapfile = (char *)malloc(strlen(BITMAPDIR)+strlen(fn)+1);
  1656. X        strcpy(bitmapfile,BITMAPDIR);
  1657. X    }
  1658. X    else
  1659. X    {
  1660. X        bitmapfile = (char *)malloc(10+strlen(fn)+1);
  1661. X        strcpy(bitmapfile, "./bitmaps/");
  1662. X    }
  1663. X    strcat(bitmapfile,fn);
  1664. X   
  1665. Xseteuid(euid); 
  1666. X    if(strcmp(fn,""))
  1667. X    XReadBitmapFile(w->theDisplay,w->theWindow,bitmapfile,&(pm->w),&(pm->h),&(pm->thepm),&xh,&yh);
  1668. X   
  1669. Xseteuid(getuid()); 
  1670. X    free(bitmapfile);
  1671. X}
  1672. X
  1673. Xread_all_weaps(w)
  1674. Xwinptr w;
  1675. X{
  1676. X    int i;
  1677. X
  1678. X    for(i=0;i<NO_WEAPONS;i++)
  1679. X    {
  1680. X        read_weap_pixmap(w,weap_file_names[i],&(w->weappms[i]));
  1681. X    }
  1682. X}
  1683. X
  1684. X#define CLOSEIN        60
  1685. X
  1686. Xfire_weapon(w)
  1687. Xwinptr w;
  1688. X{
  1689. X    int i;
  1690. X    winptr t = NULL;
  1691. X
  1692. X#define OFFSET_TO_FG  55
  1693. X
  1694. X    switch(w->curr_weap)
  1695. X    {
  1696. X        case WEAP_HEAVY_LASER:
  1697. X            w->energy_curr -= weap_energy[w->curr_weap];
  1698. X            w->load_status[w->curr_weap] = load_rate[w->curr_weap];
  1699. X            
  1700. X            lasers[no_lasers].x1 =w->sx+(CLOSEIN*mysintab[(int)w->angle])/32768;
  1701. X            lasers[no_lasers].y1 =w->sy+(CLOSEIN*mycostab[(int)w->angle])/32768;
  1702. X            lasers[no_lasers].x2 = w->sx+(14000*mysintab[(int)w->angle])/32768;
  1703. X            lasers[no_lasers].y2 = w->sy+(14000*mycostab[(int)w->angle])/32768;
  1704. X            lasers[no_lasers].dam = weap_damage[w->curr_weap];
  1705. X            lasers[no_lasers].who = w;
  1706. X            lasers[no_lasers].hit_dist = -5.0;
  1707. X            no_lasers++;
  1708. X
  1709. X            lasers[no_lasers].x1 =5*mycostab[w->angle]/32768+ w->sx+(CLOSEIN*mysintab[(int)w->angle])/32768;
  1710. X            lasers[no_lasers].y1 =5*mysintab[w->angle]/32768+ w->sy+(CLOSEIN*mycostab[(int)w->angle])/32768;
  1711. X            lasers[no_lasers].x2 = 400*mycostab[w->angle]/32768+w->sx+(14000*mysintab[(int)w->angle])/32768;
  1712. X            lasers[no_lasers].y2 = 400*mysintab[w->angle]/32768+w->sy+(14000*mycostab[(int)w->angle])/32768;
  1713. X            lasers[no_lasers].dam = weap_damage[w->curr_weap];
  1714. X            lasers[no_lasers].who = w;
  1715. X            lasers[no_lasers].hit_dist = -5.0;
  1716. X            no_lasers++;
  1717. X
  1718. X            lasers[no_lasers].x1 =-5*mycostab[w->angle]/32768+ w->sx+(CLOSEIN*mysintab[(int)w->angle])/32768;
  1719. X            lasers[no_lasers].y1 =-5*mysintab[w->angle]/32768+ w->sy+(CLOSEIN*mycostab[(int)w->angle])/32768;
  1720. X            lasers[no_lasers].x2 = -400*mycostab[w->angle]/32768+w->sx+(14000*mysintab[(int)w->angle])/32768;
  1721. X            lasers[no_lasers].y2 = -400*mysintab[w->angle]/32768+w->sy+(14000*mycostab[(int)w->angle])/32768;
  1722. X
  1723. X            lasers[no_lasers].dam = weap_damage[w->curr_weap];
  1724. X            lasers[no_lasers].who = w;
  1725. X            lasers[no_lasers].hit_dist = -5.0;
  1726. X            no_lasers++;
  1727. X
  1728. X            break;
  1729. X        case WEAP_LIGHT_LASER:
  1730. X            w->energy_curr -= weap_energy[w->curr_weap];
  1731. X            w->load_status[w->curr_weap] = load_rate[w->curr_weap];
  1732. X            lasers[no_lasers].x1 = w->sx+(CLOSEIN*mysintab[(int)w->angle])/32768;
  1733. X            lasers[no_lasers].y1 = w->sy+(CLOSEIN*mycostab[(int)w->angle])/32768;
  1734. X            lasers[no_lasers].x2 = w->sx+(14000*mysintab[(int)w->angle])/32768;
  1735. X            lasers[no_lasers].y2 = w->sy+(14000*mycostab[(int)w->angle])/32768;
  1736. X            lasers[no_lasers].dam = weap_damage[w->curr_weap];
  1737. X            lasers[no_lasers].who = w;
  1738. X            lasers[no_lasers].hit_dist = -5.0;
  1739. X            no_lasers++;
  1740. X            break;
  1741. X        case WEAP_SPRAY:
  1742. X            w->energy_curr -= weap_energy[w->curr_weap];
  1743. X            w->load_status[w->curr_weap] = load_rate[w->curr_weap];
  1744. X        for(i=0;i<5;i++)
  1745. X            add_weapon_item(w,w->curr_weap,
  1746. X                mysintab[(w->angle+(rand()%20-10)+360)%360]*weap_velocit[w->curr_weap]+w->xv,
  1747. X                mycostab[(w->angle+(rand()%20-10)+360)%360]*weap_velocit[w->curr_weap]+w->yv,
  1748. X                (int)w->angle,t,
  1749. X                w->sx+(OFFSET_TO_FG*mysintab[(int)w->angle])/32768,
  1750. X                w->sy+(OFFSET_TO_FG*mycostab[(int)w->angle])/32768);
  1751. X            break;
  1752. X        case WEAP_MAGNET:
  1753. X        case WEAP_SEEK:
  1754. X            t=w->targeting;
  1755. X            if(t == NULL)
  1756. X                break;
  1757. X        case WEAP_BLACK:
  1758. X        case WEAP_HVYPULSE:
  1759. X        case WEAP_MASS:
  1760. X        case WEAP_RAIL:
  1761. X        case WEAP_PULSE:
  1762. X        case WEAP_DUNNO:
  1763. X        case WEAP_DUNNO2:
  1764. X        case WEAP_BOMB:
  1765. X        case WEAP_MISSILE:
  1766. X            w->energy_curr -= weap_energy[w->curr_weap];
  1767. X            w->load_status[w->curr_weap] = load_rate[w->curr_weap];
  1768. X            add_weapon_item(w,w->curr_weap,
  1769. X                mysintab[(int)w->angle]*weap_velocit[w->curr_weap]+w->xv,
  1770. X                mycostab[(int)w->angle]*weap_velocit[w->curr_weap]+w->yv,
  1771. X                (int)w->angle,t,
  1772. X                w->sx+(OFFSET_TO_FG*mysintab[(int)w->angle])/32768,
  1773. X                w->sy+(OFFSET_TO_FG*mycostab[(int)w->angle])/32768);
  1774. X            break;
  1775. X        case WEAP_MINE:
  1776. X            w->energy_curr -= weap_energy[w->curr_weap];
  1777. X            w->load_status[w->curr_weap] = load_rate[w->curr_weap];
  1778. X            add_weapon_item(w,w->curr_weap,
  1779. X                mysintab[(int)w->angle]*weap_velocit[w->curr_weap]+w->xv,
  1780. X                mycostab[(int)w->angle]*weap_velocit[w->curr_weap]+w->yv,
  1781. X                (int)w->angle,t,
  1782. X                w->sx+(-OFFSET_TO_FG*mysintab[(int)w->angle])/32768,
  1783. X                w->sy+(-OFFSET_TO_FG*mycostab[(int)w->angle])/32768);
  1784. X            break;
  1785. X        default:
  1786. X            break;
  1787. X    }
  1788. X}
  1789. X
  1790. X#define abs(x) ((x) >=0?(x):-(x))
  1791. X/*
  1792. Xint check_if_bullet_hit(int x1,int y1,int x2,int y2,int *a,int *b,int *c,int *d,winptr *r)
  1793. X{
  1794. X    winptr t;
  1795. X    int sx,sy;
  1796. X    int f,g,h,j,k;
  1797. X
  1798. X    t = first_win;
  1799. X
  1800. X    while(t)
  1801. X    {
  1802. X        
  1803. X        h = x2 - x1;
  1804. X        j = y2 - y1;
  1805. X        if(abs(h) > abs(j))
  1806. X        {
  1807. X            f = 40*j / h;
  1808. X            g = 40;
  1809. X        }
  1810. X        else
  1811. X        {
  1812. X            f = 40;
  1813. X            g = 40 * h / j;
  1814. X        }
  1815. X        
  1816. X        if(line_2_line(x1,y1,x2,y2,t->sx-f,t->sy+g,t->sx+t->xv/32768+f,t->sy+t->yv/32768-g,a,b,c,d))
  1817. X        {
  1818. X            *r = t;
  1819. X            return 1;
  1820. X        }
  1821. X        t = t->next;
  1822. X    }
  1823. X    return 0;
  1824. X}
  1825. X*/
  1826. Xdo_laser_hits()
  1827. X{
  1828. X    int i;
  1829. X    witemptr w;
  1830. X    witemptr x;
  1831. X    winptr t;
  1832. X    junkptr j;
  1833. X    int a,b,c,d;
  1834. X    int cx,cy;
  1835. X    double curr_hit;
  1836. X    int hit_shield;
  1837. X
  1838. X    {
  1839. X        t = first_win;
  1840. X        while(t)
  1841. X        {
  1842. X            if(!t->exploding)
  1843. X            {
  1844. X                for(i=0;i<no_lasers;i++)
  1845. X                {
  1846. X                    if(t != lasers[i].who)
  1847. X                    {
  1848. X                    cx = t->sx + t->xv/32768;
  1849. X                    cy = t->sy + t->yv/32768;
  1850. X                    {
  1851. X                        double bsh,lsh,rsh;
  1852. X            
  1853. X                    
  1854. X                        curr_hit = -2.0;
  1855. X                        hit_shield = 0;
  1856. X                        rsh = line_2_linef(lasers[i].x1,lasers[i].y1,lasers[i].x2,lasers[i].y2,t->p1x,t->p1y,t->p2x,t->p2y);    
  1857. X                        if(rsh > curr_hit )
  1858. X                        {
  1859. X                            hit_shield = RSH;
  1860. X                            curr_hit = rsh;
  1861. X                        }
  1862. X                        lsh = line_2_linef(lasers[i].x1,lasers[i].y1,lasers[i].x2,lasers[i].y2,t->p3x,t->p3y,t->p1x,t->p1y);    
  1863. X                        if(lsh > curr_hit)
  1864. X                        {
  1865. X                            hit_shield = LSH;
  1866. X                            curr_hit = lsh;
  1867. X                        }
  1868. X                        bsh = line_2_linef(lasers[i].x1,lasers[i].y1,lasers[i].x2,lasers[i].y2,t->p2x,t->p2y,t->p3x,t->p3y);    
  1869. X                        if(bsh > curr_hit)
  1870. X                        {
  1871. X                            hit_shield = BSH;
  1872. X                            curr_hit = bsh;
  1873. X                        }
  1874. X                        if(hit_shield)
  1875. X                        {
  1876. X                            if(curr_hit > lasers[i].hit_dist)
  1877. X                            {
  1878. X                                lasers[i].hit_dist = curr_hit;    
  1879. X                                lasers[i].hit_ship = t;
  1880. X                                lasers[i].hit_shield = hit_shield;
  1881. X                            }
  1882. X                        }
  1883. X                    }
  1884. X                    }
  1885. X                }
  1886. X            }
  1887. X            t=t->next;
  1888. X        }
  1889. X    }
  1890. X
  1891. X    for(i=0;i<no_lasers;i++)
  1892. X    {
  1893. X        j=first_junk;
  1894. X        while(j)
  1895. X        {
  1896. X            if(j->type >= SMALLROCK && j->type <=BIGROCK)
  1897. X            {
  1898. X                int h;
  1899. X                double length_along;
  1900. X
  1901. X                h = line_2_circle(lasers[i].x1,lasers[i].y1,lasers[i].x2,lasers[i].y2,j->sx,j->sy,(j->type == SMALLROCK?5:j->type==MEDROCK?11:25));
  1902. X                length_along = -(double)(h-lasers[i].x1)/(double)(lasers[i].x2-lasers[i].x1);
  1903. X                if(h && length_along > lasers[i].hit_dist)
  1904. X                {
  1905. X                    lasers[i].hit_dist = length_along;
  1906. X                    lasers[i].hit_ship = NULL;
  1907. X                }
  1908. X            }    
  1909. X            j = j->next;
  1910. X        }
  1911. X    }
  1912. X                
  1913. X    for(i=0;i<no_lasers;i++)
  1914. X    {
  1915. X        if(lasers[i].hit_dist > -5.0 )
  1916. X        {
  1917. X            if(lasers[i].hit_ship)
  1918. X            {
  1919. X            double scale;
  1920. X
  1921. X                if(damage_ship(lasers[i].hit_ship,lasers[i].hit_shield,lasers[i].dam))
  1922. X                {
  1923. X                    lasers[i].who->kills++;
  1924. X                }
  1925. X                /* scale earned */
  1926. X                scale = (double)(lasers[i].hit_ship->ship_value+lasers[i].hit_ship->earned)/(double)(lasers[i].who->ship_value+lasers[i].who->earned);
  1927. X                if(scale > 10)
  1928. X                        scale=10;
  1929. X                if(scale < 0.1)
  1930. X                    scale=0.1;
  1931. X                lasers[i].who->earned += (int)(5.0*(double)lasers[i].dam*scale);
  1932. X            }
  1933. X
  1934. X            lasers[i].x2 = (lasers[i].x2 - lasers[i].x1) * -lasers[i].hit_dist + lasers[i].x1;    
  1935. X            lasers[i].y2 = (lasers[i].y2 - lasers[i].y1) * -lasers[i].hit_dist + lasers[i].y1;    
  1936. X
  1937. X            if(lasers[i].hit_ship)
  1938. X            add_junk(CLOUD1,lasers[i].x2,lasers[i].y2,8*lasers[i].hit_ship->xv/10,8*lasers[i].hit_ship->yv/10,2);
  1939. X            else
  1940. X            add_junk(CLOUD1,lasers[i].x2,lasers[i].y2,0,0,2);
  1941. X
  1942. X        }
  1943. X    }
  1944. X}
  1945. Xupdate_weapons()
  1946. X{
  1947. X    int i;
  1948. X    witemptr w;
  1949. X    witemptr x;
  1950. X    winptr t;
  1951. X    junkptr j;
  1952. X    int a,b,c,d;
  1953. X    int cx,cy;
  1954. X    double curr_hit;
  1955. X    int hit_shield;
  1956. X
  1957. X    w = first_weap_item;
  1958. X
  1959. X    while(w)
  1960. X    {
  1961. X        t = first_win;
  1962. X        while(t)
  1963. X        {
  1964. X            if(!t->exploding)
  1965. X            {
  1966. X                int nx,ny;
  1967. X                nx = w->sx+w->xv/32768;
  1968. X                ny = w->sy+w->yv/32768;
  1969. X
  1970. X
  1971. X                if((nx < t->sx + 50) && (nx > t->sx - 50) && (ny < t->sy + 50) && (ny > t->sy - 50))
  1972. X                {
  1973. X                    /* Ok the bullet approximately hit, lets check further */
  1974. X                    cx = t->sx /* + t->xv/32768*/;
  1975. X                    cy = t->sy /* + t->yv/32768*/;
  1976. X                    {
  1977. X                        int hx,hy;
  1978. X                        double bsh,lsh,rsh;
  1979. X            
  1980. X                        curr_hit = -2.0;
  1981. X                        hit_shield = 0;
  1982. X                        rsh = line_2_linef(w->sx,w->sy,nx,ny,t->p1x,t->p1y,t->p2x,t->p2y);    
  1983. X                        if(rsh > curr_hit )
  1984. X                        {
  1985. X                            hit_shield = RSH;
  1986. X                            curr_hit = rsh;
  1987. X                        }
  1988. X                        lsh = line_2_linef(w->sx,w->sy,nx,ny,t->p3x,t->p3y,t->p1x,t->p1y);    
  1989. X                        if(lsh > curr_hit)
  1990. X                        {
  1991. X                            hit_shield = LSH;
  1992. X                            curr_hit = lsh;
  1993. X                        }
  1994. X                        bsh = line_2_linef(w->sx,w->sy,nx,ny,t->p2x,t->p2y,t->p3x,t->p3y);    
  1995. X                        if(bsh > curr_hit)
  1996. X                        {
  1997. X                            hit_shield = BSH;
  1998. X                            curr_hit = bsh;
  1999. X                        }
  2000. X                        if(hit_shield)
  2001. X                        {
  2002. X                        double scale;
  2003. X
  2004. X                            hx = w->sx + (int)((double)(nx - w->sx)*-curr_hit) ;
  2005. X                            hy = w->sy + (int)((double)(ny - w->sy)*-curr_hit) ;
  2006. X                            add_junk(CLOUD1,hx,hy,8*t->xv/10,8*t->yv/10,2);
  2007. X
  2008. X                            if(damage_ship(t,hit_shield,weap_damage[w->type]))
  2009. X                            {
  2010. X                                if(w->who)
  2011. X                                w->who->kills++;
  2012. X                            }
  2013. X                            if(w->who)
  2014. X                            {
  2015. X                                scale=(double)(t->ship_value+t->earned)/(w->who->ship_value+w->who->earned);
  2016. X                                if(scale > 10)
  2017. X                                       scale=10;
  2018. X                                   if(scale < 0.1)
  2019. X                                    scale=0.1;
  2020. X                                w->who->earned += (int) 5*scale*weap_damage[w->type];
  2021. X                            }
  2022. X                            w->life = 1;
  2023. X                        }
  2024. X                        else
  2025. X                        {
  2026. X                            double scale;
  2027. X                            int width;
  2028. X                            switch(w->type)
  2029. X                            {
  2030. X                                case WEAP_PULSE:
  2031. X                                    width = 5;
  2032. X                                    break;
  2033. X                                case WEAP_BOMB:
  2034. X                                    width = 9;
  2035. X                                    break;
  2036. X                                case WEAP_SEEK:
  2037. X                                    width = 9;
  2038. X                                    break;
  2039. X                                case WEAP_MINE:
  2040. X                                    width = 8;
  2041. X                                    break;
  2042. X                                case WEAP_MASS:
  2043. X                                    width = 6;
  2044. X                                    break;
  2045. X                                case WEAP_BLACK:
  2046. X                                    width = 15;
  2047. X                                    break;
  2048. X                                case WEAP_MAGNET:
  2049. X                                    width = 13;
  2050. X                                    break;
  2051. X                                case WEAP_HVYPULSE:
  2052. X                                    width = 7;
  2053. X                                    break;
  2054. X                                case WEAP_MISSILE:
  2055. X                                    width = 30;
  2056. X                                    break;
  2057. X                                case WEAP_DUNNO:
  2058. X                                    width = 8;
  2059. X                                    break;
  2060. X                                case WEAP_DUNNO2:
  2061. X                                    width = 6;
  2062. X                                    break;
  2063. X                                default:
  2064. X                                    width = 0;
  2065. X                                    break;
  2066. X                            }
  2067. X                            if(width)
  2068. X                            {
  2069. X                                if(line_2_rect(t->p1x,t->p1y,t->p2x,t->p2y,w->sx,w->sy,width,width))
  2070. X                                {
  2071. X                                    hit_shield = RSH;
  2072. X                                }
  2073. X                                else
  2074. X                                if(line_2_rect(t->p1x,t->p1y,t->p3x,t->p3y,w->sx,w->sy,width,width))
  2075. X                                {
  2076. X                                    hit_shield = LSH;
  2077. X                                }
  2078. X                                else
  2079. X                                if(line_2_rect(t->p2x,t->p2y,t->p3x,t->p3y,w->sx,w->sy,width,width))
  2080. X                                {
  2081. X                                    hit_shield = BSH;
  2082. X                                }
  2083. X                                if(hit_shield)
  2084. X                                {
  2085. X                                    add_junk(CLOUD1,w->sx,w->sy,8*t->xv/10,8*t->yv/10,2);
  2086. X
  2087. X                                    if(damage_ship(t,hit_shield,weap_damage[w->type]))
  2088. X                                    {
  2089. X                                        if(w->who)
  2090. X                                        w->who->kills++;
  2091. X                                    }
  2092. X                                    if(w->who)
  2093. X                                    {
  2094. X                                        scale=(double)(t->ship_value+t->earned)/(w->who->ship_value+w->who->earned);
  2095. X                                        if(scale > 10)
  2096. X                                               scale=10;
  2097. X                                           if(scale < 0.1)
  2098. X                                            scale=0.1;
  2099. X                                        w->who->earned += (int) 5*scale*weap_damage[w->type];
  2100. X                                    }
  2101. X                                    w->life = 1;
  2102. X                                }
  2103. X                            }
  2104. X                        }
  2105. X                    }
  2106. X                }
  2107. X            }
  2108. X            t = t->next;
  2109. X        }
  2110. X
  2111. X#define SGN(x) ((x)>0?1:-1)
  2112. X
  2113. X        if(w->type == WEAP_SEEK)
  2114. X        {
  2115. X            long sp;
  2116. X            long nx,ny;
  2117. X
  2118. X            nx = (w->sx - w->target->sx);
  2119. X            ny = (w->sy - w->target->sy);
  2120. X
  2121. X            if(nx*nx > ny*ny)
  2122. X            {
  2123. X                ny = SGN(ny)*abs(ny)*8/abs(nx);
  2124. X                nx = 8*SGN(nx);
  2125. X            }
  2126. X            else
  2127. X            {
  2128. X                nx = SGN(nx)*abs(nx)*8/abs(ny);
  2129. X                ny = 8*SGN(ny);
  2130. X            }
  2131. X            sp = (w->xv/32768-nx)*(w->xv/32768-nx) + (w->yv/32768-ny)*(w->yv/32768-ny);
  2132. X            
  2133. X            if(sp < 4500)
  2134. X            {
  2135. X                w->xv -= nx*32768;
  2136. X                w->yv -= ny*32768; 
  2137. X            }
  2138. X        }
  2139. X
  2140. X        if(w->type == WEAP_MAGNET)
  2141. X        {
  2142. X            long x,y;
  2143. X            long nx,ny;
  2144. X
  2145. X            nx = (long) (w->sx - w->target->sx);
  2146. X            ny = (long) (w->sy - w->target->sy);
  2147. X            
  2148. X            if(nx*nx > ny*ny)
  2149. X            {
  2150. X                x = -SGN(nx)*weap_velocit[WEAP_MAGNET];
  2151. X                if(nx>0) y = ny*x/nx;
  2152. X                else y=(long)0;
  2153. X            }
  2154. X            else
  2155. X            {
  2156. X                y = -SGN(ny)*weap_velocit[WEAP_MAGNET];
  2157. X                if(ny>0) x = nx*y/ny;
  2158. X                else x=(long)0;
  2159. X            }
  2160. X            w->xv = w->xv/20+(int) x*32768;
  2161. X            w->yv = w->yv/20+(int) y*32768;
  2162. X        }
  2163. X            
  2164. X    
  2165. X        j = first_junk;
  2166. X        while(j)
  2167. X        {
  2168. X            if((w->sx < j->sx + 50) && (w->sx > j->sx - 50) && (w->sy < j->sy + 50) && (w->sy > j->sy - 50))
  2169. X            {
  2170. X            if(j->type >= SMALLROCK && j->type <= BIGROCK)
  2171. X            {
  2172. X                int r,h;
  2173. X                
  2174. X                switch(j->type)
  2175. X                {
  2176. X                    case SMALLROCK:
  2177. X                        r = 5;
  2178. X                        break;     
  2179. X                    case MEDROCK:
  2180. X                        r = 11;
  2181. X                        break;     
  2182. X                    case BIGROCK:
  2183. X                        r = 25;
  2184. X                        break;     
  2185. X                }
  2186. X                if(h=line_2_circle(w->sx,w->sy,w->sx+w->xv/32768,w->sy+w->yv/32768,j->sx,j->sy,r))
  2187. X                {
  2188. X                    w->life = 1;
  2189. X                    if(w->sx == w->sx+w->xv/32768)
  2190. X                        add_junk(CLOUD1,h,j->sy,8*j->xv/10,8*j->yv/10,2);
  2191. X                    else
  2192. X                        add_junk(CLOUD1,h,w->sy+(h-w->sx)*(w->sy+w->yv/32768-w->sy)/(w->sx+w->xv/32768-w->sx),8*j->xv/10,8*j->yv/10,2);
  2193. X                    
  2194. X                }
  2195. X            }
  2196. X            }
  2197. X            j = j->next;
  2198. X        }
  2199. X        w->sx += w->xv/32768;
  2200. X           w->sy += w->yv/32768;
  2201. X        w->life--;
  2202. X        w = w->next;
  2203. X    }
  2204. X    w = first_weap_item;
  2205. X    while(w)
  2206. X    {
  2207. X        if(w->life <= 0) 
  2208. X        {
  2209. X            x = w->next;
  2210. X            free_weap_item(w);
  2211. X            w = x;
  2212. X        }
  2213. X        else
  2214. X            w = w->next;
  2215. X    }
  2216. X}
  2217. X
  2218. Xint missile_lines[9][2][2] =
  2219. X{
  2220. X    {{-3,13},{-3,-17}},
  2221. X    {{3,13},{3,-17}},
  2222. X    {{-3,13},{0,16}},
  2223. X    {{0,16},{3,13}},
  2224. X    {{-3,-6},{-7,-15}},
  2225. X    {{-7,-15},{7,-15}},
  2226. X    {{7,-15},{3,-6}},
  2227. X    {{-3,-17},{0,-22}},
  2228. X    {{0,-22},{3,-17}}
  2229. X};
  2230. Xdisp_all_items(w)
  2231. Xwinptr w;
  2232. X{
  2233. X    int i,x1,x2,y1,y2;
  2234. X    witemptr t;
  2235. X
  2236. X    t = first_weap_item;
  2237. X
  2238. X    while(t)
  2239. X    {
  2240. X        switch(t->type)
  2241. X        {
  2242. X            case WEAP_BLACK:
  2243. X                break;
  2244. X            case WEAP_MISSILE:
  2245. X                for(i=0;i<9;i++)
  2246. X                {
  2247. X                    rotate_pt(missile_lines[i][0][0],missile_lines[i][0][1],(t->angle+180)%360,&x1,&y1);
  2248. X                    rotate_pt(missile_lines[i][1][0],missile_lines[i][1][1],(t->angle+180)%360,&x2,&y2);
  2249. X                    x1 = x1/2;
  2250. X                    x2 = x2/2;
  2251. X                    y1 = y1/2;
  2252. X                    y2 = y2/2;
  2253. X                    XDrawLine(w->theDisplay,w->back_buffer,w->bmgc,
  2254. X                        PLAYW/2 - w->sx+t->sx+OFFSET + x1,
  2255. X                        PLAYH/2 - t->sy + w->sy+OFFSET+y1,
  2256. X                        PLAYW/2 - w->sx+t->sx+OFFSET+x2,
  2257. X                        PLAYH/2 - t->sy + w->sy+OFFSET+y2);
  2258. X                }
  2259. X                break;    
  2260. X            default:
  2261. X                XCopyPlane(w->theDisplay,w->weappms[t->type].thepm,
  2262. X                    w->back_buffer,w->bbgc,0,0,w->weappms[t->type].w,
  2263. X                    w->weappms[t->type].h,PLAYW/2 - w->sx+t->sx+OFFSET,
  2264. X                    PLAYH/2 - t->sy + w->sy+OFFSET,1);
  2265. X                break;
  2266. X        }
  2267. X        t = t->next;
  2268. X    }
  2269. X}
  2270. END_OF_FILE
  2271. if test 16072 -ne `wc -c <'weapon.c'`; then
  2272.     echo shar: \"'weapon.c'\" unpacked with wrong size!
  2273. fi
  2274. # end of 'weapon.c'
  2275. fi
  2276. echo shar: End of archive 3 \(of 8\).
  2277. cp /dev/null ark3isdone
  2278. MISSING=""
  2279. for I in 1 2 3 4 5 6 7 8 ; do
  2280.     if test ! -f ark${I}isdone ; then
  2281.     MISSING="${MISSING} ${I}"
  2282.     fi
  2283. done
  2284. if test "${MISSING}" = "" ; then
  2285.     echo You have unpacked all 8 archives.
  2286.     rm -f ark[1-9]isdone
  2287. else
  2288.     echo You still need to unpack the following archives:
  2289.     echo "        " ${MISSING}
  2290. fi
  2291. ##  End of shell archive.
  2292. exit 0
  2293.