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/player-race-types.h"
11 #include "player/process-name.h"
12 #include "racial/racial-android.h"
13 #include "system/player-type-definition.h"
14 #include "term/gameterm.h"
15 #include "term/screen-processor.h"
16 #include "term/term-color-types.h"
17 #include "util/int-char-converter.h"
18 #include "util/string-processor.h"
19 #include "view/display-messages.h"
20 #include "view/display-player.h" // 暫定。後で消す.
21 #include "world/world.h"
24 * @brief 画面を再描画するコマンドのメインルーチン
25 * Hack -- redraw the screen
26 * @param creature_ptr プレーヤーへの参照ポインタ
29 * This command performs various low level updates, clears all the "extra"
30 * windows, does a total redraw of the main window, and requests all of the
31 * interesting updates and redraws that I can think of.
33 * This command is also used to "instantiate" the results of the user
34 * selecting various things, such as graphics mode, so it must call
35 * the "TERM_XTRA_REACT" hook before redrawing the windows.
38 void do_cmd_redraw(player_type *creature_ptr)
40 term_xtra(TERM_XTRA_REACT, 0);
42 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
43 creature_ptr->update |= (PU_TORCH);
44 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
45 creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
46 creature_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
47 creature_ptr->update |= (PU_MONSTERS);
49 creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
51 creature_ptr->window_flags |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
52 creature_ptr->window_flags |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
55 handle_stuff(creature_ptr);
56 if (creature_ptr->prace == RACE_ANDROID) calc_android_exp(creature_ptr);
58 term_type *old = Term;
59 for (int j = 0; j < 8; j++)
61 if (!angband_term[j]) continue;
63 term_activate(angband_term[j]);
72 * @brief プレイヤーのステータス表示
74 void do_cmd_player_status(player_type *creature_ptr)
82 display_player(creature_ptr, mode);
87 display_player(creature_ptr, mode);
90 term_putstr(2, 23, -1, TERM_WHITE,
91 _("['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]", "['c' to change name, 'f' to file, 'h' to change mode, or ESC]"));
93 if (c == ESCAPE) break;
97 get_name(creature_ptr);
98 process_player_name(creature_ptr);
102 sprintf(tmp, "%s.txt", creature_ptr->base_name);
103 if (get_string(_("ファイル名: ", "File name: "), tmp, 80))
105 if (tmp[0] && (tmp[0] != ' '))
108 file_character(creature_ptr, tmp, display_player);
125 creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
126 handle_stuff(creature_ptr);
131 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
132 * Recall the most recent message
134 void do_cmd_message_one(void)
136 prt(format("> %s", message_str(0)), 0, 0);
141 * @brief メッセージのログを表示するコマンドのメインルーチン
142 * Recall the most recent message
145 * Show previous messages to the user -BEN-
147 * The screen format uses line 0 and 23 for headers and prompts,
148 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
150 * This command shows you which commands you are viewing, and allows
151 * you to "search" for strings in the recall.
153 * Note that messages may be longer than 80 characters, but they are
154 * displayed using "infinite" length, with a special sub-command to
155 * "slide" the virtual display to the left or right.
157 * Attempt to only hilite the matching portions of the string.
160 void do_cmd_messages(int num_now)
165 concptr shower = NULL;
167 term_get_size(&wid, &hgt);
168 int num_lines = hgt - 4;
169 strcpy(finder_str, "");
170 strcpy(shower_str, "");
171 int n = message_num();
179 for (j = 0; (j < num_lines) && (i + j < n); j++)
181 concptr msg = message_str(i + j);
182 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
183 if (!shower || !shower[0]) continue;
186 while ((str = angband_strstr(str, shower)) != NULL)
188 int len = strlen(shower);
189 term_putstr(str - msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
194 for (; j < num_lines; j++)
195 term_erase(0, num_lines + 1 - j, 255);
197 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"),
198 i, i + j - 1, n), 0, 0);
199 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]",
200 "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
201 skey = inkey_special(TRUE);
202 if (skey == ESCAPE) break;
208 prt(_("強調: ", "Show: "), hgt - 1, 0);
209 strcpy(back_str, shower_str);
210 if (askfor(shower_str, 80))
211 shower = shower_str[0] ? shower_str : NULL;
213 strcpy(shower_str, back_str);
219 prt(_("検索: ", "Find: "), hgt - 1, 0);
220 strcpy(back_str, finder_str);
221 if (!askfor(finder_str, 80))
223 strcpy(finder_str, back_str);
226 else if (!finder_str[0])
233 for (int z = i + 1; z < n; z++)
235 concptr msg = message_str(z);
236 if (angband_strstr(msg, finder_str))
256 i = MIN(i + 1, n - num_lines);
259 i = MIN(i + 10, n - num_lines);
265 i = MIN(i + num_lines, n - num_lines);
270 i = MAX(0, i - num_lines);