hunt_common.h revision 1.1 1 1.1 dholland /* $NetBSD: hunt_common.h,v 1.1 2014/03/29 21:24:27 dholland Exp $ */
2 1.1 dholland
3 1.1 dholland /*
4 1.1 dholland * Copyright (c) 1983-2003, Regents of the University of California.
5 1.1 dholland * All rights reserved.
6 1.1 dholland *
7 1.1 dholland * Redistribution and use in source and binary forms, with or without
8 1.1 dholland * modification, are permitted provided that the following conditions are
9 1.1 dholland * met:
10 1.1 dholland *
11 1.1 dholland * + Redistributions of source code must retain the above copyright
12 1.1 dholland * notice, this list of conditions and the following disclaimer.
13 1.1 dholland * + Redistributions in binary form must reproduce the above copyright
14 1.1 dholland * notice, this list of conditions and the following disclaimer in the
15 1.1 dholland * documentation and/or other materials provided with the distribution.
16 1.1 dholland * + Neither the name of the University of California, San Francisco nor
17 1.1 dholland * the names of its contributors may be used to endorse or promote
18 1.1 dholland * products derived from this software without specific prior written
19 1.1 dholland * permission.
20 1.1 dholland *
21 1.1 dholland * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 1.1 dholland * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 1.1 dholland * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 1.1 dholland * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 1.1 dholland * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 1.1 dholland * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 1.1 dholland * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1 dholland * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1 dholland * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1 dholland * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 1.1 dholland * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 dholland */
33 1.1 dholland
34 1.1 dholland
35 1.1 dholland #ifdef INTERNET
36 1.1 dholland #define SOCK_FAMILY AF_INET
37 1.1 dholland #define TEST_PORT (('h' << 8) | 't')
38 1.1 dholland #else
39 1.1 dholland #define SOCK_FAMILY AF_UNIX
40 1.1 dholland #define AF_UNIX_HACK /* 4.2 hack; leaves files around */
41 1.1 dholland #endif
42 1.1 dholland
43 1.1 dholland /*
44 1.1 dholland * Preprocessor define dependencies
45 1.1 dholland */
46 1.1 dholland #if defined(VOLCANO) && !defined(OOZE)
47 1.1 dholland #define OOZE
48 1.1 dholland #endif
49 1.1 dholland #if defined(BOOTS) && !defined(FLY)
50 1.1 dholland #define FLY
51 1.1 dholland #endif
52 1.1 dholland #if !defined(REFLECT) && !defined(RANDOM)
53 1.1 dholland #define RANDOM
54 1.1 dholland #endif
55 1.1 dholland
56 1.1 dholland /* decrement version number for each change in startup protocol */
57 1.1 dholland #define HUNT_VERSION -1
58 1.1 dholland
59 1.1 dholland #define ADDCH ('a' | 0200)
60 1.1 dholland #define MOVE ('m' | 0200)
61 1.1 dholland #define REFRESH ('r' | 0200)
62 1.1 dholland #define CLRTOEOL ('c' | 0200)
63 1.1 dholland #define ENDWIN ('e' | 0200)
64 1.1 dholland #define CLEAR ('C' | 0200)
65 1.1 dholland #define REDRAW ('R' | 0200)
66 1.1 dholland #define LAST_PLAYER ('l' | 0200)
67 1.1 dholland #define BELL ('b' | 0200)
68 1.1 dholland #define READY ('g' | 0200)
69 1.1 dholland
70 1.1 dholland /*
71 1.1 dholland * Choose MAXPL and MAXMON carefully. The screen is assumed to be
72 1.1 dholland * 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
73 1.1 dholland * or (MAXPL + MAXMON <= 16).
74 1.1 dholland */
75 1.1 dholland #ifdef MONITOR
76 1.1 dholland #define MAXPL 15
77 1.1 dholland #define MAXMON 1
78 1.1 dholland #else
79 1.1 dholland #define MAXPL 17
80 1.1 dholland #define MAXMON 0
81 1.1 dholland #endif
82 1.1 dholland #define SHORTLEN 2 /* sizeof (network short) */
83 1.1 dholland #define LONGLEN 4 /* sizeof (network long) */
84 1.1 dholland #define NAMELEN 20
85 1.1 dholland #define MSGLEN SCREEN_WIDTH
86 1.1 dholland #define DECAY 50.0
87 1.1 dholland
88 1.1 dholland #define NASCII 128
89 1.1 dholland
90 1.1 dholland #define WIDTH 51
91 1.1 dholland #define WIDTH2 64 /* Next power of 2 >= WIDTH (for fast access) */
92 1.1 dholland #define HEIGHT 23
93 1.1 dholland #define UBOUND 1
94 1.1 dholland #define DBOUND (HEIGHT - 1)
95 1.1 dholland #define LBOUND 1
96 1.1 dholland #define RBOUND (WIDTH - 1)
97 1.1 dholland
98 1.1 dholland #define SCREEN_HEIGHT 24
99 1.1 dholland #define SCREEN_WIDTH 80
100 1.1 dholland #define SCREEN_WIDTH2 128 /* Next power of 2 >= SCREEN_WIDTH */
101 1.1 dholland
102 1.1 dholland #define STAT_LABEL_COL 60
103 1.1 dholland #define STAT_VALUE_COL 74
104 1.1 dholland #define STAT_NAME_COL 61
105 1.1 dholland #define STAT_SCAN_COL (STAT_NAME_COL + 5)
106 1.1 dholland #define STAT_AMMO_ROW 0
107 1.1 dholland #define STAT_GUN_ROW 1
108 1.1 dholland #define STAT_DAM_ROW 2
109 1.1 dholland #define STAT_KILL_ROW 3
110 1.1 dholland #define STAT_PLAY_ROW 5
111 1.1 dholland #ifdef MONITOR
112 1.1 dholland #define STAT_MON_ROW (STAT_PLAY_ROW + MAXPL + 1)
113 1.1 dholland #endif
114 1.1 dholland #define STAT_NAME_LEN 18
115 1.1 dholland
116 1.1 dholland #define DOOR '#'
117 1.1 dholland #define WALL1 '-'
118 1.1 dholland #define WALL2 '|'
119 1.1 dholland #define WALL3 '+'
120 1.1 dholland #ifdef REFLECT
121 1.1 dholland #define WALL4 '/'
122 1.1 dholland #define WALL5 '\\'
123 1.1 dholland #endif
124 1.1 dholland #define KNIFE 'K'
125 1.1 dholland #define SHOT ':'
126 1.1 dholland #define GRENADE 'o'
127 1.1 dholland #define SATCHEL 'O'
128 1.1 dholland #define BOMB '@'
129 1.1 dholland #define MINE ';'
130 1.1 dholland #define GMINE 'g'
131 1.1 dholland #ifdef OOZE
132 1.1 dholland #define SLIME '$'
133 1.1 dholland #endif
134 1.1 dholland #ifdef VOLCANO
135 1.1 dholland #define LAVA '~'
136 1.1 dholland #endif
137 1.1 dholland #ifdef DRONE
138 1.1 dholland #define DSHOT '?'
139 1.1 dholland #endif
140 1.1 dholland #ifdef FLY
141 1.1 dholland #define FALL 'F'
142 1.1 dholland #endif
143 1.1 dholland #ifdef BOOTS
144 1.1 dholland #define NBOOTS 2
145 1.1 dholland #define BOOT 'b'
146 1.1 dholland #define BOOT_PAIR 'B'
147 1.1 dholland #endif
148 1.1 dholland #define SPACE ' '
149 1.1 dholland
150 1.1 dholland #define ABOVE 'i'
151 1.1 dholland #define BELOW '!'
152 1.1 dholland #define RIGHT '}'
153 1.1 dholland #define LEFTS '{'
154 1.1 dholland #ifdef FLY
155 1.1 dholland #define FLYER '&'
156 1.1 dholland #define isplayer(c) (c == LEFTS || c == RIGHT ||\
157 1.1 dholland c == ABOVE || c == BELOW || c == FLYER)
158 1.1 dholland #else
159 1.1 dholland #define isplayer(c) (c == LEFTS || c == RIGHT ||\
160 1.1 dholland c == ABOVE || c == BELOW)
161 1.1 dholland #endif
162 1.1 dholland
163 1.1 dholland #define NORTH 01
164 1.1 dholland #define SOUTH 02
165 1.1 dholland #define EAST 010
166 1.1 dholland #define WEST 020
167 1.1 dholland
168 1.1 dholland #undef CTRL
169 1.1 dholland #define CTRL(x) ((x) & 037)
170 1.1 dholland
171 1.1 dholland #define BULSPD 5 /* bullets movement speed */
172 1.1 dholland #define ISHOTS 15
173 1.1 dholland #define NSHOTS 5
174 1.1 dholland #define MAXNCSHOT 2
175 1.1 dholland #define MAXDAM 10
176 1.1 dholland #define MINDAM 5
177 1.1 dholland #define STABDAM 2
178 1.1 dholland
179 1.1 dholland #define BULREQ 1
180 1.1 dholland #define GRENREQ 9
181 1.1 dholland #define SATREQ 25
182 1.1 dholland #define BOMB7REQ 49
183 1.1 dholland #define BOMB9REQ 81
184 1.1 dholland #define BOMB11REQ 121
185 1.1 dholland #define BOMB13REQ 169
186 1.1 dholland #define BOMB15REQ 225
187 1.1 dholland #define BOMB17REQ 289
188 1.1 dholland #define BOMB19REQ 361
189 1.1 dholland #define BOMB21REQ 441
190 1.1 dholland #define MAXBOMB 11
191 1.1 dholland #ifdef DRONE
192 1.1 dholland #define MINDSHOT 2 /* At least a satchel bomb */
193 1.1 dholland #endif
194 1.1 dholland
195 1.1 dholland #ifdef OOZE
196 1.1 dholland #define SLIME_FACTOR 3
197 1.1 dholland #define SLIMEREQ 5
198 1.1 dholland #define SSLIMEREQ 10
199 1.1 dholland #define SLIME2REQ 15
200 1.1 dholland #define SLIME3REQ 20
201 1.1 dholland #define MAXSLIME 4
202 1.1 dholland #define SLIMESPEED 5
203 1.1 dholland extern int slime_req[];
204 1.1 dholland #endif
205 1.1 dholland #ifdef VOLCANO
206 1.1 dholland #define LAVASPEED 1
207 1.1 dholland #endif
208 1.1 dholland
209 1.1 dholland #define CLOAKLEN 20
210 1.1 dholland #define SCANLEN (Nplayer * 20)
211 1.1 dholland #define EXPLEN 4
212 1.1 dholland
213 1.1 dholland #define Q_QUIT 0
214 1.1 dholland #define Q_CLOAK 1
215 1.1 dholland #define Q_FLY 2
216 1.1 dholland #define Q_SCAN 3
217 1.1 dholland #define Q_MESSAGE 4
218 1.1 dholland
219 1.1 dholland #define C_PLAYER 0
220 1.1 dholland #define C_MONITOR 1
221 1.1 dholland #define C_MESSAGE 2
222 1.1 dholland #define C_SCORES 3
223 1.1 dholland
224 1.1 dholland #ifdef FLY
225 1.1 dholland #define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
226 1.1 dholland #define _cloak_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
227 1.1 dholland #define stat_char(pp) (((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
228 1.1 dholland #else
229 1.1 dholland #define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
230 1.1 dholland #define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
231 1.1 dholland #endif
232 1.1 dholland
233 1.1 dholland #ifdef INTERNET
234 1.1 dholland typedef struct sockaddr_in SOCKET;
235 1.1 dholland #else
236 1.1 dholland typedef struct sockaddr_un SOCKET;
237 1.1 dholland #endif
238 1.1 dholland
239