1 #include "cmd-visual/cmd-draw.h"
2 #include "core/asking-player.h"
3 #include "core/player-redraw-types.h"
4 #include "core/player-update-types.h"
5 #include "core/stuff-handler.h"
6 #include "core/window-redrawer.h"
7 #include "io/files-util.h"
8 #include "io/input-key-acceptor.h"
9 #include "main/sound-of-music.h"
10 #include "player-base/player-race.h"
11 #include "player-info/race-types.h"
12 #include "player/process-name.h"
13 #include "racial/racial-android.h"
14 #include "system/player-type-definition.h"
15 #include "term/gameterm.h"
16 #include "term/screen-processor.h"
17 #include "term/term-color-types.h"
18 #include "util/int-char-converter.h"
19 #include "util/string-processor.h"
20 #include "view/display-messages.h"
21 #include "view/display-player.h"
22 #include "world/world.h"
25 * @brief 画面を再描画するコマンドのメインルーチン
26 * Hack -- redraw the screen
27 * @param player_ptr プレイヤーへの参照ポインタ
30 * This command performs various low level updates, clears all the "extra"
31 * windows, does a total redraw of the main window, and requests all of the
32 * interesting updates and redraws that I can think of.
34 * This command is also used to "instantiate" the results of the user
35 * selecting various things, such as graphics mode, so it must call
36 * the "TERM_XTRA_REACT" hook before redrawing the windows.
39 void do_cmd_redraw(PlayerType *player_ptr)
41 term_xtra(TERM_XTRA_REACT, 0);
43 player_ptr->update |= (PU_COMBINE | PU_REORDER);
44 player_ptr->update |= (PU_TORCH);
45 player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
46 player_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
47 player_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
48 player_ptr->update |= (PU_MONSTERS);
50 player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
52 player_ptr->window_flags |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
53 player_ptr->window_flags |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
56 handle_stuff(player_ptr);
57 if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) {
58 calc_android_exp(player_ptr);
61 term_type *old = game_term;
62 for (auto i = 0U; i < angband_terms.size(); ++i) {
63 if (!angband_terms[i]) {
67 term_activate(angband_terms[i]);
75 * @brief プレイヤーのステータス表示
77 void do_cmd_player_status(PlayerType *player_ptr)
84 (void)display_player(player_ptr, mode);
88 (void)display_player(player_ptr, mode);
91 term_putstr(2, 23, -1, TERM_WHITE,
92 _("['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]", "['c' to change name, 'f' to file, 'h' to change mode, or ESC]"));
100 process_player_name(player_ptr);
101 } else if (c == 'f') {
102 sprintf(tmp, "%s.txt", player_ptr->base_name);
103 if (get_string(_("ファイル名: ", "File name: "), tmp, 80)) {
104 if (tmp[0] && (tmp[0] != ' ')) {
106 file_character(player_ptr, tmp);
109 } else if (c == 'h') {
119 player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
120 handle_stuff(player_ptr);
124 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
125 * Recall the most recent message
127 void do_cmd_message_one(void)
129 prt(format("> %s", message_str(0)), 0, 0);
133 * @brief メッセージのログを表示するコマンドのメインルーチン
134 * Recall the most recent message
137 * Show previous messages to the user -BEN-
139 * The screen format uses line 0 and 23 for headers and prompts,
140 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
142 * This command shows you which commands you are viewing, and allows
143 * you to "search" for strings in the recall.
145 * Note that messages may be longer than 80 characters, but they are
146 * displayed using "infinite" length, with a special sub-command to
147 * "slide" the virtual display to the left or right.
149 * Attempt to only hilite the matching portions of the string.
152 void do_cmd_messages(int num_now)
157 concptr shower = nullptr;
159 term_get_size(&wid, &hgt);
160 int num_lines = hgt - 4;
161 strcpy(finder_str, "");
162 strcpy(shower_str, "");
163 int n = message_num();
170 for (j = 0; (j < num_lines) && (i + j < n); j++) {
171 concptr msg = message_str(i + j);
172 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
173 if (!shower || !shower[0]) {
178 while ((str = angband_strstr(str, shower)) != nullptr) {
179 int len = strlen(shower);
180 term_putstr(str - msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
185 for (; j < num_lines; j++) {
186 term_erase(0, num_lines + 1 - j, 255);
189 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"), i, i + j - 1, n), 0, 0);
190 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]", "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
191 skey = inkey_special(true);
192 if (skey == ESCAPE) {
199 prt(_("強調: ", "Show: "), hgt - 1, 0);
200 strcpy(back_str, shower_str);
201 if (askfor(shower_str, 80)) {
202 shower = shower_str[0] ? shower_str : nullptr;
204 strcpy(shower_str, back_str);
210 prt(_("検索: ", "Find: "), hgt - 1, 0);
211 strcpy(back_str, finder_str);
212 if (!askfor(finder_str, 80)) {
213 strcpy(finder_str, back_str);
215 } else if (!finder_str[0]) {
221 for (int z = i + 1; z < n; z++) {
222 concptr msg = message_str(z);
223 if (angband_strstr(msg, finder_str)) {
242 i = std::min(i + 1, n - num_lines);
245 i = std::min(i + 10, n - num_lines);
251 i = std::min(i + num_lines, n - num_lines);
256 i = std::max(0, i - num_lines);
259 i = std::max(0, i - 10);
263 i = std::max(0, i - 1);