Hengband  2.1.4
 全て データ構造 ファイル 関数 変数 型定義 マクロ定義 ページ
関数
grid.c

ダンジョンの生成処理の基幹部分 / low-level dungeon creation primitives [詳細]

#include "angband.h"
#include "generate.h"
#include "grid.h"
grid.cのインクルード依存関係図

関数

bool new_player_spot (void)
 新規フロアに入りたてのプレイヤーをランダムな場所に配置する / Returns random co-ordinates for player/monster/object [詳細]
 
void place_random_stairs (int y, int x)
 所定の位置に上り階段か下り階段を配置する / Place an up/down staircase at given location [詳細]
 
void place_random_door (int y, int x, bool room)
 所定の位置にさまざまな状態や種類のドアを配置する / Place a random type of door at the given location [詳細]
 
void place_closed_door (int y, int x, int type)
 所定の位置に各種の閉じたドアを配置する / Place a random type of normal door at the given location. [詳細]
 
void place_floor (int x1, int x2, int y1, int y2, bool light)
 長方形の空洞を生成する / Make an empty square floor, for the middle of rooms [詳細]
 
void place_room (int x1, int x2, int y1, int y2, bool light)
 長方形の部屋を生成する / Make an empty square room, only floor and wall grids [詳細]
 
void vault_objects (int y, int x, int num)
 特殊な部屋向けに各種アイテムを配置する / Create up to "num" objects near the given coordinates [詳細]
 
void vault_trap_aux (int y, int x, int yd, int xd)
 特殊な部屋向けに各種アイテムを配置する(vault_trapのサブセット) / Place a trap with a given displacement of point [詳細]
 
void vault_traps (int y, int x, int yd, int xd, int num)
 特殊な部屋向けに各種アイテムを配置する(メインルーチン) / Place some traps with a given displacement of given location [詳細]
 
void vault_monsters (int y1, int x1, int num)
 特殊な部屋地形向けにモンスターを配置する / Hack – Place some sleeping monsters near the given location [詳細]
 
void correct_dir (int *rdir, int *cdir, int y1, int x1, int y2, int x2)
 build_tunnel用に通路を掘るための方向を位置関係通りに決める / Always picks a correct direction [詳細]
 
void rand_dir (int *rdir, int *cdir)
 build_tunnel用に通路を掘るための方向をランダムに決める / Pick a random direction [詳細]
 
bool get_is_floor (int x, int y)
 指定のマスが床系地形であるかを返す / Function that sees if a square is a floor. [詳細]
 
void set_floor (int x, int y)
 指定のマスを床地形に変える / Set a square to be floor. [詳細]
 
bool build_tunnel (int row1, int col1, int row2, int col2)
 部屋間のトンネルを生成する / Constructs a tunnel between two points [詳細]
 
static bool set_tunnel (int *x, int *y, bool affectwall)
 トンネル生成のための基準点を指定する。 [詳細]
 
static void create_cata_tunnel (int x, int y)
 外壁を削って「カタコンベ状」の通路を作成する / This routine creates the catacomb-like tunnels by removing extra rock. [詳細]
 
static void short_seg_hack (int x1, int y1, int x2, int y2, int type, int count, bool *fail)
 トンネル生成処理(詳細調査中)/ This routine does the bulk of the work in creating the new types of tunnels. [詳細]
 
bool build_tunnel2 (int x1, int y1, int x2, int y2, int type, int cutoff)
 特定の壁(永久壁など)を避けながら部屋間の通路を作成する / This routine maps a path from (x1, y1) to (x2, y2) avoiding SOLID walls. [詳細]
 

説明

ダンジョンの生成処理の基幹部分 / low-level dungeon creation primitives

日付
2014/01/04
作者
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.

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

関数

bool build_tunnel ( int  row1,
int  col1,
int  row2,
int  col2 
)

部屋間のトンネルを生成する / Constructs a tunnel between two points

引数
row1始点Y座標
col1始点X座標
row2終点Y座標
col2終点X座標
戻り値
生成に成功したらTRUEを返す

This function must be called BEFORE any streamers are created,
since we use the special "granite wall" sub-types to keep track
of legal places for corridors to pierce rooms.

We use "door_flag" to prevent excessive construction of doors
along overlapping corridors.

We queue the tunnel grids to prevent door creation along a corridor
which intersects itself.

We queue the wall piercing grids to prevent a corridor from leaving
a room and then coming back in through the same entrance.

We "pierce" grids which are "outer" walls of rooms, and when we
do so, we change all adjacent "outer" walls of rooms into "solid"
walls so that no two corridors may use adjacent grids for exits.

The "solid" wall check prevents corridors from "chopping" the
corners of rooms off, as well as "silly" door placement, and
"excessively wide" room entrances.

Kind of walls:
extra – walls
inner – inner room walls
outer – outer room walls
solid – solid room walls

関数の呼び出しグラフ:

呼出しグラフ:

bool build_tunnel2 ( int  x1,
int  y1,
int  x2,
int  y2,
int  type,
int  cutoff 
)

特定の壁(永久壁など)を避けながら部屋間の通路を作成する / This routine maps a path from (x1, y1) to (x2, y2) avoiding SOLID walls.

戻り値
なし
TODO:
詳細用調査

Permanent rock is ignored in this path finding- sometimes there is no
path around anyway -so there will be a crash if we try to find one.
This routine is much like the river creation routine in Zangband.
It works by dividing a line segment into two. The segments are divided
until they are less than "cutoff" - when the corresponding routine from
"short_seg_hack" is called.
Note it is VERY important that the "stop if hit another passage" logic
stays as is. Without this the dungeon turns into Swiss Cheese...

関数の呼び出しグラフ:

呼出しグラフ:

void correct_dir ( int *  rdir,
int *  cdir,
int  y1,
int  x1,
int  y2,
int  x2 
)

build_tunnel用に通路を掘るための方向を位置関係通りに決める / Always picks a correct direction

引数
rdirY方向に取るべきベクトル値を返す参照ポインタ
cdirX方向に取るべきベクトル値を返す参照ポインタ
y1始点Y座標
x1始点X座標
y2終点Y座標
x2終点X座標
戻り値
なし

呼出しグラフ:

static void create_cata_tunnel ( int  x,
int  y 
)
static

外壁を削って「カタコンベ状」の通路を作成する / This routine creates the catacomb-like tunnels by removing extra rock.

引数
x基準点のX座標
y基準点のY座標
戻り値
なし

Note that this routine is only called on "even" squares - so it gives a natural checkerboard pattern.

関数の呼び出しグラフ:

呼出しグラフ:

bool get_is_floor ( int  x,
int  y 
)

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

(Includes range checking.)

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

呼出しグラフ:

bool new_player_spot ( void  )

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

戻り値
配置に成功したらTRUEを返す

関数の呼び出しグラフ:

呼出しグラフ:

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

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

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

関数の呼び出しグラフ:

呼出しグラフ:

void place_floor ( int  x1,
int  x2,
int  y1,
int  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照明の有無
戻り値
なし

呼出しグラフ:

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

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

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

関数の呼び出しグラフ:

呼出しグラフ:

void place_random_stairs ( int  y,
int  x 
)

所定の位置に上り階段か下り階段を配置する / Place an up/down staircase at given location

引数
y配置を試みたいマスのY座標
x配置を試みたいマスのX座標
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

void place_room ( int  x1,
int  x2,
int  y1,
int  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照明の有無
戻り値
なし

関数の呼び出しグラフ:

void rand_dir ( int *  rdir,
int *  cdir 
)

build_tunnel用に通路を掘るための方向をランダムに決める / Pick a random direction

引数
rdirY方向に取るべきベクトル値を返す参照ポインタ
cdirX方向に取るべきベクトル値を返す参照ポインタ
戻り値
なし

呼出しグラフ:

void set_floor ( int  x,
int  y 
)

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

(Includes range checking.)

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

呼出しグラフ:

static bool set_tunnel ( int *  x,
int *  y,
bool  affectwall 
)
static

トンネル生成のための基準点を指定する。

引数
x基準点を指定するX座標の参照ポインタ、適時値が修正される。
y基準点を指定するY座標の参照ポインタ、適時値が修正される。
affectwall(調査中)
戻り値
なし

This routine adds the square to the tunnel
It also checks for SOLID walls - and returns a nearby
non-SOLID square in (x,y) so that a simple avoiding
routine can be used. The returned boolean value reflects
whether or not this routine hit a SOLID wall.

"affectwall" toggles whether or not this new square affects
the boundaries of rooms. - This is used by the catacomb
routine.

TODO:
特に詳細な処理の意味を調査すべし

呼出しグラフ:

static void short_seg_hack ( int  x1,
int  y1,
int  x2,
int  y2,
int  type,
int  count,
bool fail 
)
static

トンネル生成処理(詳細調査中)/ This routine does the bulk of the work in creating the new types of tunnels.

戻り値
なし
TODO:
詳細用調査

It is designed to use very simple algorithms to go from (x1,y1) to (x2,y2)
It doesn't need to add any complexity - straight lines are fine.
The SOLID walls are avoided by a recursive algorithm which tries random ways
around the obstical until it works. The number of itterations is counted, and it
this gets too large the routine exits. This should stop any crashes - but may leave
small gaps in the tunnel where there are too many SOLID walls.

Type 1 tunnels are extremely simple - straight line from A to B. This is only used
as a part of the dodge SOLID walls algorithm.

Type 2 tunnels are made of two straight lines at right angles. When this is used with
short line segments it gives the "cavelike" tunnels seen deeper in the dungeon.

Type 3 tunnels are made of two straight lines like type 2, but with extra rock removed.
This, when used with longer line segments gives the "catacomb-like" tunnels seen near
the surface.

関数の呼び出しグラフ:

呼出しグラフ:

void vault_monsters ( int  y1,
int  x1,
int  num 
)

特殊な部屋地形向けにモンスターを配置する / Hack – Place some sleeping monsters near the given location

引数
y1モンスターを配置したいマスの中心Y座標
x1モンスターを配置したいマスの中心X座標
num配置したいモンスターの数
戻り値
なし

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

関数の呼び出しグラフ:

呼出しグラフ:

void vault_objects ( int  y,
int  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.

関数の呼び出しグラフ:

呼出しグラフ:

void vault_trap_aux ( int  y,
int  x,
int  yd,
int  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.

関数の呼び出しグラフ:

呼出しグラフ:

void vault_traps ( int  y,
int  x,
int  yd,
int  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.

関数の呼び出しグラフ:

呼出しグラフ: