OSDN Git Service

[Refactor] #38997 rooms-normal.c 内関数に floor_type * 引数を追加.
[hengband/hengband.git] / src / rooms-fractal.c
1 #include "angband.h"
2 #include "grid.h"
3 #include "floor-generate.h"
4 #include "rooms.h"
5 #include "rooms-normal.h"
6 #include "floor.h"
7 #include "dungeon.h"
8
9 /*!
10 * @brief タイプ9の部屋…フラクタルカーブによる洞窟生成 / Type 9 -- Driver routine to create fractal current_floor_ptr->grid_array system
11 * @return なし
12 */
13 bool build_type9(void)
14 {
15         int grd, roug, cutoff;
16         POSITION xsize, ysize, y0, x0;
17
18         bool done, light, room;
19
20         /* get size: note 'Evenness'*/
21         xsize = randint1(22) * 2 + 6;
22         ysize = randint1(15) * 2 + 6;
23
24         /* Find and reserve some space in the dungeon.  Get center of room. */
25         if (!find_space(&y0, &x0, ysize + 1, xsize + 1))
26         {
27                 /* Limit to the minimum room size, and retry */
28                 xsize = 8;
29                 ysize = 8;
30
31                 /* Find and reserve some space in the dungeon.  Get center of room. */
32                 if (!find_space(&y0, &x0, ysize + 1, xsize + 1))
33                 {
34                         /*
35                         * Still no space?!
36                         * Try normal room
37                         */
38                         return build_type1(current_floor_ptr);
39                 }
40         }
41
42         light = done = FALSE;
43         room = TRUE;
44
45         if ((current_floor_ptr->dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
46
47         while (!done)
48         {
49                 /* Note: size must be even or there are rounding problems
50                 * This causes the tunnels not to connect properly to the room */
51
52                 /* testing values for these parameters feel free to adjust */
53                 grd = 1 << (randint0(4));
54
55                 /* want average of about 16 */
56                 roug = randint1(8) * randint1(4);
57
58                 /* about size/2 */
59                 cutoff = randint1(xsize / 4) + randint1(ysize / 4) +
60                         randint1(xsize / 4) + randint1(ysize / 4);
61
62                 /* make it */
63                 generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
64
65                 /* Convert to normal format + clean up */
66                 done = generate_fracave(y0, x0, xsize, ysize, cutoff, light, room);
67         }
68
69         return TRUE;
70 }