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 "term/z-form.h"
19 #include "util/int-char-converter.h"
20 #include "util/string-processor.h"
21 #include "view/display-messages.h"
22 #include "view/display-player.h"
23 #include "world/world.h"
26 * @brief 画面を再描画するコマンドのメインルーチン
27 * Hack -- redraw the screen
28 * @param player_ptr プレイヤーへの参照ポインタ
31 * This command performs various low level updates, clears all the "extra"
32 * windows, does a total redraw of the main window, and requests all of the
33 * interesting updates and redraws that I can think of.
35 * This command is also used to "instantiate" the results of the user
36 * selecting various things, such as graphics mode, so it must call
37 * the "TERM_XTRA_REACT" hook before redrawing the windows.
40 void do_cmd_redraw(PlayerType *player_ptr)
42 term_xtra(TERM_XTRA_REACT, 0);
44 player_ptr->update |= (PU_COMBINE | PU_REORDER);
45 player_ptr->update |= (PU_TORCH);
46 player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
47 player_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
48 player_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
49 player_ptr->update |= (PU_MONSTERS);
51 player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
53 player_ptr->window_flags |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
54 player_ptr->window_flags |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
57 handle_stuff(player_ptr);
58 if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) {
59 calc_android_exp(player_ptr);
62 term_type *old = game_term;
63 for (auto i = 0U; i < angband_terms.size(); ++i) {
64 if (!angband_terms[i]) {
68 term_activate(angband_terms[i]);
76 * @brief プレイヤーのステータス表示
78 void do_cmd_player_status(PlayerType *player_ptr)
85 (void)display_player(player_ptr, mode);
89 (void)display_player(player_ptr, mode);
92 term_putstr(2, 23, -1, TERM_WHITE,
93 _("['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]", "['c' to change name, 'f' to file, 'h' to change mode, or ESC]"));
100 get_name(player_ptr);
101 process_player_name(player_ptr);
102 } else if (c == 'f') {
103 strnfmt(tmp, sizeof(tmp), "%s.txt", player_ptr->base_name);
104 if (get_string(_("ファイル名: ", "File name: "), tmp, 80)) {
105 if (tmp[0] && (tmp[0] != ' ')) {
107 file_character(player_ptr, tmp);
110 } else if (c == 'h') {
120 player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
121 handle_stuff(player_ptr);
125 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
126 * Recall the most recent message
128 void do_cmd_message_one(void)
130 prt(format("> %s", message_str(0)), 0, 0);
134 * @brief メッセージのログを表示するコマンドのメインルーチン
135 * Recall the most recent message
138 * Show previous messages to the user -BEN-
140 * The screen format uses line 0 and 23 for headers and prompts,
141 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
143 * This command shows you which commands you are viewing, and allows
144 * you to "search" for strings in the recall.
146 * Note that messages may be longer than 80 characters, but they are
147 * displayed using "infinite" length, with a special sub-command to
148 * "slide" the virtual display to the left or right.
150 * Attempt to only hilite the matching portions of the string.
153 void do_cmd_messages(int num_now)
158 concptr shower = nullptr;
160 term_get_size(&wid, &hgt);
161 int num_lines = hgt - 4;
162 strcpy(finder_str, "");
163 strcpy(shower_str, "");
164 int n = message_num();
171 for (j = 0; (j < num_lines) && (i + j < n); j++) {
172 concptr msg = message_str(i + j);
173 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
174 if (!shower || !shower[0]) {
179 while ((str = angband_strstr(str, shower)) != nullptr) {
180 int len = strlen(shower);
181 term_putstr(str - msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
186 for (; j < num_lines; j++) {
187 term_erase(0, num_lines + 1 - j, 255);
190 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"), i, i + j - 1, n), 0, 0);
191 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]", "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
192 skey = inkey_special(true);
193 if (skey == ESCAPE) {
200 prt(_("強調: ", "Show: "), hgt - 1, 0);
201 strcpy(back_str, shower_str);
202 if (askfor(shower_str, 80)) {
203 shower = shower_str[0] ? shower_str : nullptr;
205 strcpy(shower_str, back_str);
211 prt(_("検索: ", "Find: "), hgt - 1, 0);
212 strcpy(back_str, finder_str);
213 if (!askfor(finder_str, 80)) {
214 strcpy(finder_str, back_str);
216 } else if (!finder_str[0]) {
222 for (int z = i + 1; z < n; z++) {
223 concptr msg = message_str(z);
224 if (angband_strstr(msg, finder_str)) {
243 i = std::min(i + 1, n - num_lines);
246 i = std::min(i + 10, n - num_lines);
252 i = std::min(i + num_lines, n - num_lines);
257 i = std::max(0, i - num_lines);
260 i = std::max(0, i - 10);
264 i = std::max(0, i - 1);