{
char floor_savefile[1024];
+ /* Paranoia */
+ if (!sf_ptr) return;
+
/* Already empty */
if (!sf_ptr->floor_id) return;
sf_ptr->lower_floor_id = 0;
sf_ptr->visit_mark = latest_visit_mark++;
- /* sf_ptr->dun_level is not yet decided */
+ /* sf_ptr->dun_level may be changed later */
+ sf_ptr->dun_level = dun_level;
/* Increment number of floor_id */
/* Give one square */
place_floor_bold(py, px);
+
+ wipe_generate_cave_flags();
}
int dis = distance(py, px, m_ptr->fy, m_ptr->fx);
/* Confused (etc.) monsters don't follow. */
- if (m_ptr->confused || m_ptr->stunned || m_ptr->csleep) continue;
+ if (MON_CONFUSED(m_ptr) || MON_STUNNED(m_ptr) || MON_CSLEEP(m_ptr)) continue;
/* Pet of other pet don't follow. */
if (m_ptr->parent_m_idx) continue;
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, 4, m_name);
+ do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_MOVED, m_name);
}
}
{
monster_type *m_ptr = &m_list[m_idx];
monster_race *r_ptr;
- int cmi;
cave[cy][cx].m_idx = m_idx;
m_ptr->fy = cy;
m_ptr->fx = cx;
m_ptr->ml = TRUE;
- m_ptr->csleep = 0;
- for (cmi = 0; cmi < MAX_MPROC; cmi++) m_ptr->mproc_idx[cmi] = 0;
+ m_ptr->mtimed[MTIMED_CSLEEP] = 0;
/* Paranoia */
m_ptr->hold_o_idx = 0;
/* Hack -- Count the number of "reproducers" */
if (r_ptr->flags2 & RF2_MULTIPLY) num_repro++;
- if (m_ptr->fast) mproc_add(m_idx, MPROC_FAST);
- if (m_ptr->slow) mproc_add(m_idx, MPROC_SLOW);
- if (m_ptr->stunned) mproc_add(m_idx, MPROC_STUNNED);
- if (m_ptr->confused) mproc_add(m_idx, MPROC_CONFUSED);
- if (m_ptr->monfear) mproc_add(m_idx, MPROC_MONFEAR);
- if (m_ptr->invulner) mproc_add(m_idx, MPROC_INVULNER);
-
/* Hack -- Notice new multi-hued monsters */
{
monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
if (record_named_pet && m_ptr->nickname)
{
monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
- do_cmd_write_nikki(NIKKI_NAMED_PET, 5, m_name);
+ do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, m_name);
}
/* Pre-calculated in precalc_cur_num_of_pet(), but need to decrease */
{
/* Get temporal floor_id */
p_ptr->floor_id = get_new_floor_id();
-
- /* Record the dungeon level */
- get_sf_ptr(p_ptr->floor_id)->dun_level = dun_level;
}
{
c_ptr->special = new_floor_id;
}
-
- /* Record new dungeon level */
- get_sf_ptr(new_floor_id)->dun_level = dun_level;
}
/* Fix connection -- level teleportation or trap door */
}
}
+ /* Break connection to killed floor */
+ else
+ {
+ if (change_floor_mode & CFM_UP)
+ sf_ptr->lower_floor_id = 0;
+ else if (change_floor_mode & CFM_DOWN)
+ sf_ptr->upper_floor_id = 0;
+ }
+
/* Maintain monsters and artifacts */
if (loaded)
{
int i;
- s32b absence_ticks = (turn - sf_ptr->last_visit) / TURNS_PER_TICK;
+ s32b tmp_last_visit = sf_ptr->last_visit;
+ s32b absence_ticks;
int alloc_chance = d_info[dungeon_type].max_m_alloc_chance;
int alloc_times;
+ while (tmp_last_visit > turn) tmp_last_visit -= TURNS_PER_TICK * TOWN_DAWN;
+ absence_ticks = (turn - tmp_last_visit) / TURNS_PER_TICK;
+
/* Maintain monsters */
for (i = 1; i < m_max; i++)
{
/* Restore HP */
m_ptr->hp = m_ptr->maxhp = m_ptr->max_maxhp;
- if (m_ptr->monfear)
- {
- /* Remove fear */
- m_ptr->monfear = 0;
- mproc_remove(i, m_ptr->mproc_idx[MPROC_MONFEAR], MPROC_MONFEAR);
- }
-
- if (m_ptr->invulner)
- {
- /* Remove invulnerability */
- m_ptr->invulner = 0;
- mproc_remove(i, m_ptr->mproc_idx[MPROC_INVULNER], MPROC_INVULNER);
- }
-
- if (m_ptr->fast)
- {
- /* Remove fast status */
- m_ptr->fast = 0;
- mproc_remove(i, m_ptr->mproc_idx[MPROC_FAST], MPROC_FAST);
- }
-
- if (m_ptr->slow)
- {
- /* Remove slow status */
- m_ptr->slow = 0;
- mproc_remove(i, m_ptr->mproc_idx[MPROC_SLOW], MPROC_SLOW);
- }
-
- if (m_ptr->stunned)
- {
- /* Remove stun */
- m_ptr->stunned = 0;
- mproc_remove(i, m_ptr->mproc_idx[MPROC_STUNNED], MPROC_STUNNED);
- }
-
- if (m_ptr->confused)
- {
- /* Remove confusion */
- m_ptr->confused = 0;
- mproc_remove(i, m_ptr->mproc_idx[MPROC_CONFUSED], MPROC_CONFUSED);
- }
+ /* Remove timed status (except MTIMED_CSLEEP) */
+ (void)set_monster_fast(i, 0);
+ (void)set_monster_slow(i, 0);
+ (void)set_monster_stunned(i, 0);
+ (void)set_monster_confused(i, 0);
+ (void)set_monster_monfear(i, 0);
+ (void)set_monster_invulner(i, 0, FALSE);
}
/* Extract real monster race */
}
}
- place_quest_monsters();
+ (void)place_quest_monsters();
/* Place some random monsters */
alloc_times = absence_ticks / alloc_chance;
/* No stairs down from Quest */
if ((change_floor_mode & CFM_UP) && !quest_number(dun_level))
{
- if (change_floor_mode & CFM_SHAFT)
- c_ptr->feat = FEAT_MORE_MORE;
- else
- c_ptr->feat = FEAT_MORE;
+ c_ptr->feat = (change_floor_mode & CFM_SHAFT) ? feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair;
}
/* No stairs up when ironman_downward */
else if ((change_floor_mode & CFM_DOWN) && !ironman_downward)
{
- if (change_floor_mode & CFM_SHAFT)
- c_ptr->feat = FEAT_LESS_LESS;
- else
- c_ptr->feat = FEAT_LESS;
+ c_ptr->feat = (change_floor_mode & CFM_SHAFT) ? feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair;
}
/* Paranoia -- Clear mimic */
/* Extract current floor data */
sf_ptr = get_sf_ptr(p_ptr->floor_id);
+ /* Paranoia */
+ if (!sf_ptr)
+ {
+ /* No floor id? -- Create now! */
+ p_ptr->floor_id = get_new_floor_id();
+ sf_ptr = get_sf_ptr(p_ptr->floor_id);
+ }
+
/* Choose randomly */
if (up && down)
{
/* Create a staircase */
if (up)
{
- if (dest_sf_ptr->last_visit && dest_sf_ptr->dun_level <= dun_level - 2)
- cave_set_feat(py, px, FEAT_LESS_LESS);
- else
- cave_set_feat(py, px, FEAT_LESS);
+ cave_set_feat(py, px,
+ (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= dun_level - 2)) ?
+ feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair);
}
else
{
- if (dest_sf_ptr->last_visit && dest_sf_ptr->dun_level >= dun_level + 2)
- cave_set_feat(py, px, FEAT_MORE_MORE);
- else
- cave_set_feat(py, px, FEAT_MORE);
+ cave_set_feat(py, px,
+ (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= dun_level + 2)) ?
+ feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair);
}