5 #include "floor-generate.h"
8 #include "monsterrace-hook.h"
9 #include "objectkind-hook.h"
16 * @brief タイプ15の部屋…ガラス部屋の生成 / Type 15 -- glass rooms
19 bool build_type15(floor_type *floor_ptr)
21 POSITION y, x, y2, x2, yval, xval;
22 POSITION y1, x1, xsize, ysize;
27 /* Pick a room size */
28 xsize = rand_range(9, 13);
29 ysize = rand_range(9, 13);
31 /* Find and reserve some space in the dungeon. Get center of room. */
32 if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
34 /* Choose lite or dark */
35 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
37 /* Get corner values */
38 y1 = yval - ysize / 2;
39 x1 = xval - xsize / 2;
40 y2 = yval + (ysize - 1) / 2;
41 x2 = xval + (xsize - 1) / 2;
43 /* Place a full floor under the room */
44 for (y = y1 - 1; y <= y2 + 1; y++)
46 for (x = x1 - 1; x <= x2 + 1; x++)
48 g_ptr = &floor_ptr->grid_array[y][x];
49 place_floor_grid(g_ptr);
50 g_ptr->feat = feat_glass_floor;
51 g_ptr->info |= (CAVE_ROOM);
52 if (light) g_ptr->info |= (CAVE_GLOW);
56 /* Walls around the room */
57 for (y = y1 - 1; y <= y2 + 1; y++)
59 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
60 place_outer_grid(g_ptr);
61 g_ptr->feat = feat_glass_wall;
62 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
63 place_outer_grid(g_ptr);
64 g_ptr->feat = feat_glass_wall;
66 for (x = x1 - 1; x <= x2 + 1; x++)
68 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
69 place_outer_grid(g_ptr);
70 g_ptr->feat = feat_glass_wall;
71 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
72 place_outer_grid(g_ptr);
73 g_ptr->feat = feat_glass_wall;
78 case 1: /* 4 lite breathers + potion */
81 get_mon_num_prep(vault_aux_lite, NULL);
83 /* Place fixed lite berathers */
84 for (dir1 = 4; dir1 < 8; dir1++)
86 MONRACE_IDX r_idx = get_mon_num(floor_ptr->dun_level);
88 y = yval + 2 * ddy_ddd[dir1];
89 x = xval + 2 * ddx_ddd[dir1];
90 if (r_idx) place_monster_aux(0, y, x, r_idx, PM_ALLOW_SLEEP);
92 /* Walls around the breather */
93 for (dir2 = 0; dir2 < 8; dir2++)
95 g_ptr = &floor_ptr->grid_array[y + ddy_ddd[dir2]][x + ddx_ddd[dir2]];
96 place_inner_grid(g_ptr);
97 g_ptr->feat = feat_glass_wall;
101 /* Walls around the potion */
102 for (dir1 = 0; dir1 < 4; dir1++)
104 y = yval + 2 * ddy_ddd[dir1];
105 x = xval + 2 * ddx_ddd[dir1];
106 g_ptr = &floor_ptr->grid_array[y][x];
107 place_inner_perm_grid(g_ptr);
108 g_ptr->feat = feat_permanent_glass_wall;
109 floor_ptr->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]].info |= (CAVE_ICKY);
114 y = yval + 2 * ddy_ddd[dir1];
115 x = xval + 2 * ddx_ddd[dir1];
116 place_secret_door(floor_ptr, y, x, DOOR_GLASS_DOOR);
117 g_ptr = &floor_ptr->grid_array[y][x];
118 if (is_closed_door(g_ptr->feat)) g_ptr->mimic = feat_glass_wall;
121 get_obj_num_hook = kind_is_potion;
122 place_object(yval, xval, AM_NO_FIXED_ART);
123 floor_ptr->grid_array[yval][xval].info |= (CAVE_ICKY);
127 case 2: /* 1 lite breather + random object */
133 g_ptr = &floor_ptr->grid_array[y1 + 1][x1 + 1];
134 place_inner_grid(g_ptr);
135 g_ptr->feat = feat_glass_wall;
137 g_ptr = &floor_ptr->grid_array[y1 + 1][x2 - 1];
138 place_inner_grid(g_ptr);
139 g_ptr->feat = feat_glass_wall;
141 g_ptr = &floor_ptr->grid_array[y2 - 1][x1 + 1];
142 place_inner_grid(g_ptr);
143 g_ptr->feat = feat_glass_wall;
145 g_ptr = &floor_ptr->grid_array[y2 - 1][x2 - 1];
146 place_inner_grid(g_ptr);
147 g_ptr->feat = feat_glass_wall;
148 get_mon_num_prep(vault_aux_lite, NULL);
150 r_idx = get_mon_num(floor_ptr->dun_level);
151 if (r_idx) place_monster_aux(0, yval, xval, r_idx, 0L);
153 /* Walls around the breather */
154 for (dir1 = 0; dir1 < 8; dir1++)
156 g_ptr = &floor_ptr->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]];
157 place_inner_grid(g_ptr);
158 g_ptr->feat = feat_glass_wall;
161 /* Curtains around the breather */
162 for (y = yval - 1; y <= yval + 1; y++)
164 place_closed_door(floor_ptr, y, xval - 2, DOOR_CURTAIN);
165 place_closed_door(floor_ptr, y, xval + 2, DOOR_CURTAIN);
167 for (x = xval - 1; x <= xval + 1; x++)
169 place_closed_door(floor_ptr, yval - 2, x, DOOR_CURTAIN);
170 place_closed_door(floor_ptr, yval + 2, x, DOOR_CURTAIN);
173 /* Place an object */
174 place_object(yval, xval, AM_NO_FIXED_ART);
175 floor_ptr->grid_array[yval][xval].info |= (CAVE_ICKY);
179 case 3: /* 4 shards breathers + 2 potions */
183 /* Walls around the potion */
184 for (y = yval - 2; y <= yval + 2; y++)
186 g_ptr = &floor_ptr->grid_array[y][xval - 3];
187 place_inner_grid(g_ptr);
188 g_ptr->feat = feat_glass_wall;
189 g_ptr = &floor_ptr->grid_array[y][xval + 3];
190 place_inner_grid(g_ptr);
191 g_ptr->feat = feat_glass_wall;
193 for (x = xval - 2; x <= xval + 2; x++)
195 g_ptr = &floor_ptr->grid_array[yval - 3][x];
196 place_inner_grid(g_ptr);
197 g_ptr->feat = feat_glass_wall;
198 g_ptr = &floor_ptr->grid_array[yval + 3][x];
199 place_inner_grid(g_ptr);
200 g_ptr->feat = feat_glass_wall;
202 for (dir1 = 4; dir1 < 8; dir1++)
204 g_ptr = &floor_ptr->grid_array[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]];
205 place_inner_grid(g_ptr);
206 g_ptr->feat = feat_glass_wall;
208 get_mon_num_prep(vault_aux_shards, NULL);
210 /* Place shard berathers */
211 for (dir1 = 4; dir1 < 8; dir1++)
213 MONRACE_IDX r_idx = get_mon_num(floor_ptr->dun_level);
215 y = yval + ddy_ddd[dir1];
216 x = xval + ddx_ddd[dir1];
217 if (r_idx) place_monster_aux(0, y, x, r_idx, 0L);
220 /* Place two potions */
223 get_obj_num_hook = kind_is_potion;
224 place_object(yval, xval - 1, AM_NO_FIXED_ART);
225 get_obj_num_hook = kind_is_potion;
226 place_object(yval, xval + 1, AM_NO_FIXED_ART);
230 get_obj_num_hook = kind_is_potion;
231 place_object(yval - 1, xval, AM_NO_FIXED_ART);
232 get_obj_num_hook = kind_is_potion;
233 place_object(yval + 1, xval, AM_NO_FIXED_ART);
236 for (y = yval - 2; y <= yval + 2; y++)
237 for (x = xval - 2; x <= xval + 2; x++)
238 floor_ptr->grid_array[y][x].info |= (CAVE_ICKY);
244 msg_print_wizard(CHEAT_DUNGEON, _("ガラスの部屋が生成されました。", "Glass room was generated."));