OSDN Git Service

[Refactor] #37353 PROJECT_* 定義を新規ファイル projection.h へ移動。 / Move PROJECT_* definition...
[hengband/hengband.git] / src / spells2.c
index d22929d..c8162bb 100644 (file)
@@ -17,6 +17,7 @@
 #include "monsterrace-hook.h"
 #include "melee.h"
 #include "world.h"
+#include "projection.h"
 
 
 /*!
@@ -612,7 +613,7 @@ bool detect_monsters_mind(POSITION range)
  * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
  * @return 効力があった場合TRUEを返す
  */
-bool detect_monsters_string(POSITION range, cptr Match)
+bool detect_monsters_string(POSITION range, concptr Match)
 {
        MONSTER_IDX i;
        POSITION y, x;
@@ -671,7 +672,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
        MONSTER_IDX i;
        POSITION y, x;
        bool flag = FALSE;
-       cptr desc_monsters = _("変なモンスター", "weird monsters");
+       concptr desc_monsters = _("変なモンスター", "weird monsters");
 
        if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
 
@@ -990,7 +991,7 @@ void aggravate_monsters(MONSTER_IDX who)
  * @param spell_name 抹殺効果を起こした魔法の名前
  * @return 効力があった場合TRUEを返す
  */
-bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
+bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
 {
        int          msec = delay_factor * delay_factor * delay_factor;
        monster_type *m_ptr = &m_list[m_idx];
@@ -1214,7 +1215,7 @@ bool probing(void)
        bool_hack cu, cv;
        bool probe = FALSE;
        char buf[256];
-       cptr align;
+       concptr align;
 
        cu = Term->scr->cu;
        cv = Term->scr->cv;
@@ -1804,7 +1805,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
 
                if (damage)
                {
-                       cptr killer;
+                       concptr killer;
 
                        if (m_idx)
                        {
@@ -1932,7 +1933,6 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                                        }
                                                }
 
-
                                                delete_monster(yy, xx);
 
                                                /* No longer safe */
@@ -1954,13 +1954,8 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                                m_ptr->fy = sy;
                                                m_ptr->fx = sx;
 
-                                               /* Update the monster (new location) */
                                                update_monster(m_idx, TRUE);
-
-                                               /* Redraw the old grid */
                                                lite_spot(yy, xx);
-
-                                               /* Redraw the new grid */
                                                lite_spot(sy, sx);
                                        }
                                }
@@ -2203,9 +2198,7 @@ static void cave_temp_room_lite(void)
                if (c_ptr->m_idx)
                {
                        int chance = 25;
-
                        monster_type    *m_ptr = &m_list[c_ptr->m_idx];
-
                        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
                        update_monster(c_ptr->m_idx, FALSE);
 
@@ -3464,7 +3457,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
                        if (!one_in_(6)) break;
                case 7: case 8: case 9: case 18:
-                       (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                       (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                        if (!one_in_(6)) break;
                case 10: case 11: case 12:
                        msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
@@ -3504,7 +3497,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        }
                        if (!one_in_(6)) break;
                default:
-                       while (i < 6)
+                       while (i < A_MAX)
                        {
                                do
                                {
@@ -3558,51 +3551,51 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
                switch (randint1(25) + (dun_level / 20))
                {
                        case 1: case 2:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
                                break;
                        case 3: case 4:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode, '\0');
                                break;
                        case 5: case 6:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode, '\0');
                                break;
                        case 7: case 8:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode, '\0');
                                break;
                        case 9: case 10:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode, '\0');
                                break;
                        case 11: case 12:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode, '\0');
                                break;
                        case 13: case 14:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode, '\0');
                                break;
                        case 15: case 16:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode, '\0');
                                break;
                        case 17:
                                if (can_pet) break;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
                                break;
                        case 18: case 19:
                                if (can_pet) break;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0');
                                break;
                        case 20: case 21:
                                if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode, '\0');
                                break;
                        case 22: case 23:
                                if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode, '\0');
                                break;
                        case 24:
-                               count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode, '\0');
                                break;
                        default:
                                if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
+                               count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode, '\0');
                }
        }
 
@@ -3635,7 +3628,7 @@ int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
 
        for (i = 0; i < max_cyber; i++)
        {
-               count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
+               count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode, '\0');
        }
 
        return count;
@@ -3873,23 +3866,14 @@ bool kawarimi(bool success)
        x = p_ptr->x;
 
        teleport_player(10 + randint1(90), 0L);
-
        object_wipe(q_ptr);
-
        object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
 
        q_ptr->pval = MON_NINJA;
-
-       /* Drop it in the dungeon */
        (void)drop_near(q_ptr, -1, y, x);
 
-#ifdef JP
-       if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
-       else msg_print("失敗!攻撃を受けてしまった。");
-#else
-       if (success) msg_print("You have turned around just before the attack hit you.");
-       else msg_print("Failed! You are hit by the attack.");
-#endif
+       if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
+       else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
 
        p_ptr->special_defense &= ~(NINJA_KAWARIMI);
        p_ptr->redraw |= (PR_STATUS);
@@ -3984,8 +3968,7 @@ bool rush_attack(bool *mdeath)
                if (tm_idx != cave[ny][nx].m_idx)
                {
 #ifdef JP
-                       msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
-                                  m_ptr->ml ? "モンスター" : "何か");
+                       msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
 #else
                        msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
 #endif
@@ -4188,7 +4171,7 @@ void wild_magic(int spell)
        case 35:
                while (counter++ < 8)
                {
-                       (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
+                       (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET), '\0');
                }
                break;
        case 36:
@@ -4469,7 +4452,7 @@ void cast_invoke_spirits(DIRECTION dir)
                msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
                        "Oh no! Mouldering forms rise from the earth around you!"));
 
-               (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+               (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
                chg_virtue(V_UNLIFE, 1);
        }
        else if (die < 14)
@@ -4629,7 +4612,7 @@ void cast_shuffle(void)
        else if (die < 14)
        {
                msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
-               summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+               summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
        }
        else if (die < 18)
        {
@@ -4757,9 +4740,9 @@ void cast_shuffle(void)
        }
 }
 
-bool_hack life_stream(bool_hack message, bool_hack virtue)
+bool_hack life_stream(bool_hack message, bool_hack virtue_change)
 {
-       if(virtue)
+       if(virtue_change)
        {
                chg_virtue(V_VITALITY, 1);
                chg_virtue(V_UNLIFE, -5);
@@ -5003,25 +4986,14 @@ bool psychometry(void)
        object_type     *o_ptr;
        GAME_TEXT o_name[MAX_NLEN];
        byte            feel;
-       cptr            q, s;
+       concptr            q, s;
        bool okay = FALSE;
 
        q = _("どのアイテムを調べますか?", "Meditate on which item? ");
        s = _("調べるアイテムがありません。", "You have nothing appropriate.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return (FALSE);
 
        /* It is fully known, no information needed */
        if (object_is_known(o_ptr))
@@ -5044,12 +5016,10 @@ bool psychometry(void)
        }
 
 #ifdef JP
-       msg_format("%sは%sという感じがする...",
-               o_name, game_inscriptions[feel]);
+       msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
 #else
        msg_format("You feel that the %s %s %s...",
-               o_name, ((o_ptr->number == 1) ? "is" : "are"),
-               game_inscriptions[feel]);
+               o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
 #endif
 
 
@@ -5063,7 +5033,7 @@ bool psychometry(void)
        o_ptr->marked |= OM_TOUCHED;
 
        /* Combine / Reorder the pack (later) */
-       p_ptr->notice |= (PN_COMBINE | PN_REORDER);
+       p_ptr->update |= (PU_COMBINE | PU_REORDER);
 
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);