OSDN Git Service

[Refactor] #38862 Moved files.c/h to io/
[hengbandforosx/hengbandosx.git] / src / io / player-status-dump.c
1 #include "system/angband.h"
2 #include "io/files.h"
3 #include "io/player-status-dump.h"
4
5
6 /*!
7  * @brief 画面番号を指定してダンプする
8  * @param creature_ptr プレーヤーへの参照ポインタ
9  * @param fff ファイルポインタ
10  * @param display_player 画面表示へのコールバック
11  * @param map_name マップ名へのコールバック
12  * @param screen_num 画面番号
13  * @param start_y
14  * @param end_y
15  * @param change_color バッファへ詰める文字の変更有無
16  * @return なし
17  */
18 static void dump_player_status_with_screen_num(
19         player_type *creature_ptr, FILE *fff, display_player_pf display_player, map_name_pf map_name,
20         int screen_num, TERM_LEN start_y, TERM_LEN end_y, bool change_color)
21 {
22         TERM_COLOR a;
23         char c;
24         char buf[1024];
25         display_player(creature_ptr, screen_num, map_name);
26         for (TERM_LEN y = start_y; y < end_y; y++)
27         {
28                 TERM_LEN x;
29                 for (x = 0; x < 79; x++)
30                 {
31                         (void)(Term_what(x, y, &a, &c));
32                         if (!change_color)
33                         {
34                                 buf[x] = c;
35                                 continue;
36                         }
37
38                         if (a < 128)
39                                 buf[x] = c;
40                         else
41                                 buf[x] = ' ';
42                 }
43
44                 buf[x] = '\0';
45                 while ((x > 0) && (buf[x - 1] == ' '))
46                         buf[--x] = '\0';
47
48                 fprintf(fff, "%s\n", buf);
49         }
50 }
51
52
53 /*!
54  * @brief プレイヤーのステータス表示をファイルにダンプする
55  * @param creature_ptr プレーヤーへの参照ポインタ
56  * @param fff ファイルポインタ
57  * @param display_player 画面表示へのコールバック
58  * @param map_name マップ名へのコールバック
59  * @return なし
60  */
61 void dump_aux_player_status(player_type *creature_ptr, FILE *fff, display_player_pf display_player, map_name_pf map_name)
62 {
63         dump_player_status_with_screen_num(creature_ptr, fff, display_player, map_name, 0, 1, 22, FALSE);
64         dump_player_status_with_screen_num(creature_ptr, fff, display_player, map_name, 1, 10, 19, FALSE);
65         fprintf(fff, "\n");
66         dump_player_status_with_screen_num(creature_ptr, fff, display_player, map_name, 2, 2, 22, TRUE);
67         fprintf(fff, "\n");
68         dump_player_status_with_screen_num(creature_ptr, fff, display_player, map_name, 3, 1, 22, TRUE);
69         fprintf(fff, "\n");
70 }