Source:NetHack 3.0.0/rm.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to rm.h from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/rm.h#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)rm.h	3.0	88/10/25
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef RM_H
6.    #define RM_H
7.    
8.    /*
9.     * The dungeon presentation graphics code and data structures were rewritten
10.    * and generalized for NetHack's release 2 by Eric S. Raymond (eric@snark)
11.    * building on Don G. Kneller's MS-DOS implementation. See options.c for
12.    * the code that permits the user to set the contents of the symbol structure.
13.    */
14.   
15.   /* Level location types */
16.   #define STONE		0
17.   #define HWALL		1
18.   #define VWALL		2
19.   #define TLCORNER	3
20.   #define TRCORNER	4
21.   #define BLCORNER	5
22.   #define BRCORNER	6
23.   #define CROSSWALL	7	/* For pretty mazes and special levels */
24.   #define TUWALL		8
25.   #define TDWALL		9
26.   #define TLWALL		10
27.   #define TRWALL		11
28.   #define SDOOR		12
29.   #define SCORR		13
30.   #define POOL		14
31.   #define MOAT		15	/* pool that doesn't boil, adjust messages */
32.   #define DRAWBRIDGE_UP	16
33.   #define DOOR		17
34.   #define CORR		18
35.   #define ROOM		19
36.   #define STAIRS		20
37.   #define LADDER		21
38.   #define FOUNTAIN	22
39.   #define THRONE		23
40.   #define SINK		24
41.   #define ALTAR		25
42.   #define DRAWBRIDGE_DOWN	26
43.   
44.   /*
45.    * Avoid using the level types in inequalities:
46.    * these types are subject to change.
47.    * Instead, use one of the macros below.
48.    */
49.   #define IS_WALL(typ)	((typ) && (typ) <= TRWALL)
50.   #define IS_STWALL(typ)	((typ) <= TRWALL)	/* STONE <= (typ) <= TRWALL */
51.   #define IS_ROCK(typ)	((typ) < POOL)		/* absolutely nonaccessible */
52.   #define IS_DOOR(typ)	((typ) == DOOR)
53.   #define ACCESSIBLE(typ)	((typ) >= DOOR)		/* good position */
54.   #define IS_ROOM(typ)	((typ) >= ROOM)		/* ROOM, STAIRS, furniture.. */
55.   #define ZAP_POS(typ)	((typ) >= POOL)
56.   #define SPACE_POS(typ)	((typ) > DOOR)
57.   #define IS_CORNER(typ)	((typ) >= TLCORNER && (typ) <= BRCORNER)
58.   #define IS_T(typ)	((typ) >= CRWALL && (typ) <= TRWALL)
59.   #define IS_POOL(typ)	((typ) >= POOL && (typ) <= DRAWBRIDGE_UP)
60.   #define IS_THRONE(typ)	((typ) == THRONE)
61.   #define IS_FOUNTAIN(typ) ((typ) == FOUNTAIN)
62.   #define IS_SINK(typ)	((typ) == SINK)
63.   #define IS_ALTAR(typ)	((typ) == ALTAR)
64.   #define IS_DRAWBRIDGE(typ) ((typ) == DRAWBRIDGE_UP || (typ) == DRAWBRIDGE_DOWN)
65.   #define IS_FURNITURE(typ) ((typ) >= STAIRS && (typ) <= ALTAR)
66.   
67.   /*
68.    * The level-map symbols may be compiled in or defined at initialization time
69.    */
70.   
71.   /* screen symbols for using character graphics. */
72.   struct symbols {
73.       unsigned char stone, vwall, hwall, tlcorn, trcorn, blcorn, brcorn;
74.       unsigned char crwall, tuwall, tdwall, tlwall, trwall;
75.       unsigned char vbeam, hbeam, lslant, rslant;
76.       unsigned char door, room, corr, upstair, dnstair, trap, web;
77.       unsigned char pool;
78.       unsigned char fountain;
79.       unsigned char sink;
80.       unsigned char throne;
81.       unsigned char altar;
82.       unsigned char upladder, dnladder, dbvwall, dbhwall;
83.   };
84.   extern struct symbols showsyms;
85.   #ifdef REINCARNATION
86.   extern struct symbols savesyms;
87.   #endif
88.   extern const struct symbols defsyms;
89.   
90.   #define STONE_SYM	showsyms.stone
91.   #define VWALL_SYM	showsyms.vwall
92.   #define HWALL_SYM	showsyms.hwall
93.   #define TLCORN_SYM	showsyms.tlcorn
94.   #define TRCORN_SYM	showsyms.trcorn
95.   #define BLCORN_SYM	showsyms.blcorn
96.   #define BRCORN_SYM	showsyms.brcorn
97.   #define CRWALL_SYM	showsyms.crwall
98.   #define TUWALL_SYM	showsyms.tuwall
99.   #define TDWALL_SYM	showsyms.tdwall
100.  #define TLWALL_SYM	showsyms.tlwall
101.  #define TRWALL_SYM	showsyms.trwall
102.  #define VBEAM_SYM	showsyms.vbeam
103.  #define HBEAM_SYM	showsyms.hbeam
104.  #define LSLANT_SYM	showsyms.lslant
105.  #define RSLANT_SYM	showsyms.rslant
106.  #define DOOR_SYM	showsyms.door
107.  #define ROOM_SYM	showsyms.room
108.  #define	CORR_SYM	showsyms.corr
109.  #define UP_SYM		showsyms.upstair
110.  #define DN_SYM		showsyms.dnstair
111.  #define TRAP_SYM	showsyms.trap
112.  #define WEB_SYM		showsyms.web
113.  #define	POOL_SYM	showsyms.pool
114.  #define FOUNTAIN_SYM	showsyms.fountain
115.  #define SINK_SYM	showsyms.sink
116.  #define THRONE_SYM	showsyms.throne
117.  #define ALTAR_SYM	showsyms.altar
118.  #define UPLADDER_SYM	showsyms.upladder
119.  #define DNLADDER_SYM	showsyms.dnladder
120.  #define DB_VWALL_SYM	showsyms.dbvwall
121.  #define DB_HWALL_SYM	showsyms.dbhwall
122.  
123.  #define	ERRCHAR	']'
124.  
125.  #define MAXPCHARS	28	/* maximum number of mapped characters */
126.  
127.  /*
128.   * The 5 possible states of doors
129.   */
130.  
131.  #define D_NODOOR	0
132.  #define D_BROKEN	1
133.  #define D_ISOPEN	2
134.  #define D_CLOSED	4
135.  #define D_LOCKED	8
136.  #define D_TRAPPED	16
137.  
138.  /*
139.   * The 3 possible alignments for altars
140.   */
141.  #define A_CHAOS		0
142.  #define A_NEUTRAL	1
143.  #define A_LAW		2
144.  
145.  /*
146.   * Some altars are considered as shrines, so we need a flag.
147.   */
148.  #define A_SHRINE	4
149.  
150.  /*
151.   * Thrones should only be looted once.
152.   */
153.  #define T_LOOTED	1
154.  
155.  /*
156.   * The four directions for a DrawBridge.
157.   */
158.  #define DB_NORTH	0
159.  #define DB_SOUTH	1
160.  #define DB_EAST 	2
161.  #define DB_WEST 	4
162.  #define DB_DIR		7	/* mask for direction */
163.  
164.  /*
165.   * What's under a drawbridge.
166.   */
167.  #define DB_MOAT		0
168.  #define DB_FLOOR	8
169.  #define DB_UNDER	8	/* mask for underneath */
170.  
171.  /* 
172.   * Some walls may be non diggable.
173.   */
174.  #define W_DIGGABLE	0
175.  #define W_NONDIGGABLE	1
176.  #define W_GATEWAY	16	/* is a drawbridge wall */
177.  
178.  /*
179.   * Ladders (in Vlad's tower) may be up or down.
180.   */
181.  #define LA_UP		1
182.  #define LA_DOWN 	2
183.  
184.  /*
185.   * at() display character types, in order of precedence.
186.   */
187.  #define AT_APP		(uchar)0
188.  /* specific overrides */
189.  #define AT_RED		(uchar)1	/* flame */
190.  #define AT_BLUE 	(uchar)4	/* water */
191.  #define AT_WHITE	(uchar)7	/* lightning */
192.  /* non-specific */
193.  #define AT_ZAP		(uchar)8
194.  #define AT_MON		(uchar)9
195.  #define AT_U		AT_MON
196.  #define AT_OBJ		(uchar)10
197.  #define AT_GLD		AT_OBJ
198.  #define AT_MAP		(uchar)11
199.  
200.  /*
201.   * The structure describing a coordinate position.
202.   * Before adding fields, remember that this will significantly affect
203.   * the size of temporary files and save files.
204.   */
205.  struct rm {
206.  	uchar scrsym;
207.  	Bitfield(typ,5);
208.  	Bitfield(new,1);
209.  	Bitfield(seen,1);
210.  	Bitfield(lit,1);
211.  	Bitfield(doormask,5);
212.  	Bitfield(mmask,1);
213.  	Bitfield(omask,1);
214.  	Bitfield(gmask,1);
215.  };
216.  
217.  #define altarmask	doormask
218.  #define diggable	doormask
219.  #define ladder		doormask
220.  #define drawbridgemask	doormask
221.  
222.  extern struct rm levl[COLNO][ROWNO];
223.  
224.  #if defined(DGK) && !defined(TOS)
225.  #define ACTIVE	1
226.  #define SWAPPED	2
227.  
228.  struct finfo {
229.  	int	where;
230.  	long	time;
231.  	long	size;
232.  };
233.  extern struct finfo fileinfo[];
234.  #define ZFINFO	{ 0, 0L, 0L }
235.  #endif
236.  
237.  #endif /* RM_H /**/