Source:NetHack 3.1.0/rm.h

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

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

1.   /*	SCCS Id: @(#)rm.h	3.1	92/09/01		  */ 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 drawing.c for 12.   * the code that permits the user to set the contents of the symbol structure. 13.   *  14.    * The door representation was changed by Ari Huttunen(ahuttune@niksula.hut.fi) 15.   */  16.    17.   /*  18.    * TLCORNER	TDWALL		TRCORNER 19.   * +- 		-+- 		-+  20.    * |  		 |  	 	 |  21.    *  22.    * TRWALL	CROSSWALL	TLWALL		HWALL 23.   * |  		 |  		 |  24.    * +- 		-+- 		-+		---  25.    * |  		 |  		 |  26.    *  27.    * BLCORNER	TUWALL		BRCORNER	VWALL 28.   * |  		 |  		 |		|  29.    * +- 		-+- 		-+		|  30.    */  31.    32.   /* Level location types */ 33.  #define STONE		0 34.  #define VWALL		1 35.  #define HWALL		2 36.  #define TLCORNER	3 37.  #define TRCORNER	4 38.  #define BLCORNER	5 39.  #define BRCORNER	6 40.  #define CROSSWALL	7	/* For pretty mazes and special levels */ 41.  #define TUWALL		8 42.  #define TDWALL		9 43.  #define TLWALL		10 44.  #define TRWALL		11 45.  #define DBWALL		12 46.  #define SDOOR		13 47.  #define SCORR		14 48.  #define POOL		15 49.  #define MOAT		16	/* pool that doesn't boil, adjust messages */ 50.  #define WATER		17 51.  #define DRAWBRIDGE_UP	18 52.  #define LAVAPOOL	19 53.  #define DOOR		20 54.  #define CORR		21 55.  #define ROOM		22 56.  #define STAIRS		23 57.  #define LADDER		24 58.  #define FOUNTAIN	25 59.  #define THRONE		26 60.  #define SINK		27 61.  #define ALTAR		28 62.  #define ICE		29 63.  #define DRAWBRIDGE_DOWN	30 64.  #define AIR		31 65.  #define CLOUD		32 66.   67.   #define INVALID_TYPE	127 68.   69.   /*  70.    * Avoid using the level types in inequalities: 71.   * these types are subject to change. 72.   * Instead, use one of the macros below. 73.   */  74.   #define IS_WALL(typ)	((typ) && (typ) <= DBWALL) 75.  #define IS_STWALL(typ)	((typ) <= DBWALL)	/* STONE <= (typ) <= DBWALL */ 76.  #define IS_ROCK(typ)	((typ) < POOL)		/* absolutely nonaccessible */ 77.  #define IS_DOOR(typ)	((typ) == DOOR) 78.  #define ACCESSIBLE(typ)	((typ) >= DOOR)		/* good position */ 79.  #define IS_ROOM(typ)	((typ) >= ROOM)		/* ROOM, STAIRS, furniture.. */ 80.   #define ZAP_POS(typ)	((typ) >= POOL) 81.  #define SPACE_POS(typ)	((typ) > DOOR) 82.  #define IS_POOL(typ)	((typ) >= POOL && (typ) <= DRAWBRIDGE_UP) 83.  #define IS_THRONE(typ)	((typ) == THRONE) 84.  #define IS_FOUNTAIN(typ) ((typ) == FOUNTAIN) 85.  #define IS_SINK(typ)	((typ) == SINK) 86.  #define IS_ALTAR(typ)	((typ) == ALTAR) 87.  #define IS_DRAWBRIDGE(typ) ((typ) == DRAWBRIDGE_UP || (typ) == DRAWBRIDGE_DOWN) 88.  #define IS_FURNITURE(typ) ((typ) >= STAIRS && (typ) <= ALTAR) 89.  #define IS_AIR(typ)	((typ) == AIR || (typ) == CLOUD) 90.  #define IS_SOFT(typ)	((typ) == AIR || (typ) == CLOUD || IS_POOL(typ)) 91.   92.   /*  93.    * The screen symbols may be the default or defined at game startup time. 94.   * See drawing.c for defaults. 95.   * Note: {ibm|dec}_graphics[] arrays (also in drawing.c) must be kept in synch. 96.   */  97.   #define S_stone		0 98.  #define S_vwall		1 99.  #define S_hwall		2 100. #define S_tlcorn	3 101. #define S_trcorn	4 102. #define S_blcorn	5 103. #define S_brcorn	6 104. #define S_crwall	7 105. #define S_tuwall	8 106. #define S_tdwall	9 107. #define S_tlwall	10 108. #define S_trwall	11 109. #define S_ndoor		12 110. #define S_vodoor	13 111. #define S_hodoor	14 112. #define S_vcdoor	15	/* closed door, vertical wall */ 113. #define S_hcdoor	16	/* closed door, horizontal wall */ 114. #define S_room		17 115. #define S_corr		18 116. #define S_litcorr	19 117. #define S_upstair	20 118. #define S_dnstair	21 119. #define S_upladder	22 120. #define S_dnladder	23 121. #define S_trap		24 122. #define S_web		25 123. #define S_altar		26 124. #define S_throne	27 125. #define S_sink		28 126. #define S_fountain	29 127. #define S_pool		30 128. #define S_ice		31 129. #define S_lava		32 130. #define S_vodbridge	33 131. #define S_hodbridge	34 132. #define S_vcdbridge	35	/* closed drawbridge, vertical wall */ 133. #define S_hcdbridge	36	/* closed drawbridge, horizontal wall */ 134. #define S_air		37 135. #define S_cloud		38 136. #define S_water		39 137. #define S_vbeam		40	/* The 4 zap beam symbols. Do NOT separate. */ 138.  #define S_hbeam		41	/* To change order or add, see function     */ 139. #define S_lslant	42	/* zapdir_to_glyph in display.c.	    */ 140. #define S_rslant	43 141. #define S_digbeam	44	/* dig beam symbol */ 142. #define S_flashbeam	45	/* camera flash symbol */ 143. #define S_boomleft	46	/* thrown boomerang, open left, e.g ')'    */  144.  #define S_boomright	47	/* thrown boomerand, open right, e.g. '('  */ 145. #define S_ss1		48	/* 4 magic shield glyphs */ 146. #define S_ss2		49 147. #define S_ss3		50 148. #define S_ss4		51 149.  150.  /* The 8 swallow symbols. Do NOT separate. To change order or add, see */ 151. /* the function swallow_to_glyph in display.c.			 */ 152. #define S_sw_tl		52	/* swallow top left [1]			*/ 153. #define S_sw_tc		53	/* swallow top center [2]	Order:	*/ 154. #define S_sw_tr		54	/* swallow top right [3]		*/ 155. #define S_sw_ml		55	/* swallow middle left [4]	1 2 3	*/ 156. #define S_sw_mr		56	/* swallow middle right [6]	4 5 6	*/ 157. #define S_sw_bl		57	/* swallow bottom left [7]	7 8 9	*/ 158. #define S_sw_bc		58	/* swallow bottom center [8]		*/ 159. #define S_sw_br		59	/* swallow bottom right [9]		*/ 160.  161.  #define S_explode1	60	/* explosion top left			*/ 162. #define S_explode2	61	/* explosion top center			*/ 163. #define S_explode3	62	/* explosion top right		 Ex.	*/ 164. #define S_explode4	63	/* explosion middle left		*/ 165. #define S_explode5	64	/* explosion middle center	 /-\	*/ 166. #define S_explode6	65	/* explosion middle right	 |@|	*/ 167. #define S_explode7	66	/* explosion bottom left	 \-/	*/ 168. #define S_explode8	67	/* explosion bottom center		*/ 169. #define S_explode9	68	/* explosion bottom right		*/ 170.  171.  #define MAXPCHARS	69	/* maximum number of mapped characters */ 172.  173.  struct symdef { 174.     uchar sym; 175.     const char  *explanation; 176. #ifdef TEXTCOLOR 177.     uchar color; 178. #endif 179. };  180.   181.  extern const struct symdef defsyms[MAXPCHARS];	/* defaults */ 182. extern uchar showsyms[MAXPCHARS]; 183.  184.  /*  185.   * Graphics sets for display symbols 186.  */  187.  #define ASCII_GRAPHICS	0	/* regular characters: '-', '+', &c */ 188. #define IBM_GRAPHICS	1	/* PC graphic characters */ 189. #define DEC_GRAPHICS	2	/* VT100 line drawing characters */ 190. #define MAC_GRAPHICS	3	/* Macintosh drawing characters */ 191.  192.  /*  193.   * The 5 possible states of doors 194.  */  195.   196.  #define D_NODOOR	0 197. #define D_BROKEN	1 198. #define D_ISOPEN	2 199. #define D_CLOSED	4 200. #define D_LOCKED	8 201. #define D_TRAPPED	16 202.  203.  /*  204.   * The 3 possible alignments for altars 205.  */  206.  #ifndef ALIGN_H 207. #include "align.h"		/* defines the "AM_" values */ 208. #endif 209.  210.  /*  211.   * Some altars are considered as shrines, so we need a flag. 212.  */  213.  #define AM_SHRINE	8 214.  215.  /*  216.   * Thrones should only be looted once. 217.  */  218.  #define T_LOOTED	1 219.  220.  /*  221.   * Fountains have limits, and special warnings. 222.  */  223.  #define F_LOOTED	1 224. #define F_WARNED	2 225.  226.  /*  227.   * Sinks have 3 different types of loot that shouldn't be abused 228.  */  229.  #define S_LPUDDING	1 230. #define S_LDWASHER	2 231. #define S_LRING		4 232.  233.  /*  234.   * The four directions for a DrawBridge. 235.  */  236.  #define DB_NORTH	0 237. #define DB_SOUTH	1 238. #define DB_EAST		2 239. #define DB_WEST		3 240. #define DB_DIR		3	/* mask for direction */ 241.  242.  /*  243.   * What's under a drawbridge. 244.  */  245.  #define DB_MOAT		0 246. #define DB_LAVA		4 247. #define DB_ICE		8 248. #define DB_FLOOR	16 249. #define DB_UNDER	28	/* mask for underneath */ 250.  251.  /*  252.   * Some walls may be non diggable. 253.  */  254.  #define W_DIGGABLE	0 255. #define W_NONDIGGABLE	1 256. #define W_REPAIRED	2 257.  258.  /*  259.   * Ladders (in Vlad's tower) may be up or down. 260.  */  261.  #define LA_UP		1 262. #define LA_DOWN		2 263.  264.  /*  265.   * Room areas may be iced pools 266.  */  267.  #define ICED_POOL	8 268. #define ICED_MOAT	16 269.  270.  /*  271.   * The structure describing a coordinate position. 272.  * Before adding fields, remember that this will significantly affect 273.  * the size of temporary files and save files. 274.  */  275.  struct rm { 276. 	int glyph;		/* what the hero thinks is there */ 277. 	schar typ;		/* what is really there */ 278. 	Bitfield(seen,1);	/* speed hack for room walls on corridors */ 279. 	Bitfield(lit,1);	/* speed hack for lit rooms */ 280. 	Bitfield(flags,5);	/* extra information for typ */ 281. 	Bitfield(horizontal,1);	/* wall/door/etc is horiz. (more typ info) */ 282. 	Bitfield(waslit,1);	/* remember if a location was lit */ 283. 	Bitfield(roomno,6);	/* room # for special rooms */ 284. 	Bitfield(edge,1);	/* marks boundaries for special rooms*/ 285. };  286.   287.  #define doormask	flags 288. #define altarmask	flags 289. #define diggable	flags 290. #define ladder		flags 291. #define drawbridgemask	flags 292. #define looted		flags 293. #define icedpool	flags 294.  295.  #define blessedftn      horizontal  /* a fountain that grants attribs */ 296.  297.  struct damage { 298. 	struct damage *next; 299. 	long when, cost; 300. 	coord place; 301. 	schar typ; 302. };  303.   304.  struct levelflags { 305. 	uchar	nfountains;	/* Number of fountains on level */ 306. 	uchar	nsinks;		/* Number of sinks on the level */ 307. 	/* Several flags that give hints about what's on the level */ 308. 	Bitfield(has_shop, 1); 309. 	Bitfield(has_vault, 1); 310. 	Bitfield(has_zoo, 1); 311. 	Bitfield(has_court, 1); 312. 	Bitfield(has_morgue, 1); 313. 	Bitfield(has_beehive, 1); 314. #ifdef ARMY 315. 	Bitfield(has_barracks, 1); 316. #endif 317. 	Bitfield(has_temple, 1); 318. 	Bitfield(has_swamp, 1); 319. 	Bitfield(noteleport,1); 320. 	Bitfield(hardfloor,1); 321. 	Bitfield(nommap,1); 322. 	Bitfield(hero_memory,1);	/* hero has memory */ 323. 	Bitfield(shortsighted,1);	/* monsters are shortsighted */ 324. 	Bitfield(is_maze_lev,1); 325. 	Bitfield(is_cavernous_lev,1); 326. };  327.   328.  typedef struct 329. {  330.      struct rm		locations[COLNO][ROWNO]; 331. #ifndef MICROPORT_BUG 332.     struct obj		*objects[COLNO][ROWNO]; 333.     struct monst	*monsters[COLNO][ROWNO]; 334. #else 335.     struct obj		*objects[1][ROWNO]; 336.     char		*yuk1[COLNO-1][ROWNO]; 337.     struct monst	*monsters[1][ROWNO]; 338.     char		*yuk2[COLNO-1][ROWNO]; 339. #endif 340.     struct obj		*objlist; 341.     struct monst	*monlist; 342.     struct damage	*damagelist; 343.     struct levelflags	flags; 344. }  345.  dlevel_t; 346.  347.  extern dlevel_t	level;	/* structure describing the current level */ 348.  349.  /*  350.   * Macros for compatibility with old code. Someday these will go away. 351.  */  352.  #define levl		level.locations 353. #define fobj		level.objlist 354. #define fmon		level.monlist 355.  356.  #define OBJ_AT(x,y)	(level.objects[x][y] != (struct obj *)0) 357. /*  358.   * Macros for encapsulation of level.monsters references. 359.  */  360.  #define MON_AT(x,y)	(level.monsters[x][y] != (struct monst *)0) 361. #define place_monster(m,x,y)	((m)->mx=(x),(m)->my=(y),\  362.  				 level.monsters[(m)->mx][(m)->my]=(m)) 363. #define place_worm_seg(m,x,y)	level.monsters[x][y] = m  364. #define remove_monster(x,y)	level.monsters[x][y] = (struct monst *)0 365. #define m_at(x,y)		level.monsters[x][y] 366.  367.  #endif /* RM_H */