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 "target/target-preparation.h"
24 #include "target/target-types.h"
25 #include "window/main-window-util.h"
27 /* Targetting variables */
28 MONSTER_IDX target_who;
33 * @brief マップ描画のフォーカスを当てるべき座標を更新する
34 * @param creature_ptr プレーヤーへの参照ポインタ
36 * Given an row (y) and col (x), this routine detects when a move
37 * off the screen has occurred and figures new borders. -RAK-
38 * "Update" forces a "full update" to take place.
39 * The map is reprinted if necessary, and "TRUE" is returned.
40 * @return 実際に再描画が必要だった場合TRUEを返す
42 void verify_panel(player_type *creature_ptr)
44 POSITION y = creature_ptr->y;
45 POSITION x = creature_ptr->x;
47 get_screen_size(&wid, &hgt);
48 int max_prow_min = creature_ptr->current_floor_ptr->height - hgt;
49 int max_pcol_min = creature_ptr->current_floor_ptr->width - wid;
57 if (center_player && (center_running || !creature_ptr->running)) {
58 prow_min = y - hgt / 2;
61 else if (prow_min > max_prow_min)
62 prow_min = max_prow_min;
64 pcol_min = x - wid / 2;
67 else if (pcol_min > max_pcol_min)
68 pcol_min = max_pcol_min;
70 prow_min = panel_row_min;
71 pcol_min = panel_col_min;
72 if (y > panel_row_max - 2)
73 while (y > prow_min + hgt - 1 - 2)
74 prow_min += (hgt / 2);
76 if (y < panel_row_min + 2)
77 while (y < prow_min + 2)
78 prow_min -= (hgt / 2);
80 if (prow_min > max_prow_min)
81 prow_min = max_prow_min;
86 if (x > panel_col_max - 4)
87 while (x > pcol_min + wid - 1 - 4)
88 pcol_min += (wid / 2);
90 if (x < panel_col_min + 4)
91 while (x < pcol_min + 4)
92 pcol_min -= (wid / 2);
94 if (pcol_min > max_pcol_min)
95 pcol_min = max_pcol_min;
101 if ((prow_min == panel_row_min) && (pcol_min == panel_col_min))
104 panel_row_min = prow_min;
105 panel_col_min = pcol_min;
106 if (disturb_panel && !center_player)
107 disturb(creature_ptr, FALSE, FALSE);
109 panel_bounds_center();
110 creature_ptr->update |= PU_MONSTERS;
111 creature_ptr->redraw |= PR_MAP;
112 creature_ptr->window |= PW_OVERHEAD | PW_DUNGEON;
116 * Update (if necessary) and verify (if possible) the target.
117 * We return TRUE if the target is "okay" and FALSE otherwise.
119 bool target_okay(player_type *creature_ptr)
127 if (!target_able(creature_ptr, target_who))
130 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[target_who];
131 target_row = m_ptr->fy;
132 target_col = m_ptr->fx;