OSDN Git Service

#37287 #37353 (2.2.0.89) COMMAND_NUM 型を定義し、型の置換を継続中。 / Define COMMAND_NUM, ongoing...
[hengband/hengband.git] / src / mind.c
index 0e5a5ad..e153684 100644 (file)
@@ -576,7 +576,7 @@ void mindcraft_info(char *p, int use_mind, int power)
                break;
        case MIND_KI:
        {
-               int boost = p_ptr->magic_num1[0];
+               int boost = P_PTR_KI;
 
                if (heavy_armor()) boost /= 2;
 
@@ -675,70 +675,70 @@ void mindcraft_info(char *p, int use_mind, int power)
  * when you run it. It's probably easy to fix but I haven't tried,\n
  * sorry.\n
  */
-  static int get_mind_power(int *sn, bool only_browse)
-    {
-      int             i;
-      int             num = 0;
-      int             y = 1;
-      int             x = 10;
-      int             minfail = 0;
-      int             plev = p_ptr->lev;
-      int             chance = 0;
-      int             ask = TRUE;
-      char            choice;
-      char            out_val[160];
-      char            comment[80];
-      cptr            p;
-
-      mind_type       spell;
-      const mind_power      *mind_ptr;
-      bool            flag, redraw;
-      int             use_mind;
-      int menu_line = (use_menu ? 1 : 0);
-
-      switch(p_ptr->pclass)
+static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse)
+{
+       SPELL_IDX i;
+       int             num = 0;
+       int             y = 1;
+       int             x = 10;
+       int             minfail = 0;
+       int             plev = p_ptr->lev;
+       int             chance = 0;
+       int             ask = TRUE;
+       char            choice;
+       char            out_val[160];
+       char            comment[80];
+       cptr            p;
+
+       mind_type       spell;
+       const mind_power      *mind_ptr;
+       bool            flag, redraw;
+       int             use_mind;
+       int menu_line = (use_menu ? 1 : 0);
+
+       switch (p_ptr->pclass)
        {
        case CLASS_MINDCRAFTER:
-         {
-           use_mind = MIND_MINDCRAFTER;
-           p = _("超能力", "mindcraft");
-           break;
-         }
+       {
+               use_mind = MIND_MINDCRAFTER;
+               p = _("超能力", "mindcraft");
+               break;
+       }
        case CLASS_FORCETRAINER:
-         {
-           use_mind = MIND_KI;
-           p = _("練気術", "Force");
-           break;
-         }
+       {
+               use_mind = MIND_KI;
+               p = _("練気術", "Force");
+               break;
+       }
        case CLASS_BERSERKER:
-         {
-           use_mind = MIND_BERSERKER;
-           p = _("技", "brutal power");
-           break;
-         }
+       {
+               use_mind = MIND_BERSERKER;
+               p = _("技", "brutal power");
+               break;
+       }
        case CLASS_MIRROR_MASTER:
-         {
-           use_mind = MIND_MIRROR_MASTER;
-           p = _("鏡魔法", "magic");
-           break;
-         }
+       {
+               use_mind = MIND_MIRROR_MASTER;
+               p = _("鏡魔法", "magic");
+               break;
+       }
        case CLASS_NINJA:
-         {
-           use_mind = MIND_NINJUTSU;
-           p = _("忍術", "ninjutsu");
-           break;
-         }
+       {
+               use_mind = MIND_NINJUTSU;
+               p = _("忍術", "ninjutsu");
+               break;
+       }
        default:
-         {
-           use_mind = 0;
-           p = _("超能力", "mindcraft");
-           break;
-         }
+       {
+               use_mind = 0;
+               p = _("超能力", "mindcraft");
+               break;
+       }
        }
-      mind_ptr = &mind_powers[use_mind];
+       mind_ptr = &mind_powers[use_mind];
 
        /* Assume cancelled */
-      *sn = (-1);
+       *sn = (-1);
 
 #ifdef ALLOW_REPEAT /* TNB */
 
@@ -892,7 +892,7 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
                                                        if (i == 5)
                                                        {
                                                                int j;
-                                                               for (j = 0; j < p_ptr->magic_num1[0] / 50; j++)
+                                                               for (j = 0; j < P_PTR_KI / 50; j++)
                                                                        mana_cost += (j+1) * 3 / 2;
                                                        }
                                                }
@@ -934,7 +934,7 @@ put_str(format("Lv   %s   Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind
                                                else strcpy(psi_desc, "     ");
                                        }
                                        else
-                                               sprintf(psi_desc, "  %c) ",I2A(i));
+                                               sprintf(psi_desc, "  %c) ", I2A(i));
                                        /* Dump the spell --(-- */
                                        strcat(psi_desc,
                                               format("%-30s%2d %4d%s %3d%%%s",
@@ -1220,9 +1220,9 @@ static bool cast_mindcrafter_spell(int spell)
  */
 static bool cast_force_spell(int spell)
 {
-       int             dir;
-       int             plev = p_ptr->lev;
-       int             boost = p_ptr->magic_num1[0];
+       DIRECTION dir;
+       int plev = p_ptr->lev;
+       int boost = P_PTR_KI;
 
        if (heavy_armor()) boost /= 2;
 
@@ -1250,12 +1250,12 @@ static bool cast_force_spell(int spell)
                break;
        case 5:
                msg_print(_("気を練った。", "You improved the Force."));
-               p_ptr->magic_num1[0] += (70 + plev);
+               P_PTR_KI += (70 + plev);
                p_ptr->update |= (PU_BONUS);
-               if (randint1(p_ptr->magic_num1[0]) > (plev * 4 + 120))
+               if (randint1(P_PTR_KI) > (plev * 4 + 120))
                {
                        msg_print(_("気が暴走した!", "The Force exploded!"));
-                       fire_ball(GF_MANA, 0, p_ptr->magic_num1[0] / 2, 10);
+                       fire_ball(GF_MANA, 0, P_PTR_KI / 2, 10);
                        take_hit(DAMAGE_LOSELIFE, p_ptr->magic_num1[0] / 2, _("気の暴走", "Explosion of the Force"), -1);
                }
                else return TRUE;
@@ -1278,7 +1278,7 @@ static bool cast_force_spell(int spell)
                        int i;
                        int ty = y, tx = x;
                        int oy = y, ox = x;
-                       int m_idx = cave[y][x].m_idx;
+                       MONSTER_IDX m_idx = cave[y][x].m_idx;
                        monster_type *m_ptr = &m_list[m_idx];
                        monster_race *r_ptr = &r_info[m_ptr->r_idx];
                        char m_name[80];
@@ -1327,7 +1327,7 @@ static bool cast_force_spell(int spell)
                break;
        case 9:
        {
-               int m_idx;
+               MONSTER_IDX m_idx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
                m_idx = cave[target_row][target_col].m_idx;
@@ -1369,7 +1369,7 @@ static bool cast_force_spell(int spell)
        default:
                msg_print(_("なに?", "Zap?"));
        }
-       p_ptr->magic_num1[0] = 0;
+       P_PTR_KI = 0;
        p_ptr->update |= (PU_BONUS);
 
        return TRUE;
@@ -1626,7 +1626,7 @@ static bool cast_berserk_spell(int spell)
  */
 static bool cast_ninja_spell(int spell)
 {
-       int x, y;
+       POSITION x, y;
        int dir;
        int plev = p_ptr->lev;
 
@@ -1716,7 +1716,7 @@ static bool cast_ninja_spell(int spell)
                int i;
                for (i = 0; i < 8; i++)
                {
-                       int slot;
+                       OBJECT_IDX slot;
 
                        for (slot = 0; slot < INVEN_PACK; slot++)
                        {
@@ -1744,12 +1744,12 @@ static bool cast_ninja_spell(int spell)
        case 12:
        {
                monster_type *m_ptr;
-               int m_idx;
+               MONSTER_IDX m_idx;
                char m_name[80];
                int i;
                int path_n;
                u16b path_g[512];
-               int ty,tx;
+               POSITION ty, tx;
 
                if (!target_set(TARGET_KILL)) return FALSE;
                m_idx = cave[target_row][target_col].m_idx;
@@ -1877,7 +1877,8 @@ static bool cast_ninja_spell(int spell)
  */
 void do_cmd_mind(void)
 {
-       int             n = 0,  b = 0;
+       SPELL_IDX n = 0;
+       int b = 0;
        int             chance;
        int             minfail = 0;
        int             plev = p_ptr->lev;
@@ -1935,7 +1936,7 @@ void do_cmd_mind(void)
                if (n == 5)
                {
                        int j;
-                       for (j = 0; j < p_ptr->magic_num1[0] / 50; j++)
+                       for (j = 0; j < P_PTR_KI / 50; j++)
                                mana_cost += (j+1) * 3 / 2;
                }
        }
@@ -2008,10 +2009,10 @@ void do_cmd_mind(void)
 
                if ((use_mind != MIND_BERSERKER) && (use_mind != MIND_NINJUTSU))
                {
-                       if ((use_mind == MIND_KI) && (n != 5) && p_ptr->magic_num1[0])
+                       if ((use_mind == MIND_KI) && (n != 5) && P_PTR_KI)
                        {
                                msg_print(_("気が散ってしまった...", "Your improved Force has gone away..."));
-                               p_ptr->magic_num1[0] = 0;
+                               P_PTR_KI = 0;
                        }
 
                        if (randint1(100) < (chance / 2))
@@ -2188,7 +2189,7 @@ void do_cmd_mind(void)
  */
 void do_cmd_mind_browse(void)
 {
-       int n = 0;
+       SPELL_IDX n = 0;
        int j, line;
        char temp[62*5];
        int use_mind = 0;