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