OSDN Git Service

Merge remote-tracking branch 'remotes/hengbandosx/english-mind-edits' into feature...
[hengband/hengband.git] / src / io / screen-util.c
1 /*!
2  * @brief 画面描画のユーティリティ
3  * @date 2018/09/25
4  * @author
5  * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
6  * This software may be copied and distributed for educational, research, and\n
7  * not for profit purposes provided that this copyright and statement are\n
8  * included in all such copies.\n
9  * 2014 Deskull rearranged comment for Doxygen.
10  */
11
12 #include "io/screen-util.h"
13 #include "core/player-processor.h"
14 #include "core/player-redraw-types.h"
15 #include "core/player-update-types.h"
16 #include "core/stuff-handler.h"
17 #include "dungeon/dungeon.h"
18 #include "dungeon/quest.h"
19 #include "effect/effect-characteristics.h"
20 #include "effect/spells-effect-util.h"
21 #include "floor/floor-town.h"
22 #include "game-option/map-screen-options.h"
23 #include "game-option/special-options.h"
24 #include "grid/feature.h"
25 #include "grid/grid.h"
26 #include "io/cursor.h"
27 #include "io/input-key-acceptor.h"
28 #include "monster/monster-update.h"
29 #include "player/mimic-info-table.h"
30 #include "system/floor-type-definition.h"
31 #include "target/target-checker.h"
32 #include "term/screen-processor.h"
33 #include "term/term-color-types.h"
34 #include "util/bit-flags-calculator.h"
35 #include "view/display-map.h"
36 #include "window/main-window-row-column.h"
37 #include "window/main-window-util.h"
38 #include "world/world.h"
39
40 /*!
41  * todo ここにplayer_type を追加するとz-termに影響が行くので保留
42  * @brief コンソールのリサイズに合わせてマップを再描画する /
43  * Map resizing whenever the main term changes size
44  * @return なし
45  */
46 void resize_map()
47 {
48     if (!current_world_ptr->character_dungeon)
49         return;
50
51     panel_row_max = 0;
52     panel_col_max = 0;
53     panel_row_min = p_ptr->current_floor_ptr->height;
54     panel_col_min = p_ptr->current_floor_ptr->width;
55     verify_panel(p_ptr);
56
57     p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
58     p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
59     p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
60     p_ptr->update |= (PU_MONSTERS);
61     p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
62
63     handle_stuff(p_ptr);
64     term_redraw();
65
66     if (can_save)
67         move_cursor_relative(p_ptr->y, p_ptr->x);
68
69     term_fresh();
70 }
71
72 /*!
73  * @brief 現在のコンソール表示の縦横を返す。 /
74  * Get term size and calculate screen size
75  * @param wid_p コンソールの表示幅文字数を返す
76  * @param hgt_p コンソールの表示行数を返す
77  * @return なし
78  */
79 void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p)
80 {
81     term_get_size(wid_p, hgt_p);
82     *hgt_p -= ROW_MAP + 2;
83     *wid_p -= COL_MAP + 2;
84     if (use_bigtile)
85         *wid_p /= 2;
86 }
87
88 /*
89  * Determines if a map location is currently "on screen" -RAK-
90  * Note that "panel_contains(Y,X)" always implies "in_bounds2(Y,X)".
91  */
92 bool panel_contains(POSITION y, POSITION x) { return (y >= panel_row_min) && (y <= panel_row_max) && (x >= panel_col_min) && (x <= panel_col_max); }