4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Interface commands */
18 * A set of functions to maintain automatic dumps of various kinds.
21 * remove_auto_dump(orig_file, mark)
22 * Remove the old automatic dump of type "mark".
23 * auto_dump_printf(fmt, ...)
24 * Dump a formatted string using fprintf().
25 * open_auto_dump(buf, mark)
26 * Open a file, remove old dump, and add new header.
27 * close_auto_dump(void)
28 * Add a footer, and close the file.
30 * The dump commands of original Angband simply add new lines to
31 * existing files; these files will become bigger and bigger unless
32 * an user deletes some or all of these files by hand at some
35 * These three functions automatically delete old dumped lines
36 * before adding new ones. Since there are various kinds of automatic
37 * dumps in a single file, we add a header and a footer with a type
38 * name for every automatic dump, and kill old lines only when the
39 * lines have the correct type of header and footer.
41 * We need to be quite paranoid about correctness; the user might
42 * (mistakenly) edit the file by hand, and see all their work come
43 * to nothing on the next auto dump otherwise. The current code only
44 * detects changes by noting inconsistencies between the actual number
45 * of lines and the number written in the footer. Note that this will
46 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
63 * Remove old lines automatically generated before.
65 static void remove_auto_dump(cptr orig_file)
67 FILE *tmp_fff, *orig_fff;
71 bool between_mark = FALSE;
74 long header_location = 0;
75 char header_mark_str[80];
76 char footer_mark_str[80];
79 /* Prepare a header/footer mark string */
80 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
81 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
83 mark_len = strlen(footer_mark_str);
85 /* Open an old dump file in read-only mode */
86 orig_fff = my_fopen(orig_file, "r");
88 /* If original file does not exist, nothing to do */
89 if (!orig_fff) return;
91 /* Open a new (temporary) file */
92 tmp_fff = my_fopen_temp(tmp_file, 1024);
97 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", tmp_file);
99 msg_format("Failed to create temporary file %s.", tmp_file);
105 /* Loop for every line */
109 if (my_fgets(orig_fff, buf, sizeof(buf)))
111 /* Read error: Assume End of File */
114 * Was looking for the footer, but not found.
116 * Since automatic dump might be edited by hand,
117 * it's dangerous to kill these lines.
118 * Seek back to the next line of the (pseudo) header,
123 fseek(orig_fff, header_location, SEEK_SET);
124 between_mark = FALSE;
128 /* Success -- End the loop */
135 /* We are looking for the header mark of automatic dump */
138 /* Is this line a header? */
139 if (!strcmp(buf, header_mark_str))
141 /* Memorise seek point of this line */
142 header_location = ftell(orig_fff);
144 /* Initialize counter for number of lines */
147 /* Look for the footer from now */
150 /* There are some changes */
157 /* Copy orginally lines */
158 fprintf(tmp_fff, "%s\n", buf);
162 /* We are looking for the footer mark of automatic dump */
165 /* Is this line a footer? */
166 if (!strncmp(buf, footer_mark_str, mark_len))
171 * Compare the number of lines
173 * If there is an inconsistency between
174 * actual number of lines and the
175 * number here, the automatic dump
176 * might be edited by hand. So it's
177 * dangerous to kill these lines.
178 * Seek back to the next line of the
179 * (pseudo) header, and read again.
181 if (!sscanf(buf + mark_len, " (%d)", &tmp)
184 fseek(orig_fff, header_location, SEEK_SET);
187 /* Look for another header */
188 between_mark = FALSE;
194 /* Ignore old line, and count number of lines */
204 /* If there are some changes, overwrite the original file with new one */
207 /* Copy contents of temporary file */
209 tmp_fff = my_fopen(tmp_file, "r");
210 orig_fff = my_fopen(orig_file, "w");
212 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
213 fprintf(orig_fff, "%s\n", buf);
219 /* Kill the temporary file */
227 * Dump a formatted line, using "vstrnfmt()".
229 static void auto_dump_printf(cptr fmt, ...)
236 /* Begin the Varargs Stuff */
239 /* Format the args, save the length */
240 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
242 /* End the Varargs Stuff */
245 /* Count number of lines */
246 for (p = buf; *p; p++)
248 if (*p == '\n') auto_dump_line_num++;
252 fprintf(auto_dump_stream, "%s", buf);
257 * Open file to append auto dump.
259 static bool open_auto_dump(cptr buf, cptr mark)
262 char header_mark_str[80];
264 /* Save the mark string */
265 auto_dump_mark = mark;
267 /* Prepare a header mark string */
268 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
270 /* Remove old macro dumps */
271 remove_auto_dump(buf);
273 /* Append to the file */
274 auto_dump_stream = my_fopen(buf, "a");
277 if (!auto_dump_stream) {
279 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
281 msg_format("Failed to open %s.", buf);
290 fprintf(auto_dump_stream, "%s\n", header_mark_str);
292 /* Initialize counter */
293 auto_dump_line_num = 0;
296 auto_dump_printf("# *·Ù¹ð!!* °Ê¹ß¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
297 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
299 auto_dump_printf("# *Warning!* The lines below are an automatic dump.\n");
300 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
308 * Append foot part and close auto dump.
310 static void close_auto_dump(void)
312 char footer_mark_str[80];
314 /* Prepare a footer mark string */
315 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
318 auto_dump_printf("# *·Ù¹ð!!* °Ê¾å¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
319 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
321 auto_dump_printf("# *Warning!* The lines above are an automatic dump.\n");
322 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
326 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
329 my_fclose(auto_dump_stream);
337 * Return suffix of ordinal number
339 cptr get_ordinal_number_suffix(int num)
341 num = ABS(num) % 100;
345 return (num == 11) ? "th" : "st";
347 return (num == 12) ? "th" : "nd";
349 return (num == 13) ? "th" : "rd";
358 * Take note to the diary.
360 errr do_cmd_write_nikki(int type, int num, cptr note)
366 cptr note_level = "";
367 bool do_level = TRUE;
368 char note_level_buf[40];
371 static bool disable_nikki = FALSE;
373 extract_day_hour_min(&day, &hour, &min);
375 if (disable_nikki) return(-1);
377 if (type == NIKKI_FIX_QUEST_C ||
378 type == NIKKI_FIX_QUEST_F ||
379 type == NIKKI_RAND_QUEST_C ||
380 type == NIKKI_RAND_QUEST_F ||
381 type == NIKKI_TO_QUEST)
385 old_quest = p_ptr->inside_quest;
386 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
388 /* Get the quest text */
389 init_flags = INIT_ASSIGN;
391 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
393 /* Reset the old quest number */
394 p_ptr->inside_quest = old_quest;
398 sprintf(file_name,"playrecord-%s.txt",savefile_base);
400 /* different filne name to avoid mixing */
401 sprintf(file_name,"playrec-%s.txt",savefile_base);
404 /* Build the filename */
405 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
407 /* File type is "TEXT" */
408 FILE_TYPE(FILE_TYPE_TEXT);
410 fff = my_fopen(buf, "a");
416 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
418 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
425 q_idx = quest_number(dun_level);
429 if (p_ptr->inside_arena)
431 note_level = "¥¢¥ê¡¼¥Ê:";
433 note_level = "Arane:";
437 note_level = "ÃϾå:";
439 note_level = "Surface:";
441 else if (q_idx && (is_fixed_quest_idx(q_idx)
442 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
444 note_level = "¥¯¥¨¥¹¥È:";
446 note_level = "Quest:";
451 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
453 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
455 note_level = note_level_buf;
464 if (day < MAX_DAYS) fprintf(fff, "%dÆüÌÜ\n", day);
465 else fputs("*****ÆüÌÜ\n", fff);
467 if (day < MAX_DAYS) fprintf(fff, "Day %d\n", day);
468 else fputs("Day *****\n", fff);
477 fprintf(fff, "%s\n",note);
481 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
487 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
489 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
496 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
498 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
502 case NIKKI_FIX_QUEST_C:
504 if (quest[num].flags & QUEST_FLAG_SILENT) break;
506 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
508 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
512 case NIKKI_FIX_QUEST_F:
514 if (quest[num].flags & QUEST_FLAG_SILENT) break;
516 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
518 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
522 case NIKKI_RAND_QUEST_C:
525 strcpy(name, r_name+r_info[quest[num].r_idx].name);
527 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
529 fprintf(fff, " %2d:%02d %20s completed random quest '%s'\n", hour, min, note_level, name);
533 case NIKKI_RAND_QUEST_F:
536 strcpy(name, r_name+r_info[quest[num].r_idx].name);
538 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
540 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
544 case NIKKI_MAXDEAPTH:
547 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
549 fprintf(fff, " %2d:%02d %20s reached level %d of %s for the first time.\n", hour, min, note_level, num, d_name+d_info[dungeon_type].name);
556 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
558 fprintf(fff, " %2d:%02d %20s reset recall level of %s to %d %s.\n", hour, min, note_level, d_name + d_info[num].name, max_dlv[num], note);
565 if (q_idx && (is_fixed_quest_idx(q_idx)
566 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
577 if (!(dun_level+num)) to = "ÃϾå";
578 else to = format("%d³¬", dun_level+num);
580 if (!(dun_level+num)) to = "the surface";
581 else to = format("level %d", dun_level+num);
586 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
588 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
596 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
598 fprintf(fff, " %2d:%02d %20s recalled to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
602 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
604 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
610 if (quest[num].flags & QUEST_FLAG_SILENT) break;
612 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
614 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
621 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
623 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
630 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
632 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
639 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
641 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
650 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, -num, note);
653 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, get_ordinal_number_suffix(n));
658 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
660 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, get_ordinal_number_suffix(num), note);
662 if (num == MAX_ARENA_MONS)
665 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
667 fprintf(fff, " won all fight to become a Chanpion.\n");
676 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
678 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
693 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
695 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
699 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
701 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
716 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
718 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
722 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
724 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
731 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
733 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
737 case NIKKI_GAMESTART:
739 time_t ct = time((time_t*)0);
743 fprintf(fff, "%s %s",note, ctime(&ct));
746 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
749 case NIKKI_NAMED_PET:
751 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
754 case RECORD_NAMED_PET_NAME:
756 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
758 fprintf(fff, "decided to travel together with %s.\n", note);
761 case RECORD_NAMED_PET_UNNAME:
763 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
765 fprintf(fff, "unnamed %s.\n", note);
768 case RECORD_NAMED_PET_DISMISS:
770 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
772 fprintf(fff, "dismissed %s.\n", note);
775 case RECORD_NAMED_PET_DEATH:
777 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
779 fprintf(fff, "%s died.\n", note);
782 case RECORD_NAMED_PET_MOVED:
784 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
786 fprintf(fff, "moved to another map leaving %s behind.\n", note);
789 case RECORD_NAMED_PET_LOST_SIGHT:
791 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
793 fprintf(fff, "lost sight of %s.\n", note);
796 case RECORD_NAMED_PET_DESTROY:
798 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
800 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
803 case RECORD_NAMED_PET_EARTHQUAKE:
805 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
807 fprintf(fff, "%s was crushed by falling rocks.\n", note);
810 case RECORD_NAMED_PET_GENOCIDE:
812 fprintf(fff, "%s¤¬Ëõ»¦¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
814 fprintf(fff, "%s was made disappeared by genocide.\n", note);
817 case RECORD_NAMED_PET_WIZ_ZAP:
819 fprintf(fff, "%s¤¬¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
821 fprintf(fff, "%s was removed by debug command.\n", note);
824 case RECORD_NAMED_PET_TELE_LEVEL:
826 fprintf(fff, "%s¤¬¥Æ¥ì¥Ý¡¼¥È¡¦¥ì¥Ù¥ë¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
828 fprintf(fff, "%s was made disappeared by teleport level.\n", note);
831 case RECORD_NAMED_PET_BLAST:
833 fprintf(fff, "%s¤òÇúÇˤ·¤¿¡£\n", note);
835 fprintf(fff, "blasted %s.\n", note);
838 case RECORD_NAMED_PET_HEAL_LEPER:
840 fprintf(fff, "%s¤Îɵ¤¤¬¼£¤ê餫¤é³°¤ì¤¿¡£\n", note);
842 fprintf(fff, "%s was healed and left.\n", note);
845 case RECORD_NAMED_PET_COMPACT:
847 fprintf(fff, "%s¤¬¥â¥ó¥¹¥¿¡¼¾ðÊ󰵽̤ˤè¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
849 fprintf(fff, "%s was made disappeared by compacting monsters.\n", note);
852 case RECORD_NAMED_PET_LOSE_PARENT:
854 fprintf(fff, "%s¤Î¾¤´¼Ô¤¬´û¤Ë¤¤¤Ê¤¤¤¿¤á¾Ã¤¨µî¤Ã¤¿¡£\n", note);
856 fprintf(fff, "%s disappeared because there does not exist summoner.\n", note);
871 if (do_level) write_level = FALSE;
877 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
879 static void do_cmd_disp_nikki(void)
881 char nikki_title[256];
886 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
887 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
898 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
899 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
900 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
901 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
906 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
915 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
917 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
918 "Attack is the best form of defence.",
920 "An unexpected windfall",
921 "A drowning man will catch at a straw",
922 "Don't count your chickens before they are hatched.",
923 "It is no use crying over spilt milk.",
924 "Seeing is believing.",
925 "Strike the iron while it is hot.",
926 "I don't care what follows.",
927 "To dig a well to put out a house on fire.",
928 "Tomorrow is another day.",
929 "Easy come, easy go.",
930 "The more haste, the less speed.",
931 "Where there is life, there is hope.",
932 "There is no royal road to *WINNER*.",
933 "Danger past, God forgotten.",
934 "The best thing to do now is to run away.",
935 "Life is but an empty dream.",
936 "Dead men tell no tales.",
937 "A book that remains shut is but a block.",
938 "Misfortunes never come singly.",
939 "A little knowledge is a dangerous thing.",
940 "History repeats itself.",
941 "*WINNER* was not built in a day.",
942 "Ignorance is bliss.",
943 "To lose is to win?",
944 "No medicine can cure folly.",
945 "All good things come to an end.",
946 "M$ Empire strikes back.",
947 "To see is to believe",
949 "Quest of The World's Greatest Brain"};
952 sprintf(file_name,"playrecord-%s.txt",savefile_base);
954 sprintf(file_name,"playrec-%s.txt",savefile_base);
957 /* Build the filename */
958 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
960 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
961 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
962 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
963 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
964 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
967 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
968 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
970 sprintf(nikki_title, "Legend of %s %s '%s'",
971 ap_ptr->title, player_name, tmp);
974 /* Display the file contents */
975 show_file(FALSE, buf, nikki_title, -1, 0);
978 static void do_cmd_bunshou(void)
981 char bunshou[80] = "\0";
984 if (get_string("ÆâÍÆ: ", tmp, 79))
986 if (get_string("diary note: ", tmp, 79))
989 strcpy(bunshou, tmp);
991 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
995 static void do_cmd_last_get(void)
1000 if (record_o_name[0] == '\0') return;
1003 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
1005 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
1007 if (!get_check(buf)) return;
1012 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
1014 sprintf(buf,"descover %s.", record_o_name);
1016 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
1020 static void do_cmd_erase_nikki(void)
1027 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
1029 if (!get_check("Do you really want to delete all your record? ")) return;
1033 sprintf(file_name,"playrecord-%s.txt",savefile_base);
1035 sprintf(file_name,"playrec-%s.txt",savefile_base);
1038 /* Build the filename */
1039 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
1041 /* Remove the file */
1044 fff = my_fopen(buf, "w");
1048 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
1050 msg_format("deleted record.");
1054 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1056 msg_format("failed to delete %s.", buf);
1063 void do_cmd_nikki(void)
1067 /* File type is "TEXT" */
1068 FILE_TYPE(FILE_TYPE_TEXT);
1070 /* Save the screen */
1073 /* Interact until done */
1079 /* Ask for a choice */
1081 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1083 prt("[ Play Record ]", 2, 0);
1087 /* Give some choices */
1089 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1090 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1091 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1092 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1094 prt("(1) Display your record", 4, 5);
1095 prt("(2) Add record", 5, 5);
1096 prt("(3) Record item you last get/identify", 6, 5);
1097 prt("(4) Delete your record", 7, 5);
1103 prt("¥³¥Þ¥ó¥É:", 18, 0);
1105 prt("Command: ", 18, 0);
1113 if (i == ESCAPE) break;
1118 do_cmd_disp_nikki();
1127 do_cmd_erase_nikki();
1129 default: /* Unknown option */
1133 /* Flush messages */
1137 /* Restore the screen */
1142 * Hack -- redraw the screen
1144 * This command performs various low level updates, clears all the "extra"
1145 * windows, does a total redraw of the main window, and requests all of the
1146 * interesting updates and redraws that I can think of.
1148 * This command is also used to "instantiate" the results of the user
1149 * selecting various things, such as graphics mode, so it must call
1150 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1152 void do_cmd_redraw(void)
1159 /* Hack -- react to changes */
1160 Term_xtra(TERM_XTRA_REACT, 0);
1163 /* Combine and Reorder the pack (later) */
1164 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1168 p_ptr->update |= (PU_TORCH);
1171 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1173 /* Forget lite/view */
1174 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1176 /* Update lite/view */
1177 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1179 /* Update monsters */
1180 p_ptr->update |= (PU_MONSTERS);
1182 /* Redraw everything */
1183 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1186 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1189 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1193 /* Hack -- update */
1196 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1199 /* Redraw every window */
1200 for (j = 0; j < 8; j++)
1203 if (!angband_term[j]) continue;
1206 Term_activate(angband_term[j]);
1221 * Hack -- change name
1223 void do_cmd_change_name(void)
1232 /* Save the screen */
1240 /* Display the player */
1241 display_player(mode);
1246 display_player(mode);
1251 Term_putstr(2, 23, -1, TERM_WHITE,
1252 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1254 Term_putstr(2, 23, -1, TERM_WHITE,
1255 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1263 if (c == ESCAPE) break;
1270 /* Process the player name */
1271 process_player_name(FALSE);
1277 sprintf(tmp, "%s.txt", player_base);
1279 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1281 if (get_string("File name: ", tmp, 80))
1285 if (tmp[0] && (tmp[0] != ' '))
1287 file_character(tmp);
1304 /* Flush messages */
1308 /* Restore the screen */
1311 /* Redraw everything */
1312 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1319 * Recall the most recent message
1321 void do_cmd_message_one(void)
1323 /* Recall one message XXX XXX XXX */
1324 prt(format("> %s", message_str(0)), 0, 0);
1329 * Show previous messages to the user -BEN-
1331 * The screen format uses line 0 and 23 for headers and prompts,
1332 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1334 * This command shows you which commands you are viewing, and allows
1335 * you to "search" for strings in the recall.
1337 * Note that messages may be longer than 80 characters, but they are
1338 * displayed using "infinite" length, with a special sub-command to
1339 * "slide" the virtual display to the left or right.
1341 * Attempt to only hilite the matching portions of the string.
1343 void do_cmd_messages(int num_now)
1353 Term_get_size(&wid, &hgt);
1355 /* Number of message lines in a screen */
1356 num_lines = hgt - 4;
1365 /* Total messages */
1368 /* Start on first message */
1371 /* Save the screen */
1377 /* Process requests until done */
1383 /* Dump up to 20 lines of messages */
1384 for (j = 0; (j < num_lines) && (i + j < n); j++)
1386 cptr msg = message_str(i+j);
1388 /* Dump the messages, bottom to top */
1389 c_prt((i+j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1391 /* Hilite "shower" */
1396 /* Display matches */
1397 while ((str = my_strstr(str, shower)) != NULL)
1399 int len = strlen(shower);
1401 /* Display the match */
1402 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1410 /* Erase remaining lines */
1411 for (; j < num_lines; j++)
1413 Term_erase(0, num_lines + 1 - j, 255);
1416 /* Display header XXX XXX XXX */
1419 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1420 i, i+j-1, n), 0, 0);
1422 prt(format("Message Recall (%d-%d of %d)",
1423 i, i+j-1, n), 0, 0);
1427 /* Display prompt (not very informative) */
1429 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1431 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1436 skey = inkey_special(TRUE);
1438 /* Exit on Escape */
1439 if (skey == ESCAPE) break;
1441 /* Hack -- Save the old index */
1444 /* Hack -- handle show */
1449 prt("¶¯Ä´: ", hgt - 1, 0);
1451 prt("Show: ", hgt - 1, 0);
1455 /* Get a "shower" string, or continue */
1456 if (!askfor(shower, 80)) continue;
1462 /* Hack -- handle find */
1463 if (skey == '/' || skey == KTRL('s'))
1469 prt("¸¡º÷: ", hgt - 1, 0);
1471 prt("Find: ", hgt - 1, 0);
1475 /* Get a "finder" string, or continue */
1476 if (!askfor(finder, 80)) continue;
1479 strcpy(shower, finder);
1482 for (z = i + 1; z < n; z++)
1484 cptr msg = message_str(z);
1487 if (my_strstr(msg, finder))
1498 /* Recall 1 older message */
1499 if (skey == SKEY_TOP)
1501 /* Go to the oldest line */
1505 /* Recall 1 newer message */
1506 if (skey == SKEY_BOTTOM)
1508 /* Go to the newest line */
1512 /* Recall 1 older message */
1513 if (skey == '8' || skey == SKEY_UP || skey == '\n' || skey == '\r')
1515 /* Go older if legal */
1516 i = MIN(i + 1, n - num_lines);
1519 /* Recall 10 older messages */
1522 /* Go older if legal */
1523 i = MIN(i + 10, n - num_lines);
1526 /* Recall 20 older messages */
1527 if (skey == 'p' || skey == KTRL('P') || skey == ' ' || skey == SKEY_PGUP)
1529 /* Go older if legal */
1530 i = MIN(i + num_lines, n - num_lines);
1533 /* Recall 20 newer messages */
1534 if (skey == 'n' || skey == KTRL('N') || skey == SKEY_PGDOWN)
1536 /* Go newer (if able) */
1537 i = MAX(0, i - num_lines);
1540 /* Recall 10 newer messages */
1543 /* Go newer (if able) */
1547 /* Recall 1 newer messages */
1548 if (skey == '2' || skey == SKEY_DOWN)
1550 /* Go newer (if able) */
1554 /* Hack -- Error of some kind */
1558 /* Restore the screen */
1565 * Number of cheating options
1572 static option_type cheat_info[CHEAT_MAX] =
1574 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1576 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1578 "cheat_peek", "Peek into object creation"
1582 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1584 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1586 "cheat_hear", "Peek into monster creation"
1590 { &cheat_room, FALSE, 255, 0x04, 0x00,
1592 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1594 "cheat_room", "Peek into dungeon creation"
1598 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1600 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1602 "cheat_xtra", "Peek into something else"
1606 { &cheat_know, FALSE, 255, 0x10, 0x00,
1608 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1610 "cheat_know", "Know complete monster info"
1614 { &cheat_live, FALSE, 255, 0x20, 0x00,
1616 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1618 "cheat_live", "Allow player to avoid death"
1622 { &cheat_save, FALSE, 255, 0x40, 0x00,
1624 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1626 "cheat_save", "Ask for saving death"
1632 * Interact with some options for cheating
1634 static void do_cmd_options_cheat(cptr info)
1638 int i, k = 0, n = CHEAT_MAX;
1646 /* Interact with the player */
1651 /* Prompt XXX XXX XXX */
1653 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1655 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1661 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1662 prt(" << Ãí°Õ >>", 11, 0);
1663 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1664 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1665 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1667 /* Display the options */
1668 for (i = 0; i < n; i++)
1670 byte a = TERM_WHITE;
1672 /* Color current option */
1673 if (i == k) a = TERM_L_BLUE;
1675 /* Display the option text */
1676 sprintf(buf, "%-48s: %s (%s)",
1677 cheat_info[i].o_desc,
1679 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1681 (*cheat_info[i].o_var ? "yes" : "no "),
1684 cheat_info[i].o_text);
1685 c_prt(a, buf, i + 2, 0);
1688 /* Hilite current option */
1689 move_cursor(k + 2, 50);
1695 * HACK - Try to translate the key into a direction
1696 * to allow using the roguelike keys for navigation.
1698 dir = get_keymap_dir(ch);
1699 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1713 k = (n + k - 1) % n;
1732 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1734 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1736 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1737 (*cheat_info[k].o_var) = TRUE;
1746 (*cheat_info[k].o_var) = FALSE;
1754 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1756 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1758 /* Peruse the help file */
1759 (void)show_file(TRUE, buf, NULL, 0, 0);
1775 static option_type autosave_info[2] =
1777 { &autosave_l, FALSE, 255, 0x01, 0x00,
1779 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1781 "autosave_l", "Autosave when entering new levels" },
1785 { &autosave_t, FALSE, 255, 0x02, 0x00,
1787 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1789 "autosave_t", "Timed autosave" },
1795 static s16b toggle_frequency(s16b current)
1800 case 50: return 100;
1801 case 100: return 250;
1802 case 250: return 500;
1803 case 500: return 1000;
1804 case 1000: return 2500;
1805 case 2500: return 5000;
1806 case 5000: return 10000;
1807 case 10000: return 25000;
1814 * Interact with some options for cheating
1816 static void do_cmd_options_autosave(cptr info)
1820 int i, k = 0, n = 2;
1828 /* Interact with the player */
1831 /* Prompt XXX XXX XXX */
1833 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1835 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1840 /* Display the options */
1841 for (i = 0; i < n; i++)
1843 byte a = TERM_WHITE;
1845 /* Color current option */
1846 if (i == k) a = TERM_L_BLUE;
1848 /* Display the option text */
1849 sprintf(buf, "%-48s: %s (%s)",
1850 autosave_info[i].o_desc,
1852 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1854 (*autosave_info[i].o_var ? "yes" : "no "),
1857 autosave_info[i].o_text);
1858 c_prt(a, buf, i + 2, 0);
1862 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1864 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1869 /* Hilite current option */
1870 move_cursor(k + 2, 50);
1886 k = (n + k - 1) % n;
1904 (*autosave_info[k].o_var) = TRUE;
1913 (*autosave_info[k].o_var) = FALSE;
1921 autosave_freq = toggle_frequency(autosave_freq);
1923 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1924 autosave_freq), 5, 0);
1926 prt(format("Timed autosave frequency: every %d turns",
1927 autosave_freq), 5, 0);
1935 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1937 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1956 * Interact with some options
1958 void do_cmd_options_aux(int page, cptr info)
1961 int i, k = 0, n = 0, l;
1964 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1965 (!p_ptr->wizard || !allow_debug_opts);
1968 /* Lookup the options */
1969 for (i = 0; i < 24; i++) opt[i] = 0;
1971 /* Scan the options */
1972 for (i = 0; option_info[i].o_desc; i++)
1974 /* Notice options on this "page" */
1975 if (option_info[i].o_page == page) opt[n++] = i;
1982 /* Interact with the player */
1987 /* Prompt XXX XXX XXX */
1989 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
1991 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
1997 /* HACK -- description for easy-auto-destroy options */
1999 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
2001 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
2004 /* Display the options */
2005 for (i = 0; i < n; i++)
2007 byte a = TERM_WHITE;
2009 /* Color current option */
2010 if (i == k) a = TERM_L_BLUE;
2012 /* Display the option text */
2013 sprintf(buf, "%-48s: %s (%.19s)",
2014 option_info[opt[i]].o_desc,
2016 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
2018 (*option_info[opt[i]].o_var ? "yes" : "no "),
2021 option_info[opt[i]].o_text);
2022 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
2023 else c_prt(a, buf, i + 2, 0);
2026 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
2029 /* Hilite current option */
2030 move_cursor(k + 2 + l, 50);
2036 * HACK - Try to translate the key into a direction
2037 * to allow using the roguelike keys for navigation.
2039 dir = get_keymap_dir(ch);
2040 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2054 k = (n + k - 1) % n;
2071 if (browse_only) break;
2072 (*option_info[opt[k]].o_var) = TRUE;
2081 if (browse_only) break;
2082 (*option_info[opt[k]].o_var) = FALSE;
2090 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2097 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2099 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2101 /* Peruse the help file */
2102 (void)show_file(TRUE, buf, NULL, 0, 0);
2119 * Modify the "window" options
2121 static void do_cmd_options_win(void)
2135 /* Memorize old flags */
2136 for (j = 0; j < 8; j++)
2138 /* Acquire current flags */
2139 old_flag[j] = window_flag[j];
2149 /* Prompt XXX XXX XXX */
2151 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2153 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2157 /* Display the windows */
2158 for (j = 0; j < 8; j++)
2160 byte a = TERM_WHITE;
2162 cptr s = angband_term_name[j];
2165 if (j == x) a = TERM_L_BLUE;
2167 /* Window name, staggered, centered */
2168 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2171 /* Display the options */
2172 for (i = 0; i < 16; i++)
2174 byte a = TERM_WHITE;
2176 cptr str = window_flag_desc[i];
2179 if (i == y) a = TERM_L_BLUE;
2183 if (!str) str = "(̤»ÈÍÑ)";
2185 if (!str) str = "(Unused option)";
2190 Term_putstr(0, i + 5, -1, a, str);
2192 /* Display the windows */
2193 for (j = 0; j < 8; j++)
2195 byte a = TERM_WHITE;
2200 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2203 if (window_flag[j] & (1L << i)) c = 'X';
2206 Term_putch(35 + j * 5, i + 5, a, c);
2211 Term_gotoxy(35 + x * 5, y + 5);
2229 for (j = 0; j < 8; j++)
2231 window_flag[j] &= ~(1L << y);
2235 for (i = 0; i < 16; i++)
2237 window_flag[x] &= ~(1L << i);
2250 window_flag[x] |= (1L << y);
2258 window_flag[x] &= ~(1L << y);
2265 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2267 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2277 d = get_keymap_dir(ch);
2279 x = (x + ddx[d] + 8) % 8;
2280 y = (y + ddy[d] + 16) % 16;
2287 /* Notice changes */
2288 for (j = 0; j < 8; j++)
2293 if (!angband_term[j]) continue;
2295 /* Ignore non-changes */
2296 if (window_flag[j] == old_flag[j]) continue;
2299 Term_activate(angband_term[j]);
2316 * Set or unset various options.
2318 * The user must use the "Ctrl-R" command to "adapt" to changes
2319 * in any options which control "visual" aspects of the game.
2321 void do_cmd_options(void)
2326 /* Save the screen */
2335 /* Why are we here */
2337 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2339 prt("Options", 1, 0);
2343 /* Give some choices */
2345 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 2, 5);
2346 prt("(2) ¥Þ¥Ã¥×²èÌÌ ¥ª¥×¥·¥ç¥ó", 3, 5);
2347 prt("(3) ¥Æ¥¥¹¥Èɽ¼¨ ¥ª¥×¥·¥ç¥ó", 4, 5);
2348 prt("(4) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 5, 5);
2349 prt("(5) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 6, 5);
2350 prt("(6) ´Ê°×¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 7, 5);
2351 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 8, 5);
2353 /* Special choices */
2354 prt("(P) ¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 10, 5);
2355 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
2356 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
2357 prt("(M) ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
2358 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2360 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2362 prt("(1) Input Options", 2, 5);
2363 prt("(2) Map Screen Options", 3, 5);
2364 prt("(3) Text Display Options", 4, 5);
2365 prt("(4) Game-Play Options", 5, 5);
2366 prt("(5) Disturbance Options", 6, 5);
2367 prt("(6) Easy Auto-Destroyer Options", 7, 5);
2368 prt("(R) Play-record Options", 8, 5);
2369 /* Special choices */
2370 prt("(P) Auto-picker/destroyer editor", 10, 5);
2371 prt("(D) Base Delay Factor", 11, 5);
2372 prt("(H) Hitpoint Warning", 12, 5);
2373 prt("(M) Mana Color Threshold", 13, 5);
2374 prt("(A) Autosave Options", 14, 5);
2376 prt("(W) Window Flags", 15, 5);
2379 if (!p_ptr->wizard || !allow_debug_opts)
2383 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
2385 prt("(B) Birth Options (Browse Only)", 16, 5);
2392 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó", 16, 5);
2394 prt("(B) Birth Options", 16, 5);
2399 if (p_ptr->noscore || allow_debug_opts)
2403 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 17, 5);
2405 prt("(C) Cheating Options", 17, 5);
2412 prt("¥³¥Þ¥ó¥É:", 19, 0);
2414 prt("Command: ", 19, 0);
2422 if (k == ESCAPE) break;
2429 /* Process the general options */
2431 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2433 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2441 /* Process the general options */
2443 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "¥Þ¥Ã¥×²èÌÌ¥ª¥×¥·¥ç¥ó");
2445 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
2455 do_cmd_options_aux(OPT_PAGE_TEXT, "¥Æ¥¥¹¥Èɽ¼¨¥ª¥×¥·¥ç¥ó");
2457 do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
2467 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2469 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2479 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2481 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2491 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2493 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2498 /* Play-record Options */
2504 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2506 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2517 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2519 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2525 /* Cheating Options */
2528 if (!p_ptr->noscore && !allow_debug_opts)
2530 /* Cheat options are not permitted */
2537 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2539 do_cmd_options_cheat("Cheaters never win");
2549 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2551 do_cmd_options_autosave("Autosave");
2562 do_cmd_options_win();
2563 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2564 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2565 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2566 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2570 /* Auto-picker/destroyer editor */
2574 do_cmd_edit_autopick();
2578 /* Hack -- Delay Speed */
2584 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2586 prt("Command: Base Delay Factor", 19, 0);
2590 /* Get a new value */
2593 int msec = delay_factor * delay_factor * delay_factor;
2595 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2596 delay_factor, msec), 22, 0);
2598 prt(format("Current base delay factor: %d (%d msec)",
2599 delay_factor, msec), 22, 0);
2603 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2605 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2609 if (k == ESCAPE) break;
2613 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2615 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2619 else if (isdigit(k)) delay_factor = D2I(k);
2626 /* Hack -- hitpoint warning factor */
2632 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2634 prt("Command: Hitpoint Warning", 19, 0);
2638 /* Get a new value */
2642 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2643 hitpoint_warn), 22, 0);
2645 prt(format("Current hitpoint warning: %d0%%",
2646 hitpoint_warn), 22, 0);
2650 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2652 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2656 if (k == ESCAPE) break;
2660 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2662 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2666 else if (isdigit(k)) hitpoint_warn = D2I(k);
2673 /* Hack -- mana color factor */
2679 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2681 prt("Command: Mana Color Threshold", 19, 0);
2685 /* Get a new value */
2689 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2692 prt(format("Current mana color threshold: %d0%%",
2697 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2699 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2703 if (k == ESCAPE) break;
2707 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2709 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2713 else if (isdigit(k)) mana_warn = D2I(k);
2722 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2724 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2729 /* Unknown option */
2738 /* Flush messages */
2743 /* Restore the screen */
2746 /* Hack - Redraw equippy chars */
2747 p_ptr->redraw |= (PR_EQUIPPY);
2753 * Ask for a "user pref line" and process it
2755 * XXX XXX XXX Allow absolute file names?
2757 void do_cmd_pref(void)
2764 /* Ask for a "user pref command" */
2766 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2768 if (!get_string("Pref: ", buf, 80)) return;
2772 /* Process that pref command */
2773 (void)process_pref_file_command(buf);
2776 void do_cmd_reload_autopick(void)
2779 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2781 if (!get_check("Reload auto-pick preference file? ")) return;
2784 /* Load the file with messages */
2785 autopick_load_pref(TRUE);
2791 * Hack -- append all current macros to the given file
2793 static errr macro_dump(cptr fname)
2795 static cptr mark = "Macro Dump";
2801 /* Build the filename */
2802 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2804 /* File type is "TEXT" */
2805 FILE_TYPE(FILE_TYPE_TEXT);
2807 /* Append to the file */
2808 if (!open_auto_dump(buf, mark)) return (-1);
2812 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2814 auto_dump_printf("\n# Automatic macro dump\n\n");
2818 for (i = 0; i < macro__num; i++)
2820 /* Extract the action */
2821 ascii_to_text(buf, macro__act[i]);
2823 /* Dump the macro */
2824 auto_dump_printf("A:%s\n", buf);
2826 /* Extract the action */
2827 ascii_to_text(buf, macro__pat[i]);
2829 /* Dump normal macros */
2830 auto_dump_printf("P:%s\n", buf);
2833 auto_dump_printf("\n");
2845 * Hack -- ask for a "trigger" (see below)
2847 * Note the complex use of the "inkey()" function from "util.c".
2849 * Note that both "flush()" calls are extremely important.
2851 static void do_cmd_macro_aux(char *buf)
2861 /* Do not process macros */
2867 /* Read the pattern */
2873 /* Do not process macros */
2876 /* Do not wait for keys */
2879 /* Attempt to read a key */
2890 /* Convert the trigger */
2891 ascii_to_text(tmp, buf);
2893 /* Hack -- display the trigger */
2894 Term_addstr(-1, TERM_WHITE, tmp);
2901 * Hack -- ask for a keymap "trigger" (see below)
2903 * Note that both "flush()" calls are extremely important. This may
2904 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2906 static void do_cmd_macro_aux_keymap(char *buf)
2920 /* Convert to ascii */
2921 ascii_to_text(tmp, buf);
2923 /* Hack -- display the trigger */
2924 Term_addstr(-1, TERM_WHITE, tmp);
2933 * Hack -- append all keymaps to the given file
2935 static errr keymap_dump(cptr fname)
2937 static cptr mark = "Keymap Dump";
2946 if (rogue_like_commands)
2948 mode = KEYMAP_MODE_ROGUE;
2954 mode = KEYMAP_MODE_ORIG;
2958 /* Build the filename */
2959 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2961 /* File type is "TEXT" */
2962 FILE_TYPE(FILE_TYPE_TEXT);
2964 /* Append to the file */
2965 if (!open_auto_dump(buf, mark)) return -1;
2969 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2971 auto_dump_printf("\n# Automatic keymap dump\n\n");
2975 for (i = 0; i < 256; i++)
2979 /* Loop up the keymap */
2980 act = keymap_act[mode][i];
2982 /* Skip empty keymaps */
2985 /* Encode the key */
2988 ascii_to_text(key, buf);
2990 /* Encode the action */
2991 ascii_to_text(buf, act);
2993 /* Dump the macro */
2994 auto_dump_printf("A:%s\n", buf);
2995 auto_dump_printf("C:%d:%s\n", mode, key);
3008 * Interact with "macros"
3010 * Note that the macro "action" must be defined before the trigger.
3012 * Could use some helpful instructions on this page. XXX XXX XXX
3014 void do_cmd_macros(void)
3026 if (rogue_like_commands)
3028 mode = KEYMAP_MODE_ROGUE;
3034 mode = KEYMAP_MODE_ORIG;
3037 /* File type is "TEXT" */
3038 FILE_TYPE(FILE_TYPE_TEXT);
3045 /* Process requests until done */
3053 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3055 prt("Interact with Macros", 2, 0);
3060 /* Describe that action */
3062 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3064 prt("Current action (if any) shown below:", 20, 0);
3068 /* Analyze the current action */
3069 ascii_to_text(buf, macro__buf);
3071 /* Display the current action */
3077 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3079 prt("(1) Load a user pref file", 4, 5);
3084 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3085 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3086 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3087 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3088 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3089 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3090 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3091 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3092 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3094 prt("(2) Append macros to a file", 5, 5);
3095 prt("(3) Query a macro", 6, 5);
3096 prt("(4) Create a macro", 7, 5);
3097 prt("(5) Remove a macro", 8, 5);
3098 prt("(6) Append keymaps to a file", 9, 5);
3099 prt("(7) Query a keymap", 10, 5);
3100 prt("(8) Create a keymap", 11, 5);
3101 prt("(9) Remove a keymap", 12, 5);
3102 prt("(0) Enter a new action", 13, 5);
3105 #endif /* ALLOW_MACROS */
3109 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3111 prt("Command: ", 16, 0);
3119 if (i == ESCAPE) break;
3121 /* Load a 'macro' file */
3128 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3130 prt("Command: Load a user pref file", 16, 0);
3136 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3138 prt("File: ", 18, 0);
3142 /* Default filename */
3143 sprintf(tmp, "%s.prf", player_name);
3145 /* Ask for a file */
3146 if (!askfor(tmp, 80)) continue;
3148 /* Process the given filename */
3149 err = process_pref_file(tmp);
3153 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3155 msg_format("Loaded default '%s'.", tmp);
3162 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3164 msg_format("Failed to load '%s'!");
3170 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3172 msg_format("Loaded '%s'.", tmp);
3184 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3186 prt("Command: Append macros to a file", 16, 0);
3192 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3194 prt("File: ", 18, 0);
3198 /* Default filename */
3199 sprintf(tmp, "%s.prf", player_name);
3201 /* Ask for a file */
3202 if (!askfor(tmp, 80)) continue;
3204 /* Dump the macros */
3205 (void)macro_dump(tmp);
3209 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3211 msg_print("Appended macros.");
3223 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3225 prt("Command: Query a macro", 16, 0);
3231 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3233 prt("Trigger: ", 18, 0);
3237 /* Get a macro trigger */
3238 do_cmd_macro_aux(buf);
3240 /* Acquire action */
3241 k = macro_find_exact(buf);
3248 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3250 msg_print("Found no macro.");
3258 /* Obtain the action */
3259 strcpy(macro__buf, macro__act[k]);
3261 /* Analyze the current action */
3262 ascii_to_text(buf, macro__buf);
3264 /* Display the current action */
3269 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3271 msg_print("Found a macro.");
3277 /* Create a macro */
3282 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3284 prt("Command: Create a macro", 16, 0);
3290 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3292 prt("Trigger: ", 18, 0);
3296 /* Get a macro trigger */
3297 do_cmd_macro_aux(buf);
3304 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3306 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3311 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3313 prt("Action: ", 20, 0);
3317 /* Convert to text */
3318 ascii_to_text(tmp, macro__buf);
3320 /* Get an encoded action */
3321 if (askfor(tmp, 80))
3323 /* Convert to ascii */
3324 text_to_ascii(macro__buf, tmp);
3326 /* Link the macro */
3327 macro_add(buf, macro__buf);
3331 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3333 msg_print("Added a macro.");
3339 /* Remove a macro */
3344 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3346 prt("Command: Remove a macro", 16, 0);
3352 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3354 prt("Trigger: ", 18, 0);
3358 /* Get a macro trigger */
3359 do_cmd_macro_aux(buf);
3361 /* Link the macro */
3362 macro_add(buf, buf);
3366 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3368 msg_print("Removed a macro.");
3378 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3380 prt("Command: Append keymaps to a file", 16, 0);
3386 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3388 prt("File: ", 18, 0);
3392 /* Default filename */
3393 sprintf(tmp, "%s.prf", player_name);
3395 /* Ask for a file */
3396 if (!askfor(tmp, 80)) continue;
3398 /* Dump the macros */
3399 (void)keymap_dump(tmp);
3403 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3405 msg_print("Appended keymaps.");
3410 /* Query a keymap */
3417 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3419 prt("Command: Query a keymap", 16, 0);
3425 prt("²¡¤¹¥¡¼: ", 18, 0);
3427 prt("Keypress: ", 18, 0);
3431 /* Get a keymap trigger */
3432 do_cmd_macro_aux_keymap(buf);
3434 /* Look up the keymap */
3435 act = keymap_act[mode][(byte)(buf[0])];
3442 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3444 msg_print("Found no keymap.");
3452 /* Obtain the action */
3453 strcpy(macro__buf, act);
3455 /* Analyze the current action */
3456 ascii_to_text(buf, macro__buf);
3458 /* Display the current action */
3463 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3465 msg_print("Found a keymap.");
3471 /* Create a keymap */
3476 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3478 prt("Command: Create a keymap", 16, 0);
3484 prt("²¡¤¹¥¡¼: ", 18, 0);
3486 prt("Keypress: ", 18, 0);
3490 /* Get a keymap trigger */
3491 do_cmd_macro_aux_keymap(buf);
3498 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3500 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3505 prt("¹ÔÆ°: ", 20, 0);
3507 prt("Action: ", 20, 0);
3511 /* Convert to text */
3512 ascii_to_text(tmp, macro__buf);
3514 /* Get an encoded action */
3515 if (askfor(tmp, 80))
3517 /* Convert to ascii */
3518 text_to_ascii(macro__buf, tmp);
3520 /* Free old keymap */
3521 string_free(keymap_act[mode][(byte)(buf[0])]);
3523 /* Make new keymap */
3524 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3528 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3530 msg_print("Added a keymap.");
3536 /* Remove a keymap */
3541 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3543 prt("Command: Remove a keymap", 16, 0);
3549 prt("²¡¤¹¥¡¼: ", 18, 0);
3551 prt("Keypress: ", 18, 0);
3555 /* Get a keymap trigger */
3556 do_cmd_macro_aux_keymap(buf);
3558 /* Free old keymap */
3559 string_free(keymap_act[mode][(byte)(buf[0])]);
3561 /* Make new keymap */
3562 keymap_act[mode][(byte)(buf[0])] = NULL;
3566 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3568 msg_print("Removed a keymap.");
3573 /* Enter a new action */
3578 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3580 prt("Command: Enter a new action", 16, 0);
3588 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3590 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3595 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3597 prt("Action: ", 20, 0);
3600 /* Hack -- limit the value */
3603 /* Get an encoded action */
3604 if (!askfor(buf, 80)) continue;
3606 /* Extract an action */
3607 text_to_ascii(macro__buf, buf);
3610 #endif /* ALLOW_MACROS */
3619 /* Flush messages */
3628 static cptr lighting_level_str[F_LIT_MAX] =
3642 static bool cmd_visuals_aux(int i, int *num, int max)
3649 sprintf(str, "%d", *num);
3651 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3654 tmp = strtol(str, NULL, 0);
3655 if (tmp >= 0 && tmp < max)
3658 else if (isupper(i))
3659 *num = (*num + max - 1) % max;
3661 *num = (*num + 1) % max;
3666 static void print_visuals_menu(cptr choice_msg)
3669 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 1, 0);
3671 prt("Interact with Visuals", 1, 0);
3674 /* Give some choices */
3676 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3678 prt("(0) Load a user pref file", 3, 5);
3681 #ifdef ALLOW_VISUALS
3683 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3684 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3685 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3686 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3687 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3688 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3689 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3690 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3691 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3693 prt("(1) Dump monster attr/chars", 4, 5);
3694 prt("(2) Dump object attr/chars", 5, 5);
3695 prt("(3) Dump feature attr/chars", 6, 5);
3696 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3697 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3698 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3699 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3700 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3701 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3704 #endif /* ALLOW_VISUALS */
3707 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3709 prt("(R) Reset visuals", 13, 5);
3714 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3716 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3720 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3721 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3722 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3725 * Interact with "visuals"
3727 void do_cmd_visuals(void)
3732 bool need_redraw = FALSE;
3733 const char *empty_symbol = "<< ? >>";
3735 if (use_bigtile) empty_symbol = "<< ?? >>";
3737 /* File type is "TEXT" */
3738 FILE_TYPE(FILE_TYPE_TEXT);
3740 /* Save the screen */
3743 /* Interact until done */
3749 /* Ask for a choice */
3750 print_visuals_menu(NULL);
3756 if (i == ESCAPE) break;
3760 /* Load a 'pref' file */
3764 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3766 prt("Command: Load a user pref file", 15, 0);
3771 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3773 prt("File: ", 17, 0);
3776 /* Default filename */
3777 sprintf(tmp, "%s.prf", player_name);
3780 if (!askfor(tmp, 70)) continue;
3782 /* Process the given filename */
3783 (void)process_pref_file(tmp);
3788 #ifdef ALLOW_VISUALS
3790 /* Dump monster attr/chars */
3793 static cptr mark = "Monster attr/chars";
3797 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3799 prt("Command: Dump monster attr/chars", 15, 0);
3804 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3806 prt("File: ", 17, 0);
3809 /* Default filename */
3810 sprintf(tmp, "%s.prf", player_name);
3812 /* Get a filename */
3813 if (!askfor(tmp, 70)) continue;
3815 /* Build the filename */
3816 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3818 /* Append to the file */
3819 if (!open_auto_dump(buf, mark)) continue;
3823 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3825 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3829 for (i = 0; i < max_r_idx; i++)
3831 monster_race *r_ptr = &r_info[i];
3833 /* Skip non-entries */
3834 if (!r_ptr->name) continue;
3836 /* Dump a comment */
3837 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3839 /* Dump the monster attr/char info */
3840 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3841 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3849 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3851 msg_print("Dumped monster attr/chars.");
3857 /* Dump object attr/chars */
3860 static cptr mark = "Object attr/chars";
3864 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3866 prt("Command: Dump object attr/chars", 15, 0);
3871 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3873 prt("File: ", 17, 0);
3876 /* Default filename */
3877 sprintf(tmp, "%s.prf", player_name);
3879 /* Get a filename */
3880 if (!askfor(tmp, 70)) continue;
3882 /* Build the filename */
3883 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3885 /* Append to the file */
3886 if (!open_auto_dump(buf, mark)) continue;
3890 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3892 auto_dump_printf("\n# Object attr/char definitions\n\n");
3896 for (i = 0; i < max_k_idx; i++)
3899 object_kind *k_ptr = &k_info[i];
3901 /* Skip non-entries */
3902 if (!k_ptr->name) continue;
3907 strip_name(o_name, i);
3913 /* Prepare dummy object */
3914 object_prep(&forge, i);
3916 /* Get un-shuffled flavor name */
3917 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3920 /* Dump a comment */
3921 auto_dump_printf("# %s\n", o_name);
3923 /* Dump the object attr/char info */
3924 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3925 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3933 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3935 msg_print("Dumped object attr/chars.");
3941 /* Dump feature attr/chars */
3944 static cptr mark = "Feature attr/chars";
3948 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3950 prt("Command: Dump feature attr/chars", 15, 0);
3955 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3957 prt("File: ", 17, 0);
3960 /* Default filename */
3961 sprintf(tmp, "%s.prf", player_name);
3963 /* Get a filename */
3964 if (!askfor(tmp, 70)) continue;
3966 /* Build the filename */
3967 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3969 /* Append to the file */
3970 if (!open_auto_dump(buf, mark)) continue;
3974 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3976 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3980 for (i = 0; i < max_f_idx; i++)
3982 feature_type *f_ptr = &f_info[i];
3984 /* Skip non-entries */
3985 if (!f_ptr->name) continue;
3987 /* Skip mimiccing features */
3988 if (f_ptr->mimic != i) continue;
3990 /* Dump a comment */
3991 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3993 /* Dump the feature attr/char info */
3994 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3995 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3996 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3997 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
4005 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4007 msg_print("Dumped feature attr/chars.");
4013 /* Modify monster attr/chars (numeric operation) */
4017 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4019 static cptr choice_msg = "Change monster attr/chars";
4024 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4026 prt(format("Command: %s", choice_msg), 15, 0);
4029 /* Hack -- query until done */
4032 monster_race *r_ptr = &r_info[r];
4036 byte da = r_ptr->d_attr;
4037 byte dc = r_ptr->d_char;
4038 byte ca = r_ptr->x_attr;
4039 byte cc = r_ptr->x_char;
4041 /* Label the object */
4043 Term_putstr(5, 17, -1, TERM_WHITE,
4044 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
4045 r, (r_name + r_ptr->name)));
4047 Term_putstr(5, 17, -1, TERM_WHITE,
4048 format("Monster = %d, Name = %-40.40s",
4049 r, (r_name + r_ptr->name)));
4052 /* Label the Default values */
4054 Term_putstr(10, 19, -1, TERM_WHITE,
4055 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4057 Term_putstr(10, 19, -1, TERM_WHITE,
4058 format("Default attr/char = %3u / %3u", da, dc));
4061 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4062 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4064 /* Label the Current values */
4066 Term_putstr(10, 20, -1, TERM_WHITE,
4067 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4069 Term_putstr(10, 20, -1, TERM_WHITE,
4070 format("Current attr/char = %3u / %3u", ca, cc));
4073 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4074 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4078 Term_putstr(0, 22, -1, TERM_WHITE,
4079 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4081 Term_putstr(0, 22, -1, TERM_WHITE,
4082 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4089 if (i == ESCAPE) break;
4091 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4092 else if (isupper(i)) c = 'a' + i - 'A';
4102 if (!cmd_visuals_aux(i, &r, max_r_idx))
4108 while (!r_info[r].name);
4112 t = (int)r_ptr->x_attr;
4113 (void)cmd_visuals_aux(i, &t, 256);
4114 r_ptr->x_attr = (byte)t;
4118 t = (int)r_ptr->x_char;
4119 (void)cmd_visuals_aux(i, &t, 256);
4120 r_ptr->x_char = (byte)t;
4124 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4128 print_visuals_menu(choice_msg);
4136 /* Modify object attr/chars (numeric operation) */
4140 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4142 static cptr choice_msg = "Change object attr/chars";
4147 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4149 prt(format("Command: %s", choice_msg), 15, 0);
4152 /* Hack -- query until done */
4155 object_kind *k_ptr = &k_info[k];
4159 byte da = k_ptr->d_attr;
4160 byte dc = k_ptr->d_char;
4161 byte ca = k_ptr->x_attr;
4162 byte cc = k_ptr->x_char;
4164 /* Label the object */
4166 Term_putstr(5, 17, -1, TERM_WHITE,
4167 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4168 k, (k_name + k_ptr->name)));
4170 Term_putstr(5, 17, -1, TERM_WHITE,
4171 format("Object = %d, Name = %-40.40s",
4172 k, (k_name + k_ptr->name)));
4175 /* Label the Default values */
4177 Term_putstr(10, 19, -1, TERM_WHITE,
4178 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4180 Term_putstr(10, 19, -1, TERM_WHITE,
4181 format("Default attr/char = %3d / %3d", da, dc));
4184 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4185 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4187 /* Label the Current values */
4189 Term_putstr(10, 20, -1, TERM_WHITE,
4190 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4192 Term_putstr(10, 20, -1, TERM_WHITE,
4193 format("Current attr/char = %3d / %3d", ca, cc));
4196 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4197 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4201 Term_putstr(0, 22, -1, TERM_WHITE,
4202 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4204 Term_putstr(0, 22, -1, TERM_WHITE,
4205 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4212 if (i == ESCAPE) break;
4214 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4215 else if (isupper(i)) c = 'a' + i - 'A';
4225 if (!cmd_visuals_aux(i, &k, max_k_idx))
4231 while (!k_info[k].name || k_info[k].flavor);
4235 t = (int)k_ptr->x_attr;
4236 (void)cmd_visuals_aux(i, &t, 256);
4237 k_ptr->x_attr = (byte)t;
4241 t = (int)k_ptr->x_char;
4242 (void)cmd_visuals_aux(i, &t, 256);
4243 k_ptr->x_char = (byte)t;
4247 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4251 print_visuals_menu(choice_msg);
4259 /* Modify feature attr/chars (numeric operation) */
4263 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4265 static cptr choice_msg = "Change feature attr/chars";
4268 static int lighting_level = F_LIT_STANDARD;
4271 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4273 prt(format("Command: %s", choice_msg), 15, 0);
4276 /* Hack -- query until done */
4279 feature_type *f_ptr = &f_info[f];
4283 byte da = f_ptr->d_attr[lighting_level];
4284 byte dc = f_ptr->d_char[lighting_level];
4285 byte ca = f_ptr->x_attr[lighting_level];
4286 byte cc = f_ptr->x_char[lighting_level];
4288 /* Label the object */
4291 Term_putstr(5, 17, -1, TERM_WHITE,
4292 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4293 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4295 Term_putstr(5, 17, -1, TERM_WHITE,
4296 format("Terrain = %d, Name = %s, Lighting = %s",
4297 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4300 /* Label the Default values */
4302 Term_putstr(10, 19, -1, TERM_WHITE,
4303 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4305 Term_putstr(10, 19, -1, TERM_WHITE,
4306 format("Default attr/char = %3d / %3d", da, dc));
4309 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4311 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4313 /* Label the Current values */
4315 Term_putstr(10, 20, -1, TERM_WHITE,
4316 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4318 Term_putstr(10, 20, -1, TERM_WHITE,
4319 format("Current attr/char = %3d / %3d", ca, cc));
4322 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4323 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4327 Term_putstr(0, 22, -1, TERM_WHITE,
4328 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4330 Term_putstr(0, 22, -1, TERM_WHITE,
4331 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4338 if (i == ESCAPE) break;
4340 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4341 else if (isupper(i)) c = 'a' + i - 'A';
4351 if (!cmd_visuals_aux(i, &f, max_f_idx))
4357 while (!f_info[f].name || (f_info[f].mimic != f));
4361 t = (int)f_ptr->x_attr[lighting_level];
4362 (void)cmd_visuals_aux(i, &t, 256);
4363 f_ptr->x_attr[lighting_level] = (byte)t;
4367 t = (int)f_ptr->x_char[lighting_level];
4368 (void)cmd_visuals_aux(i, &t, 256);
4369 f_ptr->x_char[lighting_level] = (byte)t;
4373 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4376 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4380 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4384 print_visuals_menu(choice_msg);
4392 /* Modify monster attr/chars (visual mode) */
4394 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4397 /* Modify object attr/chars (visual mode) */
4399 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4402 /* Modify feature attr/chars (visual mode) */
4405 int lighting_level = F_LIT_STANDARD;
4406 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4410 #endif /* ALLOW_VISUALS */
4420 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4422 msg_print("Visual attr/char tables reset.");
4428 /* Unknown option */
4434 /* Flush messages */
4438 /* Restore the screen */
4441 if (need_redraw) do_cmd_redraw();
4446 * Interact with "colors"
4448 void do_cmd_colors(void)
4457 /* File type is "TEXT" */
4458 FILE_TYPE(FILE_TYPE_TEXT);
4461 /* Save the screen */
4465 /* Interact until done */
4471 /* Ask for a choice */
4473 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4475 prt("Interact with Colors", 2, 0);
4479 /* Give some choices */
4481 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4483 prt("(1) Load a user pref file", 4, 5);
4488 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4489 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4491 prt("(2) Dump colors", 5, 5);
4492 prt("(3) Modify colors", 6, 5);
4499 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4501 prt("Command: ", 8, 0);
4509 if (i == ESCAPE) break;
4511 /* Load a 'pref' file */
4516 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4518 prt("Command: Load a user pref file", 8, 0);
4524 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4526 prt("File: ", 10, 0);
4531 sprintf(tmp, "%s.prf", player_name);
4534 if (!askfor(tmp, 70)) continue;
4536 /* Process the given filename */
4537 (void)process_pref_file(tmp);
4539 /* Mega-Hack -- react to changes */
4540 Term_xtra(TERM_XTRA_REACT, 0);
4542 /* Mega-Hack -- redraw */
4551 static cptr mark = "Colors";
4555 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4557 prt("Command: Dump colors", 8, 0);
4563 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4565 prt("File: ", 10, 0);
4569 /* Default filename */
4570 sprintf(tmp, "%s.prf", player_name);
4572 /* Get a filename */
4573 if (!askfor(tmp, 70)) continue;
4575 /* Build the filename */
4576 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4578 /* Append to the file */
4579 if (!open_auto_dump(buf, mark)) continue;
4583 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4585 auto_dump_printf("\n# Color redefinitions\n\n");
4589 for (i = 0; i < 256; i++)
4591 int kv = angband_color_table[i][0];
4592 int rv = angband_color_table[i][1];
4593 int gv = angband_color_table[i][2];
4594 int bv = angband_color_table[i][3];
4599 cptr name = "unknown";
4603 /* Skip non-entries */
4604 if (!kv && !rv && !gv && !bv) continue;
4606 /* Extract the color name */
4607 if (i < 16) name = color_names[i];
4609 /* Dump a comment */
4611 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4613 auto_dump_printf("# Color '%s'\n", name);
4616 /* Dump the monster attr/char info */
4617 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4626 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4628 msg_print("Dumped color redefinitions.");
4640 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4642 prt("Command: Modify colors", 8, 0);
4646 /* Hack -- query until done */
4655 /* Exhibit the normal colors */
4656 for (j = 0; j < 16; j++)
4658 /* Exhibit this color */
4659 Term_putstr(j*4, 20, -1, a, "###");
4661 /* Exhibit all colors */
4662 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4665 /* Describe the color */
4667 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4669 name = ((a < 16) ? color_names[a] : "undefined");
4673 /* Describe the color */
4675 Term_putstr(5, 10, -1, TERM_WHITE,
4676 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4678 Term_putstr(5, 10, -1, TERM_WHITE,
4679 format("Color = %d, Name = %s", a, name));
4683 /* Label the Current values */
4684 Term_putstr(5, 12, -1, TERM_WHITE,
4685 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4686 angband_color_table[a][0],
4687 angband_color_table[a][1],
4688 angband_color_table[a][2],
4689 angband_color_table[a][3]));
4693 Term_putstr(0, 14, -1, TERM_WHITE,
4694 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4696 Term_putstr(0, 14, -1, TERM_WHITE,
4697 "Command (n/N/k/K/r/R/g/G/b/B): ");
4705 if (i == ESCAPE) break;
4708 if (i == 'n') a = (byte)(a + 1);
4709 if (i == 'N') a = (byte)(a - 1);
4710 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4711 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4712 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4713 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4714 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4715 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4716 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4717 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4719 /* Hack -- react to changes */
4720 Term_xtra(TERM_XTRA_REACT, 0);
4722 /* Hack -- redraw */
4729 /* Unknown option */
4735 /* Flush messages */
4740 /* Restore the screen */
4746 * Note something in the message recall
4748 void do_cmd_note(void)
4757 if (!get_string("¥á¥â: ", buf, 60)) return;
4759 if (!get_string("Note: ", buf, 60)) return;
4763 /* Ignore empty notes */
4764 if (!buf[0] || (buf[0] == ' ')) return;
4766 /* Add the note to the message recall */
4768 msg_format("¥á¥â: %s", buf);
4770 msg_format("Note: %s", buf);
4777 * Mention the current version
4779 void do_cmd_version(void)
4784 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4785 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4787 msg_format("You are playing Hengband %d.%d.%d.",
4788 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4795 * Array of feeling strings
4797 static cptr do_cmd_feeling_text[11] =
4800 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4802 "Looks like any other level.",
4806 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4808 "You feel there is something special about this level.",
4812 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4814 "You nearly faint as horrible visions of death fill your mind!",
4818 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4820 "This level looks very dangerous.",
4824 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4826 "You have a very bad feeling...",
4830 "°¤¤Í½´¶¤¬¤¹¤ë...",
4832 "You have a bad feeling...",
4838 "You feel nervous.",
4842 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4844 "You feel your luck is turning...",
4848 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4850 "You don't like the look of this place.",
4854 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4856 "This level looks reasonably safe.",
4860 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4862 "What a boring place..."
4867 static cptr do_cmd_feeling_text_combat[11] =
4870 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4872 "Looks like any other level.",
4876 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4878 "You feel there is something special about this level.",
4882 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4884 "You nearly faint as horrible visions of death fill your mind!",
4888 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4890 "This level looks very dangerous.",
4894 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4896 "You have a very bad feeling...",
4900 "°¤¤Í½´¶¤¬¤¹¤ë...",
4902 "You have a bad feeling...",
4908 "You feel nervous.",
4912 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4914 "You feel your luck is turning...",
4918 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4920 "You don't like the look of this place.",
4924 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4926 "This level looks reasonably safe.",
4930 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4932 "What a boring place..."
4937 static cptr do_cmd_feeling_text_lucky[11] =
4940 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4941 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4942 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4943 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4944 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4945 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4946 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4947 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4948 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4949 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4950 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4952 "Looks like any other level.",
4953 "You feel there is something special about this level.",
4954 "You have a superb feeling about this level.",
4955 "You have an excellent feeling...",
4956 "You have a very good feeling...",
4957 "You have a good feeling...",
4958 "You feel strangely lucky...",
4959 "You feel your luck is turning...",
4960 "You like the look of this place...",
4961 "This level can't be all bad...",
4962 "What a boring place..."
4968 * Note that "feeling" is set to zero unless some time has passed.
4969 * Note that this is done when the level is GENERATED, not entered.
4971 void do_cmd_feeling(void)
4973 /* No useful feeling in quests */
4974 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4977 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4979 msg_print("Looks like a typical quest level.");
4985 /* No useful feeling in town */
4986 else if (p_ptr->town_num && !dun_level)
4989 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4991 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4995 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4997 msg_print("Looks like a strange wilderness.");
5005 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
5007 msg_print("Looks like a typical town.");
5014 /* No useful feeling in the wilderness */
5015 else if (!dun_level)
5018 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5020 msg_print("Looks like a typical wilderness.");
5026 /* Display the feeling */
5027 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
5028 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
5029 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
5030 inventory[INVEN_BOW].name1 == ART_CRIMSON)
5031 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
5033 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
5039 * Description of each monster group.
5041 static cptr monster_group_text[] =
5044 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
5045 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5074 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5091 /* "¾åµé¥Ç¡¼¥â¥ó", */
5133 /* "Ancient Dragon/Wyrm", */
5142 "Multi-Headed Reptile",
5147 "Reptile/Amphibian",
5148 "Spider/Scorpion/Tick",
5150 /* "Major Demon", */
5167 * Symbols of monsters in each group. Note the "Uniques" group
5168 * is handled differently.
5170 static cptr monster_group_char[] =
5225 "!$&()+./=>?[\\]`{|~",
5235 * hook function to sort monsters by level
5237 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5239 u16b *who = (u16b*)(u);
5244 monster_race *r_ptr1 = &r_info[w1];
5245 monster_race *r_ptr2 = &r_info[w2];
5250 if (r_ptr2->level > r_ptr1->level) return TRUE;
5251 if (r_ptr1->level > r_ptr2->level) return FALSE;
5253 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5254 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5259 * Build a list of monster indexes in the given group. Return the number
5260 * of monsters in the group.
5262 * mode & 0x01 : check for non-empty group
5263 * mode & 0x02 : visual operation only
5265 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5270 /* Get a list of x_char in this group */
5271 cptr group_char = monster_group_char[grp_cur];
5273 /* XXX Hack -- Check if this is the "Uniques" group */
5274 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5276 /* XXX Hack -- Check if this is the "Riding" group */
5277 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5279 /* Check every race */
5280 for (i = 0; i < max_r_idx; i++)
5282 /* Access the race */
5283 monster_race *r_ptr = &r_info[i];
5285 /* Skip empty race */
5286 if (!r_ptr->name) continue ;
5288 /* Require known monsters */
5289 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5293 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5296 else if (grp_riding)
5298 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5303 /* Check for race in the group */
5304 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5308 mon_idx[mon_cnt++] = i;
5310 /* XXX Hack -- Just checking for non-empty group */
5311 if (mode & 0x01) break;
5314 /* Terminate the list */
5315 mon_idx[mon_cnt] = -1;
5317 /* Select the sort method */
5318 ang_sort_comp = ang_sort_comp_monster_level;
5319 ang_sort_swap = ang_sort_swap_hook;
5321 /* Sort by monster level */
5322 ang_sort(mon_idx, &dummy_why, mon_cnt);
5324 /* Return the number of races */
5330 * Description of each monster group.
5332 static cptr object_group_text[] =
5335 "¥¥Î¥³", /* "Mushrooms" */
5336 "Ìô", /* "Potions" */
5337 "Ìý¤Ä¤Ü", /* "Flasks" */
5338 "´¬Êª", /* "Scrolls" */
5339 "»ØÎØ", /* "Rings" */
5340 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5341 "ū", /* "Whistle" */
5342 "¸÷¸»", /* "Lanterns" */
5343 "ËâË¡ËÀ", /* "Wands" */
5344 "¾ó", /* "Staffs" */
5345 "¥í¥Ã¥É", /* "Rods" */
5346 "¥«¡¼¥É", /* "Cards" */
5347 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5357 "Åá·õÎà", /* "Swords" */
5358 "Æß´ï", /* "Blunt Weapons" */
5359 "ĹÊÁÉð´ï", /* "Polearms" */
5360 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5361 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5365 "·ÚÁõ³»", /* "Soft Armor" */
5366 "½ÅÁõ³»", /* "Hard Armor" */
5367 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5368 "½â", /* "Shields" */
5369 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5370 "äƼê", /* "Gloves" */
5371 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5372 "´§", /* "Crowns" */
5373 "¥Ö¡¼¥Ä", /* "Boots" */
5426 * TVALs of items in each group
5428 static byte object_group_tval[] =
5469 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5477 * Build a list of object indexes in the given group. Return the number
5478 * of objects in the group.
5480 * mode & 0x01 : check for non-empty group
5481 * mode & 0x02 : visual operation only
5483 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5485 int i, j, k, object_cnt = 0;
5487 /* Get a list of x_char in this group */
5488 byte group_tval = object_group_tval[grp_cur];
5490 /* Check every object */
5491 for (i = 0; i < max_k_idx; i++)
5493 /* Access the object */
5494 object_kind *k_ptr = &k_info[i];
5496 /* Skip empty objects */
5497 if (!k_ptr->name) continue;
5501 /* Any objects will be displayed */
5507 /* Skip non-flavoured objects */
5508 if (!k_ptr->flavor) continue;
5510 /* Require objects ever seen */
5511 if (!k_ptr->aware) continue;
5514 /* Skip items with no distribution (special artifacts) */
5515 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5519 /* Check for objects in the group */
5520 if (TV_LIFE_BOOK == group_tval)
5522 /* Hack -- All spell books */
5523 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5525 /* Add the object */
5526 object_idx[object_cnt++] = i;
5530 else if (k_ptr->tval == group_tval)
5532 /* Add the object */
5533 object_idx[object_cnt++] = i;
5537 /* XXX Hack -- Just checking for non-empty group */
5538 if (mode & 0x01) break;
5541 /* Terminate the list */
5542 object_idx[object_cnt] = -1;
5544 /* Return the number of objects */
5550 * Description of each feature group.
5552 static cptr feature_group_text[] =
5560 * Build a list of feature indexes in the given group. Return the number
5561 * of features in the group.
5563 * mode & 0x01 : check for non-empty group
5565 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5567 int i, feat_cnt = 0;
5569 /* Unused; There is a single group. */
5572 /* Check every feature */
5573 for (i = 0; i < max_f_idx; i++)
5575 /* Access the index */
5576 feature_type *f_ptr = &f_info[i];
5578 /* Skip empty index */
5579 if (!f_ptr->name) continue;
5581 /* Skip mimiccing features */
5582 if (f_ptr->mimic != i) continue;
5585 feat_idx[feat_cnt++] = i;
5587 /* XXX Hack -- Just checking for non-empty group */
5588 if (mode & 0x01) break;
5591 /* Terminate the list */
5592 feat_idx[feat_cnt] = -1;
5594 /* Return the number of races */
5601 * Build a list of monster indexes in the given group. Return the number
5602 * of monsters in the group.
5604 static int collect_artifacts(int grp_cur, int object_idx[])
5606 int i, object_cnt = 0;
5608 /* Get a list of x_char in this group */
5609 byte group_tval = object_group_tval[grp_cur];
5611 /* Check every object */
5612 for (i = 0; i < max_a_idx; i++)
5614 /* Access the artifact */
5615 artifact_type *a_ptr = &a_info[i];
5617 /* Skip empty artifacts */
5618 if (!a_ptr->name) continue;
5620 /* Skip "uncreated" artifacts */
5621 if (!a_ptr->cur_num) continue;
5623 /* Check for race in the group */
5624 if (a_ptr->tval == group_tval)
5627 object_idx[object_cnt++] = i;
5631 /* Terminate the list */
5632 object_idx[object_cnt] = 0;
5634 /* Return the number of races */
5641 * Encode the screen colors
5643 static char hack[17] = "dwsorgbuDWvyRGBU";
5647 * Hack -- load a screen dump from a file
5649 void do_cmd_load_screen(void)
5664 Term_get_size(&wid, &hgt);
5666 /* Build the filename */
5667 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5669 /* Append to the file */
5670 fff = my_fopen(buf, "r");
5675 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5677 msg_format("Failed to open %s.", buf);
5684 /* Save the screen */
5687 /* Clear the screen */
5691 /* Load the screen */
5692 for (y = 0; okay; y++)
5694 /* Get a line of data including control code */
5695 if (!fgets(buf, 1024, fff)) okay = FALSE;
5697 /* Get the blank line */
5698 if (buf[0] == '\n' || buf[0] == '\0') break;
5700 /* Ignore too large screen image */
5701 if (y >= hgt) continue;
5704 for (x = 0; x < wid - 1; x++)
5707 if (buf[x] == '\n' || buf[x] == '\0') break;
5709 /* Put the attr/char */
5710 Term_draw(x, y, TERM_WHITE, buf[x]);
5714 /* Dump the screen */
5715 for (y = 0; okay; y++)
5717 /* Get a line of data including control code */
5718 if (!fgets(buf, 1024, fff)) okay = FALSE;
5720 /* Get the blank line */
5721 if (buf[0] == '\n' || buf[0] == '\0') break;
5723 /* Ignore too large screen image */
5724 if (y >= hgt) continue;
5727 for (x = 0; x < wid - 1; x++)
5730 if (buf[x] == '\n' || buf[x] == '\0') break;
5732 /* Get the attr/char */
5733 (void)(Term_what(x, y, &a, &c));
5735 /* Look up the attr */
5736 for (i = 0; i < 16; i++)
5738 /* Use attr matches */
5739 if (hack[i] == buf[x]) a = i;
5742 /* Put the attr/char */
5743 Term_draw(x, y, a, c);
5754 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5756 msg_print("Screen dump loaded.");
5763 /* Restore the screen */
5770 cptr inven_res_label =
5772 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5774 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5779 #define IM_FLAG_STR "¡ö"
5780 #define HAS_FLAG_STR "¡Ü"
5781 #define NO_FLAG_STR "¡¦"
5783 #define IM_FLAG_STR "* "
5784 #define HAS_FLAG_STR "+ "
5785 #define NO_FLAG_STR ". "
5788 #define print_im_or_res_flag(IM, RES) \
5790 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5791 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5794 #define print_flag(TR) \
5796 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5800 /* XTRA HACK RESLIST */
5801 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5803 char o_name[MAX_NLEN];
5804 u32b flgs[TR_FLAG_SIZE];
5806 if (!o_ptr->k_idx) return;
5807 if (o_ptr->tval != tval) return;
5809 /* Identified items only */
5810 if (!object_is_known(o_ptr)) return;
5813 * HACK:Ring of Lordly protection and Dragon equipment
5814 * have random resistances.
5816 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5817 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5818 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5819 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5820 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5821 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5822 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5823 || object_is_artifact(o_ptr))
5826 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5828 while (o_name[i] && (i < 26))
5831 if (iskanji(o_name[i])) i++;
5840 o_name[i] = ' '; i++;
5845 fprintf(fff, "%s %s", where, o_name);
5847 if (!(o_ptr->ident & (IDENT_MENTAL)))
5850 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5852 fputs("-------unknown------------ -------unknown------\n", fff);
5857 object_flags_known(o_ptr, flgs);
5859 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5860 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5861 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5862 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5863 print_flag(TR_RES_POIS);
5864 print_flag(TR_RES_LITE);
5865 print_flag(TR_RES_DARK);
5866 print_flag(TR_RES_SHARDS);
5867 print_flag(TR_RES_SOUND);
5868 print_flag(TR_RES_NETHER);
5869 print_flag(TR_RES_NEXUS);
5870 print_flag(TR_RES_CHAOS);
5871 print_flag(TR_RES_DISEN);
5875 print_flag(TR_RES_BLIND);
5876 print_flag(TR_RES_FEAR);
5877 print_flag(TR_RES_CONF);
5878 print_flag(TR_FREE_ACT);
5879 print_flag(TR_SEE_INVIS);
5880 print_flag(TR_HOLD_LIFE);
5881 print_flag(TR_TELEPATHY);
5882 print_flag(TR_SLOW_DIGEST);
5883 print_flag(TR_REGEN);
5884 print_flag(TR_LEVITATION);
5892 fprintf(fff, "%s\n", inven_res_label);
5898 * Display *ID* ed weapons/armors's resistances
5900 static void do_cmd_knowledge_inven(void)
5904 char file_name[1024];
5914 /* Open a new file */
5915 fff = my_fopen_temp(file_name, 1024);
5919 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5921 msg_format("Failed to create temporary file %s.", file_name);
5926 fprintf(fff, "%s\n", inven_res_label);
5928 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
5932 for (; j < 9; j++) fputc('\n', fff);
5934 fprintf(fff, "%s\n", inven_res_label);
5938 strcpy(where, "Áõ");
5940 strcpy(where, "E ");
5942 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5944 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5948 strcpy(where, "»ý");
5950 strcpy(where, "I ");
5952 for (i = 0; i < INVEN_PACK; i++)
5954 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5957 st_ptr = &town[1].store[STORE_HOME];
5959 strcpy(where, "²È");
5961 strcpy(where, "H ");
5964 for (i = 0; i < st_ptr->stock_num; i++)
5966 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
5970 /* Close the file */
5973 /* Display the file contents */
5975 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5977 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5980 /* Remove the file */
5985 void do_cmd_save_screen_html_aux(char *filename, int message)
5989 byte a = 0, old_a = 0;
6003 cptr html_head[] = {
6004 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
6008 cptr html_foot[] = {
6010 "</body>\n</html>\n",
6016 Term_get_size(&wid, &hgt);
6018 /* File type is "TEXT" */
6019 FILE_TYPE(FILE_TYPE_TEXT);
6021 /* Append to the file */
6022 fff = my_fopen(filename, "w");
6028 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
6030 msg_format("Failed to open file %s.", filename);
6038 /* Save the screen */
6042 /* Build the filename */
6043 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
6044 tmpfff = my_fopen(buf, "r");
6046 for (i = 0; html_head[i]; i++)
6047 fprintf(fff, html_head[i]);
6051 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6053 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6057 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6059 fprintf(fff, "%s\n", buf);
6064 /* Dump the screen */
6065 for (y = 0; y < hgt; y++)
6072 for (x = 0; x < wid - 1; x++)
6076 /* Get the attr/char */
6077 (void)(Term_what(x, y, &a, &c));
6081 case '&': cc = "&"; break;
6082 case '<': cc = "<"; break;
6083 case '>': cc = ">"; break;
6085 case 0x1f: c = '.'; break;
6086 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6091 if ((y == 0 && x == 0) || a != old_a) {
6092 rv = angband_color_table[a][1];
6093 gv = angband_color_table[a][2];
6094 bv = angband_color_table[a][3];
6095 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6096 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6100 fprintf(fff, "%s", cc);
6102 fprintf(fff, "%c", c);
6105 fprintf(fff, "</font>");
6108 for (i = 0; html_foot[i]; i++)
6109 fprintf(fff, html_foot[i]);
6114 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6116 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6120 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6122 fprintf(fff, "%s\n", buf);
6137 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6139 msg_print("Screen dump saved.");
6144 /* Restore the screen */
6150 * Hack -- save a screen dump to a file
6152 static void do_cmd_save_screen_html(void)
6154 char buf[1024], tmp[256] = "screen.html";
6157 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6159 if (!get_string("File name: ", tmp, 80))
6163 /* Build the filename */
6164 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6168 do_cmd_save_screen_html_aux(buf, 1);
6173 * Redefinable "save_screen" action
6175 void (*screendump_aux)(void) = NULL;
6179 * Hack -- save a screen dump to a file
6181 void do_cmd_save_screen(void)
6183 bool old_use_graphics = use_graphics;
6184 bool html_dump = FALSE;
6189 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6191 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6196 if (c == 'Y' || c == 'y')
6198 else if (c == 'H' || c == 'h')
6210 Term_get_size(&wid, &hgt);
6212 if (old_use_graphics)
6214 use_graphics = FALSE;
6217 /* Redraw everything */
6218 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6220 /* Hack -- update */
6226 do_cmd_save_screen_html();
6230 /* Do we use a special screendump function ? */
6231 else if (screendump_aux)
6233 /* Dump the screen to a graphics file */
6234 (*screendump_aux)();
6236 else /* Dump the screen as text */
6247 /* Build the filename */
6248 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6250 /* File type is "TEXT" */
6251 FILE_TYPE(FILE_TYPE_TEXT);
6253 /* Append to the file */
6254 fff = my_fopen(buf, "w");
6260 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6262 msg_format("Failed to open file %s.", buf);
6269 /* Save the screen */
6273 /* Dump the screen */
6274 for (y = 0; y < hgt; y++)
6277 for (x = 0; x < wid - 1; x++)
6279 /* Get the attr/char */
6280 (void)(Term_what(x, y, &a, &c));
6290 fprintf(fff, "%s\n", buf);
6297 /* Dump the screen */
6298 for (y = 0; y < hgt; y++)
6301 for (x = 0; x < wid - 1; x++)
6303 /* Get the attr/char */
6304 (void)(Term_what(x, y, &a, &c));
6307 buf[x] = hack[a&0x0F];
6314 fprintf(fff, "%s\n", buf);
6326 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6328 msg_print("Screen dump saved.");
6334 /* Restore the screen */
6338 if (old_use_graphics)
6340 use_graphics = TRUE;
6343 /* Redraw everything */
6344 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6346 /* Hack -- update */
6353 * Sorting hook -- Comp function -- see below
6355 * We use "u" to point to array of monster indexes,
6356 * and "v" to select the type of sorting to perform on "u".
6358 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6360 u16b *who = (u16b*)(u);
6362 u16b *why = (u16b*)(v);
6369 /* Sort by total kills */
6372 /* Extract total kills */
6373 z1 = a_info[w1].tval;
6374 z2 = a_info[w2].tval;
6376 /* Compare total kills */
6377 if (z1 < z2) return (TRUE);
6378 if (z1 > z2) return (FALSE);
6382 /* Sort by monster level */
6385 /* Extract levels */
6386 z1 = a_info[w1].sval;
6387 z2 = a_info[w2].sval;
6389 /* Compare levels */
6390 if (z1 < z2) return (TRUE);
6391 if (z1 > z2) return (FALSE);
6395 /* Sort by monster experience */
6398 /* Extract experience */
6399 z1 = a_info[w1].level;
6400 z2 = a_info[w2].level;
6402 /* Compare experience */
6403 if (z1 < z2) return (TRUE);
6404 if (z1 > z2) return (FALSE);
6408 /* Compare indexes */
6414 * Sorting hook -- Swap function -- see below
6416 * We use "u" to point to array of monster indexes,
6417 * and "v" to select the type of sorting to perform.
6419 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6421 u16b *who = (u16b*)(u);
6436 * Check the status of "artifacts"
6438 static void do_cmd_knowledge_artifacts(void)
6440 int i, k, z, x, y, n = 0;
6446 char file_name[1024];
6448 char base_name[MAX_NLEN];
6452 /* Open a new file */
6453 fff = my_fopen_temp(file_name, 1024);
6457 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6459 msg_format("Failed to create temporary file %s.", file_name);
6465 /* Allocate the "who" array */
6466 C_MAKE(who, max_a_idx, s16b);
6468 /* Allocate the "okay" array */
6469 C_MAKE(okay, max_a_idx, bool);
6471 /* Scan the artifacts */
6472 for (k = 0; k < max_a_idx; k++)
6474 artifact_type *a_ptr = &a_info[k];
6479 /* Skip "empty" artifacts */
6480 if (!a_ptr->name) continue;
6482 /* Skip "uncreated" artifacts */
6483 if (!a_ptr->cur_num) continue;
6489 /* Check the dungeon */
6490 for (y = 0; y < cur_hgt; y++)
6492 for (x = 0; x < cur_wid; x++)
6494 cave_type *c_ptr = &cave[y][x];
6496 s16b this_o_idx, next_o_idx = 0;
6498 /* Scan all objects in the grid */
6499 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6503 /* Acquire object */
6504 o_ptr = &o_list[this_o_idx];
6506 /* Acquire next object */
6507 next_o_idx = o_ptr->next_o_idx;
6509 /* Ignore non-artifacts */
6510 if (!object_is_fixed_artifact(o_ptr)) continue;
6512 /* Ignore known items */
6513 if (object_is_known(o_ptr)) continue;
6515 /* Note the artifact */
6516 okay[o_ptr->name1] = FALSE;
6521 /* Check the inventory and equipment */
6522 for (i = 0; i < INVEN_TOTAL; i++)
6524 object_type *o_ptr = &inventory[i];
6526 /* Ignore non-objects */
6527 if (!o_ptr->k_idx) continue;
6529 /* Ignore non-artifacts */
6530 if (!object_is_fixed_artifact(o_ptr)) continue;
6532 /* Ignore known items */
6533 if (object_is_known(o_ptr)) continue;
6535 /* Note the artifact */
6536 okay[o_ptr->name1] = FALSE;
6539 for (k = 0; k < max_a_idx; k++)
6541 if (okay[k]) who[n++] = k;
6544 /* Select the sort method */
6545 ang_sort_comp = ang_sort_art_comp;
6546 ang_sort_swap = ang_sort_art_swap;
6548 /* Sort the array by dungeon depth of monsters */
6549 ang_sort(who, &why, n);
6551 /* Scan the artifacts */
6552 for (k = 0; k < n; k++)
6554 artifact_type *a_ptr = &a_info[who[k]];
6558 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6560 strcpy(base_name, "Unknown Artifact");
6564 /* Obtain the base object type */
6565 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6573 /* Get local object */
6576 /* Create fake object */
6577 object_prep(q_ptr, z);
6579 /* Make it an artifact */
6580 q_ptr->name1 = (byte)who[k];
6582 /* Display as if known */
6583 q_ptr->ident |= IDENT_STORE;
6585 /* Describe the artifact */
6586 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6589 /* Hack -- Build the artifact name */
6591 fprintf(fff, " %s\n", base_name);
6593 fprintf(fff, " The %s\n", base_name);
6598 /* Free the "who" array */
6599 C_KILL(who, max_a_idx, s16b);
6601 /* Free the "okay" array */
6602 C_KILL(okay, max_a_idx, bool);
6604 /* Close the file */
6607 /* Display the file contents */
6609 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6611 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6615 /* Remove the file */
6621 * Display known uniques
6622 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6624 static void do_cmd_knowledge_uniques(void)
6632 char file_name[1024];
6635 int n_alive_surface = 0;
6636 int n_alive_over100 = 0;
6637 int n_alive_total = 0;
6640 for (i = 0; i < 10; i++) n_alive[i] = 0;
6642 /* Open a new file */
6643 fff = my_fopen_temp(file_name, 1024);
6648 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6650 msg_format("Failed to create temporary file %s.", file_name);
6656 /* Allocate the "who" array */
6657 C_MAKE(who, max_r_idx, s16b);
6659 /* Scan the monsters */
6660 for (i = 1; i < max_r_idx; i++)
6662 monster_race *r_ptr = &r_info[i];
6665 if (!r_ptr->name) continue;
6667 /* Require unique monsters */
6668 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6670 /* Only display "known" uniques */
6671 if (!cheat_know && !r_ptr->r_sights) continue;
6673 /* Only print rarity <= 100 uniques */
6674 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6676 /* Only "alive" uniques */
6677 if (r_ptr->max_num == 0) continue;
6681 lev = (r_ptr->level - 1) / 10;
6685 if (max_lev < lev) max_lev = lev;
6687 else n_alive_over100++;
6689 else n_alive_surface++;
6691 /* Collect "appropriate" monsters */
6695 /* Select the sort method */
6696 ang_sort_comp = ang_sort_comp_hook;
6697 ang_sort_swap = ang_sort_swap_hook;
6699 /* Sort the array by dungeon depth of monsters */
6700 ang_sort(who, &why, n);
6702 if (n_alive_surface)
6705 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6707 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6709 n_alive_total += n_alive_surface;
6711 for (i = 0; i <= max_lev; i++)
6714 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6716 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6718 n_alive_total += n_alive[i];
6720 if (n_alive_over100)
6723 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6725 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6727 n_alive_total += n_alive_over100;
6733 fputs("--------- -----------\n", fff);
6734 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6736 fputs("------------- ----------\n", fff);
6737 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6743 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6745 fputs("No known uniques alive.\n", fff);
6749 /* Scan the monster races */
6750 for (k = 0; k < n; k++)
6752 monster_race *r_ptr = &r_info[who[k]];
6754 /* Print a message */
6756 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6758 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6762 /* Free the "who" array */
6763 C_KILL(who, max_r_idx, s16b);
6765 /* Close the file */
6768 /* Display the file contents */
6770 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6772 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6776 /* Remove the file */
6782 * Display weapon-exp
6784 static void do_cmd_knowledge_weapon_exp(void)
6786 int i, j, num, weapon_exp;
6790 char file_name[1024];
6793 /* Open a new file */
6794 fff = my_fopen_temp(file_name, 1024);
6797 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6799 msg_format("Failed to create temporary file %s.", file_name);
6805 for (i = 0; i < 5; i++)
6807 for (num = 0; num < 64; num++)
6809 for (j = 0; j < max_k_idx; j++)
6811 object_kind *k_ptr = &k_info[j];
6813 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6815 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6817 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6819 fprintf(fff, "%-25s ", tmp);
6820 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6821 else fprintf(fff, " ");
6822 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6823 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6831 /* Close the file */
6834 /* Display the file contents */
6836 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6838 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6842 /* Remove the file */
6850 static void do_cmd_knowledge_spell_exp(void)
6852 int i = 0, spell_exp, exp_level;
6857 char file_name[1024];
6859 /* Open a new file */
6860 fff = my_fopen_temp(file_name, 1024);
6863 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6865 msg_format("Failed to create temporary file %s.", file_name);
6871 if (p_ptr->realm1 != REALM_NONE)
6874 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6876 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6878 for (i = 0; i < 32; i++)
6880 if (!is_magic(p_ptr->realm1))
6882 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6886 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6888 if (s_ptr->slevel >= 99) continue;
6889 spell_exp = p_ptr->spell_exp[i];
6890 exp_level = spell_exp_level(spell_exp);
6891 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6892 if (p_ptr->realm1 == REALM_HISSATSU)
6893 fprintf(fff, "[--]");
6896 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6897 else fprintf(fff, " ");
6898 fprintf(fff, "%s", exp_level_str[exp_level]);
6900 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6905 if (p_ptr->realm2 != REALM_NONE)
6908 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6910 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6912 for (i = 0; i < 32; i++)
6914 if (!is_magic(p_ptr->realm1))
6916 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6920 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6922 if (s_ptr->slevel >= 99) continue;
6924 spell_exp = p_ptr->spell_exp[i + 32];
6925 exp_level = spell_exp_level(spell_exp);
6926 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
6927 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6928 else fprintf(fff, " ");
6929 fprintf(fff, "%s", exp_level_str[exp_level]);
6930 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6935 /* Close the file */
6938 /* Display the file contents */
6940 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6942 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6946 /* Remove the file */
6954 static void do_cmd_knowledge_skill_exp(void)
6956 int i = 0, skill_exp;
6960 char file_name[1024];
6962 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6964 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6967 /* Open a new file */
6968 fff = my_fopen_temp(file_name, 1024);
6971 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6973 msg_format("Failed to create temporary file %s.", file_name);
6979 for (i = 0; i < 3; i++)
6981 skill_exp = p_ptr->skill_exp[i];
6982 fprintf(fff, "%-20s ", skill_name[i]);
6983 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6984 else fprintf(fff, " ");
6985 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6986 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6990 /* Close the file */
6993 /* Display the file contents */
6995 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6997 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
7001 /* Remove the file */
7007 * Pluralize a monster name
7009 void plural_aux(char *Name)
7011 int NameLen = strlen(Name);
7013 if (my_strstr(Name, "Disembodied hand"))
7015 strcpy(Name, "Disembodied hands that strangled people");
7017 else if (my_strstr(Name, "Colour out of space"))
7019 strcpy(Name, "Colours out of space");
7021 else if (my_strstr(Name, "stairway to hell"))
7023 strcpy(Name, "stairways to hell");
7025 else if (my_strstr(Name, "Dweller on the threshold"))
7027 strcpy(Name, "Dwellers on the threshold");
7029 else if (my_strstr(Name, " of "))
7031 cptr aider = my_strstr(Name, " of ");
7042 if (dummy[i-1] == 's')
7044 strcpy(&(dummy[i]), "es");
7049 strcpy(&(dummy[i]), "s");
7052 strcpy(&(dummy[i+1]), aider);
7053 strcpy(Name, dummy);
7055 else if (my_strstr(Name, "coins"))
7058 strcpy(dummy, "piles of ");
7059 strcat(dummy, Name);
7060 strcpy(Name, dummy);
7063 else if (my_strstr(Name, "Manes"))
7067 else if (streq(&(Name[NameLen - 2]), "ey"))
7069 strcpy(&(Name[NameLen - 2]), "eys");
7071 else if (Name[NameLen - 1] == 'y')
7073 strcpy(&(Name[NameLen - 1]), "ies");
7075 else if (streq(&(Name[NameLen - 4]), "ouse"))
7077 strcpy(&(Name[NameLen - 4]), "ice");
7079 else if (streq(&(Name[NameLen - 2]), "us"))
7081 strcpy(&(Name[NameLen - 2]), "i");
7083 else if (streq(&(Name[NameLen - 6]), "kelman"))
7085 strcpy(&(Name[NameLen - 6]), "kelmen");
7087 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7089 strcpy(&(Name[NameLen - 8]), "wordsmen");
7091 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7093 strcpy(&(Name[NameLen - 7]), "oodsmen");
7095 else if (streq(&(Name[NameLen - 7]), "eastman"))
7097 strcpy(&(Name[NameLen - 7]), "eastmen");
7099 else if (streq(&(Name[NameLen - 8]), "izardman"))
7101 strcpy(&(Name[NameLen - 8]), "izardmen");
7103 else if (streq(&(Name[NameLen - 5]), "geist"))
7105 strcpy(&(Name[NameLen - 5]), "geister");
7107 else if (streq(&(Name[NameLen - 2]), "ex"))
7109 strcpy(&(Name[NameLen - 2]), "ices");
7111 else if (streq(&(Name[NameLen - 2]), "lf"))
7113 strcpy(&(Name[NameLen - 2]), "lves");
7115 else if (suffix(Name, "ch") ||
7116 suffix(Name, "sh") ||
7117 suffix(Name, "nx") ||
7118 suffix(Name, "s") ||
7121 strcpy(&(Name[NameLen]), "es");
7125 strcpy(&(Name[NameLen]), "s");
7130 * Display current pets
7132 static void do_cmd_knowledge_pets(void)
7136 monster_type *m_ptr;
7139 int show_upkeep = 0;
7140 char file_name[1024];
7143 /* Open a new file */
7144 fff = my_fopen_temp(file_name, 1024);
7147 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7149 msg_format("Failed to create temporary file %s.", file_name);
7155 /* Process the monsters (backwards) */
7156 for (i = m_max - 1; i >= 1; i--)
7158 /* Access the monster */
7161 /* Ignore "dead" monsters */
7162 if (!m_ptr->r_idx) continue;
7164 /* Calculate "upkeep" for pets */
7168 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7169 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7173 show_upkeep = calculate_upkeep();
7175 fprintf(fff, "----------------------------------------------\n");
7177 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7178 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7180 fprintf(fff, " Total: %d pet%s.\n",
7181 t_friends, (t_friends == 1 ? "" : "s"));
7182 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7187 /* Close the file */
7190 /* Display the file contents */
7192 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7194 show_file(TRUE, file_name, "Current Pets", 0, 0);
7198 /* Remove the file */
7206 * Note that the player ghosts are ignored. XXX XXX XXX
7208 static void do_cmd_knowledge_kill_count(void)
7216 char file_name[1024];
7221 /* Open a new file */
7222 fff = my_fopen_temp(file_name, 1024);
7226 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7228 msg_format("Failed to create temporary file %s.", file_name);
7234 /* Allocate the "who" array */
7235 C_MAKE(who, max_r_idx, s16b);
7238 /* Monsters slain */
7241 for (kk = 1; kk < max_r_idx; kk++)
7243 monster_race *r_ptr = &r_info[kk];
7245 if (r_ptr->flags1 & (RF1_UNIQUE))
7247 bool dead = (r_ptr->max_num == 0);
7256 s16b This = r_ptr->r_pkills;
7267 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7269 fprintf(fff,"You have defeated no enemies yet.\n\n");
7273 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7275 fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
7281 /* Scan the monsters */
7282 for (i = 1; i < max_r_idx; i++)
7284 monster_race *r_ptr = &r_info[i];
7286 /* Use that monster */
7287 if (r_ptr->name) who[n++] = i;
7290 /* Select the sort method */
7291 ang_sort_comp = ang_sort_comp_hook;
7292 ang_sort_swap = ang_sort_swap_hook;
7294 /* Sort the array by dungeon depth of monsters */
7295 ang_sort(who, &why, n);
7297 /* Scan the monster races */
7298 for (k = 0; k < n; k++)
7300 monster_race *r_ptr = &r_info[who[k]];
7302 if (r_ptr->flags1 & (RF1_UNIQUE))
7304 bool dead = (r_ptr->max_num == 0);
7308 /* Print a message */
7309 fprintf(fff, " %s\n",
7310 (r_name + r_ptr->name));
7316 s16b This = r_ptr->r_pkills;
7321 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7322 if (my_strchr("pt", r_ptr->d_char))
7323 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7325 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7329 if (my_strstr(r_name + r_ptr->name, "coins"))
7331 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7335 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7341 strcpy(ToPlural, (r_name + r_ptr->name));
7342 plural_aux(ToPlural);
7343 fprintf(fff, " %d %s\n", This, ToPlural);
7353 fprintf(fff,"----------------------------------------------\n");
7355 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
7357 fprintf(fff," Total: %lu creature%s killed.\n",
7358 Total, (Total == 1 ? "" : "s"));
7362 /* Free the "who" array */
7363 C_KILL(who, max_r_idx, s16b);
7365 /* Close the file */
7368 /* Display the file contents */
7370 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7372 show_file(TRUE, file_name, "Kill Count", 0, 0);
7376 /* Remove the file */
7382 * Display the object groups.
7384 static void display_group_list(int col, int row, int wid, int per_page,
7385 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7389 /* Display lines until done */
7390 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7392 /* Get the group index */
7393 int grp = grp_idx[grp_top + i];
7395 /* Choose a color */
7396 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7398 /* Erase the entire line */
7399 Term_erase(col, row + i, wid);
7401 /* Display the group label */
7402 c_put_str(attr, group_text[grp], row + i, col);
7408 * Move the cursor in a browser window
7410 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7411 int *list_cur, int list_cnt)
7416 int list = *list_cur;
7418 /* Extract direction */
7421 /* Hack -- scroll up full screen */
7426 /* Hack -- scroll down full screen */
7431 d = get_keymap_dir(ch);
7436 /* Diagonals - hack */
7437 if ((ddx[d] > 0) && ddy[d])
7443 Term_get_size(&wid, &hgt);
7445 browser_rows = hgt - 8;
7447 /* Browse group list */
7452 /* Move up or down */
7453 grp += ddy[d] * (browser_rows - 1);
7456 if (grp >= grp_cnt) grp = grp_cnt - 1;
7457 if (grp < 0) grp = 0;
7458 if (grp != old_grp) list = 0;
7461 /* Browse sub-list list */
7464 /* Move up or down */
7465 list += ddy[d] * browser_rows;
7468 if (list >= list_cnt) list = list_cnt - 1;
7469 if (list < 0) list = 0;
7481 if (col < 0) col = 0;
7482 if (col > 1) col = 1;
7489 /* Browse group list */
7494 /* Move up or down */
7498 if (grp >= grp_cnt) grp = grp_cnt - 1;
7499 if (grp < 0) grp = 0;
7500 if (grp != old_grp) list = 0;
7503 /* Browse sub-list list */
7506 /* Move up or down */
7510 if (list >= list_cnt) list = list_cnt - 1;
7511 if (list < 0) list = 0;
7522 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7526 /* Clear the display lines */
7527 for (i = 0; i < height; i++)
7529 Term_erase(col, row + i, width);
7532 /* Bigtile mode uses double width */
7533 if (use_bigtile) width /= 2;
7535 /* Display lines until done */
7536 for (i = 0; i < height; i++)
7538 /* Display columns until done */
7539 for (j = 0; j < width; j++)
7547 /* Bigtile mode uses double width */
7548 if (use_bigtile) x += j;
7553 /* Ignore illegal characters */
7554 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7555 (!use_graphics && ic > 0x7f))
7561 /* Force correct code for both ASCII character and tile */
7562 if (c & 0x80) a |= 0x80;
7564 /* Display symbol */
7565 Term_queue_bigchar(x, y, a, c, 0, 0);
7572 * Place the cursor at the collect position for visual mode
7574 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7576 int i = (a & 0x7f) - attr_top;
7577 int j = c - char_left;
7582 /* Bigtile mode uses double width */
7583 if (use_bigtile) x += j;
7585 /* Place the cursor */
7591 * Clipboard variables for copy&paste in visual mode
7593 static byte attr_idx = 0;
7594 static byte char_idx = 0;
7596 /* Hack -- for feature lighting */
7597 static byte attr_idx_feat[F_LIT_MAX];
7598 static byte char_idx_feat[F_LIT_MAX];
7601 * Do visual mode command -- Change symbols
7603 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7604 int height, int width,
7605 byte *attr_top_ptr, byte *char_left_ptr,
7606 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7608 static byte attr_old = 0, char_old = 0;
7613 if (*visual_list_ptr)
7616 *cur_attr_ptr = attr_old;
7617 *cur_char_ptr = char_old;
7618 *visual_list_ptr = FALSE;
7626 if (*visual_list_ptr)
7629 *visual_list_ptr = FALSE;
7630 *need_redraw = TRUE;
7638 if (!*visual_list_ptr)
7640 *visual_list_ptr = TRUE;
7642 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7643 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7645 attr_old = *cur_attr_ptr;
7646 char_old = *cur_char_ptr;
7657 /* Set the visual */
7658 attr_idx = *cur_attr_ptr;
7659 char_idx = *cur_char_ptr;
7661 /* Hack -- for feature lighting */
7662 for (i = 0; i < F_LIT_MAX; i++)
7664 attr_idx_feat[i] = 0;
7665 char_idx_feat[i] = 0;
7672 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7675 *cur_attr_ptr = attr_idx;
7676 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7677 if (!*visual_list_ptr) *need_redraw = TRUE;
7683 *cur_char_ptr = char_idx;
7684 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7685 if (!*visual_list_ptr) *need_redraw = TRUE;
7691 if (*visual_list_ptr)
7694 int d = get_keymap_dir(ch);
7695 byte a = (*cur_attr_ptr & 0x7f);
7696 byte c = *cur_char_ptr;
7698 if (use_bigtile) eff_width = width / 2;
7699 else eff_width = width;
7701 /* Restrict direction */
7702 if ((a == 0) && (ddy[d] < 0)) d = 0;
7703 if ((c == 0) && (ddx[d] < 0)) d = 0;
7704 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7705 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7710 /* Force correct code for both ASCII character and tile */
7711 if (c & 0x80) a |= 0x80;
7713 /* Set the visual */
7718 /* Move the frame */
7719 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7720 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7721 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7722 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7728 /* Visual mode command is not used */
7734 * Display the monsters in a group.
7736 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7737 int mon_cur, int mon_top, bool visual_only)
7741 /* Display lines until done */
7742 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7746 /* Get the race index */
7747 int r_idx = mon_idx[mon_top + i] ;
7749 /* Access the race */
7750 monster_race *r_ptr = &r_info[r_idx];
7752 /* Choose a color */
7753 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7755 /* Display the name */
7756 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7758 /* Hack -- visual_list mode */
7761 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7763 if (p_ptr->wizard || visual_only)
7765 c_prt(attr, format("%d", r_idx), row + i, 62);
7768 /* Erase chars before overwritten by the race letter */
7769 Term_erase(69, row + i, 255);
7771 /* Display symbol */
7772 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7777 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7779 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7781 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7786 /* Clear remaining lines */
7787 for (; i < per_page; i++)
7789 Term_erase(col, row + i, 255);
7795 * Display known monsters.
7797 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7800 int grp_cur, grp_top, old_grp_cur;
7801 int mon_cur, mon_top;
7802 int grp_cnt, grp_idx[100];
7810 bool visual_list = FALSE;
7811 byte attr_top = 0, char_left = 0;
7819 Term_get_size(&wid, &hgt);
7821 browser_rows = hgt - 8;
7823 /* Allocate the "mon_idx" array */
7824 C_MAKE(mon_idx, max_r_idx, s16b);
7829 if (direct_r_idx < 0)
7831 mode = visual_only ? 0x03 : 0x01;
7833 /* Check every group */
7834 for (i = 0; monster_group_text[i] != NULL; i++)
7836 /* Measure the label */
7837 len = strlen(monster_group_text[i]);
7839 /* Save the maximum length */
7840 if (len > max) max = len;
7842 /* See if any monsters are known */
7843 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7845 /* Build a list of groups with known monsters */
7846 grp_idx[grp_cnt++] = i;
7854 mon_idx[0] = direct_r_idx;
7857 /* Terminate the list */
7860 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7861 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7864 /* Terminate the list */
7865 grp_idx[grp_cnt] = -1;
7868 grp_cur = grp_top = 0;
7869 mon_cur = mon_top = 0;
7874 mode = visual_only ? 0x02 : 0x00;
7879 monster_race *r_ptr;
7886 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7887 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7888 prt("̾Á°", 4, max + 3);
7889 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7891 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7893 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7894 if (direct_r_idx < 0) prt("Group", 4, 0);
7895 prt("Name", 4, max + 3);
7896 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7898 if (!visual_only) prt("Kills", 4, 73);
7901 for (i = 0; i < 78; i++)
7903 Term_putch(i, 5, TERM_WHITE, '=');
7906 if (direct_r_idx < 0)
7908 for (i = 0; i < browser_rows; i++)
7910 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7917 if (direct_r_idx < 0)
7919 /* Scroll group list */
7920 if (grp_cur < grp_top) grp_top = grp_cur;
7921 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7923 /* Display a list of monster groups */
7924 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7926 if (old_grp_cur != grp_cur)
7928 old_grp_cur = grp_cur;
7930 /* Get a list of monsters in the current group */
7931 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
7934 /* Scroll monster list */
7935 while (mon_cur < mon_top)
7936 mon_top = MAX(0, mon_top - browser_rows/2);
7937 while (mon_cur >= mon_top + browser_rows)
7938 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7943 /* Display a list of monsters in the current group */
7944 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
7950 /* Display a monster name */
7951 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
7953 /* Display visual list below first monster */
7954 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7959 prt(format("<Êý¸þ>%s%s%s, ESC",
7960 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
7961 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
7962 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
7965 prt(format("<dir>%s%s%s, ESC",
7966 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7967 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7968 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7972 /* Get the current monster */
7973 r_ptr = &r_info[mon_idx[mon_cur]];
7977 /* Mega Hack -- track this monster race */
7978 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7980 /* Hack -- handle stuff */
7986 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7990 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7994 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7999 /* Do visual mode command if needed */
8000 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))
8002 if (direct_r_idx >= 0)
8027 /* Recall on screen */
8028 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
8030 screen_roff(mon_idx[mon_cur], 0);
8041 /* Move the cursor */
8042 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
8049 /* Free the "mon_idx" array */
8050 C_KILL(mon_idx, max_r_idx, s16b);
8055 * Display the objects in a group.
8057 static void display_object_list(int col, int row, int per_page, int object_idx[],
8058 int object_cur, int object_top, bool visual_only)
8062 /* Display lines until done */
8063 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8067 object_kind *flavor_k_ptr;
8069 /* Get the object index */
8070 int k_idx = object_idx[object_top + i];
8072 /* Access the object */
8073 object_kind *k_ptr = &k_info[k_idx];
8075 /* Choose a color */
8076 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8077 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8082 /* Appearance of this object is shuffled */
8083 flavor_k_ptr = &k_info[k_ptr->flavor];
8087 /* Appearance of this object is very normal */
8088 flavor_k_ptr = k_ptr;
8093 attr = ((i + object_top == object_cur) ? cursor : attr);
8095 if (!k_ptr->flavor || k_ptr->aware)
8098 strip_name(o_name, k_idx);
8103 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8106 /* Display the name */
8107 c_prt(attr, o_name, row + i, col);
8109 /* Hack -- visual_list mode */
8112 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);
8114 if (p_ptr->wizard || visual_only)
8116 c_prt(attr, format("%d", k_idx), row + i, 70);
8119 a = flavor_k_ptr->x_attr;
8120 c = flavor_k_ptr->x_char;
8122 /* Display symbol */
8123 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8126 /* Clear remaining lines */
8127 for (; i < per_page; i++)
8129 Term_erase(col, row + i, 255);
8134 * Describe fake object
8136 static void desc_obj_fake(int k_idx)
8139 object_type object_type_body;
8141 /* Get local object */
8142 o_ptr = &object_type_body;
8144 /* Wipe the object */
8147 /* Create the artifact */
8148 object_prep(o_ptr, k_idx);
8150 /* It's fully know */
8151 o_ptr->ident |= IDENT_KNOWN;
8153 /* Track the object */
8154 /* object_actual_track(o_ptr); */
8156 /* Hack - mark as fake */
8157 /* term_obj_real = FALSE; */
8159 /* Hack -- Handle stuff */
8162 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
8165 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8167 msg_print("You see nothing special.");
8176 * Display known objects
8178 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8181 int grp_cur, grp_top, old_grp_cur;
8182 int object_old, object_cur, object_top;
8183 int grp_cnt, grp_idx[100];
8191 bool visual_list = FALSE;
8192 byte attr_top = 0, char_left = 0;
8200 Term_get_size(&wid, &hgt);
8202 browser_rows = hgt - 8;
8204 /* Allocate the "object_idx" array */
8205 C_MAKE(object_idx, max_k_idx, int);
8210 if (direct_k_idx < 0)
8212 mode = visual_only ? 0x03 : 0x01;
8214 /* Check every group */
8215 for (i = 0; object_group_text[i] != NULL; i++)
8217 /* Measure the label */
8218 len = strlen(object_group_text[i]);
8220 /* Save the maximum length */
8221 if (len > max) max = len;
8223 /* See if any monsters are known */
8224 if (collect_objects(i, object_idx, mode))
8226 /* Build a list of groups with known monsters */
8227 grp_idx[grp_cnt++] = i;
8236 object_kind *k_ptr = &k_info[direct_k_idx];
8237 object_kind *flavor_k_ptr;
8241 /* Appearance of this object is shuffled */
8242 flavor_k_ptr = &k_info[k_ptr->flavor];
8246 /* Appearance of this object is very normal */
8247 flavor_k_ptr = k_ptr;
8250 object_idx[0] = direct_k_idx;
8251 object_old = direct_k_idx;
8254 /* Terminate the list */
8257 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8258 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8261 /* Terminate the list */
8262 grp_idx[grp_cnt] = -1;
8265 grp_cur = grp_top = 0;
8266 object_cur = object_top = 0;
8271 mode = visual_only ? 0x02 : 0x00;
8276 object_kind *k_ptr, *flavor_k_ptr;
8283 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8284 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8285 prt("̾Á°", 4, max + 3);
8286 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8289 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8290 if (direct_k_idx < 0) prt("Group", 4, 0);
8291 prt("Name", 4, max + 3);
8292 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8296 for (i = 0; i < 78; i++)
8298 Term_putch(i, 5, TERM_WHITE, '=');
8301 if (direct_k_idx < 0)
8303 for (i = 0; i < browser_rows; i++)
8305 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8312 if (direct_k_idx < 0)
8314 /* Scroll group list */
8315 if (grp_cur < grp_top) grp_top = grp_cur;
8316 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8318 /* Display a list of object groups */
8319 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8321 if (old_grp_cur != grp_cur)
8323 old_grp_cur = grp_cur;
8325 /* Get a list of objects in the current group */
8326 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8329 /* Scroll object list */
8330 while (object_cur < object_top)
8331 object_top = MAX(0, object_top - browser_rows/2);
8332 while (object_cur >= object_top + browser_rows)
8333 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8338 /* Display a list of objects in the current group */
8339 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8343 object_top = object_cur;
8345 /* Display a list of objects in the current group */
8346 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8348 /* Display visual list below first object */
8349 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8352 /* Get the current object */
8353 k_ptr = &k_info[object_idx[object_cur]];
8357 /* Appearance of this object is shuffled */
8358 flavor_k_ptr = &k_info[k_ptr->flavor];
8362 /* Appearance of this object is very normal */
8363 flavor_k_ptr = k_ptr;
8368 prt(format("<Êý¸þ>%s%s%s, ESC",
8369 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8370 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8371 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8374 prt(format("<dir>%s%s%s, ESC",
8375 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8376 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8377 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8383 /* Mega Hack -- track this object */
8384 if (object_cnt) object_kind_track(object_idx[object_cur]);
8386 /* The "current" object changed */
8387 if (object_old != object_idx[object_cur])
8389 /* Hack -- handle stuff */
8392 /* Remember the "current" object */
8393 object_old = object_idx[object_cur];
8399 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8403 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8407 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8412 /* Do visual mode command if needed */
8413 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))
8415 if (direct_k_idx >= 0)
8440 /* Recall on screen */
8441 if (!visual_list && !visual_only && (grp_cnt > 0))
8443 desc_obj_fake(object_idx[object_cur]);
8451 /* Move the cursor */
8452 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8458 /* Free the "object_idx" array */
8459 C_KILL(object_idx, max_k_idx, int);
8464 * Display the features in a group.
8466 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8467 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8469 int lit_col[F_LIT_MAX], i, j;
8470 int f_idx_col = use_bigtile ? 62 : 64;
8472 /* Correct columns 1 and 4 */
8473 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8474 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8475 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8477 /* Display lines until done */
8478 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8483 int f_idx = feat_idx[feat_top + i];
8485 /* Access the index */
8486 feature_type *f_ptr = &f_info[f_idx];
8488 int row_i = row + i;
8490 /* Choose a color */
8491 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8493 /* Display the name */
8494 c_prt(attr, f_name + f_ptr->name, row_i, col);
8496 /* Hack -- visual_list mode */
8499 /* Display lighting level */
8500 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8502 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));
8504 if (p_ptr->wizard || visual_only)
8506 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8509 /* Display symbol */
8510 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);
8512 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8513 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8515 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8517 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8519 /* Mega-hack -- Use non-standard colour */
8520 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8522 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8526 /* Clear remaining lines */
8527 for (; i < per_page; i++)
8529 Term_erase(col, row + i, 255);
8535 * Interact with feature visuals.
8537 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8540 int grp_cur, grp_top, old_grp_cur;
8541 int feat_cur, feat_top;
8542 int grp_cnt, grp_idx[100];
8550 bool visual_list = FALSE;
8551 byte attr_top = 0, char_left = 0;
8556 byte attr_old[F_LIT_MAX];
8557 byte char_old[F_LIT_MAX];
8558 byte *cur_attr_ptr, *cur_char_ptr;
8560 C_WIPE(attr_old, F_LIT_MAX, byte);
8561 C_WIPE(char_old, F_LIT_MAX, byte);
8564 Term_get_size(&wid, &hgt);
8566 browser_rows = hgt - 8;
8568 /* Allocate the "feat_idx" array */
8569 C_MAKE(feat_idx, max_f_idx, int);
8574 if (direct_f_idx < 0)
8576 /* Check every group */
8577 for (i = 0; feature_group_text[i] != NULL; i++)
8579 /* Measure the label */
8580 len = strlen(feature_group_text[i]);
8582 /* Save the maximum length */
8583 if (len > max) max = len;
8585 /* See if any features are known */
8586 if (collect_features(i, feat_idx, 0x01))
8588 /* Build a list of groups with known features */
8589 grp_idx[grp_cnt++] = i;
8597 feature_type *f_ptr = &f_info[direct_f_idx];
8599 feat_idx[0] = direct_f_idx;
8602 /* Terminate the list */
8605 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8606 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8608 for (i = 0; i < F_LIT_MAX; i++)
8610 attr_old[i] = f_ptr->x_attr[i];
8611 char_old[i] = f_ptr->x_char[i];
8615 /* Terminate the list */
8616 grp_idx[grp_cnt] = -1;
8619 grp_cur = grp_top = 0;
8620 feat_cur = feat_top = 0;
8628 feature_type *f_ptr;
8635 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8636 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8637 prt("̾Á°", 4, max + 3);
8640 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8641 prt("ʸ»ú ( l/ d)", 4, 66);
8645 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8646 prt("ʸ»ú (l/d)", 4, 68);
8649 prt("Visuals - features", 2, 0);
8650 if (direct_f_idx < 0) prt("Group", 4, 0);
8651 prt("Name", 4, max + 3);
8654 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8655 prt("Sym ( l/ d)", 4, 67);
8659 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8660 prt("Sym (l/d)", 4, 69);
8664 for (i = 0; i < 78; i++)
8666 Term_putch(i, 5, TERM_WHITE, '=');
8669 if (direct_f_idx < 0)
8671 for (i = 0; i < browser_rows; i++)
8673 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8680 if (direct_f_idx < 0)
8682 /* Scroll group list */
8683 if (grp_cur < grp_top) grp_top = grp_cur;
8684 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8686 /* Display a list of feature groups */
8687 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8689 if (old_grp_cur != grp_cur)
8691 old_grp_cur = grp_cur;
8693 /* Get a list of features in the current group */
8694 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8697 /* Scroll feature list */
8698 while (feat_cur < feat_top)
8699 feat_top = MAX(0, feat_top - browser_rows/2);
8700 while (feat_cur >= feat_top + browser_rows)
8701 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8706 /* Display a list of features in the current group */
8707 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8711 feat_top = feat_cur;
8713 /* Display a list of features in the current group */
8714 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8716 /* Display visual list below first object */
8717 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8722 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8723 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8724 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8727 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8728 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8729 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8733 /* Get the current feature */
8734 f_ptr = &f_info[feat_idx[feat_cur]];
8735 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8736 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8740 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8744 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8748 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8753 if (visual_list && ((ch == 'A') || (ch == 'a')))
8755 int prev_lighting_level = *lighting_level;
8759 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8760 else (*lighting_level)--;
8764 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8765 else (*lighting_level)++;
8768 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8769 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8771 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8772 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8777 else if ((ch == 'D') || (ch == 'd'))
8779 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8780 byte prev_x_char = f_ptr->x_char[*lighting_level];
8782 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8786 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8787 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8789 if (prev_x_char != f_ptr->x_char[*lighting_level])
8790 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8792 else *need_redraw = TRUE;
8797 /* Do visual mode command if needed */
8798 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))
8802 /* Restore previous visual settings */
8804 for (i = 0; i < F_LIT_MAX; i++)
8806 f_ptr->x_attr[i] = attr_old[i];
8807 f_ptr->x_char[i] = char_old[i];
8814 if (direct_f_idx >= 0) flag = TRUE;
8815 else *lighting_level = F_LIT_STANDARD;
8818 /* Preserve current visual settings */
8821 for (i = 0; i < F_LIT_MAX; i++)
8823 attr_old[i] = f_ptr->x_attr[i];
8824 char_old[i] = f_ptr->x_char[i];
8826 *lighting_level = F_LIT_STANDARD;
8833 for (i = 0; i < F_LIT_MAX; i++)
8835 attr_idx_feat[i] = f_ptr->x_attr[i];
8836 char_idx_feat[i] = f_ptr->x_char[i];
8845 /* Allow TERM_DARK text */
8846 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8848 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8849 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8867 /* Move the cursor */
8868 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8874 /* Free the "feat_idx" array */
8875 C_KILL(feat_idx, max_f_idx, int);
8880 * List wanted monsters
8882 static void do_cmd_knowledge_kubi(void)
8887 char file_name[1024];
8890 /* Open a new file */
8891 fff = my_fopen_temp(file_name, 1024);
8894 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8896 msg_format("Failed to create temporary file %s.", file_name);
8904 bool listed = FALSE;
8907 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8909 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8911 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8913 fprintf(fff, "List of wanted monsters\n");
8915 fprintf(fff, "----------------------------------------------\n");
8917 for (i = 0; i < MAX_KUBI; i++)
8919 if (kubi_r_idx[i] <= 10000)
8921 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8930 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
8932 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
8937 /* Close the file */
8940 /* Display the file contents */
8942 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8944 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8948 /* Remove the file */
8953 * List virtues & status
8955 static void do_cmd_knowledge_virtues(void)
8959 char file_name[1024];
8962 /* Open a new file */
8963 fff = my_fopen_temp(file_name, 1024);
8966 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8968 msg_format("Failed to create temporary file %s.", file_name);
8977 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8979 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8984 /* Close the file */
8987 /* Display the file contents */
8989 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8991 show_file(TRUE, file_name, "Virtues", 0, 0);
8995 /* Remove the file */
9003 static void do_cmd_knowledge_dungeon(void)
9007 char file_name[1024];
9011 /* Open a new file */
9012 fff = my_fopen_temp(file_name, 1024);
9015 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9017 msg_format("Failed to create temporary file %s.", file_name);
9025 for (i = 1; i < max_d_idx; i++)
9029 if (!d_info[i].maxdepth) continue;
9030 if (!max_dlv[i]) continue;
9031 if (d_info[i].final_guardian)
9033 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
9035 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
9037 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9039 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9044 /* Close the file */
9047 /* Display the file contents */
9049 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
9051 show_file(TRUE, file_name, "Dungeon", 0, 0);
9055 /* Remove the file */
9060 * List virtues & status
9063 static void do_cmd_knowledge_stat(void)
9067 char file_name[1024];
9070 /* Open a new file */
9071 fff = my_fopen_temp(file_name, 1024);
9074 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9076 msg_format("Failed to create temporary file %s.", file_name);
9084 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9085 (2 * p_ptr->hitdie +
9086 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9089 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9090 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9091 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9093 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9094 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9095 fprintf(fff, "Limits of maximum stats\n\n");
9097 for (v_nr = 0; v_nr < 6; v_nr++)
9099 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);
9100 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9106 /* Close the file */
9109 /* Display the file contents */
9111 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9113 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9117 /* Remove the file */
9123 * Print all active quests
9125 static void do_cmd_knowledge_quests_current(FILE *fff)
9128 char rand_tmp_str[120] = "\0";
9130 monster_race *r_ptr;
9132 int rand_level = 100;
9136 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9138 fprintf(fff, "< Current Quest >\n");
9141 for (i = 1; i < max_quests; i++)
9143 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
9145 /* Set the quest number temporary */
9146 int old_quest = p_ptr->inside_quest;
9149 /* Clear the text */
9150 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9151 quest_text_line = 0;
9153 p_ptr->inside_quest = i;
9155 /* Get the quest text */
9156 init_flags = INIT_SHOW_TEXT;
9158 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9160 /* Reset the old quest number */
9161 p_ptr->inside_quest = old_quest;
9163 /* No info from "silent" quests */
9164 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9168 if (quest[i].type != QUEST_TYPE_RANDOM)
9170 char note[80] = "\0";
9172 if (quest[i].status == QUEST_STATUS_TAKEN)
9174 switch (quest[i].type)
9176 case QUEST_TYPE_KILL_LEVEL:
9177 case QUEST_TYPE_KILL_ANY_LEVEL:
9178 r_ptr = &r_info[quest[i].r_idx];
9179 strcpy(name, r_name + r_ptr->name);
9180 if (quest[i].max_num > 1)
9183 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9184 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9187 sprintf(note," - kill %d %s, have killed %d.",
9188 quest[i].max_num, name, quest[i].cur_num);
9193 sprintf(note," - %s¤òÅݤ¹¡£",name);
9195 sprintf(note," - kill %s.",name);
9199 case QUEST_TYPE_FIND_ARTIFACT:
9200 strcpy(name, a_name + a_info[quest[i].k_idx].name);
9202 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9204 sprintf(note," - Find out %s.", name);
9208 case QUEST_TYPE_FIND_EXIT:
9210 sprintf(note," - õº÷¤¹¤ë¡£");
9212 sprintf(note," - Search.");
9216 case QUEST_TYPE_KILL_NUMBER:
9218 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9219 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9221 sprintf(note," - Kill %d monsters, have killed %d.",
9222 quest[i].max_num, quest[i].cur_num);
9226 case QUEST_TYPE_KILL_ALL:
9228 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9230 sprintf(note," - Kill all monsters.");
9236 /* Print the quest info */
9238 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9239 quest[i].name, quest[i].level, note);
9241 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9242 quest[i].name, quest[i].level, note);
9245 fprintf(fff, tmp_str);
9247 if (quest[i].status == QUEST_STATUS_COMPLETED)
9250 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9252 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9254 fprintf(fff, tmp_str);
9260 while (quest_text[j][0] && j < 10)
9262 fprintf(fff, " %s\n", quest_text[j]);
9267 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9270 rand_level = quest[i].level;
9272 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9274 /* Print the quest info */
9275 r_ptr = &r_info[quest[i].r_idx];
9276 strcpy(name, r_name + r_ptr->name);
9278 if (quest[i].max_num > 1)
9281 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9282 quest[i].name, quest[i].level,
9283 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9287 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9288 quest[i].name, quest[i].level,
9289 quest[i].max_num, name, quest[i].cur_num);
9295 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9296 quest[i].name, quest[i].level, name);
9298 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9299 quest[i].name, quest[i].level, name);
9307 /* Print the current random quest */
9308 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
9311 if (!total) fprintf(fff, " ¤Ê¤·\n");
9313 if (!total) fprintf(fff, " Nothing.\n");
9319 * Print all finished quests
9321 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9328 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9330 fprintf(fff, "< Completed Quest >\n");
9332 for (i = 1; i < max_quests; i++)
9334 int q_idx = quest_num[i];
9336 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9338 if (is_fixed_quest_idx(q_idx))
9340 /* Set the quest number temporary */
9341 int old_quest = p_ptr->inside_quest;
9343 p_ptr->inside_quest = q_idx;
9346 init_flags = INIT_ASSIGN;
9348 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9350 /* Reset the old quest number */
9351 p_ptr->inside_quest = old_quest;
9353 /* No info from "silent" quests */
9354 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9359 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9361 /* Print the quest info */
9363 if (quest[q_idx].complev == 0)
9367 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9369 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9371 r_name+r_info[quest[q_idx].r_idx].name,
9372 quest[q_idx].level);
9378 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9380 " %-40s (Dungeon level: %3d) - level %2d\n",
9382 r_name+r_info[quest[q_idx].r_idx].name,
9384 quest[q_idx].complev);
9389 /* Print the quest info */
9391 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9392 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9394 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9395 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9399 fprintf(fff, tmp_str);
9403 if (!total) fprintf(fff, " ¤Ê¤·\n");
9405 if (!total) fprintf(fff, " Nothing.\n");
9411 * Print all failed quests
9413 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9420 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9422 fprintf(fff, "< Failed Quest >\n");
9424 for (i = 1; i < max_quests; i++)
9426 int q_idx = quest_num[i];
9428 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9430 if (is_fixed_quest_idx(q_idx))
9432 /* Set the quest number temporary */
9433 int old_quest = p_ptr->inside_quest;
9435 p_ptr->inside_quest = q_idx;
9437 /* Get the quest text */
9438 init_flags = INIT_ASSIGN;
9440 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9442 /* Reset the old quest number */
9443 p_ptr->inside_quest = old_quest;
9445 /* No info from "silent" quests */
9446 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9451 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9453 /* Print the quest info */
9455 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9456 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9458 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9459 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9464 /* Print the quest info */
9466 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9467 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9469 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9470 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9473 fprintf(fff, tmp_str);
9477 if (!total) fprintf(fff, " ¤Ê¤·\n");
9479 if (!total) fprintf(fff, " Nothing.\n");
9485 * Print all random quests
9487 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9494 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9496 fprintf(fff, "< Remaining Random Quest >\n");
9498 for (i = 1; i < max_quests; i++)
9500 /* No info from "silent" quests */
9501 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9503 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9507 /* Print the quest info */
9509 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9510 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9512 sprintf(tmp_str, " %s (%d, %s)\n",
9513 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9515 fprintf(fff, tmp_str);
9519 if (!total) fprintf(fff, " ¤Ê¤·\n");
9521 if (!total) fprintf(fff, " Nothing.\n");
9526 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9528 int *q_num = (int *)u;
9529 quest_type *qa = &quest[q_num[a]];
9530 quest_type *qb = &quest[q_num[b]];
9535 if (qa->complev < qb->complev) return TRUE;
9536 if (qa->complev > qb->complev) return FALSE;
9537 if (qa->level <= qb->level) return TRUE;
9541 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9543 int *q_num = (int *)u;
9550 q_num[a] = q_num[b];
9556 * Print quest status of all active quests
9558 static void do_cmd_knowledge_quests(void)
9561 char file_name[1024];
9562 int *quest_num, dummy, i;
9564 /* Open a new file */
9565 fff = my_fopen_temp(file_name, 1024);
9569 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9571 msg_format("Failed to create temporary file %s.", file_name);
9577 /* Allocate Memory */
9578 C_MAKE(quest_num, max_quests, int);
9580 /* Sort by compete level */
9581 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9582 ang_sort_comp = ang_sort_comp_quest_num;
9583 ang_sort_swap = ang_sort_swap_quest_num;
9584 ang_sort(quest_num, &dummy, max_quests);
9586 /* Dump Quest Information */
9587 do_cmd_knowledge_quests_current(fff);
9589 do_cmd_knowledge_quests_completed(fff, quest_num);
9591 do_cmd_knowledge_quests_failed(fff, quest_num);
9595 do_cmd_knowledge_quests_wiz_random(fff);
9598 /* Close the file */
9601 /* Display the file contents */
9603 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9605 show_file(TRUE, file_name, "Quest status", 0, 0);
9608 /* Remove the file */
9612 C_KILL(quest_num, max_quests, int);
9619 static void do_cmd_knowledge_home(void)
9624 char file_name[1024];
9626 char o_name[MAX_NLEN];
9629 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9631 /* Open a new file */
9632 fff = my_fopen_temp(file_name, 1024);
9635 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9637 msg_format("Failed to create temporary file %s.", file_name);
9645 /* Print all homes in the different towns */
9646 st_ptr = &town[1].store[STORE_HOME];
9648 /* Home -- if anything there */
9649 if (st_ptr->stock_num)
9654 /* Header with name of the town */
9656 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9658 fprintf(fff, " [Home Inventory]\n");
9661 /* Dump all available items */
9662 for (i = 0; i < st_ptr->stock_num; i++)
9665 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9666 object_desc(o_name, &st_ptr->stock[i], 0);
9667 if (strlen(o_name) <= 80-3)
9669 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9675 for (n = 0, t = o_name; n < 80-3; n++, t++)
9676 if(iskanji(*t)) {t++; n++;}
9677 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9679 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9680 fprintf(fff, " %.77s\n", o_name+n);
9683 object_desc(o_name, &st_ptr->stock[i], 0);
9684 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9689 /* Add an empty line */
9690 fprintf(fff, "\n\n");
9694 /* Close the file */
9697 /* Display the file contents */
9699 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9701 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9705 /* Remove the file */
9711 * Check the status of "autopick"
9713 static void do_cmd_knowledge_autopick(void)
9717 char file_name[1024];
9719 /* Open a new file */
9720 fff = my_fopen_temp(file_name, 1024);
9725 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9727 msg_format("Failed to create temporary file %s.", file_name);
9736 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9738 fprintf(fff, "No preference for auto picker/destroyer.");
9744 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9746 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9750 for (k = 0; k < max_autopick; k++)
9753 byte act = autopick_list[k].action;
9754 if (act & DONT_AUTOPICK)
9762 else if (act & DO_AUTODESTROY)
9770 else if (act & DO_AUTOPICK)
9778 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9787 if (act & DO_DISPLAY)
9788 fprintf(fff, "%11s", format("[%s]", tmp));
9790 fprintf(fff, "%11s", format("(%s)", tmp));
9792 tmp = autopick_line_from_entry(&autopick_list[k]);
9793 fprintf(fff, " %s", tmp);
9797 /* Close the file */
9799 /* Display the file contents */
9801 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9803 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9806 /* Remove the file */
9812 * Interact with "knowledge"
9814 void do_cmd_knowledge(void)
9817 bool need_redraw = FALSE;
9819 /* File type is "TEXT" */
9820 FILE_TYPE(FILE_TYPE_TEXT);
9822 /* Save the screen */
9825 /* Interact until done */
9831 /* Ask for a choice */
9833 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9834 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9836 prt(format("page %d/2", (p+1)), 2, 65);
9837 prt("Display current knowledge", 3, 0);
9840 /* Give some choices */
9844 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9845 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9846 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9847 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9848 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9849 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9850 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9851 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9852 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9853 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9857 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9858 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9859 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9860 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9861 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9862 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9863 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9864 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9865 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9870 prt("(1) Display known artifacts", 6, 5);
9871 prt("(2) Display known objects", 7, 5);
9872 prt("(3) Display remaining uniques", 8, 5);
9873 prt("(4) Display known monster", 9, 5);
9874 prt("(5) Display kill count", 10, 5);
9875 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9876 prt("(7) Display current pets", 12, 5);
9877 prt("(8) Display home inventory", 13, 5);
9878 prt("(9) Display *identified* equip.", 14, 5);
9879 prt("(0) Display terrain symbols.", 15, 5);
9883 prt("(a) Display about yourself", 6, 5);
9884 prt("(b) Display mutations", 7, 5);
9885 prt("(c) Display weapon proficiency", 8, 5);
9886 prt("(d) Display spell proficiency", 9, 5);
9887 prt("(e) Display misc. proficiency", 10, 5);
9888 prt("(f) Display virtues", 11, 5);
9889 prt("(g) Display dungeons", 12, 5);
9890 prt("(h) Display current quests", 13, 5);
9891 prt("(i) Display auto pick/destroy", 14, 5);
9896 prt("-³¤¯-", 17, 8);
9897 prt("ESC) È´¤±¤ë", 21, 1);
9898 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9899 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9900 prt("¥³¥Þ¥ó¥É:", 20, 0);
9902 prt("-more-", 17, 8);
9903 prt("ESC) Exit menu", 21, 1);
9904 prt("SPACE) Next page", 21, 30);
9905 /*prt("-) Previous page", 21, 60);*/
9906 prt("Command: ", 20, 0);
9913 if (i == ESCAPE) break;
9916 case ' ': /* Page change */
9920 case '1': /* Artifacts */
9921 do_cmd_knowledge_artifacts();
9923 case '2': /* Objects */
9924 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
9926 case '3': /* Uniques */
9927 do_cmd_knowledge_uniques();
9929 case '4': /* Monsters */
9930 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
9932 case '5': /* Kill count */
9933 do_cmd_knowledge_kill_count();
9935 case '6': /* wanted */
9936 if (!vanilla_town) do_cmd_knowledge_kubi();
9938 case '7': /* Pets */
9939 do_cmd_knowledge_pets();
9941 case '8': /* Home */
9942 do_cmd_knowledge_home();
9944 case '9': /* Resist list */
9945 do_cmd_knowledge_inven();
9947 case '0': /* Feature list */
9949 int lighting_level = F_LIT_STANDARD;
9950 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
9954 case 'a': /* Max stat */
9955 do_cmd_knowledge_stat();
9957 case 'b': /* Mutations */
9958 do_cmd_knowledge_mutations();
9960 case 'c': /* weapon-exp */
9961 do_cmd_knowledge_weapon_exp();
9963 case 'd': /* spell-exp */
9964 do_cmd_knowledge_spell_exp();
9966 case 'e': /* skill-exp */
9967 do_cmd_knowledge_skill_exp();
9969 case 'f': /* Virtues */
9970 do_cmd_knowledge_virtues();
9972 case 'g': /* Dungeon */
9973 do_cmd_knowledge_dungeon();
9975 case 'h': /* Quests */
9976 do_cmd_knowledge_quests();
9978 case 'i': /* Autopick */
9979 do_cmd_knowledge_autopick();
9981 default: /* Unknown option */
9985 /* Flush messages */
9989 /* Restore the screen */
9992 if (need_redraw) do_cmd_redraw();
9997 * Check on the status of an active quest
9999 void do_cmd_checkquest(void)
10001 /* File type is "TEXT" */
10002 FILE_TYPE(FILE_TYPE_TEXT);
10004 /* Save the screen */
10008 do_cmd_knowledge_quests();
10010 /* Restore the screen */
10016 * Display the time and date
10018 void do_cmd_time(void)
10020 int day, hour, min, full, start, end, num;
10028 extract_day_hour_min(&day, &hour, &min);
10030 full = hour * 100 + min;
10038 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
10040 strcpy(desc, "It is a strange time.");
10044 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
10045 else strcpy(day_buf, "*****");
10049 msg_format("%sÆüÌÜ, »þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
10050 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10051 min, (hour < 12) ? "AM" : "PM");
10053 msg_format("This is day %s. The time is %d:%02d %s.",
10054 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10055 min, (hour < 12) ? "AM" : "PM");
10059 /* Find the path */
10060 if (!randint0(10) || p_ptr->image)
10063 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10065 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10072 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10074 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10079 /* Open this file */
10080 fff = my_fopen(buf, "rt");
10085 /* Find this time */
10086 while (!my_fgets(fff, buf, sizeof(buf)))
10088 /* Ignore comments */
10089 if (!buf[0] || (buf[0] == '#')) continue;
10091 /* Ignore invalid lines */
10092 if (buf[1] != ':') continue;
10094 /* Process 'Start' */
10097 /* Extract the starting time */
10098 start = atoi(buf + 2);
10100 /* Assume valid for an hour */
10107 /* Process 'End' */
10110 /* Extract the ending time */
10111 end = atoi(buf + 2);
10117 /* Ignore incorrect range */
10118 if ((start > full) || (full > end)) continue;
10120 /* Process 'Description' */
10125 /* Apply the randomizer */
10126 if (!randint0(num)) strcpy(desc, buf + 2);
10136 /* Close the file */