OSDN Git Service

[Refactor] #37353 creature.c/h を作成して,プレイヤーモンスターの共通項目として extract_energy() を追加.
authordeskull <deskull@users.sourceforge.jp>
Fri, 10 May 2019 00:36:15 +0000 (09:36 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 10 May 2019 00:36:15 +0000 (09:36 +0900)
15 files changed:
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/core.c
src/creature.c [new file with mode: 0644]
src/creature.h [new file with mode: 0644]
src/defines.h
src/externs.h
src/monster-process.c
src/monster-status.c
src/monster2.c
src/player-effects.c
src/spells2.c
src/spells3.c
src/tables.c

index 4abf18a..20fc14b 100644 (file)
     <ClCompile Include="..\..\src\cmd-read.c" />\r
     <ClCompile Include="..\..\src\cmd-smith.c" />\r
     <ClCompile Include="..\..\src\core.c" />\r
+    <ClCompile Include="..\..\src\creature.c" />\r
     <ClCompile Include="..\..\src\dungeon-file.c" />\r
     <ClCompile Include="..\..\src\dungeon.c" />\r
     <ClCompile Include="..\..\src\feature.c" />\r
     <ClInclude Include="..\..\src\cmd-read.h" />\r
     <ClInclude Include="..\..\src\cmd-usestaff.h" />\r
     <ClInclude Include="..\..\src\core.h" />\r
+    <ClInclude Include="..\..\src\creature.h" />\r
     <ClInclude Include="..\..\src\defines.h" />\r
     <ClInclude Include="..\..\src\dungeon-file.h" />\r
     <ClInclude Include="..\..\src\dungeon.h" />\r
index 0550d08..5ba2d4d 100644 (file)
     <ClCompile Include="..\..\src\realm.c">
       <Filter>spells</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\creature.c">
+      <Filter>creature</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\defines.h" />
     <ClInclude Include="..\..\src\report.h">
       <Filter>io</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\creature.h">
+      <Filter>creature</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
     <Filter Include="core">
       <UniqueIdentifier>{cbc72021-c88c-4625-b89b-ef126e300cf8}</UniqueIdentifier>
     </Filter>
+    <Filter Include="creature">
+      <UniqueIdentifier>{60e19cec-2b2f-46e7-9de6-e441c26fb1b3}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\..\src\angband.rc" />
index 2cc0c0a..ed01cce 100644 (file)
@@ -52,8 +52,9 @@ hengband_SOURCES = \
        \
        patron.h patron.c \
        \
-       projection.h projection.c\
+       projection.h projection.c \
        \
+       creature.h creature.c \
        player-move.c player-move.h player-damage.c player-damage.h player-status.c player-status.h \
        player-effects.c player-effects.h player-skill.c player-skill.h player-class.c player-class.h \
        player-race.c player-race.h player-pesonality.c player-pesonality.h player-sex.c player-sex.h \
index ae97d81..5dc6d32 100644 (file)
@@ -14,6 +14,8 @@
 #include "util.h"
 #include "core.h"
 
+#include "creature.h"
+
 #include "birth.h"
 #include "bldg.h"
 #include "cmd-activate.h"
diff --git a/src/creature.c b/src/creature.c
new file mode 100644 (file)
index 0000000..64e7d64
--- /dev/null
@@ -0,0 +1,53 @@
+#include "angband.h"
+#include "creature.h"
+
+/*!
+ * @brief 加速値による実質速度修正倍率テーブル /
+ * This table allows quick conversion from "speed" to "energy"
+ * @details
+ * <pre>
+ * The basic function WAS ((S>=110) ? (S-110) : (100 / (120-S)))
+ * Note that table access is *much* quicker than computation.
+ *
+ * Note that the table has been changed at high speeds.  From
+ * "Slow (-40)" to "Fast (+30)" is pretty much unchanged, but
+ * at speeds above "Fast (+30)", one approaches an asymptotic
+ * effective limit of 50 energy per current_world_ptr->game_turn.  This means that it
+ * is relatively easy to reach "Fast (+30)" and get about 40
+ * energy per current_world_ptr->game_turn, but then speed becomes very "expensive",
+ * and you must get all the way to "Fast (+50)" to reach the
+ * point of getting 45 energy per current_world_ptr->game_turn.  After that point,
+ * furthur increases in speed are more or less pointless,
+ * except to balance out heavy p_ptr->inventory_list.
+ *
+ * Note that currently the fastest monster is "Fast (+30)".
+ *
+ * It should be possible to lower the energy threshhold from
+ * 100 units to 50 units, though this may interact badly with
+ * the (compiled out) small random energy boost code.  It may
+ * also tend to cause more "clumping" at high speeds.
+ * </pre>
+ */
+const byte extract_energy[200] =
+{
+       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
+       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
+       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
+       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
+       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
+       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
+       /* S-50 */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
+       /* S-40 */     2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
+       /* S-30 */     2,  2,  2,  2,  2,  2,  2,  3,  3,  3,
+       /* S-20 */     3,  3,  3,  3,  3,  4,  4,  4,  4,  4,
+       /* S-10 */     5,  5,  5,  5,  6,  6,  7,  7,  8,  9,
+       /* Norm */    10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+       /* F+10 */    20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+       /* F+20 */    30, 31, 32, 33, 34, 35, 36, 36, 37, 37,
+       /* F+30 */    38, 38, 39, 39, 40, 40, 40, 41, 41, 41,
+       /* F+40 */    42, 42, 42, 43, 43, 43, 44, 44, 44, 44,
+       /* F+50 */    45, 45, 45, 45, 45, 46, 46, 46, 46, 46,
+       /* F+60 */    47, 47, 47, 47, 47, 48, 48, 48, 48, 48,
+       /* F+70 */    49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+       /* Fast */    49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+};
diff --git a/src/creature.h b/src/creature.h
new file mode 100644 (file)
index 0000000..4ff0dd2
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+/*! @brief \8fÁ\94ï\82·\82é\8ds\93®\83G\83l\83\8b\83M\81[\92l\82ð\90³\8bK\97\90\90\94\82Å\95Ô\82·(\92\86\89\9b100/\95ª\8eU25) / Random energy */
+#define ENERGY_NEED() (randnor(100, 25))
+
+/*! @brief \89Á\91¬\92l\82É\89\9e\82\82½\8aî\96{\8ds\93®\83G\83l\83\8b\83M\81[\8fÁ\94ï\97Ê\82ð\95Ô\82· / Extract energy from speed (Assumes that SPEED is unsigned) */
+#define SPEED_TO_ENERGY(SPEED) (((SPEED) > 199) ? 49 : extract_energy[(SPEED)])
+
+extern const byte extract_energy[200];
index 2340453..5cb3c7b 100644 (file)
 #define SPECIAL_KEY_STORE    253
 #define SPECIAL_KEY_QUIT     252
 
-/*! @brief 消費する行動エネルギー値を正規乱数で返す(中央100/分散25) / Random energy */
-#define ENERGY_NEED() (randnor(100, 25))
-
-/*! @brief 加速値に応じた基本行動エネルギー消費量を返す / Extract energy from speed (Assumes that SPEED is unsigned) */
-#define SPEED_TO_ENERGY(SPEED) (((SPEED) > 199) ? 49 : extract_energy[(SPEED)])
-
 
 /*
  * Misc constants
index dbade25..61d8f42 100644 (file)
@@ -48,7 +48,6 @@ extern const byte adj_dex_safe[];
 extern const byte adj_con_fix[];
 extern const byte adj_con_mhp[];
 extern const byte adj_chr_chm[];
-extern const byte extract_energy[200];
 
 extern const concptr color_names[16];
 extern const concptr stat_names[6];
index ba60cc9..d0f1b46 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "cmd-dump.h"
 #include "cmd-pet.h"
+#include "creature.h"
 #include "melee.h"
 #include "spells.h"
 #include "spells-summon.h"
index 4057153..6a62483 100644 (file)
@@ -1,6 +1,7 @@
 #include "angband.h"
 #include "util.h"
 
+#include "creature.h"
 #include "cmd-dump.h"
 #include "dungeon.h"
 #include "floor.h"
index e419508..489676b 100644 (file)
@@ -35,6 +35,7 @@
 #include "view-mainwindow.h"
 #include "world.h"
 #include "monsterrace.h"
+#include "creature.h"
 
 #define HORDE_NOGOOD 0x01 /*!< (未実装フラグ)HORDE生成でGOODなモンスターの生成を禁止する? */
 #define HORDE_NOEVIL 0x02 /*!< (未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する? */
index 4196a66..7b689b9 100644 (file)
@@ -15,6 +15,8 @@
 #include "angband.h"
 #include "util.h"
 
+#include "creature.h"
+
 #include "artifact.h"
 #include "cmd-dump.h"
 #include "floor.h"
index 9c25fa2..161c2f1 100644 (file)
@@ -14,6 +14,8 @@
 #include "angband.h"
 #include "util.h"
 
+#include "creature.h"
+
 #include "artifact.h"
 #include "cmd-pet.h"
 #include "cmd-dump.h"
index f516d77..2389ab4 100644 (file)
@@ -15,6 +15,8 @@
 #include "bldg.h"
 #include "util.h"
 
+#include "creature.h"
+
 #include "dungeon.h"
 #include "floor.h"
 #include "floor-town.h"
index 4cedfb2..7232d17 100644 (file)
@@ -989,58 +989,6 @@ const byte adj_chr_chm[] =
 };
 
 /*!
- * @brief 加速値による実質速度修正倍率テーブル /
- * This table allows quick conversion from "speed" to "energy"
- * @details
- * <pre>
- * The basic function WAS ((S>=110) ? (S-110) : (100 / (120-S)))
- * Note that table access is *much* quicker than computation.
- *
- * Note that the table has been changed at high speeds.  From
- * "Slow (-40)" to "Fast (+30)" is pretty much unchanged, but
- * at speeds above "Fast (+30)", one approaches an asymptotic
- * effective limit of 50 energy per current_world_ptr->game_turn.  This means that it
- * is relatively easy to reach "Fast (+30)" and get about 40
- * energy per current_world_ptr->game_turn, but then speed becomes very "expensive",
- * and you must get all the way to "Fast (+50)" to reach the
- * point of getting 45 energy per current_world_ptr->game_turn.  After that point,
- * furthur increases in speed are more or less pointless,
- * except to balance out heavy p_ptr->inventory_list.
- *
- * Note that currently the fastest monster is "Fast (+30)".
- *
- * It should be possible to lower the energy threshhold from
- * 100 units to 50 units, though this may interact badly with
- * the (compiled out) small random energy boost code.  It may
- * also tend to cause more "clumping" at high speeds.
- * </pre>
- */
-const byte extract_energy[200] =
-{
-       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-       /* Slow */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-       /* S-50 */     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-       /* S-40 */     2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
-       /* S-30 */     2,  2,  2,  2,  2,  2,  2,  3,  3,  3,
-       /* S-20 */     3,  3,  3,  3,  3,  4,  4,  4,  4,  4,
-       /* S-10 */     5,  5,  5,  5,  6,  6,  7,  7,  8,  9,
-       /* Norm */    10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
-       /* F+10 */    20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
-       /* F+20 */    30, 31, 32, 33, 34, 35, 36, 36, 37, 37,
-       /* F+30 */    38, 38, 39, 39, 40, 40, 40, 41, 41, 41,
-       /* F+40 */    42, 42, 42, 43, 43, 43, 44, 44, 44, 44,
-       /* F+50 */    45, 45, 45, 45, 45, 46, 46, 46, 46, 46,
-       /* F+60 */    47, 47, 47, 47, 47, 48, 48, 48, 48, 48,
-       /* F+70 */    49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-       /* Fast */    49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-};
-
-
-/*!
  * @brief 色名称テーブル / Hack -- the "basic" color names (see "TERM_xxx")
  */
 const concptr color_names[16] =