OSDN Git Service

upgrade to 3.6.1
[jnethack/source.git] / include / rm.h
index 5e71048..9d80551 100644 (file)
@@ -1,5 +1,6 @@
 /* NetHack 3.6 rm.h    $NHDT-Date: 1432512776 2015/05/25 00:12:56 $  $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
+/*-Copyright (c) Pasi Kallinen, 2017. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 #ifndef RM_H
    defines array type_names[] which contains an entry for each of
    these, so needs to be kept in sync if any new types are added
    or existing ones renumbered.] */
-#define STONE 0
-#define VWALL 1
-#define HWALL 2
-#define TLCORNER 3
-#define TRCORNER 4
-#define BLCORNER 5
-#define BRCORNER 6
-#define CROSSWALL 7 /* For pretty mazes and special levels */
-#define TUWALL 8
-#define TDWALL 9
-#define TLWALL 10
-#define TRWALL 11
-#define DBWALL 12
-#define TREE 13 /* KMH */
-#define SDOOR 14
-#define SCORR 15
-#define POOL 16
-#define MOAT 17 /* pool that doesn't boil, adjust messages */
-#define WATER 18
-#define DRAWBRIDGE_UP 19
-#define LAVAPOOL 20
-#define IRONBARS 21 /* KMH */
-#define DOOR 22
-#define CORR 23
-#define ROOM 24
-#define STAIRS 25
-#define LADDER 26
-#define FOUNTAIN 27
-#define THRONE 28
-#define SINK 29
-#define GRAVE 30
-#define ALTAR 31
-#define ICE 32
-#define DRAWBRIDGE_DOWN 33
-#define AIR 34
-#define CLOUD 35
-
-#define MAX_TYPE 36
-#define INVALID_TYPE 127
+enum levl_typ_types {
+    STONE = 0,
+    VWALL,
+    HWALL,
+    TLCORNER,
+    TRCORNER,
+    BLCORNER,
+    BRCORNER,
+    CROSSWALL, /* For pretty mazes and special levels */
+    TUWALL,
+    TDWALL,
+    TLWALL,
+    TRWALL,
+    DBWALL,
+    TREE, /* KMH */
+    SDOOR,
+    SCORR,
+    POOL,
+    MOAT, /* pool that doesn't boil, adjust messages */
+    WATER,
+    DRAWBRIDGE_UP,
+    LAVAPOOL,
+    IRONBARS, /* KMH */
+    DOOR,
+    CORR,
+    ROOM,
+    STAIRS,
+    LADDER,
+    FOUNTAIN,
+    THRONE,
+    SINK,
+    GRAVE,
+    ALTAR,
+    ICE,
+    DRAWBRIDGE_DOWN,
+    AIR,
+    CLOUD,
+
+    MAX_TYPE,
+    INVALID_TYPE = 127
+};
 
 /*
  * Avoid using the level types in inequalities:
@@ -83,7 +86,8 @@
 #define IS_STWALL(typ) ((typ) <= DBWALL) /* STONE <= (typ) <= DBWALL */
 #define IS_ROCK(typ) ((typ) < POOL)      /* absolutely nonaccessible */
 #define IS_DOOR(typ) ((typ) == DOOR)
-#define IS_TREE(typ) \
+#define IS_DOORJOIN(typ) (IS_ROCK(typ) || (typ) == IRONBARS)
+#define IS_TREE(typ)                                            \
     ((typ) == TREE || (level.flags.arboreal && (typ) == STONE))
 #define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */
 #define IS_ROOM(typ) ((typ) >= ROOM)    /* ROOM, STAIRS, furniture.. */
  */
 
 /* begin dungeon characters */
-
-#define S_stone 0
-#define S_vwall 1
-#define S_hwall 2
-#define S_tlcorn 3
-#define S_trcorn 4
-#define S_blcorn 5
-#define S_brcorn 6
-#define S_crwall 7
-#define S_tuwall 8
-#define S_tdwall 9
-#define S_tlwall 10
-#define S_trwall 11
-#define S_ndoor 12
-#define S_vodoor 13
-#define S_hodoor 14
-#define S_vcdoor 15 /* closed door, vertical wall */
-#define S_hcdoor 16 /* closed door, horizontal wall */
-#define S_bars 17   /* KMH -- iron bars */
-#define S_tree 18   /* KMH */
-#define S_room 19
-#define S_darkroom 20
-#define S_corr 21
-#define S_litcorr 22
-#define S_upstair 23
-#define S_dnstair 24
-#define S_upladder 25
-#define S_dnladder 26
-#define S_altar 27
-#define S_grave 28
-#define S_throne 29
-#define S_sink 30
-#define S_fountain 31
-#define S_pool 32
-#define S_ice 33
-#define S_lava 34
-#define S_vodbridge 35
-#define S_hodbridge 36
-#define S_vcdbridge 37 /* closed drawbridge, vertical wall */
-#define S_hcdbridge 38 /* closed drawbridge, horizontal wall */
-#define S_air 39
-#define S_cloud 40
-#define S_water 41
+enum screen_symbols {
+    S_stone = 0,
+    S_vwall,
+    S_hwall,
+    S_tlcorn,
+    S_trcorn,
+    S_blcorn,
+    S_brcorn,
+    S_crwall,
+    S_tuwall,
+    S_tdwall,
+    S_tlwall,
+    S_trwall,
+    S_ndoor,
+    S_vodoor,
+    S_hodoor,
+    S_vcdoor, /* closed door, vertical wall */
+    S_hcdoor, /* closed door, horizontal wall */
+    S_bars,   /* KMH -- iron bars */
+    S_tree,   /* KMH */
+    S_room,
+    S_darkroom,
+    S_corr,
+    S_litcorr,
+    S_upstair,
+    S_dnstair,
+    S_upladder,
+    S_dnladder,
+    S_altar,
+    S_grave,
+    S_throne,
+    S_sink,
+    S_fountain,
+    S_pool,
+    S_ice,
+    S_lava,
+    S_vodbridge,
+    S_hodbridge,
+    S_vcdbridge, /* closed drawbridge, vertical wall */
+    S_hcdbridge, /* closed drawbridge, horizontal wall */
+    S_air,
+    S_cloud,
+    S_water,
 
 /* end dungeon characters, begin traps */
 
-#define S_arrow_trap 42
-#define S_dart_trap 43
-#define S_falling_rock_trap 44
-#define S_squeaky_board 45
-#define S_bear_trap 46
-#define S_land_mine 47
-#define S_rolling_boulder_trap 48
-#define S_sleeping_gas_trap 49
-#define S_rust_trap 50
-#define S_fire_trap 51
-#define S_pit 52
-#define S_spiked_pit 53
-#define S_hole 54
-#define S_trap_door 55
-#define S_teleportation_trap 56
-#define S_level_teleporter 57
-#define S_magic_portal 58
-#define S_web 59
-#define S_statue_trap 60
-#define S_magic_trap 61
-#define S_anti_magic_trap 62
-#define S_polymorph_trap 63
-#define S_vibrating_square 64
+    S_arrow_trap,
+    S_dart_trap,
+    S_falling_rock_trap,
+    S_squeaky_board,
+    S_bear_trap,
+    S_land_mine,
+    S_rolling_boulder_trap,
+    S_sleeping_gas_trap,
+    S_rust_trap,
+    S_fire_trap,
+    S_pit,
+    S_spiked_pit,
+    S_hole,
+    S_trap_door,
+    S_teleportation_trap,
+    S_level_teleporter,
+    S_magic_portal,
+    S_web,
+    S_statue_trap,
+    S_magic_trap,
+    S_anti_magic_trap,
+    S_polymorph_trap,
+    S_vibrating_square,
 
 /* end traps, begin special effects */
 
-#define S_vbeam 65  /* The 4 zap beam symbols.  Do NOT separate. */
-#define S_hbeam 66  /* To change order or add, see function     */
-#define S_lslant 67 /* zapdir_to_glyph() in display.c.     */
-#define S_rslant 68
-#define S_digbeam 69   /* dig beam symbol */
-#define S_flashbeam 70 /* camera flash symbol */
-#define S_boomleft 71  /* thrown boomerang, open left, e.g ')'    */
-#define S_boomright 72 /* thrown boomerang, open right, e.g. '('  */
-#define S_ss1 73       /* 4 magic shield glyphs */
-#define S_ss2 74
-#define S_ss3 75
-#define S_ss4 76
-#define S_poisoncloud 77
-#define S_goodpos 78 /* valid position for targeting */
+    S_vbeam,  /* The 4 zap beam symbols.  Do NOT separate. */
+    S_hbeam,  /* To change order or add, see function     */
+    S_lslant, /* zapdir_to_glyph() in display.c.           */
+    S_rslant,
+    S_digbeam,   /* dig beam symbol */
+    S_flashbeam, /* camera flash symbol */
+    S_boomleft,  /* thrown boomerang, open left, e.g ')'    */
+    S_boomright, /* thrown boomerang, open right, e.g. '('  */
+    S_ss1,       /* 4 magic shield glyphs */
+    S_ss2,
+    S_ss3,
+    S_ss4,
+    S_poisoncloud,
+    S_goodpos, /* valid position for targeting */
 
 /* The 8 swallow symbols.  Do NOT separate.  To change order or add, see */
 /* the function swallow_to_glyph() in display.c.                        */
-#define S_sw_tl 79 /* swallow top left [1]                     */
-#define S_sw_tc 80 /* swallow top center [2]   Order:  */
-#define S_sw_tr 81 /* swallow top right [3]            */
-#define S_sw_ml 82 /* swallow middle left [4]  1 2 3   */
-#define S_sw_mr 83 /* swallow middle right [6] 4 5 6   */
-#define S_sw_bl 84 /* swallow bottom left [7]  7 8 9   */
-#define S_sw_bc 85 /* swallow bottom center [8]                */
-#define S_sw_br 86 /* swallow bottom right [9]         */
-
-#define S_explode1 87 /* explosion top left                    */
-#define S_explode2 88 /* explosion top center                  */
-#define S_explode3 89 /* explosion top right            Ex.    */
-#define S_explode4 90 /* explosion middle left         */
-#define S_explode5 91 /* explosion middle center        /-\    */
-#define S_explode6 92 /* explosion middle right         |@|    */
-#define S_explode7 93 /* explosion bottom left  \-/    */
-#define S_explode8 94 /* explosion bottom center               */
-#define S_explode9 95 /* explosion bottom right                */
+    S_sw_tl, /* swallow top left [1]             */
+    S_sw_tc, /* swallow top center [2]    Order: */
+    S_sw_tr, /* swallow top right [3]            */
+    S_sw_ml, /* swallow middle left [4]   1 2 3  */
+    S_sw_mr, /* swallow middle right [6]  4 5 6  */
+    S_sw_bl, /* swallow bottom left [7]   7 8 9  */
+    S_sw_bc, /* swallow bottom center [8]        */
+    S_sw_br, /* swallow bottom right [9]         */
+
+    S_explode1, /* explosion top left                  */
+    S_explode2, /* explosion top center                        */
+    S_explode3, /* explosion top right    Ex.  */
+    S_explode4, /* explosion middle left               */
+    S_explode5, /* explosion middle center /-\ */
+    S_explode6, /* explosion middle right  |@| */
+    S_explode7, /* explosion bottom left   \-/ */
+    S_explode8, /* explosion bottom center             */
+    S_explode9, /* explosion bottom right              */
 
 /* end effects */
 
-#define MAXPCHARS 96  /* maximum number of mapped characters */
-#define MAXDCHARS 42  /* maximum of mapped dungeon characters */
-#define MAXTCHARS 22  /* maximum of mapped trap characters */
-#define MAXECHARS 31  /* maximum of mapped effects characters */
+    MAXPCHARS   /* maximum number of mapped characters */
+};
+
+#define MAXDCHARS (S_water - S_stone + 1)  /* maximum of mapped dungeon characters */
+#define MAXTCHARS (S_vibrating_square - S_arrow_trap + 1)  /* maximum of mapped trap characters */
+#define MAXECHARS (S_explode9 - S_vbeam + 1)  /* maximum of mapped effects characters */
 #define MAXEXPCHARS 9 /* number of explosion characters */
 
 #define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom)
 
+#define is_cmap_trap(i) ((i) >= S_arrow_trap && (i) <= S_polymorph_trap)
+#define is_cmap_drawbridge(i) ((i) >= S_vodbridge && (i) <= S_hcdbridge)
+#define is_cmap_door(i) ((i) >= S_vodoor && (i) <= S_hcdoor)
+#define is_cmap_wall(i) ((i) >= S_stone && (i) <= S_trwall)
+#define is_cmap_room(i) ((i) >= S_room && (i) <= S_darkroom)
+#define is_cmap_corr(i) ((i) >= S_corr && (i) <= S_litcorr)
+#define is_cmap_furniture(i) ((i) >= S_upstair && (i) <= S_fountain)
+#define is_cmap_water(i) ((i) == S_pool || (i) == S_water)
+#define is_cmap_lava(i) ((i) == S_lava)
+
+
 struct symdef {
     uchar sym;
     const char *explanation;
@@ -285,6 +302,8 @@ extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
 extern const struct symdef def_warnsyms[WARNCOUNT];
 extern int currentgraphics; /* from drawing.c */
 extern nhsym showsyms[];
+extern nhsym l_syms[];
+extern nhsym r_syms[];
 
 extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */
 #define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht))