* Note that we ONLY handle things that can be picked up.
* See "move_player()" for handling of other things.
*/
-void carry(int pickup)
+void carry(bool pickup)
{
cave_type *c_ptr = &cave[py][px];
}
/* Describe the object */
else if (!pickup)
-
{
#ifdef JP
msg_format("%s¤¬¤¢¤ë¡£", o_name);
}
-void move_player_effect(int do_pickup, bool break_trap)
+/*
+ * Move the player
+ */
+bool move_player_effect(int oy, int ox, int ny, int nx, u32b mpe_mode)
{
- cave_type *c_ptr = &cave[py][px];
+ cave_type *c_ptr = &cave[ny][nx];
feature_type *f_ptr = &f_info[c_ptr->feat];
- /* Check for new panel (redraw map) */
- verify_panel();
+ if (!(mpe_mode & MPE_STAYING))
+ {
+ cave_type *oc_ptr = &cave[oy][ox];
+ int om_idx = oc_ptr->m_idx;
+ int nm_idx = c_ptr->m_idx;
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
+ /* Move the player */
+ py = ny;
+ px = nx;
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
+ /* Hack -- For moving monster or riding player's moving */
+ if (!(mpe_mode & MPE_DONT_SWAP_MON))
+ {
+ /* Swap two monsters */
+ c_ptr->m_idx = om_idx;
+ oc_ptr->m_idx = nm_idx;
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+ if (om_idx > 0) /* Monster on old spot (or p_ptr->riding) */
+ {
+ monster_type *om_ptr = &m_list[om_idx];
+ om_ptr->fy = ny;
+ om_ptr->fx = nx;
+ update_mon(om_idx, TRUE);
+ }
- /* Remove "unsafe" flag */
- if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
+ if (nm_idx > 0) /* Monster on new spot */
+ {
+ monster_type *nm_ptr = &m_list[nm_idx];
+ nm_ptr->fy = oy;
+ nm_ptr->fx = ox;
+ update_mon(nm_idx, TRUE);
+ }
+ }
- /* For get everything when requested hehe I'm *NASTY* */
- if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET)) wiz_dark();
+ /* Redraw old spot */
+ lite_spot(oy, ox);
- if (p_ptr->pclass == CLASS_NINJA)
- {
- if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
- else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
- }
+ /* Redraw new spot */
+ lite_spot(ny, nx);
- if ((p_ptr->action == ACTION_HAYAGAKE) && !have_flag(f_ptr->flags, FF_PROJECT))
- {
+ if (mpe_mode & MPE_FORGET_FLOW) forget_flow();
+
+ /* Check for new panel (redraw map) */
+ verify_panel();
+
+ /* Update stuff */
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
+
+ /* Update the monsters */
+ p_ptr->update |= (PU_DISTANCE);
+
+ /* Window stuff */
+ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+
+ /* Remove "unsafe" flag */
+ if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
+
+ /* For get everything when requested hehe I'm *NASTY* */
+ if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET)) wiz_dark();
+
+ /* Handle stuff */
+ if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
+
+ if (p_ptr->pclass == CLASS_NINJA)
+ {
+ if (c_ptr->info & (CAVE_GLOW)) set_superstealth(FALSE);
+ else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
+ }
+
+ if ((p_ptr->action == ACTION_HAYAGAKE) && !have_flag(f_ptr->flags, FF_PROJECT))
+ {
#ifdef JP
- msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
+ msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
#else
- msg_print("You cannot run in wall.");
+ msg_print("You cannot run in wall.");
#endif
- set_action(ACTION_NONE);
- }
-
- /* Spontaneous Searching */
- if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
- {
- search();
+ set_action(ACTION_NONE);
+ }
}
- /* Continuous Searching */
- if (p_ptr->action == ACTION_SEARCH)
+ if (mpe_mode & MPE_ENERGY_USE)
{
- search();
- }
-
- /* Handle "objects" */
-
-#ifdef ALLOW_EASY_DISARM /* TNB */
+ if (music_singing(MUSIC_WALL))
+ {
+ (void)project(0, 0, py, px, (60 + p_ptr->lev), GF_DISINTEGRATE,
+ PROJECT_KILL | PROJECT_ITEM, -1);
- carry(do_pickup != always_pickup);
+ if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
+ }
-#else /* ALLOW_EASY_DISARM -- TNB */
+ /* Spontaneous Searching */
+ if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
+ {
+ search();
+ }
- carry(do_pickup);
+ /* Continuous Searching */
+ if (p_ptr->action == ACTION_SEARCH)
+ {
+ search();
+ }
+ }
-#endif /* ALLOW_EASY_DISARM -- TNB */
+ /* Handle "objects" */
+ if (!(mpe_mode & MPE_DONT_PICKUP))
+ {
+ carry((mpe_mode & MPE_DO_PICKUP) ? TRUE : FALSE);
+ }
/* Handle "store doors" */
if (have_flag(f_ptr->flags, FF_STORE))
}
/* Set off a trap */
- else if (have_flag(f_ptr->flags, FF_HIT_TRAP))
+ else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
{
/* Disturb */
disturb(0, 0);
}
/* Hit the trap */
- hit_trap(break_trap);
+ hit_trap((mpe_mode & MPE_BREAK_TRAP) ? TRUE : FALSE);
+
+ if (!player_bold(ny, nx) || p_ptr->is_dead || p_ptr->leaving) return FALSE;
}
/* Warn when leaving trap detected region */
- if ((disturb_trap_detect || alert_trap_detect)
- && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
+ if (!(mpe_mode & MPE_STAYING) && (disturb_trap_detect || alert_trap_detect)
+ && p_ptr->dtrap && !(c_ptr->info & CAVE_IN_DETECT))
{
/* No duplicate warning */
p_ptr->dtrap = FALSE;
/* You are just on the edge */
- if (!(cave[py][px].info & CAVE_UNSAFE))
+ if (!(c_ptr->info & CAVE_UNSAFE))
{
if (alert_trap_detect)
{
if (disturb_trap_detect) disturb(0, 0);
}
}
+
+ return player_bold(ny, nx) && !p_ptr->is_dead && !p_ptr->leaving;
}
* any monster which might be in the destination grid. Previously,
* moving into walls was "free" and did NOT hit invisible monsters.
*/
-void move_player(int dir, int do_pickup, bool break_trap)
+void move_player(int dir, bool do_pickup, bool break_trap)
{
/* Find the result of moving */
int y = py + ddy[dir];
/* Normal movement */
if (oktomove)
{
- int oy, ox;
+ u32b mpe_mode = MPE_ENERGY_USE;
if (p_ptr->warning)
{
- if(!process_warning(x, y))
+ if (!process_warning(x, y))
{
energy_use = 25;
return;
}
}
- /* Hack -- For moving monster or riding player's moving */
- cave[py][px].m_idx = c_ptr->m_idx;
- c_ptr->m_idx = 0;
-
if (do_past)
{
#ifdef JP
#else
msg_format("You push past %s.", m_name);
#endif
-
- m_ptr->fy = py;
- m_ptr->fx = px;
- update_mon(cave[py][px].m_idx, TRUE);
}
/* Change oldpx and oldpy to place the player well when going back to big mode */
if (p_ptr->wild_mode)
{
- if(ddy[dir] > 0) p_ptr->oldpy = 1;
- if(ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
- if(ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
- if(ddx[dir] > 0) p_ptr->oldpx = 1;
- if(ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
- if(ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
+ if (ddy[dir] > 0) p_ptr->oldpy = 1;
+ if (ddy[dir] < 0) p_ptr->oldpy = MAX_HGT - 2;
+ if (ddy[dir] == 0) p_ptr->oldpy = MAX_HGT / 2;
+ if (ddx[dir] > 0) p_ptr->oldpx = 1;
+ if (ddx[dir] < 0) p_ptr->oldpx = MAX_WID - 2;
+ if (ddx[dir] == 0) p_ptr->oldpx = MAX_WID / 2;
}
- /* Save old location */
- oy = py;
- ox = px;
-
- /* Move the player */
- py = y;
- px = x;
-
- if (music_singing(MUSIC_WALL))
+ if (p_can_kill_walls)
{
- project(0, 0, py, px,
- (60 + p_ptr->lev), GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
- }
- else if (p_can_kill_walls)
- {
- cave_alter_feat(py, px, FF_HURT_DISI);
+ cave_alter_feat(y, x, FF_HURT_DISI);
/* Update some things -- similar to GF_KILL_WALL */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
}
- if (p_ptr->riding)
- {
- riding_m_ptr->fy = py;
- riding_m_ptr->fx = px;
- cave[py][px].m_idx = p_ptr->riding;
- update_mon(p_ptr->riding, TRUE);
- }
+ /* Sound */
+ /* sound(SOUND_WALK); */
- /* Redraw new spot */
- lite_spot(py, px);
+#ifdef ALLOW_EASY_DISARM /* TNB */
- /* Redraw old spot */
- lite_spot(oy, ox);
+ if (do_pickup != always_pickup) mpe_mode |= MPE_DO_PICKUP;
- /* Sound */
- /* sound(SOUND_WALK); */
+#else /* ALLOW_EASY_DISARM -- TNB */
- move_player_effect(do_pickup, break_trap);
+ if (do_pickup) mpe_mode |= MPE_DO_PICKUP;
+
+#endif /* ALLOW_EASY_DISARM -- TNB */
+
+ if (break_trap) mpe_mode |= MPE_BREAK_TRAP;
+
+ /* Move the player */
+ (void)move_player_effect(py, px, y, x, mpe_mode);
}
}
/*
* Support code for the "Walk" and "Jump" commands
*/
-void do_cmd_walk(int pickup)
+void do_cmd_walk(bool pickup)
{
int dir;
* Stay still. Search. Enter stores.
* Pick up treasure if "pickup" is true.
*/
-void do_cmd_stay(int pickup)
+void do_cmd_stay(bool pickup)
{
cave_type *c_ptr = &cave[py][px];
feature_type *f_ptr = &f_info[c_ptr->feat];
+ u32b mpe_mode = MPE_STAYING | MPE_ENERGY_USE;
/* Allow repeated command */
if (command_arg)
command_arg = 0;
}
-
/* Take a turn */
energy_use = 100;
-
- /* Spontaneous Searching */
- if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
- {
- search();
- }
-
- /* Continuous Searching */
- if (p_ptr->action == ACTION_SEARCH)
- {
- search();
- }
-
-
- /* Handle "objects" */
- carry(pickup);
-
-
- /* Hack -- enter a store if we are on one */
- if (have_flag(f_ptr->flags, FF_STORE))
- {
- /* Disturb */
- disturb(0, 0);
-
- energy_use = 0;
- /* Hack -- enter store */
- command_new = SPECIAL_KEY_STORE;
- }
-
- /* Hack -- enter a building if we are on one -KMW- */
- else if (have_flag(f_ptr->flags, FF_BLDG))
- {
- /* Disturb */
- disturb(0, 0);
-
- energy_use = 0;
- /* Hack -- enter building */
- command_new = SPECIAL_KEY_BUILDING;
- }
-
- /* Exit a quest if reach the quest exit */
- else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
- {
- int q_index = p_ptr->inside_quest;
-
- /* Was quest completed? */
- if (quest[q_index].type == QUEST_TYPE_FIND_EXIT)
- {
- quest[q_index].status = QUEST_STATUS_COMPLETED;
- quest[q_index].complev = (byte)p_ptr->lev;
-#ifdef JP
- msg_print("¥¯¥¨¥¹¥È¤ò´°Î»¤·¤¿¡ª");
-#else
- msg_print("You accomplished your quest!");
-#endif
-
- msg_print(NULL);
- }
-
- leave_quest_check();
-
- p_ptr->inside_quest = cave[py][px].special;
- dun_level = 0;
- p_ptr->oldpx = 0;
- p_ptr->oldpy = 0;
-
- p_ptr->leaving = TRUE;
- }
+ if (pickup) mpe_mode |= MPE_DO_PICKUP;
+ (void)move_player_effect(py, px, py, px, mpe_mode);
}
fall_dam = TRUE;
}
- if (sy && p_ptr->is_dead) move_player_effect(FALSE, FALSE);
+ /* Move the player */
+ if (sy && !p_ptr->is_dead)
+ (void)move_player_effect(py, px, py, px, MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
return fall_dam;
}
bool do_riding(bool force)
{
- int oy, ox, x, y, dir = 0;
+ int x, y, dir = 0;
cave_type *c_ptr;
monster_type *m_ptr;
if (p_ptr->riding == p_ptr->health_who) health_track(0);
}
- /* Save the old location */
- oy = py;
- ox = px;
-
- /* Move the player */
- py = y;
- px = x;
-
- /* Redraw the old spot */
- lite_spot(oy, ox);
-
- /* Redraw the new spot */
- lite_spot(py, px);
-
- /* Check for new panel */
- verify_panel();
-
energy_use = 100;
/* Mega-Hack -- Forget the view and lite */
p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
/* Update the monsters */
p_ptr->update |= (PU_BONUS);
/* Redraw map */
p_ptr->redraw |= (PR_MAP | PR_EXTRA);
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
p_ptr->redraw |= (PR_UHEALTH);
- handle_stuff();
-
- move_player_effect(FALSE, FALSE);
+ /* Move the player */
+ (void)move_player_effect(py, px, y, x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
return TRUE;
}
#define SKEY_TOP 0xf007
#define SKEY_BOTTOM 0xf008
+/*
+ * Bit flags for move_player_effect()
+ */
+#define MPE_STAYING 0x00000001
+#define MPE_FORGET_FLOW 0x00000002
+#define MPE_HANDLE_STUFF 0x00000004
+#define MPE_ENERGY_USE 0x00000008
+#define MPE_DONT_PICKUP 0x00000010
+#define MPE_DO_PICKUP 0x00000020
+#define MPE_BREAK_TRAP 0x00000040
+#define MPE_DONT_SWAP_MON 0x00000080
extern s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr, int mode, bool thrown);
extern void search(void);
extern void py_pickup_aux(int o_idx);
-extern void carry(int pickup);
+extern void carry(bool pickup);
extern bool py_attack(int y, int x, int mode);
extern bool pattern_seq(int c_y, int c_x, int n_y, int n_x);
extern bool player_can_enter(s16b feature, u16b mode);
-extern void move_player_effect(int do_pickup, bool break_trap);
-extern void move_player(int dir, int do_pickup, bool break_trap);
+extern bool move_player_effect(int oy, int ox, int ny, int nx, u32b mpe_mode);
+extern void move_player(int dir, bool do_pickup, bool break_trap);
extern void run_step(int dir);
/* cmd2.c */
extern void do_cmd_bash(void);
extern void do_cmd_alter(void);
extern void do_cmd_spike(void);
-extern void do_cmd_walk(int pickup);
-extern void do_cmd_stay(int pickup);
+extern void do_cmd_walk(bool pickup);
+extern void do_cmd_stay(bool pickup);
extern void do_cmd_run(void);
extern void do_cmd_rest(void);
extern void do_cmd_fire(void);
extern int scan_floor(int *items, int y, int x, int mode);
extern int show_floor(int target_item, int y, int x, int *min_width);
extern bool get_item_floor(int *cp, cptr pmt, cptr str, int mode);
-extern void py_pickup_floor(int pickup);
+extern void py_pickup_floor(bool pickup);
/* variable.c */
extern bool easy_floor;
if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
{
- int oy, ox;
-
msg_print(NULL);
- /* Save the old location */
- oy = py;
- ox = px;
-
/* Move the player */
- py = y;
- px = x;
-
- forget_flow();
-
- /* Redraw the old spot */
- lite_spot(oy, ox);
-
- /* Redraw the new spot */
- lite_spot(py, px);
-
- /* Check for new panel (redraw map) */
- verify_panel();
-
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- /* Handle stuff XXX XXX XXX */
- handle_stuff();
+ (void)move_player_effect(py, px, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
}
break;
}
if (dir == 5) return FALSE;
for (i = 0; i < 3; i++)
{
- int oy, ox;
int ny, nx;
int m_idx;
+ cave_type *c_ptr;
monster_type *m_ptr;
y = py + ddy[dir];
x = px + ddx[dir];
+ c_ptr = &cave[y][x];
- if (cave[y][x].m_idx)
+ if (c_ptr->m_idx)
py_attack(y, x, HISSATSU_3DAN);
else
{
}
/* Monster is dead? */
- if (!cave[y][x].m_idx) break;
+ if (!c_ptr->m_idx) break;
ny = y + ddy[dir];
nx = x + ddx[dir];
- m_idx = cave[y][x].m_idx;
+ m_idx = c_ptr->m_idx;
m_ptr = &m_list[m_idx];
/* Monster cannot move back? */
- if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0)) continue;
+ if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0))
+ {
+ /* -more- */
+ if (i < 2) msg_print(NULL);
+ continue;
+ }
- cave[y][x].m_idx = 0;
+ c_ptr->m_idx = 0;
cave[ny][nx].m_idx = m_idx;
m_ptr->fy = ny;
m_ptr->fx = nx;
update_mon(m_idx, TRUE);
- /* Player can move forward? */
- if (player_can_enter(cave[y][x].feat, 0))
- {
- /* Save the old location */
- oy = py;
- ox = px;
-
- /* Move the player */
- py = y;
- px = x;
-
- if (p_ptr->riding)
- {
- cave[oy][ox].m_idx = cave[py][px].m_idx;
- cave[py][px].m_idx = p_ptr->riding;
- m_list[p_ptr->riding].fy = py;
- m_list[p_ptr->riding].fx = px;
- update_mon(p_ptr->riding, TRUE);
- }
-
- forget_flow();
-
- /* Redraw the old spot */
- lite_spot(oy, ox);
-
- /* Redraw the new spot */
- lite_spot(py, px);
- }
-
/* Redraw the old spot */
lite_spot(y, x);
/* Redraw the new spot */
lite_spot(ny, nx);
- /* Check for new panel (redraw map) */
- verify_panel();
-
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- /* Handle stuff */
- handle_stuff();
+ /* Player can move forward? */
+ if (player_can_enter(c_ptr->feat, 0))
+ {
+ /* Move the player */
+ if (!move_player_effect(py, px, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
+ }
/* -more- */
if (i < 2) msg_print(NULL);
}
/* Push past weaker monsters (unless leaving a wall) */
- else if ((r_ptr->flags2 & RF2_MOVE_BODY) &&
+ else if ((r_ptr->flags2 & RF2_MOVE_BODY) && !(r_ptr->flags1 & RF1_NEVER_MOVE) &&
(r_ptr->mexp > z_ptr->mexp) &&
can_cross && (c_ptr->m_idx != p_ptr->riding) &&
monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0))
/* Monster pushed past another monster */
did_move_body = TRUE;
+ /* Wake up the moved monster */
+ y_ptr->csleep = 0;
+
+ if (r_info[y_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+ p_ptr->update |= (PU_MON_LITE);
+
/* XXX XXX XXX Message */
}
}
/* Take a turn */
do_turn = TRUE;
- /* Hack -- Update the old location */
- cave[oy][ox].m_idx = c_ptr->m_idx;
-
if (did_kill_wall)
{
if (one_in_(GRINDNOISE))
}
}
- /* Mega-Hack -- move the old monster, if any */
- if (c_ptr->m_idx)
+ if (!is_riding_mon)
{
- /* Move the old monster */
- y_ptr->fy = oy;
- y_ptr->fx = ox;
+ /* Hack -- Update the old location */
+ cave[oy][ox].m_idx = c_ptr->m_idx;
- /* Update the old monster */
- update_mon(c_ptr->m_idx, TRUE);
+ /* Mega-Hack -- move the old monster, if any */
+ if (c_ptr->m_idx)
+ {
+ /* Move the old monster */
+ y_ptr->fy = oy;
+ y_ptr->fx = ox;
- /* Wake up the moved monster */
- y_ptr->csleep = 0;
+ /* Update the old monster */
+ update_mon(c_ptr->m_idx, TRUE);
+ }
- if (r_info[y_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
- p_ptr->update |= (PU_MON_LITE);
- }
+ /* Hack -- Update the new location */
+ c_ptr->m_idx = m_idx;
- /* Hack -- Update the new location */
- c_ptr->m_idx = m_idx;
+ /* Move the monster */
+ m_ptr->fy = ny;
+ m_ptr->fx = nx;
- /* Move the monster */
- m_ptr->fy = ny;
- m_ptr->fx = nx;
+ /* Update the monster */
+ update_mon(m_idx, TRUE);
- /* Update the monster */
- update_mon(m_idx, TRUE);
+ /* Redraw the old grid */
+ lite_spot(oy, ox);
- if (is_riding_mon)
- {
- py = ny;
- px = nx;
+ /* Redraw the new grid */
+ lite_spot(ny, nx);
}
-
- /* Redraw the old grid */
- lite_spot(oy, ox);
-
- /* Redraw the new grid */
- lite_spot(ny, nx);
-
- if (is_riding_mon)
+ else
{
/* Sound */
/* sound(SOUND_WALK); */
- move_player_effect(FALSE, FALSE);
-
- if (!player_bold(ny, nx) || p_ptr->leaving) break;
+ /* Move the player */
+ if (!move_player_effect(py, px, ny, nx, MPE_DONT_PICKUP)) break;
}
/* Possible disturb */
if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
{
- int oy, ox;
-
msg_print(NULL);
- /* Save the old location */
- oy = py;
- ox = px;
-
/* Move the player */
- py = y;
- px = x;
-
- forget_flow();
-
- /* Redraw the old spot */
- lite_spot(oy, ox);
-
- /* Redraw the new spot */
- lite_spot(py, px);
-
- /* Check for new panel (redraw map) */
- verify_panel();
-
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- /* Handle stuff XXX XXX XXX */
- handle_stuff();
+ (void)move_player_effect(py, px, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
}
break;
}
case MUT1_EAT_ROCK:
{
- int x, y, ox, oy;
+ int x, y;
cave_type *c_ptr;
feature_type *f_ptr;
/* Destroy the wall */
cave_alter_feat(y, x, FF_HURT_ROCK);
- oy = py;
- ox = px;
-
- py = y;
- px = x;
-
- if (p_ptr->riding)
- {
- m_list[p_ptr->riding].fy = py;
- m_list[p_ptr->riding].fx = px;
- cave[py][px].m_idx = p_ptr->riding;
- cave[oy][ox].m_idx = 0;
- update_mon(p_ptr->riding, TRUE);
- }
-
- lite_spot(py, px);
- lite_spot(oy, ox);
-
- verify_panel();
-
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
- p_ptr->update |= (PU_DISTANCE);
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+ /* Move the player */
+ (void)move_player_effect(py, px, y, x, MPE_DONT_PICKUP);
}
break;
*
* This is called by py_pickup() when easy_floor is TRUE.
*/
-void py_pickup_floor(int pickup)
+void py_pickup_floor(bool pickup)
{
s16b this_o_idx, next_o_idx = 0;
*/
bool earthquake(int cy, int cx, int r)
{
- int i, t, y, x, yy, xx, dy, dx, oy, ox;
+ int i, t, y, x, yy, xx, dy, dx;
int damage = 0;
int sn = 0, sy = 0, sx = 0;
bool hurt = FALSE;
}
}
- /* Save the old location */
- oy = py;
- ox = px;
-
/* Move the player to the safe location */
- py = sy;
- px = sx;
-
- if (p_ptr->riding)
- {
- cave[oy][ox].m_idx = cave[py][px].m_idx;
- cave[py][px].m_idx = p_ptr->riding;
- m_list[p_ptr->riding].fy = py;
- m_list[p_ptr->riding].fx = px;
- update_mon(p_ptr->riding, TRUE);
- }
-
- /* Redraw the old spot */
- lite_spot(oy, ox);
-
- /* Redraw the new spot */
- lite_spot(py, px);
-
- /* Check for new panel */
- verify_panel();
+ (void)move_player_effect(py, px, sy, sx, MPE_DONT_PICKUP);
}
/* Important -- no wall on player */
m_ptr = &m_list[c_ptr->m_idx];
r_ptr = &r_info[m_ptr->r_idx];
+ /* Redraw the health bar */
+ if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
+
if (r_ptr->flagsr & RFR_RES_TELE)
{
#ifdef JP
sound(SOUND_TELEPORT);
- cave[py][px].m_idx = c_ptr->m_idx;
-
- /* Update the old location */
- c_ptr->m_idx = p_ptr->riding;
-
- /* Move the monster */
- m_ptr->fy = py;
- m_ptr->fx = px;
-
- /* Move the player */
- px = tx;
- py = ty;
-
- if (p_ptr->riding)
- {
- m_list[p_ptr->riding].fy = ty;
- m_list[p_ptr->riding].fx = tx;
-
- /* Update the monster (new location) */
- update_mon(p_ptr->riding, TRUE);
- }
-
- tx = m_ptr->fx;
- ty = m_ptr->fy;
-
- m_ptr->csleep = 0;
-
- /* Update the monster (new location) */
- update_mon(cave[ty][tx].m_idx, TRUE);
-
- /* Redraw the old grid */
- lite_spot(ty, tx);
-
- /* Redraw the new grid */
- lite_spot(py, px);
-
- /* Check for new panel (redraw map) */
- verify_panel();
-
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- /* Redraw the health bar */
- if (p_ptr->health_who == cave[ty][tx].m_idx)
- p_ptr->redraw |= (PR_HEALTH);
-
- /* Handle stuff XXX XXX XXX */
- handle_stuff();
+ /* Swap the player and monster */
+ (void)move_player_effect(py, px, ty, tx, MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
/* Success */
return TRUE;
ox = px;
/* Move the player */
- py = y;
- px = x;
-
- if (p_ptr->riding)
- {
- cave[oy][ox].m_idx = cave[py][px].m_idx;
- cave[py][px].m_idx = p_ptr->riding;
- m_list[p_ptr->riding].fy = py;
- m_list[p_ptr->riding].fx = px;
- update_mon(p_ptr->riding, TRUE);
- }
-
- /* Redraw the old spot */
- lite_spot(oy, ox);
+ (void)move_player_effect(py, px, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
/* Monsters with teleport ability may follow the player */
for (xx = -1; xx < 2; xx++)
if ((r_ptr->flags6 & RF6_TPORT) &&
!(r_ptr->flagsr & RFR_RES_TELE))
{
- if (!m_ptr->csleep) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level);
+ if (!m_ptr->csleep) teleport_monster_to(tmp_m_idx, y, x, r_ptr->level);
}
}
}
}
-
- forget_flow();
-
- /* Redraw the new spot */
- lite_spot(py, px);
-
- /* Check for new panel (redraw map) */
- verify_panel();
-
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- /* Handle stuff XXX XXX XXX */
- handle_stuff();
}
*/
void teleport_player_to(int ny, int nx, bool no_tele)
{
- int y, x, oy, ox, dis = 0, ctr = 0;
+ int y, x, dis = 0, ctr = 0;
if (p_ptr->anti_tele && no_tele)
{
/* Sound */
sound(SOUND_TELEPORT);
- /* Save the old location */
- oy = py;
- ox = px;
-
/* Move the player */
- py = y;
- px = x;
-
- if (p_ptr->riding)
- {
- cave[oy][ox].m_idx = cave[py][px].m_idx;
- cave[py][px].m_idx = p_ptr->riding;
- m_list[p_ptr->riding].fy = py;
- m_list[p_ptr->riding].fx = px;
- update_mon(p_ptr->riding, TRUE);
- }
-
- forget_flow();
-
- /* Redraw the old spot */
- lite_spot(oy, ox);
-
- /* Redraw the new spot */
- lite_spot(py, px);
-
- /* Check for new panel (redraw map) */
- verify_panel();
-
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- /* Handle stuff XXX XXX XXX */
- handle_stuff();
+ (void)move_player_effect(py, px, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
}