OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / rooms.c
index 6202b6c..5135bfa 100644 (file)
@@ -51,6 +51,8 @@
 
 #include "trap.h"
 
+#include "monster.h"
+
 
 /*!
  * 各部屋タイプの生成比定義
  * for all the rooms you ask for.\n
  */
 
-#if 0
+#if 1
 
 static room_info_type room_info_normal[ROOM_T_MAX] =
 {
        /* Depth */
        /*  0  10  20  30  40  50  60  70  80  90 100  min limit */
-
        {{999,900,800,700,600,500,400,300,200,100,  0},  0}, /*NORMAL   */
        {{  1, 10, 20, 30, 40, 50, 60, 70, 80, 90,100},  1}, /*OVERLAP  */
        {{  1, 10, 20, 30, 40, 50, 60, 70, 80, 90,100},  3}, /*CROSS    */
@@ -92,12 +93,12 @@ static room_info_type room_info_normal[ROOM_T_MAX] =
        {{  0,  0,  1,  1,  1,  2,  3,  4,  5,  6,  8}, 20}, /*TRAP     */
        {{  0,  0,  0,  0,  1,  1,  1,  2,  2,  2,  2}, 40}, /*GLASS    */
        {{  1,  1,  1,  1,  1,  1,  1,  2,  2,  3,  3},  1}, /*ARCADE   */
-       {{ 20, 40, 60, 80,100,100,100,100,100,100,100},  1}, /*FIX   */
+       {{  1,  8, 16, 24, 32, 40, 48, 56, 64, 72, 80},  1}, /*FIX      */
 };
 
 #endif
 
-#if 1
+#if 0
 static room_info_type room_info_normal[ROOM_T_MAX] =
 {
 /*デバッグ用配列*/
@@ -117,7 +118,7 @@ static room_info_type room_info_normal[ROOM_T_MAX] =
 { {  0,  0,  1,  1,  1,  2,  3,  4,  5,  6,  0}, 20 }, /*TRAP     */
 { {  0,  0,  0,  0,  1,  1,  1,  2,  2,  2,  0}, 40 }, /*GLASS    */
 { {  1,  1,  1,  1,  1,  1,  1,  2,  2,  3,  0},  1 }, /*ARCADE   */
-{ { 20, 40, 60, 80,100,100,100,100,100,100,100},  1 }, /*FIX   */
+{ { 20, 40, 60, 80,100,100,100,100,100,100,100},  1 }, /*FIX      */
 };
 
 #endif
@@ -136,12 +137,12 @@ static byte room_build_order[ROOM_T_MAX] = {
        ROOM_T_TRAP,
        ROOM_T_GLASS,
        ROOM_T_INNER_FEAT,
+       ROOM_T_FIXED,
        ROOM_T_OVAL,
        ROOM_T_CRYPT,
        ROOM_T_OVERLAP,
        ROOM_T_CROSS,
        ROOM_T_FRACAVE,
-       ROOM_T_FIXED,
        ROOM_T_NORMAL,
 };
 
@@ -282,9 +283,9 @@ static void check_room_boundary(POSITION x1, POSITION y1, POSITION x2, POSITION
  * @param block_x 範囲の左端
  * @return なし
  */
-static bool find_space_aux(int blocks_high, int blocks_wide, int block_y, int block_x)
+static bool find_space_aux(POSITION blocks_high, POSITION blocks_wide, POSITION block_y, POSITION block_x)
 {
-       int by1, bx1, by2, bx2, by, bx;
+       POSITION by1, bx1, by2, bx2, by, bx;
 
        /* Itty-bitty rooms must shift about within their rectangle */
        if (blocks_wide < 3)
@@ -327,8 +328,8 @@ static bool find_space_aux(int blocks_high, int blocks_wide, int block_y, int bl
        }
 
        /* Extract blocks */
-       by1 = block_y + 0;
-       bx1 = block_x + 0;
+       by1 = block_y;
+       bx1 = block_x;
        by2 = block_y + blocks_high;
        bx2 = block_x + blocks_wide;
 
@@ -376,13 +377,12 @@ static bool find_space_aux(int blocks_high, int blocks_wide, int block_y, int bl
 bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width)
 {
        int candidates, pick;
-       int by, bx, by1, bx1, by2, bx2;
-       int block_y = 0, block_x = 0;
-
+       POSITION by, bx, by1, bx1, by2, bx2;
+       POSITION block_y = 0, block_x = 0;
 
        /* Find out how many blocks we need. */
-       int blocks_high = 1 + ((height - 1) / BLOCK_HGT);
-       int blocks_wide = 1 + ((width - 1) / BLOCK_WID);
+       POSITION blocks_high = 1 + ((height - 1) / BLOCK_HGT);
+       POSITION blocks_wide = 1 + ((width - 1) / BLOCK_WID);
 
        /* There are no way to allocate such huge space */
        if (dun->row_rooms < blocks_high) return FALSE;
@@ -442,8 +442,8 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width)
        }
 
        /* Extract blocks */
-       by1 = block_y + 0;
-       bx1 = block_x + 0;
+       by1 = block_y;
+       bx1 = block_x;
        by2 = block_y + blocks_high;
        bx2 = block_x + blocks_wide;
 
@@ -473,7 +473,6 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width)
                }
        }
 
-
        /*
         * Hack- See if room will cut off a cavern.
         *
@@ -482,14 +481,11 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width)
         */
        check_room_boundary(*x - width / 2 - 1, *y - height / 2 - 1, *x + (width - 1) / 2 + 1, *y + (height - 1) / 2 + 1);
 
-
        /* Success. */
        return TRUE;
 }
 
 
-
-
 /*
  * Structure to hold all "fill" data
  */
@@ -527,15 +523,15 @@ static fill_data_type fill_data;
 
 /* Store routine for the fractal cave generator */
 /* this routine probably should be an inline function or a macro. */
-static void store_height(POSITION x, POSITION y, int val)
+static void store_height(POSITION x, POSITION y, FEAT_IDX val)
 {
        /* if on boundary set val > cutoff so walls are not as square */
        if (((x == fill_data.xmin) || (y == fill_data.ymin) ||
-            (x == fill_data.xmax) || (y == fill_data.ymax)) &&
-           (val <= fill_data.c1)) val = fill_data.c1 + 1;
+               (x == fill_data.xmax) || (y == fill_data.ymax)) &&
+               (val <= fill_data.c1)) val = fill_data.c1 + 1;
 
        /* store the value in height-map format */
-       cave[y][x].feat = (s16b)val;
+       cave[y][x].feat = val;
 
        return;
 }
@@ -603,12 +599,12 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
         * this gives 8 binary places of fractional part + 8 places of normal part
         */
 
-       u16b xstep, xhstep, ystep, yhstep;
-       u16b xstep2, xhstep2, ystep2, yhstep2;
-       u16b i, j, ii, jj, diagsize, xxsize, yysize;
+       POSITION xstep, xhstep, ystep, yhstep;
+       POSITION xstep2, xhstep2, ystep2, yhstep2;
+       POSITION i, j, ii, jj, diagsize, xxsize, yysize;
        
        /* Cache for speed */
-       u16b xm, xp, ym, yp;
+       POSITION xm, xp, ym, yp;
 
        /* redefine size so can change the value if out of range */
        xsize = xsiz;
@@ -793,7 +789,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g
 }
 
 
-static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int feat1, int feat2, int feat3, int info1, int info2, int info3)
+static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, FEAT_IDX feat1, FEAT_IDX feat2, FEAT_IDX feat3, BIT_FLAGS info1, BIT_FLAGS info2, BIT_FLAGS info3)
 {
        /*
         * function used to convert from height-map back to the
@@ -815,14 +811,14 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int f
                        /* 25% of the time use the other tile : it looks better this way */
                        if (randint1(100) < 75)
                        {
-                               cave[y][x].feat = (s16b)feat1;
+                               cave[y][x].feat = feat1;
                                cave[y][x].info &= ~(CAVE_MASK);
                                cave[y][x].info |= info1;
                                return TRUE;
                        }
                        else
                        {
-                               cave[y][x].feat = (s16b)feat2;
+                               cave[y][x].feat = feat2;
                                cave[y][x].info &= ~(CAVE_MASK);
                                cave[y][x].info |= info2;
                                return TRUE;
@@ -833,14 +829,14 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int f
                        /* 25% of the time use the other tile : it looks better this way */
                        if (randint1(100) < 75)
                        {
-                               cave[y][x].feat = (s16b)feat2;
+                               cave[y][x].feat = feat2;
                                cave[y][x].info &= ~(CAVE_MASK);
                                cave[y][x].info |= info2;
                                return TRUE;
                        }
                        else
                        {
-                               cave[y][x].feat = (s16b)feat1;
+                               cave[y][x].feat = feat1;
                                cave[y][x].info &= ~(CAVE_MASK);
                                cave[y][x].info |= info1;
                                return TRUE;
@@ -848,7 +844,7 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int f
                }
                else if (cave[y][x].feat <= c3)
                {
-                       cave[y][x].feat = (s16b)feat3;
+                       cave[y][x].feat = feat3;
                        cave[y][x].info &= ~(CAVE_MASK);
                        cave[y][x].info |= info3;
                        return TRUE;
@@ -872,7 +868,7 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int f
 static void cave_fill(POSITION y, POSITION x)
 {
        int i, j, d;
-       int ty, tx;
+       POSITION ty, tx;
 
        int flow_tail = 1;
        int flow_head = 0;
@@ -884,7 +880,6 @@ static void cave_fill(POSITION y, POSITION x)
        temp_y[0] = y;
        temp_x[0] = x;
 
-
        /* Now process the queue */
        while (flow_head != flow_tail)
        {
@@ -1142,7 +1137,8 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize,
  */
 void build_cavern(void)
 {
-       int grd, roug, cutoff, xsize, ysize, x0, y0;
+       int grd, roug, cutoff;
+       POSITION xsize, ysize, x0, y0;
        bool done, light;
 
        light = done = FALSE;
@@ -2162,7 +2158,9 @@ bool generate_rooms(void)
         * XXX -- Various dungeon types and options.
         */
 
-       /*! @details ダンジョンにBEGINNER、CHAMELEON、SMALLESTいずれのフラグもなく、かつ「常に通常でない部屋を生成する」フラグがONならば、GRATER_VAULTのみを生成対象とする。 / Ironman sees only Greater Vaults */
+       /*! @details ダンジョンにBEGINNER、CHAMELEON、SMALLESTいずれのフラグもなく、
+        * かつ「常に通常でない部屋を生成する」フラグがONならば、
+        * GRATER_VAULTのみを生成対象とする。 / Ironman sees only Greater Vaults */
        if (ironman_rooms && !((d_info[dungeon_type].flags1 & (DF1_BEGINNER | DF1_CHAMELEON | DF1_SMALLEST))))
        {
                for (i = 0; i < ROOM_T_MAX; i++)
@@ -2180,6 +2178,12 @@ bool generate_rooms(void)
                prob_list[ROOM_T_RANDOM_VAULT] = 0;
        }
 
+       /*! @details ダンジョンにBEGINNERフラグがあるならば、FIXED_ROOMを除外 / Forbidden vaults */
+       if (d_info[dungeon_type].flags1 & DF1_BEGINNER)
+       {
+               prob_list[ROOM_T_FIXED] = 0;
+       }
+
        /*! @details ダンジョンにNO_CAVEフラグがある場合、FRACAVEの生成枠がNORMALに与えられる。CRIPT、OVALの生成枠がINNER_Fに与えられる。/ NO_CAVE dungeon (Castle)*/
        if (d_info[dungeon_type].flags1 & DF1_NO_CAVE)
        {