Annotation of 43BSDTahoe/games/battlestar/externs.h, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.