Hengband
2.2.1
|
データ構造 | |
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]]" [詳解] | |
#define is_seen | ( | A | ) |
#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)
#define PROJECT_BEAM 0x0002 |
遠隔攻撃特性: ビーム範囲を持つ。 / Work as a beam weapon (affect every grid passed through)
#define PROJECT_DISI 0x0100 |
遠隔攻撃特性: / Disintegrate non-permanent features
#define PROJECT_FAST 0x4000 |
遠隔攻撃特性: / Hide "visual" of flying bolts until blast
#define PROJECT_GRID 0x0010 |
遠隔攻撃特性: 射程内の地形に影響を及ぼす / Affect each grid in the "blast area" in some way
#define PROJECT_HIDE 0x0080 |
遠隔攻撃特性: / Hack – disable "visual" feedback from projection
#define PROJECT_ITEM 0x0020 |
遠隔攻撃特性: 射程内のアイテムに影響を及ぼす / Affect each object in the "blast area" in some way
#define PROJECT_JUMP 0x0001 |
遠隔攻撃特性: 発動者からの軌跡を持たず、指定地点に直接発生する(予め置いたトラップ、上空からの発生などのイメージ) / Jump directly to the target location (this is a hack)
#define PROJECT_KILL 0x0040 |
遠隔攻撃特性: 射程内のモンスターに影響を及ぼす / Affect each monster in the "blast area" in some way
#define PROJECT_LOS 0x8000 |
遠隔攻撃特性: /
#define PROJECT_NO_HANGEKI 0x1000 |
遠隔攻撃特性: / Avoid counter attacks of monsters
#define PROJECT_PATH 0x2000 |
遠隔攻撃特性: / Only used for printing project path
#define PROJECT_PLAYER 0x0200 |
遠隔攻撃特性: / Main target is player (used for riding player)
#define PROJECT_REFLECTABLE 0x0800 |
遠隔攻撃特性: 反射可能(ボルト系魔法に利用) / Refrectable spell attacks (used for "bolts")
#define PROJECT_STOP 0x0008 |
遠隔攻撃特性: 道中にプレイヤーかモンスターがいた時点で到達地点を更新して停止する(壁や森はPROJECT_DISIがない限り最初から貫通しない)
#define PROJECT_THRU 0x0004 |
遠隔攻撃特性: 目標地点に到達しても射程と遮蔽の限り引き延ばす。 / Continue "through" the target (used for "bolts"/"beams")
#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".対象グリッドの一覧をまとめる構造体
typedef struct player_type player_type |
DIRECTION coords_to_dir | ( | player_type * | creature_ptr, |
POSITION | y, | ||
POSITION | x | ||
) |
プレイヤーから指定の座標がどの方角にあるかを返す / Convert an adjacent location to a direction.
y | 方角を確認したY座標 |
x | 方角を確認したX座標 |
2点間の距離をニュートン・ラプソン法で算出する / Distance between two points via Newton-Raphson technique
y1 | 1点目のy座標 |
x1 | 1点目のx座標 |
y2 | 2点目のy座標 |
x2 | 2点目のx座標 |
bool no_lite | ( | void | ) |
指定された座標をプレイヤー収められていない状態かどうか / Returns true if the player's grid is dark
player_can_see_bold()関数の返り値の否定を返している。
指定された座標をプレイヤーが視覚に収められるかを返す。 / Can the player "see" the given grid in detail?
y | y座標 |
x | x座標 |
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.
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()".
const POSITION cdd[8] |
キーパッドの円環状方向配列 / Circular keypad direction array
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 ddx_cdd[8] |
cdd越しにベクトルのX軸成分を定義 / Global arrays for optimizing "ddx[cdd[i]]" and "ddy[cdd[i]]"
const POSITION ddx_ddd[9] |
ddd越しにベクトルのX軸成分を定義 / Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]"
const POSITION ddy[10] |
dddで定義した順にベクトルのY軸成分を定義 / Global arrays for converting "keypad direction" into offsets
const POSITION ddy_cdd[8] |
cdd越しにベクトルのY軸成分を定義 / Global arrays for optimizing "ddx[cdd[i]]" and "ddy[cdd[i]]"
const POSITION ddy_ddd[9] |
ddd越しにベクトルのY軸成分を定義 / Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]"