Hengband  2.2.1
関数 | 変数
floor-generate.c ファイル
#include "angband.h"
#include "util.h"
#include "core.h"
#include "bldg.h"
#include "cmd-dump.h"
#include "grid.h"
#include "rooms.h"
#include "dungeon.h"
#include "floor.h"
#include "floor-save.h"
#include "floor-streams.h"
#include "floor-generate.h"
#include "floor-events.h"
#include "feature.h"
#include "trap.h"
#include "monster.h"
#include "quest.h"
#include "player-status.h"
#include "wild.h"
#include "monster-status.h"
#include "dungeon-file.h"
#include "init.h"
#include "spells.h"
#include "world.h"
#include "view-mainwindow.h"
floor-generate.c の依存先関係図:

関数

static int next_to_walls (floor_type *floor_ptr, POSITION y, POSITION x)
 上下左右の外壁数をカウントする / Count the number of walls adjacent to the given grid. [詳解]
 
static bool alloc_stairs_aux (floor_type *floor_ptr, POSITION y, POSITION x, int walls)
 alloc_stairs()の補助として指定の位置に階段を生成できるかの判定を行う / Helper function for alloc_stairs(). [詳解]
 
static bool alloc_stairs (floor_type *floor_ptr, FEAT_IDX feat, int num, int walls)
 外壁に隣接させて階段を生成する / Places some staircases near walls [詳解]
 
static void alloc_object (floor_type *floor_ptr, int set, EFFECT_ID typ, int num)
 フロア上のランダム位置に各種オブジェクトを配置する / Allocates some objects (using "place" and "type") [詳解]
 
bool place_quest_monsters (floor_type *floor_ptr, player_type *creature_ptr)
 クエストに関わるモンスターの配置を行う / Place quest monsters [詳解]
 
static void gen_caverns_and_lakes (dungeon_type *dungeon_ptr, floor_type *floor_ptr)
 フロアに洞窟や湖を配置する / Generate various caverns and lakes [詳解]
 
static bool cave_gen (floor_type *floor_ptr)
 ダンジョン生成のメインルーチン / Generate a new dungeon level [詳解]
 
static void build_arena (floor_type *floor_ptr)
 闘技場用のアリーナ地形を作成する / Builds the arena after it is entered -KMW- [詳解]
 
static void generate_challenge_arena (floor_type *floor_ptr)
 挑戦時闘技場への入場処理 / Town logic flow for generation of arena -KMW- [詳解]
 
static void build_battle (floor_type *floor_ptr)
 モンスター闘技場のフロア生成 / Builds the arena after it is entered -KMW- [詳解]
 
static void generate_gambling_arena (floor_type *floor_ptr, player_type *creature_ptr)
 モンスター闘技場への導入処理 / Town logic flow for generation of arena -KMW- [詳解]
 
static void generate_fixed_floor (floor_type *floor_ptr)
 固定マップクエストのフロア生成 / Generate a quest level [詳解]
 
static bool level_gen (floor_type *floor_ptr, concptr *why)
 ダンジョン時のランダムフロア生成 / Make a real level [詳解]
 
void wipe_generate_random_floor_flags (floor_type *floor_ptr)
 フロアに存在する全マスの記憶状態を初期化する / Wipe all unnecessary flags after p_ptr->current_floor_ptr->grid_array generation [詳解]
 
void clear_cave (floor_type *floor_ptr)
 フロアの全情報を初期化する / Clear and empty the p_ptr->current_floor_ptr->grid_array [詳解]
 
void generate_floor (floor_type *floor_ptr)
 ダンジョンのランダムフロアを生成する / Generates a random dungeon level -RAK- [詳解]
 
static void rand_dir (POSITION *rdir, POSITION *cdir)
 build_tunnel用に通路を掘るための方向をランダムに決める / Pick a random direction [詳解]
 
static void correct_dir (POSITION *rdir, POSITION *cdir, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 build_tunnel用に通路を掘るための方向を位置関係通りに決める / Always picks a correct direction [詳解]
 
bool build_tunnel (floor_type *floor_ptr, POSITION row1, POSITION col1, POSITION row2, POSITION col2)
 部屋間のトンネルを生成する / Constructs a tunnel between two points [詳解]
 
static bool set_tunnel (floor_type *floor_ptr, POSITION *x, POSITION *y, bool affectwall)
 トンネル生成のための基準点を指定する。 [詳解]
 
static void create_cata_tunnel (floor_type *floor_ptr, POSITION x, POSITION y)
 外壁を削って「カタコンベ状」の通路を作成する / This routine creates the catacomb-like tunnels by removing extra rock. [詳解]
 
static void short_seg_hack (floor_type *floor_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION 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 (floor_type *floor_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, int cutoff)
 特定の壁(永久壁など)を避けながら部屋間の通路を作成する / This routine maps a path from (x1, y1) to (x2, y2) avoiding SOLID walls. [詳解]
 

変数

int dun_tun_rnd
 ダンジョンの通路方向を掻き回す頻度(一回の試行ごとにで判定している) [詳解]
 
int dun_tun_chg
 ダンジョンの通路をクランクさせる頻度(一回の試行ごとにで判定している) [詳解]
 
int dun_tun_con
 ダンジョンの通路を継続して引き延ばす頻度(一回の試行ごとにで判定している) [詳解]
 
int dun_tun_pen
 ダンジョンの部屋入口にドアを設置する頻度(一回の試行ごとにで判定している) [詳解]
 
int dun_tun_jct
 ダンジョンの通路交差地点付近にドアを設置する頻度(一回の試行ごとにで判定している) [詳解]
 
dun_datadun
 Dungeon generation data – see "cave_gen()" [詳解]
 

関数詳解

◆ alloc_object()

static void alloc_object ( floor_type floor_ptr,
int  set,
EFFECT_ID  typ,
int  num 
)
static

フロア上のランダム位置に各種オブジェクトを配置する / Allocates some objects (using "place" and "type")

引数
set配置したい地形の種類
typ配置したいオブジェクトの種類
num配置したい数
戻り値
規定数通りに生成に成功したらTRUEを返す。
呼び出し関係図:
被呼び出し関係図:

◆ alloc_stairs()

static bool alloc_stairs ( floor_type floor_ptr,
FEAT_IDX  feat,
int  num,
int  walls 
)
static

外壁に隣接させて階段を生成する / Places some staircases near walls

引数
feat配置したい地形ID
num配置したい階段の数
walls最低減隣接させたい外壁の数
戻り値
規定数通りに生成に成功したらTRUEを返す。
呼び出し関係図:
被呼び出し関係図:

◆ alloc_stairs_aux()

static bool alloc_stairs_aux ( floor_type floor_ptr,
POSITION  y,
POSITION  x,
int  walls 
)
static

alloc_stairs()の補助として指定の位置に階段を生成できるかの判定を行う / Helper function for alloc_stairs().

Is this a good location for stairs?

引数
y基準のy座標
x基準のx座標
walls最低減隣接させたい外壁の数
戻り値
階段を生成して問題がないならばTRUEを返す。
呼び出し関係図:
被呼び出し関係図:

◆ build_arena()

static void build_arena ( floor_type floor_ptr)
static

闘技場用のアリーナ地形を作成する / Builds the arena after it is entered -KMW-

戻り値
なし
呼び出し関係図:
被呼び出し関係図:

◆ build_battle()

static void build_battle ( floor_type floor_ptr)
static

モンスター闘技場のフロア生成 / Builds the arena after it is entered -KMW-

戻り値
なし
呼び出し関係図:
被呼び出し関係図:

◆ build_tunnel()

bool build_tunnel ( floor_type floor_ptr,
POSITION  row1,
POSITION  col1,
POSITION  row2,
POSITION  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

呼び出し関係図:

◆ build_tunnel2()

bool build_tunnel2 ( floor_type floor_ptr,
POSITION  x1,
POSITION  y1,
POSITION  x2,
POSITION  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...

呼び出し関係図:

◆ cave_gen()

static bool cave_gen ( floor_type floor_ptr)
static

ダンジョン生成のメインルーチン / Generate a new dungeon level

Note that "dun_body" adds about 4000 bytes of memory to the stack.

戻り値
ダンジョン生成が全て無事に成功したらTRUEを返す。
呼び出し関係図:
被呼び出し関係図:

◆ clear_cave()

void clear_cave ( floor_type floor_ptr)

フロアの全情報を初期化する / Clear and empty the p_ptr->current_floor_ptr->grid_array

戻り値
なし
呼び出し関係図:

◆ correct_dir()

static void correct_dir ( POSITION rdir,
POSITION cdir,
POSITION  y1,
POSITION  x1,
POSITION  y2,
POSITION  x2 
)
static

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

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

◆ create_cata_tunnel()

static void create_cata_tunnel ( floor_type floor_ptr,
POSITION  x,
POSITION  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.

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

◆ gen_caverns_and_lakes()

static void gen_caverns_and_lakes ( dungeon_type dungeon_ptr,
floor_type floor_ptr 
)
static

フロアに洞窟や湖を配置する / Generate various caverns and lakes

There were moved from cave_gen().

戻り値
なし
呼び出し関係図:
被呼び出し関係図:

◆ generate_challenge_arena()

static void generate_challenge_arena ( floor_type floor_ptr)
static

挑戦時闘技場への入場処理 / Town logic flow for generation of arena -KMW-

戻り値
なし
呼び出し関係図:
被呼び出し関係図:

◆ generate_fixed_floor()

static void generate_fixed_floor ( floor_type floor_ptr)
static

固定マップクエストのフロア生成 / Generate a quest level

戻り値
なし
呼び出し関係図:
被呼び出し関係図:

◆ generate_floor()

void generate_floor ( floor_type floor_ptr)

ダンジョンのランダムフロアを生成する / Generates a random dungeon level -RAK-

戻り値
なし
覚え書き
Hack – regenerate any "overflow" levels
呼び出し関係図:

◆ generate_gambling_arena()

static void generate_gambling_arena ( floor_type floor_ptr,
player_type creature_ptr 
)
static

モンスター闘技場への導入処理 / Town logic flow for generation of arena -KMW-

戻り値
なし
呼び出し関係図:
被呼び出し関係図:

◆ level_gen()

static bool level_gen ( floor_type floor_ptr,
concptr why 
)
static

ダンジョン時のランダムフロア生成 / Make a real level

戻り値
フロアの生成に成功したらTRUE
呼び出し関係図:
被呼び出し関係図:

◆ next_to_walls()

static int next_to_walls ( floor_type floor_ptr,
POSITION  y,
POSITION  x 
)
static

上下左右の外壁数をカウントする / Count the number of walls adjacent to the given grid.

引数
y基準のy座標
x基準のx座標
戻り値
隣接する外壁の数
覚え書き
Assumes "in_bounds(p_ptr->current_floor_ptr, y, x)"

We count only granite walls and permanent walls.

被呼び出し関係図:

◆ place_quest_monsters()

bool place_quest_monsters ( floor_type floor_ptr,
player_type creature_ptr 
)

クエストに関わるモンスターの配置を行う / Place quest monsters

引数
floor_ptr配置するフロアの参照ポインタ
subject_ptr近隣への即出現を避けるためのプレイヤークリーチャー参照ポインタ
戻り値
成功したならばTRUEを返す
呼び出し関係図:

◆ rand_dir()

static void rand_dir ( POSITION rdir,
POSITION cdir 
)
static

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

引数
rdirY方向に取るべきベクトル値を返す参照ポインタ
cdirX方向に取るべきベクトル値を返す参照ポインタ
戻り値
なし
被呼び出し関係図:

◆ set_tunnel()

static bool set_tunnel ( floor_type floor_ptr,
POSITION x,
POSITION 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:
特に詳細な処理の意味を調査すべし
被呼び出し関係図:

◆ short_seg_hack()

static void short_seg_hack ( floor_type floor_ptr,
POSITION  x1,
POSITION  y1,
POSITION  x2,
POSITION  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.

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

◆ wipe_generate_random_floor_flags()

void wipe_generate_random_floor_flags ( floor_type floor_ptr)

フロアに存在する全マスの記憶状態を初期化する / Wipe all unnecessary flags after p_ptr->current_floor_ptr->grid_array generation

戻り値
なし

変数詳解

◆ dun

dun_data* dun

Dungeon generation data – see "cave_gen()"

◆ dun_tun_chg

int dun_tun_chg

ダンジョンの通路をクランクさせる頻度(一回の試行ごとにで判定している)

◆ dun_tun_con

int dun_tun_con

ダンジョンの通路を継続して引き延ばす頻度(一回の試行ごとにで判定している)

◆ dun_tun_jct

int dun_tun_jct

ダンジョンの通路交差地点付近にドアを設置する頻度(一回の試行ごとにで判定している)

◆ dun_tun_pen

int dun_tun_pen

ダンジョンの部屋入口にドアを設置する頻度(一回の試行ごとにで判定している)

◆ dun_tun_rnd

int dun_tun_rnd

ダンジョンの通路方向を掻き回す頻度(一回の試行ごとにで判定している)