Home | History | Annotate | Line # | Download | only in include
hunt_common.h revision 1.2
      1 /*	$NetBSD: hunt_common.h,v 1.2 2014/03/29 21:25:35 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 SHORTLEN	2		/* sizeof (network short) */
     89 #define LONGLEN		4		/* sizeof (network long) */
     90 #define NAMELEN		20
     91 #define MSGLEN		SCREEN_WIDTH
     92 #define DECAY		50.0
     93 
     94 #define NASCII		128
     95 
     96 #define WIDTH		51
     97 #define WIDTH2		64	/* Next power of 2 >= WIDTH (for fast access) */
     98 #define HEIGHT		23
     99 #define UBOUND		1
    100 #define DBOUND		(HEIGHT - 1)
    101 #define LBOUND		1
    102 #define RBOUND		(WIDTH - 1)
    103 
    104 #define SCREEN_HEIGHT	24
    105 #define SCREEN_WIDTH	80
    106 #define SCREEN_WIDTH2	128	/* Next power of 2 >= SCREEN_WIDTH */
    107 
    108 #define STAT_LABEL_COL	60
    109 #define STAT_VALUE_COL	74
    110 #define STAT_NAME_COL	61
    111 #define STAT_SCAN_COL	(STAT_NAME_COL + 5)
    112 #define STAT_AMMO_ROW	0
    113 #define STAT_GUN_ROW	1
    114 #define STAT_DAM_ROW	2
    115 #define STAT_KILL_ROW	3
    116 #define STAT_PLAY_ROW	5
    117 #ifdef MONITOR
    118 #define STAT_MON_ROW	(STAT_PLAY_ROW + MAXPL + 1)
    119 #endif
    120 #define STAT_NAME_LEN	18
    121 
    122 #define DOOR		'#'
    123 #define WALL1		'-'
    124 #define WALL2		'|'
    125 #define WALL3		'+'
    126 #ifdef REFLECT
    127 #define WALL4		'/'
    128 #define WALL5		'\\'
    129 #endif
    130 #define KNIFE		'K'
    131 #define SHOT		':'
    132 #define GRENADE		'o'
    133 #define SATCHEL		'O'
    134 #define BOMB		'@'
    135 #define MINE		';'
    136 #define GMINE		'g'
    137 #ifdef OOZE
    138 #define SLIME		'$'
    139 #endif
    140 #ifdef VOLCANO
    141 #define LAVA		'~'
    142 #endif
    143 #ifdef DRONE
    144 #define DSHOT		'?'
    145 #endif
    146 #ifdef FLY
    147 #define FALL		'F'
    148 #endif
    149 #ifdef BOOTS
    150 #define NBOOTS		2
    151 #define BOOT		'b'
    152 #define BOOT_PAIR	'B'
    153 #endif
    154 #define SPACE		' '
    155 
    156 #define ABOVE		'i'
    157 #define BELOW		'!'
    158 #define RIGHT		'}'
    159 #define LEFTS		'{'
    160 #ifdef FLY
    161 #define FLYER		'&'
    162 #define isplayer(c)	(c == LEFTS || c == RIGHT ||\
    163 			 c == ABOVE || c == BELOW || c == FLYER)
    164 #else
    165 #define	isplayer(c)	(c == LEFTS || c == RIGHT ||\
    166 			 c == ABOVE || c == BELOW)
    167 #endif
    168 
    169 #define NORTH	01
    170 #define SOUTH	02
    171 #define EAST	010
    172 #define WEST	020
    173 
    174 #undef CTRL
    175 #define CTRL(x) ((x) & 037)
    176 
    177 #define BULSPD		5		/* bullets movement speed */
    178 #define ISHOTS		15
    179 #define NSHOTS		5
    180 #define MAXNCSHOT	2
    181 #define MAXDAM		10
    182 #define MINDAM		5
    183 #define STABDAM		2
    184 
    185 #define BULREQ		1
    186 #define GRENREQ		9
    187 #define SATREQ		25
    188 #define BOMB7REQ	49
    189 #define BOMB9REQ	81
    190 #define BOMB11REQ	121
    191 #define BOMB13REQ	169
    192 #define BOMB15REQ	225
    193 #define BOMB17REQ	289
    194 #define BOMB19REQ	361
    195 #define BOMB21REQ	441
    196 #define MAXBOMB		11
    197 #ifdef DRONE
    198 #define MINDSHOT	2	/* At least a satchel bomb */
    199 #endif
    200 
    201 #ifdef OOZE
    202 #define SLIME_FACTOR	3
    203 #define SLIMEREQ	5
    204 #define SSLIMEREQ	10
    205 #define SLIME2REQ	15
    206 #define SLIME3REQ	20
    207 #define MAXSLIME	4
    208 #define SLIMESPEED	5
    209 extern int slime_req[];
    210 #endif
    211 #ifdef VOLCANO
    212 #define LAVASPEED	1
    213 #endif
    214 
    215 #define CLOAKLEN	20
    216 #define SCANLEN		(Nplayer * 20)
    217 #define EXPLEN		4
    218 
    219 #define Q_QUIT		0
    220 #define Q_CLOAK		1
    221 #define Q_FLY		2
    222 #define Q_SCAN		3
    223 #define Q_MESSAGE	4
    224 
    225 #define C_PLAYER	0
    226 #define C_MONITOR	1
    227 #define C_MESSAGE	2
    228 #define C_SCORES	3
    229 
    230 #ifdef FLY
    231 #define _scan_char(pp)	(((pp)->p_scan < 0) ? ' ' : '*')
    232 #define _cloak_char(pp)	(((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
    233 #define stat_char(pp)	(((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
    234 #else
    235 #define _scan_char(pp)	(((pp)->p_scan < 0) ? ' ' : '*')
    236 #define stat_char(pp)	(((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
    237 #endif
    238 
    239 #ifdef INTERNET
    240 typedef struct sockaddr_in	SOCKET;
    241 #else
    242 typedef struct sockaddr_un	SOCKET;
    243 #endif
    244 
    245