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

Defined variables

ate defined in line 235; used 8 times
dayobjs defined in line 272; used 1 times
direction defined in line 229; used 23 times
hashtab defined in line 265; used 3 times
loved defined in line 245; used 7 times
matchcount defined in line 244; used 6 times
meetgirl defined in line 237; used 8 times
nightfile defined in line 206; used 6 times
nightobjs defined in line 273; used 2 times
objdes defined in line 210; used 5 times
rythmn defined in line 233; used 8 times
uname defined in line 255; used 15 times
wlist defined in line 266; used 1 times
wordnumber defined in line 221; used 197 times

Defined struct's

room defined in line 191; used 12 times
wlist defined in line 257; used 18 times

Defined macros

ARM defined in line 159; used 2 times
BAR defined in line 100; used 2 times
BITS defined in line 15; used 8 times
BLOCK defined in line 101; used 3 times
BODY defined in line 50; used 2 times
BURY defined in line 154; used 1 times
CANTLAUNCH defined in line 168; used 1 times
CANTMOVE defined in line 171; used 4 times
CHAR defined in line 91; used 1 times
COCONUTS defined in line 82; used 11 times
CONJ defined in line 36; used 1 times
CRASH defined in line 73; used 2 times
DIG defined in line 145; used 1 times
DOCK defined in line 28; used 3 times
DOOR defined in line 149; used 1 times
DOWN defined in line 105; used 3 times
DRAW defined in line 121; used 3 times
DRINK defined in line 148; used 1 times
DRIVE defined in line 152; used 2 times
DROP defined in line 119; used 2 times
DUG defined in line 173; used 2 times
EAST defined in line 116; used 3 times
EAT defined in line 146; used 1 times
FINAL defined in line 25; used 5 times
FOLLOW defined in line 135; used 2 times
FOOT defined in line 75; used 2 times
GARDEN defined in line 26; used 6 times
GIRLTALK defined in line 88; used 2 times
GIVE defined in line 138; used 1 times
HASHMASK defined in line 264; used 1 times
HASHMUL defined in line 263; used 1 times
HASHSIZE defined in line 262; used 2 times
INVEN defined in line 125; used 2 times
JUMP defined in line 155; used 1 times
KICK defined in line 156; used 3 times
KILL defined in line 128; used 2 times
KISS defined in line 136; used 1 times
LANDIT defined in line 133; used 1 times
LAUNCH defined in line 132; used 1 times
LEVIS defined in line 68; used 3 times
LIGHT defined in line 134; used 2 times
LOOK defined in line 112; used 2 times
LOVE defined in line 137; used 2 times
NECK defined in line 164; used 2 times
NUMOFNOTES defined in line 174; used 1 times
NUMOFWORDS defined in line 178; used 6 times
NWORD defined in line 217; used 3 times
OFF defined in line 142; used 2 times
ON defined in line 141; used 2 times
PATH defined in line 12; used 1 times
  • in line 13
POOLS defined in line 27; used 1 times
POT defined in line 99; used 3 times
PREPS defined in line 34; used 2 times
PUT defined in line 124; used 4 times
PUTON defined in line 122; used 1 times
QUIT defined in line 113; used 2 times
RAVAGE defined in line 129; used 2 times
RIBS defined in line 160; used 2 times
RIDE defined in line 151; used 2 times
ROBE defined in line 56; used 2 times
SAVE defined in line 150; used 1 times
SCORE defined in line 153; used 2 times
SHOOT defined in line 140; used 2 times
SKULL defined in line 162; used 3 times
SLEEP defined in line 144; used 1 times
SMITE defined in line 139; used 7 times
SOUTH defined in line 115; used 3 times
SPINE defined in line 161; used 2 times
SU defined in line 118; used 1 times
SWIM defined in line 147; used 1 times
TAKE defined in line 110; used 2 times
TAKEOFF defined in line 120; used 1 times
TANKFULL defined in line 186; used 1 times
THROW defined in line 131; used 1 times
TIME defined in line 143; used 1 times
TODAY defined in line 181; used 1 times
TONIGHT defined in line 182; used 2 times
TORPEDOES defined in line 187; used 1 times
UNDRESS defined in line 130; used 1 times
UP defined in line 104; used 3 times
USE defined in line 111; used 1 times
VERB defined in line 31; used 73 times
WEARIT defined in line 123; used 2 times
WEST defined in line 117; used 3 times
access defined in line 199; used 4 times
east defined in line 196; used 6 times
flyhere defined in line 201; used 3 times
logfile defined in line 13; used 2 times

Usage of this include

Last modified: 1985-04-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3093
Valid CSS Valid XHTML 1.0 Strict