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);
336 * Take note to the dialy.
339 errr do_cmd_write_nikki(int type, int num, cptr note)
345 cptr note_level = "";
346 bool do_level = TRUE;
347 char note_level_buf[40];
349 static bool disable_nikki = FALSE;
351 extract_day_hour_min(&day, &hour, &min);
353 if (disable_nikki) return(-1);
355 if (type == NIKKI_FIX_QUEST_C ||
356 type == NIKKI_FIX_QUEST_F ||
357 type == NIKKI_RAND_QUEST_C ||
358 type == NIKKI_RAND_QUEST_F ||
359 type == NIKKI_TO_QUEST)
363 old_quest = p_ptr->inside_quest;
364 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
366 /* Get the quest text */
367 init_flags = INIT_ASSIGN;
369 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
371 /* Reset the old quest number */
372 p_ptr->inside_quest = old_quest;
376 sprintf(file_name,"playrecord-%s.txt",savefile_base);
378 /* different filne name to avoid mixing */
379 sprintf(file_name,"playrec-%s.txt",savefile_base);
382 /* Build the filename */
383 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
385 /* File type is "TEXT" */
386 FILE_TYPE(FILE_TYPE_TEXT);
388 fff = my_fopen(buf, "a");
394 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£¥×¥ì¥¤µÏ¿¤ò°ì»þÄä»ß¤·¤Þ¤¹¡£", buf);
396 msg_format("Failed to open %s. Play-Record is disabled temporally.", buf);
405 if (p_ptr->inside_arena)
407 note_level = "¥¢¥ê¡¼¥Ê:";
409 note_level = "Arane:";
413 note_level = "ÃϾå:";
415 note_level = "Surface:";
417 else if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
419 note_level = "¥¯¥¨¥¹¥È:";
421 note_level = "Quest:";
426 sprintf(note_level_buf, "%d³¬(%s):", dun_level, d_name+d_info[dungeon_type].name);
428 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level);
430 note_level = note_level_buf;
439 fprintf(fff, "%dÆüÌÜ\n",day);
441 fprintf(fff, "Day %d\n",day);
450 fprintf(fff, "%s\n",note);
454 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
460 fprintf(fff, " %2d:%02d %20s %s¤òȯ¸«¤·¤¿¡£\n", hour, min, note_level, note);
462 fprintf(fff, " %2d:%02d %20s discover %s.\n", hour, min, note_level, note);
469 fprintf(fff, " %2d:%02d %20s %s¤òÅݤ·¤¿¡£\n", hour, min, note_level, note);
471 fprintf(fff, " %2d:%02d %20s defeated %s.\n", hour, min, note_level, note);
475 case NIKKI_FIX_QUEST_C:
477 if (quest[num].flags & QUEST_FLAG_SILENT) break;
479 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
481 fprintf(fff, " %2d:%02d %20s completed quest '%s'.\n", hour, min, note_level, quest[num].name);
485 case NIKKI_FIX_QUEST_F:
487 if (quest[num].flags & QUEST_FLAG_SILENT) break;
489 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤«¤éÌ¿¤«¤é¤¬¤éƨ¤²µ¢¤Ã¤¿¡£\n", hour, min, note_level, quest[num].name);
491 fprintf(fff, " %2d:%02d %20s run away from quest '%s'.\n", hour, min, note_level, quest[num].name);
495 case NIKKI_RAND_QUEST_C:
498 strcpy(name, r_name+r_info[quest[num].r_idx].name);
500 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤òãÀ®¤·¤¿¡£\n", hour, min, note_level, name);
502 fprintf(fff, " %2d:%02d %20s completed randome quest '%s'\n", hour, min, note_level, name);
506 case NIKKI_RAND_QUEST_F:
509 strcpy(name, r_name+r_info[quest[num].r_idx].name);
511 fprintf(fff, " %2d:%02d %20s ¥é¥ó¥À¥à¥¯¥¨¥¹¥È(%s)¤«¤éƨ¤²½Ð¤·¤¿¡£\n", hour, min, note_level, name);
513 fprintf(fff, " %2d:%02d %20s ran away from quest '%s'.\n", hour, min, note_level, name);
517 case NIKKI_MAXDEAPTH:
520 fprintf(fff, " %2d:%02d %20s %s¤ÎºÇ¿¼³¬%d³¬¤ËÅþ㤷¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, num);
522 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);
529 fprintf(fff, " %2d:%02d %20s %s%s¤ÎºÇ¿¼³¬¤ò%d³¬¤Ë¥»¥Ã¥È¤·¤¿¡£\n", hour, min, note_level, note, d_name + d_info[num].name, max_dlv[num]);
531 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);
538 if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
549 if (!(dun_level+num)) to = "ÃϾå";
550 else to = format("%d³¬", dun_level+num);
552 if (!(dun_level+num)) to = "the surface";
553 else to = format("level %d", dun_level+num);
558 fprintf(fff, " %2d:%02d %20s %s¤Ø%s¡£\n", hour, min, note_level, to, note);
560 fprintf(fff, " %2d:%02d %20s %s %s.\n", hour, min, note_level, note, to);
568 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤Æ%s¤Î%d³¬¤Ø²¼¤ê¤¿¡£\n", hour, min, note_level, d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]);
570 fprintf(fff, " %2d:%02d %20s recall to dungeon level %d of %s.\n", hour, min, note_level, max_dlv[dungeon_type], d_name+d_info[dungeon_type].name);
574 fprintf(fff, " %2d:%02d %20s µ¢´Ô¤ò»È¤Ã¤ÆÃϾå¤Ø¤ÈÌá¤Ã¤¿¡£\n", hour, min, note_level);
576 fprintf(fff, " %2d:%02d %20s recall from dungeon to surface.\n", hour, min, note_level);
582 if (quest[num].flags & QUEST_FLAG_SILENT) break;
584 fprintf(fff, " %2d:%02d %20s ¥¯¥¨¥¹¥È¡Ö%s¡×¤Ø¤ÈÆÍÆþ¤·¤¿¡£\n", hour, min, note_level, quest[num].name);
586 fprintf(fff, " %2d:%02d %20s enter quest '%s'.\n", hour, min, note_level, quest[num].name);
593 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¡¦¥Æ¥ì¥Ý¡¼¥È¤Çæ½Ð¤·¤¿¡£\n", hour, min, note_level);
595 fprintf(fff, " %2d:%02d %20s Get out using teleport level.\n", hour, min, note_level);
602 fprintf(fff, " %2d:%02d %20s %s¤ò¹ØÆþ¤·¤¿¡£\n", hour, min, note_level, note);
604 fprintf(fff, " %2d:%02d %20s buy %s.\n", hour, min, note_level, note);
611 fprintf(fff, " %2d:%02d %20s %s¤òÇäµÑ¤·¤¿¡£\n", hour, min, note_level, note);
613 fprintf(fff, " %2d:%02d %20s sell %s.\n", hour, min, note_level, note);
623 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï¤Ç¡¢%s¤ÎÁ°¤ËÇÔ¤ìµî¤Ã¤¿¡£\n", hour, min, note_level, p_ptr->arena_number + 1, note);
625 int n = p_ptr->arena_number + 1;
626 fprintf(fff, " %2d:%02d %20s beaten by %s in the %d%s fight.\n", hour, min, note_level, note, n, (n%10==1?"st":n%10==2?"nd":n%10==3?"rd":"th"));
631 fprintf(fff, " %2d:%02d %20s Æ®µ»¾ì¤Î%d²óÀï(%s)¤Ë¾¡Íø¤·¤¿¡£\n", hour, min, note_level, num, note);
633 fprintf(fff, " %2d:%02d %20s win the %d%s fight (%s).\n", hour, min, note_level, num, (num%10==1?"st":num%10==2?"nd":num%10==3?"rd":"th"), note);
635 if (num == MAX_ARENA_MONS)
638 fprintf(fff, " Æ®µ»¾ì¤Î¤¹¤Ù¤Æ¤ÎŨ¤Ë¾¡Íø¤·¡¢¥Á¥ã¥ó¥Ô¥ª¥ó¤È¤Ê¤Ã¤¿¡£\n");
640 fprintf(fff, " win all fight to become a Chanpion.\n");
649 fprintf(fff, " %2d:%02d %20s %s¤ò¼±Ê̤·¤¿¡£\n", hour, min, note_level, note);
651 fprintf(fff, " %2d:%02d %20s identify %s.\n", hour, min, note_level, note);
666 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
668 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
672 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥¦¥£¥¶¡¼¥É¡¦¥Æ¥ì¥Ý¡¼¥È¤Ç°ÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
674 fprintf(fff, " %2d:%02d %20s wizard-teleport to %s.\n", hour, min, note_level, to);
689 to = format("%d³¬(%s)", dun_level, d_name+d_info[dungeon_type].name);
691 to = format("level %d of %s", dun_level, d_name+d_info[dungeon_type].name);
695 fprintf(fff, " %2d:%02d %20s %s¤Ø¤È¥Ñ¥¿¡¼¥ó¤ÎÎϤǰÜÆ°¤·¤¿¡£\n", hour, min, note_level, to);
697 fprintf(fff, " %2d:%02d %20s use Pattern to teleport to %s.\n", hour, min, note_level, to);
704 fprintf(fff, " %2d:%02d %20s ¥ì¥Ù¥ë¤¬%d¤Ë¾å¤¬¤Ã¤¿¡£\n", hour, min, note_level, num);
706 fprintf(fff, " %2d:%02d %20s reach player level %d.\n", hour, min, note_level, num);
710 case NIKKI_GAMESTART:
712 time_t ct = time((time_t*)0);
716 fprintf(fff, "%s %s",note, ctime(&ct));
719 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
722 case NIKKI_NAMED_PET:
724 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
729 fprintf(fff, "%s¤òι¤Îͧ¤Ë¤¹¤ë¤³¤È¤Ë·è¤á¤¿¡£\n", note);
731 fprintf(fff, "decide to travel together with %s.\n", note);
736 fprintf(fff, "%s¤Î̾Á°¤ò¾Ã¤·¤¿¡£\n", note);
738 fprintf(fff, "unname %s.\n", note);
743 fprintf(fff, "%s¤ò²òÊü¤·¤¿¡£\n", note);
745 fprintf(fff, "dismiss %s.\n", note);
750 fprintf(fff, "%s¤¬»à¤ó¤Ç¤·¤Þ¤Ã¤¿¡£\n", note);
752 fprintf(fff, "%s die.\n", note);
757 fprintf(fff, "%s¤ò¤ª¤¤¤ÆÊ̤ΥޥåפذÜÆ°¤·¤¿¡£\n", note);
759 fprintf(fff, "move to other map leaving %s behind.\n", note);
764 fprintf(fff, "%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£\n", note);
766 fprintf(fff, "lose sight of %s.\n", note);
771 fprintf(fff, "%s¤¬*Ç˲õ*¤Ë¤è¤Ã¤Æ¾Ã¤¨µî¤Ã¤¿¡£\n", note);
773 fprintf(fff, "%s is made disappeared by *destruction*.\n", note);
778 fprintf(fff, "%s¤¬´äÀФ˲¡¤·ÄÙ¤µ¤ì¤¿¡£\n", note);
780 fprintf(fff, "%s is crushed by falling rocks.\n", note);
795 if (do_level) write_level = FALSE;
801 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
803 static void do_cmd_disp_nikki(void)
805 char nikki_title[256];
810 static const char subtitle[][30] = {"ºÇ¶¯¤ÎÆùÂΤòµá¤á¤Æ",
811 "¿ÍÀ¸¤½¤ì¤Ï¤Ï¤«¤Ê¤¤",
822 "Åݤ¹¤Ù¤Å¨¤Ï¥²¡û¥Ä",
823 "¤ó¡Á¡©Ê¹¤³¤¨¤ó¤Ê¤¡",
824 "¥ª¥ì¤Î̾¤ò¸À¤Ã¤Æ¤ß¤í",
825 "Ƭ¤¬ÊѤˤʤäÁ¤ã¤Ã¤¿",
830 "¤³¤ó¤Ê¤â¤ó¤¸¤ã¤Ê¤¤",
839 "ºÇ¹â¤ÎƬǾ¤òµá¤á¤Æ"};
841 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
842 "Attack is the best form of defence.",
844 "An unexpected windfall",
845 "A drowning man will catch at a straw",
846 "Don't count your chickens before they are hatched.",
847 "It is no use crying over spilt milk.",
848 "Seeing is believing.",
849 "Strike the iron while it is hot.",
850 "I don't care what follows.",
851 "To dig a well to put out a house on fire.",
852 "Tomorrow is another day.",
853 "Easy come, easy go.",
854 "The more haste, the less speed.",
855 "Where there is life, there is hope.",
856 "There is no royal road to *WINNER*.",
857 "Danger past, God forgotten.",
858 "The best thing to do now is to run away.",
859 "Life is but an empty dream.",
860 "Dead men tell no tales.",
861 "A book that remains shut is but a block.",
862 "Misfortunes never come singly.",
863 "A little knowledge is a dangerous thing.",
864 "History repeats itself.",
865 "*WINNER* was not built in a day.",
866 "Ignorance is bliss.",
867 "To lose is to win?",
868 "No medicine can cure folly.",
869 "All good things come to an end.",
870 "M$ Empire strikes back.",
871 "To see is to believe",
873 "Quest of The World's Greatest Brain"};
876 sprintf(file_name,"playrecord-%s.txt",savefile_base);
878 sprintf(file_name,"playrec-%s.txt",savefile_base);
881 /* Build the filename */
882 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
884 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
885 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
886 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
887 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
888 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
891 sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
892 ap_ptr->title, ap_ptr->no ? "¤Î" : "", player_name, tmp);
894 sprintf(nikki_title, "Legend of %s %s '%s'",
895 ap_ptr->title, player_name, tmp);
898 /* Display the file contents */
899 show_file(FALSE, buf, nikki_title, -1, 0);
902 static void do_cmd_bunshou(void)
905 char bunshou[80] = "\0";
908 if (get_string("ÆâÍÆ: ", tmp, 79))
910 if (get_string("diary note: ", tmp, 79))
913 strcpy(bunshou, tmp);
915 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
919 static void do_cmd_last_get(void)
924 if (record_o_name[0] == '\0') return;
927 sprintf(buf,"%s¤ÎÆþ¼ê¤òµÏ¿¤·¤Þ¤¹¡£",record_o_name);
929 sprintf(buf,"Do you really want to record getting %s? ",record_o_name);
931 if (!get_check(buf)) return;
936 sprintf(buf,"%s¤ò¼ê¤ËÆþ¤ì¤¿¡£", record_o_name);
938 sprintf(buf,"descover %s.", record_o_name);
940 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
944 static void do_cmd_erase_nikki(void)
951 if (!get_check("ËÜÅö¤ËµÏ¿¤ò¾Ãµî¤·¤Þ¤¹¤«¡©")) return;
953 if (!get_check("Do you really want to delete all your record? ")) return;
957 sprintf(file_name,"playrecord-%s.txt",savefile_base);
959 sprintf(file_name,"playrec-%s.txt",savefile_base);
962 /* Build the filename */
963 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
965 /* Remove the file */
968 fff = my_fopen(buf, "w");
972 msg_format("µÏ¿¤ò¾Ãµî¤·¤Þ¤·¤¿¡£");
974 msg_format("deleted record.");
978 msg_format("%s ¤Î¾Ãµî¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£", buf);
980 msg_format("failed to delete %s.", buf);
987 void do_cmd_nikki(void)
991 /* File type is "TEXT" */
992 FILE_TYPE(FILE_TYPE_TEXT);
994 /* Save the screen */
997 /* Interact until done */
1003 /* Ask for a choice */
1005 prt("[ µÏ¿¤ÎÀßÄê ]", 2, 0);
1007 prt("[ Play Record ]", 2, 0);
1011 /* Give some choices */
1013 prt("(1) µÏ¿¤ò¸«¤ë", 4, 5);
1014 prt("(2) ʸ¾Ï¤òµÏ¿¤¹¤ë", 5, 5);
1015 prt("(3) ľÁ°¤ËÆþ¼êËô¤Ï´ÕÄꤷ¤¿¤â¤Î¤òµÏ¿¤¹¤ë", 6, 5);
1016 prt("(4) µÏ¿¤ò¾Ãµî¤¹¤ë", 7, 5);
1018 prt("(1) Display your record", 4, 5);
1019 prt("(2) Add record", 5, 5);
1020 prt("(3) Record item you last get/identify", 6, 5);
1021 prt("(4) Delete your record", 7, 5);
1027 prt("¥³¥Þ¥ó¥É:", 18, 0);
1029 prt("Command: ", 18, 0);
1037 if (i == ESCAPE) break;
1042 do_cmd_disp_nikki();
1051 do_cmd_erase_nikki();
1053 default: /* Unknown option */
1057 /* Flush messages */
1061 /* Restore the screen */
1066 * Hack -- redraw the screen
1068 * This command performs various low level updates, clears all the "extra"
1069 * windows, does a total redraw of the main window, and requests all of the
1070 * interesting updates and redraws that I can think of.
1072 * This command is also used to "instantiate" the results of the user
1073 * selecting various things, such as graphics mode, so it must call
1074 * the "TERM_XTRA_REACT" hook before redrawing the windows.
1076 void do_cmd_redraw(void)
1083 /* Hack -- react to changes */
1084 Term_xtra(TERM_XTRA_REACT, 0);
1087 /* Combine and Reorder the pack (later) */
1088 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1092 p_ptr->update |= (PU_TORCH);
1095 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1097 /* Forget lite/view */
1098 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1100 /* Update lite/view */
1101 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1103 /* Update monsters */
1104 p_ptr->update |= (PU_MONSTERS);
1106 /* Redraw everything */
1107 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1110 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1113 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1117 /* Hack -- update */
1120 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1123 /* Redraw every window */
1124 for (j = 0; j < 8; j++)
1127 if (!angband_term[j]) continue;
1130 Term_activate(angband_term[j]);
1145 * Hack -- change name
1147 void do_cmd_change_name(void)
1156 /* Save the screen */
1164 /* Display the player */
1165 display_player(mode);
1170 display_player(mode);
1175 Term_putstr(2, 23, -1, TERM_WHITE,
1176 "['c'¤Ç̾Á°Êѹ¹, 'f'¤Ç¥Õ¥¡¥¤¥ë¤Ø½ñ½Ð, 'h'¤Ç¥â¡¼¥ÉÊѹ¹, ESC¤Ç½ªÎ»]");
1178 Term_putstr(2, 23, -1, TERM_WHITE,
1179 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1187 if (c == ESCAPE) break;
1194 /* Process the player name */
1195 process_player_name(FALSE);
1201 sprintf(tmp, "%s.txt", player_base);
1203 if (get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
1205 if (get_string("File name: ", tmp, 80))
1209 if (tmp[0] && (tmp[0] != ' '))
1211 file_character(tmp);
1228 /* Flush messages */
1232 /* Restore the screen */
1235 /* Redraw everything */
1236 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1243 * Recall the most recent message
1245 void do_cmd_message_one(void)
1247 /* Recall one message XXX XXX XXX */
1248 prt(format("> %s", message_str(0)), 0, 0);
1253 * Show previous messages to the user -BEN-
1255 * The screen format uses line 0 and 23 for headers and prompts,
1256 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1258 * This command shows you which commands you are viewing, and allows
1259 * you to "search" for strings in the recall.
1261 * Note that messages may be longer than 80 characters, but they are
1262 * displayed using "infinite" length, with a special sub-command to
1263 * "slide" the virtual display to the left or right.
1265 * Attempt to only hilite the matching portions of the string.
1267 void do_cmd_messages(int num_now)
1278 Term_get_size(&wid, &hgt);
1287 /* Total messages */
1290 /* Start on first message */
1293 /* Start at leftmost edge */
1296 /* Save the screen */
1299 /* Process requests until done */
1305 /* Dump up to 20 lines of messages */
1306 for (j = 0; (j < hgt - 4) && (i + j < n); j++)
1308 cptr msg = message_str(i+j);
1310 /* Apply horizontal scroll */
1311 msg = (strlen(msg) >= q) ? (msg + q) : "";
1313 /* Dump the messages, bottom to top */
1314 Term_putstr(0, hgt-j-3, -1, (bool)(i+j < num_now ? TERM_WHITE : TERM_SLATE), msg);
1316 /* Hilite "shower" */
1321 /* Display matches */
1322 while ((str = strstr(str, shower)) != NULL)
1324 int len = strlen(shower);
1326 /* Display the match */
1327 Term_putstr(str-msg, hgt-j-3, len, TERM_YELLOW, shower);
1335 /* Display header XXX XXX XXX */
1338 prt(format("°ÊÁ°¤Î¥á¥Ã¥»¡¼¥¸ %d-%d Á´Éô¤Ç(%d) ¥ª¥Õ¥»¥Ã¥È(%d)",
1339 i, i+j-1, n, q), 0, 0);
1341 prt(format("Message Recall (%d-%d of %d), Offset %d",
1342 i, i+j-1, n, q), 0, 0);
1346 /* Display prompt (not very informative) */
1348 prt("[ 'p' ¤Ç¹¹¤Ë¸Å¤¤¤â¤Î, 'n' ¤Ç¹¹¤Ë¿·¤·¤¤¤â¤Î, '/' ¤Ç¸¡º÷, ESC ¤ÇÃæÃÇ ]", hgt - 1, 0);
1350 prt("[Press 'p' for older, 'n' for newer, ..., or ESCAPE]", hgt - 1, 0);
1357 /* Exit on Escape */
1358 if (k == ESCAPE) break;
1360 /* Hack -- Save the old index */
1363 /* Horizontal scroll */
1367 q = (q >= 40) ? (q - 40) : 0;
1373 /* Horizontal scroll */
1383 /* Hack -- handle show */
1388 prt("¶¯Ä´: ", hgt - 1, 0);
1390 prt("Show: ", hgt - 1, 0);
1394 /* Get a "shower" string, or continue */
1395 if (!askfor_aux(shower, 80)) continue;
1401 /* Hack -- handle find */
1408 prt("¸¡º÷: ", hgt - 1, 0);
1410 prt("Find: ", hgt - 1, 0);
1414 /* Get a "finder" string, or continue */
1415 if (!askfor_aux(finder, 80)) continue;
1418 strcpy(shower, finder);
1421 for (z = i + 1; z < n; z++)
1423 cptr msg = message_str(z);
1426 if (strstr(msg, finder))
1437 /* Recall 1 older message */
1438 if ((k == '8') || (k == '\n') || (k == '\r'))
1440 /* Go newer if legal */
1441 if (i + 1 < n) i += 1;
1444 /* Recall 10 older messages */
1447 /* Go older if legal */
1448 if (i + 10 < n) i += 10;
1451 /* Recall 20 older messages */
1452 if ((k == 'p') || (k == KTRL('P')) || (k == ' '))
1454 /* Go older if legal */
1455 if (i + 20 < n) i += 20;
1458 /* Recall 20 newer messages */
1459 if ((k == 'n') || (k == KTRL('N')))
1461 /* Go newer (if able) */
1462 i = (i >= 20) ? (i - 20) : 0;
1465 /* Recall 10 newer messages */
1468 /* Go newer (if able) */
1469 i = (i >= 20) ? (i - 20) : 0;
1472 /* Recall 1 newer messages */
1475 /* Go newer (if able) */
1476 i = (i >= 1) ? (i - 1) : 0;
1479 /* Hack -- Error of some kind */
1483 /* Restore the screen */
1490 * Number of cheating options
1497 static option_type cheat_info[CHEAT_MAX] =
1499 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1501 "cheat_peek", "¥¢¥¤¥Æ¥à¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1503 "cheat_peek", "Peek into object creation"
1507 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1509 "cheat_hear", "¥â¥ó¥¹¥¿¡¼¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1511 "cheat_hear", "Peek into monster creation"
1515 { &cheat_room, FALSE, 255, 0x04, 0x00,
1517 "cheat_room", "¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À®¤ò¤Î¤¾¤¸«¤ë"
1519 "cheat_room", "Peek into dungeon creation"
1523 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1525 "cheat_xtra", "¤½¤Î¾¤Î»ö¤ò¤Î¤¾¤¸«¤ë"
1527 "cheat_xtra", "Peek into something else"
1531 { &cheat_know, FALSE, 255, 0x10, 0x00,
1533 "cheat_know", "´°Á´¤Ê¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤òÃΤë"
1535 "cheat_know", "Know complete monster info"
1539 { &cheat_live, FALSE, 255, 0x20, 0x00,
1541 "cheat_live", "»à¤ò²óÈò¤¹¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë"
1543 "cheat_live", "Allow player to avoid death"
1547 { &cheat_save, FALSE, 255, 0x40, 0x00,
1549 "cheat_save", "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
1551 "cheat_save", "Ask for saving death"
1557 * Interact with some options for cheating
1559 static void do_cmd_options_cheat(cptr info)
1563 int i, k = 0, n = CHEAT_MAX;
1571 /* Interact with the player */
1576 /* Prompt XXX XXX XXX */
1578 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, ESC ¤Ç·èÄê )", info);
1580 sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info);
1586 /* º¾µ½¥ª¥×¥·¥ç¥ó¤ò¤¦¤Ã¤«¤ê¤¤¤¸¤Ã¤Æ¤·¤Þ¤¦¿Í¤¬¤¤¤ë¤è¤¦¤Ê¤Î¤ÇÃí°Õ */
1587 prt(" << Ãí°Õ >>", 11, 0);
1588 prt(" º¾µ½¥ª¥×¥·¥ç¥ó¤ò°ìÅ٤ǤâÀßÄꤹ¤ë¤È¡¢¥¹¥³¥¢µÏ¿¤¬»Ä¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¡ª", 12, 0);
1589 prt(" ¸å¤Ë²ò½ü¤·¤Æ¤â¥À¥á¤Ç¤¹¤Î¤Ç¡¢¾¡Íø¼Ô¤òÌܻؤ¹Êý¤Ï¤³¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¤¤", 13, 0);
1590 prt(" ¤¸¤é¤Ê¤¤¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£", 14, 0);
1592 /* Display the options */
1593 for (i = 0; i < n; i++)
1595 byte a = TERM_WHITE;
1597 /* Color current option */
1598 if (i == k) a = TERM_L_BLUE;
1600 /* Display the option text */
1601 sprintf(buf, "%-48s: %s (%s)",
1602 cheat_info[i].o_desc,
1604 (*cheat_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1606 (*cheat_info[i].o_var ? "yes" : "no "),
1609 cheat_info[i].o_text);
1610 c_prt(a, buf, i + 2, 0);
1613 /* Hilite current option */
1614 move_cursor(k + 2, 50);
1620 * HACK - Try to translate the key into a direction
1621 * to allow using the roguelike keys for navigation.
1623 dir = get_keymap_dir(ch);
1624 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1638 k = (n + k - 1) % n;
1657 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£");
1659 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options.");
1661 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1662 (*cheat_info[k].o_var) = TRUE;
1671 (*cheat_info[k].o_var) = FALSE;
1679 strnfmt(buf, sizeof(buf), "joption.txt#%s", cheat_info[k].o_text);
1681 strnfmt(buf, sizeof(buf), "option.txt#%s", cheat_info[k].o_text);
1683 /* Peruse the help file */
1684 (void)show_file(TRUE, buf, NULL, 0, 0);
1700 static option_type autosave_info[2] =
1702 { &autosave_l, FALSE, 255, 0x01, 0x00,
1704 "autosave_l", "¿·¤·¤¤³¬¤ËÆþ¤ëÅ٤˼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1706 "autosave_l", "Autosave when entering new levels" },
1710 { &autosave_t, FALSE, 255, 0x02, 0x00,
1712 "autosave_t", "°ìÄ꥿¡¼¥óËè¤Ë¼«Æ°¥»¡¼¥Ö¤¹¤ë" },
1714 "autosave_t", "Timed autosave" },
1720 static s16b toggle_frequency(s16b current)
1725 case 50: return 100;
1726 case 100: return 250;
1727 case 250: return 500;
1728 case 500: return 1000;
1729 case 1000: return 2500;
1730 case 2500: return 5000;
1731 case 5000: return 10000;
1732 case 10000: return 25000;
1739 * Interact with some options for cheating
1741 static void do_cmd_options_autosave(cptr info)
1745 int i, k = 0, n = 2;
1753 /* Interact with the player */
1756 /* Prompt XXX XXX XXX */
1758 sprintf(buf, "%s ( ¥ê¥¿¡¼¥ó¤Ç¼¡¤Ø, y/n ¤Ç¥»¥Ã¥È, F ¤ÇÉÑÅÙ¤òÆþÎÏ, ESC ¤Ç·èÄê ) ", info);
1760 sprintf(buf, "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) ", info);
1765 /* Display the options */
1766 for (i = 0; i < n; i++)
1768 byte a = TERM_WHITE;
1770 /* Color current option */
1771 if (i == k) a = TERM_L_BLUE;
1773 /* Display the option text */
1774 sprintf(buf, "%-48s: %s (%s)",
1775 autosave_info[i].o_desc,
1777 (*autosave_info[i].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1779 (*autosave_info[i].o_var ? "yes" : "no "),
1782 autosave_info[i].o_text);
1783 c_prt(a, buf, i + 2, 0);
1787 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè", autosave_freq), 5, 0);
1789 prt(format("Timed autosave frequency: every %d turns", autosave_freq), 5, 0);
1794 /* Hilite current option */
1795 move_cursor(k + 2, 50);
1811 k = (n + k - 1) % n;
1829 (*autosave_info[k].o_var) = TRUE;
1838 (*autosave_info[k].o_var) = FALSE;
1846 autosave_freq = toggle_frequency(autosave_freq);
1848 prt(format("¼«Æ°¥»¡¼¥Ö¤ÎÉÑÅÙ¡§ %d ¥¿¡¼¥óËè",
1849 autosave_freq), 5, 0);
1851 prt(format("Timed autosave frequency: every %d turns",
1852 autosave_freq), 5, 0);
1860 (void)show_file(TRUE, "joption.txt#Autosave", NULL, 0, 0);
1862 (void)show_file(TRUE, "option.txt#Autosave", NULL, 0, 0);
1880 #define PAGE_AUTODESTROY 7
1883 * Interact with some options
1885 void do_cmd_options_aux(int page, cptr info)
1888 int i, k = 0, n = 0, l;
1893 /* Lookup the options */
1894 for (i = 0; i < 24; i++) opt[i] = 0;
1896 /* Scan the options */
1897 for (i = 0; option_info[i].o_desc; i++)
1899 /* Notice options on this "page" */
1900 if (option_info[i].o_page == page) opt[n++] = i;
1907 /* Interact with the player */
1912 /* Prompt XXX XXX XXX */
1914 sprintf(buf, "%s (¥ê¥¿¡¼¥ó:¼¡, y/n:Êѹ¹, ESC:½ªÎ», ?:¥Ø¥ë¥×) ", info);
1916 sprintf(buf, "%s (RET:next, y/n:change, ESC:accept, ?:help) ", info);
1922 /* HACK -- description for easy-auto-destroy options */
1924 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "°Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢´Ê°×¼«Æ°Ç˲õ¤ò»ÈÍѤ¹¤ë¤È¤¤Î¤ß͸ú", 6, 6);
1926 if (page == PAGE_AUTODESTROY) c_prt(TERM_YELLOW, "Following options will protect items from easy auto-destroyer.", 6, 3);
1929 /* Display the options */
1930 for (i = 0; i < n; i++)
1932 byte a = TERM_WHITE;
1934 /* Color current option */
1935 if (i == k) a = TERM_L_BLUE;
1937 /* Display the option text */
1938 sprintf(buf, "%-48s: %s (%.19s)",
1939 option_info[opt[i]].o_desc,
1941 (*option_info[opt[i]].o_var ? "¤Ï¤¤ " : "¤¤¤¤¤¨"),
1943 (*option_info[opt[i]].o_var ? "yes" : "no "),
1946 option_info[opt[i]].o_text);
1947 if ((page == PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1948 else c_prt(a, buf, i + 2, 0);
1951 if ((page == PAGE_AUTODESTROY) && (k > 2)) l = 3;
1954 /* Hilite current option */
1955 move_cursor(k + 2 + l, 50);
1961 * HACK - Try to translate the key into a direction
1962 * to allow using the roguelike keys for navigation.
1964 dir = get_keymap_dir(ch);
1965 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1979 k = (n + k - 1) % n;
1996 (*option_info[opt[k]].o_var) = TRUE;
2005 (*option_info[opt[k]].o_var) = FALSE;
2013 (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
2020 strnfmt(buf, sizeof(buf), "joption.txt#%s", option_info[opt[k]].o_text);
2022 strnfmt(buf, sizeof(buf), "option.txt#%s", option_info[opt[k]].o_text);
2024 /* Peruse the help file */
2025 (void)show_file(TRUE, buf, NULL, 0, 0);
2042 * Modify the "window" options
2044 static void do_cmd_options_win(void)
2058 /* Memorize old flags */
2059 for (j = 0; j < 8; j++)
2061 /* Acquire current flags */
2062 old_flag[j] = window_flag[j];
2072 /* Prompt XXX XXX XXX */
2074 prt("¥¦¥£¥ó¥É¥¦¡¦¥Õ¥é¥° (<Êý¸þ>¤Ç°ÜÆ°, t¤Ç¥Á¥§¥ó¥¸, y/n ¤Ç¥»¥Ã¥È, ESC)", 0, 0);
2076 prt("Window Flags (<dir>, t, y, n, ESC) ", 0, 0);
2080 /* Display the windows */
2081 for (j = 0; j < 8; j++)
2083 byte a = TERM_WHITE;
2085 cptr s = angband_term_name[j];
2088 if (j == x) a = TERM_L_BLUE;
2090 /* Window name, staggered, centered */
2091 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
2094 /* Display the options */
2095 for (i = 0; i < 16; i++)
2097 byte a = TERM_WHITE;
2099 cptr str = window_flag_desc[i];
2102 if (i == y) a = TERM_L_BLUE;
2106 if (!str) str = "(̤»ÈÍÑ)";
2108 if (!str) str = "(Unused option)";
2113 Term_putstr(0, i + 5, -1, a, str);
2115 /* Display the windows */
2116 for (j = 0; j < 8; j++)
2118 byte a = TERM_WHITE;
2123 if ((i == y) && (j == x)) a = TERM_L_BLUE;
2126 if (window_flag[j] & (1L << i)) c = 'X';
2129 Term_putch(35 + j * 5, i + 5, a, c);
2134 Term_gotoxy(35 + x * 5, y + 5);
2152 for (j = 0; j < 8; j++)
2154 window_flag[j] &= ~(1L << y);
2158 for (i = 0; i < 16; i++)
2160 window_flag[x] &= ~(1L << i);
2173 window_flag[x] |= (1L << y);
2181 window_flag[x] &= ~(1L << y);
2188 (void)show_file(TRUE, "joption.txt#Window", NULL, 0, 0);
2190 (void)show_file(TRUE, "option.txt#Window", NULL, 0, 0);
2200 d = get_keymap_dir(ch);
2202 x = (x + ddx[d] + 8) % 8;
2203 y = (y + ddy[d] + 16) % 16;
2210 /* Notice changes */
2211 for (j = 0; j < 8; j++)
2216 if (!angband_term[j]) continue;
2218 /* Ignore non-changes */
2219 if (window_flag[j] == old_flag[j]) continue;
2222 Term_activate(angband_term[j]);
2239 * Set or unset various options.
2241 * The user must use the "Ctrl-R" command to "adapt" to changes
2242 * in any options which control "visual" aspects of the game.
2244 void do_cmd_options(void)
2249 /* Save the screen */
2258 /* Why are we here */
2260 prt("[ ¥ª¥×¥·¥ç¥ó¤ÎÀßÄê ]", 2, 0);
2262 prt("Options", 2, 0);
2266 /* Give some choices */
2268 prt("(1) ¥¡¼ÆþÎÏ ¥ª¥×¥·¥ç¥ó", 4, 5);
2269 prt("(2) ²èÌ̽ÐÎÏ ¥ª¥×¥·¥ç¥ó", 5, 5);
2270 prt("(3) ¥²¡¼¥à¥×¥ì¥¤ ¥ª¥×¥·¥ç¥ó", 6, 5);
2271 prt("(4) ¹ÔÆ°Ãæ»ß´Ø·¸ ¥ª¥×¥·¥ç¥ó", 7, 5);
2272 prt("(5) ¸úΨ²½ ¥ª¥×¥·¥ç¥ó", 8, 5);
2273 prt("(6) ´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ ¥ª¥×¥·¥ç¥ó", 9, 5);
2274 prt("(R) ¥×¥ì¥¤µÏ¿ ¥ª¥×¥·¥ç¥ó", 10, 5);
2275 /* Special choices */
2276 prt("(D) ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 12, 5);
2277 prt("(H) Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 13, 5);
2278 prt("(A) ¼«Æ°¥»¡¼¥Ö ¥ª¥×¥·¥ç¥ó", 14, 5);
2280 prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
2282 prt("(1) Input Options", 4, 5);
2283 prt("(2) Output Options", 5, 5);
2284 prt("(3) Game-Play Options", 6, 5);
2285 prt("(4) Disturbance Options", 7, 5);
2286 prt("(5) Efficiency Options", 8, 5);
2287 prt("(6) Easy Auto-Destroyer Options", 9, 5);
2288 prt("(R) Play-record Options", 10, 5);
2290 /* Special choices */
2291 prt("(D) Base Delay Factor", 12, 5);
2292 prt("(H) Hitpoint Warning", 13, 5);
2293 prt("(A) Autosave Options", 14, 5);
2297 prt("(W) Window Flags", 15, 5);
2300 if (p_ptr->noscore || allow_debug_opts)
2304 prt("(C) º¾µ½ ¥ª¥×¥·¥ç¥ó", 16, 5);
2306 prt("(C) Cheating Options", 16, 5);
2313 prt("¥³¥Þ¥ó¥É:", 18, 0);
2315 prt("Command: ", 18, 0);
2323 if (k == ESCAPE) break;
2328 /* General Options */
2331 /* Process the general options */
2333 do_cmd_options_aux(1, "¥¡¼ÆþÎÏ¥ª¥×¥·¥ç¥ó");
2335 do_cmd_options_aux(1, "Input Options");
2341 /* General Options */
2344 /* Process the general options */
2346 do_cmd_options_aux(2, "²èÌ̽ÐÎÏ¥ª¥×¥·¥ç¥ó");
2348 do_cmd_options_aux(2, "Output Options");
2354 /* Inventory Options */
2359 do_cmd_options_aux(3, "¥²¡¼¥à¥×¥ì¥¤¡¦¥ª¥×¥·¥ç¥ó");
2361 do_cmd_options_aux(3, "Game-Play Options");
2367 /* Disturbance Options */
2372 do_cmd_options_aux(4, "¹ÔÆ°Ãæ»ß´Ø·¸¤Î¥ª¥×¥·¥ç¥ó");
2374 do_cmd_options_aux(4, "Disturbance Options");
2380 /* Efficiency Options */
2385 do_cmd_options_aux(5, "¸úΨ²½¥ª¥×¥·¥ç¥ó");
2387 do_cmd_options_aux(5, "Efficiency Options");
2393 /* Object auto-destruction Options */
2398 do_cmd_options_aux(7, "´Ê°×¥¢¥¤¥Æ¥à¼«Æ°Ç˲õ¥ª¥×¥·¥ç¥ó");
2400 do_cmd_options_aux(7, "Easy Auto-Destroyer Options");
2405 /* Play-record Options */
2411 do_cmd_options_aux(10, "¥×¥ì¥¤µÏ¿¥ª¥×¥·¥ç¥ó");
2413 do_cmd_options_aux(10, "Play-record Option");
2418 /* Cheating Options */
2421 if (!p_ptr->noscore && !allow_debug_opts)
2423 /* Cheat options are not permitted */
2430 do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤¤Ê¤¤¡ª");
2432 do_cmd_options_cheat("Cheaters never win");
2442 do_cmd_options_autosave("¼«Æ°¥»¡¼¥Ö");
2444 do_cmd_options_autosave("Autosave");
2455 do_cmd_options_win();
2456 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2457 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2458 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2459 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON);
2463 /* Hack -- Delay Speed */
2469 prt("¥³¥Þ¥ó¥É: ´ðËÜ¥¦¥§¥¤¥ÈÎÌ", 18, 0);
2471 prt("Command: Base Delay Factor", 18, 0);
2475 /* Get a new value */
2478 int msec = delay_factor * delay_factor * delay_factor;
2480 prt(format("¸½ºß¤Î¥¦¥§¥¤¥È: %d (%d¥ß¥êÉÃ)",
2481 delay_factor, msec), 22, 0);
2483 prt(format("Current base delay factor: %d (%d msec)",
2484 delay_factor, msec), 22, 0);
2488 prt("¥¦¥§¥¤¥È (0-9) ESC¤Ç·èÄê: ", 20, 0);
2490 prt("Delay Factor (0-9 or ESC to accept): ", 20, 0);
2494 if (k == ESCAPE) break;
2498 (void)show_file(TRUE, "joption.txt#BaseDelay", NULL, 0, 0);
2500 (void)show_file(TRUE, "option.txt#BaseDelay", NULL, 0, 0);
2504 else if (isdigit(k)) delay_factor = D2I(k);
2511 /* Hack -- hitpoint warning factor */
2517 prt("¥³¥Þ¥ó¥É: Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð", 18, 0);
2519 prt("Command: Hitpoint Warning", 18, 0);
2523 /* Get a new value */
2527 prt(format("¸½ºß¤ÎÄã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð: %d0%%",
2528 hitpoint_warn), 22, 0);
2530 prt(format("Current hitpoint warning: %d0%%",
2531 hitpoint_warn), 22, 0);
2535 prt("Äã¥Ò¥Ã¥È¥Ý¥¤¥ó¥È·Ù¹ð (0-9) ESC¤Ç·èÄê: ", 20, 0);
2537 prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0);
2541 if (k == ESCAPE) break;
2545 (void)show_file(TRUE, "joption.txt#Hitpoint", NULL, 0, 0);
2547 (void)show_file(TRUE, "option.txt#Hitpoint", NULL, 0, 0);
2551 else if (isdigit(k)) hitpoint_warn = D2I(k);
2560 (void)show_file(TRUE, "joption.txt", NULL, 0, 0);
2562 (void)show_file(TRUE, "option.txt", NULL, 0, 0);
2567 /* Unknown option */
2576 /* Flush messages */
2581 /* Restore the screen */
2584 /* Hack - Redraw equippy chars */
2585 p_ptr->redraw |= (PR_EQUIPPY);
2591 * Ask for a "user pref line" and process it
2593 * XXX XXX XXX Allow absolute file names?
2595 void do_cmd_pref(void)
2602 /* Ask for a "user pref command" */
2604 if (!get_string("ÀßÄêÊѹ¹¥³¥Þ¥ó¥É: ", buf, 80)) return;
2606 if (!get_string("Pref: ", buf, 80)) return;
2610 /* Process that pref command */
2611 (void)process_pref_file_command(buf);
2614 void do_cmd_pickpref(void)
2620 if(!get_check("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹¤«? ")) return;
2622 if(!get_check("Reload auto-pick preference file? ")) return;
2625 /* Free old entries */
2628 /* ¥¥ã¥éËè¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß */
2630 sprintf(buf, "picktype-%s.prf", player_name);
2632 sprintf(buf, "pickpref-%s.prf", player_name);
2634 err = process_pickpref_file(buf);
2639 msg_format("%s¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", buf);
2641 msg_format("loaded '%s'.", buf);
2645 /* ¶¦Ä̤ÎÀßÄê¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß */
2647 /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
2651 err = process_pickpref_file("picktype.prf");
2653 err = process_pickpref_file("pickpref.prf");
2659 msg_print("picktype.prf¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£");
2661 msg_print("loaded 'pickpref.prf'.");
2668 if(err) msg_print("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
2670 if(err) msg_print("Failed to reload autopick preference.");
2677 * Hack -- append all current macros to the given file
2679 static errr macro_dump(cptr fname)
2681 static cptr mark = "Macro Dump";
2687 /* Build the filename */
2688 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2690 /* File type is "TEXT" */
2691 FILE_TYPE(FILE_TYPE_TEXT);
2693 /* Append to the file */
2694 if (!open_auto_dump(buf, mark)) return (-1);
2698 auto_dump_printf("\n# ¼«Æ°¥Þ¥¯¥í¥»¡¼¥Ö\n\n");
2700 auto_dump_printf("\n# Automatic macro dump\n\n");
2704 for (i = 0; i < macro__num; i++)
2706 /* Extract the action */
2707 ascii_to_text(buf, macro__act[i]);
2709 /* Dump the macro */
2710 auto_dump_printf("A:%s\n", buf);
2712 /* Extract the action */
2713 ascii_to_text(buf, macro__pat[i]);
2715 /* Dump normal macros */
2716 auto_dump_printf("P:%s\n", buf);
2719 auto_dump_printf("\n");
2731 * Hack -- ask for a "trigger" (see below)
2733 * Note the complex use of the "inkey()" function from "util.c".
2735 * Note that both "flush()" calls are extremely important.
2737 static void do_cmd_macro_aux(char *buf)
2747 /* Do not process macros */
2753 /* Read the pattern */
2759 /* Do not process macros */
2762 /* Do not wait for keys */
2765 /* Attempt to read a key */
2776 /* Convert the trigger */
2777 ascii_to_text(tmp, buf);
2779 /* Hack -- display the trigger */
2780 Term_addstr(-1, TERM_WHITE, tmp);
2787 * Hack -- ask for a keymap "trigger" (see below)
2789 * Note that both "flush()" calls are extremely important. This may
2790 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2792 static void do_cmd_macro_aux_keymap(char *buf)
2806 /* Convert to ascii */
2807 ascii_to_text(tmp, buf);
2809 /* Hack -- display the trigger */
2810 Term_addstr(-1, TERM_WHITE, tmp);
2819 * Hack -- append all keymaps to the given file
2821 static errr keymap_dump(cptr fname)
2823 static cptr mark = "Keymap Dump";
2832 if (rogue_like_commands)
2834 mode = KEYMAP_MODE_ROGUE;
2840 mode = KEYMAP_MODE_ORIG;
2844 /* Build the filename */
2845 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2847 /* File type is "TEXT" */
2848 FILE_TYPE(FILE_TYPE_TEXT);
2850 /* Append to the file */
2851 if (!open_auto_dump(buf, mark)) return -1;
2855 auto_dump_printf("\n# ¼«Æ°¥¡¼ÇÛÃÖ¥»¡¼¥Ö\n\n");
2857 auto_dump_printf("\n# Automatic keymap dump\n\n");
2861 for (i = 0; i < 256; i++)
2865 /* Loop up the keymap */
2866 act = keymap_act[mode][i];
2868 /* Skip empty keymaps */
2871 /* Encode the key */
2874 ascii_to_text(key, buf);
2876 /* Encode the action */
2877 ascii_to_text(buf, act);
2879 /* Dump the macro */
2880 auto_dump_printf("A:%s\n", buf);
2881 auto_dump_printf("C:%d:%s\n", mode, key);
2894 * Interact with "macros"
2896 * Note that the macro "action" must be defined before the trigger.
2898 * Could use some helpful instructions on this page. XXX XXX XXX
2900 void do_cmd_macros(void)
2912 if (rogue_like_commands)
2914 mode = KEYMAP_MODE_ROGUE;
2920 mode = KEYMAP_MODE_ORIG;
2923 /* File type is "TEXT" */
2924 FILE_TYPE(FILE_TYPE_TEXT);
2931 /* Process requests until done */
2939 prt("[ ¥Þ¥¯¥í¤ÎÀßÄê ]", 2, 0);
2941 prt("Interact with Macros", 2, 0);
2946 /* Describe that action */
2948 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
2950 prt("Current action (if any) shown below:", 20, 0);
2954 /* Analyze the current action */
2955 ascii_to_text(buf, macro__buf);
2957 /* Display the current action */
2963 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
2965 prt("(1) Load a user pref file", 4, 5);
2970 prt("(2) ¥Õ¥¡¥¤¥ë¤Ë¥Þ¥¯¥í¤òÄɲÃ", 5, 5);
2971 prt("(3) ¥Þ¥¯¥í¤Î³Îǧ", 6, 5);
2972 prt("(4) ¥Þ¥¯¥í¤ÎºîÀ®", 7, 5);
2973 prt("(5) ¥Þ¥¯¥í¤Îºï½ü", 8, 5);
2974 prt("(6) ¥Õ¥¡¥¤¥ë¤Ë¥¡¼ÇÛÃÖ¤òÄɲÃ", 9, 5);
2975 prt("(7) ¥¡¼ÇÛÃ֤γÎǧ", 10, 5);
2976 prt("(8) ¥¡¼ÇÛÃ֤κîÀ®", 11, 5);
2977 prt("(9) ¥¡¼ÇÛÃ֤κï½ü", 12, 5);
2978 prt("(0) ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 13, 5);
2980 prt("(2) Append macros to a file", 5, 5);
2981 prt("(3) Query a macro", 6, 5);
2982 prt("(4) Create a macro", 7, 5);
2983 prt("(5) Remove a macro", 8, 5);
2984 prt("(6) Append keymaps to a file", 9, 5);
2985 prt("(7) Query a keymap", 10, 5);
2986 prt("(8) Create a keymap", 11, 5);
2987 prt("(9) Remove a keymap", 12, 5);
2988 prt("(0) Enter a new action", 13, 5);
2991 #endif /* ALLOW_MACROS */
2995 prt("¥³¥Þ¥ó¥É: ", 16, 0);
2997 prt("Command: ", 16, 0);
3005 if (i == ESCAPE) break;
3007 /* Load a 'macro' file */
3014 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 16, 0);
3016 prt("Command: Load a user pref file", 16, 0);
3022 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3024 prt("File: ", 18, 0);
3028 /* Default filename */
3029 sprintf(tmp, "%s.prf", player_name);
3031 /* Ask for a file */
3032 if (!askfor_aux(tmp, 80)) continue;
3034 /* Process the given filename */
3035 err = process_pref_file(tmp);
3039 msg_format("ɸ½à¤ÎÀßÄê¥Õ¥¡¥¤¥ë'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3041 msg_format("Loaded default '%s'.", tmp);
3048 msg_format("'%s'¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡ª", tmp);
3050 msg_format("Failed to load '%s'!");
3056 msg_format("'%s'¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", tmp);
3058 msg_format("Loaded '%s'.", tmp);
3070 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3072 prt("Command: Append macros to a file", 16, 0);
3078 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3080 prt("File: ", 18, 0);
3084 /* Default filename */
3085 sprintf(tmp, "%s.prf", player_name);
3087 /* Ask for a file */
3088 if (!askfor_aux(tmp, 80)) continue;
3090 /* Dump the macros */
3091 (void)macro_dump(tmp);
3095 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3097 msg_print("Appended macros.");
3109 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Î³Îǧ", 16, 0);
3111 prt("Command: Query a macro", 16, 0);
3117 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3119 prt("Trigger: ", 18, 0);
3123 /* Get a macro trigger */
3124 do_cmd_macro_aux(buf);
3126 /* Acquire action */
3127 k = macro_find_exact(buf);
3134 msg_print("¤½¤Î¥¡¼¤Ë¤Ï¥Þ¥¯¥í¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3136 msg_print("Found no macro.");
3144 /* Obtain the action */
3145 strcpy(macro__buf, macro__act[k]);
3147 /* Analyze the current action */
3148 ascii_to_text(buf, macro__buf);
3150 /* Display the current action */
3155 msg_print("¥Þ¥¯¥í¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3157 msg_print("Found a macro.");
3163 /* Create a macro */
3168 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤ÎºîÀ®", 16, 0);
3170 prt("Command: Create a macro", 16, 0);
3176 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3178 prt("Trigger: ", 18, 0);
3182 /* Get a macro trigger */
3183 do_cmd_macro_aux(buf);
3190 prt("¥Þ¥¯¥í¹ÔÆ°: ", 20, 0);
3192 prt("Action: ", 20, 0);
3196 /* Convert to text */
3197 ascii_to_text(tmp, macro__buf);
3199 /* Get an encoded action */
3200 if (askfor_aux(tmp, 80))
3202 /* Convert to ascii */
3203 text_to_ascii(macro__buf, tmp);
3205 /* Link the macro */
3206 macro_add(buf, macro__buf);
3210 msg_print("¥Þ¥¯¥í¤òÄɲä·¤Þ¤·¤¿¡£");
3212 msg_print("Added a macro.");
3218 /* Remove a macro */
3223 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¤Îºï½ü", 16, 0);
3225 prt("Command: Remove a macro", 16, 0);
3231 prt("¥È¥ê¥¬¡¼¥¡¼: ", 18, 0);
3233 prt("Trigger: ", 18, 0);
3237 /* Get a macro trigger */
3238 do_cmd_macro_aux(buf);
3240 /* Link the macro */
3241 macro_add(buf, buf);
3245 msg_print("¥Þ¥¯¥í¤òºï½ü¤·¤Þ¤·¤¿¡£");
3247 msg_print("Removed a macro.");
3257 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃÖ¤ò¥Õ¥¡¥¤¥ë¤ËÄɲ乤ë", 16, 0);
3259 prt("Command: Append keymaps to a file", 16, 0);
3265 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3267 prt("File: ", 18, 0);
3271 /* Default filename */
3272 sprintf(tmp, "%s.prf", player_name);
3274 /* Ask for a file */
3275 if (!askfor_aux(tmp, 80)) continue;
3277 /* Dump the macros */
3278 (void)keymap_dump(tmp);
3282 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3284 msg_print("Appended keymaps.");
3289 /* Query a keymap */
3296 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤γÎǧ", 16, 0);
3298 prt("Command: Query a keymap", 16, 0);
3304 prt("²¡¤¹¥¡¼: ", 18, 0);
3306 prt("Keypress: ", 18, 0);
3310 /* Get a keymap trigger */
3311 do_cmd_macro_aux_keymap(buf);
3313 /* Look up the keymap */
3314 act = keymap_act[mode][(byte)(buf[0])];
3321 msg_print("¥¡¼ÇÛÃÖ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
3323 msg_print("Found no keymap.");
3331 /* Obtain the action */
3332 strcpy(macro__buf, act);
3334 /* Analyze the current action */
3335 ascii_to_text(buf, macro__buf);
3337 /* Display the current action */
3342 msg_print("¥¡¼ÇÛÃÖ¤ò³Îǧ¤·¤Þ¤·¤¿¡£");
3344 msg_print("Found a keymap.");
3350 /* Create a keymap */
3355 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κîÀ®", 16, 0);
3357 prt("Command: Create a keymap", 16, 0);
3363 prt("²¡¤¹¥¡¼: ", 18, 0);
3365 prt("Keypress: ", 18, 0);
3369 /* Get a keymap trigger */
3370 do_cmd_macro_aux_keymap(buf);
3377 prt("¹ÔÆ°: ", 20, 0);
3379 prt("Action: ", 20, 0);
3383 /* Convert to text */
3384 ascii_to_text(tmp, macro__buf);
3386 /* Get an encoded action */
3387 if (askfor_aux(tmp, 80))
3389 /* Convert to ascii */
3390 text_to_ascii(macro__buf, tmp);
3392 /* Free old keymap */
3393 string_free(keymap_act[mode][(byte)(buf[0])]);
3395 /* Make new keymap */
3396 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
3400 msg_print("¥¡¼ÇÛÃÖ¤òÄɲä·¤Þ¤·¤¿¡£");
3402 msg_print("Added a keymap.");
3408 /* Remove a keymap */
3413 prt("¥³¥Þ¥ó¥É: ¥¡¼ÇÛÃ֤κï½ü", 16, 0);
3415 prt("Command: Remove a keymap", 16, 0);
3421 prt("²¡¤¹¥¡¼: ", 18, 0);
3423 prt("Keypress: ", 18, 0);
3427 /* Get a keymap trigger */
3428 do_cmd_macro_aux_keymap(buf);
3430 /* Free old keymap */
3431 string_free(keymap_act[mode][(byte)(buf[0])]);
3433 /* Make new keymap */
3434 keymap_act[mode][(byte)(buf[0])] = NULL;
3438 msg_print("¥¡¼ÇÛÃÖ¤òºï½ü¤·¤Þ¤·¤¿¡£");
3440 msg_print("Removed a keymap.");
3445 /* Enter a new action */
3450 prt("¥³¥Þ¥ó¥É: ¥Þ¥¯¥í¹ÔÆ°¤ÎÆþÎÏ", 16, 0);
3452 prt("Command: Enter a new action", 16, 0);
3456 /* Go to the correct location */
3459 /* Hack -- limit the value */
3462 /* Get an encoded action */
3463 if (!askfor_aux(buf, 80)) continue;
3465 /* Extract an action */
3466 text_to_ascii(macro__buf, buf);
3469 #endif /* ALLOW_MACROS */
3478 /* Flush messages */
3487 static void cmd_visuals_aux(int i, int *num, int max)
3494 sprintf(str, "%d", *num);
3496 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3499 tmp = strtol(str, NULL, 0);
3500 if (tmp >= 0 && tmp < max)
3504 else if (isupper(i))
3505 *num = (*num + max - 1) % max;
3507 *num = (*num + 1) % max;
3513 * Interact with "visuals"
3515 void do_cmd_visuals(void)
3523 const char *empty_symbol = "<< ? >>";
3525 if (use_bigtile) empty_symbol = "<< ?? >>";
3527 /* File type is "TEXT" */
3528 FILE_TYPE(FILE_TYPE_TEXT);
3531 /* Save the screen */
3535 /* Interact until done */
3541 /* Ask for a choice */
3543 prt("²èÌÌɽ¼¨¤ÎÀßÄê", 2, 0);
3545 prt("Interact with Visuals", 2, 0);
3549 /* Give some choices */
3551 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
3553 prt("(1) Load a user pref file", 4, 5);
3556 #ifdef ALLOW_VISUALS
3558 prt("(2) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
3559 prt("(3) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 6, 5);
3560 prt("(4) ÃÏ·Á¤Î ¿§/ʸ»ú ¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 7, 5);
3561 prt("(5) (̤»ÈÍÑ)", 8, 5);
3562 prt("(6) ¥â¥ó¥¹¥¿¡¼¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 9, 5);
3563 prt("(7) ¥¢¥¤¥Æ¥à¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 10, 5);
3564 prt("(8) ÃÏ·Á¤Î ¿§/ʸ»ú ¤òÊѹ¹¤¹¤ë", 11, 5);
3565 prt("(9) (̤»ÈÍÑ)", 12, 5);
3567 prt("(2) Dump monster attr/chars", 5, 5);
3568 prt("(3) Dump object attr/chars", 6, 5);
3569 prt("(4) Dump feature attr/chars", 7, 5);
3570 prt("(5) (unused)", 8, 5);
3571 prt("(6) Change monster attr/chars", 9, 5);
3572 prt("(7) Change object attr/chars", 10, 5);
3573 prt("(8) Change feature attr/chars", 11, 5);
3574 prt("(9) (unused)", 12, 5);
3579 prt("(0) ²èÌÌɽ¼¨ÊýË¡¤Î½é´ü²½", 13, 5);
3581 prt("(0) Reset visuals", 13, 5);
3587 prt("¥³¥Þ¥ó¥É:", 18, 0);
3589 prt("Command: ", 15, 0);
3597 if (i == ESCAPE) break;
3599 /* Load a 'pref' file */
3604 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 15, 0);
3606 prt("Command: Load a user pref file", 15, 0);
3612 prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
3614 prt("File: ", 17, 0);
3618 /* Default filename */
3619 sprintf(tmp, "%s.prf", player_name);
3622 if (!askfor_aux(tmp, 70)) continue;
3624 /* Process the given filename */
3625 (void)process_pref_file(tmp);
3628 #ifdef ALLOW_VISUALS
3630 /* Dump monster attr/chars */
3633 static cptr mark = "Monster attr/chars";
3637 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3639 prt("Command: Dump monster attr/chars", 15, 0);
3645 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3647 prt("File: ", 17, 0);
3651 /* Default filename */
3652 sprintf(tmp, "%s.prf", player_name);
3654 /* Get a filename */
3655 if (!askfor_aux(tmp, 70)) continue;
3657 /* Build the filename */
3658 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3660 /* Append to the file */
3661 if (!open_auto_dump(buf, mark)) continue;
3665 auto_dump_printf("\n# ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3667 auto_dump_printf("\n# Monster attr/char definitions\n\n");
3671 for (i = 1; i < max_r_idx; i++)
3673 monster_race *r_ptr = &r_info[i];
3675 /* Skip non-entries */
3676 if (!r_ptr->name) continue;
3678 /* Dump a comment */
3679 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3681 /* Dump the monster attr/char info */
3682 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3683 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3691 msg_print("¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3693 msg_print("Dumped monster attr/chars.");
3698 /* Dump object attr/chars */
3701 static cptr mark = "Object attr/chars";
3705 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3707 prt("Command: Dump object attr/chars", 15, 0);
3713 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3715 prt("File: ", 17, 0);
3719 /* Default filename */
3720 sprintf(tmp, "%s.prf", player_name);
3722 /* Get a filename */
3723 if (!askfor_aux(tmp, 70)) continue;
3725 /* Build the filename */
3726 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3728 /* Append to the file */
3729 if (!open_auto_dump(buf, mark)) continue;
3733 auto_dump_printf("\n# ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3735 auto_dump_printf("\n# Object attr/char definitions\n\n");
3739 for (i = 1; i < max_k_idx; i++)
3742 object_kind *k_ptr = &k_info[i];
3744 /* Skip non-entries */
3745 if (!k_ptr->name) continue;
3747 /* Skip entries with flavor */
3748 if (k_ptr->flavor) continue;
3751 strip_name(o_name, i);
3753 /* Dump a comment */
3754 auto_dump_printf("# %s\n", o_name);
3756 /* Dump the object attr/char info */
3757 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3758 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3766 msg_print("¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3768 msg_print("Dumped object attr/chars.");
3773 /* Dump feature attr/chars */
3776 static cptr mark = "Feature attr/chars";
3780 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 15, 0);
3782 prt("Command: Dump feature attr/chars", 15, 0);
3788 prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
3790 prt("File: ", 17, 0);
3794 /* Default filename */
3795 sprintf(tmp, "%s.prf", player_name);
3797 /* Get a filename */
3798 if (!askfor_aux(tmp, 70)) continue;
3800 /* Build the filename */
3801 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3803 /* Append to the file */
3804 if (!open_auto_dump(buf, mark)) continue;
3808 auto_dump_printf("\n# ÃÏ·Á¤Î[¿§/ʸ»ú]¤ÎÀßÄê\n\n");
3810 auto_dump_printf("\n# Feature attr/char definitions\n\n");
3814 for (i = 1; i < max_f_idx; i++)
3816 feature_type *f_ptr = &f_info[i];
3818 /* Skip non-entries */
3819 if (!f_ptr->name) continue;
3821 /* Skip mimiccing features */
3822 if (f_ptr->mimic != i) continue;
3824 /* Dump a comment */
3825 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3827 /* Dump the feature attr/char info */
3828 auto_dump_printf("F:%d:0x%02X/0x%02X\n\n", i,
3829 (byte)(f_ptr->x_attr), (byte)(f_ptr->x_char));
3837 msg_print("ÃÏ·Á¤Î[¿§/ʸ»ú]¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
3839 msg_print("Dumped feature attr/chars.");
3844 /* Modify monster attr/chars */
3851 prt("¥³¥Þ¥ó¥É: ¥â¥ó¥¹¥¿¡¼¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3853 prt("Command: Change monster attr/chars", 15, 0);
3857 /* Hack -- query until done */
3860 monster_race *r_ptr = &r_info[r];
3865 byte da = (r_ptr->d_attr);
3866 byte dc = (r_ptr->d_char);
3867 byte ca = (r_ptr->x_attr);
3868 byte cc = (r_ptr->x_char);
3870 /* Label the object */
3872 Term_putstr(5, 17, -1, TERM_WHITE,
3873 format("¥â¥ó¥¹¥¿¡¼ = %d, ̾Á° = %-40.40s",
3874 r, (r_name + r_ptr->name)));
3876 Term_putstr(5, 17, -1, TERM_WHITE,
3877 format("Monster = %d, Name = %-40.40s",
3878 r, (r_name + r_ptr->name)));
3882 /* Label the Default values */
3884 Term_putstr(10, 19, -1, TERM_WHITE,
3885 format("½é´üÃÍ ¿§ / ʸ»ú = %3u / %3u", da, dc));
3887 Term_putstr(10, 19, -1, TERM_WHITE,
3888 format("Default attr/char = %3u / %3u", da, dc));
3891 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3895 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
3897 Term_putch(43, 19, a, c);
3898 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
3900 /* Label the Current values */
3902 Term_putstr(10, 20, -1, TERM_WHITE,
3903 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3u / %3u", ca, cc));
3905 Term_putstr(10, 20, -1, TERM_WHITE,
3906 format("Current attr/char = %3u / %3u", ca, cc));
3909 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3913 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
3915 Term_putch(43, 20, a, c);
3916 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
3921 Term_putstr(0, 22, -1, TERM_WHITE,
3922 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
3924 Term_putstr(0, 22, -1, TERM_WHITE,
3925 "Command (n/N/^N/a/A/^A/c/C/^C): ");
3932 if (i == ESCAPE) break;
3934 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3935 else if (isupper(i)) c = 'a' + i - 'A';
3941 cmd_visuals_aux(i, &r, max_r_idx);
3944 t = (int)r_ptr->x_attr;
3945 cmd_visuals_aux(i, &t, 256);
3946 r_ptr->x_attr = (byte)t;
3949 t = (int)r_ptr->x_char;
3950 cmd_visuals_aux(i, &t, 256);
3951 r_ptr->x_char = (byte)t;
3957 /* Modify object attr/chars */
3964 prt("¥³¥Þ¥ó¥É: ¥¢¥¤¥Æ¥à¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
3966 prt("Command: Change object attr/chars", 15, 0);
3970 /* Hack -- query until done */
3973 object_kind *k_ptr = &k_info[k];
3978 byte da = (byte)k_ptr->d_attr;
3979 byte dc = (byte)k_ptr->d_char;
3980 byte ca = (byte)k_ptr->x_attr;
3981 byte cc = (byte)k_ptr->x_char;
3983 /* Label the object */
3985 Term_putstr(5, 17, -1, TERM_WHITE,
3986 format("¥¢¥¤¥Æ¥à = %d, ̾Á° = %-40.40s",
3987 k, (k_name + k_ptr->name)));
3989 Term_putstr(5, 17, -1, TERM_WHITE,
3990 format("Object = %d, Name = %-40.40s",
3991 k, (k_name + k_ptr->name)));
3995 /* Label the Default values */
3997 Term_putstr(10, 19, -1, TERM_WHITE,
3998 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4000 Term_putstr(10, 19, -1, TERM_WHITE,
4001 format("Default attr/char = %3d / %3d", da, dc));
4004 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4007 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4009 Term_putch(43, 19, a, c);
4010 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4013 /* Label the Current values */
4015 Term_putstr(10, 20, -1, TERM_WHITE,
4016 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4018 Term_putstr(10, 20, -1, TERM_WHITE,
4019 format("Current attr/char = %3d / %3d", ca, cc));
4022 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4025 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4027 Term_putch(43, 20, a, c);
4028 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4033 Term_putstr(0, 22, -1, TERM_WHITE,
4034 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4036 Term_putstr(0, 22, -1, TERM_WHITE,
4037 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4044 if (i == ESCAPE) break;
4046 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4047 else if (isupper(i)) c = 'a' + i - 'A';
4053 cmd_visuals_aux(i, &k, max_k_idx);
4056 t = (int)k_info[k].x_attr;
4057 cmd_visuals_aux(i, &t, 256);
4058 k_info[k].x_attr = (byte)t;
4061 t = (int)k_info[k].x_char;
4062 cmd_visuals_aux(i, &t, 256);
4063 k_info[k].x_char = (byte)t;
4069 /* Modify feature attr/chars */
4076 prt("¥³¥Þ¥ó¥É: ÃÏ·Á¤Î[¿§/ʸ»ú]¤òÊѹ¹¤·¤Þ¤¹", 15, 0);
4078 prt("Command: Change feature attr/chars", 15, 0);
4082 /* Hack -- query until done */
4085 feature_type *f_ptr = &f_info[f];
4090 byte da = (byte)f_ptr->d_attr;
4091 byte dc = (byte)f_ptr->d_char;
4092 byte ca = (byte)f_ptr->x_attr;
4093 byte cc = (byte)f_ptr->x_char;
4095 /* Label the object */
4097 Term_putstr(5, 17, -1, TERM_WHITE,
4098 format("ÃÏ·Á = %d, ̾Á° = %-40.40s",
4099 f, (f_name + f_ptr->name)));
4101 Term_putstr(5, 17, -1, TERM_WHITE,
4102 format("Terrain = %d, Name = %-40.40s",
4103 f, (f_name + f_ptr->name)));
4107 /* Label the Default values */
4109 Term_putstr(10, 19, -1, TERM_WHITE,
4110 format("½é´üÃÍ ¿§ / ʸ»ú = %3d / %3d", da, dc));
4112 Term_putstr(10, 19, -1, TERM_WHITE,
4113 format("Default attr/char = %3d / %3d", da, dc));
4116 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
4119 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4121 Term_putch(43, 19, a, c);
4122 if (use_bigtile) Term_putch(43 + 1, 19, a2, c2);
4125 /* Label the Current values */
4127 Term_putstr(10, 20, -1, TERM_WHITE,
4128 format("¸½ºßÃÍ ¿§ / ʸ»ú = %3d / %3d", ca, cc));
4130 Term_putstr(10, 20, -1, TERM_WHITE,
4131 format("Current attr/char = %3d / %3d", ca, cc));
4134 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
4137 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
4139 Term_putch(43, 20, a, c);
4140 if (use_bigtile) Term_putch(43 + 1, 20, a2, c2);
4145 Term_putstr(0, 22, -1, TERM_WHITE,
4146 "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
4148 Term_putstr(0, 22, -1, TERM_WHITE,
4149 "Command (n/N/^N/a/A/^A/c/C/^C): ");
4156 if (i == ESCAPE) break;
4158 if (iscntrl(i)) c = 'a' + i - KTRL('A');
4159 else if (isupper(i)) c = 'a' + i - 'A';
4165 cmd_visuals_aux(i, &f, max_f_idx);
4168 t = (int)f_info[f].x_attr;
4169 cmd_visuals_aux(i, &t, 256);
4170 f_info[f].x_attr = (byte)t;
4173 t = (int)f_info[f].x_char;
4174 cmd_visuals_aux(i, &t, 256);
4175 f_info[f].x_char = (byte)t;
4191 msg_print("²èÌ̾å¤Î[¿§/ʸ»ú]¤ò½é´üÃͤ˥ꥻ¥Ã¥È¤·¤Þ¤·¤¿¡£");
4193 msg_print("Visual attr/char tables reset.");
4198 /* Unknown option */
4204 /* Flush messages */
4209 /* Restore the screen */
4215 * Interact with "colors"
4217 void do_cmd_colors(void)
4226 /* File type is "TEXT" */
4227 FILE_TYPE(FILE_TYPE_TEXT);
4230 /* Save the screen */
4234 /* Interact until done */
4240 /* Ask for a choice */
4242 prt("[ ¥«¥é¡¼¤ÎÀßÄê ]", 2, 0);
4244 prt("Interact with Colors", 2, 0);
4248 /* Give some choices */
4250 prt("(1) ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É", 4, 5);
4252 prt("(1) Load a user pref file", 4, 5);
4257 prt("(2) ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹", 5, 5);
4258 prt("(3) ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤¹¤ë", 6, 5);
4260 prt("(2) Dump colors", 5, 5);
4261 prt("(3) Modify colors", 6, 5);
4268 prt("¥³¥Þ¥ó¥É: ", 8, 0);
4270 prt("Command: ", 8, 0);
4278 if (i == ESCAPE) break;
4280 /* Load a 'pref' file */
4285 prt("¥³¥Þ¥ó¥É: ¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤·¤Þ¤¹", 8, 0);
4287 prt("Command: Load a user pref file", 8, 0);
4293 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4295 prt("File: ", 10, 0);
4300 sprintf(tmp, "%s.prf", player_name);
4303 if (!askfor_aux(tmp, 70)) continue;
4305 /* Process the given filename */
4306 (void)process_pref_file(tmp);
4308 /* Mega-Hack -- react to changes */
4309 Term_xtra(TERM_XTRA_REACT, 0);
4311 /* Mega-Hack -- redraw */
4320 static cptr mark = "Colors";
4324 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤¹", 8, 0);
4326 prt("Command: Dump colors", 8, 0);
4332 prt("¥Õ¥¡¥¤¥ë: ", 10, 0);
4334 prt("File: ", 10, 0);
4338 /* Default filename */
4339 sprintf(tmp, "%s.prf", player_name);
4341 /* Get a filename */
4342 if (!askfor_aux(tmp, 70)) continue;
4344 /* Build the filename */
4345 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4347 /* Append to the file */
4348 if (!open_auto_dump(buf, mark)) continue;
4352 auto_dump_printf("\n# ¥«¥é¡¼¤ÎÀßÄê\n\n");
4354 auto_dump_printf("\n# Color redefinitions\n\n");
4358 for (i = 0; i < 256; i++)
4360 int kv = angband_color_table[i][0];
4361 int rv = angband_color_table[i][1];
4362 int gv = angband_color_table[i][2];
4363 int bv = angband_color_table[i][3];
4368 cptr name = "unknown";
4372 /* Skip non-entries */
4373 if (!kv && !rv && !gv && !bv) continue;
4375 /* Extract the color name */
4376 if (i < 16) name = color_names[i];
4378 /* Dump a comment */
4380 auto_dump_printf("# ¥«¥é¡¼ '%s'\n", name);
4382 auto_dump_printf("# Color '%s'\n", name);
4385 /* Dump the monster attr/char info */
4386 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
4395 msg_print("¥«¥é¡¼¤ÎÀßÄê¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
4397 msg_print("Dumped color redefinitions.");
4409 prt("¥³¥Þ¥ó¥É: ¥«¥é¡¼¤ÎÀßÄê¤òÊѹ¹¤·¤Þ¤¹", 8, 0);
4411 prt("Command: Modify colors", 8, 0);
4415 /* Hack -- query until done */
4424 /* Exhibit the normal colors */
4425 for (j = 0; j < 16; j++)
4427 /* Exhibit this color */
4428 Term_putstr(j*4, 20, -1, a, "###");
4430 /* Exhibit all colors */
4431 Term_putstr(j*4, 22, -1, j, format("%3d", j));
4434 /* Describe the color */
4436 name = ((a < 16) ? color_names[a] : "̤ÄêµÁ");
4438 name = ((a < 16) ? color_names[a] : "undefined");
4442 /* Describe the color */
4444 Term_putstr(5, 10, -1, TERM_WHITE,
4445 format("¥«¥é¡¼ = %d, ̾Á° = %s", a, name));
4447 Term_putstr(5, 10, -1, TERM_WHITE,
4448 format("Color = %d, Name = %s", a, name));
4452 /* Label the Current values */
4453 Term_putstr(5, 12, -1, TERM_WHITE,
4454 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
4455 angband_color_table[a][0],
4456 angband_color_table[a][1],
4457 angband_color_table[a][2],
4458 angband_color_table[a][3]));
4462 Term_putstr(0, 14, -1, TERM_WHITE,
4463 "¥³¥Þ¥ó¥É (n/N/k/K/r/R/g/G/b/B): ");
4465 Term_putstr(0, 14, -1, TERM_WHITE,
4466 "Command (n/N/k/K/r/R/g/G/b/B): ");
4474 if (i == ESCAPE) break;
4477 if (i == 'n') a = (byte)(a + 1);
4478 if (i == 'N') a = (byte)(a - 1);
4479 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
4480 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
4481 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
4482 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
4483 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
4484 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
4485 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
4486 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
4488 /* Hack -- react to changes */
4489 Term_xtra(TERM_XTRA_REACT, 0);
4491 /* Hack -- redraw */
4498 /* Unknown option */
4504 /* Flush messages */
4509 /* Restore the screen */
4515 * Note something in the message recall
4517 void do_cmd_note(void)
4526 if (!get_string("¥á¥â: ", buf, 60)) return;
4528 if (!get_string("Note: ", buf, 60)) return;
4532 /* Ignore empty notes */
4533 if (!buf[0] || (buf[0] == ' ')) return;
4535 /* Add the note to the message recall */
4537 msg_format("¥á¥â: %s", buf);
4539 msg_format("Note: %s", buf);
4546 * Mention the current version
4548 void do_cmd_version(void)
4553 msg_format("ÊѶòÈÚÅÜ(Hengband) %d.%d.%d",
4554 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4556 msg_format("You are playing Hengband %d.%d.%d.",
4557 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
4564 * Array of feeling strings
4566 static cptr do_cmd_feeling_text[11] =
4569 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4571 "Looks like any other level.",
4575 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4577 "You feel there is something special about this level.",
4581 "¶²¤í¤·¤¤»à¤Î¸¸¤¬ÌܤËÉ⤫¤Ó¡¢µ¤À䤷¤½¤¦¤Ë¤Ê¤Ã¤¿¡ª",
4583 "You nearly faint as horrible visions of death fill your mind!",
4587 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4589 "This level looks very dangerous.",
4593 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4595 "You have a very bad feeling...",
4599 "°¤¤Í½´¶¤¬¤¹¤ë...",
4601 "You have a bad feeling...",
4607 "You feel nervous.",
4611 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4613 "You feel your luck is turning...",
4617 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4619 "You don't like the look of this place.",
4623 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4625 "This level looks reasonably safe.",
4629 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4631 "What a boring place..."
4636 static cptr do_cmd_feeling_text_combat[11] =
4639 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4641 "Looks like any other level.",
4645 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4647 "You feel there is something special about this level.",
4651 "º£Ìë¤â¤Þ¤¿¡¢Ã¯¤«¤¬Ì¿¤òÍî¤È¤¹...",
4653 "You nearly faint as horrible visions of death fill your mind!",
4657 "¤³¤Î³¬¤Ï¤È¤Æ¤â´í¸±¤Ê¤è¤¦¤À¡£",
4659 "This level looks very dangerous.",
4663 "¤È¤Æ¤â°¤¤Í½´¶¤¬¤¹¤ë...",
4665 "You have a very bad feeling...",
4669 "°¤¤Í½´¶¤¬¤¹¤ë...",
4671 "You have a bad feeling...",
4677 "You feel nervous.",
4681 "¾¯¤·ÉÔ±¿¤Êµ¤¤¬¤¹¤ë...",
4683 "You feel your luck is turning...",
4687 "¤³¤Î¾ì½ê¤Ï¹¥¤¤Ë¤Ê¤ì¤Ê¤¤¡£",
4689 "You don't like the look of this place.",
4693 "¤³¤Î³¬¤Ï¤½¤ì¤Ê¤ê¤Ë°ÂÁ´¤Ê¤è¤¦¤À¡£",
4695 "This level looks reasonably safe.",
4699 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4701 "What a boring place..."
4706 static cptr do_cmd_feeling_text_lucky[11] =
4709 "¤³¤Î³¬¤ÎÊ·°Ïµ¤¤ò´¶¤¸¤È¤ì¤Ê¤«¤Ã¤¿...",
4710 "¤³¤Î³¬¤Ë¤Ï²¿¤«ÆÃÊ̤ʤâ¤Î¤¬¤¢¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£",
4711 "¤³¤Î³¬¤Ï¤³¤Î¾å¤Ê¤¯ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë¡£",
4712 "ÁÇÀ²¤é¤·¤¤´¶¤¸¤¬¤¹¤ë...",
4713 "¤È¤Æ¤âÎɤ¤´¶¤¸¤¬¤¹¤ë...",
4714 "Îɤ¤´¶¤¸¤¬¤¹¤ë...",
4715 "¤Á¤ç¤Ã¤È¹¬±¿¤Ê´¶¤¸¤¬¤¹¤ë...",
4716 "¿¾¯¤Ï±¿¤¬¸þ¤¤¤Æ¤¤¿¤«...",
4717 "¸«¤¿´¶¤¸°¤¯¤Ï¤Ê¤¤...",
4718 "Á´Á³ÂÌÌܤȤ¤¤¦¤³¤È¤Ï¤Ê¤¤¤¬...",
4719 "¤Ê¤ó¤ÆÂà¶þ¤Ê¤È¤³¤í¤À..."
4721 "Looks like any other level.",
4722 "You feel there is something special about this level.",
4723 "You have a superb feeling about this level.",
4724 "You have an excellent feeling...",
4725 "You have a very good feeling...",
4726 "You have a good feeling...",
4727 "You feel strangely lucky...",
4728 "You feel your luck is turning...",
4729 "You like the look of this place...",
4730 "This level can't be all bad...",
4731 "What a boring place..."
4737 * Note that "feeling" is set to zero unless some time has passed.
4738 * Note that this is done when the level is GENERATED, not entered.
4740 void do_cmd_feeling(void)
4742 /* Verify the feeling */
4743 if (feeling > 10) feeling = 10;
4745 /* No useful feeling in quests */
4746 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4749 msg_print("ŵ·¿Åª¤Ê¥¯¥¨¥¹¥È¤Î¥À¥ó¥¸¥ç¥ó¤Î¤è¤¦¤À¡£");
4751 msg_print("Looks like a typical quest level.");
4757 /* No useful feeling in town */
4758 else if (p_ptr->town_num && !dun_level)
4761 if (!strcmp(town[p_ptr->town_num].name, "¹ÓÌî"))
4763 if (!strcmp(town[p_ptr->town_num].name, "wilderness"))
4767 msg_print("²¿¤«¤¢¤ê¤½¤¦¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4769 msg_print("Looks like a strange wilderness.");
4777 msg_print("ŵ·¿Åª¤ÊÄ®¤Î¤è¤¦¤À¡£");
4779 msg_print("Looks like a typical town.");
4786 /* No useful feeling in the wilderness */
4787 else if (!dun_level)
4790 msg_print("ŵ·¿Åª¤Ê¹ÓÌî¤Î¤è¤¦¤À¡£");
4792 msg_print("Looks like a typical wilderness.");
4798 /* Display the feeling */
4799 if (turn - old_turn >= (150 - dun_level)*TURNS_PER_TICK || cheat_xtra)
4801 if (p_ptr->muta3 & MUT3_GOOD_LUCK) msg_print(do_cmd_feeling_text_lucky[feeling]);
4803 if((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)){
4804 msg_print(do_cmd_feeling_text_combat[feeling]);
4806 msg_print(do_cmd_feeling_text[feeling]);
4811 msg_print(do_cmd_feeling_text[0]);
4818 * Description of each monster group.
4820 static cptr monster_group_text[] =
4823 "¥æ¥Ë¡¼¥¯", /* "Uniques" */
4852 /* "¸ÅÂå¥É¥é¥´¥ó/¥ï¥¤¥¢¡¼¥à", */
4869 /* "¾åµé¥Ç¡¼¥â¥ó", */
4909 /* "Ancient Dragon/Wyrm", */
4918 "Multi-Headed Reptile",
4923 "Reptile/Amphibian",
4924 "Spider/Scorpion/Tick",
4926 /* "Major Demon", */
4942 * Symbols of monsters in each group. Note the "Uniques" group
4943 * is handled differently.
4945 static cptr monster_group_char[] =
4999 "$!?=&`.|/\\~[]()>",
5008 * hook function to sort monsters by level
5010 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
5012 u16b *who = (u16b*)(u);
5017 monster_race *r_ptr1 = &r_info[w1];
5018 monster_race *r_ptr2 = &r_info[w2];
5023 if (r_ptr2->level > r_ptr1->level) return TRUE;
5024 if (r_ptr1->level > r_ptr2->level) return FALSE;
5026 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
5027 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
5032 * Build a list of monster indexes in the given group. Return the number
5033 * of monsters in the group.
5035 * mode & 0x01 : check for non-empty group
5036 * mode & 0x02 : cheat?
5038 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
5043 /* Get a list of x_char in this group */
5044 cptr group_char = monster_group_char[grp_cur];
5046 /* XXX Hack -- Check if this is the "Uniques" group */
5047 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
5049 /* Check every race */
5050 for (i = 0; i < max_r_idx; i++)
5052 /* Access the race */
5053 monster_race *r_ptr = &r_info[i];
5055 /* Skip empty race */
5056 if (!r_ptr->name) continue ;
5058 /* Require known monsters */
5059 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights ) continue;
5061 if (grp_unique && !(r_ptr->flags1 & RF1_UNIQUE)) continue;
5063 /* Check for race in the group */
5064 if (grp_unique || strchr(group_char, r_ptr->d_char))
5067 mon_idx[mon_cnt++] = i;
5069 /* XXX Hack -- Just checking for non-empty group */
5070 if (mode & 0x01) break;
5074 /* Terminate the list */
5075 mon_idx[mon_cnt] = 0;
5077 /* Select the sort method */
5078 ang_sort_comp = ang_sort_comp_monster_level;
5079 ang_sort_swap = ang_sort_swap_hook;
5081 /* Sort by monster level */
5082 ang_sort(mon_idx, &dummy_why, mon_cnt);
5084 /* Return the number of races */
5090 * Description of each monster group.
5092 static cptr object_group_text[] =
5095 "¥¥Î¥³", /* "Mushrooms" */
5096 "Ìô", /* "Potions" */
5097 "Ìý¤Ä¤Ü", /* "Flasks" */
5098 "´¬Êª", /* "Scrolls" */
5099 "»ØÎØ", /* "Rings" */
5100 "¥¢¥ß¥å¥ì¥Ã¥È", /* "Amulets" */
5101 "ū", /* "Whistle" */
5102 "¸÷¸»", /* "Lanterns" */
5103 "ËâË¡ËÀ", /* "Wands" */
5104 "¾ó", /* "Staffs" */
5105 "¥í¥Ã¥É", /* "Rods" */
5106 "¥«¡¼¥É", /* "Cards" */
5107 "¥¥ã¥×¥Á¥ã¡¼¡¦¥Ü¡¼¥ë",
5116 "Åá·õÎà", /* "Swords" */
5117 "Æß´ï", /* "Blunt Weapons" */
5118 "ĹÊÁÉð´ï", /* "Polearms" */
5119 "ºÎ·¡Æ»¶ñ", /* "Diggers" */
5120 "Èô¤ÓÆ»¶ñ", /* "Bows" */
5124 "·ÚÁõ³»", /* "Soft Armor" */
5125 "½ÅÁõ³»", /* "Hard Armor" */
5126 "¥É¥é¥´¥ó³»", /* "Dragon Armor" */
5127 "½â", /* "Shields" */
5128 "¥¯¥í¡¼¥¯", /* "Cloaks" */
5129 "äƼê", /* "Gloves" */
5130 "¥Ø¥ë¥á¥Ã¥È", /* "Helms" */
5131 "´§", /* "Crowns" */
5132 "¥Ö¡¼¥Ä", /* "Boots" */
5180 * TVALs of items in each group
5182 static byte object_group_tval[] =
5222 TV_LIFE_BOOK, /* Hack -- all spellbooks */
5228 * Build a list of monster indexes in the given group. Return the number
5229 * of monsters in the group.
5231 static int collect_objects(int grp_cur, int object_idx[])
5233 int i, j, k, object_cnt = 0;
5235 /* Get a list of x_char in this group */
5236 byte group_tval = object_group_tval[grp_cur];
5238 /* Check every object */
5239 for (i = 0; i < max_k_idx; i++)
5241 /* Access the race */
5242 object_kind *k_ptr = &k_info[i];
5244 /* Skip empty objects */
5245 if (!k_ptr->name) continue;
5247 /* Skip non-flavoured objects */
5248 if (!k_ptr->flavor && !p_ptr->wizard) continue;
5250 /* Skip items with no distribution (special artifacts) */
5251 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
5254 /* Require objects ever seen*/
5255 if (!k_ptr->aware && !p_ptr->wizard) continue;
5257 /* Check for race in the group */
5258 if (TV_LIFE_BOOK == group_tval)
5260 /* Hack -- All spell books */
5261 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HISSATSU_BOOK)
5264 object_idx[object_cnt++] = i;
5267 else if (k_ptr->tval == group_tval)
5270 object_idx[object_cnt++] = i;
5274 /* Terminate the list */
5275 object_idx[object_cnt] = 0;
5277 /* Return the number of races */
5283 * Description of each feature group.
5285 static cptr feature_group_text[] =
5293 * Build a list of feature indexes in the given group. Return the number
5294 * of features in the group.
5296 static int collect_features(int grp_cur, int *feat_idx)
5298 int i, feat_cnt = 0;
5300 /* Unused; There is a single group. */
5303 /* Check every feature */
5304 for (i = 1; i < max_f_idx; i++)
5306 /* Access the index */
5307 feature_type *f_ptr = &f_info[i];
5309 /* Skip empty index */
5310 if (!f_ptr->name) continue;
5312 /* Skip mimiccing features */
5313 if (f_ptr->mimic != i) continue;
5316 feat_idx[feat_cnt++] = i;
5319 /* Terminate the list */
5320 feat_idx[feat_cnt] = 0;
5322 /* Return the number of races */
5329 * Build a list of monster indexes in the given group. Return the number
5330 * of monsters in the group.
5332 static int collect_artifacts(int grp_cur, int object_idx[])
5334 int i, object_cnt = 0;
5336 /* Get a list of x_char in this group */
5337 byte group_tval = object_group_tval[grp_cur];
5339 /* Check every object */
5340 for (i = 0; i < max_a_idx; i++)
5342 /* Access the artifact */
5343 artifact_type *a_ptr = &a_info[i];
5345 /* Skip empty artifacts */
5346 if (!a_ptr->name) continue;
5348 /* Skip "uncreated" artifacts */
5349 if (!a_ptr->cur_num) continue;
5351 /* Check for race in the group */
5352 if (a_ptr->tval == group_tval)
5355 object_idx[object_cnt++] = i;
5359 /* Terminate the list */
5360 object_idx[object_cnt] = 0;
5362 /* Return the number of races */
5369 * Encode the screen colors
5371 static char hack[17] = "dwsorgbuDWvyRGBU";
5374 static errr photo_fgets(FILE *fff, char *buf, huge n)
5383 if (fgets(tmp, 1024, fff))
5385 /* Convert weirdness */
5386 for (s = tmp; *s; s++)
5388 /* Handle newline */
5399 else if (*s == '\t')
5401 /* Hack -- require room */
5402 if (i + 8 >= n) break;
5404 /* Append a space */
5407 /* Append some more spaces */
5408 while (!(i % 8)) buf[i++] = ' ';
5412 else if (iskanji(*s))
5419 /* Ⱦ³Ñ¤«¤Ê¤ËÂбþ */
5420 else if ((((int)*s & 0xff) > 0xa1) && (((int)*s & 0xff ) < 0xdf))
5427 /* Handle printables */
5448 * Hack -- load a screen dump from a file
5450 void do_cmd_load_screen(void)
5465 Term_get_size(&wid, &hgt);
5467 /* Build the filename */
5468 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5470 /* Append to the file */
5471 fff = my_fopen(buf, "r");
5476 msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
5478 msg_format("Failed to open %s.", buf);
5485 /* Save the screen */
5488 /* Clear the screen */
5492 /* Load the screen */
5493 for (y = 0; okay && (y < hgt); y++)
5495 /* Get a line of data */
5496 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5499 for (x = 0; x < wid - 1; x++)
5501 /* Put the attr/char */
5502 Term_draw(x, y, TERM_WHITE, buf[x]);
5506 /* Get the blank line */
5507 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5510 /* Dump the screen */
5511 for (y = 0; okay && (y < hgt); y++)
5513 /* Get a line of data */
5514 if (photo_fgets(fff, buf, 1024)) okay = FALSE;
5517 for (x = 0; x < wid - 1; x++)
5519 /* Get the attr/char */
5520 (void)(Term_what(x, y, &a, &c));
5522 /* Look up the attr */
5523 for (i = 0; i < 16; i++)
5525 /* Use attr matches */
5526 if (hack[i] == buf[x]) a = i;
5529 /* Put the attr/char */
5530 Term_draw(x, y, a, c);
5535 /* Get the blank line */
5536 if (my_fgets(fff, buf, sizeof(buf))) okay = FALSE;
5545 prt("¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤¿²èÌÌ(µÇ°»£±Æ)¤ò¥í¡¼¥É¤·¤Þ¤·¤¿¡£", 0, 0);
5547 msg_print("Screen dump loaded.");
5554 /* Restore the screen */
5561 cptr inven_res_label =
5563 " »ÀÅŲÐÎäÆǸ÷°ÇÇ˹ì¹ö°øÆÙÎô ÌÕÉÝÍðáãÆ©Ì¿´¶¾ÃÉüÉâ";
5565 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv";
5568 /* XTRA HACK RESLIST */
5569 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr,
5570 int *j, byte tval, char *where)
5572 char o_name[MAX_NLEN];
5573 u32b flgs[TR_FLAG_SIZE];
5575 if (!o_ptr->k_idx)return;
5576 if (o_ptr->tval != tval)return;
5579 * HACK:Ring of Lordly protection and Dragon shield/helm
5580 * have random resistances.
5582 if ( ((o_ptr->tval >= TV_BOW && o_ptr->tval<= TV_DRAG_ARMOR && o_ptr->name2)
5583 || (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_LORDLY)
5584 || (o_ptr->tval == TV_SHIELD && o_ptr->sval == SV_DRAGON_SHIELD)
5585 || (o_ptr->tval == TV_HELM && o_ptr->sval == SV_DRAGON_HELM)
5586 || (o_ptr->tval == TV_GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)
5587 || (o_ptr->tval == TV_BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)
5588 || o_ptr->art_name || o_ptr->name1) && object_known_p(o_ptr))
5591 object_desc(o_name, o_ptr, TRUE, 0);
5593 while ( o_name[i] && i < 26 ){
5595 if (iskanji(o_name[i])) i++;
5599 if(i<28) while(i<28){o_name[i]=' ';i++;}
5602 fprintf(fff,"%s %s", where, o_name);
5604 if (!(o_ptr->ident & (IDENT_MENTAL)))
5607 fprintf(fff, "-------ÉÔÌÀ--------------- -------ÉÔÌÀ---------\n");
5609 fprintf(fff, "-------unknown------------ -------unknown------\n");
5613 object_flags_known(o_ptr, flgs);
5616 if (have_flag(flgs, TR_IM_ACID)) fprintf(fff,"¡ö");
5617 else if (have_flag(flgs, TR_RES_ACID)) fprintf(fff,"¡Ü");
5618 else fprintf(fff,"¡¦");
5620 if (have_flag(flgs, TR_IM_ELEC)) fprintf(fff,"¡ö");
5621 else if (have_flag(flgs, TR_RES_ELEC)) fprintf(fff,"¡Ü");
5622 else fprintf(fff,"¡¦");
5624 if (have_flag(flgs, TR_IM_FIRE)) fprintf(fff,"¡ö");
5625 else if (have_flag(flgs, TR_RES_FIRE)) fprintf(fff,"¡Ü");
5626 else fprintf(fff,"¡¦");
5628 if (have_flag(flgs, TR_IM_COLD)) fprintf(fff,"¡ö");
5629 else if (have_flag(flgs, TR_RES_COLD)) fprintf(fff,"¡Ü");
5630 else fprintf(fff,"¡¦");
5632 if (have_flag(flgs, TR_RES_POIS)) fprintf(fff,"¡Ü");
5633 else fprintf(fff,"¡¦");
5635 if (have_flag(flgs, TR_RES_LITE)) fprintf(fff,"¡Ü");
5636 else fprintf(fff,"¡¦");
5638 if (have_flag(flgs, TR_RES_DARK)) fprintf(fff,"¡Ü");
5639 else fprintf(fff,"¡¦");
5641 if (have_flag(flgs, TR_RES_SHARDS)) fprintf(fff,"¡Ü");
5642 else fprintf(fff,"¡¦");
5644 if (have_flag(flgs, TR_RES_SOUND)) fprintf(fff,"¡Ü");
5645 else fprintf(fff,"¡¦");
5647 if (have_flag(flgs, TR_RES_NETHER)) fprintf(fff,"¡Ü");
5648 else fprintf(fff,"¡¦");
5650 if (have_flag(flgs, TR_RES_NEXUS)) fprintf(fff,"¡Ü");
5651 else fprintf(fff,"¡¦");
5653 if (have_flag(flgs, TR_RES_CHAOS)) fprintf(fff,"¡Ü");
5654 else fprintf(fff,"¡¦");
5656 if (have_flag(flgs, TR_RES_DISEN)) fprintf(fff,"¡Ü");
5657 else fprintf(fff,"¡¦");
5661 if (have_flag(flgs, TR_RES_BLIND)) fprintf(fff,"¡Ü");
5662 else fprintf(fff,"¡¦");
5664 if (have_flag(flgs, TR_RES_FEAR)) fprintf(fff,"¡Ü");
5665 else fprintf(fff,"¡¦");
5667 if (have_flag(flgs, TR_RES_CONF)) fprintf(fff,"¡Ü");
5668 else fprintf(fff,"¡¦");
5670 if (have_flag(flgs, TR_FREE_ACT)) fprintf(fff,"¡Ü");
5671 else fprintf(fff,"¡¦");
5673 if (have_flag(flgs, TR_SEE_INVIS)) fprintf(fff,"¡Ü");
5674 else fprintf(fff,"¡¦");
5676 if (have_flag(flgs, TR_HOLD_LIFE)) fprintf(fff,"¡Ü");
5677 else fprintf(fff,"¡¦");
5679 if (have_flag(flgs, TR_TELEPATHY)) fprintf(fff,"¡Ü");
5680 else fprintf(fff,"¡¦");
5682 if (have_flag(flgs, TR_SLOW_DIGEST)) fprintf(fff,"¡Ü");
5683 else fprintf(fff,"¡¦");
5686 if (have_flag(flgs, TR_REGEN)) fprintf(fff,"¡Ü");
5687 else fprintf(fff,"¡¦");
5689 if (have_flag(flgs, TR_FEATHER)) fprintf(fff,"¡Ü");
5690 else fprintf(fff,"¡¦");
5692 if (have_flag(flgs, TR_IM_ACID)) fprintf(fff,"* ");
5693 else if (have_flag(flgs, TR_RES_ACID)) fprintf(fff,"+ ");
5694 else fprintf(fff,". ");
5696 if (have_flag(flgs, TR_IM_ELEC)) fprintf(fff,"* ");
5697 else if (have_flag(flgs, TR_RES_ELEC)) fprintf(fff,"+ ");
5698 else fprintf(fff,". ");
5700 if (have_flag(flgs, TR_IM_FIRE)) fprintf(fff,"* ");
5701 else if (have_flag(flgs, TR_RES_FIRE)) fprintf(fff,"+ ");
5702 else fprintf(fff,". ");
5704 if (have_flag(flgs, TR_IM_COLD)) fprintf(fff,"* ");
5705 else if (have_flag(flgs, TR_RES_COLD)) fprintf(fff,"+ ");
5706 else fprintf(fff,". ");
5708 if (have_flag(flgs, TR_RES_POIS)) fprintf(fff,"+ ");
5709 else fprintf(fff,". ");
5711 if (have_flag(flgs, TR_RES_LITE)) fprintf(fff,"+ ");
5712 else fprintf(fff,". ");
5714 if (have_flag(flgs, TR_RES_DARK)) fprintf(fff,"+ ");
5715 else fprintf(fff,". ");
5717 if (have_flag(flgs, TR_RES_SHARDS)) fprintf(fff,"+ ");
5718 else fprintf(fff,". ");
5720 if (have_flag(flgs, TR_RES_SOUND)) fprintf(fff,"+ ");
5721 else fprintf(fff,". ");
5723 if (have_flag(flgs, TR_RES_NETHER)) fprintf(fff,"+ ");
5724 else fprintf(fff,". ");
5726 if (have_flag(flgs, TR_RES_NEXUS)) fprintf(fff,"+ ");
5727 else fprintf(fff,". ");
5729 if (have_flag(flgs, TR_RES_CHAOS)) fprintf(fff,"+ ");
5730 else fprintf(fff,". ");
5732 if (have_flag(flgs, TR_RES_DISEN)) fprintf(fff,"+ ");
5733 else fprintf(fff,". ");
5737 if (have_flag(flgs, TR_RES_BLIND)) fprintf(fff,"+ ");
5738 else fprintf(fff,". ");
5740 if (have_flag(flgs, TR_RES_FEAR)) fprintf(fff,"+ ");
5741 else fprintf(fff,". ");
5743 if (have_flag(flgs, TR_RES_CONF)) fprintf(fff,"+ ");
5744 else fprintf(fff,". ");
5746 if (have_flag(flgs, TR_FREE_ACT)) fprintf(fff,"+ ");
5747 else fprintf(fff,". ");
5749 if (have_flag(flgs, TR_SEE_INVIS)) fprintf(fff,"+ ");
5750 else fprintf(fff,". ");
5752 if (have_flag(flgs, TR_HOLD_LIFE)) fprintf(fff,"+ ");
5753 else fprintf(fff,". ");
5755 if (have_flag(flgs, TR_TELEPATHY)) fprintf(fff,"+ ");
5756 else fprintf(fff,". ");
5758 if (have_flag(flgs, TR_SLOW_DIGEST)) fprintf(fff,"+ ");
5759 else fprintf(fff,". ");
5762 if (have_flag(flgs, TR_REGEN)) fprintf(fff,"+ ");
5763 else fprintf(fff,". ");
5765 if (have_flag(flgs, TR_FEATHER)) fprintf(fff,"+ ");
5766 else fprintf(fff,". ");
5774 fprintf(fff,"%s\n", inven_res_label);
5780 * Display *ID* ed weapons/armors's resistances
5782 static void do_cmd_knowledge_inven(void)
5787 char file_name[1024];
5798 /* Open a new file */
5799 fff = my_fopen_temp(file_name, 1024);
5802 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
5804 msg_format("Failed to create temporary file %s.", file_name);
5809 fprintf(fff,"%s\n",inven_res_label);
5811 for (tval=TV_BOW; tval <= TV_RING; tval++){
5814 for (;j<9;j++) fprintf(fff, "\n");
5816 fprintf(fff,"%s\n",inven_res_label);
5820 strcpy(where, "Áõ");
5822 strcpy(where, "E ");
5824 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
5826 o_ptr = &inventory[i];
5827 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5831 strcpy(where, "»ý");
5833 strcpy(where, "I ");
5835 for (i = 0; i < INVEN_PACK; i++)
5837 o_ptr = &inventory[i];
5838 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5842 /* Print all homes in the different towns */
5843 st_ptr = &town[1].store[STORE_HOME];
5845 strcpy(where, "²È");
5847 strcpy(where, "H ");
5850 /* Dump all available items */
5851 for (i = 0; i < st_ptr->stock_num; i++)
5853 o_ptr = &st_ptr->stock[i];
5854 do_cmd_knowledge_inven_aux(fff, o_ptr, &j, tval, where);
5858 /* Close the file */
5861 /* Display the file contents */
5863 show_file(TRUE, file_name, "*´ÕÄê*ºÑ¤ßÉð´ï/Ëɶñ¤ÎÂÑÀ¥ê¥¹¥È", 0, 0);
5865 show_file(TRUE, file_name, "Resistances of *identified* equipment", 0, 0);
5868 /* Remove the file */
5873 void do_cmd_save_screen_html_aux(char *filename, int message)
5877 byte a = 0, old_a = 0;
5891 cptr html_head[] = {
5892 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5896 cptr html_foot[] = {
5898 "</body>\n</html>\n",
5904 Term_get_size(&wid, &hgt);
5906 /* File type is "TEXT" */
5907 FILE_TYPE(FILE_TYPE_TEXT);
5909 /* Append to the file */
5910 fff = my_fopen(filename, "w");
5916 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", filename);
5918 msg_format("Failed to open file %s.", filename);
5926 /* Save the screen */
5930 /* Build the filename */
5931 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5932 tmpfff = my_fopen(buf, "r");
5934 for (i = 0; html_head[i]; i++)
5935 fprintf(fff, html_head[i]);
5939 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5941 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
5945 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
5947 fprintf(fff, "%s\n", buf);
5952 /* Dump the screen */
5953 for (y = 0; y < hgt; y++)
5960 for (x = 0; x < wid - 1; x++)
5964 /* Get the attr/char */
5965 (void)(Term_what(x, y, &a, &c));
5969 case '&': cc = "&"; break;
5970 case '<': cc = "<"; break;
5971 case '>': cc = ">"; break;
5973 case 0x1f: c = '.'; break;
5974 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5979 if ((y == 0 && x == 0) || a != old_a) {
5980 rv = angband_color_table[a][1];
5981 gv = angband_color_table[a][2];
5982 bv = angband_color_table[a][3];
5983 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5984 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5988 fprintf(fff, "%s", cc);
5990 fprintf(fff, "%c", c);
5993 fprintf(fff, "</font>");
5996 for (i = 0; html_foot[i]; i++)
5997 fprintf(fff, html_foot[i]);
6002 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
6004 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
6008 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
6010 fprintf(fff, "%s\n", buf);
6025 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6027 msg_print("Screen dump saved.");
6032 /* Restore the screen */
6038 * Hack -- save a screen dump to a file
6040 static void do_cmd_save_screen_html(void)
6042 char buf[1024], tmp[256] = "screen.html";
6045 if (!get_string("¥Õ¥¡¥¤¥ë̾: ", tmp, 80))
6047 if (!get_string("File name: ", tmp, 80))
6051 /* Build the filename */
6052 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
6056 do_cmd_save_screen_html_aux(buf, 1);
6061 * Redefinable "save_screen" action
6063 void (*screendump_aux)(void) = NULL;
6067 * Hack -- save a screen dump to a file
6069 void do_cmd_save_screen(void)
6071 bool old_use_graphics = use_graphics;
6072 bool html_dump = FALSE;
6077 prt("µÇ°»£±Æ¤·¤Þ¤¹¤«¡© [(y)es/(h)tml/(n)o] ", 0, 0);
6079 prt("Save screen dump? [(y)es/(h)tml/(n)o] ", 0, 0);
6084 if (c == 'Y' || c == 'y')
6086 else if (c == 'H' || c == 'h')
6098 Term_get_size(&wid, &hgt);
6100 if (old_use_graphics)
6102 use_graphics = FALSE;
6105 /* Redraw everything */
6106 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6108 /* Hack -- update */
6114 do_cmd_save_screen_html();
6118 /* Do we use a special screendump function ? */
6119 else if (screendump_aux)
6121 /* Dump the screen to a graphics file */
6122 (*screendump_aux)();
6124 else /* Dump the screen as text */
6135 /* Build the filename */
6136 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
6138 /* File type is "TEXT" */
6139 FILE_TYPE(FILE_TYPE_TEXT);
6141 /* Append to the file */
6142 fff = my_fopen(buf, "w");
6148 msg_format("¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿¡£", buf);
6150 msg_format("Failed to open file %s.", buf);
6157 /* Save the screen */
6161 /* Dump the screen */
6162 for (y = 0; y < hgt; y++)
6165 for (x = 0; x < wid - 1; x++)
6167 /* Get the attr/char */
6168 (void)(Term_what(x, y, &a, &c));
6178 fprintf(fff, "%s\n", buf);
6185 /* Dump the screen */
6186 for (y = 0; y < hgt; y++)
6189 for (x = 0; x < wid - 1; x++)
6191 /* Get the attr/char */
6192 (void)(Term_what(x, y, &a, &c));
6195 buf[x] = hack[a&0x0F];
6202 fprintf(fff, "%s\n", buf);
6214 msg_print("²èÌÌ(µÇ°»£±Æ)¤ò¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤·¤Þ¤·¤¿¡£");
6216 msg_print("Screen dump saved.");
6222 /* Restore the screen */
6226 if (old_use_graphics)
6228 use_graphics = TRUE;
6231 /* Redraw everything */
6232 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
6234 /* Hack -- update */
6241 * Sorting hook -- Comp function -- see below
6243 * We use "u" to point to array of monster indexes,
6244 * and "v" to select the type of sorting to perform on "u".
6246 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
6248 u16b *who = (u16b*)(u);
6250 u16b *why = (u16b*)(v);
6257 /* Sort by total kills */
6260 /* Extract total kills */
6261 z1 = a_info[w1].tval;
6262 z2 = a_info[w2].tval;
6264 /* Compare total kills */
6265 if (z1 < z2) return (TRUE);
6266 if (z1 > z2) return (FALSE);
6270 /* Sort by monster level */
6273 /* Extract levels */
6274 z1 = a_info[w1].sval;
6275 z2 = a_info[w2].sval;
6277 /* Compare levels */
6278 if (z1 < z2) return (TRUE);
6279 if (z1 > z2) return (FALSE);
6283 /* Sort by monster experience */
6286 /* Extract experience */
6287 z1 = a_info[w1].level;
6288 z2 = a_info[w2].level;
6290 /* Compare experience */
6291 if (z1 < z2) return (TRUE);
6292 if (z1 > z2) return (FALSE);
6296 /* Compare indexes */
6302 * Sorting hook -- Swap function -- see below
6304 * We use "u" to point to array of monster indexes,
6305 * and "v" to select the type of sorting to perform.
6307 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
6309 u16b *who = (u16b*)(u);
6324 * Check the status of "artifacts"
6326 static void do_cmd_knowledge_artifacts(void)
6328 int i, k, z, x, y, n = 0;
6334 char file_name[1024];
6336 char base_name[MAX_NLEN];
6340 /* Open a new file */
6341 fff = my_fopen_temp(file_name, 1024);
6345 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6347 msg_format("Failed to create temporary file %s.", file_name);
6353 /* Allocate the "who" array */
6354 C_MAKE(who, max_a_idx, s16b);
6356 /* Allocate the "okay" array */
6357 C_MAKE(okay, max_a_idx, bool);
6359 /* Scan the artifacts */
6360 for (k = 0; k < max_a_idx; k++)
6362 artifact_type *a_ptr = &a_info[k];
6367 /* Skip "empty" artifacts */
6368 if (!a_ptr->name) continue;
6370 /* Skip "uncreated" artifacts */
6371 if (!a_ptr->cur_num) continue;
6377 /* Check the dungeon */
6378 for (y = 0; y < cur_hgt; y++)
6380 for (x = 0; x < cur_wid; x++)
6382 cave_type *c_ptr = &cave[y][x];
6384 s16b this_o_idx, next_o_idx = 0;
6386 /* Scan all objects in the grid */
6387 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
6391 /* Acquire object */
6392 o_ptr = &o_list[this_o_idx];
6394 /* Acquire next object */
6395 next_o_idx = o_ptr->next_o_idx;
6397 /* Ignore non-artifacts */
6398 if (!artifact_p(o_ptr)) continue;
6400 /* Ignore known items */
6401 if (object_known_p(o_ptr)) continue;
6403 /* Note the artifact */
6404 okay[o_ptr->name1] = FALSE;
6409 /* Check the inventory and equipment */
6410 for (i = 0; i < INVEN_TOTAL; i++)
6412 object_type *o_ptr = &inventory[i];
6414 /* Ignore non-objects */
6415 if (!o_ptr->k_idx) continue;
6417 /* Ignore non-artifacts */
6418 if (!artifact_p(o_ptr)) continue;
6420 /* Ignore known items */
6421 if (object_known_p(o_ptr)) continue;
6423 /* Note the artifact */
6424 okay[o_ptr->name1] = FALSE;
6427 for (k = 0; k < max_a_idx; k++)
6429 if (okay[k]) who[n++] = k;
6432 /* Select the sort method */
6433 ang_sort_comp = ang_sort_art_comp;
6434 ang_sort_swap = ang_sort_art_swap;
6436 /* Sort the array by dungeon depth of monsters */
6437 ang_sort(who, &why, n);
6439 /* Scan the artifacts */
6440 for (k = 0; k < n; k++)
6442 artifact_type *a_ptr = &a_info[who[k]];
6446 strcpy(base_name, "̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à");
6448 strcpy(base_name, "Unknown Artifact");
6452 /* Obtain the base object type */
6453 z = lookup_kind(a_ptr->tval, a_ptr->sval);
6461 /* Get local object */
6464 /* Create fake object */
6465 object_prep(q_ptr, z);
6467 /* Make it an artifact */
6468 q_ptr->name1 = (byte)who[k];
6470 /* Describe the artifact */
6471 object_desc_store(base_name, q_ptr, FALSE, 0);
6474 /* Hack -- Build the artifact name */
6476 fprintf(fff, " %s\n", base_name);
6478 fprintf(fff, " The %s\n", base_name);
6483 /* Free the "who" array */
6484 C_KILL(who, max_a_idx, s16b);
6486 /* Free the "okay" array */
6487 C_KILL(okay, max_a_idx, bool);
6489 /* Close the file */
6492 /* Display the file contents */
6494 show_file(TRUE, file_name, "´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à", 0, 0);
6496 show_file(TRUE, file_name, "Artifacts Seen", 0, 0);
6500 /* Remove the file */
6506 * Display known uniques
6508 static void do_cmd_knowledge_uniques(void)
6516 char file_name[1024];
6518 /* Open a new file */
6519 fff = my_fopen_temp(file_name, 1024);
6523 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6525 msg_format("Failed to create temporary file %s.", file_name);
6531 /* Allocate the "who" array */
6532 C_MAKE(who, max_r_idx, s16b);
6534 /* Scan the monsters */
6535 for (i = 1; i < max_r_idx; i++)
6537 monster_race *r_ptr = &r_info[i];
6539 /* Use that monster */
6540 if (r_ptr->name) who[n++] = i;
6543 /* Select the sort method */
6544 ang_sort_comp = ang_sort_comp_hook;
6545 ang_sort_swap = ang_sort_swap_hook;
6547 /* Sort the array by dungeon depth of monsters */
6548 ang_sort(who, &why, n);
6550 /* Scan the monster races */
6551 for (k = 0; k < n; k++)
6553 monster_race *r_ptr = &r_info[who[k]];
6555 /* Only print Uniques */
6556 if (r_ptr->flags1 & (RF1_UNIQUE))
6558 bool dead = (r_ptr->max_num == 0);
6562 /* Only display "known" uniques */
6563 if (dead || cheat_know || r_ptr->r_sights)
6565 /* Print a message */
6567 fprintf(fff, " %s¤Ï¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¡£\n",
6568 (r_name + r_ptr->name));
6570 fprintf(fff, " %s is alive\n",
6571 (r_name + r_ptr->name));
6578 /* Free the "who" array */
6579 C_KILL(who, max_r_idx, s16b);
6581 /* Close the file */
6584 /* Display the file contents */
6586 show_file(TRUE, file_name, "¤Þ¤ÀÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼", 0, 0);
6588 show_file(TRUE, file_name, "Alive Uniques", 0, 0);
6592 /* Remove the file */
6598 * Display weapon-exp
6600 static void do_cmd_knowledge_weapon_exp(void)
6602 int i, j, num, weapon_exp;
6606 char file_name[1024];
6609 /* Open a new file */
6610 fff = my_fopen_temp(file_name, 1024);
6613 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6615 msg_format("Failed to create temporary file %s.", file_name);
6621 for (i = 0; i < 5; i++)
6623 for (num = 0; num < 64; num++)
6625 for (j = 0; j < max_k_idx; j++)
6627 object_kind *k_ptr = &k_info[j];
6629 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
6631 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
6633 weapon_exp = p_ptr->weapon_exp[4 - i][num];
6635 fprintf(fff, "%-25s ", tmp);
6636 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
6637 else fprintf(fff, " ");
6638 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
6639 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
6647 /* Close the file */
6650 /* Display the file contents */
6652 show_file(TRUE, file_name, "Éð´ï¤Î·Ð¸³ÃÍ", 0, 0);
6654 show_file(TRUE, file_name, "Weapon Proficiency", 0, 0);
6658 /* Remove the file */
6666 static void do_cmd_knowledge_spell_exp(void)
6668 int i = 0, spell_exp, exp_level;
6673 char file_name[1024];
6675 /* Open a new file */
6676 fff = my_fopen_temp(file_name, 1024);
6679 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6681 msg_format("Failed to create temporary file %s.", file_name);
6687 if (p_ptr->realm1 != REALM_NONE)
6690 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
6692 fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
6694 for (i = 0; i < 32; i++)
6696 if (!is_magic(p_ptr->realm1))
6698 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
6702 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
6704 if (s_ptr->slevel >= 99) continue;
6705 spell_exp = p_ptr->spell_exp[i];
6706 exp_level = spell_exp_level(spell_exp);
6707 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm1) - 1][i]);
6708 if (p_ptr->realm1 == REALM_HISSATSU)
6709 fprintf(fff, "[--]");
6712 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
6713 else fprintf(fff, " ");
6714 fprintf(fff, "%s", exp_level_str[exp_level]);
6716 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6721 if (p_ptr->realm2 != REALM_NONE)
6724 fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
6726 fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
6728 for (i = 0; i < 32; i++)
6730 if (!is_magic(p_ptr->realm1))
6732 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
6736 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
6738 if (s_ptr->slevel >= 99) continue;
6740 spell_exp = p_ptr->spell_exp[i + 32];
6741 exp_level = spell_exp_level(spell_exp);
6742 fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm2) - 1][i]);
6743 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
6744 else fprintf(fff, " ");
6745 fprintf(fff, "%s", exp_level_str[exp_level]);
6746 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
6751 /* Close the file */
6754 /* Display the file contents */
6756 show_file(TRUE, file_name, "ËâË¡¤Î·Ð¸³ÃÍ", 0, 0);
6758 show_file(TRUE, file_name, "Spell Proficiency", 0, 0);
6762 /* Remove the file */
6770 static void do_cmd_knowledge_skill_exp(void)
6772 int i = 0, skill_exp;
6776 char file_name[1024];
6778 char skill_name[3][17]={"¥Þ¡¼¥·¥ã¥ë¥¢¡¼¥Ä", "ÆóÅáή ", "¾èÇÏ "};
6780 char skill_name[3][20]={"Martial Arts ", "Dual Wielding ", "Riding "};
6783 /* Open a new file */
6784 fff = my_fopen_temp(file_name, 1024);
6787 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6789 msg_format("Failed to create temporary file %s.", file_name);
6795 for (i = 0; i < 3; i++)
6797 skill_exp = p_ptr->skill_exp[i];
6798 fprintf(fff, "%-20s ", skill_name[i]);
6799 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
6800 else fprintf(fff, " ");
6801 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
6802 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
6806 /* Close the file */
6809 /* Display the file contents */
6811 show_file(TRUE, file_name, "µ»Ç½¤Î·Ð¸³ÃÍ", 0, 0);
6813 show_file(TRUE, file_name, "Miscellaneous Proficiency", 0, 0);
6817 /* Remove the file */
6823 * Pluralize a monster name
6825 void plural_aux(char *Name)
6827 int NameLen = strlen(Name);
6829 if (strstr(Name, "Disembodied hand"))
6831 strcpy(Name, "Disembodied hands that strangled people");
6833 else if (strstr(Name, "Colour out of space"))
6835 strcpy(Name, "Colours out of space");
6837 else if (strstr(Name, "stairway to hell"))
6839 strcpy(Name, "stairways to hell");
6841 else if (strstr(Name, "Dweller on the threshold"))
6843 strcpy(Name, "Dwellers on the threshold");
6845 else if (strstr(Name, " of "))
6847 cptr aider = strstr(Name, " of ");
6858 if (dummy[i-1] == 's')
6860 strcpy(&(dummy[i]), "es");
6865 strcpy(&(dummy[i]), "s");
6868 strcpy(&(dummy[i+1]), aider);
6869 strcpy(Name, dummy);
6871 else if (strstr(Name, "coins"))
6874 strcpy(dummy, "piles of ");
6875 strcat(dummy, Name);
6876 strcpy(Name, dummy);
6879 else if (strstr(Name, "Manes"))
6883 else if (streq(&(Name[NameLen - 2]), "ey"))
6885 strcpy(&(Name[NameLen - 2]), "eys");
6887 else if (Name[NameLen - 1] == 'y')
6889 strcpy(&(Name[NameLen - 1]), "ies");
6891 else if (streq(&(Name[NameLen - 4]), "ouse"))
6893 strcpy(&(Name[NameLen - 4]), "ice");
6895 else if (streq(&(Name[NameLen - 2]), "us"))
6897 strcpy(&(Name[NameLen - 2]), "i");
6899 else if (streq(&(Name[NameLen - 6]), "kelman"))
6901 strcpy(&(Name[NameLen - 6]), "kelmen");
6903 else if (streq(&(Name[NameLen - 8]), "wordsman"))
6905 strcpy(&(Name[NameLen - 8]), "wordsmen");
6907 else if (streq(&(Name[NameLen - 7]), "oodsman"))
6909 strcpy(&(Name[NameLen - 7]), "oodsmen");
6911 else if (streq(&(Name[NameLen - 7]), "eastman"))
6913 strcpy(&(Name[NameLen - 7]), "eastmen");
6915 else if (streq(&(Name[NameLen - 8]), "izardman"))
6917 strcpy(&(Name[NameLen - 8]), "izardmen");
6919 else if (streq(&(Name[NameLen - 5]), "geist"))
6921 strcpy(&(Name[NameLen - 5]), "geister");
6923 else if (streq(&(Name[NameLen - 2]), "ex"))
6925 strcpy(&(Name[NameLen - 2]), "ices");
6927 else if (streq(&(Name[NameLen - 2]), "lf"))
6929 strcpy(&(Name[NameLen - 2]), "lves");
6931 else if (suffix(Name, "ch") ||
6932 suffix(Name, "sh") ||
6933 suffix(Name, "nx") ||
6934 suffix(Name, "s") ||
6937 strcpy(&(Name[NameLen]), "es");
6941 strcpy(&(Name[NameLen]), "s");
6946 * Display current pets
6948 static void do_cmd_knowledge_pets(void)
6952 monster_type *m_ptr;
6954 int show_upkeep = 0;
6955 char file_name[1024];
6958 /* Open a new file */
6959 fff = my_fopen_temp(file_name, 1024);
6962 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
6964 msg_format("Failed to create temporary file %s.", file_name);
6970 /* Process the monsters (backwards) */
6971 for (i = m_max - 1; i >= 1; i--)
6973 /* Access the monster */
6976 /* Ignore "dead" monsters */
6977 if (!m_ptr->r_idx) continue;
6979 /* Calculate "upkeep" for pets */
6984 monster_desc(pet_name, m_ptr, 0x88);
6985 fprintf(fff, "%s (%s)", pet_name, look_mon_desc(i, 0x00));
6986 if (p_ptr->riding == i)
6988 fprintf(fff, " ¾èÇÏÃæ");
6990 fprintf(fff, " Riding");
6996 show_upkeep = calculate_upkeep();
6998 fprintf(fff, "----------------------------------------------\n");
7000 fprintf(fff, " ¹ç·×: %d ɤ¤Î¥Ú¥Ã¥È\n", t_friends);
7001 fprintf(fff, " °Ý»ý¥³¥¹¥È: %d%% MP\n", show_upkeep);
7003 fprintf(fff, " Total: %d pet%s.\n",
7004 t_friends, (t_friends == 1 ? "" : "s"));
7005 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
7010 /* Close the file */
7013 /* Display the file contents */
7015 show_file(TRUE, file_name, "¸½ºß¤Î¥Ú¥Ã¥È", 0, 0);
7017 show_file(TRUE, file_name, "Current Pets", 0, 0);
7021 /* Remove the file */
7029 * Note that the player ghosts are ignored. XXX XXX XXX
7031 static void do_cmd_knowledge_kill_count(void)
7039 char file_name[1024];
7044 /* Open a new file */
7045 fff = my_fopen_temp(file_name, 1024);
7049 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
7051 msg_format("Failed to create temporary file %s.", file_name);
7057 /* Allocate the "who" array */
7058 C_MAKE(who, max_r_idx, s16b);
7061 /* Monsters slain */
7064 for (kk = 1; kk < max_r_idx; kk++)
7066 monster_race *r_ptr = &r_info[kk];
7068 if (r_ptr->flags1 & (RF1_UNIQUE))
7070 bool dead = (r_ptr->max_num == 0);
7079 s16b This = r_ptr->r_pkills;
7090 fprintf(fff,"¤¢¤Ê¤¿¤Ï¤Þ¤ÀŨ¤òÅݤ·¤Æ¤¤¤Ê¤¤¡£\n\n");
7092 fprintf(fff,"You have defeated no enemies yet.\n\n");
7095 else if (Total == 1)
7097 fprintf(fff,"¤¢¤Ê¤¿¤Ï°ìɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n");
7099 fprintf(fff,"You have defeated one enemy.\n\n");
7104 fprintf(fff,"¤¢¤Ê¤¿¤Ï %lu ɤ¤ÎŨ¤òÅݤ·¤Æ¤¤¤ë¡£\n\n", Total);
7106 fprintf(fff,"You have defeated %lu enemies.\n\n", Total);
7113 /* Scan the monsters */
7114 for (i = 1; i < max_r_idx; i++)
7116 monster_race *r_ptr = &r_info[i];
7118 /* Use that monster */
7119 if (r_ptr->name) who[n++] = i;
7122 /* Select the sort method */
7123 ang_sort_comp = ang_sort_comp_hook;
7124 ang_sort_swap = ang_sort_swap_hook;
7126 /* Sort the array by dungeon depth of monsters */
7127 ang_sort(who, &why, n);
7129 /* Scan the monster races */
7130 for (k = 0; k < n; k++)
7132 monster_race *r_ptr = &r_info[who[k]];
7134 if (r_ptr->flags1 & (RF1_UNIQUE))
7136 bool dead = (r_ptr->max_num == 0);
7140 /* Print a message */
7141 fprintf(fff, " %s\n",
7142 (r_name + r_ptr->name));
7148 s16b This = r_ptr->r_pkills;
7153 /* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita*/
7154 if(strchr("pt",r_ptr->d_char))
7155 fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
7157 fprintf(fff, " %3d ɤ¤Î %s\n", This, r_name + r_ptr->name);
7161 if (strstr(r_name + r_ptr->name, "coins"))
7163 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
7167 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
7173 strcpy(ToPlural, (r_name + r_ptr->name));
7174 plural_aux(ToPlural);
7175 fprintf(fff, " %d %s\n", This, ToPlural);
7185 fprintf(fff,"----------------------------------------------\n");
7187 fprintf(fff," ¹ç·×: %lu ɤ¤òÅݤ·¤¿¡£\n", Total);
7189 fprintf(fff," Total: %lu creature%s killed.\n",
7190 Total, (Total == 1 ? "" : "s"));
7194 /* Free the "who" array */
7195 C_KILL(who, max_r_idx, s16b);
7197 /* Close the file */
7200 /* Display the file contents */
7202 show_file(TRUE, file_name, "Åݤ·¤¿Å¨¤Î¿ô", 0, 0);
7204 show_file(TRUE, file_name, "Kill Count", 0, 0);
7208 /* Remove the file */
7214 * Display the object groups.
7216 static void display_group_list(int col, int row, int wid, int per_page,
7217 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
7221 /* Display lines until done */
7222 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
7224 /* Get the group index */
7225 int grp = grp_idx[grp_top + i];
7227 /* Choose a color */
7228 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
7230 /* Erase the entire line */
7231 Term_erase(col, row + i, wid);
7233 /* Display the group label */
7234 c_put_str(attr, group_text[grp], row + i, col);
7240 * Move the cursor in a browser window
7242 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
7243 int *list_cur, int list_cnt)
7248 int list = *list_cur;
7250 /* Extract direction */
7253 /* Hack -- scroll up full screen */
7258 /* Hack -- scroll down full screen */
7263 d = get_keymap_dir(ch);
7268 /* Diagonals - hack */
7269 if ((ddx[d] > 0) && ddy[d])
7275 Term_get_size(&wid, &hgt);
7277 browser_rows = hgt - 8;
7279 /* Browse group list */
7284 /* Move up or down */
7285 grp += ddy[d] * (browser_rows - 1);
7288 if (grp >= grp_cnt) grp = grp_cnt - 1;
7289 if (grp < 0) grp = 0;
7290 if (grp != old_grp) list = 0;
7293 /* Browse sub-list list */
7296 /* Move up or down */
7297 list += ddy[d] * browser_rows;
7300 if (list >= list_cnt) list = list_cnt - 1;
7301 if (list < 0) list = 0;
7313 if (col < 0) col = 0;
7314 if (col > 1) col = 1;
7321 /* Browse group list */
7326 /* Move up or down */
7330 if (grp >= grp_cnt) grp = grp_cnt - 1;
7331 if (grp < 0) grp = 0;
7332 if (grp != old_grp) list = 0;
7335 /* Browse sub-list list */
7338 /* Move up or down */
7342 if (list >= list_cnt) list = list_cnt - 1;
7343 if (list < 0) list = 0;
7354 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
7358 /* Clear the display lines */
7359 for (i = 0; i < height; i++)
7361 Term_erase(col, row + i, width);
7364 /* Bigtile mode uses double width */
7365 if (use_bigtile) width /= 2;
7367 /* Display lines until done */
7368 for (i = 0; i < height; i++)
7370 /* Display columns until done */
7371 for (j = 0; j < width; j++)
7379 /* Bigtile mode uses double width */
7380 if (use_bigtile) x += j;
7385 /* Ignore illegal characters */
7386 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
7387 (!use_graphics && ic > 0x7f))
7393 /* Force correct code for both ASCII character and tile */
7394 if (c & 0x80) a |= 0x80;
7396 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7398 /* Display symbol */
7399 Term_putch(x, y, a, c);
7402 if (use_bigtile) Term_putch(x + 1, y, a2, c2);
7409 * Place the cursor at the collect position for visual mode
7411 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
7413 int i = (a & 0x7f) - attr_top;
7414 int j = c - char_left;
7419 /* Bigtile mode uses double width */
7420 if (use_bigtile) x += j;
7422 /* Place the cursor */
7428 * Clipboard variables for copy&paste in visual mode
7430 static byte attr_idx = 0;
7431 static byte char_idx = 0;
7434 * Do visual mode command -- Change symbols
7436 static bool visual_mode_command(char ch, bool *visual_list_ptr,
7437 int height, int width,
7438 byte *attr_top_ptr, byte *char_left_ptr,
7439 byte *cur_attr_ptr, byte *cur_char_ptr)
7441 static byte attr_old = 0, char_old = 0;
7446 if (*visual_list_ptr)
7449 *cur_attr_ptr = attr_old;
7450 *cur_char_ptr = char_old;
7451 *visual_list_ptr = FALSE;
7460 if (*visual_list_ptr)
7463 *visual_list_ptr = FALSE;
7471 if (!*visual_list_ptr)
7473 *visual_list_ptr = TRUE;
7475 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7476 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7478 attr_old = *cur_attr_ptr;
7479 char_old = *cur_char_ptr;
7487 /* Set the visual */
7488 attr_idx = *cur_attr_ptr;
7489 char_idx = *cur_char_ptr;
7498 *cur_attr_ptr = attr_idx;
7499 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
7505 *cur_char_ptr = char_idx;
7506 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
7512 if (*visual_list_ptr)
7515 int d = get_keymap_dir(ch);
7516 byte a = (*cur_attr_ptr & 0x7f);
7517 byte c = *cur_char_ptr;
7519 if (use_bigtile) eff_width = width / 2;
7520 else eff_width = width;
7522 /* Restrict direction */
7523 if ((a == 0) && (ddy[d] < 0)) d = 0;
7524 if ((c == 0) && (ddx[d] < 0)) d = 0;
7525 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
7526 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
7531 /* Force correct code for both ASCII character and tile */
7532 if (c & 0x80) a |= 0x80;
7534 /* Set the visual */
7539 /* Move the frame */
7540 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
7541 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
7542 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
7543 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
7550 /* Visual mode command is not used */
7556 * Display the monsters in a group.
7558 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
7559 int mon_cur, int mon_top)
7563 /* Display lines until done */
7564 for (i = 0; i < per_page && mon_idx[mon_top + i]; i++)
7570 /* Get the race index */
7571 int r_idx = mon_idx[mon_top + i] ;
7573 /* Access the race */
7574 monster_race *r_ptr = &r_info[r_idx];
7577 /* Choose a color */
7578 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
7580 /* Display the name */
7581 c_prt(attr, (r_name + r_ptr->name), row + i, col);
7583 /* Hack -- visual_list mode */
7586 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, 60);
7588 else if (p_ptr->wizard)
7590 c_prt(attr, format("%d", r_idx), row + i, 60);
7595 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7597 /* Display symbol */
7598 Term_putch(70, row + i, a, c);
7601 if (use_bigtile) Term_putch(70 + 1, row + i, a2, c2);
7604 if (!(r_ptr->flags1 & RF1_UNIQUE)) put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
7606 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "»àË´" : "À¸Â¸"), row + i, 73);
7608 else c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE), (r_ptr->max_num == 0 ? "dead" : "alive"), row + i, 73);
7613 /* Clear remaining lines */
7614 for (; i < per_page; i++)
7616 Term_erase(col, row + i, 255);
7622 * Display known monsters.
7624 static void do_cmd_knowledge_monsters(void)
7627 int grp_cur, grp_top, old_grp_cur;
7628 int mon_cur, mon_top;
7629 int grp_cnt, grp_idx[100];
7637 bool visual_list = FALSE;
7638 byte attr_top = 0, char_left = 0;
7644 Term_get_size(&wid, &hgt);
7646 browser_rows = hgt - 8;
7648 /* Allocate the "mon_idx" array */
7649 C_MAKE(mon_idx, max_r_idx, s16b);
7654 /* Check every group */
7655 for (i = 0; monster_group_text[i] != NULL; i++)
7657 /* Measure the label */
7658 len = strlen(monster_group_text[i]);
7660 /* Save the maximum length */
7661 if (len > max) max = len;
7663 /* See if any monsters are known */
7664 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, 0x01))
7666 /* Build a list of groups with known monsters */
7667 grp_idx[grp_cnt++] = i;
7671 /* Terminate the list */
7672 grp_idx[grp_cnt] = -1;
7675 grp_cur = grp_top = 0;
7676 mon_cur = mon_top = 0;
7685 monster_race *r_ptr;
7692 prt("Ãμ± - ¥â¥ó¥¹¥¿¡¼", 2, 0);
7693 prt("¥°¥ë¡¼¥×", 4, 0);
7694 prt("̾Á°", 4, max + 3);
7695 if (p_ptr->wizard) prt("Idx", 4, 60);
7696 prt("ʸ»ú »¦³²¿ô", 4, 67);
7698 prt("Knowledge - Monsters", 2, 0);
7700 prt("Name", 4, max + 3);
7701 if (p_ptr->wizard) prt("Idx", 4, 60);
7702 prt("Sym Kills", 4, 67);
7705 for (i = 0; i < 78; i++)
7707 Term_putch(i, 5, TERM_WHITE, '=');
7710 for (i = 0; i < browser_rows; i++)
7712 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7718 /* Scroll group list */
7719 if (grp_cur < grp_top) grp_top = grp_cur;
7720 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7722 /* Display a list of monster groups */
7723 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
7725 if (old_grp_cur != grp_cur)
7727 old_grp_cur = grp_cur;
7729 /* Get a list of monsters in the current group */
7730 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, 0x00);
7733 /* Scroll monster list */
7734 while (mon_cur < mon_top)
7735 mon_top = MAX(0, mon_top - browser_rows/2);
7736 while (mon_cur >= mon_top + browser_rows)
7737 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
7741 /* Display a list of monsters in the current group */
7742 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top);
7748 /* Display a monster name */
7749 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top);
7751 /* Display visual list below first monster */
7752 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7757 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
7759 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);
7762 /* Get the current monster */
7763 r_ptr = &r_info[mon_idx[mon_cur]];
7765 /* Mega Hack -- track this monster race */
7766 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
7768 /* Hack -- handle stuff */
7773 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
7777 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7781 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
7786 /* Do visual mode command if needed */
7787 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;
7800 /* Recall on screen */
7801 if (mon_idx[mon_cur])
7803 screen_roff(mon_idx[mon_cur], 0);
7814 /* Move the cursor */
7815 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
7822 /* Free the "mon_idx" array */
7823 C_KILL(mon_idx, max_r_idx, s16b);
7828 * Display the objects in a group.
7830 static void display_object_list(int col, int row, int per_page, int object_idx[],
7831 int object_cur, int object_top)
7835 /* Display lines until done */
7836 for (i = 0; i < per_page && object_idx[object_top + i]; i++)
7842 /* Get the object index */
7843 int k_idx = object_idx[object_top + i];
7845 /* Access the object */
7846 object_kind *k_ptr = &k_info[k_idx];
7848 /* Choose a color */
7849 byte attr = (k_ptr->aware ? TERM_WHITE : TERM_SLATE);
7850 byte cursor = (k_ptr->aware ? TERM_L_BLUE : TERM_BLUE);
7852 attr = ((i + object_top == object_cur) ? cursor : attr);
7855 strip_name(o_name, k_idx);
7857 /* Display the name */
7858 c_prt(attr, o_name, row + i, col);
7860 /* Hack -- visual_list mode */
7863 c_prt(attr, format("%02x/%02x", k_ptr->x_attr, k_ptr->x_char), row + i, 60);
7865 else if (p_ptr->wizard)
7867 c_prt(attr, format ("%d", k_idx), row + i, 70);
7870 a = k_ptr->flavor ? misc_to_attr[k_ptr->flavor] : k_ptr->x_attr;
7871 c = k_ptr->flavor ? misc_to_char[k_ptr->flavor] : k_ptr->x_char;
7873 /* Symbol is unknown */
7874 if (!k_ptr->aware && !p_ptr->wizard)
7880 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
7882 /* Display symbol */
7883 Term_putch(76, row + i, a, c);
7886 if (use_bigtile) Term_putch(76 + 1, row + i, a2, c2);
7889 /* Clear remaining lines */
7890 for (; i < per_page; i++)
7892 Term_erase(col, row + i, 255);
7897 * Describe fake object
7899 static void desc_obj_fake(int k_idx)
7902 object_type object_type_body;
7904 /* Get local object */
7905 o_ptr = &object_type_body;
7907 /* Wipe the object */
7910 /* Create the artifact */
7911 object_prep(o_ptr, k_idx);
7913 /* It's fully know */
7914 o_ptr->ident |= IDENT_KNOWN;
7916 /* Track the object */
7917 /* object_actual_track(o_ptr); */
7919 /* Hack - mark as fake */
7920 /* term_obj_real = FALSE; */
7922 /* Hack -- Handle stuff */
7925 if (!screen_object(o_ptr, FALSE))
7928 msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
7930 msg_print("You see nothing special.");
7939 * Display known objects
7941 static void do_cmd_knowledge_objects(void)
7944 int grp_cur, grp_top, old_grp_cur;
7945 int object_old, object_cur, object_top;
7946 int grp_cnt, grp_idx[100];
7954 bool visual_list = FALSE;
7955 byte attr_top = 0, char_left = 0;
7961 Term_get_size(&wid, &hgt);
7963 browser_rows = hgt - 8;
7965 /* Allocate the "object_idx" array */
7966 C_MAKE(object_idx, max_k_idx, int);
7971 /* Check every group */
7972 for (i = 0; object_group_text[i] != NULL; i++)
7974 /* Measure the label */
7975 len = strlen(object_group_text[i]);
7977 /* Save the maximum length */
7978 if (len > max) max = len;
7980 /* See if any monsters are known */
7981 if (collect_objects(i, object_idx))
7983 /* Build a list of groups with known monsters */
7984 grp_idx[grp_cnt++] = i;
7988 /* Terminate the list */
7989 grp_idx[grp_cnt] = -1;
7992 grp_cur = grp_top = 0;
7993 object_cur = object_top = 0;
8010 prt("Ãμ± - ¥¢¥¤¥Æ¥à", 2, 0);
8011 prt("¥°¥ë¡¼¥×", 4, 0);
8012 prt("̾Á°", 4, max + 3);
8013 if (p_ptr->wizard) prt("Idx", 4, 70);
8016 prt("Knowledge - objects", 2, 0);
8018 prt("Name", 4, max + 3);
8019 if (p_ptr->wizard) prt("Idx", 4, 70);
8023 for (i = 0; i < 78; i++)
8025 Term_putch(i, 5, TERM_WHITE, '=');
8028 for (i = 0; i < browser_rows; i++)
8030 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8036 /* Scroll group list */
8037 if (grp_cur < grp_top) grp_top = grp_cur;
8038 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8040 /* Display a list of object groups */
8041 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
8043 if (old_grp_cur != grp_cur)
8045 old_grp_cur = grp_cur;
8047 /* Get a list of objects in the current group */
8048 object_cnt = collect_objects(grp_idx[grp_cur], object_idx);
8051 /* Scroll object list */
8052 while (object_cur < object_top)
8053 object_top = MAX(0, object_top - browser_rows/2);
8054 while (object_cur >= object_top + browser_rows)
8055 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
8059 /* Display a list of objects in the current group */
8060 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top);
8064 object_top = object_cur;
8066 /* Display a list of objects in the current group */
8067 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top);
8069 /* Display visual list below first object */
8070 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8073 /* Get the current object */
8074 k_ptr = &k_info[object_idx[object_cur]];
8076 /* Mega Hack -- track this object */
8077 if (object_cnt) object_kind_track(object_idx[object_cur]);
8081 prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8083 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);
8086 /* The "current" object changed */
8087 if (object_old != object_idx[object_cur])
8089 /* Hack -- handle stuff */
8092 /* Remember the "current" object */
8093 object_old = object_idx[object_cur];
8098 place_visual_list_cursor(max + 3, 7, k_ptr->x_attr, k_ptr->x_char, attr_top, char_left);
8102 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8106 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
8111 /* Do visual mode command if needed */
8112 /* Symbol of objects with flavor cannot be changed */
8113 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;
8126 /* Recall on screen */
8128 desc_obj_fake(object_idx[object_cur]);
8136 /* Move the cursor */
8137 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
8143 /* Free the "object_idx" array */
8144 C_KILL(object_idx, max_k_idx, int);
8150 * Display the features in a group.
8152 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
8153 int feat_cur, int feat_top)
8157 /* Display lines until done */
8158 for (i = 0; i < per_page && feat_idx[feat_top + i]; i++)
8165 int f_idx = feat_idx[feat_top + i];
8167 /* Access the index */
8168 feature_type *f_ptr = &f_info[f_idx];
8170 /* Choose a color */
8171 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
8173 /* Display the name */
8174 c_prt(attr, f_name + f_ptr->name, row + i, col);
8176 /* Hack -- visual_list mode */
8179 c_prt(attr, format("%02x/%02x", f_ptr->x_attr, f_ptr->x_char), row + i, 60);
8185 if (use_bigtile) bigtile_attr(&c, &a, &c2, &a2);
8187 /* Display symbol */
8188 Term_putch(68, row + i, a, c);
8191 if (use_bigtile) Term_putch(68 + 1, row + i, a2, c2);
8194 /* Clear remaining lines */
8195 for (; i < per_page; i++)
8197 Term_erase(col, row + i, 255);
8203 * Interact with feature visuals.
8205 static void do_cmd_knowledge_features(void)
8208 int grp_cur, grp_top, old_grp_cur;
8209 int feat_cur, feat_top;
8210 int grp_cnt, grp_idx[100];
8218 bool visual_list = FALSE;
8219 byte attr_top = 0, char_left = 0;
8225 Term_get_size(&wid, &hgt);
8227 browser_rows = hgt - 8;
8229 /* Allocate the "feat_idx" array */
8230 C_MAKE(feat_idx, max_f_idx, int);
8235 /* Check every group */
8236 for (i = 0; feature_group_text[i] != NULL; i++)
8238 /* Measure the label */
8239 len = strlen(feature_group_text[i]);
8241 /* Save the maximum length */
8242 if (len > max) max = len;
8244 /* See if any features are known */
8245 if (collect_features(i, feat_idx))
8247 /* Build a list of groups with known features */
8248 grp_idx[grp_cnt++] = i;
8252 /* Terminate the list */
8253 grp_idx[grp_cnt] = -1;
8256 grp_cur = grp_top = 0;
8257 feat_cur = feat_top = 0;
8263 while ((!flag) && (grp_cnt))
8266 feature_type *f_ptr;
8272 prt("Visuals - features", 2, 0);
8274 prt("Name", 4, max + 3);
8277 for (i = 0; i < 78; i++)
8279 Term_putch(i, 5, TERM_WHITE, '=');
8282 for (i = 0; i < browser_rows; i++)
8284 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
8290 /* Scroll group list */
8291 if (grp_cur < grp_top) grp_top = grp_cur;
8292 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
8294 /* Display a list of feature groups */
8295 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
8297 if (old_grp_cur != grp_cur)
8299 old_grp_cur = grp_cur;
8301 /* Get a list of features in the current group */
8302 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx);
8305 /* Scroll feature list */
8306 while (feat_cur < feat_top)
8307 feat_top = MAX(0, feat_top - browser_rows/2);
8308 while (feat_cur >= feat_top + browser_rows)
8309 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
8313 /* Display a list of features in the current group */
8314 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top);
8318 feat_top = feat_cur;
8320 /* Display a list of features in the current group */
8321 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top);
8323 /* Display visual list below first object */
8324 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
8329 prt(format("<Êý¸þ>%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
8331 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);
8334 /* Get the current feature */
8335 f_ptr = &f_info[feat_idx[feat_cur]];
8339 place_visual_list_cursor(max + 3, 7, f_ptr->x_attr, f_ptr->x_char, attr_top, char_left);
8343 Term_gotoxy(0, 6 + (grp_cur - grp_top));
8347 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
8352 /* Do visual mode command if needed */
8353 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;
8365 /* Move the cursor */
8366 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
8373 if (!grp_cnt) msg_print("No features known.");
8375 /* Free the "feat_idx" array */
8376 C_KILL(feat_idx, max_f_idx, int);
8381 * List wanted monsters
8383 static void do_cmd_knowledge_kubi(void)
8388 char file_name[1024];
8391 /* Open a new file */
8392 fff = my_fopen_temp(file_name, 1024);
8395 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8397 msg_format("Failed to create temporary file %s.", file_name);
8406 fprintf(fff, "º£Æü¤Î¥¿¡¼¥²¥Ã¥È : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "ÉÔÌÀ"));
8408 fprintf(fff, "¾Þ¶â¼ó¥ê¥¹¥È\n");
8410 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
8412 fprintf(fff, "List of wanted monsters\n");
8414 for (i = 0; i < MAX_KUBI; i++)
8416 fprintf(fff,"%-40s ---- ",r_name + r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])].name);
8417 if (kubi_r_idx[i] > 10000)
8419 fprintf(fff, "ºÑ\n");
8421 fprintf(fff, "done\n");
8424 fprintf(fff, "$%d\n", 300 * (r_info[kubi_r_idx[i]].level + 1));
8428 /* Close the file */
8431 /* Display the file contents */
8433 show_file(TRUE, file_name, "¾Þ¶â¼ó¤Î°ìÍ÷", 0, 0);
8435 show_file(TRUE, file_name, "Wanted monsters", 0, 0);
8439 /* Remove the file */
8444 * List virtues & status
8446 static void do_cmd_knowledge_virtues(void)
8450 char file_name[1024];
8453 /* Open a new file */
8454 fff = my_fopen_temp(file_name, 1024);
8457 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8459 msg_format("Failed to create temporary file %s.", file_name);
8468 fprintf(fff, "¸½ºß¤Î°À : %s\n\n", your_alignment());
8470 fprintf(fff, "Your alighnment : %s\n\n", your_alignment());
8475 /* Close the file */
8478 /* Display the file contents */
8480 show_file(TRUE, file_name, "Ȭ¤Ä¤ÎÆÁ", 0, 0);
8482 show_file(TRUE, file_name, "Virtues", 0, 0);
8486 /* Remove the file */
8494 static void do_cmd_knowledge_dungeon(void)
8498 char file_name[1024];
8502 /* Open a new file */
8503 fff = my_fopen_temp(file_name, 1024);
8506 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8508 msg_format("Failed to create temporary file %s.", file_name);
8516 for (i = 1; i < max_d_idx; i++)
8520 if (!d_info[i].maxdepth) continue;
8521 if (!max_dlv[i]) continue;
8522 if (d_info[i].final_guardian)
8524 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
8526 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
8528 fprintf(fff,"%c%-12s : %3d ³¬\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8530 fprintf(fff,"%c%-16s : level %3d\n", seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
8535 /* Close the file */
8538 /* Display the file contents */
8540 show_file(TRUE, file_name, "º£¤Þ¤Ç¤ËÆþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó", 0, 0);
8542 show_file(TRUE, file_name, "Dungeon", 0, 0);
8546 /* Remove the file */
8551 * List virtues & status
8554 static void do_cmd_knowledge_stat(void)
8558 char file_name[1024];
8561 /* Open a new file */
8562 fff = my_fopen_temp(file_name, 1024);
8565 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8567 msg_format("Failed to create temporary file %s.", file_name);
8575 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
8576 (2 * p_ptr->hitdie +
8577 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
8580 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : %d/100\n\n", percent);
8581 else fprintf(fff, "¸½ºß¤ÎÂÎÎÏ¥é¥ó¥¯ : ???\n\n");
8582 fprintf(fff, "ǽÎϤκÇÂçÃÍ\n\n");
8584 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
8585 else fprintf(fff, "Your current Life Rating is ???.\n\n");
8586 fprintf(fff, "Limits of maximum stats\n\n");
8588 for (v_nr = 0; v_nr < 6; v_nr++)
8590 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);
8591 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
8597 /* Close the file */
8600 /* Display the file contents */
8602 show_file(TRUE, file_name, "¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó", 0, 0);
8604 show_file(TRUE, file_name, "HP-rate & Max stat", 0, 0);
8608 /* Remove the file */
8614 * Print quest status of all active quests
8616 static void do_cmd_knowledge_quests(void)
8619 char file_name[1024];
8621 char rand_tmp_str[120] = "\0";
8623 monster_race *r_ptr;
8625 int rand_level = 100;
8628 /* Open a new file */
8629 fff = my_fopen_temp(file_name, 1024);
8632 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
8634 msg_format("Failed to create temporary file %s.", file_name);
8641 fprintf(fff, "¡Ô¿ë¹ÔÃæ¤Î¥¯¥¨¥¹¥È¡Õ\n");
8643 fprintf(fff, "< Current Quest >\n");
8646 for (i = 1; i < max_quests; i++)
8648 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_COMPLETED)
8653 /* Clear the text */
8654 for (j = 0; j < 10; j++)
8656 quest_text[j][0] = '\0';
8659 quest_text_line = 0;
8661 /* Set the quest number temporary */
8662 old_quest = p_ptr->inside_quest;
8663 p_ptr->inside_quest = i;
8665 /* Get the quest text */
8666 init_flags = INIT_SHOW_TEXT;
8668 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8670 /* Reset the old quest number */
8671 p_ptr->inside_quest = old_quest;
8673 /* No info from "silent" quests */
8674 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8678 if (quest[i].type != QUEST_TYPE_RANDOM)
8680 char note[80] = "\0";
8682 if (quest[i].status == QUEST_STATUS_TAKEN)
8684 if (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL)
8686 r_ptr = &r_info[quest[i].r_idx];
8687 strcpy(name, r_name + r_ptr->name);
8688 if (quest[i].max_num > 1)
8691 sprintf(note," - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
8694 sprintf(note," - kill %d %s, have killed %d.",quest[i].max_num, name, quest[i].cur_num);
8699 sprintf(note," - %s¤òÅݤ¹¡£",name);
8701 sprintf(note," - kill %s.",name);
8704 else if (quest[i].type == QUEST_TYPE_KILL_NUMBER)
8707 sprintf(note," - %d ÂΤΥâ¥ó¥¹¥¿¡¼¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)",quest[i].max_num, quest[i].max_num-quest[i].cur_num);
8709 sprintf(note," - Kill %d monsters, have killed %d.",quest[i].max_num, quest[i].cur_num);
8712 else if (quest[i].type == QUEST_TYPE_FIND_ARTIFACT)
8714 strcpy(name, a_name + a_info[quest[i].k_idx].name);
8716 sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
8718 sprintf(note," - Find out %s.", name);
8721 else if (quest[i].type == QUEST_TYPE_FIND_EXIT)
8723 sprintf(note," - õº÷¤¹¤ë¡£");
8725 sprintf(note," - Search.");
8727 else if (quest[i].type == QUEST_TYPE_KILL_ALL)
8729 sprintf(note," - Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ¹¡£");
8731 sprintf(note," - Kill all monsters.");
8735 /* Print the quest info */
8737 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö)%s\n",
8738 quest[i].name, quest[i].level, note);
8740 sprintf(tmp_str, "%s (Danger level: %d)%s\n",
8741 quest[i].name, quest[i].level, note);
8744 fprintf(fff, tmp_str);
8746 if (quest[i].status == QUEST_STATUS_COMPLETED)
8749 sprintf(tmp_str, " ¥¯¥¨¥¹¥ÈãÀ® - ¤Þ¤ÀÊó½·¤ò¼õ¤±¤È¤Ã¤Æ¤Ê¤¤¡£\n");
8751 sprintf(tmp_str, " Quest Completed - Unrewarded\n");
8754 fprintf(fff, tmp_str);
8760 while (quest_text[j][0] && j < 10)
8762 fprintf(fff, " %s\n", quest_text[j]);
8767 else if ((quest[i].type == QUEST_TYPE_RANDOM) &&
8768 (quest[i].level < rand_level))
8771 rand_level = quest[i].level;
8773 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8775 /* Print the quest info */
8776 r_ptr = &r_info[quest[i].r_idx];
8777 strcpy(name, r_name + r_ptr->name);
8779 if (quest[i].max_num > 1)
8782 sprintf(rand_tmp_str,"%s (%d ³¬) - %d ÂΤÎ%s¤òÅݤ¹¡£(¤¢¤È %d ÂÎ)\n",
8783 quest[i].name, quest[i].level,
8784 quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
8788 sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8789 quest[i].name, quest[i].level,
8790 quest[i].max_num, name, quest[i].cur_num);
8796 sprintf(rand_tmp_str,"%s (%d ³¬) - %s¤òÅݤ¹¡£\n",
8797 quest[i].name, quest[i].level, name);
8799 sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %s.\n",
8800 quest[i].name, quest[i].level, name);
8808 /* Print the current random quest */
8809 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
8812 if (!total) fprintf(fff, "¤Ê¤·\n");
8814 if (!total) fprintf(fff, "Nothing.\n");
8818 fprintf(fff, "\n¡ÔãÀ®¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8820 fprintf(fff, "\n< Completed Quest >\n");
8823 for (i = 1; i < max_quests; i++)
8825 if (quest[i].status == QUEST_STATUS_FINISHED)
8827 if (i < MIN_RANDOM_QUEST)
8831 /* Set the quest number temporary */
8832 old_quest = p_ptr->inside_quest;
8833 p_ptr->inside_quest = i;
8836 init_flags = INIT_ASSIGN;
8838 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8840 /* Reset the old quest number */
8841 p_ptr->inside_quest = old_quest;
8843 /* No info from "silent" quests */
8844 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8849 if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
8851 /* Print the quest info */
8853 if (quest[i].complev == 0)
8857 "%s (%d³¬) - ÉÔÀᄀ\n",
8859 "%s (Dungeon level: %d) - (Cancelled)\n",
8861 r_name+r_info[quest[i].r_idx].name,
8868 "%s (%d³¬) - ¥ì¥Ù¥ë%d\n",
8870 "%s (Dungeon level: %d) - level %d\n",
8872 r_name+r_info[quest[i].r_idx].name,
8879 /* Print the quest info */
8881 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö) - ¥ì¥Ù¥ë%d\n",
8882 quest[i].name, quest[i].level, quest[i].complev);
8884 sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
8885 quest[i].name, quest[i].level, quest[i].complev);
8889 fprintf(fff, tmp_str);
8893 if (!total) fprintf(fff, "¤Ê¤·\n");
8895 if (!total) fprintf(fff, "Nothing.\n");
8899 fprintf(fff, "\n¡Ô¼ºÇÔ¤·¤¿¥¯¥¨¥¹¥È¡Õ\n");
8901 fprintf(fff, "\n< Failed Quest >\n");
8904 for (i = 1; i < max_quests; i++)
8906 if ((quest[i].status == QUEST_STATUS_FAILED_DONE) || (quest[i].status == QUEST_STATUS_FAILED))
8908 if (i < MIN_RANDOM_QUEST)
8912 /* Set the quest number temporary */
8913 old_quest = p_ptr->inside_quest;
8914 p_ptr->inside_quest = i;
8916 /* Get the quest text */
8917 init_flags = INIT_ASSIGN;
8919 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8921 /* Reset the old quest number */
8922 p_ptr->inside_quest = old_quest;
8924 /* No info from "silent" quests */
8925 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8930 if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
8932 /* Print the quest info */
8934 sprintf(tmp_str, "%s (%d³¬) - ¥ì¥Ù¥ë%d\n",
8935 r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
8937 sprintf(tmp_str, "%s (Dungeon level: %d) - level %d\n",
8938 r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
8943 /* Print the quest info */
8945 sprintf(tmp_str, "%s (´í¸±ÅÙ:%d³¬ÁêÅö) - ¥ì¥Ù¥ë%d\n",
8946 quest[i].name, quest[i].level, quest[i].complev);
8948 sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
8949 quest[i].name, quest[i].level, quest[i].complev);
8952 fprintf(fff, tmp_str);
8956 if (!total) fprintf(fff, "¤Ê¤·\n");
8958 if (!total) fprintf(fff, "Nothing.\n");
8961 if (p_ptr->wizard) {
8963 fprintf(fff, "\n¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n");
8965 fprintf(fff, "\n< Remaining Random Quest >\n");
8968 for (i = 1; i < max_quests; i++)
8970 /* No info from "silent" quests */
8971 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8973 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8977 /* Print the quest info */
8979 sprintf(tmp_str, "%s (%d³¬, %s)\n",
8980 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8982 sprintf(tmp_str, "%s (%d, %s)\n",
8983 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8985 fprintf(fff, tmp_str);
8989 if (!total) fprintf(fff, "¤Ê¤·\n");
8991 if (!total) fprintf(fff, "Nothing.\n");
8995 /* Close the file */
8998 /* Display the file contents */
9000 show_file(TRUE, file_name, "¥¯¥¨¥¹¥ÈãÀ®¾õ¶·", 0, 0);
9002 show_file(TRUE, file_name, "Quest status", 0, 0);
9006 /* Remove the file */
9015 static void do_cmd_knowledge_home(void)
9020 char file_name[1024];
9022 char o_name[MAX_NLEN];
9025 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
9027 /* Open a new file */
9028 fff = my_fopen_temp(file_name, 1024);
9031 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9033 msg_format("Failed to create temporary file %s.", file_name);
9041 /* Print all homes in the different towns */
9042 st_ptr = &town[1].store[STORE_HOME];
9044 /* Home -- if anything there */
9045 if (st_ptr->stock_num)
9047 /* Header with name of the town */
9049 fprintf(fff, " [ ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ]\n");
9051 fprintf(fff, " [Home Inventory]\n");
9055 /* Dump all available items */
9056 for (i = 0; i < st_ptr->stock_num; i++)
9059 if ((i % 12) == 0) fprintf(fff, "\n ( %d ¥Ú¡¼¥¸ )\n", x++);
9060 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9061 if (strlen(o_name) <= 80-3)
9063 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9069 for (n = 0, t = o_name; n < 80-3; n++, t++)
9070 if(iskanji(*t)) {t++; n++;}
9071 if (n == 81-3) n = 79-3; /* ºÇ¸å¤¬´Á»úȾʬ */
9073 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
9074 fprintf(fff, " %.77s\n", o_name+n);
9077 object_desc(o_name, &st_ptr->stock[i], TRUE, 3);
9078 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
9083 /* Add an empty line */
9084 fprintf(fff, "\n\n");
9088 /* Close the file */
9091 /* Display the file contents */
9093 show_file(TRUE, file_name, "²æ¤¬²È¤Î¥¢¥¤¥Æ¥à", 0, 0);
9095 show_file(TRUE, file_name, "Home Inventory", 0, 0);
9099 /* Remove the file */
9105 * Check the status of "autopick"
9107 static void do_cmd_knowledge_autopick(void)
9111 char file_name[1024];
9113 /* Open a new file */
9114 fff = my_fopen_temp(file_name, 1024);
9119 msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£", file_name);
9121 msg_format("Failed to create temporary file %s.", file_name);
9130 fprintf(fff, "¼«Æ°Ç˲õ/½¦¤¤¤Ë¤Ï²¿¤âÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
9132 fprintf(fff, "No preference for auto picker/destroyer.");
9138 fprintf(fff, " ¼«Æ°½¦¤¤/Ç˲õ¤Ë¤Ï¸½ºß %d¹ÔÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£\n\n", max_autopick);
9140 fprintf(fff, " There are %d registered lines for auto picker/destroyer.\n\n", max_autopick);
9144 for (k = 0; k < max_autopick; k++)
9147 byte act = autopick_list[k].action;
9148 if (act & DONT_AUTOPICK)
9156 else if (act & DO_AUTODESTROY)
9164 else if (act & DO_AUTOPICK)
9172 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
9181 if (act & DO_DISPLAY)
9182 fprintf(fff, "%11s", format("[%s]", tmp));
9184 fprintf(fff, "%11s", format("(%s)", tmp));
9186 tmp = autopick_line_from_entry(&autopick_list[k]);
9187 fprintf(fff, " %s", tmp);
9191 /* Close the file */
9193 /* Display the file contents */
9195 show_file(TRUE, file_name, "¼«Æ°½¦¤¤/Ç˲õ ÀßÄê¥ê¥¹¥È", 0, 0);
9197 show_file(TRUE, file_name, "Auto-picker/Destroyer", 0, 0);
9200 /* Remove the file */
9206 * Interact with "knowledge"
9208 void do_cmd_knowledge(void)
9211 /* File type is "TEXT" */
9212 FILE_TYPE(FILE_TYPE_TEXT);
9213 /* Save the screen */
9215 /* Interact until done */
9220 /* Ask for a choice */
9222 prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
9223 prt("¸½ºß¤ÎÃ챤ò³Îǧ¤¹¤ë", 3, 0);
9225 prt(format("page %d/2", (p+1)), 2, 65);
9226 prt("Display current knowledge", 3, 0);
9229 /* Give some choices */
9232 prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 6, 5);
9233 prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à ¤Î°ìÍ÷", 7, 5);
9234 prt("(3) ´ûÃΤÎÀ¸¤¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
9235 prt("(4) ´ûÃΤΥâ¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 9, 5);
9236 prt("(5) Åݤ·¤¿Å¨¤Î¿ô ¤Î°ìÍ÷", 10, 5);
9237 prt("(6) ¾Þ¶â¼ó ¤Î°ìÍ÷", 11, 5);
9238 prt("(7) ¸½ºß¤Î¥Ú¥Ã¥È ¤Î°ìÍ÷", 12, 5);
9239 prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à ¤Î°ìÍ÷", 13, 5);
9240 prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ ¤Î°ìÍ÷", 14, 5);
9241 prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë ¤Î°ìÍ÷", 15, 5);
9243 prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó ¤Î°ìÍ÷", 6, 5);
9244 prt("(b) ÆÍÁ³ÊÑ°Û ¤Î°ìÍ÷", 7, 5);
9245 prt("(c) Éð´ï¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 8, 5);
9246 prt("(d) ËâË¡¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 9, 5);
9247 prt("(e) µ»Ç½¤Î·Ð¸³ÃÍ ¤Î°ìÍ÷", 10, 5);
9248 prt("(f) ¥×¥ì¥¤¥ä¡¼¤ÎÆÁ ¤Î°ìÍ÷", 11, 5);
9249 prt("(g) Æþ¤Ã¤¿¥À¥ó¥¸¥ç¥ó ¤Î°ìÍ÷", 12, 5);
9250 prt("(h) ¼Â¹ÔÃæ¤Î¥¯¥¨¥¹¥È ¤Î°ìÍ÷", 13, 5);
9251 prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê ¤Î°ìÍ÷", 14, 5);
9255 prt("(1) Display known artifacts", 6, 5);
9256 prt("(2) Display known objects", 7, 5);
9257 prt("(3) Display remaining uniques", 8, 5);
9258 prt("(4) Display known monster", 9, 5);
9259 prt("(5) Display kill count", 10, 5);
9260 prt("(6) Display wanted monsters", 11, 5);
9261 prt("(7) Display current pets", 12, 5);
9262 prt("(8) Display home inventory", 13, 5);
9263 prt("(9) Display *identified* equip.", 14, 5);
9264 prt("(0) Display terrain symbols.", 15, 5);
9266 prt("(a) Display about yourself", 6, 5);
9267 prt("(b) Display mutations", 7, 5);
9268 prt("(c) Display weapon proficiency", 8, 5);
9269 prt("(d) Display spell proficiency", 9, 5);
9270 prt("(e) Display misc. proficiency", 10, 5);
9271 prt("(f) Display virtues", 11, 5);
9272 prt("(g) Display dungeons", 12, 5);
9273 prt("(h) Display current quests", 13, 5);
9274 prt("(i) Display auto pick/destroy", 14, 5);
9279 prt("-³¤¯-", 17, 8);
9280 prt("ESC) È´¤±¤ë", 21, 1);
9281 prt("SPACE) ¼¡¥Ú¡¼¥¸", 21, 30);
9282 /*prt("-) Á°¥Ú¡¼¥¸", 21, 60);*/
9283 prt("¥³¥Þ¥ó¥É:", 20, 0);
9285 prt("-more-", 17, 8);
9286 prt("ESC) Exit menu", 21, 1);
9287 prt("SPACE) Next page", 21, 30);
9288 /*prt("-) Previous page", 21, 60);*/
9289 prt("Command: ", 20, 0);
9295 if (i == ESCAPE) break;
9298 case ' ': /* Page change */
9302 case '1': /* Artifacts */
9303 do_cmd_knowledge_artifacts();
9305 case '2': /* Objects */
9306 do_cmd_knowledge_objects();
9308 case '3': /* Uniques */
9309 do_cmd_knowledge_uniques();
9311 case '4': /* Monsters */
9312 do_cmd_knowledge_monsters();
9314 case '5': /* Kill count */
9315 do_cmd_knowledge_kill_count();
9317 case '6': /* wanted */
9318 do_cmd_knowledge_kubi();
9320 case '7': /* Pets */
9321 do_cmd_knowledge_pets();
9323 case '8': /* Home */
9324 do_cmd_knowledge_home();
9326 case '9': /* Resist list */
9327 do_cmd_knowledge_inven();
9329 case '0': /* Feature list */
9330 do_cmd_knowledge_features();
9333 case 'a': /* Max stat */
9334 do_cmd_knowledge_stat();
9336 case 'b': /* Mutations */
9337 do_cmd_knowledge_mutations();
9339 case 'c': /* weapon-exp */
9340 do_cmd_knowledge_weapon_exp();
9342 case 'd': /* spell-exp */
9343 do_cmd_knowledge_spell_exp();
9345 case 'e': /* skill-exp */
9346 do_cmd_knowledge_skill_exp();
9348 case 'f': /* Virtues */
9349 do_cmd_knowledge_virtues();
9351 case 'g': /* Dungeon */
9352 do_cmd_knowledge_dungeon();
9354 case 'h': /* Quests */
9355 do_cmd_knowledge_quests();
9357 case 'i': /* Autopick */
9358 do_cmd_knowledge_autopick();
9360 default: /* Unknown option */
9363 /* Flush messages */
9366 /* Restore the screen */
9372 * Check on the status of an active quest
9374 void do_cmd_checkquest(void)
9376 /* File type is "TEXT" */
9377 FILE_TYPE(FILE_TYPE_TEXT);
9379 /* Save the screen */
9383 do_cmd_knowledge_quests();
9385 /* Restore the screen */
9391 * Display the time and date
9393 void do_cmd_time(void)
9395 int day, hour, min, full, start, end, num;
9402 extract_day_hour_min(&day, &hour, &min);
9404 full = hour * 100 + min;
9412 strcpy(desc, "ÊѤʻþ¹ï¤À¡£");
9414 strcpy(desc, "It is a strange time.");
9420 msg_format("%d ÆüÌÜ,»þ¹ï¤Ï%d:%02d %s¤Ç¤¹¡£",
9421 day, (hour % 12 == 0) ? 12 : (hour % 12),
9422 min, (hour < 12) ? "AM" : "PM");
9424 msg_format("This is day %d. The time is %d:%02d %s.",
9425 day, (hour % 12 == 0) ? 12 : (hour % 12),
9426 min, (hour < 12) ? "AM" : "PM");
9431 if (!randint0(10) || p_ptr->image)
9434 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun_j.txt");
9436 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timefun.txt");
9443 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm_j.txt");
9445 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "timenorm.txt");
9450 /* Open this file */
9451 fff = my_fopen(buf, "rt");
9456 /* Find this time */
9457 while (!my_fgets(fff, buf, sizeof(buf)))
9459 /* Ignore comments */
9460 if (!buf[0] || (buf[0] == '#')) continue;
9462 /* Ignore invalid lines */
9463 if (buf[1] != ':') continue;
9465 /* Process 'Start' */
9468 /* Extract the starting time */
9469 start = atoi(buf + 2);
9471 /* Assume valid for an hour */
9481 /* Extract the ending time */
9482 end = atoi(buf + 2);
9488 /* Ignore incorrect range */
9489 if ((start > full) || (full > end)) continue;
9491 /* Process 'Description' */
9496 /* Apply the randomizer */
9497 if (!randint0(num)) strcpy(desc, buf + 2);
9507 /* Close the file */