3 /* Purpose: Dungeon generation */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
14 * Note that Level generation is *not* an important bottleneck,
15 * though it can be annoyingly slow on older machines... Thus
16 * we emphasize "simplicity" and "correctness" over "speed".
18 * This entire file is only needed for generating levels.
19 * This may allow smart compilers to only load it when needed.
21 * Consider the "v_info.txt" file for vault generation.
23 * In this file, we use the "special" granite and perma-wall sub-types,
24 * where "basic" is normal, "inner" is inside a room, "outer" is the
25 * outer wall of a room, and "solid" is the outer wall of the dungeon
26 * or any walls that may not be pierced by corridors. Thus the only
27 * wall type that may be pierced by a corridor is the "outer granite"
28 * type. The "basic granite" type yields the "actual" corridors.
30 * Note that we use the special "solid" granite wall type to prevent
31 * multiple corridors from piercing a wall in two adjacent locations,
32 * which would be messy, and we use the special "outer" granite wall
33 * to indicate which walls "surround" rooms, and may thus be "pierced"
34 * by corridors entering or leaving the room.
36 * Note that a tunnel which attempts to leave a room near the "edge"
37 * of the dungeon in a direction toward that edge will cause "silly"
38 * wall piercings, but will have no permanently incorrect effects,
39 * as long as the tunnel can *eventually* exit from another side.
40 * And note that the wall may not come back into the room by the
41 * hole it left through, so it must bend to the left or right and
42 * then optionally re-enter the room (at least 2 grids away). This
43 * is not a problem since every room that is large enough to block
44 * the passage of tunnels is also large enough to allow the tunnel
45 * to pierce the room itself several times.
47 * Note that no two corridors may enter a room through adjacent grids,
48 * they must either share an entryway or else use entryways at least
49 * two grids apart. This prevents "large" (or "silly") doorways.
51 * To create rooms in the dungeon, we first divide the dungeon up
52 * into "blocks" of 11x11 grids each, and require that all rooms
53 * occupy a rectangular group of blocks. As long as each room type
54 * reserves a sufficient number of blocks, the room building routines
55 * will not need to check bounds. Note that most of the normal rooms
56 * actually only use 23x11 grids, and so reserve 33x11 grids.
58 * Note that the use of 11x11 blocks (instead of the old 33x11 blocks)
59 * allows more variability in the horizontal placement of rooms, and
60 * at the same time has the disadvantage that some rooms (two thirds
61 * of the normal rooms) may be "split" by panel boundaries. This can
62 * induce a situation where a player is in a room and part of the room
63 * is off the screen. It may be annoying enough to go back to 33x11
64 * blocks to prevent this visual situation.
66 * Note that the dungeon generation routines are much different (2.7.5)
67 * and perhaps "DUN_ROOMS" should be less than 50.
69 * XXX XXX XXX Note that it is possible to create a room which is only
70 * connected to itself, because the "tunnel generation" code allows a
71 * tunnel to leave a room, wander around, and then re-enter the room.
73 * XXX XXX XXX Note that it is possible to create a set of rooms which
74 * are only connected to other rooms in that set, since there is nothing
75 * explicit in the code to prevent this from happening. But this is less
76 * likely than the "isolated room" problem, because each room attempts to
77 * connect to another room, in a giant cycle, thus requiring at least two
78 * bizarre occurances to create an isolated section of the dungeon.
80 * Note that (2.7.9) monster pits have been split into monster "nests"
81 * and monster "pits". The "nests" have a collection of monsters of a
82 * given type strewn randomly around the room (jelly, animal, or undead),
83 * while the "pits" have a collection of monsters of a given type placed
84 * around the room in an organized manner (orc, troll, giant, dragon, or
85 * demon). Note that both "nests" and "pits" are now "level dependant",
86 * and both make 16 "expensive" calls to the "get_mon_num()" function.
88 * Note that the cave grid flags changed in a rather drastic manner
89 * for Angband 2.8.0 (and 2.7.9+), in particular, dungeon terrain
90 * features, such as doors and stairs and traps and rubble and walls,
91 * are all handled as a set of 64 possible "terrain features", and
92 * not as "fake" objects (440-479) as in pre-2.8.0 versions.
94 * The 64 new "dungeon features" will also be used for "visual display"
95 * but we must be careful not to allow, for example, the user to display
96 * hidden traps in a different way from floors, or secret doors in a way
97 * different from granite walls, or even permanent granite in a different
98 * way from granite. XXX XXX XXX
102 #include "generate.h"
117 * Dungeon generation data -- see "cave_gen()"
122 * Places some staircases near walls
124 static bool alloc_stairs(int feat, int num, int walls)
126 int y, x, i, j, flag;
130 if (feat == FEAT_LESS)
132 /* No up stairs in town or in ironman mode */
133 if (ironman_downward || !dun_level) return TRUE;
135 if (dun_level > d_info[dungeon_type].mindepth)
136 more_num = (randint1(num+1))/2;
138 else if (feat == FEAT_MORE)
140 int q_idx = quest_number(dun_level);
142 /* No downstairs on quest levels */
143 if (dun_level > 1 && q_idx)
145 monster_race *r_ptr = &r_info[quest[q_idx].r_idx];
147 /* The quest monster(s) is still alive? */
148 if (!(r_ptr->flags1 & RF1_UNIQUE) || 0 < r_ptr->max_num)
152 /* No downstairs at the bottom */
153 if (dun_level >= d_info[dungeon_type].maxdepth) return TRUE;
155 if ((dun_level < d_info[dungeon_type].maxdepth-1) && !quest_number(dun_level+1))
156 more_num = (randint1(num)+1)/2;
159 /* Place "num" stairs */
160 for (i = 0; i < num; i++)
162 /* Place some stairs */
163 for (flag = FALSE; !flag; )
165 /* Try several times, then decrease "walls" */
166 for (j = 0; !flag && j <= 3000; j++)
168 /* Pick a random grid */
169 y = randint1(cur_hgt-2);
170 x = randint1(cur_wid-2);
172 /* Access the grid */
175 /* Require "naked" floor grid */
176 if (!is_floor_grid(c_ptr) || pattern_tile(y,x) || c_ptr->o_idx || c_ptr->m_idx) continue;
178 /* Require a certain number of adjacent walls */
179 if (next_to_walls(y, x) < walls) continue;
181 /* Clear possible garbage of hidden trap */
184 /* Clear previous contents, add stairs */
185 if (i < more_num) c_ptr->feat = feat+0x07;
186 else c_ptr->feat = feat;
192 if (!flag) return FALSE;
193 /* Require fewer walls */
202 * Allocates some objects (using "place" and "type")
204 static void alloc_object(int set, int typ, int num)
210 /* Place some objects */
211 for (k = 0; k < num; k++)
213 /* Pick a "legal" spot */
214 while (dummy < SAFE_MAX_ATTEMPTS)
221 y = randint0(cur_hgt);
222 x = randint0(cur_wid);
226 /* Require "naked" floor grid */
227 if (!is_floor_grid(c_ptr) || c_ptr->o_idx || c_ptr->m_idx) continue;
229 /* Check for "room" */
230 room = (cave[y][x].info & CAVE_ROOM) ? TRUE : FALSE;
232 /* Require corridor? */
233 if ((set == ALLOC_SET_CORR) && room) continue;
236 if ((set == ALLOC_SET_ROOM) && !room) continue;
242 if (dummy >= SAFE_MAX_ATTEMPTS)
247 msg_print("·Ù¹ð¡ª¥¢¥¤¥Æ¥à¤òÇÛÃ֤Ǥ¤Þ¤»¤ó¡ª");
249 msg_print("Warning! Could not place object!");
257 /* Place something */
260 case ALLOC_TYP_RUBBLE:
263 cave[y][x].info &= ~(CAVE_FLOOR);
270 cave[y][x].info &= ~(CAVE_FLOOR);
280 case ALLOC_TYP_OBJECT:
282 place_object(y, x, FALSE, FALSE);
291 * Count the number of "corridor" grids adjacent to the given grid.
293 * Note -- Assumes "in_bounds(y1, x1)"
295 * XXX XXX This routine currently only counts actual "empty floor"
296 * grids which are not in rooms. We might want to also count stairs,
297 * open doors, closed doors, etc.
299 static int next_to_corr(int y1, int x1)
305 /* Scan adjacent grids */
306 for (i = 0; i < 4; i++)
308 /* Extract the location */
312 /* Access the grid */
315 /* Skip non floors */
316 if (!cave_floor_grid(c_ptr)) continue;
318 /* Skip non "empty floor" grids */
319 if (!is_floor_grid(c_ptr))
322 /* Skip grids inside rooms */
323 if (c_ptr->info & (CAVE_ROOM)) continue;
325 /* Count these grids */
329 /* Return the number of corridors */
335 * Determine if the given location is "between" two walls,
336 * and "next to" two corridor spaces. XXX XXX XXX
338 * Assumes "in_bounds(y, x)"
340 static bool possible_doorway(int y, int x)
342 /* Count the adjacent corridors */
343 if (next_to_corr(y, x) >= 2)
346 if ((cave[y-1][x].feat >= FEAT_MAGMA) &&
347 (cave[y+1][x].feat >= FEAT_MAGMA))
352 /* Check Horizontal */
353 if ((cave[y][x-1].feat >= FEAT_MAGMA) &&
354 (cave[y][x+1].feat >= FEAT_MAGMA))
366 * Places door at y, x position if at least 2 walls found
368 static void try_door(int y, int x)
371 if (!in_bounds(y, x)) return;
374 if (!cave_floor_bold(y, x)) return;
376 /* Ignore room grids */
377 if (cave[y][x].info & (CAVE_ROOM)) return;
379 /* Occasional door (if allowed) */
380 if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
383 place_random_door(y, x);
390 * Generate a new dungeon level
392 * Note that "dun_body" adds about 4000 bytes of memory to the stack.
394 static bool cave_gen(void)
396 int i, j, k, y, x, y1, x1;
398 int max_vault_ok = 2;
400 int feat1 = 0, feat2 = 0;
404 bool destroyed = FALSE;
405 bool empty_level = FALSE;
412 /* Fill the arrays of floors and walls in the good proportions */
413 for (i = 0; i < 100; i++)
415 int lim1, lim2, lim3;
417 lim1 = d_info[dungeon_type].floor_percent1;
418 lim2 = lim1 + d_info[dungeon_type].floor_percent2;
419 lim3 = lim2 + d_info[dungeon_type].floor_percent3;
422 floor_type[i] = d_info[dungeon_type].floor1;
424 floor_type[i] = d_info[dungeon_type].floor2;
426 floor_type[i] = d_info[dungeon_type].floor3;
428 lim1 = d_info[dungeon_type].fill_percent1;
429 lim2 = lim1 + d_info[dungeon_type].fill_percent2;
430 lim3 = lim2 + d_info[dungeon_type].fill_percent3;
432 fill_type[i] = d_info[dungeon_type].fill_type1;
434 fill_type[i] = d_info[dungeon_type].fill_type2;
436 fill_type[i] = d_info[dungeon_type].fill_type3;
439 /* Prepare allocation table */
440 get_mon_num_prep(get_monster_hook(), NULL);
442 feat_wall_outer = d_info[dungeon_type].outer_wall;
443 feat_wall_inner = d_info[dungeon_type].inner_wall;
444 feat_wall_solid = d_info[dungeon_type].outer_wall;
449 if (cur_hgt <= SCREEN_HGT / 2 - 2) max_vault_ok--;
450 if (cur_wid <= SCREEN_WID / 2 - 2) max_vault_ok--;
452 /* Randomize the dungeon creation values */
453 dun_rooms = rand_range(DUN_ROOMS_MIN, DUN_ROOMS_MAX);
454 dun_tun_rnd = rand_range(DUN_TUN_RND_MIN, DUN_TUN_RND_MAX);
455 dun_tun_chg = rand_range(DUN_TUN_CHG_MIN, DUN_TUN_CHG_MAX);
456 dun_tun_con = rand_range(DUN_TUN_CON_MIN, DUN_TUN_CON_MAX);
457 dun_tun_pen = rand_range(DUN_TUN_PEN_MIN, DUN_TUN_PEN_MAX);
458 dun_tun_jct = rand_range(DUN_TUN_JCT_MIN, DUN_TUN_JCT_MAX);
460 /* Empty arena levels */
461 if (ironman_empty_levels || ((d_info[dungeon_type].flags1 & DF1_ARENA) && (empty_levels && one_in_(EMPTY_LEVEL))))
467 msg_print("¥¢¥ê¡¼¥Ê¥ì¥Ù¥ë");
469 msg_print("Arena level.");
475 /* Hack -- Start with basic granite */
476 for (y = 0; y < cur_hgt; y++)
478 for (x = 0; x < cur_wid; x++)
480 cave_type *c_ptr = &cave[y][x];
484 place_floor_grid(c_ptr);
488 /* Create granite wall */
489 place_extra_grid(c_ptr);
494 #ifdef ALLOW_CAVERNS_AND_LAKES
495 /* Possible "destroyed" level */
496 if ((dun_level > 30) && one_in_(DUN_DEST*2) && (small_levels) && (d_info[dungeon_type].flags1 & DF1_DESTROY))
500 /* extra rubble around the place looks cool */
501 build_lake(3+randint0(2));
504 /* Make a lake some of the time */
505 if (one_in_(LAKE_LEVEL) && !empty_level && !destroyed &&
506 (d_info[dungeon_type].flags1 & DF1_LAKE_MASK))
509 if (d_info[dungeon_type].flags1 & DF1_LAKE_WATER) count += 3;
510 if (d_info[dungeon_type].flags1 & DF1_LAKE_LAVA) count += 3;
511 if (d_info[dungeon_type].flags1 & DF1_LAKE_RUBBLE) count += 3;
512 if (d_info[dungeon_type].flags1 & DF1_LAKE_TREE) count += 3;
514 if (d_info[dungeon_type].flags1 & DF1_LAKE_LAVA)
517 if ((dun_level > 80) && (randint0(count) < 2)) laketype = 1;
521 if (!laketype && (dun_level > 80) && one_in_(count)) laketype = 7;
525 if ((d_info[dungeon_type].flags1 & DF1_LAKE_WATER) && !laketype)
528 if ((dun_level > 50) && randint0(count) < 2) laketype = 2;
532 if (!laketype && (dun_level > 50) && one_in_(count)) laketype = 6;
536 if ((d_info[dungeon_type].flags1 & DF1_LAKE_RUBBLE) && !laketype)
539 if ((dun_level > 35) && (randint0(count) < 2)) laketype = 3;
542 /* Lake of rubble2 */
543 if (!laketype && (dun_level > 35) && one_in_(count)) laketype = 4;
548 if ((dun_level > 5) && (d_info[dungeon_type].flags1 & DF1_LAKE_TREE) && !laketype) laketype = 5;
554 msg_print("¸Ð¤òÀ¸À®¡£");
556 msg_print("Lake on the level.");
559 build_lake(laketype);
563 if ((dun_level > DUN_CAVERN) && !empty_level &&
564 (d_info[dungeon_type].flags1 & DF1_CAVERN) &&
565 (laketype == 0) && !destroyed && (randint1(1000) < dun_level))
569 /* make a large fractal cave in the middle of the dungeon */
573 msg_print("ƶ·¢¤òÀ¸À®¡£");
575 msg_print("Cavern on level.");
581 #endif /* ALLOW_CAVERNS_AND_LAKES */
583 /* Hack -- No destroyed "quest" levels */
584 if (quest_number(dun_level)) destroyed = FALSE;
586 /* Actual maximum number of rooms on this level */
587 dun->row_rooms = cur_hgt / BLOCK_HGT;
588 dun->col_rooms = cur_wid / BLOCK_WID;
590 /* Initialize the room table */
591 for (y = 0; y < dun->row_rooms; y++)
593 for (x = 0; x < dun->col_rooms; x++)
595 dun->room_map[y][x] = FALSE;
600 /* No "crowded" rooms yet */
608 /* Build some rooms */
609 if (!(d_info[dungeon_type].flags1 & DF1_MAZE))
611 for (i = 0; i < dun_rooms; i++)
613 bool force_rooms = (ironman_rooms && !((d_info[dungeon_type].flags1 & DF1_BEGINNER) || (d_info[dungeon_type].flags1 & DF1_CHAMELEON)));
615 /* Pick a block for the room */
616 y = randint0(dun->row_rooms);
617 x = randint0(dun->col_rooms);
619 /* Align dungeon rooms */
620 if (d_info[dungeon_type].flags1 & DF1_NO_CAVE)
622 /* Slide some rooms right */
623 if ((x % 3) == 0) x++;
625 /* Slide some rooms left */
626 if ((x % 3) == 2) x--;
629 /* Attempt an "unusual" room */
630 if (force_rooms || (randint0(DUN_UNUSUAL) < dun_level))
632 /* Roll for room type */
635 k = (force_rooms ? 0 : randint0(100));
636 if (force_rooms) break;
637 if ((d_info[dungeon_type].flags1 & DF1_NO_VAULT) && (k < 14)) continue;
641 /* Attempt a very unusual room */
642 if (force_rooms || (randint0(DUN_UNUSUAL) < dun_level))
645 if (room_build(y, x, 8)) continue;
647 /* Type 8 -- Greater vault (4%) */
650 if (max_vault_ok > 1)
652 if (room_build(y, x, 8)) continue;
657 if (cheat_room) msg_print("µðÂç¤ÊÃϲ¼¼¼¤òµÑ²¼¤·¤Þ¤¹¡£");
659 if (cheat_room) msg_print("Refusing a greater vault.");
665 /* Type 7 -- Lesser vault (6%) */
668 if (max_vault_ok > 0)
670 if (room_build(y, x, 7)) continue;
675 if (cheat_room) msg_print("¾®¤µ¤ÊÃϲ¼¼¼¤òµÑ²¼¤·¤Þ¤¹¡£");
677 if (cheat_room) msg_print("Refusing a lesser vault.");
684 /* Type 10 -- Random vault (4%) */
685 if ((k < 14) && room_build(y, x, 10)) continue;
687 /* Type 5 -- Monster nest (8%) */
688 if ((k < 22) && room_build(y, x, 5)) continue;
690 /* Type 6 -- Monster pit (10%) */
691 if ((k < 32) && room_build(y, x, 6)) continue;
693 /* Type 13 -- Trapped monster pit (5%) */
694 if ((k < 37) && room_build(y, x, 13)) continue;
699 /* Type 2 -- Overlapping (25%) */
700 if ((k < 25) && room_build(y, x, 2)) continue;
702 /* Type 3 -- Cross room (25%) */
703 if ((k < 50) && room_build(y, x, 3)) continue;
705 if (d_info[dungeon_type].flags1 & DF1_NO_CAVE)
707 if (room_build(y, x, 4)) continue;
711 /* Type 4 -- Large room (25%) */
712 if ((k < 75) && room_build(y, x, 4)) continue;
714 /* Type 11 -- Circular (10%) */
715 if ((k < 85) && room_build(y, x, 11)) continue;
717 /* Type 12 -- Crypt (15%) */
718 if ((k < 100) && room_build(y, x, 12)) continue;
722 /* The deeper you are, the more cavelike the rooms are */
725 /* No caves when a cavern exists: they look bad */
726 if (((k < dun_level) || (d_info[dungeon_type].flags1 & DF1_CAVE)) && (!cavern) && (!empty_level) && (laketype == 0) && !(d_info[dungeon_type].flags1 & DF1_NO_CAVE))
728 /* Type 9 -- Fractal cave */
729 if (room_build(y, x, 9)) continue;
732 /* Attempt a "trivial" room */
734 if (room_build(y, x, 1)) continue;
738 /* Make a hole in the dungeon roof sometimes at level 1 */
739 if ((dun_level == 1) && terrain_streams)
741 while (one_in_(DUN_MOS_DEN))
743 place_trees(randint1(cur_wid - 2), randint1(cur_hgt - 2));
747 /* Destroy the level if necessary */
748 if (destroyed) destroy_level();
750 /* Hack -- Add some rivers */
751 if (one_in_(3) && (randint1(dun_level) > 5) && terrain_streams)
753 /* Choose water or lava */
754 if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_type].flags1 & DF1_WATER_RIVER))
756 feat1 = FEAT_DEEP_WATER;
757 feat2 = FEAT_SHAL_WATER;
759 else if (d_info[dungeon_type].flags1 & DF1_LAVA_RIVER)
761 feat1 = FEAT_DEEP_LAVA;
762 feat2 = FEAT_SHAL_LAVA;
767 /* Only add river if matches lake type or if have no lake at all */
768 if ((((laketype == 1) && (feat1 == FEAT_DEEP_LAVA)) ||
769 ((laketype == 2) && (feat1 == FEAT_DEEP_WATER)) ||
770 (laketype == 0)) && feat1)
772 add_river(feat1, feat2);
777 /* Special boundary walls -- Top */
778 for (x = 0; x < cur_wid; x++)
780 cave_type *c_ptr = &cave[0][x];
782 /* Clear previous contents, add "solid" perma-wall */
783 c_ptr->feat = FEAT_PERM_SOLID;
784 c_ptr->info &= ~(CAVE_MASK);
787 /* Special boundary walls -- Bottom */
788 for (x = 0; x < cur_wid; x++)
790 cave_type *c_ptr = &cave[cur_hgt-1][x];
792 /* Clear previous contents, add "solid" perma-wall */
793 c_ptr->feat = FEAT_PERM_SOLID;
794 c_ptr->info &= ~(CAVE_MASK);
797 /* Special boundary walls -- Left */
798 for (y = 0; y < cur_hgt; y++)
800 cave_type *c_ptr = &cave[y][0];
802 /* Clear previous contents, add "solid" perma-wall */
803 c_ptr->feat = FEAT_PERM_SOLID;
804 c_ptr->info &= ~(CAVE_MASK);
807 /* Special boundary walls -- Right */
808 for (y = 0; y < cur_hgt; y++)
810 cave_type *c_ptr = &cave[y][cur_wid-1];
812 /* Clear previous contents, add "solid" perma-wall */
813 c_ptr->feat = FEAT_PERM_SOLID;
814 c_ptr->info &= ~(CAVE_MASK);
818 if (d_info[dungeon_type].flags1 & DF1_MAZE)
820 build_maze_vault(cur_wid/2-1, cur_hgt/2-1, cur_wid-4, cur_hgt-4, FALSE);
822 /* Place 3 or 4 down stairs near some walls */
823 if (!alloc_stairs(FEAT_MORE, rand_range(2, 3), 3)) return FALSE;
825 /* Place 1 or 2 up stairs near some walls */
826 if (!alloc_stairs(FEAT_LESS, 1, 3)) return FALSE;
830 /* Hack -- Scramble the room order */
831 for (i = 0; i < dun->cent_n; i++)
833 int pick1 = randint0(dun->cent_n);
834 int pick2 = randint0(dun->cent_n);
835 y1 = dun->cent[pick1].y;
836 x1 = dun->cent[pick1].x;
837 dun->cent[pick1].y = dun->cent[pick2].y;
838 dun->cent[pick1].x = dun->cent[pick2].x;
839 dun->cent[pick2].y = y1;
840 dun->cent[pick2].x = x1;
843 /* Start with no tunnel doors */
846 /* Hack -- connect the first room to the last room */
847 y = dun->cent[dun->cent_n-1].y;
848 x = dun->cent[dun->cent_n-1].x;
850 /* Connect all the rooms together */
851 for (i = 0; i < dun->cent_n; i++)
854 /* Reset the arrays */
858 /* Connect the room to the previous room */
859 if (randint1(dun_level) > d_info[dungeon_type].tunnel_percent)
861 /* make cave-like tunnel */
862 build_tunnel2(dun->cent[i].x, dun->cent[i].y, x, y, 2, 2);
866 /* make normal tunnel */
867 build_tunnel(dun->cent[i].y, dun->cent[i].x, y, x);
870 /* Turn the tunnel into corridor */
871 for (j = 0; j < dun->tunn_n; j++)
873 /* Access the grid */
877 /* Access the grid */
880 /* Clear previous contents (if not a lake), add a floor */
881 if ((c_ptr->feat < FEAT_DEEP_WATER) ||
882 (c_ptr->feat > FEAT_SHAL_LAVA))
884 place_floor_grid(c_ptr);
888 /* Apply the piercings that we found */
889 for (j = 0; j < dun->wall_n; j++)
891 /* Access the grid */
895 /* Access the grid */
898 /* Clear previous contents, add up floor */
899 place_floor_grid(c_ptr);
901 /* Occasional doorway */
902 if ((randint0(100) < dun_tun_pen) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
904 /* Place a random door */
905 place_random_door(y, x);
909 /* Remember the "previous" room */
914 /* Place intersection doors */
915 for (i = 0; i < dun->door_n; i++)
917 /* Extract junction location */
921 /* Try placing doors */
928 /* Place 3 or 4 down stairs near some walls */
929 if (!alloc_stairs(FEAT_MORE, rand_range(3, 4), 3)) return FALSE;
931 /* Place 1 or 2 up stairs near some walls */
932 if (!alloc_stairs(FEAT_LESS, rand_range(1, 2), 3)) return FALSE;
938 if (d_info[dungeon_type].stream1)
940 /* Hack -- Add some magma streamers */
941 for (i = 0; i < DUN_STR_MAG; i++)
943 build_streamer(d_info[dungeon_type].stream1, DUN_STR_MC);
947 if (d_info[dungeon_type].stream2)
949 /* Hack -- Add some quartz streamers */
950 for (i = 0; i < DUN_STR_QUA; i++)
952 build_streamer(d_info[dungeon_type].stream2, DUN_STR_QC);
957 /* Handle the quest monster placements */
958 for (i = 0; i < max_quests; i++)
960 if ((quest[i].status == QUEST_STATUS_TAKEN) &&
961 ((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
962 (quest[i].type == QUEST_TYPE_RANDOM)) &&
963 (quest[i].level == dun_level) && (dungeon_type == quest[i].dungeon) &&
964 !(quest[i].flags & QUEST_FLAG_PRESET))
966 monster_race *r_ptr = &r_info[quest[i].r_idx];
968 /* Hack -- "unique" monsters must be "unique" */
969 if ((r_ptr->flags1 & RF1_UNIQUE) &&
970 (r_ptr->cur_num >= r_ptr->max_num))
972 /* The unique is already dead */
976 u32b mode = (PM_NO_KAGE | PM_NO_PET);
978 for (j = 0; j < (quest[i].max_num - quest[i].cur_num); j++)
980 for (k = 0; k < SAFE_MAX_ATTEMPTS; k++)
982 /* Find an empty grid */
985 y = randint0(cur_hgt);
986 x = randint0(cur_wid);
988 /* Access the grid */
991 if (!is_floor_grid(c_ptr) || c_ptr->o_idx || c_ptr->m_idx) continue;
992 if (distance(y, x, py, px) < 10) continue;
996 if (!(r_ptr->flags1 & RF1_FRIENDS))
997 mode |= PM_ALLOW_GROUP;
999 /* Try to place the monster */
1000 if (place_monster_aux(0, y, x, quest[i].r_idx, mode))
1007 /* Failure - Try again */
1017 /* Basic "amount" */
1018 k = (dun_level / 3);
1022 /* Pick a base number of monsters */
1023 i = d_info[dungeon_type].min_m_alloc_level;
1025 /* To make small levels a bit more playable */
1026 if (cur_hgt < MAX_HGT || cur_wid < MAX_WID)
1028 int small_tester = i;
1030 i = (i * cur_hgt) / MAX_HGT;
1031 i = (i * cur_wid) / MAX_WID;
1034 if (i > small_tester) i = small_tester;
1035 else if (cheat_hear)
1038 msg_format("¥â¥ó¥¹¥¿¡¼¿ô´ðËÜÃͤò %d ¤«¤é %d ¤Ë¸º¤é¤·¤Þ¤¹", small_tester, i);
1040 msg_format("Reduced monsters base from %d to %d", small_tester, i);
1048 /* Put some monsters in the dungeon */
1049 for (i = i + k; i > 0; i--)
1051 (void)alloc_monster(0, TRUE);
1054 /* Place some traps in the dungeon */
1055 alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint1(k));
1057 /* Put some rubble in corridors */
1058 alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint1(k));
1060 /* Put some objects in rooms */
1061 alloc_object(ALLOC_SET_ROOM, ALLOC_TYP_OBJECT, randnor(DUN_AMT_ROOM, 3));
1063 /* Put some objects/gold in the dungeon */
1064 alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_OBJECT, randnor(DUN_AMT_ITEM, 3));
1065 alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_GOLD, randnor(DUN_AMT_GOLD, 3));
1067 /* Put an Artifact and Artifact Guardian is requested */
1068 if(d_info[dungeon_type].final_guardian && (d_info[dungeon_type].maxdepth == dun_level))
1074 /* Find a good position */
1077 /* Get a random spot */
1078 oy = randint1(cur_hgt - 4) + 2;
1079 ox = randint1(cur_wid - 4) + 2;
1081 /* Is it a good spot ? */
1082 if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[d_info[dungeon_type].final_guardian]))
1084 /* Place the guardian */
1085 if (place_monster_aux(0, oy, ox, d_info[dungeon_type].final_guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) break;
1092 if ((empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level))) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1095 for (y = 0; y < cur_hgt; y++)
1097 for (x = 0; x < cur_wid; x++)
1099 cave[y][x].info |= (CAVE_GLOW);
1104 /* Determine the character location */
1105 if (!new_player_spot())
1113 * Builds the arena after it is entered -KMW-
1115 static void build_arena(void)
1117 int yval, y_height, y_depth, xval, x_left, x_right;
1120 yval = SCREEN_HGT / 2;
1121 xval = SCREEN_WID / 2;
1122 y_height = yval - 10;
1123 y_depth = yval + 10;
1125 x_right = xval + 32;
1127 for (i = y_height; i <= y_height + 5; i++)
1128 for (j = x_left; j <= x_right; j++)
1130 cave[i][j].feat = FEAT_PERM_EXTRA;
1131 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1133 for (i = y_depth; i >= y_depth - 5; i--)
1134 for (j = x_left; j <= x_right; j++)
1136 cave[i][j].feat = FEAT_PERM_EXTRA;
1137 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1139 for (j = x_left; j <= x_left + 17; j++)
1140 for (i = y_height; i <= y_depth; i++)
1142 cave[i][j].feat = FEAT_PERM_EXTRA;
1143 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1145 for (j = x_right; j >= x_right - 17; j--)
1146 for (i = y_height; i <= y_depth; i++)
1148 cave[i][j].feat = FEAT_PERM_EXTRA;
1149 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1152 cave[y_height+6][x_left+18].feat = FEAT_PERM_EXTRA;
1153 cave[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
1154 cave[y_depth-6][x_left+18].feat = FEAT_PERM_EXTRA;
1155 cave[y_depth-6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
1156 cave[y_height+6][x_right-18].feat = FEAT_PERM_EXTRA;
1157 cave[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);
1158 cave[y_depth-6][x_right-18].feat = FEAT_PERM_EXTRA;
1159 cave[y_depth-6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);
1163 cave[i][j].feat = FEAT_BLDG_HEAD + 2;
1164 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1165 player_place(i + 1, j);
1170 * Town logic flow for generation of arena -KMW-
1172 static void arena_gen(void)
1179 cur_hgt = SCREEN_HGT;
1180 cur_wid = SCREEN_WID;
1182 /* Start with solid walls */
1183 for (y = 0; y < MAX_HGT; y++)
1185 for (x = 0; x < MAX_WID; x++)
1187 /* Create "solid" perma-wall */
1188 cave[y][x].feat = FEAT_PERM_SOLID;
1190 /* Illuminate and memorize the walls */
1191 cave[y][x].info |= (CAVE_GLOW | CAVE_MARK);
1195 /* Then place some floors */
1196 for (y = qy + 1; y < qy + SCREEN_HGT - 1; y++)
1198 for (x = qx + 1; x < qx + SCREEN_WID - 1; x++)
1200 /* Create empty floor */
1201 cave[y][x].feat = FEAT_FLOOR;
1207 place_monster_aux(0, py + 5, px, arena_monsters[p_ptr->arena_number],
1208 (PM_NO_KAGE | PM_NO_PET));
1214 * Builds the arena after it is entered -KMW-
1216 static void build_battle(void)
1218 int yval, y_height, y_depth, xval, x_left, x_right;
1221 yval = SCREEN_HGT / 2;
1222 xval = SCREEN_WID / 2;
1223 y_height = yval - 10;
1224 y_depth = yval + 10;
1226 x_right = xval + 32;
1228 for (i = y_height; i <= y_height + 5; i++)
1229 for (j = x_left; j <= x_right; j++)
1231 cave[i][j].feat = FEAT_PERM_EXTRA;
1232 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1234 for (i = y_depth; i >= y_depth - 3; i--)
1235 for (j = x_left; j <= x_right; j++)
1237 cave[i][j].feat = FEAT_PERM_EXTRA;
1238 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1240 for (j = x_left; j <= x_left + 17; j++)
1241 for (i = y_height; i <= y_depth; i++)
1243 cave[i][j].feat = FEAT_PERM_EXTRA;
1244 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1246 for (j = x_right; j >= x_right - 17; j--)
1247 for (i = y_height; i <= y_depth; i++)
1249 cave[i][j].feat = FEAT_PERM_EXTRA;
1250 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1253 cave[y_height+6][x_left+18].feat = FEAT_PERM_EXTRA;
1254 cave[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
1255 cave[y_depth-4][x_left+18].feat = FEAT_PERM_EXTRA;
1256 cave[y_depth-4][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
1257 cave[y_height+6][x_right-18].feat = FEAT_PERM_EXTRA;
1258 cave[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);
1259 cave[y_depth-4][x_right-18].feat = FEAT_PERM_EXTRA;
1260 cave[y_depth-4][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);
1264 cave[i][j].feat = FEAT_BLDG_HEAD + 3;
1265 cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
1271 * Town logic flow for generation of arena -KMW-
1273 static void battle_gen(void)
1279 /* Start with solid walls */
1280 for (y = 0; y < MAX_HGT; y++)
1282 for (x = 0; x < MAX_WID; x++)
1284 /* Create "solid" perma-wall */
1285 cave[y][x].feat = FEAT_PERM_SOLID;
1287 /* Illuminate and memorize the walls */
1288 cave[y][x].info |= (CAVE_GLOW | CAVE_MARK);
1292 /* Then place some floors */
1293 for (y = qy + 1; y < qy + SCREEN_HGT - 1; y++)
1295 for (x = qx + 1; x < qx + SCREEN_WID - 1; x++)
1297 /* Create empty floor */
1298 cave[y][x].feat = FEAT_FLOOR;
1306 place_monster_aux(0, py + 5 + (i/2)*4, px - 2 + (i%2)*4, battle_mon[i],
1307 (PM_NO_KAGE | PM_NO_PET));
1308 set_friendly(&m_list[cave[py+5+(i/2)*4][px-2+(i%2)*4].m_idx]);
1310 for(i = 1; i < m_max; i++)
1312 monster_type *m_ptr = &m_list[i];
1314 if (!m_ptr->r_idx) continue;
1316 /* Hack -- Detect monster */
1317 m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
1319 /* Update the monster */
1320 update_mon(i, FALSE);
1326 * Generate a quest level
1328 static void quest_gen(void)
1333 /* Start with perm walls */
1334 for (y = 0; y < cur_hgt; y++)
1336 for (x = 0; x < cur_wid; x++)
1338 cave[y][x].feat = FEAT_PERM_SOLID;
1342 /* Set the quest level */
1343 base_level = quest[p_ptr->inside_quest].level;
1344 dun_level = base_level;
1345 object_level = base_level;
1346 monster_level = base_level;
1348 if (record_stair) do_cmd_write_nikki(NIKKI_TO_QUEST, p_ptr->inside_quest, NULL);
1350 /* Prepare allocation table */
1351 get_mon_num_prep(get_monster_hook(), NULL);
1353 init_flags = INIT_CREATE_DUNGEON | INIT_ASSIGN;
1355 process_dungeon_file("q_info_j.txt", 0, 0, MAX_HGT, MAX_WID);
1358 /* Make a real level */
1359 static bool level_gen(cptr *why)
1361 int level_height, level_width;
1363 if ((always_small_levels || ironman_small_levels ||
1364 (one_in_(SMALL_LEVEL) && small_levels) ||
1365 (d_info[dungeon_type].flags1 & DF1_BEGINNER) ||
1366 (d_info[dungeon_type].flags1 & DF1_SMALLEST)) &&
1367 !(d_info[dungeon_type].flags1 & DF1_BIG))
1371 msg_print("¾®¤µ¤Ê¥Õ¥í¥¢");
1373 msg_print("A 'small' dungeon level.");
1377 if (d_info[dungeon_type].flags1 & DF1_SMALLEST)
1382 else if (d_info[dungeon_type].flags1 & DF1_BEGINNER)
1391 level_height = randint1(MAX_HGT/SCREEN_HGT);
1392 level_width = randint1(MAX_WID/SCREEN_WID);
1394 while ((level_height == MAX_HGT/SCREEN_HGT) &&
1395 (level_width == MAX_WID/SCREEN_WID));
1398 cur_hgt = level_height * SCREEN_HGT;
1399 cur_wid = level_width * SCREEN_WID;
1401 /* Assume illegal panel */
1402 panel_row_min = cur_hgt;
1403 panel_col_min = cur_wid;
1406 msg_format("X:%d, Y:%d.", cur_hgt, cur_wid);
1414 /* Assume illegal panel */
1415 panel_row_min = cur_hgt;
1416 panel_col_min = cur_wid;
1419 /* Make a dungeon */
1423 *why = "¥À¥ó¥¸¥ç¥óÀ¸À®¤Ë¼ºÇÔ";
1425 *why = "could not place player";
1433 static byte extract_feeling(void)
1435 /* Hack -- no feeling in the town */
1436 if (!dun_level) return 0;
1438 /* Hack -- Have a special feeling sometimes */
1439 if (good_item_flag && !preserve_mode) return 1;
1441 if (rating > 100) return 2;
1442 if (rating > 80) return 3;
1443 if (rating > 60) return 4;
1444 if (rating > 40) return 5;
1445 if (rating > 30) return 6;
1446 if (rating > 20) return 7;
1447 if (rating > 10) return 8;
1448 if (rating > 0) return 9;
1450 if((turn - old_turn) > TURNS_PER_TICK * TOWN_DAWN /2)
1451 chg_virtue(V_PATIENCE, 1);
1457 static void place_pet(void)
1461 if (p_ptr->wild_mode)
1466 for (i = 0; i < max_num; i++)
1470 if (!(party_mon[i].r_idx)) continue;
1476 p_ptr->riding = m_idx;
1487 for(d = 1; d < 6; d++)
1489 for(j = 1000; j > 0; j--)
1491 scatter(&cy, &cx, py, px, d, 0);
1492 if ((cave_floor_bold(cy, cx) || (cave[cy][cx].feat == FEAT_TREES)) && !cave[cy][cx].m_idx && !((cy == py) && (cx == px))) break;
1496 if (d == 6 || p_ptr->inside_arena || p_ptr->inside_battle)
1504 monster_type *m_ptr = &m_list[m_idx];
1505 monster_race *r_ptr;
1507 cave[cy][cx].m_idx = m_idx;
1509 m_ptr->r_idx = party_mon[i].r_idx;
1510 r_ptr = &r_info[m_ptr->r_idx];
1512 m_ptr->ap_r_idx = party_mon[i].ap_r_idx;
1513 m_ptr->sub_align = party_mon[i].sub_align;
1516 m_ptr->cdis = party_mon[i].cdis;
1517 m_ptr->mflag = party_mon[i].mflag;
1518 m_ptr->mflag2 = party_mon[i].mflag2;
1520 m_ptr->hp = party_mon[i].hp;
1521 m_ptr->maxhp = party_mon[i].maxhp;
1522 m_ptr->max_maxhp = party_mon[i].max_maxhp;
1523 m_ptr->mspeed = party_mon[i].mspeed;
1524 m_ptr->fast = party_mon[i].fast;
1525 m_ptr->slow = party_mon[i].slow;
1526 m_ptr->stunned = party_mon[i].stunned;
1527 m_ptr->confused = party_mon[i].confused;
1528 m_ptr->monfear = party_mon[i].monfear;
1529 m_ptr->invulner = party_mon[i].invulner;
1530 m_ptr->smart = party_mon[i].smart;
1532 m_ptr->nickname = party_mon[i].nickname;
1533 m_ptr->energy_need = party_mon[i].energy_need;
1534 m_ptr->exp = party_mon[i].exp;
1537 if ((r_ptr->flags1 & RF1_FORCE_SLEEP) && !ironman_nightmare)
1539 /* Monster is still being nice */
1540 m_ptr->mflag |= (MFLAG_NICE);
1542 /* Must repair monsters */
1543 repair_monsters = TRUE;
1546 /* Update the monster */
1547 update_mon(m_idx, TRUE);
1552 /* Hack -- Count the number of "reproducers" */
1553 if (r_ptr->flags2 & RF2_MULTIPLY) num_repro++;
1555 /* Hack -- Notice new multi-hued monsters */
1556 if (r_ptr->flags1 & RF1_ATTR_MULTI) shimmer_monsters = TRUE;
1562 monster_desc(m_name, &party_mon[i], 0);
1564 msg_format("%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£", m_name);
1566 msg_format("You have lost sight of %s.", m_name);
1568 if (record_named_pet && party_mon[i].nickname)
1570 monster_desc(m_name, &party_mon[i], 0x08);
1571 do_cmd_write_nikki(NIKKI_NAMED_PET, 5, m_name);
1578 * Wipe all unnecessary flags after cave generation
1580 static void wipe_generate_cave_flags(void)
1584 for (y = 0; y < cur_hgt; y++)
1586 for (x = 0; x < cur_wid; x++)
1588 /* Wipe unused flags */
1589 cave[y][x].info &= ~(CAVE_MASK);
1595 for (y = 1; y < cur_hgt - 1; y++)
1597 for (x = 1; x < cur_wid - 1; x++)
1599 /* There might be trap */
1600 cave[y][x].info |= CAVE_UNSAFE;
1607 * Generates a random dungeon level -RAK-
1609 * Hack -- regenerate any "overflow" levels
1611 * Hack -- allow auto-scumming via a gameplay option.
1613 void generate_cave(void)
1618 /* The dungeon is not ready */
1619 character_dungeon = FALSE;
1621 /* No longer in the trap detecteded region */
1622 p_ptr->dtrap = FALSE;
1625 for (num = 0; TRUE; num++)
1632 /* XXX XXX XXX XXX */
1636 /* Start with a blank cave */
1637 for (y = 0; y < MAX_HGT; y++)
1639 for (x = 0; x < MAX_WID; x++)
1642 cave[y][x].info = 0;
1645 cave[y][x].feat = 0;
1648 cave[y][x].o_idx = 0;
1651 cave[y][x].m_idx = 0;
1654 cave[y][x].mimic = 0;
1657 cave[y][x].cost = 0;
1658 cave[y][x].dist = 0;
1659 cave[y][x].when = 0;
1663 /* Mega-Hack -- no player yet */
1666 /* Mega-Hack -- no panel yet */
1672 /* Set the base level */
1673 base_level = dun_level;
1675 /* Reset the monster generation level */
1676 monster_level = base_level;
1678 /* Reset the object generation level */
1679 object_level = base_level;
1681 /* Nothing special here yet */
1682 good_item_flag = FALSE;
1684 /* Nothing good here yet */
1687 if ((d_info[dungeon_type].fill_type1 == FEAT_MAGMA_K) || (d_info[dungeon_type].fill_type2 == FEAT_MAGMA_K) || (d_info[dungeon_type].fill_type3 == FEAT_MAGMA_K)) rating += 40;
1689 ambush_flag = FALSE;
1691 /* Fill the arrays of floors and walls in the good proportions */
1692 for (i = 0; i < 100; i++)
1694 int lim1, lim2, lim3;
1696 lim1 = d_info[0].floor_percent1;
1697 lim2 = lim1 + d_info[0].floor_percent2;
1698 lim3 = lim2 + d_info[0].floor_percent3;
1701 floor_type[i] = d_info[0].floor1;
1703 floor_type[i] = d_info[0].floor2;
1705 floor_type[i] = d_info[0].floor3;
1707 lim1 = d_info[0].fill_percent1;
1708 lim2 = lim1 + d_info[0].fill_percent2;
1709 lim3 = lim2 + d_info[0].fill_percent3;
1711 fill_type[i] = d_info[0].fill_type1;
1713 fill_type[i] = d_info[0].fill_type2;
1715 fill_type[i] = d_info[0].fill_type3;
1718 /* Build the arena -KMW- */
1719 if (p_ptr->inside_arena)
1725 /* Build the battle -KMW- */
1726 else if (p_ptr->inside_battle)
1732 else if (p_ptr->inside_quest)
1737 /* Build the town */
1738 else if (!dun_level)
1740 /* Make the wilderness */
1741 if (p_ptr->wild_mode) wilderness_gen_small();
1742 else wilderness_gen();
1745 /* Build a real level */
1748 okay = level_gen(&why);
1751 /* Extract the feeling */
1752 feeling = extract_feeling();
1754 /* Prevent object over-flow */
1755 if (o_max >= max_o_idx)
1759 why = "¥¢¥¤¥Æ¥à¤¬Â¿¤¹¤®¤ë";
1761 why = "too many objects";
1768 /* Prevent monster over-flow */
1769 else if (m_max >= max_m_idx)
1773 why = "¥â¥ó¥¹¥¿¡¼¤¬Â¿¤¹¤®¤ë";
1775 why = "too many monsters";
1783 /* Mega-Hack -- "auto-scum" */
1784 else if ((auto_scum || ironman_autoscum) && (num < 100) &&
1785 !p_ptr->inside_quest && !(d_info[dungeon_type].flags1 & DF1_BEGINNER))
1787 /* Require "goodness" */
1788 if ((feeling > 9) ||
1789 ((dun_level >= 7) && (feeling > 8)) ||
1790 ((dun_level >= 15) && (feeling > 7)) ||
1791 ((dun_level >= 35) && (feeling > 6)) ||
1792 ((dun_level >= 70) && (feeling > 5)))
1794 /* Give message to cheaters */
1795 if (cheat_room || cheat_hear ||
1796 cheat_peek || cheat_xtra)
1802 why = "boring level";
1817 if (why) msg_format("À¸À®¤ä¤êľ¤·(%s)", why);
1819 if (why) msg_format("Generation restarted (%s)", why);
1823 /* Wipe the objects */
1826 /* Wipe the monsters */
1830 for (y = 1; y < cur_hgt - 1; y++)
1832 for (x = 1; x < cur_wid - 1; x++)
1834 if ((cave[y][x].feat == FEAT_DEEP_LAVA))
1837 for (i = 0; i < 9; i++)
1839 cave[y+ddy_ddd[i]][x+ddx_ddd[i]].info |= CAVE_GLOW;
1845 wipe_generate_cave_flags();
1849 /* The dungeon is ready */
1850 character_dungeon = TRUE;
1852 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) wiz_lite(TRUE, (bool)(p_ptr->pclass == CLASS_NINJA));
1854 /* Remember when this level was "created" */