OSDN Git Service

Refactor do_cmd_knowledge_quests_completed and do_cmd_knowledge_quests_failed functions
[hengband/hengband.git] / src / cmd4.c
index 57063e9..e07368d 100644 (file)
@@ -386,7 +386,7 @@ errr do_cmd_write_nikki(int type, int num, cptr note)
                p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
 
                /* Get the quest text */
-               init_flags = INIT_ASSIGN;
+               init_flags = INIT_NAME_ONLY;
 
                process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
@@ -1090,11 +1090,15 @@ void do_cmd_nikki(void)
                prt("(2) Ê¸¾Ï¤òµ­Ï¿¤¹¤ë", 5, 5);
                prt("(3) Ä¾Á°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµ­Ï¿¤¹¤ë", 6, 5);
                prt("(4) µ­Ï¿¤ò¾Ãµî¤¹¤ë", 7, 5);
+
+               prt("(R) ¥×¥ì¥¤Æ°²è¤òµ­Ï¿¤¹¤ë/Ãæ»ß¤¹¤ë", 9, 5);
 #else
                prt("(1) Display your record", 4, 5);
                prt("(2) Add record", 5, 5);
                prt("(3) Record item you last get/identify", 6, 5);
                prt("(4) Delete your record", 7, 5);
+
+               prt("(R) Record playing movie / or stop it", 9, 5);
 #endif
 
 
@@ -1126,6 +1130,10 @@ void do_cmd_nikki(void)
                case '4':
                        do_cmd_erase_nikki();
                        break;
+               case 'r': case 'R':
+                       screen_load();
+                       prepare_movie_hooks();
+                       return;
                default: /* Unknown option */
                        bell();
                }
@@ -1344,8 +1352,10 @@ void do_cmd_messages(int num_now)
 {
        int i, n;
 
-       char shower[80];
-       char finder[80];
+       char shower_str[81];
+       char finder_str[81];
+       char back_str[81];
+       cptr shower = NULL;
        int wid, hgt;
        int num_lines;
 
@@ -1356,11 +1366,10 @@ void do_cmd_messages(int num_now)
        num_lines = hgt - 4;
 
        /* Wipe finder */
-       strcpy(finder, "");
+       strcpy(finder_str, "");
 
        /* Wipe shower */
-       strcpy(shower, "");
-
+       strcpy(shower_str, "");
 
        /* Total messages */
        n = message_num();
@@ -1386,10 +1395,10 @@ void do_cmd_messages(int num_now)
                        cptr msg = message_str(i+j);
 
                        /* Dump the messages, bottom to top */
-                       c_prt((i+j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
+                       c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
 
                        /* Hilite "shower" */
-                       if (shower[0])
+                       if (shower && shower[0])
                        {
                                cptr str = msg;
 
@@ -1417,13 +1426,12 @@ void do_cmd_messages(int num_now)
 #ifdef JP
                /* translation */
                prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
-                          i, i+j-1, n), 0, 0);
+                          i, i + j - 1, n), 0, 0);
 #else
                prt(format("Message Recall (%d-%d of %d)",
-                          i, i+j-1, n), 0, 0);
+                          i, i + j - 1, n), 0, 0);
 #endif
 
-
                /* Display prompt (not very informative) */
 #ifdef JP
                prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
@@ -1431,7 +1439,6 @@ void do_cmd_messages(int num_now)
                prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
 #endif
 
-
                /* Get a command */
                skey = inkey_special(TRUE);
 
@@ -1441,9 +1448,10 @@ void do_cmd_messages(int num_now)
                /* Hack -- Save the old index */
                j = i;
 
-               /* Hack -- handle show */
-               if (skey == '=')
+               switch (skey)
                {
+               /* Hack -- handle show */
+               case '=':
                        /* Prompt */
 #ifdef JP
                        prt("¶¯Ä´: ", hgt - 1, 0);
@@ -1451,104 +1459,121 @@ void do_cmd_messages(int num_now)
                        prt("Show: ", hgt - 1, 0);
 #endif
 
-
                        /* Get a "shower" string, or continue */
-                       if (!askfor(shower, 80)) continue;
+                       strcpy(back_str, shower_str);
+                       if (askfor(shower_str, 80))
+                       {
+                               /* Show it */
+                               shower = shower_str[0] ? shower_str : NULL;
+                       }
+                       else strcpy(shower_str, back_str);
 
                        /* Okay */
                        continue;
-               }
 
                /* Hack -- handle find */
-               if (skey == '/' || skey == KTRL('s'))
-               {
-                       int z;
+               case '/':
+               case KTRL('s'):
+                       {
+                               int z;
 
-                       /* Prompt */
+                               /* Prompt */
 #ifdef JP
-                       prt("¸¡º÷: ", hgt - 1, 0);
+                               prt("¸¡º÷: ", hgt - 1, 0);
 #else
-                       prt("Find: ", hgt - 1, 0);
+                               prt("Find: ", hgt - 1, 0);
 #endif
 
+                               /* Get a "finder" string, or continue */
+                               strcpy(back_str, finder_str);
+                               if (!askfor(finder_str, 80))
+                               {
+                                       strcpy(finder_str, back_str);
+                                       continue;
+                               }
+                               else if (!finder_str[0])
+                               {
+                                       shower = NULL; /* Stop showing */
+                                       continue;
+                               }
 
-                       /* Get a "finder" string, or continue */
-                       if (!askfor(finder, 80)) continue;
-
-                       /* Show it */
-                       strcpy(shower, finder);
-
-                       /* Scan messages */
-                       for (z = i + 1; z < n; z++)
-                       {
-                               cptr msg = message_str(z);
+                               /* Show it */
+                               shower = finder_str;
 
-                               /* Search for it */
-                               if (my_strstr(msg, finder))
+                               /* Scan messages */
+                               for (z = i + 1; z < n; z++)
                                {
-                                       /* New location */
-                                       i = z;
+                                       cptr msg = message_str(z);
 
-                                       /* Done */
-                                       break;
+                                       /* Search for it */
+                                       if (my_strstr(msg, finder_str))
+                                       {
+                                               /* New location */
+                                               i = z;
+
+                                               /* Done */
+                                               break;
+                                       }
                                }
                        }
-               }
+                       break;
 
                /* Recall 1 older message */
-               if (skey == SKEY_TOP)
-               {
+               case SKEY_TOP:
                        /* Go to the oldest line */
                        i = n - num_lines;
-               }
+                       break;
 
                /* Recall 1 newer message */
-               if (skey == SKEY_BOTTOM)
-               {
+               case SKEY_BOTTOM:
                        /* Go to the newest line */
                        i = 0;
-               }
+                       break;
 
                /* Recall 1 older message */
-               if (skey == '8' || skey == SKEY_UP || skey == '\n' || skey == '\r')
-               {
+               case '8':
+               case SKEY_UP:
+               case '\n':
+               case '\r':
                        /* Go older if legal */
                        i = MIN(i + 1, n - num_lines);
-               }
+                       break;
 
                /* Recall 10 older messages */
-               if (skey == '+')
-               {
+               case '+':
                        /* Go older if legal */
                        i = MIN(i + 10, n - num_lines);
-               }
+                       break;
 
                /* Recall 20 older messages */
-               if (skey == 'p' || skey == KTRL('P') || skey == ' ' || skey == SKEY_PGUP)
-               {
+               case 'p':
+               case KTRL('P'):
+               case ' ':
+               case SKEY_PGUP:
                        /* Go older if legal */
                        i = MIN(i + num_lines, n - num_lines);
-               }
+                       break;
 
                /* Recall 20 newer messages */
-               if (skey == 'n' || skey == KTRL('N') || skey == SKEY_PGDOWN)
-               {
+               case 'n':
+               case KTRL('N'):
+               case SKEY_PGDOWN:
                        /* Go newer (if able) */
                        i = MAX(0, i - num_lines);
-               }
+                       break;
 
                /* Recall 10 newer messages */
-               if (skey == '-')
-               {
+               case '-':
                        /* Go newer (if able) */
                        i = MAX(0, i - 10);
-               }
+                       break;
 
                /* Recall 1 newer messages */
-               if (skey == '2' || skey == SKEY_DOWN)
-               {
+               case '2':
+               case SKEY_DOWN:
                        /* Go newer (if able) */
                        i = MAX(0, i - 1);
+                       break;
                }
 
                /* Hack -- Error of some kind */
@@ -2311,6 +2336,55 @@ static void do_cmd_options_win(void)
 
 
 
+#define OPT_NUM 15
+
+static struct opts
+{
+       char key;
+       cptr name;
+       int row;
+}
+option_fields[OPT_NUM] =
+{
+#ifdef JP
+       { '1', "    ¥­¡¼ÆþÎÏ     ¥ª¥×¥·¥ç¥ó", 3 },
+       { '2', "   ¥Þ¥Ã¥×²èÌÌ    ¥ª¥×¥·¥ç¥ó", 4 },
+       { '3', "  ¥Æ¥­¥¹¥Èɽ¼¨   ¥ª¥×¥·¥ç¥ó", 5 },
+       { '4', "  ¥²¡¼¥à¥×¥ì¥¤   ¥ª¥×¥·¥ç¥ó", 6 },
+       { '5', "  ¹ÔÆ°Ãæ»ß´Ø·¸   ¥ª¥×¥·¥ç¥ó", 7 },
+       { '6', "  ´Ê°×¼«Æ°Ç˲õ   ¥ª¥×¥·¥ç¥ó", 8 },
+       { 'r', "   ¥×¥ì¥¤µ­Ï¿    ¥ª¥×¥·¥ç¥ó", 9 },
+
+       { 'p', "¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 11 },
+       { 'd', " ´ðËÜ¥¦¥§¥¤¥ÈÎÌ ", 12 },
+       { 'h', "Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È", 13 },
+       { 'm', "  ÄãËâÎÏ¿§ïçÃÍ  ", 14 },
+       { 'a', "   ¼«Æ°¥»¡¼¥Ö    ¥ª¥×¥·¥ç¥ó", 15 },
+       { 'w', "¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 16 },
+
+       { 'b', "      ½é´ü       ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 18 },
+       { 'c', "      º¾µ½       ¥ª¥×¥·¥ç¥ó", 19 },
+#else
+       { '1', "Input Options", 3 },
+       { '2', "Map Screen Options", 4 },
+       { '3', "Text Display Options", 5 },
+       { '4', "Game-Play Options", 6 },
+       { '5', "Disturbance Options", 7 },
+       { '6', "Easy Auto-Destroyer Options", 8 },
+       { 'r', "Play record Options", 9 },
+
+       { 'p', "Auto-picker/destroyer editor", 11 },
+       { 'd', "Base Delay Factor", 12 },
+       { 'h', "Hitpoint Warning", 13 },
+       { 'm', "Mana Color Threshold", 14 },
+       { 'a', "Autosave Options", 15 },
+       { 'w', "Window Flags", 16 },
+
+       { 'b', "Birth Options (Browse Only)", 18 },
+       { 'c', "Cheat Options", 19 },
+#endif
+};
+
 
 /*
  * Set or unset various options.
@@ -2320,8 +2394,9 @@ static void do_cmd_options_win(void)
  */
 void do_cmd_options(void)
 {
-       int k;
-
+       char k;
+       int i, d, skey;
+       int y = 0;
 
        /* Save the screen */
        screen_save();
@@ -2329,6 +2404,11 @@ void do_cmd_options(void)
        /* Interact */
        while (1)
        {
+               int n = OPT_NUM;
+
+               /* Does not list cheat option when cheat option is off */
+               if (!p_ptr->noscore && !allow_debug_opts) n--;
+
                /* Clear screen */
                Term_clear();
 
@@ -2336,87 +2416,58 @@ void do_cmd_options(void)
 #ifdef JP
                prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
 #else
-               prt("Options", 1, 0);
+               prt("TinyAngband options", 1, 0);
 #endif
 
-
-               /* Give some choices */
-#ifdef JP
-               prt("(1)      ¥­¡¼ÆþÎÏ        ¥ª¥×¥·¥ç¥ó", 2, 5);
-               prt("(2)     ¥Þ¥Ã¥×²èÌÌ       ¥ª¥×¥·¥ç¥ó", 3, 5);
-               prt("(3)    ¥Æ¥­¥¹¥Èɽ¼¨      ¥ª¥×¥·¥ç¥ó", 4, 5);
-               prt("(4)    ¥²¡¼¥à¥×¥ì¥¤      ¥ª¥×¥·¥ç¥ó", 5, 5);
-               prt("(5)    ¹ÔÆ°Ãæ»ß´Ø·¸      ¥ª¥×¥·¥ç¥ó", 6, 5);
-               prt("(6)    ´Ê°×¼«Æ°Ç˲õ      ¥ª¥×¥·¥ç¥ó", 7, 5);
-               prt("(R)     ¥×¥ì¥¤µ­Ï¿       ¥ª¥×¥·¥ç¥ó", 8, 5);
-
-               /* Special choices */
-               prt("(P)  ¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 10, 5);
-               prt("(D)   ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
-               prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
-               prt("(M)    ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
-               prt("(A)     ¼«Æ°¥»¡¼¥Ö       ¥ª¥×¥·¥ç¥ó", 14, 5);
-               /* Window flags */
-               prt("(W)  ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
-#else
-               prt("(1) Input Options", 2, 5);
-               prt("(2) Map Screen Options", 3, 5);
-               prt("(3) Text Display Options", 4, 5);
-               prt("(4) Game-Play Options", 5, 5);
-               prt("(5) Disturbance Options", 6, 5);
-               prt("(6) Easy Auto-Destroyer Options", 7, 5);
-               prt("(R) Play-record Options", 8, 5);
-               /* Special choices */
-               prt("(P) Auto-picker/destroyer editor", 10, 5);
-               prt("(D) Base Delay Factor", 11, 5);
-               prt("(H) Hitpoint Warning", 12, 5);
-               prt("(M) Mana Color Threshold", 13, 5);
-               prt("(A) Autosave Options", 14, 5);
-               /* Window flags */
-               prt("(W) Window Flags", 15, 5);
-#endif
-
-               if (!p_ptr->wizard || !allow_debug_opts)
-               {
-                       /* Birth */
-#ifdef JP
-                       prt("(B)        ½é´ü          ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
-#else
-                       prt("(B) Birth Options (Browse Only)", 16, 5);
-#endif
-               }
-               else
+               while(1)
                {
-                       /* Birth */
+                       /* Give some choices */
+                       for (i = 0; i < n; i++)
+                       {
+                               byte a = TERM_WHITE;
+                               if (i == y) a = TERM_L_BLUE;
+                               Term_putstr(5, option_fields[i].row, -1, a, 
+                                       format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
+                       }
+
 #ifdef JP
-                       prt("(B)        ½é´ü          ¥ª¥×¥·¥ç¥ó", 16, 5);
+                       prt("<Êý¸þ>¤Ç°ÜÆ°, Enter¤Ç·èÄê, ESC¤Ç¥­¥ã¥ó¥»¥ë, ?¤Ç¥Ø¥ë¥×: ", 21, 0);
 #else
-                       prt("(B) Birth Options", 16, 5);
+                       prt("Move to <dir>, Select to Enter, Cancel to ESC, ? to help: ", 21, 0);
 #endif
-               }
 
+                       /* Get command */
+                       skey = inkey_special(TRUE);
+                       if (!(skey & SKEY_MASK)) k = (char)skey;
+                       else k = 0;
 
-               if (p_ptr->noscore || allow_debug_opts)
-               {
-                       /* Cheating */
-#ifdef JP
-                       prt("(C)        º¾µ½          ¥ª¥×¥·¥ç¥ó", 17, 5);
-#else
-                       prt("(C) Cheating Options", 17, 5);
-#endif
-               }
+                       /* Exit */
+                       if (k == ESCAPE) break;
 
+                       if (my_strchr("\n\r ", k))
+                       {
+                               k = option_fields[y].key;
+                               break;
+                       }
 
-               /* Prompt */
-#ifdef JP
-               prt("¥³¥Þ¥ó¥É:", 19, 0);
-#else
-               prt("Command: ", 19, 0);
-#endif
+                       for (i = 0; i < n; i++)
+                       {
+                               if (tolower(k) == option_fields[i].key) break;
+                       }
 
+                       /* Command is found */
+                       if (i < n) break;
 
-               /* Get command */
-               k = inkey();
+                       /* Hack -- browse help */
+                       if (k == '?') break;
+
+                       /* Move cursor */
+                       d = 0;
+                       if (skey == SKEY_UP) d = 8;
+                       if (skey == SKEY_DOWN) d = 2;
+                       y = (y + ddy[d] + n) % n;
+                       if (!d) bell();
+               }
 
                /* Exit */
                if (k == ESCAPE) break;
@@ -2432,7 +2483,6 @@ void do_cmd_options(void)
 #else
                                do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
 #endif
-
                                break;
                        }
 
@@ -2444,7 +2494,6 @@ void do_cmd_options(void)
 #else
                                do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
 #endif
-
                                break;
                        }
 
@@ -2456,7 +2505,6 @@ void do_cmd_options(void)
 #else
                                do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
 #endif
-
                                break;
                        }
 
@@ -2468,7 +2516,6 @@ void do_cmd_options(void)
 #else
                                do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
 #endif
-
                                break;
                        }
 
@@ -2480,7 +2527,6 @@ void do_cmd_options(void)
 #else
                                do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
 #endif
-
                                break;
                        }
 
@@ -2518,7 +2564,6 @@ void do_cmd_options(void)
 #else
                                do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
 #endif
-
                                break;
                        }
 
@@ -2538,7 +2583,6 @@ void do_cmd_options(void)
 #else
                                do_cmd_options_cheat("Cheaters never win");
 #endif
-
                                break;
                        }
 
@@ -2550,7 +2594,6 @@ void do_cmd_options(void)
 #else
                                do_cmd_options_autosave("Autosave");
 #endif
-
                                break;
                        }
 
@@ -2562,8 +2605,9 @@ void do_cmd_options(void)
                                do_cmd_options_win();
                                p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
                                                  PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
-                                                 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
-                                                 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
+                                                       PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
+                                                       PW_BORG_1 | PW_BORG_2 | PW_DUNGEON   |
+                                                       PW_MONSTER_LIST);
                                break;
                        }
 
@@ -2580,13 +2624,13 @@ void do_cmd_options(void)
                        case 'd':
                        {
                                /* Prompt */
+                               clear_from(18);
 #ifdef JP
                                prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
 #else
                                prt("Command: Base Delay Factor", 19, 0);
 #endif
 
-
                                /* Get a new value */
                                while (1)
                                {
@@ -2628,13 +2672,13 @@ void do_cmd_options(void)
                        case 'h':
                        {
                                /* Prompt */
+                               clear_from(18);
 #ifdef JP
                                prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
 #else
                                prt("Command: Hitpoint Warning", 19, 0);
 #endif
 
-
                                /* Get a new value */
                                while (1)
                                {
@@ -2675,13 +2719,13 @@ void do_cmd_options(void)
                        case 'm':
                        {
                                /* Prompt */
+                               clear_from(18);
 #ifdef JP
                                prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
 #else
                                prt("Command: Mana Color Threshold", 19, 0);
 #endif
 
-
                                /* Get a new value */
                                while (1)
                                {
@@ -3140,7 +3184,7 @@ void do_cmd_macros(void)
 
 
                        /* Default filename */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Ask for a file */
                        if (!askfor(tmp, 80)) continue;
@@ -3196,7 +3240,7 @@ void do_cmd_macros(void)
 
 
                        /* Default filename */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Ask for a file */
                        if (!askfor(tmp, 80)) continue;
@@ -3390,7 +3434,7 @@ void do_cmd_macros(void)
 
 
                        /* Default filename */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Ask for a file */
                        if (!askfor(tmp, 80)) continue;
@@ -3666,7 +3710,7 @@ static bool cmd_visuals_aux(int i, int *num, int max)
 static void print_visuals_menu(cptr choice_msg)
 {
 #ifdef JP
-       prt("²èÌÌɽ¼¨¤ÎÀßÄê", 1, 0);
+       prt("[ ²èÌÌɽ¼¨¤ÎÀßÄê ]", 1, 0);
 #else
        prt("Interact with Visuals", 1, 0);
 #endif
@@ -3774,7 +3818,7 @@ void do_cmd_visuals(void)
 #endif
 
                        /* Default filename */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Query */
                        if (!askfor(tmp, 70)) continue;
@@ -3807,7 +3851,7 @@ void do_cmd_visuals(void)
 #endif
 
                        /* Default filename */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Get a filename */
                        if (!askfor(tmp, 70)) continue;
@@ -3874,7 +3918,7 @@ void do_cmd_visuals(void)
 #endif
 
                        /* Default filename */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Get a filename */
                        if (!askfor(tmp, 70)) continue;
@@ -3958,7 +4002,7 @@ void do_cmd_visuals(void)
 #endif
 
                        /* Default filename */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Get a filename */
                        if (!askfor(tmp, 70)) continue;
@@ -4165,11 +4209,11 @@ void do_cmd_visuals(void)
 #ifdef JP
                                Term_putstr(5, 17, -1, TERM_WHITE,
                                            format("¥¢¥¤¥Æ¥à = %d, Ì¾Á° = %-40.40s",
-                                                  k, (k_name + k_ptr->name)));
+                                                  k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
 #else
                                Term_putstr(5, 17, -1, TERM_WHITE,
                                            format("Object = %d, Name = %-40.40s",
-                                                  k, (k_name + k_ptr->name)));
+                                                  k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
 #endif
 
                                /* Label the Default values */
@@ -4228,7 +4272,7 @@ void do_cmd_visuals(void)
                                                                break;
                                                        }
                                                }
-                                               while (!k_info[k].name || k_info[k].flavor);
+                                               while (!k_info[k].name);
                                        }
                                        break;
                                case 'a':
@@ -4528,7 +4572,7 @@ void do_cmd_colors(void)
 
 
                        /* Default file */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Query */
                        if (!askfor(tmp, 70)) continue;
@@ -4567,7 +4611,7 @@ void do_cmd_colors(void)
 
 
                        /* Default filename */
-                       sprintf(tmp, "%s.prf", player_name);
+                       sprintf(tmp, "%s.prf", player_base);
 
                        /* Get a filename */
                        if (!askfor(tmp, 70)) continue;
@@ -5043,6 +5087,8 @@ static cptr monster_group_text[] =
 #ifdef JP
        "¥æ¥Ë¡¼¥¯",     /* "Uniques" */
        "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
+       "¾Þ¶â¼ó", /* "Wanted */
+       "¥¢¥ó¥Ð¡¼¤Î²¦Â²", /* "Ambertite" */
        "¥¢¥ê",
        "¥³¥¦¥â¥ê",
        "¥à¥«¥Ç",
@@ -5102,6 +5148,8 @@ static cptr monster_group_text[] =
 #else
        "Uniques",
        "Ridable monsters",
+       "Wanted monsters",
+       "Ambertite",
        "Ant",
        "Bat",
        "Centipede",
@@ -5171,6 +5219,8 @@ static cptr monster_group_char[] =
 {
        (char *) -1L,
        (char *) -2L,
+       (char *) -3L,
+       (char *) -4L,
        "a",
        "b",
        "c",
@@ -5276,6 +5326,13 @@ static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
        /* XXX Hack -- Check if this is the "Riding" group */
        bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
 
+       /* XXX Hack -- Check if this is the "Wanted" group */
+       bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
+
+       /* XXX Hack -- Check if this is the "Amberite" group */
+       bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
+
+
        /* Check every race */
        for (i = 0; i < max_r_idx; i++)
        {
@@ -5298,6 +5355,27 @@ static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
                        if (!(r_ptr->flags7 & RF7_RIDING)) continue;
                }
 
+               else if (grp_wanted)
+               {
+                       bool wanted = FALSE;
+                       int j;
+                       for (j = 0; j < MAX_KUBI; j++)
+                       {
+                               if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
+                                       (p_ptr->today_mon && p_ptr->today_mon == i))
+                               {
+                                       wanted = TRUE;
+                                       break;
+                               }
+                       }
+                       if (!wanted) continue;
+               }
+
+               else if (grp_amberite)
+               {
+                       if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
+               }
+
                else
                {
                        /* Check for race in the group */
@@ -5520,7 +5598,7 @@ static int collect_objects(int grp_cur, int object_idx[], byte mode)
                if (TV_LIFE_BOOK == group_tval)
                {
                        /* Hack -- All spell books */
-                       if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
+                       if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
                        {
                                /* Add the object */
                                object_idx[object_cnt++] = i;
@@ -6044,7 +6122,7 @@ void do_cmd_save_screen_html_aux(char *filename, int message)
        tmpfff = my_fopen(buf, "r");
        if (!tmpfff) {
                for (i = 0; html_head[i]; i++)
-                       fprintf(fff, html_head[i]);
+                       fputs(html_head[i], fff);
        }
        else {
                yomikomu = 0;
@@ -6106,7 +6184,7 @@ void do_cmd_save_screen_html_aux(char *filename, int message)
 
        if (!tmpfff) {
                for (i = 0; html_foot[i]; i++)
-                       fprintf(fff, html_foot[i]);
+                       fputs(html_foot[i], fff);
        }
        else {
                rewind(tmpfff);
@@ -6852,7 +6930,7 @@ static void do_cmd_knowledge_spell_exp(void)
        int i = 0, spell_exp, exp_level;
 
        FILE *fff;
-       magic_type *s_ptr;
+       const magic_type *s_ptr;
 
        char file_name[1024];
 
@@ -7270,9 +7348,9 @@ static void do_cmd_knowledge_kill_count(void)
 #endif
                else
 #ifdef JP
-                       fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
+                       fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", (long int)Total);
 #else
-                       fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
+                       fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
 #endif
        }
 
@@ -7352,10 +7430,10 @@ static void do_cmd_knowledge_kill_count(void)
 
        fprintf(fff,"----------------------------------------------\n");
 #ifdef JP
-       fprintf(fff,"    ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
+       fprintf(fff,"    ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", (unsigned long int)Total);
 #else
        fprintf(fff,"   Total: %lu creature%s killed.\n",
-               Total, (Total == 1 ? "" : "s"));
+               (unsigned long int)Total, (Total == 1 ? "" : "s"));
 #endif
 
 
@@ -8077,7 +8155,7 @@ static void display_object_list(int col, int row, int per_page, int object_idx[]
                byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
 
 
-               if (k_ptr->flavor)
+               if (!visual_only && k_ptr->flavor)
                {
                        /* Appearance of this object is shuffled */
                        flavor_k_ptr = &k_info[k_ptr->flavor];
@@ -8092,7 +8170,7 @@ static void display_object_list(int col, int row, int per_page, int object_idx[]
 
                attr = ((i + object_top == object_cur) ? cursor : attr);
 
-               if (!k_ptr->flavor || k_ptr->aware)
+               if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
                {
                        /* Tidy name */
                        strip_name(o_name, k_idx);
@@ -8236,7 +8314,7 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int di
                object_kind *k_ptr = &k_info[direct_k_idx];
                object_kind *flavor_k_ptr;
 
-               if (k_ptr->flavor)
+               if (!visual_only && k_ptr->flavor)
                {
                        /* Appearance of this object is shuffled */
                        flavor_k_ptr = &k_info[k_ptr->flavor];
@@ -8352,7 +8430,7 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int di
                /* Get the current object */
                k_ptr = &k_info[object_idx[object_cur]];
 
-               if (k_ptr->flavor)
+               if (!visual_only && k_ptr->flavor)
                {
                        /* Appearance of this object is shuffled */
                        flavor_k_ptr = &k_info[k_ptr->flavor];
@@ -8557,8 +8635,8 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int d
        byte char_old[F_LIT_MAX];
        byte *cur_attr_ptr, *cur_char_ptr;
 
-       C_WIPE(attr_old, F_LIT_MAX, byte);
-       C_WIPE(char_old, F_LIT_MAX, byte);
+       (void)C_WIPE(attr_old, F_LIT_MAX, byte);
+       (void)C_WIPE(char_old, F_LIT_MAX, byte);
 
        /* Get size */
        Term_get_size(&wid, &hgt);
@@ -9140,7 +9218,9 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
 
        for (i = 1; i < max_quests; i++)
        {
-               if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
+               if ((quest[i].status == QUEST_STATUS_TAKEN) ||
+                       ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) ||
+                       (quest[i].status == QUEST_STATUS_COMPLETED))
                {
                        /* Set the quest number temporary */
                        int old_quest = p_ptr->inside_quest;
@@ -9169,7 +9249,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                        {
                                char note[80] = "\0";
 
-                               if (quest[i].status == QUEST_STATUS_TAKEN)
+                               if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
                                {
                                        switch (quest[i].type)
                                        {
@@ -9197,19 +9277,28 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                                                break;
 
                                        case QUEST_TYPE_FIND_ARTIFACT:
-                                               strcpy(name, a_name + a_info[quest[i].k_idx].name);
+                                               if (quest[i].k_idx)
+                                               {
+                                                       artifact_type *a_ptr = &a_info[quest[i].k_idx];
+                                                       object_type forge;
+                                                       object_type *q_ptr = &forge;
+                                                       int k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
+                                                       object_prep(q_ptr, k_idx);
+                                                       q_ptr->name1 = quest[i].k_idx;
+                                                       q_ptr->ident = IDENT_STORE;
+                                                       object_desc(name, q_ptr, OD_NAME_ONLY);
+                                               }
 #ifdef JP
-                                               sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
+                                               sprintf(note,"\n   - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
 #else
-                                               sprintf(note," - Find out %s.", name);
+                                               sprintf(note,"\n   - Find out %s.", name);
 #endif
                                                break;
-
                                        case QUEST_TYPE_FIND_EXIT:
 #ifdef JP
-                                               sprintf(note," - Ãµº÷¤¹¤ë¡£");
+                                               sprintf(note," - ½Ð¸ý¤ËÅþ㤹¤ë¡£");
 #else
-                                               sprintf(note," - Search.");
+                                               sprintf(note," - Reach to Exit.");
 #endif
                                                break;
 
@@ -9224,6 +9313,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                                                break;
 
                                        case QUEST_TYPE_KILL_ALL:
+                                       case QUEST_TYPE_TOWER:
 #ifdef JP
                                                sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
 #else
@@ -9242,7 +9332,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                                        quest[i].name, quest[i].level, note);
 #endif
 
-                               fprintf(fff, tmp_str);
+                               fputs(tmp_str, fff);
 
                                if (quest[i].status == QUEST_STATUS_COMPLETED)
                                {
@@ -9251,7 +9341,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
 #else
                                        sprintf(tmp_str, "    Quest Completed - Unrewarded\n");
 #endif
-                                       fprintf(fff, tmp_str);
+                                       fputs(tmp_str, fff);
                                }
                                else
                                {
@@ -9305,7 +9395,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
        }
 
        /* Print the current random quest  */
-       if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
+       if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
 
 #ifdef JP
        if (!total) fprintf(fff, "  ¤Ê¤·\n");
@@ -9315,12 +9405,75 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
 }
 
 
+static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx)
+{
+       char tmp_str[120];
+       char playtime_str[16];
+       quest_type* const q_ptr = &quest[q_idx];
+
+       if (is_fixed_quest_idx(q_idx))
+       {
+               /* Set the quest number temporary */
+               int old_quest = p_ptr->inside_quest;
+
+               p_ptr->inside_quest = q_idx;
+
+               /* Get the quest */
+               init_flags = INIT_NAME_ONLY;
+
+               process_dungeon_file("q_info.txt", 0, 0, 0, 0);
+
+               /* Reset the old quest number */
+               p_ptr->inside_quest = old_quest;
+
+               /* No info from "silent" quests */
+               if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
+       }
+
+       strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
+               q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
+
+       if (!is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
+       {
+               /* Print the quest info */
+               if (q_ptr->complev == 0)
+               {
+                       sprintf(tmp_str,
+                               _("  %-40s (%3d³¬)            -   ÉÔÀᄀ\n",
+                                 "  %-40s (Dungeon level: %3d) - (Cancelled)\n") ,
+                               r_name+r_info[q_ptr->r_idx].name,
+                               q_ptr->level);
+               }
+               else
+               {
+                       sprintf(tmp_str,
+                               _("  %-40s (%3d³¬)            - ¥ì¥Ù¥ë%2d - %s\n",
+                                 "  %-40s (Dungeon level: %3d) - level %2d - %s\n") ,
+                               r_name+r_info[q_ptr->r_idx].name,
+                               q_ptr->level,
+                               q_ptr->complev,
+                               playtime_str);
+               }
+       }
+       else
+       {
+               /* Print the quest info */
+               sprintf(tmp_str,
+                       _("  %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d - %s\n",
+                         "  %-40s (Danger  level: %3d) - level %2d - %s\n") ,
+                       q_ptr->name, q_ptr->level, q_ptr->complev, playtime_str);
+       }
+
+       fputs(tmp_str, fff);
+
+       return TRUE;
+}
+
 /*
  * Print all finished quests
  */
 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
 {
-       char tmp_str[120];
        int i;
        int total = 0;
 
@@ -9332,71 +9485,12 @@ void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
        for (i = 1; i < max_quests; i++)
        {
                int q_idx = quest_num[i];
+               quest_type* const q_ptr = &quest[q_idx];
 
-               if (quest[q_idx].status == QUEST_STATUS_FINISHED)
+               if (q_ptr->status == QUEST_STATUS_FINISHED &&
+                   do_cmd_knowledge_quests_aux(fff, q_idx))
                {
-                       if (is_fixed_quest_idx(q_idx))
-                       {
-                               /* Set the quest number temporary */
-                               int old_quest = p_ptr->inside_quest;
-
-                               p_ptr->inside_quest = q_idx;
-
-                               /* Get the quest */
-                               init_flags = INIT_ASSIGN;
-
-                               process_dungeon_file("q_info.txt", 0, 0, 0, 0);
-
-                               /* Reset the old quest number */
-                               p_ptr->inside_quest = old_quest;
-
-                               /* No info from "silent" quests */
-                               if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
-                       }
-
-                       total++;
-
-                       if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
-                       {
-                               /* Print the quest info */
-
-                               if (quest[q_idx].complev == 0)
-                               {
-                                       sprintf(tmp_str,
-#ifdef JP
-                                               "  %-40s (%3d³¬)            -   ÉÔÀᄀ\n",
-#else
-                                               "  %-40s (Dungeon level: %3d) - (Cancelled)\n",
-#endif
-                                               r_name+r_info[quest[q_idx].r_idx].name,
-                                               quest[q_idx].level);
-                               }
-                               else
-                               {
-                                       sprintf(tmp_str,
-#ifdef JP
-                                               "  %-40s (%3d³¬)            - ¥ì¥Ù¥ë%2d\n",
-#else
-                                               "  %-40s (Dungeon level: %3d) - level %2d\n",
-#endif
-                                               r_name+r_info[quest[q_idx].r_idx].name,
-                                               quest[q_idx].level,
-                                               quest[q_idx].complev);
-                               }
-                       }
-                       else
-                       {
-                               /* Print the quest info */
-#ifdef JP
-                               sprintf(tmp_str, "  %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
-                                       quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#else
-                               sprintf(tmp_str, "  %-40s (Danger  level: %3d) - level %2d\n",
-                                       quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#endif
-                       }
-
-                       fprintf(fff, tmp_str);
+                       ++ total;
                }
        }
 #ifdef JP
@@ -9412,7 +9506,6 @@ void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
  */
 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
 {
-       char tmp_str[120];
        int i;
        int total = 0;
 
@@ -9424,53 +9517,12 @@ void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
        for (i = 1; i < max_quests; i++)
        {
                int q_idx = quest_num[i];
+               quest_type* const q_ptr = &quest[q_idx];
 
-               if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
+               if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
+                   do_cmd_knowledge_quests_aux(fff, q_idx))
                {
-                       if (is_fixed_quest_idx(q_idx))
-                       {
-                               /* Set the quest number temporary */
-                               int old_quest = p_ptr->inside_quest;
-
-                               p_ptr->inside_quest = q_idx;
-
-                               /* Get the quest text */
-                               init_flags = INIT_ASSIGN;
-
-                               process_dungeon_file("q_info.txt", 0, 0, 0, 0);
-
-                               /* Reset the old quest number */
-                               p_ptr->inside_quest = old_quest;
-
-                               /* No info from "silent" quests */
-                               if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
-                       }
-
-                       total++;
-
-                       if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
-                       {
-                               /* Print the quest info */
-#ifdef JP
-                               sprintf(tmp_str, "  %-40s (%3d³¬)            - ¥ì¥Ù¥ë%2d\n",
-                                       r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#else
-                               sprintf(tmp_str, "  %-40s (Dungeon level: %3d) - level %2d\n",
-                                       r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#endif
-                       }
-                       else
-                       {
-                               /* Print the quest info */
-#ifdef JP
-                               sprintf(tmp_str, "  %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
-                                       quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#else
-                               sprintf(tmp_str, "  %-40s (Danger  level: %3d) - level %2d\n",
-                                       quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#endif
-                       }
-                       fprintf(fff, tmp_str);
+                       ++ total;
                }
        }
 #ifdef JP
@@ -9512,7 +9564,7 @@ static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
                        sprintf(tmp_str, "  %s (%d, %s)\n",
                                quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
 #endif
-                       fprintf(fff, tmp_str);
+                       fputs(tmp_str, fff);
                }
        }
 #ifdef JP