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