Source:SLASH'EM 0.0.7E7F2/mkroom.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to mkroom.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/mkroom.h#line123]], for example.

The latest source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)mkroom.h	3.4	1992/11/14	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef MKROOM_H
6.    #define MKROOM_H
7.    
8.    /* mkroom.h - types and structures for room and shop initialization */
9.    
10.   struct mkroom {
11.   	schar lx,hx,ly,hy;	/* usually xchar, but hx may be -1 */
12.   	schar rtype;		/* type of room (zoo, throne, etc...) */
13.   	schar rlit;			/* is the room lit ? */
14.   	schar doorct;		/* door count */
15.   	schar fdoor;		/* index for the first door of the room */
16.   	schar nsubrooms;	/* number of subrooms */
17.   	boolean irregular;	/* true if room is non-rectangular */
18.   	struct mkroom *sbrooms[MAX_SUBROOMS];  /* Subrooms pointers */
19.   	struct monst *resident; /* priest/shopkeeper/guard for this room */
20.   };
21.   
22.   struct shclass {
23.   	const char *name;	/* name of the shop type */
24.   	char	symb;		/* this identifies the shop type */
25.   	int	prob;		/* the shop type probability in % */
26.   	schar	shdist;		/* object placement type */
27.   #define D_SCATTER	0	/* normal placement */
28.   #define D_SHOP		1	/* shop-like placement */
29.   #define D_TEMPLE	2	/* temple-like placement */
30.   	struct itp {
31.   	    int iprob;		/* probability of an item type */
32.   	    int itype;		/* item type: if >=0 a class, if < 0 a specific item */
33.   	} iprobs[8];
34.   	const char * const *shknms;	/* list of shopkeeper names for this type */
35.   };
36.   
37.   extern NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2];
38.   extern NEARDATA struct mkroom* subrooms;
39.   /* the normal rooms on the current level are described in rooms[0..n] for
40.    * some n<MAXNROFROOMS
41.    * the vault, if any, is described by rooms[n+1]
42.    * the next rooms entry has hx -1 as a flag
43.    * there is at most one non-vault special room on a level
44.    */
45.   
46.   extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;
47.   
48.   struct door {
49.   	xchar x,y;
50.   	short arti_key;		/* Index (ART_) of key for this door */
51.   };
52.   
53.   extern NEARDATA struct door doors[DOORMAX];
54.   
55.   /* values for rtype in the room definition structure */
56.   #define OROOM		 0	/* ordinary room */
57.   #define COURT		 2	/* contains a throne */
58.   #define SWAMP		 3	/* contains pools */
59.   #define VAULT		 4	/* contains piles of gold */
60.   #define BEEHIVE		 5	/* contains killer bees and royal jelly */
61.   #define MORGUE		 6	/* contains corpses, undead and ghosts */
62.   #define BARRACKS	 7	/* contains soldiers and their gear */
63.   #define ZOO		 8	/* floor covered with treasure and monsters */
64.   #define DELPHI		 9	/* contains Oracle and peripherals */
65.   #define TEMPLE		10	/* contains a shrine */
66.   /* [Tom] new rooms... */
67.   #define REALZOO         11      /* zoo-like monsters (monkeys, etc.) */
68.   #define GIANTCOURT      12      /* a giant courtroom */
69.   #define LEPREHALL       13      /* leprechaun hall (Tom Proudfoot) */
70.   #define DRAGONLAIR      14      /* dragons and $$$ */
71.   #define BADFOODSHOP     15      /* bad food! */
72.   #define COCKNEST        16      /* cockatrice nest! */
73.   #define ANTHOLE         17      /* ants! */
74.   #define LEMUREPIT       18      /* lemures */
75.   #define MIGOHIVE        19      /* Mi-Go */
76.   #define FUNGUSFARM      20      /* molds, puddings, and slime */
77.   
78.   #define SHOPBASE        21      	/* everything above this is a shop */
79.   #define ARMORSHOP       (SHOPBASE+ 1)   /* specific shop defines for level compiler */
80.   #define SCROLLSHOP      (SHOPBASE+ 2)
81.   #define POTIONSHOP      (SHOPBASE+ 3)
82.   #define WEAPONSHOP      (SHOPBASE+ 4)
83.   #define FOODSHOP        (SHOPBASE+ 5)
84.   #define RINGSHOP        (SHOPBASE+ 6)
85.   #define WANDSHOP        (SHOPBASE+ 7)
86.   #define TOOLSHOP        (SHOPBASE+ 8)
87.   #define PETSHOP         (SHOPBASE+ 9)		/* Stephen White */
88.   #define TINSHOP         (SHOPBASE+10)		/* Robin Johnson */
89.   #define BOOKSHOP        (SHOPBASE+11)
90.   #define UNIQUESHOP      (SHOPBASE+12)      /* shops here & above not randomly gen'd. */
91.   #define CANDLESHOP      (UNIQUESHOP)
92.   #ifdef BLACKMARKET
93.   #define BLACKSHOP       (UNIQUESHOP+1)
94.   #define MAXRTYPE        (UNIQUESHOP+1)      /* maximum valid room type */
95.   #else /* BLACKMARKET */
96.   #define MAXRTYPE        (UNIQUESHOP)      /* maximum valid room type */
97.   #endif /* BLACKMARKET */
98.   
99.   /* Special type for search_special() */
100.  #define ANY_TYPE	(-1)
101.  #define ANY_SHOP	(-2)
102.  
103.  #define NO_ROOM		0	/* indicates lack of room-occupancy */
104.  #define SHARED		1	/* indicates normal shared boundary */
105.  #define SHARED_PLUS	2	/* indicates shared boundary - extra adjacent-
106.  				 * square searching required */
107.  
108.  #define ROOMOFFSET	3	/*
109.  				 * (levl[x][y].roomno - ROOMOFFSET) gives
110.  				 * rooms[] index, for inside-squares and
111.  				 * non-shared boundaries.
112.  				 */
113.  
114.  #define IS_ROOM_PTR(x)		((x) >= rooms && (x) < rooms + MAXNROFROOMS)
115.  #define IS_ROOM_INDEX(x)	((x) >= 0 && (x) < MAXNROFROOMS)
116.  #define IS_SUBROOM_PTR(x)	((x) >= subrooms && \
117.  				 (x) < subrooms + MAXNROFROOMS)
118.  #define IS_SUBROOM_INDEX(x)	((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS*2))
119.  #define ROOM_INDEX(x)		((x) - rooms)
120.  #define SUBROOM_INDEX(x)	((x) - subrooms)
121.  #define IS_LAST_ROOM_PTR(x)	(ROOM_INDEX(x) == nroom)
122.  #define IS_LAST_SUBROOM_PTR(x)	(!nsubroom || SUBROOM_INDEX(x) == nsubroom)
123.  
124.  #endif /* MKROOM_H */