2 * @brief 雑多なその他の処理2 / effects of various "objects"
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.
12 #include "target/target-checker.h"
13 #include "core/player-redraw-types.h"
14 #include "core/player-update-types.h"
15 #include "core/window-redrawer.h"
16 #include "core/disturbance.h"
17 #include "game-option/disturbance-options.h"
18 #include "game-option/map-screen-options.h"
19 #include "io/cursor.h"
20 #include "io/screen-util.h"
21 #include "system/floor-type-definition.h"
22 #include "system/monster-type-definition.h"
23 #include "system/player-type-definition.h"
24 #include "target/target-preparation.h"
25 #include "target/target-types.h"
26 #include "window/main-window-util.h"
28 /* Targetting variables */
29 MONSTER_IDX target_who;
34 * @brief マップ描画のフォーカスを当てるべき座標を更新する
35 * @param player_ptr プレイヤーへの参照ポインタ
37 * Given an row (y) and col (x), this routine detects when a move
38 * off the screen has occurred and figures new borders. -RAK-
39 * "Update" forces a "full update" to take place.
40 * The map is reprinted if necessary, and "TRUE" is returned.
41 * @return 実際に再描画が必要だった場合TRUEを返す
43 void verify_panel(PlayerType *player_ptr)
45 POSITION y = player_ptr->y;
46 POSITION x = player_ptr->x;
48 get_screen_size(&wid, &hgt);
49 int max_prow_min = player_ptr->current_floor_ptr->height - hgt;
50 int max_pcol_min = player_ptr->current_floor_ptr->width - wid;
58 if (center_player && (center_running || !player_ptr->running)) {
59 prow_min = y - hgt / 2;
62 else if (prow_min > max_prow_min)
63 prow_min = max_prow_min;
65 pcol_min = x - wid / 2;
68 else if (pcol_min > max_pcol_min)
69 pcol_min = max_pcol_min;
71 prow_min = panel_row_min;
72 pcol_min = panel_col_min;
73 if (y > panel_row_max - 2)
74 while (y > prow_min + hgt - 1 - 2)
75 prow_min += (hgt / 2);
77 if (y < panel_row_min + 2)
78 while (y < prow_min + 2)
79 prow_min -= (hgt / 2);
81 if (prow_min > max_prow_min)
82 prow_min = max_prow_min;
87 if (x > panel_col_max - 4)
88 while (x > pcol_min + wid - 1 - 4)
89 pcol_min += (wid / 2);
91 if (x < panel_col_min + 4)
92 while (x < pcol_min + 4)
93 pcol_min -= (wid / 2);
95 if (pcol_min > max_pcol_min)
96 pcol_min = max_pcol_min;
102 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min))
105 panel_row_min = prow_min;
106 panel_col_min = pcol_min;
107 if (disturb_panel && !center_player)
108 disturb(player_ptr, false, false);
110 panel_bounds_center();
111 player_ptr->update |= PU_MONSTERS;
112 player_ptr->redraw |= PR_MAP;
113 player_ptr->window_flags |= PW_OVERHEAD | PW_DUNGEON;
117 * Update (if necessary) and verify (if possible) the target.
118 * We return TRUE if the target is "okay" and FALSE otherwise.
120 bool target_okay(PlayerType *player_ptr)
128 if (!target_able(player_ptr, target_who))
131 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[target_who];
132 target_row = m_ptr->fy;
133 target_col = m_ptr->fx;