1 /* $OpenBSD: hdr.h,v 1.12 2003/06/03 03:01:37 millert Exp $ */ 2 /* $NetBSD: hdr.h,v 1.2 1995/03/21 12:05:02 cgd Exp $ */ 3 4 /*- 5 * Copyright (c) 1991, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * The game adventure was originally written in Fortran by Will Crowther 9 * and Don Woods. It was later translated to C and enhanced by Jim 10 * Gillogly. This code is derived from software contributed to Berkeley 11 * by Jim Gillogly at The Rand Corporation. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * @(#)hdr.h 8.1 (Berkeley) 5/31/93 38 */ 39 40 /* ADVENTURE -- Jim Gillogly, Jul 1977 41 * This program is a re-write of ADVENT, written in FORTRAN mostly by 42 * Don Woods of SAIL. In most places it is as nearly identical to the 43 * original as possible given the language and word-size differences. 44 * A few places, such as the message arrays and travel arrays were changed 45 * to reflect the smaller core size and word size. The labels of the 46 * original are reflected in this version, so that the comments of the 47 * fortran are still applicable here. 48 * 49 * The data file distributed with the fortran source is assumed to be called 50 * "glorkz" in the directory where the program is first run. 51 */ 52 53 /* hdr.h: included by c advent files */ 54 55 #include <sys/types.h> 56 #include <signal.h> 57 58 int datfd; /* message file descriptor */ 59 volatile sig_atomic_t delhit; 60 int yea; 61 extern char data_file[]; /* Virtual data file */ 62 63 #define TAB 011 64 #define LF 012 65 #define FLUSHLINE do { int c; while ((c = getchar()) != EOF && c != '\n'); } while (0) 66 #define FLUSHLF while (next()!=LF) 67 68 int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2; 69 int verb, obj, spk; 70 extern int blklin; 71 time_t savet; 72 int mxscor, latncy; 73 74 #define SHORT 50 /* How short is a demo game? */ 75 76 #define MAXSTR 20 /* max length of user's words */ 77 char wd1[MAXSTR]; /* the complete words */ 78 char wd2[MAXSTR]; 79 80 #define HTSIZE 512 /* max number of vocab words */ 81 struct hashtab { /* hash table for vocabulary */ 82 int val; /* word type &index (ktab) */ 83 char *atab; /* pointer to actual string */ 84 } voc[HTSIZE]; 85 86 #define SEED 1815622 /* "Encryption" seed */ 87 88 struct text { 89 #ifdef OLDSTUFF 90 int seekadr; /* DATFILE must be < 2**16 */ 91 #endif /* OLDSTUFF */ 92 char *seekadr; /* Msg start in virtual disk */ 93 int txtlen; /* length of msg starting here */ 94 }; 95 96 #define RTXSIZ 205 97 struct text rtext[RTXSIZ]; /* random text messages */ 98 99 #define MAGSIZ 35 100 struct text mtext[MAGSIZ]; /* magic messages */ 101 102 int clsses; 103 #define CLSMAX 12 104 struct text ctext[CLSMAX]; /* classes of adventurer */ 105 int cval[CLSMAX]; 106 107 struct text ptext[101]; /* object descriptions */ 108 109 #define LOCSIZ 141 /* number of locations */ 110 struct text ltext[LOCSIZ]; /* long loc description */ 111 struct text stext[LOCSIZ]; /* short loc descriptions */ 112 113 struct travlist /* direcs & conditions of travel*/ 114 { struct travlist *next; /* ptr to next list entry */ 115 int conditions; /* m in writeup (newloc / 1000) */ 116 int tloc; /* n in writeup (newloc % 1000) */ 117 int tverb; /* the verb that takes you there*/ 118 } *travel[LOCSIZ],*tkk; /* travel is closer to keys(...)*/ 119 120 int atloc[LOCSIZ]; 121 122 int plac[101]; /* initial object placement */ 123 int fixd[101], fixed[101]; /* location fixed? */ 124 125 int actspk[35]; /* rtext msg for verb <n> */ 126 127 int cond[LOCSIZ]; /* various condition bits */ 128 129 extern int setbit[16]; /* bit defn masks 1,2,4,... */ 130 131 int hntmax; 132 int hints[20][5]; /* info on hints */ 133 int hinted[20], hintlc[20]; 134 135 int place[101], prop[101], linkx[201]; 136 int abb[LOCSIZ]; 137 138 int maxtrs, tally, tally2; /* treasure values */ 139 140 #define FALSE 0 141 #define TRUE 1 142 143 int keys, lamp, grate, cage, rod, rod2, steps, /* mnemonics */ 144 bird, door, pillow, snake, fissur, tablet, clam, oyster, 145 magzin, dwarf, knife, food, bottle, water, oil, plant, plant2, 146 axe, mirror, dragon, chasm, troll, troll2, bear, messag, 147 vend, batter, nugget, coins, chest, eggs, tridnt, vase, 148 emrald, pyram, pearl, rug, chain, spices, back, look, cave, 149 null, entrnc, dprssn, enter, stream, pour, say, lock, throw, 150 find, invent; 151 152 int chloc, chloc2, dseen[7], dloc[7], /* dwarf stuff */ 153 odloc[7], dflag, daltlc; 154 155 int tk[21], stick, dtotal, attack; 156 int turns, lmwarn, iwest, knfloc, detail, /* various flags & counters */ 157 abbnum, maxdie, numdie, holdng, dkill, foobar, bonus, clock1, 158 clock2, saved, closng, panic, closed, scorng; 159 160 int demo, limit; 161 162 /* We need to get a little tricky to avoid strings */ 163 #define DECR(a,b,c,d,e) decr(*#a+'+',*#b+'-',*#c+'#',*#d+'&',*#e+'%') 164