Hengband  2.2.1
データ構造 | マクロ定義 | 型定義 | 関数 | 変数
rooms.c ファイル

ダンジョンフロアの部屋生成処理 / make rooms. [詳解]

#include "angband.h"
#include "util.h"
#include "feature.h"
#include "floor.h"
#include "floor-generate.h"
#include "dungeon.h"
#include "grid.h"
#include "rooms.h"
#include "rooms-city.h"
#include "rooms-fractal.h"
#include "rooms-normal.h"
#include "rooms-pitnest.h"
#include "rooms-special.h"
#include "rooms-trap.h"
#include "rooms-vault.h"
#include "trap.h"
#include "monster.h"
rooms.c の依存先関係図:

データ構造

struct  fill_data_type
 

マクロ定義

#define MOVE_PLIST(dst, src)   (prob_list[dst] += prob_list[src], prob_list[src] = 0)
 指定した部屋の生成確率を別の部屋に加算し、指定した部屋の生成率を0にする [詳解]
 

型定義

typedef struct fill_data_type fill_data_type
 

関数

void build_small_room (floor_type *floor_ptr, POSITION x0, POSITION y0)
 1マスだけの部屋を作成し、上下左右いずれか一つに隠しドアを配置する。 [詳解]
 
static void check_room_boundary (POSITION x1, POSITION y1, POSITION x2, POSITION y2)
 指定範囲に通路が通っていることを確認した上で床で埋める This function tunnels around a room if it will cut off part of a p_ptr->current_floor_ptr->grid_array system. [詳解]
 
static bool find_space_aux (POSITION blocks_high, POSITION blocks_wide, POSITION block_y, POSITION block_x)
 find_space()の予備処理として部屋の生成が可能かを判定する / Helper function for find_space(). [詳解]
 
bool find_space (POSITION *y, POSITION *x, POSITION height, POSITION width)
 部屋生成が可能なスペースを確保する / Find a good spot for the next room. [詳解]
 
static void store_height (floor_type *floor_ptr, POSITION x, POSITION y, FEAT_IDX val)
 
void generate_hmap (floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff)
 
static bool hack_isnt_wall (floor_type *floor_ptr, POSITION y, POSITION x, int c1, int c2, int c3, FEAT_IDX feat1, FEAT_IDX feat2, FEAT_IDX feat3, BIT_FLAGS info1, BIT_FLAGS info2, BIT_FLAGS info3)
 
static void cave_fill (floor_type *floor_ptr, POSITION y, POSITION x)
 
bool generate_fracave (floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int cutoff, bool light, bool room)
 
void build_cavern (floor_type *floor_ptr)
 
bool generate_lake (floor_type *floor_ptr, POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int c1, int c2, int c3, int type)
 
void build_lake (floor_type *floor_ptr, int type)
 
void fill_treasure (floor_type *floor_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty)
 
void build_room (floor_type *floor_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2)
 
void r_visit (floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, int node, DIRECTION dir, int *visited)
 
void build_maze_vault (POSITION x0, POSITION y0, POSITION xsize, POSITION ysize, bool is_vault)
 
void build_recursive_room (floor_type *floor_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION y2, int power)
 
void add_outer_wall (POSITION x, POSITION y, int light, POSITION x1, POSITION y1, POSITION x2, POSITION y2)
 
POSITION dist2 (POSITION x1, POSITION y1, POSITION x2, POSITION y2, POSITION h1, POSITION h2, POSITION h3, POSITION h4)
 
void generate_room_floor (POSITION y1, POSITION x1, POSITION y2, POSITION x2, int light)
 
void generate_fill_perm_bold (POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 
static bool room_build (floor_type *floor_ptr, EFFECT_ID typ)
 与えられた部屋型IDに応じて部屋の生成処理分岐を行い結果を返す / Attempt to build a room of the given type at the given block [詳解]
 
bool generate_rooms (floor_type *floor_ptr)
 部屋生成処理のメインルーチン(Sangbandを経由してOangbandからの実装を引用) / Generate rooms in dungeon. [詳解]
 

変数

static room_info_type room_info_normal [ROOM_T_MAX]
 各部屋タイプの生成比定義 [from SAngband (originally from OAngband)]

Table of values that control how many times each type of room will
appear. [詳解]
 
static byte room_build_order [ROOM_T_MAX]
 部屋の生成処理順 / Build rooms in descending order of difficulty. [詳解]
 
static fill_data_type fill_data
 

詳解

ダンジョンフロアの部屋生成処理 / make rooms.

Used by generate.c when creating dungeons.

日付
2014/01/06
著者
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 rearranged comment for Doxygen.

Room building routines.

Room types:
1 – normal
2 – overlapping
3 – cross shaped
4 – large room with features
5 – monster nests
6 – monster pits
7 – simple vaults
8 – greater vaults
9 – fractal caves
10 – random vaults
11 – circular rooms
12 – crypts
13 – trapped monster pits
14 – trapped room
15 – glass room
16 – underground arcade

Some functions are used to determine if the given monster
is appropriate for inclusion in a monster nest or monster pit or
the given type.

None of the pits/nests are allowed to include "unique" monsters.

マクロ定義詳解

◆ MOVE_PLIST

#define MOVE_PLIST (   dst,
  src 
)    (prob_list[dst] += prob_list[src], prob_list[src] = 0)

指定した部屋の生成確率を別の部屋に加算し、指定した部屋の生成率を0にする

引数
dst確率を移す先の部屋種ID
src確率を与える元の部屋種ID

型定義詳解

◆ fill_data_type

関数詳解

◆ add_outer_wall()

void add_outer_wall ( POSITION  x,
POSITION  y,
int  light,
POSITION  x1,
POSITION  y1,
POSITION  x2,
POSITION  y2 
)
呼び出し関係図:

◆ build_cavern()

void build_cavern ( floor_type floor_ptr)
呼び出し関係図:

◆ build_lake()

void build_lake ( floor_type floor_ptr,
int  type 
)
呼び出し関係図:

◆ build_maze_vault()

void build_maze_vault ( POSITION  x0,
POSITION  y0,
POSITION  xsize,
POSITION  ysize,
bool  is_vault 
)
呼び出し関係図:

◆ build_recursive_room()

void build_recursive_room ( floor_type floor_ptr,
POSITION  x1,
POSITION  y1,
POSITION  x2,
POSITION  y2,
int  power 
)
呼び出し関係図:

◆ build_room()

void build_room ( floor_type floor_ptr,
POSITION  x1,
POSITION  x2,
POSITION  y1,
POSITION  y2 
)

◆ build_small_room()

void build_small_room ( floor_type floor_ptr,
POSITION  x0,
POSITION  y0 
)

1マスだけの部屋を作成し、上下左右いずれか一つに隠しドアを配置する。

引数
floor_ptr配置するフロアの参照ポインタ
y0配置したい中心のY座標
x0配置したい中心のX座標

This funtion makes a very small room centred at (x0, y0) This is used in crypts, and random elemental vaults.

Note - this should be used only on allocated regions within another room.

呼び出し関係図:

◆ cave_fill()

static void cave_fill ( floor_type floor_ptr,
POSITION  y,
POSITION  x 
)
static
呼び出し関係図:
被呼び出し関係図:

◆ check_room_boundary()

static void check_room_boundary ( POSITION  x1,
POSITION  y1,
POSITION  x2,
POSITION  y2 
)
static

指定範囲に通路が通っていることを確認した上で床で埋める This function tunnels around a room if it will cut off part of a p_ptr->current_floor_ptr->grid_array system.

引数
x1範囲の左端
y1範囲の上端
x2範囲の右端
y2範囲の下端
戻り値
なし
呼び出し関係図:
被呼び出し関係図:

◆ dist2()

POSITION dist2 ( POSITION  x1,
POSITION  y1,
POSITION  x2,
POSITION  y2,
POSITION  h1,
POSITION  h2,
POSITION  h3,
POSITION  h4 
)

◆ fill_treasure()

void fill_treasure ( floor_type floor_ptr,
POSITION  x1,
POSITION  x2,
POSITION  y1,
POSITION  y2,
int  difficulty 
)
呼び出し関係図:

◆ find_space()

bool find_space ( POSITION y,
POSITION x,
POSITION  height,
POSITION  width 
)

部屋生成が可能なスペースを確保する / Find a good spot for the next room.

-LM-

引数
y部屋の生成が可能な中心Y座標を返す参照ポインタ
x部屋の生成が可能な中心X座標を返す参照ポインタ
height確保したい領域の高さ
width確保したい領域の幅
戻り値
所定の範囲が確保できた場合TRUEを返す

Find and allocate a free space in the dungeon large enough to hold
the room calling this function.

We allocate space in 11x11 blocks, but want to make sure that rooms
align neatly on the standard screen. Therefore, we make them use
blocks in few 11x33 rectangles as possible.

Be careful to include the edges of the room in height and width!

Return TRUE and values for the center of the room if all went well.
Otherwise, return FALSE.

呼び出し関係図:

◆ find_space_aux()

static bool find_space_aux ( POSITION  blocks_high,
POSITION  blocks_wide,
POSITION  block_y,
POSITION  block_x 
)
static

find_space()の予備処理として部屋の生成が可能かを判定する / Helper function for find_space().

Is this a good location?

引数
blocks_high範囲の高さ
blocks_wide範囲の幅
block_y範囲の上端
block_x範囲の左端
戻り値
なし
被呼び出し関係図:

◆ generate_fill_perm_bold()

void generate_fill_perm_bold ( POSITION  y1,
POSITION  x1,
POSITION  y2,
POSITION  x2 
)

◆ generate_fracave()

bool generate_fracave ( floor_type floor_ptr,
POSITION  y0,
POSITION  x0,
POSITION  xsize,
POSITION  ysize,
int  cutoff,
bool  light,
bool  room 
)
呼び出し関係図:

◆ generate_hmap()

void generate_hmap ( floor_type floor_ptr,
POSITION  y0,
POSITION  x0,
POSITION  xsiz,
POSITION  ysiz,
int  grd,
int  roug,
int  cutoff 
)
呼び出し関係図:

◆ generate_lake()

bool generate_lake ( floor_type floor_ptr,
POSITION  y0,
POSITION  x0,
POSITION  xsize,
POSITION  ysize,
int  c1,
int  c2,
int  c3,
int  type 
)
呼び出し関係図:

◆ generate_room_floor()

void generate_room_floor ( POSITION  y1,
POSITION  x1,
POSITION  y2,
POSITION  x2,
int  light 
)

◆ generate_rooms()

bool generate_rooms ( floor_type floor_ptr)

部屋生成処理のメインルーチン(Sangbandを経由してOangbandからの実装を引用) / Generate rooms in dungeon.

Build bigger rooms at first. [from SAngband (originally from OAngband)]

戻り値
部屋生成に成功した場合 TRUE を返す。

ダンジョンにBEGINNER、CHAMELEON、SMALLESTいずれのフラグもなく、 かつ「常に通常でない部屋を生成する」フラグがONならば、 GRATER_VAULTのみを生成対象とする。 / Ironman sees only Greater Vaults

ダンジョンにNO_VAULTフラグがあるならば、LESSER_VAULT / GREATER_VAULT/ RANDOM_VAULTを除外 / Forbidden vaults

ダンジョンにBEGINNERフラグがあるならば、FIXED_ROOMを除外 / Forbidden vaults

ダンジョンにNO_CAVEフラグがある場合、FRACAVEの生成枠がNORMALに与えられる。CRIPT、OVALの生成枠がINNER_Fに与えられる。/ NO_CAVE dungeon (Castle)

ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc floor_ptr->grid_array etc.)

ダンジョンの基本地形が最初から渓谷かアリーナ型の場合 FRACAVE は生成から除外。 / No caves when a (random) cavern exists: they look bad

ダンジョンに最初からGLASS_ROOMフラグがある場合、GLASS を生成から除外。/ Forbidden glass rooms

ARCADEは同フラグがダンジョンにないと生成されない。 / Forbidden glass rooms

部屋生成数が2未満の場合生成失敗を返す

呼び出し関係図:

◆ hack_isnt_wall()

static bool hack_isnt_wall ( floor_type floor_ptr,
POSITION  y,
POSITION  x,
int  c1,
int  c2,
int  c3,
FEAT_IDX  feat1,
FEAT_IDX  feat2,
FEAT_IDX  feat3,
BIT_FLAGS  info1,
BIT_FLAGS  info2,
BIT_FLAGS  info3 
)
static
被呼び出し関係図:

◆ r_visit()

void r_visit ( floor_type floor_ptr,
POSITION  y1,
POSITION  x1,
POSITION  y2,
POSITION  x2,
int  node,
DIRECTION  dir,
int *  visited 
)
呼び出し関係図:

◆ room_build()

static bool room_build ( floor_type floor_ptr,
EFFECT_ID  typ 
)
static

与えられた部屋型IDに応じて部屋の生成処理分岐を行い結果を返す / Attempt to build a room of the given type at the given block

引数
type部屋型ID
覚え書き
that we restrict the number of "crowded" rooms to reduce the chance of overflowing the monster list during level creation.
戻り値
部屋の精製に成功した場合 TRUE を返す。
呼び出し関係図:
被呼び出し関係図:

◆ store_height()

static void store_height ( floor_type floor_ptr,
POSITION  x,
POSITION  y,
FEAT_IDX  val 
)
static
被呼び出し関係図:

変数詳解

◆ fill_data

fill_data_type fill_data
static

◆ room_build_order

byte room_build_order[ROOM_T_MAX]
static
初期値:
= {
}
#define ROOM_T_GLASS
部屋型ID:ガラス部屋 / Glass room
Definition: rooms.h:45
#define ROOM_T_LESSER_VAULT
部屋型ID:小型VAULT / Lesser vault (33x22)
Definition: rooms.h:37
#define ROOM_T_NEST
部屋型ID:モンスターNEST / Monster nest (33x11)
Definition: rooms.h:35
#define ROOM_T_FRACAVE
部屋型ID:フラクタル地形 / Fractal p_ptr->current_floor_ptr->grid_array (42x24)
Definition: rooms.h:39
#define ROOM_T_GREATER_VAULT
部屋型ID:大型VAULT / Greater vault (66x44)
Definition: rooms.h:38
#define ROOM_T_INNER_FEAT
部屋型ID:二重壁 / Large (33x11)
Definition: rooms.h:34
#define ROOM_T_TRAP
部屋型ID:トラップ部屋 / Piranha/Armageddon trap room
Definition: rooms.h:44
#define ROOM_T_OVAL
部屋型ID:円形部屋 / Circular rooms (22x22)
Definition: rooms.h:41
#define ROOM_T_NORMAL
部屋型ID:基本長方形 / Simple (33x11)
Definition: rooms.h:31
#define ROOM_T_CRYPT
部屋型ID:聖堂 / Crypts (22x22)
Definition: rooms.h:42
#define ROOM_T_OVERLAP
部屋型ID:長方形二つ重ね / Overlapping (33x11)
Definition: rooms.h:32
#define ROOM_T_RANDOM_VAULT
部屋型ID:ランダムVAULT / Random vault (44x22)
Definition: rooms.h:40
#define ROOM_T_PIT
部屋型ID:モンスターPIT / Monster pit (33x11)
Definition: rooms.h:36
#define ROOM_T_ARCADE
部屋型ID:商店 / Arcade
Definition: rooms.h:46
#define ROOM_T_CROSS
部屋型ID:十字 / Crossed (33x11)
Definition: rooms.h:33
#define ROOM_T_FIXED
部屋型ID:固定部屋 / Fixed room
Definition: rooms.h:47
#define ROOM_T_TRAP_PIT
部屋型ID:トラップつきモンスターPIT / Trapped monster pit
Definition: rooms.h:43

部屋の生成処理順 / Build rooms in descending order of difficulty.

◆ room_info_normal

room_info_type room_info_normal[ROOM_T_MAX]
static
初期値:
=
{
{{999,900,800,700,600,500,400,300,200,100, 0}, 0},
{{ 1, 10, 20, 30, 40, 50, 60, 70, 80, 90,100}, 1},
{{ 1, 10, 20, 30, 40, 50, 60, 70, 80, 90,100}, 3},
{{ 1, 10, 20, 30, 40, 50, 60, 70, 80, 90,100}, 3},
{{ 0, 1, 1, 1, 2, 3, 5, 6, 8, 10, 13}, 10},
{{ 0, 1, 1, 2, 3, 4, 6, 8, 10, 13, 16}, 10},
{{ 0, 1, 1, 1, 2, 2, 3, 5, 6, 8, 10}, 10},
{{ 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4}, 20},
{{ 0,100,200,300,400,500,600,700,800,900,999}, 10},
{{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2}, 10},
{{ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40}, 3},
{{ 1, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60}, 10},
{{ 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 8}, 20},
{{ 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 8}, 20},
{{ 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2}, 40},
{{ 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3}, 1},
{{ 1, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80}, 1},
}

各部屋タイプの生成比定義 [from SAngband (originally from OAngband)]

Table of values that control how many times each type of room will
appear.

Each type of room has its own row, and each column
corresponds to dungeon levels 0, 10, 20, and so on. The final
value is the minimum depth the room can appear at. -LM-

Level 101 and below use the values for level 100.

Rooms with lots of monsters or loot may not be generated if the
object or monster lists are already nearly full. Rooms will not
appear above their minimum depth. Tiny levels will not have space
for all the rooms you ask for.