1: /*
   2:  *  Hunt
   3:  *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
   4:  *  San Francisco, California
   5:  *
   6:  *  Copyright (c) 1985 Regents of the University of California.
   7:  *  All rights reserved.  The Berkeley software License Agreement
   8:  *  specifies the terms and conditions for redistribution.
   9:  */
  10: 
  11: # include   <stdio.h>
  12: # ifndef OLDIPC
  13: # include   <sgtty.h>
  14: # include   <sys/types.h>
  15: # include   <sys/uio.h>
  16: # else OLDIPC
  17: # include   <sys/localopts.h>
  18: # include   <sys/types.h>
  19: # include   <sys/netltoshort.h>
  20: # endif OLDIPC
  21: # include   <sys/socket.h>
  22: # ifdef INTERNET
  23: # include   <netinet/in.h>
  24: # include   <netdb.h>
  25: # ifndef OLDIPC
  26: # include   <arpa/inet.h>
  27: # endif !OLDIPC
  28: # ifdef BROADCAST
  29: # include   <net/if.h>
  30: # endif BROADCAST
  31: # else  INTERNET
  32: # include   <sys/un.h>
  33: # endif	INTERNET
  34: 
  35: # ifdef INTERNET
  36: # define    SOCK_FAMILY AF_INET
  37: # else  INTERNET
  38: # define    SOCK_FAMILY AF_UNIX
  39: # define    AF_UNIX_HACK        /* 4.2 hack; leaves files around */
  40: # endif	INTERNET
  41: 
  42: # define    ADDCH       ('a' | 0200)
  43: # define    MOVE        ('m' | 0200)
  44: # define    REFRESH     ('r' | 0200)
  45: # define    CLRTOEOL    ('c' | 0200)
  46: # define    ENDWIN      ('e' | 0200)
  47: # define    CLEAR       ('C' | 0200)
  48: # define    REDRAW      ('R' | 0200)
  49: # define    LAST_PLAYER ('l' | 0200)
  50: # define    BELL        ('b' | 0200)
  51: # define    READY       ('g' | 0200)
  52: 
  53: /*
  54:  * Choose MAXPL and MAXMON carefully.  The screen is assumed to be
  55:  * 23 lines high and will only tolerate (MAXPL == 12 && MAXMON == 0)
  56:  * or (MAXPL + MAXMON <= 10).
  57:  */
  58: # define    MAXPL       9
  59: # ifdef MONITOR
  60: # define    MAXMON      1
  61: # endif MONITOR
  62: # define    NAMELEN     20
  63: # define    MSGLEN      80
  64: # define    DECAY       50.0
  65: 
  66: # define    NASCII      128
  67: 
  68: # ifndef REFLECT
  69: # ifndef RANDOM
  70: # define RANDOM
  71: # endif RANDOM
  72: # endif REFLECT
  73: 
  74: # define    WIDTH   59
  75: # define    WIDTH2  64  /* Next power of 2 >= WIDTH (for fast access) */
  76: # define    HEIGHT  23
  77: # define    UBOUND  1
  78: # define    DBOUND  22
  79: # define    LBOUND  1
  80: # define    RBOUND  (WIDTH - 1)
  81: 
  82: # define    STAT_LABEL_COL  60
  83: # define    STAT_VALUE_COL  74
  84: # define    STAT_NAME_COL   61
  85: # define    STAT_SCAN_COL   (STAT_NAME_COL + 5)
  86: # define    STAT_NAME_ROW   0
  87: # define    STAT_AMMO_ROW   2
  88: # define    STAT_SCAN_ROW   3
  89: # define    STAT_CLOAK_ROW  4
  90: # define    STAT_GUN_ROW    5
  91: # define    STAT_DAM_ROW    7
  92: # define    STAT_KILL_ROW   8
  93: # define    STAT_PLAY_ROW   10
  94: # ifdef MONITOR
  95: # define    STAT_MON_ROW    (STAT_PLAY_ROW + MAXPL + 1)
  96: # endif MONITOR
  97: # define    STAT_NAME_LEN   16
  98: 
  99: # define    DOOR    '#'
 100: # define    WALL1   '-'
 101: # define    WALL2   '|'
 102: # define    WALL3   '+'
 103: # ifdef REFLECT
 104: # define    WALL4   '/'
 105: # define    WALL5   '\\'
 106: # endif REFLECT
 107: # define    KNIFE   'K'
 108: # define    SHOT    ':'
 109: # define    GRENADE 'o'
 110: # define    SATCHEL 'O'
 111: # define    BOMB    '@'
 112: # define    MINE    ';'
 113: # define    GMINE   'g'
 114: # ifdef OOZE
 115: # define    SLIME   '$'
 116: # endif	OOZE
 117: # ifdef VOLCANO
 118: # define    LAVA    '~'
 119: # endif	VOLCANO
 120: # ifdef FLY
 121: # define    FALL    'F'
 122: # endif FLY
 123: # define    SPACE   ' '
 124: 
 125: # define    ABOVE   'i'
 126: # define    BELOW   '!'
 127: # define    RIGHT   '}'
 128: # define    LEFTS   '{'
 129: # ifdef FLY
 130: # define    FLYER   '&'
 131: # endif FLY
 132: 
 133: # define    NORTH   01
 134: # define    SOUTH   02
 135: # define    EAST    010
 136: # define    WEST    020
 137: 
 138: # ifndef TRUE
 139: # define    TRUE    1
 140: # define    FALSE   0
 141: # endif TRUE
 142: # ifndef CTRL
 143: # define    CTRL(x) ('x' & 037)
 144: # endif CTRL
 145: 
 146: # define    BULSPD      5       /* bullets movement speed */
 147: # define    ISHOTS      15
 148: # define    NSHOTS      5
 149: # define    MAXNCSHOT   2
 150: # define    MAXDAM      10
 151: # define    MINDAM      5
 152: # define    STABDAM     2
 153: 
 154: # define    BULREQ      1
 155: # define    GRENREQ     9
 156: # define    SATREQ      25
 157: # define    BOMBREQ     49
 158: # ifdef OOZE
 159: # define    SLIMEREQ    15
 160: # define    SSLIMEREQ   30
 161: # define    SLIMESPEED  5
 162: # endif	OOZE
 163: # ifdef VOLCANO
 164: # define    LAVASPEED   2
 165: # endif VOLCANO
 166: 
 167: # define    CLOAKLEN    20
 168: # define    SCANLEN     (Nplayer * 20)
 169: # define    EXPLEN      4
 170: 
 171: # ifdef FLY
 172: # define    _cloak_char(pp) (((pp)->p_cloak < 0) ? ' ' : '+')
 173: # define    _scan_char(pp)  (((pp)->p_scan < 0) ? _cloak_char(pp) : '*')
 174: # define    stat_char(pp)   (((pp)->p_flying < 0) ? _scan_char(pp) : FLYER)
 175: # else FLY
 176: # define    _cloak_char(pp) (((pp)->p_cloak < 0) ? ' ' : '+')
 177: # define    stat_char(pp)   (((pp)->p_scan < 0) ? _cloak_char(pp) : '*')
 178: # endif FLY
 179: 
 180: typedef int         FLAG;
 181: typedef struct bullet_def   BULLET;
 182: typedef struct expl_def     EXPL;
 183: typedef struct player_def   PLAYER;
 184: typedef struct ident_def    IDENT;
 185: typedef struct regen_def    REGEN;
 186: # ifdef INTERNET
 187: typedef struct sockaddr_in  SOCKET;
 188: # else  INTERNET
 189: typedef struct sockaddr_un  SOCKET;
 190: # endif	INTERNET
 191: typedef struct sgttyb       TTYB;
 192: 
 193: struct ident_def {
 194:     char    i_name[NAMELEN];
 195:     long    i_machine;
 196:     long    i_uid;
 197:     int i_kills;
 198:     int i_entries;
 199:     float   i_score;
 200:     IDENT   *i_next;
 201: };
 202: 
 203: struct player_def {
 204:     IDENT   *p_ident;
 205:     int p_face;
 206:     char    p_over;
 207:     int p_undershot;
 208: # ifdef FLY
 209:     int p_flying;
 210:     int p_flyx, p_flyy;
 211: # endif FLY
 212:     FILE    *p_output;
 213:     int p_fd;
 214:     int p_mask;
 215:     int p_damage;
 216:     int p_damcap;
 217:     int p_ammo;
 218:     int p_ncshot;
 219:     int p_scan;
 220:     int p_cloak;
 221:     int p_x, p_y;
 222:     int p_ncount;
 223:     int p_nexec;
 224:     long    p_nchar;
 225:     char    p_death[MSGLEN];
 226:     char    p_maze[HEIGHT][WIDTH2];
 227:     int p_curx, p_cury;
 228:     int p_lastx, p_lasty;
 229:     int p_changed;
 230:     char    p_cbuf[BUFSIZ];
 231: };
 232: 
 233: struct bullet_def {
 234:     int b_x, b_y;
 235:     int b_face;
 236:     int b_charge;
 237:     char    b_type;
 238:     char    b_over;
 239:     PLAYER  *b_owner;
 240:     IDENT   *b_score;
 241:     FLAG    b_expl;
 242:     BULLET  *b_next;
 243: };
 244: 
 245: struct expl_def {
 246:     int e_x, e_y;
 247:     char    e_char;
 248:     EXPL    *e_next;
 249: };
 250: 
 251: struct regen_def {
 252:     int r_x, r_y;
 253:     REGEN   *r_next;
 254: };
 255: 
 256: /*
 257:  * external variables
 258:  */
 259: 
 260: extern FLAG Last_player;
 261: 
 262: extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
 263: 
 264: extern char *Sock_name, *Driver;
 265: 
 266: extern int  errno, Have_inp, Nplayer, Num_fds, Socket;
 267: extern long Fds_mask, Sock_mask;
 268: 
 269: # ifdef INTERNET
 270: extern int  Test_port;
 271: extern int  Sock_port;
 272: # else INTERNET
 273: extern char *Sock_name;
 274: # endif INTERNET
 275: 
 276: # ifdef VOLCANO
 277: extern int  volcano;
 278: # endif	VOLCANO
 279: 
 280: extern int  See_over[NASCII];
 281: 
 282: extern BULLET   *Bullets;
 283: 
 284: extern EXPL *Expl[EXPLEN];
 285: 
 286: extern IDENT    *Scores;
 287: 
 288: extern PLAYER   Player[MAXPL], *End_player;
 289: 
 290: # ifdef MONITOR
 291: extern FLAG Am_monitor;
 292: extern PLAYER   Monitor[MAXMON], *End_monitor;
 293: # endif MONITOR
 294: 
 295: /*
 296:  * function types
 297:  */
 298: 
 299: char    *getenv(), *malloc(), *sprintf(), *strcpy(), *strncpy();
 300: 
 301: IDENT   *get_ident();
 302: 
 303: int moveshots();
 304: 
 305: BULLET  *is_bullet(), *create_shot();
 306: 
 307: PLAYER  *play_at();

Defined struct's

bullet_def defined in line 233; used 1 times
expl_def defined in line 245; used 1 times
ident_def defined in line 193; used 1 times
player_def defined in line 203; used 1 times
regen_def defined in line 251; used 1 times

Defined typedef's

BULLET defined in line 181; used 31 times
EXPL defined in line 182; used 8 times
REGEN defined in line 185; used 4 times
SOCKET defined in line 187; used 10 times
TTYB defined in line 191; never used

Defined macros

ADDCH defined in line 42; never used
AF_UNIX_HACK defined in line 39; used 1 times
BELL defined in line 50; used 1 times
BOMB defined in line 111; used 3 times
BOMBREQ defined in line 157; used 3 times
BULREQ defined in line 154; used 3 times
BULSPD defined in line 146; used 1 times
CLEAR defined in line 47; used 1 times
CLOAKLEN defined in line 167; used 2 times
CLRTOEOL defined in line 45; used 1 times
CTRL defined in line 143; used 6 times
DECAY defined in line 64; never used
EAST defined in line 135; used 8 times
ENDWIN defined in line 46; used 4 times
EXPLEN defined in line 169; used 5 times
FALL defined in line 121; used 1 times
FLYER defined in line 130; used 6 times
ISHOTS defined in line 147; used 1 times
KNIFE defined in line 107; used 1 times
LAST_PLAYER defined in line 49; used 4 times
LAVA defined in line 118; used 3 times
LAVASPEED defined in line 164; used 1 times
LBOUND defined in line 79; used 6 times
MAXMON defined in line 60; used 3 times
MAXNCSHOT defined in line 149; used 6 times
MAXPL defined in line 58; used 4 times
MINDAM defined in line 151; used 5 times
MOVE defined in line 43; used 1 times
MSGLEN defined in line 63; used 1 times
NAMELEN defined in line 62; used 10 times
NASCII defined in line 66; used 3 times
NORTH defined in line 133; used 9 times
NSHOTS defined in line 148; used 2 times
READY defined in line 51; used 4 times
REDRAW defined in line 48; used 3 times
SATCHEL defined in line 110; used 3 times
SATREQ defined in line 156; used 3 times
SCANLEN defined in line 168; used 1 times
SHOT defined in line 108; used 3 times
SLIMEREQ defined in line 159; used 3 times
SLIMESPEED defined in line 161; used 2 times
SOCK_FAMILY defined in line 38; used 14 times
SOUTH defined in line 134; used 8 times
SSLIMEREQ defined in line 160; used 3 times
STABDAM defined in line 152; used 3 times
STAT_CLOAK_ROW defined in line 89; used 5 times
STAT_DAM_ROW defined in line 91; used 4 times
STAT_GUN_ROW defined in line 90; used 5 times
STAT_KILL_ROW defined in line 92; used 3 times
STAT_LABEL_COL defined in line 82; used 9 times
STAT_NAME_COL defined in line 84; used 16 times
STAT_NAME_ROW defined in line 86; used 1 times
STAT_PLAY_ROW defined in line 93; used 8 times
STAT_SCAN_COL defined in line 85; used 2 times
STAT_SCAN_ROW defined in line 88; used 5 times
UBOUND defined in line 77; used 6 times
WALL1 defined in line 100; used 2 times
WALL2 defined in line 101; used 2 times
WALL3 defined in line 102; used 2 times
WEST defined in line 136; used 9 times
WIDTH2 defined in line 75; used 5 times
_cloak_char defined in line 176; used 2 times
_scan_char defined in line 173; used 1 times

Usage of this include

Last modified: 1986-01-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 5964
Valid CSS Valid XHTML 1.0 Strict