OSDN Git Service

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