Hengband  2.2.1
マクロ定義 | 関数 | 変数
grid.c ファイル

グリッドの実装 / low level dungeon routines -BEN- [詳解]

#include "angband.h"
#include "util.h"
#include "term.h"
#include "floor.h"
#include "world.h"
#include "object-flavor.h"
#include "object-hook.h"
#include "dungeon.h"
#include "floor-generate.h"
#include "grid.h"
#include "trap.h"
#include "rooms.h"
#include "monster.h"
#include "quest.h"
#include "feature.h"
#include "monster-status.h"
#include "player-status.h"
#include "player-effects.h"
#include "player-class.h"
#include "spells.h"
#include "view-mainwindow.h"
#include "realm-song.h"
grid.c の依存先関係図:

マクロ定義

#define MONSTER_FLOW_DEPTH   32
 敵のプレイヤーに対する移動道のりの最大値(この値以上は処理を打ち切る) / OPTION: Maximum flow depth when using "MONSTER_FLOW" [詳解]
 
#define FAF_DESTROY   0x01
 
#define FAF_NO_DROP   0x02
 
#define FAF_CRASH_GLASS   0x04
 
#define COMPLEX_WALL_ILLUMINATION
 照明状態を壁により影響を受ける、より複雑な判定に切り替えるマクロ [詳解]
 
#define update_local_illumination_aux(C, Y, X)
 対象座標のマスの照明状態を更新する際の補助処理マクロ [詳解]
 

関数

bool new_player_spot (player_type *creature_ptr)
 新規フロアに入りたてのプレイヤーをランダムな場所に配置する / Returns random co-ordinates for player/monster/object [詳解]
 
void place_random_door (POSITION y, POSITION x, bool room)
 所定の位置にさまざまな状態や種類のドアを配置する / Place a random type of door at the given location [詳解]
 
void place_closed_door (POSITION y, POSITION x, int type)
 所定の位置に各種の閉じたドアを配置する / Place a random type of normal door at the given location. [詳解]
 
static int next_to_corr (POSITION y1, POSITION x1)
 隣接4マスに存在する通路の数を返す / Count the number of "corridor" grids adjacent to the given grid. [詳解]
 
static bool possible_doorway (POSITION y, POSITION x)
 ドアを設置可能な地形かを返す / Determine if the given location is "between" two walls, and "next to" two corridor spaces. [詳解]
 
void try_door (POSITION y, POSITION x)
 ドアの設置を試みる / Places door at y, x position if at least 2 walls found [詳解]
 
void place_floor (POSITION x1, POSITION x2, POSITION y1, POSITION y2, bool light)
 長方形の空洞を生成する / Make an empty square floor, for the middle of rooms [詳解]
 
void place_room (POSITION x1, POSITION x2, POSITION y1, POSITION y2, bool light)
 長方形の部屋を生成する / Make an empty square room, only floor and wall grids [詳解]
 
void vault_objects (POSITION y, POSITION x, int num)
 特殊な部屋向けに各種アイテムを配置する / Create up to "num" objects near the given coordinates [詳解]
 
void vault_trap_aux (POSITION y, POSITION x, POSITION yd, POSITION xd)
 特殊な部屋向けに各種アイテムを配置する(vault_trapのサブセット) / Place a trap with a given displacement of point [詳解]
 
void vault_traps (POSITION y, POSITION x, POSITION yd, POSITION xd, int num)
 特殊な部屋向けに各種アイテムを配置する(メインルーチン) / Place some traps with a given displacement of given location [詳解]
 
bool get_is_floor (POSITION x, POSITION y)
 指定のマスが床系地形であるかを返す / Function that sees if a square is a floor. [詳解]
 
void set_floor (POSITION x, POSITION y)
 指定のマスを床地形に変える / Set a square to be floor. [詳解]
 
void place_bound_perm_wall (grid_type *g_ptr)
 マスにフロア端用の永久壁を配置する / Set boundary mimic and add "solid" perma-wall [詳解]
 
bool is_known_trap (grid_type *g_ptr)
 マスに看破済みの罠があるかの判定を行う。 / Return TRUE if the given grid is a known trap [詳解]
 
bool is_hidden_door (grid_type *g_ptr)
 マスに隠されたドアがあるかの判定を行う。 / Return TRUE if the given grid is a hidden closed door [詳解]
 
bool check_local_illumination (POSITION y, POSITION x)
 指定された座標のマスが現在照らされているかを返す。 / Check for "local" illumination [詳解]
 
void update_local_illumination (player_type *creature_ptr, POSITION y, POSITION x)
 指定された座標の照明状態を更新する / Update "local" illumination [詳解]
 
bool no_lite (void)
 指定された座標をプレイヤー収められていない状態かどうか / Returns true if the player's grid is dark [詳解]
 
void print_rel (SYMBOL_CODE c, TERM_COLOR a, TERM_LEN y, TERM_LEN x)
 
void note_spot (POSITION y, POSITION x)
 
void lite_spot (POSITION y, POSITION x)
 
void delayed_visual_update (void)
 
void update_flow (void)
 
void cave_set_feat (POSITION y, POSITION x, FEAT_IDX feat)
 
FEAT_IDX conv_dungeon_feat (FEAT_IDX newfeat)
 
FEAT_IDX feat_state (FEAT_IDX feat, int action)
 
void cave_alter_feat (POSITION y, POSITION x, int action)
 
void remove_mirror (POSITION y, POSITION x)
 
bool is_mirror_grid (grid_type *g_ptr)
 
bool is_glyph_grid (grid_type *g_ptr)
 
bool is_explosive_rune_grid (grid_type *g_ptr)
 
bool cave_monster_teleportable_bold (MONSTER_IDX m_idx, POSITION y, POSITION x, BIT_FLAGS mode)
 指定されたマスがモンスターのテレポート可能先かどうかを判定する。 [詳解]
 
bool cave_player_teleportable_bold (POSITION y, POSITION x, BIT_FLAGS mode)
 指定されたマスにプレイヤーがテレポート可能かどうかを判定する。 [詳解]
 
bool is_open (FEAT_IDX feat)
 地形は開くものであって、かつ開かれているかを返す / Attempt to open the given chest at the given location [詳解]
 
bool player_can_enter (FEAT_IDX feature, BIT_FLAGS16 mode)
 プレイヤーが地形踏破可能かを返す [詳解]
 

変数

static const byte feature_action_flags [FF_FLAG_MAX]
 地形状態フラグテーブル / The table of features' actions [詳解]
 
static POSITION flow_x = 0
 
static POSITION flow_y = 0
 

詳解

グリッドの実装 / low level dungeon routines -BEN-

日付
2013/12/30
著者
Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke

This software may be copied and distributed for educational, research,
and not for profit purposes provided that this copyright and statement
are included in all such copies. Other copyrights may also apply.

Support for Adam Bolt's tileset, lighting and transparency effects
by Robert Ruehlmann (rr9@a.nosp@m.ngba.nosp@m.nd.or.nosp@m.g)

2013 Deskull Doxygen向けのコメント整理

マクロ定義詳解

◆ COMPLEX_WALL_ILLUMINATION

#define COMPLEX_WALL_ILLUMINATION

照明状態を壁により影響を受ける、より複雑な判定に切り替えるマクロ

◆ FAF_CRASH_GLASS

#define FAF_CRASH_GLASS   0x04

◆ FAF_DESTROY

#define FAF_DESTROY   0x01

◆ FAF_NO_DROP

#define FAF_NO_DROP   0x02

◆ MONSTER_FLOW_DEPTH

#define MONSTER_FLOW_DEPTH   32

敵のプレイヤーに対する移動道のりの最大値(この値以上は処理を打ち切る) / OPTION: Maximum flow depth when using "MONSTER_FLOW"

◆ update_local_illumination_aux

#define update_local_illumination_aux (   C,
  Y,
 
)
値:
{ \
if (player_has_los_bold((C), (Y), (X))) \
{ \
/* Update the monster */ \
if ((C)->current_floor_ptr->grid_array[(Y)][(X)].m_idx) update_monster((C)->current_floor_ptr->grid_array[(Y)][(X)].m_idx, FALSE); \
\
/* Notice and redraw */ \
note_spot((Y), (X)); \
lite_spot((Y), (X)); \
} \
}
#define FALSE
コンパイル環境に定義がない場合のFALSE定義
Definition: h-define.h:31
void update_monster(MONSTER_IDX m_idx, bool full)
モンスターの各情報を更新する / This function updates the monster record of the given monster
Definition: monster2.c:1840
#define player_has_los_bold(C, Y, X)
Definition: floor.h:344

対象座標のマスの照明状態を更新する際の補助処理マクロ

関数詳解

◆ cave_alter_feat()

void cave_alter_feat ( POSITION  y,
POSITION  x,
int  action 
)
呼び出し関係図:

◆ cave_monster_teleportable_bold()

bool cave_monster_teleportable_bold ( MONSTER_IDX  m_idx,
POSITION  y,
POSITION  x,
BIT_FLAGS  mode 
)

指定されたマスがモンスターのテレポート可能先かどうかを判定する。

引数
m_idxモンスターID
y移動先Y座標
x移動先X座標
modeオプション
戻り値
テレポート先として妥当ならばtrue
呼び出し関係図:

◆ cave_player_teleportable_bold()

bool cave_player_teleportable_bold ( POSITION  y,
POSITION  x,
BIT_FLAGS  mode 
)

指定されたマスにプレイヤーがテレポート可能かどうかを判定する。

引数
y移動先Y座標
x移動先X座標
modeオプション
戻り値
テレポート先として妥当ならばtrue
呼び出し関係図:

◆ cave_set_feat()

void cave_set_feat ( POSITION  y,
POSITION  x,
FEAT_IDX  feat 
)
呼び出し関係図:

◆ check_local_illumination()

bool check_local_illumination ( POSITION  y,
POSITION  x 
)

指定された座標のマスが現在照らされているかを返す。 / Check for "local" illumination

引数
yy座標
xx座標
戻り値
指定された座標に照明がかかっているならTRUEを返す。。

◆ conv_dungeon_feat()

FEAT_IDX conv_dungeon_feat ( FEAT_IDX  newfeat)

◆ delayed_visual_update()

void delayed_visual_update ( void  )
呼び出し関係図:

◆ feat_state()

FEAT_IDX feat_state ( FEAT_IDX  feat,
int  action 
)
呼び出し関係図:

◆ get_is_floor()

bool get_is_floor ( POSITION  x,
POSITION  y 
)

指定のマスが床系地形であるかを返す / Function that sees if a square is a floor.

(Includes range checking.)

引数
xチェックするマスのX座標
yチェックするマスのY座標
戻り値
床系地形ならばTRUE

◆ is_explosive_rune_grid()

bool is_explosive_rune_grid ( grid_type g_ptr)

◆ is_glyph_grid()

bool is_glyph_grid ( grid_type g_ptr)

◆ is_hidden_door()

bool is_hidden_door ( grid_type g_ptr)

マスに隠されたドアがあるかの判定を行う。 / Return TRUE if the given grid is a hidden closed door

引数
g_ptrマス構造体の参照ポインタ
戻り値
隠されたドアがあるならTRUEを返す。
呼び出し関係図:

◆ is_known_trap()

bool is_known_trap ( grid_type g_ptr)

マスに看破済みの罠があるかの判定を行う。 / Return TRUE if the given grid is a known trap

引数
g_ptrマス構造体の参照ポインタ
戻り値
看破済みの罠があるならTRUEを返す。
呼び出し関係図:

◆ is_mirror_grid()

bool is_mirror_grid ( grid_type g_ptr)

◆ is_open()

bool is_open ( FEAT_IDX  feat)

地形は開くものであって、かつ開かれているかを返す / Attempt to open the given chest at the given location

引数
feat地形ID
戻り値
開いた地形である場合TRUEを返す / Return TRUE if the given feature is an open door
呼び出し関係図:

◆ lite_spot()

void lite_spot ( POSITION  y,
POSITION  x 
)
呼び出し関係図:

◆ new_player_spot()

bool new_player_spot ( player_type creature_ptr)

新規フロアに入りたてのプレイヤーをランダムな場所に配置する / Returns random co-ordinates for player/monster/object

引数
creature_ptr配置したいクリーチャーの参照ポインタ
戻り値
配置に成功したらTRUEを返す
呼び出し関係図:

◆ next_to_corr()

static int next_to_corr ( POSITION  y1,
POSITION  x1 
)
static

隣接4マスに存在する通路の数を返す / Count the number of "corridor" grids adjacent to the given grid.

引数
y1基準となるマスのY座標
x1基準となるマスのX座標
戻り値
通路の数
覚え書き
Assumes "in_bounds(p_ptr->current_floor_ptr, y1, x1)"

XXX XXX This routine currently only counts actual "empty floor"
grids which are not in rooms. We might want to also count stairs,
open doors, closed doors, etc.

被呼び出し関係図:

◆ no_lite()

bool no_lite ( void  )

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

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

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

呼び出し関係図:

◆ note_spot()

void note_spot ( POSITION  y,
POSITION  x 
)
呼び出し関係図:

◆ place_bound_perm_wall()

void place_bound_perm_wall ( grid_type g_ptr)

マスにフロア端用の永久壁を配置する / Set boundary mimic and add "solid" perma-wall

引数
g_ptr永久壁を配置したいマス構造体の参照ポインタ
戻り値
なし
呼び出し関係図:

◆ place_closed_door()

void place_closed_door ( POSITION  y,
POSITION  x,
int  type 
)

所定の位置に各種の閉じたドアを配置する / Place a random type of normal door at the given location.

引数
yドアの配置を試みたいマスのY座標
xドアの配置を試みたいマスのX座標
typeドアの地形ID
戻り値
なし
呼び出し関係図:

◆ place_floor()

void place_floor ( POSITION  x1,
POSITION  x2,
POSITION  y1,
POSITION  y2,
bool  light 
)

長方形の空洞を生成する / Make an empty square floor, for the middle of rooms

引数
x1長方形の左端X座標(-1)
x2長方形の右端X座標(+1)
y1長方形の上端Y座標(-1)
y2長方形の下端Y座標(+1)
light照明の有無
戻り値
なし

◆ place_random_door()

void place_random_door ( POSITION  y,
POSITION  x,
bool  room 
)

所定の位置にさまざまな状態や種類のドアを配置する / Place a random type of door at the given location

引数
yドアの配置を試みたいマスのY座標
xドアの配置を試みたいマスのX座標
room部屋に接している場合向けのドア生成か否か
戻り値
なし
呼び出し関係図:

◆ place_room()

void place_room ( POSITION  x1,
POSITION  x2,
POSITION  y1,
POSITION  y2,
bool  light 
)

長方形の部屋を生成する / Make an empty square room, only floor and wall grids

引数
x1長方形の左端X座標(-1)
x2長方形の右端X座標(+1)
y1長方形の上端Y座標(-1)
y2長方形の下端Y座標(+1)
light照明の有無
戻り値
なし
呼び出し関係図:

◆ player_can_enter()

bool player_can_enter ( FEAT_IDX  feature,
BIT_FLAGS16  mode 
)

プレイヤーが地形踏破可能かを返す

引数
feature判定したい地形ID
mode移動に関するオプションフラグ
戻り値
移動可能ならばTRUEを返す
呼び出し関係図:

◆ possible_doorway()

static bool possible_doorway ( POSITION  y,
POSITION  x 
)
static

ドアを設置可能な地形かを返す / Determine if the given location is "between" two walls, and "next to" two corridor spaces.

引数
y判定を行いたいマスのY座標
x判定を行いたいマスのX座標
戻り値
ドアを設置可能ならばTRUEを返す
覚え書き
Assumes "in_bounds(p_ptr->current_floor_ptr, y1, x1)"


Assumes "in_bounds(p_ptr->current_floor_ptr, y, x)"

呼び出し関係図:
被呼び出し関係図:

◆ print_rel()

void print_rel ( SYMBOL_CODE  c,
TERM_COLOR  a,
TERM_LEN  y,
TERM_LEN  x 
)
呼び出し関係図:

◆ remove_mirror()

void remove_mirror ( POSITION  y,
POSITION  x 
)
呼び出し関係図:

◆ set_floor()

void set_floor ( POSITION  x,
POSITION  y 
)

指定のマスを床地形に変える / Set a square to be floor.

(Includes range checking.)

引数
x地形を変えたいマスのX座標
y地形を変えたいマスのY座標
戻り値
なし

◆ try_door()

void try_door ( POSITION  y,
POSITION  x 
)

ドアの設置を試みる / Places door at y, x position if at least 2 walls found

引数
y設置を行いたいマスのY座標
x設置を行いたいマスのX座標
戻り値
なし
呼び出し関係図:

◆ update_flow()

void update_flow ( void  )
呼び出し関係図:

◆ update_local_illumination()

void update_local_illumination ( player_type creature_ptr,
POSITION  y,
POSITION  x 
)

指定された座標の照明状態を更新する / Update "local" illumination

引数
creature_ptr視界元のクリーチャー
y視界先y座標
x視界先x座標
戻り値
なし

◆ vault_objects()

void vault_objects ( POSITION  y,
POSITION  x,
int  num 
)

特殊な部屋向けに各種アイテムを配置する / Create up to "num" objects near the given coordinates

引数
y配置したい中心マスのY座標
x配置したい中心マスのX座標
num配置したい数
戻り値
なし

Only really called by some of the "vault" routines.

呼び出し関係図:

◆ vault_trap_aux()

void vault_trap_aux ( POSITION  y,
POSITION  x,
POSITION  yd,
POSITION  xd 
)

特殊な部屋向けに各種アイテムを配置する(vault_trapのサブセット) / Place a trap with a given displacement of point

引数
yトラップを配置したいマスの中心Y座標
xトラップを配置したいマスの中心X座標
ydY方向の配置分散マス数
xdX方向の配置分散マス数
戻り値
なし

Only really called by some of the "vault" routines.

呼び出し関係図:

◆ vault_traps()

void vault_traps ( POSITION  y,
POSITION  x,
POSITION  yd,
POSITION  xd,
int  num 
)

特殊な部屋向けに各種アイテムを配置する(メインルーチン) / Place some traps with a given displacement of given location

引数
yトラップを配置したいマスの中心Y座標
xトラップを配置したいマスの中心X座標
ydY方向の配置分散マス数
xdX方向の配置分散マス数
num配置したいトラップの数
戻り値
なし

Only really called by some of the "vault" routines.

呼び出し関係図:

変数詳解

◆ feature_action_flags

const byte feature_action_flags[FF_FLAG_MAX]
static

地形状態フラグテーブル / The table of features' actions

◆ flow_x

POSITION flow_x = 0
static

◆ flow_y

POSITION flow_y = 0
static