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 if (day < MAX_DAYS) fprintf(fff, "%dÆüÌÜ\n", day);
465 else fputs("*****ÆüÌÜ\n", fff);
467 if (day < MAX_DAYS) fprintf(fff, "Day %d\n", day);
468 else fputs("Day *****\n", fff);
477 fprintf(fff, "%s\n",note);
481 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
487 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
489 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
496 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
498 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
502 case NIKKI_FIX_QUEST_C:
504 if (quest[num].flags & QUEST_FLAG_SILENT) break;
506 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
508 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
512 case NIKKI_FIX_QUEST_F:
514 if (quest[num].flags & QUEST_FLAG_SILENT) break;
516 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
518 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
522 case NIKKI_RAND_QUEST_C:
525 strcpy(name, r_name+r_info[quest[num].r_idx].name);
527 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
529 fprintf(fff, " %2d:%02d %20s completed random quest '%s'\n", hour, min, note_level, name);
533 case NIKKI_RAND_QUEST_F:
536 strcpy(name, r_name+r_info[quest[num].r_idx].name);
538 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
540 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
544 case NIKKI_MAXDEAPTH:
547 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
549 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);
556 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
558 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);
565 if (q_idx && (is_fixed_quest_idx(q_idx)
566 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
577 if (!(dun_level+num)) to = "ÃϾå";
578 else to = format("%d³¬", dun_level+num);
580 if (!(dun_level+num)) to = "the surface";
581 else to = format("level %d", dun_level+num);
586 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
588 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
596 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
598 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);
602 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
604 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
610 if (quest[num].flags & QUEST_FLAG_SILENT) break;
612 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
614 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
621 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
623 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
630 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
632 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
639 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
641 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
650 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, -num, note);
653 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));
658 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
660 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, get_ordinal_number_suffix(num), note);
662 if (num == MAX_ARENA_MONS)
665 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
667 fprintf(fff, " won all fight to become a Chanpion.\n");
676 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
678 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
693 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
695 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
699 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
701 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
716 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
718 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
722 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
724 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
731 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
733 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
737 case NIKKI_GAMESTART:
739 time_t ct = time((time_t*)0);
743 fprintf(fff, "%s %s",note, ctime(&ct));
746 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
749 case NIKKI_NAMED_PET:
751 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
756 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
758 fprintf(fff, "decided to travel together with %s.\n", note);
763 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
765 fprintf(fff, "unnamed %s.\n", note);
770 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
772 fprintf(fff, "dismissed %s.\n", note);
777 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
779 fprintf(fff, "%s died.\n", note);
784 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
786 fprintf(fff, "moved to another map leaving %s behind.\n", note);
791 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
793 fprintf(fff, "lost sight of %s.\n", note);
798 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
800 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
805 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
807 fprintf(fff, "%s was crushed by falling rocks.\n", note);
812 fprintf(fff, "%s¤¬¥Æ¥ì¥Ý¡¼¥È¡¦¥ì¥Ù¥ë¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
814 fprintf(fff, "%s was made disappeared by teleport level.\n", note);
829 if (do_level) write_level = FALSE;
835 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
837 static void do_cmd_disp_nikki(void)
839 char nikki_title[256];
844 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
845 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
856 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
857 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
858 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
859 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
864 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
873 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
875 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
876 "Attack is the best form of defence.",
878 "An unexpected windfall",
879 "A drowning man will catch at a straw",
880 "Don't count your chickens before they are hatched.",
881 "It is no use crying over spilt milk.",
882 "Seeing is believing.",
883 "Strike the iron while it is hot.",
884 "I don't care what follows.",
885 "To dig a well to put out a house on fire.",
886 "Tomorrow is another day.",
887 "Easy come, easy go.",
888 "The more haste, the less speed.",
889 "Where there is life, there is hope.",
890 "There is no royal road to *WINNER*.",
891 "Danger past, God forgotten.",
892 "The best thing to do now is to run away.",
893 "Life is but an empty dream.",
894 "Dead men tell no tales.",
895 "A book that remains shut is but a block.",
896 "Misfortunes never come singly.",
897 "A little knowledge is a dangerous thing.",
898 "History repeats itself.",
899 "*WINNER* was not built in a day.",
900 "Ignorance is bliss.",
901 "To lose is to win?",
902 "No medicine can cure folly.",
903 "All good things come to an end.",
904 "M$ Empire strikes back.",
905 "To see is to believe",
907 "Quest of The World's Greatest Brain"};
910 sprintf(file_name,"playrecord-%s.txt",savefile_base);
912 sprintf(file_name,"playrec-%s.txt",savefile_base);
915 /* Build the filename */
916 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
918 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
919 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
920 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
921 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
922 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
925 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
926 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
928 sprintf(nikki_title, "Legend of %s %s '%s'",
929 ap_ptr->title, player_name, tmp);
932 /* Display the file contents */
933 show_file(FALSE, buf, nikki_title, -1, 0);
936 static void do_cmd_bunshou(void)
939 char bunshou[80] = "\0";
942 if (get_string("ÆâÍÆ: ", tmp, 79))
944 if (get_string("diary note: ", tmp, 79))
947 strcpy(bunshou, tmp);
949 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
953 static void do_cmd_last_get(void)
958 if (record_o_name[0] == '\0') return;
961 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
963 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
965 if (!get_check(buf)) return;
970 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
972 sprintf(buf,"descover %s.", record_o_name);
974 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
978 static void do_cmd_erase_nikki(void)
985 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
987 if (!get_check("Do you really want to delete all your record? ")) return;
991 sprintf(file_name,"playrecord-%s.txt",savefile_base);
993 sprintf(file_name,"playrec-%s.txt",savefile_base);
996 /* Build the filename */
997 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
999 /* Remove the file */
1002 fff = my_fopen(buf, "w");
1006 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
1008 msg_format("deleted record.");
1012 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1014 msg_format("failed to delete %s.", buf);
1021 void do_cmd_nikki(void)
1025 /* File type is "TEXT" */
1026 FILE_TYPE(FILE_TYPE_TEXT);
1028 /* Save the screen */
1031 /* Interact until done */
1037 /* Ask for a choice */
1039 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1041 prt("[ Play Record ]", 2, 0);
1045 /* Give some choices */
1047 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1048 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1049 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1050 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1052 prt("(1) Display your record", 4, 5);
1053 prt("(2) Add record", 5, 5);
1054 prt("(3) Record item you last get/identify", 6, 5);
1055 prt("(4) Delete your record", 7, 5);
1061 prt("¥³¥Þ¥ó¥É:", 18, 0);
1063 prt("Command: ", 18, 0);
1071 if (i == ESCAPE) break;
1076 do_cmd_disp_nikki();
1085 do_cmd_erase_nikki();
1087 default: /* Unknown option */
1091 /* Flush messages */
1095 /* Restore the screen */
1100 * Hack -- redraw the screen
1102 * This command performs various low level updates, clears all the "extra"
1103 * windows, does a total redraw of the main window, and requests all of the
1104 * interesting updates and redraws that I can think of.
1106 * This command is also used to "instantiate" the results of the user
1107 * selecting various things, such as graphics mode, so it must call
1108 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1110 void do_cmd_redraw(void)
1117 /* Hack -- react to changes */
1118 Term_xtra(TERM_XTRA_REACT, 0);
1121 /* Combine and Reorder the pack (later) */
1122 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1126 p_ptr->update |= (PU_TORCH);
1129 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1131 /* Forget lite/view */
1132 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1134 /* Update lite/view */
1135 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1137 /* Update monsters */
1138 p_ptr->update |= (PU_MONSTERS);
1140 /* Redraw everything */
1141 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1144 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1147 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1151 /* Hack -- update */
1154 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1157 /* Redraw every window */
1158 for (j = 0; j < 8; j++)
1161 if (!angband_term[j]) continue;
1164 Term_activate(angband_term[j]);
1179 * Hack -- change name
1181 void do_cmd_change_name(void)
1190 /* Save the screen */
1198 /* Display the player */
1199 display_player(mode);
1204 display_player(mode);
1209 Term_putstr(2, 23, -1, TERM_WHITE,
1210 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1212 Term_putstr(2, 23, -1, TERM_WHITE,
1213 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1221 if (c == ESCAPE) break;
1228 /* Process the player name */
1229 process_player_name(FALSE);
1235 sprintf(tmp, "%s.txt", player_base);
1237 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1239 if (get_string("File name: ", tmp, 80))
1243 if (tmp[0] && (tmp[0] != ' '))
1245 file_character(tmp);
1262 /* Flush messages */
1266 /* Restore the screen */
1269 /* Redraw everything */
1270 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1277 * Recall the most recent message
1279 void do_cmd_message_one(void)
1281 /* Recall one message XXX XXX XXX */
1282 prt(format("> %s", message_str(0)), 0, 0);
1287 * Show previous messages to the user -BEN-
1289 * The screen format uses line 0 and 23 for headers and prompts,
1290 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1292 * This command shows you which commands you are viewing, and allows
1293 * you to "search" for strings in the recall.
1295 * Note that messages may be longer than 80 characters, but they are
1296 * displayed using "infinite" length, with a special sub-command to
1297 * "slide" the virtual display to the left or right.
1299 * Attempt to only hilite the matching portions of the string.
1301 void do_cmd_messages(int num_now)
1311 Term_get_size(&wid, &hgt);
1313 /* Number of message lines in a screen */
1314 num_lines = hgt - 4;
1323 /* Total messages */
1326 /* Start on first message */
1329 /* Save the screen */
1335 /* Process requests until done */
1341 /* Dump up to 20 lines of messages */
1342 for (j = 0; (j < num_lines) && (i + j < n); j++)
1344 cptr msg = message_str(i+j);
1346 /* Dump the messages, bottom to top */
1347 c_prt((i+j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1349 /* Hilite "shower" */
1354 /* Display matches */
1355 while ((str = my_strstr(str, shower)) != NULL)
1357 int len = strlen(shower);
1359 /* Display the match */
1360 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1368 /* Erase remaining lines */
1369 for (; j < num_lines; j++)
1371 Term_erase(0, num_lines + 1 - j, 255);
1374 /* Display header XXX XXX XXX */
1377 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1378 i, i+j-1, n), 0, 0);
1380 prt(format("Message Recall (%d-%d of %d)",
1381 i, i+j-1, n), 0, 0);
1385 /* Display prompt (not very informative) */
1387 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1389 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1394 skey = inkey_special(TRUE);
1396 /* Exit on Escape */
1397 if (skey == ESCAPE) break;
1399 /* Hack -- Save the old index */
1402 /* Hack -- handle show */
1407 prt("¶¯Ä´: ", hgt - 1, 0);
1409 prt("Show: ", hgt - 1, 0);
1413 /* Get a "shower" string, or continue */
1414 if (!askfor(shower, 80)) continue;
1420 /* Hack -- handle find */
1421 if (skey == '/' || skey == KTRL('s'))
1427 prt("¸¡º÷: ", hgt - 1, 0);
1429 prt("Find: ", hgt - 1, 0);
1433 /* Get a "finder" string, or continue */
1434 if (!askfor(finder, 80)) continue;
1437 strcpy(shower, finder);
1440 for (z = i + 1; z < n; z++)
1442 cptr msg = message_str(z);
1445 if (my_strstr(msg, finder))
1456 /* Recall 1 older message */
1457 if (skey == SKEY_TOP)
1459 /* Go to the oldest line */
1463 /* Recall 1 newer message */
1464 if (skey == SKEY_BOTTOM)
1466 /* Go to the newest line */
1470 /* Recall 1 older message */
1471 if (skey == '8' || skey == SKEY_UP || skey == '\n' || skey == '\r')
1473 /* Go older if legal */
1474 i = MIN(i + 1, n - num_lines);
1477 /* Recall 10 older messages */
1480 /* Go older if legal */
1481 i = MIN(i + 10, n - num_lines);
1484 /* Recall 20 older messages */
1485 if (skey == 'p' || skey == KTRL('P') || skey == ' ' || skey == SKEY_PGUP)
1487 /* Go older if legal */
1488 i = MIN(i + num_lines, n - num_lines);
1491 /* Recall 20 newer messages */
1492 if (skey == 'n' || skey == KTRL('N') || skey == SKEY_PGDOWN)
1494 /* Go newer (if able) */
1495 i = MAX(0, i - num_lines);
1498 /* Recall 10 newer messages */
1501 /* Go newer (if able) */
1505 /* Recall 1 newer messages */
1506 if (skey == '2' || skey == SKEY_DOWN)
1508 /* Go newer (if able) */
1512 /* Hack -- Error of some kind */
1516 /* Restore the screen */
1523 * Number of cheating options
1530 static option_type cheat_info[CHEAT_MAX] =
1532 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1534 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1536 "cheat_peek", "Peek into object creation"
1540 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1542 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1544 "cheat_hear", "Peek into monster creation"
1548 { &cheat_room, FALSE, 255, 0x04, 0x00,
1550 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1552 "cheat_room", "Peek into dungeon creation"
1556 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1558 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1560 "cheat_xtra", "Peek into something else"
1564 { &cheat_know, FALSE, 255, 0x10, 0x00,
1566 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1568 "cheat_know", "Know complete monster info"
1572 { &cheat_live, FALSE, 255, 0x20, 0x00,
1574 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1576 "cheat_live", "Allow player to avoid death"
1580 { &cheat_save, FALSE, 255, 0x40, 0x00,
1582 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1584 "cheat_save", "Ask for saving death"
1590 * Interact with some options for cheating
1592 static void do_cmd_options_cheat(cptr info)
1596 int i, k = 0, n = CHEAT_MAX;
1604 /* Interact with the player */
1609 /* Prompt XXX XXX XXX */
1611 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1613 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1619 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1620 prt(" << Ãí°Õ >>", 11, 0);
1621 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1622 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1623 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1625 /* Display the options */
1626 for (i = 0; i < n; i++)
1628 byte a = TERM_WHITE;
1630 /* Color current option */
1631 if (i == k) a = TERM_L_BLUE;
1633 /* Display the option text */
1634 sprintf(buf, "%-48s: %s (%s)",
1635 cheat_info[i].o_desc,
1637 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1639 (*cheat_info[i].o_var ? "yes" : "no "),
1642 cheat_info[i].o_text);
1643 c_prt(a, buf, i + 2, 0);
1646 /* Hilite current option */
1647 move_cursor(k + 2, 50);
1653 * HACK - Try to translate the key into a direction
1654 * to allow using the roguelike keys for navigation.
1656 dir = get_keymap_dir(ch);
1657 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1671 k = (n + k - 1) % n;
1690 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1692 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1694 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1695 (*cheat_info[k].o_var) = TRUE;
1704 (*cheat_info[k].o_var) = FALSE;
1712 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1714 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1716 /* Peruse the help file */
1717 (void)show_file(TRUE, buf, NULL, 0, 0);
1733 static option_type autosave_info[2] =
1735 { &autosave_l, FALSE, 255, 0x01, 0x00,
1737 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1739 "autosave_l", "Autosave when entering new levels" },
1743 { &autosave_t, FALSE, 255, 0x02, 0x00,
1745 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1747 "autosave_t", "Timed autosave" },
1753 static s16b toggle_frequency(s16b current)
1758 case 50: return 100;
1759 case 100: return 250;
1760 case 250: return 500;
1761 case 500: return 1000;
1762 case 1000: return 2500;
1763 case 2500: return 5000;
1764 case 5000: return 10000;
1765 case 10000: return 25000;
1772 * Interact with some options for cheating
1774 static void do_cmd_options_autosave(cptr info)
1778 int i, k = 0, n = 2;
1786 /* Interact with the player */
1789 /* Prompt XXX XXX XXX */
1791 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1793 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1798 /* Display the options */
1799 for (i = 0; i < n; i++)
1801 byte a = TERM_WHITE;
1803 /* Color current option */
1804 if (i == k) a = TERM_L_BLUE;
1806 /* Display the option text */
1807 sprintf(buf, "%-48s: %s (%s)",
1808 autosave_info[i].o_desc,
1810 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1812 (*autosave_info[i].o_var ? "yes" : "no "),
1815 autosave_info[i].o_text);
1816 c_prt(a, buf, i + 2, 0);
1820 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1822 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1827 /* Hilite current option */
1828 move_cursor(k + 2, 50);
1844 k = (n + k - 1) % n;
1862 (*autosave_info[k].o_var) = TRUE;
1871 (*autosave_info[k].o_var) = FALSE;
1879 autosave_freq = toggle_frequency(autosave_freq);
1881 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1882 autosave_freq), 5, 0);
1884 prt(format("Timed autosave frequency: every %d turns",
1885 autosave_freq), 5, 0);
1893 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1895 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1914 * Interact with some options
1916 void do_cmd_options_aux(int page, cptr info)
1919 int i, k = 0, n = 0, l;
1922 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1923 (!p_ptr->wizard || !allow_debug_opts);
1926 /* Lookup the options */
1927 for (i = 0; i < 24; i++) opt[i] = 0;
1929 /* Scan the options */
1930 for (i = 0; option_info[i].o_desc; i++)
1932 /* Notice options on this "page" */
1933 if (option_info[i].o_page == page) opt[n++] = i;
1940 /* Interact with the player */
1945 /* Prompt XXX XXX XXX */
1947 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
1949 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
1955 /* HACK -- description for easy-auto-destroy options */
1957 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1959 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1962 /* Display the options */
1963 for (i = 0; i < n; i++)
1965 byte a = TERM_WHITE;
1967 /* Color current option */
1968 if (i == k) a = TERM_L_BLUE;
1970 /* Display the option text */
1971 sprintf(buf, "%-48s: %s (%.19s)",
1972 option_info[opt[i]].o_desc,
1974 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1976 (*option_info[opt[i]].o_var ? "yes" : "no "),
1979 option_info[opt[i]].o_text);
1980 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1981 else c_prt(a, buf, i + 2, 0);
1984 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1987 /* Hilite current option */
1988 move_cursor(k + 2 + l, 50);
1994 * HACK - Try to translate the key into a direction
1995 * to allow using the roguelike keys for navigation.
1997 dir = get_keymap_dir(ch);
1998 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2012 k = (n + k - 1) % n;
2029 if (browse_only) break;
2030 (*option_info[opt[k]].o_var) = TRUE;
2039 if (browse_only) break;
2040 (*option_info[opt[k]].o_var) = FALSE;
2048 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2055 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2057 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2059 /* Peruse the help file */
2060 (void)show_file(TRUE, buf, NULL, 0, 0);
2077 * Modify the "window" options
2079 static void do_cmd_options_win(void)
2093 /* Memorize old flags */
2094 for (j = 0; j < 8; j++)
2096 /* Acquire current flags */
2097 old_flag[j] = window_flag[j];
2107 /* Prompt XXX XXX XXX */
2109 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2111 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2115 /* Display the windows */
2116 for (j = 0; j < 8; j++)
2118 byte a = TERM_WHITE;
2120 cptr s = angband_term_name[j];
2123 if (j == x) a = TERM_L_BLUE;
2125 /* Window name, staggered, centered */
2126 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2129 /* Display the options */
2130 for (i = 0; i < 16; i++)
2132 byte a = TERM_WHITE;
2134 cptr str = window_flag_desc[i];
2137 if (i == y) a = TERM_L_BLUE;
2141 if (!str) str = "(̤»ÈÍÑ)";
2143 if (!str) str = "(Unused option)";
2148 Term_putstr(0, i + 5, -1, a, str);
2150 /* Display the windows */
2151 for (j = 0; j < 8; j++)
2153 byte a = TERM_WHITE;
2158 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2161 if (window_flag[j] & (1L << i)) c = 'X';
2164 Term_putch(35 + j * 5, i + 5, a, c);
2169 Term_gotoxy(35 + x * 5, y + 5);
2187 for (j = 0; j < 8; j++)
2189 window_flag[j] &= ~(1L << y);
2193 for (i = 0; i < 16; i++)
2195 window_flag[x] &= ~(1L << i);
2208 window_flag[x] |= (1L << y);
2216 window_flag[x] &= ~(1L << y);
2223 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2225 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2235 d = get_keymap_dir(ch);
2237 x = (x + ddx[d] + 8) % 8;
2238 y = (y + ddy[d] + 16) % 16;
2245 /* Notice changes */
2246 for (j = 0; j < 8; j++)
2251 if (!angband_term[j]) continue;
2253 /* Ignore non-changes */
2254 if (window_flag[j] == old_flag[j]) continue;
2257 Term_activate(angband_term[j]);
2274 * Set or unset various options.
2276 * The user must use the "Ctrl-R" command to "adapt" to changes
2277 * in any options which control "visual" aspects of the game.
2279 void do_cmd_options(void)
2284 /* Save the screen */
2293 /* Why are we here */
2295 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2297 prt("Options", 1, 0);
2301 /* Give some choices */
2303 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 2, 5);
2304 prt("(2) ¥Þ¥Ã¥×²èÌÌ ¥ª¥×¥·¥ç¥ó", 3, 5);
2305 prt("(3) ¥Æ¥¥¹¥Èɽ¼¨ ¥ª¥×¥·¥ç¥ó", 4, 5);
2306 prt("(4) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 5, 5);
2307 prt("(5) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 6, 5);
2308 prt("(6) ´Ê°×¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 7, 5);
2309 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 8, 5);
2311 /* Special choices */
2312 prt("(P) ¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 10, 5);
2313 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
2314 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
2315 prt("(M) ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
2316 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2318 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2320 prt("(1) Input Options", 2, 5);
2321 prt("(2) Map Screen Options", 3, 5);
2322 prt("(3) Text Display Options", 4, 5);
2323 prt("(4) Game-Play Options", 5, 5);
2324 prt("(5) Disturbance Options", 6, 5);
2325 prt("(6) Easy Auto-Destroyer Options", 7, 5);
2326 prt("(R) Play-record Options", 8, 5);
2327 /* Special choices */
2328 prt("(P) Auto-picker/destroyer editor", 10, 5);
2329 prt("(D) Base Delay Factor", 11, 5);
2330 prt("(H) Hitpoint Warning", 12, 5);
2331 prt("(M) Mana Color Threshold", 13, 5);
2332 prt("(A) Autosave Options", 14, 5);
2334 prt("(W) Window Flags", 15, 5);
2337 if (!p_ptr->wizard || !allow_debug_opts)
2341 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
2343 prt("(B) Birth Options (Browse Only)", 16, 5);
2350 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó", 16, 5);
2352 prt("(B) Birth Options", 16, 5);
2357 if (p_ptr->noscore || allow_debug_opts)
2361 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 17, 5);
2363 prt("(C) Cheating Options", 17, 5);
2370 prt("¥³¥Þ¥ó¥É:", 19, 0);
2372 prt("Command: ", 19, 0);
2380 if (k == ESCAPE) break;
2387 /* Process the general options */
2389 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2391 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2399 /* Process the general options */
2401 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "¥Þ¥Ã¥×²èÌÌ¥ª¥×¥·¥ç¥ó");
2403 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
2413 do_cmd_options_aux(OPT_PAGE_TEXT, "¥Æ¥¥¹¥Èɽ¼¨¥ª¥×¥·¥ç¥ó");
2415 do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
2425 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2427 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2437 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2439 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2449 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2451 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2456 /* Play-record Options */
2462 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2464 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2475 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2477 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2483 /* Cheating Options */
2486 if (!p_ptr->noscore && !allow_debug_opts)
2488 /* Cheat options are not permitted */
2495 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2497 do_cmd_options_cheat("Cheaters never win");
2507 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2509 do_cmd_options_autosave("Autosave");
2520 do_cmd_options_win();
2521 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2522 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2523 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2524 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2528 /* Auto-picker/destroyer editor */
2532 do_cmd_edit_autopick();
2536 /* Hack -- Delay Speed */
2542 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2544 prt("Command: Base Delay Factor", 19, 0);
2548 /* Get a new value */
2551 int msec = delay_factor * delay_factor * delay_factor;
2553 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2554 delay_factor, msec), 22, 0);
2556 prt(format("Current base delay factor: %d (%d msec)",
2557 delay_factor, msec), 22, 0);
2561 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2563 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2567 if (k == ESCAPE) break;
2571 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2573 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2577 else if (isdigit(k)) delay_factor = D2I(k);
2584 /* Hack -- hitpoint warning factor */
2590 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2592 prt("Command: Hitpoint Warning", 19, 0);
2596 /* Get a new value */
2600 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2601 hitpoint_warn), 22, 0);
2603 prt(format("Current hitpoint warning: %d0%%",
2604 hitpoint_warn), 22, 0);
2608 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2610 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2614 if (k == ESCAPE) break;
2618 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2620 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2624 else if (isdigit(k)) hitpoint_warn = D2I(k);
2631 /* Hack -- mana color factor */
2637 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2639 prt("Command: Mana Color Threshold", 19, 0);
2643 /* Get a new value */
2647 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2650 prt(format("Current mana color threshold: %d0%%",
2655 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2657 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2661 if (k == ESCAPE) break;
2665 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2667 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2671 else if (isdigit(k)) mana_warn = D2I(k);
2680 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2682 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2687 /* Unknown option */
2696 /* Flush messages */
2701 /* Restore the screen */
2704 /* Hack - Redraw equippy chars */
2705 p_ptr->redraw |= (PR_EQUIPPY);
2711 * Ask for a "user pref line" and process it
2713 * XXX XXX XXX Allow absolute file names?
2715 void do_cmd_pref(void)
2722 /* Ask for a "user pref command" */
2724 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2726 if (!get_string("Pref: ", buf, 80)) return;
2730 /* Process that pref command */
2731 (void)process_pref_file_command(buf);
2734 void do_cmd_reload_autopick(void)
2737 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2739 if (!get_check("Reload auto-pick preference file? ")) return;
2742 /* Load the file with messages */
2743 autopick_load_pref(TRUE);
2749 * Hack -- append all current macros to the given file
2751 static errr macro_dump(cptr fname)
2753 static cptr mark = "Macro Dump";
2759 /* Build the filename */
2760 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2762 /* File type is "TEXT" */
2763 FILE_TYPE(FILE_TYPE_TEXT);
2765 /* Append to the file */
2766 if (!open_auto_dump(buf, mark)) return (-1);
2770 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2772 auto_dump_printf("\n# Automatic macro dump\n\n");
2776 for (i = 0; i < macro__num; i++)
2778 /* Extract the action */
2779 ascii_to_text(buf, macro__act[i]);
2781 /* Dump the macro */
2782 auto_dump_printf("A:%s\n", buf);
2784 /* Extract the action */
2785 ascii_to_text(buf, macro__pat[i]);
2787 /* Dump normal macros */
2788 auto_dump_printf("P:%s\n", buf);
2791 auto_dump_printf("\n");
2803 * Hack -- ask for a "trigger" (see below)
2805 * Note the complex use of the "inkey()" function from "util.c".
2807 * Note that both "flush()" calls are extremely important.
2809 static void do_cmd_macro_aux(char *buf)
2819 /* Do not process macros */
2825 /* Read the pattern */
2831 /* Do not process macros */
2834 /* Do not wait for keys */
2837 /* Attempt to read a key */
2848 /* Convert the trigger */
2849 ascii_to_text(tmp, buf);
2851 /* Hack -- display the trigger */
2852 Term_addstr(-1, TERM_WHITE, tmp);
2859 * Hack -- ask for a keymap "trigger" (see below)
2861 * Note that both "flush()" calls are extremely important. This may
2862 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2864 static void do_cmd_macro_aux_keymap(char *buf)
2878 /* Convert to ascii */
2879 ascii_to_text(tmp, buf);
2881 /* Hack -- display the trigger */
2882 Term_addstr(-1, TERM_WHITE, tmp);
2891 * Hack -- append all keymaps to the given file
2893 static errr keymap_dump(cptr fname)
2895 static cptr mark = "Keymap Dump";
2904 if (rogue_like_commands)
2906 mode = KEYMAP_MODE_ROGUE;
2912 mode = KEYMAP_MODE_ORIG;
2916 /* Build the filename */
2917 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2919 /* File type is "TEXT" */
2920 FILE_TYPE(FILE_TYPE_TEXT);
2922 /* Append to the file */
2923 if (!open_auto_dump(buf, mark)) return -1;
2927 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2929 auto_dump_printf("\n# Automatic keymap dump\n\n");
2933 for (i = 0; i < 256; i++)
2937 /* Loop up the keymap */
2938 act = keymap_act[mode][i];
2940 /* Skip empty keymaps */
2943 /* Encode the key */
2946 ascii_to_text(key, buf);
2948 /* Encode the action */
2949 ascii_to_text(buf, act);
2951 /* Dump the macro */
2952 auto_dump_printf("A:%s\n", buf);
2953 auto_dump_printf("C:%d:%s\n", mode, key);
2966 * Interact with "macros"
2968 * Note that the macro "action" must be defined before the trigger.
2970 * Could use some helpful instructions on this page. XXX XXX XXX
2972 void do_cmd_macros(void)
2984 if (rogue_like_commands)
2986 mode = KEYMAP_MODE_ROGUE;
2992 mode = KEYMAP_MODE_ORIG;
2995 /* File type is "TEXT" */
2996 FILE_TYPE(FILE_TYPE_TEXT);
3003 /* Process requests until done */
3011 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3013 prt("Interact with Macros", 2, 0);
3018 /* Describe that action */
3020 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3022 prt("Current action (if any) shown below:", 20, 0);
3026 /* Analyze the current action */
3027 ascii_to_text(buf, macro__buf);
3029 /* Display the current action */
3035 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3037 prt("(1) Load a user pref file", 4, 5);
3042 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3043 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3044 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3045 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3046 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3047 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3048 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3049 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3050 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3052 prt("(2) Append macros to a file", 5, 5);
3053 prt("(3) Query a macro", 6, 5);
3054 prt("(4) Create a macro", 7, 5);
3055 prt("(5) Remove a macro", 8, 5);
3056 prt("(6) Append keymaps to a file", 9, 5);
3057 prt("(7) Query a keymap", 10, 5);
3058 prt("(8) Create a keymap", 11, 5);
3059 prt("(9) Remove a keymap", 12, 5);
3060 prt("(0) Enter a new action", 13, 5);
3063 #endif /* ALLOW_MACROS */
3067 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3069 prt("Command: ", 16, 0);
3077 if (i == ESCAPE) break;
3079 /* Load a 'macro' file */
3086 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3088 prt("Command: Load a user pref file", 16, 0);
3094 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3096 prt("File: ", 18, 0);
3100 /* Default filename */
3101 sprintf(tmp, "%s.prf", player_name);
3103 /* Ask for a file */
3104 if (!askfor(tmp, 80)) continue;
3106 /* Process the given filename */
3107 err = process_pref_file(tmp);
3111 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3113 msg_format("Loaded default '%s'.", tmp);
3120 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3122 msg_format("Failed to load '%s'!");
3128 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3130 msg_format("Loaded '%s'.", tmp);
3142 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3144 prt("Command: Append macros to a file", 16, 0);
3150 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3152 prt("File: ", 18, 0);
3156 /* Default filename */
3157 sprintf(tmp, "%s.prf", player_name);
3159 /* Ask for a file */
3160 if (!askfor(tmp, 80)) continue;
3162 /* Dump the macros */
3163 (void)macro_dump(tmp);
3167 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3169 msg_print("Appended macros.");
3181 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3183 prt("Command: Query a macro", 16, 0);
3189 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3191 prt("Trigger: ", 18, 0);
3195 /* Get a macro trigger */
3196 do_cmd_macro_aux(buf);
3198 /* Acquire action */
3199 k = macro_find_exact(buf);
3206 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3208 msg_print("Found no macro.");
3216 /* Obtain the action */
3217 strcpy(macro__buf, macro__act[k]);
3219 /* Analyze the current action */
3220 ascii_to_text(buf, macro__buf);
3222 /* Display the current action */
3227 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3229 msg_print("Found a macro.");
3235 /* Create a macro */
3240 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3242 prt("Command: Create a macro", 16, 0);
3248 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3250 prt("Trigger: ", 18, 0);
3254 /* Get a macro trigger */
3255 do_cmd_macro_aux(buf);
3262 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3264 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3269 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3271 prt("Action: ", 20, 0);
3275 /* Convert to text */
3276 ascii_to_text(tmp, macro__buf);
3278 /* Get an encoded action */
3279 if (askfor(tmp, 80))
3281 /* Convert to ascii */
3282 text_to_ascii(macro__buf, tmp);
3284 /* Link the macro */
3285 macro_add(buf, macro__buf);
3289 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3291 msg_print("Added a macro.");
3297 /* Remove a macro */
3302 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3304 prt("Command: Remove a macro", 16, 0);
3310 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3312 prt("Trigger: ", 18, 0);
3316 /* Get a macro trigger */
3317 do_cmd_macro_aux(buf);
3319 /* Link the macro */
3320 macro_add(buf, buf);
3324 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3326 msg_print("Removed a macro.");
3336 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3338 prt("Command: Append keymaps to a file", 16, 0);
3344 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3346 prt("File: ", 18, 0);
3350 /* Default filename */
3351 sprintf(tmp, "%s.prf", player_name);
3353 /* Ask for a file */
3354 if (!askfor(tmp, 80)) continue;
3356 /* Dump the macros */
3357 (void)keymap_dump(tmp);
3361 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3363 msg_print("Appended keymaps.");
3368 /* Query a keymap */
3375 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3377 prt("Command: Query a keymap", 16, 0);
3383 prt("²¡¤¹¥¡¼: ", 18, 0);
3385 prt("Keypress: ", 18, 0);
3389 /* Get a keymap trigger */
3390 do_cmd_macro_aux_keymap(buf);
3392 /* Look up the keymap */
3393 act = keymap_act[mode][(byte)(buf[0])];
3400 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3402 msg_print("Found no keymap.");
3410 /* Obtain the action */
3411 strcpy(macro__buf, act);
3413 /* Analyze the current action */
3414 ascii_to_text(buf, macro__buf);
3416 /* Display the current action */
3421 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3423 msg_print("Found a keymap.");
3429 /* Create a keymap */
3434 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3436 prt("Command: Create a keymap", 16, 0);
3442 prt("²¡¤¹¥¡¼: ", 18, 0);
3444 prt("Keypress: ", 18, 0);
3448 /* Get a keymap trigger */
3449 do_cmd_macro_aux_keymap(buf);
3456 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3458 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3463 prt("¹ÔÆ°: ", 20, 0);
3465 prt("Action: ", 20, 0);
3469 /* Convert to text */
3470 ascii_to_text(tmp, macro__buf);
3472 /* Get an encoded action */
3473 if (askfor(tmp, 80))
3475 /* Convert to ascii */
3476 text_to_ascii(macro__buf, tmp);
3478 /* Free old keymap */
3479 string_free(keymap_act[mode][(byte)(buf[0])]);
3481 /* Make new keymap */
3482 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3486 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3488 msg_print("Added a keymap.");
3494 /* Remove a keymap */
3499 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3501 prt("Command: Remove a keymap", 16, 0);
3507 prt("²¡¤¹¥¡¼: ", 18, 0);
3509 prt("Keypress: ", 18, 0);
3513 /* Get a keymap trigger */
3514 do_cmd_macro_aux_keymap(buf);
3516 /* Free old keymap */
3517 string_free(keymap_act[mode][(byte)(buf[0])]);
3519 /* Make new keymap */
3520 keymap_act[mode][(byte)(buf[0])] = NULL;
3524 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3526 msg_print("Removed a keymap.");
3531 /* Enter a new action */
3536 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3538 prt("Command: Enter a new action", 16, 0);
3546 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3548 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3553 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3555 prt("Action: ", 20, 0);
3558 /* Hack -- limit the value */
3561 /* Get an encoded action */
3562 if (!askfor(buf, 80)) continue;
3564 /* Extract an action */
3565 text_to_ascii(macro__buf, buf);
3568 #endif /* ALLOW_MACROS */
3577 /* Flush messages */
3586 static cptr lighting_level_str[F_LIT_MAX] =
3600 static bool cmd_visuals_aux(int i, int *num, int max)
3607 sprintf(str, "%d", *num);
3609 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3612 tmp = strtol(str, NULL, 0);
3613 if (tmp >= 0 && tmp < max)
3616 else if (isupper(i))
3617 *num = (*num + max - 1) % max;
3619 *num = (*num + 1) % max;
3624 static void print_visuals_menu(cptr choice_msg)
3627 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 1, 0);
3629 prt("Interact with Visuals", 1, 0);
3632 /* Give some choices */
3634 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3636 prt("(0) Load a user pref file", 3, 5);
3639 #ifdef ALLOW_VISUALS
3641 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3642 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3643 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3644 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3645 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3646 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3647 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3648 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3649 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3651 prt("(1) Dump monster attr/chars", 4, 5);
3652 prt("(2) Dump object attr/chars", 5, 5);
3653 prt("(3) Dump feature attr/chars", 6, 5);
3654 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3655 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3656 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3657 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3658 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3659 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3662 #endif /* ALLOW_VISUALS */
3665 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3667 prt("(R) Reset visuals", 13, 5);
3672 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3674 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3678 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3679 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3680 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3683 * Interact with "visuals"
3685 void do_cmd_visuals(void)
3690 bool need_redraw = FALSE;
3691 const char *empty_symbol = "<< ? >>";
3693 if (use_bigtile) empty_symbol = "<< ?? >>";
3695 /* File type is "TEXT" */
3696 FILE_TYPE(FILE_TYPE_TEXT);
3698 /* Save the screen */
3701 /* Interact until done */
3707 /* Ask for a choice */
3708 print_visuals_menu(NULL);
3714 if (i == ESCAPE) break;
3718 /* Load a 'pref' file */
3722 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3724 prt("Command: Load a user pref file", 15, 0);
3729 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3731 prt("File: ", 17, 0);
3734 /* Default filename */
3735 sprintf(tmp, "%s.prf", player_name);
3738 if (!askfor(tmp, 70)) continue;
3740 /* Process the given filename */
3741 (void)process_pref_file(tmp);
3746 #ifdef ALLOW_VISUALS
3748 /* Dump monster attr/chars */
3751 static cptr mark = "Monster attr/chars";
3755 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3757 prt("Command: Dump monster attr/chars", 15, 0);
3762 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3764 prt("File: ", 17, 0);
3767 /* Default filename */
3768 sprintf(tmp, "%s.prf", player_name);
3770 /* Get a filename */
3771 if (!askfor(tmp, 70)) continue;
3773 /* Build the filename */
3774 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3776 /* Append to the file */
3777 if (!open_auto_dump(buf, mark)) continue;
3781 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3783 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3787 for (i = 1; i < max_r_idx; i++)
3789 monster_race *r_ptr = &r_info[i];
3791 /* Skip non-entries */
3792 if (!r_ptr->name) continue;
3794 /* Dump a comment */
3795 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3797 /* Dump the monster attr/char info */
3798 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3799 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3807 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3809 msg_print("Dumped monster attr/chars.");
3815 /* Dump object attr/chars */
3818 static cptr mark = "Object attr/chars";
3822 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3824 prt("Command: Dump object attr/chars", 15, 0);
3829 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3831 prt("File: ", 17, 0);
3834 /* Default filename */
3835 sprintf(tmp, "%s.prf", player_name);
3837 /* Get a filename */
3838 if (!askfor(tmp, 70)) continue;
3840 /* Build the filename */
3841 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3843 /* Append to the file */
3844 if (!open_auto_dump(buf, mark)) continue;
3848 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3850 auto_dump_printf("\n# Object attr/char definitions\n\n");
3854 for (i = 1; i < max_k_idx; i++)
3857 object_kind *k_ptr = &k_info[i];
3859 /* Skip non-entries */
3860 if (!k_ptr->name) continue;
3865 strip_name(o_name, i);
3871 /* Prepare dummy object */
3872 object_prep(&forge, i);
3874 /* Get un-shuffled flavor name */
3875 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3878 /* Dump a comment */
3879 auto_dump_printf("# %s\n", o_name);
3881 /* Dump the object attr/char info */
3882 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3883 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3891 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3893 msg_print("Dumped object attr/chars.");
3899 /* Dump feature attr/chars */
3902 static cptr mark = "Feature attr/chars";
3906 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3908 prt("Command: Dump feature attr/chars", 15, 0);
3913 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3915 prt("File: ", 17, 0);
3918 /* Default filename */
3919 sprintf(tmp, "%s.prf", player_name);
3921 /* Get a filename */
3922 if (!askfor(tmp, 70)) continue;
3924 /* Build the filename */
3925 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3927 /* Append to the file */
3928 if (!open_auto_dump(buf, mark)) continue;
3932 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3934 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3938 for (i = 1; i < max_f_idx; i++)
3940 feature_type *f_ptr = &f_info[i];
3942 /* Skip non-entries */
3943 if (!f_ptr->name) continue;
3945 /* Skip mimiccing features */
3946 if (f_ptr->mimic != i) continue;
3948 /* Dump a comment */
3949 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3951 /* Dump the feature attr/char info */
3952 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3953 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3954 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3955 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3963 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3965 msg_print("Dumped feature attr/chars.");
3971 /* Modify monster attr/chars (numeric operation) */
3975 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
3977 static cptr choice_msg = "Change monster attr/chars";
3982 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
3984 prt(format("Command: %s", choice_msg), 15, 0);
3987 /* Hack -- query until done */
3990 monster_race *r_ptr = &r_info[r];
3994 byte da = r_ptr->d_attr;
3995 byte dc = r_ptr->d_char;
3996 byte ca = r_ptr->x_attr;
3997 byte cc = r_ptr->x_char;
3999 /* Label the object */
4001 Term_putstr(5, 17, -1, TERM_WHITE,
4002 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
4003 r, (r_name + r_ptr->name)));
4005 Term_putstr(5, 17, -1, TERM_WHITE,
4006 format("Monster = %d, Name = %-40.40s",
4007 r, (r_name + r_ptr->name)));
4010 /* Label the Default values */
4012 Term_putstr(10, 19, -1, TERM_WHITE,
4013 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4015 Term_putstr(10, 19, -1, TERM_WHITE,
4016 format("Default attr/char = %3u / %3u", da, dc));
4019 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4020 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4022 /* Label the Current values */
4024 Term_putstr(10, 20, -1, TERM_WHITE,
4025 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4027 Term_putstr(10, 20, -1, TERM_WHITE,
4028 format("Current attr/char = %3u / %3u", ca, cc));
4031 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4032 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4036 Term_putstr(0, 22, -1, TERM_WHITE,
4037 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4039 Term_putstr(0, 22, -1, TERM_WHITE,
4040 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4047 if (i == ESCAPE) break;
4049 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4050 else if (isupper(i)) c = 'a' + i - 'A';
4060 if (!cmd_visuals_aux(i, &r, max_r_idx))
4066 while (!r_info[r].name);
4070 t = (int)r_ptr->x_attr;
4071 (void)cmd_visuals_aux(i, &t, 256);
4072 r_ptr->x_attr = (byte)t;
4076 t = (int)r_ptr->x_char;
4077 (void)cmd_visuals_aux(i, &t, 256);
4078 r_ptr->x_char = (byte)t;
4082 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4086 print_visuals_menu(choice_msg);
4094 /* Modify object attr/chars (numeric operation) */
4098 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4100 static cptr choice_msg = "Change object attr/chars";
4105 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4107 prt(format("Command: %s", choice_msg), 15, 0);
4110 /* Hack -- query until done */
4113 object_kind *k_ptr = &k_info[k];
4117 byte da = k_ptr->d_attr;
4118 byte dc = k_ptr->d_char;
4119 byte ca = k_ptr->x_attr;
4120 byte cc = k_ptr->x_char;
4122 /* Label the object */
4124 Term_putstr(5, 17, -1, TERM_WHITE,
4125 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4126 k, (k_name + k_ptr->name)));
4128 Term_putstr(5, 17, -1, TERM_WHITE,
4129 format("Object = %d, Name = %-40.40s",
4130 k, (k_name + k_ptr->name)));
4133 /* Label the Default values */
4135 Term_putstr(10, 19, -1, TERM_WHITE,
4136 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4138 Term_putstr(10, 19, -1, TERM_WHITE,
4139 format("Default attr/char = %3d / %3d", da, dc));
4142 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4143 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4145 /* Label the Current values */
4147 Term_putstr(10, 20, -1, TERM_WHITE,
4148 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4150 Term_putstr(10, 20, -1, TERM_WHITE,
4151 format("Current attr/char = %3d / %3d", ca, cc));
4154 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4155 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4159 Term_putstr(0, 22, -1, TERM_WHITE,
4160 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4162 Term_putstr(0, 22, -1, TERM_WHITE,
4163 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4170 if (i == ESCAPE) break;
4172 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4173 else if (isupper(i)) c = 'a' + i - 'A';
4183 if (!cmd_visuals_aux(i, &k, max_k_idx))
4189 while (!k_info[k].name || k_info[k].flavor);
4193 t = (int)k_ptr->x_attr;
4194 (void)cmd_visuals_aux(i, &t, 256);
4195 k_ptr->x_attr = (byte)t;
4199 t = (int)k_ptr->x_char;
4200 (void)cmd_visuals_aux(i, &t, 256);
4201 k_ptr->x_char = (byte)t;
4205 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4209 print_visuals_menu(choice_msg);
4217 /* Modify feature attr/chars (numeric operation) */
4221 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4223 static cptr choice_msg = "Change feature attr/chars";
4226 static int lighting_level = F_LIT_STANDARD;
4229 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4231 prt(format("Command: %s", choice_msg), 15, 0);
4234 /* Hack -- query until done */
4237 feature_type *f_ptr = &f_info[f];
4241 byte da = f_ptr->d_attr[lighting_level];
4242 byte dc = f_ptr->d_char[lighting_level];
4243 byte ca = f_ptr->x_attr[lighting_level];
4244 byte cc = f_ptr->x_char[lighting_level];
4246 /* Label the object */
4249 Term_putstr(5, 17, -1, TERM_WHITE,
4250 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4251 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4253 Term_putstr(5, 17, -1, TERM_WHITE,
4254 format("Terrain = %d, Name = %s, Lighting = %s",
4255 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4258 /* Label the Default values */
4260 Term_putstr(10, 19, -1, TERM_WHITE,
4261 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4263 Term_putstr(10, 19, -1, TERM_WHITE,
4264 format("Default attr/char = %3d / %3d", da, dc));
4267 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4269 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4271 /* Label the Current values */
4273 Term_putstr(10, 20, -1, TERM_WHITE,
4274 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4276 Term_putstr(10, 20, -1, TERM_WHITE,
4277 format("Current attr/char = %3d / %3d", ca, cc));
4280 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4281 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4285 Term_putstr(0, 22, -1, TERM_WHITE,
4286 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4288 Term_putstr(0, 22, -1, TERM_WHITE,
4289 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4296 if (i == ESCAPE) break;
4298 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4299 else if (isupper(i)) c = 'a' + i - 'A';
4309 if (!cmd_visuals_aux(i, &f, max_f_idx))
4315 while (!f_info[f].name || (f_info[f].mimic != f));
4319 t = (int)f_ptr->x_attr[lighting_level];
4320 (void)cmd_visuals_aux(i, &t, 256);
4321 f_ptr->x_attr[lighting_level] = (byte)t;
4325 t = (int)f_ptr->x_char[lighting_level];
4326 (void)cmd_visuals_aux(i, &t, 256);
4327 f_ptr->x_char[lighting_level] = (byte)t;
4331 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4334 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4338 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4342 print_visuals_menu(choice_msg);
4350 /* Modify monster attr/chars (visual mode) */
4352 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4355 /* Modify object attr/chars (visual mode) */
4357 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4360 /* Modify feature attr/chars (visual mode) */
4363 int lighting_level = F_LIT_STANDARD;
4364 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4368 #endif /* ALLOW_VISUALS */
4378 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4380 msg_print("Visual attr/char tables reset.");
4386 /* Unknown option */
4392 /* Flush messages */
4396 /* Restore the screen */
4399 if (need_redraw) do_cmd_redraw();
4404 * Interact with "colors"
4406 void do_cmd_colors(void)
4415 /* File type is "TEXT" */
4416 FILE_TYPE(FILE_TYPE_TEXT);
4419 /* Save the screen */
4423 /* Interact until done */
4429 /* Ask for a choice */
4431 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4433 prt("Interact with Colors", 2, 0);
4437 /* Give some choices */
4439 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4441 prt("(1) Load a user pref file", 4, 5);
4446 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4447 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4449 prt("(2) Dump colors", 5, 5);
4450 prt("(3) Modify colors", 6, 5);
4457 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4459 prt("Command: ", 8, 0);
4467 if (i == ESCAPE) break;
4469 /* Load a 'pref' file */
4474 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4476 prt("Command: Load a user pref file", 8, 0);
4482 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4484 prt("File: ", 10, 0);
4489 sprintf(tmp, "%s.prf", player_name);
4492 if (!askfor(tmp, 70)) continue;
4494 /* Process the given filename */
4495 (void)process_pref_file(tmp);
4497 /* Mega-Hack -- react to changes */
4498 Term_xtra(TERM_XTRA_REACT, 0);
4500 /* Mega-Hack -- redraw */
4509 static cptr mark = "Colors";
4513 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4515 prt("Command: Dump colors", 8, 0);
4521 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4523 prt("File: ", 10, 0);
4527 /* Default filename */
4528 sprintf(tmp, "%s.prf", player_name);
4530 /* Get a filename */
4531 if (!askfor(tmp, 70)) continue;
4533 /* Build the filename */
4534 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4536 /* Append to the file */
4537 if (!open_auto_dump(buf, mark)) continue;
4541 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4543 auto_dump_printf("\n# Color redefinitions\n\n");
4547 for (i = 0; i < 256; i++)
4549 int kv = angband_color_table[i][0];
4550 int rv = angband_color_table[i][1];
4551 int gv = angband_color_table[i][2];
4552 int bv = angband_color_table[i][3];
4557 cptr name = "unknown";
4561 /* Skip non-entries */
4562 if (!kv && !rv && !gv && !bv) continue;
4564 /* Extract the color name */
4565 if (i < 16) name = color_names[i];
4567 /* Dump a comment */
4569 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4571 auto_dump_printf("# Color '%s'\n", name);
4574 /* Dump the monster attr/char info */
4575 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4584 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4586 msg_print("Dumped color redefinitions.");
4598 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4600 prt("Command: Modify colors", 8, 0);
4604 /* Hack -- query until done */
4613 /* Exhibit the normal colors */
4614 for (j = 0; j < 16; j++)
4616 /* Exhibit this color */
4617 Term_putstr(j*4, 20, -1, a, "###");
4619 /* Exhibit all colors */
4620 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4623 /* Describe the color */
4625 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4627 name = ((a < 16) ? color_names[a] : "undefined");
4631 /* Describe the color */
4633 Term_putstr(5, 10, -1, TERM_WHITE,
4634 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4636 Term_putstr(5, 10, -1, TERM_WHITE,
4637 format("Color = %d, Name = %s", a, name));
4641 /* Label the Current values */
4642 Term_putstr(5, 12, -1, TERM_WHITE,
4643 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4644 angband_color_table[a][0],
4645 angband_color_table[a][1],
4646 angband_color_table[a][2],
4647 angband_color_table[a][3]));
4651 Term_putstr(0, 14, -1, TERM_WHITE,
4652 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4654 Term_putstr(0, 14, -1, TERM_WHITE,
4655 "Command (n/N/k/K/r/R/g/G/b/B): ");
4663 if (i == ESCAPE) break;
4666 if (i == 'n') a = (byte)(a + 1);
4667 if (i == 'N') a = (byte)(a - 1);
4668 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4669 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4670 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4671 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4672 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4673 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4674 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4675 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4677 /* Hack -- react to changes */
4678 Term_xtra(TERM_XTRA_REACT, 0);
4680 /* Hack -- redraw */
4687 /* Unknown option */
4693 /* Flush messages */
4698 /* Restore the screen */
4704 * Note something in the message recall
4706 void do_cmd_note(void)
4715 if (!get_string("¥á¥â: ", buf, 60)) return;
4717 if (!get_string("Note: ", buf, 60)) return;
4721 /* Ignore empty notes */
4722 if (!buf[0] || (buf[0] == ' ')) return;
4724 /* Add the note to the message recall */
4726 msg_format("¥á¥â: %s", buf);
4728 msg_format("Note: %s", buf);
4735 * Mention the current version
4737 void do_cmd_version(void)
4742 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4743 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4745 msg_format("You are playing Hengband %d.%d.%d.",
4746 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4753 * Array of feeling strings
4755 static cptr do_cmd_feeling_text[11] =
4758 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4760 "Looks like any other level.",
4764 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4766 "You feel there is something special about this level.",
4770 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4772 "You nearly faint as horrible visions of death fill your mind!",
4776 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4778 "This level looks very dangerous.",
4782 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4784 "You have a very bad feeling...",
4788 "°¤¤Í½´¶¤¬¤¹¤ë...",
4790 "You have a bad feeling...",
4796 "You feel nervous.",
4800 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4802 "You feel your luck is turning...",
4806 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4808 "You don't like the look of this place.",
4812 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4814 "This level looks reasonably safe.",
4818 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4820 "What a boring place..."
4825 static cptr do_cmd_feeling_text_combat[11] =
4828 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4830 "Looks like any other level.",
4834 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4836 "You feel there is something special about this level.",
4840 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4842 "You nearly faint as horrible visions of death fill your mind!",
4846 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4848 "This level looks very dangerous.",
4852 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4854 "You have a very bad feeling...",
4858 "°¤¤Í½´¶¤¬¤¹¤ë...",
4860 "You have a bad feeling...",
4866 "You feel nervous.",
4870 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4872 "You feel your luck is turning...",
4876 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4878 "You don't like the look of this place.",
4882 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4884 "This level looks reasonably safe.",
4888 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4890 "What a boring place..."
4895 static cptr do_cmd_feeling_text_lucky[11] =
4898 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4899 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4900 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4901 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4902 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4903 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4904 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4905 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4906 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4907 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4908 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4910 "Looks like any other level.",
4911 "You feel there is something special about this level.",
4912 "You have a superb feeling about this level.",
4913 "You have an excellent feeling...",
4914 "You have a very good feeling...",
4915 "You have a good feeling...",
4916 "You feel strangely lucky...",
4917 "You feel your luck is turning...",
4918 "You like the look of this place...",
4919 "This level can't be all bad...",
4920 "What a boring place..."
4926 * Note that "feeling" is set to zero unless some time has passed.
4927 * Note that this is done when the level is GENERATED, not entered.
4929 void do_cmd_feeling(void)
4931 /* No useful feeling in quests */
4932 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4935 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4937 msg_print("Looks like a typical quest level.");
4943 /* No useful feeling in town */
4944 else if (p_ptr->town_num && !dun_level)
4947 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4949 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4953 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4955 msg_print("Looks like a strange wilderness.");
4963 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4965 msg_print("Looks like a typical town.");
4972 /* No useful feeling in the wilderness */
4973 else if (!dun_level)
4976 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4978 msg_print("Looks like a typical wilderness.");
4984 /* Display the feeling */
4985 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
4986 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
4987 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
4988 inventory[INVEN_BOW].name1 == ART_CRIMSON)
4989 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
4991 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
4997 * Description of each monster group.
4999 static cptr monster_group_text[] =
5002 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
5003 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5032 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5049 /* "¾åµé¥Ç¡¼¥â¥ó", */
5091 /* "Ancient Dragon/Wyrm", */
5100 "Multi-Headed Reptile",
5105 "Reptile/Amphibian",
5106 "Spider/Scorpion/Tick",
5108 /* "Major Demon", */
5125 * Symbols of monsters in each group. Note the "Uniques" group
5126 * is handled differently.
5128 static cptr monster_group_char[] =
5183 "!$&()+./=>?[\\]`{|~",
5193 * hook function to sort monsters by level
5195 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5197 u16b *who = (u16b*)(u);
5202 monster_race *r_ptr1 = &r_info[w1];
5203 monster_race *r_ptr2 = &r_info[w2];
5208 if (r_ptr2->level > r_ptr1->level) return TRUE;
5209 if (r_ptr1->level > r_ptr2->level) return FALSE;
5211 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5212 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5217 * Build a list of monster indexes in the given group. Return the number
5218 * of monsters in the group.
5220 * mode & 0x01 : check for non-empty group
5221 * mode & 0x02 : visual operation only
5223 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5228 /* Get a list of x_char in this group */
5229 cptr group_char = monster_group_char[grp_cur];
5231 /* XXX Hack -- Check if this is the "Uniques" group */
5232 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5234 /* XXX Hack -- Check if this is the "Riding" group */
5235 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5237 /* Check every race */
5238 for (i = 0; i < max_r_idx; i++)
5240 /* Access the race */
5241 monster_race *r_ptr = &r_info[i];
5243 /* Skip empty race */
5244 if (!r_ptr->name) continue ;
5246 /* Require known monsters */
5247 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5251 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5254 else if (grp_riding)
5256 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5261 /* Check for race in the group */
5262 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5266 mon_idx[mon_cnt++] = i;
5268 /* XXX Hack -- Just checking for non-empty group */
5269 if (mode & 0x01) break;
5272 /* Terminate the list */
5273 mon_idx[mon_cnt] = -1;
5275 /* Select the sort method */
5276 ang_sort_comp = ang_sort_comp_monster_level;
5277 ang_sort_swap = ang_sort_swap_hook;
5279 /* Sort by monster level */
5280 ang_sort(mon_idx, &dummy_why, mon_cnt);
5282 /* Return the number of races */
5288 * Description of each monster group.
5290 static cptr object_group_text[] =
5293 "¥¥Î¥³", /* "Mushrooms" */
5294 "Ìô", /* "Potions" */
5295 "Ìý¤Ä¤Ü", /* "Flasks" */
5296 "´¬Êª", /* "Scrolls" */
5297 "»ØÎØ", /* "Rings" */
5298 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5299 "ū", /* "Whistle" */
5300 "¸÷¸»", /* "Lanterns" */
5301 "ËâË¡ËÀ", /* "Wands" */
5302 "¾ó", /* "Staffs" */
5303 "¥í¥Ã¥É", /* "Rods" */
5304 "¥«¡¼¥É", /* "Cards" */
5305 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5315 "Åá·õÎà", /* "Swords" */
5316 "Æß´ï", /* "Blunt Weapons" */
5317 "ĹÊÁÉð´ï", /* "Polearms" */
5318 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5319 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5323 "·ÚÁõ³»", /* "Soft Armor" */
5324 "½ÅÁõ³»", /* "Hard Armor" */
5325 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5326 "½â", /* "Shields" */
5327 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5328 "äƼê", /* "Gloves" */
5329 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5330 "´§", /* "Crowns" */
5331 "¥Ö¡¼¥Ä", /* "Boots" */
5384 * TVALs of items in each group
5386 static byte object_group_tval[] =
5427 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5435 * Build a list of object indexes in the given group. Return the number
5436 * of objects in the group.
5438 * mode & 0x01 : check for non-empty group
5439 * mode & 0x02 : visual operation only
5441 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5443 int i, j, k, object_cnt = 0;
5445 /* Get a list of x_char in this group */
5446 byte group_tval = object_group_tval[grp_cur];
5448 /* Check every object */
5449 for (i = 0; i < max_k_idx; i++)
5451 /* Access the object */
5452 object_kind *k_ptr = &k_info[i];
5454 /* Skip empty objects */
5455 if (!k_ptr->name) continue;
5459 /* Any objects will be displayed */
5465 /* Skip non-flavoured objects */
5466 if (!k_ptr->flavor) continue;
5468 /* Require objects ever seen */
5469 if (!k_ptr->aware) continue;
5472 /* Skip items with no distribution (special artifacts) */
5473 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5477 /* Check for objects in the group */
5478 if (TV_LIFE_BOOK == group_tval)
5480 /* Hack -- All spell books */
5481 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5483 /* Add the object */
5484 object_idx[object_cnt++] = i;
5488 else if (k_ptr->tval == group_tval)
5490 /* Add the object */
5491 object_idx[object_cnt++] = i;
5495 /* XXX Hack -- Just checking for non-empty group */
5496 if (mode & 0x01) break;
5499 /* Terminate the list */
5500 object_idx[object_cnt] = -1;
5502 /* Return the number of objects */
5508 * Description of each feature group.
5510 static cptr feature_group_text[] =
5518 * Build a list of feature indexes in the given group. Return the number
5519 * of features in the group.
5521 * mode & 0x01 : check for non-empty group
5523 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5525 int i, feat_cnt = 0;
5527 /* Unused; There is a single group. */
5530 /* Check every feature */
5531 for (i = 0; i < max_f_idx; i++)
5533 /* Access the index */
5534 feature_type *f_ptr = &f_info[i];
5536 /* Skip empty index */
5537 if (!f_ptr->name) continue;
5539 /* Skip mimiccing features */
5540 if (f_ptr->mimic != i) continue;
5543 feat_idx[feat_cnt++] = i;
5545 /* XXX Hack -- Just checking for non-empty group */
5546 if (mode & 0x01) break;
5549 /* Terminate the list */
5550 feat_idx[feat_cnt] = -1;
5552 /* Return the number of races */
5559 * Build a list of monster indexes in the given group. Return the number
5560 * of monsters in the group.
5562 static int collect_artifacts(int grp_cur, int object_idx[])
5564 int i, object_cnt = 0;
5566 /* Get a list of x_char in this group */
5567 byte group_tval = object_group_tval[grp_cur];
5569 /* Check every object */
5570 for (i = 0; i < max_a_idx; i++)
5572 /* Access the artifact */
5573 artifact_type *a_ptr = &a_info[i];
5575 /* Skip empty artifacts */
5576 if (!a_ptr->name) continue;
5578 /* Skip "uncreated" artifacts */
5579 if (!a_ptr->cur_num) continue;
5581 /* Check for race in the group */
5582 if (a_ptr->tval == group_tval)
5585 object_idx[object_cnt++] = i;
5589 /* Terminate the list */
5590 object_idx[object_cnt] = 0;
5592 /* Return the number of races */
5599 * Encode the screen colors
5601 static char hack[17] = "dwsorgbuDWvyRGBU";
5605 * Hack -- load a screen dump from a file
5607 void do_cmd_load_screen(void)
5622 Term_get_size(&wid, &hgt);
5624 /* Build the filename */
5625 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5627 /* Append to the file */
5628 fff = my_fopen(buf, "r");
5633 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5635 msg_format("Failed to open %s.", buf);
5642 /* Save the screen */
5645 /* Clear the screen */
5649 /* Load the screen */
5650 for (y = 0; okay; y++)
5652 /* Get a line of data including control code */
5653 if (!fgets(buf, 1024, fff)) okay = FALSE;
5655 /* Get the blank line */
5656 if (buf[0] == '\n' || buf[0] == '\0') break;
5658 /* Ignore too large screen image */
5659 if (y >= hgt) continue;
5662 for (x = 0; x < wid - 1; x++)
5665 if (buf[x] == '\n' || buf[x] == '\0') break;
5667 /* Put the attr/char */
5668 Term_draw(x, y, TERM_WHITE, buf[x]);
5672 /* Dump the screen */
5673 for (y = 0; okay; y++)
5675 /* Get a line of data including control code */
5676 if (!fgets(buf, 1024, fff)) okay = FALSE;
5678 /* Get the blank line */
5679 if (buf[0] == '\n' || buf[0] == '\0') break;
5681 /* Ignore too large screen image */
5682 if (y >= hgt) continue;
5685 for (x = 0; x < wid - 1; x++)
5688 if (buf[x] == '\n' || buf[x] == '\0') break;
5690 /* Get the attr/char */
5691 (void)(Term_what(x, y, &a, &c));
5693 /* Look up the attr */
5694 for (i = 0; i < 16; i++)
5696 /* Use attr matches */
5697 if (hack[i] == buf[x]) a = i;
5700 /* Put the attr/char */
5701 Term_draw(x, y, a, c);
5712 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5714 msg_print("Screen dump loaded.");
5721 /* Restore the screen */
5728 cptr inven_res_label =
5730 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5732 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5737 #define IM_FLAG_STR "¡ö"
5738 #define HAS_FLAG_STR "¡Ü"
5739 #define NO_FLAG_STR "¡¦"
5741 #define IM_FLAG_STR "* "
5742 #define HAS_FLAG_STR "+ "
5743 #define NO_FLAG_STR ". "
5746 #define print_im_or_res_flag(IM, RES) \
5748 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5749 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5752 #define print_flag(TR) \
5754 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5758 /* XTRA HACK RESLIST */
5759 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5761 char o_name[MAX_NLEN];
5762 u32b flgs[TR_FLAG_SIZE];
5764 if (!o_ptr->k_idx) return;
5765 if (o_ptr->tval != tval) return;
5767 /* Identified items only */
5768 if (!object_is_known(o_ptr)) return;
5771 * HACK:Ring of Lordly protection and Dragon equipment
5772 * have random resistances.
5774 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5775 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5776 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5777 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5778 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5779 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5780 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5781 || object_is_artifact(o_ptr))
5784 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5786 while (o_name[i] && (i < 26))
5789 if (iskanji(o_name[i])) i++;
5798 o_name[i] = ' '; i++;
5803 fprintf(fff, "%s %s", where, o_name);
5805 if (!(o_ptr->ident & (IDENT_MENTAL)))
5808 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5810 fputs("-------unknown------------ -------unknown------\n", fff);
5815 object_flags_known(o_ptr, flgs);
5817 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5818 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5819 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5820 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5821 print_flag(TR_RES_POIS);
5822 print_flag(TR_RES_LITE);
5823 print_flag(TR_RES_DARK);
5824 print_flag(TR_RES_SHARDS);
5825 print_flag(TR_RES_SOUND);
5826 print_flag(TR_RES_NETHER);
5827 print_flag(TR_RES_NEXUS);
5828 print_flag(TR_RES_CHAOS);
5829 print_flag(TR_RES_DISEN);
5833 print_flag(TR_RES_BLIND);
5834 print_flag(TR_RES_FEAR);
5835 print_flag(TR_RES_CONF);
5836 print_flag(TR_FREE_ACT);
5837 print_flag(TR_SEE_INVIS);
5838 print_flag(TR_HOLD_LIFE);
5839 print_flag(TR_TELEPATHY);
5840 print_flag(TR_SLOW_DIGEST);
5841 print_flag(TR_REGEN);
5842 print_flag(TR_LEVITATION);
5850 fprintf(fff, "%s\n", inven_res_label);
5856 * Display *ID* ed weapons/armors's resistances
5858 static void do_cmd_knowledge_inven(void)
5862 char file_name[1024];
5872 /* Open a new file */
5873 fff = my_fopen_temp(file_name, 1024);
5877 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5879 msg_format("Failed to create temporary file %s.", file_name);
5884 fprintf(fff, "%s\n", inven_res_label);
5886 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
5890 for (; j < 9; j++) fputc('\n', fff);
5892 fprintf(fff, "%s\n", inven_res_label);
5896 strcpy(where, "Áõ");
5898 strcpy(where, "E ");
5900 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5902 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5906 strcpy(where, "»ý");
5908 strcpy(where, "I ");
5910 for (i = 0; i < INVEN_PACK; i++)
5912 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5915 st_ptr = &town[1].store[STORE_HOME];
5917 strcpy(where, "²È");
5919 strcpy(where, "H ");
5922 for (i = 0; i < st_ptr->stock_num; i++)
5924 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
5928 /* Close the file */
5931 /* Display the file contents */
5933 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5935 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5938 /* Remove the file */
5943 void do_cmd_save_screen_html_aux(char *filename, int message)
5947 byte a = 0, old_a = 0;
5961 cptr html_head[] = {
5962 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5966 cptr html_foot[] = {
5968 "</body>\n</html>\n",
5974 Term_get_size(&wid, &hgt);
5976 /* File type is "TEXT" */
5977 FILE_TYPE(FILE_TYPE_TEXT);
5979 /* Append to the file */
5980 fff = my_fopen(filename, "w");
5986 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5988 msg_format("Failed to open file %s.", filename);
5996 /* Save the screen */
6000 /* Build the filename */
6001 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
6002 tmpfff = my_fopen(buf, "r");
6004 for (i = 0; html_head[i]; i++)
6005 fprintf(fff, html_head[i]);
6009 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6011 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6015 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6017 fprintf(fff, "%s\n", buf);
6022 /* Dump the screen */
6023 for (y = 0; y < hgt; y++)
6030 for (x = 0; x < wid - 1; x++)
6034 /* Get the attr/char */
6035 (void)(Term_what(x, y, &a, &c));
6039 case '&': cc = "&"; break;
6040 case '<': cc = "<"; break;
6041 case '>': cc = ">"; break;
6043 case 0x1f: c = '.'; break;
6044 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6049 if ((y == 0 && x == 0) || a != old_a) {
6050 rv = angband_color_table[a][1];
6051 gv = angband_color_table[a][2];
6052 bv = angband_color_table[a][3];
6053 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6054 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6058 fprintf(fff, "%s", cc);
6060 fprintf(fff, "%c", c);
6063 fprintf(fff, "</font>");
6066 for (i = 0; html_foot[i]; i++)
6067 fprintf(fff, html_foot[i]);
6072 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6074 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6078 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6080 fprintf(fff, "%s\n", buf);
6095 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6097 msg_print("Screen dump saved.");
6102 /* Restore the screen */
6108 * Hack -- save a screen dump to a file
6110 static void do_cmd_save_screen_html(void)
6112 char buf[1024], tmp[256] = "screen.html";
6115 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6117 if (!get_string("File name: ", tmp, 80))
6121 /* Build the filename */
6122 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6126 do_cmd_save_screen_html_aux(buf, 1);
6131 * Redefinable "save_screen" action
6133 void (*screendump_aux)(void) = NULL;
6137 * Hack -- save a screen dump to a file
6139 void do_cmd_save_screen(void)
6141 bool old_use_graphics = use_graphics;
6142 bool html_dump = FALSE;
6147 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6149 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6154 if (c == 'Y' || c == 'y')
6156 else if (c == 'H' || c == 'h')
6168 Term_get_size(&wid, &hgt);
6170 if (old_use_graphics)
6172 use_graphics = FALSE;
6175 /* Redraw everything */
6176 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6178 /* Hack -- update */
6184 do_cmd_save_screen_html();
6188 /* Do we use a special screendump function ? */
6189 else if (screendump_aux)
6191 /* Dump the screen to a graphics file */
6192 (*screendump_aux)();
6194 else /* Dump the screen as text */
6205 /* Build the filename */
6206 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6208 /* File type is "TEXT" */
6209 FILE_TYPE(FILE_TYPE_TEXT);
6211 /* Append to the file */
6212 fff = my_fopen(buf, "w");
6218 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6220 msg_format("Failed to open file %s.", buf);
6227 /* Save the screen */
6231 /* Dump the screen */
6232 for (y = 0; y < hgt; y++)
6235 for (x = 0; x < wid - 1; x++)
6237 /* Get the attr/char */
6238 (void)(Term_what(x, y, &a, &c));
6248 fprintf(fff, "%s\n", buf);
6255 /* Dump the screen */
6256 for (y = 0; y < hgt; y++)
6259 for (x = 0; x < wid - 1; x++)
6261 /* Get the attr/char */
6262 (void)(Term_what(x, y, &a, &c));
6265 buf[x] = hack[a&0x0F];
6272 fprintf(fff, "%s\n", buf);
6284 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6286 msg_print("Screen dump saved.");
6292 /* Restore the screen */
6296 if (old_use_graphics)
6298 use_graphics = TRUE;
6301 /* Redraw everything */
6302 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6304 /* Hack -- update */
6311 * Sorting hook -- Comp function -- see below
6313 * We use "u" to point to array of monster indexes,
6314 * and "v" to select the type of sorting to perform on "u".
6316 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6318 u16b *who = (u16b*)(u);
6320 u16b *why = (u16b*)(v);
6327 /* Sort by total kills */
6330 /* Extract total kills */
6331 z1 = a_info[w1].tval;
6332 z2 = a_info[w2].tval;
6334 /* Compare total kills */
6335 if (z1 < z2) return (TRUE);
6336 if (z1 > z2) return (FALSE);
6340 /* Sort by monster level */
6343 /* Extract levels */
6344 z1 = a_info[w1].sval;
6345 z2 = a_info[w2].sval;
6347 /* Compare levels */
6348 if (z1 < z2) return (TRUE);
6349 if (z1 > z2) return (FALSE);
6353 /* Sort by monster experience */
6356 /* Extract experience */
6357 z1 = a_info[w1].level;
6358 z2 = a_info[w2].level;
6360 /* Compare experience */
6361 if (z1 < z2) return (TRUE);
6362 if (z1 > z2) return (FALSE);
6366 /* Compare indexes */
6372 * Sorting hook -- Swap function -- see below
6374 * We use "u" to point to array of monster indexes,
6375 * and "v" to select the type of sorting to perform.
6377 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6379 u16b *who = (u16b*)(u);
6394 * Check the status of "artifacts"
6396 static void do_cmd_knowledge_artifacts(void)
6398 int i, k, z, x, y, n = 0;
6404 char file_name[1024];
6406 char base_name[MAX_NLEN];
6410 /* Open a new file */
6411 fff = my_fopen_temp(file_name, 1024);
6415 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6417 msg_format("Failed to create temporary file %s.", file_name);
6423 /* Allocate the "who" array */
6424 C_MAKE(who, max_a_idx, s16b);
6426 /* Allocate the "okay" array */
6427 C_MAKE(okay, max_a_idx, bool);
6429 /* Scan the artifacts */
6430 for (k = 0; k < max_a_idx; k++)
6432 artifact_type *a_ptr = &a_info[k];
6437 /* Skip "empty" artifacts */
6438 if (!a_ptr->name) continue;
6440 /* Skip "uncreated" artifacts */
6441 if (!a_ptr->cur_num) continue;
6447 /* Check the dungeon */
6448 for (y = 0; y < cur_hgt; y++)
6450 for (x = 0; x < cur_wid; x++)
6452 cave_type *c_ptr = &cave[y][x];
6454 s16b this_o_idx, next_o_idx = 0;
6456 /* Scan all objects in the grid */
6457 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6461 /* Acquire object */
6462 o_ptr = &o_list[this_o_idx];
6464 /* Acquire next object */
6465 next_o_idx = o_ptr->next_o_idx;
6467 /* Ignore non-artifacts */
6468 if (!object_is_fixed_artifact(o_ptr)) continue;
6470 /* Ignore known items */
6471 if (object_is_known(o_ptr)) continue;
6473 /* Note the artifact */
6474 okay[o_ptr->name1] = FALSE;
6479 /* Check the inventory and equipment */
6480 for (i = 0; i < INVEN_TOTAL; i++)
6482 object_type *o_ptr = &inventory[i];
6484 /* Ignore non-objects */
6485 if (!o_ptr->k_idx) continue;
6487 /* Ignore non-artifacts */
6488 if (!object_is_fixed_artifact(o_ptr)) continue;
6490 /* Ignore known items */
6491 if (object_is_known(o_ptr)) continue;
6493 /* Note the artifact */
6494 okay[o_ptr->name1] = FALSE;
6497 for (k = 0; k < max_a_idx; k++)
6499 if (okay[k]) who[n++] = k;
6502 /* Select the sort method */
6503 ang_sort_comp = ang_sort_art_comp;
6504 ang_sort_swap = ang_sort_art_swap;
6506 /* Sort the array by dungeon depth of monsters */
6507 ang_sort(who, &why, n);
6509 /* Scan the artifacts */
6510 for (k = 0; k < n; k++)
6512 artifact_type *a_ptr = &a_info[who[k]];
6516 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6518 strcpy(base_name, "Unknown Artifact");
6522 /* Obtain the base object type */
6523 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6531 /* Get local object */
6534 /* Create fake object */
6535 object_prep(q_ptr, z);
6537 /* Make it an artifact */
6538 q_ptr->name1 = (byte)who[k];
6540 /* Display as if known */
6541 q_ptr->ident |= IDENT_STORE;
6543 /* Describe the artifact */
6544 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6547 /* Hack -- Build the artifact name */
6549 fprintf(fff, " %s\n", base_name);
6551 fprintf(fff, " The %s\n", base_name);
6556 /* Free the "who" array */
6557 C_KILL(who, max_a_idx, s16b);
6559 /* Free the "okay" array */
6560 C_KILL(okay, max_a_idx, bool);
6562 /* Close the file */
6565 /* Display the file contents */
6567 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6569 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6573 /* Remove the file */
6579 * Display known uniques
6580 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6582 static void do_cmd_knowledge_uniques(void)
6590 char file_name[1024];
6593 int n_alive_surface = 0;
6594 int n_alive_over100 = 0;
6595 int n_alive_total = 0;
6598 for (i = 0; i < 10; i++) n_alive[i] = 0;
6600 /* Open a new file */
6601 fff = my_fopen_temp(file_name, 1024);
6606 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6608 msg_format("Failed to create temporary file %s.", file_name);
6614 /* Allocate the "who" array */
6615 C_MAKE(who, max_r_idx, s16b);
6617 /* Scan the monsters */
6618 for (i = 1; i < max_r_idx; i++)
6620 monster_race *r_ptr = &r_info[i];
6623 if (!r_ptr->name) continue;
6625 /* Require unique monsters */
6626 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6628 /* Only display "known" uniques */
6629 if (!cheat_know && !r_ptr->r_sights) continue;
6631 /* Only print rarity <= 100 uniques */
6632 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6634 /* Only "alive" uniques */
6635 if (r_ptr->max_num == 0) continue;
6639 lev = (r_ptr->level - 1) / 10;
6643 if (max_lev < lev) max_lev = lev;
6645 else n_alive_over100++;
6647 else n_alive_surface++;
6649 /* Collect "appropriate" monsters */
6653 /* Select the sort method */
6654 ang_sort_comp = ang_sort_comp_hook;
6655 ang_sort_swap = ang_sort_swap_hook;
6657 /* Sort the array by dungeon depth of monsters */
6658 ang_sort(who, &why, n);
6660 if (n_alive_surface)
6663 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6665 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6667 n_alive_total += n_alive_surface;
6669 for (i = 0; i <= max_lev; i++)
6672 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6674 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6676 n_alive_total += n_alive[i];
6678 if (n_alive_over100)
6681 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6683 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6685 n_alive_total += n_alive_over100;
6691 fputs("--------- -----------\n", fff);
6692 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6694 fputs("------------- ----------\n", fff);
6695 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6701 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6703 fputs("No known uniques alive.\n", fff);
6707 /* Scan the monster races */
6708 for (k = 0; k < n; k++)
6710 monster_race *r_ptr = &r_info[who[k]];
6712 /* Print a message */
6714 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6716 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6720 /* Free the "who" array */
6721 C_KILL(who, max_r_idx, s16b);
6723 /* Close the file */
6726 /* Display the file contents */
6728 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6730 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6734 /* Remove the file */
6740 * Display weapon-exp
6742 static void do_cmd_knowledge_weapon_exp(void)
6744 int i, j, num, weapon_exp;
6748 char file_name[1024];
6751 /* Open a new file */
6752 fff = my_fopen_temp(file_name, 1024);
6755 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6757 msg_format("Failed to create temporary file %s.", file_name);
6763 for (i = 0; i < 5; i++)
6765 for (num = 0; num < 64; num++)
6767 for (j = 0; j < max_k_idx; j++)
6769 object_kind *k_ptr = &k_info[j];
6771 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6773 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6775 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6777 fprintf(fff, "%-25s ", tmp);
6778 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6779 else fprintf(fff, " ");
6780 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6781 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6789 /* Close the file */
6792 /* Display the file contents */
6794 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6796 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6800 /* Remove the file */
6808 static void do_cmd_knowledge_spell_exp(void)
6810 int i = 0, spell_exp, exp_level;
6815 char file_name[1024];
6817 /* Open a new file */
6818 fff = my_fopen_temp(file_name, 1024);
6821 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6823 msg_format("Failed to create temporary file %s.", file_name);
6829 if (p_ptr->realm1 != REALM_NONE)
6832 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6834 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6836 for (i = 0; i < 32; i++)
6838 if (!is_magic(p_ptr->realm1))
6840 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6844 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6846 if (s_ptr->slevel >= 99) continue;
6847 spell_exp = p_ptr->spell_exp[i];
6848 exp_level = spell_exp_level(spell_exp);
6849 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6850 if (p_ptr->realm1 == REALM_HISSATSU)
6851 fprintf(fff, "[--]");
6854 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6855 else fprintf(fff, " ");
6856 fprintf(fff, "%s", exp_level_str[exp_level]);
6858 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6863 if (p_ptr->realm2 != REALM_NONE)
6866 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6868 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6870 for (i = 0; i < 32; i++)
6872 if (!is_magic(p_ptr->realm1))
6874 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6878 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6880 if (s_ptr->slevel >= 99) continue;
6882 spell_exp = p_ptr->spell_exp[i + 32];
6883 exp_level = spell_exp_level(spell_exp);
6884 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
6885 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6886 else fprintf(fff, " ");
6887 fprintf(fff, "%s", exp_level_str[exp_level]);
6888 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6893 /* Close the file */
6896 /* Display the file contents */
6898 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6900 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6904 /* Remove the file */
6912 static void do_cmd_knowledge_skill_exp(void)
6914 int i = 0, skill_exp;
6918 char file_name[1024];
6920 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6922 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6925 /* Open a new file */
6926 fff = my_fopen_temp(file_name, 1024);
6929 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6931 msg_format("Failed to create temporary file %s.", file_name);
6937 for (i = 0; i < 3; i++)
6939 skill_exp = p_ptr->skill_exp[i];
6940 fprintf(fff, "%-20s ", skill_name[i]);
6941 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6942 else fprintf(fff, " ");
6943 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6944 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6948 /* Close the file */
6951 /* Display the file contents */
6953 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6955 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6959 /* Remove the file */
6965 * Pluralize a monster name
6967 void plural_aux(char *Name)
6969 int NameLen = strlen(Name);
6971 if (my_strstr(Name, "Disembodied hand"))
6973 strcpy(Name, "Disembodied hands that strangled people");
6975 else if (my_strstr(Name, "Colour out of space"))
6977 strcpy(Name, "Colours out of space");
6979 else if (my_strstr(Name, "stairway to hell"))
6981 strcpy(Name, "stairways to hell");
6983 else if (my_strstr(Name, "Dweller on the threshold"))
6985 strcpy(Name, "Dwellers on the threshold");
6987 else if (my_strstr(Name, " of "))
6989 cptr aider = my_strstr(Name, " of ");
7000 if (dummy[i-1] == 's')
7002 strcpy(&(dummy[i]), "es");
7007 strcpy(&(dummy[i]), "s");
7010 strcpy(&(dummy[i+1]), aider);
7011 strcpy(Name, dummy);
7013 else if (my_strstr(Name, "coins"))
7016 strcpy(dummy, "piles of ");
7017 strcat(dummy, Name);
7018 strcpy(Name, dummy);
7021 else if (my_strstr(Name, "Manes"))
7025 else if (streq(&(Name[NameLen - 2]), "ey"))
7027 strcpy(&(Name[NameLen - 2]), "eys");
7029 else if (Name[NameLen - 1] == 'y')
7031 strcpy(&(Name[NameLen - 1]), "ies");
7033 else if (streq(&(Name[NameLen - 4]), "ouse"))
7035 strcpy(&(Name[NameLen - 4]), "ice");
7037 else if (streq(&(Name[NameLen - 2]), "us"))
7039 strcpy(&(Name[NameLen - 2]), "i");
7041 else if (streq(&(Name[NameLen - 6]), "kelman"))
7043 strcpy(&(Name[NameLen - 6]), "kelmen");
7045 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7047 strcpy(&(Name[NameLen - 8]), "wordsmen");
7049 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7051 strcpy(&(Name[NameLen - 7]), "oodsmen");
7053 else if (streq(&(Name[NameLen - 7]), "eastman"))
7055 strcpy(&(Name[NameLen - 7]), "eastmen");
7057 else if (streq(&(Name[NameLen - 8]), "izardman"))
7059 strcpy(&(Name[NameLen - 8]), "izardmen");
7061 else if (streq(&(Name[NameLen - 5]), "geist"))
7063 strcpy(&(Name[NameLen - 5]), "geister");
7065 else if (streq(&(Name[NameLen - 2]), "ex"))
7067 strcpy(&(Name[NameLen - 2]), "ices");
7069 else if (streq(&(Name[NameLen - 2]), "lf"))
7071 strcpy(&(Name[NameLen - 2]), "lves");
7073 else if (suffix(Name, "ch") ||
7074 suffix(Name, "sh") ||
7075 suffix(Name, "nx") ||
7076 suffix(Name, "s") ||
7079 strcpy(&(Name[NameLen]), "es");
7083 strcpy(&(Name[NameLen]), "s");
7088 * Display current pets
7090 static void do_cmd_knowledge_pets(void)
7094 monster_type *m_ptr;
7097 int show_upkeep = 0;
7098 char file_name[1024];
7101 /* Open a new file */
7102 fff = my_fopen_temp(file_name, 1024);
7105 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7107 msg_format("Failed to create temporary file %s.", file_name);
7113 /* Process the monsters (backwards) */
7114 for (i = m_max - 1; i >= 1; i--)
7116 /* Access the monster */
7119 /* Ignore "dead" monsters */
7120 if (!m_ptr->r_idx) continue;
7122 /* Calculate "upkeep" for pets */
7126 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7127 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7131 show_upkeep = calculate_upkeep();
7133 fprintf(fff, "----------------------------------------------\n");
7135 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7136 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7138 fprintf(fff, " Total: %d pet%s.\n",
7139 t_friends, (t_friends == 1 ? "" : "s"));
7140 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7145 /* Close the file */
7148 /* Display the file contents */
7150 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7152 show_file(TRUE, file_name, "Current Pets", 0, 0);
7156 /* Remove the file */
7164 * Note that the player ghosts are ignored. XXX XXX XXX
7166 static void do_cmd_knowledge_kill_count(void)
7174 char file_name[1024];
7179 /* Open a new file */
7180 fff = my_fopen_temp(file_name, 1024);
7184 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7186 msg_format("Failed to create temporary file %s.", file_name);
7192 /* Allocate the "who" array */
7193 C_MAKE(who, max_r_idx, s16b);
7196 /* Monsters slain */
7199 for (kk = 1; kk < max_r_idx; kk++)
7201 monster_race *r_ptr = &r_info[kk];
7203 if (r_ptr->flags1 & (RF1_UNIQUE))
7205 bool dead = (r_ptr->max_num == 0);
7214 s16b This = r_ptr->r_pkills;
7225 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7227 fprintf(fff,"You have defeated no enemies yet.\n\n");
7231 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7233 fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
7239 /* Scan the monsters */
7240 for (i = 1; i < max_r_idx; i++)
7242 monster_race *r_ptr = &r_info[i];
7244 /* Use that monster */
7245 if (r_ptr->name) who[n++] = i;
7248 /* Select the sort method */
7249 ang_sort_comp = ang_sort_comp_hook;
7250 ang_sort_swap = ang_sort_swap_hook;
7252 /* Sort the array by dungeon depth of monsters */
7253 ang_sort(who, &why, n);
7255 /* Scan the monster races */
7256 for (k = 0; k < n; k++)
7258 monster_race *r_ptr = &r_info[who[k]];
7260 if (r_ptr->flags1 & (RF1_UNIQUE))
7262 bool dead = (r_ptr->max_num == 0);
7266 /* Print a message */
7267 fprintf(fff, " %s\n",
7268 (r_name + r_ptr->name));
7274 s16b This = r_ptr->r_pkills;
7279 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7280 if (my_strchr("pt", r_ptr->d_char))
7281 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7283 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7287 if (my_strstr(r_name + r_ptr->name, "coins"))
7289 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7293 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7299 strcpy(ToPlural, (r_name + r_ptr->name));
7300 plural_aux(ToPlural);
7301 fprintf(fff, " %d %s\n", This, ToPlural);
7311 fprintf(fff,"----------------------------------------------\n");
7313 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
7315 fprintf(fff," Total: %lu creature%s killed.\n",
7316 Total, (Total == 1 ? "" : "s"));
7320 /* Free the "who" array */
7321 C_KILL(who, max_r_idx, s16b);
7323 /* Close the file */
7326 /* Display the file contents */
7328 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7330 show_file(TRUE, file_name, "Kill Count", 0, 0);
7334 /* Remove the file */
7340 * Display the object groups.
7342 static void display_group_list(int col, int row, int wid, int per_page,
7343 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7347 /* Display lines until done */
7348 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7350 /* Get the group index */
7351 int grp = grp_idx[grp_top + i];
7353 /* Choose a color */
7354 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7356 /* Erase the entire line */
7357 Term_erase(col, row + i, wid);
7359 /* Display the group label */
7360 c_put_str(attr, group_text[grp], row + i, col);
7366 * Move the cursor in a browser window
7368 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7369 int *list_cur, int list_cnt)
7374 int list = *list_cur;
7376 /* Extract direction */
7379 /* Hack -- scroll up full screen */
7384 /* Hack -- scroll down full screen */
7389 d = get_keymap_dir(ch);
7394 /* Diagonals - hack */
7395 if ((ddx[d] > 0) && ddy[d])
7401 Term_get_size(&wid, &hgt);
7403 browser_rows = hgt - 8;
7405 /* Browse group list */
7410 /* Move up or down */
7411 grp += ddy[d] * (browser_rows - 1);
7414 if (grp >= grp_cnt) grp = grp_cnt - 1;
7415 if (grp < 0) grp = 0;
7416 if (grp != old_grp) list = 0;
7419 /* Browse sub-list list */
7422 /* Move up or down */
7423 list += ddy[d] * browser_rows;
7426 if (list >= list_cnt) list = list_cnt - 1;
7427 if (list < 0) list = 0;
7439 if (col < 0) col = 0;
7440 if (col > 1) col = 1;
7447 /* Browse group list */
7452 /* Move up or down */
7456 if (grp >= grp_cnt) grp = grp_cnt - 1;
7457 if (grp < 0) grp = 0;
7458 if (grp != old_grp) list = 0;
7461 /* Browse sub-list list */
7464 /* Move up or down */
7468 if (list >= list_cnt) list = list_cnt - 1;
7469 if (list < 0) list = 0;
7480 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7484 /* Clear the display lines */
7485 for (i = 0; i < height; i++)
7487 Term_erase(col, row + i, width);
7490 /* Bigtile mode uses double width */
7491 if (use_bigtile) width /= 2;
7493 /* Display lines until done */
7494 for (i = 0; i < height; i++)
7496 /* Display columns until done */
7497 for (j = 0; j < width; j++)
7505 /* Bigtile mode uses double width */
7506 if (use_bigtile) x += j;
7511 /* Ignore illegal characters */
7512 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7513 (!use_graphics && ic > 0x7f))
7519 /* Force correct code for both ASCII character and tile */
7520 if (c & 0x80) a |= 0x80;
7522 /* Display symbol */
7523 Term_queue_bigchar(x, y, a, c, 0, 0);
7530 * Place the cursor at the collect position for visual mode
7532 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7534 int i = (a & 0x7f) - attr_top;
7535 int j = c - char_left;
7540 /* Bigtile mode uses double width */
7541 if (use_bigtile) x += j;
7543 /* Place the cursor */
7549 * Clipboard variables for copy&paste in visual mode
7551 static byte attr_idx = 0;
7552 static byte char_idx = 0;
7554 /* Hack -- for feature lighting */
7555 static byte attr_idx_feat[F_LIT_MAX];
7556 static byte char_idx_feat[F_LIT_MAX];
7559 * Do visual mode command -- Change symbols
7561 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7562 int height, int width,
7563 byte *attr_top_ptr, byte *char_left_ptr,
7564 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7566 static byte attr_old = 0, char_old = 0;
7571 if (*visual_list_ptr)
7574 *cur_attr_ptr = attr_old;
7575 *cur_char_ptr = char_old;
7576 *visual_list_ptr = FALSE;
7584 if (*visual_list_ptr)
7587 *visual_list_ptr = FALSE;
7588 *need_redraw = TRUE;
7596 if (!*visual_list_ptr)
7598 *visual_list_ptr = TRUE;
7600 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7601 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7603 attr_old = *cur_attr_ptr;
7604 char_old = *cur_char_ptr;
7615 /* Set the visual */
7616 attr_idx = *cur_attr_ptr;
7617 char_idx = *cur_char_ptr;
7619 /* Hack -- for feature lighting */
7620 for (i = 0; i < F_LIT_MAX; i++)
7622 attr_idx_feat[i] = 0;
7623 char_idx_feat[i] = 0;
7630 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7633 *cur_attr_ptr = attr_idx;
7634 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7635 if (!*visual_list_ptr) *need_redraw = TRUE;
7641 *cur_char_ptr = char_idx;
7642 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7643 if (!*visual_list_ptr) *need_redraw = TRUE;
7649 if (*visual_list_ptr)
7652 int d = get_keymap_dir(ch);
7653 byte a = (*cur_attr_ptr & 0x7f);
7654 byte c = *cur_char_ptr;
7656 if (use_bigtile) eff_width = width / 2;
7657 else eff_width = width;
7659 /* Restrict direction */
7660 if ((a == 0) && (ddy[d] < 0)) d = 0;
7661 if ((c == 0) && (ddx[d] < 0)) d = 0;
7662 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7663 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7668 /* Force correct code for both ASCII character and tile */
7669 if (c & 0x80) a |= 0x80;
7671 /* Set the visual */
7676 /* Move the frame */
7677 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7678 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7679 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7680 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7686 /* Visual mode command is not used */
7692 * Display the monsters in a group.
7694 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7695 int mon_cur, int mon_top, bool visual_only)
7699 /* Display lines until done */
7700 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7704 /* Get the race index */
7705 int r_idx = mon_idx[mon_top + i] ;
7707 /* Access the race */
7708 monster_race *r_ptr = &r_info[r_idx];
7710 /* Choose a color */
7711 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7713 /* Display the name */
7714 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7716 /* Hack -- visual_list mode */
7719 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7721 if (p_ptr->wizard || visual_only)
7723 c_prt(attr, format("%d", r_idx), row + i, 62);
7726 /* Erase chars before overwritten by the race letter */
7727 Term_erase(69, row + i, 255);
7729 /* Display symbol */
7730 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7735 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7737 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7739 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7744 /* Clear remaining lines */
7745 for (; i < per_page; i++)
7747 Term_erase(col, row + i, 255);
7753 * Display known monsters.
7755 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7758 int grp_cur, grp_top, old_grp_cur;
7759 int mon_cur, mon_top;
7760 int grp_cnt, grp_idx[100];
7768 bool visual_list = FALSE;
7769 byte attr_top = 0, char_left = 0;
7777 Term_get_size(&wid, &hgt);
7779 browser_rows = hgt - 8;
7781 /* Allocate the "mon_idx" array */
7782 C_MAKE(mon_idx, max_r_idx, s16b);
7787 if (direct_r_idx < 0)
7789 mode = visual_only ? 0x03 : 0x01;
7791 /* Check every group */
7792 for (i = 0; monster_group_text[i] != NULL; i++)
7794 /* Measure the label */
7795 len = strlen(monster_group_text[i]);
7797 /* Save the maximum length */
7798 if (len > max) max = len;
7800 /* See if any monsters are known */
7801 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7803 /* Build a list of groups with known monsters */
7804 grp_idx[grp_cnt++] = i;
7812 mon_idx[0] = direct_r_idx;
7815 /* Terminate the list */
7818 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7819 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7822 /* Terminate the list */
7823 grp_idx[grp_cnt] = -1;
7826 grp_cur = grp_top = 0;
7827 mon_cur = mon_top = 0;
7832 mode = visual_only ? 0x02 : 0x00;
7837 monster_race *r_ptr;
7844 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7845 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7846 prt("̾Á°", 4, max + 3);
7847 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7849 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7851 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7852 if (direct_r_idx < 0) prt("Group", 4, 0);
7853 prt("Name", 4, max + 3);
7854 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7856 if (!visual_only) prt("Kills", 4, 73);
7859 for (i = 0; i < 78; i++)
7861 Term_putch(i, 5, TERM_WHITE, '=');
7864 if (direct_r_idx < 0)
7866 for (i = 0; i < browser_rows; i++)
7868 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7875 if (direct_r_idx < 0)
7877 /* Scroll group list */
7878 if (grp_cur < grp_top) grp_top = grp_cur;
7879 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7881 /* Display a list of monster groups */
7882 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7884 if (old_grp_cur != grp_cur)
7886 old_grp_cur = grp_cur;
7888 /* Get a list of monsters in the current group */
7889 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
7892 /* Scroll monster list */
7893 while (mon_cur < mon_top)
7894 mon_top = MAX(0, mon_top - browser_rows/2);
7895 while (mon_cur >= mon_top + browser_rows)
7896 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7901 /* Display a list of monsters in the current group */
7902 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
7908 /* Display a monster name */
7909 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
7911 /* Display visual list below first monster */
7912 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7917 prt(format("<Êý¸þ>%s%s%s, ESC",
7918 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
7919 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
7920 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
7923 prt(format("<dir>%s%s%s, ESC",
7924 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7925 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7926 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7930 /* Get the current monster */
7931 r_ptr = &r_info[mon_idx[mon_cur]];
7935 /* Mega Hack -- track this monster race */
7936 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7938 /* Hack -- handle stuff */
7944 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7948 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7952 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7957 /* Do visual mode command if needed */
7958 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, need_redraw))
7960 if (direct_r_idx >= 0)
7985 /* Recall on screen */
7986 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
7988 screen_roff(mon_idx[mon_cur], 0);
7999 /* Move the cursor */
8000 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
8007 /* Free the "mon_idx" array */
8008 C_KILL(mon_idx, max_r_idx, s16b);
8013 * Display the objects in a group.
8015 static void display_object_list(int col, int row, int per_page, int object_idx[],
8016 int object_cur, int object_top, bool visual_only)
8020 /* Display lines until done */
8021 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8025 object_kind *flavor_k_ptr;
8027 /* Get the object index */
8028 int k_idx = object_idx[object_top + i];
8030 /* Access the object */
8031 object_kind *k_ptr = &k_info[k_idx];
8033 /* Choose a color */
8034 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8035 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8040 /* Appearance of this object is shuffled */
8041 flavor_k_ptr = &k_info[k_ptr->flavor];
8045 /* Appearance of this object is very normal */
8046 flavor_k_ptr = k_ptr;
8051 attr = ((i + object_top == object_cur) ? cursor : attr);
8053 if (!k_ptr->flavor || k_ptr->aware)
8056 strip_name(o_name, k_idx);
8061 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8064 /* Display the name */
8065 c_prt(attr, o_name, row + i, col);
8067 /* Hack -- visual_list mode */
8070 c_prt(attr, format("%02x/%02x", flavor_k_ptr->x_attr, flavor_k_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 64 : 68);
8072 if (p_ptr->wizard || visual_only)
8074 c_prt(attr, format("%d", k_idx), row + i, 70);
8077 a = flavor_k_ptr->x_attr;
8078 c = flavor_k_ptr->x_char;
8080 /* Display symbol */
8081 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8084 /* Clear remaining lines */
8085 for (; i < per_page; i++)
8087 Term_erase(col, row + i, 255);
8092 * Describe fake object
8094 static void desc_obj_fake(int k_idx)
8097 object_type object_type_body;
8099 /* Get local object */
8100 o_ptr = &object_type_body;
8102 /* Wipe the object */
8105 /* Create the artifact */
8106 object_prep(o_ptr, k_idx);
8108 /* It's fully know */
8109 o_ptr->ident |= IDENT_KNOWN;
8111 /* Track the object */
8112 /* object_actual_track(o_ptr); */
8114 /* Hack - mark as fake */
8115 /* term_obj_real = FALSE; */
8117 /* Hack -- Handle stuff */
8120 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
8123 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8125 msg_print("You see nothing special.");
8134 * Display known objects
8136 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8139 int grp_cur, grp_top, old_grp_cur;
8140 int object_old, object_cur, object_top;
8141 int grp_cnt, grp_idx[100];
8149 bool visual_list = FALSE;
8150 byte attr_top = 0, char_left = 0;
8158 Term_get_size(&wid, &hgt);
8160 browser_rows = hgt - 8;
8162 /* Allocate the "object_idx" array */
8163 C_MAKE(object_idx, max_k_idx, int);
8168 if (direct_k_idx < 0)
8170 mode = visual_only ? 0x03 : 0x01;
8172 /* Check every group */
8173 for (i = 0; object_group_text[i] != NULL; i++)
8175 /* Measure the label */
8176 len = strlen(object_group_text[i]);
8178 /* Save the maximum length */
8179 if (len > max) max = len;
8181 /* See if any monsters are known */
8182 if (collect_objects(i, object_idx, mode))
8184 /* Build a list of groups with known monsters */
8185 grp_idx[grp_cnt++] = i;
8194 object_kind *k_ptr = &k_info[direct_k_idx];
8195 object_kind *flavor_k_ptr;
8199 /* Appearance of this object is shuffled */
8200 flavor_k_ptr = &k_info[k_ptr->flavor];
8204 /* Appearance of this object is very normal */
8205 flavor_k_ptr = k_ptr;
8208 object_idx[0] = direct_k_idx;
8209 object_old = direct_k_idx;
8212 /* Terminate the list */
8215 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8216 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8219 /* Terminate the list */
8220 grp_idx[grp_cnt] = -1;
8223 grp_cur = grp_top = 0;
8224 object_cur = object_top = 0;
8229 mode = visual_only ? 0x02 : 0x00;
8234 object_kind *k_ptr, *flavor_k_ptr;
8241 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8242 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8243 prt("̾Á°", 4, max + 3);
8244 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8247 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8248 if (direct_k_idx < 0) prt("Group", 4, 0);
8249 prt("Name", 4, max + 3);
8250 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8254 for (i = 0; i < 78; i++)
8256 Term_putch(i, 5, TERM_WHITE, '=');
8259 if (direct_k_idx < 0)
8261 for (i = 0; i < browser_rows; i++)
8263 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8270 if (direct_k_idx < 0)
8272 /* Scroll group list */
8273 if (grp_cur < grp_top) grp_top = grp_cur;
8274 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8276 /* Display a list of object groups */
8277 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8279 if (old_grp_cur != grp_cur)
8281 old_grp_cur = grp_cur;
8283 /* Get a list of objects in the current group */
8284 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8287 /* Scroll object list */
8288 while (object_cur < object_top)
8289 object_top = MAX(0, object_top - browser_rows/2);
8290 while (object_cur >= object_top + browser_rows)
8291 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8296 /* Display a list of objects in the current group */
8297 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8301 object_top = object_cur;
8303 /* Display a list of objects in the current group */
8304 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8306 /* Display visual list below first object */
8307 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8310 /* Get the current object */
8311 k_ptr = &k_info[object_idx[object_cur]];
8315 /* Appearance of this object is shuffled */
8316 flavor_k_ptr = &k_info[k_ptr->flavor];
8320 /* Appearance of this object is very normal */
8321 flavor_k_ptr = k_ptr;
8326 prt(format("<Êý¸þ>%s%s%s, ESC",
8327 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8328 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8329 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8332 prt(format("<dir>%s%s%s, ESC",
8333 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8334 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8335 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8341 /* Mega Hack -- track this object */
8342 if (object_cnt) object_kind_track(object_idx[object_cur]);
8344 /* The "current" object changed */
8345 if (object_old != object_idx[object_cur])
8347 /* Hack -- handle stuff */
8350 /* Remember the "current" object */
8351 object_old = object_idx[object_cur];
8357 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8361 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8365 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8370 /* Do visual mode command if needed */
8371 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw))
8373 if (direct_k_idx >= 0)
8398 /* Recall on screen */
8399 if (!visual_list && !visual_only && (grp_cnt > 0))
8401 desc_obj_fake(object_idx[object_cur]);
8409 /* Move the cursor */
8410 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8416 /* Free the "object_idx" array */
8417 C_KILL(object_idx, max_k_idx, int);
8422 * Display the features in a group.
8424 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8425 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8427 int lit_col[F_LIT_MAX], i, j;
8428 int f_idx_col = use_bigtile ? 62 : 64;
8430 /* Correct columns 1 and 4 */
8431 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8432 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8433 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8435 /* Display lines until done */
8436 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8441 int f_idx = feat_idx[feat_top + i];
8443 /* Access the index */
8444 feature_type *f_ptr = &f_info[f_idx];
8446 int row_i = row + i;
8448 /* Choose a color */
8449 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8451 /* Display the name */
8452 c_prt(attr, f_name + f_ptr->name, row_i, col);
8454 /* Hack -- visual_list mode */
8457 /* Display lighting level */
8458 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8460 c_prt(attr, format("%02x/%02x", f_ptr->x_attr[lighting_level], f_ptr->x_char[lighting_level]), row_i, f_idx_col - ((p_ptr->wizard || visual_only) ? 6 : 2));
8462 if (p_ptr->wizard || visual_only)
8464 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8467 /* Display symbol */
8468 Term_queue_bigchar(lit_col[F_LIT_STANDARD], row_i, f_ptr->x_attr[F_LIT_STANDARD], f_ptr->x_char[F_LIT_STANDARD], 0, 0);
8470 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8471 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8473 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8475 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8477 /* Mega-hack -- Use non-standard colour */
8478 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8480 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8484 /* Clear remaining lines */
8485 for (; i < per_page; i++)
8487 Term_erase(col, row + i, 255);
8493 * Interact with feature visuals.
8495 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8498 int grp_cur, grp_top, old_grp_cur;
8499 int feat_cur, feat_top;
8500 int grp_cnt, grp_idx[100];
8508 bool visual_list = FALSE;
8509 byte attr_top = 0, char_left = 0;
8514 byte attr_old[F_LIT_MAX];
8515 byte char_old[F_LIT_MAX];
8516 byte *cur_attr_ptr, *cur_char_ptr;
8518 C_WIPE(attr_old, F_LIT_MAX, byte);
8519 C_WIPE(char_old, F_LIT_MAX, byte);
8522 Term_get_size(&wid, &hgt);
8524 browser_rows = hgt - 8;
8526 /* Allocate the "feat_idx" array */
8527 C_MAKE(feat_idx, max_f_idx, int);
8532 if (direct_f_idx < 0)
8534 /* Check every group */
8535 for (i = 0; feature_group_text[i] != NULL; i++)
8537 /* Measure the label */
8538 len = strlen(feature_group_text[i]);
8540 /* Save the maximum length */
8541 if (len > max) max = len;
8543 /* See if any features are known */
8544 if (collect_features(i, feat_idx, 0x01))
8546 /* Build a list of groups with known features */
8547 grp_idx[grp_cnt++] = i;
8555 feature_type *f_ptr = &f_info[direct_f_idx];
8557 feat_idx[0] = direct_f_idx;
8560 /* Terminate the list */
8563 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8564 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8566 for (i = 0; i < F_LIT_MAX; i++)
8568 attr_old[i] = f_ptr->x_attr[i];
8569 char_old[i] = f_ptr->x_char[i];
8573 /* Terminate the list */
8574 grp_idx[grp_cnt] = -1;
8577 grp_cur = grp_top = 0;
8578 feat_cur = feat_top = 0;
8586 feature_type *f_ptr;
8593 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8594 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8595 prt("̾Á°", 4, max + 3);
8598 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8599 prt("ʸ»ú ( l/ d)", 4, 66);
8603 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8604 prt("ʸ»ú (l/d)", 4, 68);
8607 prt("Visuals - features", 2, 0);
8608 if (direct_f_idx < 0) prt("Group", 4, 0);
8609 prt("Name", 4, max + 3);
8612 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8613 prt("Sym ( l/ d)", 4, 67);
8617 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8618 prt("Sym (l/d)", 4, 69);
8622 for (i = 0; i < 78; i++)
8624 Term_putch(i, 5, TERM_WHITE, '=');
8627 if (direct_f_idx < 0)
8629 for (i = 0; i < browser_rows; i++)
8631 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8638 if (direct_f_idx < 0)
8640 /* Scroll group list */
8641 if (grp_cur < grp_top) grp_top = grp_cur;
8642 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8644 /* Display a list of feature groups */
8645 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8647 if (old_grp_cur != grp_cur)
8649 old_grp_cur = grp_cur;
8651 /* Get a list of features in the current group */
8652 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8655 /* Scroll feature list */
8656 while (feat_cur < feat_top)
8657 feat_top = MAX(0, feat_top - browser_rows/2);
8658 while (feat_cur >= feat_top + browser_rows)
8659 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8664 /* Display a list of features in the current group */
8665 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8669 feat_top = feat_cur;
8671 /* Display a list of features in the current group */
8672 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8674 /* Display visual list below first object */
8675 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8680 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8681 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8682 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8685 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8686 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8687 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8691 /* Get the current feature */
8692 f_ptr = &f_info[feat_idx[feat_cur]];
8693 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8694 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8698 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8702 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8706 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8711 if (visual_list && ((ch == 'A') || (ch == 'a')))
8713 int prev_lighting_level = *lighting_level;
8717 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8718 else (*lighting_level)--;
8722 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8723 else (*lighting_level)++;
8726 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8727 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8729 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8730 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8735 else if ((ch == 'D') || (ch == 'd'))
8737 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8738 byte prev_x_char = f_ptr->x_char[*lighting_level];
8740 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8744 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8745 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8747 if (prev_x_char != f_ptr->x_char[*lighting_level])
8748 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8750 else *need_redraw = TRUE;
8755 /* Do visual mode command if needed */
8756 else if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, cur_attr_ptr, cur_char_ptr, need_redraw))
8760 /* Restore previous visual settings */
8762 for (i = 0; i < F_LIT_MAX; i++)
8764 f_ptr->x_attr[i] = attr_old[i];
8765 f_ptr->x_char[i] = char_old[i];
8772 if (direct_f_idx >= 0) flag = TRUE;
8773 else *lighting_level = F_LIT_STANDARD;
8776 /* Preserve current visual settings */
8779 for (i = 0; i < F_LIT_MAX; i++)
8781 attr_old[i] = f_ptr->x_attr[i];
8782 char_old[i] = f_ptr->x_char[i];
8784 *lighting_level = F_LIT_STANDARD;
8791 for (i = 0; i < F_LIT_MAX; i++)
8793 attr_idx_feat[i] = f_ptr->x_attr[i];
8794 char_idx_feat[i] = f_ptr->x_char[i];
8803 /* Allow TERM_DARK text */
8804 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8806 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8807 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8825 /* Move the cursor */
8826 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8832 /* Free the "feat_idx" array */
8833 C_KILL(feat_idx, max_f_idx, int);
8838 * List wanted monsters
8840 static void do_cmd_knowledge_kubi(void)
8845 char file_name[1024];
8848 /* Open a new file */
8849 fff = my_fopen_temp(file_name, 1024);
8852 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8854 msg_format("Failed to create temporary file %s.", file_name);
8862 bool listed = FALSE;
8865 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8867 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8869 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8871 fprintf(fff, "List of wanted monsters\n");
8873 fprintf(fff, "----------------------------------------------\n");
8875 for (i = 0; i < MAX_KUBI; i++)
8877 if (kubi_r_idx[i] <= 10000)
8879 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8888 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
8890 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
8895 /* Close the file */
8898 /* Display the file contents */
8900 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8902 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8906 /* Remove the file */
8911 * List virtues & status
8913 static void do_cmd_knowledge_virtues(void)
8917 char file_name[1024];
8920 /* Open a new file */
8921 fff = my_fopen_temp(file_name, 1024);
8924 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8926 msg_format("Failed to create temporary file %s.", file_name);
8935 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8937 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8942 /* Close the file */
8945 /* Display the file contents */
8947 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8949 show_file(TRUE, file_name, "Virtues", 0, 0);
8953 /* Remove the file */
8961 static void do_cmd_knowledge_dungeon(void)
8965 char file_name[1024];
8969 /* Open a new file */
8970 fff = my_fopen_temp(file_name, 1024);
8973 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8975 msg_format("Failed to create temporary file %s.", file_name);
8983 for (i = 1; i < max_d_idx; i++)
8987 if (!d_info[i].maxdepth) continue;
8988 if (!max_dlv[i]) continue;
8989 if (d_info[i].final_guardian)
8991 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8993 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8995 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8997 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9002 /* Close the file */
9005 /* Display the file contents */
9007 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
9009 show_file(TRUE, file_name, "Dungeon", 0, 0);
9013 /* Remove the file */
9018 * List virtues & status
9021 static void do_cmd_knowledge_stat(void)
9025 char file_name[1024];
9028 /* Open a new file */
9029 fff = my_fopen_temp(file_name, 1024);
9032 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9034 msg_format("Failed to create temporary file %s.", file_name);
9042 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9043 (2 * p_ptr->hitdie +
9044 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9047 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9048 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9049 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9051 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9052 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9053 fprintf(fff, "Limits of maximum stats\n\n");
9055 for (v_nr = 0; v_nr < 6; v_nr++)
9057 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);
9058 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9064 /* Close the file */
9067 /* Display the file contents */
9069 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9071 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9075 /* Remove the file */
9081 * Print all active quests
9083 static void do_cmd_knowledge_quests_current(FILE *fff)
9086 char rand_tmp_str[120] = "\0";
9088 monster_race *r_ptr;
9090 int rand_level = 100;
9094 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9096 fprintf(fff, "< Current Quest >\n");
9099 for (i = 1; i < max_quests; i++)
9101 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
9103 /* Set the quest number temporary */
9104 int old_quest = p_ptr->inside_quest;
9107 /* Clear the text */
9108 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9109 quest_text_line = 0;
9111 p_ptr->inside_quest = i;
9113 /* Get the quest text */
9114 init_flags = INIT_SHOW_TEXT;
9116 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9118 /* Reset the old quest number */
9119 p_ptr->inside_quest = old_quest;
9121 /* No info from "silent" quests */
9122 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9126 if (quest[i].type != QUEST_TYPE_RANDOM)
9128 char note[80] = "\0";
9130 if (quest[i].status == QUEST_STATUS_TAKEN)
9132 switch (quest[i].type)
9134 case QUEST_TYPE_KILL_LEVEL:
9135 case QUEST_TYPE_KILL_ANY_LEVEL:
9136 r_ptr = &r_info[quest[i].r_idx];
9137 strcpy(name, r_name + r_ptr->name);
9138 if (quest[i].max_num > 1)
9141 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9142 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9145 sprintf(note," - kill %d %s, have killed %d.",
9146 quest[i].max_num, name, quest[i].cur_num);
9151 sprintf(note," - %s¤òÅݤ¹¡£",name);
9153 sprintf(note," - kill %s.",name);
9157 case QUEST_TYPE_FIND_ARTIFACT:
9158 strcpy(name, a_name + a_info[quest[i].k_idx].name);
9160 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9162 sprintf(note," - Find out %s.", name);
9166 case QUEST_TYPE_FIND_EXIT:
9168 sprintf(note," - õº÷¤¹¤ë¡£");
9170 sprintf(note," - Search.");
9174 case QUEST_TYPE_KILL_NUMBER:
9176 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9177 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9179 sprintf(note," - Kill %d monsters, have killed %d.",
9180 quest[i].max_num, quest[i].cur_num);
9184 case QUEST_TYPE_KILL_ALL:
9186 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9188 sprintf(note," - Kill all monsters.");
9194 /* Print the quest info */
9196 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9197 quest[i].name, quest[i].level, note);
9199 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9200 quest[i].name, quest[i].level, note);
9203 fprintf(fff, tmp_str);
9205 if (quest[i].status == QUEST_STATUS_COMPLETED)
9208 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9210 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9212 fprintf(fff, tmp_str);
9218 while (quest_text[j][0] && j < 10)
9220 fprintf(fff, " %s\n", quest_text[j]);
9225 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9228 rand_level = quest[i].level;
9230 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9232 /* Print the quest info */
9233 r_ptr = &r_info[quest[i].r_idx];
9234 strcpy(name, r_name + r_ptr->name);
9236 if (quest[i].max_num > 1)
9239 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9240 quest[i].name, quest[i].level,
9241 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9245 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9246 quest[i].name, quest[i].level,
9247 quest[i].max_num, name, quest[i].cur_num);
9253 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9254 quest[i].name, quest[i].level, name);
9256 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9257 quest[i].name, quest[i].level, name);
9265 /* Print the current random quest */
9266 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
9269 if (!total) fprintf(fff, " ¤Ê¤·\n");
9271 if (!total) fprintf(fff, " Nothing.\n");
9277 * Print all finished quests
9279 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9286 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9288 fprintf(fff, "< Completed Quest >\n");
9290 for (i = 1; i < max_quests; i++)
9292 int q_idx = quest_num[i];
9294 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9296 if (is_fixed_quest_idx(q_idx))
9298 /* Set the quest number temporary */
9299 int old_quest = p_ptr->inside_quest;
9301 p_ptr->inside_quest = q_idx;
9304 init_flags = INIT_ASSIGN;
9306 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9308 /* Reset the old quest number */
9309 p_ptr->inside_quest = old_quest;
9311 /* No info from "silent" quests */
9312 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9317 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9319 /* Print the quest info */
9321 if (quest[q_idx].complev == 0)
9325 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9327 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9329 r_name+r_info[quest[q_idx].r_idx].name,
9330 quest[q_idx].level);
9336 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9338 " %-40s (Dungeon level: %3d) - level %2d\n",
9340 r_name+r_info[quest[q_idx].r_idx].name,
9342 quest[q_idx].complev);
9347 /* Print the quest info */
9349 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9350 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9352 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9353 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9357 fprintf(fff, tmp_str);
9361 if (!total) fprintf(fff, " ¤Ê¤·\n");
9363 if (!total) fprintf(fff, " Nothing.\n");
9369 * Print all failed quests
9371 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9378 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9380 fprintf(fff, "< Failed Quest >\n");
9382 for (i = 1; i < max_quests; i++)
9384 int q_idx = quest_num[i];
9386 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9388 if (is_fixed_quest_idx(q_idx))
9390 /* Set the quest number temporary */
9391 int old_quest = p_ptr->inside_quest;
9393 p_ptr->inside_quest = q_idx;
9395 /* Get the quest text */
9396 init_flags = INIT_ASSIGN;
9398 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9400 /* Reset the old quest number */
9401 p_ptr->inside_quest = old_quest;
9403 /* No info from "silent" quests */
9404 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9409 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9411 /* Print the quest info */
9413 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9414 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9416 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9417 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9422 /* Print the quest info */
9424 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9425 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9427 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9428 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9431 fprintf(fff, tmp_str);
9435 if (!total) fprintf(fff, " ¤Ê¤·\n");
9437 if (!total) fprintf(fff, " Nothing.\n");
9443 * Print all random quests
9445 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9452 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9454 fprintf(fff, "< Remaining Random Quest >\n");
9456 for (i = 1; i < max_quests; i++)
9458 /* No info from "silent" quests */
9459 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9461 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9465 /* Print the quest info */
9467 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9468 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9470 sprintf(tmp_str, " %s (%d, %s)\n",
9471 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9473 fprintf(fff, tmp_str);
9477 if (!total) fprintf(fff, " ¤Ê¤·\n");
9479 if (!total) fprintf(fff, " Nothing.\n");
9484 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9486 int *q_num = (int *)u;
9487 quest_type *qa = &quest[q_num[a]];
9488 quest_type *qb = &quest[q_num[b]];
9493 if (qa->complev < qb->complev) return TRUE;
9494 if (qa->complev > qb->complev) return FALSE;
9495 if (qa->level <= qb->level) return TRUE;
9499 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9501 int *q_num = (int *)u;
9508 q_num[a] = q_num[b];
9514 * Print quest status of all active quests
9516 static void do_cmd_knowledge_quests(void)
9519 char file_name[1024];
9520 int *quest_num, dummy, i;
9522 /* Open a new file */
9523 fff = my_fopen_temp(file_name, 1024);
9527 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9529 msg_format("Failed to create temporary file %s.", file_name);
9535 /* Allocate Memory */
9536 C_MAKE(quest_num, max_quests, int);
9538 /* Sort by compete level */
9539 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9540 ang_sort_comp = ang_sort_comp_quest_num;
9541 ang_sort_swap = ang_sort_swap_quest_num;
9542 ang_sort(quest_num, &dummy, max_quests);
9544 /* Dump Quest Information */
9545 do_cmd_knowledge_quests_current(fff);
9547 do_cmd_knowledge_quests_completed(fff, quest_num);
9549 do_cmd_knowledge_quests_failed(fff, quest_num);
9553 do_cmd_knowledge_quests_wiz_random(fff);
9556 /* Close the file */
9559 /* Display the file contents */
9561 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9563 show_file(TRUE, file_name, "Quest status", 0, 0);
9566 /* Remove the file */
9570 C_KILL(quest_num, max_quests, int);
9577 static void do_cmd_knowledge_home(void)
9582 char file_name[1024];
9584 char o_name[MAX_NLEN];
9587 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9589 /* Open a new file */
9590 fff = my_fopen_temp(file_name, 1024);
9593 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9595 msg_format("Failed to create temporary file %s.", file_name);
9603 /* Print all homes in the different towns */
9604 st_ptr = &town[1].store[STORE_HOME];
9606 /* Home -- if anything there */
9607 if (st_ptr->stock_num)
9612 /* Header with name of the town */
9614 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9616 fprintf(fff, " [Home Inventory]\n");
9619 /* Dump all available items */
9620 for (i = 0; i < st_ptr->stock_num; i++)
9623 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9624 object_desc(o_name, &st_ptr->stock[i], 0);
9625 if (strlen(o_name) <= 80-3)
9627 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9633 for (n = 0, t = o_name; n < 80-3; n++, t++)
9634 if(iskanji(*t)) {t++; n++;}
9635 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9637 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9638 fprintf(fff, " %.77s\n", o_name+n);
9641 object_desc(o_name, &st_ptr->stock[i], 0);
9642 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9647 /* Add an empty line */
9648 fprintf(fff, "\n\n");
9652 /* Close the file */
9655 /* Display the file contents */
9657 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9659 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9663 /* Remove the file */
9669 * Check the status of "autopick"
9671 static void do_cmd_knowledge_autopick(void)
9675 char file_name[1024];
9677 /* Open a new file */
9678 fff = my_fopen_temp(file_name, 1024);
9683 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9685 msg_format("Failed to create temporary file %s.", file_name);
9694 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9696 fprintf(fff, "No preference for auto picker/destroyer.");
9702 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9704 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9708 for (k = 0; k < max_autopick; k++)
9711 byte act = autopick_list[k].action;
9712 if (act & DONT_AUTOPICK)
9720 else if (act & DO_AUTODESTROY)
9728 else if (act & DO_AUTOPICK)
9736 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9745 if (act & DO_DISPLAY)
9746 fprintf(fff, "%11s", format("[%s]", tmp));
9748 fprintf(fff, "%11s", format("(%s)", tmp));
9750 tmp = autopick_line_from_entry(&autopick_list[k]);
9751 fprintf(fff, " %s", tmp);
9755 /* Close the file */
9757 /* Display the file contents */
9759 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9761 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9764 /* Remove the file */
9770 * Interact with "knowledge"
9772 void do_cmd_knowledge(void)
9775 bool need_redraw = FALSE;
9777 /* File type is "TEXT" */
9778 FILE_TYPE(FILE_TYPE_TEXT);
9780 /* Save the screen */
9783 /* Interact until done */
9789 /* Ask for a choice */
9791 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9792 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9794 prt(format("page %d/2", (p+1)), 2, 65);
9795 prt("Display current knowledge", 3, 0);
9798 /* Give some choices */
9802 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9803 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9804 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9805 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9806 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9807 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9808 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9809 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9810 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9811 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9815 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9816 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9817 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9818 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9819 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9820 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9821 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9822 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9823 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9828 prt("(1) Display known artifacts", 6, 5);
9829 prt("(2) Display known objects", 7, 5);
9830 prt("(3) Display remaining uniques", 8, 5);
9831 prt("(4) Display known monster", 9, 5);
9832 prt("(5) Display kill count", 10, 5);
9833 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9834 prt("(7) Display current pets", 12, 5);
9835 prt("(8) Display home inventory", 13, 5);
9836 prt("(9) Display *identified* equip.", 14, 5);
9837 prt("(0) Display terrain symbols.", 15, 5);
9841 prt("(a) Display about yourself", 6, 5);
9842 prt("(b) Display mutations", 7, 5);
9843 prt("(c) Display weapon proficiency", 8, 5);
9844 prt("(d) Display spell proficiency", 9, 5);
9845 prt("(e) Display misc. proficiency", 10, 5);
9846 prt("(f) Display virtues", 11, 5);
9847 prt("(g) Display dungeons", 12, 5);
9848 prt("(h) Display current quests", 13, 5);
9849 prt("(i) Display auto pick/destroy", 14, 5);
9854 prt("-³¤¯-", 17, 8);
9855 prt("ESC) È´¤±¤ë", 21, 1);
9856 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9857 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9858 prt("¥³¥Þ¥ó¥É:", 20, 0);
9860 prt("-more-", 17, 8);
9861 prt("ESC) Exit menu", 21, 1);
9862 prt("SPACE) Next page", 21, 30);
9863 /*prt("-) Previous page", 21, 60);*/
9864 prt("Command: ", 20, 0);
9871 if (i == ESCAPE) break;
9874 case ' ': /* Page change */
9878 case '1': /* Artifacts */
9879 do_cmd_knowledge_artifacts();
9881 case '2': /* Objects */
9882 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
9884 case '3': /* Uniques */
9885 do_cmd_knowledge_uniques();
9887 case '4': /* Monsters */
9888 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
9890 case '5': /* Kill count */
9891 do_cmd_knowledge_kill_count();
9893 case '6': /* wanted */
9894 if (!vanilla_town) do_cmd_knowledge_kubi();
9896 case '7': /* Pets */
9897 do_cmd_knowledge_pets();
9899 case '8': /* Home */
9900 do_cmd_knowledge_home();
9902 case '9': /* Resist list */
9903 do_cmd_knowledge_inven();
9905 case '0': /* Feature list */
9907 int lighting_level = F_LIT_STANDARD;
9908 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
9912 case 'a': /* Max stat */
9913 do_cmd_knowledge_stat();
9915 case 'b': /* Mutations */
9916 do_cmd_knowledge_mutations();
9918 case 'c': /* weapon-exp */
9919 do_cmd_knowledge_weapon_exp();
9921 case 'd': /* spell-exp */
9922 do_cmd_knowledge_spell_exp();
9924 case 'e': /* skill-exp */
9925 do_cmd_knowledge_skill_exp();
9927 case 'f': /* Virtues */
9928 do_cmd_knowledge_virtues();
9930 case 'g': /* Dungeon */
9931 do_cmd_knowledge_dungeon();
9933 case 'h': /* Quests */
9934 do_cmd_knowledge_quests();
9936 case 'i': /* Autopick */
9937 do_cmd_knowledge_autopick();
9939 default: /* Unknown option */
9943 /* Flush messages */
9947 /* Restore the screen */
9950 if (need_redraw) do_cmd_redraw();
9955 * Check on the status of an active quest
9957 void do_cmd_checkquest(void)
9959 /* File type is "TEXT" */
9960 FILE_TYPE(FILE_TYPE_TEXT);
9962 /* Save the screen */
9966 do_cmd_knowledge_quests();
9968 /* Restore the screen */
9974 * Display the time and date
9976 void do_cmd_time(void)
9978 int day, hour, min, full, start, end, num;
9986 extract_day_hour_min(&day, &hour, &min);
9988 full = hour * 100 + min;
9996 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9998 strcpy(desc, "It is a strange time.");
10002 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
10003 else strcpy(day_buf, "*****");
10007 msg_format("%sÆüÌÜ, »þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
10008 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10009 min, (hour < 12) ? "AM" : "PM");
10011 msg_format("This is day %s. The time is %d:%02d %s.",
10012 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10013 min, (hour < 12) ? "AM" : "PM");
10017 /* Find the path */
10018 if (!randint0(10) || p_ptr->image)
10021 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10023 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10030 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10032 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10037 /* Open this file */
10038 fff = my_fopen(buf, "rt");
10043 /* Find this time */
10044 while (!my_fgets(fff, buf, sizeof(buf)))
10046 /* Ignore comments */
10047 if (!buf[0] || (buf[0] == '#')) continue;
10049 /* Ignore invalid lines */
10050 if (buf[1] != ':') continue;
10052 /* Process 'Start' */
10055 /* Extract the starting time */
10056 start = atoi(buf + 2);
10058 /* Assume valid for an hour */
10065 /* Process 'End' */
10068 /* Extract the ending time */
10069 end = atoi(buf + 2);
10075 /* Ignore incorrect range */
10076 if ((start > full) || (full > end)) continue;
10078 /* Process 'Description' */
10083 /* Apply the randomizer */
10084 if (!randint0(num)) strcpy(desc, buf + 2);
10094 /* Close the file */