Home | History | Annotate | Line # | Download | only in battlestar
extern.h revision 1.1
      1  1.1  tls /*
      2  1.1  tls  * Copyright (c) 1983, 1993
      3  1.1  tls  *	The Regents of the University of California.  All rights reserved.
      4  1.1  tls  *
      5  1.1  tls  * Redistribution and use in source and binary forms, with or without
      6  1.1  tls  * modification, are permitted provided that the following conditions
      7  1.1  tls  * are met:
      8  1.1  tls  * 1. Redistributions of source code must retain the above copyright
      9  1.1  tls  *    notice, this list of conditions and the following disclaimer.
     10  1.1  tls  * 2. Redistributions in binary form must reproduce the above copyright
     11  1.1  tls  *    notice, this list of conditions and the following disclaimer in the
     12  1.1  tls  *    documentation and/or other materials provided with the distribution.
     13  1.1  tls  * 3. All advertising materials mentioning features or use of this software
     14  1.1  tls  *    must display the following acknowledgement:
     15  1.1  tls  *	This product includes software developed by the University of
     16  1.1  tls  *	California, Berkeley and its contributors.
     17  1.1  tls  * 4. Neither the name of the University nor the names of its contributors
     18  1.1  tls  *    may be used to endorse or promote products derived from this software
     19  1.1  tls  *    without specific prior written permission.
     20  1.1  tls  *
     21  1.1  tls  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  1.1  tls  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  1.1  tls  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.1  tls  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  1.1  tls  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.1  tls  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  1.1  tls  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.1  tls  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  1.1  tls  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.1  tls  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  1.1  tls  * SUCH DAMAGE.
     32  1.1  tls  *
     33  1.1  tls  *	@(#)externs.h	8.1 (Berkeley) 5/31/93
     34  1.1  tls  */
     35  1.1  tls 
     36  1.1  tls #include <sys/signal.h>
     37  1.1  tls #include <stdio.h>
     38  1.1  tls 
     39  1.1  tls #define BITS (8 * sizeof (int))
     40  1.1  tls 
     41  1.1  tls #define OUTSIDE		(position > 68 && position < 246 && position != 218)
     42  1.1  tls #define rnd(x)		(rand() % (x))
     43  1.1  tls #define max(a,b)	((a) < (b) ? (b) : (a))
     44  1.1  tls #define testbit(array, index)	(array[index/BITS] & (1 << (index % BITS)))
     45  1.1  tls #define setbit(array, index)	(array[index/BITS] |= (1 << (index % BITS)))
     46  1.1  tls #define clearbit(array, index)	(array[index/BITS] &= ~(1 << (index % BITS)))
     47  1.1  tls 
     48  1.1  tls 	/* well known rooms */
     49  1.1  tls #define FINAL	275
     50  1.1  tls #define GARDEN	197
     51  1.1  tls #define POOLS	126
     52  1.1  tls #define DOCK	93
     53  1.1  tls 
     54  1.1  tls 	/* word types */
     55  1.1  tls #define VERB	0
     56  1.1  tls #define OBJECT  1
     57  1.1  tls #define NOUNS	2
     58  1.1  tls #define PREPS	3
     59  1.1  tls #define ADJS	4
     60  1.1  tls #define CONJ	5
     61  1.1  tls 
     62  1.1  tls 	/* words numbers */
     63  1.1  tls #define KNIFE		0
     64  1.1  tls #define SWORD		1
     65  1.1  tls #define LAND		2
     66  1.1  tls #define WOODSMAN 	3
     67  1.1  tls #define TWO_HANDED	4
     68  1.1  tls #define CLEAVER		5
     69  1.1  tls #define BROAD		6
     70  1.1  tls #define MAIL		7
     71  1.1  tls #define HELM		8
     72  1.1  tls #define SHIELD		9
     73  1.1  tls #define MAID		10
     74  1.1  tls #define BODY		10
     75  1.1  tls #define VIPER		11
     76  1.1  tls #define LAMPON		12
     77  1.1  tls #define SHOES		13
     78  1.1  tls #define CYLON		14
     79  1.1  tls #define PAJAMAS		15
     80  1.1  tls #define ROBE		16
     81  1.1  tls #define AMULET		17
     82  1.1  tls #define MEDALION	18
     83  1.1  tls #define TALISMAN	19
     84  1.1  tls #define DEADWOOD	20
     85  1.1  tls #define MALLET		21
     86  1.1  tls #define LASER		22
     87  1.1  tls #define BATHGOD		23
     88  1.1  tls #define NORMGOD		24
     89  1.1  tls #define GRENADE		25
     90  1.1  tls #define CHAIN		26
     91  1.1  tls #define ROPE		27
     92  1.1  tls #define LEVIS		28
     93  1.1  tls #define MACE		29
     94  1.1  tls #define SHOVEL		30
     95  1.1  tls #define HALBERD		31
     96  1.1  tls #define	COMPASS		32
     97  1.1  tls #define	CRASH		33
     98  1.1  tls #define ELF		34
     99  1.1  tls #define FOOT		35
    100  1.1  tls #define COINS		36
    101  1.1  tls #define MATCHES		37
    102  1.1  tls #define MAN		38
    103  1.1  tls #define PAPAYAS		39
    104  1.1  tls #define PINEAPPLE	40
    105  1.1  tls #define KIWI		41
    106  1.1  tls #define COCONUTS	42
    107  1.1  tls #define MANGO		43
    108  1.1  tls #define RING		44
    109  1.1  tls #define POTION		45
    110  1.1  tls #define BRACELET	46
    111  1.1  tls #define GIRL		47
    112  1.1  tls #define GIRLTALK	48
    113  1.1  tls #define DARK		49
    114  1.1  tls #define TIMER		50
    115  1.1  tls #define CHAR		53
    116  1.1  tls #define BOMB		54
    117  1.1  tls #define DEADGOD		55
    118  1.1  tls #define DEADTIME	56
    119  1.1  tls #define DEADNATIVE	57
    120  1.1  tls #define NATIVE		58
    121  1.1  tls #define HORSE		59
    122  1.1  tls #define CAR		60
    123  1.1  tls #define POT		61
    124  1.1  tls #define BAR		62
    125  1.1  tls #define	BLOCK		63
    126  1.1  tls #define NUMOFOBJECTS	64
    127  1.1  tls 	/* non-objects below */
    128  1.1  tls #define UP	1000
    129  1.1  tls #define DOWN	1001
    130  1.1  tls #define AHEAD	1002
    131  1.1  tls #define BACK	1003
    132  1.1  tls #define RIGHT	1004
    133  1.1  tls #define LEFT	1005
    134  1.1  tls #define TAKE	1006
    135  1.1  tls #define USE	1007
    136  1.1  tls #define LOOK	1008
    137  1.1  tls #define QUIT	1009
    138  1.1  tls #define NORTH	1010
    139  1.1  tls #define SOUTH	1011
    140  1.1  tls #define EAST	1012
    141  1.1  tls #define WEST	1013
    142  1.1  tls #define SU      1014
    143  1.1  tls #define DROP	1015
    144  1.1  tls #define TAKEOFF	1016
    145  1.1  tls #define DRAW	1017
    146  1.1  tls #define PUTON	1018
    147  1.1  tls #define WEARIT	1019
    148  1.1  tls #define PUT	1020
    149  1.1  tls #define INVEN	1021
    150  1.1  tls #define EVERYTHING 1022
    151  1.1  tls #define AND	1023
    152  1.1  tls #define KILL	1024
    153  1.1  tls #define RAVAGE	1025
    154  1.1  tls #define UNDRESS	1026
    155  1.1  tls #define THROW	1027
    156  1.1  tls #define LAUNCH	1028
    157  1.1  tls #define LANDIT	1029
    158  1.1  tls #define LIGHT	1030
    159  1.1  tls #define FOLLOW	1031
    160  1.1  tls #define KISS	1032
    161  1.1  tls #define LOVE	1033
    162  1.1  tls #define GIVE	1034
    163  1.1  tls #define SMITE	1035
    164  1.1  tls #define SHOOT	1036
    165  1.1  tls #define ON	1037
    166  1.1  tls #define	OFF	1038
    167  1.1  tls #define TIME	1039
    168  1.1  tls #define SLEEP	1040
    169  1.1  tls #define DIG	1041
    170  1.1  tls #define EAT	1042
    171  1.1  tls #define SWIM	1043
    172  1.1  tls #define DRINK	1044
    173  1.1  tls #define DOOR	1045
    174  1.1  tls #define SAVE	1046
    175  1.1  tls #define RIDE	1047
    176  1.1  tls #define DRIVE	1048
    177  1.1  tls #define SCORE	1049
    178  1.1  tls #define BURY	1050
    179  1.1  tls #define JUMP	1051
    180  1.1  tls #define KICK	1052
    181  1.1  tls 
    182  1.1  tls 	/* injuries */
    183  1.1  tls #define ARM	6		/* broken arm */
    184  1.1  tls #define RIBS	7		/* broken ribs */
    185  1.1  tls #define SPINE	9		/* broken back */
    186  1.1  tls #define SKULL	11		/* fractured skull */
    187  1.1  tls #define INCISE	10		/* deep incisions */
    188  1.1  tls #define NECK	12		/* broken NECK */
    189  1.1  tls #define NUMOFINJURIES 13
    190  1.1  tls 
    191  1.1  tls 	/* notes */
    192  1.1  tls #define	CANTLAUNCH	0
    193  1.1  tls #define LAUNCHED	1
    194  1.1  tls #define CANTSEE		2
    195  1.1  tls #define CANTMOVE	3
    196  1.1  tls #define JINXED		4
    197  1.1  tls #define DUG		5
    198  1.1  tls #define NUMOFNOTES	6
    199  1.1  tls 
    200  1.1  tls 	/* fundamental constants */
    201  1.1  tls #define NUMOFROOMS	275
    202  1.1  tls #define NUMOFWORDS	((NUMOFOBJECTS + BITS - 1) / BITS)
    203  1.1  tls #define LINELENGTH	81
    204  1.1  tls 
    205  1.1  tls #define TODAY		0
    206  1.1  tls #define TONIGHT		1
    207  1.1  tls #define CYCLE		100
    208  1.1  tls 
    209  1.1  tls 	/* initial variable values */
    210  1.1  tls #define TANKFULL	250
    211  1.1  tls #define TORPEDOES	10
    212  1.1  tls #define MAXWEIGHT	60
    213  1.1  tls #define MAXCUMBER	10
    214  1.1  tls 
    215  1.1  tls struct room {
    216  1.1  tls 	char *name;
    217  1.1  tls 	int link[8];
    218  1.1  tls #define north	link[0]
    219  1.1  tls #define south	link[1]
    220  1.1  tls #define east	link[2]
    221  1.1  tls #define west	link[3]
    222  1.1  tls #define up	link[4]
    223  1.1  tls #define access	link[5]
    224  1.1  tls #define down	link[6]
    225  1.1  tls #define flyhere	link[7]
    226  1.1  tls 	char *desc;
    227  1.1  tls 	unsigned int objects[NUMOFWORDS];
    228  1.1  tls };
    229  1.1  tls struct room dayfile[];
    230  1.1  tls struct room nightfile[];
    231  1.1  tls struct room *location;
    232  1.1  tls 
    233  1.1  tls 	/* object characteristics */
    234  1.1  tls char *objdes[NUMOFOBJECTS];
    235  1.1  tls char *objsht[NUMOFOBJECTS];
    236  1.1  tls char *ouch[NUMOFINJURIES];
    237  1.1  tls int objwt[NUMOFOBJECTS];
    238  1.1  tls int objcumber[NUMOFOBJECTS];
    239  1.1  tls 
    240  1.1  tls 	/* current input line */
    241  1.1  tls #define NWORD	20			/* words per line */
    242  1.1  tls char words[NWORD][15];
    243  1.1  tls int wordvalue[NWORD];
    244  1.1  tls int wordtype[NWORD];
    245  1.1  tls int wordcount, wordnumber;
    246  1.1  tls 
    247  1.1  tls char *truedirec(), *rate();
    248  1.1  tls char *getcom(), *getword();
    249  1.1  tls 
    250  1.1  tls 	/* state of the game */
    251  1.1  tls int time;
    252  1.1  tls int position;
    253  1.1  tls int direction;
    254  1.1  tls int left, right, ahead, back;
    255  1.1  tls int clock, fuel, torps;
    256  1.1  tls int carrying, encumber;
    257  1.1  tls int rythmn;
    258  1.1  tls int followfight;
    259  1.1  tls int ate;
    260  1.1  tls int snooze;
    261  1.1  tls int meetgirl;
    262  1.1  tls int followgod;
    263  1.1  tls int godready;
    264  1.1  tls int win;
    265  1.1  tls int wintime;
    266  1.1  tls int wiz;
    267  1.1  tls int tempwiz;
    268  1.1  tls int matchlight, matchcount;
    269  1.1  tls int loved;
    270  1.1  tls int pleasure, power, ego;
    271  1.1  tls int WEIGHT;
    272  1.1  tls int CUMBER;
    273  1.1  tls int notes[NUMOFNOTES];
    274  1.1  tls unsigned int inven[NUMOFWORDS];
    275  1.1  tls unsigned int wear[NUMOFWORDS];
    276  1.1  tls char beenthere[NUMOFROOMS+1];
    277  1.1  tls char injuries[NUMOFINJURIES];
    278  1.1  tls 
    279  1.1  tls char uname[9];
    280  1.1  tls 
    281  1.1  tls struct wlist {
    282  1.1  tls 	char *string;
    283  1.1  tls 	int value, article;
    284  1.1  tls 	struct wlist *next;
    285  1.1  tls };
    286  1.1  tls #define HASHSIZE	256
    287  1.1  tls #define HASHMUL		81
    288  1.1  tls #define HASHMASK	(HASHSIZE - 1)
    289  1.1  tls struct wlist *hashtab[HASHSIZE];
    290  1.1  tls struct wlist wlist[];
    291  1.1  tls 
    292  1.1  tls struct objs {
    293  1.1  tls 	short room;
    294  1.1  tls 	short obj;
    295  1.1  tls };
    296  1.1  tls struct objs dayobjs[];
    297  1.1  tls struct objs nightobjs[];
    298