2 * Copyright (c) 1983-2003, Regents of the University of California.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. 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 * 3. 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
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.
31 * $OpenBSD: server.h,v 1.9 2004/01/16 00:13:19 espie Exp $
32 * $NetBSD: hunt.h,v 1.5 1998/09/13 15:27:28 hubertf Exp $
33 * $DragonFly: src/games/hunt/huntd/server.h,v 1.1 2008/09/02 21:50:21 dillon Exp $
38 #include <sys/socket.h>
39 #include <sys/types.h>
42 #define __attribute__(x)
46 * Choose MAXPL and MAXMON carefully. The screen is assumed to be
47 * 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
48 * or (MAXPL + MAXMON <= 16).
52 #if (MAXPL + MAXMON > 16)
53 #warning "MAXPL + MAXMON is excessive"
56 #define MSGLEN SCREEN_WIDTH
59 #define DBOUND (HEIGHT - 1)
61 #define RBOUND (WIDTH - 1)
65 /* Layout of the scoreboard: */
66 #define STAT_LABEL_COL 60
67 #define STAT_VALUE_COL 74
68 #define STAT_NAME_COL 61
69 #define STAT_SCAN_COL (STAT_NAME_COL + 5)
70 #define STAT_AMMO_ROW 0
71 #define STAT_GUN_ROW 1
72 #define STAT_DAM_ROW 2
73 #define STAT_KILL_ROW 3
74 #define STAT_PLAY_ROW 5
75 #define STAT_MON_ROW (STAT_PLAY_ROW + MAXPL + 1)
76 #define STAT_NAME_LEN 18
78 /* Number of boots: */
81 /* Bitmask of directions */
88 #define CTRL(x) ((x) & 037)
90 #define BULREQ 1 /* 0 */
91 #define GRENREQ 9 /* 1 */
92 #define SATREQ 25 /* 2 */
93 #define BOMB7REQ 49 /* 3 */
94 #define BOMB9REQ 81 /* 4 */
95 #define BOMB11REQ 121 /* 5 */
96 #define BOMB13REQ 169 /* 6 */
97 #define BOMB15REQ 225 /* 7 */
98 #define BOMB17REQ 289 /* 8 */
99 #define BOMB19REQ 361 /* 9 */
100 #define BOMB21REQ 441 /* 10 */
103 #define SLIMEREQ 5 /* 0 */
104 #define SSLIMEREQ 10 /* 1 */
105 #define SLIME2REQ 15 /* 2 */
106 #define SLIME3REQ 20 /* 3 */
111 #define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
112 #define _cloak_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
113 #define stat_char(pp) (((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
115 typedef struct bullet_def BULLET;
116 typedef struct expl_def EXPL;
117 typedef struct player_def PLAYER;
118 typedef struct ident_def IDENT;
119 typedef struct regen_def REGEN;
121 #define ALL_PLAYERS ((PLAYER *)1)
124 char i_name[NAMELEN];
138 int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
163 char p_death[MSGLEN];
164 char p_maze[HEIGHT][WIDTH2];
166 int p_lastx, p_lasty;
197 struct sockaddr source;
200 char name[NAMELEN+1];
202 u_int32_t enter_status;
203 char ttyname[NAMELEN];
208 struct spawn ** prevnext;
210 char inbuf[ sizeof (u_int32_t) + NAMELEN +
211 sizeof (u_int8_t) + sizeof (u_int32_t) +
212 NAMELEN + sizeof (u_int32_t) ];
215 extern struct spawn * Spawn;
220 void answer_first(void);
221 int answer_next(struct spawn *);
223 void answer_info(FILE *);
226 void drawmaze(PLAYER *);
228 void check(PLAYER *, int, int);
229 void showstat(PLAYER *);
230 void drawplayer(PLAYER *, FLAG);
231 void message(PLAYER *, const char *);
235 void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
239 void mon_execute(PLAYER *);
240 void execute(PLAYER *);
241 void add_shot(int, int, int, char, int, PLAYER *, int, char);
242 BULLET *create_shot(int, int, int, char, int, int, PLAYER *, IDENT *,
244 void ammo_update(PLAYER *);
247 void showexpl(int, int, char);
249 void clearwalls(void);
250 int can_rollexpl(void);
256 int can_moveshots(void);
257 void moveshots(void);
258 PLAYER *play_at(int, int);
259 int opposite(int, char);
260 BULLET *is_bullet(int, int);
261 void fixshots(int, int, char);
264 void cgoto(PLAYER *, int, int);
265 void outch(PLAYER *, char);
266 void outstr(PLAYER *, const char *, int);
267 void outyx(PLAYER *, int, int, const char *, ...)
268 __attribute__((format (printf, 4, 5)));
269 void clrscr(PLAYER *);
271 void sendcom(PLAYER *, int, ...);
272 void flush(PLAYER *);
273 void logit(int, const char *, ...)
274 __attribute__((format (printf, 2, 3)));
275 void logx(int, const char *, ...)
276 __attribute__((format (printf, 2, 3)));
279 extern FLAG Am_monitor;
280 extern char Buf[BUFSIZ];
281 extern char Maze[HEIGHT][WIDTH2];
282 extern char Orig_maze[HEIGHT][WIDTH2];
283 extern fd_set Fds_mask;
284 extern fd_set Have_inp;
288 extern int See_over[NASCII];
289 extern BULLET * Bullets;
290 extern EXPL * Expl[EXPLEN];
291 extern EXPL * Last_expl;
292 extern PLAYER Player[MAXPL];
293 extern PLAYER * End_player;
294 extern PLAYER Boot[NBOOTS];
295 extern IDENT * Scores;
296 extern PLAYER Monitor[MAXMON];
297 extern PLAYER * End_monitor;
299 extern int shot_req[MAXBOMB];
300 extern int shot_type[MAXBOMB];
301 extern int slime_req[MAXSLIME];