Source:NetHack 1.4f/rm.h

From NetHackWiki
Revision as of 01:30, 4 March 2008 by Kernigh bot (talk | contribs) (NetHack 1.4f/rm.h moved to Source:NetHack 1.4f/rm.h: Robot: moved page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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