hunt.h revision 1.26 1 1.26 dholland /* $NetBSD: hunt.h,v 1.26 2014/03/29 21:55:59 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.26 dholland extern const int shot_req[];
59 1.26 dholland extern const int shot_type[];
60 1.26 dholland #ifdef OOZE
61 1.26 dholland extern const int slime_req[];
62 1.26 dholland #endif
63 1.1 mrg
64 1.1 mrg typedef struct bullet_def BULLET;
65 1.1 mrg typedef struct expl_def EXPL;
66 1.1 mrg typedef struct player_def PLAYER;
67 1.1 mrg typedef struct ident_def IDENT;
68 1.1 mrg typedef struct regen_def REGEN;
69 1.1 mrg
70 1.1 mrg struct ident_def {
71 1.15 dholland char i_name[NAMELEN];
72 1.15 dholland char i_team;
73 1.12 dholland uint32_t i_machine;
74 1.12 dholland uint32_t i_uid;
75 1.15 dholland float i_kills;
76 1.15 dholland int i_entries;
77 1.15 dholland float i_score;
78 1.15 dholland int i_absorbed;
79 1.15 dholland int i_faced;
80 1.15 dholland int i_shot;
81 1.15 dholland int i_robbed;
82 1.15 dholland int i_slime;
83 1.15 dholland int i_missed;
84 1.15 dholland int i_ducked;
85 1.15 dholland int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
86 1.15 dholland IDENT *i_next;
87 1.1 mrg };
88 1.1 mrg
89 1.1 mrg struct player_def {
90 1.15 dholland IDENT *p_ident;
91 1.15 dholland char p_over;
92 1.15 dholland int p_face;
93 1.15 dholland int p_undershot;
94 1.15 dholland #ifdef FLY
95 1.15 dholland int p_flying;
96 1.15 dholland int p_flyx, p_flyy;
97 1.15 dholland #endif
98 1.15 dholland #ifdef BOOTS
99 1.15 dholland int p_nboots;
100 1.15 dholland #endif
101 1.15 dholland FILE *p_output;
102 1.15 dholland int p_fd;
103 1.15 dholland int p_mask;
104 1.15 dholland int p_damage;
105 1.15 dholland int p_damcap;
106 1.15 dholland int p_ammo;
107 1.15 dholland int p_ncshot;
108 1.15 dholland int p_scan;
109 1.15 dholland int p_cloak;
110 1.15 dholland int p_x, p_y;
111 1.15 dholland int p_ncount;
112 1.15 dholland int p_nexec;
113 1.15 dholland long p_nchar;
114 1.15 dholland char p_death[MSGLEN];
115 1.15 dholland char p_maze[HEIGHT][WIDTH2];
116 1.15 dholland int p_curx, p_cury;
117 1.15 dholland int p_lastx, p_lasty;
118 1.15 dholland char p_cbuf[BUFSIZ];
119 1.1 mrg };
120 1.1 mrg
121 1.1 mrg struct bullet_def {
122 1.15 dholland int b_x, b_y;
123 1.15 dholland int b_face;
124 1.15 dholland int b_charge;
125 1.15 dholland char b_type;
126 1.15 dholland char b_size;
127 1.15 dholland char b_over;
128 1.15 dholland PLAYER *b_owner;
129 1.15 dholland IDENT *b_score;
130 1.20 dholland bool b_expl;
131 1.15 dholland BULLET *b_next;
132 1.1 mrg };
133 1.1 mrg
134 1.1 mrg struct expl_def {
135 1.15 dholland int e_x, e_y;
136 1.15 dholland char e_char;
137 1.15 dholland EXPL *e_next;
138 1.1 mrg };
139 1.1 mrg
140 1.1 mrg struct regen_def {
141 1.15 dholland int r_x, r_y;
142 1.15 dholland REGEN *r_next;
143 1.1 mrg };
144 1.1 mrg
145 1.1 mrg /*
146 1.1 mrg * external variables
147 1.1 mrg */
148 1.1 mrg
149 1.15 dholland extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
150 1.1 mrg
151 1.24 dholland extern int Nplayer, Socket;
152 1.15 dholland extern struct pollfd fdset[];
153 1.1 mrg
154 1.15 dholland extern int See_over[NASCII];
155 1.1 mrg
156 1.15 dholland extern BULLET *Bullets;
157 1.1 mrg
158 1.15 dholland extern IDENT *Scores;
159 1.1 mrg
160 1.15 dholland extern PLAYER Player[MAXPL], *End_player;
161 1.15 dholland #ifdef BOOTS
162 1.15 dholland extern PLAYER Boot[NBOOTS];
163 1.15 dholland #endif
164 1.1 mrg
165 1.15 dholland #ifdef MONITOR
166 1.15 dholland extern PLAYER Monitor[MAXMON], *End_monitor;
167 1.15 dholland #endif
168 1.1 mrg
169 1.1 mrg /*
170 1.1 mrg * function types
171 1.1 mrg */
172 1.1 mrg
173 1.25 dholland /* in answer.c */
174 1.15 dholland int answer(void);
175 1.25 dholland int rand_dir(void);
176 1.25 dholland
177 1.25 dholland /* in draw.c */
178 1.25 dholland void drawmaze(PLAYER *);
179 1.25 dholland void look(PLAYER *);
180 1.15 dholland void check(PLAYER *, int, int);
181 1.25 dholland void showstat(PLAYER *);
182 1.25 dholland void drawplayer(PLAYER *, bool);
183 1.25 dholland void message(PLAYER *, const char *);
184 1.25 dholland
185 1.25 dholland /* in driver.c */
186 1.15 dholland void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
187 1.25 dholland int rand_num(int);
188 1.25 dholland __dead void cleanup(int);
189 1.25 dholland
190 1.25 dholland /* in execute.c */
191 1.25 dholland void mon_execute(PLAYER *); /* ifdef MONITOR only */
192 1.25 dholland void execute(PLAYER *);
193 1.25 dholland void add_shot(int, int, int, char, int, PLAYER *, int, char);
194 1.15 dholland BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
195 1.10 jsm IDENT *, int, char);
196 1.25 dholland
197 1.25 dholland /* in expl.c */
198 1.25 dholland void showexpl(int, int, char);
199 1.25 dholland void rollexpl(void);
200 1.25 dholland void clearwalls(void);
201 1.25 dholland
202 1.25 dholland /* in makemaze.c */
203 1.15 dholland void makemaze(void);
204 1.25 dholland
205 1.25 dholland /* in shots.c */
206 1.15 dholland void moveshots(void);
207 1.25 dholland PLAYER *play_at(int, int);
208 1.20 dholland bool opposite(int, char);
209 1.25 dholland BULLET *is_bullet(int, int);
210 1.25 dholland void fixshots(int, int, char);
211 1.25 dholland
212 1.25 dholland /* in terminal.c */
213 1.25 dholland void cgoto(PLAYER *, int, int);
214 1.15 dholland void outch(PLAYER *, int);
215 1.15 dholland void outstr(PLAYER *, const char *, int);
216 1.25 dholland void clrscr(PLAYER *);
217 1.25 dholland void ce(PLAYER *);
218 1.15 dholland void sendcom(PLAYER *, int, ...);
219