OSDN Git Service

[Refactor] #39963 Separated spells-type.h from spells.h
[hengband/hengband.git] / src / player-move.c
index af7dd17..b71ced4 100644 (file)
 #include "angband.h"
 #include "core.h"
 #include "util.h"
+#include "main/sound-definitions-table.h"
 
-#include "realm-song.h"
-#include "autopick.h"
+#include "realm/realm-song.h"
+#include "autopick/autopick.h"
 #include "dungeon.h"
 #include "floor.h"
 #include "melee.h"
 #include "player-move.h"
 #include "player-status.h"
 #include "player-effects.h"
+#include "player-race.h"
 #include "player-class.h"
+#include "player-inventory.h"
 #include "player-personality.h"
 #include "spells-floor.h"
 #include "feature.h"
 #include "monster-status.h"
 #include "object-hook.h"
 #include "object-flavor.h"
-#include "spells.h"
+#include "spell/spells-type.h"
 #include "cmd-basic.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
 #include "world.h"
-#include "objectkind.h"
-#include "autopick.h"
+#include "object/object-kind.h"
+#include "autopick/autopick.h"
 #include "targeting.h"
 
-#ifdef TRAVEL
- /* for travel */
 travel_type travel;
-#endif
 
 /*!
  * @brief 地形やその上のアイテムの隠された要素を全て明かす /
@@ -192,14 +192,14 @@ static void discover_hidden_things(player_type *creature_ptr, POSITION y, POSITI
        floor_type *floor_ptr = creature_ptr->current_floor_ptr;
        g_ptr = &floor_ptr->grid_array[y][x];
 
-       if (g_ptr->mimic && is_trap(g_ptr->feat))
+       if (g_ptr->mimic && is_trap(creature_ptr, g_ptr->feat))
        {
                disclose_grid(creature_ptr, y, x);
                msg_print(_("トラップを発見した。", "You have found a trap."));
                disturb(creature_ptr, FALSE, TRUE);
        }
 
-       if (is_hidden_door(g_ptr))
+       if (is_hidden_door(creature_ptr, g_ptr))
        {
                msg_print(_("隠しドアを発見した。", "You have found a secret door."));
                disclose_grid(creature_ptr, y, x);
@@ -281,7 +281,7 @@ void py_pickup_aux(player_type *owner_ptr, OBJECT_IDX o_idx)
        o_ptr = &owner_ptr->current_floor_ptr->o_list[o_idx];
 
 #ifdef JP
-       object_desc(old_name, o_ptr, OD_NAME_ONLY);
+       object_desc(owner_ptr, old_name, o_ptr, OD_NAME_ONLY);
        object_desc_kosuu(kazu_str, o_ptr);
        hirottakazu = o_ptr->number;
 #endif
@@ -292,7 +292,7 @@ void py_pickup_aux(player_type *owner_ptr, OBJECT_IDX o_idx)
        /* Get the object again */
        o_ptr = &owner_ptr->inventory_list[slot];
 
-       delete_object_idx(owner_ptr->current_floor_ptr, o_idx);
+       delete_object_idx(owner_ptr, o_idx);
 
        if (owner_ptr->pseikaku == SEIKAKU_MUNCHKIN)
        {
@@ -305,7 +305,7 @@ void py_pickup_aux(player_type *owner_ptr, OBJECT_IDX o_idx)
                if (o_ptr->marked & OM_AUTODESTROY) return;
        }
 
-       object_desc(o_name, o_ptr, 0);
+       object_desc(owner_ptr, o_name, o_ptr, 0);
 
 #ifdef JP
        if ((o_ptr->name1 == ART_CRIMSON) && (owner_ptr->pseikaku == SEIKAKU_COMBAT))
@@ -354,7 +354,7 @@ void py_pickup_aux(player_type *owner_ptr, OBJECT_IDX o_idx)
 void carry(player_type *creature_ptr, bool pickup)
 {
        /* Recenter the map around the player */
-       verify_panel();
+       verify_panel(creature_ptr);
 
        creature_ptr->update |= (PU_MONSTERS);
        creature_ptr->redraw |= (PR_MAP);
@@ -377,20 +377,8 @@ void carry(player_type *creature_ptr, bool pickup)
        {
                object_type *o_ptr;
                o_ptr = &creature_ptr->current_floor_ptr->o_list[this_o_idx];
-
-#ifdef ALLOW_EASY_SENSE /* TNB */
-
-               /* Option: Make item sensing easy */
-               if (easy_sense)
-               {
-                       /* Sense the object */
-                       (void)sense_object(o_ptr);
-               }
-
-#endif /* ALLOW_EASY_SENSE -- TNB */
-
                GAME_TEXT o_name[MAX_NLEN];
-               object_desc(o_name, o_ptr, 0);
+               object_desc(creature_ptr, o_name, o_ptr, 0);
                next_o_idx = o_ptr->next_o_idx;
 
                disturb(creature_ptr, FALSE, FALSE);
@@ -398,7 +386,7 @@ void carry(player_type *creature_ptr, bool pickup)
                if (o_ptr->tval == TV_GOLD)
                {
                        int value = (long)o_ptr->pval;
-                       delete_object_idx(creature_ptr->current_floor_ptr, this_o_idx);
+                       delete_object_idx(creature_ptr, this_o_idx);
                        msg_format(_(" $%ld の価値がある%sを見つけた。", "You collect %ld gold pieces worth of %s."),
                           (long)value, o_name);
 
@@ -619,11 +607,11 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                        }
                }
 
-               lite_spot(oy, ox);
-               lite_spot(ny, nx);
+               lite_spot(creature_ptr, oy, ox);
+               lite_spot(creature_ptr, ny, nx);
 
                /* Check for new panel (redraw map) */
-               verify_panel();
+               verify_panel(creature_ptr);
 
                if (mpe_mode & MPE_FORGET_FLOW)
                {
@@ -637,7 +625,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
                /* Remove "unsafe" flag */
-               if ((!creature_ptr->blind && !no_lite(creature_ptr)) || !is_trap(g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE);
+               if ((!creature_ptr->blind && !no_lite(creature_ptr)) || !is_trap(creature_ptr, g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE);
 
                /* For get everything when requested hehe I'm *NASTY* */
                if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(creature_ptr);
@@ -992,15 +980,15 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                    pattern_seq(creature_ptr, creature_ptr->y, creature_ptr->x, y, x) && (p_can_enter || p_can_kill_walls))
                {
                        /* Disturb the monster */
-                       (void)set_monster_csleep(g_ptr->m_idx, 0);
+                       (void)set_monster_csleep(creature_ptr, g_ptr->m_idx, 0);
 
-                       monster_desc(m_name, m_ptr, 0);
+                       monster_desc(creature_ptr, m_name, m_ptr, 0);
 
                        if (m_ptr->ml)
                        {
                                /* Auto-Recall if possible and visible */
-                               if (!creature_ptr->image) monster_race_track(m_ptr->ap_r_idx);
-                               health_track(g_ptr->m_idx);
+                               if (!creature_ptr->image) monster_race_track(creature_ptr, m_ptr->ap_r_idx);
+                               health_track(creature_ptr, g_ptr->m_idx);
                        }
 
                        /* displace? */
@@ -1009,7 +997,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                                py_attack(creature_ptr, y, x, 0);
                                can_move = FALSE;
                        }
-                       else if (monster_can_cross_terrain(floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
+                       else if (monster_can_cross_terrain(creature_ptr, floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
                        {
                                do_past = TRUE;
                        }
@@ -1043,7 +1031,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                else if (MON_MONFEAR(riding_m_ptr))
                {
                        GAME_TEXT steed_name[MAX_NLEN];
-                       monster_desc(steed_name, riding_m_ptr, 0);
+                       monster_desc(creature_ptr, steed_name, riding_m_ptr, 0);
                        msg_format(_("%sが恐怖していて制御できない。", "%^s is too scared to control."), steed_name);
                        can_move = FALSE;
                        disturb(creature_ptr, FALSE, TRUE);
@@ -1088,7 +1076,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                if (can_move && MON_STUNNED(riding_m_ptr) && one_in_(2))
                {
                        GAME_TEXT steed_name[MAX_NLEN];
-                       monster_desc(steed_name, riding_m_ptr, 0);
+                       monster_desc(creature_ptr, steed_name, riding_m_ptr, 0);
                        msg_format(_("%sが朦朧としていてうまく動けない!", "You cannot control stunned %s!"), steed_name);
                        can_move = FALSE;
                        disturb(creature_ptr, FALSE, TRUE);
@@ -1157,7 +1145,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
 #endif
 
                                g_ptr->info |= (CAVE_MARK);
-                               lite_spot(y, x);
+                               lite_spot(creature_ptr, y, x);
                        }
                }
 
@@ -1176,7 +1164,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                        else
                        {
                                /* Closed doors */
-                               if (easy_open && is_closed_door(feat) && easy_open_door(creature_ptr, y, x)) return;
+                               if (easy_open && is_closed_door(creature_ptr, feat) && easy_open_door(creature_ptr, y, x)) return;
 
 #ifdef JP
                                msg_format("%sが行く手をはばんでいる。", name);
@@ -1834,8 +1822,6 @@ void run_step(player_type *creature_ptr, DIRECTION dir)
 }
 
 
-#ifdef TRAVEL
-
 /*!
  * @brief トラベル機能の判定処理 /
  * Test for traveling
@@ -1849,7 +1835,7 @@ static DIRECTION travel_test(player_type *creature_ptr, DIRECTION prev_dir)
        if (creature_ptr->blind || no_lite(creature_ptr))
        {
                msg_print(_("目が見えない!", "You cannot see!"));
-               return (0);
+               return 0;
        }
 
        /* break run when leaving trap detected region */
@@ -1871,7 +1857,7 @@ static DIRECTION travel_test(player_type *creature_ptr, DIRECTION prev_dir)
                        if (disturb_trap_detect)
                        {
                                /* Break Run */
-                               return (0);
+                               return 0;
                        }
                }
        }
@@ -1898,7 +1884,7 @@ static DIRECTION travel_test(player_type *creature_ptr, DIRECTION prev_dir)
                        monster_type *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
 
                        /* Visible monster */
-                       if (m_ptr->ml) return (0);
+                       if (m_ptr->ml) return 0;
                }
 
        }
@@ -1919,16 +1905,16 @@ static DIRECTION travel_test(player_type *creature_ptr, DIRECTION prev_dir)
                }
        }
 
-       if (!new_dir) return (0);
+       if (!new_dir) return 0;
 
        /* Access newly move grid */
        g_ptr = &floor_ptr->grid_array[creature_ptr->y+ddy[new_dir]][creature_ptr->x+ddx[new_dir]];
 
        /* Close door abort traveling */
-       if (!easy_open && is_closed_door(g_ptr->feat)) return (0);
+       if (!easy_open && is_closed_door(creature_ptr, g_ptr->feat)) return 0;
 
        /* Visible and unignorable trap abort tarveling */
-       if (!g_ptr->mimic && !trap_can_be_ignored(creature_ptr, g_ptr->feat)) return (0);
+       if (!g_ptr->mimic && !trap_can_be_ignored(creature_ptr, g_ptr->feat)) return 0;
 
        /* Move new grid */
        return new_dir;
@@ -1975,13 +1961,8 @@ void travel_step(player_type *creature_ptr)
        /* Travel Delay */
        Term_xtra(TERM_XTRA_DELAY, delay_factor);
 }
-#endif
 
 
-#ifdef TRAVEL
-/*
- * Hack: travel command
- */
 #define TRAVEL_UNABLE 9999
 
 static int flow_head = 0;
@@ -1989,7 +1970,6 @@ static int flow_tail = 0;
 static POSITION temp2_x[MAX_SHORT];
 static POSITION temp2_y[MAX_SHORT];
 
-
 /*!
  * @brief トラベル処理の記憶配列を初期化する Hack: forget the "flow" information
  * @param creature_ptr プレーヤーへの参照ポインタ
@@ -2207,7 +2187,6 @@ void do_cmd_travel(player_type *creature_ptr)
                if ((sx == ddx[i]) && (sy == ddy[i])) travel.dir = i;
        }
 }
-#endif
 
 
 /*
@@ -2218,11 +2197,6 @@ void do_cmd_travel(player_type *creature_ptr)
  */
 void disturb(player_type *creature_ptr, bool stop_search, bool stop_travel)
 {
-#ifndef TRAVEL
-       /* Unused */
-       stop_travel = stop_travel;
-#endif
-
        /* Cancel repeated commands */
        if (command_rep)
        {
@@ -2247,7 +2221,7 @@ void disturb(player_type *creature_ptr, bool stop_search, bool stop_travel)
                creature_ptr->running = 0;
 
                /* Check for new panel if appropriate */
-               if (center_player && !center_running) verify_panel();
+               if (center_player && !center_running) verify_panel(creature_ptr);
 
                /* Calculate torch radius */
                creature_ptr->update |= (PU_TORCH);
@@ -2256,19 +2230,17 @@ void disturb(player_type *creature_ptr, bool stop_search, bool stop_travel)
                creature_ptr->update |= (PU_FLOW);
        }
 
-#ifdef TRAVEL
        if (stop_travel)
        {
                /* Cancel */
                travel.run = 0;
 
                /* Check for new panel if appropriate */
-               if (center_player && !center_running) verify_panel();
+               if (center_player && !center_running) verify_panel(creature_ptr);
 
                /* Calculate torch radius */
                creature_ptr->update |= (PU_TORCH);
        }
-#endif
 
        if (flush_disturb) flush();
 }