From 27de05a592329171386f6159eab8e53b1f0d73f4 Mon Sep 17 00:00:00 2001 From: Deskull Date: Thu, 6 Aug 2015 08:37:39 +0900 Subject: [PATCH] =?utf8?q?px,=20py=E3=82=B0=E3=83=AD=E3=83=BC=E3=83=90?= =?utf8?q?=E3=83=AB=E5=A4=89=E6=95=B0=E3=82=92player=5Ftype=E6=A7=8B?= =?utf8?q?=E9=80=A0=E4=BD=93=E3=81=AB=E7=B7=A8=E5=85=A5=E3=80=82=20'px'=20?= =?utf8?q?and=20'py'=20global=20variables=20moved=20to=20structure=20'play?= =?utf8?q?er=5Ftype'.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/artifact.c | 46 +++++------ src/autopick.c | 2 +- src/bldg.c | 14 ++-- src/cave.c | 186 ++++++++++++++++++++++---------------------- src/cmd1.c | 82 ++++++++++---------- src/cmd2.c | 106 ++++++++++++------------- src/cmd5.c | 36 ++++----- src/cmd6.c | 42 +++++----- src/defines.h | 6 +- src/do-spell.c | 240 ++++++++++++++++++++++++++++----------------------------- src/dungeon.c | 74 +++++++++--------- src/effects.c | 4 +- src/externs.h | 2 - src/floors.c | 48 ++++++------ src/generate.c | 10 +-- src/grid.c | 4 +- src/init1.c | 6 +- src/load.c | 12 +-- src/main-win.c | 2 +- src/mane.c | 10 +-- src/melee1.c | 4 +- src/melee2.c | 54 ++++++------- src/mind.c | 46 +++++------ src/monster2.c | 12 +-- src/mspells1.c | 14 ++-- src/mspells2.c | 14 ++-- src/mspells3.c | 44 +++++------ src/mutation.c | 24 +++--- src/object1.c | 18 ++--- src/object2.c | 4 +- src/racial.c | 30 ++++---- src/save.c | 4 +- src/spells1.c | 44 +++++------ src/spells2.c | 128 +++++++++++++++--------------- src/spells3.c | 96 +++++++++++------------ src/store.c | 2 +- src/types.h | 4 + src/util.c | 4 +- src/variable.c | 5 -- src/wild.c | 12 +-- src/wizard2.c | 22 +++--- src/xtra1.c | 2 +- src/xtra2.c | 76 +++++++++--------- 43 files changed, 796 insertions(+), 799 deletions(-) diff --git a/src/artifact.c b/src/artifact.c index b7fa0987c..8b63e65ef 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -2379,8 +2379,8 @@ bool activate_random_artifact(object_type *o_ptr) for (dir = 0; dir <= 9; dir++) { - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; /* Get the monster */ @@ -2510,7 +2510,7 @@ bool activate_random_artifact(object_type *o_ptr) while (attempts--) { - scatter(&y, &x, py, px, 4, 0); + scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0); if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue; @@ -2587,7 +2587,7 @@ bool activate_random_artifact(object_type *o_ptr) case ACT_QUAKE: { - earthquake(py, px, 5); + earthquake(p_ptr->y, p_ptr->x, 5); break; } @@ -2688,14 +2688,14 @@ bool activate_random_artifact(object_type *o_ptr) case ACT_SUMMON_ANIMAL: { - (void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET)); + (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET)); break; } case ACT_SUMMON_PHANTOM: { msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant.")); - (void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET)); + (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET)); break; } @@ -2708,7 +2708,7 @@ bool activate_random_artifact(object_type *o_ptr) if (pet) mode |= PM_FORCE_PET; else mode |= PM_NO_PET; - if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode)) { msg_print(_("エレメンタルが現れた...", "An elemental materializes...")); if (pet) @@ -2729,7 +2729,7 @@ bool activate_random_artifact(object_type *o_ptr) if (pet) mode |= PM_FORCE_PET; else mode |= PM_NO_PET; - if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_DEMON, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_DEMON, mode)) { msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone.")); if (pet) @@ -2753,7 +2753,7 @@ bool activate_random_artifact(object_type *o_ptr) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), type, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode)) { msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...", "Cold winds begin to blow around you, carrying with them the stench of decay...")); @@ -2775,7 +2775,7 @@ bool activate_random_artifact(object_type *o_ptr) if (pet) mode |= PM_FORCE_PET; else mode |= PM_NO_PET; - if (summon_specific((pet ? -1 : 0), py, px, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode)) { if (pet) @@ -2792,7 +2792,7 @@ bool activate_random_artifact(object_type *o_ptr) case ACT_SUMMON_DAWN: { msg_print(_("暁の師団を召喚した。","You summon the Legion of the Dawn.")); - (void)summon_specific(-1, py, px, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET)); + (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET)); break; } @@ -2802,7 +2802,7 @@ bool activate_random_artifact(object_type *o_ptr) bool pet = !one_in_(5); if (pet) mode |= PM_FORCE_PET; - if (summon_named_creature(0, py, px, MON_JIZOTAKO, mode)) + if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_JIZOTAKO, mode)) { if (pet) msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant.")); @@ -3399,7 +3399,7 @@ bool activate_random_artifact(object_type *o_ptr) object_copy(&forge, o_ptr); inven_item_increase(inv, (0 - o_ptr->number)); inven_item_optimize(inv); - o_idx = drop_near(&forge, 0, py, px); + o_idx = drop_near(&forge, 0, p_ptr->y, p_ptr->x); o_ptr = &o_list[o_idx]; object_desc(o_name, o_ptr, OD_NAME_ONLY); @@ -3429,14 +3429,14 @@ bool activate_random_artifact(object_type *o_ptr) { msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade...")); msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'")); - massacre(py, px); + massacre(p_ptr->y, p_ptr->x); break; } case ACT_GRAND_CROSS: { msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'")); - project(0, 8, py, px, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1); + project(0, 8, p_ptr->y, p_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1); break; } @@ -3462,8 +3462,8 @@ bool activate_random_artifact(object_type *o_ptr) int x, y; if (!get_rep_dir2(&dir)) return FALSE; - y = py+ddy[dir]; - x = px+ddx[dir]; + y = p_ptr->y+ddy[dir]; + x = p_ptr->x+ddx[dir]; tsuri_dir = dir; if (!cave_have_flag_bold(y, x, FF_WATER)) { @@ -3489,13 +3489,13 @@ bool activate_random_artifact(object_type *o_ptr) monster_type *m_ptr; cptr kakusan = ""; - if (summon_named_creature(0, py, px, MON_SUKE, PM_FORCE_PET)) + if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_SUKE, PM_FORCE_PET)) { msg_print(_("『助さん』が現れた。", "Suke-san apperars.")); kakusan = "Suke-san"; count++; } - if (summon_named_creature(0, py, px, MON_KAKU, PM_FORCE_PET)) + if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_KAKU, PM_FORCE_PET)) { msg_print(_("『格さん』が現れた。", "Kaku-san appears.")); kakusan = "Kaku-san"; @@ -3508,8 +3508,8 @@ bool activate_random_artifact(object_type *o_ptr) m_ptr = &m_list[i]; if (!m_ptr->r_idx) continue; if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue; - if (!los(m_ptr->fy, m_ptr->fx, py, px)) continue; - if (!projectable(m_ptr->fy, m_ptr->fx, py, px)) continue; + if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue; + if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue; count++; break; } @@ -3576,8 +3576,8 @@ bool activate_random_artifact(object_type *o_ptr) if (!get_aim_dir(&dir)) return FALSE; /* Use the given direction */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) diff --git a/src/autopick.c b/src/autopick.c index da5a34c89..69e89b799 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -1659,7 +1659,7 @@ void autopick_delayed_alter(void) autopick_delayed_alter_aux(item); /* Scan the pile of objects */ - item = cave[py][px].o_idx; + item = cave[p_ptr->y][p_ptr->x].o_idx; while (item) { int next = o_list[item].next_o_idx; diff --git a/src/bldg.c b/src/bldg.c index 2d844c08c..6c3712dc3 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -2263,7 +2263,7 @@ static void castle_quest(void) clear_bldg(4, 18); /* Current quest of the building */ - q_index = cave[py][px].special; + q_index = cave[p_ptr->y][p_ptr->x].special; /* Is there a quest available at the building? */ if (!q_index) @@ -4588,7 +4588,7 @@ void do_cmd_quest(void) { p_ptr->energy_use = 100; - if (!cave_have_flag_bold(py, px, FF_QUEST_ENTER)) + if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_QUEST_ENTER)) { msg_print(_("ここにはクエストの入口はない。", "You see no quest level here.")); return; @@ -4607,7 +4607,7 @@ void do_cmd_quest(void) leave_quest_check(); if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1; - p_ptr->inside_quest = cave[py][px].special; + p_ptr->inside_quest = cave[p_ptr->y][p_ptr->x].special; p_ptr->leaving = TRUE; } @@ -4628,13 +4628,13 @@ void do_cmd_bldg(void) p_ptr->energy_use = 100; - if (!cave_have_flag_bold(py, px, FF_BLDG)) + if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_BLDG)) { msg_print(_("ここには建物はない。", "You see no building here.")); return; } - which = f_info[cave[py][px].feat].subtype; + which = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype; bldg = &building[which]; @@ -4687,8 +4687,8 @@ void do_cmd_bldg(void) } else { - p_ptr->oldpy = py; - p_ptr->oldpx = px; + p_ptr->oldpy = p_ptr->y; + p_ptr->oldpx = p_ptr->x; } /* Forget the lite */ diff --git a/src/cave.c b/src/cave.c index e0616490d..7f426a8ef 100644 --- a/src/cave.c +++ b/src/cave.c @@ -389,8 +389,8 @@ bool los(int y1, int x1, int y2, int x2) static bool check_local_illumination(int y, int x) { /* Hack -- move towards player */ - int yy = (y < py) ? (y + 1) : (y > py) ? (y - 1) : y; - int xx = (x < px) ? (x + 1) : (x > px) ? (x - 1) : x; + int yy = (y < p_ptr->y) ? (y + 1) : (y > p_ptr->y) ? (y - 1) : y; + int xx = (x < p_ptr->x) ? (x + 1) : (x > p_ptr->x) ? (x - 1) : x; /* Check for "local" illumination */ @@ -445,17 +445,17 @@ void update_local_illumination(int y, int x) #ifdef COMPLEX_WALL_ILLUMINATION /* COMPLEX_WALL_ILLUMINATION */ - if ((y != py) && (x != px)) + if ((y != p_ptr->y) && (x != p_ptr->x)) { - yy = (y < py) ? (y - 1) : (y + 1); - xx = (x < px) ? (x - 1) : (x + 1); + yy = (y < p_ptr->y) ? (y - 1) : (y + 1); + xx = (x < p_ptr->x) ? (x - 1) : (x + 1); update_local_illumination_aux(yy, xx); update_local_illumination_aux(y, xx); update_local_illumination_aux(yy, x); } - else if (x != px) /* y == py */ + else if (x != p_ptr->x) /* y == p_ptr->y */ { - xx = (x < px) ? (x - 1) : (x + 1); + xx = (x < p_ptr->x) ? (x - 1) : (x + 1); for (i = -1; i <= 1; i++) { yy = y + i; @@ -466,9 +466,9 @@ void update_local_illumination(int y, int x) yy = y + 1; update_local_illumination_aux(yy, x); } - else if (y != py) /* x == px */ + else if (y != p_ptr->y) /* x == p_ptr->x */ { - yy = (y < py) ? (y - 1) : (y + 1); + yy = (y < p_ptr->y) ? (y - 1) : (y + 1); for (i = -1; i <= 1; i++) { xx = x + i; @@ -491,24 +491,24 @@ void update_local_illumination(int y, int x) #else /* COMPLEX_WALL_ILLUMINATION */ - if ((y != py) && (x != px)) + if ((y != p_ptr->y) && (x != p_ptr->x)) { - yy = (y < py) ? (y - 1) : (y + 1); - xx = (x < px) ? (x - 1) : (x + 1); + yy = (y < p_ptr->y) ? (y - 1) : (y + 1); + xx = (x < p_ptr->x) ? (x - 1) : (x + 1); update_local_illumination_aux(yy, xx); } - else if (x != px) /* y == py */ + else if (x != p_ptr->x) /* y == p_ptr->y */ { - xx = (x < px) ? (x - 1) : (x + 1); + xx = (x < p_ptr->x) ? (x - 1) : (x + 1); for (i = -1; i <= 1; i++) { yy = y + i; update_local_illumination_aux(yy, xx); } } - else if (y != py) /* x == px */ + else if (y != p_ptr->y) /* x == p_ptr->x */ { - yy = (y < py) ? (y - 1) : (y + 1); + yy = (y < p_ptr->y) ? (y - 1) : (y + 1); for (i = -1; i <= 1; i++) { xx = x + i; @@ -601,7 +601,7 @@ bool player_can_see_bold(int y, int x) */ bool no_lite(void) { - return (!player_can_see_bold(py, px)); + return (!player_can_see_bold(p_ptr->y, p_ptr->x)); } @@ -1572,9 +1572,9 @@ void display_dungeon(void) byte ta = 0; char tc = '\0'; - for (x = px - Term->wid / 2 + 1; x <= px + Term->wid / 2; x++) + for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++) { - for (y = py - Term->hgt / 2 + 1; y <= py + Term->hgt / 2; y++) + for (y = p_ptr->y - Term->hgt / 2 + 1; y <= p_ptr->y + Term->hgt / 2; y++) { if (in_bounds2(y, x)) { @@ -1591,7 +1591,7 @@ void display_dungeon(void) } /* Hack -- Queue it */ - Term_queue_char(x - px + Term->wid / 2 - 1, y - py + Term->hgt / 2 - 1, a, c, ta, tc); + Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc); } else { @@ -1607,7 +1607,7 @@ void display_dungeon(void) c = f_ptr->x_char[F_LIT_STANDARD]; /* Hack -- Queue it */ - Term_queue_char(x - px + Term->wid / 2 - 1, y - py + Term->hgt / 2 - 1, a, c, ta, tc); + Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc); } } } @@ -1729,7 +1729,7 @@ void prt_map(void) } /* Display player */ - lite_spot(py, px); + lite_spot(p_ptr->y, p_ptr->x); /* Restore the cursor */ (void)Term_set_cursor(v); @@ -1752,7 +1752,7 @@ void prt_path(int y, int x) return; /* Get projection path */ - path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), py, px, y, x, PROJECT_PATH|PROJECT_THRU); + path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH|PROJECT_THRU); /* Redraw map */ p_ptr->redraw |= (PR_MAP); @@ -2146,11 +2146,11 @@ void display_map(int *cy, int *cx) } /* Player location */ - (*cy) = py / yrat + 1 + ROW_MAP; + (*cy) = p_ptr->y / yrat + 1 + ROW_MAP; if (!use_bigtile) - (*cx) = px / xrat + 1 + COL_MAP; + (*cx) = p_ptr->x / xrat + 1 + COL_MAP; else - (*cx) = (px / xrat + 1) * 2 + COL_MAP; + (*cx) = (p_ptr->x / xrat + 1) * 2 + COL_MAP; /* Restore lighting effects */ view_special_lite = old_view_special_lite; @@ -2605,7 +2605,7 @@ void update_lite(void) /* forget_lite(); Perhaps don't need? */ /* Add it to later visual update */ - cave_redraw_later(&cave[py][px], py, px); + cave_redraw_later(&cave[p_ptr->y][p_ptr->x], p_ptr->y, p_ptr->x); } #endif @@ -2639,54 +2639,54 @@ void update_lite(void) if (p >= 1) { /* Player grid */ - cave_lite_hack(py, px); + cave_lite_hack(p_ptr->y, p_ptr->x); /* Adjacent grid */ - cave_lite_hack(py+1, px); - cave_lite_hack(py-1, px); - cave_lite_hack(py, px+1); - cave_lite_hack(py, px-1); + cave_lite_hack(p_ptr->y+1, p_ptr->x); + cave_lite_hack(p_ptr->y-1, p_ptr->x); + cave_lite_hack(p_ptr->y, p_ptr->x+1); + cave_lite_hack(p_ptr->y, p_ptr->x-1); /* Diagonal grids */ - cave_lite_hack(py+1, px+1); - cave_lite_hack(py+1, px-1); - cave_lite_hack(py-1, px+1); - cave_lite_hack(py-1, px-1); + cave_lite_hack(p_ptr->y+1, p_ptr->x+1); + cave_lite_hack(p_ptr->y+1, p_ptr->x-1); + cave_lite_hack(p_ptr->y-1, p_ptr->x+1); + cave_lite_hack(p_ptr->y-1, p_ptr->x-1); } /* Radius 2 -- lantern radius */ if (p >= 2) { /* South of the player */ - if (cave_los_bold(py + 1, px)) + if (cave_los_bold(p_ptr->y + 1, p_ptr->x)) { - cave_lite_hack(py+2, px); - cave_lite_hack(py+2, px+1); - cave_lite_hack(py+2, px-1); + cave_lite_hack(p_ptr->y+2, p_ptr->x); + cave_lite_hack(p_ptr->y+2, p_ptr->x+1); + cave_lite_hack(p_ptr->y+2, p_ptr->x-1); } /* North of the player */ - if (cave_los_bold(py - 1, px)) + if (cave_los_bold(p_ptr->y - 1, p_ptr->x)) { - cave_lite_hack(py-2, px); - cave_lite_hack(py-2, px+1); - cave_lite_hack(py-2, px-1); + cave_lite_hack(p_ptr->y-2, p_ptr->x); + cave_lite_hack(p_ptr->y-2, p_ptr->x+1); + cave_lite_hack(p_ptr->y-2, p_ptr->x-1); } /* East of the player */ - if (cave_los_bold(py, px + 1)) + if (cave_los_bold(p_ptr->y, p_ptr->x + 1)) { - cave_lite_hack(py, px+2); - cave_lite_hack(py+1, px+2); - cave_lite_hack(py-1, px+2); + cave_lite_hack(p_ptr->y, p_ptr->x+2); + cave_lite_hack(p_ptr->y+1, p_ptr->x+2); + cave_lite_hack(p_ptr->y-1, p_ptr->x+2); } /* West of the player */ - if (cave_los_bold(py, px - 1)) + if (cave_los_bold(p_ptr->y, p_ptr->x - 1)) { - cave_lite_hack(py, px-2); - cave_lite_hack(py+1, px-2); - cave_lite_hack(py-1, px-2); + cave_lite_hack(p_ptr->y, p_ptr->x-2); + cave_lite_hack(p_ptr->y+1, p_ptr->x-2); + cave_lite_hack(p_ptr->y-1, p_ptr->x-2); } } @@ -2699,43 +2699,43 @@ void update_lite(void) if (p > 14) p = 14; /* South-East of the player */ - if (cave_los_bold(py + 1, px + 1)) + if (cave_los_bold(p_ptr->y + 1, p_ptr->x + 1)) { - cave_lite_hack(py+2, px+2); + cave_lite_hack(p_ptr->y+2, p_ptr->x+2); } /* South-West of the player */ - if (cave_los_bold(py + 1, px - 1)) + if (cave_los_bold(p_ptr->y + 1, p_ptr->x - 1)) { - cave_lite_hack(py+2, px-2); + cave_lite_hack(p_ptr->y+2, p_ptr->x-2); } /* North-East of the player */ - if (cave_los_bold(py - 1, px + 1)) + if (cave_los_bold(p_ptr->y - 1, p_ptr->x + 1)) { - cave_lite_hack(py-2, px+2); + cave_lite_hack(p_ptr->y-2, p_ptr->x+2); } /* North-West of the player */ - if (cave_los_bold(py - 1, px - 1)) + if (cave_los_bold(p_ptr->y - 1, p_ptr->x - 1)) { - cave_lite_hack(py-2, px-2); + cave_lite_hack(p_ptr->y-2, p_ptr->x-2); } /* Maximal north */ - min_y = py - p; + min_y = p_ptr->y - p; if (min_y < 0) min_y = 0; /* Maximal south */ - max_y = py + p; + max_y = p_ptr->y + p; if (max_y > cur_hgt-1) max_y = cur_hgt-1; /* Maximal west */ - min_x = px - p; + min_x = p_ptr->x - p; if (min_x < 0) min_x = 0; /* Maximal east */ - max_x = px + p; + max_x = p_ptr->x + p; if (max_x > cur_wid-1) max_x = cur_wid-1; /* Scan the maximal box */ @@ -2743,8 +2743,8 @@ void update_lite(void) { for (x = min_x; x <= max_x; x++) { - int dy = (py > y) ? (py - y) : (y - py); - int dx = (px > x) ? (px - x) : (x - px); + int dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y); + int dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x); /* Skip the "central" grids (above) */ if ((dy <= 2) && (dx <= 2)) continue; @@ -2833,11 +2833,11 @@ static void mon_lite_hack(int y, int x) /* Hack -- Prevent monster lite leakage in walls */ /* Horizontal walls between player and a monster */ - if (((y < py) && (y > mon_fy)) || ((y > py) && (y < mon_fy))) + if (((y < p_ptr->y) && (y > mon_fy)) || ((y > p_ptr->y) && (y < mon_fy))) { - dpf = py - mon_fy; + dpf = p_ptr->y - mon_fy; d = y - mon_fy; - midpoint = mon_fx + ((px - mon_fx) * ABS(d)) / ABS(dpf); + midpoint = mon_fx + ((p_ptr->x - mon_fx) * ABS(d)) / ABS(dpf); /* Only first wall viewed from mid-x is lit */ if (x < midpoint) @@ -2854,11 +2854,11 @@ static void mon_lite_hack(int y, int x) } /* Vertical walls between player and a monster */ - if (((x < px) && (x > mon_fx)) || ((x > px) && (x < mon_fx))) + if (((x < p_ptr->x) && (x > mon_fx)) || ((x > p_ptr->x) && (x < mon_fx))) { - dpf = px - mon_fx; + dpf = p_ptr->x - mon_fx; d = x - mon_fx; - midpoint = mon_fy + ((py - mon_fy) * ABS(d)) / ABS(dpf); + midpoint = mon_fy + ((p_ptr->y - mon_fy) * ABS(d)) / ABS(dpf); /* Only first wall viewed from mid-y is lit */ if (y < midpoint) @@ -2919,11 +2919,11 @@ static void mon_dark_hack(int y, int x) /* Hack -- Prevent monster dark lite leakage in walls */ /* Horizontal walls between player and a monster */ - if (((y < py) && (y > mon_fy)) || ((y > py) && (y < mon_fy))) + if (((y < p_ptr->y) && (y > mon_fy)) || ((y > p_ptr->y) && (y < mon_fy))) { - dpf = py - mon_fy; + dpf = p_ptr->y - mon_fy; d = y - mon_fy; - midpoint = mon_fx + ((px - mon_fx) * ABS(d)) / ABS(dpf); + midpoint = mon_fx + ((p_ptr->x - mon_fx) * ABS(d)) / ABS(dpf); /* Only first wall viewed from mid-x is lit */ if (x < midpoint) @@ -2940,11 +2940,11 @@ static void mon_dark_hack(int y, int x) } /* Vertical walls between player and a monster */ - if (((x < px) && (x > mon_fx)) || ((x > px) && (x < mon_fx))) + if (((x < p_ptr->x) && (x > mon_fx)) || ((x > p_ptr->x) && (x < mon_fx))) { - dpf = px - mon_fx; + dpf = p_ptr->x - mon_fx; d = x - mon_fx; - midpoint = mon_fy + ((py - mon_fy) * ABS(d)) / ABS(dpf); + midpoint = mon_fy + ((p_ptr->y - mon_fy) * ABS(d)) / ABS(dpf); /* Only first wall viewed from mid-y is lit */ if (y < midpoint) @@ -3282,7 +3282,7 @@ void update_mon_lite(void) /* Mega-Hack -- Visual update later */ p_ptr->update |= (PU_DELAY_VIS); - p_ptr->monlite = (cave[py][px].info & CAVE_MNLT) ? TRUE : FALSE; + p_ptr->monlite = (cave[p_ptr->y][p_ptr->x].info & CAVE_MNLT) ? TRUE : FALSE; if (p_ptr->special_defense & NINJA_S_STEALTH) { @@ -3382,8 +3382,8 @@ void forget_view(void) * * This function assumes that (y,x) is legal (i.e. on the map). * - * Grid (y1,x1) is on the "diagonal" between (py,px) and (y,x) - * Grid (y2,x2) is "adjacent", also between (py,px) and (y,x). + * Grid (y1,x1) is on the "diagonal" between (p_ptr->y,p_ptr->x) and (y,x) + * Grid (y2,x2) is "adjacent", also between (p_ptr->y,p_ptr->x) and (y,x). * * Note that we are using the "CAVE_XTRA" field for marking grids as * "easily viewable". This bit is cleared at the end of "update_view()". @@ -3473,7 +3473,7 @@ static bool update_view_aux(int y, int x, int y1, int x1, int y2, int x2) /* Hack -- check line of sight */ - if (los(py, px, y, x)) + if (los(p_ptr->y, p_ptr->x, y, x)) { cave_view_hack(c_ptr, y, x); @@ -3643,8 +3643,8 @@ void update_view(void) /*** Step 1 -- adjacent grids ***/ /* Now start on the player */ - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; /* Access the grid */ c_ptr = &cave[y][x]; @@ -4145,12 +4145,12 @@ void update_flow(void) } /* Save player position */ - flow_y = py; - flow_x = px; + flow_y = p_ptr->y; + flow_x = p_ptr->x; /* Add the player's grid to the queue */ - temp_y[0] = py; - temp_x[0] = px; + temp_y[0] = p_ptr->y; + temp_x[0] = p_ptr->x; /* Now process the queue */ while (flow_head != flow_tail) @@ -4269,8 +4269,8 @@ void update_smell(void) cave_type *c_ptr; /* Translate table to map grids */ - y = i + py - 2; - x = j + px - 2; + y = i + p_ptr->y - 2; + x = j + p_ptr->x - 2; /* Check Bounds */ if (!in_bounds(y, x)) continue; @@ -4310,7 +4310,7 @@ void map_area(int range) { for (x = 1; x < cur_wid - 1; x++) { - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; c_ptr = &cave[y][x]; @@ -4466,7 +4466,7 @@ void wiz_lite(bool ninja) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE); + if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } @@ -4655,7 +4655,7 @@ void cave_set_feat(int y, int x, int feat) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE); + if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } } diff --git a/src/cmd1.c b/src/cmd1.c index af1a04064..fc7047cf4 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -648,7 +648,7 @@ void search(void) /* Sometimes, notice things */ if (randint0(100) < chance) { - discover_hidden_things(py + ddy_ddd[i], px + ddx_ddd[i]); + discover_hidden_things(p_ptr->y + ddy_ddd[i], p_ptr->x + ddx_ddd[i]); } } } @@ -761,7 +761,7 @@ void py_pickup_aux(int o_idx) */ void carry(bool pickup) { - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; s16b this_o_idx, next_o_idx = 0; @@ -1077,7 +1077,7 @@ static void hit_trap_set_abnormal_status(cptr trap_message, bool resist, bool (* static void hit_trap(bool break_trap) { int i, num, dam; - int x = px, y = py; + int x = p_ptr->x, y = p_ptr->y; /* Get the cave grid */ cave_type *c_ptr = &cave[y][x]; @@ -1299,7 +1299,7 @@ static void hit_trap(bool break_trap) if (!in_bounds(y1, x1)) continue; /* Require line of projection */ - if (!projectable(py, px, y1, x1)) continue; + if (!projectable(p_ptr->y, p_ptr->x, y1, x1)) continue; if (summon_specific(0, y1, x1, lev, SUMMON_ARMAGE_EVIL, (PM_NO_PET))) evil_idx = hack_m_idx_ii; @@ -2447,7 +2447,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int /* Mega-Hack -- apply earthquake brand */ if (do_quake) { - earthquake(py, px, 10); + earthquake(p_ptr->y, p_ptr->x, 10); if (!cave[y][x].m_idx) *mdeath = TRUE; } } @@ -2824,15 +2824,15 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) if (!(mpe_mode & MPE_STAYING)) { - int oy = py; - int ox = px; + int oy = p_ptr->y; + int ox = p_ptr->x; cave_type *oc_ptr = &cave[oy][ox]; int om_idx = oc_ptr->m_idx; int nm_idx = c_ptr->m_idx; /* Move the player */ - py = ny; - px = nx; + p_ptr->y = ny; + p_ptr->x = nx; /* Hack -- For moving monster or riding player's moving */ if (!(mpe_mode & MPE_DONT_SWAP_MON)) @@ -2912,7 +2912,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) { if (music_singing(MUSIC_WALL)) { - (void)project(0, 0, py, px, (60 + p_ptr->lev), GF_DISINTEGRATE, + (void)project(0, 0, p_ptr->y, p_ptr->x, (60 + p_ptr->lev), GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1); if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE; @@ -3000,7 +3000,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) msg_print(_("トラップだ!", "You found a trap!")); /* Pick a trap */ - disclose_grid(py, px); + disclose_grid(p_ptr->y, p_ptr->x); } /* Hit the trap */ @@ -3104,8 +3104,8 @@ bool trap_can_be_ignored(int feat) void move_player(int dir, bool do_pickup, bool break_trap) { /* Find the result of moving */ - int y = py + ddy[dir]; - int x = px + ddx[dir]; + int y = p_ptr->y + ddy[dir]; + int x = p_ptr->x + ddx[dir]; /* Examine the destination */ cave_type *c_ptr = &cave[y][x]; @@ -3236,7 +3236,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) if (!is_hostile(m_ptr) && !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun || ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) && - pattern_seq(py, px, y, x) && (p_can_enter || p_can_kill_walls)) + pattern_seq(p_ptr->y, p_ptr->x, y, x) && (p_can_enter || p_can_kill_walls)) { /* Disturb the monster */ (void)set_monster_csleep(c_ptr->m_idx, 0); @@ -3259,7 +3259,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) py_attack(y, x, 0); oktomove = FALSE; } - else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr, 0)) + else if (monster_can_cross_terrain(cave[p_ptr->y][p_ptr->x].feat, r_ptr, 0)) { do_past = TRUE; } @@ -3324,7 +3324,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) } 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(&cave[py][px])].name); + msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name); p_ptr->energy_use = 0; oktomove = FALSE; disturb(0, 1); @@ -3461,7 +3461,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) } /* Normal movement */ - if (oktomove && !pattern_seq(py, px, y, x)) + if (oktomove && !pattern_seq(p_ptr->y, p_ptr->x, y, x)) { if (!(p_ptr->confused || p_ptr->stun || p_ptr->image)) { @@ -3685,12 +3685,12 @@ static void run_init(int dir) deepleft = deepright = FALSE; shortright = shortleft = FALSE; - p_ptr->run_py = py; - p_ptr->run_px = px; + p_ptr->run_py = p_ptr->y; + p_ptr->run_px = p_ptr->x; /* Find the destination grid */ - row = py + ddy[dir]; - col = px + ddx[dir]; + row = p_ptr->y + ddy[dir]; + col = p_ptr->x + ddx[dir]; ignore_avoid_run = cave_have_flag_bold(row, col, FF_AVOID_RUN); @@ -3698,7 +3698,7 @@ static void run_init(int dir) i = chome[dir]; /* Check for walls */ - if (see_wall(cycle[i+1], py, px)) + if (see_wall(cycle[i+1], p_ptr->y, p_ptr->x)) { find_breakleft = TRUE; shortleft = TRUE; @@ -3710,7 +3710,7 @@ static void run_init(int dir) } /* Check for walls */ - if (see_wall(cycle[i-1], py, px)) + if (see_wall(cycle[i-1], p_ptr->y, p_ptr->x)) { find_breakright = TRUE; shortright = TRUE; @@ -3782,13 +3782,13 @@ static bool run_test(void) /* break run when leaving trap detected region */ if ((disturb_trap_detect || alert_trap_detect) - && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT)) + && p_ptr->dtrap && !(cave[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) { /* No duplicate warning */ p_ptr->dtrap = FALSE; /* You are just on the edge */ - if (!(cave[py][px].info & CAVE_UNSAFE)) + if (!(cave[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) { if (alert_trap_detect) { @@ -3812,8 +3812,8 @@ static bool run_test(void) new_dir = cycle[chome[prev_dir] + i]; /* New location */ - row = py + ddy[new_dir]; - col = px + ddx[new_dir]; + row = p_ptr->y + ddy[new_dir]; + col = p_ptr->x + ddx[new_dir]; /* Access grid */ c_ptr = &cave[row][col]; @@ -3963,7 +3963,7 @@ static bool run_test(void) for (i = -max; i < 0; i++) { /* Unknown grid or non-wall */ - if (!see_wall(cycle[chome[prev_dir] + i], py, px)) + if (!see_wall(cycle[chome[prev_dir] + i], p_ptr->y, p_ptr->x)) { /* Looking to break right */ if (find_breakright) @@ -3987,7 +3987,7 @@ static bool run_test(void) for (i = max; i > 0; i--) { /* Unknown grid or non-wall */ - if (!see_wall(cycle[chome[prev_dir] + i], py, px)) + if (!see_wall(cycle[chome[prev_dir] + i], p_ptr->y, p_ptr->x)) { /* Looking to break left */ if (find_breakleft) @@ -4041,8 +4041,8 @@ static bool run_test(void) else { /* Get next location */ - row = py + ddy[option]; - col = px + ddx[option]; + row = p_ptr->y + ddy[option]; + col = p_ptr->x + ddx[option]; /* Don't see that it is closed off. */ /* This could be a potential corner or an intersection. */ @@ -4083,7 +4083,7 @@ static bool run_test(void) } /* About to hit a known wall, stop */ - if (see_wall(find_current, py, px)) + if (see_wall(find_current, p_ptr->y, p_ptr->x)) { return (TRUE); } @@ -4109,7 +4109,7 @@ void run_step(int dir) ignore_avoid_run = TRUE; /* Hack -- do not start silly run */ - if (see_wall(dir, py, px)) + if (see_wall(dir, p_ptr->y, p_ptr->x)) { /* Message */ msg_print(_("その方向には走れません。", "You cannot run in that direction.")); @@ -4189,13 +4189,13 @@ static int travel_test(int prev_dir) /* break run when leaving trap detected region */ if ((disturb_trap_detect || alert_trap_detect) - && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT)) + && p_ptr->dtrap && !(cave[p_ptr->y][p_ptr->x].info & CAVE_IN_DETECT)) { /* No duplicate warning */ p_ptr->dtrap = FALSE; /* You are just on the edge */ - if (!(cave[py][px].info & CAVE_UNSAFE)) + if (!(cave[p_ptr->y][p_ptr->x].info & CAVE_UNSAFE)) { if (alert_trap_detect) { @@ -4220,8 +4220,8 @@ static int travel_test(int prev_dir) int dir = cycle[chome[prev_dir] + i]; /* New location */ - int row = py + ddy[dir]; - int col = px + ddx[dir]; + int row = p_ptr->y + ddy[dir]; + int col = p_ptr->x + ddx[dir]; /* Access grid */ c_ptr = &cave[row][col]; @@ -4238,11 +4238,11 @@ static int travel_test(int prev_dir) } /* Travel cost of current grid */ - cost = travel.cost[py][px]; + cost = travel.cost[p_ptr->y][p_ptr->x]; /* Determine travel direction */ for (i = 0; i < 8; ++ i) { - int dir_cost = travel.cost[py+ddy_ddd[i]][px+ddx_ddd[i]]; + int dir_cost = travel.cost[p_ptr->y+ddy_ddd[i]][p_ptr->x+ddx_ddd[i]]; if (dir_cost < cost) { @@ -4254,7 +4254,7 @@ static int travel_test(int prev_dir) if (!new_dir) return (0); /* Access newly move grid */ - c_ptr = &cave[py+ddy[new_dir]][px+ddx[new_dir]]; + c_ptr = &cave[p_ptr->y+ddy[new_dir]][p_ptr->x+ddx[new_dir]]; /* Close door abort traveling */ if (!easy_open && is_closed_door(c_ptr->feat)) return (0); @@ -4293,7 +4293,7 @@ void travel_step(void) move_player(travel.dir, always_pickup, FALSE); - if ((py == travel.y) && (px == travel.x)) + if ((p_ptr->y == travel.y) && (p_ptr->x == travel.x)) { travel.run = 0; travel.y = travel.x = 0; diff --git a/src/cmd2.c b/src/cmd2.c index 2831165a7..28f7c8a39 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -55,7 +55,7 @@ void do_cmd_go_up(void) bool go_up = FALSE; /* Player grid */ - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; feature_type *f_ptr = &f_info[c_ptr->feat]; int up_num = 0; @@ -205,7 +205,7 @@ void do_cmd_go_up(void) void do_cmd_go_down(void) { /* Player grid */ - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; feature_type *f_ptr = &f_info[c_ptr->feat]; bool fall_trap = FALSE; @@ -300,8 +300,8 @@ void do_cmd_go_down(void) } /* Save old player position */ - p_ptr->oldpx = px; - p_ptr->oldpy = py; + p_ptr->oldpx = p_ptr->x; + p_ptr->oldpy = p_ptr->y; dungeon_type = (byte)target_dungeon; /* @@ -648,7 +648,7 @@ static void chest_trap(int y, int x, s16b o_idx) for (i = 0; i < num; i++) { if (randint1(100)y, p_ptr->x, FALSE); else (void)summon_specific(0, y, x, mon_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } @@ -908,8 +908,8 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under) if ((d == 8) && !under) continue; /* Extract adjacent (legal) location */ - yy = py + ddy_ddd[d]; - xx = px + ddx_ddd[d]; + yy = p_ptr->y + ddy_ddd[d]; + xx = p_ptr->x + ddx_ddd[d]; /* Get the cave */ c_ptr = &cave[yy][xx]; @@ -959,8 +959,8 @@ static int count_chests(int *y, int *x, bool trapped) for (d = 0; d < 9; d++) { /* Extract adjacent (legal) location */ - int yy = py + ddy_ddd[d]; - int xx = px + ddx_ddd[d]; + int yy = p_ptr->y + ddy_ddd[d]; + int xx = p_ptr->x + ddx_ddd[d]; /* No (visible) chest is there */ if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue; @@ -1000,8 +1000,8 @@ static int coords_to_dir(int y, int x) int d[3][3] = { {7, 4, 1}, {8, 5, 2}, {9, 6, 3} }; int dy, dx; - dy = y - py; - dx = x - px; + dy = y - p_ptr->y; + dx = x - p_ptr->x; /* Paranoia */ if (ABS(dx) > 1 || ABS(dy) > 1) return (0); @@ -1174,8 +1174,8 @@ void do_cmd_open(void) cave_type *c_ptr; /* Get requested location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get requested grid */ c_ptr = &cave[y][x]; @@ -1338,8 +1338,8 @@ void do_cmd_close(void) s16b feat; /* Get requested location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid and contents */ c_ptr = &cave[y][x]; @@ -1593,8 +1593,8 @@ void do_cmd_tunnel(void) if (get_rep_dir(&dir,FALSE)) { /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid */ c_ptr = &cave[y][x]; @@ -2011,8 +2011,8 @@ void do_cmd_disarm(void) s16b feat; /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid and contents */ c_ptr = &cave[y][x]; @@ -2209,8 +2209,8 @@ void do_cmd_bash(void) s16b feat; /* Bash location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid */ c_ptr = &cave[y][x]; @@ -2300,8 +2300,8 @@ void do_cmd_alter(void) feature_type *f_ptr; /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid */ c_ptr = &cave[y][x]; @@ -2428,8 +2428,8 @@ void do_cmd_spike(void) s16b feat; /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; /* Get grid and contents */ c_ptr = &cave[y][x]; @@ -2533,12 +2533,12 @@ void do_cmd_walk(bool pickup) } /* Hack again -- Is there a special encounter ??? */ - if (p_ptr->wild_mode && !cave_have_flag_bold(py, px, FF_TOWN)) + if (p_ptr->wild_mode && !cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_TOWN)) { - int tmp = 120 + p_ptr->lev*10 - wilderness[py][px].level + 5; + int tmp = 120 + p_ptr->lev*10 - wilderness[p_ptr->y][p_ptr->x].level + 5; if (tmp < 1) tmp = 1; - if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl)) + if (((wilderness[p_ptr->y][p_ptr->x].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl)) { /* Inform the player of his horrible fate :=) */ msg_print(_("襲撃だ!", "You are ambushed !")); @@ -2622,7 +2622,7 @@ void do_cmd_stay(bool pickup) p_ptr->energy_use = 100; if (pickup) mpe_mode |= MPE_DO_PICKUP; - (void)move_player_effect(py, px, mpe_mode); + (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode); } @@ -3281,8 +3281,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) } /* Predict the "target" location */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Check for "target request" */ if ((dir == 5) && target_okay()) @@ -3292,12 +3292,12 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) } /* Get projection path length */ - tdis = project_path(path_g, project_length, py, px, ty, tx, PROJECT_PATH|PROJECT_THRU) - 1; + tdis = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_PATH|PROJECT_THRU) - 1; project_length = 0; /* reset to default */ /* Don't shoot at my feet */ - if (tx == px && ty == py) + if (tx == p_ptr->x && ty == p_ptr->y) { p_ptr->energy_use = 0; @@ -3319,8 +3319,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) { /* Start at the player */ - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; /* Get local object */ q_ptr = &forge; @@ -3370,7 +3370,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Calculate the new location (see "project()") */ ny = y; nx = x; - mmove2(&ny, &nx, py, px, ty, tx); + mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx); /* Shatter Arrow */ if (snipe_type == SP_KILL_WALL) @@ -3651,7 +3651,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name); } - set_target(m_ptr, py, px); + set_target(m_ptr, p_ptr->y, p_ptr->x); /* Sniper */ if (snipe_type == SP_RUSH) @@ -3667,7 +3667,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) if (!n) break; /* Calculate the new location (see "project()") */ - mmove2(&ny, &nx, py, px, ty, tx); + mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx); /* Stopped by wilderness boundary */ if (!in_bounds2(ny, nx)) break; @@ -4002,8 +4002,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) if (shuriken >= 0) { - ty = randint0(101)-50+py; - tx = randint0(101)-50+px; + ty = randint0(101)-50+p_ptr->y; + tx = randint0(101)-50+p_ptr->x; } else { @@ -4013,8 +4013,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) if (!get_aim_dir(&dir)) return FALSE; /* Predict the "target" location */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Check for "target request" */ if ((dir == 5) && target_okay()) @@ -4059,8 +4059,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) p_ptr->energy_use -= p_ptr->lev; /* Start at the player */ - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; /* Hack -- Handle stuff */ @@ -4089,7 +4089,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Calculate the new location (see "project()") */ ny[cur_dis] = y; nx[cur_dis] = x; - mmove2(&ny[cur_dis], &nx[cur_dis], py, px, ty, tx); + mmove2(&ny[cur_dis], &nx[cur_dis], p_ptr->y, p_ptr->x, ty, tx); /* Stopped by walls/doors */ if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT)) @@ -4359,8 +4359,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) { msg_format(_("%sが返ってきた。", "%s comes back."), o2_name); } - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; } } else @@ -4581,7 +4581,7 @@ static void travel_flow(int ty, int tx) { int x, y, d; bool wall = FALSE; - feature_type *f_ptr = &f_info[cave[py][px].feat]; + feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat]; /* Reset the "queue" */ flow_head = flow_tail = 0; @@ -4635,7 +4635,7 @@ void do_cmd_travel(void) } else if (!tgt_pt(&x, &y)) return; - if ((x == px) && (y == py)) + if ((x == p_ptr->x) && (y == p_ptr->y)) { msg_print(_("すでにそこにいます!", "You are already there!!")); return; @@ -4665,10 +4665,10 @@ void do_cmd_travel(void) travel.dir = 0; /* Decides first direction */ - dx = abs(px - x); - dy = abs(py - y); - sx = ((x == px) || (dx < dy)) ? 0 : ((x > px) ? 1 : -1); - sy = ((y == py) || (dy < dx)) ? 0 : ((y > py) ? 1 : -1); + dx = abs(p_ptr->x - x); + dy = abs(p_ptr->y - y); + sx = ((x == p_ptr->x) || (dx < dy)) ? 0 : ((x > p_ptr->x) ? 1 : -1); + sy = ((y == p_ptr->y) || (dy < dx)) ? 0 : ((y > p_ptr->y) ? 1 : -1); for (i = 1; i <= 9; i++) { diff --git a/src/cmd5.c b/src/cmd5.c index d93dcb106..872fcaf21 100644 --- a/src/cmd5.c +++ b/src/cmd5.c @@ -390,7 +390,7 @@ static bool player_has_no_spellbooks(void) if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE; } - for (i = cave[py][px].o_idx; i; i = o_ptr->next_o_idx) + for (i = cave[p_ptr->y][p_ptr->x].o_idx; i; i = o_ptr->next_o_idx) { o_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; @@ -987,7 +987,7 @@ static void wild_magic(int spell) break; case 19: case 20: - trap_creation(py, px); + trap_creation(p_ptr->y, p_ptr->x); break; case 21: case 22: @@ -999,7 +999,7 @@ static void wild_magic(int spell) aggravate_monsters(0); break; case 26: - earthquake(py, px, 5); + earthquake(p_ptr->y, p_ptr->x, 5); break; case 27: case 28: @@ -1022,15 +1022,15 @@ static void wild_magic(int spell) case 35: while (counter++ < 8) { - (void)summon_specific(0, py, px, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); + (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); } break; case 36: case 37: - activate_hi_summon(py, px, FALSE); + activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); break; case 38: - (void)summon_cyber(-1, py, px); + (void)summon_cyber(-1, p_ptr->y, p_ptr->x); break; default: { @@ -1892,8 +1892,8 @@ bool rakuba(int dam, bool force) cave_type *c_ptr; /* Access the location */ - y = py + ddy_ddd[i]; - x = px + ddx_ddd[i]; + y = p_ptr->y + ddy_ddd[i]; + x = p_ptr->x + ddx_ddd[i]; c_ptr = &cave[y][x]; @@ -1929,17 +1929,17 @@ msg_format("%sから振り落とされそうになって、壁にぶつかった return FALSE; } - oy = py; - ox = px; + oy = p_ptr->y; + ox = p_ptr->x; - py = sy; - px = sx; + p_ptr->y = sy; + p_ptr->x = sx; /* Redraw the old spot */ lite_spot(oy, ox); /* Redraw the new spot */ - lite_spot(py, px); + lite_spot(p_ptr->y, p_ptr->x); /* Check for new panel */ verify_panel(); @@ -1977,7 +1977,7 @@ msg_format("%sから振り落とされそうになって、壁にぶつかった /* Move the player */ if (sy && !p_ptr->is_dead) - (void)move_player_effect(py, px, MPE_DONT_PICKUP | MPE_DONT_SWAP_MON); + (void)move_player_effect(p_ptr->y, p_ptr->x, MPE_DONT_PICKUP | MPE_DONT_SWAP_MON); return fall_dam; } @@ -1994,8 +1994,8 @@ bool do_riding(bool force) monster_type *m_ptr; if (!get_rep_dir2(&dir)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; if (p_ptr->special_defense & KATA_MUSOU) set_action(ACTION_NONE); @@ -2009,7 +2009,7 @@ bool do_riding(bool force) return FALSE; } - if (!pattern_seq(py, px, y, x)) return FALSE; + if (!pattern_seq(p_ptr->y, p_ptr->x, y, x)) return FALSE; if (c_ptr->m_idx) { @@ -2053,7 +2053,7 @@ bool do_riding(bool force) return FALSE; } - if (!pattern_seq(py, px, y, x)) return FALSE; + if (!pattern_seq(p_ptr->y, p_ptr->x, y, x)) return FALSE; if (!player_can_ride_aux(c_ptr, TRUE)) { diff --git a/src/cmd6.c b/src/cmd6.c index 3cb1e2d07..ea5b1a544 100644 --- a/src/cmd6.c +++ b/src/cmd6.c @@ -502,7 +502,7 @@ static void do_cmd_eat_food_aux(int item) object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval)); /* Drop the object from heaven */ - (void)drop_near(q_ptr, -1, py, px); + (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x); } else { @@ -1241,7 +1241,7 @@ static void do_cmd_quaff_potion_aux(int item) if (prace_is_(RACE_SKELETON)) { msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!")); - (void)potion_smash_effect(0, py, px, q_ptr->k_idx); + (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx); } /* Combine / Reorder the pack (later) */ @@ -1476,7 +1476,7 @@ static void do_cmd_read_scroll_aux(int item, bool known) { for (k = 0; k < randint1(3); k++) { - if (summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { ident = TRUE; } @@ -1488,7 +1488,7 @@ static void do_cmd_read_scroll_aux(int item, bool known) { for (k = 0; k < randint1(3); k++) { - if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { ident = TRUE; } @@ -1498,7 +1498,7 @@ static void do_cmd_read_scroll_aux(int item, bool known) case SV_SCROLL_SUMMON_PET: { - if (summon_specific(-1, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET))) + if (summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_FORCE_PET))) { ident = TRUE; } @@ -1507,7 +1507,7 @@ static void do_cmd_read_scroll_aux(int item, bool known) case SV_SCROLL_SUMMON_KIN: { - if (summon_kin_player(p_ptr->lev, py, px, (PM_FORCE_PET | PM_ALLOW_GROUP))) + if (summon_kin_player(p_ptr->lev, p_ptr->y, p_ptr->x, (PM_FORCE_PET | PM_ALLOW_GROUP))) { ident = TRUE; } @@ -1516,7 +1516,7 @@ static void do_cmd_read_scroll_aux(int item, bool known) case SV_SCROLL_TRAP_CREATION: { - if (trap_creation(py, px)) ident = TRUE; + if (trap_creation(p_ptr->y, p_ptr->x)) ident = TRUE; break; } @@ -1734,7 +1734,7 @@ static void do_cmd_read_scroll_aux(int item, bool known) case SV_SCROLL_STAR_DESTRUCTION: { - if (destroy_area(py, px, 13 + randint0(5), FALSE)) + if (destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE)) ident = TRUE; else msg_print(_("ダンジョンが揺れた...", "The dungeon trembles...")); @@ -1787,14 +1787,14 @@ static void do_cmd_read_scroll_aux(int item, bool known) case SV_SCROLL_ACQUIREMENT: { - acquirement(py, px, 1, TRUE, FALSE, FALSE); + acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE); ident = TRUE; break; } case SV_SCROLL_STAR_ACQUIREMENT: { - acquirement(py, px, randint1(2) + 1, TRUE, FALSE, FALSE); + acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE); ident = TRUE; break; } @@ -1861,14 +1861,14 @@ static void do_cmd_read_scroll_aux(int item, bool known) case SV_SCROLL_AMUSEMENT: { ident = TRUE; - amusement(py, px, 1, FALSE); + amusement(p_ptr->y, p_ptr->x, 1, FALSE); break; } case SV_SCROLL_STAR_AMUSEMENT: { ident = TRUE; - amusement(py, px, randint1(2) + 1, FALSE); + amusement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE); break; } } @@ -2085,7 +2085,7 @@ static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, b const int times = randint1(powerful ? 8 : 4); for (k = 0; k < times; k++) { - if (summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { ident = TRUE; } @@ -2146,7 +2146,7 @@ static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, b while (attempts--) { - scatter(&y, &x, py, px, 4, 0); + scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0); if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue; @@ -2321,7 +2321,7 @@ static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, b case SV_STAFF_EARTHQUAKES: { - if (earthquake(py, px, (powerful ? 15 : 10))) + if (earthquake(p_ptr->y, p_ptr->x, (powerful ? 15 : 10))) ident = TRUE; else msg_print(_("ダンジョンが揺れた。", "The dungeon trembles.")); @@ -2331,7 +2331,7 @@ static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, b case SV_STAFF_DESTRUCTION: { - if (destroy_area(py, px, (powerful ? 18 : 13) + randint0(5), FALSE)) + if (destroy_area(p_ptr->y, p_ptr->x, (powerful ? 18 : 13) + randint0(5), FALSE)) ident = TRUE; break; @@ -2339,7 +2339,7 @@ static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, b case SV_STAFF_ANIMATE_DEAD: { - if (animate_dead(0, py, px)) + if (animate_dead(0, p_ptr->y, p_ptr->x)) ident = TRUE; break; @@ -2348,7 +2348,7 @@ static int staff_effect(int sval, bool *use_charge, bool powerful, bool magic, b case SV_STAFF_MSTORM: { msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!")); - project(0, (powerful ? 7 : 5), py, px, + project(0, (powerful ? 7 : 5), p_ptr->y, p_ptr->x, (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1); if ((p_ptr->pclass != CLASS_MAGE) && (p_ptr->pclass != CLASS_HIGH_MAGE) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_MAGIC_EATER) && (p_ptr->pclass != CLASS_BLUE_MAGE)) { @@ -3766,7 +3766,7 @@ static void do_cmd_activate_aux(int item) for (i = 0; i < max_pet; i++) { pet_ctr = who[i]; - teleport_monster_to(pet_ctr, py, px, 100, TELEPORT_PASSIVE); + teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); } /* Free the "who" array */ @@ -3837,9 +3837,9 @@ static void do_cmd_activate_aux(int item) { bool success = FALSE; if (!get_rep_dir2(&dir)) return; - if (monster_can_enter(py + ddy[dir], px + ddx[dir], &r_info[o_ptr->pval], 0)) + if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0)) { - if (place_monster_aux(0, py + ddy[dir], px + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE))) + if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE))) { if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3; if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5; diff --git a/src/defines.h b/src/defines.h index ab9fa5298..f3f5b2c9e 100644 --- a/src/defines.h +++ b/src/defines.h @@ -4055,7 +4055,7 @@ */ #define is_seen(A) \ ((bool)((A)->ml && (!ignore_unview || p_ptr->inside_battle || \ - (player_can_see_bold((A)->fy, (A)->fx) && projectable(py, px, (A)->fy, (A)->fx))))) + (player_can_see_bold((A)->fy, (A)->fx) && projectable(p_ptr->y, p_ptr->x, (A)->fy, (A)->fx))))) /*** Option Definitions ***/ @@ -4224,14 +4224,14 @@ * Determine if player is on this grid */ #define player_bold(Y,X) \ - (((Y) == py) && ((X) == px)) + (((Y) == p_ptr->y) && ((X) == p_ptr->x)) /* * Grid based version of "player_bold()" */ #define player_grid(C) \ - ((C) == &cave[py][px]) + ((C) == &cave[p_ptr->y][p_ptr->x]) #define cave_have_flag_bold(Y,X,INDEX) \ diff --git a/src/do-spell.c b/src/do-spell.c index 3af36016f..dfcb82bd8 100644 --- a/src/do-spell.c +++ b/src/do-spell.c @@ -311,11 +311,11 @@ static void cast_wonder(int dir) else if (die < 101) drain_life(dir, 100 + plev); else if (die < 104) { - earthquake(py, px, 12); + earthquake(p_ptr->y, p_ptr->x, 12); } else if (die < 106) { - (void)destroy_area(py, px, 13 + randint0(5), FALSE); + (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE); } else if (die < 108) { @@ -370,7 +370,7 @@ static void cast_invoke_spirits(int dir) msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!", "Oh no! Mouldering forms rise from the earth around you!")); - (void)summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); chg_virtue(V_UNLIFE, 1); } else if (die < 14) @@ -453,11 +453,11 @@ static void cast_invoke_spirits(int dir) } else if (die < 104) { - earthquake(py, px, 12); + earthquake(p_ptr->y, p_ptr->x, 12); } else if (die < 106) { - (void)destroy_area(py, px, 13 + randint0(5), FALSE); + (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE); } else if (die < 108) { @@ -531,7 +531,7 @@ static void wild_magic(int spell) break; case 19: case 20: - trap_creation(py, px); + trap_creation(p_ptr->y, p_ptr->x); break; case 21: case 22: @@ -543,7 +543,7 @@ static void wild_magic(int spell) aggravate_monsters(0); break; case 26: - earthquake(py, px, 5); + earthquake(p_ptr->y, p_ptr->x, 5); break; case 27: case 28: @@ -566,15 +566,15 @@ static void wild_magic(int spell) case 35: while (counter++ < 8) { - (void)summon_specific(0, py, px, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); + (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET)); } break; case 36: case 37: - activate_hi_summon(py, px, FALSE); + activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); break; case 38: - (void)summon_cyber(-1, py, px); + (void)summon_cyber(-1, p_ptr->y, p_ptr->x); break; default: { @@ -628,12 +628,12 @@ static void cast_shuffle(void) msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!")); for (i = 0; i < randint1(3); i++) - activate_hi_summon(py, px, FALSE); + activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); } else if (die < 14) { msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!")); - summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } else if (die < 18) { @@ -655,7 +655,7 @@ static void cast_shuffle(void) else if (die < 30) { msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster.")); - trump_summoning(1, FALSE, py, px, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE); + trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE); } else if (die < 33) { @@ -701,27 +701,27 @@ static void cast_shuffle(void) { msg_print(_("《塔》だ。", "It's the Tower.")); - earthquake(py, px, 5); + earthquake(p_ptr->y, p_ptr->x, 5); } else if (die < 82) { msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster.")); - trump_summoning(1, TRUE, py, px, (dun_level * 3 / 2), SUMMON_MOLD, 0L); + trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (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, py, px, (dun_level * 3 / 2), SUMMON_BAT, 0L); + trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (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, py, px, (dun_level * 3 / 2), SUMMON_VORTEX, 0L); + trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (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, py, px, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L); + trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L); } else if (die < 96) { @@ -788,18 +788,18 @@ static void cast_meteor(int dam, int rad) { int dy, dx, d; - x = px - 8 + randint0(17); - y = py - 8 + randint0(17); + x = p_ptr->x - 8 + randint0(17); + y = p_ptr->y - 8 + randint0(17); - dx = (px > x) ? (px - x) : (x - px); - dy = (py > y) ? (py - y) : (y - py); + dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x); + dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y); /* Approximate distance */ d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1)); if (d >= 9) continue; - if (!in_bounds(y, x) || !projectable(py, px, y, x) + if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x) || !cave_have_flag_bold(y, x, FF_PROJECT)) continue; /* Valid position */ @@ -829,8 +829,8 @@ static bool cast_wrath_of_the_god(int dam, int rad) if (!get_aim_dir(&dir)) return FALSE; /* Use the given direction */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) @@ -839,8 +839,8 @@ static bool cast_wrath_of_the_god(int dam, int rad) ty = target_row; } - x = px; - y = py; + x = p_ptr->x; + y = p_ptr->y; while (1) { @@ -849,10 +849,10 @@ static bool cast_wrath_of_the_god(int dam, int rad) ny = y; nx = x; - mmove2(&ny, &nx, py, px, ty, tx); + mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx); /* Stop at maximum range */ - if (MAX_RANGE <= distance(py, px, ny, nx)) break; + if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break; /* Stopped by walls/doors */ if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break; @@ -950,7 +950,7 @@ static bool cast_summon_greater_demon(void) summon_lev = plev * 2 / 3 + r_info[o_ptr->pval].level; - if (summon_specific(-1, py, px, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET))) + if (summon_specific(-1, p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET))) { msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone.")); msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'")); @@ -2207,7 +2207,7 @@ static cptr do_nature_spell(int spell, int mode) object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION)); /* Drop the object from heaven */ - drop_near(q_ptr, -1, py, px); + drop_near(q_ptr, -1, p_ptr->y, p_ptr->x); } } break; @@ -2412,7 +2412,7 @@ static cptr do_nature_spell(int spell, int mode) { if (cast) { - if (!(summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET)))) + if (!(summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET)))) { msg_print(_("動物は現れなかった。", "No animals arrive.")); } @@ -2566,7 +2566,7 @@ static cptr do_nature_spell(int spell, int mode) if (cast) { - earthquake(py, px, rad); + earthquake(p_ptr->y, p_ptr->x, rad); } } break; @@ -2584,8 +2584,8 @@ static cptr do_nature_spell(int spell, int mode) for (dir = 0; dir < 8; dir++) { - y = py + ddy_ddd[dir]; - x = px + ddx_ddd[dir]; + y = p_ptr->y + ddy_ddd[dir]; + x = p_ptr->x + ddx_ddd[dir]; c_ptr = &cave[y][x]; /* Get the monster */ @@ -2710,8 +2710,8 @@ static cptr do_nature_spell(int spell, int mode) if (cast) { dispel_monsters(d_dam); - earthquake(py, px, q_rad); - project(0, b_rad, py, px, b_dam, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1); + earthquake(p_ptr->y, p_ptr->x, q_rad); + project(0, b_rad, p_ptr->y, p_ptr->x, b_dam, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1); } } break; @@ -2951,7 +2951,7 @@ static cptr do_chaos_spell(int spell, int mode) if (cast) { msg_print(_("ドーン!部屋が揺れた!", "BOOM! Shake the room!")); - project(0, rad, py, px, dam, GF_SOUND, PROJECT_KILL | PROJECT_ITEM, -1); + project(0, rad, p_ptr->y, p_ptr->x, dam, GF_SOUND, PROJECT_KILL | PROJECT_ITEM, -1); } } break; @@ -3022,7 +3022,7 @@ static cptr do_chaos_spell(int spell, int mode) if (cast) { - destroy_area(py, px, base + randint1(sides), FALSE); + destroy_area(p_ptr->y, p_ptr->x, base + randint1(sides), FALSE); } } break; @@ -3180,7 +3180,7 @@ static cptr do_chaos_spell(int spell, int mode) else mode |= PM_NO_PET; if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP; - if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, SUMMON_DEMON, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_DEMON, mode)) { msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone.")); if (pet) @@ -3582,7 +3582,7 @@ static cptr do_death_spell(int spell, int mode) if (cast) { - project(0, rad, py, px, dam, GF_POIS, PROJECT_KILL | PROJECT_ITEM, -1); + project(0, rad, p_ptr->y, p_ptr->x, dam, GF_POIS, PROJECT_KILL | PROJECT_ITEM, -1); } } break; @@ -3670,7 +3670,7 @@ static cptr do_death_spell(int spell, int mode) { if (cast) { - animate_dead(0, py, px); + animate_dead(0, p_ptr->y, p_ptr->x); } } break; @@ -3875,7 +3875,7 @@ static cptr do_death_spell(int spell, int mode) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, type, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, type, mode)) { msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...", "Cold winds begin to blow around you, carrying with them the stench of decay...")); @@ -4051,7 +4051,7 @@ static cptr do_trump_spell(int spell, int mode) if (cast || fail) { msg_print(_("あなたは蜘蛛のカードに集中する...", "You concentrate on the trump of an spider...")); - if (trump_summoning(1, !fail, py, px, 0, SUMMON_SPIDER, PM_ALLOW_GROUP)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_SPIDER, PM_ALLOW_GROUP)) { if (fail) { @@ -4148,7 +4148,7 @@ static cptr do_trump_spell(int spell, int mode) { int type = (!fail ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL); msg_print(_("あなたは動物のカードに集中する...", "You concentrate on the trump of an animal...")); - if (trump_summoning(1, !fail, py, px, 0, type, 0L)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, type, 0L)) { if (fail) { @@ -4196,8 +4196,8 @@ static cptr do_trump_spell(int spell, int mode) else { /* Summons near player when failed */ - x = px; - y = py; + x = p_ptr->x; + y = p_ptr->y; } if (p_ptr->pclass == CLASS_BEASTMASTER) @@ -4227,7 +4227,7 @@ static cptr do_trump_spell(int spell, int mode) { int summon_lev = plev * 2 / 3 + randint1(plev / 2); - if (trump_summoning(1, !fail, py, px, (summon_lev * 3 / 2), SUMMON_PHANTOM, 0L)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, (summon_lev * 3 / 2), SUMMON_PHANTOM, 0L)) { msg_print(_("御用でございますか、御主人様?", "'Your wish, master?'")); } @@ -4356,7 +4356,7 @@ static cptr do_trump_spell(int spell, int mode) if (cast || fail) { msg_print(_("あなたはアンデッドのカードに集中する...", "You concentrate on the trump of an undead creature...")); - if (trump_summoning(1, !fail, py, px, 0, SUMMON_UNDEAD, 0L)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_UNDEAD, 0L)) { if (fail) { @@ -4375,7 +4375,7 @@ static cptr do_trump_spell(int spell, int mode) if (cast || fail) { msg_print(_("あなたは爬虫類のカードに集中する...", "You concentrate on the trump of a reptile...")); - if (trump_summoning(1, !fail, py, px, 0, SUMMON_HYDRA, 0L)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HYDRA, 0L)) { if (fail) { @@ -4400,7 +4400,7 @@ static cptr do_trump_spell(int spell, int mode) else type = 0; - if (trump_summoning((1 + (plev - 15)/ 10), !fail, py, px, 0, type, 0L)) + if (trump_summoning((1 + (plev - 15)/ 10), !fail, p_ptr->y, p_ptr->x, 0, type, 0L)) { if (fail) { @@ -4420,7 +4420,7 @@ static cptr do_trump_spell(int spell, int mode) if (cast || fail) { msg_print(_("あなたはハウンドのカードに集中する...", "You concentrate on the trump of a hound...")); - if (trump_summoning(1, !fail, py, px, 0, SUMMON_HOUND, PM_ALLOW_GROUP)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HOUND, PM_ALLOW_GROUP)) { if (fail) { @@ -4477,7 +4477,7 @@ static cptr do_trump_spell(int spell, int mode) if (cast || fail) { msg_print(_("あなたはサイバーデーモンのカードに集中する...", "You concentrate on the trump of a Cyberdemon...")); - if (trump_summoning(1, !fail, py, px, 0, SUMMON_CYBER, 0L)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_CYBER, 0L)) { if (fail) { @@ -4554,7 +4554,7 @@ static cptr do_trump_spell(int spell, int mode) if (cast || fail) { msg_print(_("あなたはドラゴンのカードに集中する...", "You concentrate on the trump of a dragon...")); - if (trump_summoning(1, !fail, py, px, 0, SUMMON_DRAGON, 0L)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_DRAGON, 0L)) { if (fail) { @@ -4590,7 +4590,7 @@ static cptr do_trump_spell(int spell, int mode) if (cast || fail) { msg_print(_("あなたはデーモンのカードに集中する...", "You concentrate on the trump of a demon...")); - if (trump_summoning(1, !fail, py, px, 0, SUMMON_DEMON, 0L)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_DEMON, 0L)) { if (fail) { @@ -4610,7 +4610,7 @@ static cptr do_trump_spell(int spell, int mode) { msg_print(_("あなたは強力なアンデッドのカードに集中する...", "You concentrate on the trump of a greater undead being...")); /* May allow unique depend on level and dice roll */ - if (trump_summoning(1, !fail, py, px, 0, SUMMON_HI_UNDEAD, PM_ALLOW_UNIQUE)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HI_UNDEAD, PM_ALLOW_UNIQUE)) { if (fail) { @@ -4637,7 +4637,7 @@ static cptr do_trump_spell(int spell, int mode) msg_print(_("あなたは古代ドラゴンのカードに集中する...", "You concentrate on the trump of an ancient dragon...")); /* May allow unique depend on level and dice roll */ - if (trump_summoning(1, !fail, py, px, 0, type, PM_ALLOW_UNIQUE)) + if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, type, PM_ALLOW_UNIQUE)) { if (fail) { @@ -5081,7 +5081,7 @@ static cptr do_arcane_spell(int spell, int mode) { if (cast) { - if (!summon_specific(-1, py, px, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET))) + if (!summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET))) { msg_print(_("エレメンタルは現れなかった。", "No Elementals arrive.")); } @@ -5596,7 +5596,7 @@ static cptr do_craft_spell(int spell, int mode) { if (cast) { - if (summon_specific(-1, py, px, plev, SUMMON_GOLEM, PM_FORCE_PET)) + if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_GOLEM, PM_FORCE_PET)) { msg_print(_("ゴーレムを作った。", "You make a golem.")); } @@ -5879,7 +5879,7 @@ static cptr do_daemon_spell(int spell, int mode) { if (cast) { - if (!summon_specific(-1, py, px, (plev * 3) / 2, SUMMON_MANES, (PM_ALLOW_GROUP | PM_FORCE_PET))) + if (!summon_specific(-1, p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_MANES, (PM_ALLOW_GROUP | PM_FORCE_PET))) { msg_print(_("古代の死霊は現れなかった。", "No Manes arrive.")); } @@ -6050,7 +6050,7 @@ static cptr do_daemon_spell(int spell, int mode) else mode |= PM_NO_PET; if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP; - if (summon_specific((pet ? -1 : 0), py, px, plev*2/3+randint1(plev/2), SUMMON_DEMON, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, plev*2/3+randint1(plev/2), SUMMON_DEMON, mode)) { msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone.")); @@ -6790,7 +6790,7 @@ static cptr do_crusade_spell(int spell, int mode) else mode |= PM_NO_PET; if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP; - if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, SUMMON_ANGEL, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_ANGEL, mode)) { if (pet) { @@ -6868,7 +6868,7 @@ static cptr do_crusade_spell(int spell, int mode) if (cast) { - destroy_area(py, px, base + randint1(sides), FALSE); + destroy_area(p_ptr->y, p_ptr->x, base + randint1(sides), FALSE); } } break; @@ -6921,7 +6921,7 @@ static cptr do_crusade_spell(int spell, int mode) if (info) return format(_("回%d/損%d+%d", "h%d/dm%d+%d"), heal, d_dam, b_dam/2); if (cast) { - project(0, 1, py, px, b_dam, GF_HOLY_FIRE, PROJECT_KILL, -1); + project(0, 1, p_ptr->y, p_ptr->x, b_dam, GF_HOLY_FIRE, PROJECT_KILL, -1); dispel_monsters(d_dam); slow_monsters(plev); stun_monsters(power); @@ -6954,7 +6954,7 @@ static cptr do_crusade_spell(int spell, int mode) while (attempt--) { - scatter(&my, &mx, py, px, 4, 0); + scatter(&my, &mx, p_ptr->y, p_ptr->x, 4, 0); /* Require empty grids */ if (cave_empty_bold2(my, mx)) break; @@ -7315,7 +7315,7 @@ static cptr do_music_spell(int spell, int mode) */ if (cont || cast) { - project(0, rad, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1); + project(0, rad, p_ptr->y, p_ptr->x, 0, GF_IDENTIFY, PROJECT_ITEM, -1); } } @@ -7408,7 +7408,7 @@ static cptr do_music_spell(int spell, int mode) if (cast) { msg_print(_("生命と復活のテーマを奏で始めた...", "The themes of life and revival are woven into your song...")); - animate_dead(0, py, px); + animate_dead(0, p_ptr->y, p_ptr->x); } } break; @@ -7460,7 +7460,7 @@ static cptr do_music_spell(int spell, int mode) */ if (cont || cast) { - project(0, 0, py, px, + project(0, 0, p_ptr->y, p_ptr->x, 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1); } } @@ -7549,7 +7549,7 @@ static cptr do_music_spell(int spell, int mode) if (cast) { msg_print(_("歌が空間を歪めた...", "Reality whirls wildly as you sing a dizzying melody...")); - project(0, rad, py, px, power, GF_AWAY_ALL, PROJECT_KILL, -1); + project(0, rad, p_ptr->y, p_ptr->x, power, GF_AWAY_ALL, PROJECT_KILL, -1); } } break; @@ -7673,7 +7673,7 @@ static cptr do_music_spell(int spell, int mode) if (cont) { - earthquake(py, px, 10); + earthquake(p_ptr->y, p_ptr->x, 10); } } @@ -7942,22 +7942,22 @@ static cptr do_hissatsu_spell(int spell, int mode) if (cdir == 8) return NULL; - y = py + ddy_cdd[cdir]; - x = px + ddx_cdd[cdir]; + y = p_ptr->y + ddy_cdd[cdir]; + x = p_ptr->x + ddx_cdd[cdir]; if (cave[y][x].m_idx) py_attack(y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); - y = py + ddy_cdd[(cdir + 7) % 8]; - x = px + ddx_cdd[(cdir + 7) % 8]; + y = p_ptr->y + ddy_cdd[(cdir + 7) % 8]; + x = p_ptr->x + ddx_cdd[(cdir + 7) % 8]; if (cave[y][x].m_idx) py_attack(y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); - y = py + ddy_cdd[(cdir + 1) % 8]; - x = px + ddx_cdd[(cdir + 1) % 8]; + y = p_ptr->y + ddy_cdd[(cdir + 1) % 8]; + x = p_ptr->x + ddx_cdd[(cdir + 1) % 8]; if (cave[y][x].m_idx) py_attack(y, x, 0); else @@ -7987,8 +7987,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_FIRE); @@ -8021,8 +8021,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_MINEUCHI); @@ -8069,8 +8069,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (!cave[y][x].m_idx) { @@ -8107,8 +8107,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_POISON); @@ -8132,8 +8132,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_ZANMA); @@ -8156,8 +8156,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, 0); @@ -8240,8 +8240,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_HAGAN); @@ -8268,8 +8268,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_COLD); @@ -8293,8 +8293,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_KYUSHO); @@ -8318,8 +8318,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_MAJIN); @@ -8343,8 +8343,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_SUTEMI); @@ -8369,8 +8369,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_ELEC); @@ -8411,8 +8411,8 @@ static cptr do_hissatsu_spell(int spell, int mode) for (dir = 0; dir < 8; dir++) { - y = py + ddy_ddd[dir]; - x = px + ddx_ddd[dir]; + y = p_ptr->y + ddy_ddd[dir]; + x = p_ptr->x + ddx_ddd[dir]; c_ptr = &cave[y][x]; /* Get the monster */ @@ -8445,13 +8445,13 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_QUAKE); else - earthquake(py, px, 10); + earthquake(p_ptr->y, p_ptr->x, 10); } break; @@ -8528,8 +8528,8 @@ static cptr do_hissatsu_spell(int spell, int mode) cave_type *c_ptr; monster_type *m_ptr; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; if (c_ptr->m_idx) @@ -8603,8 +8603,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_DRAIN); @@ -8679,8 +8679,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!tgt_pt(&x, &y)) return NULL; if (!cave_player_teleportable_bold(y, x, 0L) || - (distance(y, x, py, px) > MAX_SIGHT / 2) || - !projectable(py, px, y, x)) + (distance(y, x, p_ptr->y, p_ptr->x) > MAX_SIGHT / 2) || + !projectable(p_ptr->y, p_ptr->x, y, x)) { msg_print(_("失敗!", "You cannot move to that place!")); break; @@ -8705,8 +8705,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir(&dir, FALSE)) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) { @@ -8739,8 +8739,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (d_info[dungeon_type].flags1 & DF1_NO_MELEE) { @@ -8789,8 +8789,8 @@ static cptr do_hissatsu_spell(int spell, int mode) if (!get_rep_dir2(&dir)) return NULL; if (dir == 5) return NULL; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) py_attack(y, x, HISSATSU_UNDEAD); @@ -9078,7 +9078,7 @@ static cptr do_hex_spell(int spell, int mode) msg_print(_("我慢が解かれた!", "Time for end of patioence!")); if (power) { - project(0, rad, py, px, power, GF_HELL_FIRE, + project(0, rad, p_ptr->y, p_ptr->x, power, GF_HELL_FIRE, (PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1); } if (p_ptr->wizard) @@ -9258,7 +9258,7 @@ static cptr do_hex_spell(int spell, int mode) } if (cast || cont) { - animate_dead(0, py, px); + animate_dead(0, p_ptr->y, p_ptr->x); } break; @@ -9575,7 +9575,7 @@ static cptr do_hex_spell(int spell, int mode) } if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) || - (distance(y, x, py, px) > plev + 2)) + (distance(y, x, p_ptr->y, p_ptr->x) > plev + 2)) { msg_print(_("そこには移動できない。", "Can not teleport to there.")); continue; diff --git a/src/dungeon.c b/src/dungeon.c index 9533b7616..adb304002 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -687,7 +687,7 @@ static void pattern_teleport(void) static void wreck_the_pattern(void) { int to_ruin = 0, r_y, r_x; - int pattern_type = f_info[cave[py][px].feat].subtype; + int pattern_type = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype; if (pattern_type == PATTERN_TILE_WRECKED) { @@ -705,7 +705,7 @@ static void wreck_the_pattern(void) while (to_ruin--) { - scatter(&r_y, &r_x, py, px, 4, 0); + scatter(&r_y, &r_x, p_ptr->y, p_ptr->x, 4, 0); if (pattern_tile(r_y, r_x) && (f_info[cave[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED)) @@ -714,7 +714,7 @@ static void wreck_the_pattern(void) } } - cave_set_feat(py, px, feat_pattern_corrupted); + cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_corrupted); } /*! @@ -725,7 +725,7 @@ static bool pattern_effect(void) { int pattern_type; - if (!pattern_tile(py, px)) return FALSE; + if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE; if ((prace_is_(RACE_AMBERITE)) && (p_ptr->cut > 0) && one_in_(10)) @@ -733,7 +733,7 @@ static bool pattern_effect(void) wreck_the_pattern(); } - pattern_type = f_info[cave[py][px].feat].subtype; + pattern_type = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype; switch (pattern_type) { @@ -753,7 +753,7 @@ static bool pattern_effect(void) (void)restore_level(); (void)hp_player(1000); - cave_set_feat(py, px, feat_pattern_old); + cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old); msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful.")); /* @@ -1533,7 +1533,7 @@ static object_type *choose_cursed_obj_name(u32b flag) */ static void process_world_aux_hp_and_sp(void) { - feature_type *f_ptr = &f_info[cave[py][px].feat]; + feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat]; bool cave_no_regen = FALSE; int upkeep_factor = 0; @@ -1603,7 +1603,7 @@ static void process_world_aux_hp_and_sp(void) { if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime()) { - if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) + if ((cave[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { /* Take damage */ msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!")); @@ -1661,11 +1661,11 @@ static void process_world_aux_hp_and_sp(void) { msg_print(_("熱で火傷した!", "The heat burns you!")); take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"), - f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1); + f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name), -1); } else { - cptr name = f_name + f_info[get_feat_mimic(&cave[py][px])].name; + cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name; msg_format(_("%sで火傷した!", "The %s burns you!"), name); take_hit(DAMAGE_NOESCAPE, damage, name, -1); } @@ -2323,7 +2323,7 @@ static void process_world_aux_mutation(void) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), py, px, + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, mode)) { msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!")); @@ -2393,7 +2393,7 @@ static void process_world_aux_mutation(void) msg_print(NULL); /* Absorb light from the current possition */ - if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) + if ((cave[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { hp_player(10); } @@ -2434,7 +2434,7 @@ static void process_world_aux_mutation(void) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_ANIMAL, mode)) { msg_print(_("動物を引き寄せた!", "You have attracted an animal!")); disturb(0, 1); @@ -2514,7 +2514,7 @@ static void process_world_aux_mutation(void) if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_DRAGON, mode)) { msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!")); disturb(0, 1); @@ -2796,7 +2796,7 @@ static void process_world_aux_curse(void) /* Call animal */ if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500)) { - if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL, + if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { char o_name[MAX_NLEN]; @@ -2809,7 +2809,7 @@ static void process_world_aux_curse(void) /* Call demon */ if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111)) { - if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) + if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { char o_name[MAX_NLEN]; @@ -2821,7 +2821,7 @@ static void process_world_aux_curse(void) /* Call dragon */ if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800)) { - if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON, + if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { char o_name[MAX_NLEN]; @@ -2834,7 +2834,7 @@ static void process_world_aux_curse(void) /* Call undead */ if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111)) { - if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, + if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET))) { char o_name[MAX_NLEN]; @@ -3107,14 +3107,14 @@ static void process_world_aux_movement(void) if (p_ptr->wild_mode) { - p_ptr->wilderness_y = py; - p_ptr->wilderness_x = px; + p_ptr->wilderness_y = p_ptr->y; + p_ptr->wilderness_x = p_ptr->x; } else { /* Save player position */ - p_ptr->oldpx = px; - p_ptr->oldpy = py; + p_ptr->oldpx = p_ptr->x; + p_ptr->oldpy = p_ptr->y; } p_ptr->wild_mode = FALSE; @@ -3670,7 +3670,7 @@ static void process_world(void) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE); + if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } } @@ -4969,7 +4969,7 @@ static void pack_overflow(void) msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK)); /* Drop it (carefully) near the player */ - (void)drop_near(o_ptr, 0, py, px); + (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x); /* Modify, Describe, Optimize */ inven_item_increase(INVEN_PACK, -255); @@ -5110,8 +5110,8 @@ static void process_player(void) if (r_idx && one_in_(2)) { int y, x; - y = py+ddy[tsuri_dir]; - x = px+ddx[tsuri_dir]; + y = p_ptr->y+ddy[tsuri_dir]; + x = p_ptr->x+ddx[tsuri_dir]; if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE)) { char m_name[80]; @@ -5294,7 +5294,7 @@ static void process_player(void) handle_stuff(); /* Place the cursor on the player */ - move_cursor_relative(py, px); + move_cursor_relative(p_ptr->y, p_ptr->x); /* Refresh (optional) */ if (fresh_before) Term_fresh(); @@ -5315,7 +5315,7 @@ static void process_player(void) if (p_ptr->inside_battle) { /* Place the cursor on the player */ - move_cursor_relative(py, px); + move_cursor_relative(p_ptr->y, p_ptr->x); command_cmd = SPECIAL_KEY_BUILDING; @@ -5398,7 +5398,7 @@ static void process_player(void) else { /* Place the cursor on the player */ - move_cursor_relative(py, px); + move_cursor_relative(p_ptr->y, p_ptr->x); can_save = TRUE; /* Get a command (normal) */ @@ -5813,7 +5813,7 @@ static void dungeon(bool load_game) handle_stuff(); /* Hack -- Hilite the player */ - move_cursor_relative(py, px); + move_cursor_relative(p_ptr->y, p_ptr->x); /* Optional fresh */ if (fresh_after) Term_fresh(); @@ -5831,7 +5831,7 @@ static void dungeon(bool load_game) handle_stuff(); /* Hack -- Hilite the player */ - move_cursor_relative(py, px); + move_cursor_relative(p_ptr->y, p_ptr->x); /* Optional fresh */ if (fresh_after) Term_fresh(); @@ -5850,7 +5850,7 @@ static void dungeon(bool load_game) handle_stuff(); /* Hack -- Hilite the player */ - move_cursor_relative(py, px); + move_cursor_relative(p_ptr->y, p_ptr->x); /* Optional fresh */ if (fresh_after) Term_fresh(); @@ -6352,7 +6352,7 @@ void play_game(bool new_game) { p_ptr->wizard = TRUE; - if (p_ptr->is_dead || !py || !px) + if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x) { /* Initialize the saved floors data */ init_saved_floors(TRUE); @@ -6361,7 +6361,7 @@ void play_game(bool new_game) p_ptr->inside_quest = 0; /* Avoid crash in update_view() */ - py = px = 10; + p_ptr->y = p_ptr->x = 10; } } else if (p_ptr->is_dead) @@ -6398,14 +6398,14 @@ void play_game(bool new_game) if (p_ptr->panic_save) { /* No player? -- Try to regenerate floor */ - if (!py || !px) + if (!p_ptr->y || !p_ptr->x) { msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor.")); change_floor(); } /* Still no player? -- Try to locate random place */ - if (!py || !px) py = px = 10; + if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10; /* No longer in panic */ p_ptr->panic_save = 0; @@ -6470,7 +6470,7 @@ void play_game(bool new_game) monster_type *m_ptr; int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE); monster_race *r_ptr = &r_info[pet_r_idx]; - place_monster_aux(0, py, px - 1, 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 = &m_list[hack_m_idx_ii]; m_ptr->mspeed = r_ptr->speed; diff --git a/src/effects.c b/src/effects.c index d99155767..9855b6f86 100644 --- a/src/effects.c +++ b/src/effects.c @@ -1904,7 +1904,7 @@ bool set_superstealth(bool set) { if (!(p_ptr->special_defense & NINJA_S_STEALTH)) { - if (cave[py][px].info & CAVE_MNLT) + if (cave[p_ptr->y][p_ptr->x].info & CAVE_MNLT) { msg_print(_("敵の目から薄い影の中に覆い隠された。", "You are mantled in weak shadow from ordinary eyes.")); p_ptr->monlite = p_ptr->old_monlite = TRUE; @@ -4246,7 +4246,7 @@ void change_race(int new_race, cptr effect_msg) if (old_race != p_ptr->prace) autopick_load_pref(FALSE); /* Player's graphic tile may change */ - lite_spot(py, px); + lite_spot(p_ptr->y, p_ptr->x); } diff --git a/src/externs.h b/src/externs.h index 8fb172cd6..b840b3e39 100644 --- a/src/externs.h +++ b/src/externs.h @@ -394,8 +394,6 @@ extern bool closing_flag; extern s16b panel_row_min, panel_row_max; extern s16b panel_col_min, panel_col_max; extern s16b panel_col_prt, panel_row_prt; -extern int py; -extern int px; extern s16b target_who; extern s16b target_col; extern s16b target_row; diff --git a/src/floors.c b/src/floors.c index b04f424ad..6417b4f8d 100644 --- a/src/floors.c +++ b/src/floors.c @@ -338,11 +338,11 @@ static void build_dead_end(void) } /* Place at center of the floor */ - py = cur_hgt / 2; - px = cur_wid / 2; + p_ptr->y = cur_hgt / 2; + p_ptr->x = cur_wid / 2; /* Give one square */ - place_floor_bold(py, px); + place_floor_bold(p_ptr->y, p_ptr->x); wipe_generate_cave_flags(); } @@ -406,7 +406,7 @@ static void preserve_pet(void) } else { - int dis = distance(py, px, m_ptr->fy, m_ptr->fx); + int dis = distance(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx); /* Confused (etc.) monsters don't follow. */ if (MON_CONFUSED(m_ptr) || MON_STUNNED(m_ptr) || MON_CSLEEP(m_ptr)) continue; @@ -419,8 +419,8 @@ static void preserve_pet(void) * when you or the pet can see the other. */ if (m_ptr->nickname && - ((player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(py, px, m_ptr->fy, m_ptr->fx)) || - (los(m_ptr->fy, m_ptr->fx, py, px) && projectable(m_ptr->fy, m_ptr->fx, py, px)))) + ((player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) || + (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)))) { if (dis > 3) continue; } @@ -533,8 +533,8 @@ static void place_pet(void) p_ptr->riding = m_idx; if (m_idx) { - cy = py; - cx = px; + cy = p_ptr->y; + cx = p_ptr->x; } } else @@ -545,7 +545,7 @@ static void place_pet(void) { for (j = 1000; j > 0; j--) { - scatter(&cy, &cx, py, px, d, 0); + scatter(&cy, &cx, p_ptr->y, p_ptr->x, d, 0); if (monster_can_enter(cy, cx, &r_info[party_mon[i].r_idx], 0)) break; } if (j) break; @@ -687,8 +687,8 @@ static void get_out_monster(void) { int tries = 0; int dis = 1; - int oy = py; - int ox = px; + int oy = p_ptr->y; + int ox = p_ptr->x; int m_idx = cave[oy][ox].m_idx; /* Nothing to do if no monster */ @@ -830,8 +830,8 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr) if (sx) { /* Already fixed */ - py = sy; - px = sx; + p_ptr->y = sy; + p_ptr->x = sx; } else if (!num) { @@ -839,7 +839,7 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr) 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(cave[py][px].feat)) cave[py][px].special = 0; + if (!feat_uses_special(cave[p_ptr->y][p_ptr->x].feat)) cave[p_ptr->y][p_ptr->x].special = 0; } else { @@ -847,8 +847,8 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr) i = randint0(num); /* Point stair location */ - py = y_table[i]; - px = x_table[i]; + p_ptr->y = y_table[i]; + p_ptr->x = x_table[i]; } } @@ -951,7 +951,7 @@ void leave_floor(void) if (change_floor_mode & CFM_SAVE_FLOORS) { /* Extract stair position */ - c_ptr = &cave[py][px]; + c_ptr = &cave[p_ptr->y][p_ptr->x]; f_ptr = &f_info[c_ptr->feat]; /* Get back to old saved floor? */ @@ -1155,7 +1155,7 @@ void change_floor(void) /* Forbid return stairs */ if (change_floor_mode & CFM_NO_RETURN) { - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; if (!feat_uses_special(c_ptr->feat)) { @@ -1336,7 +1336,7 @@ void change_floor(void) if (!(change_floor_mode & CFM_NO_RETURN)) { /* Extract stair position */ - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; /*** Create connected stairs ***/ @@ -1467,7 +1467,7 @@ void stair_creation(void) } /* Artifacts resists */ - if (!cave_valid_bold(py, px)) + if (!cave_valid_bold(p_ptr->y, p_ptr->x)) { #ifdef JP msg_print("床上のアイテムが呪文を跳ね返した。"); @@ -1479,7 +1479,7 @@ void stair_creation(void) } /* Destroy all objects in the grid */ - delete_object(py, px); + delete_object(p_ptr->y, p_ptr->x); /* Extract current floor data */ sf_ptr = get_sf_ptr(p_ptr->floor_id); @@ -1551,18 +1551,18 @@ void stair_creation(void) /* Create a staircase */ if (up) { - cave_set_feat(py, px, + cave_set_feat(p_ptr->y, p_ptr->x, (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= dun_level - 2)) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair); } else { - cave_set_feat(py, px, + cave_set_feat(p_ptr->y, p_ptr->x, (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= dun_level + 2)) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair); } /* Connect this stairs to the destination */ - cave[py][px].special = dest_floor_id; + cave[p_ptr->y][p_ptr->x].special = dest_floor_id; } diff --git a/src/generate.c b/src/generate.c index 1fce8a8c9..77d289905 100644 --- a/src/generate.c +++ b/src/generate.c @@ -542,7 +542,7 @@ bool place_quest_monsters(void) if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) continue; if (!monster_can_enter(y, x, r_ptr, 0)) continue; - if (distance(y, x, py, px) < 10) continue; + if (distance(y, x, p_ptr->y, p_ptr->x) < 10) continue; if (c_ptr->info & CAVE_ICKY) continue; else break; } @@ -1205,7 +1205,7 @@ static void arena_gen(void) build_arena(); - if(!place_monster_aux(0, py + 5, px, arena_info[p_ptr->arena_number].r_idx, (PM_NO_KAGE | PM_NO_PET))) + if(!place_monster_aux(0, p_ptr->y + 5, p_ptr->x, arena_info[p_ptr->arena_number].r_idx, (PM_NO_KAGE | PM_NO_PET))) { p_ptr->exit_bldg = TRUE; p_ptr->arena_number++; @@ -1318,9 +1318,9 @@ static void battle_gen(void) for(i=0;i<4;i++) { - place_monster_aux(0, py + 8 + (i/2)*4, px - 2 + (i%2)*4, battle_mon[i], + place_monster_aux(0, p_ptr->y + 8 + (i/2)*4, p_ptr->x - 2 + (i%2)*4, battle_mon[i], (PM_NO_KAGE | PM_NO_PET)); - set_friendly(&m_list[cave[py+8+(i/2)*4][px-2+(i%2)*4].m_idx]); + set_friendly(&m_list[cave[p_ptr->y+8+(i/2)*4][p_ptr->x-2+(i%2)*4].m_idx]); } for(i = 1; i < m_max; i++) { @@ -1535,7 +1535,7 @@ void clear_cave(void) } /* Mega-Hack -- no player yet */ - px = py = 0; + p_ptr->x = p_ptr->y = 0; /* Set the base level */ base_level = dun_level; diff --git a/src/grid.c b/src/grid.c index 96e70ebca..5b5f9de79 100644 --- a/src/grid.c +++ b/src/grid.c @@ -71,8 +71,8 @@ bool new_player_spot(void) return FALSE; /* Save the new player grid */ - py = y; - px = x; + p_ptr->y = y; + p_ptr->x = x; return TRUE; } diff --git a/src/init1.c b/src/init1.c index b4781b3ae..45f7e9d94 100644 --- a/src/init1.c +++ b/src/init1.c @@ -4237,13 +4237,13 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in int y, x; /* Delete the monster (if any) */ - delete_monster(py, px); + delete_monster(p_ptr->y, p_ptr->x); y = atoi(zz[0]); x = atoi(zz[1]); - py = y; - px = x; + p_ptr->y = y; + p_ptr->x = x; } /* Place player in the town */ else if (!p_ptr->oldpx && !p_ptr->oldpy) diff --git a/src/load.c b/src/load.c index 5d46c7995..65e58dd51 100644 --- a/src/load.c +++ b/src/load.c @@ -2437,17 +2437,17 @@ static errr rd_dungeon_old(void) rd_s16b(&num_repro); rd_s16b(&tmp16s); - py = (int)tmp16s; + p_ptr->y = (int)tmp16s; rd_s16b(&tmp16s); - px = (int)tmp16s; - if (z_older_than(10, 3, 13) && !dun_level && !p_ptr->inside_arena) {py = 33;px = 131;} + p_ptr->x = (int)tmp16s; + if (z_older_than(10, 3, 13) && !dun_level && !p_ptr->inside_arena) {p_ptr->y = 33;p_ptr->x = 131;} rd_s16b(&cur_hgt); rd_s16b(&cur_wid); rd_s16b(&tmp16s); /* max_panel_rows */ rd_s16b(&tmp16s); /* max_panel_cols */ #if 0 - if (!py || !px) {py = 10;px = 10;}/* ダンジョン生成に失敗してセグメンテったときの復旧用 */ + if (!p_ptr->y || !p_ptr->x) {p_ptr->y = 10;p_ptr->x = 10;}/* ダンジョン生成に失敗してセグメンテったときの復旧用 */ #endif /* Maximal size */ @@ -2887,10 +2887,10 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr) rd_s16b(&num_repro); rd_u16b(&tmp16u); - py = (int)tmp16u; + p_ptr->y = (int)tmp16u; rd_u16b(&tmp16u); - px = (int)tmp16u; + p_ptr->x = (int)tmp16u; rd_s16b(&cur_hgt); rd_s16b(&cur_wid); diff --git a/src/main-win.c b/src/main-win.c index dceef12c3..1bc7d1995 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -3221,7 +3221,7 @@ static void windows_map(void) } /* Hilite the player */ - Term_curs_win(px - min_x, py - min_y); + Term_curs_win(p_ptr->x - min_x, p_ptr->y - min_y); /* Wait for a keypress, flush key buffer */ Term_inkey(&c, TRUE, TRUE); diff --git a/src/mane.c b/src/mane.c index 08eec982e..843de44a5 100644 --- a/src/mane.c +++ b/src/mane.c @@ -301,7 +301,7 @@ static bool use_mane(int spell) m_idx = cave[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; - if (!projectable(py, px, target_row, target_col)) break; + if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; dispel_monster_status(m_idx); break; } @@ -701,7 +701,7 @@ static bool use_mane(int spell) if (!target_set(TARGET_KILL)) return FALSE; if (!cave[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; - if (!projectable(py, px, target_row, target_col)) break; + if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; m_ptr = &m_list[cave[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); @@ -724,7 +724,7 @@ static bool use_mane(int spell) } msg_format(_("%sを引き戻した。", "You command %s to return."), m_name); - teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE); + teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: @@ -743,7 +743,7 @@ static bool use_mane(int spell) target_m_idx = cave[target_row][target_col].m_idx; if (!target_m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; - if (!projectable(py, px, target_row, target_col)) break; + if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; m_ptr = &m_list[target_m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); @@ -776,7 +776,7 @@ static bool use_mane(int spell) break; case MS_RAISE_DEAD: msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead.")); - (void)animate_dead(0, py, px); + (void)animate_dead(0, p_ptr->y, p_ptr->x); break; case MS_S_KIN: { diff --git a/src/melee1.c b/src/melee1.c index 063f87b79..4a90082c0 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -235,7 +235,7 @@ bool make_attack_normal(int m_idx) /* Stop if player is dead or gone */ if (!p_ptr->playing || p_ptr->is_dead) break; - if (distance(py, px, m_ptr->fy, m_ptr->fx) > 1) break; + if (distance(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx) > 1) break; /* Handle "leaving" */ if (p_ptr->leaving) break; @@ -1816,7 +1816,7 @@ bool make_attack_normal(int m_idx) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK); } - if (is_mirror_grid(&cave[py][px])) + if (is_mirror_grid(&cave[p_ptr->y][p_ptr->x])) { teleport_player(10, 0L); } diff --git a/src/melee2.c b/src/melee2.c index deb86885b..4c5699155 100644 --- a/src/melee2.c +++ b/src/melee2.c @@ -485,7 +485,7 @@ static bool get_moves_aux2(int m_idx, int *yp, int *xp) x1 = m_ptr->fx; /* Monster can already cast spell to player */ - if (projectable(y1, x1, py, px)) return (FALSE); + if (projectable(y1, x1, p_ptr->y, p_ptr->x)) return (FALSE); /* Set current grid cost */ now_cost = cave[y1][x1].cost; @@ -528,7 +528,7 @@ static bool get_moves_aux2(int m_idx, int *yp, int *xp) if (now_cost < cost) continue; - if (!projectable(y, x, py, px)) continue; + if (!projectable(y, x, p_ptr->y, p_ptr->x)) continue; /* Accept louder sounds */ if (best < cost) continue; @@ -605,7 +605,7 @@ static bool get_moves_aux(int m_idx, int *yp, int *xp, bool no_flow) x1 = m_ptr->fx; /* Hack -- Player can see us, run towards him */ - if (player_has_los_bold(y1, x1) && projectable(py, px, y1, x1)) return (FALSE); + if (player_has_los_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)) return (FALSE); /* Monster grid */ c_ptr = &cave[y1][x1]; @@ -620,7 +620,7 @@ static bool get_moves_aux(int m_idx, int *yp, int *xp, bool no_flow) else if (c_ptr->when) { /* Too old smell */ - if (cave[py][px].when - c_ptr->when > 127) return (FALSE); + if (cave[p_ptr->y][p_ptr->x].when - c_ptr->when > 127) return (FALSE); use_scent = TRUE; best = 0; @@ -669,8 +669,8 @@ static bool get_moves_aux(int m_idx, int *yp, int *xp, bool no_flow) } /* Hack -- Save the "twiddled" location */ - (*yp) = py + 16 * ddy_ddd[i]; - (*xp) = px + 16 * ddx_ddd[i]; + (*yp) = p_ptr->y + 16 * ddy_ddd[i]; + (*xp) = p_ptr->x + 16 * ddx_ddd[i]; } /* No legal move (?) */ @@ -957,10 +957,10 @@ static bool find_safety(int m_idx, int *yp, int *xp) } /* Check for absence of shot (more or less) */ - if (!projectable(py, px, y, x)) + if (!projectable(p_ptr->y, p_ptr->x, y, x)) { /* Calculate distance from player */ - dis = distance(y, x, py, px); + dis = distance(y, x, p_ptr->y, p_ptr->x); /* Remember if further than previous */ if (dis > gdis) @@ -1037,10 +1037,10 @@ static bool find_hiding(int m_idx, int *yp, int *xp) if (!monster_can_enter(y, x, r_ptr, 0)) continue; /* Check for hidden, available grid */ - if (!projectable(py, px, y, x) && clean_shot(fy, fx, y, x, FALSE)) + if (!projectable(p_ptr->y, p_ptr->x, y, x) && clean_shot(fy, fx, y, x, FALSE)) { /* Calculate distance from player */ - dis = distance(y, x, py, px); + dis = distance(y, x, p_ptr->y, p_ptr->x); /* Remember if closer than previous */ if (dis < gdis && dis >= 2) @@ -1082,8 +1082,8 @@ static bool get_moves(int m_idx, int *mm) monster_race *r_ptr = &r_info[m_ptr->r_idx]; int y = 0, ay, x = 0, ax; int move_val = 0; - int y2 = py; - int x2 = px; + int y2 = p_ptr->y; + int x2 = p_ptr->x; bool done = FALSE; bool will_run = mon_will_run(m_idx); cave_type *c_ptr; @@ -1110,7 +1110,7 @@ static bool get_moves(int m_idx, int *mm) if (!done && !will_run && is_hostile(m_ptr) && (r_ptr->flags1 & RF1_FRIENDS) && - ((los(m_ptr->fy, m_ptr->fx, py, px) && projectable(m_ptr->fy, m_ptr->fx, py, px)) || + ((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)) || (cave[m_ptr->fy][m_ptr->fx].dist < MAX_SIGHT / 2))) { /* @@ -1125,8 +1125,8 @@ static bool get_moves(int m_idx, int *mm) /* Count room grids next to player */ for (i = 0; i < 8; i++) { - int xx = px + ddx_ddd[i]; - int yy = py + ddy_ddd[i]; + int xx = p_ptr->x + ddx_ddd[i]; + int yy = p_ptr->y + ddy_ddd[i]; if (!in_bounds2(yy, xx)) continue; @@ -1139,7 +1139,7 @@ static bool get_moves(int m_idx, int *mm) room++; } } - if (cave[py][px].info & CAVE_ROOM) room -= 2; + if (cave[p_ptr->y][p_ptr->x].info & CAVE_ROOM) room -= 2; if (!r_ptr->flags4 && !r_ptr->flags5 && !r_ptr->flags6) room -= 2; /* Not in a room and strong player */ @@ -1160,15 +1160,15 @@ static bool get_moves(int m_idx, int *mm) for (i = 0; i < 8; i++) { /* Pick squares near player (semi-randomly) */ - y2 = py + ddy_ddd[(m_idx + i) & 7]; - x2 = px + ddx_ddd[(m_idx + i) & 7]; + y2 = p_ptr->y + ddy_ddd[(m_idx + i) & 7]; + x2 = p_ptr->x + ddx_ddd[(m_idx + i) & 7]; /* Already there? */ if ((m_ptr->fy == y2) && (m_ptr->fx == x2)) { /* Attack the player */ - y2 = py; - x2 = px; + y2 = p_ptr->y; + x2 = p_ptr->x; break; } @@ -2274,7 +2274,7 @@ static void process_monster(int m_idx) if (see_m) { if ((r_ptr->flags2 & RF2_CAN_SPEAK) && (m_ptr->r_idx != MON_GRIP) && (m_ptr->r_idx != MON_WOLF) && (m_ptr->r_idx != MON_FANG) && - player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(m_ptr->fy, m_ptr->fx, py, px)) + player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) { msg_format(_("%^s「ピンチだ!退却させてもらう!」", "%^s says 'It is the pinch! I will retreat'."), m_name); } @@ -2458,7 +2458,7 @@ static void process_monster(int m_idx) if ((ap_r_ptr->flags2 & RF2_CAN_SPEAK) && aware && one_in_(SPEAK_CHANCE) && player_has_los_bold(oy, ox) && - projectable(oy, ox, py, px)) + projectable(oy, ox, p_ptr->y, p_ptr->x)) { char m_name[80]; char monmessage[1024]; @@ -3119,7 +3119,7 @@ static void process_monster(int m_idx) /* Possible disturb */ if (m_ptr->ml && (disturb_move || - (disturb_near && (m_ptr->mflag & MFLAG_VIEW) && projectable(py, px, m_ptr->fy, m_ptr->fx)) || + (disturb_near && (m_ptr->mflag & MFLAG_VIEW) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) || (disturb_high && ap_r_ptr->r_tkills && ap_r_ptr->level >= p_ptr->lev))) { /* Disturb */ @@ -3508,12 +3508,12 @@ void process_monsters(void) test = TRUE; } -#if 0 /* (cave[py][px].when == cave[fy][fx].when) is always FALSE... */ +#if 0 /* (cave[p_ptr->y][p_ptr->x].when == cave[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(py, px, FF_MOVE) && - (cave[py][px].when == cave[fy][fx].when) && + cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_MOVE) && + (cave[p_ptr->y][p_ptr->x].when == cave[fy][fx].when) && (cave[fy][fx].dist < MONSTER_FLOW_DEPTH) && (cave[fy][fx].dist < r_ptr->aaf)) { @@ -4333,7 +4333,7 @@ bool process_the_world(int num, int who, bool vs_player) p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); world_monster = 0; - if (vs_player || (player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(py, px, m_ptr->fy, m_ptr->fx))) + if (vs_player || (player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx))) { msg_print(_("「時は動きだす…」", "You feel time flowing around you once more.")); msg_print(NULL); diff --git a/src/mind.c b/src/mind.c index 7f56dd50a..8a4089435 100644 --- a/src/mind.c +++ b/src/mind.c @@ -893,7 +893,7 @@ static bool cast_mindcrafter_spell(int spell) msg_print(_("精神を捻じ曲げる波動を発生させた!", "Mind-warping forces emanate from your brain!")); if (plev < 25) - project(0, 2 + plev / 10, py, px, + project(0, 2 + plev / 10, p_ptr->y, p_ptr->x, (plev * 3), GF_PSI, PROJECT_KILL, -1); else (void)mindblast_monsters(randint1(plev * ((plev - 5) / 10 + 1))); @@ -1030,8 +1030,8 @@ static bool cast_force_spell(int spell) project_length = 1; if (!get_aim_dir(&dir)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8); fire_beam(GF_MISSILE, dir, dam); if (cave[y][x].m_idx) @@ -1094,7 +1094,7 @@ static bool cast_force_spell(int spell) m_idx = cave[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; - if (!projectable(py, px, target_row, target_col)) break; + if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; dispel_monster_status(m_idx); break; } @@ -1104,7 +1104,7 @@ static bool cast_force_spell(int spell) bool success = FALSE; for (i = 0; i < 1 + boost/100; i++) - if (summon_specific(-1, py, px, plev, SUMMON_PHANTOM, PM_FORCE_PET)) + if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_PHANTOM, PM_FORCE_PET)) success = TRUE; if (success) { @@ -1171,7 +1171,7 @@ static bool cast_mirror_spell(int spell) { /* mirror of seeing */ case 0: - tmp = is_mirror_grid(&cave[py][px]) ? 4 : 0; + tmp = is_mirror_grid(&cave[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(plev,FALSE); @@ -1191,7 +1191,7 @@ static bool cast_mirror_spell(int spell) break; case 2: if (!get_aim_dir(&dir)) return FALSE; - if ( plev > 9 && is_mirror_grid(&cave[py][px]) ) { + if ( plev > 9 && is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ) { fire_beam(GF_LITE, dir,damroll(3+((plev-1)/5),4)); } else { @@ -1258,7 +1258,7 @@ static bool cast_mirror_spell(int spell) break; /* illusion light */ case 14: - tmp = is_mirror_grid(&cave[py][px]) ? 4 : 3; + tmp = is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ? 4 : 3; slow_monsters(plev); stun_monsters(plev*tmp); confuse_monsters(plev*tmp); @@ -1268,7 +1268,7 @@ static bool cast_mirror_spell(int spell) break; /* mirror shift */ case 15: - if( !is_mirror_grid(&cave[py][px]) ){ + if( !is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) ){ msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!")); break; } @@ -1331,8 +1331,8 @@ static bool cast_berserk_spell(int spell) if (!get_rep_dir2(&dir)) return FALSE; if (dir == 5) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (!cave[y][x].m_idx) { @@ -1360,16 +1360,16 @@ static bool cast_berserk_spell(int spell) case 2: { if (!get_rep_dir2(&dir)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; move_player(dir, easy_disarm, TRUE); break; } case 3: - earthquake(py, px, 8+randint0(5)); + earthquake(p_ptr->y, p_ptr->x, 8+randint0(5)); break; case 4: - massacre(py, px); + massacre(p_ptr->y, p_ptr->x); break; default: msg_print(_("なに?", "Zap?")); @@ -1436,8 +1436,8 @@ static bool cast_ninja_spell(int spell) case 5: { if (!get_rep_dir(&dir, FALSE)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) { py_attack(y, x, 0); @@ -1516,11 +1516,11 @@ static bool cast_ninja_spell(int spell) if (!m_idx) break; if (m_idx == p_ptr->riding) break; if (!player_has_los_bold(target_row, target_col)) break; - if (!projectable(py, px, target_row, target_col)) break; + if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; m_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, py, px, 0); + path_n = project_path(path_g, MAX_RANGE, target_row, target_col, p_ptr->y, p_ptr->x, 0); ty = target_row, tx = target_col; for (i = 1; i < path_n; i++) { @@ -1612,7 +1612,7 @@ static bool cast_ninja_spell(int spell) while (attempts--) { - scatter(&y, &x, py, px, 4, 0); + scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0); if (!player_bold(y, x)) break; } @@ -1804,7 +1804,7 @@ void do_cmd_mind(void) /* Mana storm */ msg_format(_("%sの力が制御できない氾流となって解放された!", "Your mind unleashes its power in an uncontrollable storm!"), p); - project(PROJECT_WHO_UNCTRL_POWER, 2 + plev / 10, py, px, plev * 2, + project(PROJECT_WHO_UNCTRL_POWER, 2 + plev / 10, p_ptr->y, p_ptr->x, plev * 2, GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1); p_ptr->csp = MAX(0, p_ptr->csp - plev * MAX(1, plev / 10)); } @@ -1829,7 +1829,7 @@ void do_cmd_mind(void) /* Mana storm */ msg_format(_("%sの力が制御できない氾流となって解放された!", "Your mind unleashes its power in an uncontrollable storm!"), p); - project(PROJECT_WHO_UNCTRL_POWER, 2 + plev / 10, py, px, plev * 2, + project(PROJECT_WHO_UNCTRL_POWER, 2 + plev / 10, p_ptr->y, p_ptr->x, plev * 2, GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1); p_ptr->csp = MAX(0, p_ptr->csp - plev * MAX(1, plev / 10)); } @@ -1857,7 +1857,7 @@ void do_cmd_mind(void) break; case MIND_MIRROR_MASTER: /* Cast the spell */ - if( is_mirror_grid(&cave[py][px]) )on_mirror = TRUE; + if( is_mirror_grid(&cave[p_ptr->y][p_ptr->x]) )on_mirror = TRUE; cast = cast_mirror_spell(n); break; case MIND_NINJUTSU: diff --git a/src/monster2.c b/src/monster2.c index c77b85003..4e548e740 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -2382,8 +2382,8 @@ void update_mon(int m_idx, bool full) if (full) { /* Distance components */ - int dy = (py > fy) ? (py - fy) : (fy - py); - int dx = (px > fx) ? (px - fx) : (fx - px); + int dy = (p_ptr->y > fy) ? (p_ptr->y - fy) : (fy - p_ptr->y); + int dx = (p_ptr->x > fx) ? (p_ptr->x - fx) : (fx - p_ptr->x); /* Approximate distance */ d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1)); @@ -2662,7 +2662,7 @@ void update_mon(int m_idx, bool full) } /* Disturb on appearance */ - if (disturb_near && (projectable(m_ptr->fy, m_ptr->fx, py, px) && projectable(py, px, m_ptr->fy, m_ptr->fx))) + if (disturb_near && (projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx))) { if (disturb_pets || is_hostile(m_ptr)) disturb(1, 1); @@ -3958,7 +3958,7 @@ bool alloc_monster(int dis, u32b mode) } /* Accept far away grids */ - if (distance(y, x, py, px) > dis) break; + if (distance(y, x, p_ptr->y, p_ptr->x) > dis) break; } if (!attempts_left) @@ -4643,8 +4643,8 @@ bool player_place(int y, int x) if (cave[y][x].m_idx != 0) return FALSE; /* Save player location */ - py = y; - px = x; + p_ptr->y = y; + p_ptr->x = x; /* Success */ return TRUE; diff --git a/src/mspells1.c b/src/mspells1.c index 6f8511a2a..0db63423c 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -1209,7 +1209,7 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num) } /* Player is close and we have attack spells, blink away */ - if ((distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster) + if ((distance(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster) { /* Choose tactical spell */ if (tactic_num) return (tactic[randint0(tactic_num)]); @@ -1348,9 +1348,9 @@ static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp, {-1, 0, 1, -1, 1, -1, 0, 1}, { 1, 0, -1, 1, -1, 1, 0, -1}}; - if (m_ptr->fy < py && m_ptr->fx < px) tonari = 0; - else if (m_ptr->fy < py) tonari = 1; - else if (m_ptr->fx < px) tonari = 2; + if (m_ptr->fy < p_ptr->y && m_ptr->fx < p_ptr->x) tonari = 0; + else if (m_ptr->fy < p_ptr->y) tonari = 1; + else if (m_ptr->fx < p_ptr->x) tonari = 2; else tonari = 3; for (i = 0; i < 8; i++) @@ -1455,8 +1455,8 @@ bool make_attack_spell(int m_idx) int dam = 0; /* Target location */ - int x = px; - int y = py; + int x = p_ptr->x; + int y = p_ptr->y; /* Target location for lite breath */ int x_br_lite = 0; @@ -1685,7 +1685,7 @@ bool make_attack_spell(int m_idx) if (((f4 & RF4_BOLT_MASK) || (f5 & RF5_BOLT_MASK) || (f6 & RF6_BOLT_MASK)) && - !clean_shot(m_ptr->fy, m_ptr->fx, py, px, FALSE)) + !clean_shot(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x, FALSE)) { /* Remove spells that will only hurt friends */ f4 &= ~(RF4_BOLT_MASK); diff --git a/src/mspells2.c b/src/mspells2.c index 6d5de6377..a8e31f735 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -147,17 +147,17 @@ static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool if (flg & PROJECT_DISI) { if (in_disintegration_range(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE; - if (in_disintegration_range(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE; + if (in_disintegration_range(y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE; } else if (flg & PROJECT_LOS) { if (los(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE; - if (los(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE; + if (los(y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE; } else { if (projectable(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE; - if (projectable(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE; + if (projectable(y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE; } } else @@ -482,9 +482,9 @@ bool monst_spell_monst(int m_idx) get_project_point(m_ptr->fy, m_ptr->fx, &real_y, &real_x, 0L); - if (projectable(real_y, real_x, py, px)) + if (projectable(real_y, real_x, p_ptr->y, p_ptr->x)) { - int dist = distance(real_y, real_x, py, px); + int dist = distance(real_y, real_x, p_ptr->y, p_ptr->x); if (dist <= 2) { @@ -501,7 +501,7 @@ bool monst_spell_monst(int m_idx) } else if (f5 & RF5_BA_LITE) { - if ((distance(real_y, real_x, py, px) <= 4) && los(real_y, real_x, py, px)) + if ((distance(real_y, real_x, p_ptr->y, p_ptr->x) <= 4) && los(real_y, real_x, p_ptr->y, p_ptr->x)) f5 &= ~(RF5_BA_LITE); } } @@ -512,7 +512,7 @@ bool monst_spell_monst(int m_idx) int real_x = x; get_project_point(m_ptr->fy, m_ptr->fx, &real_y, &real_x, PROJECT_STOP); - if (projectable(real_y, real_x, py, px) && (distance(real_y, real_x, py, px) <= 2)) + if (projectable(real_y, real_x, p_ptr->y, p_ptr->x) && (distance(real_y, real_x, p_ptr->y, p_ptr->x) <= 2)) f4 &= ~(RF4_ROCKET); } diff --git a/src/mspells3.c b/src/mspells3.c index ebd275558..96ac753fd 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -643,7 +643,7 @@ static bool cast_learned_spell(int spell, bool success) m_idx = cave[target_row][target_col].m_idx; if (!m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; - if (!projectable(py, px, target_row, target_col)) break; + if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; dispel_monster_status(m_idx); break; } @@ -1100,7 +1100,7 @@ static bool cast_learned_spell(int spell, bool success) if (!target_set(TARGET_KILL)) return FALSE; if (!cave[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; - if (!projectable(py, px, target_row, target_col)) break; + if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; m_ptr = &m_list[cave[target_row][target_col].m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); @@ -1120,7 +1120,7 @@ static bool cast_learned_spell(int spell, bool success) } } msg_format(_("%sを引き戻した。", "You command %s to return."), m_name); - teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TELEPORT_PASSIVE); + teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE); break; } case MS_TELE_AWAY: @@ -1139,7 +1139,7 @@ static bool cast_learned_spell(int spell, bool success) target_m_idx = cave[target_row][target_col].m_idx; if (!target_m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; - if (!projectable(py, px, target_row, target_col)) break; + if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break; m_ptr = &m_list[target_m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); @@ -1176,7 +1176,7 @@ static bool cast_learned_spell(int spell, bool success) break; case MS_RAISE_DEAD: msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead.")); - (void)animate_dead(0, py, px); + (void)animate_dead(0, p_ptr->y, p_ptr->x); break; case MS_S_KIN: { @@ -1185,7 +1185,7 @@ static bool cast_learned_spell(int spell, bool success) msg_print(_("援軍を召喚した。", "You summon minions.")); for (k = 0;k < 1; k++) { - if (summon_kin_player(summon_lev, py, px, (pet ? PM_FORCE_PET : 0L))) + if (summon_kin_player(summon_lev, p_ptr->y, p_ptr->x, (pet ? PM_FORCE_PET : 0L))) { if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!")); } @@ -1202,7 +1202,7 @@ static bool cast_learned_spell(int spell, bool success) msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!")); for (k = 0 ;k < 1 ; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_CYBER, p_mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_CYBER, p_mode)) { if (!pet) msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!")); @@ -1218,7 +1218,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("仲間を召喚した。", "You summon help.")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, p_mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, p_mode)) { if (!pet) msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!")); @@ -1234,7 +1234,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("モンスターを召喚した!", "You summon monsters!")); for (k = 0;k < plev / 15 + 2; k++) - if(summon_specific((pet ? -1 : 0), py, px, summon_lev, 0, (p_mode | u_mode))) + if(summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, (p_mode | u_mode))) { if (!pet) msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!")); @@ -1250,7 +1250,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("アリを召喚した。", "You summon ants.")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!")); @@ -1266,7 +1266,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("蜘蛛を召喚した。", "You summon spiders.")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!")); @@ -1282,7 +1282,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("ハウンドを召喚した。", "You summon hounds.")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode))) { if (!pet) msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!")); @@ -1298,7 +1298,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("ヒドラを召喚した。", "You summon a hydras.")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HYDRA, (g_mode | p_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!")); @@ -1314,7 +1314,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("天使を召喚した!", "You summon an angel!")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_ANGEL, (g_mode | p_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!")); @@ -1330,7 +1330,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DEMON, (g_mode | p_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!")); @@ -1346,7 +1346,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!")); @@ -1362,7 +1362,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("ドラゴンを召喚した!", "You summon a dragon!")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_DRAGON, (g_mode | p_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode))) { if (!pet) msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!")); @@ -1378,7 +1378,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode))) { if (!pet) msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!")); @@ -1394,7 +1394,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode))) { if (!pet) msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!")); @@ -1410,7 +1410,7 @@ static bool cast_learned_spell(int spell, bool success) int k; msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode))) { if (!pet) msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!")); @@ -1426,14 +1426,14 @@ static bool cast_learned_spell(int spell, bool success) int k, count = 0; msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!")); for (k = 0;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE))) { count++; if (!pet) msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!")); } for (k = count;k < 1; k++) - if (summon_specific((pet ? -1 : 0), py, px, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE))) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE))) { count++; if (!pet) diff --git a/src/mutation.c b/src/mutation.c index 81065c48a..cad1f44c6 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -2149,8 +2149,8 @@ bool mutation_power_aux(u32b power) /* Only works on adjacent monsters */ if (!get_rep_dir2(&dir)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; mutation_stop_mouth(); @@ -2210,8 +2210,8 @@ bool mutation_power_aux(u32b power) feature_type *f_ptr, *mimic_f_ptr; if (!get_rep_dir2(&dir)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; f_ptr = &f_info[c_ptr->feat]; mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)]; @@ -2326,7 +2326,7 @@ bool mutation_power_aux(u32b power) int i; for (i = 0; i < 8; i++) { - summon_specific(-1, py, px, lvl, SUMMON_MOLD, PM_FORCE_PET); + summon_specific(-1, p_ptr->y, p_ptr->x, lvl, SUMMON_MOLD, PM_FORCE_PET); } } break; @@ -2365,7 +2365,7 @@ bool mutation_power_aux(u32b power) break; case MUT1_EARTHQUAKE: - (void)earthquake(py, px, 10); + (void)earthquake(p_ptr->y, p_ptr->x, 10); break; case MUT1_EAT_MAGIC: @@ -2394,8 +2394,8 @@ bool mutation_power_aux(u32b power) int x, y; if (!get_rep_dir2(&dir)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) { py_attack(y, x, 0); @@ -2435,8 +2435,8 @@ bool mutation_power_aux(u32b power) monster_race *r_ptr; if (!get_rep_dir2(&dir)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; if (!c_ptr->m_idx) @@ -2484,8 +2484,8 @@ bool mutation_power_aux(u32b power) cave_type *c_ptr; if (!get_rep_dir2(&dir)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; if (!c_ptr->m_idx) diff --git a/src/object1.c b/src/object1.c index 3e58ec33f..27a517f3b 100644 --- a/src/object1.c +++ b/src/object1.c @@ -2656,7 +2656,7 @@ bool can_get_item(void) if (item_tester_okay(&inventory[j])) return TRUE; - floor_num = scan_floor(floor_list, py, px, 0x03); + floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03); if (floor_num) return TRUE; @@ -2906,7 +2906,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode) if (floor) { /* Scan all objects in the grid */ - for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; @@ -3285,7 +3285,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode) if (allow_floor) { /* Scan all objects in the grid */ - for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; @@ -3815,7 +3815,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode) if (prev_tag && command_cmd) { /* Scan all objects in the grid */ - floor_num = scan_floor(floor_list, py, px, 0x03); + floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03); /* Look up the tag */ if (get_tag_floor(&k, prev_tag, floor_list, floor_num)) @@ -3953,7 +3953,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode) if (floor) { /* Scan all objects in the grid */ - floor_num = scan_floor(floor_list, py, px, 0x03); + floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03); } /* Accept inventory */ @@ -4096,7 +4096,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode) n2 = I2A(k - floor_top); /* Redraw if needed */ - if (command_see) get_item_label = show_floor(menu_line, py, px, &min_width); + if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width); } /* Viewing inventory */ @@ -4527,7 +4527,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode) case '+': { int i, o_idx; - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; if (command_wrk != (USE_FLOOR)) break; @@ -4549,7 +4549,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode) o_list[i].next_o_idx = o_idx; /* Re-scan floor list */ - floor_num = scan_floor(floor_list, py, px, 0x03); + floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03); /* Hack -- Fix screen */ if (command_see) @@ -5027,7 +5027,7 @@ void py_pickup_floor(bool pickup) int can_pickup = 0; /* Scan the pile of objects */ - for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; diff --git a/src/object2.c b/src/object2.c index 2ad34a140..034b5b8c1 100644 --- a/src/object2.c +++ b/src/object2.c @@ -397,7 +397,7 @@ void compact_objects(int size) } /* Nearby objects start out "immune" */ - if ((cur_dis > 0) && (distance(py, px, y, x) < cur_dis)) continue; + if ((cur_dis > 0) && (distance(p_ptr->y, p_ptr->x, y, x) < cur_dis)) continue; /* Saving throw */ chance = 90; @@ -6465,7 +6465,7 @@ void inven_drop(int item, int amt) msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(item)); /* Drop it near the player */ - (void)drop_near(q_ptr, 0, py, px); + (void)drop_near(q_ptr, 0, p_ptr->y, p_ptr->x); /* Modify, Describe, Optimize */ inven_item_increase(item, -amt); diff --git a/src/racial.c b/src/racial.c index 152f1fd00..5ee756b8f 100644 --- a/src/racial.c +++ b/src/racial.c @@ -94,8 +94,8 @@ static bool do_cmd_archer(void) cave_type *c_ptr; if (!get_rep_dir(&dir, FALSE)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_CAN_DIG)) @@ -780,8 +780,8 @@ static bool cmd_racial_power_aux(s32b command) for (i = 0; i < 6; i++) { dir = randint0(8); - y = py + ddy_ddd[dir]; - x = px + ddx_ddd[dir]; + y = p_ptr->y + ddy_ddd[dir]; + x = p_ptr->x + ddx_ddd[dir]; c_ptr = &cave[y][x]; /* Hack -- attack monsters */ @@ -827,8 +827,8 @@ static bool cmd_racial_power_aux(s32b command) int x, y; if (!get_rep_dir(&dir, FALSE)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) { py_attack(y, x, 0); @@ -928,8 +928,8 @@ static bool cmd_racial_power_aux(s32b command) int x, y; if (!get_rep_dir(&dir, FALSE)) return FALSE; - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; if (cave[y][x].m_idx) { if (one_in_(2)) @@ -1167,7 +1167,7 @@ static bool cmd_racial_power_aux(s32b command) msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now.")); return FALSE; } - if (is_mirror_grid(&cave[py][px])) + if (is_mirror_grid(&cave[p_ptr->y][p_ptr->x])) { msg_print(_("少し頭がハッキリした。", "You feel your head clear a little.")); @@ -1196,7 +1196,7 @@ static bool cmd_racial_power_aux(s32b command) } else { - cave_type *c_ptr = &cave[py][px]; + cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x]; feature_type *f_ptr = &f_info[c_ptr->feat]; if (!have_flag(f_ptr->flags, FF_PROJECT) || @@ -1249,8 +1249,8 @@ static bool cmd_racial_power_aux(s32b command) /* Only works on adjacent monsters */ if (!get_rep_dir(&dir, FALSE)) return FALSE; /* was get_aim_dir */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; ratial_stop_mouth(); @@ -1310,7 +1310,7 @@ static bool cmd_racial_power_aux(s32b command) object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION)); /* Drop the object from heaven */ - (void)drop_near(q_ptr, -1, py, px); + (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x); msg_print(_("食事を料理して作った。", "You cook some food.")); } break; @@ -1603,8 +1603,8 @@ static bool cmd_racial_power_aux(s32b command) /* Only works on adjacent monsters */ if (!get_rep_dir(&dir,FALSE)) return FALSE; /* was get_aim_dir */ - y = py + ddy[dir]; - x = px + ddx[dir]; + y = p_ptr->y + ddy[dir]; + x = p_ptr->x + ddx[dir]; c_ptr = &cave[y][x]; ratial_stop_mouth(); diff --git a/src/save.c b/src/save.c index 28d57e8e2..81f788789 100644 --- a/src/save.c +++ b/src/save.c @@ -947,8 +947,8 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) wr_u16b(base_level); wr_u16b(num_repro); - wr_u16b((u16b)py); - wr_u16b((u16b)px); + wr_u16b((u16b)p_ptr->y); + wr_u16b((u16b)p_ptr->x); wr_u16b(cur_hgt); wr_u16b(cur_wid); wr_byte(p_ptr->feeling); diff --git a/src/spells1.c b/src/spells1.c index a7d9b7f14..894aef0ef 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -2355,7 +2355,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b if (seen) obvious = TRUE; /* PSI only works if the monster can see you! -- RG */ - if (!(los(m_ptr->fy, m_ptr->fx, py, px))) + if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))) { if (seen_msg) msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name); @@ -5038,7 +5038,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b if (pet) mode |= PM_FORCE_PET; else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY); - count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : 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) : dun_level), 0, mode); if (!one_in_(6)) break; } case 23: case 24: case 25: @@ -5137,7 +5137,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b q_ptr->ident |= (IDENT_MENTAL); /* Drop it in the dungeon */ - (void)drop_near(q_ptr, -1, py, px); + (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x); } /* Track it */ @@ -5236,7 +5236,7 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int t_x = m_list[who].fx - 1 + randint1(3); max_attempts--; } - while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x)); + while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x)); if (max_attempts < 1) { @@ -5246,8 +5246,8 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int } else { - t_y = py - 1 + randint1(3); - t_x = px - 1 + randint1(3); + t_y = p_ptr->y - 1 + randint1(3); + t_x = p_ptr->x - 1 + randint1(3); } project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell); @@ -6835,8 +6835,8 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons rakubadam_m = 0; /* Default target of monsterspell is player */ - monster_target_y=py; - monster_target_x=px; + monster_target_y=p_ptr->y; + monster_target_x=p_ptr->x; /* Hack -- Jump to target */ if (flg & (PROJECT_JUMP)) @@ -6853,8 +6853,8 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons /* Start at player */ else if (who <= 0) { - x1 = px; - y1 = py; + x1 = p_ptr->x; + y1 = p_ptr->y; } /* Start at monster */ @@ -7478,7 +7478,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons if (flg & PROJECT_KILL) { see_s_msg = (who > 0) ? is_seen(&m_list[who]) : - (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(py, px, y1, x1))); + (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1))); } @@ -7858,18 +7858,18 @@ bool binding_field( int dam ) int point_y[3]; /* Default target of monsterspell is player */ - monster_target_y=py; - monster_target_x=px; + monster_target_y=p_ptr->y; + monster_target_x=p_ptr->x; for( x=0 ; x < cur_wid ; x++ ) { for( y=0 ; y < cur_hgt ; y++ ) { if( is_mirror_grid(&cave[y][x]) && - distance(py,px,y,x) <= MAX_RANGE && - distance(py,px,y,x) != 0 && + 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) && - projectable(py, px, y, x) + projectable(p_ptr->y, p_ptr->x, y, x) ){ mirror_y[mirror_num]=y; mirror_x[mirror_num]=x; @@ -7890,8 +7890,8 @@ bool binding_field( int dam ) point_x[0]=mirror_x[point_x[0]]; point_y[1]=mirror_y[point_x[1]]; point_x[1]=mirror_x[point_x[1]]; - point_y[2]=py; - point_x[2]=px; + point_y[2]=p_ptr->y; + point_x[2]=p_ptr->x; x=point_x[0]+point_x[1]+point_x[2]; y=point_y[0]+point_y[1]+point_y[2]; @@ -7919,7 +7919,7 @@ bool binding_field( int dam ) centersign*( (point_x[2]-x)*(point_y[0]-y) -(point_y[2]-y)*(point_x[0]-x)) >=0 ) { - if (player_has_los_bold(y, x) && projectable(py, px, y, x)) { + if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) { /* Visual effects */ if(!(p_ptr->blind) && panel_contains(y,x)){ @@ -7942,7 +7942,7 @@ bool binding_field( int dam ) centersign*( (point_x[2]-x)*(point_y[0]-y) -(point_y[2]-y)*(point_x[0]-x)) >=0 ) { - if (player_has_los_bold(y, x) && projectable(py, px, y, x)) { + if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) { (void)project_f(0,0,y,x,dam,GF_MANA); } } @@ -7957,7 +7957,7 @@ bool binding_field( int dam ) centersign*( (point_x[2]-x)*(point_y[0]-y) -(point_y[2]-y)*(point_x[0]-x)) >=0 ) { - if (player_has_los_bold(y, x) && projectable(py, px, y, x)) { + if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) { (void)project_o(0,0,y,x,dam,GF_MANA); } } @@ -7972,7 +7972,7 @@ bool binding_field( int dam ) centersign*( (point_x[2]-x)*(point_y[0]-y) -(point_y[2]-y)*(point_x[0]-x)) >=0 ) { - if (player_has_los_bold(y, x) && projectable(py, px, y, x)) { + if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) { (void)project_m(0,0,y,x,dam,GF_MANA, (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE); } diff --git a/src/spells2.c b/src/spells2.c index c04b47d67..3d644aef4 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -1834,7 +1834,7 @@ static bool detect_feat_flag(int range, int flag, bool known) { for (x = 1; x <= cur_wid - 1; x++) { - int dist = distance(py, px, y, x); + int dist = distance(p_ptr->y, p_ptr->x, y, x); if (dist > range) continue; /* Access the grid */ @@ -1999,7 +1999,7 @@ bool detect_objects_gold(int range) x = o_ptr->ix; /* Only detect nearby objects */ - if (distance(py, px, y, x) > range2) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue; /* Detect "gold" objects */ if (o_ptr->tval == TV_GOLD) @@ -2063,7 +2063,7 @@ bool detect_objects_normal(int range) x = o_ptr->ix; /* Only detect nearby objects */ - if (distance(py, px, y, x) > range2) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue; /* Detect "real" objects */ if (o_ptr->tval != TV_GOLD) @@ -2134,7 +2134,7 @@ bool detect_objects_magic(int range) x = o_ptr->ix; /* Only detect nearby objects */ - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; /* Examine the tval */ tv = o_ptr->tval; @@ -2214,7 +2214,7 @@ bool detect_monsters_normal(int range) x = m_ptr->fx; /* Only detect nearby monsters */ - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; /* Detect all non-invisible monsters */ if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv) @@ -2273,7 +2273,7 @@ bool detect_monsters_invis(int range) x = m_ptr->fx; /* Only detect nearby monsters */ - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; /* Detect invisible monsters */ if (r_ptr->flags2 & RF2_INVISIBLE) @@ -2338,7 +2338,7 @@ bool detect_monsters_evil(int range) x = m_ptr->fx; /* Only detect nearby monsters */ - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; /* Detect evil monsters */ if (r_ptr->flags3 & RF3_EVIL) @@ -2407,7 +2407,7 @@ bool detect_monsters_nonliving(int range) x = m_ptr->fx; /* Only detect nearby monsters */ - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; /* Detect non-living monsters */ if (!monster_living(r_ptr)) @@ -2470,7 +2470,7 @@ bool detect_monsters_mind(int range) x = m_ptr->fx; /* Only detect nearby monsters */ - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; /* Detect non-living monsters */ if (!(r_ptr->flags2 & RF2_EMPTY_MIND)) @@ -2535,7 +2535,7 @@ bool detect_monsters_string(int range, cptr Match) x = m_ptr->fx; /* Only detect nearby monsters */ - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; /* Detect monsters with the same symbol */ if (my_strchr(Match, r_ptr->d_char)) @@ -2602,7 +2602,7 @@ bool detect_monsters_xxx(int range, u32b match_flag) x = m_ptr->fx; /* Only detect nearby monsters */ - if (distance(py, px, y, x) > range) continue; + if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue; /* Detect evil monsters */ if (r_ptr->flags3 & (match_flag)) @@ -2717,7 +2717,7 @@ bool project_hack(int typ, int dam) x = m_ptr->fx; /* Require line of sight */ - if (!player_has_los_bold(y, x) || !projectable(py, px, y, x)) continue; + if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue; /* Mark the monster */ m_ptr->mflag |= (MFLAG_TEMP); @@ -3001,7 +3001,7 @@ bool genocide_aux(int m_idx, int power, bool player_cast, int dam_side, cptr spe } /* Visual feedback */ - move_cursor_relative(py, px); + move_cursor_relative(p_ptr->y, p_ptr->x); /* Redraw */ p_ptr->redraw |= (PR_HP); @@ -3592,7 +3592,7 @@ bool destroy_area(int y1, int x1, int r, bool in_generate) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE); + if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } @@ -3701,8 +3701,8 @@ bool earthquake_aux(int cy, int cx, int r, int m_idx) for (i = 0; i < 8; i++) { /* Access the location */ - y = py + ddy_ddd[i]; - x = px + ddx_ddd[i]; + y = p_ptr->y + ddy_ddd[i]; + x = p_ptr->x + ddx_ddd[i]; /* Skip non-empty grids */ if (!cave_empty_bold(y, x)) continue; @@ -3783,7 +3783,7 @@ bool earthquake_aux(int cy, int cx, int r, int m_idx) } /* Important -- no wall on player */ - map[16+py-cy][16+px-cx] = FALSE; + map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE; /* Take some damage */ if (damage) @@ -4076,7 +4076,7 @@ bool earthquake_aux(int cy, int cx, int r, int m_idx) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE); + if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } /* Success */ @@ -4425,7 +4425,7 @@ static void cave_temp_room_aux(int y, int x, bool only_room, bool (*pass_bold)(i if (!in_bounds2(y, x)) return; /* Do not exceed the maximum spell range */ - if (distance(py, px, y, x) > MAX_RANGE) return; + if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return; /* Verify this grid */ /* @@ -4537,7 +4537,7 @@ void lite_room(int y1, int x1) if (p_ptr->special_defense & NINJA_S_STEALTH) { - if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE); + if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); } } @@ -4605,10 +4605,10 @@ bool lite_area(int dam, int rad) } /* Hook into the "project()" function */ - (void)project(0, rad, py, px, dam, GF_LITE_WEAK, flg, -1); + (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1); /* Lite up the room */ - lite_room(py, px); + lite_room(p_ptr->y, p_ptr->x); /* Assume seen */ return (TRUE); @@ -4632,10 +4632,10 @@ bool unlite_area(int dam, int rad) } /* Hook into the "project()" function */ - (void)project(0, rad, py, px, dam, GF_DARK_WEAK, flg, -1); + (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1); /* Lite up the room */ - unlite_room(py, px); + unlite_room(p_ptr->y, p_ptr->x); /* Assume seen */ return (TRUE); @@ -4665,8 +4665,8 @@ bool fire_ball(int typ, int dir, int dam, int rad) if (typ == GF_CONTROL_LIVING) flg|= PROJECT_HIDE; /* Use the given direction */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) @@ -4703,8 +4703,8 @@ bool fire_rocket(int typ, int dir, int dam, int rad) int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL; /* Use the given direction */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) @@ -4739,8 +4739,8 @@ bool fire_ball_hide(int typ, int dir, int dam, int rad) int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE; /* Use the given direction */ - tx = px + 99 * ddx[dir]; - ty = py + 99 * ddy[dir]; + tx = p_ptr->x + 99 * ddx[dir]; + ty = p_ptr->y + 99 * ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) @@ -4806,8 +4806,8 @@ bool fire_blast(int typ, int dir, int dd, int ds, int num, int dev) /* Use the given direction */ if (dir != 5) { - ly = ty = py + 20 * ddy[dir]; - lx = tx = px + 20 * ddx[dir]; + ly = ty = p_ptr->y + 20 * ddy[dir]; + lx = tx = p_ptr->x + 20 * ddx[dir]; } /* Use an actual "target" */ @@ -4816,11 +4816,11 @@ bool fire_blast(int typ, int dir, int dd, int ds, int num, int dev) tx = target_col; ty = target_row; - lx = 20 * (tx - px) + px; - ly = 20 * (ty - py) + py; + lx = 20 * (tx - p_ptr->x) + p_ptr->x; + ly = 20 * (ty - p_ptr->y) + p_ptr->y; } - ld = distance(py, px, ly, lx); + ld = distance(p_ptr->y, p_ptr->x, ly, lx); /* Blast */ for (i = 0; i < num; i++) @@ -4864,8 +4864,8 @@ bool teleport_swap(int dir) } else { - tx = px + ddx[dir]; - ty = py + ddy[dir]; + tx = p_ptr->x + ddx[dir]; + ty = p_ptr->y + ddy[dir]; } c_ptr = &cave[ty][tx]; @@ -4883,7 +4883,7 @@ bool teleport_swap(int dir) return FALSE; } - if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, py, px) > p_ptr->lev * 3 / 2 + 10)) + if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10)) { msg_print(_("失敗した。", "Failed to swap.")); @@ -4932,8 +4932,8 @@ bool project_hook(int typ, int dir, int dam, int flg) flg |= (PROJECT_THRU); /* Use the given direction */ - tx = px + ddx[dir]; - ty = py + ddy[dir]; + tx = p_ptr->x + ddx[dir]; + ty = p_ptr->y + ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) @@ -5243,7 +5243,7 @@ bool teleport_monster(int dir, int distance) bool door_creation(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; - return (project(0, 1, py, px, 0, GF_MAKE_DOOR, flg, -1)); + return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1)); } /*! @@ -5265,7 +5265,7 @@ bool trap_creation(int y, int x) bool tree_creation(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; - return (project(0, 1, py, px, 0, GF_MAKE_TREE, flg, -1)); + return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1)); } /*! @@ -5275,7 +5275,7 @@ bool tree_creation(void) bool glyph_creation(void) { int flg = PROJECT_GRID | PROJECT_ITEM; - return (project(0, 1, py, px, 0, GF_MAKE_GLYPH, flg, -1)); + return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1)); } /*! @@ -5286,7 +5286,7 @@ bool wall_stone(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; - bool dummy = (project(0, 1, py, px, 0, GF_STONE_WALL, flg, -1)); + bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1)); /* Update stuff */ p_ptr->update |= (PU_FLOW); @@ -5304,7 +5304,7 @@ bool wall_stone(void) bool destroy_doors_touch(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; - return (project(0, 1, py, px, 0, GF_KILL_DOOR, flg, -1)); + return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1)); } /*! @@ -5314,7 +5314,7 @@ bool destroy_doors_touch(void) bool disarm_traps_touch(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; - return (project(0, 1, py, px, 0, GF_KILL_TRAP, flg, -1)); + return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1)); } /*! @@ -5324,7 +5324,7 @@ bool disarm_traps_touch(void) bool sleep_monsters_touch(void) { int flg = PROJECT_KILL | PROJECT_HIDE; - return (project(0, 1, py, px, p_ptr->lev, GF_OLD_SLEEP, flg, -1)); + return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1)); } @@ -5418,7 +5418,7 @@ bool activate_ty_curse(bool stop_ty, int *count) if (!(*count)) { msg_print(_("地面が揺れた...", "The ground trembles...")); - earthquake(py, px, 5 + randint0(10)); + earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10)); if (!one_in_(6)) break; } case 30: case 31: @@ -5426,7 +5426,7 @@ bool activate_ty_curse(bool stop_ty, int *count) { int dam = damroll(10, 10); msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!")); - project(0, 8, py, px, dam, GF_MANA, flg, -1); + project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1); take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1); if (!one_in_(6)) break; } @@ -5435,7 +5435,7 @@ bool activate_ty_curse(bool stop_ty, int *count) { msg_print(_("周囲の空間が歪んだ!", "Space warps about you!")); teleport_player(damroll(10, 10), TELEPORT_PASSIVE); - if (randint0(13)) (*count) += activate_hi_summon(py, px, FALSE); + if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); if (!one_in_(6)) break; } case 34: @@ -5443,7 +5443,7 @@ bool activate_ty_curse(bool stop_ty, int *count) wall_breaker(); if (!randint0(7)) { - project(0, 7, py, px, 50, GF_KILL_WALL, flg, -1); + project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1); take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1); } if (!one_in_(6)) break; @@ -5451,10 +5451,10 @@ bool activate_ty_curse(bool stop_ty, int *count) aggravate_monsters(0); if (!one_in_(6)) break; case 4: case 5: case 6: - (*count) += activate_hi_summon(py, px, FALSE); + (*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, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (*count) += summon_specific(0, p_ptr->y, p_ptr->x, 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...")); @@ -5488,7 +5488,7 @@ bool activate_ty_curse(bool stop_ty, int *count) */ if ((dun_level > 65) && !stop_ty) { - (*count) += summon_cyber(-1, py, px); + (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x); stop_ty = TRUE; break; } @@ -5645,7 +5645,7 @@ void wall_breaker(void) { while (attempts--) { - scatter(&y, &x, py, px, 4, 0); + scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0); if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue; @@ -5657,7 +5657,7 @@ void wall_breaker(void) } else if (randint1(100) > 30) { - earthquake(py, px, 1); + earthquake(p_ptr->y, p_ptr->x, 1); } else { @@ -5667,7 +5667,7 @@ void wall_breaker(void) { while (1) { - scatter(&y, &x, py, px, 10, 0); + scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0); if (!player_bold(y, x)) break; } @@ -5870,8 +5870,8 @@ bool kawarimi(bool success) return FALSE; } - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; teleport_player(10 + randint1(90), 0L); @@ -5921,8 +5921,8 @@ bool rush_attack(bool *mdeath) if (!get_aim_dir(&dir)) return FALSE; /* Use the given direction */ - tx = px + project_length * ddx[dir]; - ty = py + project_length * ddy[dir]; + tx = p_ptr->x + project_length * ddx[dir]; + ty = p_ptr->y + project_length * ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) @@ -5933,15 +5933,15 @@ bool rush_attack(bool *mdeath) if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx; - path_n = project_path(path_g, project_length, py, px, ty, tx, PROJECT_STOP | PROJECT_KILL); + path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL); project_length = 0; /* No need to move */ if (!path_n) return TRUE; /* Use ty and tx as to-move point */ - ty = py; - tx = px; + ty = p_ptr->y; + tx = p_ptr->x; /* Project along the path */ for (i = 0; i < path_n; i++) diff --git a/src/spells3.c b/src/spells3.c index 70bff9149..cc606efe2 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -350,10 +350,10 @@ bool teleport_player_aux(int dis, u32b mode) int total_candidates, cur_candidates; int y = 0, x = 0, min, pick, i; - int left = MAX(1, px - dis); - int right = MIN(cur_wid - 2, px + dis); - int top = MAX(1, py - dis); - int bottom = MIN(cur_hgt - 2, py + dis); + int left = MAX(1, p_ptr->x - dis); + int right = MIN(cur_wid - 2, p_ptr->x + dis); + int top = MAX(1, p_ptr->y - dis); + int bottom = MIN(cur_hgt - 2, p_ptr->y + dis); if (p_ptr->wild_mode) return FALSE; @@ -382,7 +382,7 @@ bool teleport_player_aux(int dis, u32b mode) if (!cave_player_teleportable_bold(y, x, mode)) continue; /* Calculate distance */ - d = distance(py, px, y, x); + d = distance(p_ptr->y, p_ptr->x, y, x); /* Skip too far locations */ if (d > dis) continue; @@ -421,7 +421,7 @@ bool teleport_player_aux(int dis, u32b mode) if (!cave_player_teleportable_bold(y, x, mode)) continue; /* Calculate distance */ - d = distance(py, px, y, x); + d = distance(p_ptr->y, p_ptr->x, y, x); /* Skip too far locations */ if (d > dis) continue; @@ -465,8 +465,8 @@ void teleport_player(int dis, u32b mode) int yy, xx; /* Save the old location */ - int oy = py; - int ox = px; + int oy = p_ptr->y; + int ox = p_ptr->x; if (!teleport_player_aux(dis, mode)) return; @@ -490,7 +490,7 @@ void teleport_player(int dis, u32b mode) if ((r_ptr->flags6 & RF6_TPORT) && !(r_ptr->flagsr & RFR_RES_TELE)) { - if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, 0L); + if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L); } } } @@ -509,8 +509,8 @@ void teleport_player_away(int m_idx, int dis) int yy, xx; /* Save the old location */ - int oy = py; - int ox = px; + int oy = p_ptr->y; + int ox = p_ptr->x; if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return; @@ -534,7 +534,7 @@ void teleport_player_away(int m_idx, int dis) if ((r_ptr->flags6 & RF6_TPORT) && !(r_ptr->flagsr & RFR_RES_TELE)) { - if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level, 0L); + if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L); } } } @@ -608,7 +608,7 @@ void teleport_away_followable(int m_idx) teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L); - if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(py, px, oldfy, oldfx)) + if (old_ml && (old_cdis <= MAX_SIGHT) && !world_monster && !p_ptr->inside_battle && los(p_ptr->y, p_ptr->x, oldfy, oldfx)) { bool follow = FALSE; @@ -713,8 +713,8 @@ void teleport_level(int m_idx) if (!dun_level) { dungeon_type = p_ptr->recall_dungeon; - p_ptr->oldpy = py; - p_ptr->oldpx = px; + p_ptr->oldpy = p_ptr->y; + p_ptr->oldpx = p_ptr->x; } if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL); @@ -1597,7 +1597,7 @@ void call_the_(void) for (i = 0; i < 9; i++) { - c_ptr = &cave[py + ddy_ddd[i]][px + ddx_ddd[i]]; + c_ptr = &cave[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]]; if (!cave_have_flag_grid(c_ptr, FF_PROJECT)) { @@ -1653,7 +1653,7 @@ void call_the_(void) } else { - if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), FALSE)) + if (destroy_area(p_ptr->y, p_ptr->x, 15 + p_ptr->lev + randint0(11), FALSE)) msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses...")); else msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles.")); @@ -1680,7 +1680,7 @@ void fetch(int dir, int wgt, bool require_los) char o_name[MAX_NLEN]; /* Check to see if an object is already there */ - if (cave[py][px].o_idx) + if (cave[p_ptr->y][p_ptr->x].o_idx) { msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something.")); return; @@ -1692,7 +1692,7 @@ void fetch(int dir, int wgt, bool require_los) tx = target_col; ty = target_row; - if (distance(py, px, ty, tx) > MAX_RANGE) + if (distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) { msg_print(_("そんなに遠くにある物は取れません!", "You can't fetch something that far away!")); return; @@ -1722,7 +1722,7 @@ void fetch(int dir, int wgt, bool require_los) msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location.")); return; } - else if (!projectable(py, px, ty, tx)) + else if (!projectable(p_ptr->y, p_ptr->x, ty, tx)) { msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location.")); return; @@ -1732,8 +1732,8 @@ void fetch(int dir, int wgt, bool require_los) else { /* Use a direction */ - ty = py; /* Where to drop the item */ - tx = px; + ty = p_ptr->y; /* Where to drop the item */ + tx = p_ptr->x; do { @@ -1741,7 +1741,7 @@ void fetch(int dir, int wgt, bool require_los) tx += ddx[dir]; c_ptr = &cave[ty][tx]; - if ((distance(py, px, ty, tx) > MAX_RANGE) || + if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) || !cave_have_flag_bold(ty, tx, FF_PROJECT)) return; } while (!c_ptr->o_idx); @@ -1758,15 +1758,15 @@ void fetch(int dir, int wgt, bool require_los) i = c_ptr->o_idx; c_ptr->o_idx = o_ptr->next_o_idx; - cave[py][px].o_idx = i; /* 'move' it */ + cave[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */ o_ptr->next_o_idx = 0; - o_ptr->iy = (byte)py; - o_ptr->ix = (byte)px; + o_ptr->iy = (byte)p_ptr->y; + o_ptr->ix = (byte)p_ptr->x; object_desc(o_name, o_ptr, OD_NAME_ONLY); msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name); - note_spot(py, px); + note_spot(p_ptr->y, p_ptr->x); p_ptr->redraw |= PR_MAP; } @@ -1810,21 +1810,21 @@ void alter_reality(void) bool warding_glyph(void) { /* XXX XXX XXX */ - if (!cave_clean_bold(py, px)) + if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); return FALSE; } /* Create a glyph */ - cave[py][px].info |= CAVE_OBJECT; - cave[py][px].mimic = feat_glyph; + cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + cave[p_ptr->y][p_ptr->x].mimic = feat_glyph; /* Notice */ - note_spot(py, px); + note_spot(p_ptr->y, p_ptr->x); /* Redraw */ - lite_spot(py, px); + lite_spot(p_ptr->y, p_ptr->x); return TRUE; } @@ -1836,26 +1836,26 @@ bool warding_glyph(void) bool place_mirror(void) { /* XXX XXX XXX */ - if (!cave_clean_bold(py, px)) + if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); return FALSE; } /* Create a mirror */ - cave[py][px].info |= CAVE_OBJECT; - cave[py][px].mimic = feat_mirror; + cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + cave[p_ptr->y][p_ptr->x].mimic = feat_mirror; /* Turn on the light */ - cave[py][px].info |= CAVE_GLOW; + cave[p_ptr->y][p_ptr->x].info |= CAVE_GLOW; /* Notice */ - note_spot(py, px); + note_spot(p_ptr->y, p_ptr->x); /* Redraw */ - lite_spot(py, px); + lite_spot(p_ptr->y, p_ptr->x); - update_local_illumination(py, px); + update_local_illumination(p_ptr->y, p_ptr->x); return TRUE; } @@ -1869,21 +1869,21 @@ bool place_mirror(void) bool explosive_rune(void) { /* XXX XXX XXX */ - if (!cave_clean_bold(py, px)) + if (!cave_clean_bold(p_ptr->y, p_ptr->x)) { msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell.")); return FALSE; } /* Create a glyph */ - cave[py][px].info |= CAVE_OBJECT; - cave[py][px].mimic = feat_explosive_rune; + cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT; + cave[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune; /* Notice */ - note_spot(py, px); + note_spot(p_ptr->y, p_ptr->x); /* Redraw */ - lite_spot(py, px); + lite_spot(p_ptr->y, p_ptr->x); return TRUE; } @@ -4571,7 +4571,7 @@ o_name, index_to_label(i), /* Potions smash open */ if (object_is_potion(o_ptr)) { - (void)potion_smash_effect(0, py, px, o_ptr->k_idx); + (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, o_ptr->k_idx); } /* Reduce the charges of rods/wands */ @@ -5304,7 +5304,7 @@ static bool dimension_door_aux(int x, int y) p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L); if (!cave_player_teleportable_bold(y, x, 0L) || - (distance(y, x, py, px) > plev / 2 + 10) || + (distance(y, x, p_ptr->y, p_ptr->x) > plev / 2 + 10) || (!randint0(plev / 10 + 10))) { p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L); @@ -5771,8 +5771,8 @@ void massacre(int py, int px) for (dir = 0; dir < 8; dir++) { - y = py + ddy_ddd[dir]; - x = px + ddx_ddd[dir]; + y = p_ptr->y + ddy_ddd[dir]; + x = p_ptr->x + ddx_ddd[dir]; c_ptr = &cave[y][x]; /* Get the monster */ diff --git a/src/store.c b/src/store.c index 44a1d6648..066d8188b 100644 --- a/src/store.c +++ b/src/store.c @@ -4904,7 +4904,7 @@ void do_cmd_store(void) store_bottom = MIN_STOCK + xtra_stock; /* Access the player grid */ - c_ptr = &cave[py][px]; + c_ptr = &cave[p_ptr->y][p_ptr->x]; /* Verify a store */ if (!cave_have_flag_grid(c_ptr, FF_STORE)) diff --git a/src/types.h b/src/types.h index 90d288e01..529fbb665 100644 --- a/src/types.h +++ b/src/types.h @@ -1342,6 +1342,10 @@ struct player_type byte pspeed; /* Current speed */ s16b energy_use; /* Energy use this turn */ + + int y; /* Player location in dungeon */ + int x; /* Player location in dungeon */ + }; diff --git a/src/util.c b/src/util.c index 2fdb8b19d..6e5d68d74 100644 --- a/src/util.c +++ b/src/util.c @@ -4197,7 +4197,7 @@ static char inkey_from_menu(void) int menu = 0; bool kisuu; - if (py - panel_row_min > 10) basey = 2; + if (p_ptr->y - panel_row_min > 10) basey = 2; else basey = 13; basex = 15; @@ -4251,7 +4251,7 @@ static char inkey_from_menu(void) put_str(_("》", "> "),basey + 1 + num / 2, basex + 2 + (num % 2) * 24); /* Place the cursor on the player */ - move_cursor_relative(py, px); + move_cursor_relative(p_ptr->y, p_ptr->x); /* Get a command */ sub_cmd = inkey(); diff --git a/src/variable.c b/src/variable.c index bb92778ce..7712f3612 100644 --- a/src/variable.c +++ b/src/variable.c @@ -384,11 +384,6 @@ s16b panel_row_min, panel_row_max; s16b panel_col_min, panel_col_max; s16b panel_col_prt, panel_row_prt; -/* - * Player location in dungeon - */ -int py; -int px; /* * Targetting variables diff --git a/src/wild.c b/src/wild.c index 912ea0a14..6d07fd8d2 100644 --- a/src/wild.c +++ b/src/wild.c @@ -738,8 +738,8 @@ void wilderness_gen_small() panel_col_min = cur_wid; /* Place the player */ - px = p_ptr->wilderness_x; - py = p_ptr->wilderness_y; + p_ptr->x = p_ptr->wilderness_x; + p_ptr->y = p_ptr->wilderness_y; p_ptr->town_num = 0; } @@ -1127,8 +1127,8 @@ bool change_wild_mode(void) if (p_ptr->wild_mode) { /* Save the location in the global map */ - p_ptr->wilderness_x = px; - p_ptr->wilderness_y = py; + p_ptr->wilderness_x = p_ptr->x; + p_ptr->wilderness_y = p_ptr->y; /* Give first move to the player */ p_ptr->energy_need = 0; @@ -1180,8 +1180,8 @@ bool change_wild_mode(void) p_ptr->energy_use = 1000; /* Remember the position */ - p_ptr->oldpx = px; - p_ptr->oldpy = py; + p_ptr->oldpx = p_ptr->x; + p_ptr->oldpy = p_ptr->y; /* Cancel hex spelling */ if (hex_spelling_any()) stop_hex_spell_all(); diff --git a/src/wizard2.c b/src/wizard2.c index 0dcff8a34..d2075d293 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -128,7 +128,7 @@ static void wiz_create_named_art(void) if(a_idx >= max_a_idx) a_idx = 0; /* Create the artifact */ - (void)create_named_art(a_idx, py, px); + (void)create_named_art(a_idx, p_ptr->y, p_ptr->x); /* All done */ msg_print("Allocated."); @@ -155,12 +155,12 @@ static void do_cmd_wiz_hack_ben(void) */ static void do_cmd_summon_horde(void) { - int wy = py, wx = px; + int wy = p_ptr->y, wx = p_ptr->x; int attempts = 1000; while (--attempts) { - scatter(&wy, &wx, py, px, 3, 0); + scatter(&wy, &wx, p_ptr->y, p_ptr->x, 3, 0); if (cave_empty_bold(wy, wx)) break; } @@ -1418,7 +1418,7 @@ static void wiz_create_item(void) if (a_info[i].sval != k_info[k_idx].sval) continue; /* Create this artifact */ - (void)create_named_art(i, py, px); + (void)create_named_art(i, p_ptr->y, p_ptr->x); /* All done */ msg_print("Allocated(INSTA_ART)."); @@ -1437,7 +1437,7 @@ static void wiz_create_item(void) apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART); /* Drop the object from heaven */ - (void)drop_near(q_ptr, -1, py, px); + (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x); /* All done */ msg_print("Allocated."); @@ -1630,7 +1630,7 @@ static void do_cmd_wiz_summon(int num) for (i = 0; i < num; i++) { - (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE)); + (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE)); } } @@ -1646,7 +1646,7 @@ static void do_cmd_wiz_summon(int num) */ static void do_cmd_wiz_named(int r_idx) { - (void)summon_named_creature(0, py, px, r_idx, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP)); + (void)summon_named_creature(0, p_ptr->y, p_ptr->x, r_idx, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP)); } @@ -1660,7 +1660,7 @@ static void do_cmd_wiz_named(int r_idx) */ static void do_cmd_wiz_named_friendly(int r_idx) { - (void)summon_named_creature(0, py, px, r_idx, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP | PM_FORCE_PET)); + (void)summon_named_creature(0, p_ptr->y, p_ptr->x, r_idx, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP | PM_FORCE_PET)); } @@ -2004,7 +2004,7 @@ void do_cmd_debug(void) /* Good Objects */ case 'g': if (command_arg <= 0) command_arg = 1; - acquirement(py, px, command_arg, FALSE, FALSE, TRUE); + acquirement(p_ptr->y, p_ptr->x, command_arg, FALSE, FALSE, TRUE); break; /* Hitpoint rerating */ @@ -2125,7 +2125,7 @@ void do_cmd_debug(void) /* Special(Random Artifact) Objects */ case 'S': if (command_arg <= 0) command_arg = 1; - acquirement(py, px, command_arg, TRUE, TRUE, TRUE); + acquirement(p_ptr->y, p_ptr->x, command_arg, TRUE, TRUE, TRUE); break; /* Teleport */ @@ -2136,7 +2136,7 @@ void do_cmd_debug(void) /* Very Good Objects */ case 'v': if (command_arg <= 0) command_arg = 1; - acquirement(py, px, command_arg, TRUE, FALSE, TRUE); + acquirement(p_ptr->y, p_ptr->x, command_arg, TRUE, FALSE, TRUE); break; /* Wizard Light the Level */ diff --git a/src/xtra1.c b/src/xtra1.c index 176423913..2659c872f 100644 --- a/src/xtra1.c +++ b/src/xtra1.c @@ -5762,7 +5762,7 @@ void calc_bonuses(void) if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE; if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE; } - for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx) + for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; diff --git a/src/xtra2.c b/src/xtra2.c index 6dd5d9110..b37cdde17 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -2287,7 +2287,7 @@ void resize_map(void) * Waiting command; * Place the cursor on the player */ - if (can_save) move_cursor_relative(py, px); + if (can_save) move_cursor_relative(p_ptr->y, p_ptr->x); /* Refresh */ Term_fresh(); @@ -2413,8 +2413,8 @@ bool change_panel_xy(int y, int x) */ void verify_panel(void) { - int y = py; - int x = px; + int y = p_ptr->y; + int x = p_ptr->x; int wid, hgt; int prow_min; @@ -2726,7 +2726,7 @@ bool target_able(int m_idx) if (p_ptr->riding && (p_ptr->riding == m_idx)) return (TRUE); /* Monster must be projectable */ - if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE); + if (!projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) return (FALSE); /* XXX XXX XXX Hack -- Never target trappers */ /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */ @@ -2784,15 +2784,15 @@ static bool ang_sort_comp_distance(vptr u, vptr v, int a, int b) int da, db, kx, ky; /* Absolute distance components */ - kx = x[a]; kx -= px; kx = ABS(kx); - ky = y[a]; ky -= py; ky = ABS(ky); + kx = x[a]; kx -= p_ptr->x; kx = ABS(kx); + ky = y[a]; ky -= p_ptr->y; ky = ABS(ky); /* Approximate Double Distance to the first point */ da = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx)); /* Absolute distance components */ - kx = x[b]; kx -= px; kx = ABS(kx); - ky = y[b]; ky -= py; ky = ABS(ky); + kx = x[b]; kx -= p_ptr->x; kx = ABS(kx); + ky = y[b]; ky -= p_ptr->y; ky = ABS(ky); /* Approximate Double Distance to the first point */ db = ((kx > ky) ? (kx + kx + ky) : (ky + ky + kx)); @@ -2819,8 +2819,8 @@ static bool ang_sort_comp_importance(vptr u, vptr v, int a, int b) monster_race *ap_ra_ptr, *ap_rb_ptr; /* The player grid */ - if (y[a] == py && x[a] == px) return TRUE; - if (y[b] == py && x[b] == px) return FALSE; + if (y[a] == p_ptr->y && x[a] == p_ptr->x) return TRUE; + if (y[b] == p_ptr->y && x[b] == p_ptr->x) return FALSE; /* Extract monster race */ if (ca_ptr->m_idx && ma_ptr->ml) ap_ra_ptr = &r_info[ma_ptr->ap_r_idx]; @@ -3024,10 +3024,10 @@ static void target_set_prepare(int mode) if (mode & TARGET_KILL) { /* Inner range */ - min_hgt = MAX((py - MAX_RANGE), 0); - max_hgt = MIN((py + MAX_RANGE), cur_hgt - 1); - min_wid = MAX((px - MAX_RANGE), 0); - max_wid = MIN((px + MAX_RANGE), cur_wid - 1); + min_hgt = MAX((p_ptr->y - MAX_RANGE), 0); + max_hgt = MIN((p_ptr->y + MAX_RANGE), cur_hgt - 1); + min_wid = MAX((p_ptr->x - MAX_RANGE), 0); + max_wid = MIN((p_ptr->x + MAX_RANGE), cur_wid - 1); } else /* not targetting */ { @@ -3761,8 +3761,8 @@ static int target_set_aux(int y, int x, int mode, cptr info) bool target_set(int mode) { int i, d, m, t, bd; - int y = py; - int x = px; + int y = p_ptr->y; + int x = p_ptr->x; bool done = FALSE; @@ -3911,8 +3911,8 @@ bool target_set(int mode) /* Recalculate interesting grids */ target_set_prepare(mode); - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; } case 'o': @@ -4106,8 +4106,8 @@ bool target_set(int mode) /* Recalculate interesting grids */ target_set_prepare(mode); - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; } case 'o': @@ -4746,7 +4746,7 @@ msg_format("%sの声がささやいた:", msg_print(_("「我が与えし物を賢明に使うべし。」", "'Use my gift wisely.'")); - acquirement(py, px, 1, FALSE, FALSE, FALSE); + acquirement(p_ptr->y, p_ptr->x, 1, FALSE, FALSE, FALSE); reward = _("上質なアイテムを手に入れた。", "a good item"); break; case REW_GREA_OBJ: @@ -4760,7 +4760,7 @@ msg_format("%sの声が響き渡った:", msg_print(_("「我が与えし物を賢明に使うべし。」", "'Use my gift wisely.'")); - acquirement(py, px, 1, TRUE, FALSE, FALSE); + acquirement(p_ptr->y, p_ptr->x, 1, TRUE, FALSE, FALSE); reward = _("高級品のアイテムを手に入れた。", "an excellent item"); break; case REW_CHAOS_WP: @@ -4871,7 +4871,7 @@ msg_format("%sの声が響き渡った:", q_ptr->name2 = EGO_CHAOTIC; /* Drop it in the dungeon */ - (void)drop_near(q_ptr, -1, py, px); + (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x); reward = _("(混沌)の武器を手に入れた。", "chaos weapon"); break; case REW_GOOD_OBS: @@ -4885,7 +4885,7 @@ msg_format("%sの声が響き渡った:", msg_print(_("「汝の行いは貴き報いに値せり。」", "'Thy deed hath earned thee a worthy reward.'")); - acquirement(py, px, randint1(2) + 1, FALSE, FALSE, FALSE); + acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, FALSE, FALSE, FALSE); reward = _("上質なアイテムを手に入れた。", "good items"); break; case REW_GREA_OBS: @@ -4899,7 +4899,7 @@ msg_format("%sの声が響き渡った:", msg_print(_("「下僕よ、汝の献身への我が惜しみ無き報いを見るがよい。」", "'Behold, mortal, how generously I reward thy loyalty.'")); - acquirement(py, px, randint1(2) + 1, TRUE, FALSE, FALSE); + acquirement(p_ptr->y, p_ptr->x, randint1(2) + 1, TRUE, FALSE, FALSE); reward = _("高級品のアイテムを手に入れた。", "excellent items"); break; case REW_TY_CURSE: @@ -4929,7 +4929,7 @@ msg_format("%sの声が響き渡った:", for (dummy = 0; dummy < randint1(5) + 1; dummy++) { - (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); + (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)); } reward = _("モンスターを召喚された。", "summoning hostile monsters"); break; @@ -4944,7 +4944,7 @@ msg_format("%sの声が響き渡った:", msg_print(_("「汝、より強き敵を必要とせり!」", "'Thou needst worthier opponents!'")); - activate_hi_summon(py, px, FALSE); + activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); reward = _("モンスターを召喚された。", "summoning many hostile monsters"); break; case REW_DO_HAVOC: @@ -5133,7 +5133,7 @@ msg_format("%sの声がささやいた:", reward = _("禍々しい呪いをかけられた。", "cursing"); break; case 2: - activate_hi_summon(py, px, FALSE); + activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); reward = _("モンスターを召喚された。", "summoning hostile monsters"); break; case 3: @@ -5178,7 +5178,7 @@ msg_format("%sの声がささやいた:", { (void)dec_stat(dummy, 10 + randint1(15), FALSE); } - activate_hi_summon(py, px, FALSE); + activate_hi_summon(p_ptr->y, p_ptr->x, FALSE); (void)activate_ty_curse(FALSE, &count); if (one_in_(2)) { @@ -5206,7 +5206,7 @@ msg_format("%sの声が響き渡った:", msg_print(_("「死と破壊こそ我が喜びなり!」", "'Death and destruction! This pleaseth me!'")); - (void)destroy_area(py, px, 25, FALSE); + (void)destroy_area(p_ptr->y, p_ptr->x, 25, FALSE); reward = _("ダンジョンが*破壊*された。", "*destruct*ing dungeon"); break; case REW_GENOCIDE: @@ -5261,7 +5261,7 @@ msg_format("%sはあなたを無視した。", case REW_SER_DEMO: msg_format(_("%sは褒美として悪魔の使いをよこした!", "%s rewards you with a demonic servant!"),chaos_patrons[p_ptr->chaos_patron]); - if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET)) + if (!summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, PM_FORCE_PET)) msg_print(_("何も現れなかった...", "Nobody ever turns up...")); else reward = _("悪魔がペットになった。", "a demonic servant"); @@ -5270,7 +5270,7 @@ msg_format("%sはあなたを無視した。", case REW_SER_MONS: msg_format(_("%sは褒美として使いをよこした!", "%s rewards you with a servant!"),chaos_patrons[p_ptr->chaos_patron]); - if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET)) + if (!summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, 0, PM_FORCE_PET)) msg_print(_("何も現れなかった...", "Nobody ever turns up...")); else reward = _("モンスターがペットになった。", "a servant"); @@ -5279,7 +5279,7 @@ msg_format("%sはあなたを無視した。", case REW_SER_UNDE: msg_format(_("%sは褒美としてアンデッドの使いをよこした。", "%s rewards you with an undead servant!"),chaos_patrons[p_ptr->chaos_patron]); - if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET)) + if (!summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, PM_FORCE_PET)) msg_print(_("何も現れなかった...", "Nobody ever turns up...")); else reward = _("アンデッドがペットになった。", "an undead servant"); @@ -5312,7 +5312,7 @@ static bool tgt_pt_accept(int y, int x) if (!(in_bounds(y, x))) return (FALSE); /* Player grid is always interesting */ - if ((y == py) && (x == px)) return (TRUE); + if ((y == p_ptr->y) && (x == p_ptr->x)) return (TRUE); /* Handle hallucination */ if (p_ptr->image) return (FALSE); @@ -5387,8 +5387,8 @@ bool tgt_pt(int *x_ptr, int *y_ptr) /* Get size */ get_screen_size(&wid, &hgt); - x = px; - y = py; + x = p_ptr->x; + y = p_ptr->y; if (expand_list) { @@ -5448,8 +5448,8 @@ bool tgt_pt(int *x_ptr, int *y_ptr) if (n == temp_n) /* Loop out taget list */ { n = 0; - y = py; - x = px; + y = p_ptr->y; + x = p_ptr->x; verify_panel(); /* Move cursor to player */ /* Update stuff */ -- 2.11.0