OSDN Git Service

隠しドアを隠せない地形で隠しドアを潰す判定をMOVE || CAN_FLYとした. 潰
[hengband/hengband.git] / src / rooms.c
index e382307..12e630f 100644 (file)
@@ -44,9 +44,9 @@ static room_info_type room_info_normal[ROOM_T_MAX] =
        {{  0,  1,  1,  1,  2,  3,  5,  6,  8, 10, 13}, 10}, /*NEST     */
        {{  0,  1,  1,  2,  3,  4,  6,  8, 10, 13, 16}, 10}, /*PIT      */
        {{  0,  1,  1,  1,  2,  2,  3,  5,  6,  8, 10}, 10}, /*LESSER_V */
-       {{  0,  0,  1,  1,  1,  2,  2,  3,  4,  5,  6}, 20}, /*GREATER_V*/
+       {{  0,  0,  1,  1,  1,  2,  2,  2,  3,  3,  4}, 20}, /*GREATER_V*/
        {{  0,100,200,300,400,500,600,700,800,900,999}, 10}, /*FRACAVE  */
-       {{  0,  1,  1,  1,  1,  1,  1,  2,  2,  3,  3}, 10}, /*RANDOM_V */
+       {{  0,  1,  1,  1,  1,  1,  1,  1,  1,  2,  2}, 10}, /*RANDOM_V */
        {{  0,  4,  8, 12, 16, 20, 24, 28, 32, 36, 40},  3}, /*OVAL     */
        {{  1,  6, 12, 18, 24, 30, 36, 42, 48, 54, 60}, 10}, /*CRYPT    */
        {{  0,  0,  1,  1,  1,  2,  3,  4,  5,  6,  8}, 20}, /*TRAP_PIT */
@@ -103,9 +103,12 @@ static void place_secret_door(int y, int x)
                c_ptr->mimic = feat_wall_inner;
 
                /* Floor type terrain cannot hide a door */
-               if (feat_floor(c_ptr->mimic))
+               if (feat_supports_los(c_ptr->mimic) && !feat_supports_los(c_ptr->feat))
                {
-                       c_ptr->feat = c_ptr->mimic;
+                       if (have_flag(f_info[c_ptr->mimic].flags, FF_MOVE) || have_flag(f_info[c_ptr->mimic].flags, FF_CAN_FLY))
+                       {
+                               c_ptr->feat = one_in_(2) ? c_ptr->mimic : floor_type[randint0(100)];
+                       }
                        c_ptr->mimic = 0;
                }
 
@@ -373,8 +376,19 @@ static bool find_space(int *y, int *x, int height, int width)
                return FALSE;
        }
 
-       /* Choose a random one */
-       pick = randint1(candidates);
+       /* Normal dungeon */
+       if (!(d_info[dungeon_type].flags1 & DF1_NO_CAVE))
+       {
+               /* Choose a random one */
+               pick = randint1(candidates);
+       }
+
+       /* NO_CAVE dungeon (Castle) */
+       else
+       {
+               /* Always choose the center one */
+               pick = candidates/2 + 1;
+       }
 
        /* Pick up the choosen location */
        for (block_y = dun->row_rooms - blocks_high; block_y >= 0; block_y--)
@@ -1360,7 +1374,7 @@ static bool vault_aux_jelly(int r_idx)
        if (r_ptr->flags3 & (RF3_EVIL)) return (FALSE);
 
        /* Require icky thing, jelly, mold, or mushroom */
-       if (!strchr("ijm,", r_ptr->d_char)) return (FALSE);
+       if (!my_strchr("ijm,", r_ptr->d_char)) return (FALSE);
 
        /* Okay */
        return (TRUE);
@@ -1446,7 +1460,7 @@ static bool vault_aux_kennel(int r_idx)
        if (!vault_monster_okay(r_idx)) return (FALSE);
 
        /* Require a Zephyr Hound or a dog */
-       if (!strchr("CZ", r_ptr->d_char)) return (FALSE);
+       if (!my_strchr("CZ", r_ptr->d_char)) return (FALSE);
   
        /* Okay */
        return (TRUE);
@@ -1462,9 +1476,9 @@ static bool vault_aux_mimic(int r_idx)
 
        /* Validate the monster */
        if (!vault_monster_okay(r_idx)) return (FALSE);
-  
+
        /* Require mimic */
-       if (!strchr("!|$?=", r_ptr->d_char)) return (FALSE);
+       if (!my_strchr("!$&(/=?[\\|", r_ptr->d_char)) return (FALSE);
 
        /* Okay */
        return (TRUE);
@@ -2115,7 +2129,7 @@ static bool build_type5(void)
                while (attempts--)
                {
                        /* Get a (hard) monster type */
-                       r_idx = get_mon_num(dun_level + 10);
+                       r_idx = get_mon_num(dun_level + 11);
                        r_ptr = &r_info[r_idx];
 
                        /* Decline incorrect alignment */
@@ -2344,7 +2358,7 @@ static bool build_type6(void)
                while (attempts--)
                {
                        /* Get a (hard) monster type */
-                       r_idx = get_mon_num(dun_level + 10);
+                       r_idx = get_mon_num(dun_level + 11);
                        r_ptr = &r_info[r_idx];
 
                        /* Decline incorrect alignment */
@@ -2650,9 +2664,7 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
 
                                /* Permanent wall (inner) */
                        case 'X':
-                               c_ptr->feat = FEAT_PERM_INNER;
-                               c_ptr->info &= ~(CAVE_MASK);
-                               c_ptr->info |= CAVE_INNER;
+                               place_inner_perm_grid(c_ptr);
                                break;
 
                                /* Treasure/trap */
@@ -3119,7 +3131,7 @@ static void store_height(int x, int y, int val)
 * The tricky part is making sure the created cave is connected.  This
 * is done by 'filling' from the inside and only keeping the 'filled'
 * floor.  Walls bounding the 'filled' floor are also kept.  Everything
-* else is converted to the normal granite FEAT_WALL_EXTRA.
+* else is converted to the normal _extra_.
  */
 
 
@@ -3173,10 +3185,10 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
        fill_data.ymin = y0 - yhsize;
        fill_data.xmax = x0 + xhsize;
        fill_data.ymax = y0 + yhsize;
-       
+
        /* Store cutoff in global for quick access */
        fill_data.c1 = cutoff;
-       
+
        /*
        * Scale factor for middle points:
        * About sqrt(2) * 256 - correct for a square lattice
@@ -3192,8 +3204,8 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
        {
                for (j = 0; j <= ysize; j++)
                {
-                       /* 255 is a flag for "not done yet" */
-                       cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = 255;
+                       /* -1 is a flag for "not done yet" */
+                       cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1;
                        /* Clear icky flag because may be redoing the cave */
                        cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY);
                }
@@ -3225,11 +3237,11 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                xhstep /= 2;
                ystep = yhstep;
                yhstep /= 2;
-               
+
                /* cache well used values */
                xstep2 = xstep / 256;
                ystep2 = ystep / 256;
-               
+
                xhstep2 = xhstep / 256;
                yhstep2 = yhstep / 256;
 
@@ -3241,10 +3253,10 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                /* cache often used values */
                                ii = i / 256 + fill_data.xmin;
                                jj = j / 256 + fill_data.ymin;
-                               
+
                                /* Test square */
-                               if (cave[jj][ii].feat == 255)
-                               {                               
+                               if (cave[jj][ii].feat == -1)
+                               {
                                        if (xhstep2 > grd)
                                        {
                                                /* If greater than 'grid' level then is random */
@@ -3271,9 +3283,9 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                /* cache often used values */
                                ii = i / 256 + fill_data.xmin;
                                jj = j / 256 + fill_data.ymin;
-                               
+
                                /* Test square */
-                               if (cave[jj][ii].feat == 255)
+                               if (cave[jj][ii].feat == -1)
                                {
                                        if (xhstep2 > grd)
                                        {
@@ -3300,10 +3312,10 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                /* cache often used values */
                                ii = i / 256 + fill_data.xmin;
                                jj = j / 256 + fill_data.ymin;
-                               
+
                                /* Test square */
-                               if (cave[jj][ii].feat == 255)
-                               {                               
+                               if (cave[jj][ii].feat == -1)
+                               {
                                        if (xhstep2 > grd)
                                        {
                                                /* If greater than 'grid' level then is random */
@@ -3315,12 +3327,12 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                                xm = fill_data.xmin + (i - xhstep) / 256;
                                                xp = fill_data.xmin + (i + xhstep) / 256;
                                                ym = fill_data.ymin + (j - yhstep) / 256;
-                                               yp = fill_data.ymin + (j + yhstep) / 256;                                       
-                                       
+                                               yp = fill_data.ymin + (j + yhstep) / 256;
+
                                                /* 
                                                 * Average over all four corners + scale by diagsize to
                                                 * reduce the effect of the square grid on the shape of the fractal
-                                                */                             
+                                                */
                                                store_height(ii, jj,
                                                        (cave[ym][xm].feat + cave[yp][xm].feat
                                                        + cave[ym][xp].feat + cave[yp][xp].feat) / 4
@@ -3493,7 +3505,6 @@ static void cave_fill(byte y, byte x)
 static bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, bool light, bool room)
 {
        int x, y, i, xhsize, yhsize;
-       
 
        /* offsets to middle from corner */
        xhsize = xsize / 2;
@@ -3665,7 +3676,7 @@ static bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, b
         * XXX XXX XXX There is a slight problem when tunnels pierce the caves:
         * Extra doors appear inside the system.  (Its not very noticeable though.)
         * This can be removed by "filling" from the outside in.  This allows a separation
-        * from FEAT_WALL_OUTER with FEAT_WALL_INNER.  (Internal walls are  F.W.OUTER instead.)
+        * from _outer_ with _inner_.  (Internal walls are  _outer_ instead.)
         * The extra effort for what seems to be only a minor thing (even non-existant if you
         * think of the caves not as normal rooms, but as holes in the dungeon), doesn't seem
         * worth it.
@@ -3894,9 +3905,8 @@ static bool generate_lake(int y0, int x0, int xsize, int ysize, int c1, int c2,
                        /* turn off icky flag (no longer needed.) */
                        cave[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM);
 
-                       /* Light lava and trees */
-                       if ((cave[y0 + y - yhsize][x0 + x - xhsize].feat == FEAT_DEEP_LAVA) ||
-                               (cave[y0 + y - yhsize][x0 + x - xhsize].feat == FEAT_SHAL_LAVA))
+                       /* Light lava */
+                       if (have_flag(f_flags_bold(y0 + y - yhsize, x0 + x - xhsize), FF_LAVA))
                        {
                                if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW;
                        }
@@ -4042,8 +4052,7 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
 
                         /* if floor, shallow water and lava */
                        if (is_floor_bold(y, x) ||
-                           (cave[y][x].feat == FEAT_SHAL_WATER) ||
-                           (cave[y][x].feat == FEAT_SHAL_LAVA))
+                           (have_flag(f_flags_bold(y, x), FF_PLACE) && have_flag(f_flags_bold(y, x), FF_DROP)))
                        {
                                /* The smaller 'value' is, the better the stuff */
                                if (value < 0)
@@ -4706,9 +4715,7 @@ static void build_mini_c_vault(int x0, int y0, int xsize, int ysize)
                        c_ptr->info |= (CAVE_ROOM | CAVE_ICKY);
 
                        /* Permanent walls */
-                       c_ptr->feat = FEAT_PERM_INNER;
-                       c_ptr->info &= ~(CAVE_MASK);
-                       c_ptr->info |= CAVE_INNER;
+                       place_inner_perm_grid(c_ptr);
                }
        }
 
@@ -5015,19 +5022,24 @@ static void build_castle_vault(int x0, int y0, int xsize, int ysize)
  * Note: no range checking is done so must be inside dungeon
  * This routine also stomps on doors
  */
-static void add_outer_wall(int x, int y, int light,
-                                                                       int x1, int y1, int x2, int y2)
+static void add_outer_wall(int x, int y, int light, int x1, int y1, int x2, int y2)
 {
+       cave_type *c_ptr;
+       feature_type *f_ptr;
        int i, j;
 
        if (!in_bounds(y, x)) return;
 
+       c_ptr = &cave[y][x];
+
        /* hack- check to see if square has been visited before
        * if so, then exit (use room flag to do this) */
-       if (cave[y][x].info & CAVE_ROOM) return;
+       if (c_ptr->info & CAVE_ROOM) return;
 
        /* set room flag */
-       cave[y][x].info |= CAVE_ROOM;
+       c_ptr->info |= CAVE_ROOM;
+
+       f_ptr = &f_info[c_ptr->feat];
 
        if (is_floor_bold(y, x))
        {
@@ -5039,7 +5051,7 @@ static void add_outer_wall(int x, int y, int light,
                                         (y + j >= y1) && (y + j <= y2))
                                {
                                        add_outer_wall(x + i, y + j, light, x1, y1, x2, y2);
-                                       if (light) cave[y][x].info |= CAVE_GLOW;
+                                       if (light) c_ptr->info |= CAVE_GLOW;
                                }
                        }
                }
@@ -5048,12 +5060,12 @@ static void add_outer_wall(int x, int y, int light,
        {
                /* Set bounding walls */
                place_outer_bold(y, x);
-               if (light) cave[y][x].info |= CAVE_GLOW;
+               if (light) c_ptr->info |= CAVE_GLOW;
        }
-       else if (cave[y][x].feat == FEAT_PERM_OUTER)
+       else if (permanent_wall(f_ptr))
        {
                /* Set bounding walls */
-               if (light) cave[y][x].info |= CAVE_GLOW;
+               if (light) c_ptr->info |= CAVE_GLOW;
        }
 }
 
@@ -5828,7 +5840,7 @@ static bool build_type14(void)
        bool light;
 
        cave_type *c_ptr;
-       byte trap;
+       s16b trap;
 
        /* Pick a room size */
        y1 = randint1(4);
@@ -5956,11 +5968,11 @@ void generate_rooms(void)
        int area_size = 100 * (cur_hgt*cur_wid) / (MAX_HGT*MAX_WID);
        int level_index = MIN(10, div_round(dun_level, 10));
 
-        /* Number of each type of room on this level */
-        s16b room_num[ROOM_T_MAX];
+       /* Number of each type of room on this level */
+       s16b room_num[ROOM_T_MAX];
 
        /* Limit number of rooms */
-       int dun_rooms = rand_range(DUN_ROOMS_MIN, DUN_ROOMS_MAX * area_size / 100);
+       int dun_rooms = DUN_ROOMS_MAX * area_size / 100;
 
        /* Assume normal cave */
        room_info_type *room_info_ptr = room_info_normal;
@@ -6134,6 +6146,12 @@ void generate_rooms(void)
                if (!remain) break;
        }
 
+       if (cheat_room)
+       {
+#ifdef JP
+               msg_format("Éô²°¿ô: %d", rooms_built);
+#else
+               msg_format("Number of Rooms: %d", rooms_built);
+#endif
+       }
 }
-
-