Annotation of 43BSDReno/games/hunt/common_source/hunt.h, revision 1.1

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

unix.superglobalmegacorp.com

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