OSDN Git Service

[Refactor] #37353 自己分析処理を selfinfo.c/h に分離。 / Separate self knoledge spells to selfin...
[hengband/hengband.git] / src / do-spell.c
index 83a8c56..e4ddcf7 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "angband.h"
+#include "selfinfo.h"
 
 
 /*!
@@ -62,7 +63,7 @@ static cptr info_duration(int base, int sides)
  * @param range 効果範囲
  * @return フォーマットに従い整形された文字列
  */
-static cptr info_range(int range)
+static cptr info_range(POSITION range)
 {
        return format(_("範囲:%d", "range %d"), range);
 }
@@ -96,7 +97,7 @@ static cptr info_delay(int base, int sides)
  * @param dam 固定値
  * @return フォーマットに従い整形された文字列
  */
-static cptr info_multi_damage(int dam)
+static cptr info_multi_damage(HIT_POINT dam)
 {
        return format(_("損傷:各%d", "dam %d each"), dam);
 }
@@ -193,11 +194,11 @@ static int beam_chance(void)
  * @param mode モンスター生成条件フラグ
  * @return モンスターが(敵対も含めて)召還されたならばTRUEを返す。
  */
-static bool trump_summoning(int num, bool pet, int y, int x, int lev, int type, u32b mode)
+static bool trump_summoning(int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode)
 {
-       int plev = p_ptr->lev;
+       PLAYER_LEVEL plev = p_ptr->lev;
 
-       int who;
+       MONSTER_IDX who;
        int i;
        bool success = FALSE;
 
@@ -303,19 +304,19 @@ static void cast_wonder(int dir)
        else if (die < 71)
                fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
                                  damroll(8 + ((plev - 5) / 4), 8));
-       else if (die < 76) drain_life(dir, 75);
+       else if (die < 76) hypodynamic_bolt(dir, 75);
        else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
        else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
        else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
        else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
-       else if (die < 101) drain_life(dir, 100 + plev);
+       else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
        else if (die < 104)
        {
-               earthquake(py, px, 12);
+               earthquake(p_ptr->y, p_ptr->x, 12);
        }
        else if (die < 106)
        {
-               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
+               (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
        }
        else if (die < 108)
        {
@@ -370,7 +371,7 @@ static void cast_invoke_spirits(int dir)
                msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!", 
                                        "Oh no! Mouldering forms rise from the earth around you!"));
 
-               (void)summon_specific(0, py, px, 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));
                chg_virtue(V_UNLIFE, 1);
        }
        else if (die < 14)
@@ -429,7 +430,7 @@ static void cast_invoke_spirits(int dir)
        }
        else if (die < 76)
        {
-               drain_life(dir, 75);
+               hypodynamic_bolt(dir, 75);
        }
        else if (die < 81)
        {
@@ -449,15 +450,15 @@ static void cast_invoke_spirits(int dir)
        }
        else if (die < 101)
        {
-               drain_life(dir, 100 + plev);
+               hypodynamic_bolt(dir, 100 + plev);
        }
        else if (die < 104)
        {
-               earthquake(py, px, 12);
+               earthquake(p_ptr->y, p_ptr->x, 12);
        }
        else if (die < 106)
        {
-               (void)destroy_area(py, px, 13 + randint0(5), FALSE);
+               (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
        }
        else if (die < 108)
        {
@@ -487,13 +488,13 @@ static void cast_invoke_spirits(int dir)
  * @param spell 基準となる引数ID
  * @return なし
  */
-static void wild_magic(int spell)
+static void wild_magic(SPELL_IDX spell)
 {
        int counter = 0;
-       int type = SUMMON_BIZARRE1 + randint0(6);
+       int type = SUMMON_MOLD + randint0(6);
 
-       if (type < SUMMON_BIZARRE1) type = SUMMON_BIZARRE1;
-       else if (type > SUMMON_BIZARRE6) type = SUMMON_BIZARRE6;
+       if (type < SUMMON_MOLD) type = SUMMON_MOLD;
+       else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
 
        switch (randint1(spell) + randint1(8) + 1)
        {
@@ -526,12 +527,13 @@ static void wild_magic(int spell)
                break;
        case 16: case 17:
                wall_breaker();
+               break;
        case 18:
                sleep_monsters_touch();
                break;
        case 19:
        case 20:
-               trap_creation(py, px);
+               trap_creation(p_ptr->y, p_ptr->x);
                break;
        case 21:
        case 22:
@@ -543,7 +545,7 @@ static void wild_magic(int spell)
                aggravate_monsters(0);
                break;
        case 26:
-               earthquake(py, px, 5);
+               earthquake(p_ptr->y, p_ptr->x, 5);
                break;
        case 27:
        case 28:
@@ -566,15 +568,15 @@ static void wild_magic(int spell)
        case 35:
                while (counter++ < 8)
                {
-                       (void)summon_specific(0, py, px, (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));
                }
                break;
        case 36:
        case 37:
-               activate_hi_summon(py, px, FALSE);
+               activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
                break;
        case 38:
-               (void)summon_cyber(-1, py, px);
+               (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
                break;
        default:
                {
@@ -628,12 +630,12 @@ static void cast_shuffle(void)
                msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
 
                for (i = 0; i < randint1(3); i++)
-                       activate_hi_summon(py, px, FALSE);
+                       activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
        }
        else if (die < 14)
        {
                msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
-               summon_specific(0, py, px, 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));
        }
        else if (die < 18)
        {
@@ -655,7 +657,7 @@ static void cast_shuffle(void)
        else if (die < 30)
        {
                msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
-               trump_summoning(1, FALSE, py, px, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
+               trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
        }
        else if (die < 33)
        {
@@ -701,27 +703,27 @@ static void cast_shuffle(void)
        {
                msg_print(_("《塔》だ。", "It's the Tower."));
 
-               earthquake(py, px, 5);
+               earthquake(p_ptr->y, p_ptr->x, 5);
        }
        else if (die < 82)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, py, px, (dun_level * 3 / 2), SUMMON_BIZARRE1, 0L);
+               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
        }
        else if (die < 84)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, py, px, (dun_level * 3 / 2), SUMMON_BIZARRE2, 0L);
+               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
        }
        else if (die < 86)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, py, px, (dun_level * 3 / 2), SUMMON_BIZARRE4, 0L);
+               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
        }
        else if (die < 88)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, py, px, (dun_level * 3 / 2), SUMMON_BIZARRE5, 0L);
+               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
        }
        else if (die < 96)
        {
@@ -739,13 +741,7 @@ static void cast_shuffle(void)
        {
                msg_print(_("《審判》だ。", "It's the Judgement."));
                do_cmd_rerate(FALSE);
-               if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
-               {
-                       msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
-                       p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
-                       p_ptr->update |= PU_BONUS;
-                       handle_stuff();
-               }
+               lose_all_mutations();
        }
        else if (die < 120)
        {
@@ -774,32 +770,32 @@ static void cast_shuffle(void)
  * @param rad 効力の半径
  * @return なし
  */
-static void cast_meteor(int dam, int rad)
+static void cast_meteor(HIT_POINT dam, int rad)
 {
        int i;
        int b = 10 + randint1(10);
 
        for (i = 0; i < b; i++)
        {
-               int y, x;
+               POSITION y = 0, x = 0;
                int count;
 
                for (count = 0; count <= 20; count++)
                {
                        int dy, dx, d;
 
-                       x = px - 8 + randint0(17);
-                       y = py - 8 + randint0(17);
+                       x = p_ptr->x - 8 + randint0(17);
+                       y = p_ptr->y - 8 + randint0(17);
 
-                       dx = (px > x) ? (px - x) : (x - px);
-                       dy = (py > y) ? (py - y) : (y - py);
+                       dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
+                       dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
 
                        /* Approximate distance */
                        d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
 
                        if (d >= 9) continue;
 
-                       if (!in_bounds(y, x) || !projectable(py, px, y, x)
+                       if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
                            || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
 
                        /* Valid position */
@@ -819,7 +815,7 @@ static void cast_meteor(int dam, int rad)
  * @param rad 効力の半径
  * @return ターゲットを指定し、実行したならばTRUEを返す。
  */
-static bool cast_wrath_of_the_god(int dam, int rad)
+static bool cast_wrath_of_the_god(HIT_POINT dam, int rad)
 {
        int x, y, tx, ty;
        int nx, ny;
@@ -829,8 +825,8 @@ static bool cast_wrath_of_the_god(int dam, int rad)
        if (!get_aim_dir(&dir)) return FALSE;
 
        /* Use the given direction */
-       tx = px + 99 * ddx[dir];
-       ty = py + 99 * ddy[dir];
+       tx = p_ptr->x + 99 * ddx[dir];
+       ty = p_ptr->y + 99 * ddy[dir];
 
        /* Hack -- Use an actual "target" */
        if ((dir == 5) && target_okay())
@@ -839,8 +835,8 @@ static bool cast_wrath_of_the_god(int dam, int rad)
                ty = target_row;
        }
 
-       x = px;
-       y = py;
+       x = p_ptr->x;
+       y = p_ptr->y;
 
        while (1)
        {
@@ -849,10 +845,10 @@ static bool cast_wrath_of_the_god(int dam, int rad)
 
                ny = y;
                nx = x;
-               mmove2(&ny, &nx, py, px, ty, tx);
+               mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
 
                /* Stop at maximum range */
-               if (MAX_RANGE <= distance(py, px, ny, nx)) break;
+               if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
 
                /* Stopped by walls/doors */
                if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
@@ -925,8 +921,8 @@ static bool item_tester_offer(object_type *o_ptr)
  */
 static bool cast_summon_greater_demon(void)
 {
-       int plev = p_ptr->lev;
-       int item;
+       PLAYER_LEVEL plev = p_ptr->lev;
+       OBJECT_IDX item;
        cptr q, s;
        int summon_lev;
        object_type *o_ptr;
@@ -950,7 +946,7 @@ static bool cast_summon_greater_demon(void)
 
        summon_lev = plev * 2 / 3 + r_info[o_ptr->pval].level;
 
-       if (summon_specific(-1, py, px, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET)))
+       if (summon_specific(-1, p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET)))
        {
                msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
                msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
@@ -985,13 +981,13 @@ static bool cast_summon_greater_demon(void)
  * @param song 魔法効果のID
  * @return なし
  */
-static void start_singing(int spell, int song)
+static void start_singing(SPELL_IDX spell, MAGIC_NUM1 song)
 {
        /* Remember the song index */
-       p_ptr->magic_num1[0] = song;
+       SINGING_SONG_EFFECT(p_ptr) = (MAGIC_NUM1)song;
 
        /* Remember the index of the spell which activated the song */
-       p_ptr->magic_num2[0] = spell;
+       SINGING_SONG_ID(p_ptr) = (MAGIC_NUM2)spell;
 
 
        /* Now the player is singing */
@@ -1014,24 +1010,24 @@ void stop_singing(void)
        if (p_ptr->pclass != CLASS_BARD) return;
 
        /* Are there interupted song? */
-       if (p_ptr->magic_num1[1])
+       if (INTERUPTING_SONG_EFFECT(p_ptr))
        {
                /* Forget interupted song */
-               p_ptr->magic_num1[1] = 0;
+               INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
                return;
        }
 
        /* The player is singing? */
-       if (!p_ptr->magic_num1[0]) return;
+       if (!SINGING_SONG_EFFECT(p_ptr)) return;
 
        /* Hack -- if called from set_action(), avoid recursive loop */
        if (p_ptr->action == ACTION_SING) set_action(ACTION_NONE);
 
        /* Message text of each song or etc. */
-       do_spell(REALM_MUSIC, p_ptr->magic_num2[0], SPELL_STOP);
+       do_spell(REALM_MUSIC, SINGING_SONG_ID(p_ptr), SPELL_STOP);
 
-       p_ptr->magic_num1[0] = MUSIC_NONE;
-       p_ptr->magic_num2[0] = 0;
+       SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
+       SINGING_SONG_ID(p_ptr) = 0;
 
        /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
@@ -1047,7 +1043,7 @@ void stop_singing(void)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_life_spell(int spell, int mode)
+static cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -1207,7 +1203,7 @@ static cptr do_life_spell(int spell, int mode)
                        if (cast)
                        {
                                if (!get_aim_dir(&dir)) return NULL;
-                               fire_ball_hide(GF_WOUNDS, dir, damroll(sides, dice), 0);
+                               fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
                        }
                }
                break;
@@ -1546,13 +1542,13 @@ static cptr do_life_spell(int spell, int mode)
                if (desc) return _("一定時間、あらゆる耐性を付け、ACと魔法防御能力を上昇させる。", "Gives ultimate resistance, bonus to AC and speed.");
     
                {
-                       int base = plev / 2;
+                       TIME_EFFECT base = (TIME_EFFECT)plev / 2;
 
                        if (info) return info_duration(base, base);
 
                        if (cast)
                        {
-                               int v = randint1(base) + base;
+                               TIME_EFFECT v = randint1(base) + base;
                                set_fast(v, FALSE);
                                set_oppose_acid(v, FALSE);
                                set_oppose_elec(v, FALSE);
@@ -1574,7 +1570,7 @@ static cptr do_life_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_sorcery_spell(int spell, int mode)
+static cptr do_sorcery_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -1607,7 +1603,7 @@ static cptr do_sorcery_spell(int spell, int mode)
                if (desc) return _("近距離のテレポートをする。", "Teleport short distance.");
     
                {
-                       int range = 10;
+                       POSITION range = 10;
 
                        if (info) return info_range(range);
 
@@ -1677,7 +1673,7 @@ static cptr do_sorcery_spell(int spell, int mode)
                if (desc) return _("遠距離のテレポートをする。", "Teleport long distance.");
     
                {
-                       int range = plev * 5;
+                       POSITION range = plev * 5;
 
                        if (info) return info_range(range);
 
@@ -1962,7 +1958,7 @@ static cptr do_sorcery_spell(int spell, int mode)
                if (desc) return _("短距離内の指定した場所にテレポートする。", "Teleport to given location.");
     
                {
-                       int range = plev / 2 + 10;
+                       POSITION range = plev / 2 + 10;
 
                        if (info) return info_range(range);
 
@@ -2122,7 +2118,7 @@ static cptr do_sorcery_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_nature_spell(int spell, int mode)
+static cptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -2160,7 +2156,7 @@ static cptr do_nature_spell(int spell, int mode)
                {
                        int dice = 3 + (plev - 1) / 5;
                        int sides = 4;
-                       int range = plev / 6 + 2;
+                       POSITION range = plev / 6 + 2;
 
                        if (info) return format("%s%dd%d %s%d", s_dam, dice, sides, s_rng, range);
 
@@ -2207,7 +2203,7 @@ static cptr do_nature_spell(int spell, int mode)
                                object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
 
                                /* Drop the object from heaven */
-                               drop_near(q_ptr, -1, py, px);
+                               drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
                        }
                }
                break;
@@ -2412,7 +2408,7 @@ static cptr do_nature_spell(int spell, int mode)
                {
                        if (cast)
                        {
-                               if (!(summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET))))
+                               if (!(summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET))))
                                {
                                        msg_print(_("動物は現れなかった。", "No animals arrive."));
                                }
@@ -2566,7 +2562,7 @@ static cptr do_nature_spell(int spell, int mode)
 
                        if (cast)
                        {
-                               earthquake(py, px, rad);
+                               earthquake(p_ptr->y, p_ptr->x, rad);
                        }
                }
                break;
@@ -2584,8 +2580,8 @@ static cptr do_nature_spell(int spell, int mode)
 
                                for (dir = 0; dir < 8; dir++)
                                {
-                                       y = py + ddy_ddd[dir];
-                                       x = px + ddx_ddd[dir];
+                                       y = p_ptr->y + ddy_ddd[dir];
+                                       x = p_ptr->x + ddx_ddd[dir];
                                        c_ptr = &cave[y][x];
 
                                        /* Get the monster */
@@ -2604,7 +2600,7 @@ static cptr do_nature_spell(int spell, int mode)
                if (desc) return _("巨大な冷気の球を放つ。", "Fires a huge ball of cold.");
     
                {
-                       int dam = 70 + plev * 3 / 2;
+                       HIT_POINT dam = 70 + plev * 3 / 2;
                        int rad = plev / 12 + 1;
 
                        if (info) return info_damage(0, 0, dam);
@@ -2623,7 +2619,7 @@ static cptr do_nature_spell(int spell, int mode)
                if (desc) return _("巨大な電撃の球を放つ。", "Fires a huge electric ball.");
     
                {
-                       int dam = 90 + plev * 3 / 2;
+                       HIT_POINT dam = 90 + plev * 3 / 2;
                        int rad = plev / 12 + 1;
 
                        if (info) return info_damage(0, 0, dam);
@@ -2642,7 +2638,7 @@ static cptr do_nature_spell(int spell, int mode)
                if (desc) return _("巨大な水の球を放つ。", "Fires a huge ball of water.");
     
                {
-                       int dam = 100 + plev * 3 / 2;
+                       HIT_POINT dam = 100 + plev * 3 / 2;
                        int rad = plev / 12 + 1;
 
                        if (info) return info_damage(0, 0, dam);
@@ -2661,7 +2657,7 @@ static cptr do_nature_spell(int spell, int mode)
                        "Generates ball of light centered on you. Maps and lights whole dungeon level. Knows all objects location.");
     
                {
-                       int dam = 150;
+                       HIT_POINT dam = 150;
                        int rad = 8;
 
                        if (info) return info_damage(0, 0, dam/2);
@@ -2710,8 +2706,8 @@ static cptr do_nature_spell(int spell, int mode)
                        if (cast)
                        {
                                dispel_monsters(d_dam);
-                               earthquake(py, px, q_rad);
-                               project(0, b_rad, py, px, b_dam, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
+                               earthquake(p_ptr->y, p_ptr->x, q_rad);
+                               project(0, b_rad, p_ptr->y, p_ptr->x, b_dam, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
                        }
                }
                break;
@@ -2727,7 +2723,7 @@ static cptr do_nature_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_chaos_spell(int spell, int mode)
+static cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -2891,7 +2887,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("遠距離のテレポートをする。", "Teleport long distance.");
     
                {
-                       int range = plev * 5;
+                       POSITION range = plev * 5;
 
                        if (info) return info_range(range);
 
@@ -2943,7 +2939,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("自分を中心とした轟音の球を発生させる。", "Generates a ball of sound centered on you.");
     
                {
-                       int dam = 60 + plev;
+                       HIT_POINT dam = 60 + plev;
                        int rad = plev / 10 + 2;
 
                        if (info) return info_damage(0, 0, dam/2);
@@ -2951,7 +2947,7 @@ static cptr do_chaos_spell(int spell, int mode)
                        if (cast)
                        {
                                msg_print(_("ドーン!部屋が揺れた!", "BOOM! Shake the room!"));
-                               project(0, rad, py, px, dam, GF_SOUND, PROJECT_KILL | PROJECT_ITEM, -1);
+                               project(0, rad, p_ptr->y, p_ptr->x, dam, GF_SOUND, PROJECT_KILL | PROJECT_ITEM, -1);
                        }
                }
                break;
@@ -2980,7 +2976,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("炎の球を放つ。", "Fires a ball of fire.");
     
                {
-                       int dam = plev + 55;
+                       HIT_POINT dam = plev + 55;
                        int rad = 2;
 
                        if (info) return info_damage(0, 0, dam);
@@ -3022,7 +3018,7 @@ static cptr do_chaos_spell(int spell, int mode)
 
                        if (cast)
                        {
-                               destroy_area(py, px, base + randint1(sides), FALSE);
+                               destroy_area(p_ptr->y, p_ptr->x, base + randint1(sides), FALSE);
                        }
                }
                break;
@@ -3032,7 +3028,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("巨大なカオスの球を放つ。", "Fires a huge ball of chaos.");
     
                {
-                       int dam = plev * 2 + 99;
+                       HIT_POINT dam = plev * 2 + 99;
                        int rad = plev / 5;
 
                        if (info) return info_damage(0, 0, dam);
@@ -3103,7 +3099,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("巨大な分解の球を放つ。", "Fires a huge ball of disintegration.");
     
                {
-                       int dam = plev + 70;
+                       HIT_POINT dam = plev + 70;
                        int rad = 3 + plev / 40;
 
                        if (info) return info_damage(0, 0, dam);
@@ -3139,7 +3135,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("ロケットを発射する。", "Fires a magic rocket.");
     
                {
-                       int dam = 120 + plev * 2;
+                       HIT_POINT dam = 120 + plev * 2;
                        int rad = 2;
 
                        if (info) return info_damage(0, 0, dam);
@@ -3173,14 +3169,14 @@ static cptr do_chaos_spell(int spell, int mode)
                {
                        if (cast)
                        {
-                               u32b mode = 0L;
+                               u32b flg = 0L;
                                bool pet = !one_in_(3);
 
-                               if (pet) mode |= PM_FORCE_PET;
-                               else mode |= PM_NO_PET;
-                               if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
+                               if (pet) flg |= PM_FORCE_PET;
+                               else flg |= PM_NO_PET;
+                               if (!(pet && (plev < 50))) flg |= PM_ALLOW_GROUP;
 
-                               if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, SUMMON_DEMON, mode))
+                               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_DEMON, flg))
                                {
                                        msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
                                        if (pet)
@@ -3221,7 +3217,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("自分の周辺に隕石を落とす。", "Makes meteor balls fall down to nearby random locations.");
     
                {
-                       int dam = plev * 2;
+                       HIT_POINT dam = plev * 2;
                        int rad = 2;
 
                        if (info) return info_multi_damage(dam);
@@ -3238,7 +3234,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("自分を中心とした超巨大な炎の球を発生させる。", "Generate a huge ball of fire centered on you.");
     
                {
-                       int dam = 300 + 3 * plev;
+                       HIT_POINT dam = 300 + 3 * plev;
                        int rad = 8;
 
                        if (info) return info_damage(0, 0, dam/2);
@@ -3282,7 +3278,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("非常に強力で巨大な純粋な魔力の球を放つ。", "Fires an extremely powerful huge ball of pure mana.");
     
                {
-                       int dam = 300 + plev * 4;
+                       HIT_POINT dam = 300 + plev * 4;
                        int rad = 4;
 
                        if (info) return info_damage(0, 0, dam);
@@ -3301,7 +3297,7 @@ static cptr do_chaos_spell(int spell, int mode)
                if (desc) return _("非常に強力なカオスの球を放つ。", "Fires an extremely powerful ball of chaos.");
     
                {
-                       int dam = p_ptr->chp;
+                       HIT_POINT dam = p_ptr->chp;
                        int rad = 2;
 
                        if (info) return info_damage(0, 0, dam);
@@ -3340,7 +3336,7 @@ static cptr do_chaos_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_death_spell(int spell, int mode)
+static cptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -3436,7 +3432,7 @@ static cptr do_death_spell(int spell, int mode)
                if (desc) return _("毒の球を放つ。", "Fires a ball of poison.");
     
                {
-                       int dam = 10 + plev / 2;
+                       HIT_POINT dam = 10 + plev / 2;
                        int rad = 2;
 
                        if (info) return info_damage(0, 0, dam);
@@ -3524,8 +3520,8 @@ static cptr do_death_spell(int spell, int mode)
 
        case 8:
                if (name) return _("エントロピーの球", "Orb of Entropy");
-               if (desc) return _("ç\94\9få\91½ã\81®ã\81\82ã\82\8bè\80\85ã\81«å\8a¹æ\9e\9cã\81®ã\81\82ã\82\8bç\90\83ã\82\92æ\94¾ã\81¤ã\80\82", "Fires a ball which damages living monsters.");
-    
+               if (desc) return _("ç\94\9få\91½ã\81®ã\81\82ã\82\8bè\80\85ã\81®HPã\81¨æ\9c\80大HPå\8f\8cæ\96¹ã\81«ã\83\80ã\83¡ã\83¼ã\82¸ã\82\92ä¸\8eã\81\88ã\82\8bå\8a¹æ\9e\9cã\81®ã\81\82ã\82\8bç\90\83ã\82\92æ\94¾ã\81¤ã\80\82", "Fires a ball which damages to both HP and MaxHP of living monsters.");
+
                {
                        int dice = 3;
                        int sides = 6;
@@ -3546,7 +3542,7 @@ static cptr do_death_spell(int spell, int mode)
                        {
                                if (!get_aim_dir(&dir)) return NULL;
 
-                               fire_ball(GF_OLD_DRAIN, dir, damroll(dice, dice) + base, rad);
+                               fire_ball(GF_HYPODYNAMIA, dir, damroll(dice, sides) + base, rad);
                        }
                }
                break;
@@ -3575,14 +3571,14 @@ static cptr do_death_spell(int spell, int mode)
                if (desc) return _("自分を中心とした毒の球を発生させる。", "Generate a ball of poison centered on you.");
     
                {
-                       int dam = (30 + plev) * 2;
+                       HIT_POINT dam = (30 + plev) * 2;
                        int rad = plev / 10 + 2;
 
                        if (info) return info_damage(0, 0, dam/2);
 
                        if (cast)
                        {
-                               project(0, rad, py, px, dam, GF_POIS, PROJECT_KILL | PROJECT_ITEM, -1);
+                               project(0, rad, p_ptr->y, p_ptr->x, dam, GF_POIS, PROJECT_KILL | PROJECT_ITEM, -1);
                        }
                }
                break;
@@ -3618,9 +3614,9 @@ static cptr do_death_spell(int spell, int mode)
                break;
 
        case 13:
-               if (name) return _("å\90¸è¡\80ã\83\89ã\83¬ã\82¤ã\83³", "Vampiric Drain");
-               if (desc) return _("モンスター1体から生命力を吸いとる。吸いとった生命力によって満腹度が上がる。", 
-                       "Absorbs some HP from a monster and gives them to you. You will also gain nutritional sustenance from this.");
+               if (name) return _("å\90¸è¡\80ã\81®ç\9f¢", "Vampiric Bolt");
+               if (desc) return _("ã\83\9cã\83«ã\83\88ã\81«ã\82\88ã\82\8aã\83¢ã\83³ã\82¹ã\82¿ã\83¼1ä½\93ã\81\8bã\82\89ç\94\9få\91½å\8a\9bã\82\92å\90¸ã\81\84ã\81¨ã\82\8bã\80\82å\90¸ã\81\84ã\81¨ã\81£ã\81\9fç\94\9få\91½å\8a\9bã\81«ã\82\88ã\81£ã\81¦æº\80è\85¹åº¦ã\81\8cä¸\8aã\81\8cã\82\8bã\80\82", 
+                       "Absorbs some HP from a monster and gives them to you by bolt. You will also gain nutritional sustenance from this.");
     
                {
                        int dice = 1;
@@ -3631,11 +3627,11 @@ static cptr do_death_spell(int spell, int mode)
 
                        if (cast)
                        {
-                               int dam = base + damroll(dice, sides);
+                               HIT_POINT dam = base + damroll(dice, sides);
 
                                if (!get_aim_dir(&dir)) return NULL;
 
-                               if (drain_life(dir, dam))
+                               if (hypodynamic_bolt(dir, dam))
                                {
                                        chg_virtue(V_SACRIFICE, -1);
                                        chg_virtue(V_VITALITY, -1);
@@ -3670,7 +3666,7 @@ static cptr do_death_spell(int spell, int mode)
                {
                        if (cast)
                        {
-                               animate_dead(0, py, px);
+                               animate_dead(0, p_ptr->y, p_ptr->x);
                        }
                }
                break;
@@ -3780,12 +3776,11 @@ static cptr do_death_spell(int spell, int mode)
                break;
 
        case 21:
-               if (name) return _("真・吸血", "Vampirism True");
-               if (desc) return _("モンスター1体から生命力を吸いとる。吸いとった生命力によって体力が回復する。", 
+               if (name) return _("吸血の連矢", "Vampiric Bolts");
+               if (desc) return _("3連射のボルトによりモンスター1体から生命力を吸いとる。吸いとった生命力によって体力が回復する。", 
                        "Fires 3 bolts. Each of the bolts absorbs some HP from a monster and gives them to you.");
-    
                {
-                       int dam = 100;
+                       HIT_POINT dam = 100;
 
                        if (info) return format("%s3*%d", s_dam, dam);
 
@@ -3800,7 +3795,7 @@ static cptr do_death_spell(int spell, int mode)
 
                                for (i = 0; i < 3; i++)
                                {
-                                       if (drain_life(dir, dam))
+                                       if (hypodynamic_bolt(dir, dam))
                                                hp_player(dam);
                                }
                        }
@@ -3828,7 +3823,7 @@ static cptr do_death_spell(int spell, int mode)
                if (desc) return _("巨大な暗黒の球を放つ。", "Fires a huge ball of darkness.");
     
                {
-                       int dam = 100 + plev * 2;
+                       HIT_POINT dam = 100 + plev * 2;
                        int rad = 4;
 
                        if (info) return info_damage(0, 0, dam);
@@ -3865,17 +3860,17 @@ static cptr do_death_spell(int spell, int mode)
                        {
                                int type;
                                bool pet = one_in_(3);
-                               u32b mode = 0L;
+                               u32b flg = 0L;
 
                                type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
 
                                if (!pet || (pet && (plev > 24) && one_in_(3)))
-                                       mode |= PM_ALLOW_GROUP;
+                                       flg |= PM_ALLOW_GROUP;
 
-                               if (pet) mode |= PM_FORCE_PET;
-                               else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
+                               if (pet) flg |= PM_FORCE_PET;
+                               else flg |= (PM_ALLOW_UNIQUE | PM_NO_PET);
 
-                               if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, type, mode))
+                               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, type, flg))
                                {
                                        msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
                                                                "Cold winds begin to blow around you, carrying with them the stench of decay..."));
@@ -3970,7 +3965,7 @@ static cptr do_death_spell(int spell, int mode)
                        "Fires a powerful ball of evil power. Hurts good monsters greatly.");
     
                {
-                       int dam = 666;
+                       HIT_POINT dam = 666;
                        int rad = 3;
 
                        if (info) return info_damage(0, 0, dam);
@@ -4013,7 +4008,7 @@ static cptr do_death_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_trump_spell(int spell, int mode)
+static cptr do_trump_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -4032,7 +4027,7 @@ static cptr do_trump_spell(int spell, int mode)
                if (desc) return _("近距離のテレポートをする。", "Teleport short distance.");
     
                {
-                       int range = 10;
+                       POSITION range = 10;
 
                        if (info) return info_range(range);
 
@@ -4051,7 +4046,7 @@ static cptr do_trump_spell(int spell, int mode)
                        if (cast || fail)
                        {
                                msg_print(_("あなたは蜘蛛のカードに集中する...", "You concentrate on the trump of an spider..."));
-                               if (trump_summoning(1, !fail, py, px, 0, SUMMON_SPIDER, PM_ALLOW_GROUP))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_SPIDER, PM_ALLOW_GROUP))
                                {
                                        if (fail)
                                        {
@@ -4093,7 +4088,7 @@ static cptr do_trump_spell(int spell, int mode)
                if (desc) return _("遠距離のテレポートをする。", "Teleport long distance.");
     
                {
-                       int range = plev * 4;
+                       POSITION range = plev * 4;
 
                        if (info) return info_range(range);
 
@@ -4148,7 +4143,7 @@ static cptr do_trump_spell(int spell, int mode)
                        {
                                int type = (!fail ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL);
                                msg_print(_("あなたは動物のカードに集中する...", "You concentrate on the trump of an animal..."));
-                               if (trump_summoning(1, !fail, py, px, 0, type, 0L))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, type, 0L))
                                {
                                        if (fail)
                                        {
@@ -4196,8 +4191,8 @@ static cptr do_trump_spell(int spell, int mode)
                                else
                                {
                                        /* Summons near player when failed */
-                                       x = px;
-                                       y = py;
+                                       x = p_ptr->x;
+                                       y = p_ptr->y;
                                }
 
                                if (p_ptr->pclass == CLASS_BEASTMASTER)
@@ -4227,7 +4222,7 @@ static cptr do_trump_spell(int spell, int mode)
                        {
                                int summon_lev = plev * 2 / 3 + randint1(plev / 2);
 
-                               if (trump_summoning(1, !fail, py, px, (summon_lev * 3 / 2), SUMMON_PHANTOM, 0L))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, (summon_lev * 3 / 2), SUMMON_PHANTOM, 0L))
                                {
                                        msg_print(_("御用でございますか、御主人様?", "'Your wish, master?'"));
                                }
@@ -4278,7 +4273,7 @@ static cptr do_trump_spell(int spell, int mode)
                if (desc) return _("短距離内の指定した場所にテレポートする。", "Teleport to given location.");
     
                {
-                       int range = plev / 2 + 10;
+                       POSITION range = plev / 2 + 10;
 
                        if (info) return info_range(range);
 
@@ -4356,7 +4351,7 @@ static cptr do_trump_spell(int spell, int mode)
                        if (cast || fail)
                        {
                                msg_print(_("あなたはアンデッドのカードに集中する...", "You concentrate on the trump of an undead creature..."));
-                               if (trump_summoning(1, !fail, py, px, 0, SUMMON_UNDEAD, 0L))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_UNDEAD, 0L))
                                {
                                        if (fail)
                                        {
@@ -4375,7 +4370,7 @@ static cptr do_trump_spell(int spell, int mode)
                        if (cast || fail)
                        {
                                msg_print(_("あなたは爬虫類のカードに集中する...", "You concentrate on the trump of a reptile..."));
-                               if (trump_summoning(1, !fail, py, px, 0, SUMMON_HYDRA, 0L))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HYDRA, 0L))
                                {
                                        if (fail)
                                        {
@@ -4400,7 +4395,7 @@ static cptr do_trump_spell(int spell, int mode)
                                else
                                        type = 0;
 
-                               if (trump_summoning((1 + (plev - 15)/ 10), !fail, py, px, 0, type, 0L))
+                               if (trump_summoning((1 + (plev - 15)/ 10), !fail, p_ptr->y, p_ptr->x, 0, type, 0L))
                                {
                                        if (fail)
                                        {
@@ -4420,7 +4415,7 @@ static cptr do_trump_spell(int spell, int mode)
                        if (cast || fail)
                        {
                                msg_print(_("あなたはハウンドのカードに集中する...", "You concentrate on the trump of a hound..."));
-                               if (trump_summoning(1, !fail, py, px, 0, SUMMON_HOUND, PM_ALLOW_GROUP))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HOUND, PM_ALLOW_GROUP))
                                {
                                        if (fail)
                                        {
@@ -4477,7 +4472,7 @@ static cptr do_trump_spell(int spell, int mode)
                        if (cast || fail)
                        {
                                msg_print(_("あなたはサイバーデーモンのカードに集中する...", "You concentrate on the trump of a Cyberdemon..."));
-                               if (trump_summoning(1, !fail, py, px, 0, SUMMON_CYBER, 0L))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_CYBER, 0L))
                                {
                                        if (fail)
                                        {
@@ -4554,7 +4549,7 @@ static cptr do_trump_spell(int spell, int mode)
                        if (cast || fail)
                        {
                                msg_print(_("あなたはドラゴンのカードに集中する...", "You concentrate on the trump of a dragon..."));
-                               if (trump_summoning(1, !fail, py, px, 0, SUMMON_DRAGON, 0L))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_DRAGON, 0L))
                                {
                                        if (fail)
                                        {
@@ -4570,7 +4565,7 @@ static cptr do_trump_spell(int spell, int mode)
                if (desc) return _("自分の周辺に隕石を落とす。", "Makes meteor balls fall down to nearby random locations.");
     
                {
-                       int dam = plev * 2;
+                       HIT_POINT dam = plev * 2;
                        int rad = 2;
 
                        if (info) return info_multi_damage(dam);
@@ -4590,7 +4585,7 @@ static cptr do_trump_spell(int spell, int mode)
                        if (cast || fail)
                        {
                                msg_print(_("あなたはデーモンのカードに集中する...", "You concentrate on the trump of a demon..."));
-                               if (trump_summoning(1, !fail, py, px, 0, SUMMON_DEMON, 0L))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_DEMON, 0L))
                                {
                                        if (fail)
                                        {
@@ -4610,7 +4605,7 @@ static cptr do_trump_spell(int spell, int mode)
                        {
                                msg_print(_("あなたは強力なアンデッドのカードに集中する...", "You concentrate on the trump of a greater undead being..."));
                                /* May allow unique depend on level and dice roll */
-                               if (trump_summoning(1, !fail, py, px, 0, SUMMON_HI_UNDEAD, PM_ALLOW_UNIQUE))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HI_UNDEAD, PM_ALLOW_UNIQUE))
                                {
                                        if (fail)
                                        {
@@ -4637,7 +4632,7 @@ static cptr do_trump_spell(int spell, int mode)
 
                                msg_print(_("あなたは古代ドラゴンのカードに集中する...", "You concentrate on the trump of an ancient dragon..."));
                                /* May allow unique depend on level and dice roll */
-                               if (trump_summoning(1, !fail, py, px, 0, type, PM_ALLOW_UNIQUE))
+                               if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, type, PM_ALLOW_UNIQUE))
                                {
                                        if (fail)
                                        {
@@ -4659,7 +4654,7 @@ static cptr do_trump_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_arcane_spell(int spell, int mode)
+static cptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -4741,7 +4736,7 @@ static cptr do_arcane_spell(int spell, int mode)
                if (desc) return _("近距離のテレポートをする。", "Teleport short distance.");
     
                {
-                       int range = 10;
+                       POSITION range = 10;
 
                        if (info) return info_range(range);
 
@@ -4983,7 +4978,7 @@ static cptr do_arcane_spell(int spell, int mode)
                if (desc) return _("遠距離のテレポートをする。", "Teleport long distance.");
     
                {
-                       int range = plev * 5;
+                       POSITION range = plev * 5;
 
                        if (info) return info_range(range);
 
@@ -5081,7 +5076,7 @@ static cptr do_arcane_spell(int spell, int mode)
                {
                        if (cast)
                        {
-                               if (!summon_specific(-1, py, px, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET)))
+                               if (!summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET)))
                                {
                                        msg_print(_("エレメンタルは現れなかった。", "No Elementals arrive."));
                                }
@@ -5125,7 +5120,7 @@ static cptr do_arcane_spell(int spell, int mode)
                if (desc) return _("炎、電撃、冷気、酸のどれかの球を放つ。", "Fires a ball of some elements.");
     
                {
-                       int dam = 75 + plev;
+                       HIT_POINT dam = 75 + plev;
                        int rad = 2;
 
                        if (info) return info_damage(0, 0, dam);
@@ -5220,7 +5215,7 @@ static cptr do_arcane_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_craft_spell(int spell, int mode)
+static cptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -5596,7 +5591,7 @@ static cptr do_craft_spell(int spell, int mode)
                {
                        if (cast)
                        {
-                               if (summon_specific(-1, py, px, plev, SUMMON_GOLEM, PM_FORCE_PET))
+                               if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_GOLEM, PM_FORCE_PET))
                                {
                                        msg_print(_("ゴーレムを作った。", "You make a golem."));
                                }
@@ -5753,7 +5748,7 @@ static cptr do_craft_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_daemon_spell(int spell, int mode)
+static cptr do_daemon_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -5879,7 +5874,7 @@ static cptr do_daemon_spell(int spell, int mode)
                {
                        if (cast)
                        {
-                               if (!summon_specific(-1, py, px, (plev * 3) / 2, SUMMON_MANES, (PM_ALLOW_GROUP | PM_FORCE_PET)))
+                               if (!summon_specific(-1, p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_MANES, (PM_ALLOW_GROUP | PM_FORCE_PET)))
                                {
                                        msg_print(_("古代の死霊は現れなかった。", "No Manes arrive."));
                                }
@@ -5991,7 +5986,7 @@ static cptr do_daemon_spell(int spell, int mode)
                if (desc) return _("炎の球を放つ。", "Fires a ball of fire.");
     
                {
-                       int dam = plev + 55;
+                       HIT_POINT dam = plev + 55;
                        int rad = 2;
 
                        if (info) return info_damage(0, 0, dam);
@@ -6022,7 +6017,7 @@ static cptr do_daemon_spell(int spell, int mode)
                if (desc) return _("大きな地獄の球を放つ。", "Fires a huge ball of nether.");
     
                {
-                       int dam = plev * 3 / 2 + 100;
+                       HIT_POINT dam = plev * 3 / 2 + 100;
                        int rad = plev / 20 + 2;
 
                        if (info) return info_damage(0, 0, dam);
@@ -6044,13 +6039,13 @@ static cptr do_daemon_spell(int spell, int mode)
                        if (cast)
                        {
                                bool pet = !one_in_(3);
-                               u32b mode = 0L;
+                               u32b flg = 0L;
 
-                               if (pet) mode |= PM_FORCE_PET;
-                               else mode |= PM_NO_PET;
-                               if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
+                               if (pet) flg |= PM_FORCE_PET;
+                               else flg |= PM_NO_PET;
+                               if (!(pet && (plev < 50))) flg |= PM_ALLOW_GROUP;
 
-                               if (summon_specific((pet ? -1 : 0), py, px, plev*2/3+randint1(plev/2), SUMMON_DEMON, mode))
+                               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, plev*2/3+randint1(plev/2), SUMMON_DEMON, flg))
                                {
                                        msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
 
@@ -6085,7 +6080,7 @@ static cptr do_daemon_spell(int spell, int mode)
 
                        if (cast)
                        {
-                               set_tim_esp(randint1(base) + sides, FALSE);
+                               set_tim_esp(randint1(sides) + base, FALSE);
                        }
                }
                break;
@@ -6096,13 +6091,13 @@ static cptr do_daemon_spell(int spell, int mode)
                        "Removes fear. Gives resistance to fire and cold, and aura of fire. These resistances can be added to which from equipment for more powerful resistances.");
     
                {
-                       int base = 20;
+                       TIME_EFFECT base = 20;
 
                        if (info) return info_duration(base, base);
 
                        if (cast)
                        {
-                               int dur = randint1(base) + base;
+                               TIME_EFFECT dur = randint1(base) + base;
                                        
                                set_oppose_fire(dur, FALSE);
                                set_oppose_cold(dur, FALSE);
@@ -6119,7 +6114,7 @@ static cptr do_daemon_spell(int spell, int mode)
                        "Generates a ball of fire centered on you which transforms floors to magma.");
     
                {
-                       int dam = (55 + plev) * 2;
+                       HIT_POINT dam = (55 + plev) * 2;
                        int rad = 3;
 
                        if (info) return info_damage(0, 0, dam/2);
@@ -6137,7 +6132,7 @@ static cptr do_daemon_spell(int spell, int mode)
                if (desc) return _("プラズマの球を放つ。", "Fires a ball of plasma.");
     
                {
-                       int dam = plev * 3 / 2 + 80;
+                       HIT_POINT dam = plev * 3 / 2 + 80;
                        int rad = 2 + plev / 40;
 
                        if (info) return info_damage(0, 0, dam);
@@ -6192,7 +6187,7 @@ static cptr do_daemon_spell(int spell, int mode)
                if (desc) return _("因果混乱の球を放つ。", "Fires a ball of nexus.");
     
                {
-                       int dam = 100 + plev * 2;
+                       HIT_POINT dam = 100 + plev * 2;
                        int rad = 4;
 
                        if (info) return info_damage(0, 0, dam);
@@ -6262,7 +6257,7 @@ static cptr do_daemon_spell(int spell, int mode)
                        "Generate balls of chaos, confusion and charm centered on you.");
     
                {
-                       int dam = 50 + plev;
+                       HIT_POINT dam = 50 + plev;
                        int power = 20 + plev;
                        int rad = 3 + plev / 20;
 
@@ -6307,7 +6302,7 @@ static cptr do_daemon_spell(int spell, int mode)
                if (desc) return _("超巨大な地獄の球を放つ。", "Generate a huge ball of nether.");
     
                {
-                       int dam = plev * 15;
+                       HIT_POINT dam = plev * 15;
                        int rad = plev / 5;
 
                        if (info) return info_damage(0, 0, dam);
@@ -6327,7 +6322,7 @@ static cptr do_daemon_spell(int spell, int mode)
                        "Puts blood curse which damages and causes various effects on a monster. You also take damage.");
     
                {
-                       int dam = 600;
+                       HIT_POINT dam = 600;
                        int rad = 0;
 
                        if (info) return info_damage(0, 0, dam);
@@ -6369,7 +6364,7 @@ static cptr do_daemon_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_crusade_spell(int spell, int mode)
+static cptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -6467,7 +6462,7 @@ static cptr do_crusade_spell(int spell, int mode)
                if (desc) return _("中距離のテレポートをする。", "Teleport medium distance.");
     
                {
-                       int range = 25 + plev / 2;
+                       POSITION range = 25 + plev / 2;
 
                        if (info) return info_range(range);
 
@@ -6620,7 +6615,7 @@ static cptr do_crusade_spell(int spell, int mode)
 
                        if (cast)
                        {
-                               set_protevil(randint1(sides) + sides, FALSE);
+                               set_protevil(randint1(sides) + base, FALSE);
                        }
                }
                break;
@@ -6630,7 +6625,7 @@ static cptr do_crusade_spell(int spell, int mode)
                if (desc) return _("強力な電撃のボルトを放つ。", "Fires a powerful bolt of lightning.");
     
                {
-                       int dam = plev * 5;
+                       HIT_POINT dam = plev * 5;
 
                        if (info) return info_damage(0, 0, dam);
 
@@ -6762,7 +6757,7 @@ static cptr do_crusade_spell(int spell, int mode)
                if (desc) return _("巨大な閃光の球を放つ。", "Fires a huge ball of powerful light.");
     
                {
-                       int dam = 100 + plev * 2;
+                       HIT_POINT dam = 100 + plev * 2;
                        int rad = 4;
 
                        if (info) return info_damage(0, 0, dam);
@@ -6784,13 +6779,13 @@ static cptr do_crusade_spell(int spell, int mode)
                        if (cast)
                        {
                                bool pet = !one_in_(3);
-                               u32b mode = 0L;
+                               u32b flg = 0L;
 
-                               if (pet) mode |= PM_FORCE_PET;
-                               else mode |= PM_NO_PET;
-                               if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
+                               if (pet) flg |= PM_FORCE_PET;
+                               else flg |= PM_NO_PET;
+                               if (!(pet && (plev < 50))) flg |= PM_ALLOW_GROUP;
 
-                               if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, SUMMON_ANGEL, mode))
+                               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_ANGEL, flg))
                                {
                                        if (pet)
                                        {
@@ -6868,7 +6863,7 @@ static cptr do_crusade_spell(int spell, int mode)
 
                        if (cast)
                        {
-                               destroy_area(py, px, base + randint1(sides), FALSE);
+                               destroy_area(p_ptr->y, p_ptr->x, base + randint1(sides), FALSE);
                        }
                }
                break;
@@ -6895,7 +6890,7 @@ static cptr do_crusade_spell(int spell, int mode)
                if (desc) return _("ターゲットの周囲に分解の球を多数落とす。", "Drops many balls of disintegration near the target.");
     
                {
-                       int dam = plev * 3 + 25;
+                       HIT_POINT dam = plev * 3 + 25;
                        int rad = 2;
 
                        if (info) return info_multi_damage(dam);
@@ -6921,7 +6916,7 @@ static cptr do_crusade_spell(int spell, int mode)
                        if (info) return format(_("回%d/損%d+%d", "h%d/dm%d+%d"), heal, d_dam, b_dam/2);
                        if (cast)
                        {
-                               project(0, 1, py, px, b_dam, GF_HOLY_FIRE, PROJECT_KILL, -1);
+                               project(0, 1, p_ptr->y, p_ptr->x, b_dam, GF_HOLY_FIRE, PROJECT_KILL, -1);
                                dispel_monsters(d_dam);
                                slow_monsters(plev);
                                stun_monsters(power);
@@ -6950,11 +6945,11 @@ static cptr do_crusade_spell(int spell, int mode)
                                for (i = 0; i < 12; i++)
                                {
                                        int attempt = 10;
-                                       int my, mx;
+                                       POSITION my = 0, mx = 0;
 
                                        while (attempt--)
                                        {
-                                               scatter(&my, &mx, py, px, 4, 0);
+                                               scatter(&my, &mx, p_ptr->y, p_ptr->x, 4, 0);
 
                                                /* Require empty grids */
                                                if (cave_empty_bold2(my, mx)) break;
@@ -6982,7 +6977,7 @@ static cptr do_crusade_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST / SPELL_FAIL / SPELL_CONT / SPELL_STOP)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST / SPELL_FAIL / SPELL_CONT / SPELL_STOP 時はNULL文字列を返す。
  */
-static cptr do_music_spell(int spell, int mode)
+static cptr do_music_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -7214,8 +7209,7 @@ static cptr do_music_spell(int spell, int mode)
                {
                        msg_print(_("静かな音楽が感覚を研ぎ澄まさせた...", "Your quiet music sharpens your sense of hearing..."));
                        /* Hack -- Initialize the turn count */
-                       p_ptr->magic_num1[2] = 0;
-
+                       SINGING_COUNT(p_ptr) = 0;
                        start_singing(spell, MUSIC_DETECT);
                }
 
@@ -7226,14 +7220,14 @@ static cptr do_music_spell(int spell, int mode)
 
                        if (cont)
                        {
-                               int count = p_ptr->magic_num1[2];
+                               int count = SINGING_COUNT(p_ptr);
 
                                if (count >= 19) wiz_lite(FALSE);
                                if (count >= 11)
                                {
                                        map_area(rad);
                                        if (plev > 39 && count < 19)
-                                               p_ptr->magic_num1[2] = count + 1;
+                                               SINGING_COUNT(p_ptr) = count + 1;
                                }
                                if (count >= 6)
                                {
@@ -7243,7 +7237,7 @@ static cptr do_music_spell(int spell, int mode)
                                        detect_objects_normal(rad);
 
                                        if (plev > 24 && count < 11)
-                                               p_ptr->magic_num1[2] = count + 1;
+                                               SINGING_COUNT(p_ptr) = count + 1;
                                }
                                if (count >= 3)
                                {
@@ -7251,14 +7245,14 @@ static cptr do_music_spell(int spell, int mode)
                                        detect_monsters_normal(rad);
 
                                        if (plev > 19 && count < 6)
-                                               p_ptr->magic_num1[2] = count + 1;
+                                               SINGING_COUNT(p_ptr) = count + 1;
                                }
                                detect_traps(rad, TRUE);
                                detect_doors(rad);
                                detect_stairs(rad);
 
                                if (plev > 14 && count < 3)
-                                       p_ptr->magic_num1[2] = count + 1;
+                                       SINGING_COUNT(p_ptr) = count + 1;
                        }
                }
 
@@ -7315,7 +7309,7 @@ static cptr do_music_spell(int spell, int mode)
                         */
                        if (cont || cast)
                        {
-                               project(0, rad, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
+                               project(0, rad, p_ptr->y, p_ptr->x, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
                        }
                }
 
@@ -7408,7 +7402,7 @@ static cptr do_music_spell(int spell, int mode)
                        if (cast)
                        {
                                msg_print(_("生命と復活のテーマを奏で始めた...", "The themes of life and revival are woven into your song..."));
-                               animate_dead(0, py, px);
+                               animate_dead(0, p_ptr->y, p_ptr->x);
                        }
                }
                break;
@@ -7460,7 +7454,7 @@ static cptr do_music_spell(int spell, int mode)
                         */
                        if (cont || cast)
                        {
-                               project(0, 0, py, px,
+                               project(0, 0, p_ptr->y, p_ptr->x,
                                        0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
                        }
                }
@@ -7549,7 +7543,7 @@ static cptr do_music_spell(int spell, int mode)
                        if (cast)
                        {
                                msg_print(_("歌が空間を歪めた...", "Reality whirls wildly as you sing a dizzying melody..."));
-                               project(0, rad, py, px, power, GF_AWAY_ALL, PROJECT_KILL, -1);
+                               project(0, rad, p_ptr->y, p_ptr->x, power, GF_AWAY_ALL, PROJECT_KILL, -1);
                        }
                }
                break;
@@ -7673,7 +7667,7 @@ static cptr do_music_spell(int spell, int mode)
 
                        if (cont)
                        {
-                               earthquake(py, px, 10);
+                               earthquake(p_ptr->y, p_ptr->x, 10);
                        }
                }
 
@@ -7899,7 +7893,7 @@ static cptr do_music_spell(int spell, int mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_hissatsu_spell(int spell, int mode)
+static cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -7942,22 +7936,22 @@ static cptr do_hissatsu_spell(int spell, int mode)
 
                        if (cdir == 8) return NULL;
 
-                       y = py + ddy_cdd[cdir];
-                       x = px + ddx_cdd[cdir];
+                       y = p_ptr->y + ddy_cdd[cdir];
+                       x = p_ptr->x + ddx_cdd[cdir];
                        if (cave[y][x].m_idx)
                                py_attack(y, x, 0);
                        else
                                msg_print(_("攻撃は空を切った。", "You attack the empty air."));
                        
-                       y = py + ddy_cdd[(cdir + 7) % 8];
-                       x = px + ddx_cdd[(cdir + 7) % 8];
+                       y = p_ptr->y + ddy_cdd[(cdir + 7) % 8];
+                       x = p_ptr->x + ddx_cdd[(cdir + 7) % 8];
                        if (cave[y][x].m_idx)
                                py_attack(y, x, 0);
                        else
                                msg_print(_("攻撃は空を切った。", "You attack the empty air."));
                        
-                       y = py + ddy_cdd[(cdir + 1) % 8];
-                       x = px + ddx_cdd[(cdir + 1) % 8];
+                       y = p_ptr->y + ddy_cdd[(cdir + 1) % 8];
+                       x = p_ptr->x + ddx_cdd[(cdir + 1) % 8];
                        if (cave[y][x].m_idx)
                                py_attack(y, x, 0);
                        else
@@ -7987,8 +7981,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_FIRE);
@@ -8021,8 +8015,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_MINEUCHI);
@@ -8058,7 +8052,7 @@ static cptr do_hissatsu_spell(int spell, int mode)
     
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
                        if (p_ptr->riding)
                        {
@@ -8069,8 +8063,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
        
                        if (dir == 5) return NULL;
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
        
                        if (!cave[y][x].m_idx)
                        {
@@ -8107,8 +8101,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_POISON);
@@ -8132,8 +8126,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_ZANMA);
@@ -8156,8 +8150,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, 0);
@@ -8173,9 +8167,9 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (cave[y][x].m_idx)
                        {
                                int i;
-                               int ty = y, tx = x;
-                               int oy = y, ox = x;
-                               int m_idx = cave[y][x].m_idx;
+                               POSITION ty = y, tx = x;
+                               POSITION oy = y, ox = x;
+                               MONSTER_IDX m_idx = cave[y][x].m_idx;
                                monster_type *m_ptr = &m_list[m_idx];
                                char m_name[80];
        
@@ -8240,8 +8234,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_HAGAN);
@@ -8268,8 +8262,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_COLD);
@@ -8293,8 +8287,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_KYUSHO);
@@ -8318,8 +8312,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_MAJIN);
@@ -8343,8 +8337,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_SUTEMI);
@@ -8369,8 +8363,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_ELEC);
@@ -8411,8 +8405,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
        
                        for (dir = 0; dir < 8; dir++)
                        {
-                               y = py + ddy_ddd[dir];
-                               x = px + ddx_ddd[dir];
+                               y = p_ptr->y + ddy_ddd[dir];
+                               x = p_ptr->x + ddx_ddd[dir];
                                c_ptr = &cave[y][x];
        
                                /* Get the monster */
@@ -8445,13 +8439,13 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_QUAKE);
                        else
-                               earthquake(py, px, 10);
+                               earthquake(p_ptr->y, p_ptr->x, 10);
                }
                break;
 
@@ -8522,14 +8516,14 @@ static cptr do_hissatsu_spell(int spell, int mode)
 
                        for (i = 0; i < 3; i++)
                        {
-                               int y, x;
-                               int ny, nx;
-                               int m_idx;
+                               POSITION y, x;
+                               POSITION ny, nx;
+                               MONSTER_IDX m_idx;
                                cave_type *c_ptr;
                                monster_type *m_ptr;
        
-                               y = py + ddy[dir];
-                               x = px + ddx[dir];
+                               y = p_ptr->y + ddy[dir];
+                               x = p_ptr->x + ddx[dir];
                                c_ptr = &cave[y][x];
        
                                if (c_ptr->m_idx)
@@ -8603,8 +8597,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_DRAIN);
@@ -8674,13 +8668,13 @@ static cptr do_hissatsu_spell(int spell, int mode)
     
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
                        if (!tgt_pt(&x, &y)) return NULL;
 
                        if (!cave_player_teleportable_bold(y, x, 0L) ||
-                           (distance(y, x, py, px) > MAX_SIGHT / 2) ||
-                           !projectable(py, px, y, x))
+                           (distance(y, x, p_ptr->y, p_ptr->x) > MAX_SIGHT / 2) ||
+                           !projectable(p_ptr->y, p_ptr->x, y, x))
                        {
                                msg_print(_("失敗!", "You cannot move to that place!"));
                                break;
@@ -8705,8 +8699,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
        
                        if (!get_rep_dir(&dir, FALSE)) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                        {
@@ -8739,8 +8733,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
                        {
@@ -8789,8 +8783,8 @@ static cptr do_hissatsu_spell(int spell, int mode)
                        if (!get_rep_dir2(&dir)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = py + ddy[dir];
-                       x = px + ddx[dir];
+                       y = p_ptr->y + ddy[dir];
+                       x = p_ptr->x + ddx[dir];
 
                        if (cave[y][x].m_idx)
                                py_attack(y, x, HISSATSU_UNDEAD);
@@ -8872,7 +8866,7 @@ static bool item_tester_hook_cursed(object_type *o_ptr)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST / SPELL_CONT / SPELL_STOP)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST / SPELL_CONT / SPELL_STOP 時はNULL文字列を返す。
  */
-static cptr do_hex_spell(int spell, int mode)
+static cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -8883,8 +8877,8 @@ static cptr do_hex_spell(int spell, int mode)
 
        bool add = TRUE;
 
-       int plev = p_ptr->lev;
-       int power;
+       PLAYER_LEVEL plev = p_ptr->lev;
+       HIT_POINT power;
 
        switch (spell)
        {
@@ -8961,7 +8955,7 @@ static cptr do_hex_spell(int spell, int mode)
                if (desc) return _("装備している武器を呪う。", "Curses your weapon.");
                if (cast)
                {
-                       int item;
+                       OBJECT_IDX item;
                        cptr q, s;
                        char o_name[MAX_NLEN];
                        object_type *o_ptr;
@@ -9005,7 +8999,7 @@ static cptr do_hex_spell(int spell, int mode)
                        }
                        else
                        {
-                               int power = 0;
+                               int curse_rank = 0;
                                msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
                                o_ptr->curse_flags |= (TRC_CURSED);
 
@@ -9022,11 +9016,11 @@ static cptr do_hex_spell(int spell, int mode)
                                                add_flag(o_ptr->art_flags, TR_VORPAL);
                                                add_flag(o_ptr->art_flags, TR_VAMPIRIC);
                                                msg_print(_("血だ!血だ!血だ!", "Blood, Blood, Blood!"));
-                                               power = 2;
+                                               curse_rank = 2;
                                        }
                                }
 
-                               o_ptr->curse_flags |= get_curse(power, o_ptr);
+                               o_ptr->curse_flags |= get_curse(curse_rank, o_ptr);
                        }
 
                        p_ptr->update |= (PU_BONUS);
@@ -9048,22 +9042,22 @@ static cptr do_hex_spell(int spell, int mode)
                if (name) return _("我慢", "Patience");
                if (desc) return _("数ターン攻撃を耐えた後、受けたダメージを地獄の業火として周囲に放出する。", 
                        "Bursts hell fire strongly after patients any damage while few turns.");
-               power = MIN(200, (p_ptr->magic_num1[2] * 2));
+               power = MIN(200, (HEX_REVENGE_POWER(p_ptr) * 2));
                if (info) return info_damage(0, 0, power);
                if (cast)
                {
                        int a = 3 - (p_ptr->pspeed - 100) / 10;
-                       int r = 3 + randint1(3) + MAX(0, MIN(3, a));
+                       MAGIC_NUM2 r = 3 + randint1(3) + MAX(0, MIN(3, a));
 
-                       if (p_ptr->magic_num2[2] > 0)
+                       if (HEX_REVENGE_TURN(p_ptr) > 0)
                        {
                                msg_print(_("すでに我慢をしている。", "You are already patienting."));
                                return NULL;
                        }
 
-                       p_ptr->magic_num2[1] = 1;
-                       p_ptr->magic_num2[2] = r;
-                       p_ptr->magic_num1[2] = 0;
+                       HEX_REVENGE_TYPE(p_ptr) = 1;
+                       HEX_REVENGE_TURN(p_ptr) = r;
+                       HEX_REVENGE_POWER(p_ptr) = 0;
                        msg_print(_("じっと耐えることにした。", "You decide to patient all damages."));
                        add = FALSE;
                }
@@ -9071,14 +9065,14 @@ static cptr do_hex_spell(int spell, int mode)
                {
                        int rad = 2 + (power / 50);
 
-                       p_ptr->magic_num2[2]--;
+                       HEX_REVENGE_TURN(p_ptr)--;
 
-                       if ((p_ptr->magic_num2[2] <= 0) || (power >= 200))
+                       if ((HEX_REVENGE_TURN(p_ptr) <= 0) || (power >= 200))
                        {
                                msg_print(_("我慢が解かれた!", "Time for end of patioence!"));
                                if (power)
                                {
-                                       project(0, rad, py, px, power, GF_HELL_FIRE,
+                                       project(0, rad, p_ptr->y, p_ptr->x, power, GF_HELL_FIRE,
                                                (PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
                                }
                                if (p_ptr->wizard)
@@ -9087,9 +9081,9 @@ static cptr do_hex_spell(int spell, int mode)
                                }
 
                                /* Reset */
-                               p_ptr->magic_num2[1] = 0;
-                               p_ptr->magic_num2[2] = 0;
-                               p_ptr->magic_num1[2] = 0;
+                               HEX_REVENGE_TYPE(p_ptr) = 0;
+                               HEX_REVENGE_TURN(p_ptr) = 0;
+                               HEX_REVENGE_POWER(p_ptr) = 0;
                        }
                }
                break;
@@ -9128,22 +9122,22 @@ static cptr do_hex_spell(int spell, int mode)
                if (desc) return _("呪文詠唱を中止することなく、薬の効果を得ることができる。", "Quaffs a potion without canceling of casting a spell.");
                if (cast)
                {
-                       p_ptr->magic_num1[0] |= (1L << HEX_INHAIL);
+                       CASTING_HEX_FLAGS(p_ptr) |= (1L << HEX_INHAIL);
                        do_cmd_quaff_potion();
-                       p_ptr->magic_num1[0] &= ~(1L << HEX_INHAIL);
+                       CASTING_HEX_FLAGS(p_ptr) &= ~(1L << HEX_INHAIL);
                        add = FALSE;
                }
                break;
 
        case 11:
-               if (name) return _("吸血霧", "Vampiric mist");
-               if (desc) return _("視界内のモンスターに微弱量の生命力吸収のダメージを与える。与えたダメージの分、体力が回復する。", 
-                       "Deals few dameges of drain life to all monsters in your sight.");
+               if (name) return _("衰弱の霧", "Hypodynamic mist");
+               if (desc) return _("視界内のモンスターに微弱量の衰弱属性のダメージを与える。", 
+                       "Deals few damages of hypodynamia to all monsters in your sight.");
                power = (plev / 2) + 5;
                if (info) return info_damage(1, power, 0);
                if (cast || cont)
                {
-                       project_hack(GF_OLD_DRAIN, randint1(power));
+                       project_hack(GF_HYPODYNAMIA, randint1(power));
                }
                break;
 
@@ -9258,7 +9252,7 @@ static cptr do_hex_spell(int spell, int mode)
                }
                if (cast || cont)
                {
-                       animate_dead(0, py, px);
+                       animate_dead(0, p_ptr->y, p_ptr->x);
                }
                break;
 
@@ -9267,7 +9261,7 @@ static cptr do_hex_spell(int spell, int mode)
                if (desc) return _("装備している防具に呪いをかける。", "Curse a piece of armour that you wielding.");
                if (cast)
                {
-                       int item;
+                       OBJECT_IDX item;
                        cptr q, s;
                        char o_name[MAX_NLEN];
                        object_type *o_ptr;
@@ -9311,7 +9305,7 @@ static cptr do_hex_spell(int spell, int mode)
                        }
                        else
                        {
-                               int power = 0;
+                               int curse_rank = 0;
                                msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
                                o_ptr->curse_flags |= (TRC_CURSED);
 
@@ -9329,11 +9323,11 @@ static cptr do_hex_spell(int spell, int mode)
                                                add_flag(o_ptr->art_flags, TR_RES_DARK);
                                                add_flag(o_ptr->art_flags, TR_RES_NETHER);
                                                msg_print(_("血だ!血だ!血だ!", "Blood, Blood, Blood!"));
-                                               power = 2;
+                                               curse_rank = 2;
                                        }
                                }
 
-                               o_ptr->curse_flags |= get_curse(power, o_ptr);
+                               o_ptr->curse_flags |= get_curse(curse_rank, o_ptr);
                        }
 
                        p_ptr->update |= (PU_BONUS);
@@ -9370,9 +9364,9 @@ static cptr do_hex_spell(int spell, int mode)
                        if ((!o_ptr->k_idx) || (!object_is_cursed(o_ptr)))
                        {
                                do_spell(REALM_HEX, spell, SPELL_STOP);
-                               p_ptr->magic_num1[0] &= ~(1L << spell);
-                               p_ptr->magic_num2[0]--;
-                               if (!p_ptr->magic_num2[0]) set_action(ACTION_NONE);
+                               CASTING_HEX_FLAGS(p_ptr) &= ~(1L << spell);
+                               CASTING_HEX_NUM(p_ptr)--;
+                               if (!SINGING_SONG_ID(p_ptr)) set_action(ACTION_NONE);
                        }
                }
                if (stop)
@@ -9459,9 +9453,9 @@ static cptr do_hex_spell(int spell, int mode)
                        if (!flag)
                        {
                                msg_format(_("%sの呪文の詠唱をやめた。", "Finish casting '%^s'."), do_spell(REALM_HEX, HEX_RESTORE, SPELL_NAME));
-                               p_ptr->magic_num1[0] &= ~(1L << HEX_RESTORE);
-                               if (cont) p_ptr->magic_num2[0]--;
-                               if (p_ptr->magic_num2) p_ptr->action = ACTION_NONE;
+                               CASTING_HEX_FLAGS(p_ptr) &= ~(1L << HEX_RESTORE);
+                               if (cont) CASTING_HEX_NUM(p_ptr)--;
+                               if (CASTING_HEX_NUM(p_ptr)) p_ptr->action = ACTION_NONE;
 
                                /* Redraw status */
                                p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
@@ -9477,7 +9471,7 @@ static cptr do_hex_spell(int spell, int mode)
                if (desc) return _("呪われた武器の呪いを吸収して魔力を回復する。", "Drains curse on your weapon and heals SP a little.");
                if (cast)
                {
-                       int item;
+                       OBJECT_IDX item;
                        cptr s, q;
                        u32b f[TR_FLAG_SIZE];
                        object_type *o_ptr;
@@ -9557,7 +9551,8 @@ static cptr do_hex_spell(int spell, int mode)
                if (desc) return _("モンスターの隣のマスに瞬間移動する。", "Teleports you close to a monster.");
                if (cast)
                {
-                       int i, y, x, dir;
+                       int i, dir;
+                       POSITION y, x;
                        bool flag;
 
                        for (i = 0; i < 3; i++)
@@ -9575,7 +9570,7 @@ static cptr do_hex_spell(int spell, int mode)
                                }
 
                                if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
-                                       (distance(y, x, py, px) > plev + 2))
+                                       (distance(y, x, p_ptr->y, p_ptr->x) > plev + 2))
                                {
                                        msg_print(_("そこには移動できない。", "Can not teleport to there."));
                                        continue;
@@ -9612,30 +9607,30 @@ static cptr do_hex_spell(int spell, int mode)
                if (name) return _("復讐の宣告", "Revenge sentence");
                if (desc) return _("数ターン後にそれまで受けたダメージに応じた威力の地獄の劫火の弾を放つ。", 
                        "Fires  a ball of hell fire to try revenging after few turns.");
-               power = p_ptr->magic_num1[2];
+               power = HEX_REVENGE_POWER(p_ptr);
                if (info) return info_damage(0, 0, power);
                if (cast)
                {
-                       int r;
+                       MAGIC_NUM2 r;
                        int a = 3 - (p_ptr->pspeed - 100) / 10;
                        r = 1 + randint1(2) + MAX(0, MIN(3, a));
 
-                       if (p_ptr->magic_num2[2] > 0)
+                       if (HEX_REVENGE_TURN(p_ptr) > 0)
                        {
                                msg_print(_("すでに復讐は宣告済みだ。", "You already pronounced your revenge."));
                                return NULL;
                        }
 
-                       p_ptr->magic_num2[1] = 2;
-                       p_ptr->magic_num2[2] = r;
+                       HEX_REVENGE_TYPE(p_ptr) = 2;
+                       HEX_REVENGE_TURN(p_ptr) = r;
                        msg_format(_("あなたは復讐を宣告した。あと %d ターン。", "You pronounce your revenge. %d turns left."), r);
                        add = FALSE;
                }
                if (cont)
                {
-                       p_ptr->magic_num2[2]--;
+                       HEX_REVENGE_TURN(p_ptr)--;
 
-                       if (p_ptr->magic_num2[2] <= 0)
+                       if (HEX_REVENGE_TURN(p_ptr) <= 0)
                        {
                                int dir;
 
@@ -9660,7 +9655,7 @@ static cptr do_hex_spell(int spell, int mode)
                                {
                                        msg_print(_("復讐する気が失せた。", "You are not a mood to revenge."));
                                }
-                               p_ptr->magic_num1[2] = 0;
+                               HEX_REVENGE_POWER(p_ptr) = 0;
                        }
                }
                break;
@@ -9670,8 +9665,8 @@ static cptr do_hex_spell(int spell, int mode)
        if ((cast) && (add))
        {
                /* add spell */
-               p_ptr->magic_num1[0] |= 1L << (spell);
-               p_ptr->magic_num2[0]++;
+               CASTING_HEX_FLAGS(p_ptr) |= 1L << (spell);
+               CASTING_HEX_NUM(p_ptr)++;
 
                if (p_ptr->action != ACTION_SPELL) set_action(ACTION_SPELL);
        }
@@ -9694,7 +9689,7 @@ static cptr do_hex_spell(int spell, int mode)
  * @param mode 求める処理
  * @return 各領域魔法に各種テキストを求めた場合は文字列参照ポインタ、そうでない場合はNULLポインタを返す。
  */
-cptr do_spell(int realm, int spell, int mode)
+cptr do_spell(REALM_IDX realm, SPELL_IDX spell, BIT_FLAGS mode)
 {
        switch (realm)
        {