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 "player/player-race.h"
12 #include "term/gameterm.h"
13 #include "term/screen-processor.h"
14 #include "term/term-color-types.h"
15 #include "view/display-messages.h"
16 #include "view/display-player.h"
17 #include "window/display-sub-window-spells.h"
18 #include "window/display-sub-windows.h"
19 #include "window/main-window-left-frame.h"
20 #include "window/main-window-row-column.h"
21 #include "window/main-window-stat-poster.h"
22 #include "window/main-window-util.h"
23 #include "world/world-turn-processor.h"
24 #include "world/world.h"
27 * todo ここにplayer_type を追加するとz-termに影響が行くので保留
28 * @brief コンソールを再描画する /
29 * Redraw a term when it is resized
32 void redraw_window(void)
34 if (!current_world_ptr->character_dungeon)
37 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
38 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
45 * @brief 現在のマップ名を描画する / Print dungeon
46 * @param creature_ptr プレーヤーへの参照ポインタ
49 static void print_dungeon(player_type *creature_ptr)
51 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
52 concptr dungeon_name = map_name(creature_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"
63 * @details 更新処理の対象はゲーム中の全描画処理
65 void redraw_stuff(player_type *creature_ptr)
67 if (!creature_ptr->redraw)
70 if (!current_world_ptr->character_generated)
73 if (current_world_ptr->character_icky)
76 if (creature_ptr->redraw & (PR_WIPE)) {
77 creature_ptr->redraw &= ~(PR_WIPE);
82 if (creature_ptr->redraw & (PR_MAP)) {
83 creature_ptr->redraw &= ~(PR_MAP);
84 print_map(creature_ptr);
87 if (creature_ptr->redraw & (PR_BASIC)) {
88 creature_ptr->redraw &= ~(PR_BASIC);
89 creature_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
90 creature_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
91 creature_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
92 creature_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
93 print_frame_basic(creature_ptr);
94 print_time(creature_ptr);
95 print_dungeon(creature_ptr);
98 if (creature_ptr->redraw & (PR_EQUIPPY)) {
99 creature_ptr->redraw &= ~(PR_EQUIPPY);
100 display_player_equippy(creature_ptr, ROW_EQUIPPY, COL_EQUIPPY, 0);
103 if (creature_ptr->redraw & (PR_MISC)) {
104 creature_ptr->redraw &= ~(PR_MISC);
105 print_field(rp_ptr->title, ROW_RACE, COL_RACE);
108 if (creature_ptr->redraw & (PR_TITLE)) {
109 creature_ptr->redraw &= ~(PR_TITLE);
110 print_title(creature_ptr);
113 if (creature_ptr->redraw & (PR_LEV)) {
114 creature_ptr->redraw &= ~(PR_LEV);
115 print_level(creature_ptr);
118 if (creature_ptr->redraw & (PR_EXP)) {
119 creature_ptr->redraw &= ~(PR_EXP);
120 print_exp(creature_ptr);
123 if (creature_ptr->redraw & (PR_STATS)) {
124 creature_ptr->redraw &= ~(PR_STATS);
125 print_stat(creature_ptr, A_STR);
126 print_stat(creature_ptr, A_INT);
127 print_stat(creature_ptr, A_WIS);
128 print_stat(creature_ptr, A_DEX);
129 print_stat(creature_ptr, A_CON);
130 print_stat(creature_ptr, A_CHR);
133 if (creature_ptr->redraw & (PR_STATUS)) {
134 creature_ptr->redraw &= ~(PR_STATUS);
135 print_status(creature_ptr);
138 if (creature_ptr->redraw & (PR_ARMOR)) {
139 creature_ptr->redraw &= ~(PR_ARMOR);
140 print_ac(creature_ptr);
143 if (creature_ptr->redraw & (PR_HP)) {
144 creature_ptr->redraw &= ~(PR_HP);
145 print_hp(creature_ptr);
148 if (creature_ptr->redraw & (PR_MANA)) {
149 creature_ptr->redraw &= ~(PR_MANA);
150 print_sp(creature_ptr);
153 if (creature_ptr->redraw & (PR_GOLD)) {
154 creature_ptr->redraw &= ~(PR_GOLD);
155 print_gold(creature_ptr);
158 if (creature_ptr->redraw & (PR_DEPTH)) {
159 creature_ptr->redraw &= ~(PR_DEPTH);
160 print_depth(creature_ptr);
163 if (creature_ptr->redraw & (PR_HEALTH)) {
164 creature_ptr->redraw &= ~(PR_HEALTH);
165 health_redraw(creature_ptr, FALSE);
168 if (creature_ptr->redraw & (PR_UHEALTH)) {
169 creature_ptr->redraw &= ~(PR_UHEALTH);
170 health_redraw(creature_ptr, TRUE);
173 if (creature_ptr->redraw & (PR_EXTRA)) {
174 creature_ptr->redraw &= ~(PR_EXTRA);
175 creature_ptr->redraw &= ~(PR_CUT | PR_STUN);
176 creature_ptr->redraw &= ~(PR_HUNGER);
177 creature_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
178 print_frame_extra(creature_ptr);
181 if (creature_ptr->redraw & (PR_CUT)) {
182 creature_ptr->redraw &= ~(PR_CUT);
183 print_cut(creature_ptr);
186 if (creature_ptr->redraw & (PR_STUN)) {
187 creature_ptr->redraw &= ~(PR_STUN);
188 print_stun(creature_ptr);
191 if (creature_ptr->redraw & (PR_HUNGER)) {
192 creature_ptr->redraw &= ~(PR_HUNGER);
193 print_hunger(creature_ptr);
196 if (creature_ptr->redraw & (PR_STATE)) {
197 creature_ptr->redraw &= ~(PR_STATE);
198 print_state(creature_ptr);
201 if (creature_ptr->redraw & (PR_SPEED)) {
202 creature_ptr->redraw &= ~(PR_SPEED);
203 print_speed(creature_ptr);
206 if (creature_ptr->pclass == CLASS_IMITATOR) {
207 if (creature_ptr->redraw & (PR_IMITATION)) {
208 creature_ptr->redraw &= ~(PR_IMITATION);
209 print_imitation(creature_ptr);
215 if (creature_ptr->redraw & (PR_STUDY)) {
216 creature_ptr->redraw &= ~(PR_STUDY);
217 print_study(creature_ptr);
222 * @brief player_ptr->window のフラグに応じた更新をまとめて行う / Handle "player_ptr->window"
223 * @param player_ptr プレーヤーへの参照ポインタ
225 * @details 更新処理の対象はサブウィンドウ全般
227 void window_stuff(player_type *player_ptr)
229 if (!player_ptr->window)
232 if (!need_term_fresh())
236 for (int j = 0; j < 8; j++) {
238 mask |= window_flag[j];
241 player_ptr->window &= mask;
243 if (!player_ptr->window)
246 if (player_ptr->window & (PW_INVEN)) {
247 player_ptr->window &= ~(PW_INVEN);
248 fix_inventory(player_ptr, 0); // TODO:2.2.2 まともなtval参照手段を確保
251 if (player_ptr->window & (PW_EQUIP)) {
252 player_ptr->window &= ~(PW_EQUIP);
253 fix_equip(player_ptr, 0); // TODO:2.2.2 まともなtval参照手段を確保
256 if (player_ptr->window & (PW_SPELL)) {
257 player_ptr->window &= ~(PW_SPELL);
258 fix_spell(player_ptr);
261 if (player_ptr->window & (PW_PLAYER)) {
262 player_ptr->window &= ~(PW_PLAYER);
263 fix_player(player_ptr);
266 if (player_ptr->window & (PW_MONSTER_LIST)) {
267 player_ptr->window &= ~(PW_MONSTER_LIST);
268 fix_monster_list(player_ptr);
271 if (player_ptr->window & (PW_MESSAGE)) {
272 player_ptr->window &= ~(PW_MESSAGE);
276 if (player_ptr->window & (PW_OVERHEAD)) {
277 player_ptr->window &= ~(PW_OVERHEAD);
278 fix_overhead(player_ptr);
281 if (player_ptr->window & (PW_DUNGEON)) {
282 player_ptr->window &= ~(PW_DUNGEON);
283 fix_dungeon(player_ptr);
286 if (player_ptr->window & (PW_MONSTER)) {
287 player_ptr->window &= ~(PW_MONSTER);
288 fix_monster(player_ptr);
291 if (player_ptr->window & (PW_OBJECT)) {
292 player_ptr->window &= ~(PW_OBJECT);
293 fix_object(player_ptr);