xref: /original-bsd/games/adventure/hdr.h (revision 3a8172c6)
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * The game adventure was original written Fortran by Will Crowther
6  * and Don Woods.  It was later translated to C and enhanced by
7  * Jim Gillogly.
8  *
9  * %sccs.include.redist.c%
10  *
11  *	@(#)hdr.h	5.1 (Berkeley) 04/08/91
12  */
13 
14 /*   ADVENTURE -- Jim Gillogly, Jul 1977
15  * This program is a re-write of ADVENT, written in FORTRAN mostly by
16  * Don Woods of SAIL.  In most places it is as nearly identical to the
17  * original as possible given the language and word-size differences.
18  * A few places, such as the message arrays and travel arrays were changed
19  * to reflect the smaller core size and word size.  The labels of the
20  * original are reflected in this version, so that the comments of the
21  * fortran are still applicable here.
22  *
23  * The data file distributed with the fortran source is assumed to be called
24  * "glorkz" in the directory where the program is first run.
25  */
26 
27 /* hdr.h: included by c advent files */
28 
29 extern int setup;                       /* changed by savec & init      */
30 int datfd;                              /* message file descriptor      */
31 int delhit;
32 int yea;
33 
34 #define TAB     011
35 #define LF      012
36 #define FLUSHLINE while (getchar()!='\n')
37 #define FLUSHLF   while (next()!=LF)
38 
39 int loc,newloc,oldloc,oldlc2,wzdark,SHORT,gaveup,kq,k,k2;
40 char *wd1,*wd2;                         /* the complete words           */
41 int verb,obj,spk;
42 extern int blklin;
43 int saved,savet,mxscor,latncy;
44 
45 #define MAXSTR  20                      /* max length of user's words   */
46 
47 #define HTSIZE  512                     /* max number of vocab words    */
48 struct hashtab                          /* hash table for vocabulary    */
49 {       int val;                        /* word type &index (ktab)      */
50 	char *atab;                     /* pointer to actual string     */
51 } voc[HTSIZE];
52 
53 #define DATFILE "glorkz"                /* all the original msgs        */
54 #define TMPFILE "tmp.foo.baz"           /* just the text msgs           */
55 
56 
57 struct text
58 {       int seekadr;                    /* DATFILE must be < 2**16      */
59 	int txtlen;                     /* length of msg starting here  */
60 };
61 
62 #define RTXSIZ  205
63 struct text rtext[RTXSIZ];              /* random text messages         */
64 
65 #define MAGSIZ  35
66 struct text mtext[MAGSIZ];              /* magic messages               */
67 
68 int clsses;
69 #define CLSMAX  12
70 struct text ctext[CLSMAX];              /* classes of adventurer        */
71 int cval[CLSMAX];
72 
73 struct text ptext[101];                 /* object descriptions          */
74 
75 #define LOCSIZ  141                     /* number of locations          */
76 struct text ltext[LOCSIZ];              /* long loc description         */
77 struct text stext[LOCSIZ];              /* short loc descriptions       */
78 
79 struct travlist                         /* direcs & conditions of travel*/
80 {       struct travlist *next;          /* ptr to next list entry       */
81 	int conditions;                 /* m in writeup (newloc / 1000) */
82 	int tloc;                       /* n in writeup (newloc % 1000) */
83 	int tverb;                      /* the verb that takes you there*/
84 } *travel[LOCSIZ],*tkk;                 /* travel is closer to keys(...)*/
85 
86 int atloc[LOCSIZ];
87 
88 int  plac[101];                         /* initial object placement     */
89 int  fixd[101],fixed[101];              /* location fixed?              */
90 
91 int actspk[35];                         /* rtext msg for verb <n>       */
92 
93 int cond[LOCSIZ];                       /* various condition bits       */
94 
95 extern int setbit[16];                  /* bit defn masks 1,2,4,...     */
96 
97 int hntmax;
98 int hints[20][5];                       /* info on hints                */
99 int hinted[20],hintlc[20];
100 
101 int place[101], prop[101],link[201];
102 int abb[LOCSIZ];
103 
104 int maxtrs,tally,tally2;                /* treasure values              */
105 
106 #define FALSE   0
107 #define TRUE    1
108 
109 int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics                    */
110 	bird,door,pillow,snake,fissur,tablet,clam,oyster,magzin,
111 	dwarf,knife,food,bottle,water,oil,plant,plant2,axe,mirror,dragon,
112 	chasm,troll,troll2,bear,messag,vend,batter,
113 	nugget,coins,chest,eggs,tridnt,vase,emrald,pyram,pearl,rug,chain,
114 	spices,
115 	back,look,cave,null,entrnc,dprssn,
116 	say,lock,throw,find,invent;
117 
118 int chloc,chloc2,dseen[7],dloc[7],      /* dwarf stuff                  */
119 	odloc[7],dflag,daltlc;
120 
121 int tk[21],stick,dtotal,attack;
122 int turns,lmwarn,iwest,knfloc,detail,   /* various flags & counters     */
123 	abbnum,maxdie,numdie,holdng,dkill,foobar,bonus,clock1,clock2,
124 	saved,closng,panic,closed,scorng;
125 
126 int demo,newloc,limit;
127 
128 char *malloc();
129