1 #include "view/display-sub-windows.h"
2 #include "floor/floor.h"
3 #include "game-option/option-flags.h"
4 #include "game-option/special-options.h"
6 #include "inventory/player-inventory.h"
7 #include "io/input-key-processor.h"
8 #include "io/targeting.h"
9 #include "monster-race/monster-race.h"
10 #include "monster-race/race-flags1.h"
11 #include "monster/monster-flag-types.h"
12 #include "monster/monster-info.h"
13 #include "spell/spells3.h"
14 #include "system/monster-type-definition.h"
15 #include "term/gameterm.h"
16 #include "term/term-color-types.h"
17 #include "view/display-main-window.h" // todo 相互依存している、後で何とかする.
18 #include "view/display-messages.h"
19 #include "view/display-lore.h"
20 #include "view/display-player.h"
21 #include "view/main-window-util.h"
22 #include "view/object-describer.h"
23 #include "world/world.h"
26 * @brief サブウィンドウに所持品一覧を表示する / Hack -- display inventory in sub-windows
27 * @param player_ptr プレーヤーへの参照ポインタ
30 void fix_inventory(player_type *player_ptr, tval_type item_tester_tval)
32 for (int j = 0; j < 8; j++) {
37 if (!(window_flag[j] & (PW_INVEN)))
40 Term_activate(angband_term[j]);
41 display_inventory(player_ptr, item_tester_tval);
48 * @brief モンスターの現在数を一行で表現する / Print monster info in line
51 * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
52 * @param n_same モンスターの数の現在数
56 * nnn : number or unique(U) or wanted unique(W)
57 * X : symbol of monster
58 * LV : monster lv if known
59 * name: name of monster
63 static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type *m_ptr, int n_same)
66 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
67 monster_race *r_ptr = &r_info[r_idx];
72 if (r_ptr->flags1 & RF1_UNIQUE) {
73 bool is_bounty = FALSE;
74 for (int i = 0; i < MAX_BOUNTY; i++) {
75 if (current_world_ptr->bounty_r_idx[i] == r_idx) {
81 Term_addstr(-1, TERM_WHITE, is_bounty ? " W" : " U");
83 sprintf(buf, "%3d", n_same);
84 Term_addstr(-1, TERM_WHITE, buf);
87 Term_addstr(-1, TERM_WHITE, " ");
88 Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
90 if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)) {
91 sprintf(buf, " %2d", (int)r_ptr->level);
96 Term_addstr(-1, TERM_WHITE, buf);
98 sprintf(buf, " %s ", r_name + r_ptr->name);
99 Term_addstr(-1, TERM_WHITE, buf);
103 * @brief モンスターの出現リストを表示する / Print monster info in line
106 * @param max_lines 最大何行描画するか
108 void print_monster_list(floor_type *floor_ptr, TERM_LEN x, TERM_LEN y, TERM_LEN max_lines)
111 monster_type *last_mons = NULL;
112 monster_type *m_ptr = NULL;
115 for (i = 0; i < tmp_pos.n; i++) {
116 grid_type *g_ptr = &floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
117 if (!g_ptr->m_idx || !floor_ptr->m_list[g_ptr->m_idx].ml)
119 m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
125 //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する.
134 if (last_mons->ap_r_idx == m_ptr->ap_r_idx) {
136 continue; //表示処理を次に回す
139 // print last mons info
140 print_monster_line(x, line++, last_mons, n_same);
143 if (line - y - 1 == max_lines)
147 if (line - y - 1 == max_lines && i != tmp_pos.n) {
148 Term_gotoxy(x, line);
149 Term_addstr(-1, TERM_WHITE, "-- and more --");
152 print_monster_line(x, line++, last_mons, n_same);
157 * @brief 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
158 * @param player_ptr プレーヤーへの参照ポインタ
161 void fix_monster_list(player_type *player_ptr)
163 for (int j = 0; j < 8; j++) {
165 if (!angband_term[j])
167 if (!(window_flag[j] & (PW_MONSTER_LIST)))
170 Term_activate(angband_term[j]);
172 Term_get_size(&w, &h);
174 target_set_prepare_look(player_ptr);
175 print_monster_list(player_ptr->current_floor_ptr, 0, 0, h);
182 * @brief 現在の装備品をサブウィンドウに表示する /
183 * Hack -- display equipment in sub-windows
184 * @param player_ptr プレーヤーへの参照ポインタ
187 void fix_equip(player_type *player_ptr, tval_type item_tester_tval)
189 for (int j = 0; j < 8; j++) {
191 if (!angband_term[j])
193 if (!(window_flag[j] & (PW_EQUIP)))
196 Term_activate(angband_term[j]);
197 display_equipment(player_ptr, item_tester_tval);
204 * @brief 現在の習得済魔法をサブウィンドウに表示する /
205 * @param player_ptr プレーヤーへの参照ポインタ
206 * Hack -- display spells in sub-windows
209 void fix_spell(player_type *player_ptr)
211 for (int j = 0; j < 8; j++) {
213 if (!angband_term[j])
216 if (!(window_flag[j] & (PW_SPELL)))
219 Term_activate(angband_term[j]);
220 display_spell_list(player_ptr);
227 * @brief 現在のプレイヤーステータスをサブウィンドウに表示する /
228 * @param player_ptr プレーヤーへの参照ポインタ
229 * Hack -- display character in sub-windows
232 void fix_player(player_type *player_ptr)
234 for (int j = 0; j < 8; j++) {
236 if (!angband_term[j])
239 if (!(window_flag[j] & (PW_PLAYER)))
242 Term_activate(angband_term[j]);
244 display_player(player_ptr, 0, map_name);
251 * @brief ゲームメッセージ履歴をサブウィンドウに表示する /
252 * Hack -- display recent messages in sub-windows
253 * Adjust for width and split messages
256 void fix_message(void)
258 for (int j = 0; j < 8; j++) {
260 if (!angband_term[j])
263 if (!(window_flag[j] & (PW_MESSAGE)))
266 Term_activate(angband_term[j]);
268 Term_get_size(&w, &h);
269 for (int i = 0; i < h; i++) {
270 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
273 Term_erase(x, y, 255);
282 * @brief 簡易マップをサブウィンドウに表示する /
283 * Hack -- display overhead view in sub-windows
284 * Adjust for width and split messages
285 * @param player_ptr プレーヤーへの参照ポインタ
288 * Note that the "player" symbol does NOT appear on the map.
290 void fix_overhead(player_type *player_ptr)
292 for (int j = 0; j < 8; j++) {
295 if (!angband_term[j])
298 if (!(window_flag[j] & (PW_OVERHEAD)))
301 Term_activate(angband_term[j]);
302 Term_get_size(&wid, &hgt);
303 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2) {
305 display_map(player_ptr, &cy, &cx);
313 static void display_dungeon(player_type *player_ptr)
316 SYMBOL_CODE tc = '\0';
318 for (TERM_LEN x = player_ptr->x - Term->wid / 2 + 1; x <= player_ptr->x + Term->wid / 2; x++) {
319 for (TERM_LEN y = player_ptr->y - Term->hgt / 2 + 1; y <= player_ptr->y + Term->hgt / 2; y++) {
322 if (!in_bounds2(player_ptr->current_floor_ptr, y, x)) {
323 feature_type *f_ptr = &f_info[feat_none];
324 a = f_ptr->x_attr[F_LIT_STANDARD];
325 c = f_ptr->x_char[F_LIT_STANDARD];
326 Term_queue_char(x - player_ptr->x + Term->wid / 2 - 1, y - player_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
330 map_info(player_ptr, y, x, &a, &c, &ta, &tc);
333 if (current_world_ptr->timewalk_m_idx)
335 else if (is_invuln(player_ptr) || player_ptr->timewalk)
337 else if (player_ptr->wraith_form)
341 Term_queue_char(x - player_ptr->x + Term->wid / 2 - 1, y - player_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
347 * @brief ダンジョンの地形をサブウィンドウに表示する /
348 * Hack -- display dungeon view in sub-windows
349 * @param player_ptr プレーヤーへの参照ポインタ
352 void fix_dungeon(player_type *player_ptr)
354 for (int j = 0; j < 8; j++) {
356 if (!angband_term[j])
359 if (!(window_flag[j] & (PW_DUNGEON)))
362 Term_activate(angband_term[j]);
363 display_dungeon(player_ptr);
370 * @brief モンスターの思い出をサブウィンドウに表示する /
371 * Hack -- display dungeon view in sub-windows
372 * @param player_ptr プレーヤーへの参照ポインタ
375 void fix_monster(player_type *player_ptr)
377 for (int j = 0; j < 8; j++) {
379 if (!angband_term[j])
382 if (!(window_flag[j] & (PW_MONSTER)))
385 Term_activate(angband_term[j]);
386 if (player_ptr->monster_race_idx)
387 display_roff(player_ptr);
395 * @brief ベースアイテム情報をサブウィンドウに表示する /
396 * Hack -- display object recall in sub-windows
397 * @param player_ptr プレーヤーへの参照ポインタ
400 void fix_object(player_type *player_ptr)
402 for (int j = 0; j < 8; j++) {
404 if (!angband_term[j])
407 if (!(window_flag[j] & (PW_OBJECT)))
410 Term_activate(angband_term[j]);
411 if (player_ptr->object_kind_idx)
412 display_koff(player_ptr, player_ptr->object_kind_idx);