1: /*
   2:  * Copyright (c) 1983 Regents of the University of California,
   3:  * All rights reserved.  Redistribution permitted subject to
   4:  * the terms of the Berkeley Software License Agreement.
   5:  */
   6: 
   7: /* @(#)externs.h	1.3.1 1996/10/26 */
   8: 
   9: #include <sys/signal.h>
  10: #include <stdio.h>
  11: 
  12: #define PATH(x)     "/usr/games/lib/x"
  13: #define logfile     PATH(battlestar.log)
  14: #define BATTLESTRINGS   PATH(battle_strings)
  15: 
  16: #define BITS (8 * sizeof (int))
  17: 
  18: #define OUTSIDE     (position > 68 && position < 246 && position != 218)
  19: #define rnd(x)      (rand() % (x))
  20: #define max(a,b)    ((a) < (b) ? (b) : (a))
  21: #define testbit(array, index)   (array[index/BITS] & (1 << (index % BITS)))
  22: #define setbit(array, index)    (array[index/BITS] |= (1 << (index % BITS)))
  23: #define clearbit(array, index)  (array[index/BITS] &= ~(1 << (index % BITS)))
  24: 
  25:     /* well known rooms */
  26: #define FINAL   275
  27: #define GARDEN  197
  28: #define POOLS   126
  29: #define DOCK    93
  30: 
  31:     /* word types */
  32: #define VERB    0
  33: #define OBJECT  1
  34: #define NOUNS   2
  35: #define PREPS   3
  36: #define ADJS    4
  37: #define CONJ    5
  38: 
  39:     /* words numbers */
  40: #define KNIFE       0
  41: #define SWORD       1
  42: #define LAND        2
  43: #define WOODSMAN    3
  44: #define TWO_HANDED  4
  45: #define CLEAVER     5
  46: #define BROAD       6
  47: #define MAIL        7
  48: #define HELM        8
  49: #define SHIELD      9
  50: #define MAID        10
  51: #define BODY        10
  52: #define VIPER       11
  53: #define LAMPON      12
  54: #define SHOES       13
  55: #define CYLON       14
  56: #define PAJAMAS     15
  57: #define ROBE        16
  58: #define AMULET      17
  59: #define MEDALION    18
  60: #define TALISMAN    19
  61: #define DEADWOOD    20
  62: #define MALLET      21
  63: #define LASER       22
  64: #define BATHGOD     23
  65: #define NORMGOD     24
  66: #define GRENADE     25
  67: #define CHAIN       26
  68: #define ROPE        27
  69: #define LEVIS       28
  70: #define MACE        29
  71: #define SHOVEL      30
  72: #define HALBERD     31
  73: #define COMPASS     32
  74: #define CRASH       33
  75: #define ELF     34
  76: #define FOOT        35
  77: #define COINS       36
  78: #define MATCHES     37
  79: #define MAN     38
  80: #define PAPAYAS     39
  81: #define PINEAPPLE   40
  82: #define KIWI        41
  83: #define COCONUTS    42
  84: #define MANGO       43
  85: #define RING        44
  86: #define POTION      45
  87: #define BRACELET    46
  88: #define GIRL        47
  89: #define GIRLTALK    48
  90: #define DARK        49
  91: #define TIMER       50
  92: #define CHAR        53
  93: #define BOMB        54
  94: #define DEADGOD     55
  95: #define DEADTIME    56
  96: #define DEADNATIVE  57
  97: #define NATIVE      58
  98: #define HORSE       59
  99: #define CAR     60
 100: #define POT     61
 101: #define BAR     62
 102: #define BLOCK       63
 103: #define NUMOFOBJECTS    64
 104:     /* non-objects below */
 105: #define UP  1000
 106: #define DOWN    1001
 107: #define AHEAD   1002
 108: #define BACK    1003
 109: #define RIGHT   1004
 110: #define LEFT    1005
 111: #define TAKE    1006
 112: #define USE 1007
 113: #define LOOK    1008
 114: #define QUIT    1009
 115: #define NORTH   1010
 116: #define SOUTH   1011
 117: #define EAST    1012
 118: #define WEST    1013
 119: #define SU      1014
 120: #define DROP    1015
 121: #define TAKEOFF 1016
 122: #define DRAW    1017
 123: #define PUTON   1018
 124: #define WEARIT  1019
 125: #define PUT 1020
 126: #define INVEN   1021
 127: #define EVERYTHING 1022
 128: #define AND 1023
 129: #define KILL    1024
 130: #define RAVAGE  1025
 131: #define UNDRESS 1026
 132: #define THROW   1027
 133: #define LAUNCH  1028
 134: #define LANDIT  1029
 135: #define LIGHT   1030
 136: #define FOLLOW  1031
 137: #define KISS    1032
 138: #define LOVE    1033
 139: #define GIVE    1034
 140: #define SMITE   1035
 141: #define SHOOT   1036
 142: #define ON  1037
 143: #define OFF 1038
 144: #define TIME    1039
 145: #define SLEEP   1040
 146: #define DIG 1041
 147: #define EAT 1042
 148: #define SWIM    1043
 149: #define DRINK   1044
 150: #define DOOR    1045
 151: #define SAVE    1046
 152: #define RIDE    1047
 153: #define DRIVE   1048
 154: #define SCORE   1049
 155: #define BURY    1050
 156: #define JUMP    1051
 157: #define KICK    1052
 158: 
 159:     /* injuries */
 160: #define ARM 6       /* broken arm */
 161: #define RIBS    7       /* broken ribs */
 162: #define SPINE   9       /* broken back */
 163: #define SKULL   11      /* fractured skull */
 164: #define INCISE  10      /* deep incisions */
 165: #define NECK    12      /* broken NECK */
 166: #define NUMOFINJURIES 13
 167: 
 168:     /* notes */
 169: #define CANTLAUNCH  0
 170: #define LAUNCHED    1
 171: #define CANTSEE     2
 172: #define CANTMOVE    3
 173: #define JINXED      4
 174: #define DUG     5
 175: #define NUMOFNOTES  6
 176: 
 177:     /* fundamental constants */
 178: #define NUMOFROOMS  275
 179: #define NUMOFWORDS  ((NUMOFOBJECTS + BITS - 1) / BITS)
 180: #define LINELENGTH  81
 181: 
 182: #define TODAY       0
 183: #define TONIGHT     1
 184: #define CYCLE       100
 185: 
 186:     /* initial variable values */
 187: #define TANKFULL    250
 188: #define TORPEDOES   10
 189: #define MAXWEIGHT   60
 190: #define MAXCUMBER   10
 191: 
 192: struct room {
 193: #ifdef pdp11
 194:     unsigned name;
 195: #else
 196:     char *name;
 197: #endif
 198:     int link[8];
 199: #define north   link[0]
 200: #define south   link[1]
 201: #define east    link[2]
 202: #define west    link[3]
 203: #define up  link[4]
 204: #define access  link[5]
 205: #define down    link[6]
 206: #define flyhere link[7]
 207: #ifdef pdp11
 208:     unsigned desc;
 209: #else
 210:     char *desc;
 211: #endif
 212:     unsigned int objects[NUMOFWORDS];
 213: };
 214: struct room dayfile[];
 215: struct room nightfile[];
 216: struct room *location;
 217: 
 218:     /* object characteristics */
 219: #ifdef pdp11
 220: unsigned objdes[NUMOFOBJECTS];
 221: #else
 222: char *objdes[NUMOFOBJECTS];
 223: #endif
 224: char *objsht[NUMOFOBJECTS];
 225: char *ouch[NUMOFINJURIES];
 226: int objwt[NUMOFOBJECTS];
 227: int objcumber[NUMOFOBJECTS];
 228: 
 229:     /* current input line */
 230: #define NWORD   20          /* words per line */
 231: char words[NWORD][15];
 232: int wordvalue[NWORD];
 233: int wordtype[NWORD];
 234: int wordcount, wordnumber;
 235: 
 236: char *truedirec(), *rate();
 237: char *getcom(), *getword();
 238: 
 239:     /* state of the game */
 240: int Time;
 241: int position;
 242: int direction;
 243: int left, right, ahead, back;
 244: int clock, fuel, torps;
 245: int carrying, encumber;
 246: int rythmn;
 247: int followfight;
 248: int ate;
 249: int snooze;
 250: int meetgirl;
 251: int followgod;
 252: int godready;
 253: int win;
 254: int wintime;
 255: int wiz;
 256: int tempwiz;
 257: int matchlight, matchcount;
 258: int loved;
 259: int pleasure, power, ego;
 260: int WEIGHT;
 261: int CUMBER;
 262: int notes[NUMOFNOTES];
 263: unsigned int inven[NUMOFWORDS];
 264: unsigned int wear[NUMOFWORDS];
 265: char beenthere[NUMOFROOMS+1];
 266: char injuries[NUMOFINJURIES];
 267: 
 268: char uname[9];
 269: 
 270: struct wlist {
 271:     char *string;
 272:     int value, article;
 273:     struct wlist *next;
 274: };
 275: #define HASHSIZE    256
 276: #define HASHMUL     81
 277: #define HASHMASK    (HASHSIZE - 1)
 278: struct wlist *hashtab[HASHSIZE];
 279: struct wlist wlist[];
 280: 
 281: struct objs {
 282:     short room;
 283:     short obj;
 284: };
 285: struct objs dayobjs[];
 286: struct objs nightobjs[];

Defined variables

ate defined in line 248; used 8 times
dayobjs defined in line 285; used 1 times
direction defined in line 242; used 23 times
hashtab defined in line 278; used 3 times
loved defined in line 258; used 7 times
matchcount defined in line 257; used 6 times
meetgirl defined in line 250; used 8 times
nightfile defined in line 215; used 6 times
nightobjs defined in line 286; used 2 times
objdes defined in line 222; used 8 times
rythmn defined in line 246; used 8 times
uname defined in line 268; used 15 times
wlist defined in line 279; used 1 times
wordnumber defined in line 234; used 197 times

Defined struct's

room defined in line 192; used 12 times
wlist defined in line 270; used 18 times

Defined macros

ARM defined in line 160; used 2 times
BAR defined in line 101; used 2 times
BATTLESTRINGS defined in line 14; used 1 times
BITS defined in line 16; used 8 times
BLOCK defined in line 102; used 3 times
BODY defined in line 51; used 2 times
BURY defined in line 155; used 1 times
CANTLAUNCH defined in line 169; used 1 times
CANTMOVE defined in line 172; used 4 times
CHAR defined in line 92; used 1 times
COCONUTS defined in line 83; used 11 times
CONJ defined in line 37; used 1 times
CRASH defined in line 74; used 2 times
DIG defined in line 146; used 1 times
DOCK defined in line 29; used 3 times
DOOR defined in line 150; used 1 times
DOWN defined in line 106; used 3 times
DRAW defined in line 122; used 3 times
DRINK defined in line 149; used 1 times
DRIVE defined in line 153; used 2 times
DROP defined in line 120; used 2 times
DUG defined in line 174; used 2 times
EAST defined in line 117; used 3 times
EAT defined in line 147; used 1 times
FINAL defined in line 26; used 5 times
FOLLOW defined in line 136; used 2 times
FOOT defined in line 76; used 2 times
GARDEN defined in line 27; used 6 times
GIRLTALK defined in line 89; used 2 times
GIVE defined in line 139; used 1 times
HASHMASK defined in line 277; used 1 times
HASHMUL defined in line 276; used 1 times
HASHSIZE defined in line 275; used 2 times
INVEN defined in line 126; used 2 times
JUMP defined in line 156; used 1 times
KICK defined in line 157; used 3 times
KILL defined in line 129; used 2 times
KISS defined in line 137; used 1 times
LANDIT defined in line 134; used 1 times
LAUNCH defined in line 133; used 1 times
LEVIS defined in line 69; used 3 times
LIGHT defined in line 135; used 2 times
LOOK defined in line 113; used 2 times
LOVE defined in line 138; used 2 times
NECK defined in line 165; used 2 times
NUMOFNOTES defined in line 175; used 1 times
NUMOFWORDS defined in line 179; used 6 times
NWORD defined in line 230; used 3 times
OFF defined in line 143; used 2 times
ON defined in line 142; used 2 times
PATH defined in line 12; used 2 times
POOLS defined in line 28; used 1 times
POT defined in line 100; used 3 times
PREPS defined in line 35; used 2 times
PUT defined in line 125; used 4 times
PUTON defined in line 123; used 1 times
QUIT defined in line 114; used 2 times
RAVAGE defined in line 130; used 2 times
RIBS defined in line 161; used 2 times
RIDE defined in line 152; used 2 times
ROBE defined in line 57; used 2 times
SAVE defined in line 151; used 1 times
SCORE defined in line 154; used 2 times
SHOOT defined in line 141; used 2 times
SKULL defined in line 163; used 3 times
SLEEP defined in line 145; used 1 times
SMITE defined in line 140; used 7 times
SOUTH defined in line 116; used 3 times
SPINE defined in line 162; used 2 times
SU defined in line 119; used 1 times
SWIM defined in line 148; used 1 times
TAKE defined in line 111; used 2 times
TAKEOFF defined in line 121; used 1 times
TANKFULL defined in line 187; used 1 times
THROW defined in line 132; used 1 times
TIME defined in line 144; used 1 times
TODAY defined in line 182; used 1 times
TONIGHT defined in line 183; used 2 times
TORPEDOES defined in line 188; used 1 times
UNDRESS defined in line 131; used 1 times
UP defined in line 105; used 3 times
USE defined in line 112; used 1 times
VERB defined in line 32; used 73 times
WEARIT defined in line 124; used 2 times
WEST defined in line 118; used 3 times
access defined in line 204; used 4 times
east defined in line 201; used 6 times
flyhere defined in line 206; used 3 times
logfile defined in line 13; used 2 times

Usage of this include

Last modified: 1996-10-27
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 7317
Valid CSS Valid XHTML 1.0 Strict