]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - hunt/huntd/hunt.h
Time warp forward 34 years so that it compiles (but not work)
[bsdgames-darwin.git] / hunt / huntd / hunt.h
1 /* $NetBSD: hunt.h,v 1.31 2014/03/30 05:53:12 dholland Exp $ */
2
3 /*
4 * Copyright (c) 1983-2003, Regents of the University of California.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met:
10 *
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
19 * permission.
20 *
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.
32 */
33
34 #include <stdbool.h>
35 #include <stdio.h>
36 #include <string.h>
37 #include <syslog.h>
38
39 #include <sys/ioctl.h>
40 #include <sys/types.h>
41 #include <sys/uio.h>
42 #include <sys/poll.h>
43
44 #include "hunt_common.h"
45
46 extern const int shot_req[];
47 extern const int shot_type[];
48 #ifdef OOZE
49 extern const int slime_req[];
50 #endif
51
52 typedef struct bullet_def BULLET;
53 typedef struct expl_def EXPL;
54 typedef struct player_def PLAYER;
55 typedef struct ident_def IDENT;
56 typedef struct regen_def REGEN;
57
58 struct ident_def {
59 char i_name[WIRE_NAMELEN];
60 char i_team;
61 uint32_t i_machine;
62 uint32_t i_uid;
63 float i_kills;
64 int i_entries;
65 float i_score;
66 int i_absorbed;
67 int i_faced;
68 int i_shot;
69 int i_robbed;
70 int i_slime;
71 int i_missed;
72 int i_ducked;
73 int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
74 IDENT *i_next;
75 };
76
77 struct player_def {
78 IDENT *p_ident;
79 char p_over;
80 int p_face;
81 int p_undershot;
82 #ifdef FLY
83 int p_flying;
84 int p_flyx, p_flyy;
85 #endif
86 #ifdef BOOTS
87 int p_nboots;
88 #endif
89 FILE *p_output;
90 int p_fd;
91 int p_mask;
92 int p_damage;
93 int p_damcap;
94 int p_ammo;
95 int p_ncshot;
96 int p_scan;
97 int p_cloak;
98 int p_x, p_y;
99 int p_ncount;
100 int p_nexec;
101 long p_nchar;
102 char p_death[MSGLEN];
103 char p_maze[HEIGHT][WIDTH2];
104 int p_curx, p_cury;
105 int p_lastx, p_lasty;
106 char p_cbuf[BUFSIZ];
107 };
108
109 struct bullet_def {
110 int b_x, b_y;
111 int b_face;
112 int b_charge;
113 char b_type;
114 char b_size;
115 char b_over;
116 PLAYER *b_owner;
117 IDENT *b_score;
118 bool b_expl;
119 BULLET *b_next;
120 };
121
122 struct expl_def {
123 int e_x, e_y;
124 char e_char;
125 EXPL *e_next;
126 };
127
128 struct regen_def {
129 int r_x, r_y;
130 REGEN *r_next;
131 };
132
133 /*
134 * external variables
135 */
136
137 extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
138
139 extern int Nplayer;
140 extern int huntsock;
141 extern struct pollfd fdset[];
142
143 extern int See_over[NASCII];
144
145 extern BULLET *Bullets;
146
147 extern IDENT *Scores;
148
149 extern PLAYER Player[MAXPL], *End_player;
150 #ifdef BOOTS
151 extern PLAYER Boot[NBOOTS];
152 #endif
153
154 #ifdef MONITOR
155 extern PLAYER Monitor[MAXMON], *End_monitor;
156 #endif
157
158 /*
159 * function types
160 */
161
162 /* in answer.c */
163 bool answer(void);
164 int rand_dir(void);
165
166 /* in draw.c */
167 void drawmaze(PLAYER *);
168 void look(PLAYER *);
169 void check(PLAYER *, int, int);
170 void showstat(PLAYER *);
171 void drawplayer(PLAYER *, bool);
172 void message(PLAYER *, const char *);
173
174 /* in driver.c */
175 void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
176 int rand_num(int);
177 __dead void cleanup(int);
178
179 /* in execute.c */
180 void mon_execute(PLAYER *); /* ifdef MONITOR only */
181 void execute(PLAYER *);
182 void add_shot(int, int, int, char, int, PLAYER *, int, char);
183 BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
184 IDENT *, int, char);
185
186 /* in expl.c */
187 void showexpl(int, int, char);
188 void rollexpl(void);
189 void clearwalls(void);
190
191 /* in makemaze.c */
192 void makemaze(void);
193
194 /* in shots.c */
195 void moveshots(void);
196 PLAYER *play_at(int, int);
197 bool opposite(int, char);
198 BULLET *is_bullet(int, int);
199 void fixshots(int, int, char);
200
201 /* in support.c */
202 __printflike(2, 3) void complain(int level, const char *fmt, ...);
203
204 /* in terminal.c */
205 void cgoto(PLAYER *, int, int);
206 void outch(PLAYER *, int);
207 void outstr(PLAYER *, const char *, int);
208 void clrscr(PLAYER *);
209 void ce(PLAYER *);
210 void sendcom(PLAYER *, int, ...);