mkroom.h

Go to the documentation of this file.
00001 /*      SCCS Id: @(#)mkroom.h   3.4     1992/11/14      */
00002 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
00003 /* NetHack may be freely redistributed.  See license for details. */
00004 
00005 #ifndef MKROOM_H
00006 #define MKROOM_H
00007 
00008 /* mkroom.h - types and structures for room and shop initialization */
00009 
00010 struct mkroom {
00011         schar lx,hx,ly,hy;      /* usually xchar, but hx may be -1 */
00012         schar rtype;            /* type of room (zoo, throne, etc...) */
00013         schar rlit;             /* is the room lit ? */
00014         schar needfill;         /* does the room need filling? */
00015         schar doorct;           /* door count */
00016         schar fdoor;            /* index for the first door of the room */
00017         schar nsubrooms;        /* number of subrooms */
00018         boolean irregular;      /* true if room is non-rectangular */
00019         struct mkroom *sbrooms[MAX_SUBROOMS];  /* Subrooms pointers */
00020         struct monst *resident; /* priest/shopkeeper/guard for this room */
00021 };
00022 
00023 struct shclass {
00024         const char *name;       /* name of the shop type */
00025         char    symb;           /* this identifies the shop type */
00026         int     prob;           /* the shop type probability in % */
00027         schar   shdist;         /* object placement type */
00028 #define D_SCATTER       0       /* normal placement */
00029 #define D_SHOP          1       /* shop-like placement */
00030 #define D_TEMPLE        2       /* temple-like placement */
00031         struct itp {
00032             int iprob;          /* probability of an item type */
00033             int itype;  /* item type: if >=0 a class, if < 0 a specific item */
00034         } iprobs[20];
00035         const char * const *shknms;     /* list of shopkeeper names for this type */
00036 };
00037 
00038 extern NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2];
00039 extern NEARDATA struct mkroom* subrooms;
00040 /* the normal rooms on the current level are described in rooms[0..n] for
00041  * some n<MAXNROFROOMS
00042  * the vault, if any, is described by rooms[n+1]
00043  * the next rooms entry has hx -1 as a flag
00044  * there is at most one non-vault special room on a level
00045  */
00046 
00047 extern struct mkroom *dnstairs_room, *upstairs_room, *sstairs_room;
00048 
00049 extern NEARDATA coord doors[DOORMAX];
00050 
00051 /* values for rtype in the room definition structure */
00052 #define OROOM            0      /* ordinary room */
00053 #define COURT            2      /* contains a throne */
00054 #define SWAMP            3      /* contains pools */
00055 #define VAULT            4      /* contains piles of gold */
00056 #define BEEHIVE          5      /* contains killer bees and royal jelly */
00057 #define MORGUE           6      /* contains corpses, undead and ghosts */
00058 #define BARRACKS         7      /* contains soldiers and their gear */
00059 #define ZOO              8      /* floor covered with treasure and monsters */
00060 #define DELPHI           9      /* contains Oracle and peripherals */
00061 #define TEMPLE          10      /* contains a shrine */
00062 #define LEPREHALL       11      /* leprechaun hall (Tom Proudfoot) */
00063 #define COCKNEST        12      /* cockatrice nest (Tom Proudfoot) */
00064 #define ANTHOLE         13      /* ants (Tom Proudfoot) */
00065 #define GARDEN          14      /* nymphs, trees and fountains */
00066 #define ARMORY          15      /* weapons, armor and rust monsters (L) */
00067 #define LEMUREPIT       16      /* contains lemures and horned devils */
00068 #define POOLROOM        17      /*  */
00069 #define SHOPBASE        18      /* everything above this is a shop */
00070 #define ARMORSHOP       (SHOPBASE+ 1)   /* specific shop defines for level compiler */
00071 #define SCROLLSHOP      (SHOPBASE+ 2)
00072 #define POTIONSHOP      (SHOPBASE+ 3)
00073 #define WEAPONSHOP      (SHOPBASE+ 4)
00074 #define FOODSHOP        (SHOPBASE+ 5)
00075 #define RINGSHOP        (SHOPBASE+ 6)
00076 #define WANDSHOP        (SHOPBASE+ 7)
00077 #define TOOLSHOP        (SHOPBASE+ 8)
00078 #define BOOKSHOP        (SHOPBASE+ 9)
00079 #define TINSHOP         (SHOPBASE+10)
00080 #define INSTRUMENTSHOP  (SHOPBASE+11)
00081 #define PETSHOP         (SHOPBASE+12)   /* Stephen White */
00082 #define UNIQUESHOP      (SHOPBASE+13)   /* shops here & above not randomly gen'd. */
00083 #define CANDLESHOP      (UNIQUESHOP)
00084 #ifdef BLACKMARKET
00085 #define BLACKSHOP       (UNIQUESHOP+1)
00086 #define MAXRTYPE        (UNIQUESHOP+1)      /* maximum valid room type */
00087 #else /* BLACKMARKET */
00088 #define MAXRTYPE        (UNIQUESHOP)      /* maximum valid room type */
00089 #endif /* BLACKMARKET */
00090 
00091 /* Special type for search_special() */
00092 #define ANY_TYPE        (-1)
00093 #define ANY_SHOP        (-2)
00094 
00095 #define NO_ROOM         0       /* indicates lack of room-occupancy */
00096 #define SHARED          1       /* indicates normal shared boundary */
00097 #define SHARED_PLUS     2       /* indicates shared boundary - extra adjacent-
00098                                  * square searching required */
00099 
00100 #define ROOMOFFSET      3       /*
00101                                  * (levl[x][y].roomno - ROOMOFFSET) gives
00102                                  * rooms[] index, for inside-squares and
00103                                  * non-shared boundaries.
00104                                  */
00105 
00106 #define IS_ROOM_PTR(x)          ((x) >= rooms && (x) < rooms + MAXNROFROOMS)
00107 #define IS_ROOM_INDEX(x)        ((x) >= 0 && (x) < MAXNROFROOMS)
00108 #define IS_SUBROOM_PTR(x)       ((x) >= subrooms && \
00109                                  (x) < subrooms + MAXNROFROOMS)
00110 #define IS_SUBROOM_INDEX(x)     ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS*2))
00111 #define ROOM_INDEX(x)           ((x) - rooms)
00112 #define SUBROOM_INDEX(x)        ((x) - subrooms)
00113 #define IS_LAST_ROOM_PTR(x)     (ROOM_INDEX(x) == nroom)
00114 #define IS_LAST_SUBROOM_PTR(x)  (!nsubroom || SUBROOM_INDEX(x) == nsubroom)
00115 
00116 #endif /* MKROOM_H */