]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hunt/huntd/hunt.h
1 /* $NetBSD: hunt.h,v 1.4 1998/09/11 13:46:30 hubertf Exp $ */
5 * Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
6 * San Francisco, California
16 # if !defined(TERMINFO) && BSD_RELEASE < 44
19 # include <sys/ioctl.h>
21 # include <sys/types.h>
23 # include <sys/socket.h>
25 # include <netinet/in.h>
27 # include <arpa/inet.h>
36 # define SOCK_FAMILY AF_INET
38 # define SOCK_FAMILY AF_UNIX
39 # define AF_UNIX_HACK /* 4.2 hack; leaves files around */
43 * Preprocessor define dependencies
45 # if defined(VOLCANO) && !defined(OOZE)
48 # if defined(BOOTS) && !defined(FLY)
51 # if !defined(REFLECT) && !defined(RANDOM)
55 /* mvcur() in terminfo needs the curses library to be initialized to not
56 * coredump, so give up and use it. */
60 /* decrement version number for each change in startup protocol */
61 # define HUNT_VERSION -1
63 # define ADDCH ('a' | 0200)
64 # define MOVE ('m' | 0200)
65 # define REFRESH ('r' | 0200)
66 # define CLRTOEOL ('c' | 0200)
67 # define ENDWIN ('e' | 0200)
68 # define CLEAR ('C' | 0200)
69 # define REDRAW ('R' | 0200)
70 # define LAST_PLAYER ('l' | 0200)
71 # define BELL ('b' | 0200)
72 # define READY ('g' | 0200)
75 * Choose MAXPL and MAXMON carefully. The screen is assumed to be
76 * 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
77 * or (MAXPL + MAXMON <= 16).
85 # define SHORTLEN 2 /* sizeof (network short) */
86 # define LONGLEN 4 /* sizeof (network long) */
88 # define MSGLEN SCREEN_WIDTH
94 # define WIDTH2 64 /* Next power of 2 >= WIDTH (for fast access) */
97 # define DBOUND (HEIGHT - 1)
99 # define RBOUND (WIDTH - 1)
101 # define SCREEN_HEIGHT 24
102 # define SCREEN_WIDTH 80
103 # define SCREEN_WIDTH2 128 /* Next power of 2 >= SCREEN_WIDTH */
105 # define STAT_LABEL_COL 60
106 # define STAT_VALUE_COL 74
107 # define STAT_NAME_COL 61
108 # define STAT_SCAN_COL (STAT_NAME_COL + 5)
109 # define STAT_AMMO_ROW 0
110 # define STAT_GUN_ROW 1
111 # define STAT_DAM_ROW 2
112 # define STAT_KILL_ROW 3
113 # define STAT_PLAY_ROW 5
115 # define STAT_MON_ROW (STAT_PLAY_ROW + MAXPL + 1)
117 # define STAT_NAME_LEN 18
149 # define BOOT_PAIR 'B'
159 # define isplayer(c) (c == LEFTS || c == RIGHT ||\
160 c == ABOVE || c == BELOW || c == FLYER)
162 # define isplayer(c) (c == LEFTS || c == RIGHT ||\
163 c == ABOVE || c == BELOW)
176 # define CTRL(x) ((x) & 037)
178 # define BULSPD 5 /* bullets movement speed */
191 # define BOMB11REQ 121
192 # define BOMB13REQ 169
193 # define BOMB15REQ 225
194 # define BOMB17REQ 289
195 # define BOMB19REQ 361
196 # define BOMB21REQ 441
199 # define MINDSHOT 2 /* At least a satchel bomb */
201 extern int shot_req
[];
202 extern int shot_type
[];
204 # define SLIME_FACTOR 3
206 # define SSLIMEREQ 10
207 # define SLIME2REQ 15
208 # define SLIME3REQ 20
210 # define SLIMESPEED 5
211 extern int slime_req
[];
218 # define SCANLEN (Nplayer * 20)
233 # define C_TESTMSG() (Query_driver ? C_MESSAGE :\
234 (Show_scores ? C_SCORES :\
235 (Am_monitor ? C_MONITOR :\
238 # define C_TESTMSG() (Show_scores ? C_SCORES :\
239 (Query_driver ? C_MESSAGE :\
244 # define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
245 # define _cloak_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
246 # define stat_char(pp) (((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
248 # define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
249 # define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
253 typedef struct bullet_def BULLET
;
254 typedef struct expl_def EXPL
;
255 typedef struct player_def PLAYER
;
256 typedef struct ident_def IDENT
;
257 typedef struct regen_def REGEN
;
259 typedef struct sockaddr_in SOCKET
;
261 typedef struct sockaddr_un SOCKET
;
265 char i_name
[NAMELEN
];
279 int i_gkills
, i_bkills
, i_deaths
, i_stillb
, i_saved
;
308 char p_death
[MSGLEN
];
309 char p_maze
[HEIGHT
][WIDTH2
];
311 int p_lastx
, p_lasty
;
343 extern FLAG Last_player
;
345 extern char Buf
[BUFSIZ
], Maze
[HEIGHT
][WIDTH2
], Orig_maze
[HEIGHT
][WIDTH2
];
347 extern char *Sock_name
, *Driver
;
349 extern int errno
, Nplayer
, Num_fds
, Socket
, Status
;
350 extern fd_set Fds_mask
, Have_inp
;
353 extern u_short Test_port
;
355 extern char *Sock_name
;
362 extern int See_over
[NASCII
];
364 extern BULLET
*Bullets
;
366 extern EXPL
*Expl
[EXPLEN
];
367 extern EXPL
*Last_expl
;
369 extern IDENT
*Scores
;
371 extern PLAYER Player
[MAXPL
], *End_player
;
373 extern PLAYER Boot
[NBOOTS
];
377 extern FLAG Am_monitor
;
378 extern PLAYER Monitor
[MAXMON
], *End_monitor
;
382 extern char *Send_message
;
385 extern char map_key
[256];
392 void add_shot
__P((int, int, int, char, int, PLAYER
*, int, char));
393 int answer
__P((void));
394 void bad_con
__P((void));
395 void bad_ver
__P((void));
396 int broadcast_vec
__P((int, struct sockaddr
**));
397 void ce
__P((PLAYER
*));
398 void cgoto
__P((PLAYER
*, int, int));
399 void check
__P((PLAYER
*, int, int));
400 void checkdam
__P((PLAYER
*, PLAYER
*, IDENT
*, int, char));
401 void clearwalls
__P((void));
402 void clear_eol
__P((void));
403 void clear_the_screen
__P((void));
404 void clrscr
__P((PLAYER
*));
405 BULLET
*create_shot
__P((int, int, int, char, int, int, PLAYER
*,
406 IDENT
*, int, char));
407 void do_connect
__P((char *, char, long));
408 void do_message
__P((void));
409 void drawmaze
__P((PLAYER
*));
410 void drawplayer
__P((PLAYER
*, FLAG
));
411 void drawstatus
__P((PLAYER
*));
412 void execute
__P((PLAYER
*));
413 void faketalk
__P((void));
414 void find_driver
__P((FLAG
));
415 void fixshots
__P((int, int, char));
416 IDENT
*get_ident
__P((u_long
, u_long
, char *, char));
417 void get_local_name
__P((char *));
418 int get_remote_name
__P((char *));
419 BULLET
*is_bullet
__P((int, int));
420 void look
__P((PLAYER
*));
421 void makemaze
__P((void));
422 void message
__P((PLAYER
*, char *));
423 void mon_execute
__P((PLAYER
*));
424 void moveshots
__P((void));
425 void open_ctl
__P((void));
426 int opposite
__P((int, char));
427 void otto
__P((int, int, char));
428 void outch
__P((PLAYER
*, int));
429 void outstr
__P((PLAYER
*, char *, int));
430 int player_sym
__P((PLAYER
*, int, int));
431 PLAYER
*play_at
__P((int, int));
432 void playit
__P((void));
433 void put_ch
__P((char));
434 void put_str
__P((char *));
436 int rand_dir
__P((void));
437 int rand_num
__P((int));
438 void redraw_screen
__P((void));
439 void rmnl
__P((char *));
440 void rollexpl
__P((void));
441 void see
__P((PLAYER
*, int));
442 void sendcom
__P((PLAYER
*, int, ...));
443 void showexpl
__P((int, int, char));
444 void showstat
__P((PLAYER
*));
445 void start_driver
__P((void));
446 void stmonitor
__P((PLAYER
*));
447 void stplayer
__P((PLAYER
*, int));
448 char translate
__P((char));
449 SIGNAL_TYPE cleanup
__P((int));
450 SIGNAL_TYPE intr
__P((int));
451 SIGNAL_TYPE sigalrm
__P((int));
452 SIGNAL_TYPE sigemt
__P((int));
453 SIGNAL_TYPE sigterm
__P((int));
454 SIGNAL_TYPE tstp
__P((int));