Wikia

Wikihack

Source:NetHack 3.1.0/dungeon.h

2,032pages on
this wiki
Talk0

Below is the full text to dungeon.h from the source code of NetHack 3.1.0. To link to a particular line, write [[NetHack 3.1.0/dungeon.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.
1.    /*	SCCS Id: @(#)dungeon.h	3.1	93/01/17	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef DUNGEON_H
6.    #define DUNGEON_H
7.    
8.    typedef struct d_flags {	/* dungeon/level type flags */
9.    	Bitfield(town, 1);	/* is this a town? (levels only) */
10.   	Bitfield(hellish, 1);	/* is this part of hell? */
11.   	Bitfield(maze_like, 1);	/* is this a maze? */
12.   	Bitfield(rogue_like, 1); /* is this an old-fashioned presentation? */
13.   	Bitfield(align, 3);	/* dungeon alignment. */
14.   	Bitfield(unused, 1);	/* etc... */
15.   } d_flags;
16.   
17.   #include "align.h"
18.   
19.   typedef struct d_level {	/* basic dungeon level element */
20.   	xchar	dnum;		/* dungeon number */
21.   	xchar	dlevel;		/* level number */
22.   } d_level;
23.   
24.   typedef struct s_level {	/* special dungeon level element */
25.   	struct	s_level	*next;
26.   	d_level	dlevel;		/* dungeon & level numbers */
27.   	char	proto[15];	/* name of prototype file (eg. "tower") */
28.   	char    boneid;		/* character to id level in bones files */
29.   	uchar	rndlevs;	/* no. of randomly available similar levels */
30.   	d_flags	flags;		/* type flags */
31.   } s_level;
32.   
33.   typedef struct stairway {	/* basic stairway identifier */
34.   	xchar	sx, sy;		/* x / y location of the stair */
35.   	d_level	tolev;		/* where does it go */
36.   	char	up;		/* what type of stairway (up/down) */
37.   } stairway;
38.   
39.   /* level region types */
40.   #define LR_DOWNSTAIR 0
41.   #define LR_UPSTAIR 1
42.   #define LR_PORTAL 2
43.   #define LR_BRANCH 3
44.   #define LR_TELE 4
45.   #define LR_UPTELE 5
46.   #define LR_DOWNTELE 6
47.   
48.   typedef struct dest_area {	/* non-stairway level change indentifier */
49.   	xchar	lx, ly;		/* "lower" left corner (near [0,0]) */
50.   	xchar	hx, hy;		/* "upper" right corner (near [COLNO,ROWNO]) */
51.   	xchar	nlx, nly;	/* outline of invalid area */
52.   	xchar	nhx, nhy;	/* opposite corner of invalid area */
53.   } dest_area;
54.   
55.   typedef struct dungeon {	/* basic dungeon identifier */
56.   	char	dname[24];	/* name of the dungeon (eg. "Hell") */
57.   	char	proto[15];	/* name of prototype file (eg. "tower") */
58.   	char	boneid;		/* character to id dungeon in bones files */
59.   	d_flags	flags;		/* dungeon flags */
60.   	xchar	entry_lev;	/* entry level */
61.   	xchar	num_dunlevs;	/* number of levels in this dungeon */
62.   	xchar	dunlev_ureached; /* how deep you have been in this dungeon */
63.   	int	ledger_start,	/* the starting depth in "real" terms */
64.   		depth_start;	/* the starting depth in "logical" terms */
65.   } dungeon;
66.   
67.   /*
68.    * A branch structure defines the connection between two dungeons.  They
69.    * will be ordered by the dungeon number/level number of 'end1'.  Ties
70.    * are resolved by 'end2'.  'Type' uses 'end1' arbitrarily as the primary
71.    * point.
72.    */
73.   typedef struct branch {
74.       struct branch *next;	/* next in the branch chain */
75.       int		  id;		/* branch identifier */
76.       int		  type;		/* type of branch */
77.       d_level	  end1;		/* "primary" end point */
78.       d_level	  end2;		/* other end point */
79.       boolean	  end1_up;	/* does end1 go up? */
80.   } branch;
81.   
82.   /* branch types */
83.   #define BR_STAIR   0	/* "Regular" connection, 2 staircases. */
84.   #define BR_NO_END1 1	/* "Regular" connection.  However, no stair from  */
85.   			/*	end1 to end2.  There is a stair from end2 */
86.   			/*	to end1.				  */
87.   #define BR_NO_END2 2	/* "Regular" connection.  However, no stair from  */
88.   			/*	end2 to end1.  There is a stair from end1 */
89.   			/*	to end2.				  */
90.   #define BR_PORTAL  3	/* Connection by magic portals (traps) */
91.   
92.   
93.   /* A particular dungeon contains num_dunlevs d_levels with dlevel 1..
94.    * num_dunlevs.  Ledger_start and depth_start are bases that are added
95.    * to the dlevel of a particular d_level to get the effective ledger_no
96.    * and depth for that d_level.
97.    *
98.    * Ledger_no is a bookkeeping number that gives a unique identifier for a
99.    * particular d_level (for level.?? files, e.g.).
100.   *
101.   * Depth corresponds to the number of floors below the surface.
102.   */
103.  #define Is_astralevel(x)	(on_level(x, &astral_level))
104.  #define Is_earthlevel(x)	(on_level(x, &earth_level))
105.  #define Is_waterlevel(x)	(on_level(x, &water_level))
106.  #define Is_firelevel(x)		(on_level(x, &fire_level))
107.  #define Is_airlevel(x)		(on_level(x, &air_level))
108.  #define Is_medusa_level(x)	(on_level(x, &medusa_level))
109.  #define Is_oracle_level(x)	(on_level(x, &oracle_level))
110.  #define Is_valley(x)		(on_level(x, &valley_level))
111.  #define Is_asmo_level(x)	(on_level(x, &asmodeus_level))
112.  #define Is_baal_level(x)	(on_level(x, &baalzebub_level))
113.  #define Is_wiz1_level(x)	(on_level(x, &wiz1_level))
114.  #define Is_wiz2_level(x)	(on_level(x, &wiz2_level))
115.  #define Is_wiz3_level(x)	(on_level(x, &wiz3_level))
116.  #define Is_sanctum(x)		(on_level(x, &sanctum_level))
117.  #define Is_portal_level(x)	(on_level(x, &portal_level))
118.  #define Is_rogue_level(x)	(on_level(x, &rogue_level))
119.  #define Is_stronghold(x)	(on_level(x, &stronghold_level))
120.  #define Is_bigroom(x)		(on_level(x, &bigroom_level))
121.  #ifdef MULDGN
122.  #define Is_qstart(x)		(on_level(x, &qstart_level))
123.  #define Is_qlocate(x)		(on_level(x, &qlocate_level))
124.  #define Is_nemesis(x)		(on_level(x, &nemesis_level))
125.  #define Is_knox(x)		(on_level(x, &knox_level))
126.  #endif
127.  
128.  #define Inhell			In_hell(&u.uz)	/* now gehennom */
129.  #define In_endgame(x)		((x)->dnum == astral_level.dnum)
130.  
131.  #endif /* DUNGEON_H */

Around Wikia's network

Random Wiki