#include "rooms.h"
#include "floor-streams.h"
#include "trap.h"
+#include "monster.h"
+#include "quest.h"
int dun_tun_rnd;
int dun_tun_chg;
/* No up stairs in town or in ironman mode */
if (ironman_downward || !dun_level) return TRUE;
- if (dun_level > d_info[dungeon_type].mindepth)
+ if (dun_level > d_info[p_ptr->dungeon_idx].mindepth)
shaft_num = (randint1(num+1))/2;
}
else if (have_flag(f_ptr->flags, FF_MORE))
}
/* No downstairs at the bottom */
- if (dun_level >= d_info[dungeon_type].maxdepth) return TRUE;
+ if (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) return TRUE;
- if ((dun_level < d_info[dungeon_type].maxdepth-1) && !quest_number(dun_level+1))
+ if ((dun_level < d_info[p_ptr->dungeon_idx].maxdepth-1) && !quest_number(dun_level+1))
shaft_num = (randint1(num)+1)/2;
}
(quest[i].type != QUEST_TYPE_KILL_LEVEL &&
quest[i].type != QUEST_TYPE_RANDOM) ||
quest[i].level != dun_level ||
- dungeon_type != quest[i].dungeon ||
+ p_ptr->dungeon_idx != quest[i].dungeon ||
(quest[i].flags & QUEST_FLAG_PRESET))
{
/* Ignore it */
{
#ifdef ALLOW_CAVERNS_AND_LAKES
/* Possible "destroyed" level */
- if ((dun_level > 30) && one_in_(DUN_DEST*2) && (small_levels) && (d_info[dungeon_type].flags1 & DF1_DESTROY))
+ if ((dun_level > 30) && one_in_(DUN_DEST*2) && (small_levels) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_DESTROY))
{
dun->destroyed = TRUE;
/* Make a lake some of the time */
if (one_in_(LAKE_LEVEL) && !dun->empty_level && !dun->destroyed &&
- (d_info[dungeon_type].flags1 & DF1_LAKE_MASK))
+ (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_MASK))
{
int count = 0;
- if (d_info[dungeon_type].flags1 & DF1_LAKE_WATER) count += 3;
- if (d_info[dungeon_type].flags1 & DF1_LAKE_LAVA) count += 3;
- if (d_info[dungeon_type].flags1 & DF1_LAKE_RUBBLE) count += 3;
- if (d_info[dungeon_type].flags1 & DF1_LAKE_TREE) count += 3;
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_WATER) count += 3;
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_LAVA) count += 3;
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_RUBBLE) count += 3;
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_TREE) count += 3;
- if (d_info[dungeon_type].flags1 & DF1_LAKE_LAVA)
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_LAVA)
{
/* Lake of Lava */
if ((dun_level > 80) && (randint0(count) < 2)) dun->laketype = LAKE_T_LAVA;
count--;
}
- if ((d_info[dungeon_type].flags1 & DF1_LAKE_WATER) && !dun->laketype)
+ if ((d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_WATER) && !dun->laketype)
{
/* Lake of Water */
if ((dun_level > 50) && randint0(count) < 2) dun->laketype = LAKE_T_WATER;
count--;
}
- if ((d_info[dungeon_type].flags1 & DF1_LAKE_RUBBLE) && !dun->laketype)
+ if ((d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_RUBBLE) && !dun->laketype)
{
/* Lake of rubble */
if ((dun_level > 35) && (randint0(count) < 2)) dun->laketype = LAKE_T_CAVE;
}
/* Lake of tree */
- if ((dun_level > 5) && (d_info[dungeon_type].flags1 & DF1_LAKE_TREE) && !dun->laketype) dun->laketype = LAKE_T_AIR_VAULT;
+ if ((dun_level > 5) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_TREE) && !dun->laketype) dun->laketype = LAKE_T_AIR_VAULT;
if (dun->laketype)
{
}
if ((dun_level > DUN_CAVERN) && !dun->empty_level &&
- (d_info[dungeon_type].flags1 & DF1_CAVERN) &&
+ (d_info[p_ptr->dungeon_idx].flags1 & DF1_CAVERN) &&
!dun->laketype && !dun->destroyed && (randint1(1000) < dun_level))
{
dun->cavern = TRUE;
dun->laketype = 0;
/* Fill the arrays of floors and walls in the good proportions */
- set_floor_and_wall(dungeon_type);
-
- /* Prepare allocation table */
+ set_floor_and_wall(p_ptr->dungeon_idx);
get_mon_num_prep(get_monster_hook(), NULL);
/* Randomize the dungeon creation values */
dun->cent_n = 0;
/* Empty arena levels */
- if (ironman_empty_levels || ((d_info[dungeon_type].flags1 & DF1_ARENA) && (empty_levels && one_in_(EMPTY_LEVEL))))
+ if (ironman_empty_levels || ((d_info[p_ptr->dungeon_idx].flags1 & DF1_ARENA) && (empty_levels && one_in_(EMPTY_LEVEL))))
{
dun->empty_level = TRUE;
msg_print_wizard(CHEAT_DUNGEON, _("アリーナレベルを生成。", "Arena level."));
/* Build maze */
- if (d_info[dungeon_type].flags1 & DF1_MAZE)
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_MAZE)
{
build_maze_vault(cur_wid/2-1, cur_hgt/2-1, cur_wid-4, cur_hgt-4, FALSE);
FEAT_IDX feat1 = 0, feat2 = 0;
/* Choose water mainly */
- if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_type].flags1 & DF1_WATER_RIVER))
+ if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_WATER_RIVER))
{
feat1 = feat_deep_water;
feat2 = feat_shallow_water;
FEAT_IDX select_shallow_feat[10];
int select_id_max = 0, selected;
- if (d_info[dungeon_type].flags1 & DF1_LAVA_RIVER)
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAVA_RIVER)
{
select_deep_feat[select_id_max] = feat_deep_lava;
select_shallow_feat[select_id_max] = feat_shallow_lava;
select_id_max++;
}
- if (d_info[dungeon_type].flags1 & DF1_POISONOUS_RIVER)
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_POISONOUS_RIVER)
{
select_deep_feat[select_id_max] = feat_deep_poisonous_puddle;
select_shallow_feat[select_id_max] = feat_shallow_poisonous_puddle;
select_id_max++;
}
- if (d_info[dungeon_type].flags1 & DF1_ACID_RIVER)
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_ACID_RIVER)
{
select_deep_feat[select_id_max] = feat_deep_acid_puddle;
select_shallow_feat[select_id_max] = feat_shallow_acid_puddle;
select_id_max++;
}
- selected = randint1(select_id_max);
+ selected = randint0(select_id_max);
feat1 = select_deep_feat[selected];
feat2 = select_shallow_feat[selected];
}
dun->wall_n = 0;
/* Connect the room to the previous room */
- if (randint1(dun_level) > d_info[dungeon_type].tunnel_percent)
+ if (randint1(dun_level) > d_info[p_ptr->dungeon_idx].tunnel_percent)
{
/* make cave-like tunnel */
(void)build_tunnel2(dun->cent[i].x, dun->cent[i].y, x, y, 2, 2);
place_floor_grid(c_ptr);
/* Occasional doorway */
- if ((randint0(100) < dun_tun_pen) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
+ if ((randint0(100) < dun_tun_pen) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS))
{
/* Place a random door */
place_random_door(y, x, TRUE);
if (!dun->laketype)
{
- if (d_info[dungeon_type].stream2)
+ if (d_info[p_ptr->dungeon_idx].stream2)
{
/* Hack -- Add some quartz streamers */
for (i = 0; i < DUN_STR_QUA; i++)
{
- build_streamer(d_info[dungeon_type].stream2, DUN_STR_QC);
+ build_streamer(d_info[p_ptr->dungeon_idx].stream2, DUN_STR_QC);
}
}
- if (d_info[dungeon_type].stream1)
+ if (d_info[p_ptr->dungeon_idx].stream1)
{
/* Hack -- Add some magma streamers */
for (i = 0; i < DUN_STR_MAG; i++)
{
- build_streamer(d_info[dungeon_type].stream1, DUN_STR_MC);
+ build_streamer(d_info[p_ptr->dungeon_idx].stream1, DUN_STR_MC);
}
}
}
if (k < 2) k = 2;
/* Pick a base number of monsters */
- i = d_info[dungeon_type].min_m_alloc_level;
+ i = d_info[p_ptr->dungeon_idx].min_m_alloc_level;
/* To make small levels a bit more playable */
if (cur_hgt < MAX_HGT || cur_wid < MAX_WID)
alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint1(k));
/* Put some rubble in corridors (except NO_CAVE dungeon (Castle)) */
- if (!(d_info[dungeon_type].flags1 & DF1_NO_CAVE)) alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint1(k));
+ if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE)) alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint1(k));
/* Mega Hack -- No object at first level of deeper dungeon */
if (p_ptr->enter_dungeon && dun_level > 1)
/* Put the Guardian */
if (!alloc_guardian(TRUE)) return FALSE;
- if (dun->empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+ if (dun->empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
{
/* Lite the cave */
for (y = 0; y < cur_hgt; y++)
if (!m_ptr->r_idx) continue;
- /* Hack -- Detect monster */
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(i, FALSE);
}
monster_level = base_level;
if (record_stair) do_cmd_write_nikki(NIKKI_TO_QUEST, p_ptr->inside_quest, NULL);
-
- /* Prepare allocation table */
get_mon_num_prep(get_monster_hook(), NULL);
init_flags = INIT_CREATE_DUNGEON;
* @brief ダンジョン時のランダムフロア生成 / Make a real level
* @return フロアの生成に成功したらTRUE
*/
-static bool level_gen(cptr *why)
+static bool level_gen(concptr *why)
{
int level_height, level_width;
if ((always_small_levels || ironman_small_levels ||
(one_in_(SMALL_LEVEL) && small_levels) ||
- (d_info[dungeon_type].flags1 & DF1_BEGINNER) ||
- (d_info[dungeon_type].flags1 & DF1_SMALLEST)) &&
- !(d_info[dungeon_type].flags1 & DF1_BIG))
+ (d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER) ||
+ (d_info[p_ptr->dungeon_idx].flags1 & DF1_SMALLEST)) &&
+ !(d_info[p_ptr->dungeon_idx].flags1 & DF1_BIG))
{
- if (d_info[dungeon_type].flags1 & DF1_SMALLEST)
+ if (d_info[p_ptr->dungeon_idx].flags1 & DF1_SMALLEST)
{
level_height = 1;
level_width = 1;
}
- else if (d_info[dungeon_type].flags1 & DF1_BEGINNER)
+ else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER)
{
level_height = 2;
level_width = 2;
int num;
/* Fill the arrays of floors and walls in the good proportions */
- set_floor_and_wall(dungeon_type);
+ set_floor_and_wall(p_ptr->dungeon_idx);
/* Generate */
for (num = 0; TRUE; num++)
{
bool okay = TRUE;
- cptr why = NULL;
+ concptr why = NULL;
/* Clear and empty the cave */
clear_cave();