11 * @brief タイプ1の部屋…通常可変長方形の部屋を生成する / Type 1 -- normal rectangular rooms
14 bool build_type1(floor_type *floor_ptr)
16 POSITION y, x, y2, x2, yval, xval;
17 POSITION y1, x1, xsize, ysize;
23 bool curtain = (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
24 one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 48 : 512);
26 /* Pick a room size */
35 /* Find and reserve some space in the dungeon. Get center of room. */
36 if (!find_space(&yval, &xval, ysize + 2, xsize + 2))
38 /* Limit to the minimum room size, and retry */
47 /* Find and reserve some space in the dungeon. Get center of room. */
48 if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
51 /* Choose lite or dark */
52 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
55 /* Get corner values */
56 y1 = yval - ysize / 2;
57 x1 = xval - xsize / 2;
58 y2 = yval + (ysize - 1) / 2;
59 x2 = xval + (xsize - 1) / 2;
62 /* Place a full floor under the room */
63 for (y = y1 - 1; y <= y2 + 1; y++)
65 for (x = x1 - 1; x <= x2 + 1; x++)
67 g_ptr = &floor_ptr->grid_array[y][x];
68 place_floor_grid(g_ptr);
69 g_ptr->info |= (CAVE_ROOM);
70 if (light) g_ptr->info |= (CAVE_GLOW);
74 /* Walls around the room */
75 for (y = y1 - 1; y <= y2 + 1; y++)
77 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
78 place_outer_grid(g_ptr);
79 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
80 place_outer_grid(g_ptr);
82 for (x = x1 - 1; x <= x2 + 1; x++)
84 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
85 place_outer_grid(g_ptr);
86 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
87 place_outer_grid(g_ptr);
91 /* Hack -- Occasional curtained room */
92 if (curtain && (y2 - y1 > 2) && (x2 - x1 > 2))
94 for (y = y1; y <= y2; y++)
96 g_ptr = &floor_ptr->grid_array[y][x1];
97 g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
98 g_ptr->info &= ~(CAVE_MASK);
99 g_ptr = &floor_ptr->grid_array[y][x2];
100 g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
101 g_ptr->info &= ~(CAVE_MASK);
103 for (x = x1; x <= x2; x++)
105 g_ptr = &floor_ptr->grid_array[y1][x];
106 g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
107 g_ptr->info &= ~(CAVE_MASK);
108 g_ptr = &floor_ptr->grid_array[y2][x];
109 g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
110 g_ptr->info &= ~(CAVE_MASK);
115 /* Hack -- Occasional pillar room */
118 for (y = y1; y <= y2; y += 2)
120 for (x = x1; x <= x2; x += 2)
122 g_ptr = &floor_ptr->grid_array[y][x];
123 place_inner_grid(g_ptr);
128 /* Hack -- Occasional room with four pillars */
129 else if (one_in_(20))
131 if ((y1 + 4 < y2) && (x1 + 4 < x2))
133 g_ptr = &floor_ptr->grid_array[y1 + 1][x1 + 1];
134 place_inner_grid(g_ptr);
136 g_ptr = &floor_ptr->grid_array[y1 + 1][x2 - 1];
137 place_inner_grid(g_ptr);
139 g_ptr = &floor_ptr->grid_array[y2 - 1][x1 + 1];
140 place_inner_grid(g_ptr);
142 g_ptr = &floor_ptr->grid_array[y2 - 1][x2 - 1];
143 place_inner_grid(g_ptr);
147 /* Hack -- Occasional ragged-edge room */
148 else if (one_in_(50))
150 for (y = y1 + 2; y <= y2 - 2; y += 2)
152 g_ptr = &floor_ptr->grid_array[y][x1];
153 place_inner_grid(g_ptr);
154 g_ptr = &floor_ptr->grid_array[y][x2];
155 place_inner_grid(g_ptr);
157 for (x = x1 + 2; x <= x2 - 2; x += 2)
159 g_ptr = &floor_ptr->grid_array[y1][x];
160 place_inner_grid(g_ptr);
161 g_ptr = &floor_ptr->grid_array[y2][x];
162 place_inner_grid(g_ptr);
165 /* Hack -- Occasional divided room */
166 else if (one_in_(50))
168 bool curtain2 = (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
169 one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 2 : 128);
171 if (randint1(100) < 50)
173 /* Horizontal wall */
174 for (x = x1; x <= x2; x++)
176 place_inner_bold(floor_ptr, yval, x);
177 if (curtain2) floor_ptr->grid_array[yval][x].feat = feat_door[DOOR_CURTAIN].closed;
180 /* Prevent edge of wall from being tunneled */
181 place_solid_bold(yval, x1 - 1);
182 place_solid_bold(yval, x2 + 1);
187 for (y = y1; y <= y2; y++)
189 place_inner_bold(floor_ptr, y, xval);
190 if (curtain2) floor_ptr->grid_array[y][xval].feat = feat_door[DOOR_CURTAIN].closed;
193 /* Prevent edge of wall from being tunneled */
194 place_solid_bold(y1 - 1, xval);
195 place_solid_bold(y2 + 1, xval);
198 place_random_door(floor_ptr, yval, xval, TRUE);
199 if (curtain2) floor_ptr->grid_array[yval][xval].feat = feat_door[DOOR_CURTAIN].closed;
206 * @brief タイプ2の部屋…二重長方形の部屋を生成する / Type 2 -- Overlapping rectangular rooms
209 bool build_type2(floor_type *floor_ptr)
211 POSITION y, x, xval, yval;
212 POSITION y1a, x1a, y2a, x2a;
213 POSITION y1b, x1b, y2b, x2b;
217 /* Find and reserve some space in the dungeon. Get center of room. */
218 if (!find_space(&yval, &xval, 11, 25)) return FALSE;
220 /* Choose lite or dark */
221 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
223 /* Determine extents of the first room */
224 y1a = yval - randint1(4);
225 y2a = yval + randint1(3);
226 x1a = xval - randint1(11);
227 x2a = xval + randint1(10);
229 /* Determine extents of the second room */
230 y1b = yval - randint1(3);
231 y2b = yval + randint1(4);
232 x1b = xval - randint1(10);
233 x2b = xval + randint1(11);
236 /* Place a full floor for room "a" */
237 for (y = y1a - 1; y <= y2a + 1; y++)
239 for (x = x1a - 1; x <= x2a + 1; x++)
241 g_ptr = &floor_ptr->grid_array[y][x];
242 place_floor_grid(g_ptr);
243 g_ptr->info |= (CAVE_ROOM);
244 if (light) g_ptr->info |= (CAVE_GLOW);
248 /* Place a full floor for room "b" */
249 for (y = y1b - 1; y <= y2b + 1; y++)
251 for (x = x1b - 1; x <= x2b + 1; x++)
253 g_ptr = &floor_ptr->grid_array[y][x];
254 place_floor_grid(g_ptr);
255 g_ptr->info |= (CAVE_ROOM);
256 if (light) g_ptr->info |= (CAVE_GLOW);
261 /* Place the walls around room "a" */
262 for (y = y1a - 1; y <= y2a + 1; y++)
264 g_ptr = &floor_ptr->grid_array[y][x1a - 1];
265 place_outer_grid(g_ptr);
266 g_ptr = &floor_ptr->grid_array[y][x2a + 1];
267 place_outer_grid(g_ptr);
269 for (x = x1a - 1; x <= x2a + 1; x++)
271 g_ptr = &floor_ptr->grid_array[y1a - 1][x];
272 place_outer_grid(g_ptr);
273 g_ptr = &floor_ptr->grid_array[y2a + 1][x];
274 place_outer_grid(g_ptr);
277 /* Place the walls around room "b" */
278 for (y = y1b - 1; y <= y2b + 1; y++)
280 g_ptr = &floor_ptr->grid_array[y][x1b - 1];
281 place_outer_grid(g_ptr);
282 g_ptr = &floor_ptr->grid_array[y][x2b + 1];
283 place_outer_grid(g_ptr);
285 for (x = x1b - 1; x <= x2b + 1; x++)
287 g_ptr = &floor_ptr->grid_array[y1b - 1][x];
288 place_outer_grid(g_ptr);
289 g_ptr = &floor_ptr->grid_array[y2b + 1][x];
290 place_outer_grid(g_ptr);
295 /* Replace the floor for room "a" */
296 for (y = y1a; y <= y2a; y++)
298 for (x = x1a; x <= x2a; x++)
300 g_ptr = &floor_ptr->grid_array[y][x];
301 place_floor_grid(g_ptr);
305 /* Replace the floor for room "b" */
306 for (y = y1b; y <= y2b; y++)
308 for (x = x1b; x <= x2b; x++)
310 g_ptr = &floor_ptr->grid_array[y][x];
311 place_floor_grid(g_ptr);
319 * @brief タイプ3の部屋…十字型の部屋を生成する / Type 3 -- Cross shaped rooms
322 * Builds a room at a row, column coordinate\n
324 * Room "a" runs north/south, and Room "b" runs east/east\n
325 * So the "central pillar" runs from x1a, y1b to x2a, y2b.\n
327 * Note that currently, the "center" is always 3x3, but I think that\n
328 * the code below will work (with "bounds checking") for 5x5, or even\n
329 * for unsymetric values like 4x3 or 5x3 or 3x4 or 3x5, or even larger.\n
331 bool build_type3(floor_type *floor_ptr)
333 POSITION y, x, dy, dx, wy, wx;
334 POSITION y1a, x1a, y2a, x2a;
335 POSITION y1b, x1b, y2b, x2b;
341 /* Find and reserve some space in the dungeon. Get center of room. */
342 if (!find_space(&yval, &xval, 11, 25)) return FALSE;
345 /* Choose lite or dark */
346 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
348 /* For now, always 3x3 */
351 /* Pick max vertical size (at most 4) */
352 dy = rand_range(3, 4);
354 /* Pick max horizontal size (at most 15) */
355 dx = rand_range(3, 11);
358 /* Determine extents of the north/south room */
364 /* Determine extents of the east/west room */
371 /* Place a full floor for room "a" */
372 for (y = y1a - 1; y <= y2a + 1; y++)
374 for (x = x1a - 1; x <= x2a + 1; x++)
376 g_ptr = &floor_ptr->grid_array[y][x];
377 place_floor_grid(g_ptr);
378 g_ptr->info |= (CAVE_ROOM);
379 if (light) g_ptr->info |= (CAVE_GLOW);
383 /* Place a full floor for room "b" */
384 for (y = y1b - 1; y <= y2b + 1; y++)
386 for (x = x1b - 1; x <= x2b + 1; x++)
388 g_ptr = &floor_ptr->grid_array[y][x];
389 place_floor_grid(g_ptr);
390 g_ptr->info |= (CAVE_ROOM);
391 if (light) g_ptr->info |= (CAVE_GLOW);
396 /* Place the walls around room "a" */
397 for (y = y1a - 1; y <= y2a + 1; y++)
399 g_ptr = &floor_ptr->grid_array[y][x1a - 1];
400 place_outer_grid(g_ptr);
401 g_ptr = &floor_ptr->grid_array[y][x2a + 1];
402 place_outer_grid(g_ptr);
404 for (x = x1a - 1; x <= x2a + 1; x++)
406 g_ptr = &floor_ptr->grid_array[y1a - 1][x];
407 place_outer_grid(g_ptr);
408 g_ptr = &floor_ptr->grid_array[y2a + 1][x];
409 place_outer_grid(g_ptr);
412 /* Place the walls around room "b" */
413 for (y = y1b - 1; y <= y2b + 1; y++)
415 g_ptr = &floor_ptr->grid_array[y][x1b - 1];
416 place_outer_grid(g_ptr);
417 g_ptr = &floor_ptr->grid_array[y][x2b + 1];
418 place_outer_grid(g_ptr);
420 for (x = x1b - 1; x <= x2b + 1; x++)
422 g_ptr = &floor_ptr->grid_array[y1b - 1][x];
423 place_outer_grid(g_ptr);
424 g_ptr = &floor_ptr->grid_array[y2b + 1][x];
425 place_outer_grid(g_ptr);
429 /* Replace the floor for room "a" */
430 for (y = y1a; y <= y2a; y++)
432 for (x = x1a; x <= x2a; x++)
434 g_ptr = &floor_ptr->grid_array[y][x];
435 place_floor_grid(g_ptr);
439 /* Replace the floor for room "b" */
440 for (y = y1b; y <= y2b; y++)
442 for (x = x1b; x <= x2b; x++)
444 g_ptr = &floor_ptr->grid_array[y][x];
445 place_floor_grid(g_ptr);
451 /* Special features (3/4) */
454 /* Large solid middle pillar */
457 for (y = y1b; y <= y2b; y++)
459 for (x = x1a; x <= x2a; x++)
461 g_ptr = &floor_ptr->grid_array[y][x];
462 place_inner_grid(g_ptr);
468 /* Inner treasure vault */
471 /* Build the vault */
472 for (y = y1b; y <= y2b; y++)
474 g_ptr = &floor_ptr->grid_array[y][x1a];
475 place_inner_grid(g_ptr);
476 g_ptr = &floor_ptr->grid_array[y][x2a];
477 place_inner_grid(g_ptr);
479 for (x = x1a; x <= x2a; x++)
481 g_ptr = &floor_ptr->grid_array[y1b][x];
482 place_inner_grid(g_ptr);
483 g_ptr = &floor_ptr->grid_array[y2b][x];
484 place_inner_grid(g_ptr);
487 /* Place a secret door on the inner room */
490 case 0: place_secret_door(floor_ptr, y1b, xval, DOOR_DEFAULT); break;
491 case 1: place_secret_door(floor_ptr, y2b, xval, DOOR_DEFAULT); break;
492 case 2: place_secret_door(floor_ptr, yval, x1a, DOOR_DEFAULT); break;
493 case 3: place_secret_door(floor_ptr, yval, x2a, DOOR_DEFAULT); break;
496 /* Place a treasure in the vault */
497 place_object(yval, xval, 0L);
499 /* Let's guard the treasure well */
500 vault_monsters(floor_ptr, yval, xval, randint0(2) + 3);
502 /* Traps naturally */
503 vault_traps(yval, xval, 4, 4, randint0(3) + 2);
511 /* Occasionally pinch the center shut */
514 /* Pinch the east/west sides */
515 for (y = y1b; y <= y2b; y++)
517 if (y == yval) continue;
518 g_ptr = &floor_ptr->grid_array[y][x1a - 1];
519 place_inner_grid(g_ptr);
520 g_ptr = &floor_ptr->grid_array[y][x2a + 1];
521 place_inner_grid(g_ptr);
524 /* Pinch the north/south sides */
525 for (x = x1a; x <= x2a; x++)
527 if (x == xval) continue;
528 g_ptr = &floor_ptr->grid_array[y1b - 1][x];
529 place_inner_grid(g_ptr);
530 g_ptr = &floor_ptr->grid_array[y2b + 1][x];
531 place_inner_grid(g_ptr);
534 /* Sometimes shut using secret doors */
537 int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
538 one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
539 ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
541 place_secret_door(floor_ptr, yval, x1a - 1, door_type);
542 place_secret_door(floor_ptr, yval, x2a + 1, door_type);
543 place_secret_door(floor_ptr, y1b - 1, xval, door_type);
544 place_secret_door(floor_ptr, y2b + 1, xval, door_type);
548 /* Occasionally put a "plus" in the center */
551 g_ptr = &floor_ptr->grid_array[yval][xval];
552 place_inner_grid(g_ptr);
553 g_ptr = &floor_ptr->grid_array[y1b][xval];
554 place_inner_grid(g_ptr);
555 g_ptr = &floor_ptr->grid_array[y2b][xval];
556 place_inner_grid(g_ptr);
557 g_ptr = &floor_ptr->grid_array[yval][x1a];
558 place_inner_grid(g_ptr);
559 g_ptr = &floor_ptr->grid_array[yval][x2a];
560 place_inner_grid(g_ptr);
563 /* Occasionally put a pillar in the center */
566 g_ptr = &floor_ptr->grid_array[yval][xval];
567 place_inner_grid(g_ptr);
578 * @brief タイプ4の部屋…固定サイズの二重構造部屋を生成する / Type 4 -- Large room with inner features
581 * Possible sub-types:\n
582 * 1 - Just an inner room with one door\n
583 * 2 - An inner room within an inner room\n
584 * 3 - An inner room with pillar(s)\n
585 * 4 - Inner room has a maze\n
586 * 5 - A set of four inner rooms\n
588 bool build_type4(floor_type *floor_ptr)
590 POSITION y, x, y1, x1;
591 POSITION y2, x2, tmp, yval, xval;
596 /* Find and reserve some space in the dungeon. Get center of room. */
597 if (!find_space(&yval, &xval, 11, 25)) return FALSE;
599 /* Choose lite or dark */
600 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
608 /* Place a full floor under the room */
609 for (y = y1 - 1; y <= y2 + 1; y++)
611 for (x = x1 - 1; x <= x2 + 1; x++)
613 g_ptr = &floor_ptr->grid_array[y][x];
614 place_floor_grid(g_ptr);
615 g_ptr->info |= (CAVE_ROOM);
616 if (light) g_ptr->info |= (CAVE_GLOW);
621 for (y = y1 - 1; y <= y2 + 1; y++)
623 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
624 place_outer_grid(g_ptr);
625 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
626 place_outer_grid(g_ptr);
628 for (x = x1 - 1; x <= x2 + 1; x++)
630 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
631 place_outer_grid(g_ptr);
632 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
633 place_outer_grid(g_ptr);
643 /* The inner walls */
644 for (y = y1 - 1; y <= y2 + 1; y++)
646 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
647 place_inner_grid(g_ptr);
648 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
649 place_inner_grid(g_ptr);
651 for (x = x1 - 1; x <= x2 + 1; x++)
653 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
654 place_inner_grid(g_ptr);
655 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
656 place_inner_grid(g_ptr);
660 /* Inner room variations */
663 /* Just an inner room with a monster */
666 /* Place a secret door */
669 case 1: place_secret_door(floor_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
670 case 2: place_secret_door(floor_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
671 case 3: place_secret_door(floor_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
672 case 4: place_secret_door(floor_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
675 /* Place a monster in the room */
676 vault_monsters(floor_ptr, yval, xval, 1);
681 /* Treasure Vault (with a door) */
684 /* Place a secret door */
687 case 1: place_secret_door(floor_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
688 case 2: place_secret_door(floor_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
689 case 3: place_secret_door(floor_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
690 case 4: place_secret_door(floor_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
693 /* Place another inner room */
694 for (y = yval - 1; y <= yval + 1; y++)
696 for (x = xval - 1; x <= xval + 1; x++)
698 if ((x == xval) && (y == yval)) continue;
699 g_ptr = &floor_ptr->grid_array[y][x];
700 place_inner_grid(g_ptr);
704 /* Place a locked door on the inner room */
707 case 1: place_locked_door(floor_ptr, yval - 1, xval); break;
708 case 2: place_locked_door(floor_ptr, yval + 1, xval); break;
709 case 3: place_locked_door(floor_ptr, yval, xval - 1); break;
710 case 4: place_locked_door(floor_ptr, yval, xval + 1); break;
713 /* Monsters to guard the "treasure" */
714 vault_monsters(floor_ptr, yval, xval, randint1(3) + 2);
717 if (randint0(100) < 80)
719 place_object(yval, xval, 0L);
725 place_random_stairs(floor_ptr, yval, xval);
728 /* Traps to protect the treasure */
729 vault_traps(yval, xval, 4, 10, 2 + randint1(3));
734 /* Inner pillar(s). */
737 /* Place a secret door */
740 case 1: place_secret_door(floor_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
741 case 2: place_secret_door(floor_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
742 case 3: place_secret_door(floor_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
743 case 4: place_secret_door(floor_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
746 /* Large Inner Pillar */
747 for (y = yval - 1; y <= yval + 1; y++)
749 for (x = xval - 1; x <= xval + 1; x++)
751 g_ptr = &floor_ptr->grid_array[y][x];
752 place_inner_grid(g_ptr);
756 /* Occasionally, two more Large Inner Pillars */
760 for (y = yval - 1; y <= yval + 1; y++)
762 for (x = xval - 5 - tmp; x <= xval - 3 - tmp; x++)
764 g_ptr = &floor_ptr->grid_array[y][x];
765 place_inner_grid(g_ptr);
767 for (x = xval + 3 + tmp; x <= xval + 5 + tmp; x++)
769 g_ptr = &floor_ptr->grid_array[y][x];
770 place_inner_grid(g_ptr);
775 /* Occasionally, some Inner rooms */
778 int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
779 one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
780 ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
782 /* Long horizontal walls */
783 for (x = xval - 5; x <= xval + 5; x++)
785 g_ptr = &floor_ptr->grid_array[yval - 1][x];
786 place_inner_grid(g_ptr);
787 g_ptr = &floor_ptr->grid_array[yval + 1][x];
788 place_inner_grid(g_ptr);
791 /* Close off the left/right edges */
792 g_ptr = &floor_ptr->grid_array[yval][xval - 5];
793 place_inner_grid(g_ptr);
794 g_ptr = &floor_ptr->grid_array[yval][xval + 5];
795 place_inner_grid(g_ptr);
797 /* Secret doors (random top/bottom) */
798 place_secret_door(floor_ptr, yval - 3 + (randint1(2) * 2), xval - 3, door_type);
799 place_secret_door(floor_ptr, yval - 3 + (randint1(2) * 2), xval + 3, door_type);
802 vault_monsters(floor_ptr, yval, xval - 2, randint1(2));
803 vault_monsters(floor_ptr, yval, xval + 2, randint1(2));
806 if (one_in_(3)) place_object(yval, xval - 2, 0L);
807 if (one_in_(3)) place_object(yval, xval + 2, 0L);
816 /* Place a secret door */
819 case 1: place_secret_door(floor_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
820 case 2: place_secret_door(floor_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
821 case 3: place_secret_door(floor_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
822 case 4: place_secret_door(floor_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
825 /* Maze (really a checkerboard) */
826 for (y = y1; y <= y2; y++)
828 for (x = x1; x <= x2; x++)
832 g_ptr = &floor_ptr->grid_array[y][x];
833 place_inner_grid(g_ptr);
838 /* Monsters just love mazes. */
839 vault_monsters(floor_ptr, yval, xval - 5, randint1(3));
840 vault_monsters(floor_ptr, yval, xval + 5, randint1(3));
842 /* Traps make them entertaining. */
843 vault_traps(yval, xval - 3, 2, 8, randint1(3));
844 vault_traps(yval, xval + 3, 2, 8, randint1(3));
846 /* Mazes should have some treasure too. */
847 vault_objects(yval, xval, 3);
852 /* Four small rooms. */
855 int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
856 one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
857 ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
860 for (y = y1; y <= y2; y++)
862 g_ptr = &floor_ptr->grid_array[y][xval];
863 place_inner_grid(g_ptr);
865 for (x = x1; x <= x2; x++)
867 g_ptr = &floor_ptr->grid_array[yval][x];
868 place_inner_grid(g_ptr);
871 /* Doors into the rooms */
872 if (randint0(100) < 50)
874 int i = randint1(10);
875 place_secret_door(floor_ptr, y1 - 1, xval - i, door_type);
876 place_secret_door(floor_ptr, y1 - 1, xval + i, door_type);
877 place_secret_door(floor_ptr, y2 + 1, xval - i, door_type);
878 place_secret_door(floor_ptr, y2 + 1, xval + i, door_type);
883 place_secret_door(floor_ptr, yval + i, x1 - 1, door_type);
884 place_secret_door(floor_ptr, yval - i, x1 - 1, door_type);
885 place_secret_door(floor_ptr, yval + i, x2 + 1, door_type);
886 place_secret_door(floor_ptr, yval - i, x2 + 1, door_type);
889 /* Treasure, centered at the center of the cross */
890 vault_objects(yval, xval, 2 + randint1(2));
892 /* Gotta have some monsters. */
893 vault_monsters(floor_ptr, yval + 1, xval - 4, randint1(4));
894 vault_monsters(floor_ptr, yval + 1, xval + 4, randint1(4));
895 vault_monsters(floor_ptr, yval - 1, xval - 4, randint1(4));
896 vault_monsters(floor_ptr, yval - 1, xval + 4, randint1(4));
907 * @brief タイプ11の部屋…円形部屋の生成 / Type 11 -- Build an vertical oval room.
910 * For every grid in the possible square, check the distance.\n
911 * If it's less than the radius, make it a room square.\n
913 * When done fill from the inside to find the walls,\n
915 bool build_type11(floor_type *floor_ptr)
917 POSITION rad, x, y, x0, y0;
920 /* Occasional light */
921 if ((randint1(floor_ptr->dun_level) <= 15) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
925 /* Find and reserve some space in the dungeon. Get center of room. */
926 if (!find_space(&y0, &x0, rad * 2 + 1, rad * 2 + 1)) return FALSE;
928 /* Make circular floor */
929 for (x = x0 - rad; x <= x0 + rad; x++)
931 for (y = y0 - rad; y <= y0 + rad; y++)
933 if (distance(y0, x0, y, x) <= rad - 1)
935 /* inside- so is floor */
936 place_floor_bold(floor_ptr, y, x);
938 else if (distance(y0, x0, y, x) <= rad + 1)
940 /* make granite outside so arena works */
941 place_extra_bold(floor_ptr, y, x);
946 /* Find visible outer walls and set to be FEAT_OUTER */
947 add_outer_wall(floor_ptr, x0, y0, light, x0 - rad, y0 - rad, x0 + rad, y0 + rad);
954 * @brief タイプ12の部屋…ドーム型部屋の生成 / Type 12 -- Build crypt room.
957 * For every grid in the possible square, check the (fake) distance.\n
958 * If it's less than the radius, make it a room square.\n
960 * When done fill from the inside to find the walls,\n
962 bool build_type12(floor_type *floor_ptr)
964 POSITION rad, x, y, x0, y0;
966 bool emptyflag = TRUE;
968 /* Make a random metric */
969 POSITION h1, h2, h3, h4;
970 h1 = randint1(32) - 16;
973 h4 = randint1(32) - 16;
975 /* Occasional light */
976 if ((randint1(floor_ptr->dun_level) <= 5) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
980 /* Find and reserve some space in the dungeon. Get center of room. */
981 if (!find_space(&y0, &x0, rad * 2 + 3, rad * 2 + 3)) return FALSE;
984 for (x = x0 - rad; x <= x0 + rad; x++)
986 for (y = y0 - rad; y <= y0 + rad; y++)
988 /* clear room flag */
989 floor_ptr->grid_array[y][x].info &= ~(CAVE_ROOM);
991 if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1)
993 /* inside - so is floor */
994 place_floor_bold(floor_ptr, y, x);
996 else if (distance(y0, x0, y, x) < 3)
998 place_floor_bold(floor_ptr, y, x);
1002 /* make granite outside so arena works */
1003 place_extra_bold(floor_ptr, y, x);
1006 /* proper boundary for arena */
1007 if (((y + rad) == y0) || ((y - rad) == y0) ||
1008 ((x + rad) == x0) || ((x - rad) == x0))
1010 place_extra_bold(floor_ptr, y, x);
1015 /* Find visible outer walls and set to be FEAT_OUTER */
1016 add_outer_wall(floor_ptr, x0, y0, light, x0 - rad - 1, y0 - rad - 1, x0 + rad + 1, y0 + rad + 1);
1018 /* Check to see if there is room for an inner vault */
1019 for (x = x0 - 2; x <= x0 + 2; x++)
1021 for (y = y0 - 2; y <= y0 + 2; y++)
1023 if (!is_floor_bold(floor_ptr, y, x))
1025 /* Wall in the way */
1031 if (emptyflag && one_in_(2))
1033 /* Build the vault */
1034 build_small_room(floor_ptr, x0, y0);
1036 /* Place a treasure in the vault */
1037 place_object(y0, x0, 0L);
1039 /* Let's guard the treasure well */
1040 vault_monsters(floor_ptr, y0, x0, randint0(2) + 3);
1042 /* Traps naturally */
1043 vault_traps(y0, x0, 4, 4, randint0(3) + 2);