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