home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume13 / jetpack / part04 < prev    next >
Encoding:
Internet Message Format  |  1992-04-09  |  39.3 KB

  1. Path: uunet!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v13i076:  jetpack - an arcade action game for X, Part04/04
  5. Message-ID: <2648@master.CNA.TEK.COM>
  6. Date: 23 Mar 92 22:32:12 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1609
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: meb2@cec2.wustl.edu (Mark Edward Bradley)
  12. Posting-number: Volume 13, Issue 76
  13. Archive-name: jetpack/Part04
  14. Environment: X11, Xlib
  15.  
  16.  
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 4 (of 4)."
  25. # Contents:  ADVERTISEMENT Imakefile bonus.c collision.c events.c
  26. #   gameover.c jetpack.man levels/000 main.c message.h p2.hdr quitx.c
  27. #   setinmaze.c special.c time.c
  28. # Wrapped by billr@saab on Mon Mar 23 14:29:27 1992
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'ADVERTISEMENT' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'ADVERTISEMENT'\"
  32. else
  33. echo shar: Extracting \"'ADVERTISEMENT'\" \(874 characters\)
  34. sed "s/^X//" >'ADVERTISEMENT' <<'END_OF_FILE'
  35. XJetpack was written by Mark Bradley
  36. X
  37. XI am a Computer Science major at Washington University.  I will be
  38. Xgraduating with a Bachelor's degree in May '92.  I am currently seeking
  39. Xpermanent employment in a computing field.  The languages I am proficient
  40. Xin are C, X, Bourne Shell, 68000 and 6502 assembly, Pascal, LISP, and PROLOG.
  41. XI am experienced with UNIX, X-Windows, Macintosh OS, MS-DOS and Microsoft
  42. XWindows.  If you like this game, and are looking for a good C / UNIX / X
  43. Xprogrammer, please consider me.
  44. X
  45. XMy e-mail address (through May '92):
  46. X
  47. Xmeb2@cec2.wustl.edu
  48. X
  49. XMy school address (through May '92):
  50. X
  51. X6926 Millbrook Blvd.
  52. XUnit 3-102
  53. XSt. Louis, Mo. 63130
  54. X(314) 935-1568
  55. X
  56. XMy permanent home address:
  57. X
  58. X3735 S. Winston
  59. XTulsa Ok, 74135
  60. X(918) 745-6025
  61. X
  62. XI would be happy to send you my resume, code examples, or set up an
  63. Xinterview.
  64. X
  65. XThank you, and enjoy the game!
  66. XMark Bradley
  67. END_OF_FILE
  68. if test 874 -ne `wc -c <'ADVERTISEMENT'`; then
  69.     echo shar: \"'ADVERTISEMENT'\" unpacked with wrong size!
  70. fi
  71. # end of 'ADVERTISEMENT'
  72. fi
  73. if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  74.   echo shar: Will not clobber existing file \"'Imakefile'\"
  75. else
  76. echo shar: Extracting \"'Imakefile'\" \(2086 characters\)
  77. sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
  78. X    SRCS = bitmap.c bonus.c collision.c demo.c draw.c erase.c events.c\
  79. X     gameover.c initx.c main.c maze.c message.c normal.c quitx.c scores.c\
  80. X     setinmaze.c setup.c special.c time.c update.c windowx.c
  81. X    OBJS = bitmap.o bonus.o collision.o demo.o draw.o erase.o events.o\
  82. X     gameover.o initx.o main.o maze.o message.o normal.o quitx.o scores.o\
  83. X     setinmaze.o setup.o special.o time.o update.o windowx.o
  84. X
  85. X    PROGRAMS = jetpack
  86. X
  87. X    DESTDIR = /usrd/s/m/meb2
  88. X
  89. X# These defines override the template defaults. Trash em if you want to
  90. X# use the template locations
  91. X    USRLIBDIR = $(DESTDIR)/lib/jetpack
  92. X    BINDIR = $(DESTDIR)/bin
  93. X    MANPATH = $(DESTDIR)/man
  94. X    MANDIR = $(MANSOURCEPATH)1
  95. X    TOP_INCLUDES =
  96. X    DEPXLIB =
  97. X    EXTRA_LIBRARIES = $(XLIB)
  98. X
  99. X# I like my programs optimized, stripped, and setuid. Do what you like.
  100. X    INSTPGMFLAGS = $(INSTUIDFLAGS) -s
  101. X    CDEBUGFLAGS = -O4
  102. X
  103. X# Since my programs are setuid, I make the data files readable only by me.
  104. X    INSTDATFLAGS = -m 0600
  105. X
  106. X# These defines are needed by jetpack. Delete the -DBLIT if you don't want
  107. X# the game to do all the drawing to an offscreen pixmap. (This is good for
  108. X# machines that don't have hardware blitting -- if you have an xterm or a
  109. X# graphics workhorse, leave it in, there will be no flicker)
  110. X    DEFINES = -DBLIT -DSCOREPATH=\"$(SCOREFILE)\" -DLEVELPATH=\"$(LEVELFILE)\"
  111. X
  112. X# The score file can be any name you like, just make sure the directory
  113. X# it's supposed to reside in exists, or jetpack will start creating score
  114. X# files in the directories it is run from. Same for the level files, only
  115. X# the filename you give here is only a prefix -- the complete filename has
  116. X# the level number appended to it.
  117. X    SCOREFILE = $(USRLIBDIR)/jetpack.scores
  118. X    LEVELFILE = $(USRLIBDIR)/jetpack.lev
  119. X
  120. XComplexProgramTarget(jetpack)
  121. X
  122. XDependTarget()
  123. XDependDependency()
  124. X
  125. XInstallNonExec(levels/000,$(LEVELFILE)000)
  126. X
  127. X# oops, I can't figure how to override the template default to install the
  128. X# man page as jetpack.1, so I install both and remove the bad one.
  129. Xinstall.man:: jetpack.man
  130. X    $(INSTALL) -c $(INSTMANFLAGS) jetpack.man $(MANDIR)/jetpack.1
  131. X    @rm -f $(MANDIR)/jetpack.n
  132. END_OF_FILE
  133. if test 2086 -ne `wc -c <'Imakefile'`; then
  134.     echo shar: \"'Imakefile'\" unpacked with wrong size!
  135. fi
  136. # end of 'Imakefile'
  137. fi
  138. if test -f 'bonus.c' -a "${1}" != "-c" ; then 
  139.   echo shar: Will not clobber existing file \"'bonus.c'\"
  140. else
  141. echo shar: Extracting \"'bonus.c'\" \(1014 characters\)
  142. sed "s/^X//" >'bonus.c' <<'END_OF_FILE'
  143. X/*    bonus.c : bonus calculating routines for jetpack
  144. X*/
  145. X
  146. X#include "copyright.h"
  147. X#include "defs.h"
  148. X
  149. Xint    bonus, bonustimer, initbonus, extramaninc;
  150. X
  151. X/*    bonus_check decrements the bonus and checks to see if the player has
  152. X    earned an extra player
  153. X*/
  154. Xbonus_check()
  155. X{
  156. X    decrement_bonus();
  157. X    extra_man_check();
  158. X}
  159. X
  160. X/*    decrement_bonus decrements the bonus
  161. X*/
  162. Xdecrement_bonus()
  163. X{
  164. X    bonustimer--;
  165. X    if(!bonustimer) {
  166. X        bonus -= BONUSINCREMENT;
  167. X        if(bonus < 0) bonus = 0;
  168. X        bonustimer = BONUSTIME;
  169. X    }
  170. X}
  171. X
  172. X/*    extra_man_check awards an extra player if he/she has earned it
  173. X*/
  174. Xextra_man_check()
  175. X{
  176. X    if(score >= EXTRAMANSCORE * extramaninc) {
  177. X        men++;
  178. X        extramaninc++;
  179. X        if(!waiting) bigmessage("BONUS!", CBLACK, 50);
  180. X        message("Extra player awarded!", CBLACK, 100);
  181. X        refresh_info();
  182. X    }
  183. X}
  184. X
  185. X/*    score_bonus counts down the bonus at the end of a level
  186. X*/
  187. Xscore_bonus()
  188. X{
  189. X    char buf[14];
  190. X
  191. X    sprintf(buf, "Bonus: %06d", bonus);
  192. X    bigmessage(buf, CYELLOW, 1);
  193. X    bonus -= BONUSINCREMENT;
  194. X    if(bonus < 0) bonus = 0;
  195. X    else score += BONUSINCREMENT;
  196. X}
  197. END_OF_FILE
  198. if test 1014 -ne `wc -c <'bonus.c'`; then
  199.     echo shar: \"'bonus.c'\" unpacked with wrong size!
  200. fi
  201. # end of 'bonus.c'
  202. fi
  203. if test -f 'collision.c' -a "${1}" != "-c" ; then 
  204.   echo shar: Will not clobber existing file \"'collision.c'\"
  205. else
  206. echo shar: Extracting \"'collision.c'\" \(3952 characters\)
  207. sed "s/^X//" >'collision.c' <<'END_OF_FILE'
  208. X/*    collision.c : routines that check player collisions
  209. X*/
  210. X
  211. X#include "copyright.h"
  212. X#include "defs.h"
  213. X
  214. X/*    collision_check checks for all collisions
  215. X*/
  216. Xcollision_check()
  217. X{
  218. X    register int    i;
  219. X    register long    dx, dy;
  220. X
  221. X    /*    if in the door, player can't be hurt
  222. X    */
  223. X    if(!indoor) {
  224. X        for(i=0; i<numfire; i++) {
  225. X            dx = (plx - firex[i]) * (plx - firex[i]);
  226. X            dy = (ply - firey[i]) * (ply - firey[i]);
  227. X            if(dx + dy <= (PLAYERWIDTH / 2 + FIREWIDTH / 2) * (PLAYERWIDTH
  228. X                / 2 + FIREWIDTH / 2)) {
  229. X                if(exploded == -1) {
  230. X                    dumb_message(MKILL);
  231. X                    exploded = 0;
  232. X                    explodetimer = EXPLODETIME;
  233. X                    indoor = 1;
  234. X                    if(!keyalive) {
  235. X                        keyalive = 1;
  236. X                        keyx = plx;
  237. X                        keyy = ply;
  238. X                        refresh_info();
  239. X                    }
  240. X                }
  241. X            } else if(dx + dy <= (PLAYERWIDTH / 2 + FIREWIDTH / 2) *
  242. X                        (PLAYERWIDTH / 2 + FIREWIDTH / 2) * 2) {
  243. X                if((plx / mazescale == firex[i] / mazescale) &&
  244. X                    (ply / mazescale == firey[i] / mazescale))
  245. X                        dumb_message(MCLOSE);
  246. X            }
  247. X        }
  248. X        for(i=0; i<numsweep; i++) {
  249. X            dx = (plx - sweepx[i]) * (plx - sweepx[i]);
  250. X            dy = (ply - sweepy[i]) * (ply - sweepy[i]);
  251. X            if(dx + dy <= (PLAYERWIDTH / 2 + SWEEPERWIDTH / 2) * (PLAYERWIDTH
  252. X                / 2 + SWEEPERWIDTH / 2)) {
  253. X                if(exploded == -1) {
  254. X                    dumb_message(MKILL);
  255. X                    exploded = 0;
  256. X                    explodetimer = EXPLODETIME;
  257. X                    indoor = 1;
  258. X                    if(!keyalive) {
  259. X                        keyalive = 1;
  260. X                        keyx = plx;
  261. X                        keyy = ply;
  262. X                        refresh_info();
  263. X                    }
  264. X                }
  265. X            } else if(dx + dy <= (PLAYERWIDTH / 2 + SWEEPERWIDTH / 2) *
  266. X                        (PLAYERWIDTH / 2 + SWEEPERWIDTH / 2) * 2) {
  267. X                if((plx / mazescale == sweepx[i] / mazescale) &&
  268. X                    (ply / mazescale == sweepy[i] / mazescale))
  269. X                        dumb_message(MCLOSE);
  270. X            }
  271. X        }
  272. X        for(i=0; i<numguard; i++) {
  273. X            dx = (plx - guardx[i]) * (plx - guardx[i]);
  274. X            dy = (ply - guardy[i]) * (ply - guardy[i]);
  275. X            if(dx + dy <= (PLAYERWIDTH / 2 + GUARDWIDTH / 2) *
  276. X                (PLAYERWIDTH / 2 + GUARDWIDTH / 2)) {
  277. X                if(exploded == -1) {
  278. X                    dumb_message(MKILL);
  279. X                    exploded = 0;
  280. X                    explodetimer = EXPLODETIME;
  281. X                    indoor = 1;
  282. X                    if(!keyalive) {
  283. X                        keyalive = 1;
  284. X                        keyx = plx;
  285. X                        keyy = ply;
  286. X                        refresh_info();
  287. X                    }
  288. X                }
  289. X            } else if(dx + dy <= (PLAYERWIDTH / 2 + GUARDWIDTH / 2) *
  290. X                        (PLAYERWIDTH / 2 + GUARDWIDTH / 2) * 2) {
  291. X                if((plx / mazescale == guardx[i] / mazescale) &&
  292. X                    (ply / mazescale == guardy[i] / mazescale))
  293. X                        dumb_message(MCLOSE);
  294. X            }
  295. X        }
  296. X    }
  297. X    for(i=0; i<numfuel; i++) {
  298. X        if(fuelalive[i]) {
  299. X            dx = (plx - fuelx[i]) * (plx - fuelx[i]);
  300. X            dy = (ply - fuely[i]) * (ply - fuely[i]);
  301. X            if(dx + dy <= (PLAYERWIDTH / 2 + FUELWIDTH / 2) * (PLAYERWIDTH
  302. X                / 2 + FUELWIDTH / 2)) {
  303. X                dumb_message(MFUEL);
  304. X                playerfuel += FUELINCREMENT;
  305. X                if(playerfuel > FUELCAPACITY) playerfuel = FUELCAPACITY;
  306. X                fuelalive[i] = 0;
  307. X                fueltimer[i] = 25;
  308. X                score += 100;
  309. X            }
  310. X        }
  311. X    }
  312. X
  313. X    /*    Grab the key
  314. X    */
  315. X    if(keyalive && (exploded == -1)) {
  316. X        dx = (plx - keyx) * (plx - keyx);
  317. X        dy = (ply - keyy) * (ply - keyy);
  318. X        if(dx + dy <= (PLAYERWIDTH / 2 + KEYWIDTH / 2) * (PLAYERWIDTH / 2
  319. X            + KEYWIDTH / 2)) {
  320. X            dumb_message(MKEY);
  321. X            score += 500;
  322. X            keyalive = 0;
  323. X            keytimer = 25;
  324. X            refresh_info();
  325. X        }
  326. X    }
  327. X
  328. X    /*    Exit?
  329. X    */
  330. X    if(!keyalive && indoor && !waiting && !leveldone) {
  331. X        plx = doorx;
  332. X        ply = doory;
  333. X        indoor = 1;
  334. X        dumb_message(MEXIT);
  335. X        waiting = bonus / BONUSINCREMENT + 50;
  336. X        playerphase = FACEFRONT;
  337. X        playerdir = STOP;
  338. X    }
  339. X}
  340. X
  341. X/*    message_checks if the player has hit a message zone and if so, puts up
  342. X    the appropriate message
  343. X*/
  344. Xmessage_check()
  345. X{
  346. X    register int    i;
  347. X
  348. X    for(i=0; i<numlmessage; i++) {
  349. X        if(lmessage[i].unused) {
  350. X            if((plx >= lmessage[i].x1) && (ply >= lmessage[i].y1) &&
  351. X                (plx <= lmessage[i].x2) && (ply <= lmessage[i].y2)) {
  352. X                    lmessage[i].unused = 0;
  353. X                    if(lmessage[i].bigactive) {
  354. X                        bigmessage(lmessage[i].bigtext, lmessage[i].bigcolor,
  355. X                                    lmessage[i].bigtime);
  356. X                    }
  357. X                    if(lmessage[i].active) {
  358. X                        message(lmessage[i].text, lmessage[i].color,
  359. X                                    lmessage[i].time);
  360. X                    }
  361. X            }
  362. X        }
  363. X    }
  364. X}
  365. END_OF_FILE
  366. if test 3952 -ne `wc -c <'collision.c'`; then
  367.     echo shar: \"'collision.c'\" unpacked with wrong size!
  368. fi
  369. # end of 'collision.c'
  370. fi
  371. if test -f 'events.c' -a "${1}" != "-c" ; then 
  372.   echo shar: Will not clobber existing file \"'events.c'\"
  373. else
  374. echo shar: Extracting \"'events.c'\" \(3753 characters\)
  375. sed "s/^X//" >'events.c' <<'END_OF_FILE'
  376. X/*    events.c : routines that do event handling
  377. X*/
  378. X
  379. X#include "copyright.h"
  380. X#include "defs.h"
  381. X
  382. X/*    event_filter handles game events
  383. X*/
  384. Xint    event_filter()
  385. X{
  386. X    XEvent    event;
  387. X
  388. X    XNextEvent(display, &event);
  389. X    switch(event.type) {
  390. X        case ConfigureNotify:
  391. X        case Expose:
  392. X        case MapNotify:
  393. X            refresh_info();
  394. X
  395. X#ifdef    BLIT
  396. X            XCopyArea(display, drawpixmap, gamewindow,
  397. X                        ctable[CBLACK].smallgc, 0, 0,
  398. X                        WINDOWWIDTH, WINDOWHEIGHT, 0, 0);
  399. X#else
  400. X            refresh();
  401. X#endif
  402. X
  403. X            return(1);
  404. X            break;
  405. X        case ButtonPress:
  406. X            if(!waiting) {
  407. X                if(event.xbutton.button == Button2) burn = 1;
  408. X                if(event.xbutton.button == Button1) {
  409. X                    if(event.xbutton.state & Button3Mask) {
  410. X                        playerdir = STOP;
  411. X                    } else {
  412. X                        playerdir = GOLEFT;
  413. X                    }
  414. X                }
  415. X                if(event.xbutton.button == Button3) {
  416. X                    if(event.xbutton.state & Button1Mask) {
  417. X                        playerdir = STOP;
  418. X                    } else {
  419. X                        playerdir = GORIGHT;
  420. X                    }
  421. X                }
  422. X            }
  423. X            return(1);
  424. X            break;
  425. X        case ButtonRelease:
  426. X            if((event.xbutton.state & Button2Mask) && 
  427. X                (event.xbutton.button == Button2))
  428. X                burn = 0;
  429. X            if(event.xbutton.button == Button3) {
  430. X                if(event.xbutton.state & Button1Mask) {
  431. X                    playerdir = GOLEFT;
  432. X                } else {
  433. X                    playerdir = STOP;
  434. X                }
  435. X            }
  436. X            if(event.xbutton.button == Button1) {
  437. X                if(event.xbutton.state & Button3Mask) {
  438. X                    playerdir = GORIGHT;
  439. X                } else {
  440. X                    playerdir = STOP;
  441. X                }
  442. X            }
  443. X            return(1);
  444. X            break;
  445. X        case KeyPress:
  446. X            key_hit(&event);
  447. X            return(1);
  448. X            break;
  449. X    }
  450. X    return(0);
  451. X}
  452. X
  453. X/*    key_hit handles game key events
  454. X*/
  455. Xkey_hit(event)
  456. XXKeyEvent    *event;
  457. X{
  458. X    char            buf;
  459. X    KeySym            key;
  460. X    XComposeStatus    i;
  461. X    
  462. X    XLookupString(event, &buf, 1, &key, &i);
  463. X    switch(key) {
  464. X        case XK_KP_4:
  465. X        case 'a':
  466. X        case 'A':
  467. X            playerdir = GOLEFT;
  468. X            break;
  469. X        case XK_KP_6:
  470. X        case 'd':
  471. X        case 'D':
  472. X            playerdir = GORIGHT;
  473. X            break;
  474. X        case XK_KP_5:
  475. X        case ' ':
  476. X        case 's':
  477. X        case 'S':
  478. X            playerdir = STOP;
  479. X            break;
  480. X        case 'K':
  481. X            if(exploded != -1) break;
  482. X            dumb_message(MSUICIDE);
  483. X            exploded = 0;
  484. X            explodetimer = EXPLODETIME;
  485. X            indoor = 1;
  486. X            if(!keyalive) {
  487. X                keyalive = 1;
  488. X                keyx = plx;
  489. X                keyy = ply;
  490. X            }
  491. X            break;
  492. X        case 'Q':
  493. X            if(dead) break;
  494. X            dead = 1;
  495. X            deadtimer = 50;
  496. X            messagetime = 0;
  497. X            bigmessagetime = 0;
  498. X            bigmessage("Game Over", CBLACK, 100);
  499. X            dumb_message(MQUIT);
  500. X            break;
  501. X        case 'p':
  502. X            if(paused) {
  503. X                paused = 0;
  504. X                bigmessagetime = 0;
  505. X                begin_timer();
  506. X            } else {
  507. X                bigmessage("PAUSED", CBLUE, 50);
  508. X                draw();
  509. X
  510. X#ifdef    BLIT
  511. X                XCopyArea(display, drawpixmap, gamewindow,
  512. X                            ctable[CBLACK].smallgc, 0, 0,
  513. X                            WINDOWWIDTH, WINDOWHEIGHT, 0, 0);
  514. X#else
  515. X                refresh();
  516. X#endif
  517. X
  518. X                paused = 1;
  519. X                stop_timer();
  520. X            }
  521. X            break;
  522. X    }
  523. X}
  524. X
  525. X/*    demo_event_filter handles events for the demo
  526. X*/
  527. Xint    demo_event_filter()
  528. X{
  529. X    XEvent    event;
  530. X
  531. X    XNextEvent(display, &event);
  532. X    switch(event.type) {
  533. X        case ConfigureNotify:
  534. X        case Expose:
  535. X        case MapNotify:
  536. X            refresh_info();
  537. X            return(1);
  538. X            break;
  539. X        case ButtonPress:
  540. X            leveldone = 1;
  541. X            gameover = 0;
  542. X            break;
  543. X        case KeyPress:
  544. X            title_key_hit(&event);
  545. X            return(1);
  546. X            break;
  547. X    }
  548. X    return(0);
  549. X}
  550. X
  551. X/*    title_event_filter handles events for the title screen
  552. X*/
  553. Xtitle_event_filter()
  554. X{
  555. X    XEvent    event;
  556. X
  557. X    XNextEvent(display, &event);
  558. X    switch(event.type) {
  559. X        case ConfigureNotify:
  560. X        case Expose:
  561. X        case MapNotify:
  562. X            title_refresh();
  563. X            break;
  564. X        case ButtonPress:
  565. X            gameover = 0;
  566. X            break;
  567. X        case KeyPress:
  568. X            title_key_hit(&event);
  569. X            break;
  570. X    }
  571. X}
  572. X
  573. X/*    title_key_hit handles key events for the demo and title screen
  574. X*/
  575. Xtitle_key_hit(event)
  576. XXKeyEvent    *event;
  577. X{
  578. X    char            buf;
  579. X    KeySym            key;
  580. X    XComposeStatus    i;
  581. X    int                length;
  582. X    
  583. X    length = XLookupString(event, &buf, 1, &key, &i);
  584. X    switch(key) {
  585. X        case 'Q':
  586. X        case 'q':
  587. X            quit_game();
  588. X            break;
  589. X        default:
  590. X            if(length > 0) {
  591. X                gameover = 0;
  592. X                leveldone = 1;
  593. X            }
  594. X    }
  595. X}
  596. END_OF_FILE
  597. if test 3753 -ne `wc -c <'events.c'`; then
  598.     echo shar: \"'events.c'\" unpacked with wrong size!
  599. fi
  600. # end of 'events.c'
  601. fi
  602. if test -f 'gameover.c' -a "${1}" != "-c" ; then 
  603.   echo shar: Will not clobber existing file \"'gameover.c'\"
  604. else
  605. echo shar: Extracting \"'gameover.c'\" \(950 characters\)
  606. sed "s/^X//" >'gameover.c' <<'END_OF_FILE'
  607. X/*    gameover.c : routines used when player dies or game is over
  608. X*/
  609. X
  610. X#include "copyright.h"
  611. X#include "defs.h"
  612. X
  613. Xint    dead, deadtimer;
  614. X
  615. X/*    death is called when a player is killed.
  616. X*/
  617. Xdeath()
  618. X{
  619. X    men--;
  620. X    if(men < 0) {
  621. X        dead = 1;
  622. X        deadtimer = 50;
  623. X        bigmessage("Game Over", CBLACK, 100);
  624. X        return;
  625. X    }
  626. X    if(!keyalive) {
  627. X        keyx = plx;
  628. X        keyy = ply;
  629. X        keyalive = 1;
  630. X    }
  631. X    plx = doorx;
  632. X    ply = doory;
  633. X    playerfuel = 1000;
  634. X    burn = 0;
  635. X    walk = 1;
  636. X    playerdir = STOP;
  637. X    playervert = 0;
  638. X    playerphase = FACEFRONT;
  639. X    exploded = -1;
  640. X    XClearWindow(display, gamewindow);
  641. X    XClearWindow(display, infowindow);
  642. X    refresh_info();
  643. X}
  644. X
  645. X/*    game_over is called when a player loses his/her last life. The high
  646. X    score table is checked, and some cleanup is done.
  647. X*/
  648. Xgame_over()
  649. X{
  650. X    lastscore = score;
  651. X    check_score();
  652. X    XClearWindow(display, gamewindow);
  653. X    XClearWindow(display, infowindow);
  654. X    gameover = 1;
  655. X    leveldone = 1;
  656. X}
  657. END_OF_FILE
  658. if test 950 -ne `wc -c <'gameover.c'`; then
  659.     echo shar: \"'gameover.c'\" unpacked with wrong size!
  660. fi
  661. # end of 'gameover.c'
  662. fi
  663. if test -f 'jetpack.man' -a "${1}" != "-c" ; then 
  664.   echo shar: Will not clobber existing file \"'jetpack.man'\"
  665. else
  666. echo shar: Extracting \"'jetpack.man'\" \(4244 characters\)
  667. sed "s/^X//" >'jetpack.man' <<'END_OF_FILE'
  668. X.\" Copyright (c) 1992 Mark Bradley
  669. X.\"
  670. X.\" @(#)jetpack.1 1.00 90/02/15 SMI;
  671. X.TH JETPACK 1  "23 February 1992"
  672. X.SH NAME
  673. Xjetpack \- Arcade action game for X Windows
  674. X.SH SYNOPSIS
  675. X.B jetpack
  676. X.SH DESCRIPTION
  677. X.IX games jetpack "" "\fLjetpack\fR \(em Arcade action game"
  678. X.IX jetpack "" "\fLjetpack\fR \(em Arcade action game"
  679. X.LP
  680. X.B jetpack
  681. Xis an arcade action game.
  682. XThe user controls a
  683. X.B player
  684. Xwearing a jetpack.
  685. XThe game takes place within a series of
  686. X.B levels
  687. Xthat each consist of a
  688. X.B maze ,
  689. X.B fuel pods ,
  690. Xa
  691. X.B door ,
  692. Xand a
  693. X.B key .
  694. XThe player must travel through the maze to find the key
  695. Xand bring it back to the door to exit to the next level.
  696. XThere is a
  697. X.B bonus
  698. Xfor each level that is decremented as time goes on.
  699. XIt is awarded when the player sucessfully exits the level.
  700. X.SS Movement
  701. X.LP
  702. XThe player can move left and right through space or walk along a
  703. Xhorizontal maze wall.
  704. XThe player can also fire the jetpack, thrusting him upward.
  705. XIf the player is not standing on a wall and not firing the jetpack, he will
  706. Xaccelerate downward.
  707. XThe player cannot be damaged by falling.
  708. X.LP
  709. XFiring the jetpack uses fuel.
  710. XThe player has a tank of fuel that can contain up to 1000 units of fuel.
  711. XPicking up a fuel pod gives the player 100 units of fuel.
  712. X.SS Enemies
  713. X.LP
  714. XThere are three kinds of enemies in jetpack:
  715. X.B guards ,
  716. X.B fireballs ,
  717. Xand
  718. X.B wall sweepers .
  719. XTouching any enemy is fatal, and enemies do not harm each other.
  720. X.LP
  721. XGuards patrol the maze.
  722. XThey fly in the middle of the corridors and follow random paths through
  723. Xthe maze.
  724. X.LP
  725. XFireballs fly through space and bounce off walls.
  726. X.LP
  727. XWall Sweepers cling to walls and continuously move along the surface of
  728. Xthe walls.
  729. XThey can hang on to any side, and when they reach the end of a wall, flip
  730. Xto hug the other side and continue in the opposite direction.
  731. X.SS Scoring
  732. X.LP
  733. XThe bonus for each level is proportional to the size of the level, how
  734. Xdense the maze is, and how many enemies and fuel pods are in it.
  735. XIn addition to the bonus, picking up a fuel pod is worth 100 points, and
  736. Xpicking up the key is worth 500 points.
  737. X.SS Commands
  738. X.PD 0
  739. X.LP
  740. XQ    :    Quit the current game.
  741. X.LP
  742. XK    :    Commit suicide. (player loses a life and returns to the door)
  743. X.LP
  744. Xa, A, keypad 4
  745. X.LP
  746. X.RS
  747. X:    Move left. Player will continue to move left until direction is
  748. Xchanged.
  749. X.RE
  750. X.LP
  751. Xd, D, keypad 6
  752. X.LP
  753. X.RS
  754. X:    Move right. Player will continue to move right until direction is
  755. Xchanged.
  756. X.RE
  757. X.LP
  758. Xs, S, keypad 5
  759. X.LP
  760. X.RS
  761. X:    Stop horizontal movement.
  762. X.RE
  763. X.LP
  764. Xleft mouse button
  765. X.LP
  766. X.RS
  767. X:    Move left. Player will continue to move left until the button is
  768. Xreleased.
  769. X.RE
  770. X.LP
  771. Xright mouse button
  772. X.LP
  773. X.RS
  774. X:    Move right. Player will continue to move right until the button is
  775. Xreleased.
  776. X.RE
  777. X.LP
  778. Xcenter mouse button
  779. X.LP
  780. X.RS
  781. X:    Fire jetpack. Jetpack will continue to fire until the button is
  782. Xreleased.
  783. X.RE
  784. X.PD
  785. X.SS Miscellaneous
  786. X.LP
  787. XThe player starts each level from the door.
  788. XWhen the player is standing within the door, he cannot be killed.
  789. XThe door is grey when the player is in it, otherwise it is white.
  790. XThe player is returned to the door each time he dies.
  791. X.LP
  792. XIf the player has the key when he dies, the key stays where the player was
  793. Xkilled.
  794. X.LP
  795. XExtra players are awarded every 10000 points.
  796. X.SH FILES
  797. X.PD 0
  798. X.LP
  799. Xlib/jetpack.scores - jetpack high scores
  800. X.LP
  801. Xlib/jetpack.lev000 - predefined demo level
  802. X.PD
  803. X.SH DIAGNOSTICS
  804. X.LP
  805. X"Jetpack : Cannot connect to X Server <servername>"
  806. X.PD 0
  807. X.LP
  808. X.PD
  809. XJetpack can't open the display you wanted.
  810. XCheck the environment variable DISPLAY and make sure the host is
  811. Xauthorized.
  812. X.LP
  813. X"Jetpack : Couldn't load <fontname> font."
  814. X.PD 0
  815. X.LP
  816. X.PD
  817. XJetpack was unable to load a needed font.
  818. XCheck to make sure your X server has the font loaded, or if necessary,
  819. Xrecompile jetpack with a font that exists on your server.
  820. X.LP
  821. X"Jetpack : Couldn't open scorefile."
  822. X.PD 0
  823. X.LP
  824. X.PD
  825. XJetpack couldn't open or create a high score file.
  826. XCheck to see if the jetpack lib directory is readable and writable, and if
  827. Xthe score file already exists, that it is readable and writable.
  828. X.SH BUGS
  829. X.LP
  830. XJetpack does not use .Xauthority databases.
  831. X.LP
  832. XJetpack does not have any command line options.
  833. X.LP
  834. XJetpack has the ability to read in predefined levels, but only the demo
  835. Xlevel is provided.
  836. X.SH AUTHOR
  837. X.LP
  838. XCopyright (c) 1992 Mark Bradley
  839. END_OF_FILE
  840. if test 4244 -ne `wc -c <'jetpack.man'`; then
  841.     echo shar: \"'jetpack.man'\" unpacked with wrong size!
  842. fi
  843. # end of 'jetpack.man'
  844. fi
  845. if test -f 'levels/000' -a "${1}" != "-c" ; then 
  846.   echo shar: Will not clobber existing file \"'levels/000'\"
  847. else
  848. echo shar: Extracting \"'levels/000'\" \(1191 characters\)
  849. sed "s/^X//" >'levels/000' <<'END_OF_FILE'
  850. X11  7  120   
  851. X0  4  4  4  4  4  4  4  4  4  4  4  0    
  852. X2  9  1  1  3 13  7  9  1  1  1  3  8    
  853. X2  8  0  4  4  5  5  4  4  0  4  2  8    
  854. X2  8  2  9  1  1  1  1  3 14 11 10  8    
  855. X2  8  2  8  0  0  0  4  4  5  2 10  8    
  856. X2 12  6  8  0  0  6  9  5  3 14 10  8    
  857. X0  1  1  0  0  0 13  2 15  8  5  6  8    
  858. X0  0  0  0  0  0  3 12  5  6  9  1  0    
  859. X0  0  0  0  0  0  0  1  1  1  0  0  0    
  860. X  
  861. X1  5   
  862. X
  863. X500 
  864. X
  865. X1 
  866. X5  1  1  3   
  867. X  
  868. X1 
  869. X1140  420   4  0   
  870. X  
  871. X2 
  872. X8  5  2  1  1   
  873. X8  5  2  -1  5   
  874. X  
  875. X1 
  876. X
  877. X540  359   
  878. X  
  879. X780  780   
  880. X
  881. X6 
  882. X
  883. X240  600  360  720  3  7  75  75   
  884. X5
  885. XDOOR:
  886. X64
  887. XYou start each level from the door. You can't be hurt inside it.
  888. X
  889. X360  120  480  360  3  2  75  75   
  890. X9
  891. XFUEL POD:
  892. X56
  893. XYour jetpack uses fuel. Pick up fuel pods to fly longer.
  894. X
  895. X600  120  720  360  3  5  75  75   
  896. X6
  897. XGUARD:
  898. X42
  899. XGuards patrol the maze. Guards are deadly.
  900. X
  901. X960  120  1080  360  3  1  75  75   
  902. X9
  903. XFIREBALL:
  904. X62
  905. XFireballs bounce off walls. Touching a fireball will kill you.
  906. X
  907. X1080  600  1200  960  3  6  75  75   
  908. X13
  909. XWALL SWEEPER:
  910. X59
  911. XSweepers move along the walls. Touching a sweeper is fatal.
  912. X
  913. X840  600  960  960  3  3  75  75   
  914. X4
  915. XKEY:
  916. X54
  917. XPick up the key and bring it back to the door to exit.
  918. END_OF_FILE
  919. if test 1191 -ne `wc -c <'levels/000'`; then
  920.     echo shar: \"'levels/000'\" unpacked with wrong size!
  921. fi
  922. # end of 'levels/000'
  923. fi
  924. if test -f 'main.c' -a "${1}" != "-c" ; then 
  925.   echo shar: Will not clobber existing file \"'main.c'\"
  926. else
  927. echo shar: Extracting \"'main.c'\" \(2487 characters\)
  928. sed "s/^X//" >'main.c' <<'END_OF_FILE'
  929. X/*    main.c : main loop of jetpack
  930. X*/
  931. X
  932. X#include "copyright.h"
  933. X#include "defs.h"
  934. X
  935. XWindow    gamewindow, infowindow;
  936. X
  937. Xint    men, score, level;
  938. X
  939. Xint    leveldone, paused, gameover, lastscore;
  940. X
  941. X/*    main is the main loop of the progam. (surprise!) Because of the
  942. X    functional abstraction, it should be pretty readable.
  943. X*/
  944. Xmain()
  945. X{
  946. X    int                        seed;
  947. X    char                    lev[20];
  948. X    register unsigned long    timer;
  949. X
  950. X    /*    randomize the random number generator by seeding it with the time
  951. X        in seconds
  952. X    */
  953. X    seed = (int) time(NULL);
  954. X    srandom(seed);
  955. X
  956. X    
  957. X    /*    set things up
  958. X    */
  959. X    open_scores();
  960. X    init_X();
  961. X    set_up_windows();
  962. X    set_up_bitmaps();
  963. X    lastscore = 0;
  964. X    gameover = 1;
  965. X
  966. X#ifndef    BLIT
  967. X    init_zones();
  968. X#endif
  969. X
  970. X    /*    This outer loop is executed forever. The program is exited by a
  971. X        call to quit_game.
  972. X    */
  973. X    while(1) {
  974. X
  975. X        /*    This loop cycles between the title screen and the
  976. X            demonstration. When the user hits a key or button, gameover
  977. X            is set to 1.
  978. X        */
  979. X        while(gameover) {
  980. X            title_screen();
  981. X            if(gameover) demo();
  982. X        }
  983. X
  984. X        reset_game();
  985. X
  986. X        /*    This loop is the outer "game" loop. Each level is started here.
  987. X        */
  988. X        while(!gameover) {
  989. X            reset_level();
  990. X
  991. X            /*    Some levels are special preset levels
  992. X            */
  993. X            if(!special_setup()) normal_level();
  994. X
  995. X            /* Display the level number
  996. X            */
  997. X            sprintf(lev, "Level: %d", level);
  998. X            bigmessage(lev, CGREEN, 75);
  999. X
  1000. X            /* initial draw
  1001. X            */
  1002. X            XClearWindow(display, gamewindow);
  1003. X            draw();
  1004. X            XClearWindow(display, infowindow);
  1005. X            refresh_info();
  1006. X
  1007. X            /*    central event loop. When the level is over, or the player
  1008. X                loses his/her last life, leveldone is set to 1.
  1009. X            */
  1010. X            while(!leveldone) {
  1011. X                begin_timer();
  1012. X                while(paused) {
  1013. X                    while(XPending(display) && !event_filter());
  1014. X                    usleep(USECDELAY);
  1015. X                }
  1016. X                while(XPending(display) && !event_filter());
  1017. X                update();
  1018. X                collision_check();
  1019. X                message_check();
  1020. X                bonus_check();
  1021. X                draw();
  1022. X
  1023. X                /*    When nothing was in the maze except me, I set
  1024. X                    USECDELAY to a nice-looking speed. Jetpack doesn't
  1025. X                    use a lot of cpu, but there would be slowdown with
  1026. X                    more objects. So to keep the delay constant, I used
  1027. X                    begin_timer and get_timer to time the calculations
  1028. X                    and drawing, subtracted that from USECDELAY, and
  1029. X                    voila! I had a constant delay. The only times that
  1030. X                    it runs over are usually unnoticeable, and if it
  1031. X                    runs over a lot, it means the machine is really
  1032. X                    busy, and you shouldn't be playing anyway.
  1033. X                */
  1034. X                timer = get_timer();
  1035. X                if(timer < USECDELAY) usleep(USECDELAY - timer);
  1036. X            }
  1037. X        }
  1038. X    }
  1039. X}
  1040. END_OF_FILE
  1041. if test 2487 -ne `wc -c <'main.c'`; then
  1042.     echo shar: \"'main.c'\" unpacked with wrong size!
  1043. fi
  1044. # end of 'main.c'
  1045. fi
  1046. if test -f 'message.h' -a "${1}" != "-c" ; then 
  1047.   echo shar: Will not clobber existing file \"'message.h'\"
  1048. else
  1049. echo shar: Extracting \"'message.h'\" \(4113 characters\)
  1050. sed "s/^X//" >'message.h' <<'END_OF_FILE'
  1051. X/*    message.h : silly messages used in jetpack.
  1052. X*/
  1053. X
  1054. X#include "copyright.h"
  1055. X
  1056. X#define    MAXDUMBMESSAGES        10
  1057. X#define    DUMBMESSAGETYPES    7
  1058. X#define    DUMBMESSAGEOPINIONS    4
  1059. X
  1060. Xstatic int    numdumbmessages[DUMBMESSAGETYPES][DUMBMESSAGEOPINIONS] = {
  1061. X    { 8, 9 },
  1062. X    { 9 },
  1063. X    { 10, 9, 8, 7 },
  1064. X    { 10 },
  1065. X    { 8 },
  1066. X    { 10, 9, 9, 10 },
  1067. X    { 10 },
  1068. X};
  1069. X
  1070. Xstatic int    dumbmessagetime[DUMBMESSAGETYPES] = {
  1071. X    50, 20, 50, 20, 50, 100, 100,
  1072. X};
  1073. X
  1074. Xstatic int    dumbmessagechance[DUMBMESSAGETYPES] = {
  1075. X    3, 2, 1, 2, 1, 1, 1,
  1076. X};
  1077. X
  1078. Xstatic char dumbmessage[DUMBMESSAGETYPES][DUMBMESSAGEOPINIONS][MAXDUMBMESSAGES][MAXMESSAGELENGTH] = {
  1079. X
  1080. X/*    MFUEL
  1081. X*/
  1082. X{
  1083. X    {
  1084. X        "Wasteful.",
  1085. X        "It'd people like you who caused the oil crisis!",
  1086. X        "Did you really need that?",
  1087. X        "I think you have plenty.",
  1088. X        "Your tank only holds 1000.",
  1089. X        "When you're running out of fuel later, don't come crying to me.",
  1090. X        "Greedy, aren't you?",
  1091. X        "If you use all the fuel up now, you'll run out later.",
  1092. X    },
  1093. X    {
  1094. X        "Lucky break.",
  1095. X        "You should be more careful!",
  1096. X        "Do you like living on the edge?",
  1097. X        "Whew!",
  1098. X        "Don't let yourself run out!",
  1099. X        "What a relief!",
  1100. X        "I hope there's more around here.",
  1101. X        "Try to pick up fuel more often.",
  1102. X        "Running on empty is a good way to lose.",
  1103. X    },
  1104. X},
  1105. X
  1106. X/*    MKILL
  1107. X*/
  1108. X{
  1109. X    {
  1110. X        "Ouch!",
  1111. X        "Aaarrrgghhh!",
  1112. X        "BOOM!",
  1113. X        "Noooooo!",
  1114. X        "Another one bites the dust.",
  1115. X        "OH NOOOOOO!!!",
  1116. X        "Dead meat.",
  1117. X        "End of the line.",
  1118. X        "KA-BOOOMMM!!",
  1119. X    },
  1120. X},
  1121. X
  1122. X/*    MKEY
  1123. X*/
  1124. X{
  1125. X    {
  1126. X        "Took you long enough.",
  1127. X        "Finally!",
  1128. X        "I hope you don't take this long to get back.",
  1129. X        "It's about time!",
  1130. X        "Hurry up and get back!",
  1131. X        "The clock's ticking...",
  1132. X        "C'mon, slowpoke!",
  1133. X        "tick...tick...tick...",
  1134. X        "Your bonus is running out!",
  1135. X        "Get the lead out!",
  1136. X    },
  1137. X    {
  1138. X        "That was quick!",
  1139. X        "Piece of cake!",
  1140. X        "What a stroke of luck!",
  1141. X        "How did you find it so quickly?",
  1142. X        "Wow, that was fast!",
  1143. X        "You didn't peek when I placed the key, did you?",
  1144. X        "That was easy!",
  1145. X        "No problem!",
  1146. X        "Perfect!",
  1147. X    },
  1148. X    {
  1149. X        "Your chances don't look good.",
  1150. X        "Did you pass any fuel on the way?",
  1151. X        "Can you make it?",
  1152. X        "You really need some fuel.",
  1153. X        "Getting back is going to be tough.",
  1154. X        "I hope you didn't use all the fuel pods getting here.",
  1155. X        "Don't waste so much fuel!",
  1156. X        "You have to find some fuel pods!",
  1157. X    },
  1158. X    {
  1159. X        "Now head back to the door!",
  1160. X        "Got it!",
  1161. X        "Alright!",
  1162. X        "Yes!",
  1163. X        "Go! Go! Go!",
  1164. X        "Good job!",
  1165. X        "Yeah!",
  1166. X    },
  1167. X},
  1168. X
  1169. X/*    MCLOSE
  1170. X*/
  1171. X{
  1172. X    {
  1173. X        "Yow! Careful!",
  1174. X        "Not so close!",
  1175. X        "Watch out!",
  1176. X        "Are you trying to get yourself killed?",
  1177. X        "Are you crazy!",
  1178. X        "I can't look!",
  1179. X        "You're out of your mind!",
  1180. X        "Look out!",
  1181. X        "Yikes!",
  1182. X        "Whoa!",
  1183. X    },
  1184. X},
  1185. X
  1186. X/*    MSUICIDE
  1187. X*/
  1188. X{
  1189. X    {
  1190. X        "Don't you know suicide is illegal?",
  1191. X        "Such a senseless waste of human life.",
  1192. X        "AAAARRRRGGGHHHH.....",
  1193. X        "Way to confront your problems!",
  1194. X        "Remember kids, suicide isn't cool.",
  1195. X        "That's no way to win.",
  1196. X        "BOOOOMMMM!!!",
  1197. X        "Surely there's an alternative?",
  1198. X    },
  1199. X},
  1200. X
  1201. X/*    MEXIT
  1202. X*/
  1203. X{
  1204. X    {
  1205. X        "Pathetic.",
  1206. X        "You need diapers.",
  1207. X        "Slow and steady loses the bonus.",
  1208. X        "Speedy Gonzalez you're not.",
  1209. X        "Zero bonus. Is that you Qarl?",
  1210. X        "Wake me after the next level.",
  1211. X        "Stop it, you're boring me to death.",
  1212. X        "What are you doing, drawing maps?",
  1213. X        "Zzzzzzzzz....",
  1214. X        "Wretched.",
  1215. X    },
  1216. X    {
  1217. X        "What speed!",
  1218. X        "I'm really impressed!",
  1219. X        "Terrific!",
  1220. X        "That was amazing!",
  1221. X        "Incredible!",
  1222. X        "Wow! I'll have to make the next maze harder!",
  1223. X        "You've got this down pat!",
  1224. X        "Fabulous!",
  1225. X        "Excellent!",
  1226. X    },
  1227. X    {
  1228. X        "You can do better than that!",
  1229. X        "That's not too good.",
  1230. X        "You need to go a little faster.",
  1231. X        "I've seen better times.",
  1232. X        "Pick up the pace, Ace.",
  1233. X        "If you want a big bonus, you have to go faster.",
  1234. X        "You're taking too long.",
  1235. X        "Too slow.",
  1236. X        "Hurry it up!",
  1237. X    },
  1238. X    {
  1239. X        "Good job!",
  1240. X        "Congratulations!",
  1241. X        "Way to go!",
  1242. X        "Good level!",
  1243. X        "Good job!",
  1244. X        "Alright!",
  1245. X        "Great!",
  1246. X        "Keep it up!",
  1247. X        "Lookin' good!",
  1248. X        "Yeah!",
  1249. X    },
  1250. X},
  1251. X
  1252. X/*    MQUIT
  1253. X*/
  1254. X{
  1255. X    {
  1256. X        "Quitter!",
  1257. X        "Don't stop now!",
  1258. X        "Well, play again soon!",
  1259. X        "Just one more game, please?",
  1260. X        "Play again, I dare ya!",
  1261. X        "Don't give up!",
  1262. X        "It's been real.",
  1263. X        "Oh, come on!",
  1264. X        "Don't you want to finish the game?",
  1265. X        "Goodbye!",
  1266. X    },
  1267. X},
  1268. X};
  1269. END_OF_FILE
  1270. if test 4113 -ne `wc -c <'message.h'`; then
  1271.     echo shar: \"'message.h'\" unpacked with wrong size!
  1272. fi
  1273. # end of 'message.h'
  1274. fi
  1275. if test -f 'p2.hdr' -a "${1}" != "-c" ; then 
  1276.   echo shar: Will not clobber existing file \"'p2.hdr'\"
  1277. else
  1278. echo shar: Extracting \"'p2.hdr'\" \(716 characters\)
  1279. sed "s/^X//" >'p2.hdr' <<'END_OF_FILE'
  1280. XFrom meb2@cec2.wustl.edu Sun Feb 23 11:50:11 1992
  1281. XReceived: from master.CNA.TEK.COM by saab.CNA.TEK.COM (4.1/6.24)
  1282. X    id AA03370; Sun, 23 Feb 92 11:50:06 PST
  1283. XReceived: from tektronix.TEK.COM by master.CNA.TEK.COM (4.1/7.1)
  1284. X    id AA15620; Sun, 23 Feb 92 11:49:16 PST
  1285. XReceived: from cec2.wustl.edu by tektronix.TEK.COM (4.1/8.0)
  1286. X    id AA14507; Sun, 23 Feb 92 11:50:11 PST
  1287. XReturn-Path: <meb2@cec2.wustl.edu>
  1288. XReceived: by cec2.wustl.edu
  1289. X    (5.65a/1.35); id AA10358; Sun, 23 Feb 92 13:48:29 -0600
  1290. XDate: Sun, 23 Feb 92 13:48:29 -0600
  1291. XFrom: meb2@cec2.wustl.edu (Mark Edward Bradley)
  1292. XMessage-Id: <9202231948.AA10358@cec2.wustl.edu>
  1293. XTo: billr@saab.CNA.TEK.COM
  1294. XSubject: jetpack.shar.2 Jetpack - an arcade action game for X
  1295. XStatus: O
  1296. X
  1297. END_OF_FILE
  1298. if test 716 -ne `wc -c <'p2.hdr'`; then
  1299.     echo shar: \"'p2.hdr'\" unpacked with wrong size!
  1300. fi
  1301. # end of 'p2.hdr'
  1302. fi
  1303. if test -f 'quitx.c' -a "${1}" != "-c" ; then 
  1304.   echo shar: Will not clobber existing file \"'quitx.c'\"
  1305. else
  1306. echo shar: Extracting \"'quitx.c'\" \(1097 characters\)
  1307. sed "s/^X//" >'quitx.c' <<'END_OF_FILE'
  1308. X/*    quitx.c : routine that destroys resources and quits.
  1309. X*/
  1310. X
  1311. X#include "copyright.h"
  1312. X#include "defs.h"
  1313. X
  1314. X/*    quit_game destroys all resources, closes the score file, and quits.
  1315. X*/
  1316. X
  1317. Xquit_game()
  1318. X{
  1319. X    register int    i, j;
  1320. X
  1321. X    for(i=0; i<PLAYERPHASES; i++) {
  1322. X        XFreePixmap(display, playerpix[i]);
  1323. X    }
  1324. X    for(i=0; i<BURNDIRECTIONS; i++) {
  1325. X        XFreePixmap(display, burnpix[i]);
  1326. X    }
  1327. X    for(i=0; i<FIREPHASES; i++) {
  1328. X        XFreePixmap(display, firepix[i]);
  1329. X    }
  1330. X    for(i=0; i<SWEEPERPHASES; i++) {
  1331. X        XFreePixmap(display, sweeperpix[i]);
  1332. X    }
  1333. X    for(i=0; i<EXPLODEFRAMES; i++) {
  1334. X        XFreePixmap(display, explodepix[i]);
  1335. X    }
  1336. X    for(i=0; i<GUARDDIRECTIONS; i++) {
  1337. X        for(j=0; j<GUARDPHASES; j++) {
  1338. X            XFreePixmap(display, guardpix[i][j]);
  1339. X        }
  1340. X    }
  1341. X    for(i=0; i<DOORFRAMES; i++) {
  1342. X        XFreePixmap(display, doorpix[i]);
  1343. X    }
  1344. X    XFreePixmap(display, fuelpix);
  1345. X    XFreePixmap(display, keypix);
  1346. X    XFreePixmap(display, extramanpix);
  1347. X    XFreePixmap(display, scorepixmap);
  1348. X
  1349. X#ifdef    BLIT
  1350. X    XFreePixmap(display, drawpixmap);
  1351. X#endif
  1352. X
  1353. X    XDestroySubwindows(display, gamewindow);
  1354. X    XDestroyWindow(display, gamewindow);
  1355. X    XCloseDisplay(display);
  1356. X    close_scores();
  1357. X    exit(0);
  1358. X}
  1359. END_OF_FILE
  1360. if test 1097 -ne `wc -c <'quitx.c'`; then
  1361.     echo shar: \"'quitx.c'\" unpacked with wrong size!
  1362. fi
  1363. # end of 'quitx.c'
  1364. fi
  1365. if test -f 'setinmaze.c' -a "${1}" != "-c" ; then 
  1366.   echo shar: Will not clobber existing file \"'setinmaze.c'\"
  1367. else
  1368. echo shar: Extracting \"'setinmaze.c'\" \(2355 characters\)
  1369. sed "s/^X//" >'setinmaze.c' <<'END_OF_FILE'
  1370. X/*    setinmaze.c : routine used to keep objects off the maze walls
  1371. X*/
  1372. X
  1373. X#include "copyright.h"
  1374. X#include "defs.h"
  1375. X
  1376. Xint    nx, ny;
  1377. X
  1378. X/*    set_in_maze : This ugly procedure checks the global variables nx and
  1379. X    ny against the maze and adjusts them if they sit on a wall. The reason
  1380. X    there are double checks for WALLUP and WALLDOWN is to avoid side
  1381. X    effects like being stopped by a vertical wall on the other side of the
  1382. X    ceiling you're touching with your head.
  1383. X*/
  1384. Xint    set_in_maze(off)
  1385. Xint    off;
  1386. X{
  1387. X    int flags = 0;
  1388. X
  1389. X    if(((ny % mazescale) >= mazescale - (off + 1)) &&
  1390. X        (maze[nx/mazescale][ny/mazescale] & WALLDOWN)) {
  1391. X
  1392. X            ny = mazescale - (off + 1) + ((ny/mazescale) * mazescale);
  1393. X            flags |= WALLDOWN;
  1394. X        
  1395. X    } else if(((ny % mazescale) <= (off + 1)) &&
  1396. X        (maze[nx/mazescale][ny/mazescale] & WALLUP)) {
  1397. X        
  1398. X            ny = (off + 1) + ((ny/mazescale) * mazescale);
  1399. X            flags |= WALLUP;
  1400. X        
  1401. X    }
  1402. X    if(((nx % mazescale) >= mazescale - (off + 1)) &&
  1403. X        ((maze[nx/mazescale][ny/mazescale] & WALLRIGHT) ||
  1404. X        (((ny % mazescale) > mazescale - off) &&
  1405. X        (maze[nx/mazescale][ny/mazescale+1] & WALLRIGHT)) ||
  1406. X        (((ny % mazescale) < off) &&
  1407. X        (maze[nx/mazescale][ny/mazescale-1] & WALLRIGHT)))) {
  1408. X            
  1409. X            nx = mazescale - (off + 1) + ((nx/mazescale) * mazescale);
  1410. X            flags |= WALLRIGHT;
  1411. X        
  1412. X    } else if(((nx % mazescale) <= (off + 1)) &&
  1413. X        ((maze[nx/mazescale][ny/mazescale] & WALLLEFT) ||
  1414. X        (((ny % mazescale) > mazescale - off) &&
  1415. X        (maze[nx/mazescale][ny/mazescale+1] & WALLLEFT)) ||
  1416. X        (((ny % mazescale) < off) &&
  1417. X        (maze[nx/mazescale][ny/mazescale-1] & WALLLEFT)))) {
  1418. X            
  1419. X            nx = (off + 1) + ((nx/mazescale) * mazescale);
  1420. X            flags |= WALLLEFT;
  1421. X        
  1422. X    }
  1423. X    if(((ny % mazescale) >= mazescale - (off + 1)) &&
  1424. X        ((maze[nx/mazescale][ny/mazescale] & WALLDOWN) ||
  1425. X        (((nx % mazescale) > mazescale - off) &&
  1426. X        (maze[nx/mazescale+1][ny/mazescale] & WALLDOWN)) ||
  1427. X        (((nx % mazescale) < off) &&
  1428. X        (maze[nx/mazescale-1][ny/mazescale] & WALLDOWN)))) {
  1429. X        
  1430. X            ny = mazescale - (off + 1) + ((ny/mazescale) * mazescale);
  1431. X            flags |= WALLDOWN;
  1432. X        
  1433. X    } else if(((ny % mazescale) <= (off + 1)) &&
  1434. X        ((maze[nx/mazescale][ny/mazescale] & WALLUP) ||
  1435. X        (((nx % mazescale) > mazescale - off) &&
  1436. X        (maze[nx/mazescale+1][ny/mazescale] & WALLUP)) ||
  1437. X        (((nx % mazescale) < off) &&
  1438. X        (maze[nx/mazescale-1][ny/mazescale] & WALLUP)))) {
  1439. X        
  1440. X            ny = (off + 1) + ((ny/mazescale) * mazescale);
  1441. X            flags |= WALLUP;
  1442. X        
  1443. X    }
  1444. X    return(flags);
  1445. X}
  1446. END_OF_FILE
  1447. if test 2355 -ne `wc -c <'setinmaze.c'`; then
  1448.     echo shar: \"'setinmaze.c'\" unpacked with wrong size!
  1449. fi
  1450. # end of 'setinmaze.c'
  1451. fi
  1452. if test -f 'special.c' -a "${1}" != "-c" ; then 
  1453.   echo shar: Will not clobber existing file \"'special.c'\"
  1454. else
  1455. echo shar: Extracting \"'special.c'\" \(2264 characters\)
  1456. sed "s/^X//" >'special.c' <<'END_OF_FILE'
  1457. X/*    special.c : routines that read in the predefined levels from files.
  1458. X*/
  1459. X
  1460. X#include "copyright.h"
  1461. X#include "defs.h"
  1462. X
  1463. X#ifndef    LEVELPATH
  1464. X#define    LEVELPATH    "jetpack.lev"
  1465. X#endif
  1466. X
  1467. X/*    special_setup checks to see if the current level has a level file, and
  1468. X    if so, to read in the level from the level file
  1469. X*/
  1470. Xint    special_setup()
  1471. X{
  1472. X    register int    i, j;
  1473. X    char            filename[MAXPATHLEN];
  1474. X    FILE            *fp;
  1475. X    int                gx, gy, gd, gs, fx, fy, fdx, fdy, sx, sy, sf, sd, ss,
  1476. X                    px, py, kx, ky, length, ng, nf, ns, np, playerx,
  1477. X                    playery;
  1478. X
  1479. X    sprintf(filename, "%s%03d", LEVELPATH, level);
  1480. X    fp = fopen(filename, "r");
  1481. X    if(fp == NULL) return(0);
  1482. X    rewind(fp);
  1483. X    fflush(fp);
  1484. X    mazelcount = 0;
  1485. X    fscanf(fp, " %d %d %d ", &mazewidth, &mazeheight, &mazescale);
  1486. X    for(i=0; i<mazeheight+2; i++) {
  1487. X        for(j=0; j<mazewidth+2; j++) {
  1488. X            fscanf(fp, "%d", &(maze[j][i]));
  1489. X        }
  1490. X    }
  1491. X    convert_maze(mazewidth, mazeheight);
  1492. X    fscanf(fp, " %d %d %d ", &playerx, &playery, &bonus);
  1493. X    place_player(playerx, playery);
  1494. X    fscanf(fp, " %d ", &ng);
  1495. X    for(i=0; i<ng; i++) {
  1496. X        fscanf(fp, " %d %d %d %d ", &gx, &gy, &gd, &gs);
  1497. X        place_guard(gx, gy, gd, gs);
  1498. X    }
  1499. X    fscanf(fp, " %d ", &nf);
  1500. X    for(i=0; i<nf; i++) {
  1501. X        fscanf(fp, " %d %d %d %d ", &fx, &fy, &fdx, &fdy);
  1502. X        place_fireball(fx, fy, fdx, fdy);
  1503. X    }
  1504. X    fscanf(fp, " %d ", &ns);
  1505. X    for(i=0; i<ns; i++) {
  1506. X        fscanf(fp, " %d %d %d %d %d ", &sx, &sy, &sf, &sd, &ss);
  1507. X        place_sweeper(sx, sy, sf, sd, ss);
  1508. X    }
  1509. X    fscanf(fp, " %d ", &np);
  1510. X    for(i=0; i<np; i++) {
  1511. X        fscanf(fp, " %d %d ", &px, &py);
  1512. X        place_fuel(px, py);
  1513. X    }
  1514. X    fscanf(fp, " %d %d ", &kx, &ky);
  1515. X    place_key(kx, ky);
  1516. X    fscanf(fp, " %d ", &numlmessage);
  1517. X    for(i=0; i<numlmessage; i++) {
  1518. X        fscanf(fp, " %d %d %d %d %d %d %d %d ", &(lmessage[i].x1),
  1519. X                &(lmessage[i].y1), &(lmessage[i].x2), &(lmessage[i].y2),
  1520. X                &(lmessage[i].color), &(lmessage[i].bigcolor),
  1521. X                &(lmessage[i].time), &(lmessage[i].bigtime));
  1522. X        fscanf(fp, " %d ", &length);
  1523. X        for(j=0; j<length; j++) {
  1524. X            fscanf(fp, "%c", lmessage[i].bigtext+j);
  1525. X        }
  1526. X        lmessage[i].bigtext[length] = '\0';
  1527. X        lmessage[i].bigactive = (length != 0);
  1528. X        fscanf(fp, " %d ", &length);
  1529. X        for(j=0; j<length; j++) {
  1530. X            fscanf(fp, "%c", lmessage[i].text+j);
  1531. X        }
  1532. X        lmessage[i].text[length] = '\0';
  1533. X        lmessage[i].active = (length != 0);
  1534. X        lmessage[i].unused = 1;
  1535. X    }
  1536. X    initbonus = bonus;
  1537. X    return(1);
  1538. X}
  1539. END_OF_FILE
  1540. if test 2264 -ne `wc -c <'special.c'`; then
  1541.     echo shar: \"'special.c'\" unpacked with wrong size!
  1542. fi
  1543. # end of 'special.c'
  1544. fi
  1545. if test -f 'time.c' -a "${1}" != "-c" ; then 
  1546.   echo shar: Will not clobber existing file \"'time.c'\"
  1547. else
  1548. echo shar: Extracting \"'time.c'\" \(872 characters\)
  1549. sed "s/^X//" >'time.c' <<'END_OF_FILE'
  1550. X/*    time.c : routines that use the realtime process timer to synchronize
  1551. X    the game.
  1552. X*/
  1553. X
  1554. X#include "copyright.h"
  1555. X#include "defs.h"
  1556. X
  1557. Xstruct itimerval    val;
  1558. X
  1559. X/*    begin_timer starts the realtime process timer
  1560. X*/
  1561. Xbegin_timer()
  1562. X{
  1563. X    val.it_value.tv_sec = 30000;
  1564. X    val.it_value.tv_usec = 0;
  1565. X    val.it_interval.tv_sec = 30000;
  1566. X    val.it_interval.tv_usec = 0;
  1567. X    setitimer(ITIMER_REAL, &val, NULL);
  1568. X}
  1569. X
  1570. X/*    stop_timer stops the realtime process timer
  1571. X*/
  1572. Xstop_timer()
  1573. X{
  1574. X    val.it_value.tv_sec = 0;
  1575. X    val.it_value.tv_usec = 0;
  1576. X    val.it_interval.tv_sec = 0;
  1577. X    val.it_interval.tv_usec = 0;
  1578. X    setitimer(ITIMER_REAL, &val, NULL);
  1579. X}
  1580. X
  1581. X/*    get_timer returns the elapsed real timer time in microseconds
  1582. X*/
  1583. Xunsigned long    get_timer()
  1584. X{
  1585. X    register long    ds, dus, dt;
  1586. X
  1587. X    getitimer(ITIMER_REAL, &val);
  1588. X    ds = 30000 - val.it_value.tv_sec - 1;
  1589. X    dus = 1000000 - val.it_value.tv_usec;
  1590. X    dt = dus + 1000000 * ds;
  1591. X    return(dt);
  1592. X}
  1593. END_OF_FILE
  1594. if test 872 -ne `wc -c <'time.c'`; then
  1595.     echo shar: \"'time.c'\" unpacked with wrong size!
  1596. fi
  1597. # end of 'time.c'
  1598. fi
  1599. echo shar: End of archive 4 \(of 4\).
  1600. cp /dev/null ark4isdone
  1601. MISSING=""
  1602. for I in 1 2 3 4 ; do
  1603.     if test ! -f ark${I}isdone ; then
  1604.     MISSING="${MISSING} ${I}"
  1605.     fi
  1606. done
  1607. if test "${MISSING}" = "" ; then
  1608.     echo You have unpacked all 4 archives.
  1609.     rm -f ark[1-9]isdone
  1610. else
  1611.     echo You still need to unpack the following archives:
  1612.     echo "        " ${MISSING}
  1613. fi
  1614. ##  End of shell archive.
  1615. exit 0
  1616.