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 * + 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
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>
41 #define __attribute__(x)
45 * Choose MAXPL and MAXMON carefully. The screen is assumed to be
46 * 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
47 * or (MAXPL + MAXMON <= 16).
51 #if (MAXPL + MAXMON > 16)
52 #warning "MAXPL + MAXMON is excessive"
55 #define MSGLEN SCREEN_WIDTH
58 #define DBOUND (HEIGHT - 1)
60 #define RBOUND (WIDTH - 1)
64 /* Layout of the scoreboard: */
65 #define STAT_LABEL_COL 60
66 #define STAT_VALUE_COL 74
67 #define STAT_NAME_COL 61
68 #define STAT_SCAN_COL (STAT_NAME_COL + 5)
69 #define STAT_AMMO_ROW 0
70 #define STAT_GUN_ROW 1
71 #define STAT_DAM_ROW 2
72 #define STAT_KILL_ROW 3
73 #define STAT_PLAY_ROW 5
74 #define STAT_MON_ROW (STAT_PLAY_ROW + MAXPL + 1)
75 #define STAT_NAME_LEN 18
77 /* Number of boots: */
80 /* Bitmask of directions */
87 #define CTRL(x) ((x) & 037)
89 #define BULREQ 1 /* 0 */
90 #define GRENREQ 9 /* 1 */
91 #define SATREQ 25 /* 2 */
92 #define BOMB7REQ 49 /* 3 */
93 #define BOMB9REQ 81 /* 4 */
94 #define BOMB11REQ 121 /* 5 */
95 #define BOMB13REQ 169 /* 6 */
96 #define BOMB15REQ 225 /* 7 */
97 #define BOMB17REQ 289 /* 8 */
98 #define BOMB19REQ 361 /* 9 */
99 #define BOMB21REQ 441 /* 10 */
102 #define SLIMEREQ 5 /* 0 */
103 #define SSLIMEREQ 10 /* 1 */
104 #define SLIME2REQ 15 /* 2 */
105 #define SLIME3REQ 20 /* 3 */
110 #define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
111 #define _cloak_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
112 #define stat_char(pp) (((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
114 typedef struct bullet_def BULLET;
115 typedef struct expl_def EXPL;
116 typedef struct player_def PLAYER;
117 typedef struct ident_def IDENT;
118 typedef struct regen_def REGEN;
120 #define ALL_PLAYERS ((PLAYER *)1)
123 char i_name[NAMELEN];
137 int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
162 char p_death[MSGLEN];
163 char p_maze[HEIGHT][WIDTH2];
165 int p_lastx, p_lasty;
196 struct sockaddr source;
199 char name[NAMELEN+1];
201 u_int32_t enter_status;
202 char ttyname[NAMELEN];
207 struct spawn ** prevnext;
209 char inbuf[ sizeof (u_int32_t) + NAMELEN +
210 sizeof (u_int8_t) + sizeof (u_int32_t) +
211 NAMELEN + sizeof (u_int32_t) ];
214 extern struct spawn * Spawn;
219 void answer_first(void);
220 int answer_next(struct spawn *);
222 void answer_info(FILE *);
225 void drawmaze(PLAYER *);
227 void check(PLAYER *, int, int);
228 void showstat(PLAYER *);
229 void drawplayer(PLAYER *, FLAG);
230 void message(PLAYER *, const char *);
234 void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
238 void mon_execute(PLAYER *);
239 void execute(PLAYER *);
240 void add_shot(int, int, int, char, int, PLAYER *, int, char);
241 BULLET *create_shot(int, int, int, char, int, int, PLAYER *, IDENT *,
243 void ammo_update(PLAYER *);
246 void showexpl(int, int, char);
248 void clearwalls(void);
249 int can_rollexpl(void);
255 int can_moveshots(void);
256 void moveshots(void);
257 PLAYER *play_at(int, int);
258 int opposite(int, char);
259 BULLET *is_bullet(int, int);
260 void fixshots(int, int, char);
263 void cgoto(PLAYER *, int, int);
264 void outch(PLAYER *, char);
265 void outstr(PLAYER *, const char *, int);
266 void outyx(PLAYER *, int, int, const char *, ...)
267 __attribute__((format (printf, 4, 5)));
268 void clrscr(PLAYER *);
270 void sendcom(PLAYER *, int, ...);
271 void flush(PLAYER *);
272 void logit(int, const char *, ...)
273 __attribute__((format (printf, 2, 3)));
274 void logx(int, const char *, ...)
275 __attribute__((format (printf, 2, 3)));
278 extern FLAG Am_monitor;
279 extern char Buf[BUFSIZ];
280 extern char Maze[HEIGHT][WIDTH2];
281 extern char Orig_maze[HEIGHT][WIDTH2];
282 extern fd_set Fds_mask;
283 extern fd_set Have_inp;
287 extern int See_over[NASCII];
288 extern BULLET * Bullets;
289 extern EXPL * Expl[EXPLEN];
290 extern EXPL * Last_expl;
291 extern PLAYER Player[MAXPL];
292 extern PLAYER * End_player;
293 extern PLAYER Boot[NBOOTS];
294 extern IDENT * Scores;
295 extern PLAYER Monitor[MAXMON];
296 extern PLAYER * End_monitor;
298 extern int shot_req[MAXBOMB];
299 extern int shot_type[MAXBOMB];
300 extern int slime_req[MAXSLIME];