OSDN Git Service

トラップに掛かる, 迷宮の地形を忘れるなどと言ったプレイヤー移動時の効
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 29 Nov 2003 11:16:23 +0000 (11:16 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 29 Nov 2003 11:16:23 +0000 (11:16 +0000)
果を関数に分けた. これにより, 乗馬時の移動を乗馬に任せた場合にトラッ
プを無視できたり迷宮を忘れなかったりするバグを修正. なお, 以下の変更
を含む.
* モンスターのドアの鍵解除でいきなりドアが開いていたのを修正.
* モンスターがドアを開けた際に1ターン消費する事を意図していたようだ
  が, 実際は移動できていたバグを修正.
* モンスターがドアを打ち破った際にドアの位置に移動できなかったバグを
  修正.

src/cmd1.c
src/externs.h
src/melee2.c

index 76fe5d8..0efa9a8 100644 (file)
@@ -3439,6 +3439,177 @@ bool player_can_enter(s16b feature, u16b mode)
 }
 
 
+void move_player_effect(int do_pickup, bool break_trap)
+{
+       cave_type *c_ptr = &cave[py][px];
+       feature_type *f_ptr = &f_info[c_ptr->feat];
+
+       /* 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();
+
+       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) && !cave_floor_bold(py, px))
+       {
+#ifdef JP
+               msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
+#else
+               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();
+       }
+
+       /* Continuous Searching */
+       if (p_ptr->action == ACTION_SEARCH)
+       {
+               search();
+       }
+
+       /* Handle "objects" */
+
+#ifdef ALLOW_EASY_DISARM /* TNB */
+
+       carry(do_pickup != always_pickup);
+
+#else /* ALLOW_EASY_DISARM -- TNB */
+
+       carry(do_pickup);
+
+#endif /* ALLOW_EASY_DISARM -- TNB */
+
+       /* Handle "store doors" */
+       if (have_flag(f_ptr->flags, FF_STORE))
+       {
+               /* Disturb */
+               disturb(0, 0);
+
+               energy_use = 0;
+               /* Hack -- Enter store */
+               command_new = SPECIAL_KEY_STORE;
+       }
+
+       /* Handle "building doors" -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;
+       }
+
+       /* Handle quest areas -KMW- */
+       else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
+       {
+               /* Disturb */
+               disturb(0, 0);
+
+               energy_use = 0;
+               /* Hack -- Enter quest level */
+               command_new = SPECIAL_KEY_QUEST;
+       }
+
+       else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
+       {
+               if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
+               {
+                       if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL);
+                       quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
+                       quest[p_ptr->inside_quest].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 = c_ptr->special;
+               dun_level = 0;
+               p_ptr->oldpx = 0;
+               p_ptr->oldpy = 0;
+
+               p_ptr->leaving = TRUE;
+       }
+
+       /* Set off a trap */
+       else if (have_flag(f_ptr->flags, FF_HIT_TRAP))
+       {
+               /* Disturb */
+               disturb(0, 0);
+
+               /* Hidden trap */
+               if (c_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
+               {
+                       /* Message */
+#ifdef JP
+                       msg_print("¥È¥é¥Ã¥×¤À¡ª");
+#else
+                       msg_print("You found a trap!");
+#endif
+
+                       /* Pick a trap */
+                       disclose_grid(py, px);
+               }
+
+               /* Hit the trap */
+               hit_trap(break_trap);
+       }
+
+       /* Warn when leaving trap detected region */
+       if ((disturb_trap_detect || alert_trap_detect)
+           && p_ptr->dtrap && !(cave[py][px].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 (alert_trap_detect)
+                       {
+#ifdef JP
+                               msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
+#else
+                               msg_print("*Leaving trap detect region!*");
+#endif
+                       }
+
+                       if (disturb_trap_detect) disturb(0, 0);
+               }
+       }
+}
+
+
 /*
  * Move player in the given direction, with the given "pickup" flag.
  *
@@ -3959,9 +4130,6 @@ void move_player(int dir, int do_pickup, bool break_trap)
                        p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
                }
 
-               /* Remove "unsafe" flag */
-               if ((!p_ptr->blind && !no_lite()) || !is_trap(c_ptr->feat)) c_ptr->info &= ~(CAVE_UNSAFE);
-
                if (p_ptr->riding)
                {
                        riding_m_ptr->fy = py;
@@ -3979,172 +4147,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                /* Sound */
                /* sound(SOUND_WALK); */
 
-               /* Check for new panel (redraw map) */
-               verify_panel();
-
-               /* For get everything when requested hehe I'm *NASTY* */
-               if (dun_level && (d_info[dungeon_type].flags1 & DF1_FORGET))
-               {
-                       wiz_dark();
-               }
-
-               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) && !cave_floor_bold(py, px))
-               {
-#ifdef JP
-                       msg_print("¤³¤³¤Ç¤ÏÁÇÁ᤯ư¤±¤Ê¤¤¡£");
-#else
-                       msg_print("You cannot run in wall.");
-#endif
-                       set_action(ACTION_NONE);
-               }
-
-               /* 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);
-
-               /* 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" */
-
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
-               carry(do_pickup != always_pickup);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               carry(do_pickup);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
-
-               /* Handle "store doors" */
-               if (have_flag(f_ptr->flags, FF_STORE))
-               {
-                       /* Disturb */
-                       disturb(0, 0);
-
-                       energy_use = 0;
-                       /* Hack -- Enter store */
-                       command_new = SPECIAL_KEY_STORE;
-               }
-
-               /* Handle "building doors" -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;
-               }
-
-               /* Handle quest areas -KMW- */
-               else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
-               {
-                       /* Disturb */
-                       disturb(0, 0);
-
-                       energy_use = 0;
-                       /* Hack -- Enter quest level */
-                       command_new = SPECIAL_KEY_QUEST;
-               }
-
-               else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
-               {
-                       if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
-                       {
-                               if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_C, p_ptr->inside_quest, NULL);
-                               quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
-                               quest[p_ptr->inside_quest].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 = c_ptr->special;
-                       dun_level = 0;
-                       p_ptr->oldpx = 0;
-                       p_ptr->oldpy = 0;
-
-                       p_ptr->leaving = TRUE;
-               }
-
-               /* Set off a trap */
-               else if (have_flag(f_ptr->flags, FF_HIT_TRAP))
-               {
-                       /* Disturb */
-                       disturb(0, 0);
-
-                       /* Hidden trap */
-                       if (c_ptr->mimic)
-                       {
-                               /* Message */
-#ifdef JP
-                               msg_print("¥È¥é¥Ã¥×¤À¡ª");
-#else
-                               msg_print("You found a trap!");
-#endif
-
-                               /* Pick a trap */
-                               disclose_grid(py, px);
-                       }
-
-                       /* Hit the trap */
-                       hit_trap(break_trap);
-               }
-
-               /* Warn when leaving trap detected region */
-               if ((disturb_trap_detect || alert_trap_detect)
-                   && p_ptr->dtrap && !(cave[py][px].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 (alert_trap_detect)
-                               {
-#ifdef JP
-                                       msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
-#else
-                                       msg_print("*Leaving trap detect region!*");
-#endif
-                               }
-
-                               if (disturb_trap_detect)
-                               {
-                                       disturb(0, 0);
-                               }
-                       }
-               }
+               move_player_effect(do_pickup, break_trap);
        }
 }
 
index ab01dfa..78c0f1a 100644 (file)
@@ -658,6 +658,7 @@ extern void carry(int 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 void run_step(int dir);
 
index 4c845fc..e6c409d 100644 (file)
@@ -2963,8 +2963,8 @@ msg_format("%^s%s", m_name, monmessage);
                                        /* Do not bash the door */
                                        may_bash = FALSE;
 
-                                       /* Assume no move allowed */
-                                       do_move = TRUE;
+                                       /* Take a turn */
+                                       do_turn = TRUE;
                                }
 
                                /* Locked doors (not jammed) */
@@ -2974,10 +2974,13 @@ msg_format("%^s%s", m_name, monmessage);
                                        if (randint0(m_ptr->hp / 10) > f_ptr->power)
                                        {
                                                /* Unlock the door */
-                                               cave_alter_feat(ny, nx, FF_OPEN);
+                                               cave_alter_feat(ny, nx, FF_DISARM);
 
                                                /* Do not bash the door */
                                                may_bash = FALSE;
+
+                                               /* Take a turn */
+                                               do_turn = TRUE;
                                        }
                                }
                        }
@@ -3216,7 +3219,7 @@ msg_format("%^s%s", m_name, monmessage);
                 * to allow monsters to attack an enemy,
                 * even if it can't enter the terrain.
                 */
-               if (do_move && !can_cross && !did_kill_wall)
+               if (do_move && !can_cross && !did_kill_wall && !did_bash_door)
                {
                        /* Assume no move allowed */
                        do_move = FALSE;
@@ -3313,16 +3316,12 @@ msg_format("%^s%s", m_name, monmessage);
 
                        if (is_riding_mon)
                        {
-                               verify_panel();
-
-                               /* Update stuff */
-                               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
+                               /* Sound */
+                               /* sound(SOUND_WALK); */
 
-                               /* Update the monsters */
-                               p_ptr->update |= (PU_DISTANCE);
+                               move_player_effect(FALSE, FALSE);
 
-                               /* Update sub-windows */
-                               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+                               if (!player_bold(ny, nx) || p_ptr->leaving) break;
                        }
 
                        /* Possible disturb */