OSDN Git Service

fix #45401
[jnethack/source.git] / src / cmd.c
index eed4cc8..f8dc36a 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1,11 +1,11 @@
-/* NetHack 3.6 cmd.c   $NHDT-Date: 1557088405 2019/05/05 20:33:25 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.333 $ */
+/* NetHack 3.6 cmd.c   $NHDT-Date: 1575245052 2019/12/02 00:04:12 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.350 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 /* JNetHack Copyright */
 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
-/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019            */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2022            */
 /* JNetHack may be freely redistributed.  See license for details. */
 
 #include "hack.h"
@@ -28,6 +28,9 @@
 #define C(c) (0x1f & (c))
 #endif
 
+#define unctrl(c) ((c) <= C('z') ? (0x60 | (c)) : (c))
+#define unmeta(c) (0x7f & (c))
+
 #ifdef ALTMETA
 STATIC_VAR boolean alt_esc = FALSE;
 #endif
@@ -157,7 +160,6 @@ STATIC_PTR int NDECL(wiz_level_change);
 STATIC_PTR int NDECL(wiz_show_seenv);
 STATIC_PTR int NDECL(wiz_show_vision);
 STATIC_PTR int NDECL(wiz_smell);
-STATIC_PTR int NDECL(wiz_intrinsic);
 STATIC_PTR int NDECL(wiz_show_wmodes);
 STATIC_DCL void NDECL(wiz_map_levltyp);
 STATIC_DCL void NDECL(wiz_levltyp_legend);
@@ -367,7 +369,7 @@ doextcmd(VOID_ARGS)
             return 0;
         }
         if (iflags.menu_requested && !accept_menu_prefix(func)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             pline("'%s' prefix has no effect for the %s command.",
                   visctrl(Cmd.spkeys[NHKF_REQMENU]),
                   extcmdlist[idx].ef_txt);
@@ -397,7 +399,7 @@ doextlist(VOID_ARGS)
     int n, pass;
     int menumode = 0, menushown[2], onelist = 0;
     boolean redisplay = TRUE, search = FALSE;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     static const char *headings[] = { "Extended commands",
                                       "Debugging Extended Commands" };
 #else
@@ -412,7 +414,7 @@ doextlist(VOID_ARGS)
         redisplay = FALSE;
         any = zeroany;
         start_menu(menuwin);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
                  "Extended Commands List", MENU_UNSELECTED);
 #else
@@ -422,7 +424,7 @@ doextlist(VOID_ARGS)
         add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
                  "", MENU_UNSELECTED);
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Strcpy(buf, menumode ? "Show" : "Hide");
         Strcat(buf, " commands that don't autocomplete");
         if (!menumode)
@@ -442,7 +444,7 @@ doextlist(VOID_ARGS)
                actual list of extended commands shown via separator lines;
                having ':' as an explicit selector overrides the default
                menu behavior for it; we retain 's' as a group accelerator */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             add_menu(menuwin, NO_GLYPH, &any, ':', 's', ATR_NONE,
                      "Search extended commands", MENU_UNSELECTED);
 #else
@@ -450,7 +452,7 @@ doextlist(VOID_ARGS)
                      "\8ag\92£\83R\83}\83\93\83h\82ð\8c\9f\8dõ\82·\82é", MENU_UNSELECTED);
 #endif
         } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             Strcpy(buf, "Show all, clear search");
 #else
             Strcpy(buf, "\91S\82Ä\95\\8e¦; \8c\9f\8dõ\82ð\83N\83\8a\83A");
@@ -468,7 +470,7 @@ doextlist(VOID_ARGS)
         }
         if (wizard) {
             any.a_int = 4;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             add_menu(menuwin, NO_GLYPH, &any, 'z', 0, ATR_NONE,
                      onelist ? "Show debugging commands in separate section"
                      : "Show all alphabetically, including debugging commands",
@@ -540,7 +542,7 @@ doextlist(VOID_ARGS)
                          "", MENU_UNSELECTED);
         }
         if (*searchbuf && !n)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
                      "no matches", MENU_UNSELECTED);
 #else
@@ -577,7 +579,7 @@ doextlist(VOID_ARGS)
             searchbuf[0] = '\0';
         }
         if (search) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             Strcpy(promptbuf, "Extended command list search phrase");
             Strcat(promptbuf, "?");
 #else
@@ -642,11 +644,11 @@ extcmd_via_menu()
                 if ((len = (int) strlen(efp->ef_desc)) > biggest)
                     biggest = len;
                 if (++i > MAX_EXT_CMD) {
-#if defined(BETA)
+#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
                     impossible(
       "Exceeded %d extended commands in doextcmd() menu; 'extmenu' disabled.",
                                MAX_EXT_CMD);
-#endif /* BETA */
+#endif /* NH_DEVEL_STATUS != NH_STATUS_RELEASED */
                     iflags.extmenu = 0;
                     return -1;
                 }
@@ -736,7 +738,7 @@ extcmd_via_menu()
         if (n == 1) {
             if (matchlevel > (QBUFSZ - 2)) {
                 free((genericptr_t) pick_list);
-#if defined(BETA)
+#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
                 impossible("Too many chars (%d) entered in extcmd_via_menu()",
                            matchlevel);
 #endif
@@ -970,6 +972,7 @@ wiz_makemap(VOID_ARGS)
         u_on_rndspot((u.uhave.amulet ? 1 : 0) /* 'going up' flag */
                      | (was_in_W_tower ? 2 : 0));
         losedogs();
+        kill_genocided_monsters();
         /* u_on_rndspot() might pick a spot that has a monster, or losedogs()
            might pick the hero's spot (only if there isn't already a monster
            there), so we might have to move hero or the co-located monster */
@@ -1126,10 +1129,13 @@ wiz_panic(VOID_ARGS)
         u.uen = u.uenmax = 1000;
         return 0;
     }
-/*JP
-    if (yn("Do you want to call panic() and end your game?") == 'y')
-*/
-    if (yn("panic()\8aÖ\90\94\82ð\8cÄ\82Ñ\8fo\82µ\82Ä\83Q\81[\83\80\82ð\8fI\97¹\82³\82¹\82Ü\82·\82©\81H") == 'y')
+#if 0 /*JP:T*/
+    if (paranoid_query(ParanoidQuit,
+                       "Do you want to call panic() and end your game?"))
+#else
+    if (paranoid_query(ParanoidQuit,
+                       "panic()\8aÖ\90\94\82ð\8cÄ\82Ñ\8fo\82µ\82Ä\83Q\81[\83\80\82ð\8fI\97¹\82³\82¹\82Ü\82·\82©\81H"))
+#endif
         panic("Crash test.");
     return 0;
 }
@@ -1610,15 +1616,21 @@ wiz_intrinsic(VOID_ARGS)
                                          = &mons[context.warntype.speciesidx];
                 }
                 goto def_feedback;
+            case GLIB:
+                /* slippery fingers applies to gloves if worn at the time
+                   so persistent inventory might need updating */
+                make_glib((int) newtimeout);
+                goto def_feedback;
             case LEVITATION:
             case FLYING:
                 float_vs_flight();
                 /*FALLTHRU*/
             default:
           def_feedback:
+ def_feedback:
                 pline("Timeout for %s %s %d.", propertynames[i].prop_name,
                       oldtimeout ? "increased by" : "set to", amt);
-                incr_itimeout(&u.uprops[p].intrinsic, amt);
+                if (p != GLIB)
+                    incr_itimeout(&u.uprops[p].intrinsic, amt);
                 break;
             }
             context.botl = 1; /* probably not necessary... */
@@ -1840,7 +1852,7 @@ char *outbuf;
     /* Protection amount is typically larger than damage or to-hit;
        reduce magnitude by a third in order to stretch modifier ranges
        (small:1..5, moderate:6..10, large:11..19, huge:20+) */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     if (!strcmp(inctyp, "defense"))
 #else
     if (!strcmp(inctyp, "\96h\8cä"))
@@ -1921,7 +1933,7 @@ int final;
         category_name = "\95s\96¾";
         break;
     }
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     Sprintf(buf, " %s %s damage", (final || wizard) ? "half" : "reduced",
             category_name);
     enl_msg(You_, "take", "took", buf, from_what(category));
@@ -1995,7 +2007,7 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
     *tmpbuf = highc(*tmpbuf); /* same adjustment as bottom line */
     /* as in background_enlightenment, when poly'd we need to use the saved
        gender in u.mfemale rather than the current you-as-monster gender */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     Sprintf(buf, "%s the %s's attributes:", tmpbuf,
             ((Upolyd ? u.mfemale : flags.female) && urole.name.f)
                 ? urole.name.f
@@ -2085,7 +2097,7 @@ int final;
             Sprintf(tmpbuf, "%s ", genders[flags.female ? 1 : 0].adj);
 */
             Sprintf(tmpbuf, "%s\82Ì", genders[flags.female ? 1 : 0].adj);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, "%sin %s%s form", !final ? "currently " : "", tmpbuf,
                 uasmon->mname);
 #else
@@ -2109,14 +2121,14 @@ int final;
         Sprintf(tmpbuf, "%s", genders[innategend].adj);
     buf[0] = '\0';
     if (Upolyd)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Strcpy(buf, "actually "); /* "You are actually a ..." */
 #else
         Strcpy(buf, "\8eÀ\8dÛ\82É\82Í"); /* "\82 \82È\82½\82Í\8eÀ\8dÛ\82É\82Í..." */
 #endif
     if (!strcmpi(rank_titl, role_titl)) {
         /* omit role when rank title matches it */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(eos(buf), "%s, level %d %s%s", an(rank_titl), u.ulevel,
                 tmpbuf, urace.noun);
 #else
@@ -2124,7 +2136,7 @@ int final;
                 tmpbuf, urace.adj, role_titl);
 #endif
     } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(eos(buf), "%s, a level %d %s%s %s", an(rank_titl), u.ulevel,
                 tmpbuf, urace.adj, role_titl);
 #else
@@ -2181,7 +2193,7 @@ int final;
     Strcpy(buf, "\82 \82È\82½\82Í");
 #endif
     if (u.ualign.type != A_LAWFUL)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(eos(buf), " %s (%s) and", align_gname(A_LAWFUL),
                 align_str(A_LAWFUL));
 #else
@@ -2189,7 +2201,7 @@ int final;
                 align_str(A_LAWFUL));
 #endif
     if (u.ualign.type != A_NEUTRAL)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(eos(buf), " %s (%s)%s", align_gname(A_NEUTRAL),
                 align_str(A_NEUTRAL),
                 (u.ualign.type != A_CHAOTIC) ? " and" : "");
@@ -2199,7 +2211,7 @@ int final;
                 (u.ualign.type != A_CHAOTIC) ? "\82¨\82æ\82Ñ" : "");
 #endif
     if (u.ualign.type != A_CHAOTIC)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(eos(buf), " %s (%s)", align_gname(A_CHAOTIC),
                 align_str(A_CHAOTIC));
 #else
@@ -2249,7 +2261,7 @@ int final;
         enlght_out(buf);
     }
 
-    /* 3.6.2: dungeon level, so that ^X really has all status info as
+    /* As of 3.6.2: dungeon level, so that ^X really has all status info as
        claimed by the comment below; this reveals more information than
        the basic status display, but that's one of the purposes of ^X;
        similar information is revealed by #overview; the "You died in
@@ -2331,29 +2343,113 @@ int final;
         enlght_line(You_, "", buf, "");
 #endif
     }
+
+    /* for gameover, these have been obtained in really_done() so that they
+       won't vary if user leaves a disclosure prompt or --More-- unanswered
+       long enough for the dynamic value to change between then and now */
+    if (final ? iflags.at_midnight : midnight()) {
+#if 0 /*JP:T*/
+        enl_msg("It ", "is ", "was ", "the midnight hour", "");
+#else
+        enl_msg("\8e\9e\8aÔ\91Ñ\82Í\90[\96é", "\82¾", "\82¾\82Á\82½", "", "");
+#endif
+    } else if (final ? iflags.at_night : night()) {
+#if 0 /*JP:T*/
+        enl_msg("It ", "is ", "was ", "nighttime", "");
+#else
+        enl_msg("\8e\9e\8aÔ\91Ñ\82Í\96é", "\82¾", "\82¾\82Á\82½", "", "");
+#endif
+    }
+    /* other environmental factors */
+    if (flags.moonphase == FULL_MOON || flags.moonphase == NEW_MOON) {
+        /* [This had "tonight" but has been changed to "in effect".
+           There is a similar issue to Friday the 13th--it's the value
+           at the start of the current session but that session might
+           have dragged on for an arbitrary amount of time.  We want to
+           report the values that currently affect play--or affected
+           play when game ended--rather than actual outside situation.] */
+#if 0 /*JP:T*/
+        Sprintf(buf, "a %s moon in effect%s",
+                (flags.moonphase == FULL_MOON) ? "full"
+                : (flags.moonphase == NEW_MOON) ? "new"
+                  /* showing these would probably just lead to confusion
+                     since they have no effect on game play... */
+                  : (flags.moonphase < FULL_MOON) ? "first quarter"
+                    : "last quarter",
+                /* we don't have access to 'how' here--aside from survived
+                   vs died--so settle for general platitude */
+                final ? " when your adventure ended" : "");
+        enl_msg("There ", "is ", "was ", buf, "");
+#else
+        Sprintf(buf, "%s%s\8c\8e",
+                /* we don't have access to 'how' here--aside from survived
+                   vs died--so settle for general platitude */
+                final ? "\96`\8c¯\82ð\8fI\82¦\82½\82Æ\82«\81C" : "",
+                (flags.moonphase == FULL_MOON) ? "\96\9e"
+                : (flags.moonphase == NEW_MOON) ? "\90V"
+                  /* showing these would probably just lead to confusion
+                     since they have no effect on game play... */
+                  : (flags.moonphase < FULL_MOON) ? "\8fã\8c·\82Ì"
+                    : "\89º\8c·\82Ì");
+        enl_msg("", "\82¾", "\82¾\82Á\82½", buf, "");
+#endif
+    }
+    if (flags.friday13) {
+        /* let player know that friday13 penalty is/was in effect;
+           we don't say "it is/was Friday the 13th" because that was at
+           the start of the session and it might be past midnight (or
+           days later if the game has been paused without save/restore),
+           so phrase this similar to the start up message */
+#if 0 /*JP:T*/
+        Sprintf(buf, " Bad things %s on Friday the 13th.",
+                !final ? "can happen"
+                : (final == ENL_GAMEOVERALIVE) ? "could have happened"
+                  /* there's no may to tell whether -1 Luck made a
+                     difference but hero has died... */
+                  : "happened");
+#else
+        Sprintf(buf, "\82P\82R\93ú\82Ì\8bà\97j\93ú\82É\82Í\82æ\82­\82È\82¢\82±\82Æ\82ª%s\81D",
+                !final ? "\82 \82é"
+                : (final == ENL_GAMEOVERALIVE) ? "\82 \82Á\82½\82©\82à\82µ\82ê\82È\82¢"
+                  /* there's no may to tell whether -1 Luck made a
+                     difference but hero has died... */
+                  : "\82 \82Á\82½");
+#endif
+        enlght_out(buf);
+    }
+
     if (!Upolyd) {
-        /* flags.showexp does not matter */
+        int ulvl = (int) u.ulevel;
+        /* [flags.showexp currently does not matter; should it?] */
+
         /* experience level is already shown above */
 #if 0 /*JP*/
         Sprintf(buf, "%-1ld experience point%s", u.uexp, plur(u.uexp));
 #else
         Sprintf(buf, "\8co\8c±\92l%-1ld\83|\83C\83\93\83g", u.uexp);
 #endif
-        if (wizard) {
-            if (u.ulevel < 30) {
-                int ulvl = (int) u.ulevel;
-                long nxtlvl = newuexp(ulvl);
-                /* long oldlvl = (ulvl > 1) ? newuexp(ulvl - 1) : 0; */
+        /* TODO?
+         *  Remove wizard-mode restriction since patient players can
+         *  determine the numbers needed without resorting to spoilers
+         *  (even before this started being disclosed for 'final';
+         *  just enable 'showexp' and look at normal status lines
+         *  after drinking gain level potions or eating wraith corpses
+         *  or being level-drained by vampires).
+         */
+        if (ulvl < 30 && (final || wizard)) {
+            long nxtlvl = newuexp(ulvl), delta = nxtlvl - u.uexp;
 
 #if 0 /*JP*/
-                Sprintf(eos(buf), ", %ld %s%sneeded to attain level %d",
-                        (nxtlvl - u.uexp), (u.uexp > 0) ? "more " : "",
-                        !final ? "" : "were ", (ulvl + 1));
+            Sprintf(eos(buf), ", %ld %s%sneeded %s level %d",
+                    delta, (u.uexp > 0) ? "more " : "",
+                    /* present tense=="needed", past tense=="were needed" */
+                    !final ? "" : (delta == 1L) ? "was " : "were ",
+                    /* "for": grammatically iffy but less likely to wrap */
+                    (ulvl < 18) ? "to attain" : "for", (ulvl + 1));
 #else
-                Sprintf(eos(buf), "(\83\8c\83x\83\8b%d\82Ü\82Å%ld\83|\83C\83\93\83g)",
-                        (ulvl + 1), (nxtlvl - u.uexp));
+            Sprintf(eos(buf), "(\83\8c\83x\83\8b%d\82Ü\82Å%ld\83|\83C\83\93\83g)",
+                    (ulvl + 1), delta);
 #endif
-            }
         }
         you_have(buf, "");
     }
@@ -2382,7 +2478,9 @@ basics_enlightenment(mode, final)
 int mode UNUSED;
 int final;
 {
+#if 0 /*JP*//*unused*/
     static char Power[] = "energy points (spell power)";
+#endif
     char buf[BUFSZ];
     int pw = u.uen, hp = (Upolyd ? u.mh : u.uhp),
         pwmax = u.uenmax, hpmax = (Upolyd ? u.mhmax : u.uhpmax);
@@ -2463,7 +2561,7 @@ int final;
 /*JP
             enl_msg(Your_wallet, "is ", "was ", "empty", "");
 */
-            enl_msg(Your_wallet, "\82Å\82 \82é", "\82ł¾\82Á\82½", "\82Í\8bó", "");
+            enl_msg(Your_wallet, "\82Å\82 \82é", "\82¾\82Á\82½", "\82Í\8bó", "");
         } else {
 #if 0 /*JP:T*/
             Sprintf(buf, "%ld %s", umoney, currency(umoney));
@@ -2494,16 +2592,14 @@ int final;
             Strcat(buf, " plus thrown");
 */
             Strcat(buf, "\82É\89Á\82¦\82Ä\93\8a\82°\82é\82à\82Ì");
-        if (iflags.autopickup_exceptions[AP_GRAB]
-            || iflags.autopickup_exceptions[AP_LEAVE])
+        if (apelist)
 /*JP
             Strcat(buf, ", with exceptions");
 */
             Strcat(buf, "(\97á\8aO\82 \82è)");
 #if 1 /*JP*/
-        Strcpy(buf, "\82É\91Î\82µ\82Ä\83I\83\93");
+        Strcat(buf, "\82É\91Î\82µ\82Ä\83I\83\93");
 #endif
-        
     } else
 /*JP
         Strcpy(buf, "off");
@@ -2527,7 +2623,7 @@ int final;
 /*JP
     Sprintf(buf, "%s Characteristics:", !final ? "Current" : "Final");
 */
-    Sprintf(buf, "%s\91®\90«\81F", !final ? "\8c»\8dÝ\82Ì" : "\8dÅ\8fI");
+    Sprintf(buf, "%s\93Á\90«\81F", !final ? "\8c»\8dÝ\82Ì" : "\8dÅ\8fI");
     enlght_out(buf);
 
     /* bottom line order */
@@ -2618,7 +2714,7 @@ int mode, final, attrindx;
 */
         paren_pfx = final ? " (" : " (\8c»\8dÝ; ";
         if (acurrent != abase) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             Sprintf(eos(valubuf), "%sbase:%s", paren_pfx,
                     attrval(attrindx, abase, valstring));
 #else
@@ -2628,7 +2724,7 @@ int mode, final, attrindx;
             paren_pfx = ", ";
         }
         if (abase != apeak) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             Sprintf(eos(valubuf), "%speak:%s", paren_pfx,
                     attrval(attrindx, apeak, valstring));
 #else
@@ -2638,7 +2734,7 @@ int mode, final, attrindx;
             paren_pfx = ", ";
         }
         if (interesting_alimit) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             Sprintf(eos(valubuf), "%s%slimit:%s", paren_pfx,
                     /* more verbose if exceeding 'limit' due to magic bonus */
                     (acurrent > alimit) ? "innate " : "",
@@ -2711,7 +2807,7 @@ int final;
     /* not a trouble, but we want to display riding status before maybe
        reporting steed as trapped or hero stuck to cursed saddle */
     if (Riding) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, "riding %s", steedname);
         you_are(buf, "");
 #else
@@ -2771,16 +2867,30 @@ int final;
         youhiding(TRUE, final);
 
     /* internal troubles, mostly in the order that prayer ranks them */
-    if (Stoned)
+    if (Stoned) {
+        if (final && (Stoned & I_SPECIAL))
+/*JP
+            enlght_out(" You turned into stone.");
+*/
+            enlght_out(" \82 \82È\82½\82Í\90Î\82É\82È\82Á\82½\81D");
+        else
 /*JP
-        you_are("turning to stone", "");
+            you_are("turning to stone", "");
 */
-        enl_msg("\82 \82È\82½\82Í", "\82È\82è\82Â\82Â\82 \82é", "\82È\82Á\82½", "\90Î\82É", "");
-    if (Slimed)
+            enl_msg("\82 \82È\82½\82Í", "\82È\82è\82Â\82Â\82 \82é", "\82È\82Á\82½", "\90Î\82É", "");
+    }
+    if (Slimed) {
+        if (final && (Slimed & I_SPECIAL))
+/*JP
+            enlght_out(" You turned into slime.");
+*/
+            enlght_out(" \82 \82È\82½\82Í\83X\83\89\83C\83\80\82É\82È\82Á\82½\81D");
+        else
 /*JP
-        you_are("turning into slime", "");
+            you_are("turning into slime", "");
 */
-        enl_msg("\82 \82È\82½\82Í", "\82È\82è\82Â\82Â\82 \82é", "\82È\82Á\82½", "\83X\83\89\83C\83\80\82É", "");
+            enl_msg("\82 \82È\82½\82Í", "\82È\82è\82Â\82Â\82 \82é", "\82È\82Á\82½", "\83X\83\89\83C\83\80\82É", "");
+    }
     if (Strangled) {
         if (u.uburied) {
 /*JP
@@ -2788,30 +2898,55 @@ int final;
 */
             you_are_ing("\92\82\91§\82µ\82Ä", "");
         } else {
+            if (final && (Strangled & I_SPECIAL)) {
 /*JP
-            Strcpy(buf, "being strangled");
+                enlght_out(" You died from strangulation.");
 */
-            Strcpy(buf, "\8eñ\82ð\8di\82ß\82ç\82ê\82Ä");
-            if (wizard)
-                Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT));
+                enlght_out(" \82 \82È\82½\82Í\92\82\91§\8e\80\82µ\82½\81D");
+            } else {
 /*JP
-            you_are(buf, from_what(STRANGLED));
+                Strcpy(buf, "being strangled");
 */
-            enl_msg("\82 \82È\82½\82Í", "\82¢\82é", "\82¢\82½", buf, from_what(STRANGLED));
+                Strcpy(buf, "\8eñ\82ð\8di\82ß\82ç\82ê\82Ä");
+                if (wizard)
+                    Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT));
+/*JP
+                you_are(buf, from_what(STRANGLED));
+*/
+                enl_msg("\82 \82È\82½\82Í", "\82¢\82é", "\82¢\82½", buf, from_what(STRANGLED));
+            }
         }
     }
     if (Sick) {
-        /* prayer lumps these together; botl puts Ill before FoodPois */
-        if (u.usick_type & SICK_NONVOMITABLE)
+        /* the two types of sickness are lumped together; hero can be
+           afflicted by both but there is only one timeout; botl status
+           puts TermIll before FoodPois and death due to timeout reports
+           terminal illness if both are in effect, so do the same here */
+        if (final && (Sick & I_SPECIAL)) {
+#if 0 /*JP:T*/
+            Sprintf(buf, " %sdied from %s.", You_, /* has trailing space */
+                    (u.usick_type & SICK_NONVOMITABLE)
+                    ? "terminal illness" : "food poisoning");
+#else
+            Sprintf(buf, " %s%s\82Å\8e\80\82ñ\82¾\81D", You_, /* has trailing space */
+                    (u.usick_type & SICK_NONVOMITABLE)
+                    ? "\95a\8bC" : "\90H\92\86\93Å");
+#endif
+            enlght_out(buf);
+        } else {
+            /* unlike death due to sickness, report the two cases separately
+               because it is possible to cure one without curing the other */
+            if (u.usick_type & SICK_NONVOMITABLE)
 /*JP
-            you_are("terminally sick from illness", "");
+                you_are("terminally sick from illness", "");
 */
-            enl_msg("\82 \82È\82½\82Í\95a\8bC\82Å\92v\96½\93I\82É\8bC\95ª\82ª\88«", "\82¢", "\82©\82Á\82½", "", "");
-        if (u.usick_type & SICK_VOMITABLE)
+                enl_msg("\82 \82È\82½\82Í\95a\8bC\82Å\92v\96½\93I\82É\8bC\95ª\82ª\88«", "\82¢", "\82©\82Á\82½", "", "");
+            if (u.usick_type & SICK_VOMITABLE)
 /*JP
-            you_are("terminally sick from food poisoning", "");
+                you_are("terminally sick from food poisoning", "");
 */
-            enl_msg("\82 \82È\82½\82Í\90H\92\86\93Å\82Å\92v\96½\93I\82É\8bC\95ª\82ª\88«", "\82¢", "\82©\82Á\82½", "", "");
+                enl_msg("\82 \82È\82½\82Í\90H\92\86\93Å\82Å\92v\96½\93I\82É\8bC\95ª\82ª\88«", "\82¢", "\82©\82Á\82½", "", "");
+        }
     }
     if (Vomiting)
 /*JP
@@ -2836,7 +2971,7 @@ int final;
     if (Blind) {
         /* from_what() (currently wizard-mode only) checks !haseyes()
            before u.uroleplay.blind, so we should too */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, "%s blind",
                 !haseyes(youmonst.data) ? "innately"
                 : u.uroleplay.blind ? "permanently"
@@ -2982,10 +3117,14 @@ int final;
     }
     if (Glib) {
 #if 0 /*JP*/
-        Sprintf(buf, "slippery %s", makeplural(body_part(FINGER)));
+        Sprintf(buf, "slippery %s", fingers_or_gloves(TRUE));
+        if (wizard)
+            Sprintf(eos(buf), " (%ld)", (Glib & TIMEOUT));
         you_have(buf, "");
 #else
         Sprintf(buf, "%s\82ª\82Ê\82é\82Ê\82é\82µ\82Ä", body_part(FINGER));
+        if (wizard)
+            Sprintf(eos(buf), " (%ld)", (Glib & TIMEOUT));
         enl_msg(buf, iru, ita, "", "");
 #endif
     }
@@ -3124,20 +3263,28 @@ int final;
         boolean hav = (sklvl != P_UNSKILLED && sklvl != P_SKILLED);
 
         if (sklvl == P_ISRESTRICTED)
+/*JP
             Strcpy(sklvlbuf, "no");
+*/
+            Strcpy(sklvlbuf, "\90§\8cÀ");
         else
             (void) lcase(skill_level_name(wtype, sklvlbuf));
         /* "you have no/basic/expert/master/grand-master skill with <skill>"
            or "you are unskilled/skilled in <skill>" */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, "%s %s %s", sklvlbuf,
                 hav ? "skill with" : "in", skill_name(wtype));
 #else
         Sprintf(buf, "%s\82Ì%s\83X\83L\83\8b", skill_name(wtype), sklvlbuf);
 #endif
         if (can_advance(wtype, FALSE))
+#if 0 /*JP:T*/
             Sprintf(eos(buf), " and %s that",
                     !final ? "can enhance" : "could have enhanced");
+#else
+            Sprintf(eos(buf), "(\8d\82\82ß\82é\82±\82Æ\82ª\82Å\82«%s)",
+                    !final ? "\82é" : "\82½");
+#endif
         if (hav)
             you_have(buf, "");
         else
@@ -3146,13 +3293,13 @@ int final;
     /* report 'nudity' */
     if (!uarm && !uarmu && !uarmc && !uarms && !uarmg && !uarmf && !uarmh) {
         if (u.uroleplay.nudist)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             enl_msg(You_, "do", "did", " not wear any armor", "");
 #else
             enl_msg(You_, "\82¢", "\82©\82Á\82½", "\89½\82Ì\8aZ\82à\91\95\94õ\82µ\82È", "");
 #endif
         else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             you_are("not wearing any armor", "");
 #else
             enl_msg(You_, "\82¢", "\82©\82Á\82½", "\89½\82Ì\8aZ\82à\91\95\94õ\82µ\82Ä\82¢\82È", "");
@@ -3161,7 +3308,7 @@ int final;
 }
 
 /* attributes: intrinsics and the like, other non-obvious capabilities */
-void
+STATIC_OVL void
 attributes_enlightenment(unused_mode, final)
 int unused_mode UNUSED;
 int final;
@@ -3183,7 +3330,7 @@ int final;
     enlght_out(final ? "\8dÅ\8fI\91®\90«:" : "\8c»\8dÝ\82Ì\91®\90«:");
 
     if (u.uevent.uhand_of_elbereth) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         static const char *const hofe_titles[3] = { "the Hand of Elbereth",
                                                     "the Envoy of Balance",
                                                     "the Glory of Arioch" };
@@ -3205,7 +3352,7 @@ int final;
         you_have(buf, "");
 
     if (wizard) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, " %d", u.ualign.record);
         enl_msg("Your alignment ", "is", "was", buf, "");
 #else
@@ -3276,7 +3423,7 @@ int final;
 */
         you_have("\90Î\89»\82Ö\82Ì\91Ï\90«", from_what(STONE_RES));
     if (Halluc_resistance)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         enl_msg(You_, "resist", "resisted", " hallucinations",
                 from_what(HALLUC_RES));
 #else
@@ -3302,7 +3449,7 @@ int final;
 */
             enl_msg("\82 \82È\82½\82Í\93§\96¾\82È\82à\82Ì\82ð\8c©\82ç\82ê", "\82é", "\82½", "", from_what(SEE_INVIS));
         else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             enl_msg(You_, "will see", "would have seen",
                     " invisible when not blind", from_what(SEE_INVIS));
 #else
@@ -3321,7 +3468,7 @@ int final;
 */
         you_have("\8cx\89ú\94\\97Í", from_what(WARNING));
     if (Warn_of_mon && context.warntype.obj) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, "aware of the presence of %s",
                 (context.warntype.obj & M2_ORC) ? "orcs"
                 : (context.warntype.obj & M2_ELF) ? "elves"
@@ -3403,9 +3550,9 @@ int final;
         enl_msg(You_, "could be", "could have been", " clairvoyant", buf);
 #else
         /*JP:\81u\81c\82É\82æ\82Á\82Ä\81v*/
-        if (!strncmp(buf, "\82É\82æ\82Á\82Ä", 8))
+        if (!STRNCMP2(buf, "\82É\82æ\82Á\82Ä"))
             /*JP:\81u\81c\82ª\82È\82¯\82ê\82Î\81v\82É\8f\91\82«\8a·\82¦\82é*/
-            strcpy(eos(buf) - 8, "\82ª\82È\82¯\82ê\82Î");
+            strcpy(eos(buf) - strlen("\82É\82æ\82Á\82Ä"), "\82ª\82È\82¯\82ê\82Î");
         you_have("\90ç\97¢\8aá\94\\97Í", buf);
 #endif
     }
@@ -3532,7 +3679,7 @@ int final;
 
         BFlying = 0L;
         if (Flying) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             enl_msg(You_, "would fly", "would have flown",
                     /* wording quibble: for past tense, "hadn't been"
                        would sound better than "weren't" (and
@@ -3644,7 +3791,7 @@ int final;
     if ((armpro = magic_negation(&youmonst)) > 0) {
         /* magic cancellation factor, conferred by worn armor */
         static const char *const mc_types[] = {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             "" /*ordinary*/, "warded", "guarded", "protected",
 #else
             "" /*ordinary*/, "\89q\82ç\82ê\82Ä", "\8cì\82ç\82ê\82Ä", "\8eç\82ç\82ê\82Ä",
@@ -3793,7 +3940,7 @@ int final;
     /*** Miscellany ***/
     if (Luck) {
         ltmp = abs((int) Luck);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, "%s%slucky",
                 ltmp >= 10 ? "extremely " : ltmp >= 5 ? "very " : "",
                 Luck < 0 ? "un" : "");
@@ -3961,7 +4108,7 @@ int final;
             case 1:
                 break; /* just "are dead" */
             default:
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 Sprintf(buf, " (%d%s time!)", u.umortality,
                         ordin(u.umortality));
 #else
@@ -4102,7 +4249,7 @@ minimal_enlightenment()
              "Deities", FALSE);
 */
              "\90_", FALSE);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC),
             (u.ualignbase[A_ORIGINAL] == u.ualign.type
              && u.ualign.type == A_CHAOTIC)               ? " (s,c)"
@@ -4121,7 +4268,7 @@ minimal_enlightenment()
     Sprintf(buf, fmtstr, "\8d¬\93×", buf2);
     add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL),
             (u.ualignbase[A_ORIGINAL] == u.ualign.type
              && u.ualign.type == A_NEUTRAL)               ? " (s,c)"
@@ -4140,7 +4287,7 @@ minimal_enlightenment()
     Sprintf(buf, fmtstr, "\92\86\97§", buf2);
     add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL),
             (u.ualignbase[A_ORIGINAL] == u.ualign.type
              && u.ualign.type == A_LAWFUL)                ? " (s,c)"
@@ -4249,7 +4396,7 @@ int msgflag;          /* for variant message phrasing */
             if (u.utrap && u.utraptype == TT_PIT) {
                 struct trap *t = t_at(u.ux, u.uy);
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 Sprintf(bp, " in a %spit",
                         (t && t->ttyp == SPIKED_PIT) ? "spiked " : "");
 #else
@@ -4351,7 +4498,7 @@ int final;
 */
         you_have_never("\82 \82È\82½\82Í\91\95\94õ\82µ\82Ä\82¢\82é\95\90\8aí\82Å\8dU\8c\82\82µ");
     } else if (wizard) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, "used a wielded weapon %ld time%s", u.uconduct.weaphit,
                 plur(u.uconduct.weaphit));
         you_have_X(buf);
@@ -4437,7 +4584,7 @@ int final;
 */
         you_have_never("\82 \82È\82½\82Í\8aè\82¢\8e\96\82ð\82µ");
     } else {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         Sprintf(buf, "used %ld wish%s", u.uconduct.wishes,
                 (u.uconduct.wishes > 1L) ? "es" : "");
 #else
@@ -4488,45 +4635,65 @@ int final;
 struct ext_func_tab extcmdlist[] = {
     { '#', "#", "perform an extended command",
             doextcmd, IFBURIED | GENERALCMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('?'), "?", "list all extended commands",
 #else
     { M('?'), "?", "\82±\82Ì\8ag\92£\83R\83}\83\93\83h\88ê\97\97\82ð\95\\8e¦\82·\82é",
 #endif
             doextlist, IFBURIED | AUTOCOMPLETE | GENERALCMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('a'), "adjust", "adjust inventory letters",
 #else
     { M('a'), "adjust", "\8e\9d\82¿\95¨\88ê\97\97\82Ì\92²\90®",
 #endif
             doorganize, IFBURIED | AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('A'), "annotate", "name current level",
 #else
     { M('A'), "annotate", "\8c»\8dÝ\82Ì\8aK\82É\96¼\91O\82ð\82Â\82¯\82é",
 #endif
             donamelevel, IFBURIED | AUTOCOMPLETE },
+#if 0 /*JP*/
     { 'a', "apply", "apply (use) a tool (pick-axe, key, lamp...)",
+#else
+    { 'a', "apply", "\93¹\8bï\82ð\8eg\82¤\81D(\82Â\82é\82Í\82µ, \8c®, \83\89\83\93\83v\81c)",
+#endif
             doapply },
     { C('x'), "attributes", "show your attributes",
             doattributes, IFBURIED },
+#if 0 /*JP:T*/
     { '@', "autopickup", "toggle the pickup option on/off",
+#else
+    { '@', "autopickup", "\8e©\93®\8fE\82¢\83I\83v\83V\83\87\83\93\82ð\90Ø\82è\91Ö\82¦\82é",
+#endif
             dotogglepickup, IFBURIED },
+#if 0 /*JP:T*/
     { 'C', "call", "call (name) something", docallcmd, IFBURIED },
+#else
+    { 'C', "call", "\96¼\91O\82ð\82Â\82¯\82é", docallcmd, IFBURIED },
+#endif
+#if 0 /*JP:T*/
     { 'Z', "cast", "zap (cast) a spell", docast, IFBURIED },
-#if 0 /*JP*/
+#else
+    { 'Z', "cast", "\8eô\95\82ð\8f¥\82¦\82é", docast, IFBURIED },
+#endif
+#if 0 /*JP:T*/
     { M('c'), "chat", "talk to someone", dotalk, IFBURIED | AUTOCOMPLETE },
 #else
     { M('c'), "chat", "\92N\82©\82Æ\98b\82·", dotalk, IFBURIED | AUTOCOMPLETE },
 #endif
+#if 0 /*JP:T*/
     { 'c', "close", "close a door", doclose },
-#if 0 /*JP*/
+#else
+    { 'c', "close", "\83h\83A\82ð\95Â\82ß\82é", doclose },
+#endif
+#if 0 /*JP:T*/
     { M('C'), "conduct", "list voluntary challenges you have maintained",
 #else
     { M('C'), "conduct", "\82Ç\82¤\82¢\82¤\8ds\93®\82ð\82Æ\82Á\82½\82©\8c©\82é",
 #endif
             doconduct, IFBURIED | AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('d'), "dip", "dip an object into something", dodip, AUTOCOMPLETE },
 #else
     { M('d'), "dip", "\89½\82©\82É\95¨\82ð\90Z\82·", dodip, AUTOCOMPLETE },
@@ -4536,20 +4703,20 @@ struct ext_func_tab extcmdlist[] = {
     { 'D', "droptype", "drop specific item types", doddrop },
     { 'e', "eat", "eat something", doeat },
     { 'E', "engrave", "engrave writing on the floor", doengrave },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('e'), "enhance", "advance or check weapon and spell skills",
 #else
     { M('e'), "enhance", "\95\90\8aí\8fn\97û\93x\82ð\8d\82\82ß\82é",
 #endif
             enhance_weapon_skill, IFBURIED | AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "exploremode", "enter explore (discovery) mode",
 #else
     { '\0', "exploremode", "\92T\8c\9f(\94­\8c©)\83\82\81[\83h\82É\93ü\82é",
 #endif
             enter_explore_mode, IFBURIED },
     { 'f', "fire", "fire ammunition from quiver", dofire },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('f'), "force", "force a lock", doforce, AUTOCOMPLETE },
 #else
     { M('f'), "force", "\8c®\82ð\82±\82\82 \82¯\82é", doforce, AUTOCOMPLETE },
@@ -4564,13 +4731,13 @@ struct ext_func_tab extcmdlist[] = {
     { 'i', "inventory", "show your inventory", ddoinv, IFBURIED },
     { 'I', "inventtype", "inventory specific item types",
             dotypeinv, IFBURIED },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('i'), "invoke", "invoke an object's special powers",
 #else
     { M('i'), "invoke", "\95¨\82Ì\93Á\95Ê\82È\97Í\82ð\8eg\82¤",
 #endif
             doinvoke, IFBURIED | AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('j'), "jump", "jump to another location", dojump, AUTOCOMPLETE },
 #else
     { M('j'), "jump", "\91¼\82Ì\88Ê\92u\82É\94ò\82Ñ\82¤\82Â\82é", dojump, AUTOCOMPLETE },
@@ -4580,45 +4747,45 @@ struct ext_func_tab extcmdlist[] = {
             dodiscovered, IFBURIED | GENERALCMD },
     { '`', "knownclass", "show discovered types for one class of objects",
             doclassdisco, IFBURIED | GENERALCMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "levelchange", "change experience level",
 #else
     { '\0', "levelchange", "\8co\8c±\83\8c\83x\83\8b\82ð\95Ï\82¦\82é",
 #endif
             wiz_level_change, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "lightsources", "show mobile light sources",
 #else
     { '\0', "lightsources", "\88Ú\93®\8cõ\8c¹\82ð\8c©\82é",
 #endif
             wiz_light_sources, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
     { ':', "look", "look at what is here", dolook, IFBURIED },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('l'), "loot", "loot a box on the floor", doloot, AUTOCOMPLETE },
 #else
     { M('l'), "loot", "\8f°\82Ì\8fã\82Ì\94 \82ð\8aJ\82¯\82é", doloot, AUTOCOMPLETE },
 #endif
 #ifdef DEBUG_MIGRATING_MONS
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "migratemons", "migrate N random monsters",
 #else
     { '\0', "migratemons", "\83\89\83\93\83_\83\80\82È\89ö\95¨\82ð\89½\91Ì\82©\88Ú\8fZ\82³\82¹\82é",
 #endif
             wiz_migrate_mons, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
 #endif
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('m'), "monster", "use monster's special ability",
 #else
     { M('m'), "monster", "\89ö\95¨\82Ì\93Á\95Ê\94\\97Í\82ð\8eg\82¤",
 #endif
             domonability, IFBURIED | AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { 'N', "name", "name a monster or an object",
 #else
     { 'N', "name", "\83A\83C\83e\83\80\82â\95¨\82É\96¼\91O\82ð\82Â\82¯\82é",
 #endif
             docallcmd, IFBURIED | AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('o'), "offer", "offer a sacrifice to the gods",
 #else
     { M('o'), "offer", "\90_\82É\8b\9f\95¨\82ð\95ù\82°\82é",
@@ -4627,13 +4794,13 @@ struct ext_func_tab extcmdlist[] = {
     { 'o', "open", "open a door", doopen },
     { 'O', "options", "show option settings, possibly change them",
             doset, IFBURIED | GENERALCMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { C('o'), "overview", "show a summary of the explored dungeon",
 #else
     { C('o'), "overview", "\92T\8dõ\82µ\82½\96À\8b{\82Ì\8aT\97v\82ð\95\\8e¦\82·\82é",
 #endif
             dooverview, IFBURIED | AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "panic", "test panic routine (fatal to game)",
 #else
     { '\0', "panic", "\83p\83j\83b\83N\83\8b\81[\83`\83\93\82ð\83e\83X\83g\82·\82é(\92v\96½\93I)",
@@ -4641,13 +4808,13 @@ struct ext_func_tab extcmdlist[] = {
             wiz_panic, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
     { 'p', "pay", "pay your shopping bill", dopay },
     { ',', "pickup", "pick up things at the current location", dopickup },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "polyself", "polymorph self",
 #else
     { '\0', "polyself", "\95Ï\89»\82·\82é",
 #endif
             wiz_polyself, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('p'), "pray", "pray to the gods for help",
 #else
     { M('p'), "pray", "\90_\82É\8bF\82é",
@@ -4657,7 +4824,7 @@ struct ext_func_tab extcmdlist[] = {
             doprev_message, IFBURIED | GENERALCMD },
     { 'P', "puton", "put on an accessory (ring, amulet, etc)", doputon },
     { 'q', "quaff", "quaff (drink) something", dodrink },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('q'), "quit", "exit without saving current game",
 #else
     { M('q'), "quit", "\83Z\81[\83u\82µ\82È\82¢\82Å\8fI\97¹",
@@ -4667,19 +4834,19 @@ struct ext_func_tab extcmdlist[] = {
     { 'r', "read", "read a scroll or spellbook", doread },
     { C('r'), "redraw", "redraw screen", doredraw, IFBURIED | GENERALCMD },
     { 'R', "remove", "remove an accessory (ring, amulet, etc)", doremring },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('R'), "ride", "mount or dismount a saddled steed",
 #else
     { M('R'), "ride", "\89ö\95¨\82É\8fæ\82é(\82Ü\82½\82Í\8d~\82è\82é)",
 #endif
             doride, AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('r'), "rub", "rub a lamp or a stone", dorub, AUTOCOMPLETE },
 #else
     { M('r'), "rub", "\83\89\83\93\83v\82ð\82±\82·\82é", dorub, AUTOCOMPLETE },
 #endif
     { 'S', "save", "save the game and exit", dosave, IFBURIED | GENERALCMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { 's', "search", "search for traps and secret doors",
             dosearch, IFBURIED, "searching" },
 #else
@@ -4692,7 +4859,7 @@ struct ext_func_tab extcmdlist[] = {
     { ARMOR_SYM, "seearmor", "show the armor currently worn",
             doprarm, IFBURIED },
     { GOLD_SYM, "seegold", "count your gold", doprgold, IFBURIED },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "seenv", "show seen vectors",
 #else
     { '\0', "seenv", "\8e\8b\90ü\83x\83N\83g\83\8b\82ð\8c©\82é",
@@ -4713,12 +4880,12 @@ struct ext_func_tab extcmdlist[] = {
                        | CMD_NOT_AVAILABLE
 #endif /* SHELL */
     },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('s'), "sit", "sit down", dosit, AUTOCOMPLETE },
 #else
     { M('s'), "sit", "\8dÀ\82é", dosit, AUTOCOMPLETE },
 #endif
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "stats", "show memory statistics",
 #else
     { '\0', "stats", "\83\81\83\82\83\8a\8fó\91Ô\82ð\8c©\82é",
@@ -4734,7 +4901,7 @@ struct ext_func_tab extcmdlist[] = {
     { 'T', "takeoff", "take off one piece of armor", dotakeoff },
     { 'A', "takeoffall", "remove all armor", doddoremarm },
     { C('t'), "teleport", "teleport around the level", dotelecmd, IFBURIED },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "terrain", "show map without obstructions",
 #else
     { '\0', "terrain", "\8e×\96\82\82³\82ê\82¸\82É\92n\90}\82ð\8c©\82é",
@@ -4744,56 +4911,56 @@ struct ext_func_tab extcmdlist[] = {
             "menu of commands you can do from here to adjacent spot",
             dotherecmdmenu },
     { 't', "throw", "throw something", dothrow },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "timeout", "look at timeout queue and hero's timed intrinsics",
 #else
     { '\0', "timeout", "\8e\9e\8aÔ\90Ø\82ê\83L\83\85\81[\82Æ\83v\83\8c\83C\83\84\81[\82Ì\8e\9e\8aÔ\8co\89ß\82ð\8c©\82é",
 #endif
             wiz_timeout_queue, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('T'), "tip", "empty a container", dotip, AUTOCOMPLETE },
 #else
     { M('T'), "tip", "\93ü\82ê\95¨\82ð\8bó\82É\82·\82é", dotip, AUTOCOMPLETE },
 #endif
     { '_', "travel", "travel to a specific location on the map", dotravel },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('t'), "turn", "turn undead away", doturn, IFBURIED | AUTOCOMPLETE },
 #else
     { M('t'), "turn", "\83A\83\93\83f\83b\83g\82ð\93y\82É\95Ô\82·", doturn, IFBURIED | AUTOCOMPLETE },
 #endif
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { 'X', "twoweapon", "toggle two-weapon combat",
 #else
     { 'X', "twoweapon", "\97¼\8eè\8e\9d\82¿\82Ì\90Ø\82è\91Ö\82¦",
 #endif
             dotwoweapon, AUTOCOMPLETE },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('u'), "untrap", "untrap something", dountrap, AUTOCOMPLETE },
 #else
     { M('u'), "untrap", "ã©\82ð\82Í\82¸\82·", dountrap, AUTOCOMPLETE },
 #endif
     { '<', "up", "go up a staircase", doup },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "vanquished", "list vanquished monsters",
 #else
     { '\0', "vanquished", "\93|\82µ\82½\89ö\95¨\82Ì\88ê\97\97\82ð\8c©\82é",
 #endif
             dovanquished, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
     { M('v'), "version",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             "list compile time options for this version of NetHack",
 #else
             "\83R\83\93\83p\83C\83\8b\8e\9e\82Ì\83I\83v\83V\83\87\83\93\82ð\95\\8e¦\82·\82é",
 #endif
             doextversion, IFBURIED | AUTOCOMPLETE | GENERALCMD },
     { 'v', "versionshort", "show version", doversion, IFBURIED | GENERALCMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "vision", "show vision array",
 #else
     { '\0', "vision", "\8e\8b\8aE\94z\97ñ\82ð\8c©\82é",
 #endif
             wiz_show_vision, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '.', "wait", "rest one move while doing nothing",
             donull, IFBURIED, "waiting" },
 #else
@@ -4805,13 +4972,13 @@ struct ext_func_tab extcmdlist[] = {
     { '/', "whatis", "show what type of thing a symbol corresponds to",
             dowhatis, IFBURIED | GENERALCMD },
     { 'w', "wield", "wield (put in use) a weapon", dowield },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { M('w'), "wipe", "wipe off your face", dowipe, AUTOCOMPLETE },
 #else
     { M('w'), "wipe", "\8aç\82ð\90@\82¤", dowipe, AUTOCOMPLETE },
 #endif
 #ifdef DEBUG
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "wizbury", "bury objs under and around you",
 #else
     { '\0', "wizbury", "\95¨\82ð\82 \82È\82½\82Ì\8eü\82è\82É\96\84\82ß\82é",
@@ -4832,13 +4999,13 @@ struct ext_func_tab extcmdlist[] = {
             wiz_makemap, IFBURIED | WIZMODECMD },
     { C('f'), "wizmap", "map the level",
             wiz_map, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "wizrumorcheck", "verify rumor boundaries",
 #else
     { '\0', "wizrumorcheck", "\89\\82Ì\8b«\8aE\82ð\8c\9f\8fØ\82·\82é",
 #endif
             wiz_rumor_check, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "wizsmell", "smell monster",
 #else
     { '\0', "wizsmell", "\89ö\95¨\82Ì\93õ\82¢\82ð\9ak\82®",
@@ -4848,7 +5015,7 @@ struct ext_func_tab extcmdlist[] = {
             wiz_where, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
     { C('w'), "wizwish", "wish for something",
             wiz_wish, IFBURIED | AUTOCOMPLETE | WIZMODECMD },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     { '\0', "wmode", "show wall modes",
 #else
     { '\0', "wmode", "\95Ç\83\82\81[\83h\82ð\8c©\82é",
@@ -4858,14 +5025,71 @@ struct ext_func_tab extcmdlist[] = {
     { '\0', (char *) 0, (char *) 0, donull, 0, (char *) 0 } /* sentinel */
 };
 
+/* for key2extcmddesc() to support dowhatdoes() */
+struct movcmd {
+    uchar k1, k2, k3, k4; /* 'normal', 'qwertz', 'numpad', 'phone' */
+    const char *txt, *alt; /* compass direction, screen direction */
+};
+static const struct movcmd movtab[] = {
+    { 'h', 'h', '4', '4', "west",      "left" },
+    { 'j', 'j', '2', '8', "south",     "down" },
+    { 'k', 'k', '8', '2', "north",     "up" },
+    { 'l', 'l', '6', '6', "east",      "right" },
+    { 'b', 'b', '1', '7', "southwest", "lower left" },
+    { 'n', 'n', '3', '9', "southeast", "lower right" },
+    { 'u', 'u', '9', '3', "northeast", "upper right" },
+    { 'y', 'z', '7', '1', "northwest", "upper left" },
+    {   0,   0,   0,   0,  (char *) 0, (char *) 0 }
+};
+
 int extcmdlist_length = SIZE(extcmdlist) - 1;
 
 const char *
 key2extcmddesc(key)
 uchar key;
 {
-    if (Cmd.commands[key] && Cmd.commands[key]->ef_txt)
-        return Cmd.commands[key]->ef_desc;
+    static char key2cmdbuf[48];
+    const struct movcmd *mov;
+    int k, c;
+    uchar M_5 = (uchar) M('5'), M_0 = (uchar) M('0');
+
+    /* need to check for movement commands before checking the extended
+       commands table because it contains entries for number_pad commands
+       that match !number_pad movement (like 'j' for "jump") */
+    key2cmdbuf[0] = '\0';
+    if (movecmd(k = key))
+        Strcpy(key2cmdbuf, "move"); /* "move or attack"? */
+    else if (movecmd(k = unctrl(key)))
+        Strcpy(key2cmdbuf, "rush");
+    else if (movecmd(k = (Cmd.num_pad ? unmeta(key) : lowc(key))))
+        Strcpy(key2cmdbuf, "run");
+    if (*key2cmdbuf) {
+        for (mov = &movtab[0]; mov->k1; ++mov) {
+            c = !Cmd.num_pad ? (!Cmd.swap_yz ? mov->k1 : mov->k2)
+                             : (!Cmd.phone_layout ? mov->k3 : mov->k4);
+            if (c == k) {
+                Sprintf(eos(key2cmdbuf), " %s (screen %s)",
+                        mov->txt, mov->alt);
+                return key2cmdbuf;
+            }
+        }
+    } else if (digit(key) || (Cmd.num_pad && digit(unmeta(key)))) {
+        key2cmdbuf[0] = '\0';
+        if (!Cmd.num_pad)
+            Strcpy(key2cmdbuf, "start of, or continuation of, a count");
+        else if (key == '5' || key == M_5)
+            Sprintf(key2cmdbuf, "%s prefix",
+                    (!!Cmd.pcHack_compat ^ (key == M_5)) ? "run" : "rush");
+        else if (key == '0' || (Cmd.pcHack_compat && key == M_0))
+            Strcpy(key2cmdbuf, "synonym for 'i'");
+        if (*key2cmdbuf)
+            return key2cmdbuf;
+    }
+    if (Cmd.commands[key]) {
+        if (Cmd.commands[key]->ef_txt)
+            return Cmd.commands[key]->ef_desc;
+
+    }
     return (char *) 0;
 }
 
@@ -5010,11 +5234,17 @@ dokeylist(VOID_ARGS)
 
     datawin = create_nhwindow(NHW_TEXT);
     putstr(datawin, 0, "");
+/*JP
     putstr(datawin, 0, "            Full Current Key Bindings List");
+*/
+    putstr(datawin, 0, "             \8c»\8dÝ\82Ì\8a®\91S\82È\83L\81[\8a\84\82è\93\96\82Ä\88ê\97\97");
 
     /* directional keys */
     putstr(datawin, 0, "");
+/*JP
     putstr(datawin, 0, "Directional keys:");
+*/
+    putstr(datawin, 0, "\95û\8cü\83L\81[:");
     show_direction_keys(datawin, '.', FALSE); /* '.'==self in direction grid */
 
     keys_used[(uchar) Cmd.move_NW] = keys_used[(uchar) Cmd.move_N]
@@ -5041,16 +5271,31 @@ dokeylist(VOID_ARGS)
             = keys_used[(uchar) C(Cmd.move_S)]
             = keys_used[(uchar) C(Cmd.move_SE)] = TRUE;
         putstr(datawin, 0, "");
+#if 0 /*JP:T*/
         putstr(datawin, 0,
           "Shift-<direction> will move in specified direction until you hit");
         putstr(datawin, 0, "        a wall or run into something.");
+#else
+        putstr(datawin, 0,
+          "Shift-<\95û\8cü> \82Í\81A\95Ç\82É\82Ô\82Â\82©\82é\82©\89½\82©\82ª\82 \82é\82Ü\82Å\8ew\92è\82³\82ê\82½\95û\8cü\82É");
+        putstr(datawin, 0, "        \88Ú\93®\82·\82é\81D");
+#endif
+#if 0 /*JP:T*/
         putstr(datawin, 0,
           "Ctrl-<direction> will run in specified direction until something");
         putstr(datawin, 0, "        very interesting is seen.");
+#else
+        putstr(datawin, 0,
+          "Ctrl-<\95û\8cü> \82Í\81A\89½\82©\8b»\96¡\90[\82¢\82à\82Ì\82ª\8c©\82¦\82é\82Ü\82Å\8ew\92è\82³\82ê\82½\95û\8cü\82É");
+        putstr(datawin, 0, "        \88Ú\93®\82·\82é\81D");
+#endif
     }
 
     putstr(datawin, 0, "");
+/*JP
     putstr(datawin, 0, "Miscellaneous keys:");
+*/
+    putstr(datawin, 0, "\97l\81X\82È\83L\81[:");
     for (i = 0; misc_keys[i].desc; i++) {
         key = Cmd.spkeys[misc_keys[i].nhkf];
         if (key && ((misc_keys[i].numpad && iflags.num_pad)
@@ -5070,21 +5315,30 @@ dokeylist(VOID_ARGS)
 
     if (dokeylist_putcmds(datawin, TRUE, GENERALCMD, WIZMODECMD, keys_used)) {
         putstr(datawin, 0, "");
+/*JP
         putstr(datawin, 0, "General commands:");
+*/
+        putstr(datawin, 0, "\88ê\94Ê\83R\83}\83\93\83h:");
         (void) dokeylist_putcmds(datawin, FALSE, GENERALCMD, WIZMODECMD,
                                  keys_used);
     }
 
     if (dokeylist_putcmds(datawin, TRUE, 0, WIZMODECMD, keys_used)) {
         putstr(datawin, 0, "");
+/*JP
         putstr(datawin, 0, "Game commands:");
+*/
+        putstr(datawin, 0, "\83Q\81[\83\80\83R\83}\83\93\83h:");
         (void) dokeylist_putcmds(datawin, FALSE, 0, WIZMODECMD, keys_used);
     }
 
     if (wizard
         && dokeylist_putcmds(datawin, TRUE, WIZMODECMD, 0, keys_used)) {
         putstr(datawin, 0, "");
+/*JP
         putstr(datawin, 0, "Wizard-mode commands:");
+*/
+        putstr(datawin, 0, "\83E\83B\83U\81[\83h\83\82\81[\83h\83R\83}\83\93\83h:");
         (void) dokeylist_putcmds(datawin, FALSE, WIZMODECMD, 0, keys_used);
     }
 
@@ -5536,9 +5790,6 @@ wiz_migrate_mons()
 }
 #endif
 
-#define unctrl(c) ((c) <= C('z') ? (0x60 | (c)) : (c))
-#define unmeta(c) (0x7f & (c))
-
 struct {
     int nhkf;
     char key;
@@ -5872,21 +6123,51 @@ int NDECL((*cmd_func));
 char
 randomkey()
 {
-    static int i = 0;
+    static unsigned i = 0;
     char c;
 
-    switch (rn2(12)) {
-    default: c = '\033'; break;
-    case 0: c = '\n'; break;
+    switch (rn2(16)) {
+    default:
+        c = '\033';
+        break;
+    case 0:
+        c = '\n';
+        break;
     case 1:
     case 2:
     case 3:
-    case 4: c = (char)(' ' + rn2((int)('~' - ' '))); break;
-    case 5: c = '\t'; break;
-    case 6: c = (char)('a' + rn2((int)('z' - 'a'))); break;
-    case 7: c = (char)('A' + rn2((int)('Z' - 'A'))); break;
-    case 8: c = extcmdlist[(i++) % SIZE(extcmdlist)].key; break;
-    case 9: c = '#'; break;
+    case 4:
+        c = (char) rn1('~' - ' ' + 1, ' ');
+        break;
+    case 5:
+        c = (char) (rn2(2) ? '\t' : ' ');
+        break;
+    case 6:
+        c = (char) rn1('z' - 'a' + 1, 'a');
+        break;
+    case 7:
+        c = (char) rn1('Z' - 'A' + 1, 'A');
+        break;
+    case 8:
+        c = extcmdlist[i++ % SIZE(extcmdlist)].key;
+        break;
+    case 9:
+        c = '#';
+        break;
+    case 10:
+    case 11:
+    case 12:
+        c = Cmd.dirchars[rn2(8)];
+        if (!rn2(7))
+            c = !Cmd.num_pad ? (!rn2(3) ? C(c) : (c + 'A' - 'a')) : M(c);
+        break;
+    case 13:
+        c = (char) rn1('9' - '0' + 1, '0');
+        break;
+    case 14:
+        /* any char, but avoid '\0' because it's used for mouse click */
+        c = (char) rnd(iflags.wc_eight_bit_input ? 255 : 127);
+        break;
     }
 
     return c;
@@ -6295,7 +6576,7 @@ const char *s;
     char dirsym;
     int is_mov;
 
-retry:
+ retry:
     if (in_doagain || *readchar_queue)
         dirsym = readchar();
     else
@@ -6412,13 +6693,25 @@ const char *msg;
      * general message if it's on.
      */
     dothat = "do that";
+#if 0 /*JP*/
     how = " at"; /* for "<action> at yourself"; not used for up/down */
+#else
+    how = "";
+#endif
     switch (spkey) {
     case NHKF_NOPICKUP:
+#if 0 /*JP*/
         dothat = "move";
+#else
+        dothat = "\88Ú\93®\82·\82é";
+#endif
         break;
     case NHKF_RUSH:
+#if 0 /*JP*/
         dothat = "rush";
+#else
+        dothat = "\93Ë\90i\82·\82é";
+#endif
         break;
     case NHKF_RUN2:
         if (!Cmd.num_pad)
@@ -6426,14 +6719,22 @@ const char *msg;
         /*FALLTHRU*/
     case NHKF_RUN:
     case NHKF_RUN_NOPICKUP:
+#if 0 /*JP*/
         dothat = "run";
+#else
+        dothat = "\91\96\82é";
+#endif
         break;
     case NHKF_FIGHT2:
         if (!Cmd.num_pad)
             break;
         /*FALLTHRU*/
     case NHKF_FIGHT:
+#if 0 /*JP*/
         dothat = "fight";
+#else
+        dothat = "\90í\82¤";
+#endif
         how = ""; /* avoid "fight at yourself" */
         break;
     default:
@@ -6447,13 +6748,21 @@ const char *msg;
     if (prefixhandling
         && (sym == Cmd.spkeys[NHKF_GETDIR_SELF]
             || (Cmd.num_pad && sym == Cmd.spkeys[NHKF_GETDIR_SELF2]))) {
+/*JP
         Sprintf(buf, "You can't %s%s yourself.", dothat, how);
+*/
+        Sprintf(buf, "\8e©\95ª\8e©\90g\82É%s%s\82±\82Æ\82Í\82Å\82«\82È\82¢\81D", dothat, how);
     /* for movement prefix followed by up or down */
     } else if (prefixhandling && (sym == '<' || sym == '>')) {
+#if 0 /*JP*/
         Sprintf(buf, "You can't %s %s.", dothat,
                 /* was "upwards" and "downwards", but they're considered
                    to be variants of canonical "upward" and "downward" */
                 (sym == '<') ? "upward" : "downward");
+#else
+        Sprintf(buf, "%s%s\82±\82Æ\82Í\82Å\82«\82È\82¢\81D",
+                (sym == '<') ? "\8fã\95û\8cü\82É" : "\89º\95û\8cü\82É", dothat);
+#endif
     }
 
     /* if '!cmdassist', display via pline() and we're done (note: asking
@@ -6461,8 +6770,13 @@ const char *msg;
     if (!viawindow) {
         if (prefixhandling) {
             if (!*buf)
+#if 0 /*JP*/
                 Sprintf(buf, "Invalid direction for '%s' prefix.",
                         visctrl(Cmd.spkeys[spkey]));
+#else
+                Sprintf(buf, "'%s'\90Ú\93ª\8e«\82É\82Í\95s\90³\82È\95û\8cü\81D",
+                        visctrl(Cmd.spkeys[spkey]));
+#endif
             pline("%s", buf);
             return TRUE;
         }
@@ -6505,14 +6819,14 @@ const char *msg;
         }
     }
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     Sprintf(buf, "Valid direction keys%s%s%s are:",
             prefixhandling ? " to " : "", prefixhandling ? dothat : "",
             NODIAG(u.umonnum) ? " in your current form" : "");
 #else
-    Sprintf(buf, "%s%s%s\82Å\82Ì\97L\8cø\82È\95û\8cü\8ew\92è\82Í:",
-            prefixhandling ? " to " : "", prefixhandling ? dothat : "",
-            NODIAG(u.umonnum) ? " in your current form" : "");
+    Sprintf(buf, "%s%s%s\97L\8cø\82È\95û\8cü\8ew\92è\82Í:",
+            prefixhandling ? dothat : "", prefixhandling ? "\82½\82ß\82Ì" : "",
+            NODIAG(u.umonnum) ? " \8c»\8dÝ\82Ì\8ep\82Å\82Ì" : "");
 #endif
     putstr(win, 0, buf);
     show_direction_keys(win, !prefixhandling ? '.' : ' ', NODIAG(u.umonnum));
@@ -6523,13 +6837,24 @@ const char *msg;
            given but we include up and down for 'm'+invalid_direction;
            self is excluded as a viable direction for every prefix */
         putstr(win, 0, "");
+/*JP
         putstr(win, 0, "          <  up");
+*/
+        putstr(win, 0, "          <  \8fã");
+/*JP
         putstr(win, 0, "          >  down");
+*/
+        putstr(win, 0, "          >  \89º");
         if (!prefixhandling) {
             int selfi = Cmd.num_pad ? NHKF_GETDIR_SELF2 : NHKF_GETDIR_SELF;
 
+#if 0 /*JP:T*/
             Sprintf(buf,   "       %4s  direct at yourself",
                     visctrl(Cmd.spkeys[selfi]));
+#else
+            Sprintf(buf,   "       %4s  \8e©\95ª\82É\8cü\82¯\82é",
+                    visctrl(Cmd.spkeys[selfi]));
+#endif
             putstr(win, 0, buf);
         }
     }
@@ -7151,7 +7476,7 @@ end_of_input()
 #ifdef NOSAVEONHANGUP
 #ifdef INSURANCE
     if (flags.ins_chkpt && program_state.something_worth_saving)
-        program_statue.preserve_locks = 1; /* keep files for recovery */
+        program_state.preserve_locks = 1; /* keep files for recovery */
 #endif
     program_state.something_worth_saving = 0; /* don't save */
 #endif
@@ -7330,19 +7655,27 @@ const char *prompt;
        to give the go-ahead for this query; default is "no" unless the
        ParanoidConfirm flag is set in which case there's no default */
     if (be_paranoid) {
-        char qbuf[QBUFSZ], ans[BUFSZ] = DUMMY;
-        const char *promptprefix = "", *responsetype = ParanoidConfirm
-                                                           ? "(yes|no)"
-                                                           : "(yes) [no]";
-        int trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */
+        char pbuf[BUFSZ], qbuf[QBUFSZ], ans[BUFSZ];
+        const char *promptprefix = "",
+                *responsetype = ParanoidConfirm ? "(yes|no)" : "(yes) [no]";
+        int k, trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */
 
+        copynchars(pbuf, prompt, BUFSZ - 1);
         /* in addition to being paranoid about this particular
            query, we might be even more paranoid about all paranoia
            responses (ie, ParanoidConfirm is set) in which case we
            require "no" to reject in addition to "yes" to confirm
            (except we won't loop if response is ESC; it means no) */
         do {
-            Sprintf(qbuf, "%s%s %s", promptprefix, prompt, responsetype);
+            /* make sure we won't overflow a QBUFSZ sized buffer */
+            k = (int) (strlen(promptprefix) + 1 + strlen(responsetype));
+            if ((int) strlen(pbuf) + k > QBUFSZ - 1) {
+                /* chop off some at the end */
+                Strcpy(pbuf + (QBUFSZ - 1) - k - 4, "...?"); /* -4: "...?" */
+            }
+
+            Sprintf(qbuf, "%s%s %s", promptprefix, pbuf, responsetype);
+            *ans = '\0';
             getlin(qbuf, ans);
             (void) mungspaces(ans);
             confirmed_ok = !strcmpi(ans, "yes");