Source:NetHack 3.6.1/include/rm.h

From NetHackWiki
(Redirected from Rm.h)
Jump to: navigation, search

Below is the full text to rm.h from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/include/rm.h#line123]], for example.

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.  /* NetHack 3.6	rm.h	$NHDT-Date: 1432512776 2015/05/25 00:12:56 $  $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */
  2.  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3.  /*-Copyright (c) Pasi Kallinen, 2017. */
  4.  /* NetHack may be freely redistributed.  See license for details. */
  5.  
  6.  #ifndef RM_H
  7.  #define RM_H
  8.  
  9.  /*
  10.   * The dungeon presentation graphics code and data structures were rewritten
  11.   * and generalized for NetHack's release 2 by Eric S. Raymond (eric@snark)
  12.   * building on Don G. Kneller's MS-DOS implementation.	See drawing.c for
  13.   * the code that permits the user to set the contents of the symbol structure.
  14.   *
  15.   * The door representation was changed by Ari
  16.   * Huttunen(ahuttune@niksula.hut.fi)
  17.   */
  18.  
  19.  /*
  20.   * TLCORNER	TDWALL		TRCORNER
  21.   * +-		-+-		-+
  22.   * |		 |		 |
  23.   *
  24.   * TRWALL	CROSSWALL	TLWALL		HWALL
  25.   * |		 |		 |
  26.   * +-		-+-		-+		---
  27.   * |		 |		 |
  28.   *
  29.   * BLCORNER	TUWALL		BRCORNER	VWALL
  30.   * |		 |		 |		|
  31.   * +-		-+-		-+		|
  32.   */
  33.  
  34.  /* Level location types.  [Some debugging code in src/display.c
  35.     defines array type_names[] which contains an entry for each of
  36.     these, so needs to be kept in sync if any new types are added
  37.     or existing ones renumbered.] */
  38.  enum levl_typ_types {
  39.      STONE = 0,
  40.      VWALL,
  41.      HWALL,
  42.      TLCORNER,
  43.      TRCORNER,
  44.      BLCORNER,
  45.      BRCORNER,
  46.      CROSSWALL, /* For pretty mazes and special levels */
  47.      TUWALL,
  48.      TDWALL,
  49.      TLWALL,
  50.      TRWALL,
  51.      DBWALL,
  52.      TREE, /* KMH */
  53.      SDOOR,
  54.      SCORR,
  55.      POOL,
  56.      MOAT, /* pool that doesn't boil, adjust messages */
  57.      WATER,
  58.      DRAWBRIDGE_UP,
  59.      LAVAPOOL,
  60.      IRONBARS, /* KMH */
  61.      DOOR,
  62.      CORR,
  63.      ROOM,
  64.      STAIRS,
  65.      LADDER,
  66.      FOUNTAIN,
  67.      THRONE,
  68.      SINK,
  69.      GRAVE,
  70.      ALTAR,
  71.      ICE,
  72.      DRAWBRIDGE_DOWN,
  73.      AIR,
  74.      CLOUD,
  75.  
  76.      MAX_TYPE,
  77.      INVALID_TYPE = 127
  78.  };
  79.  
  80.  /*
  81.   * Avoid using the level types in inequalities:
  82.   * these types are subject to change.
  83.   * Instead, use one of the macros below.
  84.   */
  85.  #define IS_WALL(typ) ((typ) && (typ) <= DBWALL)
  86.  #define IS_STWALL(typ) ((typ) <= DBWALL) /* STONE <= (typ) <= DBWALL */
  87.  #define IS_ROCK(typ) ((typ) < POOL)      /* absolutely nonaccessible */
  88.  #define IS_DOOR(typ) ((typ) == DOOR)
  89.  #define IS_DOORJOIN(typ) (IS_ROCK(typ) || (typ) == IRONBARS)
  90.  #define IS_TREE(typ)                                            \
  91.      ((typ) == TREE || (level.flags.arboreal && (typ) == STONE))
  92.  #define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */
  93.  #define IS_ROOM(typ) ((typ) >= ROOM)    /* ROOM, STAIRS, furniture.. */
  94.  #define ZAP_POS(typ) ((typ) >= POOL)
  95.  #define SPACE_POS(typ) ((typ) > DOOR)
  96.  #define IS_POOL(typ) ((typ) >= POOL && (typ) <= DRAWBRIDGE_UP)
  97.  #define IS_THRONE(typ) ((typ) == THRONE)
  98.  #define IS_FOUNTAIN(typ) ((typ) == FOUNTAIN)
  99.  #define IS_SINK(typ) ((typ) == SINK)
  100.  #define IS_GRAVE(typ) ((typ) == GRAVE)
  101.  #define IS_ALTAR(typ) ((typ) == ALTAR)
  102.  #define IS_DRAWBRIDGE(typ) \
  103.      ((typ) == DRAWBRIDGE_UP || (typ) == DRAWBRIDGE_DOWN)
  104.  #define IS_FURNITURE(typ) ((typ) >= STAIRS && (typ) <= ALTAR)
  105.  #define IS_AIR(typ) ((typ) == AIR || (typ) == CLOUD)
  106.  #define IS_SOFT(typ) ((typ) == AIR || (typ) == CLOUD || IS_POOL(typ))
  107.  
  108.  /*
  109.   * The screen symbols may be the default or defined at game startup time.
  110.   * See drawing.c for defaults.
  111.   * Note: {ibm|dec}_graphics[] arrays (also in drawing.c) must be kept in
  112.   * synch.
  113.   */
  114.  
  115.  /* begin dungeon characters */
  116.  enum screen_symbols {
  117.      S_stone = 0,
  118.      S_vwall,
  119.      S_hwall,
  120.      S_tlcorn,
  121.      S_trcorn,
  122.      S_blcorn,
  123.      S_brcorn,
  124.      S_crwall,
  125.      S_tuwall,
  126.      S_tdwall,
  127.      S_tlwall,
  128.      S_trwall,
  129.      S_ndoor,
  130.      S_vodoor,
  131.      S_hodoor,
  132.      S_vcdoor, /* closed door, vertical wall */
  133.      S_hcdoor, /* closed door, horizontal wall */
  134.      S_bars,   /* KMH -- iron bars */
  135.      S_tree,   /* KMH */
  136.      S_room,
  137.      S_darkroom,
  138.      S_corr,
  139.      S_litcorr,
  140.      S_upstair,
  141.      S_dnstair,
  142.      S_upladder,
  143.      S_dnladder,
  144.      S_altar,
  145.      S_grave,
  146.      S_throne,
  147.      S_sink,
  148.      S_fountain,
  149.      S_pool,
  150.      S_ice,
  151.      S_lava,
  152.      S_vodbridge,
  153.      S_hodbridge,
  154.      S_vcdbridge, /* closed drawbridge, vertical wall */
  155.      S_hcdbridge, /* closed drawbridge, horizontal wall */
  156.      S_air,
  157.      S_cloud,
  158.      S_water,
  159.  
  160.  /* end dungeon characters, begin traps */
  161.  
  162.      S_arrow_trap,
  163.      S_dart_trap,
  164.      S_falling_rock_trap,
  165.      S_squeaky_board,
  166.      S_bear_trap,
  167.      S_land_mine,
  168.      S_rolling_boulder_trap,
  169.      S_sleeping_gas_trap,
  170.      S_rust_trap,
  171.      S_fire_trap,
  172.      S_pit,
  173.      S_spiked_pit,
  174.      S_hole,
  175.      S_trap_door,
  176.      S_teleportation_trap,
  177.      S_level_teleporter,
  178.      S_magic_portal,
  179.      S_web,
  180.      S_statue_trap,
  181.      S_magic_trap,
  182.      S_anti_magic_trap,
  183.      S_polymorph_trap,
  184.      S_vibrating_square,
  185.  
  186.  /* end traps, begin special effects */
  187.  
  188.      S_vbeam,  /* The 4 zap beam symbols.  Do NOT separate. */
  189.      S_hbeam,  /* To change order or add, see function     */
  190.      S_lslant, /* zapdir_to_glyph() in display.c.	    */
  191.      S_rslant,
  192.      S_digbeam,   /* dig beam symbol */
  193.      S_flashbeam, /* camera flash symbol */
  194.      S_boomleft,  /* thrown boomerang, open left, e.g ')'    */
  195.      S_boomright, /* thrown boomerang, open right, e.g. '('  */
  196.      S_ss1,       /* 4 magic shield glyphs */
  197.      S_ss2,
  198.      S_ss3,
  199.      S_ss4,
  200.      S_poisoncloud,
  201.      S_goodpos, /* valid position for targeting */
  202.  
  203.  /* The 8 swallow symbols.  Do NOT separate.  To change order or add, see */
  204.  /* the function swallow_to_glyph() in display.c.			 */
  205.      S_sw_tl, /* swallow top left [1]             */
  206.      S_sw_tc, /* swallow top center [2]    Order: */
  207.      S_sw_tr, /* swallow top right [3]            */
  208.      S_sw_ml, /* swallow middle left [4]   1 2 3  */
  209.      S_sw_mr, /* swallow middle right [6]  4 5 6  */
  210.      S_sw_bl, /* swallow bottom left [7]   7 8 9  */
  211.      S_sw_bc, /* swallow bottom center [8]        */
  212.      S_sw_br, /* swallow bottom right [9]         */
  213.  
  214.      S_explode1, /* explosion top left			*/
  215.      S_explode2, /* explosion top center			*/
  216.      S_explode3, /* explosion top right	   Ex.	*/
  217.      S_explode4, /* explosion middle left		*/
  218.      S_explode5, /* explosion middle center /-\	*/
  219.      S_explode6, /* explosion middle right  |@|	*/
  220.      S_explode7, /* explosion bottom left   \-/	*/
  221.      S_explode8, /* explosion bottom center		*/
  222.      S_explode9, /* explosion bottom right		*/
  223.  
  224.  /* end effects */
  225.  
  226.      MAXPCHARS   /* maximum number of mapped characters */
  227.  };
  228.  
  229.  #define MAXDCHARS (S_water - S_stone + 1)  /* maximum of mapped dungeon characters */
  230.  #define MAXTCHARS (S_vibrating_square - S_arrow_trap + 1)  /* maximum of mapped trap characters */
  231.  #define MAXECHARS (S_explode9 - S_vbeam + 1)  /* maximum of mapped effects characters */
  232.  #define MAXEXPCHARS 9 /* number of explosion characters */
  233.  
  234.  #define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom)
  235.  
  236.  #define is_cmap_trap(i) ((i) >= S_arrow_trap && (i) <= S_polymorph_trap)
  237.  #define is_cmap_drawbridge(i) ((i) >= S_vodbridge && (i) <= S_hcdbridge)
  238.  #define is_cmap_door(i) ((i) >= S_vodoor && (i) <= S_hcdoor)
  239.  #define is_cmap_wall(i) ((i) >= S_stone && (i) <= S_trwall)
  240.  #define is_cmap_room(i) ((i) >= S_room && (i) <= S_darkroom)
  241.  #define is_cmap_corr(i) ((i) >= S_corr && (i) <= S_litcorr)
  242.  #define is_cmap_furniture(i) ((i) >= S_upstair && (i) <= S_fountain)
  243.  #define is_cmap_water(i) ((i) == S_pool || (i) == S_water)
  244.  #define is_cmap_lava(i) ((i) == S_lava)
  245.  
  246.  
  247.  struct symdef {
  248.      uchar sym;
  249.      const char *explanation;
  250.  #ifdef TEXTCOLOR
  251.      uchar color;
  252.  #endif
  253.  };
  254.  
  255.  struct symparse {
  256.      unsigned range;
  257.  #define SYM_CONTROL 1 /* start/finish markers */
  258.  #define SYM_PCHAR 2   /* index into showsyms  */
  259.  #define SYM_OC 3      /* index into oc_syms   */
  260.  #define SYM_MON 4     /* index into monsyms   */
  261.  #define SYM_OTH 5     /* misc                 */
  262.      int idx;
  263.      const char *name;
  264.  };
  265.  
  266.  /* misc symbol definitions */
  267.  #define SYM_BOULDER 0
  268.  #define SYM_INVISIBLE 1
  269.  #define MAXOTHER 2
  270.  
  271.  /* linked list of symsets and their characteristics */
  272.  struct symsetentry {
  273.      struct symsetentry *next; /* next in list                         */
  274.      char *name;               /* ptr to symset name                   */
  275.      char *desc;               /* ptr to description                   */
  276.      int idx;                  /* an index value                       */
  277.      int handling;             /* known handlers value                 */
  278.      Bitfield(nocolor, 1);     /* don't use color if set               */
  279.      Bitfield(primary, 1);     /* restricted for use as primary set    */
  280.      Bitfield(rogue, 1);       /* restricted for use as rogue lev set  */
  281.                                /* 5 free bits */
  282.  };
  283.  
  284.  /*
  285.   * Graphics sets for display symbols
  286.   */
  287.  #define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */
  288.  #define PRIMARY 0          /* primary graphics set        */
  289.  #define ROGUESET 1         /* rogue graphics set          */
  290.  #define NUM_GRAPHICS 2
  291.  
  292.  /*
  293.   * special symbol set handling types ( for invoking callbacks, etc.)
  294.   * Must match the order of the known_handlers strings
  295.   * in drawing.c
  296.   */
  297.  #define H_UNK 0
  298.  #define H_IBM 1
  299.  #define H_DEC 2
  300.  
  301.  extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
  302.  extern const struct symdef def_warnsyms[WARNCOUNT];
  303.  extern int currentgraphics; /* from drawing.c */
  304.  extern nhsym showsyms[];
  305.  extern nhsym l_syms[];
  306.  extern nhsym r_syms[];
  307.  
  308.  extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */
  309.  #define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht))
  310.  
  311.  /*
  312.   * The 5 possible states of doors
  313.   */
  314.  
  315.  #define D_NODOOR 0
  316.  #define D_BROKEN 1
  317.  #define D_ISOPEN 2
  318.  #define D_CLOSED 4
  319.  #define D_LOCKED 8
  320.  #define D_TRAPPED 16
  321.  #define D_SECRET 32 /* only used by sp_lev.c, NOT in rm-struct */
  322.  
  323.  /*
  324.   * Some altars are considered as shrines, so we need a flag.
  325.   */
  326.  #define AM_SHRINE 8
  327.  
  328.  /*
  329.   * Thrones should only be looted once.
  330.   */
  331.  #define T_LOOTED 1
  332.  
  333.  /*
  334.   * Trees have more than one kick result.
  335.   */
  336.  #define TREE_LOOTED 1
  337.  #define TREE_SWARM 2
  338.  
  339.  /*
  340.   * Fountains have limits, and special warnings.
  341.   */
  342.  #define F_LOOTED 1
  343.  #define F_WARNED 2
  344.  #define FOUNTAIN_IS_WARNED(x, y) (levl[x][y].looted & F_WARNED)
  345.  #define FOUNTAIN_IS_LOOTED(x, y) (levl[x][y].looted & F_LOOTED)
  346.  #define SET_FOUNTAIN_WARNED(x, y) levl[x][y].looted |= F_WARNED;
  347.  #define SET_FOUNTAIN_LOOTED(x, y) levl[x][y].looted |= F_LOOTED;
  348.  #define CLEAR_FOUNTAIN_WARNED(x, y) levl[x][y].looted &= ~F_WARNED;
  349.  #define CLEAR_FOUNTAIN_LOOTED(x, y) levl[x][y].looted &= ~F_LOOTED;
  350.  
  351.  /*
  352.   * Doors are even worse :-) The special warning has a side effect
  353.   * of instantly trapping the door, and if it was defined as trapped,
  354.   * the guards consider that you have already been warned!
  355.   */
  356.  #define D_WARNED 16
  357.  
  358.  /*
  359.   * Sinks have 3 different types of loot that shouldn't be abused
  360.   */
  361.  #define S_LPUDDING 1
  362.  #define S_LDWASHER 2
  363.  #define S_LRING 4
  364.  
  365.  /*
  366.   * The four directions for a DrawBridge.
  367.   */
  368.  #define DB_NORTH 0
  369.  #define DB_SOUTH 1
  370.  #define DB_EAST 2
  371.  #define DB_WEST 3
  372.  #define DB_DIR 3 /* mask for direction */
  373.  
  374.  /*
  375.   * What's under a drawbridge.
  376.   */
  377.  #define DB_MOAT 0
  378.  #define DB_LAVA 4
  379.  #define DB_ICE 8
  380.  #define DB_FLOOR 16
  381.  #define DB_UNDER 28 /* mask for underneath */
  382.  
  383.  /*
  384.   * Wall information.
  385.   */
  386.  #define WM_MASK 0x07 /* wall mode (bottom three bits) */
  387.  #define W_NONDIGGABLE 0x08
  388.  #define W_NONPASSWALL 0x10
  389.  
  390.  /*
  391.   * Ladders (in Vlad's tower) may be up or down.
  392.   */
  393.  #define LA_UP 1
  394.  #define LA_DOWN 2
  395.  
  396.  /*
  397.   * Room areas may be iced pools
  398.   */
  399.  #define ICED_POOL 8
  400.  #define ICED_MOAT 16
  401.  
  402.  /*
  403.   * The structure describing a coordinate position.
  404.   * Before adding fields, remember that this will significantly affect
  405.   * the size of temporary files and save files.
  406.   *
  407.   * Also remember that the run-length encoding for some ports in save.c
  408.   * must be updated to consider the field.
  409.   */
  410.  struct rm {
  411.      int glyph;               /* what the hero thinks is there */
  412.      schar typ;               /* what is really there */
  413.      uchar seenv;             /* seen vector */
  414.      Bitfield(flags, 5);      /* extra information for typ */
  415.      Bitfield(horizontal, 1); /* wall/door/etc is horiz. (more typ info) */
  416.      Bitfield(lit, 1);        /* speed hack for lit rooms */
  417.      Bitfield(waslit, 1);     /* remember if a location was lit */
  418.  
  419.      Bitfield(roomno, 6); /* room # for special rooms */
  420.      Bitfield(edge, 1);   /* marks boundaries for special rooms*/
  421.      Bitfield(candig, 1); /* Exception to Can_dig_down; was a trapdoor */
  422.  };
  423.  
  424.  #define SET_TYPLIT(x, y, ttyp, llit)                              \
  425.      {                                                             \
  426.          if ((x) >= 0 && (y) >= 0 && (x) < COLNO && (y) < ROWNO) { \
  427.              if ((ttyp) < MAX_TYPE)                                \
  428.                  levl[(x)][(y)].typ = (ttyp);                      \
  429.              if ((ttyp) == LAVAPOOL)                               \
  430.                  levl[(x)][(y)].lit = 1;                           \
  431.              else if ((schar)(llit) != -2) {                       \
  432.                  if ((schar)(llit) == -1)                          \
  433.                      levl[(x)][(y)].lit = rn2(2);                  \
  434.                  else                                              \
  435.                      levl[(x)][(y)].lit = (llit);                  \
  436.              }                                                     \
  437.          }                                                         \
  438.      }
  439.  
  440.  /*
  441.   * Add wall angle viewing by defining "modes" for each wall type.  Each
  442.   * mode describes which parts of a wall are finished (seen as as wall)
  443.   * and which are unfinished (seen as rock).
  444.   *
  445.   * We use the bottom 3 bits of the flags field for the mode.  This comes
  446.   * in conflict with secret doors, but we avoid problems because until
  447.   * a secret door becomes discovered, we know what sdoor's bottom three
  448.   * bits are.
  449.   *
  450.   * The following should cover all of the cases.
  451.   *
  452.   *	type	mode				Examples: R=rock, F=finished
  453.   *	-----	----				----------------------------
  454.   *	WALL:	0 none				hwall, mode 1
  455.   *		1 left/top (1/2 rock)			RRR
  456.   *		2 right/bottom (1/2 rock)		---
  457.   *							FFF
  458.   *
  459.   *	CORNER: 0 none				trcorn, mode 2
  460.   *		1 outer (3/4 rock)			FFF
  461.   *		2 inner (1/4 rock)			F+-
  462.   *							F|R
  463.   *
  464.   *	TWALL:	0 none				tlwall, mode 3
  465.   *		1 long edge (1/2 rock)			F|F
  466.   *		2 bottom left (on a tdwall)		-+F
  467.   *		3 bottom right (on a tdwall)		R|F
  468.   *
  469.   *	CRWALL: 0 none				crwall, mode 5
  470.   *		1 top left (1/4 rock)			R|F
  471.   *		2 top right (1/4 rock)			-+-
  472.   *		3 bottom left (1/4 rock)		F|R
  473.   *		4 bottom right (1/4 rock)
  474.   *		5 top left & bottom right (1/2 rock)
  475.   *		6 bottom left & top right (1/2 rock)
  476.   */
  477.  
  478.  #define WM_W_LEFT 1 /* vertical or horizontal wall */
  479.  #define WM_W_RIGHT 2
  480.  #define WM_W_TOP WM_W_LEFT
  481.  #define WM_W_BOTTOM WM_W_RIGHT
  482.  
  483.  #define WM_C_OUTER 1 /* corner wall */
  484.  #define WM_C_INNER 2
  485.  
  486.  #define WM_T_LONG 1 /* T wall */
  487.  #define WM_T_BL 2
  488.  #define WM_T_BR 3
  489.  
  490.  #define WM_X_TL 1 /* cross wall */
  491.  #define WM_X_TR 2
  492.  #define WM_X_BL 3
  493.  #define WM_X_BR 4
  494.  #define WM_X_TLBR 5
  495.  #define WM_X_BLTR 6
  496.  
  497.  /*
  498.   * Seen vector values.	The seen vector is an array of 8 bits, one for each
  499.   * octant around a given center x:
  500.   *
  501.   *			0 1 2
  502.   *			7 x 3
  503.   *			6 5 4
  504.   *
  505.   * In the case of walls, a single wall square can be viewed from 8 possible
  506.   * directions.	If we know the type of wall and the directions from which
  507.   * it has been seen, then we can determine what it looks like to the hero.
  508.   */
  509.  #define SV0 0x1
  510.  #define SV1 0x2
  511.  #define SV2 0x4
  512.  #define SV3 0x8
  513.  #define SV4 0x10
  514.  #define SV5 0x20
  515.  #define SV6 0x40
  516.  #define SV7 0x80
  517.  #define SVALL 0xFF
  518.  
  519.  #define doormask flags
  520.  #define altarmask flags
  521.  #define wall_info flags
  522.  #define ladder flags
  523.  #define drawbridgemask flags
  524.  #define looted flags
  525.  #define icedpool flags
  526.  
  527.  #define blessedftn horizontal /* a fountain that grants attribs */
  528.  #define disturbed horizontal  /* a grave that has been disturbed */
  529.  
  530.  struct damage {
  531.      struct damage *next;
  532.      long when, cost;
  533.      coord place;
  534.      schar typ;
  535.  };
  536.  
  537.  /* for bones levels:  identify the dead character, who might have died on
  538.     an existing bones level; if so, most recent victim will be first in list */
  539.  struct cemetery {
  540.      struct cemetery *next; /* next struct is previous dead character... */
  541.      /* "plname" + "-ROLe" + "-RACe" + "-GENder" + "-ALIgnment" + \0 */
  542.      char who[PL_NSIZ + 4 * (1 + 3) + 1];
  543.      /* death reason, same as in score/log file */
  544.      char how[100 + 1]; /* [DTHSZ+1] */
  545.      /* date+time in string of digits rather than binary */
  546.      char when[4 + 2 + 2 + 2 + 2 + 2 + 1]; /* "YYYYMMDDhhmmss\0" */
  547.      /* final resting place spot */
  548.      schar frpx, frpy;
  549.      boolean bonesknown;
  550.  };
  551.  
  552.  struct levelflags {
  553.      uchar nfountains; /* number of fountains on level */
  554.      uchar nsinks;     /* number of sinks on the level */
  555.      /* Several flags that give hints about what's on the level */
  556.      Bitfield(has_shop, 1);
  557.      Bitfield(has_vault, 1);
  558.      Bitfield(has_zoo, 1);
  559.      Bitfield(has_court, 1);
  560.      Bitfield(has_morgue, 1);
  561.      Bitfield(has_beehive, 1);
  562.      Bitfield(has_barracks, 1);
  563.      Bitfield(has_temple, 1);
  564.  
  565.      Bitfield(has_swamp, 1);
  566.      Bitfield(noteleport, 1);
  567.      Bitfield(hardfloor, 1);
  568.      Bitfield(nommap, 1);
  569.      Bitfield(hero_memory, 1);   /* hero has memory */
  570.      Bitfield(shortsighted, 1);  /* monsters are shortsighted */
  571.      Bitfield(graveyard, 1);     /* has_morgue, but remains set */
  572.      Bitfield(sokoban_rules, 1); /* fill pits and holes w/ boulders */
  573.  
  574.      Bitfield(is_maze_lev, 1);
  575.      Bitfield(is_cavernous_lev, 1);
  576.      Bitfield(arboreal, 1);     /* Trees replace rock */
  577.      Bitfield(wizard_bones, 1); /* set if level came from a bones file
  578.                                    which was created in wizard mode (or
  579.                                    normal mode descendant of such) */
  580.      Bitfield(corrmaze, 1);     /* Whether corridors are used for the maze
  581.                                    rather than ROOM */
  582.  };
  583.  
  584.  typedef struct {
  585.      struct rm locations[COLNO][ROWNO];
  586.  #ifndef MICROPORT_BUG
  587.      struct obj *objects[COLNO][ROWNO];
  588.      struct monst *monsters[COLNO][ROWNO];
  589.  #else
  590.      struct obj *objects[1][ROWNO];
  591.      char *yuk1[COLNO - 1][ROWNO];
  592.      struct monst *monsters[1][ROWNO];
  593.      char *yuk2[COLNO - 1][ROWNO];
  594.  #endif
  595.      struct obj *objlist;
  596.      struct obj *buriedobjlist;
  597.      struct monst *monlist;
  598.      struct damage *damagelist;
  599.      struct cemetery *bonesinfo;
  600.      struct levelflags flags;
  601.  } dlevel_t;
  602.  
  603.  extern schar lastseentyp[COLNO][ROWNO]; /* last seen/touched dungeon typ */
  604.  
  605.  extern dlevel_t level; /* structure describing the current level */
  606.  
  607.  /*
  608.   * Macros for compatibility with old code. Someday these will go away.
  609.   */
  610.  #define levl level.locations
  611.  #define fobj level.objlist
  612.  #define fmon level.monlist
  613.  
  614.  /*
  615.   * Covert a trap number into the defsym graphics array.
  616.   * Convert a defsym number into a trap number.
  617.   * Assumes that arrow trap will always be the first trap.
  618.   */
  619.  #define trap_to_defsym(t) (S_arrow_trap + (t) -1)
  620.  #define defsym_to_trap(d) ((d) -S_arrow_trap + 1)
  621.  
  622.  #define OBJ_AT(x, y) (level.objects[x][y] != (struct obj *) 0)
  623.  /*
  624.   * Macros for encapsulation of level.monsters references.
  625.   */
  626.  #define MON_AT(x, y)                            \
  627.      (level.monsters[x][y] != (struct monst *) 0 \
  628.       && !(level.monsters[x][y])->mburied)
  629.  #define MON_BURIED_AT(x, y)                     \
  630.      (level.monsters[x][y] != (struct monst *) 0 \
  631.       && (level.monsters[x][y])->mburied)
  632.  #define place_worm_seg(m, x, y) level.monsters[x][y] = m
  633.  #define remove_monster(x, y) level.monsters[x][y] = (struct monst *) 0
  634.  #define m_at(x, y) (MON_AT(x, y) ? level.monsters[x][y] : (struct monst *) 0)
  635.  #define m_buried_at(x, y) \
  636.      (MON_BURIED_AT(x, y) ? level.monsters[x][y] : (struct monst *) 0)
  637.  
  638.  /* restricted movement, potential luck penalties */
  639.  #define Sokoban level.flags.sokoban_rules
  640.  
  641.  #endif /* RM_H */