xref: /csrg-svn/games/adventure/hdr.h (revision 60733)
147851Sbostic /*-
2*60733Sbostic  * Copyright (c) 1991, 1993
3*60733Sbostic  *	The Regents of the University of California.  All rights reserved.
447851Sbostic  *
559968Sbostic  * The game adventure was originally written in Fortran by Will Crowther
659968Sbostic  * and Don Woods.  It was later translated to C and enhanced by Jim
759968Sbostic  * Gillogly.  This code is derived from software contributed to Berkeley
859968Sbostic  * by Jim Gillogly at The Rand Corporation.
947851Sbostic  *
1047851Sbostic  * %sccs.include.redist.c%
1147851Sbostic  *
12*60733Sbostic  *	@(#)hdr.h	8.1 (Berkeley) 05/31/93
1347851Sbostic  */
1447851Sbostic 
156743Srrh /*   ADVENTURE -- Jim Gillogly, Jul 1977
166743Srrh  * This program is a re-write of ADVENT, written in FORTRAN mostly by
176743Srrh  * Don Woods of SAIL.  In most places it is as nearly identical to the
186743Srrh  * original as possible given the language and word-size differences.
196743Srrh  * A few places, such as the message arrays and travel arrays were changed
206743Srrh  * to reflect the smaller core size and word size.  The labels of the
216743Srrh  * original are reflected in this version, so that the comments of the
226743Srrh  * fortran are still applicable here.
236743Srrh  *
246743Srrh  * The data file distributed with the fortran source is assumed to be called
256743Srrh  * "glorkz" in the directory where the program is first run.
266743Srrh  */
276743Srrh 
286743Srrh /* hdr.h: included by c advent files */
296743Srrh 
306743Srrh int datfd;                              /* message file descriptor      */
316743Srrh int delhit;
326743Srrh int yea;
3359968Sbostic extern char data_file[];                /* Virtual data file            */
346743Srrh 
356743Srrh #define TAB     011
366743Srrh #define LF      012
376743Srrh #define FLUSHLINE while (getchar()!='\n')
386743Srrh #define FLUSHLF   while (next()!=LF)
396743Srrh 
4059968Sbostic int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2;
416743Srrh char *wd1,*wd2;                         /* the complete words           */
426743Srrh int verb,obj,spk;
436743Srrh extern int blklin;
446743Srrh int saved,savet,mxscor,latncy;
456743Srrh 
4659968Sbostic #define SHORT 50                        /* How short is a demo game?    */
4759968Sbostic 
486743Srrh #define MAXSTR  20                      /* max length of user's words   */
496743Srrh 
506743Srrh #define HTSIZE  512                     /* max number of vocab words    */
516743Srrh struct hashtab                          /* hash table for vocabulary    */
526743Srrh {       int val;                        /* word type &index (ktab)      */
536743Srrh 	char *atab;                     /* pointer to actual string     */
546743Srrh } voc[HTSIZE];
556743Srrh 
5659968Sbostic #define SEED 1815622                    /* "Encryption" seed            */
576743Srrh 
586743Srrh struct text
5959968Sbostic #ifdef OLDSTUFF
606743Srrh {       int seekadr;                    /* DATFILE must be < 2**16      */
6159968Sbostic #endif OLDSTUFF
6259968Sbostic {       char *seekadr;                  /* Msg start in virtual disk    */
636743Srrh 	int txtlen;                     /* length of msg starting here  */
646743Srrh };
656743Srrh 
666743Srrh #define RTXSIZ  205
676743Srrh struct text rtext[RTXSIZ];              /* random text messages         */
686743Srrh 
696743Srrh #define MAGSIZ  35
706743Srrh struct text mtext[MAGSIZ];              /* magic messages               */
716743Srrh 
726743Srrh int clsses;
736743Srrh #define CLSMAX  12
746743Srrh struct text ctext[CLSMAX];              /* classes of adventurer        */
756743Srrh int cval[CLSMAX];
766743Srrh 
776743Srrh struct text ptext[101];                 /* object descriptions          */
786743Srrh 
796743Srrh #define LOCSIZ  141                     /* number of locations          */
806743Srrh struct text ltext[LOCSIZ];              /* long loc description         */
816743Srrh struct text stext[LOCSIZ];              /* short loc descriptions       */
826743Srrh 
836743Srrh struct travlist                         /* direcs & conditions of travel*/
846743Srrh {       struct travlist *next;          /* ptr to next list entry       */
856743Srrh 	int conditions;                 /* m in writeup (newloc / 1000) */
866743Srrh 	int tloc;                       /* n in writeup (newloc % 1000) */
876743Srrh 	int tverb;                      /* the verb that takes you there*/
886743Srrh } *travel[LOCSIZ],*tkk;                 /* travel is closer to keys(...)*/
896743Srrh 
906743Srrh int atloc[LOCSIZ];
916743Srrh 
926743Srrh int  plac[101];                         /* initial object placement     */
936743Srrh int  fixd[101],fixed[101];              /* location fixed?              */
946743Srrh 
956743Srrh int actspk[35];                         /* rtext msg for verb <n>       */
966743Srrh 
976743Srrh int cond[LOCSIZ];                       /* various condition bits       */
986743Srrh 
996743Srrh extern int setbit[16];                  /* bit defn masks 1,2,4,...     */
1006743Srrh 
1016743Srrh int hntmax;
1026743Srrh int hints[20][5];                       /* info on hints                */
1036743Srrh int hinted[20],hintlc[20];
1046743Srrh 
1056743Srrh int place[101], prop[101],link[201];
1066743Srrh int abb[LOCSIZ];
1076743Srrh 
1086743Srrh int maxtrs,tally,tally2;                /* treasure values              */
1096743Srrh 
1106743Srrh #define FALSE   0
1116743Srrh #define TRUE    1
1126743Srrh 
1136743Srrh int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics                    */
1146743Srrh 	bird,door,pillow,snake,fissur,tablet,clam,oyster,magzin,
1156743Srrh 	dwarf,knife,food,bottle,water,oil,plant,plant2,axe,mirror,dragon,
1166743Srrh 	chasm,troll,troll2,bear,messag,vend,batter,
1176743Srrh 	nugget,coins,chest,eggs,tridnt,vase,emrald,pyram,pearl,rug,chain,
1186743Srrh 	spices,
1196743Srrh 	back,look,cave,null,entrnc,dprssn,
12059968Sbostic 	enter, stream, pour,
1216743Srrh 	say,lock,throw,find,invent;
1226743Srrh 
1236743Srrh int chloc,chloc2,dseen[7],dloc[7],      /* dwarf stuff                  */
1246743Srrh 	odloc[7],dflag,daltlc;
1256743Srrh 
1266743Srrh int tk[21],stick,dtotal,attack;
1276743Srrh int turns,lmwarn,iwest,knfloc,detail,   /* various flags & counters     */
1286743Srrh 	abbnum,maxdie,numdie,holdng,dkill,foobar,bonus,clock1,clock2,
1296743Srrh 	saved,closng,panic,closed,scorng;
1306743Srrh 
1316743Srrh int demo,newloc,limit;
1326743Srrh 
1336743Srrh char *malloc();
13459997Sbostic char *decr();
13559997Sbostic unsigned long crc();
13659968Sbostic 
13759968Sbostic /* We need to get a little tricky to avoid strings */
13859968Sbostic #define DECR(a,b,c,d,e) decr('a'+'+','b'+'-','c'+'#','d'+'&','e'+'%')
139