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);
337 * Return suffix of ordinal number
339 cptr get_ordinal_number_suffix(int num)
341 num = ABS(num) % 100;
345 return (num == 11) ? "th" : "st";
347 return (num == 12) ? "th" : "nd";
349 return (num == 13) ? "th" : "rd";
358 * Take note to the diary.
360 errr do_cmd_write_nikki(int type, int num, cptr note)
366 cptr note_level = "";
367 bool do_level = TRUE;
368 char note_level_buf[40];
371 static bool disable_nikki = FALSE;
373 extract_day_hour_min(&day, &hour, &min);
375 if (disable_nikki) return(-1);
377 if (type == NIKKI_FIX_QUEST_C ||
378 type == NIKKI_FIX_QUEST_F ||
379 type == NIKKI_RAND_QUEST_C ||
380 type == NIKKI_RAND_QUEST_F ||
381 type == NIKKI_TO_QUEST)
385 old_quest = p_ptr->inside_quest;
386 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
388 /* Get the quest text */
389 init_flags = INIT_ASSIGN;
391 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
393 /* Reset the old quest number */
394 p_ptr->inside_quest = old_quest;
398 sprintf(file_name,"playrecord-%s.txt",savefile_base);
400 /* different filne name to avoid mixing */
401 sprintf(file_name,"playrec-%s.txt",savefile_base);
404 /* Build the filename */
405 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
407 /* File type is "TEXT" */
408 FILE_TYPE(FILE_TYPE_TEXT);
410 fff = my_fopen(buf, "a");
416 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
418 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
425 q_idx = quest_number(dun_level);
429 if (p_ptr->inside_arena)
431 note_level = "¥¢¥ê¡¼¥Ê:";
433 note_level = "Arane:";
437 note_level = "ÃϾå:";
439 note_level = "Surface:";
441 else if (q_idx && (is_fixed_quest_idx(q_idx)
442 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
444 note_level = "¥¯¥¨¥¹¥È:";
446 note_level = "Quest:";
451 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
453 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
455 note_level = note_level_buf;
464 fprintf(fff, "%dÆüÌÜ\n",day);
466 fprintf(fff, "Day %d\n",day);
475 fprintf(fff, "%s\n",note);
479 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
485 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
487 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
494 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
496 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
500 case NIKKI_FIX_QUEST_C:
502 if (quest[num].flags & QUEST_FLAG_SILENT) break;
504 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
506 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
510 case NIKKI_FIX_QUEST_F:
512 if (quest[num].flags & QUEST_FLAG_SILENT) break;
514 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
516 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
520 case NIKKI_RAND_QUEST_C:
523 strcpy(name, r_name+r_info[quest[num].r_idx].name);
525 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
527 fprintf(fff, " %2d:%02d %20s completed randome quest '%s'\n", hour, min, note_level, name);
531 case NIKKI_RAND_QUEST_F:
534 strcpy(name, r_name+r_info[quest[num].r_idx].name);
536 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
538 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
542 case NIKKI_MAXDEAPTH:
545 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
547 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);
554 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
556 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);
563 if (q_idx && (is_fixed_quest_idx(q_idx)
564 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
575 if (!(dun_level+num)) to = "ÃϾå";
576 else to = format("%d³¬", dun_level+num);
578 if (!(dun_level+num)) to = "the surface";
579 else to = format("level %d", dun_level+num);
584 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
586 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
594 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
596 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);
600 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
602 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
608 if (quest[num].flags & QUEST_FLAG_SILENT) break;
610 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
612 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
619 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
621 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
628 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
630 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
637 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
639 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
648 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, -num, note);
651 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, get_ordinal_number_suffix(n));
656 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
658 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, get_ordinal_number_suffix(num), note);
660 if (num == MAX_ARENA_MONS)
663 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
665 fprintf(fff, " won all fight to become a Chanpion.\n");
674 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
676 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
691 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
693 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
697 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
699 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
714 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
716 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
720 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
722 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
729 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
731 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
735 case NIKKI_GAMESTART:
737 time_t ct = time((time_t*)0);
741 fprintf(fff, "%s %s",note, ctime(&ct));
744 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
747 case NIKKI_NAMED_PET:
749 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
754 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
756 fprintf(fff, "decided to travel together with %s.\n", note);
761 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
763 fprintf(fff, "unnamed %s.\n", note);
768 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
770 fprintf(fff, "dismissed %s.\n", note);
775 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
777 fprintf(fff, "%s died.\n", note);
782 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
784 fprintf(fff, "moved to another map leaving %s behind.\n", note);
789 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
791 fprintf(fff, "lost sight of %s.\n", note);
796 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
798 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
803 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
805 fprintf(fff, "%s was crushed by falling rocks.\n", note);
820 if (do_level) write_level = FALSE;
826 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
828 static void do_cmd_disp_nikki(void)
830 char nikki_title[256];
835 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
836 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
847 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
848 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
849 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
850 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
855 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
864 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
866 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
867 "Attack is the best form of defence.",
869 "An unexpected windfall",
870 "A drowning man will catch at a straw",
871 "Don't count your chickens before they are hatched.",
872 "It is no use crying over spilt milk.",
873 "Seeing is believing.",
874 "Strike the iron while it is hot.",
875 "I don't care what follows.",
876 "To dig a well to put out a house on fire.",
877 "Tomorrow is another day.",
878 "Easy come, easy go.",
879 "The more haste, the less speed.",
880 "Where there is life, there is hope.",
881 "There is no royal road to *WINNER*.",
882 "Danger past, God forgotten.",
883 "The best thing to do now is to run away.",
884 "Life is but an empty dream.",
885 "Dead men tell no tales.",
886 "A book that remains shut is but a block.",
887 "Misfortunes never come singly.",
888 "A little knowledge is a dangerous thing.",
889 "History repeats itself.",
890 "*WINNER* was not built in a day.",
891 "Ignorance is bliss.",
892 "To lose is to win?",
893 "No medicine can cure folly.",
894 "All good things come to an end.",
895 "M$ Empire strikes back.",
896 "To see is to believe",
898 "Quest of The World's Greatest Brain"};
901 sprintf(file_name,"playrecord-%s.txt",savefile_base);
903 sprintf(file_name,"playrec-%s.txt",savefile_base);
906 /* Build the filename */
907 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
909 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
910 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
911 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
912 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
913 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
916 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
917 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
919 sprintf(nikki_title, "Legend of %s %s '%s'",
920 ap_ptr->title, player_name, tmp);
923 /* Display the file contents */
924 show_file(FALSE, buf, nikki_title, -1, 0);
927 static void do_cmd_bunshou(void)
930 char bunshou[80] = "\0";
933 if (get_string("ÆâÍÆ: ", tmp, 79))
935 if (get_string("diary note: ", tmp, 79))
938 strcpy(bunshou, tmp);
940 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
944 static void do_cmd_last_get(void)
949 if (record_o_name[0] == '\0') return;
952 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
954 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
956 if (!get_check(buf)) return;
961 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
963 sprintf(buf,"descover %s.", record_o_name);
965 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
969 static void do_cmd_erase_nikki(void)
976 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
978 if (!get_check("Do you really want to delete all your record? ")) return;
982 sprintf(file_name,"playrecord-%s.txt",savefile_base);
984 sprintf(file_name,"playrec-%s.txt",savefile_base);
987 /* Build the filename */
988 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
990 /* Remove the file */
993 fff = my_fopen(buf, "w");
997 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
999 msg_format("deleted record.");
1003 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1005 msg_format("failed to delete %s.", buf);
1012 void do_cmd_nikki(void)
1016 /* File type is "TEXT" */
1017 FILE_TYPE(FILE_TYPE_TEXT);
1019 /* Save the screen */
1022 /* Interact until done */
1028 /* Ask for a choice */
1030 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1032 prt("[ Play Record ]", 2, 0);
1036 /* Give some choices */
1038 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1039 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1040 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1041 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1043 prt("(1) Display your record", 4, 5);
1044 prt("(2) Add record", 5, 5);
1045 prt("(3) Record item you last get/identify", 6, 5);
1046 prt("(4) Delete your record", 7, 5);
1052 prt("¥³¥Þ¥ó¥É:", 18, 0);
1054 prt("Command: ", 18, 0);
1062 if (i == ESCAPE) break;
1067 do_cmd_disp_nikki();
1076 do_cmd_erase_nikki();
1078 default: /* Unknown option */
1082 /* Flush messages */
1086 /* Restore the screen */
1091 * Hack -- redraw the screen
1093 * This command performs various low level updates, clears all the "extra"
1094 * windows, does a total redraw of the main window, and requests all of the
1095 * interesting updates and redraws that I can think of.
1097 * This command is also used to "instantiate" the results of the user
1098 * selecting various things, such as graphics mode, so it must call
1099 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1101 void do_cmd_redraw(void)
1108 /* Hack -- react to changes */
1109 Term_xtra(TERM_XTRA_REACT, 0);
1112 /* Combine and Reorder the pack (later) */
1113 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1117 p_ptr->update |= (PU_TORCH);
1120 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1122 /* Forget lite/view */
1123 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1125 /* Update lite/view */
1126 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1128 /* Update monsters */
1129 p_ptr->update |= (PU_MONSTERS);
1131 /* Redraw everything */
1132 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1135 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1138 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1142 /* Hack -- update */
1145 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1148 /* Redraw every window */
1149 for (j = 0; j < 8; j++)
1152 if (!angband_term[j]) continue;
1155 Term_activate(angband_term[j]);
1170 * Hack -- change name
1172 void do_cmd_change_name(void)
1181 /* Save the screen */
1189 /* Display the player */
1190 display_player(mode);
1195 display_player(mode);
1200 Term_putstr(2, 23, -1, TERM_WHITE,
1201 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1203 Term_putstr(2, 23, -1, TERM_WHITE,
1204 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1212 if (c == ESCAPE) break;
1219 /* Process the player name */
1220 process_player_name(FALSE);
1226 sprintf(tmp, "%s.txt", player_base);
1228 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1230 if (get_string("File name: ", tmp, 80))
1234 if (tmp[0] && (tmp[0] != ' '))
1236 file_character(tmp);
1253 /* Flush messages */
1257 /* Restore the screen */
1260 /* Redraw everything */
1261 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1268 * Recall the most recent message
1270 void do_cmd_message_one(void)
1272 /* Recall one message XXX XXX XXX */
1273 prt(format("> %s", message_str(0)), 0, 0);
1278 * Show previous messages to the user -BEN-
1280 * The screen format uses line 0 and 23 for headers and prompts,
1281 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1283 * This command shows you which commands you are viewing, and allows
1284 * you to "search" for strings in the recall.
1286 * Note that messages may be longer than 80 characters, but they are
1287 * displayed using "infinite" length, with a special sub-command to
1288 * "slide" the virtual display to the left or right.
1290 * Attempt to only hilite the matching portions of the string.
1292 void do_cmd_messages(int num_now)
1302 Term_get_size(&wid, &hgt);
1304 /* Number of message lines in a screen */
1305 num_lines = hgt - 4;
1314 /* Total messages */
1317 /* Start on first message */
1320 /* Save the screen */
1326 /* Process requests until done */
1332 /* Dump up to 20 lines of messages */
1333 for (j = 0; (j < num_lines) && (i + j < n); j++)
1335 cptr msg = message_str(i+j);
1337 /* Dump the messages, bottom to top */
1338 c_prt((i+j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1340 /* Hilite "shower" */
1345 /* Display matches */
1346 while ((str = my_strstr(str, shower)) != NULL)
1348 int len = strlen(shower);
1350 /* Display the match */
1351 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1359 /* Erase remaining lines */
1360 for (; j < num_lines; j++)
1362 Term_erase(0, num_lines + 1 - j, 255);
1365 /* Display header XXX XXX XXX */
1368 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1369 i, i+j-1, n), 0, 0);
1371 prt(format("Message Recall (%d-%d of %d)",
1372 i, i+j-1, n), 0, 0);
1376 /* Display prompt (not very informative) */
1378 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1380 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1385 skey = inkey_special(TRUE);
1387 /* Exit on Escape */
1388 if (skey == ESCAPE) break;
1390 /* Hack -- Save the old index */
1393 /* Hack -- handle show */
1398 prt("¶¯Ä´: ", hgt - 1, 0);
1400 prt("Show: ", hgt - 1, 0);
1404 /* Get a "shower" string, or continue */
1405 if (!askfor(shower, 80)) continue;
1411 /* Hack -- handle find */
1412 if (skey == '/' || skey == KTRL('s'))
1418 prt("¸¡º÷: ", hgt - 1, 0);
1420 prt("Find: ", hgt - 1, 0);
1424 /* Get a "finder" string, or continue */
1425 if (!askfor(finder, 80)) continue;
1428 strcpy(shower, finder);
1431 for (z = i + 1; z < n; z++)
1433 cptr msg = message_str(z);
1436 if (my_strstr(msg, finder))
1447 /* Recall 1 older message */
1448 if (skey == SKEY_TOP)
1450 /* Go to the oldest line */
1454 /* Recall 1 newer message */
1455 if (skey == SKEY_BOTTOM)
1457 /* Go to the newest line */
1461 /* Recall 1 older message */
1462 if (skey == '8' || skey == SKEY_UP || skey == '\n' || skey == '\r')
1464 /* Go older if legal */
1465 i = MIN(i + 1, n - num_lines);
1468 /* Recall 10 older messages */
1471 /* Go older if legal */
1472 i = MIN(i + 10, n - num_lines);
1475 /* Recall 20 older messages */
1476 if (skey == 'p' || skey == KTRL('P') || skey == ' ' || skey == SKEY_PGUP)
1478 /* Go older if legal */
1479 i = MIN(i + num_lines, n - num_lines);
1482 /* Recall 20 newer messages */
1483 if (skey == 'n' || skey == KTRL('N') || skey == SKEY_PGDOWN)
1485 /* Go newer (if able) */
1486 i = MAX(0, i - num_lines);
1489 /* Recall 10 newer messages */
1492 /* Go newer (if able) */
1496 /* Recall 1 newer messages */
1497 if (skey == '2' || skey == SKEY_DOWN)
1499 /* Go newer (if able) */
1503 /* Hack -- Error of some kind */
1507 /* Restore the screen */
1514 * Number of cheating options
1521 static option_type cheat_info[CHEAT_MAX] =
1523 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1525 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1527 "cheat_peek", "Peek into object creation"
1531 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1533 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1535 "cheat_hear", "Peek into monster creation"
1539 { &cheat_room, FALSE, 255, 0x04, 0x00,
1541 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1543 "cheat_room", "Peek into dungeon creation"
1547 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1549 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1551 "cheat_xtra", "Peek into something else"
1555 { &cheat_know, FALSE, 255, 0x10, 0x00,
1557 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1559 "cheat_know", "Know complete monster info"
1563 { &cheat_live, FALSE, 255, 0x20, 0x00,
1565 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1567 "cheat_live", "Allow player to avoid death"
1571 { &cheat_save, FALSE, 255, 0x40, 0x00,
1573 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1575 "cheat_save", "Ask for saving death"
1581 * Interact with some options for cheating
1583 static void do_cmd_options_cheat(cptr info)
1587 int i, k = 0, n = CHEAT_MAX;
1595 /* Interact with the player */
1600 /* Prompt XXX XXX XXX */
1602 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1604 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1610 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1611 prt(" << Ãí°Õ >>", 11, 0);
1612 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1613 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1614 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1616 /* Display the options */
1617 for (i = 0; i < n; i++)
1619 byte a = TERM_WHITE;
1621 /* Color current option */
1622 if (i == k) a = TERM_L_BLUE;
1624 /* Display the option text */
1625 sprintf(buf, "%-48s: %s (%s)",
1626 cheat_info[i].o_desc,
1628 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1630 (*cheat_info[i].o_var ? "yes" : "no "),
1633 cheat_info[i].o_text);
1634 c_prt(a, buf, i + 2, 0);
1637 /* Hilite current option */
1638 move_cursor(k + 2, 50);
1644 * HACK - Try to translate the key into a direction
1645 * to allow using the roguelike keys for navigation.
1647 dir = get_keymap_dir(ch);
1648 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1662 k = (n + k - 1) % n;
1681 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1683 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1685 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1686 (*cheat_info[k].o_var) = TRUE;
1695 (*cheat_info[k].o_var) = FALSE;
1703 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1705 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1707 /* Peruse the help file */
1708 (void)show_file(TRUE, buf, NULL, 0, 0);
1724 static option_type autosave_info[2] =
1726 { &autosave_l, FALSE, 255, 0x01, 0x00,
1728 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1730 "autosave_l", "Autosave when entering new levels" },
1734 { &autosave_t, FALSE, 255, 0x02, 0x00,
1736 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1738 "autosave_t", "Timed autosave" },
1744 static s16b toggle_frequency(s16b current)
1749 case 50: return 100;
1750 case 100: return 250;
1751 case 250: return 500;
1752 case 500: return 1000;
1753 case 1000: return 2500;
1754 case 2500: return 5000;
1755 case 5000: return 10000;
1756 case 10000: return 25000;
1763 * Interact with some options for cheating
1765 static void do_cmd_options_autosave(cptr info)
1769 int i, k = 0, n = 2;
1777 /* Interact with the player */
1780 /* Prompt XXX XXX XXX */
1782 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1784 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1789 /* Display the options */
1790 for (i = 0; i < n; i++)
1792 byte a = TERM_WHITE;
1794 /* Color current option */
1795 if (i == k) a = TERM_L_BLUE;
1797 /* Display the option text */
1798 sprintf(buf, "%-48s: %s (%s)",
1799 autosave_info[i].o_desc,
1801 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1803 (*autosave_info[i].o_var ? "yes" : "no "),
1806 autosave_info[i].o_text);
1807 c_prt(a, buf, i + 2, 0);
1811 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1813 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1818 /* Hilite current option */
1819 move_cursor(k + 2, 50);
1835 k = (n + k - 1) % n;
1853 (*autosave_info[k].o_var) = TRUE;
1862 (*autosave_info[k].o_var) = FALSE;
1870 autosave_freq = toggle_frequency(autosave_freq);
1872 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1873 autosave_freq), 5, 0);
1875 prt(format("Timed autosave frequency: every %d turns",
1876 autosave_freq), 5, 0);
1884 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1886 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1905 * Interact with some options
1907 void do_cmd_options_aux(int page, cptr info)
1910 int i, k = 0, n = 0, l;
1913 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1914 (!p_ptr->wizard || !allow_debug_opts);
1917 /* Lookup the options */
1918 for (i = 0; i < 24; i++) opt[i] = 0;
1920 /* Scan the options */
1921 for (i = 0; option_info[i].o_desc; i++)
1923 /* Notice options on this "page" */
1924 if (option_info[i].o_page == page) opt[n++] = i;
1931 /* Interact with the player */
1936 /* Prompt XXX XXX XXX */
1938 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
1940 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
1946 /* HACK -- description for easy-auto-destroy options */
1948 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1950 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1953 /* Display the options */
1954 for (i = 0; i < n; i++)
1956 byte a = TERM_WHITE;
1958 /* Color current option */
1959 if (i == k) a = TERM_L_BLUE;
1961 /* Display the option text */
1962 sprintf(buf, "%-48s: %s (%.19s)",
1963 option_info[opt[i]].o_desc,
1965 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1967 (*option_info[opt[i]].o_var ? "yes" : "no "),
1970 option_info[opt[i]].o_text);
1971 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1972 else c_prt(a, buf, i + 2, 0);
1975 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1978 /* Hilite current option */
1979 move_cursor(k + 2 + l, 50);
1985 * HACK - Try to translate the key into a direction
1986 * to allow using the roguelike keys for navigation.
1988 dir = get_keymap_dir(ch);
1989 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2003 k = (n + k - 1) % n;
2020 if (browse_only) break;
2021 (*option_info[opt[k]].o_var) = TRUE;
2030 if (browse_only) break;
2031 (*option_info[opt[k]].o_var) = FALSE;
2039 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2046 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2048 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2050 /* Peruse the help file */
2051 (void)show_file(TRUE, buf, NULL, 0, 0);
2068 * Modify the "window" options
2070 static void do_cmd_options_win(void)
2084 /* Memorize old flags */
2085 for (j = 0; j < 8; j++)
2087 /* Acquire current flags */
2088 old_flag[j] = window_flag[j];
2098 /* Prompt XXX XXX XXX */
2100 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2102 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2106 /* Display the windows */
2107 for (j = 0; j < 8; j++)
2109 byte a = TERM_WHITE;
2111 cptr s = angband_term_name[j];
2114 if (j == x) a = TERM_L_BLUE;
2116 /* Window name, staggered, centered */
2117 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2120 /* Display the options */
2121 for (i = 0; i < 16; i++)
2123 byte a = TERM_WHITE;
2125 cptr str = window_flag_desc[i];
2128 if (i == y) a = TERM_L_BLUE;
2132 if (!str) str = "(̤»ÈÍÑ)";
2134 if (!str) str = "(Unused option)";
2139 Term_putstr(0, i + 5, -1, a, str);
2141 /* Display the windows */
2142 for (j = 0; j < 8; j++)
2144 byte a = TERM_WHITE;
2149 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2152 if (window_flag[j] & (1L << i)) c = 'X';
2155 Term_putch(35 + j * 5, i + 5, a, c);
2160 Term_gotoxy(35 + x * 5, y + 5);
2178 for (j = 0; j < 8; j++)
2180 window_flag[j] &= ~(1L << y);
2184 for (i = 0; i < 16; i++)
2186 window_flag[x] &= ~(1L << i);
2199 window_flag[x] |= (1L << y);
2207 window_flag[x] &= ~(1L << y);
2214 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2216 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2226 d = get_keymap_dir(ch);
2228 x = (x + ddx[d] + 8) % 8;
2229 y = (y + ddy[d] + 16) % 16;
2236 /* Notice changes */
2237 for (j = 0; j < 8; j++)
2242 if (!angband_term[j]) continue;
2244 /* Ignore non-changes */
2245 if (window_flag[j] == old_flag[j]) continue;
2248 Term_activate(angband_term[j]);
2265 * Set or unset various options.
2267 * The user must use the "Ctrl-R" command to "adapt" to changes
2268 * in any options which control "visual" aspects of the game.
2270 void do_cmd_options(void)
2275 /* Save the screen */
2284 /* Why are we here */
2286 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2288 prt("Options", 1, 0);
2292 /* Give some choices */
2294 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 2, 5);
2295 prt("(2) ²èÌ̽ÐÎÏ ¥ª¥×¥·¥ç¥ó", 3, 5);
2296 prt("(3) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 4, 5);
2297 prt("(4) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 5, 5);
2298 prt("(5) ¸úΨ²½ ¥ª¥×¥·¥ç¥ó", 6, 5);
2299 prt("(6) ´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 7, 5);
2300 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 8, 5);
2302 /* Special choices */
2303 prt("(P) ¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 10, 5);
2304 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
2305 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
2306 prt("(M) ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
2307 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2309 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2311 prt("(1) Input Options", 2, 5);
2312 prt("(2) Output Options", 3, 5);
2313 prt("(3) Game-Play Options", 4, 5);
2314 prt("(4) Disturbance Options", 5, 5);
2315 prt("(5) Efficiency Options", 6, 5);
2316 prt("(6) Easy Auto-Destroyer Options", 7, 5);
2317 prt("(R) Play-record Options", 8, 5);
2318 /* Special choices */
2319 prt("(P) Auto-picker/destroyer editor", 10, 5);
2320 prt("(D) Base Delay Factor", 11, 5);
2321 prt("(H) Hitpoint Warning", 12, 5);
2322 prt("(M) Mana Color Threshold", 13, 5);
2323 prt("(A) Autosave Options", 14, 5);
2325 prt("(W) Window Flags", 15, 5);
2328 if (!p_ptr->wizard || !allow_debug_opts)
2332 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
2334 prt("(B) Birth Options (Browse Only)", 16, 5);
2341 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó", 16, 5);
2343 prt("(B) Birth Options", 16, 5);
2348 if (p_ptr->noscore || allow_debug_opts)
2352 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 17, 5);
2354 prt("(C) Cheating Options", 17, 5);
2361 prt("¥³¥Þ¥ó¥É:", 19, 0);
2363 prt("Command: ", 19, 0);
2371 if (k == ESCAPE) break;
2376 /* General Options */
2379 /* Process the general options */
2381 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2383 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2389 /* General Options */
2392 /* Process the general options */
2394 do_cmd_options_aux(OPT_PAGE_OUTPUT, "²èÌ̽ÐÎÏ¥ª¥×¥·¥ç¥ó");
2396 do_cmd_options_aux(OPT_PAGE_OUTPUT, "Output Options");
2402 /* Inventory Options */
2407 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2409 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2415 /* Disturbance Options */
2420 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2422 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2428 /* Efficiency Options */
2433 do_cmd_options_aux(OPT_PAGE_EFFICIENCY, "¸úΨ²½¥ª¥×¥·¥ç¥ó");
2435 do_cmd_options_aux(OPT_PAGE_EFFICIENCY, "Efficiency Options");
2441 /* Object auto-destruction Options */
2446 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2448 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2453 /* Play-record Options */
2459 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2461 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2472 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2474 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2480 /* Cheating Options */
2483 if (!p_ptr->noscore && !allow_debug_opts)
2485 /* Cheat options are not permitted */
2492 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2494 do_cmd_options_cheat("Cheaters never win");
2504 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2506 do_cmd_options_autosave("Autosave");
2517 do_cmd_options_win();
2518 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2519 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2520 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2521 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2525 /* Auto-picker/destroyer editor */
2529 do_cmd_edit_autopick();
2533 /* Hack -- Delay Speed */
2539 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2541 prt("Command: Base Delay Factor", 19, 0);
2545 /* Get a new value */
2548 int msec = delay_factor * delay_factor * delay_factor;
2550 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2551 delay_factor, msec), 22, 0);
2553 prt(format("Current base delay factor: %d (%d msec)",
2554 delay_factor, msec), 22, 0);
2558 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2560 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2564 if (k == ESCAPE) break;
2568 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2570 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2574 else if (isdigit(k)) delay_factor = D2I(k);
2581 /* Hack -- hitpoint warning factor */
2587 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2589 prt("Command: Hitpoint Warning", 19, 0);
2593 /* Get a new value */
2597 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2598 hitpoint_warn), 22, 0);
2600 prt(format("Current hitpoint warning: %d0%%",
2601 hitpoint_warn), 22, 0);
2605 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2607 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2611 if (k == ESCAPE) break;
2615 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2617 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2621 else if (isdigit(k)) hitpoint_warn = D2I(k);
2628 /* Hack -- mana color factor */
2634 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2636 prt("Command: Mana Color Threshold", 19, 0);
2640 /* Get a new value */
2644 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2647 prt(format("Current mana color threshold: %d0%%",
2652 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2654 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2658 if (k == ESCAPE) break;
2662 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2664 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2668 else if (isdigit(k)) mana_warn = D2I(k);
2677 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2679 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2684 /* Unknown option */
2693 /* Flush messages */
2698 /* Restore the screen */
2701 /* Hack - Redraw equippy chars */
2702 p_ptr->redraw |= (PR_EQUIPPY);
2708 * Ask for a "user pref line" and process it
2710 * XXX XXX XXX Allow absolute file names?
2712 void do_cmd_pref(void)
2719 /* Ask for a "user pref command" */
2721 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2723 if (!get_string("Pref: ", buf, 80)) return;
2727 /* Process that pref command */
2728 (void)process_pref_file_command(buf);
2731 void do_cmd_reload_autopick(void)
2734 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2736 if (!get_check("Reload auto-pick preference file? ")) return;
2739 /* Load the file with messages */
2740 autopick_load_pref(TRUE);
2746 * Hack -- append all current macros to the given file
2748 static errr macro_dump(cptr fname)
2750 static cptr mark = "Macro Dump";
2756 /* Build the filename */
2757 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2759 /* File type is "TEXT" */
2760 FILE_TYPE(FILE_TYPE_TEXT);
2762 /* Append to the file */
2763 if (!open_auto_dump(buf, mark)) return (-1);
2767 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2769 auto_dump_printf("\n# Automatic macro dump\n\n");
2773 for (i = 0; i < macro__num; i++)
2775 /* Extract the action */
2776 ascii_to_text(buf, macro__act[i]);
2778 /* Dump the macro */
2779 auto_dump_printf("A:%s\n", buf);
2781 /* Extract the action */
2782 ascii_to_text(buf, macro__pat[i]);
2784 /* Dump normal macros */
2785 auto_dump_printf("P:%s\n", buf);
2788 auto_dump_printf("\n");
2800 * Hack -- ask for a "trigger" (see below)
2802 * Note the complex use of the "inkey()" function from "util.c".
2804 * Note that both "flush()" calls are extremely important.
2806 static void do_cmd_macro_aux(char *buf)
2816 /* Do not process macros */
2822 /* Read the pattern */
2828 /* Do not process macros */
2831 /* Do not wait for keys */
2834 /* Attempt to read a key */
2845 /* Convert the trigger */
2846 ascii_to_text(tmp, buf);
2848 /* Hack -- display the trigger */
2849 Term_addstr(-1, TERM_WHITE, tmp);
2856 * Hack -- ask for a keymap "trigger" (see below)
2858 * Note that both "flush()" calls are extremely important. This may
2859 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2861 static void do_cmd_macro_aux_keymap(char *buf)
2875 /* Convert to ascii */
2876 ascii_to_text(tmp, buf);
2878 /* Hack -- display the trigger */
2879 Term_addstr(-1, TERM_WHITE, tmp);
2888 * Hack -- append all keymaps to the given file
2890 static errr keymap_dump(cptr fname)
2892 static cptr mark = "Keymap Dump";
2901 if (rogue_like_commands)
2903 mode = KEYMAP_MODE_ROGUE;
2909 mode = KEYMAP_MODE_ORIG;
2913 /* Build the filename */
2914 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2916 /* File type is "TEXT" */
2917 FILE_TYPE(FILE_TYPE_TEXT);
2919 /* Append to the file */
2920 if (!open_auto_dump(buf, mark)) return -1;
2924 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2926 auto_dump_printf("\n# Automatic keymap dump\n\n");
2930 for (i = 0; i < 256; i++)
2934 /* Loop up the keymap */
2935 act = keymap_act[mode][i];
2937 /* Skip empty keymaps */
2940 /* Encode the key */
2943 ascii_to_text(key, buf);
2945 /* Encode the action */
2946 ascii_to_text(buf, act);
2948 /* Dump the macro */
2949 auto_dump_printf("A:%s\n", buf);
2950 auto_dump_printf("C:%d:%s\n", mode, key);
2963 * Interact with "macros"
2965 * Note that the macro "action" must be defined before the trigger.
2967 * Could use some helpful instructions on this page. XXX XXX XXX
2969 void do_cmd_macros(void)
2981 if (rogue_like_commands)
2983 mode = KEYMAP_MODE_ROGUE;
2989 mode = KEYMAP_MODE_ORIG;
2992 /* File type is "TEXT" */
2993 FILE_TYPE(FILE_TYPE_TEXT);
3000 /* Process requests until done */
3008 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3010 prt("Interact with Macros", 2, 0);
3015 /* Describe that action */
3017 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3019 prt("Current action (if any) shown below:", 20, 0);
3023 /* Analyze the current action */
3024 ascii_to_text(buf, macro__buf);
3026 /* Display the current action */
3032 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3034 prt("(1) Load a user pref file", 4, 5);
3039 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3040 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3041 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3042 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3043 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3044 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3045 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3046 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3047 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3049 prt("(2) Append macros to a file", 5, 5);
3050 prt("(3) Query a macro", 6, 5);
3051 prt("(4) Create a macro", 7, 5);
3052 prt("(5) Remove a macro", 8, 5);
3053 prt("(6) Append keymaps to a file", 9, 5);
3054 prt("(7) Query a keymap", 10, 5);
3055 prt("(8) Create a keymap", 11, 5);
3056 prt("(9) Remove a keymap", 12, 5);
3057 prt("(0) Enter a new action", 13, 5);
3060 #endif /* ALLOW_MACROS */
3064 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3066 prt("Command: ", 16, 0);
3074 if (i == ESCAPE) break;
3076 /* Load a 'macro' file */
3083 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3085 prt("Command: Load a user pref file", 16, 0);
3091 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3093 prt("File: ", 18, 0);
3097 /* Default filename */
3098 sprintf(tmp, "%s.prf", player_name);
3100 /* Ask for a file */
3101 if (!askfor(tmp, 80)) continue;
3103 /* Process the given filename */
3104 err = process_pref_file(tmp);
3108 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3110 msg_format("Loaded default '%s'.", tmp);
3117 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3119 msg_format("Failed to load '%s'!");
3125 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3127 msg_format("Loaded '%s'.", tmp);
3139 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3141 prt("Command: Append macros to a file", 16, 0);
3147 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3149 prt("File: ", 18, 0);
3153 /* Default filename */
3154 sprintf(tmp, "%s.prf", player_name);
3156 /* Ask for a file */
3157 if (!askfor(tmp, 80)) continue;
3159 /* Dump the macros */
3160 (void)macro_dump(tmp);
3164 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3166 msg_print("Appended macros.");
3178 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3180 prt("Command: Query a macro", 16, 0);
3186 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3188 prt("Trigger: ", 18, 0);
3192 /* Get a macro trigger */
3193 do_cmd_macro_aux(buf);
3195 /* Acquire action */
3196 k = macro_find_exact(buf);
3203 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3205 msg_print("Found no macro.");
3213 /* Obtain the action */
3214 strcpy(macro__buf, macro__act[k]);
3216 /* Analyze the current action */
3217 ascii_to_text(buf, macro__buf);
3219 /* Display the current action */
3224 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3226 msg_print("Found a macro.");
3232 /* Create a macro */
3237 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3239 prt("Command: Create a macro", 16, 0);
3245 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3247 prt("Trigger: ", 18, 0);
3251 /* Get a macro trigger */
3252 do_cmd_macro_aux(buf);
3259 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3261 prt("Action: ", 20, 0);
3265 /* Convert to text */
3266 ascii_to_text(tmp, macro__buf);
3268 /* Get an encoded action */
3269 if (askfor(tmp, 80))
3271 /* Convert to ascii */
3272 text_to_ascii(macro__buf, tmp);
3274 /* Link the macro */
3275 macro_add(buf, macro__buf);
3279 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3281 msg_print("Added a macro.");
3287 /* Remove a macro */
3292 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3294 prt("Command: Remove a macro", 16, 0);
3300 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3302 prt("Trigger: ", 18, 0);
3306 /* Get a macro trigger */
3307 do_cmd_macro_aux(buf);
3309 /* Link the macro */
3310 macro_add(buf, buf);
3314 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3316 msg_print("Removed a macro.");
3326 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3328 prt("Command: Append keymaps to a file", 16, 0);
3334 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3336 prt("File: ", 18, 0);
3340 /* Default filename */
3341 sprintf(tmp, "%s.prf", player_name);
3343 /* Ask for a file */
3344 if (!askfor(tmp, 80)) continue;
3346 /* Dump the macros */
3347 (void)keymap_dump(tmp);
3351 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3353 msg_print("Appended keymaps.");
3358 /* Query a keymap */
3365 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3367 prt("Command: Query a keymap", 16, 0);
3373 prt("²¡¤¹¥¡¼: ", 18, 0);
3375 prt("Keypress: ", 18, 0);
3379 /* Get a keymap trigger */
3380 do_cmd_macro_aux_keymap(buf);
3382 /* Look up the keymap */
3383 act = keymap_act[mode][(byte)(buf[0])];
3390 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3392 msg_print("Found no keymap.");
3400 /* Obtain the action */
3401 strcpy(macro__buf, act);
3403 /* Analyze the current action */
3404 ascii_to_text(buf, macro__buf);
3406 /* Display the current action */
3411 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3413 msg_print("Found a keymap.");
3419 /* Create a keymap */
3424 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3426 prt("Command: Create a keymap", 16, 0);
3432 prt("²¡¤¹¥¡¼: ", 18, 0);
3434 prt("Keypress: ", 18, 0);
3438 /* Get a keymap trigger */
3439 do_cmd_macro_aux_keymap(buf);
3446 prt("¹ÔÆ°: ", 20, 0);
3448 prt("Action: ", 20, 0);
3452 /* Convert to text */
3453 ascii_to_text(tmp, macro__buf);
3455 /* Get an encoded action */
3456 if (askfor(tmp, 80))
3458 /* Convert to ascii */
3459 text_to_ascii(macro__buf, tmp);
3461 /* Free old keymap */
3462 string_free(keymap_act[mode][(byte)(buf[0])]);
3464 /* Make new keymap */
3465 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3469 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3471 msg_print("Added a keymap.");
3477 /* Remove a keymap */
3482 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3484 prt("Command: Remove a keymap", 16, 0);
3490 prt("²¡¤¹¥¡¼: ", 18, 0);
3492 prt("Keypress: ", 18, 0);
3496 /* Get a keymap trigger */
3497 do_cmd_macro_aux_keymap(buf);
3499 /* Free old keymap */
3500 string_free(keymap_act[mode][(byte)(buf[0])]);
3502 /* Make new keymap */
3503 keymap_act[mode][(byte)(buf[0])] = NULL;
3507 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3509 msg_print("Removed a keymap.");
3514 /* Enter a new action */
3519 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3521 prt("Command: Enter a new action", 16, 0);
3525 /* Go to the correct location */
3528 /* Hack -- limit the value */
3531 /* Get an encoded action */
3532 if (!askfor(buf, 80)) continue;
3534 /* Extract an action */
3535 text_to_ascii(macro__buf, buf);
3538 #endif /* ALLOW_MACROS */
3547 /* Flush messages */
3556 static void cmd_visuals_aux(int i, int *num, int max)
3563 sprintf(str, "%d", *num);
3565 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3568 tmp = strtol(str, NULL, 0);
3569 if (tmp >= 0 && tmp < max)
3573 else if (isupper(i))
3574 *num = (*num + max - 1) % max;
3576 *num = (*num + 1) % max;
3582 * Interact with "visuals"
3584 void do_cmd_visuals(void)
3592 const char *empty_symbol = "<< ? >>";
3594 if (use_bigtile) empty_symbol = "<< ?? >>";
3597 /* File type is "TEXT" */
3598 FILE_TYPE(FILE_TYPE_TEXT);
3601 /* Save the screen */
3605 /* Interact until done */
3611 /* Ask for a choice */
3613 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 2, 0);
3615 prt("Interact with Visuals", 2, 0);
3619 /* Give some choices */
3621 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3623 prt("(1) Load a user pref file", 4, 5);
3626 #ifdef ALLOW_VISUALS
3628 prt("(2) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3629 prt("(3) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3630 prt("(4) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 7, 5);
3631 prt("(5) (̤»ÈÍÑ)", 8, 5);
3632 prt("(6) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 9, 5);
3633 prt("(7) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 10, 5);
3634 prt("(8) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 11, 5);
3635 prt("(9) (̤»ÈÍÑ)", 12, 5);
3637 prt("(2) Dump monster attr/chars", 5, 5);
3638 prt("(3) Dump object attr/chars", 6, 5);
3639 prt("(4) Dump feature attr/chars", 7, 5);
3640 prt("(5) (unused)", 8, 5);
3641 prt("(6) Change monster attr/chars", 9, 5);
3642 prt("(7) Change object attr/chars", 10, 5);
3643 prt("(8) Change feature attr/chars", 11, 5);
3644 prt("(9) (unused)", 12, 5);
3649 prt("(0) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3651 prt("(0) Reset visuals", 13, 5);
3657 prt("¥³¥Þ¥ó¥É:", 18, 0);
3659 prt("Command: ", 15, 0);
3667 if (i == ESCAPE) break;
3669 /* Load a 'pref' file */
3674 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3676 prt("Command: Load a user pref file", 15, 0);
3682 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3684 prt("File: ", 17, 0);
3688 /* Default filename */
3689 sprintf(tmp, "%s.prf", player_name);
3692 if (!askfor(tmp, 70)) continue;
3694 /* Process the given filename */
3695 (void)process_pref_file(tmp);
3698 #ifdef ALLOW_VISUALS
3700 /* Dump monster attr/chars */
3703 static cptr mark = "Monster attr/chars";
3707 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3709 prt("Command: Dump monster attr/chars", 15, 0);
3715 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3717 prt("File: ", 17, 0);
3721 /* Default filename */
3722 sprintf(tmp, "%s.prf", player_name);
3724 /* Get a filename */
3725 if (!askfor(tmp, 70)) continue;
3727 /* Build the filename */
3728 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3730 /* Append to the file */
3731 if (!open_auto_dump(buf, mark)) continue;
3735 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3737 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3741 for (i = 1; i < max_r_idx; i++)
3743 monster_race *r_ptr = &r_info[i];
3745 /* Skip non-entries */
3746 if (!r_ptr->name) continue;
3748 /* Dump a comment */
3749 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3751 /* Dump the monster attr/char info */
3752 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3753 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3761 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3763 msg_print("Dumped monster attr/chars.");
3768 /* Dump object attr/chars */
3771 static cptr mark = "Object attr/chars";
3775 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3777 prt("Command: Dump object attr/chars", 15, 0);
3783 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3785 prt("File: ", 17, 0);
3789 /* Default filename */
3790 sprintf(tmp, "%s.prf", player_name);
3792 /* Get a filename */
3793 if (!askfor(tmp, 70)) continue;
3795 /* Build the filename */
3796 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3798 /* Append to the file */
3799 if (!open_auto_dump(buf, mark)) continue;
3803 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3805 auto_dump_printf("\n# Object attr/char definitions\n\n");
3809 for (i = 1; i < max_k_idx; i++)
3812 object_kind *k_ptr = &k_info[i];
3814 /* Skip non-entries */
3815 if (!k_ptr->name) continue;
3817 /* Skip entries with flavor */
3818 if (k_ptr->flavor) continue;
3821 strip_name(o_name, i);
3823 /* Dump a comment */
3824 auto_dump_printf("# %s\n", o_name);
3826 /* Dump the object attr/char info */
3827 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3828 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3836 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3838 msg_print("Dumped object attr/chars.");
3843 /* Dump feature attr/chars */
3846 static cptr mark = "Feature attr/chars";
3850 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3852 prt("Command: Dump feature attr/chars", 15, 0);
3858 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3860 prt("File: ", 17, 0);
3864 /* Default filename */
3865 sprintf(tmp, "%s.prf", player_name);
3867 /* Get a filename */
3868 if (!askfor(tmp, 70)) continue;
3870 /* Build the filename */
3871 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3873 /* Append to the file */
3874 if (!open_auto_dump(buf, mark)) continue;
3878 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3880 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3884 for (i = 1; i < max_f_idx; i++)
3886 feature_type *f_ptr = &f_info[i];
3888 /* Skip non-entries */
3889 if (!f_ptr->name) continue;
3891 /* Skip mimiccing features */
3892 if (f_ptr->mimic != i) continue;
3894 /* Dump a comment */
3895 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3897 /* Dump the feature attr/char info */
3898 auto_dump_printf("F:%d:0x%02X/0x%02X\n\n", i,
3899 (byte)(f_ptr->x_attr), (byte)(f_ptr->x_char));
3907 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3909 msg_print("Dumped feature attr/chars.");
3914 /* Modify monster attr/chars */
3921 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3923 prt("Command: Change monster attr/chars", 15, 0);
3927 /* Hack -- query until done */
3930 monster_race *r_ptr = &r_info[r];
3934 byte da = (r_ptr->d_attr);
3935 byte dc = (r_ptr->d_char);
3936 byte ca = (r_ptr->x_attr);
3937 byte cc = (r_ptr->x_char);
3939 /* Label the object */
3941 Term_putstr(5, 17, -1, TERM_WHITE,
3942 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
3943 r, (r_name + r_ptr->name)));
3945 Term_putstr(5, 17, -1, TERM_WHITE,
3946 format("Monster = %d, Name = %-40.40s",
3947 r, (r_name + r_ptr->name)));
3951 /* Label the Default values */
3953 Term_putstr(10, 19, -1, TERM_WHITE,
3954 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
3956 Term_putstr(10, 19, -1, TERM_WHITE,
3957 format("Default attr/char = %3u / %3u", da, dc));
3960 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3961 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3963 /* Label the Current values */
3965 Term_putstr(10, 20, -1, TERM_WHITE,
3966 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
3968 Term_putstr(10, 20, -1, TERM_WHITE,
3969 format("Current attr/char = %3u / %3u", ca, cc));
3972 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3973 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3977 Term_putstr(0, 22, -1, TERM_WHITE,
3978 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
3980 Term_putstr(0, 22, -1, TERM_WHITE,
3981 "Command (n/N/^N/a/A/^A/c/C/^C): ");
3988 if (i == ESCAPE) break;
3990 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3991 else if (isupper(i)) c = 'a' + i - 'A';
3997 cmd_visuals_aux(i, &r, max_r_idx);
4000 t = (int)r_ptr->x_attr;
4001 cmd_visuals_aux(i, &t, 256);
4002 r_ptr->x_attr = (byte)t;
4005 t = (int)r_ptr->x_char;
4006 cmd_visuals_aux(i, &t, 256);
4007 r_ptr->x_char = (byte)t;
4013 /* Modify object attr/chars */
4020 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
4022 prt("Command: Change object attr/chars", 15, 0);
4026 /* Hack -- query until done */
4029 object_kind *k_ptr = &k_info[k];
4033 byte da = (byte)k_ptr->d_attr;
4034 byte dc = (byte)k_ptr->d_char;
4035 byte ca = (byte)k_ptr->x_attr;
4036 byte cc = (byte)k_ptr->x_char;
4038 /* Label the object */
4040 Term_putstr(5, 17, -1, TERM_WHITE,
4041 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4042 k, (k_name + k_ptr->name)));
4044 Term_putstr(5, 17, -1, TERM_WHITE,
4045 format("Object = %d, Name = %-40.40s",
4046 k, (k_name + k_ptr->name)));
4050 /* Label the Default values */
4052 Term_putstr(10, 19, -1, TERM_WHITE,
4053 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4055 Term_putstr(10, 19, -1, TERM_WHITE,
4056 format("Default attr/char = %3d / %3d", da, dc));
4059 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4060 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4062 /* Label the Current values */
4064 Term_putstr(10, 20, -1, TERM_WHITE,
4065 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4067 Term_putstr(10, 20, -1, TERM_WHITE,
4068 format("Current attr/char = %3d / %3d", ca, cc));
4071 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4072 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4076 Term_putstr(0, 22, -1, TERM_WHITE,
4077 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4079 Term_putstr(0, 22, -1, TERM_WHITE,
4080 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4087 if (i == ESCAPE) break;
4089 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4090 else if (isupper(i)) c = 'a' + i - 'A';
4096 cmd_visuals_aux(i, &k, max_k_idx);
4099 t = (int)k_info[k].x_attr;
4100 cmd_visuals_aux(i, &t, 256);
4101 k_info[k].x_attr = (byte)t;
4104 t = (int)k_info[k].x_char;
4105 cmd_visuals_aux(i, &t, 256);
4106 k_info[k].x_char = (byte)t;
4112 /* Modify feature attr/chars */
4119 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
4121 prt("Command: Change feature attr/chars", 15, 0);
4125 /* Hack -- query until done */
4128 feature_type *f_ptr = &f_info[f];
4132 byte da = (byte)f_ptr->d_attr;
4133 byte dc = (byte)f_ptr->d_char;
4134 byte ca = (byte)f_ptr->x_attr;
4135 byte cc = (byte)f_ptr->x_char;
4137 /* Label the object */
4139 Term_putstr(5, 17, -1, TERM_WHITE,
4140 format("ÃÏ·Á = %d, ̾Á° = %-40.40s",
4141 f, (f_name + f_ptr->name)));
4143 Term_putstr(5, 17, -1, TERM_WHITE,
4144 format("Terrain = %d, Name = %-40.40s",
4145 f, (f_name + f_ptr->name)));
4149 /* Label the Default values */
4151 Term_putstr(10, 19, -1, TERM_WHITE,
4152 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4154 Term_putstr(10, 19, -1, TERM_WHITE,
4155 format("Default attr/char = %3d / %3d", da, dc));
4158 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4160 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4163 /* Label the Current values */
4165 Term_putstr(10, 20, -1, TERM_WHITE,
4166 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4168 Term_putstr(10, 20, -1, TERM_WHITE,
4169 format("Current attr/char = %3d / %3d", ca, cc));
4172 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4173 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4177 Term_putstr(0, 22, -1, TERM_WHITE,
4178 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4180 Term_putstr(0, 22, -1, TERM_WHITE,
4181 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4188 if (i == ESCAPE) break;
4190 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4191 else if (isupper(i)) c = 'a' + i - 'A';
4197 cmd_visuals_aux(i, &f, max_f_idx);
4200 t = (int)f_info[f].x_attr;
4201 cmd_visuals_aux(i, &t, 256);
4202 f_info[f].x_attr = (byte)t;
4205 t = (int)f_info[f].x_char;
4206 cmd_visuals_aux(i, &t, 256);
4207 f_info[f].x_char = (byte)t;
4223 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4225 msg_print("Visual attr/char tables reset.");
4230 /* Unknown option */
4236 /* Flush messages */
4241 /* Restore the screen */
4247 * Interact with "colors"
4249 void do_cmd_colors(void)
4258 /* File type is "TEXT" */
4259 FILE_TYPE(FILE_TYPE_TEXT);
4262 /* Save the screen */
4266 /* Interact until done */
4272 /* Ask for a choice */
4274 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4276 prt("Interact with Colors", 2, 0);
4280 /* Give some choices */
4282 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4284 prt("(1) Load a user pref file", 4, 5);
4289 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4290 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4292 prt("(2) Dump colors", 5, 5);
4293 prt("(3) Modify colors", 6, 5);
4300 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4302 prt("Command: ", 8, 0);
4310 if (i == ESCAPE) break;
4312 /* Load a 'pref' file */
4317 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4319 prt("Command: Load a user pref file", 8, 0);
4325 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4327 prt("File: ", 10, 0);
4332 sprintf(tmp, "%s.prf", player_name);
4335 if (!askfor(tmp, 70)) continue;
4337 /* Process the given filename */
4338 (void)process_pref_file(tmp);
4340 /* Mega-Hack -- react to changes */
4341 Term_xtra(TERM_XTRA_REACT, 0);
4343 /* Mega-Hack -- redraw */
4352 static cptr mark = "Colors";
4356 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4358 prt("Command: Dump colors", 8, 0);
4364 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4366 prt("File: ", 10, 0);
4370 /* Default filename */
4371 sprintf(tmp, "%s.prf", player_name);
4373 /* Get a filename */
4374 if (!askfor(tmp, 70)) continue;
4376 /* Build the filename */
4377 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4379 /* Append to the file */
4380 if (!open_auto_dump(buf, mark)) continue;
4384 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4386 auto_dump_printf("\n# Color redefinitions\n\n");
4390 for (i = 0; i < 256; i++)
4392 int kv = angband_color_table[i][0];
4393 int rv = angband_color_table[i][1];
4394 int gv = angband_color_table[i][2];
4395 int bv = angband_color_table[i][3];
4400 cptr name = "unknown";
4404 /* Skip non-entries */
4405 if (!kv && !rv && !gv && !bv) continue;
4407 /* Extract the color name */
4408 if (i < 16) name = color_names[i];
4410 /* Dump a comment */
4412 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4414 auto_dump_printf("# Color '%s'\n", name);
4417 /* Dump the monster attr/char info */
4418 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4427 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4429 msg_print("Dumped color redefinitions.");
4441 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4443 prt("Command: Modify colors", 8, 0);
4447 /* Hack -- query until done */
4456 /* Exhibit the normal colors */
4457 for (j = 0; j < 16; j++)
4459 /* Exhibit this color */
4460 Term_putstr(j*4, 20, -1, a, "###");
4462 /* Exhibit all colors */
4463 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4466 /* Describe the color */
4468 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4470 name = ((a < 16) ? color_names[a] : "undefined");
4474 /* Describe the color */
4476 Term_putstr(5, 10, -1, TERM_WHITE,
4477 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4479 Term_putstr(5, 10, -1, TERM_WHITE,
4480 format("Color = %d, Name = %s", a, name));
4484 /* Label the Current values */
4485 Term_putstr(5, 12, -1, TERM_WHITE,
4486 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4487 angband_color_table[a][0],
4488 angband_color_table[a][1],
4489 angband_color_table[a][2],
4490 angband_color_table[a][3]));
4494 Term_putstr(0, 14, -1, TERM_WHITE,
4495 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4497 Term_putstr(0, 14, -1, TERM_WHITE,
4498 "Command (n/N/k/K/r/R/g/G/b/B): ");
4506 if (i == ESCAPE) break;
4509 if (i == 'n') a = (byte)(a + 1);
4510 if (i == 'N') a = (byte)(a - 1);
4511 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4512 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4513 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4514 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4515 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4516 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4517 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4518 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4520 /* Hack -- react to changes */
4521 Term_xtra(TERM_XTRA_REACT, 0);
4523 /* Hack -- redraw */
4530 /* Unknown option */
4536 /* Flush messages */
4541 /* Restore the screen */
4547 * Note something in the message recall
4549 void do_cmd_note(void)
4558 if (!get_string("¥á¥â: ", buf, 60)) return;
4560 if (!get_string("Note: ", buf, 60)) return;
4564 /* Ignore empty notes */
4565 if (!buf[0] || (buf[0] == ' ')) return;
4567 /* Add the note to the message recall */
4569 msg_format("¥á¥â: %s", buf);
4571 msg_format("Note: %s", buf);
4578 * Mention the current version
4580 void do_cmd_version(void)
4585 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4586 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4588 msg_format("You are playing Hengband %d.%d.%d.",
4589 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4596 * Array of feeling strings
4598 static cptr do_cmd_feeling_text[11] =
4601 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4603 "Looks like any other level.",
4607 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4609 "You feel there is something special about this level.",
4613 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4615 "You nearly faint as horrible visions of death fill your mind!",
4619 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4621 "This level looks very dangerous.",
4625 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4627 "You have a very bad feeling...",
4631 "°¤¤Í½´¶¤¬¤¹¤ë...",
4633 "You have a bad feeling...",
4639 "You feel nervous.",
4643 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4645 "You feel your luck is turning...",
4649 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4651 "You don't like the look of this place.",
4655 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4657 "This level looks reasonably safe.",
4661 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4663 "What a boring place..."
4668 static cptr do_cmd_feeling_text_combat[11] =
4671 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4673 "Looks like any other level.",
4677 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4679 "You feel there is something special about this level.",
4683 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4685 "You nearly faint as horrible visions of death fill your mind!",
4689 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4691 "This level looks very dangerous.",
4695 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4697 "You have a very bad feeling...",
4701 "°¤¤Í½´¶¤¬¤¹¤ë...",
4703 "You have a bad feeling...",
4709 "You feel nervous.",
4713 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4715 "You feel your luck is turning...",
4719 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4721 "You don't like the look of this place.",
4725 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4727 "This level looks reasonably safe.",
4731 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4733 "What a boring place..."
4738 static cptr do_cmd_feeling_text_lucky[11] =
4741 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4742 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4743 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4744 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4745 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4746 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4747 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4748 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4749 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4750 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4751 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4753 "Looks like any other level.",
4754 "You feel there is something special about this level.",
4755 "You have a superb feeling about this level.",
4756 "You have an excellent feeling...",
4757 "You have a very good feeling...",
4758 "You have a good feeling...",
4759 "You feel strangely lucky...",
4760 "You feel your luck is turning...",
4761 "You like the look of this place...",
4762 "This level can't be all bad...",
4763 "What a boring place..."
4769 * Note that "feeling" is set to zero unless some time has passed.
4770 * Note that this is done when the level is GENERATED, not entered.
4772 void do_cmd_feeling(void)
4774 /* Verify the feeling */
4775 if (feeling > 10) feeling = 10;
4777 /* No useful feeling in quests */
4778 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4781 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4783 msg_print("Looks like a typical quest level.");
4789 /* No useful feeling in town */
4790 else if (p_ptr->town_num && !dun_level)
4793 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4795 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4799 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4801 msg_print("Looks like a strange wilderness.");
4809 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4811 msg_print("Looks like a typical town.");
4818 /* No useful feeling in the wilderness */
4819 else if (!dun_level)
4822 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4824 msg_print("Looks like a typical wilderness.");
4830 /* Display the feeling */
4831 if (turn - old_turn >= (150 - dun_level)*TURNS_PER_TICK || cheat_xtra)
4833 if (p_ptr->muta3 & MUT3_GOOD_LUCK) msg_print(do_cmd_feeling_text_lucky[feeling]);
4835 if((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)){
4836 msg_print(do_cmd_feeling_text_combat[feeling]);
4838 msg_print(do_cmd_feeling_text[feeling]);
4843 msg_print(do_cmd_feeling_text[0]);
4850 * Description of each monster group.
4852 static cptr monster_group_text[] =
4855 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
4856 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
4885 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
4902 /* "¾åµé¥Ç¡¼¥â¥ó", */
4943 /* "Ancient Dragon/Wyrm", */
4952 "Multi-Headed Reptile",
4957 "Reptile/Amphibian",
4958 "Spider/Scorpion/Tick",
4960 /* "Major Demon", */
4976 * Symbols of monsters in each group. Note the "Uniques" group
4977 * is handled differently.
4979 static cptr monster_group_char[] =
5034 "$!?=&`.|/\\~[]()>",
5043 * hook function to sort monsters by level
5045 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5047 u16b *who = (u16b*)(u);
5052 monster_race *r_ptr1 = &r_info[w1];
5053 monster_race *r_ptr2 = &r_info[w2];
5058 if (r_ptr2->level > r_ptr1->level) return TRUE;
5059 if (r_ptr1->level > r_ptr2->level) return FALSE;
5061 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5062 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5067 * Build a list of monster indexes in the given group. Return the number
5068 * of monsters in the group.
5070 * mode & 0x01 : check for non-empty group
5071 * mode & 0x02 : cheat?
5073 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5078 /* Get a list of x_char in this group */
5079 cptr group_char = monster_group_char[grp_cur];
5081 /* XXX Hack -- Check if this is the "Uniques" group */
5082 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5084 /* XXX Hack -- Check if this is the "Riding" group */
5085 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5087 /* Check every race */
5088 for (i = 0; i < max_r_idx; i++)
5090 /* Access the race */
5091 monster_race *r_ptr = &r_info[i];
5093 /* Skip empty race */
5094 if (!r_ptr->name) continue ;
5096 /* Require known monsters */
5097 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights ) continue;
5101 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5104 else if (grp_riding)
5106 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5111 /* Check for race in the group */
5112 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5116 mon_idx[mon_cnt++] = i;
5118 /* XXX Hack -- Just checking for non-empty group */
5119 if (mode & 0x01) break;
5122 /* Terminate the list */
5123 mon_idx[mon_cnt] = 0;
5125 /* Select the sort method */
5126 ang_sort_comp = ang_sort_comp_monster_level;
5127 ang_sort_swap = ang_sort_swap_hook;
5129 /* Sort by monster level */
5130 ang_sort(mon_idx, &dummy_why, mon_cnt);
5132 /* Return the number of races */
5138 * Description of each monster group.
5140 static cptr object_group_text[] =
5143 "¥¥Î¥³", /* "Mushrooms" */
5144 "Ìô", /* "Potions" */
5145 "Ìý¤Ä¤Ü", /* "Flasks" */
5146 "´¬Êª", /* "Scrolls" */
5147 "»ØÎØ", /* "Rings" */
5148 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5149 "ū", /* "Whistle" */
5150 "¸÷¸»", /* "Lanterns" */
5151 "ËâË¡ËÀ", /* "Wands" */
5152 "¾ó", /* "Staffs" */
5153 "¥í¥Ã¥É", /* "Rods" */
5154 "¥«¡¼¥É", /* "Cards" */
5155 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5164 "Åá·õÎà", /* "Swords" */
5165 "Æß´ï", /* "Blunt Weapons" */
5166 "ĹÊÁÉð´ï", /* "Polearms" */
5167 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5168 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5172 "·ÚÁõ³»", /* "Soft Armor" */
5173 "½ÅÁõ³»", /* "Hard Armor" */
5174 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5175 "½â", /* "Shields" */
5176 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5177 "äƼê", /* "Gloves" */
5178 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5179 "´§", /* "Crowns" */
5180 "¥Ö¡¼¥Ä", /* "Boots" */
5228 * TVALs of items in each group
5230 static byte object_group_tval[] =
5270 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5276 * Build a list of monster indexes in the given group. Return the number
5277 * of monsters in the group.
5279 static int collect_objects(int grp_cur, int object_idx[])
5281 int i, j, k, object_cnt = 0;
5283 /* Get a list of x_char in this group */
5284 byte group_tval = object_group_tval[grp_cur];
5286 /* Check every object */
5287 for (i = 0; i < max_k_idx; i++)
5289 /* Access the race */
5290 object_kind *k_ptr = &k_info[i];
5292 /* Skip empty objects */
5293 if (!k_ptr->name) continue;
5295 /* Skip non-flavoured objects */
5296 if (!k_ptr->flavor && !p_ptr->wizard) continue;
5298 /* Skip items with no distribution (special artifacts) */
5299 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5302 /* Require objects ever seen*/
5303 if (!k_ptr->aware && !p_ptr->wizard) continue;
5305 /* Check for race in the group */
5306 if (TV_LIFE_BOOK == group_tval)
5308 /* Hack -- All spell books */
5309 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5312 object_idx[object_cnt++] = i;
5315 else if (k_ptr->tval == group_tval)
5318 object_idx[object_cnt++] = i;
5322 /* Terminate the list */
5323 object_idx[object_cnt] = 0;
5325 /* Return the number of races */
5331 * Description of each feature group.
5333 static cptr feature_group_text[] =
5341 * Build a list of feature indexes in the given group. Return the number
5342 * of features in the group.
5344 static int collect_features(int grp_cur, int *feat_idx)
5346 int i, feat_cnt = 0;
5348 /* Unused; There is a single group. */
5351 /* Check every feature */
5352 for (i = 1; i < max_f_idx; i++)
5354 /* Access the index */
5355 feature_type *f_ptr = &f_info[i];
5357 /* Skip empty index */
5358 if (!f_ptr->name) continue;
5360 /* Skip mimiccing features */
5361 if (f_ptr->mimic != i) continue;
5364 feat_idx[feat_cnt++] = i;
5367 /* Terminate the list */
5368 feat_idx[feat_cnt] = 0;
5370 /* Return the number of races */
5377 * Build a list of monster indexes in the given group. Return the number
5378 * of monsters in the group.
5380 static int collect_artifacts(int grp_cur, int object_idx[])
5382 int i, object_cnt = 0;
5384 /* Get a list of x_char in this group */
5385 byte group_tval = object_group_tval[grp_cur];
5387 /* Check every object */
5388 for (i = 0; i < max_a_idx; i++)
5390 /* Access the artifact */
5391 artifact_type *a_ptr = &a_info[i];
5393 /* Skip empty artifacts */
5394 if (!a_ptr->name) continue;
5396 /* Skip "uncreated" artifacts */
5397 if (!a_ptr->cur_num) continue;
5399 /* Check for race in the group */
5400 if (a_ptr->tval == group_tval)
5403 object_idx[object_cnt++] = i;
5407 /* Terminate the list */
5408 object_idx[object_cnt] = 0;
5410 /* Return the number of races */
5417 * Encode the screen colors
5419 static char hack[17] = "dwsorgbuDWvyRGBU";
5423 * Hack -- load a screen dump from a file
5425 void do_cmd_load_screen(void)
5440 Term_get_size(&wid, &hgt);
5442 /* Build the filename */
5443 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5445 /* Append to the file */
5446 fff = my_fopen(buf, "r");
5451 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5453 msg_format("Failed to open %s.", buf);
5460 /* Save the screen */
5463 /* Clear the screen */
5467 /* Load the screen */
5468 for (y = 0; okay; y++)
5470 /* Get a line of data including control code */
5471 if (!fgets(buf, 1024, fff)) okay = FALSE;
5473 /* Get the blank line */
5474 if (buf[0] == '\n' || buf[0] == '\0') break;
5476 /* Ignore too large screen image */
5477 if (y >= hgt) continue;
5480 for (x = 0; x < wid - 1; x++)
5483 if (buf[x] == '\n' || buf[x] == '\0') break;
5485 /* Put the attr/char */
5486 Term_draw(x, y, TERM_WHITE, buf[x]);
5490 /* Dump the screen */
5491 for (y = 0; okay; y++)
5493 /* Get a line of data including control code */
5494 if (!fgets(buf, 1024, fff)) okay = FALSE;
5496 /* Get the blank line */
5497 if (buf[0] == '\n' || buf[0] == '\0') break;
5499 /* Ignore too large screen image */
5500 if (y >= hgt) continue;
5503 for (x = 0; x < wid - 1; x++)
5506 if (buf[x] == '\n' || buf[x] == '\0') break;
5508 /* Get the attr/char */
5509 (void)(Term_what(x, y, &a, &c));
5511 /* Look up the attr */
5512 for (i = 0; i < 16; i++)
5514 /* Use attr matches */
5515 if (hack[i] == buf[x]) a = i;
5518 /* Put the attr/char */
5519 Term_draw(x, y, a, c);
5530 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5532 msg_print("Screen dump loaded.");
5539 /* Restore the screen */
5546 cptr inven_res_label =
5548 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5550 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5555 #define IM_FLAG_STR "¡ö"
5556 #define HAS_FLAG_STR "¡Ü"
5557 #define NO_FLAG_STR "¡¦"
5559 #define IM_FLAG_STR "* "
5560 #define HAS_FLAG_STR "+ "
5561 #define NO_FLAG_STR ". "
5564 #define print_im_or_res_flag(IM, RES) \
5566 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5567 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5570 #define print_flag(TR) \
5572 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5576 /* XTRA HACK RESLIST */
5577 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5579 char o_name[MAX_NLEN];
5580 u32b flgs[TR_FLAG_SIZE];
5582 if (!o_ptr->k_idx) return;
5583 if (o_ptr->tval != tval) return;
5585 /* Identified items only */
5586 if (!object_known_p(o_ptr)) return;
5589 * HACK:Ring of Lordly protection and Dragon equipment
5590 * have random resistances.
5592 if (((TV_WEARABLE_BEGIN <= tval) && (tval <= TV_WEARABLE_END) && o_ptr->name2)
5593 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5594 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5595 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5596 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5597 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5598 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5599 || o_ptr->art_name || o_ptr->name1)
5602 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5604 while (o_name[i] && (i < 26))
5607 if (iskanji(o_name[i])) i++;
5616 o_name[i] = ' '; i++;
5621 fprintf(fff, "%s %s", where, o_name);
5623 if (!(o_ptr->ident & (IDENT_MENTAL)))
5626 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5628 fputs("-------unknown------------ -------unknown------\n", fff);
5633 object_flags_known(o_ptr, flgs);
5635 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5636 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5637 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5638 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5639 print_flag(TR_RES_POIS);
5640 print_flag(TR_RES_LITE);
5641 print_flag(TR_RES_DARK);
5642 print_flag(TR_RES_SHARDS);
5643 print_flag(TR_RES_SOUND);
5644 print_flag(TR_RES_NETHER);
5645 print_flag(TR_RES_NEXUS);
5646 print_flag(TR_RES_CHAOS);
5647 print_flag(TR_RES_DISEN);
5651 print_flag(TR_RES_BLIND);
5652 print_flag(TR_RES_FEAR);
5653 print_flag(TR_RES_CONF);
5654 print_flag(TR_FREE_ACT);
5655 print_flag(TR_SEE_INVIS);
5656 print_flag(TR_HOLD_LIFE);
5657 print_flag(TR_TELEPATHY);
5658 print_flag(TR_SLOW_DIGEST);
5659 print_flag(TR_REGEN);
5660 print_flag(TR_FEATHER);
5668 fprintf(fff, "%s\n", inven_res_label);
5674 * Display *ID* ed weapons/armors's resistances
5676 static void do_cmd_knowledge_inven(void)
5680 char file_name[1024];
5690 /* Open a new file */
5691 fff = my_fopen_temp(file_name, 1024);
5695 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5697 msg_format("Failed to create temporary file %s.", file_name);
5702 fprintf(fff, "%s\n", inven_res_label);
5704 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
5708 for (; j < 9; j++) fputc('\n', fff);
5710 fprintf(fff, "%s\n", inven_res_label);
5714 strcpy(where, "Áõ");
5716 strcpy(where, "E ");
5718 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5720 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5724 strcpy(where, "»ý");
5726 strcpy(where, "I ");
5728 for (i = 0; i < INVEN_PACK; i++)
5730 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5733 st_ptr = &town[1].store[STORE_HOME];
5735 strcpy(where, "²È");
5737 strcpy(where, "H ");
5740 for (i = 0; i < st_ptr->stock_num; i++)
5742 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
5746 /* Close the file */
5749 /* Display the file contents */
5751 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5753 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5756 /* Remove the file */
5761 void do_cmd_save_screen_html_aux(char *filename, int message)
5765 byte a = 0, old_a = 0;
5779 cptr html_head[] = {
5780 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5784 cptr html_foot[] = {
5786 "</body>\n</html>\n",
5792 Term_get_size(&wid, &hgt);
5794 /* File type is "TEXT" */
5795 FILE_TYPE(FILE_TYPE_TEXT);
5797 /* Append to the file */
5798 fff = my_fopen(filename, "w");
5804 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5806 msg_format("Failed to open file %s.", filename);
5814 /* Save the screen */
5818 /* Build the filename */
5819 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5820 tmpfff = my_fopen(buf, "r");
5822 for (i = 0; html_head[i]; i++)
5823 fprintf(fff, html_head[i]);
5827 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5829 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
5833 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
5835 fprintf(fff, "%s\n", buf);
5840 /* Dump the screen */
5841 for (y = 0; y < hgt; y++)
5848 for (x = 0; x < wid - 1; x++)
5852 /* Get the attr/char */
5853 (void)(Term_what(x, y, &a, &c));
5857 case '&': cc = "&"; break;
5858 case '<': cc = "<"; break;
5859 case '>': cc = ">"; break;
5861 case 0x1f: c = '.'; break;
5862 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5867 if ((y == 0 && x == 0) || a != old_a) {
5868 rv = angband_color_table[a][1];
5869 gv = angband_color_table[a][2];
5870 bv = angband_color_table[a][3];
5871 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5872 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5876 fprintf(fff, "%s", cc);
5878 fprintf(fff, "%c", c);
5881 fprintf(fff, "</font>");
5884 for (i = 0; html_foot[i]; i++)
5885 fprintf(fff, html_foot[i]);
5890 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5892 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
5896 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
5898 fprintf(fff, "%s\n", buf);
5913 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
5915 msg_print("Screen dump saved.");
5920 /* Restore the screen */
5926 * Hack -- save a screen dump to a file
5928 static void do_cmd_save_screen_html(void)
5930 char buf[1024], tmp[256] = "screen.html";
5933 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
5935 if (!get_string("File name: ", tmp, 80))
5939 /* Build the filename */
5940 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
5944 do_cmd_save_screen_html_aux(buf, 1);
5949 * Redefinable "save_screen" action
5951 void (*screendump_aux)(void) = NULL;
5955 * Hack -- save a screen dump to a file
5957 void do_cmd_save_screen(void)
5959 bool old_use_graphics = use_graphics;
5960 bool html_dump = FALSE;
5965 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
5967 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
5972 if (c == 'Y' || c == 'y')
5974 else if (c == 'H' || c == 'h')
5986 Term_get_size(&wid, &hgt);
5988 if (old_use_graphics)
5990 use_graphics = FALSE;
5993 /* Redraw everything */
5994 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5996 /* Hack -- update */
6002 do_cmd_save_screen_html();
6006 /* Do we use a special screendump function ? */
6007 else if (screendump_aux)
6009 /* Dump the screen to a graphics file */
6010 (*screendump_aux)();
6012 else /* Dump the screen as text */
6023 /* Build the filename */
6024 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6026 /* File type is "TEXT" */
6027 FILE_TYPE(FILE_TYPE_TEXT);
6029 /* Append to the file */
6030 fff = my_fopen(buf, "w");
6036 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6038 msg_format("Failed to open file %s.", buf);
6045 /* Save the screen */
6049 /* Dump the screen */
6050 for (y = 0; y < hgt; y++)
6053 for (x = 0; x < wid - 1; x++)
6055 /* Get the attr/char */
6056 (void)(Term_what(x, y, &a, &c));
6066 fprintf(fff, "%s\n", buf);
6073 /* Dump the screen */
6074 for (y = 0; y < hgt; y++)
6077 for (x = 0; x < wid - 1; x++)
6079 /* Get the attr/char */
6080 (void)(Term_what(x, y, &a, &c));
6083 buf[x] = hack[a&0x0F];
6090 fprintf(fff, "%s\n", buf);
6102 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6104 msg_print("Screen dump saved.");
6110 /* Restore the screen */
6114 if (old_use_graphics)
6116 use_graphics = TRUE;
6119 /* Redraw everything */
6120 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6122 /* Hack -- update */
6129 * Sorting hook -- Comp function -- see below
6131 * We use "u" to point to array of monster indexes,
6132 * and "v" to select the type of sorting to perform on "u".
6134 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6136 u16b *who = (u16b*)(u);
6138 u16b *why = (u16b*)(v);
6145 /* Sort by total kills */
6148 /* Extract total kills */
6149 z1 = a_info[w1].tval;
6150 z2 = a_info[w2].tval;
6152 /* Compare total kills */
6153 if (z1 < z2) return (TRUE);
6154 if (z1 > z2) return (FALSE);
6158 /* Sort by monster level */
6161 /* Extract levels */
6162 z1 = a_info[w1].sval;
6163 z2 = a_info[w2].sval;
6165 /* Compare levels */
6166 if (z1 < z2) return (TRUE);
6167 if (z1 > z2) return (FALSE);
6171 /* Sort by monster experience */
6174 /* Extract experience */
6175 z1 = a_info[w1].level;
6176 z2 = a_info[w2].level;
6178 /* Compare experience */
6179 if (z1 < z2) return (TRUE);
6180 if (z1 > z2) return (FALSE);
6184 /* Compare indexes */
6190 * Sorting hook -- Swap function -- see below
6192 * We use "u" to point to array of monster indexes,
6193 * and "v" to select the type of sorting to perform.
6195 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6197 u16b *who = (u16b*)(u);
6212 * Check the status of "artifacts"
6214 static void do_cmd_knowledge_artifacts(void)
6216 int i, k, z, x, y, n = 0;
6222 char file_name[1024];
6224 char base_name[MAX_NLEN];
6228 /* Open a new file */
6229 fff = my_fopen_temp(file_name, 1024);
6233 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6235 msg_format("Failed to create temporary file %s.", file_name);
6241 /* Allocate the "who" array */
6242 C_MAKE(who, max_a_idx, s16b);
6244 /* Allocate the "okay" array */
6245 C_MAKE(okay, max_a_idx, bool);
6247 /* Scan the artifacts */
6248 for (k = 0; k < max_a_idx; k++)
6250 artifact_type *a_ptr = &a_info[k];
6255 /* Skip "empty" artifacts */
6256 if (!a_ptr->name) continue;
6258 /* Skip "uncreated" artifacts */
6259 if (!a_ptr->cur_num) continue;
6265 /* Check the dungeon */
6266 for (y = 0; y < cur_hgt; y++)
6268 for (x = 0; x < cur_wid; x++)
6270 cave_type *c_ptr = &cave[y][x];
6272 s16b this_o_idx, next_o_idx = 0;
6274 /* Scan all objects in the grid */
6275 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6279 /* Acquire object */
6280 o_ptr = &o_list[this_o_idx];
6282 /* Acquire next object */
6283 next_o_idx = o_ptr->next_o_idx;
6285 /* Ignore non-artifacts */
6286 if (!artifact_p(o_ptr)) continue;
6288 /* Ignore known items */
6289 if (object_known_p(o_ptr)) continue;
6291 /* Note the artifact */
6292 okay[o_ptr->name1] = FALSE;
6297 /* Check the inventory and equipment */
6298 for (i = 0; i < INVEN_TOTAL; i++)
6300 object_type *o_ptr = &inventory[i];
6302 /* Ignore non-objects */
6303 if (!o_ptr->k_idx) continue;
6305 /* Ignore non-artifacts */
6306 if (!artifact_p(o_ptr)) continue;
6308 /* Ignore known items */
6309 if (object_known_p(o_ptr)) continue;
6311 /* Note the artifact */
6312 okay[o_ptr->name1] = FALSE;
6315 for (k = 0; k < max_a_idx; k++)
6317 if (okay[k]) who[n++] = k;
6320 /* Select the sort method */
6321 ang_sort_comp = ang_sort_art_comp;
6322 ang_sort_swap = ang_sort_art_swap;
6324 /* Sort the array by dungeon depth of monsters */
6325 ang_sort(who, &why, n);
6327 /* Scan the artifacts */
6328 for (k = 0; k < n; k++)
6330 artifact_type *a_ptr = &a_info[who[k]];
6334 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6336 strcpy(base_name, "Unknown Artifact");
6340 /* Obtain the base object type */
6341 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6349 /* Get local object */
6352 /* Create fake object */
6353 object_prep(q_ptr, z);
6355 /* Make it an artifact */
6356 q_ptr->name1 = (byte)who[k];
6358 /* Display as if known */
6359 q_ptr->ident |= IDENT_STORE;
6361 /* Describe the artifact */
6362 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6365 /* Hack -- Build the artifact name */
6367 fprintf(fff, " %s\n", base_name);
6369 fprintf(fff, " The %s\n", base_name);
6374 /* Free the "who" array */
6375 C_KILL(who, max_a_idx, s16b);
6377 /* Free the "okay" array */
6378 C_KILL(okay, max_a_idx, bool);
6380 /* Close the file */
6383 /* Display the file contents */
6385 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6387 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6391 /* Remove the file */
6397 * Display known uniques
6399 static void do_cmd_knowledge_uniques(void)
6407 char file_name[1024];
6409 /* Open a new file */
6410 fff = my_fopen_temp(file_name, 1024);
6414 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6416 msg_format("Failed to create temporary file %s.", file_name);
6422 /* Allocate the "who" array */
6423 C_MAKE(who, max_r_idx, s16b);
6425 /* Scan the monsters */
6426 for (i = 1; i < max_r_idx; i++)
6428 monster_race *r_ptr = &r_info[i];
6430 /* Use that monster */
6431 if (r_ptr->name) who[n++] = i;
6434 /* Select the sort method */
6435 ang_sort_comp = ang_sort_comp_hook;
6436 ang_sort_swap = ang_sort_swap_hook;
6438 /* Sort the array by dungeon depth of monsters */
6439 ang_sort(who, &why, n);
6441 /* Scan the monster races */
6442 for (k = 0; k < n; k++)
6444 monster_race *r_ptr = &r_info[who[k]];
6446 /* Only print Uniques */
6447 if (r_ptr->flags1 & (RF1_UNIQUE))
6449 bool dead = (r_ptr->max_num == 0);
6453 /* Only display "known" uniques */
6454 if (dead || cheat_know || r_ptr->r_sights)
6456 /* Print a message */
6458 fprintf(fff, " %s¤Ï¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¡£\n",
6459 (r_name + r_ptr->name));
6461 fprintf(fff, " %s is alive\n",
6462 (r_name + r_ptr->name));
6469 /* Free the "who" array */
6470 C_KILL(who, max_r_idx, s16b);
6472 /* Close the file */
6475 /* Display the file contents */
6477 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6479 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6483 /* Remove the file */
6489 * Display weapon-exp
6491 static void do_cmd_knowledge_weapon_exp(void)
6493 int i, j, num, weapon_exp;
6497 char file_name[1024];
6500 /* Open a new file */
6501 fff = my_fopen_temp(file_name, 1024);
6504 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6506 msg_format("Failed to create temporary file %s.", file_name);
6512 for (i = 0; i < 5; i++)
6514 for (num = 0; num < 64; num++)
6516 for (j = 0; j < max_k_idx; j++)
6518 object_kind *k_ptr = &k_info[j];
6520 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6522 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6524 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6526 fprintf(fff, "%-25s ", tmp);
6527 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6528 else fprintf(fff, " ");
6529 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6530 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6538 /* Close the file */
6541 /* Display the file contents */
6543 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6545 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6549 /* Remove the file */
6557 static void do_cmd_knowledge_spell_exp(void)
6559 int i = 0, spell_exp, exp_level;
6564 char file_name[1024];
6566 /* Open a new file */
6567 fff = my_fopen_temp(file_name, 1024);
6570 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6572 msg_format("Failed to create temporary file %s.", file_name);
6578 if (p_ptr->realm1 != REALM_NONE)
6581 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6583 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6585 for (i = 0; i < 32; i++)
6587 if (!is_magic(p_ptr->realm1))
6589 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6593 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6595 if (s_ptr->slevel >= 99) continue;
6596 spell_exp = p_ptr->spell_exp[i];
6597 exp_level = spell_exp_level(spell_exp);
6598 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm1) - 1][i]);
6599 if (p_ptr->realm1 == REALM_HISSATSU)
6600 fprintf(fff, "[--]");
6603 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6604 else fprintf(fff, " ");
6605 fprintf(fff, "%s", exp_level_str[exp_level]);
6607 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6612 if (p_ptr->realm2 != REALM_NONE)
6615 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6617 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6619 for (i = 0; i < 32; i++)
6621 if (!is_magic(p_ptr->realm1))
6623 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6627 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6629 if (s_ptr->slevel >= 99) continue;
6631 spell_exp = p_ptr->spell_exp[i + 32];
6632 exp_level = spell_exp_level(spell_exp);
6633 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm2) - 1][i]);
6634 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6635 else fprintf(fff, " ");
6636 fprintf(fff, "%s", exp_level_str[exp_level]);
6637 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6642 /* Close the file */
6645 /* Display the file contents */
6647 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6649 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6653 /* Remove the file */
6661 static void do_cmd_knowledge_skill_exp(void)
6663 int i = 0, skill_exp;
6667 char file_name[1024];
6669 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6671 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6674 /* Open a new file */
6675 fff = my_fopen_temp(file_name, 1024);
6678 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6680 msg_format("Failed to create temporary file %s.", file_name);
6686 for (i = 0; i < 3; i++)
6688 skill_exp = p_ptr->skill_exp[i];
6689 fprintf(fff, "%-20s ", skill_name[i]);
6690 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6691 else fprintf(fff, " ");
6692 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6693 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6697 /* Close the file */
6700 /* Display the file contents */
6702 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6704 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6708 /* Remove the file */
6714 * Pluralize a monster name
6716 void plural_aux(char *Name)
6718 int NameLen = strlen(Name);
6720 if (my_strstr(Name, "Disembodied hand"))
6722 strcpy(Name, "Disembodied hands that strangled people");
6724 else if (my_strstr(Name, "Colour out of space"))
6726 strcpy(Name, "Colours out of space");
6728 else if (my_strstr(Name, "stairway to hell"))
6730 strcpy(Name, "stairways to hell");
6732 else if (my_strstr(Name, "Dweller on the threshold"))
6734 strcpy(Name, "Dwellers on the threshold");
6736 else if (my_strstr(Name, " of "))
6738 cptr aider = my_strstr(Name, " of ");
6749 if (dummy[i-1] == 's')
6751 strcpy(&(dummy[i]), "es");
6756 strcpy(&(dummy[i]), "s");
6759 strcpy(&(dummy[i+1]), aider);
6760 strcpy(Name, dummy);
6762 else if (my_strstr(Name, "coins"))
6765 strcpy(dummy, "piles of ");
6766 strcat(dummy, Name);
6767 strcpy(Name, dummy);
6770 else if (my_strstr(Name, "Manes"))
6774 else if (streq(&(Name[NameLen - 2]), "ey"))
6776 strcpy(&(Name[NameLen - 2]), "eys");
6778 else if (Name[NameLen - 1] == 'y')
6780 strcpy(&(Name[NameLen - 1]), "ies");
6782 else if (streq(&(Name[NameLen - 4]), "ouse"))
6784 strcpy(&(Name[NameLen - 4]), "ice");
6786 else if (streq(&(Name[NameLen - 2]), "us"))
6788 strcpy(&(Name[NameLen - 2]), "i");
6790 else if (streq(&(Name[NameLen - 6]), "kelman"))
6792 strcpy(&(Name[NameLen - 6]), "kelmen");
6794 else if (streq(&(Name[NameLen - 8]), "wordsman"))
6796 strcpy(&(Name[NameLen - 8]), "wordsmen");
6798 else if (streq(&(Name[NameLen - 7]), "oodsman"))
6800 strcpy(&(Name[NameLen - 7]), "oodsmen");
6802 else if (streq(&(Name[NameLen - 7]), "eastman"))
6804 strcpy(&(Name[NameLen - 7]), "eastmen");
6806 else if (streq(&(Name[NameLen - 8]), "izardman"))
6808 strcpy(&(Name[NameLen - 8]), "izardmen");
6810 else if (streq(&(Name[NameLen - 5]), "geist"))
6812 strcpy(&(Name[NameLen - 5]), "geister");
6814 else if (streq(&(Name[NameLen - 2]), "ex"))
6816 strcpy(&(Name[NameLen - 2]), "ices");
6818 else if (streq(&(Name[NameLen - 2]), "lf"))
6820 strcpy(&(Name[NameLen - 2]), "lves");
6822 else if (suffix(Name, "ch") ||
6823 suffix(Name, "sh") ||
6824 suffix(Name, "nx") ||
6825 suffix(Name, "s") ||
6828 strcpy(&(Name[NameLen]), "es");
6832 strcpy(&(Name[NameLen]), "s");
6837 * Display current pets
6839 static void do_cmd_knowledge_pets(void)
6843 monster_type *m_ptr;
6846 int show_upkeep = 0;
6847 char file_name[1024];
6850 /* Open a new file */
6851 fff = my_fopen_temp(file_name, 1024);
6854 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6856 msg_format("Failed to create temporary file %s.", file_name);
6862 /* Process the monsters (backwards) */
6863 for (i = m_max - 1; i >= 1; i--)
6865 /* Access the monster */
6868 /* Ignore "dead" monsters */
6869 if (!m_ptr->r_idx) continue;
6871 /* Calculate "upkeep" for pets */
6875 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6876 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
6880 show_upkeep = calculate_upkeep();
6882 fprintf(fff, "----------------------------------------------\n");
6884 fprintf(fff, " ¹ç·×: %d ɤ¤Î¥Ú¥Ã¥È\n", t_friends);
6885 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
6887 fprintf(fff, " Total: %d pet%s.\n",
6888 t_friends, (t_friends == 1 ? "" : "s"));
6889 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
6894 /* Close the file */
6897 /* Display the file contents */
6899 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
6901 show_file(TRUE, file_name, "Current Pets", 0, 0);
6905 /* Remove the file */
6913 * Note that the player ghosts are ignored. XXX XXX XXX
6915 static void do_cmd_knowledge_kill_count(void)
6923 char file_name[1024];
6928 /* Open a new file */
6929 fff = my_fopen_temp(file_name, 1024);
6933 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6935 msg_format("Failed to create temporary file %s.", file_name);
6941 /* Allocate the "who" array */
6942 C_MAKE(who, max_r_idx, s16b);
6945 /* Monsters slain */
6948 for (kk = 1; kk < max_r_idx; kk++)
6950 monster_race *r_ptr = &r_info[kk];
6952 if (r_ptr->flags1 & (RF1_UNIQUE))
6954 bool dead = (r_ptr->max_num == 0);
6963 s16b This = r_ptr->r_pkills;
6974 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
6976 fprintf(fff,"You have defeated no enemies yet.\n\n");
6979 else if (Total == 1)
6981 fprintf(fff,"¤¢¤Ê¤¿¤Ï°ìɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n");
6983 fprintf(fff,"You have defeated one enemy.\n\n");
6988 fprintf(fff,"¤¢¤Ê¤¿¤Ï %lu ɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
6990 fprintf(fff,"You have defeated %lu enemies.\n\n", Total);
6997 /* Scan the monsters */
6998 for (i = 1; i < max_r_idx; i++)
7000 monster_race *r_ptr = &r_info[i];
7002 /* Use that monster */
7003 if (r_ptr->name) who[n++] = i;
7006 /* Select the sort method */
7007 ang_sort_comp = ang_sort_comp_hook;
7008 ang_sort_swap = ang_sort_swap_hook;
7010 /* Sort the array by dungeon depth of monsters */
7011 ang_sort(who, &why, n);
7013 /* Scan the monster races */
7014 for (k = 0; k < n; k++)
7016 monster_race *r_ptr = &r_info[who[k]];
7018 if (r_ptr->flags1 & (RF1_UNIQUE))
7020 bool dead = (r_ptr->max_num == 0);
7024 /* Print a message */
7025 fprintf(fff, " %s\n",
7026 (r_name + r_ptr->name));
7032 s16b This = r_ptr->r_pkills;
7037 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita*/
7038 if(my_strchr("pt",r_ptr->d_char))
7039 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7041 fprintf(fff, " %3d ɤ¤Î %s\n", This, r_name + r_ptr->name);
7045 if (my_strstr(r_name + r_ptr->name, "coins"))
7047 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7051 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7057 strcpy(ToPlural, (r_name + r_ptr->name));
7058 plural_aux(ToPlural);
7059 fprintf(fff, " %d %s\n", This, ToPlural);
7069 fprintf(fff,"----------------------------------------------\n");
7071 fprintf(fff," ¹ç·×: %lu ɤ¤òÅݤ·¤¿¡£\n", Total);
7073 fprintf(fff," Total: %lu creature%s killed.\n",
7074 Total, (Total == 1 ? "" : "s"));
7078 /* Free the "who" array */
7079 C_KILL(who, max_r_idx, s16b);
7081 /* Close the file */
7084 /* Display the file contents */
7086 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7088 show_file(TRUE, file_name, "Kill Count", 0, 0);
7092 /* Remove the file */
7098 * Display the object groups.
7100 static void display_group_list(int col, int row, int wid, int per_page,
7101 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7105 /* Display lines until done */
7106 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7108 /* Get the group index */
7109 int grp = grp_idx[grp_top + i];
7111 /* Choose a color */
7112 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7114 /* Erase the entire line */
7115 Term_erase(col, row + i, wid);
7117 /* Display the group label */
7118 c_put_str(attr, group_text[grp], row + i, col);
7124 * Move the cursor in a browser window
7126 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7127 int *list_cur, int list_cnt)
7132 int list = *list_cur;
7134 /* Extract direction */
7137 /* Hack -- scroll up full screen */
7142 /* Hack -- scroll down full screen */
7147 d = get_keymap_dir(ch);
7152 /* Diagonals - hack */
7153 if ((ddx[d] > 0) && ddy[d])
7159 Term_get_size(&wid, &hgt);
7161 browser_rows = hgt - 8;
7163 /* Browse group list */
7168 /* Move up or down */
7169 grp += ddy[d] * (browser_rows - 1);
7172 if (grp >= grp_cnt) grp = grp_cnt - 1;
7173 if (grp < 0) grp = 0;
7174 if (grp != old_grp) list = 0;
7177 /* Browse sub-list list */
7180 /* Move up or down */
7181 list += ddy[d] * browser_rows;
7184 if (list >= list_cnt) list = list_cnt - 1;
7185 if (list < 0) list = 0;
7197 if (col < 0) col = 0;
7198 if (col > 1) col = 1;
7205 /* Browse group list */
7210 /* Move up or down */
7214 if (grp >= grp_cnt) grp = grp_cnt - 1;
7215 if (grp < 0) grp = 0;
7216 if (grp != old_grp) list = 0;
7219 /* Browse sub-list list */
7222 /* Move up or down */
7226 if (list >= list_cnt) list = list_cnt - 1;
7227 if (list < 0) list = 0;
7238 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7242 /* Clear the display lines */
7243 for (i = 0; i < height; i++)
7245 Term_erase(col, row + i, width);
7248 /* Bigtile mode uses double width */
7249 if (use_bigtile) width /= 2;
7251 /* Display lines until done */
7252 for (i = 0; i < height; i++)
7254 /* Display columns until done */
7255 for (j = 0; j < width; j++)
7263 /* Bigtile mode uses double width */
7264 if (use_bigtile) x += j;
7269 /* Ignore illegal characters */
7270 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7271 (!use_graphics && ic > 0x7f))
7277 /* Force correct code for both ASCII character and tile */
7278 if (c & 0x80) a |= 0x80;
7280 /* Display symbol */
7281 Term_queue_bigchar(x, y, a, c, 0, 0);
7288 * Place the cursor at the collect position for visual mode
7290 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7292 int i = (a & 0x7f) - attr_top;
7293 int j = c - char_left;
7298 /* Bigtile mode uses double width */
7299 if (use_bigtile) x += j;
7301 /* Place the cursor */
7307 * Clipboard variables for copy&paste in visual mode
7309 static byte attr_idx = 0;
7310 static byte char_idx = 0;
7313 * Do visual mode command -- Change symbols
7315 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7316 int height, int width,
7317 byte *attr_top_ptr, byte *char_left_ptr,
7318 byte *cur_attr_ptr, byte *cur_char_ptr)
7320 static byte attr_old = 0, char_old = 0;
7325 if (*visual_list_ptr)
7328 *cur_attr_ptr = attr_old;
7329 *cur_char_ptr = char_old;
7330 *visual_list_ptr = FALSE;
7339 if (*visual_list_ptr)
7342 *visual_list_ptr = FALSE;
7350 if (!*visual_list_ptr)
7352 *visual_list_ptr = TRUE;
7354 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7355 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7357 attr_old = *cur_attr_ptr;
7358 char_old = *cur_char_ptr;
7366 /* Set the visual */
7367 attr_idx = *cur_attr_ptr;
7368 char_idx = *cur_char_ptr;
7377 *cur_attr_ptr = attr_idx;
7378 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7384 *cur_char_ptr = char_idx;
7385 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7391 if (*visual_list_ptr)
7394 int d = get_keymap_dir(ch);
7395 byte a = (*cur_attr_ptr & 0x7f);
7396 byte c = *cur_char_ptr;
7398 if (use_bigtile) eff_width = width / 2;
7399 else eff_width = width;
7401 /* Restrict direction */
7402 if ((a == 0) && (ddy[d] < 0)) d = 0;
7403 if ((c == 0) && (ddx[d] < 0)) d = 0;
7404 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7405 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7410 /* Force correct code for both ASCII character and tile */
7411 if (c & 0x80) a |= 0x80;
7413 /* Set the visual */
7418 /* Move the frame */
7419 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7420 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7421 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7422 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7429 /* Visual mode command is not used */
7435 * Display the monsters in a group.
7437 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7438 int mon_cur, int mon_top)
7442 /* Display lines until done */
7443 for (i = 0; i < per_page && mon_idx[mon_top + i]; i++)
7447 /* Get the race index */
7448 int r_idx = mon_idx[mon_top + i] ;
7450 /* Access the race */
7451 monster_race *r_ptr = &r_info[r_idx];
7454 /* Choose a color */
7455 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7457 /* Display the name */
7458 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7460 /* Hack -- visual_list mode */
7463 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, 60);
7465 else if (p_ptr->wizard)
7467 c_prt(attr, format("%d", r_idx), row + i, 60);
7470 /* Display symbol */
7471 Term_queue_bigchar(70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7475 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7477 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 73);
7479 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "dead" : "alive"), row + i, 73);
7484 /* Clear remaining lines */
7485 for (; i < per_page; i++)
7487 Term_erase(col, row + i, 255);
7493 * Display known monsters.
7495 static void do_cmd_knowledge_monsters(void)
7498 int grp_cur, grp_top, old_grp_cur;
7499 int mon_cur, mon_top;
7500 int grp_cnt, grp_idx[100];
7508 bool visual_list = FALSE;
7509 byte attr_top = 0, char_left = 0;
7515 Term_get_size(&wid, &hgt);
7517 browser_rows = hgt - 8;
7519 /* Allocate the "mon_idx" array */
7520 C_MAKE(mon_idx, max_r_idx, s16b);
7525 /* Check every group */
7526 for (i = 0; monster_group_text[i] != NULL; i++)
7528 /* Measure the label */
7529 len = strlen(monster_group_text[i]);
7531 /* Save the maximum length */
7532 if (len > max) max = len;
7534 /* See if any monsters are known */
7535 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, 0x01))
7537 /* Build a list of groups with known monsters */
7538 grp_idx[grp_cnt++] = i;
7542 /* Terminate the list */
7543 grp_idx[grp_cnt] = -1;
7546 grp_cur = grp_top = 0;
7547 mon_cur = mon_top = 0;
7556 monster_race *r_ptr;
7563 prt("Ãμ± - ¥â¥ó¥¹¥¿¡¼", 2, 0);
7564 prt("¥°¥ë¡¼¥×", 4, 0);
7565 prt("̾Á°", 4, max + 3);
7566 if (p_ptr->wizard) prt("Idx", 4, 60);
7567 prt("ʸ»ú »¦³²¿ô", 4, 67);
7569 prt("Knowledge - Monsters", 2, 0);
7571 prt("Name", 4, max + 3);
7572 if (p_ptr->wizard) prt("Idx", 4, 60);
7573 prt("Sym Kills", 4, 67);
7576 for (i = 0; i < 78; i++)
7578 Term_putch(i, 5, TERM_WHITE, '=');
7581 for (i = 0; i < browser_rows; i++)
7583 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7589 /* Scroll group list */
7590 if (grp_cur < grp_top) grp_top = grp_cur;
7591 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7593 /* Display a list of monster groups */
7594 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7596 if (old_grp_cur != grp_cur)
7598 old_grp_cur = grp_cur;
7600 /* Get a list of monsters in the current group */
7601 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, 0x00);
7604 /* Scroll monster list */
7605 while (mon_cur < mon_top)
7606 mon_top = MAX(0, mon_top - browser_rows/2);
7607 while (mon_cur >= mon_top + browser_rows)
7608 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7612 /* Display a list of monsters in the current group */
7613 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top);
7619 /* Display a monster name */
7620 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top);
7622 /* Display visual list below first monster */
7623 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7628 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
7630 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);
7633 /* Get the current monster */
7634 r_ptr = &r_info[mon_idx[mon_cur]];
7636 /* Mega Hack -- track this monster race */
7637 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7639 /* Hack -- handle stuff */
7644 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7648 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7652 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7657 /* Do visual mode command if needed */
7658 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;
7671 /* Recall on screen */
7672 if (mon_idx[mon_cur])
7674 screen_roff(mon_idx[mon_cur], 0);
7685 /* Move the cursor */
7686 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
7693 /* Free the "mon_idx" array */
7694 C_KILL(mon_idx, max_r_idx, s16b);
7699 * Display the objects in a group.
7701 static void display_object_list(int col, int row, int per_page, int object_idx[],
7702 int object_cur, int object_top)
7706 /* Display lines until done */
7707 for (i = 0; i < per_page && object_idx[object_top + i]; i++)
7712 /* Get the object index */
7713 int k_idx = object_idx[object_top + i];
7715 /* Access the object */
7716 object_kind *k_ptr = &k_info[k_idx];
7718 /* Choose a color */
7719 byte attr = (k_ptr->aware ? TERM_WHITE : TERM_SLATE);
7720 byte cursor = (k_ptr->aware ? TERM_L_BLUE : TERM_BLUE);
7722 attr = ((i + object_top == object_cur) ? cursor : attr);
7725 strip_name(o_name, k_idx);
7727 /* Display the name */
7728 c_prt(attr, o_name, row + i, col);
7730 /* Hack -- visual_list mode */
7733 c_prt(attr, format("%02x/%02x", k_ptr->x_attr, k_ptr->x_char), row + i, 60);
7735 else if (p_ptr->wizard)
7737 c_prt(attr, format ("%d", k_idx), row + i, 70);
7740 a = k_ptr->flavor ? misc_to_attr[k_ptr->flavor] : k_ptr->x_attr;
7741 c = k_ptr->flavor ? misc_to_char[k_ptr->flavor] : k_ptr->x_char;
7743 /* Symbol is unknown */
7744 if (!k_ptr->aware && !p_ptr->wizard)
7750 /* Display symbol */
7751 Term_queue_bigchar(76, row + i, a, c, 0, 0);
7754 /* Clear remaining lines */
7755 for (; i < per_page; i++)
7757 Term_erase(col, row + i, 255);
7762 * Describe fake object
7764 static void desc_obj_fake(int k_idx)
7767 object_type object_type_body;
7769 /* Get local object */
7770 o_ptr = &object_type_body;
7772 /* Wipe the object */
7775 /* Create the artifact */
7776 object_prep(o_ptr, k_idx);
7778 /* It's fully know */
7779 o_ptr->ident |= IDENT_KNOWN;
7781 /* Track the object */
7782 /* object_actual_track(o_ptr); */
7784 /* Hack - mark as fake */
7785 /* term_obj_real = FALSE; */
7787 /* Hack -- Handle stuff */
7790 if (!screen_object(o_ptr, FALSE))
7793 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
7795 msg_print("You see nothing special.");
7804 * Display known objects
7806 static void do_cmd_knowledge_objects(void)
7809 int grp_cur, grp_top, old_grp_cur;
7810 int object_old, object_cur, object_top;
7811 int grp_cnt, grp_idx[100];
7819 bool visual_list = FALSE;
7820 byte attr_top = 0, char_left = 0;
7826 Term_get_size(&wid, &hgt);
7828 browser_rows = hgt - 8;
7830 /* Allocate the "object_idx" array */
7831 C_MAKE(object_idx, max_k_idx, int);
7836 /* Check every group */
7837 for (i = 0; object_group_text[i] != NULL; i++)
7839 /* Measure the label */
7840 len = strlen(object_group_text[i]);
7842 /* Save the maximum length */
7843 if (len > max) max = len;
7845 /* See if any monsters are known */
7846 if (collect_objects(i, object_idx))
7848 /* Build a list of groups with known monsters */
7849 grp_idx[grp_cnt++] = i;
7853 /* Terminate the list */
7854 grp_idx[grp_cnt] = -1;
7857 grp_cur = grp_top = 0;
7858 object_cur = object_top = 0;
7875 prt("Ãμ± - ¥¢¥¤¥Æ¥à", 2, 0);
7876 prt("¥°¥ë¡¼¥×", 4, 0);
7877 prt("̾Á°", 4, max + 3);
7878 if (p_ptr->wizard) prt("Idx", 4, 70);
7881 prt("Knowledge - objects", 2, 0);
7883 prt("Name", 4, max + 3);
7884 if (p_ptr->wizard) prt("Idx", 4, 70);
7888 for (i = 0; i < 78; i++)
7890 Term_putch(i, 5, TERM_WHITE, '=');
7893 for (i = 0; i < browser_rows; i++)
7895 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7901 /* Scroll group list */
7902 if (grp_cur < grp_top) grp_top = grp_cur;
7903 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7905 /* Display a list of object groups */
7906 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
7908 if (old_grp_cur != grp_cur)
7910 old_grp_cur = grp_cur;
7912 /* Get a list of objects in the current group */
7913 object_cnt = collect_objects(grp_idx[grp_cur], object_idx);
7916 /* Scroll object list */
7917 while (object_cur < object_top)
7918 object_top = MAX(0, object_top - browser_rows/2);
7919 while (object_cur >= object_top + browser_rows)
7920 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
7924 /* Display a list of objects in the current group */
7925 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top);
7929 object_top = object_cur;
7931 /* Display a list of objects in the current group */
7932 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top);
7934 /* Display visual list below first object */
7935 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7938 /* Get the current object */
7939 k_ptr = &k_info[object_idx[object_cur]];
7941 /* Mega Hack -- track this object */
7942 if (object_cnt) object_kind_track(object_idx[object_cur]);
7946 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
7948 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);
7951 /* The "current" object changed */
7952 if (object_old != object_idx[object_cur])
7954 /* Hack -- handle stuff */
7957 /* Remember the "current" object */
7958 object_old = object_idx[object_cur];
7963 place_visual_list_cursor(max + 3, 7, k_ptr->x_attr, k_ptr->x_char, attr_top, char_left);
7967 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7971 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
7976 /* Do visual mode command if needed */
7977 /* Symbol of objects with flavor cannot be changed */
7978 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;
7991 /* Recall on screen */
7993 desc_obj_fake(object_idx[object_cur]);
8001 /* Move the cursor */
8002 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8008 /* Free the "object_idx" array */
8009 C_KILL(object_idx, max_k_idx, int);
8015 * Display the features in a group.
8017 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8018 int feat_cur, int feat_top)
8022 /* Display lines until done */
8023 for (i = 0; i < per_page && feat_idx[feat_top + i]; i++)
8028 int f_idx = feat_idx[feat_top + i];
8030 /* Access the index */
8031 feature_type *f_ptr = &f_info[f_idx];
8033 /* Choose a color */
8034 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8036 /* Display the name */
8037 c_prt(attr, f_name + f_ptr->name, row + i, col);
8039 /* Hack -- visual_list mode */
8042 c_prt(attr, format("%02x/%02x", f_ptr->x_attr, f_ptr->x_char), row + i, 60);
8045 /* Display symbol */
8046 Term_queue_bigchar(68, row + i, f_ptr->x_attr, f_ptr->x_char, 0, 0);
8049 /* Clear remaining lines */
8050 for (; i < per_page; i++)
8052 Term_erase(col, row + i, 255);
8058 * Interact with feature visuals.
8060 static void do_cmd_knowledge_features(void)
8063 int grp_cur, grp_top, old_grp_cur;
8064 int feat_cur, feat_top;
8065 int grp_cnt, grp_idx[100];
8073 bool visual_list = FALSE;
8074 byte attr_top = 0, char_left = 0;
8080 Term_get_size(&wid, &hgt);
8082 browser_rows = hgt - 8;
8084 /* Allocate the "feat_idx" array */
8085 C_MAKE(feat_idx, max_f_idx, int);
8090 /* Check every group */
8091 for (i = 0; feature_group_text[i] != NULL; i++)
8093 /* Measure the label */
8094 len = strlen(feature_group_text[i]);
8096 /* Save the maximum length */
8097 if (len > max) max = len;
8099 /* See if any features are known */
8100 if (collect_features(i, feat_idx))
8102 /* Build a list of groups with known features */
8103 grp_idx[grp_cnt++] = i;
8107 /* Terminate the list */
8108 grp_idx[grp_cnt] = -1;
8111 grp_cur = grp_top = 0;
8112 feat_cur = feat_top = 0;
8118 while ((!flag) && (grp_cnt))
8121 feature_type *f_ptr;
8127 prt("Visuals - features", 2, 0);
8129 prt("Name", 4, max + 3);
8132 for (i = 0; i < 78; i++)
8134 Term_putch(i, 5, TERM_WHITE, '=');
8137 for (i = 0; i < browser_rows; i++)
8139 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8145 /* Scroll group list */
8146 if (grp_cur < grp_top) grp_top = grp_cur;
8147 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8149 /* Display a list of feature groups */
8150 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8152 if (old_grp_cur != grp_cur)
8154 old_grp_cur = grp_cur;
8156 /* Get a list of features in the current group */
8157 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx);
8160 /* Scroll feature list */
8161 while (feat_cur < feat_top)
8162 feat_top = MAX(0, feat_top - browser_rows/2);
8163 while (feat_cur >= feat_top + browser_rows)
8164 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8168 /* Display a list of features in the current group */
8169 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top);
8173 feat_top = feat_cur;
8175 /* Display a list of features in the current group */
8176 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top);
8178 /* Display visual list below first object */
8179 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8184 prt(format("<Êý¸þ>%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8186 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);
8189 /* Get the current feature */
8190 f_ptr = &f_info[feat_idx[feat_cur]];
8194 place_visual_list_cursor(max + 3, 7, f_ptr->x_attr, f_ptr->x_char, attr_top, char_left);
8198 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8202 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8207 /* Do visual mode command if needed */
8208 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;
8220 /* Move the cursor */
8221 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8228 if (!grp_cnt) msg_print("No features known.");
8230 /* Free the "feat_idx" array */
8231 C_KILL(feat_idx, max_f_idx, int);
8236 * List wanted monsters
8238 static void do_cmd_knowledge_kubi(void)
8243 char file_name[1024];
8246 /* Open a new file */
8247 fff = my_fopen_temp(file_name, 1024);
8250 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8252 msg_format("Failed to create temporary file %s.", file_name);
8260 bool listed = FALSE;
8263 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8265 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8267 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8269 fprintf(fff, "List of wanted monsters\n");
8271 fprintf(fff, "----------------------------------------------\n");
8273 for (i = 0; i < MAX_KUBI; i++)
8275 if (kubi_r_idx[i] <= 10000)
8277 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8286 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
8288 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
8293 /* Close the file */
8296 /* Display the file contents */
8298 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8300 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8304 /* Remove the file */
8309 * List virtues & status
8311 static void do_cmd_knowledge_virtues(void)
8315 char file_name[1024];
8318 /* Open a new file */
8319 fff = my_fopen_temp(file_name, 1024);
8322 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8324 msg_format("Failed to create temporary file %s.", file_name);
8333 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8335 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8340 /* Close the file */
8343 /* Display the file contents */
8345 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8347 show_file(TRUE, file_name, "Virtues", 0, 0);
8351 /* Remove the file */
8359 static void do_cmd_knowledge_dungeon(void)
8363 char file_name[1024];
8367 /* Open a new file */
8368 fff = my_fopen_temp(file_name, 1024);
8371 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8373 msg_format("Failed to create temporary file %s.", file_name);
8381 for (i = 1; i < max_d_idx; i++)
8385 if (!d_info[i].maxdepth) continue;
8386 if (!max_dlv[i]) continue;
8387 if (d_info[i].final_guardian)
8389 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8391 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8393 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8395 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8400 /* Close the file */
8403 /* Display the file contents */
8405 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
8407 show_file(TRUE, file_name, "Dungeon", 0, 0);
8411 /* Remove the file */
8416 * List virtues & status
8419 static void do_cmd_knowledge_stat(void)
8423 char file_name[1024];
8426 /* Open a new file */
8427 fff = my_fopen_temp(file_name, 1024);
8430 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8432 msg_format("Failed to create temporary file %s.", file_name);
8440 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
8441 (2 * p_ptr->hitdie +
8442 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
8445 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
8446 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
8447 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
8449 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
8450 else fprintf(fff, "Your current Life Rating is ???.\n\n");
8451 fprintf(fff, "Limits of maximum stats\n\n");
8453 for (v_nr = 0; v_nr < 6; v_nr++)
8455 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);
8456 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
8462 /* Close the file */
8465 /* Display the file contents */
8467 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
8469 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
8473 /* Remove the file */
8479 * Print all active quests
8481 static void do_cmd_knowledge_quests_current(FILE *fff)
8484 char rand_tmp_str[120] = "\0";
8486 monster_race *r_ptr;
8488 int rand_level = 100;
8492 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
8494 fprintf(fff, "< Current Quest >\n");
8497 for (i = 1; i < max_quests; i++)
8499 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
8501 /* Set the quest number temporary */
8502 int old_quest = p_ptr->inside_quest;
8505 /* Clear the text */
8506 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
8507 quest_text_line = 0;
8509 p_ptr->inside_quest = i;
8511 /* Get the quest text */
8512 init_flags = INIT_SHOW_TEXT;
8514 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8516 /* Reset the old quest number */
8517 p_ptr->inside_quest = old_quest;
8519 /* No info from "silent" quests */
8520 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8524 if (quest[i].type != QUEST_TYPE_RANDOM)
8526 char note[80] = "\0";
8528 if (quest[i].status == QUEST_STATUS_TAKEN)
8530 switch (quest[i].type)
8532 case QUEST_TYPE_KILL_LEVEL:
8533 case QUEST_TYPE_KILL_ANY_LEVEL:
8534 r_ptr = &r_info[quest[i].r_idx];
8535 strcpy(name, r_name + r_ptr->name);
8536 if (quest[i].max_num > 1)
8539 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
8540 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
8543 sprintf(note," - kill %d %s, have killed %d.",
8544 quest[i].max_num, name, quest[i].cur_num);
8549 sprintf(note," - %s¤òÅݤ¹¡£",name);
8551 sprintf(note," - kill %s.",name);
8555 case QUEST_TYPE_FIND_ARTIFACT:
8556 strcpy(name, a_name + a_info[quest[i].k_idx].name);
8558 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
8560 sprintf(note," - Find out %s.", name);
8564 case QUEST_TYPE_FIND_EXIT:
8566 sprintf(note," - õº÷¤¹¤ë¡£");
8568 sprintf(note," - Search.");
8572 case QUEST_TYPE_KILL_NUMBER:
8574 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
8575 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
8577 sprintf(note," - Kill %d monsters, have killed %d.",
8578 quest[i].max_num, quest[i].cur_num);
8582 case QUEST_TYPE_KILL_ALL:
8584 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
8586 sprintf(note," - Kill all monsters.");
8592 /* Print the quest info */
8594 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
8595 quest[i].name, quest[i].level, note);
8597 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
8598 quest[i].name, quest[i].level, note);
8601 fprintf(fff, tmp_str);
8603 if (quest[i].status == QUEST_STATUS_COMPLETED)
8606 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
8608 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
8610 fprintf(fff, tmp_str);
8616 while (quest_text[j][0] && j < 10)
8618 fprintf(fff, " %s\n", quest_text[j]);
8623 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
8626 rand_level = quest[i].level;
8628 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8630 /* Print the quest info */
8631 r_ptr = &r_info[quest[i].r_idx];
8632 strcpy(name, r_name + r_ptr->name);
8634 if (quest[i].max_num > 1)
8637 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
8638 quest[i].name, quest[i].level,
8639 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
8643 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8644 quest[i].name, quest[i].level,
8645 quest[i].max_num, name, quest[i].cur_num);
8651 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
8652 quest[i].name, quest[i].level, name);
8654 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
8655 quest[i].name, quest[i].level, name);
8663 /* Print the current random quest */
8664 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
8667 if (!total) fprintf(fff, " ¤Ê¤·\n");
8669 if (!total) fprintf(fff, " Nothing.\n");
8675 * Print all finished quests
8677 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
8684 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8686 fprintf(fff, "< Completed Quest >\n");
8688 for (i = 1; i < max_quests; i++)
8690 int q_idx = quest_num[i];
8692 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
8694 if (is_fixed_quest_idx(q_idx))
8696 /* Set the quest number temporary */
8697 int old_quest = p_ptr->inside_quest;
8699 p_ptr->inside_quest = q_idx;
8702 init_flags = INIT_ASSIGN;
8704 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8706 /* Reset the old quest number */
8707 p_ptr->inside_quest = old_quest;
8709 /* No info from "silent" quests */
8710 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
8715 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
8717 /* Print the quest info */
8719 if (quest[q_idx].complev == 0)
8723 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
8725 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
8727 r_name+r_info[quest[q_idx].r_idx].name,
8728 quest[q_idx].level);
8734 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
8736 " %-40s (Dungeon level: %3d) - level %2d\n",
8738 r_name+r_info[quest[q_idx].r_idx].name,
8740 quest[q_idx].complev);
8745 /* Print the quest info */
8747 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
8748 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8750 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
8751 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8755 fprintf(fff, tmp_str);
8759 if (!total) fprintf(fff, " ¤Ê¤·\n");
8761 if (!total) fprintf(fff, " Nothing.\n");
8767 * Print all failed quests
8769 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
8776 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8778 fprintf(fff, "< Failed Quest >\n");
8780 for (i = 1; i < max_quests; i++)
8782 int q_idx = quest_num[i];
8784 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
8786 if (is_fixed_quest_idx(q_idx))
8788 /* Set the quest number temporary */
8789 int old_quest = p_ptr->inside_quest;
8791 p_ptr->inside_quest = q_idx;
8793 /* Get the quest text */
8794 init_flags = INIT_ASSIGN;
8796 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8798 /* Reset the old quest number */
8799 p_ptr->inside_quest = old_quest;
8801 /* No info from "silent" quests */
8802 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
8807 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
8809 /* Print the quest info */
8811 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
8812 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
8814 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
8815 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
8820 /* Print the quest info */
8822 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
8823 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8825 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
8826 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8829 fprintf(fff, tmp_str);
8833 if (!total) fprintf(fff, " ¤Ê¤·\n");
8835 if (!total) fprintf(fff, " Nothing.\n");
8841 * Print all random quests
8843 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
8850 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
8852 fprintf(fff, "< Remaining Random Quest >\n");
8854 for (i = 1; i < max_quests; i++)
8856 /* No info from "silent" quests */
8857 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8859 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8863 /* Print the quest info */
8865 sprintf(tmp_str, " %s (%d³¬, %s)\n",
8866 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8868 sprintf(tmp_str, " %s (%d, %s)\n",
8869 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8871 fprintf(fff, tmp_str);
8875 if (!total) fprintf(fff, " ¤Ê¤·\n");
8877 if (!total) fprintf(fff, " Nothing.\n");
8882 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
8884 int *q_num = (int *)u;
8885 quest_type *qa = &quest[q_num[a]];
8886 quest_type *qb = &quest[q_num[b]];
8891 if (qa->complev < qb->complev) return TRUE;
8892 if (qa->complev > qb->complev) return FALSE;
8893 if (qa->level <= qb->level) return TRUE;
8897 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
8899 int *q_num = (int *)u;
8906 q_num[a] = q_num[b];
8912 * Print quest status of all active quests
8914 static void do_cmd_knowledge_quests(void)
8917 char file_name[1024];
8918 int *quest_num, dummy, i;
8920 /* Open a new file */
8921 fff = my_fopen_temp(file_name, 1024);
8925 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8927 msg_format("Failed to create temporary file %s.", file_name);
8933 /* Allocate Memory */
8934 C_MAKE(quest_num, max_quests, int);
8936 /* Sort by compete level */
8937 for (i = 1; i < max_quests; i++) quest_num[i] = i;
8938 ang_sort_comp = ang_sort_comp_quest_num;
8939 ang_sort_swap = ang_sort_swap_quest_num;
8940 ang_sort(quest_num, &dummy, max_quests);
8942 /* Dump Quest Information */
8943 do_cmd_knowledge_quests_current(fff);
8945 do_cmd_knowledge_quests_completed(fff, quest_num);
8947 do_cmd_knowledge_quests_failed(fff, quest_num);
8951 do_cmd_knowledge_quests_wiz_random(fff);
8954 /* Close the file */
8957 /* Display the file contents */
8959 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
8961 show_file(TRUE, file_name, "Quest status", 0, 0);
8964 /* Remove the file */
8968 C_KILL(quest_num, max_quests, int);
8975 static void do_cmd_knowledge_home(void)
8980 char file_name[1024];
8982 char o_name[MAX_NLEN];
8985 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
8987 /* Open a new file */
8988 fff = my_fopen_temp(file_name, 1024);
8991 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8993 msg_format("Failed to create temporary file %s.", file_name);
9001 /* Print all homes in the different towns */
9002 st_ptr = &town[1].store[STORE_HOME];
9004 /* Home -- if anything there */
9005 if (st_ptr->stock_num)
9010 /* Header with name of the town */
9012 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9014 fprintf(fff, " [Home Inventory]\n");
9017 /* Dump all available items */
9018 for (i = 0; i < st_ptr->stock_num; i++)
9021 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9022 object_desc(o_name, &st_ptr->stock[i], 0);
9023 if (strlen(o_name) <= 80-3)
9025 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9031 for (n = 0, t = o_name; n < 80-3; n++, t++)
9032 if(iskanji(*t)) {t++; n++;}
9033 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9035 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9036 fprintf(fff, " %.77s\n", o_name+n);
9039 object_desc(o_name, &st_ptr->stock[i], 0);
9040 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9045 /* Add an empty line */
9046 fprintf(fff, "\n\n");
9050 /* Close the file */
9053 /* Display the file contents */
9055 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9057 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9061 /* Remove the file */
9067 * Check the status of "autopick"
9069 static void do_cmd_knowledge_autopick(void)
9073 char file_name[1024];
9075 /* Open a new file */
9076 fff = my_fopen_temp(file_name, 1024);
9081 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9083 msg_format("Failed to create temporary file %s.", file_name);
9092 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9094 fprintf(fff, "No preference for auto picker/destroyer.");
9100 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9102 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9106 for (k = 0; k < max_autopick; k++)
9109 byte act = autopick_list[k].action;
9110 if (act & DONT_AUTOPICK)
9118 else if (act & DO_AUTODESTROY)
9126 else if (act & DO_AUTOPICK)
9134 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9143 if (act & DO_DISPLAY)
9144 fprintf(fff, "%11s", format("[%s]", tmp));
9146 fprintf(fff, "%11s", format("(%s)", tmp));
9148 tmp = autopick_line_from_entry(&autopick_list[k]);
9149 fprintf(fff, " %s", tmp);
9153 /* Close the file */
9155 /* Display the file contents */
9157 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9159 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9162 /* Remove the file */
9168 * Interact with "knowledge"
9170 void do_cmd_knowledge(void)
9173 /* File type is "TEXT" */
9174 FILE_TYPE(FILE_TYPE_TEXT);
9175 /* Save the screen */
9177 /* Interact until done */
9182 /* Ask for a choice */
9184 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9185 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9187 prt(format("page %d/2", (p+1)), 2, 65);
9188 prt("Display current knowledge", 3, 0);
9191 /* Give some choices */
9194 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9195 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9196 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9197 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9198 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9199 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9200 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9201 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9202 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9203 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9205 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9206 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9207 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9208 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9209 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9210 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9211 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9212 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9213 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9217 prt("(1) Display known artifacts", 6, 5);
9218 prt("(2) Display known objects", 7, 5);
9219 prt("(3) Display remaining uniques", 8, 5);
9220 prt("(4) Display known monster", 9, 5);
9221 prt("(5) Display kill count", 10, 5);
9222 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9223 prt("(7) Display current pets", 12, 5);
9224 prt("(8) Display home inventory", 13, 5);
9225 prt("(9) Display *identified* equip.", 14, 5);
9226 prt("(0) Display terrain symbols.", 15, 5);
9228 prt("(a) Display about yourself", 6, 5);
9229 prt("(b) Display mutations", 7, 5);
9230 prt("(c) Display weapon proficiency", 8, 5);
9231 prt("(d) Display spell proficiency", 9, 5);
9232 prt("(e) Display misc. proficiency", 10, 5);
9233 prt("(f) Display virtues", 11, 5);
9234 prt("(g) Display dungeons", 12, 5);
9235 prt("(h) Display current quests", 13, 5);
9236 prt("(i) Display auto pick/destroy", 14, 5);
9241 prt("-³¤¯-", 17, 8);
9242 prt("ESC) È´¤±¤ë", 21, 1);
9243 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9244 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9245 prt("¥³¥Þ¥ó¥É:", 20, 0);
9247 prt("-more-", 17, 8);
9248 prt("ESC) Exit menu", 21, 1);
9249 prt("SPACE) Next page", 21, 30);
9250 /*prt("-) Previous page", 21, 60);*/
9251 prt("Command: ", 20, 0);
9257 if (i == ESCAPE) break;
9260 case ' ': /* Page change */
9264 case '1': /* Artifacts */
9265 do_cmd_knowledge_artifacts();
9267 case '2': /* Objects */
9268 do_cmd_knowledge_objects();
9270 case '3': /* Uniques */
9271 do_cmd_knowledge_uniques();
9273 case '4': /* Monsters */
9274 do_cmd_knowledge_monsters();
9276 case '5': /* Kill count */
9277 do_cmd_knowledge_kill_count();
9279 case '6': /* wanted */
9280 if (!vanilla_town) do_cmd_knowledge_kubi();
9282 case '7': /* Pets */
9283 do_cmd_knowledge_pets();
9285 case '8': /* Home */
9286 do_cmd_knowledge_home();
9288 case '9': /* Resist list */
9289 do_cmd_knowledge_inven();
9291 case '0': /* Feature list */
9292 do_cmd_knowledge_features();
9295 case 'a': /* Max stat */
9296 do_cmd_knowledge_stat();
9298 case 'b': /* Mutations */
9299 do_cmd_knowledge_mutations();
9301 case 'c': /* weapon-exp */
9302 do_cmd_knowledge_weapon_exp();
9304 case 'd': /* spell-exp */
9305 do_cmd_knowledge_spell_exp();
9307 case 'e': /* skill-exp */
9308 do_cmd_knowledge_skill_exp();
9310 case 'f': /* Virtues */
9311 do_cmd_knowledge_virtues();
9313 case 'g': /* Dungeon */
9314 do_cmd_knowledge_dungeon();
9316 case 'h': /* Quests */
9317 do_cmd_knowledge_quests();
9319 case 'i': /* Autopick */
9320 do_cmd_knowledge_autopick();
9322 default: /* Unknown option */
9325 /* Flush messages */
9328 /* Restore the screen */
9334 * Check on the status of an active quest
9336 void do_cmd_checkquest(void)
9338 /* File type is "TEXT" */
9339 FILE_TYPE(FILE_TYPE_TEXT);
9341 /* Save the screen */
9345 do_cmd_knowledge_quests();
9347 /* Restore the screen */
9353 * Display the time and date
9355 void do_cmd_time(void)
9357 int day, hour, min, full, start, end, num;
9364 extract_day_hour_min(&day, &hour, &min);
9366 full = hour * 100 + min;
9374 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9376 strcpy(desc, "It is a strange time.");
9382 msg_format("%d ÆüÌÜ,»þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
9383 day, (hour % 12 == 0) ? 12 : (hour % 12),
9384 min, (hour < 12) ? "AM" : "PM");
9386 msg_format("This is day %d. The time is %d:%02d %s.",
9387 day, (hour % 12 == 0) ? 12 : (hour % 12),
9388 min, (hour < 12) ? "AM" : "PM");
9393 if (!randint0(10) || p_ptr->image)
9396 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
9398 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
9405 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
9407 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
9412 /* Open this file */
9413 fff = my_fopen(buf, "rt");
9418 /* Find this time */
9419 while (!my_fgets(fff, buf, sizeof(buf)))
9421 /* Ignore comments */
9422 if (!buf[0] || (buf[0] == '#')) continue;
9424 /* Ignore invalid lines */
9425 if (buf[1] != ':') continue;
9427 /* Process 'Start' */
9430 /* Extract the starting time */
9431 start = atoi(buf + 2);
9433 /* Assume valid for an hour */
9443 /* Extract the ending time */
9444 end = atoi(buf + 2);
9450 /* Ignore incorrect range */
9451 if ((start > full) || (full > end)) continue;
9453 /* Process 'Description' */
9458 /* Apply the randomizer */
9459 if (!randint0(num)) strcpy(desc, buf + 2);
9469 /* Close the file */