OSDN Git Service

#37287 #37353 (2.2.0.89) TERM_COLOR 型を定義し、型の置換を継続中。 / Define TERM_COLOR, ongoing...
[hengband/hengband.git] / src / hissatsu.c
index 18ce411..292d768 100644 (file)
  * when you run it. It's probably easy to fix but I haven't tried,\n
  * sorry.\n
  */
-static int get_hissatsu_power(int *sn)
+static int get_hissatsu_power(SPELL_IDX *sn)
 {
-       int             i, j = 0;
+       SPELL_IDX i;
+       int j = 0;
        int             num = 0;
        int             y = 1;
        int             x = 15;
@@ -42,12 +43,8 @@ static int get_hissatsu_power(int *sn)
        int             ask = TRUE;
        char            choice;
        char            out_val[160];
-       char sentaku[32];
-#ifdef JP
-cptr            p = "必殺剣";
-#else
-       cptr            p = "special attack";
-#endif
+       SPELL_IDX sentaku[32];
+       cptr            p = _("必殺剣", "special attack");
 
        magic_type spell;
        bool            flag, redraw;
@@ -88,11 +85,7 @@ cptr            p = "必殺剣";
 
        /* Build a prompt (accept all spells) */
        (void) strnfmt(out_val, 78, 
-#ifdef JP
-                      "(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?",
-#else
-                      "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
-#endif
+                      _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
                       p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num-1], p);
 
        if (use_menu) screen_save();
@@ -198,11 +191,8 @@ cptr            p = "必殺剣";
 
                                /* Display a list of spells */
                                prt("", y, x);
-#ifdef JP
-put_str("名前              Lv  MP      名前              Lv  MP ", y, x + 5);
-#else
-put_str("name              Lv  SP      name              Lv  SP ", y, x + 5);
-#endif
+                               put_str(_("名前              Lv  MP      名前              Lv  MP ", 
+                                                 "name              Lv  SP      name              Lv  SP "), y, x + 5);
                                prt("", y+1, x);
                                /* Dump the spells */
                                for (i = 0, line = 0; i < 32; i++)
@@ -219,11 +209,7 @@ put_str("name              Lv  SP      name              Lv  SP ", y, x + 5);
                                        if (use_menu)
                                        {
                                                if (i == (menu_line-1))
-#ifdef JP
-                                                       strcpy(psi_desc, "  》");
-#else
-                                                       strcpy(psi_desc, "  > ");
-#endif
+                                                       strcpy(psi_desc, _("  》", "  > "));
                                                else strcpy(psi_desc, "    ");
                                                
                                        }
@@ -268,7 +254,7 @@ put_str("name              Lv  SP      name              Lv  SP ", y, x + 5);
                                ask = (isupper(choice));
 
                                /* Lowercase */
-                               if (ask) choice = tolower(choice);
+                               if (ask) choice = (char)tolower(choice);
 
                                /* Extract request */
                                i = (islower(choice) ? A2I(choice) : -1);
@@ -296,12 +282,7 @@ put_str("name              Lv  SP      name              Lv  SP ", y, x + 5);
                        char tmp_val[160];
 
                        /* Prompt */
-#ifdef JP
-                       (void) strnfmt(tmp_val, 78, "%sを使いますか?", do_spell(REALM_HISSATSU, j, SPELL_NAME));
-#else
-                       (void)strnfmt(tmp_val, 78, "Use %s? ", do_spell(REALM_HISSATSU, j, SPELL_NAME));
-#endif
-
+                       (void) strnfmt(tmp_val, 78, _("%sを使いますか?", "Use %s? "), do_spell(REALM_HISSATSU, j, SPELL_NAME));
 
                        /* Belay that order */
                        if (!get_check(tmp_val)) continue;
@@ -344,40 +325,25 @@ put_str("name              Lv  SP      name              Lv  SP ", y, x + 5);
  */
 void do_cmd_hissatsu(void)
 {
-       int             n = 0;
+       SPELL_IDX       n = 0;
        magic_type      spell;
 
 
        /* not if confused */
        if (p_ptr->confused)
        {
-#ifdef JP
-msg_print("混乱していて集中できない!");
-#else
-               msg_print("You are too confused!");
-#endif
-
+               msg_print(_("混乱していて集中できない!", "You are too confused!"));
                return;
        }
        if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
        {
                if (flush_failure) flush();
-#ifdef JP
-msg_print("武器を持たないと必殺技は使えない!");
-#else
-               msg_print("You need to wield a weapon!");
-#endif
-
+               msg_print(_("武器を持たないと必殺技は使えない!", "You need to wield a weapon!"));
                return;
        }
        if (!p_ptr->spell_learned1)
        {
-#ifdef JP
-msg_print("何も技を知らない。");
-#else
-               msg_print("You don't know any special attacks.");
-#endif
-
+               msg_print(_("何も技を知らない。", "You don't know any special attacks."));
                return;
        }
 
@@ -396,11 +362,7 @@ msg_print("何も技を知らない。");
        {
                if (flush_failure) flush();
                /* Warning */
-#ifdef JP
-msg_print("MPが足りません。");
-#else
-               msg_print("You do not have enough mana to use this power.");
-#endif
+               msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
                msg_print(NULL);
                return;
        }
@@ -411,7 +373,7 @@ msg_print("MPが足りません。");
        if (!do_spell(REALM_HISSATSU, n, SPELL_CAST)) return;
 
        /* Take a turn */
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        /* Use some mana */
        p_ptr->csp -= spell.smana;
@@ -434,7 +396,8 @@ msg_print("MPが足りません。");
  */
 void do_cmd_gain_hissatsu(void)
 {
-       int item, i, j;
+       OBJECT_IDX item;
+       int i, j;
 
        object_type *o_ptr;
        cptr q, s;
@@ -448,34 +411,19 @@ void do_cmd_gain_hissatsu(void)
 
        if (p_ptr->blind || no_lite())
        {
-#ifdef JP
-msg_print("目が見えない!");
-#else
-               msg_print("You cannot see!");
-#endif
-
+               msg_print(_("目が見えない!", "You cannot see!"));
                return;
        }
 
        if (p_ptr->confused)
        {
-#ifdef JP
-msg_print("混乱していて読めない!");
-#else
-               msg_print("You are too confused!");
-#endif
-
+               msg_print(_("混乱していて読めない!", "You are too confused!"));
                return;
        }
 
        if (!(p_ptr->new_spells))
        {
-#ifdef JP
-msg_print("新しい必殺技を覚えることはできない!");
-#else
-               msg_print("You cannot learn any new special attacks!");
-#endif
-
+               msg_print(_("新しい必殺技を覚えることはできない!", "You cannot learn any new special attacks!"));
                return;
        }
 
@@ -493,17 +441,8 @@ msg_print("新しい必殺技を覚えることはできない!");
        item_tester_tval = TV_HISSATSU_BOOK;
 
        /* Get an item */
-#ifdef JP
-q = "どの書から学びますか? ";
-#else
-       q = "Study which book? ";
-#endif
-
-#ifdef JP
-s = "読める書がない。";
-#else
-       s = "You have no books that you can read.";
-#endif
+       q = _("どの書から学びますか? ", "Study which book? ");
+       s = _("読める書がない。", "You have no books that you can read.");
 
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
 
@@ -526,11 +465,7 @@ s = "読める書がない。";
 
                p_ptr->spell_learned1 |= (1L << i);
                p_ptr->spell_worked1 |= (1L << i);
-#ifdef JP
-               msg_format("%sの技を覚えた。", do_spell(REALM_HISSATSU, i, SPELL_NAME));
-#else
-               msg_format("You have learned the special attack of %s.", do_spell(REALM_HISSATSU, i, SPELL_NAME));
-#endif
+               msg_format(_("%sの技を覚えた。", "You have learned the special attack of %s."), do_spell(REALM_HISSATSU, i, SPELL_NAME));
                for (j = 0; j < 64; j++)
                {
                        /* Stop at the first empty space */
@@ -542,15 +477,11 @@ s = "読める書がない。";
 
        /* No gain ... */
        if (!gain)
-#ifdef JP
-               msg_print("何も覚えられなかった。");
-#else
-               msg_print("You were not able to learn any special attacks.");
-#endif
+               msg_print(_("何も覚えられなかった。", "You were not able to learn any special attacks."));
 
        /* Take a turn */
        else
-               energy_use = 100;
+               p_ptr->energy_use = 100;
 
        p_ptr->update |= (PU_SPELLS);
 }
@@ -565,7 +496,7 @@ s = "読める書がない。";
  * @param mode 剣術のスレイ型ID
  * @return スレイの倍率(/10倍)
  */
-s16b mult_hissatsu(int mult, u32b *flgs, monster_type *m_ptr, int mode)
+MULTIPLY mult_hissatsu(MULTIPLY mult, BIT_FLAGS *flgs, monster_type *m_ptr, int mode)
 {
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
@@ -719,7 +650,7 @@ s16b mult_hissatsu(int mult, u32b *flgs, monster_type *m_ptr, int mode)
        /* Bloody Maelstrom */
        if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(r_ptr))
        {
-               int tmp = MIN(100, MAX(10, p_ptr->cut / 10));
+               MULTIPLY tmp = MIN(100, MAX(10, p_ptr->cut / 10));
                if (mult < tmp) mult = tmp;
        }