Bring hunt in from OpenBSD. The best multi-player terminal game ever!
[dragonfly.git] / games / hunt / huntd / extern.c
1 /*
2  * Copyright (c) 1983-2003, Regents of the University of California.
3  * All rights reserved.
4  * 
5  * Redistribution and use in source and binary forms, with or without 
6  * modification, are permitted provided that the following conditions are 
7  * met:
8  * 
9  * + Redistributions of source code must retain the above copyright 
10  *   notice, this list of conditions and the following disclaimer.
11  * + Redistributions in binary form must reproduce the above copyright 
12  *   notice, this list of conditions and the following disclaimer in the 
13  *   documentation and/or other materials provided with the distribution.
14  * + Neither the name of the University of California, San Francisco nor 
15  *   the names of its contributors may be used to endorse or promote 
16  *   products derived from this software without specific prior written 
17  *   permission.
18  * 
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
22  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  * $OpenBSD: extern.c,v 1.4 2003/06/11 08:45:33 pjanzen Exp $
32  * $NetBSD: extern.c,v 1.2 1997/10/10 16:33:24 lukem Exp $
33  * $DragonFly: src/games/hunt/huntd/extern.c,v 1.1 2008/09/02 21:50:21 dillon Exp $
34  */
35
36 # include       "hunt.h"
37 # include       "server.h"
38
39 FLAG    Am_monitor = FALSE;             /* current process is a monitor */
40
41 char    Buf[BUFSIZ];                    /* general scribbling buffer */
42 char    Maze[HEIGHT][WIDTH2];           /* the maze */
43 char    Orig_maze[HEIGHT][WIDTH2];      /* the original maze */
44
45 fd_set  Fds_mask;                       /* mask for the file descriptors */
46 fd_set  Have_inp;                       /* which file descriptors have input */
47 int     Nplayer = 0;                    /* number of players */
48 int     Num_fds;                        /* number of maximum file descriptor */
49 int     Socket;                         /* main socket */
50 int     Status;                         /* stat socket */
51 int     See_over[NASCII];               /* lookup table for determining whether
52                                          * character represents "transparent"
53                                          * item */
54
55 BULLET  *Bullets = NULL;                /* linked list of bullets */
56
57 EXPL    *Expl[EXPLEN];                  /* explosion lists */
58 EXPL    *Last_expl;                     /* last explosion on Expl[0] */
59
60 PLAYER  Player[MAXPL];                  /* all the players */
61 PLAYER  *End_player = Player;           /* last active player slot */
62 PLAYER  Boot[NBOOTS];                   /* all the boots */
63 IDENT   *Scores;                        /* score cache */
64 PLAYER  Monitor[MAXMON];                /* all the monitors */
65 PLAYER  *End_monitor = Monitor;         /* last active monitor slot */
66
67 int     volcano = 0;                    /* Explosion size */
68
69 int     shot_req[MAXBOMB]       = {
70                                 BULREQ, GRENREQ, SATREQ,
71                                 BOMB7REQ, BOMB9REQ, BOMB11REQ,
72                                 BOMB13REQ, BOMB15REQ, BOMB17REQ,
73                                 BOMB19REQ, BOMB21REQ,
74                         };
75 int     shot_type[MAXBOMB]      = {
76                                 SHOT, GRENADE, SATCHEL,
77                                 BOMB, BOMB, BOMB,
78                                 BOMB, BOMB, BOMB,
79                                 BOMB, BOMB,
80                         };
81
82 int     slime_req[MAXSLIME]     = {
83                                 SLIMEREQ, SSLIMEREQ, SLIME2REQ, SLIME3REQ,
84                         };