OSDN Git Service

#37287 #37353 (2.2.0.89) 型の置換を継続中。 / Ongoing type replacement.
[hengband/hengband.git] / src / cave.c
index 54a34a3..e75d77d 100644 (file)
@@ -1,6 +1,6 @@
-/*!
+/*!
  * @file cave.c
- * @brief ¥À¥ó¥¸¥ç¥ó¤Î´ðÁÃÉôʬ¼ÂÁõ(¼ç¤Ë¥Þ¥¹¤Î¼ÂÁõ) / low level dungeon routines -BEN-
+ * @brief ダンジョンの基礎部分実装(主にマスの実装) / low level dungeon routines -BEN-
  * @date 2013/12/30
  * @author
  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
  * Support for Adam Bolt's tileset, lighting and transparency effects\n
  * by Robert Ruehlmann (rr9@angband.org)\n
  * \n
- * 2013 Deskull Doxygen¸þ¤±¤Î¥³¥á¥ó¥ÈÀ°Íý\n
+ * 2013 Deskull Doxygen向けのコメント整理\n
  */
 
 
 #include "angband.h"
 
-static byte display_autopick; /*!< ¼«Æ°½¦¤¤¾õÂÖ¤ÎÀßÄê¥Õ¥é¥° */
+static byte display_autopick; /*!< è\87ªå\8b\95æ\8b¾ã\81\84ç\8a¶æ\85\8bã\81®è¨­å®\9aã\83\95ã\83©ã\82° */
 static int match_autopick;
-static object_type *autopick_obj; /*!< ³Æ¼ï¼«Æ°½¦¤¤½èÍý»þ¤Ë»È¤¦¥ª¥Ö¥¸¥§¥¯¥È¥Ý¥¤¥ó¥¿ */
-static int feat_priority; /*!< ¥Þ¥Ã¥×½Ì¾®É½¼¨»þ¤Ëɽ¼¨¤¹¤Ù¤­ÃÏ·Á¤ÎÍ¥ÀèÅÙ¤òÊݴɤ¹¤ë */
+static object_type *autopick_obj; /*!< å\90\84種è\87ªå\8b\95æ\8b¾ã\81\84å\87¦ç\90\86æ\99\82ã\81«ä½¿ã\81\86ã\82ªã\83\96ã\82¸ã\82§ã\82¯ã\83\88ã\83\9dã\82¤ã\83³ã\82¿ */
+static int feat_priority; /*!< マップ縮小表示時に表示すべき地形の優先度を保管する */
 
 /*!
- * @brief 2ÅÀ´Ö¤Îµ÷Î¥¤ò¥Ë¥å¡¼¥È¥ó¡¦¥é¥×¥½¥óË¡¤Ç»»½Ð¤¹¤ë / Distance between two points via Newton-Raphson technique
- * @param y1 1ÅÀÌܤÎyºÂɸ
- * @param x1 1ÅÀÌܤÎxºÂɸ
- * @param y2 2ÅÀÌܤÎyºÂɸ
- * @param x2 2ÅÀÌܤÎxºÂɸ
- * @return 2ÅÀ´Ö¤Îµ÷Î¥
+ * @brief 2点間の距離をニュートン・ラプソン法で算出する / Distance between two points via Newton-Raphson technique
+ * @param y1 1点目のy座標
+ * @param x1 1点目のx座標
+ * @param y2 2点目のy座標
+ * @param x2 2点目のx座標
+ * @return 2点間の距離
  */
-int distance (int y1, int x1, int y2, int x2)
+POSITION distance (POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 {
-       int dy = (y1 > y2) ? (y1 - y2) : (y2 - y1);
-       int dx = (x1 > x2) ? (x1 - x2) : (x2 - x1);
+       POSITION dy = (y1 > y2) ? (y1 - y2) : (y2 - y1);
+       POSITION dx = (x1 > x2) ? (x1 - x2) : (x2 - x1);
 
        /* Squared distance */
-       int target = (dy * dy) + (dx * dx);
+       POSITION target = (dy * dy) + (dx * dx);
 
        /* Approximate distance: hypot(dy,dx) = max(dy,dx) + min(dy,dx) / 2 */
-       int d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1));
+       POSITION d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1));
 
-       int err;
+       POSITION err;
 
        /* Simple case */
        if (!dy || !dx) return d;
@@ -63,19 +63,19 @@ int distance (int y1, int x1, int y2, int x2)
 }
 
 /*!
- * @brief ÃÏ·Á¤¬æ«»ý¤Á¤Ç¤¢¤ë¤«¤ÎȽÄê¤ò¹Ô¤¦¡£ / Return TRUE if the given feature is a trap
- * @param feat ÃÏ·Á¾ðÊó¤ÎID
- * @return æ«»ý¤Á¤ÎÃÏ·Á¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
+ * @brief 地形が罠持ちであるかの判定を行う。 / Return TRUE if the given feature is a trap
+ * @param feat 地形情報のID
+ * @return 罠持ちの地形ならばTRUEを返す。
  */
-bool is_trap(int feat)
+bool is_trap(IDX feat)
 {
        return have_flag(f_info[feat].flags, FF_TRAP);
 }
 
 /*!
- * @brief ¥Þ¥¹¤Ë´ÇÇ˺ѤߤÎ櫤¬¤¢¤ë¤«¤ÎȽÄê¤ò¹Ô¤¦¡£ / Return TRUE if the given grid is a known trap
- * @param c_ptr ¥Þ¥¹¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
- * @return ´ÇÇ˺ѤߤÎ櫤¬¤¢¤ë¤Ê¤éTRUE¤òÊÖ¤¹¡£
+ * @brief マスに看破済みの罠があるかの判定を行う。 / Return TRUE if the given grid is a known trap
+ * @param c_ptr ã\83\9eã\82¹æ§\8bé\80 ä½\93ã\81®å\8f\82ç\85§ã\83\9dã\82¤ã\83³ã\82¿
+ * @return 看破済みの罠があるならTRUEを返す。
  */
 bool is_known_trap(cave_type *c_ptr)
 {
@@ -86,11 +86,11 @@ bool is_known_trap(cave_type *c_ptr)
 }
 
 /*!
- * @brief ÃÏ·Á¤¬ÊĤ¸¤¿¥É¥¢¤Ç¤¢¤ë¤«¤ÎȽÄê¤ò¹Ô¤¦¡£ / Return TRUE if the given grid is a closed door
- * @param feat ÃÏ·Á¾ðÊó¤ÎID
- * @return ÊĤ¸¤¿¥É¥¢¤Î¤¢¤ëÃÏ·Á¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
+ * @brief 地形が閉じたドアであるかの判定を行う。 / Return TRUE if the given grid is a closed door
+ * @param feat 地形情報のID
+ * @return 閉じたドアのある地形ならばTRUEを返す。
  */
-bool is_closed_door(int feat)
+bool is_closed_door(IDX feat)
 {
        feature_type *f_ptr = &f_info[feat];
 
@@ -99,9 +99,9 @@ bool is_closed_door(int feat)
 }
 
 /*!
- * @brief ¥Þ¥¹¤Ë±£¤µ¤ì¤¿¥É¥¢¤¬¤¢¤ë¤«¤ÎȽÄê¤ò¹Ô¤¦¡£ / Return TRUE if the given grid is a hidden closed door
- * @param c_ptr ¥Þ¥¹¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
- * @return ±£¤µ¤ì¤¿¥É¥¢¤¬¤¢¤ë¤Ê¤éTRUE¤òÊÖ¤¹¡£
+ * @brief マスに隠されたドアがあるかの判定を行う。 / Return TRUE if the given grid is a hidden closed door
+ * @param c_ptr ã\83\9eã\82¹æ§\8bé\80 ä½\93ã\81®å\8f\82ç\85§ã\83\9dã\82¤ã\83³ã\82¿
+ * @return 隠されたドアがあるならTRUEを返す。
  */
 bool is_hidden_door(cave_type *c_ptr)
 {
@@ -113,14 +113,13 @@ bool is_hidden_door(cave_type *c_ptr)
 }
 
 /*!
- * @brief LOS(Line Of Sight / »ëÀþ¤¬Ä̤äƤ¤¤ë¤«)¤ÎȽÄê¤ò¹Ô¤¦¡£
- * @param c_ptr ¥Þ¥¹¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
- * @param y1 »ÏÅÀ¤ÎyºÂɸ
- * @param x1 »ÏÅÀ¤ÎxºÂɸ
- * @param y2 ½ªÅÀ¤ÎyºÂɸ
- * @param x2 ½ªÅÀ¤ÎxºÂɸ
- * @return LOS¤¬Ä̤äƤ¤¤ë¤Ê¤éTRUE¤òÊÖ¤¹¡£
- * @detail
+ * @brief LOS(Line Of Sight / 視線が通っているか)の判定を行う。
+ * @param y1 始点のy座標
+ * @param x1 始点のx座標
+ * @param y2 終点のy座標
+ * @param x2 終点のx座標
+ * @return LOSが通っているならTRUEを返す。
+ * @details
  * A simple, fast, integer-based line-of-sight algorithm.  By Joseph Hall,\n
  * 4116 Brewster Drive, Raleigh NC 27606.  Email to jnh@ecemwl.ncsu.edu.\n
  *\n
@@ -155,10 +154,10 @@ bool is_hidden_door(cave_type *c_ptr)
  *\n
  * Use the "update_view()" function to determine player line-of-sight.\n
  */
-bool los(int y1, int x1, int y2, int x2)
+bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 {
        /* Delta */
-       int dx, dy;
+       POSITION dx, dy;
 
        /* Absolute */
        int ax, ay;
@@ -378,20 +377,20 @@ bool los(int y1, int x1, int y2, int x2)
        return TRUE;
 }
 
-#define COMPLEX_WALL_ILLUMINATION /*!< ¾ÈÌÀ¾õÂÖ¤òÊɤˤè¤ê±Æ¶Á¤ò¼õ¤±¤ë¡¢¤è¤êÊ£»¨¤ÊȽÄê¤ËÀÚ¤êÂؤ¨¤ë¥Þ¥¯¥í */
+#define COMPLEX_WALL_ILLUMINATION /*!< 照明状態を壁により影響を受ける、より複雑な判定に切り替えるマクロ */
 
 
 /*!
- * @brief »ØÄꤵ¤ì¤¿ºÂɸ¤Î¥Þ¥¹¤¬¸½ºß¾È¤é¤µ¤ì¤Æ¤¤¤ë¤«¤òÊÖ¤¹¡£ / Check for "local" illumination
- * @param y yºÂɸ
- * @param y xºÂɸ
- * @return »ØÄꤵ¤ì¤¿ºÂɸ¤Ë¾ÈÌÀ¤¬¤«¤«¤Ã¤Æ¤¤¤ë¤Ê¤éTRUE¤òÊÖ¤¹¡£¡£
+ * @brief 指定された座標のマスが現在照らされているかを返す。 / Check for "local" illumination
+ * @param y y座標
+ * @param x x座標
+ * @return 指定された座標に照明がかかっているならTRUEを返す。。
  */
 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 */
 
@@ -418,7 +417,7 @@ static bool check_local_illumination(int y, int x)
 }
 
 
-/*! ÂоݺÂɸ¤Î¥Þ¥¹¤Î¾ÈÌÀ¾õÂÖ¤ò¹¹¿·¤¹¤ëºÝ¤ÎÊä½õ½èÍý¥Þ¥¯¥í */
+/*! 対象座標のマスの照明状態を更新する際の補助処理マクロ */
 #define update_local_illumination_aux(Y, X) \
 { \
        if (player_has_los_bold((Y), (X))) \
@@ -433,10 +432,10 @@ static bool check_local_illumination(int y, int x)
 }
 
 /*!
- * @brief »ØÄꤵ¤ì¤¿ºÂɸ¤Î¾ÈÌÀ¾õÂÖ¤ò¹¹¿·¤¹¤ë / Update "local" illumination
- * @param y yºÂɸ
- * @param y xºÂɸ
- * @return ¤Ê¤·
+ * @brief 指定された座標の照明状態を更新する / Update "local" illumination
+ * @param y y座標
+ * @param x x座標
+ * @return なし
  */
 void update_local_illumination(int y, int x)
 {
@@ -446,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;
@@ -467,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;
@@ -492,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;
@@ -531,10 +530,10 @@ void update_local_illumination(int y, int x)
 
 
 /*!
- * @brief »ØÄꤵ¤ì¤¿ºÂɸ¤ò¥×¥ì¥¤¥ä¡¼¤¬»ë³Ð¤Ë¼ý¤á¤é¤ì¤ë¤«¤òÊÖ¤¹¡£ / Can the player "see" the given grid in detail?
- * @param y yºÂɸ
- * @param y xºÂɸ
- * @return »ë³Ð¤Ë¼ý¤á¤é¤ì¤ë¾õÂ֤ʤéTRUE¤òÊÖ¤¹
+ * @brief 指定された座標をプレイヤーが視覚に収められるかを返す。 / Can the player "see" the given grid in detail?
+ * @param y y座標
+ * @param x x座標
+ * @return 視覚に収められる状態ならTRUEを返す
  * @details
  * He must have vision, illumination, and line of sight.\n
  * \n
@@ -596,25 +595,23 @@ bool player_can_see_bold(int y, int x)
 }
 
 /*!
- * @brief »ØÄꤵ¤ì¤¿ºÂɸ¤ò¥×¥ì¥¤¥ä¡¼¼ý¤á¤é¤ì¤Æ¤¤¤Ê¤¤¾õÂÖ¤«¤É¤¦¤« / Returns true if the player's grid is dark
- * @param y yºÂɸ
- * @param y xºÂɸ
- * @return »ë³Ð¤Ë¼ý¤á¤é¤ì¤Æ¤¤¤Ê¤¤¤Ê¤éTRUE¤òÊÖ¤¹
- * @details player_can_see_bold()´Ø¿ô¤ÎÊÖ¤êÃͤÎÈÝÄê¤òÊÖ¤·¤Æ¤¤¤ë¡£
+ * @brief 指定された座標をプレイヤー収められていない状態かどうか / Returns true if the player's grid is dark
+ * @return 視覚に収められていないならTRUEを返す
+ * @details player_can_see_bold()関数の返り値の否定を返している。
  */
 bool no_lite(void)
 {
-       return (!player_can_see_bold(py, px));
+       return (!player_can_see_bold(p_ptr->y, p_ptr->x));
 }
 
 
 /*!
- * @brief »ØÄꤵ¤ì¤¿ºÂɸ¤¬ÃϿ̤䳬ÃÊÀ¸À®¤ÎÂоݤȤʤë¥Þ¥¹¤«¤òÊÖ¤¹¡£ / Determine if a given location may be "destroyed"
- * @param y yºÂɸ
- * @param y xºÂɸ
- * @return ³Æ¼ï¤ÎÊѹ¹¤¬²Äǽ¤Ê¤éTRUE¤òÊÖ¤¹¡£
+ * @brief 指定された座標が地震や階段生成の対象となるマスかを返す。 / Determine if a given location may be "destroyed"
+ * @param y y座標
+ * @param x x座標
+ * @return 各種の変更が可能ならTRUEを返す。
  * @details 
- * ¾ò·ï¤Ï±Êµ×ÃÏ·Á¤Ç¤Ê¤¯¡¢¤Ê¤ª¤«¤Ä³ºÅö¤Î¥Þ¥¹¤Ë¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤¬Â¸ºß¤·¤Ê¤¤¤«¡¢¤Ç¤¢¤ë¡£±Ñ¸ì¤Îµì¥³¥á¥ó¥È¤ËÈ¿¤·¤Æ¡öÇ˲õ¡ö¤ÎÍÞ»ßȽÄê¤Ë¤Ï¸½ºß»È¤ï¤ì¤Æ¤¤¤Ê¤¤¡£
+ * 条件は永久地形でなく、なおかつ該当のマスにアーティファクトが存在しないか、である。英語の旧コメントに反して*破壊*の抑止判定には現在使われていない。
  */
 bool cave_valid_bold(int y, int x)
 {
@@ -649,21 +646,21 @@ bool cave_valid_bold(int y, int x)
 
 
 /*!
- * °ìÈÌŪ¤Ë¥â¥ó¥¹¥¿¡¼¥·¥ó¥Ü¥ë¤È¤·¤Æ°·¤ï¤ì¤ëµ­¹æ¤òÄêµÁ¤¹¤ë(¸¸³Ð½èÍý¸þ¤±) / Hack -- Legal monster codes
+ * 一般的にモンスターシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal monster codes
  */
 static char image_monster_hack[] = \
 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
 /*!
- * °ìÈÌŪ¤Ë¥ª¥Ö¥¸¥§¥¯¥È¥·¥ó¥Ü¥ë¤È¤·¤Æ°·¤ï¤ì¤ëµ­¹æ¤òÄêµÁ¤¹¤ë(¸¸³Ð½èÍý¸þ¤±) /  Hack -- Legal object codes
+ * 一般的にオブジェクトシンボルとして扱われる記号を定義する(幻覚処理向け) /  Hack -- Legal object codes
  */
 static char image_object_hack[] = "?/|\\\"!$()_-=[]{},~";
 
 /*!
- * @brief ¥â¥ó¥¹¥¿¡¼¤Îɽ¼¨¤ò¸¸³Ð¾õÂ֤˺¹¤·Âؤ¨¤ë / Mega-Hack -- Hallucinatory monster
- * @param ap ËÜÍè¤Î¿§
- * @param cp ËÜÍè¤Î¥·¥ó¥Ü¥ë
- * @return ¤Ê¤·
+ * @brief モンスターの表示を幻覚状態に差し替える / Mega-Hack -- Hallucinatory monster
+ * @param ap 本来の色
+ * @param cp 本来のシンボル
+ * @return なし
  */
 static void image_monster(byte *ap, char *cp)
 {
@@ -688,10 +685,10 @@ static void image_monster(byte *ap, char *cp)
 }
 
 /*!
- * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Îɽ¼¨¤ò¸¸³Ð¾õÂ֤˺¹¤·Âؤ¨¤ë / Hallucinatory object
- * @param ap ËÜÍè¤Î¿§
- * @param cp ËÜÍè¤Î¥·¥ó¥Ü¥ë
- * @return ¤Ê¤·
+ * @brief オブジェクトの表示を幻覚状態に差し替える / Hallucinatory object
+ * @param ap 本来の色
+ * @param cp 本来のシンボル
+ * @return なし
  */
 static void image_object(byte *ap, char *cp)
 {
@@ -715,10 +712,10 @@ static void image_object(byte *ap, char *cp)
 
 
 /*!
- * @brief ¥ª¥Ö¥¸¥§¥¯¥È¡õ¥â¥ó¥¹¥¿¡¼¤Îɽ¼¨¤ò¸¸³Ð¾õÂ֤˺¹¤·Âؤ¨¤ë / Hack -- Random hallucination
- * @param ap ËÜÍè¤Î¿§
- * @param cp ËÜÍè¤Î¥·¥ó¥Ü¥ë
- * @return ¤Ê¤·
+ * @brief オブジェクト&モンスターの表示を幻覚状態に差し替える / Hack -- Random hallucination
+ * @param ap 本来の色
+ * @param cp 本来のシンボル
+ * @return なし
  */
 static void image_random(byte *ap, char *cp)
 {
@@ -736,7 +733,7 @@ static void image_random(byte *ap, char *cp)
 }
 
 /*!
- * ¾ÈÌÀ¤Îɽ¸½¤ò¹Ô¤¦¤¿¤á¤Î¿§¹ç¤¤¤Î´Ø·¸¤ò{°Å°Ç»þ, ¾ÈÌÀ»þ} ¤ÇÄêµÁ¤¹¤ë /
+ * 照明の表現を行うための色合いの関係を{暗闇時, 照明時} で定義する /
  * This array lists the effects of "brightness" on various "base" colours.\n
  *\n
  * This is used to do dynamic lighting effects in ascii :-)\n
@@ -796,8 +793,8 @@ static byte lighting_colours[16][2] =
 };
 
 /*!
- * @brief Ä´ººÃæ
- * @todo ¥³¥á¥ó¥È¤òÉղ乤뤳¤È
+ * @brief 調査中
+ * @todo コメントを付加すること
  */
 void apply_default_feat_lighting(byte f_attr[F_LIT_MAX], byte f_char[F_LIT_MAX])
 {
@@ -821,7 +818,7 @@ void apply_default_feat_lighting(byte f_attr[F_LIT_MAX], byte f_char[F_LIT_MAX])
 
 
 /*!
- * ¥â¥ó¥¹¥¿¡¼¤Ë¤è¤ê¾ÈÌÀ¤¬¾Ã¤µ¤ì¤Æ¤¤¤ëÃÏ·Á¤«Èݤ«¤òȽÄꤹ¤ë¡£ / Is this grid "darkened" by monster?
+ * モンスターにより照明が消されている地形か否かを判定する。 / Is this grid "darkened" by monster?
  */
 #define darkened_grid(C) \
        ((((C)->info & (CAVE_VIEW | CAVE_LITE | CAVE_MNLT | CAVE_MNDK)) == (CAVE_VIEW | CAVE_MNDK)) && \
@@ -829,7 +826,7 @@ void apply_default_feat_lighting(byte f_attr[F_LIT_MAX], byte f_char[F_LIT_MAX])
 
 
 /*!
- * @brief M¥³¥Þ¥ó¥É¤Ë¤è¤ë½Ì¾®¥Þ¥Ã¥×¤Îɽ¼¨¤ò¹Ô¤¦ / Extract the attr/char to display at the given (legal) map location
+ * @brief Mコマンドによる縮小マップの表示を行う / Extract the attr/char to display at the given (legal) map location
  * @details
  * Basically, we "paint" the chosen attr/char in several passes, starting\n
  * with any known "terrain features" (defaulting to darkness), then adding\n
@@ -1572,12 +1569,12 @@ void display_dungeon(void)
        byte a;
        char c;
 
-       byte ta;
-       char tc;
+       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))
                        {
@@ -1594,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
                        {
@@ -1610,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);
                        }
                }
        }
@@ -1732,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);
@@ -1748,14 +1745,14 @@ void prt_path(int y, int x)
        int i;
        int path_n;
        u16b path_g[512];
-       int default_color = TERM_SLATE;
+       byte_hack default_color = TERM_SLATE;
 
        if (!display_path) return;
        if (-1 == project_length)
                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);
@@ -1816,7 +1813,7 @@ void prt_path(int y, int x)
 static cptr simplify_list[][2] =
 {
 #ifdef JP
-       {"¤ÎËâË¡½ñ", ""},
+       {"の魔法書", ""},
        {NULL, NULL}
 #else
        {"^Ring of ",   "="},
@@ -1851,11 +1848,7 @@ static void display_shortened_item_name(object_type *o_ptr, int y)
        if (p_ptr->image)
        {
                attr = TERM_WHITE;
-#ifdef JP
-               strcpy(buf, "²¿¤«´ñ̯¤Êʪ");
-#else
-               strcpy(buf, "something strange");
-#endif
+               strcpy(buf, _("何か奇妙な物", "something strange"));
        }
 
        for (c = buf; *c; c++)
@@ -1889,7 +1882,7 @@ static void display_shortened_item_name(object_type *o_ptr, int y)
 
        c = buf;
        len = 0;
-       /* È¾³Ñ 12 Ê¸»úʬ¤ÇÀÚ¤ë */
+       /* 半角 12 文字分で切る */
        while(*c)
        {
 #ifdef JP
@@ -2025,7 +2018,7 @@ void display_map(int *cy, int *cx)
                        map_info(j, i, &ta, &tc, &ta, &tc);
 
                        /* Extract the priority */
-                       tp = feat_priority;
+                       tp = (byte_hack)feat_priority;
 
                        if(match_autopick!=-1
                           && (match_autopick_yx[y][x] == -1
@@ -2153,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;
@@ -2211,11 +2204,7 @@ void do_cmd_view_map(void)
        screen_save();
 
        /* Note */
-#ifdef JP
-prt("¤ªÂÔ¤Á²¼¤µ¤¤...", 0, 0);
-#else
-       prt("Please wait...", 0, 0);
-#endif
+       prt(_("お待ち下さい...", "Please wait..."), 0, 0);
 
        /* Flush */
        Term_fresh();
@@ -2243,11 +2232,8 @@ prt("
                        Term_get_size(&wid, &hgt);
                        row_message = hgt - 1;
 
-#ifdef JP
-                       put_str("²¿¤«¥­¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤('M':½¦¤¦ 'N':ÊüÃÖ 'D':M+N 'K':²õ¤¹¥¢¥¤¥Æ¥à¤òɽ¼¨)", row_message, 1);
-#else
-                       put_str(" Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items.", row_message, 1);
-#endif
+                       put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
+                                         " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."), row_message, 1);
 
                        /* Hilite the player */
                        move_cursor(cy, cx);
@@ -2280,11 +2266,8 @@ prt("
        }
        else
        {
-#ifdef JP
-               put_str("²¿¤«¥­¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹", 23, 30);
-#else
-               put_str("Hit any key to continue", 23, 30);
-#endif         /* Hilite the player */
+               put_str(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"), 23, 30);              
+               /* Hilite the player */
                move_cursor(cy, cx);
                /* Get any key */
                inkey();
@@ -2622,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
 
@@ -2656,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);
                }
        }
 
@@ -2716,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 */
@@ -2760,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;
@@ -2827,15 +2810,16 @@ void update_lite(void)
 
 
 static bool mon_invis;
-static s16b mon_fy, mon_fx;
+static POSITION mon_fy, mon_fx;
 
 /*
  * Add a square to the changes array
  */
-static void mon_lite_hack(int y, int x)
+static void mon_lite_hack(POSITION y, POSITION x)
 {
        cave_type *c_ptr;
-       int       midpoint, dpf, d;
+       int dpf, d;
+       POSITION midpoint;
 
        /* We trust this grid is in bounds */
        /* if (!in_bounds2(y, x)) return; */
@@ -2850,11 +2834,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)
@@ -2871,11 +2855,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)
@@ -2918,7 +2902,7 @@ static void mon_lite_hack(int y, int x)
 /*
  * Add a square to the changes array
  */
-static void mon_dark_hack(int y, int x)
+static void mon_dark_hack(POSITION y, POSITION x)
 {
        cave_type *c_ptr;
        int       midpoint, dpf, d;
@@ -2936,11 +2920,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)
@@ -2957,11 +2941,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)
@@ -3005,8 +2989,8 @@ void update_mon_lite(void)
        int i, rad;
        cave_type *c_ptr;
 
-       s16b fx, fy;
-       void (*add_mon_lite)(int, int);
+       POSITION fx, fy;
+       void (*add_mon_lite)(POSITION, POSITION);
        int f_flag;
 
        s16b end_temp;
@@ -3239,8 +3223,8 @@ void update_mon_lite(void)
                }
 
                /* Add to end of temp array */
-               temp_x[temp_n] = (byte)fx;
-               temp_y[temp_n] = (byte)fy;
+               temp_x[temp_n] = fx;
+               temp_y[temp_n] = fy;
                temp_n++;
        }
 
@@ -3299,7 +3283,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)
        {
@@ -3307,19 +3291,11 @@ void update_mon_lite(void)
                {
                        if (p_ptr->monlite)
                        {
-#ifdef JP
-                               msg_print("±Æ¤Îʤ¤¤¤¬Çö¤ì¤¿µ¤¤¬¤¹¤ë¡£");
-#else
-                               msg_print("Your mantle of shadow become thin.");
-#endif
+                               msg_print(_("影の覆いが薄れた気がする。", "Your mantle of shadow become thin."));
                        }
                        else
                        {
-#ifdef JP
-                               msg_print("±Æ¤Îʤ¤¤¤¬Ç»¤¯¤Ê¤Ã¤¿¡ª");
-#else
-                               msg_print("Your mantle of shadow restored its original darkness.");
-#endif
+                               msg_print(_("影の覆いが濃くなった!", "Your mantle of shadow restored its original darkness."));
                        }
                }
        }
@@ -3407,8 +3383,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()".
@@ -3498,7 +3474,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);
 
@@ -3605,14 +3581,15 @@ static bool update_view_aux(int y, int x, int y1, int x1, int y2, int x2)
  */
 void update_view(void)
 {
-       int n, m, d, k, y, x, z;
+       int n, m, d, k, z;
+       POSITION y, x;
 
        int se, sw, ne, nw, es, en, ws, wn;
 
        int full, over;
 
-       int y_max = cur_hgt - 1;
-       int x_max = cur_wid - 1;
+       POSITION y_max = cur_hgt - 1;
+       POSITION x_max = cur_wid - 1;
 
        cave_type *c_ptr;
 
@@ -3668,8 +3645,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];
@@ -4125,8 +4102,8 @@ void forget_flow(void)
  * it everytime the player moves out of LOS of the last
  * "way-point".
  */
-static u16b flow_x = 0;
-static u16b flow_y = 0;
+static POSITION flow_x = 0;
+static POSITION flow_y = 0;
 
 
 
@@ -4145,7 +4122,7 @@ static u16b flow_y = 0;
  */
 void update_flow(void)
 {
-       int x, y, d;
+       POSITION x, y, d;
        int flow_head = 1;
        int flow_tail = 0;
 
@@ -4170,12 +4147,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)
@@ -4193,8 +4170,8 @@ void update_flow(void)
                for (d = 0; d < 8; d++)
                {
                        int old_head = flow_head;
-                       int m = cave[ty][tx].cost + 1;
-                       int n = cave[ty][tx].dist + 1;
+                       byte_hack m = cave[ty][tx].cost + 1;
+                       byte_hack n = cave[ty][tx].dist + 1;
                        cave_type *c_ptr;
 
                        /* Child location */
@@ -4294,8 +4271,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;
@@ -4321,7 +4298,7 @@ void update_smell(void)
 /*
  * Hack -- map the current panel (plus some) ala "magic mapping"
  */
-void map_area(int range)
+void map_area(POSITION range)
 {
        int             i, x, y;
        cave_type       *c_ptr;
@@ -4335,7 +4312,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];
 
@@ -4491,7 +4468,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);
        }
 }
 
@@ -4572,7 +4549,7 @@ void wiz_dark(void)
 /*
  * Change the "feat" flag for a grid, and notice/redraw the grid
  */
-void cave_set_feat(int y, int x, int feat)
+void cave_set_feat(POSITION y, POSITION x, IDX feat)
 {
        cave_type *c_ptr = &cave[y][x];
        feature_type *f_ptr = &f_info[feat];
@@ -4680,13 +4657,13 @@ 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);
                }
        }
 }
 
 
-int conv_dungeon_feat(int newfeat)
+IDX conv_dungeon_feat(IDX newfeat)
 {
        feature_type *f_ptr = &f_info[newfeat];
 
@@ -4720,7 +4697,7 @@ int conv_dungeon_feat(int newfeat)
  * Take a feature, determine what that feature becomes
  * through applying the given action.
  */
-int feat_state(int feat, int action)
+IDX feat_state(IDX feat, int action)
 {
        feature_type *f_ptr = &f_info[feat];
        int i;
@@ -4743,10 +4720,10 @@ int feat_state(int feat, int action)
 void cave_alter_feat(int y, int x, int action)
 {
        /* Set old feature */
-       int oldfeat = cave[y][x].feat;
+       IDX oldfeat = cave[y][x].feat;
 
        /* Get the new feat */
-       int newfeat = feat_state(oldfeat, action);
+       IDX newfeat = feat_state(oldfeat, action);
 
        /* No change */
        if (newfeat == oldfeat) return;
@@ -4778,11 +4755,7 @@ void cave_alter_feat(int y, int x, int action)
 
                if (found && character_dungeon && player_can_see_bold(y, x))
                {
-#ifdef JP
-                       msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
-#else
-                       msg_print("You have found something!");
-#endif
+                       msg_print(_("何かを発見した!", "You have found something!"));
                }
        }
 
@@ -4925,9 +4898,9 @@ void mmove2(int *y, int *x, int y1, int x1, int y2, int x2)
  *
  * This is slightly (but significantly) different from "los(y1,x1,y2,x2)".
  */
-bool projectable(int y1, int x1, int y2, int x2)
+bool projectable(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 {
-       int y, x;
+       POSITION y, x;
 
        int grid_n = 0;
        u16b grid_g[512];
@@ -4961,9 +4934,9 @@ bool projectable(int y1, int x1, int y2, int x2)
  *
  * Currently the "m" parameter is unused.
  */
-void scatter(int *yp, int *xp, int y, int x, int d, int m)
+void scatter(POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, int m)
 {
-       int nx, ny;
+       POSITION nx, ny;
 
        /* Unused */
        m = m;
@@ -4996,7 +4969,7 @@ void scatter(int *yp, int *xp, int y, int x, int d, int m)
 /*
  * Track a new monster
  */
-void health_track(int m_idx)
+void health_track(MONSTER_IDX m_idx)
 {
        /* Mount monster is already tracked */
        if (m_idx && m_idx == p_ptr->riding) return;
@@ -5013,7 +4986,7 @@ void health_track(int m_idx)
 /*
  * Hack -- track the given monster race
  */
-void monster_race_track(int r_idx)
+void monster_race_track(MONRACE_IDX r_idx)
 {
        /* Save this monster ID */
        p_ptr->monster_race_idx = r_idx;
@@ -5027,7 +5000,7 @@ void monster_race_track(int r_idx)
 /*
  * Hack -- track the given object kind
  */
-void object_kind_track(int k_idx)
+void object_kind_track(IDX k_idx)
 {
        /* Save this monster ID */
        p_ptr->object_kind_idx = k_idx;