OSDN Git Service

#37353 CASTING_HEX_FLAGS、CASTING_HEX_NUMを定義。SINGING_SONG_IDをSINGING_SONG_EFFECTに改名...
authorDeskull <desull@users.sourceforge.jp>
Tue, 19 Dec 2017 11:48:54 +0000 (20:48 +0900)
committerDeskull <desull@users.sourceforge.jp>
Tue, 19 Dec 2017 11:48:54 +0000 (20:48 +0900)
src/cmd2.c
src/defines.h
src/do-spell.c
src/dungeon.c
src/effects.c
src/hex.c
src/racial.c
src/xtra1.c

index 16bdb23..1bb5471 100644 (file)
@@ -2637,7 +2637,7 @@ void do_cmd_rest(void)
 
        set_action(ACTION_NONE);
 
-       if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_ID(p_ptr) || p_ptr->magic_num1[1]))
+       if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) || INTERUPTING_SONG_EFFECT(p_ptr)))
        {
                stop_singing();
        }
index a840988..c7124c6 100644 (file)
@@ -5241,8 +5241,9 @@ extern int PlayerUID;
 
 #define MUSIC_DETECT            101
 
-#define SINGING_SONG_ID(P_PTR) ((P_PTR)->magic_num1[0])
-#define INTERUPTING_SONG_ID(P_PTR) ((P_PTR)->magic_num1[0])
+#define SINGING_SONG_EFFECT(P_PTR) ((P_PTR)->magic_num1[0])
+#define INTERUPTING_SONG_EFFECT(P_PTR) ((P_PTR)->magic_num1[1])
+#define SINGING_SONG_ID(P_PTR) ((P_PTR)->magic_num2[0])
 #define music_singing(X) ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] == (X)))
 #define music_singing_any() ((p_ptr->pclass == CLASS_BARD) && p_ptr->magic_num1[0])
 
@@ -5585,6 +5586,10 @@ extern int PlayerUID;
        ((p_ptr->realm1 == REALM_HEX) && (p_ptr->magic_num1[0]))
 #define hex_spelling(X) \
        ((p_ptr->realm1 == REALM_HEX) && (p_ptr->magic_num1[0] & (1L << (X))))
+#define CASTING_HEX_FLAGS(P_PTR) ((P_PTR)->magic_num1[0])
+#define CASTING_HEX_NUM(P_PTR) ((P_PTR)->magic_num2[0])
+
+
 /* 1st book */
 #define HEX_BLESS             0
 #define HEX_CURE_LIGHT        1
index 8d6e308..04dbe2c 100644 (file)
@@ -989,10 +989,10 @@ static bool cast_summon_greater_demon(void)
 static void start_singing(SPELL_IDX spell, MAGIC_NUM1 song)
 {
        /* Remember the song index */
-       SINGING_SONG_ID(p_ptr) = song;
+       SINGING_SONG_EFFECT(p_ptr) = song;
 
        /* Remember the index of the spell which activated the song */
-       p_ptr->magic_num2[0] = spell;
+       SINGING_SONG_ID(p_ptr) = spell;
 
 
        /* Now the player is singing */
@@ -1015,24 +1015,24 @@ void stop_singing(void)
        if (p_ptr->pclass != CLASS_BARD) return;
 
        /* Are there interupted song? */
-       if (INTERUPTING_SONG_ID(p_ptr))
+       if (INTERUPTING_SONG_EFFECT(p_ptr))
        {
                /* Forget interupted song */
-               INTERUPTING_SONG_ID(p_ptr) = MUSIC_NONE;
+               INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
                return;
        }
 
        /* The player is singing? */
-       if (!SINGING_SONG_ID(p_ptr)) 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);
 
-       SINGING_SONG_ID(p_ptr) = 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);
@@ -9129,9 +9129,9 @@ static cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS 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;
@@ -9371,9 +9371,9 @@ static cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS 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)
@@ -9460,9 +9460,9 @@ static cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS 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);
@@ -9672,8 +9672,8 @@ static cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS 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);
        }
index 71fba72..88ef652 100644 (file)
@@ -1394,7 +1394,7 @@ static void check_music(void)
 
        /* Music singed by player */
        if (p_ptr->pclass != CLASS_BARD) return;
-       if (!SINGING_SONG_ID(p_ptr) && !INTERUPTING_SONG_ID(p_ptr)) return;
+       if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
 
        if (p_ptr->anti_magic)
        {
@@ -1402,7 +1402,7 @@ static void check_music(void)
                return;
        }
 
-       spell = p_ptr->magic_num2[0];
+       spell = SINGING_SONG_ID(p_ptr);
        s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
 
        need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
@@ -1421,10 +1421,10 @@ static void check_music(void)
                s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
 
                p_ptr->redraw |= PR_MANA;
-               if (INTERUPTING_SONG_ID(p_ptr))
+               if (INTERUPTING_SONG_EFFECT(p_ptr))
                {
-                       SINGING_SONG_ID(p_ptr) = p_ptr->magic_num1[1];
-                       INTERUPTING_SONG_ID(p_ptr) = 0;
+                       SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
+                       INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
                        msg_print(_("歌を再開した。", "You restart singing."));
                        p_ptr->action = ACTION_SING;
 
@@ -5748,8 +5748,8 @@ static void dungeon(bool load_game)
                }
        }
 
-       if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_ID(p_ptr) > MUSIC_DETECT))
-               SINGING_SONG_ID(p_ptr) = MUSIC_DETECT;
+       if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
+               SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
 
        /* Hack -- notice death or departure */
        if (!p_ptr->playing || p_ptr->is_dead) return;
index 7bcdd23..8d27e31 100644 (file)
@@ -206,8 +206,8 @@ void reset_tim_flags(void)
 
        if (p_ptr->pclass == CLASS_BARD)
        {
-               p_ptr->magic_num1[0] = 0;
-               p_ptr->magic_num2[0] = 0;
+               SINGING_SONG_EFFECT(p_ptr) = 0;
+               SINGING_SONG_ID(p_ptr) = 0;
        }
 }
 
@@ -268,8 +268,8 @@ void dispel_player(void)
        if (music_singing_any() || hex_spelling_any())
        {
                cptr str = (music_singing_any()) ? _("歌", "singing") : _("呪文", "spelling");
-               INTERUPTING_SONG_ID(p_ptr) = SINGING_SONG_ID(p_ptr);
-               SINGING_SONG_ID(p_ptr) = MUSIC_NONE;
+               INTERUPTING_SONG_EFFECT(p_ptr) = SINGING_SONG_EFFECT(p_ptr);
+               SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
                msg_format(_("%sが途切れた。", "Your %s is interrupted."), str);
                p_ptr->action = ACTION_NONE;
 
index 9a5f116..b71e7a5 100644 (file)
--- a/src/hex.c
+++ b/src/hex.c
@@ -33,8 +33,8 @@ bool stop_hex_spell_all(void)
                if (hex_spelling(spell)) do_spell(REALM_HEX, spell, SPELL_STOP);
        }
 
-       p_ptr->magic_num1[0] = 0;
-       p_ptr->magic_num2[0] = 0;
+       CASTING_HEX_FLAGS(p_ptr) = 0;
+       CASTING_HEX_NUM(p_ptr) = 0;
 
        /* Print message */
        if (p_ptr->action == ACTION_SPELL) set_action(ACTION_NONE);
@@ -71,7 +71,7 @@ bool stop_hex_spell(void)
        }
 
        /* Stop all spells */
-       else if ((p_ptr->magic_num2[0] == 1) || (p_ptr->lev < 35))
+       else if ((CASTING_HEX_NUM(p_ptr) == 1) || (p_ptr->lev < 35))
        {
                return stop_hex_spell_all();
        }
@@ -79,10 +79,10 @@ bool stop_hex_spell(void)
        {
 #ifdef JP
                strnfmt(out_val, 78, "どの呪文の詠唱を中断しますか?(呪文 %c-%c, 'l'全て, ESC)",
-                       I2A(0), I2A(p_ptr->magic_num2[0] - 1));
+                       I2A(0), I2A(CASTING_HEX_NUM(p_ptr) - 1));
 #else
                strnfmt(out_val, 78, "Which spell do you stop casting? (Spell %c-%c, 'l' to all, ESC)",
-                       I2A(0), I2A(p_ptr->magic_num2[0] - 1));
+                       I2A(0), I2A(CASTING_HEX_NUM(p_ptr) - 1));
 #endif
 
                screen_save();
@@ -110,7 +110,7 @@ bool stop_hex_spell(void)
                                screen_load();
                                return stop_hex_spell_all();
                        }
-                       if ((choice < I2A(0)) || (choice > I2A(p_ptr->magic_num2[0] - 1))) continue;
+                       if ((choice < I2A(0)) || (choice > I2A(CASTING_HEX_NUM(p_ptr) - 1))) continue;
                        flag = TRUE;
                }
        }
@@ -122,8 +122,8 @@ bool stop_hex_spell(void)
                int n = sp[A2I(choice)];
 
                do_spell(REALM_HEX, n, SPELL_STOP);
-               p_ptr->magic_num1[0] &= ~(1L << n);
-               p_ptr->magic_num2[0]--;
+               CASTING_HEX_FLAGS(p_ptr) &= ~(1L << n);
+               CASTING_HEX_NUM(p_ptr)--;
        }
 
        /* Redraw status */
@@ -148,7 +148,7 @@ void check_hex(void)
 
        /* Spells spelled by player */
        if (p_ptr->realm1 != REALM_HEX) return;
-       if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
+       if (!CASTING_HEX_FLAGS(p_ptr) && !p_ptr->magic_num1[1]) return;
 
        if (p_ptr->magic_num1[1])
        {
@@ -179,7 +179,7 @@ void check_hex(void)
        /* Culcurates final mana cost */
        need_mana_frac = 0;
        s64b_div(&need_mana, &need_mana_frac, 0, 3); /* Divide by 3 */
-       need_mana += (p_ptr->magic_num2[0] - 1);
+       need_mana += (CASTING_HEX_NUM(p_ptr) - 1);
 
 
        /* Not enough mana */
@@ -260,7 +260,7 @@ bool hex_spell_fully(void)
        /* Paranoia */
        k_max = MIN(k_max, MAX_KEEP);
 
-       if (p_ptr->magic_num2[0] < k_max) return FALSE;
+       if (CASTING_HEX_NUM(p_ptr) < k_max) return FALSE;
 
        return TRUE;
 }
index cee06a4..4b0aaec 100644 (file)
@@ -1027,7 +1027,7 @@ static bool cmd_racial_power_aux(s32b command)
                case CLASS_BARD:
                {
                        /* Singing is already stopped */
-                       if (!SINGING_SONG_ID(p_ptr) && !INTERUPTING_SONG_ID(p_ptr)) return FALSE;
+                       if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return FALSE;
 
                        stop_singing();
                        p_ptr->energy_use = 10;
index 5a3adb6..904c90b 100644 (file)
@@ -4503,7 +4503,7 @@ void calc_bonuses(void)
        /* Hex bonuses */
        if (p_ptr->realm1 == REALM_HEX)
        {
-               if (hex_spelling_any()) p_ptr->skill_stl -= (1 + p_ptr->magic_num2[0]);
+               if (hex_spelling_any()) p_ptr->skill_stl -= (1 + CASTING_HEX_NUM(p_ptr));
                if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE;
                if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4;
                if (hex_spelling(HEX_BUILDING))