1 #include "room/rooms-normal.h"
2 #include "dungeon/dungeon-flag-types.h"
3 #include "dungeon/dungeon.h"
6 #include "grid/stair.h"
7 #include "grid/object-placer.h"
9 #include "room/door-definition.h"
10 #include "room/rooms-builder.h"
11 #include "room/space-finder.h"
12 #include "room/vault-builder.h"
13 #include "system/floor-type-definition.h"
16 * @brief タイプ1の部屋…通常可変長方形の部屋を生成する / Type 1 -- normal rectangular rooms
17 * @param player_ptr プレーヤーへの参照ポインタ
20 bool build_type1(player_type *player_ptr, dun_data_type *dd_ptr)
22 POSITION y, x, y2, x2, yval, xval;
23 POSITION y1, x1, xsize, ysize;
29 floor_type *floor_ptr = player_ptr->current_floor_ptr;
30 bool curtain = (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 48 : 512);
32 /* Pick a room size */
41 /* Find and reserve some space in the dungeon. Get center of room. */
42 if (!find_space(player_ptr, dd_ptr, &yval, &xval, ysize + 2, xsize + 2)) {
43 /* Limit to the minimum room size, and retry */
52 /* Find and reserve some space in the dungeon. Get center of room. */
53 if (!find_space(player_ptr, dd_ptr, &yval, &xval, ysize + 2, xsize + 2))
57 /* Choose lite or dark */
58 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
60 /* Get corner values */
61 y1 = yval - ysize / 2;
62 x1 = xval - xsize / 2;
63 y2 = yval + (ysize - 1) / 2;
64 x2 = xval + (xsize - 1) / 2;
66 /* Place a full floor under the room */
67 for (y = y1 - 1; y <= y2 + 1; y++) {
68 for (x = x1 - 1; x <= x2 + 1; x++) {
69 g_ptr = &floor_ptr->grid_array[y][x];
70 place_grid(player_ptr, g_ptr, GB_FLOOR);
71 g_ptr->info |= (CAVE_ROOM);
73 g_ptr->info |= (CAVE_GLOW);
77 /* Walls around the room */
78 for (y = y1 - 1; y <= y2 + 1; y++) {
79 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
80 place_grid(player_ptr, g_ptr, GB_OUTER);
81 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
82 place_grid(player_ptr, g_ptr, GB_OUTER);
84 for (x = x1 - 1; x <= x2 + 1; x++) {
85 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
86 place_grid(player_ptr, g_ptr, GB_OUTER);
87 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
88 place_grid(player_ptr, g_ptr, GB_OUTER);
91 /* Hack -- Occasional curtained room */
92 if (curtain && (y2 - y1 > 2) && (x2 - x1 > 2)) {
93 for (y = y1; y <= y2; y++) {
94 g_ptr = &floor_ptr->grid_array[y][x1];
95 g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
96 g_ptr->info &= ~(CAVE_MASK);
97 g_ptr = &floor_ptr->grid_array[y][x2];
98 g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
99 g_ptr->info &= ~(CAVE_MASK);
101 for (x = x1; x <= x2; x++) {
102 g_ptr = &floor_ptr->grid_array[y1][x];
103 g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
104 g_ptr->info &= ~(CAVE_MASK);
105 g_ptr = &floor_ptr->grid_array[y2][x];
106 g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
107 g_ptr->info &= ~(CAVE_MASK);
111 /* Hack -- Occasional pillar room */
113 for (y = y1; y <= y2; y += 2) {
114 for (x = x1; x <= x2; x += 2) {
115 g_ptr = &floor_ptr->grid_array[y][x];
116 place_grid(player_ptr, g_ptr, GB_INNER);
121 /* Hack -- Occasional room with four pillars */
122 else if (one_in_(20)) {
123 if ((y1 + 4 < y2) && (x1 + 4 < x2)) {
124 g_ptr = &floor_ptr->grid_array[y1 + 1][x1 + 1];
125 place_grid(player_ptr, g_ptr, GB_INNER);
127 g_ptr = &floor_ptr->grid_array[y1 + 1][x2 - 1];
128 place_grid(player_ptr, g_ptr, GB_INNER);
130 g_ptr = &floor_ptr->grid_array[y2 - 1][x1 + 1];
131 place_grid(player_ptr, g_ptr, GB_INNER);
133 g_ptr = &floor_ptr->grid_array[y2 - 1][x2 - 1];
134 place_grid(player_ptr, g_ptr, GB_INNER);
138 /* Hack -- Occasional ragged-edge room */
139 else if (one_in_(50)) {
140 for (y = y1 + 2; y <= y2 - 2; y += 2) {
141 g_ptr = &floor_ptr->grid_array[y][x1];
142 place_grid(player_ptr, g_ptr, GB_INNER);
143 g_ptr = &floor_ptr->grid_array[y][x2];
144 place_grid(player_ptr, g_ptr, GB_INNER);
146 for (x = x1 + 2; x <= x2 - 2; x += 2) {
147 g_ptr = &floor_ptr->grid_array[y1][x];
148 place_grid(player_ptr, g_ptr, GB_INNER);
149 g_ptr = &floor_ptr->grid_array[y2][x];
150 place_grid(player_ptr, g_ptr, GB_INNER);
153 /* Hack -- Occasional divided room */
154 else if (one_in_(50)) {
155 bool curtain2 = (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 2 : 128);
157 if (randint1(100) < 50) {
158 /* Horizontal wall */
159 for (x = x1; x <= x2; x++) {
160 place_bold(player_ptr, yval, x, GB_INNER);
162 floor_ptr->grid_array[yval][x].feat = feat_door[DOOR_CURTAIN].closed;
165 /* Prevent edge of wall from being tunneled */
166 place_bold(player_ptr, yval, x1 - 1, GB_SOLID);
167 place_bold(player_ptr, yval, x2 + 1, GB_SOLID);
170 for (y = y1; y <= y2; y++) {
171 place_bold(player_ptr, y, xval, GB_INNER);
173 floor_ptr->grid_array[y][xval].feat = feat_door[DOOR_CURTAIN].closed;
176 /* Prevent edge of wall from being tunneled */
177 place_bold(player_ptr, y1 - 1, xval, GB_SOLID);
178 place_bold(player_ptr, y2 + 1, xval, GB_SOLID);
181 place_random_door(player_ptr, yval, xval, TRUE);
183 floor_ptr->grid_array[yval][xval].feat = feat_door[DOOR_CURTAIN].closed;
190 * @brief タイプ2の部屋…二重長方形の部屋を生成する / Type 2 -- Overlapping rectangular rooms
191 * @param player_ptr プレーヤーへの参照ポインタ
194 bool build_type2(player_type *player_ptr, dun_data_type *dd_ptr)
196 POSITION y, x, xval, yval;
197 POSITION y1a, x1a, y2a, x2a;
198 POSITION y1b, x1b, y2b, x2b;
202 /* Find and reserve some space in the dungeon. Get center of room. */
203 floor_type *floor_ptr = player_ptr->current_floor_ptr;
204 if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25))
207 /* Choose lite or dark */
208 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
210 /* Determine extents of the first room */
211 y1a = yval - randint1(4);
212 y2a = yval + randint1(3);
213 x1a = xval - randint1(11);
214 x2a = xval + randint1(10);
216 /* Determine extents of the second room */
217 y1b = yval - randint1(3);
218 y2b = yval + randint1(4);
219 x1b = xval - randint1(10);
220 x2b = xval + randint1(11);
222 /* Place a full floor for room "a" */
223 for (y = y1a - 1; y <= y2a + 1; y++) {
224 for (x = x1a - 1; x <= x2a + 1; x++) {
225 g_ptr = &floor_ptr->grid_array[y][x];
226 place_grid(player_ptr, g_ptr, GB_FLOOR);
227 g_ptr->info |= (CAVE_ROOM);
229 g_ptr->info |= (CAVE_GLOW);
233 /* Place a full floor for room "b" */
234 for (y = y1b - 1; y <= y2b + 1; y++) {
235 for (x = x1b - 1; x <= x2b + 1; x++) {
236 g_ptr = &floor_ptr->grid_array[y][x];
237 place_grid(player_ptr, g_ptr, GB_FLOOR);
238 g_ptr->info |= (CAVE_ROOM);
240 g_ptr->info |= (CAVE_GLOW);
244 /* Place the walls around room "a" */
245 for (y = y1a - 1; y <= y2a + 1; y++) {
246 g_ptr = &floor_ptr->grid_array[y][x1a - 1];
247 place_grid(player_ptr, g_ptr, GB_OUTER);
248 g_ptr = &floor_ptr->grid_array[y][x2a + 1];
249 place_grid(player_ptr, g_ptr, GB_OUTER);
251 for (x = x1a - 1; x <= x2a + 1; x++) {
252 g_ptr = &floor_ptr->grid_array[y1a - 1][x];
253 place_grid(player_ptr, g_ptr, GB_OUTER);
254 g_ptr = &floor_ptr->grid_array[y2a + 1][x];
255 place_grid(player_ptr, g_ptr, GB_OUTER);
258 /* Place the walls around room "b" */
259 for (y = y1b - 1; y <= y2b + 1; y++) {
260 g_ptr = &floor_ptr->grid_array[y][x1b - 1];
261 place_grid(player_ptr, g_ptr, GB_OUTER);
262 g_ptr = &floor_ptr->grid_array[y][x2b + 1];
263 place_grid(player_ptr, g_ptr, GB_OUTER);
265 for (x = x1b - 1; x <= x2b + 1; x++) {
266 g_ptr = &floor_ptr->grid_array[y1b - 1][x];
267 place_grid(player_ptr, g_ptr, GB_OUTER);
268 g_ptr = &floor_ptr->grid_array[y2b + 1][x];
269 place_grid(player_ptr, g_ptr, GB_OUTER);
272 /* Replace the floor for room "a" */
273 for (y = y1a; y <= y2a; y++) {
274 for (x = x1a; x <= x2a; x++) {
275 g_ptr = &floor_ptr->grid_array[y][x];
276 place_grid(player_ptr, g_ptr, GB_FLOOR);
280 /* Replace the floor for room "b" */
281 for (y = y1b; y <= y2b; y++) {
282 for (x = x1b; x <= x2b; x++) {
283 g_ptr = &floor_ptr->grid_array[y][x];
284 place_grid(player_ptr, g_ptr, GB_FLOOR);
292 * @brief タイプ3の部屋…十字型の部屋を生成する / Type 3 -- Cross shaped rooms
293 * @param player_ptr プレーヤーへの参照ポインタ
296 * Builds a room at a row, column coordinate\n
298 * Room "a" runs north/south, and Room "b" runs east/east\n
299 * So the "central pillar" runs from x1a, y1b to x2a, y2b.\n
301 * Note that currently, the "center" is always 3x3, but I think that\n
302 * the code below will work (with "bounds checking") for 5x5, or even\n
303 * for unsymetric values like 4x3 or 5x3 or 3x4 or 3x5, or even larger.\n
305 bool build_type3(player_type *player_ptr, dun_data_type *dd_ptr)
307 POSITION y, x, dy, dx, wy, wx;
308 POSITION y1a, x1a, y2a, x2a;
309 POSITION y1b, x1b, y2b, x2b;
314 /* Find and reserve some space in the dungeon. Get center of room. */
315 floor_type *floor_ptr = player_ptr->current_floor_ptr;
316 if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25))
319 /* Choose lite or dark */
320 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
322 /* For now, always 3x3 */
325 /* Pick max vertical size (at most 4) */
326 dy = rand_range(3, 4);
328 /* Pick max horizontal size (at most 15) */
329 dx = rand_range(3, 11);
331 /* Determine extents of the north/south room */
337 /* Determine extents of the east/west room */
343 /* Place a full floor for room "a" */
344 for (y = y1a - 1; y <= y2a + 1; y++) {
345 for (x = x1a - 1; x <= x2a + 1; x++) {
346 g_ptr = &floor_ptr->grid_array[y][x];
347 place_grid(player_ptr, g_ptr, GB_FLOOR);
348 g_ptr->info |= (CAVE_ROOM);
350 g_ptr->info |= (CAVE_GLOW);
354 /* Place a full floor for room "b" */
355 for (y = y1b - 1; y <= y2b + 1; y++) {
356 for (x = x1b - 1; x <= x2b + 1; x++) {
357 g_ptr = &floor_ptr->grid_array[y][x];
358 place_grid(player_ptr, g_ptr, GB_FLOOR);
359 g_ptr->info |= (CAVE_ROOM);
361 g_ptr->info |= (CAVE_GLOW);
365 /* Place the walls around room "a" */
366 for (y = y1a - 1; y <= y2a + 1; y++) {
367 g_ptr = &floor_ptr->grid_array[y][x1a - 1];
368 place_grid(player_ptr, g_ptr, GB_OUTER);
369 g_ptr = &floor_ptr->grid_array[y][x2a + 1];
370 place_grid(player_ptr, g_ptr, GB_OUTER);
372 for (x = x1a - 1; x <= x2a + 1; x++) {
373 g_ptr = &floor_ptr->grid_array[y1a - 1][x];
374 place_grid(player_ptr, g_ptr, GB_OUTER);
375 g_ptr = &floor_ptr->grid_array[y2a + 1][x];
376 place_grid(player_ptr, g_ptr, GB_OUTER);
379 /* Place the walls around room "b" */
380 for (y = y1b - 1; y <= y2b + 1; y++) {
381 g_ptr = &floor_ptr->grid_array[y][x1b - 1];
382 place_grid(player_ptr, g_ptr, GB_OUTER);
383 g_ptr = &floor_ptr->grid_array[y][x2b + 1];
384 place_grid(player_ptr, g_ptr, GB_OUTER);
386 for (x = x1b - 1; x <= x2b + 1; x++) {
387 g_ptr = &floor_ptr->grid_array[y1b - 1][x];
388 place_grid(player_ptr, g_ptr, GB_OUTER);
389 g_ptr = &floor_ptr->grid_array[y2b + 1][x];
390 place_grid(player_ptr, g_ptr, GB_OUTER);
393 /* Replace the floor for room "a" */
394 for (y = y1a; y <= y2a; y++) {
395 for (x = x1a; x <= x2a; x++) {
396 g_ptr = &floor_ptr->grid_array[y][x];
397 place_grid(player_ptr, g_ptr, GB_FLOOR);
401 /* Replace the floor for room "b" */
402 for (y = y1b; y <= y2b; y++) {
403 for (x = x1b; x <= x2b; x++) {
404 g_ptr = &floor_ptr->grid_array[y][x];
405 place_grid(player_ptr, g_ptr, GB_FLOOR);
409 /* Special features (3/4) */
410 switch (randint0(4)) {
411 /* Large solid middle pillar */
413 for (y = y1b; y <= y2b; y++) {
414 for (x = x1a; x <= x2a; x++) {
415 g_ptr = &floor_ptr->grid_array[y][x];
416 place_grid(player_ptr, g_ptr, GB_INNER);
422 /* Inner treasure vault */
424 /* Build the vault */
425 for (y = y1b; y <= y2b; y++) {
426 g_ptr = &floor_ptr->grid_array[y][x1a];
427 place_grid(player_ptr, g_ptr, GB_INNER);
428 g_ptr = &floor_ptr->grid_array[y][x2a];
429 place_grid(player_ptr, g_ptr, GB_INNER);
431 for (x = x1a; x <= x2a; x++) {
432 g_ptr = &floor_ptr->grid_array[y1b][x];
433 place_grid(player_ptr, g_ptr, GB_INNER);
434 g_ptr = &floor_ptr->grid_array[y2b][x];
435 place_grid(player_ptr, g_ptr, GB_INNER);
438 /* Place a secret door on the inner room */
439 switch (randint0(4)) {
441 place_secret_door(player_ptr, y1b, xval, DOOR_DEFAULT);
444 place_secret_door(player_ptr, y2b, xval, DOOR_DEFAULT);
447 place_secret_door(player_ptr, yval, x1a, DOOR_DEFAULT);
450 place_secret_door(player_ptr, yval, x2a, DOOR_DEFAULT);
454 /* Place a treasure in the vault */
455 place_object(player_ptr, yval, xval, 0L);
457 /* Let's guard the treasure well */
458 vault_monsters(player_ptr, yval, xval, randint0(2) + 3);
460 /* Traps naturally */
461 vault_traps(player_ptr, yval, xval, 4, 4, randint0(3) + 2);
468 /* Occasionally pinch the center shut */
470 /* Pinch the east/west sides */
471 for (y = y1b; y <= y2b; y++) {
474 g_ptr = &floor_ptr->grid_array[y][x1a - 1];
475 place_grid(player_ptr, g_ptr, GB_INNER);
476 g_ptr = &floor_ptr->grid_array[y][x2a + 1];
477 place_grid(player_ptr, g_ptr, GB_INNER);
480 /* Pinch the north/south sides */
481 for (x = x1a; x <= x2a; x++) {
484 g_ptr = &floor_ptr->grid_array[y1b - 1][x];
485 place_grid(player_ptr, g_ptr, GB_INNER);
486 g_ptr = &floor_ptr->grid_array[y2b + 1][x];
487 place_grid(player_ptr, g_ptr, GB_INNER);
490 /* Sometimes shut using secret doors */
493 = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256))
495 : ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
497 place_secret_door(player_ptr, yval, x1a - 1, door_type);
498 place_secret_door(player_ptr, yval, x2a + 1, door_type);
499 place_secret_door(player_ptr, y1b - 1, xval, door_type);
500 place_secret_door(player_ptr, y2b + 1, xval, door_type);
504 /* Occasionally put a "plus" in the center */
505 else if (one_in_(3)) {
506 g_ptr = &floor_ptr->grid_array[yval][xval];
507 place_grid(player_ptr, g_ptr, GB_INNER);
508 g_ptr = &floor_ptr->grid_array[y1b][xval];
509 place_grid(player_ptr, g_ptr, GB_INNER);
510 g_ptr = &floor_ptr->grid_array[y2b][xval];
511 place_grid(player_ptr, g_ptr, GB_INNER);
512 g_ptr = &floor_ptr->grid_array[yval][x1a];
513 place_grid(player_ptr, g_ptr, GB_INNER);
514 g_ptr = &floor_ptr->grid_array[yval][x2a];
515 place_grid(player_ptr, g_ptr, GB_INNER);
518 /* Occasionally put a pillar in the center */
519 else if (one_in_(3)) {
520 g_ptr = &floor_ptr->grid_array[yval][xval];
521 place_grid(player_ptr, g_ptr, GB_INNER);
532 * @brief タイプ4の部屋…固定サイズの二重構造部屋を生成する / Type 4 -- Large room with inner features
533 * @param player_ptr プレーヤーへの参照ポインタ
536 * Possible sub-types:\n
537 * 1 - Just an inner room with one door\n
538 * 2 - An inner room within an inner room\n
539 * 3 - An inner room with pillar(s)\n
540 * 4 - Inner room has a maze\n
541 * 5 - A set of four inner rooms\n
543 bool build_type4(player_type *player_ptr, dun_data_type *dd_ptr)
545 POSITION y, x, y1, x1;
546 POSITION y2, x2, tmp, yval, xval;
550 /* Find and reserve some space in the dungeon. Get center of room. */
551 floor_type *floor_ptr = player_ptr->current_floor_ptr;
552 if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25))
555 /* Choose lite or dark */
556 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
564 /* Place a full floor under the room */
565 for (y = y1 - 1; y <= y2 + 1; y++) {
566 for (x = x1 - 1; x <= x2 + 1; x++) {
567 g_ptr = &floor_ptr->grid_array[y][x];
568 place_grid(player_ptr, g_ptr, GB_FLOOR);
569 g_ptr->info |= (CAVE_ROOM);
571 g_ptr->info |= (CAVE_GLOW);
576 for (y = y1 - 1; y <= y2 + 1; y++) {
577 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
578 place_grid(player_ptr, g_ptr, GB_OUTER);
579 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
580 place_grid(player_ptr, g_ptr, GB_OUTER);
582 for (x = x1 - 1; x <= x2 + 1; x++) {
583 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
584 place_grid(player_ptr, g_ptr, GB_OUTER);
585 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
586 place_grid(player_ptr, g_ptr, GB_OUTER);
595 /* The inner walls */
596 for (y = y1 - 1; y <= y2 + 1; y++) {
597 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
598 place_grid(player_ptr, g_ptr, GB_INNER);
599 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
600 place_grid(player_ptr, g_ptr, GB_INNER);
602 for (x = x1 - 1; x <= x2 + 1; x++) {
603 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
604 place_grid(player_ptr, g_ptr, GB_INNER);
605 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
606 place_grid(player_ptr, g_ptr, GB_INNER);
609 /* Inner room variations */
610 switch (randint1(5)) {
611 /* Just an inner room with a monster */
613 /* Place a secret door */
614 switch (randint1(4)) {
616 place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
619 place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
622 place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
625 place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
629 /* Place a monster in the room */
630 vault_monsters(player_ptr, yval, xval, 1);
635 /* Treasure Vault (with a door) */
637 /* Place a secret door */
638 switch (randint1(4)) {
640 place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
643 place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
646 place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
649 place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
653 /* Place another inner room */
654 for (y = yval - 1; y <= yval + 1; y++) {
655 for (x = xval - 1; x <= xval + 1; x++) {
656 if ((x == xval) && (y == yval))
658 g_ptr = &floor_ptr->grid_array[y][x];
659 place_grid(player_ptr, g_ptr, GB_INNER);
663 /* Place a locked door on the inner room */
664 switch (randint1(4)) {
666 place_locked_door(player_ptr, yval - 1, xval);
669 place_locked_door(player_ptr, yval + 1, xval);
672 place_locked_door(player_ptr, yval, xval - 1);
675 place_locked_door(player_ptr, yval, xval + 1);
679 /* Monsters to guard the "treasure" */
680 vault_monsters(player_ptr, yval, xval, randint1(3) + 2);
683 if (randint0(100) < 80) {
684 place_object(player_ptr, yval, xval, 0L);
689 place_random_stairs(player_ptr, yval, xval);
692 /* Traps to protect the treasure */
693 vault_traps(player_ptr, yval, xval, 4, 10, 2 + randint1(3));
698 /* Inner pillar(s). */
700 /* Place a secret door */
701 switch (randint1(4)) {
703 place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
706 place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
709 place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
712 place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
716 /* Large Inner Pillar */
717 for (y = yval - 1; y <= yval + 1; y++) {
718 for (x = xval - 1; x <= xval + 1; x++) {
719 g_ptr = &floor_ptr->grid_array[y][x];
720 place_grid(player_ptr, g_ptr, GB_INNER);
724 /* Occasionally, two more Large Inner Pillars */
727 for (y = yval - 1; y <= yval + 1; y++) {
728 for (x = xval - 5 - tmp; x <= xval - 3 - tmp; x++) {
729 g_ptr = &floor_ptr->grid_array[y][x];
730 place_grid(player_ptr, g_ptr, GB_INNER);
732 for (x = xval + 3 + tmp; x <= xval + 5 + tmp; x++) {
733 g_ptr = &floor_ptr->grid_array[y][x];
734 place_grid(player_ptr, g_ptr, GB_INNER);
739 /* Occasionally, some Inner rooms */
741 int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256))
743 : ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
745 /* Long horizontal walls */
746 for (x = xval - 5; x <= xval + 5; x++) {
747 g_ptr = &floor_ptr->grid_array[yval - 1][x];
748 place_grid(player_ptr, g_ptr, GB_INNER);
749 g_ptr = &floor_ptr->grid_array[yval + 1][x];
750 place_grid(player_ptr, g_ptr, GB_INNER);
753 /* Close off the left/right edges */
754 g_ptr = &floor_ptr->grid_array[yval][xval - 5];
755 place_grid(player_ptr, g_ptr, GB_INNER);
756 g_ptr = &floor_ptr->grid_array[yval][xval + 5];
757 place_grid(player_ptr, g_ptr, GB_INNER);
759 /* Secret doors (random top/bottom) */
760 place_secret_door(player_ptr, yval - 3 + (randint1(2) * 2), xval - 3, door_type);
761 place_secret_door(player_ptr, yval - 3 + (randint1(2) * 2), xval + 3, door_type);
764 vault_monsters(player_ptr, yval, xval - 2, randint1(2));
765 vault_monsters(player_ptr, yval, xval + 2, randint1(2));
769 place_object(player_ptr, yval, xval - 2, 0L);
771 place_object(player_ptr, yval, xval + 2, 0L);
779 /* Place a secret door */
780 switch (randint1(4)) {
782 place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
785 place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
788 place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
791 place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
795 /* Maze (really a checkerboard) */
796 for (y = y1; y <= y2; y++) {
797 for (x = x1; x <= x2; x++) {
799 g_ptr = &floor_ptr->grid_array[y][x];
800 place_grid(player_ptr, g_ptr, GB_INNER);
805 /* Monsters just love mazes. */
806 vault_monsters(player_ptr, yval, xval - 5, randint1(3));
807 vault_monsters(player_ptr, yval, xval + 5, randint1(3));
809 /* Traps make them entertaining. */
810 vault_traps(player_ptr, yval, xval - 3, 2, 8, randint1(3));
811 vault_traps(player_ptr, yval, xval + 3, 2, 8, randint1(3));
813 /* Mazes should have some treasure too. */
814 vault_objects(player_ptr, yval, xval, 3);
819 /* Four small rooms. */
821 int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256))
823 : ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
826 for (y = y1; y <= y2; y++) {
827 g_ptr = &floor_ptr->grid_array[y][xval];
828 place_grid(player_ptr, g_ptr, GB_INNER);
830 for (x = x1; x <= x2; x++) {
831 g_ptr = &floor_ptr->grid_array[yval][x];
832 place_grid(player_ptr, g_ptr, GB_INNER);
835 /* Doors into the rooms */
836 if (randint0(100) < 50) {
837 int i = randint1(10);
838 place_secret_door(player_ptr, y1 - 1, xval - i, door_type);
839 place_secret_door(player_ptr, y1 - 1, xval + i, door_type);
840 place_secret_door(player_ptr, y2 + 1, xval - i, door_type);
841 place_secret_door(player_ptr, y2 + 1, xval + i, door_type);
844 place_secret_door(player_ptr, yval + i, x1 - 1, door_type);
845 place_secret_door(player_ptr, yval - i, x1 - 1, door_type);
846 place_secret_door(player_ptr, yval + i, x2 + 1, door_type);
847 place_secret_door(player_ptr, yval - i, x2 + 1, door_type);
850 /* Treasure, centered at the center of the cross */
851 vault_objects(player_ptr, yval, xval, 2 + randint1(2));
853 /* Gotta have some monsters. */
854 vault_monsters(player_ptr, yval + 1, xval - 4, randint1(4));
855 vault_monsters(player_ptr, yval + 1, xval + 4, randint1(4));
856 vault_monsters(player_ptr, yval - 1, xval - 4, randint1(4));
857 vault_monsters(player_ptr, yval - 1, xval + 4, randint1(4));
867 * @brief タイプ11の部屋…円形部屋の生成 / Type 11 -- Build an vertical oval room.
868 * @param player_ptr プレーヤーへの参照ポインタ
871 * For every grid in the possible square, check the distance.\n
872 * If it's less than the radius, make it a room square.\n
874 * When done fill from the inside to find the walls,\n
876 bool build_type11(player_type *player_ptr, dun_data_type *dd_ptr)
878 POSITION rad, x, y, x0, y0;
881 /* Occasional light */
882 floor_type *floor_ptr = player_ptr->current_floor_ptr;
883 if ((randint1(floor_ptr->dun_level) <= 15) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
888 /* Find and reserve some space in the dungeon. Get center of room. */
889 if (!find_space(player_ptr, dd_ptr, &y0, &x0, rad * 2 + 1, rad * 2 + 1))
892 /* Make circular floor */
893 for (x = x0 - rad; x <= x0 + rad; x++) {
894 for (y = y0 - rad; y <= y0 + rad; y++) {
895 if (distance(y0, x0, y, x) <= rad - 1) {
896 /* inside- so is floor */
897 place_bold(player_ptr, y, x, GB_FLOOR);
898 } else if (distance(y0, x0, y, x) <= rad + 1) {
899 /* make granite outside so on_defeat_arena_monster works */
900 place_bold(player_ptr, y, x, GB_EXTRA);
905 /* Find visible outer walls and set to be FEAT_OUTER */
906 add_outer_wall(player_ptr, x0, y0, light, x0 - rad, y0 - rad, x0 + rad, y0 + rad);
912 * @brief タイプ12の部屋…ドーム型部屋の生成 / Type 12 -- Build crypt room.
913 * @param player_ptr プレーヤーへの参照ポインタ
916 * For every grid in the possible square, check the (fake) distance.\n
917 * If it's less than the radius, make it a room square.\n
919 * When done fill from the inside to find the walls,\n
921 bool build_type12(player_type *player_ptr, dun_data_type *dd_ptr)
923 POSITION rad, x, y, x0, y0;
925 bool emptyflag = TRUE;
927 /* Make a random metric */
928 POSITION h1, h2, h3, h4;
929 h1 = randint1(32) - 16;
932 h4 = randint1(32) - 16;
934 /* Occasional light */
935 floor_type *floor_ptr = player_ptr->current_floor_ptr;
936 if ((randint1(floor_ptr->dun_level) <= 5) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
941 /* Find and reserve some space in the dungeon. Get center of room. */
942 if (!find_space(player_ptr, dd_ptr, &y0, &x0, rad * 2 + 3, rad * 2 + 3))
946 for (x = x0 - rad; x <= x0 + rad; x++) {
947 for (y = y0 - rad; y <= y0 + rad; y++) {
948 /* clear room flag */
949 floor_ptr->grid_array[y][x].info &= ~(CAVE_ROOM);
951 if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1) {
952 /* inside - so is floor */
953 place_bold(player_ptr, y, x, GB_FLOOR);
954 } else if (distance(y0, x0, y, x) < 3) {
955 place_bold(player_ptr, y, x, GB_FLOOR);
957 /* make granite outside so on_defeat_arena_monster works */
958 place_bold(player_ptr, y, x, GB_EXTRA);
961 /* proper boundary for on_defeat_arena_monster */
962 if (((y + rad) == y0) || ((y - rad) == y0) || ((x + rad) == x0) || ((x - rad) == x0)) {
963 place_bold(player_ptr, y, x, GB_EXTRA);
968 /* Find visible outer walls and set to be FEAT_OUTER */
969 add_outer_wall(player_ptr, x0, y0, light, x0 - rad - 1, y0 - rad - 1, x0 + rad + 1, y0 + rad + 1);
971 /* Check to see if there is room for an inner vault */
972 for (x = x0 - 2; x <= x0 + 2; x++) {
973 for (y = y0 - 2; y <= y0 + 2; y++) {
974 if (!is_floor_bold(floor_ptr, y, x)) {
975 /* Wall in the way */
981 if (emptyflag && one_in_(2)) {
982 /* Build the vault */
983 build_small_room(player_ptr, x0, y0);
985 /* Place a treasure in the vault */
986 place_object(player_ptr, y0, x0, 0L);
988 /* Let's guard the treasure well */
989 vault_monsters(player_ptr, y0, x0, randint0(2) + 3);
991 /* Traps naturally */
992 vault_traps(player_ptr, y0, x0, 4, 4, randint0(3) + 2);