| 1 | /* |
| 2 | * Copyright (c) 1983, 1993 |
| 3 | * The Regents of the University of California. All rights reserved. |
| 4 | * |
| 5 | * %sccs.include.redist.c% |
| 6 | */ |
| 7 | |
| 8 | #ifndef lint |
| 9 | static char copyright[] = |
| 10 | "@(#) Copyright (c) 1983, 1993\n\ |
| 11 | The Regents of the University of California. All rights reserved.\n"; |
| 12 | #endif /* not lint */ |
| 13 | |
| 14 | #ifndef lint |
| 15 | static char sccsid[] = "@(#)battlestar.c 8.1 (Berkeley) %G%"; |
| 16 | #endif /* not lint */ |
| 17 | |
| 18 | /* |
| 19 | * Battlestar - a stellar-tropical adventure game |
| 20 | * |
| 21 | * Originally written by His Lordship, Admiral David W. Horatio Riggle, |
| 22 | * on the Cory PDP-11/70, University of California, Berkeley. |
| 23 | */ |
| 24 | |
| 25 | #include "externs.h" |
| 26 | |
| 27 | main(argc,argv) |
| 28 | int argc; |
| 29 | char **argv; |
| 30 | { |
| 31 | char mainbuf[LINELENGTH]; |
| 32 | char *next; |
| 33 | |
| 34 | initialize(argc < 2 || strcmp(argv[1], "-r")); |
| 35 | start: |
| 36 | news(); |
| 37 | beenthere[position]++; |
| 38 | if (notes[LAUNCHED]) |
| 39 | crash(); /* decrements fuel & crash */ |
| 40 | if (matchlight) { |
| 41 | puts("Your match splutters out."); |
| 42 | matchlight = 0; |
| 43 | } |
| 44 | if (!notes[CANTSEE] || testbit(inven,LAMPON) || |
| 45 | testbit(location[position].objects, LAMPON)) { |
| 46 | writedes(); |
| 47 | printobjs(); |
| 48 | } else |
| 49 | puts("It's too dark to see anything in here!"); |
| 50 | whichway(location[position]); |
| 51 | run: |
| 52 | next = getcom(mainbuf, sizeof mainbuf, ">-: ", |
| 53 | "Please type in something."); |
| 54 | for (wordcount = 0; next && wordcount < 20; wordcount++) |
| 55 | next = getword(next, words[wordcount], -1); |
| 56 | parse(); |
| 57 | switch (cypher()) { |
| 58 | case -1: |
| 59 | goto run; |
| 60 | case 0: |
| 61 | goto start; |
| 62 | default: |
| 63 | exit(); |
| 64 | } |
| 65 | } |