OSDN Git Service

#37287 #37353 (2.2.0.89) FEAT_POWER 型を定義し、型の置換を継続中。 / Define FEAT_POWER, ongoing...
[hengband/hengband.git] / src / cave.c
index 88d7730..e75d77d 100644 (file)
@@ -31,18 +31,18 @@ static int feat_priority; /*!< マップ縮小表示時に表示すべき地形
  * @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;
@@ -67,7 +67,7 @@ int distance (int y1, int x1, int y2, int x2)
  * @param feat 地形情報のID
  * @return 罠持ちの地形ならばTRUEを返す。
  */
-bool is_trap(int feat)
+bool is_trap(IDX feat)
 {
        return have_flag(f_info[feat].flags, FF_TRAP);
 }
@@ -90,7 +90,7 @@ bool is_known_trap(cave_type *c_ptr)
  * @param feat 地形情報のID
  * @return 閉じたドアのある地形ならばTRUEを返す。
  */
-bool is_closed_door(int feat)
+bool is_closed_door(IDX feat)
 {
        feature_type *f_ptr = &f_info[feat];
 
@@ -154,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;
@@ -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));
 }
 
 
@@ -1569,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))
                        {
@@ -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);
@@ -1745,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);
@@ -1848,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++)
@@ -2022,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
@@ -2150,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;
@@ -2208,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();
@@ -2240,11 +2232,8 @@ prt("お待ち下さい...", 0, 0);
                        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);
@@ -2277,11 +2266,8 @@ prt("お待ち下さい...", 0, 0);
        }
        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();
@@ -2619,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
 
@@ -2653,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);
                }
        }
 
@@ -2713,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 */
@@ -2757,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;
@@ -2824,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; */
@@ -2847,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)
@@ -2868,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)
@@ -2915,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;
@@ -2933,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)
@@ -2954,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)
@@ -3002,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;
@@ -3236,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++;
        }
 
@@ -3296,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)
        {
@@ -3304,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."));
                        }
                }
        }
@@ -3404,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()".
@@ -3495,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);
 
@@ -3602,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;
 
@@ -3665,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];
@@ -4122,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;
 
 
 
@@ -4142,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;
 
@@ -4167,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)
@@ -4190,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 */
@@ -4291,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;
@@ -4318,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;
@@ -4332,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];
 
@@ -4488,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);
        }
 }
 
@@ -4569,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];
@@ -4677,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];
 
@@ -4717,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;
@@ -4740,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;
@@ -4775,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!"));
                }
        }
 
@@ -4922,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];
@@ -4958,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;
@@ -4993,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;
@@ -5010,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;
@@ -5024,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;