From bc0912f0342d96557ac0598cbaf517479f19f324 Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 21 Sep 2019 11:42:53 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38844=20current=5Ffloor=5Fptr=20?= =?utf8?q?=E3=82=92=20player=5Ftype=20=E6=A7=8B=E9=80=A0=E4=BD=93=E3=81=AB?= =?utf8?q?=E5=8A=A0=E3=81=88=EF=BC=8C=20max=5Fo=5Fidx,=20max=5Fm=5Fidx=20?= =?utf8?q?=E3=82=92=20world=5Ftype=E3=80=80=E6=A7=8B=E9=80=A0=E4=BD=93?= =?utf8?q?=E3=81=B8=E7=A7=BB=E5=8B=95=EF=BC=8E=20=20/=20Add=20current=5Ffl?= =?utf8?q?oor=5Fptr=20to=20player=5Ftype=20structure.=20Move=20max=5Fo=5Fi?= =?utf8?q?dx=20and=20max=5Fm=5Fidx=20to=20world=5Ftype=E3=80=80structure.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/artifact.c | 16 ++-- src/autopick.c | 10 +-- src/birth.c | 2 +- src/bldg.c | 10 +-- src/chest.c | 12 +-- src/cmd/cmd-activate.c | 29 +++---- src/cmd/cmd-basic.c | 80 +++++++++--------- src/cmd/cmd-dump.c | 38 ++++----- src/cmd/cmd-eat.c | 2 +- src/cmd/cmd-mane.c | 10 +-- src/cmd/cmd-pet.c | 44 +++++----- src/cmd/cmd-quaff.c | 2 +- src/cmd/cmd-read.c | 8 +- src/cmd/cmd-spell.c | 6 +- src/cmd/cmd-usestaff.c | 4 +- src/cmd/cmd-zaprod.c | 2 +- src/cmd/cmd-zapwand.c | 2 +- src/combat/melee1.c | 46 +++++------ src/combat/shoot.c | 32 ++++---- src/core.c | 216 ++++++++++++++++++++++++------------------------ src/dungeon-file.c | 36 ++++---- src/files.c | 44 +++++----- src/floor-events.c | 52 ++++++------ src/floor-generate.c | 73 +++++++++-------- src/floor-save.c | 112 ++++++++++++------------- src/floor-streams.c | 48 +++++------ src/floor.c | 1 - src/floor.h | 45 +++++----- src/gamevalue.h | 6 +- src/geometry.c | 20 ++--- src/geometry.h | 2 +- src/grid.c | 166 ++++++++++++++++++------------------- src/grid.h | 96 +++++++++++----------- src/init.c | 15 ++-- src/load.c | 126 ++++++++++++++-------------- src/main-win.c | 12 +-- src/mind.c | 42 +++++----- src/monster-process.c | 114 +++++++++++++------------- src/monster-status.c | 68 +++++++-------- src/monster.h | 2 +- src/monster1.c | 36 ++++---- src/monster2.c | 218 ++++++++++++++++++++++++------------------------- src/monsterrace-hook.c | 4 +- src/mspells1.c | 32 ++++---- src/mspells2.c | 26 +++--- src/mspells3.c | 8 +- src/mspells4.c | 142 ++++++++++++++++---------------- src/mutation.c | 8 +- src/object2.c | 150 +++++++++++++++++----------------- src/patron.c | 8 +- src/player-damage.c | 6 +- src/player-effects.c | 2 +- src/player-inventory.c | 56 ++++++------- src/player-move.c | 98 +++++++++++----------- src/player-status.c | 34 ++++---- src/player-status.h | 4 + src/quest.c | 14 ++-- src/realm-hex.c | 16 ++-- src/realm-hissatsu.c | 64 +++++++-------- src/realm-life.c | 2 +- src/report.c | 2 +- src/rooms-city.c | 10 +-- src/rooms-fractal.c | 6 +- src/rooms-pitnest.c | 8 +- src/rooms-special.c | 52 ++++++------ src/rooms-trap.c | 16 ++-- src/rooms-vault.c | 136 +++++++++++++++--------------- src/rooms.c | 210 +++++++++++++++++++++++------------------------ src/rooms.h | 2 +- src/save.c | 44 +++++----- src/scores.c | 6 +- src/sort.c | 28 +++---- src/spells-floor.c | 140 +++++++++++++++---------------- src/spells-object.c | 10 +-- src/spells-status.c | 6 +- src/spells-summon.c | 8 +- src/spells.h | 6 +- src/spells1.c | 106 ++++++++++++------------ src/spells2.c | 178 ++++++++++++++++++++-------------------- src/spells3.c | 148 ++++++++++++++++----------------- src/store.c | 6 +- src/targeting.c | 78 +++++++++--------- src/trap.c | 28 +++---- src/util.c | 8 +- src/view-mainwindow.c | 120 +++++++++++++-------------- src/warning.c | 10 +-- src/wild.c | 178 ++++++++++++++++++++-------------------- src/wizard2.c | 40 ++++----- src/world.h | 2 + 89 files changed, 2090 insertions(+), 2081 deletions(-) diff --git a/src/artifact.c b/src/artifact.c index 35bf1df3d..c780e6cd4 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -2234,7 +2234,7 @@ bool make_artifact(object_type *o_ptr) ARTIFACT_IDX i; /* No artifacts in the town */ - if (!current_floor_ptr->dun_level) return (FALSE); + if (!p_ptr->current_floor_ptr->dun_level) return (FALSE); /* Paranoia -- no "plural" artifacts */ if (o_ptr->number != 1) return (FALSE); @@ -2259,10 +2259,10 @@ bool make_artifact(object_type *o_ptr) if (a_ptr->sval != o_ptr->sval) continue; /* XXX XXX Enforce minimum "depth" (loosely) */ - if (a_ptr->level > current_floor_ptr->dun_level) + if (a_ptr->level > p_ptr->current_floor_ptr->dun_level) { /* Acquire the "out-of-depth factor" */ - int d = (a_ptr->level - current_floor_ptr->dun_level) * 2; + int d = (a_ptr->level - p_ptr->current_floor_ptr->dun_level) * 2; /* Roll for out-of-depth creation */ if (!one_in_(d)) continue; @@ -2302,7 +2302,7 @@ bool make_artifact_special(object_type *o_ptr) KIND_OBJECT_IDX k_idx = 0; /*! @note 地上ではキャンセルする / No artifacts in the town */ - if (!current_floor_ptr->dun_level) return (FALSE); + if (!p_ptr->current_floor_ptr->dun_level) return (FALSE); /*! @note get_obj_num_hookによる指定がある場合は生成をキャンセルする / Themed object */ if (get_obj_num_hook) return (FALSE); @@ -2322,10 +2322,10 @@ bool make_artifact_special(object_type *o_ptr) /*! @note アーティファクト生成階が現在に対して足りない場合は高確率で1/(不足階層*2)を満たさないと生成リストに加えられない / * XXX XXX Enforce minimum "depth" (loosely) */ - if (a_ptr->level > current_floor_ptr->object_level) + if (a_ptr->level > p_ptr->current_floor_ptr->object_level) { /* @note / Acquire the "out-of-depth factor". Roll for out-of-depth creation. */ - int d = (a_ptr->level - current_floor_ptr->object_level) * 2; + int d = (a_ptr->level - p_ptr->current_floor_ptr->object_level) * 2; if (!one_in_(d)) continue; } @@ -2335,9 +2335,9 @@ bool make_artifact_special(object_type *o_ptr) /*! @note INSTA_ART型固定アーティファクトのベースアイテムもチェック対象とする。ベースアイテムの生成階層が足りない場合1/(不足階層*5) を満たさないと除外される。 / * Find the base object. XXX XXX Enforce minimum "object" level (loosely). Acquire the "out-of-depth factor". Roll for out-of-depth creation. */ k_idx = lookup_kind(a_ptr->tval, a_ptr->sval); - if (k_info[k_idx].level > current_floor_ptr->object_level) + if (k_info[k_idx].level > p_ptr->current_floor_ptr->object_level) { - int d = (k_info[k_idx].level - current_floor_ptr->object_level) * 5; + int d = (k_info[k_idx].level - p_ptr->current_floor_ptr->object_level) * 5; if (!one_in_(d)) continue; } diff --git a/src/autopick.c b/src/autopick.c index e91e1eb5f..80f012ed3 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -1640,7 +1640,7 @@ static void autopick_delayed_alter_aux(INVENTORY_IDX item) { object_type *o_ptr; - o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(p_ptr, p_ptr->current_floor_ptr, item); if (o_ptr->k_idx && (o_ptr->marked & OM_AUTODESTROY)) { @@ -1682,10 +1682,10 @@ void autopick_delayed_alter(void) autopick_delayed_alter_aux(item); /* Scan the pile of objects */ - item = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; + item = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; while (item) { - OBJECT_IDX next = current_floor_ptr->o_list[item].next_o_idx; + OBJECT_IDX next = p_ptr->current_floor_ptr->o_list[item].next_o_idx; autopick_delayed_alter_aux(-item); item = next; } @@ -1703,7 +1703,7 @@ void autopick_alter_item(INVENTORY_IDX item, bool destroy) object_type *o_ptr; int idx; - o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(p_ptr, p_ptr->current_floor_ptr, item); /* Get the index in the auto-pick/destroy list */ idx = is_autopick(o_ptr); @@ -1728,7 +1728,7 @@ void autopick_pickup_items(grid_type *g_ptr) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { int idx; - object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; idx = is_autopick(o_ptr); diff --git a/src/birth.c b/src/birth.c index fee585a67..c87d1d6c6 100644 --- a/src/birth.c +++ b/src/birth.c @@ -4566,7 +4566,7 @@ void player_birth(player_type *creature_ptr) /* * Wipe monsters in old dungeon - * This wipe destroys value of current_floor_ptr->m_list[].cur_num . + * This wipe destroys value of p_ptr->current_floor_ptr->m_list[].cur_num . */ wipe_m_list(); diff --git a/src/bldg.c b/src/bldg.c index b80487c27..18d2808c1 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -1961,7 +1961,7 @@ static bool kankin(void) /* Prepare to make a prize */ object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval)); - apply_magic(&forge, current_floor_ptr->object_level, AM_NO_FIXED_ART); + apply_magic(&forge, p_ptr->current_floor_ptr->object_level, AM_NO_FIXED_ART); object_aware(&forge); object_known(&forge); @@ -2170,7 +2170,7 @@ static void castle_quest(void) clear_bldg(4, 18); /* Current quest of the building */ - q_index = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special; + q_index = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special; /* Is there a quest available at the building? */ if (!q_index) @@ -4091,7 +4091,7 @@ void do_cmd_bldg(void) return; } - which = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype; + which = f_info[p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype; bldg = &building[which]; @@ -4105,7 +4105,7 @@ void do_cmd_bldg(void) } else if ((which == 2) && p_ptr->inside_arena) { - if (!p_ptr->exit_bldg && current_floor_ptr->m_cnt > 0) + if (!p_ptr->exit_bldg && p_ptr->current_floor_ptr->m_cnt > 0) { prt(_("ゲートは閉まっている。モンスターがあなたを待っている!", "The gates are closed. The monster awaits!"), 0, 0); } @@ -4148,7 +4148,7 @@ void do_cmd_bldg(void) p_ptr->oldpx = p_ptr->x; } - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); /* Hack -- Increase "icky" depth */ diff --git a/src/chest.c b/src/chest.c index b1a12daea..0915a5c17 100644 --- a/src/chest.c +++ b/src/chest.c @@ -42,7 +42,7 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx) object_type forge; object_type *q_ptr; - object_type *o_ptr = ¤t_floor_ptr->o_list[o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; /* Small chests often hold "gold" */ @@ -56,12 +56,12 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx) number = 5; small = FALSE; mode |= AM_GREAT; - current_floor_ptr->object_level = o_ptr->xtra3; + p_ptr->current_floor_ptr->object_level = o_ptr->xtra3; } else { /* Determine the "value" of the items */ - current_floor_ptr->object_level = ABS(o_ptr->pval) + 10; + p_ptr->current_floor_ptr->object_level = ABS(o_ptr->pval) + 10; } /* Zero pval means empty chest */ @@ -113,7 +113,7 @@ void chest_death(bool scatter, POSITION y, POSITION x, OBJECT_IDX o_idx) } /* Reset the object level */ - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; /* Empty */ o_ptr->pval = 0; @@ -140,7 +140,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx) { int i, trap; - object_type *o_ptr = ¤t_floor_ptr->o_list[o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; int mon_level = o_ptr->xtra3; @@ -193,7 +193,7 @@ void chest_trap(POSITION y, POSITION x, OBJECT_IDX o_idx) msg_print(_("突如吹き出した煙に包み込まれた!", "You are enveloped in a cloud of smoke!")); for (i = 0; i < num; i++) { - if (randint1(100)dun_level) + if (randint1(100)current_floor_ptr->dun_level) activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); else (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); diff --git a/src/cmd/cmd-activate.c b/src/cmd/cmd-activate.c index 87ad893ba..31b6ece3f 100644 --- a/src/cmd/cmd-activate.c +++ b/src/cmd/cmd-activate.c @@ -37,6 +37,7 @@ #include "player-race.h" #include "player-class.h" #include "view-mainwindow.h" +#include "world.h" /*! * @brief 装備耐性に準じたブレス効果の選択テーブル / @@ -355,7 +356,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item) object_type *o_ptr; bool success; - o_ptr = REF_ITEM(user_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(user_ptr, p_ptr->current_floor_ptr, item); take_turn(user_ptr, 100); lev = k_info[o_ptr->k_idx].level; @@ -450,12 +451,12 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item) u16b dummy_why; /* Allocate the "who" array */ - C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX); + C_MAKE(who, current_world_ptr->max_m_idx, MONSTER_IDX); /* Process the monsters (backwards) */ - for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) + for (pet_ctr = p_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) { - if (is_pet(¤t_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr)) + if (is_pet(&p_ptr->current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr)) who[max_pet++] = pet_ctr; } @@ -469,7 +470,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item) } /* Free the "who" array */ - C_KILL(who, current_floor_ptr->max_m_idx, MONSTER_IDX); + C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX); } o_ptr->timeout = 100 + randint1(100); return; @@ -540,10 +541,10 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item) { if (place_monster_aux(0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE))) { - if (o_ptr->xtra3) current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3; - if (o_ptr->xtra5) current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5; - if (o_ptr->xtra4) current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4; - current_floor_ptr->m_list[hack_m_idx_ii].maxhp = current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp; + if (o_ptr->xtra3) p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3; + if (o_ptr->xtra5) p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5; + if (o_ptr->xtra4) p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].maxhp = p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp; if (o_ptr->inscription) { char buf[80]; @@ -585,7 +586,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item) s--; #endif *s = '\0'; - current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf); + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf); t = quark_str(o_ptr->inscription); s = buf; while(*t && (*t != '#')) @@ -1191,7 +1192,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr) case ACT_SUMMON_PHANTOM: { msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant.")); - (void)summon_specific(-1, user_ptr->y, user_ptr->x, current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET)); + (void)summon_specific(-1, user_ptr->y, user_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET)); break; } @@ -1216,7 +1217,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr) case ACT_SUMMON_DAWN: { msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn.")); - (void)summon_specific(-1, user_ptr->y, user_ptr->x, current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET)); + (void)summon_specific(-1, user_ptr->y, user_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET)); break; } @@ -1582,9 +1583,9 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr) monster_race *r_ptr; msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ...")); /* Process the monsters (backwards) */ - for (i = current_floor_ptr->m_max - 1; i >= 1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) { - m_ptr = ¤t_floor_ptr->m_list[i]; + m_ptr = &p_ptr->current_floor_ptr->m_list[i]; /* Ignore "dead" monsters */ if (!monster_is_valid(m_ptr)) continue; diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index ddc98bd40..0254e0c1a 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -92,7 +92,7 @@ static bool confirm_leave_level(player_type *creature_ptr, bool down_stair) */ bool cmd_limit_cast(player_type *creature_ptr) { - if (current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC)) + if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC)) { msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!")); msg_print(NULL); @@ -189,7 +189,7 @@ void do_cmd_go_up(player_type *creature_ptr) bool go_up = FALSE; /* Player grid */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]; feature_type *f_ptr = &f_info[g_ptr->feat]; int up_num = 0; @@ -235,7 +235,7 @@ void do_cmd_go_up(player_type *creature_ptr) /* Leaving a quest */ if (!creature_ptr->inside_quest) { - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; } creature_ptr->leaving = TRUE; @@ -248,7 +248,7 @@ void do_cmd_go_up(player_type *creature_ptr) return; } - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) { go_up = TRUE; } @@ -279,7 +279,7 @@ void do_cmd_go_up(player_type *creature_ptr) leave_quest_check(); creature_ptr->inside_quest = g_ptr->special; - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; up_num = 0; } @@ -303,15 +303,15 @@ void do_cmd_go_up(player_type *creature_ptr) } /* Get out from current dungeon */ - if (current_floor_ptr->dun_level - up_num < d_info[creature_ptr->dungeon_idx].mindepth) - up_num = current_floor_ptr->dun_level; + if (p_ptr->current_floor_ptr->dun_level - up_num < d_info[creature_ptr->dungeon_idx].mindepth) + up_num = p_ptr->current_floor_ptr->dun_level; } if (record_stair) exe_write_diary(creature_ptr, NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to")); /* Success */ if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON)) msg_print(_("なんだこの階段は!", "What's this STAIRWAY!")); - else if (up_num == current_floor_ptr->dun_level) + else if (up_num == p_ptr->current_floor_ptr->dun_level) msg_print(_("地上に戻った。", "You go back to the surface.")); else msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases.")); @@ -326,7 +326,7 @@ void do_cmd_go_up(player_type *creature_ptr) void do_cmd_go_down(player_type *creature_ptr) { /* Player grid */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]; feature_type *f_ptr = &f_info[g_ptr->feat]; bool fall_trap = FALSE; @@ -382,7 +382,7 @@ void do_cmd_go_down(player_type *creature_ptr) /* Leaving a quest */ if (!creature_ptr->inside_quest) { - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; } creature_ptr->leaving = TRUE; creature_ptr->oldpx = 0; @@ -395,7 +395,7 @@ void do_cmd_go_down(player_type *creature_ptr) { DUNGEON_IDX target_dungeon = 0; - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) { target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? g_ptr->special : DUNGEON_ANGBAND; @@ -431,7 +431,7 @@ void do_cmd_go_down(player_type *creature_ptr) if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2; else down_num += 1; - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) { /* Enter the dungeon just now */ creature_ptr->enter_dungeon = TRUE; @@ -518,7 +518,7 @@ void do_cmd_search(player_type * creature_ptr) */ static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; /* Scan all objects in the grid */ @@ -526,7 +526,7 @@ static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Skip unknown chests XXX XXX */ @@ -558,7 +558,7 @@ static bool exe_open_chest(player_type *creature_ptr, POSITION y, POSITION x, OB int i, j; bool flag = TRUE; bool more = FALSE; - object_type *o_ptr = ¤t_floor_ptr->o_list[o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; take_turn(creature_ptr, 100); @@ -645,8 +645,8 @@ static int count_dt(player_type *creature_ptr, POSITION *y, POSITION *x, bool (* yy = creature_ptr->y + ddy_ddd[d]; xx = creature_ptr->x + ddx_ddd[d]; - /* Get the current_floor_ptr->grid_array */ - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + /* Get the p_ptr->current_floor_ptr->grid_array */ + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; /* Must have knowledge */ if (!(g_ptr->info & (CAVE_MARK))) continue; @@ -701,7 +701,7 @@ static int count_chests(player_type *creature_ptr, POSITION *y, POSITION *x, boo if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue; /* Grab the object */ - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; /* Already open */ if (o_ptr->pval == 0) continue; @@ -740,7 +740,7 @@ static bool exe_open(player_type *creature_ptr, POSITION y, POSITION x) int i, j; /* Get requested grid */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; bool more = FALSE; @@ -871,7 +871,7 @@ void do_cmd_open(player_type *creature_ptr) x = creature_ptr->x + ddx[dir]; /* Get requested grid */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -918,7 +918,7 @@ void do_cmd_open(player_type *creature_ptr) */ static bool exe_close(player_type *creature_ptr, POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; FEAT_IDX old_feat = g_ptr->feat; bool more = FALSE; @@ -1007,7 +1007,7 @@ void do_cmd_close(player_type *creature_ptr) y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -1051,7 +1051,7 @@ void do_cmd_close(player_type *creature_ptr) */ static bool do_cmd_tunnel_test(POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Must have knowledge */ if (!(g_ptr->info & CAVE_MARK)) @@ -1097,7 +1097,7 @@ static bool exe_tunnel(player_type *creature_ptr, POSITION y, POSITION x) take_turn(creature_ptr, 100); - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; f_ptr = &f_info[g_ptr->feat]; power = f_ptr->power; @@ -1241,7 +1241,7 @@ void do_cmd_tunnel(player_type *creature_ptr) y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -1298,7 +1298,7 @@ bool easy_open_door(player_type *creature_ptr, POSITION y, POSITION x) { int i, j; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; /* Must be a closed door */ @@ -1388,7 +1388,7 @@ static bool exe_disarm_chest(player_type *creature_ptr, POSITION y, POSITION x, { int i, j; bool more = FALSE; - object_type *o_ptr = ¤t_floor_ptr->o_list[o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; take_turn(creature_ptr, 100); @@ -1469,7 +1469,7 @@ static bool exe_disarm_chest(player_type *creature_ptr, POSITION y, POSITION x, bool exe_disarm(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Get feature */ feature_type *f_ptr = &f_info[g_ptr->feat]; @@ -1594,7 +1594,7 @@ void do_cmd_disarm(player_type *creature_ptr) y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -1651,7 +1651,7 @@ void do_cmd_disarm(player_type *creature_ptr) */ static bool do_cmd_bash_aux(player_type *creature_ptr, POSITION y, POSITION x, DIRECTION dir) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Get feature */ feature_type *f_ptr = &f_info[g_ptr->feat]; @@ -1776,7 +1776,7 @@ void do_cmd_bash(player_type *creature_ptr) y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -1858,7 +1858,7 @@ void do_cmd_alter(player_type *creature_ptr) y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -1977,7 +1977,7 @@ void do_cmd_spike(player_type *creature_ptr) y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -2548,7 +2548,7 @@ bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_ID if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT)) { hit_wall = TRUE; - if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !current_floor_ptr->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break; + if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !p_ptr->current_floor_ptr->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break; } /* The player can see the (on screen) missile */ @@ -2584,10 +2584,10 @@ bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_ID cur_dis++; /* Monster here, Try to hit it */ - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; GAME_TEXT m_name[MAX_NLEN]; monster_name(g_ptr->m_idx, m_name); @@ -2717,13 +2717,13 @@ bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_ID if (potion_smash_effect(0, y, x, q_ptr->k_idx)) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]; - if (current_floor_ptr->grid_array[y][x].m_idx && is_friendly(m_ptr) && !MON_INVULNER(m_ptr)) + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx]; + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx && is_friendly(m_ptr) && !MON_INVULNER(m_ptr)) { GAME_TEXT m_name[MAX_NLEN]; monster_desc(m_name, m_ptr, 0); msg_format(_("%sは怒った!", "%^s gets angry!"), m_name); - set_hostile(¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]); + set_hostile(&p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx]); } } do_drop = FALSE; diff --git a/src/cmd/cmd-dump.c b/src/cmd/cmd-dump.c index 6637dc6ae..578c68029 100644 --- a/src/cmd/cmd-dump.c +++ b/src/cmd/cmd-dump.c @@ -454,13 +454,13 @@ errr exe_write_diary(player_type *creature_ptr, int type, int num, concptr note) return (-1); } - q_idx = quest_number(current_floor_ptr->dun_level); + q_idx = quest_number(p_ptr->current_floor_ptr->dun_level); if (write_level) { if (creature_ptr->inside_arena) note_level = _("アリーナ:", "Arane:"); - else if (!current_floor_ptr->dun_level) + else if (!p_ptr->current_floor_ptr->dun_level) note_level = _("地上:", "Surface:"); else if (q_idx && (is_fixed_quest_idx(q_idx) && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT)))) @@ -468,9 +468,9 @@ errr exe_write_diary(player_type *creature_ptr, int type, int num, concptr note) else { #ifdef JP - sprintf(note_level_buf, "%d階(%s):", (int)current_floor_ptr->dun_level, d_name+d_info[creature_ptr->dungeon_idx].name); + sprintf(note_level_buf, "%d階(%s):", (int)p_ptr->current_floor_ptr->dun_level, d_name+d_info[creature_ptr->dungeon_idx].name); #else - sprintf(note_level_buf, "%s L%d:", d_name+d_info[creature_ptr->dungeon_idx].name, (int)current_floor_ptr->dun_level); + sprintf(note_level_buf, "%s L%d:", d_name+d_info[creature_ptr->dungeon_idx].name, (int)p_ptr->current_floor_ptr->dun_level); #endif note_level = note_level_buf; } @@ -567,8 +567,8 @@ errr exe_write_diary(player_type *creature_ptr, int type, int num, concptr note) } else { - if (!(current_floor_ptr->dun_level+num)) to = _("地上", "the surface"); - else to = format(_("%d階", "level %d"), current_floor_ptr->dun_level+num); + if (!(p_ptr->current_floor_ptr->dun_level+num)) to = _("地上", "the surface"); + else to = format(_("%d階", "level %d"), p_ptr->current_floor_ptr->dun_level+num); } fprintf(fff, _(" %2d:%02d %20s %sへ%s。\n", " %2d:%02d %20s %s %s.\n"), hour, min, note_level, _(to, note), _(note, to)); break; @@ -634,10 +634,10 @@ errr exe_write_diary(player_type *creature_ptr, int type, int num, concptr note) case NIKKI_WIZ_TELE: { concptr to; - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) to = _("地上", "the surface"); else - to = format(_("%d階(%s)", "level %d of %s"), current_floor_ptr->dun_level, d_name+d_info[creature_ptr->dungeon_idx].name); + to = format(_("%d階(%s)", "level %d of %s"), p_ptr->current_floor_ptr->dun_level, d_name+d_info[creature_ptr->dungeon_idx].name); fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n", " %2d:%02d %20s wizard-teleport to %s.\n"), hour, min, note_level, to); @@ -646,10 +646,10 @@ errr exe_write_diary(player_type *creature_ptr, int type, int num, concptr note) case NIKKI_PAT_TELE: { concptr to; - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) to = _("地上", "the surface"); else - to = format(_("%d階(%s)", "level %d of %s"), current_floor_ptr->dun_level, d_name+d_info[creature_ptr->dungeon_idx].name); + to = format(_("%d階(%s)", "level %d of %s"), p_ptr->current_floor_ptr->dun_level, d_name+d_info[creature_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); @@ -2913,14 +2913,14 @@ void do_cmd_feeling(player_type *creature_ptr) if (creature_ptr->wild_mode) return; /* No useful feeling in quests */ - if (creature_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) + if (creature_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) { msg_print(_("典型的なクエストのダンジョンのようだ。", "Looks like a typical quest level.")); return; } /* No useful feeling in town */ - else if (creature_ptr->town_num && !current_floor_ptr->dun_level) + else if (creature_ptr->town_num && !p_ptr->current_floor_ptr->dun_level) { if (!strcmp(town_info[creature_ptr->town_num].name, _("荒野", "wilderness"))) { @@ -2935,7 +2935,7 @@ void do_cmd_feeling(player_type *creature_ptr) } /* No useful feeling in the wilderness */ - else if (!current_floor_ptr->dun_level) + else if (!p_ptr->current_floor_ptr->dun_level) { msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness.")); return; @@ -4195,11 +4195,11 @@ static void do_cmd_knowledge_artifacts(void) } /* Check the dungeon */ - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -4207,7 +4207,7 @@ static void do_cmd_knowledge_artifacts(void) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Ignore non-artifacts */ @@ -4625,9 +4625,9 @@ static void do_cmd_knowledge_pets(void) } /* Process the monsters (backwards) */ - for (i = current_floor_ptr->m_max - 1; i >= 1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) { - m_ptr = ¤t_floor_ptr->m_list[i]; + m_ptr = &p_ptr->current_floor_ptr->m_list[i]; /* Ignore "dead" monsters */ if (!monster_is_valid(m_ptr)) continue; diff --git a/src/cmd/cmd-eat.c b/src/cmd/cmd-eat.c index ee9459844..f6f585d29 100644 --- a/src/cmd/cmd-eat.c +++ b/src/cmd/cmd-eat.c @@ -39,7 +39,7 @@ void exe_eat_food(player_type *creature_ptr, INVENTORY_IDX item) if (music_singing_any(creature_ptr)) stop_singing(creature_ptr); if (hex_spelling_any(creature_ptr)) stop_hex_spell_all(); - o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item); sound(SOUND_EAT); diff --git a/src/cmd/cmd-mane.c b/src/cmd/cmd-mane.c index 3c76f06c9..c2d2a069b 100644 --- a/src/cmd/cmd-mane.c +++ b/src/cmd/cmd-mane.c @@ -291,7 +291,7 @@ static bool use_mane(player_type *caster_ptr, int spell) MONSTER_IDX m_idx; if (!target_set(TARGET_KILL)) return FALSE; - m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx; + m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break; @@ -680,10 +680,10 @@ static bool use_mane(player_type *caster_ptr, int spell) GAME_TEXT m_name[MAX_NLEN]; if (!target_set(TARGET_KILL)) return FALSE; - if (!current_floor_ptr->grid_array[target_row][target_col].m_idx) break; + if (!p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break; - m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); if (r_ptr->flagsr & RFR_RES_TELE) @@ -705,7 +705,7 @@ static bool use_mane(player_type *caster_ptr, int spell) } msg_format(_("%sを引き戻した。", "You command %s to return."), m_name); - teleport_monster_to(current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE); + teleport_monster_to(p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: @@ -756,7 +756,7 @@ static bool use_mane(player_type *caster_ptr, int spell) case MS_S_CYBER: { int k; - int max_cyber = (current_floor_ptr->dun_level / 50) + randint1(3); + int max_cyber = (p_ptr->current_floor_ptr->dun_level / 50) + randint1(3); if (!target_set(TARGET_KILL)) return FALSE; msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!")); if (max_cyber > 4) max_cyber = 4; diff --git a/src/cmd/cmd-pet.c b/src/cmd/cmd-pet.c index 04395bc81..f213473a0 100644 --- a/src/cmd/cmd-pet.c +++ b/src/cmd/cmd-pet.c @@ -82,12 +82,12 @@ PERCENTAGE calculate_upkeep(player_type *creature_ptr) total_friends = 0; - for (m_idx = current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) + for (m_idx = p_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) { monster_type *m_ptr; monster_race *r_ptr; - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if (!monster_is_valid(m_ptr)) continue; r_ptr = &r_info[m_ptr->r_idx]; @@ -150,12 +150,12 @@ void do_cmd_pet_dismiss(player_type *creature_ptr) Term->scr->cv = 1; /* Allocate the "who" array */ - C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX); + C_MAKE(who, current_world_ptr->max_m_idx, MONSTER_IDX); /* Process the monsters (backwards) */ - for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) + for (pet_ctr = p_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) { - if (is_pet(¤t_floor_ptr->m_list[pet_ctr])) + if (is_pet(&p_ptr->current_floor_ptr->m_list[pet_ctr])) who[max_pet++] = pet_ctr; } @@ -169,7 +169,7 @@ void do_cmd_pet_dismiss(player_type *creature_ptr) bool kakunin; pet_ctr = who[i]; - m_ptr = ¤t_floor_ptr->m_list[pet_ctr]; + m_ptr = &p_ptr->current_floor_ptr->m_list[pet_ctr]; delete_this = FALSE; kakunin = ((pet_ctr == creature_ptr->riding) || (m_ptr->nickname)); @@ -251,7 +251,7 @@ void do_cmd_pet_dismiss(player_type *creature_ptr) Term->scr->cv = cv; Term_fresh(); - C_KILL(who, current_floor_ptr->max_m_idx, MONSTER_IDX); + C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX); #ifdef JP msg_format("%d 体のペットを放しました。", Dismissed); @@ -282,7 +282,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (creature_ptr->special_defense & KATA_MUSOU) set_action(creature_ptr, ACTION_NONE); @@ -315,7 +315,7 @@ bool do_cmd_riding(player_type *creature_ptr, bool force) { if (cmd_limit_confused(creature_ptr)) return FALSE; - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; if (!g_ptr->m_idx || !m_ptr->ml) { @@ -409,9 +409,9 @@ static void do_name_pet(void) } target_pet = old_target_pet; - if (current_floor_ptr->grid_array[target_row][target_col].m_idx) + if (p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) { - m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx]; if (!is_pet(m_ptr)) { @@ -499,10 +499,10 @@ void do_cmd_pet(player_type *creature_ptr) #ifdef JP sprintf(target_buf, "ペットのターゲットを指定 (現在:%s)", - (creature_ptr->pet_t_m_idx ? (creature_ptr->image ? "何か奇妙な物" : (r_name + r_info[current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name)) : "指定なし")); + (creature_ptr->pet_t_m_idx ? (creature_ptr->image ? "何か奇妙な物" : (r_name + r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name)) : "指定なし")); #else sprintf(target_buf, "specify a target of pet (now:%s)", - (creature_ptr->pet_t_m_idx ? (creature_ptr->image ? "something strange" : (r_name + r_info[current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name)) : "nothing")); + (creature_ptr->pet_t_m_idx ? (creature_ptr->image ? "something strange" : (r_name + r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name)) : "nothing")); #endif power_desc[num] = target_buf; powers[num++] = PET_TARGET; @@ -815,10 +815,10 @@ void do_cmd_pet(player_type *creature_ptr) case PET_DISMISS: /* Dismiss pets */ { /* Check pets (backwards) */ - for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) + for (pet_ctr = p_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) { /* Player has pet */ - if (is_pet(¤t_floor_ptr->m_list[pet_ctr])) break; + if (is_pet(&p_ptr->current_floor_ptr->m_list[pet_ctr])) break; } if (!pet_ctr) @@ -836,10 +836,10 @@ void do_cmd_pet(player_type *creature_ptr) if (!target_set(TARGET_KILL)) creature_ptr->pet_t_m_idx = 0; else { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[target_row][target_col]; - if (g_ptr->m_idx && (current_floor_ptr->m_list[g_ptr->m_idx].ml)) + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[target_row][target_col]; + if (g_ptr->m_idx && (p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) { - creature_ptr->pet_t_m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx; + creature_ptr->pet_t_m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx; creature_ptr->pet_follow_distance = PET_DESTROY_DIST; } else creature_ptr->pet_t_m_idx = 0; @@ -893,9 +893,9 @@ void do_cmd_pet(player_type *creature_ptr) if (creature_ptr->pet_extra_flags & PF_PICKUP_ITEMS) { creature_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS); - for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) + for (pet_ctr = p_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) { - m_ptr = ¤t_floor_ptr->m_list[pet_ctr]; + m_ptr = &p_ptr->current_floor_ptr->m_list[pet_ctr]; if (is_pet(m_ptr)) { @@ -972,7 +972,7 @@ bool rakuba(player_type *creature_ptr, HIT_POINT dam, bool force) POSITION y, x, oy, ox, sy = 0, sx = 0; int sn = 0; GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool fall_dam = FALSE; @@ -1022,7 +1022,7 @@ bool rakuba(player_type *creature_ptr, HIT_POINT dam, bool force) y = creature_ptr->y + ddy_ddd[i]; x = creature_ptr->x + ddx_ddd[i]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (g_ptr->m_idx) continue; diff --git a/src/cmd/cmd-quaff.c b/src/cmd/cmd-quaff.c index c1e466565..6120033b7 100644 --- a/src/cmd/cmd-quaff.c +++ b/src/cmd/cmd-quaff.c @@ -62,7 +62,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item) if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all(); } - o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item); q_ptr = &forge; object_copy(q_ptr, o_ptr); diff --git a/src/cmd/cmd-read.c b/src/cmd/cmd-read.c index a29b92d4f..09503d5e7 100644 --- a/src/cmd/cmd-read.c +++ b/src/cmd/cmd-read.c @@ -52,7 +52,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) int k, used_up, ident, lev; object_type *o_ptr; - o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item); take_turn(creature_ptr, 100); if (cmd_limit_time_walk(creature_ptr)) return; @@ -121,7 +121,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) { for (k = 0; k < randint1(3); k++) { - if (summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { ident = TRUE; } @@ -133,7 +133,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) { for (k = 0; k < randint1(3); k++) { - if (summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { ident = TRUE; } @@ -143,7 +143,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) case SV_SCROLL_SUMMON_PET: { - if (summon_specific(-1, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET))) + if (summon_specific(-1, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET))) { ident = TRUE; } diff --git a/src/cmd/cmd-spell.c b/src/cmd/cmd-spell.c index 31f6a8b1c..f6028c89c 100644 --- a/src/cmd/cmd-spell.c +++ b/src/cmd/cmd-spell.c @@ -1377,17 +1377,17 @@ void do_cmd_cast(player_type *caster_ptr) exp_gain += 60; else if (cur_exp < SPELL_EXP_SKILLED) { - if ((current_floor_ptr->dun_level > 4) && ((current_floor_ptr->dun_level + 10) > caster_ptr->lev)) + if ((p_ptr->current_floor_ptr->dun_level > 4) && ((p_ptr->current_floor_ptr->dun_level + 10) > caster_ptr->lev)) exp_gain = 8; } else if (cur_exp < SPELL_EXP_EXPERT) { - if (((current_floor_ptr->dun_level + 5) > caster_ptr->lev) && ((current_floor_ptr->dun_level + 5) > s_ptr->slevel)) + if (((p_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && ((p_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) exp_gain = 2; } else if ((cur_exp < SPELL_EXP_MASTER) && !increment) { - if (((current_floor_ptr->dun_level + 5) > caster_ptr->lev) && (current_floor_ptr->dun_level > s_ptr->slevel)) + if (((p_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && (p_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) exp_gain = 1; } caster_ptr->spell_exp[(increment ? 32 : 0) + spell] += exp_gain; diff --git a/src/cmd/cmd-usestaff.c b/src/cmd/cmd-usestaff.c index fd8bb404c..09c522857 100644 --- a/src/cmd/cmd-usestaff.c +++ b/src/cmd/cmd-usestaff.c @@ -65,7 +65,7 @@ int staff_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use const int times = randint1(powerful ? 8 : 4); for (k = 0; k < times; k++) { - if (summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { ident = TRUE; } @@ -290,7 +290,7 @@ void exe_use_staff(player_type *creature_ptr, INVENTORY_IDX item) /* Hack -- let staffs of identify get aborted */ bool use_charge = TRUE; - o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item); /* Mega-Hack -- refuse to use a pile from the ground */ if ((item < 0) && (o_ptr->number > 1)) diff --git a/src/cmd/cmd-zaprod.c b/src/cmd/cmd-zaprod.c index e7b3a1e75..465f09d32 100644 --- a/src/cmd/cmd-zaprod.c +++ b/src/cmd/cmd-zaprod.c @@ -281,7 +281,7 @@ void exe_zap_rod(player_type *creature_ptr, INVENTORY_IDX item) object_kind *k_ptr; - o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item); /* Mega-Hack -- refuse to zap a pile from the ground */ if ((item < 0) && (o_ptr->number > 1)) diff --git a/src/cmd/cmd-zapwand.c b/src/cmd/cmd-zapwand.c index ad62695cf..1b5bc0760 100644 --- a/src/cmd/cmd-zapwand.c +++ b/src/cmd/cmd-zapwand.c @@ -335,7 +335,7 @@ void exe_aim_wand(player_type *creature_ptr, INVENTORY_IDX item) object_type *o_ptr; bool old_target_pet = target_pet; - o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item); + o_ptr = REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item); /* Mega-Hack -- refuse to aim a pile from the ground */ if ((item < 0) && (o_ptr->number > 1)) diff --git a/src/combat/melee1.c b/src/combat/melee1.c index e3a1b8094..4c402e5f7 100644 --- a/src/combat/melee1.c +++ b/src/combat/melee1.c @@ -1150,7 +1150,7 @@ static void natural_attack(MONSTER_IDX m_idx, int attack, bool *fear, bool *mdea HIT_POINT k; int bonus, chance; WEIGHT n_weight = 0; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -1284,9 +1284,9 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo int num = 0, bonus, chance, vir; HIT_POINT k; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Access the weapon */ @@ -1998,7 +1998,7 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo } /* Hack -- Get new monster */ - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Oops, we need a different name... */ monster_desc(m_name, m_ptr, 0); @@ -2009,11 +2009,11 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo } else if (o_ptr->name1 == ART_G_HAMMER) { - monster_type *target_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *target_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; if (target_ptr->hold_o_idx) { - object_type *q_ptr = ¤t_floor_ptr->o_list[target_ptr->hold_o_idx]; + object_type *q_ptr = &p_ptr->current_floor_ptr->o_list[target_ptr->hold_o_idx]; GAME_TEXT o_name[MAX_NLEN]; object_desc(o_name, q_ptr, OD_NAME_ONLY); @@ -2153,7 +2153,7 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo if (do_quake) { earthquake(attacker_ptr->y, attacker_ptr->x, 10, 0); - if (!current_floor_ptr->grid_array[y][x].m_idx) *mdeath = TRUE; + if (!p_ptr->current_floor_ptr->grid_array[y][x].m_idx) *mdeath = TRUE; } } @@ -2172,8 +2172,8 @@ bool py_attack(player_type *attacker_ptr, POSITION y, POSITION x, COMBAT_OPTION_ bool mdeath = FALSE; bool stormbringer = FALSE; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -2292,7 +2292,7 @@ bool py_attack(player_type *attacker_ptr, POSITION y, POSITION x, COMBAT_OPTION_ if (cur < max) { - DEPTH ridinglevel = r_info[current_floor_ptr->m_list[attacker_ptr->riding].r_idx].level; + DEPTH ridinglevel = r_info[p_ptr->current_floor_ptr->m_list[attacker_ptr->riding].r_idx].level; DEPTH targetlevel = r_ptr->level; int inc = 0; @@ -2355,7 +2355,7 @@ bool py_attack(player_type *attacker_ptr, POSITION y, POSITION x, COMBAT_OPTION_ */ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; int ap_cnt; @@ -3018,7 +3018,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx) if (o_idx) { object_type *j_ptr; - j_ptr = ¤t_floor_ptr->o_list[o_idx]; + j_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; object_copy(j_ptr, o_ptr); /* Modify number */ @@ -3833,7 +3833,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK); } - if (is_mirror_grid(¤t_floor_ptr->grid_array[target_ptr->y][target_ptr->x])) + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[target_ptr->y][target_ptr->x])) { teleport_player(10, 0L); } @@ -4031,7 +4031,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx) if (target_ptr->riding && damage) { char m_steed_name[MAX_NLEN]; - monster_desc(m_steed_name, ¤t_floor_ptr->m_list[target_ptr->riding], 0); + monster_desc(m_steed_name, &p_ptr->current_floor_ptr->m_list[target_ptr->riding], 0); if (rakuba(target_ptr, (damage > 200) ? 200 : damage, FALSE)) { msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_steed_name); @@ -4126,8 +4126,8 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx) */ bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; @@ -4174,7 +4174,7 @@ bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx) if (!see_either && known) { - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(p_ptr, TRUE, TRUE); @@ -4719,7 +4719,7 @@ bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx) } else if (known) { - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } } else @@ -4730,7 +4730,7 @@ bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx) } else if (known) { - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L); @@ -4755,7 +4755,7 @@ bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx) */ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, concptr note, MONSTER_IDX who) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[160]; bool seen = is_seen(m_ptr); @@ -4834,7 +4834,7 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, /* Unseen death by normal attack */ if (!seen) { - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /* Death by special attack */ else if (note) @@ -4907,9 +4907,9 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr) && (who != m_idx)) { - if (is_pet(¤t_floor_ptr->m_list[who]) && !player_bold(m_ptr->target_y, m_ptr->target_x)) + if (is_pet(&p_ptr->current_floor_ptr->m_list[who]) && !player_bold(m_ptr->target_y, m_ptr->target_x)) { - set_target(m_ptr, current_floor_ptr->m_list[who].fy, current_floor_ptr->m_list[who].fx); + set_target(m_ptr, p_ptr->current_floor_ptr->m_list[who].fy, p_ptr->current_floor_ptr->m_list[who].fx); } } diff --git a/src/combat/shoot.c b/src/combat/shoot.c index 3f8ea1c6e..9d1944725 100644 --- a/src/combat/shoot.c +++ b/src/combat/shoot.c @@ -389,7 +389,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, } else { - o_ptr = ¤t_floor_ptr->o_list[0 - item]; + o_ptr = &p_ptr->current_floor_ptr->o_list[0 - item]; } /* Sniper - Cannot shot a single arrow twice */ @@ -536,7 +536,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, /* Shatter Arrow */ if (snipe_type == SP_KILL_WALL) { - g_ptr = ¤t_floor_ptr->grid_array[ny][nx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx]; if (cave_have_flag_grid(g_ptr, FF_HURT_ROCK) && !g_ptr->m_idx) { @@ -554,7 +554,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, } /* Stopped by walls/doors */ - if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && !current_floor_ptr->grid_array[ny][nx].m_idx) break; + if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && !p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx) break; /* Advance the distance */ cur_dis++; @@ -562,7 +562,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, /* Sniper */ if (snipe_type == SP_LITE) { - current_floor_ptr->grid_array[ny][nx].info |= (CAVE_GLOW); + p_ptr->current_floor_ptr->grid_array[ny][nx].info |= (CAVE_GLOW); note_spot(ny, nx); lite_spot(ny, nx); } @@ -599,7 +599,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, /* Sniper */ if (snipe_type == SP_EVILNESS) { - current_floor_ptr->grid_array[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK); + p_ptr->current_floor_ptr->grid_array[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK); note_spot(ny, nx); lite_spot(ny, nx); } @@ -612,11 +612,11 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, y = ny; /* Monster here, Try to hit it */ - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { - grid_type *c_mon_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *c_mon_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[c_mon_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[c_mon_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Check the visibility */ @@ -649,7 +649,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, if (shooter_ptr->riding) { if ((shooter_ptr->skill_exp[GINOU_RIDING] < s_info[shooter_ptr->pclass].s_max[GINOU_RIDING]) - && ((shooter_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[current_floor_ptr->m_list[shooter_ptr->riding].r_idx].level) + && ((shooter_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[p_ptr->current_floor_ptr->m_list[shooter_ptr->riding].r_idx].level) && one_in_(2)) { shooter_ptr->skill_exp[GINOU_RIDING] += 1; @@ -735,7 +735,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, /* Sniper */ if (snipe_type == SP_HOLYNESS) { - current_floor_ptr->grid_array[ny][nx].info |= (CAVE_GLOW); + p_ptr->current_floor_ptr->grid_array[ny][nx].info |= (CAVE_GLOW); note_spot(ny, nx); lite_spot(ny, nx); } @@ -796,13 +796,13 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, if (!in_bounds2(ny, nx)) break; /* Stopped by walls/doors */ - if (!player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0)) break; + if (!player_can_enter(p_ptr->current_floor_ptr->grid_array[ny][nx].feat, 0)) break; /* Stopped by monsters */ if (!cave_empty_bold(ny, nx)) break; - current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; - current_floor_ptr->grid_array[oy][ox].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; m_ptr->fx = nx; m_ptr->fy = ny; @@ -842,8 +842,8 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, if (stick_to) { - MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + MONSTER_IDX m_idx = p_ptr->current_floor_ptr->grid_array[y][x].m_idx; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; OBJECT_IDX o_idx = o_pop(); if (!o_idx) @@ -856,7 +856,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, return; } - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; object_copy(o_ptr, q_ptr); /* Forget mark */ diff --git a/src/core.c b/src/core.c index 3407328e2..09fb7000b 100644 --- a/src/core.c +++ b/src/core.c @@ -622,14 +622,14 @@ static void pattern_teleport(void) /* Only downward in ironman mode */ if (ironman_downward) - min_level = current_floor_ptr->dun_level; + min_level = p_ptr->current_floor_ptr->dun_level; /* Maximum level */ if (p_ptr->dungeon_idx == DUNGEON_ANGBAND) { - if (current_floor_ptr->dun_level > 100) + if (p_ptr->current_floor_ptr->dun_level > 100) max_level = MAX_DEPTH - 1; - else if (current_floor_ptr->dun_level == 100) + else if (p_ptr->current_floor_ptr->dun_level == 100) max_level = 100; } else @@ -642,7 +642,7 @@ static void pattern_teleport(void) sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level); /* Default */ - sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level); + sprintf(tmp_val, "%d", (int)p_ptr->current_floor_ptr->dun_level); /* Ask for a level */ if (!get_string(ppp, tmp_val, 10)) return; @@ -668,7 +668,7 @@ static void pattern_teleport(void) if (autosave_l) do_cmd_save_game(TRUE); /* Change level */ - current_floor_ptr->dun_level = command_arg; + p_ptr->current_floor_ptr->dun_level = command_arg; leave_quest_check(); @@ -701,7 +701,7 @@ static bool pattern_effect(player_type *creature_ptr) wreck_the_pattern(creature_ptr); } - pattern_type = f_info[current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype; + pattern_type = f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype; switch (pattern_type) { @@ -939,10 +939,10 @@ static void regen_monsters(void) /* Regenerate everyone */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { /* Check the i'th monster */ - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -1181,11 +1181,11 @@ static void check_music(player_type *creature_ptr) if (creature_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER) creature_ptr->spell_exp[spell] += 5; else if(creature_ptr->spell_exp[spell] < SPELL_EXP_SKILLED) - { if (one_in_(2) && (current_floor_ptr->dun_level > 4) && ((current_floor_ptr->dun_level + 10) > creature_ptr->lev)) creature_ptr->spell_exp[spell] += 1; } + { if (one_in_(2) && (p_ptr->current_floor_ptr->dun_level > 4) && ((p_ptr->current_floor_ptr->dun_level + 10) > creature_ptr->lev)) creature_ptr->spell_exp[spell] += 1; } else if(creature_ptr->spell_exp[spell] < SPELL_EXP_EXPERT) - { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > creature_ptr->lev) && ((current_floor_ptr->dun_level + 5) > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; } + { if (one_in_(5) && ((p_ptr->current_floor_ptr->dun_level + 5) > creature_ptr->lev) && ((p_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; } else if(creature_ptr->spell_exp[spell] < SPELL_EXP_MASTER) - { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > creature_ptr->lev) && (current_floor_ptr->dun_level > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; } + { if (one_in_(5) && ((p_ptr->current_floor_ptr->dun_level + 5) > creature_ptr->lev) && (p_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; } /* Do any effects of continual song */ exe_spell(creature_ptr, REALM_MUSIC, spell, SPELL_CONT); @@ -1335,7 +1335,7 @@ static void process_world_aux_digestion(player_type *creature_ptr) */ static void process_world_aux_hp_and_sp(player_type *creature_ptr) { - feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat]; + feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat]; bool cave_no_regen = FALSE; int upkeep_factor = 0; @@ -1400,9 +1400,9 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr) /* (Vampires) Take damage from sunlight */ if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE)) { - if (!current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN() && is_daytime()) + if (!p_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN() && is_daytime()) { - if ((current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) + if ((p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!")); take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1); @@ -1457,11 +1457,11 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr) { msg_print(_("熱で火傷した!", "The heat burns you!")); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); } else { - concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; msg_format(_("%sで火傷した!", "The %s burns you!"), name); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1); } @@ -1495,11 +1495,11 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr) { msg_print(_("冷気に覆われた!", "The cold engulfs you!")); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); } else { - concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; msg_format(_("%sに凍えた!", "The %s frostbites you!"), name); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1); } @@ -1533,11 +1533,11 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr) { msg_print(_("電撃を受けた!", "The electric shocks you!")); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); } else { - concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; msg_format(_("%sに感電した!", "The %s shocks you!"), name); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1); } @@ -1571,11 +1571,11 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr) { msg_print(_("酸が飛び散った!", "The acid melt you!")); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); } else { - concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; msg_format(_("%sに溶かされた!", "The %s melts you!"), name); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1); } @@ -1609,12 +1609,12 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr) { msg_print(_("毒気を吸い込んだ!", "The gas poisons you!")); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); + f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1); if (creature_ptr->resist_pois) (void)set_poisoned(creature_ptr, creature_ptr->poisoned + 1); } else { - concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; + concptr name = f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name; msg_format(_("%sに毒された!", "The %s poisons you!"), name); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1); if (creature_ptr->resist_pois) (void)set_poisoned(creature_ptr, creature_ptr->poisoned + 3); @@ -1638,27 +1638,27 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr) if (creature_ptr->riding) { HIT_POINT damage; - if ((r_info[current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !creature_ptr->immune_fire) + if ((r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !creature_ptr->immune_fire) { - damage = r_info[current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2; + damage = r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2; if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3; if (creature_ptr->resist_fire) damage = damage / 3; if (IS_OPPOSE_FIRE()) damage = damage / 3; msg_print(_("熱い!", "It's hot!")); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1); } - if ((r_info[current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !creature_ptr->immune_elec) + if ((r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !creature_ptr->immune_elec) { - damage = r_info[current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2; + damage = r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2; if (PRACE_IS_(creature_ptr, RACE_ANDROID)) damage += damage / 3; if (creature_ptr->resist_elec) damage = damage / 3; if (IS_OPPOSE_ELEC()) damage = damage / 3; msg_print(_("痛い!", "It hurts!")); take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1); } - if ((r_info[current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !creature_ptr->immune_cold) + if ((r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !creature_ptr->immune_cold) { - damage = r_info[current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2; + damage = r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2; if (creature_ptr->resist_cold) damage = damage / 3; if (IS_OPPOSE_COLD()) damage = damage / 3; msg_print(_("冷たい!", "It's cold!")); @@ -2262,7 +2262,7 @@ static void process_world_aux_mutation(player_type *creature_ptr) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode)) + if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode)) { msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!")); disturb(creature_ptr, FALSE, TRUE); @@ -2306,7 +2306,7 @@ static void process_world_aux_mutation(player_type *creature_ptr) msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely.")); banish_monsters(100); - if (!current_floor_ptr->dun_level && creature_ptr->town_num) + if (!p_ptr->current_floor_ptr->dun_level && creature_ptr->town_num) { int n; @@ -2331,7 +2331,7 @@ static void process_world_aux_mutation(player_type *creature_ptr) msg_print(NULL); /* Absorb light from the current possition */ - if ((current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) + if ((p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { hp_player(creature_ptr, 10); } @@ -2371,7 +2371,7 @@ static void process_world_aux_mutation(player_type *creature_ptr) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode)) + if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode)) { msg_print(_("動物を引き寄せた!", "You have attracted an animal!")); disturb(creature_ptr, FALSE, TRUE); @@ -2449,7 +2449,7 @@ static void process_world_aux_mutation(player_type *creature_ptr) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode)) + if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode)) { msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!")); disturb(creature_ptr, FALSE, TRUE); @@ -2488,9 +2488,9 @@ static void process_world_aux_mutation(player_type *creature_ptr) int danger_amount = 0; MONSTER_IDX monster; - for (monster = 0; monster < current_floor_ptr->m_max; monster++) + for (monster = 0; monster < p_ptr->current_floor_ptr->m_max; monster++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[monster]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[monster]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -2712,7 +2712,7 @@ static void process_world_aux_curse(player_type *creature_ptr) /* Call animal */ if ((creature_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500)) { - if (summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { GAME_TEXT o_name[MAX_NLEN]; @@ -2724,7 +2724,7 @@ static void process_world_aux_curse(player_type *creature_ptr) /* Call demon */ if ((creature_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111)) { - if (summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { GAME_TEXT o_name[MAX_NLEN]; @@ -2736,7 +2736,7 @@ static void process_world_aux_curse(player_type *creature_ptr) /* Call dragon */ if ((creature_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800)) { - if (summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, + if (summon_specific(0, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { GAME_TEXT o_name[MAX_NLEN]; @@ -2749,7 +2749,7 @@ static void process_world_aux_curse(player_type *creature_ptr) /* Call undead */ if ((creature_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111)) { - if (summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, + if (summon_specific(0, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { GAME_TEXT o_name[MAX_NLEN]; @@ -2905,9 +2905,9 @@ static void process_world_aux_recharge(player_type *creature_ptr) } /* Process objects on floor */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; @@ -2954,15 +2954,15 @@ static void process_world_aux_movement(player_type *creature_ptr) disturb(creature_ptr, FALSE, TRUE); /* Determine the level */ - if (current_floor_ptr->dun_level || creature_ptr->inside_quest || creature_ptr->enter_dungeon) + if (p_ptr->current_floor_ptr->dun_level || creature_ptr->inside_quest || creature_ptr->enter_dungeon) { msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!")); if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx; if (record_stair) - exe_write_diary(creature_ptr, NIKKI_RECALL, current_floor_ptr->dun_level, NULL); + exe_write_diary(creature_ptr, NIKKI_RECALL, p_ptr->current_floor_ptr->dun_level, NULL); - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; creature_ptr->dungeon_idx = 0; leave_quest_check(); @@ -2979,26 +2979,26 @@ static void process_world_aux_movement(player_type *creature_ptr) creature_ptr->dungeon_idx = creature_ptr->recall_dungeon; if (record_stair) - exe_write_diary(creature_ptr, NIKKI_RECALL, current_floor_ptr->dun_level, NULL); + exe_write_diary(creature_ptr, NIKKI_RECALL, p_ptr->current_floor_ptr->dun_level, NULL); /* New depth */ - current_floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx]; - if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1; + p_ptr->current_floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx]; + if (p_ptr->current_floor_ptr->dun_level < 1) p_ptr->current_floor_ptr->dun_level = 1; /* Nightmare mode makes recall more dangerous */ if (ironman_nightmare && !randint0(666) && (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)) { - if (current_floor_ptr->dun_level < 50) + if (p_ptr->current_floor_ptr->dun_level < 50) { - current_floor_ptr->dun_level *= 2; + p_ptr->current_floor_ptr->dun_level *= 2; } - else if (current_floor_ptr->dun_level < 99) + else if (p_ptr->current_floor_ptr->dun_level < 99) { - current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2; + p_ptr->current_floor_ptr->dun_level = (p_ptr->current_floor_ptr->dun_level + 99) / 2; } - else if (current_floor_ptr->dun_level > 100) + else if (p_ptr->current_floor_ptr->dun_level > 100) { - current_floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].maxdepth - 1; + p_ptr->current_floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].maxdepth - 1; } } @@ -3033,7 +3033,7 @@ static void process_world_aux_movement(player_type *creature_ptr) if ((q_ptr->type == QUEST_TYPE_RANDOM) && (q_ptr->status == QUEST_STATUS_TAKEN) && - (q_ptr->level < current_floor_ptr->dun_level)) + (q_ptr->level < p_ptr->current_floor_ptr->dun_level)) { q_ptr->status = QUEST_STATUS_FAILED; q_ptr->complev = (byte)creature_ptr->lev; @@ -3068,7 +3068,7 @@ static void process_world_aux_movement(player_type *creature_ptr) disturb(creature_ptr, FALSE, TRUE); /* Determine the level */ - if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level) + if (!quest_number(p_ptr->current_floor_ptr->dun_level) && p_ptr->current_floor_ptr->dun_level) { msg_print(_("世界が変わった!", "The world changes!")); @@ -3105,12 +3105,12 @@ static void process_world(void) extract_day_hour_min(&day, &hour, &min); /* Update dungeon feeling, and announce it if changed */ - update_dungeon_feeling(p_ptr, current_floor_ptr); + update_dungeon_feeling(p_ptr, p_ptr->current_floor_ptr); /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/ if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0)) { - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; p_ptr->dungeon_idx = 0; prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE); p_ptr->inside_arena = FALSE; @@ -3126,10 +3126,10 @@ static void process_world(void) int number_mon = 0; /* Count all hostile monsters */ - for (i2 = 0; i2 < current_floor_ptr->width; ++i2) - for (j2 = 0; j2 < current_floor_ptr->height; j2++) + for (i2 = 0; i2 < p_ptr->current_floor_ptr->width; ++i2) + for (j2 = 0; j2 < p_ptr->current_floor_ptr->height; j2++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[j2][i2]; if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding)) { @@ -3150,7 +3150,7 @@ static void process_world(void) GAME_TEXT m_name[MAX_NLEN]; monster_type *wm_ptr; - wm_ptr = ¤t_floor_ptr->m_list[win_m_idx]; + wm_ptr = &p_ptr->current_floor_ptr->m_list[win_m_idx]; monster_desc(m_name, wm_ptr, 0); msg_format(_("%sが勝利した!", "%s is winner!"), m_name); @@ -3170,7 +3170,7 @@ static void process_world(void) p_ptr->energy_need = 0; update_gambling_monsters(); } - else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK) + else if (current_world_ptr->game_turn - p_ptr->current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK) { msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw.")); p_ptr->au += kakekin; @@ -3190,7 +3190,7 @@ static void process_world(void) do_cmd_save_game(TRUE); } - if (current_floor_ptr->monster_noise && !ignore_unview) + if (p_ptr->current_floor_ptr->monster_noise && !ignore_unview) { msg_print(_("何かが聞こえた。", "You hear noise.")); } @@ -3198,7 +3198,7 @@ static void process_world(void) /*** Handle the wilderness/town (sunshine) ***/ /* While in town/wilderness */ - if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->phase_out && !p_ptr->inside_arena) + if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->phase_out && !p_ptr->inside_arena) { /* Hack -- Daybreak/Nighfall in town */ if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2))) @@ -3208,14 +3208,14 @@ static void process_world(void) /* Check for dawn */ dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN))); - if (dawn) day_break(current_floor_ptr); - else night_falls(current_floor_ptr); + if (dawn) day_break(p_ptr->current_floor_ptr); + else night_falls(p_ptr->current_floor_ptr); } } /* While in the dungeon (vanilla_town or lite_town mode only) */ - else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->phase_out && !p_ptr->inside_arena)) && current_floor_ptr->dun_level) + else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->phase_out && !p_ptr->inside_arena)) && p_ptr->current_floor_ptr->dun_level) { /*** Shuffle the Storekeepers ***/ @@ -3283,7 +3283,7 @@ static void process_world(void) /* Hack -- Process the counters of monsters if needed */ for (i = 0; i < MAX_MTIMED; i++) { - if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i); + if (p_ptr->current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i); } } @@ -3743,7 +3743,7 @@ static void process_command(player_type *creature_ptr) /* Go up staircase */ case '<': { - if (!creature_ptr->wild_mode && !current_floor_ptr->dun_level && !creature_ptr->inside_arena && !creature_ptr->inside_quest) + if (!creature_ptr->wild_mode && !p_ptr->current_floor_ptr->dun_level && !creature_ptr->inside_arena && !creature_ptr->inside_quest) { if (vanilla_town) break; @@ -3856,7 +3856,7 @@ static void process_command(player_type *creature_ptr) { msg_print(_("呪文を唱えられない!", "You cannot cast spells!")); } - else if (current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH)) + else if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH)) { msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!")); msg_print(NULL); @@ -4374,7 +4374,7 @@ static void process_fishing(void) MONRACE_IDX r_idx; bool success = FALSE; get_mon_num_prep(monster_is_fishing_target, NULL); - r_idx = get_mon_num(current_floor_ptr->dun_level ? current_floor_ptr->dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level); + r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level ? p_ptr->current_floor_ptr->dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level); msg_print(NULL); if (r_idx && one_in_(2)) { @@ -4384,7 +4384,7 @@ static void process_fishing(void) if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE)) { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0); + monster_desc(m_name, &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx], 0); msg_format(_("%sが釣れた!", "You have a good catch!"), m_name); success = TRUE; } @@ -4428,9 +4428,9 @@ static void process_player(void) if (p_ptr->phase_out) { - for(m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++) + for(m_idx = 1; m_idx < p_ptr->current_floor_ptr->m_max; m_idx++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -4510,7 +4510,7 @@ static void process_player(void) if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (MON_CSLEEP(m_ptr)) @@ -4754,12 +4754,12 @@ static void process_player(void) if (p_ptr->image) p_ptr->redraw |= (PR_MAP); /* Shimmer multi-hued monsters */ - for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++) + for (m_idx = 1; m_idx < p_ptr->current_floor_ptr->m_max; m_idx++) { monster_type *m_ptr; monster_race *r_ptr; - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if (!monster_is_valid(m_ptr)) continue; /* Skip unseen monsters */ @@ -4784,10 +4784,10 @@ static void process_player(void) repair_monsters = FALSE; /* Rotate detection flags */ - for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++) + for (m_idx = 1; m_idx < p_ptr->current_floor_ptr->m_max; m_idx++) { monster_type *m_ptr; - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if (!monster_is_valid(m_ptr)) continue; /* Nice monsters get mean */ @@ -4902,7 +4902,7 @@ static void dungeon(bool load_game) int quest_num = 0; /* Set the base level */ - current_floor_ptr->base_level = current_floor_ptr->dun_level; + p_ptr->current_floor_ptr->base_level = p_ptr->current_floor_ptr->dun_level; /* Reset various flags */ current_world_ptr->is_loading_now = FALSE; @@ -4939,7 +4939,7 @@ static void dungeon(bool load_game) disturb(p_ptr, TRUE, TRUE); /* Get index of current quest (if any) */ - quest_num = quest_number(current_floor_ptr->dun_level); + quest_num = quest_number(p_ptr->current_floor_ptr->dun_level); /* Inside a quest? */ if (quest_num) @@ -4956,10 +4956,10 @@ static void dungeon(bool load_game) /* Track maximum dungeon level (if not in quest -KMW-) */ - if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest) + if ((max_dlv[p_ptr->dungeon_idx] < p_ptr->current_floor_ptr->dun_level) && !p_ptr->inside_quest) { - max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level; - if (record_maxdepth) exe_write_diary(p_ptr, NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL); + max_dlv[p_ptr->dungeon_idx] = p_ptr->current_floor_ptr->dun_level; + if (record_maxdepth) exe_write_diary(p_ptr, NIKKI_MAXDEAPTH, p_ptr->current_floor_ptr->dun_level, NULL); } (void)calculate_upkeep(p_ptr); @@ -5017,10 +5017,10 @@ static void dungeon(bool load_game) /* Print quest message if appropriate */ if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND)) { - quest_discovery(random_quest_number(current_floor_ptr->dun_level)); - p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level); + quest_discovery(random_quest_number(p_ptr->current_floor_ptr->dun_level)); + p_ptr->inside_quest = random_quest_number(p_ptr->current_floor_ptr->dun_level); } - if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian) + if ((p_ptr->current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian) { if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num) #ifdef JP @@ -5039,15 +5039,15 @@ static void dungeon(bool load_game) /*** Process this dungeon level ***/ /* Reset the monster generation level */ - current_floor_ptr->monster_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; /* Reset the object generation level */ - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; current_world_ptr->is_loading_now = TRUE; if (p_ptr->energy_need > 0 && !p_ptr->phase_out && - (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena)) + (p_ptr->current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena)) p_ptr->energy_need = 0; /* Not leaving dungeon */ @@ -5060,17 +5060,17 @@ static void dungeon(bool load_game) while (TRUE) { /* Hack -- Compact the monster list occasionally */ - if ((current_floor_ptr->m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->phase_out) compact_monsters(64); + if ((p_ptr->current_floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !p_ptr->phase_out) compact_monsters(64); /* Hack -- Compress the monster list occasionally */ - if ((current_floor_ptr->m_cnt + 32 < current_floor_ptr->m_max) && !p_ptr->phase_out) compact_monsters(0); + if ((p_ptr->current_floor_ptr->m_cnt + 32 < p_ptr->current_floor_ptr->m_max) && !p_ptr->phase_out) compact_monsters(0); /* Hack -- Compact the object list occasionally */ - if (current_floor_ptr->o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64); + if (p_ptr->current_floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(64); /* Hack -- Compress the object list occasionally */ - if (current_floor_ptr->o_cnt + 32 < current_floor_ptr->o_max) compact_objects(0); + if (p_ptr->current_floor_ptr->o_cnt + 32 < p_ptr->current_floor_ptr->o_max) compact_objects(0); /* Process the player */ process_player(); @@ -5390,7 +5390,7 @@ void play_game(bool new_game) current_world_ptr->character_dungeon = FALSE; /* Start in town */ - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; p_ptr->inside_quest = 0; p_ptr->inside_arena = FALSE; p_ptr->phase_out = FALSE; @@ -5432,9 +5432,9 @@ void play_game(bool new_game) if (p_ptr->riding == -1) { p_ptr->riding = 0; - for (i = current_floor_ptr->m_max; i > 0; i--) + for (i = p_ptr->current_floor_ptr->m_max; i > 0; i--) { - if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx)) + if (player_bold(p_ptr->current_floor_ptr->m_list[i].fy, p_ptr->current_floor_ptr->m_list[i].fx)) { p_ptr->riding = i; break; @@ -5454,8 +5454,8 @@ void play_game(bool new_game) record_o_name[0] = '\0'; /* Reset map panel */ - panel_row_min = current_floor_ptr->height; - panel_col_min = current_floor_ptr->width; + panel_row_min = p_ptr->current_floor_ptr->height; + panel_col_min = p_ptr->current_floor_ptr->width; /* Sexy gal gets bonus to maximum weapon skill of whip */ if (p_ptr->pseikaku == SEIKAKU_SEXY) @@ -5500,7 +5500,7 @@ void play_game(bool new_game) } /* Initialize the town-buildings if necessary */ - if (!current_floor_ptr->dun_level && !p_ptr->inside_quest) + if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->inside_quest) { process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x); init_flags = INIT_ONLY_BUILDINGS; @@ -5587,7 +5587,7 @@ void play_game(bool new_game) monster_race *r_ptr = &r_info[pet_r_idx]; place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx, (PM_FORCE_PET | PM_NO_KAGE)); - m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii]; + m_ptr = &p_ptr->current_floor_ptr->m_list[hack_m_idx_ii]; m_ptr->mspeed = r_ptr->speed; m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2; m_ptr->max_maxhp = m_ptr->maxhp; @@ -5620,14 +5620,14 @@ void play_game(bool new_game) /* Cancel the health bar */ health_track(0); - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Handle "quit and save" */ if (!p_ptr->playing && !p_ptr->is_dead) break; - /* Erase the old current_floor_ptr->grid_array */ + /* Erase the old p_ptr->current_floor_ptr->grid_array */ wipe_o_list(); if (!p_ptr->is_dead) wipe_m_list(); @@ -5719,8 +5719,8 @@ void prevent_turn_overflow(void) if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns; else current_world_ptr->game_turn = 1; - if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns; - else current_floor_ptr->generated_turn = 1; + if (p_ptr->current_floor_ptr->generated_turn > rollback_turns) p_ptr->current_floor_ptr->generated_turn -= rollback_turns; + else p_ptr->current_floor_ptr->generated_turn = 1; if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns; else current_world_ptr->arena_start_turn = 1; if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns; diff --git a/src/dungeon-file.c b/src/dungeon-file.c index 9e0013ba3..63ab3fc44 100644 --- a/src/dungeon-file.c +++ b/src/dungeon-file.c @@ -3859,13 +3859,13 @@ static errr parse_line_building(char *buf) */ static void drop_here(object_type *j_ptr, POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; object_type *o_ptr; OBJECT_IDX o_idx = o_pop(); /* Access new object */ - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; /* Structure copy */ object_copy(o_ptr, j_ptr); @@ -3926,7 +3926,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in return parse_line_feature(buf); } - /* Process "D:" -- info for the current_floor_ptr->grid_array grids */ + /* Process "D:" -- info for the p_ptr->current_floor_ptr->grid_array grids */ else if (buf[0] == 'D') { object_type object_type_body; @@ -3941,7 +3941,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in for (*x = xmin, i = 0; ((*x < xmax) && (i < len)); (*x)++, s++, i++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[*y][*x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[*y][*x]; int idx = s[0]; @@ -3962,11 +3962,11 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in /* Create a monster */ if (random & RANDOM_MONSTER) { - current_floor_ptr->monster_level = current_floor_ptr->base_level + monster_index; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + monster_index; place_monster(*y, *x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP)); - current_floor_ptr->monster_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; } else if (monster_index) { @@ -4003,7 +4003,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in if (clone) { /* clone */ - current_floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED; /* Make alive again for real unique monster */ r_info[monster_index].cur_num = old_cur_num; @@ -4014,7 +4014,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in /* Object (and possible trap) */ if ((random & RANDOM_OBJECT) && (random & RANDOM_TRAP)) { - current_floor_ptr->object_level = current_floor_ptr->base_level + object_index; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + object_index; /* * Random trap and random treasure defined @@ -4029,11 +4029,11 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in place_trap(*y, *x); } - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; } else if (random & RANDOM_OBJECT) { - current_floor_ptr->object_level = current_floor_ptr->base_level + object_index; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + object_index; /* Create an out of deep object */ if (randint0(100) < 75) @@ -4043,7 +4043,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in else place_object(*y, *x, AM_GOOD | AM_GREAT); - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; } /* Random trap */ else if (random & RANDOM_TRAP) @@ -4069,7 +4069,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in } /* Apply magic (no messages, no artifacts) */ - apply_magic(o_ptr, current_floor_ptr->base_level, AM_NO_FIXED_ART | AM_GOOD); + apply_magic(o_ptr, p_ptr->current_floor_ptr->base_level, AM_NO_FIXED_ART | AM_GOOD); drop_here(o_ptr, *y, *x); } @@ -4228,15 +4228,15 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in /* Hack - Set the dungeon size */ panels_y = (*y / SCREEN_HGT); if (*y % SCREEN_HGT) panels_y++; - current_floor_ptr->height = panels_y * SCREEN_HGT; + p_ptr->current_floor_ptr->height = panels_y * SCREEN_HGT; panels_x = (*x / SCREEN_WID); if (*x % SCREEN_WID) panels_x++; - current_floor_ptr->width = panels_x * SCREEN_WID; + p_ptr->current_floor_ptr->width = panels_x * SCREEN_WID; /* Assume illegal panel */ - panel_row_min = current_floor_ptr->height; - panel_col_min = current_floor_ptr->width; + panel_row_min = p_ptr->current_floor_ptr->height; + panel_col_min = p_ptr->current_floor_ptr->width; /* Place player in a quest level */ if (p_ptr->inside_quest) @@ -4332,13 +4332,13 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in /* Maximum o_idx */ else if (zz[0][0] == 'O') { - current_floor_ptr->max_o_idx = (OBJECT_IDX)atoi(zz[1]); + current_world_ptr->max_o_idx = (OBJECT_IDX)atoi(zz[1]); } /* Maximum m_idx */ else if (zz[0][0] == 'M') { - current_floor_ptr->max_m_idx = (MONSTER_IDX)atoi(zz[1]); + current_world_ptr->max_m_idx = (MONSTER_IDX)atoi(zz[1]); } /* Wilderness size */ diff --git a/src/files.c b/src/files.c index bebbbe142..de9b58879 100644 --- a/src/files.c +++ b/src/files.c @@ -1872,8 +1872,8 @@ static void display_player_middle(player_type *creature_ptr) } else { - if (MON_FAST(¤t_floor_ptr->m_list[creature_ptr->riding])) tmp_speed += 10; - if (MON_SLOW(¤t_floor_ptr->m_list[creature_ptr->riding])) tmp_speed -= 10; + if (MON_FAST(&p_ptr->current_floor_ptr->m_list[creature_ptr->riding])) tmp_speed += 10; + if (MON_SLOW(&p_ptr->current_floor_ptr->m_list[creature_ptr->riding])) tmp_speed -= 10; } if (tmp_speed) @@ -3959,7 +3959,7 @@ void display_player(player_type *creature_ptr, int mode) sprintf(statmsg, "...You %s after the winning.", streq(creature_ptr->died_from, "Seppuku") ? "did Seppuku" : "retired from the adventure"); #endif } - else if (!current_floor_ptr->dun_level) + else if (!p_ptr->current_floor_ptr->dun_level) { #ifdef JP sprintf(statmsg, "…あなたは%sで%sに殺された。", map_name(), creature_ptr->died_from); @@ -3984,15 +3984,15 @@ void display_player(player_type *creature_ptr, int mode) else { #ifdef JP - sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)current_floor_ptr->dun_level, creature_ptr->died_from); + sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)p_ptr->current_floor_ptr->dun_level, creature_ptr->died_from); #else - sprintf(statmsg, "...You were killed by %s on level %d of %s.", creature_ptr->died_from, current_floor_ptr->dun_level, map_name()); + sprintf(statmsg, "...You were killed by %s on level %d of %s.", creature_ptr->died_from, p_ptr->current_floor_ptr->dun_level, map_name()); #endif } } else if (current_world_ptr->character_dungeon) { - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) { sprintf(statmsg, _("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name()); } @@ -4016,9 +4016,9 @@ void display_player(player_type *creature_ptr, int mode) else { #ifdef JP - sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(), (int)current_floor_ptr->dun_level); + sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(), (int)p_ptr->current_floor_ptr->dun_level); #else - sprintf(statmsg, "...Now, you are exploring level %d of %s.", current_floor_ptr->dun_level, map_name()); + sprintf(statmsg, "...Now, you are exploring level %d of %s.", p_ptr->current_floor_ptr->dun_level, map_name()); #endif } } @@ -4214,9 +4214,9 @@ static void dump_aux_pet(FILE *fff) bool pet_settings = FALSE; GAME_TEXT pet_name[MAX_NLEN]; - for (i = current_floor_ptr->m_max - 1; i >= 1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; if (!is_pet(m_ptr)) continue; @@ -6084,12 +6084,12 @@ static void make_bones(void) if (!(p_ptr->noscore & 0x00FF)) { /* Ignore people who die in town */ - if (current_floor_ptr->dun_level) + if (p_ptr->current_floor_ptr->dun_level) { char tmp[128]; /* "Bones" name */ - sprintf(tmp, "bone.%03d", current_floor_ptr->dun_level); + sprintf(tmp, "bone.%03d", p_ptr->current_floor_ptr->dun_level); path_build(str, sizeof(str), ANGBAND_DIR_BONE, tmp); /* Attempt to open the bones file */ @@ -6288,7 +6288,7 @@ void print_tomb(void) if (!streq(p_ptr->died_from, "ripe") && !streq(p_ptr->died_from, "Seppuku")) { - if (current_floor_ptr->dun_level == 0) + if (p_ptr->current_floor_ptr->dun_level == 0) { concptr field_name = p_ptr->town_num ? "街" : "荒野"; if (streq(p_ptr->died_from, "途中終了")) @@ -6304,18 +6304,18 @@ void print_tomb(void) { if (streq(p_ptr->died_from, "途中終了")) { - sprintf(tmp, "地下 %d 階で死んだ", (int)current_floor_ptr->dun_level); + sprintf(tmp, "地下 %d 階で死んだ", (int)p_ptr->current_floor_ptr->dun_level); } else { - sprintf(tmp, "に地下 %d 階で殺された", (int)current_floor_ptr->dun_level); + sprintf(tmp, "に地下 %d 階で殺された", (int)p_ptr->current_floor_ptr->dun_level); } } center_string(buf, tmp); put_str(buf, 15 + extra_line, 11); } #else - (void)sprintf(tmp, "Killed on Level %d", current_floor_ptr->dun_level); + (void)sprintf(tmp, "Killed on Level %d", p_ptr->current_floor_ptr->dun_level); center_string(buf, tmp); put_str(buf, 14, 11); @@ -6932,9 +6932,9 @@ static void handle_signal_simple(int sig) /* Mark the savefile */ (void)strcpy(p_ptr->died_from, _("強制終了", "Abortion")); - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Close stuff */ close_game(); @@ -6949,9 +6949,9 @@ static void handle_signal_simple(int sig) /* Cause of "death" */ (void)strcpy(p_ptr->died_from, _("強制終了中", "Interrupting")); - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Stop playing */ p_ptr->playing = FALSE; @@ -7025,9 +7025,9 @@ static void handle_signal_abort(int sig) if (!current_world_ptr->character_generated || current_world_ptr->character_saved) quit(NULL); - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Clear the bottom line */ Term_erase(0, hgt - 1, 255); diff --git a/src/floor-events.c b/src/floor-events.c index 417d403c9..e9aac78f1 100644 --- a/src/floor-events.c +++ b/src/floor-events.c @@ -434,23 +434,23 @@ void update_lite(player_type *player_ptr) /* forget_lite(); Perhaps don't need? */ /* Add it to later visual update */ - cave_redraw_later(¤t_floor_ptr->grid_array[player_ptr->y][player_ptr->x], player_ptr->y, player_ptr->x); + cave_redraw_later(&p_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x], player_ptr->y, player_ptr->x); } #endif /*** Save the old "lite" grids for later ***/ /* Clear them all */ - for (i = 0; i < current_floor_ptr->lite_n; i++) + for (i = 0; i < p_ptr->current_floor_ptr->lite_n; i++) { - y = current_floor_ptr->lite_y[i]; - x = current_floor_ptr->lite_x[i]; + y = p_ptr->current_floor_ptr->lite_y[i]; + x = p_ptr->current_floor_ptr->lite_x[i]; /* Mark the grid as not "lite" */ - current_floor_ptr->grid_array[y][x].info &= ~(CAVE_LITE); + p_ptr->current_floor_ptr->grid_array[y][x].info &= ~(CAVE_LITE); /* Mark the grid as "seen" */ - current_floor_ptr->grid_array[y][x].info |= (CAVE_TEMP); + p_ptr->current_floor_ptr->grid_array[y][x].info |= (CAVE_TEMP); /* Add it to the "seen" set */ tmp_pos.y[tmp_pos.n] = y; @@ -459,7 +459,7 @@ void update_lite(player_type *player_ptr) } /* None left */ - current_floor_ptr->lite_n = 0; + p_ptr->current_floor_ptr->lite_n = 0; /*** Collect the new "lite" grids ***/ @@ -557,7 +557,7 @@ void update_lite(player_type *player_ptr) /* Maximal south */ max_y = player_ptr->y + p; - if (max_y > current_floor_ptr->height - 1) max_y = current_floor_ptr->height - 1; + if (max_y > p_ptr->current_floor_ptr->height - 1) max_y = p_ptr->current_floor_ptr->height - 1; /* Maximal west */ min_x = player_ptr->x - p; @@ -565,7 +565,7 @@ void update_lite(player_type *player_ptr) /* Maximal east */ max_x = player_ptr->x + p; - if (max_x > current_floor_ptr->width - 1) max_x = current_floor_ptr->width - 1; + if (max_x > p_ptr->current_floor_ptr->width - 1) max_x = p_ptr->current_floor_ptr->width - 1; /* Scan the maximal box */ for (y = min_y; y <= max_y; y++) @@ -585,7 +585,7 @@ void update_lite(player_type *player_ptr) if (d > p) continue; /* Viewable, nearby, grids get "torch lit" */ - if (current_floor_ptr->grid_array[y][x].info & CAVE_VIEW) + if (p_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_VIEW) { /* This grid is "torch lit" */ cave_lite_hack(y, x); @@ -598,12 +598,12 @@ void update_lite(player_type *player_ptr) /*** Complete the algorithm ***/ /* Draw the new grids */ - for (i = 0; i < current_floor_ptr->lite_n; i++) + for (i = 0; i < p_ptr->current_floor_ptr->lite_n; i++) { - y = current_floor_ptr->lite_y[i]; - x = current_floor_ptr->lite_x[i]; + y = p_ptr->current_floor_ptr->lite_y[i]; + x = p_ptr->current_floor_ptr->lite_x[i]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Update fresh grids */ if (g_ptr->info & (CAVE_TEMP)) continue; @@ -618,7 +618,7 @@ void update_lite(player_type *player_ptr) y = tmp_pos.y[i]; x = tmp_pos.x[i]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* No longer in the array */ g_ptr->info &= ~(CAVE_TEMP); @@ -648,14 +648,14 @@ void forget_view(void) grid_type *g_ptr; /* None to forget */ - if (!current_floor_ptr->view_n) return; + if (!p_ptr->current_floor_ptr->view_n) return; /* Clear them all */ - for (i = 0; i < current_floor_ptr->view_n; i++) + for (i = 0; i < p_ptr->current_floor_ptr->view_n; i++) { - POSITION y = current_floor_ptr->view_y[i]; - POSITION x = current_floor_ptr->view_x[i]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + POSITION y = p_ptr->current_floor_ptr->view_y[i]; + POSITION x = p_ptr->current_floor_ptr->view_x[i]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Forget that the grid is viewable */ g_ptr->info &= ~(CAVE_VIEW); @@ -667,7 +667,7 @@ void forget_view(void) } /* None left */ - current_floor_ptr->view_n = 0; + p_ptr->current_floor_ptr->view_n = 0; } @@ -699,8 +699,8 @@ static bool update_view_aux(POSITION y, POSITION x, POSITION y1, POSITION x1, PO grid_type *g2_c_ptr; /* Access the grids */ - g1_c_ptr = ¤t_floor_ptr->grid_array[y1][x1]; - g2_c_ptr = ¤t_floor_ptr->grid_array[y2][x2]; + g1_c_ptr = &p_ptr->current_floor_ptr->grid_array[y1][x1]; + g2_c_ptr = &p_ptr->current_floor_ptr->grid_array[y2][x2]; /* Check for walls */ @@ -718,7 +718,7 @@ static bool update_view_aux(POSITION y, POSITION x, POSITION y1, POSITION x1, PO /* Totally blocked by "unviewable neighbors" */ if (!v1 && !v2) return (TRUE); - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Check for walls */ @@ -1334,7 +1334,7 @@ static void mon_lite_hack(POSITION y, POSITION x) /* We trust this grid is in bounds */ /* if (!in_bounds2(y, x)) return; */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Want a unlit square in view of the player */ if ((g_ptr->info & (CAVE_MNLT | CAVE_VIEW)) != CAVE_VIEW) return; @@ -1420,7 +1420,7 @@ static void mon_dark_hack(POSITION y, POSITION x) /* We trust this grid is in bounds */ /* if (!in_bounds2(y, x)) return; */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Want a unlit and undarkened square in view of the player */ if ((g_ptr->info & (CAVE_LITE | CAVE_MNLT | CAVE_MNDK | CAVE_VIEW)) != CAVE_VIEW) return; diff --git a/src/floor-generate.c b/src/floor-generate.c index 95827e500..459e0a23b 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -123,6 +123,7 @@ #include "feature.h" #include "spells.h" +#include "world.h" #include "view-mainwindow.h" int dun_tun_rnd; @@ -143,17 +144,17 @@ dun_data *dun; * @param y 基準のy座標 * @param x 基準のx座標 * @return 隣接する外壁の数 - * @note Assumes "in_bounds(current_floor_ptr, y, x)" + * @note Assumes "in_bounds(p_ptr->current_floor_ptr, y, x)" * @details We count only granite walls and permanent walls. */ static int next_to_walls(POSITION y, POSITION x) { int k = 0; - if (in_bounds(current_floor_ptr, y + 1, x) && is_extra_bold(y + 1, x)) k++; - if (in_bounds(current_floor_ptr, y - 1, x) && is_extra_bold(y - 1, x)) k++; - if (in_bounds(current_floor_ptr, y, x + 1) && is_extra_bold(y, x + 1)) k++; - if (in_bounds(current_floor_ptr, y, x - 1) && is_extra_bold(y, x - 1)) k++; + if (in_bounds(p_ptr->current_floor_ptr, y + 1, x) && is_extra_bold(y + 1, x)) k++; + if (in_bounds(p_ptr->current_floor_ptr, y - 1, x) && is_extra_bold(y - 1, x)) k++; + if (in_bounds(p_ptr->current_floor_ptr, y, x + 1) && is_extra_bold(y, x + 1)) k++; + if (in_bounds(p_ptr->current_floor_ptr, y, x - 1) && is_extra_bold(y, x - 1)) k++; return (k); } @@ -167,7 +168,7 @@ static int next_to_walls(POSITION y, POSITION x) */ static bool alloc_stairs_aux(POSITION y, POSITION x, int walls) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Require "naked" floor grid */ if (!is_floor_grid(g_ptr)) return FALSE; @@ -198,17 +199,17 @@ static bool alloc_stairs(FEAT_IDX feat, int num, int walls) if (have_flag(f_ptr->flags, FF_LESS)) { /* No up stairs in town or in ironman mode */ - if (ironman_downward || !current_floor_ptr->dun_level) return TRUE; + if (ironman_downward || !p_ptr->current_floor_ptr->dun_level) return TRUE; - if (current_floor_ptr->dun_level > d_info[p_ptr->dungeon_idx].mindepth) + if (p_ptr->current_floor_ptr->dun_level > d_info[p_ptr->dungeon_idx].mindepth) shaft_num = (randint1(num+1))/2; } else if (have_flag(f_ptr->flags, FF_MORE)) { - QUEST_IDX q_idx = quest_number(current_floor_ptr->dun_level); + QUEST_IDX q_idx = quest_number(p_ptr->current_floor_ptr->dun_level); /* No downstairs on quest levels */ - if (current_floor_ptr->dun_level > 1 && q_idx) + if (p_ptr->current_floor_ptr->dun_level > 1 && q_idx) { monster_race *r_ptr = &r_info[quest[q_idx].r_idx]; @@ -218,9 +219,9 @@ static bool alloc_stairs(FEAT_IDX feat, int num, int walls) } /* No downstairs at the bottom */ - if (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) return TRUE; + if (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) return TRUE; - if ((current_floor_ptr->dun_level < d_info[p_ptr->dungeon_idx].maxdepth-1) && !quest_number(current_floor_ptr->dun_level+1)) + if ((p_ptr->current_floor_ptr->dun_level < d_info[p_ptr->dungeon_idx].maxdepth-1) && !quest_number(p_ptr->current_floor_ptr->dun_level+1)) shaft_num = (randint1(num)+1)/2; } else return FALSE; @@ -237,9 +238,9 @@ static bool alloc_stairs(FEAT_IDX feat, int num, int walls) int candidates = 0; int pick; - for (y = 1; y < current_floor_ptr->height - 1; y++) + for (y = 1; y < p_ptr->current_floor_ptr->height - 1; y++) { - for (x = 1; x < current_floor_ptr->width - 1; x++) + for (x = 1; x < p_ptr->current_floor_ptr->width - 1; x++) { if (alloc_stairs_aux(y, x, walls)) { @@ -263,9 +264,9 @@ static bool alloc_stairs(FEAT_IDX feat, int num, int walls) /* Choose a random one */ pick = randint1(candidates); - for (y = 1; y < current_floor_ptr->height - 1; y++) + for (y = 1; y < p_ptr->current_floor_ptr->height - 1; y++) { - for (x = 1; x < current_floor_ptr->width - 1; x++) + for (x = 1; x < p_ptr->current_floor_ptr->width - 1; x++) { if (alloc_stairs_aux(y, x, walls)) { @@ -278,7 +279,7 @@ static bool alloc_stairs(FEAT_IDX feat, int num, int walls) if (!pick) break; } - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Clear possible garbage of hidden trap */ g_ptr->mimic = 0; @@ -407,7 +408,7 @@ bool place_quest_monsters(void) if (quest[i].status != QUEST_STATUS_TAKEN || (quest[i].type != QUEST_TYPE_KILL_LEVEL && quest[i].type != QUEST_TYPE_RANDOM) || - quest[i].level != current_floor_ptr->dun_level || + quest[i].level != p_ptr->current_floor_ptr->dun_level || p_ptr->dungeon_idx != quest[i].dungeon || (quest[i].flags & QUEST_FLAG_PRESET)) { @@ -441,10 +442,10 @@ bool place_quest_monsters(void) grid_type *g_ptr; feature_type *f_ptr; - y = randint0(current_floor_ptr->height); - x = randint0(current_floor_ptr->width); + y = randint0(p_ptr->current_floor_ptr->height); + x = randint0(p_ptr->current_floor_ptr->width); - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; f_ptr = &f_info[g_ptr->feat]; if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) continue; @@ -1303,7 +1304,7 @@ static bool level_gen(floor_type *floor_ptr, concptr *why) } /*! - * @brief フロアに存在する全マスの記憶状態を初期化する / Wipe all unnecessary flags after current_floor_ptr->grid_array generation + * @brief フロアに存在する全マスの記憶状態を初期化する / Wipe all unnecessary flags after p_ptr->current_floor_ptr->grid_array generation * @return なし */ void wipe_generate_random_floor_flags(floor_type *floor_ptr) @@ -1333,7 +1334,7 @@ void wipe_generate_random_floor_flags(floor_type *floor_ptr) } /*! - * @brief フロアの全情報を初期化する / Clear and empty the current_floor_ptr->grid_array + * @brief フロアの全情報を初期化する / Clear and empty the p_ptr->current_floor_ptr->grid_array * @return なし */ void clear_cave(floor_type *floor_ptr) @@ -1441,13 +1442,13 @@ void generate_random_floor(floor_type *floor_ptr) /* Prevent object over-flow */ - if (floor_ptr->o_max >= floor_ptr->max_o_idx) + if (floor_ptr->o_max >= current_world_ptr->max_o_idx) { why = _("アイテムが多すぎる", "too many objects"); okay = FALSE; } /* Prevent monster over-flow */ - else if (floor_ptr->m_max >= floor_ptr->max_m_idx) + else if (floor_ptr->m_max >= current_world_ptr->max_m_idx) { why = _("モンスターが多すぎる", "too many monsters"); okay = FALSE; @@ -1592,7 +1593,7 @@ bool build_tunnel(POSITION row1, POSITION col1, POSITION row2, POSITION col2) /* Extremely Important -- do not leave the dungeon */ - while (!in_bounds(current_floor_ptr, tmp_row, tmp_col)) + while (!in_bounds(p_ptr->current_floor_ptr, tmp_row, tmp_col)) { /* Acquire the correct direction */ correct_dir(&row_dir, &col_dir, row1, col1, row2, col2); @@ -1608,7 +1609,7 @@ bool build_tunnel(POSITION row1, POSITION col1, POSITION row2, POSITION col2) tmp_col = col1 + col_dir; } - g_ptr = ¤t_floor_ptr->grid_array[tmp_row][tmp_col]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[tmp_row][tmp_col]; /* Avoid "solid" walls */ if (is_solid_grid(g_ptr)) continue; @@ -1746,9 +1747,9 @@ static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall) { int i, j, dx, dy; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[*y][*x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[*y][*x]; - if (!in_bounds(current_floor_ptr, *y, *x)) return TRUE; + if (!in_bounds(p_ptr->current_floor_ptr, *y, *x)) return TRUE; if (is_inner_grid(g_ptr)) { @@ -1801,7 +1802,7 @@ static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall) } /* Clear mimic type */ - current_floor_ptr->grid_array[*y][*x].mimic = 0; + p_ptr->current_floor_ptr->grid_array[*y][*x].mimic = 0; place_floor_bold(*y, *x); @@ -1823,7 +1824,7 @@ static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall) dy = randint0(3) - 1; dx = randint0(3) - 1; - if (!in_bounds(current_floor_ptr, *y + dy, *x + dx)) + if (!in_bounds(p_ptr->current_floor_ptr, *y + dy, *x + dx)) { dx = 0; dy = 0; @@ -2061,13 +2062,13 @@ bool build_tunnel2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, y3 = y1 + dy + changey; /* See if in bounds - if not - do not perturb point */ - if (!in_bounds(current_floor_ptr, y3, x3)) + if (!in_bounds(p_ptr->current_floor_ptr, y3, x3)) { x3 = (x1 + x2) / 2; y3 = (y1 + y2) / 2; } /* cache g_ptr */ - g_ptr = ¤t_floor_ptr->grid_array[y3][x3]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y3][x3]; if (is_solid_grid(g_ptr)) { /* move midpoint a bit to avoid problem. */ @@ -2080,7 +2081,7 @@ bool build_tunnel2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, { dy = randint0(3) - 1; dx = randint0(3) - 1; - if (!in_bounds(current_floor_ptr, y3 + dy, x3 + dx)) + if (!in_bounds(p_ptr->current_floor_ptr, y3 + dy, x3 + dx)) { dx = 0; dy = 0; @@ -2097,14 +2098,14 @@ bool build_tunnel2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, } y3 += dy; x3 += dx; - g_ptr = ¤t_floor_ptr->grid_array[y3][x3]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y3][x3]; } if (is_floor_grid(g_ptr)) { if (build_tunnel2(x1, y1, x3, y3, type, cutoff)) { - if ((current_floor_ptr->grid_array[y3][x3].info & CAVE_ROOM) || (randint1(100) > 95)) + if ((p_ptr->current_floor_ptr->grid_array[y3][x3].info & CAVE_ROOM) || (randint1(100) > 95)) { /* do second half only if works + if have hit a room */ retval = build_tunnel2(x3, y3, x2, y2, type, cutoff); diff --git a/src/floor-save.c b/src/floor-save.c index 4de6f0c04..0b0724214 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -315,7 +315,7 @@ FLOOR_IDX get_new_floor_id(void) sf_ptr->visit_mark = latest_visit_mark++; /* sf_ptr->dun_level may be changed later */ - sf_ptr->dun_level = current_floor_ptr->dun_level; + sf_ptr->dun_level = p_ptr->current_floor_ptr->dun_level; /* Increment number of floor_id */ @@ -396,7 +396,7 @@ static void preserve_pet(void) if (p_ptr->riding) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; /* Pet of other pet don't follow. */ if (m_ptr->parent_m_idx) @@ -421,9 +421,9 @@ static void preserve_pet(void) */ if (!p_ptr->wild_mode && !p_ptr->inside_arena && !p_ptr->phase_out) { - for (i = current_floor_ptr->m_max - 1, num = 1; (i >= 1 && num < MAX_PARTY_MON); i--) + for (i = p_ptr->current_floor_ptr->m_max - 1, num = 1; (i >= 1 && num < MAX_PARTY_MON); i--) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; if (!is_pet(m_ptr)) continue; @@ -459,7 +459,7 @@ static void preserve_pet(void) } } - (void)COPY(&party_mon[num], ¤t_floor_ptr->m_list[i], monster_type); + (void)COPY(&party_mon[num], &p_ptr->current_floor_ptr->m_list[i], monster_type); num++; @@ -470,9 +470,9 @@ static void preserve_pet(void) if (record_named_pet) { - for (i = current_floor_ptr->m_max - 1; i >=1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >=1; i--) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; GAME_TEXT m_name[MAX_NLEN]; if (!monster_is_valid(m_ptr)) continue; @@ -487,12 +487,12 @@ static void preserve_pet(void) /* Pet of other pet may disappear. */ - for (i = current_floor_ptr->m_max - 1; i >=1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >=1; i--) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; /* Are there its parent? */ - if (m_ptr->parent_m_idx && !current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx) + if (m_ptr->parent_m_idx && !p_ptr->current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx) { /* Its parent have gone, it also goes away. */ @@ -578,10 +578,10 @@ static void place_pet(player_type *master_ptr) if (m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr; - current_floor_ptr->grid_array[cy][cx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[cy][cx].m_idx = m_idx; m_ptr->r_idx = party_mon[i].r_idx; @@ -611,7 +611,7 @@ static void place_pet(player_type *master_ptr) /* r_ptr->cur_num++; */ /* Hack -- Count the number of "reproducers" */ - if (r_ptr->flags2 & RF2_MULTIPLY) current_floor_ptr->num_repro++; + if (r_ptr->flags2 & RF2_MULTIPLY) p_ptr->current_floor_ptr->num_repro++; } else @@ -652,10 +652,10 @@ static void update_unique_artifact(s16b cur_floor_id) int i; /* Maintain unique monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { monster_race *r_ptr; - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -671,9 +671,9 @@ static void update_unique_artifact(s16b cur_floor_id) } /* Maintain artifatcs */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; @@ -696,7 +696,7 @@ static void get_out_monster(void) POSITION dis = 1; POSITION oy = p_ptr->y; POSITION ox = p_ptr->x; - MONSTER_IDX m_idx = current_floor_ptr->grid_array[oy][ox].m_idx; + MONSTER_IDX m_idx = p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx; /* Nothing to do if no monster */ if (!m_idx) return; @@ -722,27 +722,27 @@ static void get_out_monster(void) if (tries > 20 * dis * dis) dis++; /* Ignore illegal locations */ - if (!in_bounds(current_floor_ptr, ny, nx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue; /* Require "empty" floor space */ if (!cave_empty_bold(ny, nx)) continue; /* Hack -- no teleport onto glyph of warding */ - if (is_glyph_grid(¤t_floor_ptr->grid_array[ny][nx])) continue; - if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[ny][nx])) continue; + if (is_glyph_grid(&p_ptr->current_floor_ptr->grid_array[ny][nx])) continue; + if (is_explosive_rune_grid(&p_ptr->current_floor_ptr->grid_array[ny][nx])) continue; /* ...nor onto the Pattern */ if (pattern_tile(ny, nx)) continue; /*** It's a good place ***/ - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; /* Update the old location */ - current_floor_ptr->grid_array[oy][ox].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; /* Update the new location */ - current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; @@ -769,11 +769,11 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS floor_mo int i; /* Search usable stairs */ - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; bool ok = FALSE; @@ -840,7 +840,7 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS floor_mo prepare_change_floor_mode(CFM_RAND_PLACE | CFM_NO_RETURN); /* Mega Hack -- It's not the stairs you enter. Disable it. */ - if (!feat_uses_special(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat)) current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special = 0; + if (!feat_uses_special(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat)) p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special = 0; } else { @@ -892,7 +892,7 @@ void leave_floor(player_type *creature_ptr, BIT_FLAGS floor_mode) if ((quest[i].status == QUEST_STATUS_TAKEN) && ((quest[i].type == QUEST_TYPE_KILL_LEVEL) || (quest[i].type == QUEST_TYPE_RANDOM)) && - (quest[i].level == current_floor_ptr->dun_level) && + (quest[i].level == p_ptr->current_floor_ptr->dun_level) && (creature_ptr->dungeon_idx == quest[i].dungeon) && !(quest[i].flags & QUEST_FLAG_PRESET)) { @@ -901,10 +901,10 @@ void leave_floor(player_type *creature_ptr, BIT_FLAGS floor_mode) } /* Maintain quest monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { monster_race *r_ptr; - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -949,7 +949,7 @@ void leave_floor(player_type *creature_ptr, BIT_FLAGS floor_mode) if (floor_mode & CFM_SAVE_FLOORS) { /* Extract stair position */ - g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]; f_ptr = &f_info[g_ptr->feat]; /* Get back to old saved floor? */ @@ -982,20 +982,20 @@ void leave_floor(player_type *creature_ptr, BIT_FLAGS floor_mode) /* Get out from or Enter the dungeon */ if (floor_mode & CFM_DOWN) { - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) move_num = d_info[creature_ptr->dungeon_idx].mindepth; } else if (floor_mode & CFM_UP) { - if (current_floor_ptr->dun_level + move_num < d_info[creature_ptr->dungeon_idx].mindepth) - move_num = -current_floor_ptr->dun_level; + if (p_ptr->current_floor_ptr->dun_level + move_num < d_info[creature_ptr->dungeon_idx].mindepth) + move_num = -p_ptr->current_floor_ptr->dun_level; } - current_floor_ptr->dun_level += move_num; + p_ptr->current_floor_ptr->dun_level += move_num; } /* Leaving the dungeon to town */ - if (!current_floor_ptr->dun_level && creature_ptr->dungeon_idx) + if (!p_ptr->current_floor_ptr->dun_level && creature_ptr->dungeon_idx) { creature_ptr->leaving_dungeon = TRUE; if (!vanilla_town && !lite_town) @@ -1066,9 +1066,9 @@ void leave_floor(player_type *creature_ptr, BIT_FLAGS floor_mode) /* Record the last visit current_world_ptr->game_turn of current floor */ sf_ptr->last_visit = current_world_ptr->game_turn; - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Save current floor */ if (!save_floor(sf_ptr, 0)) @@ -1088,7 +1088,7 @@ void leave_floor(player_type *creature_ptr, BIT_FLAGS floor_mode) * @return なし * @details * If the floor is an old saved floor, it will be\n - * restored from the temporal file. If the floor is new one, new current_floor_ptr->grid_array\n + * restored from the temporal file. If the floor is new one, new p_ptr->current_floor_ptr->grid_array\n * will be generated.\n */ void change_floor(BIT_FLAGS floor_mode) @@ -1115,8 +1115,8 @@ void change_floor(BIT_FLAGS floor_mode) if (!(floor_mode & CFM_SAVE_FLOORS) && !(floor_mode & CFM_FIRST_FLOOR)) { - /* Create current_floor_ptr->grid_array */ - generate_random_floor(current_floor_ptr); + /* Create p_ptr->current_floor_ptr->grid_array */ + generate_random_floor(p_ptr->current_floor_ptr); /* Paranoia -- No new saved floor */ new_floor_id = 0; @@ -1146,7 +1146,7 @@ void change_floor(BIT_FLAGS floor_mode) /* Forbid return stairs */ if (floor_mode & CFM_NO_RETURN) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; if (!feat_uses_special(g_ptr->feat)) { @@ -1209,10 +1209,10 @@ void change_floor(BIT_FLAGS floor_mode) absence_ticks = (current_world_ptr->game_turn - tmp_last_visit) / TURNS_PER_TICK; /* Maintain monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { monster_race *r_ptr; - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -1246,9 +1246,9 @@ void change_floor(BIT_FLAGS floor_mode) } /* Maintain artifatcs */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; @@ -1293,7 +1293,7 @@ void change_floor(BIT_FLAGS floor_mode) msg_print(_("階段は行き止まりだった。", "The staircases come to a dead end...")); /* Create simple dead end */ - build_dead_end(current_floor_ptr); + build_dead_end(p_ptr->current_floor_ptr); /* Break connection */ if (floor_mode & CFM_UP) @@ -1307,26 +1307,26 @@ void change_floor(BIT_FLAGS floor_mode) } else { - /* Newly create current_floor_ptr->grid_array */ - generate_random_floor(current_floor_ptr); + /* Newly create p_ptr->current_floor_ptr->grid_array */ + generate_random_floor(p_ptr->current_floor_ptr); } /* Record last visit current_world_ptr->game_turn */ sf_ptr->last_visit = current_world_ptr->game_turn; - /* Set correct current_floor_ptr->dun_level value */ - sf_ptr->dun_level = current_floor_ptr->dun_level; + /* Set correct p_ptr->current_floor_ptr->dun_level value */ + sf_ptr->dun_level = p_ptr->current_floor_ptr->dun_level; /* Create connected stairs */ if (!(floor_mode & CFM_NO_RETURN)) { /* Extract stair position */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; /*** Create connected stairs ***/ /* No stairs down from Quest */ - if ((floor_mode & CFM_UP) && !quest_number(current_floor_ptr->dun_level)) + if ((floor_mode & CFM_UP) && !quest_number(p_ptr->current_floor_ptr->dun_level)) { g_ptr->feat = (floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair; } @@ -1395,10 +1395,10 @@ void change_floor(BIT_FLAGS floor_mode) wiz_lite(p_ptr, (bool)(p_ptr->pclass == CLASS_NINJA)); /* Remember when this level was "created" */ - current_floor_ptr->generated_turn = current_world_ptr->game_turn; + p_ptr->current_floor_ptr->generated_turn = current_world_ptr->game_turn; /* No dungeon feeling yet */ - p_ptr->feeling_turn = current_floor_ptr->generated_turn; + p_ptr->feeling_turn = p_ptr->current_floor_ptr->generated_turn; p_ptr->feeling = 0; /* Clear all flags */ diff --git a/src/floor-streams.c b/src/floor-streams.c index 99d2519ce..6f5b2dad3 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -83,7 +83,7 @@ static void recursive_river(POSITION x1, POSITION y1, POSITION x2, POSITION y2, changey = 0; } - if (!in_bounds(current_floor_ptr, y1 + dy + changey, x1 + dx + changex)) + if (!in_bounds(p_ptr->current_floor_ptr, y1 + dy + changey, x1 + dx + changex)) { changex = 0; changey = 0; @@ -119,7 +119,7 @@ static void recursive_river(POSITION x1, POSITION y1, POSITION x2, POSITION y2, { if (!in_bounds2(ty, tx)) continue; - g_ptr = ¤t_floor_ptr->grid_array[ty][tx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx]; if (g_ptr->feat == feat1) continue; if (g_ptr->feat == feat2) continue; @@ -174,8 +174,8 @@ void add_river(FEAT_IDX feat1, FEAT_IDX feat2) /* Hack -- Choose starting point */ - y2 = randint1(current_floor_ptr->height / 2 - 2) + current_floor_ptr->height / 2; - x2 = randint1(current_floor_ptr->width / 2 - 2) + current_floor_ptr->width / 2; + y2 = randint1(p_ptr->current_floor_ptr->height / 2 - 2) + p_ptr->current_floor_ptr->height / 2; + x2 = randint1(p_ptr->current_floor_ptr->width / 2 - 2) + p_ptr->current_floor_ptr->width / 2; /* Hack -- Choose ending point somewhere on boundary */ switch(randint1(4)) @@ -183,7 +183,7 @@ void add_river(FEAT_IDX feat1, FEAT_IDX feat2) case 1: { /* top boundary */ - x1 = randint1(current_floor_ptr->width-2)+1; + x1 = randint1(p_ptr->current_floor_ptr->width-2)+1; y1 = 1; break; } @@ -191,21 +191,21 @@ void add_river(FEAT_IDX feat1, FEAT_IDX feat2) { /* left boundary */ x1 = 1; - y1 = randint1(current_floor_ptr->height-2)+1; + y1 = randint1(p_ptr->current_floor_ptr->height-2)+1; break; } case 3: { /* right boundary */ - x1 = current_floor_ptr->width-1; - y1 = randint1(current_floor_ptr->height-2)+1; + x1 = p_ptr->current_floor_ptr->width-1; + y1 = randint1(p_ptr->current_floor_ptr->height-2)+1; break; } case 4: { /* bottom boundary */ - x1 = randint1(current_floor_ptr->width-2)+1; - y1 = current_floor_ptr->height-1; + x1 = randint1(p_ptr->current_floor_ptr->width-2)+1; + y1 = p_ptr->current_floor_ptr->height-1; break; } } @@ -252,8 +252,8 @@ void build_streamer(FEAT_IDX feat, int chance) bool streamer_may_have_gold = have_flag(streamer_ptr->flags, FF_MAY_HAVE_GOLD); /* Hack -- Choose starting point */ - y = rand_spread(current_floor_ptr->height / 2, current_floor_ptr->height / 6); - x = rand_spread(current_floor_ptr->width / 2, current_floor_ptr->width / 6); + y = rand_spread(p_ptr->current_floor_ptr->height / 2, p_ptr->current_floor_ptr->height / 6); + x = rand_spread(p_ptr->current_floor_ptr->width / 2, p_ptr->current_floor_ptr->width / 6); /* Choose a random compass direction */ dir = randint0(8); @@ -276,7 +276,7 @@ void build_streamer(FEAT_IDX feat, int chance) if (!in_bounds2(ty, tx)) continue; break; } - g_ptr = ¤t_floor_ptr->grid_array[ty][tx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx]; f_ptr = &f_info[g_ptr->feat]; if (have_flag(f_ptr->flags, FF_MOVE) && (have_flag(f_ptr->flags, FF_WATER) || have_flag(f_ptr->flags, FF_LAVA))) @@ -292,7 +292,7 @@ void build_streamer(FEAT_IDX feat, int chance) if (is_closed_door(g_ptr->feat)) continue; } - if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[current_floor_ptr->m_list[g_ptr->m_idx].r_idx], 0))) + if (g_ptr->m_idx && !(have_flag(streamer_ptr->flags, FF_PLACE) && monster_can_cross_terrain(feat, &r_info[p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].r_idx], 0))) { /* Delete the monster (if any) */ delete_monster(ty, tx); @@ -305,7 +305,7 @@ void build_streamer(FEAT_IDX feat, int chance) /* Scan all objects in the grid */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { - object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Hack -- Preserve unknown artifacts */ @@ -372,7 +372,7 @@ void build_streamer(FEAT_IDX feat, int chance) } /* Quit before leaving the dungeon */ - if (!in_bounds(current_floor_ptr, y, x)) break; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) break; } } @@ -399,8 +399,8 @@ void place_trees(POSITION x, POSITION y) { for (j = y - 3; j < y + 4; j++) { - if (!in_bounds(current_floor_ptr, j, i)) continue; - g_ptr = ¤t_floor_ptr->grid_array[j][i]; + if (!in_bounds(p_ptr->current_floor_ptr, j, i)) continue; + g_ptr = &p_ptr->current_floor_ptr->grid_array[j][i]; if (g_ptr->info & CAVE_ICKY) continue; if (g_ptr->o_idx) continue; @@ -415,18 +415,18 @@ void place_trees(POSITION x, POSITION y) if ((distance(j, i, y, x) > 1) || (randint1(100) < 25)) { if (randint1(100) < 75) - current_floor_ptr->grid_array[j][i].feat = feat_tree; + p_ptr->current_floor_ptr->grid_array[j][i].feat = feat_tree; } else { - current_floor_ptr->grid_array[j][i].feat = feat_rubble; + p_ptr->current_floor_ptr->grid_array[j][i].feat = feat_rubble; } /* Clear garbage of hidden trap or door */ g_ptr->mimic = 0; /* Light area since is open above */ - if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) current_floor_ptr->grid_array[j][i].info |= (CAVE_GLOW | CAVE_ROOM); + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) p_ptr->current_floor_ptr->grid_array[j][i].info |= (CAVE_GLOW | CAVE_ROOM); } } } @@ -435,7 +435,7 @@ void place_trees(POSITION x, POSITION y) if (!ironman_downward && one_in_(3)) { /* up stair */ - current_floor_ptr->grid_array[y][x].feat = feat_up_stair; + p_ptr->current_floor_ptr->grid_array[y][x].feat = feat_up_stair; } } @@ -457,8 +457,8 @@ void destroy_level(void) for (n = 0; n < randint1(5); n++) { /* Pick an epi-center */ - x1 = rand_range(5, current_floor_ptr->width - 1 - 5); - y1 = rand_range(5, current_floor_ptr->height - 1 - 5); + x1 = rand_range(5, p_ptr->current_floor_ptr->width - 1 - 5); + y1 = rand_range(5, p_ptr->current_floor_ptr->height - 1 - 5); (void)destroy_area(y1, x1, 15, TRUE); } diff --git a/src/floor.c b/src/floor.c index 376e9a7a4..d52b48d26 100644 --- a/src/floor.c +++ b/src/floor.c @@ -8,7 +8,6 @@ * Not completely hardcoded, that would overflow memory */ floor_type floor_info; -floor_type *current_floor_ptr = &floor_info; /* * The array of saved floors diff --git a/src/floor.h b/src/floor.h index 2b684ba4d..0e1da2f9c 100644 --- a/src/floor.h +++ b/src/floor.h @@ -65,14 +65,14 @@ #define MON_LITE_MAX 1536 /*! - * @brief 視界処理配列サイズ / Maximum size of the "view" array (see "current_floor_ptr->grid_array.c") + * @brief 視界処理配列サイズ / Maximum size of the "view" array (see "p_ptr->current_floor_ptr->grid_array.c") * @details Note that the "view radius" will NEVER exceed 20, and even if the "view" * was octagonal, we would never require more than 1520 entries in the array. */ #define VIEW_MAX 1536 /*! - * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array (see "current_floor_ptr->grid_array.c") + * @brief 再描画処理用配列サイズ / Maximum size of the "redraw" array (see "p_ptr->current_floor_ptr->grid_array.c") * @details We must be large for proper functioning of delayed redrawing. * We must also be as large as two times of the largest view area. * Note that maximum view grids are 1149 entries. @@ -85,32 +85,30 @@ typedef struct { grid_type *grid_array[MAX_HGT]; DEPTH dun_level; /*!< 現在の実ダンジョン階層base_levelの参照元となる / Current dungeon level */ DEPTH base_level; /*!< 基本生成レベル、後述のobject_level, monster_levelの参照元となる / Base dungeon level */ - DEPTH object_level; /*!< アイテムの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */ - DEPTH monster_level; /*!< モンスターの生成レベル、current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current monster creation level */ + DEPTH object_level; /*!< アイテムの生成レベル、p_ptr->current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current object creation level */ + DEPTH monster_level; /*!< モンスターの生成レベル、p_ptr->current_floor_ptr->base_levelを起点に一時変更する時に参照 / Current monster creation level */ POSITION width; /* Current dungeon width */ POSITION height; /* Current dungeon height */ MONSTER_NUMBER num_repro; /*!< Current reproducer count */ GAME_TURN generated_turn; /* Turn when level began */ - object_type *o_list; /*!< The array of dungeon items [current_floor_ptr->max_o_idx] */ - OBJECT_IDX max_o_idx; /*!< Maximum number of objects in the level */ + object_type *o_list; /*!< The array of dungeon items [current_world_ptr->max_o_idx] */ OBJECT_IDX o_max; /* Number of allocated objects */ OBJECT_IDX o_cnt; /* Number of live objects */ - monster_type *m_list; /*!< The array of dungeon monsters [current_floor_ptr->max_m_idx] */ - MONSTER_IDX max_m_idx; /*!< Maximum number of monsters in the level */ + monster_type *m_list; /*!< The array of dungeon monsters [current_world_ptr->max_m_idx] */ MONSTER_IDX m_max; /* Number of allocated monsters */ MONSTER_IDX m_cnt; /* Number of live monsters */ s16b *mproc_list[MAX_MTIMED]; /*!< The array to process dungeon monsters[max_m_idx] */ s16b mproc_max[MAX_MTIMED]; /*!< Number of monsters to be processed */ - POSITION_IDX lite_n; //!< Array of grids lit by player lite (see "current_floor_ptr->grid_array.c") + POSITION_IDX lite_n; //!< Array of grids lit by player lite (see "p_ptr->current_floor_ptr->grid_array.c") POSITION lite_y[LITE_MAX]; POSITION lite_x[LITE_MAX]; - POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "current_floor_ptr->grid_array.c") + POSITION_IDX mon_lite_n; //!< Array of grids lit by player lite (see "p_ptr->current_floor_ptr->grid_array.c") POSITION mon_lite_y[MON_LITE_MAX]; POSITION mon_lite_x[MON_LITE_MAX]; @@ -118,7 +116,7 @@ typedef struct { POSITION view_y[VIEW_MAX]; POSITION view_x[VIEW_MAX]; - POSITION_IDX redraw_n; //!< Array of grids for delayed visual updating (see "current_floor_ptr->grid_array.c") + POSITION_IDX redraw_n; //!< Array of grids for delayed visual updating (see "p_ptr->current_floor_ptr->grid_array.c") POSITION redraw_y[REDRAW_MAX]; POSITION redraw_x[REDRAW_MAX]; @@ -126,6 +124,8 @@ typedef struct { } floor_type; +extern floor_type floor_info; + #define DUNGEON_MODE_NONE 0 #define DUNGEON_MODE_AND 1 #define DUNGEON_MODE_NAND 2 @@ -178,14 +178,14 @@ typedef struct { * Determines if a map location is on or inside the outer walls */ #define in_bounds2(Y,X) \ - (((Y) >= 0) && ((X) >= 0) && ((Y) < current_floor_ptr->height) && ((X) < current_floor_ptr->width)) + (((Y) >= 0) && ((X) >= 0) && ((Y) < p_ptr->current_floor_ptr->height) && ((X) < p_ptr->current_floor_ptr->width)) /* * Determines if a map location is on or inside the outer walls * (unsigned version) */ #define in_bounds2u(Y,X) \ - (((Y) < current_floor_ptr->height) && ((X) < current_floor_ptr->width)) + (((Y) < p_ptr->current_floor_ptr->height) && ((X) < p_ptr->current_floor_ptr->width)) /* @@ -198,11 +198,11 @@ typedef struct { * Grid based version of "player_bold()" */ #define player_grid(C) \ - ((C) == ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) + ((C) == &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) #define cave_have_flag_bold(Y,X,INDEX) \ - (have_flag(f_info[current_floor_ptr->grid_array[(Y)][(X)].feat].flags, (INDEX))) + (have_flag(f_info[p_ptr->current_floor_ptr->grid_array[(Y)][(X)].feat].flags, (INDEX))) #define cave_have_flag_grid(C,INDEX) \ @@ -220,7 +220,7 @@ typedef struct { * Determine if a "legal" grid supports "los" */ #define cave_los_bold(Y,X) \ - (feat_supports_los(current_floor_ptr->grid_array[(Y)][(X)].feat)) + (feat_supports_los(p_ptr->current_floor_ptr->grid_array[(Y)][(X)].feat)) #define cave_los_grid(C) \ (feat_supports_los((C)->feat)) @@ -236,8 +236,8 @@ typedef struct { */ #define cave_clean_bold(Y,X) \ (cave_have_flag_bold((Y), (X), FF_FLOOR) && \ - !(current_floor_ptr->grid_array[Y][X].info & CAVE_OBJECT) && \ - (current_floor_ptr->grid_array[Y][X].o_idx == 0)) + !(p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_OBJECT) && \ + (p_ptr->current_floor_ptr->grid_array[Y][X].o_idx == 0)) /* @@ -248,7 +248,7 @@ typedef struct { */ #define cave_drop_bold(Y,X) \ (cave_have_flag_bold((Y), (X), FF_DROP) && \ - !(current_floor_ptr->grid_array[Y][X].info & CAVE_OBJECT)) + !(p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_OBJECT)) /* @@ -261,7 +261,7 @@ typedef struct { */ #define cave_empty_bold(Y,X) \ (cave_have_flag_bold((Y), (X), FF_PLACE) && \ - !(current_floor_ptr->grid_array[Y][X].m_idx) && \ + !(p_ptr->current_floor_ptr->grid_array[Y][X].m_idx) && \ !player_bold(Y,X)) @@ -286,7 +286,7 @@ typedef struct { */ #define cave_naked_bold(Y,X) \ (cave_clean_bold(Y,X) && \ - !(current_floor_ptr->grid_array[Y][X].m_idx) && \ + !(p_ptr->current_floor_ptr->grid_array[Y][X].m_idx) && \ !player_bold(Y,X)) @@ -341,7 +341,7 @@ typedef struct { * Note the use of comparison to zero to force a "boolean" result */ #define player_has_los_bold(Y,X) \ - (((current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->phase_out) + (((p_ptr->current_floor_ptr->grid_array[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->phase_out) /* @@ -351,7 +351,6 @@ typedef struct { (have_flag((F)->flags, FF_WALL) && \ have_flag((F)->flags, FF_PERMANENT)) -extern floor_type *current_floor_ptr; extern saved_floor_type saved_floors[MAX_SAVED_FLOORS]; /* diff --git a/src/gamevalue.h b/src/gamevalue.h index 1758ddb77..e6966974b 100644 --- a/src/gamevalue.h +++ b/src/gamevalue.h @@ -2,7 +2,7 @@ /*! * @brief ベースアイテム生成階層が加算される確率 * @details -* There is a 1/10 (10%) chance of inflating the requested current_floor_ptr->object_level +* There is a 1/10 (10%) chance of inflating the requested p_ptr->current_floor_ptr->object_level * during the creation of an object (see "get_obj_num()" in "object.c"). * Lower values yield better objects more often. */ @@ -11,7 +11,7 @@ /*! * @brief 深層モンスターが生成される(NASTY生成)の基本確率(1/x) * @details -* There is a 1/25 (4%) chance of inflating the requested current_floor_ptr->monster_level +* There is a 1/25 (4%) chance of inflating the requested p_ptr->current_floor_ptr->monster_level * during the creation of a monsters (see "get_mon_num()" in "monster.c"). * Lower values yield harder monsters more often. */ @@ -44,7 +44,7 @@ * @details * A monster can only "multiply" (reproduce) if there are fewer than 100 * monsters on the level capable of such spontaneous reproduction. This -* is a hack which prevents the "current_floor_ptr->m_list[]" array from exploding due to +* is a hack which prevents the "p_ptr->current_floor_ptr->m_list[]" array from exploding due to * reproducing monsters. Messy, but necessary. */ #define MAX_REPRO 100 diff --git a/src/geometry.c b/src/geometry.c index ada5a5206..652c84b0a 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -276,11 +276,11 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y if (flg & (PROJECT_STOP)) { if ((n > 0) && - (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0)) + (player_bold(y, x) || p_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0)) break; } - if (!in_bounds(current_floor_ptr, y, x)) break; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) break; /* Slant */ if (m) @@ -365,11 +365,11 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y if (flg & (PROJECT_STOP)) { if ((n > 0) && - (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0)) + (player_bold(y, x) || p_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0)) break; } - if (!in_bounds(current_floor_ptr, y, x)) break; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) break; /* Slant */ if (m) @@ -436,11 +436,11 @@ sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y if (flg & (PROJECT_STOP)) { if ((n > 0) && - (player_bold(y, x) || current_floor_ptr->grid_array[y][x].m_idx != 0)) + (player_bold(y, x) || p_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0)) break; } - if (!in_bounds(current_floor_ptr, y, x)) break; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) break; /* Advance (Y) */ y += sy; @@ -534,8 +534,8 @@ bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2) /* Paranoia -- require "safe" origin */ - /* if (!in_bounds(current_floor_ptr, y1, x1)) return FALSE; */ - /* if (!in_bounds(current_floor_ptr, y2, x2)) return FALSE; */ + /* if (!in_bounds(p_ptr->current_floor_ptr, y1, x1)) return FALSE; */ + /* if (!in_bounds(p_ptr->current_floor_ptr, y2, x2)) return FALSE; */ /* Directly South/North */ @@ -774,7 +774,7 @@ void scatter(POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT nx = rand_spread(x, d); /* Ignore annoying locations */ - if (!in_bounds(current_floor_ptr, ny, nx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue; /* Ignore "excessively distant" locations */ if ((d > 1) && (distance(y, x, ny, nx) > d)) continue; @@ -838,7 +838,7 @@ bool player_can_see_bold(POSITION y, POSITION x) /* Blind players see nothing */ if (p_ptr->blind) return FALSE; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Note that "torch-lite" yields "illumination" */ if (g_ptr->info & (CAVE_LITE | CAVE_MNLT)) return TRUE; diff --git a/src/geometry.h b/src/geometry.h index 354d2f61e..f8ea15bee 100644 --- a/src/geometry.h +++ b/src/geometry.h @@ -43,7 +43,7 @@ extern bool player_can_see_bold(POSITION y, POSITION x); extern bool no_lite(void); /*! - * @brief 視界及び光源の過渡処理配列サイズ / Maximum size of the "temp" array (see "current_floor_ptr->grid_array.c") + * @brief 視界及び光源の過渡処理配列サイズ / Maximum size of the "temp" array (see "p_ptr->current_floor_ptr->grid_array.c") * @details We must be as large as "VIEW_MAX" and "LITE_MAX" for proper functioning * of "update_view()" and "update_lite()". We must also be as large as the * largest illuminatable room, but no room is larger than 800 grids. We diff --git a/src/grid.c b/src/grid.c index 1baf83144..2a4fd36d8 100644 --- a/src/grid.c +++ b/src/grid.c @@ -197,14 +197,14 @@ bool new_player_spot(void) while (max_attempts--) { /* Pick a legal spot */ - y = (POSITION)rand_range(1, current_floor_ptr->height - 2); - x = (POSITION)rand_range(1, current_floor_ptr->width - 2); + y = (POSITION)rand_range(1, p_ptr->current_floor_ptr->height - 2); + x = (POSITION)rand_range(1, p_ptr->current_floor_ptr->width - 2); - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Must be a "naked" floor grid */ if (g_ptr->m_idx) continue; - if (current_floor_ptr->dun_level) + if (p_ptr->current_floor_ptr->dun_level) { f_ptr = &f_info[g_ptr->feat]; @@ -222,7 +222,7 @@ bool new_player_spot(void) if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) continue; } if (!player_can_enter(g_ptr->feat, 0)) continue; - if (!in_bounds(current_floor_ptr, y, x)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) continue; /* Refuse to start on anti-teleport grids */ if (g_ptr->info & (CAVE_ICKY)) continue; @@ -253,13 +253,13 @@ void place_random_stairs(POSITION y, POSITION x) bool up_stairs = TRUE; bool down_stairs = TRUE; grid_type *g_ptr; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (!is_floor_grid(g_ptr) || g_ptr->o_idx) return; - if (!current_floor_ptr->dun_level) up_stairs = FALSE; + if (!p_ptr->current_floor_ptr->dun_level) up_stairs = FALSE; if (ironman_downward) up_stairs = FALSE; - if (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) down_stairs = FALSE; - if (quest_number(current_floor_ptr->dun_level) && (current_floor_ptr->dun_level > 1)) down_stairs = FALSE; + if (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) down_stairs = FALSE; + if (quest_number(p_ptr->current_floor_ptr->dun_level) && (p_ptr->current_floor_ptr->dun_level > 1)) down_stairs = FALSE; /* We can't place both */ if (down_stairs && up_stairs) @@ -270,8 +270,8 @@ void place_random_stairs(POSITION y, POSITION x) } /* Place the stairs */ - if (up_stairs) set_cave_feat(current_floor_ptr, y, x, feat_up_stair); - else if (down_stairs) set_cave_feat(current_floor_ptr, y, x, feat_down_stair); + if (up_stairs) set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_up_stair); + else if (down_stairs) set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_down_stair); } /*! @@ -285,7 +285,7 @@ void place_random_door(POSITION y, POSITION x, bool room) { int tmp, type; FEAT_IDX feat = feat_none; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Initialize mimic info */ g_ptr->mimic = 0; @@ -347,7 +347,7 @@ void place_random_door(POSITION y, POSITION x, bool room) { if (feat != feat_none) { - set_cave_feat(current_floor_ptr, y, x, feat); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat); } else { @@ -405,7 +405,7 @@ void place_closed_door(POSITION y, POSITION x, int type) cave_set_feat(y, x, feat); /* Now it is not floor */ - current_floor_ptr->grid_array[y][x].info &= ~(CAVE_MASK); + p_ptr->current_floor_ptr->grid_array[y][x].info &= ~(CAVE_MASK); } else { @@ -427,8 +427,8 @@ void place_locked_door(POSITION y, POSITION x) } else { - set_cave_feat(current_floor_ptr, y, x, feat_locked_door_random((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR)); - current_floor_ptr->grid_array[y][x].info &= ~(CAVE_FLOOR); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_locked_door_random((d_info[p_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR)); + p_ptr->current_floor_ptr->grid_array[y][x].info &= ~(CAVE_FLOOR); delete_monster(y, x); } } @@ -449,7 +449,7 @@ void place_secret_door(POSITION y, POSITION x, int type) } else { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (type == DOOR_DEFAULT) { @@ -539,7 +539,7 @@ void add_door(POSITION x, POSITION y) * @param y1 基準となるマスのY座標 * @param x1 基準となるマスのX座標 * @return 通路の数 -* @note Assumes "in_bounds(current_floor_ptr, y1, x1)" +* @note Assumes "in_bounds(p_ptr->current_floor_ptr, y1, x1)" * @details * XXX XXX This routine currently only counts actual "empty floor"\n * grids which are not in rooms. We might want to also count stairs,\n @@ -557,7 +557,7 @@ static int next_to_corr(POSITION y1, POSITION x1) { y = y1 + ddy_ddd[i]; x = x1 + ddx_ddd[i]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Skip non floors */ if (cave_have_flag_grid(g_ptr, FF_WALL)) continue; @@ -582,10 +582,10 @@ static int next_to_corr(POSITION y1, POSITION x1) * @param y 判定を行いたいマスのY座標 * @param x 判定を行いたいマスのX座標 * @return ドアを設置可能ならばTRUEを返す -* @note Assumes "in_bounds(current_floor_ptr, y1, x1)" +* @note Assumes "in_bounds(p_ptr->current_floor_ptr, y1, x1)" * @details * \n -* Assumes "in_bounds(current_floor_ptr, y, x)"\n +* Assumes "in_bounds(p_ptr->current_floor_ptr, y, x)"\n */ static bool possible_doorway(POSITION y, POSITION x) { @@ -618,13 +618,13 @@ static bool possible_doorway(POSITION y, POSITION x) * @return なし */ void try_door(POSITION y, POSITION x) -{ if (!in_bounds(current_floor_ptr, y, x)) return; +{ if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; /* Ignore walls */ if (cave_have_flag_bold(y, x, FF_WALL)) return; /* Ignore room grids */ - if (current_floor_ptr->grid_array[y][x].info & (CAVE_ROOM)) return; + if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_ROOM)) return; /* Occasional door (if allowed) */ if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_DOORS)) @@ -719,7 +719,7 @@ void vault_objects(POSITION y, POSITION x, int num) j = rand_spread(y, 2); k = rand_spread(x, 3); dummy++; - if (!in_bounds(current_floor_ptr, j, k)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, j, k)) continue; break; } @@ -729,7 +729,7 @@ void vault_objects(POSITION y, POSITION x, int num) } /* Require "clean" floor space */ - g_ptr = ¤t_floor_ptr->grid_array[j][k]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[j][k]; if (!is_floor_grid(g_ptr) || g_ptr->o_idx) continue; if (randint0(100) < 75) @@ -773,7 +773,7 @@ void vault_trap_aux(POSITION y, POSITION x, POSITION yd, POSITION xd) y1 = rand_spread(y, yd); x1 = rand_spread(x, xd); dummy++; - if (!in_bounds(current_floor_ptr, y1, x1)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y1, x1)) continue; break; } @@ -783,7 +783,7 @@ void vault_trap_aux(POSITION y, POSITION x, POSITION yd, POSITION xd) } /* Require "naked" floor grids */ - g_ptr = ¤t_floor_ptr->grid_array[y1][x1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y1][x1]; if (!is_floor_grid(g_ptr) || g_ptr->o_idx || g_ptr->m_idx) continue; /* Place the trap */ @@ -841,13 +841,13 @@ void vault_monsters(POSITION y1, POSITION x1, int num) scatter(&y, &x, y1, x1, d, 0); /* Require "empty" floor grids */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (!cave_empty_grid(g_ptr)) continue; /* Place the monster (allow groups) */ - current_floor_ptr->monster_level = current_floor_ptr->base_level + 2; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 2; (void)place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP)); - current_floor_ptr->monster_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; } } } @@ -860,7 +860,7 @@ void vault_monsters(POSITION y1, POSITION x1, int num) */ bool get_is_floor(POSITION x, POSITION y) { - if (!in_bounds(current_floor_ptr, y, x)) + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) { /* Out of bounds */ return (FALSE); @@ -880,13 +880,13 @@ bool get_is_floor(POSITION x, POSITION y) */ void set_floor(POSITION x, POSITION y) { - if (!in_bounds(current_floor_ptr, y, x)) + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) { /* Out of bounds */ return; } - if (current_floor_ptr->grid_array[y][x].info & CAVE_ROOM) + if (p_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_ROOM) { /* A room border don't touch. */ return; @@ -975,12 +975,12 @@ bool check_local_illumination(POSITION y, POSITION x) #ifdef COMPLEX_WALL_ILLUMINATION /* COMPLEX_WALL_ILLUMINATION */ /* Check for "complex" illumination */ - if ((feat_supports_los(get_feat_mimic(¤t_floor_ptr->grid_array[yy][xx])) && - (current_floor_ptr->grid_array[yy][xx].info & CAVE_GLOW)) || - (feat_supports_los(get_feat_mimic(¤t_floor_ptr->grid_array[y][xx])) && - (current_floor_ptr->grid_array[y][xx].info & CAVE_GLOW)) || - (feat_supports_los(get_feat_mimic(¤t_floor_ptr->grid_array[yy][x])) && - (current_floor_ptr->grid_array[yy][x].info & CAVE_GLOW))) + if ((feat_supports_los(get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[yy][xx])) && + (p_ptr->current_floor_ptr->grid_array[yy][xx].info & CAVE_GLOW)) || + (feat_supports_los(get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[y][xx])) && + (p_ptr->current_floor_ptr->grid_array[y][xx].info & CAVE_GLOW)) || + (feat_supports_los(get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[yy][x])) && + (p_ptr->current_floor_ptr->grid_array[yy][x].info & CAVE_GLOW))) { return TRUE; } @@ -989,7 +989,7 @@ bool check_local_illumination(POSITION y, POSITION x) #else /* COMPLEX_WALL_ILLUMINATION */ /* Check for "simple" illumination */ - return (current_floor_ptr->grid_array[yy][xx].info & CAVE_GLOW) ? TRUE : FALSE; + return (p_ptr->current_floor_ptr->grid_array[yy][xx].info & CAVE_GLOW) ? TRUE : FALSE; #endif /* COMPLEX_WALL_ILLUMINATION */ } @@ -1001,7 +1001,7 @@ bool check_local_illumination(POSITION y, POSITION x) if (player_has_los_bold((Y), (X))) \ { \ /* Update the monster */ \ - if (current_floor_ptr->grid_array[(Y)][(X)].m_idx) update_monster(current_floor_ptr->grid_array[(Y)][(X)].m_idx, FALSE); \ + if (p_ptr->current_floor_ptr->grid_array[(Y)][(X)].m_idx) update_monster(p_ptr->current_floor_ptr->grid_array[(Y)][(X)].m_idx, FALSE); \ \ /* Notice and redraw */ \ note_spot((Y), (X)); \ @@ -1021,7 +1021,7 @@ void update_local_illumination(player_type * creature_ptr, POSITION y, POSITION int i; POSITION yy, xx; - if (!in_bounds(current_floor_ptr, y, x)) return; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; #ifdef COMPLEX_WALL_ILLUMINATION /* COMPLEX_WALL_ILLUMINATION */ @@ -1130,7 +1130,7 @@ bool no_lite(void) */ bool cave_valid_bold(POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; /* Forbid perma-grids */ @@ -1140,7 +1140,7 @@ bool cave_valid_bold(POSITION y, POSITION x) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Forbid artifact grids */ @@ -1219,7 +1219,7 @@ void print_rel(SYMBOL_CODE c, TERM_COLOR a, TERM_LEN y, TERM_LEN x) */ void note_spot(POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; /* Blind players see nothing */ @@ -1243,7 +1243,7 @@ void note_spot(POSITION y, POSITION x) /* Hack -- memorize objects */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { - object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Memorize objects */ @@ -1553,11 +1553,11 @@ void delayed_visual_update(void) grid_type *g_ptr; /* Update needed grids */ - for (i = 0; i < current_floor_ptr->redraw_n; i++) + for (i = 0; i < p_ptr->current_floor_ptr->redraw_n; i++) { - y = current_floor_ptr->redraw_y[i]; - x = current_floor_ptr->redraw_x[i]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + y = p_ptr->current_floor_ptr->redraw_y[i]; + x = p_ptr->current_floor_ptr->redraw_x[i]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Update only needed grids (prevent multiple updating) */ if (!(g_ptr->info & CAVE_REDRAW)) continue; @@ -1575,7 +1575,7 @@ void delayed_visual_update(void) } /* None left */ - current_floor_ptr->redraw_n = 0; + p_ptr->current_floor_ptr->redraw_n = 0; } @@ -1587,14 +1587,14 @@ void forget_flow(void) POSITION x, y; /* Check the entire dungeon */ - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { /* Forget the old data */ - current_floor_ptr->grid_array[y][x].dist = 0; - current_floor_ptr->grid_array[y][x].cost = 0; - current_floor_ptr->grid_array[y][x].when = 0; + p_ptr->current_floor_ptr->grid_array[y][x].dist = 0; + p_ptr->current_floor_ptr->grid_array[y][x].cost = 0; + p_ptr->current_floor_ptr->grid_array[y][x].when = 0; } } } @@ -1634,19 +1634,19 @@ void update_flow(void) if (tmp_pos.n) return; /* The last way-point is on the map */ - if (p_ptr->running && in_bounds(current_floor_ptr, flow_y, flow_x)) + if (p_ptr->running && in_bounds(p_ptr->current_floor_ptr, flow_y, flow_x)) { /* The way point is in sight - do not update. (Speedup) */ - if (current_floor_ptr->grid_array[flow_y][flow_x].info & CAVE_VIEW) return; + if (p_ptr->current_floor_ptr->grid_array[flow_y][flow_x].info & CAVE_VIEW) return; } /* Erase all of the current flow information */ - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - current_floor_ptr->grid_array[y][x].cost = 0; - current_floor_ptr->grid_array[y][x].dist = 0; + p_ptr->current_floor_ptr->grid_array[y][x].cost = 0; + p_ptr->current_floor_ptr->grid_array[y][x].dist = 0; } } @@ -1674,8 +1674,8 @@ void update_flow(void) for (d = 0; d < 8; d++) { int old_head = flow_head; - byte_hack m = current_floor_ptr->grid_array[ty][tx].cost + 1; - byte_hack n = current_floor_ptr->grid_array[ty][tx].dist + 1; + byte_hack m = p_ptr->current_floor_ptr->grid_array[ty][tx].cost + 1; + byte_hack n = p_ptr->current_floor_ptr->grid_array[ty][tx].dist + 1; grid_type *g_ptr; /* Child location */ @@ -1685,7 +1685,7 @@ void update_flow(void) /* Ignore player's grid */ if (player_bold(y, x)) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (is_closed_door(g_ptr->feat)) m += 3; @@ -1753,12 +1753,12 @@ void update_smell(void) if (++scent_when == 254) { /* Scan the entire dungeon */ - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - int w = current_floor_ptr->grid_array[y][x].when; - current_floor_ptr->grid_array[y][x].when = (w > 128) ? (w - 128) : 0; + int w = p_ptr->current_floor_ptr->grid_array[y][x].when; + p_ptr->current_floor_ptr->grid_array[y][x].when = (w > 128) ? (w - 128) : 0; } } @@ -1779,9 +1779,9 @@ void update_smell(void) x = j + p_ptr->x - 2; /* Check Bounds */ - if (!in_bounds(current_floor_ptr, y, x)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Walls, water, and lava cannot hold scent. */ if (!cave_have_flag_grid(g_ptr, FF_MOVE) && !is_closed_door(g_ptr->feat)) continue; @@ -1805,7 +1805,7 @@ void update_smell(void) */ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[feat]; bool old_los, old_mirror; @@ -1828,7 +1828,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) yy = y + ddy_ddd[i]; xx = x + ddx_ddd[i]; if (!in_bounds2(yy, xx)) continue; - current_floor_ptr->grid_array[yy][xx].info |= CAVE_GLOW; + p_ptr->current_floor_ptr->grid_array[yy][xx].info |= CAVE_GLOW; } } @@ -1888,7 +1888,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) yy = y + ddy_ddd[i]; xx = x + ddx_ddd[i]; if (!in_bounds2(yy, xx)) continue; - cc_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + cc_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; cc_ptr->info |= CAVE_GLOW; if (player_has_los_grid(cc_ptr)) @@ -1905,7 +1905,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE); + if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE); } } } @@ -1967,7 +1967,7 @@ FEAT_IDX feat_state(FEAT_IDX feat, int action) void cave_alter_feat(POSITION y, POSITION x, int action) { /* Set old feature */ - FEAT_IDX oldfeat = current_floor_ptr->grid_array[y][x].feat; + FEAT_IDX oldfeat = p_ptr->current_floor_ptr->grid_array[y][x].feat; /* Get the new feat */ FEAT_IDX newfeat = feat_state(oldfeat, action); @@ -1993,7 +1993,7 @@ void cave_alter_feat(POSITION y, POSITION x, int action) } /* Handle item */ - if (have_flag(old_f_ptr->flags, FF_HAS_ITEM) && !have_flag(f_ptr->flags, FF_HAS_ITEM) && (randint0(100) < (15 - current_floor_ptr->dun_level / 2))) + if (have_flag(old_f_ptr->flags, FF_HAS_ITEM) && !have_flag(f_ptr->flags, FF_HAS_ITEM) && (randint0(100) < (15 - p_ptr->current_floor_ptr->dun_level / 2))) { /* Place object */ place_object(y, x, 0L); @@ -2012,7 +2012,7 @@ void cave_alter_feat(POSITION y, POSITION x, int action) if (have_flag(old_f_ptr->flags, FF_GLASS) && current_world_ptr->character_dungeon) { - project(PROJECT_WHO_GLASS_SHARDS, 1, y, x, MIN(current_floor_ptr->dun_level, 100) / 4, GF_SHARDS, + project(PROJECT_WHO_GLASS_SHARDS, 1, y, x, MIN(p_ptr->current_floor_ptr->dun_level, 100) / 4, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1); } } @@ -2022,7 +2022,7 @@ void cave_alter_feat(POSITION y, POSITION x, int action) /* Remove a mirror */ void remove_mirror(POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Remove the mirror */ g_ptr->info &= ~(CAVE_OBJECT); @@ -2088,8 +2088,8 @@ bool is_explosive_rune_grid(grid_type *g_ptr) */ bool cave_monster_teleportable_bold(MONSTER_IDX m_idx, POSITION y, POSITION x, BIT_FLAGS mode) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; /* Require "teleportable" space */ @@ -2119,7 +2119,7 @@ bool cave_monster_teleportable_bold(MONSTER_IDX m_idx, POSITION y, POSITION x, B */ bool cave_player_teleportable_bold(POSITION y, POSITION x, BIT_FLAGS mode) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; /* Require "teleportable" space */ @@ -2177,7 +2177,7 @@ bool player_can_enter(FEAT_IDX feature, BIT_FLAGS16 mode) { feature_type *f_ptr = &f_info[feature]; - if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx], mode | CEM_RIDING); + if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[p_ptr->current_floor_ptr->m_list[p_ptr->riding].r_idx], mode | CEM_RIDING); if (have_flag(f_ptr->flags, FF_PATTERN)) { diff --git a/src/grid.h b/src/grid.h index 3c0a008a1..6bb2b9baf 100644 --- a/src/grid.h +++ b/src/grid.h @@ -18,7 +18,7 @@ /* * A single "grid" in a Cave * - * Note that several aspects of the code restrict the actual current_floor_ptr->grid_array + * Note that several aspects of the code restrict the actual p_ptr->current_floor_ptr->grid_array * to a max size of 256 by 256. In partcular, locations are often * saved as bytes, limiting each coordinate to the 0-255 range. * @@ -31,7 +31,7 @@ * amound of memory, but they all seem rather complicated, and would * probably add enough code that the savings would be lost. So for * these reasons, we simply store an index into the "o_list" and - * "current_floor_ptr->m_list" arrays, using "zero" when no monster/object is present. + * "p_ptr->current_floor_ptr->m_list" arrays, using "zero" when no monster/object is present. * * Note that "o_idx" is the index of the top object in a stack of * objects, using the "next_o_idx" field of objects (see below) to @@ -48,13 +48,13 @@ typedef struct grid_type grid_type; struct grid_type { - BIT_FLAGS info; /* Hack -- current_floor_ptr->grid_array flags */ + BIT_FLAGS info; /* Hack -- p_ptr->current_floor_ptr->grid_array flags */ FEAT_IDX feat; /* Hack -- feature type */ OBJECT_IDX o_idx; /* Object in this grid */ MONSTER_IDX m_idx; /* Monster in this grid */ - /*! 地形の特別な情報を保存する / Special current_floor_ptr->grid_array info + /*! 地形の特別な情報を保存する / Special p_ptr->current_floor_ptr->grid_array info * 具体的な使用一覧はクエスト行き階段の移行先クエストID、 * 各ダンジョン入口の移行先ダンジョンID、 * @@ -82,17 +82,17 @@ typedef struct /* Macros */ #define set_cave_feat(FL,Y,X,F) ((FL)->grid_array[(Y)][(X)].feat = (F)) -#define add_cave_info(Y,X,I) (current_floor_ptr->grid_array[(Y)][(X)].info |= (I)) +#define add_cave_info(Y,X,I) (p_ptr->current_floor_ptr->grid_array[(Y)][(X)].info |= (I)) /* This should not be used */ -/*#define set_cave_info(Y,X,I) (current_floor_ptr->grid_array[(Y)][(X)].info = (I)) */ +/*#define set_cave_info(Y,X,I) (p_ptr->current_floor_ptr->grid_array[(Y)][(X)].info = (I)) */ /*! * @brief 指定座標に瓦礫を配置する * @param Y 指定Y座標 * @param X 指定X座標 */ -#define place_rubble(Y,X) set_cave_feat(current_floor_ptr,Y,X,feat_rubble) +#define place_rubble(Y,X) set_cave_feat(p_ptr->current_floor_ptr,Y,X,feat_rubble) /*! * @brief 指定座標がFLOOR属性を持ったマスかどうかを返す @@ -100,12 +100,12 @@ typedef struct * @param X 指定X座標 * @return FLOOR属性を持っているならばTRUE */ -#define is_floor_bold(Y,X) (current_floor_ptr->grid_array[Y][X].info & CAVE_FLOOR) -#define is_extra_bold(Y,X) (current_floor_ptr->grid_array[Y][X].info & CAVE_EXTRA) +#define is_floor_bold(Y,X) (p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_FLOOR) +#define is_extra_bold(Y,X) (p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_EXTRA) -#define is_inner_bold(Y,X) (current_floor_ptr->grid_array[Y][X].info & CAVE_INNER) -#define is_outer_bold(Y,X) (current_floor_ptr->grid_array[Y][X].info & CAVE_OUTER) -#define is_solid_bold(Y,X) (current_floor_ptr->grid_array[Y][X].info & CAVE_SOLID) +#define is_inner_bold(Y,X) (p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_INNER) +#define is_outer_bold(Y,X) (p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_OUTER) +#define is_solid_bold(Y,X) (p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_SOLID) #define is_floor_grid(C) ((C)->info & CAVE_FLOOR) #define is_extra_grid(C) ((C)->info & CAVE_EXTRA) @@ -115,8 +115,8 @@ typedef struct #define place_floor_bold(Y, X) \ { \ - set_cave_feat(current_floor_ptr, Y,X,feat_ground_type[randint0(100)]); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_ground_type[randint0(100)]); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_FLOOR); \ delete_monster(Y, X); \ } @@ -131,8 +131,8 @@ typedef struct #define place_extra_bold(Y, X) \ { \ - set_cave_feat(current_floor_ptr, Y,X,feat_wall_type[randint0(100)]); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_wall_type[randint0(100)]); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_EXTRA); \ delete_monster(Y, X); \ } @@ -148,7 +148,7 @@ typedef struct #define place_extra_perm_bold(Y, X) \ { \ set_cave_feat(floor_ptr, Y,X,feat_permanent); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_EXTRA); \ delete_monster(Y, X); \ } @@ -165,17 +165,17 @@ typedef struct { \ feature_type *_f_ptr; \ set_cave_feat(floor_ptr, Y,X,feat_wall_type[randint0(100)]); \ - _f_ptr = &f_info[current_floor_ptr->grid_array[Y][X].feat]; \ - if (permanent_wall(_f_ptr)) current_floor_ptr->grid_array[Y][X].feat = feat_state(current_floor_ptr->grid_array[Y][X].feat, FF_UNPERM); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + _f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[Y][X].feat]; \ + if (permanent_wall(_f_ptr)) p_ptr->current_floor_ptr->grid_array[Y][X].feat = feat_state(p_ptr->current_floor_ptr->grid_array[Y][X].feat, FF_UNPERM); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_EXTRA); \ delete_monster(Y, X); \ } #define place_inner_bold(Y, X) \ { \ - set_cave_feat(current_floor_ptr, Y,X,feat_wall_inner); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_wall_inner); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_INNER); \ delete_monster(Y, X); \ } @@ -190,8 +190,8 @@ typedef struct #define place_inner_perm_bold(Y, X) \ { \ - set_cave_feat(current_floor_ptr, Y,X,feat_permanent); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_permanent); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_INNER); \ delete_monster(Y, X); \ } @@ -206,8 +206,8 @@ typedef struct #define place_outer_bold(Y, X) \ { \ - set_cave_feat(current_floor_ptr, Y,X,feat_wall_outer); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_wall_outer); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_OUTER); \ delete_monster(Y, X); \ } @@ -223,7 +223,7 @@ typedef struct #define place_outer_perm_bold(Y, X) \ { \ set_cave_feat(floor_ptr, Y,X,feat_permanent); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_OUTER); \ delete_monster(Y, X); \ } @@ -239,9 +239,9 @@ typedef struct #define place_outer_noperm_bold(Y, X) \ { \ feature_type *_f_ptr = &f_info[feat_wall_outer]; \ - if (permanent_wall(_f_ptr)) set_cave_feat(current_floor_ptr, Y, X, (s16b)feat_state(feat_wall_outer, FF_UNPERM)); \ - else set_cave_feat(current_floor_ptr, Y,X,feat_wall_outer); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + if (permanent_wall(_f_ptr)) set_cave_feat(p_ptr->current_floor_ptr, Y, X, (s16b)feat_state(feat_wall_outer, FF_UNPERM)); \ + else set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_wall_outer); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,(CAVE_OUTER | CAVE_VAULT)); \ delete_monster(Y, X); \ } @@ -258,8 +258,8 @@ typedef struct #define place_solid_bold(Y, X) \ { \ - set_cave_feat(current_floor_ptr, Y,X,feat_wall_solid); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_wall_solid); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_SOLID); \ delete_monster(Y, X); \ } @@ -275,7 +275,7 @@ typedef struct #define place_solid_perm_bold(Y, X) \ { \ set_cave_feat(floor_ptr, Y,X,feat_permanent); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_SOLID); \ delete_monster(Y, X); \ } @@ -291,10 +291,10 @@ typedef struct #define place_solid_noperm_bold(Y, X) \ { \ feature_type *_f_ptr = &f_info[feat_wall_solid]; \ - if ((current_floor_ptr->grid_array[Y][X].info & CAVE_VAULT) && permanent_wall(_f_ptr)) \ - set_cave_feat(current_floor_ptr, Y, X, feat_state(feat_wall_solid, FF_UNPERM)); \ - else set_cave_feat(current_floor_ptr, Y,X,feat_wall_solid); \ - current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ + if ((p_ptr->current_floor_ptr->grid_array[Y][X].info & CAVE_VAULT) && permanent_wall(_f_ptr)) \ + set_cave_feat(p_ptr->current_floor_ptr, Y, X, feat_state(feat_wall_solid, FF_UNPERM)); \ + else set_cave_feat(p_ptr->current_floor_ptr, Y,X,feat_wall_solid); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info &= ~(CAVE_MASK); \ add_cave_info(Y,X,CAVE_SOLID); \ delete_monster(Y, X); \ } @@ -325,7 +325,7 @@ typedef struct #define CAVE_MNLT 0x0100 /*!< モンスターの光源によって照らされている / Illuminated by monster */ #define CAVE_MNDK 0x8000 /*!< モンスターの暗源によって暗闇になっている / Darken by monster */ - /* Used only while current_floor_ptr->grid_array generation */ + /* Used only while p_ptr->current_floor_ptr->grid_array generation */ #define CAVE_FLOOR 0x0200 /*!< フロア属性のあるマス */ #define CAVE_EXTRA 0x0400 #define CAVE_INNER 0x0800 @@ -334,7 +334,7 @@ typedef struct #define CAVE_VAULT 0x4000 #define CAVE_MASK (CAVE_FLOOR | CAVE_EXTRA | CAVE_INNER | CAVE_OUTER | CAVE_SOLID | CAVE_VAULT) -/* Used only after current_floor_ptr->grid_array generation */ +/* Used only after p_ptr->current_floor_ptr->grid_array generation */ #define CAVE_KNOWN 0x0200 /* Directly viewed or map detected flag */ #define CAVE_NOTE 0x0400 /* Flag for delayed visual update (needs note_spot()) */ #define CAVE_REDRAW 0x0800 /* Flag for delayed visual update (needs lite_spot()) */ @@ -443,11 +443,11 @@ extern bool cave_player_teleportable_bold(POSITION y, POSITION x, BIT_FLAGS mode */ #define cave_lite_hack(Y,X) \ {\ - if (!(current_floor_ptr->grid_array[Y][X].info & (CAVE_LITE))) \ + if (!(p_ptr->current_floor_ptr->grid_array[Y][X].info & (CAVE_LITE))) \ { \ - current_floor_ptr->grid_array[Y][X].info |= (CAVE_LITE); \ - current_floor_ptr->lite_y[current_floor_ptr->lite_n] = (Y); \ - current_floor_ptr->lite_x[current_floor_ptr->lite_n++] = (X); \ + p_ptr->current_floor_ptr->grid_array[Y][X].info |= (CAVE_LITE); \ + p_ptr->current_floor_ptr->lite_y[p_ptr->current_floor_ptr->lite_n] = (Y); \ + p_ptr->current_floor_ptr->lite_x[p_ptr->current_floor_ptr->lite_n++] = (X); \ } \ } @@ -468,8 +468,8 @@ extern bool cave_player_teleportable_bold(POSITION y, POSITION x, BIT_FLAGS mode if (!((C)->info & CAVE_REDRAW)) \ { \ (C)->info |= CAVE_REDRAW; \ - current_floor_ptr->redraw_y[current_floor_ptr->redraw_n] = (Y); \ - current_floor_ptr->redraw_x[current_floor_ptr->redraw_n++] = (X); \ + p_ptr->current_floor_ptr->redraw_y[p_ptr->current_floor_ptr->redraw_n] = (Y); \ + p_ptr->current_floor_ptr->redraw_x[p_ptr->current_floor_ptr->redraw_n++] = (X); \ } \ } @@ -483,8 +483,8 @@ extern bool cave_player_teleportable_bold(POSITION y, POSITION x, BIT_FLAGS mode {\ if (!((C)->info & (CAVE_VIEW))){\ (C)->info |= (CAVE_VIEW); \ - current_floor_ptr->view_y[current_floor_ptr->view_n] = (Y); \ - current_floor_ptr->view_x[current_floor_ptr->view_n] = (X); \ - current_floor_ptr->view_n++;}\ + p_ptr->current_floor_ptr->view_y[p_ptr->current_floor_ptr->view_n] = (Y); \ + p_ptr->current_floor_ptr->view_x[p_ptr->current_floor_ptr->view_n] = (X); \ + p_ptr->current_floor_ptr->view_n++;}\ } diff --git a/src/init.c b/src/init.c index 7a9f615c7..0c82ceb50 100644 --- a/src/init.c +++ b/src/init.c @@ -58,6 +58,7 @@ #include "objectkind.h" #include "object-ego.h" #include "rooms-vault.h" +#include "world.h" #ifndef MACINTOSH #ifdef CHECK_MODIFICATION_TIME @@ -1218,29 +1219,31 @@ static errr init_other(void) { int i, n; + p_ptr->current_floor_ptr = &floor_info; // TODO:本当はこんなところで初期化したくない + /*** Prepare the "dungeon" information ***/ /* Allocate and Wipe the object list */ - C_MAKE(current_floor_ptr->o_list, current_floor_ptr->max_o_idx, object_type); + C_MAKE(p_ptr->current_floor_ptr->o_list, current_world_ptr->max_o_idx, object_type); /* Allocate and Wipe the monster list */ - C_MAKE(current_floor_ptr->m_list, current_floor_ptr->max_m_idx, monster_type); + C_MAKE(p_ptr->current_floor_ptr->m_list, current_world_ptr->max_m_idx, monster_type); /* Allocate and Wipe the monster process list */ for (i = 0; i < MAX_MTIMED; i++) { - C_MAKE(current_floor_ptr->mproc_list[i], current_floor_ptr->max_m_idx, s16b); + C_MAKE(p_ptr->current_floor_ptr->mproc_list[i], current_world_ptr->max_m_idx, s16b); } /* Allocate and Wipe the max dungeon level */ C_MAKE(max_dlv, max_d_idx, DEPTH); - /* Allocate and wipe each line of the current_floor_ptr->grid_array */ + /* Allocate and wipe each line of the p_ptr->current_floor_ptr->grid_array */ for (i = 0; i < MAX_HGT; i++) { - /* Allocate one row of the current_floor_ptr->grid_array */ - C_MAKE(current_floor_ptr->grid_array[i], MAX_WID, grid_type); + /* Allocate one row of the p_ptr->current_floor_ptr->grid_array */ + C_MAKE(p_ptr->current_floor_ptr->grid_array[i], MAX_WID, grid_type); } diff --git a/src/load.c b/src/load.c index 6d71546e8..3d3674977 100644 --- a/src/load.c +++ b/src/load.c @@ -1975,7 +1975,7 @@ static void rd_extra(void) rd_s16b(&tmp16s); p_ptr->oldpy = (POSITION)tmp16s; - if (z_older_than(10, 3, 13) && !current_floor_ptr->dun_level && !p_ptr->inside_arena) {p_ptr->oldpy = 33;p_ptr->oldpx = 131;} + if (z_older_than(10, 3, 13) && !p_ptr->current_floor_ptr->dun_level && !p_ptr->inside_arena) {p_ptr->oldpy = 33;p_ptr->oldpx = 131;} /* Was p_ptr->rewards[MAX_BACT] */ rd_s16b(&tmp16s); @@ -2286,11 +2286,11 @@ static void rd_extra(void) current_world_ptr->dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4; /* Turn when level began */ - rd_s32b(¤t_floor_ptr->generated_turn); + rd_s32b(&p_ptr->current_floor_ptr->generated_turn); if (h_older_than(1, 7, 0, 4)) { - p_ptr->feeling_turn = current_floor_ptr->generated_turn; + p_ptr->feeling_turn = p_ptr->current_floor_ptr->generated_turn; } else { @@ -2309,7 +2309,7 @@ static void rd_extra(void) if (z_older_than(11, 0, 13)) { - current_floor_ptr->generated_turn /= 2; + p_ptr->current_floor_ptr->generated_turn /= 2; p_ptr->feeling_turn /= 2; current_world_ptr->game_turn /= 2; current_world_ptr->dungeon_turn /= 2; @@ -2581,7 +2581,7 @@ static errr rd_dungeon_old(void) /* Header info */ rd_s16b(&tmp16s); - current_floor_ptr->dun_level = (DEPTH)tmp16s; + p_ptr->current_floor_ptr->dun_level = (DEPTH)tmp16s; if (z_older_than(10, 3, 8)) p_ptr->dungeon_idx = DUNGEON_ANGBAND; else { @@ -2590,22 +2590,22 @@ static errr rd_dungeon_old(void) } /* Set the base level for old versions */ - current_floor_ptr->base_level = current_floor_ptr->dun_level; + p_ptr->current_floor_ptr->base_level = p_ptr->current_floor_ptr->dun_level; rd_s16b(&tmp16s); - current_floor_ptr->base_level = (DEPTH)tmp16s; + p_ptr->current_floor_ptr->base_level = (DEPTH)tmp16s; rd_s16b(&tmp16s); - current_floor_ptr->num_repro = (MONSTER_NUMBER)tmp16s; + p_ptr->current_floor_ptr->num_repro = (MONSTER_NUMBER)tmp16s; rd_s16b(&tmp16s); p_ptr->y = (POSITION)tmp16s; rd_s16b(&tmp16s); p_ptr->x = (POSITION)tmp16s; - if (z_older_than(10, 3, 13) && !current_floor_ptr->dun_level && !p_ptr->inside_arena) {p_ptr->y = 33;p_ptr->x = 131;} + if (z_older_than(10, 3, 13) && !p_ptr->current_floor_ptr->dun_level && !p_ptr->inside_arena) {p_ptr->y = 33;p_ptr->x = 131;} rd_s16b(&tmp16s); - current_floor_ptr->height = (POSITION)tmp16s; + p_ptr->current_floor_ptr->height = (POSITION)tmp16s; rd_s16b(&tmp16s); - current_floor_ptr->width = (POSITION)tmp16s; + p_ptr->current_floor_ptr->width = (POSITION)tmp16s; rd_s16b(&tmp16s); /* max_panel_rows */ rd_s16b(&tmp16s); /* max_panel_cols */ @@ -2614,8 +2614,8 @@ static errr rd_dungeon_old(void) #endif /* Maximal size */ - ymax = current_floor_ptr->height; - xmax = current_floor_ptr->width; + ymax = p_ptr->current_floor_ptr->height; + xmax = p_ptr->current_floor_ptr->width; /*** Run length decoding ***/ @@ -2643,8 +2643,8 @@ static errr rd_dungeon_old(void) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the current_floor_ptr->grid_array */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Extract "info" */ g_ptr->info = info; @@ -2674,8 +2674,8 @@ static errr rd_dungeon_old(void) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the current_floor_ptr->grid_array */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Extract "feat" */ g_ptr->feat = (s16b)tmp8u; @@ -2704,8 +2704,8 @@ static errr rd_dungeon_old(void) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the current_floor_ptr->grid_array */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Extract "mimic" */ g_ptr->mimic = (s16b)tmp8u; @@ -2734,8 +2734,8 @@ static errr rd_dungeon_old(void) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the current_floor_ptr->grid_array */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Extract "feat" */ g_ptr->special = tmp16s; @@ -2752,13 +2752,13 @@ static errr rd_dungeon_old(void) } } - /* Convert current_floor_ptr->grid_array data */ + /* Convert p_ptr->current_floor_ptr->grid_array data */ if (z_older_than(11, 0, 99)) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { /* Wipe old unused flags */ - current_floor_ptr->grid_array[y][x].info &= ~(CAVE_MASK); + p_ptr->current_floor_ptr->grid_array[y][x].info &= ~(CAVE_MASK); } } @@ -2766,8 +2766,8 @@ static errr rd_dungeon_old(void) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { - /* Access the current_floor_ptr->grid_array */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Very old */ if (g_ptr->feat == OLD_FEAT_INVIS) @@ -2789,8 +2789,8 @@ static errr rd_dungeon_old(void) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { - /* Access the current_floor_ptr->grid_array */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Old CAVE_IN_MIRROR flag */ if (g_ptr->info & CAVE_OBJECT) @@ -2829,10 +2829,10 @@ static errr rd_dungeon_old(void) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { - /* Access the current_floor_ptr->grid_array */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; - if ((g_ptr->special == OLD_QUEST_WATER_CAVE) && !current_floor_ptr->dun_level) + if ((g_ptr->special == OLD_QUEST_WATER_CAVE) && !p_ptr->current_floor_ptr->dun_level) { if (g_ptr->feat == OLD_FEAT_QUEST_ENTER) { @@ -2859,7 +2859,7 @@ static errr rd_dungeon_old(void) rd_u16b(&limit); /* Verify maximum */ - if (limit > current_floor_ptr->max_o_idx) + if (limit > current_world_ptr->max_o_idx) { note(format(_("アイテムの配列が大きすぎる(%d)!", "Too many (%d) object entries!"), limit)); return (151); @@ -2884,7 +2884,7 @@ static errr rd_dungeon_old(void) /* Acquire place */ - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; /* Read the item */ rd_item(o_ptr); @@ -2893,7 +2893,7 @@ static errr rd_dungeon_old(void) if (OBJECT_IS_HELD_MONSTER(o_ptr)) { monster_type *m_ptr; - m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[o_ptr->held_m_idx]; /* Build a stack */ o_ptr->next_o_idx = m_ptr->hold_o_idx; @@ -2905,7 +2905,7 @@ static errr rd_dungeon_old(void) else { /* Access the item location */ - g_ptr = ¤t_floor_ptr->grid_array[o_ptr->iy][o_ptr->ix]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[o_ptr->iy][o_ptr->ix]; /* Build a stack */ o_ptr->next_o_idx = g_ptr->o_idx; @@ -2921,7 +2921,7 @@ static errr rd_dungeon_old(void) rd_u16b(&limit); /* Hack -- verify */ - if (limit > current_floor_ptr->max_m_idx) + if (limit > current_world_ptr->max_m_idx) { note(format(_("モンスターの配列が大きすぎる(%d)!", "Too many (%d) monster entries!"), limit)); return (161); @@ -2942,14 +2942,14 @@ static errr rd_dungeon_old(void) return (162); } - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; /* Read the monster */ rd_monster(m_ptr); /* Access grid */ - g_ptr = ¤t_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx]; /* Mark the location */ g_ptr->m_idx = m_idx; @@ -2961,7 +2961,7 @@ static errr rd_dungeon_old(void) /*** Success ***/ /* The dungeon is ready */ - if (z_older_than(10, 3, 13) && !current_floor_ptr->dun_level && !p_ptr->inside_arena) + if (z_older_than(10, 3, 13) && !p_ptr->current_floor_ptr->dun_level && !p_ptr->inside_arena) current_world_ptr->character_dungeon = FALSE; else current_world_ptr->character_dungeon = TRUE; @@ -2999,7 +2999,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) grid_template_type *templates; - clear_cave(current_floor_ptr); + clear_cave(p_ptr->current_floor_ptr); /*** Basic info ***/ @@ -3010,8 +3010,8 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) /*** Not a saved floor ***/ rd_s16b(&tmp16s); - current_floor_ptr->dun_level = (DEPTH)tmp16s; - current_floor_ptr->base_level = current_floor_ptr->dun_level; + p_ptr->current_floor_ptr->dun_level = (DEPTH)tmp16s; + p_ptr->current_floor_ptr->base_level = p_ptr->current_floor_ptr->dun_level; } else { @@ -3025,7 +3025,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) rd_s16b(&tmp16s); if (tmp16s != sf_ptr->dun_level) return 171; - current_floor_ptr->dun_level = sf_ptr->dun_level; + p_ptr->current_floor_ptr->dun_level = sf_ptr->dun_level; rd_s32b(&tmp32s); if (tmp32s != sf_ptr->last_visit) return 171; @@ -3041,9 +3041,9 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) } rd_s16b(&tmp16s); - current_floor_ptr->base_level = (DEPTH)tmp16s; + p_ptr->current_floor_ptr->base_level = (DEPTH)tmp16s; rd_s16b(&tmp16s); - current_floor_ptr->num_repro = (MONSTER_NUMBER)tmp16s; + p_ptr->current_floor_ptr->num_repro = (MONSTER_NUMBER)tmp16s; rd_u16b(&tmp16u); p_ptr->y = (POSITION)tmp16u; @@ -3052,9 +3052,9 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) p_ptr->x = (POSITION)tmp16u; rd_s16b(&tmp16s); - current_floor_ptr->height = (POSITION)tmp16s; + p_ptr->current_floor_ptr->height = (POSITION)tmp16s; rd_s16b(&tmp16s); - current_floor_ptr->width = (POSITION)tmp16s; + p_ptr->current_floor_ptr->width = (POSITION)tmp16s; rd_byte(&p_ptr->feeling); @@ -3092,8 +3092,8 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) } /* Maximal size */ - ymax = current_floor_ptr->height; - xmax = current_floor_ptr->width; + ymax = p_ptr->current_floor_ptr->height; + xmax = p_ptr->current_floor_ptr->width; /*** Run length decoding ***/ @@ -3116,10 +3116,10 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) /* Apply the RLE info */ for (i = count; i > 0; i--) { - /* Access the current_floor_ptr->grid_array */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; - /* Extract current_floor_ptr->grid_array data */ + /* Extract p_ptr->current_floor_ptr->grid_array data */ g_ptr->info = templates[id].info; g_ptr->feat = templates[id].feat; g_ptr->mimic = templates[id].mimic; @@ -3142,10 +3142,10 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) { for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++) { - /* Access the current_floor_ptr->grid_array */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Access the p_ptr->current_floor_ptr->grid_array */ + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; - if ((g_ptr->special == OLD_QUEST_WATER_CAVE) && !current_floor_ptr->dun_level) + if ((g_ptr->special == OLD_QUEST_WATER_CAVE) && !p_ptr->current_floor_ptr->dun_level) { if (g_ptr->feat == OLD_FEAT_QUEST_ENTER) { @@ -3176,7 +3176,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) rd_u16b(&limit); /* Verify maximum */ - if (limit > current_floor_ptr->max_o_idx) return 151; + if (limit > current_world_ptr->max_o_idx) return 151; /* Read the dungeon items */ @@ -3192,7 +3192,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) if (i != o_idx) return 152; /* Acquire place */ - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; /* Read the item */ rd_item(o_ptr); @@ -3200,7 +3200,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) if (OBJECT_IS_HELD_MONSTER(o_ptr)) { monster_type *m_ptr; - m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[o_ptr->held_m_idx]; /* Build a stack */ o_ptr->next_o_idx = m_ptr->hold_o_idx; @@ -3212,7 +3212,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) else { /* Access the item location */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[o_ptr->iy][o_ptr->ix]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[o_ptr->iy][o_ptr->ix]; /* Build a stack */ o_ptr->next_o_idx = g_ptr->o_idx; @@ -3228,7 +3228,7 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) rd_u16b(&limit); /* Hack -- verify */ - if (limit > current_floor_ptr->max_m_idx) return 161; + if (limit > current_world_ptr->max_m_idx) return 161; /* Read the monsters */ for (i = 1; i < limit; i++) @@ -3242,14 +3242,14 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) if (i != m_idx) return 162; - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; /* Read the monster */ rd_monster(m_ptr); /* Access grid */ - g_ptr = ¤t_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx]; /* Mark the location */ g_ptr->m_idx = m_idx; @@ -3290,7 +3290,7 @@ static errr rd_dungeon(void) if (p_ptr->dungeon_idx) { p_ptr->floor_id = get_new_floor_id(); - get_sf_ptr(p_ptr->floor_id)->dun_level = current_floor_ptr->dun_level; + get_sf_ptr(p_ptr->floor_id)->dun_level = p_ptr->current_floor_ptr->dun_level; } return err; @@ -3964,7 +3964,7 @@ static errr rd_savefile_new_aux(void) if (p_ptr->inside_quest == OLD_QUEST_WATER_CAVE) { p_ptr->dungeon_idx = lite_town ? DUNGEON_ANGBAND : DUNGEON_GALGALS; - current_floor_ptr->dun_level = 1; + p_ptr->current_floor_ptr->dun_level = 1; p_ptr->inside_quest = 0; } } diff --git a/src/main-win.c b/src/main-win.c index 15fec7219..2ea21e99d 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -3276,8 +3276,8 @@ static void windows_map(void) { min_x = 0; min_y = 0; - max_x = current_floor_ptr->width; - max_y = current_floor_ptr->height; + max_x = p_ptr->current_floor_ptr->width; + max_y = p_ptr->current_floor_ptr->height; } /* Draw the map */ @@ -3940,9 +3940,9 @@ static void process_menus(WORD wCmd) /* Hack -- Forget messages */ msg_flag = FALSE; - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Save the game */ #ifdef ZANGBAND @@ -4837,9 +4837,9 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP /* Hack -- Forget messages */ msg_flag = FALSE; - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Save the game */ #ifdef ZANGBAND diff --git a/src/mind.c b/src/mind.c index b81bdcfec..32dc3e845 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1243,7 +1243,7 @@ static bool cast_force_spell(int spell) MONSTER_IDX m_idx; if (!target_set(TARGET_KILL)) return FALSE; - m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx; + m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; @@ -1297,9 +1297,9 @@ static int number_of_mirrors(void) { POSITION x, y; int val = 0; - for (x = 0; x < current_floor_ptr->width; x++) { - for (y = 0; y < current_floor_ptr->height; y++) { - if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) val++; + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x])) val++; } } return val; @@ -1324,7 +1324,7 @@ static bool cast_mirror_spell(int spell) { /* mirror of seeing */ case 0: - tmp = is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0; + tmp = is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0; if (plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT); if (plev + tmp > 18)detect_monsters_invis(DETECT_RAD_DEFAULT); if (plev + tmp > 28)set_tim_esp(p_ptr, (TIME_EFFECT)plev, FALSE); @@ -1344,7 +1344,7 @@ static bool cast_mirror_spell(int spell) break; case 2: if (!get_aim_dir(&dir)) return FALSE; - if (plev > 9 && is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])) { + if (plev > 9 && is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x])) { fire_beam(GF_LITE, dir, damroll(3 + ((plev - 1) / 5), 4)); } else { @@ -1380,9 +1380,9 @@ static bool cast_mirror_spell(int spell) break; /* mirror sleeping */ case 9: - for (x = 0; x < current_floor_ptr->width; x++) { - for (y = 0; y < current_floor_ptr->height; y++) { - if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) { + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x])) { project(0, 2, y, x, (HIT_POINT)plev, GF_OLD_SLEEP, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1); } } @@ -1411,7 +1411,7 @@ static bool cast_mirror_spell(int spell) break; /* illusion light */ case 14: - tmp = is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3; + tmp = is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3; slow_monsters(plev); stun_monsters(plev*tmp); confuse_monsters(plev*tmp); @@ -1421,7 +1421,7 @@ static bool cast_mirror_spell(int spell) break; /* mirror shift */ case 15: - if (!is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])) { + if (!is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x])) { msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!")); break; } @@ -1487,7 +1487,7 @@ static bool cast_berserk_spell(int spell) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (!current_floor_ptr->grid_array[y][x].m_idx) + if (!p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return FALSE; @@ -1495,13 +1495,13 @@ static bool cast_berserk_spell(int spell) py_attack(p_ptr, y, x, 0); - if (!player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(current_floor_ptr->grid_array[y][x].feat)) + if (!player_can_enter(p_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(p_ptr->current_floor_ptr->grid_array[y][x].feat)) break; y += ddy[dir]; x += ddx[dir]; - if (player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx) + if (player_can_enter(p_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(p_ptr->current_floor_ptr->grid_array[y][x].feat) && !p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { msg_print(NULL); (void)move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); @@ -1643,12 +1643,12 @@ static bool cast_ninja_spell(int spell) POSITION ty, tx; if (!target_set(TARGET_KILL)) return FALSE; - m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx; + m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx; if (!m_idx) break; if (m_idx == p_ptr->riding) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_desc(m_name, m_ptr, 0); msg_format(_("%sを引き戻した。", "You pull back %s."), m_name); path_n = project_path(path_g, MAX_RANGE, target_row, target_col, p_ptr->y, p_ptr->x, 0); @@ -1657,9 +1657,9 @@ static bool cast_ninja_spell(int spell) { POSITION ny = GRID_Y(path_g[i]); POSITION nx = GRID_X(path_g[i]); - grid_type *g_ptr = ¤t_floor_ptr->grid_array[ny][nx]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx]; - if (in_bounds(current_floor_ptr, ny, nx) && cave_empty_bold(ny, nx) && + if (in_bounds(p_ptr->current_floor_ptr, ny, nx) && cave_empty_bold(ny, nx) && !(g_ptr->info & CAVE_OBJECT) && !pattern_tile(ny, nx)) { @@ -1668,10 +1668,10 @@ static bool cast_ninja_spell(int spell) } } /* Update the old location */ - current_floor_ptr->grid_array[target_row][target_col].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx = 0; /* Update the new location */ - current_floor_ptr->grid_array[ty][tx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ty; @@ -1976,7 +1976,7 @@ void do_cmd_mind(void) break; case MIND_MIRROR_MASTER: - if( is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE; + if( is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE; cast = cast_mirror_spell(n); break; case MIND_NINJUTSU: diff --git a/src/monster-process.c b/src/monster-process.c index f62e26dee..56fe9630f 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -56,38 +56,38 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm) int start; int plus = 1; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_type *t_ptr; if (p_ptr->riding_t_m_idx && player_bold(m_ptr->fy, m_ptr->fx)) { - y = current_floor_ptr->m_list[p_ptr->riding_t_m_idx].fy; - x = current_floor_ptr->m_list[p_ptr->riding_t_m_idx].fx; + y = p_ptr->current_floor_ptr->m_list[p_ptr->riding_t_m_idx].fy; + x = p_ptr->current_floor_ptr->m_list[p_ptr->riding_t_m_idx].fx; } else if (is_pet(m_ptr) && p_ptr->pet_t_m_idx) { - y = current_floor_ptr->m_list[p_ptr->pet_t_m_idx].fy; - x = current_floor_ptr->m_list[p_ptr->pet_t_m_idx].fx; + y = p_ptr->current_floor_ptr->m_list[p_ptr->pet_t_m_idx].fy; + x = p_ptr->current_floor_ptr->m_list[p_ptr->pet_t_m_idx].fx; } else { if (p_ptr->phase_out) { - start = randint1(current_floor_ptr->m_max-1)+current_floor_ptr->m_max; + start = randint1(p_ptr->current_floor_ptr->m_max-1)+p_ptr->current_floor_ptr->m_max; if(randint0(2)) plus = -1; } - else start = current_floor_ptr->m_max + 1; + else start = p_ptr->current_floor_ptr->m_max + 1; /* Scan thru all monsters */ - for (i = start; ((i < start + current_floor_ptr->m_max) && (i > start - current_floor_ptr->m_max)); i+=plus) + for (i = start; ((i < start + p_ptr->current_floor_ptr->m_max) && (i > start - p_ptr->current_floor_ptr->m_max)); i+=plus) { - MONSTER_IDX dummy = (i % current_floor_ptr->m_max); + MONSTER_IDX dummy = (i % p_ptr->current_floor_ptr->m_max); if (!dummy) continue; t_idx = dummy; - t_ptr = ¤t_floor_ptr->m_list[t_idx]; + t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; /* The monster itself isn't a target */ if (t_ptr == m_ptr) continue; @@ -220,7 +220,7 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm) */ static bool mon_will_run(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; #ifdef ALLOW_TERROR @@ -302,7 +302,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) bool can_open_door = FALSE; int now_cost; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Monster location */ @@ -313,7 +313,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) if (projectable(y1, x1, p_ptr->y, p_ptr->x)) return (FALSE); /* Set current grid cost */ - now_cost = current_floor_ptr->grid_array[y1][x1].cost; + now_cost = p_ptr->current_floor_ptr->grid_array[y1][x1].cost; if (now_cost == 0) now_cost = 999; /* Can monster bash or open doors? */ @@ -336,7 +336,7 @@ static bool get_moves_aux2(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) /* Simply move to player */ if (player_bold(y, x)) return (FALSE); - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; cost = g_ptr->cost; @@ -406,7 +406,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no grid_type *g_ptr; bool use_scent = FALSE; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Can monster cast attack spell? */ @@ -433,7 +433,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no if (player_has_los_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)) return (FALSE); /* Monster grid */ - g_ptr = ¤t_floor_ptr->grid_array[y1][x1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y1][x1]; /* If we can hear noises, advance towards them */ if (g_ptr->cost) @@ -445,7 +445,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no else if (g_ptr->when) { /* Too old smell */ - if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].when - g_ptr->when > 127) return (FALSE); + if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].when - g_ptr->when > 127) return (FALSE); use_scent = TRUE; best = 0; @@ -466,7 +466,7 @@ static bool get_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp, bool no /* Ignore locations off of edge */ if (!in_bounds2(y, x)) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* We're following a scent trail */ if (use_scent) @@ -523,7 +523,7 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) int score = -1; int i; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; /* Monster location */ fy = m_ptr->fy; @@ -545,13 +545,13 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) if (!in_bounds2(y, x)) continue; /* Don't move toward player */ - /* if (current_floor_ptr->grid_array[y][x].dist < 3) continue; */ /* Hmm.. Need it? */ + /* if (p_ptr->current_floor_ptr->grid_array[y][x].dist < 3) continue; */ /* Hmm.. Need it? */ /* Calculate distance of this grid from our destination */ dis = distance(y, x, y1, x1); /* Score this grid */ - s = 5000 / (dis + 3) - 500 / (current_floor_ptr->grid_array[y][x].dist + 1); + s = 5000 / (dis + 3) - 500 / (p_ptr->current_floor_ptr->grid_array[y][x].dist + 1); /* No negative scores */ if (s < 0) s = 0; @@ -710,7 +710,7 @@ static POSITION *dist_offsets_x[10] = */ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; POSITION fy = m_ptr->fy; POSITION fx = m_ptr->fx; @@ -739,9 +739,9 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) x = fx + dx; /* Skip illegal locations */ - if (!in_bounds(current_floor_ptr, y, x)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Skip locations in a wall */ if (!monster_can_cross_terrain(g_ptr->feat, &r_info[m_ptr->r_idx], (m_idx == p_ptr->riding) ? CEM_RIDING : 0)) continue; @@ -753,7 +753,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) if (g_ptr->dist == 0) continue; /* Ignore too-distant grids */ - if (g_ptr->dist > current_floor_ptr->grid_array[fy][fx].dist + 2 * d) continue; + if (g_ptr->dist > p_ptr->current_floor_ptr->grid_array[fy][fx].dist + 2 * d) continue; } /* Check for absence of shot (more or less) */ @@ -804,7 +804,7 @@ static bool find_safety(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) */ static bool find_hiding(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; POSITION fy = m_ptr->fy; @@ -831,7 +831,7 @@ static bool find_hiding(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) x = fx + dx; /* Skip illegal locations */ - if (!in_bounds(current_floor_ptr, y, x)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) continue; /* Skip occupied locations */ if (!monster_can_enter(y, x, r_ptr, 0)) continue; @@ -878,7 +878,7 @@ static bool find_hiding(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) */ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; POSITION y = 0, ay, x = 0, ax; int move_val = 0; @@ -887,17 +887,17 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) bool done = FALSE; bool will_run = mon_will_run(m_idx); grid_type *g_ptr; - bool no_flow = ((m_ptr->mflag2 & MFLAG2_NOFLOW) && (current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].cost > 2)); + bool no_flow = ((m_ptr->mflag2 & MFLAG2_NOFLOW) && (p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].cost > 2)); bool can_pass_wall = ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall)); /* Counter attack to an enemy monster */ if (!will_run && m_ptr->target_y) { - int t_m_idx = current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; + int t_m_idx = p_ptr->current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; /* The monster must be an enemy, and in LOS */ if (t_m_idx && - are_enemies(m_ptr, ¤t_floor_ptr->m_list[t_m_idx]) && + are_enemies(m_ptr, &p_ptr->current_floor_ptr->m_list[t_m_idx]) && los(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x) && projectable(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x)) { @@ -911,7 +911,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) if (!done && !will_run && is_hostile(m_ptr) && (r_ptr->flags1 & RF1_FRIENDS) && ((los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) || - (current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].dist < MAX_SIGHT / 2))) + (p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].dist < MAX_SIGHT / 2))) { /* * Animal packs try to get the player out of corridors @@ -930,7 +930,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) if (!in_bounds2(yy, xx)) continue; - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; /* Check grid */ if (monster_can_cross_terrain(g_ptr->feat, r_ptr, 0)) @@ -939,7 +939,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) room++; } } - if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_ROOM) room -= 2; + if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_ROOM) room -= 2; if (!r_ptr->flags4 && !r_ptr->a_ability_flags1 && !r_ptr->a_ability_flags2) room -= 2; /* Not in a room and strong player */ @@ -952,7 +952,7 @@ static bool get_moves(MONSTER_IDX m_idx, DIRECTION *mm) } /* Monster groups try to surround the player */ - if (!done && (current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].dist < 3)) + if (!done && (p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].dist < 3)) { int i; @@ -1241,7 +1241,7 @@ static bool check_hp_for_feat_destruction(feature_type *f_ptr, monster_type *m_p */ void process_monster(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; @@ -1283,7 +1283,7 @@ void process_monster(MONSTER_IDX m_idx) msg_print("地面に落とされた。"); #else GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0); + monster_desc(m_name, &p_ptr->current_floor_ptr->m_list[p_ptr->riding], 0); msg_format("You have fallen from %s.", m_name); #endif } @@ -1307,7 +1307,7 @@ void process_monster(MONSTER_IDX m_idx) } /* Are there its parent? */ - if (m_ptr->parent_m_idx && !current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx) + if (m_ptr->parent_m_idx && !p_ptr->current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx) { /* Its parent have gone, it also goes away. */ @@ -1490,7 +1490,7 @@ void process_monster(MONSTER_IDX m_idx) ox = m_ptr->fx; /* Attempt to "multiply" if able and allowed */ - if ((r_ptr->flags2 & RF2_MULTIPLY) && (current_floor_ptr->num_repro < MAX_REPRO)) + if ((r_ptr->flags2 & RF2_MULTIPLY) && (p_ptr->current_floor_ptr->num_repro < MAX_REPRO)) { int k; POSITION y, x; @@ -1502,7 +1502,7 @@ void process_monster(MONSTER_IDX m_idx) { /* Ignore locations off of edge */ if (!in_bounds2(y, x)) continue; - if (current_floor_ptr->grid_array[y][x].m_idx) k++; + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) k++; } } @@ -1515,7 +1515,7 @@ void process_monster(MONSTER_IDX m_idx) if (multiply_monster(m_idx, FALSE, (is_pet(m_ptr) ? PM_FORCE_PET : 0))) { /* Take note if visible */ - if (current_floor_ptr->m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(m_ptr)) + if (p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(m_ptr)) { r_ptr->r_flags2 |= (RF2_MULTIPLY); } @@ -1543,7 +1543,7 @@ void process_monster(MONSTER_IDX m_idx) { if (summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode))) { - if (current_floor_ptr->m_list[hack_m_idx_ii].ml) count++; + if (p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml) count++; } } @@ -1606,10 +1606,10 @@ void process_monster(MONSTER_IDX m_idx) /* Give priority to counter attack? */ if (m_ptr->target_y) { - MONSTER_IDX t_m_idx = current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; + MONSTER_IDX t_m_idx = p_ptr->current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; /* The monster must be an enemy, and projectable */ - if (t_m_idx && are_enemies(m_ptr, ¤t_floor_ptr->m_list[t_m_idx]) && + if (t_m_idx && are_enemies(m_ptr, &p_ptr->current_floor_ptr->m_list[t_m_idx]) && projectable(m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x)) { counterattack = TRUE; @@ -1780,12 +1780,12 @@ void process_monster(MONSTER_IDX m_idx) if (!in_bounds2(ny, nx)) continue; /* Access that grid */ - g_ptr = ¤t_floor_ptr->grid_array[ny][nx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx]; f_ptr = &f_info[g_ptr->feat]; can_cross = monster_can_cross_terrain(g_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0); /* Access that grid's contents */ - y_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + y_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- player 'in' wall */ if (player_bold(ny, nx)) @@ -2081,7 +2081,7 @@ void process_monster(MONSTER_IDX m_idx) else if ((r_ptr->flags2 & RF2_MOVE_BODY) && !(r_ptr->flags1 & RF1_NEVER_MOVE) && (r_ptr->mexp > z_ptr->mexp) && can_cross && (g_ptr->m_idx != p_ptr->riding) && - monster_can_cross_terrain(current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0)) + monster_can_cross_terrain(p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0)) { /* Allow movement */ do_move = TRUE; @@ -2098,7 +2098,7 @@ void process_monster(MONSTER_IDX m_idx) if (is_riding_mon) { - if (!p_ptr->riding_ryoute && !MON_MONFEAR(¤t_floor_ptr->m_list[p_ptr->riding])) do_move = FALSE; + if (!p_ptr->riding_ryoute && !MON_MONFEAR(&p_ptr->current_floor_ptr->m_list[p_ptr->riding])) do_move = FALSE; } if (did_kill_wall && do_move) @@ -2176,7 +2176,7 @@ void process_monster(MONSTER_IDX m_idx) if (!is_riding_mon) { /* Hack -- Update the old location */ - current_floor_ptr->grid_array[oy][ox].m_idx = g_ptr->m_idx; + p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = g_ptr->m_idx; /* Mega-Hack -- move the old monster, if any */ if (g_ptr->m_idx) @@ -2228,7 +2228,7 @@ void process_monster(MONSTER_IDX m_idx) { BIT_FLAGS flgs[TR_FLAG_SIZE], flg2 = 0L, flg3 = 0L, flgr = 0L; GAME_TEXT m_name[MAX_NLEN], o_name[MAX_NLEN]; - object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; if (do_take) @@ -2487,7 +2487,7 @@ void process_monsters(void) SPEED speed; /* Clear monster fighting indicator */ - current_floor_ptr->monster_noise = FALSE; + p_ptr->current_floor_ptr->monster_noise = FALSE; /* Memorize old race */ old_monster_race_idx = p_ptr->monster_race_idx; @@ -2519,9 +2519,9 @@ void process_monsters(void) /* Process the monsters (backwards) */ - for (i = current_floor_ptr->m_max - 1; i >= 1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) { - m_ptr = ¤t_floor_ptr->m_list[i]; + m_ptr = &p_ptr->current_floor_ptr->m_list[i]; r_ptr = &r_info[m_ptr->r_idx]; /* Handle "leaving" */ @@ -2573,14 +2573,14 @@ void process_monsters(void) test = TRUE; } -#if 0 /* (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].when == current_floor_ptr->grid_array[fy][fx].when) is always FALSE... */ +#if 0 /* (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].when == p_ptr->current_floor_ptr->grid_array[fy][fx].when) is always FALSE... */ /* Hack -- Monsters can "smell" the player from far away */ /* Note that most monsters have "aaf" of "20" or so */ else if (!(m_ptr->mflag2 & MFLAG2_NOFLOW) && cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_MOVE) && - (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].when == current_floor_ptr->grid_array[fy][fx].when) && - (current_floor_ptr->grid_array[fy][fx].dist < MONSTER_FLOW_DEPTH) && - (current_floor_ptr->grid_array[fy][fx].dist < r_ptr->aaf)) + (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].when == p_ptr->current_floor_ptr->grid_array[fy][fx].when) && + (p_ptr->current_floor_ptr->grid_array[fy][fx].dist < MONSTER_FLOW_DEPTH) && + (p_ptr->current_floor_ptr->grid_array[fy][fx].dist < r_ptr->aaf)) { /* We can "smell" the player */ test = TRUE; diff --git a/src/monster-status.c b/src/monster-status.c index e5c8fcb3d..a018ae59c 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -33,7 +33,7 @@ */ bool monster_is_powerful(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool powerful = r_ptr->flags2 & RF2_POWERFUL ? TRUE : FALSE; return powerful; @@ -46,7 +46,7 @@ bool monster_is_powerful(MONSTER_IDX m_idx) */ DEPTH monster_level_idx(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1); return rlev; @@ -139,7 +139,7 @@ static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr) s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside * 2); /* Special penalty in the wilderness */ - if (!current_floor_ptr->dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE))) + if (!p_ptr->current_floor_ptr->dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE))) s64b_mul(&div_h, &div_l, 0, 5); /* Do division first to prevent overflaw */ @@ -188,10 +188,10 @@ static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr) */ int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type) { - s16b *cur_mproc_list = current_floor_ptr->mproc_list[mproc_type]; + s16b *cur_mproc_list = p_ptr->current_floor_ptr->mproc_list[mproc_type]; int i; - for (i = current_floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--) + for (i = p_ptr->current_floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--) { if (cur_mproc_list[i] == m_idx) return i; } @@ -207,7 +207,7 @@ int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type) */ static void mproc_add(MONSTER_IDX m_idx, int mproc_type) { - if (current_floor_ptr->mproc_max[mproc_type] < current_floor_ptr->max_m_idx) current_floor_ptr->mproc_list[mproc_type][current_floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx; + if (p_ptr->current_floor_ptr->mproc_max[mproc_type] < current_world_ptr->max_m_idx) p_ptr->current_floor_ptr->mproc_list[mproc_type][p_ptr->current_floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx; } @@ -220,7 +220,7 @@ static void mproc_add(MONSTER_IDX m_idx, int mproc_type) static void mproc_remove(MONSTER_IDX m_idx, int mproc_type) { int mproc_idx = get_mproc_idx(m_idx, mproc_type); - if (mproc_idx >= 0) current_floor_ptr->mproc_list[mproc_type][mproc_idx] = current_floor_ptr->mproc_list[mproc_type][--current_floor_ptr->mproc_max[mproc_type]]; + if (mproc_idx >= 0) p_ptr->current_floor_ptr->mproc_list[mproc_type][mproc_idx] = p_ptr->current_floor_ptr->mproc_list[mproc_type][--p_ptr->current_floor_ptr->mproc_max[mproc_type]]; } @@ -234,13 +234,13 @@ void mproc_init(void) MONSTER_IDX i; int cmi; - /* Reset "current_floor_ptr->mproc_max[]" */ - for (cmi = 0; cmi < MAX_MTIMED; cmi++) current_floor_ptr->mproc_max[cmi] = 0; + /* Reset "p_ptr->current_floor_ptr->mproc_max[]" */ + for (cmi = 0; cmi < MAX_MTIMED; cmi++) p_ptr->current_floor_ptr->mproc_max[cmi] = 0; /* Process the monsters (backwards) */ - for (i = current_floor_ptr->m_max - 1; i >= 1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) { - m_ptr = ¤t_floor_ptr->m_list[i]; + m_ptr = &p_ptr->current_floor_ptr->m_list[i]; /* Ignore "dead" monsters */ if (!monster_is_valid(m_ptr)) continue; @@ -262,7 +262,7 @@ void mproc_init(void) */ bool set_monster_csleep(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; @@ -311,7 +311,7 @@ bool set_monster_csleep(MONSTER_IDX m_idx, int v) */ bool set_monster_fast(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -349,7 +349,7 @@ bool set_monster_fast(MONSTER_IDX m_idx, int v) */ bool set_monster_slow(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -391,7 +391,7 @@ bool set_monster_slow(MONSTER_IDX m_idx, int v) */ bool set_monster_stunned(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -429,7 +429,7 @@ bool set_monster_stunned(MONSTER_IDX m_idx, int v) */ bool set_monster_confused(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -467,7 +467,7 @@ bool set_monster_confused(MONSTER_IDX m_idx, int v) */ bool set_monster_monfear(MONSTER_IDX m_idx, int v) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -515,7 +515,7 @@ bool set_monster_monfear(MONSTER_IDX m_idx, int v) */ bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool notice = FALSE; v = (v > 200) ? 200 : (v < 0) ? 0 : v; @@ -564,7 +564,7 @@ static u32b csleep_noise; */ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; switch (mtimed_idx) { @@ -755,13 +755,13 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx) void process_monsters_mtimed(int mtimed_idx) { int i; - s16b *cur_mproc_list = current_floor_ptr->mproc_list[mtimed_idx]; + s16b *cur_mproc_list = p_ptr->current_floor_ptr->mproc_list[mtimed_idx]; /* Hack -- calculate the "player noise" */ if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - p_ptr->skill_stl)); /* Process the monsters (backwards) */ - for (i = current_floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--) + for (i = p_ptr->current_floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--) { process_monsters_mtimed_aux(cur_mproc_list[i], mtimed_idx); } @@ -774,7 +774,7 @@ void process_monsters_mtimed(int mtimed_idx) */ void dispel_monster_status(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; GAME_TEXT m_name[MAX_NLEN]; monster_desc(m_name, m_ptr, 0); @@ -801,7 +801,7 @@ void dispel_monster_status(MONSTER_IDX m_idx) */ bool set_monster_timewalk(int num, MONSTER_IDX who, bool vs_player) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[hack_m_idx]; /* the world monster */ + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[hack_m_idx]; /* the world monster */ if (current_world_ptr->timewalk_m_idx) return (FALSE); @@ -863,7 +863,7 @@ void monster_gain_exp(MONSTER_IDX m_idx, MONRACE_IDX s_idx) int new_exp; if (m_idx <= 0 || s_idx <= 0) return; - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if (!monster_is_valid(m_ptr)) return; @@ -876,7 +876,7 @@ void monster_gain_exp(MONSTER_IDX m_idx, MONRACE_IDX s_idx) new_exp = s_ptr->mexp * s_ptr->level / (r_ptr->level + 2); if (m_idx == p_ptr->riding) new_exp = (new_exp + 1) / 2; - if (!current_floor_ptr->dun_level) new_exp /= 5; + if (!p_ptr->current_floor_ptr->dun_level) new_exp /= 5; m_ptr->exp += new_exp; if (m_ptr->mflag2 & MFLAG2_CHAMELEON) return; @@ -996,7 +996,7 @@ void monster_gain_exp(MONSTER_IDX m_idx, MONRACE_IDX s_idx) */ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_type exp_mon; @@ -1145,13 +1145,13 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note) if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER)) { - if (!current_floor_ptr->dun_level && !p_ptr->ambush_flag && !p_ptr->inside_arena) + if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->ambush_flag && !p_ptr->inside_arena) { chg_virtue(p_ptr, V_VALOUR, -1); } - else if (r_ptr->level > current_floor_ptr->dun_level) + else if (r_ptr->level > p_ptr->current_floor_ptr->dun_level) { - if (randint1(10) <= (r_ptr->level - current_floor_ptr->dun_level)) + if (randint1(10) <= (r_ptr->level - p_ptr->current_floor_ptr->dun_level)) chg_virtue(p_ptr, V_VALOUR, 1); } if (r_ptr->level > 60) @@ -1180,14 +1180,14 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note) chg_virtue(p_ptr, V_COMPASSION, -1); } - if ((r_ptr->flags3 & RF3_GOOD) && ((r_ptr->level) / 10 + (3 * current_floor_ptr->dun_level) >= randint1(100))) + if ((r_ptr->flags3 & RF3_GOOD) && ((r_ptr->level) / 10 + (3 * p_ptr->current_floor_ptr->dun_level) >= randint1(100))) chg_virtue(p_ptr, V_UNLIFE, 1); if (r_ptr->d_char == 'A') { if (r_ptr->flags1 & RF1_UNIQUE) chg_virtue(p_ptr, V_FAITH, -2); - else if ((r_ptr->level) / 10 + (3 * current_floor_ptr->dun_level) >= randint1(100)) + else if ((r_ptr->level) / 10 + (3 * p_ptr->current_floor_ptr->dun_level) >= randint1(100)) { if (r_ptr->flags3 & RF3_GOOD) chg_virtue(p_ptr, V_FAITH, -1); else chg_virtue(p_ptr, V_FAITH, 1); @@ -1197,7 +1197,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note) { if (r_ptr->flags1 & RF1_UNIQUE) chg_virtue(p_ptr, V_FAITH, 2); - else if ((r_ptr->level) / 10 + (3 * current_floor_ptr->dun_level) >= randint1(100)) + else if ((r_ptr->level) / 10 + (3 * p_ptr->current_floor_ptr->dun_level) >= randint1(100)) chg_virtue(p_ptr, V_FAITH, 1); } @@ -1210,7 +1210,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note) { chg_virtue(p_ptr, V_HONOUR, 10); } - else if ((r_ptr->level) / 10 + (2 * current_floor_ptr->dun_level) >= randint1(100)) + else if ((r_ptr->level) / 10 + (2 * p_ptr->current_floor_ptr->dun_level) >= randint1(100)) { chg_virtue(p_ptr, V_HONOUR, 1); } @@ -1237,7 +1237,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note) { if (r_ptr->flags1 & RF1_UNIQUE) chg_virtue(p_ptr, V_JUSTICE, 3); - else if (1 + ((r_ptr->level) / 10 + (2 * current_floor_ptr->dun_level)) >= randint1(100)) + else if (1 + ((r_ptr->level) / 10 + (2 * p_ptr->current_floor_ptr->dun_level)) >= randint1(100)) chg_virtue(p_ptr, V_JUSTICE, 1); } else if (innocent) diff --git a/src/monster.h b/src/monster.h index adb32d5eb..a17f94e66 100644 --- a/src/monster.h +++ b/src/monster.h @@ -512,7 +512,7 @@ extern void monster_drop_carried_objects(monster_type *m_ptr); (bool)(((A)->smart & SM_FRIENDLY) ? TRUE : FALSE) #define is_friendly_idx(MONSTER_IDX) \ - (bool)((MONSTER_IDX) > 0 && is_friendly(¤t_floor_ptr->m_list[(MONSTER_IDX)])) + (bool)((MONSTER_IDX) > 0 && is_friendly(&p_ptr->current_floor_ptr->m_list[(MONSTER_IDX)])) #define is_pet(A) \ (bool)(((A)->smart & SM_PET) ? TRUE : FALSE) diff --git a/src/monster1.c b/src/monster1.c index 90996b605..8b1cbe9f9 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -2132,7 +2132,7 @@ void output_monster_spoiler(MONRACE_IDX r_idx, void (*roff_func)(TERM_COLOR attr */ monsterrace_hook_type get_monster_hook(void) { - if (!current_floor_ptr->dun_level && !p_ptr->inside_quest) + if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->inside_quest) { switch (wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].terrain) { @@ -2171,7 +2171,7 @@ monsterrace_hook_type get_monster_hook(void) */ monsterrace_hook_type get_monster_hook2(POSITION y, POSITION x) { - feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[y][x].feat]; + feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat]; /* Set the monster list */ @@ -2362,7 +2362,7 @@ bool monster_can_cross_terrain(FEAT_IDX feat, monster_race *r_ptr, BIT_FLAGS16 m */ bool monster_can_enter(POSITION y, POSITION x, monster_race *r_ptr, BIT_FLAGS16 mode) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Player or other monster */ if (player_bold(y, x)) return FALSE; @@ -2523,7 +2523,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) int dump_gold = 0; int number = 0; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE)); @@ -2605,7 +2605,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Prepare to make a prize */ object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval)); - apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART); + apply_magic(q_ptr, p_ptr->current_floor_ptr->object_level, AM_NO_FIXED_ART); (void)drop_near(q_ptr, -1, y, x); } @@ -2664,7 +2664,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Prepare to make an object */ object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON))); - apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART); + apply_magic(q_ptr, p_ptr->current_floor_ptr->object_level, AM_NO_FIXED_ART); q_ptr->pval = m_ptr->r_idx; (void)drop_near(q_ptr, -1, y, x); @@ -2711,19 +2711,19 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Prepare to make a Blade of Chaos */ object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS)); - apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART | mo_mode); + apply_magic(q_ptr, p_ptr->current_floor_ptr->object_level, AM_NO_FIXED_ART | mo_mode); (void)drop_near(q_ptr, -1, y, x); } break; case MON_RAAL: - if (drop_chosen_item && (current_floor_ptr->dun_level > 9)) + if (drop_chosen_item && (p_ptr->current_floor_ptr->dun_level > 9)) { q_ptr = &forge; object_wipe(q_ptr); /* Activate restriction */ - if ((current_floor_ptr->dun_level > 49) && one_in_(5)) + if ((p_ptr->current_floor_ptr->dun_level > 49) && one_in_(5)) get_obj_num_hook = kind_is_good_book; else get_obj_num_hook = kind_is_book; @@ -2750,7 +2750,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) do { scatter(&wy, &wx, y, x, 20, 0); - } while (!(in_bounds(current_floor_ptr, wy, wx) && cave_empty_bold2(wy, wx)) && --attempts); + } while (!(in_bounds(p_ptr->current_floor_ptr, wy, wx) && cave_empty_bold2(wy, wx)) && --attempts); if (attempts > 0) { @@ -2862,7 +2862,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Prepare to make a Can of Toys */ object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME)); - apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART); + apply_magic(q_ptr, p_ptr->current_floor_ptr->object_level, AM_NO_FIXED_ART); (void)drop_near(q_ptr, -1, y, x); } break; @@ -2880,7 +2880,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) switch (r_ptr->d_char) { case '(': - if (current_floor_ptr->dun_level > 0) + if (p_ptr->current_floor_ptr->dun_level > 0) { q_ptr = &forge; object_wipe(q_ptr); @@ -2895,7 +2895,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) break; case '/': - if (current_floor_ptr->dun_level > 4) + if (p_ptr->current_floor_ptr->dun_level > 4) { q_ptr = &forge; object_wipe(q_ptr); @@ -2910,7 +2910,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) break; case '[': - if (current_floor_ptr->dun_level > 19) + if (p_ptr->current_floor_ptr->dun_level > 19) { q_ptr = &forge; object_wipe(q_ptr); @@ -2925,7 +2925,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) break; case '\\': - if (current_floor_ptr->dun_level > 4) + if (p_ptr->current_floor_ptr->dun_level > 4) { q_ptr = &forge; object_wipe(q_ptr); @@ -3020,7 +3020,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Prepare to make a reward */ object_prep(q_ptr, k_idx); - apply_magic(q_ptr, current_floor_ptr->object_level, AM_NO_FIXED_ART | AM_GOOD); + apply_magic(q_ptr, p_ptr->current_floor_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[p_ptr->dungeon_idx].name); @@ -3049,7 +3049,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) coin_type = force_coin; /* Average dungeon and monster levels */ - current_floor_ptr->object_level = (current_floor_ptr->dun_level + r_ptr->level) / 2; + p_ptr->current_floor_ptr->object_level = (p_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2; /* Drop some objects */ for (j = 0; j < number; j++) @@ -3071,7 +3071,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) } /* Reset the object level */ - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; /* Reset "coin" type */ coin_type = 0; diff --git a/src/monster2.c b/src/monster2.c index f1ef5c8c1..8dd262942 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -114,7 +114,7 @@ MONRACE_IDX real_r_idx(monster_type *m_ptr) void delete_monster_idx(MONSTER_IDX i) { POSITION x, y; - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -125,7 +125,7 @@ void delete_monster_idx(MONSTER_IDX i) real_r_ptr(m_ptr)->cur_num--; /* Hack -- count the number of "reproducers" */ - if (r_ptr->flags2 & (RF2_MULTIPLY)) current_floor_ptr->num_repro--; + if (r_ptr->flags2 & (RF2_MULTIPLY)) p_ptr->current_floor_ptr->num_repro--; if (MON_CSLEEP(m_ptr)) (void)set_monster_csleep(i, 0); if (MON_FAST(m_ptr)) (void)set_monster_fast(i, 0); @@ -146,12 +146,12 @@ void delete_monster_idx(MONSTER_IDX i) if (p_ptr->riding == i) p_ptr->riding = 0; /* Monster is gone */ - current_floor_ptr->grid_array[y][x].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[y][x].m_idx = 0; for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* @@ -165,7 +165,7 @@ void delete_monster_idx(MONSTER_IDX i) (void)WIPE(m_ptr, monster_type); /* Count monsters */ - current_floor_ptr->m_cnt--; + p_ptr->current_floor_ptr->m_cnt--; lite_spot(y, x); if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) @@ -184,10 +184,10 @@ void delete_monster_idx(MONSTER_IDX i) void delete_monster(POSITION y, POSITION x) { grid_type *g_ptr; - if (!in_bounds(current_floor_ptr, y, x)) return; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; /* Check the grid */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Delete the monster (if any) */ if (g_ptr->m_idx) delete_monster_idx(g_ptr->m_idx); @@ -212,22 +212,22 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2) if (i1 == i2) return; /* Old monster */ - m_ptr = ¤t_floor_ptr->m_list[i1]; + m_ptr = &p_ptr->current_floor_ptr->m_list[i1]; y = m_ptr->fy; x = m_ptr->fx; /* Cave grid */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; - /* Update the current_floor_ptr->grid_array */ + /* Update the p_ptr->current_floor_ptr->grid_array */ g_ptr->m_idx = i2; /* Repair objects being carried by monster */ for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Reset monster pointer */ @@ -250,9 +250,9 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2) /* Hack -- Update parent index */ if (is_pet(m_ptr)) { - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m2_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m2_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (m2_ptr->parent_m_idx == i1) m2_ptr->parent_m_idx = i2; @@ -260,15 +260,15 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2) } /* Structure copy */ - (void)COPY(¤t_floor_ptr->m_list[i2], ¤t_floor_ptr->m_list[i1], monster_type); + (void)COPY(&p_ptr->current_floor_ptr->m_list[i2], &p_ptr->current_floor_ptr->m_list[i1], monster_type); /* Wipe the hole */ - (void)WIPE(¤t_floor_ptr->m_list[i1], monster_type); + (void)WIPE(&p_ptr->current_floor_ptr->m_list[i1], monster_type); for (i = 0; i < MAX_MTIMED; i++) { int mproc_idx = get_mproc_idx(i1, i); - if (mproc_idx >= 0) current_floor_ptr->mproc_list[i][mproc_idx] = i2; + if (mproc_idx >= 0) p_ptr->current_floor_ptr->mproc_list[i][mproc_idx] = i2; } } @@ -307,9 +307,9 @@ void compact_monsters(int size) cur_dis = 5 * (20 - cnt); /* Check all the monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -352,19 +352,19 @@ void compact_monsters(int size) /* Excise dead monsters (backwards!) */ - for (i = current_floor_ptr->m_max - 1; i >= 1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) { /* Get the i'th monster */ - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; /* Skip real monsters */ if (m_ptr->r_idx) continue; /* Move last monster into open hole */ - compact_monsters_aux(current_floor_ptr->m_max - 1, i); + compact_monsters_aux(p_ptr->current_floor_ptr->m_max - 1, i); - /* Compress "current_floor_ptr->m_max" */ - current_floor_ptr->m_max--; + /* Compress "p_ptr->current_floor_ptr->m_max" */ + p_ptr->current_floor_ptr->m_max--; } } @@ -400,13 +400,13 @@ void wipe_m_list(void) } /* Delete all the monsters */ - for (i = current_floor_ptr->m_max - 1; i >= 1; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; /* Monster is gone */ - current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].m_idx = 0; (void)WIPE(m_ptr, monster_type); @@ -421,17 +421,17 @@ void wipe_m_list(void) /* Hack -- Wipe the racial counter of all monster races */ for (i = 1; i < max_r_idx; i++) r_info[i].cur_num = 0; - /* Reset "current_floor_ptr->m_max" */ - current_floor_ptr->m_max = 1; + /* Reset "p_ptr->current_floor_ptr->m_max" */ + p_ptr->current_floor_ptr->m_max = 1; - /* Reset "current_floor_ptr->m_cnt" */ - current_floor_ptr->m_cnt = 0; + /* Reset "p_ptr->current_floor_ptr->m_cnt" */ + p_ptr->current_floor_ptr->m_cnt = 0; - /* Reset "current_floor_ptr->mproc_max[]" */ - for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0; + /* Reset "p_ptr->current_floor_ptr->mproc_max[]" */ + for (i = 0; i < MAX_MTIMED; i++) p_ptr->current_floor_ptr->mproc_max[i] = 0; /* Hack -- reset "reproducer" count */ - current_floor_ptr->num_repro = 0; + p_ptr->current_floor_ptr->num_repro = 0; /* Hack -- no more target */ target_who = 0; @@ -454,32 +454,32 @@ MONSTER_IDX m_pop(void) MONSTER_IDX i; /* Normal allocation */ - if (current_floor_ptr->m_max < current_floor_ptr->max_m_idx) + if (p_ptr->current_floor_ptr->m_max < current_world_ptr->max_m_idx) { /* Access the next hole */ - i = current_floor_ptr->m_max; + i = p_ptr->current_floor_ptr->m_max; /* Expand the array */ - current_floor_ptr->m_max++; + p_ptr->current_floor_ptr->m_max++; /* Count monsters */ - current_floor_ptr->m_cnt++; + p_ptr->current_floor_ptr->m_cnt++; /* Return the index */ return (i); } /* Recycle dead monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { monster_type *m_ptr; - m_ptr = ¤t_floor_ptr->m_list[i]; + m_ptr = &p_ptr->current_floor_ptr->m_list[i]; /* Skip live monsters */ if (m_ptr->r_idx) continue; /* Count monsters */ - current_floor_ptr->m_cnt++; + p_ptr->current_floor_ptr->m_cnt++; /* Use this monster */ return (i); @@ -867,7 +867,7 @@ static bool restrict_monster_to_dungeon(DUNGEON_IDX d_idx, MONRACE_IDX r_idx) } if (d_ptr->flags1 & DF1_BEGINNER) { - if (r_ptr->level > current_floor_ptr->dun_level) + if (r_ptr->level > p_ptr->current_floor_ptr->dun_level) return FALSE; } @@ -1075,14 +1075,14 @@ errr get_mon_num_prep(monsterrace_hook_type monster_hook, /* Depth Monsters never appear out of depth */ if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && - (r_ptr->level > current_floor_ptr->dun_level)) + (r_ptr->level > p_ptr->current_floor_ptr->dun_level)) continue; } /* Accept this monster */ entry->prob2 = entry->prob1; - if (current_floor_ptr->dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && + if (p_ptr->current_floor_ptr->dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && !restrict_monster_to_dungeon(p_ptr->dungeon_idx, entry->index) && !p_ptr->phase_out) { int hoge = entry->prob2 * d_info[p_ptr->dungeon_idx].special_div; @@ -1536,7 +1536,7 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode) /* Inside monster arena, and it is not your mount */ else if (p_ptr->phase_out && - !(p_ptr->riding && (¤t_floor_ptr->m_list[p_ptr->riding] == m_ptr))) + !(p_ptr->riding && (&p_ptr->current_floor_ptr->m_list[p_ptr->riding] == m_ptr))) { /* It is a fake unique monster */ (void)sprintf(desc, _("%sもどき", "fake %s"), name); @@ -1581,7 +1581,7 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode) strcat(desc,buf); } - if (p_ptr->riding && (¤t_floor_ptr->m_list[p_ptr->riding] == m_ptr)) + if (p_ptr->riding && (&p_ptr->current_floor_ptr->m_list[p_ptr->riding] == m_ptr)) { strcat(desc,_("(乗馬中)", "(riding)")); } @@ -1621,7 +1621,7 @@ void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode) */ void monster_name(MONSTER_IDX m_idx, char* m_name) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_desc(m_name, m_ptr, 0x00); } @@ -1752,7 +1752,7 @@ int lore_do_probe(MONRACE_IDX r_idx) */ void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -1839,7 +1839,7 @@ void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold */ void update_monster(MONSTER_IDX m_idx, bool full) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool do_disturb = disturb_move; @@ -2215,9 +2215,9 @@ void update_monsters(bool full) MONSTER_IDX i; /* Update each (live) monster */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; update_monster(i, full); } @@ -2232,7 +2232,7 @@ void update_monsters(bool full) static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[chameleon_change_m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[chameleon_change_m_idx]; monster_race *old_r_ptr = &r_info[m_ptr->r_idx]; if (!(r_ptr->flags1 & (RF1_UNIQUE))) return FALSE; @@ -2243,7 +2243,7 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx) if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE)) return FALSE; - if (!monster_can_cross_terrain(current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; + if (!monster_can_cross_terrain(p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; /* Not born */ if (!(old_r_ptr->flags7 & RF7_CHAMELEON)) @@ -2254,7 +2254,7 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx) /* Born now */ else if (summon_specific_who > 0) { - if (monster_has_hostile_align(¤t_floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; + if (monster_has_hostile_align(&p_ptr->current_floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; } return TRUE; @@ -2269,7 +2269,7 @@ static bool monster_hook_chameleon_lord(MONRACE_IDX r_idx) static bool monster_hook_chameleon(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[chameleon_change_m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[chameleon_change_m_idx]; monster_race *old_r_ptr = &r_info[m_ptr->r_idx]; if (r_ptr->flags1 & (RF1_UNIQUE)) return FALSE; @@ -2279,7 +2279,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx) if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE)) return FALSE; - if (!monster_can_cross_terrain(current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; + if (!monster_can_cross_terrain(p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; /* Not born */ if (!(old_r_ptr->flags7 & RF7_CHAMELEON)) @@ -2292,7 +2292,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx) /* Born now */ else if (summon_specific_who > 0) { - if (monster_has_hostile_align(¤t_floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; + if (monster_has_hostile_align(&p_ptr->current_floor_ptr->m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; } return (*(get_monster_hook()))(r_idx); @@ -2308,7 +2308,7 @@ static bool monster_hook_chameleon(MONRACE_IDX r_idx) void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx) { int oldmaxhp; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr; char old_m_name[MAX_NLEN]; bool old_unique = FALSE; @@ -2333,10 +2333,10 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx) if (old_unique) level = r_info[MON_CHAMELEON_K].level; - else if (!current_floor_ptr->dun_level) + else if (!p_ptr->current_floor_ptr->dun_level) level = wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level; else - level = current_floor_ptr->dun_level; + level = p_ptr->current_floor_ptr->dun_level; if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CHAMELEON) level+= 2+randint1(3); @@ -2438,11 +2438,11 @@ static MONRACE_IDX initial_r_appearance(MONRACE_IDX r_idx, BIT_FLAGS generate_mo { int attempts = 1000; MONRACE_IDX ap_r_idx; - DEPTH min = MIN(current_floor_ptr->base_level - 5, 50); + DEPTH min = MIN(p_ptr->current_floor_ptr->base_level - 5, 50); if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN && !(generate_mode & (PM_MULTIPLY | PM_KAGE))) { - if (current_floor_ptr->base_level == 0 || + if (p_ptr->current_floor_ptr->base_level == 0 || (one_in_(5) && my_strchr("hkoptuyAHOPTUVY", r_info[r_idx].d_char))) return MON_ALIEN_JURAL; } @@ -2453,7 +2453,7 @@ static MONRACE_IDX initial_r_appearance(MONRACE_IDX r_idx, BIT_FLAGS generate_mo while (--attempts) { - ap_r_idx = get_mon_num(current_floor_ptr->base_level + 10); + ap_r_idx = get_mon_num(p_ptr->current_floor_ptr->base_level + 10); if (r_info[ap_r_idx].level >= min) return ap_r_idx; } @@ -2512,7 +2512,7 @@ SPEED get_mspeed(monster_race *r_ptr) */ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; monster_type *m_ptr; monster_race *r_ptr = &r_info[r_idx]; concptr name = (r_name + r_ptr->name); @@ -2522,7 +2522,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I /* DO NOT PLACE A MONSTER IN THE SMALL SCALE WILDERNESS !!! */ if (p_ptr->wild_mode) return FALSE; - if (!in_bounds(current_floor_ptr, y, x)) return (FALSE); + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return (FALSE); if (!r_idx) return (FALSE); if (!r_ptr->name) return (FALSE); @@ -2559,7 +2559,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I } /* Depth monsters may NOT be created out of depth, unless in Nightmare mode */ - if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (current_floor_ptr->dun_level < r_ptr->level) && + if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (p_ptr->current_floor_ptr->dun_level < r_ptr->level) && (!ironman_nightmare || (r_ptr->flags1 & (RF1_QUESTOR)))) { /* Cannot create */ @@ -2567,9 +2567,9 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I } } - if (quest_number(current_floor_ptr->dun_level)) + if (quest_number(p_ptr->current_floor_ptr->dun_level)) { - int hoge = quest_number(current_floor_ptr->dun_level); + int hoge = quest_number(p_ptr->current_floor_ptr->dun_level); if ((quest[hoge].type == QUEST_TYPE_KILL_LEVEL) || (quest[hoge].type == QUEST_TYPE_RANDOM)) { if(r_idx == quest[hoge].r_idx) @@ -2578,10 +2578,10 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I number_mon = 0; /* Count all quest monsters */ - for (i2 = 0; i2 < current_floor_ptr->width; ++i2) - for (j2 = 0; j2 < current_floor_ptr->height; j2++) - if (current_floor_ptr->grid_array[j2][i2].m_idx > 0) - if (current_floor_ptr->m_list[current_floor_ptr->grid_array[j2][i2].m_idx].r_idx == quest[hoge].r_idx) + for (i2 = 0; i2 < p_ptr->current_floor_ptr->width; ++i2) + for (j2 = 0; j2 < p_ptr->current_floor_ptr->height; j2++) + if (p_ptr->current_floor_ptr->grid_array[j2][i2].m_idx > 0) + if (p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[j2][i2].m_idx].r_idx == quest[hoge].r_idx) number_mon++; if(number_mon + quest[hoge].cur_num >= quest[hoge].max_num) return FALSE; @@ -2624,7 +2624,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I /* Get a new monster record */ - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Save the race */ m_ptr->r_idx = r_idx; @@ -2635,17 +2635,17 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I m_ptr->mflag2 = 0; /* Hack -- Appearance transfer */ - if ((mode & PM_MULTIPLY) && (who > 0) && !is_original_ap(¤t_floor_ptr->m_list[who])) + if ((mode & PM_MULTIPLY) && (who > 0) && !is_original_ap(&p_ptr->current_floor_ptr->m_list[who])) { - m_ptr->ap_r_idx = current_floor_ptr->m_list[who].ap_r_idx; + m_ptr->ap_r_idx = p_ptr->current_floor_ptr->m_list[who].ap_r_idx; /* Hack -- Shadower spawns Shadower */ - if (current_floor_ptr->m_list[who].mflag2 & MFLAG2_KAGE) m_ptr->mflag2 |= MFLAG2_KAGE; + if (p_ptr->current_floor_ptr->m_list[who].mflag2 & MFLAG2_KAGE) m_ptr->mflag2 |= MFLAG2_KAGE; } /* Sub-alignment of a monster */ if ((who > 0) && !(r_ptr->flags3 & (RF3_EVIL | RF3_GOOD))) - m_ptr->sub_align = current_floor_ptr->m_list[who].sub_align; + m_ptr->sub_align = p_ptr->current_floor_ptr->m_list[who].sub_align; else { m_ptr->sub_align = SUB_ALIGN_NEUTRAL; @@ -2672,7 +2672,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I /* Your pet summons its pet. */ - if (who > 0 && is_pet(¤t_floor_ptr->m_list[who])) + if (who > 0 && is_pet(&p_ptr->current_floor_ptr->m_list[who])) { mode |= PM_FORCE_PET; m_ptr->parent_m_idx = who; @@ -2808,7 +2808,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I real_r_ptr(m_ptr)->floor_id = p_ptr->floor_id; /* Hack -- Count the number of "reproducers" */ - if (r_ptr->flags2 & RF2_MULTIPLY) current_floor_ptr->num_repro++; + if (r_ptr->flags2 & RF2_MULTIPLY) p_ptr->current_floor_ptr->num_repro++; if (p_ptr->warning && current_world_ptr->character_dungeon) { @@ -2910,7 +2910,7 @@ static bool mon_scatter(MONRACE_IDX r_idx, POSITION *yp, POSITION *xp, POSITION for (ny = y - max_dist; ny <= y + max_dist; ny++) { /* Ignore annoying locations */ - if (!in_bounds(current_floor_ptr, ny, nx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue; /* Require "line of projection" */ if (!projectable(y, x, ny, nx)) continue; @@ -2986,16 +2986,16 @@ static bool place_monster_group(MONSTER_IDX who, POSITION y, POSITION x, MONRACE total = randint1(10); /* Hard monsters, small groups */ - if (r_ptr->level > current_floor_ptr->dun_level) + if (r_ptr->level > p_ptr->current_floor_ptr->dun_level) { - extra = r_ptr->level - current_floor_ptr->dun_level; + extra = r_ptr->level - p_ptr->current_floor_ptr->dun_level; extra = 0 - randint1(extra); } /* Easy monsters, large groups */ - else if (r_ptr->level < current_floor_ptr->dun_level) + else if (r_ptr->level < p_ptr->current_floor_ptr->dun_level) { - extra = current_floor_ptr->dun_level - r_ptr->level; + extra = p_ptr->current_floor_ptr->dun_level - r_ptr->level; extra = randint1(extra); } @@ -3072,7 +3072,7 @@ static MONSTER_IDX place_monster_m_idx = 0; static bool place_monster_can_escort(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[place_monster_idx]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[place_monster_m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[place_monster_m_idx]; monster_race *z_ptr = &r_info[r_idx]; @@ -3221,7 +3221,7 @@ bool place_monster(POSITION y, POSITION x, BIT_FLAGS mode) get_mon_num_prep(get_monster_hook(), get_monster_hook2(y, x)); /* Pick a monster */ - r_idx = get_mon_num(current_floor_ptr->monster_level); + r_idx = get_mon_num(p_ptr->current_floor_ptr->monster_level); /* Handle failure */ if (!r_idx) return (FALSE); @@ -3251,7 +3251,7 @@ bool alloc_horde(POSITION y, POSITION x) while (--attempts) { /* Pick a monster */ - r_idx = get_mon_num(current_floor_ptr->monster_level); + r_idx = get_mon_num(p_ptr->current_floor_ptr->monster_level); /* Handle failure */ if (!r_idx) return (FALSE); @@ -3275,15 +3275,15 @@ bool alloc_horde(POSITION y, POSITION x) if (attempts < 1) return FALSE; - m_idx = current_floor_ptr->grid_array[y][x].m_idx; + m_idx = p_ptr->current_floor_ptr->grid_array[y][x].m_idx; - if (current_floor_ptr->m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[current_floor_ptr->m_list[m_idx].r_idx]; + if (p_ptr->current_floor_ptr->m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[p_ptr->current_floor_ptr->m_list[m_idx].r_idx]; for (attempts = randint1(10) + 5; attempts; attempts--) { scatter(&cy, &cx, y, x, 5, 0); - (void)summon_specific(m_idx, cy, cx, current_floor_ptr->dun_level + 5, SUMMON_KIN, PM_ALLOW_GROUP); + (void)summon_specific(m_idx, cy, cx, p_ptr->current_floor_ptr->dun_level + 5, SUMMON_KIN, PM_ALLOW_GROUP); y = cy; x = cx; @@ -3302,7 +3302,7 @@ bool alloc_guardian(bool def_val) { MONRACE_IDX guardian = d_info[p_ptr->dungeon_idx].final_guardian; - if (guardian && (d_info[p_ptr->dungeon_idx].maxdepth == current_floor_ptr->dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num)) + if (guardian && (d_info[p_ptr->dungeon_idx].maxdepth == p_ptr->current_floor_ptr->dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num)) { POSITION oy; POSITION ox; @@ -3312,11 +3312,11 @@ bool alloc_guardian(bool def_val) while (try_count) { /* Get a random spot */ - oy = randint1(current_floor_ptr->height - 4) + 2; - ox = randint1(current_floor_ptr->width - 4) + 2; + oy = randint1(p_ptr->current_floor_ptr->height - 4) + 2; + ox = randint1(p_ptr->current_floor_ptr->width - 4) + 2; /* Is it a good spot ? */ - if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(current_floor_ptr->grid_array[oy][ox].feat, &r_info[guardian], 0)) + if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(p_ptr->current_floor_ptr->grid_array[oy][ox].feat, &r_info[guardian], 0)) { /* Place the guardian */ if (place_monster_aux(0, oy, ox, guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) return TRUE; @@ -3341,7 +3341,7 @@ bool alloc_guardian(bool def_val) * @details * Place the monster at least "dis" distance from the player. * Use "slp" to choose the initial "sleep" status - * Use "current_floor_ptr->monster_level" for the monster level + * Use "p_ptr->current_floor_ptr->monster_level" for the monster level */ bool alloc_monster(POSITION dis, BIT_FLAGS mode) { @@ -3355,11 +3355,11 @@ bool alloc_monster(POSITION dis, BIT_FLAGS mode) while (attempts_left--) { /* Pick a location */ - y = randint0(current_floor_ptr->height); - x = randint0(current_floor_ptr->width); + y = randint0(p_ptr->current_floor_ptr->height); + x = randint0(p_ptr->current_floor_ptr->width); /* Require empty floor grid (was "naked") */ - if (current_floor_ptr->dun_level) + if (p_ptr->current_floor_ptr->dun_level) { if (!cave_empty_bold2(y, x)) continue; } @@ -3383,7 +3383,7 @@ bool alloc_monster(POSITION dis, BIT_FLAGS mode) } - if (randint1(5000) <= current_floor_ptr->dun_level) + if (randint1(5000) <= p_ptr->current_floor_ptr->dun_level) { if (alloc_horde(y, x)) { @@ -3408,7 +3408,7 @@ bool alloc_monster(POSITION dis, BIT_FLAGS mode) static bool summon_specific_okay(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[summon_specific_who]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[summon_specific_who]; /* Hack - Only summon dungeon monsters */ if (!mon_hook_dungeon(r_idx)) return (FALSE); @@ -3498,7 +3498,7 @@ bool summon_specific(MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, int t get_mon_num_prep(summon_specific_okay, get_monster_hook2(y, x)); /* Pick a monster, using the level calculation */ - r_idx = get_mon_num((current_floor_ptr->dun_level + lev) / 2 + 5); + r_idx = get_mon_num((p_ptr->current_floor_ptr->dun_level + lev) / 2 + 5); /* Handle failure */ if (!r_idx) @@ -3560,7 +3560,7 @@ bool summon_named_creature(MONSTER_IDX who, POSITION oy, POSITION ox, MONRACE_ID */ bool multiply_monster(MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; POSITION y, x; if (!mon_scatter(m_ptr->r_idx, &y, &x, m_ptr->fy, m_ptr->fx, 1)) @@ -3575,8 +3575,8 @@ bool multiply_monster(MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode) /* Hack -- Transfer "clone" flag */ if (clone || (m_ptr->smart & SM_CLONED)) { - current_floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED; - current_floor_ptr->m_list[hack_m_idx_ii].mflag2 |= MFLAG2_NOPET; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].mflag2 |= MFLAG2_NOPET; } return TRUE; @@ -3598,7 +3598,7 @@ void message_pain(MONSTER_IDX m_idx, HIT_POINT dam) HIT_POINT tmp; PERCENTAGE percentage; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -3922,7 +3922,7 @@ void message_pain(MONSTER_IDX m_idx, HIT_POINT dam) */ void update_smart_learn(MONSTER_IDX m_idx, int what) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Not allowed to learn */ @@ -4042,7 +4042,7 @@ void monster_drop_carried_objects(monster_type *m_ptr) /* Drop objects being carried */ for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; q_ptr = &forge; @@ -4069,7 +4069,7 @@ void monster_drop_carried_objects(monster_type *m_ptr) */ int get_monster_crowd_number(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; POSITION my = m_ptr->fy; POSITION mx = m_ptr->fx; int i; @@ -4080,10 +4080,10 @@ int get_monster_crowd_number(MONSTER_IDX m_idx) int ay = my + ddy_ddd[i]; int ax = mx + ddx_ddd[i]; - if (!in_bounds(current_floor_ptr, ay, ax)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, ay, ax)) continue; /* Count number of monsters */ - if (current_floor_ptr->grid_array[ay][ax].m_idx > 0) count++; + if (p_ptr->current_floor_ptr->grid_array[ay][ax].m_idx > 0) count++; } return count; diff --git a/src/monsterrace-hook.c b/src/monsterrace-hook.c index 743eeb00a..a5a90252f 100644 --- a/src/monsterrace-hook.c +++ b/src/monsterrace-hook.c @@ -29,7 +29,7 @@ void vault_prep_clone(void) get_mon_num_prep(vault_aux_simple, NULL); /* Pick a race to clone */ - vault_aux_race = get_mon_num(current_floor_ptr->dun_level + 10); + vault_aux_race = get_mon_num(p_ptr->current_floor_ptr->dun_level + 10); /* Remove the monster restriction */ get_mon_num_prep(NULL, NULL); @@ -48,7 +48,7 @@ void vault_prep_symbol(void) get_mon_num_prep(vault_aux_simple, NULL); /* Pick a race to clone */ - r_idx = get_mon_num(current_floor_ptr->dun_level + 10); + r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level + 10); /* Remove the monster restriction */ get_mon_num_prep(NULL, NULL); diff --git a/src/mspells1.c b/src/mspells1.c index 7eb3a89b4..c372d675b 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -87,7 +87,7 @@ static bool int_outof(monster_race *r_ptr, PERCENTAGE prob) */ static void remove_bad_spells(MONSTER_IDX m_idx, u32b *f4p, u32b *f5p, u32b *f6p) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; u32b f4 = (*f4p); @@ -389,7 +389,7 @@ bool summon_possible(POSITION y1, POSITION x1) for (x = x1 - 2; x <= x1 + 2; x++) { /* Ignore illegal locations */ - if (!in_bounds(current_floor_ptr, y, x)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) continue; /* Only check a circular area */ if (distance(y1, x1, y, x)>2) continue; @@ -428,11 +428,11 @@ bool raise_possible(monster_type *m_ptr) if (!los(y, x, yy, xx)) continue; if (!projectable(y, x, yy, xx)) continue; - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; /* Scan the pile of objects */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { - object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Known to be worthless? */ @@ -495,9 +495,9 @@ bool clean_shot(POSITION y1, POSITION x1, POSITION y2, POSITION x2, bool is_frie y = GRID_Y(grid_g[i]); x = GRID_X(grid_g[i]); - if ((current_floor_ptr->grid_array[y][x].m_idx > 0) && !((y == y2) && (x == x2))) + if ((p_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0) && !((y == y2) && (x == x2))) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx]; if (is_friend == is_pet(m_ptr)) { return (FALSE); @@ -592,7 +592,7 @@ void beam(MONSTER_IDX m_idx, POSITION y, POSITION x, EFFECT_ID typ, int dam_hp, */ void breath(POSITION y, POSITION x, MONSTER_IDX m_idx, EFFECT_ID typ, int dam_hp, POSITION rad, bool breath, int monspell, int target_type) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool learnable = spell_learnable(m_idx); BIT_FLAGS flg = 0x00; @@ -873,7 +873,7 @@ static bool spell_dispel(byte spell) */ bool dispel_check(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Invulnabilty (including the song) */ @@ -958,9 +958,9 @@ bool dispel_check(MONSTER_IDX m_idx) /* Light speed */ if (p_ptr->lightspeed && (m_ptr->mspeed < 136)) return (TRUE); - if (p_ptr->riding && (current_floor_ptr->m_list[p_ptr->riding].mspeed < 135)) + if (p_ptr->riding && (p_ptr->current_floor_ptr->m_list[p_ptr->riding].mspeed < 135)) { - if (MON_FAST(¤t_floor_ptr->m_list[p_ptr->riding])) return (TRUE); + if (MON_FAST(&p_ptr->current_floor_ptr->m_list[p_ptr->riding])) return (TRUE); } /* No need to cast dispel spell */ @@ -989,7 +989,7 @@ bool dispel_check(MONSTER_IDX m_idx) */ static int choose_attack_spell(MONSTER_IDX m_idx, byte spells[], byte num) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; byte escape[96], escape_num = 0; @@ -1271,7 +1271,7 @@ static bool adjacent_grid_check(monster_type *m_ptr, POSITION *yp, POSITION *xp, grid_type *g_ptr; /* Access the next grid */ - g_ptr = ¤t_floor_ptr->grid_array[next_y][next_x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[next_y][next_x]; /* Skip this feature */ if (!cave_have_flag_grid(g_ptr, f_flag)) continue; @@ -1358,7 +1358,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) PERCENTAGE failrate; byte spell[96], num = 0; BIT_FLAGS f4, f5, f6; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; #ifndef JP @@ -1382,7 +1382,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) /* Check "projectable" */ bool direct; - bool in_no_magic_dungeon = (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && current_floor_ptr->dun_level + bool in_no_magic_dungeon = (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && p_ptr->current_floor_ptr->dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)); bool can_use_lite_area = FALSE; @@ -1425,7 +1425,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) if (los(m_ptr->fy, m_ptr->fx, y_br_lite, x_br_lite)) { - feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[y_br_lite][x_br_lite].feat]; + feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y_br_lite][x_br_lite].feat]; if (!have_flag(f_ptr->flags, FF_LOS)) { @@ -1447,7 +1447,7 @@ bool make_attack_spell(MONSTER_IDX m_idx) /* Check path */ if (projectable(m_ptr->fy, m_ptr->fx, y, x)) { - feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[y][x].feat]; + feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat]; if (!have_flag(f_ptr->flags, FF_PROJECT)) { diff --git a/src/mspells2.c b/src/mspells2.c index be0f357bb..d23f07199 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -63,8 +63,8 @@ static bool direct_beam(POSITION y1, POSITION x1, POSITION y2, POSITION x2, mons if (y == y2 && x == x2) hit2 = TRUE; - else if (is_friend && current_floor_ptr->grid_array[y][x].m_idx > 0 && - !are_enemies(m_ptr, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx])) + else if (is_friend && p_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0 && + !are_enemies(m_ptr, &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx])) { /* Friends don't shoot friends */ return FALSE; @@ -239,7 +239,7 @@ void get_project_point(POSITION sy, POSITION sx, POSITION *ty, POSITION *tx, BIT */ static bool dispel_check_monster(MONSTER_IDX m_idx, MONSTER_IDX t_idx) { - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; if (MON_INVULNER(t_ptr)) return TRUE; @@ -285,7 +285,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) char m_poss[160]; #endif - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_type *t_ptr = NULL; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -296,7 +296,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[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && current_floor_ptr->dun_level + bool in_no_magic_dungeon = (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && p_ptr->current_floor_ptr->dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)); bool can_use_lite_area = FALSE; @@ -314,7 +314,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx) if (p_ptr->pet_t_m_idx && pet) { target_idx = p_ptr->pet_t_m_idx; - t_ptr = ¤t_floor_ptr->m_list[target_idx]; + t_ptr = &p_ptr->current_floor_ptr->m_list[target_idx]; /* Cancel if not projectable (for now) */ if ((m_idx == target_idx) || !projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) @@ -326,11 +326,11 @@ bool monst_spell_monst(MONSTER_IDX m_idx) /* Is there counter attack target? */ if (!target_idx && m_ptr->target_y) { - target_idx = current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; + target_idx = p_ptr->current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx; if (target_idx) { - t_ptr = ¤t_floor_ptr->m_list[target_idx]; + t_ptr = &p_ptr->current_floor_ptr->m_list[target_idx]; /* Cancel if neither enemy nor a given target */ if ((m_idx == target_idx) || @@ -356,19 +356,19 @@ bool monst_spell_monst(MONSTER_IDX m_idx) if (p_ptr->phase_out) { - start = randint1(current_floor_ptr->m_max-1) + current_floor_ptr->m_max; + start = randint1(p_ptr->current_floor_ptr->m_max-1) + p_ptr->current_floor_ptr->m_max; if (randint0(2)) plus = -1; } - else start = current_floor_ptr->m_max + 1; + else start = p_ptr->current_floor_ptr->m_max + 1; /* Scan thru all monsters */ - for (i = start; ((i < start + current_floor_ptr->m_max) && (i > start - current_floor_ptr->m_max)); i += plus) + for (i = start; ((i < start + p_ptr->current_floor_ptr->m_max) && (i > start - p_ptr->current_floor_ptr->m_max)); i += plus) { - MONSTER_IDX dummy = (i % current_floor_ptr->m_max); + MONSTER_IDX dummy = (i % p_ptr->current_floor_ptr->m_max); if (!dummy) continue; target_idx = dummy; - t_ptr = ¤t_floor_ptr->m_list[target_idx]; + t_ptr = &p_ptr->current_floor_ptr->m_list[target_idx]; if (!monster_is_valid(t_ptr)) continue; diff --git a/src/mspells3.c b/src/mspells3.c index b9645563b..854772dff 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -861,7 +861,7 @@ static bool cast_learned_spell(int spell, bool success) MONSTER_IDX m_idx; if (!target_set(TARGET_KILL)) return FALSE; - m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx; + m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; @@ -1303,10 +1303,10 @@ static bool cast_learned_spell(int spell, bool success) GAME_TEXT m_name[MAX_NLEN]; if (!target_set(TARGET_KILL)) return FALSE; - if (!current_floor_ptr->grid_array[target_row][target_col].m_idx) break; + if (!p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; - m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); if (r_ptr->flagsr & RFR_RES_TELE) @@ -1325,7 +1325,7 @@ static bool cast_learned_spell(int spell, bool success) } } msg_format(_("%sを引き戻した。", "You command %s to return."), m_name); - teleport_monster_to(current_floor_ptr->grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); + teleport_monster_to(p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: diff --git a/src/mspells4.c b/src/mspells4.c index 676550fa5..6f18d46f1 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -37,8 +37,8 @@ */ bool monster_near_player(MONSTER_IDX m_idx, MONSTER_IDX t_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; return (m_ptr->cdis <= MAX_SIGHT) || (t_ptr->cdis <= MAX_SIGHT); } @@ -49,7 +49,7 @@ bool monster_near_player(MONSTER_IDX m_idx, MONSTER_IDX t_idx) */ bool see_monster(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; return is_seen(m_ptr); } @@ -60,7 +60,7 @@ bool see_monster(MONSTER_IDX m_idx) */ bool spell_learnable(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; /* Extract the "see-able-ness" */ bool seen = (!p_ptr->blind && m_ptr->ml); @@ -76,7 +76,7 @@ bool spell_learnable(MONSTER_IDX m_idx) BIT_FLAGS monster_u_mode(MONSTER_IDX m_idx) { BIT_FLAGS u_mode = 0L; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool pet = is_pet(m_ptr); if (!pet) u_mode |= PM_ALLOW_UNIQUE; return u_mode; @@ -126,7 +126,7 @@ static void monspell_message_base(MONSTER_IDX m_idx, MONSTER_IDX t_idx, concptr } if (mon_to_mon && known && !see_either) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -286,7 +286,7 @@ HIT_POINT spell_RF4_BREATH(int GF_TYPE, POSITION y, POSITION x, MONSTER_IDX m_id HIT_POINT dam, ms_type, drs_type = 0; concptr type_s; bool smart_learn_aux = TRUE; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool known = monster_near_player(m_idx, t_idx); bool see_either = see_monster(m_idx) || see_monster(t_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); @@ -468,7 +468,7 @@ HIT_POINT spell_RF4_BREATH(int GF_TYPE, POSITION y, POSITION x, MONSTER_IDX m_id } if (mon_to_mon && known && !see_either) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; sound(SOUND_BREATH); breath(y, x, m_idx, GF_TYPE, dam, 0, TRUE, ms_type, TARGET_TYPE); @@ -602,7 +602,7 @@ HIT_POINT spell_RF5_BA_ELEC(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_I HIT_POINT spell_RF5_BA_FIRE(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { HIT_POINT dam, rad; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if (m_ptr->r_idx == MON_ROLENTO) { @@ -850,7 +850,7 @@ HIT_POINT spell_RF5_DRAIN_MANA(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTE */ HIT_POINT spell_RF5_MIND_BLAST(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool seen = (!p_ptr->blind && m_ptr->ml); HIT_POINT dam; GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN]; @@ -887,7 +887,7 @@ HIT_POINT spell_RF5_MIND_BLAST(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTE */ HIT_POINT spell_RF5_BRAIN_SMASH(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool seen = (!p_ptr->blind && m_ptr->ml); HIT_POINT dam; GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN]; @@ -950,7 +950,7 @@ void spell_RF5_CAUSE(int GF_TYPE, HIT_POINT dam, POSITION y, POSITION x, MONSTER } else { - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } } breath(y, x, m_idx, GF_TYPE, dam, 0, FALSE, MS_TYPE, TARGET_TYPE); @@ -1409,7 +1409,7 @@ void spell_badstatus_message(MONSTER_IDX m_idx, MONSTER_IDX t_idx, concptr msg1, } else { - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } } @@ -1437,7 +1437,7 @@ void spell_badstatus_message(MONSTER_IDX m_idx, MONSTER_IDX t_idx, concptr msg1, */ void spell_RF5_SCARE(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; DEPTH rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1487,7 +1487,7 @@ void spell_RF5_SCARE(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF5_BLIND(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; DEPTH rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1550,7 +1550,7 @@ void spell_RF5_BLIND(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF5_CONF(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; DEPTH rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1600,7 +1600,7 @@ void spell_RF5_CONF(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF5_SLOW(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; DEPTH rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1663,7 +1663,7 @@ void spell_RF5_SLOW(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF5_HOLD(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; DEPTH rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -1714,7 +1714,7 @@ void spell_RF5_HOLD(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) void spell_RF6_HASTE(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { bool see_m = see_monster(m_idx); - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; GAME_TEXT m_name[MAX_NLEN]; monster_name(m_idx, m_name); @@ -1773,7 +1773,7 @@ HIT_POINT spell_RF6_HAND_DOOM(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER */ void spell_RF6_HEAL(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; DEPTH rlev = monster_level_idx(m_idx); bool seen = (!p_ptr->blind && m_ptr->ml); GAME_TEXT m_name[MAX_NLEN]; @@ -1839,7 +1839,7 @@ void spell_RF6_HEAL(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF6_INVULNER(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; bool seen = (!p_ptr->blind && m_ptr->ml); monspell_message_base(m_idx, t_idx, @@ -1916,7 +1916,7 @@ void spell_RF6_TPORT(MONSTER_IDX m_idx, int TARGET_TYPE) */ HIT_POINT spell_RF6_WORLD(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; MONSTER_IDX who = 0; GAME_TEXT m_name[MAX_NLEN]; monster_name(m_idx, m_name); @@ -1934,7 +1934,7 @@ HIT_POINT spell_RF6_WORLD(MONSTER_IDX m_idx) */ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; HIT_POINT dummy_hp, dummy_maxhp; MONSTER_IDX k; POSITION dummy_y = m_ptr->fy; @@ -1950,13 +1950,13 @@ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(MONSTER_IDX m_idx) if (p_ptr->inside_arena || p_ptr->phase_out || !summon_possible(m_ptr->fy, m_ptr->fx)) return -1; - delete_monster_idx(current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].m_idx); + delete_monster_idx(p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].m_idx); summon_named_creature(0, dummy_y, dummy_x, MON_BANOR, mode); - current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; - current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; summon_named_creature(0, dummy_y, dummy_x, MON_LUPART, mode); - current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; - current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; msg_print(_("『バーノール・ルパート』が分裂した!","Banor=Rupart splits in two person!")); break; @@ -1969,23 +1969,23 @@ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(MONSTER_IDX m_idx) if (!r_info[MON_BANOR].cur_num || !r_info[MON_LUPART].cur_num) return -1; - for (k = 1; k < current_floor_ptr->m_max; k++) + for (k = 1; k < p_ptr->current_floor_ptr->m_max; k++) { - if (current_floor_ptr->m_list[k].r_idx == MON_BANOR || current_floor_ptr->m_list[k].r_idx == MON_LUPART) + if (p_ptr->current_floor_ptr->m_list[k].r_idx == MON_BANOR || p_ptr->current_floor_ptr->m_list[k].r_idx == MON_LUPART) { - dummy_hp += current_floor_ptr->m_list[k].hp; - dummy_maxhp += current_floor_ptr->m_list[k].maxhp; - if (current_floor_ptr->m_list[k].r_idx != m_ptr->r_idx) + dummy_hp += p_ptr->current_floor_ptr->m_list[k].hp; + dummy_maxhp += p_ptr->current_floor_ptr->m_list[k].maxhp; + if (p_ptr->current_floor_ptr->m_list[k].r_idx != m_ptr->r_idx) { - dummy_y = current_floor_ptr->m_list[k].fy; - dummy_x = current_floor_ptr->m_list[k].fx; + dummy_y = p_ptr->current_floor_ptr->m_list[k].fy; + dummy_x = p_ptr->current_floor_ptr->m_list[k].fx; } delete_monster_idx(k); } } summon_named_creature(0, dummy_y, dummy_x, MON_BANORLUPART, mode); - current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; - current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hp = dummy_hp; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].maxhp = dummy_maxhp; msg_print(_("『バーノール』と『ルパート』が合体した!", "Banor and Rupart combine into one!")); break; @@ -2037,8 +2037,8 @@ HIT_POINT spell_RF6_SPECIAL_ROLENTO(POSITION y, POSITION x, MONSTER_IDX m_idx, M HIT_POINT spell_RF6_SPECIAL_B(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { HIT_POINT dam = -1; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; bool monster_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); bool monster_to_monster = (TARGET_TYPE == MONSTER_TO_MONSTER); @@ -2114,7 +2114,7 @@ HIT_POINT spell_RF6_SPECIAL_B(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER } if(monster_to_player && p_ptr->riding) - mon_take_hit_mon(p_ptr->riding, dam, &dead, &fear, extract_note_dies(real_r_idx(¤t_floor_ptr->m_list[p_ptr->riding])), m_idx); + mon_take_hit_mon(p_ptr->riding, dam, &dead, &fear, extract_note_dies(real_r_idx(&p_ptr->current_floor_ptr->m_list[p_ptr->riding])), m_idx); if(monster_to_monster) mon_take_hit_mon(t_idx, dam, &dead, &fear, extract_note_dies(real_r_idx(t_ptr)), m_idx); @@ -2133,7 +2133,7 @@ HIT_POINT spell_RF6_SPECIAL_B(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER */ HIT_POINT spell_RF6_SPECIAL(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; disturb(p_ptr, TRUE, TRUE); @@ -2173,8 +2173,8 @@ HIT_POINT spell_RF6_SPECIAL(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_I */ void spell_RF6_TELE_TO(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; simple_monspell_message(m_idx, t_idx, @@ -2236,7 +2236,7 @@ void spell_RF6_TELE_TO(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF6_TELE_AWAY(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; simple_monspell_message(m_idx, t_idx, @@ -2306,7 +2306,7 @@ void spell_RF6_TELE_AWAY(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) */ void spell_RF6_TELE_LEVEL(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; DEPTH rlev = monster_level_idx(m_idx); bool resist, saving_throw; @@ -2383,8 +2383,8 @@ HIT_POINT spell_RF6_PSY_SPEAR(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER */ void spell_RF6_DARKNESS(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; - monster_type *t_ptr = ¤t_floor_ptr->m_list[t_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + monster_type *t_ptr = &p_ptr->current_floor_ptr->m_list[t_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool can_use_lite_area = FALSE; bool monster_to_monster = TARGET_TYPE == MONSTER_TO_MONSTER; @@ -2513,7 +2513,7 @@ void spell_RF6_FORGET(MONSTER_IDX m_idx) */ void spell_RF6_RAISE_DEAD(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monspell_message(m_idx, t_idx, _("%^sが何かをつぶやいた。", "%^s mumbles."), @@ -2675,7 +2675,7 @@ void spell_RF6_S_KIN(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_id bool see_either = see_monster(m_idx) || see_monster(t_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; DEPTH rlev = monster_level_idx(m_idx); int count = 0; @@ -2713,7 +2713,7 @@ void spell_RF6_S_KIN(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_id } if (mon_to_mon && known && !see_either) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } switch (m_ptr->r_idx) @@ -2750,7 +2750,7 @@ void spell_RF6_S_KIN(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_id msg_print(_("多くのものが間近に現れた音がする。", "You hear many things appear nearby.")); if (known && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -2765,7 +2765,7 @@ void spell_RF6_S_KIN(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_id void spell_RF6_S_CYBER(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { int count = 0; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; DEPTH rlev = monster_level_idx(m_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); @@ -2789,7 +2789,7 @@ void spell_RF6_S_CYBER(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_ msg_print(_("重厚な足音が近くで聞こえる。", "You hear heavy steps nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -2827,7 +2827,7 @@ void spell_RF6_S_MONSTER(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX msg_print(_("何かが間近に現れた音がする。", "You hear something appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -2865,7 +2865,7 @@ void spell_RF6_S_MONSTERS(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX msg_print(_("多くのものが間近に現れた音がする。", "You hear many things appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -2899,7 +2899,7 @@ void spell_RF6_S_ANT(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_id msg_print(_("多くのものが間近に現れた音がする。", "You hear many things appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -2933,7 +2933,7 @@ void spell_RF6_S_SPIDER(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t msg_print(_("多くのものが間近に現れた音がする。", "You hear many things appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -2967,7 +2967,7 @@ void spell_RF6_S_HOUND(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_ msg_print(_("多くのものが間近に現れた音がする。", "You hear many things appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3001,7 +3001,7 @@ void spell_RF6_S_HYDRA(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_ msg_print(_("多くのものが間近に現れた音がする。", "You hear many things appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3017,7 +3017,7 @@ void spell_RF6_S_ANGEL(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_ { int count = 0, k; int num = 1; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; DEPTH rlev = monster_level_idx(m_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); @@ -3050,7 +3050,7 @@ void spell_RF6_S_ANGEL(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_ } if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3083,7 +3083,7 @@ void spell_RF6_S_DEMON(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_ msg_print(_("何かが間近に現れた音がする。", "You hear something appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3116,7 +3116,7 @@ void spell_RF6_S_UNDEAD(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t msg_print(_("何かが間近に現れた音がする。", "You hear something appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3149,7 +3149,7 @@ void spell_RF6_S_DRAGON(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t msg_print(_("何かが間近に現れた音がする。", "You hear something appear nearby.")); if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3223,7 +3223,7 @@ void spell_RF6_S_HI_UNDEAD(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_ID { bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; DEPTH rlev = monster_level_idx(m_idx); int k, count = 0; GAME_TEXT m_name[MAX_NLEN]; @@ -3260,7 +3260,7 @@ void spell_RF6_S_HI_UNDEAD(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_ID } if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3300,7 +3300,7 @@ void spell_RF6_S_HI_DRAGON(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_ID } if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3336,7 +3336,7 @@ void spell_RF6_S_AMBERITES(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_ID } if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /*! @@ -3351,7 +3351,7 @@ void spell_RF6_S_AMBERITES(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_ID void spell_RF6_S_UNIQUE(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE) { int count = 0, k; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; DEPTH rlev = monster_level_idx(m_idx); bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER); bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER); @@ -3388,7 +3388,7 @@ void spell_RF6_S_UNIQUE(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t } if (monster_near_player(m_idx, t_idx) && !see_monster(t_idx) && count && mon_to_mon) - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } @@ -4076,7 +4076,7 @@ HIT_POINT monspell_damage_base(int SPELL_NUM, int hp, int rlev, bool powerful, i */ HIT_POINT monspell_damage(int SPELL_NUM, MONSTER_IDX m_idx, int TYPE) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; int hp; DEPTH rlev = monster_level_idx(m_idx); diff --git a/src/mutation.c b/src/mutation.c index 4af46923d..0acfe1def 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -2266,7 +2266,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power) case MUT1_STERILITY: msg_print(_("突然頭が痛くなった!", "You suddenly have a headache!")); take_hit(p_ptr, DAMAGE_LOSELIFE, randint1(17) + 17, _("禁欲を強いた疲労", "the strain of forcing abstinence"), -1); - current_floor_ptr->num_repro += MAX_REPRO; + p_ptr->current_floor_ptr->num_repro += MAX_REPRO; break; case MUT1_PANIC_HIT: @@ -2297,7 +2297,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (!g_ptr->m_idx) { @@ -2306,7 +2306,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power) break; } - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; r_ptr = &r_info[m_ptr->r_idx]; if ((r_ptr->flags3 & RF3_EVIL) && @@ -2342,7 +2342,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (!g_ptr->m_idx) { msg_print(_("あなたは何もない場所で手を振った。", "You wave your hands in the air.")); diff --git a/src/object2.c b/src/object2.c index df04bbc73..89c015f7c 100644 --- a/src/object2.c +++ b/src/object2.c @@ -56,18 +56,18 @@ void excise_object_idx(OBJECT_IDX o_idx) OBJECT_IDX prev_o_idx = 0; /* Object */ - j_ptr = ¤t_floor_ptr->o_list[o_idx]; + j_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; if (OBJECT_IS_HELD_MONSTER(j_ptr)) { monster_type *m_ptr; - m_ptr = ¤t_floor_ptr->m_list[j_ptr->held_m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[j_ptr->held_m_idx]; /* Scan all objects in the grid */ for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; if (this_o_idx == o_idx) @@ -85,7 +85,7 @@ void excise_object_idx(OBJECT_IDX o_idx) object_type *k_ptr; /* Previous object */ - k_ptr = ¤t_floor_ptr->o_list[prev_o_idx]; + k_ptr = &p_ptr->current_floor_ptr->o_list[prev_o_idx]; /* Remove from list */ k_ptr->next_o_idx = next_o_idx; @@ -110,13 +110,13 @@ void excise_object_idx(OBJECT_IDX o_idx) POSITION y = j_ptr->iy; POSITION x = j_ptr->ix; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Scan all objects in the grid */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; if (this_o_idx == o_idx) @@ -134,7 +134,7 @@ void excise_object_idx(OBJECT_IDX o_idx) object_type *k_ptr; /* Previous object */ - k_ptr = ¤t_floor_ptr->o_list[prev_o_idx]; + k_ptr = &p_ptr->current_floor_ptr->o_list[prev_o_idx]; /* Remove from list */ k_ptr->next_o_idx = next_o_idx; @@ -168,7 +168,7 @@ void delete_object_idx(OBJECT_IDX o_idx) excise_object_idx(o_idx); /* Object */ - j_ptr = ¤t_floor_ptr->o_list[o_idx]; + j_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; /* Dungeon floor */ if (!OBJECT_IS_HELD_MONSTER(j_ptr)) @@ -181,7 +181,7 @@ void delete_object_idx(OBJECT_IDX o_idx) object_wipe(j_ptr); /* Count objects */ - current_floor_ptr->o_cnt--; + p_ptr->current_floor_ptr->o_cnt--; } @@ -198,20 +198,20 @@ void delete_object(POSITION y, POSITION x) OBJECT_IDX this_o_idx, next_o_idx = 0; /* Refuse "illegal" locations */ - if (!in_bounds(current_floor_ptr, y, x)) return; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Scan all objects in the grid */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; object_wipe(o_ptr); /* Count objects */ - current_floor_ptr->o_cnt--; + p_ptr->current_floor_ptr->o_cnt--; } /* Objects are gone */ @@ -238,9 +238,9 @@ static void compact_objects_aux(OBJECT_IDX i1, OBJECT_IDX i2) if (i1 == i2) return; /* Repair objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - o_ptr = ¤t_floor_ptr->o_list[i]; + o_ptr = &p_ptr->current_floor_ptr->o_list[i]; /* Skip "dead" objects */ if (!o_ptr->k_idx) continue; @@ -252,12 +252,12 @@ static void compact_objects_aux(OBJECT_IDX i1, OBJECT_IDX i2) o_ptr->next_o_idx = i2; } } - o_ptr = ¤t_floor_ptr->o_list[i1]; + o_ptr = &p_ptr->current_floor_ptr->o_list[i1]; if (OBJECT_IS_HELD_MONSTER(o_ptr)) { monster_type *m_ptr; - m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[o_ptr->held_m_idx]; /* Repair monster */ if (m_ptr->hold_o_idx == i1) @@ -277,7 +277,7 @@ static void compact_objects_aux(OBJECT_IDX i1, OBJECT_IDX i2) x = o_ptr->ix; /* Acquire grid */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Repair grid */ if (g_ptr->o_idx == i1) @@ -288,7 +288,7 @@ static void compact_objects_aux(OBJECT_IDX i1, OBJECT_IDX i2) } /* Structure copy */ - current_floor_ptr->o_list[i2] = current_floor_ptr->o_list[i1]; + p_ptr->current_floor_ptr->o_list[i2] = p_ptr->current_floor_ptr->o_list[i1]; /* Wipe the hole */ object_wipe(o_ptr); @@ -338,9 +338,9 @@ void compact_objects(int size) cur_dis = 5 * (20 - cnt); /* Examine the objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - o_ptr = ¤t_floor_ptr->o_list[i]; + o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; @@ -350,7 +350,7 @@ void compact_objects(int size) if (OBJECT_IS_HELD_MONSTER(o_ptr)) { monster_type *m_ptr; - m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[o_ptr->held_m_idx]; y = m_ptr->fy; x = m_ptr->fx; @@ -388,18 +388,18 @@ void compact_objects(int size) /* Excise dead objects (backwards!) */ - for (i = current_floor_ptr->o_max - 1; i >= 1; i--) + for (i = p_ptr->current_floor_ptr->o_max - 1; i >= 1; i--) { - o_ptr = ¤t_floor_ptr->o_list[i]; + o_ptr = &p_ptr->current_floor_ptr->o_list[i]; /* Skip real objects */ if (o_ptr->k_idx) continue; /* Move last object into open hole */ - compact_objects_aux(current_floor_ptr->o_max - 1, i); + compact_objects_aux(p_ptr->current_floor_ptr->o_max - 1, i); - /* Compress "current_floor_ptr->o_max" */ - current_floor_ptr->o_max--; + /* Compress "p_ptr->current_floor_ptr->o_max" */ + p_ptr->current_floor_ptr->o_max--; } } @@ -421,9 +421,9 @@ void wipe_o_list(void) int i; /* Delete the existing objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; @@ -441,7 +441,7 @@ void wipe_o_list(void) if (OBJECT_IS_HELD_MONSTER(o_ptr)) { monster_type *m_ptr; - m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[o_ptr->held_m_idx]; /* Hack -- see above */ m_ptr->hold_o_idx = 0; @@ -457,7 +457,7 @@ void wipe_o_list(void) POSITION x = o_ptr->ix; /* Access grid */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Hack -- see above */ g_ptr->o_idx = 0; @@ -465,11 +465,11 @@ void wipe_o_list(void) object_wipe(o_ptr); } - /* Reset "current_floor_ptr->o_max" */ - current_floor_ptr->o_max = 1; + /* Reset "p_ptr->current_floor_ptr->o_max" */ + p_ptr->current_floor_ptr->o_max = 1; - /* Reset "current_floor_ptr->o_cnt" */ - current_floor_ptr->o_cnt = 0; + /* Reset "p_ptr->current_floor_ptr->o_cnt" */ + p_ptr->current_floor_ptr->o_cnt = 0; } @@ -486,16 +486,16 @@ OBJECT_IDX o_pop(void) OBJECT_IDX i; /* Initial allocation */ - if (current_floor_ptr->o_max < current_floor_ptr->max_o_idx) + if (p_ptr->current_floor_ptr->o_max < current_world_ptr->max_o_idx) { /* Get next space */ - i = current_floor_ptr->o_max; + i = p_ptr->current_floor_ptr->o_max; /* Expand object array */ - current_floor_ptr->o_max++; + p_ptr->current_floor_ptr->o_max++; /* Count objects */ - current_floor_ptr->o_cnt++; + p_ptr->current_floor_ptr->o_cnt++; /* Use this object */ return (i); @@ -503,16 +503,16 @@ OBJECT_IDX o_pop(void) /* Recycle dead objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[i]; + o_ptr = &p_ptr->current_floor_ptr->o_list[i]; /* Skip live objects */ if (o_ptr->k_idx) continue; /* Count objects */ - current_floor_ptr->o_cnt++; + p_ptr->current_floor_ptr->o_cnt++; /* Use this object */ return (i); @@ -3732,7 +3732,7 @@ static void a_m_aux_4(object_type *o_ptr, DEPTH level, int power) r_ptr = &r_info[i]; - check = (current_floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - current_floor_ptr->dun_level) : 0; + check = (p_ptr->current_floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - p_ptr->current_floor_ptr->dun_level) : 0; /* Ignore dead monsters */ if (!r_ptr->rarity) continue; @@ -3778,11 +3778,11 @@ static void a_m_aux_4(object_type *o_ptr, DEPTH level, int power) /* Pick a random non-unique monster race */ while (1) { - i = get_mon_num(current_floor_ptr->dun_level); + i = get_mon_num(p_ptr->current_floor_ptr->dun_level); r_ptr = &r_info[i]; - check = (current_floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - current_floor_ptr->dun_level) : 0; + check = (p_ptr->current_floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - p_ptr->current_floor_ptr->dun_level) : 0; /* Ignore dead monsters */ if (!r_ptr->rarity) continue; @@ -3846,7 +3846,7 @@ static void a_m_aux_4(object_type *o_ptr, DEPTH level, int power) o_ptr->pval = randint1(obj_level); if (o_ptr->sval == SV_CHEST_KANDUME) o_ptr->pval = 6; - o_ptr->xtra3 = current_floor_ptr->dun_level + 5; + o_ptr->xtra3 = p_ptr->current_floor_ptr->dun_level + 5; /* Never exceed "difficulty" of 55 to 59 */ if (o_ptr->pval > 55) o_ptr->pval = 55 + (byte)randint0(5); @@ -4301,7 +4301,7 @@ void apply_magic(object_type *o_ptr, DEPTH lev, BIT_FLAGS mode) * @return 生成に成功したらTRUEを返す。 * @details * This routine plays nasty games to generate the "special artifacts".\n - * This routine uses "current_floor_ptr->object_level" for the "generation level".\n + * This routine uses "p_ptr->current_floor_ptr->object_level" for the "generation level".\n * We assume that the given object has been "wiped".\n */ bool make_object(object_type *j_ptr, BIT_FLAGS mode) @@ -4314,7 +4314,7 @@ bool make_object(object_type *j_ptr, BIT_FLAGS mode) prob = ((mode & AM_GOOD) ? 10 : 1000); /* Base level for the object */ - base = ((mode & AM_GOOD) ? (current_floor_ptr->object_level + 10) : current_floor_ptr->object_level); + base = ((mode & AM_GOOD) ? (p_ptr->current_floor_ptr->object_level + 10) : p_ptr->current_floor_ptr->object_level); /* Generate a special object, or a normal object */ @@ -4353,7 +4353,7 @@ bool make_object(object_type *j_ptr, BIT_FLAGS mode) } /* Apply magic (allow artifacts) */ - apply_magic(j_ptr, current_floor_ptr->object_level, mode); + apply_magic(j_ptr, p_ptr->current_floor_ptr->object_level, mode); /* Hack -- generate multiple spikes/missiles */ switch (j_ptr->tval) @@ -4384,7 +4384,7 @@ bool make_object(object_type *j_ptr, BIT_FLAGS mode) * @return 生成に成功したらTRUEを返す。 * @details * This routine plays nasty games to generate the "special artifacts".\n - * This routine uses "current_floor_ptr->object_level" for the "generation level".\n + * This routine uses "p_ptr->current_floor_ptr->object_level" for the "generation level".\n * This routine requires a clean floor grid destination.\n */ void place_object(POSITION y, POSITION x, BIT_FLAGS mode) @@ -4392,14 +4392,14 @@ void place_object(POSITION y, POSITION x, BIT_FLAGS mode) OBJECT_IDX o_idx; /* Acquire grid */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; object_type forge; object_type *q_ptr; /* Paranoia -- check bounds */ - if (!in_bounds(current_floor_ptr, y, x)) return; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; /* Require floor space */ if (!cave_drop_bold(y, x)) return; @@ -4419,7 +4419,7 @@ void place_object(POSITION y, POSITION x, BIT_FLAGS mode) if (o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; /* Structure Copy */ object_copy(o_ptr, q_ptr); @@ -4461,12 +4461,12 @@ bool make_gold(object_type *j_ptr) s32b base; /* Hack -- Pick a Treasure variety */ - i = ((randint1(current_floor_ptr->object_level + 2) + 2) / 2) - 1; + i = ((randint1(p_ptr->current_floor_ptr->object_level + 2) + 2) / 2) - 1; /* Apply "extra" magic */ if (one_in_(GREAT_OBJ)) { - i += randint1(current_floor_ptr->object_level + 1); + i += randint1(p_ptr->current_floor_ptr->object_level + 1); } /* Hack -- Creeping Coins only generate "themselves" */ @@ -4503,14 +4503,14 @@ void place_gold(POSITION y, POSITION x) OBJECT_IDX o_idx; /* Acquire grid */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; object_type forge; object_type *q_ptr; /* Paranoia -- check bounds */ - if (!in_bounds(current_floor_ptr, y, x)) return; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; /* Require floor space */ if (!cave_drop_bold(y, x)) return; @@ -4530,7 +4530,7 @@ void place_gold(POSITION y, POSITION x) if (o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; object_copy(o_ptr, q_ptr); /* Save location */ @@ -4556,7 +4556,7 @@ void place_gold(POSITION y, POSITION x) * @param x 配置したいフロアのX座標 * @return 生成に成功したらオブジェクトのIDを返す。 * @details - * The initial location is assumed to be "in_bounds(current_floor_ptr, )".\n + * The initial location is assumed to be "in_bounds(p_ptr->current_floor_ptr, )".\n *\n * This function takes a parameter "chance". This is the percentage\n * chance that the item will "disappear" instead of drop. If the object\n @@ -4639,13 +4639,13 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION ty = y + dy; tx = x + dx; - if (!in_bounds(current_floor_ptr, ty, tx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, ty, tx)) continue; /* Require line of projection */ if (!projectable(y, x, ty, tx)) continue; /* Obtain grid */ - g_ptr = ¤t_floor_ptr->grid_array[ty][tx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx]; /* Require floor space */ if (!cave_drop_bold(ty, tx)) continue; @@ -4657,7 +4657,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Check for possible combination */ @@ -4718,7 +4718,7 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION ty = rand_spread(by, 1); tx = rand_spread(bx, 1); - if (!in_bounds(current_floor_ptr, ty, tx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, ty, tx)) continue; /* Bounce to that location */ by = ty; @@ -4735,9 +4735,9 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION { int candidates = 0, pick; - for (ty = 1; ty < current_floor_ptr->height - 1; ty++) + for (ty = 1; ty < p_ptr->current_floor_ptr->height - 1; ty++) { - for (tx = 1; tx < current_floor_ptr->width - 1; tx++) + for (tx = 1; tx < p_ptr->current_floor_ptr->width - 1; tx++) { /* A valid space found */ if (cave_drop_bold(ty, tx)) candidates++; @@ -4773,9 +4773,9 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION /* Choose a random one */ pick = randint1(candidates); - for (ty = 1; ty < current_floor_ptr->height - 1; ty++) + for (ty = 1; ty < p_ptr->current_floor_ptr->height - 1; ty++) { - for (tx = 1; tx < current_floor_ptr->width - 1; tx++) + for (tx = 1; tx < p_ptr->current_floor_ptr->width - 1; tx++) { if (cave_drop_bold(ty, tx)) { @@ -4794,13 +4794,13 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION } - g_ptr = ¤t_floor_ptr->grid_array[by][bx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[by][bx]; /* Scan objects in that grid for combination */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Check for combination */ @@ -4842,10 +4842,10 @@ OBJECT_IDX drop_near(object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION if (!done) { /* Structure copy */ - object_copy(¤t_floor_ptr->o_list[o_idx], j_ptr); + object_copy(&p_ptr->current_floor_ptr->o_list[o_idx], j_ptr); /* Access new object */ - j_ptr = ¤t_floor_ptr->o_list[o_idx]; + j_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; /* Locate */ j_ptr->iy = by; @@ -5061,7 +5061,7 @@ void inven_item_optimize(INVENTORY_IDX item) */ void floor_item_charges(INVENTORY_IDX item) { - object_type *o_ptr = ¤t_floor_ptr->o_list[item]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[item]; /* Require staff/wand */ if ((o_ptr->tval != TV_STAFF) && (o_ptr->tval != TV_WAND)) return; @@ -5102,7 +5102,7 @@ void floor_item_charges(INVENTORY_IDX item) */ void floor_item_describe(INVENTORY_IDX item) { - object_type *o_ptr = ¤t_floor_ptr->o_list[item]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[item]; GAME_TEXT o_name[MAX_NLEN]; object_desc(o_name, o_ptr, 0); @@ -5133,7 +5133,7 @@ void floor_item_describe(INVENTORY_IDX item) */ void floor_item_increase(INVENTORY_IDX item, ITEM_NUMBER num) { - object_type *o_ptr = ¤t_floor_ptr->o_list[item]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[item]; /* Apply */ num += o_ptr->number; @@ -5158,7 +5158,7 @@ void floor_item_increase(INVENTORY_IDX item, ITEM_NUMBER num) */ void floor_item_optimize(INVENTORY_IDX item) { - object_type *o_ptr = ¤t_floor_ptr->o_list[item]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[item]; /* Paranoia -- be sure it exists */ if (!o_ptr->k_idx) return; diff --git a/src/patron.c b/src/patron.c index 362213bad..aef130a12 100644 --- a/src/patron.c +++ b/src/patron.c @@ -387,7 +387,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) for (dummy = 0; dummy < randint1(5) + 1; dummy++) { - (void)summon_specific(0, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (void)summon_specific(0, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } reward = _("モンスターを召喚された。", "summoning hostile monsters"); break; @@ -633,7 +633,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) msg_format(_("%sは褒美として悪魔の使いをよこした!", "%s rewards you with a demonic servant!"), chaos_patrons[creature_ptr->chaos_patron]); - if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, PM_FORCE_PET)) + if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, PM_FORCE_PET)) msg_print(_("何も現れなかった...", "Nobody ever turns up...")); else reward = _("悪魔がペットになった。", "a demonic servant"); @@ -643,7 +643,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) case REW_SER_MONS: msg_format(_("%sは褒美として使いをよこした!", "%s rewards you with a servant!"), chaos_patrons[creature_ptr->chaos_patron]); - if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, 0, PM_FORCE_PET)) + if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, 0, PM_FORCE_PET)) msg_print(_("何も現れなかった...", "Nobody ever turns up...")); else reward = _("モンスターがペットになった。", "a servant"); @@ -653,7 +653,7 @@ void gain_level_reward(player_type *creature_ptr, int chosen_reward) case REW_SER_UNDE: msg_format(_("%sは褒美としてアンデッドの使いをよこした。", "%s rewards you with an undead servant!"), chaos_patrons[creature_ptr->chaos_patron]); - if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, PM_FORCE_PET)) + if (!summon_specific(-1, creature_ptr->y, creature_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, PM_FORCE_PET)) msg_print(_("何も現れなかった...", "Nobody ever turns up...")); else reward = _("アンデッドがペットになった。", "an undead servant"); diff --git a/src/player-damage.c b/src/player-damage.c index 969d3c831..daafb1e36 100644 --- a/src/player-damage.c +++ b/src/player-damage.c @@ -509,7 +509,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp } else { - QUEST_IDX q_idx = quest_number(current_floor_ptr->dun_level); + QUEST_IDX q_idx = quest_number(p_ptr->current_floor_ptr->dun_level); bool seppuku = streq(hit_from, "Seppuku"); bool winning_seppuku = creature_ptr->total_winner && seppuku; @@ -552,13 +552,13 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp if (creature_ptr->inside_arena) strcpy(buf, _("アリーナ", "in the Arena")); - else if (!current_floor_ptr->dun_level) + else if (!p_ptr->current_floor_ptr->dun_level) strcpy(buf, _("地上", "on the surface")); else if (q_idx && (is_fixed_quest_idx(q_idx) && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT)))) strcpy(buf, _("クエスト", "in a quest")); else - sprintf(buf, _("%d階", "level %d"), (int)current_floor_ptr->dun_level); + sprintf(buf, _("%d階", "level %d"), (int)p_ptr->current_floor_ptr->dun_level); sprintf(tmp, _("%sで%sに殺された。", "killed by %s %s."), buf, creature_ptr->died_from); exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, tmp); diff --git a/src/player-effects.c b/src/player-effects.c index f0bb59434..ce91346ac 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -1640,7 +1640,7 @@ bool set_superstealth(player_type *creature_ptr, bool set) { if (!(creature_ptr->special_defense & NINJA_S_STEALTH)) { - if (current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & CAVE_MNLT) + if (p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & CAVE_MNLT) { msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes.")); creature_ptr->monlite = creature_ptr->old_monlite = TRUE; diff --git a/src/player-inventory.c b/src/player-inventory.c index 37505bed2..f2e0f0940 100644 --- a/src/player-inventory.c +++ b/src/player-inventory.c @@ -296,7 +296,7 @@ static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], IT /* Check every object in the grid */ for (i = 0; i < floor_num && i < 23; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[floor_list[i]]; /* Skip empty inscriptions */ if (!o_ptr->inscription) continue; @@ -335,7 +335,7 @@ static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], IT /* Check every object in the grid */ for (i = 0; i < floor_num && i < 23; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[floor_list[i]]; /* Skip empty inscriptions */ if (!o_ptr->inscription) continue; @@ -743,7 +743,7 @@ static bool verify(concptr prompt, INVENTORY_IDX item) /* Floor */ else { - o_ptr = ¤t_floor_ptr->o_list[0 - item]; + o_ptr = &p_ptr->current_floor_ptr->o_list[0 - item]; } object_desc(o_name, o_ptr, 0); @@ -777,7 +777,7 @@ static bool get_item_allow(INVENTORY_IDX item) /* Floor */ else { - o_ptr = ¤t_floor_ptr->o_list[0 - item]; + o_ptr = &p_ptr->current_floor_ptr->o_list[0 - item]; } /* No inscription */ @@ -919,7 +919,7 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_T /* Special index */ k = 0 - (*cp); - o_ptr = ¤t_floor_ptr->o_list[k]; + o_ptr = &p_ptr->current_floor_ptr->o_list[k]; /* Validate the item */ if (item_tester_okay(o_ptr, tval) || (mode & USE_FULL)) @@ -1030,10 +1030,10 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_T if (floor) { /* Scan all objects in the grid */ - for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Accept the item on the floor if legal */ @@ -1374,10 +1374,10 @@ bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_T if (allow_floor) { /* Scan all objects in the grid */ - for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Validate the item */ @@ -1630,7 +1630,7 @@ object_type *choose_object(player_type *creature_ptr, OBJECT_IDX *idx, concptr q if (!get_item(&item, q, s, option, tval)) return NULL; if (idx) *idx = item; if (item == INVEN_FORCE) return NULL; - return REF_ITEM(creature_ptr, current_floor_ptr, item); + return REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item); } @@ -1642,7 +1642,7 @@ object_type *choose_object(player_type *creature_ptr, OBJECT_IDX *idx, concptr q * @param mode オプションフラグ * @return 対象のマスに落ちているアイテム数 * @details - * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array + * Return a list of o_list[] indexes of items at the given p_ptr->current_floor_ptr->grid_array * location. Valid flags are: * * mode & 0x01 -- Item tester @@ -1656,13 +1656,13 @@ ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode ITEM_NUMBER num = 0; /* Sanity */ - if (!in_bounds(current_floor_ptr, y, x)) return 0; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return 0; /* Scan all objects in the grid */ - for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = p_ptr->current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Item tester */ @@ -1728,7 +1728,7 @@ COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_w /* Display the floor objects */ for (k = 0, i = 0; i < floor_num && i < 23; i++) { - o_ptr = ¤t_floor_ptr->o_list[floor_list[i]]; + o_ptr = &p_ptr->current_floor_ptr->o_list[floor_list[i]]; object_desc(o_name, o_ptr, 0); @@ -1770,7 +1770,7 @@ COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_w for (j = 0; j < k; j++) { m = floor_list[out_index[j]]; - o_ptr = ¤t_floor_ptr->o_list[m]; + o_ptr = &p_ptr->current_floor_ptr->o_list[m]; /* Clear the line */ prt("", j + 1, col ? col - 2 : col); @@ -1904,7 +1904,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode, } /* Validate the item */ - else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)], tval) || (mode & USE_FULL)) + else if (item_tester_okay(&p_ptr->current_floor_ptr->o_list[0 - (*cp)], tval) || (mode & USE_FULL)) { /* Forget restrictions */ tval = 0; @@ -2536,7 +2536,7 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode, { int i; OBJECT_IDX o_idx; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; if (command_wrk != (USE_FLOOR)) break; @@ -2544,18 +2544,18 @@ bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode, o_idx = g_ptr->o_idx; /* Only rotate a pile of two or more objects. */ - if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break; + if (!(o_idx && p_ptr->current_floor_ptr->o_list[o_idx].next_o_idx)) break; /* Remove the first object from the list. */ excise_object_idx(o_idx); /* Find end of the list. */ i = g_ptr->o_idx; - while (current_floor_ptr->o_list[i].next_o_idx) - i = current_floor_ptr->o_list[i].next_o_idx; + while (p_ptr->current_floor_ptr->o_list[i].next_o_idx) + i = p_ptr->current_floor_ptr->o_list[i].next_o_idx; /* Add after the last object. */ - current_floor_ptr->o_list[i].next_o_idx = o_idx; + p_ptr->current_floor_ptr->o_list[i].next_o_idx = o_idx; /* Re-scan floor list */ floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03); @@ -3009,10 +3009,10 @@ void py_pickup_floor(bool pickup) int can_pickup = 0; /* Scan the pile of objects */ - for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { /* Access the object */ - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; object_desc(o_name, o_ptr, 0); @@ -3078,7 +3078,7 @@ void py_pickup_floor(bool pickup) if (floor_num == 1) { /* Access the object */ - o_ptr = ¤t_floor_ptr->o_list[floor_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[floor_o_idx]; #ifdef ALLOW_EASY_SENSE @@ -3112,7 +3112,7 @@ void py_pickup_floor(bool pickup) if (floor_num == 1) { /* Access the object */ - o_ptr = ¤t_floor_ptr->o_list[floor_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[floor_o_idx]; #ifdef ALLOW_EASY_SENSE @@ -3149,7 +3149,7 @@ void py_pickup_floor(bool pickup) char out_val[MAX_NLEN + 20]; /* Access the object */ - o_ptr = ¤t_floor_ptr->o_list[floor_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[floor_o_idx]; #ifdef ALLOW_EASY_SENSE @@ -3174,7 +3174,7 @@ void py_pickup_floor(bool pickup) } /* Access the object */ - o_ptr = ¤t_floor_ptr->o_list[floor_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[floor_o_idx]; #ifdef ALLOW_EASY_SENSE diff --git a/src/player-move.c b/src/player-move.c index ee62d1372..097197fb1 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -190,7 +190,7 @@ static void discover_hidden_things(POSITION y, POSITION x) { OBJECT_IDX this_o_idx, next_o_idx = 0; grid_type *g_ptr; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Invisible trap */ if (g_ptr->mimic && is_trap(g_ptr->feat)) @@ -212,7 +212,7 @@ static void discover_hidden_things(POSITION y, POSITION x) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; if (o_ptr->tval != TV_CHEST) continue; if (!chest_traps[o_ptr->pval]) continue; @@ -282,7 +282,7 @@ void py_pickup_aux(OBJECT_IDX o_idx) object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; #ifdef JP object_desc(old_name, o_ptr, OD_NAME_ONLY); @@ -356,7 +356,7 @@ void py_pickup_aux(OBJECT_IDX o_idx) */ void carry(bool pickup) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -383,7 +383,7 @@ void carry(bool pickup) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; #ifdef ALLOW_EASY_SENSE /* TNB */ @@ -477,8 +477,8 @@ void carry(bool pickup) */ bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x) { - feature_type *cur_f_ptr = &f_info[current_floor_ptr->grid_array[c_y][c_x].feat]; - feature_type *new_f_ptr = &f_info[current_floor_ptr->grid_array[n_y][n_x].feat]; + feature_type *cur_f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[c_y][c_x].feat]; + feature_type *new_f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[n_y][n_x].feat]; bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN); bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN); int pattern_type_cur, pattern_type_new; @@ -605,8 +605,8 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT { POSITION oy = creature_ptr->y; POSITION ox = creature_ptr->x; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[ny][nx]; - grid_type *oc_ptr = ¤t_floor_ptr->grid_array[oy][ox]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx]; + grid_type *oc_ptr = &p_ptr->current_floor_ptr->grid_array[oy][ox]; feature_type *f_ptr = &f_info[g_ptr->feat]; feature_type *of_ptr = &f_info[oc_ptr->feat]; @@ -627,7 +627,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT if (om_idx > 0) /* Monster on old spot (or creature_ptr->riding) */ { - monster_type *om_ptr = ¤t_floor_ptr->m_list[om_idx]; + monster_type *om_ptr = &p_ptr->current_floor_ptr->m_list[om_idx]; om_ptr->fy = ny; om_ptr->fx = nx; update_monster(om_idx, TRUE); @@ -635,7 +635,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT if (nm_idx > 0) /* Monster on new spot */ { - monster_type *nm_ptr = ¤t_floor_ptr->m_list[nm_idx]; + monster_type *nm_ptr = &p_ptr->current_floor_ptr->m_list[nm_idx]; nm_ptr->fy = oy; nm_ptr->fx = ox; update_monster(nm_idx, TRUE); @@ -663,7 +663,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT if ((!creature_ptr->blind && !no_lite()) || !is_trap(g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE); /* For get everything when requested hehe I'm *NASTY* */ - if (current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(); + if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(); if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff(); if (creature_ptr->pclass == CLASS_NINJA) @@ -758,7 +758,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT leave_quest_check(); creature_ptr->inside_quest = g_ptr->special; - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; creature_ptr->oldpx = 0; creature_ptr->oldpy = 0; @@ -884,13 +884,13 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool POSITION x = creature_ptr->x + ddx[dir]; /* Examine the destination */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; monster_type *m_ptr; - monster_type *riding_m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding]; + monster_type *riding_m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding]; monster_race *riding_r_ptr = &r_info[creature_ptr->riding ? riding_m_ptr->r_idx : 0]; GAME_TEXT m_name[MAX_NLEN]; @@ -903,7 +903,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool bool do_past = FALSE; /* Exit the area */ - if (!current_floor_ptr->dun_level && !creature_ptr->wild_mode && + if (!p_ptr->current_floor_ptr->dun_level && !creature_ptr->wild_mode && ((x == 0) || (x == MAX_WID - 1) || (y == 0) || (y == MAX_HGT - 1))) { @@ -915,8 +915,8 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool { creature_ptr->wilderness_y--; creature_ptr->wilderness_x--; - creature_ptr->oldpy = current_floor_ptr->height - 2; - creature_ptr->oldpx = current_floor_ptr->width - 2; + creature_ptr->oldpy = p_ptr->current_floor_ptr->height - 2; + creature_ptr->oldpx = p_ptr->current_floor_ptr->width - 2; creature_ptr->ambush_flag = FALSE; } @@ -924,7 +924,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool { creature_ptr->wilderness_y--; creature_ptr->wilderness_x++; - creature_ptr->oldpy = current_floor_ptr->height - 2; + creature_ptr->oldpy = p_ptr->current_floor_ptr->height - 2; creature_ptr->oldpx = 1; creature_ptr->ambush_flag = FALSE; } @@ -934,7 +934,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool creature_ptr->wilderness_y++; creature_ptr->wilderness_x--; creature_ptr->oldpy = 1; - creature_ptr->oldpx = current_floor_ptr->width - 2; + creature_ptr->oldpx = p_ptr->current_floor_ptr->width - 2; creature_ptr->ambush_flag = FALSE; } @@ -950,7 +950,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool else if (y == 0) { creature_ptr->wilderness_y--; - creature_ptr->oldpy = current_floor_ptr->height - 2; + creature_ptr->oldpy = p_ptr->current_floor_ptr->height - 2; creature_ptr->oldpx = x; creature_ptr->ambush_flag = FALSE; } @@ -966,7 +966,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool else if (x == 0) { creature_ptr->wilderness_x--; - creature_ptr->oldpx = current_floor_ptr->width - 2; + creature_ptr->oldpx = p_ptr->current_floor_ptr->width - 2; creature_ptr->oldpy = y; creature_ptr->ambush_flag = FALSE; } @@ -990,7 +990,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool p_can_enter = FALSE; } - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; if (creature_ptr->inventory_list[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE; if (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE; @@ -1030,7 +1030,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool py_attack(p_ptr, y, x, 0); oktomove = FALSE; } - else if (monster_can_cross_terrain(current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0)) + else if (monster_can_cross_terrain(p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0)) { do_past = TRUE; } @@ -1091,7 +1091,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool } else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC)) { - msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name); + msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name); free_turn(creature_ptr); oktomove = FALSE; disturb(p_ptr, FALSE, TRUE); @@ -1305,7 +1305,7 @@ static bool see_wall(DIRECTION dir, POSITION y, POSITION x) if (!in_bounds2(y, x)) return (FALSE); /* Access grid */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Must be known to the player */ if (g_ptr->info & (CAVE_MARK)) @@ -1348,7 +1348,7 @@ static bool see_nothing(DIRECTION dir, POSITION y, POSITION x) if (!in_bounds2(y, x)) return (TRUE); /* Memorized grids are always known */ - if (current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) return (FALSE); + if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) return (FALSE); /* Viewable door/wall grids are known */ if (player_can_see_bold(y, x)) return (FALSE); @@ -1523,13 +1523,13 @@ static bool run_test(void) /* break run when leaving trap detected region */ if ((disturb_trap_detect || alert_trap_detect) - && p_ptr->dtrap && !(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) + && p_ptr->dtrap && !(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) { /* No duplicate warning */ p_ptr->dtrap = FALSE; /* You are just on the edge */ - if (!(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) + if (!(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) { if (alert_trap_detect) { @@ -1557,7 +1557,7 @@ static bool run_test(void) col = p_ptr->x + ddx[new_dir]; /* Access grid */ - g_ptr = ¤t_floor_ptr->grid_array[row][col]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[row][col]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -1566,7 +1566,7 @@ static bool run_test(void) /* Visible monsters abort running */ if (g_ptr->m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Visible monster */ if (m_ptr->ml) return (TRUE); @@ -1576,7 +1576,7 @@ static bool run_test(void) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Visible object */ @@ -1914,13 +1914,13 @@ static DIRECTION travel_test(DIRECTION prev_dir) /* break run when leaving trap detected region */ if ((disturb_trap_detect || alert_trap_detect) - && p_ptr->dtrap && !(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) + && p_ptr->dtrap && !(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) { /* No duplicate warning */ p_ptr->dtrap = FALSE; /* You are just on the edge */ - if (!(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) + if (!(p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) { if (alert_trap_detect) { @@ -1949,12 +1949,12 @@ static DIRECTION travel_test(DIRECTION prev_dir) POSITION col = p_ptr->x + ddx[dir]; /* Access grid */ - g_ptr = ¤t_floor_ptr->grid_array[row][col]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[row][col]; /* Visible monsters abort running */ if (g_ptr->m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Visible monster */ if (m_ptr->ml) return (0); @@ -1979,7 +1979,7 @@ static DIRECTION travel_test(DIRECTION prev_dir) if (!new_dir) return (0); /* Access newly move grid */ - g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]]; /* Close door abort traveling */ if (!easy_open && is_closed_door(g_ptr->feat)) return (0); @@ -2050,9 +2050,9 @@ void forget_travel_flow(void) { POSITION x, y; /* Check the entire dungeon / Forget the old data */ - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { travel.cost[y][x] = MAX_SHORT; @@ -2069,7 +2069,7 @@ void forget_travel_flow(void) */ static int travel_flow_cost(POSITION y, POSITION x) { - feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[y][x].feat]; + feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat]; int cost = 1; /* Avoid obstacles (ex. trees) */ @@ -2093,7 +2093,7 @@ static int travel_flow_cost(POSITION y, POSITION x) } /* Detected traps and doors */ - if (current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) + if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) { if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1; if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10; @@ -2112,7 +2112,7 @@ static int travel_flow_cost(POSITION y, POSITION x) */ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; int old_head = flow_head; int add_cost = 1; @@ -2121,15 +2121,15 @@ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall) int cost; /* Ignore out of bounds */ - if (!in_bounds(current_floor_ptr, y, x)) return; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; /* Ignore unknown grid except in wilderness */ - if (current_floor_ptr->dun_level > 0 && !(g_ptr->info & CAVE_KNOWN)) return; + if (p_ptr->current_floor_ptr->dun_level > 0 && !(g_ptr->info & CAVE_KNOWN)) return; /* Ignore "walls" and "rubble" (include "secret doors") */ if (have_flag(f_ptr->flags, FF_WALL) || have_flag(f_ptr->flags, FF_CAN_DIG) || - (have_flag(f_ptr->flags, FF_DOOR) && current_floor_ptr->grid_array[y][x].mimic) || + (have_flag(f_ptr->flags, FF_DOOR) && p_ptr->current_floor_ptr->grid_array[y][x].mimic) || (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation)) { if (!wall || !from_wall) return; @@ -2172,7 +2172,7 @@ static void travel_flow(POSITION ty, POSITION tx) POSITION x, y; DIRECTION d; bool wall = FALSE; - feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat]; + feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat]; /* Reset the "queue" */ flow_head = flow_tail = 0; @@ -2233,12 +2233,12 @@ void do_cmd_travel(player_type *creature_ptr) return; } - f_ptr = &f_info[current_floor_ptr->grid_array[y][x].feat]; + f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat]; - if ((current_floor_ptr->grid_array[y][x].info & CAVE_MARK) && + if ((p_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_MARK) && (have_flag(f_ptr->flags, FF_WALL) || have_flag(f_ptr->flags, FF_CAN_DIG) || - (have_flag(f_ptr->flags, FF_DOOR) && current_floor_ptr->grid_array[y][x].mimic))) + (have_flag(f_ptr->flags, FF_DOOR) && p_ptr->current_floor_ptr->grid_array[y][x].mimic))) { msg_print(_("そこには行くことができません!", "You cannot travel there!")); return; diff --git a/src/player-status.c b/src/player-status.c index 008e5bbaa..186ee09e8 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -1405,7 +1405,7 @@ void calc_bonuses(player_type *creature_ptr) bool old_mighty_throw = creature_ptr->mighty_throw; /* Current feature under player. */ - feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat]; + feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat]; /* Save the old armor class */ ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac; @@ -3070,7 +3070,7 @@ void calc_bonuses(player_type *creature_ptr) } else { - monster_type *riding_m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding]; + monster_type *riding_m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding]; monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx]; SPEED speed = riding_m_ptr->mspeed; @@ -3439,7 +3439,7 @@ void calc_bonuses(player_type *creature_ptr) } else { - penalty = r_info[current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80; + penalty = r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80; penalty += 30; if (penalty < 30) penalty = 30; } @@ -3478,7 +3478,7 @@ void calc_bonuses(player_type *creature_ptr) } else { - penalty = r_info[current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80; + penalty = r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80; penalty += 30; if (penalty < 30) penalty = 30; } @@ -3875,9 +3875,9 @@ void calc_bonuses(player_type *creature_ptr) if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_kabe = TRUE; } - for (this_o_idx = current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; #if 0 @@ -3922,11 +3922,11 @@ static void calc_alignment(player_type *creature_ptr) creature_ptr->align = 0; int i, j, neutral[2]; - for (m_idx = current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) + for (m_idx = p_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) { monster_type *m_ptr; monster_race *r_ptr; - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if (!monster_is_valid(m_ptr)) continue; r_ptr = &r_info[m_ptr->r_idx]; @@ -5045,7 +5045,7 @@ void update_creature(player_type *creature_ptr) if (creature_ptr->update & (PU_UN_LITE)) { creature_ptr->update &= ~(PU_UN_LITE); - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); } if (creature_ptr->update & (PU_UN_VIEW)) @@ -5057,7 +5057,7 @@ void update_creature(player_type *creature_ptr) if (creature_ptr->update & (PU_VIEW)) { creature_ptr->update &= ~(PU_VIEW); - update_view(creature_ptr, current_floor_ptr); + update_view(creature_ptr, p_ptr->current_floor_ptr); } if (creature_ptr->update & (PU_LITE)) @@ -5086,7 +5086,7 @@ void update_creature(player_type *creature_ptr) if (creature_ptr->update & (PU_MON_LITE)) { creature_ptr->update &= ~(PU_MON_LITE); - update_mon_lite(current_floor_ptr); + update_mon_lite(p_ptr->current_floor_ptr); } /* @@ -5121,9 +5121,9 @@ bool player_has_no_spellbooks(player_type *creature_ptr) if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE; } - for (i = current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx) + for (i = p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx) { - o_ptr = ¤t_floor_ptr->o_list[i]; + o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE; } @@ -5149,7 +5149,7 @@ void free_turn(player_type *creature_ptr) bool player_place(player_type *creature_ptr, POSITION y, POSITION x) { /* Paranoia XXX XXX */ - if (current_floor_ptr->grid_array[y][x].m_idx != 0) return FALSE; + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) return FALSE; /* Save player location */ creature_ptr->y = y; @@ -5167,7 +5167,7 @@ void wreck_the_pattern(player_type *creature_ptr) { int to_ruin = 0; POSITION r_y, r_x; - int pattern_type = f_info[current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype; + int pattern_type = f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype; if (pattern_type == PATTERN_TILE_WRECKED) { @@ -5186,7 +5186,7 @@ void wreck_the_pattern(player_type *creature_ptr) scatter(&r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0); if (pattern_tile(r_y, r_x) && - (f_info[current_floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED)) + (f_info[p_ptr->current_floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED)) { cave_set_feat(r_y, r_x, feat_pattern_corrupted); } @@ -5846,7 +5846,7 @@ void cheat_death(player_type *creature_ptr) /* Hack -- Prevent starvation */ (void)set_food(creature_ptr, PY_FOOD_MAX - 1); - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; creature_ptr->inside_arena = FALSE; creature_ptr->phase_out = FALSE; leaving_quest = 0; diff --git a/src/player-status.h b/src/player-status.h index 24ffbb293..6854385a4 100644 --- a/src/player-status.h +++ b/src/player-status.h @@ -1,5 +1,7 @@ #pragma once +#include "floor.h" + /* * Most of the "player" information goes here. * @@ -79,6 +81,7 @@ extern const concptr stat_names[6]; extern const concptr stat_names_reduced[6]; typedef struct player_type player_type; +struct floor_type; struct player_type { @@ -86,6 +89,7 @@ struct player_type int player_euid; int player_egid; + floor_type *current_floor_ptr; POSITION oldpy; /* Previous player location -KMW- */ POSITION oldpx; /* Previous player location -KMW- */ diff --git a/src/quest.c b/src/quest.c index 7704764b2..52f70ab5d 100644 --- a/src/quest.c +++ b/src/quest.c @@ -150,7 +150,7 @@ void check_quest_completion(monster_type *m_ptr) continue; /* Quest is not on this level */ - if ((q_ptr->level != current_floor_ptr->dun_level) && + if ((q_ptr->level != p_ptr->current_floor_ptr->dun_level) && (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL)) continue; @@ -200,7 +200,7 @@ void check_quest_completion(monster_type *m_ptr) { if (!is_hostile(m_ptr)) break; - if (count_all_hostile_monsters(current_floor_ptr) == 1) + if (count_all_hostile_monsters(p_ptr->current_floor_ptr) == 1) { if (q_ptr->flags & QUEST_FLAG_SILENT) { @@ -260,7 +260,7 @@ void check_quest_completion(monster_type *m_ptr) { if (!is_hostile(m_ptr)) break; - if (count_all_hostile_monsters(current_floor_ptr) == 1) + if (count_all_hostile_monsters(p_ptr->current_floor_ptr) == 1) { q_ptr->status = QUEST_STATUS_STAGE_COMPLETED; @@ -283,7 +283,7 @@ void check_quest_completion(monster_type *m_ptr) POSITION ny, nx; /* Stagger around */ - while (cave_perma_bold(y, x) || current_floor_ptr->grid_array[y][x].o_idx || (current_floor_ptr->grid_array[y][x].info & CAVE_OBJECT)) + while (cave_perma_bold(y, x) || p_ptr->current_floor_ptr->grid_array[y][x].o_idx || (p_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_OBJECT)) { /* Pick a location */ scatter(&ny, &nx, y, x, 1, 0); @@ -309,7 +309,7 @@ void check_quest_completion(monster_type *m_ptr) { int i; - for (i = 0; i < (current_floor_ptr->dun_level / 15) + 1; i++) + for (i = 0; i < (p_ptr->current_floor_ptr->dun_level / 15) + 1; i++) { o_ptr = &forge; object_wipe(o_ptr); @@ -547,8 +547,8 @@ void do_cmd_quest(void) leave_quest_check(); - if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) current_floor_ptr->dun_level = 1; - p_ptr->inside_quest = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special; + if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) p_ptr->current_floor_ptr->dun_level = 1; + p_ptr->inside_quest = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special; p_ptr->leaving = TRUE; } diff --git a/src/realm-hex.c b/src/realm-hex.c index a5c2367ad..437a5ebee 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -226,11 +226,11 @@ void check_hex(void) if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER) p_ptr->spell_exp[spell] += 5; else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED) - { if (one_in_(2) && (current_floor_ptr->dun_level > 4) && ((current_floor_ptr->dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; } + { if (one_in_(2) && (p_ptr->current_floor_ptr->dun_level > 4) && ((p_ptr->current_floor_ptr->dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; } else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT) - { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > p_ptr->lev) && ((current_floor_ptr->dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; } + { if (one_in_(5) && ((p_ptr->current_floor_ptr->dun_level + 5) > p_ptr->lev) && ((p_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; } else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER) - { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > p_ptr->lev) && (current_floor_ptr->dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; } + { if (one_in_(5) && ((p_ptr->current_floor_ptr->dun_level + 5) > p_ptr->lev) && (p_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; } } /* Do any effects of continual spells */ @@ -292,7 +292,7 @@ void revenge_store(HIT_POINT dam) */ bool teleport_barrier(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!hex_spelling(HEX_ANTI_TELE)) return FALSE; @@ -308,7 +308,7 @@ bool teleport_barrier(MONSTER_IDX m_idx) */ bool magic_barrier(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!hex_spelling(HEX_ANTI_MAGIC)) return FALSE; @@ -324,7 +324,7 @@ bool magic_barrier(MONSTER_IDX m_idx) */ bool multiply_barrier(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!hex_spelling(HEX_ANTI_MULTI)) return FALSE; @@ -1023,10 +1023,10 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) int dy = y + ddy_ddd[dir]; int dx = x + ddx_ddd[dir]; if (dir == 5) continue; - if (current_floor_ptr->grid_array[dy][dx].m_idx) flag = TRUE; + if (p_ptr->current_floor_ptr->grid_array[dy][dx].m_idx) flag = TRUE; } - if (!cave_empty_bold(y, x) || (current_floor_ptr->grid_array[y][x].info & CAVE_ICKY) || + if (!cave_empty_bold(y, x) || (p_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_ICKY) || (distance(y, x, caster_ptr->y, caster_ptr->x) > plev + 2)) { msg_print(_("そこには移動できない。", "Can not teleport to there.")); diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 4f7a1cffd..78deb5f13 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -72,21 +72,21 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy_cdd[cdir]; x = caster_ptr->x + ddx_cdd[cdir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); y = caster_ptr->y + ddy_cdd[(cdir + 7) % 8]; x = caster_ptr->x + ddx_cdd[(cdir + 7) % 8]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); y = caster_ptr->y + ddy_cdd[(cdir + 1) % 8]; x = caster_ptr->x + ddx_cdd[(cdir + 1) % 8]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); @@ -118,7 +118,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_FIRE); else { @@ -152,7 +152,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_MINEUCHI); else { @@ -200,7 +200,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (!current_floor_ptr->grid_array[y][x].m_idx) + if (!p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return NULL; @@ -208,13 +208,13 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo py_attack(p_ptr, y, x, 0); - if (!player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(current_floor_ptr->grid_array[y][x].feat)) + if (!player_can_enter(p_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(p_ptr->current_floor_ptr->grid_array[y][x].feat)) break; y += ddy[dir]; x += ddx[dir]; - if (player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx) + if (player_can_enter(p_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(p_ptr->current_floor_ptr->grid_array[y][x].feat) && !p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { msg_print(NULL); (void)move_player_effect(caster_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); @@ -236,7 +236,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_POISON); else { @@ -261,7 +261,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_ZANMA); else { @@ -285,7 +285,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, 0); else { @@ -296,13 +296,13 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo { return ""; } - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { int i; POSITION ty = y, tx = x; POSITION oy = y, ox = x; - MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + MONSTER_IDX m_idx = p_ptr->current_floor_ptr->grid_array[y][x].m_idx; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; GAME_TEXT m_name[MAX_NLEN]; monster_desc(m_name, m_ptr, 0); @@ -321,8 +321,8 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo if ((ty != oy) || (tx != ox)) { msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name); - current_floor_ptr->grid_array[oy][ox].m_idx = 0; - current_floor_ptr->grid_array[ty][tx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx; m_ptr->fy = ty; m_ptr->fx = tx; @@ -369,7 +369,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_HAGAN); if (!cave_have_flag_bold(y, x, FF_HURT_ROCK)) break; @@ -395,7 +395,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_COLD); else { @@ -420,7 +420,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_KYUSHO); else { @@ -445,7 +445,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_MAJIN); else { @@ -470,7 +470,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_SUTEMI); else { @@ -496,7 +496,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_ELEC); else { @@ -537,8 +537,8 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo { y = caster_ptr->y + ddy_ddd[dir]; x = caster_ptr->x + ddx_ddd[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- attack monsters */ if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT))) @@ -570,7 +570,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_QUAKE); else earthquake(caster_ptr->y, caster_ptr->x, 10, 0); @@ -652,7 +652,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (g_ptr->m_idx) py_attack(p_ptr, y, x, HISSATSU_3DAN); @@ -673,7 +673,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo ny = y + ddy[dir]; nx = x + ddx[dir]; m_idx = g_ptr->m_idx; - m_ptr = ¤t_floor_ptr->m_list[m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; /* Monster cannot move back? */ if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0)) @@ -684,7 +684,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo } g_ptr->m_idx = 0; - current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; m_ptr->fy = ny; m_ptr->fx = nx; @@ -727,7 +727,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_DRAIN); else { @@ -828,10 +828,10 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { py_attack(p_ptr, y, x, 0); - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { handle_stuff(); py_attack(p_ptr, y, x, 0); @@ -912,7 +912,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo y = caster_ptr->y + ddy[dir]; x = caster_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) py_attack(p_ptr, y, x, HISSATSU_UNDEAD); else { diff --git a/src/realm-life.c b/src/realm-life.c index 217f4a05d..989f7ec91 100644 --- a/src/realm-life.c +++ b/src/realm-life.c @@ -373,7 +373,7 @@ concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) { if (cast) { - current_floor_ptr->num_repro += MAX_REPRO; + p_ptr->current_floor_ptr->num_repro += MAX_REPRO; } } break; diff --git a/src/report.c b/src/report.c index c0213b53a..57b369938 100644 --- a/src/report.c +++ b/src/report.c @@ -484,7 +484,7 @@ errr report_score(void) #endif buf_sprintf(score, "score: %d\n", calc_score(p_ptr)); buf_sprintf(score, "level: %d\n", p_ptr->lev); - buf_sprintf(score, "depth: %d\n", current_floor_ptr->dun_level); + buf_sprintf(score, "depth: %d\n", p_ptr->current_floor_ptr->dun_level); buf_sprintf(score, "maxlv: %d\n", p_ptr->max_plv); buf_sprintf(score, "maxdp: %d\n", max_dlv[DUNGEON_ANGBAND]); buf_sprintf(score, "au: %d\n", p_ptr->au); diff --git a/src/rooms-city.c b/src/rooms-city.c index 2e3dc4d04..295baff02 100644 --- a/src/rooms-city.c +++ b/src/rooms-city.c @@ -184,7 +184,7 @@ static void build_stores(POSITION ltcy, POSITION ltcx, int stores[], int n) * Town logic flow for generation of new town\n * Originally from Vanilla 3.0.3\n *\n -* We start with a fully wiped current_floor_ptr->grid_array of normal floors.\n +* We start with a fully wiped p_ptr->current_floor_ptr->grid_array of normal floors.\n *\n * Note that town_gen_hack() plays games with the R.N.G.\n *\n @@ -205,13 +205,13 @@ bool build_type16(void) bool prevent_bm = FALSE; /* Hack -- If already exist black market, prevent building */ - for (y = 0; (y < current_floor_ptr->height) && !prevent_bm; y++) + for (y = 0; (y < p_ptr->current_floor_ptr->height) && !prevent_bm; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - if (current_floor_ptr->grid_array[y][x].feat == FF_STORE) + if (p_ptr->current_floor_ptr->grid_array[y][x].feat == FF_STORE) { - prevent_bm = (f_info[current_floor_ptr->grid_array[y][x].feat].subtype == STORE_BLACK); + prevent_bm = (f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat].subtype == STORE_BLACK); break; } } diff --git a/src/rooms-fractal.c b/src/rooms-fractal.c index d9b8cabd1..010e4290c 100644 --- a/src/rooms-fractal.c +++ b/src/rooms-fractal.c @@ -7,7 +7,7 @@ #include "dungeon.h" /*! -* @brief タイプ9の部屋…フラクタルカーブによる洞窟生成 / Type 9 -- Driver routine to create fractal current_floor_ptr->grid_array system +* @brief タイプ9の部屋…フラクタルカーブによる洞窟生成 / Type 9 -- Driver routine to create fractal p_ptr->current_floor_ptr->grid_array system * @return なし */ bool build_type9(void) @@ -35,14 +35,14 @@ bool build_type9(void) * Still no space?! * Try normal room */ - return build_type1(current_floor_ptr); + return build_type1(p_ptr->current_floor_ptr); } } light = done = FALSE; room = TRUE; - if ((current_floor_ptr->dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; + if ((p_ptr->current_floor_ptr->dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; while (!done) { diff --git a/src/rooms-pitnest.c b/src/rooms-pitnest.c index 65f02c371..86c88ea3e 100644 --- a/src/rooms-pitnest.c +++ b/src/rooms-pitnest.c @@ -73,13 +73,13 @@ static int pick_vault_type(vault_aux_type *l_ptr, BIT_FLAGS16 allow_flag_mask) if (!n_ptr->name) break; /* Ignore excessive depth */ - if (n_ptr->level > current_floor_ptr->dun_level) continue; + if (n_ptr->level > p_ptr->current_floor_ptr->dun_level) continue; /* Not matched with pit/nest flag */ if (!(allow_flag_mask & (1L << count))) continue; /* Count this possibility */ - total += n_ptr->chance * MAX_DEPTH / (MIN(current_floor_ptr->dun_level, MAX_DEPTH - 1) - n_ptr->level + 5); + total += n_ptr->chance * MAX_DEPTH / (MIN(p_ptr->current_floor_ptr->dun_level, MAX_DEPTH - 1) - n_ptr->level + 5); } /* Pick a random type */ @@ -92,13 +92,13 @@ static int pick_vault_type(vault_aux_type *l_ptr, BIT_FLAGS16 allow_flag_mask) if (!n_ptr->name) break; /* Ignore excessive depth */ - if (n_ptr->level > current_floor_ptr->dun_level) continue; + if (n_ptr->level > p_ptr->current_floor_ptr->dun_level) continue; /* Not matched with pit/nest flag */ if (!(allow_flag_mask & (1L << count))) continue; /* Count this possibility */ - total += n_ptr->chance * MAX_DEPTH / (MIN(current_floor_ptr->dun_level, MAX_DEPTH - 1) - n_ptr->level + 5); + total += n_ptr->chance * MAX_DEPTH / (MIN(p_ptr->current_floor_ptr->dun_level, MAX_DEPTH - 1) - n_ptr->level + 5); /* Found the type */ if (tmp < total) break; diff --git a/src/rooms-special.c b/src/rooms-special.c index f867c363d..87df79196 100644 --- a/src/rooms-special.c +++ b/src/rooms-special.c @@ -32,7 +32,7 @@ bool build_type15(void) if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE; /* Choose lite or dark */ - light = ((current_floor_ptr->dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((p_ptr->current_floor_ptr->dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* Get corner values */ y1 = yval - ysize / 2; @@ -45,7 +45,7 @@ bool build_type15(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->feat = feat_glass_floor; g_ptr->info |= (CAVE_ROOM); @@ -56,19 +56,19 @@ bool build_type15(void) /* Walls around the room */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x1 - 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = ¤t_floor_ptr->grid_array[y][x2 + 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); g_ptr->feat = feat_glass_wall; } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y1 - 1][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = ¤t_floor_ptr->grid_array[y2 + 1][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); g_ptr->feat = feat_glass_wall; } @@ -83,7 +83,7 @@ bool build_type15(void) /* Place fixed lite berathers */ for (dir1 = 4; dir1 < 8; dir1++) { - MONRACE_IDX r_idx = get_mon_num(current_floor_ptr->dun_level); + MONRACE_IDX r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level); y = yval + 2 * ddy_ddd[dir1]; x = xval + 2 * ddx_ddd[dir1]; @@ -92,7 +92,7 @@ bool build_type15(void) /* Walls around the breather */ for (dir2 = 0; dir2 < 8; dir2++) { - g_ptr = ¤t_floor_ptr->grid_array[y + ddy_ddd[dir2]][x + ddx_ddd[dir2]]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y + ddy_ddd[dir2]][x + ddx_ddd[dir2]]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } @@ -103,10 +103,10 @@ bool build_type15(void) { y = yval + 2 * ddy_ddd[dir1]; x = xval + 2 * ddx_ddd[dir1]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; place_inner_perm_grid(g_ptr); g_ptr->feat = feat_permanent_glass_wall; - current_floor_ptr->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]].info |= (CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]].info |= (CAVE_ICKY); } /* Glass door */ @@ -114,13 +114,13 @@ bool build_type15(void) y = yval + 2 * ddy_ddd[dir1]; x = xval + 2 * ddx_ddd[dir1]; place_secret_door(y, x, DOOR_GLASS_DOOR); - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (is_closed_door(g_ptr->feat)) g_ptr->mimic = feat_glass_wall; /* Place a potion */ get_obj_num_hook = kind_is_potion; place_object(yval, xval, AM_NO_FIXED_ART); - current_floor_ptr->grid_array[yval][xval].info |= (CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[yval][xval].info |= (CAVE_ICKY); } break; @@ -130,30 +130,30 @@ bool build_type15(void) DIRECTION dir1; /* Pillars */ - g_ptr = ¤t_floor_ptr->grid_array[y1 + 1][x1 + 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y1 + 1][x1 + 1]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = ¤t_floor_ptr->grid_array[y1 + 1][x2 - 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y1 + 1][x2 - 1]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = ¤t_floor_ptr->grid_array[y2 - 1][x1 + 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y2 - 1][x1 + 1]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = ¤t_floor_ptr->grid_array[y2 - 1][x2 - 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y2 - 1][x2 - 1]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; get_mon_num_prep(vault_aux_lite, NULL); - r_idx = get_mon_num(current_floor_ptr->dun_level); + r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level); if (r_idx) place_monster_aux(0, yval, xval, r_idx, 0L); /* Walls around the breather */ for (dir1 = 0; dir1 < 8; dir1++) { - g_ptr = ¤t_floor_ptr->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } @@ -172,7 +172,7 @@ bool build_type15(void) /* Place an object */ place_object(yval, xval, AM_NO_FIXED_ART); - current_floor_ptr->grid_array[yval][xval].info |= (CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[yval][xval].info |= (CAVE_ICKY); } break; @@ -183,25 +183,25 @@ bool build_type15(void) /* Walls around the potion */ for (y = yval - 2; y <= yval + 2; y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][xval - 3]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][xval - 3]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = ¤t_floor_ptr->grid_array[y][xval + 3]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][xval + 3]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } for (x = xval - 2; x <= xval + 2; x++) { - g_ptr = ¤t_floor_ptr->grid_array[yval - 3][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yval - 3][x]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; - g_ptr = ¤t_floor_ptr->grid_array[yval + 3][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yval + 3][x]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } for (dir1 = 4; dir1 < 8; dir1++) { - g_ptr = ¤t_floor_ptr->grid_array[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]]; place_inner_grid(g_ptr); g_ptr->feat = feat_glass_wall; } @@ -210,7 +210,7 @@ bool build_type15(void) /* Place shard berathers */ for (dir1 = 4; dir1 < 8; dir1++) { - MONRACE_IDX r_idx = get_mon_num(current_floor_ptr->dun_level); + MONRACE_IDX r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level); y = yval + ddy_ddd[dir1]; x = xval + ddx_ddd[dir1]; @@ -235,7 +235,7 @@ bool build_type15(void) for (y = yval - 2; y <= yval + 2; y++) for (x = xval - 2; x <= xval + 2; x++) - current_floor_ptr->grid_array[y][x].info |= (CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y][x].info |= (CAVE_ICKY); } break; diff --git a/src/rooms-trap.c b/src/rooms-trap.c index ece3060e9..a8625f8f7 100644 --- a/src/rooms-trap.c +++ b/src/rooms-trap.c @@ -37,7 +37,7 @@ bool build_type14(void) if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE; /* Choose lite or dark */ - light = ((current_floor_ptr->dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((p_ptr->current_floor_ptr->dun_level <= randint1(25)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); /* Get corner values */ @@ -52,7 +52,7 @@ bool build_type14(void) { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -62,26 +62,26 @@ bool build_type14(void) /* Walls around the room */ for (y = y1 - 1; y <= y2 + 1; y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x1 - 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x1 - 1]; place_outer_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y][x2 + 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x2 + 1]; place_outer_grid(g_ptr); } for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y1 - 1][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y1 - 1][x]; place_outer_grid(g_ptr); - g_ptr = ¤t_floor_ptr->grid_array[y2 + 1][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y2 + 1][x]; place_outer_grid(g_ptr); } - if (current_floor_ptr->dun_level < 30 + randint1(30)) + if (p_ptr->current_floor_ptr->dun_level < 30 + randint1(30)) trap = feat_trap_piranha; else trap = feat_trap_armageddon; /* Place a special trap */ - g_ptr = ¤t_floor_ptr->grid_array[rand_spread(yval, ysize / 4)][rand_spread(xval, xsize / 4)]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[rand_spread(yval, ysize / 4)][rand_spread(xval, xsize / 4)]; g_ptr->mimic = g_ptr->feat; g_ptr->feat = trap; diff --git a/src/rooms-vault.c b/src/rooms-vault.c index c2d56f7d9..ff0cc732d 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -190,7 +190,7 @@ static void build_room_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION POSITION y = y0 - yhsize + y1; place_extra_bold(y, x); - current_floor_ptr->grid_array[y][x].info &= (~CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y][x].info &= (~CAVE_ICKY); } } @@ -213,11 +213,11 @@ static void build_room_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION } /* Fill with monsters and treasure, high difficulty */ - fill_treasure(current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5); + fill_treasure(p_ptr->current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5); } -/* Create a random vault out of a fractal current_floor_ptr->grid_array */ +/* Create a random vault out of a fractal p_ptr->current_floor_ptr->grid_array */ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION ysiz) { int grd, roug, cutoff; @@ -259,12 +259,12 @@ static void build_cave_vault(POSITION x0, POSITION y0, POSITION xsiz, POSITION y { for (y = 0; y <= ysize; y++) { - current_floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY; + p_ptr->current_floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY; } } /* Fill with monsters and treasure, low difficulty */ - fill_treasure(current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5)); + fill_treasure(p_ptr->current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5)); } @@ -358,7 +358,7 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm /* Hack -- skip "non-grids" */ if (*t == ' ') continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Lay down a floor */ place_floor_grid(g_ptr); @@ -444,92 +444,92 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm /* Black market in a dungeon */ case 'S': - set_cave_feat(current_floor_ptr, y, x, feat_black_market); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_black_market); store_init(NO_TOWN, STORE_BLACK); break; /* The Pattern */ case 'p': - set_cave_feat(current_floor_ptr, y, x, feat_pattern_start); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_start); break; case 'a': - set_cave_feat(current_floor_ptr, y, x, feat_pattern_1); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_1); break; case 'b': - set_cave_feat(current_floor_ptr, y, x, feat_pattern_2); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_2); break; case 'c': - set_cave_feat(current_floor_ptr, y, x, feat_pattern_3); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_3); break; case 'd': - set_cave_feat(current_floor_ptr, y, x, feat_pattern_4); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_4); break; case 'P': - set_cave_feat(current_floor_ptr, y, x, feat_pattern_end); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_end); break; case 'B': - set_cave_feat(current_floor_ptr, y, x, feat_pattern_exit); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_pattern_exit); break; case 'A': /* Reward for Pattern walk */ - current_floor_ptr->object_level = current_floor_ptr->base_level + 12; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + 12; place_object(y, x, AM_GOOD | AM_GREAT); - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; break; case '~': - set_cave_feat(current_floor_ptr, y, x, feat_shallow_water); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_shallow_water); break; case '=': - set_cave_feat(current_floor_ptr, y, x, feat_deep_water); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_deep_water); break; case 'v': - set_cave_feat(current_floor_ptr, y, x, feat_shallow_lava); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_shallow_lava); break; case 'w': - set_cave_feat(current_floor_ptr, y, x, feat_deep_lava); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_deep_lava); break; case 'f': - set_cave_feat(current_floor_ptr, y, x, feat_shallow_acid_puddle); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_shallow_acid_puddle); break; case 'F': - set_cave_feat(current_floor_ptr, y, x, feat_deep_acid_puddle); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_deep_acid_puddle); break; case 'g': - set_cave_feat(current_floor_ptr, y, x, feat_shallow_poisonous_puddle); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_shallow_poisonous_puddle); break; case 'G': - set_cave_feat(current_floor_ptr, y, x, feat_deep_poisonous_puddle); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_deep_poisonous_puddle); break; case 'h': - set_cave_feat(current_floor_ptr, y, x, feat_cold_zone); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_cold_zone); break; case 'H': - set_cave_feat(current_floor_ptr, y, x, feat_heavy_cold_zone); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_heavy_cold_zone); break; case 'i': - set_cave_feat(current_floor_ptr, y, x, feat_electrical_zone); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_electrical_zone); break; case 'I': - set_cave_feat(current_floor_ptr, y, x, feat_heavy_electrical_zone); + set_cave_feat(p_ptr->current_floor_ptr, y, x, feat_heavy_electrical_zone); break; } @@ -570,42 +570,42 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm { case '&': { - current_floor_ptr->monster_level = current_floor_ptr->base_level + 5; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 5; place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP)); - current_floor_ptr->monster_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; break; } /* Meaner monster */ case '@': { - current_floor_ptr->monster_level = current_floor_ptr->base_level + 11; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 11; place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP)); - current_floor_ptr->monster_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; break; } /* Meaner monster, plus treasure */ case '9': { - current_floor_ptr->monster_level = current_floor_ptr->base_level + 9; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 9; place_monster(y, x, PM_ALLOW_SLEEP); - current_floor_ptr->monster_level = current_floor_ptr->base_level; - current_floor_ptr->object_level = current_floor_ptr->base_level + 7; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + 7; place_object(y, x, AM_GOOD); - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; break; } /* Nasty monster and treasure */ case '8': { - current_floor_ptr->monster_level = current_floor_ptr->base_level + 40; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 40; place_monster(y, x, PM_ALLOW_SLEEP); - current_floor_ptr->monster_level = current_floor_ptr->base_level; - current_floor_ptr->object_level = current_floor_ptr->base_level + 20; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + 20; place_object(y, x, AM_GOOD | AM_GREAT); - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; break; } @@ -614,15 +614,15 @@ static void build_vault(POSITION yval, POSITION xval, POSITION ymax, POSITION xm { if (randint0(100) < 50) { - current_floor_ptr->monster_level = current_floor_ptr->base_level + 3; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level + 3; place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP)); - current_floor_ptr->monster_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; } if (randint0(100) < 50) { - current_floor_ptr->object_level = current_floor_ptr->base_level + 7; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level + 7; place_object(y, x, 0L); - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; } break; } @@ -672,7 +672,7 @@ bool build_type7(void) y = v_ptr->hgt; /* Some huge vault cannot be ratated to fit in the dungeon */ - if (x + 2 > current_floor_ptr->height - 2) + if (x + 2 > p_ptr->current_floor_ptr->height - 2) { /* Forbid 90 or 270 degree ratation */ transno &= ~1; @@ -752,7 +752,7 @@ bool build_type8(void) y = v_ptr->hgt; /* Some huge vault cannot be ratated to fit in the dungeon */ - if (x + 2 > current_floor_ptr->height - 2) + if (x + 2 > p_ptr->current_floor_ptr->height - 2) { /* Forbid 90 or 270 degree ratation */ transno &= ~1; @@ -835,10 +835,10 @@ static void build_target_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO for (y = y0 - rad; y <= y0 + rad; y++) { /* clear room flag */ - current_floor_ptr->grid_array[y][x].info &= ~(CAVE_ROOM); + p_ptr->current_floor_ptr->grid_array[y][x].info &= ~(CAVE_ROOM); /* Vault - so is "icky" */ - current_floor_ptr->grid_array[y][x].info |= CAVE_ICKY; + p_ptr->current_floor_ptr->grid_array[y][x].info |= CAVE_ICKY; if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1) { @@ -918,7 +918,7 @@ static void build_target_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO add_door(x0, y0 - y); /* Fill with stuff - medium difficulty */ - fill_treasure(current_floor_ptr, x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3); + fill_treasure(p_ptr->current_floor_ptr, x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3); } @@ -947,17 +947,17 @@ static void build_elemental_vault(POSITION x0, POSITION y0, POSITION xsiz, POSIT xsize = xhsize * 2; ysize = yhsize * 2; - if (current_floor_ptr->dun_level < 25) + if (p_ptr->current_floor_ptr->dun_level < 25) { /* Earth vault (Rubble) */ type = LAKE_T_EARTH_VAULT; } - else if (current_floor_ptr->dun_level < 50) + else if (p_ptr->current_floor_ptr->dun_level < 50) { /* Air vault (Trees) */ type = LAKE_T_AIR_VAULT; } - else if (current_floor_ptr->dun_level < 75) + else if (p_ptr->current_floor_ptr->dun_level < 75) { /* Water vault (shallow water) */ type = LAKE_T_WATER_VAULT; @@ -998,7 +998,7 @@ static void build_elemental_vault(POSITION x0, POSITION y0, POSITION xsiz, POSIT { for (y = 0; y <= ysize; y++) { - current_floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY; + p_ptr->current_floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY; } } @@ -1010,7 +1010,7 @@ static void build_elemental_vault(POSITION x0, POSITION y0, POSITION xsiz, POSIT } /* Fill with monsters and treasure, low difficulty */ - fill_treasure(current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, + fill_treasure(p_ptr->current_floor_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5)); } #endif /* ALLOW_CAVERNS_AND_LAKES */ @@ -1045,36 +1045,36 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO /* generate the room */ for (x = x1 - 2; x <= x2 + 2; x++) { - if (!in_bounds(current_floor_ptr, y1 - 2, x)) break; + if (!in_bounds(p_ptr->current_floor_ptr, y1 - 2, x)) break; - current_floor_ptr->grid_array[y1 - 2][x].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y1 - 2][x].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y1 - 2, x); } for (x = x1 - 2; x <= x2 + 2; x++) { - if (!in_bounds(current_floor_ptr, y2 + 2, x)) break; + if (!in_bounds(p_ptr->current_floor_ptr, y2 + 2, x)) break; - current_floor_ptr->grid_array[y2 + 2][x].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y2 + 2][x].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y2 + 2, x); } for (y = y1 - 2; y <= y2 + 2; y++) { - if (!in_bounds(current_floor_ptr, y, x1 - 2)) break; + if (!in_bounds(p_ptr->current_floor_ptr, y, x1 - 2)) break; - current_floor_ptr->grid_array[y][x1 - 2].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y][x1 - 2].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y, x1 - 2); } for (y = y1 - 2; y <= y2 + 2; y++) { - if (!in_bounds(current_floor_ptr, y, x2 + 2)) break; + if (!in_bounds(p_ptr->current_floor_ptr, y, x2 + 2)) break; - current_floor_ptr->grid_array[y][x2 + 2].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y][x2 + 2].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y, x2 + 2); } @@ -1083,7 +1083,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { for (x = x1 - 1; x <= x2 + 1; x++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; g_ptr->info |= (CAVE_ROOM | CAVE_ICKY); @@ -1135,7 +1135,7 @@ static void build_mini_c_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO } /* Fill with monsters and treasure, highest difficulty */ - fill_treasure(current_floor_ptr, x1, x2, y1, y2, 10); + fill_treasure(p_ptr->current_floor_ptr, x1, x2, y1, y2, 10); C_KILL(visited, num_vertices, int); } @@ -1168,7 +1168,7 @@ static void build_castle_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO { for (x = x1 - 1; x <= x2 + 1; x++) { - current_floor_ptr->grid_array[y][x].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y][x].info |= (CAVE_ROOM | CAVE_ICKY); /* Make everything a floor */ place_floor_bold(y, x); } @@ -1178,7 +1178,7 @@ static void build_castle_vault(POSITION x0, POSITION y0, POSITION xsize, POSITIO build_recursive_room(x1, y1, x2, y2, randint1(5)); /* Fill with monsters and treasure, low difficulty */ - fill_treasure(current_floor_ptr, x1, x2, y1, y2, randint1(3)); + fill_treasure(p_ptr->current_floor_ptr, x1, x2, y1, y2, randint1(3)); } @@ -1216,7 +1216,7 @@ bool build_type10(void) switch (vtype) { /* Build an appropriate room */ - case 1: case 9: build_bubble_vault(current_floor_ptr, x0, y0, xsize, ysize); break; + case 1: case 9: build_bubble_vault(p_ptr->current_floor_ptr, 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; @@ -1272,7 +1272,7 @@ bool build_type17(void) y = v_ptr->hgt; /* Some huge vault cannot be ratated to fit in the dungeon */ - if (x + 2 > current_floor_ptr->height - 2) + if (x + 2 > p_ptr->current_floor_ptr->height - 2) { /* Forbid 90 or 270 degree ratation */ transno &= ~1; diff --git a/src/rooms.c b/src/rooms.c index dd1d40ab9..df56108c4 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -188,7 +188,7 @@ void build_small_room(POSITION x0, POSITION y0) } /* Clear mimic type */ - current_floor_ptr->grid_array[y0][x0].mimic = 0; + p_ptr->current_floor_ptr->grid_array[y0][x0].mimic = 0; /* Add inner open space */ place_floor_bold(y0, x0); @@ -197,7 +197,7 @@ void build_small_room(POSITION x0, POSITION y0) /*! * @brief * 指定範囲に通路が通っていることを確認した上で床で埋める - * This function tunnels around a room if it will cut off part of a current_floor_ptr->grid_array system. + * This function tunnels around a room if it will cut off part of a p_ptr->current_floor_ptr->grid_array system. * @param x1 範囲の左端 * @param y1 範囲の上端 * @param x2 範囲の右端 @@ -526,7 +526,7 @@ struct fill_data_type static fill_data_type fill_data; -/* Store routine for the fractal current_floor_ptr->grid_array generator */ +/* Store routine for the fractal p_ptr->current_floor_ptr->grid_array generator */ /* this routine probably should be an inline function or a macro. */ static void store_height(POSITION x, POSITION y, FEAT_IDX val) { @@ -536,7 +536,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) (val <= fill_data.c1)) val = fill_data.c1 + 1; /* store the value in height-map format */ - current_floor_ptr->grid_array[y][x].feat = val; + p_ptr->current_floor_ptr->grid_array[y][x].feat = val; return; } @@ -569,7 +569,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) * * How fractal caves are made: * -* When the map is complete, a cut-off value is used to create a current_floor_ptr->grid_array. +* When the map is complete, a cut-off value is used to create a p_ptr->current_floor_ptr->grid_array. * Heights below this value are "floor", and heights above are "wall". * This also can be used to create lakes, by adding more height levels * representing shallow and deep water/ lava etc. @@ -577,7 +577,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) * The grd variable affects the width of passages. * The roug variable affects the roughness of those passages * -* The tricky part is making sure the created current_floor_ptr->grid_array is connected. This +* The tricky part is making sure the created p_ptr->current_floor_ptr->grid_array is connected. This * is done by 'filling' from the inside and only keeping the 'filled' * floor. Walls bounding the 'filled' floor are also kept. Everything * else is converted to the normal _extra_. @@ -585,7 +585,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) /* - * Note that this uses the current_floor_ptr->grid_array.feat array in a very hackish way + * Note that this uses the p_ptr->current_floor_ptr->grid_array.feat array in a very hackish way * the values are first set to zero, and then each array location * is used as a "heightmap" * The heightmap then needs to be converted back into the "feat" format. @@ -593,7 +593,7 @@ static void store_height(POSITION x, POSITION y, FEAT_IDX val) * grd=level at which fractal turns on. smaller gives more mazelike caves * roug=roughness level. 16=normal. higher values make things more convoluted * small values are good for smooth walls. - * size=length of the side of the square current_floor_ptr->grid_array system. + * size=length of the side of the square p_ptr->current_floor_ptr->grid_array system. */ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff) { @@ -654,20 +654,20 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g for (j = 0; j <= ysize; j++) { /* -1 is a flag for "not done yet" */ - current_floor_ptr->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1; - /* Clear icky flag because may be redoing the current_floor_ptr->grid_array */ - current_floor_ptr->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1; + /* Clear icky flag because may be redoing the p_ptr->current_floor_ptr->grid_array */ + p_ptr->current_floor_ptr->grid_array[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY); } } /* Boundaries are walls */ - current_floor_ptr->grid_array[fill_data.ymin][fill_data.xmin].feat = (s16b)maxsize; - current_floor_ptr->grid_array[fill_data.ymax][fill_data.xmin].feat = (s16b)maxsize; - current_floor_ptr->grid_array[fill_data.ymin][fill_data.xmax].feat = (s16b)maxsize; - current_floor_ptr->grid_array[fill_data.ymax][fill_data.xmax].feat = (s16b)maxsize; + p_ptr->current_floor_ptr->grid_array[fill_data.ymin][fill_data.xmin].feat = (s16b)maxsize; + p_ptr->current_floor_ptr->grid_array[fill_data.ymax][fill_data.xmin].feat = (s16b)maxsize; + p_ptr->current_floor_ptr->grid_array[fill_data.ymin][fill_data.xmax].feat = (s16b)maxsize; + p_ptr->current_floor_ptr->grid_array[fill_data.ymax][fill_data.xmax].feat = (s16b)maxsize; /* Set the middle square to be an open area. */ - current_floor_ptr->grid_array[y0][x0].feat = 0; + p_ptr->current_floor_ptr->grid_array[y0][x0].feat = 0; /* Initialize the step sizes */ xstep = xhstep = xsize * 256; @@ -704,7 +704,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g jj = j / 256 + fill_data.ymin; /* Test square */ - if (current_floor_ptr->grid_array[jj][ii].feat == -1) + if (p_ptr->current_floor_ptr->grid_array[jj][ii].feat == -1) { if (xhstep2 > grd) { @@ -715,8 +715,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g { /* Average of left and right points +random bit */ store_height(ii, jj, - (current_floor_ptr->grid_array[jj][fill_data.xmin + (i - xhstep) / 256].feat - + current_floor_ptr->grid_array[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2 + (p_ptr->current_floor_ptr->grid_array[jj][fill_data.xmin + (i - xhstep) / 256].feat + + p_ptr->current_floor_ptr->grid_array[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2 + (randint1(xstep2) - xhstep2) * roug / 16); } } @@ -734,7 +734,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g jj = j / 256 + fill_data.ymin; /* Test square */ - if (current_floor_ptr->grid_array[jj][ii].feat == -1) + if (p_ptr->current_floor_ptr->grid_array[jj][ii].feat == -1) { if (xhstep2 > grd) { @@ -745,8 +745,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g { /* Average of up and down points +random bit */ store_height(ii, jj, - (current_floor_ptr->grid_array[fill_data.ymin + (j - yhstep) / 256][ii].feat - + current_floor_ptr->grid_array[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2 + (p_ptr->current_floor_ptr->grid_array[fill_data.ymin + (j - yhstep) / 256][ii].feat + + p_ptr->current_floor_ptr->grid_array[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2 + (randint1(ystep2) - yhstep2) * roug / 16); } } @@ -763,7 +763,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g jj = j / 256 + fill_data.ymin; /* Test square */ - if (current_floor_ptr->grid_array[jj][ii].feat == -1) + if (p_ptr->current_floor_ptr->grid_array[jj][ii].feat == -1) { if (xhstep2 > grd) { @@ -783,8 +783,8 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g * reduce the effect of the square grid on the shape of the fractal */ store_height(ii, jj, - (current_floor_ptr->grid_array[ym][xm].feat + current_floor_ptr->grid_array[yp][xm].feat - + current_floor_ptr->grid_array[ym][xp].feat + current_floor_ptr->grid_array[yp][xp].feat) / 4 + (p_ptr->current_floor_ptr->grid_array[ym][xm].feat + p_ptr->current_floor_ptr->grid_array[yp][xm].feat + + p_ptr->current_floor_ptr->grid_array[ym][xp].feat + p_ptr->current_floor_ptr->grid_array[yp][xp].feat) / 4 + (randint1(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug); } } @@ -868,7 +868,7 @@ static bool hack_isnt_wall(floor_type *floor_ptr, POSITION y, POSITION x, int c1 /* * Quick and nasty fill routine used to find the connected region - * of floor in the middle of the current_floor_ptr->grid_array + * of floor in the middle of the p_ptr->current_floor_ptr->grid_array */ static void cave_fill(POSITION y, POSITION x) { @@ -904,11 +904,11 @@ static void cave_fill(POSITION y, POSITION x) j = ty + ddy_ddd[d]; i = tx + ddx_ddd[d]; - /* Paranoia Don't leave the current_floor_ptr->grid_array */ - if (!in_bounds(current_floor_ptr, j, i)) + /* Paranoia Don't leave the p_ptr->current_floor_ptr->grid_array */ + if (!in_bounds(p_ptr->current_floor_ptr, j, i)) { /* affect boundary */ - current_floor_ptr->grid_array[j][i].info |= CAVE_ICKY; + p_ptr->current_floor_ptr->grid_array[j][i].info |= CAVE_ICKY; /* return; */ } @@ -917,7 +917,7 @@ static void cave_fill(POSITION y, POSITION x) && (j > fill_data.ymin) && (j < fill_data.ymax)) { /* If not a wall or floor done before */ - if (hack_isnt_wall(current_floor_ptr, j, i, + if (hack_isnt_wall(p_ptr->current_floor_ptr, j, i, fill_data.c1, fill_data.c2, fill_data.c3, fill_data.feat1, fill_data.feat2, fill_data.feat3, fill_data.info1, fill_data.info2, fill_data.info3)) @@ -936,7 +936,7 @@ static void cave_fill(POSITION y, POSITION x) } else { - /* keep tally of size of current_floor_ptr->grid_array system */ + /* keep tally of size of p_ptr->current_floor_ptr->grid_array system */ (fill_data.amount)++; } } @@ -944,7 +944,7 @@ static void cave_fill(POSITION y, POSITION x) else { /* affect boundary */ - current_floor_ptr->grid_array[j][i].info |= CAVE_ICKY; + p_ptr->current_floor_ptr->grid_array[j][i].info |= CAVE_ICKY; } } } @@ -962,7 +962,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, /* - * select region connected to center of current_floor_ptr->grid_array system + * select region connected to center of p_ptr->current_floor_ptr->grid_array system * this gets rid of alot of isolated one-sqaures that * can make teleport traps instadeaths... */ @@ -995,7 +995,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, for (y = 0; y <= ysize; ++y) { place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); - current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); + p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); } } return FALSE; @@ -1009,12 +1009,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, for (i = 0; i <= xsize; ++i) { /* top boundary */ - if ((current_floor_ptr->grid_array[0 + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room)) + if ((p_ptr->current_floor_ptr->grid_array[0 + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room)) { /* Next to a 'filled' region? - set to be room walls */ place_outer_bold(y0 + 0 - yhsize, x0 + i - xhsize); - if (light) current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_GLOW); - current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_ROOM); + if (light) p_ptr->current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_GLOW); + p_ptr->current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info |= (CAVE_ROOM); place_outer_bold(y0 + 0 - yhsize, x0 + i - xhsize); } else @@ -1024,12 +1024,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, } /* bottom boundary */ - if ((current_floor_ptr->grid_array[ysize + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room)) + if ((p_ptr->current_floor_ptr->grid_array[ysize + y0 - yhsize][i + x0 - xhsize].info & CAVE_ICKY) && (room)) { /* Next to a 'filled' region? - set to be room walls */ place_outer_bold(y0 + ysize - yhsize, x0 + i - xhsize); - if (light) current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_GLOW); - current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_ROOM); + if (light) p_ptr->current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_GLOW); + p_ptr->current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info|=(CAVE_ROOM); place_outer_bold(y0 + ysize - yhsize, x0 + i - xhsize); } else @@ -1039,20 +1039,20 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, } /* clear the icky flag-don't need it any more */ - current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); - current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); } /* Do the left and right boundaries minus the corners (done above) */ for (i = 1; i < ysize; ++i) { /* left boundary */ - if ((current_floor_ptr->grid_array[i + y0 - yhsize][0 + x0 - xhsize].info & CAVE_ICKY) && room) + if ((p_ptr->current_floor_ptr->grid_array[i + y0 - yhsize][0 + x0 - xhsize].info & CAVE_ICKY) && room) { /* room boundary */ place_outer_bold(y0 + i - yhsize, x0 + 0 - xhsize); - if (light) current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_GLOW); - current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_ROOM); + if (light) p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_GLOW); + p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info |= (CAVE_ROOM); place_outer_bold(y0 + i - yhsize, x0 + 0 - xhsize); } else @@ -1061,12 +1061,12 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, place_extra_bold(y0 + i - yhsize, x0 + 0 - xhsize); } /* right boundary */ - if ((current_floor_ptr->grid_array[i + y0 - yhsize][xsize + x0 - xhsize].info & CAVE_ICKY) && room) + if ((p_ptr->current_floor_ptr->grid_array[i + y0 - yhsize][xsize + x0 - xhsize].info & CAVE_ICKY) && room) { /* room boundary */ place_outer_bold(y0 + i - yhsize, x0 + xsize - xhsize); - if (light) current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_GLOW); - current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_ROOM); + if (light) p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_GLOW); + p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info |= (CAVE_ROOM); place_outer_bold(y0 + i - yhsize, x0 + xsize - xhsize); } else @@ -1076,8 +1076,8 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, } /* clear icky flag -done with it */ - current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); - current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY); } @@ -1087,37 +1087,37 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, for (y = 1; y < ysize; ++y) { if (is_floor_bold(y0 + y - yhsize, x0 + x - xhsize) && - (current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) + (p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) { /* Clear the icky flag in the filled region */ - current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~CAVE_ICKY; + p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~CAVE_ICKY; /* Set appropriate flags */ - if (light) current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW); - if (room) current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM); + if (light) p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW); + if (room) p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM); } else if (is_outer_bold(y0 + y - yhsize, x0 + x - xhsize) && - (current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) + (p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) { /* Walls */ - current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY); - if (light) current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW); + p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY); + if (light) p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_GLOW); if (room) { - current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM); + p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM); } else { place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); - current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ROOM); + p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ROOM); } } else { /* Clear the unconnected regions */ place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); - current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); + p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); } } } @@ -1138,7 +1138,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, #ifdef ALLOW_CAVERNS_AND_LAKES /* - * Builds a current_floor_ptr->grid_array system in the center of the dungeon. + * Builds a p_ptr->current_floor_ptr->grid_array system in the center of the dungeon. */ void build_cavern(void) { @@ -1147,11 +1147,11 @@ void build_cavern(void) bool done, light; light = done = FALSE; - if ((current_floor_ptr->dun_level <= randint1(50)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; + if ((p_ptr->current_floor_ptr->dun_level <= randint1(50)) && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE; - /* Make a current_floor_ptr->grid_array the size of the dungeon */ - xsize = current_floor_ptr->width - 1; - ysize = current_floor_ptr->height - 1; + /* Make a p_ptr->current_floor_ptr->grid_array the size of the dungeon */ + xsize = p_ptr->current_floor_ptr->width - 1; + ysize = p_ptr->current_floor_ptr->height - 1; x0 = xsize / 2; y0 = ysize / 2; @@ -1201,7 +1201,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int feat2 = feat_shallow_water; feat3 = feat_ground_type[randint0(100)]; break; - case LAKE_T_CAVE: /* Collapsed current_floor_ptr->grid_array */ + case LAKE_T_CAVE: /* Collapsed p_ptr->current_floor_ptr->grid_array */ feat1 = feat_ground_type[randint0(100)]; feat2 = feat_ground_type[randint0(100)]; feat3 = feat_rubble; @@ -1230,7 +1230,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int } /* - * select region connected to center of current_floor_ptr->grid_array system + * select region connected to center of p_ptr->current_floor_ptr->grid_array system * this gets rid of alot of isolated one-sqaures that * can make teleport traps instadeaths... */ @@ -1252,7 +1252,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int /* number of filled squares */ fill_data.amount = 0; - /* select region connected to center of current_floor_ptr->grid_array system + /* select region connected to center of p_ptr->current_floor_ptr->grid_array system * this gets rid of alot of isolated one-sqaures that * can make teleport traps instadeaths... */ cave_fill((byte)y0, (byte)x0); @@ -1266,7 +1266,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int for (y = 0; y <= ysize; ++y) { place_floor_bold(y0 + y - yhsize, x0 + x - xhsize); - current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY); } } return FALSE; @@ -1279,8 +1279,8 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int place_extra_bold(y0 + ysize - yhsize, x0 + i - xhsize); /* clear the icky flag-don't need it any more */ - current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); - current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + 0 - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + ysize - yhsize][x0 + i - xhsize].info &= ~(CAVE_ICKY); } /* Do the left and right boundaries minus the corners (done above) */ @@ -1291,8 +1291,8 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int place_extra_bold(y0 + i - yhsize, x0 + xsize - xhsize); /* clear icky flag -done with it */ - current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); - current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + 0 - xhsize].info &= ~(CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y0 + i - yhsize][x0 + xsize - xhsize].info &= ~(CAVE_ICKY); } @@ -1302,17 +1302,17 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int for (y = 1; y < ysize; ++y) { /* Fill unconnected regions with granite */ - if ((!(current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) || + if ((!(p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY)) || is_outer_bold(y0 + y - yhsize, x0 + x - xhsize)) place_extra_bold(y0 + y - yhsize, x0 + x - xhsize); /* current_world_ptr->game_turn off icky flag (no longer needed.) */ - current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); + p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM); /* Light lava */ if (cave_have_flag_bold(y0 + y - yhsize, x0 + x - xhsize, FF_LAVA)) { - if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW; + if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) p_ptr->current_floor_ptr->grid_array[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW; } } } @@ -1322,7 +1322,7 @@ bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int /* - * makes a lake/collapsed current_floor_ptr->grid_array system in the center of the dungeon + * makes a lake/collapsed p_ptr->current_floor_ptr->grid_array system in the center of the dungeon */ void build_lake(int type) { @@ -1338,8 +1338,8 @@ void build_lake(int type) } /* Make the size of the dungeon */ - xsize = current_floor_ptr->width - 1; - ysize = current_floor_ptr->height - 1; + xsize = p_ptr->current_floor_ptr->width - 1; + ysize = p_ptr->current_floor_ptr->height - 1; x0 = xsize / 2; y0 = ysize / 2; @@ -1550,18 +1550,18 @@ void build_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2) for (i = 0; i <= xsize; i++) { place_outer_noperm_bold(y1, x1 + i); - current_floor_ptr->grid_array[y1][x1 + i].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y1][x1 + i].info |= (CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y2, x1 + i); - current_floor_ptr->grid_array[y2][x1 + i].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y2][x1 + i].info |= (CAVE_ROOM | CAVE_ICKY); } /* Left and right boundaries */ for (i = 1; i < ysize; i++) { place_outer_noperm_bold(y1 + i, x1); - current_floor_ptr->grid_array[y1 + i][x1].info|=(CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y1 + i][x1].info|=(CAVE_ROOM | CAVE_ICKY); place_outer_noperm_bold(y1 + i, x2); - current_floor_ptr->grid_array[y1 + i][x2].info|=(CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y1 + i][x2].info|=(CAVE_ROOM | CAVE_ICKY); } /* Middle */ @@ -1573,12 +1573,12 @@ void build_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2) { /* clear the untouched region */ place_floor_bold(y1 + y, x1 + x); - current_floor_ptr->grid_array[y1 + y][x1 + x].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y1 + y][x1 + x].info |= (CAVE_ROOM | CAVE_ICKY); } else { /* make it a room- but don't touch */ - current_floor_ptr->grid_array[y1 + y][x1 + x].info |= (CAVE_ROOM | CAVE_ICKY); + p_ptr->current_floor_ptr->grid_array[y1 + y][x1 + x].info |= (CAVE_ROOM | CAVE_ICKY); } } } @@ -1699,7 +1699,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 = ((current_floor_ptr->dun_level <= randint1(25)) && is_vault && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)); + light = ((p_ptr->current_floor_ptr->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; @@ -1715,7 +1715,7 @@ void build_maze_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION ysize, { for (x = x1 - 1; x <= x2 + 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; g_ptr->info |= CAVE_ROOM; if (is_vault) g_ptr->info |= CAVE_ICKY; if ((x == x1 - 1) || (x == x2 + 1) || (y == y1 - 1) || (y == y2 + 1)) @@ -1746,7 +1746,7 @@ void build_maze_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION ysize, r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited); /* Fill with monsters and treasure, low difficulty */ - if (is_vault) fill_treasure(current_floor_ptr, x1, x2, y1, y2, randint1(5)); + if (is_vault) fill_treasure(p_ptr->current_floor_ptr, x1, x2, y1, y2, randint1(5)); C_KILL(visited, num_vertices, int); } @@ -1969,9 +1969,9 @@ void add_outer_wall(POSITION x, POSITION y, int light, POSITION x1, POSITION y1, feature_type *f_ptr; int i, j; - if (!in_bounds(current_floor_ptr, y, x)) return; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* hack- check to see if square has been visited before * if so, then exit (use room flag to do this) */ @@ -2051,7 +2051,7 @@ void generate_room_floor(POSITION y1, POSITION x1, POSITION y2, POSITION x2, int for (x = x1; x <= x2; x++) { /* Point to grid */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; place_floor_grid(g_ptr); g_ptr->info |= (CAVE_ROOM); if (light) g_ptr->info |= (CAVE_GLOW); @@ -2086,19 +2086,19 @@ static bool room_build(EFFECT_ID typ) switch (typ) { /* Build an appropriate room */ - case ROOM_T_NORMAL: return build_type1(current_floor_ptr); - case ROOM_T_OVERLAP: return build_type2(current_floor_ptr); - case ROOM_T_CROSS: return build_type3(current_floor_ptr); - case ROOM_T_INNER_FEAT: return build_type4(current_floor_ptr); - case ROOM_T_NEST: return build_type5(current_floor_ptr); - case ROOM_T_PIT: return build_type6(current_floor_ptr); + case ROOM_T_NORMAL: return build_type1(p_ptr->current_floor_ptr); + case ROOM_T_OVERLAP: return build_type2(p_ptr->current_floor_ptr); + case ROOM_T_CROSS: return build_type3(p_ptr->current_floor_ptr); + case ROOM_T_INNER_FEAT: return build_type4(p_ptr->current_floor_ptr); + case ROOM_T_NEST: return build_type5(p_ptr->current_floor_ptr); + case ROOM_T_PIT: return build_type6(p_ptr->current_floor_ptr); case ROOM_T_LESSER_VAULT: return build_type7(); case ROOM_T_GREATER_VAULT: return build_type8(); case ROOM_T_FRACAVE: return build_type9(); case ROOM_T_RANDOM_VAULT: return build_type10(); - case ROOM_T_OVAL: return build_type11(current_floor_ptr); - case ROOM_T_CRYPT: return build_type12(current_floor_ptr); - case ROOM_T_TRAP_PIT: return build_type13(current_floor_ptr); + case ROOM_T_OVAL: return build_type11(p_ptr->current_floor_ptr); + case ROOM_T_CRYPT: return build_type12(p_ptr->current_floor_ptr); + case ROOM_T_TRAP_PIT: return build_type13(p_ptr->current_floor_ptr); case ROOM_T_TRAP: return build_type14(); case ROOM_T_GLASS: return build_type15(); case ROOM_T_ARCADE: return build_type16(); @@ -2126,8 +2126,8 @@ bool generate_rooms(void) int total_prob; int prob_list[ROOM_T_MAX]; int rooms_built = 0; - int area_size = 100 * (current_floor_ptr->height*current_floor_ptr->width) / (MAX_HGT*MAX_WID); - int level_index = MIN(10, div_round(current_floor_ptr->dun_level, 10)); + int area_size = 100 * (p_ptr->current_floor_ptr->height*p_ptr->current_floor_ptr->width) / (MAX_HGT*MAX_WID); + int level_index = MIN(10, div_round(p_ptr->current_floor_ptr->dun_level, 10)); /* Number of each type of room on this level */ s16b room_num[ROOM_T_MAX]; @@ -2135,7 +2135,7 @@ bool generate_rooms(void) /* Limit number of rooms */ int dun_rooms = DUN_ROOMS_MAX * area_size / 100; - /* Assume normal current_floor_ptr->grid_array */ + /* Assume normal p_ptr->current_floor_ptr->grid_array */ room_info_type *room_info_ptr = room_info_normal; /* @@ -2144,7 +2144,7 @@ bool generate_rooms(void) for (i = 0; i < ROOM_T_MAX; i++) { /* No rooms allowed above their minimum depth. */ - if (current_floor_ptr->dun_level < room_info_ptr[i].min_level) + if (p_ptr->current_floor_ptr->dun_level < room_info_ptr[i].min_level) { prob_list[i] = 0; } @@ -2192,7 +2192,7 @@ bool generate_rooms(void) MOVE_PLIST(ROOM_T_INNER_FEAT, ROOM_T_OVAL); } - /*! @details ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc current_floor_ptr->grid_array etc.) */ + /*! @details ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc p_ptr->current_floor_ptr->grid_array etc.) */ else if (d_info[p_ptr->dungeon_idx].flags1 & DF1_CAVE) { MOVE_PLIST(ROOM_T_FRACAVE, ROOM_T_NORMAL); diff --git a/src/rooms.h b/src/rooms.h index 24c2e2c1f..e658d1b99 100644 --- a/src/rooms.h +++ b/src/rooms.h @@ -36,7 +36,7 @@ #define ROOM_T_PIT 5 /*!<部屋型ID:モンスターPIT / Monster pit (33x11) */ #define ROOM_T_LESSER_VAULT 6 /*!<部屋型ID:小型VAULT / Lesser vault (33x22) */ #define ROOM_T_GREATER_VAULT 7 /*!<部屋型ID:大型VAULT / Greater vault (66x44) */ -#define ROOM_T_FRACAVE 8 /*!<部屋型ID:フラクタル地形 / Fractal current_floor_ptr->grid_array (42x24) */ +#define ROOM_T_FRACAVE 8 /*!<部屋型ID:フラクタル地形 / Fractal p_ptr->current_floor_ptr->grid_array (42x24) */ #define ROOM_T_RANDOM_VAULT 9 /*!<部屋型ID:ランダムVAULT / Random vault (44x22) */ #define ROOM_T_OVAL 10 /*!<部屋型ID:円形部屋 / Circular rooms (22x22) */ #define ROOM_T_CRYPT 11 /*!<部屋型ID:聖堂 / Crypts (22x22) */ diff --git a/src/save.c b/src/save.c index 118a8ea28..f19f2b845 100644 --- a/src/save.c +++ b/src/save.c @@ -835,7 +835,7 @@ static void wr_extra(void) wr_byte(p_ptr->feeling); /* Turn when level began */ - wr_s32b(current_floor_ptr->generated_turn); + wr_s32b(p_ptr->current_floor_ptr->generated_turn); /* Turn of last "feeling" */ wr_s32b(p_ptr->feeling_turn); @@ -893,7 +893,7 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) { /*** Not a saved floor ***/ - wr_s16b((s16b)current_floor_ptr->dun_level); + wr_s16b((s16b)p_ptr->current_floor_ptr->dun_level); } else { @@ -908,12 +908,12 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) wr_s16b(sf_ptr->lower_floor_id); } - wr_u16b((u16b)current_floor_ptr->base_level); - wr_u16b((s16b)current_floor_ptr->num_repro); + wr_u16b((u16b)p_ptr->current_floor_ptr->base_level); + wr_u16b((s16b)p_ptr->current_floor_ptr->num_repro); wr_u16b((u16b)p_ptr->y); wr_u16b((u16b)p_ptr->x); - wr_u16b((u16b)current_floor_ptr->height); - wr_u16b((u16b)current_floor_ptr->width); + wr_u16b((u16b)p_ptr->current_floor_ptr->height); + wr_u16b((u16b)p_ptr->current_floor_ptr->width); wr_byte(p_ptr->feeling); @@ -938,11 +938,11 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) C_MAKE(templates, max_num_temp, grid_template_type); /* Extract template array */ - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; for (i = 0; i < num_temp; i++) { @@ -1006,18 +1006,18 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) - /*** "Run-Length-Encoding" of current_floor_ptr->grid_array ***/ + /*** "Run-Length-Encoding" of p_ptr->current_floor_ptr->grid_array ***/ /* Note that this will induce two wasted bytes */ count = 0; prev_u16b = 0; - /* Dump the current_floor_ptr->grid_array */ - for (y = 0; y < current_floor_ptr->height; y++) + /* Dump the p_ptr->current_floor_ptr->grid_array */ + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; for (i = 0; i < num_temp; i++) { @@ -1078,12 +1078,12 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) /*** Dump objects ***/ /* Total objects */ - wr_u16b(current_floor_ptr->o_max); + wr_u16b(p_ptr->current_floor_ptr->o_max); /* Dump the objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; /* Dump it */ wr_item(o_ptr); @@ -1093,12 +1093,12 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) /*** Dump the monsters ***/ /* Total monsters */ - wr_u16b(current_floor_ptr->m_max); + wr_u16b(p_ptr->current_floor_ptr->m_max); /* Dump the monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; /* Dump it */ wr_monster(m_ptr); @@ -1116,9 +1116,9 @@ static bool wr_dungeon(void) saved_floor_type *cur_sf_ptr; int i; - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Update lite/view */ p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE); diff --git a/src/scores.c b/src/scores.c index 21ae79577..1f86d956c 100644 --- a/src/scores.c +++ b/src/scores.c @@ -527,7 +527,7 @@ errr top_twenty(void) /* Save the level and such */ sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999)); - sprintf(the_score.cur_dun, "%3d", (int)current_floor_ptr->dun_level); + sprintf(the_score.cur_dun, "%3d", (int)p_ptr->current_floor_ptr->dun_level); sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999)); sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]); @@ -640,7 +640,7 @@ errr predict_score(void) /* Save the level and such */ sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999)); - sprintf(the_score.cur_dun, "%3d", (int)current_floor_ptr->dun_level); + sprintf(the_score.cur_dun, "%3d", (int)p_ptr->current_floor_ptr->dun_level); sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999)); sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]); @@ -862,7 +862,7 @@ void kingly(void) bool seppuku = streq(p_ptr->died_from, "Seppuku"); /* Hack -- retire in town */ - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; /* Fake death */ if (!seppuku) diff --git a/src/sort.c b/src/sort.c index b7f401849..386e521b5 100644 --- a/src/sort.c +++ b/src/sort.c @@ -113,10 +113,10 @@ bool ang_sort_comp_importance(vptr u, vptr v, int a, int b) { POSITION *x = (POSITION*)(u); POSITION *y = (POSITION*)(v); - grid_type *ca_ptr = ¤t_floor_ptr->grid_array[y[a]][x[a]]; - grid_type *cb_ptr = ¤t_floor_ptr->grid_array[y[b]][x[b]]; - monster_type *ma_ptr = ¤t_floor_ptr->m_list[ca_ptr->m_idx]; - monster_type *mb_ptr = ¤t_floor_ptr->m_list[cb_ptr->m_idx]; + grid_type *ca_ptr = &p_ptr->current_floor_ptr->grid_array[y[a]][x[a]]; + grid_type *cb_ptr = &p_ptr->current_floor_ptr->grid_array[y[b]][x[b]]; + monster_type *ma_ptr = &p_ptr->current_floor_ptr->m_list[ca_ptr->m_idx]; + monster_type *mb_ptr = &p_ptr->current_floor_ptr->m_list[cb_ptr->m_idx]; monster_race *ap_ra_ptr, *ap_rb_ptr; /* The player grid */ @@ -160,8 +160,8 @@ bool ang_sort_comp_importance(vptr u, vptr v, int a, int b) } /* An object get higher priority */ - if (current_floor_ptr->grid_array[y[a]][x[a]].o_idx && !current_floor_ptr->grid_array[y[b]][x[b]].o_idx) return TRUE; - if (!current_floor_ptr->grid_array[y[a]][x[a]].o_idx && current_floor_ptr->grid_array[y[b]][x[b]].o_idx) return FALSE; + if (p_ptr->current_floor_ptr->grid_array[y[a]][x[a]].o_idx && !p_ptr->current_floor_ptr->grid_array[y[b]][x[b]].o_idx) return TRUE; + if (!p_ptr->current_floor_ptr->grid_array[y[a]][x[a]].o_idx && p_ptr->current_floor_ptr->grid_array[y[b]][x[b]].o_idx) return FALSE; /* Priority from the terrain */ if (f_info[ca_ptr->feat].priority > f_info[cb_ptr->feat].priority) return TRUE; @@ -321,8 +321,8 @@ bool ang_sort_comp_pet(vptr u, vptr v, int a, int b) int w1 = who[a]; int w2 = who[b]; - monster_type *m_ptr1 = ¤t_floor_ptr->m_list[w1]; - monster_type *m_ptr2 = ¤t_floor_ptr->m_list[w2]; + monster_type *m_ptr1 = &p_ptr->current_floor_ptr->m_list[w1]; + monster_type *m_ptr2 = &p_ptr->current_floor_ptr->m_list[w2]; monster_race *r_ptr1 = &r_info[m_ptr1->r_idx]; monster_race *r_ptr2 = &r_info[m_ptr2->r_idx]; @@ -490,8 +490,8 @@ bool ang_sort_comp_pet_dismiss(vptr u, vptr v, int a, int b) int w1 = who[a]; int w2 = who[b]; - monster_type *m_ptr1 = ¤t_floor_ptr->m_list[w1]; - monster_type *m_ptr2 = ¤t_floor_ptr->m_list[w2]; + monster_type *m_ptr1 = &p_ptr->current_floor_ptr->m_list[w1]; + monster_type *m_ptr2 = &p_ptr->current_floor_ptr->m_list[w2]; monster_race *r_ptr1 = &r_info[m_ptr1->r_idx]; monster_race *r_ptr2 = &r_info[m_ptr2->r_idx]; @@ -521,8 +521,8 @@ bool ang_sort_comp_pet_dismiss(vptr u, vptr v, int a, int b) /*! - * @brief フロア保存時のcurrent_floor_ptr->grid_array情報テンプレートをソートするための比較処理 - * @param u current_floor_ptr->grid_arrayテンプレートの参照ポインタ + * @brief フロア保存時のp_ptr->current_floor_ptr->grid_array情報テンプレートをソートするための比較処理 + * @param u p_ptr->current_floor_ptr->grid_arrayテンプレートの参照ポインタ * @param v 未使用 * @param a スワップするモンスター種族のID1 * @param b スワップするモンスター種族のID2 @@ -543,8 +543,8 @@ bool ang_sort_comp_cave_temp(vptr u, vptr v, int a, int b) /*! - * @brief フロア保存時のcurrent_floor_ptr->grid_array情報テンプレートをソートするためのスワップ処理 / Sorting hook -- Swap function - * @param u current_floor_ptr->grid_arrayテンプレートの参照ポインタ + * @brief フロア保存時のp_ptr->current_floor_ptr->grid_array情報テンプレートをソートするためのスワップ処理 / Sorting hook -- Swap function + * @param u p_ptr->current_floor_ptr->grid_arrayテンプレートの参照ポインタ * @param v 未使用 * @param a スワップするモンスター種族のID1 * @param b スワップするモンスター種族のID2 diff --git a/src/spells-floor.c b/src/spells-floor.c index 967a9e13f..1c9d5c1ff 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -50,9 +50,9 @@ void wiz_lite(player_type *caster_ptr, bool ninja) feature_type *f_ptr; /* Memorize objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue; @@ -62,12 +62,12 @@ void wiz_lite(player_type *caster_ptr, bool ninja) } /* Scan all normal grids */ - for (y = 1; y < current_floor_ptr->height - 1; y++) + for (y = 1; y < p_ptr->current_floor_ptr->height - 1; y++) { /* Scan all normal grids */ - for (x = 1; x < current_floor_ptr->width - 1; x++) + for (x = 1; x < p_ptr->current_floor_ptr->width - 1; x++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Memorize terrain of the grid */ g_ptr->info |= (CAVE_KNOWN); @@ -84,7 +84,7 @@ void wiz_lite(player_type *caster_ptr, bool ninja) { POSITION yy = y + ddy_ddd[i]; POSITION xx = x + ddx_ddd[i]; - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; /* Feature code (applying "mimic" field) */ f_ptr = &f_info[get_feat_mimic(g_ptr)]; @@ -123,7 +123,7 @@ void wiz_lite(player_type *caster_ptr, bool ninja) if (caster_ptr->special_defense & NINJA_S_STEALTH) { - if (current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE); + if (p_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE); } } @@ -137,11 +137,11 @@ void wiz_dark(void) POSITION y, x; /* Forget every grid */ - for (y = 1; y < current_floor_ptr->height - 1; y++) + for (y = 1; y < p_ptr->current_floor_ptr->height - 1; y++) { - for (x = 1; x < current_floor_ptr->width - 1; x++) + for (x = 1; x < p_ptr->current_floor_ptr->width - 1; x++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Process the grid */ g_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN); @@ -150,23 +150,23 @@ void wiz_dark(void) } /* Forget every grid on horizontal edge */ - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - current_floor_ptr->grid_array[0][x].info &= ~(CAVE_MARK); - current_floor_ptr->grid_array[current_floor_ptr->height - 1][x].info &= ~(CAVE_MARK); + p_ptr->current_floor_ptr->grid_array[0][x].info &= ~(CAVE_MARK); + p_ptr->current_floor_ptr->grid_array[p_ptr->current_floor_ptr->height - 1][x].info &= ~(CAVE_MARK); } /* Forget every grid on vertical edge */ - for (y = 1; y < (current_floor_ptr->height - 1); y++) + for (y = 1; y < (p_ptr->current_floor_ptr->height - 1); y++) { - current_floor_ptr->grid_array[y][0].info &= ~(CAVE_MARK); - current_floor_ptr->grid_array[y][current_floor_ptr->width - 1].info &= ~(CAVE_MARK); + p_ptr->current_floor_ptr->grid_array[y][0].info &= ~(CAVE_MARK); + p_ptr->current_floor_ptr->grid_array[y][p_ptr->current_floor_ptr->width - 1].info &= ~(CAVE_MARK); } /* Forget all objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue; @@ -199,8 +199,8 @@ bool warding_glyph(void) } /* Create a glyph */ - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_glyph; + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_glyph; note_spot(p_ptr->y, p_ptr->x); lite_spot(p_ptr->y, p_ptr->x); @@ -223,8 +223,8 @@ bool explosive_rune(void) } /* Create a glyph */ - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune; + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune; note_spot(p_ptr->y, p_ptr->x); lite_spot(p_ptr->y, p_ptr->x); @@ -245,11 +245,11 @@ bool place_mirror(void) } /* Create a mirror */ - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_mirror; + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_mirror; /* Turn on the light */ - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW; + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW; note_spot(p_ptr->y, p_ptr->x); lite_spot(p_ptr->y, p_ptr->x); @@ -277,10 +277,10 @@ void stair_creation(void) if (ironman_downward) up = FALSE; /* Forbid down staircases on quest level */ - if (quest_number(current_floor_ptr->dun_level) || (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) down = FALSE; + if (quest_number(p_ptr->current_floor_ptr->dun_level) || (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) down = FALSE; /* No effect out of standard dungeon floor */ - if (!current_floor_ptr->dun_level || (!up && !down) || + if (!p_ptr->current_floor_ptr->dun_level || (!up && !down) || (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || p_ptr->inside_arena || p_ptr->phase_out) { @@ -331,11 +331,11 @@ void stair_creation(void) { POSITION x, y; - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (!g_ptr->special) continue; if (feat_uses_special(g_ptr->feat)) continue; @@ -368,19 +368,19 @@ void stair_creation(void) if (up) { cave_set_feat(p_ptr->y, p_ptr->x, - (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= current_floor_ptr->dun_level - 2)) ? + (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= p_ptr->current_floor_ptr->dun_level - 2)) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair); } else { cave_set_feat(p_ptr->y, p_ptr->x, - (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= current_floor_ptr->dun_level + 2)) ? + (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= p_ptr->current_floor_ptr->dun_level + 2)) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair); } /* Connect this stairs to the destination */ - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special = dest_floor_id; + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special = dest_floor_id; } /* @@ -397,13 +397,13 @@ void map_area(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; /* Scan that area */ - for (y = 1; y < current_floor_ptr->height - 1; y++) + for (y = 1; y < p_ptr->current_floor_ptr->height - 1; y++) { - for (x = 1; x < current_floor_ptr->width - 1; x++) + for (x = 1; x < p_ptr->current_floor_ptr->width - 1; x++) { if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Memorize terrain of the grid */ g_ptr->info |= (CAVE_KNOWN); @@ -425,7 +425,7 @@ void map_area(POSITION range) /* Memorize known walls */ for (i = 0; i < 8; i++) { - g_ptr = ¤t_floor_ptr->grid_array[y + ddy_ddd[i]][x + ddx_ddd[i]]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y + ddy_ddd[i]][x + ddx_ddd[i]]; /* Feature code (applying "mimic" field) */ feat = get_feat_mimic(g_ptr); @@ -471,27 +471,27 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) bool flag = FALSE; /* Prevent destruction of quest levels and town */ - if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level) + if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !p_ptr->current_floor_ptr->dun_level) { return (FALSE); } /* Lose monster light */ - if (!in_generate) clear_mon_lite(current_floor_ptr); + if (!in_generate) clear_mon_lite(p_ptr->current_floor_ptr); /* Big area of affect */ for (y = (y1 - r); y <= (y1 + r); y++) { for (x = (x1 - r); x <= (x1 + r); x++) { - if (!in_bounds(current_floor_ptr, y, x)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) continue; /* Extract the distance */ k = distance(y1, x1, y, x); /* Stay in the circle of death */ if (k > r) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Lose room and vault */ g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); @@ -520,7 +520,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) if (g_ptr->m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (in_generate) /* In generation */ @@ -560,7 +560,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Hack -- Preserve unknown artifacts */ @@ -652,14 +652,14 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) { for (x = (x1 - r); x <= (x1 + r); x++) { - if (!in_bounds(current_floor_ptr, y, x)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) continue; /* Extract the distance */ k = distance(y1, x1, y, x); /* Stay in the circle of death */ if (k > r) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW; else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) @@ -673,7 +673,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) yy = y + ddy_ddd[i]; xx = x + ddx_ddd[i]; if (!in_bounds2(yy, xx)) continue; - cc_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + cc_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW)) { g_ptr->info |= CAVE_GLOW; @@ -706,7 +706,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE); + if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE); } } @@ -755,7 +755,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) bool map[32][32]; /* Prevent destruction of quest levels and town */ - if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level) + if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !p_ptr->current_floor_ptr->dun_level) { return (FALSE); } @@ -780,11 +780,11 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) yy = cy + dy; xx = cx + dx; - if (!in_bounds(current_floor_ptr, yy, xx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, yy, xx)) continue; /* Skip distant grids */ if (distance(cy, cx, yy, xx) > r) continue; - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; /* Lose room and vault / Lose light and knowledge */ g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE); @@ -819,7 +819,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Important -- Skip "quake" grids */ if (map[16 + y - cy][16 + x - cx]) continue; - if (current_floor_ptr->grid_array[y][x].m_idx) continue; + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) continue; /* Count "safe" grids */ sn++; @@ -836,17 +836,17 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) { case 1: { - msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!")); + msg_print(_("ダンジョンの壁が崩れた!", "The p_ptr->current_floor_ptr->grid_array ceiling collapses!")); break; } case 2: { - msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!")); + msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The p_ptr->current_floor_ptr->grid_array floor twists in an unnatural way!")); break; } default: { - msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!")); + msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The p_ptr->current_floor_ptr->grid_array quakes! You are pummeled with debris!")); break; } } @@ -901,7 +901,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) if (m_idx) { GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME); killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name); } @@ -924,14 +924,14 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Skip unaffected grids */ if (!map[16 + yy - cy][16 + xx - cx]) continue; - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; if (g_ptr->m_idx == p_ptr->riding) continue; /* Process monsters */ if (g_ptr->m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Quest monsters */ @@ -965,8 +965,8 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) if (!cave_empty_bold(y, x)) continue; /* Hack -- no safety on glyph of warding */ - if (is_glyph_grid(¤t_floor_ptr->grid_array[y][x])) continue; - if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[y][x])) continue; + if (is_glyph_grid(&p_ptr->current_floor_ptr->grid_array[y][x])) continue; + if (is_explosive_rune_grid(&p_ptr->current_floor_ptr->grid_array[y][x])) continue; /* ... nor on the Pattern */ if (pattern_tile(y, x)) continue; @@ -974,7 +974,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Important -- Skip "quake" grids */ if (map[16 + y - cy][16 + x - cx]) continue; - if (current_floor_ptr->grid_array[y][x].m_idx) continue; + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) continue; if (player_bold(y, x)) continue; /* Count "safe" grids */ @@ -1010,7 +1010,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) if (g_ptr->m_idx) { - if (record_named_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname) + if (record_named_pet && is_pet(&p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]) && p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].nickname) { char m2_name[MAX_NLEN]; @@ -1028,13 +1028,13 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Hack -- Escape from the rock */ if (sn) { - IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx; + IDX m_idx_aux = p_ptr->current_floor_ptr->grid_array[yy][xx].m_idx; /* Update the old location */ - current_floor_ptr->grid_array[yy][xx].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[yy][xx].m_idx = 0; /* Update the new location */ - current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux; + p_ptr->current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux; /* Move the monster */ m_ptr->fy = sy; @@ -1050,7 +1050,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) } /* Lose monster light */ - clear_mon_lite(current_floor_ptr); + clear_mon_lite(p_ptr->current_floor_ptr); /* Examine the quaked region */ for (dy = -r; dy <= r; dy++) @@ -1063,7 +1063,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) /* Skip unaffected grids */ if (!map[16 + yy - cy][16 + xx - cx]) continue; - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; /* Paranoia -- never affect player */ /* if (player_bold(yy, xx)) continue; */ @@ -1115,11 +1115,11 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) yy = cy + dy; xx = cx + dx; - if (!in_bounds(current_floor_ptr, yy, xx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, yy, xx)) continue; /* Skip distant grids */ if (distance(cy, cx, yy, xx) > r) continue; - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW; else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) @@ -1133,7 +1133,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) yyy = yy + ddy_ddd[ii]; xxx = xx + ddx_ddd[ii]; if (!in_bounds2(yyy, xxx)) continue; - cc_ptr = ¤t_floor_ptr->grid_array[yyy][xxx]; + cc_ptr = &p_ptr->current_floor_ptr->grid_array[yyy][xxx]; if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW)) { g_ptr->info |= CAVE_GLOW; @@ -1151,7 +1151,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE); + if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE); } /* Success */ diff --git a/src/spells-object.c b/src/spells-object.c index b26f412be..8ec762670 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -138,7 +138,7 @@ bool create_ammo(player_type *creature_ptr) if (!get_rep_dir(&dir, FALSE)) return FALSE; y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_CAN_DIG)) { @@ -586,8 +586,8 @@ void acquire_chaos_weapon(player_type *creature_ptr) } object_prep(q_ptr, lookup_kind(dummy, dummy2)); - q_ptr->to_h = 3 + randint1(current_floor_ptr->dun_level) % 10; - q_ptr->to_d = 3 + randint1(current_floor_ptr->dun_level) % 10; + q_ptr->to_h = 3 + randint1(p_ptr->current_floor_ptr->dun_level) % 10; + q_ptr->to_d = 3 + randint1(p_ptr->current_floor_ptr->dun_level) % 10; one_resistance(q_ptr); q_ptr->name2 = EGO_CHAOTIC; (void)drop_near(q_ptr, -1, creature_ptr->y, creature_ptr->x); @@ -1380,7 +1380,7 @@ void brand_weapon(int brand_type) act = _("は鋭さを増した!", "becomes very sharp!"); o_ptr->name2 = EGO_SHARPNESS; - o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, current_floor_ptr->dun_level) + 1; + o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, p_ptr->current_floor_ptr->dun_level) + 1; if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2)) o_ptr->pval = 2; @@ -1389,7 +1389,7 @@ void brand_weapon(int brand_type) { act = _("は破壊力を増した!", "seems very powerful."); o_ptr->name2 = EGO_EARTHQUAKES; - o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, current_floor_ptr->dun_level); + o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, p_ptr->current_floor_ptr->dun_level); } break; case 16: diff --git a/src/spells-status.c b/src/spells-status.c index 8bdcf6f20..14f3ca718 100644 --- a/src/spells-status.c +++ b/src/spells-status.c @@ -418,10 +418,10 @@ bool fishing(player_type *creature_ptr) msg_print(_("そこは水辺ではない。", "There is no fishing place.")); return FALSE; } - else if (current_floor_ptr->grid_array[y][x].m_idx) + else if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0); + monster_desc(m_name, &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx], 0); msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name); free_turn(creature_ptr); return FALSE; @@ -451,7 +451,7 @@ bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr) inven_item_increase(inv, (0 - o_ptr->number)); inven_item_optimize(inv); o_idx = drop_near(&forge, 0, creature_ptr->y, creature_ptr->x); - o_ptr = ¤t_floor_ptr->o_list[o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx]; object_desc(o_name, o_ptr, OD_NAME_ONLY); msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name); diff --git a/src/spells-summon.c b/src/spells-summon.c index 53d304850..a806932a8 100644 --- a/src/spells-summon.c +++ b/src/spells-summon.c @@ -268,14 +268,14 @@ bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode) int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x) { int i; - int max_cyber = (easy_band ? 1 : (current_floor_ptr->dun_level / 50) + randint1(2)); + int max_cyber = (easy_band ? 1 : (p_ptr->current_floor_ptr->dun_level / 50) + randint1(2)); int count = 0; BIT_FLAGS mode = PM_ALLOW_GROUP; /* Summoned by a monster */ if (who > 0) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[who]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[who]; if (is_pet(m_ptr)) mode |= PM_FORCE_PET; } @@ -310,9 +310,9 @@ void mitokohmon(void) } if (!count) { - for (i = current_floor_ptr->m_max - 1; i > 0; i--) + for (i = p_ptr->current_floor_ptr->m_max - 1; i > 0; i--) { - m_ptr = ¤t_floor_ptr->m_list[i]; + m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue; if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue; diff --git a/src/spells.h b/src/spells.h index 8d3d7ba7f..3db718001 100644 --- a/src/spells.h +++ b/src/spells.h @@ -331,6 +331,6 @@ extern bool tele_town(void); /* Is "teleport level" ineffective to this target? */ #define TELE_LEVEL_IS_INEFF(TARGET) \ (p_ptr->inside_arena || p_ptr->phase_out || \ - (p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || \ - (((TARGET) <= 0) && (quest_number(current_floor_ptr->dun_level) || (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) && \ - (current_floor_ptr->dun_level >= 1) && ironman_downward)) + (p_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || \ + (((TARGET) <= 0) && (quest_number(p_ptr->current_floor_ptr->dun_level) || (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) && \ + (p_ptr->current_floor_ptr->dun_level >= 1) && ironman_downward)) diff --git a/src/spells1.c b/src/spells1.c index 9b29aa5f1..572c1106a 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -208,11 +208,11 @@ static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSIT POSITION x, y; int num; - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) { + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x])) { mirror_y[mirror_num] = y; mirror_x[mirror_num] = x; mirror_num++; @@ -270,7 +270,7 @@ static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */ */ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; bool obvious = FALSE; @@ -603,7 +603,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P /* Turn off the light. */ if (do_dark) { - if (current_floor_ptr->dun_level || !is_daytime()) + if (p_ptr->current_floor_ptr->dun_level || !is_daytime()) { for (j = 0; j < 9; j++) { @@ -612,7 +612,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P if (in_bounds2(by, bx)) { - grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx]; + grid_type *cc_ptr = &p_ptr->current_floor_ptr->grid_array[by][bx]; if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW)) { @@ -757,7 +757,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P */ static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -781,7 +781,7 @@ static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P /* Scan all objects in the grid */ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { - object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; bool is_art = FALSE; bool ignore = FALSE; @@ -982,7 +982,7 @@ static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P int i; BIT_FLAGS mode = 0L; - if (!who || is_pet(¤t_floor_ptr->m_list[who])) + if (!who || is_pet(&p_ptr->current_floor_ptr->m_list[who])) mode |= PM_FORCE_PET; for (i = 0; i < o_ptr->number ; i++) @@ -1135,10 +1135,10 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P { int tmp; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; - monster_type *caster_ptr = (who > 0) ? ¤t_floor_ptr->m_list[who] : NULL; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *caster_ptr = (who > 0) ? &p_ptr->current_floor_ptr->m_list[who] : NULL; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -3726,7 +3726,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P } /* Hack -- Get new monster */ - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- Get new race */ r_ptr = &r_info[m_ptr->r_idx]; @@ -3750,7 +3750,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P x = m_ptr->fx; /* Hack -- get new grid */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; } /* Fear */ @@ -3800,7 +3800,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P } else { - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } } @@ -3831,7 +3831,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P } else { - current_floor_ptr->monster_noise = TRUE; + p_ptr->current_floor_ptr->monster_noise = TRUE; } /* Hack -- handle sleep */ @@ -4051,16 +4051,16 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI { do { - t_y = current_floor_ptr->m_list[who].fy - 1 + randint1(3); - t_x = current_floor_ptr->m_list[who].fx - 1 + randint1(3); + t_y = p_ptr->current_floor_ptr->m_list[who].fy - 1 + randint1(3); + t_x = p_ptr->current_floor_ptr->m_list[who].fx - 1 + randint1(3); max_attempts--; } while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x)); if (max_attempts < 1) { - t_y = current_floor_ptr->m_list[who].fy; - t_x = current_floor_ptr->m_list[who].fx; + t_y = p_ptr->current_floor_ptr->m_list[who].fy; + t_x = p_ptr->current_floor_ptr->m_list[who].fx; } } else @@ -4088,7 +4088,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI if (who > 0) { - m_ptr = ¤t_floor_ptr->m_list[who]; + m_ptr = &p_ptr->current_floor_ptr->m_list[who]; rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1); monster_desc(m_name, m_ptr, 0); @@ -5139,7 +5139,7 @@ bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2) if ((ax < 2) && (ay < 2)) return (TRUE); /* Paranoia -- require "safe" origin */ - /* if (!in_bounds(current_floor_ptr, y1, x1)) return (FALSE); */ + /* if (!in_bounds(p_ptr->current_floor_ptr, y1, x1)) return (FALSE); */ /* Directly South/North */ if (!dx) @@ -5362,7 +5362,7 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *g for (x = bx - cdis; x <= bx + cdis; x++) { /* Ignore "illegal" locations */ - if (!in_bounds(current_floor_ptr, y, x)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) continue; /* Enforce a circular "ripple" */ if (distance(y1, x1, y, x) != bdis) continue; @@ -5641,9 +5641,9 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da /* Start at monster */ else if (who > 0) { - x1 = current_floor_ptr->m_list[who].fx; - y1 = current_floor_ptr->m_list[who].fy; - monster_desc(who_name, ¤t_floor_ptr->m_list[who], MD_WRONGDOER_NAME); + x1 = p_ptr->current_floor_ptr->m_list[who].fx; + y1 = p_ptr->current_floor_ptr->m_list[who].fy; + monster_desc(who_name, &p_ptr->current_floor_ptr->m_list[who], MD_WRONGDOER_NAME); } else @@ -5794,7 +5794,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da } } if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE; - if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x])) { /* The target of monsterspell becomes tha mirror(broken) */ monster_target_y = y; @@ -5810,13 +5810,13 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da x = GRID_X(path_g[j]); if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE; if (!who && (project_m_n == 1) && !jump) { - if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; + if (p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) { + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx); + health_track(p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx); } } } @@ -5833,14 +5833,14 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE)) notice = TRUE; if (!who && (project_m_n == 1) && !jump) { - if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) + if (p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx); + health_track(p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx); } } } @@ -5931,7 +5931,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da if( second_step )continue; break; } - if( is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && !second_step ) + if( is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x]) && !second_step ) { /* The target of monsterspell becomes tha mirror(broken) */ monster_target_y = y; @@ -5963,13 +5963,13 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da px = GRID_X(path_g[i]); (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE); if(!who && (project_m_n == 1) && !jump){ - if(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){ - monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; + if(p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){ + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx]; if (m_ptr->ml) { if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx); + health_track(p_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx); } } } @@ -6242,7 +6242,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da if (flg & PROJECT_KILL) { - see_s_msg = (who > 0) ? is_seen(¤t_floor_ptr->m_list[who]) : + see_s_msg = (who > 0) ? is_seen(&p_ptr->current_floor_ptr->m_list[who]) : (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1))); } @@ -6340,11 +6340,11 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da /* A single bolt may be reflected */ if (grids <= 1) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx]; monster_race *ref_ptr = &r_info[m_ptr->r_idx]; - if ((flg & PROJECT_REFLECTABLE) && current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) && - ((current_floor_ptr->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) && + if ((flg & PROJECT_REFLECTABLE) && p_ptr->current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) && + ((p_ptr->current_floor_ptr->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) && (!who || dist_hack > 1) && !one_in_(10)) { POSITION t_y, t_x; @@ -6382,7 +6382,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da else flg |= PROJECT_PLAYER; /* The bolt is reflected */ - project(current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell); + project(p_ptr->current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell); /* Don't affect the monster any longer */ continue; @@ -6484,14 +6484,14 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da y = project_m_y; /* Track if possible */ - if (current_floor_ptr->grid_array[y][x].m_idx > 0) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx]; if (m_ptr->ml) { if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); - health_track(current_floor_ptr->grid_array[y][x].m_idx); + health_track(p_ptr->current_floor_ptr->grid_array[y][x].m_idx); } } } @@ -6577,7 +6577,7 @@ bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT da { GAME_TEXT m_name[MAX_NLEN]; - monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0); + monster_desc(m_name, &p_ptr->current_floor_ptr->m_list[p_ptr->riding], 0); if (rakubadam_m > 0) { @@ -6622,11 +6622,11 @@ bool binding_field(HIT_POINT dam) monster_target_y = p_ptr->y; monster_target_x = p_ptr->x; - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x]) && distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE && distance(p_ptr->y, p_ptr->x, y, x) != 0 && player_has_los_bold(y, x) && @@ -6756,16 +6756,16 @@ void seal_of_mirror(HIT_POINT dam) { POSITION x, y; - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x])) { if (project_m(0, 0, y, x, dam, GF_GENOCIDE, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE)) { - if (!current_floor_ptr->grid_array[y][x].m_idx) + if (!p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { remove_mirror(y, x); } diff --git a/src/spells2.c b/src/spells2.c index e099825a1..73f7978dc 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -73,13 +73,13 @@ static bool detect_feat_flag(POSITION range, int flag, bool known) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; /* Scan the current panel */ - for (y = 1; y < current_floor_ptr->height - 1; y++) + for (y = 1; y < p_ptr->current_floor_ptr->height - 1; y++) { - for (x = 1; x <= current_floor_ptr->width - 1; x++) + for (x = 1; x <= p_ptr->current_floor_ptr->width - 1; x++) { int dist = distance(p_ptr->y, p_ptr->x, y, x); if (dist > range) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Hack -- Safe */ if (flag == FF_TRAP) @@ -199,9 +199,9 @@ bool detect_objects_gold(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3; /* Scan objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue; @@ -251,9 +251,9 @@ bool detect_objects_normal(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3; /* Scan objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue; @@ -311,9 +311,9 @@ bool detect_objects_magic(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; /* Scan all objects */ - for (i = 1; i < current_floor_ptr->o_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++) { - object_type *o_ptr = ¤t_floor_ptr->o_list[i]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i]; if (!OBJECT_IS_VALID(o_ptr)) continue; if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue; @@ -382,9 +382,9 @@ bool detect_monsters_normal(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -428,9 +428,9 @@ bool detect_monsters_invis(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -480,9 +480,9 @@ bool detect_monsters_evil(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -535,9 +535,9 @@ bool detect_monsters_nonliving(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; y = m_ptr->fy; @@ -583,9 +583,9 @@ bool detect_monsters_mind(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -634,9 +634,9 @@ bool detect_monsters_string(POSITION range, concptr Match) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -687,9 +687,9 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -787,9 +787,9 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) bool obvious = FALSE; /* Mark all (nearby) monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; y = m_ptr->fy; @@ -803,9 +803,9 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) } /* Affect all marked monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; /* Skip unmarked monsters */ if (!(m_ptr->mflag & (MFLAG_LOS))) continue; @@ -975,9 +975,9 @@ void aggravate_monsters(MONSTER_IDX who) bool speed = FALSE; /* Aggravate everyone nearby */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; /* Skip aggravating monster (or player) */ @@ -1024,7 +1024,7 @@ void aggravate_monsters(MONSTER_IDX who) bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name) { int msec = delay_factor * delay_factor * delay_factor; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool resist = FALSE; @@ -1034,7 +1034,7 @@ bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE; else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE; else if (m_idx == p_ptr->riding) resist = TRUE; - else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) resist = TRUE; + else if ((p_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) resist = TRUE; else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE; else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE; @@ -1113,7 +1113,7 @@ bool symbol_genocide(int power, bool player_cast) bool result = FALSE; /* Prevent genocide in quest levels */ - if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) + if ((p_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) { msg_print(_("何も起きないようだ……", "It seems nothing happen here...")); return (FALSE); @@ -1123,9 +1123,9 @@ bool symbol_genocide(int power, bool player_cast) while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ; /* Delete the monsters of that "type" */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -1157,15 +1157,15 @@ bool mass_genocide(int power, bool player_cast) bool result = FALSE; /* Prevent mass genocide in quest levels */ - if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) + if ((p_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) { return (FALSE); } /* Delete the (nearby) monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; /* Skip distant monsters */ @@ -1197,15 +1197,15 @@ bool mass_genocide_undead(int power, bool player_cast) bool result = FALSE; /* Prevent mass genocide in quest levels */ - if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) + if ((p_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) { return (FALSE); } /* Delete the (nearby) monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -1247,9 +1247,9 @@ bool probing(void) Term->scr->cv = 1; /* Probe all (nearby) monsters */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (!monster_is_valid(m_ptr)) continue; @@ -1371,9 +1371,9 @@ void discharge_minion(void) MONSTER_IDX i; bool okay = TRUE; - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!m_ptr->r_idx || !is_pet(m_ptr)) continue; if (m_ptr->nickname) okay = FALSE; } @@ -1382,10 +1382,10 @@ void discharge_minion(void) if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? "))) return; } - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { HIT_POINT dam; - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; monster_race *r_ptr; if (!m_ptr->r_idx || !is_pet(m_ptr)) continue; @@ -1446,7 +1446,7 @@ static void cave_temp_room_lite(void) POSITION y = tmp_pos.y[i]; POSITION x = tmp_pos.x[i]; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* No longer in the array */ g_ptr->info &= ~(CAVE_TEMP); @@ -1461,7 +1461,7 @@ static void cave_temp_room_lite(void) if (g_ptr->m_idx) { PERCENTAGE chance = 25; - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; update_monster(g_ptr->m_idx, FALSE); @@ -1521,7 +1521,7 @@ static void cave_temp_room_unlite(void) POSITION x = tmp_pos.x[i]; int j; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; bool do_dark = !is_mirror_grid(g_ptr); /* No longer in the array */ @@ -1530,7 +1530,7 @@ static void cave_temp_room_unlite(void) /* Darken the grid */ if (do_dark) { - if (current_floor_ptr->dun_level || !is_daytime()) + if (p_ptr->current_floor_ptr->dun_level || !is_daytime()) { for (j = 0; j < 9; j++) { @@ -1539,7 +1539,7 @@ static void cave_temp_room_unlite(void) if (in_bounds2(by, bx)) { - grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx]; + grid_type *cc_ptr = &p_ptr->current_floor_ptr->grid_array[by][bx]; if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW)) { @@ -1653,7 +1653,7 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION)) { grid_type *g_ptr; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Avoid infinite recursion */ if (g_ptr->info & (CAVE_TEMP)) return; @@ -1678,7 +1678,7 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa * properly. * This leaves only a check for 6 bounding walls! */ - if (in_bounds(current_floor_ptr, y, x) && pass_bold(y, x) && + if (in_bounds(p_ptr->current_floor_ptr, y, x) && pass_bold(y, x) && (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return; } @@ -1780,7 +1780,7 @@ void lite_room(POSITION y1, POSITION x1) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE); + if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE); } } @@ -2152,7 +2152,7 @@ bool teleport_swap(DIRECTION dir) tx = p_ptr->x + ddx[dir]; ty = p_ptr->y + ddy[dir]; } - g_ptr = ¤t_floor_ptr->grid_array[ty][tx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx]; if (p_ptr->anti_tele) { @@ -2172,7 +2172,7 @@ bool teleport_swap(DIRECTION dir) return FALSE; } - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; r_ptr = &r_info[m_ptr->r_idx]; (void)set_monster_csleep(g_ptr->m_idx, 0); @@ -2594,7 +2594,7 @@ bool activate_ty_curse(bool stop_ty, int *count) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); if (!one_in_(6)) break; case 7: case 8: case 9: case 18: - (*count) += summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (*count) += summon_specific(0, p_ptr->y, p_ptr->x, p_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); if (!one_in_(6)) break; case 10: case 11: case 12: msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away...")); @@ -2626,7 +2626,7 @@ bool activate_ty_curse(bool stop_ty, int *count) /* * Only summon Cyberdemons deep in the dungeon. */ - if ((current_floor_ptr->dun_level > 65) && !stop_ty) + if ((p_ptr->current_floor_ptr->dun_level > 65) && !stop_ty) { (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x); stop_ty = TRUE; @@ -2681,11 +2681,11 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet) if (!pet) mode |= PM_NO_PET; - summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level); + summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : p_ptr->current_floor_ptr->dun_level); - for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++) + for (i = 0; i < (randint1(7) + (p_ptr->current_floor_ptr->dun_level / 40)); i++) { - switch (randint1(25) + (current_floor_ptr->dun_level / 20)) + switch (randint1(25) + (p_ptr->current_floor_ptr->dun_level / 20)) { case 1: case 2: count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode); @@ -3019,7 +3019,7 @@ bool rush_attack(bool *mdeath) ty = target_row; } - if (in_bounds(current_floor_ptr, ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx; + if (in_bounds(p_ptr->current_floor_ptr, ty, tx)) tm_idx = p_ptr->current_floor_ptr->grid_array[ty][tx].m_idx; path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL); project_length = 0; @@ -3039,7 +3039,7 @@ bool rush_attack(bool *mdeath) int ny = GRID_Y(path_g[i]); int nx = GRID_X(path_g[i]); - if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0)) + if (cave_empty_bold(ny, nx) && player_can_enter(p_ptr->current_floor_ptr->grid_array[ny][nx].feat, 0)) { ty = ny; tx = nx; @@ -3048,7 +3048,7 @@ bool rush_attack(bool *mdeath) continue; } - if (!current_floor_ptr->grid_array[ny][nx].m_idx) + if (!p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx) { if (tm_idx) { @@ -3065,12 +3065,12 @@ bool rush_attack(bool *mdeath) /* Move player before updating the monster */ if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL); - update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE); + update_monster(p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx, TRUE); /* Found a monster */ - m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx]; - if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx) + if (tm_idx != p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx) { #ifdef JP msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か"); @@ -3111,11 +3111,11 @@ void remove_all_mirrors(bool explode) { POSITION x, y; - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x])) { remove_mirror(y, x); if (explode) @@ -3269,7 +3269,7 @@ void wild_magic(int spell) case 35: while (counter++ < 8) { - (void)summon_specific(0, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); + (void)summon_specific(0, p_ptr->y, p_ptr->x, (p_ptr->current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); } break; case 36: @@ -3322,7 +3322,7 @@ void cast_meteor(HIT_POINT dam, POSITION rad) if (d >= 9) continue; - if (!in_bounds(current_floor_ptr, y, x) || !projectable(p_ptr->y, p_ptr->x, y, x) + if (!in_bounds(p_ptr->current_floor_ptr, y, x) || !projectable(p_ptr->y, p_ptr->x, y, x) || !cave_have_flag_bold(y, x, FF_PROJECT)) continue; /* Valid position */ @@ -3382,7 +3382,7 @@ bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad) if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break; /* Stopped by monsters */ - if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break; + if ((dir != 5) && p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break; /* Save the new location */ x = nx; @@ -3414,7 +3414,7 @@ bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad) if (count < 0) continue; /* Cannot penetrate perm walls */ - if (!in_bounds(current_floor_ptr, y, x) || + if (!in_bounds(p_ptr->current_floor_ptr, y, x) || cave_stop_disintegration(y, x) || !in_disintegration_range(ty, tx, y, x)) continue; @@ -3550,7 +3550,7 @@ void cast_invoke_spirits(DIRECTION dir) msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!", "Oh no! Mouldering forms rise from the earth around you!")); - (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (void)summon_specific(0, p_ptr->y, p_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); chg_virtue(p_ptr, V_UNLIFE, 1); } else if (die < 14) @@ -3710,7 +3710,7 @@ void cast_shuffle(void) else if (die < 14) { msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!")); - summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + summon_specific(0, p_ptr->y, p_ptr->x, p_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } else if (die < 18) { @@ -3732,7 +3732,7 @@ void cast_shuffle(void) else if (die < 30) { msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster.")); - trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE); + trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (p_ptr->current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE); } else if (die < 33) { @@ -3783,22 +3783,22 @@ void cast_shuffle(void) else if (die < 82) { msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster.")); - trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L); + trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (p_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L); } else if (die < 84) { msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster.")); - trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L); + trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (p_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L); } else if (die < 86) { msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster.")); - trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L); + trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (p_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L); } else if (die < 88) { msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster.")); - trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L); + trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (p_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L); } else if (die < 96) { @@ -3866,7 +3866,7 @@ bool_hack vampirism(void) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; stop_mouth(); @@ -3909,7 +3909,7 @@ bool panic_hit(void) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { py_attack(p_ptr, y, x, 0); if (randint0(p_ptr->skill_dis) < 7) @@ -4216,7 +4216,7 @@ void hayagake(player_type *creature_ptr) } else { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]; feature_type *f_ptr = &f_info[g_ptr->feat]; if (!have_flag(f_ptr->flags, FF_PROJECT) || @@ -4240,7 +4240,7 @@ bool double_attack(player_type *creature_ptr) if (!get_rep_dir(&dir, FALSE)) return FALSE; y = creature_ptr->y + ddy[dir]; x = creature_ptr->x + ddx[dir]; - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { if (one_in_(3)) msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!", @@ -4253,7 +4253,7 @@ bool double_attack(player_type *creature_ptr) "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!")); py_attack(p_ptr, y, x, 0); - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { handle_stuff(); py_attack(p_ptr, y, x, 0); @@ -4321,7 +4321,7 @@ bool mirror_concentration(player_type *creature_ptr) msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now.")); return FALSE; } - if (is_mirror_grid(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])) + if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])) { msg_print(_("少し頭がハッキリした。", "You feel your head clear a little.")); @@ -4352,7 +4352,7 @@ bool sword_dancing(player_type *creature_ptr) dir = randint0(8); y = creature_ptr->y + ddy_ddd[dir]; x = creature_ptr->x + ddx_ddd[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Hack -- attack monsters */ if (g_ptr->m_idx) @@ -4390,7 +4390,7 @@ bool rodeo(player_type *creature_ptr) } if (!do_cmd_riding(creature_ptr, TRUE)) return TRUE; - m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding]; + m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); msg_format(_("%sに乗った。", "You ride on %s."), m_name); diff --git a/src/spells3.c b/src/spells3.c index ff1df6bc7..540152187 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -82,7 +82,7 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) bool look = TRUE; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if (!monster_is_valid(m_ptr)) return (FALSE); oy = m_ptr->fy; @@ -119,13 +119,13 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) } /* Ignore illegal locations */ - if (!in_bounds(current_floor_ptr, ny, nx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue; if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue; /* No teleporting into vaults and such */ if (!(p_ptr->inside_quest || p_ptr->inside_arena)) - if (current_floor_ptr->grid_array[ny][nx].info & CAVE_ICKY) continue; + if (p_ptr->current_floor_ptr->grid_array[ny][nx].info & CAVE_ICKY) continue; /* This grid looks good */ look = FALSE; @@ -147,10 +147,10 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) sound(SOUND_TPOTHER); /* Update the old location */ - current_floor_ptr->grid_array[oy][ox].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; /* Update the new location */ - current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; @@ -187,7 +187,7 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, int attempts = 500; POSITION dis = 2; bool look = TRUE; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; if(!m_ptr->r_idx) return; /* "Skill" test */ @@ -220,12 +220,12 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, } /* Ignore illegal locations */ - if (!in_bounds(current_floor_ptr, ny, nx)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue; if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue; /* No teleporting into vaults and such */ - /* if (current_floor_ptr->grid_array[ny][nx].info & (CAVE_ICKY)) continue; */ + /* if (p_ptr->current_floor_ptr->grid_array[ny][nx].info & (CAVE_ICKY)) continue; */ /* This grid looks good */ look = FALSE; @@ -246,10 +246,10 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, sound(SOUND_TPOTHER); /* Update the old location */ - current_floor_ptr->grid_array[oy][ox].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; /* Update the new location */ - current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; @@ -294,9 +294,9 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode) int min, pick, i; int left = MAX(1, p_ptr->x - dis); - int right = MIN(current_floor_ptr->width - 2, p_ptr->x + dis); + int right = MIN(p_ptr->current_floor_ptr->width - 2, p_ptr->x + dis); int top = MAX(1, p_ptr->y - dis); - int bottom = MIN(current_floor_ptr->height - 2, p_ptr->y + dis); + int bottom = MIN(p_ptr->current_floor_ptr->height - 2, p_ptr->y + dis); if (p_ptr->wild_mode) return FALSE; @@ -413,12 +413,12 @@ void teleport_player(POSITION dis, BIT_FLAGS mode) { for (yy = -1; yy < 2; yy++) { - MONSTER_IDX tmp_m_idx = current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx; + MONSTER_IDX tmp_m_idx = p_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx; /* A monster except your mount may follow */ if (tmp_m_idx && (p_ptr->riding != tmp_m_idx)) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[tmp_m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[tmp_m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* @@ -455,12 +455,12 @@ void teleport_player_away(MONSTER_IDX m_idx, POSITION dis) { for (yy = -1; yy < 2; yy++) { - MONSTER_IDX tmp_m_idx = current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx; + MONSTER_IDX tmp_m_idx = p_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx; /* A monster except your mount or caster may follow */ if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx)) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[tmp_m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[tmp_m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* @@ -510,11 +510,11 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) { y = (POSITION)rand_spread(ny, dis); x = (POSITION)rand_spread(nx, dis); - if (in_bounds(current_floor_ptr, y, x)) break; + if (in_bounds(p_ptr->current_floor_ptr, y, x)) break; } /* Accept any grid when wizard mode */ - if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!current_floor_ptr->grid_array[y][x].m_idx || (current_floor_ptr->grid_array[y][x].m_idx == p_ptr->riding))) break; + if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!p_ptr->current_floor_ptr->grid_array[y][x].m_idx || (p_ptr->current_floor_ptr->grid_array[y][x].m_idx == p_ptr->riding))) break; /* Accept teleportable floor grids */ if (cave_player_teleportable_bold(y, x, mode)) break; @@ -534,7 +534,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode) void teleport_away_followable(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; POSITION oldfy = m_ptr->fy; POSITION oldfx = m_ptr->fx; bool old_ml = m_ptr->ml; @@ -593,11 +593,11 @@ bool teleport_level_other(player_type *creature_ptr) GAME_TEXT m_name[MAX_NLEN]; if (!target_set(TARGET_KILL)) return FALSE; - target_m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx; + target_m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx; if (!target_m_idx) return TRUE; if (!player_has_los_bold(target_row, target_col)) return TRUE; if (!projectable(creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE; - m_ptr = ¤t_floor_ptr->m_list[target_m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[target_m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name); @@ -629,7 +629,7 @@ void teleport_level(MONSTER_IDX m_idx) } else /* To monster */ { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; /* Get the monster name (or "it") */ monster_desc(m_name, m_ptr, 0); @@ -661,7 +661,7 @@ void teleport_level(MONSTER_IDX m_idx) } /* Down only */ - if ((ironman_downward && (m_idx <= 0)) || (current_floor_ptr->dun_level <= d_info[p_ptr->dungeon_idx].mindepth)) + if ((ironman_downward && (m_idx <= 0)) || (p_ptr->current_floor_ptr->dun_level <= d_info[p_ptr->dungeon_idx].mindepth)) { #ifdef JP if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name); @@ -670,7 +670,7 @@ void teleport_level(MONSTER_IDX m_idx) #endif if (m_idx <= 0) /* To player */ { - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) { p_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon; p_ptr->oldpy = p_ptr->y; @@ -681,9 +681,9 @@ void teleport_level(MONSTER_IDX m_idx) if (autosave_l) do_cmd_save_game(TRUE); - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) { - current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].mindepth; + p_ptr->current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].mindepth; prepare_change_floor_mode(CFM_RAND_PLACE); } else @@ -695,7 +695,7 @@ void teleport_level(MONSTER_IDX m_idx) } /* Up only */ - else if (quest_number(current_floor_ptr->dun_level) || (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) + else if (quest_number(p_ptr->current_floor_ptr->dun_level) || (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) { #ifdef JP if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name); @@ -747,7 +747,7 @@ void teleport_level(MONSTER_IDX m_idx) if (m_idx <= 0) /* To player */ { /* Never reach this code on the surface */ - /* if (!current_floor_ptr->dun_level) p_ptr->dungeon_idx = p_ptr->recall_dungeon; */ + /* if (!p_ptr->current_floor_ptr->dun_level) p_ptr->dungeon_idx = p_ptr->recall_dungeon; */ if (record_stair) exe_write_diary(p_ptr, NIKKI_TELE_LEV, 1, NULL); if (autosave_l) do_cmd_save_game(TRUE); @@ -759,7 +759,7 @@ void teleport_level(MONSTER_IDX m_idx) /* Monster level teleportation is simple deleting now */ if (m_idx > 0) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; check_quest_completion(m_ptr); @@ -797,11 +797,11 @@ bool recall_player(player_type *creature_ptr, TIME_EFFECT turns) return TRUE; } - if (current_floor_ptr->dun_level && (max_dlv[p_ptr->dungeon_idx] > current_floor_ptr->dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall) + if (p_ptr->current_floor_ptr->dun_level && (max_dlv[p_ptr->dungeon_idx] > p_ptr->current_floor_ptr->dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall) { if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? "))) { - max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level; + max_dlv[p_ptr->dungeon_idx] = p_ptr->current_floor_ptr->dun_level; if (record_maxdepth) exe_write_diary(p_ptr, NIKKI_TRUMP, p_ptr->dungeon_idx, _("帰還のときに", "when recall from dungeon")); } @@ -809,7 +809,7 @@ bool recall_player(player_type *creature_ptr, TIME_EFFECT turns) } if (!creature_ptr->word_recall) { - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) { DUNGEON_IDX select_dungeon; select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14); @@ -892,7 +892,7 @@ bool reset_recall(void) (int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]); /* Default */ - sprintf(tmp_val, "%d", (int)MAX(current_floor_ptr->dun_level, 1)); + sprintf(tmp_val, "%d", (int)MAX(p_ptr->current_floor_ptr->dun_level, 1)); /* Ask for a level */ if (get_string(ppp, tmp_val, 10)) @@ -1039,17 +1039,17 @@ static bool vanish_dungeon(void) GAME_TEXT m_name[MAX_NLEN]; /* Prevent vasishing of quest levels and town */ - if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level) + if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !p_ptr->current_floor_ptr->dun_level) { return FALSE; } /* Scan all normal grids */ - for (y = 1; y < current_floor_ptr->height - 1; y++) + for (y = 1; y < p_ptr->current_floor_ptr->height - 1; y++) { - for (x = 1; x < current_floor_ptr->width - 1; x++) + for (x = 1; x < p_ptr->current_floor_ptr->width - 1; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Seeing true feature code (ignore mimic) */ f_ptr = &f_info[g_ptr->feat]; @@ -1057,7 +1057,7 @@ static bool vanish_dungeon(void) /* Lose room and vault */ g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Awake monster */ if (g_ptr->m_idx && MON_CSLEEP(m_ptr)) @@ -1078,9 +1078,9 @@ static bool vanish_dungeon(void) } /* Special boundary walls -- Top and bottom */ - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - g_ptr = ¤t_floor_ptr->grid_array[0][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[0][x]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -1095,7 +1095,7 @@ static bool vanish_dungeon(void) if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); } - g_ptr = ¤t_floor_ptr->grid_array[current_floor_ptr->height - 1][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->current_floor_ptr->height - 1][x]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -1112,9 +1112,9 @@ static bool vanish_dungeon(void) } /* Special boundary walls -- Left and right */ - for (y = 1; y < (current_floor_ptr->height - 1); y++) + for (y = 1; y < (p_ptr->current_floor_ptr->height - 1); y++) { - g_ptr = ¤t_floor_ptr->grid_array[y][0]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][0]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -1129,7 +1129,7 @@ static bool vanish_dungeon(void) if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); } - g_ptr = ¤t_floor_ptr->grid_array[y][current_floor_ptr->width - 1]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][p_ptr->current_floor_ptr->width - 1]; f_ptr = &f_info[g_ptr->mimic]; /* Lose room and vault */ @@ -1165,7 +1165,7 @@ void call_the_(void) for (i = 0; i < 9; i++) { - g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]]; if (!cave_have_flag_grid(g_ptr, FF_PROJECT)) { @@ -1197,7 +1197,7 @@ void call_the_(void) } /* Prevent destruction of quest levels and town */ - else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level) + else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !p_ptr->current_floor_ptr->dun_level) { msg_print(_("地面が揺れた。", "The ground trembles.")); } @@ -1248,7 +1248,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) GAME_TEXT o_name[MAX_NLEN]; /* Check to see if an object is already there */ - if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx) + if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx) { msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something.")); return; @@ -1266,7 +1266,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) return; } - g_ptr = ¤t_floor_ptr->grid_array[ty][tx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx]; /* We need an item to fetch */ if (!g_ptr->o_idx) @@ -1305,7 +1305,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) { ty += ddy[dir]; tx += ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[ty][tx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx]; if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) || !cave_have_flag_bold(ty, tx, FF_PROJECT)) return; @@ -1313,7 +1313,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) while (!g_ptr->o_idx); } - o_ptr = ¤t_floor_ptr->o_list[g_ptr->o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[g_ptr->o_idx]; if (o_ptr->weight > wgt) { @@ -1324,7 +1324,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los) i = g_ptr->o_idx; g_ptr->o_idx = o_ptr->next_o_idx; - current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */ + p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */ o_ptr->next_o_idx = 0; o_ptr->iy = p_ptr->y; @@ -2558,7 +2558,7 @@ PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm) chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1); if (p_ptr->riding) - chance += (MAX(r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0)); + chance += (MAX(r_info[p_ptr->current_floor_ptr->m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0)); /* Extract mana consumption rate */ need_mana = mod_need_mana(s_ptr->smana, spell, use_realm); @@ -2824,7 +2824,7 @@ static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx) for (i = 0; i < 1000; i++) { /* Pick a new race, using a level calculation */ - r = get_mon_num((current_floor_ptr->dun_level + r_ptr->level) / 2 + 5); + r = get_mon_num((p_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5); /* Handle failure */ if (!r) break; @@ -2854,8 +2854,8 @@ static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx) */ bool polymorph_monster(POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; bool polymorphed = FALSE; MONRACE_IDX new_r_idx; MONRACE_IDX old_r_idx = m_ptr->r_idx; @@ -2894,9 +2894,9 @@ bool polymorph_monster(POSITION y, POSITION x) /* Create a new monster (no groups) */ if (place_monster_aux(0, y, x, new_r_idx, mode)) { - current_floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname; - current_floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx; - current_floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx; /* Success */ polymorphed = TRUE; @@ -2906,7 +2906,7 @@ bool polymorph_monster(POSITION y, POSITION x) /* Placing the new monster failed */ if (place_monster_aux(0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN))) { - current_floor_ptr->m_list[hack_m_idx_ii] = back_m; + p_ptr->current_floor_ptr->m_list[hack_m_idx_ii] = back_m; /* Re-initialize monster process */ mproc_init(); @@ -2919,7 +2919,7 @@ bool polymorph_monster(POSITION y, POSITION x) { for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { - object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Held by new monster */ @@ -2930,7 +2930,7 @@ bool polymorph_monster(POSITION y, POSITION x) { for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { - next_o_idx = current_floor_ptr->o_list[this_o_idx].next_o_idx; + next_o_idx = p_ptr->current_floor_ptr->o_list[this_o_idx].next_o_idx; delete_object_idx(this_o_idx); } } @@ -3293,8 +3293,8 @@ void massacre(void) { y = p_ptr->y + ddy_ddd[dir]; x = p_ptr->x + ddx_ddd[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- attack monsters */ if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT))) @@ -3312,7 +3312,7 @@ bool eat_lock(void) if (!get_direction(&dir, FALSE, FALSE)) return FALSE; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; f_ptr = &f_info[g_ptr->feat]; mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)]; @@ -3328,7 +3328,7 @@ bool eat_lock(void) } else if (g_ptr->m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; msg_print(_("何かが邪魔しています!", "There's something in the way!")); if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(p_ptr, y, x, 0); @@ -3379,13 +3379,13 @@ bool shock_power(void) x = p_ptr->x + ddx[dir]; dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8); fire_beam(GF_MISSILE, dir, dam); - if (current_floor_ptr->grid_array[y][x].m_idx) + if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx) { int i; POSITION ty = y, tx = x; POSITION oy = y, ox = x; - MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + MONSTER_IDX m_idx = p_ptr->current_floor_ptr->grid_array[y][x].m_idx; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; GAME_TEXT m_name[MAX_NLEN]; @@ -3411,8 +3411,8 @@ bool shock_power(void) if ((ty != oy) || (tx != ox)) { msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name); - current_floor_ptr->grid_array[oy][ox].m_idx = 0; - current_floor_ptr->grid_array[ty][tx].m_idx = m_idx; + p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; + p_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx; m_ptr->fy = ty; m_ptr->fx = tx; @@ -3475,8 +3475,8 @@ bool detonation(player_type *creature_ptr) void blood_curse_to_enemy(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx]; BIT_FLAGS curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP); int count = 0; do @@ -3526,7 +3526,7 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY); - count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level), 0, mode); + count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : p_ptr->current_floor_ptr->dun_level), 0, mode); if (!one_in_(6)) break; } case 23: case 24: case 25: @@ -3619,7 +3619,7 @@ bool tele_town(void) POSITION x, y; int num = 0; - if (current_floor_ptr->dun_level) + if (p_ptr->current_floor_ptr->dun_level) { msg_print(_("この魔法は地上でしか使えない!", "This spell can only be used on the surface!")); return FALSE; diff --git a/src/store.c b/src/store.c index 78494bcf3..b45dff5d1 100644 --- a/src/store.c +++ b/src/store.c @@ -5720,7 +5720,7 @@ void do_cmd_store(void) store_bottom = MIN_STOCK + xtra_stock; /* Access the player grid */ - g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]; /* Verify a store */ if (!cave_have_flag_grid(g_ptr, FF_STORE)) @@ -5734,7 +5734,7 @@ void do_cmd_store(void) old_town_num = p_ptr->town_num; if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1; - if (current_floor_ptr->dun_level) p_ptr->town_num = NO_TOWN; + if (p_ptr->current_floor_ptr->dun_level) p_ptr->town_num = NO_TOWN; inner_town_num = p_ptr->town_num; /* Hack -- Check the "locked doors" */ @@ -5762,7 +5762,7 @@ void do_cmd_store(void) town_info[p_ptr->town_num].store[which].last_visit = current_world_ptr->game_turn; } - forget_lite(current_floor_ptr); + forget_lite(p_ptr->current_floor_ptr); forget_view(); /* Hack -- Character is in "icky" mode */ diff --git a/src/targeting.c b/src/targeting.c index 1e1421d70..096c1615b 100644 --- a/src/targeting.c +++ b/src/targeting.c @@ -108,8 +108,8 @@ void verify_panel(void) get_screen_size(&wid, &hgt); - max_prow_min = current_floor_ptr->height - hgt; - max_pcol_min = current_floor_ptr->width - wid; + max_prow_min = p_ptr->current_floor_ptr->height - hgt; + max_pcol_min = p_ptr->current_floor_ptr->width - wid; /* Bounds checking */ if (max_prow_min < 0) max_prow_min = 0; @@ -210,7 +210,7 @@ void verify_panel(void) */ bool target_able(MONSTER_IDX m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; /* Monster must be alive */ if (!monster_is_valid(m_ptr)) return (FALSE); @@ -257,7 +257,7 @@ bool target_okay(void) /* Accept reasonable targets */ if (target_able(target_who)) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[target_who]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[target_who]; /* Acquire monster location */ target_row = m_ptr->fy; @@ -324,19 +324,19 @@ static bool target_set_accept(POSITION y, POSITION x) grid_type *g_ptr; OBJECT_IDX this_o_idx, next_o_idx = 0; - if (!(in_bounds(current_floor_ptr, y, x))) return (FALSE); + if (!(in_bounds(p_ptr->current_floor_ptr, y, x))) return (FALSE); /* Player grid is always interesting */ if (player_bold(y, x)) return (TRUE); if (p_ptr->image) return (FALSE); - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Visible monsters */ if (g_ptr->m_idx) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Visible monsters */ if (m_ptr->ml) return (TRUE); @@ -346,7 +346,7 @@ static bool target_set_accept(POSITION y, POSITION x) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Memorized object */ @@ -381,9 +381,9 @@ static void target_set_prepare(BIT_FLAGS mode) { /* Inner range */ min_hgt = MAX((p_ptr->y - MAX_RANGE), 0); - max_hgt = MIN((p_ptr->y + MAX_RANGE), current_floor_ptr->height - 1); + max_hgt = MIN((p_ptr->y + MAX_RANGE), p_ptr->current_floor_ptr->height - 1); min_wid = MAX((p_ptr->x - MAX_RANGE), 0); - max_wid = MIN((p_ptr->x + MAX_RANGE), current_floor_ptr->width - 1); + max_wid = MIN((p_ptr->x + MAX_RANGE), p_ptr->current_floor_ptr->width - 1); } else /* not targetting */ { @@ -407,12 +407,12 @@ static void target_set_prepare(BIT_FLAGS mode) /* Require "interesting" contents */ if (!target_set_accept(y, x)) continue; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Require target_able monsters for "TARGET_KILL" */ if ((mode & (TARGET_KILL)) && !target_able(g_ptr->m_idx)) continue; - if ((mode & (TARGET_KILL)) && !target_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx])) continue; + if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&p_ptr->current_floor_ptr->m_list[g_ptr->m_idx])) continue; /* Save the location */ tmp_pos.x[tmp_pos.n] = x; @@ -529,7 +529,7 @@ bool show_gold_on_floor = FALSE; */ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; concptr s1 = "", s2 = "", s3 = "", x_info = ""; bool boring = TRUE; @@ -593,9 +593,9 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info) /* Actual monsters */ - if (g_ptr->m_idx && current_floor_ptr->m_list[g_ptr->m_idx].ml) + if (g_ptr->m_idx && p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; GAME_TEXT m_name[MAX_NLEN]; bool recall = FALSE; @@ -688,7 +688,7 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info) GAME_TEXT o_name[MAX_NLEN]; object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; object_desc(o_name, o_ptr, 0); @@ -733,7 +733,7 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info) GAME_TEXT o_name[MAX_NLEN]; object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[floor_list[0]]; + o_ptr = &p_ptr->current_floor_ptr->o_list[floor_list[0]]; object_desc(o_name, o_ptr, 0); @@ -807,18 +807,18 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info) o_idx = g_ptr->o_idx; /* Only rotate a pile of two or more objects. */ - if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) continue; + if (!(o_idx && p_ptr->current_floor_ptr->o_list[o_idx].next_o_idx)) continue; /* Remove the first object from the list. */ excise_object_idx(o_idx); /* Find end of the list. */ i = g_ptr->o_idx; - while (current_floor_ptr->o_list[i].next_o_idx) - i = current_floor_ptr->o_list[i].next_o_idx; + while (p_ptr->current_floor_ptr->o_list[i].next_o_idx) + i = p_ptr->current_floor_ptr->o_list[i].next_o_idx; /* Add after the last object. */ - current_floor_ptr->o_list[i].next_o_idx = o_idx; + p_ptr->current_floor_ptr->o_list[i].next_o_idx = o_idx; /* Loop and re-display the list */ } @@ -831,7 +831,7 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, concptr info) for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; if (o_ptr->marked & OM_FOUND) @@ -1099,7 +1099,7 @@ bool target_set(BIT_FLAGS mode) if (!(mode & TARGET_LOOK)) prt_path(y, x); /* Access */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Allow target */ if (target_able(g_ptr->m_idx)) @@ -1314,11 +1314,11 @@ bool target_set(BIT_FLAGS mode) } /* Slide into legality */ - if (x >= current_floor_ptr->width-1) x = current_floor_ptr->width - 2; + if (x >= p_ptr->current_floor_ptr->width-1) x = p_ptr->current_floor_ptr->width - 2; else if (x <= 0) x = 1; /* Slide into legality */ - if (y >= current_floor_ptr->height-1) y = current_floor_ptr->height- 2; + if (y >= p_ptr->current_floor_ptr->height-1) y = p_ptr->current_floor_ptr->height- 2; else if (y <= 0) y = 1; } } @@ -1336,7 +1336,7 @@ bool target_set(BIT_FLAGS mode) if (!(mode & TARGET_LOOK)) prt_path(y, x); /* Access */ - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Default prompt */ strcpy(info, _("qæ­¢ t決 p自 m近 +次 -前", "q,t,p,m,+,-,")); @@ -1488,11 +1488,11 @@ bool target_set(BIT_FLAGS mode) } /* Slide into legality */ - if (x >= current_floor_ptr->width-1) x = current_floor_ptr->width - 2; + if (x >= p_ptr->current_floor_ptr->width-1) x = p_ptr->current_floor_ptr->width - 2; else if (x <= 0) x = 1; /* Slide into legality */ - if (y >= current_floor_ptr->height-1) y = current_floor_ptr->height- 2; + if (y >= p_ptr->current_floor_ptr->height-1) y = p_ptr->current_floor_ptr->height- 2; else if (y <= 0) y = 1; } } @@ -1723,7 +1723,7 @@ bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed) } else if (p_ptr->riding && with_steed) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (MON_CONFUSED(m_ptr)) @@ -1758,7 +1758,7 @@ bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed) else { GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; monster_desc(m_name, m_ptr, 0); if (MON_CONFUSED(m_ptr)) @@ -1868,7 +1868,7 @@ bool get_rep_dir(DIRECTION *dp, bool under) } else if (p_ptr->riding) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; if (MON_CONFUSED(m_ptr)) @@ -1903,7 +1903,7 @@ bool get_rep_dir(DIRECTION *dp, bool under) else { GAME_TEXT m_name[MAX_NLEN]; - monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; monster_desc(m_name, m_ptr, 0); if (MON_CONFUSED(m_ptr)) @@ -1936,14 +1936,14 @@ static bool tgt_pt_accept(POSITION y, POSITION x) { grid_type *g_ptr; - if (!(in_bounds(current_floor_ptr, y, x))) return (FALSE); + if (!(in_bounds(p_ptr->current_floor_ptr, y, x))) return (FALSE); /* Player grid is always interesting */ if ((y == p_ptr->y) && (x == p_ptr->x)) return (TRUE); if (p_ptr->image) return (FALSE); - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Interesting memorized features */ if (g_ptr->info & (CAVE_MARK)) @@ -1975,9 +1975,9 @@ static void tgt_pt_prepare(void) if (!expand_list) return; /* Scan the current panel */ - for (y = 1; y < current_floor_ptr->height; y++) + for (y = 1; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 1; x < current_floor_ptr->width; x++) + for (x = 1; x < p_ptr->current_floor_ptr->width; x++) { /* Require "interesting" contents */ if (!tgt_pt_accept(y, x)) continue; @@ -2055,7 +2055,7 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr) /* Skip stairs which have defferent distance */ for (; n < tmp_pos.n; ++ n) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[tmp_pos.y[n]][tmp_pos.x[n]]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[tmp_pos.y[n]][tmp_pos.x[n]]; if (cave_have_flag_grid(g_ptr, FF_STAIRS) && cave_have_flag_grid(g_ptr, ch == '>' ? FF_MORE : FF_LESS)) @@ -2140,11 +2140,11 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr) } /* Slide into legality */ - if (x >= current_floor_ptr->width-1) x = current_floor_ptr->width - 2; + if (x >= p_ptr->current_floor_ptr->width-1) x = p_ptr->current_floor_ptr->width - 2; else if (x <= 0) x = 1; /* Slide into legality */ - if (y >= current_floor_ptr->height-1) y = current_floor_ptr->height- 2; + if (y >= p_ptr->current_floor_ptr->height-1) y = p_ptr->current_floor_ptr->height- 2; else if (y <= 0) y = 1; } diff --git a/src/trap.c b/src/trap.c index 503d60a8c..501dd8fd1 100644 --- a/src/trap.c +++ b/src/trap.c @@ -158,10 +158,10 @@ FEAT_IDX choose_random_trap(void) if (!have_flag(f_info[feat].flags, FF_MORE)) break; /* Hack -- no trap doors on special levels */ - if (p_ptr->inside_arena || quest_number(current_floor_ptr->dun_level)) continue; + if (p_ptr->inside_arena || quest_number(p_ptr->current_floor_ptr->dun_level)) continue; /* Hack -- no trap doors on the deepest level */ - if (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) continue; + if (p_ptr->current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth) continue; break; } @@ -178,7 +178,7 @@ FEAT_IDX choose_random_trap(void) */ void disclose_grid(POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (cave_have_flag_grid(g_ptr, FF_SECRET)) { @@ -207,10 +207,10 @@ void disclose_grid(POSITION y, POSITION x) */ void place_trap(POSITION y, POSITION x) { - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Paranoia -- verify location */ - if (!in_bounds(current_floor_ptr, y, x)) return; + if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return; /* Require empty, clean, floor grid */ if (!cave_clean_bold(y, x)) return; @@ -406,7 +406,7 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) { int i, num, dam; POSITION x = trapped_ptr->x, y = trapped_ptr->y; - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; feature_type *f_ptr = &f_info[g_ptr->feat]; int trap_feat_type = have_flag(f_ptr->flags, FF_TRAP) ? f_ptr->subtype : NOT_TRAP; concptr name = _("トラップ", "a trap"); @@ -464,10 +464,10 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) num = 2 + randint1(3); for (i = 0; i < num; i++) { - (void)summon_specific(0, y, x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (void)summon_specific(0, y, x, p_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } - if (current_floor_ptr->dun_level > randint1(100)) /* No nasty effect for low levels */ + if (p_ptr->current_floor_ptr->dun_level > randint1(100)) /* No nasty effect for low levels */ { bool stop_ty = FALSE; int count = 0; @@ -612,7 +612,7 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) msg_print(_("突然天界の戦争に巻き込まれた!", "Suddenly, you are surrounded by immotal beings!")); /* Summon Demons and Angels */ - for (lev = current_floor_ptr->dun_level; lev >= 20; lev -= 1 + lev / 16) + for (lev = p_ptr->current_floor_ptr->dun_level; lev >= 20; lev -= 1 + lev / 16) { num = levs[MIN(lev / 10, 9)]; for (i = 0; i < num; i++) @@ -620,7 +620,7 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) POSITION x1 = rand_spread(x, 7); POSITION y1 = rand_spread(y, 5); - if (!in_bounds(current_floor_ptr, y1, x1)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, y1, x1)) continue; /* Require line of projection */ if (!projectable(trapped_ptr->y, trapped_ptr->x, y1, x1)) continue; @@ -636,8 +636,8 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) /* Let them fight each other */ if (evil_idx && good_idx) { - monster_type *evil_ptr = ¤t_floor_ptr->m_list[evil_idx]; - monster_type *good_ptr = ¤t_floor_ptr->m_list[good_idx]; + monster_type *evil_ptr = &p_ptr->current_floor_ptr->m_list[evil_idx]; + monster_type *good_ptr = &p_ptr->current_floor_ptr->m_list[good_idx]; evil_ptr->target_y = good_ptr->fy; evil_ptr->target_x = good_ptr->fx; good_ptr->target_y = evil_ptr->fy; @@ -656,10 +656,10 @@ void hit_trap(player_type *trapped_ptr, bool break_trap) fire_ball_hide(GF_WATER_FLOW, 0, 1, 10); /* Summon Piranhas */ - num = 1 + current_floor_ptr->dun_level / 20; + num = 1 + p_ptr->current_floor_ptr->dun_level / 20; for (i = 0; i < num; i++) { - (void)summon_specific(0, y, x, current_floor_ptr->dun_level, SUMMON_PIRANHAS, (PM_ALLOW_GROUP | PM_NO_PET)); + (void)summon_specific(0, y, x, p_ptr->current_floor_ptr->dun_level, SUMMON_PIRANHAS, (PM_ALLOW_GROUP | PM_NO_PET)); } break; } diff --git a/src/util.c b/src/util.c index bd91c41c7..dbe73652c 100644 --- a/src/util.c +++ b/src/util.c @@ -1842,11 +1842,11 @@ void select_floor_music(player_type *player_ptr) { if (!play_music(TERM_XTRA_MUSIC_DUNGEON, player_ptr->dungeon_idx)) return; - if (current_floor_ptr->dun_level < 40) + if (p_ptr->current_floor_ptr->dun_level < 40) { if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_LOW)) return; } - else if (current_floor_ptr->dun_level < 80) + else if (p_ptr->current_floor_ptr->dun_level < 80) { if (!play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_MED)) return; } @@ -1864,7 +1864,7 @@ void select_floor_music(player_type *player_ptr) return; } - if(!current_floor_ptr->dun_level) + if(!p_ptr->current_floor_ptr->dun_level) { if (player_ptr->lev >= 45) { @@ -4340,7 +4340,7 @@ static char inkey_from_menu(void) if (p_ptr->pclass == special_menu_info[hoge].jouken_naiyou) menu_name = special_menu_info[hoge].name; break; case MENU_WILD: - if (!current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest) + if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest) { if ((byte)p_ptr->wild_mode == special_menu_info[hoge].jouken_naiyou) menu_name = special_menu_info[hoge].name; } diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 7b82e8063..b1239d19b 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -199,7 +199,7 @@ concptr map_name(void) return _("アリーナ", "Arena"); else if (p_ptr->phase_out) return _("闘技場", "Monster Arena"); - else if (!current_floor_ptr->dun_level && p_ptr->town_num) + else if (!p_ptr->current_floor_ptr->dun_level && p_ptr->town_num) return town_info[p_ptr->town_num].name; else return d_name+d_info[p_ptr->dungeon_idx].name; @@ -970,7 +970,7 @@ static void prt_depth(void) col_depth = wid + COL_DEPTH; row_depth = hgt + ROW_DEPTH; - if (!current_floor_ptr->dun_level) + if (!p_ptr->current_floor_ptr->dun_level) { strcpy(depths, _("地上", "Surf.")); } @@ -980,8 +980,8 @@ static void prt_depth(void) } else { - if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)current_floor_ptr->dun_level * 50); - else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)current_floor_ptr->dun_level); + if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)p_ptr->current_floor_ptr->dun_level * 50); + else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)p_ptr->current_floor_ptr->dun_level); /* Get color of level based on feeling -JSV- */ switch (p_ptr->feeling) @@ -1192,7 +1192,7 @@ static void prt_speed(void) { if (p_ptr->riding) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE; else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET; else attr = TERM_GREEN; @@ -1208,7 +1208,7 @@ static void prt_speed(void) { if (p_ptr->riding) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding]; if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE; else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET; else attr = TERM_RED; @@ -1390,7 +1390,7 @@ static void health_redraw(bool riding) col = COL_INFO; } - m_ptr = ¤t_floor_ptr->m_list[health_who]; + m_ptr = &p_ptr->current_floor_ptr->m_list[health_who]; if (current_world_ptr->wizard && p_ptr->phase_out) { @@ -1402,32 +1402,32 @@ static void health_redraw(bool riding) Term_putstr(col - 2, row + 2, 12, TERM_WHITE, " / "); Term_putstr(col - 2, row + 3, 12, TERM_WHITE, " / "); - if(current_floor_ptr->m_list[1].r_idx) + if(p_ptr->current_floor_ptr->m_list[1].r_idx) { - Term_putstr(col - 2, row, 2, r_info[current_floor_ptr->m_list[1].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[1].r_idx].x_char)); - Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].hp)); - Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].max_maxhp)); + Term_putstr(col - 2, row, 2, r_info[p_ptr->current_floor_ptr->m_list[1].r_idx].x_attr, format("%c", r_info[p_ptr->current_floor_ptr->m_list[1].r_idx].x_char)); + Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", p_ptr->current_floor_ptr->m_list[1].hp)); + Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", p_ptr->current_floor_ptr->m_list[1].max_maxhp)); } - if(current_floor_ptr->m_list[2].r_idx) + if(p_ptr->current_floor_ptr->m_list[2].r_idx) { - Term_putstr(col - 2, row + 1, 2, r_info[current_floor_ptr->m_list[2].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[2].r_idx].x_char)); - Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].hp)); - Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].max_maxhp)); + Term_putstr(col - 2, row + 1, 2, r_info[p_ptr->current_floor_ptr->m_list[2].r_idx].x_attr, format("%c", r_info[p_ptr->current_floor_ptr->m_list[2].r_idx].x_char)); + Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", p_ptr->current_floor_ptr->m_list[2].hp)); + Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", p_ptr->current_floor_ptr->m_list[2].max_maxhp)); } - if(current_floor_ptr->m_list[3].r_idx) + if(p_ptr->current_floor_ptr->m_list[3].r_idx) { - Term_putstr(col - 2, row + 2, 2, r_info[current_floor_ptr->m_list[3].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[3].r_idx].x_char)); - Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].hp)); - Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].max_maxhp)); + Term_putstr(col - 2, row + 2, 2, r_info[p_ptr->current_floor_ptr->m_list[3].r_idx].x_attr, format("%c", r_info[p_ptr->current_floor_ptr->m_list[3].r_idx].x_char)); + Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", p_ptr->current_floor_ptr->m_list[3].hp)); + Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", p_ptr->current_floor_ptr->m_list[3].max_maxhp)); } - if(current_floor_ptr->m_list[4].r_idx) + if(p_ptr->current_floor_ptr->m_list[4].r_idx) { - Term_putstr(col - 2, row + 3, 2, r_info[current_floor_ptr->m_list[4].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[4].r_idx].x_char)); - Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].hp)); - Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].max_maxhp)); + Term_putstr(col - 2, row + 3, 2, r_info[p_ptr->current_floor_ptr->m_list[4].r_idx].x_attr, format("%c", r_info[p_ptr->current_floor_ptr->m_list[4].r_idx].x_char)); + Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", p_ptr->current_floor_ptr->m_list[4].hp)); + Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", p_ptr->current_floor_ptr->m_list[4].max_maxhp)); } } else @@ -1654,9 +1654,9 @@ void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){ int i; for(i=0;igrid_array[tmp_pos.y[i]][tmp_pos.x[i]]; - if(!g_ptr->m_idx || !current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + grid_type* g_ptr = &p_ptr->current_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]]; + if(!g_ptr->m_idx || !p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; if(is_pet(m_ptr))continue;//pet if(!m_ptr->r_idx)continue;//dead? { @@ -2369,8 +2369,8 @@ void resize_map(void) panel_col_max = 0; /* Reset the panels */ - panel_row_min = current_floor_ptr->height; - panel_col_min = current_floor_ptr->width; + panel_row_min = p_ptr->current_floor_ptr->height; + panel_col_min = p_ptr->current_floor_ptr->width; verify_panel(); @@ -2431,11 +2431,11 @@ bool change_panel(POSITION dy, POSITION dx) x = panel_col_min + dx * wid / 2; /* Verify the row */ - if (y > current_floor_ptr->height - hgt) y = current_floor_ptr->height - hgt; + if (y > p_ptr->current_floor_ptr->height - hgt) y = p_ptr->current_floor_ptr->height - hgt; if (y < 0) y = 0; /* Verify the col */ - if (x > current_floor_ptr->width - wid) x = current_floor_ptr->width - wid; + if (x > p_ptr->current_floor_ptr->width - wid) x = p_ptr->current_floor_ptr->width - wid; if (x < 0) x = 0; /* Handle "changes" */ @@ -2524,9 +2524,9 @@ void prt_map(void) /* Get bounds */ xmin = (0 < panel_col_min) ? panel_col_min : 0; - xmax = (current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : current_floor_ptr->width - 1; + xmax = (p_ptr->current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : p_ptr->current_floor_ptr->width - 1; ymin = (0 < panel_row_min) ? panel_row_min : 0; - ymax = (current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : current_floor_ptr->height - 1; + ymax = (p_ptr->current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : p_ptr->current_floor_ptr->height - 1; /* Bottom section of screen */ for (y = 1; y <= ymin - panel_row_prt; y++) @@ -2783,7 +2783,7 @@ void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_cha * not any. If there were, they would have to set "shimmer_objects"\n * when they were created, and then new "shimmer" code in "dungeon.c"\n * would have to be created handle the "shimmer" effect, and the code\n - * in "current_floor_ptr->grid_array.c" would have to be updated to create the shimmer effect.\n + * in "p_ptr->current_floor_ptr->grid_array.c" would have to be updated to create the shimmer effect.\n *\n * Note the effects of hallucination. Objects always appear as random\n * "objects", monsters as random "monsters", and normal grids occasionally\n @@ -2872,8 +2872,8 @@ void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_cha */ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLOR *tap, SYMBOL_CODE *tcp) { - /* Get the current_floor_ptr->grid_array */ - grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x]; + /* Get the p_ptr->current_floor_ptr->grid_array */ + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; OBJECT_IDX this_o_idx, next_o_idx = 0; @@ -3122,7 +3122,7 @@ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLO for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - o_ptr = ¤t_floor_ptr->o_list[this_o_idx]; + o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx]; next_o_idx = o_ptr->next_o_idx; /* Memorized objects */ @@ -3167,7 +3167,7 @@ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLO /* Handle monsters */ if (g_ptr->m_idx && display_autopick == 0) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; /* Visible monster */ if (m_ptr->ml) @@ -3420,8 +3420,8 @@ void display_map(int *cy, int *cx) wid -= 14; if (use_bigtile) wid /= 2; - yrat = (current_floor_ptr->height + hgt - 1) / hgt; - xrat = (current_floor_ptr->width + wid - 1) / wid; + yrat = (p_ptr->current_floor_ptr->height + hgt - 1) / hgt; + xrat = (p_ptr->current_floor_ptr->width + wid - 1) / wid; /* Disable lighting effects */ view_special_lite = FALSE; @@ -3459,19 +3459,19 @@ void display_map(int *cy, int *cx) } /* Allocate the maps */ - C_MAKE(bigma, (current_floor_ptr->height + 2), TERM_COLOR *); - C_MAKE(bigmc, (current_floor_ptr->height + 2), char_ptr); - C_MAKE(bigmp, (current_floor_ptr->height + 2), byte_ptr); + C_MAKE(bigma, (p_ptr->current_floor_ptr->height + 2), TERM_COLOR *); + C_MAKE(bigmc, (p_ptr->current_floor_ptr->height + 2), char_ptr); + C_MAKE(bigmp, (p_ptr->current_floor_ptr->height + 2), byte_ptr); /* Allocate and wipe each line map */ - for (y = 0; y < (current_floor_ptr->height + 2); y++) + for (y = 0; y < (p_ptr->current_floor_ptr->height + 2); y++) { /* Allocate one row each array */ - C_MAKE(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR); - C_MAKE(bigmc[y], (current_floor_ptr->width + 2), char); - C_MAKE(bigmp[y], (current_floor_ptr->width + 2), byte); + C_MAKE(bigma[y], (p_ptr->current_floor_ptr->width + 2), TERM_COLOR); + C_MAKE(bigmc[y], (p_ptr->current_floor_ptr->width + 2), char); + C_MAKE(bigmp[y], (p_ptr->current_floor_ptr->width + 2), byte); - for (x = 0; x < current_floor_ptr->width + 2; ++x) + for (x = 0; x < p_ptr->current_floor_ptr->width + 2; ++x) { /* Nothing here */ bigma[y][x] = TERM_WHITE; @@ -3483,9 +3483,9 @@ void display_map(int *cy, int *cx) } /* Fill in the map */ - for (i = 0; i < current_floor_ptr->width; ++i) + for (i = 0; i < p_ptr->current_floor_ptr->width; ++i) { - for (j = 0; j < current_floor_ptr->height; ++j) + for (j = 0; j < p_ptr->current_floor_ptr->height; ++j) { x = i / xrat + 1; y = j / yrat + 1; @@ -3516,9 +3516,9 @@ void display_map(int *cy, int *cx) } } - for (j = 0; j < current_floor_ptr->height; ++j) + for (j = 0; j < p_ptr->current_floor_ptr->height; ++j) { - for (i = 0; i < current_floor_ptr->width; ++i) + for (i = 0; i < p_ptr->current_floor_ptr->width; ++i) { x = i / xrat + 1; y = j / yrat + 1; @@ -3654,18 +3654,18 @@ void display_map(int *cy, int *cx) C_KILL(object_autopick_yx, (hgt + 2), object_type **); /* Free each line map */ - for (y = 0; y < (current_floor_ptr->height + 2); y++) + for (y = 0; y < (p_ptr->current_floor_ptr->height + 2); y++) { /* Free one row each array */ - C_KILL(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR); - C_KILL(bigmc[y], (current_floor_ptr->width + 2), SYMBOL_CODE); - C_KILL(bigmp[y], (current_floor_ptr->width + 2), byte); + C_KILL(bigma[y], (p_ptr->current_floor_ptr->width + 2), TERM_COLOR); + C_KILL(bigmc[y], (p_ptr->current_floor_ptr->width + 2), SYMBOL_CODE); + C_KILL(bigmp[y], (p_ptr->current_floor_ptr->width + 2), byte); } /* Free each line map */ - C_KILL(bigma, (current_floor_ptr->height + 2), TERM_COLOR *); - C_KILL(bigmc, (current_floor_ptr->height + 2), char_ptr); - C_KILL(bigmp, (current_floor_ptr->height + 2), byte_ptr); + C_KILL(bigma, (p_ptr->current_floor_ptr->height + 2), TERM_COLOR *); + C_KILL(bigmc, (p_ptr->current_floor_ptr->height + 2), char_ptr); + C_KILL(bigmp, (p_ptr->current_floor_ptr->height + 2), byte_ptr); } @@ -3802,7 +3802,7 @@ void prt_path(POSITION y, POSITION x) { POSITION ny = GRID_Y(path_g[i]); POSITION nx = GRID_X(path_g[i]); - grid_type *g_ptr = ¤t_floor_ptr->grid_array[ny][nx]; + grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx]; if (panel_contains(ny, nx)) { @@ -3812,7 +3812,7 @@ void prt_path(POSITION y, POSITION x) TERM_COLOR ta = default_color; char tc = '*'; - if (g_ptr->m_idx && current_floor_ptr->m_list[g_ptr->m_idx].ml) + if (g_ptr->m_idx && p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml) { /* Determine what is there */ map_info(ny, nx, &a, &c, &ta, &tc); diff --git a/src/warning.c b/src/warning.c index 4e52fea4c..3d6d51d92 100644 --- a/src/warning.c +++ b/src/warning.c @@ -308,7 +308,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I */ void spell_damcalc_by_spellnum(int spell_num, EFFECT_ID typ, MONSTER_IDX m_idx, int *max) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; HIT_POINT dam = monspell_damage((spell_num), m_idx, DAM_MAX); spell_damcalc(p_ptr, m_ptr, typ, dam, max); } @@ -415,13 +415,13 @@ bool process_warning(POSITION xx, POSITION yy) monster_type *m_ptr; monster_race *r_ptr; - if (!in_bounds(current_floor_ptr, my, mx) || (distance(my, mx, yy, xx) > WARNING_AWARE_RANGE)) continue; + if (!in_bounds(p_ptr->current_floor_ptr, my, mx) || (distance(my, mx, yy, xx) > WARNING_AWARE_RANGE)) continue; - g_ptr = ¤t_floor_ptr->grid_array[my][mx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[my][mx]; if (!g_ptr->m_idx) continue; - m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; + m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; if (MON_CSLEEP(m_ptr)) continue; if (!is_hostile(m_ptr)) continue; @@ -515,7 +515,7 @@ bool process_warning(POSITION xx, POSITION yy) } else old_damage = old_damage / 2; - g_ptr = ¤t_floor_ptr->grid_array[yy][xx]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[yy][xx]; if (((!easy_disarm && is_trap(g_ptr->feat)) || (g_ptr->mimic && is_trap(g_ptr->feat))) && !one_in_(13)) { diff --git a/src/wild.c b/src/wild.c index 1ec7bcc4f..f05990333 100644 --- a/src/wild.c +++ b/src/wild.c @@ -121,7 +121,7 @@ static void perturb_point_mid(FEAT_IDX x1, FEAT_IDX x2, FEAT_IDX x3, FEAT_IDX x4 if (avg > depth_max) avg = depth_max; /* Set the new value. */ - current_floor_ptr->grid_array[ymid][xmid].feat = (FEAT_IDX)avg; + p_ptr->current_floor_ptr->grid_array[ymid][xmid].feat = (FEAT_IDX)avg; } @@ -156,7 +156,7 @@ static void perturb_point_end(FEAT_IDX x1, FEAT_IDX x2, FEAT_IDX x3, POSITION xm if (avg > depth_max) avg = depth_max; /* Set the new value. */ - current_floor_ptr->grid_array[ymid][xmid].feat = (FEAT_IDX)avg; + p_ptr->current_floor_ptr->grid_array[ymid][xmid].feat = (FEAT_IDX)avg; } @@ -188,19 +188,19 @@ static void plasma_recursive(POSITION x1, POSITION y1, POSITION x2, POSITION y2, /* Are we done? */ if (x1 + 1 == x2) return; - perturb_point_mid(current_floor_ptr->grid_array[y1][x1].feat, current_floor_ptr->grid_array[y2][x1].feat, current_floor_ptr->grid_array[y1][x2].feat, - current_floor_ptr->grid_array[y2][x2].feat, xmid, ymid, rough, depth_max); + perturb_point_mid(p_ptr->current_floor_ptr->grid_array[y1][x1].feat, p_ptr->current_floor_ptr->grid_array[y2][x1].feat, p_ptr->current_floor_ptr->grid_array[y1][x2].feat, + p_ptr->current_floor_ptr->grid_array[y2][x2].feat, xmid, ymid, rough, depth_max); - perturb_point_end(current_floor_ptr->grid_array[y1][x1].feat, current_floor_ptr->grid_array[y1][x2].feat, current_floor_ptr->grid_array[ymid][xmid].feat, + perturb_point_end(p_ptr->current_floor_ptr->grid_array[y1][x1].feat, p_ptr->current_floor_ptr->grid_array[y1][x2].feat, p_ptr->current_floor_ptr->grid_array[ymid][xmid].feat, xmid, y1, rough, depth_max); - perturb_point_end(current_floor_ptr->grid_array[y1][x2].feat, current_floor_ptr->grid_array[y2][x2].feat, current_floor_ptr->grid_array[ymid][xmid].feat, + perturb_point_end(p_ptr->current_floor_ptr->grid_array[y1][x2].feat, p_ptr->current_floor_ptr->grid_array[y2][x2].feat, p_ptr->current_floor_ptr->grid_array[ymid][xmid].feat, x2, ymid, rough, depth_max); - perturb_point_end(current_floor_ptr->grid_array[y2][x2].feat, current_floor_ptr->grid_array[y2][x1].feat, current_floor_ptr->grid_array[ymid][xmid].feat, + perturb_point_end(p_ptr->current_floor_ptr->grid_array[y2][x2].feat, p_ptr->current_floor_ptr->grid_array[y2][x1].feat, p_ptr->current_floor_ptr->grid_array[ymid][xmid].feat, xmid, y2, rough, depth_max); - perturb_point_end(current_floor_ptr->grid_array[y2][x1].feat, current_floor_ptr->grid_array[y1][x1].feat, current_floor_ptr->grid_array[ymid][xmid].feat, + perturb_point_end(p_ptr->current_floor_ptr->grid_array[y2][x1].feat, p_ptr->current_floor_ptr->grid_array[y1][x1].feat, p_ptr->current_floor_ptr->grid_array[ymid][xmid].feat, x1, ymid, rough, depth_max); @@ -245,7 +245,7 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c { for (x1 = 0; x1 < MAX_WID; x1++) { - current_floor_ptr->grid_array[y1][x1].feat = feat_permanent; + p_ptr->current_floor_ptr->grid_array[y1][x1].feat = feat_permanent; } } @@ -267,7 +267,7 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c { for (x1 = 0; x1 < MAX_WID; x1++) { - current_floor_ptr->grid_array[y1][x1].feat = table_size / 2; + p_ptr->current_floor_ptr->grid_array[y1][x1].feat = table_size / 2; } } } @@ -277,42 +277,42 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c * ToDo: calculate the medium height of the adjacent * terrains for every corner. */ - current_floor_ptr->grid_array[1][1].feat = (s16b)randint0(table_size); - current_floor_ptr->grid_array[MAX_HGT-2][1].feat = (s16b)randint0(table_size); - current_floor_ptr->grid_array[1][MAX_WID-2].feat = (s16b)randint0(table_size); - current_floor_ptr->grid_array[MAX_HGT-2][MAX_WID-2].feat = (s16b)randint0(table_size); + p_ptr->current_floor_ptr->grid_array[1][1].feat = (s16b)randint0(table_size); + p_ptr->current_floor_ptr->grid_array[MAX_HGT-2][1].feat = (s16b)randint0(table_size); + p_ptr->current_floor_ptr->grid_array[1][MAX_WID-2].feat = (s16b)randint0(table_size); + p_ptr->current_floor_ptr->grid_array[MAX_HGT-2][MAX_WID-2].feat = (s16b)randint0(table_size); if (!corner) { /* Hack -- preserve four corners */ - s16b north_west = current_floor_ptr->grid_array[1][1].feat; - s16b south_west = current_floor_ptr->grid_array[MAX_HGT - 2][1].feat; - s16b north_east = current_floor_ptr->grid_array[1][MAX_WID - 2].feat; - s16b south_east = current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat; + s16b north_west = p_ptr->current_floor_ptr->grid_array[1][1].feat; + s16b south_west = p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][1].feat; + s16b north_east = p_ptr->current_floor_ptr->grid_array[1][MAX_WID - 2].feat; + s16b south_east = p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat; /* x1, y1, x2, y2, num_depths, roughness */ plasma_recursive(1, 1, MAX_WID-2, MAX_HGT-2, table_size-1, roughness); /* Hack -- copyback four corners */ - current_floor_ptr->grid_array[1][1].feat = north_west; - current_floor_ptr->grid_array[MAX_HGT - 2][1].feat = south_west; - current_floor_ptr->grid_array[1][MAX_WID - 2].feat = north_east; - current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = south_east; + p_ptr->current_floor_ptr->grid_array[1][1].feat = north_west; + p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][1].feat = south_west; + p_ptr->current_floor_ptr->grid_array[1][MAX_WID - 2].feat = north_east; + p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = south_east; for (y1 = 1; y1 < MAX_HGT - 1; y1++) { for (x1 = 1; x1 < MAX_WID - 1; x1++) { - current_floor_ptr->grid_array[y1][x1].feat = terrain_table[terrain][current_floor_ptr->grid_array[y1][x1].feat]; + p_ptr->current_floor_ptr->grid_array[y1][x1].feat = terrain_table[terrain][p_ptr->current_floor_ptr->grid_array[y1][x1].feat]; } } } else /* Hack -- only four corners */ { - current_floor_ptr->grid_array[1][1].feat = terrain_table[terrain][current_floor_ptr->grid_array[1][1].feat]; - current_floor_ptr->grid_array[MAX_HGT - 2][1].feat = terrain_table[terrain][current_floor_ptr->grid_array[MAX_HGT - 2][1].feat]; - current_floor_ptr->grid_array[1][MAX_WID - 2].feat = terrain_table[terrain][current_floor_ptr->grid_array[1][MAX_WID - 2].feat]; - current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = terrain_table[terrain][current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat]; + p_ptr->current_floor_ptr->grid_array[1][1].feat = terrain_table[terrain][p_ptr->current_floor_ptr->grid_array[1][1].feat]; + p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][1].feat = terrain_table[terrain][p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][1].feat]; + p_ptr->current_floor_ptr->grid_array[1][MAX_WID - 2].feat = terrain_table[terrain][p_ptr->current_floor_ptr->grid_array[1][MAX_WID - 2].feat]; + p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = terrain_table[terrain][p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat]; } /* Hack -- Restore the RNG state */ @@ -347,16 +347,16 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) p_ptr->town_num = wilderness[y][x].town; /* Set the base level */ - current_floor_ptr->base_level = wilderness[y][x].level; + p_ptr->current_floor_ptr->base_level = wilderness[y][x].level; /* Set the dungeon level */ - current_floor_ptr->dun_level = 0; + p_ptr->current_floor_ptr->dun_level = 0; /* Set the monster generation level */ - current_floor_ptr->monster_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level; /* Set the object generation level */ - current_floor_ptr->object_level = current_floor_ptr->base_level; + p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level; /* Create the town */ @@ -391,7 +391,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) */ if (wilderness[y][x].road) { - current_floor_ptr->grid_array[MAX_HGT/2][MAX_WID/2].feat = feat_floor; + p_ptr->current_floor_ptr->grid_array[MAX_HGT/2][MAX_WID/2].feat = feat_floor; if (wilderness[y-1][x].road) { @@ -399,7 +399,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) for (y1 = 1; y1 < MAX_HGT/2; y1++) { x1 = MAX_WID/2; - current_floor_ptr->grid_array[y1][x1].feat = feat_floor; + p_ptr->current_floor_ptr->grid_array[y1][x1].feat = feat_floor; } } @@ -409,7 +409,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) for (y1 = MAX_HGT/2; y1 < MAX_HGT - 1; y1++) { x1 = MAX_WID/2; - current_floor_ptr->grid_array[y1][x1].feat = feat_floor; + p_ptr->current_floor_ptr->grid_array[y1][x1].feat = feat_floor; } } @@ -419,7 +419,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) for (x1 = MAX_WID/2; x1 < MAX_WID - 1; x1++) { y1 = MAX_HGT/2; - current_floor_ptr->grid_array[y1][x1].feat = feat_floor; + p_ptr->current_floor_ptr->grid_array[y1][x1].feat = feat_floor; } } @@ -429,7 +429,7 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) for (x1 = 1; x1 < MAX_WID/2; x1++) { y1 = MAX_HGT/2; - current_floor_ptr->grid_array[y1][x1].feat = feat_floor; + p_ptr->current_floor_ptr->grid_array[y1][x1].feat = feat_floor; } } } @@ -446,11 +446,11 @@ static void generate_area(POSITION y, POSITION x, bool border, bool corner) /* Hack -- Induce consistant flavors */ Rand_state_set(wilderness[y][x].seed); - dy = rand_range(6, current_floor_ptr->height - 6); - dx = rand_range(6, current_floor_ptr->width - 6); + dy = rand_range(6, p_ptr->current_floor_ptr->height - 6); + dx = rand_range(6, p_ptr->current_floor_ptr->width - 6); - current_floor_ptr->grid_array[dy][dx].feat = feat_entrance; - current_floor_ptr->grid_array[dy][dx].special = wilderness[y][x].entrance; + p_ptr->current_floor_ptr->grid_array[dy][dx].feat = feat_entrance; + p_ptr->current_floor_ptr->grid_array[dy][dx].special = wilderness[y][x].entrance; /* Hack -- Restore the RNG state */ Rand_state_restore(state_backup); @@ -477,12 +477,12 @@ void wilderness_gen(void) feature_type *f_ptr; /* Big town */ - current_floor_ptr->height = MAX_HGT; - current_floor_ptr->width = MAX_WID; + p_ptr->current_floor_ptr->height = MAX_HGT; + p_ptr->current_floor_ptr->width = MAX_WID; /* Assume illegal panel */ - panel_row_min = current_floor_ptr->height; - panel_col_min = current_floor_ptr->width; + panel_row_min = p_ptr->current_floor_ptr->height; + panel_col_min = p_ptr->current_floor_ptr->width; process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x); x = p_ptr->wilderness_x; @@ -494,7 +494,7 @@ void wilderness_gen(void) for (i = 1; i < MAX_WID - 1; i++) { - border.north[i] = current_floor_ptr->grid_array[MAX_HGT - 2][i].feat; + border.north[i] = p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][i].feat; } /* South border */ @@ -502,7 +502,7 @@ void wilderness_gen(void) for (i = 1; i < MAX_WID - 1; i++) { - border.south[i] = current_floor_ptr->grid_array[1][i].feat; + border.south[i] = p_ptr->current_floor_ptr->grid_array[1][i].feat; } /* West border */ @@ -510,7 +510,7 @@ void wilderness_gen(void) for (i = 1; i < MAX_HGT - 1; i++) { - border.west[i] = current_floor_ptr->grid_array[i][MAX_WID - 2].feat; + border.west[i] = p_ptr->current_floor_ptr->grid_array[i][MAX_WID - 2].feat; } /* East border */ @@ -518,24 +518,24 @@ void wilderness_gen(void) for (i = 1; i < MAX_HGT - 1; i++) { - border.east[i] = current_floor_ptr->grid_array[i][1].feat; + border.east[i] = p_ptr->current_floor_ptr->grid_array[i][1].feat; } /* North west corner */ generate_area(y - 1, x - 1, FALSE, TRUE); - border.north_west = current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat; + border.north_west = p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat; /* North east corner */ generate_area(y - 1, x + 1, FALSE, TRUE); - border.north_east = current_floor_ptr->grid_array[MAX_HGT - 2][1].feat; + border.north_east = p_ptr->current_floor_ptr->grid_array[MAX_HGT - 2][1].feat; /* South west corner */ generate_area(y + 1, x - 1, FALSE, TRUE); - border.south_west = current_floor_ptr->grid_array[1][MAX_WID - 2].feat; + border.south_west = p_ptr->current_floor_ptr->grid_array[1][MAX_WID - 2].feat; /* South east corner */ generate_area(y + 1, x + 1, FALSE, TRUE); - border.south_east = current_floor_ptr->grid_array[1][1].feat; + border.south_east = p_ptr->current_floor_ptr->grid_array[1][1].feat; /* Create terrain of the current area */ @@ -545,49 +545,49 @@ void wilderness_gen(void) /* Special boundary walls -- North */ for (i = 0; i < MAX_WID; i++) { - current_floor_ptr->grid_array[0][i].feat = feat_permanent; - current_floor_ptr->grid_array[0][i].mimic = border.north[i]; + p_ptr->current_floor_ptr->grid_array[0][i].feat = feat_permanent; + p_ptr->current_floor_ptr->grid_array[0][i].mimic = border.north[i]; } /* Special boundary walls -- South */ for (i = 0; i < MAX_WID; i++) { - current_floor_ptr->grid_array[MAX_HGT - 1][i].feat = feat_permanent; - current_floor_ptr->grid_array[MAX_HGT - 1][i].mimic = border.south[i]; + p_ptr->current_floor_ptr->grid_array[MAX_HGT - 1][i].feat = feat_permanent; + p_ptr->current_floor_ptr->grid_array[MAX_HGT - 1][i].mimic = border.south[i]; } /* Special boundary walls -- West */ for (i = 0; i < MAX_HGT; i++) { - current_floor_ptr->grid_array[i][0].feat = feat_permanent; - current_floor_ptr->grid_array[i][0].mimic = border.west[i]; + p_ptr->current_floor_ptr->grid_array[i][0].feat = feat_permanent; + p_ptr->current_floor_ptr->grid_array[i][0].mimic = border.west[i]; } /* Special boundary walls -- East */ for (i = 0; i < MAX_HGT; i++) { - current_floor_ptr->grid_array[i][MAX_WID - 1].feat = feat_permanent; - current_floor_ptr->grid_array[i][MAX_WID - 1].mimic = border.east[i]; + p_ptr->current_floor_ptr->grid_array[i][MAX_WID - 1].feat = feat_permanent; + p_ptr->current_floor_ptr->grid_array[i][MAX_WID - 1].mimic = border.east[i]; } /* North west corner */ - current_floor_ptr->grid_array[0][0].mimic = border.north_west; + p_ptr->current_floor_ptr->grid_array[0][0].mimic = border.north_west; /* North east corner */ - current_floor_ptr->grid_array[0][MAX_WID - 1].mimic = border.north_east; + p_ptr->current_floor_ptr->grid_array[0][MAX_WID - 1].mimic = border.north_east; /* South west corner */ - current_floor_ptr->grid_array[MAX_HGT - 1][0].mimic = border.south_west; + p_ptr->current_floor_ptr->grid_array[MAX_HGT - 1][0].mimic = border.south_west; /* South east corner */ - current_floor_ptr->grid_array[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east; + p_ptr->current_floor_ptr->grid_array[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east; /* Light up or darken the area */ - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (is_daytime()) { @@ -629,11 +629,11 @@ void wilderness_gen(void) if (p_ptr->teleport_town) { - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Seeing true feature code (ignore mimic) */ f_ptr = &f_info[g_ptr->feat]; @@ -654,11 +654,11 @@ void wilderness_gen(void) else if (p_ptr->leaving_dungeon) { - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; if (cave_have_flag_grid(g_ptr, FF_ENTRANCE)) { @@ -718,7 +718,7 @@ void wilderness_gen_small(void) for (i = 0; i < MAX_WID; i++) for (j = 0; j < MAX_HGT; j++) { - current_floor_ptr->grid_array[j][i].feat = feat_permanent; + p_ptr->current_floor_ptr->grid_array[j][i].feat = feat_permanent; } process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x); @@ -729,29 +729,29 @@ void wilderness_gen_small(void) { if (wilderness[j][i].town && (wilderness[j][i].town != NO_TOWN)) { - current_floor_ptr->grid_array[j][i].feat = (s16b)feat_town; - current_floor_ptr->grid_array[j][i].special = (s16b)wilderness[j][i].town; + p_ptr->current_floor_ptr->grid_array[j][i].feat = (s16b)feat_town; + p_ptr->current_floor_ptr->grid_array[j][i].special = (s16b)wilderness[j][i].town; } - else if (wilderness[j][i].road) current_floor_ptr->grid_array[j][i].feat = feat_floor; + else if (wilderness[j][i].road) p_ptr->current_floor_ptr->grid_array[j][i].feat = feat_floor; else if (wilderness[j][i].entrance && (p_ptr->total_winner || !(d_info[wilderness[j][i].entrance].flags1 & DF1_WINNER))) { - current_floor_ptr->grid_array[j][i].feat = feat_entrance; - current_floor_ptr->grid_array[j][i].special = (byte)wilderness[j][i].entrance; + p_ptr->current_floor_ptr->grid_array[j][i].feat = feat_entrance; + p_ptr->current_floor_ptr->grid_array[j][i].special = (byte)wilderness[j][i].entrance; } - else current_floor_ptr->grid_array[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain]; + else p_ptr->current_floor_ptr->grid_array[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain]; - current_floor_ptr->grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK); + p_ptr->current_floor_ptr->grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK); } - current_floor_ptr->height = (s16b) current_world_ptr->max_wild_y; - current_floor_ptr->width = (s16b) current_world_ptr->max_wild_x; + p_ptr->current_floor_ptr->height = (s16b) current_world_ptr->max_wild_y; + p_ptr->current_floor_ptr->width = (s16b) current_world_ptr->max_wild_x; - if (current_floor_ptr->height > MAX_HGT) current_floor_ptr->height = MAX_HGT; - if (current_floor_ptr->width > MAX_WID) current_floor_ptr->width = MAX_WID; + if (p_ptr->current_floor_ptr->height > MAX_HGT) p_ptr->current_floor_ptr->height = MAX_HGT; + if (p_ptr->current_floor_ptr->width > MAX_WID) p_ptr->current_floor_ptr->width = MAX_WID; /* Assume illegal panel */ - panel_row_min = current_floor_ptr->height; - panel_col_min = current_floor_ptr->width; + panel_row_min = p_ptr->current_floor_ptr->height; + panel_col_min = p_ptr->current_floor_ptr->width; p_ptr->x = p_ptr->wilderness_x; p_ptr->y = p_ptr->wilderness_y; @@ -1144,9 +1144,9 @@ bool change_wild_mode(bool encount) return TRUE; } - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; if (is_pet(m_ptr) && i != p_ptr->riding) have_pet = TRUE; diff --git a/src/wizard2.c b/src/wizard2.c index a5c1b97e3..2f75bee90 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -820,42 +820,42 @@ static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr) case 'w': case 'W': { object_prep(q_ptr, o_ptr->k_idx); - apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT | AM_CURSED); + apply_magic(q_ptr, p_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT | AM_CURSED); break; } /* Apply bad magic, but first clear object */ case 'c': case 'C': { object_prep(q_ptr, o_ptr->k_idx); - apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_CURSED); + apply_magic(q_ptr, p_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_CURSED); break; } /* Apply normal magic, but first clear object */ case 'n': case 'N': { object_prep(q_ptr, o_ptr->k_idx); - apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART); + apply_magic(q_ptr, p_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART); break; } /* Apply good magic, but first clear object */ case 'g': case 'G': { object_prep(q_ptr, o_ptr->k_idx); - apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD); + apply_magic(q_ptr, p_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD); break; } /* Apply great magic, but first clear object */ case 'e': case 'E': { object_prep(q_ptr, o_ptr->k_idx); - apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT); + apply_magic(q_ptr, p_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT); break; } /* Apply special magic, but first clear object */ case 's': case 'S': { object_prep(q_ptr, o_ptr->k_idx); - apply_magic(q_ptr, current_floor_ptr->dun_level, AM_GOOD | AM_GREAT | AM_SPECIAL); + apply_magic(q_ptr, p_ptr->current_floor_ptr->dun_level, AM_GOOD | AM_GREAT | AM_SPECIAL); /* Failed to create artifact; make a random one */ if (!object_is_artifact(q_ptr)) become_random_artifact(q_ptr, FALSE); @@ -952,7 +952,7 @@ static void wiz_statistics(object_type *o_ptr) /* Let us know what we are doing */ msg_format("Creating a lot of %s items. Base level = %d.", - quality, current_floor_ptr->dun_level); + quality, p_ptr->current_floor_ptr->dun_level); msg_print(NULL); /* Set counters to zero */ @@ -1274,7 +1274,7 @@ static void wiz_create_item(void) q_ptr = &forge; object_prep(q_ptr, k_idx); - apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART); + apply_magic(q_ptr, p_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART); /* Drop the object from heaven */ (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x); @@ -1328,7 +1328,7 @@ static void do_cmd_wiz_jump(player_type *creature_ptr) (int)d_info[tmp_dungeon_type].mindepth, (int)d_info[tmp_dungeon_type].maxdepth); /* Default */ - sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level); + sprintf(tmp_val, "%d", (int)p_ptr->current_floor_ptr->dun_level); /* Ask for a level */ if (!get_string(ppp, tmp_val, 10)) return; @@ -1347,11 +1347,11 @@ static void do_cmd_wiz_jump(player_type *creature_ptr) if (autosave_l) do_cmd_save_game(TRUE); /* Change level */ - current_floor_ptr->dun_level = command_arg; + p_ptr->current_floor_ptr->dun_level = command_arg; prepare_change_floor_mode(CFM_RAND_PLACE); - if (!current_floor_ptr->dun_level) creature_ptr->dungeon_idx = 0; + if (!p_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = 0; creature_ptr->inside_arena = FALSE; creature_ptr->wild_mode = FALSE; @@ -1413,7 +1413,7 @@ static void do_cmd_wiz_summon(int num) int i; for (i = 0; i < num; i++) { - (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE)); + (void)summon_specific(0, p_ptr->y, p_ptr->x, p_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE)); } } @@ -1458,9 +1458,9 @@ static void do_cmd_wiz_zap(void) MONSTER_IDX i; /* Genocide everyone nearby */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; /* Skip the mount */ @@ -1493,9 +1493,9 @@ static void do_cmd_wiz_zap_all(void) MONSTER_IDX i; /* Genocide everyone */ - for (i = 1; i < current_floor_ptr->m_max; i++) + for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++) { - monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; + monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; /* Skip the mount */ @@ -1532,7 +1532,7 @@ static void do_cmd_wiz_create_feature(player_type *creature_ptr) if (!tgt_pt(&x, &y)) return; - g_ptr = ¤t_floor_ptr->grid_array[y][x]; + g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x]; /* Default */ sprintf(tmp_val, "%d", prev_feat); @@ -1874,11 +1874,11 @@ void do_cmd_debug(player_type *creature_ptr) /* Make every dungeon square "known" to test streamers -KMW- */ case 'u': - for (y = 0; y < current_floor_ptr->height; y++) + for (y = 0; y < p_ptr->current_floor_ptr->height; y++) { - for (x = 0; x < current_floor_ptr->width; x++) + for (x = 0; x < p_ptr->current_floor_ptr->width; x++) { - current_floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK); + p_ptr->current_floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK); } } wiz_lite(creature_ptr, FALSE); diff --git a/src/world.h b/src/world.h index c3c93ba2e..e52daf14a 100644 --- a/src/world.h +++ b/src/world.h @@ -57,6 +57,8 @@ typedef struct { bool wizard; /* This world under wizard mode */ + OBJECT_IDX max_o_idx; /*!< Maximum number of objects in the level */ + MONSTER_IDX max_m_idx; /*!< Maximum number of monsters in the level */ } world_type; -- 2.11.0