static FLOOR_IDX new_floor_id; /*!<次のフロアのID / floor_id of the destination */
-BIT_FLAGS change_floor_mode; /*!<フロア移行処理に関するフラグ / Mode flags for changing floor */
static u32b latest_visit_mark; /*!<フロアを渡った回数?(確認中) / Max number of visit_mark */
/*
new_floor_id = 0;
/* No change floor mode yet */
- change_floor_mode = 0;
+ p_ptr->change_floor_mode = 0;
#ifdef SET_UID
# ifdef SECURE
*/
void prepare_change_floor_mode(BIT_FLAGS mode)
{
- change_floor_mode |= mode;
+ p_ptr->change_floor_mode |= mode;
}
/*!
* @brief 階段移動先のフロアが生成できない時に簡単な行き止まりマップを作成する / Builds the dead end
* @return なし
*/
-static void build_dead_end(void)
+static void build_dead_end(floor_type *floor_ptr)
{
POSITION x, y;
- /* Clear and empty the current_floor_ptr->grid_array */
- clear_cave();
+ clear_cave(floor_ptr);
/* Fill the arrays of floors and walls in the good proportions */
set_floor_and_wall(0);
/* Smallest area */
- current_floor_ptr->height = SCREEN_HGT;
- current_floor_ptr->width = SCREEN_WID;
+ floor_ptr->height = SCREEN_HGT;
+ floor_ptr->width = SCREEN_WID;
/* Filled with permanent walls */
for (y = 0; y < MAX_HGT; y++)
}
/* Place at center of the floor */
- p_ptr->y = current_floor_ptr->height / 2;
- p_ptr->x = current_floor_ptr->width / 2;
+ p_ptr->y = floor_ptr->height / 2;
+ p_ptr->x = floor_ptr->width / 2;
/* Give one square */
place_floor_bold(p_ptr->y, p_ptr->x);
- wipe_generate_random_floor_flags();
+ wipe_generate_random_floor_flags(floor_ptr);
}
* If player is in wild mode, no pets are preserved
* except a monster whom player riding
*/
- if (!p_ptr->wild_mode && !p_ptr->inside_arena && !p_ptr->inside_battle)
+ if (!p_ptr->wild_mode && !p_ptr->inside_arena && !p_ptr->phase_out)
{
for (i = current_floor_ptr->m_max - 1, num = 1; (i >= 1 && num < MAX_PARTY_MON); i--)
{
if (p_ptr->riding == i) continue;
monster_desc(m_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
- do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_MOVED, m_name);
+ exe_write_diary(p_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_MOVED, m_name);
}
}
* @brief 移動先のフロアに伴ったペットを配置する / Place preserved pet monsters on new floor
* @return なし
*/
-static void place_pet(void)
+static void place_pet(player_type *master_ptr)
{
int i;
- int max_num = p_ptr->wild_mode ? 1 : MAX_PARTY_MON;
+ int max_num = master_ptr->wild_mode ? 1 : MAX_PARTY_MON;
for (i = 0; i < max_num; i++)
{
if (i == 0)
{
m_idx = m_pop();
- p_ptr->riding = m_idx;
+ master_ptr->riding = m_idx;
if (m_idx)
{
- cy = p_ptr->y;
- cx = p_ptr->x;
+ cy = master_ptr->y;
+ cx = master_ptr->x;
}
}
else
{
for (j = 1000; j > 0; j--)
{
- scatter(&cy, &cx, p_ptr->y, p_ptr->x, d, 0);
+ scatter(&cy, &cx, master_ptr->y, master_ptr->x, d, 0);
if (monster_can_enter(cy, cx, &r_info[party_mon[i].r_idx], 0)) break;
}
if (j) break;
if (record_named_pet && m_ptr->nickname)
{
monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
- do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, m_name);
+ exe_write_diary(master_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, m_name);
}
/* Pre-calculated in precalc_cur_num_of_pet(), but need to decrease */
* @param sf_ptr 移動元の保存フロア構造体参照ポインタ
* @return なし
*/
-static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS prev_floor_mode)
+static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS floor_mode)
{
POSITION x, y, sx = 0, sy = 0;
POSITION x_table[20];
feature_type *f_ptr = &f_info[g_ptr->feat];
bool ok = FALSE;
- if (prev_floor_mode & CFM_UP)
+ if (floor_mode & CFM_UP)
{
if (have_flag(f_ptr->flags, FF_LESS) && have_flag(f_ptr->flags, FF_STAIRS) &&
!have_flag(f_ptr->flags, FF_SPECIAL))
}
}
- else if (prev_floor_mode & CFM_DOWN)
+ else if (floor_mode & CFM_DOWN)
{
if (have_flag(f_ptr->flags, FF_MORE) && have_flag(f_ptr->flags, FF_STAIRS) &&
!have_flag(f_ptr->flags, FF_SPECIAL))
* / Maintain quest monsters, mark next floor_id at stairs, save current floor, and prepare to enter next floor.
* @return なし
*/
-void leave_floor(void)
+void leave_floor(BIT_FLAGS floor_mode)
{
grid_type *g_ptr = NULL;
feature_type *f_ptr;
/* Remove all mirrors without explosion */
remove_all_mirrors(FALSE);
- if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
+ if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(p_ptr, FALSE);
/* New floor is not yet prepared */
new_floor_id = 0;
/* Temporary get a floor_id (for Arena) */
if (!p_ptr->floor_id &&
- (change_floor_mode & CFM_SAVE_FLOORS) &&
- !(change_floor_mode & CFM_NO_RETURN))
+ (floor_mode & CFM_SAVE_FLOORS) &&
+ !(floor_mode & CFM_NO_RETURN))
{
/* Get temporal floor_id */
p_ptr->floor_id = get_new_floor_id();
sf_ptr = get_sf_ptr(p_ptr->floor_id);
/* Choose random stairs */
- if ((change_floor_mode & CFM_RAND_CONNECT) && p_ptr->floor_id)
+ if ((floor_mode & CFM_RAND_CONNECT) && p_ptr->floor_id)
{
- locate_connected_stairs(sf_ptr, change_floor_mode);
+ locate_connected_stairs(sf_ptr, floor_mode);
}
/* Extract new dungeon level */
- if (change_floor_mode & CFM_SAVE_FLOORS)
+ if (floor_mode & CFM_SAVE_FLOORS)
{
/* Extract stair position */
g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
}
/* Climb up/down some sort of stairs */
- if (change_floor_mode & (CFM_DOWN | CFM_UP))
+ if (floor_mode & (CFM_DOWN | CFM_UP))
{
int move_num = 0;
/* Extract level movement number */
- if (change_floor_mode & CFM_DOWN) move_num = 1;
- else if (change_floor_mode & CFM_UP) move_num = -1;
+ if (floor_mode & CFM_DOWN) move_num = 1;
+ else if (floor_mode & CFM_UP) move_num = -1;
/* Shafts are deeper than normal stairs */
- if (change_floor_mode & CFM_SHAFT)
+ if (floor_mode & CFM_SHAFT)
move_num += SGN(move_num);
/* Get out from or Enter the dungeon */
- if (change_floor_mode & CFM_DOWN)
+ if (floor_mode & CFM_DOWN)
{
if (!current_floor_ptr->dun_level)
move_num = d_info[p_ptr->dungeon_idx].mindepth;
}
- else if (change_floor_mode & CFM_UP)
+ else if (floor_mode & CFM_UP)
{
if (current_floor_ptr->dun_level + move_num < d_info[p_ptr->dungeon_idx].mindepth)
move_num = -current_floor_ptr->dun_level;
p_ptr->dungeon_idx = 0;
/* Reach to the surface -- Clear all saved floors */
- change_floor_mode &= ~CFM_SAVE_FLOORS;
+ floor_mode &= ~CFM_SAVE_FLOORS;
}
/* Kill some old saved floors */
- if (!(change_floor_mode & CFM_SAVE_FLOORS))
+ if (!(floor_mode & CFM_SAVE_FLOORS))
{
/* Kill all saved floors */
for (i = 0; i < MAX_SAVED_FLOORS; i++)
/* Reset visit_mark count */
latest_visit_mark = 1;
}
- else if (change_floor_mode & CFM_NO_RETURN)
+ else if (floor_mode & CFM_NO_RETURN)
{
/* Kill current floor */
kill_saved_floor(sf_ptr);
}
/* Fix connection -- level teleportation or trap door */
- if (change_floor_mode & CFM_RAND_CONNECT)
+ if (floor_mode & CFM_RAND_CONNECT)
{
- if (change_floor_mode & CFM_UP)
+ if (floor_mode & CFM_UP)
sf_ptr->upper_floor_id = new_floor_id;
- else if (change_floor_mode & CFM_DOWN)
+ else if (floor_mode & CFM_DOWN)
sf_ptr->lower_floor_id = new_floor_id;
}
/* If you can return, you need to save previous floor */
- if ((change_floor_mode & CFM_SAVE_FLOORS) &&
- !(change_floor_mode & CFM_NO_RETURN))
+ if ((floor_mode & CFM_SAVE_FLOORS) &&
+ !(floor_mode & CFM_NO_RETURN))
{
/* Get out of the my way! */
get_out_monster();
forget_lite();
forget_view();
- clear_mon_lite();
+ clear_mon_lite(current_floor_ptr);
/* Save current floor */
if (!save_floor(sf_ptr, 0))
* restored from the temporal file. If the floor is new one, new current_floor_ptr->grid_array\n
* will be generated.\n
*/
-void change_floor(BIT_FLAGS next_floor_mode)
+void change_floor(BIT_FLAGS floor_mode)
{
saved_floor_type *sf_ptr;
bool loaded = FALSE;
p_ptr->ambush_flag = FALSE;
/* No saved floors (On the surface etc.) */
- if (!(next_floor_mode & CFM_SAVE_FLOORS) &&
- !(next_floor_mode & CFM_FIRST_FLOOR))
+ if (!(floor_mode & CFM_SAVE_FLOORS) &&
+ !(floor_mode & CFM_FIRST_FLOOR))
{
/* Create current_floor_ptr->grid_array */
- generate_random_floor();
+ generate_random_floor(current_floor_ptr);
/* Paranoia -- No new saved floor */
new_floor_id = 0;
loaded = TRUE;
/* Forbid return stairs */
- if (next_floor_mode & CFM_NO_RETURN)
+ if (floor_mode & CFM_NO_RETURN)
{
grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
if (!feat_uses_special(g_ptr->feat))
{
- if (next_floor_mode & (CFM_DOWN | CFM_UP))
+ if (floor_mode & (CFM_DOWN | CFM_UP))
{
/* Reset to floor */
g_ptr->feat = feat_ground_type[randint0(100)];
{
saved_floor_type *cur_sf_ptr = get_sf_ptr(p_ptr->floor_id);
- if (next_floor_mode & CFM_UP)
+ if (floor_mode & CFM_UP)
{
/* New floor is right-above */
if (cur_sf_ptr->upper_floor_id == new_floor_id)
sf_ptr->lower_floor_id = p_ptr->floor_id;
}
- else if (next_floor_mode & CFM_DOWN)
+ else if (floor_mode & CFM_DOWN)
{
/* New floor is right-under */
if (cur_sf_ptr->lower_floor_id == new_floor_id)
/* Break connection to killed floor */
else
{
- if (next_floor_mode & CFM_UP)
+ if (floor_mode & CFM_UP)
sf_ptr->lower_floor_id = 0;
- else if (next_floor_mode & CFM_DOWN)
+ else if (floor_mode & CFM_DOWN)
sf_ptr->upper_floor_id = 0;
}
msg_print(_("階段は行き止まりだった。", "The staircases come to a dead end..."));
/* Create simple dead end */
- build_dead_end();
+ build_dead_end(current_floor_ptr);
/* Break connection */
- if (next_floor_mode & CFM_UP)
+ if (floor_mode & CFM_UP)
{
sf_ptr->upper_floor_id = 0;
}
- else if (next_floor_mode & CFM_DOWN)
+ else if (floor_mode & CFM_DOWN)
{
sf_ptr->lower_floor_id = 0;
}
else
{
/* Newly create current_floor_ptr->grid_array */
- generate_random_floor();
+ generate_random_floor(current_floor_ptr);
}
/* Record last visit current_world_ptr->game_turn */
sf_ptr->dun_level = current_floor_ptr->dun_level;
/* Create connected stairs */
- if (!(next_floor_mode & CFM_NO_RETURN))
+ if (!(floor_mode & CFM_NO_RETURN))
{
/* Extract stair position */
grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
/*** Create connected stairs ***/
/* No stairs down from Quest */
- if ((next_floor_mode & CFM_UP) && !quest_number(current_floor_ptr->dun_level))
+ if ((floor_mode & CFM_UP) && !quest_number(current_floor_ptr->dun_level))
{
- g_ptr->feat = (next_floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair;
+ g_ptr->feat = (floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair;
}
/* No stairs up when ironman_downward */
- else if ((next_floor_mode & CFM_DOWN) && !ironman_downward)
+ else if ((floor_mode & CFM_DOWN) && !ironman_downward)
{
- g_ptr->feat = (next_floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair;
+ g_ptr->feat = (floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair;
}
/* Paranoia -- Clear mimic */
}
/* Arrive at random grid */
- if (next_floor_mode & (CFM_RAND_PLACE))
+ if (floor_mode & (CFM_RAND_PLACE))
{
(void)new_player_spot();
}
/* You see stairs blocked */
- else if ((next_floor_mode & CFM_NO_RETURN) && (next_floor_mode & (CFM_DOWN | CFM_UP)))
+ else if ((floor_mode & CFM_NO_RETURN) && (floor_mode & (CFM_DOWN | CFM_UP)))
{
if (!p_ptr->blind)
{
}
/* Place preserved pet monsters */
- place_pet();
+ place_pet(p_ptr);
/* Reset travel target place */
forget_travel_flow();
/* Hack -- Munchkin characters always get whole map */
if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
- wiz_lite((bool)(p_ptr->pclass == CLASS_NINJA));
+ wiz_lite(p_ptr, (bool)(p_ptr->pclass == CLASS_NINJA));
/* Remember when this level was "created" */
current_floor_ptr->generated_turn = current_world_ptr->game_turn;
p_ptr->feeling = 0;
/* Clear all flags */
- next_floor_mode = 0L;
+ floor_mode = 0L;
- select_floor_music();
+ select_floor_music(p_ptr);
+ p_ptr->change_floor_mode = 0;
}