OSDN Git Service

46e680f910a996a30ab12e428419f36682cd9866
[hengband/hengband.git] / src / rooms-trap.c
1 #include "angband.h"\r
2 #include "grid.h"\r
3 #include "generate.h"\r
4 #include "rooms.h"\r
5 \r
6 \r
7 /*!\r
8 * @brief タイプ14の部屋…特殊トラップ部屋の生成 / Type 14 -- trapped rooms\r
9 * @return なし\r
10 * @details\r
11 * A special trap is placed at center of the room\r
12 */\r
13 bool build_type14(void)\r
14 {\r
15         POSITION y, x, y2, x2, yval, xval;\r
16         POSITION y1, x1, xsize, ysize;\r
17 \r
18         bool light;\r
19 \r
20         cave_type *c_ptr;\r
21         s16b trap;\r
22 \r
23         /* Pick a room size */\r
24         y1 = randint1(4);\r
25         x1 = randint1(11);\r
26         y2 = randint1(3);\r
27         x2 = randint1(11);\r
28 \r
29         xsize = x1 + x2 + 1;\r
30         ysize = y1 + y2 + 1;\r
31 \r
32         /* Find and reserve some space in the dungeon.  Get center of room. */\r
33         if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;\r
34 \r
35         /* Choose lite or dark */\r
36         light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS));\r
37 \r
38 \r
39         /* Get corner values */\r
40         y1 = yval - ysize / 2;\r
41         x1 = xval - xsize / 2;\r
42         y2 = yval + (ysize - 1) / 2;\r
43         x2 = xval + (xsize - 1) / 2;\r
44 \r
45 \r
46         /* Place a full floor under the room */\r
47         for (y = y1 - 1; y <= y2 + 1; y++)\r
48         {\r
49                 for (x = x1 - 1; x <= x2 + 1; x++)\r
50                 {\r
51                         c_ptr = &cave[y][x];\r
52                         place_floor_grid(c_ptr);\r
53                         c_ptr->info |= (CAVE_ROOM);\r
54                         if (light) c_ptr->info |= (CAVE_GLOW);\r
55                 }\r
56         }\r
57 \r
58         /* Walls around the room */\r
59         for (y = y1 - 1; y <= y2 + 1; y++)\r
60         {\r
61                 c_ptr = &cave[y][x1 - 1];\r
62                 place_outer_grid(c_ptr);\r
63                 c_ptr = &cave[y][x2 + 1];\r
64                 place_outer_grid(c_ptr);\r
65         }\r
66         for (x = x1 - 1; x <= x2 + 1; x++)\r
67         {\r
68                 c_ptr = &cave[y1 - 1][x];\r
69                 place_outer_grid(c_ptr);\r
70                 c_ptr = &cave[y2 + 1][x];\r
71                 place_outer_grid(c_ptr);\r
72         }\r
73 \r
74         if (dun_level < 30 + randint1(30))\r
75                 trap = feat_trap_piranha;\r
76         else\r
77                 trap = feat_trap_armageddon;\r
78 \r
79         /* Place a special trap */\r
80         c_ptr = &cave[rand_spread(yval, ysize / 4)][rand_spread(xval, xsize / 4)];\r
81         c_ptr->mimic = c_ptr->feat;\r
82         c_ptr->feat = trap;\r
83 \r
84         msg_format_wizard(CHEAT_DUNGEON, _("%sの部屋が生成されました。", "Room of %s was generated."), f_name + f_info[trap].name);\r
85 \r
86         return TRUE;\r
87 }\r
88 \r