summaryrefslogtreecommitdiffstats
path: root/hunt/huntd/hunt.h
blob: 41bf03070748638b749bbde3fb69b89d716f8751 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*	$NetBSD: hunt.h,v 1.31 2014/03/30 05:53:12 dholland Exp $	*/

/*
 * Copyright (c) 1983-2003, Regents of the University of California.
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are 
 * met:
 * 
 * + Redistributions of source code must retain the above copyright 
 *   notice, this list of conditions and the following disclaimer.
 * + Redistributions in binary form must reproduce the above copyright 
 *   notice, this list of conditions and the following disclaimer in the 
 *   documentation and/or other materials provided with the distribution.
 * + Neither the name of the University of California, San Francisco nor 
 *   the names of its contributors may be used to endorse or promote 
 *   products derived from this software without specific prior written 
 *   permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>

#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/poll.h>
#include <_types/_uint32_t.h>

#include "hunt_common.h"

extern const int shot_req[];
extern const int shot_type[];
#ifdef OOZE
extern const int slime_req[];
#endif

typedef struct bullet_def	BULLET;
typedef struct expl_def		EXPL;
typedef struct player_def	PLAYER;
typedef struct ident_def	IDENT;
typedef struct regen_def	REGEN;

struct ident_def {
	char i_name[WIRE_NAMELEN];
	char i_team;
	uint32_t i_machine;
	uint32_t i_uid;
	float i_kills;
	int i_entries;
	float i_score;
	int i_absorbed;
	int i_faced;
	int i_shot;
	int i_robbed;
	int i_slime;
	int i_missed;
	int i_ducked;
	int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
	IDENT *i_next;
};

struct player_def {
	IDENT *p_ident;
	char p_over;
	int p_face;
	int p_undershot;
#ifdef FLY
	int p_flying;
	int p_flyx, p_flyy;
#endif
#ifdef BOOTS
	int p_nboots;
#endif
	FILE *p_output;
	int p_fd;
	int p_mask;
	int p_damage;
	int p_damcap;
	int p_ammo;
	int p_ncshot;
	int p_scan;
	int p_cloak;
	int p_x, p_y;
	int p_ncount;
	int p_nexec;
	long p_nchar;
	char p_death[MSGLEN];
	char p_maze[HEIGHT][WIDTH2];
	int p_curx, p_cury;
	int p_lastx, p_lasty;
	char p_cbuf[BUFSIZ];
};

struct bullet_def {
	int b_x, b_y;
	int b_face;
	int b_charge;
	char b_type;
	char b_size;
	char b_over;
	PLAYER *b_owner;
	IDENT *b_score;
	bool b_expl;
	BULLET *b_next;
};

struct expl_def {
	int e_x, e_y;
	char e_char;
	EXPL *e_next;
};

struct regen_def {
	int r_x, r_y;
	REGEN *r_next;
};

/*
 * external variables
 */

extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];

extern int Nplayer;
extern int huntsock;
extern struct pollfd fdset[];

extern int See_over[NASCII];

extern BULLET *Bullets;

extern IDENT *Scores;

extern PLAYER Player[MAXPL], *End_player;
#ifdef BOOTS
extern PLAYER Boot[NBOOTS];
#endif

#ifdef MONITOR
extern PLAYER Monitor[MAXMON], *End_monitor;
#endif

/*
 * function types
 */

/* in answer.c */
bool answer(void);
int rand_dir(void);

/* in draw.c */
void drawmaze(PLAYER *);
void look(PLAYER *);
void check(PLAYER *, int, int);
void showstat(PLAYER *);
void drawplayer(PLAYER *, bool);
void message(PLAYER *, const char *);

/* in driver.c */
void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
int rand_num(int);
__dead void cleanup(int);

/* in execute.c */
void mon_execute(PLAYER *);	/* ifdef MONITOR only */
void execute(PLAYER *);
void add_shot(int, int, int, char, int, PLAYER *, int, char);
BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
		    IDENT *, int, char);

/* in expl.c */
void showexpl(int, int, char);
void rollexpl(void);
void clearwalls(void);

/* in makemaze.c */
void makemaze(void);

/* in shots.c */
void moveshots(void);
PLAYER *play_at(int, int);
bool opposite(int, char);
BULLET *is_bullet(int, int);
void fixshots(int, int, char);

/* in support.c */
__printflike(2, 3) void complain(int level, const char *fmt, ...);

/* in terminal.c */
void cgoto(PLAYER *, int, int);
void outch(PLAYER *, int);
void outstr(PLAYER *, const char *, int);
void clrscr(PLAYER *);
void ce(PLAYER *);
void sendcom(PLAYER *, int, ...);