6 #include "core/window-redrawer.h"
7 #include "core/player-redraw-types.h"
8 #include "core/stuff-handler.h"
9 #include "floor/floor-util.h"
10 #include "game-option/option-flags.h"
11 #include "object/item-tester-hooker.h"
12 #include "player-info/race-info.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/bit-flags-calculator.h"
18 #include "view/display-messages.h"
19 #include "view/display-player.h"
20 #include "window/display-sub-window-spells.h"
21 #include "window/display-sub-windows.h"
22 #include "window/main-window-left-frame.h"
23 #include "window/main-window-row-column.h"
24 #include "window/main-window-stat-poster.h"
25 #include "window/main-window-util.h"
26 #include "world/world-turn-processor.h"
27 #include "world/world.h"
30 * @brief コンソールを再描画する /
31 * Redraw a term when it is resized
32 * @todo ここにplayer_type を追加するとz-termに影響が行くので保留
34 void redraw_window(void)
36 if (!w_ptr->character_dungeon)
39 p_ptr->window_flags = PW_ALL;
46 * @brief 現在のマップ名を描画する / Print dungeon
47 * @param player_ptr プレイヤーへの参照ポインタ
49 static void print_dungeon(player_type *player_ptr)
51 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
52 concptr dungeon_name = map_name(player_ptr);
53 TERM_LEN col = COL_DUNGEON + 6 - strlen(dungeon_name) / 2;
57 c_put_str(TERM_L_UMBER, format("%s", dungeon_name), ROW_DUNGEON, col);
61 * @brief redraw のフラグに応じた更新をまとめて行う / Handle "redraw"
62 * @details 更新処理の対象はゲーム中の全描画処理
64 void redraw_stuff(player_type *player_ptr)
66 if (!player_ptr->redraw)
69 if (!w_ptr->character_generated)
72 if (w_ptr->character_icky_depth > 0)
75 if (player_ptr->redraw & (PR_WIPE)) {
76 player_ptr->redraw &= ~(PR_WIPE);
81 if (player_ptr->redraw & (PR_MAP)) {
82 player_ptr->redraw &= ~(PR_MAP);
83 print_map(player_ptr);
86 if (player_ptr->redraw & (PR_BASIC)) {
87 player_ptr->redraw &= ~(PR_BASIC);
88 player_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
89 player_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
90 player_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
91 player_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
92 print_frame_basic(player_ptr);
93 WorldTurnProcessor(player_ptr).print_time();
94 print_dungeon(player_ptr);
97 if (player_ptr->redraw & (PR_EQUIPPY)) {
98 player_ptr->redraw &= ~(PR_EQUIPPY);
99 display_player_equippy(player_ptr, ROW_EQUIPPY, COL_EQUIPPY, 0);
102 if (player_ptr->redraw & (PR_MISC)) {
103 player_ptr->redraw &= ~(PR_MISC);
104 print_field(rp_ptr->title, ROW_RACE, COL_RACE);
107 if (player_ptr->redraw & (PR_TITLE)) {
108 player_ptr->redraw &= ~(PR_TITLE);
109 print_title(player_ptr);
112 if (player_ptr->redraw & (PR_LEV)) {
113 player_ptr->redraw &= ~(PR_LEV);
114 print_level(player_ptr);
117 if (player_ptr->redraw & (PR_EXP)) {
118 player_ptr->redraw &= ~(PR_EXP);
119 print_exp(player_ptr);
122 if (player_ptr->redraw & (PR_STATS)) {
123 player_ptr->redraw &= ~(PR_STATS);
124 print_stat(player_ptr, A_STR);
125 print_stat(player_ptr, A_INT);
126 print_stat(player_ptr, A_WIS);
127 print_stat(player_ptr, A_DEX);
128 print_stat(player_ptr, A_CON);
129 print_stat(player_ptr, A_CHR);
132 if (player_ptr->redraw & (PR_STATUS)) {
133 player_ptr->redraw &= ~(PR_STATUS);
134 print_status(player_ptr);
137 if (player_ptr->redraw & (PR_ARMOR)) {
138 player_ptr->redraw &= ~(PR_ARMOR);
139 print_ac(player_ptr);
142 if (player_ptr->redraw & (PR_HP)) {
143 player_ptr->redraw &= ~(PR_HP);
144 print_hp(player_ptr);
147 if (player_ptr->redraw & (PR_MANA)) {
148 player_ptr->redraw &= ~(PR_MANA);
149 print_sp(player_ptr);
152 if (player_ptr->redraw & (PR_GOLD)) {
153 player_ptr->redraw &= ~(PR_GOLD);
154 print_gold(player_ptr);
157 if (player_ptr->redraw & (PR_DEPTH)) {
158 player_ptr->redraw &= ~(PR_DEPTH);
159 print_depth(player_ptr);
162 if (player_ptr->redraw & (PR_HEALTH)) {
163 player_ptr->redraw &= ~(PR_HEALTH);
164 health_redraw(player_ptr, false);
167 if (player_ptr->redraw & (PR_UHEALTH)) {
168 player_ptr->redraw &= ~(PR_UHEALTH);
169 health_redraw(player_ptr, true);
172 if (player_ptr->redraw & (PR_EXTRA)) {
173 player_ptr->redraw &= ~(PR_EXTRA);
174 player_ptr->redraw &= ~(PR_CUT | PR_STUN);
175 player_ptr->redraw &= ~(PR_HUNGER);
176 player_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
177 print_frame_extra(player_ptr);
180 if (player_ptr->redraw & (PR_CUT)) {
181 player_ptr->redraw &= ~(PR_CUT);
182 print_cut(player_ptr);
185 if (player_ptr->redraw & (PR_STUN)) {
186 player_ptr->redraw &= ~(PR_STUN);
187 print_stun(player_ptr);
190 if (player_ptr->redraw & (PR_HUNGER)) {
191 player_ptr->redraw &= ~(PR_HUNGER);
192 print_hunger(player_ptr);
195 if (player_ptr->redraw & (PR_STATE)) {
196 player_ptr->redraw &= ~(PR_STATE);
197 print_state(player_ptr);
200 if (player_ptr->redraw & (PR_SPEED)) {
201 player_ptr->redraw &= ~(PR_SPEED);
202 print_speed(player_ptr);
205 if (player_ptr->pclass == CLASS_IMITATOR) {
206 if (player_ptr->redraw & (PR_IMITATION)) {
207 player_ptr->redraw &= ~(PR_IMITATION);
208 print_imitation(player_ptr);
214 if (player_ptr->redraw & (PR_STUDY)) {
215 player_ptr->redraw &= ~(PR_STUDY);
216 print_study(player_ptr);
221 * @brief player_ptr->window のフラグに応じた更新をまとめて行う / Handle "player_ptr->window"
222 * @param player_ptr プレイヤーへの参照ポインタ
223 * @details 更新処理の対象はサブウィンドウ全般
225 void window_stuff(player_type *player_ptr)
227 if (!player_ptr->window_flags)
231 for (int j = 0; j < 8; j++) {
232 if (angband_term[j] && !angband_term[j]->never_fresh)
233 mask |= window_flag[j];
235 BIT_FLAGS window_flags = player_ptr->window_flags & mask;
237 if (window_flags & (PW_INVEN)) {
238 player_ptr->window_flags &= ~(PW_INVEN);
239 fix_inventory(player_ptr);
242 if (window_flags & (PW_EQUIP)) {
243 player_ptr->window_flags &= ~(PW_EQUIP);
244 fix_equip(player_ptr);
247 if (window_flags & (PW_SPELL)) {
248 player_ptr->window_flags &= ~(PW_SPELL);
249 fix_spell(player_ptr);
252 if (window_flags & (PW_PLAYER)) {
253 player_ptr->window_flags &= ~(PW_PLAYER);
254 fix_player(player_ptr);
257 // モンスターBGM対応のため、視界内モンスター表示のサブウインドウなし時も処理を行う
258 if (player_ptr->window_flags & (PW_MONSTER_LIST)) {
259 player_ptr->window_flags &= ~(PW_MONSTER_LIST);
260 fix_monster_list(player_ptr);
263 if (window_flags & (PW_MESSAGE)) {
264 player_ptr->window_flags &= ~(PW_MESSAGE);
268 if (window_flags & (PW_OVERHEAD)) {
269 player_ptr->window_flags &= ~(PW_OVERHEAD);
270 fix_overhead(player_ptr);
273 if (window_flags & (PW_DUNGEON)) {
274 player_ptr->window_flags &= ~(PW_DUNGEON);
275 fix_dungeon(player_ptr);
278 if (window_flags & (PW_MONSTER)) {
279 player_ptr->window_flags &= ~(PW_MONSTER);
280 fix_monster(player_ptr);
283 if (window_flags & (PW_OBJECT)) {
284 player_ptr->window_flags &= ~(PW_OBJECT);
285 fix_object(player_ptr);
288 if (any_bits(window_flags, PW_FLOOR_ITEM_LIST)) {
289 reset_bits(player_ptr->window_flags, PW_FLOOR_ITEM_LIST);
290 // ウィンドウサイズ変更に対応できず。カーソル位置を取る必要がある。
291 fix_floor_item_list(player_ptr, player_ptr->y, player_ptr->x);