6 #include "monsterrace-hook.h"
7 #include "objectkind-hook.h"
12 * @brief タイプ15の部屋…ガラス部屋の生成 / Type 15 -- glass rooms
15 bool build_type15(void)
17 POSITION y, x, y2, x2, yval, xval;
18 POSITION y1, x1, xsize, ysize;
23 /* Pick a room size */
24 xsize = rand_range(9, 13);
25 ysize = rand_range(9, 13);
27 /* Find and reserve some space in the dungeon. Get center of room. */
28 if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
30 /* Choose lite or dark */
31 light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
33 /* Get corner values */
34 y1 = yval - ysize / 2;
35 x1 = xval - xsize / 2;
36 y2 = yval + (ysize - 1) / 2;
37 x2 = xval + (xsize - 1) / 2;
39 /* Place a full floor under the room */
40 for (y = y1 - 1; y <= y2 + 1; y++)
42 for (x = x1 - 1; x <= x2 + 1; x++)
44 g_ptr = &grid_array[y][x];
45 place_floor_grid(g_ptr);
46 g_ptr->feat = feat_glass_floor;
47 g_ptr->info |= (CAVE_ROOM);
48 if (light) g_ptr->info |= (CAVE_GLOW);
52 /* Walls around the room */
53 for (y = y1 - 1; y <= y2 + 1; y++)
55 g_ptr = &grid_array[y][x1 - 1];
56 place_outer_grid(g_ptr);
57 g_ptr->feat = feat_glass_wall;
58 g_ptr = &grid_array[y][x2 + 1];
59 place_outer_grid(g_ptr);
60 g_ptr->feat = feat_glass_wall;
62 for (x = x1 - 1; x <= x2 + 1; x++)
64 g_ptr = &grid_array[y1 - 1][x];
65 place_outer_grid(g_ptr);
66 g_ptr->feat = feat_glass_wall;
67 g_ptr = &grid_array[y2 + 1][x];
68 place_outer_grid(g_ptr);
69 g_ptr->feat = feat_glass_wall;
74 case 1: /* 4 lite breathers + potion */
77 get_mon_num_prep(vault_aux_lite, NULL);
79 /* Place fixed lite berathers */
80 for (dir1 = 4; dir1 < 8; dir1++)
82 MONRACE_IDX r_idx = get_mon_num(dun_level);
84 y = yval + 2 * ddy_ddd[dir1];
85 x = xval + 2 * ddx_ddd[dir1];
86 if (r_idx) place_monster_aux(0, y, x, r_idx, PM_ALLOW_SLEEP);
88 /* Walls around the breather */
89 for (dir2 = 0; dir2 < 8; dir2++)
91 g_ptr = &grid_array[y + ddy_ddd[dir2]][x + ddx_ddd[dir2]];
92 place_inner_grid(g_ptr);
93 g_ptr->feat = feat_glass_wall;
97 /* Walls around the potion */
98 for (dir1 = 0; dir1 < 4; dir1++)
100 y = yval + 2 * ddy_ddd[dir1];
101 x = xval + 2 * ddx_ddd[dir1];
102 g_ptr = &grid_array[y][x];
103 place_inner_perm_grid(g_ptr);
104 g_ptr->feat = feat_permanent_glass_wall;
105 grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]].info |= (CAVE_ICKY);
110 y = yval + 2 * ddy_ddd[dir1];
111 x = xval + 2 * ddx_ddd[dir1];
112 place_secret_door(y, x, DOOR_GLASS_DOOR);
113 g_ptr = &grid_array[y][x];
114 if (is_closed_door(g_ptr->feat)) g_ptr->mimic = feat_glass_wall;
117 get_obj_num_hook = kind_is_potion;
118 place_object(yval, xval, AM_NO_FIXED_ART);
119 grid_array[yval][xval].info |= (CAVE_ICKY);
123 case 2: /* 1 lite breather + random object */
129 g_ptr = &grid_array[y1 + 1][x1 + 1];
130 place_inner_grid(g_ptr);
131 g_ptr->feat = feat_glass_wall;
133 g_ptr = &grid_array[y1 + 1][x2 - 1];
134 place_inner_grid(g_ptr);
135 g_ptr->feat = feat_glass_wall;
137 g_ptr = &grid_array[y2 - 1][x1 + 1];
138 place_inner_grid(g_ptr);
139 g_ptr->feat = feat_glass_wall;
141 g_ptr = &grid_array[y2 - 1][x2 - 1];
142 place_inner_grid(g_ptr);
143 g_ptr->feat = feat_glass_wall;
144 get_mon_num_prep(vault_aux_lite, NULL);
146 r_idx = get_mon_num(dun_level);
147 if (r_idx) place_monster_aux(0, yval, xval, r_idx, 0L);
149 /* Walls around the breather */
150 for (dir1 = 0; dir1 < 8; dir1++)
152 g_ptr = &grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]];
153 place_inner_grid(g_ptr);
154 g_ptr->feat = feat_glass_wall;
157 /* Curtains around the breather */
158 for (y = yval - 1; y <= yval + 1; y++)
160 place_closed_door(y, xval - 2, DOOR_CURTAIN);
161 place_closed_door(y, xval + 2, DOOR_CURTAIN);
163 for (x = xval - 1; x <= xval + 1; x++)
165 place_closed_door(yval - 2, x, DOOR_CURTAIN);
166 place_closed_door(yval + 2, x, DOOR_CURTAIN);
169 /* Place an object */
170 place_object(yval, xval, AM_NO_FIXED_ART);
171 grid_array[yval][xval].info |= (CAVE_ICKY);
175 case 3: /* 4 shards breathers + 2 potions */
179 /* Walls around the potion */
180 for (y = yval - 2; y <= yval + 2; y++)
182 g_ptr = &grid_array[y][xval - 3];
183 place_inner_grid(g_ptr);
184 g_ptr->feat = feat_glass_wall;
185 g_ptr = &grid_array[y][xval + 3];
186 place_inner_grid(g_ptr);
187 g_ptr->feat = feat_glass_wall;
189 for (x = xval - 2; x <= xval + 2; x++)
191 g_ptr = &grid_array[yval - 3][x];
192 place_inner_grid(g_ptr);
193 g_ptr->feat = feat_glass_wall;
194 g_ptr = &grid_array[yval + 3][x];
195 place_inner_grid(g_ptr);
196 g_ptr->feat = feat_glass_wall;
198 for (dir1 = 4; dir1 < 8; dir1++)
200 g_ptr = &grid_array[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]];
201 place_inner_grid(g_ptr);
202 g_ptr->feat = feat_glass_wall;
204 get_mon_num_prep(vault_aux_shards, NULL);
206 /* Place shard berathers */
207 for (dir1 = 4; dir1 < 8; dir1++)
209 MONRACE_IDX r_idx = get_mon_num(dun_level);
211 y = yval + ddy_ddd[dir1];
212 x = xval + ddx_ddd[dir1];
213 if (r_idx) place_monster_aux(0, y, x, r_idx, 0L);
216 /* Place two potions */
219 get_obj_num_hook = kind_is_potion;
220 place_object(yval, xval - 1, AM_NO_FIXED_ART);
221 get_obj_num_hook = kind_is_potion;
222 place_object(yval, xval + 1, AM_NO_FIXED_ART);
226 get_obj_num_hook = kind_is_potion;
227 place_object(yval - 1, xval, AM_NO_FIXED_ART);
228 get_obj_num_hook = kind_is_potion;
229 place_object(yval + 1, xval, AM_NO_FIXED_ART);
232 for (y = yval - 2; y <= yval + 2; y++)
233 for (x = xval - 2; x <= xval + 2; x++)
234 grid_array[y][x].info |= (CAVE_ICKY);
240 msg_print_wizard(CHEAT_DUNGEON, _("ガラスの部屋が生成されました。", "Glass room was generated."));