4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Interface commands */
18 * A set of functions to maintain automatic dumps of various kinds.
21 * remove_auto_dump(orig_file, mark)
22 * Remove the old automatic dump of type "mark".
23 * auto_dump_printf(fmt, ...)
24 * Dump a formatted string using fprintf().
25 * open_auto_dump(buf, mark)
26 * Open a file, remove old dump, and add new header.
27 * close_auto_dump(void)
28 * Add a footer, and close the file.
30 * The dump commands of original Angband simply add new lines to
31 * existing files; these files will become bigger and bigger unless
32 * an user deletes some or all of these files by hand at some
35 * These three functions automatically delete old dumped lines
36 * before adding new ones. Since there are various kinds of automatic
37 * dumps in a single file, we add a header and a footer with a type
38 * name for every automatic dump, and kill old lines only when the
39 * lines have the correct type of header and footer.
41 * We need to be quite paranoid about correctness; the user might
42 * (mistakenly) edit the file by hand, and see all their work come
43 * to nothing on the next auto dump otherwise. The current code only
44 * detects changes by noting inconsistencies between the actual number
45 * of lines and the number written in the footer. Note that this will
46 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
63 * Remove old lines automatically generated before.
65 static void remove_auto_dump(cptr orig_file)
67 FILE *tmp_fff, *orig_fff;
71 bool between_mark = FALSE;
74 long header_location = 0;
75 char header_mark_str[80];
76 char footer_mark_str[80];
79 /* Prepare a header/footer mark string */
80 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
81 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
83 mark_len = strlen(footer_mark_str);
85 /* Open an old dump file in read-only mode */
86 orig_fff = my_fopen(orig_file, "r");
88 /* If original file does not exist, nothing to do */
89 if (!orig_fff) return;
91 /* Open a new (temporary) file */
92 tmp_fff = my_fopen_temp(tmp_file, 1024);
97 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", tmp_file);
99 msg_format("Failed to create temporary file %s.", tmp_file);
105 /* Loop for every line */
109 if (my_fgets(orig_fff, buf, sizeof(buf)))
111 /* Read error: Assume End of File */
114 * Was looking for the footer, but not found.
116 * Since automatic dump might be edited by hand,
117 * it's dangerous to kill these lines.
118 * Seek back to the next line of the (pseudo) header,
123 fseek(orig_fff, header_location, SEEK_SET);
124 between_mark = FALSE;
128 /* Success -- End the loop */
135 /* We are looking for the header mark of automatic dump */
138 /* Is this line a header? */
139 if (!strcmp(buf, header_mark_str))
141 /* Memorise seek point of this line */
142 header_location = ftell(orig_fff);
144 /* Initialize counter for number of lines */
147 /* Look for the footer from now */
150 /* There are some changes */
157 /* Copy orginally lines */
158 fprintf(tmp_fff, "%s\n", buf);
162 /* We are looking for the footer mark of automatic dump */
165 /* Is this line a footer? */
166 if (!strncmp(buf, footer_mark_str, mark_len))
171 * Compare the number of lines
173 * If there is an inconsistency between
174 * actual number of lines and the
175 * number here, the automatic dump
176 * might be edited by hand. So it's
177 * dangerous to kill these lines.
178 * Seek back to the next line of the
179 * (pseudo) header, and read again.
181 if (!sscanf(buf + mark_len, " (%d)", &tmp)
184 fseek(orig_fff, header_location, SEEK_SET);
187 /* Look for another header */
188 between_mark = FALSE;
194 /* Ignore old line, and count number of lines */
204 /* If there are some changes, overwrite the original file with new one */
207 /* Copy contents of temporary file */
209 tmp_fff = my_fopen(tmp_file, "r");
210 orig_fff = my_fopen(orig_file, "w");
212 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
213 fprintf(orig_fff, "%s\n", buf);
219 /* Kill the temporary file */
227 * Dump a formatted line, using "vstrnfmt()".
229 static void auto_dump_printf(cptr fmt, ...)
236 /* Begin the Varargs Stuff */
239 /* Format the args, save the length */
240 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
242 /* End the Varargs Stuff */
245 /* Count number of lines */
246 for (p = buf; *p; p++)
248 if (*p == '\n') auto_dump_line_num++;
252 fprintf(auto_dump_stream, "%s", buf);
257 * Open file to append auto dump.
259 static bool open_auto_dump(cptr buf, cptr mark)
262 char header_mark_str[80];
264 /* Save the mark string */
265 auto_dump_mark = mark;
267 /* Prepare a header mark string */
268 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
270 /* Remove old macro dumps */
271 remove_auto_dump(buf);
273 /* Append to the file */
274 auto_dump_stream = my_fopen(buf, "a");
277 if (!auto_dump_stream) {
279 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
281 msg_format("Failed to open %s.", buf);
290 fprintf(auto_dump_stream, "%s\n", header_mark_str);
292 /* Initialize counter */
293 auto_dump_line_num = 0;
296 auto_dump_printf("# *·Ù¹ð!!* °Ê¹ß¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
297 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
299 auto_dump_printf("# *Warning!* The lines below are an automatic dump.\n");
300 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
308 * Append foot part and close auto dump.
310 static void close_auto_dump(void)
312 char footer_mark_str[80];
314 /* Prepare a footer mark string */
315 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
318 auto_dump_printf("# *·Ù¹ð!!* °Ê¾å¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
319 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
321 auto_dump_printf("# *Warning!* The lines above are an automatic dump.\n");
322 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
326 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
329 my_fclose(auto_dump_stream);
337 * Return suffix of ordinal number
339 cptr get_ordinal_number_suffix(int num)
341 num = ABS(num) % 100;
345 return (num == 11) ? "th" : "st";
347 return (num == 12) ? "th" : "nd";
349 return (num == 13) ? "th" : "rd";
358 * Take note to the diary.
360 errr do_cmd_write_nikki(int type, int num, cptr note)
366 cptr note_level = "";
367 bool do_level = TRUE;
368 char note_level_buf[40];
371 static bool disable_nikki = FALSE;
373 extract_day_hour_min(&day, &hour, &min);
375 if (disable_nikki) return(-1);
377 if (type == NIKKI_FIX_QUEST_C ||
378 type == NIKKI_FIX_QUEST_F ||
379 type == NIKKI_RAND_QUEST_C ||
380 type == NIKKI_RAND_QUEST_F ||
381 type == NIKKI_TO_QUEST)
385 old_quest = p_ptr->inside_quest;
386 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
388 /* Get the quest text */
389 init_flags = INIT_ASSIGN;
391 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
393 /* Reset the old quest number */
394 p_ptr->inside_quest = old_quest;
398 sprintf(file_name,"playrecord-%s.txt",savefile_base);
400 /* different filne name to avoid mixing */
401 sprintf(file_name,"playrec-%s.txt",savefile_base);
404 /* Build the filename */
405 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
407 /* File type is "TEXT" */
408 FILE_TYPE(FILE_TYPE_TEXT);
410 fff = my_fopen(buf, "a");
416 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
418 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
425 q_idx = quest_number(dun_level);
429 if (p_ptr->inside_arena)
431 note_level = "¥¢¥ê¡¼¥Ê:";
433 note_level = "Arane:";
437 note_level = "ÃϾå:";
439 note_level = "Surface:";
441 else if (q_idx && (is_fixed_quest_idx(q_idx)
442 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
444 note_level = "¥¯¥¨¥¹¥È:";
446 note_level = "Quest:";
451 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
453 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
455 note_level = note_level_buf;
464 fprintf(fff, "%dÆüÌÜ\n",day);
466 fprintf(fff, "Day %d\n",day);
475 fprintf(fff, "%s\n",note);
479 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
485 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
487 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
494 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
496 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
500 case NIKKI_FIX_QUEST_C:
502 if (quest[num].flags & QUEST_FLAG_SILENT) break;
504 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
506 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
510 case NIKKI_FIX_QUEST_F:
512 if (quest[num].flags & QUEST_FLAG_SILENT) break;
514 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
516 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
520 case NIKKI_RAND_QUEST_C:
523 strcpy(name, r_name+r_info[quest[num].r_idx].name);
525 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
527 fprintf(fff, " %2d:%02d %20s completed random quest '%s'\n", hour, min, note_level, name);
531 case NIKKI_RAND_QUEST_F:
534 strcpy(name, r_name+r_info[quest[num].r_idx].name);
536 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
538 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
542 case NIKKI_MAXDEAPTH:
545 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
547 fprintf(fff, " %2d:%02d %20s reached level %d of %s for the first time.\n", hour, min, note_level, num, d_name+d_info[dungeon_type].name);
554 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
556 fprintf(fff, " %2d:%02d %20s reset recall level of %s to %d %s.\n", hour, min, note_level, d_name + d_info[num].name, max_dlv[num], note);
563 if (q_idx && (is_fixed_quest_idx(q_idx)
564 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
575 if (!(dun_level+num)) to = "ÃϾå";
576 else to = format("%d³¬", dun_level+num);
578 if (!(dun_level+num)) to = "the surface";
579 else to = format("level %d", dun_level+num);
584 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
586 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
594 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
596 fprintf(fff, " %2d:%02d %20s recalled to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
600 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
602 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
608 if (quest[num].flags & QUEST_FLAG_SILENT) break;
610 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
612 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
619 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
621 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
628 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
630 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
637 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
639 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
648 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, -num, note);
651 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, get_ordinal_number_suffix(n));
656 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
658 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, get_ordinal_number_suffix(num), note);
660 if (num == MAX_ARENA_MONS)
663 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
665 fprintf(fff, " won all fight to become a Chanpion.\n");
674 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
676 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
691 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
693 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
697 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
699 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
714 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
716 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
720 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
722 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
729 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
731 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
735 case NIKKI_GAMESTART:
737 time_t ct = time((time_t*)0);
741 fprintf(fff, "%s %s",note, ctime(&ct));
744 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
747 case NIKKI_NAMED_PET:
749 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
754 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
756 fprintf(fff, "decided to travel together with %s.\n", note);
761 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
763 fprintf(fff, "unnamed %s.\n", note);
768 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
770 fprintf(fff, "dismissed %s.\n", note);
775 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
777 fprintf(fff, "%s died.\n", note);
782 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
784 fprintf(fff, "moved to another map leaving %s behind.\n", note);
789 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
791 fprintf(fff, "lost sight of %s.\n", note);
796 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
798 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
803 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
805 fprintf(fff, "%s was crushed by falling rocks.\n", note);
810 fprintf(fff, "%s¤¬¥Æ¥ì¥Ý¡¼¥È¡¦¥ì¥Ù¥ë¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
812 fprintf(fff, "%s was made disappeared by teleport level.\n", note);
827 if (do_level) write_level = FALSE;
833 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
835 static void do_cmd_disp_nikki(void)
837 char nikki_title[256];
842 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
843 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
854 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
855 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
856 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
857 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
862 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
871 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
873 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
874 "Attack is the best form of defence.",
876 "An unexpected windfall",
877 "A drowning man will catch at a straw",
878 "Don't count your chickens before they are hatched.",
879 "It is no use crying over spilt milk.",
880 "Seeing is believing.",
881 "Strike the iron while it is hot.",
882 "I don't care what follows.",
883 "To dig a well to put out a house on fire.",
884 "Tomorrow is another day.",
885 "Easy come, easy go.",
886 "The more haste, the less speed.",
887 "Where there is life, there is hope.",
888 "There is no royal road to *WINNER*.",
889 "Danger past, God forgotten.",
890 "The best thing to do now is to run away.",
891 "Life is but an empty dream.",
892 "Dead men tell no tales.",
893 "A book that remains shut is but a block.",
894 "Misfortunes never come singly.",
895 "A little knowledge is a dangerous thing.",
896 "History repeats itself.",
897 "*WINNER* was not built in a day.",
898 "Ignorance is bliss.",
899 "To lose is to win?",
900 "No medicine can cure folly.",
901 "All good things come to an end.",
902 "M$ Empire strikes back.",
903 "To see is to believe",
905 "Quest of The World's Greatest Brain"};
908 sprintf(file_name,"playrecord-%s.txt",savefile_base);
910 sprintf(file_name,"playrec-%s.txt",savefile_base);
913 /* Build the filename */
914 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
916 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
917 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
918 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
919 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
920 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
923 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
924 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
926 sprintf(nikki_title, "Legend of %s %s '%s'",
927 ap_ptr->title, player_name, tmp);
930 /* Display the file contents */
931 show_file(FALSE, buf, nikki_title, -1, 0);
934 static void do_cmd_bunshou(void)
937 char bunshou[80] = "\0";
940 if (get_string("ÆâÍÆ: ", tmp, 79))
942 if (get_string("diary note: ", tmp, 79))
945 strcpy(bunshou, tmp);
947 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
951 static void do_cmd_last_get(void)
956 if (record_o_name[0] == '\0') return;
959 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
961 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
963 if (!get_check(buf)) return;
968 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
970 sprintf(buf,"descover %s.", record_o_name);
972 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
976 static void do_cmd_erase_nikki(void)
983 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
985 if (!get_check("Do you really want to delete all your record? ")) return;
989 sprintf(file_name,"playrecord-%s.txt",savefile_base);
991 sprintf(file_name,"playrec-%s.txt",savefile_base);
994 /* Build the filename */
995 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
997 /* Remove the file */
1000 fff = my_fopen(buf, "w");
1004 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
1006 msg_format("deleted record.");
1010 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1012 msg_format("failed to delete %s.", buf);
1019 void do_cmd_nikki(void)
1023 /* File type is "TEXT" */
1024 FILE_TYPE(FILE_TYPE_TEXT);
1026 /* Save the screen */
1029 /* Interact until done */
1035 /* Ask for a choice */
1037 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1039 prt("[ Play Record ]", 2, 0);
1043 /* Give some choices */
1045 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1046 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1047 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1048 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1050 prt("(1) Display your record", 4, 5);
1051 prt("(2) Add record", 5, 5);
1052 prt("(3) Record item you last get/identify", 6, 5);
1053 prt("(4) Delete your record", 7, 5);
1059 prt("¥³¥Þ¥ó¥É:", 18, 0);
1061 prt("Command: ", 18, 0);
1069 if (i == ESCAPE) break;
1074 do_cmd_disp_nikki();
1083 do_cmd_erase_nikki();
1085 default: /* Unknown option */
1089 /* Flush messages */
1093 /* Restore the screen */
1098 * Hack -- redraw the screen
1100 * This command performs various low level updates, clears all the "extra"
1101 * windows, does a total redraw of the main window, and requests all of the
1102 * interesting updates and redraws that I can think of.
1104 * This command is also used to "instantiate" the results of the user
1105 * selecting various things, such as graphics mode, so it must call
1106 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1108 void do_cmd_redraw(void)
1115 /* Hack -- react to changes */
1116 Term_xtra(TERM_XTRA_REACT, 0);
1119 /* Combine and Reorder the pack (later) */
1120 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1124 p_ptr->update |= (PU_TORCH);
1127 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1129 /* Forget lite/view */
1130 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1132 /* Update lite/view */
1133 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1135 /* Update monsters */
1136 p_ptr->update |= (PU_MONSTERS);
1138 /* Redraw everything */
1139 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1142 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1145 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1149 /* Hack -- update */
1152 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1155 /* Redraw every window */
1156 for (j = 0; j < 8; j++)
1159 if (!angband_term[j]) continue;
1162 Term_activate(angband_term[j]);
1177 * Hack -- change name
1179 void do_cmd_change_name(void)
1188 /* Save the screen */
1196 /* Display the player */
1197 display_player(mode);
1202 display_player(mode);
1207 Term_putstr(2, 23, -1, TERM_WHITE,
1208 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1210 Term_putstr(2, 23, -1, TERM_WHITE,
1211 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1219 if (c == ESCAPE) break;
1226 /* Process the player name */
1227 process_player_name(FALSE);
1233 sprintf(tmp, "%s.txt", player_base);
1235 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1237 if (get_string("File name: ", tmp, 80))
1241 if (tmp[0] && (tmp[0] != ' '))
1243 file_character(tmp);
1260 /* Flush messages */
1264 /* Restore the screen */
1267 /* Redraw everything */
1268 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1275 * Recall the most recent message
1277 void do_cmd_message_one(void)
1279 /* Recall one message XXX XXX XXX */
1280 prt(format("> %s", message_str(0)), 0, 0);
1285 * Show previous messages to the user -BEN-
1287 * The screen format uses line 0 and 23 for headers and prompts,
1288 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1290 * This command shows you which commands you are viewing, and allows
1291 * you to "search" for strings in the recall.
1293 * Note that messages may be longer than 80 characters, but they are
1294 * displayed using "infinite" length, with a special sub-command to
1295 * "slide" the virtual display to the left or right.
1297 * Attempt to only hilite the matching portions of the string.
1299 void do_cmd_messages(int num_now)
1309 Term_get_size(&wid, &hgt);
1311 /* Number of message lines in a screen */
1312 num_lines = hgt - 4;
1321 /* Total messages */
1324 /* Start on first message */
1327 /* Save the screen */
1333 /* Process requests until done */
1339 /* Dump up to 20 lines of messages */
1340 for (j = 0; (j < num_lines) && (i + j < n); j++)
1342 cptr msg = message_str(i+j);
1344 /* Dump the messages, bottom to top */
1345 c_prt((i+j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1347 /* Hilite "shower" */
1352 /* Display matches */
1353 while ((str = my_strstr(str, shower)) != NULL)
1355 int len = strlen(shower);
1357 /* Display the match */
1358 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1366 /* Erase remaining lines */
1367 for (; j < num_lines; j++)
1369 Term_erase(0, num_lines + 1 - j, 255);
1372 /* Display header XXX XXX XXX */
1375 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1376 i, i+j-1, n), 0, 0);
1378 prt(format("Message Recall (%d-%d of %d)",
1379 i, i+j-1, n), 0, 0);
1383 /* Display prompt (not very informative) */
1385 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1387 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1392 skey = inkey_special(TRUE);
1394 /* Exit on Escape */
1395 if (skey == ESCAPE) break;
1397 /* Hack -- Save the old index */
1400 /* Hack -- handle show */
1405 prt("¶¯Ä´: ", hgt - 1, 0);
1407 prt("Show: ", hgt - 1, 0);
1411 /* Get a "shower" string, or continue */
1412 if (!askfor(shower, 80)) continue;
1418 /* Hack -- handle find */
1419 if (skey == '/' || skey == KTRL('s'))
1425 prt("¸¡º÷: ", hgt - 1, 0);
1427 prt("Find: ", hgt - 1, 0);
1431 /* Get a "finder" string, or continue */
1432 if (!askfor(finder, 80)) continue;
1435 strcpy(shower, finder);
1438 for (z = i + 1; z < n; z++)
1440 cptr msg = message_str(z);
1443 if (my_strstr(msg, finder))
1454 /* Recall 1 older message */
1455 if (skey == SKEY_TOP)
1457 /* Go to the oldest line */
1461 /* Recall 1 newer message */
1462 if (skey == SKEY_BOTTOM)
1464 /* Go to the newest line */
1468 /* Recall 1 older message */
1469 if (skey == '8' || skey == SKEY_UP || skey == '\n' || skey == '\r')
1471 /* Go older if legal */
1472 i = MIN(i + 1, n - num_lines);
1475 /* Recall 10 older messages */
1478 /* Go older if legal */
1479 i = MIN(i + 10, n - num_lines);
1482 /* Recall 20 older messages */
1483 if (skey == 'p' || skey == KTRL('P') || skey == ' ' || skey == SKEY_PGUP)
1485 /* Go older if legal */
1486 i = MIN(i + num_lines, n - num_lines);
1489 /* Recall 20 newer messages */
1490 if (skey == 'n' || skey == KTRL('N') || skey == SKEY_PGDOWN)
1492 /* Go newer (if able) */
1493 i = MAX(0, i - num_lines);
1496 /* Recall 10 newer messages */
1499 /* Go newer (if able) */
1503 /* Recall 1 newer messages */
1504 if (skey == '2' || skey == SKEY_DOWN)
1506 /* Go newer (if able) */
1510 /* Hack -- Error of some kind */
1514 /* Restore the screen */
1521 * Number of cheating options
1528 static option_type cheat_info[CHEAT_MAX] =
1530 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1532 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1534 "cheat_peek", "Peek into object creation"
1538 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1540 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1542 "cheat_hear", "Peek into monster creation"
1546 { &cheat_room, FALSE, 255, 0x04, 0x00,
1548 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1550 "cheat_room", "Peek into dungeon creation"
1554 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1556 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1558 "cheat_xtra", "Peek into something else"
1562 { &cheat_know, FALSE, 255, 0x10, 0x00,
1564 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1566 "cheat_know", "Know complete monster info"
1570 { &cheat_live, FALSE, 255, 0x20, 0x00,
1572 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1574 "cheat_live", "Allow player to avoid death"
1578 { &cheat_save, FALSE, 255, 0x40, 0x00,
1580 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1582 "cheat_save", "Ask for saving death"
1588 * Interact with some options for cheating
1590 static void do_cmd_options_cheat(cptr info)
1594 int i, k = 0, n = CHEAT_MAX;
1602 /* Interact with the player */
1607 /* Prompt XXX XXX XXX */
1609 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1611 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1617 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1618 prt(" << Ãí°Õ >>", 11, 0);
1619 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1620 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1621 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1623 /* Display the options */
1624 for (i = 0; i < n; i++)
1626 byte a = TERM_WHITE;
1628 /* Color current option */
1629 if (i == k) a = TERM_L_BLUE;
1631 /* Display the option text */
1632 sprintf(buf, "%-48s: %s (%s)",
1633 cheat_info[i].o_desc,
1635 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1637 (*cheat_info[i].o_var ? "yes" : "no "),
1640 cheat_info[i].o_text);
1641 c_prt(a, buf, i + 2, 0);
1644 /* Hilite current option */
1645 move_cursor(k + 2, 50);
1651 * HACK - Try to translate the key into a direction
1652 * to allow using the roguelike keys for navigation.
1654 dir = get_keymap_dir(ch);
1655 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1669 k = (n + k - 1) % n;
1688 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1690 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1692 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1693 (*cheat_info[k].o_var) = TRUE;
1702 (*cheat_info[k].o_var) = FALSE;
1710 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1712 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1714 /* Peruse the help file */
1715 (void)show_file(TRUE, buf, NULL, 0, 0);
1731 static option_type autosave_info[2] =
1733 { &autosave_l, FALSE, 255, 0x01, 0x00,
1735 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1737 "autosave_l", "Autosave when entering new levels" },
1741 { &autosave_t, FALSE, 255, 0x02, 0x00,
1743 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1745 "autosave_t", "Timed autosave" },
1751 static s16b toggle_frequency(s16b current)
1756 case 50: return 100;
1757 case 100: return 250;
1758 case 250: return 500;
1759 case 500: return 1000;
1760 case 1000: return 2500;
1761 case 2500: return 5000;
1762 case 5000: return 10000;
1763 case 10000: return 25000;
1770 * Interact with some options for cheating
1772 static void do_cmd_options_autosave(cptr info)
1776 int i, k = 0, n = 2;
1784 /* Interact with the player */
1787 /* Prompt XXX XXX XXX */
1789 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1791 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1796 /* Display the options */
1797 for (i = 0; i < n; i++)
1799 byte a = TERM_WHITE;
1801 /* Color current option */
1802 if (i == k) a = TERM_L_BLUE;
1804 /* Display the option text */
1805 sprintf(buf, "%-48s: %s (%s)",
1806 autosave_info[i].o_desc,
1808 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1810 (*autosave_info[i].o_var ? "yes" : "no "),
1813 autosave_info[i].o_text);
1814 c_prt(a, buf, i + 2, 0);
1818 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1820 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1825 /* Hilite current option */
1826 move_cursor(k + 2, 50);
1842 k = (n + k - 1) % n;
1860 (*autosave_info[k].o_var) = TRUE;
1869 (*autosave_info[k].o_var) = FALSE;
1877 autosave_freq = toggle_frequency(autosave_freq);
1879 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1880 autosave_freq), 5, 0);
1882 prt(format("Timed autosave frequency: every %d turns",
1883 autosave_freq), 5, 0);
1891 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1893 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1912 * Interact with some options
1914 void do_cmd_options_aux(int page, cptr info)
1917 int i, k = 0, n = 0, l;
1920 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1921 (!p_ptr->wizard || !allow_debug_opts);
1924 /* Lookup the options */
1925 for (i = 0; i < 24; i++) opt[i] = 0;
1927 /* Scan the options */
1928 for (i = 0; option_info[i].o_desc; i++)
1930 /* Notice options on this "page" */
1931 if (option_info[i].o_page == page) opt[n++] = i;
1938 /* Interact with the player */
1943 /* Prompt XXX XXX XXX */
1945 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
1947 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
1953 /* HACK -- description for easy-auto-destroy options */
1955 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1957 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1960 /* Display the options */
1961 for (i = 0; i < n; i++)
1963 byte a = TERM_WHITE;
1965 /* Color current option */
1966 if (i == k) a = TERM_L_BLUE;
1968 /* Display the option text */
1969 sprintf(buf, "%-48s: %s (%.19s)",
1970 option_info[opt[i]].o_desc,
1972 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1974 (*option_info[opt[i]].o_var ? "yes" : "no "),
1977 option_info[opt[i]].o_text);
1978 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1979 else c_prt(a, buf, i + 2, 0);
1982 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1985 /* Hilite current option */
1986 move_cursor(k + 2 + l, 50);
1992 * HACK - Try to translate the key into a direction
1993 * to allow using the roguelike keys for navigation.
1995 dir = get_keymap_dir(ch);
1996 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2010 k = (n + k - 1) % n;
2027 if (browse_only) break;
2028 (*option_info[opt[k]].o_var) = TRUE;
2037 if (browse_only) break;
2038 (*option_info[opt[k]].o_var) = FALSE;
2046 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2053 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2055 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2057 /* Peruse the help file */
2058 (void)show_file(TRUE, buf, NULL, 0, 0);
2075 * Modify the "window" options
2077 static void do_cmd_options_win(void)
2091 /* Memorize old flags */
2092 for (j = 0; j < 8; j++)
2094 /* Acquire current flags */
2095 old_flag[j] = window_flag[j];
2105 /* Prompt XXX XXX XXX */
2107 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2109 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2113 /* Display the windows */
2114 for (j = 0; j < 8; j++)
2116 byte a = TERM_WHITE;
2118 cptr s = angband_term_name[j];
2121 if (j == x) a = TERM_L_BLUE;
2123 /* Window name, staggered, centered */
2124 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2127 /* Display the options */
2128 for (i = 0; i < 16; i++)
2130 byte a = TERM_WHITE;
2132 cptr str = window_flag_desc[i];
2135 if (i == y) a = TERM_L_BLUE;
2139 if (!str) str = "(̤»ÈÍÑ)";
2141 if (!str) str = "(Unused option)";
2146 Term_putstr(0, i + 5, -1, a, str);
2148 /* Display the windows */
2149 for (j = 0; j < 8; j++)
2151 byte a = TERM_WHITE;
2156 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2159 if (window_flag[j] & (1L << i)) c = 'X';
2162 Term_putch(35 + j * 5, i + 5, a, c);
2167 Term_gotoxy(35 + x * 5, y + 5);
2185 for (j = 0; j < 8; j++)
2187 window_flag[j] &= ~(1L << y);
2191 for (i = 0; i < 16; i++)
2193 window_flag[x] &= ~(1L << i);
2206 window_flag[x] |= (1L << y);
2214 window_flag[x] &= ~(1L << y);
2221 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2223 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2233 d = get_keymap_dir(ch);
2235 x = (x + ddx[d] + 8) % 8;
2236 y = (y + ddy[d] + 16) % 16;
2243 /* Notice changes */
2244 for (j = 0; j < 8; j++)
2249 if (!angband_term[j]) continue;
2251 /* Ignore non-changes */
2252 if (window_flag[j] == old_flag[j]) continue;
2255 Term_activate(angband_term[j]);
2272 * Set or unset various options.
2274 * The user must use the "Ctrl-R" command to "adapt" to changes
2275 * in any options which control "visual" aspects of the game.
2277 void do_cmd_options(void)
2282 /* Save the screen */
2291 /* Why are we here */
2293 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2295 prt("Options", 1, 0);
2299 /* Give some choices */
2301 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 2, 5);
2302 prt("(2) ¥Þ¥Ã¥×²èÌÌ ¥ª¥×¥·¥ç¥ó", 3, 5);
2303 prt("(3) ¥Æ¥¥¹¥Èɽ¼¨ ¥ª¥×¥·¥ç¥ó", 4, 5);
2304 prt("(4) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 5, 5);
2305 prt("(5) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 6, 5);
2306 prt("(6) ´Ê°×¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 7, 5);
2307 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 8, 5);
2309 /* Special choices */
2310 prt("(P) ¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 10, 5);
2311 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
2312 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
2313 prt("(M) ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
2314 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2316 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2318 prt("(1) Input Options", 2, 5);
2319 prt("(2) Map Screen Options", 3, 5);
2320 prt("(3) Text Display Options", 4, 5);
2321 prt("(4) Game-Play Options", 5, 5);
2322 prt("(5) Disturbance Options", 6, 5);
2323 prt("(6) Easy Auto-Destroyer Options", 7, 5);
2324 prt("(R) Play-record Options", 8, 5);
2325 /* Special choices */
2326 prt("(P) Auto-picker/destroyer editor", 10, 5);
2327 prt("(D) Base Delay Factor", 11, 5);
2328 prt("(H) Hitpoint Warning", 12, 5);
2329 prt("(M) Mana Color Threshold", 13, 5);
2330 prt("(A) Autosave Options", 14, 5);
2332 prt("(W) Window Flags", 15, 5);
2335 if (!p_ptr->wizard || !allow_debug_opts)
2339 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
2341 prt("(B) Birth Options (Browse Only)", 16, 5);
2348 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó", 16, 5);
2350 prt("(B) Birth Options", 16, 5);
2355 if (p_ptr->noscore || allow_debug_opts)
2359 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 17, 5);
2361 prt("(C) Cheating Options", 17, 5);
2368 prt("¥³¥Þ¥ó¥É:", 19, 0);
2370 prt("Command: ", 19, 0);
2378 if (k == ESCAPE) break;
2385 /* Process the general options */
2387 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2389 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2397 /* Process the general options */
2399 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "¥Þ¥Ã¥×²èÌÌ¥ª¥×¥·¥ç¥ó");
2401 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
2411 do_cmd_options_aux(OPT_PAGE_TEXT, "¥Æ¥¥¹¥Èɽ¼¨¥ª¥×¥·¥ç¥ó");
2413 do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
2423 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2425 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2435 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2437 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2447 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2449 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2454 /* Play-record Options */
2460 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2462 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2473 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2475 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2481 /* Cheating Options */
2484 if (!p_ptr->noscore && !allow_debug_opts)
2486 /* Cheat options are not permitted */
2493 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2495 do_cmd_options_cheat("Cheaters never win");
2505 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2507 do_cmd_options_autosave("Autosave");
2518 do_cmd_options_win();
2519 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2520 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2521 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2522 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2526 /* Auto-picker/destroyer editor */
2530 do_cmd_edit_autopick();
2534 /* Hack -- Delay Speed */
2540 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2542 prt("Command: Base Delay Factor", 19, 0);
2546 /* Get a new value */
2549 int msec = delay_factor * delay_factor * delay_factor;
2551 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2552 delay_factor, msec), 22, 0);
2554 prt(format("Current base delay factor: %d (%d msec)",
2555 delay_factor, msec), 22, 0);
2559 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2561 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2565 if (k == ESCAPE) break;
2569 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2571 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2575 else if (isdigit(k)) delay_factor = D2I(k);
2582 /* Hack -- hitpoint warning factor */
2588 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2590 prt("Command: Hitpoint Warning", 19, 0);
2594 /* Get a new value */
2598 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2599 hitpoint_warn), 22, 0);
2601 prt(format("Current hitpoint warning: %d0%%",
2602 hitpoint_warn), 22, 0);
2606 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2608 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2612 if (k == ESCAPE) break;
2616 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2618 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2622 else if (isdigit(k)) hitpoint_warn = D2I(k);
2629 /* Hack -- mana color factor */
2635 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2637 prt("Command: Mana Color Threshold", 19, 0);
2641 /* Get a new value */
2645 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2648 prt(format("Current mana color threshold: %d0%%",
2653 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2655 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2659 if (k == ESCAPE) break;
2663 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2665 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2669 else if (isdigit(k)) mana_warn = D2I(k);
2678 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2680 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2685 /* Unknown option */
2694 /* Flush messages */
2699 /* Restore the screen */
2702 /* Hack - Redraw equippy chars */
2703 p_ptr->redraw |= (PR_EQUIPPY);
2709 * Ask for a "user pref line" and process it
2711 * XXX XXX XXX Allow absolute file names?
2713 void do_cmd_pref(void)
2720 /* Ask for a "user pref command" */
2722 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2724 if (!get_string("Pref: ", buf, 80)) return;
2728 /* Process that pref command */
2729 (void)process_pref_file_command(buf);
2732 void do_cmd_reload_autopick(void)
2735 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2737 if (!get_check("Reload auto-pick preference file? ")) return;
2740 /* Load the file with messages */
2741 autopick_load_pref(TRUE);
2747 * Hack -- append all current macros to the given file
2749 static errr macro_dump(cptr fname)
2751 static cptr mark = "Macro Dump";
2757 /* Build the filename */
2758 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2760 /* File type is "TEXT" */
2761 FILE_TYPE(FILE_TYPE_TEXT);
2763 /* Append to the file */
2764 if (!open_auto_dump(buf, mark)) return (-1);
2768 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2770 auto_dump_printf("\n# Automatic macro dump\n\n");
2774 for (i = 0; i < macro__num; i++)
2776 /* Extract the action */
2777 ascii_to_text(buf, macro__act[i]);
2779 /* Dump the macro */
2780 auto_dump_printf("A:%s\n", buf);
2782 /* Extract the action */
2783 ascii_to_text(buf, macro__pat[i]);
2785 /* Dump normal macros */
2786 auto_dump_printf("P:%s\n", buf);
2789 auto_dump_printf("\n");
2801 * Hack -- ask for a "trigger" (see below)
2803 * Note the complex use of the "inkey()" function from "util.c".
2805 * Note that both "flush()" calls are extremely important.
2807 static void do_cmd_macro_aux(char *buf)
2817 /* Do not process macros */
2823 /* Read the pattern */
2829 /* Do not process macros */
2832 /* Do not wait for keys */
2835 /* Attempt to read a key */
2846 /* Convert the trigger */
2847 ascii_to_text(tmp, buf);
2849 /* Hack -- display the trigger */
2850 Term_addstr(-1, TERM_WHITE, tmp);
2857 * Hack -- ask for a keymap "trigger" (see below)
2859 * Note that both "flush()" calls are extremely important. This may
2860 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2862 static void do_cmd_macro_aux_keymap(char *buf)
2876 /* Convert to ascii */
2877 ascii_to_text(tmp, buf);
2879 /* Hack -- display the trigger */
2880 Term_addstr(-1, TERM_WHITE, tmp);
2889 * Hack -- append all keymaps to the given file
2891 static errr keymap_dump(cptr fname)
2893 static cptr mark = "Keymap Dump";
2902 if (rogue_like_commands)
2904 mode = KEYMAP_MODE_ROGUE;
2910 mode = KEYMAP_MODE_ORIG;
2914 /* Build the filename */
2915 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2917 /* File type is "TEXT" */
2918 FILE_TYPE(FILE_TYPE_TEXT);
2920 /* Append to the file */
2921 if (!open_auto_dump(buf, mark)) return -1;
2925 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2927 auto_dump_printf("\n# Automatic keymap dump\n\n");
2931 for (i = 0; i < 256; i++)
2935 /* Loop up the keymap */
2936 act = keymap_act[mode][i];
2938 /* Skip empty keymaps */
2941 /* Encode the key */
2944 ascii_to_text(key, buf);
2946 /* Encode the action */
2947 ascii_to_text(buf, act);
2949 /* Dump the macro */
2950 auto_dump_printf("A:%s\n", buf);
2951 auto_dump_printf("C:%d:%s\n", mode, key);
2964 * Interact with "macros"
2966 * Note that the macro "action" must be defined before the trigger.
2968 * Could use some helpful instructions on this page. XXX XXX XXX
2970 void do_cmd_macros(void)
2982 if (rogue_like_commands)
2984 mode = KEYMAP_MODE_ROGUE;
2990 mode = KEYMAP_MODE_ORIG;
2993 /* File type is "TEXT" */
2994 FILE_TYPE(FILE_TYPE_TEXT);
3001 /* Process requests until done */
3009 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3011 prt("Interact with Macros", 2, 0);
3016 /* Describe that action */
3018 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3020 prt("Current action (if any) shown below:", 20, 0);
3024 /* Analyze the current action */
3025 ascii_to_text(buf, macro__buf);
3027 /* Display the current action */
3033 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3035 prt("(1) Load a user pref file", 4, 5);
3040 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3041 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3042 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3043 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3044 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3045 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3046 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3047 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3048 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3050 prt("(2) Append macros to a file", 5, 5);
3051 prt("(3) Query a macro", 6, 5);
3052 prt("(4) Create a macro", 7, 5);
3053 prt("(5) Remove a macro", 8, 5);
3054 prt("(6) Append keymaps to a file", 9, 5);
3055 prt("(7) Query a keymap", 10, 5);
3056 prt("(8) Create a keymap", 11, 5);
3057 prt("(9) Remove a keymap", 12, 5);
3058 prt("(0) Enter a new action", 13, 5);
3061 #endif /* ALLOW_MACROS */
3065 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3067 prt("Command: ", 16, 0);
3075 if (i == ESCAPE) break;
3077 /* Load a 'macro' file */
3084 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3086 prt("Command: Load a user pref file", 16, 0);
3092 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3094 prt("File: ", 18, 0);
3098 /* Default filename */
3099 sprintf(tmp, "%s.prf", player_name);
3101 /* Ask for a file */
3102 if (!askfor(tmp, 80)) continue;
3104 /* Process the given filename */
3105 err = process_pref_file(tmp);
3109 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3111 msg_format("Loaded default '%s'.", tmp);
3118 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3120 msg_format("Failed to load '%s'!");
3126 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3128 msg_format("Loaded '%s'.", tmp);
3140 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3142 prt("Command: Append macros to a file", 16, 0);
3148 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3150 prt("File: ", 18, 0);
3154 /* Default filename */
3155 sprintf(tmp, "%s.prf", player_name);
3157 /* Ask for a file */
3158 if (!askfor(tmp, 80)) continue;
3160 /* Dump the macros */
3161 (void)macro_dump(tmp);
3165 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3167 msg_print("Appended macros.");
3179 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3181 prt("Command: Query a macro", 16, 0);
3187 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3189 prt("Trigger: ", 18, 0);
3193 /* Get a macro trigger */
3194 do_cmd_macro_aux(buf);
3196 /* Acquire action */
3197 k = macro_find_exact(buf);
3204 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3206 msg_print("Found no macro.");
3214 /* Obtain the action */
3215 strcpy(macro__buf, macro__act[k]);
3217 /* Analyze the current action */
3218 ascii_to_text(buf, macro__buf);
3220 /* Display the current action */
3225 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3227 msg_print("Found a macro.");
3233 /* Create a macro */
3238 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3240 prt("Command: Create a macro", 16, 0);
3246 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3248 prt("Trigger: ", 18, 0);
3252 /* Get a macro trigger */
3253 do_cmd_macro_aux(buf);
3260 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3262 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3267 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3269 prt("Action: ", 20, 0);
3273 /* Convert to text */
3274 ascii_to_text(tmp, macro__buf);
3276 /* Get an encoded action */
3277 if (askfor(tmp, 80))
3279 /* Convert to ascii */
3280 text_to_ascii(macro__buf, tmp);
3282 /* Link the macro */
3283 macro_add(buf, macro__buf);
3287 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3289 msg_print("Added a macro.");
3295 /* Remove a macro */
3300 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3302 prt("Command: Remove a macro", 16, 0);
3308 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3310 prt("Trigger: ", 18, 0);
3314 /* Get a macro trigger */
3315 do_cmd_macro_aux(buf);
3317 /* Link the macro */
3318 macro_add(buf, buf);
3322 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3324 msg_print("Removed a macro.");
3334 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3336 prt("Command: Append keymaps to a file", 16, 0);
3342 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3344 prt("File: ", 18, 0);
3348 /* Default filename */
3349 sprintf(tmp, "%s.prf", player_name);
3351 /* Ask for a file */
3352 if (!askfor(tmp, 80)) continue;
3354 /* Dump the macros */
3355 (void)keymap_dump(tmp);
3359 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3361 msg_print("Appended keymaps.");
3366 /* Query a keymap */
3373 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3375 prt("Command: Query a keymap", 16, 0);
3381 prt("²¡¤¹¥¡¼: ", 18, 0);
3383 prt("Keypress: ", 18, 0);
3387 /* Get a keymap trigger */
3388 do_cmd_macro_aux_keymap(buf);
3390 /* Look up the keymap */
3391 act = keymap_act[mode][(byte)(buf[0])];
3398 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3400 msg_print("Found no keymap.");
3408 /* Obtain the action */
3409 strcpy(macro__buf, act);
3411 /* Analyze the current action */
3412 ascii_to_text(buf, macro__buf);
3414 /* Display the current action */
3419 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3421 msg_print("Found a keymap.");
3427 /* Create a keymap */
3432 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3434 prt("Command: Create a keymap", 16, 0);
3440 prt("²¡¤¹¥¡¼: ", 18, 0);
3442 prt("Keypress: ", 18, 0);
3446 /* Get a keymap trigger */
3447 do_cmd_macro_aux_keymap(buf);
3454 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3456 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3461 prt("¹ÔÆ°: ", 20, 0);
3463 prt("Action: ", 20, 0);
3467 /* Convert to text */
3468 ascii_to_text(tmp, macro__buf);
3470 /* Get an encoded action */
3471 if (askfor(tmp, 80))
3473 /* Convert to ascii */
3474 text_to_ascii(macro__buf, tmp);
3476 /* Free old keymap */
3477 string_free(keymap_act[mode][(byte)(buf[0])]);
3479 /* Make new keymap */
3480 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3484 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3486 msg_print("Added a keymap.");
3492 /* Remove a keymap */
3497 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3499 prt("Command: Remove a keymap", 16, 0);
3505 prt("²¡¤¹¥¡¼: ", 18, 0);
3507 prt("Keypress: ", 18, 0);
3511 /* Get a keymap trigger */
3512 do_cmd_macro_aux_keymap(buf);
3514 /* Free old keymap */
3515 string_free(keymap_act[mode][(byte)(buf[0])]);
3517 /* Make new keymap */
3518 keymap_act[mode][(byte)(buf[0])] = NULL;
3522 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3524 msg_print("Removed a keymap.");
3529 /* Enter a new action */
3534 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3536 prt("Command: Enter a new action", 16, 0);
3544 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3546 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3551 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3553 prt("Action: ", 20, 0);
3556 /* Hack -- limit the value */
3559 /* Get an encoded action */
3560 if (!askfor(buf, 80)) continue;
3562 /* Extract an action */
3563 text_to_ascii(macro__buf, buf);
3566 #endif /* ALLOW_MACROS */
3575 /* Flush messages */
3584 static cptr lighting_level_str[F_LIT_MAX] =
3598 static bool cmd_visuals_aux(int i, int *num, int max)
3605 sprintf(str, "%d", *num);
3607 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3610 tmp = strtol(str, NULL, 0);
3611 if (tmp >= 0 && tmp < max)
3614 else if (isupper(i))
3615 *num = (*num + max - 1) % max;
3617 *num = (*num + 1) % max;
3622 static void print_visuals_menu(cptr choice_msg)
3625 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 1, 0);
3627 prt("Interact with Visuals", 1, 0);
3630 /* Give some choices */
3632 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3634 prt("(0) Load a user pref file", 3, 5);
3637 #ifdef ALLOW_VISUALS
3639 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3640 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3641 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3642 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3643 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3644 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3645 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3646 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3647 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3649 prt("(1) Dump monster attr/chars", 4, 5);
3650 prt("(2) Dump object attr/chars", 5, 5);
3651 prt("(3) Dump feature attr/chars", 6, 5);
3652 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3653 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3654 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3655 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3656 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3657 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3660 #endif /* ALLOW_VISUALS */
3663 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3665 prt("(R) Reset visuals", 13, 5);
3670 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3672 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3676 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3677 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3678 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3681 * Interact with "visuals"
3683 void do_cmd_visuals(void)
3688 bool need_redraw = FALSE;
3689 const char *empty_symbol = "<< ? >>";
3691 if (use_bigtile) empty_symbol = "<< ?? >>";
3693 /* File type is "TEXT" */
3694 FILE_TYPE(FILE_TYPE_TEXT);
3696 /* Save the screen */
3699 /* Interact until done */
3705 /* Ask for a choice */
3706 print_visuals_menu(NULL);
3712 if (i == ESCAPE) break;
3716 /* Load a 'pref' file */
3720 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3722 prt("Command: Load a user pref file", 15, 0);
3727 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3729 prt("File: ", 17, 0);
3732 /* Default filename */
3733 sprintf(tmp, "%s.prf", player_name);
3736 if (!askfor(tmp, 70)) continue;
3738 /* Process the given filename */
3739 (void)process_pref_file(tmp);
3744 #ifdef ALLOW_VISUALS
3746 /* Dump monster attr/chars */
3749 static cptr mark = "Monster attr/chars";
3753 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3755 prt("Command: Dump monster attr/chars", 15, 0);
3760 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3762 prt("File: ", 17, 0);
3765 /* Default filename */
3766 sprintf(tmp, "%s.prf", player_name);
3768 /* Get a filename */
3769 if (!askfor(tmp, 70)) continue;
3771 /* Build the filename */
3772 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3774 /* Append to the file */
3775 if (!open_auto_dump(buf, mark)) continue;
3779 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3781 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3785 for (i = 1; i < max_r_idx; i++)
3787 monster_race *r_ptr = &r_info[i];
3789 /* Skip non-entries */
3790 if (!r_ptr->name) continue;
3792 /* Dump a comment */
3793 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3795 /* Dump the monster attr/char info */
3796 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3797 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3805 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3807 msg_print("Dumped monster attr/chars.");
3813 /* Dump object attr/chars */
3816 static cptr mark = "Object attr/chars";
3820 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3822 prt("Command: Dump object attr/chars", 15, 0);
3827 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3829 prt("File: ", 17, 0);
3832 /* Default filename */
3833 sprintf(tmp, "%s.prf", player_name);
3835 /* Get a filename */
3836 if (!askfor(tmp, 70)) continue;
3838 /* Build the filename */
3839 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3841 /* Append to the file */
3842 if (!open_auto_dump(buf, mark)) continue;
3846 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3848 auto_dump_printf("\n# Object attr/char definitions\n\n");
3852 for (i = 1; i < max_k_idx; i++)
3855 object_kind *k_ptr = &k_info[i];
3857 /* Skip non-entries */
3858 if (!k_ptr->name) continue;
3863 strip_name(o_name, i);
3869 /* Prepare dummy object */
3870 object_prep(&forge, i);
3872 /* Get un-shuffled flavor name */
3873 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3876 /* Dump a comment */
3877 auto_dump_printf("# %s\n", o_name);
3879 /* Dump the object attr/char info */
3880 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3881 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3889 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3891 msg_print("Dumped object attr/chars.");
3897 /* Dump feature attr/chars */
3900 static cptr mark = "Feature attr/chars";
3904 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3906 prt("Command: Dump feature attr/chars", 15, 0);
3911 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3913 prt("File: ", 17, 0);
3916 /* Default filename */
3917 sprintf(tmp, "%s.prf", player_name);
3919 /* Get a filename */
3920 if (!askfor(tmp, 70)) continue;
3922 /* Build the filename */
3923 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3925 /* Append to the file */
3926 if (!open_auto_dump(buf, mark)) continue;
3930 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3932 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3936 for (i = 1; i < max_f_idx; i++)
3938 feature_type *f_ptr = &f_info[i];
3940 /* Skip non-entries */
3941 if (!f_ptr->name) continue;
3943 /* Skip mimiccing features */
3944 if (f_ptr->mimic != i) continue;
3946 /* Dump a comment */
3947 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3949 /* Dump the feature attr/char info */
3950 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3951 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3952 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3953 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3961 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3963 msg_print("Dumped feature attr/chars.");
3969 /* Modify monster attr/chars (numeric operation) */
3973 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
3975 static cptr choice_msg = "Change monster attr/chars";
3980 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
3982 prt(format("Command: %s", choice_msg), 15, 0);
3985 /* Hack -- query until done */
3988 monster_race *r_ptr = &r_info[r];
3992 byte da = r_ptr->d_attr;
3993 byte dc = r_ptr->d_char;
3994 byte ca = r_ptr->x_attr;
3995 byte cc = r_ptr->x_char;
3997 /* Label the object */
3999 Term_putstr(5, 17, -1, TERM_WHITE,
4000 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
4001 r, (r_name + r_ptr->name)));
4003 Term_putstr(5, 17, -1, TERM_WHITE,
4004 format("Monster = %d, Name = %-40.40s",
4005 r, (r_name + r_ptr->name)));
4008 /* Label the Default values */
4010 Term_putstr(10, 19, -1, TERM_WHITE,
4011 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4013 Term_putstr(10, 19, -1, TERM_WHITE,
4014 format("Default attr/char = %3u / %3u", da, dc));
4017 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4018 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4020 /* Label the Current values */
4022 Term_putstr(10, 20, -1, TERM_WHITE,
4023 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4025 Term_putstr(10, 20, -1, TERM_WHITE,
4026 format("Current attr/char = %3u / %3u", ca, cc));
4029 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4030 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4034 Term_putstr(0, 22, -1, TERM_WHITE,
4035 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4037 Term_putstr(0, 22, -1, TERM_WHITE,
4038 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4045 if (i == ESCAPE) break;
4047 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4048 else if (isupper(i)) c = 'a' + i - 'A';
4058 if (!cmd_visuals_aux(i, &r, max_r_idx))
4064 while (!r_info[r].name);
4068 t = (int)r_ptr->x_attr;
4069 (void)cmd_visuals_aux(i, &t, 256);
4070 r_ptr->x_attr = (byte)t;
4074 t = (int)r_ptr->x_char;
4075 (void)cmd_visuals_aux(i, &t, 256);
4076 r_ptr->x_char = (byte)t;
4080 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4084 print_visuals_menu(choice_msg);
4092 /* Modify object attr/chars (numeric operation) */
4096 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4098 static cptr choice_msg = "Change object attr/chars";
4103 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4105 prt(format("Command: %s", choice_msg), 15, 0);
4108 /* Hack -- query until done */
4111 object_kind *k_ptr = &k_info[k];
4115 byte da = k_ptr->d_attr;
4116 byte dc = k_ptr->d_char;
4117 byte ca = k_ptr->x_attr;
4118 byte cc = k_ptr->x_char;
4120 /* Label the object */
4122 Term_putstr(5, 17, -1, TERM_WHITE,
4123 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4124 k, (k_name + k_ptr->name)));
4126 Term_putstr(5, 17, -1, TERM_WHITE,
4127 format("Object = %d, Name = %-40.40s",
4128 k, (k_name + k_ptr->name)));
4131 /* Label the Default values */
4133 Term_putstr(10, 19, -1, TERM_WHITE,
4134 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4136 Term_putstr(10, 19, -1, TERM_WHITE,
4137 format("Default attr/char = %3d / %3d", da, dc));
4140 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4141 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4143 /* Label the Current values */
4145 Term_putstr(10, 20, -1, TERM_WHITE,
4146 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4148 Term_putstr(10, 20, -1, TERM_WHITE,
4149 format("Current attr/char = %3d / %3d", ca, cc));
4152 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4153 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4157 Term_putstr(0, 22, -1, TERM_WHITE,
4158 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4160 Term_putstr(0, 22, -1, TERM_WHITE,
4161 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4168 if (i == ESCAPE) break;
4170 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4171 else if (isupper(i)) c = 'a' + i - 'A';
4181 if (!cmd_visuals_aux(i, &k, max_k_idx))
4187 while (!k_info[k].name || k_info[k].flavor);
4191 t = (int)k_ptr->x_attr;
4192 (void)cmd_visuals_aux(i, &t, 256);
4193 k_ptr->x_attr = (byte)t;
4197 t = (int)k_ptr->x_char;
4198 (void)cmd_visuals_aux(i, &t, 256);
4199 k_ptr->x_char = (byte)t;
4203 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4207 print_visuals_menu(choice_msg);
4215 /* Modify feature attr/chars (numeric operation) */
4219 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4221 static cptr choice_msg = "Change feature attr/chars";
4224 static int lighting_level = F_LIT_STANDARD;
4227 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4229 prt(format("Command: %s", choice_msg), 15, 0);
4232 /* Hack -- query until done */
4235 feature_type *f_ptr = &f_info[f];
4239 byte da = f_ptr->d_attr[lighting_level];
4240 byte dc = f_ptr->d_char[lighting_level];
4241 byte ca = f_ptr->x_attr[lighting_level];
4242 byte cc = f_ptr->x_char[lighting_level];
4244 /* Label the object */
4247 Term_putstr(5, 17, -1, TERM_WHITE,
4248 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4249 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4251 Term_putstr(5, 17, -1, TERM_WHITE,
4252 format("Terrain = %d, Name = %s, Lighting = %s",
4253 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4256 /* Label the Default values */
4258 Term_putstr(10, 19, -1, TERM_WHITE,
4259 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4261 Term_putstr(10, 19, -1, TERM_WHITE,
4262 format("Default attr/char = %3d / %3d", da, dc));
4265 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4267 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4269 /* Label the Current values */
4271 Term_putstr(10, 20, -1, TERM_WHITE,
4272 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4274 Term_putstr(10, 20, -1, TERM_WHITE,
4275 format("Current attr/char = %3d / %3d", ca, cc));
4278 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4279 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4283 Term_putstr(0, 22, -1, TERM_WHITE,
4284 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4286 Term_putstr(0, 22, -1, TERM_WHITE,
4287 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4294 if (i == ESCAPE) break;
4296 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4297 else if (isupper(i)) c = 'a' + i - 'A';
4307 if (!cmd_visuals_aux(i, &f, max_f_idx))
4313 while (!f_info[f].name || (f_info[f].mimic != f));
4317 t = (int)f_ptr->x_attr[lighting_level];
4318 (void)cmd_visuals_aux(i, &t, 256);
4319 f_ptr->x_attr[lighting_level] = (byte)t;
4323 t = (int)f_ptr->x_char[lighting_level];
4324 (void)cmd_visuals_aux(i, &t, 256);
4325 f_ptr->x_char[lighting_level] = (byte)t;
4329 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4332 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4336 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4340 print_visuals_menu(choice_msg);
4348 /* Modify monster attr/chars (visual mode) */
4350 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4353 /* Modify object attr/chars (visual mode) */
4355 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4358 /* Modify feature attr/chars (visual mode) */
4361 int lighting_level = F_LIT_STANDARD;
4362 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4366 #endif /* ALLOW_VISUALS */
4376 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4378 msg_print("Visual attr/char tables reset.");
4384 /* Unknown option */
4390 /* Flush messages */
4394 /* Restore the screen */
4397 if (need_redraw) do_cmd_redraw();
4402 * Interact with "colors"
4404 void do_cmd_colors(void)
4413 /* File type is "TEXT" */
4414 FILE_TYPE(FILE_TYPE_TEXT);
4417 /* Save the screen */
4421 /* Interact until done */
4427 /* Ask for a choice */
4429 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4431 prt("Interact with Colors", 2, 0);
4435 /* Give some choices */
4437 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4439 prt("(1) Load a user pref file", 4, 5);
4444 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4445 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4447 prt("(2) Dump colors", 5, 5);
4448 prt("(3) Modify colors", 6, 5);
4455 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4457 prt("Command: ", 8, 0);
4465 if (i == ESCAPE) break;
4467 /* Load a 'pref' file */
4472 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4474 prt("Command: Load a user pref file", 8, 0);
4480 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4482 prt("File: ", 10, 0);
4487 sprintf(tmp, "%s.prf", player_name);
4490 if (!askfor(tmp, 70)) continue;
4492 /* Process the given filename */
4493 (void)process_pref_file(tmp);
4495 /* Mega-Hack -- react to changes */
4496 Term_xtra(TERM_XTRA_REACT, 0);
4498 /* Mega-Hack -- redraw */
4507 static cptr mark = "Colors";
4511 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4513 prt("Command: Dump colors", 8, 0);
4519 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4521 prt("File: ", 10, 0);
4525 /* Default filename */
4526 sprintf(tmp, "%s.prf", player_name);
4528 /* Get a filename */
4529 if (!askfor(tmp, 70)) continue;
4531 /* Build the filename */
4532 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4534 /* Append to the file */
4535 if (!open_auto_dump(buf, mark)) continue;
4539 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4541 auto_dump_printf("\n# Color redefinitions\n\n");
4545 for (i = 0; i < 256; i++)
4547 int kv = angband_color_table[i][0];
4548 int rv = angband_color_table[i][1];
4549 int gv = angband_color_table[i][2];
4550 int bv = angband_color_table[i][3];
4555 cptr name = "unknown";
4559 /* Skip non-entries */
4560 if (!kv && !rv && !gv && !bv) continue;
4562 /* Extract the color name */
4563 if (i < 16) name = color_names[i];
4565 /* Dump a comment */
4567 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4569 auto_dump_printf("# Color '%s'\n", name);
4572 /* Dump the monster attr/char info */
4573 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4582 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4584 msg_print("Dumped color redefinitions.");
4596 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4598 prt("Command: Modify colors", 8, 0);
4602 /* Hack -- query until done */
4611 /* Exhibit the normal colors */
4612 for (j = 0; j < 16; j++)
4614 /* Exhibit this color */
4615 Term_putstr(j*4, 20, -1, a, "###");
4617 /* Exhibit all colors */
4618 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4621 /* Describe the color */
4623 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4625 name = ((a < 16) ? color_names[a] : "undefined");
4629 /* Describe the color */
4631 Term_putstr(5, 10, -1, TERM_WHITE,
4632 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4634 Term_putstr(5, 10, -1, TERM_WHITE,
4635 format("Color = %d, Name = %s", a, name));
4639 /* Label the Current values */
4640 Term_putstr(5, 12, -1, TERM_WHITE,
4641 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4642 angband_color_table[a][0],
4643 angband_color_table[a][1],
4644 angband_color_table[a][2],
4645 angband_color_table[a][3]));
4649 Term_putstr(0, 14, -1, TERM_WHITE,
4650 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4652 Term_putstr(0, 14, -1, TERM_WHITE,
4653 "Command (n/N/k/K/r/R/g/G/b/B): ");
4661 if (i == ESCAPE) break;
4664 if (i == 'n') a = (byte)(a + 1);
4665 if (i == 'N') a = (byte)(a - 1);
4666 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4667 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4668 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4669 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4670 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4671 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4672 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4673 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4675 /* Hack -- react to changes */
4676 Term_xtra(TERM_XTRA_REACT, 0);
4678 /* Hack -- redraw */
4685 /* Unknown option */
4691 /* Flush messages */
4696 /* Restore the screen */
4702 * Note something in the message recall
4704 void do_cmd_note(void)
4713 if (!get_string("¥á¥â: ", buf, 60)) return;
4715 if (!get_string("Note: ", buf, 60)) return;
4719 /* Ignore empty notes */
4720 if (!buf[0] || (buf[0] == ' ')) return;
4722 /* Add the note to the message recall */
4724 msg_format("¥á¥â: %s", buf);
4726 msg_format("Note: %s", buf);
4733 * Mention the current version
4735 void do_cmd_version(void)
4740 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4741 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4743 msg_format("You are playing Hengband %d.%d.%d.",
4744 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4751 * Array of feeling strings
4753 static cptr do_cmd_feeling_text[11] =
4756 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4758 "Looks like any other level.",
4762 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4764 "You feel there is something special about this level.",
4768 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4770 "You nearly faint as horrible visions of death fill your mind!",
4774 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4776 "This level looks very dangerous.",
4780 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4782 "You have a very bad feeling...",
4786 "°¤¤Í½´¶¤¬¤¹¤ë...",
4788 "You have a bad feeling...",
4794 "You feel nervous.",
4798 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4800 "You feel your luck is turning...",
4804 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4806 "You don't like the look of this place.",
4810 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4812 "This level looks reasonably safe.",
4816 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4818 "What a boring place..."
4823 static cptr do_cmd_feeling_text_combat[11] =
4826 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4828 "Looks like any other level.",
4832 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4834 "You feel there is something special about this level.",
4838 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4840 "You nearly faint as horrible visions of death fill your mind!",
4844 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4846 "This level looks very dangerous.",
4850 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4852 "You have a very bad feeling...",
4856 "°¤¤Í½´¶¤¬¤¹¤ë...",
4858 "You have a bad feeling...",
4864 "You feel nervous.",
4868 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4870 "You feel your luck is turning...",
4874 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4876 "You don't like the look of this place.",
4880 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4882 "This level looks reasonably safe.",
4886 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4888 "What a boring place..."
4893 static cptr do_cmd_feeling_text_lucky[11] =
4896 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4897 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4898 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4899 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4900 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4901 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4902 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4903 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4904 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4905 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4906 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4908 "Looks like any other level.",
4909 "You feel there is something special about this level.",
4910 "You have a superb feeling about this level.",
4911 "You have an excellent feeling...",
4912 "You have a very good feeling...",
4913 "You have a good feeling...",
4914 "You feel strangely lucky...",
4915 "You feel your luck is turning...",
4916 "You like the look of this place...",
4917 "This level can't be all bad...",
4918 "What a boring place..."
4924 * Note that "feeling" is set to zero unless some time has passed.
4925 * Note that this is done when the level is GENERATED, not entered.
4927 void do_cmd_feeling(void)
4929 /* No useful feeling in quests */
4930 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4933 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4935 msg_print("Looks like a typical quest level.");
4941 /* No useful feeling in town */
4942 else if (p_ptr->town_num && !dun_level)
4945 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4947 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4951 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4953 msg_print("Looks like a strange wilderness.");
4961 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4963 msg_print("Looks like a typical town.");
4970 /* No useful feeling in the wilderness */
4971 else if (!dun_level)
4974 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4976 msg_print("Looks like a typical wilderness.");
4982 /* Display the feeling */
4983 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
4984 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
4985 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
4986 inventory[INVEN_BOW].name1 == ART_CRIMSON)
4987 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
4989 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
4995 * Description of each monster group.
4997 static cptr monster_group_text[] =
5000 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
5001 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5030 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5047 /* "¾åµé¥Ç¡¼¥â¥ó", */
5089 /* "Ancient Dragon/Wyrm", */
5098 "Multi-Headed Reptile",
5103 "Reptile/Amphibian",
5104 "Spider/Scorpion/Tick",
5106 /* "Major Demon", */
5123 * Symbols of monsters in each group. Note the "Uniques" group
5124 * is handled differently.
5126 static cptr monster_group_char[] =
5181 "!$&()+./=>?[\\]`{|~",
5191 * hook function to sort monsters by level
5193 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5195 u16b *who = (u16b*)(u);
5200 monster_race *r_ptr1 = &r_info[w1];
5201 monster_race *r_ptr2 = &r_info[w2];
5206 if (r_ptr2->level > r_ptr1->level) return TRUE;
5207 if (r_ptr1->level > r_ptr2->level) return FALSE;
5209 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5210 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5215 * Build a list of monster indexes in the given group. Return the number
5216 * of monsters in the group.
5218 * mode & 0x01 : check for non-empty group
5219 * mode & 0x02 : visual operation only
5221 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5226 /* Get a list of x_char in this group */
5227 cptr group_char = monster_group_char[grp_cur];
5229 /* XXX Hack -- Check if this is the "Uniques" group */
5230 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5232 /* XXX Hack -- Check if this is the "Riding" group */
5233 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5235 /* Check every race */
5236 for (i = 0; i < max_r_idx; i++)
5238 /* Access the race */
5239 monster_race *r_ptr = &r_info[i];
5241 /* Skip empty race */
5242 if (!r_ptr->name) continue ;
5244 /* Require known monsters */
5245 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5249 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5252 else if (grp_riding)
5254 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5259 /* Check for race in the group */
5260 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5264 mon_idx[mon_cnt++] = i;
5266 /* XXX Hack -- Just checking for non-empty group */
5267 if (mode & 0x01) break;
5270 /* Terminate the list */
5271 mon_idx[mon_cnt] = -1;
5273 /* Select the sort method */
5274 ang_sort_comp = ang_sort_comp_monster_level;
5275 ang_sort_swap = ang_sort_swap_hook;
5277 /* Sort by monster level */
5278 ang_sort(mon_idx, &dummy_why, mon_cnt);
5280 /* Return the number of races */
5286 * Description of each monster group.
5288 static cptr object_group_text[] =
5291 "¥¥Î¥³", /* "Mushrooms" */
5292 "Ìô", /* "Potions" */
5293 "Ìý¤Ä¤Ü", /* "Flasks" */
5294 "´¬Êª", /* "Scrolls" */
5295 "»ØÎØ", /* "Rings" */
5296 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5297 "ū", /* "Whistle" */
5298 "¸÷¸»", /* "Lanterns" */
5299 "ËâË¡ËÀ", /* "Wands" */
5300 "¾ó", /* "Staffs" */
5301 "¥í¥Ã¥É", /* "Rods" */
5302 "¥«¡¼¥É", /* "Cards" */
5303 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5313 "Åá·õÎà", /* "Swords" */
5314 "Æß´ï", /* "Blunt Weapons" */
5315 "ĹÊÁÉð´ï", /* "Polearms" */
5316 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5317 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5321 "·ÚÁõ³»", /* "Soft Armor" */
5322 "½ÅÁõ³»", /* "Hard Armor" */
5323 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5324 "½â", /* "Shields" */
5325 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5326 "äƼê", /* "Gloves" */
5327 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5328 "´§", /* "Crowns" */
5329 "¥Ö¡¼¥Ä", /* "Boots" */
5382 * TVALs of items in each group
5384 static byte object_group_tval[] =
5425 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5433 * Build a list of object indexes in the given group. Return the number
5434 * of objects in the group.
5436 * mode & 0x01 : check for non-empty group
5437 * mode & 0x02 : visual operation only
5439 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5441 int i, j, k, object_cnt = 0;
5443 /* Get a list of x_char in this group */
5444 byte group_tval = object_group_tval[grp_cur];
5446 /* Check every object */
5447 for (i = 0; i < max_k_idx; i++)
5449 /* Access the object */
5450 object_kind *k_ptr = &k_info[i];
5452 /* Skip empty objects */
5453 if (!k_ptr->name) continue;
5457 /* Any objects will be displayed */
5463 /* Skip non-flavoured objects */
5464 if (!k_ptr->flavor) continue;
5466 /* Require objects ever seen */
5467 if (!k_ptr->aware) continue;
5470 /* Skip items with no distribution (special artifacts) */
5471 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5475 /* Check for objects in the group */
5476 if (TV_LIFE_BOOK == group_tval)
5478 /* Hack -- All spell books */
5479 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5481 /* Add the object */
5482 object_idx[object_cnt++] = i;
5486 else if (k_ptr->tval == group_tval)
5488 /* Add the object */
5489 object_idx[object_cnt++] = i;
5493 /* XXX Hack -- Just checking for non-empty group */
5494 if (mode & 0x01) break;
5497 /* Terminate the list */
5498 object_idx[object_cnt] = -1;
5500 /* Return the number of objects */
5506 * Description of each feature group.
5508 static cptr feature_group_text[] =
5516 * Build a list of feature indexes in the given group. Return the number
5517 * of features in the group.
5519 * mode & 0x01 : check for non-empty group
5521 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5523 int i, feat_cnt = 0;
5525 /* Unused; There is a single group. */
5528 /* Check every feature */
5529 for (i = 0; i < max_f_idx; i++)
5531 /* Access the index */
5532 feature_type *f_ptr = &f_info[i];
5534 /* Skip empty index */
5535 if (!f_ptr->name) continue;
5537 /* Skip mimiccing features */
5538 if (f_ptr->mimic != i) continue;
5541 feat_idx[feat_cnt++] = i;
5543 /* XXX Hack -- Just checking for non-empty group */
5544 if (mode & 0x01) break;
5547 /* Terminate the list */
5548 feat_idx[feat_cnt] = -1;
5550 /* Return the number of races */
5557 * Build a list of monster indexes in the given group. Return the number
5558 * of monsters in the group.
5560 static int collect_artifacts(int grp_cur, int object_idx[])
5562 int i, object_cnt = 0;
5564 /* Get a list of x_char in this group */
5565 byte group_tval = object_group_tval[grp_cur];
5567 /* Check every object */
5568 for (i = 0; i < max_a_idx; i++)
5570 /* Access the artifact */
5571 artifact_type *a_ptr = &a_info[i];
5573 /* Skip empty artifacts */
5574 if (!a_ptr->name) continue;
5576 /* Skip "uncreated" artifacts */
5577 if (!a_ptr->cur_num) continue;
5579 /* Check for race in the group */
5580 if (a_ptr->tval == group_tval)
5583 object_idx[object_cnt++] = i;
5587 /* Terminate the list */
5588 object_idx[object_cnt] = 0;
5590 /* Return the number of races */
5597 * Encode the screen colors
5599 static char hack[17] = "dwsorgbuDWvyRGBU";
5603 * Hack -- load a screen dump from a file
5605 void do_cmd_load_screen(void)
5620 Term_get_size(&wid, &hgt);
5622 /* Build the filename */
5623 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5625 /* Append to the file */
5626 fff = my_fopen(buf, "r");
5631 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5633 msg_format("Failed to open %s.", buf);
5640 /* Save the screen */
5643 /* Clear the screen */
5647 /* Load the screen */
5648 for (y = 0; okay; y++)
5650 /* Get a line of data including control code */
5651 if (!fgets(buf, 1024, fff)) okay = FALSE;
5653 /* Get the blank line */
5654 if (buf[0] == '\n' || buf[0] == '\0') break;
5656 /* Ignore too large screen image */
5657 if (y >= hgt) continue;
5660 for (x = 0; x < wid - 1; x++)
5663 if (buf[x] == '\n' || buf[x] == '\0') break;
5665 /* Put the attr/char */
5666 Term_draw(x, y, TERM_WHITE, buf[x]);
5670 /* Dump the screen */
5671 for (y = 0; okay; y++)
5673 /* Get a line of data including control code */
5674 if (!fgets(buf, 1024, fff)) okay = FALSE;
5676 /* Get the blank line */
5677 if (buf[0] == '\n' || buf[0] == '\0') break;
5679 /* Ignore too large screen image */
5680 if (y >= hgt) continue;
5683 for (x = 0; x < wid - 1; x++)
5686 if (buf[x] == '\n' || buf[x] == '\0') break;
5688 /* Get the attr/char */
5689 (void)(Term_what(x, y, &a, &c));
5691 /* Look up the attr */
5692 for (i = 0; i < 16; i++)
5694 /* Use attr matches */
5695 if (hack[i] == buf[x]) a = i;
5698 /* Put the attr/char */
5699 Term_draw(x, y, a, c);
5710 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5712 msg_print("Screen dump loaded.");
5719 /* Restore the screen */
5726 cptr inven_res_label =
5728 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5730 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5735 #define IM_FLAG_STR "¡ö"
5736 #define HAS_FLAG_STR "¡Ü"
5737 #define NO_FLAG_STR "¡¦"
5739 #define IM_FLAG_STR "* "
5740 #define HAS_FLAG_STR "+ "
5741 #define NO_FLAG_STR ". "
5744 #define print_im_or_res_flag(IM, RES) \
5746 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5747 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5750 #define print_flag(TR) \
5752 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5756 /* XTRA HACK RESLIST */
5757 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5759 char o_name[MAX_NLEN];
5760 u32b flgs[TR_FLAG_SIZE];
5762 if (!o_ptr->k_idx) return;
5763 if (o_ptr->tval != tval) return;
5765 /* Identified items only */
5766 if (!object_is_known(o_ptr)) return;
5769 * HACK:Ring of Lordly protection and Dragon equipment
5770 * have random resistances.
5772 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5773 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5774 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5775 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5776 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5777 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5778 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5779 || object_is_artifact(o_ptr))
5782 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5784 while (o_name[i] && (i < 26))
5787 if (iskanji(o_name[i])) i++;
5796 o_name[i] = ' '; i++;
5801 fprintf(fff, "%s %s", where, o_name);
5803 if (!(o_ptr->ident & (IDENT_MENTAL)))
5806 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5808 fputs("-------unknown------------ -------unknown------\n", fff);
5813 object_flags_known(o_ptr, flgs);
5815 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5816 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5817 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5818 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5819 print_flag(TR_RES_POIS);
5820 print_flag(TR_RES_LITE);
5821 print_flag(TR_RES_DARK);
5822 print_flag(TR_RES_SHARDS);
5823 print_flag(TR_RES_SOUND);
5824 print_flag(TR_RES_NETHER);
5825 print_flag(TR_RES_NEXUS);
5826 print_flag(TR_RES_CHAOS);
5827 print_flag(TR_RES_DISEN);
5831 print_flag(TR_RES_BLIND);
5832 print_flag(TR_RES_FEAR);
5833 print_flag(TR_RES_CONF);
5834 print_flag(TR_FREE_ACT);
5835 print_flag(TR_SEE_INVIS);
5836 print_flag(TR_HOLD_LIFE);
5837 print_flag(TR_TELEPATHY);
5838 print_flag(TR_SLOW_DIGEST);
5839 print_flag(TR_REGEN);
5840 print_flag(TR_LEVITATION);
5848 fprintf(fff, "%s\n", inven_res_label);
5854 * Display *ID* ed weapons/armors's resistances
5856 static void do_cmd_knowledge_inven(void)
5860 char file_name[1024];
5870 /* Open a new file */
5871 fff = my_fopen_temp(file_name, 1024);
5875 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5877 msg_format("Failed to create temporary file %s.", file_name);
5882 fprintf(fff, "%s\n", inven_res_label);
5884 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
5888 for (; j < 9; j++) fputc('\n', fff);
5890 fprintf(fff, "%s\n", inven_res_label);
5894 strcpy(where, "Áõ");
5896 strcpy(where, "E ");
5898 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5900 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5904 strcpy(where, "»ý");
5906 strcpy(where, "I ");
5908 for (i = 0; i < INVEN_PACK; i++)
5910 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5913 st_ptr = &town[1].store[STORE_HOME];
5915 strcpy(where, "²È");
5917 strcpy(where, "H ");
5920 for (i = 0; i < st_ptr->stock_num; i++)
5922 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
5926 /* Close the file */
5929 /* Display the file contents */
5931 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5933 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5936 /* Remove the file */
5941 void do_cmd_save_screen_html_aux(char *filename, int message)
5945 byte a = 0, old_a = 0;
5959 cptr html_head[] = {
5960 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5964 cptr html_foot[] = {
5966 "</body>\n</html>\n",
5972 Term_get_size(&wid, &hgt);
5974 /* File type is "TEXT" */
5975 FILE_TYPE(FILE_TYPE_TEXT);
5977 /* Append to the file */
5978 fff = my_fopen(filename, "w");
5984 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5986 msg_format("Failed to open file %s.", filename);
5994 /* Save the screen */
5998 /* Build the filename */
5999 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
6000 tmpfff = my_fopen(buf, "r");
6002 for (i = 0; html_head[i]; i++)
6003 fprintf(fff, html_head[i]);
6007 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6009 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6013 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6015 fprintf(fff, "%s\n", buf);
6020 /* Dump the screen */
6021 for (y = 0; y < hgt; y++)
6028 for (x = 0; x < wid - 1; x++)
6032 /* Get the attr/char */
6033 (void)(Term_what(x, y, &a, &c));
6037 case '&': cc = "&"; break;
6038 case '<': cc = "<"; break;
6039 case '>': cc = ">"; break;
6041 case 0x1f: c = '.'; break;
6042 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6047 if ((y == 0 && x == 0) || a != old_a) {
6048 rv = angband_color_table[a][1];
6049 gv = angband_color_table[a][2];
6050 bv = angband_color_table[a][3];
6051 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6052 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6056 fprintf(fff, "%s", cc);
6058 fprintf(fff, "%c", c);
6061 fprintf(fff, "</font>");
6064 for (i = 0; html_foot[i]; i++)
6065 fprintf(fff, html_foot[i]);
6070 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6072 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6076 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6078 fprintf(fff, "%s\n", buf);
6093 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6095 msg_print("Screen dump saved.");
6100 /* Restore the screen */
6106 * Hack -- save a screen dump to a file
6108 static void do_cmd_save_screen_html(void)
6110 char buf[1024], tmp[256] = "screen.html";
6113 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6115 if (!get_string("File name: ", tmp, 80))
6119 /* Build the filename */
6120 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6124 do_cmd_save_screen_html_aux(buf, 1);
6129 * Redefinable "save_screen" action
6131 void (*screendump_aux)(void) = NULL;
6135 * Hack -- save a screen dump to a file
6137 void do_cmd_save_screen(void)
6139 bool old_use_graphics = use_graphics;
6140 bool html_dump = FALSE;
6145 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6147 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6152 if (c == 'Y' || c == 'y')
6154 else if (c == 'H' || c == 'h')
6166 Term_get_size(&wid, &hgt);
6168 if (old_use_graphics)
6170 use_graphics = FALSE;
6173 /* Redraw everything */
6174 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6176 /* Hack -- update */
6182 do_cmd_save_screen_html();
6186 /* Do we use a special screendump function ? */
6187 else if (screendump_aux)
6189 /* Dump the screen to a graphics file */
6190 (*screendump_aux)();
6192 else /* Dump the screen as text */
6203 /* Build the filename */
6204 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6206 /* File type is "TEXT" */
6207 FILE_TYPE(FILE_TYPE_TEXT);
6209 /* Append to the file */
6210 fff = my_fopen(buf, "w");
6216 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6218 msg_format("Failed to open file %s.", buf);
6225 /* Save the screen */
6229 /* Dump the screen */
6230 for (y = 0; y < hgt; y++)
6233 for (x = 0; x < wid - 1; x++)
6235 /* Get the attr/char */
6236 (void)(Term_what(x, y, &a, &c));
6246 fprintf(fff, "%s\n", buf);
6253 /* Dump the screen */
6254 for (y = 0; y < hgt; y++)
6257 for (x = 0; x < wid - 1; x++)
6259 /* Get the attr/char */
6260 (void)(Term_what(x, y, &a, &c));
6263 buf[x] = hack[a&0x0F];
6270 fprintf(fff, "%s\n", buf);
6282 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6284 msg_print("Screen dump saved.");
6290 /* Restore the screen */
6294 if (old_use_graphics)
6296 use_graphics = TRUE;
6299 /* Redraw everything */
6300 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6302 /* Hack -- update */
6309 * Sorting hook -- Comp function -- see below
6311 * We use "u" to point to array of monster indexes,
6312 * and "v" to select the type of sorting to perform on "u".
6314 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6316 u16b *who = (u16b*)(u);
6318 u16b *why = (u16b*)(v);
6325 /* Sort by total kills */
6328 /* Extract total kills */
6329 z1 = a_info[w1].tval;
6330 z2 = a_info[w2].tval;
6332 /* Compare total kills */
6333 if (z1 < z2) return (TRUE);
6334 if (z1 > z2) return (FALSE);
6338 /* Sort by monster level */
6341 /* Extract levels */
6342 z1 = a_info[w1].sval;
6343 z2 = a_info[w2].sval;
6345 /* Compare levels */
6346 if (z1 < z2) return (TRUE);
6347 if (z1 > z2) return (FALSE);
6351 /* Sort by monster experience */
6354 /* Extract experience */
6355 z1 = a_info[w1].level;
6356 z2 = a_info[w2].level;
6358 /* Compare experience */
6359 if (z1 < z2) return (TRUE);
6360 if (z1 > z2) return (FALSE);
6364 /* Compare indexes */
6370 * Sorting hook -- Swap function -- see below
6372 * We use "u" to point to array of monster indexes,
6373 * and "v" to select the type of sorting to perform.
6375 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6377 u16b *who = (u16b*)(u);
6392 * Check the status of "artifacts"
6394 static void do_cmd_knowledge_artifacts(void)
6396 int i, k, z, x, y, n = 0;
6402 char file_name[1024];
6404 char base_name[MAX_NLEN];
6408 /* Open a new file */
6409 fff = my_fopen_temp(file_name, 1024);
6413 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6415 msg_format("Failed to create temporary file %s.", file_name);
6421 /* Allocate the "who" array */
6422 C_MAKE(who, max_a_idx, s16b);
6424 /* Allocate the "okay" array */
6425 C_MAKE(okay, max_a_idx, bool);
6427 /* Scan the artifacts */
6428 for (k = 0; k < max_a_idx; k++)
6430 artifact_type *a_ptr = &a_info[k];
6435 /* Skip "empty" artifacts */
6436 if (!a_ptr->name) continue;
6438 /* Skip "uncreated" artifacts */
6439 if (!a_ptr->cur_num) continue;
6445 /* Check the dungeon */
6446 for (y = 0; y < cur_hgt; y++)
6448 for (x = 0; x < cur_wid; x++)
6450 cave_type *c_ptr = &cave[y][x];
6452 s16b this_o_idx, next_o_idx = 0;
6454 /* Scan all objects in the grid */
6455 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6459 /* Acquire object */
6460 o_ptr = &o_list[this_o_idx];
6462 /* Acquire next object */
6463 next_o_idx = o_ptr->next_o_idx;
6465 /* Ignore non-artifacts */
6466 if (!object_is_fixed_artifact(o_ptr)) continue;
6468 /* Ignore known items */
6469 if (object_is_known(o_ptr)) continue;
6471 /* Note the artifact */
6472 okay[o_ptr->name1] = FALSE;
6477 /* Check the inventory and equipment */
6478 for (i = 0; i < INVEN_TOTAL; i++)
6480 object_type *o_ptr = &inventory[i];
6482 /* Ignore non-objects */
6483 if (!o_ptr->k_idx) continue;
6485 /* Ignore non-artifacts */
6486 if (!object_is_fixed_artifact(o_ptr)) continue;
6488 /* Ignore known items */
6489 if (object_is_known(o_ptr)) continue;
6491 /* Note the artifact */
6492 okay[o_ptr->name1] = FALSE;
6495 for (k = 0; k < max_a_idx; k++)
6497 if (okay[k]) who[n++] = k;
6500 /* Select the sort method */
6501 ang_sort_comp = ang_sort_art_comp;
6502 ang_sort_swap = ang_sort_art_swap;
6504 /* Sort the array by dungeon depth of monsters */
6505 ang_sort(who, &why, n);
6507 /* Scan the artifacts */
6508 for (k = 0; k < n; k++)
6510 artifact_type *a_ptr = &a_info[who[k]];
6514 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6516 strcpy(base_name, "Unknown Artifact");
6520 /* Obtain the base object type */
6521 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6529 /* Get local object */
6532 /* Create fake object */
6533 object_prep(q_ptr, z);
6535 /* Make it an artifact */
6536 q_ptr->name1 = (byte)who[k];
6538 /* Display as if known */
6539 q_ptr->ident |= IDENT_STORE;
6541 /* Describe the artifact */
6542 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6545 /* Hack -- Build the artifact name */
6547 fprintf(fff, " %s\n", base_name);
6549 fprintf(fff, " The %s\n", base_name);
6554 /* Free the "who" array */
6555 C_KILL(who, max_a_idx, s16b);
6557 /* Free the "okay" array */
6558 C_KILL(okay, max_a_idx, bool);
6560 /* Close the file */
6563 /* Display the file contents */
6565 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6567 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6571 /* Remove the file */
6577 * Display known uniques
6578 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6580 static void do_cmd_knowledge_uniques(void)
6588 char file_name[1024];
6591 int n_alive_surface = 0;
6592 int n_alive_over100 = 0;
6593 int n_alive_total = 0;
6596 for (i = 0; i < 10; i++) n_alive[i] = 0;
6598 /* Open a new file */
6599 fff = my_fopen_temp(file_name, 1024);
6604 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6606 msg_format("Failed to create temporary file %s.", file_name);
6612 /* Allocate the "who" array */
6613 C_MAKE(who, max_r_idx, s16b);
6615 /* Scan the monsters */
6616 for (i = 1; i < max_r_idx; i++)
6618 monster_race *r_ptr = &r_info[i];
6621 if (!r_ptr->name) continue;
6623 /* Require unique monsters */
6624 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6626 /* Only display "known" uniques */
6627 if (!cheat_know && !r_ptr->r_sights) continue;
6629 /* Only print rarity <= 100 uniques */
6630 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6632 /* Only "alive" uniques */
6633 if (r_ptr->max_num == 0) continue;
6637 lev = (r_ptr->level - 1) / 10;
6641 if (max_lev < lev) max_lev = lev;
6643 else n_alive_over100++;
6645 else n_alive_surface++;
6647 /* Collect "appropriate" monsters */
6651 /* Select the sort method */
6652 ang_sort_comp = ang_sort_comp_hook;
6653 ang_sort_swap = ang_sort_swap_hook;
6655 /* Sort the array by dungeon depth of monsters */
6656 ang_sort(who, &why, n);
6658 if (n_alive_surface)
6661 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6663 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6665 n_alive_total += n_alive_surface;
6667 for (i = 0; i <= max_lev; i++)
6670 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6672 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6674 n_alive_total += n_alive[i];
6676 if (n_alive_over100)
6679 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6681 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6683 n_alive_total += n_alive_over100;
6689 fputs("--------- -----------\n", fff);
6690 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6692 fputs("------------- ----------\n", fff);
6693 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6699 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6701 fputs("No known uniques alive.\n", fff);
6705 /* Scan the monster races */
6706 for (k = 0; k < n; k++)
6708 monster_race *r_ptr = &r_info[who[k]];
6710 /* Print a message */
6712 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6714 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6718 /* Free the "who" array */
6719 C_KILL(who, max_r_idx, s16b);
6721 /* Close the file */
6724 /* Display the file contents */
6726 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6728 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6732 /* Remove the file */
6738 * Display weapon-exp
6740 static void do_cmd_knowledge_weapon_exp(void)
6742 int i, j, num, weapon_exp;
6746 char file_name[1024];
6749 /* Open a new file */
6750 fff = my_fopen_temp(file_name, 1024);
6753 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6755 msg_format("Failed to create temporary file %s.", file_name);
6761 for (i = 0; i < 5; i++)
6763 for (num = 0; num < 64; num++)
6765 for (j = 0; j < max_k_idx; j++)
6767 object_kind *k_ptr = &k_info[j];
6769 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6771 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6773 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6775 fprintf(fff, "%-25s ", tmp);
6776 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6777 else fprintf(fff, " ");
6778 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6779 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6787 /* Close the file */
6790 /* Display the file contents */
6792 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6794 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6798 /* Remove the file */
6806 static void do_cmd_knowledge_spell_exp(void)
6808 int i = 0, spell_exp, exp_level;
6813 char file_name[1024];
6815 /* Open a new file */
6816 fff = my_fopen_temp(file_name, 1024);
6819 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6821 msg_format("Failed to create temporary file %s.", file_name);
6827 if (p_ptr->realm1 != REALM_NONE)
6830 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6832 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6834 for (i = 0; i < 32; i++)
6836 if (!is_magic(p_ptr->realm1))
6838 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6842 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6844 if (s_ptr->slevel >= 99) continue;
6845 spell_exp = p_ptr->spell_exp[i];
6846 exp_level = spell_exp_level(spell_exp);
6847 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6848 if (p_ptr->realm1 == REALM_HISSATSU)
6849 fprintf(fff, "[--]");
6852 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6853 else fprintf(fff, " ");
6854 fprintf(fff, "%s", exp_level_str[exp_level]);
6856 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6861 if (p_ptr->realm2 != REALM_NONE)
6864 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6866 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6868 for (i = 0; i < 32; i++)
6870 if (!is_magic(p_ptr->realm1))
6872 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6876 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6878 if (s_ptr->slevel >= 99) continue;
6880 spell_exp = p_ptr->spell_exp[i + 32];
6881 exp_level = spell_exp_level(spell_exp);
6882 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
6883 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6884 else fprintf(fff, " ");
6885 fprintf(fff, "%s", exp_level_str[exp_level]);
6886 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6891 /* Close the file */
6894 /* Display the file contents */
6896 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6898 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6902 /* Remove the file */
6910 static void do_cmd_knowledge_skill_exp(void)
6912 int i = 0, skill_exp;
6916 char file_name[1024];
6918 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6920 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6923 /* Open a new file */
6924 fff = my_fopen_temp(file_name, 1024);
6927 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6929 msg_format("Failed to create temporary file %s.", file_name);
6935 for (i = 0; i < 3; i++)
6937 skill_exp = p_ptr->skill_exp[i];
6938 fprintf(fff, "%-20s ", skill_name[i]);
6939 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6940 else fprintf(fff, " ");
6941 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6942 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6946 /* Close the file */
6949 /* Display the file contents */
6951 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6953 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6957 /* Remove the file */
6963 * Pluralize a monster name
6965 void plural_aux(char *Name)
6967 int NameLen = strlen(Name);
6969 if (my_strstr(Name, "Disembodied hand"))
6971 strcpy(Name, "Disembodied hands that strangled people");
6973 else if (my_strstr(Name, "Colour out of space"))
6975 strcpy(Name, "Colours out of space");
6977 else if (my_strstr(Name, "stairway to hell"))
6979 strcpy(Name, "stairways to hell");
6981 else if (my_strstr(Name, "Dweller on the threshold"))
6983 strcpy(Name, "Dwellers on the threshold");
6985 else if (my_strstr(Name, " of "))
6987 cptr aider = my_strstr(Name, " of ");
6998 if (dummy[i-1] == 's')
7000 strcpy(&(dummy[i]), "es");
7005 strcpy(&(dummy[i]), "s");
7008 strcpy(&(dummy[i+1]), aider);
7009 strcpy(Name, dummy);
7011 else if (my_strstr(Name, "coins"))
7014 strcpy(dummy, "piles of ");
7015 strcat(dummy, Name);
7016 strcpy(Name, dummy);
7019 else if (my_strstr(Name, "Manes"))
7023 else if (streq(&(Name[NameLen - 2]), "ey"))
7025 strcpy(&(Name[NameLen - 2]), "eys");
7027 else if (Name[NameLen - 1] == 'y')
7029 strcpy(&(Name[NameLen - 1]), "ies");
7031 else if (streq(&(Name[NameLen - 4]), "ouse"))
7033 strcpy(&(Name[NameLen - 4]), "ice");
7035 else if (streq(&(Name[NameLen - 2]), "us"))
7037 strcpy(&(Name[NameLen - 2]), "i");
7039 else if (streq(&(Name[NameLen - 6]), "kelman"))
7041 strcpy(&(Name[NameLen - 6]), "kelmen");
7043 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7045 strcpy(&(Name[NameLen - 8]), "wordsmen");
7047 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7049 strcpy(&(Name[NameLen - 7]), "oodsmen");
7051 else if (streq(&(Name[NameLen - 7]), "eastman"))
7053 strcpy(&(Name[NameLen - 7]), "eastmen");
7055 else if (streq(&(Name[NameLen - 8]), "izardman"))
7057 strcpy(&(Name[NameLen - 8]), "izardmen");
7059 else if (streq(&(Name[NameLen - 5]), "geist"))
7061 strcpy(&(Name[NameLen - 5]), "geister");
7063 else if (streq(&(Name[NameLen - 2]), "ex"))
7065 strcpy(&(Name[NameLen - 2]), "ices");
7067 else if (streq(&(Name[NameLen - 2]), "lf"))
7069 strcpy(&(Name[NameLen - 2]), "lves");
7071 else if (suffix(Name, "ch") ||
7072 suffix(Name, "sh") ||
7073 suffix(Name, "nx") ||
7074 suffix(Name, "s") ||
7077 strcpy(&(Name[NameLen]), "es");
7081 strcpy(&(Name[NameLen]), "s");
7086 * Display current pets
7088 static void do_cmd_knowledge_pets(void)
7092 monster_type *m_ptr;
7095 int show_upkeep = 0;
7096 char file_name[1024];
7099 /* Open a new file */
7100 fff = my_fopen_temp(file_name, 1024);
7103 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7105 msg_format("Failed to create temporary file %s.", file_name);
7111 /* Process the monsters (backwards) */
7112 for (i = m_max - 1; i >= 1; i--)
7114 /* Access the monster */
7117 /* Ignore "dead" monsters */
7118 if (!m_ptr->r_idx) continue;
7120 /* Calculate "upkeep" for pets */
7124 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7125 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7129 show_upkeep = calculate_upkeep();
7131 fprintf(fff, "----------------------------------------------\n");
7133 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7134 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7136 fprintf(fff, " Total: %d pet%s.\n",
7137 t_friends, (t_friends == 1 ? "" : "s"));
7138 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7143 /* Close the file */
7146 /* Display the file contents */
7148 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7150 show_file(TRUE, file_name, "Current Pets", 0, 0);
7154 /* Remove the file */
7162 * Note that the player ghosts are ignored. XXX XXX XXX
7164 static void do_cmd_knowledge_kill_count(void)
7172 char file_name[1024];
7177 /* Open a new file */
7178 fff = my_fopen_temp(file_name, 1024);
7182 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7184 msg_format("Failed to create temporary file %s.", file_name);
7190 /* Allocate the "who" array */
7191 C_MAKE(who, max_r_idx, s16b);
7194 /* Monsters slain */
7197 for (kk = 1; kk < max_r_idx; kk++)
7199 monster_race *r_ptr = &r_info[kk];
7201 if (r_ptr->flags1 & (RF1_UNIQUE))
7203 bool dead = (r_ptr->max_num == 0);
7212 s16b This = r_ptr->r_pkills;
7223 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7225 fprintf(fff,"You have defeated no enemies yet.\n\n");
7229 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7231 fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
7237 /* Scan the monsters */
7238 for (i = 1; i < max_r_idx; i++)
7240 monster_race *r_ptr = &r_info[i];
7242 /* Use that monster */
7243 if (r_ptr->name) who[n++] = i;
7246 /* Select the sort method */
7247 ang_sort_comp = ang_sort_comp_hook;
7248 ang_sort_swap = ang_sort_swap_hook;
7250 /* Sort the array by dungeon depth of monsters */
7251 ang_sort(who, &why, n);
7253 /* Scan the monster races */
7254 for (k = 0; k < n; k++)
7256 monster_race *r_ptr = &r_info[who[k]];
7258 if (r_ptr->flags1 & (RF1_UNIQUE))
7260 bool dead = (r_ptr->max_num == 0);
7264 /* Print a message */
7265 fprintf(fff, " %s\n",
7266 (r_name + r_ptr->name));
7272 s16b This = r_ptr->r_pkills;
7277 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7278 if (my_strchr("pt", r_ptr->d_char))
7279 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7281 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7285 if (my_strstr(r_name + r_ptr->name, "coins"))
7287 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7291 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7297 strcpy(ToPlural, (r_name + r_ptr->name));
7298 plural_aux(ToPlural);
7299 fprintf(fff, " %d %s\n", This, ToPlural);
7309 fprintf(fff,"----------------------------------------------\n");
7311 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
7313 fprintf(fff," Total: %lu creature%s killed.\n",
7314 Total, (Total == 1 ? "" : "s"));
7318 /* Free the "who" array */
7319 C_KILL(who, max_r_idx, s16b);
7321 /* Close the file */
7324 /* Display the file contents */
7326 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7328 show_file(TRUE, file_name, "Kill Count", 0, 0);
7332 /* Remove the file */
7338 * Display the object groups.
7340 static void display_group_list(int col, int row, int wid, int per_page,
7341 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7345 /* Display lines until done */
7346 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7348 /* Get the group index */
7349 int grp = grp_idx[grp_top + i];
7351 /* Choose a color */
7352 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7354 /* Erase the entire line */
7355 Term_erase(col, row + i, wid);
7357 /* Display the group label */
7358 c_put_str(attr, group_text[grp], row + i, col);
7364 * Move the cursor in a browser window
7366 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7367 int *list_cur, int list_cnt)
7372 int list = *list_cur;
7374 /* Extract direction */
7377 /* Hack -- scroll up full screen */
7382 /* Hack -- scroll down full screen */
7387 d = get_keymap_dir(ch);
7392 /* Diagonals - hack */
7393 if ((ddx[d] > 0) && ddy[d])
7399 Term_get_size(&wid, &hgt);
7401 browser_rows = hgt - 8;
7403 /* Browse group list */
7408 /* Move up or down */
7409 grp += ddy[d] * (browser_rows - 1);
7412 if (grp >= grp_cnt) grp = grp_cnt - 1;
7413 if (grp < 0) grp = 0;
7414 if (grp != old_grp) list = 0;
7417 /* Browse sub-list list */
7420 /* Move up or down */
7421 list += ddy[d] * browser_rows;
7424 if (list >= list_cnt) list = list_cnt - 1;
7425 if (list < 0) list = 0;
7437 if (col < 0) col = 0;
7438 if (col > 1) col = 1;
7445 /* Browse group list */
7450 /* Move up or down */
7454 if (grp >= grp_cnt) grp = grp_cnt - 1;
7455 if (grp < 0) grp = 0;
7456 if (grp != old_grp) list = 0;
7459 /* Browse sub-list list */
7462 /* Move up or down */
7466 if (list >= list_cnt) list = list_cnt - 1;
7467 if (list < 0) list = 0;
7478 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7482 /* Clear the display lines */
7483 for (i = 0; i < height; i++)
7485 Term_erase(col, row + i, width);
7488 /* Bigtile mode uses double width */
7489 if (use_bigtile) width /= 2;
7491 /* Display lines until done */
7492 for (i = 0; i < height; i++)
7494 /* Display columns until done */
7495 for (j = 0; j < width; j++)
7503 /* Bigtile mode uses double width */
7504 if (use_bigtile) x += j;
7509 /* Ignore illegal characters */
7510 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7511 (!use_graphics && ic > 0x7f))
7517 /* Force correct code for both ASCII character and tile */
7518 if (c & 0x80) a |= 0x80;
7520 /* Display symbol */
7521 Term_queue_bigchar(x, y, a, c, 0, 0);
7528 * Place the cursor at the collect position for visual mode
7530 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7532 int i = (a & 0x7f) - attr_top;
7533 int j = c - char_left;
7538 /* Bigtile mode uses double width */
7539 if (use_bigtile) x += j;
7541 /* Place the cursor */
7547 * Clipboard variables for copy&paste in visual mode
7549 static byte attr_idx = 0;
7550 static byte char_idx = 0;
7552 /* Hack -- for feature lighting */
7553 static byte attr_idx_feat[F_LIT_MAX];
7554 static byte char_idx_feat[F_LIT_MAX];
7557 * Do visual mode command -- Change symbols
7559 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7560 int height, int width,
7561 byte *attr_top_ptr, byte *char_left_ptr,
7562 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7564 static byte attr_old = 0, char_old = 0;
7569 if (*visual_list_ptr)
7572 *cur_attr_ptr = attr_old;
7573 *cur_char_ptr = char_old;
7574 *visual_list_ptr = FALSE;
7582 if (*visual_list_ptr)
7585 *visual_list_ptr = FALSE;
7586 *need_redraw = TRUE;
7594 if (!*visual_list_ptr)
7596 *visual_list_ptr = TRUE;
7598 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7599 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7601 attr_old = *cur_attr_ptr;
7602 char_old = *cur_char_ptr;
7613 /* Set the visual */
7614 attr_idx = *cur_attr_ptr;
7615 char_idx = *cur_char_ptr;
7617 /* Hack -- for feature lighting */
7618 for (i = 0; i < F_LIT_MAX; i++)
7620 attr_idx_feat[i] = 0;
7621 char_idx_feat[i] = 0;
7628 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7631 *cur_attr_ptr = attr_idx;
7632 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7633 if (!*visual_list_ptr) *need_redraw = TRUE;
7639 *cur_char_ptr = char_idx;
7640 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7641 if (!*visual_list_ptr) *need_redraw = TRUE;
7647 if (*visual_list_ptr)
7650 int d = get_keymap_dir(ch);
7651 byte a = (*cur_attr_ptr & 0x7f);
7652 byte c = *cur_char_ptr;
7654 if (use_bigtile) eff_width = width / 2;
7655 else eff_width = width;
7657 /* Restrict direction */
7658 if ((a == 0) && (ddy[d] < 0)) d = 0;
7659 if ((c == 0) && (ddx[d] < 0)) d = 0;
7660 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7661 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7666 /* Force correct code for both ASCII character and tile */
7667 if (c & 0x80) a |= 0x80;
7669 /* Set the visual */
7674 /* Move the frame */
7675 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7676 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7677 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7678 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7684 /* Visual mode command is not used */
7690 * Display the monsters in a group.
7692 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7693 int mon_cur, int mon_top, bool visual_only)
7697 /* Display lines until done */
7698 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7702 /* Get the race index */
7703 int r_idx = mon_idx[mon_top + i] ;
7705 /* Access the race */
7706 monster_race *r_ptr = &r_info[r_idx];
7708 /* Choose a color */
7709 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7711 /* Display the name */
7712 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7714 /* Hack -- visual_list mode */
7717 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7719 if (p_ptr->wizard || visual_only)
7721 c_prt(attr, format("%d", r_idx), row + i, 62);
7724 /* Erase chars before overwritten by the race letter */
7725 Term_erase(69, row + i, 255);
7727 /* Display symbol */
7728 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7733 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7735 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7737 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7742 /* Clear remaining lines */
7743 for (; i < per_page; i++)
7745 Term_erase(col, row + i, 255);
7751 * Display known monsters.
7753 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7756 int grp_cur, grp_top, old_grp_cur;
7757 int mon_cur, mon_top;
7758 int grp_cnt, grp_idx[100];
7766 bool visual_list = FALSE;
7767 byte attr_top = 0, char_left = 0;
7775 Term_get_size(&wid, &hgt);
7777 browser_rows = hgt - 8;
7779 /* Allocate the "mon_idx" array */
7780 C_MAKE(mon_idx, max_r_idx, s16b);
7785 if (direct_r_idx < 0)
7787 mode = visual_only ? 0x03 : 0x01;
7789 /* Check every group */
7790 for (i = 0; monster_group_text[i] != NULL; i++)
7792 /* Measure the label */
7793 len = strlen(monster_group_text[i]);
7795 /* Save the maximum length */
7796 if (len > max) max = len;
7798 /* See if any monsters are known */
7799 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7801 /* Build a list of groups with known monsters */
7802 grp_idx[grp_cnt++] = i;
7810 mon_idx[0] = direct_r_idx;
7813 /* Terminate the list */
7816 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7817 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7820 /* Terminate the list */
7821 grp_idx[grp_cnt] = -1;
7824 grp_cur = grp_top = 0;
7825 mon_cur = mon_top = 0;
7830 mode = visual_only ? 0x02 : 0x00;
7835 monster_race *r_ptr;
7842 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7843 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7844 prt("̾Á°", 4, max + 3);
7845 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7847 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7849 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7850 if (direct_r_idx < 0) prt("Group", 4, 0);
7851 prt("Name", 4, max + 3);
7852 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7854 if (!visual_only) prt("Kills", 4, 73);
7857 for (i = 0; i < 78; i++)
7859 Term_putch(i, 5, TERM_WHITE, '=');
7862 if (direct_r_idx < 0)
7864 for (i = 0; i < browser_rows; i++)
7866 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7873 if (direct_r_idx < 0)
7875 /* Scroll group list */
7876 if (grp_cur < grp_top) grp_top = grp_cur;
7877 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7879 /* Display a list of monster groups */
7880 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7882 if (old_grp_cur != grp_cur)
7884 old_grp_cur = grp_cur;
7886 /* Get a list of monsters in the current group */
7887 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
7890 /* Scroll monster list */
7891 while (mon_cur < mon_top)
7892 mon_top = MAX(0, mon_top - browser_rows/2);
7893 while (mon_cur >= mon_top + browser_rows)
7894 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7899 /* Display a list of monsters in the current group */
7900 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
7906 /* Display a monster name */
7907 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
7909 /* Display visual list below first monster */
7910 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7915 prt(format("<Êý¸þ>%s%s%s, ESC",
7916 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
7917 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
7918 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
7921 prt(format("<dir>%s%s%s, ESC",
7922 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7923 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7924 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7928 /* Get the current monster */
7929 r_ptr = &r_info[mon_idx[mon_cur]];
7933 /* Mega Hack -- track this monster race */
7934 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7936 /* Hack -- handle stuff */
7942 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7946 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7950 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7955 /* Do visual mode command if needed */
7956 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))
7958 if (direct_r_idx >= 0)
7983 /* Recall on screen */
7984 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
7986 screen_roff(mon_idx[mon_cur], 0);
7997 /* Move the cursor */
7998 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
8005 /* Free the "mon_idx" array */
8006 C_KILL(mon_idx, max_r_idx, s16b);
8011 * Display the objects in a group.
8013 static void display_object_list(int col, int row, int per_page, int object_idx[],
8014 int object_cur, int object_top, bool visual_only)
8018 /* Display lines until done */
8019 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8023 object_kind *flavor_k_ptr;
8025 /* Get the object index */
8026 int k_idx = object_idx[object_top + i];
8028 /* Access the object */
8029 object_kind *k_ptr = &k_info[k_idx];
8031 /* Choose a color */
8032 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8033 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8038 /* Appearance of this object is shuffled */
8039 flavor_k_ptr = &k_info[k_ptr->flavor];
8043 /* Appearance of this object is very normal */
8044 flavor_k_ptr = k_ptr;
8049 attr = ((i + object_top == object_cur) ? cursor : attr);
8051 if (!k_ptr->flavor || k_ptr->aware)
8054 strip_name(o_name, k_idx);
8059 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8062 /* Display the name */
8063 c_prt(attr, o_name, row + i, col);
8065 /* Hack -- visual_list mode */
8068 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);
8070 if (p_ptr->wizard || visual_only)
8072 c_prt(attr, format("%d", k_idx), row + i, 70);
8075 a = flavor_k_ptr->x_attr;
8076 c = flavor_k_ptr->x_char;
8078 /* Display symbol */
8079 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8082 /* Clear remaining lines */
8083 for (; i < per_page; i++)
8085 Term_erase(col, row + i, 255);
8090 * Describe fake object
8092 static void desc_obj_fake(int k_idx)
8095 object_type object_type_body;
8097 /* Get local object */
8098 o_ptr = &object_type_body;
8100 /* Wipe the object */
8103 /* Create the artifact */
8104 object_prep(o_ptr, k_idx);
8106 /* It's fully know */
8107 o_ptr->ident |= IDENT_KNOWN;
8109 /* Track the object */
8110 /* object_actual_track(o_ptr); */
8112 /* Hack - mark as fake */
8113 /* term_obj_real = FALSE; */
8115 /* Hack -- Handle stuff */
8118 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
8121 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8123 msg_print("You see nothing special.");
8132 * Display known objects
8134 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8137 int grp_cur, grp_top, old_grp_cur;
8138 int object_old, object_cur, object_top;
8139 int grp_cnt, grp_idx[100];
8147 bool visual_list = FALSE;
8148 byte attr_top = 0, char_left = 0;
8156 Term_get_size(&wid, &hgt);
8158 browser_rows = hgt - 8;
8160 /* Allocate the "object_idx" array */
8161 C_MAKE(object_idx, max_k_idx, int);
8166 if (direct_k_idx < 0)
8168 mode = visual_only ? 0x03 : 0x01;
8170 /* Check every group */
8171 for (i = 0; object_group_text[i] != NULL; i++)
8173 /* Measure the label */
8174 len = strlen(object_group_text[i]);
8176 /* Save the maximum length */
8177 if (len > max) max = len;
8179 /* See if any monsters are known */
8180 if (collect_objects(i, object_idx, mode))
8182 /* Build a list of groups with known monsters */
8183 grp_idx[grp_cnt++] = i;
8192 object_kind *k_ptr = &k_info[direct_k_idx];
8193 object_kind *flavor_k_ptr;
8197 /* Appearance of this object is shuffled */
8198 flavor_k_ptr = &k_info[k_ptr->flavor];
8202 /* Appearance of this object is very normal */
8203 flavor_k_ptr = k_ptr;
8206 object_idx[0] = direct_k_idx;
8207 object_old = direct_k_idx;
8210 /* Terminate the list */
8213 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8214 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8217 /* Terminate the list */
8218 grp_idx[grp_cnt] = -1;
8221 grp_cur = grp_top = 0;
8222 object_cur = object_top = 0;
8227 mode = visual_only ? 0x02 : 0x00;
8232 object_kind *k_ptr, *flavor_k_ptr;
8239 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8240 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8241 prt("̾Á°", 4, max + 3);
8242 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8245 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8246 if (direct_k_idx < 0) prt("Group", 4, 0);
8247 prt("Name", 4, max + 3);
8248 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8252 for (i = 0; i < 78; i++)
8254 Term_putch(i, 5, TERM_WHITE, '=');
8257 if (direct_k_idx < 0)
8259 for (i = 0; i < browser_rows; i++)
8261 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8268 if (direct_k_idx < 0)
8270 /* Scroll group list */
8271 if (grp_cur < grp_top) grp_top = grp_cur;
8272 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8274 /* Display a list of object groups */
8275 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8277 if (old_grp_cur != grp_cur)
8279 old_grp_cur = grp_cur;
8281 /* Get a list of objects in the current group */
8282 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8285 /* Scroll object list */
8286 while (object_cur < object_top)
8287 object_top = MAX(0, object_top - browser_rows/2);
8288 while (object_cur >= object_top + browser_rows)
8289 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8294 /* Display a list of objects in the current group */
8295 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8299 object_top = object_cur;
8301 /* Display a list of objects in the current group */
8302 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8304 /* Display visual list below first object */
8305 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8308 /* Get the current object */
8309 k_ptr = &k_info[object_idx[object_cur]];
8313 /* Appearance of this object is shuffled */
8314 flavor_k_ptr = &k_info[k_ptr->flavor];
8318 /* Appearance of this object is very normal */
8319 flavor_k_ptr = k_ptr;
8324 prt(format("<Êý¸þ>%s%s%s, ESC",
8325 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8326 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8327 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8330 prt(format("<dir>%s%s%s, ESC",
8331 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8332 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8333 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8339 /* Mega Hack -- track this object */
8340 if (object_cnt) object_kind_track(object_idx[object_cur]);
8342 /* The "current" object changed */
8343 if (object_old != object_idx[object_cur])
8345 /* Hack -- handle stuff */
8348 /* Remember the "current" object */
8349 object_old = object_idx[object_cur];
8355 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8359 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8363 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8368 /* Do visual mode command if needed */
8369 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))
8371 if (direct_k_idx >= 0)
8396 /* Recall on screen */
8397 if (!visual_list && !visual_only && (grp_cnt > 0))
8399 desc_obj_fake(object_idx[object_cur]);
8407 /* Move the cursor */
8408 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8414 /* Free the "object_idx" array */
8415 C_KILL(object_idx, max_k_idx, int);
8420 * Display the features in a group.
8422 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8423 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8425 int lit_col[F_LIT_MAX], i, j;
8426 int f_idx_col = use_bigtile ? 62 : 64;
8428 /* Correct columns 1 and 4 */
8429 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8430 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8431 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8433 /* Display lines until done */
8434 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8439 int f_idx = feat_idx[feat_top + i];
8441 /* Access the index */
8442 feature_type *f_ptr = &f_info[f_idx];
8444 int row_i = row + i;
8446 /* Choose a color */
8447 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8449 /* Display the name */
8450 c_prt(attr, f_name + f_ptr->name, row_i, col);
8452 /* Hack -- visual_list mode */
8455 /* Display lighting level */
8456 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8458 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));
8460 if (p_ptr->wizard || visual_only)
8462 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8465 /* Display symbol */
8466 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);
8468 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8469 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8471 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8473 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8475 /* Mega-hack -- Use non-standard colour */
8476 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8478 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8482 /* Clear remaining lines */
8483 for (; i < per_page; i++)
8485 Term_erase(col, row + i, 255);
8491 * Interact with feature visuals.
8493 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8496 int grp_cur, grp_top, old_grp_cur;
8497 int feat_cur, feat_top;
8498 int grp_cnt, grp_idx[100];
8506 bool visual_list = FALSE;
8507 byte attr_top = 0, char_left = 0;
8512 byte attr_old[F_LIT_MAX];
8513 byte char_old[F_LIT_MAX];
8514 byte *cur_attr_ptr, *cur_char_ptr;
8516 C_WIPE(attr_old, F_LIT_MAX, byte);
8517 C_WIPE(char_old, F_LIT_MAX, byte);
8520 Term_get_size(&wid, &hgt);
8522 browser_rows = hgt - 8;
8524 /* Allocate the "feat_idx" array */
8525 C_MAKE(feat_idx, max_f_idx, int);
8530 if (direct_f_idx < 0)
8532 /* Check every group */
8533 for (i = 0; feature_group_text[i] != NULL; i++)
8535 /* Measure the label */
8536 len = strlen(feature_group_text[i]);
8538 /* Save the maximum length */
8539 if (len > max) max = len;
8541 /* See if any features are known */
8542 if (collect_features(i, feat_idx, 0x01))
8544 /* Build a list of groups with known features */
8545 grp_idx[grp_cnt++] = i;
8553 feature_type *f_ptr = &f_info[direct_f_idx];
8555 feat_idx[0] = direct_f_idx;
8558 /* Terminate the list */
8561 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8562 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8564 for (i = 0; i < F_LIT_MAX; i++)
8566 attr_old[i] = f_ptr->x_attr[i];
8567 char_old[i] = f_ptr->x_char[i];
8571 /* Terminate the list */
8572 grp_idx[grp_cnt] = -1;
8575 grp_cur = grp_top = 0;
8576 feat_cur = feat_top = 0;
8584 feature_type *f_ptr;
8591 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8592 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8593 prt("̾Á°", 4, max + 3);
8596 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8597 prt("ʸ»ú ( l/ d)", 4, 66);
8601 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8602 prt("ʸ»ú (l/d)", 4, 68);
8605 prt("Visuals - features", 2, 0);
8606 if (direct_f_idx < 0) prt("Group", 4, 0);
8607 prt("Name", 4, max + 3);
8610 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8611 prt("Sym ( l/ d)", 4, 67);
8615 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8616 prt("Sym (l/d)", 4, 69);
8620 for (i = 0; i < 78; i++)
8622 Term_putch(i, 5, TERM_WHITE, '=');
8625 if (direct_f_idx < 0)
8627 for (i = 0; i < browser_rows; i++)
8629 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8636 if (direct_f_idx < 0)
8638 /* Scroll group list */
8639 if (grp_cur < grp_top) grp_top = grp_cur;
8640 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8642 /* Display a list of feature groups */
8643 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8645 if (old_grp_cur != grp_cur)
8647 old_grp_cur = grp_cur;
8649 /* Get a list of features in the current group */
8650 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8653 /* Scroll feature list */
8654 while (feat_cur < feat_top)
8655 feat_top = MAX(0, feat_top - browser_rows/2);
8656 while (feat_cur >= feat_top + browser_rows)
8657 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8662 /* Display a list of features in the current group */
8663 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8667 feat_top = feat_cur;
8669 /* Display a list of features in the current group */
8670 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8672 /* Display visual list below first object */
8673 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8678 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8679 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8680 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8683 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8684 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8685 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8689 /* Get the current feature */
8690 f_ptr = &f_info[feat_idx[feat_cur]];
8691 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8692 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8696 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8700 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8704 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8709 if (visual_list && ((ch == 'A') || (ch == 'a')))
8711 int prev_lighting_level = *lighting_level;
8715 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8716 else (*lighting_level)--;
8720 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8721 else (*lighting_level)++;
8724 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8725 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8727 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8728 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8733 else if ((ch == 'D') || (ch == 'd'))
8735 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8736 byte prev_x_char = f_ptr->x_char[*lighting_level];
8738 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8742 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8743 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8745 if (prev_x_char != f_ptr->x_char[*lighting_level])
8746 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8748 else *need_redraw = TRUE;
8753 /* Do visual mode command if needed */
8754 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))
8758 /* Restore previous visual settings */
8760 for (i = 0; i < F_LIT_MAX; i++)
8762 f_ptr->x_attr[i] = attr_old[i];
8763 f_ptr->x_char[i] = char_old[i];
8770 if (direct_f_idx >= 0) flag = TRUE;
8771 else *lighting_level = F_LIT_STANDARD;
8774 /* Preserve current visual settings */
8777 for (i = 0; i < F_LIT_MAX; i++)
8779 attr_old[i] = f_ptr->x_attr[i];
8780 char_old[i] = f_ptr->x_char[i];
8782 *lighting_level = F_LIT_STANDARD;
8789 for (i = 0; i < F_LIT_MAX; i++)
8791 attr_idx_feat[i] = f_ptr->x_attr[i];
8792 char_idx_feat[i] = f_ptr->x_char[i];
8801 /* Allow TERM_DARK text */
8802 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8804 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8805 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8823 /* Move the cursor */
8824 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8830 /* Free the "feat_idx" array */
8831 C_KILL(feat_idx, max_f_idx, int);
8836 * List wanted monsters
8838 static void do_cmd_knowledge_kubi(void)
8843 char file_name[1024];
8846 /* Open a new file */
8847 fff = my_fopen_temp(file_name, 1024);
8850 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8852 msg_format("Failed to create temporary file %s.", file_name);
8860 bool listed = FALSE;
8863 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8865 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8867 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8869 fprintf(fff, "List of wanted monsters\n");
8871 fprintf(fff, "----------------------------------------------\n");
8873 for (i = 0; i < MAX_KUBI; i++)
8875 if (kubi_r_idx[i] <= 10000)
8877 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8886 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
8888 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
8893 /* Close the file */
8896 /* Display the file contents */
8898 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8900 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8904 /* Remove the file */
8909 * List virtues & status
8911 static void do_cmd_knowledge_virtues(void)
8915 char file_name[1024];
8918 /* Open a new file */
8919 fff = my_fopen_temp(file_name, 1024);
8922 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8924 msg_format("Failed to create temporary file %s.", file_name);
8933 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8935 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8940 /* Close the file */
8943 /* Display the file contents */
8945 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8947 show_file(TRUE, file_name, "Virtues", 0, 0);
8951 /* Remove the file */
8959 static void do_cmd_knowledge_dungeon(void)
8963 char file_name[1024];
8967 /* Open a new file */
8968 fff = my_fopen_temp(file_name, 1024);
8971 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8973 msg_format("Failed to create temporary file %s.", file_name);
8981 for (i = 1; i < max_d_idx; i++)
8985 if (!d_info[i].maxdepth) continue;
8986 if (!max_dlv[i]) continue;
8987 if (d_info[i].final_guardian)
8989 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8991 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8993 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8995 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9000 /* Close the file */
9003 /* Display the file contents */
9005 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
9007 show_file(TRUE, file_name, "Dungeon", 0, 0);
9011 /* Remove the file */
9016 * List virtues & status
9019 static void do_cmd_knowledge_stat(void)
9023 char file_name[1024];
9026 /* Open a new file */
9027 fff = my_fopen_temp(file_name, 1024);
9030 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9032 msg_format("Failed to create temporary file %s.", file_name);
9040 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9041 (2 * p_ptr->hitdie +
9042 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9045 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9046 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9047 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9049 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9050 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9051 fprintf(fff, "Limits of maximum stats\n\n");
9053 for (v_nr = 0; v_nr < 6; v_nr++)
9055 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);
9056 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9062 /* Close the file */
9065 /* Display the file contents */
9067 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9069 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9073 /* Remove the file */
9079 * Print all active quests
9081 static void do_cmd_knowledge_quests_current(FILE *fff)
9084 char rand_tmp_str[120] = "\0";
9086 monster_race *r_ptr;
9088 int rand_level = 100;
9092 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9094 fprintf(fff, "< Current Quest >\n");
9097 for (i = 1; i < max_quests; i++)
9099 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
9101 /* Set the quest number temporary */
9102 int old_quest = p_ptr->inside_quest;
9105 /* Clear the text */
9106 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9107 quest_text_line = 0;
9109 p_ptr->inside_quest = i;
9111 /* Get the quest text */
9112 init_flags = INIT_SHOW_TEXT;
9114 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9116 /* Reset the old quest number */
9117 p_ptr->inside_quest = old_quest;
9119 /* No info from "silent" quests */
9120 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9124 if (quest[i].type != QUEST_TYPE_RANDOM)
9126 char note[80] = "\0";
9128 if (quest[i].status == QUEST_STATUS_TAKEN)
9130 switch (quest[i].type)
9132 case QUEST_TYPE_KILL_LEVEL:
9133 case QUEST_TYPE_KILL_ANY_LEVEL:
9134 r_ptr = &r_info[quest[i].r_idx];
9135 strcpy(name, r_name + r_ptr->name);
9136 if (quest[i].max_num > 1)
9139 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9140 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9143 sprintf(note," - kill %d %s, have killed %d.",
9144 quest[i].max_num, name, quest[i].cur_num);
9149 sprintf(note," - %s¤òÅݤ¹¡£",name);
9151 sprintf(note," - kill %s.",name);
9155 case QUEST_TYPE_FIND_ARTIFACT:
9156 strcpy(name, a_name + a_info[quest[i].k_idx].name);
9158 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9160 sprintf(note," - Find out %s.", name);
9164 case QUEST_TYPE_FIND_EXIT:
9166 sprintf(note," - õº÷¤¹¤ë¡£");
9168 sprintf(note," - Search.");
9172 case QUEST_TYPE_KILL_NUMBER:
9174 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9175 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9177 sprintf(note," - Kill %d monsters, have killed %d.",
9178 quest[i].max_num, quest[i].cur_num);
9182 case QUEST_TYPE_KILL_ALL:
9184 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9186 sprintf(note," - Kill all monsters.");
9192 /* Print the quest info */
9194 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9195 quest[i].name, quest[i].level, note);
9197 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9198 quest[i].name, quest[i].level, note);
9201 fprintf(fff, tmp_str);
9203 if (quest[i].status == QUEST_STATUS_COMPLETED)
9206 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9208 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9210 fprintf(fff, tmp_str);
9216 while (quest_text[j][0] && j < 10)
9218 fprintf(fff, " %s\n", quest_text[j]);
9223 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9226 rand_level = quest[i].level;
9228 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9230 /* Print the quest info */
9231 r_ptr = &r_info[quest[i].r_idx];
9232 strcpy(name, r_name + r_ptr->name);
9234 if (quest[i].max_num > 1)
9237 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9238 quest[i].name, quest[i].level,
9239 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9243 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9244 quest[i].name, quest[i].level,
9245 quest[i].max_num, name, quest[i].cur_num);
9251 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9252 quest[i].name, quest[i].level, name);
9254 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9255 quest[i].name, quest[i].level, name);
9263 /* Print the current random quest */
9264 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
9267 if (!total) fprintf(fff, " ¤Ê¤·\n");
9269 if (!total) fprintf(fff, " Nothing.\n");
9275 * Print all finished quests
9277 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9284 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9286 fprintf(fff, "< Completed Quest >\n");
9288 for (i = 1; i < max_quests; i++)
9290 int q_idx = quest_num[i];
9292 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9294 if (is_fixed_quest_idx(q_idx))
9296 /* Set the quest number temporary */
9297 int old_quest = p_ptr->inside_quest;
9299 p_ptr->inside_quest = q_idx;
9302 init_flags = INIT_ASSIGN;
9304 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9306 /* Reset the old quest number */
9307 p_ptr->inside_quest = old_quest;
9309 /* No info from "silent" quests */
9310 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9315 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9317 /* Print the quest info */
9319 if (quest[q_idx].complev == 0)
9323 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9325 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9327 r_name+r_info[quest[q_idx].r_idx].name,
9328 quest[q_idx].level);
9334 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9336 " %-40s (Dungeon level: %3d) - level %2d\n",
9338 r_name+r_info[quest[q_idx].r_idx].name,
9340 quest[q_idx].complev);
9345 /* Print the quest info */
9347 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9348 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9350 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9351 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9355 fprintf(fff, tmp_str);
9359 if (!total) fprintf(fff, " ¤Ê¤·\n");
9361 if (!total) fprintf(fff, " Nothing.\n");
9367 * Print all failed quests
9369 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9376 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9378 fprintf(fff, "< Failed Quest >\n");
9380 for (i = 1; i < max_quests; i++)
9382 int q_idx = quest_num[i];
9384 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9386 if (is_fixed_quest_idx(q_idx))
9388 /* Set the quest number temporary */
9389 int old_quest = p_ptr->inside_quest;
9391 p_ptr->inside_quest = q_idx;
9393 /* Get the quest text */
9394 init_flags = INIT_ASSIGN;
9396 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9398 /* Reset the old quest number */
9399 p_ptr->inside_quest = old_quest;
9401 /* No info from "silent" quests */
9402 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9407 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9409 /* Print the quest info */
9411 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9412 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9414 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9415 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9420 /* Print the quest info */
9422 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9423 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9425 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9426 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9429 fprintf(fff, tmp_str);
9433 if (!total) fprintf(fff, " ¤Ê¤·\n");
9435 if (!total) fprintf(fff, " Nothing.\n");
9441 * Print all random quests
9443 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9450 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9452 fprintf(fff, "< Remaining Random Quest >\n");
9454 for (i = 1; i < max_quests; i++)
9456 /* No info from "silent" quests */
9457 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9459 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9463 /* Print the quest info */
9465 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9466 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9468 sprintf(tmp_str, " %s (%d, %s)\n",
9469 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9471 fprintf(fff, tmp_str);
9475 if (!total) fprintf(fff, " ¤Ê¤·\n");
9477 if (!total) fprintf(fff, " Nothing.\n");
9482 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9484 int *q_num = (int *)u;
9485 quest_type *qa = &quest[q_num[a]];
9486 quest_type *qb = &quest[q_num[b]];
9491 if (qa->complev < qb->complev) return TRUE;
9492 if (qa->complev > qb->complev) return FALSE;
9493 if (qa->level <= qb->level) return TRUE;
9497 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9499 int *q_num = (int *)u;
9506 q_num[a] = q_num[b];
9512 * Print quest status of all active quests
9514 static void do_cmd_knowledge_quests(void)
9517 char file_name[1024];
9518 int *quest_num, dummy, i;
9520 /* Open a new file */
9521 fff = my_fopen_temp(file_name, 1024);
9525 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9527 msg_format("Failed to create temporary file %s.", file_name);
9533 /* Allocate Memory */
9534 C_MAKE(quest_num, max_quests, int);
9536 /* Sort by compete level */
9537 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9538 ang_sort_comp = ang_sort_comp_quest_num;
9539 ang_sort_swap = ang_sort_swap_quest_num;
9540 ang_sort(quest_num, &dummy, max_quests);
9542 /* Dump Quest Information */
9543 do_cmd_knowledge_quests_current(fff);
9545 do_cmd_knowledge_quests_completed(fff, quest_num);
9547 do_cmd_knowledge_quests_failed(fff, quest_num);
9551 do_cmd_knowledge_quests_wiz_random(fff);
9554 /* Close the file */
9557 /* Display the file contents */
9559 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9561 show_file(TRUE, file_name, "Quest status", 0, 0);
9564 /* Remove the file */
9568 C_KILL(quest_num, max_quests, int);
9575 static void do_cmd_knowledge_home(void)
9580 char file_name[1024];
9582 char o_name[MAX_NLEN];
9585 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9587 /* Open a new file */
9588 fff = my_fopen_temp(file_name, 1024);
9591 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9593 msg_format("Failed to create temporary file %s.", file_name);
9601 /* Print all homes in the different towns */
9602 st_ptr = &town[1].store[STORE_HOME];
9604 /* Home -- if anything there */
9605 if (st_ptr->stock_num)
9610 /* Header with name of the town */
9612 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9614 fprintf(fff, " [Home Inventory]\n");
9617 /* Dump all available items */
9618 for (i = 0; i < st_ptr->stock_num; i++)
9621 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9622 object_desc(o_name, &st_ptr->stock[i], 0);
9623 if (strlen(o_name) <= 80-3)
9625 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9631 for (n = 0, t = o_name; n < 80-3; n++, t++)
9632 if(iskanji(*t)) {t++; n++;}
9633 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9635 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9636 fprintf(fff, " %.77s\n", o_name+n);
9639 object_desc(o_name, &st_ptr->stock[i], 0);
9640 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9645 /* Add an empty line */
9646 fprintf(fff, "\n\n");
9650 /* Close the file */
9653 /* Display the file contents */
9655 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9657 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9661 /* Remove the file */
9667 * Check the status of "autopick"
9669 static void do_cmd_knowledge_autopick(void)
9673 char file_name[1024];
9675 /* Open a new file */
9676 fff = my_fopen_temp(file_name, 1024);
9681 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9683 msg_format("Failed to create temporary file %s.", file_name);
9692 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9694 fprintf(fff, "No preference for auto picker/destroyer.");
9700 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9702 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9706 for (k = 0; k < max_autopick; k++)
9709 byte act = autopick_list[k].action;
9710 if (act & DONT_AUTOPICK)
9718 else if (act & DO_AUTODESTROY)
9726 else if (act & DO_AUTOPICK)
9734 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9743 if (act & DO_DISPLAY)
9744 fprintf(fff, "%11s", format("[%s]", tmp));
9746 fprintf(fff, "%11s", format("(%s)", tmp));
9748 tmp = autopick_line_from_entry(&autopick_list[k]);
9749 fprintf(fff, " %s", tmp);
9753 /* Close the file */
9755 /* Display the file contents */
9757 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9759 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9762 /* Remove the file */
9768 * Interact with "knowledge"
9770 void do_cmd_knowledge(void)
9773 bool need_redraw = FALSE;
9775 /* File type is "TEXT" */
9776 FILE_TYPE(FILE_TYPE_TEXT);
9778 /* Save the screen */
9781 /* Interact until done */
9787 /* Ask for a choice */
9789 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9790 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9792 prt(format("page %d/2", (p+1)), 2, 65);
9793 prt("Display current knowledge", 3, 0);
9796 /* Give some choices */
9800 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9801 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9802 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9803 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9804 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9805 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9806 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9807 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9808 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9809 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9813 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9814 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9815 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9816 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9817 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9818 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9819 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9820 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9821 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9826 prt("(1) Display known artifacts", 6, 5);
9827 prt("(2) Display known objects", 7, 5);
9828 prt("(3) Display remaining uniques", 8, 5);
9829 prt("(4) Display known monster", 9, 5);
9830 prt("(5) Display kill count", 10, 5);
9831 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9832 prt("(7) Display current pets", 12, 5);
9833 prt("(8) Display home inventory", 13, 5);
9834 prt("(9) Display *identified* equip.", 14, 5);
9835 prt("(0) Display terrain symbols.", 15, 5);
9839 prt("(a) Display about yourself", 6, 5);
9840 prt("(b) Display mutations", 7, 5);
9841 prt("(c) Display weapon proficiency", 8, 5);
9842 prt("(d) Display spell proficiency", 9, 5);
9843 prt("(e) Display misc. proficiency", 10, 5);
9844 prt("(f) Display virtues", 11, 5);
9845 prt("(g) Display dungeons", 12, 5);
9846 prt("(h) Display current quests", 13, 5);
9847 prt("(i) Display auto pick/destroy", 14, 5);
9852 prt("-³¤¯-", 17, 8);
9853 prt("ESC) È´¤±¤ë", 21, 1);
9854 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9855 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9856 prt("¥³¥Þ¥ó¥É:", 20, 0);
9858 prt("-more-", 17, 8);
9859 prt("ESC) Exit menu", 21, 1);
9860 prt("SPACE) Next page", 21, 30);
9861 /*prt("-) Previous page", 21, 60);*/
9862 prt("Command: ", 20, 0);
9869 if (i == ESCAPE) break;
9872 case ' ': /* Page change */
9876 case '1': /* Artifacts */
9877 do_cmd_knowledge_artifacts();
9879 case '2': /* Objects */
9880 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
9882 case '3': /* Uniques */
9883 do_cmd_knowledge_uniques();
9885 case '4': /* Monsters */
9886 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
9888 case '5': /* Kill count */
9889 do_cmd_knowledge_kill_count();
9891 case '6': /* wanted */
9892 if (!vanilla_town) do_cmd_knowledge_kubi();
9894 case '7': /* Pets */
9895 do_cmd_knowledge_pets();
9897 case '8': /* Home */
9898 do_cmd_knowledge_home();
9900 case '9': /* Resist list */
9901 do_cmd_knowledge_inven();
9903 case '0': /* Feature list */
9905 int lighting_level = F_LIT_STANDARD;
9906 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
9910 case 'a': /* Max stat */
9911 do_cmd_knowledge_stat();
9913 case 'b': /* Mutations */
9914 do_cmd_knowledge_mutations();
9916 case 'c': /* weapon-exp */
9917 do_cmd_knowledge_weapon_exp();
9919 case 'd': /* spell-exp */
9920 do_cmd_knowledge_spell_exp();
9922 case 'e': /* skill-exp */
9923 do_cmd_knowledge_skill_exp();
9925 case 'f': /* Virtues */
9926 do_cmd_knowledge_virtues();
9928 case 'g': /* Dungeon */
9929 do_cmd_knowledge_dungeon();
9931 case 'h': /* Quests */
9932 do_cmd_knowledge_quests();
9934 case 'i': /* Autopick */
9935 do_cmd_knowledge_autopick();
9937 default: /* Unknown option */
9941 /* Flush messages */
9945 /* Restore the screen */
9948 if (need_redraw) do_cmd_redraw();
9953 * Check on the status of an active quest
9955 void do_cmd_checkquest(void)
9957 /* File type is "TEXT" */
9958 FILE_TYPE(FILE_TYPE_TEXT);
9960 /* Save the screen */
9964 do_cmd_knowledge_quests();
9966 /* Restore the screen */
9972 * Display the time and date
9974 void do_cmd_time(void)
9976 int day, hour, min, full, start, end, num;
9983 extract_day_hour_min(&day, &hour, &min);
9985 full = hour * 100 + min;
9993 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9995 strcpy(desc, "It is a strange time.");
10001 msg_format("%d ÆüÌÜ,»þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
10002 day, (hour % 12 == 0) ? 12 : (hour % 12),
10003 min, (hour < 12) ? "AM" : "PM");
10005 msg_format("This is day %d. The time is %d:%02d %s.",
10006 day, (hour % 12 == 0) ? 12 : (hour % 12),
10007 min, (hour < 12) ? "AM" : "PM");
10011 /* Find the path */
10012 if (!randint0(10) || p_ptr->image)
10015 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10017 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10024 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10026 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10031 /* Open this file */
10032 fff = my_fopen(buf, "rt");
10037 /* Find this time */
10038 while (!my_fgets(fff, buf, sizeof(buf)))
10040 /* Ignore comments */
10041 if (!buf[0] || (buf[0] == '#')) continue;
10043 /* Ignore invalid lines */
10044 if (buf[1] != ':') continue;
10046 /* Process 'Start' */
10049 /* Extract the starting time */
10050 start = atoi(buf + 2);
10052 /* Assume valid for an hour */
10059 /* Process 'End' */
10062 /* Extract the ending time */
10063 end = atoi(buf + 2);
10069 /* Ignore incorrect range */
10070 if ((start > full) || (full > end)) continue;
10072 /* Process 'Description' */
10077 /* Apply the randomizer */
10078 if (!randint0(num)) strcpy(desc, buf + 2);
10088 /* Close the file */