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)
1347 char shower_str[81];
1348 char finder_str[81];
1355 Term_get_size(&wid, &hgt);
1357 /* Number of message lines in a screen */
1358 num_lines = hgt - 4;
1361 strcpy(finder_str, "");
1364 strcpy(shower_str, "");
1366 /* Total messages */
1369 /* Start on first message */
1372 /* Save the screen */
1378 /* Process requests until done */
1384 /* Dump up to 20 lines of messages */
1385 for (j = 0; (j < num_lines) && (i + j < n); j++)
1387 cptr msg = message_str(i+j);
1389 /* Dump the messages, bottom to top */
1390 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1392 /* Hilite "shower" */
1393 if (shower && shower[0])
1397 /* Display matches */
1398 while ((str = my_strstr(str, shower)) != NULL)
1400 int len = strlen(shower);
1402 /* Display the match */
1403 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1411 /* Erase remaining lines */
1412 for (; j < num_lines; j++)
1414 Term_erase(0, num_lines + 1 - j, 255);
1417 /* Display header XXX XXX XXX */
1420 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d)",
1421 i, i + j - 1, n), 0, 0);
1423 prt(format("Message Recall (%d-%d of %d)",
1424 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);
1435 skey = inkey_special(TRUE);
1437 /* Exit on Escape */
1438 if (skey == ESCAPE) break;
1440 /* Hack -- Save the old index */
1445 /* Hack -- handle show */
1449 prt("¶¯Ä´: ", hgt - 1, 0);
1451 prt("Show: ", hgt - 1, 0);
1454 /* Get a "shower" string, or continue */
1455 strcpy(back_str, shower_str);
1456 if (askfor(shower_str, 80))
1459 shower = shower_str[0] ? shower_str : NULL;
1461 else strcpy(shower_str, back_str);
1466 /* Hack -- handle find */
1474 prt("¸¡º÷: ", hgt - 1, 0);
1476 prt("Find: ", hgt - 1, 0);
1479 /* Get a "finder" string, or continue */
1480 strcpy(back_str, finder_str);
1481 if (!askfor(finder_str, 80))
1483 strcpy(finder_str, back_str);
1486 else if (!finder_str[0])
1488 shower = NULL; /* Stop showing */
1493 shower = finder_str;
1496 for (z = i + 1; z < n; z++)
1498 cptr msg = message_str(z);
1501 if (my_strstr(msg, finder_str))
1513 /* Recall 1 older message */
1515 /* Go to the oldest line */
1519 /* Recall 1 newer message */
1521 /* Go to the newest line */
1525 /* Recall 1 older message */
1530 /* Go older if legal */
1531 i = MIN(i + 1, n - num_lines);
1534 /* Recall 10 older messages */
1536 /* Go older if legal */
1537 i = MIN(i + 10, n - num_lines);
1540 /* Recall 20 older messages */
1545 /* Go older if legal */
1546 i = MIN(i + num_lines, n - num_lines);
1549 /* Recall 20 newer messages */
1553 /* Go newer (if able) */
1554 i = MAX(0, i - num_lines);
1557 /* Recall 10 newer messages */
1559 /* Go newer (if able) */
1563 /* Recall 1 newer messages */
1566 /* Go newer (if able) */
1571 /* Hack -- Error of some kind */
1575 /* Restore the screen */
1582 * Number of cheating options
1589 static option_type cheat_info[CHEAT_MAX] =
1591 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1593 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1595 "cheat_peek", "Peek into object creation"
1599 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1601 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1603 "cheat_hear", "Peek into monster creation"
1607 { &cheat_room, FALSE, 255, 0x04, 0x00,
1609 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1611 "cheat_room", "Peek into dungeon creation"
1615 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1617 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1619 "cheat_xtra", "Peek into something else"
1623 { &cheat_know, FALSE, 255, 0x10, 0x00,
1625 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1627 "cheat_know", "Know complete monster info"
1631 { &cheat_live, FALSE, 255, 0x20, 0x00,
1633 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1635 "cheat_live", "Allow player to avoid death"
1639 { &cheat_save, FALSE, 255, 0x40, 0x00,
1641 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1643 "cheat_save", "Ask for saving death"
1649 * Interact with some options for cheating
1651 static void do_cmd_options_cheat(cptr info)
1655 int i, k = 0, n = CHEAT_MAX;
1663 /* Interact with the player */
1668 /* Prompt XXX XXX XXX */
1670 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1672 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1678 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1679 prt(" << Ãí°Õ >>", 11, 0);
1680 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1681 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1682 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1684 /* Display the options */
1685 for (i = 0; i < n; i++)
1687 byte a = TERM_WHITE;
1689 /* Color current option */
1690 if (i == k) a = TERM_L_BLUE;
1692 /* Display the option text */
1693 sprintf(buf, "%-48s: %s (%s)",
1694 cheat_info[i].o_desc,
1696 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1698 (*cheat_info[i].o_var ? "yes" : "no "),
1701 cheat_info[i].o_text);
1702 c_prt(a, buf, i + 2, 0);
1705 /* Hilite current option */
1706 move_cursor(k + 2, 50);
1712 * HACK - Try to translate the key into a direction
1713 * to allow using the roguelike keys for navigation.
1715 dir = get_keymap_dir(ch);
1716 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1730 k = (n + k - 1) % n;
1749 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1751 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1753 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1754 (*cheat_info[k].o_var) = TRUE;
1763 (*cheat_info[k].o_var) = FALSE;
1771 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1773 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1775 /* Peruse the help file */
1776 (void)show_file(TRUE, buf, NULL, 0, 0);
1792 static option_type autosave_info[2] =
1794 { &autosave_l, FALSE, 255, 0x01, 0x00,
1796 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1798 "autosave_l", "Autosave when entering new levels" },
1802 { &autosave_t, FALSE, 255, 0x02, 0x00,
1804 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1806 "autosave_t", "Timed autosave" },
1812 static s16b toggle_frequency(s16b current)
1817 case 50: return 100;
1818 case 100: return 250;
1819 case 250: return 500;
1820 case 500: return 1000;
1821 case 1000: return 2500;
1822 case 2500: return 5000;
1823 case 5000: return 10000;
1824 case 10000: return 25000;
1831 * Interact with some options for cheating
1833 static void do_cmd_options_autosave(cptr info)
1837 int i, k = 0, n = 2;
1845 /* Interact with the player */
1848 /* Prompt XXX XXX XXX */
1850 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1852 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1857 /* Display the options */
1858 for (i = 0; i < n; i++)
1860 byte a = TERM_WHITE;
1862 /* Color current option */
1863 if (i == k) a = TERM_L_BLUE;
1865 /* Display the option text */
1866 sprintf(buf, "%-48s: %s (%s)",
1867 autosave_info[i].o_desc,
1869 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1871 (*autosave_info[i].o_var ? "yes" : "no "),
1874 autosave_info[i].o_text);
1875 c_prt(a, buf, i + 2, 0);
1879 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1881 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1886 /* Hilite current option */
1887 move_cursor(k + 2, 50);
1903 k = (n + k - 1) % n;
1921 (*autosave_info[k].o_var) = TRUE;
1930 (*autosave_info[k].o_var) = FALSE;
1938 autosave_freq = toggle_frequency(autosave_freq);
1940 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1941 autosave_freq), 5, 0);
1943 prt(format("Timed autosave frequency: every %d turns",
1944 autosave_freq), 5, 0);
1952 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1954 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1973 * Interact with some options
1975 void do_cmd_options_aux(int page, cptr info)
1978 int i, k = 0, n = 0, l;
1981 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1982 (!p_ptr->wizard || !allow_debug_opts);
1985 /* Lookup the options */
1986 for (i = 0; i < 24; i++) opt[i] = 0;
1988 /* Scan the options */
1989 for (i = 0; option_info[i].o_desc; i++)
1991 /* Notice options on this "page" */
1992 if (option_info[i].o_page == page) opt[n++] = i;
1999 /* Interact with the player */
2004 /* Prompt XXX XXX XXX */
2006 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
2008 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
2014 /* HACK -- description for easy-auto-destroy options */
2016 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
2018 if (page == OPT_PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
2021 /* Display the options */
2022 for (i = 0; i < n; i++)
2024 byte a = TERM_WHITE;
2026 /* Color current option */
2027 if (i == k) a = TERM_L_BLUE;
2029 /* Display the option text */
2030 sprintf(buf, "%-48s: %s (%.19s)",
2031 option_info[opt[i]].o_desc,
2033 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
2035 (*option_info[opt[i]].o_var ? "yes" : "no "),
2038 option_info[opt[i]].o_text);
2039 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
2040 else c_prt(a, buf, i + 2, 0);
2043 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
2046 /* Hilite current option */
2047 move_cursor(k + 2 + l, 50);
2053 * HACK - Try to translate the key into a direction
2054 * to allow using the roguelike keys for navigation.
2056 dir = get_keymap_dir(ch);
2057 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2071 k = (n + k - 1) % n;
2088 if (browse_only) break;
2089 (*option_info[opt[k]].o_var) = TRUE;
2098 if (browse_only) break;
2099 (*option_info[opt[k]].o_var) = FALSE;
2107 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2114 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2116 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2118 /* Peruse the help file */
2119 (void)show_file(TRUE, buf, NULL, 0, 0);
2136 * Modify the "window" options
2138 static void do_cmd_options_win(void)
2152 /* Memorize old flags */
2153 for (j = 0; j < 8; j++)
2155 /* Acquire current flags */
2156 old_flag[j] = window_flag[j];
2166 /* Prompt XXX XXX XXX */
2168 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2170 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2174 /* Display the windows */
2175 for (j = 0; j < 8; j++)
2177 byte a = TERM_WHITE;
2179 cptr s = angband_term_name[j];
2182 if (j == x) a = TERM_L_BLUE;
2184 /* Window name, staggered, centered */
2185 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2188 /* Display the options */
2189 for (i = 0; i < 16; i++)
2191 byte a = TERM_WHITE;
2193 cptr str = window_flag_desc[i];
2196 if (i == y) a = TERM_L_BLUE;
2200 if (!str) str = "(̤»ÈÍÑ)";
2202 if (!str) str = "(Unused option)";
2207 Term_putstr(0, i + 5, -1, a, str);
2209 /* Display the windows */
2210 for (j = 0; j < 8; j++)
2212 byte a = TERM_WHITE;
2217 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2220 if (window_flag[j] & (1L << i)) c = 'X';
2223 Term_putch(35 + j * 5, i + 5, a, c);
2228 Term_gotoxy(35 + x * 5, y + 5);
2246 for (j = 0; j < 8; j++)
2248 window_flag[j] &= ~(1L << y);
2252 for (i = 0; i < 16; i++)
2254 window_flag[x] &= ~(1L << i);
2267 window_flag[x] |= (1L << y);
2275 window_flag[x] &= ~(1L << y);
2282 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2284 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2294 d = get_keymap_dir(ch);
2296 x = (x + ddx[d] + 8) % 8;
2297 y = (y + ddy[d] + 16) % 16;
2304 /* Notice changes */
2305 for (j = 0; j < 8; j++)
2310 if (!angband_term[j]) continue;
2312 /* Ignore non-changes */
2313 if (window_flag[j] == old_flag[j]) continue;
2316 Term_activate(angband_term[j]);
2333 * Set or unset various options.
2335 * The user must use the "Ctrl-R" command to "adapt" to changes
2336 * in any options which control "visual" aspects of the game.
2338 void do_cmd_options(void)
2343 /* Save the screen */
2352 /* Why are we here */
2354 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 1, 0);
2356 prt("Options", 1, 0);
2360 /* Give some choices */
2362 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 2, 5);
2363 prt("(2) ¥Þ¥Ã¥×²èÌÌ ¥ª¥×¥·¥ç¥ó", 3, 5);
2364 prt("(3) ¥Æ¥¥¹¥Èɽ¼¨ ¥ª¥×¥·¥ç¥ó", 4, 5);
2365 prt("(4) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 5, 5);
2366 prt("(5) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 6, 5);
2367 prt("(6) ´Ê°×¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 7, 5);
2368 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 8, 5);
2370 /* Special choices */
2371 prt("(P) ¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿", 10, 5);
2372 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
2373 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
2374 prt("(M) ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
2375 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2377 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2379 prt("(1) Input Options", 2, 5);
2380 prt("(2) Map Screen Options", 3, 5);
2381 prt("(3) Text Display Options", 4, 5);
2382 prt("(4) Game-Play Options", 5, 5);
2383 prt("(5) Disturbance Options", 6, 5);
2384 prt("(6) Easy Auto-Destroyer Options", 7, 5);
2385 prt("(R) Play-record Options", 8, 5);
2386 /* Special choices */
2387 prt("(P) Auto-picker/destroyer editor", 10, 5);
2388 prt("(D) Base Delay Factor", 11, 5);
2389 prt("(H) Hitpoint Warning", 12, 5);
2390 prt("(M) Mana Color Threshold", 13, 5);
2391 prt("(A) Autosave Options", 14, 5);
2393 prt("(W) Window Flags", 15, 5);
2396 if (!p_ptr->wizard || !allow_debug_opts)
2400 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
2402 prt("(B) Birth Options (Browse Only)", 16, 5);
2409 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó", 16, 5);
2411 prt("(B) Birth Options", 16, 5);
2416 if (p_ptr->noscore || allow_debug_opts)
2420 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 17, 5);
2422 prt("(C) Cheating Options", 17, 5);
2429 prt("¥³¥Þ¥ó¥É:", 19, 0);
2431 prt("Command: ", 19, 0);
2439 if (k == ESCAPE) break;
2446 /* Process the general options */
2448 do_cmd_options_aux(OPT_PAGE_INPUT, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2450 do_cmd_options_aux(OPT_PAGE_INPUT, "Input Options");
2458 /* Process the general options */
2460 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "¥Þ¥Ã¥×²èÌÌ¥ª¥×¥·¥ç¥ó");
2462 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, "Map Screen Options");
2472 do_cmd_options_aux(OPT_PAGE_TEXT, "¥Æ¥¥¹¥Èɽ¼¨¥ª¥×¥·¥ç¥ó");
2474 do_cmd_options_aux(OPT_PAGE_TEXT, "Text Display Options");
2484 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2486 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, "Game-Play Options");
2496 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2498 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, "Disturbance Options");
2508 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "´Ê°×¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2510 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, "Easy Auto-Destroyer Options");
2515 /* Play-record Options */
2521 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2523 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, "Play-record Options");
2534 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2536 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2542 /* Cheating Options */
2545 if (!p_ptr->noscore && !allow_debug_opts)
2547 /* Cheat options are not permitted */
2554 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2556 do_cmd_options_cheat("Cheaters never win");
2566 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2568 do_cmd_options_autosave("Autosave");
2579 do_cmd_options_win();
2580 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2581 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2582 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2583 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2587 /* Auto-picker/destroyer editor */
2591 do_cmd_edit_autopick();
2595 /* Hack -- Delay Speed */
2601 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2603 prt("Command: Base Delay Factor", 19, 0);
2607 /* Get a new value */
2610 int msec = delay_factor * delay_factor * delay_factor;
2612 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2613 delay_factor, msec), 22, 0);
2615 prt(format("Current base delay factor: %d (%d msec)",
2616 delay_factor, msec), 22, 0);
2620 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2622 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2626 if (k == ESCAPE) break;
2630 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2632 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2636 else if (isdigit(k)) delay_factor = D2I(k);
2643 /* Hack -- hitpoint warning factor */
2649 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2651 prt("Command: Hitpoint Warning", 19, 0);
2655 /* Get a new value */
2659 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2660 hitpoint_warn), 22, 0);
2662 prt(format("Current hitpoint warning: %d0%%",
2663 hitpoint_warn), 22, 0);
2667 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2669 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2673 if (k == ESCAPE) break;
2677 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2679 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2683 else if (isdigit(k)) hitpoint_warn = D2I(k);
2690 /* Hack -- mana color factor */
2696 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2698 prt("Command: Mana Color Threshold", 19, 0);
2702 /* Get a new value */
2706 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2709 prt(format("Current mana color threshold: %d0%%",
2714 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2716 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2720 if (k == ESCAPE) break;
2724 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2726 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2730 else if (isdigit(k)) mana_warn = D2I(k);
2739 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2741 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2746 /* Unknown option */
2755 /* Flush messages */
2760 /* Restore the screen */
2763 /* Hack - Redraw equippy chars */
2764 p_ptr->redraw |= (PR_EQUIPPY);
2770 * Ask for a "user pref line" and process it
2772 * XXX XXX XXX Allow absolute file names?
2774 void do_cmd_pref(void)
2781 /* Ask for a "user pref command" */
2783 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2785 if (!get_string("Pref: ", buf, 80)) return;
2789 /* Process that pref command */
2790 (void)process_pref_file_command(buf);
2793 void do_cmd_reload_autopick(void)
2796 if (!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2798 if (!get_check("Reload auto-pick preference file? ")) return;
2801 /* Load the file with messages */
2802 autopick_load_pref(TRUE);
2808 * Hack -- append all current macros to the given file
2810 static errr macro_dump(cptr fname)
2812 static cptr mark = "Macro Dump";
2818 /* Build the filename */
2819 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2821 /* File type is "TEXT" */
2822 FILE_TYPE(FILE_TYPE_TEXT);
2824 /* Append to the file */
2825 if (!open_auto_dump(buf, mark)) return (-1);
2829 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2831 auto_dump_printf("\n# Automatic macro dump\n\n");
2835 for (i = 0; i < macro__num; i++)
2837 /* Extract the action */
2838 ascii_to_text(buf, macro__act[i]);
2840 /* Dump the macro */
2841 auto_dump_printf("A:%s\n", buf);
2843 /* Extract the action */
2844 ascii_to_text(buf, macro__pat[i]);
2846 /* Dump normal macros */
2847 auto_dump_printf("P:%s\n", buf);
2850 auto_dump_printf("\n");
2862 * Hack -- ask for a "trigger" (see below)
2864 * Note the complex use of the "inkey()" function from "util.c".
2866 * Note that both "flush()" calls are extremely important.
2868 static void do_cmd_macro_aux(char *buf)
2878 /* Do not process macros */
2884 /* Read the pattern */
2890 /* Do not process macros */
2893 /* Do not wait for keys */
2896 /* Attempt to read a key */
2907 /* Convert the trigger */
2908 ascii_to_text(tmp, buf);
2910 /* Hack -- display the trigger */
2911 Term_addstr(-1, TERM_WHITE, tmp);
2918 * Hack -- ask for a keymap "trigger" (see below)
2920 * Note that both "flush()" calls are extremely important. This may
2921 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2923 static void do_cmd_macro_aux_keymap(char *buf)
2937 /* Convert to ascii */
2938 ascii_to_text(tmp, buf);
2940 /* Hack -- display the trigger */
2941 Term_addstr(-1, TERM_WHITE, tmp);
2950 * Hack -- append all keymaps to the given file
2952 static errr keymap_dump(cptr fname)
2954 static cptr mark = "Keymap Dump";
2963 if (rogue_like_commands)
2965 mode = KEYMAP_MODE_ROGUE;
2971 mode = KEYMAP_MODE_ORIG;
2975 /* Build the filename */
2976 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2978 /* File type is "TEXT" */
2979 FILE_TYPE(FILE_TYPE_TEXT);
2981 /* Append to the file */
2982 if (!open_auto_dump(buf, mark)) return -1;
2986 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2988 auto_dump_printf("\n# Automatic keymap dump\n\n");
2992 for (i = 0; i < 256; i++)
2996 /* Loop up the keymap */
2997 act = keymap_act[mode][i];
2999 /* Skip empty keymaps */
3002 /* Encode the key */
3005 ascii_to_text(key, buf);
3007 /* Encode the action */
3008 ascii_to_text(buf, act);
3010 /* Dump the macro */
3011 auto_dump_printf("A:%s\n", buf);
3012 auto_dump_printf("C:%d:%s\n", mode, key);
3025 * Interact with "macros"
3027 * Note that the macro "action" must be defined before the trigger.
3029 * Could use some helpful instructions on this page. XXX XXX XXX
3031 void do_cmd_macros(void)
3043 if (rogue_like_commands)
3045 mode = KEYMAP_MODE_ROGUE;
3051 mode = KEYMAP_MODE_ORIG;
3054 /* File type is "TEXT" */
3055 FILE_TYPE(FILE_TYPE_TEXT);
3062 /* Process requests until done */
3070 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3072 prt("Interact with Macros", 2, 0);
3077 /* Describe that action */
3079 prt("¥Þ¥¯¥í¹ÔÆ°¤¬(¤â¤·¤¢¤ì¤Ð)²¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹:", 20, 0);
3081 prt("Current action (if any) shown below:", 20, 0);
3085 /* Analyze the current action */
3086 ascii_to_text(buf, macro__buf);
3088 /* Display the current action */
3094 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3096 prt("(1) Load a user pref file", 4, 5);
3101 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3102 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3103 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3104 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3105 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3106 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3107 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3108 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3109 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3111 prt("(2) Append macros to a file", 5, 5);
3112 prt("(3) Query a macro", 6, 5);
3113 prt("(4) Create a macro", 7, 5);
3114 prt("(5) Remove a macro", 8, 5);
3115 prt("(6) Append keymaps to a file", 9, 5);
3116 prt("(7) Query a keymap", 10, 5);
3117 prt("(8) Create a keymap", 11, 5);
3118 prt("(9) Remove a keymap", 12, 5);
3119 prt("(0) Enter a new action", 13, 5);
3122 #endif /* ALLOW_MACROS */
3126 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3128 prt("Command: ", 16, 0);
3136 if (i == ESCAPE) break;
3138 /* Load a 'macro' file */
3145 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3147 prt("Command: Load a user pref file", 16, 0);
3153 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3155 prt("File: ", 18, 0);
3159 /* Default filename */
3160 sprintf(tmp, "%s.prf", player_base);
3162 /* Ask for a file */
3163 if (!askfor(tmp, 80)) continue;
3165 /* Process the given filename */
3166 err = process_pref_file(tmp);
3170 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3172 msg_format("Loaded default '%s'.", tmp);
3179 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3181 msg_format("Failed to load '%s'!");
3187 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3189 msg_format("Loaded '%s'.", tmp);
3201 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3203 prt("Command: Append macros to a file", 16, 0);
3209 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3211 prt("File: ", 18, 0);
3215 /* Default filename */
3216 sprintf(tmp, "%s.prf", player_base);
3218 /* Ask for a file */
3219 if (!askfor(tmp, 80)) continue;
3221 /* Dump the macros */
3222 (void)macro_dump(tmp);
3226 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3228 msg_print("Appended macros.");
3240 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3242 prt("Command: Query a macro", 16, 0);
3248 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3250 prt("Trigger: ", 18, 0);
3254 /* Get a macro trigger */
3255 do_cmd_macro_aux(buf);
3257 /* Acquire action */
3258 k = macro_find_exact(buf);
3265 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3267 msg_print("Found no macro.");
3275 /* Obtain the action */
3276 strcpy(macro__buf, macro__act[k]);
3278 /* Analyze the current action */
3279 ascii_to_text(buf, macro__buf);
3281 /* Display the current action */
3286 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3288 msg_print("Found a macro.");
3294 /* Create a macro */
3299 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3301 prt("Command: Create a macro", 16, 0);
3307 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3309 prt("Trigger: ", 18, 0);
3313 /* Get a macro trigger */
3314 do_cmd_macro_aux(buf);
3321 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3323 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3328 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3330 prt("Action: ", 20, 0);
3334 /* Convert to text */
3335 ascii_to_text(tmp, macro__buf);
3337 /* Get an encoded action */
3338 if (askfor(tmp, 80))
3340 /* Convert to ascii */
3341 text_to_ascii(macro__buf, tmp);
3343 /* Link the macro */
3344 macro_add(buf, macro__buf);
3348 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3350 msg_print("Added a macro.");
3356 /* Remove a macro */
3361 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3363 prt("Command: Remove a macro", 16, 0);
3369 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3371 prt("Trigger: ", 18, 0);
3375 /* Get a macro trigger */
3376 do_cmd_macro_aux(buf);
3378 /* Link the macro */
3379 macro_add(buf, buf);
3383 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3385 msg_print("Removed a macro.");
3395 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3397 prt("Command: Append keymaps to a file", 16, 0);
3403 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3405 prt("File: ", 18, 0);
3409 /* Default filename */
3410 sprintf(tmp, "%s.prf", player_base);
3412 /* Ask for a file */
3413 if (!askfor(tmp, 80)) continue;
3415 /* Dump the macros */
3416 (void)keymap_dump(tmp);
3420 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3422 msg_print("Appended keymaps.");
3427 /* Query a keymap */
3434 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3436 prt("Command: Query a keymap", 16, 0);
3442 prt("²¡¤¹¥¡¼: ", 18, 0);
3444 prt("Keypress: ", 18, 0);
3448 /* Get a keymap trigger */
3449 do_cmd_macro_aux_keymap(buf);
3451 /* Look up the keymap */
3452 act = keymap_act[mode][(byte)(buf[0])];
3459 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3461 msg_print("Found no keymap.");
3469 /* Obtain the action */
3470 strcpy(macro__buf, act);
3472 /* Analyze the current action */
3473 ascii_to_text(buf, macro__buf);
3475 /* Display the current action */
3480 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3482 msg_print("Found a keymap.");
3488 /* Create a keymap */
3493 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3495 prt("Command: Create a keymap", 16, 0);
3501 prt("²¡¤¹¥¡¼: ", 18, 0);
3503 prt("Keypress: ", 18, 0);
3507 /* Get a keymap trigger */
3508 do_cmd_macro_aux_keymap(buf);
3515 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3517 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3522 prt("¹ÔÆ°: ", 20, 0);
3524 prt("Action: ", 20, 0);
3528 /* Convert to text */
3529 ascii_to_text(tmp, macro__buf);
3531 /* Get an encoded action */
3532 if (askfor(tmp, 80))
3534 /* Convert to ascii */
3535 text_to_ascii(macro__buf, tmp);
3537 /* Free old keymap */
3538 string_free(keymap_act[mode][(byte)(buf[0])]);
3540 /* Make new keymap */
3541 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3545 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3547 msg_print("Added a keymap.");
3553 /* Remove a keymap */
3558 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3560 prt("Command: Remove a keymap", 16, 0);
3566 prt("²¡¤¹¥¡¼: ", 18, 0);
3568 prt("Keypress: ", 18, 0);
3572 /* Get a keymap trigger */
3573 do_cmd_macro_aux_keymap(buf);
3575 /* Free old keymap */
3576 string_free(keymap_act[mode][(byte)(buf[0])]);
3578 /* Make new keymap */
3579 keymap_act[mode][(byte)(buf[0])] = NULL;
3583 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3585 msg_print("Removed a keymap.");
3590 /* Enter a new action */
3595 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3597 prt("Command: Enter a new action", 16, 0);
3605 c_prt(TERM_L_RED, "¥«¡¼¥½¥ë¥¡¼¤Îº¸±¦¤Ç¥«¡¼¥½¥ë°ÌÃÖ¤ò°ÜÆ°¡£Backspace¤«Delete¤Ç°ìʸ»úºï½ü¡£", 22, 0);
3607 c_prt(TERM_L_RED, "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char.", 22, 0);
3612 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3614 prt("Action: ", 20, 0);
3617 /* Hack -- limit the value */
3620 /* Get an encoded action */
3621 if (!askfor(buf, 80)) continue;
3623 /* Extract an action */
3624 text_to_ascii(macro__buf, buf);
3627 #endif /* ALLOW_MACROS */
3636 /* Flush messages */
3645 static cptr lighting_level_str[F_LIT_MAX] =
3659 static bool cmd_visuals_aux(int i, int *num, int max)
3666 sprintf(str, "%d", *num);
3668 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3671 tmp = strtol(str, NULL, 0);
3672 if (tmp >= 0 && tmp < max)
3675 else if (isupper(i))
3676 *num = (*num + max - 1) % max;
3678 *num = (*num + 1) % max;
3683 static void print_visuals_menu(cptr choice_msg)
3686 prt("[ ²èÌÌɽ¼¨¤ÎÀßÄê ]", 1, 0);
3688 prt("Interact with Visuals", 1, 0);
3691 /* Give some choices */
3693 prt("(0) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 3, 5);
3695 prt("(0) Load a user pref file", 3, 5);
3698 #ifdef ALLOW_VISUALS
3700 prt("(1) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 4, 5);
3701 prt("(2) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3702 prt("(3) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3703 prt("(4) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 7, 5);
3704 prt("(5) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 8, 5);
3705 prt("(6) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¿ôÃÍÁàºî)", 9, 5);
3706 prt("(7) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 10, 5);
3707 prt("(8) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 11, 5);
3708 prt("(9) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë (¥·¥ó¥Ü¥ë¥¨¥Ç¥£¥¿)", 12, 5);
3710 prt("(1) Dump monster attr/chars", 4, 5);
3711 prt("(2) Dump object attr/chars", 5, 5);
3712 prt("(3) Dump feature attr/chars", 6, 5);
3713 prt("(4) Change monster attr/chars (numeric operation)", 7, 5);
3714 prt("(5) Change object attr/chars (numeric operation)", 8, 5);
3715 prt("(6) Change feature attr/chars (numeric operation)", 9, 5);
3716 prt("(7) Change monster attr/chars (visual mode)", 10, 5);
3717 prt("(8) Change object attr/chars (visual mode)", 11, 5);
3718 prt("(9) Change feature attr/chars (visual mode)", 12, 5);
3721 #endif /* ALLOW_VISUALS */
3724 prt("(R) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3726 prt("(R) Reset visuals", 13, 5);
3731 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg ? choice_msg : ""), 15, 0);
3733 prt(format("Command: %s", choice_msg ? choice_msg : ""), 15, 0);
3737 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3738 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3739 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3742 * Interact with "visuals"
3744 void do_cmd_visuals(void)
3749 bool need_redraw = FALSE;
3750 const char *empty_symbol = "<< ? >>";
3752 if (use_bigtile) empty_symbol = "<< ?? >>";
3754 /* File type is "TEXT" */
3755 FILE_TYPE(FILE_TYPE_TEXT);
3757 /* Save the screen */
3760 /* Interact until done */
3766 /* Ask for a choice */
3767 print_visuals_menu(NULL);
3773 if (i == ESCAPE) break;
3777 /* Load a 'pref' file */
3781 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3783 prt("Command: Load a user pref file", 15, 0);
3788 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3790 prt("File: ", 17, 0);
3793 /* Default filename */
3794 sprintf(tmp, "%s.prf", player_base);
3797 if (!askfor(tmp, 70)) continue;
3799 /* Process the given filename */
3800 (void)process_pref_file(tmp);
3805 #ifdef ALLOW_VISUALS
3807 /* Dump monster attr/chars */
3810 static cptr mark = "Monster attr/chars";
3814 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3816 prt("Command: Dump monster attr/chars", 15, 0);
3821 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3823 prt("File: ", 17, 0);
3826 /* Default filename */
3827 sprintf(tmp, "%s.prf", player_base);
3829 /* Get a filename */
3830 if (!askfor(tmp, 70)) continue;
3832 /* Build the filename */
3833 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3835 /* Append to the file */
3836 if (!open_auto_dump(buf, mark)) continue;
3840 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3842 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3846 for (i = 0; i < max_r_idx; i++)
3848 monster_race *r_ptr = &r_info[i];
3850 /* Skip non-entries */
3851 if (!r_ptr->name) continue;
3853 /* Dump a comment */
3854 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3856 /* Dump the monster attr/char info */
3857 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3858 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3866 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3868 msg_print("Dumped monster attr/chars.");
3874 /* Dump object attr/chars */
3877 static cptr mark = "Object attr/chars";
3881 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3883 prt("Command: Dump object attr/chars", 15, 0);
3888 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3890 prt("File: ", 17, 0);
3893 /* Default filename */
3894 sprintf(tmp, "%s.prf", player_base);
3896 /* Get a filename */
3897 if (!askfor(tmp, 70)) continue;
3899 /* Build the filename */
3900 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3902 /* Append to the file */
3903 if (!open_auto_dump(buf, mark)) continue;
3907 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3909 auto_dump_printf("\n# Object attr/char definitions\n\n");
3913 for (i = 0; i < max_k_idx; i++)
3916 object_kind *k_ptr = &k_info[i];
3918 /* Skip non-entries */
3919 if (!k_ptr->name) continue;
3924 strip_name(o_name, i);
3930 /* Prepare dummy object */
3931 object_prep(&forge, i);
3933 /* Get un-shuffled flavor name */
3934 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3937 /* Dump a comment */
3938 auto_dump_printf("# %s\n", o_name);
3940 /* Dump the object attr/char info */
3941 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3942 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3950 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3952 msg_print("Dumped object attr/chars.");
3958 /* Dump feature attr/chars */
3961 static cptr mark = "Feature attr/chars";
3965 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3967 prt("Command: Dump feature attr/chars", 15, 0);
3972 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3974 prt("File: ", 17, 0);
3977 /* Default filename */
3978 sprintf(tmp, "%s.prf", player_base);
3980 /* Get a filename */
3981 if (!askfor(tmp, 70)) continue;
3983 /* Build the filename */
3984 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3986 /* Append to the file */
3987 if (!open_auto_dump(buf, mark)) continue;
3991 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3993 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3997 for (i = 0; i < max_f_idx; i++)
3999 feature_type *f_ptr = &f_info[i];
4001 /* Skip non-entries */
4002 if (!f_ptr->name) continue;
4004 /* Skip mimiccing features */
4005 if (f_ptr->mimic != i) continue;
4007 /* Dump a comment */
4008 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
4010 /* Dump the feature attr/char info */
4011 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
4012 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
4013 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
4014 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
4022 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4024 msg_print("Dumped feature attr/chars.");
4030 /* Modify monster attr/chars (numeric operation) */
4034 static cptr choice_msg = "¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4036 static cptr choice_msg = "Change monster attr/chars";
4041 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4043 prt(format("Command: %s", choice_msg), 15, 0);
4046 /* Hack -- query until done */
4049 monster_race *r_ptr = &r_info[r];
4053 byte da = r_ptr->d_attr;
4054 byte dc = r_ptr->d_char;
4055 byte ca = r_ptr->x_attr;
4056 byte cc = r_ptr->x_char;
4058 /* Label the object */
4060 Term_putstr(5, 17, -1, TERM_WHITE,
4061 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
4062 r, (r_name + r_ptr->name)));
4064 Term_putstr(5, 17, -1, TERM_WHITE,
4065 format("Monster = %d, Name = %-40.40s",
4066 r, (r_name + r_ptr->name)));
4069 /* Label the Default values */
4071 Term_putstr(10, 19, -1, TERM_WHITE,
4072 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
4074 Term_putstr(10, 19, -1, TERM_WHITE,
4075 format("Default attr/char = %3u / %3u", da, dc));
4078 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4079 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4081 /* Label the Current values */
4083 Term_putstr(10, 20, -1, TERM_WHITE,
4084 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4086 Term_putstr(10, 20, -1, TERM_WHITE,
4087 format("Current attr/char = %3u / %3u", ca, cc));
4090 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4091 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4095 Term_putstr(0, 22, -1, TERM_WHITE,
4096 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4098 Term_putstr(0, 22, -1, TERM_WHITE,
4099 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4106 if (i == ESCAPE) break;
4108 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4109 else if (isupper(i)) c = 'a' + i - 'A';
4119 if (!cmd_visuals_aux(i, &r, max_r_idx))
4125 while (!r_info[r].name);
4129 t = (int)r_ptr->x_attr;
4130 (void)cmd_visuals_aux(i, &t, 256);
4131 r_ptr->x_attr = (byte)t;
4135 t = (int)r_ptr->x_char;
4136 (void)cmd_visuals_aux(i, &t, 256);
4137 r_ptr->x_char = (byte)t;
4141 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
4145 print_visuals_menu(choice_msg);
4153 /* Modify object attr/chars (numeric operation) */
4157 static cptr choice_msg = "¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4159 static cptr choice_msg = "Change object attr/chars";
4164 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4166 prt(format("Command: %s", choice_msg), 15, 0);
4169 /* Hack -- query until done */
4172 object_kind *k_ptr = &k_info[k];
4176 byte da = k_ptr->d_attr;
4177 byte dc = k_ptr->d_char;
4178 byte ca = k_ptr->x_attr;
4179 byte cc = k_ptr->x_char;
4181 /* Label the object */
4183 Term_putstr(5, 17, -1, TERM_WHITE,
4184 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4185 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4187 Term_putstr(5, 17, -1, TERM_WHITE,
4188 format("Object = %d, Name = %-40.40s",
4189 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
4192 /* Label the Default values */
4194 Term_putstr(10, 19, -1, TERM_WHITE,
4195 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4197 Term_putstr(10, 19, -1, TERM_WHITE,
4198 format("Default attr/char = %3d / %3d", da, dc));
4201 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4202 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4204 /* Label the Current values */
4206 Term_putstr(10, 20, -1, TERM_WHITE,
4207 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4209 Term_putstr(10, 20, -1, TERM_WHITE,
4210 format("Current attr/char = %3d / %3d", ca, cc));
4213 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4214 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4218 Term_putstr(0, 22, -1, TERM_WHITE,
4219 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4221 Term_putstr(0, 22, -1, TERM_WHITE,
4222 "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ");
4229 if (i == ESCAPE) break;
4231 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4232 else if (isupper(i)) c = 'a' + i - 'A';
4242 if (!cmd_visuals_aux(i, &k, max_k_idx))
4248 while (!k_info[k].name);
4252 t = (int)k_ptr->x_attr;
4253 (void)cmd_visuals_aux(i, &t, 256);
4254 k_ptr->x_attr = (byte)t;
4258 t = (int)k_ptr->x_char;
4259 (void)cmd_visuals_aux(i, &t, 256);
4260 k_ptr->x_char = (byte)t;
4264 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
4268 print_visuals_menu(choice_msg);
4276 /* Modify feature attr/chars (numeric operation) */
4280 static cptr choice_msg = "ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹";
4282 static cptr choice_msg = "Change feature attr/chars";
4285 static int lighting_level = F_LIT_STANDARD;
4288 prt(format("¥³¥Þ¥ó¥É: %s", choice_msg), 15, 0);
4290 prt(format("Command: %s", choice_msg), 15, 0);
4293 /* Hack -- query until done */
4296 feature_type *f_ptr = &f_info[f];
4300 byte da = f_ptr->d_attr[lighting_level];
4301 byte dc = f_ptr->d_char[lighting_level];
4302 byte ca = f_ptr->x_attr[lighting_level];
4303 byte cc = f_ptr->x_char[lighting_level];
4305 /* Label the object */
4308 Term_putstr(5, 17, -1, TERM_WHITE,
4309 format("ÃÏ·Á = %d, ̾Á° = %s, ÌÀÅÙ = %s",
4310 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4312 Term_putstr(5, 17, -1, TERM_WHITE,
4313 format("Terrain = %d, Name = %s, Lighting = %s",
4314 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
4317 /* Label the Default values */
4319 Term_putstr(10, 19, -1, TERM_WHITE,
4320 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4322 Term_putstr(10, 19, -1, TERM_WHITE,
4323 format("Default attr/char = %3d / %3d", da, dc));
4326 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4328 Term_queue_bigchar(43, 19, da, dc, 0, 0);
4330 /* Label the Current values */
4332 Term_putstr(10, 20, -1, TERM_WHITE,
4333 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4335 Term_putstr(10, 20, -1, TERM_WHITE,
4336 format("Current attr/char = %3d / %3d", ca, cc));
4339 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4340 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
4344 Term_putstr(0, 22, -1, TERM_WHITE,
4345 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4347 Term_putstr(0, 22, -1, TERM_WHITE,
4348 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
4355 if (i == ESCAPE) break;
4357 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4358 else if (isupper(i)) c = 'a' + i - 'A';
4368 if (!cmd_visuals_aux(i, &f, max_f_idx))
4374 while (!f_info[f].name || (f_info[f].mimic != f));
4378 t = (int)f_ptr->x_attr[lighting_level];
4379 (void)cmd_visuals_aux(i, &t, 256);
4380 f_ptr->x_attr[lighting_level] = (byte)t;
4384 t = (int)f_ptr->x_char[lighting_level];
4385 (void)cmd_visuals_aux(i, &t, 256);
4386 f_ptr->x_char[lighting_level] = (byte)t;
4390 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
4393 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
4397 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
4401 print_visuals_menu(choice_msg);
4409 /* Modify monster attr/chars (visual mode) */
4411 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
4414 /* Modify object attr/chars (visual mode) */
4416 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
4419 /* Modify feature attr/chars (visual mode) */
4422 int lighting_level = F_LIT_STANDARD;
4423 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
4427 #endif /* ALLOW_VISUALS */
4437 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4439 msg_print("Visual attr/char tables reset.");
4445 /* Unknown option */
4451 /* Flush messages */
4455 /* Restore the screen */
4458 if (need_redraw) do_cmd_redraw();
4463 * Interact with "colors"
4465 void do_cmd_colors(void)
4474 /* File type is "TEXT" */
4475 FILE_TYPE(FILE_TYPE_TEXT);
4478 /* Save the screen */
4482 /* Interact until done */
4488 /* Ask for a choice */
4490 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4492 prt("Interact with Colors", 2, 0);
4496 /* Give some choices */
4498 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4500 prt("(1) Load a user pref file", 4, 5);
4505 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4506 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4508 prt("(2) Dump colors", 5, 5);
4509 prt("(3) Modify colors", 6, 5);
4516 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4518 prt("Command: ", 8, 0);
4526 if (i == ESCAPE) break;
4528 /* Load a 'pref' file */
4533 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4535 prt("Command: Load a user pref file", 8, 0);
4541 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4543 prt("File: ", 10, 0);
4548 sprintf(tmp, "%s.prf", player_base);
4551 if (!askfor(tmp, 70)) continue;
4553 /* Process the given filename */
4554 (void)process_pref_file(tmp);
4556 /* Mega-Hack -- react to changes */
4557 Term_xtra(TERM_XTRA_REACT, 0);
4559 /* Mega-Hack -- redraw */
4568 static cptr mark = "Colors";
4572 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4574 prt("Command: Dump colors", 8, 0);
4580 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4582 prt("File: ", 10, 0);
4586 /* Default filename */
4587 sprintf(tmp, "%s.prf", player_base);
4589 /* Get a filename */
4590 if (!askfor(tmp, 70)) continue;
4592 /* Build the filename */
4593 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4595 /* Append to the file */
4596 if (!open_auto_dump(buf, mark)) continue;
4600 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4602 auto_dump_printf("\n# Color redefinitions\n\n");
4606 for (i = 0; i < 256; i++)
4608 int kv = angband_color_table[i][0];
4609 int rv = angband_color_table[i][1];
4610 int gv = angband_color_table[i][2];
4611 int bv = angband_color_table[i][3];
4616 cptr name = "unknown";
4620 /* Skip non-entries */
4621 if (!kv && !rv && !gv && !bv) continue;
4623 /* Extract the color name */
4624 if (i < 16) name = color_names[i];
4626 /* Dump a comment */
4628 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4630 auto_dump_printf("# Color '%s'\n", name);
4633 /* Dump the monster attr/char info */
4634 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4643 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4645 msg_print("Dumped color redefinitions.");
4657 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4659 prt("Command: Modify colors", 8, 0);
4663 /* Hack -- query until done */
4672 /* Exhibit the normal colors */
4673 for (j = 0; j < 16; j++)
4675 /* Exhibit this color */
4676 Term_putstr(j*4, 20, -1, a, "###");
4678 /* Exhibit all colors */
4679 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4682 /* Describe the color */
4684 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4686 name = ((a < 16) ? color_names[a] : "undefined");
4690 /* Describe the color */
4692 Term_putstr(5, 10, -1, TERM_WHITE,
4693 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4695 Term_putstr(5, 10, -1, TERM_WHITE,
4696 format("Color = %d, Name = %s", a, name));
4700 /* Label the Current values */
4701 Term_putstr(5, 12, -1, TERM_WHITE,
4702 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4703 angband_color_table[a][0],
4704 angband_color_table[a][1],
4705 angband_color_table[a][2],
4706 angband_color_table[a][3]));
4710 Term_putstr(0, 14, -1, TERM_WHITE,
4711 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4713 Term_putstr(0, 14, -1, TERM_WHITE,
4714 "Command (n/N/k/K/r/R/g/G/b/B): ");
4722 if (i == ESCAPE) break;
4725 if (i == 'n') a = (byte)(a + 1);
4726 if (i == 'N') a = (byte)(a - 1);
4727 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4728 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4729 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4730 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4731 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4732 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4733 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4734 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4736 /* Hack -- react to changes */
4737 Term_xtra(TERM_XTRA_REACT, 0);
4739 /* Hack -- redraw */
4746 /* Unknown option */
4752 /* Flush messages */
4757 /* Restore the screen */
4763 * Note something in the message recall
4765 void do_cmd_note(void)
4774 if (!get_string("¥á¥â: ", buf, 60)) return;
4776 if (!get_string("Note: ", buf, 60)) return;
4780 /* Ignore empty notes */
4781 if (!buf[0] || (buf[0] == ' ')) return;
4783 /* Add the note to the message recall */
4785 msg_format("¥á¥â: %s", buf);
4787 msg_format("Note: %s", buf);
4794 * Mention the current version
4796 void do_cmd_version(void)
4801 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4802 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4804 msg_format("You are playing Hengband %d.%d.%d.",
4805 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4812 * Array of feeling strings
4814 static cptr do_cmd_feeling_text[11] =
4817 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4819 "Looks like any other level.",
4823 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4825 "You feel there is something special about this level.",
4829 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4831 "You nearly faint as horrible visions of death fill your mind!",
4835 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4837 "This level looks very dangerous.",
4841 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4843 "You have a very bad feeling...",
4847 "°¤¤Í½´¶¤¬¤¹¤ë...",
4849 "You have a bad feeling...",
4855 "You feel nervous.",
4859 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4861 "You feel your luck is turning...",
4865 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4867 "You don't like the look of this place.",
4871 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4873 "This level looks reasonably safe.",
4877 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4879 "What a boring place..."
4884 static cptr do_cmd_feeling_text_combat[11] =
4887 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4889 "Looks like any other level.",
4893 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4895 "You feel there is something special about this level.",
4899 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4901 "You nearly faint as horrible visions of death fill your mind!",
4905 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4907 "This level looks very dangerous.",
4911 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4913 "You have a very bad feeling...",
4917 "°¤¤Í½´¶¤¬¤¹¤ë...",
4919 "You have a bad feeling...",
4925 "You feel nervous.",
4929 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4931 "You feel your luck is turning...",
4935 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4937 "You don't like the look of this place.",
4941 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4943 "This level looks reasonably safe.",
4947 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4949 "What a boring place..."
4954 static cptr do_cmd_feeling_text_lucky[11] =
4957 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4958 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4959 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4960 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4961 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4962 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4963 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4964 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4965 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4966 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4967 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4969 "Looks like any other level.",
4970 "You feel there is something special about this level.",
4971 "You have a superb feeling about this level.",
4972 "You have an excellent feeling...",
4973 "You have a very good feeling...",
4974 "You have a good feeling...",
4975 "You feel strangely lucky...",
4976 "You feel your luck is turning...",
4977 "You like the look of this place...",
4978 "This level can't be all bad...",
4979 "What a boring place..."
4985 * Note that "feeling" is set to zero unless some time has passed.
4986 * Note that this is done when the level is GENERATED, not entered.
4988 void do_cmd_feeling(void)
4990 /* No useful feeling in quests */
4991 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4994 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4996 msg_print("Looks like a typical quest level.");
5002 /* No useful feeling in town */
5003 else if (p_ptr->town_num && !dun_level)
5006 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
5008 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
5012 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5014 msg_print("Looks like a strange wilderness.");
5022 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
5024 msg_print("Looks like a typical town.");
5031 /* No useful feeling in the wilderness */
5032 else if (!dun_level)
5035 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
5037 msg_print("Looks like a typical wilderness.");
5043 /* Display the feeling */
5044 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
5045 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
5046 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
5047 inventory[INVEN_BOW].name1 == ART_CRIMSON)
5048 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
5050 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
5056 * Description of each monster group.
5058 static cptr monster_group_text[] =
5061 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
5062 "¾èÇϲÄǽ¤Ê¥â¥ó¥¹¥¿¡¼", /* "Riding" */
5063 "¾Þ¶â¼ó", /* "Wanted */
5064 "¥¢¥ó¥Ð¡¼¤Î²¦Â²", /* "Ambertite" */
5093 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
5110 /* "¾åµé¥Ç¡¼¥â¥ó", */
5154 /* "Ancient Dragon/Wyrm", */
5163 "Multi-Headed Reptile",
5168 "Reptile/Amphibian",
5169 "Spider/Scorpion/Tick",
5171 /* "Major Demon", */
5188 * Symbols of monsters in each group. Note the "Uniques" group
5189 * is handled differently.
5191 static cptr monster_group_char[] =
5248 "!$&()+./=>?[\\]`{|~",
5258 * hook function to sort monsters by level
5260 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5262 u16b *who = (u16b*)(u);
5267 monster_race *r_ptr1 = &r_info[w1];
5268 monster_race *r_ptr2 = &r_info[w2];
5273 if (r_ptr2->level > r_ptr1->level) return TRUE;
5274 if (r_ptr1->level > r_ptr2->level) return FALSE;
5276 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5277 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5282 * Build a list of monster indexes in the given group. Return the number
5283 * of monsters in the group.
5285 * mode & 0x01 : check for non-empty group
5286 * mode & 0x02 : visual operation only
5288 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5293 /* Get a list of x_char in this group */
5294 cptr group_char = monster_group_char[grp_cur];
5296 /* XXX Hack -- Check if this is the "Uniques" group */
5297 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5299 /* XXX Hack -- Check if this is the "Riding" group */
5300 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
5302 /* XXX Hack -- Check if this is the "Wanted" group */
5303 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
5305 /* XXX Hack -- Check if this is the "Amberite" group */
5306 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
5309 /* Check every race */
5310 for (i = 0; i < max_r_idx; i++)
5312 /* Access the race */
5313 monster_race *r_ptr = &r_info[i];
5315 /* Skip empty race */
5316 if (!r_ptr->name) continue ;
5318 /* Require known monsters */
5319 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
5323 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5326 else if (grp_riding)
5328 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
5331 else if (grp_wanted)
5333 bool wanted = FALSE;
5335 for (j = 0; j < MAX_KUBI; j++)
5337 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
5338 (p_ptr->today_mon && p_ptr->today_mon == i))
5344 if (!wanted) continue;
5347 else if (grp_amberite)
5349 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
5354 /* Check for race in the group */
5355 if (!my_strchr(group_char, r_ptr->d_char)) continue;
5359 mon_idx[mon_cnt++] = i;
5361 /* XXX Hack -- Just checking for non-empty group */
5362 if (mode & 0x01) break;
5365 /* Terminate the list */
5366 mon_idx[mon_cnt] = -1;
5368 /* Select the sort method */
5369 ang_sort_comp = ang_sort_comp_monster_level;
5370 ang_sort_swap = ang_sort_swap_hook;
5372 /* Sort by monster level */
5373 ang_sort(mon_idx, &dummy_why, mon_cnt);
5375 /* Return the number of races */
5381 * Description of each monster group.
5383 static cptr object_group_text[] =
5386 "¥¥Î¥³", /* "Mushrooms" */
5387 "Ìô", /* "Potions" */
5388 "Ìý¤Ä¤Ü", /* "Flasks" */
5389 "´¬Êª", /* "Scrolls" */
5390 "»ØÎØ", /* "Rings" */
5391 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5392 "ū", /* "Whistle" */
5393 "¸÷¸»", /* "Lanterns" */
5394 "ËâË¡ËÀ", /* "Wands" */
5395 "¾ó", /* "Staffs" */
5396 "¥í¥Ã¥É", /* "Rods" */
5397 "¥«¡¼¥É", /* "Cards" */
5398 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5408 "Åá·õÎà", /* "Swords" */
5409 "Æß´ï", /* "Blunt Weapons" */
5410 "ĹÊÁÉð´ï", /* "Polearms" */
5411 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5412 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5416 "·ÚÁõ³»", /* "Soft Armor" */
5417 "½ÅÁõ³»", /* "Hard Armor" */
5418 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5419 "½â", /* "Shields" */
5420 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5421 "äƼê", /* "Gloves" */
5422 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5423 "´§", /* "Crowns" */
5424 "¥Ö¡¼¥Ä", /* "Boots" */
5477 * TVALs of items in each group
5479 static byte object_group_tval[] =
5520 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5528 * Build a list of object indexes in the given group. Return the number
5529 * of objects in the group.
5531 * mode & 0x01 : check for non-empty group
5532 * mode & 0x02 : visual operation only
5534 static int collect_objects(int grp_cur, int object_idx[], byte mode)
5536 int i, j, k, object_cnt = 0;
5538 /* Get a list of x_char in this group */
5539 byte group_tval = object_group_tval[grp_cur];
5541 /* Check every object */
5542 for (i = 0; i < max_k_idx; i++)
5544 /* Access the object */
5545 object_kind *k_ptr = &k_info[i];
5547 /* Skip empty objects */
5548 if (!k_ptr->name) continue;
5552 /* Any objects will be displayed */
5558 /* Skip non-flavoured objects */
5559 if (!k_ptr->flavor) continue;
5561 /* Require objects ever seen */
5562 if (!k_ptr->aware) continue;
5565 /* Skip items with no distribution (special artifacts) */
5566 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5570 /* Check for objects in the group */
5571 if (TV_LIFE_BOOK == group_tval)
5573 /* Hack -- All spell books */
5574 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5576 /* Add the object */
5577 object_idx[object_cnt++] = i;
5581 else if (k_ptr->tval == group_tval)
5583 /* Add the object */
5584 object_idx[object_cnt++] = i;
5588 /* XXX Hack -- Just checking for non-empty group */
5589 if (mode & 0x01) break;
5592 /* Terminate the list */
5593 object_idx[object_cnt] = -1;
5595 /* Return the number of objects */
5601 * Description of each feature group.
5603 static cptr feature_group_text[] =
5611 * Build a list of feature indexes in the given group. Return the number
5612 * of features in the group.
5614 * mode & 0x01 : check for non-empty group
5616 static int collect_features(int grp_cur, int *feat_idx, byte mode)
5618 int i, feat_cnt = 0;
5620 /* Unused; There is a single group. */
5623 /* Check every feature */
5624 for (i = 0; i < max_f_idx; i++)
5626 /* Access the index */
5627 feature_type *f_ptr = &f_info[i];
5629 /* Skip empty index */
5630 if (!f_ptr->name) continue;
5632 /* Skip mimiccing features */
5633 if (f_ptr->mimic != i) continue;
5636 feat_idx[feat_cnt++] = i;
5638 /* XXX Hack -- Just checking for non-empty group */
5639 if (mode & 0x01) break;
5642 /* Terminate the list */
5643 feat_idx[feat_cnt] = -1;
5645 /* Return the number of races */
5652 * Build a list of monster indexes in the given group. Return the number
5653 * of monsters in the group.
5655 static int collect_artifacts(int grp_cur, int object_idx[])
5657 int i, object_cnt = 0;
5659 /* Get a list of x_char in this group */
5660 byte group_tval = object_group_tval[grp_cur];
5662 /* Check every object */
5663 for (i = 0; i < max_a_idx; i++)
5665 /* Access the artifact */
5666 artifact_type *a_ptr = &a_info[i];
5668 /* Skip empty artifacts */
5669 if (!a_ptr->name) continue;
5671 /* Skip "uncreated" artifacts */
5672 if (!a_ptr->cur_num) continue;
5674 /* Check for race in the group */
5675 if (a_ptr->tval == group_tval)
5678 object_idx[object_cnt++] = i;
5682 /* Terminate the list */
5683 object_idx[object_cnt] = 0;
5685 /* Return the number of races */
5692 * Encode the screen colors
5694 static char hack[17] = "dwsorgbuDWvyRGBU";
5698 * Hack -- load a screen dump from a file
5700 void do_cmd_load_screen(void)
5715 Term_get_size(&wid, &hgt);
5717 /* Build the filename */
5718 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5720 /* Append to the file */
5721 fff = my_fopen(buf, "r");
5726 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5728 msg_format("Failed to open %s.", buf);
5735 /* Save the screen */
5738 /* Clear the screen */
5742 /* Load the screen */
5743 for (y = 0; okay; y++)
5745 /* Get a line of data including control code */
5746 if (!fgets(buf, 1024, fff)) okay = FALSE;
5748 /* Get the blank line */
5749 if (buf[0] == '\n' || buf[0] == '\0') break;
5751 /* Ignore too large screen image */
5752 if (y >= hgt) continue;
5755 for (x = 0; x < wid - 1; x++)
5758 if (buf[x] == '\n' || buf[x] == '\0') break;
5760 /* Put the attr/char */
5761 Term_draw(x, y, TERM_WHITE, buf[x]);
5765 /* Dump the screen */
5766 for (y = 0; okay; y++)
5768 /* Get a line of data including control code */
5769 if (!fgets(buf, 1024, fff)) okay = FALSE;
5771 /* Get the blank line */
5772 if (buf[0] == '\n' || buf[0] == '\0') break;
5774 /* Ignore too large screen image */
5775 if (y >= hgt) continue;
5778 for (x = 0; x < wid - 1; x++)
5781 if (buf[x] == '\n' || buf[x] == '\0') break;
5783 /* Get the attr/char */
5784 (void)(Term_what(x, y, &a, &c));
5786 /* Look up the attr */
5787 for (i = 0; i < 16; i++)
5789 /* Use attr matches */
5790 if (hack[i] == buf[x]) a = i;
5793 /* Put the attr/char */
5794 Term_draw(x, y, a, c);
5805 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5807 msg_print("Screen dump loaded.");
5814 /* Restore the screen */
5821 cptr inven_res_label =
5823 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5825 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5830 #define IM_FLAG_STR "¡ö"
5831 #define HAS_FLAG_STR "¡Ü"
5832 #define NO_FLAG_STR "¡¦"
5834 #define IM_FLAG_STR "* "
5835 #define HAS_FLAG_STR "+ "
5836 #define NO_FLAG_STR ". "
5839 #define print_im_or_res_flag(IM, RES) \
5841 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5842 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5845 #define print_flag(TR) \
5847 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5851 /* XTRA HACK RESLIST */
5852 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5854 char o_name[MAX_NLEN];
5855 u32b flgs[TR_FLAG_SIZE];
5857 if (!o_ptr->k_idx) return;
5858 if (o_ptr->tval != tval) return;
5860 /* Identified items only */
5861 if (!object_is_known(o_ptr)) return;
5864 * HACK:Ring of Lordly protection and Dragon equipment
5865 * have random resistances.
5867 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
5868 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5869 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5870 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5871 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5872 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5873 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5874 || object_is_artifact(o_ptr))
5877 object_desc(o_name, o_ptr, OD_NAME_ONLY);
5879 while (o_name[i] && (i < 26))
5882 if (iskanji(o_name[i])) i++;
5891 o_name[i] = ' '; i++;
5896 fprintf(fff, "%s %s", where, o_name);
5898 if (!(o_ptr->ident & (IDENT_MENTAL)))
5901 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5903 fputs("-------unknown------------ -------unknown------\n", fff);
5908 object_flags_known(o_ptr, flgs);
5910 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5911 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5912 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5913 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5914 print_flag(TR_RES_POIS);
5915 print_flag(TR_RES_LITE);
5916 print_flag(TR_RES_DARK);
5917 print_flag(TR_RES_SHARDS);
5918 print_flag(TR_RES_SOUND);
5919 print_flag(TR_RES_NETHER);
5920 print_flag(TR_RES_NEXUS);
5921 print_flag(TR_RES_CHAOS);
5922 print_flag(TR_RES_DISEN);
5926 print_flag(TR_RES_BLIND);
5927 print_flag(TR_RES_FEAR);
5928 print_flag(TR_RES_CONF);
5929 print_flag(TR_FREE_ACT);
5930 print_flag(TR_SEE_INVIS);
5931 print_flag(TR_HOLD_LIFE);
5932 print_flag(TR_TELEPATHY);
5933 print_flag(TR_SLOW_DIGEST);
5934 print_flag(TR_REGEN);
5935 print_flag(TR_LEVITATION);
5943 fprintf(fff, "%s\n", inven_res_label);
5949 * Display *ID* ed weapons/armors's resistances
5951 static void do_cmd_knowledge_inven(void)
5955 char file_name[1024];
5965 /* Open a new file */
5966 fff = my_fopen_temp(file_name, 1024);
5970 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5972 msg_format("Failed to create temporary file %s.", file_name);
5977 fprintf(fff, "%s\n", inven_res_label);
5979 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
5983 for (; j < 9; j++) fputc('\n', fff);
5985 fprintf(fff, "%s\n", inven_res_label);
5989 strcpy(where, "Áõ");
5991 strcpy(where, "E ");
5993 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5995 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5999 strcpy(where, "»ý");
6001 strcpy(where, "I ");
6003 for (i = 0; i < INVEN_PACK; i++)
6005 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
6008 st_ptr = &town[1].store[STORE_HOME];
6010 strcpy(where, "²È");
6012 strcpy(where, "H ");
6015 for (i = 0; i < st_ptr->stock_num; i++)
6017 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
6021 /* Close the file */
6024 /* Display the file contents */
6026 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
6028 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
6031 /* Remove the file */
6036 void do_cmd_save_screen_html_aux(char *filename, int message)
6040 byte a = 0, old_a = 0;
6054 cptr html_head[] = {
6055 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
6059 cptr html_foot[] = {
6061 "</body>\n</html>\n",
6067 Term_get_size(&wid, &hgt);
6069 /* File type is "TEXT" */
6070 FILE_TYPE(FILE_TYPE_TEXT);
6072 /* Append to the file */
6073 fff = my_fopen(filename, "w");
6079 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
6081 msg_format("Failed to open file %s.", filename);
6089 /* Save the screen */
6093 /* Build the filename */
6094 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
6095 tmpfff = my_fopen(buf, "r");
6097 for (i = 0; html_head[i]; i++)
6098 fprintf(fff, html_head[i]);
6102 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6104 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
6108 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
6110 fprintf(fff, "%s\n", buf);
6115 /* Dump the screen */
6116 for (y = 0; y < hgt; y++)
6123 for (x = 0; x < wid - 1; x++)
6127 /* Get the attr/char */
6128 (void)(Term_what(x, y, &a, &c));
6132 case '&': cc = "&"; break;
6133 case '<': cc = "<"; break;
6134 case '>': cc = ">"; break;
6136 case 0x1f: c = '.'; break;
6137 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
6142 if ((y == 0 && x == 0) || a != old_a) {
6143 rv = angband_color_table[a][1];
6144 gv = angband_color_table[a][2];
6145 bv = angband_color_table[a][3];
6146 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
6147 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6151 fprintf(fff, "%s", cc);
6153 fprintf(fff, "%c", c);
6156 fprintf(fff, "</font>");
6159 for (i = 0; html_foot[i]; i++)
6160 fprintf(fff, html_foot[i]);
6165 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6167 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6171 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6173 fprintf(fff, "%s\n", buf);
6188 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6190 msg_print("Screen dump saved.");
6195 /* Restore the screen */
6201 * Hack -- save a screen dump to a file
6203 static void do_cmd_save_screen_html(void)
6205 char buf[1024], tmp[256] = "screen.html";
6208 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6210 if (!get_string("File name: ", tmp, 80))
6214 /* Build the filename */
6215 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6219 do_cmd_save_screen_html_aux(buf, 1);
6224 * Redefinable "save_screen" action
6226 void (*screendump_aux)(void) = NULL;
6230 * Hack -- save a screen dump to a file
6232 void do_cmd_save_screen(void)
6234 bool old_use_graphics = use_graphics;
6235 bool html_dump = FALSE;
6240 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6242 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6247 if (c == 'Y' || c == 'y')
6249 else if (c == 'H' || c == 'h')
6261 Term_get_size(&wid, &hgt);
6263 if (old_use_graphics)
6265 use_graphics = FALSE;
6268 /* Redraw everything */
6269 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6271 /* Hack -- update */
6277 do_cmd_save_screen_html();
6281 /* Do we use a special screendump function ? */
6282 else if (screendump_aux)
6284 /* Dump the screen to a graphics file */
6285 (*screendump_aux)();
6287 else /* Dump the screen as text */
6298 /* Build the filename */
6299 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6301 /* File type is "TEXT" */
6302 FILE_TYPE(FILE_TYPE_TEXT);
6304 /* Append to the file */
6305 fff = my_fopen(buf, "w");
6311 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6313 msg_format("Failed to open file %s.", buf);
6320 /* Save the screen */
6324 /* Dump the screen */
6325 for (y = 0; y < hgt; y++)
6328 for (x = 0; x < wid - 1; x++)
6330 /* Get the attr/char */
6331 (void)(Term_what(x, y, &a, &c));
6341 fprintf(fff, "%s\n", buf);
6348 /* Dump the screen */
6349 for (y = 0; y < hgt; y++)
6352 for (x = 0; x < wid - 1; x++)
6354 /* Get the attr/char */
6355 (void)(Term_what(x, y, &a, &c));
6358 buf[x] = hack[a&0x0F];
6365 fprintf(fff, "%s\n", buf);
6377 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6379 msg_print("Screen dump saved.");
6385 /* Restore the screen */
6389 if (old_use_graphics)
6391 use_graphics = TRUE;
6394 /* Redraw everything */
6395 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6397 /* Hack -- update */
6404 * Sorting hook -- Comp function -- see below
6406 * We use "u" to point to array of monster indexes,
6407 * and "v" to select the type of sorting to perform on "u".
6409 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6411 u16b *who = (u16b*)(u);
6413 u16b *why = (u16b*)(v);
6420 /* Sort by total kills */
6423 /* Extract total kills */
6424 z1 = a_info[w1].tval;
6425 z2 = a_info[w2].tval;
6427 /* Compare total kills */
6428 if (z1 < z2) return (TRUE);
6429 if (z1 > z2) return (FALSE);
6433 /* Sort by monster level */
6436 /* Extract levels */
6437 z1 = a_info[w1].sval;
6438 z2 = a_info[w2].sval;
6440 /* Compare levels */
6441 if (z1 < z2) return (TRUE);
6442 if (z1 > z2) return (FALSE);
6446 /* Sort by monster experience */
6449 /* Extract experience */
6450 z1 = a_info[w1].level;
6451 z2 = a_info[w2].level;
6453 /* Compare experience */
6454 if (z1 < z2) return (TRUE);
6455 if (z1 > z2) return (FALSE);
6459 /* Compare indexes */
6465 * Sorting hook -- Swap function -- see below
6467 * We use "u" to point to array of monster indexes,
6468 * and "v" to select the type of sorting to perform.
6470 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6472 u16b *who = (u16b*)(u);
6487 * Check the status of "artifacts"
6489 static void do_cmd_knowledge_artifacts(void)
6491 int i, k, z, x, y, n = 0;
6497 char file_name[1024];
6499 char base_name[MAX_NLEN];
6503 /* Open a new file */
6504 fff = my_fopen_temp(file_name, 1024);
6508 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6510 msg_format("Failed to create temporary file %s.", file_name);
6516 /* Allocate the "who" array */
6517 C_MAKE(who, max_a_idx, s16b);
6519 /* Allocate the "okay" array */
6520 C_MAKE(okay, max_a_idx, bool);
6522 /* Scan the artifacts */
6523 for (k = 0; k < max_a_idx; k++)
6525 artifact_type *a_ptr = &a_info[k];
6530 /* Skip "empty" artifacts */
6531 if (!a_ptr->name) continue;
6533 /* Skip "uncreated" artifacts */
6534 if (!a_ptr->cur_num) continue;
6540 /* Check the dungeon */
6541 for (y = 0; y < cur_hgt; y++)
6543 for (x = 0; x < cur_wid; x++)
6545 cave_type *c_ptr = &cave[y][x];
6547 s16b this_o_idx, next_o_idx = 0;
6549 /* Scan all objects in the grid */
6550 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6554 /* Acquire object */
6555 o_ptr = &o_list[this_o_idx];
6557 /* Acquire next object */
6558 next_o_idx = o_ptr->next_o_idx;
6560 /* Ignore non-artifacts */
6561 if (!object_is_fixed_artifact(o_ptr)) continue;
6563 /* Ignore known items */
6564 if (object_is_known(o_ptr)) continue;
6566 /* Note the artifact */
6567 okay[o_ptr->name1] = FALSE;
6572 /* Check the inventory and equipment */
6573 for (i = 0; i < INVEN_TOTAL; i++)
6575 object_type *o_ptr = &inventory[i];
6577 /* Ignore non-objects */
6578 if (!o_ptr->k_idx) continue;
6580 /* Ignore non-artifacts */
6581 if (!object_is_fixed_artifact(o_ptr)) continue;
6583 /* Ignore known items */
6584 if (object_is_known(o_ptr)) continue;
6586 /* Note the artifact */
6587 okay[o_ptr->name1] = FALSE;
6590 for (k = 0; k < max_a_idx; k++)
6592 if (okay[k]) who[n++] = k;
6595 /* Select the sort method */
6596 ang_sort_comp = ang_sort_art_comp;
6597 ang_sort_swap = ang_sort_art_swap;
6599 /* Sort the array by dungeon depth of monsters */
6600 ang_sort(who, &why, n);
6602 /* Scan the artifacts */
6603 for (k = 0; k < n; k++)
6605 artifact_type *a_ptr = &a_info[who[k]];
6609 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6611 strcpy(base_name, "Unknown Artifact");
6615 /* Obtain the base object type */
6616 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6624 /* Get local object */
6627 /* Create fake object */
6628 object_prep(q_ptr, z);
6630 /* Make it an artifact */
6631 q_ptr->name1 = (byte)who[k];
6633 /* Display as if known */
6634 q_ptr->ident |= IDENT_STORE;
6636 /* Describe the artifact */
6637 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
6640 /* Hack -- Build the artifact name */
6642 fprintf(fff, " %s\n", base_name);
6644 fprintf(fff, " The %s\n", base_name);
6649 /* Free the "who" array */
6650 C_KILL(who, max_a_idx, s16b);
6652 /* Free the "okay" array */
6653 C_KILL(okay, max_a_idx, bool);
6655 /* Close the file */
6658 /* Display the file contents */
6660 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6662 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6666 /* Remove the file */
6672 * Display known uniques
6673 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
6675 static void do_cmd_knowledge_uniques(void)
6683 char file_name[1024];
6686 int n_alive_surface = 0;
6687 int n_alive_over100 = 0;
6688 int n_alive_total = 0;
6691 for (i = 0; i < 10; i++) n_alive[i] = 0;
6693 /* Open a new file */
6694 fff = my_fopen_temp(file_name, 1024);
6699 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6701 msg_format("Failed to create temporary file %s.", file_name);
6707 /* Allocate the "who" array */
6708 C_MAKE(who, max_r_idx, s16b);
6710 /* Scan the monsters */
6711 for (i = 1; i < max_r_idx; i++)
6713 monster_race *r_ptr = &r_info[i];
6716 if (!r_ptr->name) continue;
6718 /* Require unique monsters */
6719 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6721 /* Only display "known" uniques */
6722 if (!cheat_know && !r_ptr->r_sights) continue;
6724 /* Only print rarity <= 100 uniques */
6725 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
6727 /* Only "alive" uniques */
6728 if (r_ptr->max_num == 0) continue;
6732 lev = (r_ptr->level - 1) / 10;
6736 if (max_lev < lev) max_lev = lev;
6738 else n_alive_over100++;
6740 else n_alive_surface++;
6742 /* Collect "appropriate" monsters */
6746 /* Select the sort method */
6747 ang_sort_comp = ang_sort_comp_hook;
6748 ang_sort_swap = ang_sort_swap_hook;
6750 /* Sort the array by dungeon depth of monsters */
6751 ang_sort(who, &why, n);
6753 if (n_alive_surface)
6756 fprintf(fff, " ÃϾå À¸Â¸: %3dÂÎ\n", n_alive_surface);
6758 fprintf(fff, " Surface alive: %3d\n", n_alive_surface);
6760 n_alive_total += n_alive_surface;
6762 for (i = 0; i <= max_lev; i++)
6765 fprintf(fff, "%3d-%3d³¬ À¸Â¸: %3dÂÎ\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6767 fprintf(fff, "Level %3d-%3d alive: %3d\n", 1 + i * 10, 10 + i * 10, n_alive[i]);
6769 n_alive_total += n_alive[i];
6771 if (n_alive_over100)
6774 fprintf(fff, "101- ³¬ À¸Â¸: %3dÂÎ\n", n_alive_over100);
6776 fprintf(fff, "Level 101- alive: %3d\n", n_alive_over100);
6778 n_alive_total += n_alive_over100;
6784 fputs("--------- -----------\n", fff);
6785 fprintf(fff, " ¹ç·× À¸Â¸: %3dÂÎ\n\n", n_alive_total);
6787 fputs("------------- ----------\n", fff);
6788 fprintf(fff, " Total alive: %3d\n\n", n_alive_total);
6794 fputs("¸½ºß¤Ï´ûÃΤÎÀ¸Â¸¥æ¥Ë¡¼¥¯¤Ï¤¤¤Þ¤»¤ó¡£\n", fff);
6796 fputs("No known uniques alive.\n", fff);
6800 /* Scan the monster races */
6801 for (k = 0; k < n; k++)
6803 monster_race *r_ptr = &r_info[who[k]];
6805 /* Print a message */
6807 fprintf(fff, " %s (¥ì¥Ù¥ë%d)\n", r_name + r_ptr->name, r_ptr->level);
6809 fprintf(fff, " %s (level %d)\n", r_name + r_ptr->name, r_ptr->level);
6813 /* Free the "who" array */
6814 C_KILL(who, max_r_idx, s16b);
6816 /* Close the file */
6819 /* Display the file contents */
6821 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6823 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6827 /* Remove the file */
6833 * Display weapon-exp
6835 static void do_cmd_knowledge_weapon_exp(void)
6837 int i, j, num, weapon_exp;
6841 char file_name[1024];
6844 /* Open a new file */
6845 fff = my_fopen_temp(file_name, 1024);
6848 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6850 msg_format("Failed to create temporary file %s.", file_name);
6856 for (i = 0; i < 5; i++)
6858 for (num = 0; num < 64; num++)
6860 for (j = 0; j < max_k_idx; j++)
6862 object_kind *k_ptr = &k_info[j];
6864 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6866 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6868 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6870 fprintf(fff, "%-25s ", tmp);
6871 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6872 else fprintf(fff, " ");
6873 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6874 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6882 /* Close the file */
6885 /* Display the file contents */
6887 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6889 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6893 /* Remove the file */
6901 static void do_cmd_knowledge_spell_exp(void)
6903 int i = 0, spell_exp, exp_level;
6908 char file_name[1024];
6910 /* Open a new file */
6911 fff = my_fopen_temp(file_name, 1024);
6914 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6916 msg_format("Failed to create temporary file %s.", file_name);
6922 if (p_ptr->realm1 != REALM_NONE)
6925 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6927 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6929 for (i = 0; i < 32; i++)
6931 if (!is_magic(p_ptr->realm1))
6933 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6937 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6939 if (s_ptr->slevel >= 99) continue;
6940 spell_exp = p_ptr->spell_exp[i];
6941 exp_level = spell_exp_level(spell_exp);
6942 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
6943 if (p_ptr->realm1 == REALM_HISSATSU)
6944 fprintf(fff, "[--]");
6947 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6948 else fprintf(fff, " ");
6949 fprintf(fff, "%s", exp_level_str[exp_level]);
6951 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6956 if (p_ptr->realm2 != REALM_NONE)
6959 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6961 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6963 for (i = 0; i < 32; i++)
6965 if (!is_magic(p_ptr->realm1))
6967 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6971 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6973 if (s_ptr->slevel >= 99) continue;
6975 spell_exp = p_ptr->spell_exp[i + 32];
6976 exp_level = spell_exp_level(spell_exp);
6977 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
6978 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6979 else fprintf(fff, " ");
6980 fprintf(fff, "%s", exp_level_str[exp_level]);
6981 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6986 /* Close the file */
6989 /* Display the file contents */
6991 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6993 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6997 /* Remove the file */
7005 static void do_cmd_knowledge_skill_exp(void)
7007 int i = 0, skill_exp;
7011 char file_name[1024];
7013 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
7015 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
7018 /* Open a new file */
7019 fff = my_fopen_temp(file_name, 1024);
7022 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7024 msg_format("Failed to create temporary file %s.", file_name);
7030 for (i = 0; i < 3; i++)
7032 skill_exp = p_ptr->skill_exp[i];
7033 fprintf(fff, "%-20s ", skill_name[i]);
7034 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
7035 else fprintf(fff, " ");
7036 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
7037 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
7041 /* Close the file */
7044 /* Display the file contents */
7046 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
7048 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
7052 /* Remove the file */
7058 * Pluralize a monster name
7060 void plural_aux(char *Name)
7062 int NameLen = strlen(Name);
7064 if (my_strstr(Name, "Disembodied hand"))
7066 strcpy(Name, "Disembodied hands that strangled people");
7068 else if (my_strstr(Name, "Colour out of space"))
7070 strcpy(Name, "Colours out of space");
7072 else if (my_strstr(Name, "stairway to hell"))
7074 strcpy(Name, "stairways to hell");
7076 else if (my_strstr(Name, "Dweller on the threshold"))
7078 strcpy(Name, "Dwellers on the threshold");
7080 else if (my_strstr(Name, " of "))
7082 cptr aider = my_strstr(Name, " of ");
7093 if (dummy[i-1] == 's')
7095 strcpy(&(dummy[i]), "es");
7100 strcpy(&(dummy[i]), "s");
7103 strcpy(&(dummy[i+1]), aider);
7104 strcpy(Name, dummy);
7106 else if (my_strstr(Name, "coins"))
7109 strcpy(dummy, "piles of ");
7110 strcat(dummy, Name);
7111 strcpy(Name, dummy);
7114 else if (my_strstr(Name, "Manes"))
7118 else if (streq(&(Name[NameLen - 2]), "ey"))
7120 strcpy(&(Name[NameLen - 2]), "eys");
7122 else if (Name[NameLen - 1] == 'y')
7124 strcpy(&(Name[NameLen - 1]), "ies");
7126 else if (streq(&(Name[NameLen - 4]), "ouse"))
7128 strcpy(&(Name[NameLen - 4]), "ice");
7130 else if (streq(&(Name[NameLen - 2]), "us"))
7132 strcpy(&(Name[NameLen - 2]), "i");
7134 else if (streq(&(Name[NameLen - 6]), "kelman"))
7136 strcpy(&(Name[NameLen - 6]), "kelmen");
7138 else if (streq(&(Name[NameLen - 8]), "wordsman"))
7140 strcpy(&(Name[NameLen - 8]), "wordsmen");
7142 else if (streq(&(Name[NameLen - 7]), "oodsman"))
7144 strcpy(&(Name[NameLen - 7]), "oodsmen");
7146 else if (streq(&(Name[NameLen - 7]), "eastman"))
7148 strcpy(&(Name[NameLen - 7]), "eastmen");
7150 else if (streq(&(Name[NameLen - 8]), "izardman"))
7152 strcpy(&(Name[NameLen - 8]), "izardmen");
7154 else if (streq(&(Name[NameLen - 5]), "geist"))
7156 strcpy(&(Name[NameLen - 5]), "geister");
7158 else if (streq(&(Name[NameLen - 2]), "ex"))
7160 strcpy(&(Name[NameLen - 2]), "ices");
7162 else if (streq(&(Name[NameLen - 2]), "lf"))
7164 strcpy(&(Name[NameLen - 2]), "lves");
7166 else if (suffix(Name, "ch") ||
7167 suffix(Name, "sh") ||
7168 suffix(Name, "nx") ||
7169 suffix(Name, "s") ||
7172 strcpy(&(Name[NameLen]), "es");
7176 strcpy(&(Name[NameLen]), "s");
7181 * Display current pets
7183 static void do_cmd_knowledge_pets(void)
7187 monster_type *m_ptr;
7190 int show_upkeep = 0;
7191 char file_name[1024];
7194 /* Open a new file */
7195 fff = my_fopen_temp(file_name, 1024);
7198 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7200 msg_format("Failed to create temporary file %s.", file_name);
7206 /* Process the monsters (backwards) */
7207 for (i = m_max - 1; i >= 1; i--)
7209 /* Access the monster */
7212 /* Ignore "dead" monsters */
7213 if (!m_ptr->r_idx) continue;
7215 /* Calculate "upkeep" for pets */
7219 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7220 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7224 show_upkeep = calculate_upkeep();
7226 fprintf(fff, "----------------------------------------------\n");
7228 fprintf(fff, " ¹ç·×: %d ÂΤΥڥåÈ\n", t_friends);
7229 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7231 fprintf(fff, " Total: %d pet%s.\n",
7232 t_friends, (t_friends == 1 ? "" : "s"));
7233 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7238 /* Close the file */
7241 /* Display the file contents */
7243 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7245 show_file(TRUE, file_name, "Current Pets", 0, 0);
7249 /* Remove the file */
7257 * Note that the player ghosts are ignored. XXX XXX XXX
7259 static void do_cmd_knowledge_kill_count(void)
7267 char file_name[1024];
7272 /* Open a new file */
7273 fff = my_fopen_temp(file_name, 1024);
7277 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7279 msg_format("Failed to create temporary file %s.", file_name);
7285 /* Allocate the "who" array */
7286 C_MAKE(who, max_r_idx, s16b);
7289 /* Monsters slain */
7292 for (kk = 1; kk < max_r_idx; kk++)
7294 monster_race *r_ptr = &r_info[kk];
7296 if (r_ptr->flags1 & (RF1_UNIQUE))
7298 bool dead = (r_ptr->max_num == 0);
7307 s16b This = r_ptr->r_pkills;
7318 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7320 fprintf(fff,"You have defeated no enemies yet.\n\n");
7324 fprintf(fff,"¤¢¤Ê¤¿¤Ï%ldÂΤÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7326 fprintf(fff,"You have defeated %ld %s.\n\n", Total, (Total == 1) ? "enemy" : "enemies");
7332 /* Scan the monsters */
7333 for (i = 1; i < max_r_idx; i++)
7335 monster_race *r_ptr = &r_info[i];
7337 /* Use that monster */
7338 if (r_ptr->name) who[n++] = i;
7341 /* Select the sort method */
7342 ang_sort_comp = ang_sort_comp_hook;
7343 ang_sort_swap = ang_sort_swap_hook;
7345 /* Sort the array by dungeon depth of monsters */
7346 ang_sort(who, &why, n);
7348 /* Scan the monster races */
7349 for (k = 0; k < n; k++)
7351 monster_race *r_ptr = &r_info[who[k]];
7353 if (r_ptr->flags1 & (RF1_UNIQUE))
7355 bool dead = (r_ptr->max_num == 0);
7359 /* Print a message */
7360 fprintf(fff, " %s\n",
7361 (r_name + r_ptr->name));
7367 s16b This = r_ptr->r_pkills;
7372 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita */
7373 if (my_strchr("pt", r_ptr->d_char))
7374 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7376 fprintf(fff, " %3d ÂΤΠ%s\n", This, r_name + r_ptr->name);
7380 if (my_strstr(r_name + r_ptr->name, "coins"))
7382 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7386 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7392 strcpy(ToPlural, (r_name + r_ptr->name));
7393 plural_aux(ToPlural);
7394 fprintf(fff, " %d %s\n", This, ToPlural);
7404 fprintf(fff,"----------------------------------------------\n");
7406 fprintf(fff," ¹ç·×: %lu ÂΤòÅݤ·¤¿¡£\n", Total);
7408 fprintf(fff," Total: %lu creature%s killed.\n",
7409 Total, (Total == 1 ? "" : "s"));
7413 /* Free the "who" array */
7414 C_KILL(who, max_r_idx, s16b);
7416 /* Close the file */
7419 /* Display the file contents */
7421 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7423 show_file(TRUE, file_name, "Kill Count", 0, 0);
7427 /* Remove the file */
7433 * Display the object groups.
7435 static void display_group_list(int col, int row, int wid, int per_page,
7436 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7440 /* Display lines until done */
7441 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7443 /* Get the group index */
7444 int grp = grp_idx[grp_top + i];
7446 /* Choose a color */
7447 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7449 /* Erase the entire line */
7450 Term_erase(col, row + i, wid);
7452 /* Display the group label */
7453 c_put_str(attr, group_text[grp], row + i, col);
7459 * Move the cursor in a browser window
7461 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7462 int *list_cur, int list_cnt)
7467 int list = *list_cur;
7469 /* Extract direction */
7472 /* Hack -- scroll up full screen */
7477 /* Hack -- scroll down full screen */
7482 d = get_keymap_dir(ch);
7487 /* Diagonals - hack */
7488 if ((ddx[d] > 0) && ddy[d])
7494 Term_get_size(&wid, &hgt);
7496 browser_rows = hgt - 8;
7498 /* Browse group list */
7503 /* Move up or down */
7504 grp += ddy[d] * (browser_rows - 1);
7507 if (grp >= grp_cnt) grp = grp_cnt - 1;
7508 if (grp < 0) grp = 0;
7509 if (grp != old_grp) list = 0;
7512 /* Browse sub-list list */
7515 /* Move up or down */
7516 list += ddy[d] * browser_rows;
7519 if (list >= list_cnt) list = list_cnt - 1;
7520 if (list < 0) list = 0;
7532 if (col < 0) col = 0;
7533 if (col > 1) col = 1;
7540 /* Browse group list */
7545 /* Move up or down */
7549 if (grp >= grp_cnt) grp = grp_cnt - 1;
7550 if (grp < 0) grp = 0;
7551 if (grp != old_grp) list = 0;
7554 /* Browse sub-list list */
7557 /* Move up or down */
7561 if (list >= list_cnt) list = list_cnt - 1;
7562 if (list < 0) list = 0;
7573 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7577 /* Clear the display lines */
7578 for (i = 0; i < height; i++)
7580 Term_erase(col, row + i, width);
7583 /* Bigtile mode uses double width */
7584 if (use_bigtile) width /= 2;
7586 /* Display lines until done */
7587 for (i = 0; i < height; i++)
7589 /* Display columns until done */
7590 for (j = 0; j < width; j++)
7598 /* Bigtile mode uses double width */
7599 if (use_bigtile) x += j;
7604 /* Ignore illegal characters */
7605 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7606 (!use_graphics && ic > 0x7f))
7612 /* Force correct code for both ASCII character and tile */
7613 if (c & 0x80) a |= 0x80;
7615 /* Display symbol */
7616 Term_queue_bigchar(x, y, a, c, 0, 0);
7623 * Place the cursor at the collect position for visual mode
7625 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7627 int i = (a & 0x7f) - attr_top;
7628 int j = c - char_left;
7633 /* Bigtile mode uses double width */
7634 if (use_bigtile) x += j;
7636 /* Place the cursor */
7642 * Clipboard variables for copy&paste in visual mode
7644 static byte attr_idx = 0;
7645 static byte char_idx = 0;
7647 /* Hack -- for feature lighting */
7648 static byte attr_idx_feat[F_LIT_MAX];
7649 static byte char_idx_feat[F_LIT_MAX];
7652 * Do visual mode command -- Change symbols
7654 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7655 int height, int width,
7656 byte *attr_top_ptr, byte *char_left_ptr,
7657 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
7659 static byte attr_old = 0, char_old = 0;
7664 if (*visual_list_ptr)
7667 *cur_attr_ptr = attr_old;
7668 *cur_char_ptr = char_old;
7669 *visual_list_ptr = FALSE;
7677 if (*visual_list_ptr)
7680 *visual_list_ptr = FALSE;
7681 *need_redraw = TRUE;
7689 if (!*visual_list_ptr)
7691 *visual_list_ptr = TRUE;
7693 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7694 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7696 attr_old = *cur_attr_ptr;
7697 char_old = *cur_char_ptr;
7708 /* Set the visual */
7709 attr_idx = *cur_attr_ptr;
7710 char_idx = *cur_char_ptr;
7712 /* Hack -- for feature lighting */
7713 for (i = 0; i < F_LIT_MAX; i++)
7715 attr_idx_feat[i] = 0;
7716 char_idx_feat[i] = 0;
7723 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
7726 *cur_attr_ptr = attr_idx;
7727 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7728 if (!*visual_list_ptr) *need_redraw = TRUE;
7734 *cur_char_ptr = char_idx;
7735 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7736 if (!*visual_list_ptr) *need_redraw = TRUE;
7742 if (*visual_list_ptr)
7745 int d = get_keymap_dir(ch);
7746 byte a = (*cur_attr_ptr & 0x7f);
7747 byte c = *cur_char_ptr;
7749 if (use_bigtile) eff_width = width / 2;
7750 else eff_width = width;
7752 /* Restrict direction */
7753 if ((a == 0) && (ddy[d] < 0)) d = 0;
7754 if ((c == 0) && (ddx[d] < 0)) d = 0;
7755 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7756 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7761 /* Force correct code for both ASCII character and tile */
7762 if (c & 0x80) a |= 0x80;
7764 /* Set the visual */
7769 /* Move the frame */
7770 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7771 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7772 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7773 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7779 /* Visual mode command is not used */
7785 * Display the monsters in a group.
7787 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7788 int mon_cur, int mon_top, bool visual_only)
7792 /* Display lines until done */
7793 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
7797 /* Get the race index */
7798 int r_idx = mon_idx[mon_top + i] ;
7800 /* Access the race */
7801 monster_race *r_ptr = &r_info[r_idx];
7803 /* Choose a color */
7804 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7806 /* Display the name */
7807 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7809 /* Hack -- visual_list mode */
7812 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
7814 if (p_ptr->wizard || visual_only)
7816 c_prt(attr, format("%d", r_idx), row + i, 62);
7819 /* Erase chars before overwritten by the race letter */
7820 Term_erase(69, row + i, 255);
7822 /* Display symbol */
7823 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
7828 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7830 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 74);
7832 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? " dead" : "alive"), row + i, 73);
7837 /* Clear remaining lines */
7838 for (; i < per_page; i++)
7840 Term_erase(col, row + i, 255);
7846 * Display known monsters.
7848 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
7851 int grp_cur, grp_top, old_grp_cur;
7852 int mon_cur, mon_top;
7853 int grp_cnt, grp_idx[100];
7861 bool visual_list = FALSE;
7862 byte attr_top = 0, char_left = 0;
7870 Term_get_size(&wid, &hgt);
7872 browser_rows = hgt - 8;
7874 /* Allocate the "mon_idx" array */
7875 C_MAKE(mon_idx, max_r_idx, s16b);
7880 if (direct_r_idx < 0)
7882 mode = visual_only ? 0x03 : 0x01;
7884 /* Check every group */
7885 for (i = 0; monster_group_text[i] != NULL; i++)
7887 /* Measure the label */
7888 len = strlen(monster_group_text[i]);
7890 /* Save the maximum length */
7891 if (len > max) max = len;
7893 /* See if any monsters are known */
7894 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
7896 /* Build a list of groups with known monsters */
7897 grp_idx[grp_cnt++] = i;
7905 mon_idx[0] = direct_r_idx;
7908 /* Terminate the list */
7911 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7912 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
7915 /* Terminate the list */
7916 grp_idx[grp_cnt] = -1;
7919 grp_cur = grp_top = 0;
7920 mon_cur = mon_top = 0;
7925 mode = visual_only ? 0x02 : 0x00;
7930 monster_race *r_ptr;
7937 prt(format("%s - ¥â¥ó¥¹¥¿¡¼", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
7938 if (direct_r_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
7939 prt("̾Á°", 4, max + 3);
7940 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7942 if (!visual_only) prt("»¦³²¿ô", 4, 72);
7944 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7945 if (direct_r_idx < 0) prt("Group", 4, 0);
7946 prt("Name", 4, max + 3);
7947 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7949 if (!visual_only) prt("Kills", 4, 73);
7952 for (i = 0; i < 78; i++)
7954 Term_putch(i, 5, TERM_WHITE, '=');
7957 if (direct_r_idx < 0)
7959 for (i = 0; i < browser_rows; i++)
7961 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7968 if (direct_r_idx < 0)
7970 /* Scroll group list */
7971 if (grp_cur < grp_top) grp_top = grp_cur;
7972 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7974 /* Display a list of monster groups */
7975 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7977 if (old_grp_cur != grp_cur)
7979 old_grp_cur = grp_cur;
7981 /* Get a list of monsters in the current group */
7982 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
7985 /* Scroll monster list */
7986 while (mon_cur < mon_top)
7987 mon_top = MAX(0, mon_top - browser_rows/2);
7988 while (mon_cur >= mon_top + browser_rows)
7989 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7994 /* Display a list of monsters in the current group */
7995 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
8001 /* Display a monster name */
8002 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
8004 /* Display visual list below first monster */
8005 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8010 prt(format("<Êý¸þ>%s%s%s, ESC",
8011 (!visual_list && !visual_only) ? ", 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë" : "",
8012 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8013 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8016 prt(format("<dir>%s%s%s, ESC",
8017 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8018 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8019 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8023 /* Get the current monster */
8024 r_ptr = &r_info[mon_idx[mon_cur]];
8028 /* Mega Hack -- track this monster race */
8029 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
8031 /* Hack -- handle stuff */
8037 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
8041 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8045 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
8050 /* Do visual mode command if needed */
8051 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))
8053 if (direct_r_idx >= 0)
8078 /* Recall on screen */
8079 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
8081 screen_roff(mon_idx[mon_cur], 0);
8092 /* Move the cursor */
8093 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
8100 /* Free the "mon_idx" array */
8101 C_KILL(mon_idx, max_r_idx, s16b);
8106 * Display the objects in a group.
8108 static void display_object_list(int col, int row, int per_page, int object_idx[],
8109 int object_cur, int object_top, bool visual_only)
8113 /* Display lines until done */
8114 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
8118 object_kind *flavor_k_ptr;
8120 /* Get the object index */
8121 int k_idx = object_idx[object_top + i];
8123 /* Access the object */
8124 object_kind *k_ptr = &k_info[k_idx];
8126 /* Choose a color */
8127 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
8128 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
8131 if (!visual_only && k_ptr->flavor)
8133 /* Appearance of this object is shuffled */
8134 flavor_k_ptr = &k_info[k_ptr->flavor];
8138 /* Appearance of this object is very normal */
8139 flavor_k_ptr = k_ptr;
8144 attr = ((i + object_top == object_cur) ? cursor : attr);
8146 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
8149 strip_name(o_name, k_idx);
8154 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
8157 /* Display the name */
8158 c_prt(attr, o_name, row + i, col);
8160 /* Hack -- visual_list mode */
8163 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);
8165 if (p_ptr->wizard || visual_only)
8167 c_prt(attr, format("%d", k_idx), row + i, 70);
8170 a = flavor_k_ptr->x_attr;
8171 c = flavor_k_ptr->x_char;
8173 /* Display symbol */
8174 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
8177 /* Clear remaining lines */
8178 for (; i < per_page; i++)
8180 Term_erase(col, row + i, 255);
8185 * Describe fake object
8187 static void desc_obj_fake(int k_idx)
8190 object_type object_type_body;
8192 /* Get local object */
8193 o_ptr = &object_type_body;
8195 /* Wipe the object */
8198 /* Create the artifact */
8199 object_prep(o_ptr, k_idx);
8201 /* It's fully know */
8202 o_ptr->ident |= IDENT_KNOWN;
8204 /* Track the object */
8205 /* object_actual_track(o_ptr); */
8207 /* Hack - mark as fake */
8208 /* term_obj_real = FALSE; */
8210 /* Hack -- Handle stuff */
8213 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
8216 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
8218 msg_print("You see nothing special.");
8227 * Display known objects
8229 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
8232 int grp_cur, grp_top, old_grp_cur;
8233 int object_old, object_cur, object_top;
8234 int grp_cnt, grp_idx[100];
8242 bool visual_list = FALSE;
8243 byte attr_top = 0, char_left = 0;
8251 Term_get_size(&wid, &hgt);
8253 browser_rows = hgt - 8;
8255 /* Allocate the "object_idx" array */
8256 C_MAKE(object_idx, max_k_idx, int);
8261 if (direct_k_idx < 0)
8263 mode = visual_only ? 0x03 : 0x01;
8265 /* Check every group */
8266 for (i = 0; object_group_text[i] != NULL; i++)
8268 /* Measure the label */
8269 len = strlen(object_group_text[i]);
8271 /* Save the maximum length */
8272 if (len > max) max = len;
8274 /* See if any monsters are known */
8275 if (collect_objects(i, object_idx, mode))
8277 /* Build a list of groups with known monsters */
8278 grp_idx[grp_cnt++] = i;
8287 object_kind *k_ptr = &k_info[direct_k_idx];
8288 object_kind *flavor_k_ptr;
8290 if (!visual_only && k_ptr->flavor)
8292 /* Appearance of this object is shuffled */
8293 flavor_k_ptr = &k_info[k_ptr->flavor];
8297 /* Appearance of this object is very normal */
8298 flavor_k_ptr = k_ptr;
8301 object_idx[0] = direct_k_idx;
8302 object_old = direct_k_idx;
8305 /* Terminate the list */
8308 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8309 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
8312 /* Terminate the list */
8313 grp_idx[grp_cnt] = -1;
8316 grp_cur = grp_top = 0;
8317 object_cur = object_top = 0;
8322 mode = visual_only ? 0x02 : 0x00;
8327 object_kind *k_ptr, *flavor_k_ptr;
8334 prt(format("%s - ¥¢¥¤¥Æ¥à", !visual_only ? "Ãμ±" : "ɽ¼¨"), 2, 0);
8335 if (direct_k_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8336 prt("̾Á°", 4, max + 3);
8337 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8340 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
8341 if (direct_k_idx < 0) prt("Group", 4, 0);
8342 prt("Name", 4, max + 3);
8343 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
8347 for (i = 0; i < 78; i++)
8349 Term_putch(i, 5, TERM_WHITE, '=');
8352 if (direct_k_idx < 0)
8354 for (i = 0; i < browser_rows; i++)
8356 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8363 if (direct_k_idx < 0)
8365 /* Scroll group list */
8366 if (grp_cur < grp_top) grp_top = grp_cur;
8367 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8369 /* Display a list of object groups */
8370 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8372 if (old_grp_cur != grp_cur)
8374 old_grp_cur = grp_cur;
8376 /* Get a list of objects in the current group */
8377 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
8380 /* Scroll object list */
8381 while (object_cur < object_top)
8382 object_top = MAX(0, object_top - browser_rows/2);
8383 while (object_cur >= object_top + browser_rows)
8384 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8389 /* Display a list of objects in the current group */
8390 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
8394 object_top = object_cur;
8396 /* Display a list of objects in the current group */
8397 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
8399 /* Display visual list below first object */
8400 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8403 /* Get the current object */
8404 k_ptr = &k_info[object_idx[object_cur]];
8406 if (!visual_only && k_ptr->flavor)
8408 /* Appearance of this object is shuffled */
8409 flavor_k_ptr = &k_info[k_ptr->flavor];
8413 /* Appearance of this object is very normal */
8414 flavor_k_ptr = k_ptr;
8419 prt(format("<Êý¸þ>%s%s%s, ESC",
8420 (!visual_list && !visual_only) ? ", 'r'¤Ç¾ÜºÙ¤ò¸«¤ë" : "",
8421 visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8422 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8425 prt(format("<dir>%s%s%s, ESC",
8426 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
8427 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
8428 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8434 /* Mega Hack -- track this object */
8435 if (object_cnt) object_kind_track(object_idx[object_cur]);
8437 /* The "current" object changed */
8438 if (object_old != object_idx[object_cur])
8440 /* Hack -- handle stuff */
8443 /* Remember the "current" object */
8444 object_old = object_idx[object_cur];
8450 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
8454 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8458 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8463 /* Do visual mode command if needed */
8464 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))
8466 if (direct_k_idx >= 0)
8491 /* Recall on screen */
8492 if (!visual_list && !visual_only && (grp_cnt > 0))
8494 desc_obj_fake(object_idx[object_cur]);
8502 /* Move the cursor */
8503 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8509 /* Free the "object_idx" array */
8510 C_KILL(object_idx, max_k_idx, int);
8515 * Display the features in a group.
8517 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8518 int feat_cur, int feat_top, bool visual_only, int lighting_level)
8520 int lit_col[F_LIT_MAX], i, j;
8521 int f_idx_col = use_bigtile ? 62 : 64;
8523 /* Correct columns 1 and 4 */
8524 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
8525 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8526 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
8528 /* Display lines until done */
8529 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
8534 int f_idx = feat_idx[feat_top + i];
8536 /* Access the index */
8537 feature_type *f_ptr = &f_info[f_idx];
8539 int row_i = row + i;
8541 /* Choose a color */
8542 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8544 /* Display the name */
8545 c_prt(attr, f_name + f_ptr->name, row_i, col);
8547 /* Hack -- visual_list mode */
8550 /* Display lighting level */
8551 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
8553 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));
8555 if (p_ptr->wizard || visual_only)
8557 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
8560 /* Display symbol */
8561 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);
8563 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
8564 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
8566 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
8568 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
8570 /* Mega-hack -- Use non-standard colour */
8571 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
8573 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
8577 /* Clear remaining lines */
8578 for (; i < per_page; i++)
8580 Term_erase(col, row + i, 255);
8586 * Interact with feature visuals.
8588 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
8591 int grp_cur, grp_top, old_grp_cur;
8592 int feat_cur, feat_top;
8593 int grp_cnt, grp_idx[100];
8601 bool visual_list = FALSE;
8602 byte attr_top = 0, char_left = 0;
8607 byte attr_old[F_LIT_MAX];
8608 byte char_old[F_LIT_MAX];
8609 byte *cur_attr_ptr, *cur_char_ptr;
8611 C_WIPE(attr_old, F_LIT_MAX, byte);
8612 C_WIPE(char_old, F_LIT_MAX, byte);
8615 Term_get_size(&wid, &hgt);
8617 browser_rows = hgt - 8;
8619 /* Allocate the "feat_idx" array */
8620 C_MAKE(feat_idx, max_f_idx, int);
8625 if (direct_f_idx < 0)
8627 /* Check every group */
8628 for (i = 0; feature_group_text[i] != NULL; i++)
8630 /* Measure the label */
8631 len = strlen(feature_group_text[i]);
8633 /* Save the maximum length */
8634 if (len > max) max = len;
8636 /* See if any features are known */
8637 if (collect_features(i, feat_idx, 0x01))
8639 /* Build a list of groups with known features */
8640 grp_idx[grp_cnt++] = i;
8648 feature_type *f_ptr = &f_info[direct_f_idx];
8650 feat_idx[0] = direct_f_idx;
8653 /* Terminate the list */
8656 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
8657 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
8659 for (i = 0; i < F_LIT_MAX; i++)
8661 attr_old[i] = f_ptr->x_attr[i];
8662 char_old[i] = f_ptr->x_char[i];
8666 /* Terminate the list */
8667 grp_idx[grp_cnt] = -1;
8670 grp_cur = grp_top = 0;
8671 feat_cur = feat_top = 0;
8679 feature_type *f_ptr;
8686 prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
8687 if (direct_f_idx < 0) prt("¥°¥ë¡¼¥×", 4, 0);
8688 prt("̾Á°", 4, max + 3);
8691 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8692 prt("ʸ»ú ( l/ d)", 4, 66);
8696 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8697 prt("ʸ»ú (l/d)", 4, 68);
8700 prt("Visuals - features", 2, 0);
8701 if (direct_f_idx < 0) prt("Group", 4, 0);
8702 prt("Name", 4, max + 3);
8705 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
8706 prt("Sym ( l/ d)", 4, 67);
8710 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
8711 prt("Sym (l/d)", 4, 69);
8715 for (i = 0; i < 78; i++)
8717 Term_putch(i, 5, TERM_WHITE, '=');
8720 if (direct_f_idx < 0)
8722 for (i = 0; i < browser_rows; i++)
8724 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8731 if (direct_f_idx < 0)
8733 /* Scroll group list */
8734 if (grp_cur < grp_top) grp_top = grp_cur;
8735 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8737 /* Display a list of feature groups */
8738 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8740 if (old_grp_cur != grp_cur)
8742 old_grp_cur = grp_cur;
8744 /* Get a list of features in the current group */
8745 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
8748 /* Scroll feature list */
8749 while (feat_cur < feat_top)
8750 feat_top = MAX(0, feat_top - browser_rows/2);
8751 while (feat_cur >= feat_top + browser_rows)
8752 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8757 /* Display a list of features in the current group */
8758 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
8762 feat_top = feat_cur;
8764 /* Display a list of features in the current group */
8765 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
8767 /* Display visual list below first object */
8768 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8773 prt(format("<Êý¸þ>%s, 'd'¤Çɸ½à¸÷¸»¸ú²Ì%s, ESC",
8774 visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹",
8775 (attr_idx || char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"),
8778 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
8779 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
8780 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
8784 /* Get the current feature */
8785 f_ptr = &f_info[feat_idx[feat_cur]];
8786 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
8787 cur_char_ptr = &f_ptr->x_char[*lighting_level];
8791 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
8795 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8799 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8804 if (visual_list && ((ch == 'A') || (ch == 'a')))
8806 int prev_lighting_level = *lighting_level;
8810 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
8811 else (*lighting_level)--;
8815 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
8816 else (*lighting_level)++;
8819 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
8820 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8822 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
8823 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8828 else if ((ch == 'D') || (ch == 'd'))
8830 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
8831 byte prev_x_char = f_ptr->x_char[*lighting_level];
8833 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
8837 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
8838 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
8840 if (prev_x_char != f_ptr->x_char[*lighting_level])
8841 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
8843 else *need_redraw = TRUE;
8848 /* Do visual mode command if needed */
8849 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))
8853 /* Restore previous visual settings */
8855 for (i = 0; i < F_LIT_MAX; i++)
8857 f_ptr->x_attr[i] = attr_old[i];
8858 f_ptr->x_char[i] = char_old[i];
8865 if (direct_f_idx >= 0) flag = TRUE;
8866 else *lighting_level = F_LIT_STANDARD;
8869 /* Preserve current visual settings */
8872 for (i = 0; i < F_LIT_MAX; i++)
8874 attr_old[i] = f_ptr->x_attr[i];
8875 char_old[i] = f_ptr->x_char[i];
8877 *lighting_level = F_LIT_STANDARD;
8884 for (i = 0; i < F_LIT_MAX; i++)
8886 attr_idx_feat[i] = f_ptr->x_attr[i];
8887 char_idx_feat[i] = f_ptr->x_char[i];
8896 /* Allow TERM_DARK text */
8897 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
8899 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
8900 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
8918 /* Move the cursor */
8919 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8925 /* Free the "feat_idx" array */
8926 C_KILL(feat_idx, max_f_idx, int);
8931 * List wanted monsters
8933 static void do_cmd_knowledge_kubi(void)
8938 char file_name[1024];
8941 /* Open a new file */
8942 fff = my_fopen_temp(file_name, 1024);
8945 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8947 msg_format("Failed to create temporary file %s.", file_name);
8955 bool listed = FALSE;
8958 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8960 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8962 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8964 fprintf(fff, "List of wanted monsters\n");
8966 fprintf(fff, "----------------------------------------------\n");
8968 for (i = 0; i < MAX_KUBI; i++)
8970 if (kubi_r_idx[i] <= 10000)
8972 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8981 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
8983 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
8988 /* Close the file */
8991 /* Display the file contents */
8993 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8995 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8999 /* Remove the file */
9004 * List virtues & status
9006 static void do_cmd_knowledge_virtues(void)
9010 char file_name[1024];
9013 /* Open a new file */
9014 fff = my_fopen_temp(file_name, 1024);
9017 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9019 msg_format("Failed to create temporary file %s.", file_name);
9028 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
9030 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
9035 /* Close the file */
9038 /* Display the file contents */
9040 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
9042 show_file(TRUE, file_name, "Virtues", 0, 0);
9046 /* Remove the file */
9054 static void do_cmd_knowledge_dungeon(void)
9058 char file_name[1024];
9062 /* Open a new file */
9063 fff = my_fopen_temp(file_name, 1024);
9066 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9068 msg_format("Failed to create temporary file %s.", file_name);
9076 for (i = 1; i < max_d_idx; i++)
9080 if (!d_info[i].maxdepth) continue;
9081 if (!max_dlv[i]) continue;
9082 if (d_info[i].final_guardian)
9084 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
9086 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
9088 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9090 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
9095 /* Close the file */
9098 /* Display the file contents */
9100 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
9102 show_file(TRUE, file_name, "Dungeon", 0, 0);
9106 /* Remove the file */
9111 * List virtues & status
9114 static void do_cmd_knowledge_stat(void)
9118 char file_name[1024];
9121 /* Open a new file */
9122 fff = my_fopen_temp(file_name, 1024);
9125 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9127 msg_format("Failed to create temporary file %s.", file_name);
9135 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
9136 (2 * p_ptr->hitdie +
9137 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
9140 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
9141 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
9142 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
9144 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
9145 else fprintf(fff, "Your current Life Rating is ???.\n\n");
9146 fprintf(fff, "Limits of maximum stats\n\n");
9148 for (v_nr = 0; v_nr < 6; v_nr++)
9150 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);
9151 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
9157 /* Close the file */
9160 /* Display the file contents */
9162 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
9164 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
9168 /* Remove the file */
9174 * Print all active quests
9176 static void do_cmd_knowledge_quests_current(FILE *fff)
9179 char rand_tmp_str[120] = "\0";
9181 monster_race *r_ptr;
9183 int rand_level = 100;
9187 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
9189 fprintf(fff, "< Current Quest >\n");
9192 for (i = 1; i < max_quests; i++)
9194 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
9196 /* Set the quest number temporary */
9197 int old_quest = p_ptr->inside_quest;
9200 /* Clear the text */
9201 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
9202 quest_text_line = 0;
9204 p_ptr->inside_quest = i;
9206 /* Get the quest text */
9207 init_flags = INIT_SHOW_TEXT;
9209 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9211 /* Reset the old quest number */
9212 p_ptr->inside_quest = old_quest;
9214 /* No info from "silent" quests */
9215 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9219 if (quest[i].type != QUEST_TYPE_RANDOM)
9221 char note[80] = "\0";
9223 if (quest[i].status == QUEST_STATUS_TAKEN)
9225 switch (quest[i].type)
9227 case QUEST_TYPE_KILL_LEVEL:
9228 case QUEST_TYPE_KILL_ANY_LEVEL:
9229 r_ptr = &r_info[quest[i].r_idx];
9230 strcpy(name, r_name + r_ptr->name);
9231 if (quest[i].max_num > 1)
9234 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9235 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9238 sprintf(note," - kill %d %s, have killed %d.",
9239 quest[i].max_num, name, quest[i].cur_num);
9244 sprintf(note," - %s¤òÅݤ¹¡£",name);
9246 sprintf(note," - kill %s.",name);
9250 case QUEST_TYPE_FIND_ARTIFACT:
9251 strcpy(name, a_name + a_info[quest[i].k_idx].name);
9253 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
9255 sprintf(note," - Find out %s.", name);
9259 case QUEST_TYPE_FIND_EXIT:
9261 sprintf(note," - õº÷¤¹¤ë¡£");
9263 sprintf(note," - Search.");
9267 case QUEST_TYPE_KILL_NUMBER:
9269 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
9270 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
9272 sprintf(note," - Kill %d monsters, have killed %d.",
9273 quest[i].max_num, quest[i].cur_num);
9277 case QUEST_TYPE_KILL_ALL:
9279 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
9281 sprintf(note," - Kill all monsters.");
9287 /* Print the quest info */
9289 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
9290 quest[i].name, quest[i].level, note);
9292 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
9293 quest[i].name, quest[i].level, note);
9296 fprintf(fff, tmp_str);
9298 if (quest[i].status == QUEST_STATUS_COMPLETED)
9301 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
9303 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
9305 fprintf(fff, tmp_str);
9311 while (quest_text[j][0] && j < 10)
9313 fprintf(fff, " %s\n", quest_text[j]);
9318 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
9321 rand_level = quest[i].level;
9323 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
9325 /* Print the quest info */
9326 r_ptr = &r_info[quest[i].r_idx];
9327 strcpy(name, r_name + r_ptr->name);
9329 if (quest[i].max_num > 1)
9332 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
9333 quest[i].name, quest[i].level,
9334 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
9338 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
9339 quest[i].name, quest[i].level,
9340 quest[i].max_num, name, quest[i].cur_num);
9346 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
9347 quest[i].name, quest[i].level, name);
9349 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
9350 quest[i].name, quest[i].level, name);
9358 /* Print the current random quest */
9359 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
9362 if (!total) fprintf(fff, " ¤Ê¤·\n");
9364 if (!total) fprintf(fff, " Nothing.\n");
9370 * Print all finished quests
9372 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
9379 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9381 fprintf(fff, "< Completed Quest >\n");
9383 for (i = 1; i < max_quests; i++)
9385 int q_idx = quest_num[i];
9387 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
9389 if (is_fixed_quest_idx(q_idx))
9391 /* Set the quest number temporary */
9392 int old_quest = p_ptr->inside_quest;
9394 p_ptr->inside_quest = q_idx;
9397 init_flags = INIT_ASSIGN;
9399 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9401 /* Reset the old quest number */
9402 p_ptr->inside_quest = old_quest;
9404 /* No info from "silent" quests */
9405 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9410 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9412 /* Print the quest info */
9414 if (quest[q_idx].complev == 0)
9418 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
9420 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
9422 r_name+r_info[quest[q_idx].r_idx].name,
9423 quest[q_idx].level);
9429 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9431 " %-40s (Dungeon level: %3d) - level %2d\n",
9433 r_name+r_info[quest[q_idx].r_idx].name,
9435 quest[q_idx].complev);
9440 /* Print the quest info */
9442 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9443 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9445 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9446 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9450 fprintf(fff, tmp_str);
9454 if (!total) fprintf(fff, " ¤Ê¤·\n");
9456 if (!total) fprintf(fff, " Nothing.\n");
9462 * Print all failed quests
9464 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
9471 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
9473 fprintf(fff, "< Failed Quest >\n");
9475 for (i = 1; i < max_quests; i++)
9477 int q_idx = quest_num[i];
9479 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
9481 if (is_fixed_quest_idx(q_idx))
9483 /* Set the quest number temporary */
9484 int old_quest = p_ptr->inside_quest;
9486 p_ptr->inside_quest = q_idx;
9488 /* Get the quest text */
9489 init_flags = INIT_ASSIGN;
9491 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
9493 /* Reset the old quest number */
9494 p_ptr->inside_quest = old_quest;
9496 /* No info from "silent" quests */
9497 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
9502 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
9504 /* Print the quest info */
9506 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
9507 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9509 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
9510 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
9515 /* Print the quest info */
9517 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
9518 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9520 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
9521 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
9524 fprintf(fff, tmp_str);
9528 if (!total) fprintf(fff, " ¤Ê¤·\n");
9530 if (!total) fprintf(fff, " Nothing.\n");
9536 * Print all random quests
9538 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9545 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9547 fprintf(fff, "< Remaining Random Quest >\n");
9549 for (i = 1; i < max_quests; i++)
9551 /* No info from "silent" quests */
9552 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9554 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9558 /* Print the quest info */
9560 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9561 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9563 sprintf(tmp_str, " %s (%d, %s)\n",
9564 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9566 fprintf(fff, tmp_str);
9570 if (!total) fprintf(fff, " ¤Ê¤·\n");
9572 if (!total) fprintf(fff, " Nothing.\n");
9577 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9579 int *q_num = (int *)u;
9580 quest_type *qa = &quest[q_num[a]];
9581 quest_type *qb = &quest[q_num[b]];
9586 if (qa->complev < qb->complev) return TRUE;
9587 if (qa->complev > qb->complev) return FALSE;
9588 if (qa->level <= qb->level) return TRUE;
9592 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9594 int *q_num = (int *)u;
9601 q_num[a] = q_num[b];
9607 * Print quest status of all active quests
9609 static void do_cmd_knowledge_quests(void)
9612 char file_name[1024];
9613 int *quest_num, dummy, i;
9615 /* Open a new file */
9616 fff = my_fopen_temp(file_name, 1024);
9620 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9622 msg_format("Failed to create temporary file %s.", file_name);
9628 /* Allocate Memory */
9629 C_MAKE(quest_num, max_quests, int);
9631 /* Sort by compete level */
9632 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9633 ang_sort_comp = ang_sort_comp_quest_num;
9634 ang_sort_swap = ang_sort_swap_quest_num;
9635 ang_sort(quest_num, &dummy, max_quests);
9637 /* Dump Quest Information */
9638 do_cmd_knowledge_quests_current(fff);
9640 do_cmd_knowledge_quests_completed(fff, quest_num);
9642 do_cmd_knowledge_quests_failed(fff, quest_num);
9646 do_cmd_knowledge_quests_wiz_random(fff);
9649 /* Close the file */
9652 /* Display the file contents */
9654 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9656 show_file(TRUE, file_name, "Quest status", 0, 0);
9659 /* Remove the file */
9663 C_KILL(quest_num, max_quests, int);
9670 static void do_cmd_knowledge_home(void)
9675 char file_name[1024];
9677 char o_name[MAX_NLEN];
9680 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9682 /* Open a new file */
9683 fff = my_fopen_temp(file_name, 1024);
9686 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9688 msg_format("Failed to create temporary file %s.", file_name);
9696 /* Print all homes in the different towns */
9697 st_ptr = &town[1].store[STORE_HOME];
9699 /* Home -- if anything there */
9700 if (st_ptr->stock_num)
9705 /* Header with name of the town */
9707 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9709 fprintf(fff, " [Home Inventory]\n");
9712 /* Dump all available items */
9713 for (i = 0; i < st_ptr->stock_num; i++)
9716 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9717 object_desc(o_name, &st_ptr->stock[i], 0);
9718 if (strlen(o_name) <= 80-3)
9720 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9726 for (n = 0, t = o_name; n < 80-3; n++, t++)
9727 if(iskanji(*t)) {t++; n++;}
9728 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9730 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9731 fprintf(fff, " %.77s\n", o_name+n);
9734 object_desc(o_name, &st_ptr->stock[i], 0);
9735 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9740 /* Add an empty line */
9741 fprintf(fff, "\n\n");
9745 /* Close the file */
9748 /* Display the file contents */
9750 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9752 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9756 /* Remove the file */
9762 * Check the status of "autopick"
9764 static void do_cmd_knowledge_autopick(void)
9768 char file_name[1024];
9770 /* Open a new file */
9771 fff = my_fopen_temp(file_name, 1024);
9776 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9778 msg_format("Failed to create temporary file %s.", file_name);
9787 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9789 fprintf(fff, "No preference for auto picker/destroyer.");
9795 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9797 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9801 for (k = 0; k < max_autopick; k++)
9804 byte act = autopick_list[k].action;
9805 if (act & DONT_AUTOPICK)
9813 else if (act & DO_AUTODESTROY)
9821 else if (act & DO_AUTOPICK)
9829 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9838 if (act & DO_DISPLAY)
9839 fprintf(fff, "%11s", format("[%s]", tmp));
9841 fprintf(fff, "%11s", format("(%s)", tmp));
9843 tmp = autopick_line_from_entry(&autopick_list[k]);
9844 fprintf(fff, " %s", tmp);
9848 /* Close the file */
9850 /* Display the file contents */
9852 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9854 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9857 /* Remove the file */
9863 * Interact with "knowledge"
9865 void do_cmd_knowledge(void)
9868 bool need_redraw = FALSE;
9870 /* File type is "TEXT" */
9871 FILE_TYPE(FILE_TYPE_TEXT);
9873 /* Save the screen */
9876 /* Interact until done */
9882 /* Ask for a choice */
9884 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9885 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9887 prt(format("page %d/2", (p+1)), 2, 65);
9888 prt("Display current knowledge", 3, 0);
9891 /* Give some choices */
9895 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9896 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9897 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9898 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9899 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9900 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9901 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9902 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9903 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9904 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9908 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9909 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9910 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9911 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9912 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9913 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9914 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9915 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9916 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9921 prt("(1) Display known artifacts", 6, 5);
9922 prt("(2) Display known objects", 7, 5);
9923 prt("(3) Display remaining uniques", 8, 5);
9924 prt("(4) Display known monster", 9, 5);
9925 prt("(5) Display kill count", 10, 5);
9926 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9927 prt("(7) Display current pets", 12, 5);
9928 prt("(8) Display home inventory", 13, 5);
9929 prt("(9) Display *identified* equip.", 14, 5);
9930 prt("(0) Display terrain symbols.", 15, 5);
9934 prt("(a) Display about yourself", 6, 5);
9935 prt("(b) Display mutations", 7, 5);
9936 prt("(c) Display weapon proficiency", 8, 5);
9937 prt("(d) Display spell proficiency", 9, 5);
9938 prt("(e) Display misc. proficiency", 10, 5);
9939 prt("(f) Display virtues", 11, 5);
9940 prt("(g) Display dungeons", 12, 5);
9941 prt("(h) Display current quests", 13, 5);
9942 prt("(i) Display auto pick/destroy", 14, 5);
9947 prt("-³¤¯-", 17, 8);
9948 prt("ESC) È´¤±¤ë", 21, 1);
9949 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9950 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9951 prt("¥³¥Þ¥ó¥É:", 20, 0);
9953 prt("-more-", 17, 8);
9954 prt("ESC) Exit menu", 21, 1);
9955 prt("SPACE) Next page", 21, 30);
9956 /*prt("-) Previous page", 21, 60);*/
9957 prt("Command: ", 20, 0);
9964 if (i == ESCAPE) break;
9967 case ' ': /* Page change */
9971 case '1': /* Artifacts */
9972 do_cmd_knowledge_artifacts();
9974 case '2': /* Objects */
9975 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
9977 case '3': /* Uniques */
9978 do_cmd_knowledge_uniques();
9980 case '4': /* Monsters */
9981 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
9983 case '5': /* Kill count */
9984 do_cmd_knowledge_kill_count();
9986 case '6': /* wanted */
9987 if (!vanilla_town) do_cmd_knowledge_kubi();
9989 case '7': /* Pets */
9990 do_cmd_knowledge_pets();
9992 case '8': /* Home */
9993 do_cmd_knowledge_home();
9995 case '9': /* Resist list */
9996 do_cmd_knowledge_inven();
9998 case '0': /* Feature list */
10000 int lighting_level = F_LIT_STANDARD;
10001 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
10005 case 'a': /* Max stat */
10006 do_cmd_knowledge_stat();
10008 case 'b': /* Mutations */
10009 do_cmd_knowledge_mutations();
10011 case 'c': /* weapon-exp */
10012 do_cmd_knowledge_weapon_exp();
10014 case 'd': /* spell-exp */
10015 do_cmd_knowledge_spell_exp();
10017 case 'e': /* skill-exp */
10018 do_cmd_knowledge_skill_exp();
10020 case 'f': /* Virtues */
10021 do_cmd_knowledge_virtues();
10023 case 'g': /* Dungeon */
10024 do_cmd_knowledge_dungeon();
10026 case 'h': /* Quests */
10027 do_cmd_knowledge_quests();
10029 case 'i': /* Autopick */
10030 do_cmd_knowledge_autopick();
10032 default: /* Unknown option */
10036 /* Flush messages */
10040 /* Restore the screen */
10043 if (need_redraw) do_cmd_redraw();
10048 * Check on the status of an active quest
10050 void do_cmd_checkquest(void)
10052 /* File type is "TEXT" */
10053 FILE_TYPE(FILE_TYPE_TEXT);
10055 /* Save the screen */
10059 do_cmd_knowledge_quests();
10061 /* Restore the screen */
10067 * Display the time and date
10069 void do_cmd_time(void)
10071 int day, hour, min, full, start, end, num;
10079 extract_day_hour_min(&day, &hour, &min);
10081 full = hour * 100 + min;
10089 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
10091 strcpy(desc, "It is a strange time.");
10095 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
10096 else strcpy(day_buf, "*****");
10100 msg_format("%sÆüÌÜ, »þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
10101 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10102 min, (hour < 12) ? "AM" : "PM");
10104 msg_format("This is day %s. The time is %d:%02d %s.",
10105 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
10106 min, (hour < 12) ? "AM" : "PM");
10110 /* Find the path */
10111 if (!randint0(10) || p_ptr->image)
10114 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
10116 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
10123 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
10125 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
10130 /* Open this file */
10131 fff = my_fopen(buf, "rt");
10136 /* Find this time */
10137 while (!my_fgets(fff, buf, sizeof(buf)))
10139 /* Ignore comments */
10140 if (!buf[0] || (buf[0] == '#')) continue;
10142 /* Ignore invalid lines */
10143 if (buf[1] != ':') continue;
10145 /* Process 'Start' */
10148 /* Extract the starting time */
10149 start = atoi(buf + 2);
10151 /* Assume valid for an hour */
10158 /* Process 'End' */
10161 /* Extract the ending time */
10162 end = atoi(buf + 2);
10168 /* Ignore incorrect range */
10169 if ((start > full) || (full > end)) continue;
10171 /* Process 'Description' */
10176 /* Apply the randomizer */
10177 if (!randint0(num)) strcpy(desc, buf + 2);
10187 /* Close the file */