-/*!
+/*!
* @file generate.c
- * @brief ¥À¥ó¥¸¥ç¥ó¤ÎÀ¸À® / Dungeon generation
+ * @brief ダンジョンの生成 / Dungeon generation
* @date 2014/01/04
* @author
* Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
#include "rooms.h"
#include "streams.h"
-int dun_tun_rnd;
+int dun_tun_rnd;
int dun_tun_chg;
int dun_tun_con;
int dun_tun_pen;
/*!
- * @brief ¾å²¼º¸±¦¤Î³°ÊÉ¿ô¤ò¥«¥¦¥ó¥È¤¹¤ë / Count the number of walls adjacent to the given grid.
- * @param y ´ð½à¤ÎyºÂɸ
- * @param x ´ð½à¤ÎxºÂɸ
- * @return ÎÙÀܤ¹¤ë³°Êɤοô
+ * @brief 上下左右の外壁数をカウントする / Count the number of walls adjacent to the given grid.
+ * @param y 基準のy座標
+ * @param x 基準のx座標
+ * @return 隣接する外壁の数
* @note Assumes "in_bounds(y, x)"
* @details We count only granite walls and permanent walls.
*/
}
/*!
- * @brief alloc_stairs()¤ÎÊä½õ¤È¤·¤Æ»ØÄê¤Î°ÌÃ֤˳¬ÃʤòÀ¸À®¤Ç¤¤ë¤«¤ÎȽÄê¤ò¹Ô¤¦ / Helper function for alloc_stairs(). Is this a good location for stairs?
- * @param y ´ð½à¤ÎyºÂɸ
- * @param x ´ð½à¤ÎxºÂɸ
- * @param walls ºÇÄ㸺ÎÙÀܤµ¤»¤¿¤¤³°Êɤοô
- * @return ³¬ÃʤòÀ¸À®¤·¤ÆÌäÂ꤬¤Ê¤¤¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
+ * @brief alloc_stairs()の補助として指定の位置に階段を生成できるかの判定を行う / Helper function for alloc_stairs(). Is this a good location for stairs?
+ * @param y 基準のy座標
+ * @param x 基準のx座標
+ * @param walls 最低減隣接させたい外壁の数
+ * @return 階段を生成して問題がないならばTRUEを返す。
*/
static bool alloc_stairs_aux(int y, int x, int walls)
{
/*!
- * @brief ³°ÊɤËÎÙÀܤµ¤»¤Æ³¬ÃʤòÀ¸À®¤¹¤ë / Places some staircases near walls
- * @param feat ÇÛÃÖ¤·¤¿¤¤ÃÏ·ÁID
- * @param num ÇÛÃÖ¤·¤¿¤¤³¬Ãʤοô
- * @param walls ºÇÄ㸺ÎÙÀܤµ¤»¤¿¤¤³°Êɤοô
- * @return µ¬Äê¿ôÄ̤ê¤ËÀ¸À®¤ËÀ®¸ù¤·¤¿¤éTRUE¤òÊÖ¤¹¡£
+ * @brief 外壁に隣接させて階段を生成する / Places some staircases near walls
+ * @param feat 配置したい地形ID
+ * @param num 配置したい階段の数
+ * @param walls 最低減隣接させたい外壁の数
+ * @return 規定数通りに生成に成功したらTRUEを返す。
*/
-static bool alloc_stairs(int feat, int num, int walls)
+static bool alloc_stairs(IDX feat, int num, int walls)
{
int i;
int shaft_num = 0;
return TRUE;
}
-
-/*
- * Allocates some objects (using "place" and "type")
+/*!
+ * @brief フロア上のランダム位置に各種オブジェクトを配置する / Allocates some objects (using "place" and "type")
+ * @param set 配置したい地形の種類
+ * @param typ 配置したいオブジェクトの種類
+ * @param num 配置したい数
+ * @return 規定数通りに生成に成功したらTRUEを返す。
*/
static void alloc_object(int set, int typ, int num)
{
if (dummy >= SAFE_MAX_ATTEMPTS)
{
- if (cheat_room)
- {
-#ifdef JP
-msg_print("·Ù¹ð¡ª¥¢¥¤¥Æ¥à¤òÇÛÃ֤Ǥ¤Þ¤»¤ó¡ª");
-#else
- msg_print("Warning! Could not place object!");
-#endif
-
- }
+ msg_print_wizard(CHEAT_DUNGEON, _("アイテムの配置に失敗しました。", "Failed to place object."));
return;
}
}
}
-
-/*
- * Count the number of "corridor" grids adjacent to the given grid.
- *
- * Note -- Assumes "in_bounds(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,
+/*!
+ * @brief 隣接4マスに存在する通路の数を返す / Count the number of "corridor" grids adjacent to the given grid.
+ * @param y1 基準となるマスのY座標
+ * @param x1 基準となるマスのX座標
+ * @return 通路の数
+ * @note Assumes "in_bounds(y1, x1)"
+ * @details
+ * XXX XXX This routine currently only counts actual "empty floor"\n
+ * grids which are not in rooms. We might want to also count stairs,\n
* open doors, closed doors, etc.
*/
static int next_to_corr(int y1, int x1)
}
-/*
- * Determine if the given location is "between" two walls,
- * and "next to" two corridor spaces. XXX XXX XXX
- *
- * Assumes "in_bounds(y, x)"
+/*!
+ * @brief ドアを設置可能な地形かを返す / Determine if the given location is "between" two walls, and "next to" two corridor spaces.
+ * @param y 判定を行いたいマスのY座標
+ * @param x 判定を行いたいマスのX座標
+ * @return ドアを設置可能ならばTRUEを返す
+ * @note Assumes "in_bounds(y1, x1)"
+ * @details
+ * XXX XXX XXX\n
+ * Assumes "in_bounds(y, x)"\n
*/
static bool possible_doorway(int y, int x)
{
return (FALSE);
}
-
-/*
- * Places door at y, x position if at least 2 walls found
+/*!
+ * @brief ドアの設置を試みる / Places door at y, x position if at least 2 walls found
+ * @param y 設置を行いたいマスのY座標
+ * @param x 設置を行いたいマスのX座標
+ * @return なし
*/
static void try_door(int y, int x)
{
}
-/* Place quest monsters */
+/*!
+ * @brief クエストに関わるモンスターの配置を行う / Place quest monsters
+ * @return 成功したならばTRUEを返す
+ */
bool place_quest_monsters(void)
{
int i;
for (k = 0; k < SAFE_MAX_ATTEMPTS; k++)
{
- int x, y;
+ int x = 0, y = 0;
int l;
/* Find an empty grid */
if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) continue;
if (!monster_can_enter(y, x, r_ptr, 0)) continue;
- if (distance(y, x, py, px) < 10) continue;
+ if (distance(y, x, p_ptr->y, p_ptr->x) < 10) continue;
if (c_ptr->info & CAVE_ICKY) continue;
else break;
}
}
-/*
- * Set boundary mimic and add "solid" perma-wall
+/*!
+ * @brief マスにフロア端用の永久壁を配置する / Set boundary mimic and add "solid" perma-wall
+ * @param c_ptr 永久壁を廃止したいマス構造体の参照ポインタ
+ * @return なし
*/
static void set_bound_perm_wall(cave_type *c_ptr)
{
place_solid_perm_grid(c_ptr);
}
-
-/*
- * Generate various caverns and lakes
- *
- * There were moved from cave_gen().
+/*!
+ * @brief フロアに洞窟や湖を配置する / Generate various caverns and lakes
+ * @details There were moved from cave_gen().
+ * @return なし
*/
static void gen_caverns_and_lakes(void)
{
if (dun->laketype)
{
- if (cheat_room)
-#ifdef JP
- msg_print("¸Ð¤òÀ¸À®¡£");
-#else
- msg_print("Lake on the level.");
-#endif
-
+ msg_print_wizard(CHEAT_DUNGEON, _("湖を生成します。", "Lake on the level."));
build_lake(dun->laketype);
}
}
/* make a large fractal cave in the middle of the dungeon */
- if (cheat_room)
-#ifdef JP
- msg_print("ƶ·¢¤òÀ¸À®¡£");
-#else
- msg_print("Cavern on level.");
-#endif
-
+ msg_print_wizard(CHEAT_DUNGEON, _("洞窟を生成。", "Cavern on level."));
build_cavern();
}
#endif /* ALLOW_CAVERNS_AND_LAKES */
}
-
-/*
- * Generate a new dungeon level
- *
- * Note that "dun_body" adds about 4000 bytes of memory to the stack.
+/*!
+ * @brief ダンジョン生成のメインルーチン / Generate a new dungeon level
+ * @details Note that "dun_body" adds about 4000 bytes of memory to the stack.
+ * @return ダンジョン生成が全て無事に成功したらTRUEを返す。
*/
static bool cave_gen(void)
{
if (ironman_empty_levels || ((d_info[dungeon_type].flags1 & DF1_ARENA) && (empty_levels && one_in_(EMPTY_LEVEL))))
{
dun->empty_level = TRUE;
-
- if (cheat_room)
-#ifdef JP
- msg_print("¥¢¥ê¡¼¥Ê¥ì¥Ù¥ë");
-#else
- msg_print("Arena level.");
-#endif
+ msg_print_wizard(CHEAT_DUNGEON, _("アリーナレベルを生成。", "Arena level."));
}
if (dun->empty_level)
/* Hack -- Add some rivers */
if (one_in_(3) && (randint1(dun_level) > 5))
{
- int feat1 = 0, feat2 = 0;
+ IDX feat1 = 0, feat2 = 0;
/* Choose water or lava */
if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_type].flags1 & DF1_WATER_RIVER))
i += 1;
if (i > small_tester) i = small_tester;
- else if (cheat_hear)
- {
-#ifdef JP
-msg_format("¥â¥ó¥¹¥¿¡¼¿ô´ðËÜÃͤò %d ¤«¤é %d ¤Ë¸º¤é¤·¤Þ¤¹", small_tester, i);
-#else
- msg_format("Reduced monsters base from %d to %d", small_tester, i);
-#endif
+ else msg_format_wizard(CHEAT_DUNGEON,
+ _("モンスター数基本値を %d から %d に減らします", "Reduced monsters base from %d to %d"), small_tester, i);
- }
}
i += randint1(8);
return TRUE;
}
-
-/*
- * Builds the arena after it is entered -KMW-
+/*!
+ * @brief 闘技場用のアリーナ地形を作成する / Builds the arena after it is entered -KMW-
+ * @return なし
*/
static void build_arena(void)
{
player_place(i, j);
}
-
-/*
- * Town logic flow for generation of arena -KMW-
+/*!
+ * @brief 闘技場への入場処理 / Town logic flow for generation of arena -KMW-
+ * @return なし
*/
static void arena_gen(void)
{
build_arena();
- if(!place_monster_aux(0, py + 5, px, arena_info[p_ptr->arena_number].r_idx, (PM_NO_KAGE | PM_NO_PET)))
+ if(!place_monster_aux(0, p_ptr->y + 5, p_ptr->x, arena_info[p_ptr->arena_number].r_idx, (PM_NO_KAGE | PM_NO_PET)))
{
p_ptr->exit_bldg = TRUE;
p_ptr->arena_number++;
#ifdef JP
- msg_print("Áê¼ê¤Ï·ç¾ì¤·¤¿¡£¤¢¤Ê¤¿¤ÎÉÔÀᄀ¤À¡£");
+ msg_print("相手は欠場した。あなたの不戦勝だ。");
#else
msg_print("The enemy is unable appear. You won by default.");
#endif
}
-
-
-/*
- * Builds the arena after it is entered -KMW-
+/*!
+ * @brief モンスター闘技場のフロア生成 / Builds the arena after it is entered -KMW-
+ * @return なし
*/
static void build_battle(void)
{
player_place(i, j);
}
-
-/*
- * Town logic flow for generation of arena -KMW-
+/*!
+ * @brief モンスター闘技場への導入処理 / Town logic flow for generation of arena -KMW-
+ * @return なし
*/
static void battle_gen(void)
{
- int y, x, i;
+ int y, x;
+ MONSTER_IDX i;
int qy = 0;
int qx = 0;
build_battle();
- for(i=0;i<4;i++)
+ for(i = 0; i < 4; i++)
{
- place_monster_aux(0, py + 8 + (i/2)*4, px - 2 + (i%2)*4, battle_mon[i],
+ place_monster_aux(0, p_ptr->y + 8 + (i/2)*4, p_ptr->x - 2 + (i%2)*4, battle_mon[i],
(PM_NO_KAGE | PM_NO_PET));
- set_friendly(&m_list[cave[py+8+(i/2)*4][px-2+(i%2)*4].m_idx]);
+ set_friendly(&m_list[cave[p_ptr->y+8+(i/2)*4][p_ptr->x-2+(i%2)*4].m_idx]);
}
for(i = 1; i < m_max; i++)
{
}
}
-
-/*
- * Generate a quest level
+/*!
+ * @brief 固定マップクエストのフロア生成 / Generate a quest level
+ * @return なし
*/
static void quest_gen(void)
{
process_dungeon_file("q_info.txt", 0, 0, MAX_HGT, MAX_WID);
}
-/* Make a real level */
+/*!
+ * @brief ダンジョン時のランダムフロア生成 / Make a real level
+ * @return フロアの生成に成功したらTRUE
+ */
static bool level_gen(cptr *why)
{
int level_height, level_width;
(d_info[dungeon_type].flags1 & DF1_SMALLEST)) &&
!(d_info[dungeon_type].flags1 & DF1_BIG))
{
- if (cheat_room)
-#ifdef JP
- msg_print("¾®¤µ¤Ê¥Õ¥í¥¢");
-#else
- msg_print("A 'small' dungeon level.");
-#endif
-
if (d_info[dungeon_type].flags1 & DF1_SMALLEST)
{
level_height = 1;
panel_row_min = cur_hgt;
panel_col_min = cur_wid;
- if (cheat_room)
- msg_format("X:%d, Y:%d.", cur_wid, cur_hgt);
+ msg_format_wizard(CHEAT_DUNGEON,
+ _("小さなフロア: X:%d, Y:%d", "A 'small' dungeon level: X:%d, Y:%d."),
+ cur_wid, cur_hgt);
}
else
{
if (!cave_gen())
{
#ifdef JP
-*why = "¥À¥ó¥¸¥ç¥óÀ¸À®¤Ë¼ºÇÔ";
+*why = "ダンジョン生成に失敗";
#else
*why = "could not place player";
#endif
else return TRUE;
}
-
-/*
- * Wipe all unnecessary flags after cave generation
+/*!
+ * @brief フロアに存在する全マスの記憶状態を初期化する / Wipe all unnecessary flags after cave generation
+ * @return なし
*/
void wipe_generate_cave_flags(void)
{
}
}
-
-/*
- * Clear and empty the cave
+/*!
+ * @brief フロアの全情報を初期化する / Clear and empty the cave
+ * @return なし
*/
void clear_cave(void)
{
}
/* Mega-Hack -- no player yet */
- px = py = 0;
+ p_ptr->x = p_ptr->y = 0;
/* Set the base level */
base_level = dun_level;
}
-/*
- * Generates a random dungeon level -RAK-
- *
- * Hack -- regenerate any "overflow" levels
+/*!
+ * ダンジョンのランダムフロアを生成する / Generates a random dungeon level -RAK-
+ * @return なし
+ * @note Hack -- regenerate any "overflow" levels
*/
void generate_cave(void)
{
{
/* Message */
#ifdef JP
-why = "¥¢¥¤¥Æ¥à¤¬Â¿¤¹¤®¤ë";
+why = "アイテムが多すぎる";
#else
why = "too many objects";
#endif
{
/* Message */
#ifdef JP
-why = "¥â¥ó¥¹¥¿¡¼¤¬Â¿¤¹¤®¤ë";
+why = "モンスターが多すぎる";
#else
why = "too many monsters";
#endif
/* Message */
#ifdef JP
-if (why) msg_format("À¸À®¤ä¤êľ¤·(%s)", why);
+if (why) msg_format("生成やり直し(%s)", why);
#else
if (why) msg_format("Generation restarted (%s)", why);
#endif