OSDN Git Service

[Refactor] #37353 term.c/h 追加。 / Add term.c/h.
authorDeskull <deskull@users.sourceforge.jp>
Wed, 20 Feb 2019 14:19:38 +0000 (23:19 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Wed, 20 Feb 2019 14:19:38 +0000 (23:19 +0900)
Hengband_vcs2017/Hengband/Hengband.vcxproj
src/mind.c
src/spells1.c

index 7b695fd..cf6b20b 100644 (file)
     <ClCompile Include="..\..\src\store.c" />\r
     <ClCompile Include="..\..\src\floor-streams.c" />\r
     <ClCompile Include="..\..\src\tables.c" />\r
+    <ClCompile Include="..\..\src\term.c" />\r
     <ClCompile Include="..\..\src\trap.c" />\r
     <ClCompile Include="..\..\src\util.c" />\r
     <ClCompile Include="..\..\src\variable.c" />\r
     <ClInclude Include="..\..\src\spells-world.h" />\r
     <ClInclude Include="..\..\src\spells.h" />\r
     <ClInclude Include="..\..\src\store.h" />\r
+    <ClInclude Include="..\..\src\term.h" />\r
     <ClInclude Include="..\..\src\trap.h" />\r
     <ClInclude Include="..\..\src\types.h" />\r
     <ClInclude Include="..\..\src\wild.h" />\r
index ffedc99..2f27dd2 100644 (file)
@@ -1658,11 +1658,11 @@ static bool cast_ninja_spell(int spell)
                grid_array[target_row][target_col].m_idx = 0;
 
                /* Update the new location */
-               grid_array[ty][tx].m_idx = (s16b)m_idx;
+               grid_array[ty][tx].m_idx = m_idx;
 
                /* Move the monster */
-               m_ptr->fy = (byte_hack)ty;
-               m_ptr->fx = (byte_hack)tx;
+               m_ptr->fy = ty;
+               m_ptr->fx = tx;
 
                /* Wake the monster up */
                (void)set_monster_csleep(m_idx, 0);
index 5856b2c..27431a6 100644 (file)
@@ -33,6 +33,7 @@
 #include "player-status.h"
 #include "realm-hex.h"
 #include "object-hook.h"
+#include "term.h"
 
 
 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
@@ -80,192 +81,6 @@ static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSIT
        return;
 }
 
-/*!
- * @brief 万色表現用にランダムな色を選択する関数 /
- * Get a legal "multi-hued" color for drawing "spells"
- * @param max 色IDの最大値
- * @return 選択した色ID
- */
-static TERM_COLOR mh_attr(int max)
-{
-       switch (randint1(max))
-       {
-               case  1: return (TERM_RED);
-               case  2: return (TERM_GREEN);
-               case  3: return (TERM_BLUE);
-               case  4: return (TERM_YELLOW);
-               case  5: return (TERM_ORANGE);
-               case  6: return (TERM_VIOLET);
-               case  7: return (TERM_L_RED);
-               case  8: return (TERM_L_GREEN);
-               case  9: return (TERM_L_BLUE);
-               case 10: return (TERM_UMBER);
-               case 11: return (TERM_L_UMBER);
-               case 12: return (TERM_SLATE);
-               case 13: return (TERM_WHITE);
-               case 14: return (TERM_L_WHITE);
-               case 15: return (TERM_L_DARK);
-       }
-
-       return (TERM_WHITE);
-}
-
-
-/*!
- * @brief 魔法属性に応じたエフェクトの色を返す /
- * Return a color to use for the bolt/ball spells
- * @param type 魔法属性
- * @return 対応する色ID
- */
-static TERM_COLOR spell_color(EFFECT_ID type)
-{
-       /* Check if A.B.'s new graphics should be used (rr9) */
-       if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
-       {
-               /* Analyze */
-               switch (type)
-               {
-                       case GF_PSY_SPEAR:              return (0x06);
-                       case GF_MISSILE:                return (0x0F);
-                       case GF_ACID:                   return (0x04);
-                       case GF_ELEC:                   return (0x02);
-                       case GF_FIRE:                   return (0x00);
-                       case GF_COLD:                   return (0x01);
-                       case GF_POIS:                   return (0x03);
-                       case GF_HOLY_FIRE:              return (0x00);
-                       case GF_HELL_FIRE:              return (0x00);
-                       case GF_MANA:                   return (0x0E);
-                         /* by henkma */
-                       case GF_SEEKER:                 return (0x0E);
-                       case GF_SUPER_RAY:              return (0x0E);
-
-                       case GF_ARROW:                  return (0x0F);
-                       case GF_WATER:                  return (0x04);
-                       case GF_NETHER:                 return (0x07);
-                       case GF_CHAOS:                  return (mh_attr(15));
-                       case GF_DISENCHANT:             return (0x05);
-                       case GF_NEXUS:                  return (0x0C);
-                       case GF_CONFUSION:              return (mh_attr(4));
-                       case GF_SOUND:                  return (0x09);
-                       case GF_SHARDS:                 return (0x08);
-                       case GF_FORCE:                  return (0x09);
-                       case GF_INERTIAL:               return (0x09);
-                       case GF_GRAVITY:                return (0x09);
-                       case GF_TIME:                   return (0x09);
-                       case GF_LITE_WEAK:              return (0x06);
-                       case GF_LITE:                   return (0x06);
-                       case GF_DARK_WEAK:              return (0x07);
-                       case GF_DARK:                   return (0x07);
-                       case GF_PLASMA:                 return (0x0B);
-                       case GF_METEOR:                 return (0x00);
-                       case GF_ICE:                    return (0x01);
-                       case GF_ROCKET:                 return (0x0F);
-                       case GF_DEATH_RAY:              return (0x07);
-                       case GF_NUKE:                   return (mh_attr(2));
-                       case GF_DISINTEGRATE:   return (0x05);
-                       case GF_PSI:
-                       case GF_PSI_DRAIN:
-                       case GF_TELEKINESIS:
-                       case GF_DOMINATION:
-                       case GF_DRAIN_MANA:
-                       case GF_MIND_BLAST:
-                       case GF_BRAIN_SMASH:
-                               return (0x09);
-                       case GF_CAUSE_1:
-                       case GF_CAUSE_2:
-                       case GF_CAUSE_3:
-                       case GF_CAUSE_4:                return (0x0E);
-                       case GF_HAND_DOOM:              return (0x07);
-                       case GF_CAPTURE  :              return (0x0E);
-                       case GF_IDENTIFY:               return (0x01);
-                       case GF_ATTACK:                 return (0x0F);
-                       case GF_PHOTO   :               return (0x06);
-               }
-       }
-       /* Normal tiles or ASCII */
-       else
-       {
-               TERM_COLOR a;
-               SYMBOL_CODE c;
-
-               /* Lookup the default colors for this type */
-               concptr s = quark_str(gf_color[type]);
-
-               if (!s) return (TERM_WHITE);
-
-               /* Pick a random color */
-               c = s[randint0(strlen(s))];
-
-               /* Lookup this color */
-               a = my_strchr(color_char, c) - color_char;
-
-               /* Invalid color (note check for < 0 removed, gave a silly
-                * warning because bytes are always >= 0 -- RG) */
-               if (a > 15) return (TERM_WHITE);
-
-               /* Use this color */
-               return (a);
-       }
-
-       /* Standard "color" */
-       return (TERM_WHITE);
-}
-
-
-/*!
- * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
- * Find the attr/char pair to use for a spell effect
- * @param y 始点Y座標
- * @param x 始点X座標
- * @param ny 終点Y座標
- * @param nx 終点X座標
- * @param typ 魔法の効果属性
- * @return 方向キャラID
- * @details
- * <pre>
- * It is moving (or has moved) from (x,y) to (nx,ny).
- * If the distance is not "one", we (may) return "*".
- * </pre>
- */
-u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
-{
-       int base;
-
-       byte k;
-
-       TERM_COLOR a;
-       SYMBOL_CODE c;
-
-       /* No motion (*) */
-       if ((ny == y) && (nx == x)) base = 0x30;
-
-       /* Vertical (|) */
-       else if (nx == x) base = 0x40;
-
-       /* Horizontal (-) */
-       else if (ny == y) base = 0x50;
-
-       /* Diagonal (/) */
-       else if ((ny - y) == (x - nx)) base = 0x60;
-
-       /* Diagonal (\) */
-       else if ((ny - y) == (nx - x)) base = 0x70;
-
-       /* Weird (*) */
-       else base = 0x30;
-
-       /* Basic spell color */
-       k = spell_color(typ);
-
-       /* Obtain attr/char */
-       a = misc_to_attr[base + k];
-       c = misc_to_char[base + k];
-
-       /* Create pict */
-       return (PICT(a, c));
-}
-
-
 
 /*
  * Mega-Hack -- track "affected" monsters (see "project()" comments)