]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - hunt/include/hunt_common.h
Remove SHORTLEN and LONGLEN defines; use sizeof() properly instead.
[bsdgames-darwin.git] / hunt / include / hunt_common.h
1 /* $NetBSD: hunt_common.h,v 1.4 2014/03/30 05:30:28 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
35 /*
36 * There is no particular significance to the numbers assigned
37 * to Test_port. They're just random numbers greater than the
38 * range reserved for privileged sockets.
39 */
40
41 #ifdef INTERNET
42 #define SOCK_FAMILY AF_INET
43 #define TEST_PORT (('h' << 8) | 't')
44 #else
45 #define SOCK_FAMILY AF_UNIX
46 #define AF_UNIX_HACK /* 4.2 hack; leaves files around */
47 #endif
48
49 /*
50 * Preprocessor define dependencies
51 */
52 #if defined(VOLCANO) && !defined(OOZE)
53 #define OOZE
54 #endif
55 #if defined(BOOTS) && !defined(FLY)
56 #define FLY
57 #endif
58 #if !defined(REFLECT) && !defined(RANDOM)
59 #define RANDOM
60 #endif
61
62 /* decrement version number for each change in startup protocol */
63 #define HUNT_VERSION -1
64
65 #define ADDCH ('a' | 0200)
66 #define MOVE ('m' | 0200)
67 #define REFRESH ('r' | 0200)
68 #define CLRTOEOL ('c' | 0200)
69 #define ENDWIN ('e' | 0200)
70 #define CLEAR ('C' | 0200)
71 #define REDRAW ('R' | 0200)
72 #define LAST_PLAYER ('l' | 0200)
73 #define BELL ('b' | 0200)
74 #define READY ('g' | 0200)
75
76 /*
77 * Choose MAXPL and MAXMON carefully. The screen is assumed to be
78 * 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
79 * or (MAXPL + MAXMON <= 16).
80 */
81 #ifdef MONITOR
82 #define MAXPL 15
83 #define MAXMON 1
84 #else
85 #define MAXPL 17
86 #define MAXMON 0
87 #endif
88 #define WIRE_NAMELEN 20
89 #define MSGLEN SCREEN_WIDTH
90 #define DECAY 50.0
91
92 #define NASCII 128
93
94 #define WIDTH 51
95 #define WIDTH2 64 /* Next power of 2 >= WIDTH (for fast access) */
96 #define HEIGHT 23
97 #define UBOUND 1
98 #define DBOUND (HEIGHT - 1)
99 #define LBOUND 1
100 #define RBOUND (WIDTH - 1)
101
102 #define SCREEN_HEIGHT 24
103 #define SCREEN_WIDTH 80
104 #define SCREEN_WIDTH2 128 /* Next power of 2 >= SCREEN_WIDTH */
105
106 #define STAT_LABEL_COL 60
107 #define STAT_VALUE_COL 74
108 #define STAT_NAME_COL 61
109 #define STAT_SCAN_COL (STAT_NAME_COL + 5)
110 #define STAT_AMMO_ROW 0
111 #define STAT_GUN_ROW 1
112 #define STAT_DAM_ROW 2
113 #define STAT_KILL_ROW 3
114 #define STAT_PLAY_ROW 5
115 #ifdef MONITOR
116 #define STAT_MON_ROW (STAT_PLAY_ROW + MAXPL + 1)
117 #endif
118 #define STAT_NAME_LEN 18
119
120 #define DOOR '#'
121 #define WALL1 '-'
122 #define WALL2 '|'
123 #define WALL3 '+'
124 #ifdef REFLECT
125 #define WALL4 '/'
126 #define WALL5 '\\'
127 #endif
128 #define KNIFE 'K'
129 #define SHOT ':'
130 #define GRENADE 'o'
131 #define SATCHEL 'O'
132 #define BOMB '@'
133 #define MINE ';'
134 #define GMINE 'g'
135 #ifdef OOZE
136 #define SLIME '$'
137 #endif
138 #ifdef VOLCANO
139 #define LAVA '~'
140 #endif
141 #ifdef DRONE
142 #define DSHOT '?'
143 #endif
144 #ifdef FLY
145 #define FALL 'F'
146 #endif
147 #ifdef BOOTS
148 #define NBOOTS 2
149 #define BOOT 'b'
150 #define BOOT_PAIR 'B'
151 #endif
152 #define SPACE ' '
153
154 #define ABOVE 'i'
155 #define BELOW '!'
156 #define RIGHT '}'
157 #define LEFTS '{'
158 #ifdef FLY
159 #define FLYER '&'
160 #define isplayer(c) (c == LEFTS || c == RIGHT ||\
161 c == ABOVE || c == BELOW || c == FLYER)
162 #else
163 #define isplayer(c) (c == LEFTS || c == RIGHT ||\
164 c == ABOVE || c == BELOW)
165 #endif
166
167 #define NORTH 01
168 #define SOUTH 02
169 #define EAST 010
170 #define WEST 020
171
172 #undef CTRL
173 #define CTRL(x) ((x) & 037)
174
175 #define BULSPD 5 /* bullets movement speed */
176 #define ISHOTS 15
177 #define NSHOTS 5
178 #define MAXNCSHOT 2
179 #define MAXDAM 10
180 #define MINDAM 5
181 #define STABDAM 2
182
183 #define BULREQ 1
184 #define GRENREQ 9
185 #define SATREQ 25
186 #define BOMB7REQ 49
187 #define BOMB9REQ 81
188 #define BOMB11REQ 121
189 #define BOMB13REQ 169
190 #define BOMB15REQ 225
191 #define BOMB17REQ 289
192 #define BOMB19REQ 361
193 #define BOMB21REQ 441
194 #define MAXBOMB 11
195 #ifdef DRONE
196 #define MINDSHOT 2 /* At least a satchel bomb */
197 #endif
198
199 #ifdef OOZE
200 #define SLIME_FACTOR 3
201 #define SLIMEREQ 5
202 #define SSLIMEREQ 10
203 #define SLIME2REQ 15
204 #define SLIME3REQ 20
205 #define MAXSLIME 4
206 #define SLIMESPEED 5
207 #endif
208 #ifdef VOLCANO
209 #define LAVASPEED 1
210 #endif
211
212 #define CLOAKLEN 20
213 #define SCANLEN (Nplayer * 20)
214 #define EXPLEN 4
215
216 #define Q_QUIT 0
217 #define Q_CLOAK 1
218 #define Q_FLY 2
219 #define Q_SCAN 3
220 #define Q_MESSAGE 4
221
222 #define C_PLAYER 0
223 #define C_MONITOR 1
224 #define C_MESSAGE 2
225 #define C_SCORES 3
226
227 #ifdef FLY
228 #define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
229 #define _cloak_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
230 #define stat_char(pp) (((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
231 #else
232 #define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
233 #define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
234 #endif
235
236 #ifdef INTERNET
237 typedef struct sockaddr_in SOCKET;
238 #else
239 typedef struct sockaddr_un SOCKET;
240 #endif
241