* included in all such copies. \n
* 2014 Deskull rearranged comment for Doxygen. \n
*/
+#pragma once
#include "angband.h"
#include "bldg.h"
#include "artifact.h"
#include "dungeon.h"
#include "floor.h"
+#include "floor-save.h"
#include "floor-events.h"
#include "floor-generate.h"
#include "feature.h"
+#include "geometry.h"
#include "grid.h"
#include "monster.h"
#include "quest.h"
sf_ptr->visit_mark = latest_visit_mark++;
/* sf_ptr->dun_level may be changed later */
- sf_ptr->dun_level = current_floor_ptr->dun_level;
+ sf_ptr->dun_level = p_ptr->current_floor_ptr->dun_level;
/* Increment number of floor_id */
if (p_ptr->riding)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding];
/* Pet of other pet don't follow. */
if (m_ptr->parent_m_idx)
*/
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--)
+ for (i = p_ptr->current_floor_ptr->m_max - 1, num = 1; (i >= 1 && num < MAX_PARTY_MON); i--)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
if (!is_pet(m_ptr)) continue;
}
}
- (void)COPY(&party_mon[num], ¤t_floor_ptr->m_list[i], monster_type);
+ (void)COPY(&party_mon[num], &p_ptr->current_floor_ptr->m_list[i], monster_type);
num++;
if (record_named_pet)
{
- for (i = current_floor_ptr->m_max - 1; i >=1; i--)
+ for (i = p_ptr->current_floor_ptr->m_max - 1; i >=1; i--)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
GAME_TEXT m_name[MAX_NLEN];
if (!monster_is_valid(m_ptr)) continue;
/* Pet of other pet may disappear. */
- for (i = current_floor_ptr->m_max - 1; i >=1; i--)
+ for (i = p_ptr->current_floor_ptr->m_max - 1; i >=1; i--)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
/* Are there its parent? */
- if (m_ptr->parent_m_idx && !current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx)
+ if (m_ptr->parent_m_idx && !p_ptr->current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx)
{
/* Its parent have gone, it also goes away. */
if (m_idx)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
monster_race *r_ptr;
- current_floor_ptr->grid_array[cy][cx].m_idx = m_idx;
+ p_ptr->current_floor_ptr->grid_array[cy][cx].m_idx = m_idx;
m_ptr->r_idx = party_mon[i].r_idx;
/* r_ptr->cur_num++; */
/* Hack -- Count the number of "reproducers" */
- if (r_ptr->flags2 & RF2_MULTIPLY) current_floor_ptr->num_repro++;
+ if (r_ptr->flags2 & RF2_MULTIPLY) p_ptr->current_floor_ptr->num_repro++;
}
else
int i;
/* Maintain unique monsters */
- for (i = 1; i < current_floor_ptr->m_max; i++)
+ for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
{
monster_race *r_ptr;
- monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
}
/* Maintain artifatcs */
- for (i = 1; i < current_floor_ptr->o_max; i++)
+ for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
{
- object_type *o_ptr = ¤t_floor_ptr->o_list[i];
+ object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
if (!OBJECT_IS_VALID(o_ptr)) continue;
* @brief フロア移動時、プレイヤーの移動先モンスターが既にいた場合ランダムな近隣に移動させる / When a monster is at a place where player will return,
* @return なし
*/
-static void get_out_monster(void)
+static void get_out_monster(floor_type *floor_ptr, player_type *protected_ptr)
{
int tries = 0;
POSITION dis = 1;
- POSITION oy = p_ptr->y;
- POSITION ox = p_ptr->x;
- MONSTER_IDX m_idx = current_floor_ptr->grid_array[oy][ox].m_idx;
+ POSITION oy = protected_ptr->y;
+ POSITION ox = protected_ptr->x;
+ MONSTER_IDX m_idx = floor_ptr->grid_array[oy][ox].m_idx;
/* Nothing to do if no monster */
if (!m_idx) return;
if (tries > 20 * dis * dis) dis++;
/* Ignore illegal locations */
- if (!in_bounds(ny, nx)) continue;
+ if (!in_bounds(floor_ptr, ny, nx)) continue;
/* Require "empty" floor space */
- if (!cave_empty_bold(ny, nx)) continue;
+ if (!cave_empty_bold(p_ptr->current_floor_ptr, ny, nx)) continue;
/* Hack -- no teleport onto glyph of warding */
- if (is_glyph_grid(¤t_floor_ptr->grid_array[ny][nx])) continue;
- if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[ny][nx])) continue;
+ if (is_glyph_grid(&floor_ptr->grid_array[ny][nx])) continue;
+ if (is_explosive_rune_grid(&floor_ptr->grid_array[ny][nx])) continue;
/* ...nor onto the Pattern */
if (pattern_tile(ny, nx)) continue;
/*** It's a good place ***/
- m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ m_ptr = &floor_ptr->m_list[m_idx];
/* Update the old location */
- current_floor_ptr->grid_array[oy][ox].m_idx = 0;
+ floor_ptr->grid_array[oy][ox].m_idx = 0;
/* Update the new location */
- current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
+ floor_ptr->grid_array[ny][nx].m_idx = m_idx;
/* Move the monster */
m_ptr->fy = ny;
* @param sf_ptr 移動元の保存フロア構造体参照ポインタ
* @return なし
*/
-static void locate_connected_stairs(saved_floor_type *sf_ptr, BIT_FLAGS floor_mode)
+static void locate_connected_stairs(player_type *creature_ptr, floor_type *floor_ptr, saved_floor_type *sf_ptr, BIT_FLAGS floor_mode)
{
POSITION x, y, sx = 0, sy = 0;
POSITION x_table[20];
int i;
/* Search usable stairs */
- for (y = 0; y < current_floor_ptr->height; y++)
+ for (y = 0; y < floor_ptr->height; y++)
{
- for (x = 0; x < current_floor_ptr->width; x++)
+ for (x = 0; x < floor_ptr->width; x++)
{
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ grid_type *g_ptr = &floor_ptr->grid_array[y][x];
feature_type *f_ptr = &f_info[g_ptr->feat];
bool ok = FALSE;
if (sx)
{
/* Already fixed */
- p_ptr->y = sy;
- p_ptr->x = sx;
+ creature_ptr->y = sy;
+ creature_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(current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat)) current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special = 0;
+ if (!feat_uses_special(floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat)) floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].special = 0;
}
else
{
i = randint0(num);
/* Point stair location */
- p_ptr->y = y_table[i];
- p_ptr->x = x_table[i];
+ creature_ptr->y = y_table[i];
+ creature_ptr->x = x_table[i];
}
}
* / Maintain quest monsters, mark next floor_id at stairs, save current floor, and prepare to enter next floor.
* @return なし
*/
-void leave_floor(BIT_FLAGS floor_mode)
+void leave_floor(player_type *creature_ptr)
{
grid_type *g_ptr = NULL;
feature_type *f_ptr;
saved_floor_type *sf_ptr;
MONRACE_IDX quest_r_idx = 0;
DUNGEON_IDX i;
-
+ FLOOR_IDX tmp_floor_idx = 0;
+
/* Preserve pets and prepare to take these to next floor */
preserve_pet();
/* Remove all mirrors without explosion */
remove_all_mirrors(FALSE);
- if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(p_ptr, FALSE);
+ if (creature_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(creature_ptr, FALSE);
/* New floor is not yet prepared */
new_floor_id = 0;
/* Temporary get a floor_id (for Arena) */
- if (!p_ptr->floor_id &&
- (floor_mode & CFM_SAVE_FLOORS) &&
- !(floor_mode & CFM_NO_RETURN))
+ if (!creature_ptr->floor_id &&
+ (creature_ptr->change_floor_mode & CFM_SAVE_FLOORS) &&
+ !(creature_ptr->change_floor_mode & CFM_NO_RETURN))
{
/* Get temporal floor_id */
- p_ptr->floor_id = get_new_floor_id();
+ tmp_floor_idx = get_new_floor_id();
}
/* Search the quest monster index */
if ((quest[i].status == QUEST_STATUS_TAKEN) &&
((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
(quest[i].type == QUEST_TYPE_RANDOM)) &&
- (quest[i].level == current_floor_ptr->dun_level) &&
- (p_ptr->dungeon_idx == quest[i].dungeon) &&
+ (quest[i].level == p_ptr->current_floor_ptr->dun_level) &&
+ (creature_ptr->dungeon_idx == quest[i].dungeon) &&
!(quest[i].flags & QUEST_FLAG_PRESET))
{
quest_r_idx = quest[i].r_idx;
}
/* Maintain quest monsters */
- for (i = 1; i < current_floor_ptr->m_max; i++)
+ for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
{
monster_race *r_ptr;
- monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
/* Check if there is a same item */
for (i = 0; i < INVEN_PACK; i++)
{
- object_type *o_ptr = &p_ptr->inventory_list[i];
+ object_type *o_ptr = &creature_ptr->inventory_list[i];
if (!OBJECT_IS_VALID(o_ptr)) continue;
}
/* Extract current floor info or NULL */
- sf_ptr = get_sf_ptr(p_ptr->floor_id);
+ sf_ptr = get_sf_ptr(tmp_floor_idx);
/* Choose random stairs */
- if ((floor_mode & CFM_RAND_CONNECT) && p_ptr->floor_id)
+ if ((creature_ptr->change_floor_mode & CFM_RAND_CONNECT) && tmp_floor_idx)
{
- locate_connected_stairs(sf_ptr, floor_mode);
+ locate_connected_stairs(creature_ptr, creature_ptr->current_floor_ptr, sf_ptr, creature_ptr->change_floor_mode);
}
/* Extract new dungeon level */
- if (floor_mode & CFM_SAVE_FLOORS)
+ if (creature_ptr->change_floor_mode & CFM_SAVE_FLOORS)
{
/* Extract stair position */
- g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+ g_ptr = &p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
f_ptr = &f_info[g_ptr->feat];
/* Get back to old saved floor? */
}
/* Climb up/down some sort of stairs */
- if (floor_mode & (CFM_DOWN | CFM_UP))
+ if (creature_ptr->change_floor_mode & (CFM_DOWN | CFM_UP))
{
int move_num = 0;
/* Extract level movement number */
- if (floor_mode & CFM_DOWN) move_num = 1;
- else if (floor_mode & CFM_UP) move_num = -1;
+ if (creature_ptr->change_floor_mode & CFM_DOWN) move_num = 1;
+ else if (creature_ptr->change_floor_mode & CFM_UP) move_num = -1;
/* Shafts are deeper than normal stairs */
- if (floor_mode & CFM_SHAFT)
+ if (creature_ptr->change_floor_mode & CFM_SHAFT)
move_num += SGN(move_num);
/* Get out from or Enter the dungeon */
- if (floor_mode & CFM_DOWN)
+ if (creature_ptr->change_floor_mode & CFM_DOWN)
{
- if (!current_floor_ptr->dun_level)
- move_num = d_info[p_ptr->dungeon_idx].mindepth;
+ if (!p_ptr->current_floor_ptr->dun_level)
+ move_num = d_info[creature_ptr->dungeon_idx].mindepth;
}
- else if (floor_mode & CFM_UP)
+ else if (creature_ptr->change_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;
+ if (p_ptr->current_floor_ptr->dun_level + move_num < d_info[creature_ptr->dungeon_idx].mindepth)
+ move_num = -p_ptr->current_floor_ptr->dun_level;
}
- current_floor_ptr->dun_level += move_num;
+ p_ptr->current_floor_ptr->dun_level += move_num;
}
/* Leaving the dungeon to town */
- if (!current_floor_ptr->dun_level && p_ptr->dungeon_idx)
+ if (!p_ptr->current_floor_ptr->dun_level && creature_ptr->dungeon_idx)
{
- p_ptr->leaving_dungeon = TRUE;
+ creature_ptr->leaving_dungeon = TRUE;
if (!vanilla_town && !lite_town)
{
- p_ptr->wilderness_y = d_info[p_ptr->dungeon_idx].dy;
- p_ptr->wilderness_x = d_info[p_ptr->dungeon_idx].dx;
+ creature_ptr->wilderness_y = d_info[creature_ptr->dungeon_idx].dy;
+ creature_ptr->wilderness_x = d_info[creature_ptr->dungeon_idx].dx;
}
- p_ptr->recall_dungeon = p_ptr->dungeon_idx;
- p_ptr->dungeon_idx = 0;
+ creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
+ creature_ptr->dungeon_idx = 0;
/* Reach to the surface -- Clear all saved floors */
- floor_mode &= ~CFM_SAVE_FLOORS;
+ creature_ptr->change_floor_mode &= ~CFM_SAVE_FLOORS; // TODO
}
/* Kill some old saved floors */
- if (!(floor_mode & CFM_SAVE_FLOORS))
+ if (!(creature_ptr->change_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 (floor_mode & CFM_NO_RETURN)
+ else if (creature_ptr->change_floor_mode & CFM_NO_RETURN)
{
/* Kill current floor */
kill_saved_floor(sf_ptr);
}
/* No current floor -- Left/Enter dungeon etc... */
- if (!p_ptr->floor_id)
+ if (!tmp_floor_idx)
{
/* No longer need to save current floor */
return;
}
-
/* Mark next floor_id on the previous floor */
if (!new_floor_id)
{
/* Connect from here */
if (g_ptr && !feat_uses_special(g_ptr->feat))
{
- g_ptr->special = new_floor_id;
+ g_ptr->special = tmp_floor_idx;
}
}
/* Fix connection -- level teleportation or trap door */
- if (floor_mode & CFM_RAND_CONNECT)
+ if (creature_ptr->change_floor_mode & CFM_RAND_CONNECT)
{
- if (floor_mode & CFM_UP)
+ if (creature_ptr->change_floor_mode & CFM_UP)
sf_ptr->upper_floor_id = new_floor_id;
- else if (floor_mode & CFM_DOWN)
+ else if (creature_ptr->change_floor_mode & CFM_DOWN)
sf_ptr->lower_floor_id = new_floor_id;
}
/* If you can return, you need to save previous floor */
- if ((floor_mode & CFM_SAVE_FLOORS) &&
- !(floor_mode & CFM_NO_RETURN))
+ if ((creature_ptr->change_floor_mode & CFM_SAVE_FLOORS) &&
+ !(creature_ptr->change_floor_mode & CFM_NO_RETURN))
{
/* Get out of the my way! */
- get_out_monster();
+ get_out_monster(p_ptr->current_floor_ptr, creature_ptr);
- /* Record the last visit current_world_ptr->game_turn of current floor */
+ /* Record the last visit turn of current floor */
sf_ptr->last_visit = current_world_ptr->game_turn;
- forget_lite();
+ forget_lite(p_ptr->current_floor_ptr);
forget_view();
- clear_mon_lite(current_floor_ptr);
+ clear_mon_lite(p_ptr->current_floor_ptr);
/* Save current floor */
if (!save_floor(sf_ptr, 0))
prepare_change_floor_mode(CFM_NO_RETURN);
/* Kill current floor */
- kill_saved_floor(get_sf_ptr(p_ptr->floor_id));
+ kill_saved_floor(get_sf_ptr(creature_ptr->floor_id));
}
}
}
* @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 current_floor_ptr->grid_array\n
+ * restored from the temporal file. If the floor is new one, new p_ptr->current_floor_ptr->grid_array\n
* will be generated.\n
*/
-void change_floor(BIT_FLAGS floor_mode)
+void change_floor(player_type *creature_ptr)
{
saved_floor_type *sf_ptr;
bool loaded = FALSE;
current_world_ptr->character_dungeon = FALSE;
/* No longer in the trap detecteded region */
- p_ptr->dtrap = FALSE;
+ creature_ptr->dtrap = FALSE;
/* Mega-Hack -- no panel yet */
panel_row_min = 0;
panel_col_max = 0;
/* Mega-Hack -- not ambushed on the wildness? */
- p_ptr->ambush_flag = FALSE;
+ creature_ptr->ambush_flag = FALSE;
/* No saved floors (On the surface etc.) */
- if (!(floor_mode & CFM_SAVE_FLOORS) &&
- !(floor_mode & CFM_FIRST_FLOOR))
+ if (!(creature_ptr->change_floor_mode & CFM_SAVE_FLOORS) &&
+ !(creature_ptr->change_floor_mode & CFM_FIRST_FLOOR))
{
- /* Create current_floor_ptr->grid_array */
- generate_random_floor(current_floor_ptr);
+ generate_floor(creature_ptr->current_floor_ptr);
/* Paranoia -- No new saved floor */
new_floor_id = 0;
loaded = TRUE;
/* Forbid return stairs */
- if (floor_mode & CFM_NO_RETURN)
+ if (creature_ptr->change_floor_mode & CFM_NO_RETURN)
{
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+ grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
if (!feat_uses_special(g_ptr->feat))
{
- if (floor_mode & (CFM_DOWN | CFM_UP))
+ if (creature_ptr->change_floor_mode & (CFM_DOWN | CFM_UP))
{
/* Reset to floor */
g_ptr->feat = feat_ground_type[randint0(100)];
* Stair creation/Teleport level/Trap door will take
* you the same floor when you used it later again.
*/
- if (p_ptr->floor_id)
+ if (creature_ptr->floor_id)
{
- saved_floor_type *cur_sf_ptr = get_sf_ptr(p_ptr->floor_id);
+ saved_floor_type *cur_sf_ptr = get_sf_ptr(creature_ptr->floor_id);
- if (floor_mode & CFM_UP)
+ if (creature_ptr->change_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;
+ sf_ptr->lower_floor_id = creature_ptr->floor_id;
}
- else if (floor_mode & CFM_DOWN)
+ else if (creature_ptr->change_floor_mode & CFM_DOWN)
{
/* New floor is right-under */
if (cur_sf_ptr->lower_floor_id == new_floor_id)
- sf_ptr->upper_floor_id = p_ptr->floor_id;
+ sf_ptr->upper_floor_id = creature_ptr->floor_id;
}
}
/* Break connection to killed floor */
else
{
- if (floor_mode & CFM_UP)
+ if (creature_ptr->change_floor_mode & CFM_UP)
sf_ptr->lower_floor_id = 0;
- else if (floor_mode & CFM_DOWN)
+ else if (creature_ptr->change_floor_mode & CFM_DOWN)
sf_ptr->upper_floor_id = 0;
}
MONSTER_IDX i;
GAME_TURN tmp_last_visit = sf_ptr->last_visit;
GAME_TURN absence_ticks;
- int alloc_chance = d_info[p_ptr->dungeon_idx].max_m_alloc_chance;
+ int alloc_chance = d_info[creature_ptr->dungeon_idx].max_m_alloc_chance;
GAME_TURN alloc_times;
while (tmp_last_visit > current_world_ptr->game_turn) tmp_last_visit -= TURNS_PER_TICK * TOWN_DAWN;
absence_ticks = (current_world_ptr->game_turn - tmp_last_visit) / TURNS_PER_TICK;
/* Maintain monsters */
- for (i = 1; i < current_floor_ptr->m_max; i++)
+ for (i = 1; i < creature_ptr->current_floor_ptr->m_max; i++)
{
monster_race *r_ptr;
- monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[i];
if (!monster_is_valid(m_ptr)) continue;
}
/* Maintain artifatcs */
- for (i = 1; i < current_floor_ptr->o_max; i++)
+ for (i = 1; i < creature_ptr->current_floor_ptr->o_max; i++)
{
- object_type *o_ptr = ¤t_floor_ptr->o_list[i];
+ object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[i];
if (!OBJECT_IS_VALID(o_ptr)) continue;
}
}
- (void)place_quest_monsters();
+ (void)place_quest_monsters(creature_ptr->current_floor_ptr, creature_ptr);
/* Place some random monsters */
alloc_times = absence_ticks / alloc_chance;
msg_print(_("階段は行き止まりだった。", "The staircases come to a dead end..."));
/* Create simple dead end */
- build_dead_end(current_floor_ptr);
+ build_dead_end(creature_ptr->current_floor_ptr);
/* Break connection */
- if (floor_mode & CFM_UP)
+ if (creature_ptr->change_floor_mode & CFM_UP)
{
sf_ptr->upper_floor_id = 0;
}
- else if (floor_mode & CFM_DOWN)
+ else if (creature_ptr->change_floor_mode & CFM_DOWN)
{
sf_ptr->lower_floor_id = 0;
}
}
else
{
- /* Newly create current_floor_ptr->grid_array */
- generate_random_floor(current_floor_ptr);
+ generate_floor(creature_ptr->current_floor_ptr);
}
- /* Record last visit current_world_ptr->game_turn */
+ /* Record last visit turn */
sf_ptr->last_visit = current_world_ptr->game_turn;
- /* Set correct current_floor_ptr->dun_level value */
- sf_ptr->dun_level = current_floor_ptr->dun_level;
+ /* Set correct dun_level value */
+ sf_ptr->dun_level = creature_ptr->current_floor_ptr->dun_level;
/* Create connected stairs */
- if (!(floor_mode & CFM_NO_RETURN))
+ if (!(creature_ptr->change_floor_mode & CFM_NO_RETURN))
{
/* Extract stair position */
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+ grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
/*** Create connected stairs ***/
/* No stairs down from Quest */
- if ((floor_mode & CFM_UP) && !quest_number(current_floor_ptr->dun_level))
+ if ((creature_ptr->change_floor_mode & CFM_UP) && !quest_number(creature_ptr->current_floor_ptr->dun_level))
{
- g_ptr->feat = (floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair;
+ g_ptr->feat = (creature_ptr->change_floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair;
}
/* No stairs up when ironman_downward */
- else if ((floor_mode & CFM_DOWN) && !ironman_downward)
+ else if ((creature_ptr->change_floor_mode & CFM_DOWN) && !ironman_downward)
{
- g_ptr->feat = (floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair;
+ g_ptr->feat = (creature_ptr->change_floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair;
}
/* Paranoia -- Clear mimic */
g_ptr->mimic = 0;
/* Connect to previous floor */
- g_ptr->special = p_ptr->floor_id;
+ g_ptr->special = creature_ptr->floor_id;
}
}
/* Arrive at random grid */
- if (floor_mode & (CFM_RAND_PLACE))
+ if (creature_ptr->change_floor_mode & (CFM_RAND_PLACE))
{
- (void)new_player_spot();
+ (void)new_player_spot(creature_ptr);
}
/* You see stairs blocked */
- else if ((floor_mode & CFM_NO_RETURN) && (floor_mode & (CFM_DOWN | CFM_UP)))
+ else if ((creature_ptr->change_floor_mode & CFM_NO_RETURN) && (creature_ptr->change_floor_mode & (CFM_DOWN | CFM_UP)))
{
- if (!p_ptr->blind)
+ if (!creature_ptr->blind)
{
msg_print(_("突然階段が塞がれてしまった。", "Suddenly the stairs is blocked!"));
}
/*
* Update visit mark
*
- * The "current_world_ptr->game_turn" is not always different number because
- * the level teleport doesn't take any current_world_ptr->game_turn. Use
- * visit mark instead of last visit current_world_ptr->game_turn to find the
+ * The "turn" is not always different number because
+ * the level teleport doesn't take any turn. Use
+ * visit mark instead of last visit turn to find the
* oldest saved floor.
*/
sf_ptr->visit_mark = latest_visit_mark++;
}
/* Place preserved pet monsters */
- place_pet(p_ptr);
+ place_pet(creature_ptr);
/* Reset travel target place */
forget_travel_flow();
update_unique_artifact(new_floor_id);
/* Now the player is in new floor */
- p_ptr->floor_id = new_floor_id;
+ creature_ptr->floor_id = new_floor_id;
/* The dungeon is ready */
current_world_ptr->character_dungeon = TRUE;
/* Hack -- Munchkin characters always get whole map */
- if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
- wiz_lite(p_ptr, (bool)(p_ptr->pclass == CLASS_NINJA));
+ if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
+ wiz_lite(creature_ptr, (bool)(creature_ptr->pclass == CLASS_NINJA));
/* Remember when this level was "created" */
- current_floor_ptr->generated_turn = current_world_ptr->game_turn;
+ creature_ptr->current_floor_ptr->generated_turn = current_world_ptr->game_turn;
/* No dungeon feeling yet */
- p_ptr->feeling_turn = current_floor_ptr->generated_turn;
- p_ptr->feeling = 0;
+ creature_ptr->feeling_turn = creature_ptr->current_floor_ptr->generated_turn;
+ creature_ptr->feeling = 0;
/* Clear all flags */
- floor_mode = 0L;
+ creature_ptr->change_floor_mode = 0L;
- select_floor_music(p_ptr);
- p_ptr->change_floor_mode = 0;
+ select_floor_music(creature_ptr);
+ creature_ptr->change_floor_mode = 0;
}