]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hunt/huntd/hunt.h
1 /* $NetBSD: hunt.h,v 1.22 2014/03/29 20:16:09 dholland Exp $ */
4 * Copyright (c) 1983-2003, Regents of the University of California.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
11 * + Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * + Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * + Neither the name of the University of California, San Francisco nor
17 * the names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior written
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 #include <sys/ioctl.h>
43 #include <sys/types.h>
48 #include <netinet/in.h>
50 #include <arpa/inet.h>
57 #define SOCK_FAMILY AF_INET
59 #define SOCK_FAMILY AF_UNIX
60 #define AF_UNIX_HACK /* 4.2 hack; leaves files around */
64 * Preprocessor define dependencies
66 #if defined(VOLCANO) && !defined(OOZE)
69 #if defined(BOOTS) && !defined(FLY)
72 #if !defined(REFLECT) && !defined(RANDOM)
76 /* decrement version number for each change in startup protocol */
77 #define HUNT_VERSION -1
79 #define ADDCH ('a' | 0200)
80 #define MOVE ('m' | 0200)
81 #define REFRESH ('r' | 0200)
82 #define CLRTOEOL ('c' | 0200)
83 #define ENDWIN ('e' | 0200)
84 #define CLEAR ('C' | 0200)
85 #define REDRAW ('R' | 0200)
86 #define LAST_PLAYER ('l' | 0200)
87 #define BELL ('b' | 0200)
88 #define READY ('g' | 0200)
91 * Choose MAXPL and MAXMON carefully. The screen is assumed to be
92 * 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
93 * or (MAXPL + MAXMON <= 16).
102 #define SHORTLEN 2 /* sizeof (network short) */
103 #define LONGLEN 4 /* sizeof (network long) */
105 #define MSGLEN SCREEN_WIDTH
111 #define WIDTH2 64 /* Next power of 2 >= WIDTH (for fast access) */
114 #define DBOUND (HEIGHT - 1)
116 #define RBOUND (WIDTH - 1)
118 #define SCREEN_HEIGHT 24
119 #define SCREEN_WIDTH 80
120 #define SCREEN_WIDTH2 128 /* Next power of 2 >= SCREEN_WIDTH */
122 #define STAT_LABEL_COL 60
123 #define STAT_VALUE_COL 74
124 #define STAT_NAME_COL 61
125 #define STAT_SCAN_COL (STAT_NAME_COL + 5)
126 #define STAT_AMMO_ROW 0
127 #define STAT_GUN_ROW 1
128 #define STAT_DAM_ROW 2
129 #define STAT_KILL_ROW 3
130 #define STAT_PLAY_ROW 5
132 #define STAT_MON_ROW (STAT_PLAY_ROW + MAXPL + 1)
134 #define STAT_NAME_LEN 18
166 #define BOOT_PAIR 'B'
176 #define isplayer(c) (c == LEFTS || c == RIGHT ||\
177 c == ABOVE || c == BELOW || c == FLYER)
179 #define isplayer(c) (c == LEFTS || c == RIGHT ||\
180 c == ABOVE || c == BELOW)
189 #define CTRL(x) ((x) & 037)
191 #define BULSPD 5 /* bullets movement speed */
204 #define BOMB11REQ 121
205 #define BOMB13REQ 169
206 #define BOMB15REQ 225
207 #define BOMB17REQ 289
208 #define BOMB19REQ 361
209 #define BOMB21REQ 441
212 #define MINDSHOT 2 /* At least a satchel bomb */
214 extern int shot_req
[];
215 extern int shot_type
[];
217 #define SLIME_FACTOR 3
224 extern int slime_req
[];
231 #define SCANLEN (Nplayer * 20)
246 #define C_TESTMSG() (Query_driver ? C_MESSAGE :\
247 (Show_scores ? C_SCORES :\
248 (Am_monitor ? C_MONITOR :\
251 #define C_TESTMSG() (Show_scores ? C_SCORES :\
252 (Query_driver ? C_MESSAGE :\
257 #define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
258 #define _cloak_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
259 #define stat_char(pp) (((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
261 #define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
262 #define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
265 typedef struct bullet_def BULLET
;
266 typedef struct expl_def EXPL
;
267 typedef struct player_def PLAYER
;
268 typedef struct ident_def IDENT
;
269 typedef struct regen_def REGEN
;
271 typedef struct sockaddr_in SOCKET
;
273 typedef struct sockaddr_un SOCKET
;
277 char i_name
[NAMELEN
];
291 int i_gkills
, i_bkills
, i_deaths
, i_stillb
, i_saved
;
320 char p_death
[MSGLEN
];
321 char p_maze
[HEIGHT
][WIDTH2
];
323 int p_lastx
, p_lasty
;
355 extern bool Last_player
;
357 extern char Buf
[BUFSIZ
], Maze
[HEIGHT
][WIDTH2
], Orig_maze
[HEIGHT
][WIDTH2
];
359 extern const char *Driver
;
361 extern int Nplayer
, Socket
, Status
;
362 extern struct pollfd fdset
[];
365 extern u_short Test_port
;
367 extern char *Sock_name
, *Stat_name
;
374 extern int See_over
[NASCII
];
376 extern BULLET
*Bullets
;
378 extern EXPL
*Expl
[EXPLEN
];
379 extern EXPL
*Last_expl
;
381 extern IDENT
*Scores
;
383 extern PLAYER Player
[MAXPL
], *End_player
;
385 extern PLAYER Boot
[NBOOTS
];
389 extern bool Am_monitor
;
390 extern PLAYER Monitor
[MAXMON
], *End_monitor
;
394 extern char *Send_message
;
397 extern char map_key
[256];
404 void add_shot(int, int, int, char, int, PLAYER
*, int, char);
406 void bad_con(void) __dead
;
407 void bad_ver(void) __dead
;
409 void cgoto(PLAYER
*, int, int);
410 void check(PLAYER
*, int, int);
411 void checkdam(PLAYER
*, PLAYER
*, IDENT
*, int, char);
412 void clearwalls(void);
413 void clear_eol(void);
414 void clear_the_screen(void);
415 void clrscr(PLAYER
*);
416 BULLET
*create_shot(int, int, int, char, int, int, PLAYER
*,
418 void do_connect(char *, char, long);
419 void do_message(void);
420 void drawmaze(PLAYER
*);
421 void drawplayer(PLAYER
*, bool);
422 void execute(PLAYER
*);
424 void fixshots(int, int, char);
425 void get_local_name(const char *);
426 int get_remote_name(char *);
427 BULLET
*is_bullet(int, int);
430 void message(PLAYER
*, const char *);
431 void mon_execute(PLAYER
*);
432 void moveshots(void);
434 bool opposite(int, char);
435 void otto(int, int, char);
436 void outch(PLAYER
*, int);
437 void outstr(PLAYER
*, const char *, int);
438 PLAYER
*play_at(int, int);
441 void put_str(char *);
446 void sendcom(PLAYER
*, int, ...);
447 void showexpl(int, int, char);
448 void showstat(PLAYER
*);
449 void cleanup(int) __dead
;