Hengband  2.2.1
データ構造 | マクロ定義 | 型定義 | 関数 | 変数
geometry.h ファイル
被依存関係図:

[ソースコード]

データ構造

struct  pos_list
 
struct  target_dir
 
struct  coord
 

マクロ定義

#define PROJECT_JUMP   0x0001
 遠隔攻撃特性: 発動者からの軌跡を持たず、指定地点に直接発生する(予め置いたトラップ、上空からの発生などのイメージ) / Jump directly to the target location (this is a hack) [詳解]
 
#define PROJECT_BEAM   0x0002
 遠隔攻撃特性: ビーム範囲を持つ。 / Work as a beam weapon (affect every grid passed through) [詳解]
 
#define PROJECT_THRU   0x0004
 遠隔攻撃特性: 目標地点に到達しても射程と遮蔽の限り引き延ばす。 / Continue "through" the target (used for "bolts"/"beams") [詳解]
 
#define PROJECT_STOP   0x0008
 遠隔攻撃特性: 道中にプレイヤーかモンスターがいた時点で到達地点を更新して停止する(壁や森はPROJECT_DISIがない限り最初から貫通しない) [詳解]
 
#define PROJECT_GRID   0x0010
 遠隔攻撃特性: 射程内の地形に影響を及ぼす / Affect each grid in the "blast area" in some way [詳解]
 
#define PROJECT_ITEM   0x0020
 遠隔攻撃特性: 射程内のアイテムに影響を及ぼす / Affect each object in the "blast area" in some way [詳解]
 
#define PROJECT_KILL   0x0040
 遠隔攻撃特性: 射程内のモンスターに影響を及ぼす / Affect each monster in the "blast area" in some way [詳解]
 
#define PROJECT_HIDE   0x0080
 遠隔攻撃特性: / Hack – disable "visual" feedback from projection [詳解]
 
#define PROJECT_DISI   0x0100
 遠隔攻撃特性: / Disintegrate non-permanent features [詳解]
 
#define PROJECT_PLAYER   0x0200
 遠隔攻撃特性: / Main target is player (used for riding player) [詳解]
 
#define PROJECT_AIMED   0x0400
 遠隔攻撃特性: / Target is only player or monster, so don't affect another. [詳解]
 
#define PROJECT_REFLECTABLE   0x0800
 遠隔攻撃特性: 反射可能(ボルト系魔法に利用) / Refrectable spell attacks (used for "bolts") [詳解]
 
#define PROJECT_NO_HANGEKI   0x1000
 遠隔攻撃特性: / Avoid counter attacks of monsters [詳解]
 
#define PROJECT_PATH   0x2000
 遠隔攻撃特性: / Only used for printing project path [詳解]
 
#define PROJECT_FAST   0x4000
 遠隔攻撃特性: / Hide "visual" of flying bolts until blast [詳解]
 
#define PROJECT_LOS   0x8000
 遠隔攻撃特性: / [詳解]
 
#define TEMP_MAX   2298
 視界及び光源の過渡処理配列サイズ / Maximum size of the "temp" array (see "p_ptr->current_floor_ptr->grid_array.c") [詳解]
 
#define is_seen(A)
 

型定義

typedef struct player_type player_type
 
typedef struct coord coord
 

関数

DIRECTION coords_to_dir (player_type *creature_ptr, POSITION y, POSITION x)
 プレイヤーから指定の座標がどの方角にあるかを返す / Convert an adjacent location to a direction. [詳解]
 
sint project_path (u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
 始点から終点への直線経路を返す / Determine the path taken by a projection. [詳解]
 
POSITION distance (POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 2点間の距離をニュートン・ラプソン法で算出する / Distance between two points via Newton-Raphson technique [詳解]
 
void scatter (POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode)
 
void mmove2 (POSITION *y, POSITION *x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 
bool player_can_see_bold (POSITION y, POSITION x)
 指定された座標をプレイヤーが視覚に収められるかを返す。 / Can the player "see" the given grid in detail? [詳解]
 
bool no_lite (void)
 指定された座標をプレイヤー収められていない状態かどうか / Returns true if the player's grid is dark [詳解]
 

変数

const POSITION ddd [9]
 キーパッドの方向を南から反時計回り順に列挙 / Global array for looping through the "keypad directions" [詳解]
 
const POSITION ddx [10]
 dddで定義した順にベクトルのX軸成分を定義 / Global arrays for converting "keypad direction" into offsets [詳解]
 
const POSITION ddy [10]
 dddで定義した順にベクトルのY軸成分を定義 / Global arrays for converting "keypad direction" into offsets [詳解]
 
const POSITION ddx_ddd [9]
 ddd越しにベクトルのX軸成分を定義 / Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]" [詳解]
 
const POSITION ddy_ddd [9]
 ddd越しにベクトルのY軸成分を定義 / Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]" [詳解]
 
const POSITION cdd [8]
 キーパッドの円環状方向配列 / Circular keypad direction array [詳解]
 
const POSITION ddx_cdd [8]
 cdd越しにベクトルのX軸成分を定義 / Global arrays for optimizing "ddx[cdd[i]]" and "ddy[cdd[i]]" [詳解]
 
const POSITION ddy_cdd [8]
 cdd越しにベクトルのY軸成分を定義 / Global arrays for optimizing "ddx[cdd[i]]" and "ddy[cdd[i]]" [詳解]
 

マクロ定義詳解

◆ is_seen

#define is_seen (   A)
値:
((bool)((A)->ml && (!ignore_unview || p_ptr->phase_out || \
(player_can_see_bold((A)->fy, (A)->fx) && projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, (A)->fy, (A)->fx)))))
POSITION x
Definition: player-status.h:723
bool projectable(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
Definition: floor.c:550
floor_type * current_floor_ptr
Definition: player-status.h:92
POSITION y
Definition: player-status.h:722
bool player_can_see_bold(POSITION y, POSITION x)
指定された座標をプレイヤーが視覚に収められるかを返す。 / Can the player "see" the given grid in detail?
Definition: geometry.c:538
char bool
bool型をcharとして定義 / Note that a bool is smaller than a full "int" / Simple True/False type
Definition: h-type.h:83
player_type * p_ptr
Definition: player-status.c:1288
bool phase_out
フェイズアウト状態(闘技場観戦状態などに利用、NPCの処理の対象にならず自身もほとんどの行動ができない)
Definition: player-status.h:128

◆ PROJECT_AIMED

#define PROJECT_AIMED   0x0400

遠隔攻撃特性: / Target is only player or monster, so don't affect another.

Depend on PROJECT_PLAYER. (used for minimum (rad == 0) balls on riding player)

◆ PROJECT_BEAM

#define PROJECT_BEAM   0x0002

遠隔攻撃特性: ビーム範囲を持つ。 / Work as a beam weapon (affect every grid passed through)

◆ PROJECT_DISI

#define PROJECT_DISI   0x0100

遠隔攻撃特性: / Disintegrate non-permanent features

◆ PROJECT_FAST

#define PROJECT_FAST   0x4000

遠隔攻撃特性: / Hide "visual" of flying bolts until blast

◆ PROJECT_GRID

#define PROJECT_GRID   0x0010

遠隔攻撃特性: 射程内の地形に影響を及ぼす / Affect each grid in the "blast area" in some way

◆ PROJECT_HIDE

#define PROJECT_HIDE   0x0080

遠隔攻撃特性: / Hack – disable "visual" feedback from projection

◆ PROJECT_ITEM

#define PROJECT_ITEM   0x0020

遠隔攻撃特性: 射程内のアイテムに影響を及ぼす / Affect each object in the "blast area" in some way

◆ PROJECT_JUMP

#define PROJECT_JUMP   0x0001

遠隔攻撃特性: 発動者からの軌跡を持たず、指定地点に直接発生する(予め置いたトラップ、上空からの発生などのイメージ) / Jump directly to the target location (this is a hack)

◆ PROJECT_KILL

#define PROJECT_KILL   0x0040

遠隔攻撃特性: 射程内のモンスターに影響を及ぼす / Affect each monster in the "blast area" in some way

◆ PROJECT_LOS

#define PROJECT_LOS   0x8000

遠隔攻撃特性: /

◆ PROJECT_NO_HANGEKI

#define PROJECT_NO_HANGEKI   0x1000

遠隔攻撃特性: / Avoid counter attacks of monsters

◆ PROJECT_PATH

#define PROJECT_PATH   0x2000

遠隔攻撃特性: / Only used for printing project path

◆ PROJECT_PLAYER

#define PROJECT_PLAYER   0x0200

遠隔攻撃特性: / Main target is player (used for riding player)

◆ PROJECT_REFLECTABLE

#define PROJECT_REFLECTABLE   0x0800

遠隔攻撃特性: 反射可能(ボルト系魔法に利用) / Refrectable spell attacks (used for "bolts")

◆ PROJECT_STOP

#define PROJECT_STOP   0x0008

遠隔攻撃特性: 道中にプレイヤーかモンスターがいた時点で到達地点を更新して停止する(壁や森はPROJECT_DISIがない限り最初から貫通しない)

◆ PROJECT_THRU

#define PROJECT_THRU   0x0004

遠隔攻撃特性: 目標地点に到達しても射程と遮蔽の限り引き延ばす。 / Continue "through" the target (used for "bolts"/"beams")

◆ TEMP_MAX

#define TEMP_MAX   2298

視界及び光源の過渡処理配列サイズ / Maximum size of the "temp" array (see "p_ptr->current_floor_ptr->grid_array.c")

We must be as large as "VIEW_MAX" and "LITE_MAX" for proper functioning of "update_view()" and "update_lite()". We must also be as large as the largest illuminatable room, but no room is larger than 800 grids. We must also be large enough to allow "good enough" use as a circular queue, to calculate monster flow, but note that the flow code is "paranoid".対象グリッドの一覧をまとめる構造体

型定義詳解

◆ coord

typedef struct coord coord

◆ player_type

typedef struct player_type player_type

関数詳解

◆ coords_to_dir()

DIRECTION coords_to_dir ( player_type creature_ptr,
POSITION  y,
POSITION  x 
)

プレイヤーから指定の座標がどの方角にあるかを返す / Convert an adjacent location to a direction.

引数
y方角を確認したY座標
x方角を確認したX座標
戻り値
方向ID

◆ distance()

POSITION distance ( POSITION  y1,
POSITION  x1,
POSITION  y2,
POSITION  x2 
)

2点間の距離をニュートン・ラプソン法で算出する / Distance between two points via Newton-Raphson technique

引数
y11点目のy座標
x11点目のx座標
y22点目のy座標
x22点目のx座標
戻り値
2点間の距離

◆ mmove2()

void mmove2 ( POSITION y,
POSITION x,
POSITION  y1,
POSITION  x1,
POSITION  y2,
POSITION  x2 
)

◆ no_lite()

bool no_lite ( void  )

指定された座標をプレイヤー収められていない状態かどうか / Returns true if the player's grid is dark

戻り値
視覚に収められていないならTRUEを返す

player_can_see_bold()関数の返り値の否定を返している。

◆ player_can_see_bold()

bool player_can_see_bold ( POSITION  y,
POSITION  x 
)

指定された座標をプレイヤーが視覚に収められるかを返す。 / Can the player "see" the given grid in detail?

引数
yy座標
xx座標
戻り値
視覚に収められる状態ならTRUEを返す

He must have vision, illumination, and line of sight.

Note – "CAVE_LITE" is only set if the "torch" has "los()".
So, given "CAVE_LITE", we know that the grid is "fully visible".

Note that "CAVE_GLOW" makes little sense for a wall, since it would mean
that a wall is visible from any direction. That would be odd. Except
under wizard light, which might make sense. Thus, for walls, we require
not only that they be "CAVE_GLOW", but also, that they be adjacent to a
grid which is not only "CAVE_GLOW", but which is a non-wall, and which is
in line of sight of the player.

This extra check is expensive, but it provides a more "correct" semantics.

Note that we should not run this check on walls which are "outer walls" of
the dungeon, or we will induce a memory fault, but actually verifying all
of the locations would be extremely expensive.

Thus, to speed up the function, we assume that all "perma-walls" which are
"CAVE_GLOW" are "illuminated" from all sides. This is correct for all cases
except "vaults" and the "buildings" in town. But the town is a hack anyway,
and the player has more important things on his mind when he is attacking a
monster vault. It is annoying, but an extremely important optimization.

Note that "glowing walls" are only considered to be "illuminated" if the
grid which is next to the wall in the direction of the player is also a
"glowing" grid. This prevents the player from being able to "see" the
walls of illuminated rooms from a corridor outside the room.

◆ project_path()

sint project_path ( u16b gp,
POSITION  range,
POSITION  y1,
POSITION  x1,
POSITION  y2,
POSITION  x2,
BIT_FLAGS  flg 
)

始点から終点への直線経路を返す / Determine the path taken by a projection.

引数
gp経路座標リストを返す参照ポインタ
range距離
y1始点Y座標
x1始点X座標
y2終点Y座標
x2終点X座標
flgフラグID
戻り値
リストの長さ
The projection will always start from the grid (y1,x1), and will travel
towards the grid (y2,x2), touching one grid per unit of distance along
the major axis, and stopping when it enters the destination grid or a
wall grid, or has travelled the maximum legal distance of "range".
Note that "distance" in this function (as in the "update_view()" code)
is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
actually has an "octagon of projection" not a "circle of projection".
The path grids are saved into the grid array pointed to by "gp", and
there should be room for at least "range" grids in "gp".  Note that
due to the way in which distance is calculated, this function normally
uses fewer than "range" grids for the projection path, so the result
of this function should never be compared directly to "range".  Note
that the initial grid (y1,x1) is never saved into the grid array, not
even if the initial grid is also the final grid.
The "flg" flags can be used to modify the behavior of this function.
In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
semantics as they do for the "project" function, namely, that the path
will stop as soon as it hits a monster, or that the path will continue
through the destination grid, respectively.
The "PROJECT_JUMP" flag, which for the "project()" function means to
start at a special grid (which makes no sense in this function), means
that the path should be "angled" slightly if needed to avoid any wall
grids, allowing the player to "target" any grid which is in "view".
This flag is non-trivial and has not yet been implemented, but could
perhaps make use of the "vinfo" array (above).
This function returns the number of grids (if any) in the path.  This
function will return zero if and only if (y1,x1) and (y2,x2) are equal.
This algorithm is similar to, but slightly different from, the one used
by "update_view_los()", and very different from the one used by "los()".

◆ scatter()

void scatter ( POSITION yp,
POSITION xp,
POSITION  y,
POSITION  x,
POSITION  d,
BIT_FLAGS  mode 
)
呼び出し関係図:

変数詳解

◆ cdd

const POSITION cdd[8]

キーパッドの円環状方向配列 / Circular keypad direction array

◆ ddd

const POSITION ddd[9]

キーパッドの方向を南から反時計回り順に列挙 / Global array for looping through the "keypad directions"

◆ ddx

const POSITION ddx[10]

dddで定義した順にベクトルのX軸成分を定義 / Global arrays for converting "keypad direction" into offsets

◆ ddx_cdd

const POSITION ddx_cdd[8]

cdd越しにベクトルのX軸成分を定義 / Global arrays for optimizing "ddx[cdd[i]]" and "ddy[cdd[i]]"

◆ ddx_ddd

const POSITION ddx_ddd[9]

ddd越しにベクトルのX軸成分を定義 / Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]"

◆ ddy

const POSITION ddy[10]

dddで定義した順にベクトルのY軸成分を定義 / Global arrays for converting "keypad direction" into offsets

◆ ddy_cdd

const POSITION ddy_cdd[8]

cdd越しにベクトルのY軸成分を定義 / Global arrays for optimizing "ddx[cdd[i]]" and "ddy[cdd[i]]"

◆ ddy_ddd

const POSITION ddy_ddd[9]

ddd越しにベクトルのY軸成分を定義 / Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]"