4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Interface commands */
18 * A set of functions to maintain automatic dumps of various kinds.
21 * remove_auto_dump(orig_file, mark)
22 * Remove the old automatic dump of type "mark".
23 * auto_dump_printf(fmt, ...)
24 * Dump a formatted string using fprintf().
25 * open_auto_dump(buf, mark)
26 * Open a file, remove old dump, and add new header.
27 * close_auto_dump(void)
28 * Add a footer, and close the file.
30 * The dump commands of original Angband simply add new lines to
31 * existing files; these files will become bigger and bigger unless
32 * an user deletes some or all of these files by hand at some
35 * These three functions automatically delete old dumped lines
36 * before adding new ones. Since there are various kinds of automatic
37 * dumps in a single file, we add a header and a footer with a type
38 * name for every automatic dump, and kill old lines only when the
39 * lines have the correct type of header and footer.
41 * We need to be quite paranoid about correctness; the user might
42 * (mistakenly) edit the file by hand, and see all their work come
43 * to nothing on the next auto dump otherwise. The current code only
44 * detects changes by noting inconsistencies between the actual number
45 * of lines and the number written in the footer. Note that this will
46 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
63 * Remove old lines automatically generated before.
65 static void remove_auto_dump(cptr orig_file)
67 FILE *tmp_fff, *orig_fff;
71 bool between_mark = FALSE;
74 long header_location = 0;
75 char header_mark_str[80];
76 char footer_mark_str[80];
79 /* Prepare a header/footer mark string */
80 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
81 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
83 mark_len = strlen(footer_mark_str);
85 /* Open an old dump file in read-only mode */
86 orig_fff = my_fopen(orig_file, "r");
88 /* If original file does not exist, nothing to do */
89 if (!orig_fff) return;
91 /* Open a new (temporary) file */
92 tmp_fff = my_fopen_temp(tmp_file, 1024);
97 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", tmp_file);
99 msg_format("Failed to create temporary file %s.", tmp_file);
105 /* Loop for every line */
109 if (my_fgets(orig_fff, buf, sizeof(buf)))
111 /* Read error: Assume End of File */
114 * Was looking for the footer, but not found.
116 * Since automatic dump might be edited by hand,
117 * it's dangerous to kill these lines.
118 * Seek back to the next line of the (pseudo) header,
123 fseek(orig_fff, header_location, SEEK_SET);
124 between_mark = FALSE;
128 /* Success -- End the loop */
135 /* We are looking for the header mark of automatic dump */
138 /* Is this line a header? */
139 if (!strcmp(buf, header_mark_str))
141 /* Memorise seek point of this line */
142 header_location = ftell(orig_fff);
144 /* Initialize counter for number of lines */
147 /* Look for the footer from now */
150 /* There are some changes */
157 /* Copy orginally lines */
158 fprintf(tmp_fff, "%s\n", buf);
162 /* We are looking for the footer mark of automatic dump */
165 /* Is this line a footer? */
166 if (!strncmp(buf, footer_mark_str, mark_len))
171 * Compare the number of lines
173 * If there is an inconsistency between
174 * actual number of lines and the
175 * number here, the automatic dump
176 * might be edited by hand. So it's
177 * dangerous to kill these lines.
178 * Seek back to the next line of the
179 * (pseudo) header, and read again.
181 if (!sscanf(buf + mark_len, " (%d)", &tmp)
184 fseek(orig_fff, header_location, SEEK_SET);
187 /* Look for another header */
188 between_mark = FALSE;
194 /* Ignore old line, and count number of lines */
204 /* If there are some changes, overwrite the original file with new one */
207 /* Copy contents of temporary file */
209 tmp_fff = my_fopen(tmp_file, "r");
210 orig_fff = my_fopen(orig_file, "w");
212 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
213 fprintf(orig_fff, "%s\n", buf);
219 /* Kill the temporary file */
227 * Dump a formatted line, using "vstrnfmt()".
229 static void auto_dump_printf(cptr fmt, ...)
236 /* Begin the Varargs Stuff */
239 /* Format the args, save the length */
240 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
242 /* End the Varargs Stuff */
245 /* Count number of lines */
246 for (p = buf; *p; p++)
248 if (*p == '\n') auto_dump_line_num++;
252 fprintf(auto_dump_stream, "%s", buf);
257 * Open file to append auto dump.
259 static bool open_auto_dump(cptr buf, cptr mark)
262 char header_mark_str[80];
264 /* Save the mark string */
265 auto_dump_mark = mark;
267 /* Prepare a header mark string */
268 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
270 /* Remove old macro dumps */
271 remove_auto_dump(buf);
273 /* Append to the file */
274 auto_dump_stream = my_fopen(buf, "a");
277 if (!auto_dump_stream) {
279 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
281 msg_format("Failed to open %s.", buf);
290 fprintf(auto_dump_stream, "%s\n", header_mark_str);
292 /* Initialize counter */
293 auto_dump_line_num = 0;
296 auto_dump_printf("# *·Ù¹ð!!* °Ê¹ß¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
297 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
299 auto_dump_printf("# *Warning!* The lines below are an automatic dump.\n");
300 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
308 * Append foot part and close auto dump.
310 static void close_auto_dump(void)
312 char footer_mark_str[80];
314 /* Prepare a footer mark string */
315 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
318 auto_dump_printf("# *·Ù¹ð!!* °Ê¾å¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
319 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
321 auto_dump_printf("# *Warning!* The lines above are an automatic dump.\n");
322 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
326 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
329 my_fclose(auto_dump_stream);
336 * Take note to the diary.
338 errr do_cmd_write_nikki(int type, int num, cptr note)
344 cptr note_level = "";
345 bool do_level = TRUE;
346 char note_level_buf[40];
349 static bool disable_nikki = FALSE;
351 extract_day_hour_min(&day, &hour, &min);
353 if (disable_nikki) return(-1);
355 if (type == NIKKI_FIX_QUEST_C ||
356 type == NIKKI_FIX_QUEST_F ||
357 type == NIKKI_RAND_QUEST_C ||
358 type == NIKKI_RAND_QUEST_F ||
359 type == NIKKI_TO_QUEST)
363 old_quest = p_ptr->inside_quest;
364 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
366 /* Get the quest text */
367 init_flags = INIT_ASSIGN;
369 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
371 /* Reset the old quest number */
372 p_ptr->inside_quest = old_quest;
376 sprintf(file_name,"playrecord-%s.txt",savefile_base);
378 /* different filne name to avoid mixing */
379 sprintf(file_name,"playrec-%s.txt",savefile_base);
382 /* Build the filename */
383 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
385 /* File type is "TEXT" */
386 FILE_TYPE(FILE_TYPE_TEXT);
388 fff = my_fopen(buf, "a");
394 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
396 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
403 q_idx = quest_number(dun_level);
407 if (p_ptr->inside_arena)
409 note_level = "¥¢¥ê¡¼¥Ê:";
411 note_level = "Arane:";
415 note_level = "ÃϾå:";
417 note_level = "Surface:";
419 else if (q_idx && (is_fixed_quest_idx(q_idx)
420 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
422 note_level = "¥¯¥¨¥¹¥È:";
424 note_level = "Quest:";
429 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
431 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
433 note_level = note_level_buf;
442 fprintf(fff, "%dÆüÌÜ\n",day);
444 fprintf(fff, "Day %d\n",day);
453 fprintf(fff, "%s\n",note);
457 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
463 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
465 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
472 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
474 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
478 case NIKKI_FIX_QUEST_C:
480 if (quest[num].flags & QUEST_FLAG_SILENT) break;
482 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
484 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
488 case NIKKI_FIX_QUEST_F:
490 if (quest[num].flags & QUEST_FLAG_SILENT) break;
492 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
494 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
498 case NIKKI_RAND_QUEST_C:
501 strcpy(name, r_name+r_info[quest[num].r_idx].name);
503 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
505 fprintf(fff, " %2d:%02d %20s completed randome quest '%s'\n", hour, min, note_level, name);
509 case NIKKI_RAND_QUEST_F:
512 strcpy(name, r_name+r_info[quest[num].r_idx].name);
514 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
516 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
520 case NIKKI_MAXDEAPTH:
523 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
525 fprintf(fff, " %2d:%02d %20s reached level %d of %s for the first time.\n", hour, min, note_level, num, d_name+d_info[dungeon_type].name);
532 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
534 fprintf(fff, " %2d:%02d %20s reset recall level of %s to %d %s.\n", hour, min, note_level, d_name + d_info[num].name, max_dlv[num], note);
541 if (q_idx && (is_fixed_quest_idx(q_idx)
542 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
553 if (!(dun_level+num)) to = "ÃϾå";
554 else to = format("%d³¬", dun_level+num);
556 if (!(dun_level+num)) to = "the surface";
557 else to = format("level %d", dun_level+num);
562 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
564 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
572 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
574 fprintf(fff, " %2d:%02d %20s recalled to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
578 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
580 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
586 if (quest[num].flags & QUEST_FLAG_SILENT) break;
588 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
590 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
597 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
599 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
606 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
608 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
615 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
617 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
627 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, p_ptr->arena_number + 1, note);
629 int n = p_ptr->arena_number + 1;
630 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, (n%10==1?"st":n%10==2?"nd":n%10==3?"rd":"th"));
635 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
637 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, (num%10==1?"st":num%10==2?"nd":num%10==3?"rd":"th"), note);
639 if (num == MAX_ARENA_MONS)
642 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
644 fprintf(fff, " won all fight to become a Chanpion.\n");
653 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
655 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
670 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
672 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
676 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
678 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
693 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
695 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
699 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
701 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
708 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
710 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
714 case NIKKI_GAMESTART:
716 time_t ct = time((time_t*)0);
720 fprintf(fff, "%s %s",note, ctime(&ct));
723 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
726 case NIKKI_NAMED_PET:
728 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
733 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
735 fprintf(fff, "decided to travel together with %s.\n", note);
740 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
742 fprintf(fff, "unnamed %s.\n", note);
747 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
749 fprintf(fff, "dismissed %s.\n", note);
754 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
756 fprintf(fff, "%s died.\n", note);
761 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
763 fprintf(fff, "moved to another map leaving %s behind.\n", note);
768 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
770 fprintf(fff, "lost sight of %s.\n", note);
775 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
777 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
782 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
784 fprintf(fff, "%s was crushed by falling rocks.\n", note);
799 if (do_level) write_level = FALSE;
805 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
807 static void do_cmd_disp_nikki(void)
809 char nikki_title[256];
814 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
815 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
826 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
827 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
828 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
829 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
834 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
843 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
845 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
846 "Attack is the best form of defence.",
848 "An unexpected windfall",
849 "A drowning man will catch at a straw",
850 "Don't count your chickens before they are hatched.",
851 "It is no use crying over spilt milk.",
852 "Seeing is believing.",
853 "Strike the iron while it is hot.",
854 "I don't care what follows.",
855 "To dig a well to put out a house on fire.",
856 "Tomorrow is another day.",
857 "Easy come, easy go.",
858 "The more haste, the less speed.",
859 "Where there is life, there is hope.",
860 "There is no royal road to *WINNER*.",
861 "Danger past, God forgotten.",
862 "The best thing to do now is to run away.",
863 "Life is but an empty dream.",
864 "Dead men tell no tales.",
865 "A book that remains shut is but a block.",
866 "Misfortunes never come singly.",
867 "A little knowledge is a dangerous thing.",
868 "History repeats itself.",
869 "*WINNER* was not built in a day.",
870 "Ignorance is bliss.",
871 "To lose is to win?",
872 "No medicine can cure folly.",
873 "All good things come to an end.",
874 "M$ Empire strikes back.",
875 "To see is to believe",
877 "Quest of The World's Greatest Brain"};
880 sprintf(file_name,"playrecord-%s.txt",savefile_base);
882 sprintf(file_name,"playrec-%s.txt",savefile_base);
885 /* Build the filename */
886 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
888 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
889 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
890 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
891 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
892 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
895 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
896 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
898 sprintf(nikki_title, "Legend of %s %s '%s'",
899 ap_ptr->title, player_name, tmp);
902 /* Display the file contents */
903 show_file(FALSE, buf, nikki_title, -1, 0);
906 static void do_cmd_bunshou(void)
909 char bunshou[80] = "\0";
912 if (get_string("ÆâÍÆ: ", tmp, 79))
914 if (get_string("diary note: ", tmp, 79))
917 strcpy(bunshou, tmp);
919 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
923 static void do_cmd_last_get(void)
928 if (record_o_name[0] == '\0') return;
931 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
933 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
935 if (!get_check(buf)) return;
940 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
942 sprintf(buf,"descover %s.", record_o_name);
944 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
948 static void do_cmd_erase_nikki(void)
955 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
957 if (!get_check("Do you really want to delete all your record? ")) return;
961 sprintf(file_name,"playrecord-%s.txt",savefile_base);
963 sprintf(file_name,"playrec-%s.txt",savefile_base);
966 /* Build the filename */
967 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
969 /* Remove the file */
972 fff = my_fopen(buf, "w");
976 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
978 msg_format("deleted record.");
982 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
984 msg_format("failed to delete %s.", buf);
991 void do_cmd_nikki(void)
995 /* File type is "TEXT" */
996 FILE_TYPE(FILE_TYPE_TEXT);
998 /* Save the screen */
1001 /* Interact until done */
1007 /* Ask for a choice */
1009 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1011 prt("[ Play Record ]", 2, 0);
1015 /* Give some choices */
1017 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1018 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1019 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1020 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1022 prt("(1) Display your record", 4, 5);
1023 prt("(2) Add record", 5, 5);
1024 prt("(3) Record item you last get/identify", 6, 5);
1025 prt("(4) Delete your record", 7, 5);
1031 prt("¥³¥Þ¥ó¥É:", 18, 0);
1033 prt("Command: ", 18, 0);
1041 if (i == ESCAPE) break;
1046 do_cmd_disp_nikki();
1055 do_cmd_erase_nikki();
1057 default: /* Unknown option */
1061 /* Flush messages */
1065 /* Restore the screen */
1070 * Hack -- redraw the screen
1072 * This command performs various low level updates, clears all the "extra"
1073 * windows, does a total redraw of the main window, and requests all of the
1074 * interesting updates and redraws that I can think of.
1076 * This command is also used to "instantiate" the results of the user
1077 * selecting various things, such as graphics mode, so it must call
1078 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1080 void do_cmd_redraw(void)
1087 /* Hack -- react to changes */
1088 Term_xtra(TERM_XTRA_REACT, 0);
1091 /* Combine and Reorder the pack (later) */
1092 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1096 p_ptr->update |= (PU_TORCH);
1099 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1101 /* Forget lite/view */
1102 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1104 /* Update lite/view */
1105 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1107 /* Update monsters */
1108 p_ptr->update |= (PU_MONSTERS);
1110 /* Redraw everything */
1111 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1114 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1117 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1121 /* Hack -- update */
1124 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1127 /* Redraw every window */
1128 for (j = 0; j < 8; j++)
1131 if (!angband_term[j]) continue;
1134 Term_activate(angband_term[j]);
1149 * Hack -- change name
1151 void do_cmd_change_name(void)
1160 /* Save the screen */
1168 /* Display the player */
1169 display_player(mode);
1174 display_player(mode);
1179 Term_putstr(2, 23, -1, TERM_WHITE,
1180 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1182 Term_putstr(2, 23, -1, TERM_WHITE,
1183 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1191 if (c == ESCAPE) break;
1198 /* Process the player name */
1199 process_player_name(FALSE);
1205 sprintf(tmp, "%s.txt", player_base);
1207 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1209 if (get_string("File name: ", tmp, 80))
1213 if (tmp[0] && (tmp[0] != ' '))
1215 file_character(tmp);
1232 /* Flush messages */
1236 /* Restore the screen */
1239 /* Redraw everything */
1240 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1247 * Recall the most recent message
1249 void do_cmd_message_one(void)
1251 /* Recall one message XXX XXX XXX */
1252 prt(format("> %s", message_str(0)), 0, 0);
1257 * Show previous messages to the user -BEN-
1259 * The screen format uses line 0 and 23 for headers and prompts,
1260 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1262 * This command shows you which commands you are viewing, and allows
1263 * you to "search" for strings in the recall.
1265 * Note that messages may be longer than 80 characters, but they are
1266 * displayed using "infinite" length, with a special sub-command to
1267 * "slide" the virtual display to the left or right.
1269 * Attempt to only hilite the matching portions of the string.
1271 void do_cmd_messages(int num_now)
1282 Term_get_size(&wid, &hgt);
1291 /* Total messages */
1294 /* Start on first message */
1297 /* Start at leftmost edge */
1300 /* Save the screen */
1303 /* Process requests until done */
1309 /* Dump up to 20 lines of messages */
1310 for (j = 0; (j < hgt - 4) && (i + j < n); j++)
1312 cptr msg = message_str(i+j);
1314 /* Apply horizontal scroll */
1315 msg = (strlen(msg) >= q) ? (msg + q) : "";
1317 /* Dump the messages, bottom to top */
1318 Term_putstr(0, hgt-j-3, -1, (bool)(i+j < num_now ? TERM_WHITE : TERM_SLATE), msg);
1320 /* Hilite "shower" */
1325 /* Display matches */
1326 while ((str = strstr(str, shower)) != NULL)
1328 int len = strlen(shower);
1330 /* Display the match */
1331 Term_putstr(str-msg, hgt-j-3, len, TERM_YELLOW, shower);
1339 /* Display header XXX XXX XXX */
1342 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d) ¥ª¥Õ¥»¥Ã¥È(%d)",
1343 i, i+j-1, n, q), 0, 0);
1345 prt(format("Message Recall (%d-%d of %d), Offset %d",
1346 i, i+j-1, n, q), 0, 0);
1350 /* Display prompt (not very informative) */
1352 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1354 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1361 /* Exit on Escape */
1362 if (k == ESCAPE) break;
1364 /* Hack -- Save the old index */
1367 /* Horizontal scroll */
1371 q = (q >= 40) ? (q - 40) : 0;
1377 /* Horizontal scroll */
1387 /* Hack -- handle show */
1392 prt("¶¯Ä´: ", hgt - 1, 0);
1394 prt("Show: ", hgt - 1, 0);
1398 /* Get a "shower" string, or continue */
1399 if (!askfor_aux(shower, 80)) continue;
1405 /* Hack -- handle find */
1412 prt("¸¡º÷: ", hgt - 1, 0);
1414 prt("Find: ", hgt - 1, 0);
1418 /* Get a "finder" string, or continue */
1419 if (!askfor_aux(finder, 80)) continue;
1422 strcpy(shower, finder);
1425 for (z = i + 1; z < n; z++)
1427 cptr msg = message_str(z);
1430 if (strstr(msg, finder))
1441 /* Recall 1 older message */
1442 if ((k == '8') || (k == '\n') || (k == '\r'))
1444 /* Go newer if legal */
1445 if (i + 1 < n) i += 1;
1448 /* Recall 10 older messages */
1451 /* Go older if legal */
1452 if (i + 10 < n) i += 10;
1455 /* Recall 20 older messages */
1456 if ((k == 'p') || (k == KTRL('P')) || (k == ' '))
1458 /* Go older if legal */
1459 if (i + 20 < n) i += 20;
1462 /* Recall 20 newer messages */
1463 if ((k == 'n') || (k == KTRL('N')))
1465 /* Go newer (if able) */
1466 i = (i >= 20) ? (i - 20) : 0;
1469 /* Recall 10 newer messages */
1472 /* Go newer (if able) */
1473 i = (i >= 20) ? (i - 20) : 0;
1476 /* Recall 1 newer messages */
1479 /* Go newer (if able) */
1480 i = (i >= 1) ? (i - 1) : 0;
1483 /* Hack -- Error of some kind */
1487 /* Restore the screen */
1494 * Number of cheating options
1501 static option_type cheat_info[CHEAT_MAX] =
1503 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1505 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1507 "cheat_peek", "Peek into object creation"
1511 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1513 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1515 "cheat_hear", "Peek into monster creation"
1519 { &cheat_room, FALSE, 255, 0x04, 0x00,
1521 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1523 "cheat_room", "Peek into dungeon creation"
1527 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1529 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1531 "cheat_xtra", "Peek into something else"
1535 { &cheat_know, FALSE, 255, 0x10, 0x00,
1537 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1539 "cheat_know", "Know complete monster info"
1543 { &cheat_live, FALSE, 255, 0x20, 0x00,
1545 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1547 "cheat_live", "Allow player to avoid death"
1551 { &cheat_save, FALSE, 255, 0x40, 0x00,
1553 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1555 "cheat_save", "Ask for saving death"
1561 * Interact with some options for cheating
1563 static void do_cmd_options_cheat(cptr info)
1567 int i, k = 0, n = CHEAT_MAX;
1575 /* Interact with the player */
1580 /* Prompt XXX XXX XXX */
1582 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1584 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1590 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1591 prt(" << Ãí°Õ >>", 11, 0);
1592 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1593 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1594 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1596 /* Display the options */
1597 for (i = 0; i < n; i++)
1599 byte a = TERM_WHITE;
1601 /* Color current option */
1602 if (i == k) a = TERM_L_BLUE;
1604 /* Display the option text */
1605 sprintf(buf, "%-48s: %s (%s)",
1606 cheat_info[i].o_desc,
1608 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1610 (*cheat_info[i].o_var ? "yes" : "no "),
1613 cheat_info[i].o_text);
1614 c_prt(a, buf, i + 2, 0);
1617 /* Hilite current option */
1618 move_cursor(k + 2, 50);
1624 * HACK - Try to translate the key into a direction
1625 * to allow using the roguelike keys for navigation.
1627 dir = get_keymap_dir(ch);
1628 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1642 k = (n + k - 1) % n;
1661 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1663 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1665 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1666 (*cheat_info[k].o_var) = TRUE;
1675 (*cheat_info[k].o_var) = FALSE;
1683 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1685 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1687 /* Peruse the help file */
1688 (void)show_file(TRUE, buf, NULL, 0, 0);
1704 static option_type autosave_info[2] =
1706 { &autosave_l, FALSE, 255, 0x01, 0x00,
1708 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1710 "autosave_l", "Autosave when entering new levels" },
1714 { &autosave_t, FALSE, 255, 0x02, 0x00,
1716 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1718 "autosave_t", "Timed autosave" },
1724 static s16b toggle_frequency(s16b current)
1729 case 50: return 100;
1730 case 100: return 250;
1731 case 250: return 500;
1732 case 500: return 1000;
1733 case 1000: return 2500;
1734 case 2500: return 5000;
1735 case 5000: return 10000;
1736 case 10000: return 25000;
1743 * Interact with some options for cheating
1745 static void do_cmd_options_autosave(cptr info)
1749 int i, k = 0, n = 2;
1757 /* Interact with the player */
1760 /* Prompt XXX XXX XXX */
1762 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1764 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1769 /* Display the options */
1770 for (i = 0; i < n; i++)
1772 byte a = TERM_WHITE;
1774 /* Color current option */
1775 if (i == k) a = TERM_L_BLUE;
1777 /* Display the option text */
1778 sprintf(buf, "%-48s: %s (%s)",
1779 autosave_info[i].o_desc,
1781 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1783 (*autosave_info[i].o_var ? "yes" : "no "),
1786 autosave_info[i].o_text);
1787 c_prt(a, buf, i + 2, 0);
1791 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1793 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1798 /* Hilite current option */
1799 move_cursor(k + 2, 50);
1815 k = (n + k - 1) % n;
1833 (*autosave_info[k].o_var) = TRUE;
1842 (*autosave_info[k].o_var) = FALSE;
1850 autosave_freq = toggle_frequency(autosave_freq);
1852 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1853 autosave_freq), 5, 0);
1855 prt(format("Timed autosave frequency: every %d turns",
1856 autosave_freq), 5, 0);
1864 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1866 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1884 #define PAGE_AUTODESTROY 7
1887 * Interact with some options
1889 void do_cmd_options_aux(int page, cptr info)
1892 int i, k = 0, n = 0, l;
1897 /* Lookup the options */
1898 for (i = 0; i < 24; i++) opt[i] = 0;
1900 /* Scan the options */
1901 for (i = 0; option_info[i].o_desc; i++)
1903 /* Notice options on this "page" */
1904 if (option_info[i].o_page == page) opt[n++] = i;
1911 /* Interact with the player */
1916 /* Prompt XXX XXX XXX */
1918 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, y/n:Êѹ¹, ESC:½ªÎ», ?:¥Ø¥ë¥×) ", info);
1920 sprintf(buf, "%s (RET:next, y/n:change, ESC:accept, ?:help) ", info);
1926 /* HACK -- description for easy-auto-destroy options */
1928 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1930 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1933 /* Display the options */
1934 for (i = 0; i < n; i++)
1936 byte a = TERM_WHITE;
1938 /* Color current option */
1939 if (i == k) a = TERM_L_BLUE;
1941 /* Display the option text */
1942 sprintf(buf, "%-48s: %s (%.19s)",
1943 option_info[opt[i]].o_desc,
1945 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1947 (*option_info[opt[i]].o_var ? "yes" : "no "),
1950 option_info[opt[i]].o_text);
1951 if ((page == PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1952 else c_prt(a, buf, i + 2, 0);
1955 if ((page == PAGE_AUTODESTROY) && (k > 2)) l = 3;
1958 /* Hilite current option */
1959 move_cursor(k + 2 + l, 50);
1965 * HACK - Try to translate the key into a direction
1966 * to allow using the roguelike keys for navigation.
1968 dir = get_keymap_dir(ch);
1969 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1983 k = (n + k - 1) % n;
2000 (*option_info[opt[k]].o_var) = TRUE;
2009 (*option_info[opt[k]].o_var) = FALSE;
2017 (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2024 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2026 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2028 /* Peruse the help file */
2029 (void)show_file(TRUE, buf, NULL, 0, 0);
2046 * Modify the "window" options
2048 static void do_cmd_options_win(void)
2062 /* Memorize old flags */
2063 for (j = 0; j < 8; j++)
2065 /* Acquire current flags */
2066 old_flag[j] = window_flag[j];
2076 /* Prompt XXX XXX XXX */
2078 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2080 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2084 /* Display the windows */
2085 for (j = 0; j < 8; j++)
2087 byte a = TERM_WHITE;
2089 cptr s = angband_term_name[j];
2092 if (j == x) a = TERM_L_BLUE;
2094 /* Window name, staggered, centered */
2095 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2098 /* Display the options */
2099 for (i = 0; i < 16; i++)
2101 byte a = TERM_WHITE;
2103 cptr str = window_flag_desc[i];
2106 if (i == y) a = TERM_L_BLUE;
2110 if (!str) str = "(̤»ÈÍÑ)";
2112 if (!str) str = "(Unused option)";
2117 Term_putstr(0, i + 5, -1, a, str);
2119 /* Display the windows */
2120 for (j = 0; j < 8; j++)
2122 byte a = TERM_WHITE;
2127 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2130 if (window_flag[j] & (1L << i)) c = 'X';
2133 Term_putch(35 + j * 5, i + 5, a, c);
2138 Term_gotoxy(35 + x * 5, y + 5);
2156 for (j = 0; j < 8; j++)
2158 window_flag[j] &= ~(1L << y);
2162 for (i = 0; i < 16; i++)
2164 window_flag[x] &= ~(1L << i);
2177 window_flag[x] |= (1L << y);
2185 window_flag[x] &= ~(1L << y);
2192 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2194 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2204 d = get_keymap_dir(ch);
2206 x = (x + ddx[d] + 8) % 8;
2207 y = (y + ddy[d] + 16) % 16;
2214 /* Notice changes */
2215 for (j = 0; j < 8; j++)
2220 if (!angband_term[j]) continue;
2222 /* Ignore non-changes */
2223 if (window_flag[j] == old_flag[j]) continue;
2226 Term_activate(angband_term[j]);
2243 * Set or unset various options.
2245 * The user must use the "Ctrl-R" command to "adapt" to changes
2246 * in any options which control "visual" aspects of the game.
2248 void do_cmd_options(void)
2253 /* Save the screen */
2262 /* Why are we here */
2264 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 2, 0);
2266 prt("Options", 2, 0);
2270 /* Give some choices */
2272 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 4, 5);
2273 prt("(2) ²èÌ̽ÐÎÏ ¥ª¥×¥·¥ç¥ó", 5, 5);
2274 prt("(3) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 6, 5);
2275 prt("(4) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 7, 5);
2276 prt("(5) ¸úΨ²½ ¥ª¥×¥·¥ç¥ó", 8, 5);
2277 prt("(6) ´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 9, 5);
2278 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 10, 5);
2279 /* Special choices */
2280 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 12, 5);
2281 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 13, 5);
2282 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2284 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2286 prt("(1) Input Options", 4, 5);
2287 prt("(2) Output Options", 5, 5);
2288 prt("(3) Game-Play Options", 6, 5);
2289 prt("(4) Disturbance Options", 7, 5);
2290 prt("(5) Efficiency Options", 8, 5);
2291 prt("(6) Easy Auto-Destroyer Options", 9, 5);
2292 prt("(R) Play-record Options", 10, 5);
2294 /* Special choices */
2295 prt("(D) Base Delay Factor", 12, 5);
2296 prt("(H) Hitpoint Warning", 13, 5);
2297 prt("(A) Autosave Options", 14, 5);
2301 prt("(W) Window Flags", 15, 5);
2304 if (p_ptr->noscore || allow_debug_opts)
2308 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 16, 5);
2310 prt("(C) Cheating Options", 16, 5);
2317 prt("¥³¥Þ¥ó¥É:", 18, 0);
2319 prt("Command: ", 18, 0);
2327 if (k == ESCAPE) break;
2332 /* General Options */
2335 /* Process the general options */
2337 do_cmd_options_aux(1, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2339 do_cmd_options_aux(1, "Input Options");
2345 /* General Options */
2348 /* Process the general options */
2350 do_cmd_options_aux(2, "²èÌ̽ÐÎÏ¥ª¥×¥·¥ç¥ó");
2352 do_cmd_options_aux(2, "Output Options");
2358 /* Inventory Options */
2363 do_cmd_options_aux(3, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2365 do_cmd_options_aux(3, "Game-Play Options");
2371 /* Disturbance Options */
2376 do_cmd_options_aux(4, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2378 do_cmd_options_aux(4, "Disturbance Options");
2384 /* Efficiency Options */
2389 do_cmd_options_aux(5, "¸úΨ²½¥ª¥×¥·¥ç¥ó");
2391 do_cmd_options_aux(5, "Efficiency Options");
2397 /* Object auto-destruction Options */
2402 do_cmd_options_aux(7, "´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2404 do_cmd_options_aux(7, "Easy Auto-Destroyer Options");
2409 /* Play-record Options */
2415 do_cmd_options_aux(10, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2417 do_cmd_options_aux(10, "Play-record Option");
2422 /* Cheating Options */
2425 if (!p_ptr->noscore && !allow_debug_opts)
2427 /* Cheat options are not permitted */
2434 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2436 do_cmd_options_cheat("Cheaters never win");
2446 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2448 do_cmd_options_autosave("Autosave");
2459 do_cmd_options_win();
2460 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2461 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2462 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2463 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2467 /* Hack -- Delay Speed */
2473 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 18, 0);
2475 prt("Command: Base Delay Factor", 18, 0);
2479 /* Get a new value */
2482 int msec = delay_factor * delay_factor * delay_factor;
2484 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2485 delay_factor, msec), 22, 0);
2487 prt(format("Current base delay factor: %d (%d msec)",
2488 delay_factor, msec), 22, 0);
2492 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2494 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2498 if (k == ESCAPE) break;
2502 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2504 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2508 else if (isdigit(k)) delay_factor = D2I(k);
2515 /* Hack -- hitpoint warning factor */
2521 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 18, 0);
2523 prt("Command: Hitpoint Warning", 18, 0);
2527 /* Get a new value */
2531 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2532 hitpoint_warn), 22, 0);
2534 prt(format("Current hitpoint warning: %d0%%",
2535 hitpoint_warn), 22, 0);
2539 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2541 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2545 if (k == ESCAPE) break;
2549 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2551 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2555 else if (isdigit(k)) hitpoint_warn = D2I(k);
2564 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2566 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2571 /* Unknown option */
2580 /* Flush messages */
2585 /* Restore the screen */
2588 /* Hack - Redraw equippy chars */
2589 p_ptr->redraw |= (PR_EQUIPPY);
2595 * Ask for a "user pref line" and process it
2597 * XXX XXX XXX Allow absolute file names?
2599 void do_cmd_pref(void)
2606 /* Ask for a "user pref command" */
2608 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2610 if (!get_string("Pref: ", buf, 80)) return;
2614 /* Process that pref command */
2615 (void)process_pref_file_command(buf);
2618 void do_cmd_pickpref(void)
2624 if(!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2626 if(!get_check("Reload auto-pick preference file? ")) return;
2629 /* Free old entries */
2632 /* ¥¥ã¥éËè¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß */
2634 sprintf(buf, "picktype-%s.prf", player_name);
2636 sprintf(buf, "pickpref-%s.prf", player_name);
2638 err = process_pickpref_file(buf);
2643 msg_format("%s¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", buf);
2645 msg_format("loaded '%s'.", buf);
2649 /* ¶¦Ä̤ÎÀßÄê¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß */
2651 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
2655 err = process_pickpref_file("picktype.prf");
2657 err = process_pickpref_file("pickpref.prf");
2663 msg_print("picktype.prf¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£");
2665 msg_print("loaded 'pickpref.prf'.");
2672 if(err) msg_print("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
2674 if(err) msg_print("Failed to reload autopick preference.");
2681 * Hack -- append all current macros to the given file
2683 static errr macro_dump(cptr fname)
2685 static cptr mark = "Macro Dump";
2691 /* Build the filename */
2692 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2694 /* File type is "TEXT" */
2695 FILE_TYPE(FILE_TYPE_TEXT);
2697 /* Append to the file */
2698 if (!open_auto_dump(buf, mark)) return (-1);
2702 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2704 auto_dump_printf("\n# Automatic macro dump\n\n");
2708 for (i = 0; i < macro__num; i++)
2710 /* Extract the action */
2711 ascii_to_text(buf, macro__act[i]);
2713 /* Dump the macro */
2714 auto_dump_printf("A:%s\n", buf);
2716 /* Extract the action */
2717 ascii_to_text(buf, macro__pat[i]);
2719 /* Dump normal macros */
2720 auto_dump_printf("P:%s\n", buf);
2723 auto_dump_printf("\n");
2735 * Hack -- ask for a "trigger" (see below)
2737 * Note the complex use of the "inkey()" function from "util.c".
2739 * Note that both "flush()" calls are extremely important.
2741 static void do_cmd_macro_aux(char *buf)
2751 /* Do not process macros */
2757 /* Read the pattern */
2763 /* Do not process macros */
2766 /* Do not wait for keys */
2769 /* Attempt to read a key */
2780 /* Convert the trigger */
2781 ascii_to_text(tmp, buf);
2783 /* Hack -- display the trigger */
2784 Term_addstr(-1, TERM_WHITE, tmp);
2791 * Hack -- ask for a keymap "trigger" (see below)
2793 * Note that both "flush()" calls are extremely important. This may
2794 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2796 static void do_cmd_macro_aux_keymap(char *buf)
2810 /* Convert to ascii */
2811 ascii_to_text(tmp, buf);
2813 /* Hack -- display the trigger */
2814 Term_addstr(-1, TERM_WHITE, tmp);
2823 * Hack -- append all keymaps to the given file
2825 static errr keymap_dump(cptr fname)
2827 static cptr mark = "Keymap Dump";
2836 if (rogue_like_commands)
2838 mode = KEYMAP_MODE_ROGUE;
2844 mode = KEYMAP_MODE_ORIG;
2848 /* Build the filename */
2849 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2851 /* File type is "TEXT" */
2852 FILE_TYPE(FILE_TYPE_TEXT);
2854 /* Append to the file */
2855 if (!open_auto_dump(buf, mark)) return -1;
2859 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2861 auto_dump_printf("\n# Automatic keymap dump\n\n");
2865 for (i = 0; i < 256; i++)
2869 /* Loop up the keymap */
2870 act = keymap_act[mode][i];
2872 /* Skip empty keymaps */
2875 /* Encode the key */
2878 ascii_to_text(key, buf);
2880 /* Encode the action */
2881 ascii_to_text(buf, act);
2883 /* Dump the macro */
2884 auto_dump_printf("A:%s\n", buf);
2885 auto_dump_printf("C:%d:%s\n", mode, key);
2898 * Interact with "macros"
2900 * Note that the macro "action" must be defined before the trigger.
2902 * Could use some helpful instructions on this page. XXX XXX XXX
2904 void do_cmd_macros(void)
2916 if (rogue_like_commands)
2918 mode = KEYMAP_MODE_ROGUE;
2924 mode = KEYMAP_MODE_ORIG;
2927 /* File type is "TEXT" */
2928 FILE_TYPE(FILE_TYPE_TEXT);
2935 /* Process requests until done */
2943 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
2945 prt("Interact with Macros", 2, 0);
2950 /* Describe that action */
2952 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
2954 prt("Current action (if any) shown below:", 20, 0);
2958 /* Analyze the current action */
2959 ascii_to_text(buf, macro__buf);
2961 /* Display the current action */
2967 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
2969 prt("(1) Load a user pref file", 4, 5);
2974 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
2975 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
2976 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
2977 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
2978 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
2979 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
2980 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
2981 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
2982 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
2984 prt("(2) Append macros to a file", 5, 5);
2985 prt("(3) Query a macro", 6, 5);
2986 prt("(4) Create a macro", 7, 5);
2987 prt("(5) Remove a macro", 8, 5);
2988 prt("(6) Append keymaps to a file", 9, 5);
2989 prt("(7) Query a keymap", 10, 5);
2990 prt("(8) Create a keymap", 11, 5);
2991 prt("(9) Remove a keymap", 12, 5);
2992 prt("(0) Enter a new action", 13, 5);
2995 #endif /* ALLOW_MACROS */
2999 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3001 prt("Command: ", 16, 0);
3009 if (i == ESCAPE) break;
3011 /* Load a 'macro' file */
3018 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3020 prt("Command: Load a user pref file", 16, 0);
3026 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3028 prt("File: ", 18, 0);
3032 /* Default filename */
3033 sprintf(tmp, "%s.prf", player_name);
3035 /* Ask for a file */
3036 if (!askfor_aux(tmp, 80)) continue;
3038 /* Process the given filename */
3039 err = process_pref_file(tmp);
3043 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3045 msg_format("Loaded default '%s'.", tmp);
3052 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3054 msg_format("Failed to load '%s'!");
3060 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3062 msg_format("Loaded '%s'.", tmp);
3074 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3076 prt("Command: Append macros to a file", 16, 0);
3082 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3084 prt("File: ", 18, 0);
3088 /* Default filename */
3089 sprintf(tmp, "%s.prf", player_name);
3091 /* Ask for a file */
3092 if (!askfor_aux(tmp, 80)) continue;
3094 /* Dump the macros */
3095 (void)macro_dump(tmp);
3099 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3101 msg_print("Appended macros.");
3113 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3115 prt("Command: Query a macro", 16, 0);
3121 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3123 prt("Trigger: ", 18, 0);
3127 /* Get a macro trigger */
3128 do_cmd_macro_aux(buf);
3130 /* Acquire action */
3131 k = macro_find_exact(buf);
3138 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3140 msg_print("Found no macro.");
3148 /* Obtain the action */
3149 strcpy(macro__buf, macro__act[k]);
3151 /* Analyze the current action */
3152 ascii_to_text(buf, macro__buf);
3154 /* Display the current action */
3159 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3161 msg_print("Found a macro.");
3167 /* Create a macro */
3172 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3174 prt("Command: Create a macro", 16, 0);
3180 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3182 prt("Trigger: ", 18, 0);
3186 /* Get a macro trigger */
3187 do_cmd_macro_aux(buf);
3194 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3196 prt("Action: ", 20, 0);
3200 /* Convert to text */
3201 ascii_to_text(tmp, macro__buf);
3203 /* Get an encoded action */
3204 if (askfor_aux(tmp, 80))
3206 /* Convert to ascii */
3207 text_to_ascii(macro__buf, tmp);
3209 /* Link the macro */
3210 macro_add(buf, macro__buf);
3214 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3216 msg_print("Added a macro.");
3222 /* Remove a macro */
3227 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3229 prt("Command: Remove a macro", 16, 0);
3235 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3237 prt("Trigger: ", 18, 0);
3241 /* Get a macro trigger */
3242 do_cmd_macro_aux(buf);
3244 /* Link the macro */
3245 macro_add(buf, buf);
3249 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3251 msg_print("Removed a macro.");
3261 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3263 prt("Command: Append keymaps to a file", 16, 0);
3269 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3271 prt("File: ", 18, 0);
3275 /* Default filename */
3276 sprintf(tmp, "%s.prf", player_name);
3278 /* Ask for a file */
3279 if (!askfor_aux(tmp, 80)) continue;
3281 /* Dump the macros */
3282 (void)keymap_dump(tmp);
3286 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3288 msg_print("Appended keymaps.");
3293 /* Query a keymap */
3300 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3302 prt("Command: Query a keymap", 16, 0);
3308 prt("²¡¤¹¥¡¼: ", 18, 0);
3310 prt("Keypress: ", 18, 0);
3314 /* Get a keymap trigger */
3315 do_cmd_macro_aux_keymap(buf);
3317 /* Look up the keymap */
3318 act = keymap_act[mode][(byte)(buf[0])];
3325 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3327 msg_print("Found no keymap.");
3335 /* Obtain the action */
3336 strcpy(macro__buf, act);
3338 /* Analyze the current action */
3339 ascii_to_text(buf, macro__buf);
3341 /* Display the current action */
3346 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3348 msg_print("Found a keymap.");
3354 /* Create a keymap */
3359 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3361 prt("Command: Create a keymap", 16, 0);
3367 prt("²¡¤¹¥¡¼: ", 18, 0);
3369 prt("Keypress: ", 18, 0);
3373 /* Get a keymap trigger */
3374 do_cmd_macro_aux_keymap(buf);
3381 prt("¹ÔÆ°: ", 20, 0);
3383 prt("Action: ", 20, 0);
3387 /* Convert to text */
3388 ascii_to_text(tmp, macro__buf);
3390 /* Get an encoded action */
3391 if (askfor_aux(tmp, 80))
3393 /* Convert to ascii */
3394 text_to_ascii(macro__buf, tmp);
3396 /* Free old keymap */
3397 string_free(keymap_act[mode][(byte)(buf[0])]);
3399 /* Make new keymap */
3400 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3404 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3406 msg_print("Added a keymap.");
3412 /* Remove a keymap */
3417 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3419 prt("Command: Remove a keymap", 16, 0);
3425 prt("²¡¤¹¥¡¼: ", 18, 0);
3427 prt("Keypress: ", 18, 0);
3431 /* Get a keymap trigger */
3432 do_cmd_macro_aux_keymap(buf);
3434 /* Free old keymap */
3435 string_free(keymap_act[mode][(byte)(buf[0])]);
3437 /* Make new keymap */
3438 keymap_act[mode][(byte)(buf[0])] = NULL;
3442 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3444 msg_print("Removed a keymap.");
3449 /* Enter a new action */
3454 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3456 prt("Command: Enter a new action", 16, 0);
3460 /* Go to the correct location */
3463 /* Hack -- limit the value */
3466 /* Get an encoded action */
3467 if (!askfor_aux(buf, 80)) continue;
3469 /* Extract an action */
3470 text_to_ascii(macro__buf, buf);
3473 #endif /* ALLOW_MACROS */
3482 /* Flush messages */
3491 static void cmd_visuals_aux(int i, int *num, int max)
3498 sprintf(str, "%d", *num);
3500 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3503 tmp = strtol(str, NULL, 0);
3504 if (tmp >= 0 && tmp < max)
3508 else if (isupper(i))
3509 *num = (*num + max - 1) % max;
3511 *num = (*num + 1) % max;
3517 * Interact with "visuals"
3519 void do_cmd_visuals(void)
3527 const char *empty_symbol = "<< ? >>";
3529 if (use_bigtile) empty_symbol = "<< ?? >>";
3531 /* File type is "TEXT" */
3532 FILE_TYPE(FILE_TYPE_TEXT);
3535 /* Save the screen */
3539 /* Interact until done */
3545 /* Ask for a choice */
3547 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 2, 0);
3549 prt("Interact with Visuals", 2, 0);
3553 /* Give some choices */
3555 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3557 prt("(1) Load a user pref file", 4, 5);
3560 #ifdef ALLOW_VISUALS
3562 prt("(2) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3563 prt("(3) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3564 prt("(4) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 7, 5);
3565 prt("(5) (̤»ÈÍÑ)", 8, 5);
3566 prt("(6) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 9, 5);
3567 prt("(7) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 10, 5);
3568 prt("(8) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 11, 5);
3569 prt("(9) (̤»ÈÍÑ)", 12, 5);
3571 prt("(2) Dump monster attr/chars", 5, 5);
3572 prt("(3) Dump object attr/chars", 6, 5);
3573 prt("(4) Dump feature attr/chars", 7, 5);
3574 prt("(5) (unused)", 8, 5);
3575 prt("(6) Change monster attr/chars", 9, 5);
3576 prt("(7) Change object attr/chars", 10, 5);
3577 prt("(8) Change feature attr/chars", 11, 5);
3578 prt("(9) (unused)", 12, 5);
3583 prt("(0) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3585 prt("(0) Reset visuals", 13, 5);
3591 prt("¥³¥Þ¥ó¥É:", 18, 0);
3593 prt("Command: ", 15, 0);
3601 if (i == ESCAPE) break;
3603 /* Load a 'pref' file */
3608 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3610 prt("Command: Load a user pref file", 15, 0);
3616 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3618 prt("File: ", 17, 0);
3622 /* Default filename */
3623 sprintf(tmp, "%s.prf", player_name);
3626 if (!askfor_aux(tmp, 70)) continue;
3628 /* Process the given filename */
3629 (void)process_pref_file(tmp);
3632 #ifdef ALLOW_VISUALS
3634 /* Dump monster attr/chars */
3637 static cptr mark = "Monster attr/chars";
3641 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3643 prt("Command: Dump monster attr/chars", 15, 0);
3649 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3651 prt("File: ", 17, 0);
3655 /* Default filename */
3656 sprintf(tmp, "%s.prf", player_name);
3658 /* Get a filename */
3659 if (!askfor_aux(tmp, 70)) continue;
3661 /* Build the filename */
3662 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3664 /* Append to the file */
3665 if (!open_auto_dump(buf, mark)) continue;
3669 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3671 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3675 for (i = 1; i < max_r_idx; i++)
3677 monster_race *r_ptr = &r_info[i];
3679 /* Skip non-entries */
3680 if (!r_ptr->name) continue;
3682 /* Dump a comment */
3683 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3685 /* Dump the monster attr/char info */
3686 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3687 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3695 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3697 msg_print("Dumped monster attr/chars.");
3702 /* Dump object attr/chars */
3705 static cptr mark = "Object attr/chars";
3709 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3711 prt("Command: Dump object attr/chars", 15, 0);
3717 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3719 prt("File: ", 17, 0);
3723 /* Default filename */
3724 sprintf(tmp, "%s.prf", player_name);
3726 /* Get a filename */
3727 if (!askfor_aux(tmp, 70)) continue;
3729 /* Build the filename */
3730 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3732 /* Append to the file */
3733 if (!open_auto_dump(buf, mark)) continue;
3737 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3739 auto_dump_printf("\n# Object attr/char definitions\n\n");
3743 for (i = 1; i < max_k_idx; i++)
3746 object_kind *k_ptr = &k_info[i];
3748 /* Skip non-entries */
3749 if (!k_ptr->name) continue;
3751 /* Skip entries with flavor */
3752 if (k_ptr->flavor) continue;
3755 strip_name(o_name, i);
3757 /* Dump a comment */
3758 auto_dump_printf("# %s\n", o_name);
3760 /* Dump the object attr/char info */
3761 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3762 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3770 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3772 msg_print("Dumped object attr/chars.");
3777 /* Dump feature attr/chars */
3780 static cptr mark = "Feature attr/chars";
3784 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3786 prt("Command: Dump feature attr/chars", 15, 0);
3792 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3794 prt("File: ", 17, 0);
3798 /* Default filename */
3799 sprintf(tmp, "%s.prf", player_name);
3801 /* Get a filename */
3802 if (!askfor_aux(tmp, 70)) continue;
3804 /* Build the filename */
3805 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3807 /* Append to the file */
3808 if (!open_auto_dump(buf, mark)) continue;
3812 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3814 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3818 for (i = 1; i < max_f_idx; i++)
3820 feature_type *f_ptr = &f_info[i];
3822 /* Skip non-entries */
3823 if (!f_ptr->name) continue;
3825 /* Skip mimiccing features */
3826 if (f_ptr->mimic != i) continue;
3828 /* Dump a comment */
3829 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3831 /* Dump the feature attr/char info */
3832 auto_dump_printf("F:%d:0x%02X/0x%02X\n\n", i,
3833 (byte)(f_ptr->x_attr), (byte)(f_ptr->x_char));
3841 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3843 msg_print("Dumped feature attr/chars.");
3848 /* Modify monster attr/chars */
3855 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3857 prt("Command: Change monster attr/chars", 15, 0);
3861 /* Hack -- query until done */
3864 monster_race *r_ptr = &r_info[r];
3869 byte da = (r_ptr->d_attr);
3870 byte dc = (r_ptr->d_char);
3871 byte ca = (r_ptr->x_attr);
3872 byte cc = (r_ptr->x_char);
3874 /* Label the object */
3876 Term_putstr(5, 17, -1, TERM_WHITE,
3877 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
3878 r, (r_name + r_ptr->name)));
3880 Term_putstr(5, 17, -1, TERM_WHITE,
3881 format("Monster = %d, Name = %-40.40s",
3882 r, (r_name + r_ptr->name)));
3886 /* Label the Default values */
3888 Term_putstr(10, 19, -1, TERM_WHITE,
3889 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
3891 Term_putstr(10, 19, -1, TERM_WHITE,
3892 format("Default attr/char = %3u / %3u", da, dc));
3895 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3899 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
3901 Term_putch(43, 19, a, c);
3902 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
3904 /* Label the Current values */
3906 Term_putstr(10, 20, -1, TERM_WHITE,
3907 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
3909 Term_putstr(10, 20, -1, TERM_WHITE,
3910 format("Current attr/char = %3u / %3u", ca, cc));
3913 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3917 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
3919 Term_putch(43, 20, a, c);
3920 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
3925 Term_putstr(0, 22, -1, TERM_WHITE,
3926 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
3928 Term_putstr(0, 22, -1, TERM_WHITE,
3929 "Command (n/N/^N/a/A/^A/c/C/^C): ");
3936 if (i == ESCAPE) break;
3938 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3939 else if (isupper(i)) c = 'a' + i - 'A';
3945 cmd_visuals_aux(i, &r, max_r_idx);
3948 t = (int)r_ptr->x_attr;
3949 cmd_visuals_aux(i, &t, 256);
3950 r_ptr->x_attr = (byte)t;
3953 t = (int)r_ptr->x_char;
3954 cmd_visuals_aux(i, &t, 256);
3955 r_ptr->x_char = (byte)t;
3961 /* Modify object attr/chars */
3968 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3970 prt("Command: Change object attr/chars", 15, 0);
3974 /* Hack -- query until done */
3977 object_kind *k_ptr = &k_info[k];
3982 byte da = (byte)k_ptr->d_attr;
3983 byte dc = (byte)k_ptr->d_char;
3984 byte ca = (byte)k_ptr->x_attr;
3985 byte cc = (byte)k_ptr->x_char;
3987 /* Label the object */
3989 Term_putstr(5, 17, -1, TERM_WHITE,
3990 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
3991 k, (k_name + k_ptr->name)));
3993 Term_putstr(5, 17, -1, TERM_WHITE,
3994 format("Object = %d, Name = %-40.40s",
3995 k, (k_name + k_ptr->name)));
3999 /* Label the Default values */
4001 Term_putstr(10, 19, -1, TERM_WHITE,
4002 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4004 Term_putstr(10, 19, -1, TERM_WHITE,
4005 format("Default attr/char = %3d / %3d", da, dc));
4008 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4011 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4013 Term_putch(43, 19, a, c);
4014 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4017 /* Label the Current values */
4019 Term_putstr(10, 20, -1, TERM_WHITE,
4020 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4022 Term_putstr(10, 20, -1, TERM_WHITE,
4023 format("Current attr/char = %3d / %3d", ca, cc));
4026 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4029 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4031 Term_putch(43, 20, a, c);
4032 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4037 Term_putstr(0, 22, -1, TERM_WHITE,
4038 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4040 Term_putstr(0, 22, -1, TERM_WHITE,
4041 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4048 if (i == ESCAPE) break;
4050 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4051 else if (isupper(i)) c = 'a' + i - 'A';
4057 cmd_visuals_aux(i, &k, max_k_idx);
4060 t = (int)k_info[k].x_attr;
4061 cmd_visuals_aux(i, &t, 256);
4062 k_info[k].x_attr = (byte)t;
4065 t = (int)k_info[k].x_char;
4066 cmd_visuals_aux(i, &t, 256);
4067 k_info[k].x_char = (byte)t;
4073 /* Modify feature attr/chars */
4080 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
4082 prt("Command: Change feature attr/chars", 15, 0);
4086 /* Hack -- query until done */
4089 feature_type *f_ptr = &f_info[f];
4094 byte da = (byte)f_ptr->d_attr;
4095 byte dc = (byte)f_ptr->d_char;
4096 byte ca = (byte)f_ptr->x_attr;
4097 byte cc = (byte)f_ptr->x_char;
4099 /* Label the object */
4101 Term_putstr(5, 17, -1, TERM_WHITE,
4102 format("ÃÏ·Á = %d, ̾Á° = %-40.40s",
4103 f, (f_name + f_ptr->name)));
4105 Term_putstr(5, 17, -1, TERM_WHITE,
4106 format("Terrain = %d, Name = %-40.40s",
4107 f, (f_name + f_ptr->name)));
4111 /* Label the Default values */
4113 Term_putstr(10, 19, -1, TERM_WHITE,
4114 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4116 Term_putstr(10, 19, -1, TERM_WHITE,
4117 format("Default attr/char = %3d / %3d", da, dc));
4120 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4123 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4125 Term_putch(43, 19, a, c);
4126 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4129 /* Label the Current values */
4131 Term_putstr(10, 20, -1, TERM_WHITE,
4132 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4134 Term_putstr(10, 20, -1, TERM_WHITE,
4135 format("Current attr/char = %3d / %3d", ca, cc));
4138 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4141 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4143 Term_putch(43, 20, a, c);
4144 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4149 Term_putstr(0, 22, -1, TERM_WHITE,
4150 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4152 Term_putstr(0, 22, -1, TERM_WHITE,
4153 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4160 if (i == ESCAPE) break;
4162 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4163 else if (isupper(i)) c = 'a' + i - 'A';
4169 cmd_visuals_aux(i, &f, max_f_idx);
4172 t = (int)f_info[f].x_attr;
4173 cmd_visuals_aux(i, &t, 256);
4174 f_info[f].x_attr = (byte)t;
4177 t = (int)f_info[f].x_char;
4178 cmd_visuals_aux(i, &t, 256);
4179 f_info[f].x_char = (byte)t;
4195 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4197 msg_print("Visual attr/char tables reset.");
4202 /* Unknown option */
4208 /* Flush messages */
4213 /* Restore the screen */
4219 * Interact with "colors"
4221 void do_cmd_colors(void)
4230 /* File type is "TEXT" */
4231 FILE_TYPE(FILE_TYPE_TEXT);
4234 /* Save the screen */
4238 /* Interact until done */
4244 /* Ask for a choice */
4246 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4248 prt("Interact with Colors", 2, 0);
4252 /* Give some choices */
4254 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4256 prt("(1) Load a user pref file", 4, 5);
4261 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4262 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4264 prt("(2) Dump colors", 5, 5);
4265 prt("(3) Modify colors", 6, 5);
4272 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4274 prt("Command: ", 8, 0);
4282 if (i == ESCAPE) break;
4284 /* Load a 'pref' file */
4289 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4291 prt("Command: Load a user pref file", 8, 0);
4297 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4299 prt("File: ", 10, 0);
4304 sprintf(tmp, "%s.prf", player_name);
4307 if (!askfor_aux(tmp, 70)) continue;
4309 /* Process the given filename */
4310 (void)process_pref_file(tmp);
4312 /* Mega-Hack -- react to changes */
4313 Term_xtra(TERM_XTRA_REACT, 0);
4315 /* Mega-Hack -- redraw */
4324 static cptr mark = "Colors";
4328 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4330 prt("Command: Dump colors", 8, 0);
4336 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4338 prt("File: ", 10, 0);
4342 /* Default filename */
4343 sprintf(tmp, "%s.prf", player_name);
4345 /* Get a filename */
4346 if (!askfor_aux(tmp, 70)) continue;
4348 /* Build the filename */
4349 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4351 /* Append to the file */
4352 if (!open_auto_dump(buf, mark)) continue;
4356 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4358 auto_dump_printf("\n# Color redefinitions\n\n");
4362 for (i = 0; i < 256; i++)
4364 int kv = angband_color_table[i][0];
4365 int rv = angband_color_table[i][1];
4366 int gv = angband_color_table[i][2];
4367 int bv = angband_color_table[i][3];
4372 cptr name = "unknown";
4376 /* Skip non-entries */
4377 if (!kv && !rv && !gv && !bv) continue;
4379 /* Extract the color name */
4380 if (i < 16) name = color_names[i];
4382 /* Dump a comment */
4384 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4386 auto_dump_printf("# Color '%s'\n", name);
4389 /* Dump the monster attr/char info */
4390 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4399 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4401 msg_print("Dumped color redefinitions.");
4413 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4415 prt("Command: Modify colors", 8, 0);
4419 /* Hack -- query until done */
4428 /* Exhibit the normal colors */
4429 for (j = 0; j < 16; j++)
4431 /* Exhibit this color */
4432 Term_putstr(j*4, 20, -1, a, "###");
4434 /* Exhibit all colors */
4435 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4438 /* Describe the color */
4440 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4442 name = ((a < 16) ? color_names[a] : "undefined");
4446 /* Describe the color */
4448 Term_putstr(5, 10, -1, TERM_WHITE,
4449 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4451 Term_putstr(5, 10, -1, TERM_WHITE,
4452 format("Color = %d, Name = %s", a, name));
4456 /* Label the Current values */
4457 Term_putstr(5, 12, -1, TERM_WHITE,
4458 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4459 angband_color_table[a][0],
4460 angband_color_table[a][1],
4461 angband_color_table[a][2],
4462 angband_color_table[a][3]));
4466 Term_putstr(0, 14, -1, TERM_WHITE,
4467 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4469 Term_putstr(0, 14, -1, TERM_WHITE,
4470 "Command (n/N/k/K/r/R/g/G/b/B): ");
4478 if (i == ESCAPE) break;
4481 if (i == 'n') a = (byte)(a + 1);
4482 if (i == 'N') a = (byte)(a - 1);
4483 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4484 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4485 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4486 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4487 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4488 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4489 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4490 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4492 /* Hack -- react to changes */
4493 Term_xtra(TERM_XTRA_REACT, 0);
4495 /* Hack -- redraw */
4502 /* Unknown option */
4508 /* Flush messages */
4513 /* Restore the screen */
4519 * Note something in the message recall
4521 void do_cmd_note(void)
4530 if (!get_string("¥á¥â: ", buf, 60)) return;
4532 if (!get_string("Note: ", buf, 60)) return;
4536 /* Ignore empty notes */
4537 if (!buf[0] || (buf[0] == ' ')) return;
4539 /* Add the note to the message recall */
4541 msg_format("¥á¥â: %s", buf);
4543 msg_format("Note: %s", buf);
4550 * Mention the current version
4552 void do_cmd_version(void)
4557 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4558 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4560 msg_format("You are playing Hengband %d.%d.%d.",
4561 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4568 * Array of feeling strings
4570 static cptr do_cmd_feeling_text[11] =
4573 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4575 "Looks like any other level.",
4579 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4581 "You feel there is something special about this level.",
4585 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4587 "You nearly faint as horrible visions of death fill your mind!",
4591 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4593 "This level looks very dangerous.",
4597 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4599 "You have a very bad feeling...",
4603 "°¤¤Í½´¶¤¬¤¹¤ë...",
4605 "You have a bad feeling...",
4611 "You feel nervous.",
4615 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4617 "You feel your luck is turning...",
4621 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4623 "You don't like the look of this place.",
4627 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4629 "This level looks reasonably safe.",
4633 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4635 "What a boring place..."
4640 static cptr do_cmd_feeling_text_combat[11] =
4643 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4645 "Looks like any other level.",
4649 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4651 "You feel there is something special about this level.",
4655 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4657 "You nearly faint as horrible visions of death fill your mind!",
4661 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4663 "This level looks very dangerous.",
4667 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4669 "You have a very bad feeling...",
4673 "°¤¤Í½´¶¤¬¤¹¤ë...",
4675 "You have a bad feeling...",
4681 "You feel nervous.",
4685 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4687 "You feel your luck is turning...",
4691 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4693 "You don't like the look of this place.",
4697 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4699 "This level looks reasonably safe.",
4703 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4705 "What a boring place..."
4710 static cptr do_cmd_feeling_text_lucky[11] =
4713 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4714 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4715 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4716 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4717 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4718 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4719 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4720 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4721 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4722 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4723 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4725 "Looks like any other level.",
4726 "You feel there is something special about this level.",
4727 "You have a superb feeling about this level.",
4728 "You have an excellent feeling...",
4729 "You have a very good feeling...",
4730 "You have a good feeling...",
4731 "You feel strangely lucky...",
4732 "You feel your luck is turning...",
4733 "You like the look of this place...",
4734 "This level can't be all bad...",
4735 "What a boring place..."
4741 * Note that "feeling" is set to zero unless some time has passed.
4742 * Note that this is done when the level is GENERATED, not entered.
4744 void do_cmd_feeling(void)
4746 /* Verify the feeling */
4747 if (feeling > 10) feeling = 10;
4749 /* No useful feeling in quests */
4750 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4753 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4755 msg_print("Looks like a typical quest level.");
4761 /* No useful feeling in town */
4762 else if (p_ptr->town_num && !dun_level)
4765 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4767 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4771 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4773 msg_print("Looks like a strange wilderness.");
4781 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4783 msg_print("Looks like a typical town.");
4790 /* No useful feeling in the wilderness */
4791 else if (!dun_level)
4794 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4796 msg_print("Looks like a typical wilderness.");
4802 /* Display the feeling */
4803 if (turn - old_turn >= (150 - dun_level)*TURNS_PER_TICK || cheat_xtra)
4805 if (p_ptr->muta3 & MUT3_GOOD_LUCK) msg_print(do_cmd_feeling_text_lucky[feeling]);
4807 if((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)){
4808 msg_print(do_cmd_feeling_text_combat[feeling]);
4810 msg_print(do_cmd_feeling_text[feeling]);
4815 msg_print(do_cmd_feeling_text[0]);
4822 * Description of each monster group.
4824 static cptr monster_group_text[] =
4827 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
4856 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
4873 /* "¾åµé¥Ç¡¼¥â¥ó", */
4913 /* "Ancient Dragon/Wyrm", */
4922 "Multi-Headed Reptile",
4927 "Reptile/Amphibian",
4928 "Spider/Scorpion/Tick",
4930 /* "Major Demon", */
4946 * Symbols of monsters in each group. Note the "Uniques" group
4947 * is handled differently.
4949 static cptr monster_group_char[] =
5003 "$!?=&`.|/\\~[]()>",
5012 * hook function to sort monsters by level
5014 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5016 u16b *who = (u16b*)(u);
5021 monster_race *r_ptr1 = &r_info[w1];
5022 monster_race *r_ptr2 = &r_info[w2];
5027 if (r_ptr2->level > r_ptr1->level) return TRUE;
5028 if (r_ptr1->level > r_ptr2->level) return FALSE;
5030 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5031 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5036 * Build a list of monster indexes in the given group. Return the number
5037 * of monsters in the group.
5039 * mode & 0x01 : check for non-empty group
5040 * mode & 0x02 : cheat?
5042 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5047 /* Get a list of x_char in this group */
5048 cptr group_char = monster_group_char[grp_cur];
5050 /* XXX Hack -- Check if this is the "Uniques" group */
5051 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5053 /* Check every race */
5054 for (i = 0; i < max_r_idx; i++)
5056 /* Access the race */
5057 monster_race *r_ptr = &r_info[i];
5059 /* Skip empty race */
5060 if (!r_ptr->name) continue ;
5062 /* Require known monsters */
5063 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights ) continue;
5065 if (grp_unique && !(r_ptr->flags1 & RF1_UNIQUE)) continue;
5067 /* Check for race in the group */
5068 if (grp_unique || strchr(group_char, r_ptr->d_char))
5071 mon_idx[mon_cnt++] = i;
5073 /* XXX Hack -- Just checking for non-empty group */
5074 if (mode & 0x01) break;
5078 /* Terminate the list */
5079 mon_idx[mon_cnt] = 0;
5081 /* Select the sort method */
5082 ang_sort_comp = ang_sort_comp_monster_level;
5083 ang_sort_swap = ang_sort_swap_hook;
5085 /* Sort by monster level */
5086 ang_sort(mon_idx, &dummy_why, mon_cnt);
5088 /* Return the number of races */
5094 * Description of each monster group.
5096 static cptr object_group_text[] =
5099 "¥¥Î¥³", /* "Mushrooms" */
5100 "Ìô", /* "Potions" */
5101 "Ìý¤Ä¤Ü", /* "Flasks" */
5102 "´¬Êª", /* "Scrolls" */
5103 "»ØÎØ", /* "Rings" */
5104 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5105 "ū", /* "Whistle" */
5106 "¸÷¸»", /* "Lanterns" */
5107 "ËâË¡ËÀ", /* "Wands" */
5108 "¾ó", /* "Staffs" */
5109 "¥í¥Ã¥É", /* "Rods" */
5110 "¥«¡¼¥É", /* "Cards" */
5111 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5120 "Åá·õÎà", /* "Swords" */
5121 "Æß´ï", /* "Blunt Weapons" */
5122 "ĹÊÁÉð´ï", /* "Polearms" */
5123 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5124 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5128 "·ÚÁõ³»", /* "Soft Armor" */
5129 "½ÅÁõ³»", /* "Hard Armor" */
5130 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5131 "½â", /* "Shields" */
5132 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5133 "äƼê", /* "Gloves" */
5134 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5135 "´§", /* "Crowns" */
5136 "¥Ö¡¼¥Ä", /* "Boots" */
5184 * TVALs of items in each group
5186 static byte object_group_tval[] =
5226 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5232 * Build a list of monster indexes in the given group. Return the number
5233 * of monsters in the group.
5235 static int collect_objects(int grp_cur, int object_idx[])
5237 int i, j, k, object_cnt = 0;
5239 /* Get a list of x_char in this group */
5240 byte group_tval = object_group_tval[grp_cur];
5242 /* Check every object */
5243 for (i = 0; i < max_k_idx; i++)
5245 /* Access the race */
5246 object_kind *k_ptr = &k_info[i];
5248 /* Skip empty objects */
5249 if (!k_ptr->name) continue;
5251 /* Skip non-flavoured objects */
5252 if (!k_ptr->flavor && !p_ptr->wizard) continue;
5254 /* Skip items with no distribution (special artifacts) */
5255 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5258 /* Require objects ever seen*/
5259 if (!k_ptr->aware && !p_ptr->wizard) continue;
5261 /* Check for race in the group */
5262 if (TV_LIFE_BOOK == group_tval)
5264 /* Hack -- All spell books */
5265 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5268 object_idx[object_cnt++] = i;
5271 else if (k_ptr->tval == group_tval)
5274 object_idx[object_cnt++] = i;
5278 /* Terminate the list */
5279 object_idx[object_cnt] = 0;
5281 /* Return the number of races */
5287 * Description of each feature group.
5289 static cptr feature_group_text[] =
5297 * Build a list of feature indexes in the given group. Return the number
5298 * of features in the group.
5300 static int collect_features(int grp_cur, int *feat_idx)
5302 int i, feat_cnt = 0;
5304 /* Unused; There is a single group. */
5307 /* Check every feature */
5308 for (i = 1; i < max_f_idx; i++)
5310 /* Access the index */
5311 feature_type *f_ptr = &f_info[i];
5313 /* Skip empty index */
5314 if (!f_ptr->name) continue;
5316 /* Skip mimiccing features */
5317 if (f_ptr->mimic != i) continue;
5320 feat_idx[feat_cnt++] = i;
5323 /* Terminate the list */
5324 feat_idx[feat_cnt] = 0;
5326 /* Return the number of races */
5333 * Build a list of monster indexes in the given group. Return the number
5334 * of monsters in the group.
5336 static int collect_artifacts(int grp_cur, int object_idx[])
5338 int i, object_cnt = 0;
5340 /* Get a list of x_char in this group */
5341 byte group_tval = object_group_tval[grp_cur];
5343 /* Check every object */
5344 for (i = 0; i < max_a_idx; i++)
5346 /* Access the artifact */
5347 artifact_type *a_ptr = &a_info[i];
5349 /* Skip empty artifacts */
5350 if (!a_ptr->name) continue;
5352 /* Skip "uncreated" artifacts */
5353 if (!a_ptr->cur_num) continue;
5355 /* Check for race in the group */
5356 if (a_ptr->tval == group_tval)
5359 object_idx[object_cnt++] = i;
5363 /* Terminate the list */
5364 object_idx[object_cnt] = 0;
5366 /* Return the number of races */
5373 * Encode the screen colors
5375 static char hack[17] = "dwsorgbuDWvyRGBU";
5378 static errr photo_fgets(FILE *fff, char *buf, huge n)
5387 if (fgets(tmp, 1024, fff))
5389 /* Convert weirdness */
5390 for (s = tmp; *s; s++)
5392 /* Handle newline */
5403 else if (*s == '\t')
5405 /* Hack -- require room */
5406 if (i + 8 >= n) break;
5408 /* Append a space */
5411 /* Append some more spaces */
5412 while (!(i % 8)) buf[i++] = ' ';
5416 else if (iskanji(*s))
5423 /* Ⱦ³Ñ¤«¤Ê¤ËÂбþ */
5424 else if ((((int)*s & 0xff) > 0xa1) && (((int)*s & 0xff ) < 0xdf))
5431 /* Handle printables */
5452 * Hack -- load a screen dump from a file
5454 void do_cmd_load_screen(void)
5469 Term_get_size(&wid, &hgt);
5471 /* Build the filename */
5472 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5474 /* Append to the file */
5475 fff = my_fopen(buf, "r");
5480 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5482 msg_format("Failed to open %s.", buf);
5489 /* Save the screen */
5492 /* Clear the screen */
5496 /* Load the screen */
5497 for (y = 0; okay && (y < hgt); y++)
5499 /* Get a line of data */
5500 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5503 for (x = 0; x < wid - 1; x++)
5505 /* Put the attr/char */
5506 Term_draw(x, y, TERM_WHITE, buf[x]);
5510 /* Get the blank line */
5511 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5514 /* Dump the screen */
5515 for (y = 0; okay && (y < hgt); y++)
5517 /* Get a line of data */
5518 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5521 for (x = 0; x < wid - 1; x++)
5523 /* Get the attr/char */
5524 (void)(Term_what(x, y, &a, &c));
5526 /* Look up the attr */
5527 for (i = 0; i < 16; i++)
5529 /* Use attr matches */
5530 if (hack[i] == buf[x]) a = i;
5533 /* Put the attr/char */
5534 Term_draw(x, y, a, c);
5539 /* Get the blank line */
5540 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5549 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5551 msg_print("Screen dump loaded.");
5558 /* Restore the screen */
5565 cptr inven_res_label =
5567 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5569 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5572 /* XTRA HACK RESLIST */
5573 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr,
5574 int *j, byte tval, char *where)
5576 char o_name[MAX_NLEN];
5577 u32b flgs[TR_FLAG_SIZE];
5579 if (!o_ptr->k_idx)return;
5580 if (o_ptr->tval != tval)return;
5583 * HACK:Ring of Lordly protection and Dragon shield/helm
5584 * have random resistances.
5586 if ( ((o_ptr->tval >= TV_BOW && o_ptr->tval<= TV_DRAG_ARMOR && o_ptr->name2)
5587 || (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_LORDLY)
5588 || (o_ptr->tval == TV_SHIELD && o_ptr->sval == SV_DRAGON_SHIELD)
5589 || (o_ptr->tval == TV_HELM && o_ptr->sval == SV_DRAGON_HELM)
5590 || (o_ptr->tval == TV_GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)
5591 || (o_ptr->tval == TV_BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)
5592 || o_ptr->art_name || o_ptr->name1) && object_known_p(o_ptr))
5595 object_desc(o_name, o_ptr, TRUE, 0);
5597 while ( o_name[i] && i < 26 ){
5599 if (iskanji(o_name[i])) i++;
5603 if(i<28) while(i<28){o_name[i]=' ';i++;}
5606 fprintf(fff,"%s %s", where, o_name);
5608 if (!(o_ptr->ident & (IDENT_MENTAL)))
5611 fprintf(fff, "-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n");
5613 fprintf(fff, "-------unknown------------ -------unknown------\n");
5617 object_flags_known(o_ptr, flgs);
5620 if (have_flag(flgs, TR_IM_ACID)) fprintf(fff,"¡ö");
5621 else if (have_flag(flgs, TR_RES_ACID)) fprintf(fff,"¡Ü");
5622 else fprintf(fff,"¡¦");
5624 if (have_flag(flgs, TR_IM_ELEC)) fprintf(fff,"¡ö");
5625 else if (have_flag(flgs, TR_RES_ELEC)) fprintf(fff,"¡Ü");
5626 else fprintf(fff,"¡¦");
5628 if (have_flag(flgs, TR_IM_FIRE)) fprintf(fff,"¡ö");
5629 else if (have_flag(flgs, TR_RES_FIRE)) fprintf(fff,"¡Ü");
5630 else fprintf(fff,"¡¦");
5632 if (have_flag(flgs, TR_IM_COLD)) fprintf(fff,"¡ö");
5633 else if (have_flag(flgs, TR_RES_COLD)) fprintf(fff,"¡Ü");
5634 else fprintf(fff,"¡¦");
5636 if (have_flag(flgs, TR_RES_POIS)) fprintf(fff,"¡Ü");
5637 else fprintf(fff,"¡¦");
5639 if (have_flag(flgs, TR_RES_LITE)) fprintf(fff,"¡Ü");
5640 else fprintf(fff,"¡¦");
5642 if (have_flag(flgs, TR_RES_DARK)) fprintf(fff,"¡Ü");
5643 else fprintf(fff,"¡¦");
5645 if (have_flag(flgs, TR_RES_SHARDS)) fprintf(fff,"¡Ü");
5646 else fprintf(fff,"¡¦");
5648 if (have_flag(flgs, TR_RES_SOUND)) fprintf(fff,"¡Ü");
5649 else fprintf(fff,"¡¦");
5651 if (have_flag(flgs, TR_RES_NETHER)) fprintf(fff,"¡Ü");
5652 else fprintf(fff,"¡¦");
5654 if (have_flag(flgs, TR_RES_NEXUS)) fprintf(fff,"¡Ü");
5655 else fprintf(fff,"¡¦");
5657 if (have_flag(flgs, TR_RES_CHAOS)) fprintf(fff,"¡Ü");
5658 else fprintf(fff,"¡¦");
5660 if (have_flag(flgs, TR_RES_DISEN)) fprintf(fff,"¡Ü");
5661 else fprintf(fff,"¡¦");
5665 if (have_flag(flgs, TR_RES_BLIND)) fprintf(fff,"¡Ü");
5666 else fprintf(fff,"¡¦");
5668 if (have_flag(flgs, TR_RES_FEAR)) fprintf(fff,"¡Ü");
5669 else fprintf(fff,"¡¦");
5671 if (have_flag(flgs, TR_RES_CONF)) fprintf(fff,"¡Ü");
5672 else fprintf(fff,"¡¦");
5674 if (have_flag(flgs, TR_FREE_ACT)) fprintf(fff,"¡Ü");
5675 else fprintf(fff,"¡¦");
5677 if (have_flag(flgs, TR_SEE_INVIS)) fprintf(fff,"¡Ü");
5678 else fprintf(fff,"¡¦");
5680 if (have_flag(flgs, TR_HOLD_LIFE)) fprintf(fff,"¡Ü");
5681 else fprintf(fff,"¡¦");
5683 if (have_flag(flgs, TR_TELEPATHY)) fprintf(fff,"¡Ü");
5684 else fprintf(fff,"¡¦");
5686 if (have_flag(flgs, TR_SLOW_DIGEST)) fprintf(fff,"¡Ü");
5687 else fprintf(fff,"¡¦");
5690 if (have_flag(flgs, TR_REGEN)) fprintf(fff,"¡Ü");
5691 else fprintf(fff,"¡¦");
5693 if (have_flag(flgs, TR_FEATHER)) fprintf(fff,"¡Ü");
5694 else fprintf(fff,"¡¦");
5696 if (have_flag(flgs, TR_IM_ACID)) fprintf(fff,"* ");
5697 else if (have_flag(flgs, TR_RES_ACID)) fprintf(fff,"+ ");
5698 else fprintf(fff,". ");
5700 if (have_flag(flgs, TR_IM_ELEC)) fprintf(fff,"* ");
5701 else if (have_flag(flgs, TR_RES_ELEC)) fprintf(fff,"+ ");
5702 else fprintf(fff,". ");
5704 if (have_flag(flgs, TR_IM_FIRE)) fprintf(fff,"* ");
5705 else if (have_flag(flgs, TR_RES_FIRE)) fprintf(fff,"+ ");
5706 else fprintf(fff,". ");
5708 if (have_flag(flgs, TR_IM_COLD)) fprintf(fff,"* ");
5709 else if (have_flag(flgs, TR_RES_COLD)) fprintf(fff,"+ ");
5710 else fprintf(fff,". ");
5712 if (have_flag(flgs, TR_RES_POIS)) fprintf(fff,"+ ");
5713 else fprintf(fff,". ");
5715 if (have_flag(flgs, TR_RES_LITE)) fprintf(fff,"+ ");
5716 else fprintf(fff,". ");
5718 if (have_flag(flgs, TR_RES_DARK)) fprintf(fff,"+ ");
5719 else fprintf(fff,". ");
5721 if (have_flag(flgs, TR_RES_SHARDS)) fprintf(fff,"+ ");
5722 else fprintf(fff,". ");
5724 if (have_flag(flgs, TR_RES_SOUND)) fprintf(fff,"+ ");
5725 else fprintf(fff,". ");
5727 if (have_flag(flgs, TR_RES_NETHER)) fprintf(fff,"+ ");
5728 else fprintf(fff,". ");
5730 if (have_flag(flgs, TR_RES_NEXUS)) fprintf(fff,"+ ");
5731 else fprintf(fff,". ");
5733 if (have_flag(flgs, TR_RES_CHAOS)) fprintf(fff,"+ ");
5734 else fprintf(fff,". ");
5736 if (have_flag(flgs, TR_RES_DISEN)) fprintf(fff,"+ ");
5737 else fprintf(fff,". ");
5741 if (have_flag(flgs, TR_RES_BLIND)) fprintf(fff,"+ ");
5742 else fprintf(fff,". ");
5744 if (have_flag(flgs, TR_RES_FEAR)) fprintf(fff,"+ ");
5745 else fprintf(fff,". ");
5747 if (have_flag(flgs, TR_RES_CONF)) fprintf(fff,"+ ");
5748 else fprintf(fff,". ");
5750 if (have_flag(flgs, TR_FREE_ACT)) fprintf(fff,"+ ");
5751 else fprintf(fff,". ");
5753 if (have_flag(flgs, TR_SEE_INVIS)) fprintf(fff,"+ ");
5754 else fprintf(fff,". ");
5756 if (have_flag(flgs, TR_HOLD_LIFE)) fprintf(fff,"+ ");
5757 else fprintf(fff,". ");
5759 if (have_flag(flgs, TR_TELEPATHY)) fprintf(fff,"+ ");
5760 else fprintf(fff,". ");
5762 if (have_flag(flgs, TR_SLOW_DIGEST)) fprintf(fff,"+ ");
5763 else fprintf(fff,". ");
5766 if (have_flag(flgs, TR_REGEN)) fprintf(fff,"+ ");
5767 else fprintf(fff,". ");
5769 if (have_flag(flgs, TR_FEATHER)) fprintf(fff,"+ ");
5770 else fprintf(fff,". ");
5778 fprintf(fff,"%s\n", inven_res_label);
5784 * Display *ID* ed weapons/armors's resistances
5786 static void do_cmd_knowledge_inven(void)
5791 char file_name[1024];
5802 /* Open a new file */
5803 fff = my_fopen_temp(file_name, 1024);
5806 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5808 msg_format("Failed to create temporary file %s.", file_name);
5813 fprintf(fff,"%s\n",inven_res_label);
5815 for (tval=TV_BOW; tval <= TV_RING; tval++){
5818 for (;j<9;j++) fprintf(fff, "\n");
5820 fprintf(fff,"%s\n",inven_res_label);
5824 strcpy(where, "Áõ");
5826 strcpy(where, "E ");
5828 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5830 o_ptr = &inventory[i];
5831 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5835 strcpy(where, "»ý");
5837 strcpy(where, "I ");
5839 for (i = 0; i < INVEN_PACK; i++)
5841 o_ptr = &inventory[i];
5842 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5846 /* Print all homes in the different towns */
5847 st_ptr = &town[1].store[STORE_HOME];
5849 strcpy(where, "²È");
5851 strcpy(where, "H ");
5854 /* Dump all available items */
5855 for (i = 0; i < st_ptr->stock_num; i++)
5857 o_ptr = &st_ptr->stock[i];
5858 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5862 /* Close the file */
5865 /* Display the file contents */
5867 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5869 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5872 /* Remove the file */
5877 void do_cmd_save_screen_html_aux(char *filename, int message)
5881 byte a = 0, old_a = 0;
5895 cptr html_head[] = {
5896 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5900 cptr html_foot[] = {
5902 "</body>\n</html>\n",
5908 Term_get_size(&wid, &hgt);
5910 /* File type is "TEXT" */
5911 FILE_TYPE(FILE_TYPE_TEXT);
5913 /* Append to the file */
5914 fff = my_fopen(filename, "w");
5920 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5922 msg_format("Failed to open file %s.", filename);
5930 /* Save the screen */
5934 /* Build the filename */
5935 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5936 tmpfff = my_fopen(buf, "r");
5938 for (i = 0; html_head[i]; i++)
5939 fprintf(fff, html_head[i]);
5943 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5945 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
5949 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
5951 fprintf(fff, "%s\n", buf);
5956 /* Dump the screen */
5957 for (y = 0; y < hgt; y++)
5964 for (x = 0; x < wid - 1; x++)
5968 /* Get the attr/char */
5969 (void)(Term_what(x, y, &a, &c));
5973 case '&': cc = "&"; break;
5974 case '<': cc = "<"; break;
5975 case '>': cc = ">"; break;
5977 case 0x1f: c = '.'; break;
5978 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5983 if ((y == 0 && x == 0) || a != old_a) {
5984 rv = angband_color_table[a][1];
5985 gv = angband_color_table[a][2];
5986 bv = angband_color_table[a][3];
5987 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5988 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5992 fprintf(fff, "%s", cc);
5994 fprintf(fff, "%c", c);
5997 fprintf(fff, "</font>");
6000 for (i = 0; html_foot[i]; i++)
6001 fprintf(fff, html_foot[i]);
6006 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6008 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6012 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6014 fprintf(fff, "%s\n", buf);
6029 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6031 msg_print("Screen dump saved.");
6036 /* Restore the screen */
6042 * Hack -- save a screen dump to a file
6044 static void do_cmd_save_screen_html(void)
6046 char buf[1024], tmp[256] = "screen.html";
6049 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6051 if (!get_string("File name: ", tmp, 80))
6055 /* Build the filename */
6056 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6060 do_cmd_save_screen_html_aux(buf, 1);
6065 * Redefinable "save_screen" action
6067 void (*screendump_aux)(void) = NULL;
6071 * Hack -- save a screen dump to a file
6073 void do_cmd_save_screen(void)
6075 bool old_use_graphics = use_graphics;
6076 bool html_dump = FALSE;
6081 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6083 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6088 if (c == 'Y' || c == 'y')
6090 else if (c == 'H' || c == 'h')
6102 Term_get_size(&wid, &hgt);
6104 if (old_use_graphics)
6106 use_graphics = FALSE;
6109 /* Redraw everything */
6110 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6112 /* Hack -- update */
6118 do_cmd_save_screen_html();
6122 /* Do we use a special screendump function ? */
6123 else if (screendump_aux)
6125 /* Dump the screen to a graphics file */
6126 (*screendump_aux)();
6128 else /* Dump the screen as text */
6139 /* Build the filename */
6140 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6142 /* File type is "TEXT" */
6143 FILE_TYPE(FILE_TYPE_TEXT);
6145 /* Append to the file */
6146 fff = my_fopen(buf, "w");
6152 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6154 msg_format("Failed to open file %s.", buf);
6161 /* Save the screen */
6165 /* Dump the screen */
6166 for (y = 0; y < hgt; y++)
6169 for (x = 0; x < wid - 1; x++)
6171 /* Get the attr/char */
6172 (void)(Term_what(x, y, &a, &c));
6182 fprintf(fff, "%s\n", buf);
6189 /* Dump the screen */
6190 for (y = 0; y < hgt; y++)
6193 for (x = 0; x < wid - 1; x++)
6195 /* Get the attr/char */
6196 (void)(Term_what(x, y, &a, &c));
6199 buf[x] = hack[a&0x0F];
6206 fprintf(fff, "%s\n", buf);
6218 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6220 msg_print("Screen dump saved.");
6226 /* Restore the screen */
6230 if (old_use_graphics)
6232 use_graphics = TRUE;
6235 /* Redraw everything */
6236 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6238 /* Hack -- update */
6245 * Sorting hook -- Comp function -- see below
6247 * We use "u" to point to array of monster indexes,
6248 * and "v" to select the type of sorting to perform on "u".
6250 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6252 u16b *who = (u16b*)(u);
6254 u16b *why = (u16b*)(v);
6261 /* Sort by total kills */
6264 /* Extract total kills */
6265 z1 = a_info[w1].tval;
6266 z2 = a_info[w2].tval;
6268 /* Compare total kills */
6269 if (z1 < z2) return (TRUE);
6270 if (z1 > z2) return (FALSE);
6274 /* Sort by monster level */
6277 /* Extract levels */
6278 z1 = a_info[w1].sval;
6279 z2 = a_info[w2].sval;
6281 /* Compare levels */
6282 if (z1 < z2) return (TRUE);
6283 if (z1 > z2) return (FALSE);
6287 /* Sort by monster experience */
6290 /* Extract experience */
6291 z1 = a_info[w1].level;
6292 z2 = a_info[w2].level;
6294 /* Compare experience */
6295 if (z1 < z2) return (TRUE);
6296 if (z1 > z2) return (FALSE);
6300 /* Compare indexes */
6306 * Sorting hook -- Swap function -- see below
6308 * We use "u" to point to array of monster indexes,
6309 * and "v" to select the type of sorting to perform.
6311 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6313 u16b *who = (u16b*)(u);
6328 * Check the status of "artifacts"
6330 static void do_cmd_knowledge_artifacts(void)
6332 int i, k, z, x, y, n = 0;
6338 char file_name[1024];
6340 char base_name[MAX_NLEN];
6344 /* Open a new file */
6345 fff = my_fopen_temp(file_name, 1024);
6349 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6351 msg_format("Failed to create temporary file %s.", file_name);
6357 /* Allocate the "who" array */
6358 C_MAKE(who, max_a_idx, s16b);
6360 /* Allocate the "okay" array */
6361 C_MAKE(okay, max_a_idx, bool);
6363 /* Scan the artifacts */
6364 for (k = 0; k < max_a_idx; k++)
6366 artifact_type *a_ptr = &a_info[k];
6371 /* Skip "empty" artifacts */
6372 if (!a_ptr->name) continue;
6374 /* Skip "uncreated" artifacts */
6375 if (!a_ptr->cur_num) continue;
6381 /* Check the dungeon */
6382 for (y = 0; y < cur_hgt; y++)
6384 for (x = 0; x < cur_wid; x++)
6386 cave_type *c_ptr = &cave[y][x];
6388 s16b this_o_idx, next_o_idx = 0;
6390 /* Scan all objects in the grid */
6391 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6395 /* Acquire object */
6396 o_ptr = &o_list[this_o_idx];
6398 /* Acquire next object */
6399 next_o_idx = o_ptr->next_o_idx;
6401 /* Ignore non-artifacts */
6402 if (!artifact_p(o_ptr)) continue;
6404 /* Ignore known items */
6405 if (object_known_p(o_ptr)) continue;
6407 /* Note the artifact */
6408 okay[o_ptr->name1] = FALSE;
6413 /* Check the inventory and equipment */
6414 for (i = 0; i < INVEN_TOTAL; i++)
6416 object_type *o_ptr = &inventory[i];
6418 /* Ignore non-objects */
6419 if (!o_ptr->k_idx) continue;
6421 /* Ignore non-artifacts */
6422 if (!artifact_p(o_ptr)) continue;
6424 /* Ignore known items */
6425 if (object_known_p(o_ptr)) continue;
6427 /* Note the artifact */
6428 okay[o_ptr->name1] = FALSE;
6431 for (k = 0; k < max_a_idx; k++)
6433 if (okay[k]) who[n++] = k;
6436 /* Select the sort method */
6437 ang_sort_comp = ang_sort_art_comp;
6438 ang_sort_swap = ang_sort_art_swap;
6440 /* Sort the array by dungeon depth of monsters */
6441 ang_sort(who, &why, n);
6443 /* Scan the artifacts */
6444 for (k = 0; k < n; k++)
6446 artifact_type *a_ptr = &a_info[who[k]];
6450 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6452 strcpy(base_name, "Unknown Artifact");
6456 /* Obtain the base object type */
6457 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6465 /* Get local object */
6468 /* Create fake object */
6469 object_prep(q_ptr, z);
6471 /* Make it an artifact */
6472 q_ptr->name1 = (byte)who[k];
6474 /* Describe the artifact */
6475 object_desc_store(base_name, q_ptr, FALSE, 0);
6478 /* Hack -- Build the artifact name */
6480 fprintf(fff, " %s\n", base_name);
6482 fprintf(fff, " The %s\n", base_name);
6487 /* Free the "who" array */
6488 C_KILL(who, max_a_idx, s16b);
6490 /* Free the "okay" array */
6491 C_KILL(okay, max_a_idx, bool);
6493 /* Close the file */
6496 /* Display the file contents */
6498 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6500 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6504 /* Remove the file */
6510 * Display known uniques
6512 static void do_cmd_knowledge_uniques(void)
6520 char file_name[1024];
6522 /* Open a new file */
6523 fff = my_fopen_temp(file_name, 1024);
6527 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6529 msg_format("Failed to create temporary file %s.", file_name);
6535 /* Allocate the "who" array */
6536 C_MAKE(who, max_r_idx, s16b);
6538 /* Scan the monsters */
6539 for (i = 1; i < max_r_idx; i++)
6541 monster_race *r_ptr = &r_info[i];
6543 /* Use that monster */
6544 if (r_ptr->name) who[n++] = i;
6547 /* Select the sort method */
6548 ang_sort_comp = ang_sort_comp_hook;
6549 ang_sort_swap = ang_sort_swap_hook;
6551 /* Sort the array by dungeon depth of monsters */
6552 ang_sort(who, &why, n);
6554 /* Scan the monster races */
6555 for (k = 0; k < n; k++)
6557 monster_race *r_ptr = &r_info[who[k]];
6559 /* Only print Uniques */
6560 if (r_ptr->flags1 & (RF1_UNIQUE))
6562 bool dead = (r_ptr->max_num == 0);
6566 /* Only display "known" uniques */
6567 if (dead || cheat_know || r_ptr->r_sights)
6569 /* Print a message */
6571 fprintf(fff, " %s¤Ï¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¡£\n",
6572 (r_name + r_ptr->name));
6574 fprintf(fff, " %s is alive\n",
6575 (r_name + r_ptr->name));
6582 /* Free the "who" array */
6583 C_KILL(who, max_r_idx, s16b);
6585 /* Close the file */
6588 /* Display the file contents */
6590 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6592 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6596 /* Remove the file */
6602 * Display weapon-exp
6604 static void do_cmd_knowledge_weapon_exp(void)
6606 int i, j, num, weapon_exp;
6610 char file_name[1024];
6613 /* Open a new file */
6614 fff = my_fopen_temp(file_name, 1024);
6617 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6619 msg_format("Failed to create temporary file %s.", file_name);
6625 for (i = 0; i < 5; i++)
6627 for (num = 0; num < 64; num++)
6629 for (j = 0; j < max_k_idx; j++)
6631 object_kind *k_ptr = &k_info[j];
6633 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6635 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6637 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6639 fprintf(fff, "%-25s ", tmp);
6640 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6641 else fprintf(fff, " ");
6642 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6643 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6651 /* Close the file */
6654 /* Display the file contents */
6656 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6658 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6662 /* Remove the file */
6670 static void do_cmd_knowledge_spell_exp(void)
6672 int i = 0, spell_exp, exp_level;
6677 char file_name[1024];
6679 /* Open a new file */
6680 fff = my_fopen_temp(file_name, 1024);
6683 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6685 msg_format("Failed to create temporary file %s.", file_name);
6691 if (p_ptr->realm1 != REALM_NONE)
6694 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6696 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6698 for (i = 0; i < 32; i++)
6700 if (!is_magic(p_ptr->realm1))
6702 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6706 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6708 if (s_ptr->slevel >= 99) continue;
6709 spell_exp = p_ptr->spell_exp[i];
6710 exp_level = spell_exp_level(spell_exp);
6711 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm1) - 1][i]);
6712 if (p_ptr->realm1 == REALM_HISSATSU)
6713 fprintf(fff, "[--]");
6716 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6717 else fprintf(fff, " ");
6718 fprintf(fff, "%s", exp_level_str[exp_level]);
6720 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6725 if (p_ptr->realm2 != REALM_NONE)
6728 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6730 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6732 for (i = 0; i < 32; i++)
6734 if (!is_magic(p_ptr->realm1))
6736 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6740 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6742 if (s_ptr->slevel >= 99) continue;
6744 spell_exp = p_ptr->spell_exp[i + 32];
6745 exp_level = spell_exp_level(spell_exp);
6746 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm2) - 1][i]);
6747 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6748 else fprintf(fff, " ");
6749 fprintf(fff, "%s", exp_level_str[exp_level]);
6750 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6755 /* Close the file */
6758 /* Display the file contents */
6760 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6762 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6766 /* Remove the file */
6774 static void do_cmd_knowledge_skill_exp(void)
6776 int i = 0, skill_exp;
6780 char file_name[1024];
6782 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6784 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6787 /* Open a new file */
6788 fff = my_fopen_temp(file_name, 1024);
6791 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6793 msg_format("Failed to create temporary file %s.", file_name);
6799 for (i = 0; i < 3; i++)
6801 skill_exp = p_ptr->skill_exp[i];
6802 fprintf(fff, "%-20s ", skill_name[i]);
6803 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6804 else fprintf(fff, " ");
6805 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6806 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6810 /* Close the file */
6813 /* Display the file contents */
6815 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6817 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6821 /* Remove the file */
6827 * Pluralize a monster name
6829 void plural_aux(char *Name)
6831 int NameLen = strlen(Name);
6833 if (strstr(Name, "Disembodied hand"))
6835 strcpy(Name, "Disembodied hands that strangled people");
6837 else if (strstr(Name, "Colour out of space"))
6839 strcpy(Name, "Colours out of space");
6841 else if (strstr(Name, "stairway to hell"))
6843 strcpy(Name, "stairways to hell");
6845 else if (strstr(Name, "Dweller on the threshold"))
6847 strcpy(Name, "Dwellers on the threshold");
6849 else if (strstr(Name, " of "))
6851 cptr aider = strstr(Name, " of ");
6862 if (dummy[i-1] == 's')
6864 strcpy(&(dummy[i]), "es");
6869 strcpy(&(dummy[i]), "s");
6872 strcpy(&(dummy[i+1]), aider);
6873 strcpy(Name, dummy);
6875 else if (strstr(Name, "coins"))
6878 strcpy(dummy, "piles of ");
6879 strcat(dummy, Name);
6880 strcpy(Name, dummy);
6883 else if (strstr(Name, "Manes"))
6887 else if (streq(&(Name[NameLen - 2]), "ey"))
6889 strcpy(&(Name[NameLen - 2]), "eys");
6891 else if (Name[NameLen - 1] == 'y')
6893 strcpy(&(Name[NameLen - 1]), "ies");
6895 else if (streq(&(Name[NameLen - 4]), "ouse"))
6897 strcpy(&(Name[NameLen - 4]), "ice");
6899 else if (streq(&(Name[NameLen - 2]), "us"))
6901 strcpy(&(Name[NameLen - 2]), "i");
6903 else if (streq(&(Name[NameLen - 6]), "kelman"))
6905 strcpy(&(Name[NameLen - 6]), "kelmen");
6907 else if (streq(&(Name[NameLen - 8]), "wordsman"))
6909 strcpy(&(Name[NameLen - 8]), "wordsmen");
6911 else if (streq(&(Name[NameLen - 7]), "oodsman"))
6913 strcpy(&(Name[NameLen - 7]), "oodsmen");
6915 else if (streq(&(Name[NameLen - 7]), "eastman"))
6917 strcpy(&(Name[NameLen - 7]), "eastmen");
6919 else if (streq(&(Name[NameLen - 8]), "izardman"))
6921 strcpy(&(Name[NameLen - 8]), "izardmen");
6923 else if (streq(&(Name[NameLen - 5]), "geist"))
6925 strcpy(&(Name[NameLen - 5]), "geister");
6927 else if (streq(&(Name[NameLen - 2]), "ex"))
6929 strcpy(&(Name[NameLen - 2]), "ices");
6931 else if (streq(&(Name[NameLen - 2]), "lf"))
6933 strcpy(&(Name[NameLen - 2]), "lves");
6935 else if (suffix(Name, "ch") ||
6936 suffix(Name, "sh") ||
6937 suffix(Name, "nx") ||
6938 suffix(Name, "s") ||
6941 strcpy(&(Name[NameLen]), "es");
6945 strcpy(&(Name[NameLen]), "s");
6950 * Display current pets
6952 static void do_cmd_knowledge_pets(void)
6956 monster_type *m_ptr;
6958 int show_upkeep = 0;
6959 char file_name[1024];
6962 /* Open a new file */
6963 fff = my_fopen_temp(file_name, 1024);
6966 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6968 msg_format("Failed to create temporary file %s.", file_name);
6974 /* Process the monsters (backwards) */
6975 for (i = m_max - 1; i >= 1; i--)
6977 /* Access the monster */
6980 /* Ignore "dead" monsters */
6981 if (!m_ptr->r_idx) continue;
6983 /* Calculate "upkeep" for pets */
6988 monster_desc(pet_name, m_ptr, 0x88);
6989 fprintf(fff, "%s (%s)", pet_name, look_mon_desc(i, 0x00));
6990 if (p_ptr->riding == i)
6992 fprintf(fff, " ¾èÇÏÃæ");
6994 fprintf(fff, " Riding");
7000 show_upkeep = calculate_upkeep();
7002 fprintf(fff, "----------------------------------------------\n");
7004 fprintf(fff, " ¹ç·×: %d ɤ¤Î¥Ú¥Ã¥È\n", t_friends);
7005 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7007 fprintf(fff, " Total: %d pet%s.\n",
7008 t_friends, (t_friends == 1 ? "" : "s"));
7009 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7014 /* Close the file */
7017 /* Display the file contents */
7019 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7021 show_file(TRUE, file_name, "Current Pets", 0, 0);
7025 /* Remove the file */
7033 * Note that the player ghosts are ignored. XXX XXX XXX
7035 static void do_cmd_knowledge_kill_count(void)
7043 char file_name[1024];
7048 /* Open a new file */
7049 fff = my_fopen_temp(file_name, 1024);
7053 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7055 msg_format("Failed to create temporary file %s.", file_name);
7061 /* Allocate the "who" array */
7062 C_MAKE(who, max_r_idx, s16b);
7065 /* Monsters slain */
7068 for (kk = 1; kk < max_r_idx; kk++)
7070 monster_race *r_ptr = &r_info[kk];
7072 if (r_ptr->flags1 & (RF1_UNIQUE))
7074 bool dead = (r_ptr->max_num == 0);
7083 s16b This = r_ptr->r_pkills;
7094 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7096 fprintf(fff,"You have defeated no enemies yet.\n\n");
7099 else if (Total == 1)
7101 fprintf(fff,"¤¢¤Ê¤¿¤Ï°ìɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n");
7103 fprintf(fff,"You have defeated one enemy.\n\n");
7108 fprintf(fff,"¤¢¤Ê¤¿¤Ï %lu ɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7110 fprintf(fff,"You have defeated %lu enemies.\n\n", Total);
7117 /* Scan the monsters */
7118 for (i = 1; i < max_r_idx; i++)
7120 monster_race *r_ptr = &r_info[i];
7122 /* Use that monster */
7123 if (r_ptr->name) who[n++] = i;
7126 /* Select the sort method */
7127 ang_sort_comp = ang_sort_comp_hook;
7128 ang_sort_swap = ang_sort_swap_hook;
7130 /* Sort the array by dungeon depth of monsters */
7131 ang_sort(who, &why, n);
7133 /* Scan the monster races */
7134 for (k = 0; k < n; k++)
7136 monster_race *r_ptr = &r_info[who[k]];
7138 if (r_ptr->flags1 & (RF1_UNIQUE))
7140 bool dead = (r_ptr->max_num == 0);
7144 /* Print a message */
7145 fprintf(fff, " %s\n",
7146 (r_name + r_ptr->name));
7152 s16b This = r_ptr->r_pkills;
7157 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita*/
7158 if(strchr("pt",r_ptr->d_char))
7159 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7161 fprintf(fff, " %3d ɤ¤Î %s\n", This, r_name + r_ptr->name);
7165 if (strstr(r_name + r_ptr->name, "coins"))
7167 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7171 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7177 strcpy(ToPlural, (r_name + r_ptr->name));
7178 plural_aux(ToPlural);
7179 fprintf(fff, " %d %s\n", This, ToPlural);
7189 fprintf(fff,"----------------------------------------------\n");
7191 fprintf(fff," ¹ç·×: %lu ɤ¤òÅݤ·¤¿¡£\n", Total);
7193 fprintf(fff," Total: %lu creature%s killed.\n",
7194 Total, (Total == 1 ? "" : "s"));
7198 /* Free the "who" array */
7199 C_KILL(who, max_r_idx, s16b);
7201 /* Close the file */
7204 /* Display the file contents */
7206 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7208 show_file(TRUE, file_name, "Kill Count", 0, 0);
7212 /* Remove the file */
7218 * Display the object groups.
7220 static void display_group_list(int col, int row, int wid, int per_page,
7221 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7225 /* Display lines until done */
7226 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7228 /* Get the group index */
7229 int grp = grp_idx[grp_top + i];
7231 /* Choose a color */
7232 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7234 /* Erase the entire line */
7235 Term_erase(col, row + i, wid);
7237 /* Display the group label */
7238 c_put_str(attr, group_text[grp], row + i, col);
7244 * Move the cursor in a browser window
7246 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7247 int *list_cur, int list_cnt)
7252 int list = *list_cur;
7254 /* Extract direction */
7257 /* Hack -- scroll up full screen */
7262 /* Hack -- scroll down full screen */
7267 d = get_keymap_dir(ch);
7272 /* Diagonals - hack */
7273 if ((ddx[d] > 0) && ddy[d])
7279 Term_get_size(&wid, &hgt);
7281 browser_rows = hgt - 8;
7283 /* Browse group list */
7288 /* Move up or down */
7289 grp += ddy[d] * (browser_rows - 1);
7292 if (grp >= grp_cnt) grp = grp_cnt - 1;
7293 if (grp < 0) grp = 0;
7294 if (grp != old_grp) list = 0;
7297 /* Browse sub-list list */
7300 /* Move up or down */
7301 list += ddy[d] * browser_rows;
7304 if (list >= list_cnt) list = list_cnt - 1;
7305 if (list < 0) list = 0;
7317 if (col < 0) col = 0;
7318 if (col > 1) col = 1;
7325 /* Browse group list */
7330 /* Move up or down */
7334 if (grp >= grp_cnt) grp = grp_cnt - 1;
7335 if (grp < 0) grp = 0;
7336 if (grp != old_grp) list = 0;
7339 /* Browse sub-list list */
7342 /* Move up or down */
7346 if (list >= list_cnt) list = list_cnt - 1;
7347 if (list < 0) list = 0;
7358 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7362 /* Clear the display lines */
7363 for (i = 0; i < height; i++)
7365 Term_erase(col, row + i, width);
7368 /* Bigtile mode uses double width */
7369 if (use_bigtile) width /= 2;
7371 /* Display lines until done */
7372 for (i = 0; i < height; i++)
7374 /* Display columns until done */
7375 for (j = 0; j < width; j++)
7383 /* Bigtile mode uses double width */
7384 if (use_bigtile) x += j;
7389 /* Ignore illegal characters */
7390 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7391 (!use_graphics && ic > 0x7f))
7397 /* Force correct code for both ASCII character and tile */
7398 if (c & 0x80) a |= 0x80;
7400 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7402 /* Display symbol */
7403 Term_putch(x, y, a, c);
7406 if (use_bigtile) Term_putch(x + 1, y, a2, c2);
7413 * Place the cursor at the collect position for visual mode
7415 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7417 int i = (a & 0x7f) - attr_top;
7418 int j = c - char_left;
7423 /* Bigtile mode uses double width */
7424 if (use_bigtile) x += j;
7426 /* Place the cursor */
7432 * Clipboard variables for copy&paste in visual mode
7434 static byte attr_idx = 0;
7435 static byte char_idx = 0;
7438 * Do visual mode command -- Change symbols
7440 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7441 int height, int width,
7442 byte *attr_top_ptr, byte *char_left_ptr,
7443 byte *cur_attr_ptr, byte *cur_char_ptr)
7445 static byte attr_old = 0, char_old = 0;
7450 if (*visual_list_ptr)
7453 *cur_attr_ptr = attr_old;
7454 *cur_char_ptr = char_old;
7455 *visual_list_ptr = FALSE;
7464 if (*visual_list_ptr)
7467 *visual_list_ptr = FALSE;
7475 if (!*visual_list_ptr)
7477 *visual_list_ptr = TRUE;
7479 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7480 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7482 attr_old = *cur_attr_ptr;
7483 char_old = *cur_char_ptr;
7491 /* Set the visual */
7492 attr_idx = *cur_attr_ptr;
7493 char_idx = *cur_char_ptr;
7502 *cur_attr_ptr = attr_idx;
7503 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7509 *cur_char_ptr = char_idx;
7510 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7516 if (*visual_list_ptr)
7519 int d = get_keymap_dir(ch);
7520 byte a = (*cur_attr_ptr & 0x7f);
7521 byte c = *cur_char_ptr;
7523 if (use_bigtile) eff_width = width / 2;
7524 else eff_width = width;
7526 /* Restrict direction */
7527 if ((a == 0) && (ddy[d] < 0)) d = 0;
7528 if ((c == 0) && (ddx[d] < 0)) d = 0;
7529 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7530 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7535 /* Force correct code for both ASCII character and tile */
7536 if (c & 0x80) a |= 0x80;
7538 /* Set the visual */
7543 /* Move the frame */
7544 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7545 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7546 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7547 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7554 /* Visual mode command is not used */
7560 * Display the monsters in a group.
7562 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7563 int mon_cur, int mon_top)
7567 /* Display lines until done */
7568 for (i = 0; i < per_page && mon_idx[mon_top + i]; i++)
7574 /* Get the race index */
7575 int r_idx = mon_idx[mon_top + i] ;
7577 /* Access the race */
7578 monster_race *r_ptr = &r_info[r_idx];
7581 /* Choose a color */
7582 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7584 /* Display the name */
7585 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7587 /* Hack -- visual_list mode */
7590 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, 60);
7592 else if (p_ptr->wizard)
7594 c_prt(attr, format("%d", r_idx), row + i, 60);
7599 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7601 /* Display symbol */
7602 Term_putch(70, row + i, a, c);
7605 if (use_bigtile) Term_putch(70 + 1, row + i, a2, c2);
7608 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7610 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 73);
7612 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "dead" : "alive"), row + i, 73);
7617 /* Clear remaining lines */
7618 for (; i < per_page; i++)
7620 Term_erase(col, row + i, 255);
7626 * Display known monsters.
7628 static void do_cmd_knowledge_monsters(void)
7631 int grp_cur, grp_top, old_grp_cur;
7632 int mon_cur, mon_top;
7633 int grp_cnt, grp_idx[100];
7641 bool visual_list = FALSE;
7642 byte attr_top = 0, char_left = 0;
7648 Term_get_size(&wid, &hgt);
7650 browser_rows = hgt - 8;
7652 /* Allocate the "mon_idx" array */
7653 C_MAKE(mon_idx, max_r_idx, s16b);
7658 /* Check every group */
7659 for (i = 0; monster_group_text[i] != NULL; i++)
7661 /* Measure the label */
7662 len = strlen(monster_group_text[i]);
7664 /* Save the maximum length */
7665 if (len > max) max = len;
7667 /* See if any monsters are known */
7668 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, 0x01))
7670 /* Build a list of groups with known monsters */
7671 grp_idx[grp_cnt++] = i;
7675 /* Terminate the list */
7676 grp_idx[grp_cnt] = -1;
7679 grp_cur = grp_top = 0;
7680 mon_cur = mon_top = 0;
7689 monster_race *r_ptr;
7696 prt("Ãμ± - ¥â¥ó¥¹¥¿¡¼", 2, 0);
7697 prt("¥°¥ë¡¼¥×", 4, 0);
7698 prt("̾Á°", 4, max + 3);
7699 if (p_ptr->wizard) prt("Idx", 4, 60);
7700 prt("ʸ»ú »¦³²¿ô", 4, 67);
7702 prt("Knowledge - Monsters", 2, 0);
7704 prt("Name", 4, max + 3);
7705 if (p_ptr->wizard) prt("Idx", 4, 60);
7706 prt("Sym Kills", 4, 67);
7709 for (i = 0; i < 78; i++)
7711 Term_putch(i, 5, TERM_WHITE, '=');
7714 for (i = 0; i < browser_rows; i++)
7716 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7722 /* Scroll group list */
7723 if (grp_cur < grp_top) grp_top = grp_cur;
7724 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7726 /* Display a list of monster groups */
7727 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7729 if (old_grp_cur != grp_cur)
7731 old_grp_cur = grp_cur;
7733 /* Get a list of monsters in the current group */
7734 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, 0x00);
7737 /* Scroll monster list */
7738 while (mon_cur < mon_top)
7739 mon_top = MAX(0, mon_top - browser_rows/2);
7740 while (mon_cur >= mon_top + browser_rows)
7741 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7745 /* Display a list of monsters in the current group */
7746 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top);
7752 /* Display a monster name */
7753 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top);
7755 /* Display visual list below first monster */
7756 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7761 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
7763 prt(format("<dir>, 'r' to recall%s%s, ESC", visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
7766 /* Get the current monster */
7767 r_ptr = &r_info[mon_idx[mon_cur]];
7769 /* Mega Hack -- track this monster race */
7770 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7772 /* Hack -- handle stuff */
7777 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7781 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7785 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7790 /* Do visual mode command if needed */
7791 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &r_ptr->x_attr, &r_ptr->x_char)) continue;
7804 /* Recall on screen */
7805 if (mon_idx[mon_cur])
7807 screen_roff(mon_idx[mon_cur], 0);
7818 /* Move the cursor */
7819 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
7826 /* Free the "mon_idx" array */
7827 C_KILL(mon_idx, max_r_idx, s16b);
7832 * Display the objects in a group.
7834 static void display_object_list(int col, int row, int per_page, int object_idx[],
7835 int object_cur, int object_top)
7839 /* Display lines until done */
7840 for (i = 0; i < per_page && object_idx[object_top + i]; i++)
7846 /* Get the object index */
7847 int k_idx = object_idx[object_top + i];
7849 /* Access the object */
7850 object_kind *k_ptr = &k_info[k_idx];
7852 /* Choose a color */
7853 byte attr = (k_ptr->aware ? TERM_WHITE : TERM_SLATE);
7854 byte cursor = (k_ptr->aware ? TERM_L_BLUE : TERM_BLUE);
7856 attr = ((i + object_top == object_cur) ? cursor : attr);
7859 strip_name(o_name, k_idx);
7861 /* Display the name */
7862 c_prt(attr, o_name, row + i, col);
7864 /* Hack -- visual_list mode */
7867 c_prt(attr, format("%02x/%02x", k_ptr->x_attr, k_ptr->x_char), row + i, 60);
7869 else if (p_ptr->wizard)
7871 c_prt(attr, format ("%d", k_idx), row + i, 70);
7874 a = k_ptr->flavor ? misc_to_attr[k_ptr->flavor] : k_ptr->x_attr;
7875 c = k_ptr->flavor ? misc_to_char[k_ptr->flavor] : k_ptr->x_char;
7877 /* Symbol is unknown */
7878 if (!k_ptr->aware && !p_ptr->wizard)
7884 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7886 /* Display symbol */
7887 Term_putch(76, row + i, a, c);
7890 if (use_bigtile) Term_putch(76 + 1, row + i, a2, c2);
7893 /* Clear remaining lines */
7894 for (; i < per_page; i++)
7896 Term_erase(col, row + i, 255);
7901 * Describe fake object
7903 static void desc_obj_fake(int k_idx)
7906 object_type object_type_body;
7908 /* Get local object */
7909 o_ptr = &object_type_body;
7911 /* Wipe the object */
7914 /* Create the artifact */
7915 object_prep(o_ptr, k_idx);
7917 /* It's fully know */
7918 o_ptr->ident |= IDENT_KNOWN;
7920 /* Track the object */
7921 /* object_actual_track(o_ptr); */
7923 /* Hack - mark as fake */
7924 /* term_obj_real = FALSE; */
7926 /* Hack -- Handle stuff */
7929 if (!screen_object(o_ptr, FALSE))
7932 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
7934 msg_print("You see nothing special.");
7943 * Display known objects
7945 static void do_cmd_knowledge_objects(void)
7948 int grp_cur, grp_top, old_grp_cur;
7949 int object_old, object_cur, object_top;
7950 int grp_cnt, grp_idx[100];
7958 bool visual_list = FALSE;
7959 byte attr_top = 0, char_left = 0;
7965 Term_get_size(&wid, &hgt);
7967 browser_rows = hgt - 8;
7969 /* Allocate the "object_idx" array */
7970 C_MAKE(object_idx, max_k_idx, int);
7975 /* Check every group */
7976 for (i = 0; object_group_text[i] != NULL; i++)
7978 /* Measure the label */
7979 len = strlen(object_group_text[i]);
7981 /* Save the maximum length */
7982 if (len > max) max = len;
7984 /* See if any monsters are known */
7985 if (collect_objects(i, object_idx))
7987 /* Build a list of groups with known monsters */
7988 grp_idx[grp_cnt++] = i;
7992 /* Terminate the list */
7993 grp_idx[grp_cnt] = -1;
7996 grp_cur = grp_top = 0;
7997 object_cur = object_top = 0;
8014 prt("Ãμ± - ¥¢¥¤¥Æ¥à", 2, 0);
8015 prt("¥°¥ë¡¼¥×", 4, 0);
8016 prt("̾Á°", 4, max + 3);
8017 if (p_ptr->wizard) prt("Idx", 4, 70);
8020 prt("Knowledge - objects", 2, 0);
8022 prt("Name", 4, max + 3);
8023 if (p_ptr->wizard) prt("Idx", 4, 70);
8027 for (i = 0; i < 78; i++)
8029 Term_putch(i, 5, TERM_WHITE, '=');
8032 for (i = 0; i < browser_rows; i++)
8034 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8040 /* Scroll group list */
8041 if (grp_cur < grp_top) grp_top = grp_cur;
8042 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8044 /* Display a list of object groups */
8045 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8047 if (old_grp_cur != grp_cur)
8049 old_grp_cur = grp_cur;
8051 /* Get a list of objects in the current group */
8052 object_cnt = collect_objects(grp_idx[grp_cur], object_idx);
8055 /* Scroll object list */
8056 while (object_cur < object_top)
8057 object_top = MAX(0, object_top - browser_rows/2);
8058 while (object_cur >= object_top + browser_rows)
8059 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8063 /* Display a list of objects in the current group */
8064 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top);
8068 object_top = object_cur;
8070 /* Display a list of objects in the current group */
8071 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top);
8073 /* Display visual list below first object */
8074 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8077 /* Get the current object */
8078 k_ptr = &k_info[object_idx[object_cur]];
8080 /* Mega Hack -- track this object */
8081 if (object_cnt) object_kind_track(object_idx[object_cur]);
8085 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8087 prt(format("<dir>, 'r' to recall%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
8090 /* The "current" object changed */
8091 if (object_old != object_idx[object_cur])
8093 /* Hack -- handle stuff */
8096 /* Remember the "current" object */
8097 object_old = object_idx[object_cur];
8102 place_visual_list_cursor(max + 3, 7, k_ptr->x_attr, k_ptr->x_char, attr_top, char_left);
8106 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8110 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8115 /* Do visual mode command if needed */
8116 /* Symbol of objects with flavor cannot be changed */
8117 if (!k_ptr->flavor && visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &k_ptr->x_attr, &k_ptr->x_char)) continue;
8130 /* Recall on screen */
8132 desc_obj_fake(object_idx[object_cur]);
8140 /* Move the cursor */
8141 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8147 /* Free the "object_idx" array */
8148 C_KILL(object_idx, max_k_idx, int);
8154 * Display the features in a group.
8156 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8157 int feat_cur, int feat_top)
8161 /* Display lines until done */
8162 for (i = 0; i < per_page && feat_idx[feat_top + i]; i++)
8169 int f_idx = feat_idx[feat_top + i];
8171 /* Access the index */
8172 feature_type *f_ptr = &f_info[f_idx];
8174 /* Choose a color */
8175 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8177 /* Display the name */
8178 c_prt(attr, f_name + f_ptr->name, row + i, col);
8180 /* Hack -- visual_list mode */
8183 c_prt(attr, format("%02x/%02x", f_ptr->x_attr, f_ptr->x_char), row + i, 60);
8189 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
8191 /* Display symbol */
8192 Term_putch(68, row + i, a, c);
8195 if (use_bigtile) Term_putch(68 + 1, row + i, a2, c2);
8198 /* Clear remaining lines */
8199 for (; i < per_page; i++)
8201 Term_erase(col, row + i, 255);
8207 * Interact with feature visuals.
8209 static void do_cmd_knowledge_features(void)
8212 int grp_cur, grp_top, old_grp_cur;
8213 int feat_cur, feat_top;
8214 int grp_cnt, grp_idx[100];
8222 bool visual_list = FALSE;
8223 byte attr_top = 0, char_left = 0;
8229 Term_get_size(&wid, &hgt);
8231 browser_rows = hgt - 8;
8233 /* Allocate the "feat_idx" array */
8234 C_MAKE(feat_idx, max_f_idx, int);
8239 /* Check every group */
8240 for (i = 0; feature_group_text[i] != NULL; i++)
8242 /* Measure the label */
8243 len = strlen(feature_group_text[i]);
8245 /* Save the maximum length */
8246 if (len > max) max = len;
8248 /* See if any features are known */
8249 if (collect_features(i, feat_idx))
8251 /* Build a list of groups with known features */
8252 grp_idx[grp_cnt++] = i;
8256 /* Terminate the list */
8257 grp_idx[grp_cnt] = -1;
8260 grp_cur = grp_top = 0;
8261 feat_cur = feat_top = 0;
8267 while ((!flag) && (grp_cnt))
8270 feature_type *f_ptr;
8276 prt("Visuals - features", 2, 0);
8278 prt("Name", 4, max + 3);
8281 for (i = 0; i < 78; i++)
8283 Term_putch(i, 5, TERM_WHITE, '=');
8286 for (i = 0; i < browser_rows; i++)
8288 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8294 /* Scroll group list */
8295 if (grp_cur < grp_top) grp_top = grp_cur;
8296 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8298 /* Display a list of feature groups */
8299 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8301 if (old_grp_cur != grp_cur)
8303 old_grp_cur = grp_cur;
8305 /* Get a list of features in the current group */
8306 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx);
8309 /* Scroll feature list */
8310 while (feat_cur < feat_top)
8311 feat_top = MAX(0, feat_top - browser_rows/2);
8312 while (feat_cur >= feat_top + browser_rows)
8313 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8317 /* Display a list of features in the current group */
8318 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top);
8322 feat_top = feat_cur;
8324 /* Display a list of features in the current group */
8325 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top);
8327 /* Display visual list below first object */
8328 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8333 prt(format("<Êý¸þ>%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8335 prt(format("<dir>%s%s, ESC", visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
8338 /* Get the current feature */
8339 f_ptr = &f_info[feat_idx[feat_cur]];
8343 place_visual_list_cursor(max + 3, 7, f_ptr->x_attr, f_ptr->x_char, attr_top, char_left);
8347 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8351 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8356 /* Do visual mode command if needed */
8357 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &f_ptr->x_attr, &f_ptr->x_char)) continue;
8369 /* Move the cursor */
8370 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8377 if (!grp_cnt) msg_print("No features known.");
8379 /* Free the "feat_idx" array */
8380 C_KILL(feat_idx, max_f_idx, int);
8385 * List wanted monsters
8387 static void do_cmd_knowledge_kubi(void)
8392 char file_name[1024];
8395 /* Open a new file */
8396 fff = my_fopen_temp(file_name, 1024);
8399 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8401 msg_format("Failed to create temporary file %s.", file_name);
8410 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8412 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8414 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8416 fprintf(fff, "List of wanted monsters\n");
8418 for (i = 0; i < MAX_KUBI; i++)
8420 fprintf(fff,"%-40s ---- ",r_name + r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])].name);
8421 if (kubi_r_idx[i] > 10000)
8423 fprintf(fff, "ºÑ\n");
8425 fprintf(fff, "done\n");
8428 fprintf(fff, "$%d\n", 300 * (r_info[kubi_r_idx[i]].level + 1));
8432 /* Close the file */
8435 /* Display the file contents */
8437 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8439 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8443 /* Remove the file */
8448 * List virtues & status
8450 static void do_cmd_knowledge_virtues(void)
8454 char file_name[1024];
8457 /* Open a new file */
8458 fff = my_fopen_temp(file_name, 1024);
8461 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8463 msg_format("Failed to create temporary file %s.", file_name);
8472 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8474 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8479 /* Close the file */
8482 /* Display the file contents */
8484 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8486 show_file(TRUE, file_name, "Virtues", 0, 0);
8490 /* Remove the file */
8498 static void do_cmd_knowledge_dungeon(void)
8502 char file_name[1024];
8506 /* Open a new file */
8507 fff = my_fopen_temp(file_name, 1024);
8510 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8512 msg_format("Failed to create temporary file %s.", file_name);
8520 for (i = 1; i < max_d_idx; i++)
8524 if (!d_info[i].maxdepth) continue;
8525 if (!max_dlv[i]) continue;
8526 if (d_info[i].final_guardian)
8528 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8530 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8532 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8534 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8539 /* Close the file */
8542 /* Display the file contents */
8544 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
8546 show_file(TRUE, file_name, "Dungeon", 0, 0);
8550 /* Remove the file */
8555 * List virtues & status
8558 static void do_cmd_knowledge_stat(void)
8562 char file_name[1024];
8565 /* Open a new file */
8566 fff = my_fopen_temp(file_name, 1024);
8569 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8571 msg_format("Failed to create temporary file %s.", file_name);
8579 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
8580 (2 * p_ptr->hitdie +
8581 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
8584 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
8585 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
8586 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
8588 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
8589 else fprintf(fff, "Your current Life Rating is ???.\n\n");
8590 fprintf(fff, "Limits of maximum stats\n\n");
8592 for (v_nr = 0; v_nr < 6; v_nr++)
8594 if ((p_ptr->knowledge & KNOW_STAT) || p_ptr->stat_max[v_nr] == p_ptr->stat_max_max[v_nr]) fprintf(fff, "%s 18/%d\n", stat_names[v_nr], p_ptr->stat_max_max[v_nr]-18);
8595 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
8601 /* Close the file */
8604 /* Display the file contents */
8606 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
8608 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
8612 /* Remove the file */
8618 * Print all active quests
8620 static void do_cmd_knowledge_quests_current(FILE *fff)
8623 char rand_tmp_str[120] = "\0";
8625 monster_race *r_ptr;
8627 int rand_level = 100;
8631 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
8633 fprintf(fff, "< Current Quest >\n");
8636 for (i = 1; i < max_quests; i++)
8638 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
8640 /* Set the quest number temporary */
8641 int old_quest = p_ptr->inside_quest;
8644 /* Clear the text */
8645 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
8646 quest_text_line = 0;
8648 p_ptr->inside_quest = i;
8650 /* Get the quest text */
8651 init_flags = INIT_SHOW_TEXT;
8653 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8655 /* Reset the old quest number */
8656 p_ptr->inside_quest = old_quest;
8658 /* No info from "silent" quests */
8659 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8663 if (quest[i].type != QUEST_TYPE_RANDOM)
8665 char note[80] = "\0";
8667 if (quest[i].status == QUEST_STATUS_TAKEN)
8669 switch (quest[i].type)
8671 case QUEST_TYPE_KILL_LEVEL:
8672 case QUEST_TYPE_KILL_ANY_LEVEL:
8673 r_ptr = &r_info[quest[i].r_idx];
8674 strcpy(name, r_name + r_ptr->name);
8675 if (quest[i].max_num > 1)
8678 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
8679 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
8682 sprintf(note," - kill %d %s, have killed %d.",
8683 quest[i].max_num, name, quest[i].cur_num);
8688 sprintf(note," - %s¤òÅݤ¹¡£",name);
8690 sprintf(note," - kill %s.",name);
8694 case QUEST_TYPE_FIND_ARTIFACT:
8695 strcpy(name, a_name + a_info[quest[i].k_idx].name);
8697 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
8699 sprintf(note," - Find out %s.", name);
8703 case QUEST_TYPE_FIND_EXIT:
8705 sprintf(note," - õº÷¤¹¤ë¡£");
8707 sprintf(note," - Search.");
8711 case QUEST_TYPE_KILL_NUMBER:
8713 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
8714 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
8716 sprintf(note," - Kill %d monsters, have killed %d.",
8717 quest[i].max_num, quest[i].cur_num);
8721 case QUEST_TYPE_KILL_ALL:
8723 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
8725 sprintf(note," - Kill all monsters.");
8731 /* Print the quest info */
8733 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
8734 quest[i].name, quest[i].level, note);
8736 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
8737 quest[i].name, quest[i].level, note);
8740 fprintf(fff, tmp_str);
8742 if (quest[i].status == QUEST_STATUS_COMPLETED)
8745 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
8747 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
8749 fprintf(fff, tmp_str);
8755 while (quest_text[j][0] && j < 10)
8757 fprintf(fff, " %s\n", quest_text[j]);
8762 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
8765 rand_level = quest[i].level;
8767 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8769 /* Print the quest info */
8770 r_ptr = &r_info[quest[i].r_idx];
8771 strcpy(name, r_name + r_ptr->name);
8773 if (quest[i].max_num > 1)
8776 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
8777 quest[i].name, quest[i].level,
8778 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
8782 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8783 quest[i].name, quest[i].level,
8784 quest[i].max_num, name, quest[i].cur_num);
8790 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
8791 quest[i].name, quest[i].level, name);
8793 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
8794 quest[i].name, quest[i].level, name);
8802 /* Print the current random quest */
8803 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
8806 if (!total) fprintf(fff, " ¤Ê¤·\n");
8808 if (!total) fprintf(fff, " Nothing.\n");
8814 * Print all finished quests
8816 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
8823 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8825 fprintf(fff, "< Completed Quest >\n");
8827 for (i = 1; i < max_quests; i++)
8829 int q_idx = quest_num[i];
8831 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
8833 if (is_fixed_quest_idx(q_idx))
8835 /* Set the quest number temporary */
8836 int old_quest = p_ptr->inside_quest;
8838 p_ptr->inside_quest = q_idx;
8841 init_flags = INIT_ASSIGN;
8843 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8845 /* Reset the old quest number */
8846 p_ptr->inside_quest = old_quest;
8848 /* No info from "silent" quests */
8849 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
8854 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
8856 /* Print the quest info */
8858 if (quest[q_idx].complev == 0)
8862 " %s (%d³¬) - ÉÔÀᄀ\n",
8864 " %s (Dungeon level: %d) - (Cancelled)\n",
8866 r_name+r_info[quest[q_idx].r_idx].name,
8867 quest[q_idx].level);
8873 " %s (%d³¬) - ¥ì¥Ù¥ë%d\n",
8875 " %s (Dungeon level: %d) - level %d\n",
8877 r_name+r_info[quest[q_idx].r_idx].name,
8879 quest[q_idx].complev);
8884 /* Print the quest info */
8886 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö) - ¥ì¥Ù¥ë%d\n",
8887 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8889 sprintf(tmp_str, " %s (Danger level: %d) - level %d\n",
8890 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8894 fprintf(fff, tmp_str);
8898 if (!total) fprintf(fff, " ¤Ê¤·\n");
8900 if (!total) fprintf(fff, " Nothing.\n");
8906 * Print all failed quests
8908 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
8915 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8917 fprintf(fff, "< Failed Quest >\n");
8919 for (i = 1; i < max_quests; i++)
8921 int q_idx = quest_num[i];
8923 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
8925 if (is_fixed_quest_idx(q_idx))
8927 /* Set the quest number temporary */
8928 int old_quest = p_ptr->inside_quest;
8930 p_ptr->inside_quest = q_idx;
8932 /* Get the quest text */
8933 init_flags = INIT_ASSIGN;
8935 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8937 /* Reset the old quest number */
8938 p_ptr->inside_quest = old_quest;
8940 /* No info from "silent" quests */
8941 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
8946 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
8948 /* Print the quest info */
8950 sprintf(tmp_str, " %s (%d³¬) - ¥ì¥Ù¥ë%d\n",
8951 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
8953 sprintf(tmp_str, " %s (Dungeon level: %d) - level %d\n",
8954 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
8959 /* Print the quest info */
8961 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö) - ¥ì¥Ù¥ë%d\n",
8962 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8964 sprintf(tmp_str, " %s (Danger level: %d) - level %d\n",
8965 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8968 fprintf(fff, tmp_str);
8972 if (!total) fprintf(fff, " ¤Ê¤·\n");
8974 if (!total) fprintf(fff, " Nothing.\n");
8980 * Print all random quests
8982 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
8989 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
8991 fprintf(fff, "< Remaining Random Quest >\n");
8993 for (i = 1; i < max_quests; i++)
8995 /* No info from "silent" quests */
8996 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8998 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9002 /* Print the quest info */
9004 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9005 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9007 sprintf(tmp_str, " %s (%d, %s)\n",
9008 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9010 fprintf(fff, tmp_str);
9014 if (!total) fprintf(fff, " ¤Ê¤·\n");
9016 if (!total) fprintf(fff, " Nothing.\n");
9021 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9023 int *q_num = (int *)u;
9024 quest_type *qa = &quest[q_num[a]];
9025 quest_type *qb = &quest[q_num[b]];
9030 if (qa->complev < qb->complev) return TRUE;
9031 if (qa->complev > qb->complev) return FALSE;
9032 if (qa->level <= qb->level) return TRUE;
9036 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9038 int *q_num = (int *)u;
9045 q_num[a] = q_num[b];
9051 * Print quest status of all active quests
9053 static void do_cmd_knowledge_quests(void)
9056 char file_name[1024];
9057 int *quest_num, dummy, i;
9059 /* Open a new file */
9060 fff = my_fopen_temp(file_name, 1024);
9064 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9066 msg_format("Failed to create temporary file %s.", file_name);
9072 /* Allocate Memory */
9073 C_MAKE(quest_num, max_quests, int);
9075 /* Sort by compete level */
9076 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9077 ang_sort_comp = ang_sort_comp_quest_num;
9078 ang_sort_swap = ang_sort_swap_quest_num;
9079 ang_sort(quest_num, &dummy, max_quests);
9081 /* Dump Quest Information */
9082 do_cmd_knowledge_quests_current(fff);
9084 do_cmd_knowledge_quests_completed(fff, quest_num);
9086 do_cmd_knowledge_quests_failed(fff, quest_num);
9090 do_cmd_knowledge_quests_wiz_random(fff);
9093 /* Close the file */
9096 /* Display the file contents */
9098 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9100 show_file(TRUE, file_name, "Quest status", 0, 0);
9103 /* Remove the file */
9107 C_KILL(quest_num, max_quests, int);
9114 static void do_cmd_knowledge_home(void)
9119 char file_name[1024];
9121 char o_name[MAX_NLEN];
9124 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9126 /* Open a new file */
9127 fff = my_fopen_temp(file_name, 1024);
9130 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9132 msg_format("Failed to create temporary file %s.", file_name);
9140 /* Print all homes in the different towns */
9141 st_ptr = &town[1].store[STORE_HOME];
9143 /* Home -- if anything there */
9144 if (st_ptr->stock_num)
9149 /* Header with name of the town */
9151 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9153 fprintf(fff, " [Home Inventory]\n");
9156 /* Dump all available items */
9157 for (i = 0; i < st_ptr->stock_num; i++)
9160 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9161 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9162 if (strlen(o_name) <= 80-3)
9164 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9170 for (n = 0, t = o_name; n < 80-3; n++, t++)
9171 if(iskanji(*t)) {t++; n++;}
9172 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9174 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9175 fprintf(fff, " %.77s\n", o_name+n);
9178 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9179 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9184 /* Add an empty line */
9185 fprintf(fff, "\n\n");
9189 /* Close the file */
9192 /* Display the file contents */
9194 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9196 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9200 /* Remove the file */
9206 * Check the status of "autopick"
9208 static void do_cmd_knowledge_autopick(void)
9212 char file_name[1024];
9214 /* Open a new file */
9215 fff = my_fopen_temp(file_name, 1024);
9220 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9222 msg_format("Failed to create temporary file %s.", file_name);
9231 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9233 fprintf(fff, "No preference for auto picker/destroyer.");
9239 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9241 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9245 for (k = 0; k < max_autopick; k++)
9248 byte act = autopick_list[k].action;
9249 if (act & DONT_AUTOPICK)
9257 else if (act & DO_AUTODESTROY)
9265 else if (act & DO_AUTOPICK)
9273 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9282 if (act & DO_DISPLAY)
9283 fprintf(fff, "%11s", format("[%s]", tmp));
9285 fprintf(fff, "%11s", format("(%s)", tmp));
9287 tmp = autopick_line_from_entry(&autopick_list[k]);
9288 fprintf(fff, " %s", tmp);
9292 /* Close the file */
9294 /* Display the file contents */
9296 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9298 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9301 /* Remove the file */
9307 * Interact with "knowledge"
9309 void do_cmd_knowledge(void)
9312 /* File type is "TEXT" */
9313 FILE_TYPE(FILE_TYPE_TEXT);
9314 /* Save the screen */
9316 /* Interact until done */
9321 /* Ask for a choice */
9323 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9324 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9326 prt(format("page %d/2", (p+1)), 2, 65);
9327 prt("Display current knowledge", 3, 0);
9330 /* Give some choices */
9333 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9334 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9335 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9336 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9337 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9338 prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9339 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9340 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9341 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9342 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9344 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9345 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9346 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9347 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9348 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9349 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9350 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9351 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9352 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9356 prt("(1) Display known artifacts", 6, 5);
9357 prt("(2) Display known objects", 7, 5);
9358 prt("(3) Display remaining uniques", 8, 5);
9359 prt("(4) Display known monster", 9, 5);
9360 prt("(5) Display kill count", 10, 5);
9361 prt("(6) Display wanted monsters", 11, 5);
9362 prt("(7) Display current pets", 12, 5);
9363 prt("(8) Display home inventory", 13, 5);
9364 prt("(9) Display *identified* equip.", 14, 5);
9365 prt("(0) Display terrain symbols.", 15, 5);
9367 prt("(a) Display about yourself", 6, 5);
9368 prt("(b) Display mutations", 7, 5);
9369 prt("(c) Display weapon proficiency", 8, 5);
9370 prt("(d) Display spell proficiency", 9, 5);
9371 prt("(e) Display misc. proficiency", 10, 5);
9372 prt("(f) Display virtues", 11, 5);
9373 prt("(g) Display dungeons", 12, 5);
9374 prt("(h) Display current quests", 13, 5);
9375 prt("(i) Display auto pick/destroy", 14, 5);
9380 prt("-³¤¯-", 17, 8);
9381 prt("ESC) È´¤±¤ë", 21, 1);
9382 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9383 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9384 prt("¥³¥Þ¥ó¥É:", 20, 0);
9386 prt("-more-", 17, 8);
9387 prt("ESC) Exit menu", 21, 1);
9388 prt("SPACE) Next page", 21, 30);
9389 /*prt("-) Previous page", 21, 60);*/
9390 prt("Command: ", 20, 0);
9396 if (i == ESCAPE) break;
9399 case ' ': /* Page change */
9403 case '1': /* Artifacts */
9404 do_cmd_knowledge_artifacts();
9406 case '2': /* Objects */
9407 do_cmd_knowledge_objects();
9409 case '3': /* Uniques */
9410 do_cmd_knowledge_uniques();
9412 case '4': /* Monsters */
9413 do_cmd_knowledge_monsters();
9415 case '5': /* Kill count */
9416 do_cmd_knowledge_kill_count();
9418 case '6': /* wanted */
9419 do_cmd_knowledge_kubi();
9421 case '7': /* Pets */
9422 do_cmd_knowledge_pets();
9424 case '8': /* Home */
9425 do_cmd_knowledge_home();
9427 case '9': /* Resist list */
9428 do_cmd_knowledge_inven();
9430 case '0': /* Feature list */
9431 do_cmd_knowledge_features();
9434 case 'a': /* Max stat */
9435 do_cmd_knowledge_stat();
9437 case 'b': /* Mutations */
9438 do_cmd_knowledge_mutations();
9440 case 'c': /* weapon-exp */
9441 do_cmd_knowledge_weapon_exp();
9443 case 'd': /* spell-exp */
9444 do_cmd_knowledge_spell_exp();
9446 case 'e': /* skill-exp */
9447 do_cmd_knowledge_skill_exp();
9449 case 'f': /* Virtues */
9450 do_cmd_knowledge_virtues();
9452 case 'g': /* Dungeon */
9453 do_cmd_knowledge_dungeon();
9455 case 'h': /* Quests */
9456 do_cmd_knowledge_quests();
9458 case 'i': /* Autopick */
9459 do_cmd_knowledge_autopick();
9461 default: /* Unknown option */
9464 /* Flush messages */
9467 /* Restore the screen */
9473 * Check on the status of an active quest
9475 void do_cmd_checkquest(void)
9477 /* File type is "TEXT" */
9478 FILE_TYPE(FILE_TYPE_TEXT);
9480 /* Save the screen */
9484 do_cmd_knowledge_quests();
9486 /* Restore the screen */
9492 * Display the time and date
9494 void do_cmd_time(void)
9496 int day, hour, min, full, start, end, num;
9503 extract_day_hour_min(&day, &hour, &min);
9505 full = hour * 100 + min;
9513 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9515 strcpy(desc, "It is a strange time.");
9521 msg_format("%d ÆüÌÜ,»þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
9522 day, (hour % 12 == 0) ? 12 : (hour % 12),
9523 min, (hour < 12) ? "AM" : "PM");
9525 msg_format("This is day %d. The time is %d:%02d %s.",
9526 day, (hour % 12 == 0) ? 12 : (hour % 12),
9527 min, (hour < 12) ? "AM" : "PM");
9532 if (!randint0(10) || p_ptr->image)
9535 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
9537 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
9544 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
9546 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
9551 /* Open this file */
9552 fff = my_fopen(buf, "rt");
9557 /* Find this time */
9558 while (!my_fgets(fff, buf, sizeof(buf)))
9560 /* Ignore comments */
9561 if (!buf[0] || (buf[0] == '#')) continue;
9563 /* Ignore invalid lines */
9564 if (buf[1] != ':') continue;
9566 /* Process 'Start' */
9569 /* Extract the starting time */
9570 start = atoi(buf + 2);
9572 /* Assume valid for an hour */
9582 /* Extract the ending time */
9583 end = atoi(buf + 2);
9589 /* Ignore incorrect range */
9590 if ((start > full) || (full > end)) continue;
9592 /* Process 'Description' */
9597 /* Apply the randomizer */
9598 if (!randint0(num)) strcpy(desc, buf + 2);
9608 /* Close the file */