-/*!
+/*!
* @file floors.c
- * @brief Êݸ¤µ¤ì¤¿³¬¤Î´ÉÍý / management of the saved floor
+ * @brief 保存された階の管理 / management of the saved floor
* @date 2014/01/04
* @author
* Copyright (c) 2002 Mogami \n
#include "grid.h"
-static s16b new_floor_id; /*!<¼¡¤Î¥Õ¥í¥¢¤ÎID / floor_id of the destination */
-static u32b change_floor_mode; /*!<¥Õ¥í¥¢°Ü¹Ô½èÍý¤Ë´Ø¤¹¤ë¥Õ¥é¥° / Mode flags for changing floor */
-static u32b latest_visit_mark; /*!<¥Õ¥í¥¢¤òÅϤ俲ó¿ô¡©(³ÎǧÃæ) / Max number of visit_mark */
+static s16b new_floor_id; /*!<次のフロアのID / floor_id of the destination */
+static u32b change_floor_mode; /*!<ã\83\95ã\83ã\82¢ç§»è¡\8cå\87¦ç\90\86ã\81«é\96¢ã\81\99ã\82\8bã\83\95ã\83©ã\82° / Mode flags for changing floor */
+static u32b latest_visit_mark; /*!<フロアを渡った回数?(確認中) / Max number of visit_mark */
/*!
- * @brief Êݸ¥Õ¥í¥¢ÇÛÎó¤ò½é´ü²½¤¹¤ë / Initialize saved_floors array.
- * @param force ¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤¬»Ä¤Ã¤Æ¤¤¤¿¾ì¹ç¤â·Ù¹ð¤Ê¤·¤Ç¶¯À©Åª¤Ëºï½ü¤¹¤ë¡£
+ * @brief 保存フロア配列を初期化する / Initialize saved_floors array.
+ * @param force テンポラリファイルが残っていた場合も警告なしで強制的に削除する。
* @details Make sure that old temporal files are not remaining as gurbages.
- * @return ¤Ê¤·
+ * @return なし
*/
void init_saved_floors(bool force)
{
if (!force)
{
#ifdef JP
- msg_print("¥¨¥é¡¼¡§¸Å¤¤¥Æ¥ó¥Ý¥é¥ê¡¦¥Õ¥¡¥¤¥ë¤¬»Ä¤Ã¤Æ¤¤¤Þ¤¹¡£");
- msg_print("ÊѶòÈÚÅܤòÆó½Å¤Ëµ¯Æ°¤·¤Æ¤¤¤Ê¤¤¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£");
- msg_print("²áµî¤ËÊѶòÈÚÅܤ¬¥¯¥é¥Ã¥·¥å¤·¤¿¾ì¹ç¤Ï°ì»þ¥Õ¥¡¥¤¥ë¤ò");
- msg_print("¶¯À©Åª¤Ëºï½ü¤·¤Æ¼Â¹Ô¤ò³¤±¤é¤ì¤Þ¤¹¡£");
- if (!get_check("¶¯À©Åª¤Ëºï½ü¤·¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) quit("¼Â¹ÔÃæ»ß");
+ msg_print("エラー:古いテンポラリ・ファイルが残っています。");
+ msg_print("変愚蛮怒を二重に起動していないか確認してください。");
+ msg_print("過去に変愚蛮怒がクラッシュした場合は一時ファイルを");
+ msg_print("強制的に削除して実行を続けられます。");
+ if (!get_check("強制的に削除してもよろしいですか?")) quit("実行中止");
#else
msg_print("Error: There are old temporal files.");
msg_print("Make sure you are not running two game processes simultaneously.");
}
/*!
- * @brief Êݸ¥Õ¥í¥¢Íѥƥó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë / Kill temporal files
+ * @brief 保存フロア用テンポラリファイルを削除する / Kill temporal files
* @details Should be called just before the game quit.
- * @return ¤Ê¤·
+ * @return なし
*/
void clear_saved_floor_files(void)
{
}
/*!
- * @brief Êݸ¥Õ¥í¥¢ID¤«¤é»²¾È¥Ý¥¤¥ó¥¿¤òÆÀ¤ë / Get a pointer for an item of the saved_floors array.
- * @param floor_id Êݸ¥Õ¥í¥¢ID
- * @return ID¤ËÂбþ¤¹¤ëÊݸ¥Õ¥í¥¢¤Î¥Ý¥¤¥ó¥¿¡¢¤Ê¤¤¾ì¹ç¤ÏNULL¤òÊÖ¤¹¡£
+ * @brief 保存フロアIDから参照ポインタを得る / Get a pointer for an item of the saved_floors array.
+ * @param floor_id ä¿\9då\98ã\83\95ã\83ã\82¢ID
+ * @return IDに対応する保存フロアのポインタ、ない場合はNULLを返す。
*/
saved_floor_type *get_sf_ptr(s16b floor_id)
{
/*!
- * @brief »²¾È¥Ý¥¤¥ó¥¿Àè¤ÎÊݸ¥Õ¥í¥¢¤òËõ¾Ã¤¹¤ë / kill a saved floor and get an empty space
- * @param sf_ptr Êݸ¥Õ¥í¥¢¤Î»²¾È¥Ý¥¤¥ó¥¿
- * @return ¤Ê¤·
+ * @brief 参照ポインタ先の保存フロアを抹消する / kill a saved floor and get an empty space
+ * @param sf_ptr ä¿\9då\98ã\83\95ã\83ã\82¢ã\81®å\8f\82ç\85§ã\83\9dã\82¤ã\83³ã\82¿
+ * @return なし
*/
static void kill_saved_floor(saved_floor_type *sf_ptr)
{
/*!
- * @brief ¿·µ¬¤ËÍøÍѲÄǽ¤ÊÊݸ¥Õ¥í¥¢¤òÊÖ¤¹ / Initialize new saved floor and get its floor id.
- * @return ÍøÍѲÄǽ¤ÊÊݸ¥Õ¥í¥¢ID
+ * @brief 新規に利用可能な保存フロアを返す / Initialize new saved floor and get its floor id.
+ * @return å\88©ç\94¨å\8f¯è\83½ã\81ªä¿\9då\98ã\83\95ã\83ã\82¢ID
* @details
* If number of saved floors are already MAX_SAVED_FLOORS, kill the oldest one.
*/
s16b get_new_floor_id(void)
{
- saved_floor_type *sf_ptr;
+ saved_floor_type *sf_ptr = NULL;
int i;
/* Look for empty space */
/*!
- * @brief ¥Õ¥í¥¢ÀÚ¤êÂؤ¨»þ¤Î½èÍý¥Õ¥é¥°¤òÄɲ乤ë / Prepare mode flags of changing floor
- * @param mode Äɲä·¤¿¤¤½ê»ý¥Õ¥é¥°
- * @return ¤Ê¤·
+ * @brief フロア切り替え時の処理フラグを追加する / Prepare mode flags of changing floor
+ * @param mode 追å\8a ã\81\97ã\81\9fã\81\84æ\89\80æ\8c\81ã\83\95ã\83©ã\82°
+ * @return なし
*/
void prepare_change_floor_mode(u32b mode)
{
}
/*!
- * @brief ³¬ÃÊ°ÜÆ°Àè¤Î¥Õ¥í¥¢¤¬À¸À®¤Ç¤¤Ê¤¤»þ¤Ë´Êñ¤Ê¹Ô¤»ß¤Þ¤ê¥Þ¥Ã¥×¤òºîÀ®¤¹¤ë / Builds the dead end
- * @return ¤Ê¤·
+ * @brief 階段移動先のフロアが生成できない時に簡単な行き止まりマップを作成する / Builds the dead end
+ * @return なし
*/
static void build_dead_end(void)
{
}
/* Place at center of the floor */
- py = cur_hgt / 2;
- px = cur_wid / 2;
+ p_ptr->y = cur_hgt / 2;
+ p_ptr->x = cur_wid / 2;
/* Give one square */
- place_floor_bold(py, px);
+ place_floor_bold(p_ptr->y, p_ptr->x);
wipe_generate_cave_flags();
}
-#define MAX_PARTY_MON 21 /*!< ¥Õ¥í¥¢°ÜÆ°»þ¤ËÀè¤Î¥Õ¥í¥¢¤ËÏ¢¤ì¤Æ¹Ô¤±¤ë¥Ú¥Ã¥È¤ÎºÇÂç¿ô Maximum number of preservable pets */
-static monster_type party_mon[MAX_PARTY_MON]; /*!< ¥Õ¥í¥¢°ÜÆ°¤ËÊݸ¤¹¤ë¥Ú¥Ã¥È¥â¥ó¥¹¥¿¡¼¤ÎÇÛÎó */
+#define MAX_PARTY_MON 21 /*!< フロア移動時に先のフロアに連れて行けるペットの最大数 Maximum number of preservable pets */
+static monster_type party_mon[MAX_PARTY_MON]; /*!< フロア移動に保存するペットモンスターの配列 */
/*!
- * @brief ¥Õ¥í¥¢°ÜÆ°»þ¤Î¥Ú¥Ã¥ÈÊݸ½èÍý / Preserve_pets
- * @return ¤Ê¤·
+ * @brief フロア移動時のペット保存処理 / Preserve_pets
+ * @return なし
*/
static void preserve_pet(void)
{
}
else
{
- int dis = distance(py, px, m_ptr->fy, m_ptr->fx);
+ int dis = distance(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx);
/* Confused (etc.) monsters don't follow. */
if (MON_CONFUSED(m_ptr) || MON_STUNNED(m_ptr) || MON_CSLEEP(m_ptr)) continue;
* when you or the pet can see the other.
*/
if (m_ptr->nickname &&
- ((player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(py, px, m_ptr->fy, m_ptr->fx)) ||
- (los(m_ptr->fy, m_ptr->fx, py, px) && projectable(m_ptr->fy, m_ptr->fx, py, px))))
+ ((player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) ||
+ (los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x) && projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x))))
{
if (dis > 3) continue;
}
monster_desc(m_name, m_ptr, 0);
#ifdef JP
- msg_format("%s¤Ï¾Ã¤¨µî¤Ã¤¿¡ª", m_name);
+ msg_format("%sは消え去った!", m_name);
#else
msg_format("%^s disappears!", m_name);
#endif
/*!
- * @brief ¥Õ¥í¥¢°ÜÆ°»þ¤Ë¥Ú¥Ã¥È¤òȼ¤Ã¤¿¾ì¹ç¤Î½àÈ÷½èÍý / Pre-calculate the racial counters of preserved pets
- * @return ¤Ê¤·
+ * @brief フロア移動時にペットを伴った場合の準備処理 / Pre-calculate the racial counters of preserved pets
+ * @return なし
* @details
* To prevent multiple generation of unique monster who is the minion of player
*/
}
/*!
- * @brief °ÜÆ°Àè¤Î¥Õ¥í¥¢¤Ëȼ¤Ã¤¿¥Ú¥Ã¥È¤òÇÛÃÖ¤¹¤ë / Place preserved pet monsters on new floor
- * @return ¤Ê¤·
+ * @brief 移動先のフロアに伴ったペットを配置する / Place preserved pet monsters on new floor
+ * @return なし
*/
static void place_pet(void)
{
for (i = 0; i < max_num; i++)
{
- int cy, cx, m_idx;
+ int cy = 0, cx = 0, m_idx;
if (!(party_mon[i].r_idx)) continue;
p_ptr->riding = m_idx;
if (m_idx)
{
- cy = py;
- cx = px;
+ cy = p_ptr->y;
+ cx = p_ptr->x;
}
}
else
{
for (j = 1000; j > 0; j--)
{
- scatter(&cy, &cx, py, px, d, 0);
+ scatter(&cy, &cx, p_ptr->y, p_ptr->x, d, 0);
if (monster_can_enter(cy, cx, &r_info[party_mon[i].r_idx], 0)) break;
}
if (j) break;
monster_desc(m_name, m_ptr, 0);
#ifdef JP
- msg_format("%s¤È¤Ï¤°¤ì¤Æ¤·¤Þ¤Ã¤¿¡£", m_name);
+ msg_format("%sとはぐれてしまった。", m_name);
#else
msg_format("You have lost sight of %s.", m_name);
#endif
/*!
- * @brief ¥æ¥Ë¡¼¥¯¥â¥ó¥¹¥¿¡¼¤ä¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î½êºß¥Õ¥í¥¢¤ò¹¹¿·¤¹¤ë / Hack -- Update location of unique monsters and artifacts
- * @param cur_floor_id ¸½ºß¤Î¥Õ¥í¥¢ID
- * @return ¤Ê¤·
+ * @brief ユニークモンスターやアーティファクトの所在フロアを更新する / Hack -- Update location of unique monsters and artifacts
+ * @param cur_floor_id ç\8f¾å\9c¨ã\81®ã\83\95ã\83ã\82¢ID
+ * @return なし
* @details
* The r_ptr->floor_id and a_ptr->floor_id are not updated correctly\n
* while new floor creation since dungeons may be re-created by\n
/*!
- * @brief ¥Õ¥í¥¢°ÜÆ°»þ¡¢¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°Àè¥â¥ó¥¹¥¿¡¼¤¬´û¤Ë¤¤¤¿¾ì¹ç¥é¥ó¥À¥à¤Ê¶áÎ٤˰ÜÆ°¤µ¤»¤ë / When a monster is at a place where player will return,
- * @return ¤Ê¤·
+ * @brief フロア移動時、プレイヤーの移動先モンスターが既にいた場合ランダムな近隣に移動させる / When a monster is at a place where player will return,
+ * @return なし
*/
static void get_out_monster(void)
{
int tries = 0;
int dis = 1;
- int oy = py;
- int ox = px;
+ int oy = p_ptr->y;
+ int ox = p_ptr->x;
int m_idx = cave[oy][ox].m_idx;
/* Nothing to do if no monster */
}
/*!
- * ¥Þ¥¹¹½Â¤ÂΤÎspecialÍ×ÁǤòÍøÍѤ¹¤ëÃÏ·Á¤«¤É¤¦¤«¤òȽÄꤹ¤ë¥Þ¥¯¥í / Is this feature has special meaning (except floor_id) with c_ptr->special?
+ * マス構造体のspecial要素を利用する地形かどうかを判定するマクロ / Is this feature has special meaning (except floor_id) with c_ptr->special?
*/
#define feat_uses_special(F) (have_flag(f_info[(F)].flags, FF_SPECIAL))
/*!
- * @brief ¿·¥Õ¥í¥¢¤Ë°ÜÆ°¸µ¥Õ¥í¥¢¤Ë·Ò¤¬¤ë³¬ÃʤòÇÛÃÖ¤¹¤ë / Virtually teleport onto the stairs that is connecting between two floors.
- * @param sf_ptr °ÜÆ°¸µ¤ÎÊݸ¥Õ¥í¥¢¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
- * @return ¤Ê¤·
+ * @brief 新フロアに移動元フロアに繋がる階段を配置する / Virtually teleport onto the stairs that is connecting between two floors.
+ * @param sf_ptr 移å\8b\95å\85\83ã\81®ä¿\9då\98ã\83\95ã\83ã\82¢æ§\8bé\80 ä½\93å\8f\82ç\85§ã\83\9dã\82¤ã\83³ã\82¿
+ * @return なし
*/
static void locate_connected_stairs(saved_floor_type *sf_ptr)
{
if (sx)
{
/* Already fixed */
- py = sy;
- px = sx;
+ p_ptr->y = sy;
+ p_ptr->x = sx;
}
else if (!num)
{
prepare_change_floor_mode(CFM_RAND_PLACE | CFM_NO_RETURN);
/* Mega Hack -- It's not the stairs you enter. Disable it. */
- if (!feat_uses_special(cave[py][px].feat)) cave[py][px].special = 0;
+ if (!feat_uses_special(cave[p_ptr->y][p_ptr->x].feat)) cave[p_ptr->y][p_ptr->x].special = 0;
}
else
{
i = randint0(num);
/* Point stair location */
- py = y_table[i];
- px = x_table[i];
+ p_ptr->y = y_table[i];
+ p_ptr->x = x_table[i];
}
}
/*!
- * @brief ¸½ºß¤Î¥Õ¥í¥¢¤òÎ¥¤ì¤ë¤Ëȼ¤Ã¤Æ¹Ô£ùÊݸ½èÍý
+ * @brief 現在のフロアを離れるに伴って行なわれる保存処理
* / Maintain quest monsters, mark next floor_id at stairs, save current floor, and prepare to enter next floor.
- * @return ¤Ê¤·
+ * @return なし
*/
void leave_floor(void)
{
if (change_floor_mode & CFM_SAVE_FLOORS)
{
/* Extract stair position */
- c_ptr = &cave[py][px];
+ c_ptr = &cave[p_ptr->y][p_ptr->x];
f_ptr = &f_info[c_ptr->feat];
/* Get back to old saved floor? */
/* Kill some old saved floors */
if (!(change_floor_mode & CFM_SAVE_FLOORS))
{
- int i;
-
/* Kill all saved floors */
for (i = 0; i < MAX_SAVED_FLOORS; i++)
kill_saved_floor(&saved_floors[i]);
/*!
- * @brief ¥Õ¥í¥¢¤ÎÀÚ¤êÂؤ¨½èÍý / Enter new floor.
- * @return ¤Ê¤·
+ * @brief フロアの切り替え処理 / Enter new floor.
+ * @return なし
* @details
* If the floor is an old saved floor, it will be\n
* restored from the temporal file. If the floor is new one, new cave\n
/* Forbid return stairs */
if (change_floor_mode & CFM_NO_RETURN)
{
- cave_type *c_ptr = &cave[py][px];
+ cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
if (!feat_uses_special(c_ptr->feat))
{
{
/* Temporal file is broken? */
#ifdef JP
- msg_print("³¬ÃʤϹԤ»ß¤Þ¤ê¤À¤Ã¤¿¡£");
+ msg_print("階段は行き止まりだった。");
#else
msg_print("The staircases come to a dead end...");
#endif
if (!(change_floor_mode & CFM_NO_RETURN))
{
/* Extract stair position */
- cave_type *c_ptr = &cave[py][px];
+ cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
/*** Create connected stairs ***/
if (!p_ptr->blind)
{
#ifdef JP
- msg_print("ÆÍÁ³³¬Ãʤ¬ºÉ¤¬¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
+ msg_print("突然階段が塞がれてしまった。");
#else
msg_print("Suddenly the stairs is blocked!");
#endif
else
{
#ifdef JP
- msg_print("¥´¥È¥´¥È¤È²¿¤«²»¤¬¤·¤¿¡£");
+ msg_print("ゴトゴトと何か音がした。");
#else
msg_print("You hear some noises.");
#endif
}
/*!
- * @brief ¥×¥ì¥¤¥ä¡¼¤Î¼ê¤Ë¤è¤ëǽưŪ¤Ê³¬ÃÊÀ¸À®½èÍý /
+ * @brief プレイヤーの手による能動的な階段生成処理 /
* Create stairs at or move previously created stairs into the player location.
- * @return ¤Ê¤·
+ * @return なし
*/
void stair_creation(void)
{
{
/* arena or quest */
#ifdef JP
- msg_print("¸ú²Ì¤¬¤¢¤ê¤Þ¤»¤ó¡ª");
+ msg_print("効果がありません!");
#else
msg_print("There is no effect!");
#endif
}
/* Artifacts resists */
- if (!cave_valid_bold(py, px))
+ if (!cave_valid_bold(p_ptr->y, p_ptr->x))
{
#ifdef JP
- msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
+ msg_print("床上のアイテムが呪文を跳ね返した。");
#else
msg_print("The object resists the spell.");
#endif
}
/* Destroy all objects in the grid */
- delete_object(py, px);
+ delete_object(p_ptr->y, p_ptr->x);
/* Extract current floor data */
sf_ptr = get_sf_ptr(p_ptr->floor_id);
/* Create a staircase */
if (up)
{
- cave_set_feat(py, px,
+ cave_set_feat(p_ptr->y, p_ptr->x,
(dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= dun_level - 2)) ?
feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair);
}
else
{
- cave_set_feat(py, px,
+ cave_set_feat(p_ptr->y, p_ptr->x,
(dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= dun_level + 2)) ?
feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair);
}
/* Connect this stairs to the destination */
- cave[py][px].special = dest_floor_id;
+ cave[p_ptr->y][p_ptr->x].special = dest_floor_id;
}