From: Deskull Date: Sat, 9 Feb 2019 09:43:03 +0000 (+0900) Subject: [Refactor] #37353 dungeon_idx を player_type 構造体に編入。 / Enter dungeon_idx to player_typ... X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=0dbae6f56c7024ac1985958dd99c5f9936b2116b [Refactor] #37353 dungeon_idx を player_type 構造体に編入。 / Enter dungeon_idx to player_type structure. --- diff --git a/src/birth.c b/src/birth.c index 05c2ce4d8..2df5679d3 100644 --- a/src/birth.c +++ b/src/birth.c @@ -1815,7 +1815,7 @@ static void player_wipe_without_name(void) /* Reset virtues */ for (i = 0; i < 8; i++) p_ptr->virtues[i]=0; - dungeon_idx = 0; + p_ptr->dungeon_idx = 0; /* Set the recall dungeon accordingly */ if (vanilla_town || ironman_downward) diff --git a/src/cave.c b/src/cave.c index dcb69a488..5a8a76ad5 100644 --- a/src/cave.c +++ b/src/cave.c @@ -2960,7 +2960,7 @@ void update_mon_lite(void) s16b end_temp; /* Non-Ninja player in the darkness */ - int dis_lim = ((d_info[dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto) ? + int dis_lim = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto) ? (MAX_SIGHT / 2 + 1) : (MAX_SIGHT + 3); /* Clear all monster lit squares */ @@ -3011,7 +3011,7 @@ void update_mon_lite(void) else if (rad > 0) { if (!(r_ptr->flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2)) && (MON_CSLEEP(m_ptr) || (!dun_level && is_daytime()) || p_ptr->inside_battle)) continue; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) rad = 1; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) rad = 1; add_mon_lite = mon_lite_hack; f_flag = FF_LOS; } @@ -4255,7 +4255,7 @@ void map_area(POSITION range) FEAT_IDX feat; feature_type *f_ptr; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; /* Scan that area */ for (y = 1; y < cur_hgt - 1; y++) @@ -4379,7 +4379,7 @@ void wiz_lite(bool ninja) f_ptr = &f_info[get_feat_mimic(c_ptr)]; /* Perma-lite the grid */ - if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS) && !ninja) + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !ninja) { c_ptr->info |= (CAVE_GLOW); } @@ -4495,7 +4495,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) c_ptr->feat = feat; /* Hack -- glow the GLOW terrain */ - if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) + if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) { DIRECTION i; POSITION yy, xx; @@ -4524,7 +4524,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) /* Remove flag for mirror/glyph */ c_ptr->info &= ~(CAVE_OBJECT); - if (old_mirror && (d_info[dungeon_idx].flags1 & DF1_DARKNESS)) + if (old_mirror && (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) { c_ptr->info &= ~(CAVE_GLOW); if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK); @@ -4555,7 +4555,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) } /* Hack -- glow the GLOW terrain */ - if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) + if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) { DIRECTION i; POSITION yy, xx; @@ -4608,9 +4608,9 @@ FEAT_IDX conv_dungeon_feat(FEAT_IDX newfeat) case CONVERT_TYPE_SOLID: return feat_wall_solid; case CONVERT_TYPE_STREAM1: - return d_info[dungeon_idx].stream1; + return d_info[p_ptr->dungeon_idx].stream1; case CONVERT_TYPE_STREAM2: - return d_info[dungeon_idx].stream2; + return d_info[p_ptr->dungeon_idx].stream2; default: return newfeat; } @@ -4707,7 +4707,7 @@ void remove_mirror(POSITION y, POSITION x) c_ptr->info &= ~(CAVE_OBJECT); c_ptr->mimic = 0; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) { c_ptr->info &= ~(CAVE_GLOW); if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK); @@ -5016,7 +5016,7 @@ void glow_deep_lava_and_bldg(void) cave_type *c_ptr; /* Not in the darkness dungeon */ - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) return; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) return; for (y = 0; y < cur_hgt; y++) { diff --git a/src/cmd2.c b/src/cmd2.c index 30c4406b9..6d806a50b 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -59,7 +59,7 @@ bool confirm_leave_level(bool down_stair) */ bool cmd_limit_cast(player_type *creature_ptr) { - if (dun_level && (d_info[dungeon_idx].flags1 & DF1_NO_MAGIC)) + if (dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC)) { msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!")); msg_print(NULL); @@ -240,7 +240,7 @@ void do_cmd_go_up(void) } /* Get out from current dungeon */ - if (dun_level - up_num < d_info[dungeon_idx].mindepth) + if (dun_level - up_num < d_info[p_ptr->dungeon_idx].mindepth) up_num = dun_level; } if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to")); @@ -355,7 +355,7 @@ void do_cmd_go_down(void) /* Save old player position */ p_ptr->oldpx = p_ptr->x; p_ptr->oldpy = p_ptr->y; - dungeon_idx = target_dungeon; + p_ptr->dungeon_idx = target_dungeon; /* * Clear all saved floors @@ -376,7 +376,7 @@ void do_cmd_go_down(void) { /* Enter the dungeon just now */ p_ptr->enter_dungeon = TRUE; - down_num = d_info[dungeon_idx].mindepth; + down_num = d_info[p_ptr->dungeon_idx].mindepth; } if (record_stair) @@ -394,7 +394,7 @@ void do_cmd_go_down(void) /* Success */ if (target_dungeon) { - msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[dungeon_idx].text); + msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[p_ptr->dungeon_idx].text); } else { diff --git a/src/cmd4.c b/src/cmd4.c index 52cd6e923..511c264f7 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -439,9 +439,9 @@ errr do_cmd_write_nikki(int type, int num, concptr note) else { #ifdef JP - sprintf(note_level_buf, "%d階(%s):", (int)dun_level, d_name+d_info[dungeon_idx].name); + sprintf(note_level_buf, "%d階(%s):", (int)dun_level, d_name+d_info[p_ptr->dungeon_idx].name); #else - sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_idx].name, (int)dun_level); + sprintf(note_level_buf, "%s L%d:", d_name+d_info[p_ptr->dungeon_idx].name, (int)dun_level); #endif note_level = note_level_buf; } @@ -516,8 +516,8 @@ errr do_cmd_write_nikki(int type, int num, concptr note) { fprintf(fff, _(" %2d:%02d %20s %sの最深階%d階に到達した。\n", " %2d:%02d %20s reached level %d of %s for the first time.\n"), hour, min, note_level, - _(d_name+d_info[dungeon_idx].name, num), - _(num, d_name+d_info[dungeon_idx].name)); + _(d_name+d_info[p_ptr->dungeon_idx].name, num), + _(num, d_name+d_info[p_ptr->dungeon_idx].name)); break; } case NIKKI_TRUMP: @@ -548,8 +548,8 @@ errr do_cmd_write_nikki(int type, int num, concptr note) { if (!num) fprintf(fff, _(" %2d:%02d %20s 帰還を使って%sの%d階へ下りた。\n", " %2d:%02d %20s recalled to dungeon level %d of %s.\n"), - hour, min, note_level, _(d_name+d_info[dungeon_idx].name, (int)max_dlv[dungeon_idx]), - _((int)max_dlv[dungeon_idx], d_name+d_info[dungeon_idx].name)); + hour, min, note_level, _(d_name+d_info[p_ptr->dungeon_idx].name, (int)max_dlv[p_ptr->dungeon_idx]), + _((int)max_dlv[p_ptr->dungeon_idx], d_name+d_info[p_ptr->dungeon_idx].name)); else fprintf(fff, _(" %2d:%02d %20s 帰還を使って地上へと戻った。\n", " %2d:%02d %20s recalled from dungeon to surface.\n"), hour, min, note_level); break; @@ -608,7 +608,7 @@ errr do_cmd_write_nikki(int type, int num, concptr note) if (!dun_level) to = _("地上", "the surface"); else - to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_idx].name); + to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[p_ptr->dungeon_idx].name); fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n", " %2d:%02d %20s wizard-teleport to %s.\n"), hour, min, note_level, to); @@ -620,7 +620,7 @@ errr do_cmd_write_nikki(int type, int num, concptr note) if (!dun_level) to = _("地上", "the surface"); else - to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_idx].name); + to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[p_ptr->dungeon_idx].name); fprintf(fff, _(" %2d:%02d %20s %sへとパターンの力で移動した。\n", " %2d:%02d %20s used Pattern to teleport to %s.\n"), hour, min, note_level, to); diff --git a/src/defines.h b/src/defines.h index d620a673d..ee010e320 100644 --- a/src/defines.h +++ b/src/defines.h @@ -4684,7 +4684,7 @@ extern int PlayerUID; #define TELE_LEVEL_IS_INEFF(TARGET) \ (p_ptr->inside_arena || p_ptr->inside_battle || \ (p_ptr->inside_quest && !random_quest_number(dun_level)) || \ - (((TARGET) <= 0) && (quest_number(dun_level) || (dun_level >= d_info[dungeon_idx].maxdepth)) && \ + (((TARGET) <= 0) && (quest_number(dun_level) || (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) && \ (dun_level >= 1) && ironman_downward)) diff --git a/src/dungeon.c b/src/dungeon.c index 450b7eed3..eaf1c2855 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -539,7 +539,7 @@ static void pattern_teleport(void) min_level = dun_level; /* Maximum level */ - if (dungeon_idx == DUNGEON_ANGBAND) + if (p_ptr->dungeon_idx == DUNGEON_ANGBAND) { if (dun_level > 100) max_level = MAX_DEPTH - 1; @@ -548,8 +548,8 @@ static void pattern_teleport(void) } else { - max_level = d_info[dungeon_idx].maxdepth; - min_level = d_info[dungeon_idx].mindepth; + max_level = d_info[p_ptr->dungeon_idx].maxdepth; + min_level = d_info[p_ptr->dungeon_idx].mindepth; } /* Prompt */ @@ -3001,12 +3001,12 @@ static void process_world_aux_movement(void) { msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!")); - if (dungeon_idx) p_ptr->recall_dungeon = dungeon_idx; + if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx; if (record_stair) do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL); dun_level = 0; - dungeon_idx = 0; + p_ptr->dungeon_idx = 0; leave_quest_check(); leave_tower_check(); @@ -3019,17 +3019,17 @@ static void process_world_aux_movement(void) { msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!")); - dungeon_idx = p_ptr->recall_dungeon; + p_ptr->dungeon_idx = p_ptr->recall_dungeon; if (record_stair) do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL); /* New depth */ - dun_level = max_dlv[dungeon_idx]; + dun_level = max_dlv[p_ptr->dungeon_idx]; if (dun_level < 1) dun_level = 1; /* Nightmare mode makes recall more dangerous */ - if (ironman_nightmare && !randint0(666) && (dungeon_idx == DUNGEON_ANGBAND)) + if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND)) { if (dun_level < 50) { @@ -3041,7 +3041,7 @@ static void process_world_aux_movement(void) } else if (dun_level > 100) { - dun_level = d_info[dungeon_idx].maxdepth - 1; + dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1; } } @@ -3067,7 +3067,7 @@ static void process_world_aux_movement(void) /* Leaving */ p_ptr->leaving = TRUE; - if (dungeon_idx == DUNGEON_ANGBAND) + if (p_ptr->dungeon_idx == DUNGEON_ANGBAND) { int i; @@ -3384,10 +3384,10 @@ static void process_world(void) update_dungeon_feeling(); /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/ - if (ironman_downward && (dungeon_idx != DUNGEON_ANGBAND && dungeon_idx != 0)) + if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0)) { dun_level = 0; - dungeon_idx = 0; + p_ptr->dungeon_idx = 0; prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE); p_ptr->inside_arena = FALSE; p_ptr->wild_mode = FALSE; @@ -3576,7 +3576,7 @@ static void process_world(void) /*** Process the monsters ***/ /* Check for creature generation. */ - if (one_in_(d_info[dungeon_idx].max_m_alloc_chance) && + if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) && !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle) { /* Make a new monster */ @@ -4198,7 +4198,7 @@ static void process_command(void) { msg_print(_("呪文を唱えられない!", "You cannot cast spells!")); } - else if (dun_level && (d_info[dungeon_idx].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH)) + else if (dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH)) { msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!")); msg_print(NULL); @@ -5321,9 +5321,9 @@ static void dungeon(bool load_game) /* Track maximum dungeon level (if not in quest -KMW-) */ - if ((max_dlv[dungeon_idx] < dun_level) && !p_ptr->inside_quest) + if ((max_dlv[p_ptr->dungeon_idx] < dun_level) && !p_ptr->inside_quest) { - max_dlv[dungeon_idx] = dun_level; + max_dlv[p_ptr->dungeon_idx] = dun_level; if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL); } @@ -5390,22 +5390,22 @@ static void dungeon(bool load_game) if (!p_ptr->playing || p_ptr->is_dead) return; /* Print quest message if appropriate */ - if (!p_ptr->inside_quest && (dungeon_idx == DUNGEON_ANGBAND)) + if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND)) { quest_discovery(random_quest_number(dun_level)); p_ptr->inside_quest = random_quest_number(dun_level); } - if ((dun_level == d_info[dungeon_idx].maxdepth) && d_info[dungeon_idx].final_guardian) + if ((dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian) { - if (r_info[d_info[dungeon_idx].final_guardian].max_num) + if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num) #ifdef JP msg_format("この階には%sの主である%sが棲んでいる。", - d_name+d_info[dungeon_idx].name, - r_name+r_info[d_info[dungeon_idx].final_guardian].name); + d_name+d_info[p_ptr->dungeon_idx].name, + r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name); #else msg_format("%^s lives in this level as the keeper of %s.", - r_name+r_info[d_info[dungeon_idx].final_guardian].name, - d_name+d_info[dungeon_idx].name); + r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name, + d_name+d_info[p_ptr->dungeon_idx].name); #endif } @@ -5966,7 +5966,7 @@ void play_game(bool new_game) s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER; /* Fill the arrays of floors and walls in the good proportions */ - set_floor_and_wall(dungeon_idx); + set_floor_and_wall(p_ptr->dungeon_idx); /* Flavor the objects */ flavor_init(); diff --git a/src/externs.h b/src/externs.h index 21bba8d11..297d43983 100644 --- a/src/externs.h +++ b/src/externs.h @@ -438,7 +438,6 @@ extern FEAT_IDX feat_mountain; extern FEAT_IDX feat_swamp; extern FEAT_IDX feat_undetected; -extern DUNGEON_IDX dungeon_idx; extern DEPTH *max_dlv; extern FEAT_IDX feat_wall_outer; extern FEAT_IDX feat_wall_inner; diff --git a/src/floor-generate.c b/src/floor-generate.c index e697c80f2..1f01b906d 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -180,7 +180,7 @@ static bool alloc_stairs(IDX feat, int num, int walls) /* No up stairs in town or in ironman mode */ if (ironman_downward || !dun_level) return TRUE; - if (dun_level > d_info[dungeon_idx].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)) @@ -198,9 +198,9 @@ static bool alloc_stairs(IDX feat, int num, int walls) } /* No downstairs at the bottom */ - if (dun_level >= d_info[dungeon_idx].maxdepth) return TRUE; + if (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) return TRUE; - if ((dun_level < d_info[dungeon_idx].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; } @@ -390,7 +390,7 @@ bool place_quest_monsters(void) (quest[i].type != QUEST_TYPE_KILL_LEVEL && quest[i].type != QUEST_TYPE_RANDOM) || quest[i].level != dun_level || - dungeon_idx != quest[i].dungeon || + p_ptr->dungeon_idx != quest[i].dungeon || (quest[i].flags & QUEST_FLAG_PRESET)) { /* Ignore it */ @@ -499,7 +499,7 @@ static void gen_caverns_and_lakes(void) { #ifdef ALLOW_CAVERNS_AND_LAKES /* Possible "destroyed" level */ - if ((dun_level > 30) && one_in_(DUN_DEST*2) && (small_levels) && (d_info[dungeon_idx].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; @@ -509,15 +509,15 @@ static void gen_caverns_and_lakes(void) /* Make a lake some of the time */ if (one_in_(LAKE_LEVEL) && !dun->empty_level && !dun->destroyed && - (d_info[dungeon_idx].flags1 & DF1_LAKE_MASK)) + (d_info[p_ptr->dungeon_idx].flags1 & DF1_LAKE_MASK)) { int count = 0; - if (d_info[dungeon_idx].flags1 & DF1_LAKE_WATER) count += 3; - if (d_info[dungeon_idx].flags1 & DF1_LAKE_LAVA) count += 3; - if (d_info[dungeon_idx].flags1 & DF1_LAKE_RUBBLE) count += 3; - if (d_info[dungeon_idx].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_idx].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; @@ -528,7 +528,7 @@ static void gen_caverns_and_lakes(void) count--; } - if ((d_info[dungeon_idx].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; @@ -539,7 +539,7 @@ static void gen_caverns_and_lakes(void) count--; } - if ((d_info[dungeon_idx].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; @@ -551,7 +551,7 @@ static void gen_caverns_and_lakes(void) } /* Lake of tree */ - if ((dun_level > 5) && (d_info[dungeon_idx].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) { @@ -561,7 +561,7 @@ static void gen_caverns_and_lakes(void) } if ((dun_level > DUN_CAVERN) && !dun->empty_level && - (d_info[dungeon_idx].flags1 & DF1_CAVERN) && + (d_info[p_ptr->dungeon_idx].flags1 & DF1_CAVERN) && !dun->laketype && !dun->destroyed && (randint1(1000) < dun_level)) { dun->cavern = TRUE; @@ -598,7 +598,7 @@ static bool cave_gen(void) dun->laketype = 0; /* Fill the arrays of floors and walls in the good proportions */ - set_floor_and_wall(dungeon_idx); + set_floor_and_wall(p_ptr->dungeon_idx); get_mon_num_prep(get_monster_hook(), NULL); /* Randomize the dungeon creation values */ @@ -625,7 +625,7 @@ static bool cave_gen(void) dun->cent_n = 0; /* Empty arena levels */ - if (ironman_empty_levels || ((d_info[dungeon_idx].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.")); @@ -674,7 +674,7 @@ static bool cave_gen(void) /* Build maze */ - if (d_info[dungeon_idx].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); @@ -714,7 +714,7 @@ static bool cave_gen(void) FEAT_IDX feat1 = 0, feat2 = 0; /* Choose water mainly */ - if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_idx].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; @@ -725,19 +725,19 @@ static bool cave_gen(void) FEAT_IDX select_shallow_feat[10]; int select_id_max = 0, selected; - if (d_info[dungeon_idx].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_idx].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_idx].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; @@ -794,7 +794,7 @@ static bool cave_gen(void) dun->wall_n = 0; /* Connect the room to the previous room */ - if (randint1(dun_level) > d_info[dungeon_idx].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); @@ -842,7 +842,7 @@ static bool cave_gen(void) place_floor_grid(c_ptr); /* Occasional doorway */ - if ((randint0(100) < dun_tun_pen) && !(d_info[dungeon_idx].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); @@ -877,21 +877,21 @@ static bool cave_gen(void) if (!dun->laketype) { - if (d_info[dungeon_idx].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_idx].stream2, DUN_STR_QC); + build_streamer(d_info[p_ptr->dungeon_idx].stream2, DUN_STR_QC); } } - if (d_info[dungeon_idx].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_idx].stream1, DUN_STR_MC); + build_streamer(d_info[p_ptr->dungeon_idx].stream1, DUN_STR_MC); } } } @@ -921,7 +921,7 @@ static bool cave_gen(void) if (k < 2) k = 2; /* Pick a base number of monsters */ - i = d_info[dungeon_idx].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) @@ -950,7 +950,7 @@ static bool cave_gen(void) alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint1(k)); /* Put some rubble in corridors (except NO_CAVE dungeon (Castle)) */ - if (!(d_info[dungeon_idx].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) @@ -972,7 +972,7 @@ static bool cave_gen(void) /* Put the Guardian */ if (!alloc_guardian(TRUE)) return FALSE; - if (dun->empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level)) && !(d_info[dungeon_idx].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++) @@ -1248,16 +1248,16 @@ static bool level_gen(concptr *why) if ((always_small_levels || ironman_small_levels || (one_in_(SMALL_LEVEL) && small_levels) || - (d_info[dungeon_idx].flags1 & DF1_BEGINNER) || - (d_info[dungeon_idx].flags1 & DF1_SMALLEST)) && - !(d_info[dungeon_idx].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_idx].flags1 & DF1_SMALLEST) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_SMALLEST) { level_height = 1; level_width = 1; } - else if (d_info[dungeon_idx].flags1 & DF1_BEGINNER) + else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER) { level_height = 2; level_width = 2; @@ -1401,7 +1401,7 @@ void generate_cave(void) int num; /* Fill the arrays of floors and walls in the good proportions */ - set_floor_and_wall(dungeon_idx); + set_floor_and_wall(p_ptr->dungeon_idx); /* Generate */ for (num = 0; TRUE; num++) diff --git a/src/floor-save.c b/src/floor-save.c index d5fde764b..e0102754a 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -878,7 +878,7 @@ void leave_floor(void) ((quest[i].type == QUEST_TYPE_KILL_LEVEL) || (quest[i].type == QUEST_TYPE_RANDOM)) && (quest[i].level == dun_level) && - (dungeon_idx == quest[i].dungeon) && + (p_ptr->dungeon_idx == quest[i].dungeon) && !(quest[i].flags & QUEST_FLAG_PRESET)) { quest_r_idx = quest[i].r_idx; @@ -970,11 +970,11 @@ void leave_floor(void) if (change_floor_mode & CFM_DOWN) { if (!dun_level) - move_num = d_info[dungeon_idx].mindepth; + move_num = d_info[p_ptr->dungeon_idx].mindepth; } else if (change_floor_mode & CFM_UP) { - if (dun_level + move_num < d_info[dungeon_idx].mindepth) + if (dun_level + move_num < d_info[p_ptr->dungeon_idx].mindepth) move_num = -dun_level; } @@ -982,16 +982,16 @@ void leave_floor(void) } /* Leaving the dungeon to town */ - if (!dun_level && dungeon_idx) + if (!dun_level && p_ptr->dungeon_idx) { p_ptr->leaving_dungeon = TRUE; if (!vanilla_town && !lite_town) { - p_ptr->wilderness_y = d_info[dungeon_idx].dy; - p_ptr->wilderness_x = d_info[dungeon_idx].dx; + p_ptr->wilderness_y = d_info[p_ptr->dungeon_idx].dy; + p_ptr->wilderness_x = d_info[p_ptr->dungeon_idx].dx; } - p_ptr->recall_dungeon = dungeon_idx; - dungeon_idx = 0; + p_ptr->recall_dungeon = p_ptr->dungeon_idx; + p_ptr->dungeon_idx = 0; /* Reach to the surface -- Clear all saved floors */ change_floor_mode &= ~CFM_SAVE_FLOORS; @@ -1189,7 +1189,7 @@ void change_floor(void) MONSTER_IDX i; GAME_TURN tmp_last_visit = sf_ptr->last_visit; GAME_TURN absence_ticks; - int alloc_chance = d_info[dungeon_idx].max_m_alloc_chance; + int alloc_chance = d_info[p_ptr->dungeon_idx].max_m_alloc_chance; GAME_TURN alloc_times; while (tmp_last_visit > turn) tmp_last_visit -= TURNS_PER_TICK * TOWN_DAWN; @@ -1415,7 +1415,7 @@ void stair_creation(void) if (ironman_downward) up = FALSE; /* Forbid down staircases on quest level */ - if (quest_number(dun_level) || (dun_level >= d_info[dungeon_idx].maxdepth)) down = FALSE; + if (quest_number(dun_level) || (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) down = FALSE; /* No effect out of standard dungeon floor */ if (!dun_level || (!up && !down) || diff --git a/src/floor-streams.c b/src/floor-streams.c index 520f026c1..3a419d567 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -133,7 +133,7 @@ static void recursive_river(POSITION x1, POSITION y1, POSITION x2, POSITION y2, /* Lava terrain glows */ if (have_flag(f_info[feat1].flags, FF_LAVA)) { - if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) c_ptr->info |= CAVE_GLOW; + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) c_ptr->info |= CAVE_GLOW; } /* Hack -- don't teleport here */ @@ -416,7 +416,7 @@ void place_trees(POSITION x, POSITION y) c_ptr->mimic = 0; /* Light area since is open above */ - if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) cave[j][i].info |= (CAVE_GLOW | CAVE_ROOM); + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) cave[j][i].info |= (CAVE_GLOW | CAVE_ROOM); } } } diff --git a/src/grid.c b/src/grid.c index 3de4d8ebb..bc64cef23 100644 --- a/src/grid.c +++ b/src/grid.c @@ -105,7 +105,7 @@ void place_random_stairs(POSITION y, POSITION x) if (ironman_downward) up_stairs = FALSE; /* Bottom */ - if (dun_level >= d_info[dungeon_idx].maxdepth) down_stairs = FALSE; + if (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) down_stairs = FALSE; /* Quest-level */ if (quest_number(dun_level) && (dun_level > 1)) down_stairs = FALSE; @@ -139,15 +139,15 @@ void place_random_door(POSITION y, POSITION x, bool room) /* Initialize mimic info */ c_ptr->mimic = 0; - if (d_info[dungeon_idx].flags1 & DF1_NO_DOORS) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS) { place_floor_bold(y, x); return; } - type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) && - one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : - ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); + type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && + one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : + ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); /* Choose an object */ tmp = randint0(1000); @@ -219,7 +219,7 @@ void place_closed_door(POSITION y, POSITION x, int type) int tmp; FEAT_IDX feat = feat_none; - if (d_info[dungeon_idx].flags1 & DF1_NO_DOORS) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS) { place_floor_bold(y, x); return; @@ -270,13 +270,13 @@ void place_closed_door(POSITION y, POSITION x, int type) */ void place_locked_door(POSITION y, POSITION x) { - if (d_info[dungeon_idx].flags1 & DF1_NO_DOORS) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS) { place_floor_bold(y, x); } else { - set_cave_feat(y, x, feat_locked_door_random((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR)); + set_cave_feat(y, x, feat_locked_door_random((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR)); cave[y][x].info &= ~(CAVE_FLOOR); delete_monster(y, x); } @@ -292,7 +292,7 @@ void place_locked_door(POSITION y, POSITION x) */ void place_secret_door(POSITION y, POSITION x, int type) { - if (d_info[dungeon_idx].flags1 & DF1_NO_DOORS) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS) { place_floor_bold(y, x); } @@ -302,9 +302,9 @@ void place_secret_door(POSITION y, POSITION x, int type) if (type == DOOR_DEFAULT) { - type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) && - one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : - ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); + type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && + one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : + ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); } /* Create secret door */ @@ -479,7 +479,7 @@ void try_door(POSITION y, POSITION x) if (cave[y][x].info & (CAVE_ROOM)) return; /* Occasional door (if allowed) */ - if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[dungeon_idx].flags1 & DF1_NO_DOORS)) + if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS)) { /* Place a door */ place_random_door(y, x, FALSE); diff --git a/src/load.c b/src/load.c index 163fe53b1..3acf8a0e0 100644 --- a/src/load.c +++ b/src/load.c @@ -2557,11 +2557,11 @@ static errr rd_dungeon_old(void) /* Header info */ rd_s16b(&tmp16s); dun_level = (DEPTH)tmp16s; - if (z_older_than(10, 3, 8)) dungeon_idx = DUNGEON_ANGBAND; + if (z_older_than(10, 3, 8)) p_ptr->dungeon_idx = DUNGEON_ANGBAND; else { rd_byte(&tmp8u); - dungeon_idx = (IDX)tmp8u; + p_ptr->dungeon_idx = (IDX)tmp8u; } /* Set the base level for old versions */ @@ -3282,7 +3282,7 @@ static errr rd_dungeon(void) err = rd_dungeon_old(); /* Prepare floor_id of current floor */ - if (dungeon_idx) + if (p_ptr->dungeon_idx) { p_ptr->floor_id = get_new_floor_id(); get_sf_ptr(p_ptr->floor_id)->dun_level = dun_level; @@ -3299,7 +3299,7 @@ static errr rd_dungeon(void) /* Current dungeon type */ rd_byte(&tmp8u); - dungeon_idx = (DUNGEON_IDX)tmp8u; + p_ptr->dungeon_idx = (DUNGEON_IDX)tmp8u; /* Number of the saved_floors array elements */ rd_byte(&num); @@ -3958,7 +3958,7 @@ static errr rd_savefile_new_aux(void) { if (p_ptr->inside_quest == OLD_QUEST_WATER_CAVE) { - dungeon_idx = lite_town ? DUNGEON_ANGBAND : DUNGEON_GALGALS; + p_ptr->dungeon_idx = lite_town ? DUNGEON_ANGBAND : DUNGEON_GALGALS; dun_level = 1; p_ptr->inside_quest = 0; } diff --git a/src/melee1.c b/src/melee1.c index e6dca36a9..fc40a89ed 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -1363,7 +1363,7 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode) } } - if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking.")); return FALSE; @@ -1538,7 +1538,7 @@ bool make_attack_normal(MONSTER_IDX m_idx) /* Not allowed to attack */ if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return (FALSE); - if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE); + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE); /* ...nor if friendly */ if (!is_hostile(m_ptr)) return FALSE; diff --git a/src/monster-process.c b/src/monster-process.c index 36fbf743a..6c21cdd17 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -1453,7 +1453,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx) /* Not allowed to attack */ if (r_ptr->flags1 & RF1_NEVER_BLOW) return FALSE; - if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE); + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE); /* Total armor */ ac = tr_ptr->ac; @@ -2849,7 +2849,7 @@ void process_monster(MONSTER_IDX m_idx) } /* In anti-melee dungeon, stupid or confused monster takes useless turn */ - if (do_move && (d_info[dungeon_idx].flags1 & DF1_NO_MELEE)) + if (do_move && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)) { if (!MON_CONFUSED(m_ptr)) { @@ -2905,7 +2905,7 @@ void process_monster(MONSTER_IDX m_idx) if (monst_attack_monst(m_idx, c_ptr->m_idx)) return; /* In anti-melee dungeon, stupid or confused monster takes useless turn */ - else if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) + else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { if (MON_CONFUSED(m_ptr)) return; else if (r_ptr->flags2 & RF2_STUPID) diff --git a/src/monster-status.c b/src/monster-status.c index 44d649c80..8ed688eee 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -1121,7 +1121,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note) #endif } - if (!(d_info[dungeon_idx].flags1 & DF1_BEGINNER)) + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER)) { if (!dun_level && !ambush_flag && !p_ptr->inside_arena) { diff --git a/src/monster1.c b/src/monster1.c index e15f38933..7bf7c4485 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -3000,14 +3000,14 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) } } - if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_idx].final_guardian == m_ptr->r_idx)) + if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[p_ptr->dungeon_idx].final_guardian == m_ptr->r_idx)) { - KIND_OBJECT_IDX k_idx = d_info[dungeon_idx].final_object ? d_info[dungeon_idx].final_object + KIND_OBJECT_IDX k_idx = d_info[p_ptr->dungeon_idx].final_object ? d_info[p_ptr->dungeon_idx].final_object : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT); - if (d_info[dungeon_idx].final_artifact) + if (d_info[p_ptr->dungeon_idx].final_artifact) { - a_idx = d_info[dungeon_idx].final_artifact; + a_idx = d_info[p_ptr->dungeon_idx].final_artifact; artifact_type *a_ptr = &a_info[a_idx]; if (!a_ptr->cur_num) @@ -3023,7 +3023,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) else if (!preserve_mode) a_ptr->cur_num = 1; /* Prevent rewarding both artifact and "default" object */ - if (!d_info[dungeon_idx].final_object) k_idx = 0; + if (!d_info[p_ptr->dungeon_idx].final_object) k_idx = 0; } } @@ -3037,7 +3037,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD); (void)drop_near(q_ptr, -1, y, x); } - msg_format(_("あなたは%sを制覇した!", "You have conquered %s!"), d_name + d_info[dungeon_idx].name); + msg_format(_("あなたは%sを制覇した!", "You have conquered %s!"), d_name + d_info[p_ptr->dungeon_idx].name); } } diff --git a/src/monster2.c b/src/monster2.c index 13d5f5f7b..f5eb3a7a5 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -967,7 +967,7 @@ static int chameleon_change_m_idx = 0; */ static bool restrict_monster_to_dungeon(MONRACE_IDX r_idx) { - dungeon_info_type *d_ptr = &d_info[dungeon_idx]; + dungeon_info_type *d_ptr = &d_info[p_ptr->dungeon_idx]; monster_race *r_ptr = &r_info[r_idx]; byte a; @@ -1205,7 +1205,7 @@ errr get_mon_num_prep(monsterrace_hook_type monster_hook, if (dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && !restrict_monster_to_dungeon(entry->index) && !p_ptr->inside_battle) { - int hoge = entry->prob2 * d_info[dungeon_idx].special_div; + int hoge = entry->prob2 * d_info[p_ptr->dungeon_idx].special_div; entry->prob2 = hoge / 64; if (randint0(64) < (hoge & 0x3f)) entry->prob2++; } @@ -1256,7 +1256,7 @@ MONRACE_IDX get_mon_num(DEPTH level) pls_kakuritu = MAX(NASTY_MON_MAX, NASTY_MON_BASE - ((dungeon_turn / (TURNS_PER_TICK * 5000L) - delay / 10))); pls_level = MIN(NASTY_MON_PLUS_MAX, 3 + dungeon_turn / (TURNS_PER_TICK * 40000L) - delay / 40 + MIN(5, level / 10)) ; - if (d_info[dungeon_idx].flags1 & DF1_MAZE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_MAZE) { pls_kakuritu = MIN(pls_kakuritu / 2, pls_kakuritu - 10); if (pls_kakuritu < 2) pls_kakuritu = 2; @@ -1265,7 +1265,7 @@ MONRACE_IDX get_mon_num(DEPTH level) } /* Boost the level */ - if (!p_ptr->inside_battle && !(d_info[dungeon_idx].flags1 & DF1_BEGINNER)) + if (!p_ptr->inside_battle && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER)) { /* Nightmare mode allows more out-of depth monsters */ if (ironman_nightmare && !randint0(pls_kakuritu)) @@ -2262,7 +2262,7 @@ void update_monster(MONSTER_IDX m_idx, bool full) bool easy = FALSE; /* Non-Ninja player in the darkness */ - bool in_darkness = (d_info[dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto; + bool in_darkness = (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto; /* Do disturb? */ if (disturb_high) @@ -2761,7 +2761,7 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx) else level = dun_level; - if (d_info[dungeon_idx].flags1 & DF1_CHAMELEON) level+= 2+randint1(3); + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON) level+= 2+randint1(3); r_idx = get_mon_num(level); r_ptr = &r_info[r_idx]; @@ -3740,9 +3740,9 @@ bool alloc_horde(POSITION y, POSITION x) */ bool alloc_guardian(bool def_val) { - MONRACE_IDX guardian = d_info[dungeon_idx].final_guardian; + MONRACE_IDX guardian = d_info[p_ptr->dungeon_idx].final_guardian; - if (guardian && (d_info[dungeon_idx].maxdepth == dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num)) + if (guardian && (d_info[p_ptr->dungeon_idx].maxdepth == dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num)) { int oy; int ox; @@ -3882,7 +3882,7 @@ static bool summon_specific_okay(MONRACE_IDX r_idx) monster_has_hostile_align(NULL, 10, -10, r_ptr)) return FALSE; - if ((r_ptr->flags7 & RF7_CHAMELEON) && (d_info[dungeon_idx].flags1 & DF1_CHAMELEON)) return TRUE; + if ((r_ptr->flags7 & RF7_CHAMELEON) && (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON)) return TRUE; return (summon_specific_aux(r_idx)); } diff --git a/src/monsterrace-hook.c b/src/monsterrace-hook.c index 33386bed3..b4b842a08 100644 --- a/src/monsterrace-hook.c +++ b/src/monsterrace-hook.c @@ -118,7 +118,7 @@ bool mon_hook_dungeon(MONRACE_IDX r_idx) return TRUE; else { - dungeon_info_type *d_ptr = &d_info[dungeon_idx]; + dungeon_info_type *d_ptr = &d_info[p_ptr->dungeon_idx]; if ((d_ptr->mflags8 & RF8_WILD_MOUNTAIN) && (r_ptr->flags8 & RF8_WILD_MOUNTAIN)) return TRUE; return FALSE; diff --git a/src/mspells1.c b/src/mspells1.c index ae1f9ad62..9c9f5659d 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -1371,7 +1371,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) /* Check "projectable" */ bool direct; - bool in_no_magic_dungeon = (d_info[dungeon_idx].flags1 & DF1_NO_MAGIC) && dun_level + bool in_no_magic_dungeon = (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)); bool can_use_lite_area = FALSE; @@ -1529,7 +1529,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) if (!(r_ptr->flags2 & RF2_STUPID)) { - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS); + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS); else if ((p_ptr->pclass == CLASS_NINJA) && !can_use_lite_area) f6 &= ~(RF6_DARKNESS); } } diff --git a/src/mspells2.c b/src/mspells2.c index 91d465994..000d63cda 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -286,7 +286,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx); bool pet = is_pet(m_ptr); - bool in_no_magic_dungeon = (d_info[dungeon_idx].flags1 & DF1_NO_MAGIC) && dun_level + bool in_no_magic_dungeon = (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)); bool can_use_lite_area = FALSE; @@ -413,7 +413,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) if (!(r_ptr->flags2 & RF2_STUPID)) { - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS); + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS); else if (vs_ninja && !can_use_lite_area) f6 &= ~(RF6_DARKNESS); } } diff --git a/src/object2.c b/src/object2.c index 76dd11c9c..3ff211f9c 100644 --- a/src/object2.c +++ b/src/object2.c @@ -628,7 +628,7 @@ OBJECT_IDX get_obj_num(DEPTH level) if (level > MAX_DEPTH - 1) level = MAX_DEPTH - 1; /* Boost level */ - if ((level > 0) && !(d_info[dungeon_idx].flags1 & DF1_BEGINNER)) + if ((level > 0) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER)) { /* Occasional "boost" */ if (one_in_(GREAT_OBJ)) @@ -4295,14 +4295,14 @@ void apply_magic(object_type *o_ptr, DEPTH lev, BIT_FLAGS mode) f1 = lev + 10; /* Maximal chance of being "good" */ - if (f1 > d_info[dungeon_idx].obj_good) f1 = d_info[dungeon_idx].obj_good; + if (f1 > d_info[p_ptr->dungeon_idx].obj_good) f1 = d_info[p_ptr->dungeon_idx].obj_good; /* Base chance of being "great" */ f2 = f1 * 2 / 3; /* Maximal chance of being "great" */ - if ((p_ptr->pseikaku != SEIKAKU_MUNCHKIN) && (f2 > d_info[dungeon_idx].obj_great)) - f2 = d_info[dungeon_idx].obj_great; + if ((p_ptr->pseikaku != SEIKAKU_MUNCHKIN) && (f2 > d_info[p_ptr->dungeon_idx].obj_great)) + f2 = d_info[p_ptr->dungeon_idx].obj_great; if (p_ptr->muta3 & MUT3_GOOD_LUCK) { @@ -6734,7 +6734,7 @@ bool process_warning(POSITION xx, POSITION yy) BIT_FLAGS f5 = r_ptr->a_ability_flags1; BIT_FLAGS f6 = r_ptr->a_ability_flags2; - if (!(d_info[dungeon_idx].flags1 & DF1_NO_MAGIC)) + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC)) { if (f4 & RF4_BA_CHAO) spell_damcalc_by_spellnum(MS_BALL_CHAOS, GF_CHAOS, c_ptr->m_idx, &dam_max0); if (f5 & RF5_BA_MANA) spell_damcalc_by_spellnum(MS_BALL_MANA, GF_MANA, c_ptr->m_idx, &dam_max0); @@ -6769,7 +6769,7 @@ bool process_warning(POSITION xx, POSITION yy) } /* Monster melee attacks */ - if (!(r_ptr->flags1 & RF1_NEVER_BLOW) && !(d_info[dungeon_idx].flags1 & DF1_NO_MELEE)) + if (!(r_ptr->flags1 & RF1_NEVER_BLOW) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)) { if (mx <= xx + 1 && mx >= xx - 1 && my <= yy + 1 && my >= yy - 1) { diff --git a/src/player-move.c b/src/player-move.c index 59039184c..2fcaa1a8b 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -883,7 +883,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode) if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE); /* For get everything when requested hehe I'm *NASTY* */ - if (dun_level && (d_info[dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(); + if (dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(); if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff(); if (p_ptr->pclass == CLASS_NINJA) diff --git a/src/player-status.c b/src/player-status.c index 5fff7afd9..7064df513 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -2813,7 +2813,7 @@ static void calc_torch(void) /* max radius is 14 (was 5) without rewriting other code -- */ /* see cave.c:update_lite() and defines.h:LITE_MAX */ - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1) p_ptr->cur_lite = 1; /* diff --git a/src/quest.c b/src/quest.c index 7590e1740..034ce48a8 100644 --- a/src/quest.c +++ b/src/quest.c @@ -394,7 +394,7 @@ QUEST_IDX quest_number(DEPTH level) if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) && !(quest[i].flags & QUEST_FLAG_PRESET) && (quest[i].level == level) && - (quest[i].dungeon == dungeon_idx)) + (quest[i].dungeon == p_ptr->dungeon_idx)) return (i); } @@ -411,7 +411,7 @@ QUEST_IDX random_quest_number(DEPTH level) { QUEST_IDX i; - if (dungeon_idx != DUNGEON_ANGBAND) return 0; + if (p_ptr->dungeon_idx != DUNGEON_ANGBAND) return 0; for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++) { diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 64ba090b1..3111b7639 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -277,7 +277,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return NULL; } - if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { return ""; } @@ -649,7 +649,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) return NULL; } - if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { return ""; } @@ -849,7 +849,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking.")); return ""; diff --git a/src/rooms-fractal.c b/src/rooms-fractal.c index 90330c14d..858c7d27c 100644 --- a/src/rooms-fractal.c +++ b/src/rooms-fractal.c @@ -40,7 +40,7 @@ bool build_type9(void) light = done = FALSE; room = TRUE; - if ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; + if ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; while (!done) { diff --git a/src/rooms-normal.c b/src/rooms-normal.c index 6c488447e..2c4703d08 100644 --- a/src/rooms-normal.c +++ b/src/rooms-normal.c @@ -18,8 +18,8 @@ bool build_type1(void) cave_type *c_ptr; - bool curtain = (d_info[dungeon_idx].flags1 & DF1_CURTAIN) && - one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 48 : 512); + bool curtain = (d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && + one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 48 : 512); /* Pick a room size */ y1 = randint1(4); @@ -47,7 +47,7 @@ bool build_type1(void) } /* Choose lite or dark */ - light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* Get corner values */ @@ -163,8 +163,8 @@ bool build_type1(void) /* Hack -- Occasional divided room */ else if (one_in_(50)) { - bool curtain2 = (d_info[dungeon_idx].flags1 & DF1_CURTAIN) && - one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 2 : 128); + bool curtain2 = (d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && + one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 2 : 128); if (randint1(100) < 50) { @@ -216,7 +216,7 @@ bool build_type2(void) if (!find_space(&yval, &xval, 11, 25)) return FALSE; /* Choose lite or dark */ - light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* Determine extents of the first room */ y1a = yval - randint1(4); @@ -341,7 +341,7 @@ bool build_type3(void) /* Choose lite or dark */ - light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* For now, always 3x3 */ wx = wy = 1; @@ -532,9 +532,9 @@ bool build_type3(void) /* Sometimes shut using secret doors */ if (one_in_(3)) { - int door_type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) && - one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : - ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); + int door_type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && + one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : + ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); place_secret_door(yval, x1a - 1, door_type); place_secret_door(yval, x2a + 1, door_type); @@ -595,7 +595,7 @@ bool build_type4(void) if (!find_space(&yval, &xval, 11, 25)) return FALSE; /* Choose lite or dark */ - light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* Large room */ y1 = yval - 4; @@ -773,9 +773,9 @@ bool build_type4(void) /* Occasionally, some Inner rooms */ if (one_in_(3)) { - int door_type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) && - one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : - ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); + int door_type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && + one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : + ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); /* Long horizontal walls */ for (x = xval - 5; x <= xval + 5; x++) @@ -850,9 +850,9 @@ bool build_type4(void) /* Four small rooms. */ case 5: { - int door_type = ((d_info[dungeon_idx].flags1 & DF1_CURTAIN) && - one_in_((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : - ((d_info[dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); + int door_type = ((d_info[p_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && + one_in_((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN : + ((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR); /* Inner "cross" */ for (y = y1; y <= y2; y++) @@ -916,7 +916,7 @@ bool build_type11(void) int light = FALSE; /* Occasional light */ - if ((randint1(dun_level) <= 15) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; + if ((randint1(dun_level) <= 15) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; rad = randint0(9); @@ -971,7 +971,7 @@ bool build_type12(void) h4 = randint1(32) - 16; /* Occasional light */ - if ((randint1(dun_level) <= 5) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; + if ((randint1(dun_level) <= 5) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; rad = randint1(9); diff --git a/src/rooms-pitnest.c b/src/rooms-pitnest.c index d1ca4e5aa..c12a9b97e 100644 --- a/src/rooms-pitnest.c +++ b/src/rooms-pitnest.c @@ -286,7 +286,7 @@ bool build_type5(void) cave_type *c_ptr; - int cur_nest_type = pick_vault_type(nest_types, d_info[dungeon_idx].nest); + int cur_nest_type = pick_vault_type(nest_types, d_info[p_ptr->dungeon_idx].nest); vault_aux_type *n_ptr; /* No type available */ @@ -497,7 +497,7 @@ bool build_type6(void) cave_type *c_ptr; - int cur_pit_type = pick_vault_type(pit_types, d_info[dungeon_idx].pit); + int cur_pit_type = pick_vault_type(pit_types, d_info[p_ptr->dungeon_idx].pit); vault_aux_type *n_ptr; /* No type available */ @@ -802,11 +802,11 @@ bool build_type13(void) cave_type *c_ptr; - int cur_pit_type = pick_vault_type(pit_types, d_info[dungeon_idx].pit); + int cur_pit_type = pick_vault_type(pit_types, d_info[p_ptr->dungeon_idx].pit); vault_aux_type *n_ptr; /* Only in Angband */ - if (dungeon_idx != DUNGEON_ANGBAND) return FALSE; + if (p_ptr->dungeon_idx != DUNGEON_ANGBAND) return FALSE; /* No type available */ if (cur_pit_type < 0) return FALSE; diff --git a/src/rooms-special.c b/src/rooms-special.c index b4a96c3de..915e99e88 100644 --- a/src/rooms-special.c +++ b/src/rooms-special.c @@ -27,7 +27,7 @@ bool build_type15(void) if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE; /* Choose lite or dark */ - light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* Get corner values */ y1 = yval - ysize / 2; diff --git a/src/rooms-trap.c b/src/rooms-trap.c index 46e680f91..39dd33ed2 100644 --- a/src/rooms-trap.c +++ b/src/rooms-trap.c @@ -33,7 +33,7 @@ bool build_type14(void) if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE; /* Choose lite or dark */ - light = ((dun_level <= randint1(25)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* Get corner values */ diff --git a/src/rooms-vault.c b/src/rooms-vault.c index 84dd9d52b..f21ec719c 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -1186,13 +1186,13 @@ bool build_type10(void) do { vtype = randint1(15); - } while ((d_info[dungeon_idx].flags1 & DF1_NO_CAVE) && + } while ((d_info[p_ptr->dungeon_idx].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_idx].flags1 & DF1_NO_CAVE) && + } while ((d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) && ((vtype == 1) || (vtype == 3))); #endif /* ALLOW_CAVERNS_AND_LAKES */ diff --git a/src/rooms.c b/src/rooms.c index 414ef829b..a3c6fb18e 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -411,7 +411,7 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width) } /* Normal dungeon */ - if (!(d_info[dungeon_idx].flags1 & DF1_NO_CAVE)) + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE)) { /* Choose a random one */ pick = randint1(candidates); @@ -1142,7 +1142,7 @@ void build_cavern(void) bool done, light; light = done = FALSE; - if ((dun_level <= randint1(50)) && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; + if ((dun_level <= randint1(50)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; /* Make a cave the size of the dungeon */ xsize = cur_wid - 1; @@ -1309,7 +1309,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int /* Light lava */ if (cave_have_flag_bold(y0 + y - yhsize, x0 + x - xhsize, FF_LAVA)) { - if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW; + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW; } } } @@ -1697,7 +1697,7 @@ void build_maze_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION ysize, msg_print_wizard(CHEAT_DUNGEON, _("迷路ランダムVaultを生成しました。", "Maze Vault.")); /* Choose lite or dark */ - light = ((dun_level <= randint1(25)) && is_vault && !(d_info[dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((dun_level <= randint1(25)) && is_vault && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* Pick a random room size - randomized by calling routine */ dy = ysize / 2 - 1; @@ -2161,7 +2161,7 @@ bool generate_rooms(void) /*! @details ダンジョンにBEGINNER、CHAMELEON、SMALLESTいずれのフラグもなく、 * かつ「常に通常でない部屋を生成する」フラグがONならば、 * GRATER_VAULTのみを生成対象とする。 / Ironman sees only Greater Vaults */ - if (ironman_rooms && !((d_info[dungeon_idx].flags1 & (DF1_BEGINNER | DF1_CHAMELEON | DF1_SMALLEST)))) + if (ironman_rooms && !((d_info[p_ptr->dungeon_idx].flags1 & (DF1_BEGINNER | DF1_CHAMELEON | DF1_SMALLEST)))) { for (i = 0; i < ROOM_T_MAX; i++) { @@ -2171,7 +2171,7 @@ bool generate_rooms(void) } /*! @details ダンジョンにNO_VAULTフラグがあるならば、LESSER_VAULT / GREATER_VAULT/ RANDOM_VAULTを除外 / Forbidden vaults */ - else if (d_info[dungeon_idx].flags1 & DF1_NO_VAULT) + else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_VAULT) { prob_list[ROOM_T_LESSER_VAULT] = 0; prob_list[ROOM_T_GREATER_VAULT] = 0; @@ -2179,13 +2179,13 @@ bool generate_rooms(void) } /*! @details ダンジョンにBEGINNERフラグがあるならば、FIXED_ROOMを除外 / Forbidden vaults */ - if (d_info[dungeon_idx].flags1 & DF1_BEGINNER) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER) { prob_list[ROOM_T_FIXED] = 0; } /*! @details ダンジョンにNO_CAVEフラグがある場合、FRACAVEの生成枠がNORMALに与えられる。CRIPT、OVALの生成枠がINNER_Fに与えられる。/ NO_CAVE dungeon (Castle)*/ - if (d_info[dungeon_idx].flags1 & DF1_NO_CAVE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) { MOVE_PLIST(ROOM_T_NORMAL, ROOM_T_FRACAVE); MOVE_PLIST(ROOM_T_INNER_FEAT, ROOM_T_CRYPT); @@ -2193,7 +2193,7 @@ bool generate_rooms(void) } /*! @details ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc cave etc.) */ - else if (d_info[dungeon_idx].flags1 & DF1_CAVE) + else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CAVE) { MOVE_PLIST(ROOM_T_FRACAVE, ROOM_T_NORMAL); } @@ -2205,13 +2205,13 @@ bool generate_rooms(void) } /*! @details ダンジョンに最初からGLASS_ROOMフラグがある場合、GLASS を生成から除外。/ Forbidden glass rooms */ - if (!(d_info[dungeon_idx].flags1 & DF1_GLASS_ROOM)) + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_ROOM)) { prob_list[ROOM_T_GLASS] = 0; } /*! @details ARCADEは同フラグがダンジョンにないと生成されない。 / Forbidden glass rooms */ - if (!(d_info[dungeon_idx].flags1 & DF1_ARCADE)) + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_ARCADE)) { prob_list[ROOM_T_ARCADE] = 0; } diff --git a/src/save.c b/src/save.c index c13fc4ac1..5070eb67e 100644 --- a/src/save.c +++ b/src/save.c @@ -1166,7 +1166,7 @@ static bool wr_dungeon(void) wr_s16b(max_floor_id); /* Current dungeon type */ - wr_byte((byte_hack)dungeon_idx); + wr_byte((byte_hack)p_ptr->dungeon_idx); /*** No saved floor (On the surface etc.) ***/ diff --git a/src/scores.c b/src/scores.c index 1580ac26f..b11de8356 100644 --- a/src/scores.c +++ b/src/scores.c @@ -509,7 +509,7 @@ errr top_twenty(void) sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999)); sprintf(the_score.cur_dun, "%3d", (int)dun_level); sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999)); - sprintf(the_score.max_dun, "%3d", (int)max_dlv[dungeon_idx]); + sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]); /* Save the cause of death (31 chars) */ if (strlen(p_ptr->died_from) >= sizeof(the_score.how)) @@ -622,7 +622,7 @@ errr predict_score(void) sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999)); sprintf(the_score.cur_dun, "%3d", (int)dun_level); sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999)); - sprintf(the_score.max_dun, "%3d", (int)max_dlv[dungeon_idx]); + sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]); /* Hack -- no cause of death */ /* まだ死んでいないときの識別文字 */ diff --git a/src/spells1.c b/src/spells1.c index 6f2344eb6..07ad8bace 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -606,7 +606,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P case GF_LITE: { /* Turn on the light */ - if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) { c_ptr->info |= (CAVE_GLOW); note_spot(y, x); diff --git a/src/spells2.c b/src/spells2.c index 189f44761..2b3ef60e1 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -40,7 +40,7 @@ static bool detect_feat_flag(POSITION range, int flag, bool known) bool detect = FALSE; cave_type *c_ptr; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; /* Scan the current panel */ for (y = 1; y < cur_hgt - 1; y++) @@ -172,7 +172,7 @@ bool detect_objects_gold(POSITION range) bool detect = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3; /* Scan objects */ for (i = 1; i < o_max; i++) @@ -227,7 +227,7 @@ bool detect_objects_normal(POSITION range) bool detect = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3; /* Scan objects */ for (i = 1; i < o_max; i++) @@ -290,7 +290,7 @@ bool detect_objects_magic(POSITION range) bool detect = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; /* Scan all objects */ for (i = 1; i < o_max; i++) @@ -365,7 +365,7 @@ bool detect_monsters_normal(POSITION range) POSITION y, x; bool flag = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; for (i = 1; i < m_max; i++) { @@ -413,7 +413,7 @@ bool detect_monsters_invis(POSITION range) POSITION y, x; bool flag = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; for (i = 1; i < m_max; i++) { @@ -466,7 +466,7 @@ bool detect_monsters_evil(POSITION range) POSITION y, x; bool flag = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; for (i = 1; i < m_max; i++) { @@ -523,7 +523,7 @@ bool detect_monsters_nonliving(POSITION range) POSITION y, x; bool flag = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; for (i = 1; i < m_max; i++) { @@ -573,7 +573,7 @@ bool detect_monsters_mind(POSITION range) POSITION y, x; bool flag = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; for (i = 1; i < m_max; i++) { @@ -626,7 +626,7 @@ bool detect_monsters_string(POSITION range, concptr Match) POSITION y, x; bool flag = FALSE; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; for (i = 1; i < m_max; i++) { @@ -681,7 +681,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag) bool flag = FALSE; concptr desc_monsters = _("変なモンスター", "weird monsters"); - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; for (i = 1; i < m_max; i++) { @@ -1593,7 +1593,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) c_ptr = &cave[y][x]; if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW; - else if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) + else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) { DIRECTION i; POSITION yy, xx; @@ -2063,7 +2063,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) c_ptr = &cave[yy][xx]; if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW; - else if (!(d_info[dungeon_idx].flags1 & DF1_DARKNESS)) + else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) { DIRECTION ii; POSITION yyy, xxx; @@ -2616,7 +2616,7 @@ bool lite_area(HIT_POINT dam, POSITION rad) { BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL; - if (d_info[dungeon_idx].flags1 & DF1_DARKNESS) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) { msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light.")); return FALSE; @@ -4609,7 +4609,7 @@ bool_hack vampirism(void) int dummy; cave_type *c_ptr; - if (d_info[dungeon_idx].flags1 & DF1_NO_MELEE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking.")); return FALSE; diff --git a/src/spells3.c b/src/spells3.c index 6e4166521..6f86499b1 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -629,7 +629,7 @@ void teleport_level(MONSTER_IDX m_idx) } /* Down only */ - if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[dungeon_idx].mindepth)) + if ((ironman_downward && (m_idx <= 0)) || (dun_level <= d_info[p_ptr->dungeon_idx].mindepth)) { #ifdef JP if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name); @@ -640,7 +640,7 @@ void teleport_level(MONSTER_IDX m_idx) { if (!dun_level) { - dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon; + p_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon; p_ptr->oldpy = p_ptr->y; p_ptr->oldpx = p_ptr->x; } @@ -651,7 +651,7 @@ void teleport_level(MONSTER_IDX m_idx) if (!dun_level) { - dun_level = d_info[dungeon_idx].mindepth; + dun_level = d_info[p_ptr->dungeon_idx].mindepth; prepare_change_floor_mode(CFM_RAND_PLACE); } else @@ -665,7 +665,7 @@ void teleport_level(MONSTER_IDX m_idx) } /* Up only */ - else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_idx].maxdepth)) + else if (quest_number(dun_level) || (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) { #ifdef JP if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name); @@ -721,7 +721,7 @@ void teleport_level(MONSTER_IDX m_idx) if (m_idx <= 0) /* To player */ { /* Never reach this code on the surface */ - /* if (!dun_level) dungeon_idx = p_ptr->recall_dungeon; */ + /* if (!dun_level) p_ptr->dungeon_idx = p_ptr->recall_dungeon; */ if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL); @@ -859,13 +859,13 @@ bool recall_player(player_type *creature_ptr, TIME_EFFECT turns) return TRUE; } - if (dun_level && (max_dlv[dungeon_idx] > dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall) + if (dun_level && (max_dlv[p_ptr->dungeon_idx] > dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall) { if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? "))) { - max_dlv[dungeon_idx] = dun_level; + max_dlv[p_ptr->dungeon_idx] = dun_level; if (record_maxdepth) - do_cmd_write_nikki(NIKKI_TRUMP, dungeon_idx, _("帰還のときに", "when recall from dungeon")); + do_cmd_write_nikki(NIKKI_TRUMP, p_ptr->dungeon_idx, _("帰還のときに", "when recall from dungeon")); } } diff --git a/src/trap.c b/src/trap.c index f22087200..238975849 100644 --- a/src/trap.c +++ b/src/trap.c @@ -65,7 +65,7 @@ FEAT_IDX choose_random_trap(void) if (p_ptr->inside_arena || quest_number(dun_level)) continue; /* Hack -- no trap doors on the deepest level */ - if (dun_level >= d_info[dungeon_idx].maxdepth) continue; + if (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) continue; break; } diff --git a/src/types.h b/src/types.h index 7a9c9d3a2..2eb2dc181 100644 --- a/src/types.h +++ b/src/types.h @@ -1026,6 +1026,7 @@ struct player_type QUEST_IDX inside_quest; /* Inside quest level */ bool inside_battle; /* Is character inside tougijou? */ + DUNGEON_IDX dungeon_idx; /* current dungeon index */ POSITION wilderness_x; /* Coordinates in the wilderness */ POSITION wilderness_y; bool wild_mode; diff --git a/src/util.c b/src/util.c index 8a8dd00ef..692376e8e 100644 --- a/src/util.c +++ b/src/util.c @@ -1718,7 +1718,7 @@ void select_floor_music(void) { // TODO マクロで類似条件を統合すること if(quest[i].status == QUEST_STATUS_TAKEN && (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_RANDOM) && - quest[i].level == dun_level && dungeon_idx == quest[i].dungeon) + quest[i].level == dun_level && p_ptr->dungeon_idx == quest[i].dungeon) { if(play_music(TERM_XTRA_MUSIC_QUEST, i)) { @@ -1728,13 +1728,13 @@ void select_floor_music(void) } } - if(dungeon_idx) + if(p_ptr->dungeon_idx) { if(p_ptr->feeling == 2) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL2); else if(p_ptr->feeling >= 3 && p_ptr->feeling <= 5) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL1); else { - if(play_music(TERM_XTRA_MUSIC_DUNGEON, dungeon_idx)) + if(play_music(TERM_XTRA_MUSIC_DUNGEON, p_ptr->dungeon_idx)) { if(dun_level < 40) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_LOW); else if(dun_level < 80) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_MED); diff --git a/src/variable.c b/src/variable.c index e8a5d2039..b786e1848 100644 --- a/src/variable.c +++ b/src/variable.c @@ -950,7 +950,6 @@ FEAT_IDX feat_undetected; /* * Which dungeon ? */ -DUNGEON_IDX dungeon_idx; DEPTH *max_dlv; FEAT_IDX feat_wall_outer; diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 55a60ab45..3e466e9a2 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -162,7 +162,7 @@ concptr map_name(void) else if (!dun_level && p_ptr->town_num) return town[p_ptr->town_num].name; else - return d_name+d_info[dungeon_idx].name; + return d_name+d_info[p_ptr->dungeon_idx].name; } /*! @@ -936,7 +936,7 @@ static void prt_depth(void) { strcpy(depths, _("地上", "Surf.")); } - else if (p_ptr->inside_quest && !dungeon_idx) + else if (p_ptr->inside_quest && !p_ptr->dungeon_idx) { strcpy(depths, _("地上", "Quest")); } diff --git a/src/wizard2.c b/src/wizard2.c index ce6bcb55c..c0ec8b2c5 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1356,7 +1356,7 @@ static void do_cmd_wiz_jump(void) sprintf(ppp, "Jump which dungeon : "); /* Default */ - sprintf(tmp_val, "%d", dungeon_idx); + sprintf(tmp_val, "%d", p_ptr->dungeon_idx); /* Ask for a level */ if (!get_string(ppp, tmp_val, 2)) return; @@ -1377,12 +1377,12 @@ static void do_cmd_wiz_jump(void) /* Extract request */ command_arg = (COMMAND_ARG)atoi(tmp_val); - dungeon_idx = tmp_dungeon_type; + p_ptr->dungeon_idx = tmp_dungeon_type; } /* Paranoia */ - if (command_arg < d_info[dungeon_idx].mindepth) command_arg = 0; - if (command_arg > d_info[dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[dungeon_idx].maxdepth; + if (command_arg < d_info[p_ptr->dungeon_idx].mindepth) command_arg = 0; + if (command_arg > d_info[p_ptr->dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[p_ptr->dungeon_idx].maxdepth; /* Accept request */ msg_format("You jump to dungeon level %d.", command_arg); @@ -1394,7 +1394,7 @@ static void do_cmd_wiz_jump(void) prepare_change_floor_mode(CFM_RAND_PLACE); - if (!dun_level) dungeon_idx = 0; + if (!dun_level) p_ptr->dungeon_idx = 0; p_ptr->inside_arena = FALSE; p_ptr->wild_mode = FALSE; @@ -2097,8 +2097,8 @@ void cheat_death(player_type *creature_ptr) creature_ptr->inside_battle = FALSE; leaving_quest = 0; creature_ptr->inside_quest = 0; - if (dungeon_idx) creature_ptr->recall_dungeon = dungeon_idx; - dungeon_idx = 0; + if (p_ptr->dungeon_idx) creature_ptr->recall_dungeon = p_ptr->dungeon_idx; + p_ptr->dungeon_idx = 0; if (lite_town || vanilla_town) { creature_ptr->wilderness_y = 1;