OSDN Git Service

[Refactor] #39970 Reshaped world-movement-processor.c
[hengband/hengband.git] / src / geometry.h
1 #pragma once
2
3 typedef struct player_type player_type;
4
5 extern const POSITION ddd[9];
6 extern const POSITION ddx[10];
7 extern const POSITION ddy[10];
8 extern const POSITION ddx_ddd[9];
9 extern const POSITION ddy_ddd[9];
10 extern const POSITION cdd[8];
11 extern const POSITION ddx_cdd[8];
12 extern const POSITION ddy_cdd[8];
13
14 extern DIRECTION coords_to_dir(player_type *creature_ptr, POSITION y, POSITION x);
15
16 extern POSITION distance(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
17
18 extern void mmove2(POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POSITION x2);
19
20 extern bool player_can_see_bold(player_type *creature_ptr, POSITION y, POSITION x);
21
22 /*!
23  * @brief 視界及び光源の過渡処理配列サイズ / Maximum size of the "temp" array
24  * @details We must be as large as "VIEW_MAX" and "LITE_MAX" for proper functioning
25  * of "update_view()" and "update_lite()".  We must also be as large as the
26  * largest illuminatable room, but no room is larger than 800 grids.  We
27  * must also be large enough to allow "good enough" use as a circular queue,
28  * to calculate monster flow, but note that the flow code is "paranoid".
29  */
30 #define TEMP_MAX 2298
31
32 //!< 対象グリッドの一覧をまとめる構造体
33 typedef struct
34 {
35         POSITION_IDX n; //!< Array of grids for use by various functions (see grid.c")
36         POSITION y[TEMP_MAX];
37         POSITION x[TEMP_MAX];
38 } pos_list;
39
40 //!< ターゲット指定構造体
41 typedef struct
42 {
43         DIRECTION dir;
44         POSITION y;
45         POSITION x;
46 } target_dir;
47
48 /*
49  * Simple structure to hold a map location
50  */
51 typedef struct coord coord;
52
53 struct coord
54 {
55         POSITION y;
56         POSITION x;
57 };
58
59 /*
60  * Is the monster seen by the player?
61  */
62 #define is_seen(A) \
63         ((bool)((A)->ml && (!ignore_unview || p_ptr->phase_out || \
64          (player_can_see_bold(p_ptr, (A)->fy, (A)->fx) && projectable(p_ptr, p_ptr->y, p_ptr->x, (A)->fy, (A)->fx)))))
65
66 /*
67  * todo is_seen() の関数マクロをバラそうとしたがインクルード関係のコンパイルエラーで失敗
68  * Is the monster seen by the player?
69  * @param creature_ptr プレーヤーへの参照ポインタ
70  * @param m_ptr 個々のモンスターへの参照ポインタ
71  * @return 個々のモンスターがプレーヤーが見えたらTRUE
72  */
73
74 /*
75 extern bool is_seen(player_type *creature_ptr, monster_type *m_ptr);
76 bool is_seen(player_type *creature_ptr, monster_type *m_ptr)
77 {
78         bool is_inside_view = !ignore_unview;
79         is_inside_view |= creature_ptr->phase_out;
80         is_inside_view |= player_can_see_bold(creature_ptr, m_ptr->fy, m_ptr->fx) &&
81                 projectable(creature_ptr, creature_ptr->y, creature_ptr->x, m_ptr->fy, m_ptr->fx);
82         return m_ptr->ml && is_inside_view;
83 }
84
85 */