hunt.h revision 1.25 1 1.25 dholland /* $NetBSD: hunt.h,v 1.25 2014/03/29 21:43:46 dholland Exp $ */
2 1.3 perry
3 1.1 mrg /*
4 1.8 wiz * Copyright (c) 1983-2003, Regents of the University of California.
5 1.8 wiz * All rights reserved.
6 1.8 wiz *
7 1.8 wiz * Redistribution and use in source and binary forms, with or without
8 1.8 wiz * modification, are permitted provided that the following conditions are
9 1.8 wiz * met:
10 1.8 wiz *
11 1.8 wiz * + Redistributions of source code must retain the above copyright
12 1.8 wiz * notice, this list of conditions and the following disclaimer.
13 1.8 wiz * + Redistributions in binary form must reproduce the above copyright
14 1.8 wiz * notice, this list of conditions and the following disclaimer in the
15 1.8 wiz * documentation and/or other materials provided with the distribution.
16 1.8 wiz * + Neither the name of the University of California, San Francisco nor
17 1.8 wiz * the names of its contributors may be used to endorse or promote
18 1.8 wiz * products derived from this software without specific prior written
19 1.8 wiz * permission.
20 1.8 wiz *
21 1.8 wiz * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 1.8 wiz * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 1.8 wiz * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 1.8 wiz * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 1.8 wiz * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 1.8 wiz * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 1.8 wiz * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.8 wiz * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.8 wiz * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.8 wiz * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 1.8 wiz * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 mrg */
33 1.1 mrg
34 1.20 dholland #include <stdbool.h>
35 1.15 dholland #include <stdio.h>
36 1.15 dholland #include <string.h>
37 1.15 dholland
38 1.15 dholland #ifdef LOG
39 1.15 dholland #include <syslog.h>
40 1.15 dholland #endif
41 1.15 dholland
42 1.15 dholland #include <sys/ioctl.h>
43 1.15 dholland #include <sys/types.h>
44 1.15 dholland #include <sys/uio.h>
45 1.15 dholland #include <sys/poll.h>
46 1.15 dholland
47 1.15 dholland #ifdef INTERNET
48 1.15 dholland #include <netinet/in.h>
49 1.15 dholland #include <netdb.h>
50 1.15 dholland #include <arpa/inet.h>
51 1.15 dholland #include <net/if.h>
52 1.15 dholland #else
53 1.15 dholland #include <sys/un.h>
54 1.15 dholland #endif
55 1.15 dholland
56 1.23 dholland #include "hunt_common.h"
57 1.15 dholland
58 1.15 dholland extern int shot_req[];
59 1.15 dholland extern int shot_type[];
60 1.1 mrg
61 1.1 mrg typedef struct bullet_def BULLET;
62 1.1 mrg typedef struct expl_def EXPL;
63 1.1 mrg typedef struct player_def PLAYER;
64 1.1 mrg typedef struct ident_def IDENT;
65 1.1 mrg typedef struct regen_def REGEN;
66 1.1 mrg
67 1.1 mrg struct ident_def {
68 1.15 dholland char i_name[NAMELEN];
69 1.15 dholland char i_team;
70 1.12 dholland uint32_t i_machine;
71 1.12 dholland uint32_t i_uid;
72 1.15 dholland float i_kills;
73 1.15 dholland int i_entries;
74 1.15 dholland float i_score;
75 1.15 dholland int i_absorbed;
76 1.15 dholland int i_faced;
77 1.15 dholland int i_shot;
78 1.15 dholland int i_robbed;
79 1.15 dholland int i_slime;
80 1.15 dholland int i_missed;
81 1.15 dholland int i_ducked;
82 1.15 dholland int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
83 1.15 dholland IDENT *i_next;
84 1.1 mrg };
85 1.1 mrg
86 1.1 mrg struct player_def {
87 1.15 dholland IDENT *p_ident;
88 1.15 dholland char p_over;
89 1.15 dholland int p_face;
90 1.15 dholland int p_undershot;
91 1.15 dholland #ifdef FLY
92 1.15 dholland int p_flying;
93 1.15 dholland int p_flyx, p_flyy;
94 1.15 dholland #endif
95 1.15 dholland #ifdef BOOTS
96 1.15 dholland int p_nboots;
97 1.15 dholland #endif
98 1.15 dholland FILE *p_output;
99 1.15 dholland int p_fd;
100 1.15 dholland int p_mask;
101 1.15 dholland int p_damage;
102 1.15 dholland int p_damcap;
103 1.15 dholland int p_ammo;
104 1.15 dholland int p_ncshot;
105 1.15 dholland int p_scan;
106 1.15 dholland int p_cloak;
107 1.15 dholland int p_x, p_y;
108 1.15 dholland int p_ncount;
109 1.15 dholland int p_nexec;
110 1.15 dholland long p_nchar;
111 1.15 dholland char p_death[MSGLEN];
112 1.15 dholland char p_maze[HEIGHT][WIDTH2];
113 1.15 dholland int p_curx, p_cury;
114 1.15 dholland int p_lastx, p_lasty;
115 1.15 dholland char p_cbuf[BUFSIZ];
116 1.1 mrg };
117 1.1 mrg
118 1.1 mrg struct bullet_def {
119 1.15 dholland int b_x, b_y;
120 1.15 dholland int b_face;
121 1.15 dholland int b_charge;
122 1.15 dholland char b_type;
123 1.15 dholland char b_size;
124 1.15 dholland char b_over;
125 1.15 dholland PLAYER *b_owner;
126 1.15 dholland IDENT *b_score;
127 1.20 dholland bool b_expl;
128 1.15 dholland BULLET *b_next;
129 1.1 mrg };
130 1.1 mrg
131 1.1 mrg struct expl_def {
132 1.15 dholland int e_x, e_y;
133 1.15 dholland char e_char;
134 1.15 dholland EXPL *e_next;
135 1.1 mrg };
136 1.1 mrg
137 1.1 mrg struct regen_def {
138 1.15 dholland int r_x, r_y;
139 1.15 dholland REGEN *r_next;
140 1.1 mrg };
141 1.1 mrg
142 1.1 mrg /*
143 1.1 mrg * external variables
144 1.1 mrg */
145 1.1 mrg
146 1.15 dholland extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
147 1.1 mrg
148 1.24 dholland extern int Nplayer, Socket;
149 1.15 dholland extern struct pollfd fdset[];
150 1.1 mrg
151 1.15 dholland extern int See_over[NASCII];
152 1.1 mrg
153 1.15 dholland extern BULLET *Bullets;
154 1.1 mrg
155 1.15 dholland extern IDENT *Scores;
156 1.1 mrg
157 1.15 dholland extern PLAYER Player[MAXPL], *End_player;
158 1.15 dholland #ifdef BOOTS
159 1.15 dholland extern PLAYER Boot[NBOOTS];
160 1.15 dholland #endif
161 1.1 mrg
162 1.15 dholland #ifdef MONITOR
163 1.15 dholland extern PLAYER Monitor[MAXMON], *End_monitor;
164 1.15 dholland #endif
165 1.1 mrg
166 1.1 mrg /*
167 1.1 mrg * function types
168 1.1 mrg */
169 1.1 mrg
170 1.25 dholland /* in answer.c */
171 1.15 dholland int answer(void);
172 1.25 dholland int rand_dir(void);
173 1.25 dholland
174 1.25 dholland /* in draw.c */
175 1.25 dholland void drawmaze(PLAYER *);
176 1.25 dholland void look(PLAYER *);
177 1.15 dholland void check(PLAYER *, int, int);
178 1.25 dholland void showstat(PLAYER *);
179 1.25 dholland void drawplayer(PLAYER *, bool);
180 1.25 dholland void message(PLAYER *, const char *);
181 1.25 dholland
182 1.25 dholland /* in driver.c */
183 1.15 dholland void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
184 1.25 dholland int rand_num(int);
185 1.25 dholland __dead void cleanup(int);
186 1.25 dholland
187 1.25 dholland /* in execute.c */
188 1.25 dholland void mon_execute(PLAYER *); /* ifdef MONITOR only */
189 1.25 dholland void execute(PLAYER *);
190 1.25 dholland void add_shot(int, int, int, char, int, PLAYER *, int, char);
191 1.15 dholland BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
192 1.10 jsm IDENT *, int, char);
193 1.25 dholland
194 1.25 dholland /* in expl.c */
195 1.25 dholland void showexpl(int, int, char);
196 1.25 dholland void rollexpl(void);
197 1.25 dholland void clearwalls(void);
198 1.25 dholland
199 1.25 dholland /* in makemaze.c */
200 1.15 dholland void makemaze(void);
201 1.25 dholland
202 1.25 dholland /* in shots.c */
203 1.15 dholland void moveshots(void);
204 1.25 dholland PLAYER *play_at(int, int);
205 1.20 dholland bool opposite(int, char);
206 1.25 dholland BULLET *is_bullet(int, int);
207 1.25 dholland void fixshots(int, int, char);
208 1.25 dholland
209 1.25 dholland /* in terminal.c */
210 1.25 dholland void cgoto(PLAYER *, int, int);
211 1.15 dholland void outch(PLAYER *, int);
212 1.15 dholland void outstr(PLAYER *, const char *, int);
213 1.25 dholland void clrscr(PLAYER *);
214 1.25 dholland void ce(PLAYER *);
215 1.15 dholland void sendcom(PLAYER *, int, ...);
216