Fandom

Wikihack

Source:NetHack 2.3e/rm.h

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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

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

Screenshots and source code from Hack are used under the CWI license.
1.    /*	SCCS Id: @(#)rm.h	2.3	88/03/29
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    
4.    /*
5.     * The dungeon presentation graphics code and data structures were rewritten
6.     * and generalized for NetHack's release 2 by Eric S. Raymond (eric@snark)
7.     * building on Don G. Kneller's MS-DOS implementation. See options.c for
8.     * the code that permits the user to set the contents of the symbol structure.
9.     */
10.   
11.   /* Level location types */
12.   #define	HWALL 1
13.   #define	VWALL 2
14.   #define	SDOOR 3
15.   #define	SCORR 4
16.   #define	LDOOR 5
17.   #define	POOL	6	/* not yet fully implemented */
18.   			/* this should in fact be a bit like lit */
19.   #define	DOOR	  7
20.   #define	CORR	  8
21.   #define	ROOM	  9
22.   #define	STAIRS 	 10
23.   #define FOUNTAIN 11
24.   #define THRONE	 12
25.   #define	SINK	 13
26.   
27.   /*
28.    * Avoid using the level types in inequalities:
29.    *  these types are subject to change.
30.    * Instead, use one of the macros below.
31.    */
32.   #define	IS_WALL(typ)	((typ) <= VWALL)
33.   #define IS_ROCK(typ)	((typ) < POOL)		/* absolutely nonaccessible */
34.   #define	ACCESSIBLE(typ)	((typ) >= DOOR)			/* good position */
35.   #define	IS_ROOM(typ)		((typ) >= ROOM)		/* ROOM or STAIRS */
36.   #ifdef RPH
37.   /* zappable positions include 1 in 5 doors. */
38.   #define ZAP_POS(typ)	((typ) >= POOL || (((typ) == DOOR) && !rn2(5)))
39.   #define SPACE_POS(typ)	((typ) > DOOR)
40.   #else
41.   #define	ZAP_POS(typ)		((typ) > DOOR)
42.   #endif
43.   #define IS_POOL(typ)    ((typ) == POOL)
44.   #define IS_THRONE(typ)    ((typ) == THRONE)
45.   #define IS_FOUNTAIN(typ)        ((typ) == FOUNTAIN)
46.   #define IS_SINK(typ)	((typ) == SINK)
47.   
48.   /*
49.    * The level-map symbols may be compiled in or defined at initialization time
50.    */
51.   #ifndef GRAPHICS
52.   
53.   #define STONE_SYM	' '
54.   #define VWALL_SYM	'|'
55.   #define HWALL_SYM	'-'
56.   #define TLCORN_SYM	'+'
57.   #define TRCORN_SYM	'+'
58.   #define BLCORN_SYM	'+'
59.   #define BRCORN_SYM	'+'
60.   #define DOOR_SYM	'+'
61.   #define ROOM_SYM	'.'
62.   #ifdef QUEST
63.   # define	CORR_SYM	':'
64.   #else
65.   # define	CORR_SYM	'#'
66.   #endif
67.   #define UP_SYM		'<'
68.   #define DN_SYM		'>'
69.   #define TRAP_SYM	'^'
70.   #define	POOL_SYM	'}'
71.   #define FOUNTAIN_SYM    '{'
72.   #define THRONE_SYM      '\\'
73.   #define WEB_SYM         '"'
74.   #define SINK_SYM	'#'
75.   #else /* GRAPHICS */
76.   
77.   /* screen symbols for using character graphics. */
78.   struct symbols {
79.       unsigned char stone, vwall, hwall, tlcorn, trcorn, blcorn, brcorn;
80.       unsigned char door, room, corr, upstair, dnstair, trap;
81.   #ifdef FOUNTAINS
82.       unsigned char pool, fountain;
83.   #endif
84.   #ifdef NEWCLASS
85.       unsigned char throne;
86.   #endif
87.   #ifdef SPIDERS
88.       unsigned char web;
89.   #endif
90.   #ifdef SINKS
91.       unsigned char sink;
92.   #endif
93.   };
94.   extern struct symbols showsyms, defsyms;
95.   
96.   #define STONE_SYM	showsyms.stone
97.   #define VWALL_SYM	showsyms.vwall
98.   #define HWALL_SYM	showsyms.hwall
99.   #define TLCORN_SYM	showsyms.tlcorn
100.  #define TRCORN_SYM	showsyms.trcorn
101.  #define BLCORN_SYM	showsyms.blcorn
102.  #define BRCORN_SYM	showsyms.brcorn
103.  #define DOOR_SYM	showsyms.door
104.  #define ROOM_SYM	showsyms.room
105.  #define	CORR_SYM	showsyms.corr
106.  #define UP_SYM		showsyms.upstair
107.  #define DN_SYM		showsyms.dnstair
108.  #define TRAP_SYM	showsyms.trap
109.  #define	POOL_SYM	showsyms.pool
110.  #define FOUNTAIN_SYM    showsyms.fountain
111.  #define THRONE_SYM      showsyms.throne
112.  #define WEB_SYM         showsyms.web
113.  #define SINK_SYM	showsyms.sink
114.  #endif
115.  
116.  #define	ERRCHAR	']'
117.  
118.  #define MAXPCHARS	17	/* maximum number of mapped characters */
119.  
120.  #define IS_CORNER(x)	((x) == TLCORN_SYM || (x) == TRCORN_SYM \
121.  			 || (x) == BLCORN_SYM || (x) == BRCORN_SYM)
122.  
123.  /*
124.   * The structure describing a coordinate position.
125.   * Before adding fields, remember that this will significantly affect
126.   * the size of temporary files and save files.
127.   */
128.  #ifdef MSDOS
129.  /* Save disk space by using unsigned char's instead of unsigned ints
130.   */
131.  struct rm {
132.  	uchar scrsym;
133.  	unsigned typ:5;
134.  	unsigned new:1;
135.  	unsigned seen:1;
136.  	unsigned lit:1;
137.  };
138.  #else
139.  struct rm {
140.  	char scrsym;
141.  	Bitfield(typ,5);
142.  	Bitfield(new,1);
143.  	Bitfield(seen,1);
144.  	Bitfield(lit,1);
145.  };
146.  #endif /* MSDOS /**/
147.  extern struct rm levl[COLNO][ROWNO];
148.  
149.  #ifdef DGK
150.  #define ACTIVE	1
151.  #define SWAPPED	2
152.  
153.  struct finfo {
154.  	int	where;
155.  	long	time;
156.  	long	size;
157.  };
158.  extern struct finfo fileinfo[];
159.  #define ZFINFO	{ 0, 0L, 0L }
160.  #endif

Also on Fandom

Random Wiki