Separate generation of fractal room from rooms.c to rooms-fractal.c/h.
<ClCompile Include="..\..\src\realm-trump.c" />\r
<ClCompile Include="..\..\src\report.c" />\r
<ClCompile Include="..\..\src\rooms-city.c" />\r
+ <ClCompile Include="..\..\src\rooms-fractal.c" />\r
<ClCompile Include="..\..\src\rooms-normal.c" />\r
<ClCompile Include="..\..\src\rooms-pitnest.c" />\r
<ClCompile Include="..\..\src\rooms-special.c" />\r
<ClInclude Include="..\..\src\realm-sorcery.h" />\r
<ClInclude Include="..\..\src\realm-trump.h" />\r
<ClInclude Include="..\..\src\rooms-city.h" />\r
+ <ClInclude Include="..\..\src\rooms-fractal.h" />\r
<ClInclude Include="..\..\src\rooms-normal.h" />\r
<ClInclude Include="..\..\src\rooms-pitnest.h" />\r
<ClInclude Include="..\..\src\rooms-special.h" />\r
<ClCompile Include="..\..\src\rooms-special.c">\r
<Filter>Source</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\src\rooms-fractal.c">\r
+ <Filter>Source</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\src\angband.h">\r
<ClInclude Include="..\..\src\rooms-special.h">\r
<Filter>Header</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\..\src\rooms-fractal.h">\r
+ <Filter>Header</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ResourceCompile Include="..\..\src\angband.rc" />\r
--- /dev/null
+#include "angband.h"\r
+#include "grid.h"\r
+#include "generate.h"\r
+#include "rooms.h"\r
+#include "rooms-normal.h"\r
+\r
+/*!\r
+* @brief \83^\83C\83v9\82Ì\95\94\89®\81c\83t\83\89\83N\83^\83\8b\83J\81[\83u\82É\82æ\82é\93´\8cA\90¶\90¬ / Type 9 -- Driver routine to create fractal cave system\r
+* @return \82È\82µ\r
+*/\r
+bool build_type9(void)\r
+{\r
+ int grd, roug, cutoff;\r
+ POSITION xsize, ysize, y0, x0;\r
+\r
+ bool done, light, room;\r
+\r
+ /* get size: note 'Evenness'*/\r
+ xsize = randint1(22) * 2 + 6;\r
+ ysize = randint1(15) * 2 + 6;\r
+\r
+ /* Find and reserve some space in the dungeon. Get center of room. */\r
+ if (!find_space(&y0, &x0, ysize + 1, xsize + 1))\r
+ {\r
+ /* Limit to the minimum room size, and retry */\r
+ xsize = 8;\r
+ ysize = 8;\r
+\r
+ /* Find and reserve some space in the dungeon. Get center of room. */\r
+ if (!find_space(&y0, &x0, ysize + 1, xsize + 1))\r
+ {\r
+ /*\r
+ * Still no space?!\r
+ * Try normal room\r
+ */\r
+ return build_type1();\r
+ }\r
+ }\r
+\r
+ light = done = FALSE;\r
+ room = TRUE;\r
+\r
+ if ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;\r
+\r
+ while (!done)\r
+ {\r
+ /* Note: size must be even or there are rounding problems\r
+ * This causes the tunnels not to connect properly to the room */\r
+\r
+ /* testing values for these parameters feel free to adjust */\r
+ grd = 1 << (randint0(4));\r
+\r
+ /* want average of about 16 */\r
+ roug = randint1(8) * randint1(4);\r
+\r
+ /* about size/2 */\r
+ cutoff = randint1(xsize / 4) + randint1(ysize / 4) +\r
+ randint1(xsize / 4) + randint1(ysize / 4);\r
+\r
+ /* make it */\r
+ generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);\r
+\r
+ /* Convert to normal format + clean up */\r
+ done = generate_fracave(y0, x0, xsize, ysize, cutoff, light, room);\r
+ }\r
+\r
+ return TRUE;\r
+}\r
--- /dev/null
+\r
+extern bool build_type9(void);\r
#include "rooms.h"
#include "rooms-city.h"
+#include "rooms-fractal.h"
#include "rooms-normal.h"
#include "rooms-pitnest.h"
#include "rooms-special.h"
* small values are good for smooth walls.
* size=length of the side of the square cave system.
*/
-static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug, int cutoff)
+void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug, int cutoff)
{
int xhsize, yhsize, xsize, ysize, maxsize;
}
-static bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, bool light, bool room)
+bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, bool light, bool room)
{
int x, y, i, xhsize, yhsize;
}
-/*!
- * @brief タイプ9の部屋…フラクタルカーブによる洞窟生成 / Type 9 -- Driver routine to create fractal cave system
- * @return なし
- */
-static bool build_type9(void)
-{
- int grd, roug, cutoff;
- POSITION xsize, ysize, y0, x0;
-
- bool done, light, room;
-
- /* get size: note 'Evenness'*/
- xsize = randint1(22) * 2 + 6;
- ysize = randint1(15) * 2 + 6;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(&y0, &x0, ysize + 1, xsize + 1))
- {
- /* Limit to the minimum room size, and retry */
- xsize = 8;
- ysize = 8;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(&y0, &x0, ysize + 1, xsize + 1))
- {
- /*
- * Still no space?!
- * Try normal room
- */
- return build_type1();
- }
- }
-
- light = done = FALSE;
- room = TRUE;
-
- if ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
-
- while (!done)
- {
- /* Note: size must be even or there are rounding problems
- * This causes the tunnels not to connect properly to the room */
-
- /* testing values for these parameters feel free to adjust */
- grd = 1 << (randint0(4));
-
- /* want average of about 16 */
- roug = randint1(8) * randint1(4);
-
- /* about size/2 */
- cutoff = randint1(xsize / 4) + randint1(ysize / 4) +
- randint1(xsize / 4) + randint1(ysize / 4);
-
- /* make it */
- generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
-
- /* Convert to normal format + clean up */
- done = generate_fracave(y0, x0, xsize, ysize, cutoff, light, room);
- }
-
- return TRUE;
-}
-
#ifdef ALLOW_CAVERNS_AND_LAKES
/*
* Builds a cave system in the center of the dungeon.
extern int dist2(int x1, int y1, int x2, int y2, int h1, int h2, int h3, int h4);
extern void generate_room_floor(int y1, int x1, int y2, int x2, int light);
extern void generate_fill_perm_bold(int y1, int x1, int y2, int x2);
+extern void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug, int cutoff);
+extern bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, bool light, bool room);