home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume15 / robothnt / part03 < prev    next >
Encoding:
Internet Message Format  |  1993-01-26  |  54.4 KB

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v15i034:  robot_hunt - original hunt with a robot, Part03/04
  5. Message-ID: <4190@master.CNA.TEK.COM>
  6. Date: 14 Jan 93 03:14:08 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 2465
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1533
  11.  
  12. Submitted-by: whatis@ucsd.edu (Steve Boswell)
  13. Posting-number: Volume 15, Issue 34
  14. Archive-name: robot_hunt/Part03
  15. Environment: Curses, Sockets
  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 3 (of 4)."
  25. # Contents:  answer.c draw.c execute.c hunt.6 hunt.h playit.c
  26. # Wrapped by billr@saab on Wed Jan 13 19:04:32 1993
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'answer.c' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'answer.c'\"
  30. else
  31. echo shar: Extracting \"'answer.c'\" \(8280 characters\)
  32. sed "s/^X//" >'answer.c' <<'END_OF_FILE'
  33. X/*
  34. X * Copyright (c) 1985 Regents of the University of California.
  35. X * All rights reserved.
  36. X *
  37. X * Redistribution and use in source and binary forms are permitted
  38. X * provided that the above copyright notice and this paragraph are
  39. X * duplicated in all such forms and that any documentation,
  40. X * advertising materials, and other materials related to such
  41. X * distribution and use acknowledge that the software was developed
  42. X * by the University of California, Berkeley.  The name of the
  43. X * University may not be used to endorse or promote products derived
  44. X * from this software without specific prior written permission.
  45. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  46. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  47. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  48. X */
  49. X
  50. X#ifndef lint
  51. Xstatic char sccsid[] = "@(#)answer.c    5.2 (Berkeley) 6/27/88";
  52. X#endif /* not lint */
  53. X
  54. X/*
  55. X *  Hunt
  56. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  57. X *  San Francisco, California
  58. X */
  59. X
  60. X# include    "hunt.h"
  61. X# include    <errno.h>
  62. X
  63. X# define    MAXPERMACH    3    /* Max player/monitor per machine */
  64. X
  65. Xstatic char    Ttyname[NAMELEN];
  66. X
  67. Xanswer()
  68. X{
  69. X    register PLAYER        *pp;
  70. X    register int        newsock;
  71. X    register FILE        *tmpfd;
  72. X# ifdef MONITOR
  73. X    static FLAG        monitor;
  74. X# endif MONITOR
  75. X    static char        name[NAMELEN];
  76. X    static int        socklen;
  77. X    static u_long        machine;
  78. X    static u_long        uid;
  79. X    static SOCKET        sockstruct;
  80. X# ifdef OLDIPC
  81. X    extern SOCKET        Daemon;
  82. X# endif OLDIPC
  83. X
  84. X# ifdef INTERNET
  85. X    socklen = sizeof sockstruct;
  86. X# else
  87. X    socklen = sizeof sockstruct - 1;
  88. X# endif INTERNET
  89. X    errno = 0;
  90. X# ifndef OLDIPC
  91. X    if ((newsock = accept(Socket, &sockstruct, &socklen)) < 0)
  92. X# else OLDIPC
  93. X    if (accept(Socket, &sockstruct) < 0)
  94. X# endif OLDIPC
  95. X    {
  96. X        if (errno == EINTR)
  97. X            return;
  98. X        perror("accept");
  99. X        cleanup(1);
  100. X    }
  101. X# ifdef OLDIPC
  102. X    newsock = Socket;
  103. X    Socket = socket(SOCK_STREAM, 0, (struct sockaddr *) &Daemon,
  104. X        SO_ACCEPTCONN);
  105. X    if (Socket < 0) {
  106. X        perror("new accept socket");
  107. X        cleanup(1);
  108. X    }
  109. X    Sock_mask = (1 << Socket);
  110. X    Fds_mask |= Sock_mask;
  111. X    if (Socket >= Num_fds)
  112. X        Num_fds = Socket + 1;
  113. X# endif OLDIPC
  114. X
  115. X    tmpfd = fdopen(newsock, "w");
  116. X
  117. X# ifdef INTERNET
  118. X    machine = ntohl(((struct sockaddr_in *) &sockstruct)->sin_addr.s_addr);
  119. X# else INTERNET
  120. X    if (machine == 0)
  121. X        machine = gethostid();
  122. X# endif INTERNET
  123. X    (void) putw(getpid(), tmpfd);
  124. X    (void) read(newsock, (char *) &uid, sizeof uid);
  125. X    uid = ntohl(uid);
  126. X    (void) read(newsock, name, NAMELEN);
  127. X    (void) read(newsock, Ttyname, NAMELEN);
  128. X# ifdef MONITOR
  129. X    (void) read(newsock, (char *) &monitor, sizeof monitor);
  130. X# endif MONITOR
  131. X
  132. X    if (reached_limit(machine)) {
  133. X        socklen = 0;
  134. X        (void) write(newsock, (char *) &socklen, sizeof socklen);
  135. X        (void) close(newsock);
  136. X# ifdef OLDIPC
  137. X        Fds_mask &= ~(1 << newsock);
  138. X# endif OLDIPC
  139. X        return;
  140. X    }
  141. X
  142. X# ifdef MONITOR
  143. X    if (monitor)
  144. X        if (End_monitor < &Monitor[MAXMON])
  145. X            pp = End_monitor++;
  146. X        else {
  147. X            socklen = 0;
  148. X            (void) write(newsock, (char *) &socklen,
  149. X                sizeof socklen);
  150. X            (void) close(newsock);
  151. X            return;
  152. X        }
  153. X    else
  154. X# endif MONITOR
  155. X        if (End_player < &Player[MAXPL])
  156. X            pp = End_player++;
  157. X        else {
  158. X            socklen = 0;
  159. X            (void) write(newsock, (char *) &socklen,
  160. X                sizeof socklen);
  161. X            (void) close(newsock);
  162. X            return;
  163. X        }
  164. X
  165. X    pp->p_ident = get_ident(machine, uid, name);
  166. X    pp->p_output = tmpfd;
  167. X    pp->p_death[0] = '\0';
  168. X    pp->p_fd = newsock;
  169. X    pp->p_mask = (1 << pp->p_fd);
  170. X# ifndef OLDIPC
  171. X    Fds_mask |= pp->p_mask;
  172. X    if (pp->p_fd >= Num_fds)
  173. X        Num_fds = pp->p_fd + 1;
  174. X# endif OLDIPC
  175. X
  176. X    pp->p_y = 0;
  177. X    pp->p_x = 0;
  178. X
  179. X# ifdef MONITOR
  180. X    if (monitor)
  181. X        stmonitor(pp);
  182. X    else
  183. X# endif MONITOR
  184. X        stplayer(pp);
  185. X}
  186. X
  187. X# ifdef MONITOR
  188. Xstmonitor(pp)
  189. Xregister PLAYER    *pp;
  190. X{
  191. X    register int    line;
  192. X    register PLAYER    *npp;
  193. X
  194. X    bcopy((char *) Maze, (char *) pp->p_maze, sizeof Maze);
  195. X
  196. X    drawmaze(pp);
  197. X
  198. X    (void) sprintf(Buf, "%5.5s%c%-10.10s", " ", stat_char(pp),
  199. X        pp->p_ident->i_name);
  200. X    line = STAT_MON_ROW + 1 + (pp - Monitor);
  201. X    for (npp = Player; npp < End_player; npp++) {
  202. X        cgoto(npp, line, STAT_NAME_COL);
  203. X        outstr(npp, Buf, STAT_NAME_LEN);
  204. X    }
  205. X    for (npp = Monitor; npp < End_monitor; npp++) {
  206. X        cgoto(npp, line, STAT_NAME_COL);
  207. X        outstr(npp, Buf, STAT_NAME_LEN);
  208. X    }
  209. X
  210. X    sendcom(pp, REFRESH);
  211. X    sendcom(pp, READY, 0);
  212. X    (void) fflush(pp->p_output);
  213. X}
  214. X# endif MONITOR
  215. X
  216. Xstplayer(newpp)
  217. Xregister PLAYER    *newpp;
  218. X{
  219. X    register int    x, y;
  220. X    register PLAYER    *pp;
  221. X
  222. X    Nplayer++;
  223. X
  224. X    for (y = 0; y < UBOUND; y++)
  225. X        for (x = 0; x < WIDTH; x++)
  226. X            newpp->p_maze[y][x] = Maze[y][x];
  227. X    for (     ; y < DBOUND; y++) {
  228. X        for (x = 0; x < LBOUND; x++)
  229. X            newpp->p_maze[y][x] = Maze[y][x];
  230. X        for (     ; x < RBOUND; x++)
  231. X            newpp->p_maze[y][x] = SPACE;
  232. X        for (     ; x < WIDTH;  x++)
  233. X            newpp->p_maze[y][x] = Maze[y][x];
  234. X    }
  235. X    for (     ; y < HEIGHT; y++)
  236. X        for (x = 0; x < WIDTH; x++)
  237. X            newpp->p_maze[y][x] = Maze[y][x];
  238. X
  239. X    do {
  240. X        x = rand_num(WIDTH - 1) + 1;
  241. X        y = rand_num(HEIGHT - 1) + 1;
  242. X    } while (Maze[y][x] != SPACE);
  243. X    newpp->p_over = SPACE;
  244. X    newpp->p_x = x;
  245. X    newpp->p_y = y;
  246. X    newpp->p_undershot = FALSE;
  247. X
  248. X# ifdef    START_FLYING
  249. X    /* This is only for debugging */
  250. X    newpp->p_flying = rand_num(20);
  251. X    newpp->p_flyx = 2 * rand_num(6) - 5;
  252. X    newpp->p_flyy = 2 * rand_num(6) - 5;
  253. X    newpp->p_face = FLYER;
  254. X# else START_FLYING
  255. X    newpp->p_flying = -1;
  256. X    rand_face(newpp);
  257. X# endif START_FLYING
  258. X    newpp->p_damage = 0;
  259. X    newpp->p_damcap = MAXDAM;
  260. X    newpp->p_nchar = 0;
  261. X    newpp->p_ncount = 0;
  262. X    newpp->p_nexec = 0;
  263. X    newpp->p_ammo = ISHOTS;
  264. X    newpp->p_scan = -1;
  265. X    newpp->p_cloak = CLOAKLEN;
  266. X    newpp->p_ncshot = 0;
  267. X
  268. X    do {
  269. X        x = rand_num(WIDTH - 1) + 1;
  270. X        y = rand_num(HEIGHT - 1) + 1;
  271. X    } while (Maze[y][x] != SPACE);
  272. X    Maze[y][x] = GMINE;
  273. X# ifdef MONITOR
  274. X    for (pp = Monitor; pp < End_monitor; pp++)
  275. X        check(pp, y, x);
  276. X# endif MONITOR
  277. X
  278. X    do {
  279. X        x = rand_num(WIDTH - 1) + 1;
  280. X        y = rand_num(HEIGHT - 1) + 1;
  281. X    } while (Maze[y][x] != SPACE);
  282. X    Maze[y][x] = MINE;
  283. X# ifdef MONITOR
  284. X    for (pp = Monitor; pp < End_monitor; pp++)
  285. X        check(pp, y, x);
  286. X# endif MONITOR
  287. X
  288. X    (void) sprintf(Buf, "%5.2f%c%-10.10s", newpp->p_ident->i_score,
  289. X        stat_char(newpp), newpp->p_ident->i_name);
  290. X    y = STAT_PLAY_ROW + 1 + (newpp - Player);
  291. X    for (pp = Player; pp < End_player; pp++) {
  292. X        if (pp != newpp) {
  293. X            char    smallbuf[10];
  294. X
  295. X            pp->p_ammo += NSHOTS;
  296. X            newpp->p_ammo += NSHOTS;
  297. X            cgoto(pp, y, STAT_NAME_COL);
  298. X            outstr(pp, Buf, STAT_NAME_LEN);
  299. X            (void) sprintf(smallbuf, "%3d", pp->p_ammo);
  300. X            cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
  301. X            outstr(pp, smallbuf, 3);
  302. X        }
  303. X    }
  304. X# ifdef MONITOR
  305. X    for (pp = Monitor; pp < End_monitor; pp++) {
  306. X        cgoto(pp, y, STAT_NAME_COL);
  307. X        outstr(pp, Buf, STAT_NAME_LEN);
  308. X    }
  309. X# endif MONITOR
  310. X
  311. X    drawmaze(newpp);
  312. X    drawplayer(newpp, TRUE);
  313. X    look(newpp);
  314. X# ifdef START_FLYING
  315. X    /* Make sure that the position you enter in will be erased */
  316. X    showexpl(newpp->p_y, newpp->p_x, FLYER);
  317. X# endif START_FLYING
  318. X    sendcom(newpp, REFRESH);
  319. X    sendcom(newpp, READY, 0);
  320. X    (void) fflush(newpp->p_output);
  321. X}
  322. X
  323. X/*
  324. X * rand_face:
  325. X *    Give the player a random facing direction
  326. X */
  327. Xrand_face(pp)
  328. Xregister PLAYER    *pp;
  329. X{
  330. X    switch (rand_num(4)) {
  331. X      case 0:
  332. X        pp->p_face = LEFTS;
  333. X        break;
  334. X      case 1:
  335. X        pp->p_face = RIGHT;
  336. X        break;
  337. X      case 2:
  338. X        pp->p_face = BELOW;
  339. X        break;
  340. X      case 3:
  341. X        pp->p_face = ABOVE;
  342. X        break;
  343. X    }
  344. X}
  345. X
  346. X/*
  347. X * get_ident:
  348. X *    Get the score structure of a player
  349. X */
  350. XIDENT *
  351. Xget_ident(machine, uid, name)
  352. Xu_long    machine;
  353. Xu_long    uid;
  354. Xchar    *name;
  355. X{
  356. X    register IDENT    *ip;
  357. X    static IDENT    punt;
  358. X
  359. X    for (ip = Scores; ip != NULL; ip = ip->i_next)
  360. X        if (ip->i_machine == machine && ip->i_uid == uid &&
  361. X            strncmp(ip->i_name, name, NAMELEN) == 0)
  362. X            break;
  363. X
  364. X    if (ip != NULL) {
  365. X        ip->i_entries++;
  366. X        ip->i_score = ip->i_kills / (double) ip->i_entries;
  367. X    }
  368. X    else {
  369. X        ip = (IDENT *) malloc(sizeof (IDENT));
  370. X        if (ip == NULL) {
  371. X            /* Fourth down, time to punt */
  372. X            ip = &punt;
  373. X        }
  374. X        ip->i_machine = machine;
  375. X        ip->i_uid = uid;
  376. X        strncpy(ip->i_name, name, NAMELEN);
  377. X        ip->i_kills = 0;
  378. X        ip->i_entries = 1;
  379. X        ip->i_score = 0;
  380. X        ip->i_next = Scores;
  381. X        Scores = ip;
  382. X    }
  383. X
  384. X    return ip;
  385. X}
  386. X
  387. X/*
  388. X * reached_limit:
  389. X *    Returns whether the limit of x persons per machine has been reached
  390. X */
  391. Xreached_limit(machine)
  392. Xu_long    machine;
  393. X{
  394. X    register PLAYER    *pp;
  395. X    register int    count;
  396. X
  397. X    count = 0;
  398. X    for (pp = Player; pp < End_player; pp++)
  399. X        if (pp->p_ident->i_machine == machine)
  400. X            count++;
  401. X    for (pp = Monitor; pp < End_monitor; pp++)
  402. X        if (pp->p_ident->i_machine == machine)
  403. X            count++;
  404. X    return count >= MAXPERMACH;
  405. X}
  406. END_OF_FILE
  407. if test 8280 -ne `wc -c <'answer.c'`; then
  408.     echo shar: \"'answer.c'\" unpacked with wrong size!
  409. fi
  410. # end of 'answer.c'
  411. fi
  412. if test -f 'draw.c' -a "${1}" != "-c" ; then 
  413.   echo shar: Will not clobber existing file \"'draw.c'\"
  414. else
  415. echo shar: Extracting \"'draw.c'\" \(8245 characters\)
  416. sed "s/^X//" >'draw.c' <<'END_OF_FILE'
  417. X/*
  418. X * Copyright (c) 1985 Regents of the University of California.
  419. X * All rights reserved.
  420. X *
  421. X * Redistribution and use in source and binary forms are permitted
  422. X * provided that the above copyright notice and this paragraph are
  423. X * duplicated in all such forms and that any documentation,
  424. X * advertising materials, and other materials related to such
  425. X * distribution and use acknowledge that the software was developed
  426. X * by the University of California, Berkeley.  The name of the
  427. X * University may not be used to endorse or promote products derived
  428. X * from this software without specific prior written permission.
  429. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  430. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  431. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  432. X */
  433. X
  434. X#ifndef lint
  435. Xstatic char sccsid[] = "@(#)draw.c    5.2 (Berkeley) 6/27/88";
  436. X#endif /* not lint */
  437. X
  438. X/*
  439. X *  Hunt
  440. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  441. X *  San Francisco, California
  442. X */
  443. X
  444. X# include    "hunt.h"
  445. X
  446. Xdrawmaze(pp)
  447. Xregister PLAYER    *pp;
  448. X{
  449. X    register int    x;
  450. X    register char    *sp;
  451. X    register int    y;
  452. X    register char    *endp;
  453. X
  454. X    clrscr(pp);
  455. X    outstr(pp, pp->p_maze[0], WIDTH);
  456. X    for (y = 1; y < HEIGHT - 1; y++) {
  457. X        endp = &pp->p_maze[y][WIDTH];
  458. X        for (x = 0, sp = pp->p_maze[y]; sp < endp; x++, sp++)
  459. X            if (*sp != SPACE) {
  460. X                cgoto(pp, y, x);
  461. X                if (pp->p_x == x && pp->p_y == y)
  462. X                    outch(pp, translate(*sp));
  463. X                else
  464. X                    outch(pp, *sp);
  465. X            }
  466. X    }
  467. X    cgoto(pp, HEIGHT - 1, 0);
  468. X    outstr(pp, pp->p_maze[HEIGHT - 1], WIDTH);
  469. X    drawstatus(pp);
  470. X}
  471. X
  472. X/*
  473. X * drawstatus - put up the status lines (this assumes the screen
  474. X *        size is 80x24 with the maze being 64x24)
  475. X */
  476. Xdrawstatus(pp)
  477. Xregister PLAYER    *pp;
  478. X{
  479. X    register int    i;
  480. X    register PLAYER    *np;
  481. X
  482. X    (void) sprintf(Buf, "%-13.13s", pp->p_ident->i_name);
  483. X    cgoto(pp, STAT_NAME_ROW, STAT_LABEL_COL);
  484. X    outstr(pp, Buf, 13);
  485. X
  486. X    cgoto(pp, STAT_AMMO_ROW, STAT_LABEL_COL);
  487. X    outstr(pp, "Ammo:", 5);
  488. X    (void) sprintf(Buf, "%3d", pp->p_ammo);
  489. X    cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
  490. X    outstr(pp, Buf, 3);
  491. X
  492. X    cgoto(pp, STAT_CLOAK_ROW, STAT_LABEL_COL);
  493. X    outstr(pp, "Cloak:", 6);
  494. X    cgoto(pp, STAT_CLOAK_ROW, STAT_VALUE_COL);
  495. X    outstr(pp, (pp->p_cloak < 0) ? "   " : " on", 3);
  496. X
  497. X    cgoto(pp, STAT_SCAN_ROW, STAT_LABEL_COL);
  498. X    outstr(pp, "Scan:", 5);
  499. X    cgoto(pp, STAT_SCAN_ROW, STAT_VALUE_COL);
  500. X    outstr(pp, (pp->p_scan < 0) ? "   " : " on", 3);
  501. X
  502. X    cgoto(pp, STAT_GUN_ROW, STAT_LABEL_COL);
  503. X    outstr(pp, "Gun:", 4);
  504. X    cgoto(pp, STAT_GUN_ROW, STAT_VALUE_COL);
  505. X    outstr(pp, (pp->p_ncshot < MAXNCSHOT) ? " ok" : "   ", 3);
  506. X
  507. X    cgoto(pp, STAT_DAM_ROW, STAT_LABEL_COL);
  508. X    outstr(pp, "Damage:", 7);
  509. X    (void) sprintf(Buf, "%2d/%2d", pp->p_damage, pp->p_damcap);
  510. X    cgoto(pp, STAT_DAM_ROW, STAT_VALUE_COL);
  511. X    outstr(pp, Buf, 5);
  512. X
  513. X    cgoto(pp, STAT_KILL_ROW, STAT_LABEL_COL);
  514. X    outstr(pp, "Kills:", 6);
  515. X    (void) sprintf(Buf, "%3d", (pp->p_damcap - MAXDAM) / 2);
  516. X    cgoto(pp, STAT_KILL_ROW, STAT_VALUE_COL);
  517. X    outstr(pp, Buf, 3);
  518. X
  519. X    cgoto(pp, STAT_PLAY_ROW, STAT_LABEL_COL);
  520. X    outstr(pp, "Player:", 7);
  521. X    for (i = STAT_PLAY_ROW + 1, np = Player; np < End_player; np++) {
  522. X        (void) sprintf(Buf, "%5.2f%c%-10.10s", np->p_ident->i_score,
  523. X            stat_char(np), np->p_ident->i_name);
  524. X        cgoto(pp, i++, STAT_NAME_COL);
  525. X        outstr(pp, Buf, STAT_NAME_LEN);
  526. X    }
  527. X
  528. X# ifdef MONITOR
  529. X    cgoto(pp, STAT_MON_ROW, STAT_LABEL_COL);
  530. X    outstr(pp, "Monitor:", 8);
  531. X    for (i = STAT_MON_ROW + 1, np = Monitor; np < End_monitor; np++) {
  532. X        (void) sprintf(Buf, "%5.5s %-10.10s", " ", np->p_ident->i_name);
  533. X        cgoto(pp, i++, STAT_NAME_COL);
  534. X        outstr(pp, Buf, STAT_NAME_LEN);
  535. X    }
  536. X# endif MONITOR
  537. X}
  538. X
  539. X# ifndef CPUHOG
  540. Xlook(pp)
  541. Xregister PLAYER    *pp;
  542. X{
  543. X    register int    x, y;
  544. X
  545. X    x = pp->p_x;
  546. X    y = pp->p_y;
  547. X
  548. X    check(pp, y - 1, x - 1);
  549. X    check(pp, y - 1, x    );
  550. X    check(pp, y - 1, x + 1);
  551. X    check(pp, y    , x - 1);
  552. X    check(pp, y    , x    );
  553. X    check(pp, y    , x + 1);
  554. X    check(pp, y + 1, x - 1);
  555. X    check(pp, y + 1, x    );
  556. X    check(pp, y + 1, x + 1);
  557. X
  558. X    switch (pp->p_face) {
  559. X      case LEFTS:
  560. X        see(pp, LEFTS);
  561. X        see(pp, ABOVE);
  562. X        see(pp, BELOW);
  563. X        break;
  564. X      case RIGHT:
  565. X        see(pp, RIGHT);
  566. X        see(pp, ABOVE);
  567. X        see(pp, BELOW);
  568. X        break;
  569. X      case ABOVE:
  570. X        see(pp, ABOVE);
  571. X        see(pp, LEFTS);
  572. X        see(pp, RIGHT);
  573. X        break;
  574. X      case BELOW:
  575. X        see(pp, BELOW);
  576. X        see(pp, LEFTS);
  577. X        see(pp, RIGHT);
  578. X        break;
  579. X# ifdef FLY
  580. X      case FLYER:
  581. X        break;
  582. X# endif FLY
  583. X    }
  584. X    cgoto(pp, y, x);
  585. X}
  586. X
  587. Xsee(pp, face)
  588. Xregister PLAYER    *pp;
  589. Xint        face;
  590. X{
  591. X    register char    *sp;
  592. X    register int    y, x, i, cnt;
  593. X
  594. X    x = pp->p_x;
  595. X    y = pp->p_y;
  596. X
  597. X    switch (face) {
  598. X      case LEFTS:
  599. X        sp = &Maze[y][x];
  600. X        for (i = 0; See_over[*--sp]; i++)
  601. X            continue;
  602. X
  603. X        if (i == 0)
  604. X            break;
  605. X
  606. X        cnt = i;
  607. X        x = pp->p_x - 1;
  608. X        --y;
  609. X        while (i--)
  610. X            check(pp, y, --x);
  611. X        i = cnt;
  612. X        x = pp->p_x - 1;
  613. X        ++y;
  614. X        while (i--)
  615. X            check(pp, y, --x);
  616. X        i = cnt;
  617. X        x = pp->p_x - 1;
  618. X        ++y;
  619. X        while (i--)
  620. X            check(pp, y, --x);
  621. X        break;
  622. X      case RIGHT:
  623. X        sp = &Maze[y][++x];
  624. X        for (i = 0; See_over[*sp++]; i++)
  625. X            continue;
  626. X
  627. X        if (i == 0)
  628. X            break;
  629. X
  630. X        cnt = i;
  631. X        x = pp->p_x + 1;
  632. X        --y;
  633. X        while (i--)
  634. X            check(pp, y, ++x);
  635. X        i = cnt;
  636. X        x = pp->p_x + 1;
  637. X        ++y;
  638. X        while (i--)
  639. X            check(pp, y, ++x);
  640. X        i = cnt;
  641. X        x = pp->p_x + 1;
  642. X        ++y;
  643. X        while (i--)
  644. X            check(pp, y, ++x);
  645. X        break;
  646. X      case ABOVE:
  647. X        sp = &Maze[--y][x];
  648. X        if (!See_over[*sp])
  649. X            break;
  650. X        do {
  651. X            --y;
  652. X            sp -= sizeof Maze[0];
  653. X            check(pp, y, x - 1);
  654. X            check(pp, y, x    );
  655. X            check(pp, y, x + 1);
  656. X        } while (See_over[*sp]);
  657. X        break;
  658. X      case BELOW:
  659. X        sp = &Maze[++y][x];
  660. X        if (!See_over[*sp])
  661. X            break;
  662. X        do {
  663. X            y++;
  664. X            sp += sizeof Maze[0];
  665. X            check(pp, y, x - 1);
  666. X            check(pp, y, x    );
  667. X            check(pp, y, x + 1);
  668. X        } while (See_over[*sp]);
  669. X        break;
  670. X    }
  671. X}
  672. X
  673. X# else CPUHOG
  674. X
  675. Xlook(pp)
  676. Xregister PLAYER    *pp;
  677. X{
  678. X    switch (pp->p_face) {
  679. X      case LEFTS:
  680. X        lookquad2(pp, pp->p_y, pp->p_x);
  681. X        lookquad3(pp, pp->p_y, pp->p_x);
  682. X        break;
  683. X      case RIGHT:
  684. X        lookquad1(pp, pp->p_y, pp->p_x);
  685. X        lookquad4(pp, pp->p_y, pp->p_x);
  686. X        break;
  687. X      case ABOVE:
  688. X        lookquad3(pp, pp->p_y, pp->p_x);
  689. X        lookquad4(pp, pp->p_y, pp->p_x);
  690. X        break;
  691. X      case BELOW:
  692. X        lookquad1(pp, pp->p_y, pp->p_x);
  693. X        lookquad2(pp, pp->p_y, pp->p_x);
  694. X        break;
  695. X    }
  696. X    cgoto(pp, pp->p_y, pp->p_x);
  697. X}
  698. X# endif CPUHOG
  699. X
  700. Xcheck(pp, y, x)
  701. XPLAYER    *pp;
  702. Xint    y, x;
  703. X{
  704. X    register int    index;
  705. X    register int    ch;
  706. X    register PLAYER    *rpp;
  707. X
  708. X    index = y * sizeof Maze[0] + x;
  709. X    ch = ((char *) Maze)[index];
  710. X    if (ch != ((char *) pp->p_maze)[index]) {
  711. X        rpp = pp;
  712. X        cgoto(rpp, y, x);
  713. X        if (x == rpp->p_x && y == rpp->p_y)
  714. X            outch(rpp, translate(ch));
  715. X        else
  716. X            outch(rpp, ch);
  717. X        ((char *) rpp->p_maze)[index] = ch;
  718. X    }
  719. X}
  720. X
  721. X/*
  722. X * showstat
  723. X *    Update the status of players
  724. X */
  725. Xshowstat(pp)
  726. Xregister PLAYER    *pp;
  727. X{
  728. X    register PLAYER    *np;
  729. X    register int    y;
  730. X    register char    c;
  731. X
  732. X    y = STAT_PLAY_ROW + 1 + (pp - Player);
  733. X    c = stat_char(pp);
  734. X# ifdef MONITOR
  735. X    for (np = Monitor; np < End_monitor; np++) {
  736. X        cgoto(np, y, STAT_SCAN_COL);
  737. X        outch(np, c);
  738. X    }
  739. X# endif MONITOR
  740. X    for (np = Player; np < End_player; np++) {
  741. X        cgoto(np, y, STAT_SCAN_COL);
  742. X        outch(np, c);
  743. X    }
  744. X}
  745. X
  746. X/*
  747. X * drawplayer:
  748. X *    Draw the player on the screen and show him to everyone who's scanning
  749. X *    unless he is cloaked.
  750. X */
  751. Xdrawplayer(pp, draw)
  752. XPLAYER    *pp;
  753. XFLAG    draw;
  754. X{
  755. X    register PLAYER    *newp;
  756. X    register int    x, y;
  757. X
  758. X    x = pp->p_x;
  759. X    y = pp->p_y;
  760. X    Maze[y][x] = draw ? pp->p_face : pp->p_over;
  761. X
  762. X# ifdef MONITOR
  763. X    for (newp = Monitor; newp < End_monitor; newp++)
  764. X        check(newp, y, x);
  765. X# endif MONITOR
  766. X
  767. X    for (newp = Player; newp < End_player; newp++) {
  768. X        if (!draw || newp == pp) {
  769. X            check(newp, y, x);
  770. X            continue;
  771. X        }
  772. X        if (newp->p_scan == 0) {
  773. X            cgoto(newp, STAT_SCAN_ROW, STAT_VALUE_COL);
  774. X            outstr(newp, "   ", 3);
  775. X            newp->p_scan--;
  776. X            showstat(newp);
  777. X        }
  778. X        else if (newp->p_scan > 0) {
  779. X            if (pp->p_cloak < 0)
  780. X                check(newp, y, x);
  781. X            newp->p_scan--;
  782. X        }
  783. X    }
  784. X    if (!draw || pp->p_cloak < 0)
  785. X        return;
  786. X    if (pp->p_cloak-- == 0) {
  787. X        cgoto(pp, STAT_CLOAK_ROW, STAT_VALUE_COL);
  788. X        outstr(pp, "   ", 3);
  789. X        showstat(pp);
  790. X    }
  791. X}
  792. X
  793. Xmessage(pp, s)
  794. Xregister PLAYER    *pp;
  795. Xchar        *s;
  796. X{
  797. X    cgoto(pp, HEIGHT, 0);
  798. X    outstr(pp, s, strlen(s));
  799. X    ce(pp);
  800. X}
  801. X
  802. X/*
  803. X * translate:
  804. X *    Turn a charcter into the right direction character if we are
  805. X *    looking at the current player.
  806. X */
  807. Xtranslate(ch)
  808. Xchar    ch;
  809. X{
  810. X    switch (ch) {
  811. X      case LEFTS:
  812. X        return PLAYER_LEFT;
  813. X      case RIGHT:
  814. X        return PLAYER_RIGHT;
  815. X      case ABOVE:
  816. X        return PLAYER_ABOVE;
  817. X      case BELOW:
  818. X        return PLAYER_BELOW;
  819. X    }
  820. X    return ch;
  821. X}
  822. END_OF_FILE
  823. if test 8245 -ne `wc -c <'draw.c'`; then
  824.     echo shar: \"'draw.c'\" unpacked with wrong size!
  825. fi
  826. # end of 'draw.c'
  827. fi
  828. if test -f 'execute.c' -a "${1}" != "-c" ; then 
  829.   echo shar: Will not clobber existing file \"'execute.c'\"
  830. else
  831. echo shar: Extracting \"'execute.c'\" \(9279 characters\)
  832. sed "s/^X//" >'execute.c' <<'END_OF_FILE'
  833. X/*
  834. X * Copyright (c) 1985 Regents of the University of California.
  835. X * All rights reserved.
  836. X *
  837. X * Redistribution and use in source and binary forms are permitted
  838. X * provided that the above copyright notice and this paragraph are
  839. X * duplicated in all such forms and that any documentation,
  840. X * advertising materials, and other materials related to such
  841. X * distribution and use acknowledge that the software was developed
  842. X * by the University of California, Berkeley.  The name of the
  843. X * University may not be used to endorse or promote products derived
  844. X * from this software without specific prior written permission.
  845. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  846. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  847. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  848. X */
  849. X
  850. X#ifndef lint
  851. Xstatic char sccsid[] = "@(#)execute.c    5.2 (Berkeley) 6/27/88";
  852. X#endif /* not lint */
  853. X
  854. X/*
  855. X *  Hunt
  856. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  857. X *  San Francisco, California
  858. X */
  859. X
  860. X# include    "hunt.h"
  861. X
  862. X# undef CTRL
  863. X# define    CTRL(x)    ('x' & 037)
  864. X
  865. X# ifdef MONITOR
  866. X/*
  867. X * mon_execute:
  868. X *    Execute a single monitor command
  869. X */
  870. Xmon_execute(pp)
  871. Xregister PLAYER    *pp;
  872. X{
  873. X    register char    ch;
  874. X
  875. X    ch = pp->p_cbuf[pp->p_ncount++];
  876. X    switch (ch) {
  877. X      case CTRL(L):
  878. X        sendcom(pp, REDRAW);
  879. X        break;
  880. X      case 'q':
  881. X        (void) strcpy(pp->p_death, "| Quit |");
  882. X        break;
  883. X    }
  884. X}
  885. X# endif MONITOR
  886. X
  887. X/*
  888. X * execute:
  889. X *    Execute a single command
  890. X */
  891. Xexecute(pp)
  892. Xregister PLAYER    *pp;
  893. X{
  894. X    register char    ch;
  895. X
  896. X    ch = pp->p_cbuf[pp->p_ncount++];
  897. X
  898. X# ifdef    FLY
  899. X    if (pp->p_flying >= 0) {
  900. X        switch (ch) {
  901. X          case CTRL(L):
  902. X            sendcom(pp, REDRAW);
  903. X            break;
  904. X          case 'q':
  905. X            (void) strcpy(pp->p_death, "| Quit |");
  906. X            break;
  907. X        }
  908. X        return;
  909. X    }
  910. X# endif    FLY
  911. X
  912. X    switch (ch) {
  913. X      case CTRL(L):
  914. X        sendcom(pp, REDRAW);
  915. X        break;
  916. X      case 'h':
  917. X        move(pp, LEFTS);
  918. X        break;
  919. X      case 'H':
  920. X        face(pp, LEFTS);
  921. X        break;
  922. X      case 'j':
  923. X        move(pp, BELOW);
  924. X        break;
  925. X      case 'J':
  926. X        face(pp, BELOW);
  927. X        break;
  928. X      case 'k':
  929. X        move(pp, ABOVE);
  930. X        break;
  931. X      case 'K':
  932. X        face(pp, ABOVE);
  933. X        break;
  934. X      case 'l':
  935. X        move(pp, RIGHT);
  936. X        break;
  937. X      case 'L':
  938. X        face(pp, RIGHT);
  939. X        break;
  940. X      case 'f':
  941. X        fire(pp, SHOT);
  942. X        break;
  943. X      case 'g':
  944. X        fire(pp, GRENADE);
  945. X        break;
  946. X      case 'F':
  947. X        fire(pp, SATCHEL);
  948. X        break;
  949. X      case 'G':
  950. X        fire(pp, BOMB);
  951. X        break;
  952. X# ifdef    OOZE
  953. X      case 'o':
  954. X        fire_slime(pp, SLIMEREQ);
  955. X        break;
  956. X      case 'O':
  957. X        fire_slime(pp, SSLIMEREQ);
  958. X        break;
  959. X# endif    OOZE
  960. X      case 's':
  961. X        scan(pp);
  962. X        break;
  963. X      case 'c':
  964. X        cloak(pp);
  965. X        break;
  966. X      case 'q':
  967. X        (void) strcpy(pp->p_death, "| Quit |");
  968. X        break;
  969. X    }
  970. X}
  971. X
  972. X/*
  973. X * move:
  974. X *    Execute a move in the given direction
  975. X */
  976. Xmove(pp, dir)
  977. Xregister PLAYER    *pp;
  978. Xint        dir;
  979. X{
  980. X    register PLAYER    *newp;
  981. X    register int    x, y;
  982. X    register FLAG    moved;
  983. X    register BULLET    *bp;
  984. X
  985. X    y = pp->p_y;
  986. X    x = pp->p_x;
  987. X
  988. X    switch (dir) {
  989. X      case LEFTS:
  990. X        x--;
  991. X        break;
  992. X      case RIGHT:
  993. X        x++;
  994. X        break;
  995. X      case ABOVE:
  996. X        y--;
  997. X        break;
  998. X      case BELOW:
  999. X        y++;
  1000. X        break;
  1001. X    }
  1002. X
  1003. X    moved = FALSE;
  1004. X    switch (Maze[y][x]) {
  1005. X      case SPACE:
  1006. X# ifdef RANDOM
  1007. X      case DOOR:
  1008. X# endif RANDOM
  1009. X        moved = TRUE;
  1010. X        break;
  1011. X      case WALL1:
  1012. X      case WALL2:
  1013. X      case WALL3:
  1014. X# ifdef REFLECT
  1015. X      case WALL4:
  1016. X      case WALL5:
  1017. X# endif REFLECT
  1018. X        break;
  1019. X      case MINE:
  1020. X      case GMINE:
  1021. X        if (dir == pp->p_face)
  1022. X            pickup(pp, y, x, 5, Maze[y][x]);
  1023. X        else if (opposite(dir, pp->p_face))
  1024. X            pickup(pp, y, x, 95, Maze[y][x]);
  1025. X        else
  1026. X            pickup(pp, y, x, 50, Maze[y][x]);
  1027. X        Maze[y][x] = SPACE;
  1028. X        moved = TRUE;
  1029. X        break;
  1030. X      case SHOT:
  1031. X      case GRENADE:
  1032. X      case SATCHEL:
  1033. X      case BOMB:
  1034. X        bp = is_bullet(y, x);
  1035. X        if (bp != NULL)
  1036. X            bp->b_expl = TRUE;
  1037. X        Maze[y][x] = SPACE;
  1038. X        moved = TRUE;
  1039. X        break;
  1040. X      case LEFTS:
  1041. X      case RIGHT:
  1042. X      case ABOVE:
  1043. X      case BELOW:
  1044. X# ifdef FLY
  1045. X      case FLYER:
  1046. X# endif FLY
  1047. X        if (dir != pp->p_face)
  1048. X            sendcom(pp, BELL);
  1049. X        else {
  1050. X            newp = play_at(y, x);
  1051. X            checkdam(newp, pp, pp->p_ident, STABDAM, KNIFE);
  1052. X        }
  1053. X        break;
  1054. X    }
  1055. X    if (moved) {
  1056. X        if (pp->p_ncshot > 0)
  1057. X            if (--pp->p_ncshot == MAXNCSHOT) {
  1058. X                cgoto(pp, STAT_GUN_ROW, STAT_VALUE_COL);
  1059. X                outstr(pp, " ok", 3);
  1060. X            }
  1061. X        if (pp->p_undershot) {
  1062. X            fixshots(pp->p_y, pp->p_x, pp->p_over);
  1063. X            pp->p_undershot = FALSE;
  1064. X        }
  1065. X        drawplayer(pp, FALSE);
  1066. X        pp->p_over = Maze[y][x];
  1067. X        pp->p_y = y;
  1068. X        pp->p_x = x;
  1069. X        drawplayer(pp, TRUE);
  1070. X    }
  1071. X}
  1072. X
  1073. X/*
  1074. X * face:
  1075. X *    Change the direction the player is facing
  1076. X */
  1077. Xface(pp, dir)
  1078. Xregister PLAYER    *pp;
  1079. Xregister int    dir;
  1080. X{
  1081. X    if (pp->p_face != dir) {
  1082. X        pp->p_face = dir;
  1083. X        drawplayer(pp, TRUE);
  1084. X    }
  1085. X}
  1086. X
  1087. X/*
  1088. X * fire:
  1089. X *    Fire a shot of the given type in the given direction
  1090. X */
  1091. Xfire(pp, type)
  1092. Xregister PLAYER    *pp;
  1093. Xregister char    type;
  1094. X{
  1095. X    register int    req_index;
  1096. X    static int    req[4] = { BULREQ, GRENREQ, SATREQ, BOMBREQ };
  1097. X    static int    shot_type[4] = { SHOT, GRENADE, SATCHEL, BOMB };
  1098. X
  1099. X    if (pp == NULL)
  1100. X        return;
  1101. X    if (pp->p_ammo == 0) {
  1102. X        message(pp, "No more charges.");
  1103. X        return;
  1104. X    }
  1105. X    if (pp->p_ncshot > MAXNCSHOT)
  1106. X        return;
  1107. X    if (pp->p_ncshot++ == MAXNCSHOT) {
  1108. X        cgoto(pp, STAT_GUN_ROW, STAT_VALUE_COL);
  1109. X        outstr(pp, "   ", 3);
  1110. X    }
  1111. X    switch (type) {
  1112. X      case SHOT:
  1113. X        req_index = 0;
  1114. X        break;
  1115. X      case GRENADE:
  1116. X        req_index = 1;
  1117. X        break;
  1118. X      case SATCHEL:
  1119. X        req_index = 2;
  1120. X        break;
  1121. X      case BOMB:
  1122. X        req_index = 3;
  1123. X        break;
  1124. X# ifdef DEBUG
  1125. X      default:
  1126. X        message(pp, "What you do!!!");
  1127. X        return;
  1128. X# endif DEBUG
  1129. X    }
  1130. X    while (pp->p_ammo < req[req_index])
  1131. X        req_index--;
  1132. X    pp->p_ammo -= req[req_index];
  1133. X    (void) sprintf(Buf, "%3d", pp->p_ammo);
  1134. X    cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
  1135. X    outstr(pp, Buf, 3);
  1136. X
  1137. X    add_shot(shot_type[req_index], pp->p_y, pp->p_x, pp->p_face,
  1138. X        req[req_index], pp, FALSE, pp->p_face);
  1139. X    pp->p_undershot = TRUE;
  1140. X
  1141. X    /*
  1142. X     * Show the object to everyone
  1143. X     */
  1144. X    showexpl(pp->p_y, pp->p_x, shot_type[req_index]);
  1145. X    for (pp = Player; pp < End_player; pp++)
  1146. X        sendcom(pp, REFRESH);
  1147. X# ifdef MONITOR
  1148. X    for (pp = Monitor; pp < End_monitor; pp++)
  1149. X        sendcom(pp, REFRESH);
  1150. X# endif MONITOR
  1151. X}
  1152. X
  1153. X# ifdef    OOZE
  1154. X/*
  1155. X * fire_slime:
  1156. X *    Fire a slime shot in the given direction
  1157. X */
  1158. Xfire_slime(pp, req)
  1159. Xregister PLAYER    *pp;
  1160. Xregister int    req;
  1161. X{
  1162. X    if (pp == NULL)
  1163. X        return;
  1164. X    if (pp->p_ammo < req) {
  1165. X        message(pp, "Not enough charges.");
  1166. X        return;
  1167. X    }
  1168. X    if (pp->p_ncshot > MAXNCSHOT)
  1169. X        return;
  1170. X    if (pp->p_ncshot++ == MAXNCSHOT) {
  1171. X        cgoto(pp, STAT_GUN_ROW, STAT_VALUE_COL);
  1172. X        outstr(pp, "   ", 3);
  1173. X    }
  1174. X    pp->p_ammo -= req;
  1175. X    (void) sprintf(Buf, "%3d", pp->p_ammo);
  1176. X    cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
  1177. X    outstr(pp, Buf, 3);
  1178. X
  1179. X    add_shot(SLIME, pp->p_y, pp->p_x, pp->p_face, req, pp, FALSE,
  1180. X        pp->p_face);
  1181. X
  1182. X    /*
  1183. X     * Show the object to everyone
  1184. X     */
  1185. X    showexpl(pp->p_y, pp->p_x, SLIME);
  1186. X    for (pp = Player; pp < End_player; pp++)
  1187. X        sendcom(pp, REFRESH);
  1188. X# ifdef MONITOR
  1189. X    for (pp = Monitor; pp < End_monitor; pp++)
  1190. X        sendcom(pp, REFRESH);
  1191. X# endif MONITOR
  1192. X}
  1193. X# endif    OOZE
  1194. X
  1195. X/*
  1196. X * create_shot:
  1197. X *    Create a shot with the given properties
  1198. X */
  1199. Xadd_shot(type, y, x, face, charge, owner, expl, over)
  1200. Xint    type;
  1201. Xint    y, x;
  1202. Xchar    face;
  1203. Xint    charge;
  1204. XPLAYER    *owner;
  1205. Xint    expl;
  1206. Xchar    over;
  1207. X{
  1208. X    register BULLET    *bp;
  1209. X
  1210. X# ifdef CONSTANT_MOVE
  1211. X    /*
  1212. X     * if there are no bullets in flight, set up the alarm
  1213. X     */
  1214. X
  1215. X    if (Bullets == NULL)
  1216. X        bul_alarm(1);
  1217. X# endif CONSTANT_MOVE
  1218. X
  1219. X    bp = create_shot(type, y, x, face, charge, owner,
  1220. X        (owner == NULL) ? NULL : owner->p_ident, expl, over);
  1221. X    bp->b_next = Bullets;
  1222. X    Bullets = bp;
  1223. X}
  1224. X
  1225. XBULLET *
  1226. Xcreate_shot(type, y, x, face, charge, owner, score, expl, over)
  1227. Xint    type;
  1228. Xint    y, x;
  1229. Xchar    face;
  1230. Xint    charge;
  1231. XPLAYER    *owner;
  1232. XIDENT    *score;
  1233. Xint    expl;
  1234. Xchar    over;
  1235. X{
  1236. X    register BULLET    *bp;
  1237. X
  1238. X    bp = (BULLET *) malloc(sizeof (BULLET));    /* NOSTRICT */
  1239. X    if (bp == NULL) {
  1240. X        if (owner != NULL)
  1241. X            message(owner, "Out of memory");
  1242. X        return NULL;
  1243. X    }
  1244. X
  1245. X    bp->b_face = face;
  1246. X    bp->b_x = x;
  1247. X    bp->b_y = y;
  1248. X    bp->b_charge = charge;
  1249. X    bp->b_owner = owner;
  1250. X    bp->b_score = score;
  1251. X    bp->b_type = type;
  1252. X    bp->b_expl = expl;
  1253. X    bp->b_over = over;
  1254. X    bp->b_next = NULL;
  1255. X
  1256. X    return bp;
  1257. X}
  1258. X
  1259. X/*
  1260. X * cloak:
  1261. X *    Turn on or increase length of a cloak
  1262. X */
  1263. Xcloak(pp)
  1264. Xregister PLAYER    *pp;
  1265. X{
  1266. X    if (pp->p_ammo <= 0) {
  1267. X        message(pp, "No more charges");
  1268. X        return;
  1269. X    }
  1270. X    (void) sprintf(Buf, "%3d", --pp->p_ammo);
  1271. X    cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
  1272. X    outstr(pp, Buf, 3);
  1273. X
  1274. X    pp->p_cloak += CLOAKLEN;
  1275. X    cgoto(pp, STAT_CLOAK_ROW, STAT_VALUE_COL);
  1276. X    outstr(pp, " on", 3);
  1277. X
  1278. X    if (pp->p_scan >= 0) {
  1279. X        pp->p_scan = -1;
  1280. X        cgoto(pp, STAT_SCAN_ROW, STAT_VALUE_COL);
  1281. X        outstr(pp, "   ", 3);
  1282. X    }
  1283. X
  1284. X    showstat(pp);
  1285. X}
  1286. X
  1287. X/*
  1288. X * scan:
  1289. X *    Turn on or increase length of a scan
  1290. X */
  1291. Xscan(pp)
  1292. Xregister PLAYER    *pp;
  1293. X{
  1294. X    if (pp->p_ammo <= 0) {
  1295. X        message(pp, "No more charges");
  1296. X        return;
  1297. X    }
  1298. X    (void) sprintf(Buf, "%3d", --pp->p_ammo);
  1299. X    cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
  1300. X    outstr(pp, Buf, 3);
  1301. X
  1302. X    pp->p_scan += SCANLEN;
  1303. X    cgoto(pp, STAT_SCAN_ROW, STAT_VALUE_COL);
  1304. X    outstr(pp, " on", 3);
  1305. X
  1306. X    if (pp->p_cloak >= 0) {
  1307. X        pp->p_cloak = -1;
  1308. X        cgoto(pp, STAT_CLOAK_ROW, STAT_VALUE_COL);
  1309. X        outstr(pp, "   ", 3);
  1310. X    }
  1311. X
  1312. X    showstat(pp);
  1313. X}
  1314. X
  1315. X/*
  1316. X * pickup:
  1317. X *    check whether the object blew up or whether he picked it up
  1318. X */
  1319. Xpickup(pp, y, x, prob, obj)
  1320. Xregister PLAYER    *pp;
  1321. Xregister int    y, x;
  1322. Xint        prob;
  1323. Xint        obj;
  1324. X{
  1325. X    register int    req;
  1326. X
  1327. X    switch (obj) {
  1328. X      case MINE:
  1329. X        req = BULREQ;
  1330. X        break;
  1331. X      case GMINE:
  1332. X        req = GRENREQ;
  1333. X        break;
  1334. X      default:
  1335. X        abort();
  1336. X    }
  1337. X    if (rand_num(100) < prob)
  1338. X        add_shot(obj, y, x, LEFTS, req, (PLAYER *) NULL,
  1339. X            TRUE, pp->p_face);
  1340. X    else {
  1341. X        pp->p_ammo += req;
  1342. X        (void) sprintf(Buf, "%3d", pp->p_ammo);
  1343. X        cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
  1344. X        outstr(pp, Buf, 3);
  1345. X    }
  1346. X}
  1347. END_OF_FILE
  1348. if test 9279 -ne `wc -c <'execute.c'`; then
  1349.     echo shar: \"'execute.c'\" unpacked with wrong size!
  1350. fi
  1351. # end of 'execute.c'
  1352. fi
  1353. if test -f 'hunt.6' -a "${1}" != "-c" ; then 
  1354.   echo shar: Will not clobber existing file \"'hunt.6'\"
  1355. else
  1356. echo shar: Extracting \"'hunt.6'\" \(8633 characters\)
  1357. sed "s/^X//" >'hunt.6' <<'END_OF_FILE'
  1358. X.\" Copyright (c) 1985 The Regents of the University of California.
  1359. X.\" All rights reserved.
  1360. X.\"
  1361. X.\" Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  1362. X.\"
  1363. X.\" Redistribution and use in source and binary forms are permitted
  1364. X.\" provided that the above copyright notice and this paragraph are
  1365. X.\" duplicated in all such forms and that any documentation,
  1366. X.\" advertising materials, and other materials related to such
  1367. X.\" distribution and use acknowledge that the software was developed
  1368. X.\" by the University of California, Berkeley.  The name of the
  1369. X.\" University may not be used to endorse or promote products derived
  1370. X.\" from this software without specific prior written permission.
  1371. X.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1372. X.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1373. X.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1374. X.\"
  1375. X.\"    @(#)hunt.6    6.4 (Berkeley) 9/23/88
  1376. X.\"
  1377. X.TH HUNT 6 "September 23, 1988"
  1378. X.UC 6
  1379. X.SH NAME
  1380. Xhunt \- a multi-player multi-terminal game
  1381. X.SH SYNOPSIS
  1382. X\fB/usr/games/hunt\fP [-q] [\fB-m\fP] [-r [-d] ] [hostname] [\fB-l\fP name]
  1383. X.SH DESCRIPTION
  1384. XThe object of the game
  1385. X.I hunt
  1386. Xis to kill off the other players.
  1387. XThere are no rooms, no treasures, and no monsters.
  1388. XInstead, you wander around a maze, find grenades, trip mines, and shoot down
  1389. Xwalls and players.
  1390. XThe more players you kill before you die, the better your score is.
  1391. XIf the
  1392. X.B \-m
  1393. Xflag is given,
  1394. Xyou enter the game as a monitor
  1395. X(you can see the action but you cannot play).
  1396. X.PP
  1397. X.I Hunt
  1398. Xnormally looks for an active game on the local network; if none is found,
  1399. Xit starts one up on the local host.  One may specify the location of the
  1400. Xgame by giving the \fIhostname\fP argument.  The player name may be specified
  1401. Xon the command line by using the \fB-l\fP option.  This command syntax was
  1402. Xchosen for \fIrlogin/rsh\fP compatibility.
  1403. XIf the
  1404. X.B \-q
  1405. Xflag is given,
  1406. X.I hunt
  1407. Xqueries the network and reports if an active game were found.
  1408. XThis is useful for .login scripts.
  1409. X.PP
  1410. XThe
  1411. X.B \-r
  1412. Xflag makes the current player a robot.  The
  1413. X.B \-d
  1414. Xflag in conjunction with the
  1415. X.B \-r
  1416. Xflag allows the robot to play in the background, as a daemon.  This
  1417. Xis useful when you want to set up a couple of robots to play against.
  1418. X.PP
  1419. X.I Hunt
  1420. Xonly works on crt (vdt) terminals with at least 24 lines, 80 columns, and
  1421. Xcursor addressing.
  1422. XThe screen is divided in to 3 areas.
  1423. XOn the right hand side is the status area.
  1424. XIt shows you how much damage you've sustained,
  1425. Xhow many charges you have left,
  1426. Xwho's in the game,
  1427. Xwho's scanning (the asterisk in front of the name),
  1428. Xwho's cloaked (the plus sign in front of the name),
  1429. Xand other players' scores.
  1430. XMost of the rest of the screen is taken up by your map of the maze,
  1431. Xexcept for the 24th line,
  1432. Xwhich is used for longer messages that don't fit in the status area.
  1433. X.PP
  1434. X.I Hunt
  1435. Xuses the same keys to move as
  1436. X.I vi
  1437. Xdoes,
  1438. X.IR i.e. ,
  1439. X.BR h , j , k ,
  1440. Xand
  1441. X.B l
  1442. Xfor left, down, up, right respectively.
  1443. XTo change which direction you're facing in the maze,
  1444. Xuse the upper case version of the movement key (\c
  1445. X.IR i.e. ,
  1446. XHJKL).
  1447. X.TP
  1448. XOther commands are:
  1449. X.sp
  1450. X.nf
  1451. X.ta
  1452. X.ta \w'>\|<\|^\|v\ \ 'u
  1453. Xf    \- Fire (in the direction you're facing) (Takes 1 charge)
  1454. Xg    \- Throw grenade (in the direction you're facing) (Takes 9 charges)
  1455. XF    \- Throw satchel charge (Takes 25 charges)
  1456. XG    \- Throw bomb (Takes 49 charges)
  1457. Xo    \- Throw small slime bomb (Takes 15 charges)
  1458. XO    \- Throw big slime bomb (Takes 30 charges)
  1459. Xs    \- Scan (show where other players are) (Takes 1 charge)
  1460. Xc    \- Cloak (hide from scanners) (Takes 1 charge)
  1461. X
  1462. X^L    \- Redraw screen
  1463. Xq    \- Quit
  1464. X.fi
  1465. X.TP
  1466. XKnowing what the symbols on the screen often helps:
  1467. X.sp
  1468. X.nf
  1469. X.ta
  1470. X.ta \w'>\|<\|^\|v\ \ 'u
  1471. X\-\||\|+    \- walls
  1472. X/\|\\    \- diagonal (deflecting) walls
  1473. X#    \- doors (dispersion walls)
  1474. X;    \- small mine
  1475. Xg    \- large mine
  1476. X:    \- shot
  1477. Xo    \- grenade
  1478. XO    \- satchel charge
  1479. X@    \- bomb
  1480. Xs    \- small slime bomb
  1481. X$    \- big slime bomb
  1482. X>\|<\|^\|v    \- you facing right, left, up, or down
  1483. X}\|{\|i\|!    \- other players facing right, left, up, or down
  1484. X\(**    \- explosion
  1485. X.ne 3
  1486. X.cs R 24
  1487. X.cs I 24
  1488. X\fR\\|/\fP
  1489. X.cs R
  1490. X\fI\-\(**\-\fP    \- grenade and large mine explosion
  1491. X.fl
  1492. X.cs R 24
  1493. X\fR/|\\\fP
  1494. X.cs R
  1495. X.cs I
  1496. X.fi
  1497. X.TP
  1498. XSatchel and bomb explosions are larger than grenades (5x5, 7x7,
  1499. Xand 3x3 respectively).
  1500. X.LP
  1501. XOther helpful hints:
  1502. X.sp
  1503. X.ie n .ds b []
  1504. X.el .ds b \(bu
  1505. X.ta
  1506. X.ta \w'\*b\ \|'u
  1507. X.nr In \n(.i
  1508. X.de MP
  1509. X.br
  1510. X.in \n(Inu+\w'\*b\ \|'u
  1511. X.ti \n(Inu
  1512. X\*b    \c
  1513. X..
  1514. X.MP
  1515. XYou can only fire in the direction you are facing.
  1516. X.MP
  1517. XYou can only fire three shots in a row, then the gun must cool.
  1518. X.MP
  1519. XA shot only affects the square it hits.
  1520. X.MP
  1521. XShots and grenades move 5 times faster than you do.
  1522. X.MP
  1523. XTo stab someone,
  1524. Xyou must face that player and move at them.
  1525. X.MP
  1526. XStabbing does 2 points worth of damage and shooting does 5 points.
  1527. X.MP
  1528. XSlime does 5 points of damage each time it hits.
  1529. X.MP
  1530. XYou start with 15 charges and get 5 more for every new player.
  1531. X.MP
  1532. XA grenade affects the nine squares centered about the square it hits.
  1533. X.MP
  1534. XA satchel affects the twenty-five squares centered about the square it hits.
  1535. X.MP
  1536. XA bomb affects the forty-nine squares centered about the square it hits.
  1537. X.MP
  1538. XSlime affects all squares it oozes over (15 or 30 respectively).
  1539. X.MP
  1540. XOne small mine and one large mine is placed in the maze for every new player.
  1541. XA mine has a 5% probability of tripping when you walk directly at it;
  1542. X50% when going sideways on to it;
  1543. X95% when backing up on to it.
  1544. XTripping a mine costs you 5 points or 10 points respectively.
  1545. XDefusing a mine is worth 1 charge or 9 charges respectively.
  1546. X.MP
  1547. XYou cannot see behind you.
  1548. X.MP
  1549. XScanning lasts for (20 times the number of players) turns.
  1550. XScanning takes 1 ammo charge,
  1551. Xso don't waste all your charges scanning.
  1552. X.MP
  1553. XCloaking lasts for 20 turns.
  1554. X.MP
  1555. XWhenever you kill someone,
  1556. Xyou get 2 more damage capacity points and 2 damage points taken away.
  1557. X.MP
  1558. XMaximum typeahead is 5 characters.
  1559. X.MP
  1560. XA shot destroys normal (\c
  1561. X.IR i.e., 
  1562. Xnon-diagonal, non-door) walls.
  1563. X.MP
  1564. XDiagonal walls deflect shots and change orientation.
  1565. X.MP
  1566. XDoors disperse shots in random directions (up, down, left, right).
  1567. X.MP
  1568. XDiagonal walls and doors cannot be destroyed by direct shots but may
  1569. Xbe destroyed by an adjacent grenade explosion.
  1570. X.MP
  1571. XSlime goes around walls, not through them.
  1572. X.MP
  1573. XWalls regenerate, reappearing in the order they were destroyed.
  1574. XOne percent of the regenerated walls will be diagonal walls or doors.
  1575. XWhen a wall is generated directly beneath a player, he is thrown in
  1576. Xa random direction for a random period of time.  When he lands, he
  1577. Xsustains damage (up to 20 percent of the amount of damage he had before
  1578. Ximpact); that is, the less damage he had, the more nimble he is and
  1579. Xtherefore less likely to hurt himself on landing.
  1580. X\".MP
  1581. X\"There is a volcano close to the center of the maze which goes off
  1582. X\"close to every 100 deaths.
  1583. X.MP
  1584. XThe environment variable
  1585. X.B HUNT
  1586. Xis checked to get the player name.
  1587. XIf you don't have this variable set,
  1588. X.I hunt
  1589. Xwill ask you what name you want to play under.
  1590. XIf it is set,
  1591. Xyou may also set up a single character keyboard map, but then you have to
  1592. Xenumerate the options:
  1593. X.br
  1594. X.ti +1i
  1595. X\fIe.g.\fP setenv HUNT ``name=Sneaky,mapkey=zoFfGg1f2g3F4G''
  1596. X.br
  1597. Xsets the player name to Sneaky,
  1598. Xand the maps \fBz\fP to \fBo\fP, \fBF\fP to \fBf\fP, \fBG\fP to \fBg\fP,
  1599. X\fB1\fP to \fBf\fP,
  1600. X\fB2\fP to \fBg\fP, \fB3\fP to \fBF\fP, and \fB4\fP to \fBG\fP.
  1601. XThe \fImapkey\fP option must be last.
  1602. X.MP
  1603. XIt's a boring game if you're the only one playing.
  1604. X.PP
  1605. XYour score is the ratio of number of kills to number
  1606. Xof times you entered the game and is only kept for the duration
  1607. Xof a single session of \fIhunt\fP.
  1608. X.PP
  1609. X.I Hunt
  1610. Xnormally drives up the load average to be about
  1611. X(number_of_players + 0.5) greater than it would be without a
  1612. X.I hunt 
  1613. Xgame executing.  A limit of three players per host and nine players
  1614. Xtotal is enforced by \fIhunt\fP.
  1615. X.SH FILES
  1616. X.nf
  1617. X.ta
  1618. X.ta \w'/usr/games/lib/hunt.driver\ \ \ 'u
  1619. X/usr/games/lib/hunt.driver    game coordinator
  1620. X.DT
  1621. X.fi
  1622. X.SH AUTHORS
  1623. XConrad Huang,
  1624. XKen Arnold,
  1625. Xand Greg Couch,
  1626. XUniversity of California, San Francisco, Computer Graphics Lab.
  1627. X.PP
  1628. XRobot written by Steve Boswell, University of California, San Diego.
  1629. X.SH ACKNOWLEDGEMENTS
  1630. XWe thank Don Kneller,
  1631. XJohn Thomason, Eric Pettersen,
  1632. Xand Scott Weiner for providing
  1633. Xendless hours of play-testing to improve the character of the game.
  1634. XWe hope their significant others will forgive them;
  1635. Xwe certainly don't.
  1636. X.PP
  1637. XSteve would like to thank Jimmy Lang for providing skilled competition
  1638. Xfor the robot during its development, and for all the feedback.
  1639. X.SH BUGS
  1640. XTo keep up the pace, not everything is as realistic as possible.
  1641. X.PP
  1642. XThe robot sometimes gets into steady states.
  1643. END_OF_FILE
  1644. if test 8633 -ne `wc -c <'hunt.6'`; then
  1645.     echo shar: \"'hunt.6'\" unpacked with wrong size!
  1646. fi
  1647. # end of 'hunt.6'
  1648. fi
  1649. if test -f 'hunt.h' -a "${1}" != "-c" ; then 
  1650.   echo shar: Will not clobber existing file \"'hunt.h'\"
  1651. else
  1652. echo shar: Extracting \"'hunt.h'\" \(6817 characters\)
  1653. sed "s/^X//" >'hunt.h' <<'END_OF_FILE'
  1654. X/*
  1655. X * Copyright (c) 1985 Regents of the University of California.
  1656. X * All rights reserved.
  1657. X *
  1658. X * Redistribution and use in source and binary forms are permitted
  1659. X * provided that the above copyright notice and this paragraph are
  1660. X * duplicated in all such forms and that any documentation,
  1661. X * advertising materials, and other materials related to such
  1662. X * distribution and use acknowledge that the software was developed
  1663. X * by the University of California, Berkeley.  The name of the
  1664. X * University may not be used to endorse or promote products derived
  1665. X * from this software without specific prior written permission.
  1666. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1667. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1668. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1669. X *
  1670. X *    @(#)hunt.h    5.2 (Berkeley) 6/27/88
  1671. X */
  1672. X
  1673. X/*
  1674. X *  Hunt
  1675. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  1676. X *  San Francisco, California
  1677. X */
  1678. X
  1679. X# ifndef _H_hunt
  1680. X# define _H_hunt
  1681. X
  1682. X# include    <stdio.h>
  1683. X# ifndef OLDIPC
  1684. X# include    <sgtty.h>
  1685. X# include    <sys/types.h>
  1686. X# include    <sys/uio.h>
  1687. X# else OLDIPC
  1688. X# include    <sys/localopts.h>
  1689. X# include    <sys/types.h>
  1690. X# include    <sys/netltoshort.h>
  1691. X# endif OLDIPC
  1692. X# include    <sys/socket.h>
  1693. X# ifdef    INTERNET
  1694. X# include    <netinet/in.h>
  1695. X# include    <netdb.h>
  1696. X# ifndef OLDIPC
  1697. X# include    <arpa/inet.h>
  1698. X# endif !OLDIPC
  1699. X# ifdef BROADCAST
  1700. X# include    <net/if.h>
  1701. X# endif BROADCAST
  1702. X# else    INTERNET
  1703. X# include    <sys/un.h>
  1704. X# endif    INTERNET
  1705. X
  1706. X# ifdef    INTERNET
  1707. X# define    SOCK_FAMILY    AF_INET
  1708. X# else    INTERNET
  1709. X# define    SOCK_FAMILY    AF_UNIX
  1710. X# define    AF_UNIX_HACK        /* 4.2 hack; leaves files around */
  1711. X# endif    INTERNET
  1712. X
  1713. X# define    ADDCH        ('a' | 0200)
  1714. X# define    MOVE        ('m' | 0200)
  1715. X# define    REFRESH        ('r' | 0200)
  1716. X# define    CLRTOEOL    ('c' | 0200)
  1717. X# define    ENDWIN        ('e' | 0200)
  1718. X# define    CLEAR        ('C' | 0200)
  1719. X# define    REDRAW        ('R' | 0200)
  1720. X# define    LAST_PLAYER    ('l' | 0200)
  1721. X# define    BELL        ('b' | 0200)
  1722. X# define    READY        ('g' | 0200)
  1723. X
  1724. X/*
  1725. X * Choose MAXPL and MAXMON carefully.  The screen is assumed to be
  1726. X * 23 lines high and will only tolerate (MAXPL == 12 && MAXMON == 0)
  1727. X * or (MAXPL + MAXMON <= 10).
  1728. X */
  1729. X# define    MAXPL        9
  1730. X# ifdef MONITOR
  1731. X# define    MAXMON        1
  1732. X# endif MONITOR
  1733. X# define    NAMELEN        20
  1734. X# define    MSGLEN        80
  1735. X# define    DECAY        50.0
  1736. X
  1737. X# define    NASCII        128
  1738. X
  1739. X# ifndef REFLECT
  1740. X# ifndef RANDOM
  1741. X# define RANDOM
  1742. X# endif RANDOM
  1743. X# endif REFLECT
  1744. X
  1745. X# define    WIDTH    59
  1746. X# define    WIDTH2    64    /* Next power of 2 >= WIDTH (for fast access) */
  1747. X# define    HEIGHT    23
  1748. X# define    UBOUND    1
  1749. X# define    DBOUND    22
  1750. X# define    LBOUND    1
  1751. X# define    RBOUND    (WIDTH - 1)
  1752. X
  1753. X# define    STAT_LABEL_COL    60
  1754. X# define    STAT_VALUE_COL    74
  1755. X# define    STAT_NAME_COL    61
  1756. X# define    STAT_SCAN_COL    (STAT_NAME_COL + 5)
  1757. X# define    STAT_NAME_ROW    0
  1758. X# define    STAT_AMMO_ROW    2
  1759. X# define    STAT_SCAN_ROW    3
  1760. X# define    STAT_CLOAK_ROW    4
  1761. X# define    STAT_GUN_ROW    5
  1762. X# define    STAT_DAM_ROW    7
  1763. X# define    STAT_KILL_ROW    8
  1764. X# define    STAT_PLAY_ROW    10
  1765. X# ifdef MONITOR
  1766. X# define    STAT_MON_ROW    (STAT_PLAY_ROW + MAXPL + 1)
  1767. X# endif MONITOR
  1768. X# define    STAT_NAME_LEN    16
  1769. X
  1770. X# define    DOOR    '#'
  1771. X# define    WALL1    '-'
  1772. X# define    WALL2    '|'
  1773. X# define    WALL3    '+'
  1774. X# ifdef REFLECT
  1775. X# define    WALL4    '/'
  1776. X# define    WALL5    '\\'
  1777. X# endif REFLECT
  1778. X# define    KNIFE    'K'
  1779. X# define    SHOT    ':'
  1780. X# define    GRENADE    'o'
  1781. X# define    SATCHEL    'O'
  1782. X# define    BOMB    '@'
  1783. X# define    MINE    ';'
  1784. X# define    GMINE    'g'
  1785. X# ifdef    OOZE
  1786. X# define    SLIME    '$'
  1787. X# endif    OOZE
  1788. X# ifdef    VOLCANO
  1789. X# define    LAVA    '~'
  1790. X# endif    VOLCANO
  1791. X# ifdef FLY
  1792. X# define    FALL    'F'
  1793. X# endif FLY
  1794. X# define    SPACE    ' '
  1795. X
  1796. X# define    ABOVE    'i'
  1797. X# define    BELOW    '!'
  1798. X# define    RIGHT    '}'
  1799. X# define    LEFTS    '{'
  1800. X# ifdef FLY
  1801. X# define    FLYER    '&'
  1802. X# endif FLY
  1803. X
  1804. X# define    PLAYER_ABOVE    '^'
  1805. X# define    PLAYER_BELOW    'v'
  1806. X# define    PLAYER_RIGHT    '>'
  1807. X# define    PLAYER_LEFT        '<'
  1808. X
  1809. X# define    NORTH    01
  1810. X# define    SOUTH    02
  1811. X# define    EAST    010
  1812. X# define    WEST    020
  1813. X
  1814. X# ifndef TRUE
  1815. X# define    TRUE    1
  1816. X# define    FALSE    0
  1817. X# endif TRUE
  1818. X# ifndef CTRL
  1819. X# define    CTRL(x)    ('x' & 037)
  1820. X# endif CTRL
  1821. X
  1822. X# define    BULSPD        5        /* bullets movement speed */
  1823. X# define    ISHOTS        15
  1824. X# define    NSHOTS        5
  1825. X# define    MAXNCSHOT    2
  1826. X# define    MAXDAM        10
  1827. X# define    MINDAM        5
  1828. X# define    STABDAM        2
  1829. X
  1830. X# define    BULREQ        1
  1831. X# define    GRENREQ        9
  1832. X# define    SATREQ        25
  1833. X# define    BOMBREQ        49
  1834. X# ifdef    OOZE
  1835. X# define    SLIMEREQ    15
  1836. X# define    SSLIMEREQ    30
  1837. X# define    SLIMESPEED    5
  1838. X# endif    OOZE
  1839. X# ifdef    VOLCANO
  1840. X# define    LAVASPEED    2
  1841. X# endif VOLCANO
  1842. X
  1843. X# define    CLOAKLEN    20
  1844. X# define    SCANLEN        (Nplayer * 20)
  1845. X# define    EXPLEN        4
  1846. X
  1847. X# ifdef FLY
  1848. X# define    _cloak_char(pp)    (((pp)->p_cloak < 0) ? ' ' : '+')
  1849. X# define    _scan_char(pp)    (((pp)->p_scan < 0) ? _cloak_char(pp) : '*')
  1850. X# define    stat_char(pp)    (((pp)->p_flying < 0) ? _scan_char(pp) : FLYER)
  1851. X# else FLY
  1852. X# define    _cloak_char(pp)    (((pp)->p_cloak < 0) ? ' ' : '+')
  1853. X# define    stat_char(pp)    (((pp)->p_scan < 0) ? _cloak_char(pp) : '*')
  1854. X# endif FLY
  1855. X
  1856. Xtypedef int            FLAG;
  1857. Xtypedef struct bullet_def    BULLET;
  1858. Xtypedef struct expl_def        EXPL;
  1859. Xtypedef struct player_def    PLAYER;
  1860. Xtypedef struct ident_def    IDENT;
  1861. Xtypedef struct regen_def    REGEN;
  1862. X# ifdef    INTERNET
  1863. Xtypedef struct sockaddr_in    SOCKET;
  1864. X# else    INTERNET
  1865. Xtypedef struct sockaddr_un    SOCKET;
  1866. X# endif    INTERNET
  1867. Xtypedef struct sgttyb        TTYB;
  1868. X
  1869. Xstruct ident_def {
  1870. X    char    i_name[NAMELEN];
  1871. X    long    i_machine;
  1872. X    long    i_uid;
  1873. X    int    i_kills;
  1874. X    int    i_entries;
  1875. X    float    i_score;
  1876. X    IDENT    *i_next;
  1877. X};
  1878. X
  1879. Xstruct player_def {
  1880. X    IDENT    *p_ident;
  1881. X    int    p_face;
  1882. X    char    p_over;
  1883. X    int    p_undershot;
  1884. X# ifdef    FLY
  1885. X    int    p_flying;
  1886. X    int    p_flyx, p_flyy;
  1887. X# endif FLY
  1888. X    FILE    *p_output;
  1889. X    int    p_fd;
  1890. X    int    p_mask;
  1891. X    int    p_damage;
  1892. X    int    p_damcap;
  1893. X    int    p_ammo;
  1894. X    int    p_ncshot;
  1895. X    int    p_scan;
  1896. X    int    p_cloak;
  1897. X    int    p_x, p_y;
  1898. X    int    p_ncount;
  1899. X    int    p_nexec;
  1900. X    long    p_nchar;
  1901. X    char    p_death[MSGLEN];
  1902. X    char    p_maze[HEIGHT][WIDTH2];
  1903. X    int    p_curx, p_cury;
  1904. X    int    p_lastx, p_lasty;
  1905. X    int    p_changed;
  1906. X    char    p_cbuf[BUFSIZ];
  1907. X};
  1908. X
  1909. Xstruct bullet_def {
  1910. X    int    b_x, b_y;
  1911. X    int    b_face;
  1912. X    int    b_charge;
  1913. X    char    b_type;
  1914. X    char    b_over;
  1915. X    PLAYER    *b_owner;
  1916. X    IDENT    *b_score;
  1917. X    FLAG    b_expl;
  1918. X    BULLET    *b_next;
  1919. X};
  1920. X
  1921. Xstruct expl_def {
  1922. X    int    e_x, e_y;
  1923. X    char    e_char;
  1924. X    EXPL    *e_next;
  1925. X};
  1926. X
  1927. Xstruct regen_def {
  1928. X    int    r_x, r_y;
  1929. X    REGEN    *r_next;
  1930. X};
  1931. X
  1932. X/*
  1933. X * external variables
  1934. X */
  1935. X
  1936. Xextern FLAG    Last_player;
  1937. X
  1938. Xextern char    Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
  1939. X
  1940. Xextern char    *Sock_name, *Driver;
  1941. X
  1942. Xextern int    errno, Have_inp, Nplayer, Num_fds, Socket;
  1943. Xextern long    Fds_mask, Sock_mask;
  1944. X
  1945. X# ifdef INTERNET
  1946. Xextern int    Test_port;
  1947. Xextern int    Sock_port;
  1948. X# else INTERNET
  1949. Xextern char    *Sock_name;
  1950. X# endif INTERNET
  1951. X
  1952. X# ifdef VOLCANO
  1953. Xextern int    volcano;
  1954. X# endif    VOLCANO
  1955. X
  1956. Xextern int    See_over[NASCII];
  1957. X
  1958. Xextern BULLET    *Bullets;
  1959. X
  1960. Xextern EXPL    *Expl[EXPLEN];
  1961. X
  1962. Xextern IDENT    *Scores;
  1963. X
  1964. Xextern PLAYER    Player[MAXPL], *End_player;
  1965. X
  1966. X# ifdef MONITOR
  1967. Xextern FLAG    Am_monitor;
  1968. Xextern PLAYER    Monitor[MAXMON], *End_monitor;
  1969. X# endif MONITOR
  1970. X
  1971. X/*
  1972. X * function types
  1973. X */
  1974. X
  1975. Xchar    *getenv(), *malloc(), *strcpy(), *strncpy();
  1976. X
  1977. XIDENT    *get_ident();
  1978. X
  1979. Xint    moveshots();
  1980. X
  1981. XBULLET    *is_bullet(), *create_shot();
  1982. X
  1983. XPLAYER    *play_at();
  1984. X
  1985. X#ifdef DAEMON
  1986. X#define COLS 80
  1987. X#define LINES 24
  1988. X#endif DAEMON
  1989. X
  1990. X# endif _H_hunt
  1991. END_OF_FILE
  1992. if test 6817 -ne `wc -c <'hunt.h'`; then
  1993.     echo shar: \"'hunt.h'\" unpacked with wrong size!
  1994. fi
  1995. # end of 'hunt.h'
  1996. fi
  1997. if test -f 'playit.c' -a "${1}" != "-c" ; then 
  1998.   echo shar: Will not clobber existing file \"'playit.c'\"
  1999. else
  2000. echo shar: Extracting \"'playit.c'\" \(8542 characters\)
  2001. sed "s/^X//" >'playit.c' <<'END_OF_FILE'
  2002. X/*
  2003. X * Copyright (c) 1985 Regents of the University of California.
  2004. X * All rights reserved.
  2005. X *
  2006. X * Redistribution and use in source and binary forms are permitted
  2007. X * provided that the above copyright notice and this paragraph are
  2008. X * duplicated in all such forms and that any documentation,
  2009. X * advertising materials, and other materials related to such
  2010. X * distribution and use acknowledge that the software was developed
  2011. X * by the University of California, Berkeley.  The name of the
  2012. X * University may not be used to endorse or promote products derived
  2013. X * from this software without specific prior written permission.
  2014. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  2015. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  2016. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  2017. X */
  2018. X
  2019. X#ifndef lint
  2020. Xstatic char sccsid[] = "@(#)playit.c    5.3 (Berkeley) 6/27/88";
  2021. X#endif /* not lint */
  2022. X
  2023. X/*
  2024. X *  Hunt
  2025. X *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  2026. X *  San Francisco, California
  2027. X */
  2028. X
  2029. X# include    <curses.h>
  2030. X# include    <ctype.h>
  2031. X# include    <signal.h>
  2032. X# include    <errno.h>
  2033. X# include    "hunt.h"
  2034. X# include    <sys/file.h>
  2035. X# include    <sys/time.h>
  2036. X# include    "player.h"
  2037. X
  2038. X
  2039. X#ifdef ROBOT
  2040. Xextern int daemon_player, robot_player;
  2041. X#endif ROBOT
  2042. X
  2043. Xint        input();
  2044. Xstatic int    nchar_send;
  2045. Xstatic int    in    = FREAD;
  2046. Xchar        screen[24][80], blanks[80];
  2047. Xint        cur_row, cur_col;
  2048. XFILE *inf;
  2049. X# ifdef OTTO
  2050. Xint        Otto_count;
  2051. Xint        Otto_mode;
  2052. Xstatic int    otto_y, otto_x;
  2053. Xstatic char    otto_face;
  2054. X# endif OTTO
  2055. X
  2056. X# define    MAX_SEND    5
  2057. X
  2058. X/*
  2059. X * ibuf is the input buffer used for the stream from the driver.
  2060. X * It is small because we do not check for user input when there
  2061. X * are characters in the input buffer.
  2062. X */
  2063. Xchar ibuf[20];
  2064. X
  2065. Xextern int        _putchar();
  2066. X
  2067. X/*
  2068. X * setup_to_play:
  2069. X *    Do final setup, so a human or robot can play.
  2070. X */
  2071. Xvoid
  2072. Xsetup_to_play()
  2073. X{
  2074. X    extern int        Master_pid;
  2075. X    extern int        errno;
  2076. X
  2077. X    errno = 0;
  2078. X    while ((inf = fdopen(Socket, "r")) == NULL)
  2079. X        if (errno == EINTR)
  2080. X            errno = 0;
  2081. X        else {
  2082. X            perror("fdopen of socket");
  2083. X            exit(1);
  2084. X        }
  2085. X    setbuffer(inf, ibuf, sizeof ibuf);
  2086. X    Master_pid = getw(inf);
  2087. X    if (Master_pid == 0 || Master_pid == EOF) {
  2088. X        bad_con();
  2089. X        /* NOTREACHED */
  2090. X    }
  2091. X}
  2092. X
  2093. X/*
  2094. X * playit:
  2095. X *    Play a given game, handling all the curses commands from
  2096. X *    the driver.
  2097. X */
  2098. Xplayit()
  2099. X{
  2100. X    register int        ch;
  2101. X    register unsigned int    y, x;
  2102. X
  2103. X# ifdef OTTO
  2104. X    Otto_count = 0;
  2105. X# endif OTTO
  2106. X    nchar_send = MAX_SEND;
  2107. X    while ((ch = GETCHR(inf)) != EOF) {
  2108. X# ifdef DEBUG
  2109. X        fputc(ch, stderr);
  2110. X# endif DEBUG
  2111. X        switch (ch & 0377) {
  2112. X          case MOVE:
  2113. X            y = GETCHR(inf);
  2114. X            x = GETCHR(inf);
  2115. X            if (!daemon_player)
  2116. X            {
  2117. X                mvcur(cur_row, cur_col, y, x);
  2118. X            }
  2119. X            cur_row = y;
  2120. X            cur_col = x;
  2121. X            break;
  2122. X          case ADDCH:
  2123. X            ch = GETCHR(inf);
  2124. X# ifdef OTTO
  2125. X            switch (ch) {
  2126. X
  2127. X            case '<':
  2128. X            case '>':
  2129. X            case '^':
  2130. X            case 'v':
  2131. X                otto_face = ch;
  2132. X                getyx(stdscr, otto_y, otto_x);
  2133. X                break;
  2134. X            }
  2135. X# endif OTTO
  2136. X            put_ch(ch);
  2137. X            break;
  2138. X          case CLRTOEOL:
  2139. X            clear_eol();
  2140. X            break;
  2141. X          case CLEAR:
  2142. X            clear_screen();
  2143. X            break;
  2144. X          case REFRESH:
  2145. X            fflush(stdout);
  2146. X            break;
  2147. X          case REDRAW:
  2148. X            redraw_screen();
  2149. X            fflush(stdout);
  2150. X            break;
  2151. X          case ENDWIN:
  2152. X            fflush(stdout);
  2153. X            if ((ch = GETCHR(inf)) == LAST_PLAYER)
  2154. X                Last_player = TRUE;
  2155. X            ch = EOF;
  2156. X            goto out;
  2157. X          case BELL:
  2158. X            if (!daemon_player)
  2159. X            {
  2160. X                putchar(CTRL(G));
  2161. X            }
  2162. X            break;
  2163. X
  2164. X          case READY:
  2165. X            (void) fflush(stdout);
  2166. X            if (nchar_send < 0)
  2167. X                (void) ioctl(fileno(stdin), TIOCFLUSH, &in);
  2168. X            nchar_send = MAX_SEND;
  2169. X# ifndef OTTO
  2170. X            (void) GETCHR(inf);
  2171. X# else OTTO
  2172. X            Otto_count -= (GETCHR(inf) & 255);
  2173. X            if (!Am_monitor) {
  2174. X# ifdef DEBUG
  2175. X                fputc('0' + Otto_count, stderr);
  2176. X# endif DEBUG
  2177. X                if (Otto_count == 0 && Otto_mode)
  2178. X                    otto(otto_y, otto_x, otto_face);
  2179. X            }
  2180. X# endif OTTO
  2181. X            break;
  2182. X          default:
  2183. X# ifdef OTTO
  2184. X            switch (ch) {
  2185. X
  2186. X            case '<':
  2187. X            case '>':
  2188. X            case '^':
  2189. X            case 'v':
  2190. X                otto_face = ch;
  2191. X                getyx(stdscr, otto_y, otto_x);
  2192. X                break;
  2193. X            }
  2194. X# endif OTTO
  2195. X            put_ch(ch);
  2196. X            break;
  2197. X        }
  2198. X    }
  2199. Xout:
  2200. X    (void) fclose(inf);
  2201. X}
  2202. X
  2203. X/*
  2204. X * getchr:
  2205. X *    Grab input and pass it along to the driver
  2206. X *    Return any characters from the driver
  2207. X *    When this routine is called by GETCHR, we already know there are
  2208. X *    no characters in the input buffer.
  2209. X */
  2210. Xgetchr(fd)
  2211. Xregister FILE    *fd;
  2212. X{
  2213. X    long    nchar;
  2214. X    long    readfds, s_readfds;
  2215. X    int    driver_mask, stdin_mask;
  2216. X    int    nfds, s_nfds;
  2217. X    extern int    errno;
  2218. X
  2219. X    driver_mask = 1L << fileno(fd);
  2220. X    stdin_mask = 1L << fileno(stdin);
  2221. X    s_readfds = driver_mask;
  2222. X    if (!robot_player)
  2223. X        s_readfds |= stdin_mask;
  2224. X    s_nfds = (robot_player && driver_mask < stdin_mask)
  2225. X        ? fileno(stdin) : fileno(fd);
  2226. X    s_nfds++;
  2227. X
  2228. Xone_more_time:
  2229. X    do {
  2230. X        errno = 0;
  2231. X        readfds = s_readfds;
  2232. X        nfds = s_nfds;
  2233. X# ifndef OLDIPC
  2234. X        nfds = select(nfds, &readfds, NULL, NULL, NULL);
  2235. X# else OLDIPC
  2236. X        nfds = select(nfds, &readfds, (int *) NULL, 32767);
  2237. X# endif OLDIPC
  2238. X    } while (nfds <= 0 && errno == EINTR && !robot_player);
  2239. X
  2240. X    if (!robot_player && !daemon_player)
  2241. X    {
  2242. X        if (readfds & stdin_mask)
  2243. X            send_stuff();
  2244. X    }
  2245. X    if ((readfds & driver_mask) == 0)
  2246. X    {
  2247. X        if (robot_player)
  2248. X            return READY;
  2249. X        else
  2250. X            goto one_more_time;
  2251. X    }
  2252. X    return _filbuf(fd);
  2253. X}
  2254. X
  2255. X/*
  2256. X * send_stuff:
  2257. X *    Send standard input characters to the driver
  2258. X */
  2259. Xsend_stuff()
  2260. X{
  2261. X    register int    count;
  2262. X    register char    *sp, *nsp;
  2263. X    static char    inp[sizeof Buf];
  2264. X    extern char    map_key[256];
  2265. X
  2266. X    count = read(fileno(stdin), Buf, sizeof Buf);
  2267. X    if (count <= 0)
  2268. X        return;
  2269. X    if (nchar_send <= 0) {
  2270. X        (void) write(1, "\7", 1);
  2271. X        return;
  2272. X    }
  2273. X
  2274. X    /*
  2275. X     * look for 'q'uit commands; if we find one,
  2276. X     * confirm it.  If it is not confirmed, strip
  2277. X     * it out of the input
  2278. X     */
  2279. X    Buf[count] = '\0';
  2280. X    nsp = inp;
  2281. X    for (sp = Buf; *sp != '\0'; sp++)
  2282. X        if ((*nsp = map_key[*sp]) == 'q')
  2283. X            intr();
  2284. X# ifdef OTTO
  2285. X        else if (*nsp == CTRL(O))
  2286. X            Otto_mode = !Otto_mode;
  2287. X# endif OTTO
  2288. X        else
  2289. X            nsp++;
  2290. X    count = nsp - inp;
  2291. X    if (count) {
  2292. X# ifdef OTTO
  2293. X        Otto_count += count;
  2294. X# endif OTTO
  2295. X        nchar_send -= count;
  2296. X        if (nchar_send < 0)
  2297. X            count += nchar_send;
  2298. X        (void) write(Socket, inp, count);
  2299. X    }
  2300. X}
  2301. X
  2302. X/*
  2303. X * quit:
  2304. X *    Handle the end of the game when the player dies
  2305. X */
  2306. Xquit()
  2307. X{
  2308. X    register int    explain, ch;
  2309. X
  2310. X    if (Last_player)
  2311. X        return TRUE;
  2312. X# ifdef OTTO
  2313. X    if (Otto_mode)
  2314. X        return FALSE;
  2315. X# endif OTTO
  2316. X    if (!daemon_player)
  2317. X    {
  2318. X        mvcur(cur_row, cur_col, HEIGHT, 0);
  2319. X    }
  2320. X    cur_row = HEIGHT;
  2321. X    cur_col = 0;
  2322. X    put_str("Re-enter game? ");
  2323. X    clear_eol();
  2324. X    fflush(stdout);
  2325. X    explain = FALSE;
  2326. X    for (;;) {
  2327. X        if (isupper(ch = getchar()))
  2328. X            ch = tolower(ch);
  2329. X        if (ch == 'y') {
  2330. X            sleep(2);
  2331. X            return FALSE;
  2332. X        }
  2333. X        else if (ch == 'n')
  2334. X            return TRUE;
  2335. X        (void) putchar(CTRL(G));
  2336. X        if (!explain) {
  2337. X            put_str("(Y or N) ");
  2338. X            explain = TRUE;
  2339. X        }
  2340. X        fflush(stdout);
  2341. X    }
  2342. X}
  2343. X
  2344. Xput_ch(ch)
  2345. X    char    ch;
  2346. X{
  2347. X    if (!isprint(ch)) {
  2348. X# ifdef DEBUG
  2349. X        fprintf(stderr, "r,c,ch: %d,%d,%d", cur_row, cur_col, ch);
  2350. X# endif DEBUG
  2351. X        return;
  2352. X    }
  2353. X    screen[cur_row][cur_col] = ch;
  2354. X    if (!daemon_player)
  2355. X    {
  2356. X        putchar(ch);
  2357. X    }
  2358. X    if (++cur_col >= COLS) {
  2359. X    if (!daemon_player)
  2360. X    {
  2361. X        if (!AM || XN)
  2362. X            putchar('\n');
  2363. X    }
  2364. X        cur_col = 0;
  2365. X        if (++cur_row >= LINES)
  2366. X            cur_row = LINES;
  2367. X    }
  2368. X}
  2369. X
  2370. Xput_str(s)
  2371. X    char    *s;
  2372. X{
  2373. X    while (*s)
  2374. X        put_ch(*s++);
  2375. X}
  2376. X
  2377. Xclear_screen()
  2378. X{
  2379. X    register int    i;
  2380. X
  2381. X    if (blanks[0] == '\0')
  2382. X        for (i = 0; i < 80; i++)
  2383. X            blanks[i] = ' ';
  2384. X
  2385. X    if (!daemon_player && CL != NULL)
  2386. X        tputs(CL, LINES, _putchar);
  2387. X    if (daemon_player || CL != NULL) {
  2388. X        for (i = 0; i < 24; i++)
  2389. X            bcopy(blanks, screen[i], 80);
  2390. X    }
  2391. X    if (!daemon_player && CL != NULL) {
  2392. X        for (i = 0; i < 24; i++) {
  2393. X            mvcur(cur_row, cur_col, 0, 0);
  2394. X            cur_row = i;
  2395. X            cur_col = 0;
  2396. X            clear_eol();
  2397. X        }
  2398. X        mvcur(cur_row, cur_col, 0, 0);
  2399. X    }
  2400. X    cur_row = cur_col = 0;
  2401. X}
  2402. X
  2403. Xclear_eol()
  2404. X{
  2405. X    if (!daemon_player)
  2406. X    {
  2407. X        if (CE != NULL)
  2408. X            tputs(CE, 1, _putchar);
  2409. X        else {
  2410. X            fwrite(blanks, sizeof (char), 80 - cur_col, stdout);
  2411. X            if (COLS != 80)
  2412. X                mvcur(cur_row, 80, cur_row, cur_col);
  2413. X            else if (AM)
  2414. X                mvcur(cur_row + 1, 0, cur_row, cur_col);
  2415. X            else
  2416. X                mvcur(cur_row, 79, cur_row, cur_col);
  2417. X        }
  2418. X    }
  2419. X
  2420. X    bcopy(blanks, &screen[cur_row][cur_col], 80 - cur_col);
  2421. X}
  2422. X
  2423. Xredraw_screen()
  2424. X{
  2425. X    if (!daemon_player)
  2426. X    {
  2427. X        register int    i;
  2428. X        static int    first = 1;
  2429. X
  2430. X        if (first) {
  2431. X            if ((curscr = newwin(24, 80, 0, 0)) == NULL) {
  2432. X                fprintf(stderr, "Can't create curscr\n");
  2433. X                exit(1);
  2434. X            }
  2435. X            for (i = 0; i < 24; i++)
  2436. X                curscr->_y[i] = screen[i];
  2437. X            first = 0;
  2438. X        }
  2439. X        curscr->_cury = cur_row;
  2440. X        curscr->_curx = cur_col;
  2441. X        wrefresh(curscr);
  2442. X#ifdef    NOCURSES
  2443. X        mvcur(cur_row, cur_col, 0, 0);
  2444. X        for (i = 0; i < 23; i++) {
  2445. X            fwrite(screen[i], sizeof (char), 80, stdout);
  2446. X            if (COLS > 80 || (COLS == 80 && !AM))
  2447. X                putchar('\n');
  2448. X        }
  2449. X        fwrite(screen[23], sizeof (char), 79, stdout);
  2450. X        mvcur(23, 79, cur_row, cur_col);
  2451. X#endif
  2452. X    }
  2453. X}
  2454. END_OF_FILE
  2455. if test 8542 -ne `wc -c <'playit.c'`; then
  2456.     echo shar: \"'playit.c'\" unpacked with wrong size!
  2457. fi
  2458. # end of 'playit.c'
  2459. fi
  2460. echo shar: End of archive 3 \(of 4\).
  2461. cp /dev/null ark3isdone
  2462. MISSING=""
  2463. for I in 1 2 3 4 ; do
  2464.     if test ! -f ark${I}isdone ; then
  2465.     MISSING="${MISSING} ${I}"
  2466.     fi
  2467. done
  2468. if test "${MISSING}" = "" ; then
  2469.     echo You have unpacked all 4 archives.
  2470.     rm -f ark[1-9]isdone
  2471. else
  2472.     echo You still need to unpack the following archives:
  2473.     echo "        " ${MISSING}
  2474. fi
  2475. ##  End of shell archive.
  2476. exit 0
  2477.