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