jcs's openbsd hax
openbsd
1/* $OpenBSD: def.rm.h,v 1.4 2003/03/16 21:22:35 camield Exp $*/
2/* $NetBSD: def.rm.h,v 1.3 1995/03/23 08:29:39 cgd Exp $*/
3
4/*
5 * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
6 * Amsterdam
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are
11 * met:
12 *
13 * - Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 *
16 * - Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * - Neither the name of the Stichting Centrum voor Wiskunde en
21 * Informatica, nor the names of its contributors may be used to endorse or
22 * promote products derived from this software without specific prior
23 * written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
26 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
29 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38/*
39 * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
40 * All rights reserved.
41 *
42 * Redistribution and use in source and binary forms, with or without
43 * modification, are permitted provided that the following conditions
44 * are met:
45 * 1. Redistributions of source code must retain the above copyright
46 * notice, this list of conditions and the following disclaimer.
47 * 2. Redistributions in binary form must reproduce the above copyright
48 * notice, this list of conditions and the following disclaimer in the
49 * documentation and/or other materials provided with the distribution.
50 * 3. The name of the author may not be used to endorse or promote products
51 * derived from this software without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
54 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
55 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
56 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
57 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
58 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
59 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
60 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
61 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
62 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 */
64
65/* Level location types */
66#define HWALL 1
67#define VWALL 2
68#define SDOOR 3
69#define SCORR 4
70#define LDOOR 5
71#define POOL 6 /* not yet fully implemented */
72 /* this should in fact be a bit like lit */
73#define DOOR 7
74#define CORR 8
75#define ROOM 9
76#define STAIRS 10
77
78/*
79 * Avoid using the level types in inequalities:
80 * these types are subject to change.
81 * Instead, use one of the macros below.
82 */
83#define IS_WALL(typ) ((typ) <= VWALL)
84#define IS_ROCK(typ) ((typ) < POOL) /* absolutely nonaccessible */
85#define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */
86#define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM or STAIRS */
87#define ZAP_POS(typ) ((typ) > DOOR)
88
89/*
90 * A few of the associated symbols are not hardwired.
91 */
92#ifdef QUEST
93#define CORR_SYM ':'
94#else
95#define CORR_SYM '#'
96#endif /* QUEST */
97#define POOL_SYM '}'
98
99#define ERRCHAR '{'
100
101/*
102 * The structure describing a coordinate position.
103 * Before adding fields, remember that this will significantly affect
104 * the size of temporary files and save files.
105 */
106struct rm {
107 char scrsym;
108 unsigned typ:5;
109 unsigned new:1;
110 unsigned seen:1;
111 unsigned lit:1;
112};
113extern struct rm levl[COLNO][ROWNO];