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
10struct 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
22struct 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[5];
34	const char * const *shknms;	/* list of shopkeeper names for this type */
35};
36
37extern NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2];
38extern 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
46extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;
47
48extern NEARDATA coord doors[DOORMAX];
49
50/* values for rtype in the room definition structure */
51#define OROOM		 0	/* ordinary room */
52#define COURT		 2	/* contains a throne */
53#define SWAMP		 3	/* contains pools */
54#define VAULT		 4	/* contains piles of gold */
55#define BEEHIVE		 5	/* contains killer bees and royal jelly */
56#define MORGUE		 6	/* contains corpses, undead and ghosts */
57#define BARRACKS	 7	/* contains soldiers and their gear */
58#define ZOO		 8	/* floor covered with treasure and monsters */
59#define DELPHI		 9	/* contains Oracle and peripherals */
60#define TEMPLE		10	/* contains a shrine */
61#define LEPREHALL	11	/* leprechaun hall (Tom Proudfoot) */
62#define COCKNEST	12	/* cockatrice nest (Tom Proudfoot) */
63#define ANTHOLE		13	/* ants (Tom Proudfoot) */
64#define SHOPBASE	14	/* everything above this is a shop */
65#define ARMORSHOP	15	/* specific shop defines for level compiler */
66#define SCROLLSHOP	16
67#define POTIONSHOP	17
68#define WEAPONSHOP	18
69#define FOODSHOP	19
70#define RINGSHOP	20
71#define WANDSHOP	21
72#define TOOLSHOP	22
73#define BOOKSHOP	23
74#define UNIQUESHOP	24	/* shops here & above not randomly gen'd. */
75#define CANDLESHOP	24
76#define MAXRTYPE	24	/* maximum valid room type */
77
78/* Special type for search_special() */
79#define ANY_TYPE	(-1)
80#define ANY_SHOP	(-2)
81
82#define NO_ROOM		0	/* indicates lack of room-occupancy */
83#define SHARED		1	/* indicates normal shared boundary */
84#define SHARED_PLUS	2	/* indicates shared boundary - extra adjacent-
85				 * square searching required */
86
87#define ROOMOFFSET	3	/*
88				 * (levl[x][y].roomno - ROOMOFFSET) gives
89				 * rooms[] index, for inside-squares and
90				 * non-shared boundaries.
91				 */
92
93#define IS_ROOM_PTR(x)		((x) >= rooms && (x) < rooms + MAXNROFROOMS)
94#define IS_ROOM_INDEX(x)	((x) >= 0 && (x) < MAXNROFROOMS)
95#define IS_SUBROOM_PTR(x)	((x) >= subrooms && \
96				 (x) < subrooms + MAXNROFROOMS)
97#define IS_SUBROOM_INDEX(x)	((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS*2))
98#define ROOM_INDEX(x)		((x) - rooms)
99#define SUBROOM_INDEX(x)	((x) - subrooms)
100#define IS_LAST_ROOM_PTR(x)	(ROOM_INDEX(x) == nroom)
101#define IS_LAST_SUBROOM_PTR(x)	(!nsubroom || SUBROOM_INDEX(x) == nsubroom)
102
103#endif /* MKROOM_H */
104