OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / xtra2.c
index b30ca5e..bdc7f4c 100644 (file)
@@ -67,7 +67,6 @@ void check_experience(void)
                /* Redraw some stuff */
                p_ptr->redraw |= (PR_LEV | PR_TITLE);
 
-               /* Window stuff */
                p_ptr->window |= (PW_PLAYER);
 
                /* Handle stuff */
@@ -111,7 +110,6 @@ void check_experience(void)
                /* Redraw some stuff */
                p_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
 
-               /* Window stuff */
                p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
 
                /* HPとMPの上昇量を表示 */
@@ -204,7 +202,6 @@ void check_experience(void)
                /* Redraw some stuff */
                p_ptr->redraw |= (PR_LEV | PR_TITLE);
 
-               /* Window stuff */
                p_ptr->window |= (PW_PLAYER | PW_SPELL);
 
                /* Handle stuff */
@@ -223,7 +220,7 @@ void check_experience(void)
  * @details
  * Hack -- Return the "automatic coin type" of a monster race
  * Used to allocate proper treasure when "Creeping coins" die
- * XXX XXX XXX Note the use of actual "monster names"
+ * Note the use of actual "monster names"
  */
 static int get_coin_type(MONRACE_IDX r_idx)
 {
@@ -651,8 +648,6 @@ void check_quest_completion(monster_type *m_ptr)
                {
                        /* Get local object */
                        o_ptr = &forge;
-
-                       /* Wipe the object */
                        object_wipe(o_ptr);
 
                        /* Make a great object */
@@ -956,8 +951,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                {
                        /* Get local object */
                        q_ptr = &forge;
-
-                       /* Wipe the object */
                        object_wipe(q_ptr);
 
                        /* Activate restriction */
@@ -1141,8 +1134,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        {
                                /* Get local object */
                                q_ptr = &forge;
-
-                               /* Wipe the object */
                                object_wipe(q_ptr);
 
                                /* Activate restriction */
@@ -1161,8 +1152,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        {
                                /* Get local object */
                                q_ptr = &forge;
-
-                               /* Wipe the object */
                                object_wipe(q_ptr);
 
                                /* Activate restriction */
@@ -1181,8 +1170,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        {
                                /* Get local object */
                                q_ptr = &forge;
-
-                               /* Wipe the object */
                                object_wipe(q_ptr);
 
                                /* Activate restriction */
@@ -1201,8 +1188,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        {
                                /* Get local object */
                                q_ptr = &forge;
-
-                               /* Wipe the object */
                                object_wipe(q_ptr);
 
                                /* Activate restriction */
@@ -1221,8 +1206,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        {
                                /* Get local object */
                                q_ptr = &forge;
-
-                               /* Wipe the object */
                                object_wipe(q_ptr);
 
                                /* Activate restriction */
@@ -1343,8 +1326,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
        {
                /* Get local object */
                q_ptr = &forge;
-
-               /* Wipe the object */
                object_wipe(q_ptr);
 
                /* Make Gold */
@@ -1353,7 +1334,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        /* Make some gold */
                        if (!make_gold(q_ptr)) continue;
 
-                       /* XXX XXX XXX */
                        dump_gold++;
                }
 
@@ -1363,7 +1343,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item)
                        /* Make an object */
                        if (!make_object(q_ptr, mo_mode)) continue;
 
-                       /* XXX XXX XXX */
                        dump_item++;
                }
 
@@ -1564,7 +1543,7 @@ static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr)
  * Made name, sex, and capitalization generic -BEN-
  * As always, the "ghost" processing is a total hack.
  * Hack -- we "delay" fear messages by passing around a "fear" flag.
- * XXX XXX XXX Consider decreasing monster experience over time, say,
+ * Consider decreasing monster experience over time, say,
  * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
  * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
  * monster worth more than subsequent monsters.  This would also need
@@ -1934,7 +1913,7 @@ msg_format("%sを葬り去った。", m_name);
 
                        if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
 
-                       /* Delete the monster */
+
                        delete_monster_idx(m_idx);
 
                        if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
@@ -1944,7 +1923,7 @@ msg_format("%sを葬り去った。", m_name);
                }
                else
                {
-                       /* Delete the monster */
+
                        delete_monster_idx(m_idx);
                }
 
@@ -1987,7 +1966,7 @@ msg_format("%sを葬り去った。", m_name);
                        /* Hack -- note fear */
                        (*fear) = TRUE;
 
-                       /* XXX XXX XXX Hack -- Add some timed fear */
+                       /* Hack -- Add some timed fear */
                        (void)set_monster_monfear(m_idx, (randint1(10) +
                                          (((dam >= m_ptr->hp) && (percentage > 7)) ?
                                           20 : ((11 - percentage) * 5))));
@@ -2042,7 +2021,6 @@ void panel_bounds_center(void)
 {
        int wid, hgt;
 
-       /* Get size */
        get_screen_size(&wid, &hgt);
 
        panel_row_max = panel_row_min + hgt - 1;
@@ -2072,7 +2050,6 @@ void resize_map(void)
                                
        verify_panel();
 
-       /* Update stuff */
        p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
 
        /* Forget lite/view */
@@ -2089,8 +2066,6 @@ void resize_map(void)
 
        /* Hack -- update */
        handle_stuff();
-       
-       /* Redraw */
        Term_redraw();
 
        /*
@@ -2113,16 +2088,11 @@ void redraw_window(void)
        /* Only if the dungeon exists */
        if (!character_dungeon) return;
 
-       /* Window stuff */
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
-
-       /* Window stuff */
        p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
 
        /* Hack -- update */
        handle_stuff();
-
-       /* Redraw */
        Term_redraw();
 }
 
@@ -2141,7 +2111,6 @@ bool change_panel(POSITION dy, POSITION dx)
        POSITION y, x;
        TERM_LEN wid, hgt;
 
-       /* Get size */
        get_screen_size(&wid, &hgt);
 
        /* Apply the motion */
@@ -2166,10 +2135,8 @@ bool change_panel(POSITION dy, POSITION dx)
                /* Recalculate the boundaries */
                panel_bounds_center();
 
-               /* Update stuff */
                p_ptr->update |= (PU_MONSTERS);
 
-               /* Redraw map */
                p_ptr->redraw |= (PR_MAP);
 
                /* Handle stuff */
@@ -2198,7 +2165,6 @@ static bool change_panel_xy(POSITION y, POSITION x)
        POSITION dy = 0, dx = 0;
        TERM_LEN wid, hgt;
 
-       /* Get size */
        get_screen_size(&wid, &hgt);
 
        if (y < panel_row_min) dy = -1;
@@ -2232,7 +2198,6 @@ void verify_panel(void)
        int max_prow_min;
        int max_pcol_min;
 
-       /* Get size */
        get_screen_size(&wid, &hgt);
 
        max_prow_min = cur_hgt - hgt;
@@ -2309,18 +2274,15 @@ void verify_panel(void)
        panel_col_min = pcol_min;
 
        /* Hack -- optional disturb on "panel change" */
-       if (disturb_panel && !center_player) disturb(0, 0);
+       if (disturb_panel && !center_player) disturb(FALSE, FALSE);
 
        /* Recalculate the boundaries */
        panel_bounds_center();
 
-       /* Update stuff */
        p_ptr->update |= (PU_MONSTERS);
 
-       /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 }
 
@@ -2538,7 +2500,7 @@ bool target_able(MONSTER_IDX m_idx)
        /* Monster must be projectable */
        if (!projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) return (FALSE);
 
-       /* XXX XXX XXX Hack -- Never target trappers */
+       /* Hack -- Never target trappers */
        /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */
 
        /* Assume okay */
@@ -2743,7 +2705,7 @@ static POSITION_IDX target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION
                /* Approximate Double Distance */
                v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
 
-               /* XXX XXX XXX Penalize location */
+               /* Penalize location */
 
                /* Track best */
                if ((b_i >= 0) && (v >= b_v)) continue;
@@ -2751,8 +2713,6 @@ static POSITION_IDX target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION
                /* Track best */
                b_i = i; b_v = v;
        }
-
-       /* Result */
        return (b_i);
 }
 
@@ -2811,7 +2771,6 @@ static bool target_set_accept(POSITION y, POSITION x)
                if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
        }
 
-       /* Nope */
        return (FALSE);
 }
 
@@ -2979,7 +2938,7 @@ bool show_gold_on_floor = FALSE;
  * recall info and the health bar info to track that monster.
  *
  * Eventually, we may allow multiple objects per grid, or objects
- * and terrain features in the same grid. XXX XXX XXX
+ * and terrain features in the same grid. 
  *
  * This function must handle blindness/hallucination.
  */
@@ -2993,8 +2952,6 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
        feature_type *f_ptr;
        char query = '\001';
        char out_val[MAX_NLEN+80];
-
-#ifdef ALLOW_EASY_FLOOR
        OBJECT_IDX floor_list[23];
        ITEM_NUMBER floor_num = 0;
 
@@ -3009,8 +2966,6 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
                }
        }
 
-#endif /* ALLOW_EASY_FLOOR */
-
        /* Hack -- under the player */
        if (player_bold(y, x))
        {
@@ -3175,7 +3130,6 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
                        /* Obtain an object description */
                        object_desc(o_name, o_ptr, 0);
 
-                       /* Describe the object */
 #ifdef JP
                        sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
 #else
@@ -3205,8 +3159,6 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
 #endif
        }
 
-
-#ifdef ALLOW_EASY_FLOOR
        if (floor_num)
        {
                int min_width = 0;
@@ -3222,15 +3174,12 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
                                /* Acquire object */
                                o_ptr = &o_list[floor_list[0]];
 
-                               /* Describe the object */
                                object_desc(o_name, o_ptr, 0);
 
 #ifdef JP
-                               sprintf(out_val, "%s%s%s%s[%s]",
-                                       s1, o_name, s2, s3, info);
+                               sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
 #else
-                               sprintf(out_val, "%s%s%s%s [%s]",
-                                       s1, s2, s3, o_name, info);
+                               sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
 #endif
 
                                prt(out_val, 0, 0);
@@ -3328,8 +3277,6 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
 
                /* NOTREACHED */
        }
-#endif /* ALLOW_EASY_FLOOR */
-
 
        /* Scan all objects in the grid */
        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
@@ -3353,7 +3300,6 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
                        /* Obtain an object description */
                        object_desc(o_name, o_ptr, 0);
 
-                       /* Describe the object */
 #ifdef JP
                        sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
 #else
@@ -3531,10 +3477,10 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info)
  *
  * All locations must be on the current panel.  Consider the use of
  * "panel_bounds()" to allow "off-panel" targets, perhaps by using
- * some form of "scrolling" the map around the cursor.  XXX XXX XXX
+ * some form of "scrolling" the map around the cursor.  
  * That is, consider the possibility of "auto-scrolling" the screen
  * while the cursor moves around.  This may require changes in the
- * "update_mon()" code to allow "visibility" even if off panel, and
+ * "update_monster()" code to allow "visibility" even if off panel, and
  * may require dynamic recalculation of the "temp" grid set.
  *
  * Hack -- targeting/observing an "outer border grid" may induce
@@ -3581,7 +3527,6 @@ bool target_set(BIT_FLAGS mode)
 
        int wid, hgt;
        
-       /* Get size */
        get_screen_size(&wid, &hgt);
 
        /* Cancel target */
@@ -3718,13 +3663,10 @@ bool target_set(BIT_FLAGS mode)
                                        /* Recenter the map around the player */
                                        verify_panel();
 
-                                       /* Update stuff */
                                        p_ptr->update |= (PU_MONSTERS);
 
-                                       /* Redraw map */
                                        p_ptr->redraw |= (PR_MAP);
 
-                                       /* Window stuff */
                                        p_ptr->window |= (PW_OVERHEAD);
 
                                        /* Handle stuff */
@@ -3811,13 +3753,10 @@ bool target_set(BIT_FLAGS mode)
                                                panel_col_min = x2;
                                                panel_bounds_center();
 
-                                               /* Update stuff */
                                                p_ptr->update |= (PU_MONSTERS);
 
-                                               /* Redraw map */
                                                p_ptr->redraw |= (PR_MAP);
 
-                                               /* Window stuff */
                                                p_ptr->window |= (PW_OVERHEAD);
 
                                                /* Handle stuff */
@@ -3932,13 +3871,10 @@ bool target_set(BIT_FLAGS mode)
                                        /* Recenter the map around the player */
                                        verify_panel();
 
-                                       /* Update stuff */
                                        p_ptr->update |= (PU_MONSTERS);
 
-                                       /* Redraw map */
                                        p_ptr->redraw |= (PR_MAP);
 
-                                       /* Window stuff */
                                        p_ptr->window |= (PW_OVERHEAD);
 
                                        /* Handle stuff */
@@ -4059,13 +3995,10 @@ bool target_set(BIT_FLAGS mode)
        /* Recenter the map around the player */
        verify_panel();
 
-       /* Update stuff */
        p_ptr->update |= (PU_MONSTERS);
 
-       /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD);
 
        /* Handle stuff */
@@ -4097,7 +4030,6 @@ bool get_aim_dir(DIRECTION *dp)
        cptr    p;
        COMMAND_CODE code;
 
-       /* Initialize */
        (*dp) = 0;
 
        /* Global direction */
@@ -4106,8 +4038,6 @@ bool get_aim_dir(DIRECTION *dp)
        /* Hack -- auto-target if requested */
        if (use_old_target && target_okay()) dir = 5;
 
-#ifdef ALLOW_REPEAT /* TNB */
-
        if (repeat_pull(&code))
        {
                /* Confusion? */
@@ -4121,8 +4051,6 @@ bool get_aim_dir(DIRECTION *dp)
        }
        *dp = (DIRECTION)code;
 
-#endif /* ALLOW_REPEAT -- TNB */
-
        /* Ask until satisfied */
        while (!dir)
        {
@@ -4196,7 +4124,6 @@ bool get_aim_dir(DIRECTION *dp)
        /* Check for confusion */
        if (p_ptr->confused)
        {
-               /* XXX XXX XXX */
                /* Random direction */
                dir = ddd[randint0(8)];
        }
@@ -4211,59 +4138,33 @@ bool get_aim_dir(DIRECTION *dp)
        /* Save direction */
        (*dp) = dir;
 
-#ifdef ALLOW_REPEAT /* TNB */
-
 /*     repeat_push(dir); */
        repeat_push((COMMAND_CODE)command_dir);
 
-#endif /* ALLOW_REPEAT -- TNB */
-
        /* A "valid" direction was entered */
        return (TRUE);
 }
 
 
-
-/*
- * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
- * and place it into "command_dir", unless we already have one.
- *
- * This function should be used for all "repeatable" commands, such as
- * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
- * as all commands which must reference a grid adjacent to the player,
- * and which may not reference the grid under the player.  Note that,
- * for example, it is no longer possible to "disarm" or "open" chests
- * in the same grid as the player.
- *
- * Direction "5" is illegal and will (cleanly) abort the command.
- *
- * This function tracks and uses the "global direction", and uses
- * that as the "desired direction", to which "confusion" is applied.
- */
-bool get_rep_dir(DIRECTION *dp, bool under)
+bool get_direction(DIRECTION *dp, bool allow_under, bool with_steed)
 {
        DIRECTION dir;
        cptr prompt;
        COMMAND_CODE code;
 
-       /* Initialize */
        (*dp) = 0;
 
        /* Global direction */
        dir = command_dir;
 
-#ifdef ALLOW_REPEAT /* TNB */
-
        if (repeat_pull(&code))
        {
                dir = (DIRECTION)code;
-/*             return (TRUE); */
+               /*              return (TRUE); */
        }
        *dp = (DIRECTION)code;
 
-#endif /* ALLOW_REPEAT -- TNB */
-
-       if (under)
+       if (allow_under)
        {
                prompt = _("方向 ('.'足元, ESCで中断)? ", "Direction ('.' at feet, Escape to cancel)? ");
        }
@@ -4271,7 +4172,7 @@ bool get_rep_dir(DIRECTION *dp, bool under)
        {
                prompt = _("方向 (ESCで中断)? ", "Direction (Escape to cancel)? ");
        }
-       
+
        /* Get a direction */
        while (!dir)
        {
@@ -4281,7 +4182,7 @@ bool get_rep_dir(DIRECTION *dp, bool under)
                if (!get_com(prompt, &ch, TRUE)) break;
 
                /* Look down */
-               if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
+               if ((allow_under) && ((ch == '5') || (ch == '-') || (ch == '.')))
                {
                        dir = 5;
                }
@@ -4290,13 +4191,12 @@ bool get_rep_dir(DIRECTION *dp, bool under)
                        /* Look up the direction */
                        dir = get_keymap_dir(ch);
 
-                       /* Oops */
                        if (!dir) bell();
                }
        }
 
        /* Prevent weirdness */
-       if ((dir == 5) && (!under)) dir = 0;
+       if ((dir == 5) && (!allow_under)) dir = 0;
 
        /* Aborted */
        if (!dir) return (FALSE);
@@ -4314,7 +4214,7 @@ bool get_rep_dir(DIRECTION *dp, bool under)
                        dir = ddd[randint0(8)];
                }
        }
-       else if (p_ptr->riding)
+       else if (p_ptr->riding && with_steed)
        {
                monster_type *m_ptr = &m_list[p_ptr->riding];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
@@ -4368,31 +4268,40 @@ bool get_rep_dir(DIRECTION *dp, bool under)
        /* Save direction */
        (*dp) = dir;
 
-#ifdef ALLOW_REPEAT /* TNB */
-
-/*     repeat_push(dir); */
+       /*      repeat_push(dir); */
        repeat_push((COMMAND_CODE)command_dir);
 
-#endif /* ALLOW_REPEAT -- TNB */
-
        /* Success */
        return (TRUE);
 }
 
-
-bool get_rep_dir2(DIRECTION *dp)
+/*
+ * @brief 進行方向を指定する(騎乗対象の混乱の影響を受ける) / Request a "movement" direction (1,2,3,4,6,7,8,9) from the user,
+ * and place it into "command_dir", unless we already have one.
+ *
+ * This function should be used for all "repeatable" commands, such as
+ * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well
+ * as all commands which must reference a grid adjacent to the player,
+ * and which may not reference the grid under the player.  Note that,
+ * for example, it is no longer possible to "disarm" or "open" chests
+ * in the same grid as the player.
+ *
+ * Direction "5" is illegal and will (cleanly) abort the command.
+ *
+ * This function tracks and uses the "global direction", and uses
+ * that as the "desired direction", to which "confusion" is applied.
+ */
+bool get_rep_dir(DIRECTION *dp, bool under)
 {
        DIRECTION dir;
+       cptr prompt;
        COMMAND_CODE code;
 
-       /* Initialize */
        (*dp) = 0;
 
        /* Global direction */
        dir = command_dir;
 
-#ifdef ALLOW_REPEAT /* TNB */
-
        if (repeat_pull(&code))
        {
                dir = (DIRECTION)code;
@@ -4400,25 +4309,39 @@ bool get_rep_dir2(DIRECTION *dp)
        }
        *dp = (DIRECTION)code;
 
-#endif /* ALLOW_REPEAT -- TNB */
-
+       if (under)
+       {
+               prompt = _("方向 ('.'足元, ESCで中断)? ", "Direction ('.' at feet, Escape to cancel)? ");
+       }
+       else
+       {
+               prompt = _("方向 (ESCで中断)? ", "Direction (Escape to cancel)? ");
+       }
+       
        /* Get a direction */
        while (!dir)
        {
                char ch;
 
                /* Get a command (or Cancel) */
-               if (!get_com(_("方向 (ESCで中断)? ", "Direction (Escape to cancel)? "), &ch, TRUE)) break;
+               if (!get_com(prompt, &ch, TRUE)) break;
 
-               /* Look up the direction */
-               dir = get_keymap_dir(ch);
+               /* Look down */
+               if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
+               {
+                       dir = 5;
+               }
+               else
+               {
+                       /* Look up the direction */
+                       dir = get_keymap_dir(ch);
 
-               /* Oops */
-               if (!dir) bell();
+                       if (!dir) bell();
+               }
        }
 
        /* Prevent weirdness */
-       if (dir == 5) dir = 0;
+       if ((dir == 5) && (!under)) dir = 0;
 
        /* Aborted */
        if (!dir) return (FALSE);
@@ -4436,24 +4359,63 @@ bool get_rep_dir2(DIRECTION *dp)
                        dir = ddd[randint0(8)];
                }
        }
+       else if (p_ptr->riding)
+       {
+               monster_type *m_ptr = &m_list[p_ptr->riding];
+               monster_race *r_ptr = &r_info[m_ptr->r_idx];
+
+               if (MON_CONFUSED(m_ptr))
+               {
+                       /* Standard confusion */
+                       if (randint0(100) < 75)
+                       {
+                               /* Random direction */
+                               dir = ddd[randint0(8)];
+                       }
+               }
+               else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
+               {
+                       /* Random direction */
+                       dir = ddd[randint0(8)];
+               }
+               else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
+               {
+                       /* Random direction */
+                       dir = ddd[randint0(8)];
+               }
+       }
 
        /* Notice confusion */
        if (command_dir != dir)
        {
-               /* Warn the user */
-               msg_print(_("あなたは混乱している。", "You are confused."));
+               if (p_ptr->confused)
+               {
+                       /* Warn the user */
+                       msg_print(_("あなたは混乱している。", "You are confused."));
+               }
+               else
+               {
+                       char m_name[80];
+                       monster_type *m_ptr = &m_list[p_ptr->riding];
+
+                       monster_desc(m_name, m_ptr, 0);
+                       if (MON_CONFUSED(m_ptr))
+                       {
+                               msg_format(_("%sは混乱している。", "%^s is confusing."), m_name);
+                       }
+                       else
+                       {
+                               msg_format(_("%sは思い通りに動いてくれない。", "You cannot control %s."), m_name);
+                       }
+               }
        }
 
        /* Save direction */
        (*dp) = dir;
 
-#ifdef ALLOW_REPEAT /* TNB */
-
 /*     repeat_push(dir); */
        repeat_push((COMMAND_CODE)command_dir);
 
-#endif /* ALLOW_REPEAT -- TNB */
-
        /* Success */
        return (TRUE);
 }
@@ -5068,7 +5030,6 @@ static bool tgt_pt_accept(POSITION y, POSITION x)
                if (cave_have_flag_grid(c_ptr, FF_QUEST_EXIT)) return (TRUE);
        }
 
-       /* Nope */
        return (FALSE);
 }
 
@@ -5121,7 +5082,6 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
 
        int wid, hgt;
 
-       /* Get size */
        get_screen_size(&wid, &hgt);
 
        x = p_ptr->x;
@@ -5189,13 +5149,10 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                                        x = p_ptr->x;
                                        verify_panel(); /* Move cursor to player */
 
-                                       /* Update stuff */
                                        p_ptr->update |= (PU_MONSTERS);
 
-                                       /* Redraw map */
                                        p_ptr->redraw |= (PR_MAP);
 
-                                       /* Window stuff */
                                        p_ptr->window |= (PW_OVERHEAD);
 
                                        /* Handle stuff */
@@ -5280,13 +5237,10 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
        /* Recenter the map around the player */
        verify_panel();
 
-       /* Update stuff */
        p_ptr->update |= (PU_MONSTERS);
 
-       /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD);
 
        /* Handle stuff */
@@ -5304,7 +5258,6 @@ bool get_hack_dir(DIRECTION *dp)
        cptr    p;
        char    command;
 
-       /* Initialize */
        (*dp) = 0;
 
        /* Global direction */
@@ -5381,7 +5334,6 @@ bool get_hack_dir(DIRECTION *dp)
        /* Check for confusion */
        if (p_ptr->confused)
        {
-               /* XXX XXX XXX */
                /* Random direction */
                dir = ddd[randint0(8)];
        }