-/*
- * Build target vault.
- * This is made by two concentric "crypts" with perpendicular
- * walls creating the cross-hairs.
- */
-static void build_target_vault(int x0, int y0, int xsize, int ysize)
-{
- int rad, x, y;
-
- /* Make a random metric */
- int h1, h2, h3, h4;
- h1 = randint1(32) - 16;
- h2 = randint1(16);
- h3 = randint1(32);
- h4 = randint1(32) - 16;
-
- msg_print_wizard(CHEAT_DUNGEON, _("対称形ランダムVaultを生成しました。", "Elemental Vault"));
-
- /* work out outer radius */
- if (xsize > ysize)
- {
- rad = ysize / 2;
- }
- else
- {
- rad = xsize / 2;
- }
-
- /* Make floor */
- for (x = x0 - rad; x <= x0 + rad; x++)
- {
- for (y = y0 - rad; y <= y0 + rad; y++)
- {
- /* clear room flag */
- cave[y][x].info &= ~(CAVE_ROOM);
-
- /* Vault - so is "icky" */
- cave[y][x].info |= CAVE_ICKY;
-
- if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1)
- {
- /* inside- so is floor */
- place_floor_bold(y, x);
- }
- else
- {
- /* make granite outside so arena works */
- place_extra_bold(y, x);
- }
-
- /* proper boundary for arena */
- if (((y + rad) == y0) || ((y - rad) == y0) ||
- ((x + rad) == x0) || ((x - rad) == x0))
- {
- place_extra_bold(y, x);
- }
- }
- }
-
- /* Find visible outer walls and set to be FEAT_OUTER */
- add_outer_wall(x0, y0, FALSE, x0 - rad - 1, y0 - rad - 1,
- x0 + rad + 1, y0 + rad + 1);
-
- /* Add inner wall */
- for (x = x0 - rad / 2; x <= x0 + rad / 2; x++)
- {
- for (y = y0 - rad / 2; y <= y0 + rad / 2; y++)
- {
- if (dist2(y0, x0, y, x, h1, h2, h3, h4) == rad / 2)
- {
- /* Make an internal wall */
- place_inner_bold(y, x);
- }
- }
- }
-
- /* Add perpendicular walls */
- for (x = x0 - rad; x <= x0 + rad; x++)
- {
- place_inner_bold(y0, x);
- }
-
- for (y = y0 - rad; y <= y0 + rad; y++)
- {
- place_inner_bold(y, x0);
- }
-
- /* Make inner vault */
- for (y = y0 - 1; y <= y0 + 1; y++)
- {
- place_inner_bold(y, x0 - 1);
- place_inner_bold(y, x0 + 1);
- }
- for (x = x0 - 1; x <= x0 + 1; x++)
- {
- place_inner_bold(y0 - 1, x);
- place_inner_bold(y0 + 1, x);
- }
-
- place_floor_bold(y0, x0);
-
-
- /* Add doors to vault */
- /* get two distances so can place doors relative to centre */
- x = (rad - 2) / 4 + 1;
- y = rad / 2 + x;
-
- add_door(x0 + x, y0);
- add_door(x0 + y, y0);
- add_door(x0 - x, y0);
- add_door(x0 - y, y0);
- add_door(x0, y0 + x);
- add_door(x0, y0 + y);
- add_door(x0, y0 - x);
- add_door(x0, y0 - y);
-
- /* Fill with stuff - medium difficulty */
- fill_treasure(x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
-}
-
-
-#ifdef ALLOW_CAVERNS_AND_LAKES
-/*
- * This routine uses a modified version of the lake code to make a
- * distribution of some terrain type over the vault. This type
- * depends on the dungeon depth.
- *
- * Miniture rooms are then scattered across the vault.
- */
-static void build_elemental_vault(int x0, int y0, int xsiz, int ysiz)
-{
- int grd, roug;
- int c1, c2, c3;
- bool done = FALSE;
- int xsize, ysize, xhsize, yhsize, x, y, i;
- int type;
-
- msg_print_wizard(CHEAT_DUNGEON, _("精霊界ランダムVaultを生成しました。", "Elemental Vault"));
-
- /* round to make sizes even */
- xhsize = xsiz / 2;
- yhsize = ysiz / 2;
- xsize = xhsize * 2;
- ysize = yhsize * 2;
-
- if (dun_level < 25)
- {
- /* Earth vault (Rubble) */
- type = LAKE_T_EARTH_VAULT;
- }
- else if (dun_level < 50)
- {
- /* Air vault (Trees) */
- type = LAKE_T_AIR_VAULT;
- }
- else if (dun_level < 75)
- {
- /* Water vault (shallow water) */
- type = LAKE_T_WATER_VAULT;
- }
- else
- {
- /* Fire vault (shallow lava) */
- type = LAKE_T_FIRE_VAULT;
- }
-
- while (!done)
- {
- /* testing values for these parameters: feel free to adjust */
- grd = 1 << (randint0(3));
-
- /* want average of about 16 */
- roug = randint1(8) * randint1(4);
-
- /* Make up size of various componants */
- /* Floor */
- c3 = 2 * xsize / 3;
-
- /* Deep water/lava */
- c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
-
- /* Shallow boundary */
- c2 = (c1 + c3) / 2;
-
- /* make it */
- generate_hmap(y0, x0, xsize, ysize, grd, roug, c3);
-
- /* Convert to normal format+ clean up */
- done = generate_lake(y0, x0, xsize, ysize, c1, c2, c3, type);
- }
-
- /* Set icky flag because is a vault */
- for (x = 0; x <= xsize; x++)
- {
- for (y = 0; y <= ysize; y++)
- {
- cave[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY;
- }
- }
-
- /* make a few rooms in the vault */
- for (i = 1; i <= (xsize * ysize) / 50; i++)
- {
- build_small_room(x0 + randint0(xsize - 4) - xsize / 2 + 2,
- y0 + randint0(ysize - 4) - ysize / 2 + 2);
- }
-
- /* Fill with monsters and treasure, low difficulty */
- fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1,
- y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
-}
-#endif /* ALLOW_CAVERNS_AND_LAKES */
-
-
-/*!
- * @brief タイプ10の部屋…ランダム生成vault / Type 10 -- Random vaults
- * @return なし
- */
-static bool build_type10(void)
-{
- POSITION y0, x0, xsize, ysize, vtype;
-
- /* Get size */
- /* big enough to look good, small enough to be fairly common. */
- xsize = randint1(22) + 22;
- ysize = randint1(11) + 11;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(&y0, &x0, ysize + 1, xsize + 1)) return FALSE;
-
- /* Select type of vault */
-#ifdef ALLOW_CAVERNS_AND_LAKES
- do
- {
- vtype = randint1(15);
- }
- while ((d_info[dungeon_type].flags1 & DF1_NO_CAVE) &&
- ((vtype == 1) || (vtype == 3) || (vtype == 8) || (vtype == 9) || (vtype == 11)));
-#else /* ALLOW_CAVERNS_AND_LAKES */
- do
- {
- vtype = randint1(7);
- }
- while ((d_info[dungeon_type].flags1 & DF1_NO_CAVE) &&
- ((vtype == 1) || (vtype == 3)));
-#endif /* ALLOW_CAVERNS_AND_LAKES */
-
- switch (vtype)
- {
- /* Build an appropriate room */
- case 1: case 9: build_bubble_vault(x0, y0, xsize, ysize); break;
- case 2: case 10: build_room_vault(x0, y0, xsize, ysize); break;
- case 3: case 11: build_cave_vault(x0, y0, xsize, ysize); break;
- case 4: case 12: build_maze_vault(x0, y0, xsize, ysize, TRUE); break;
- case 5: case 13: build_mini_c_vault(x0, y0, xsize, ysize); break;
- case 6: case 14: build_castle_vault(x0, y0, xsize, ysize); break;
- case 7: case 15: build_target_vault(x0, y0, xsize, ysize); break;
-#ifdef ALLOW_CAVERNS_AND_LAKES
- case 8: build_elemental_vault(x0, y0, xsize, ysize); break;
-#endif /* ALLOW_CAVERNS_AND_LAKES */
- /* I know how to add a few more... give me some time. */
-
- /* Paranoia */
- default: return FALSE;
- }
-
- return TRUE;
-}
-
-
-
-/*!
- * @brief タイプ14の部屋…特殊トラップ部屋の生成 / Type 14 -- trapped rooms
- * @return なし
- * @details
- * A special trap is placed at center of the room
- */
-static bool build_type14(void)
-{
- POSITION y, x, y2, x2, yval, xval;
- POSITION y1, x1, xsize, ysize;
-
- bool light;
-
- cave_type *c_ptr;
- s16b trap;
-
- /* Pick a room size */
- y1 = randint1(4);
- x1 = randint1(11);
- y2 = randint1(3);
- x2 = randint1(11);
-
- xsize = x1 + x2 + 1;
- ysize = y1 + y2 + 1;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
-
- /* Choose lite or dark */
- light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
-
-
- /* Get corner values */
- y1 = yval - ysize / 2;
- x1 = xval - xsize / 2;
- y2 = yval + (ysize - 1) / 2;
- x2 = xval + (xsize - 1) / 2;
-
-
- /* Place a full floor under the room */
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- c_ptr = &cave[y][x];
- place_floor_grid(c_ptr);
- c_ptr->info |= (CAVE_ROOM);
- if (light) c_ptr->info |= (CAVE_GLOW);
- }
- }
-
- /* Walls around the room */
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- c_ptr = &cave[y][x1 - 1];
- place_outer_grid(c_ptr);
- c_ptr = &cave[y][x2 + 1];
- place_outer_grid(c_ptr);
- }
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- c_ptr = &cave[y1 - 1][x];
- place_outer_grid(c_ptr);
- c_ptr = &cave[y2 + 1][x];
- place_outer_grid(c_ptr);
- }
-
- if (dun_level < 30 + randint1(30))
- trap = feat_trap_piranha;
- else
- trap = feat_trap_armageddon;
-
- /* Place a special trap */
- c_ptr = &cave[rand_spread(yval, ysize/4)][rand_spread(xval, xsize/4)];
- c_ptr->mimic = c_ptr->feat;
- c_ptr->feat = trap;
-
- msg_format_wizard(CHEAT_DUNGEON, _("%sの部屋が生成されました。", "Room of %s was generated."), f_name + f_info[trap].name);
-
- return TRUE;
-}
-
-
-/*
- * Helper function for "glass room"
- */
-static bool vault_aux_lite(MONRACE_IDX r_idx)
-{
- monster_race *r_ptr = &r_info[r_idx];
-
- /* Validate the monster */
- if (!vault_monster_okay(r_idx)) return FALSE;
-
- /* Require lite attack */
- if (!(r_ptr->flags4 & RF4_BR_LITE) && !(r_ptr->a_ability_flags1 & RF5_BA_LITE)) return FALSE;
-
- /* No wall passing monsters */
- if (r_ptr->flags2 & (RF2_PASS_WALL | RF2_KILL_WALL)) return FALSE;
-
- /* No disintegrating monsters */
- if (r_ptr->flags4 & RF4_BR_DISI) return FALSE;
-
- return TRUE;
-}
-
-/*
- * Helper function for "glass room"
- */
-static bool vault_aux_shards(MONRACE_IDX r_idx)
-{
- monster_race *r_ptr = &r_info[r_idx];
-
- /* Validate the monster */
- if (!vault_monster_okay(r_idx)) return FALSE;
-
- /* Require shards breath attack */
- if (!(r_ptr->flags4 & RF4_BR_SHAR)) return FALSE;
-
- return TRUE;
-}
-
-/*
- * Hack -- determine if a template is potion
- */
-static bool kind_is_potion(KIND_OBJECT_IDX k_idx)
-{
- return k_info[k_idx].tval == TV_POTION;
-}
-
-/*!
- * @brief タイプ15の部屋…ガラス部屋の生成 / Type 15 -- glass rooms
- * @return なし
- */
-static bool build_type15(void)
-{
- POSITION y, x, y2, x2, yval, xval;
- POSITION y1, x1, xsize, ysize;
- bool light;
-
- cave_type *c_ptr;
-
- /* Pick a room size */
- xsize = rand_range(9, 13);
- ysize = rand_range(9, 13);
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
-
- /* Choose lite or dark */
- light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
-
- /* Get corner values */
- y1 = yval - ysize / 2;
- x1 = xval - xsize / 2;
- y2 = yval + (ysize - 1) / 2;
- x2 = xval + (xsize - 1) / 2;
-
- /* Place a full floor under the room */
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- c_ptr = &cave[y][x];
- place_floor_grid(c_ptr);
- c_ptr->feat = feat_glass_floor;
- c_ptr->info |= (CAVE_ROOM);
- if (light) c_ptr->info |= (CAVE_GLOW);
- }
- }
-
- /* Walls around the room */
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- c_ptr = &cave[y][x1 - 1];
- place_outer_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- c_ptr = &cave[y][x2 + 1];
- place_outer_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- }
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- c_ptr = &cave[y1 - 1][x];
- place_outer_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- c_ptr = &cave[y2 + 1][x];
- place_outer_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- }
-
- switch (randint1(3))
- {
- case 1: /* 4 lite breathers + potion */
- {
- int dir1, dir2;
-
- /* Prepare allocation table */
- get_mon_num_prep(vault_aux_lite, NULL);
-
- /* Place fixed lite berathers */
- for (dir1 = 4; dir1 < 8; dir1++)
- {
- MONRACE_IDX r_idx = get_mon_num(dun_level);
-
- y = yval + 2 * ddy_ddd[dir1];
- x = xval + 2 * ddx_ddd[dir1];
- if (r_idx) place_monster_aux(0, y, x, r_idx, PM_ALLOW_SLEEP);
-
- /* Walls around the breather */
- for (dir2 = 0; dir2 < 8; dir2++)
- {
- c_ptr = &cave[y + ddy_ddd[dir2]][x + ddx_ddd[dir2]];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- }
- }
-
- /* Walls around the potion */
- for (dir1 = 0; dir1 < 4; dir1++)
- {
- y = yval + 2 * ddy_ddd[dir1];
- x = xval + 2 * ddx_ddd[dir1];
- c_ptr = &cave[y][x];
- place_inner_perm_grid(c_ptr);
- c_ptr->feat = feat_permanent_glass_wall;
- cave[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]].info |= (CAVE_ICKY);
- }
-
- /* Glass door */
- dir1 = randint0(4);
- y = yval + 2 * ddy_ddd[dir1];
- x = xval + 2 * ddx_ddd[dir1];
- place_secret_door(y, x, DOOR_GLASS_DOOR);
- c_ptr = &cave[y][x];
- if (is_closed_door(c_ptr->feat)) c_ptr->mimic = feat_glass_wall;
-
- /* Place a potion */
- get_obj_num_hook = kind_is_potion;
- place_object(yval, xval, AM_NO_FIXED_ART);
- cave[yval][xval].info |= (CAVE_ICKY);
- }
- break;
-
- case 2: /* 1 lite breather + random object */
- {
- MONRACE_IDX r_idx;
- DIRECTION dir1;
-
- /* Pillars */
- c_ptr = &cave[y1 + 1][x1 + 1];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
-
- c_ptr = &cave[y1 + 1][x2 - 1];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
-
- c_ptr = &cave[y2 - 1][x1 + 1];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
-
- c_ptr = &cave[y2 - 1][x2 - 1];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
-
- /* Prepare allocation table */
- get_mon_num_prep(vault_aux_lite, NULL);
-
- r_idx = get_mon_num(dun_level);
- if (r_idx) place_monster_aux(0, yval, xval, r_idx, 0L);
-
- /* Walls around the breather */
- for (dir1 = 0; dir1 < 8; dir1++)
- {
- c_ptr = &cave[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- }
-
- /* Curtains around the breather */
- for (y = yval - 1; y <= yval + 1; y++)
- {
- place_closed_door(y, xval - 2, DOOR_CURTAIN);
- place_closed_door(y, xval + 2, DOOR_CURTAIN);
- }
- for (x = xval - 1; x <= xval + 1; x++)
- {
- place_closed_door(yval - 2, x, DOOR_CURTAIN);
- place_closed_door(yval + 2, x, DOOR_CURTAIN);
- }
-
- /* Place an object */
- place_object(yval, xval, AM_NO_FIXED_ART);
- cave[yval][xval].info |= (CAVE_ICKY);
- }
- break;
-
- case 3: /* 4 shards breathers + 2 potions */
- {
- int dir1;
-
- /* Walls around the potion */
- for (y = yval - 2; y <= yval + 2; y++)
- {
- c_ptr = &cave[y][xval - 3];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- c_ptr = &cave[y][xval + 3];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- }
- for (x = xval - 2; x <= xval + 2; x++)
- {
- c_ptr = &cave[yval - 3][x];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- c_ptr = &cave[yval + 3][x];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- }
- for (dir1 = 4; dir1 < 8; dir1++)
- {
- c_ptr = &cave[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]];
- place_inner_grid(c_ptr);
- c_ptr->feat = feat_glass_wall;
- }
-
- /* Prepare allocation table */
- get_mon_num_prep(vault_aux_shards, NULL);
-
- /* Place shard berathers */
- for (dir1 = 4; dir1 < 8; dir1++)
- {
- MONRACE_IDX r_idx = get_mon_num(dun_level);
-
- y = yval + ddy_ddd[dir1];
- x = xval + ddx_ddd[dir1];
- if (r_idx) place_monster_aux(0, y, x, r_idx, 0L);
- }
-
- /* Place two potions */
- if (one_in_(2))
- {
- get_obj_num_hook = kind_is_potion;
- place_object(yval, xval - 1, AM_NO_FIXED_ART);
- get_obj_num_hook = kind_is_potion;
- place_object(yval, xval + 1, AM_NO_FIXED_ART);
- }
- else
- {
- get_obj_num_hook = kind_is_potion;
- place_object(yval - 1, xval, AM_NO_FIXED_ART);
- get_obj_num_hook = kind_is_potion;
- place_object(yval + 1, xval, AM_NO_FIXED_ART);
- }
-
- for (y = yval - 2; y <= yval + 2; y++)
- for (x = xval - 2; x <= xval + 2; x++)
- cave[y][x].info |= (CAVE_ICKY);
-
- }
- break;
- }
-
- msg_print_wizard(CHEAT_DUNGEON, _("ガラスの部屋が生成されました。", "Glass room was generated."));
-
- return TRUE;
-}