1 /* NetHack 3.6 mkroom.h $NHDT-Date: 1560851014 2019/06/18 09:43:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.16 $ */ 2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3 /*-Copyright (c) Pasi Kallinen, 2016. */ 4 /* NetHack may be freely redistributed. See license for details. */ 5 6 #ifndef MKROOM_H 7 #define MKROOM_H 8 9 /* mkroom.h - types and structures for room and shop initialization */ 10 11 struct mkroom { 12 schar lx, hx, ly, hy; /* usually xchar, but hx may be -1 */ 13 schar rtype; /* type of room (zoo, throne, etc...) */ 14 schar orig_rtype; /* same as rtype, but not zeroed later */ 15 schar rlit; /* is the room lit ? */ 16 schar needfill; /* sp_lev: does the room need filling? */ 17 schar needjoining; /* sp_lev */ 18 schar doorct; /* door count */ 19 schar fdoor; /* index for the first door of the room */ 20 schar nsubrooms; /* number of subrooms */ 21 boolean irregular; /* true if room is non-rectangular */ 22 struct mkroom *sbrooms[MAX_SUBROOMS]; /* Subrooms pointers */ 23 struct monst *resident; /* priest/shopkeeper/guard for this room */ 24 }; 25 26 struct shclass { 27 const char *name; /* name of the shop type */ 28 char symb; /* this identifies the shop type */ 29 int prob; /* the shop type probability in % */ 30 schar shdist; /* object placement type */ 31 #define D_SCATTER 0 /* normal placement */ 32 #define D_SHOP 1 /* shop-like placement */ 33 #define D_TEMPLE 2 /* temple-like placement */ 34 struct itp { 35 int iprob; /* probability of an item type */ 36 int itype; /* item type: if >=0 a class, if < 0 a specific item */ 37 } iprobs[6]; 38 const char *const *shknms; /* list of shopkeeper names for this type */ 39 }; 40 41 extern NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2]; 42 extern NEARDATA struct mkroom *subrooms; 43 /* the normal rooms on the current level are described in rooms[0..n] for 44 * some n<MAXNROFROOMS 45 * the vault, if any, is described by rooms[n+1] 46 * the next rooms entry has hx -1 as a flag 47 * there is at most one non-vault special room on a level 48 */ 49 50 extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room; 51 52 extern NEARDATA coord doors[DOORMAX]; 53 54 /* values for rtype in the room definition structure */ 55 enum roomtype_types { 56 OROOM = 0, /* ordinary room */ 57 COURT = 2, /* contains a throne */ 58 SWAMP = 3, /* contains pools */ 59 VAULT = 4, /* detached room usually reached via teleport trap */ 60 BEEHIVE = 5, /* contains killer bees and royal jelly */ 61 MORGUE = 6, /* contains corpses, undead and graves */ 62 BARRACKS = 7, /* contains soldiers and their gear */ 63 ZOO = 8, /* floor covered with treasure and monsters */ 64 DELPHI = 9, /* contains Oracle and peripherals */ 65 TEMPLE = 10, /* contains a shrine (altar attended by priest[ess]) */ 66 LEPREHALL = 11, /* leprechaun hall (Tom Proudfoot) */ 67 COCKNEST = 12, /* cockatrice nest (Tom Proudfoot) */ 68 ANTHOLE = 13, /* ants (Tom Proudfoot) */ 69 SHOPBASE = 14, /* everything above this is a shop */ 70 ARMORSHOP = 15, /* specific shop defines for level compiler */ 71 SCROLLSHOP = 16, 72 POTIONSHOP = 17, 73 WEAPONSHOP = 18, 74 FOODSHOP = 19, 75 RINGSHOP = 20, 76 WANDSHOP = 21, 77 TOOLSHOP = 22, 78 BOOKSHOP = 23, 79 FODDERSHOP = 24, /* health food store */ 80 CANDLESHOP = 25 81 }; 82 83 #define MAXRTYPE (CANDLESHOP) /* maximum valid room type */ 84 #define UNIQUESHOP (CANDLESHOP) /* shops here & above not randomly gen'd. */ 85 86 /* Special type for search_special() */ 87 #define ANY_TYPE (-1) 88 #define ANY_SHOP (-2) 89 90 #define NO_ROOM 0 /* indicates lack of room-occupancy */ 91 #define SHARED 1 /* indicates normal shared boundary */ 92 #define SHARED_PLUS 2 /* indicates shared boundary - extra adjacent-square 93 * searching required */ 94 #define ROOMOFFSET 3 /* (levl[x][y].roomno - ROOMOFFSET) gives rooms[] index, 95 * for inside-squares and non-shared boundaries */ 96 97 #define IS_ROOM_PTR(x) ((x) >= rooms && (x) < rooms + MAXNROFROOMS) 98 #define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS) 99 #define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS) 100 #define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2)) 101 #define ROOM_INDEX(x) ((x) -rooms) 102 #define SUBROOM_INDEX(x) ((x) -subrooms) 103 #define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == nroom) 104 #define IS_LAST_SUBROOM_PTR(x) (!nsubroom || SUBROOM_INDEX(x) == nsubroom) 105 106 #endif /* MKROOM_H */ 107