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