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