xref: /openbsd/games/hunt/huntd/hunt.h (revision ac1fa6a8)
1 /*	$OpenBSD: hunt.h,v 1.6 2017/01/21 08:22:57 krw Exp $	*/
2 /*	$NetBSD: hunt.h,v 1.5 1998/09/13 15:27:28 hubertf Exp $	*/
3 
4 /*
5  * Copyright (c) 1983-2003, Regents of the University of California.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * + Redistributions of source code must retain the above copyright
13  *   notice, this list of conditions and the following disclaimer.
14  * + Redistributions in binary form must reproduce the above copyright
15  *   notice, this list of conditions and the following disclaimer in the
16  *   documentation and/or other materials provided with the distribution.
17  * + Neither the name of the University of California, San Francisco nor
18  *   the names of its contributors may be used to endorse or promote
19  *   products derived from this software without specific prior written
20  *   permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
23  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /*
36  * Preprocessor define dependencies
37  */
38 
39 /* decrement version number for each change in startup protocol */
40 # define	HUNT_VERSION		(-1)
41 # define	HUNT_PORT		(('h' << 8) | 't')
42 
43 # define	ADDCH		('a' | 0200)
44 # define	MOVE		('m' | 0200)
45 # define	REFRESH		('r' | 0200)
46 # define	CLRTOEOL	('c' | 0200)
47 # define	ENDWIN		('e' | 0200)
48 # define	CLEAR		('C' | 0200)
49 # define	REDRAW		('R' | 0200)
50 # define	LAST_PLAYER	('l' | 0200)
51 # define	BELL		('b' | 0200)
52 # define	READY		('g' | 0200)
53 
54 # define	SCREEN_HEIGHT	24
55 # define	SCREEN_WIDTH	80
56 # define	HEIGHT	23
57 # define	WIDTH	51
58 # define	SCREEN_WIDTH2	128	/* Next power of 2 >= SCREEN_WIDTH */
59 # define	WIDTH2	64	/* Next power of 2 >= WIDTH (for fast access) */
60 
61 # define	NAMELEN		20
62 
63 # define	Q_QUIT		0
64 # define	Q_CLOAK		1
65 # define	Q_FLY		2
66 # define	Q_SCAN		3
67 # define	Q_MESSAGE	4
68 
69 # define	C_PLAYER	0
70 # define	C_MONITOR	1
71 # define	C_MESSAGE	2
72 # define	C_SCORES	3
73 # define	C_TESTMSG()	(Query_driver ? C_MESSAGE :\
74 				(Show_scores ? C_SCORES :\
75 				(Am_monitor ? C_MONITOR :\
76 				C_PLAYER)))
77 
78 typedef int			FLAG;
79 
80 /* Objects within the maze: */
81 
82 # define	DOOR	'#'
83 # define	WALL1	'-'
84 # define	WALL2	'|'
85 # define	WALL3	'+'
86 # define	WALL4	'/'
87 # define	WALL5	'\\'
88 # define	KNIFE	'K'
89 # define	SHOT	':'
90 # define	GRENADE	'o'
91 # define	SATCHEL	'O'
92 # define	BOMB	'@'
93 # define	MINE	';'
94 # define	GMINE	'g'
95 # define	SLIME	'$'
96 # define	LAVA	'~'
97 # define	DSHOT	'?'
98 # define	FALL	'F'
99 # define	BOOT		'b'
100 # define	BOOT_PAIR	'B'
101 
102 # define	SPACE	' '
103 
104 # define	ABOVE	'i'
105 # define	BELOW	'!'
106 # define	RIGHT	'}'
107 # define	LEFTS	'{'
108 # define	FLYER	'&'
109 # define	is_player(c)	(c == LEFTS || c == RIGHT ||\
110 				c == ABOVE || c == BELOW || c == FLYER)
111 
112 # ifndef TRUE
113 # define	TRUE	1
114 # define	FALSE	0
115 # endif
116 
117