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);
820 if (do_level) write_level = FALSE;
826 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
828 static void do_cmd_disp_nikki(void)
830 char nikki_title[256];
835 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
836 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
847 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
848 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
849 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
850 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
855 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
864 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
866 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
867 "Attack is the best form of defence.",
869 "An unexpected windfall",
870 "A drowning man will catch at a straw",
871 "Don't count your chickens before they are hatched.",
872 "It is no use crying over spilt milk.",
873 "Seeing is believing.",
874 "Strike the iron while it is hot.",
875 "I don't care what follows.",
876 "To dig a well to put out a house on fire.",
877 "Tomorrow is another day.",
878 "Easy come, easy go.",
879 "The more haste, the less speed.",
880 "Where there is life, there is hope.",
881 "There is no royal road to *WINNER*.",
882 "Danger past, God forgotten.",
883 "The best thing to do now is to run away.",
884 "Life is but an empty dream.",
885 "Dead men tell no tales.",
886 "A book that remains shut is but a block.",
887 "Misfortunes never come singly.",
888 "A little knowledge is a dangerous thing.",
889 "History repeats itself.",
890 "*WINNER* was not built in a day.",
891 "Ignorance is bliss.",
892 "To lose is to win?",
893 "No medicine can cure folly.",
894 "All good things come to an end.",
895 "M$ Empire strikes back.",
896 "To see is to believe",
898 "Quest of The World's Greatest Brain"};
901 sprintf(file_name,"playrecord-%s.txt",savefile_base);
903 sprintf(file_name,"playrec-%s.txt",savefile_base);
906 /* Build the filename */
907 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
909 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
910 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
911 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
912 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
913 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
916 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
917 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
919 sprintf(nikki_title, "Legend of %s %s '%s'",
920 ap_ptr->title, player_name, tmp);
923 /* Display the file contents */
924 show_file(FALSE, buf, nikki_title, -1, 0);
927 static void do_cmd_bunshou(void)
930 char bunshou[80] = "\0";
933 if (get_string("ÆâÍÆ: ", tmp, 79))
935 if (get_string("diary note: ", tmp, 79))
938 strcpy(bunshou, tmp);
940 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
944 static void do_cmd_last_get(void)
949 if (record_o_name[0] == '\0') return;
952 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
954 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
956 if (!get_check(buf)) return;
961 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
963 sprintf(buf,"descover %s.", record_o_name);
965 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
969 static void do_cmd_erase_nikki(void)
976 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
978 if (!get_check("Do you really want to delete all your record? ")) return;
982 sprintf(file_name,"playrecord-%s.txt",savefile_base);
984 sprintf(file_name,"playrec-%s.txt",savefile_base);
987 /* Build the filename */
988 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
990 /* Remove the file */
993 fff = my_fopen(buf, "w");
997 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
999 msg_format("deleted record.");
1003 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1005 msg_format("failed to delete %s.", buf);
1012 void do_cmd_nikki(void)
1016 /* File type is "TEXT" */
1017 FILE_TYPE(FILE_TYPE_TEXT);
1019 /* Save the screen */
1022 /* Interact until done */
1028 /* Ask for a choice */
1030 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1032 prt("[ Play Record ]", 2, 0);
1036 /* Give some choices */
1038 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1039 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1040 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1041 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1043 prt("(1) Display your record", 4, 5);
1044 prt("(2) Add record", 5, 5);
1045 prt("(3) Record item you last get/identify", 6, 5);
1046 prt("(4) Delete your record", 7, 5);
1052 prt("¥³¥Þ¥ó¥É:", 18, 0);
1054 prt("Command: ", 18, 0);
1062 if (i == ESCAPE) break;
1067 do_cmd_disp_nikki();
1076 do_cmd_erase_nikki();
1078 default: /* Unknown option */
1082 /* Flush messages */
1086 /* Restore the screen */
1091 * Hack -- redraw the screen
1093 * This command performs various low level updates, clears all the "extra"
1094 * windows, does a total redraw of the main window, and requests all of the
1095 * interesting updates and redraws that I can think of.
1097 * This command is also used to "instantiate" the results of the user
1098 * selecting various things, such as graphics mode, so it must call
1099 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1101 void do_cmd_redraw(void)
1108 /* Hack -- react to changes */
1109 Term_xtra(TERM_XTRA_REACT, 0);
1112 /* Combine and Reorder the pack (later) */
1113 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1117 p_ptr->update |= (PU_TORCH);
1120 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1122 /* Forget lite/view */
1123 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1125 /* Update lite/view */
1126 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1128 /* Update monsters */
1129 p_ptr->update |= (PU_MONSTERS);
1131 /* Redraw everything */
1132 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1135 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1138 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1142 /* Hack -- update */
1145 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1148 /* Redraw every window */
1149 for (j = 0; j < 8; j++)
1152 if (!angband_term[j]) continue;
1155 Term_activate(angband_term[j]);
1170 * Hack -- change name
1172 void do_cmd_change_name(void)
1181 /* Save the screen */
1189 /* Display the player */
1190 display_player(mode);
1195 display_player(mode);
1200 Term_putstr(2, 23, -1, TERM_WHITE,
1201 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1203 Term_putstr(2, 23, -1, TERM_WHITE,
1204 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1212 if (c == ESCAPE) break;
1219 /* Process the player name */
1220 process_player_name(FALSE);
1226 sprintf(tmp, "%s.txt", player_base);
1228 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1230 if (get_string("File name: ", tmp, 80))
1234 if (tmp[0] && (tmp[0] != ' '))
1236 file_character(tmp);
1253 /* Flush messages */
1257 /* Restore the screen */
1260 /* Redraw everything */
1261 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1268 * Recall the most recent message
1270 void do_cmd_message_one(void)
1272 /* Recall one message XXX XXX XXX */
1273 prt(format("> %s", message_str(0)), 0, 0);
1278 * Show previous messages to the user -BEN-
1280 * The screen format uses line 0 and 23 for headers and prompts,
1281 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1283 * This command shows you which commands you are viewing, and allows
1284 * you to "search" for strings in the recall.
1286 * Note that messages may be longer than 80 characters, but they are
1287 * displayed using "infinite" length, with a special sub-command to
1288 * "slide" the virtual display to the left or right.
1290 * Attempt to only hilite the matching portions of the string.
1292 void do_cmd_messages(int num_now)
1302 Term_get_size(&wid, &hgt);
1304 /* Number of message lines in a screen */
1305 num_lines = hgt - 4;
1314 /* Total messages */
1317 /* Start on first message */
1320 /* Save the screen */
1326 /* Process requests until done */
1332 /* Dump up to 20 lines of messages */
1333 for (j = 0; (j < num_lines) && (i + j < n); j++)
1335 cptr msg = message_str(i+j);
1337 /* Dump the messages, bottom to top */
1338 c_prt((i+j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1340 /* Hilite "shower" */
1345 /* Display matches */
1346 while ((str = my_strstr(str, shower)) != NULL)
1348 int len = strlen(shower);
1350 /* Display the match */
1351 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1359 /* Erase remaining lines */
1360 for (; j < num_lines; j++)
1362 Term_erase(0, num_lines + 1 - j, 255);
1365 /* Display header XXX XXX XXX */
1368 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1369 i, i+j-1, n), 0, 0);
1371 prt(format("Message Recall (%d-%d of %d)",
1372 i, i+j-1, n), 0, 0);
1376 /* Display prompt (not very informative) */
1378 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1380 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1385 skey = inkey_special(TRUE);
1387 /* Exit on Escape */
1388 if (skey == ESCAPE) break;
1390 /* Hack -- Save the old index */
1393 /* Hack -- handle show */
1398 prt("¶¯Ä´: ", hgt - 1, 0);
1400 prt("Show: ", hgt - 1, 0);
1404 /* Get a "shower" string, or continue */
1405 if (!askfor(shower, 80)) continue;
1411 /* Hack -- handle find */
1412 if (skey == '/' || skey == KTRL('s'))
1418 prt("¸¡º÷: ", hgt - 1, 0);
1420 prt("Find: ", hgt - 1, 0);
1424 /* Get a "finder" string, or continue */
1425 if (!askfor(finder, 80)) continue;
1428 strcpy(shower, finder);
1431 for (z = i + 1; z < n; z++)
1433 cptr msg = message_str(z);
1436 if (my_strstr(msg, finder))
1447 /* Recall 1 older message */
1448 if (skey == SKEY_TOP)
1450 /* Go to the oldest line */
1454 /* Recall 1 newer message */
1455 if (skey == SKEY_BOTTOM)
1457 /* Go to the newest line */
1461 /* Recall 1 older message */
1462 if (skey == '8' || skey == SKEY_UP || skey == '\n' || skey == '\r')
1464 /* Go older if legal */
1465 i = MIN(i + 1, n - num_lines);
1468 /* Recall 10 older messages */
1471 /* Go older if legal */
1472 i = MIN(i + 10, n - num_lines);
1475 /* Recall 20 older messages */
1476 if (skey == 'p' || skey == KTRL('P') || skey == ' ' || skey == SKEY_PGUP)
1478 /* Go older if legal */
1479 i = MIN(i + num_lines, n - num_lines);
1482 /* Recall 20 newer messages */
1483 if (skey == 'n' || skey == KTRL('N') || skey == SKEY_PGDOWN)
1485 /* Go newer (if able) */
1486 i = MAX(0, i - num_lines);
1489 /* Recall 10 newer messages */
1492 /* Go newer (if able) */
1496 /* Recall 1 newer messages */
1497 if (skey == '2' || skey == SKEY_DOWN)
1499 /* Go newer (if able) */
1503 /* Hack -- Error of some kind */
1507 /* Restore the screen */
1514 * Number of cheating options
1521 static option_type cheat_info[CHEAT_MAX] =
1523 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1525 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1527 "cheat_peek", "Peek into object creation"
1531 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1533 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1535 "cheat_hear", "Peek into monster creation"
1539 { &cheat_room, FALSE, 255, 0x04, 0x00,
1541 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1543 "cheat_room", "Peek into dungeon creation"
1547 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1549 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1551 "cheat_xtra", "Peek into something else"
1555 { &cheat_know, FALSE, 255, 0x10, 0x00,
1557 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1559 "cheat_know", "Know complete monster info"
1563 { &cheat_live, FALSE, 255, 0x20, 0x00,
1565 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1567 "cheat_live", "Allow player to avoid death"
1571 { &cheat_save, FALSE, 255, 0x40, 0x00,
1573 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1575 "cheat_save", "Ask for saving death"
1581 * Interact with some options for cheating
1583 static void do_cmd_options_cheat(cptr info)
1587 int i, k = 0, n = CHEAT_MAX;
1595 /* Interact with the player */
1600 /* Prompt XXX XXX XXX */
1602 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1604 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1610 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1611 prt(" << Ãí°Õ >>", 11, 0);
1612 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1613 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1614 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1616 /* Display the options */
1617 for (i = 0; i < n; i++)
1619 byte a = TERM_WHITE;
1621 /* Color current option */
1622 if (i == k) a = TERM_L_BLUE;
1624 /* Display the option text */
1625 sprintf(buf, "%-48s: %s (%s)",
1626 cheat_info[i].o_desc,
1628 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1630 (*cheat_info[i].o_var ? "yes" : "no "),
1633 cheat_info[i].o_text);
1634 c_prt(a, buf, i + 2, 0);
1637 /* Hilite current option */
1638 move_cursor(k + 2, 50);
1644 * HACK - Try to translate the key into a direction
1645 * to allow using the roguelike keys for navigation.
1647 dir = get_keymap_dir(ch);
1648 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1662 k = (n + k - 1) % n;
1681 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1683 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1685 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1686 (*cheat_info[k].o_var) = TRUE;
1695 (*cheat_info[k].o_var) = FALSE;
1703 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1705 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1707 /* Peruse the help file */
1708 (void)show_file(TRUE, buf, NULL, 0, 0);
1724 static option_type autosave_info[2] =
1726 { &autosave_l, FALSE, 255, 0x01, 0x00,
1728 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1730 "autosave_l", "Autosave when entering new levels" },
1734 { &autosave_t, FALSE, 255, 0x02, 0x00,
1736 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1738 "autosave_t", "Timed autosave" },
1744 static s16b toggle_frequency(s16b current)
1749 case 50: return 100;
1750 case 100: return 250;
1751 case 250: return 500;
1752 case 500: return 1000;
1753 case 1000: return 2500;
1754 case 2500: return 5000;
1755 case 5000: return 10000;
1756 case 10000: return 25000;
1763 * Interact with some options for cheating
1765 static void do_cmd_options_autosave(cptr info)
1769 int i, k = 0, n = 2;
1777 /* Interact with the player */
1780 /* Prompt XXX XXX XXX */
1782 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1784 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1789 /* Display the options */
1790 for (i = 0; i < n; i++)
1792 byte a = TERM_WHITE;
1794 /* Color current option */
1795 if (i == k) a = TERM_L_BLUE;
1797 /* Display the option text */
1798 sprintf(buf, "%-48s: %s (%s)",
1799 autosave_info[i].o_desc,
1801 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1803 (*autosave_info[i].o_var ? "yes" : "no "),
1806 autosave_info[i].o_text);
1807 c_prt(a, buf, i + 2, 0);
1811 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1813 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1818 /* Hilite current option */
1819 move_cursor(k + 2, 50);
1835 k = (n + k - 1) % n;
1853 (*autosave_info[k].o_var) = TRUE;
1862 (*autosave_info[k].o_var) = FALSE;
1870 autosave_freq = toggle_frequency(autosave_freq);
1872 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1873 autosave_freq), 5, 0);
1875 prt(format("Timed autosave frequency: every %d turns",
1876 autosave_freq), 5, 0);
1884 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1886 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1905 * Interact with some options
1907 void do_cmd_options_aux(int page, cptr info)
1910 int i, k = 0, n = 0, l;
1913 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1914 (!p_ptr->wizard || !allow_debug_opts);
1917 /* Lookup the options */
1918 for (i = 0; i < 24; i++) opt[i] = 0;
1920 /* Scan the options */
1921 for (i = 0; option_info[i].o_desc; i++)
1923 /* Notice options on this "page" */
1924 if (option_info[i].o_page == page) opt[n++] = i;
1931 /* Interact with the player */
1936 /* Prompt XXX XXX XXX */
1938 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
1940 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
1946 /* HACK -- description for easy-auto-destroy options */
1948 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1950 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1953 /* Display the options */
1954 for (i = 0; i < n; i++)
1956 byte a = TERM_WHITE;
1958 /* Color current option */
1959 if (i == k) a = TERM_L_BLUE;
1961 /* Display the option text */
1962 sprintf(buf, "%-48s: %s (%.19s)",
1963 option_info[opt[i]].o_desc,
1965 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1967 (*option_info[opt[i]].o_var ? "yes" : "no "),
1970 option_info[opt[i]].o_text);
1971 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1972 else c_prt(a, buf, i + 2, 0);
1975 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1978 /* Hilite current option */
1979 move_cursor(k + 2 + l, 50);
1985 * HACK - Try to translate the key into a direction
1986 * to allow using the roguelike keys for navigation.
1988 dir = get_keymap_dir(ch);
1989 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2003 k = (n + k - 1) % n;
2020 if (browse_only) break;
2021 (*option_info[opt[k]].o_var) = TRUE;
2030 if (browse_only) break;
2031 (*option_info[opt[k]].o_var) = FALSE;
2039 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2046 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2048 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2050 /* Peruse the help file */
2051 (void)show_file(TRUE, buf, NULL, 0, 0);
2068 * Modify the "window" options
2070 static void do_cmd_options_win(void)
2084 /* Memorize old flags */
2085 for (j = 0; j < 8; j++)
2087 /* Acquire current flags */
2088 old_flag[j] = window_flag[j];
2098 /* Prompt XXX XXX XXX */
2100 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2102 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2106 /* Display the windows */
2107 for (j = 0; j < 8; j++)
2109 byte a = TERM_WHITE;
2111 cptr s = angband_term_name[j];
2114 if (j == x) a = TERM_L_BLUE;
2116 /* Window name, staggered, centered */
2117 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2120 /* Display the options */
2121 for (i = 0; i < 16; i++)
2123 byte a = TERM_WHITE;
2125 cptr str = window_flag_desc[i];
2128 if (i == y) a = TERM_L_BLUE;
2132 if (!str) str = "(̤»ÈÍÑ)";
2134 if (!str) str = "(Unused option)";
2139 Term_putstr(0, i + 5, -1, a, str);
2141 /* Display the windows */
2142 for (j = 0; j < 8; j++)
2144 byte a = TERM_WHITE;
2149 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2152 if (window_flag[j] & (1L << i)) c = 'X';
2155 Term_putch(35 + j * 5, i + 5, a, c);
2160 Term_gotoxy(35 + x * 5, y + 5);
2178 for (j = 0; j < 8; j++)
2180 window_flag[j] &= ~(1L << y);
2184 for (i = 0; i < 16; i++)
2186 window_flag[x] &= ~(1L << i);
2199 window_flag[x] |= (1L << y);
2207 window_flag[x] &= ~(1L << y);
2214 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2216 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2226 d = get_keymap_dir(ch);
2228 x = (x + ddx[d] + 8) % 8;
2229 y = (y + ddy[d] + 16) % 16;
2236 /* Notice changes */
2237 for (j = 0; j < 8; j++)
2242 if (!angband_term[j]) continue;
2244 /* Ignore non-changes */
2245 if (window_flag[j] == old_flag[j]) continue;
2248 Term_activate(angband_term[j]);
2265 * Set or unset various options.
2267 * The user must use the "Ctrl-R" command to "adapt" to changes
2268 * in any options which control "visual" aspects of the game.
2270 void do_cmd_options(void)
2275 /* Save the screen */
2284 /* Why are we here */
2286 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2288 prt("Options", 1, 0);
2292 /* Give some choices */
2294 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 2, 5);
2295 prt("(2) ¥Þ¥Ã¥×²èÌÌ ¥ª¥×¥·¥ç¥ó", 3, 5);
2296 prt("(3) ¥Æ¥¥¹¥Èɽ¼¨ ¥ª¥×¥·¥ç¥ó", 4, 5);
2297 prt("(4) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 5, 5);
2298 prt("(5) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 6, 5);
2299 prt("(6) ´Ê°×¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 7, 5);
2300 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 8, 5);
2302 /* Special choices */
2303 prt("(P) ¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 10, 5);
2304 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
2305 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
2306 prt("(M) ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
2307 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2309 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2311 prt("(1) Input Options", 2, 5);
2312 prt("(2) Map Screen Options", 3, 5);
2313 prt("(3) Text Display Options", 4, 5);
2314 prt("(4) Game-Play Options", 5, 5);
2315 prt("(5) Disturbance Options", 6, 5);
2316 prt("(6) Easy Auto-Destroyer Options", 7, 5);
2317 prt("(R) Play-record Options", 8, 5);
2318 /* Special choices */
2319 prt("(P) Auto-picker/destroyer editor", 10, 5);
2320 prt("(D) Base Delay Factor", 11, 5);
2321 prt("(H) Hitpoint Warning", 12, 5);
2322 prt("(M) Mana Color Threshold", 13, 5);
2323 prt("(A) Autosave Options", 14, 5);
2325 prt("(W) Window Flags", 15, 5);
2328 if (!p_ptr->wizard || !allow_debug_opts)
2332 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
2334 prt("(B) Birth Options (Browse Only)", 16, 5);
2341 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó", 16, 5);
2343 prt("(B) Birth Options", 16, 5);
2348 if (p_ptr->noscore || allow_debug_opts)
2352 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 17, 5);
2354 prt("(C) Cheating Options", 17, 5);
2361 prt("¥³¥Þ¥ó¥É:", 19, 0);
2363 prt("Command: ", 19, 0);
2371 if (k == ESCAPE) break;
2378 /* Process the general options */
2380 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2382 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2390 /* Process the general options */
2392 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "¥Þ¥Ã¥×²èÌÌ¥ª¥×¥·¥ç¥ó");
2394 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
2404 do_cmd_options_aux(OPT_PAGE_TEXT, "¥Æ¥¥¹¥Èɽ¼¨¥ª¥×¥·¥ç¥ó");
2406 do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
2416 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2418 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2428 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2430 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2440 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2442 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2447 /* Play-record Options */
2453 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2455 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2466 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2468 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2474 /* Cheating Options */
2477 if (!p_ptr->noscore && !allow_debug_opts)
2479 /* Cheat options are not permitted */
2486 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2488 do_cmd_options_cheat("Cheaters never win");
2498 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2500 do_cmd_options_autosave("Autosave");
2511 do_cmd_options_win();
2512 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2513 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2514 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2515 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2519 /* Auto-picker/destroyer editor */
2523 do_cmd_edit_autopick();
2527 /* Hack -- Delay Speed */
2533 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2535 prt("Command: Base Delay Factor", 19, 0);
2539 /* Get a new value */
2542 int msec = delay_factor * delay_factor * delay_factor;
2544 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2545 delay_factor, msec), 22, 0);
2547 prt(format("Current base delay factor: %d (%d msec)",
2548 delay_factor, msec), 22, 0);
2552 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2554 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2558 if (k == ESCAPE) break;
2562 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2564 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2568 else if (isdigit(k)) delay_factor = D2I(k);
2575 /* Hack -- hitpoint warning factor */
2581 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2583 prt("Command: Hitpoint Warning", 19, 0);
2587 /* Get a new value */
2591 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2592 hitpoint_warn), 22, 0);
2594 prt(format("Current hitpoint warning: %d0%%",
2595 hitpoint_warn), 22, 0);
2599 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2601 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2605 if (k == ESCAPE) break;
2609 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2611 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2615 else if (isdigit(k)) hitpoint_warn = D2I(k);
2622 /* Hack -- mana color factor */
2628 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2630 prt("Command: Mana Color Threshold", 19, 0);
2634 /* Get a new value */
2638 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2641 prt(format("Current mana color threshold: %d0%%",
2646 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2648 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2652 if (k == ESCAPE) break;
2656 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2658 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2662 else if (isdigit(k)) mana_warn = D2I(k);
2671 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2673 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2678 /* Unknown option */
2687 /* Flush messages */
2692 /* Restore the screen */
2695 /* Hack - Redraw equippy chars */
2696 p_ptr->redraw |= (PR_EQUIPPY);
2702 * Ask for a "user pref line" and process it
2704 * XXX XXX XXX Allow absolute file names?
2706 void do_cmd_pref(void)
2713 /* Ask for a "user pref command" */
2715 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2717 if (!get_string("Pref: ", buf, 80)) return;
2721 /* Process that pref command */
2722 (void)process_pref_file_command(buf);
2725 void do_cmd_reload_autopick(void)
2728 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2730 if (!get_check("Reload auto-pick preference file? ")) return;
2733 /* Load the file with messages */
2734 autopick_load_pref(TRUE);
2740 * Hack -- append all current macros to the given file
2742 static errr macro_dump(cptr fname)
2744 static cptr mark = "Macro Dump";
2750 /* Build the filename */
2751 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2753 /* File type is "TEXT" */
2754 FILE_TYPE(FILE_TYPE_TEXT);
2756 /* Append to the file */
2757 if (!open_auto_dump(buf, mark)) return (-1);
2761 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2763 auto_dump_printf("\n# Automatic macro dump\n\n");
2767 for (i = 0; i < macro__num; i++)
2769 /* Extract the action */
2770 ascii_to_text(buf, macro__act[i]);
2772 /* Dump the macro */
2773 auto_dump_printf("A:%s\n", buf);
2775 /* Extract the action */
2776 ascii_to_text(buf, macro__pat[i]);
2778 /* Dump normal macros */
2779 auto_dump_printf("P:%s\n", buf);
2782 auto_dump_printf("\n");
2794 * Hack -- ask for a "trigger" (see below)
2796 * Note the complex use of the "inkey()" function from "util.c".
2798 * Note that both "flush()" calls are extremely important.
2800 static void do_cmd_macro_aux(char *buf)
2810 /* Do not process macros */
2816 /* Read the pattern */
2822 /* Do not process macros */
2825 /* Do not wait for keys */
2828 /* Attempt to read a key */
2839 /* Convert the trigger */
2840 ascii_to_text(tmp, buf);
2842 /* Hack -- display the trigger */
2843 Term_addstr(-1, TERM_WHITE, tmp);
2850 * Hack -- ask for a keymap "trigger" (see below)
2852 * Note that both "flush()" calls are extremely important. This may
2853 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2855 static void do_cmd_macro_aux_keymap(char *buf)
2869 /* Convert to ascii */
2870 ascii_to_text(tmp, buf);
2872 /* Hack -- display the trigger */
2873 Term_addstr(-1, TERM_WHITE, tmp);
2882 * Hack -- append all keymaps to the given file
2884 static errr keymap_dump(cptr fname)
2886 static cptr mark = "Keymap Dump";
2895 if (rogue_like_commands)
2897 mode = KEYMAP_MODE_ROGUE;
2903 mode = KEYMAP_MODE_ORIG;
2907 /* Build the filename */
2908 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2910 /* File type is "TEXT" */
2911 FILE_TYPE(FILE_TYPE_TEXT);
2913 /* Append to the file */
2914 if (!open_auto_dump(buf, mark)) return -1;
2918 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2920 auto_dump_printf("\n# Automatic keymap dump\n\n");
2924 for (i = 0; i < 256; i++)
2928 /* Loop up the keymap */
2929 act = keymap_act[mode][i];
2931 /* Skip empty keymaps */
2934 /* Encode the key */
2937 ascii_to_text(key, buf);
2939 /* Encode the action */
2940 ascii_to_text(buf, act);
2942 /* Dump the macro */
2943 auto_dump_printf("A:%s\n", buf);
2944 auto_dump_printf("C:%d:%s\n", mode, key);
2957 * Interact with "macros"
2959 * Note that the macro "action" must be defined before the trigger.
2961 * Could use some helpful instructions on this page. XXX XXX XXX
2963 void do_cmd_macros(void)
2975 if (rogue_like_commands)
2977 mode = KEYMAP_MODE_ROGUE;
2983 mode = KEYMAP_MODE_ORIG;
2986 /* File type is "TEXT" */
2987 FILE_TYPE(FILE_TYPE_TEXT);
2994 /* Process requests until done */
3002 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3004 prt("Interact with Macros", 2, 0);
3009 /* Describe that action */
3011 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3013 prt("Current action (if any) shown below:", 20, 0);
3017 /* Analyze the current action */
3018 ascii_to_text(buf, macro__buf);
3020 /* Display the current action */
3026 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3028 prt("(1) Load a user pref file", 4, 5);
3033 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3034 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3035 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3036 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3037 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3038 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3039 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3040 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3041 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3043 prt("(2) Append macros to a file", 5, 5);
3044 prt("(3) Query a macro", 6, 5);
3045 prt("(4) Create a macro", 7, 5);
3046 prt("(5) Remove a macro", 8, 5);
3047 prt("(6) Append keymaps to a file", 9, 5);
3048 prt("(7) Query a keymap", 10, 5);
3049 prt("(8) Create a keymap", 11, 5);
3050 prt("(9) Remove a keymap", 12, 5);
3051 prt("(0) Enter a new action", 13, 5);
3054 #endif /* ALLOW_MACROS */
3058 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3060 prt("Command: ", 16, 0);
3068 if (i == ESCAPE) break;
3070 /* Load a 'macro' file */
3077 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3079 prt("Command: Load a user pref file", 16, 0);
3085 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3087 prt("File: ", 18, 0);
3091 /* Default filename */
3092 sprintf(tmp, "%s.prf", player_name);
3094 /* Ask for a file */
3095 if (!askfor(tmp, 80)) continue;
3097 /* Process the given filename */
3098 err = process_pref_file(tmp);
3102 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3104 msg_format("Loaded default '%s'.", tmp);
3111 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3113 msg_format("Failed to load '%s'!");
3119 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3121 msg_format("Loaded '%s'.", tmp);
3133 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3135 prt("Command: Append macros to a file", 16, 0);
3141 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3143 prt("File: ", 18, 0);
3147 /* Default filename */
3148 sprintf(tmp, "%s.prf", player_name);
3150 /* Ask for a file */
3151 if (!askfor(tmp, 80)) continue;
3153 /* Dump the macros */
3154 (void)macro_dump(tmp);
3158 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3160 msg_print("Appended macros.");
3172 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3174 prt("Command: Query a macro", 16, 0);
3180 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3182 prt("Trigger: ", 18, 0);
3186 /* Get a macro trigger */
3187 do_cmd_macro_aux(buf);
3189 /* Acquire action */
3190 k = macro_find_exact(buf);
3197 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3199 msg_print("Found no macro.");
3207 /* Obtain the action */
3208 strcpy(macro__buf, macro__act[k]);
3210 /* Analyze the current action */
3211 ascii_to_text(buf, macro__buf);
3213 /* Display the current action */
3218 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3220 msg_print("Found a macro.");
3226 /* Create a macro */
3231 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3233 prt("Command: Create a macro", 16, 0);
3239 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3241 prt("Trigger: ", 18, 0);
3245 /* Get a macro trigger */
3246 do_cmd_macro_aux(buf);
3253 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3255 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3260 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3262 prt("Action: ", 20, 0);
3266 /* Convert to text */
3267 ascii_to_text(tmp, macro__buf);
3269 /* Get an encoded action */
3270 if (askfor(tmp, 80))
3272 /* Convert to ascii */
3273 text_to_ascii(macro__buf, tmp);
3275 /* Link the macro */
3276 macro_add(buf, macro__buf);
3280 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3282 msg_print("Added a macro.");
3288 /* Remove a macro */
3293 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3295 prt("Command: Remove a macro", 16, 0);
3301 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3303 prt("Trigger: ", 18, 0);
3307 /* Get a macro trigger */
3308 do_cmd_macro_aux(buf);
3310 /* Link the macro */
3311 macro_add(buf, buf);
3315 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3317 msg_print("Removed a macro.");
3327 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3329 prt("Command: Append keymaps to a file", 16, 0);
3335 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3337 prt("File: ", 18, 0);
3341 /* Default filename */
3342 sprintf(tmp, "%s.prf", player_name);
3344 /* Ask for a file */
3345 if (!askfor(tmp, 80)) continue;
3347 /* Dump the macros */
3348 (void)keymap_dump(tmp);
3352 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3354 msg_print("Appended keymaps.");
3359 /* Query a keymap */
3366 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3368 prt("Command: Query a keymap", 16, 0);
3374 prt("²¡¤¹¥¡¼: ", 18, 0);
3376 prt("Keypress: ", 18, 0);
3380 /* Get a keymap trigger */
3381 do_cmd_macro_aux_keymap(buf);
3383 /* Look up the keymap */
3384 act = keymap_act[mode][(byte)(buf[0])];
3391 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3393 msg_print("Found no keymap.");
3401 /* Obtain the action */
3402 strcpy(macro__buf, act);
3404 /* Analyze the current action */
3405 ascii_to_text(buf, macro__buf);
3407 /* Display the current action */
3412 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3414 msg_print("Found a keymap.");
3420 /* Create a keymap */
3425 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3427 prt("Command: Create a keymap", 16, 0);
3433 prt("²¡¤¹¥¡¼: ", 18, 0);
3435 prt("Keypress: ", 18, 0);
3439 /* Get a keymap trigger */
3440 do_cmd_macro_aux_keymap(buf);
3447 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3449 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3454 prt("¹ÔÆ°: ", 20, 0);
3456 prt("Action: ", 20, 0);
3460 /* Convert to text */
3461 ascii_to_text(tmp, macro__buf);
3463 /* Get an encoded action */
3464 if (askfor(tmp, 80))
3466 /* Convert to ascii */
3467 text_to_ascii(macro__buf, tmp);
3469 /* Free old keymap */
3470 string_free(keymap_act[mode][(byte)(buf[0])]);
3472 /* Make new keymap */
3473 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3477 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3479 msg_print("Added a keymap.");
3485 /* Remove a keymap */
3490 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3492 prt("Command: Remove a keymap", 16, 0);
3498 prt("²¡¤¹¥¡¼: ", 18, 0);
3500 prt("Keypress: ", 18, 0);
3504 /* Get a keymap trigger */
3505 do_cmd_macro_aux_keymap(buf);
3507 /* Free old keymap */
3508 string_free(keymap_act[mode][(byte)(buf[0])]);
3510 /* Make new keymap */
3511 keymap_act[mode][(byte)(buf[0])] = NULL;
3515 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3517 msg_print("Removed a keymap.");
3522 /* Enter a new action */
3527 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3529 prt("Command: Enter a new action", 16, 0);
3537 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3539 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3544 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3546 prt("Action: ", 20, 0);
3549 /* Hack -- limit the value */
3552 /* Get an encoded action */
3553 if (!askfor(buf, 80)) continue;
3555 /* Extract an action */
3556 text_to_ascii(macro__buf, buf);
3559 #endif /* ALLOW_MACROS */
3568 /* Flush messages */
3577 static cptr lighting_level_str[F_LIT_MAX] =
3591 static bool cmd_visuals_aux(int i, int *num, int max)
3598 sprintf(str, "%d", *num);
3600 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3603 tmp = strtol(str, NULL, 0);
3604 if (tmp >= 0 && tmp < max)
3607 else if (isupper(i))
3608 *num = (*num + max - 1) % max;
3610 *num = (*num + 1) % max;
3615 static void print_visuals_menu(cptr choice_msg)
3618 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 1, 0);
3620 prt("Interact with Visuals", 1, 0);
3623 /* Give some choices */
3625 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3627 prt("(0) Load a user pref file", 3, 5);
3630 #ifdef ALLOW_VISUALS
3632 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3633 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3634 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3635 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3636 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3637 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3638 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3639 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3640 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3642 prt("(1) Dump monster attr/chars", 4, 5);
3643 prt("(2) Dump object attr/chars", 5, 5);
3644 prt("(3) Dump feature attr/chars", 6, 5);
3645 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3646 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3647 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3648 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3649 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3650 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3653 #endif /* ALLOW_VISUALS */
3656 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3658 prt("(R) Reset visuals", 13, 5);
3663 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3665 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3669 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3670 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3671 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3674 * Interact with "visuals"
3676 void do_cmd_visuals(void)
3681 bool need_redraw = FALSE;
3682 const char *empty_symbol = "<< ? >>";
3684 if (use_bigtile) empty_symbol = "<< ?? >>";
3686 /* File type is "TEXT" */
3687 FILE_TYPE(FILE_TYPE_TEXT);
3689 /* Save the screen */
3692 /* Interact until done */
3698 /* Ask for a choice */
3699 print_visuals_menu(NULL);
3705 if (i == ESCAPE) break;
3709 /* Load a 'pref' file */
3713 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3715 prt("Command: Load a user pref file", 15, 0);
3720 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3722 prt("File: ", 17, 0);
3725 /* Default filename */
3726 sprintf(tmp, "%s.prf", player_name);
3729 if (!askfor(tmp, 70)) continue;
3731 /* Process the given filename */
3732 (void)process_pref_file(tmp);
3737 #ifdef ALLOW_VISUALS
3739 /* Dump monster attr/chars */
3742 static cptr mark = "Monster attr/chars";
3746 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3748 prt("Command: Dump monster attr/chars", 15, 0);
3753 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3755 prt("File: ", 17, 0);
3758 /* Default filename */
3759 sprintf(tmp, "%s.prf", player_name);
3761 /* Get a filename */
3762 if (!askfor(tmp, 70)) continue;
3764 /* Build the filename */
3765 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3767 /* Append to the file */
3768 if (!open_auto_dump(buf, mark)) continue;
3772 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3774 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3778 for (i = 1; i < max_r_idx; i++)
3780 monster_race *r_ptr = &r_info[i];
3782 /* Skip non-entries */
3783 if (!r_ptr->name) continue;
3785 /* Dump a comment */
3786 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3788 /* Dump the monster attr/char info */
3789 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3790 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3798 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3800 msg_print("Dumped monster attr/chars.");
3806 /* Dump object attr/chars */
3809 static cptr mark = "Object attr/chars";
3813 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3815 prt("Command: Dump object attr/chars", 15, 0);
3820 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3822 prt("File: ", 17, 0);
3825 /* Default filename */
3826 sprintf(tmp, "%s.prf", player_name);
3828 /* Get a filename */
3829 if (!askfor(tmp, 70)) continue;
3831 /* Build the filename */
3832 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3834 /* Append to the file */
3835 if (!open_auto_dump(buf, mark)) continue;
3839 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3841 auto_dump_printf("\n# Object attr/char definitions\n\n");
3845 for (i = 1; i < max_k_idx; i++)
3848 object_kind *k_ptr = &k_info[i];
3850 /* Skip non-entries */
3851 if (!k_ptr->name) continue;
3856 strip_name(o_name, i);
3862 /* Prepare dummy object */
3863 object_prep(&forge, i);
3865 /* Get un-shuffled flavor name */
3866 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3869 /* Dump a comment */
3870 auto_dump_printf("# %s\n", o_name);
3872 /* Dump the object attr/char info */
3873 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3874 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3882 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3884 msg_print("Dumped object attr/chars.");
3890 /* Dump feature attr/chars */
3893 static cptr mark = "Feature attr/chars";
3897 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3899 prt("Command: Dump feature attr/chars", 15, 0);
3904 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3906 prt("File: ", 17, 0);
3909 /* Default filename */
3910 sprintf(tmp, "%s.prf", player_name);
3912 /* Get a filename */
3913 if (!askfor(tmp, 70)) continue;
3915 /* Build the filename */
3916 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3918 /* Append to the file */
3919 if (!open_auto_dump(buf, mark)) continue;
3923 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3925 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3929 for (i = 1; i < max_f_idx; i++)
3931 feature_type *f_ptr = &f_info[i];
3933 /* Skip non-entries */
3934 if (!f_ptr->name) continue;
3936 /* Skip mimiccing features */
3937 if (f_ptr->mimic != i) continue;
3939 /* Dump a comment */
3940 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3942 /* Dump the feature attr/char info */
3943 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3944 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3945 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3946 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3954 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3956 msg_print("Dumped feature attr/chars.");
3962 /* Modify monster attr/chars (numeric operation) */
3966 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
3968 static cptr choice_msg = "Change monster attr/chars";
3973 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
3975 prt(format("Command: %s", choice_msg), 15, 0);
3978 /* Hack -- query until done */
3981 monster_race *r_ptr = &r_info[r];
3985 byte da = r_ptr->d_attr;
3986 byte dc = r_ptr->d_char;
3987 byte ca = r_ptr->x_attr;
3988 byte cc = r_ptr->x_char;
3990 /* Label the object */
3992 Term_putstr(5, 17, -1, TERM_WHITE,
3993 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
3994 r, (r_name + r_ptr->name)));
3996 Term_putstr(5, 17, -1, TERM_WHITE,
3997 format("Monster = %d, Name = %-40.40s",
3998 r, (r_name + r_ptr->name)));
4001 /* Label the Default values */
4003 Term_putstr(10, 19, -1, TERM_WHITE,
4004 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4006 Term_putstr(10, 19, -1, TERM_WHITE,
4007 format("Default attr/char = %3u / %3u", da, dc));
4010 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4011 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4013 /* Label the Current values */
4015 Term_putstr(10, 20, -1, TERM_WHITE,
4016 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4018 Term_putstr(10, 20, -1, TERM_WHITE,
4019 format("Current attr/char = %3u / %3u", ca, cc));
4022 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4023 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4027 Term_putstr(0, 22, -1, TERM_WHITE,
4028 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4030 Term_putstr(0, 22, -1, TERM_WHITE,
4031 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4038 if (i == ESCAPE) break;
4040 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4041 else if (isupper(i)) c = 'a' + i - 'A';
4051 if (!cmd_visuals_aux(i, &r, max_r_idx))
4057 while (!r_info[r].name);
4061 t = (int)r_ptr->x_attr;
4062 (void)cmd_visuals_aux(i, &t, 256);
4063 r_ptr->x_attr = (byte)t;
4067 t = (int)r_ptr->x_char;
4068 (void)cmd_visuals_aux(i, &t, 256);
4069 r_ptr->x_char = (byte)t;
4073 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4077 print_visuals_menu(choice_msg);
4085 /* Modify object attr/chars (numeric operation) */
4089 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4091 static cptr choice_msg = "Change object attr/chars";
4096 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4098 prt(format("Command: %s", choice_msg), 15, 0);
4101 /* Hack -- query until done */
4104 object_kind *k_ptr = &k_info[k];
4108 byte da = k_ptr->d_attr;
4109 byte dc = k_ptr->d_char;
4110 byte ca = k_ptr->x_attr;
4111 byte cc = k_ptr->x_char;
4113 /* Label the object */
4115 Term_putstr(5, 17, -1, TERM_WHITE,
4116 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4117 k, (k_name + k_ptr->name)));
4119 Term_putstr(5, 17, -1, TERM_WHITE,
4120 format("Object = %d, Name = %-40.40s",
4121 k, (k_name + k_ptr->name)));
4124 /* Label the Default values */
4126 Term_putstr(10, 19, -1, TERM_WHITE,
4127 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4129 Term_putstr(10, 19, -1, TERM_WHITE,
4130 format("Default attr/char = %3d / %3d", da, dc));
4133 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4134 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4136 /* Label the Current values */
4138 Term_putstr(10, 20, -1, TERM_WHITE,
4139 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4141 Term_putstr(10, 20, -1, TERM_WHITE,
4142 format("Current attr/char = %3d / %3d", ca, cc));
4145 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4146 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4150 Term_putstr(0, 22, -1, TERM_WHITE,
4151 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4153 Term_putstr(0, 22, -1, TERM_WHITE,
4154 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4161 if (i == ESCAPE) break;
4163 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4164 else if (isupper(i)) c = 'a' + i - 'A';
4174 if (!cmd_visuals_aux(i, &k, max_k_idx))
4180 while (!k_info[k].name || k_info[k].flavor);
4184 t = (int)k_ptr->x_attr;
4185 (void)cmd_visuals_aux(i, &t, 256);
4186 k_ptr->x_attr = (byte)t;
4190 t = (int)k_ptr->x_char;
4191 (void)cmd_visuals_aux(i, &t, 256);
4192 k_ptr->x_char = (byte)t;
4196 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4200 print_visuals_menu(choice_msg);
4208 /* Modify feature attr/chars (numeric operation) */
4212 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4214 static cptr choice_msg = "Change feature attr/chars";
4217 static int lighting_level = F_LIT_STANDARD;
4220 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4222 prt(format("Command: %s", choice_msg), 15, 0);
4225 /* Hack -- query until done */
4228 feature_type *f_ptr = &f_info[f];
4232 byte da = f_ptr->d_attr[lighting_level];
4233 byte dc = f_ptr->d_char[lighting_level];
4234 byte ca = f_ptr->x_attr[lighting_level];
4235 byte cc = f_ptr->x_char[lighting_level];
4237 /* Label the object */
4240 Term_putstr(5, 17, -1, TERM_WHITE,
4241 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4242 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4244 Term_putstr(5, 17, -1, TERM_WHITE,
4245 format("Terrain = %d, Name = %s, Lighting = %s",
4246 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4249 /* Label the Default values */
4251 Term_putstr(10, 19, -1, TERM_WHITE,
4252 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4254 Term_putstr(10, 19, -1, TERM_WHITE,
4255 format("Default attr/char = %3d / %3d", da, dc));
4258 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4260 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4262 /* Label the Current values */
4264 Term_putstr(10, 20, -1, TERM_WHITE,
4265 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4267 Term_putstr(10, 20, -1, TERM_WHITE,
4268 format("Current attr/char = %3d / %3d", ca, cc));
4271 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4272 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4276 Term_putstr(0, 22, -1, TERM_WHITE,
4277 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4279 Term_putstr(0, 22, -1, TERM_WHITE,
4280 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4287 if (i == ESCAPE) break;
4289 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4290 else if (isupper(i)) c = 'a' + i - 'A';
4300 if (!cmd_visuals_aux(i, &f, max_f_idx))
4306 while (!f_info[f].name || (f_info[f].mimic != f));
4310 t = (int)f_ptr->x_attr[lighting_level];
4311 (void)cmd_visuals_aux(i, &t, 256);
4312 f_ptr->x_attr[lighting_level] = (byte)t;
4316 t = (int)f_ptr->x_char[lighting_level];
4317 (void)cmd_visuals_aux(i, &t, 256);
4318 f_ptr->x_char[lighting_level] = (byte)t;
4322 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4325 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4329 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4333 print_visuals_menu(choice_msg);
4341 /* Modify monster attr/chars (visual mode) */
4343 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4346 /* Modify object attr/chars (visual mode) */
4348 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4351 /* Modify feature attr/chars (visual mode) */
4354 int lighting_level = F_LIT_STANDARD;
4355 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4359 #endif /* ALLOW_VISUALS */
4369 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4371 msg_print("Visual attr/char tables reset.");
4377 /* Unknown option */
4383 /* Flush messages */
4387 /* Restore the screen */
4390 if (need_redraw) do_cmd_redraw();
4395 * Interact with "colors"
4397 void do_cmd_colors(void)
4406 /* File type is "TEXT" */
4407 FILE_TYPE(FILE_TYPE_TEXT);
4410 /* Save the screen */
4414 /* Interact until done */
4420 /* Ask for a choice */
4422 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4424 prt("Interact with Colors", 2, 0);
4428 /* Give some choices */
4430 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4432 prt("(1) Load a user pref file", 4, 5);
4437 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4438 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4440 prt("(2) Dump colors", 5, 5);
4441 prt("(3) Modify colors", 6, 5);
4448 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4450 prt("Command: ", 8, 0);
4458 if (i == ESCAPE) break;
4460 /* Load a 'pref' file */
4465 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4467 prt("Command: Load a user pref file", 8, 0);
4473 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4475 prt("File: ", 10, 0);
4480 sprintf(tmp, "%s.prf", player_name);
4483 if (!askfor(tmp, 70)) continue;
4485 /* Process the given filename */
4486 (void)process_pref_file(tmp);
4488 /* Mega-Hack -- react to changes */
4489 Term_xtra(TERM_XTRA_REACT, 0);
4491 /* Mega-Hack -- redraw */
4500 static cptr mark = "Colors";
4504 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4506 prt("Command: Dump colors", 8, 0);
4512 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4514 prt("File: ", 10, 0);
4518 /* Default filename */
4519 sprintf(tmp, "%s.prf", player_name);
4521 /* Get a filename */
4522 if (!askfor(tmp, 70)) continue;
4524 /* Build the filename */
4525 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4527 /* Append to the file */
4528 if (!open_auto_dump(buf, mark)) continue;
4532 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4534 auto_dump_printf("\n# Color redefinitions\n\n");
4538 for (i = 0; i < 256; i++)
4540 int kv = angband_color_table[i][0];
4541 int rv = angband_color_table[i][1];
4542 int gv = angband_color_table[i][2];
4543 int bv = angband_color_table[i][3];
4548 cptr name = "unknown";
4552 /* Skip non-entries */
4553 if (!kv && !rv && !gv && !bv) continue;
4555 /* Extract the color name */
4556 if (i < 16) name = color_names[i];
4558 /* Dump a comment */
4560 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4562 auto_dump_printf("# Color '%s'\n", name);
4565 /* Dump the monster attr/char info */
4566 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4575 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4577 msg_print("Dumped color redefinitions.");
4589 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4591 prt("Command: Modify colors", 8, 0);
4595 /* Hack -- query until done */
4604 /* Exhibit the normal colors */
4605 for (j = 0; j < 16; j++)
4607 /* Exhibit this color */
4608 Term_putstr(j*4, 20, -1, a, "###");
4610 /* Exhibit all colors */
4611 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4614 /* Describe the color */
4616 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4618 name = ((a < 16) ? color_names[a] : "undefined");
4622 /* Describe the color */
4624 Term_putstr(5, 10, -1, TERM_WHITE,
4625 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4627 Term_putstr(5, 10, -1, TERM_WHITE,
4628 format("Color = %d, Name = %s", a, name));
4632 /* Label the Current values */
4633 Term_putstr(5, 12, -1, TERM_WHITE,
4634 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4635 angband_color_table[a][0],
4636 angband_color_table[a][1],
4637 angband_color_table[a][2],
4638 angband_color_table[a][3]));
4642 Term_putstr(0, 14, -1, TERM_WHITE,
4643 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4645 Term_putstr(0, 14, -1, TERM_WHITE,
4646 "Command (n/N/k/K/r/R/g/G/b/B): ");
4654 if (i == ESCAPE) break;
4657 if (i == 'n') a = (byte)(a + 1);
4658 if (i == 'N') a = (byte)(a - 1);
4659 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4660 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4661 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4662 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4663 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4664 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4665 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4666 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4668 /* Hack -- react to changes */
4669 Term_xtra(TERM_XTRA_REACT, 0);
4671 /* Hack -- redraw */
4678 /* Unknown option */
4684 /* Flush messages */
4689 /* Restore the screen */
4695 * Note something in the message recall
4697 void do_cmd_note(void)
4706 if (!get_string("¥á¥â: ", buf, 60)) return;
4708 if (!get_string("Note: ", buf, 60)) return;
4712 /* Ignore empty notes */
4713 if (!buf[0] || (buf[0] == ' ')) return;
4715 /* Add the note to the message recall */
4717 msg_format("¥á¥â: %s", buf);
4719 msg_format("Note: %s", buf);
4726 * Mention the current version
4728 void do_cmd_version(void)
4733 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4734 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4736 msg_format("You are playing Hengband %d.%d.%d.",
4737 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4744 * Array of feeling strings
4746 static cptr do_cmd_feeling_text[11] =
4749 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4751 "Looks like any other level.",
4755 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4757 "You feel there is something special about this level.",
4761 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4763 "You nearly faint as horrible visions of death fill your mind!",
4767 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4769 "This level looks very dangerous.",
4773 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4775 "You have a very bad feeling...",
4779 "°¤¤Í½´¶¤¬¤¹¤ë...",
4781 "You have a bad feeling...",
4787 "You feel nervous.",
4791 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4793 "You feel your luck is turning...",
4797 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4799 "You don't like the look of this place.",
4803 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4805 "This level looks reasonably safe.",
4809 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4811 "What a boring place..."
4816 static cptr do_cmd_feeling_text_combat[11] =
4819 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4821 "Looks like any other level.",
4825 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4827 "You feel there is something special about this level.",
4831 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4833 "You nearly faint as horrible visions of death fill your mind!",
4837 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4839 "This level looks very dangerous.",
4843 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4845 "You have a very bad feeling...",
4849 "°¤¤Í½´¶¤¬¤¹¤ë...",
4851 "You have a bad feeling...",
4857 "You feel nervous.",
4861 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4863 "You feel your luck is turning...",
4867 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4869 "You don't like the look of this place.",
4873 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4875 "This level looks reasonably safe.",
4879 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4881 "What a boring place..."
4886 static cptr do_cmd_feeling_text_lucky[11] =
4889 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4890 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4891 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4892 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4893 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4894 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4895 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4896 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4897 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4898 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4899 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4901 "Looks like any other level.",
4902 "You feel there is something special about this level.",
4903 "You have a superb feeling about this level.",
4904 "You have an excellent feeling...",
4905 "You have a very good feeling...",
4906 "You have a good feeling...",
4907 "You feel strangely lucky...",
4908 "You feel your luck is turning...",
4909 "You like the look of this place...",
4910 "This level can't be all bad...",
4911 "What a boring place..."
4917 * Note that "feeling" is set to zero unless some time has passed.
4918 * Note that this is done when the level is GENERATED, not entered.
4920 void do_cmd_feeling(void)
4922 /* No useful feeling in quests */
4923 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4926 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4928 msg_print("Looks like a typical quest level.");
4934 /* No useful feeling in town */
4935 else if (p_ptr->town_num && !dun_level)
4938 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4940 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4944 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4946 msg_print("Looks like a strange wilderness.");
4954 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4956 msg_print("Looks like a typical town.");
4963 /* No useful feeling in the wilderness */
4964 else if (!dun_level)
4967 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4969 msg_print("Looks like a typical wilderness.");
4975 /* Display the feeling */
4976 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
4977 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
4978 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
4979 inventory[INVEN_BOW].name1 == ART_CRIMSON)
4980 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
4982 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
4988 * Description of each monster group.
4990 static cptr monster_group_text[] =
4993 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
4994 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5023 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5040 /* "¾åµé¥Ç¡¼¥â¥ó", */
5082 /* "Ancient Dragon/Wyrm", */
5091 "Multi-Headed Reptile",
5096 "Reptile/Amphibian",
5097 "Spider/Scorpion/Tick",
5099 /* "Major Demon", */
5116 * Symbols of monsters in each group. Note the "Uniques" group
5117 * is handled differently.
5119 static cptr monster_group_char[] =
5174 "!$&()+./=>?[\\]`{|~",
5184 * hook function to sort monsters by level
5186 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5188 u16b *who = (u16b*)(u);
5193 monster_race *r_ptr1 = &r_info[w1];
5194 monster_race *r_ptr2 = &r_info[w2];
5199 if (r_ptr2->level > r_ptr1->level) return TRUE;
5200 if (r_ptr1->level > r_ptr2->level) return FALSE;
5202 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5203 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5208 * Build a list of monster indexes in the given group. Return the number
5209 * of monsters in the group.
5211 * mode & 0x01 : check for non-empty group
5212 * mode & 0x02 : visual operation only
5214 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5219 /* Get a list of x_char in this group */
5220 cptr group_char = monster_group_char[grp_cur];
5222 /* XXX Hack -- Check if this is the "Uniques" group */
5223 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5225 /* XXX Hack -- Check if this is the "Riding" group */
5226 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5228 /* Check every race */
5229 for (i = 0; i < max_r_idx; i++)
5231 /* Access the race */
5232 monster_race *r_ptr = &r_info[i];
5234 /* Skip empty race */
5235 if (!r_ptr->name) continue ;
5237 /* Require known monsters */
5238 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5242 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5245 else if (grp_riding)
5247 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5252 /* Check for race in the group */
5253 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5257 mon_idx[mon_cnt++] = i;
5259 /* XXX Hack -- Just checking for non-empty group */
5260 if (mode & 0x01) break;
5263 /* Terminate the list */
5264 mon_idx[mon_cnt] = -1;
5266 /* Select the sort method */
5267 ang_sort_comp = ang_sort_comp_monster_level;
5268 ang_sort_swap = ang_sort_swap_hook;
5270 /* Sort by monster level */
5271 ang_sort(mon_idx, &dummy_why, mon_cnt);
5273 /* Return the number of races */
5279 * Description of each monster group.
5281 static cptr object_group_text[] =
5284 "¥¥Î¥³", /* "Mushrooms" */
5285 "Ìô", /* "Potions" */
5286 "Ìý¤Ä¤Ü", /* "Flasks" */
5287 "´¬Êª", /* "Scrolls" */
5288 "»ØÎØ", /* "Rings" */
5289 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5290 "ū", /* "Whistle" */
5291 "¸÷¸»", /* "Lanterns" */
5292 "ËâË¡ËÀ", /* "Wands" */
5293 "¾ó", /* "Staffs" */
5294 "¥í¥Ã¥É", /* "Rods" */
5295 "¥«¡¼¥É", /* "Cards" */
5296 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5305 "Åá·õÎà", /* "Swords" */
5306 "Æß´ï", /* "Blunt Weapons" */
5307 "ĹÊÁÉð´ï", /* "Polearms" */
5308 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5309 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5313 "·ÚÁõ³»", /* "Soft Armor" */
5314 "½ÅÁõ³»", /* "Hard Armor" */
5315 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5316 "½â", /* "Shields" */
5317 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5318 "äƼê", /* "Gloves" */
5319 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5320 "´§", /* "Crowns" */
5321 "¥Ö¡¼¥Ä", /* "Boots" */
5371 * TVALs of items in each group
5373 static byte object_group_tval[] =
5413 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5420 * Build a list of object indexes in the given group. Return the number
5421 * of objects in the group.
5423 * mode & 0x01 : check for non-empty group
5424 * mode & 0x02 : visual operation only
5426 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5428 int i, j, k, object_cnt = 0;
5430 /* Get a list of x_char in this group */
5431 byte group_tval = object_group_tval[grp_cur];
5433 /* Check every object */
5434 for (i = 0; i < max_k_idx; i++)
5436 /* Access the object */
5437 object_kind *k_ptr = &k_info[i];
5439 /* Skip empty objects */
5440 if (!k_ptr->name) continue;
5444 /* Any objects will be displayed */
5450 /* Skip non-flavoured objects */
5451 if (!k_ptr->flavor) continue;
5453 /* Require objects ever seen */
5454 if (!k_ptr->aware) continue;
5457 /* Skip items with no distribution (special artifacts) */
5458 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5462 /* Check for objects in the group */
5463 if (TV_LIFE_BOOK == group_tval)
5465 /* Hack -- All spell books */
5466 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5468 /* Add the object */
5469 object_idx[object_cnt++] = i;
5473 else if (k_ptr->tval == group_tval)
5475 /* Add the object */
5476 object_idx[object_cnt++] = i;
5480 /* XXX Hack -- Just checking for non-empty group */
5481 if (mode & 0x01) break;
5484 /* Terminate the list */
5485 object_idx[object_cnt] = -1;
5487 /* Return the number of objects */
5493 * Description of each feature group.
5495 static cptr feature_group_text[] =
5503 * Build a list of feature indexes in the given group. Return the number
5504 * of features in the group.
5506 * mode & 0x01 : check for non-empty group
5508 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5510 int i, feat_cnt = 0;
5512 /* Unused; There is a single group. */
5515 /* Check every feature */
5516 for (i = 0; i < max_f_idx; i++)
5518 /* Access the index */
5519 feature_type *f_ptr = &f_info[i];
5521 /* Skip empty index */
5522 if (!f_ptr->name) continue;
5524 /* Skip mimiccing features */
5525 if (f_ptr->mimic != i) continue;
5528 feat_idx[feat_cnt++] = i;
5530 /* XXX Hack -- Just checking for non-empty group */
5531 if (mode & 0x01) break;
5534 /* Terminate the list */
5535 feat_idx[feat_cnt] = -1;
5537 /* Return the number of races */
5544 * Build a list of monster indexes in the given group. Return the number
5545 * of monsters in the group.
5547 static int collect_artifacts(int grp_cur, int object_idx[])
5549 int i, object_cnt = 0;
5551 /* Get a list of x_char in this group */
5552 byte group_tval = object_group_tval[grp_cur];
5554 /* Check every object */
5555 for (i = 0; i < max_a_idx; i++)
5557 /* Access the artifact */
5558 artifact_type *a_ptr = &a_info[i];
5560 /* Skip empty artifacts */
5561 if (!a_ptr->name) continue;
5563 /* Skip "uncreated" artifacts */
5564 if (!a_ptr->cur_num) continue;
5566 /* Check for race in the group */
5567 if (a_ptr->tval == group_tval)
5570 object_idx[object_cnt++] = i;
5574 /* Terminate the list */
5575 object_idx[object_cnt] = 0;
5577 /* Return the number of races */
5584 * Encode the screen colors
5586 static char hack[17] = "dwsorgbuDWvyRGBU";
5590 * Hack -- load a screen dump from a file
5592 void do_cmd_load_screen(void)
5607 Term_get_size(&wid, &hgt);
5609 /* Build the filename */
5610 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5612 /* Append to the file */
5613 fff = my_fopen(buf, "r");
5618 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5620 msg_format("Failed to open %s.", buf);
5627 /* Save the screen */
5630 /* Clear the screen */
5634 /* Load the screen */
5635 for (y = 0; okay; y++)
5637 /* Get a line of data including control code */
5638 if (!fgets(buf, 1024, fff)) okay = FALSE;
5640 /* Get the blank line */
5641 if (buf[0] == '\n' || buf[0] == '\0') break;
5643 /* Ignore too large screen image */
5644 if (y >= hgt) continue;
5647 for (x = 0; x < wid - 1; x++)
5650 if (buf[x] == '\n' || buf[x] == '\0') break;
5652 /* Put the attr/char */
5653 Term_draw(x, y, TERM_WHITE, buf[x]);
5657 /* Dump the screen */
5658 for (y = 0; okay; y++)
5660 /* Get a line of data including control code */
5661 if (!fgets(buf, 1024, fff)) okay = FALSE;
5663 /* Get the blank line */
5664 if (buf[0] == '\n' || buf[0] == '\0') break;
5666 /* Ignore too large screen image */
5667 if (y >= hgt) continue;
5670 for (x = 0; x < wid - 1; x++)
5673 if (buf[x] == '\n' || buf[x] == '\0') break;
5675 /* Get the attr/char */
5676 (void)(Term_what(x, y, &a, &c));
5678 /* Look up the attr */
5679 for (i = 0; i < 16; i++)
5681 /* Use attr matches */
5682 if (hack[i] == buf[x]) a = i;
5685 /* Put the attr/char */
5686 Term_draw(x, y, a, c);
5697 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5699 msg_print("Screen dump loaded.");
5706 /* Restore the screen */
5713 cptr inven_res_label =
5715 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5717 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5722 #define IM_FLAG_STR "¡ö"
5723 #define HAS_FLAG_STR "¡Ü"
5724 #define NO_FLAG_STR "¡¦"
5726 #define IM_FLAG_STR "* "
5727 #define HAS_FLAG_STR "+ "
5728 #define NO_FLAG_STR ". "
5731 #define print_im_or_res_flag(IM, RES) \
5733 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5734 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5737 #define print_flag(TR) \
5739 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5743 /* XTRA HACK RESLIST */
5744 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5746 char o_name[MAX_NLEN];
5747 u32b flgs[TR_FLAG_SIZE];
5749 if (!o_ptr->k_idx) return;
5750 if (o_ptr->tval != tval) return;
5752 /* Identified items only */
5753 if (!object_is_known(o_ptr)) return;
5756 * HACK:Ring of Lordly protection and Dragon equipment
5757 * have random resistances.
5759 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5760 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5761 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5762 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5763 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5764 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5765 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5766 || object_is_artifact(o_ptr))
5769 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5771 while (o_name[i] && (i < 26))
5774 if (iskanji(o_name[i])) i++;
5783 o_name[i] = ' '; i++;
5788 fprintf(fff, "%s %s", where, o_name);
5790 if (!(o_ptr->ident & (IDENT_MENTAL)))
5793 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5795 fputs("-------unknown------------ -------unknown------\n", fff);
5800 object_flags_known(o_ptr, flgs);
5802 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5803 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5804 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5805 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5806 print_flag(TR_RES_POIS);
5807 print_flag(TR_RES_LITE);
5808 print_flag(TR_RES_DARK);
5809 print_flag(TR_RES_SHARDS);
5810 print_flag(TR_RES_SOUND);
5811 print_flag(TR_RES_NETHER);
5812 print_flag(TR_RES_NEXUS);
5813 print_flag(TR_RES_CHAOS);
5814 print_flag(TR_RES_DISEN);
5818 print_flag(TR_RES_BLIND);
5819 print_flag(TR_RES_FEAR);
5820 print_flag(TR_RES_CONF);
5821 print_flag(TR_FREE_ACT);
5822 print_flag(TR_SEE_INVIS);
5823 print_flag(TR_HOLD_LIFE);
5824 print_flag(TR_TELEPATHY);
5825 print_flag(TR_SLOW_DIGEST);
5826 print_flag(TR_REGEN);
5827 print_flag(TR_LEVITATION);
5835 fprintf(fff, "%s\n", inven_res_label);
5841 * Display *ID* ed weapons/armors's resistances
5843 static void do_cmd_knowledge_inven(void)
5847 char file_name[1024];
5857 /* Open a new file */
5858 fff = my_fopen_temp(file_name, 1024);
5862 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5864 msg_format("Failed to create temporary file %s.", file_name);
5869 fprintf(fff, "%s\n", inven_res_label);
5871 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
5875 for (; j < 9; j++) fputc('\n', fff);
5877 fprintf(fff, "%s\n", inven_res_label);
5881 strcpy(where, "Áõ");
5883 strcpy(where, "E ");
5885 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5887 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5891 strcpy(where, "»ý");
5893 strcpy(where, "I ");
5895 for (i = 0; i < INVEN_PACK; i++)
5897 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5900 st_ptr = &town[1].store[STORE_HOME];
5902 strcpy(where, "²È");
5904 strcpy(where, "H ");
5907 for (i = 0; i < st_ptr->stock_num; i++)
5909 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
5913 /* Close the file */
5916 /* Display the file contents */
5918 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5920 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5923 /* Remove the file */
5928 void do_cmd_save_screen_html_aux(char *filename, int message)
5932 byte a = 0, old_a = 0;
5946 cptr html_head[] = {
5947 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5951 cptr html_foot[] = {
5953 "</body>\n</html>\n",
5959 Term_get_size(&wid, &hgt);
5961 /* File type is "TEXT" */
5962 FILE_TYPE(FILE_TYPE_TEXT);
5964 /* Append to the file */
5965 fff = my_fopen(filename, "w");
5971 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5973 msg_format("Failed to open file %s.", filename);
5981 /* Save the screen */
5985 /* Build the filename */
5986 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5987 tmpfff = my_fopen(buf, "r");
5989 for (i = 0; html_head[i]; i++)
5990 fprintf(fff, html_head[i]);
5994 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5996 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6000 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6002 fprintf(fff, "%s\n", buf);
6007 /* Dump the screen */
6008 for (y = 0; y < hgt; y++)
6015 for (x = 0; x < wid - 1; x++)
6019 /* Get the attr/char */
6020 (void)(Term_what(x, y, &a, &c));
6024 case '&': cc = "&"; break;
6025 case '<': cc = "<"; break;
6026 case '>': cc = ">"; break;
6028 case 0x1f: c = '.'; break;
6029 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6034 if ((y == 0 && x == 0) || a != old_a) {
6035 rv = angband_color_table[a][1];
6036 gv = angband_color_table[a][2];
6037 bv = angband_color_table[a][3];
6038 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6039 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6043 fprintf(fff, "%s", cc);
6045 fprintf(fff, "%c", c);
6048 fprintf(fff, "</font>");
6051 for (i = 0; html_foot[i]; i++)
6052 fprintf(fff, html_foot[i]);
6057 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6059 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6063 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6065 fprintf(fff, "%s\n", buf);
6080 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6082 msg_print("Screen dump saved.");
6087 /* Restore the screen */
6093 * Hack -- save a screen dump to a file
6095 static void do_cmd_save_screen_html(void)
6097 char buf[1024], tmp[256] = "screen.html";
6100 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6102 if (!get_string("File name: ", tmp, 80))
6106 /* Build the filename */
6107 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6111 do_cmd_save_screen_html_aux(buf, 1);
6116 * Redefinable "save_screen" action
6118 void (*screendump_aux)(void) = NULL;
6122 * Hack -- save a screen dump to a file
6124 void do_cmd_save_screen(void)
6126 bool old_use_graphics = use_graphics;
6127 bool html_dump = FALSE;
6132 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6134 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6139 if (c == 'Y' || c == 'y')
6141 else if (c == 'H' || c == 'h')
6153 Term_get_size(&wid, &hgt);
6155 if (old_use_graphics)
6157 use_graphics = FALSE;
6160 /* Redraw everything */
6161 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6163 /* Hack -- update */
6169 do_cmd_save_screen_html();
6173 /* Do we use a special screendump function ? */
6174 else if (screendump_aux)
6176 /* Dump the screen to a graphics file */
6177 (*screendump_aux)();
6179 else /* Dump the screen as text */
6190 /* Build the filename */
6191 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6193 /* File type is "TEXT" */
6194 FILE_TYPE(FILE_TYPE_TEXT);
6196 /* Append to the file */
6197 fff = my_fopen(buf, "w");
6203 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6205 msg_format("Failed to open file %s.", buf);
6212 /* Save the screen */
6216 /* Dump the screen */
6217 for (y = 0; y < hgt; y++)
6220 for (x = 0; x < wid - 1; x++)
6222 /* Get the attr/char */
6223 (void)(Term_what(x, y, &a, &c));
6233 fprintf(fff, "%s\n", buf);
6240 /* Dump the screen */
6241 for (y = 0; y < hgt; y++)
6244 for (x = 0; x < wid - 1; x++)
6246 /* Get the attr/char */
6247 (void)(Term_what(x, y, &a, &c));
6250 buf[x] = hack[a&0x0F];
6257 fprintf(fff, "%s\n", buf);
6269 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6271 msg_print("Screen dump saved.");
6277 /* Restore the screen */
6281 if (old_use_graphics)
6283 use_graphics = TRUE;
6286 /* Redraw everything */
6287 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6289 /* Hack -- update */
6296 * Sorting hook -- Comp function -- see below
6298 * We use "u" to point to array of monster indexes,
6299 * and "v" to select the type of sorting to perform on "u".
6301 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6303 u16b *who = (u16b*)(u);
6305 u16b *why = (u16b*)(v);
6312 /* Sort by total kills */
6315 /* Extract total kills */
6316 z1 = a_info[w1].tval;
6317 z2 = a_info[w2].tval;
6319 /* Compare total kills */
6320 if (z1 < z2) return (TRUE);
6321 if (z1 > z2) return (FALSE);
6325 /* Sort by monster level */
6328 /* Extract levels */
6329 z1 = a_info[w1].sval;
6330 z2 = a_info[w2].sval;
6332 /* Compare levels */
6333 if (z1 < z2) return (TRUE);
6334 if (z1 > z2) return (FALSE);
6338 /* Sort by monster experience */
6341 /* Extract experience */
6342 z1 = a_info[w1].level;
6343 z2 = a_info[w2].level;
6345 /* Compare experience */
6346 if (z1 < z2) return (TRUE);
6347 if (z1 > z2) return (FALSE);
6351 /* Compare indexes */
6357 * Sorting hook -- Swap function -- see below
6359 * We use "u" to point to array of monster indexes,
6360 * and "v" to select the type of sorting to perform.
6362 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6364 u16b *who = (u16b*)(u);
6379 * Check the status of "artifacts"
6381 static void do_cmd_knowledge_artifacts(void)
6383 int i, k, z, x, y, n = 0;
6389 char file_name[1024];
6391 char base_name[MAX_NLEN];
6395 /* Open a new file */
6396 fff = my_fopen_temp(file_name, 1024);
6400 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6402 msg_format("Failed to create temporary file %s.", file_name);
6408 /* Allocate the "who" array */
6409 C_MAKE(who, max_a_idx, s16b);
6411 /* Allocate the "okay" array */
6412 C_MAKE(okay, max_a_idx, bool);
6414 /* Scan the artifacts */
6415 for (k = 0; k < max_a_idx; k++)
6417 artifact_type *a_ptr = &a_info[k];
6422 /* Skip "empty" artifacts */
6423 if (!a_ptr->name) continue;
6425 /* Skip "uncreated" artifacts */
6426 if (!a_ptr->cur_num) continue;
6432 /* Check the dungeon */
6433 for (y = 0; y < cur_hgt; y++)
6435 for (x = 0; x < cur_wid; x++)
6437 cave_type *c_ptr = &cave[y][x];
6439 s16b this_o_idx, next_o_idx = 0;
6441 /* Scan all objects in the grid */
6442 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6446 /* Acquire object */
6447 o_ptr = &o_list[this_o_idx];
6449 /* Acquire next object */
6450 next_o_idx = o_ptr->next_o_idx;
6452 /* Ignore non-artifacts */
6453 if (!object_is_fixed_artifact(o_ptr)) continue;
6455 /* Ignore known items */
6456 if (object_is_known(o_ptr)) continue;
6458 /* Note the artifact */
6459 okay[o_ptr->name1] = FALSE;
6464 /* Check the inventory and equipment */
6465 for (i = 0; i < INVEN_TOTAL; i++)
6467 object_type *o_ptr = &inventory[i];
6469 /* Ignore non-objects */
6470 if (!o_ptr->k_idx) continue;
6472 /* Ignore non-artifacts */
6473 if (!object_is_fixed_artifact(o_ptr)) continue;
6475 /* Ignore known items */
6476 if (object_is_known(o_ptr)) continue;
6478 /* Note the artifact */
6479 okay[o_ptr->name1] = FALSE;
6482 for (k = 0; k < max_a_idx; k++)
6484 if (okay[k]) who[n++] = k;
6487 /* Select the sort method */
6488 ang_sort_comp = ang_sort_art_comp;
6489 ang_sort_swap = ang_sort_art_swap;
6491 /* Sort the array by dungeon depth of monsters */
6492 ang_sort(who, &why, n);
6494 /* Scan the artifacts */
6495 for (k = 0; k < n; k++)
6497 artifact_type *a_ptr = &a_info[who[k]];
6501 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6503 strcpy(base_name, "Unknown Artifact");
6507 /* Obtain the base object type */
6508 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6516 /* Get local object */
6519 /* Create fake object */
6520 object_prep(q_ptr, z);
6522 /* Make it an artifact */
6523 q_ptr->name1 = (byte)who[k];
6525 /* Display as if known */
6526 q_ptr->ident |= IDENT_STORE;
6528 /* Describe the artifact */
6529 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6532 /* Hack -- Build the artifact name */
6534 fprintf(fff, " %s\n", base_name);
6536 fprintf(fff, " The %s\n", base_name);
6541 /* Free the "who" array */
6542 C_KILL(who, max_a_idx, s16b);
6544 /* Free the "okay" array */
6545 C_KILL(okay, max_a_idx, bool);
6547 /* Close the file */
6550 /* Display the file contents */
6552 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6554 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6558 /* Remove the file */
6564 * Display known uniques
6565 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6567 static void do_cmd_knowledge_uniques(void)
6575 char file_name[1024];
6578 int n_alive_surface = 0;
6579 int n_alive_over100 = 0;
6580 int n_alive_total = 0;
6583 for (i = 0; i < 10; i++) n_alive[i] = 0;
6585 /* Open a new file */
6586 fff = my_fopen_temp(file_name, 1024);
6591 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6593 msg_format("Failed to create temporary file %s.", file_name);
6599 /* Allocate the "who" array */
6600 C_MAKE(who, max_r_idx, s16b);
6602 /* Scan the monsters */
6603 for (i = 1; i < max_r_idx; i++)
6605 monster_race *r_ptr = &r_info[i];
6608 if (!r_ptr->name) continue;
6610 /* Require unique monsters */
6611 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6613 /* Only display "known" uniques */
6614 if (!cheat_know && !r_ptr->r_sights) continue;
6616 /* Only print rarity <= 100 uniques */
6617 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6619 /* Only "alive" uniques */
6620 if (r_ptr->max_num == 0) continue;
6624 lev = (r_ptr->level - 1) / 10;
6628 if (max_lev < lev) max_lev = lev;
6630 else n_alive_over100++;
6632 else n_alive_surface++;
6634 /* Collect "appropriate" monsters */
6638 /* Select the sort method */
6639 ang_sort_comp = ang_sort_comp_hook;
6640 ang_sort_swap = ang_sort_swap_hook;
6642 /* Sort the array by dungeon depth of monsters */
6643 ang_sort(who, &why, n);
6645 if (n_alive_surface)
6648 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6650 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6652 n_alive_total += n_alive_surface;
6654 for (i = 0; i <= max_lev; i++)
6657 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6659 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6661 n_alive_total += n_alive[i];
6663 if (n_alive_over100)
6666 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6668 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6670 n_alive_total += n_alive_over100;
6676 fputs("--------- -----------\n", fff);
6677 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6679 fputs("------------- ----------\n", fff);
6680 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6686 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6688 fputs("No known uniques alive.\n", fff);
6692 /* Scan the monster races */
6693 for (k = 0; k < n; k++)
6695 monster_race *r_ptr = &r_info[who[k]];
6697 /* Print a message */
6699 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6701 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6705 /* Free the "who" array */
6706 C_KILL(who, max_r_idx, s16b);
6708 /* Close the file */
6711 /* Display the file contents */
6713 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6715 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6719 /* Remove the file */
6725 * Display weapon-exp
6727 static void do_cmd_knowledge_weapon_exp(void)
6729 int i, j, num, weapon_exp;
6733 char file_name[1024];
6736 /* Open a new file */
6737 fff = my_fopen_temp(file_name, 1024);
6740 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6742 msg_format("Failed to create temporary file %s.", file_name);
6748 for (i = 0; i < 5; i++)
6750 for (num = 0; num < 64; num++)
6752 for (j = 0; j < max_k_idx; j++)
6754 object_kind *k_ptr = &k_info[j];
6756 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6758 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6760 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6762 fprintf(fff, "%-25s ", tmp);
6763 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6764 else fprintf(fff, " ");
6765 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6766 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6774 /* Close the file */
6777 /* Display the file contents */
6779 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6781 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6785 /* Remove the file */
6793 static void do_cmd_knowledge_spell_exp(void)
6795 int i = 0, spell_exp, exp_level;
6800 char file_name[1024];
6802 /* Open a new file */
6803 fff = my_fopen_temp(file_name, 1024);
6806 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6808 msg_format("Failed to create temporary file %s.", file_name);
6814 if (p_ptr->realm1 != REALM_NONE)
6817 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6819 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6821 for (i = 0; i < 32; i++)
6823 if (!is_magic(p_ptr->realm1))
6825 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6829 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6831 if (s_ptr->slevel >= 99) continue;
6832 spell_exp = p_ptr->spell_exp[i];
6833 exp_level = spell_exp_level(spell_exp);
6834 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6835 if (p_ptr->realm1 == REALM_HISSATSU)
6836 fprintf(fff, "[--]");
6839 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6840 else fprintf(fff, " ");
6841 fprintf(fff, "%s", exp_level_str[exp_level]);
6843 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6848 if (p_ptr->realm2 != REALM_NONE)
6851 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6853 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6855 for (i = 0; i < 32; i++)
6857 if (!is_magic(p_ptr->realm1))
6859 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6863 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6865 if (s_ptr->slevel >= 99) continue;
6867 spell_exp = p_ptr->spell_exp[i + 32];
6868 exp_level = spell_exp_level(spell_exp);
6869 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
6870 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6871 else fprintf(fff, " ");
6872 fprintf(fff, "%s", exp_level_str[exp_level]);
6873 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6878 /* Close the file */
6881 /* Display the file contents */
6883 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6885 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6889 /* Remove the file */
6897 static void do_cmd_knowledge_skill_exp(void)
6899 int i = 0, skill_exp;
6903 char file_name[1024];
6905 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6907 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6910 /* Open a new file */
6911 fff = my_fopen_temp(file_name, 1024);
6914 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6916 msg_format("Failed to create temporary file %s.", file_name);
6922 for (i = 0; i < 3; i++)
6924 skill_exp = p_ptr->skill_exp[i];
6925 fprintf(fff, "%-20s ", skill_name[i]);
6926 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6927 else fprintf(fff, " ");
6928 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6929 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6933 /* Close the file */
6936 /* Display the file contents */
6938 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6940 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6944 /* Remove the file */
6950 * Pluralize a monster name
6952 void plural_aux(char *Name)
6954 int NameLen = strlen(Name);
6956 if (my_strstr(Name, "Disembodied hand"))
6958 strcpy(Name, "Disembodied hands that strangled people");
6960 else if (my_strstr(Name, "Colour out of space"))
6962 strcpy(Name, "Colours out of space");
6964 else if (my_strstr(Name, "stairway to hell"))
6966 strcpy(Name, "stairways to hell");
6968 else if (my_strstr(Name, "Dweller on the threshold"))
6970 strcpy(Name, "Dwellers on the threshold");
6972 else if (my_strstr(Name, " of "))
6974 cptr aider = my_strstr(Name, " of ");
6985 if (dummy[i-1] == 's')
6987 strcpy(&(dummy[i]), "es");
6992 strcpy(&(dummy[i]), "s");
6995 strcpy(&(dummy[i+1]), aider);
6996 strcpy(Name, dummy);
6998 else if (my_strstr(Name, "coins"))
7001 strcpy(dummy, "piles of ");
7002 strcat(dummy, Name);
7003 strcpy(Name, dummy);
7006 else if (my_strstr(Name, "Manes"))
7010 else if (streq(&(Name[NameLen - 2]), "ey"))
7012 strcpy(&(Name[NameLen - 2]), "eys");
7014 else if (Name[NameLen - 1] == 'y')
7016 strcpy(&(Name[NameLen - 1]), "ies");
7018 else if (streq(&(Name[NameLen - 4]), "ouse"))
7020 strcpy(&(Name[NameLen - 4]), "ice");
7022 else if (streq(&(Name[NameLen - 2]), "us"))
7024 strcpy(&(Name[NameLen - 2]), "i");
7026 else if (streq(&(Name[NameLen - 6]), "kelman"))
7028 strcpy(&(Name[NameLen - 6]), "kelmen");
7030 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7032 strcpy(&(Name[NameLen - 8]), "wordsmen");
7034 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7036 strcpy(&(Name[NameLen - 7]), "oodsmen");
7038 else if (streq(&(Name[NameLen - 7]), "eastman"))
7040 strcpy(&(Name[NameLen - 7]), "eastmen");
7042 else if (streq(&(Name[NameLen - 8]), "izardman"))
7044 strcpy(&(Name[NameLen - 8]), "izardmen");
7046 else if (streq(&(Name[NameLen - 5]), "geist"))
7048 strcpy(&(Name[NameLen - 5]), "geister");
7050 else if (streq(&(Name[NameLen - 2]), "ex"))
7052 strcpy(&(Name[NameLen - 2]), "ices");
7054 else if (streq(&(Name[NameLen - 2]), "lf"))
7056 strcpy(&(Name[NameLen - 2]), "lves");
7058 else if (suffix(Name, "ch") ||
7059 suffix(Name, "sh") ||
7060 suffix(Name, "nx") ||
7061 suffix(Name, "s") ||
7064 strcpy(&(Name[NameLen]), "es");
7068 strcpy(&(Name[NameLen]), "s");
7073 * Display current pets
7075 static void do_cmd_knowledge_pets(void)
7079 monster_type *m_ptr;
7082 int show_upkeep = 0;
7083 char file_name[1024];
7086 /* Open a new file */
7087 fff = my_fopen_temp(file_name, 1024);
7090 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7092 msg_format("Failed to create temporary file %s.", file_name);
7098 /* Process the monsters (backwards) */
7099 for (i = m_max - 1; i >= 1; i--)
7101 /* Access the monster */
7104 /* Ignore "dead" monsters */
7105 if (!m_ptr->r_idx) continue;
7107 /* Calculate "upkeep" for pets */
7111 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7112 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7116 show_upkeep = calculate_upkeep();
7118 fprintf(fff, "----------------------------------------------\n");
7120 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7121 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7123 fprintf(fff, " Total: %d pet%s.\n",
7124 t_friends, (t_friends == 1 ? "" : "s"));
7125 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7130 /* Close the file */
7133 /* Display the file contents */
7135 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7137 show_file(TRUE, file_name, "Current Pets", 0, 0);
7141 /* Remove the file */
7149 * Note that the player ghosts are ignored. XXX XXX XXX
7151 static void do_cmd_knowledge_kill_count(void)
7159 char file_name[1024];
7164 /* Open a new file */
7165 fff = my_fopen_temp(file_name, 1024);
7169 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7171 msg_format("Failed to create temporary file %s.", file_name);
7177 /* Allocate the "who" array */
7178 C_MAKE(who, max_r_idx, s16b);
7181 /* Monsters slain */
7184 for (kk = 1; kk < max_r_idx; kk++)
7186 monster_race *r_ptr = &r_info[kk];
7188 if (r_ptr->flags1 & (RF1_UNIQUE))
7190 bool dead = (r_ptr->max_num == 0);
7199 s16b This = r_ptr->r_pkills;
7210 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7212 fprintf(fff,"You have defeated no enemies yet.\n\n");
7216 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7218 fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
7224 /* Scan the monsters */
7225 for (i = 1; i < max_r_idx; i++)
7227 monster_race *r_ptr = &r_info[i];
7229 /* Use that monster */
7230 if (r_ptr->name) who[n++] = i;
7233 /* Select the sort method */
7234 ang_sort_comp = ang_sort_comp_hook;
7235 ang_sort_swap = ang_sort_swap_hook;
7237 /* Sort the array by dungeon depth of monsters */
7238 ang_sort(who, &why, n);
7240 /* Scan the monster races */
7241 for (k = 0; k < n; k++)
7243 monster_race *r_ptr = &r_info[who[k]];
7245 if (r_ptr->flags1 & (RF1_UNIQUE))
7247 bool dead = (r_ptr->max_num == 0);
7251 /* Print a message */
7252 fprintf(fff, " %s\n",
7253 (r_name + r_ptr->name));
7259 s16b This = r_ptr->r_pkills;
7264 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7265 if (my_strchr("pt", r_ptr->d_char))
7266 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7268 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7272 if (my_strstr(r_name + r_ptr->name, "coins"))
7274 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7278 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7284 strcpy(ToPlural, (r_name + r_ptr->name));
7285 plural_aux(ToPlural);
7286 fprintf(fff, " %d %s\n", This, ToPlural);
7296 fprintf(fff,"----------------------------------------------\n");
7298 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
7300 fprintf(fff," Total: %lu creature%s killed.\n",
7301 Total, (Total == 1 ? "" : "s"));
7305 /* Free the "who" array */
7306 C_KILL(who, max_r_idx, s16b);
7308 /* Close the file */
7311 /* Display the file contents */
7313 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7315 show_file(TRUE, file_name, "Kill Count", 0, 0);
7319 /* Remove the file */
7325 * Display the object groups.
7327 static void display_group_list(int col, int row, int wid, int per_page,
7328 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7332 /* Display lines until done */
7333 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7335 /* Get the group index */
7336 int grp = grp_idx[grp_top + i];
7338 /* Choose a color */
7339 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7341 /* Erase the entire line */
7342 Term_erase(col, row + i, wid);
7344 /* Display the group label */
7345 c_put_str(attr, group_text[grp], row + i, col);
7351 * Move the cursor in a browser window
7353 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7354 int *list_cur, int list_cnt)
7359 int list = *list_cur;
7361 /* Extract direction */
7364 /* Hack -- scroll up full screen */
7369 /* Hack -- scroll down full screen */
7374 d = get_keymap_dir(ch);
7379 /* Diagonals - hack */
7380 if ((ddx[d] > 0) && ddy[d])
7386 Term_get_size(&wid, &hgt);
7388 browser_rows = hgt - 8;
7390 /* Browse group list */
7395 /* Move up or down */
7396 grp += ddy[d] * (browser_rows - 1);
7399 if (grp >= grp_cnt) grp = grp_cnt - 1;
7400 if (grp < 0) grp = 0;
7401 if (grp != old_grp) list = 0;
7404 /* Browse sub-list list */
7407 /* Move up or down */
7408 list += ddy[d] * browser_rows;
7411 if (list >= list_cnt) list = list_cnt - 1;
7412 if (list < 0) list = 0;
7424 if (col < 0) col = 0;
7425 if (col > 1) col = 1;
7432 /* Browse group list */
7437 /* Move up or down */
7441 if (grp >= grp_cnt) grp = grp_cnt - 1;
7442 if (grp < 0) grp = 0;
7443 if (grp != old_grp) list = 0;
7446 /* Browse sub-list list */
7449 /* Move up or down */
7453 if (list >= list_cnt) list = list_cnt - 1;
7454 if (list < 0) list = 0;
7465 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7469 /* Clear the display lines */
7470 for (i = 0; i < height; i++)
7472 Term_erase(col, row + i, width);
7475 /* Bigtile mode uses double width */
7476 if (use_bigtile) width /= 2;
7478 /* Display lines until done */
7479 for (i = 0; i < height; i++)
7481 /* Display columns until done */
7482 for (j = 0; j < width; j++)
7490 /* Bigtile mode uses double width */
7491 if (use_bigtile) x += j;
7496 /* Ignore illegal characters */
7497 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7498 (!use_graphics && ic > 0x7f))
7504 /* Force correct code for both ASCII character and tile */
7505 if (c & 0x80) a |= 0x80;
7507 /* Display symbol */
7508 Term_queue_bigchar(x, y, a, c, 0, 0);
7515 * Place the cursor at the collect position for visual mode
7517 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7519 int i = (a & 0x7f) - attr_top;
7520 int j = c - char_left;
7525 /* Bigtile mode uses double width */
7526 if (use_bigtile) x += j;
7528 /* Place the cursor */
7534 * Clipboard variables for copy&paste in visual mode
7536 static byte attr_idx = 0;
7537 static byte char_idx = 0;
7539 /* Hack -- for feature lighting */
7540 static byte attr_idx_feat[F_LIT_MAX];
7541 static byte char_idx_feat[F_LIT_MAX];
7544 * Do visual mode command -- Change symbols
7546 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7547 int height, int width,
7548 byte *attr_top_ptr, byte *char_left_ptr,
7549 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7551 static byte attr_old = 0, char_old = 0;
7556 if (*visual_list_ptr)
7559 *cur_attr_ptr = attr_old;
7560 *cur_char_ptr = char_old;
7561 *visual_list_ptr = FALSE;
7569 if (*visual_list_ptr)
7572 *visual_list_ptr = FALSE;
7573 *need_redraw = TRUE;
7581 if (!*visual_list_ptr)
7583 *visual_list_ptr = TRUE;
7585 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7586 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7588 attr_old = *cur_attr_ptr;
7589 char_old = *cur_char_ptr;
7600 /* Set the visual */
7601 attr_idx = *cur_attr_ptr;
7602 char_idx = *cur_char_ptr;
7604 /* Hack -- for feature lighting */
7605 for (i = 0; i < F_LIT_MAX; i++)
7607 attr_idx_feat[i] = 0;
7608 char_idx_feat[i] = 0;
7615 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7618 *cur_attr_ptr = attr_idx;
7619 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7620 if (!*visual_list_ptr) *need_redraw = TRUE;
7626 *cur_char_ptr = char_idx;
7627 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7628 if (!*visual_list_ptr) *need_redraw = TRUE;
7634 if (*visual_list_ptr)
7637 int d = get_keymap_dir(ch);
7638 byte a = (*cur_attr_ptr & 0x7f);
7639 byte c = *cur_char_ptr;
7641 if (use_bigtile) eff_width = width / 2;
7642 else eff_width = width;
7644 /* Restrict direction */
7645 if ((a == 0) && (ddy[d] < 0)) d = 0;
7646 if ((c == 0) && (ddx[d] < 0)) d = 0;
7647 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7648 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7653 /* Force correct code for both ASCII character and tile */
7654 if (c & 0x80) a |= 0x80;
7656 /* Set the visual */
7661 /* Move the frame */
7662 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7663 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7664 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7665 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7671 /* Visual mode command is not used */
7677 * Display the monsters in a group.
7679 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7680 int mon_cur, int mon_top, bool visual_only)
7684 /* Display lines until done */
7685 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7689 /* Get the race index */
7690 int r_idx = mon_idx[mon_top + i] ;
7692 /* Access the race */
7693 monster_race *r_ptr = &r_info[r_idx];
7695 /* Choose a color */
7696 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7698 /* Display the name */
7699 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7701 /* Hack -- visual_list mode */
7704 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7706 if (p_ptr->wizard || visual_only)
7708 c_prt(attr, format("%d", r_idx), row + i, 62);
7711 /* Erase chars before overwritten by the race letter */
7712 Term_erase(69, row + i, 255);
7714 /* Display symbol */
7715 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7720 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7722 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7724 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7729 /* Clear remaining lines */
7730 for (; i < per_page; i++)
7732 Term_erase(col, row + i, 255);
7738 * Display known monsters.
7740 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7743 int grp_cur, grp_top, old_grp_cur;
7744 int mon_cur, mon_top;
7745 int grp_cnt, grp_idx[100];
7753 bool visual_list = FALSE;
7754 byte attr_top = 0, char_left = 0;
7762 Term_get_size(&wid, &hgt);
7764 browser_rows = hgt - 8;
7766 /* Allocate the "mon_idx" array */
7767 C_MAKE(mon_idx, max_r_idx, s16b);
7772 if (direct_r_idx < 0)
7774 mode = visual_only ? 0x03 : 0x01;
7776 /* Check every group */
7777 for (i = 0; monster_group_text[i] != NULL; i++)
7779 /* Measure the label */
7780 len = strlen(monster_group_text[i]);
7782 /* Save the maximum length */
7783 if (len > max) max = len;
7785 /* See if any monsters are known */
7786 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7788 /* Build a list of groups with known monsters */
7789 grp_idx[grp_cnt++] = i;
7797 mon_idx[0] = direct_r_idx;
7800 /* Terminate the list */
7803 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7804 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7807 /* Terminate the list */
7808 grp_idx[grp_cnt] = -1;
7811 grp_cur = grp_top = 0;
7812 mon_cur = mon_top = 0;
7817 mode = visual_only ? 0x02 : 0x00;
7822 monster_race *r_ptr;
7829 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7830 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7831 prt("̾Á°", 4, max + 3);
7832 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7834 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7836 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7837 if (direct_r_idx < 0) prt("Group", 4, 0);
7838 prt("Name", 4, max + 3);
7839 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7841 if (!visual_only) prt("Kills", 4, 73);
7844 for (i = 0; i < 78; i++)
7846 Term_putch(i, 5, TERM_WHITE, '=');
7849 if (direct_r_idx < 0)
7851 for (i = 0; i < browser_rows; i++)
7853 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7860 if (direct_r_idx < 0)
7862 /* Scroll group list */
7863 if (grp_cur < grp_top) grp_top = grp_cur;
7864 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7866 /* Display a list of monster groups */
7867 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7869 if (old_grp_cur != grp_cur)
7871 old_grp_cur = grp_cur;
7873 /* Get a list of monsters in the current group */
7874 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
7877 /* Scroll monster list */
7878 while (mon_cur < mon_top)
7879 mon_top = MAX(0, mon_top - browser_rows/2);
7880 while (mon_cur >= mon_top + browser_rows)
7881 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7886 /* Display a list of monsters in the current group */
7887 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
7893 /* Display a monster name */
7894 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
7896 /* Display visual list below first monster */
7897 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7902 prt(format("<Êý¸þ>%s%s%s, ESC",
7903 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
7904 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
7905 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
7908 prt(format("<dir>%s%s%s, ESC",
7909 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7910 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7911 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7915 /* Get the current monster */
7916 r_ptr = &r_info[mon_idx[mon_cur]];
7920 /* Mega Hack -- track this monster race */
7921 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7923 /* Hack -- handle stuff */
7929 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7933 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7937 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7942 /* Do visual mode command if needed */
7943 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))
7945 if (direct_r_idx >= 0)
7970 /* Recall on screen */
7971 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
7973 screen_roff(mon_idx[mon_cur], 0);
7984 /* Move the cursor */
7985 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
7992 /* Free the "mon_idx" array */
7993 C_KILL(mon_idx, max_r_idx, s16b);
7998 * Display the objects in a group.
8000 static void display_object_list(int col, int row, int per_page, int object_idx[],
8001 int object_cur, int object_top, bool visual_only)
8005 /* Display lines until done */
8006 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8010 object_kind *flavor_k_ptr;
8012 /* Get the object index */
8013 int k_idx = object_idx[object_top + i];
8015 /* Access the object */
8016 object_kind *k_ptr = &k_info[k_idx];
8018 /* Choose a color */
8019 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8020 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8025 /* Appearance of this object is shuffled */
8026 flavor_k_ptr = &k_info[k_ptr->flavor];
8030 /* Appearance of this object is very normal */
8031 flavor_k_ptr = k_ptr;
8036 attr = ((i + object_top == object_cur) ? cursor : attr);
8038 if (!k_ptr->flavor || k_ptr->aware)
8041 strip_name(o_name, k_idx);
8046 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8049 /* Display the name */
8050 c_prt(attr, o_name, row + i, col);
8052 /* Hack -- visual_list mode */
8055 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);
8057 if (p_ptr->wizard || visual_only)
8059 c_prt(attr, format("%d", k_idx), row + i, 70);
8062 a = flavor_k_ptr->x_attr;
8063 c = flavor_k_ptr->x_char;
8065 /* Display symbol */
8066 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8069 /* Clear remaining lines */
8070 for (; i < per_page; i++)
8072 Term_erase(col, row + i, 255);
8077 * Describe fake object
8079 static void desc_obj_fake(int k_idx)
8082 object_type object_type_body;
8084 /* Get local object */
8085 o_ptr = &object_type_body;
8087 /* Wipe the object */
8090 /* Create the artifact */
8091 object_prep(o_ptr, k_idx);
8093 /* It's fully know */
8094 o_ptr->ident |= IDENT_KNOWN;
8096 /* Track the object */
8097 /* object_actual_track(o_ptr); */
8099 /* Hack - mark as fake */
8100 /* term_obj_real = FALSE; */
8102 /* Hack -- Handle stuff */
8105 if (!screen_object(o_ptr, FALSE))
8108 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8110 msg_print("You see nothing special.");
8119 * Display known objects
8121 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8124 int grp_cur, grp_top, old_grp_cur;
8125 int object_old, object_cur, object_top;
8126 int grp_cnt, grp_idx[100];
8134 bool visual_list = FALSE;
8135 byte attr_top = 0, char_left = 0;
8143 Term_get_size(&wid, &hgt);
8145 browser_rows = hgt - 8;
8147 /* Allocate the "object_idx" array */
8148 C_MAKE(object_idx, max_k_idx, int);
8153 if (direct_k_idx < 0)
8155 mode = visual_only ? 0x03 : 0x01;
8157 /* Check every group */
8158 for (i = 0; object_group_text[i] != NULL; i++)
8160 /* Measure the label */
8161 len = strlen(object_group_text[i]);
8163 /* Save the maximum length */
8164 if (len > max) max = len;
8166 /* See if any monsters are known */
8167 if (collect_objects(i, object_idx, mode))
8169 /* Build a list of groups with known monsters */
8170 grp_idx[grp_cnt++] = i;
8179 object_kind *k_ptr = &k_info[direct_k_idx];
8180 object_kind *flavor_k_ptr;
8184 /* Appearance of this object is shuffled */
8185 flavor_k_ptr = &k_info[k_ptr->flavor];
8189 /* Appearance of this object is very normal */
8190 flavor_k_ptr = k_ptr;
8193 object_idx[0] = direct_k_idx;
8194 object_old = direct_k_idx;
8197 /* Terminate the list */
8200 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8201 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8204 /* Terminate the list */
8205 grp_idx[grp_cnt] = -1;
8208 grp_cur = grp_top = 0;
8209 object_cur = object_top = 0;
8214 mode = visual_only ? 0x02 : 0x00;
8219 object_kind *k_ptr, *flavor_k_ptr;
8226 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8227 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8228 prt("̾Á°", 4, max + 3);
8229 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8232 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8233 if (direct_k_idx < 0) prt("Group", 4, 0);
8234 prt("Name", 4, max + 3);
8235 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8239 for (i = 0; i < 78; i++)
8241 Term_putch(i, 5, TERM_WHITE, '=');
8244 if (direct_k_idx < 0)
8246 for (i = 0; i < browser_rows; i++)
8248 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8255 if (direct_k_idx < 0)
8257 /* Scroll group list */
8258 if (grp_cur < grp_top) grp_top = grp_cur;
8259 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8261 /* Display a list of object groups */
8262 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8264 if (old_grp_cur != grp_cur)
8266 old_grp_cur = grp_cur;
8268 /* Get a list of objects in the current group */
8269 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8272 /* Scroll object list */
8273 while (object_cur < object_top)
8274 object_top = MAX(0, object_top - browser_rows/2);
8275 while (object_cur >= object_top + browser_rows)
8276 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8281 /* Display a list of objects in the current group */
8282 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8286 object_top = object_cur;
8288 /* Display a list of objects in the current group */
8289 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8291 /* Display visual list below first object */
8292 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8295 /* Get the current object */
8296 k_ptr = &k_info[object_idx[object_cur]];
8300 /* Appearance of this object is shuffled */
8301 flavor_k_ptr = &k_info[k_ptr->flavor];
8305 /* Appearance of this object is very normal */
8306 flavor_k_ptr = k_ptr;
8311 prt(format("<Êý¸þ>%s%s%s, ESC",
8312 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8313 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8314 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8317 prt(format("<dir>%s%s%s, ESC",
8318 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8319 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8320 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8326 /* Mega Hack -- track this object */
8327 if (object_cnt) object_kind_track(object_idx[object_cur]);
8329 /* The "current" object changed */
8330 if (object_old != object_idx[object_cur])
8332 /* Hack -- handle stuff */
8335 /* Remember the "current" object */
8336 object_old = object_idx[object_cur];
8342 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8346 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8350 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8355 /* Do visual mode command if needed */
8356 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))
8358 if (direct_k_idx >= 0)
8383 /* Recall on screen */
8384 if (!visual_list && !visual_only && (grp_cnt > 0))
8386 desc_obj_fake(object_idx[object_cur]);
8394 /* Move the cursor */
8395 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8401 /* Free the "object_idx" array */
8402 C_KILL(object_idx, max_k_idx, int);
8407 * Display the features in a group.
8409 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8410 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8412 int lit_col[F_LIT_MAX], i, j;
8413 int f_idx_col = use_bigtile ? 62 : 64;
8415 /* Correct columns 1 and 4 */
8416 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8417 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8418 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8420 /* Display lines until done */
8421 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8426 int f_idx = feat_idx[feat_top + i];
8428 /* Access the index */
8429 feature_type *f_ptr = &f_info[f_idx];
8431 int row_i = row + i;
8433 /* Choose a color */
8434 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8436 /* Display the name */
8437 c_prt(attr, f_name + f_ptr->name, row_i, col);
8439 /* Hack -- visual_list mode */
8442 /* Display lighting level */
8443 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8445 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));
8447 if (p_ptr->wizard || visual_only)
8449 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8452 /* Display symbol */
8453 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);
8455 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8456 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8458 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8460 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8462 /* Mega-hack -- Use non-standard colour */
8463 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8465 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8469 /* Clear remaining lines */
8470 for (; i < per_page; i++)
8472 Term_erase(col, row + i, 255);
8478 * Interact with feature visuals.
8480 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8483 int grp_cur, grp_top, old_grp_cur;
8484 int feat_cur, feat_top;
8485 int grp_cnt, grp_idx[100];
8493 bool visual_list = FALSE;
8494 byte attr_top = 0, char_left = 0;
8499 byte attr_old[F_LIT_MAX];
8500 byte char_old[F_LIT_MAX];
8501 byte *cur_attr_ptr, *cur_char_ptr;
8503 C_WIPE(attr_old, F_LIT_MAX, byte);
8504 C_WIPE(char_old, F_LIT_MAX, byte);
8507 Term_get_size(&wid, &hgt);
8509 browser_rows = hgt - 8;
8511 /* Allocate the "feat_idx" array */
8512 C_MAKE(feat_idx, max_f_idx, int);
8517 if (direct_f_idx < 0)
8519 /* Check every group */
8520 for (i = 0; feature_group_text[i] != NULL; i++)
8522 /* Measure the label */
8523 len = strlen(feature_group_text[i]);
8525 /* Save the maximum length */
8526 if (len > max) max = len;
8528 /* See if any features are known */
8529 if (collect_features(i, feat_idx, 0x01))
8531 /* Build a list of groups with known features */
8532 grp_idx[grp_cnt++] = i;
8540 feature_type *f_ptr = &f_info[direct_f_idx];
8542 feat_idx[0] = direct_f_idx;
8545 /* Terminate the list */
8548 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8549 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8551 for (i = 0; i < F_LIT_MAX; i++)
8553 attr_old[i] = f_ptr->x_attr[i];
8554 char_old[i] = f_ptr->x_char[i];
8558 /* Terminate the list */
8559 grp_idx[grp_cnt] = -1;
8562 grp_cur = grp_top = 0;
8563 feat_cur = feat_top = 0;
8571 feature_type *f_ptr;
8578 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8579 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8580 prt("̾Á°", 4, max + 3);
8583 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8584 prt("ʸ»ú ( l/ d)", 4, 66);
8588 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8589 prt("ʸ»ú (l/d)", 4, 68);
8592 prt("Visuals - features", 2, 0);
8593 if (direct_f_idx < 0) prt("Group", 4, 0);
8594 prt("Name", 4, max + 3);
8597 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8598 prt("Sym ( l/ d)", 4, 67);
8602 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8603 prt("Sym (l/d)", 4, 69);
8607 for (i = 0; i < 78; i++)
8609 Term_putch(i, 5, TERM_WHITE, '=');
8612 if (direct_f_idx < 0)
8614 for (i = 0; i < browser_rows; i++)
8616 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8623 if (direct_f_idx < 0)
8625 /* Scroll group list */
8626 if (grp_cur < grp_top) grp_top = grp_cur;
8627 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8629 /* Display a list of feature groups */
8630 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8632 if (old_grp_cur != grp_cur)
8634 old_grp_cur = grp_cur;
8636 /* Get a list of features in the current group */
8637 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8640 /* Scroll feature list */
8641 while (feat_cur < feat_top)
8642 feat_top = MAX(0, feat_top - browser_rows/2);
8643 while (feat_cur >= feat_top + browser_rows)
8644 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8649 /* Display a list of features in the current group */
8650 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8654 feat_top = feat_cur;
8656 /* Display a list of features in the current group */
8657 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8659 /* Display visual list below first object */
8660 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8665 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8666 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8667 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8670 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8671 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8672 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8676 /* Get the current feature */
8677 f_ptr = &f_info[feat_idx[feat_cur]];
8678 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8679 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8683 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8687 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8691 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8696 if (visual_list && ((ch == 'A') || (ch == 'a')))
8698 int prev_lighting_level = *lighting_level;
8702 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8703 else (*lighting_level)--;
8707 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8708 else (*lighting_level)++;
8711 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8712 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8714 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8715 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8720 else if ((ch == 'D') || (ch == 'd'))
8722 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8723 byte prev_x_char = f_ptr->x_char[*lighting_level];
8725 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8729 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8730 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8732 if (prev_x_char != f_ptr->x_char[*lighting_level])
8733 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8735 else *need_redraw = TRUE;
8740 /* Do visual mode command if needed */
8741 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))
8745 /* Restore previous visual settings */
8747 for (i = 0; i < F_LIT_MAX; i++)
8749 f_ptr->x_attr[i] = attr_old[i];
8750 f_ptr->x_char[i] = char_old[i];
8757 if (direct_f_idx >= 0) flag = TRUE;
8758 else *lighting_level = F_LIT_STANDARD;
8761 /* Preserve current visual settings */
8764 for (i = 0; i < F_LIT_MAX; i++)
8766 attr_old[i] = f_ptr->x_attr[i];
8767 char_old[i] = f_ptr->x_char[i];
8769 *lighting_level = F_LIT_STANDARD;
8776 for (i = 0; i < F_LIT_MAX; i++)
8778 attr_idx_feat[i] = f_ptr->x_attr[i];
8779 char_idx_feat[i] = f_ptr->x_char[i];
8788 /* Allow TERM_DARK text */
8789 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8791 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8792 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8810 /* Move the cursor */
8811 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8817 /* Free the "feat_idx" array */
8818 C_KILL(feat_idx, max_f_idx, int);
8823 * List wanted monsters
8825 static void do_cmd_knowledge_kubi(void)
8830 char file_name[1024];
8833 /* Open a new file */
8834 fff = my_fopen_temp(file_name, 1024);
8837 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8839 msg_format("Failed to create temporary file %s.", file_name);
8847 bool listed = FALSE;
8850 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8852 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8854 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8856 fprintf(fff, "List of wanted monsters\n");
8858 fprintf(fff, "----------------------------------------------\n");
8860 for (i = 0; i < MAX_KUBI; i++)
8862 if (kubi_r_idx[i] <= 10000)
8864 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8873 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
8875 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
8880 /* Close the file */
8883 /* Display the file contents */
8885 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8887 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8891 /* Remove the file */
8896 * List virtues & status
8898 static void do_cmd_knowledge_virtues(void)
8902 char file_name[1024];
8905 /* Open a new file */
8906 fff = my_fopen_temp(file_name, 1024);
8909 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8911 msg_format("Failed to create temporary file %s.", file_name);
8920 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8922 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8927 /* Close the file */
8930 /* Display the file contents */
8932 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8934 show_file(TRUE, file_name, "Virtues", 0, 0);
8938 /* Remove the file */
8946 static void do_cmd_knowledge_dungeon(void)
8950 char file_name[1024];
8954 /* Open a new file */
8955 fff = my_fopen_temp(file_name, 1024);
8958 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8960 msg_format("Failed to create temporary file %s.", file_name);
8968 for (i = 1; i < max_d_idx; i++)
8972 if (!d_info[i].maxdepth) continue;
8973 if (!max_dlv[i]) continue;
8974 if (d_info[i].final_guardian)
8976 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8978 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8980 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8982 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8987 /* Close the file */
8990 /* Display the file contents */
8992 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
8994 show_file(TRUE, file_name, "Dungeon", 0, 0);
8998 /* Remove the file */
9003 * List virtues & status
9006 static void do_cmd_knowledge_stat(void)
9010 char file_name[1024];
9013 /* Open a new file */
9014 fff = my_fopen_temp(file_name, 1024);
9017 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9019 msg_format("Failed to create temporary file %s.", file_name);
9027 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9028 (2 * p_ptr->hitdie +
9029 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9032 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9033 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9034 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9036 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9037 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9038 fprintf(fff, "Limits of maximum stats\n\n");
9040 for (v_nr = 0; v_nr < 6; v_nr++)
9042 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);
9043 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9049 /* Close the file */
9052 /* Display the file contents */
9054 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9056 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9060 /* Remove the file */
9066 * Print all active quests
9068 static void do_cmd_knowledge_quests_current(FILE *fff)
9071 char rand_tmp_str[120] = "\0";
9073 monster_race *r_ptr;
9075 int rand_level = 100;
9079 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9081 fprintf(fff, "< Current Quest >\n");
9084 for (i = 1; i < max_quests; i++)
9086 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
9088 /* Set the quest number temporary */
9089 int old_quest = p_ptr->inside_quest;
9092 /* Clear the text */
9093 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9094 quest_text_line = 0;
9096 p_ptr->inside_quest = i;
9098 /* Get the quest text */
9099 init_flags = INIT_SHOW_TEXT;
9101 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9103 /* Reset the old quest number */
9104 p_ptr->inside_quest = old_quest;
9106 /* No info from "silent" quests */
9107 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9111 if (quest[i].type != QUEST_TYPE_RANDOM)
9113 char note[80] = "\0";
9115 if (quest[i].status == QUEST_STATUS_TAKEN)
9117 switch (quest[i].type)
9119 case QUEST_TYPE_KILL_LEVEL:
9120 case QUEST_TYPE_KILL_ANY_LEVEL:
9121 r_ptr = &r_info[quest[i].r_idx];
9122 strcpy(name, r_name + r_ptr->name);
9123 if (quest[i].max_num > 1)
9126 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9127 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9130 sprintf(note," - kill %d %s, have killed %d.",
9131 quest[i].max_num, name, quest[i].cur_num);
9136 sprintf(note," - %s¤òÅݤ¹¡£",name);
9138 sprintf(note," - kill %s.",name);
9142 case QUEST_TYPE_FIND_ARTIFACT:
9143 strcpy(name, a_name + a_info[quest[i].k_idx].name);
9145 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9147 sprintf(note," - Find out %s.", name);
9151 case QUEST_TYPE_FIND_EXIT:
9153 sprintf(note," - õº÷¤¹¤ë¡£");
9155 sprintf(note," - Search.");
9159 case QUEST_TYPE_KILL_NUMBER:
9161 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9162 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9164 sprintf(note," - Kill %d monsters, have killed %d.",
9165 quest[i].max_num, quest[i].cur_num);
9169 case QUEST_TYPE_KILL_ALL:
9171 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9173 sprintf(note," - Kill all monsters.");
9179 /* Print the quest info */
9181 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9182 quest[i].name, quest[i].level, note);
9184 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9185 quest[i].name, quest[i].level, note);
9188 fprintf(fff, tmp_str);
9190 if (quest[i].status == QUEST_STATUS_COMPLETED)
9193 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9195 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9197 fprintf(fff, tmp_str);
9203 while (quest_text[j][0] && j < 10)
9205 fprintf(fff, " %s\n", quest_text[j]);
9210 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9213 rand_level = quest[i].level;
9215 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9217 /* Print the quest info */
9218 r_ptr = &r_info[quest[i].r_idx];
9219 strcpy(name, r_name + r_ptr->name);
9221 if (quest[i].max_num > 1)
9224 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9225 quest[i].name, quest[i].level,
9226 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9230 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9231 quest[i].name, quest[i].level,
9232 quest[i].max_num, name, quest[i].cur_num);
9238 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9239 quest[i].name, quest[i].level, name);
9241 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9242 quest[i].name, quest[i].level, name);
9250 /* Print the current random quest */
9251 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
9254 if (!total) fprintf(fff, " ¤Ê¤·\n");
9256 if (!total) fprintf(fff, " Nothing.\n");
9262 * Print all finished quests
9264 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9271 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9273 fprintf(fff, "< Completed Quest >\n");
9275 for (i = 1; i < max_quests; i++)
9277 int q_idx = quest_num[i];
9279 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9281 if (is_fixed_quest_idx(q_idx))
9283 /* Set the quest number temporary */
9284 int old_quest = p_ptr->inside_quest;
9286 p_ptr->inside_quest = q_idx;
9289 init_flags = INIT_ASSIGN;
9291 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9293 /* Reset the old quest number */
9294 p_ptr->inside_quest = old_quest;
9296 /* No info from "silent" quests */
9297 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9302 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9304 /* Print the quest info */
9306 if (quest[q_idx].complev == 0)
9310 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9312 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9314 r_name+r_info[quest[q_idx].r_idx].name,
9315 quest[q_idx].level);
9321 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9323 " %-40s (Dungeon level: %3d) - level %2d\n",
9325 r_name+r_info[quest[q_idx].r_idx].name,
9327 quest[q_idx].complev);
9332 /* Print the quest info */
9334 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9335 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9337 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9338 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9342 fprintf(fff, tmp_str);
9346 if (!total) fprintf(fff, " ¤Ê¤·\n");
9348 if (!total) fprintf(fff, " Nothing.\n");
9354 * Print all failed quests
9356 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9363 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9365 fprintf(fff, "< Failed Quest >\n");
9367 for (i = 1; i < max_quests; i++)
9369 int q_idx = quest_num[i];
9371 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9373 if (is_fixed_quest_idx(q_idx))
9375 /* Set the quest number temporary */
9376 int old_quest = p_ptr->inside_quest;
9378 p_ptr->inside_quest = q_idx;
9380 /* Get the quest text */
9381 init_flags = INIT_ASSIGN;
9383 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9385 /* Reset the old quest number */
9386 p_ptr->inside_quest = old_quest;
9388 /* No info from "silent" quests */
9389 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9394 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9396 /* Print the quest info */
9398 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9399 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9401 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9402 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9407 /* Print the quest info */
9409 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9410 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9412 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9413 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9416 fprintf(fff, tmp_str);
9420 if (!total) fprintf(fff, " ¤Ê¤·\n");
9422 if (!total) fprintf(fff, " Nothing.\n");
9428 * Print all random quests
9430 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9437 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9439 fprintf(fff, "< Remaining Random Quest >\n");
9441 for (i = 1; i < max_quests; i++)
9443 /* No info from "silent" quests */
9444 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9446 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9450 /* Print the quest info */
9452 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9453 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9455 sprintf(tmp_str, " %s (%d, %s)\n",
9456 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9458 fprintf(fff, tmp_str);
9462 if (!total) fprintf(fff, " ¤Ê¤·\n");
9464 if (!total) fprintf(fff, " Nothing.\n");
9469 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9471 int *q_num = (int *)u;
9472 quest_type *qa = &quest[q_num[a]];
9473 quest_type *qb = &quest[q_num[b]];
9478 if (qa->complev < qb->complev) return TRUE;
9479 if (qa->complev > qb->complev) return FALSE;
9480 if (qa->level <= qb->level) return TRUE;
9484 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9486 int *q_num = (int *)u;
9493 q_num[a] = q_num[b];
9499 * Print quest status of all active quests
9501 static void do_cmd_knowledge_quests(void)
9504 char file_name[1024];
9505 int *quest_num, dummy, i;
9507 /* Open a new file */
9508 fff = my_fopen_temp(file_name, 1024);
9512 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9514 msg_format("Failed to create temporary file %s.", file_name);
9520 /* Allocate Memory */
9521 C_MAKE(quest_num, max_quests, int);
9523 /* Sort by compete level */
9524 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9525 ang_sort_comp = ang_sort_comp_quest_num;
9526 ang_sort_swap = ang_sort_swap_quest_num;
9527 ang_sort(quest_num, &dummy, max_quests);
9529 /* Dump Quest Information */
9530 do_cmd_knowledge_quests_current(fff);
9532 do_cmd_knowledge_quests_completed(fff, quest_num);
9534 do_cmd_knowledge_quests_failed(fff, quest_num);
9538 do_cmd_knowledge_quests_wiz_random(fff);
9541 /* Close the file */
9544 /* Display the file contents */
9546 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9548 show_file(TRUE, file_name, "Quest status", 0, 0);
9551 /* Remove the file */
9555 C_KILL(quest_num, max_quests, int);
9562 static void do_cmd_knowledge_home(void)
9567 char file_name[1024];
9569 char o_name[MAX_NLEN];
9572 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9574 /* Open a new file */
9575 fff = my_fopen_temp(file_name, 1024);
9578 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9580 msg_format("Failed to create temporary file %s.", file_name);
9588 /* Print all homes in the different towns */
9589 st_ptr = &town[1].store[STORE_HOME];
9591 /* Home -- if anything there */
9592 if (st_ptr->stock_num)
9597 /* Header with name of the town */
9599 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9601 fprintf(fff, " [Home Inventory]\n");
9604 /* Dump all available items */
9605 for (i = 0; i < st_ptr->stock_num; i++)
9608 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9609 object_desc(o_name, &st_ptr->stock[i], 0);
9610 if (strlen(o_name) <= 80-3)
9612 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9618 for (n = 0, t = o_name; n < 80-3; n++, t++)
9619 if(iskanji(*t)) {t++; n++;}
9620 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9622 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9623 fprintf(fff, " %.77s\n", o_name+n);
9626 object_desc(o_name, &st_ptr->stock[i], 0);
9627 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9632 /* Add an empty line */
9633 fprintf(fff, "\n\n");
9637 /* Close the file */
9640 /* Display the file contents */
9642 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9644 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9648 /* Remove the file */
9654 * Check the status of "autopick"
9656 static void do_cmd_knowledge_autopick(void)
9660 char file_name[1024];
9662 /* Open a new file */
9663 fff = my_fopen_temp(file_name, 1024);
9668 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9670 msg_format("Failed to create temporary file %s.", file_name);
9679 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9681 fprintf(fff, "No preference for auto picker/destroyer.");
9687 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9689 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9693 for (k = 0; k < max_autopick; k++)
9696 byte act = autopick_list[k].action;
9697 if (act & DONT_AUTOPICK)
9705 else if (act & DO_AUTODESTROY)
9713 else if (act & DO_AUTOPICK)
9721 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9730 if (act & DO_DISPLAY)
9731 fprintf(fff, "%11s", format("[%s]", tmp));
9733 fprintf(fff, "%11s", format("(%s)", tmp));
9735 tmp = autopick_line_from_entry(&autopick_list[k]);
9736 fprintf(fff, " %s", tmp);
9740 /* Close the file */
9742 /* Display the file contents */
9744 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9746 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9749 /* Remove the file */
9755 * Interact with "knowledge"
9757 void do_cmd_knowledge(void)
9760 bool need_redraw = FALSE;
9762 /* File type is "TEXT" */
9763 FILE_TYPE(FILE_TYPE_TEXT);
9765 /* Save the screen */
9768 /* Interact until done */
9774 /* Ask for a choice */
9776 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9777 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9779 prt(format("page %d/2", (p+1)), 2, 65);
9780 prt("Display current knowledge", 3, 0);
9783 /* Give some choices */
9787 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9788 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9789 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9790 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9791 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9792 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9793 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9794 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9795 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9796 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9800 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9801 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9802 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9803 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9804 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9805 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9806 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9807 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9808 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9813 prt("(1) Display known artifacts", 6, 5);
9814 prt("(2) Display known objects", 7, 5);
9815 prt("(3) Display remaining uniques", 8, 5);
9816 prt("(4) Display known monster", 9, 5);
9817 prt("(5) Display kill count", 10, 5);
9818 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9819 prt("(7) Display current pets", 12, 5);
9820 prt("(8) Display home inventory", 13, 5);
9821 prt("(9) Display *identified* equip.", 14, 5);
9822 prt("(0) Display terrain symbols.", 15, 5);
9826 prt("(a) Display about yourself", 6, 5);
9827 prt("(b) Display mutations", 7, 5);
9828 prt("(c) Display weapon proficiency", 8, 5);
9829 prt("(d) Display spell proficiency", 9, 5);
9830 prt("(e) Display misc. proficiency", 10, 5);
9831 prt("(f) Display virtues", 11, 5);
9832 prt("(g) Display dungeons", 12, 5);
9833 prt("(h) Display current quests", 13, 5);
9834 prt("(i) Display auto pick/destroy", 14, 5);
9839 prt("-³¤¯-", 17, 8);
9840 prt("ESC) È´¤±¤ë", 21, 1);
9841 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9842 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9843 prt("¥³¥Þ¥ó¥É:", 20, 0);
9845 prt("-more-", 17, 8);
9846 prt("ESC) Exit menu", 21, 1);
9847 prt("SPACE) Next page", 21, 30);
9848 /*prt("-) Previous page", 21, 60);*/
9849 prt("Command: ", 20, 0);
9856 if (i == ESCAPE) break;
9859 case ' ': /* Page change */
9863 case '1': /* Artifacts */
9864 do_cmd_knowledge_artifacts();
9866 case '2': /* Objects */
9867 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
9869 case '3': /* Uniques */
9870 do_cmd_knowledge_uniques();
9872 case '4': /* Monsters */
9873 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
9875 case '5': /* Kill count */
9876 do_cmd_knowledge_kill_count();
9878 case '6': /* wanted */
9879 if (!vanilla_town) do_cmd_knowledge_kubi();
9881 case '7': /* Pets */
9882 do_cmd_knowledge_pets();
9884 case '8': /* Home */
9885 do_cmd_knowledge_home();
9887 case '9': /* Resist list */
9888 do_cmd_knowledge_inven();
9890 case '0': /* Feature list */
9892 int lighting_level = F_LIT_STANDARD;
9893 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
9897 case 'a': /* Max stat */
9898 do_cmd_knowledge_stat();
9900 case 'b': /* Mutations */
9901 do_cmd_knowledge_mutations();
9903 case 'c': /* weapon-exp */
9904 do_cmd_knowledge_weapon_exp();
9906 case 'd': /* spell-exp */
9907 do_cmd_knowledge_spell_exp();
9909 case 'e': /* skill-exp */
9910 do_cmd_knowledge_skill_exp();
9912 case 'f': /* Virtues */
9913 do_cmd_knowledge_virtues();
9915 case 'g': /* Dungeon */
9916 do_cmd_knowledge_dungeon();
9918 case 'h': /* Quests */
9919 do_cmd_knowledge_quests();
9921 case 'i': /* Autopick */
9922 do_cmd_knowledge_autopick();
9924 default: /* Unknown option */
9928 /* Flush messages */
9932 /* Restore the screen */
9935 if (need_redraw) do_cmd_redraw();
9940 * Check on the status of an active quest
9942 void do_cmd_checkquest(void)
9944 /* File type is "TEXT" */
9945 FILE_TYPE(FILE_TYPE_TEXT);
9947 /* Save the screen */
9951 do_cmd_knowledge_quests();
9953 /* Restore the screen */
9959 * Display the time and date
9961 void do_cmd_time(void)
9963 int day, hour, min, full, start, end, num;
9970 extract_day_hour_min(&day, &hour, &min);
9972 full = hour * 100 + min;
9980 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9982 strcpy(desc, "It is a strange time.");
9988 msg_format("%d ÆüÌÜ,»þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
9989 day, (hour % 12 == 0) ? 12 : (hour % 12),
9990 min, (hour < 12) ? "AM" : "PM");
9992 msg_format("This is day %d. The time is %d:%02d %s.",
9993 day, (hour % 12 == 0) ? 12 : (hour % 12),
9994 min, (hour < 12) ? "AM" : "PM");
9999 if (!randint0(10) || p_ptr->image)
10002 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10004 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10011 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10013 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10018 /* Open this file */
10019 fff = my_fopen(buf, "rt");
10024 /* Find this time */
10025 while (!my_fgets(fff, buf, sizeof(buf)))
10027 /* Ignore comments */
10028 if (!buf[0] || (buf[0] == '#')) continue;
10030 /* Ignore invalid lines */
10031 if (buf[1] != ':') continue;
10033 /* Process 'Start' */
10036 /* Extract the starting time */
10037 start = atoi(buf + 2);
10039 /* Assume valid for an hour */
10046 /* Process 'End' */
10049 /* Extract the ending time */
10050 end = atoi(buf + 2);
10056 /* Ignore incorrect range */
10057 if ((start > full) || (full > end)) continue;
10059 /* Process 'Description' */
10064 /* Apply the randomizer */
10065 if (!randint0(num)) strcpy(desc, buf + 2);
10075 /* Close the file */