4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Interface commands */
18 * A set of functions to maintain automatic dumps of various kinds.
21 * remove_auto_dump(orig_file, mark)
22 * Remove the old automatic dump of type "mark".
23 * auto_dump_printf(fmt, ...)
24 * Dump a formatted string using fprintf().
25 * open_auto_dump(buf, mark)
26 * Open a file, remove old dump, and add new header.
27 * close_auto_dump(void)
28 * Add a footer, and close the file.
30 * The dump commands of original Angband simply add new lines to
31 * existing files; these files will become bigger and bigger unless
32 * an user deletes some or all of these files by hand at some
35 * These three functions automatically delete old dumped lines
36 * before adding new ones. Since there are various kinds of automatic
37 * dumps in a single file, we add a header and a footer with a type
38 * name for every automatic dump, and kill old lines only when the
39 * lines have the correct type of header and footer.
41 * We need to be quite paranoid about correctness; the user might
42 * (mistakenly) edit the file by hand, and see all their work come
43 * to nothing on the next auto dump otherwise. The current code only
44 * detects changes by noting inconsistencies between the actual number
45 * of lines and the number written in the footer. Note that this will
46 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
63 * Remove old lines automatically generated before.
65 static void remove_auto_dump(cptr orig_file)
67 FILE *tmp_fff, *orig_fff;
71 bool between_mark = FALSE;
74 long header_location = 0;
75 char header_mark_str[80];
76 char footer_mark_str[80];
79 /* Prepare a header/footer mark string */
80 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
81 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
83 mark_len = strlen(footer_mark_str);
85 /* Open an old dump file in read-only mode */
86 orig_fff = my_fopen(orig_file, "r");
88 /* If original file does not exist, nothing to do */
89 if (!orig_fff) return;
91 /* Open a new (temporary) file */
92 tmp_fff = my_fopen_temp(tmp_file, 1024);
97 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", tmp_file);
99 msg_format("Failed to create temporary file %s.", tmp_file);
105 /* Loop for every line */
109 if (my_fgets(orig_fff, buf, sizeof(buf)))
111 /* Read error: Assume End of File */
114 * Was looking for the footer, but not found.
116 * Since automatic dump might be edited by hand,
117 * it's dangerous to kill these lines.
118 * Seek back to the next line of the (pseudo) header,
123 fseek(orig_fff, header_location, SEEK_SET);
124 between_mark = FALSE;
128 /* Success -- End the loop */
135 /* We are looking for the header mark of automatic dump */
138 /* Is this line a header? */
139 if (!strcmp(buf, header_mark_str))
141 /* Memorise seek point of this line */
142 header_location = ftell(orig_fff);
144 /* Initialize counter for number of lines */
147 /* Look for the footer from now */
150 /* There are some changes */
157 /* Copy orginally lines */
158 fprintf(tmp_fff, "%s\n", buf);
162 /* We are looking for the footer mark of automatic dump */
165 /* Is this line a footer? */
166 if (!strncmp(buf, footer_mark_str, mark_len))
171 * Compare the number of lines
173 * If there is an inconsistency between
174 * actual number of lines and the
175 * number here, the automatic dump
176 * might be edited by hand. So it's
177 * dangerous to kill these lines.
178 * Seek back to the next line of the
179 * (pseudo) header, and read again.
181 if (!sscanf(buf + mark_len, " (%d)", &tmp)
184 fseek(orig_fff, header_location, SEEK_SET);
187 /* Look for another header */
188 between_mark = FALSE;
194 /* Ignore old line, and count number of lines */
204 /* If there are some changes, overwrite the original file with new one */
207 /* Copy contents of temporary file */
209 tmp_fff = my_fopen(tmp_file, "r");
210 orig_fff = my_fopen(orig_file, "w");
212 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
213 fprintf(orig_fff, "%s\n", buf);
219 /* Kill the temporary file */
227 * Dump a formatted line, using "vstrnfmt()".
229 static void auto_dump_printf(cptr fmt, ...)
236 /* Begin the Varargs Stuff */
239 /* Format the args, save the length */
240 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
242 /* End the Varargs Stuff */
245 /* Count number of lines */
246 for (p = buf; *p; p++)
248 if (*p == '\n') auto_dump_line_num++;
252 fprintf(auto_dump_stream, "%s", buf);
257 * Open file to append auto dump.
259 static bool open_auto_dump(cptr buf, cptr mark)
262 char header_mark_str[80];
264 /* Save the mark string */
265 auto_dump_mark = mark;
267 /* Prepare a header mark string */
268 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
270 /* Remove old macro dumps */
271 remove_auto_dump(buf);
273 /* Append to the file */
274 auto_dump_stream = my_fopen(buf, "a");
277 if (!auto_dump_stream) {
279 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
281 msg_format("Failed to open %s.", buf);
290 fprintf(auto_dump_stream, "%s\n", header_mark_str);
292 /* Initialize counter */
293 auto_dump_line_num = 0;
296 auto_dump_printf("# *·Ù¹ð!!* °Ê¹ß¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
297 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
299 auto_dump_printf("# *Warning!* The lines below are an automatic dump.\n");
300 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
308 * Append foot part and close auto dump.
310 static void close_auto_dump(void)
312 char footer_mark_str[80];
314 /* Prepare a footer mark string */
315 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
318 auto_dump_printf("# *·Ù¹ð!!* °Ê¾å¤Î¹Ô¤Ï¼«Æ°À¸À®¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£\n");
319 auto_dump_printf("# *·Ù¹ð!!* ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤ë¤Î¤ÇÊÔ½¸¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£\n");
321 auto_dump_printf("# *Warning!* The lines above are an automatic dump.\n");
322 auto_dump_printf("# Don't edit them; changes will be deleted and replaced automatically.\n");
326 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
329 my_fclose(auto_dump_stream);
337 * Return suffix of ordinal number
339 cptr get_ordinal_number_suffix(int num)
341 num = ABS(num) % 100;
345 return (num == 11) ? "th" : "st";
347 return (num == 12) ? "th" : "nd";
349 return (num == 13) ? "th" : "rd";
358 * Take note to the diary.
360 errr do_cmd_write_nikki(int type, int num, cptr note)
366 cptr note_level = "";
367 bool do_level = TRUE;
368 char note_level_buf[40];
371 static bool disable_nikki = FALSE;
373 extract_day_hour_min(&day, &hour, &min);
375 if (disable_nikki) return(-1);
377 if (type == NIKKI_FIX_QUEST_C ||
378 type == NIKKI_FIX_QUEST_F ||
379 type == NIKKI_RAND_QUEST_C ||
380 type == NIKKI_RAND_QUEST_F ||
381 type == NIKKI_TO_QUEST)
385 old_quest = p_ptr->inside_quest;
386 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
388 /* Get the quest text */
389 init_flags = INIT_ASSIGN;
391 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
393 /* Reset the old quest number */
394 p_ptr->inside_quest = old_quest;
398 sprintf(file_name,"playrecord-%s.txt",savefile_base);
400 /* different filne name to avoid mixing */
401 sprintf(file_name,"playrec-%s.txt",savefile_base);
404 /* Build the filename */
405 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
407 /* File type is "TEXT" */
408 FILE_TYPE(FILE_TYPE_TEXT);
410 fff = my_fopen(buf, "a");
416 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
418 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
425 q_idx = quest_number(dun_level);
429 if (p_ptr->inside_arena)
431 note_level = "¥¢¥ê¡¼¥Ê:";
433 note_level = "Arane:";
437 note_level = "ÃϾå:";
439 note_level = "Surface:";
441 else if (q_idx && (is_fixed_quest_idx(q_idx)
442 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
444 note_level = "¥¯¥¨¥¹¥È:";
446 note_level = "Quest:";
451 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
453 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
455 note_level = note_level_buf;
464 fprintf(fff, "%dÆüÌÜ\n",day);
466 fprintf(fff, "Day %d\n",day);
475 fprintf(fff, "%s\n",note);
479 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
485 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
487 fprintf(fff, " %2d:%02d %20s discovered %s.\n", hour, min, note_level, note);
494 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
496 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
500 case NIKKI_FIX_QUEST_C:
502 if (quest[num].flags & QUEST_FLAG_SILENT) break;
504 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
506 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
510 case NIKKI_FIX_QUEST_F:
512 if (quest[num].flags & QUEST_FLAG_SILENT) break;
514 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
516 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
520 case NIKKI_RAND_QUEST_C:
523 strcpy(name, r_name+r_info[quest[num].r_idx].name);
525 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
527 fprintf(fff, " %2d:%02d %20s completed randome quest '%s'\n", hour, min, note_level, name);
531 case NIKKI_RAND_QUEST_F:
534 strcpy(name, r_name+r_info[quest[num].r_idx].name);
536 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
538 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
542 case NIKKI_MAXDEAPTH:
545 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
547 fprintf(fff, " %2d:%02d %20s reached level %d of %s for the first time.\n", hour, min, note_level, num, d_name+d_info[dungeon_type].name);
554 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
556 fprintf(fff, " %2d:%02d %20s reset recall level of %s to %d %s.\n", hour, min, note_level, d_name + d_info[num].name, max_dlv[num], note);
563 if (q_idx && (is_fixed_quest_idx(q_idx)
564 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
575 if (!(dun_level+num)) to = "ÃϾå";
576 else to = format("%d³¬", dun_level+num);
578 if (!(dun_level+num)) to = "the surface";
579 else to = format("level %d", dun_level+num);
584 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
586 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
594 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
596 fprintf(fff, " %2d:%02d %20s recalled to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
600 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
602 fprintf(fff, " %2d:%02d %20s recalled from dungeon to surface.\n", hour, min, note_level);
608 if (quest[num].flags & QUEST_FLAG_SILENT) break;
610 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
612 fprintf(fff, " %2d:%02d %20s entered the quest '%s'.\n", hour, min, note_level, quest[num].name);
619 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
621 fprintf(fff, " %2d:%02d %20s Got out using teleport level.\n", hour, min, note_level);
628 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
630 fprintf(fff, " %2d:%02d %20s bought %s.\n", hour, min, note_level, note);
637 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
639 fprintf(fff, " %2d:%02d %20s sold %s.\n", hour, min, note_level, note);
648 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, -num, note);
651 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, get_ordinal_number_suffix(n));
656 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
658 fprintf(fff, " %2d:%02d %20s won the %d%s fight (%s).\n", hour, min, note_level, num, get_ordinal_number_suffix(num), note);
660 if (num == MAX_ARENA_MONS)
663 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
665 fprintf(fff, " won all fight to become a Chanpion.\n");
674 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
676 fprintf(fff, " %2d:%02d %20s identified %s.\n", hour, min, note_level, note);
691 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
693 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
697 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
699 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
714 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
716 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
720 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
722 fprintf(fff, " %2d:%02d %20s used Pattern to teleport to %s.\n", hour, min, note_level, to);
729 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
731 fprintf(fff, " %2d:%02d %20s reached player level %d.\n", hour, min, note_level, num);
735 case NIKKI_GAMESTART:
737 time_t ct = time((time_t*)0);
741 fprintf(fff, "%s %s",note, ctime(&ct));
744 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
747 case NIKKI_NAMED_PET:
749 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
754 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
756 fprintf(fff, "decided to travel together with %s.\n", note);
761 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
763 fprintf(fff, "unnamed %s.\n", note);
768 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
770 fprintf(fff, "dismissed %s.\n", note);
775 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
777 fprintf(fff, "%s died.\n", note);
782 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
784 fprintf(fff, "moved to another map leaving %s behind.\n", note);
789 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
791 fprintf(fff, "lost sight of %s.\n", note);
796 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
798 fprintf(fff, "%s was made disappeared by *destruction*.\n", note);
803 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
805 fprintf(fff, "%s was crushed by falling rocks.\n", note);
820 if (do_level) write_level = FALSE;
826 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
828 static void do_cmd_disp_nikki(void)
830 char nikki_title[256];
835 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
836 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
847 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
848 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
849 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
850 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
855 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
864 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
866 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
867 "Attack is the best form of defence.",
869 "An unexpected windfall",
870 "A drowning man will catch at a straw",
871 "Don't count your chickens before they are hatched.",
872 "It is no use crying over spilt milk.",
873 "Seeing is believing.",
874 "Strike the iron while it is hot.",
875 "I don't care what follows.",
876 "To dig a well to put out a house on fire.",
877 "Tomorrow is another day.",
878 "Easy come, easy go.",
879 "The more haste, the less speed.",
880 "Where there is life, there is hope.",
881 "There is no royal road to *WINNER*.",
882 "Danger past, God forgotten.",
883 "The best thing to do now is to run away.",
884 "Life is but an empty dream.",
885 "Dead men tell no tales.",
886 "A book that remains shut is but a block.",
887 "Misfortunes never come singly.",
888 "A little knowledge is a dangerous thing.",
889 "History repeats itself.",
890 "*WINNER* was not built in a day.",
891 "Ignorance is bliss.",
892 "To lose is to win?",
893 "No medicine can cure folly.",
894 "All good things come to an end.",
895 "M$ Empire strikes back.",
896 "To see is to believe",
898 "Quest of The World's Greatest Brain"};
901 sprintf(file_name,"playrecord-%s.txt",savefile_base);
903 sprintf(file_name,"playrec-%s.txt",savefile_base);
906 /* Build the filename */
907 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
909 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
910 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
911 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
912 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
913 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
916 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
917 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
919 sprintf(nikki_title, "Legend of %s %s '%s'",
920 ap_ptr->title, player_name, tmp);
923 /* Display the file contents */
924 show_file(FALSE, buf, nikki_title, -1, 0);
927 static void do_cmd_bunshou(void)
930 char bunshou[80] = "\0";
933 if (get_string("ÆâÍÆ: ", tmp, 79))
935 if (get_string("diary note: ", tmp, 79))
938 strcpy(bunshou, tmp);
940 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
944 static void do_cmd_last_get(void)
949 if (record_o_name[0] == '\0') return;
952 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
954 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
956 if (!get_check(buf)) return;
961 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
963 sprintf(buf,"descover %s.", record_o_name);
965 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
969 static void do_cmd_erase_nikki(void)
976 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
978 if (!get_check("Do you really want to delete all your record? ")) return;
982 sprintf(file_name,"playrecord-%s.txt",savefile_base);
984 sprintf(file_name,"playrec-%s.txt",savefile_base);
987 /* Build the filename */
988 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
990 /* Remove the file */
993 fff = my_fopen(buf, "w");
997 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
999 msg_format("deleted record.");
1003 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
1005 msg_format("failed to delete %s.", buf);
1012 void do_cmd_nikki(void)
1016 /* File type is "TEXT" */
1017 FILE_TYPE(FILE_TYPE_TEXT);
1019 /* Save the screen */
1022 /* Interact until done */
1028 /* Ask for a choice */
1030 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1032 prt("[ Play Record ]", 2, 0);
1036 /* Give some choices */
1038 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1039 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1040 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1041 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1043 prt("(1) Display your record", 4, 5);
1044 prt("(2) Add record", 5, 5);
1045 prt("(3) Record item you last get/identify", 6, 5);
1046 prt("(4) Delete your record", 7, 5);
1052 prt("¥³¥Þ¥ó¥É:", 18, 0);
1054 prt("Command: ", 18, 0);
1062 if (i == ESCAPE) break;
1067 do_cmd_disp_nikki();
1076 do_cmd_erase_nikki();
1078 default: /* Unknown option */
1082 /* Flush messages */
1086 /* Restore the screen */
1091 * Hack -- redraw the screen
1093 * This command performs various low level updates, clears all the "extra"
1094 * windows, does a total redraw of the main window, and requests all of the
1095 * interesting updates and redraws that I can think of.
1097 * This command is also used to "instantiate" the results of the user
1098 * selecting various things, such as graphics mode, so it must call
1099 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1101 void do_cmd_redraw(void)
1108 /* Hack -- react to changes */
1109 Term_xtra(TERM_XTRA_REACT, 0);
1112 /* Combine and Reorder the pack (later) */
1113 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1117 p_ptr->update |= (PU_TORCH);
1120 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1122 /* Forget lite/view */
1123 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1125 /* Update lite/view */
1126 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1128 /* Update monsters */
1129 p_ptr->update |= (PU_MONSTERS);
1131 /* Redraw everything */
1132 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1135 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1138 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1142 /* Hack -- update */
1145 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1148 /* Redraw every window */
1149 for (j = 0; j < 8; j++)
1152 if (!angband_term[j]) continue;
1155 Term_activate(angband_term[j]);
1170 * Hack -- change name
1172 void do_cmd_change_name(void)
1181 /* Save the screen */
1189 /* Display the player */
1190 display_player(mode);
1195 display_player(mode);
1200 Term_putstr(2, 23, -1, TERM_WHITE,
1201 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1203 Term_putstr(2, 23, -1, TERM_WHITE,
1204 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1212 if (c == ESCAPE) break;
1219 /* Process the player name */
1220 process_player_name(FALSE);
1226 sprintf(tmp, "%s.txt", player_base);
1228 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1230 if (get_string("File name: ", tmp, 80))
1234 if (tmp[0] && (tmp[0] != ' '))
1236 file_character(tmp);
1253 /* Flush messages */
1257 /* Restore the screen */
1260 /* Redraw everything */
1261 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1268 * Recall the most recent message
1270 void do_cmd_message_one(void)
1272 /* Recall one message XXX XXX XXX */
1273 prt(format("> %s", message_str(0)), 0, 0);
1278 * Show previous messages to the user -BEN-
1280 * The screen format uses line 0 and 23 for headers and prompts,
1281 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1283 * This command shows you which commands you are viewing, and allows
1284 * you to "search" for strings in the recall.
1286 * Note that messages may be longer than 80 characters, but they are
1287 * displayed using "infinite" length, with a special sub-command to
1288 * "slide" the virtual display to the left or right.
1290 * Attempt to only hilite the matching portions of the string.
1292 void do_cmd_messages(int num_now)
1303 Term_get_size(&wid, &hgt);
1312 /* Total messages */
1315 /* Start on first message */
1318 /* Start at leftmost edge */
1321 /* Save the screen */
1324 /* Process requests until done */
1330 /* Dump up to 20 lines of messages */
1331 for (j = 0; (j < hgt - 4) && (i + j < n); j++)
1333 cptr msg = message_str(i+j);
1335 /* Apply horizontal scroll */
1336 msg = (strlen(msg) >= q) ? (msg + q) : "";
1338 /* Dump the messages, bottom to top */
1339 Term_putstr(0, hgt-j-3, -1, (bool)(i+j < num_now ? TERM_WHITE : TERM_SLATE), msg);
1341 /* Hilite "shower" */
1346 /* Display matches */
1347 while ((str = strstr(str, shower)) != NULL)
1349 int len = strlen(shower);
1351 /* Display the match */
1352 Term_putstr(str-msg, hgt-j-3, len, TERM_YELLOW, shower);
1360 /* Display header XXX XXX XXX */
1363 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d) ¥ª¥Õ¥»¥Ã¥È(%d)",
1364 i, i+j-1, n, q), 0, 0);
1366 prt(format("Message Recall (%d-%d of %d), Offset %d",
1367 i, i+j-1, n, q), 0, 0);
1371 /* Display prompt (not very informative) */
1373 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1375 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1382 /* Exit on Escape */
1383 if (k == ESCAPE) break;
1385 /* Hack -- Save the old index */
1388 /* Horizontal scroll */
1392 q = (q >= 40) ? (q - 40) : 0;
1398 /* Horizontal scroll */
1408 /* Hack -- handle show */
1413 prt("¶¯Ä´: ", hgt - 1, 0);
1415 prt("Show: ", hgt - 1, 0);
1419 /* Get a "shower" string, or continue */
1420 if (!askfor_aux(shower, 80)) continue;
1426 /* Hack -- handle find */
1433 prt("¸¡º÷: ", hgt - 1, 0);
1435 prt("Find: ", hgt - 1, 0);
1439 /* Get a "finder" string, or continue */
1440 if (!askfor_aux(finder, 80)) continue;
1443 strcpy(shower, finder);
1446 for (z = i + 1; z < n; z++)
1448 cptr msg = message_str(z);
1451 if (strstr(msg, finder))
1462 /* Recall 1 older message */
1463 if ((k == '8') || (k == '\n') || (k == '\r'))
1465 /* Go newer if legal */
1466 if (i + 1 < n) i += 1;
1469 /* Recall 10 older messages */
1472 /* Go older if legal */
1473 if (i + 10 < n) i += 10;
1476 /* Recall 20 older messages */
1477 if ((k == 'p') || (k == KTRL('P')) || (k == ' '))
1479 /* Go older if legal */
1480 if (i + 20 < n) i += 20;
1483 /* Recall 20 newer messages */
1484 if ((k == 'n') || (k == KTRL('N')))
1486 /* Go newer (if able) */
1487 i = (i >= 20) ? (i - 20) : 0;
1490 /* Recall 10 newer messages */
1493 /* Go newer (if able) */
1494 i = (i >= 20) ? (i - 20) : 0;
1497 /* Recall 1 newer messages */
1500 /* Go newer (if able) */
1501 i = (i >= 1) ? (i - 1) : 0;
1504 /* Hack -- Error of some kind */
1508 /* Restore the screen */
1515 * Number of cheating options
1522 static option_type cheat_info[CHEAT_MAX] =
1524 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1526 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1528 "cheat_peek", "Peek into object creation"
1532 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1534 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1536 "cheat_hear", "Peek into monster creation"
1540 { &cheat_room, FALSE, 255, 0x04, 0x00,
1542 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1544 "cheat_room", "Peek into dungeon creation"
1548 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1550 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1552 "cheat_xtra", "Peek into something else"
1556 { &cheat_know, FALSE, 255, 0x10, 0x00,
1558 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1560 "cheat_know", "Know complete monster info"
1564 { &cheat_live, FALSE, 255, 0x20, 0x00,
1566 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1568 "cheat_live", "Allow player to avoid death"
1572 { &cheat_save, FALSE, 255, 0x40, 0x00,
1574 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1576 "cheat_save", "Ask for saving death"
1582 * Interact with some options for cheating
1584 static void do_cmd_options_cheat(cptr info)
1588 int i, k = 0, n = CHEAT_MAX;
1596 /* Interact with the player */
1601 /* Prompt XXX XXX XXX */
1603 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1605 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1611 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1612 prt(" << Ãí°Õ >>", 11, 0);
1613 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1614 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1615 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1617 /* Display the options */
1618 for (i = 0; i < n; i++)
1620 byte a = TERM_WHITE;
1622 /* Color current option */
1623 if (i == k) a = TERM_L_BLUE;
1625 /* Display the option text */
1626 sprintf(buf, "%-48s: %s (%s)",
1627 cheat_info[i].o_desc,
1629 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1631 (*cheat_info[i].o_var ? "yes" : "no "),
1634 cheat_info[i].o_text);
1635 c_prt(a, buf, i + 2, 0);
1638 /* Hilite current option */
1639 move_cursor(k + 2, 50);
1645 * HACK - Try to translate the key into a direction
1646 * to allow using the roguelike keys for navigation.
1648 dir = get_keymap_dir(ch);
1649 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1663 k = (n + k - 1) % n;
1682 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1684 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1686 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1687 (*cheat_info[k].o_var) = TRUE;
1696 (*cheat_info[k].o_var) = FALSE;
1704 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1706 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1708 /* Peruse the help file */
1709 (void)show_file(TRUE, buf, NULL, 0, 0);
1725 static option_type autosave_info[2] =
1727 { &autosave_l, FALSE, 255, 0x01, 0x00,
1729 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1731 "autosave_l", "Autosave when entering new levels" },
1735 { &autosave_t, FALSE, 255, 0x02, 0x00,
1737 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1739 "autosave_t", "Timed autosave" },
1745 static s16b toggle_frequency(s16b current)
1750 case 50: return 100;
1751 case 100: return 250;
1752 case 250: return 500;
1753 case 500: return 1000;
1754 case 1000: return 2500;
1755 case 2500: return 5000;
1756 case 5000: return 10000;
1757 case 10000: return 25000;
1764 * Interact with some options for cheating
1766 static void do_cmd_options_autosave(cptr info)
1770 int i, k = 0, n = 2;
1778 /* Interact with the player */
1781 /* Prompt XXX XXX XXX */
1783 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1785 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1790 /* Display the options */
1791 for (i = 0; i < n; i++)
1793 byte a = TERM_WHITE;
1795 /* Color current option */
1796 if (i == k) a = TERM_L_BLUE;
1798 /* Display the option text */
1799 sprintf(buf, "%-48s: %s (%s)",
1800 autosave_info[i].o_desc,
1802 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1804 (*autosave_info[i].o_var ? "yes" : "no "),
1807 autosave_info[i].o_text);
1808 c_prt(a, buf, i + 2, 0);
1812 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1814 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1819 /* Hilite current option */
1820 move_cursor(k + 2, 50);
1836 k = (n + k - 1) % n;
1854 (*autosave_info[k].o_var) = TRUE;
1863 (*autosave_info[k].o_var) = FALSE;
1871 autosave_freq = toggle_frequency(autosave_freq);
1873 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1874 autosave_freq), 5, 0);
1876 prt(format("Timed autosave frequency: every %d turns",
1877 autosave_freq), 5, 0);
1885 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1887 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1905 #define PAGE_BIRTH 6
1906 #define PAGE_AUTODESTROY 7
1909 * Interact with some options
1911 void do_cmd_options_aux(int page, cptr info)
1914 int i, k = 0, n = 0, l;
1917 bool browse_only = (page == PAGE_BIRTH) && character_generated &&
1918 (!p_ptr->wizard || !allow_debug_opts);
1921 /* Lookup the options */
1922 for (i = 0; i < 24; i++) opt[i] = 0;
1924 /* Scan the options */
1925 for (i = 0; option_info[i].o_desc; i++)
1927 /* Notice options on this "page" */
1928 if (option_info[i].o_page == page) opt[n++] = i;
1935 /* Interact with the player */
1940 /* Prompt XXX XXX XXX */
1942 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, %sESC:½ªÎ», ?:¥Ø¥ë¥×) ", info, browse_only ? "" : "y/n:Êѹ¹, ");
1944 sprintf(buf, "%s (RET:next, %s, ?:help) ", info, browse_only ? "ESC:exit" : "y/n:change, ESC:accept");
1950 /* HACK -- description for easy-auto-destroy options */
1952 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1954 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1957 /* Display the options */
1958 for (i = 0; i < n; i++)
1960 byte a = TERM_WHITE;
1962 /* Color current option */
1963 if (i == k) a = TERM_L_BLUE;
1965 /* Display the option text */
1966 sprintf(buf, "%-48s: %s (%.19s)",
1967 option_info[opt[i]].o_desc,
1969 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1971 (*option_info[opt[i]].o_var ? "yes" : "no "),
1974 option_info[opt[i]].o_text);
1975 if ((page == PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1976 else c_prt(a, buf, i + 2, 0);
1979 if ((page == PAGE_AUTODESTROY) && (k > 2)) l = 3;
1982 /* Hilite current option */
1983 move_cursor(k + 2 + l, 50);
1989 * HACK - Try to translate the key into a direction
1990 * to allow using the roguelike keys for navigation.
1992 dir = get_keymap_dir(ch);
1993 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
2007 k = (n + k - 1) % n;
2024 if (browse_only) break;
2025 (*option_info[opt[k]].o_var) = TRUE;
2034 if (browse_only) break;
2035 (*option_info[opt[k]].o_var) = FALSE;
2043 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2050 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2052 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2054 /* Peruse the help file */
2055 (void)show_file(TRUE, buf, NULL, 0, 0);
2072 * Modify the "window" options
2074 static void do_cmd_options_win(void)
2088 /* Memorize old flags */
2089 for (j = 0; j < 8; j++)
2091 /* Acquire current flags */
2092 old_flag[j] = window_flag[j];
2102 /* Prompt XXX XXX XXX */
2104 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2106 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2110 /* Display the windows */
2111 for (j = 0; j < 8; j++)
2113 byte a = TERM_WHITE;
2115 cptr s = angband_term_name[j];
2118 if (j == x) a = TERM_L_BLUE;
2120 /* Window name, staggered, centered */
2121 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2124 /* Display the options */
2125 for (i = 0; i < 16; i++)
2127 byte a = TERM_WHITE;
2129 cptr str = window_flag_desc[i];
2132 if (i == y) a = TERM_L_BLUE;
2136 if (!str) str = "(̤»ÈÍÑ)";
2138 if (!str) str = "(Unused option)";
2143 Term_putstr(0, i + 5, -1, a, str);
2145 /* Display the windows */
2146 for (j = 0; j < 8; j++)
2148 byte a = TERM_WHITE;
2153 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2156 if (window_flag[j] & (1L << i)) c = 'X';
2159 Term_putch(35 + j * 5, i + 5, a, c);
2164 Term_gotoxy(35 + x * 5, y + 5);
2182 for (j = 0; j < 8; j++)
2184 window_flag[j] &= ~(1L << y);
2188 for (i = 0; i < 16; i++)
2190 window_flag[x] &= ~(1L << i);
2203 window_flag[x] |= (1L << y);
2211 window_flag[x] &= ~(1L << y);
2218 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2220 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2230 d = get_keymap_dir(ch);
2232 x = (x + ddx[d] + 8) % 8;
2233 y = (y + ddy[d] + 16) % 16;
2240 /* Notice changes */
2241 for (j = 0; j < 8; j++)
2246 if (!angband_term[j]) continue;
2248 /* Ignore non-changes */
2249 if (window_flag[j] == old_flag[j]) continue;
2252 Term_activate(angband_term[j]);
2269 * Set or unset various options.
2271 * The user must use the "Ctrl-R" command to "adapt" to changes
2272 * in any options which control "visual" aspects of the game.
2274 void do_cmd_options(void)
2279 /* Save the screen */
2288 /* Why are we here */
2290 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 2, 0);
2292 prt("Options", 2, 0);
2296 /* Give some choices */
2298 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 3, 5);
2299 prt("(2) ²èÌ̽ÐÎÏ ¥ª¥×¥·¥ç¥ó", 4, 5);
2300 prt("(3) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 5, 5);
2301 prt("(4) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 6, 5);
2302 prt("(5) ¸úΨ²½ ¥ª¥×¥·¥ç¥ó", 7, 5);
2303 prt("(6) ´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 8, 5);
2304 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 9, 5);
2305 /* Special choices */
2306 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 11, 5);
2307 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 12, 5);
2308 prt("(M) ÄãËâÎÏ¿§ïçÃÍ", 13, 5);
2309 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2311 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2313 prt("(1) Input Options", 3, 5);
2314 prt("(2) Output Options", 4, 5);
2315 prt("(3) Game-Play Options", 5, 5);
2316 prt("(4) Disturbance Options", 6, 5);
2317 prt("(5) Efficiency Options", 7, 5);
2318 prt("(6) Easy Auto-Destroyer Options", 8, 5);
2319 prt("(R) Play-record Options", 9, 5);
2320 /* Special choices */
2321 prt("(D) Base Delay Factor", 11, 5);
2322 prt("(H) Hitpoint Warning", 12, 5);
2323 prt("(M) Mana Color Threshold", 13, 5);
2324 prt("(A) Autosave Options", 14, 5);
2326 prt("(W) Window Flags", 15, 5);
2329 if (!p_ptr->wizard || !allow_debug_opts)
2333 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó (»²¾È¤Î¤ß)", 16, 5);
2335 prt("(B) Birth Options (Browse Only)", 16, 5);
2342 prt("(B) ½é´ü ¥ª¥×¥·¥ç¥ó", 16, 5);
2344 prt("(B) Birth Options", 16, 5);
2349 if (p_ptr->noscore || allow_debug_opts)
2353 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 17, 5);
2355 prt("(C) Cheating Options", 17, 5);
2362 prt("¥³¥Þ¥ó¥É:", 19, 0);
2364 prt("Command: ", 19, 0);
2372 if (k == ESCAPE) break;
2377 /* General Options */
2380 /* Process the general options */
2382 do_cmd_options_aux(1, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2384 do_cmd_options_aux(1, "Input Options");
2390 /* General Options */
2393 /* Process the general options */
2395 do_cmd_options_aux(2, "²èÌ̽ÐÎÏ¥ª¥×¥·¥ç¥ó");
2397 do_cmd_options_aux(2, "Output Options");
2403 /* Inventory Options */
2408 do_cmd_options_aux(3, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2410 do_cmd_options_aux(3, "Game-Play Options");
2416 /* Disturbance Options */
2421 do_cmd_options_aux(4, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2423 do_cmd_options_aux(4, "Disturbance Options");
2429 /* Efficiency Options */
2434 do_cmd_options_aux(5, "¸úΨ²½¥ª¥×¥·¥ç¥ó");
2436 do_cmd_options_aux(5, "Efficiency Options");
2442 /* Object auto-destruction Options */
2447 do_cmd_options_aux(7, "´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2449 do_cmd_options_aux(7, "Easy Auto-Destroyer Options");
2454 /* Play-record Options */
2460 do_cmd_options_aux(10, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2462 do_cmd_options_aux(10, "Play-record Options");
2473 do_cmd_options_aux(6, (!p_ptr->wizard || !allow_debug_opts) ? "½é´ü¥ª¥×¥·¥ç¥ó(»²¾È¤Î¤ß)" : "½é´ü¥ª¥×¥·¥ç¥ó((*)¤Ï¥¹¥³¥¢¤Ë±Æ¶Á)");
2475 do_cmd_options_aux(6, (!p_ptr->wizard || !allow_debug_opts) ? "Birth Options(browse only)" : "Birth Options((*)s effect score)");
2481 /* Cheating Options */
2484 if (!p_ptr->noscore && !allow_debug_opts)
2486 /* Cheat options are not permitted */
2493 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2495 do_cmd_options_cheat("Cheaters never win");
2505 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2507 do_cmd_options_autosave("Autosave");
2518 do_cmd_options_win();
2519 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2520 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2521 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2522 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2526 /* Hack -- Delay Speed */
2532 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 19, 0);
2534 prt("Command: Base Delay Factor", 19, 0);
2538 /* Get a new value */
2541 int msec = delay_factor * delay_factor * delay_factor;
2543 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2544 delay_factor, msec), 22, 0);
2546 prt(format("Current base delay factor: %d (%d msec)",
2547 delay_factor, msec), 22, 0);
2551 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2553 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2557 if (k == ESCAPE) break;
2561 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2563 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2567 else if (isdigit(k)) delay_factor = D2I(k);
2574 /* Hack -- hitpoint warning factor */
2580 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 19, 0);
2582 prt("Command: Hitpoint Warning", 19, 0);
2586 /* Get a new value */
2590 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2591 hitpoint_warn), 22, 0);
2593 prt(format("Current hitpoint warning: %d0%%",
2594 hitpoint_warn), 22, 0);
2598 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2600 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2604 if (k == ESCAPE) break;
2608 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2610 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2614 else if (isdigit(k)) hitpoint_warn = D2I(k);
2621 /* Hack -- mana color factor */
2627 prt("¥³¥Þ¥ó¥É: ÄãËâÎÏ¿§ïçÃÍ", 19, 0);
2629 prt("Command: Mana Color Threshold", 19, 0);
2633 /* Get a new value */
2637 prt(format("¸½ºß¤ÎÄãËâÎÏ¿§ïçÃÍ: %d0%%",
2640 prt(format("Current mana color threshold: %d0%%",
2645 prt("ÄãËâÎÏïçÃÍ (0-9) ESC¤Ç·èÄê: ", 20, 0);
2647 prt("Mana color Threshold (0-9 or ESC to accept): ", 20, 0);
2651 if (k == ESCAPE) break;
2655 (void)show_file(TRUE, "joption.txt#Manapoint", NULL, 0, 0);
2657 (void)show_file(TRUE, "option.txt#Manapoint", NULL, 0, 0);
2661 else if (isdigit(k)) mana_warn = D2I(k);
2670 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2672 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2677 /* Unknown option */
2686 /* Flush messages */
2691 /* Restore the screen */
2694 /* Hack - Redraw equippy chars */
2695 p_ptr->redraw |= (PR_EQUIPPY);
2701 * Ask for a "user pref line" and process it
2703 * XXX XXX XXX Allow absolute file names?
2705 void do_cmd_pref(void)
2712 /* Ask for a "user pref command" */
2714 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2716 if (!get_string("Pref: ", buf, 80)) return;
2720 /* Process that pref command */
2721 (void)process_pref_file_command(buf);
2724 void do_cmd_pickpref(void)
2730 if(!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2732 if(!get_check("Reload auto-pick preference file? ")) return;
2735 /* Free old entries */
2738 /* ¥¥ã¥éËè¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß */
2740 sprintf(buf, "picktype-%s.prf", player_name);
2742 sprintf(buf, "pickpref-%s.prf", player_name);
2744 err = process_pickpref_file(buf);
2749 msg_format("%s¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", buf);
2751 msg_format("loaded '%s'.", buf);
2755 /* ¶¦Ä̤ÎÀßÄê¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß */
2757 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
2761 err = process_pickpref_file("picktype.prf");
2763 err = process_pickpref_file("pickpref.prf");
2769 msg_print("picktype.prf¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£");
2771 msg_print("loaded 'pickpref.prf'.");
2778 if(err) msg_print("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
2780 if(err) msg_print("Failed to reload autopick preference.");
2787 * Hack -- append all current macros to the given file
2789 static errr macro_dump(cptr fname)
2791 static cptr mark = "Macro Dump";
2797 /* Build the filename */
2798 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2800 /* File type is "TEXT" */
2801 FILE_TYPE(FILE_TYPE_TEXT);
2803 /* Append to the file */
2804 if (!open_auto_dump(buf, mark)) return (-1);
2808 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2810 auto_dump_printf("\n# Automatic macro dump\n\n");
2814 for (i = 0; i < macro__num; i++)
2816 /* Extract the action */
2817 ascii_to_text(buf, macro__act[i]);
2819 /* Dump the macro */
2820 auto_dump_printf("A:%s\n", buf);
2822 /* Extract the action */
2823 ascii_to_text(buf, macro__pat[i]);
2825 /* Dump normal macros */
2826 auto_dump_printf("P:%s\n", buf);
2829 auto_dump_printf("\n");
2841 * Hack -- ask for a "trigger" (see below)
2843 * Note the complex use of the "inkey()" function from "util.c".
2845 * Note that both "flush()" calls are extremely important.
2847 static void do_cmd_macro_aux(char *buf)
2857 /* Do not process macros */
2863 /* Read the pattern */
2869 /* Do not process macros */
2872 /* Do not wait for keys */
2875 /* Attempt to read a key */
2886 /* Convert the trigger */
2887 ascii_to_text(tmp, buf);
2889 /* Hack -- display the trigger */
2890 Term_addstr(-1, TERM_WHITE, tmp);
2897 * Hack -- ask for a keymap "trigger" (see below)
2899 * Note that both "flush()" calls are extremely important. This may
2900 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2902 static void do_cmd_macro_aux_keymap(char *buf)
2916 /* Convert to ascii */
2917 ascii_to_text(tmp, buf);
2919 /* Hack -- display the trigger */
2920 Term_addstr(-1, TERM_WHITE, tmp);
2929 * Hack -- append all keymaps to the given file
2931 static errr keymap_dump(cptr fname)
2933 static cptr mark = "Keymap Dump";
2942 if (rogue_like_commands)
2944 mode = KEYMAP_MODE_ROGUE;
2950 mode = KEYMAP_MODE_ORIG;
2954 /* Build the filename */
2955 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2957 /* File type is "TEXT" */
2958 FILE_TYPE(FILE_TYPE_TEXT);
2960 /* Append to the file */
2961 if (!open_auto_dump(buf, mark)) return -1;
2965 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2967 auto_dump_printf("\n# Automatic keymap dump\n\n");
2971 for (i = 0; i < 256; i++)
2975 /* Loop up the keymap */
2976 act = keymap_act[mode][i];
2978 /* Skip empty keymaps */
2981 /* Encode the key */
2984 ascii_to_text(key, buf);
2986 /* Encode the action */
2987 ascii_to_text(buf, act);
2989 /* Dump the macro */
2990 auto_dump_printf("A:%s\n", buf);
2991 auto_dump_printf("C:%d:%s\n", mode, key);
3004 * Interact with "macros"
3006 * Note that the macro "action" must be defined before the trigger.
3008 * Could use some helpful instructions on this page. XXX XXX XXX
3010 void do_cmd_macros(void)
3022 if (rogue_like_commands)
3024 mode = KEYMAP_MODE_ROGUE;
3030 mode = KEYMAP_MODE_ORIG;
3033 /* File type is "TEXT" */
3034 FILE_TYPE(FILE_TYPE_TEXT);
3041 /* Process requests until done */
3049 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
3051 prt("Interact with Macros", 2, 0);
3056 /* Describe that action */
3058 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3060 prt("Current action (if any) shown below:", 20, 0);
3064 /* Analyze the current action */
3065 ascii_to_text(buf, macro__buf);
3067 /* Display the current action */
3073 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3075 prt("(1) Load a user pref file", 4, 5);
3080 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
3081 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
3082 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
3083 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
3084 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
3085 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
3086 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
3087 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
3088 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
3090 prt("(2) Append macros to a file", 5, 5);
3091 prt("(3) Query a macro", 6, 5);
3092 prt("(4) Create a macro", 7, 5);
3093 prt("(5) Remove a macro", 8, 5);
3094 prt("(6) Append keymaps to a file", 9, 5);
3095 prt("(7) Query a keymap", 10, 5);
3096 prt("(8) Create a keymap", 11, 5);
3097 prt("(9) Remove a keymap", 12, 5);
3098 prt("(0) Enter a new action", 13, 5);
3101 #endif /* ALLOW_MACROS */
3105 prt("¥³¥Þ¥ó¥É: ", 16, 0);
3107 prt("Command: ", 16, 0);
3115 if (i == ESCAPE) break;
3117 /* Load a 'macro' file */
3124 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3126 prt("Command: Load a user pref file", 16, 0);
3132 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3134 prt("File: ", 18, 0);
3138 /* Default filename */
3139 sprintf(tmp, "%s.prf", player_name);
3141 /* Ask for a file */
3142 if (!askfor_aux(tmp, 80)) continue;
3144 /* Process the given filename */
3145 err = process_pref_file(tmp);
3149 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3151 msg_format("Loaded default '%s'.", tmp);
3158 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3160 msg_format("Failed to load '%s'!");
3166 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3168 msg_format("Loaded '%s'.", tmp);
3180 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3182 prt("Command: Append macros to a file", 16, 0);
3188 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3190 prt("File: ", 18, 0);
3194 /* Default filename */
3195 sprintf(tmp, "%s.prf", player_name);
3197 /* Ask for a file */
3198 if (!askfor_aux(tmp, 80)) continue;
3200 /* Dump the macros */
3201 (void)macro_dump(tmp);
3205 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3207 msg_print("Appended macros.");
3219 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3221 prt("Command: Query a macro", 16, 0);
3227 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3229 prt("Trigger: ", 18, 0);
3233 /* Get a macro trigger */
3234 do_cmd_macro_aux(buf);
3236 /* Acquire action */
3237 k = macro_find_exact(buf);
3244 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3246 msg_print("Found no macro.");
3254 /* Obtain the action */
3255 strcpy(macro__buf, macro__act[k]);
3257 /* Analyze the current action */
3258 ascii_to_text(buf, macro__buf);
3260 /* Display the current action */
3265 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3267 msg_print("Found a macro.");
3273 /* Create a macro */
3278 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3280 prt("Command: Create a macro", 16, 0);
3286 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3288 prt("Trigger: ", 18, 0);
3292 /* Get a macro trigger */
3293 do_cmd_macro_aux(buf);
3300 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3302 prt("Action: ", 20, 0);
3306 /* Convert to text */
3307 ascii_to_text(tmp, macro__buf);
3309 /* Get an encoded action */
3310 if (askfor_aux(tmp, 80))
3312 /* Convert to ascii */
3313 text_to_ascii(macro__buf, tmp);
3315 /* Link the macro */
3316 macro_add(buf, macro__buf);
3320 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3322 msg_print("Added a macro.");
3328 /* Remove a macro */
3333 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3335 prt("Command: Remove a macro", 16, 0);
3341 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3343 prt("Trigger: ", 18, 0);
3347 /* Get a macro trigger */
3348 do_cmd_macro_aux(buf);
3350 /* Link the macro */
3351 macro_add(buf, buf);
3355 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3357 msg_print("Removed a macro.");
3367 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3369 prt("Command: Append keymaps to a file", 16, 0);
3375 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3377 prt("File: ", 18, 0);
3381 /* Default filename */
3382 sprintf(tmp, "%s.prf", player_name);
3384 /* Ask for a file */
3385 if (!askfor_aux(tmp, 80)) continue;
3387 /* Dump the macros */
3388 (void)keymap_dump(tmp);
3392 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3394 msg_print("Appended keymaps.");
3399 /* Query a keymap */
3406 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3408 prt("Command: Query a keymap", 16, 0);
3414 prt("²¡¤¹¥¡¼: ", 18, 0);
3416 prt("Keypress: ", 18, 0);
3420 /* Get a keymap trigger */
3421 do_cmd_macro_aux_keymap(buf);
3423 /* Look up the keymap */
3424 act = keymap_act[mode][(byte)(buf[0])];
3431 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3433 msg_print("Found no keymap.");
3441 /* Obtain the action */
3442 strcpy(macro__buf, act);
3444 /* Analyze the current action */
3445 ascii_to_text(buf, macro__buf);
3447 /* Display the current action */
3452 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3454 msg_print("Found a keymap.");
3460 /* Create a keymap */
3465 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3467 prt("Command: Create a keymap", 16, 0);
3473 prt("²¡¤¹¥¡¼: ", 18, 0);
3475 prt("Keypress: ", 18, 0);
3479 /* Get a keymap trigger */
3480 do_cmd_macro_aux_keymap(buf);
3487 prt("¹ÔÆ°: ", 20, 0);
3489 prt("Action: ", 20, 0);
3493 /* Convert to text */
3494 ascii_to_text(tmp, macro__buf);
3496 /* Get an encoded action */
3497 if (askfor_aux(tmp, 80))
3499 /* Convert to ascii */
3500 text_to_ascii(macro__buf, tmp);
3502 /* Free old keymap */
3503 string_free(keymap_act[mode][(byte)(buf[0])]);
3505 /* Make new keymap */
3506 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3510 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3512 msg_print("Added a keymap.");
3518 /* Remove a keymap */
3523 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3525 prt("Command: Remove a keymap", 16, 0);
3531 prt("²¡¤¹¥¡¼: ", 18, 0);
3533 prt("Keypress: ", 18, 0);
3537 /* Get a keymap trigger */
3538 do_cmd_macro_aux_keymap(buf);
3540 /* Free old keymap */
3541 string_free(keymap_act[mode][(byte)(buf[0])]);
3543 /* Make new keymap */
3544 keymap_act[mode][(byte)(buf[0])] = NULL;
3548 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3550 msg_print("Removed a keymap.");
3555 /* Enter a new action */
3560 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3562 prt("Command: Enter a new action", 16, 0);
3566 /* Go to the correct location */
3569 /* Hack -- limit the value */
3572 /* Get an encoded action */
3573 if (!askfor_aux(buf, 80)) continue;
3575 /* Extract an action */
3576 text_to_ascii(macro__buf, buf);
3579 #endif /* ALLOW_MACROS */
3588 /* Flush messages */
3597 static void cmd_visuals_aux(int i, int *num, int max)
3604 sprintf(str, "%d", *num);
3606 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3609 tmp = strtol(str, NULL, 0);
3610 if (tmp >= 0 && tmp < max)
3614 else if (isupper(i))
3615 *num = (*num + max - 1) % max;
3617 *num = (*num + 1) % max;
3623 * Interact with "visuals"
3625 void do_cmd_visuals(void)
3633 const char *empty_symbol = "<< ? >>";
3635 if (use_bigtile) empty_symbol = "<< ?? >>";
3637 /* File type is "TEXT" */
3638 FILE_TYPE(FILE_TYPE_TEXT);
3641 /* Save the screen */
3645 /* Interact until done */
3651 /* Ask for a choice */
3653 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 2, 0);
3655 prt("Interact with Visuals", 2, 0);
3659 /* Give some choices */
3661 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3663 prt("(1) Load a user pref file", 4, 5);
3666 #ifdef ALLOW_VISUALS
3668 prt("(2) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3669 prt("(3) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3670 prt("(4) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 7, 5);
3671 prt("(5) (̤»ÈÍÑ)", 8, 5);
3672 prt("(6) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 9, 5);
3673 prt("(7) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 10, 5);
3674 prt("(8) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 11, 5);
3675 prt("(9) (̤»ÈÍÑ)", 12, 5);
3677 prt("(2) Dump monster attr/chars", 5, 5);
3678 prt("(3) Dump object attr/chars", 6, 5);
3679 prt("(4) Dump feature attr/chars", 7, 5);
3680 prt("(5) (unused)", 8, 5);
3681 prt("(6) Change monster attr/chars", 9, 5);
3682 prt("(7) Change object attr/chars", 10, 5);
3683 prt("(8) Change feature attr/chars", 11, 5);
3684 prt("(9) (unused)", 12, 5);
3689 prt("(0) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3691 prt("(0) Reset visuals", 13, 5);
3697 prt("¥³¥Þ¥ó¥É:", 18, 0);
3699 prt("Command: ", 15, 0);
3707 if (i == ESCAPE) break;
3709 /* Load a 'pref' file */
3714 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3716 prt("Command: Load a user pref file", 15, 0);
3722 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3724 prt("File: ", 17, 0);
3728 /* Default filename */
3729 sprintf(tmp, "%s.prf", player_name);
3732 if (!askfor_aux(tmp, 70)) continue;
3734 /* Process the given filename */
3735 (void)process_pref_file(tmp);
3738 #ifdef ALLOW_VISUALS
3740 /* Dump monster attr/chars */
3743 static cptr mark = "Monster attr/chars";
3747 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3749 prt("Command: Dump monster attr/chars", 15, 0);
3755 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3757 prt("File: ", 17, 0);
3761 /* Default filename */
3762 sprintf(tmp, "%s.prf", player_name);
3764 /* Get a filename */
3765 if (!askfor_aux(tmp, 70)) continue;
3767 /* Build the filename */
3768 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3770 /* Append to the file */
3771 if (!open_auto_dump(buf, mark)) continue;
3775 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3777 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3781 for (i = 1; i < max_r_idx; i++)
3783 monster_race *r_ptr = &r_info[i];
3785 /* Skip non-entries */
3786 if (!r_ptr->name) continue;
3788 /* Dump a comment */
3789 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3791 /* Dump the monster attr/char info */
3792 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3793 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3801 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3803 msg_print("Dumped monster attr/chars.");
3808 /* Dump object attr/chars */
3811 static cptr mark = "Object attr/chars";
3815 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3817 prt("Command: Dump object attr/chars", 15, 0);
3823 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3825 prt("File: ", 17, 0);
3829 /* Default filename */
3830 sprintf(tmp, "%s.prf", player_name);
3832 /* Get a filename */
3833 if (!askfor_aux(tmp, 70)) continue;
3835 /* Build the filename */
3836 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3838 /* Append to the file */
3839 if (!open_auto_dump(buf, mark)) continue;
3843 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3845 auto_dump_printf("\n# Object attr/char definitions\n\n");
3849 for (i = 1; i < max_k_idx; i++)
3852 object_kind *k_ptr = &k_info[i];
3854 /* Skip non-entries */
3855 if (!k_ptr->name) continue;
3857 /* Skip entries with flavor */
3858 if (k_ptr->flavor) continue;
3861 strip_name(o_name, i);
3863 /* Dump a comment */
3864 auto_dump_printf("# %s\n", o_name);
3866 /* Dump the object attr/char info */
3867 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3868 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3876 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3878 msg_print("Dumped object attr/chars.");
3883 /* Dump feature attr/chars */
3886 static cptr mark = "Feature attr/chars";
3890 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3892 prt("Command: Dump feature attr/chars", 15, 0);
3898 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3900 prt("File: ", 17, 0);
3904 /* Default filename */
3905 sprintf(tmp, "%s.prf", player_name);
3907 /* Get a filename */
3908 if (!askfor_aux(tmp, 70)) continue;
3910 /* Build the filename */
3911 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3913 /* Append to the file */
3914 if (!open_auto_dump(buf, mark)) continue;
3918 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3920 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3924 for (i = 1; i < max_f_idx; i++)
3926 feature_type *f_ptr = &f_info[i];
3928 /* Skip non-entries */
3929 if (!f_ptr->name) continue;
3931 /* Skip mimiccing features */
3932 if (f_ptr->mimic != i) continue;
3934 /* Dump a comment */
3935 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3937 /* Dump the feature attr/char info */
3938 auto_dump_printf("F:%d:0x%02X/0x%02X\n\n", i,
3939 (byte)(f_ptr->x_attr), (byte)(f_ptr->x_char));
3947 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3949 msg_print("Dumped feature attr/chars.");
3954 /* Modify monster attr/chars */
3961 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3963 prt("Command: Change monster attr/chars", 15, 0);
3967 /* Hack -- query until done */
3970 monster_race *r_ptr = &r_info[r];
3975 byte da = (r_ptr->d_attr);
3976 byte dc = (r_ptr->d_char);
3977 byte ca = (r_ptr->x_attr);
3978 byte cc = (r_ptr->x_char);
3980 /* Label the object */
3982 Term_putstr(5, 17, -1, TERM_WHITE,
3983 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
3984 r, (r_name + r_ptr->name)));
3986 Term_putstr(5, 17, -1, TERM_WHITE,
3987 format("Monster = %d, Name = %-40.40s",
3988 r, (r_name + r_ptr->name)));
3992 /* Label the Default values */
3994 Term_putstr(10, 19, -1, TERM_WHITE,
3995 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
3997 Term_putstr(10, 19, -1, TERM_WHITE,
3998 format("Default attr/char = %3u / %3u", da, dc));
4001 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4005 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4007 Term_putch(43, 19, a, c);
4008 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4010 /* Label the Current values */
4012 Term_putstr(10, 20, -1, TERM_WHITE,
4013 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
4015 Term_putstr(10, 20, -1, TERM_WHITE,
4016 format("Current attr/char = %3u / %3u", ca, cc));
4019 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4023 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4025 Term_putch(43, 20, a, c);
4026 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4031 Term_putstr(0, 22, -1, TERM_WHITE,
4032 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4034 Term_putstr(0, 22, -1, TERM_WHITE,
4035 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4042 if (i == ESCAPE) break;
4044 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4045 else if (isupper(i)) c = 'a' + i - 'A';
4051 cmd_visuals_aux(i, &r, max_r_idx);
4054 t = (int)r_ptr->x_attr;
4055 cmd_visuals_aux(i, &t, 256);
4056 r_ptr->x_attr = (byte)t;
4059 t = (int)r_ptr->x_char;
4060 cmd_visuals_aux(i, &t, 256);
4061 r_ptr->x_char = (byte)t;
4067 /* Modify object attr/chars */
4074 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
4076 prt("Command: Change object attr/chars", 15, 0);
4080 /* Hack -- query until done */
4083 object_kind *k_ptr = &k_info[k];
4088 byte da = (byte)k_ptr->d_attr;
4089 byte dc = (byte)k_ptr->d_char;
4090 byte ca = (byte)k_ptr->x_attr;
4091 byte cc = (byte)k_ptr->x_char;
4093 /* Label the object */
4095 Term_putstr(5, 17, -1, TERM_WHITE,
4096 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
4097 k, (k_name + k_ptr->name)));
4099 Term_putstr(5, 17, -1, TERM_WHITE,
4100 format("Object = %d, Name = %-40.40s",
4101 k, (k_name + k_ptr->name)));
4105 /* Label the Default values */
4107 Term_putstr(10, 19, -1, TERM_WHITE,
4108 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4110 Term_putstr(10, 19, -1, TERM_WHITE,
4111 format("Default attr/char = %3d / %3d", da, dc));
4114 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4117 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4119 Term_putch(43, 19, a, c);
4120 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4123 /* Label the Current values */
4125 Term_putstr(10, 20, -1, TERM_WHITE,
4126 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4128 Term_putstr(10, 20, -1, TERM_WHITE,
4129 format("Current attr/char = %3d / %3d", ca, cc));
4132 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4135 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4137 Term_putch(43, 20, a, c);
4138 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4143 Term_putstr(0, 22, -1, TERM_WHITE,
4144 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4146 Term_putstr(0, 22, -1, TERM_WHITE,
4147 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4154 if (i == ESCAPE) break;
4156 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4157 else if (isupper(i)) c = 'a' + i - 'A';
4163 cmd_visuals_aux(i, &k, max_k_idx);
4166 t = (int)k_info[k].x_attr;
4167 cmd_visuals_aux(i, &t, 256);
4168 k_info[k].x_attr = (byte)t;
4171 t = (int)k_info[k].x_char;
4172 cmd_visuals_aux(i, &t, 256);
4173 k_info[k].x_char = (byte)t;
4179 /* Modify feature attr/chars */
4186 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
4188 prt("Command: Change feature attr/chars", 15, 0);
4192 /* Hack -- query until done */
4195 feature_type *f_ptr = &f_info[f];
4200 byte da = (byte)f_ptr->d_attr;
4201 byte dc = (byte)f_ptr->d_char;
4202 byte ca = (byte)f_ptr->x_attr;
4203 byte cc = (byte)f_ptr->x_char;
4205 /* Label the object */
4207 Term_putstr(5, 17, -1, TERM_WHITE,
4208 format("ÃÏ·Á = %d, ̾Á° = %-40.40s",
4209 f, (f_name + f_ptr->name)));
4211 Term_putstr(5, 17, -1, TERM_WHITE,
4212 format("Terrain = %d, Name = %-40.40s",
4213 f, (f_name + f_ptr->name)));
4217 /* Label the Default values */
4219 Term_putstr(10, 19, -1, TERM_WHITE,
4220 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4222 Term_putstr(10, 19, -1, TERM_WHITE,
4223 format("Default attr/char = %3d / %3d", da, dc));
4226 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4229 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4231 Term_putch(43, 19, a, c);
4232 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4235 /* Label the Current values */
4237 Term_putstr(10, 20, -1, TERM_WHITE,
4238 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4240 Term_putstr(10, 20, -1, TERM_WHITE,
4241 format("Current attr/char = %3d / %3d", ca, cc));
4244 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4247 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4249 Term_putch(43, 20, a, c);
4250 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4255 Term_putstr(0, 22, -1, TERM_WHITE,
4256 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4258 Term_putstr(0, 22, -1, TERM_WHITE,
4259 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4266 if (i == ESCAPE) break;
4268 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4269 else if (isupper(i)) c = 'a' + i - 'A';
4275 cmd_visuals_aux(i, &f, max_f_idx);
4278 t = (int)f_info[f].x_attr;
4279 cmd_visuals_aux(i, &t, 256);
4280 f_info[f].x_attr = (byte)t;
4283 t = (int)f_info[f].x_char;
4284 cmd_visuals_aux(i, &t, 256);
4285 f_info[f].x_char = (byte)t;
4301 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4303 msg_print("Visual attr/char tables reset.");
4308 /* Unknown option */
4314 /* Flush messages */
4319 /* Restore the screen */
4325 * Interact with "colors"
4327 void do_cmd_colors(void)
4336 /* File type is "TEXT" */
4337 FILE_TYPE(FILE_TYPE_TEXT);
4340 /* Save the screen */
4344 /* Interact until done */
4350 /* Ask for a choice */
4352 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4354 prt("Interact with Colors", 2, 0);
4358 /* Give some choices */
4360 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4362 prt("(1) Load a user pref file", 4, 5);
4367 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4368 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4370 prt("(2) Dump colors", 5, 5);
4371 prt("(3) Modify colors", 6, 5);
4378 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4380 prt("Command: ", 8, 0);
4388 if (i == ESCAPE) break;
4390 /* Load a 'pref' file */
4395 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4397 prt("Command: Load a user pref file", 8, 0);
4403 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4405 prt("File: ", 10, 0);
4410 sprintf(tmp, "%s.prf", player_name);
4413 if (!askfor_aux(tmp, 70)) continue;
4415 /* Process the given filename */
4416 (void)process_pref_file(tmp);
4418 /* Mega-Hack -- react to changes */
4419 Term_xtra(TERM_XTRA_REACT, 0);
4421 /* Mega-Hack -- redraw */
4430 static cptr mark = "Colors";
4434 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4436 prt("Command: Dump colors", 8, 0);
4442 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4444 prt("File: ", 10, 0);
4448 /* Default filename */
4449 sprintf(tmp, "%s.prf", player_name);
4451 /* Get a filename */
4452 if (!askfor_aux(tmp, 70)) continue;
4454 /* Build the filename */
4455 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4457 /* Append to the file */
4458 if (!open_auto_dump(buf, mark)) continue;
4462 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4464 auto_dump_printf("\n# Color redefinitions\n\n");
4468 for (i = 0; i < 256; i++)
4470 int kv = angband_color_table[i][0];
4471 int rv = angband_color_table[i][1];
4472 int gv = angband_color_table[i][2];
4473 int bv = angband_color_table[i][3];
4478 cptr name = "unknown";
4482 /* Skip non-entries */
4483 if (!kv && !rv && !gv && !bv) continue;
4485 /* Extract the color name */
4486 if (i < 16) name = color_names[i];
4488 /* Dump a comment */
4490 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4492 auto_dump_printf("# Color '%s'\n", name);
4495 /* Dump the monster attr/char info */
4496 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4505 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4507 msg_print("Dumped color redefinitions.");
4519 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4521 prt("Command: Modify colors", 8, 0);
4525 /* Hack -- query until done */
4534 /* Exhibit the normal colors */
4535 for (j = 0; j < 16; j++)
4537 /* Exhibit this color */
4538 Term_putstr(j*4, 20, -1, a, "###");
4540 /* Exhibit all colors */
4541 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4544 /* Describe the color */
4546 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4548 name = ((a < 16) ? color_names[a] : "undefined");
4552 /* Describe the color */
4554 Term_putstr(5, 10, -1, TERM_WHITE,
4555 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4557 Term_putstr(5, 10, -1, TERM_WHITE,
4558 format("Color = %d, Name = %s", a, name));
4562 /* Label the Current values */
4563 Term_putstr(5, 12, -1, TERM_WHITE,
4564 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4565 angband_color_table[a][0],
4566 angband_color_table[a][1],
4567 angband_color_table[a][2],
4568 angband_color_table[a][3]));
4572 Term_putstr(0, 14, -1, TERM_WHITE,
4573 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4575 Term_putstr(0, 14, -1, TERM_WHITE,
4576 "Command (n/N/k/K/r/R/g/G/b/B): ");
4584 if (i == ESCAPE) break;
4587 if (i == 'n') a = (byte)(a + 1);
4588 if (i == 'N') a = (byte)(a - 1);
4589 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4590 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4591 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4592 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4593 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4594 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4595 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4596 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4598 /* Hack -- react to changes */
4599 Term_xtra(TERM_XTRA_REACT, 0);
4601 /* Hack -- redraw */
4608 /* Unknown option */
4614 /* Flush messages */
4619 /* Restore the screen */
4625 * Note something in the message recall
4627 void do_cmd_note(void)
4636 if (!get_string("¥á¥â: ", buf, 60)) return;
4638 if (!get_string("Note: ", buf, 60)) return;
4642 /* Ignore empty notes */
4643 if (!buf[0] || (buf[0] == ' ')) return;
4645 /* Add the note to the message recall */
4647 msg_format("¥á¥â: %s", buf);
4649 msg_format("Note: %s", buf);
4656 * Mention the current version
4658 void do_cmd_version(void)
4663 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4664 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4666 msg_format("You are playing Hengband %d.%d.%d.",
4667 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4674 * Array of feeling strings
4676 static cptr do_cmd_feeling_text[11] =
4679 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4681 "Looks like any other level.",
4685 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4687 "You feel there is something special about this level.",
4691 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4693 "You nearly faint as horrible visions of death fill your mind!",
4697 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4699 "This level looks very dangerous.",
4703 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4705 "You have a very bad feeling...",
4709 "°¤¤Í½´¶¤¬¤¹¤ë...",
4711 "You have a bad feeling...",
4717 "You feel nervous.",
4721 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4723 "You feel your luck is turning...",
4727 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4729 "You don't like the look of this place.",
4733 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4735 "This level looks reasonably safe.",
4739 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4741 "What a boring place..."
4746 static cptr do_cmd_feeling_text_combat[11] =
4749 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4751 "Looks like any other level.",
4755 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4757 "You feel there is something special about this level.",
4761 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4763 "You nearly faint as horrible visions of death fill your mind!",
4767 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4769 "This level looks very dangerous.",
4773 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4775 "You have a very bad feeling...",
4779 "°¤¤Í½´¶¤¬¤¹¤ë...",
4781 "You have a bad feeling...",
4787 "You feel nervous.",
4791 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4793 "You feel your luck is turning...",
4797 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4799 "You don't like the look of this place.",
4803 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4805 "This level looks reasonably safe.",
4809 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4811 "What a boring place..."
4816 static cptr do_cmd_feeling_text_lucky[11] =
4819 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4820 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4821 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4822 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4823 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4824 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4825 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4826 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4827 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4828 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4829 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4831 "Looks like any other level.",
4832 "You feel there is something special about this level.",
4833 "You have a superb feeling about this level.",
4834 "You have an excellent feeling...",
4835 "You have a very good feeling...",
4836 "You have a good feeling...",
4837 "You feel strangely lucky...",
4838 "You feel your luck is turning...",
4839 "You like the look of this place...",
4840 "This level can't be all bad...",
4841 "What a boring place..."
4847 * Note that "feeling" is set to zero unless some time has passed.
4848 * Note that this is done when the level is GENERATED, not entered.
4850 void do_cmd_feeling(void)
4852 /* Verify the feeling */
4853 if (feeling > 10) feeling = 10;
4855 /* No useful feeling in quests */
4856 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4859 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4861 msg_print("Looks like a typical quest level.");
4867 /* No useful feeling in town */
4868 else if (p_ptr->town_num && !dun_level)
4871 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4873 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4877 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4879 msg_print("Looks like a strange wilderness.");
4887 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4889 msg_print("Looks like a typical town.");
4896 /* No useful feeling in the wilderness */
4897 else if (!dun_level)
4900 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4902 msg_print("Looks like a typical wilderness.");
4908 /* Display the feeling */
4909 if (turn - old_turn >= (150 - dun_level)*TURNS_PER_TICK || cheat_xtra)
4911 if (p_ptr->muta3 & MUT3_GOOD_LUCK) msg_print(do_cmd_feeling_text_lucky[feeling]);
4913 if((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)){
4914 msg_print(do_cmd_feeling_text_combat[feeling]);
4916 msg_print(do_cmd_feeling_text[feeling]);
4921 msg_print(do_cmd_feeling_text[0]);
4928 * Description of each monster group.
4930 static cptr monster_group_text[] =
4933 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
4962 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
4979 /* "¾åµé¥Ç¡¼¥â¥ó", */
5019 /* "Ancient Dragon/Wyrm", */
5028 "Multi-Headed Reptile",
5033 "Reptile/Amphibian",
5034 "Spider/Scorpion/Tick",
5036 /* "Major Demon", */
5052 * Symbols of monsters in each group. Note the "Uniques" group
5053 * is handled differently.
5055 static cptr monster_group_char[] =
5109 "$!?=&`.|/\\~[]()>",
5118 * hook function to sort monsters by level
5120 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5122 u16b *who = (u16b*)(u);
5127 monster_race *r_ptr1 = &r_info[w1];
5128 monster_race *r_ptr2 = &r_info[w2];
5133 if (r_ptr2->level > r_ptr1->level) return TRUE;
5134 if (r_ptr1->level > r_ptr2->level) return FALSE;
5136 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5137 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5142 * Build a list of monster indexes in the given group. Return the number
5143 * of monsters in the group.
5145 * mode & 0x01 : check for non-empty group
5146 * mode & 0x02 : cheat?
5148 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5153 /* Get a list of x_char in this group */
5154 cptr group_char = monster_group_char[grp_cur];
5156 /* XXX Hack -- Check if this is the "Uniques" group */
5157 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5159 /* Check every race */
5160 for (i = 0; i < max_r_idx; i++)
5162 /* Access the race */
5163 monster_race *r_ptr = &r_info[i];
5165 /* Skip empty race */
5166 if (!r_ptr->name) continue ;
5168 /* Require known monsters */
5169 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights ) continue;
5171 if (grp_unique && !(r_ptr->flags1 & RF1_UNIQUE)) continue;
5173 /* Check for race in the group */
5174 if (grp_unique || strchr(group_char, r_ptr->d_char))
5177 mon_idx[mon_cnt++] = i;
5179 /* XXX Hack -- Just checking for non-empty group */
5180 if (mode & 0x01) break;
5184 /* Terminate the list */
5185 mon_idx[mon_cnt] = 0;
5187 /* Select the sort method */
5188 ang_sort_comp = ang_sort_comp_monster_level;
5189 ang_sort_swap = ang_sort_swap_hook;
5191 /* Sort by monster level */
5192 ang_sort(mon_idx, &dummy_why, mon_cnt);
5194 /* Return the number of races */
5200 * Description of each monster group.
5202 static cptr object_group_text[] =
5205 "¥¥Î¥³", /* "Mushrooms" */
5206 "Ìô", /* "Potions" */
5207 "Ìý¤Ä¤Ü", /* "Flasks" */
5208 "´¬Êª", /* "Scrolls" */
5209 "»ØÎØ", /* "Rings" */
5210 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5211 "ū", /* "Whistle" */
5212 "¸÷¸»", /* "Lanterns" */
5213 "ËâË¡ËÀ", /* "Wands" */
5214 "¾ó", /* "Staffs" */
5215 "¥í¥Ã¥É", /* "Rods" */
5216 "¥«¡¼¥É", /* "Cards" */
5217 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5226 "Åá·õÎà", /* "Swords" */
5227 "Æß´ï", /* "Blunt Weapons" */
5228 "ĹÊÁÉð´ï", /* "Polearms" */
5229 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5230 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5234 "·ÚÁõ³»", /* "Soft Armor" */
5235 "½ÅÁõ³»", /* "Hard Armor" */
5236 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5237 "½â", /* "Shields" */
5238 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5239 "äƼê", /* "Gloves" */
5240 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5241 "´§", /* "Crowns" */
5242 "¥Ö¡¼¥Ä", /* "Boots" */
5290 * TVALs of items in each group
5292 static byte object_group_tval[] =
5332 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5338 * Build a list of monster indexes in the given group. Return the number
5339 * of monsters in the group.
5341 static int collect_objects(int grp_cur, int object_idx[])
5343 int i, j, k, object_cnt = 0;
5345 /* Get a list of x_char in this group */
5346 byte group_tval = object_group_tval[grp_cur];
5348 /* Check every object */
5349 for (i = 0; i < max_k_idx; i++)
5351 /* Access the race */
5352 object_kind *k_ptr = &k_info[i];
5354 /* Skip empty objects */
5355 if (!k_ptr->name) continue;
5357 /* Skip non-flavoured objects */
5358 if (!k_ptr->flavor && !p_ptr->wizard) continue;
5360 /* Skip items with no distribution (special artifacts) */
5361 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5364 /* Require objects ever seen*/
5365 if (!k_ptr->aware && !p_ptr->wizard) continue;
5367 /* Check for race in the group */
5368 if (TV_LIFE_BOOK == group_tval)
5370 /* Hack -- All spell books */
5371 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5374 object_idx[object_cnt++] = i;
5377 else if (k_ptr->tval == group_tval)
5380 object_idx[object_cnt++] = i;
5384 /* Terminate the list */
5385 object_idx[object_cnt] = 0;
5387 /* Return the number of races */
5393 * Description of each feature group.
5395 static cptr feature_group_text[] =
5403 * Build a list of feature indexes in the given group. Return the number
5404 * of features in the group.
5406 static int collect_features(int grp_cur, int *feat_idx)
5408 int i, feat_cnt = 0;
5410 /* Unused; There is a single group. */
5413 /* Check every feature */
5414 for (i = 1; i < max_f_idx; i++)
5416 /* Access the index */
5417 feature_type *f_ptr = &f_info[i];
5419 /* Skip empty index */
5420 if (!f_ptr->name) continue;
5422 /* Skip mimiccing features */
5423 if (f_ptr->mimic != i) continue;
5426 feat_idx[feat_cnt++] = i;
5429 /* Terminate the list */
5430 feat_idx[feat_cnt] = 0;
5432 /* Return the number of races */
5439 * Build a list of monster indexes in the given group. Return the number
5440 * of monsters in the group.
5442 static int collect_artifacts(int grp_cur, int object_idx[])
5444 int i, object_cnt = 0;
5446 /* Get a list of x_char in this group */
5447 byte group_tval = object_group_tval[grp_cur];
5449 /* Check every object */
5450 for (i = 0; i < max_a_idx; i++)
5452 /* Access the artifact */
5453 artifact_type *a_ptr = &a_info[i];
5455 /* Skip empty artifacts */
5456 if (!a_ptr->name) continue;
5458 /* Skip "uncreated" artifacts */
5459 if (!a_ptr->cur_num) continue;
5461 /* Check for race in the group */
5462 if (a_ptr->tval == group_tval)
5465 object_idx[object_cnt++] = i;
5469 /* Terminate the list */
5470 object_idx[object_cnt] = 0;
5472 /* Return the number of races */
5479 * Encode the screen colors
5481 static char hack[17] = "dwsorgbuDWvyRGBU";
5484 static errr photo_fgets(FILE *fff, char *buf, huge n)
5493 if (fgets(tmp, 1024, fff))
5495 /* Convert weirdness */
5496 for (s = tmp; *s; s++)
5498 /* Handle newline */
5509 else if (*s == '\t')
5511 /* Hack -- require room */
5512 if (i + 8 >= n) break;
5514 /* Append a space */
5517 /* Append some more spaces */
5518 while (!(i % 8)) buf[i++] = ' ';
5522 else if (iskanji(*s))
5529 /* Ⱦ³Ñ¤«¤Ê¤ËÂбþ */
5530 else if ((((int)*s & 0xff) > 0xa1) && (((int)*s & 0xff ) < 0xdf))
5537 /* Handle printables */
5558 * Hack -- load a screen dump from a file
5560 void do_cmd_load_screen(void)
5575 Term_get_size(&wid, &hgt);
5577 /* Build the filename */
5578 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5580 /* Append to the file */
5581 fff = my_fopen(buf, "r");
5586 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5588 msg_format("Failed to open %s.", buf);
5595 /* Save the screen */
5598 /* Clear the screen */
5602 /* Load the screen */
5603 for (y = 0; okay && (y < hgt); y++)
5605 /* Get a line of data */
5606 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5609 for (x = 0; x < wid - 1; x++)
5611 /* Put the attr/char */
5612 Term_draw(x, y, TERM_WHITE, buf[x]);
5616 /* Get the blank line */
5617 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5620 /* Dump the screen */
5621 for (y = 0; okay && (y < hgt); y++)
5623 /* Get a line of data */
5624 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5627 for (x = 0; x < wid - 1; x++)
5629 /* Get the attr/char */
5630 (void)(Term_what(x, y, &a, &c));
5632 /* Look up the attr */
5633 for (i = 0; i < 16; i++)
5635 /* Use attr matches */
5636 if (hack[i] == buf[x]) a = i;
5639 /* Put the attr/char */
5640 Term_draw(x, y, a, c);
5645 /* Get the blank line */
5646 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5655 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5657 msg_print("Screen dump loaded.");
5664 /* Restore the screen */
5671 cptr inven_res_label =
5673 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5675 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5680 #define IM_FLAG_STR "¡ö"
5681 #define HAS_FLAG_STR "¡Ü"
5682 #define NO_FLAG_STR "¡¦"
5684 #define IM_FLAG_STR "* "
5685 #define HAS_FLAG_STR "+ "
5686 #define NO_FLAG_STR ". "
5689 #define print_im_or_res_flag(IM, RES) \
5691 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
5692 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
5695 #define print_flag(TR) \
5697 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
5701 /* XTRA HACK RESLIST */
5702 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
5704 char o_name[MAX_NLEN];
5705 u32b flgs[TR_FLAG_SIZE];
5707 if (!o_ptr->k_idx) return;
5708 if (o_ptr->tval != tval) return;
5710 /* Identified items only */
5711 if (!object_known_p(o_ptr)) return;
5714 * HACK:Ring of Lordly protection and Dragon equipment
5715 * have random resistances.
5717 if (((o_ptr->tval >= TV_BOW) && (o_ptr->tval<= TV_DRAG_ARMOR) && o_ptr->name2)
5718 || ((o_ptr->tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
5719 || ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
5720 || ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
5721 || ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
5722 || ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
5723 || ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
5724 || o_ptr->art_name || o_ptr->name1)
5727 object_desc(o_name, o_ptr, TRUE, 0);
5729 while (o_name[i] && (i < 26))
5732 if (iskanji(o_name[i])) i++;
5741 o_name[i] = ' '; i++;
5746 fprintf(fff, "%s %s", where, o_name);
5748 if (!(o_ptr->ident & (IDENT_MENTAL)))
5751 fputs("-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n", fff);
5753 fputs("-------unknown------------ -------unknown------\n", fff);
5758 object_flags_known(o_ptr, flgs);
5760 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
5761 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
5762 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
5763 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
5764 print_flag(TR_RES_POIS);
5765 print_flag(TR_RES_LITE);
5766 print_flag(TR_RES_DARK);
5767 print_flag(TR_RES_SHARDS);
5768 print_flag(TR_RES_SOUND);
5769 print_flag(TR_RES_NETHER);
5770 print_flag(TR_RES_NEXUS);
5771 print_flag(TR_RES_CHAOS);
5772 print_flag(TR_RES_DISEN);
5776 print_flag(TR_RES_BLIND);
5777 print_flag(TR_RES_FEAR);
5778 print_flag(TR_RES_CONF);
5779 print_flag(TR_FREE_ACT);
5780 print_flag(TR_SEE_INVIS);
5781 print_flag(TR_HOLD_LIFE);
5782 print_flag(TR_TELEPATHY);
5783 print_flag(TR_SLOW_DIGEST);
5784 print_flag(TR_REGEN);
5785 print_flag(TR_FEATHER);
5793 fprintf(fff, "%s\n", inven_res_label);
5799 * Display *ID* ed weapons/armors's resistances
5801 static void do_cmd_knowledge_inven(void)
5805 char file_name[1024];
5815 /* Open a new file */
5816 fff = my_fopen_temp(file_name, 1024);
5820 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5822 msg_format("Failed to create temporary file %s.", file_name);
5827 fprintf(fff, "%s\n", inven_res_label);
5829 for (tval = TV_BOW; tval <= TV_RING; tval++)
5833 for (; j < 9; j++) fputc('\n', fff);
5835 fprintf(fff, "%s\n", inven_res_label);
5839 strcpy(where, "Áõ");
5841 strcpy(where, "E ");
5843 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5845 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5849 strcpy(where, "»ý");
5851 strcpy(where, "I ");
5853 for (i = 0; i < INVEN_PACK; i++)
5855 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
5858 st_ptr = &town[1].store[STORE_HOME];
5860 strcpy(where, "²È");
5862 strcpy(where, "H ");
5865 for (i = 0; i < st_ptr->stock_num; i++)
5867 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
5871 /* Close the file */
5874 /* Display the file contents */
5876 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5878 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5881 /* Remove the file */
5886 void do_cmd_save_screen_html_aux(char *filename, int message)
5890 byte a = 0, old_a = 0;
5904 cptr html_head[] = {
5905 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5909 cptr html_foot[] = {
5911 "</body>\n</html>\n",
5917 Term_get_size(&wid, &hgt);
5919 /* File type is "TEXT" */
5920 FILE_TYPE(FILE_TYPE_TEXT);
5922 /* Append to the file */
5923 fff = my_fopen(filename, "w");
5929 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5931 msg_format("Failed to open file %s.", filename);
5939 /* Save the screen */
5943 /* Build the filename */
5944 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5945 tmpfff = my_fopen(buf, "r");
5947 for (i = 0; html_head[i]; i++)
5948 fprintf(fff, html_head[i]);
5952 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5954 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
5958 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
5960 fprintf(fff, "%s\n", buf);
5965 /* Dump the screen */
5966 for (y = 0; y < hgt; y++)
5973 for (x = 0; x < wid - 1; x++)
5977 /* Get the attr/char */
5978 (void)(Term_what(x, y, &a, &c));
5982 case '&': cc = "&"; break;
5983 case '<': cc = "<"; break;
5984 case '>': cc = ">"; break;
5986 case 0x1f: c = '.'; break;
5987 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5992 if ((y == 0 && x == 0) || a != old_a) {
5993 rv = angband_color_table[a][1];
5994 gv = angband_color_table[a][2];
5995 bv = angband_color_table[a][3];
5996 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5997 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
6001 fprintf(fff, "%s", cc);
6003 fprintf(fff, "%c", c);
6006 fprintf(fff, "</font>");
6009 for (i = 0; html_foot[i]; i++)
6010 fprintf(fff, html_foot[i]);
6015 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6017 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6021 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6023 fprintf(fff, "%s\n", buf);
6038 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6040 msg_print("Screen dump saved.");
6045 /* Restore the screen */
6051 * Hack -- save a screen dump to a file
6053 static void do_cmd_save_screen_html(void)
6055 char buf[1024], tmp[256] = "screen.html";
6058 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6060 if (!get_string("File name: ", tmp, 80))
6064 /* Build the filename */
6065 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6069 do_cmd_save_screen_html_aux(buf, 1);
6074 * Redefinable "save_screen" action
6076 void (*screendump_aux)(void) = NULL;
6080 * Hack -- save a screen dump to a file
6082 void do_cmd_save_screen(void)
6084 bool old_use_graphics = use_graphics;
6085 bool html_dump = FALSE;
6090 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6092 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6097 if (c == 'Y' || c == 'y')
6099 else if (c == 'H' || c == 'h')
6111 Term_get_size(&wid, &hgt);
6113 if (old_use_graphics)
6115 use_graphics = FALSE;
6118 /* Redraw everything */
6119 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6121 /* Hack -- update */
6127 do_cmd_save_screen_html();
6131 /* Do we use a special screendump function ? */
6132 else if (screendump_aux)
6134 /* Dump the screen to a graphics file */
6135 (*screendump_aux)();
6137 else /* Dump the screen as text */
6148 /* Build the filename */
6149 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6151 /* File type is "TEXT" */
6152 FILE_TYPE(FILE_TYPE_TEXT);
6154 /* Append to the file */
6155 fff = my_fopen(buf, "w");
6161 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6163 msg_format("Failed to open file %s.", buf);
6170 /* Save the screen */
6174 /* Dump the screen */
6175 for (y = 0; y < hgt; y++)
6178 for (x = 0; x < wid - 1; x++)
6180 /* Get the attr/char */
6181 (void)(Term_what(x, y, &a, &c));
6191 fprintf(fff, "%s\n", buf);
6198 /* Dump the screen */
6199 for (y = 0; y < hgt; y++)
6202 for (x = 0; x < wid - 1; x++)
6204 /* Get the attr/char */
6205 (void)(Term_what(x, y, &a, &c));
6208 buf[x] = hack[a&0x0F];
6215 fprintf(fff, "%s\n", buf);
6227 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6229 msg_print("Screen dump saved.");
6235 /* Restore the screen */
6239 if (old_use_graphics)
6241 use_graphics = TRUE;
6244 /* Redraw everything */
6245 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6247 /* Hack -- update */
6254 * Sorting hook -- Comp function -- see below
6256 * We use "u" to point to array of monster indexes,
6257 * and "v" to select the type of sorting to perform on "u".
6259 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6261 u16b *who = (u16b*)(u);
6263 u16b *why = (u16b*)(v);
6270 /* Sort by total kills */
6273 /* Extract total kills */
6274 z1 = a_info[w1].tval;
6275 z2 = a_info[w2].tval;
6277 /* Compare total kills */
6278 if (z1 < z2) return (TRUE);
6279 if (z1 > z2) return (FALSE);
6283 /* Sort by monster level */
6286 /* Extract levels */
6287 z1 = a_info[w1].sval;
6288 z2 = a_info[w2].sval;
6290 /* Compare levels */
6291 if (z1 < z2) return (TRUE);
6292 if (z1 > z2) return (FALSE);
6296 /* Sort by monster experience */
6299 /* Extract experience */
6300 z1 = a_info[w1].level;
6301 z2 = a_info[w2].level;
6303 /* Compare experience */
6304 if (z1 < z2) return (TRUE);
6305 if (z1 > z2) return (FALSE);
6309 /* Compare indexes */
6315 * Sorting hook -- Swap function -- see below
6317 * We use "u" to point to array of monster indexes,
6318 * and "v" to select the type of sorting to perform.
6320 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6322 u16b *who = (u16b*)(u);
6337 * Check the status of "artifacts"
6339 static void do_cmd_knowledge_artifacts(void)
6341 int i, k, z, x, y, n = 0;
6347 char file_name[1024];
6349 char base_name[MAX_NLEN];
6353 /* Open a new file */
6354 fff = my_fopen_temp(file_name, 1024);
6358 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6360 msg_format("Failed to create temporary file %s.", file_name);
6366 /* Allocate the "who" array */
6367 C_MAKE(who, max_a_idx, s16b);
6369 /* Allocate the "okay" array */
6370 C_MAKE(okay, max_a_idx, bool);
6372 /* Scan the artifacts */
6373 for (k = 0; k < max_a_idx; k++)
6375 artifact_type *a_ptr = &a_info[k];
6380 /* Skip "empty" artifacts */
6381 if (!a_ptr->name) continue;
6383 /* Skip "uncreated" artifacts */
6384 if (!a_ptr->cur_num) continue;
6390 /* Check the dungeon */
6391 for (y = 0; y < cur_hgt; y++)
6393 for (x = 0; x < cur_wid; x++)
6395 cave_type *c_ptr = &cave[y][x];
6397 s16b this_o_idx, next_o_idx = 0;
6399 /* Scan all objects in the grid */
6400 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6404 /* Acquire object */
6405 o_ptr = &o_list[this_o_idx];
6407 /* Acquire next object */
6408 next_o_idx = o_ptr->next_o_idx;
6410 /* Ignore non-artifacts */
6411 if (!artifact_p(o_ptr)) continue;
6413 /* Ignore known items */
6414 if (object_known_p(o_ptr)) continue;
6416 /* Note the artifact */
6417 okay[o_ptr->name1] = FALSE;
6422 /* Check the inventory and equipment */
6423 for (i = 0; i < INVEN_TOTAL; i++)
6425 object_type *o_ptr = &inventory[i];
6427 /* Ignore non-objects */
6428 if (!o_ptr->k_idx) continue;
6430 /* Ignore non-artifacts */
6431 if (!artifact_p(o_ptr)) continue;
6433 /* Ignore known items */
6434 if (object_known_p(o_ptr)) continue;
6436 /* Note the artifact */
6437 okay[o_ptr->name1] = FALSE;
6440 for (k = 0; k < max_a_idx; k++)
6442 if (okay[k]) who[n++] = k;
6445 /* Select the sort method */
6446 ang_sort_comp = ang_sort_art_comp;
6447 ang_sort_swap = ang_sort_art_swap;
6449 /* Sort the array by dungeon depth of monsters */
6450 ang_sort(who, &why, n);
6452 /* Scan the artifacts */
6453 for (k = 0; k < n; k++)
6455 artifact_type *a_ptr = &a_info[who[k]];
6459 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6461 strcpy(base_name, "Unknown Artifact");
6465 /* Obtain the base object type */
6466 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6474 /* Get local object */
6477 /* Create fake object */
6478 object_prep(q_ptr, z);
6480 /* Make it an artifact */
6481 q_ptr->name1 = (byte)who[k];
6483 /* Describe the artifact */
6484 object_desc_store(base_name, q_ptr, FALSE, 0);
6487 /* Hack -- Build the artifact name */
6489 fprintf(fff, " %s\n", base_name);
6491 fprintf(fff, " The %s\n", base_name);
6496 /* Free the "who" array */
6497 C_KILL(who, max_a_idx, s16b);
6499 /* Free the "okay" array */
6500 C_KILL(okay, max_a_idx, bool);
6502 /* Close the file */
6505 /* Display the file contents */
6507 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6509 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6513 /* Remove the file */
6519 * Display known uniques
6521 static void do_cmd_knowledge_uniques(void)
6529 char file_name[1024];
6531 /* Open a new file */
6532 fff = my_fopen_temp(file_name, 1024);
6536 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6538 msg_format("Failed to create temporary file %s.", file_name);
6544 /* Allocate the "who" array */
6545 C_MAKE(who, max_r_idx, s16b);
6547 /* Scan the monsters */
6548 for (i = 1; i < max_r_idx; i++)
6550 monster_race *r_ptr = &r_info[i];
6552 /* Use that monster */
6553 if (r_ptr->name) who[n++] = i;
6556 /* Select the sort method */
6557 ang_sort_comp = ang_sort_comp_hook;
6558 ang_sort_swap = ang_sort_swap_hook;
6560 /* Sort the array by dungeon depth of monsters */
6561 ang_sort(who, &why, n);
6563 /* Scan the monster races */
6564 for (k = 0; k < n; k++)
6566 monster_race *r_ptr = &r_info[who[k]];
6568 /* Only print Uniques */
6569 if (r_ptr->flags1 & (RF1_UNIQUE))
6571 bool dead = (r_ptr->max_num == 0);
6575 /* Only display "known" uniques */
6576 if (dead || cheat_know || r_ptr->r_sights)
6578 /* Print a message */
6580 fprintf(fff, " %s¤Ï¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¡£\n",
6581 (r_name + r_ptr->name));
6583 fprintf(fff, " %s is alive\n",
6584 (r_name + r_ptr->name));
6591 /* Free the "who" array */
6592 C_KILL(who, max_r_idx, s16b);
6594 /* Close the file */
6597 /* Display the file contents */
6599 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6601 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6605 /* Remove the file */
6611 * Display weapon-exp
6613 static void do_cmd_knowledge_weapon_exp(void)
6615 int i, j, num, weapon_exp;
6619 char file_name[1024];
6622 /* Open a new file */
6623 fff = my_fopen_temp(file_name, 1024);
6626 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6628 msg_format("Failed to create temporary file %s.", file_name);
6634 for (i = 0; i < 5; i++)
6636 for (num = 0; num < 64; num++)
6638 for (j = 0; j < max_k_idx; j++)
6640 object_kind *k_ptr = &k_info[j];
6642 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6644 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6646 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6648 fprintf(fff, "%-25s ", tmp);
6649 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6650 else fprintf(fff, " ");
6651 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6652 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6660 /* Close the file */
6663 /* Display the file contents */
6665 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6667 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6671 /* Remove the file */
6679 static void do_cmd_knowledge_spell_exp(void)
6681 int i = 0, spell_exp, exp_level;
6686 char file_name[1024];
6688 /* Open a new file */
6689 fff = my_fopen_temp(file_name, 1024);
6692 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6694 msg_format("Failed to create temporary file %s.", file_name);
6700 if (p_ptr->realm1 != REALM_NONE)
6703 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6705 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6707 for (i = 0; i < 32; i++)
6709 if (!is_magic(p_ptr->realm1))
6711 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6715 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6717 if (s_ptr->slevel >= 99) continue;
6718 spell_exp = p_ptr->spell_exp[i];
6719 exp_level = spell_exp_level(spell_exp);
6720 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm1) - 1][i]);
6721 if (p_ptr->realm1 == REALM_HISSATSU)
6722 fprintf(fff, "[--]");
6725 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6726 else fprintf(fff, " ");
6727 fprintf(fff, "%s", exp_level_str[exp_level]);
6729 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6734 if (p_ptr->realm2 != REALM_NONE)
6737 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6739 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6741 for (i = 0; i < 32; i++)
6743 if (!is_magic(p_ptr->realm1))
6745 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6749 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6751 if (s_ptr->slevel >= 99) continue;
6753 spell_exp = p_ptr->spell_exp[i + 32];
6754 exp_level = spell_exp_level(spell_exp);
6755 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm2) - 1][i]);
6756 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6757 else fprintf(fff, " ");
6758 fprintf(fff, "%s", exp_level_str[exp_level]);
6759 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6764 /* Close the file */
6767 /* Display the file contents */
6769 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6771 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6775 /* Remove the file */
6783 static void do_cmd_knowledge_skill_exp(void)
6785 int i = 0, skill_exp;
6789 char file_name[1024];
6791 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6793 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6796 /* Open a new file */
6797 fff = my_fopen_temp(file_name, 1024);
6800 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6802 msg_format("Failed to create temporary file %s.", file_name);
6808 for (i = 0; i < 3; i++)
6810 skill_exp = p_ptr->skill_exp[i];
6811 fprintf(fff, "%-20s ", skill_name[i]);
6812 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6813 else fprintf(fff, " ");
6814 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6815 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6819 /* Close the file */
6822 /* Display the file contents */
6824 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6826 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6830 /* Remove the file */
6836 * Pluralize a monster name
6838 void plural_aux(char *Name)
6840 int NameLen = strlen(Name);
6842 if (strstr(Name, "Disembodied hand"))
6844 strcpy(Name, "Disembodied hands that strangled people");
6846 else if (strstr(Name, "Colour out of space"))
6848 strcpy(Name, "Colours out of space");
6850 else if (strstr(Name, "stairway to hell"))
6852 strcpy(Name, "stairways to hell");
6854 else if (strstr(Name, "Dweller on the threshold"))
6856 strcpy(Name, "Dwellers on the threshold");
6858 else if (strstr(Name, " of "))
6860 cptr aider = strstr(Name, " of ");
6871 if (dummy[i-1] == 's')
6873 strcpy(&(dummy[i]), "es");
6878 strcpy(&(dummy[i]), "s");
6881 strcpy(&(dummy[i+1]), aider);
6882 strcpy(Name, dummy);
6884 else if (strstr(Name, "coins"))
6887 strcpy(dummy, "piles of ");
6888 strcat(dummy, Name);
6889 strcpy(Name, dummy);
6892 else if (strstr(Name, "Manes"))
6896 else if (streq(&(Name[NameLen - 2]), "ey"))
6898 strcpy(&(Name[NameLen - 2]), "eys");
6900 else if (Name[NameLen - 1] == 'y')
6902 strcpy(&(Name[NameLen - 1]), "ies");
6904 else if (streq(&(Name[NameLen - 4]), "ouse"))
6906 strcpy(&(Name[NameLen - 4]), "ice");
6908 else if (streq(&(Name[NameLen - 2]), "us"))
6910 strcpy(&(Name[NameLen - 2]), "i");
6912 else if (streq(&(Name[NameLen - 6]), "kelman"))
6914 strcpy(&(Name[NameLen - 6]), "kelmen");
6916 else if (streq(&(Name[NameLen - 8]), "wordsman"))
6918 strcpy(&(Name[NameLen - 8]), "wordsmen");
6920 else if (streq(&(Name[NameLen - 7]), "oodsman"))
6922 strcpy(&(Name[NameLen - 7]), "oodsmen");
6924 else if (streq(&(Name[NameLen - 7]), "eastman"))
6926 strcpy(&(Name[NameLen - 7]), "eastmen");
6928 else if (streq(&(Name[NameLen - 8]), "izardman"))
6930 strcpy(&(Name[NameLen - 8]), "izardmen");
6932 else if (streq(&(Name[NameLen - 5]), "geist"))
6934 strcpy(&(Name[NameLen - 5]), "geister");
6936 else if (streq(&(Name[NameLen - 2]), "ex"))
6938 strcpy(&(Name[NameLen - 2]), "ices");
6940 else if (streq(&(Name[NameLen - 2]), "lf"))
6942 strcpy(&(Name[NameLen - 2]), "lves");
6944 else if (suffix(Name, "ch") ||
6945 suffix(Name, "sh") ||
6946 suffix(Name, "nx") ||
6947 suffix(Name, "s") ||
6950 strcpy(&(Name[NameLen]), "es");
6954 strcpy(&(Name[NameLen]), "s");
6959 * Display current pets
6961 static void do_cmd_knowledge_pets(void)
6965 monster_type *m_ptr;
6968 int show_upkeep = 0;
6969 char file_name[1024];
6972 /* Open a new file */
6973 fff = my_fopen_temp(file_name, 1024);
6976 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6978 msg_format("Failed to create temporary file %s.", file_name);
6984 /* Process the monsters (backwards) */
6985 for (i = m_max - 1; i >= 1; i--)
6987 /* Access the monster */
6990 /* Ignore "dead" monsters */
6991 if (!m_ptr->r_idx) continue;
6993 /* Calculate "upkeep" for pets */
6997 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6998 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7002 /* Process the waiting pets (backwards) */
7003 for (i = MAX_PARTY_MON - 1; i >= 0; i--)
7005 /* Access the monster */
7006 m_ptr = &party_mon[i];
7008 /* Ignore "dead" monsters */
7009 if (!m_ptr->r_idx) continue;
7013 /* List waiting pets */
7014 monster_desc(pet_name, m_ptr, MD_ASSUME_OUTSIDE | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
7015 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
7018 show_upkeep = calculate_upkeep();
7020 fprintf(fff, "----------------------------------------------\n");
7022 fprintf(fff, " ¹ç·×: %d ɤ¤Î¥Ú¥Ã¥È\n", t_friends);
7023 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7025 fprintf(fff, " Total: %d pet%s.\n",
7026 t_friends, (t_friends == 1 ? "" : "s"));
7027 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7032 /* Close the file */
7035 /* Display the file contents */
7037 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7039 show_file(TRUE, file_name, "Current Pets", 0, 0);
7043 /* Remove the file */
7051 * Note that the player ghosts are ignored. XXX XXX XXX
7053 static void do_cmd_knowledge_kill_count(void)
7061 char file_name[1024];
7066 /* Open a new file */
7067 fff = my_fopen_temp(file_name, 1024);
7071 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7073 msg_format("Failed to create temporary file %s.", file_name);
7079 /* Allocate the "who" array */
7080 C_MAKE(who, max_r_idx, s16b);
7083 /* Monsters slain */
7086 for (kk = 1; kk < max_r_idx; kk++)
7088 monster_race *r_ptr = &r_info[kk];
7090 if (r_ptr->flags1 & (RF1_UNIQUE))
7092 bool dead = (r_ptr->max_num == 0);
7101 s16b This = r_ptr->r_pkills;
7112 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7114 fprintf(fff,"You have defeated no enemies yet.\n\n");
7117 else if (Total == 1)
7119 fprintf(fff,"¤¢¤Ê¤¿¤Ï°ìɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n");
7121 fprintf(fff,"You have defeated one enemy.\n\n");
7126 fprintf(fff,"¤¢¤Ê¤¿¤Ï %lu ɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7128 fprintf(fff,"You have defeated %lu enemies.\n\n", Total);
7135 /* Scan the monsters */
7136 for (i = 1; i < max_r_idx; i++)
7138 monster_race *r_ptr = &r_info[i];
7140 /* Use that monster */
7141 if (r_ptr->name) who[n++] = i;
7144 /* Select the sort method */
7145 ang_sort_comp = ang_sort_comp_hook;
7146 ang_sort_swap = ang_sort_swap_hook;
7148 /* Sort the array by dungeon depth of monsters */
7149 ang_sort(who, &why, n);
7151 /* Scan the monster races */
7152 for (k = 0; k < n; k++)
7154 monster_race *r_ptr = &r_info[who[k]];
7156 if (r_ptr->flags1 & (RF1_UNIQUE))
7158 bool dead = (r_ptr->max_num == 0);
7162 /* Print a message */
7163 fprintf(fff, " %s\n",
7164 (r_name + r_ptr->name));
7170 s16b This = r_ptr->r_pkills;
7175 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita*/
7176 if(strchr("pt",r_ptr->d_char))
7177 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7179 fprintf(fff, " %3d ɤ¤Î %s\n", This, r_name + r_ptr->name);
7183 if (strstr(r_name + r_ptr->name, "coins"))
7185 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7189 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7195 strcpy(ToPlural, (r_name + r_ptr->name));
7196 plural_aux(ToPlural);
7197 fprintf(fff, " %d %s\n", This, ToPlural);
7207 fprintf(fff,"----------------------------------------------\n");
7209 fprintf(fff," ¹ç·×: %lu ɤ¤òÅݤ·¤¿¡£\n", Total);
7211 fprintf(fff," Total: %lu creature%s killed.\n",
7212 Total, (Total == 1 ? "" : "s"));
7216 /* Free the "who" array */
7217 C_KILL(who, max_r_idx, s16b);
7219 /* Close the file */
7222 /* Display the file contents */
7224 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7226 show_file(TRUE, file_name, "Kill Count", 0, 0);
7230 /* Remove the file */
7236 * Display the object groups.
7238 static void display_group_list(int col, int row, int wid, int per_page,
7239 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7243 /* Display lines until done */
7244 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7246 /* Get the group index */
7247 int grp = grp_idx[grp_top + i];
7249 /* Choose a color */
7250 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7252 /* Erase the entire line */
7253 Term_erase(col, row + i, wid);
7255 /* Display the group label */
7256 c_put_str(attr, group_text[grp], row + i, col);
7262 * Move the cursor in a browser window
7264 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7265 int *list_cur, int list_cnt)
7270 int list = *list_cur;
7272 /* Extract direction */
7275 /* Hack -- scroll up full screen */
7280 /* Hack -- scroll down full screen */
7285 d = get_keymap_dir(ch);
7290 /* Diagonals - hack */
7291 if ((ddx[d] > 0) && ddy[d])
7297 Term_get_size(&wid, &hgt);
7299 browser_rows = hgt - 8;
7301 /* Browse group list */
7306 /* Move up or down */
7307 grp += ddy[d] * (browser_rows - 1);
7310 if (grp >= grp_cnt) grp = grp_cnt - 1;
7311 if (grp < 0) grp = 0;
7312 if (grp != old_grp) list = 0;
7315 /* Browse sub-list list */
7318 /* Move up or down */
7319 list += ddy[d] * browser_rows;
7322 if (list >= list_cnt) list = list_cnt - 1;
7323 if (list < 0) list = 0;
7335 if (col < 0) col = 0;
7336 if (col > 1) col = 1;
7343 /* Browse group list */
7348 /* Move up or down */
7352 if (grp >= grp_cnt) grp = grp_cnt - 1;
7353 if (grp < 0) grp = 0;
7354 if (grp != old_grp) list = 0;
7357 /* Browse sub-list list */
7360 /* Move up or down */
7364 if (list >= list_cnt) list = list_cnt - 1;
7365 if (list < 0) list = 0;
7376 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7380 /* Clear the display lines */
7381 for (i = 0; i < height; i++)
7383 Term_erase(col, row + i, width);
7386 /* Bigtile mode uses double width */
7387 if (use_bigtile) width /= 2;
7389 /* Display lines until done */
7390 for (i = 0; i < height; i++)
7392 /* Display columns until done */
7393 for (j = 0; j < width; j++)
7401 /* Bigtile mode uses double width */
7402 if (use_bigtile) x += j;
7407 /* Ignore illegal characters */
7408 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7409 (!use_graphics && ic > 0x7f))
7415 /* Force correct code for both ASCII character and tile */
7416 if (c & 0x80) a |= 0x80;
7418 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7420 /* Display symbol */
7421 Term_putch(x, y, a, c);
7424 if (use_bigtile) Term_putch(x + 1, y, a2, c2);
7431 * Place the cursor at the collect position for visual mode
7433 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7435 int i = (a & 0x7f) - attr_top;
7436 int j = c - char_left;
7441 /* Bigtile mode uses double width */
7442 if (use_bigtile) x += j;
7444 /* Place the cursor */
7450 * Clipboard variables for copy&paste in visual mode
7452 static byte attr_idx = 0;
7453 static byte char_idx = 0;
7456 * Do visual mode command -- Change symbols
7458 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7459 int height, int width,
7460 byte *attr_top_ptr, byte *char_left_ptr,
7461 byte *cur_attr_ptr, byte *cur_char_ptr)
7463 static byte attr_old = 0, char_old = 0;
7468 if (*visual_list_ptr)
7471 *cur_attr_ptr = attr_old;
7472 *cur_char_ptr = char_old;
7473 *visual_list_ptr = FALSE;
7482 if (*visual_list_ptr)
7485 *visual_list_ptr = FALSE;
7493 if (!*visual_list_ptr)
7495 *visual_list_ptr = TRUE;
7497 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7498 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7500 attr_old = *cur_attr_ptr;
7501 char_old = *cur_char_ptr;
7509 /* Set the visual */
7510 attr_idx = *cur_attr_ptr;
7511 char_idx = *cur_char_ptr;
7520 *cur_attr_ptr = attr_idx;
7521 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7527 *cur_char_ptr = char_idx;
7528 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7534 if (*visual_list_ptr)
7537 int d = get_keymap_dir(ch);
7538 byte a = (*cur_attr_ptr & 0x7f);
7539 byte c = *cur_char_ptr;
7541 if (use_bigtile) eff_width = width / 2;
7542 else eff_width = width;
7544 /* Restrict direction */
7545 if ((a == 0) && (ddy[d] < 0)) d = 0;
7546 if ((c == 0) && (ddx[d] < 0)) d = 0;
7547 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7548 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7553 /* Force correct code for both ASCII character and tile */
7554 if (c & 0x80) a |= 0x80;
7556 /* Set the visual */
7561 /* Move the frame */
7562 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7563 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7564 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7565 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7572 /* Visual mode command is not used */
7578 * Display the monsters in a group.
7580 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7581 int mon_cur, int mon_top)
7585 /* Display lines until done */
7586 for (i = 0; i < per_page && mon_idx[mon_top + i]; i++)
7592 /* Get the race index */
7593 int r_idx = mon_idx[mon_top + i] ;
7595 /* Access the race */
7596 monster_race *r_ptr = &r_info[r_idx];
7599 /* Choose a color */
7600 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7602 /* Display the name */
7603 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7605 /* Hack -- visual_list mode */
7608 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, 60);
7610 else if (p_ptr->wizard)
7612 c_prt(attr, format("%d", r_idx), row + i, 60);
7617 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7619 /* Display symbol */
7620 Term_putch(70, row + i, a, c);
7623 if (use_bigtile) Term_putch(70 + 1, row + i, a2, c2);
7626 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7628 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 73);
7630 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "dead" : "alive"), row + i, 73);
7635 /* Clear remaining lines */
7636 for (; i < per_page; i++)
7638 Term_erase(col, row + i, 255);
7644 * Display known monsters.
7646 static void do_cmd_knowledge_monsters(void)
7649 int grp_cur, grp_top, old_grp_cur;
7650 int mon_cur, mon_top;
7651 int grp_cnt, grp_idx[100];
7659 bool visual_list = FALSE;
7660 byte attr_top = 0, char_left = 0;
7666 Term_get_size(&wid, &hgt);
7668 browser_rows = hgt - 8;
7670 /* Allocate the "mon_idx" array */
7671 C_MAKE(mon_idx, max_r_idx, s16b);
7676 /* Check every group */
7677 for (i = 0; monster_group_text[i] != NULL; i++)
7679 /* Measure the label */
7680 len = strlen(monster_group_text[i]);
7682 /* Save the maximum length */
7683 if (len > max) max = len;
7685 /* See if any monsters are known */
7686 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, 0x01))
7688 /* Build a list of groups with known monsters */
7689 grp_idx[grp_cnt++] = i;
7693 /* Terminate the list */
7694 grp_idx[grp_cnt] = -1;
7697 grp_cur = grp_top = 0;
7698 mon_cur = mon_top = 0;
7707 monster_race *r_ptr;
7714 prt("Ãμ± - ¥â¥ó¥¹¥¿¡¼", 2, 0);
7715 prt("¥°¥ë¡¼¥×", 4, 0);
7716 prt("̾Á°", 4, max + 3);
7717 if (p_ptr->wizard) prt("Idx", 4, 60);
7718 prt("ʸ»ú »¦³²¿ô", 4, 67);
7720 prt("Knowledge - Monsters", 2, 0);
7722 prt("Name", 4, max + 3);
7723 if (p_ptr->wizard) prt("Idx", 4, 60);
7724 prt("Sym Kills", 4, 67);
7727 for (i = 0; i < 78; i++)
7729 Term_putch(i, 5, TERM_WHITE, '=');
7732 for (i = 0; i < browser_rows; i++)
7734 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7740 /* Scroll group list */
7741 if (grp_cur < grp_top) grp_top = grp_cur;
7742 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7744 /* Display a list of monster groups */
7745 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7747 if (old_grp_cur != grp_cur)
7749 old_grp_cur = grp_cur;
7751 /* Get a list of monsters in the current group */
7752 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, 0x00);
7755 /* Scroll monster list */
7756 while (mon_cur < mon_top)
7757 mon_top = MAX(0, mon_top - browser_rows/2);
7758 while (mon_cur >= mon_top + browser_rows)
7759 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7763 /* Display a list of monsters in the current group */
7764 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top);
7770 /* Display a monster name */
7771 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top);
7773 /* Display visual list below first monster */
7774 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7779 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
7781 prt(format("<dir>, 'r' to recall%s%s, ESC", visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
7784 /* Get the current monster */
7785 r_ptr = &r_info[mon_idx[mon_cur]];
7787 /* Mega Hack -- track this monster race */
7788 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7790 /* Hack -- handle stuff */
7795 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7799 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7803 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7808 /* Do visual mode command if needed */
7809 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)) continue;
7822 /* Recall on screen */
7823 if (mon_idx[mon_cur])
7825 screen_roff(mon_idx[mon_cur], 0);
7836 /* Move the cursor */
7837 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
7844 /* Free the "mon_idx" array */
7845 C_KILL(mon_idx, max_r_idx, s16b);
7850 * Display the objects in a group.
7852 static void display_object_list(int col, int row, int per_page, int object_idx[],
7853 int object_cur, int object_top)
7857 /* Display lines until done */
7858 for (i = 0; i < per_page && object_idx[object_top + i]; i++)
7864 /* Get the object index */
7865 int k_idx = object_idx[object_top + i];
7867 /* Access the object */
7868 object_kind *k_ptr = &k_info[k_idx];
7870 /* Choose a color */
7871 byte attr = (k_ptr->aware ? TERM_WHITE : TERM_SLATE);
7872 byte cursor = (k_ptr->aware ? TERM_L_BLUE : TERM_BLUE);
7874 attr = ((i + object_top == object_cur) ? cursor : attr);
7877 strip_name(o_name, k_idx);
7879 /* Display the name */
7880 c_prt(attr, o_name, row + i, col);
7882 /* Hack -- visual_list mode */
7885 c_prt(attr, format("%02x/%02x", k_ptr->x_attr, k_ptr->x_char), row + i, 60);
7887 else if (p_ptr->wizard)
7889 c_prt(attr, format ("%d", k_idx), row + i, 70);
7892 a = k_ptr->flavor ? misc_to_attr[k_ptr->flavor] : k_ptr->x_attr;
7893 c = k_ptr->flavor ? misc_to_char[k_ptr->flavor] : k_ptr->x_char;
7895 /* Symbol is unknown */
7896 if (!k_ptr->aware && !p_ptr->wizard)
7902 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7904 /* Display symbol */
7905 Term_putch(76, row + i, a, c);
7908 if (use_bigtile) Term_putch(76 + 1, row + i, a2, c2);
7911 /* Clear remaining lines */
7912 for (; i < per_page; i++)
7914 Term_erase(col, row + i, 255);
7919 * Describe fake object
7921 static void desc_obj_fake(int k_idx)
7924 object_type object_type_body;
7926 /* Get local object */
7927 o_ptr = &object_type_body;
7929 /* Wipe the object */
7932 /* Create the artifact */
7933 object_prep(o_ptr, k_idx);
7935 /* It's fully know */
7936 o_ptr->ident |= IDENT_KNOWN;
7938 /* Track the object */
7939 /* object_actual_track(o_ptr); */
7941 /* Hack - mark as fake */
7942 /* term_obj_real = FALSE; */
7944 /* Hack -- Handle stuff */
7947 if (!screen_object(o_ptr, FALSE))
7950 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
7952 msg_print("You see nothing special.");
7961 * Display known objects
7963 static void do_cmd_knowledge_objects(void)
7966 int grp_cur, grp_top, old_grp_cur;
7967 int object_old, object_cur, object_top;
7968 int grp_cnt, grp_idx[100];
7976 bool visual_list = FALSE;
7977 byte attr_top = 0, char_left = 0;
7983 Term_get_size(&wid, &hgt);
7985 browser_rows = hgt - 8;
7987 /* Allocate the "object_idx" array */
7988 C_MAKE(object_idx, max_k_idx, int);
7993 /* Check every group */
7994 for (i = 0; object_group_text[i] != NULL; i++)
7996 /* Measure the label */
7997 len = strlen(object_group_text[i]);
7999 /* Save the maximum length */
8000 if (len > max) max = len;
8002 /* See if any monsters are known */
8003 if (collect_objects(i, object_idx))
8005 /* Build a list of groups with known monsters */
8006 grp_idx[grp_cnt++] = i;
8010 /* Terminate the list */
8011 grp_idx[grp_cnt] = -1;
8014 grp_cur = grp_top = 0;
8015 object_cur = object_top = 0;
8032 prt("Ãμ± - ¥¢¥¤¥Æ¥à", 2, 0);
8033 prt("¥°¥ë¡¼¥×", 4, 0);
8034 prt("̾Á°", 4, max + 3);
8035 if (p_ptr->wizard) prt("Idx", 4, 70);
8038 prt("Knowledge - objects", 2, 0);
8040 prt("Name", 4, max + 3);
8041 if (p_ptr->wizard) prt("Idx", 4, 70);
8045 for (i = 0; i < 78; i++)
8047 Term_putch(i, 5, TERM_WHITE, '=');
8050 for (i = 0; i < browser_rows; i++)
8052 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8058 /* Scroll group list */
8059 if (grp_cur < grp_top) grp_top = grp_cur;
8060 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8062 /* Display a list of object groups */
8063 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8065 if (old_grp_cur != grp_cur)
8067 old_grp_cur = grp_cur;
8069 /* Get a list of objects in the current group */
8070 object_cnt = collect_objects(grp_idx[grp_cur], object_idx);
8073 /* Scroll object list */
8074 while (object_cur < object_top)
8075 object_top = MAX(0, object_top - browser_rows/2);
8076 while (object_cur >= object_top + browser_rows)
8077 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8081 /* Display a list of objects in the current group */
8082 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top);
8086 object_top = object_cur;
8088 /* Display a list of objects in the current group */
8089 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top);
8091 /* Display visual list below first object */
8092 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8095 /* Get the current object */
8096 k_ptr = &k_info[object_idx[object_cur]];
8098 /* Mega Hack -- track this object */
8099 if (object_cnt) object_kind_track(object_idx[object_cur]);
8103 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8105 prt(format("<dir>, 'r' to recall%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
8108 /* The "current" object changed */
8109 if (object_old != object_idx[object_cur])
8111 /* Hack -- handle stuff */
8114 /* Remember the "current" object */
8115 object_old = object_idx[object_cur];
8120 place_visual_list_cursor(max + 3, 7, k_ptr->x_attr, k_ptr->x_char, attr_top, char_left);
8124 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8128 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8133 /* Do visual mode command if needed */
8134 /* Symbol of objects with flavor cannot be changed */
8135 if (!k_ptr->flavor && visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &k_ptr->x_attr, &k_ptr->x_char)) continue;
8148 /* Recall on screen */
8150 desc_obj_fake(object_idx[object_cur]);
8158 /* Move the cursor */
8159 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8165 /* Free the "object_idx" array */
8166 C_KILL(object_idx, max_k_idx, int);
8172 * Display the features in a group.
8174 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8175 int feat_cur, int feat_top)
8179 /* Display lines until done */
8180 for (i = 0; i < per_page && feat_idx[feat_top + i]; i++)
8187 int f_idx = feat_idx[feat_top + i];
8189 /* Access the index */
8190 feature_type *f_ptr = &f_info[f_idx];
8192 /* Choose a color */
8193 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8195 /* Display the name */
8196 c_prt(attr, f_name + f_ptr->name, row + i, col);
8198 /* Hack -- visual_list mode */
8201 c_prt(attr, format("%02x/%02x", f_ptr->x_attr, f_ptr->x_char), row + i, 60);
8207 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
8209 /* Display symbol */
8210 Term_putch(68, row + i, a, c);
8213 if (use_bigtile) Term_putch(68 + 1, row + i, a2, c2);
8216 /* Clear remaining lines */
8217 for (; i < per_page; i++)
8219 Term_erase(col, row + i, 255);
8225 * Interact with feature visuals.
8227 static void do_cmd_knowledge_features(void)
8230 int grp_cur, grp_top, old_grp_cur;
8231 int feat_cur, feat_top;
8232 int grp_cnt, grp_idx[100];
8240 bool visual_list = FALSE;
8241 byte attr_top = 0, char_left = 0;
8247 Term_get_size(&wid, &hgt);
8249 browser_rows = hgt - 8;
8251 /* Allocate the "feat_idx" array */
8252 C_MAKE(feat_idx, max_f_idx, int);
8257 /* Check every group */
8258 for (i = 0; feature_group_text[i] != NULL; i++)
8260 /* Measure the label */
8261 len = strlen(feature_group_text[i]);
8263 /* Save the maximum length */
8264 if (len > max) max = len;
8266 /* See if any features are known */
8267 if (collect_features(i, feat_idx))
8269 /* Build a list of groups with known features */
8270 grp_idx[grp_cnt++] = i;
8274 /* Terminate the list */
8275 grp_idx[grp_cnt] = -1;
8278 grp_cur = grp_top = 0;
8279 feat_cur = feat_top = 0;
8285 while ((!flag) && (grp_cnt))
8288 feature_type *f_ptr;
8294 prt("Visuals - features", 2, 0);
8296 prt("Name", 4, max + 3);
8299 for (i = 0; i < 78; i++)
8301 Term_putch(i, 5, TERM_WHITE, '=');
8304 for (i = 0; i < browser_rows; i++)
8306 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8312 /* Scroll group list */
8313 if (grp_cur < grp_top) grp_top = grp_cur;
8314 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8316 /* Display a list of feature groups */
8317 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8319 if (old_grp_cur != grp_cur)
8321 old_grp_cur = grp_cur;
8323 /* Get a list of features in the current group */
8324 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx);
8327 /* Scroll feature list */
8328 while (feat_cur < feat_top)
8329 feat_top = MAX(0, feat_top - browser_rows/2);
8330 while (feat_cur >= feat_top + browser_rows)
8331 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8335 /* Display a list of features in the current group */
8336 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top);
8340 feat_top = feat_cur;
8342 /* Display a list of features in the current group */
8343 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top);
8345 /* Display visual list below first object */
8346 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8351 prt(format("<Êý¸þ>%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8353 prt(format("<dir>%s%s, ESC", visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
8356 /* Get the current feature */
8357 f_ptr = &f_info[feat_idx[feat_cur]];
8361 place_visual_list_cursor(max + 3, 7, f_ptr->x_attr, f_ptr->x_char, attr_top, char_left);
8365 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8369 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8374 /* Do visual mode command if needed */
8375 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &f_ptr->x_attr, &f_ptr->x_char)) continue;
8387 /* Move the cursor */
8388 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8395 if (!grp_cnt) msg_print("No features known.");
8397 /* Free the "feat_idx" array */
8398 C_KILL(feat_idx, max_f_idx, int);
8403 * List wanted monsters
8405 static void do_cmd_knowledge_kubi(void)
8410 char file_name[1024];
8413 /* Open a new file */
8414 fff = my_fopen_temp(file_name, 1024);
8417 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8419 msg_format("Failed to create temporary file %s.", file_name);
8427 bool listed = FALSE;
8430 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8432 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8434 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8436 fprintf(fff, "List of wanted monsters\n");
8438 fprintf(fff, "----------------------------------------------\n");
8440 for (i = 0; i < MAX_KUBI; i++)
8442 if (kubi_r_idx[i] <= 10000)
8444 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
8453 fprintf(fff,"\n%s\n", "¾Þ¶â¼ó¤Ï¤â¤¦»Ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£");
8455 fprintf(fff,"\n%s\n", "There is no more wanted monster.");
8460 /* Close the file */
8463 /* Display the file contents */
8465 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8467 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8471 /* Remove the file */
8476 * List virtues & status
8478 static void do_cmd_knowledge_virtues(void)
8482 char file_name[1024];
8485 /* Open a new file */
8486 fff = my_fopen_temp(file_name, 1024);
8489 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8491 msg_format("Failed to create temporary file %s.", file_name);
8500 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8502 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8507 /* Close the file */
8510 /* Display the file contents */
8512 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8514 show_file(TRUE, file_name, "Virtues", 0, 0);
8518 /* Remove the file */
8526 static void do_cmd_knowledge_dungeon(void)
8530 char file_name[1024];
8534 /* Open a new file */
8535 fff = my_fopen_temp(file_name, 1024);
8538 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8540 msg_format("Failed to create temporary file %s.", file_name);
8548 for (i = 1; i < max_d_idx; i++)
8552 if (!d_info[i].maxdepth) continue;
8553 if (!max_dlv[i]) continue;
8554 if (d_info[i].final_guardian)
8556 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8558 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8560 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8562 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8567 /* Close the file */
8570 /* Display the file contents */
8572 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
8574 show_file(TRUE, file_name, "Dungeon", 0, 0);
8578 /* Remove the file */
8583 * List virtues & status
8586 static void do_cmd_knowledge_stat(void)
8590 char file_name[1024];
8593 /* Open a new file */
8594 fff = my_fopen_temp(file_name, 1024);
8597 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8599 msg_format("Failed to create temporary file %s.", file_name);
8607 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
8608 (2 * p_ptr->hitdie +
8609 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
8612 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
8613 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
8614 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
8616 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
8617 else fprintf(fff, "Your current Life Rating is ???.\n\n");
8618 fprintf(fff, "Limits of maximum stats\n\n");
8620 for (v_nr = 0; v_nr < 6; v_nr++)
8622 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);
8623 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
8629 /* Close the file */
8632 /* Display the file contents */
8634 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
8636 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
8640 /* Remove the file */
8646 * Print all active quests
8648 static void do_cmd_knowledge_quests_current(FILE *fff)
8651 char rand_tmp_str[120] = "\0";
8653 monster_race *r_ptr;
8655 int rand_level = 100;
8659 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
8661 fprintf(fff, "< Current Quest >\n");
8664 for (i = 1; i < max_quests; i++)
8666 if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
8668 /* Set the quest number temporary */
8669 int old_quest = p_ptr->inside_quest;
8672 /* Clear the text */
8673 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
8674 quest_text_line = 0;
8676 p_ptr->inside_quest = i;
8678 /* Get the quest text */
8679 init_flags = INIT_SHOW_TEXT;
8681 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8683 /* Reset the old quest number */
8684 p_ptr->inside_quest = old_quest;
8686 /* No info from "silent" quests */
8687 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8691 if (quest[i].type != QUEST_TYPE_RANDOM)
8693 char note[80] = "\0";
8695 if (quest[i].status == QUEST_STATUS_TAKEN)
8697 switch (quest[i].type)
8699 case QUEST_TYPE_KILL_LEVEL:
8700 case QUEST_TYPE_KILL_ANY_LEVEL:
8701 r_ptr = &r_info[quest[i].r_idx];
8702 strcpy(name, r_name + r_ptr->name);
8703 if (quest[i].max_num > 1)
8706 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
8707 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
8710 sprintf(note," - kill %d %s, have killed %d.",
8711 quest[i].max_num, name, quest[i].cur_num);
8716 sprintf(note," - %s¤òÅݤ¹¡£",name);
8718 sprintf(note," - kill %s.",name);
8722 case QUEST_TYPE_FIND_ARTIFACT:
8723 strcpy(name, a_name + a_info[quest[i].k_idx].name);
8725 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
8727 sprintf(note," - Find out %s.", name);
8731 case QUEST_TYPE_FIND_EXIT:
8733 sprintf(note," - õº÷¤¹¤ë¡£");
8735 sprintf(note," - Search.");
8739 case QUEST_TYPE_KILL_NUMBER:
8741 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",
8742 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
8744 sprintf(note," - Kill %d monsters, have killed %d.",
8745 quest[i].max_num, quest[i].cur_num);
8749 case QUEST_TYPE_KILL_ALL:
8751 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
8753 sprintf(note," - Kill all monsters.");
8759 /* Print the quest info */
8761 sprintf(tmp_str, " %s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
8762 quest[i].name, quest[i].level, note);
8764 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
8765 quest[i].name, quest[i].level, note);
8768 fprintf(fff, tmp_str);
8770 if (quest[i].status == QUEST_STATUS_COMPLETED)
8773 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
8775 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
8777 fprintf(fff, tmp_str);
8783 while (quest_text[j][0] && j < 10)
8785 fprintf(fff, " %s\n", quest_text[j]);
8790 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
8793 rand_level = quest[i].level;
8795 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8797 /* Print the quest info */
8798 r_ptr = &r_info[quest[i].r_idx];
8799 strcpy(name, r_name + r_ptr->name);
8801 if (quest[i].max_num > 1)
8804 sprintf(rand_tmp_str," %s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
8805 quest[i].name, quest[i].level,
8806 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
8810 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8811 quest[i].name, quest[i].level,
8812 quest[i].max_num, name, quest[i].cur_num);
8818 sprintf(rand_tmp_str," %s (%d ³¬) - %s¤òÅݤ¹¡£\n",
8819 quest[i].name, quest[i].level, name);
8821 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
8822 quest[i].name, quest[i].level, name);
8830 /* Print the current random quest */
8831 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
8834 if (!total) fprintf(fff, " ¤Ê¤·\n");
8836 if (!total) fprintf(fff, " Nothing.\n");
8842 * Print all finished quests
8844 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
8851 fprintf(fff, "¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8853 fprintf(fff, "< Completed Quest >\n");
8855 for (i = 1; i < max_quests; i++)
8857 int q_idx = quest_num[i];
8859 if (quest[q_idx].status == QUEST_STATUS_FINISHED)
8861 if (is_fixed_quest_idx(q_idx))
8863 /* Set the quest number temporary */
8864 int old_quest = p_ptr->inside_quest;
8866 p_ptr->inside_quest = q_idx;
8869 init_flags = INIT_ASSIGN;
8871 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8873 /* Reset the old quest number */
8874 p_ptr->inside_quest = old_quest;
8876 /* No info from "silent" quests */
8877 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
8882 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
8884 /* Print the quest info */
8886 if (quest[q_idx].complev == 0)
8890 " %-40s (%3d³¬) - ÉÔÀᄀ\n",
8892 " %-40s (Dungeon level: %3d) - (Cancelled)\n",
8894 r_name+r_info[quest[q_idx].r_idx].name,
8895 quest[q_idx].level);
8901 " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
8903 " %-40s (Dungeon level: %3d) - level %2d\n",
8905 r_name+r_info[quest[q_idx].r_idx].name,
8907 quest[q_idx].complev);
8912 /* Print the quest info */
8914 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
8915 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8917 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
8918 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8922 fprintf(fff, tmp_str);
8926 if (!total) fprintf(fff, " ¤Ê¤·\n");
8928 if (!total) fprintf(fff, " Nothing.\n");
8934 * Print all failed quests
8936 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
8943 fprintf(fff, "¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8945 fprintf(fff, "< Failed Quest >\n");
8947 for (i = 1; i < max_quests; i++)
8949 int q_idx = quest_num[i];
8951 if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
8953 if (is_fixed_quest_idx(q_idx))
8955 /* Set the quest number temporary */
8956 int old_quest = p_ptr->inside_quest;
8958 p_ptr->inside_quest = q_idx;
8960 /* Get the quest text */
8961 init_flags = INIT_ASSIGN;
8963 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8965 /* Reset the old quest number */
8966 p_ptr->inside_quest = old_quest;
8968 /* No info from "silent" quests */
8969 if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
8974 if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
8976 /* Print the quest info */
8978 sprintf(tmp_str, " %-40s (%3d³¬) - ¥ì¥Ù¥ë%2d\n",
8979 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
8981 sprintf(tmp_str, " %-40s (Dungeon level: %3d) - level %2d\n",
8982 r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
8987 /* Print the quest info */
8989 sprintf(tmp_str, " %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
8990 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8992 sprintf(tmp_str, " %-40s (Danger level: %3d) - level %2d\n",
8993 quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
8996 fprintf(fff, tmp_str);
9000 if (!total) fprintf(fff, " ¤Ê¤·\n");
9002 if (!total) fprintf(fff, " Nothing.\n");
9008 * Print all random quests
9010 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
9017 fprintf(fff, "¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
9019 fprintf(fff, "< Remaining Random Quest >\n");
9021 for (i = 1; i < max_quests; i++)
9023 /* No info from "silent" quests */
9024 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
9026 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
9030 /* Print the quest info */
9032 sprintf(tmp_str, " %s (%d³¬, %s)\n",
9033 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9035 sprintf(tmp_str, " %s (%d, %s)\n",
9036 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
9038 fprintf(fff, tmp_str);
9042 if (!total) fprintf(fff, " ¤Ê¤·\n");
9044 if (!total) fprintf(fff, " Nothing.\n");
9049 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9051 int *q_num = (int *)u;
9052 quest_type *qa = &quest[q_num[a]];
9053 quest_type *qb = &quest[q_num[b]];
9058 if (qa->complev < qb->complev) return TRUE;
9059 if (qa->complev > qb->complev) return FALSE;
9060 if (qa->level <= qb->level) return TRUE;
9064 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9066 int *q_num = (int *)u;
9073 q_num[a] = q_num[b];
9079 * Print quest status of all active quests
9081 static void do_cmd_knowledge_quests(void)
9084 char file_name[1024];
9085 int *quest_num, dummy, i;
9087 /* Open a new file */
9088 fff = my_fopen_temp(file_name, 1024);
9092 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9094 msg_format("Failed to create temporary file %s.", file_name);
9100 /* Allocate Memory */
9101 C_MAKE(quest_num, max_quests, int);
9103 /* Sort by compete level */
9104 for (i = 1; i < max_quests; i++) quest_num[i] = i;
9105 ang_sort_comp = ang_sort_comp_quest_num;
9106 ang_sort_swap = ang_sort_swap_quest_num;
9107 ang_sort(quest_num, &dummy, max_quests);
9109 /* Dump Quest Information */
9110 do_cmd_knowledge_quests_current(fff);
9112 do_cmd_knowledge_quests_completed(fff, quest_num);
9114 do_cmd_knowledge_quests_failed(fff, quest_num);
9118 do_cmd_knowledge_quests_wiz_random(fff);
9121 /* Close the file */
9124 /* Display the file contents */
9126 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9128 show_file(TRUE, file_name, "Quest status", 0, 0);
9131 /* Remove the file */
9135 C_KILL(quest_num, max_quests, int);
9142 static void do_cmd_knowledge_home(void)
9147 char file_name[1024];
9149 char o_name[MAX_NLEN];
9152 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9154 /* Open a new file */
9155 fff = my_fopen_temp(file_name, 1024);
9158 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9160 msg_format("Failed to create temporary file %s.", file_name);
9168 /* Print all homes in the different towns */
9169 st_ptr = &town[1].store[STORE_HOME];
9171 /* Home -- if anything there */
9172 if (st_ptr->stock_num)
9177 /* Header with name of the town */
9179 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9181 fprintf(fff, " [Home Inventory]\n");
9184 /* Dump all available items */
9185 for (i = 0; i < st_ptr->stock_num; i++)
9188 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9189 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9190 if (strlen(o_name) <= 80-3)
9192 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9198 for (n = 0, t = o_name; n < 80-3; n++, t++)
9199 if(iskanji(*t)) {t++; n++;}
9200 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9202 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9203 fprintf(fff, " %.77s\n", o_name+n);
9206 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9207 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9212 /* Add an empty line */
9213 fprintf(fff, "\n\n");
9217 /* Close the file */
9220 /* Display the file contents */
9222 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9224 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9228 /* Remove the file */
9234 * Check the status of "autopick"
9236 static void do_cmd_knowledge_autopick(void)
9240 char file_name[1024];
9242 /* Open a new file */
9243 fff = my_fopen_temp(file_name, 1024);
9248 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9250 msg_format("Failed to create temporary file %s.", file_name);
9259 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9261 fprintf(fff, "No preference for auto picker/destroyer.");
9267 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9269 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9273 for (k = 0; k < max_autopick; k++)
9276 byte act = autopick_list[k].action;
9277 if (act & DONT_AUTOPICK)
9285 else if (act & DO_AUTODESTROY)
9293 else if (act & DO_AUTOPICK)
9301 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9310 if (act & DO_DISPLAY)
9311 fprintf(fff, "%11s", format("[%s]", tmp));
9313 fprintf(fff, "%11s", format("(%s)", tmp));
9315 tmp = autopick_line_from_entry(&autopick_list[k]);
9316 fprintf(fff, " %s", tmp);
9320 /* Close the file */
9322 /* Display the file contents */
9324 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9326 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9329 /* Remove the file */
9335 * Interact with "knowledge"
9337 void do_cmd_knowledge(void)
9340 /* File type is "TEXT" */
9341 FILE_TYPE(FILE_TYPE_TEXT);
9342 /* Save the screen */
9344 /* Interact until done */
9349 /* Ask for a choice */
9351 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9352 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9354 prt(format("page %d/2", (p+1)), 2, 65);
9355 prt("Display current knowledge", 3, 0);
9358 /* Give some choices */
9361 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9362 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9363 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9364 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9365 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9366 if (!vanilla_town) prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9367 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9368 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9369 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9370 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9372 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9373 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9374 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9375 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9376 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9377 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9378 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9379 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9380 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9384 prt("(1) Display known artifacts", 6, 5);
9385 prt("(2) Display known objects", 7, 5);
9386 prt("(3) Display remaining uniques", 8, 5);
9387 prt("(4) Display known monster", 9, 5);
9388 prt("(5) Display kill count", 10, 5);
9389 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
9390 prt("(7) Display current pets", 12, 5);
9391 prt("(8) Display home inventory", 13, 5);
9392 prt("(9) Display *identified* equip.", 14, 5);
9393 prt("(0) Display terrain symbols.", 15, 5);
9395 prt("(a) Display about yourself", 6, 5);
9396 prt("(b) Display mutations", 7, 5);
9397 prt("(c) Display weapon proficiency", 8, 5);
9398 prt("(d) Display spell proficiency", 9, 5);
9399 prt("(e) Display misc. proficiency", 10, 5);
9400 prt("(f) Display virtues", 11, 5);
9401 prt("(g) Display dungeons", 12, 5);
9402 prt("(h) Display current quests", 13, 5);
9403 prt("(i) Display auto pick/destroy", 14, 5);
9408 prt("-³¤¯-", 17, 8);
9409 prt("ESC) È´¤±¤ë", 21, 1);
9410 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9411 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9412 prt("¥³¥Þ¥ó¥É:", 20, 0);
9414 prt("-more-", 17, 8);
9415 prt("ESC) Exit menu", 21, 1);
9416 prt("SPACE) Next page", 21, 30);
9417 /*prt("-) Previous page", 21, 60);*/
9418 prt("Command: ", 20, 0);
9424 if (i == ESCAPE) break;
9427 case ' ': /* Page change */
9431 case '1': /* Artifacts */
9432 do_cmd_knowledge_artifacts();
9434 case '2': /* Objects */
9435 do_cmd_knowledge_objects();
9437 case '3': /* Uniques */
9438 do_cmd_knowledge_uniques();
9440 case '4': /* Monsters */
9441 do_cmd_knowledge_monsters();
9443 case '5': /* Kill count */
9444 do_cmd_knowledge_kill_count();
9446 case '6': /* wanted */
9447 if (!vanilla_town) do_cmd_knowledge_kubi();
9449 case '7': /* Pets */
9450 do_cmd_knowledge_pets();
9452 case '8': /* Home */
9453 do_cmd_knowledge_home();
9455 case '9': /* Resist list */
9456 do_cmd_knowledge_inven();
9458 case '0': /* Feature list */
9459 do_cmd_knowledge_features();
9462 case 'a': /* Max stat */
9463 do_cmd_knowledge_stat();
9465 case 'b': /* Mutations */
9466 do_cmd_knowledge_mutations();
9468 case 'c': /* weapon-exp */
9469 do_cmd_knowledge_weapon_exp();
9471 case 'd': /* spell-exp */
9472 do_cmd_knowledge_spell_exp();
9474 case 'e': /* skill-exp */
9475 do_cmd_knowledge_skill_exp();
9477 case 'f': /* Virtues */
9478 do_cmd_knowledge_virtues();
9480 case 'g': /* Dungeon */
9481 do_cmd_knowledge_dungeon();
9483 case 'h': /* Quests */
9484 do_cmd_knowledge_quests();
9486 case 'i': /* Autopick */
9487 do_cmd_knowledge_autopick();
9489 default: /* Unknown option */
9492 /* Flush messages */
9495 /* Restore the screen */
9501 * Check on the status of an active quest
9503 void do_cmd_checkquest(void)
9505 /* File type is "TEXT" */
9506 FILE_TYPE(FILE_TYPE_TEXT);
9508 /* Save the screen */
9512 do_cmd_knowledge_quests();
9514 /* Restore the screen */
9520 * Display the time and date
9522 void do_cmd_time(void)
9524 int day, hour, min, full, start, end, num;
9531 extract_day_hour_min(&day, &hour, &min);
9533 full = hour * 100 + min;
9541 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9543 strcpy(desc, "It is a strange time.");
9549 msg_format("%d ÆüÌÜ,»þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
9550 day, (hour % 12 == 0) ? 12 : (hour % 12),
9551 min, (hour < 12) ? "AM" : "PM");
9553 msg_format("This is day %d. The time is %d:%02d %s.",
9554 day, (hour % 12 == 0) ? 12 : (hour % 12),
9555 min, (hour < 12) ? "AM" : "PM");
9560 if (!randint0(10) || p_ptr->image)
9563 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
9565 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
9572 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
9574 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
9579 /* Open this file */
9580 fff = my_fopen(buf, "rt");
9585 /* Find this time */
9586 while (!my_fgets(fff, buf, sizeof(buf)))
9588 /* Ignore comments */
9589 if (!buf[0] || (buf[0] == '#')) continue;
9591 /* Ignore invalid lines */
9592 if (buf[1] != ':') continue;
9594 /* Process 'Start' */
9597 /* Extract the starting time */
9598 start = atoi(buf + 2);
9600 /* Assume valid for an hour */
9610 /* Extract the ending time */
9611 end = atoi(buf + 2);
9617 /* Ignore incorrect range */
9618 if ((start > full) || (full > end)) continue;
9620 /* Process 'Description' */
9625 /* Apply the randomizer */
9626 if (!randint0(num)) strcpy(desc, buf + 2);
9636 /* Close the file */