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