Source:NetHack 2.2a/rm.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to rm.h from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/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.1	87/10/17
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.   
26.   /*
27.    * Avoid using the level types in inequalities:
28.    *  these types are subject to change.
29.    * Instead, use one of the macros below.
30.    */
31.   #define	IS_WALL(typ)	((typ) <= VWALL)
32.   #define IS_ROCK(typ)	((typ) < POOL)		/* absolutely nonaccessible */
33.   #define	ACCESSIBLE(typ)	((typ) >= DOOR)			/* good position */
34.   #define	IS_ROOM(typ)		((typ) >= ROOM)		/* ROOM or STAIRS */
35.   #ifdef RPH
36.   /* zappable positions include 1 in 5 doors. */
37.   #define ZAP_POS(typ)	((typ) >= POOL || (((typ) == DOOR) && !rn2(5)))
38.   #define SPACE_POS(typ)	((typ) > DOOR)
39.   #else
40.   #define	ZAP_POS(typ)		((typ) > DOOR)
41.   #endif
42.   #define IS_POOL(typ)    ((typ) == POOL)
43.   #define IS_THRONE(typ)    ((typ) == THRONE)
44.   #define IS_FOUNTAIN(typ)        ((typ) == FOUNTAIN)
45.   
46.   /*
47.    * The level-map symbols may be compiled in or defined at initialization time
48.    */
49.   #ifndef GRAPHICS
50.   
51.   #define STONE_SYM	' '
52.   #define VWALL_SYM	'|'
53.   #define HWALL_SYM	'-'
54.   #define TLCORN_SYM	'+'
55.   #define TRCORN_SYM	'+'
56.   #define BLCORN_SYM	'+'
57.   #define BRCORN_SYM	'+'
58.   #define DOOR_SYM	'+'
59.   #define ROOM_SYM	'.'
60.   #ifdef QUEST
61.   # define	CORR_SYM	':'
62.   #else
63.   # define	CORR_SYM	'#'
64.   #endif
65.   #define UP_SYM		'<'
66.   #define DN_SYM		'>'
67.   #define TRAP_SYM	'^'
68.   #define	POOL_SYM	'}'
69.   #define FOUNTAIN_SYM    '{'
70.   #define THRONE_SYM      '\\'
71.   #define WEB_SYM         '"'
72.   #else /* GRAPHICS */
73.   
74.   /* screen symbols for using character graphics. */
75.   struct symbols {
76.       unsigned char stone, vwall, hwall, tlcorn, trcorn, blcorn, brcorn;
77.       unsigned char door, room, corr, upstair, dnstair, trap;
78.   #ifdef FOUNTAINS
79.       unsigned char pool, fountain;
80.   #endif
81.   #ifdef NEWCLASS
82.       unsigned char throne;
83.   #endif
84.   #ifdef SPIDERS
85.       unsigned char web;
86.   #endif
87.   };
88.   extern struct symbols showsyms, 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 DOOR_SYM	showsyms.door
98.   #define ROOM_SYM	showsyms.room
99.   #define	CORR_SYM	showsyms.corr
100.  #define UP_SYM		showsyms.upstair
101.  #define DN_SYM		showsyms.dnstair
102.  #define TRAP_SYM	showsyms.trap
103.  #define	POOL_SYM	showsyms.pool
104.  #define FOUNTAIN_SYM    showsyms.fountain
105.  #define THRONE_SYM      showsyms.throne
106.  #define WEB_SYM         showsyms.web
107.  #endif
108.  
109.  #define	ERRCHAR	']'
110.  
111.  #define MAXPCHARS	17	/* maximum number of mapped characters */
112.  
113.  #define IS_CORNER(x)	((x) == TLCORN_SYM || (x) == TRCORN_SYM \
114.  			 || (x) == BLCORN_SYM || (x) == BRCORN_SYM)
115.  
116.  /*
117.   * The structure describing a coordinate position.
118.   * Before adding fields, remember that this will significantly affect
119.   * the size of temporary files and save files.
120.   */
121.  #ifdef MSDOS
122.  /* Save disk space by using unsigned char's instead of unsigned ints
123.   */
124.  struct rm {
125.  	uchar scrsym;
126.  	unsigned typ:5;
127.  	unsigned new:1;
128.  	unsigned seen:1;
129.  	unsigned lit:1;
130.  };
131.  #else
132.  struct rm {
133.  	char scrsym;
134.  	Bitfield(typ,5);
135.  	Bitfield(new,1);
136.  	Bitfield(seen,1);
137.  	Bitfield(lit,1);
138.  };
139.  #endif /* MSDOS /**/
140.  extern struct rm levl[COLNO][ROWNO];
141.  
142.  #ifdef DGK
143.  #define ACTIVE	1
144.  #define SWAPPED	2
145.  
146.  struct finfo {
147.  	int	where;
148.  	long	time;
149.  	long	size;
150.  };
151.  extern struct finfo fileinfo[];
152.  #define ZFINFO	{ 0, 0L, 0L }
153.  #endif