home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume18 / xmpb / part04 < prev    next >
Encoding:
Internet Message Format  |  1993-07-11  |  55.2 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: v18i004:  xmpb - multiplayer space combat for X, Part04/08
  5. Date: 26 Jun 1993 00:32:45 GMT
  6. Organization: Tektronix, Inc, Redmond, OR, USA
  7. Lines: 2259
  8. Approved: billr@saab.CNA.TEK.COM
  9. Message-ID: <20g5fd$6sn@ying.cna.tek.com>
  10. NNTP-Posting-Host: saab.cna.tek.com
  11. Xref: uunet comp.sources.games:1794
  12.  
  13. Submitted-by: ddp@deakin.edu.au (Damien De Paoli)
  14. Posting-number: Volume 18, Issue 4
  15. Archive-name: xmpb/Part04
  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 4 (of 8)."
  27. # Contents:  bitmaps/title.bmp.Z.uu handle_ev.c radar.c shop.contents
  28. #   test.c
  29. # Wrapped by billr@saab on Fri Jun 25 16:30:15 1993
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'bitmaps/title.bmp.Z.uu' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'bitmaps/title.bmp.Z.uu'\"
  33. else
  34. echo shar: Extracting \"'bitmaps/title.bmp.Z.uu'\" \(8704 characters\)
  35. sed "s/^X//" >'bitmaps/title.bmp.Z.uu' <<'END_OF_FILE'
  36. Xbegin 400 title.bmp.Z
  37. XM'YV0(\B4,9/&31D0=-+085/FRYTT9.B@ 3$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41AKFF!JT_D:!?6E@HCD\#3=-C!%0)!
  164. XM,6C1UB#:2U9S!+GYE*PC1,J+WGMVY$W6\1;?9 ;@WCHA@0I, UY!4KB(%!'Y
  165. XM.'8T ^P1$\ZQ]'*7@7EOA8V"K)*R5T$RC%$(+YG0*K Y0G@*OV S*C%&QM=E
  166. XMO)U76Y;>>[L!580>:KH_]U@("1HI;#? U_T/DJ7FFF :S%"*",9,E=\F]3*'
  167. XM,.P:AD3J[2]1:/5$@].C2?2C!CI :J@ZL$DKD8=3;\RDA1PS$.%=V2 ?P<4&
  168. XM'+RAXLT$(E8JB++.L:%!A+/X:LNI@X3X12+6EDODE\I=7 "&RTAC_+D"\TK*
  169. XM6-<P,#:P$(Y"1/?L3M(UJ7@Z$8J@Q/U&,PC3\O%'^V@H4A;?)NRXG<IJA\=O
  170. XM&G8JJJ<]1(HZ 8A3D2K8@$^":;8#X=![+L\J_([JXENL7L:#'1$Q!<8\2^C[
  171. XM*D-P47E+8Q/U.YI!#D^";!,-!@8:RCI="!5J@%UDB%!!!NBK=0<&9R)]Z(.^
  172. XMJ>U]C;-'/LA>B*EY,P EICD\J!;'U\DK#'8DVL4I(1+^UEW-JX1DD.18JM@1
  173. XM X3A).0;BX9FK#H#QP8=4ED03V *'YI$!180ET92%'Z\T N&17=H$,5B9>2(
  174. XM=M ,-D?FJ!SKX'1<CMC1.E9'0W@0KZ-V3([@L3MNQZ7X'*7C>&QN?/'_>4?N
  175. XMZ!RC8WE\C^XQ/JY'\B@?S^-&-(_AL3W.1_08&ZEC?O2/XO$_9D?V""#UHWU,
  176. XJ@/@Q0"I( RD@O^."+) 0<D#2Q_UX'^$CA420%O) ;C9V6/106A_8 0H 
  177. Xend
  178. END_OF_FILE
  179. if test 8704 -ne `wc -c <'bitmaps/title.bmp.Z.uu'`; then
  180.     echo shar: \"'bitmaps/title.bmp.Z.uu'\" unpacked with wrong size!
  181. fi
  182. # end of 'bitmaps/title.bmp.Z.uu'
  183. fi
  184. if test -f 'handle_ev.c' -a "${1}" != "-c" ; then 
  185.   echo shar: Will not clobber existing file \"'handle_ev.c'\"
  186. else
  187. echo shar: Extracting \"'handle_ev.c'\" \(11684 characters\)
  188. sed "s/^X//" >'handle_ev.c' <<'END_OF_FILE'
  189. X/* handle_ev.c - *** Handle X events */
  190. X
  191. Xstatic char sccs_id[] = "@(#)handle_ev.c 1.27 92/11/24 XMPB";
  192. X
  193. X#include "player.h"
  194. X#include "save.h"
  195. X#include <X11/keysym.h>
  196. X#include "save.c"
  197. X
  198. Xextern int euid;
  199. Xextern int no_hosts;
  200. Xextern int num_alive;
  201. Xextern witemptr first_weap_item;
  202. Xextern winptr first_win;
  203. Xextern int num_npcs_windows;
  204. Xextern int num_npcs_alive;
  205. X
  206. X
  207. X
  208. XXEvent xe;        /* the X event received */
  209. XKeySym keysym;     /* the keysym decoded from the event */
  210. X
  211. Xint num_quit=0;
  212. Xchar buf[20];      /* dummy buffer for XLookupString */
  213. X
  214. X/*
  215. X* handle all the events for player w
  216. X*/
  217. Xint handle_events(w)
  218. Xwinptr w;
  219. X{
  220. X
  221. X    /*
  222. X    *    Only get the events for this window that match the eventmask
  223. X    */
  224. X       while(XCheckWindowEvent(w->theDisplay,w->theWindow,EVENTMASK,&xe)) 
  225. X       {
  226. X        switch(xe.type)
  227. X        {
  228. X            /*
  229. X            *    A mouse button was pressed.  Once we know which, we
  230. X            *    the appropriate variable in the player structure
  231. X            */
  232. X            case ButtonPress:
  233. X                switch(xe.xbutton.button)
  234. X                {
  235. X                    case Button1:
  236. X                        w->b1 = 1;
  237. X                        w->cloaking = 0;
  238. X                        break;
  239. X                    case Button2:
  240. X                        w->b2 = 1;
  241. X                        break;
  242. X                    case Button3:
  243. X                        w->b3 = 1;
  244. X                        break;
  245. X                    default:
  246. X                        break;
  247. X                }
  248. X                break;
  249. X
  250. X            /*
  251. X            *    Same as for ButtonPress
  252. X            */
  253. X            case ButtonRelease:
  254. X                switch(xe.xbutton.button)
  255. X                {
  256. X                    case Button1:
  257. X                        w->b1 = 0;
  258. X                        break;
  259. X                    case Button2:
  260. X                        w->b2 = 0;
  261. X                        break;
  262. X                    case Button3:
  263. X                        w->b3 = 0;
  264. X                        break;
  265. X                    default:
  266. X                        break;
  267. X                }
  268. X                break;
  269. X
  270. X            /* 
  271. X            *    OK, a key was pressed, which one eh?
  272. X            */
  273. X            case KeyPress:
  274. X                XLookupString(&(xe.xkey),buf,10,&keysym,NULL);
  275. X                /*
  276. X                *     Turn Anti-clockwise
  277. X                */
  278. X                if(keysym==w->prefs.turnLeft) 
  279. X                    start_turn_left(w);
  280. X
  281. X                /* 
  282. X                *    Turn Clockwise
  283. X                */
  284. X                if(keysym==w->prefs.turnRight)
  285. X                    start_turn_right(w);
  286. X
  287. X                /*
  288. X                **  Change view of deaders
  289. X                */
  290. X                if(keysym==w->prefs.changeView)
  291. X                    change_view(w);
  292. X
  293. X                /*
  294. X                *    Quit Now
  295. X                */
  296. X                if(keysym==w->prefs.quit)
  297. X                    quit(w);
  298. X
  299. X                /*
  300. X                *     Change radar resolution
  301. X                */
  302. X                if(keysym==w->prefs.toggleRadar)
  303. X                {
  304. X                        w->short_range_radar = 1 - w->short_range_radar;
  305. X                }
  306. X
  307. X                /*
  308. X                *     Change which item is being repaired
  309. X                *    only damaged items can be repaired, destroyed
  310. X                *    or non-existent are skipped
  311. X                *   idle means nothing is being repaired
  312. X                */
  313. X                    
  314. X                if(keysym==w->prefs.changeRepair)    
  315. X                {
  316. X                    change_repair(w);
  317. X                }
  318. X    
  319. X                /*
  320. X                *    Toggle shield regenerating
  321. X                */
  322. X                if(keysym==w->prefs.toggleShieldsRegen)
  323. X                {
  324. X                    w->shield_regen=1-w->shield_regen;
  325. X                }
  326. X
  327. X                /*
  328. X                ** transfer the energy from shields to energy bank
  329. X                */
  330. X                if(keysym==w->prefs.grabEnergy)
  331. X                    grab_energy(w);
  332. X
  333. X                /*
  334. X                ** okay, lets toggle cloaking
  335. X                */
  336. X                if(keysym==w->prefs.invisibility)
  337. X                    invis(w);
  338. X
  339. X                /*
  340. X                **  Balance the shield energy
  341. X                */
  342. X                if(keysym==w->prefs.balanceShields)
  343. X                    balance_shields(w);
  344. X
  345. X                /*
  346. X                *    Toggle who we are targeting
  347. X                */
  348. X                if(keysym==w->prefs.changeTarget)
  349. X                    change_target(w);
  350. X
  351. X                /*
  352. X                *    Toggle current weapon on/off
  353. X                */
  354. X                if(keysym==w->prefs.toggleWeaponStatus)
  355. X                {
  356. X                    w->weap_on_status[w->curr_weap] = 1 - w->weap_on_status[w->curr_weap];
  357. X                }
  358. X
  359. X                /*
  360. X                ** Simulate buttons down
  361. X                */
  362. X                if(keysym==w->prefs.fire)
  363. X                    w->b1=1;
  364. X                if(keysym==w->prefs.changeWeapon)
  365. X                    w->b2=1;
  366. X                if(keysym==w->prefs.thrust)
  367. X                    w->b3=1;
  368. X                break;
  369. X
  370. X            /*
  371. X            *     A key was released
  372. X            */
  373. X            case KeyRelease:
  374. X                XLookupString(&(xe.xkey),buf,10,&keysym,NULL);
  375. X
  376. X                /*
  377. X                *     We only care about the rotate keys so we know
  378. X                *    when to stop rotating
  379. X                */
  380. X                if(keysym==w->prefs.turnLeft)
  381. X                    stop_turn_left(w);
  382. X
  383. X                if(keysym==w->prefs.turnRight)
  384. X                    stop_turn_right(w);
  385. X
  386. X                /*
  387. X                ** Simulate buttons down
  388. X                */
  389. X                if(keysym==w->prefs.fire)
  390. X                    w->b1=0;
  391. X                if(keysym==w->prefs.changeWeapon)
  392. X                    w->b2=0;
  393. X                if(keysym==w->prefs.thrust)
  394. X                    w->b3=0;
  395. X                break;
  396. X            
  397. X            /*
  398. X            *     Blargh, an expose event, clear the screen the next
  399. X            *    frame will fix the exposed region
  400. X            */
  401. X
  402. X            case EnterNotify:
  403. X                XAutoRepeatOff(w->theDisplay);
  404. X                break;
  405. X            case LeaveNotify:
  406. X                XAutoRepeatOn(w->theDisplay);
  407. X                break;
  408. X               case Expose:
  409. X                xfe_clear(w);
  410. X                break;
  411. X            case DestroyNotify:
  412. X                bad();
  413. X                break;
  414. X
  415. X            /*
  416. X            *    Obviously an event we don't care about
  417. X            */
  418. X            default:
  419. X                break;
  420. X        }
  421. X    }
  422. X    return 0;
  423. X}
  424. X
  425. Xsave *load_dude(name)
  426. Xchar *name;
  427. X{
  428. X    int i;
  429. X    FILE *fp;
  430. X    save *temp;
  431. X    char fn[100];
  432. X
  433. X    strcpy(fn,SAVEDIR);
  434. X    strcat(fn, name);
  435. X    strcat(fn, ".xms");    
  436. X
  437. Xseteuid(euid);    
  438. X    fp=fopen(fn, "rb");
  439. Xseteuid(getuid());
  440. X
  441. X    if(!fp) {
  442. X        return &(default_save);
  443. X    }
  444. X    temp=(save *) malloc (sizeof(save));
  445. X    if(!temp)
  446. X        xmpb_error("Not enough memory");
  447. X    fread(temp, sizeof(save), 1, fp);
  448. X    fclose(fp);
  449. X    return temp;    
  450. X}
  451. X
  452. Xsave_dude(w)
  453. Xwinptr w;
  454. X{
  455. Xsave *temp;
  456. XFILE *fp;
  457. Xint i;
  458. Xchar fn[100];
  459. Xchar buf[200];
  460. X
  461. X    strcpy(fn,SAVEDIR);
  462. X    strcat(fn, w->Name);
  463. X    strcat(fn, ".xms");    
  464. X
  465. Xseteuid(euid);    
  466. X    fp=fopen(fn,"wb");
  467. Xseteuid(getuid());
  468. X
  469. X    if(!fp) {
  470. X        perror("Can't open save file");
  471. X        xmpb_error("Fatal xmpb error");
  472. X    }
  473. X    temp=(save *) malloc (sizeof(save));
  474. X    if(!temp)
  475. X        xmpb_error("Not enough memory");
  476. X    strcpy(temp->Name, w->Name);
  477. X    strcpy(temp->Ship, w->Ship);
  478. X    temp->energy_max=w->energy_max;
  479. X    temp->ls_max=w->ls_max;
  480. X    temp->bs_max=w->bs_max;
  481. X    temp->rs_max=w->rs_max;
  482. X    temp->credits=w->credits+w->earned;
  483. X    temp->kills = w->kills;
  484. X    strncpy(temp->password,w->password,9);
  485. X    temp->password[9] = 0;
  486. X    temp->ship_value=w->ship_value;
  487. X    for(i=0; i<NUM_ITEMS; i++)
  488. X    {
  489. X        temp->quality[i]=w->quality[i];
  490. X        if(w->state[i] > 0)
  491. X            temp->state[i]=w->state[i];
  492. X        else
  493. X            temp->state[i] = -1;
  494. X    }
  495. X    for(i=0; i<NO_WEAPONS; i++)
  496. X    {
  497. X        if(w->load_status[i] != -1)
  498. X            temp->does_have_weap[i]=w->does_have_weap[i];    
  499. X        else
  500. X            temp->does_have_weap[i] = 0;
  501. X        temp->weap_on_status[i]=w->weap_on_status[i];
  502. X    }    
  503. X    fwrite(temp, sizeof(save), 1, fp);
  504. X    fclose(fp);
  505. X    sprintf(buf,"chmod 600 %s",fn);
  506. X    free(temp);
  507. X}
  508. X
  509. Xclose_host(w)
  510. Xwinptr w;
  511. X{
  512. X    char buf[80];
  513. X
  514. X    XAutoRepeatOn(w->theDisplay);
  515. X    XCloseDisplay(w->theDisplay);
  516. X    XCloseDisplay(w->radar->theDisplay);
  517. X    XCloseDisplay(w->stats->theDisplay);
  518. X    if(!w->npc)
  519. X    {
  520. X        strcpy(buf, SAVEDIR);
  521. X        strcat(buf, w->Name);
  522. X        strcat(buf, ".lock");
  523. Xseteuid(euid);
  524. X        unlink(buf);
  525. Xseteuid(getuid());
  526. X    }    
  527. X}
  528. X
  529. Xhandle_quitting(w)
  530. Xwinptr w;
  531. X{
  532. X    char buf[10];
  533. X    int add;
  534. X
  535. X    XDrawImageString(w->theDisplay, w->theWindow, w->aGC, 20, 20, "Are you sure you wish to quit (y/n)? ", strlen("Are you sure you wish to quit (y/n)? "));
  536. X    while(XCheckWindowEvent(w->theDisplay,w->theWindow,KeyPressMask,&xe))    
  537. X    {
  538. X        if(xe.type==KeyPress)
  539. X        {
  540. X            XLookupString(&(xe.xkey),buf,10,&keysym,NULL);
  541. X            if(keysym==XK_y)    {
  542. X                winptr t, l;
  543. X                witemptr tw;
  544. X
  545. X                tw=first_weap_item;
  546. X                while(tw)
  547. X                {
  548. X                    if(tw->who==w)
  549. X                        tw->who=NULL;
  550. X                    tw=tw->next;
  551. X                }
  552. X                add=0;
  553. X                no_hosts--;
  554. X                if(w->quitting==2) {
  555. X
  556. X
  557. X                    num_alive--;
  558. X                    num_quit++;
  559. X                    untarget(w);
  560. X                    add=w->earned/3;
  561. X
  562. X                    if(num_alive && num_alive!=num_npcs_alive)
  563. X                        add=add/(num_alive-num_npcs_alive);
  564. X                    w->earned=w->earned*2/3;
  565. X                }
  566. X                t = first_win;
  567. X                if (t==w) {
  568. X                    first_win=w->next;
  569. X                    if(!w->npc || w->npcwin) close_host(w);
  570. X                    t=first_win;
  571. X                    while(t)
  572. X                    {
  573. X                        if(!t->exploding && !t->npc) t->earned+=add;
  574. X                        t=t->next;
  575. X                    }
  576. X                    return 1;
  577. X                }
  578. X                else 
  579. X                while(t) {
  580. X                    l=t;
  581. X                    t=t->next;
  582. X                    if(w==t) {
  583. X                        l->next=t->next;
  584. X                        if(!w->npc || w->npcwin) close_host(w);
  585. X                        t=first_win;
  586. X                        while(t)
  587. X                        {
  588. X                            if(!t->exploding && !t->npc) t->earned+=add;
  589. X                            t=t->next;
  590. X                        }
  591. X                        return 1;
  592. X                    }
  593. X                }
  594. X            }
  595. X            else  { /* not a y so not quitting */
  596. X                w->quitting=0;
  597. X            }
  598. X                
  599. X        }
  600. X    }
  601. X    return 0;
  602. X}
  603. X
  604. X/*
  605. X*    This obscurely named routine handles events for all of the windows
  606. X*/
  607. Xupdate_win_strs()
  608. X{
  609. X    winptr temp,t,old;
  610. X
  611. X
  612. X    if(num_alive==num_npcs_alive && num_npcs_windows==0)
  613. X    {
  614. X/*
  615. X        winptr w;
  616. X
  617. X        w = first_win;
  618. X        while(w)
  619. X        {
  620. X            if(w->npc)
  621. X                save_npc(w);
  622. X            else
  623. X                save_dude(w);
  624. X            w=w->next;
  625. X        }
  626. X        exit(0);
  627. X*/
  628. X        winners();
  629. X    }
  630. X    temp = first_win;
  631. X    while(temp != NULL)
  632. X    {
  633. X        t=temp;
  634. X        if(temp->quitting>0 && !temp->npc) 
  635. X        {
  636. X            if(handle_quitting(temp)) 
  637. X            {
  638. X                t = temp->next;
  639. X                if(!temp->npc)
  640. X                {
  641. X                    parse_shop_contents();
  642. X                    temp->ship_value=value_of_craft(temp);
  643. X                    save_dude(temp);
  644. X                }
  645. X                free(temp);
  646. X                temp =t;
  647. X            }
  648. X            else
  649. X                temp = temp->next;
  650. X        }
  651. X        else {
  652. X            if(!temp->npc)
  653. X                handle_events(temp);
  654. X            else if (!temp->exploding)
  655. X            {
  656. X            int i;
  657. X                for(i=0; i < 20 && execute_ins(temp,temp->comp); i++);
  658. X            }
  659. X            old=temp;
  660. X            temp = temp->next;
  661. X        }
  662. X    }
  663. X}
  664. X
  665. Xstart_turn_left(w)
  666. Xwinptr w;
  667. X{
  668. X    w->angle_changed = 1;
  669. X    if(w->angle_v > 0)
  670. X        w->angle_v = 0;
  671. X    w->tl = 1;
  672. X    w->tr = 0;
  673. X}
  674. X
  675. Xstart_turn_right(w)
  676. Xwinptr w;
  677. X{
  678. X    w->angle_changed = 1;
  679. X    w->tr = 1;
  680. X    if(w->angle_v < 0)
  681. X        w->angle_v = 0;
  682. X    w->tl = 0;
  683. X}
  684. X
  685. Xchange_view(w)
  686. Xwinptr w;
  687. X{
  688. X    int flag=0;
  689. X    winptr t;
  690. X
  691. X    if(!w->exploding)
  692. X        return;
  693. X    if(!w->watching)
  694. X        w->watching = first_win;
  695. X    else
  696. X    {
  697. X        w->watching = w->watching->next;
  698. X    }
  699. X    t = w->watching;
  700. XBLURGH:
  701. X    while(w->watching)
  702. X    {
  703. X        if(!w->watching->exploding)
  704. X        {
  705. X            flag = 1;
  706. X            return;
  707. X        }
  708. X        if(t == w->watching->next && w->watching->next)
  709. X            return;
  710. X        else if(t == first_win && !w->watching->next)
  711. X            return;
  712. X        w->watching = w->watching->next;
  713. X    }
  714. X    if(!w->watching)
  715. X    {
  716. X        w->watching = first_win;
  717. X        goto BLURGH;
  718. X    }
  719. X    if(!flag)
  720. X        w->watching = NULL;
  721. X}
  722. X    
  723. Xquit(w)
  724. Xwinptr w;
  725. X{
  726. X    if(w->npc) 
  727. X        return;
  728. X    xfe_clear(w);
  729. X    XDrawImageString(w->theDisplay, w->theWindow, w->aGC, 20, 20, "Are you sure you wish to quit (y/n)? ", strlen("Are you sure you wish to quit (y/n)? "));
  730. X        
  731. X    if(w->exploding) /* 1 = dead & quit, 2= !dead & quit */
  732. X        w->quitting=1;
  733. X    else
  734. X        w->quitting=2;
  735. X}
  736. X
  737. Xchange_repair(w)
  738. Xwinptr w;
  739. X{
  740. X    /*
  741. X    *    Got to the next one
  742. X    */
  743. X    w->rep_which=(w->rep_which+1)%(NUM_ITEMS+1);
  744. X
  745. X    /*
  746. X    *    Skip the ones that can't be repaired
  747. X    */    
  748. X    while(w->rep_which!=IDLE && 
  749. X        (w->state[w->rep_which]<=0 || w->state[w->rep_which]==100))
  750. X    {
  751. X        w->rep_which=(w->rep_which+1)%(NUM_ITEMS+1);
  752. X    }
  753. X}
  754. X
  755. Xgrab_energy(w)
  756. Xwinptr w;
  757. X{
  758. X    int tot,max;
  759. X
  760. X    tot=w->ls_curr+w->rs_curr+w->bs_curr;
  761. X    if((w->energy_max-w->energy_curr) > tot/2)
  762. X    {
  763. X        w->energy_curr+=tot/2;
  764. X        w->ls_curr /= 2;
  765. X        w->rs_curr /= 2;
  766. X        w->bs_curr /= 2;
  767. X    }
  768. X}    
  769. X
  770. Xinvis(w)
  771. Xwinptr w;
  772. X{
  773. X    w->cloaking=1-w->cloaking;
  774. X    if(w->state[CLOAK]<=0) 
  775. X        w->cloaking=0;
  776. X}
  777. X
  778. Xbalance_shields(w)
  779. Xwinptr w;
  780. X{
  781. X    int tot,max;
  782. X    
  783. X    tot=w->ls_curr+w->rs_curr+w->bs_curr;
  784. X    max=w->ls_max+w->rs_max+w->bs_max;
  785. X    w->ls_curr=((w->ls_max*tot)/max);
  786. X    w->rs_curr=((w->rs_max*tot)/max);
  787. X    w->bs_curr=((w->bs_max*tot)/max);
  788. X}
  789. X
  790. Xchange_target(w)
  791. Xwinptr w;
  792. X{
  793. X    winptr temp;
  794. X
  795. X    if(w->exploding!=0 || w->state[TC] == -1) 
  796. X        return;    
  797. X    if(!w->targeting)    /* not targeting anyone yet */    
  798. X    {
  799. X        temp=first_win; /* so set to first */
  800. X    }
  801. X    else
  802. X        temp=w->targeting->next; /* else next */
  803. X
  804. X    while(temp && (((temp->cloaking) &&
  805. X        (temp->state[CLOAK]>=rand()%100+1)) || (w==temp)
  806. X        || (temp->exploding))) 
  807. X    {                        /* watch we don't target 
  808. X                            * cloak'ns, ourself or deaders */
  809. X        temp=temp->next;
  810. X    }
  811. X    w->targeting=temp;
  812. X}
  813. X
  814. Xstop_turn_left(w)
  815. Xwinptr w;
  816. X{
  817. X    w->tl = 0;
  818. X    w->tr = 0;
  819. X    w->angle_v = 0;
  820. X}
  821. X
  822. Xstop_turn_right(w)
  823. Xwinptr w;
  824. X{
  825. X        w->tr = 0;
  826. X        w->tl = 0;
  827. X        w->angle_v = 0;
  828. X}
  829. END_OF_FILE
  830. if test 11684 -ne `wc -c <'handle_ev.c'`; then
  831.     echo shar: \"'handle_ev.c'\" unpacked with wrong size!
  832. fi
  833. # end of 'handle_ev.c'
  834. fi
  835. if test -f 'radar.c' -a "${1}" != "-c" ; then 
  836.   echo shar: Will not clobber existing file \"'radar.c'\"
  837. else
  838. echo shar: Extracting \"'radar.c'\" \(10038 characters\)
  839. sed "s/^X//" >'radar.c' <<'END_OF_FILE'
  840. X/* radar.c - *** routines for the radar window */
  841. X
  842. Xstatic char sccs_id[] = "@(#)radar.c 1.17 92/11/24 XMPB";
  843. X
  844. X#include "player.h"
  845. X#include "bitmaps/ship.0"
  846. X#define BORDER_WIDTH 2
  847. X#define RES_NAME "da" 
  848. X#define RES_CLASS "da"
  849. X#define RADARW 200
  850. X#define RADARH 200
  851. X
  852. X
  853. Xint worldw,worldh;
  854. Xextern junkptr first_junk;
  855. Xextern witemptr first_weap_item;
  856. Xextern winptr first_win;
  857. X
  858. Xsubwinptr xfe_open_sub_window(dn,win_name,w,h,x,y)
  859. Xchar *dn, *win_name;
  860. Xint w,h,x,y;
  861. X{
  862. X    XGCValues       theGCValues;
  863. X    XSetWindowAttributes    theWindowAttributes;
  864. X    XSizeHints      theSizeHints;
  865. X    unsigned long       theWindowMask;
  866. X    Pixmap          theIconPixmap;
  867. X    XWMHints        theWMHints;
  868. X    subwinptr        temp;
  869. X    XClassHint      theClassHint;
  870. X
  871. X    temp=(subwinptr)malloc(sizeof(struct subwin));
  872. X    if(temp == NULL)
  873. X    {
  874. X        return NULL;
  875. X    }
  876. X
  877. X    if(!strcmp(dn,"")) temp->theDisplay = XOpenDisplay(NULL);
  878. X    temp->theDisplay = XOpenDisplay(dn);
  879. X
  880. X    if(!(temp->theDisplay))
  881. X    {
  882. X        free(temp);
  883. X        return NULL;
  884. X    }
  885. X
  886. X    temp->theScreen = DefaultScreen(temp->theDisplay);
  887. X    temp->thedepth = DefaultDepth(temp->theDisplay,temp->theScreen);
  888. X    temp->theBlackPixel = BlackPixel(temp->theDisplay,temp->theScreen);
  889. X    temp->theWhitePixel = WhitePixel(temp->theDisplay,temp->theScreen);
  890. X    temp->theCursor = XCreateFontCursor(temp->theDisplay,XC_crosshair);
  891. X
  892. X    theWindowAttributes.border_pixel = temp->theBlackPixel;
  893. X      theWindowAttributes.background_pixel = temp->theBlackPixel;
  894. X    theWindowAttributes.cursor = temp->theCursor;
  895. X    theWindowAttributes.override_redirect = False;
  896. X
  897. X    theWindowMask = CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWCursor;
  898. X
  899. X    temp->theWindow = XCreateWindow(temp->theDisplay,
  900. X            RootWindow(temp->theDisplay,temp->theScreen),
  901. X            x,y,w,h,BORDER_WIDTH,CopyFromParent,CopyFromParent,
  902. X            CopyFromParent,theWindowMask,&theWindowAttributes);
  903. X
  904. X    theIconPixmap = XCreateBitmapFromData(temp->theDisplay,temp->theWindow,ship0_bits,ship0_width,ship0_height);
  905. X    theWMHints.initial_state = NormalState;
  906. X
  907. X    theWMHints.icon_pixmap = theIconPixmap;
  908. X
  909. X    theWMHints.flags = IconPixmapHint | StateHint;
  910. X
  911. X    XSetWMHints(temp->theDisplay,temp->theWindow,&theWMHints);
  912. X
  913. X    XStoreName(temp->theDisplay,temp->theWindow,win_name);
  914. X    XSetIconName(temp->theDisplay,temp->theWindow,win_name);
  915. X
  916. X    theClassHint.res_name = RES_NAME;
  917. X    theClassHint.res_class = RES_CLASS;
  918. X
  919. X    XSetClassHint(temp->theDisplay,temp->theWindow,&theClassHint);
  920. X
  921. X    theSizeHints.flags = USPosition | USSize | PMinSize | PMaxSize;
  922. X    theSizeHints.x     = x;
  923. X    theSizeHints.y     = y;
  924. X    theSizeHints.width = w;
  925. X    theSizeHints.height = h;
  926. X    theSizeHints.min_width = w;
  927. X    theSizeHints.max_width = w;
  928. X    theSizeHints.min_height = h;
  929. X    theSizeHints.max_height = h;
  930. X
  931. X    XSetNormalHints(temp->theDisplay,temp->theWindow,&theSizeHints);
  932. X    theGCValues.function = GXcopy;
  933. X    theGCValues.foreground = temp->theWhitePixel;
  934. X    theGCValues.background = temp->theBlackPixel;
  935. X    temp->theGC = XCreateGC(temp->theDisplay,temp->theWindow,(unsigned long
  936. X)(GCFunction|GCForeground|GCBackground),&theGCValues);
  937. X
  938. X    if(temp->theGC == 0)
  939. X     {
  940. X        XDestroyWindow(temp->theDisplay,temp->theWindow);
  941. X        free(temp);
  942. X        return NULL;
  943. X    }
  944. X    XSetForeground(temp->theDisplay,temp->theGC,temp->theWhitePixel);
  945. X    XSetBackground(temp->theDisplay,temp->theGC,temp->theBlackPixel);
  946. X    XSelectInput(temp->theDisplay,temp->theWindow,ExposureMask);
  947. X    XMapWindow(temp->theDisplay,temp->theWindow);
  948. X    XFlush(temp->theDisplay);
  949. X
  950. X    return temp;
  951. X
  952. X}
  953. X
  954. Xdraw_bigrocks(w)
  955. Xwinptr w;
  956. X{
  957. X
  958. X    junkptr j;
  959. X    witemptr b;
  960. X    int x,y;
  961. X
  962. X    j = first_junk;
  963. X    while(j)
  964. X    {
  965. X        if(j->type==BIGROCK && w->quality[SHORTRR] > 1) {
  966. X           x=RADARW/2+(j->sx-w->sx)*RADARW/(worldw*2);
  967. X           y=RADARH/2+(w->sy-j->sy)*RADARH/(worldh*2);
  968. X           XDrawPoint(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  969. X                x,y);
  970. X        }
  971. X        if(j->type==MEDROCK && w->quality[SHORTRR] > 2) {
  972. X           x=RADARW/2+(j->sx-w->sx)*RADARW/(worldw*2);
  973. X           y=RADARH/2+(w->sy-j->sy)*RADARH/(worldh*2);
  974. X           XDrawPoint(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  975. X                x,y);
  976. X        }
  977. X        if(j->type==SMALLROCK && w->quality[SHORTRR] > 3) {
  978. X           x=RADARW/2+(j->sx-w->sx)*RADARW/(worldw*2);
  979. X           y=RADARH/2+(w->sy-j->sy)*RADARH/(worldh*2);
  980. X           XDrawPoint(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  981. X                x,y);
  982. X        }
  983. X        if(j->type > CLOUD6 && w->quality[SHORTRR] > 5) {
  984. X           x=RADARW/2+(j->sx-w->sx)*RADARW/(worldw*2);
  985. X           y=RADARH/2+(w->sy-j->sy)*RADARH/(worldh*2);
  986. X           XDrawPoint(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  987. X                x,y);
  988. X        }
  989. X        if(j->type > CLOUD1 && j->type < DEBRIS1 && w->quality[SHORTRR] > 6) {
  990. X           x=RADARW/2+(j->sx-w->sx)*RADARW/(worldw*2);
  991. X           y=RADARH/2+(w->sy-j->sy)*RADARH/(worldh*2);
  992. X           XDrawPoint(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  993. X                x,y);
  994. X        }
  995. X        j=j->next;
  996. X    }
  997. X    if(w->quality[SHORTRR] < 8) return;
  998. X    b = first_weap_item;
  999. X    while(b)
  1000. X    {
  1001. X        x=RADARW/2+(b->sx-w->sx)*RADARW/(worldw*2);
  1002. X        y=RADARH/2+(w->sy-b->sy)*RADARH/(worldh*2);
  1003. X        XDrawPoint(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  1004. X            x,y);
  1005. X        b = b->next;
  1006. X    }
  1007. X}
  1008. X
  1009. Xdraw_walls(w)
  1010. Xwinptr w;
  1011. X{
  1012. X    int x,y, yl, xl, xt, yt, xwall, ywall;
  1013. X
  1014. X    xwall=ywall=0;
  1015. X    if(w->sx>0) 
  1016. X    {
  1017. X        x=RADARW/2+(WORLDW-w->sx)*RADARW/(worldw*2);
  1018. X        if((RADARW)>x)
  1019. X            xwall=1;
  1020. X    }
  1021. X    else 
  1022. X    {
  1023. X        x=RADARW/2+(-WORLDW-w->sx)*RADARW/(worldw*2);
  1024. X        if((RADARW/2)>x && x>0)
  1025. X            xwall=1;
  1026. X    }
  1027. X    if(w->sy>0)
  1028. X    {
  1029. X        y=RADARH/2+(w->sy-WORLDH)*RADARH/(worldh*2);
  1030. X        if((RADARH/2)>y && y>0)
  1031. X            ywall=1;
  1032. X    }
  1033. X    else
  1034. X    {
  1035. X        y=RADARH/2+(w->sy+WORLDH)*RADARH/(worldh*2);
  1036. X        if((RADARH)>y)
  1037. X            ywall=1;
  1038. X    }
  1039. X    if(xwall && ywall)  /* we have two walls */
  1040. X    {
  1041. X        if(w->sx>0)
  1042. X        {
  1043. X            xl=0;
  1044. X            xt=x;
  1045. X        }
  1046. X        else
  1047. X        {
  1048. X            xl=x;
  1049. X            xt=RADARW;
  1050. X        }
  1051. X        if(w->sy>0)
  1052. X        {
  1053. X            yl=y;
  1054. X            yt=RADARH;
  1055. X        }
  1056. X        else
  1057. X        {
  1058. X            yl=0;
  1059. X            yt=y;
  1060. X        }
  1061. X        XDrawLine(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  1062. X            x, yl, x, yt);
  1063. X        XDrawLine(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  1064. X            xl, y, xt, y);
  1065. X    }
  1066. X    else  /* only one so ... */
  1067. X    {
  1068. X        if(xwall)
  1069. X            XDrawLine(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  1070. X                x, 0, x, RADARH);
  1071. X        if(ywall)
  1072. X            XDrawLine(w->radar->theDisplay,w->radar->theWindow, w->radar->theGC,
  1073. X                0, y, RADARW, y);
  1074. X    }
  1075. X}
  1076. X
  1077. Xdo_radar(w)
  1078. Xwinptr w;
  1079. X{
  1080. X    char buf[20];
  1081. X    winptr temp;
  1082. X    int sx,sy,x,y;
  1083. X
  1084. X    if(w->short_range_radar)
  1085. X    {
  1086. X        worldh = WORLDH / 4;
  1087. X        worldw = WORLDW / 4;
  1088. X        if(w->state[SHORTRR] < rand()%100+1) 
  1089. X            return;
  1090. X        draw_bigrocks(w);
  1091. X        if(w->quality[SHORTRR]>4) draw_walls(w);
  1092. X    }
  1093. X    else
  1094. X    {
  1095. X        worldh = WORLDH;
  1096. X        worldw = WORLDW;
  1097. X        if(w->state[LONGRR]<rand()%100+1)
  1098. X            return;
  1099. X    }
  1100. X    sprintf(buf,"%2dx",WORLDW/worldw);
  1101. X    XDrawString(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,0,198,buf,strlen(buf));
  1102. X    
  1103. X    temp=first_win;
  1104. X    while(temp!=NULL) {
  1105. X        x=RADARW/2 + (temp->sx)/(2*WORLDW/RADARW);
  1106. X        y=RADARH/2 - (temp->sy)/(2*WORLDH/RADARH);
  1107. X        if(temp==w) 
  1108. X        {
  1109. X            if(w->short_range_radar)
  1110. X            {
  1111. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1112. X                    RADARW/2-1, RADARH/2-1);
  1113. X                   XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1114. X                    RADARW/2+1,RADARH/2-1);
  1115. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1116. X                    RADARW/2+1,RADARH/2+1);
  1117. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1118. X                    RADARW/2-1,RADARH/2+1);
  1119. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1120. X                    RADARW/2,RADARH/2);
  1121. X            }
  1122. X            else
  1123. X            {
  1124. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1125. X                    x-1,y-1);
  1126. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1127. X                    x+1,y-1);
  1128. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1129. X                    x+1,y+1);
  1130. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1131. X                    x-1,y+1);
  1132. X                XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,x,y);
  1133. X            } 
  1134. X        }
  1135. X        else if(!temp->exploding) 
  1136. X        {
  1137. X        int chance=0;
  1138. X
  1139. X            if(w->short_range_radar) 
  1140. X            {
  1141. X            int c,r;
  1142. X    
  1143. X                
  1144. X                if(temp->cloaking)
  1145. X                {
  1146. X                    c=(temp->quality[CLOAK]-1)*temp->state[CLOAK];
  1147. X                    r=w->quality[SHORTRR]*w->state[SHORTRR];
  1148. X                    if(c+r!=0)
  1149. X                        chance=(r-c)*100/(c+r) + 50;
  1150. X                }
  1151. X                if(!temp->cloaking || (temp->cloaking && chance >= (rand()%100+1)))
  1152. X                {
  1153. X                    x=RADARW/2+(temp->sx-w->sx)*RADARW/(worldw*2);
  1154. X                    y=RADARH/2+(w->sy-temp->sy)*RADARH/(worldh*2);
  1155. X                    if(w->targeting==temp) 
  1156. X                    {
  1157. X                        XDrawLine(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1158. X                            x-4,y,x+4,y);
  1159. X                        XDrawLine(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1160. X                            x,y-4,x,y+4);
  1161. X                    }
  1162. X                    else 
  1163. X                    {
  1164. X                        XDrawRectangle(w->radar->theDisplay,w->radar->theWindow,
  1165. X                                    w->radar->theGC,x-1,y-1,3,3);
  1166. X                    }
  1167. X                }
  1168. X                else
  1169. X                {
  1170. X                int xx, yy;
  1171. X
  1172. X                    xx=rand()%RADARW;
  1173. X                    yy=rand()%RADARH;
  1174. X                    XDrawRectangle(w->radar->theDisplay,w->radar->theWindow,
  1175. X                        w->radar->theGC,xx-1, yy-1, 3, 3);
  1176. X                }
  1177. X            }
  1178. X            else 
  1179. X            {
  1180. X            int c,r;
  1181. X
  1182. X                if(temp->cloaking)
  1183. X                {
  1184. X                    c=(temp->quality[CLOAK]-1)*temp->state[CLOAK];
  1185. X                    r=w->quality[LONGRR]*w->state[LONGRR];
  1186. X                    if(c+r!=0)
  1187. X                        chance=(r-c)*100/(c+r) + 50;
  1188. X                }    
  1189. X                if(!temp->cloaking || (temp->cloaking && chance >= (rand()%100+1)))
  1190. X                {
  1191. X                    XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1192. X                        x,y);
  1193. X                    if(w->targeting==temp) 
  1194. X                    {
  1195. X                        XDrawLine(w->radar->theDisplay,w->radar->theWindow,
  1196. X                            w->radar->theGC,x-2,y,x+2,y);
  1197. X                        XDrawLine(w->radar->theDisplay,w->radar->theWindow,
  1198. X                            w->radar->theGC,x,y-2,x,y+2);
  1199. X                    }
  1200. X                }
  1201. X                else
  1202. X                {
  1203. X                    XDrawPoint(w->radar->theDisplay,w->radar->theWindow,w->radar->theGC,
  1204. X                        rand()%PLAYW,rand()%PLAYH);
  1205. X                }
  1206. X            }
  1207. X        }
  1208. X        temp=temp->next;
  1209. X    }
  1210. X    XFlush(w->radar->theDisplay);
  1211. X}
  1212. X
  1213. Xredo_radar(w)
  1214. Xwinptr w;
  1215. X{
  1216. X    XClearWindow(w->radar->theDisplay,w->radar->theWindow);
  1217. X    XFlush(w->radar->theDisplay);
  1218. X}
  1219. END_OF_FILE
  1220. if test 10038 -ne `wc -c <'radar.c'`; then
  1221.     echo shar: \"'radar.c'\" unpacked with wrong size!
  1222. fi
  1223. # end of 'radar.c'
  1224. fi
  1225. if test -f 'shop.contents' -a "${1}" != "-c" ; then 
  1226.   echo shar: Will not clobber existing file \"'shop.contents'\"
  1227. else
  1228. echo shar: Extracting \"'shop.contents'\" \(8155 characters\)
  1229. sed "s/^X//" >'shop.contents' <<'END_OF_FILE'
  1230. XEngines
  1231. XEngine(1)
  1232. XThis is the most basic engine available
  1233. XDon' expect to last too long with this engine.
  1234. X
  1235. XEnergy Use:   7 units per turn.
  1236. XAcceleration: 1/2 units/turn/turn
  1237. X$500
  1238. XEngine(2)
  1239. XEnergy Use:   7 units per turn.
  1240. XAcceleration: 1 units/turn/turn
  1241. X$1000
  1242. XEngine(3)
  1243. XEnergy Use:   7 units per turn.
  1244. XAcceleration: 3/2 units/turn/turn
  1245. X$2000
  1246. XEngine(4)
  1247. XEnergy Use:   7 units per turn.
  1248. XAcceleration: 2 units/turn/turn
  1249. X$5000
  1250. XEngine(5)
  1251. XEnergy Use:   7 units per turn.
  1252. XAcceleration: 2 1/2 units/turn/turn
  1253. X$10000
  1254. XEngine(6)
  1255. XEnergy Use:   7 units per turn.
  1256. XAcceleration: 3 units/turn/turn
  1257. X$20000
  1258. XEngine(7)
  1259. XEnergy Use:   7 units per turn.
  1260. XAcceleration: 3 1/2 units/turn/turn
  1261. X$40000
  1262. XEngine(8)
  1263. XEnergy Use:   7 units per turn.
  1264. XAcceleration: 4 units/turn/turn
  1265. X$80000
  1266. XEngine(9)
  1267. XEnergy Use:   7 units per turn.
  1268. XAcceleration: 4 1/2 units/turn/turn
  1269. X$160000
  1270. X###
  1271. XSolar Panels
  1272. XSolar(1)
  1273. XEnergy gain: 3/2 units per turn
  1274. X$500
  1275. XSolar(2)
  1276. XEnergy gain: 3 units per turn
  1277. X$1000
  1278. XSolar(3)
  1279. XEnergy gain: 4 1/2 units per turn
  1280. X$5000
  1281. XSolar(4)
  1282. XEnergy gain: 6 units per turn
  1283. X$10000
  1284. XSolar(5)
  1285. XEnergy gain: 7 1/2 units per turn
  1286. X$30000
  1287. XSolar(6)
  1288. XEnergy gain: 9 units per turn
  1289. X$70000
  1290. XSolar(7)
  1291. XEnergy gain: 10 1/2 units per turn
  1292. X$150000
  1293. XSolar(8)
  1294. XEnergy gain: 12 units per turn
  1295. X$300000
  1296. XSolar(9)
  1297. XEnergy gain: 13 1/2 units per turn
  1298. X$600000
  1299. X###
  1300. XRadar
  1301. XLong Range Radar(1)
  1302. XThis device shows the whole playing field
  1303. Xand the positions of all the combatants.
  1304. XThe outer edge of the radar is where the
  1305. Xwalls of the playing field are.
  1306. XThe dots represent the other combatants,
  1307. Xwhilst the cross represents yourself.
  1308. X$100
  1309. XLong Range Radar(2)
  1310. X    This device will detect Jammers of 
  1311. Xquality 2 
  1312. X$1000
  1313. XLong Range Radar(3)
  1314. X    This device will detect Jammers of 
  1315. Xquality 3 or less
  1316. X$4000
  1317. XLong Range Radar(4)
  1318. X    This device will detect Jammers of 
  1319. Xquality 4 or less
  1320. X$7500
  1321. XLong Range Radar(5)
  1322. X    This device will detect Jammers of 
  1323. Xquality 5 or less
  1324. X$10000
  1325. XLong Range Radar(6)
  1326. X    This device will detect Jammers of 
  1327. Xquality 6 or less
  1328. X$12000
  1329. XLong Range Radar(7)
  1330. X    This device will detect Jammers of 
  1331. Xquality 7 or less
  1332. X$15000
  1333. XLong Range Radar(8)
  1334. X    This device will detect Jammers of 
  1335. Xquality 8 or less
  1336. X$18000
  1337. XLong Range Radar(9)
  1338. X    This device will detect Jammers of 
  1339. Xquality 9 or less
  1340. X$20000
  1341. XShort Range Radar(1)
  1342. XThis device shows a view of what is currently
  1343. Xaround your ship.  The center cross is your ship
  1344. Xand the squares are opponents.
  1345. X$100
  1346. XShort Range Radar(2)
  1347. XLike a short range radar(1), this radar shows the
  1348. Xcombatants who are close to you, and it shows large
  1349. Xrocks as well. These appear as a dot on the radar.
  1350. X$500
  1351. XShort Range Radar(3)
  1352. XThis radar shows both large and medium sized rocks
  1353. Xas well as combatants.
  1354. X$1000
  1355. XShort Range Radar(4)
  1356. XThis radar shows all combatants and rock
  1357. X(large, medium and small)
  1358. X$2000
  1359. XShort Range Radar(5)
  1360. XThis radar shows you all combatants, 
  1361. Xall rocks and the walls as they come into view
  1362. X$8000
  1363. XShort Range Radar(6)
  1364. XThis radar shows you all combatants,
  1365. Xall the rocks, the walls as they come into view
  1366. Xand any debris that is floating in space.
  1367. X$12000
  1368. XShort Range Radar(7)
  1369. XThis Radar shows you all combatants,
  1370. Xall the rocks, the walls as they come into view
  1371. Xany debris that is floating in space and the
  1372. Xclouds that appear when you score a hit.
  1373. X$15000
  1374. XShort Range Radar(8)
  1375. XThis radar shows the combatants, all rocks and the
  1376. Xclouds, debris, walls and all the weapons.
  1377. X$30000
  1378. X###
  1379. XWeapons
  1380. XPulse Rifle
  1381. XEnergy Use:       10 units
  1382. XFiring Rate:      1 turn
  1383. XDamage:           10
  1384. XRange:            1000 units
  1385. XVelocity:         50 units/turn
  1386. X$500
  1387. XEnergy Bomb
  1388. XEnergy Use:       50 units
  1389. XFiring Rate:      3 turn
  1390. XDamage:           45
  1391. XRange:            450 units
  1392. XVelocity:         30 units/turn
  1393. X$4500
  1394. XSeeker (T)
  1395. XSeeker Bomb
  1396. XEnergy Use:       100 units
  1397. XFiring Rate:      10 turn
  1398. XDamage:           80
  1399. XRange:            1600 units
  1400. XVelocity:         20 units/turn
  1401. XNote: To fire Seeker bombs requires a targeting
  1402. XComputer.
  1403. X$5000
  1404. XLight Laser
  1405. XEnergy Use:       50 units
  1406. XFiring Rate:      4 turn
  1407. XDamage:           40
  1408. XRange:            N/A
  1409. XVelocity:         N/A
  1410. X$10000
  1411. XRail Gun    
  1412. XEnergy Use:       70 units
  1413. XFiring Rate:      3 turn
  1414. XDamage:           50
  1415. XRange:            4000 units
  1416. XVelocity:         50 units/turn
  1417. X$50000
  1418. XMass Driver
  1419. XEnergy Use:       30 units
  1420. XFiring Rate:      2 turn
  1421. XDamage:           25
  1422. XRange:            800 
  1423. XVelocity:         20 units/turn
  1424. X$2500
  1425. XMine
  1426. XEnergy Use:       180 units
  1427. XFiring Rate:      8 turn
  1428. XDamage:           180
  1429. XDuration:         5000 units 
  1430. XVelocity:         -5 units/turn
  1431. X$8000
  1432. XHeavy Laser  
  1433. XEnergy Use:       80 units
  1434. XFiring Rate:      6 turn
  1435. XDamage:           60
  1436. XRange:            N/A
  1437. XVelocity:         N/A
  1438. X$70000
  1439. XAtomic Spray  
  1440. XEnergy Use:       5 units
  1441. XFiring Rate:      1 turn
  1442. XDamage:           2 
  1443. XRange:            1200 
  1444. XVelocity:         40  units/turn
  1445. X$17500
  1446. XMagneto Disk(T) 
  1447. XEnergy Use:       130 units
  1448. XFiring Rate:      8 turn
  1449. XDamage:           120
  1450. XRange:            4000 
  1451. XVelocity:         40 units/turn
  1452. X$120000
  1453. XHvy Pulse Rifle
  1454. XEnergy Use:       20 units
  1455. XFiring Rate:      2 turn
  1456. XDamage:           20
  1457. XRange:            1650 
  1458. XVelocity:         55 units/turn
  1459. X$8000
  1460. XBlack Death
  1461. XEnergy Use:       400 units
  1462. XFiring Rate:      40 turn
  1463. XDamage:           400
  1464. XRange:            400 
  1465. XVelocity:         40 units/turn
  1466. X$75000
  1467. XClover Launch
  1468. XEnergy Use:       30 units 
  1469. XFiring Rate:      3 turn
  1470. XDamage:           30
  1471. XRange:            2100
  1472. XVelocity:         60 units/turn
  1473. X$20000
  1474. XVortex Gun
  1475. XEnergy Use:       50 units 
  1476. XFiring Rate:      4 turn
  1477. XDamage:           45
  1478. XRange:            3000
  1479. XVelocity:         50 units/turn
  1480. X$25000
  1481. XMissile
  1482. XEnergy Use:       70 units 
  1483. XFiring Rate:      3 turn
  1484. XDamage:           55
  1485. XRange:            8000
  1486. XVelocity:         80 units/turn
  1487. Xunits/turn
  1488. X$27500
  1489. X###
  1490. XRepair Systems
  1491. XRepair(1)
  1492. XEnergy Cost: 50 units
  1493. XRepair Rate: 1 units/10 turns
  1494. X$100
  1495. XRepair(2)
  1496. XEnergy Cost: 25 units
  1497. XRepair Rate: 1 units/9 turns
  1498. X$250
  1499. XRepair(3)
  1500. XEnergy Cost: 16 units
  1501. XRepair Rate: 1 units/8 turns
  1502. X$500
  1503. XRepair(4)
  1504. XEnergy Cost: 12 units
  1505. XRepair Rate: 1 units/7 turns
  1506. X$1000
  1507. XRepair(5)
  1508. XEnergy Cost: 10 units
  1509. XRepair Rate: 1 units/6 turns
  1510. X$5000
  1511. XRepair(6)
  1512. XEnergy Cost: 5 units
  1513. XRepair Rate: 1 units/5 turns
  1514. X$10000
  1515. XRepair(7)
  1516. XEnergy Cost: 7 units
  1517. XRepair Rate: 1 units/4 turns
  1518. X$20000
  1519. XRepair(8)
  1520. XEnergy Cost: 6 units
  1521. XRepair Rate: 1 units/3 turns
  1522. X$30000
  1523. XRepair(9)
  1524. XEnergy Cost: 5 units
  1525. XRepair Rate: 1 units/2 turns
  1526. X$40000
  1527. X###
  1528. XMiscellaneous
  1529. XTargeting Computer
  1530. X    The targeting computer is needed if you wish to 
  1531. Xuse the Seeker weapon. These seeker weapons will 
  1532. Xseek out and explode upon their target. The target
  1533. Xis chosen by using the targeting computer.
  1534. X$4000
  1535. XJammer(2)
  1536. X    This device allows the ship to be cloaked. This
  1537. Xcloaking means that other ships will not see you on
  1538. Xtheir radar.  This can be a good stealth attack 
  1539. Xweapon.  It uses a small amount of energy to cloak,
  1540. Xbut if you thrust, fire and cloak. Watch Out! 
  1541. X    If you fire, then you once again appear on others
  1542. Xradars.
  1543. X    A Jammer(2) can be detected by a radar(2)
  1544. X$2000
  1545. XJammer(3)
  1546. X    A Jammer(3) will hide you from other
  1547. Xcombatants radars of quality less than 3
  1548. X$5000
  1549. XJammer(4)
  1550. X    A Jammer(4) will hide you from other
  1551. Xcombatants radars of quality less than 4
  1552. X$10000
  1553. XJammer(5)
  1554. X    A Jammer(5) will hide you from other
  1555. Xcombatants radars of quality less than 5
  1556. XThis Jammer only shows about 3/4 of your
  1557. Xship when you are in plain view of an
  1558. Xopponent
  1559. X$20000
  1560. XJammer(6)
  1561. X    A Jammer(6) will hide you from other
  1562. Xcombatants radars of quality less than 6
  1563. XThis jammer only shows about a 1/2 of
  1564. Xyour ship when in plain view
  1565. X$30000
  1566. XJammer(7)
  1567. X    A Jammer(7) will hide you from other
  1568. Xcombatants radars of quality less than 7
  1569. XThis Jammer only shows about a 1/4 of
  1570. Xyour ship in plain view
  1571. X$40000
  1572. XJammer(8)
  1573. X    A Jammer(8) will hide you from other
  1574. Xcombatants radars of quality less than 8
  1575. XThis Jammer camouflage you as stars
  1576. Xwhen in plain view
  1577. X$50000
  1578. XJammer(9)
  1579. X    A Jammer(9) will hide you from other
  1580. Xcombatants radars of quality less than 9
  1581. XThis Jammer completely covers you from 
  1582. Xplain view
  1583. X$60000
  1584. X###
  1585. XShields
  1586. XLeft Shield
  1587. XIncrease your Left Shield capacity by 100 units.
  1588. X$12000
  1589. XRight Shield
  1590. XIncrease your Right Shield capacity by 100 units.
  1591. X$12000
  1592. XBottom Shield
  1593. XIncrease your Bottom Shield capacity by 100 units.
  1594. X$10000
  1595. X###
  1596. XEnergy
  1597. XBattery
  1598. XIncrease your Maximum Energy capacity by 100 units.
  1599. X$15000
  1600. END_OF_FILE
  1601. if test 8155 -ne `wc -c <'shop.contents'`; then
  1602.     echo shar: \"'shop.contents'\" unpacked with wrong size!
  1603. fi
  1604. # end of 'shop.contents'
  1605. fi
  1606. if test -f 'test.c' -a "${1}" != "-c" ; then 
  1607.   echo shar: Will not clobber existing file \"'test.c'\"
  1608. else
  1609. echo shar: Extracting \"'test.c'\" \(12372 characters\)
  1610. sed "s/^X//" >'test.c' <<'END_OF_FILE'
  1611. X/* test.c - *** Main loop of xmpb */
  1612. X
  1613. Xstatic char sccs_id[] = "@(#)test.c 1.23 92/11/24 XMPB";
  1614. X
  1615. Xint installed=1;
  1616. X
  1617. X#include "player.h"
  1618. X#include <math.h>
  1619. X#include <X11/keysym.h>
  1620. X#include "save.h"
  1621. X#include <signal.h>
  1622. X#include "bits.h"
  1623. X#include "bits.c"
  1624. X#include <sys/types.h>
  1625. X#include <sys/time.h>
  1626. X#include <sys/stat.h>
  1627. X#include <fcntl.h>
  1628. X#include <errno.h>
  1629. X
  1630. X#define MAXSHIPWIDTH 91
  1631. X#define MAXSHIPHEIGHT 91
  1632. X#define maj 1
  1633. X#define min 1
  1634. X
  1635. Xextern winptr first_win;
  1636. Xextern int no_lasers;
  1637. Xextern int no_hosts, numnpcs; 
  1638. Xextern int num_quit;
  1639. Xextern int errno;
  1640. Xextern int num_alive;
  1641. X
  1642. Xint counter=5;
  1643. Xlong time_started, time_limit=900;
  1644. Xint mins_left, mins_gone, secs_left;
  1645. Xint all_combs;
  1646. Xint euid;
  1647. X
  1648. X/*
  1649. X** set default keys
  1650. X*/
  1651. Xinit_prefs(w, name)
  1652. Xwinptr w;
  1653. Xchar *name;
  1654. X{
  1655. X
  1656. X    char *t;
  1657. X
  1658. X    w->prefs.turnLeft=XK_z;
  1659. X    w->prefs.turnRight=XK_x;
  1660. X    w->prefs.toggleRadar=XK_c;
  1661. X    w->prefs.toggleShieldsRegen=XK_s;
  1662. X    w->prefs.toggleWeaponStatus=XK_w;
  1663. X    w->prefs.changeRepair=XK_r;
  1664. X    w->prefs.changeTarget=XK_t;
  1665. X    w->prefs.invisibility=XK_i;
  1666. X    w->prefs.quit=XK_q;
  1667. X    w->prefs.grabEnergy=XK_g;
  1668. X    w->prefs.balanceShields=XK_b;
  1669. X    w->prefs.changeView=XK_plus;
  1670. X    w->prefs.fire=XK_space;
  1671. X    w->prefs.changeWeapon=XK_p;
  1672. X    w->prefs.thrust=XK_l;
  1673. X    t="";
  1674. X    t=XGetDefault(w->theDisplay, name, "turnLeft");
  1675. X    if(t!=NULL)
  1676. X    {
  1677. X        w->prefs.turnLeft=XStringToKeysym(t);
  1678. X        t="";
  1679. X    }
  1680. X    t=XGetDefault(w->theDisplay, name, "turnRight");
  1681. X    if(t!=NULL)
  1682. X    {
  1683. X        w->prefs.turnRight=XStringToKeysym(t);
  1684. X        t="";
  1685. X    }
  1686. X    t=XGetDefault(w->theDisplay, name, "toggleRadar");
  1687. X    if(t!=NULL)
  1688. X    {
  1689. X        w->prefs.toggleRadar=XStringToKeysym(t);
  1690. X        t="";
  1691. X    }
  1692. X    t=XGetDefault(w->theDisplay, name, "toggleShieldsRegen");
  1693. X    if(t!=NULL)
  1694. X    {
  1695. X        w->prefs.toggleShieldsRegen=XStringToKeysym(t);
  1696. X        t="";
  1697. X    }
  1698. X    t=XGetDefault(w->theDisplay, name, "toggleWeaponStatus");
  1699. X    if(t!=NULL)
  1700. X    {
  1701. X        w->prefs.toggleWeaponStatus=XStringToKeysym(t);
  1702. X        t="";
  1703. X    }
  1704. X    t=XGetDefault(w->theDisplay, name, "changeRepair");
  1705. X    if(t!=NULL)
  1706. X    {
  1707. X        w->prefs.changeRepair=XStringToKeysym(t);
  1708. X        t="";
  1709. X    }
  1710. X    t=XGetDefault(w->theDisplay, name, "changeTarget");
  1711. X    if(t!=NULL)
  1712. X    {
  1713. X        w->prefs.changeTarget=XStringToKeysym(t);
  1714. X        t="";
  1715. X    }
  1716. X    t=XGetDefault(w->theDisplay, name, "changeView");
  1717. X    if(t!=NULL)
  1718. X    {
  1719. X        w->prefs.changeView=XStringToKeysym(t);
  1720. X        t="";
  1721. X    }
  1722. X    t=XGetDefault(w->theDisplay, name, "invisibility");
  1723. X    if(t!=NULL)
  1724. X    {
  1725. X        w->prefs.invisibility=XStringToKeysym(t);
  1726. X        t="";
  1727. X    }
  1728. X    t=XGetDefault(w->theDisplay, name, "quit");
  1729. X    if(t!=NULL)
  1730. X    {
  1731. X        w->prefs.quit=XStringToKeysym(t);
  1732. X        t="";
  1733. X    }
  1734. X    t=XGetDefault(w->theDisplay, name, "grabEnergy");
  1735. X    if(t!=NULL)
  1736. X    {
  1737. X        w->prefs.grabEnergy=XStringToKeysym(t);
  1738. X        t="";
  1739. X    }
  1740. X    t=XGetDefault(w->theDisplay, name, "balanceShields");
  1741. X    if(t!=NULL)
  1742. X    {
  1743. X        w->prefs.balanceShields=XStringToKeysym(t);
  1744. X        t="";
  1745. X    }
  1746. X    t=XGetDefault(w->theDisplay, name, "fire");
  1747. X    if(t!=NULL)
  1748. X    {
  1749. X        w->prefs.fire=XStringToKeysym(t);
  1750. X        t="";
  1751. X    }
  1752. X    t=XGetDefault(w->theDisplay, name, "changeWeapon");
  1753. X    if(t!=NULL)
  1754. X    {
  1755. X        w->prefs.changeWeapon=XStringToKeysym(t);
  1756. X        t="";
  1757. X    }
  1758. X    t=XGetDefault(w->theDisplay, name, "thrust");
  1759. X    if(t!=NULL)
  1760. X    {
  1761. X        w->prefs.thrust=XStringToKeysym(t);
  1762. X        t="";
  1763. X    }
  1764. X}
  1765. X
  1766. Xwinners()
  1767. X{
  1768. Xwinptr w;
  1769. XFont xf;
  1770. Xchar buf[MAX_NAME_SIZE];
  1771. Xint num_winner=0;
  1772. Xint retn;
  1773. Xchar **fonts;
  1774. X
  1775. X
  1776. X    w=first_win;
  1777. X    while(w) {
  1778. X        if(!w->exploding)
  1779. X            num_winner++;
  1780. X        w=w->next;
  1781. X    }
  1782. X    if(num_winner==1) winner(0);
  1783. X    else winner(1);
  1784. X}
  1785. X
  1786. Xsave_npc(w)
  1787. Xwinptr w;
  1788. X{
  1789. X    int i,start,no_vars,no_ins;
  1790. X    FILE *fp, *out_fp;
  1791. X    char fn[100], fn2[100];
  1792. X    struct header h;
  1793. X
  1794. Xprintf("Saving an npc:  %s\n", w->Name);
  1795. X    strcpy(fn, NPCDIR);
  1796. X    strcat(fn,w->comp->fname);
  1797. X    strcat(fn,".no");
  1798. X
  1799. Xseteuid(euid);
  1800. X    fp = fopen(fn,"rb");
  1801. Xseteuid(getuid());
  1802. X
  1803. X    if(!fp) 
  1804. X    {
  1805. X        fprintf(stderr, "Cannot find NPC! - Cancelling save\n");
  1806. X        return 0;
  1807. X    }
  1808. X    strcpy(fn2, fn);
  1809. X    strcat(fn2, ".tmp");
  1810. X
  1811. Xseteuid(euid);
  1812. X    out_fp = fopen(fn2,"wb");
  1813. Xseteuid(getuid());
  1814. X
  1815. X    if(!out_fp) 
  1816. X    {
  1817. X        fprintf(stderr, "Cannot save NPC!\n");
  1818. X    }
  1819. X    fread(&h, sizeof(struct header), 1, fp);
  1820. X    h.kills += w->kills-w->last_kills;
  1821. X    h.cash_earned += w->earned;
  1822. X
  1823. Xprintf("%s (%d) got %d %s", w->Name, w->ship_value, w->earned,(!w->exploding?"     -  Alive\n":"\n"));
  1824. X
  1825. X    if(w->exploding || secs_left<=0) h.num_played++;
  1826. X    fwrite(&h, sizeof(struct header), 1, out_fp);
  1827. X
  1828. Xseteuid(euid);
  1829. X       fread(w->comp->text,sizeof(struct ins),h.no_ins,fp);
  1830. X    fwrite(w->comp->text,sizeof(struct ins),h.no_ins,out_fp);
  1831. X    fread(&(w->comp->no_states),sizeof(int),1,fp);
  1832. X    fwrite(&(w->comp->no_states),sizeof(int),1,out_fp);
  1833. X    for(i=0;i<w->comp->no_states;i++)
  1834. X    {
  1835. X        fread(w->comp->states[i],1,MAX_SYMB_LEN,fp);
  1836. X        fwrite(w->comp->states[i],1,MAX_SYMB_LEN,out_fp);
  1837. X        fread(&(w->comp->stp[i]),sizeof(int),1,fp);
  1838. X        fwrite(&(w->comp->stp[i]),sizeof(int),1,out_fp);
  1839. X    }
  1840. X
  1841. X    fclose(fp);
  1842. X    fclose(out_fp);    
  1843. X    unlink(fn);
  1844. X    rename(fn2, fn);
  1845. Xseteuid(getuid());
  1846. X}
  1847. X
  1848. Xwinner(no_winner)
  1849. Xint no_winner;
  1850. X{
  1851. Xwinptr w;
  1852. XFont xf;
  1853. Xchar buf[MAX_NAME_SIZE];
  1854. Xint retn;
  1855. Xchar **fonts;
  1856. X
  1857. X    w=first_win;
  1858. X    if(!no_winner)
  1859. X    {
  1860. X        while(w) 
  1861. X        {    
  1862. X            sprintf(buf, "Today's Winner is: %s", w->Name); 
  1863. X            if(!w->exploding && all_combs>1) 
  1864. X                w->credits+=5000;
  1865. X            w=w->next;
  1866. X        }
  1867. X    }
  1868. X    else
  1869. X        sprintf(buf, "There is no winner");
  1870. X
  1871. X    if(no_winner==2)
  1872. X    {
  1873. X        sprintf(buf, "Time has run out");
  1874. X    }
  1875. X    w=first_win;
  1876. X    parse_shop_contents();
  1877. X    while(w) {
  1878. X        if(!w->npc || w->npcwin)
  1879. X        {
  1880. X            xfe_clear(w);
  1881. X            fonts=XListFonts(w->theDisplay, "-*-helvetica-medium-*-normal-*-*-240-*-100-*-*-*-*", 10, &retn);
  1882. X            if(fonts!=NULL)
  1883. X            { 
  1884. X                xf=XLoadFont(w->theDisplay, fonts[0]);
  1885. X                XSetFont(w->theDisplay, w->aGC, xf);
  1886. X            }
  1887. X            XDrawString(w->theDisplay, w->theWindow, w->aGC ,120, 300, buf, strlen(buf));
  1888. X            if(!w->npc) 
  1889. X            {
  1890. X                w->ship_value=value_of_craft(w);
  1891. X                save_dude(w);
  1892. X            }
  1893. X            XFlush(w->theDisplay);
  1894. X        }
  1895. X        w=w->next;
  1896. X    }
  1897. X    sleep(2);
  1898. X    w=first_win;
  1899. X    while(w) {
  1900. X        if(!w->npc || w->npcwin) close_host(w);
  1901. X        if(w->npc)
  1902. X        {
  1903. X            save_npc(w);
  1904. X        }
  1905. X        w=w->next;
  1906. X    }
  1907. X    exit(0);
  1908. X}
  1909. X
  1910. Xdec_earned()
  1911. X{
  1912. X    winptr w;
  1913. X    
  1914. X    w=first_win;
  1915. X    
  1916. X    counter--;
  1917. X    if(counter)
  1918. X        return;
  1919. X    while(w)
  1920. X    {
  1921. X        if(!w->exploding && w->earned > 0)
  1922. X            w->earned--;
  1923. X        w=w->next;
  1924. X    }
  1925. X    counter=5;
  1926. X}
  1927. X
  1928. Xdie()
  1929. X{
  1930. X    winptr w;
  1931. X
  1932. X    w=first_win;
  1933. X    while(w) {
  1934. X        if(w->npc)
  1935. X            save_npc(w);
  1936. X        if(!w->npc || w->npcwin) close_host(w);
  1937. X        w=w->next;
  1938. X    }
  1939. X    exit(0);
  1940. X}
  1941. X
  1942. Xbad()
  1943. X{
  1944. X    fprintf(stderr, "Major Bummer...  We got a bus/seg fault error\n");
  1945. X    exit(0);
  1946. X}
  1947. X
  1948. Xchar *index();
  1949. X
  1950. Xsecs_of(s)
  1951. Xchar *s;
  1952. X{
  1953. X    char *s2;
  1954. X
  1955. X    s2=0;
  1956. X    s2=index(s, ':');
  1957. X    if(s2!=NULL)
  1958. X    {
  1959. X        s[strlen(s) - strlen(s2)]=0;
  1960. X        s2=s2+1;
  1961. X        return (atoi(s)*60 + atoi(s2));
  1962. X    }
  1963. X    else
  1964. X        return (atoi(s)*60);
  1965. X}
  1966. X
  1967. X    
  1968. Xmain(argc,argv)
  1969. Xint argc;
  1970. Xchar *argv[];
  1971. X{
  1972. Xint valid_disp=0;
  1973. Xint i,j,k,l,counter=30;
  1974. Xwinptr temp;
  1975. XXGCValues gc;
  1976. XXImage *xi;
  1977. Xint h,w,xh,yh;
  1978. Xchar fn[40];
  1979. Xlong tmp;
  1980. Xint fp;
  1981. X
  1982. X    euid = geteuid();
  1983. X    seteuid(getuid());
  1984. X    srand(getpid());
  1985. X
  1986. X    if(argc==1) {
  1987. X        printf("Usage: xmpb [-s] [-t] [-npc NPC_Name] [-npcwin display1] [display2] [display3] ...\n");
  1988. X        exit();
  1989. X    }
  1990. X
  1991. X    if(!strcmp(argv[1], "-s"))
  1992. X    {
  1993. X    FILE *fp;
  1994. X    char buf[160];
  1995. X    save temp;
  1996. X    struct header head;
  1997. X
  1998. X        printf("\nPlayer's Hall of Fame\n");
  1999. X         buf[0]=0;
  2000. X        strcpy(buf, SAVEDIR);
  2001. X        strcat(buf, "hall.of.fame");
  2002. X
  2003. Xseteuid(euid);
  2004. X        fp=fopen(buf, "rb");
  2005. Xseteuid(getuid());
  2006. X
  2007. X        if(!fp) {
  2008. X            fprintf(stderr, "Cannot find hall of fame\n");
  2009. X        }
  2010. X        else
  2011. X        while(fread(&temp, sizeof(save), 1, fp))
  2012. X        {
  2013. X            printf("%-25s in %-25s with %-3d kills and $%d\n", temp.Name, temp.Ship, temp.kills, temp.credits);
  2014. X        }
  2015. X        fclose(fp);
  2016. X
  2017. X        printf("\n\nNPC hall of fame:\n");
  2018. X        strcat(buf, ".npc");
  2019. X
  2020. Xseteuid(euid);
  2021. X        fp=fopen(buf, "rb");
  2022. Xseteuid(getuid());
  2023. X
  2024. X        if(!fp) {
  2025. X            fprintf(stderr, "Cannot find npc hall of fame\n");
  2026. X        }
  2027. X        else
  2028. X        while(fread(&head, sizeof(struct header), 1, fp))
  2029. X        {
  2030. X            printf("%-25s in %-25s with %-3d kills and $%d\n", head.Name, head.Ship, head.kills, head.cash_earned);
  2031. X        }
  2032. X        fclose(fp);
  2033. X        exit(0);
  2034. X    }
  2035. X
  2036. X    installed=1;
  2037. Xseteuid(euid);
  2038. X    fp=open(BITMAPDIR, O_WRONLY);  /* check to see if bitmapdir is set */
  2039. Xseteuid(getuid());
  2040. X    if(fp == -1)
  2041. X    {
  2042. X        if(errno==2)
  2043. X        {
  2044. X            installed=0;
  2045. X            fprintf(stderr, "Warning: Cannot find BITMAPDIR.  Checking for bitmaps in current directory!\n");
  2046. X        }
  2047. X        else
  2048. X        if (errno!=EISDIR)  /* if errno is EISDIR, then bitmaps have been installed */
  2049. X            perror("Trying to find bitmaps in BITMAPDIR");
  2050. X    }
  2051. X
  2052. X    i=1;
  2053. X    while (argv[i])
  2054. X    {
  2055. X        if(!strcmp(argv[i], "-npc"))
  2056. X        {
  2057. X            i++;
  2058. X            if((i!=(argc-1)) && (!strcmp(argv[i+1], "-npcwin")))
  2059. X            {
  2060. X                if(add_host(argv[i], 1, 1, argv[i+2]))
  2061. X                    valid_disp = 1;
  2062. X                i=i+3;
  2063. X            }
  2064. X            else
  2065. X            {
  2066. X                add_host(argv[i], 1, 0, "");
  2067. X                i++;
  2068. X            }
  2069. X        }
  2070. X        else
  2071. X            i++;
  2072. X    }
  2073. X    printf("Xmpb version %d.%d\n",maj,min);
  2074. X    printf("Copyright (C)1992 Shane Hyde & Damien De Paoli\n");
  2075. X
  2076. X/*
  2077. X    for(i=0;i<argc-1;i++)
  2078. X    {
  2079. X        int j;
  2080. X        for(j=i+1;j<argc;j++)
  2081. X        {
  2082. X            char buf[40];
  2083. X            char buf2[40];
  2084. X
  2085. X            sscanf(argv[i],"%[^ .]",buf);
  2086. X            sscanf(argv[j],"%[^ .]",buf2);
  2087. X            if(!strcmp(buf,buf2))
  2088. X            {
  2089. X                fprintf(stderr,"I'm sorry, all host's must be unique\n");
  2090. X                exit(1);
  2091. X            }
  2092. X        }
  2093. X    }
  2094. X*/
  2095. X{
  2096. X            
  2097. X    for(i=1; i<argc; i++) 
  2098. X    {
  2099. X        if(!strcmp(argv[i], "-t"))
  2100. X        {
  2101. X            i++;
  2102. X            time_limit=secs_of(argv[i]);
  2103. X        }
  2104. X        else
  2105. X        if(!(strcmp(argv[i],"-npc")) || (!strcmp(argv[i], "-npcwin")))
  2106. X        {
  2107. X            i++;
  2108. X        }
  2109. X        else
  2110. X        {
  2111. X            if(add_host(argv[i],0,0,"")) 
  2112. X                valid_disp=1;
  2113. X            else
  2114. X                printf("Cannot connect to %s, probably not authorised to connect to server\n",argv[i]);
  2115. X        }
  2116. X    }
  2117. X    if(!valid_disp) 
  2118. X    {
  2119. X        xmpb_error("Specified host(s) could not be connected to.  Exiting\n");
  2120. X    }
  2121. X    all_combs=no_hosts;
  2122. X}
  2123. X    sleep(1);
  2124. X{
  2125. Xwinptr w;
  2126. X    w=first_win;
  2127. X    while(w)
  2128. X    {
  2129. X        if(!w->npc || w->npcwin)
  2130. X            xfe_clear(w);
  2131. X        w=w->next;
  2132. X    }
  2133. X}
  2134. X/*
  2135. Xprintf("Vendor: %s  Release: %d\n", ServerVendor(first_win->theDisplay), VendorRelease(first_win->theDisplay));
  2136. X*/
  2137. X    get_strings();
  2138. X
  2139. X    {
  2140. X        winptr w,t;
  2141. X        char buf[180];
  2142. X
  2143. X        w = first_win;
  2144. X        while(w)
  2145. X        {
  2146. X            i =0;
  2147. X            if(!w->npc || w->npcwin)
  2148. X            {
  2149. X                init_prefs(w,argv[0]);
  2150. X                XClearWindow(w->theDisplay,w->theWindow);
  2151. X                XDrawString(w->theDisplay,w->theWindow,w->aGC,20,20,"Todays Combat!",14);
  2152. X                t = first_win;
  2153. X                while(t)
  2154. X                {
  2155. X                    sprintf(buf,"%s in %s %5s%d",t->Name,t->Ship,"$", t->ship_value);
  2156. X                    XDrawString(w->theDisplay,w->theWindow,w->aGC,30,40+15*i,buf,strlen(buf));
  2157. X                    i++;
  2158. X                    t =t->next;
  2159. X                }
  2160. X                XSync(w->theDisplay,False);
  2161. X            }
  2162. X            w = w->next;
  2163. X        }
  2164. X        for(i=3;i>0;i--)
  2165. X        {
  2166. X            t = first_win;
  2167. X            while(t)
  2168. X            {
  2169. X                if(!t->npc || t->npcwin)
  2170. X                {
  2171. X                    sprintf(buf,"%d",i);
  2172. X                    XDrawImageString(t->theDisplay,t->theWindow,t->aGC,PLAYW/2,3*PLAYH/4,buf,strlen(buf));
  2173. X                    XSync(t->theDisplay,False);
  2174. X                }
  2175. X                t =t->next;
  2176. X            }
  2177. X            sleep(1);
  2178. X        }
  2179. X    }
  2180. X#define MAX_JUNK_MOD     40
  2181. X#define MAX_JUNK_OFFSET 20
  2182. X
  2183. X    for(i=0;i<15;i++)
  2184. X    {
  2185. X        add_junk(SMALLROCK,rand()%(WORLDW*2)-WORLDW,rand()%(WORLDH*2)-WORLDH,((rand()%(MAX_JUNK_MOD)-MAX_JUNK_OFFSET)*32768),((rand()%(MAX_JUNK_MOD)-MAX_JUNK_OFFSET)*32768),0);
  2186. X        add_junk(MEDROCK,rand()%(WORLDW*2)-WORLDW,rand()%(WORLDH*2)-WORLDH,((rand()%(MAX_JUNK_MOD)-MAX_JUNK_OFFSET)*32768),((rand()%(MAX_JUNK_MOD)-MAX_JUNK_OFFSET)*32768),0);
  2187. X    }
  2188. X    for(i=0;i<10;i++)
  2189. X    {
  2190. X        add_junk(BIGROCK,rand()%(WORLDW*2)-WORLDW,rand()%(WORLDH*2)-WORLDH,((rand()%(MAX_JUNK_MOD)-MAX_JUNK_OFFSET)*32768),((rand()%(MAX_JUNK_MOD)-MAX_JUNK_OFFSET)*32768),0);
  2191. X    }
  2192. X
  2193. X    signal(SIGINT, die);
  2194. X    signal(SIGHUP, die);
  2195. X    signal(SIGQUIT, die);
  2196. X    signal(SIGPIPE, die);
  2197. X    signal(SIGHUP, die);
  2198. X    signal(SIGSEGV, bad);
  2199. X    signal(SIGBUS, bad);
  2200. X
  2201. X{
  2202. X    winptr r;
  2203. X
  2204. X    r = first_win;
  2205. X    while(r)
  2206. X    {
  2207. X        if(!r->npc)
  2208. X            XAutoRepeatOff(r->theDisplay);
  2209. X        r=r->next;
  2210. X    }
  2211. X}
  2212. X
  2213. X    time_started=time(NULL);
  2214. X    mins_left=(int) time_limit/60;
  2215. X    secs_left=time_limit;
  2216. X    mins_gone=0;
  2217. X    while(1)
  2218. X    {
  2219. X        update_win_strs();
  2220. X        update_ships();
  2221. X        update_weapons();
  2222. X        update_win_input();
  2223. X        do_laser_hits();
  2224. X        synch_all();
  2225. X        dec_earned();
  2226. X        if(num_alive<=1) {
  2227. X            counter--;
  2228. X            if(num_alive==1 && counter==1) winner(0);
  2229. X            else { /* unlikely but both may die or quit in the same handle_events loop */
  2230. X                if(counter==1) winners();
  2231. X            }
  2232. X        }
  2233. X        update_win_pics();
  2234. X        update_junk();
  2235. X        no_lasers = 0;
  2236. X        tmp=time(NULL);
  2237. X        if(mins_left<=1)
  2238. X            secs_left=time_limit+time_started-tmp;
  2239. X        if(secs_left<=0)
  2240. X            winner(2);
  2241. X        if(tmp-time_started>59+60*mins_gone)
  2242. X        {
  2243. X            mins_left--;
  2244. X            mins_gone++;
  2245. X        }
  2246. X    }
  2247. X}
  2248. END_OF_FILE
  2249. if test 12372 -ne `wc -c <'test.c'`; then
  2250.     echo shar: \"'test.c'\" unpacked with wrong size!
  2251. fi
  2252. # end of 'test.c'
  2253. fi
  2254. echo shar: End of archive 4 \(of 8\).
  2255. cp /dev/null ark4isdone
  2256. MISSING=""
  2257. for I in 1 2 3 4 5 6 7 8 ; do
  2258.     if test ! -f ark${I}isdone ; then
  2259.     MISSING="${MISSING} ${I}"
  2260.     fi
  2261. done
  2262. if test "${MISSING}" = "" ; then
  2263.     echo You have unpacked all 8 archives.
  2264.     rm -f ark[1-9]isdone
  2265. else
  2266.     echo You still need to unpack the following archives:
  2267.     echo "        " ${MISSING}
  2268. fi
  2269. ##  End of shell archive.
  2270. exit 0
  2271.