OSDN Git Service

#37353 トラップ部屋生成処理を rooms.c から rooms-trap.c/h へ分離。
authorDeskull <deskull@users.sourceforge.jp>
Sat, 15 Sep 2018 08:05:54 +0000 (17:05 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Sat, 15 Sep 2018 08:05:54 +0000 (17:05 +0900)
Separate generation of trap room from rooms.c to rooms-trap.c/h.

Hengband_vcs2015/Hengband/Hengband.vcxproj
Hengband_vcs2015/Hengband/Hengband.vcxproj.filters
src/rooms-trap.c [new file with mode: 0644]
src/rooms-trap.h [new file with mode: 0644]
src/rooms.c

index 84720df..c3e6271 100644 (file)
     <ClCompile Include="..\..\src\rooms-city.c" />\r
     <ClCompile Include="..\..\src\rooms-normal.c" />\r
     <ClCompile Include="..\..\src\rooms-pitnest.c" />\r
+    <ClCompile Include="..\..\src\rooms-trap.c" />\r
     <ClCompile Include="..\..\src\rooms-vault.c" />\r
     <ClCompile Include="..\..\src\rooms.c" />\r
     <ClCompile Include="..\..\src\save.c" />\r
     <ClInclude Include="..\..\src\rooms-city.h" />\r
     <ClInclude Include="..\..\src\rooms-normal.h" />\r
     <ClInclude Include="..\..\src\rooms-pitnest.h" />\r
+    <ClInclude Include="..\..\src\rooms-trap.h" />\r
     <ClInclude Include="..\..\src\rooms-vault.h" />\r
     <ClInclude Include="..\..\src\rooms.h" />\r
     <ClInclude Include="..\..\src\selfinfo.h" />\r
index 0bc7d49..a6eadac 100644 (file)
     <ClCompile Include="..\..\src\rooms-city.c">\r
       <Filter>Source</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\src\rooms-trap.c">\r
+      <Filter>Source</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\src\angband.h">\r
     <ClInclude Include="..\..\src\rooms-city.h">\r
       <Filter>Header</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\src\rooms-trap.h">\r
+      <Filter>Header</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ResourceCompile Include="..\..\src\angband.rc" />\r
diff --git a/src/rooms-trap.c b/src/rooms-trap.c
new file mode 100644 (file)
index 0000000..c19c163
--- /dev/null
@@ -0,0 +1,88 @@
+#include "angband.h"\r
+#include "grid.h"\r
+#include "generate.h"\r
+#include "rooms.h"\r
+\r
+\r
+/*!\r
+* @brief \83^\83C\83v14\82Ì\95\94\89®\81c\93Á\8eê\83g\83\89\83b\83v\95\94\89®\82Ì\90\90¬ / Type 14 -- trapped rooms\r
+* @return \82È\82µ\r
+* @details\r
+* A special trap is placed at center of the room\r
+*/\r
+bool build_type14(void)\r
+{\r
+       POSITION y, x, y2, x2, yval, xval;\r
+       POSITION y1, x1, xsize, ysize;\r
+\r
+       bool light;\r
+\r
+       cave_type *c_ptr;\r
+       s16b trap;\r
+\r
+       /* Pick a room size */\r
+       y1 = randint1(4);\r
+       x1 = randint1(11);\r
+       y2 = randint1(3);\r
+       x2 = randint1(11);\r
+\r
+       xsize = x1 + x2 + 1;\r
+       ysize = y1 + y2 + 1;\r
+\r
+       /* Find and reserve some space in the dungeon.  Get center of room. */\r
+       if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;\r
+\r
+       /* Choose lite or dark */\r
+       light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));\r
+\r
+\r
+       /* Get corner values */\r
+       y1 = yval - ysize / 2;\r
+       x1 = xval - xsize / 2;\r
+       y2 = yval + (ysize - 1) / 2;\r
+       x2 = xval + (xsize - 1) / 2;\r
+\r
+\r
+       /* Place a full floor under the room */\r
+       for (y = y1 - 1; y <= y2 + 1; y++)\r
+       {\r
+               for (x = x1 - 1; x <= x2 + 1; x++)\r
+               {\r
+                       c_ptr = &cave[y][x];\r
+                       place_floor_grid(c_ptr);\r
+                       c_ptr->info |= (CAVE_ROOM);\r
+                       if (light) c_ptr->info |= (CAVE_GLOW);\r
+               }\r
+       }\r
+\r
+       /* Walls around the room */\r
+       for (y = y1 - 1; y <= y2 + 1; y++)\r
+       {\r
+               c_ptr = &cave[y][x1 - 1];\r
+               place_outer_grid(c_ptr);\r
+               c_ptr = &cave[y][x2 + 1];\r
+               place_outer_grid(c_ptr);\r
+       }\r
+       for (x = x1 - 1; x <= x2 + 1; x++)\r
+       {\r
+               c_ptr = &cave[y1 - 1][x];\r
+               place_outer_grid(c_ptr);\r
+               c_ptr = &cave[y2 + 1][x];\r
+               place_outer_grid(c_ptr);\r
+       }\r
+\r
+       if (dun_level < 30 + randint1(30))\r
+               trap = feat_trap_piranha;\r
+       else\r
+               trap = feat_trap_armageddon;\r
+\r
+       /* Place a special trap */\r
+       c_ptr = &cave[rand_spread(yval, ysize / 4)][rand_spread(xval, xsize / 4)];\r
+       c_ptr->mimic = c_ptr->feat;\r
+       c_ptr->feat = trap;\r
+\r
+       msg_format_wizard(CHEAT_DUNGEON, _("%s\82Ì\95\94\89®\82ª\90\90¬\82³\82ê\82Ü\82µ\82½\81B", "Room of %s was generated."), f_name + f_info[trap].name);\r
+\r
+       return TRUE;\r
+}\r
+\r
diff --git a/src/rooms-trap.h b/src/rooms-trap.h
new file mode 100644 (file)
index 0000000..d03ed26
--- /dev/null
@@ -0,0 +1 @@
+extern bool build_type14(void);\r
index 8d49cf6..4079e69 100644 (file)
 #include "grid.h"
 #include "rooms.h"
 
+#include "rooms-city.h"
 #include "rooms-normal.h"
 #include "rooms-pitnest.h"
+#include "rooms-trap.h"
 #include "rooms-vault.h"
-#include "rooms-city.h"
 
 
 /*!
@@ -522,9 +523,6 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width)
 
 
 
-
-
-
 /*
  * Structure to hold all "fill" data
  */
@@ -2866,89 +2864,6 @@ static bool build_type10(void)
 
 
 
-/*!
- * @brief タイプ14の部屋…特殊トラップ部屋の生成 / Type 14 -- trapped rooms
- * @return なし
- * @details
- * A special trap is placed at center of the room
- */
-static bool build_type14(void)
-{
-       POSITION y, x, y2, x2, yval, xval;
-       POSITION y1, x1, xsize, ysize;
-
-       bool light;
-
-       cave_type *c_ptr;
-       s16b trap;
-
-       /* Pick a room size */
-       y1 = randint1(4);
-       x1 = randint1(11);
-       y2 = randint1(3);
-       x2 = randint1(11);
-
-       xsize = x1 + x2 + 1;
-       ysize = y1 + y2 + 1;
-
-       /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
-
-       /* Choose lite or dark */
-       light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
-
-
-       /* Get corner values */
-       y1 = yval - ysize / 2;
-       x1 = xval - xsize / 2;
-       y2 = yval + (ysize - 1) / 2;
-       x2 = xval + (xsize - 1) / 2;
-
-
-       /* Place a full floor under the room */
-       for (y = y1 - 1; y <= y2 + 1; y++)
-       {
-               for (x = x1 - 1; x <= x2 + 1; x++)
-               {
-                       c_ptr = &cave[y][x];
-                       place_floor_grid(c_ptr);
-                       c_ptr->info |= (CAVE_ROOM);
-                       if (light) c_ptr->info |= (CAVE_GLOW);
-               }
-       }
-
-       /* Walls around the room */
-       for (y = y1 - 1; y <= y2 + 1; y++)
-       {
-               c_ptr = &cave[y][x1 - 1];
-               place_outer_grid(c_ptr);
-               c_ptr = &cave[y][x2 + 1];
-               place_outer_grid(c_ptr);
-       }
-       for (x = x1 - 1; x <= x2 + 1; x++)
-       {
-               c_ptr = &cave[y1 - 1][x];
-               place_outer_grid(c_ptr);
-               c_ptr = &cave[y2 + 1][x];
-               place_outer_grid(c_ptr);
-       }
-
-       if (dun_level < 30 + randint1(30))
-               trap = feat_trap_piranha;
-       else
-               trap = feat_trap_armageddon;
-
-       /* Place a special trap */
-       c_ptr = &cave[rand_spread(yval, ysize/4)][rand_spread(xval, xsize/4)];
-       c_ptr->mimic = c_ptr->feat;
-       c_ptr->feat = trap;
-
-       msg_format_wizard(CHEAT_DUNGEON, _("%sの部屋が生成されました。", "Room of %s was generated."), f_name + f_info[trap].name);
-
-       return TRUE;
-}
-
-
 /*
  * Helper function for "glass room"
  */