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