<ClCompile Include="..\..\src\load\store-loader.c" />\r
<ClCompile Include="..\..\src\load\world-loader.c" />\r
<ClCompile Include="..\..\src\room\cave-filler.c" />\r
+ <ClCompile Include="..\..\src\room\door-definition.c" />\r
<ClCompile Include="..\..\src\room\room-generator.c" />\r
<ClCompile Include="..\..\src\room\room-info-table.c" />\r
<ClCompile Include="..\..\src\room\rooms-maze-vault.c" />\r
<ClInclude Include="..\..\src\load\store-loader.h" />\r
<ClInclude Include="..\..\src\load\world-loader.h" />\r
<ClInclude Include="..\..\src\room\cave-filler.h" />\r
+ <ClInclude Include="..\..\src\room\door-definition.h" />\r
<ClInclude Include="..\..\src\room\lake-types.h" />\r
<ClInclude Include="..\..\src\room\room-generator.h" />\r
<ClInclude Include="..\..\src\room\room-info-table.h" />\r
<ClCompile Include="..\..\src\room\space-finder.c">
<Filter>room</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\room\door-definition.c">
+ <Filter>room</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\combat\shoot.h">
<ClInclude Include="..\..\src\room\space-finder.h">
<Filter>room</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\room\door-definition.h">
+ <Filter>room</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
realm/realm-types.h \
\
room/cave-filler.c room/cave-filler.h \
+ room/door-definition.c room/door-definition.h \
room/lake-types.h room/room-types.h \
room/room-generator.c room/room-generator.h \
room/room-info-table.c room/room-info-table.h \
#include "mind/mind-ninja.h"
#include "monster/monster-update.h"
#include "player/special-defense-types.h"
-#include "room/rooms.h"
+#include "room/door-definition.h"
#include "spell/process-effect.h" // 暫定、後で消す.
#include "spell/spell-types.h"
#include "system/floor-type-definition.h"
#include "object/object-kind.h"
#include "perception/object-perception.h"
#include "player/special-defense-types.h"
-#include "room/rooms.h"
+#include "room/door-definition.h"
#include "system/artifact-type-definition.h"
#include "system/floor-type-definition.h"
#include "util/bit-flags-calculator.h"
#include "grid/trap.h"
#include "info-reader/feature-info-tokens-table.h"
#include "info-reader/parse-error-types.h"
-#include "room/rooms.h"
+#include "room/door-definition.h"
#include "term/gameterm.h"
#include "util/bit-flags-calculator.h"
#include "util/string-processor.h"
--- /dev/null
+#include "room/door-definition.h"
+
+door_type feat_door[MAX_DOOR_TYPES];
--- /dev/null
+#pragma once
+
+#include "system/angband.h"
+
+#define DUN_ROOMS_MAX 40 /*!< 部屋生成処理の最大試行数 / Number of rooms to attempt (was 50) */
+
+/* Maximum locked/jammed doors */
+#define MAX_LJ_DOORS 8
+
+#define MAX_DOOR_TYPES 3
+
+/* A structure type for doors */
+typedef struct door_type {
+ FEAT_IDX open;
+ FEAT_IDX broken;
+ FEAT_IDX closed;
+ FEAT_IDX locked[MAX_LJ_DOORS];
+ FEAT_IDX num_locked;
+ FEAT_IDX jammed[MAX_LJ_DOORS];
+ FEAT_IDX num_jammed;
+} door_type;
+
+extern door_type feat_door[MAX_DOOR_TYPES];
#include "game-option/birth-options.h"
#include "game-option/cheat-types.h"
#include "grid/grid.h"
+#include "room/door-definition.h"
#include "room/room-info-table.h"
#include "room/room-types.h"
#include "room/rooms-city.h"
#include "room/rooms-special.h"
#include "room/rooms-trap.h"
#include "room/rooms-vault.h"
-#include "room/rooms.h"
#include "system/dungeon-data-definition.h"
#include "system/floor-type-definition.h"
#include "wizard/wizard-messages.h"
#include "floor/floor.h"
#include "grid/grid.h"
#include "grid/trap.h"
-#include "room/rooms.h" // todo 相互依存.
+#include "room/door-definition.h"
+#include "room/rooms.h"
#include "room/space-finder.h"
#include "system/floor-type-definition.h"
/*!
-* @brief タイプ1の部屋…通常可変長方形の部屋を生成する / Type 1 -- normal rectangular rooms
-* @param player_ptr プレーヤーへの参照ポインタ
-* @return なし
-*/
+ * @brief タイプ1の部屋…通常可変長方形の部屋を生成する / Type 1 -- normal rectangular rooms
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ */
bool build_type1(player_type *player_ptr)
{
- POSITION y, x, y2, x2, yval, xval;
- POSITION y1, x1, xsize, ysize;
-
- bool light;
-
- grid_type *g_ptr;
-
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- bool curtain = (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
- one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 48 : 512);
-
- /* 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(player_ptr, &yval, &xval, ysize + 2, xsize + 2))
- {
- /* Limit to the minimum room size, and retry */
- y1 = 1;
- x1 = 1;
- y2 = 1;
- x2 = 1;
-
- xsize = x1 + x2 + 1;
- ysize = y1 + y2 + 1;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2)) return FALSE;
- }
-
- /* Choose lite or dark */
- light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].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++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- g_ptr->info |= (CAVE_ROOM);
- if (light) g_ptr->info |= (CAVE_GLOW);
- }
- }
-
- /* Walls around the room */
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1 - 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y][x2 + 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1 - 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y2 + 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
-
-
- /* Hack -- Occasional curtained room */
- if (curtain && (y2 - y1 > 2) && (x2 - x1 > 2))
- {
- for (y = y1; y <= y2; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1];
- g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
- g_ptr->info &= ~(CAVE_MASK);
- g_ptr = &floor_ptr->grid_array[y][x2];
- g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
- g_ptr->info &= ~(CAVE_MASK);
- }
- for (x = x1; x <= x2; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1][x];
- g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
- g_ptr->info &= ~(CAVE_MASK);
- g_ptr = &floor_ptr->grid_array[y2][x];
- g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
- g_ptr->info &= ~(CAVE_MASK);
- }
- }
-
-
- /* Hack -- Occasional pillar room */
- if (one_in_(20))
- {
- for (y = y1; y <= y2; y += 2)
- {
- for (x = x1; x <= x2; x += 2)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- }
- }
-
- /* Hack -- Occasional room with four pillars */
- else if (one_in_(20))
- {
- if ((y1 + 4 < y2) && (x1 + 4 < x2))
- {
- g_ptr = &floor_ptr->grid_array[y1 + 1][x1 + 1];
- place_grid(player_ptr, g_ptr, GB_INNER);
-
- g_ptr = &floor_ptr->grid_array[y1 + 1][x2 - 1];
- place_grid(player_ptr, g_ptr, GB_INNER);
-
- g_ptr = &floor_ptr->grid_array[y2 - 1][x1 + 1];
- place_grid(player_ptr, g_ptr, GB_INNER);
-
- g_ptr = &floor_ptr->grid_array[y2 - 1][x2 - 1];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- }
-
- /* Hack -- Occasional ragged-edge room */
- else if (one_in_(50))
- {
- for (y = y1 + 2; y <= y2 - 2; y += 2)
- {
- g_ptr = &floor_ptr->grid_array[y][x1];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y][x2];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- for (x = x1 + 2; x <= x2 - 2; x += 2)
- {
- g_ptr = &floor_ptr->grid_array[y1][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y2][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- }
- /* Hack -- Occasional divided room */
- else if (one_in_(50))
- {
- bool curtain2 = (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
- one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 2 : 128);
-
- if (randint1(100) < 50)
- {
- /* Horizontal wall */
- for (x = x1; x <= x2; x++)
- {
- place_bold(player_ptr, yval, x, GB_INNER);
- if (curtain2) floor_ptr->grid_array[yval][x].feat = feat_door[DOOR_CURTAIN].closed;
- }
-
- /* Prevent edge of wall from being tunneled */
- place_bold(player_ptr, yval, x1 - 1, GB_SOLID);
- place_bold(player_ptr, yval, x2 + 1, GB_SOLID);
- }
- else
- {
- /* Vertical wall */
- for (y = y1; y <= y2; y++)
- {
- place_bold(player_ptr, y, xval, GB_INNER);
- if (curtain2) floor_ptr->grid_array[y][xval].feat = feat_door[DOOR_CURTAIN].closed;
- }
-
- /* Prevent edge of wall from being tunneled */
- place_bold(player_ptr, y1 - 1, xval, GB_SOLID);
- place_bold(player_ptr, y2 + 1, xval, GB_SOLID);
- }
-
- place_random_door(player_ptr, yval, xval, TRUE);
- if (curtain2) floor_ptr->grid_array[yval][xval].feat = feat_door[DOOR_CURTAIN].closed;
- }
-
- return TRUE;
+ POSITION y, x, y2, x2, yval, xval;
+ POSITION y1, x1, xsize, ysize;
+
+ bool light;
+
+ grid_type *g_ptr;
+
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ bool curtain = (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 48 : 512);
+
+ /* 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(player_ptr, &yval, &xval, ysize + 2, xsize + 2)) {
+ /* Limit to the minimum room size, and retry */
+ y1 = 1;
+ x1 = 1;
+ y2 = 1;
+ x2 = 1;
+
+ xsize = x1 + x2 + 1;
+ ysize = y1 + y2 + 1;
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2))
+ return FALSE;
+ }
+
+ /* Choose lite or dark */
+ light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].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++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ g_ptr->info |= (CAVE_ROOM);
+ if (light)
+ g_ptr->info |= (CAVE_GLOW);
+ }
+ }
+
+ /* Walls around the room */
+ for (y = y1 - 1; y <= y2 + 1; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1 - 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y][x2 + 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+ for (x = x1 - 1; x <= x2 + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y1 - 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y2 + 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+
+ /* Hack -- Occasional curtained room */
+ if (curtain && (y2 - y1 > 2) && (x2 - x1 > 2)) {
+ for (y = y1; y <= y2; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1];
+ g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
+ g_ptr->info &= ~(CAVE_MASK);
+ g_ptr = &floor_ptr->grid_array[y][x2];
+ g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
+ g_ptr->info &= ~(CAVE_MASK);
+ }
+ for (x = x1; x <= x2; x++) {
+ g_ptr = &floor_ptr->grid_array[y1][x];
+ g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
+ g_ptr->info &= ~(CAVE_MASK);
+ g_ptr = &floor_ptr->grid_array[y2][x];
+ g_ptr->feat = feat_door[DOOR_CURTAIN].closed;
+ g_ptr->info &= ~(CAVE_MASK);
+ }
+ }
+
+ /* Hack -- Occasional pillar room */
+ if (one_in_(20)) {
+ for (y = y1; y <= y2; y += 2) {
+ for (x = x1; x <= x2; x += 2) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ }
+ }
+
+ /* Hack -- Occasional room with four pillars */
+ else if (one_in_(20)) {
+ if ((y1 + 4 < y2) && (x1 + 4 < x2)) {
+ g_ptr = &floor_ptr->grid_array[y1 + 1][x1 + 1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+
+ g_ptr = &floor_ptr->grid_array[y1 + 1][x2 - 1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+
+ g_ptr = &floor_ptr->grid_array[y2 - 1][x1 + 1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+
+ g_ptr = &floor_ptr->grid_array[y2 - 1][x2 - 1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ }
+
+ /* Hack -- Occasional ragged-edge room */
+ else if (one_in_(50)) {
+ for (y = y1 + 2; y <= y2 - 2; y += 2) {
+ g_ptr = &floor_ptr->grid_array[y][x1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y][x2];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ for (x = x1 + 2; x <= x2 - 2; x += 2) {
+ g_ptr = &floor_ptr->grid_array[y1][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y2][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ }
+ /* Hack -- Occasional divided room */
+ else if (one_in_(50)) {
+ bool curtain2 = (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 2 : 128);
+
+ if (randint1(100) < 50) {
+ /* Horizontal wall */
+ for (x = x1; x <= x2; x++) {
+ place_bold(player_ptr, yval, x, GB_INNER);
+ if (curtain2)
+ floor_ptr->grid_array[yval][x].feat = feat_door[DOOR_CURTAIN].closed;
+ }
+
+ /* Prevent edge of wall from being tunneled */
+ place_bold(player_ptr, yval, x1 - 1, GB_SOLID);
+ place_bold(player_ptr, yval, x2 + 1, GB_SOLID);
+ } else {
+ /* Vertical wall */
+ for (y = y1; y <= y2; y++) {
+ place_bold(player_ptr, y, xval, GB_INNER);
+ if (curtain2)
+ floor_ptr->grid_array[y][xval].feat = feat_door[DOOR_CURTAIN].closed;
+ }
+
+ /* Prevent edge of wall from being tunneled */
+ place_bold(player_ptr, y1 - 1, xval, GB_SOLID);
+ place_bold(player_ptr, y2 + 1, xval, GB_SOLID);
+ }
+
+ place_random_door(player_ptr, yval, xval, TRUE);
+ if (curtain2)
+ floor_ptr->grid_array[yval][xval].feat = feat_door[DOOR_CURTAIN].closed;
+ }
+
+ return TRUE;
}
/*!
-* @brief タイプ2の部屋…二重長方形の部屋を生成する / Type 2 -- Overlapping rectangular rooms
-* @param player_ptr プレーヤーへの参照ポインタ
-* @return なし
-*/
+ * @brief タイプ2の部屋…二重長方形の部屋を生成する / Type 2 -- Overlapping rectangular rooms
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ */
bool build_type2(player_type *player_ptr)
{
- POSITION y, x, xval, yval;
- POSITION y1a, x1a, y2a, x2a;
- POSITION y1b, x1b, y2b, x2b;
- bool light;
- grid_type *g_ptr;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if (!find_space(player_ptr, &yval, &xval, 11, 25)) return FALSE;
-
- /* Choose lite or dark */
- light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
-
- /* Determine extents of the first room */
- y1a = yval - randint1(4);
- y2a = yval + randint1(3);
- x1a = xval - randint1(11);
- x2a = xval + randint1(10);
-
- /* Determine extents of the second room */
- y1b = yval - randint1(3);
- y2b = yval + randint1(4);
- x1b = xval - randint1(10);
- x2b = xval + randint1(11);
-
-
- /* Place a full floor for room "a" */
- for (y = y1a - 1; y <= y2a + 1; y++)
- {
- for (x = x1a - 1; x <= x2a + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- g_ptr->info |= (CAVE_ROOM);
- if (light) g_ptr->info |= (CAVE_GLOW);
- }
- }
-
- /* Place a full floor for room "b" */
- for (y = y1b - 1; y <= y2b + 1; y++)
- {
- for (x = x1b - 1; x <= x2b + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- g_ptr->info |= (CAVE_ROOM);
- if (light) g_ptr->info |= (CAVE_GLOW);
- }
- }
-
-
- /* Place the walls around room "a" */
- for (y = y1a - 1; y <= y2a + 1; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1a - 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y][x2a + 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
- for (x = x1a - 1; x <= x2a + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1a - 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y2a + 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
-
- /* Place the walls around room "b" */
- for (y = y1b - 1; y <= y2b + 1; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1b - 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y][x2b + 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
- for (x = x1b - 1; x <= x2b + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1b - 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y2b + 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
-
-
-
- /* Replace the floor for room "a" */
- for (y = y1a; y <= y2a; y++)
- {
- for (x = x1a; x <= x2a; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- }
- }
-
- /* Replace the floor for room "b" */
- for (y = y1b; y <= y2b; y++)
- {
- for (x = x1b; x <= x2b; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- }
- }
-
- return TRUE;
+ POSITION y, x, xval, yval;
+ POSITION y1a, x1a, y2a, x2a;
+ POSITION y1b, x1b, y2b, x2b;
+ bool light;
+ grid_type *g_ptr;
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if (!find_space(player_ptr, &yval, &xval, 11, 25))
+ return FALSE;
+
+ /* Choose lite or dark */
+ light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
+
+ /* Determine extents of the first room */
+ y1a = yval - randint1(4);
+ y2a = yval + randint1(3);
+ x1a = xval - randint1(11);
+ x2a = xval + randint1(10);
+
+ /* Determine extents of the second room */
+ y1b = yval - randint1(3);
+ y2b = yval + randint1(4);
+ x1b = xval - randint1(10);
+ x2b = xval + randint1(11);
+
+ /* Place a full floor for room "a" */
+ for (y = y1a - 1; y <= y2a + 1; y++) {
+ for (x = x1a - 1; x <= x2a + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ g_ptr->info |= (CAVE_ROOM);
+ if (light)
+ g_ptr->info |= (CAVE_GLOW);
+ }
+ }
+
+ /* Place a full floor for room "b" */
+ for (y = y1b - 1; y <= y2b + 1; y++) {
+ for (x = x1b - 1; x <= x2b + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ g_ptr->info |= (CAVE_ROOM);
+ if (light)
+ g_ptr->info |= (CAVE_GLOW);
+ }
+ }
+
+ /* Place the walls around room "a" */
+ for (y = y1a - 1; y <= y2a + 1; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1a - 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y][x2a + 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+ for (x = x1a - 1; x <= x2a + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y1a - 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y2a + 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+
+ /* Place the walls around room "b" */
+ for (y = y1b - 1; y <= y2b + 1; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1b - 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y][x2b + 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+ for (x = x1b - 1; x <= x2b + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y1b - 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y2b + 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+
+ /* Replace the floor for room "a" */
+ for (y = y1a; y <= y2a; y++) {
+ for (x = x1a; x <= x2a; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ }
+ }
+
+ /* Replace the floor for room "b" */
+ for (y = y1b; y <= y2b; y++) {
+ for (x = x1b; x <= x2b; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ }
+ }
+
+ return TRUE;
}
/*!
-* @brief タイプ3の部屋…十字型の部屋を生成する / Type 3 -- Cross shaped rooms
-* @param player_ptr プレーヤーへの参照ポインタ
-* @return なし
-* @details
-* Builds a room at a row, column coordinate\n
-*\n
-* Room "a" runs north/south, and Room "b" runs east/east\n
-* So the "central pillar" runs from x1a, y1b to x2a, y2b.\n
-*\n
-* Note that currently, the "center" is always 3x3, but I think that\n
-* the code below will work (with "bounds checking") for 5x5, or even\n
-* for unsymetric values like 4x3 or 5x3 or 3x4 or 3x5, or even larger.\n
-*/
+ * @brief タイプ3の部屋…十字型の部屋を生成する / Type 3 -- Cross shaped rooms
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @details
+ * Builds a room at a row, column coordinate\n
+ *\n
+ * Room "a" runs north/south, and Room "b" runs east/east\n
+ * So the "central pillar" runs from x1a, y1b to x2a, y2b.\n
+ *\n
+ * Note that currently, the "center" is always 3x3, but I think that\n
+ * the code below will work (with "bounds checking") for 5x5, or even\n
+ * for unsymetric values like 4x3 or 5x3 or 3x4 or 3x5, or even larger.\n
+ */
bool build_type3(player_type *player_ptr)
{
- POSITION y, x, dy, dx, wy, wx;
- POSITION y1a, x1a, y2a, x2a;
- POSITION y1b, x1b, y2b, x2b;
- POSITION yval, xval;
- bool light;
- grid_type *g_ptr;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if (!find_space(player_ptr, &yval, &xval, 11, 25)) return FALSE;
-
-
- /* Choose lite or dark */
- light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
-
- /* For now, always 3x3 */
- wx = wy = 1;
-
- /* Pick max vertical size (at most 4) */
- dy = rand_range(3, 4);
-
- /* Pick max horizontal size (at most 15) */
- dx = rand_range(3, 11);
-
-
- /* Determine extents of the north/south room */
- y1a = yval - dy;
- y2a = yval + dy;
- x1a = xval - wx;
- x2a = xval + wx;
-
- /* Determine extents of the east/west room */
- y1b = yval - wy;
- y2b = yval + wy;
- x1b = xval - dx;
- x2b = xval + dx;
-
-
- /* Place a full floor for room "a" */
- for (y = y1a - 1; y <= y2a + 1; y++)
- {
- for (x = x1a - 1; x <= x2a + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- g_ptr->info |= (CAVE_ROOM);
- if (light) g_ptr->info |= (CAVE_GLOW);
- }
- }
-
- /* Place a full floor for room "b" */
- for (y = y1b - 1; y <= y2b + 1; y++)
- {
- for (x = x1b - 1; x <= x2b + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- g_ptr->info |= (CAVE_ROOM);
- if (light) g_ptr->info |= (CAVE_GLOW);
- }
- }
-
-
- /* Place the walls around room "a" */
- for (y = y1a - 1; y <= y2a + 1; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1a - 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y][x2a + 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
- for (x = x1a - 1; x <= x2a + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1a - 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y2a + 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
-
- /* Place the walls around room "b" */
- for (y = y1b - 1; y <= y2b + 1; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1b - 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y][x2b + 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
- for (x = x1b - 1; x <= x2b + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1b - 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y2b + 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
-
-
- /* Replace the floor for room "a" */
- for (y = y1a; y <= y2a; y++)
- {
- for (x = x1a; x <= x2a; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- }
- }
-
- /* Replace the floor for room "b" */
- for (y = y1b; y <= y2b; y++)
- {
- for (x = x1b; x <= x2b; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- }
- }
-
-
-
- /* Special features (3/4) */
- switch (randint0(4))
- {
- /* Large solid middle pillar */
- case 1:
- {
- for (y = y1b; y <= y2b; y++)
- {
- for (x = x1a; x <= x2a; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- }
- break;
- }
-
- /* Inner treasure vault */
- case 2:
- {
- /* Build the vault */
- for (y = y1b; y <= y2b; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1a];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y][x2a];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- for (x = x1a; x <= x2a; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1b][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y2b][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
-
- /* Place a secret door on the inner room */
- switch (randint0(4))
- {
- case 0: place_secret_door(player_ptr, y1b, xval, DOOR_DEFAULT); break;
- case 1: place_secret_door(player_ptr, y2b, xval, DOOR_DEFAULT); break;
- case 2: place_secret_door(player_ptr, yval, x1a, DOOR_DEFAULT); break;
- case 3: place_secret_door(player_ptr, yval, x2a, DOOR_DEFAULT); break;
- }
-
- /* Place a treasure in the vault */
- place_object(player_ptr, yval, xval, 0L);
-
- /* Let's guard the treasure well */
- vault_monsters(player_ptr, yval, xval, randint0(2) + 3);
-
- /* Traps naturally */
- vault_traps(player_ptr, yval, xval, 4, 4, randint0(3) + 2);
-
- break;
- }
-
- /* Something else */
- case 3:
- {
- /* Occasionally pinch the center shut */
- if (one_in_(3))
- {
- /* Pinch the east/west sides */
- for (y = y1b; y <= y2b; y++)
- {
- if (y == yval) continue;
- g_ptr = &floor_ptr->grid_array[y][x1a - 1];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y][x2a + 1];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
-
- /* Pinch the north/south sides */
- for (x = x1a; x <= x2a; x++)
- {
- if (x == xval) continue;
- g_ptr = &floor_ptr->grid_array[y1b - 1][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y2b + 1][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
-
- /* Sometimes shut using secret doors */
- if (one_in_(3))
- {
- int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
- one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
- ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
-
- place_secret_door(player_ptr, yval, x1a - 1, door_type);
- place_secret_door(player_ptr, yval, x2a + 1, door_type);
- place_secret_door(player_ptr, y1b - 1, xval, door_type);
- place_secret_door(player_ptr, y2b + 1, xval, door_type);
- }
- }
-
- /* Occasionally put a "plus" in the center */
- else if (one_in_(3))
- {
- g_ptr = &floor_ptr->grid_array[yval][xval];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y1b][xval];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y2b][xval];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[yval][x1a];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[yval][x2a];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
-
- /* Occasionally put a pillar in the center */
- else if (one_in_(3))
- {
- g_ptr = &floor_ptr->grid_array[yval][xval];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
-
- break;
- }
- }
-
- return TRUE;
+ POSITION y, x, dy, dx, wy, wx;
+ POSITION y1a, x1a, y2a, x2a;
+ POSITION y1b, x1b, y2b, x2b;
+ POSITION yval, xval;
+ bool light;
+ grid_type *g_ptr;
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if (!find_space(player_ptr, &yval, &xval, 11, 25))
+ return FALSE;
+
+ /* Choose lite or dark */
+ light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
+
+ /* For now, always 3x3 */
+ wx = wy = 1;
+
+ /* Pick max vertical size (at most 4) */
+ dy = rand_range(3, 4);
+
+ /* Pick max horizontal size (at most 15) */
+ dx = rand_range(3, 11);
+
+ /* Determine extents of the north/south room */
+ y1a = yval - dy;
+ y2a = yval + dy;
+ x1a = xval - wx;
+ x2a = xval + wx;
+
+ /* Determine extents of the east/west room */
+ y1b = yval - wy;
+ y2b = yval + wy;
+ x1b = xval - dx;
+ x2b = xval + dx;
+
+ /* Place a full floor for room "a" */
+ for (y = y1a - 1; y <= y2a + 1; y++) {
+ for (x = x1a - 1; x <= x2a + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ g_ptr->info |= (CAVE_ROOM);
+ if (light)
+ g_ptr->info |= (CAVE_GLOW);
+ }
+ }
+
+ /* Place a full floor for room "b" */
+ for (y = y1b - 1; y <= y2b + 1; y++) {
+ for (x = x1b - 1; x <= x2b + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ g_ptr->info |= (CAVE_ROOM);
+ if (light)
+ g_ptr->info |= (CAVE_GLOW);
+ }
+ }
+
+ /* Place the walls around room "a" */
+ for (y = y1a - 1; y <= y2a + 1; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1a - 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y][x2a + 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+ for (x = x1a - 1; x <= x2a + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y1a - 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y2a + 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+
+ /* Place the walls around room "b" */
+ for (y = y1b - 1; y <= y2b + 1; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1b - 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y][x2b + 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+ for (x = x1b - 1; x <= x2b + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y1b - 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y2b + 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+
+ /* Replace the floor for room "a" */
+ for (y = y1a; y <= y2a; y++) {
+ for (x = x1a; x <= x2a; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ }
+ }
+
+ /* Replace the floor for room "b" */
+ for (y = y1b; y <= y2b; y++) {
+ for (x = x1b; x <= x2b; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ }
+ }
+
+ /* Special features (3/4) */
+ switch (randint0(4)) {
+ /* Large solid middle pillar */
+ case 1: {
+ for (y = y1b; y <= y2b; y++) {
+ for (x = x1a; x <= x2a; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ }
+ break;
+ }
+
+ /* Inner treasure vault */
+ case 2: {
+ /* Build the vault */
+ for (y = y1b; y <= y2b; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1a];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y][x2a];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ for (x = x1a; x <= x2a; x++) {
+ g_ptr = &floor_ptr->grid_array[y1b][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y2b][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+
+ /* Place a secret door on the inner room */
+ switch (randint0(4)) {
+ case 0:
+ place_secret_door(player_ptr, y1b, xval, DOOR_DEFAULT);
+ break;
+ case 1:
+ place_secret_door(player_ptr, y2b, xval, DOOR_DEFAULT);
+ break;
+ case 2:
+ place_secret_door(player_ptr, yval, x1a, DOOR_DEFAULT);
+ break;
+ case 3:
+ place_secret_door(player_ptr, yval, x2a, DOOR_DEFAULT);
+ break;
+ }
+
+ /* Place a treasure in the vault */
+ place_object(player_ptr, yval, xval, 0L);
+
+ /* Let's guard the treasure well */
+ vault_monsters(player_ptr, yval, xval, randint0(2) + 3);
+
+ /* Traps naturally */
+ vault_traps(player_ptr, yval, xval, 4, 4, randint0(3) + 2);
+
+ break;
+ }
+
+ /* Something else */
+ case 3: {
+ /* Occasionally pinch the center shut */
+ if (one_in_(3)) {
+ /* Pinch the east/west sides */
+ for (y = y1b; y <= y2b; y++) {
+ if (y == yval)
+ continue;
+ g_ptr = &floor_ptr->grid_array[y][x1a - 1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y][x2a + 1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+
+ /* Pinch the north/south sides */
+ for (x = x1a; x <= x2a; x++) {
+ if (x == xval)
+ continue;
+ g_ptr = &floor_ptr->grid_array[y1b - 1][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y2b + 1][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+
+ /* Sometimes shut using secret doors */
+ if (one_in_(3)) {
+ int door_type
+ = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256))
+ ? DOOR_CURTAIN
+ : ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
+
+ place_secret_door(player_ptr, yval, x1a - 1, door_type);
+ place_secret_door(player_ptr, yval, x2a + 1, door_type);
+ place_secret_door(player_ptr, y1b - 1, xval, door_type);
+ place_secret_door(player_ptr, y2b + 1, xval, door_type);
+ }
+ }
+
+ /* Occasionally put a "plus" in the center */
+ else if (one_in_(3)) {
+ g_ptr = &floor_ptr->grid_array[yval][xval];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y1b][xval];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y2b][xval];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[yval][x1a];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[yval][x2a];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+
+ /* Occasionally put a pillar in the center */
+ else if (one_in_(3)) {
+ g_ptr = &floor_ptr->grid_array[yval][xval];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+
+ break;
+ }
+ }
+
+ return TRUE;
}
/*!
-* @brief タイプ4の部屋…固定サイズの二重構造部屋を生成する / Type 4 -- Large room with inner features
-* @param player_ptr プレーヤーへの参照ポインタ
-* @return なし
-* @details
-* Possible sub-types:\n
-* 1 - Just an inner room with one door\n
-* 2 - An inner room within an inner room\n
-* 3 - An inner room with pillar(s)\n
-* 4 - Inner room has a maze\n
-* 5 - A set of four inner rooms\n
-*/
+ * @brief タイプ4の部屋…固定サイズの二重構造部屋を生成する / Type 4 -- Large room with inner features
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @details
+ * Possible sub-types:\n
+ * 1 - Just an inner room with one door\n
+ * 2 - An inner room within an inner room\n
+ * 3 - An inner room with pillar(s)\n
+ * 4 - Inner room has a maze\n
+ * 5 - A set of four inner rooms\n
+ */
bool build_type4(player_type *player_ptr)
{
- POSITION y, x, y1, x1;
- POSITION y2, x2, tmp, yval, xval;
- bool light;
- grid_type *g_ptr;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if (!find_space(player_ptr, &yval, &xval, 11, 25)) return FALSE;
-
- /* Choose lite or dark */
- light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
-
- /* Large room */
- y1 = yval - 4;
- y2 = yval + 4;
- x1 = xval - 11;
- x2 = xval + 11;
-
- /* Place a full floor under the room */
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_FLOOR);
- g_ptr->info |= (CAVE_ROOM);
- if (light) g_ptr->info |= (CAVE_GLOW);
- }
- }
-
- /* Outer Walls */
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1 - 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y][x2 + 1];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1 - 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- g_ptr = &floor_ptr->grid_array[y2 + 1][x];
- place_grid(player_ptr, g_ptr, GB_OUTER);
- }
-
-
- /* The inner room */
- y1 = y1 + 2;
- y2 = y2 - 2;
- x1 = x1 + 2;
- x2 = x2 - 2;
-
- /* The inner walls */
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][x1 - 1];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y][x2 + 1];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y1 - 1][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[y2 + 1][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
-
-
- /* Inner room variations */
- switch (randint1(5))
- {
- /* Just an inner room with a monster */
- case 1:
- {
- /* Place a secret door */
- switch (randint1(4))
- {
- case 1: place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
- case 2: place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
- case 3: place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
- case 4: place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
- }
-
- /* Place a monster in the room */
- vault_monsters(player_ptr, yval, xval, 1);
-
- break;
- }
-
- /* Treasure Vault (with a door) */
- case 2:
- {
- /* Place a secret door */
- switch (randint1(4))
- {
- case 1: place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
- case 2: place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
- case 3: place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
- case 4: place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
- }
-
- /* Place another inner room */
- for (y = yval - 1; y <= yval + 1; y++)
- {
- for (x = xval - 1; x <= xval + 1; x++)
- {
- if ((x == xval) && (y == yval)) continue;
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- }
-
- /* Place a locked door on the inner room */
- switch (randint1(4))
- {
- case 1: place_locked_door(player_ptr, yval - 1, xval); break;
- case 2: place_locked_door(player_ptr, yval + 1, xval); break;
- case 3: place_locked_door(player_ptr, yval, xval - 1); break;
- case 4: place_locked_door(player_ptr, yval, xval + 1); break;
- }
-
- /* Monsters to guard the "treasure" */
- vault_monsters(player_ptr, yval, xval, randint1(3) + 2);
-
- /* Object (80%) */
- if (randint0(100) < 80)
- {
- place_object(player_ptr, yval, xval, 0L);
- }
-
- /* Stairs (20%) */
- else
- {
- place_random_stairs(player_ptr, yval, xval);
- }
-
- /* Traps to protect the treasure */
- vault_traps(player_ptr, yval, xval, 4, 10, 2 + randint1(3));
-
- break;
- }
-
- /* Inner pillar(s). */
- case 3:
- {
- /* Place a secret door */
- switch (randint1(4))
- {
- case 1: place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
- case 2: place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
- case 3: place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
- case 4: place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
- }
-
- /* Large Inner Pillar */
- for (y = yval - 1; y <= yval + 1; y++)
- {
- for (x = xval - 1; x <= xval + 1; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- }
-
- /* Occasionally, two more Large Inner Pillars */
- if (one_in_(2))
- {
- tmp = randint1(2);
- for (y = yval - 1; y <= yval + 1; y++)
- {
- for (x = xval - 5 - tmp; x <= xval - 3 - tmp; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- for (x = xval + 3 + tmp; x <= xval + 5 + tmp; x++)
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- }
- }
-
- /* Occasionally, some Inner rooms */
- if (one_in_(3))
- {
- int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
- one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
- ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
-
- /* Long horizontal walls */
- for (x = xval - 5; x <= xval + 5; x++)
- {
- g_ptr = &floor_ptr->grid_array[yval - 1][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[yval + 1][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
-
- /* Close off the left/right edges */
- g_ptr = &floor_ptr->grid_array[yval][xval - 5];
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr = &floor_ptr->grid_array[yval][xval + 5];
- place_grid(player_ptr, g_ptr, GB_INNER);
-
- /* Secret doors (random top/bottom) */
- place_secret_door(player_ptr, yval - 3 + (randint1(2) * 2), xval - 3, door_type);
- place_secret_door(player_ptr, yval - 3 + (randint1(2) * 2), xval + 3, door_type);
-
- /* Monsters */
- vault_monsters(player_ptr, yval, xval - 2, randint1(2));
- vault_monsters(player_ptr, yval, xval + 2, randint1(2));
-
- /* Objects */
- if (one_in_(3)) place_object(player_ptr, yval, xval - 2, 0L);
- if (one_in_(3)) place_object(player_ptr, yval, xval + 2, 0L);
- }
-
- break;
- }
-
- /* Maze inside. */
- case 4:
- {
- /* Place a secret door */
- switch (randint1(4))
- {
- case 1: place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT); break;
- case 2: place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT); break;
- case 3: place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT); break;
- case 4: place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT); break;
- }
-
- /* Maze (really a checkerboard) */
- for (y = y1; y <= y2; y++)
- {
- for (x = x1; x <= x2; x++)
- {
- if (0x1 & (x + y))
- {
- g_ptr = &floor_ptr->grid_array[y][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- }
- }
-
- /* Monsters just love mazes. */
- vault_monsters(player_ptr, yval, xval - 5, randint1(3));
- vault_monsters(player_ptr, yval, xval + 5, randint1(3));
-
- /* Traps make them entertaining. */
- vault_traps(player_ptr, yval, xval - 3, 2, 8, randint1(3));
- vault_traps(player_ptr, yval, xval + 3, 2, 8, randint1(3));
-
- /* Mazes should have some treasure too. */
- vault_objects(player_ptr, yval, xval, 3);
-
- break;
- }
-
- /* Four small rooms. */
- case 5:
- {
- int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) &&
- one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
- ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
-
- /* Inner "cross" */
- for (y = y1; y <= y2; y++)
- {
- g_ptr = &floor_ptr->grid_array[y][xval];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
- for (x = x1; x <= x2; x++)
- {
- g_ptr = &floor_ptr->grid_array[yval][x];
- place_grid(player_ptr, g_ptr, GB_INNER);
- }
-
- /* Doors into the rooms */
- if (randint0(100) < 50)
- {
- int i = randint1(10);
- place_secret_door(player_ptr, y1 - 1, xval - i, door_type);
- place_secret_door(player_ptr, y1 - 1, xval + i, door_type);
- place_secret_door(player_ptr, y2 + 1, xval - i, door_type);
- place_secret_door(player_ptr, y2 + 1, xval + i, door_type);
- }
- else
- {
- int i = randint1(3);
- place_secret_door(player_ptr, yval + i, x1 - 1, door_type);
- place_secret_door(player_ptr, yval - i, x1 - 1, door_type);
- place_secret_door(player_ptr, yval + i, x2 + 1, door_type);
- place_secret_door(player_ptr, yval - i, x2 + 1, door_type);
- }
-
- /* Treasure, centered at the center of the cross */
- vault_objects(player_ptr, yval, xval, 2 + randint1(2));
-
- /* Gotta have some monsters. */
- vault_monsters(player_ptr, yval + 1, xval - 4, randint1(4));
- vault_monsters(player_ptr, yval + 1, xval + 4, randint1(4));
- vault_monsters(player_ptr, yval - 1, xval - 4, randint1(4));
- vault_monsters(player_ptr, yval - 1, xval + 4, randint1(4));
-
- break;
- }
- }
-
- return TRUE;
+ POSITION y, x, y1, x1;
+ POSITION y2, x2, tmp, yval, xval;
+ bool light;
+ grid_type *g_ptr;
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if (!find_space(player_ptr, &yval, &xval, 11, 25))
+ return FALSE;
+
+ /* Choose lite or dark */
+ light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
+
+ /* Large room */
+ y1 = yval - 4;
+ y2 = yval + 4;
+ x1 = xval - 11;
+ x2 = xval + 11;
+
+ /* Place a full floor under the room */
+ for (y = y1 - 1; y <= y2 + 1; y++) {
+ for (x = x1 - 1; x <= x2 + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+ g_ptr->info |= (CAVE_ROOM);
+ if (light)
+ g_ptr->info |= (CAVE_GLOW);
+ }
+ }
+
+ /* Outer Walls */
+ for (y = y1 - 1; y <= y2 + 1; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1 - 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y][x2 + 1];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+ for (x = x1 - 1; x <= x2 + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y1 - 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ g_ptr = &floor_ptr->grid_array[y2 + 1][x];
+ place_grid(player_ptr, g_ptr, GB_OUTER);
+ }
+
+ /* The inner room */
+ y1 = y1 + 2;
+ y2 = y2 - 2;
+ x1 = x1 + 2;
+ x2 = x2 - 2;
+
+ /* The inner walls */
+ for (y = y1 - 1; y <= y2 + 1; y++) {
+ g_ptr = &floor_ptr->grid_array[y][x1 - 1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y][x2 + 1];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ for (x = x1 - 1; x <= x2 + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y1 - 1][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[y2 + 1][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+
+ /* Inner room variations */
+ switch (randint1(5)) {
+ /* Just an inner room with a monster */
+ case 1: {
+ /* Place a secret door */
+ switch (randint1(4)) {
+ case 1:
+ place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
+ break;
+ case 2:
+ place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
+ break;
+ case 3:
+ place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
+ break;
+ case 4:
+ place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
+ break;
+ }
+
+ /* Place a monster in the room */
+ vault_monsters(player_ptr, yval, xval, 1);
+
+ break;
+ }
+
+ /* Treasure Vault (with a door) */
+ case 2: {
+ /* Place a secret door */
+ switch (randint1(4)) {
+ case 1:
+ place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
+ break;
+ case 2:
+ place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
+ break;
+ case 3:
+ place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
+ break;
+ case 4:
+ place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
+ break;
+ }
+
+ /* Place another inner room */
+ for (y = yval - 1; y <= yval + 1; y++) {
+ for (x = xval - 1; x <= xval + 1; x++) {
+ if ((x == xval) && (y == yval))
+ continue;
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ }
+
+ /* Place a locked door on the inner room */
+ switch (randint1(4)) {
+ case 1:
+ place_locked_door(player_ptr, yval - 1, xval);
+ break;
+ case 2:
+ place_locked_door(player_ptr, yval + 1, xval);
+ break;
+ case 3:
+ place_locked_door(player_ptr, yval, xval - 1);
+ break;
+ case 4:
+ place_locked_door(player_ptr, yval, xval + 1);
+ break;
+ }
+
+ /* Monsters to guard the "treasure" */
+ vault_monsters(player_ptr, yval, xval, randint1(3) + 2);
+
+ /* Object (80%) */
+ if (randint0(100) < 80) {
+ place_object(player_ptr, yval, xval, 0L);
+ }
+
+ /* Stairs (20%) */
+ else {
+ place_random_stairs(player_ptr, yval, xval);
+ }
+
+ /* Traps to protect the treasure */
+ vault_traps(player_ptr, yval, xval, 4, 10, 2 + randint1(3));
+
+ break;
+ }
+
+ /* Inner pillar(s). */
+ case 3: {
+ /* Place a secret door */
+ switch (randint1(4)) {
+ case 1:
+ place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
+ break;
+ case 2:
+ place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
+ break;
+ case 3:
+ place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
+ break;
+ case 4:
+ place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
+ break;
+ }
+
+ /* Large Inner Pillar */
+ for (y = yval - 1; y <= yval + 1; y++) {
+ for (x = xval - 1; x <= xval + 1; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ }
+
+ /* Occasionally, two more Large Inner Pillars */
+ if (one_in_(2)) {
+ tmp = randint1(2);
+ for (y = yval - 1; y <= yval + 1; y++) {
+ for (x = xval - 5 - tmp; x <= xval - 3 - tmp; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ for (x = xval + 3 + tmp; x <= xval + 5 + tmp; x++) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ }
+ }
+
+ /* Occasionally, some Inner rooms */
+ if (one_in_(3)) {
+ int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256))
+ ? DOOR_CURTAIN
+ : ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
+
+ /* Long horizontal walls */
+ for (x = xval - 5; x <= xval + 5; x++) {
+ g_ptr = &floor_ptr->grid_array[yval - 1][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[yval + 1][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+
+ /* Close off the left/right edges */
+ g_ptr = &floor_ptr->grid_array[yval][xval - 5];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr = &floor_ptr->grid_array[yval][xval + 5];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+
+ /* Secret doors (random top/bottom) */
+ place_secret_door(player_ptr, yval - 3 + (randint1(2) * 2), xval - 3, door_type);
+ place_secret_door(player_ptr, yval - 3 + (randint1(2) * 2), xval + 3, door_type);
+
+ /* Monsters */
+ vault_monsters(player_ptr, yval, xval - 2, randint1(2));
+ vault_monsters(player_ptr, yval, xval + 2, randint1(2));
+
+ /* Objects */
+ if (one_in_(3))
+ place_object(player_ptr, yval, xval - 2, 0L);
+ if (one_in_(3))
+ place_object(player_ptr, yval, xval + 2, 0L);
+ }
+
+ break;
+ }
+
+ /* Maze inside. */
+ case 4: {
+ /* Place a secret door */
+ switch (randint1(4)) {
+ case 1:
+ place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
+ break;
+ case 2:
+ place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
+ break;
+ case 3:
+ place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
+ break;
+ case 4:
+ place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
+ break;
+ }
+
+ /* Maze (really a checkerboard) */
+ for (y = y1; y <= y2; y++) {
+ for (x = x1; x <= x2; x++) {
+ if (0x1 & (x + y)) {
+ g_ptr = &floor_ptr->grid_array[y][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ }
+ }
+
+ /* Monsters just love mazes. */
+ vault_monsters(player_ptr, yval, xval - 5, randint1(3));
+ vault_monsters(player_ptr, yval, xval + 5, randint1(3));
+
+ /* Traps make them entertaining. */
+ vault_traps(player_ptr, yval, xval - 3, 2, 8, randint1(3));
+ vault_traps(player_ptr, yval, xval + 3, 2, 8, randint1(3));
+
+ /* Mazes should have some treasure too. */
+ vault_objects(player_ptr, yval, xval, 3);
+
+ break;
+ }
+
+ /* Four small rooms. */
+ case 5: {
+ int door_type = ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_CURTAIN) && one_in_((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) ? 16 : 256))
+ ? DOOR_CURTAIN
+ : ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
+
+ /* Inner "cross" */
+ for (y = y1; y <= y2; y++) {
+ g_ptr = &floor_ptr->grid_array[y][xval];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+ for (x = x1; x <= x2; x++) {
+ g_ptr = &floor_ptr->grid_array[yval][x];
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ }
+
+ /* Doors into the rooms */
+ if (randint0(100) < 50) {
+ int i = randint1(10);
+ place_secret_door(player_ptr, y1 - 1, xval - i, door_type);
+ place_secret_door(player_ptr, y1 - 1, xval + i, door_type);
+ place_secret_door(player_ptr, y2 + 1, xval - i, door_type);
+ place_secret_door(player_ptr, y2 + 1, xval + i, door_type);
+ } else {
+ int i = randint1(3);
+ place_secret_door(player_ptr, yval + i, x1 - 1, door_type);
+ place_secret_door(player_ptr, yval - i, x1 - 1, door_type);
+ place_secret_door(player_ptr, yval + i, x2 + 1, door_type);
+ place_secret_door(player_ptr, yval - i, x2 + 1, door_type);
+ }
+
+ /* Treasure, centered at the center of the cross */
+ vault_objects(player_ptr, yval, xval, 2 + randint1(2));
+
+ /* Gotta have some monsters. */
+ vault_monsters(player_ptr, yval + 1, xval - 4, randint1(4));
+ vault_monsters(player_ptr, yval + 1, xval + 4, randint1(4));
+ vault_monsters(player_ptr, yval - 1, xval - 4, randint1(4));
+ vault_monsters(player_ptr, yval - 1, xval + 4, randint1(4));
+
+ break;
+ }
+ }
+
+ return TRUE;
}
-
/*!
-* @brief タイプ11の部屋…円形部屋の生成 / Type 11 -- Build an vertical oval room.
-* @param player_ptr プレーヤーへの参照ポインタ
-* @return なし
-* @details
-* For every grid in the possible square, check the distance.\n
-* If it's less than the radius, make it a room square.\n
-*\n
-* When done fill from the inside to find the walls,\n
-*/
+ * @brief タイプ11の部屋…円形部屋の生成 / Type 11 -- Build an vertical oval room.
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @details
+ * For every grid in the possible square, check the distance.\n
+ * If it's less than the radius, make it a room square.\n
+ *\n
+ * When done fill from the inside to find the walls,\n
+ */
bool build_type11(player_type *player_ptr)
{
- POSITION rad, x, y, x0, y0;
- int light = FALSE;
-
- /* Occasional light */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if ((randint1(floor_ptr->dun_level) <= 15) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
-
- rad = randint0(9);
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(player_ptr, &y0, &x0, rad * 2 + 1, rad * 2 + 1)) return FALSE;
-
- /* Make circular floor */
- for (x = x0 - rad; x <= x0 + rad; x++)
- {
- for (y = y0 - rad; y <= y0 + rad; y++)
- {
- if (distance(y0, x0, y, x) <= rad - 1)
- {
- /* inside- so is floor */
- place_bold(player_ptr, y, x, GB_FLOOR);
- }
- else if (distance(y0, x0, y, x) <= rad + 1)
- {
- /* make granite outside so arena works */
- place_bold(player_ptr, y, x, GB_EXTRA);
- }
- }
- }
-
- /* Find visible outer walls and set to be FEAT_OUTER */
- add_outer_wall(player_ptr, x0, y0, light, x0 - rad, y0 - rad, x0 + rad, y0 + rad);
-
- return TRUE;
+ POSITION rad, x, y, x0, y0;
+ int light = FALSE;
+
+ /* Occasional light */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if ((randint1(floor_ptr->dun_level) <= 15) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
+ light = TRUE;
+
+ rad = randint0(9);
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ if (!find_space(player_ptr, &y0, &x0, rad * 2 + 1, rad * 2 + 1))
+ return FALSE;
+
+ /* Make circular floor */
+ for (x = x0 - rad; x <= x0 + rad; x++) {
+ for (y = y0 - rad; y <= y0 + rad; y++) {
+ if (distance(y0, x0, y, x) <= rad - 1) {
+ /* inside- so is floor */
+ place_bold(player_ptr, y, x, GB_FLOOR);
+ } else if (distance(y0, x0, y, x) <= rad + 1) {
+ /* make granite outside so arena works */
+ place_bold(player_ptr, y, x, GB_EXTRA);
+ }
+ }
+ }
+
+ /* Find visible outer walls and set to be FEAT_OUTER */
+ add_outer_wall(player_ptr, x0, y0, light, x0 - rad, y0 - rad, x0 + rad, y0 + rad);
+
+ return TRUE;
}
-
/*!
-* @brief タイプ12の部屋…ドーム型部屋の生成 / Type 12 -- Build crypt room.
-* @param player_ptr プレーヤーへの参照ポインタ
-* @return なし
-* @details
-* For every grid in the possible square, check the (fake) distance.\n
-* If it's less than the radius, make it a room square.\n
-*\n
-* When done fill from the inside to find the walls,\n
-*/
+ * @brief タイプ12の部屋…ドーム型部屋の生成 / Type 12 -- Build crypt room.
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @details
+ * For every grid in the possible square, check the (fake) distance.\n
+ * If it's less than the radius, make it a room square.\n
+ *\n
+ * When done fill from the inside to find the walls,\n
+ */
bool build_type12(player_type *player_ptr)
{
- POSITION rad, x, y, x0, y0;
- int light = FALSE;
- bool emptyflag = TRUE;
-
- /* Make a random metric */
- POSITION h1, h2, h3, h4;
- h1 = randint1(32) - 16;
- h2 = randint1(16);
- h3 = randint1(32);
- h4 = randint1(32) - 16;
-
- /* Occasional light */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if ((randint1(floor_ptr->dun_level) <= 5) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) light = TRUE;
-
- rad = randint1(9);
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(player_ptr, &y0, &x0, rad * 2 + 3, rad * 2 + 3)) return FALSE;
-
- /* Make floor */
- for (x = x0 - rad; x <= x0 + rad; x++)
- {
- for (y = y0 - rad; y <= y0 + rad; y++)
- {
- /* clear room flag */
- floor_ptr->grid_array[y][x].info &= ~(CAVE_ROOM);
-
- if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1)
- {
- /* inside - so is floor */
- place_bold(player_ptr, y, x, GB_FLOOR);
- }
- else if (distance(y0, x0, y, x) < 3)
- {
- place_bold(player_ptr, y, x, GB_FLOOR);
- }
- else
- {
- /* make granite outside so arena works */
- place_bold(player_ptr, y, x, GB_EXTRA);
- }
-
- /* proper boundary for arena */
- if (((y + rad) == y0) || ((y - rad) == y0) ||
- ((x + rad) == x0) || ((x - rad) == x0))
- {
- place_bold(player_ptr, y, x, GB_EXTRA);
- }
- }
- }
-
- /* Find visible outer walls and set to be FEAT_OUTER */
- add_outer_wall(player_ptr, x0, y0, light, x0 - rad - 1, y0 - rad - 1, x0 + rad + 1, y0 + rad + 1);
-
- /* Check to see if there is room for an inner vault */
- for (x = x0 - 2; x <= x0 + 2; x++)
- {
- for (y = y0 - 2; y <= y0 + 2; y++)
- {
- if (!is_floor_bold(floor_ptr, y, x))
- {
- /* Wall in the way */
- emptyflag = FALSE;
- }
- }
- }
-
- if (emptyflag && one_in_(2))
- {
- /* Build the vault */
- build_small_room(player_ptr, x0, y0);
-
- /* Place a treasure in the vault */
- place_object(player_ptr, y0, x0, 0L);
-
- /* Let's guard the treasure well */
- vault_monsters(player_ptr, y0, x0, randint0(2) + 3);
-
- /* Traps naturally */
- vault_traps(player_ptr, y0, x0, 4, 4, randint0(3) + 2);
- }
-
- return TRUE;
+ POSITION rad, x, y, x0, y0;
+ int light = FALSE;
+ bool emptyflag = TRUE;
+
+ /* Make a random metric */
+ POSITION h1, h2, h3, h4;
+ h1 = randint1(32) - 16;
+ h2 = randint1(16);
+ h3 = randint1(32);
+ h4 = randint1(32) - 16;
+
+ /* Occasional light */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if ((randint1(floor_ptr->dun_level) <= 5) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
+ light = TRUE;
+
+ rad = randint1(9);
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ if (!find_space(player_ptr, &y0, &x0, rad * 2 + 3, rad * 2 + 3))
+ return FALSE;
+
+ /* Make floor */
+ for (x = x0 - rad; x <= x0 + rad; x++) {
+ for (y = y0 - rad; y <= y0 + rad; y++) {
+ /* clear room flag */
+ floor_ptr->grid_array[y][x].info &= ~(CAVE_ROOM);
+
+ if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1) {
+ /* inside - so is floor */
+ place_bold(player_ptr, y, x, GB_FLOOR);
+ } else if (distance(y0, x0, y, x) < 3) {
+ place_bold(player_ptr, y, x, GB_FLOOR);
+ } else {
+ /* make granite outside so arena works */
+ place_bold(player_ptr, y, x, GB_EXTRA);
+ }
+
+ /* proper boundary for arena */
+ if (((y + rad) == y0) || ((y - rad) == y0) || ((x + rad) == x0) || ((x - rad) == x0)) {
+ place_bold(player_ptr, y, x, GB_EXTRA);
+ }
+ }
+ }
+
+ /* Find visible outer walls and set to be FEAT_OUTER */
+ add_outer_wall(player_ptr, x0, y0, light, x0 - rad - 1, y0 - rad - 1, x0 + rad + 1, y0 + rad + 1);
+
+ /* Check to see if there is room for an inner vault */
+ for (x = x0 - 2; x <= x0 + 2; x++) {
+ for (y = y0 - 2; y <= y0 + 2; y++) {
+ if (!is_floor_bold(floor_ptr, y, x)) {
+ /* Wall in the way */
+ emptyflag = FALSE;
+ }
+ }
+ }
+
+ if (emptyflag && one_in_(2)) {
+ /* Build the vault */
+ build_small_room(player_ptr, x0, y0);
+
+ /* Place a treasure in the vault */
+ place_object(player_ptr, y0, x0, 0L);
+
+ /* Let's guard the treasure well */
+ vault_monsters(player_ptr, y0, x0, randint0(2) + 3);
+
+ /* Traps naturally */
+ vault_traps(player_ptr, y0, x0, 4, 4, randint0(3) + 2);
+ }
+
+ return TRUE;
}
#include "room/cave-filler.h"
#include "room/lake-types.h"
#include "room/rooms-maze-vault.h"
-#include "room/rooms.h" // todo 相互依存.
+#include "room/rooms.h"
#include "room/space-finder.h"
#include "room/treasure-deployment.h"
#include "store/store-util.h"
VAULT_IDX max_v_idx;
/*
-* This function creates a random vault that looks like a collection of bubbles.
-* It works by getting a set of coordinates that represent the center of each
-* bubble. The entire room is made by seeing which bubble center is closest. If
-* two centers are equidistant then the square is a wall, otherwise it is a floor.
-* The only exception is for squares really near a center, these are always floor.
-* (It looks better than without this check.)
-*
-* Note: If two centers are on the same point then this algorithm will create a
-* blank bubble filled with walls. - This is prevented from happening.
-*/
+ * This function creates a random vault that looks like a collection of bubbles.
+ * It works by getting a set of coordinates that represent the center of each
+ * bubble. The entire room is made by seeing which bubble center is closest. If
+ * two centers are equidistant then the square is a wall, otherwise it is a floor.
+ * The only exception is for squares really near a center, these are always floor.
+ * (It looks better than without this check.)
+ *
+ * Note: If two centers are on the same point then this algorithm will create a
+ * blank bubble filled with walls. - This is prevented from happening.
+ */
static void build_bubble_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
{
-#define BUBBLENUM 10 /* number of bubbles */
-
- /* array of center points of bubbles */
- coord center[BUBBLENUM];
-
- int i, j;
- POSITION x = 0, y = 0;
- u16b min1, min2, temp;
- bool done;
-
- /* Offset from center to top left hand corner */
- POSITION xhsize = xsize / 2;
- POSITION yhsize = ysize / 2;
-
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("泡型ランダムVaultを生成しました。", "Room Vault."));
-
- /* Allocate center of bubbles */
- center[0].x = (byte)randint1(xsize - 3) + 1;
- center[0].y = (byte)randint1(ysize - 3) + 1;
-
- for (i = 1; i < BUBBLENUM; i++)
- {
- done = FALSE;
-
- /* get center and check to see if it is unique */
- while (!done)
- {
- done = TRUE;
-
- x = randint1(xsize - 3) + 1;
- y = randint1(ysize - 3) + 1;
-
- for (j = 0; j < i; j++)
- {
- /* rough test to see if there is an overlap */
- if ((x == center[j].x) && (y == center[j].y)) done = FALSE;
- }
- }
-
- center[i].x = x;
- center[i].y = y;
- }
-
- /* Top and bottom boundaries */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- for (i = 0; i < xsize; i++)
- {
- int side_x = x0 - xhsize + i;
-
- place_bold(player_ptr, y0 - yhsize + 0, side_x, GB_OUTER_NOPERM);
- floor_ptr->grid_array[y0 - yhsize + 0][side_x].info |= (CAVE_ROOM | CAVE_ICKY);
- place_bold(player_ptr, y0 - yhsize + ysize - 1, side_x, GB_OUTER_NOPERM);
- floor_ptr->grid_array[y0 - yhsize + ysize - 1][side_x].info |= (CAVE_ROOM | CAVE_ICKY);
- }
-
- /* Left and right boundaries */
- for (i = 1; i < ysize - 1; i++)
- {
- int side_y = y0 - yhsize + i;
-
- place_bold(player_ptr, side_y, x0 - xhsize + 0, GB_OUTER_NOPERM);
- floor_ptr->grid_array[side_y][x0 - xhsize + 0].info |= (CAVE_ROOM | CAVE_ICKY);
- place_bold(player_ptr, side_y, x0 - xhsize + xsize - 1, GB_OUTER_NOPERM);
- floor_ptr->grid_array[side_y][x0 - xhsize + xsize - 1].info |= (CAVE_ROOM | CAVE_ICKY);
- }
-
- /* Fill in middle with bubbles */
- for (x = 1; x < xsize - 1; x++)
- {
- for (y = 1; y < ysize - 1; y++)
- {
- /* Get distances to two closest centers */
-
- min1 = (u16b)distance(x, y, center[0].x, center[0].y);
- min2 = (u16b)distance(x, y, center[1].x, center[1].y);
-
- if (min1 > min2)
- {
- /* swap if in wrong order */
- temp = min1;
- min1 = min2;
- min2 = temp;
- }
-
- /* Scan the rest */
- for (i = 2; i < BUBBLENUM; i++)
- {
- temp = (u16b)distance(x, y, center[i].x, center[i].y);
-
- if (temp < min1)
- {
- /* smallest */
- min2 = min1;
- min1 = temp;
- }
- else if (temp < min2)
- {
- /* second smallest */
- min2 = temp;
- }
- }
- if (((min2 - min1) <= 2) && (!(min1 < 3)))
- {
- /* Boundary at midpoint+ not at inner region of bubble */
- place_bold(player_ptr, y0 - yhsize + y, x0 - xhsize + x, GB_OUTER_NOPERM);
- }
- else
- {
- /* middle of a bubble */
- place_bold(player_ptr, y0 - yhsize + y, x0 - xhsize + x, GB_FLOOR);
- }
-
- /* clean up rest of flags */
- floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= (CAVE_ROOM | CAVE_ICKY);
- }
- }
-
- /* Try to add some random doors */
- for (i = 0; i < 500; i++)
- {
- x = randint1(xsize - 3) - xhsize + x0 + 1;
- y = randint1(ysize - 3) - yhsize + y0 + 1;
- add_door(player_ptr, x, y);
- }
-
- /* Fill with monsters and treasure, low difficulty */
- fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
+#define BUBBLENUM 10 /* number of bubbles */
+
+ /* array of center points of bubbles */
+ coord center[BUBBLENUM];
+
+ int i, j;
+ POSITION x = 0, y = 0;
+ u16b min1, min2, temp;
+ bool done;
+
+ /* Offset from center to top left hand corner */
+ POSITION xhsize = xsize / 2;
+ POSITION yhsize = ysize / 2;
+
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("泡型ランダムVaultを生成しました。", "Room Vault."));
+
+ /* Allocate center of bubbles */
+ center[0].x = (byte)randint1(xsize - 3) + 1;
+ center[0].y = (byte)randint1(ysize - 3) + 1;
+
+ for (i = 1; i < BUBBLENUM; i++) {
+ done = FALSE;
+
+ /* get center and check to see if it is unique */
+ while (!done) {
+ done = TRUE;
+
+ x = randint1(xsize - 3) + 1;
+ y = randint1(ysize - 3) + 1;
+
+ for (j = 0; j < i; j++) {
+ /* rough test to see if there is an overlap */
+ if ((x == center[j].x) && (y == center[j].y))
+ done = FALSE;
+ }
+ }
+
+ center[i].x = x;
+ center[i].y = y;
+ }
+
+ /* Top and bottom boundaries */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ for (i = 0; i < xsize; i++) {
+ int side_x = x0 - xhsize + i;
+
+ place_bold(player_ptr, y0 - yhsize + 0, side_x, GB_OUTER_NOPERM);
+ floor_ptr->grid_array[y0 - yhsize + 0][side_x].info |= (CAVE_ROOM | CAVE_ICKY);
+ place_bold(player_ptr, y0 - yhsize + ysize - 1, side_x, GB_OUTER_NOPERM);
+ floor_ptr->grid_array[y0 - yhsize + ysize - 1][side_x].info |= (CAVE_ROOM | CAVE_ICKY);
+ }
+
+ /* Left and right boundaries */
+ for (i = 1; i < ysize - 1; i++) {
+ int side_y = y0 - yhsize + i;
+
+ place_bold(player_ptr, side_y, x0 - xhsize + 0, GB_OUTER_NOPERM);
+ floor_ptr->grid_array[side_y][x0 - xhsize + 0].info |= (CAVE_ROOM | CAVE_ICKY);
+ place_bold(player_ptr, side_y, x0 - xhsize + xsize - 1, GB_OUTER_NOPERM);
+ floor_ptr->grid_array[side_y][x0 - xhsize + xsize - 1].info |= (CAVE_ROOM | CAVE_ICKY);
+ }
+
+ /* Fill in middle with bubbles */
+ for (x = 1; x < xsize - 1; x++) {
+ for (y = 1; y < ysize - 1; y++) {
+ /* Get distances to two closest centers */
+
+ min1 = (u16b)distance(x, y, center[0].x, center[0].y);
+ min2 = (u16b)distance(x, y, center[1].x, center[1].y);
+
+ if (min1 > min2) {
+ /* swap if in wrong order */
+ temp = min1;
+ min1 = min2;
+ min2 = temp;
+ }
+
+ /* Scan the rest */
+ for (i = 2; i < BUBBLENUM; i++) {
+ temp = (u16b)distance(x, y, center[i].x, center[i].y);
+
+ if (temp < min1) {
+ /* smallest */
+ min2 = min1;
+ min1 = temp;
+ } else if (temp < min2) {
+ /* second smallest */
+ min2 = temp;
+ }
+ }
+ if (((min2 - min1) <= 2) && (!(min1 < 3))) {
+ /* Boundary at midpoint+ not at inner region of bubble */
+ place_bold(player_ptr, y0 - yhsize + y, x0 - xhsize + x, GB_OUTER_NOPERM);
+ } else {
+ /* middle of a bubble */
+ place_bold(player_ptr, y0 - yhsize + y, x0 - xhsize + x, GB_FLOOR);
+ }
+
+ /* clean up rest of flags */
+ floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= (CAVE_ROOM | CAVE_ICKY);
+ }
+ }
+
+ /* Try to add some random doors */
+ for (i = 0; i < 500; i++) {
+ x = randint1(xsize - 3) - xhsize + x0 + 1;
+ y = randint1(ysize - 3) - yhsize + y0 + 1;
+ add_door(player_ptr, x, y);
+ }
+
+ /* Fill with monsters and treasure, low difficulty */
+ fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
}
/* Create a random vault that looks like a collection of overlapping rooms */
static void build_room_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
{
- POSITION x1, x2, y1, y2, xhsize, yhsize;
- int i;
-
- /* get offset from center */
- xhsize = xsize / 2;
- yhsize = ysize / 2;
-
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("部屋型ランダムVaultを生成しました。", "Room Vault."));
-
- /* fill area so don't get problems with arena levels */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- for (x1 = 0; x1 < xsize; x1++)
- {
- POSITION x = x0 - xhsize + x1;
-
- for (y1 = 0; y1 < ysize; y1++)
- {
- POSITION y = y0 - yhsize + y1;
-
- place_bold(player_ptr, y, x, GB_EXTRA);
- floor_ptr->grid_array[y][x].info &= (~CAVE_ICKY);
- }
- }
-
- /* add ten random rooms */
- for (i = 0; i < 10; i++)
- {
- x1 = randint1(xhsize) * 2 + x0 - xhsize;
- x2 = randint1(xhsize) * 2 + x0 - xhsize;
- y1 = randint1(yhsize) * 2 + y0 - yhsize;
- y2 = randint1(yhsize) * 2 + y0 - yhsize;
- build_room(player_ptr, x1, x2, y1, y2);
- }
-
- /* Add some random doors */
- for (i = 0; i < 500; i++)
- {
- x1 = randint1(xsize - 3) - xhsize + x0 + 1;
- y1 = randint1(ysize - 3) - yhsize + y0 + 1;
- add_door(player_ptr, x1, y1);
- }
-
- /* Fill with monsters and treasure, high difficulty */
- fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
+ POSITION x1, x2, y1, y2, xhsize, yhsize;
+ int i;
+
+ /* get offset from center */
+ xhsize = xsize / 2;
+ yhsize = ysize / 2;
+
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("部屋型ランダムVaultを生成しました。", "Room Vault."));
+
+ /* fill area so don't get problems with arena levels */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ for (x1 = 0; x1 < xsize; x1++) {
+ POSITION x = x0 - xhsize + x1;
+
+ for (y1 = 0; y1 < ysize; y1++) {
+ POSITION y = y0 - yhsize + y1;
+
+ place_bold(player_ptr, y, x, GB_EXTRA);
+ floor_ptr->grid_array[y][x].info &= (~CAVE_ICKY);
+ }
+ }
+
+ /* add ten random rooms */
+ for (i = 0; i < 10; i++) {
+ x1 = randint1(xhsize) * 2 + x0 - xhsize;
+ x2 = randint1(xhsize) * 2 + x0 - xhsize;
+ y1 = randint1(yhsize) * 2 + y0 - yhsize;
+ y2 = randint1(yhsize) * 2 + y0 - yhsize;
+ build_room(player_ptr, x1, x2, y1, y2);
+ }
+
+ /* Add some random doors */
+ for (i = 0; i < 500; i++) {
+ x1 = randint1(xsize - 3) - xhsize + x0 + 1;
+ y1 = randint1(ysize - 3) - yhsize + y0 + 1;
+ add_door(player_ptr, x1, y1);
+ }
+
+ /* Fill with monsters and treasure, high difficulty */
+ fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
}
-
/* Create a random vault out of a fractal grid */
static void build_cave_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsiz, POSITION ysiz)
{
- int grd, roug, cutoff;
- bool done, light, room;
- POSITION xhsize, yhsize, xsize, ysize, x, y;
-
- /* round to make sizes even */
- xhsize = xsiz / 2;
- yhsize = ysiz / 2;
- xsize = xhsize * 2;
- ysize = yhsize * 2;
-
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("洞穴ランダムVaultを生成しました。", "Cave Vault."));
-
- light = done = FALSE;
- room = TRUE;
-
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- while (!done)
- {
- /* 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(floor_ptr, y0, x0, xsize, ysize, grd, roug, cutoff);
-
- /* Convert to normal format+ clean up */
- done = generate_fracave(player_ptr, y0, x0, xsize, ysize, cutoff, light, room);
- }
-
- /* Set icky flag because is a vault */
- for (x = 0; x <= xsize; x++)
- {
- for (y = 0; y <= ysize; y++)
- {
- floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY;
- }
- }
-
- /* Fill with monsters and treasure, low difficulty */
- fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
-}
+ int grd, roug, cutoff;
+ bool done, light, room;
+ POSITION xhsize, yhsize, xsize, ysize, x, y;
+
+ /* round to make sizes even */
+ xhsize = xsiz / 2;
+ yhsize = ysiz / 2;
+ xsize = xhsize * 2;
+ ysize = yhsize * 2;
+
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("洞穴ランダムVaultを生成しました。", "Cave Vault."));
+
+ light = done = FALSE;
+ room = TRUE;
+
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ while (!done) {
+ /* 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(floor_ptr, y0, x0, xsize, ysize, grd, roug, cutoff);
+
+ /* Convert to normal format+ clean up */
+ done = generate_fracave(player_ptr, y0, x0, xsize, ysize, cutoff, light, room);
+ }
+
+ /* Set icky flag because is a vault */
+ for (x = 0; x <= xsize; x++) {
+ for (y = 0; y <= ysize; y++) {
+ floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY;
+ }
+ }
+
+ /* Fill with monsters and treasure, low difficulty */
+ fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
+}
/*!
-* @brief Vault地形を回転、上下左右反転するための座標変換を返す / coordinate translation code
-* @param x 変換したい点のX座標参照ポインタ
-* @param y 変換したい点のY座標参照ポインタ
-* @param xoffset Vault生成時の基準X座標
-* @param yoffset Vault生成時の基準Y座標
-* @param transno 処理ID
-* @return なし
-*/
+ * @brief Vault地形を回転、上下左右反転するための座標変換を返す / coordinate translation code
+ * @param x 変換したい点のX座標参照ポインタ
+ * @param y 変換したい点のY座標参照ポインタ
+ * @param xoffset Vault生成時の基準X座標
+ * @param yoffset Vault生成時の基準Y座標
+ * @param transno 処理ID
+ * @return なし
+ */
static void coord_trans(POSITION *x, POSITION *y, POSITION xoffset, POSITION yoffset, int transno)
{
- int i;
- int temp;
-
- /*
- * transno specifies what transformation is required. (0-7)
- * The lower two bits indicate by how much the vault is rotated,
- * and the upper bit indicates a reflection.
- * This is done by using rotation matrices... however since
- * these are mostly zeros for rotations by 90 degrees this can
- * be expressed simply in terms of swapping and inverting the
- * x and y coordinates.
- */
- for (i = 0; i < transno % 4; i++)
- {
- /* rotate by 90 degrees */
- temp = *x;
- *x = -(*y);
- *y = temp;
- }
-
- if (transno / 4)
- {
- /* Reflect depending on status of 3rd bit. */
- *x = -(*x);
- }
-
- /* Add offsets so vault stays in the first quadrant */
- *x += xoffset;
- *y += yoffset;
+ int i;
+ int temp;
+
+ /*
+ * transno specifies what transformation is required. (0-7)
+ * The lower two bits indicate by how much the vault is rotated,
+ * and the upper bit indicates a reflection.
+ * This is done by using rotation matrices... however since
+ * these are mostly zeros for rotations by 90 degrees this can
+ * be expressed simply in terms of swapping and inverting the
+ * x and y coordinates.
+ */
+ for (i = 0; i < transno % 4; i++) {
+ /* rotate by 90 degrees */
+ temp = *x;
+ *x = -(*y);
+ *y = temp;
+ }
+
+ if (transno / 4) {
+ /* Reflect depending on status of 3rd bit. */
+ *x = -(*x);
+ }
+
+ /* Add offsets so vault stays in the first quadrant */
+ *x += xoffset;
+ *y += yoffset;
}
-
/*!
-* @brief Vaultをフロアに配置する / Hack -- fill in "vault" rooms
-* @param player_ptr プレーヤーへの参照ポインタ
-* @param yval 生成基準Y座標
-* @param xval 生成基準X座標
-* @param ymax VaultのYサイズ
-* @param xmax VaultのXサイズ
-* @param data Vaultのデータ文字列
-* @param xoffset 変換基準X座標
-* @param yoffset 変換基準Y座標
-* @param transno 変換ID
-* @return なし
-*/
-static void build_vault(player_type *player_ptr, POSITION yval, POSITION xval, POSITION ymax, POSITION xmax, concptr data,
- POSITION xoffset, POSITION yoffset, int transno)
+ * @brief Vaultをフロアに配置する / Hack -- fill in "vault" rooms
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @param yval 生成基準Y座標
+ * @param xval 生成基準X座標
+ * @param ymax VaultのYサイズ
+ * @param xmax VaultのXサイズ
+ * @param data Vaultのデータ文字列
+ * @param xoffset 変換基準X座標
+ * @param yoffset 変換基準Y座標
+ * @param transno 変換ID
+ * @return なし
+ */
+static void build_vault(
+ player_type *player_ptr, POSITION yval, POSITION xval, POSITION ymax, POSITION xmax, concptr data, POSITION xoffset, POSITION yoffset, int transno)
{
- POSITION dx, dy, x, y, i, j;
- concptr t;
- grid_type *g_ptr;
-
- /* Place dungeon features and objects */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- for (t = data, dy = 0; dy < ymax; dy++)
- {
- for (dx = 0; dx < xmax; dx++, t++)
- {
- /* prevent loop counter from being overwritten */
- i = dx;
- j = dy;
-
- /* Flip / rotate */
- coord_trans(&i, &j, xoffset, yoffset, transno);
-
- if (transno % 2 == 0)
- {
- /* no swap of x/y */
- x = xval - (xmax / 2) + i;
- y = yval - (ymax / 2) + j;
- }
- else
- {
- /* swap of x/y */
- x = xval - (ymax / 2) + i;
- y = yval - (xmax / 2) + j;
- }
-
- /* Hack -- skip "non-grids" */
- if (*t == ' ') continue;
- g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Lay down a floor */
- place_grid(player_ptr, g_ptr, GB_FLOOR);
-
- /* Remove any mimic */
- g_ptr->mimic = 0;
-
- /* Part of a vault */
- g_ptr->info |= (CAVE_ROOM | CAVE_ICKY);
-
- /* Analyze the grid */
- switch (*t)
- {
- /* Granite wall (outer) */
- case '%':
- place_grid(player_ptr, g_ptr, GB_OUTER_NOPERM);
- break;
-
- /* Granite wall (inner) */
- case '#':
- place_grid(player_ptr, g_ptr, GB_INNER);
- break;
-
- /* Glass wall (inner) */
- case '$':
- place_grid(player_ptr, g_ptr, GB_INNER);
- g_ptr->feat = feat_glass_wall;
- break;
-
- /* Permanent wall (inner) */
- case 'X':
- place_grid(player_ptr, g_ptr, GB_INNER_PERM);
- break;
-
- /* Permanent glass wall (inner) */
- case 'Y':
- place_grid(player_ptr, g_ptr, GB_INNER_PERM);
- g_ptr->feat = feat_permanent_glass_wall;
- break;
-
- /* Treasure/trap */
- case '*':
- if (randint0(100) < 75)
- {
- place_object(player_ptr, y, x, 0L);
- }
- else
- {
- place_trap(player_ptr, y, x);
- }
- break;
-
- /* Treasure */
- case '[':
- place_object(player_ptr, y, x, 0L);
- break;
-
- /* Tree */
- case ':':
- g_ptr->feat = feat_tree;
- break;
-
- /* Secret doors */
- case '+':
- place_secret_door(player_ptr, y, x, DOOR_DEFAULT);
- break;
-
- /* Secret glass doors */
- case '-':
- place_secret_door(player_ptr, y, x, DOOR_GLASS_DOOR);
- if (is_closed_door(player_ptr, g_ptr->feat)) g_ptr->mimic = feat_glass_wall;
- break;
-
- /* Curtains */
- case '\'':
- place_secret_door(player_ptr, y, x, DOOR_CURTAIN);
- break;
-
- /* Trap */
- case '^':
- place_trap(player_ptr, y, x);
- break;
-
- /* Black market in a dungeon */
- case 'S':
- set_cave_feat(floor_ptr, y, x, feat_black_market);
- store_init(NO_TOWN, STORE_BLACK);
- break;
-
- /* The Pattern */
- case 'p':
- set_cave_feat(floor_ptr, y, x, feat_pattern_start);
- break;
-
- case 'a':
- set_cave_feat(floor_ptr, y, x, feat_pattern_1);
- break;
-
- case 'b':
- set_cave_feat(floor_ptr, y, x, feat_pattern_2);
- break;
-
- case 'c':
- set_cave_feat(floor_ptr, y, x, feat_pattern_3);
- break;
-
- case 'd':
- set_cave_feat(floor_ptr, y, x, feat_pattern_4);
- break;
-
- case 'P':
- set_cave_feat(floor_ptr, y, x, feat_pattern_end);
- break;
-
- case 'B':
- set_cave_feat(floor_ptr, y, x, feat_pattern_exit);
- break;
-
- case 'A':
- /* Reward for Pattern walk */
- floor_ptr->object_level = floor_ptr->base_level + 12;
- place_object(player_ptr, y, x, AM_GOOD | AM_GREAT);
- floor_ptr->object_level = floor_ptr->base_level;
- break;
-
- case '~':
- set_cave_feat(floor_ptr, y, x, feat_shallow_water);
- break;
-
- case '=':
- set_cave_feat(floor_ptr, y, x, feat_deep_water);
- break;
-
- case 'v':
- set_cave_feat(floor_ptr, y, x, feat_shallow_lava);
- break;
-
- case 'w':
- set_cave_feat(floor_ptr, y, x, feat_deep_lava);
- break;
-
- case 'f':
- set_cave_feat(floor_ptr, y, x, feat_shallow_acid_puddle);
- break;
-
- case 'F':
- set_cave_feat(floor_ptr, y, x, feat_deep_acid_puddle);
- break;
-
- case 'g':
- set_cave_feat(floor_ptr, y, x, feat_shallow_poisonous_puddle);
- break;
-
- case 'G':
- set_cave_feat(floor_ptr, y, x, feat_deep_poisonous_puddle);
- break;
-
- case 'h':
- set_cave_feat(floor_ptr, y, x, feat_cold_zone);
- break;
-
- case 'H':
- set_cave_feat(floor_ptr, y, x, feat_heavy_cold_zone);
- break;
-
- case 'i':
- set_cave_feat(floor_ptr, y, x, feat_electrical_zone);
- break;
-
- case 'I':
- set_cave_feat(floor_ptr, y, x, feat_heavy_electrical_zone);
- break;
-
- }
- }
- }
-
-
- /* Place dungeon monsters and objects */
- for (t = data, dy = 0; dy < ymax; dy++)
- {
- for (dx = 0; dx < xmax; dx++, t++)
- {
- /* prevent loop counter from being overwritten */
- i = dx;
- j = dy;
-
- /* Flip / rotate */
- coord_trans(&i, &j, xoffset, yoffset, transno);
-
- if (transno % 2 == 0)
- {
- /* no swap of x/y */
- x = xval - (xmax / 2) + i;
- y = yval - (ymax / 2) + j;
- }
- else
- {
- /* swap of x/y */
- x = xval - (ymax / 2) + i;
- y = yval - (xmax / 2) + j;
- }
-
- /* Hack -- skip "non-grids" */
- if (*t == ' ') continue;
-
- /* Analyze the symbol */
- switch (*t)
- {
- case '&':
- {
- floor_ptr->monster_level = floor_ptr->base_level + 5;
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- floor_ptr->monster_level = floor_ptr->base_level;
- break;
- }
-
- /* Meaner monster */
- case '@':
- {
- floor_ptr->monster_level = floor_ptr->base_level + 11;
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- floor_ptr->monster_level = floor_ptr->base_level;
- break;
- }
-
- /* Meaner monster, plus treasure */
- case '9':
- {
- floor_ptr->monster_level = floor_ptr->base_level + 9;
- place_monster(player_ptr, y, x, PM_ALLOW_SLEEP);
- floor_ptr->monster_level = floor_ptr->base_level;
- floor_ptr->object_level = floor_ptr->base_level + 7;
- place_object(player_ptr, y, x, AM_GOOD);
- floor_ptr->object_level = floor_ptr->base_level;
- break;
- }
-
- /* Nasty monster and treasure */
- case '8':
- {
- floor_ptr->monster_level = floor_ptr->base_level + 40;
- place_monster(player_ptr, y, x, PM_ALLOW_SLEEP);
- floor_ptr->monster_level = floor_ptr->base_level;
- floor_ptr->object_level = floor_ptr->base_level + 20;
- place_object(player_ptr, y, x, AM_GOOD | AM_GREAT);
- floor_ptr->object_level = floor_ptr->base_level;
- break;
- }
-
- /* Monster and/or object */
- case ',':
- {
- if (randint0(100) < 50)
- {
- floor_ptr->monster_level = floor_ptr->base_level + 3;
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- floor_ptr->monster_level = floor_ptr->base_level;
- }
- if (randint0(100) < 50)
- {
- floor_ptr->object_level = floor_ptr->base_level + 7;
- place_object(player_ptr, y, x, 0L);
- floor_ptr->object_level = floor_ptr->base_level;
- }
- break;
- }
- }
- }
- }
+ POSITION dx, dy, x, y, i, j;
+ concptr t;
+ grid_type *g_ptr;
+
+ /* Place dungeon features and objects */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ for (t = data, dy = 0; dy < ymax; dy++) {
+ for (dx = 0; dx < xmax; dx++, t++) {
+ /* prevent loop counter from being overwritten */
+ i = dx;
+ j = dy;
+
+ /* Flip / rotate */
+ coord_trans(&i, &j, xoffset, yoffset, transno);
+
+ if (transno % 2 == 0) {
+ /* no swap of x/y */
+ x = xval - (xmax / 2) + i;
+ y = yval - (ymax / 2) + j;
+ } else {
+ /* swap of x/y */
+ x = xval - (ymax / 2) + i;
+ y = yval - (xmax / 2) + j;
+ }
+
+ /* Hack -- skip "non-grids" */
+ if (*t == ' ')
+ continue;
+ g_ptr = &floor_ptr->grid_array[y][x];
+
+ /* Lay down a floor */
+ place_grid(player_ptr, g_ptr, GB_FLOOR);
+
+ /* Remove any mimic */
+ g_ptr->mimic = 0;
+
+ /* Part of a vault */
+ g_ptr->info |= (CAVE_ROOM | CAVE_ICKY);
+
+ /* Analyze the grid */
+ switch (*t) {
+ /* Granite wall (outer) */
+ case '%':
+ place_grid(player_ptr, g_ptr, GB_OUTER_NOPERM);
+ break;
+
+ /* Granite wall (inner) */
+ case '#':
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ break;
+
+ /* Glass wall (inner) */
+ case '$':
+ place_grid(player_ptr, g_ptr, GB_INNER);
+ g_ptr->feat = feat_glass_wall;
+ break;
+
+ /* Permanent wall (inner) */
+ case 'X':
+ place_grid(player_ptr, g_ptr, GB_INNER_PERM);
+ break;
+
+ /* Permanent glass wall (inner) */
+ case 'Y':
+ place_grid(player_ptr, g_ptr, GB_INNER_PERM);
+ g_ptr->feat = feat_permanent_glass_wall;
+ break;
+
+ /* Treasure/trap */
+ case '*':
+ if (randint0(100) < 75) {
+ place_object(player_ptr, y, x, 0L);
+ } else {
+ place_trap(player_ptr, y, x);
+ }
+ break;
+
+ /* Treasure */
+ case '[':
+ place_object(player_ptr, y, x, 0L);
+ break;
+
+ /* Tree */
+ case ':':
+ g_ptr->feat = feat_tree;
+ break;
+
+ /* Secret doors */
+ case '+':
+ place_secret_door(player_ptr, y, x, DOOR_DEFAULT);
+ break;
+
+ /* Secret glass doors */
+ case '-':
+ place_secret_door(player_ptr, y, x, DOOR_GLASS_DOOR);
+ if (is_closed_door(player_ptr, g_ptr->feat))
+ g_ptr->mimic = feat_glass_wall;
+ break;
+
+ /* Curtains */
+ case '\'':
+ place_secret_door(player_ptr, y, x, DOOR_CURTAIN);
+ break;
+
+ /* Trap */
+ case '^':
+ place_trap(player_ptr, y, x);
+ break;
+
+ /* Black market in a dungeon */
+ case 'S':
+ set_cave_feat(floor_ptr, y, x, feat_black_market);
+ store_init(NO_TOWN, STORE_BLACK);
+ break;
+
+ /* The Pattern */
+ case 'p':
+ set_cave_feat(floor_ptr, y, x, feat_pattern_start);
+ break;
+
+ case 'a':
+ set_cave_feat(floor_ptr, y, x, feat_pattern_1);
+ break;
+
+ case 'b':
+ set_cave_feat(floor_ptr, y, x, feat_pattern_2);
+ break;
+
+ case 'c':
+ set_cave_feat(floor_ptr, y, x, feat_pattern_3);
+ break;
+
+ case 'd':
+ set_cave_feat(floor_ptr, y, x, feat_pattern_4);
+ break;
+
+ case 'P':
+ set_cave_feat(floor_ptr, y, x, feat_pattern_end);
+ break;
+
+ case 'B':
+ set_cave_feat(floor_ptr, y, x, feat_pattern_exit);
+ break;
+
+ case 'A':
+ /* Reward for Pattern walk */
+ floor_ptr->object_level = floor_ptr->base_level + 12;
+ place_object(player_ptr, y, x, AM_GOOD | AM_GREAT);
+ floor_ptr->object_level = floor_ptr->base_level;
+ break;
+
+ case '~':
+ set_cave_feat(floor_ptr, y, x, feat_shallow_water);
+ break;
+
+ case '=':
+ set_cave_feat(floor_ptr, y, x, feat_deep_water);
+ break;
+
+ case 'v':
+ set_cave_feat(floor_ptr, y, x, feat_shallow_lava);
+ break;
+
+ case 'w':
+ set_cave_feat(floor_ptr, y, x, feat_deep_lava);
+ break;
+
+ case 'f':
+ set_cave_feat(floor_ptr, y, x, feat_shallow_acid_puddle);
+ break;
+
+ case 'F':
+ set_cave_feat(floor_ptr, y, x, feat_deep_acid_puddle);
+ break;
+
+ case 'g':
+ set_cave_feat(floor_ptr, y, x, feat_shallow_poisonous_puddle);
+ break;
+
+ case 'G':
+ set_cave_feat(floor_ptr, y, x, feat_deep_poisonous_puddle);
+ break;
+
+ case 'h':
+ set_cave_feat(floor_ptr, y, x, feat_cold_zone);
+ break;
+
+ case 'H':
+ set_cave_feat(floor_ptr, y, x, feat_heavy_cold_zone);
+ break;
+
+ case 'i':
+ set_cave_feat(floor_ptr, y, x, feat_electrical_zone);
+ break;
+
+ case 'I':
+ set_cave_feat(floor_ptr, y, x, feat_heavy_electrical_zone);
+ break;
+ }
+ }
+ }
+
+ /* Place dungeon monsters and objects */
+ for (t = data, dy = 0; dy < ymax; dy++) {
+ for (dx = 0; dx < xmax; dx++, t++) {
+ /* prevent loop counter from being overwritten */
+ i = dx;
+ j = dy;
+
+ /* Flip / rotate */
+ coord_trans(&i, &j, xoffset, yoffset, transno);
+
+ if (transno % 2 == 0) {
+ /* no swap of x/y */
+ x = xval - (xmax / 2) + i;
+ y = yval - (ymax / 2) + j;
+ } else {
+ /* swap of x/y */
+ x = xval - (ymax / 2) + i;
+ y = yval - (xmax / 2) + j;
+ }
+
+ /* Hack -- skip "non-grids" */
+ if (*t == ' ')
+ continue;
+
+ /* Analyze the symbol */
+ switch (*t) {
+ case '&': {
+ floor_ptr->monster_level = floor_ptr->base_level + 5;
+ place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
+ floor_ptr->monster_level = floor_ptr->base_level;
+ break;
+ }
+
+ /* Meaner monster */
+ case '@': {
+ floor_ptr->monster_level = floor_ptr->base_level + 11;
+ place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
+ floor_ptr->monster_level = floor_ptr->base_level;
+ break;
+ }
+
+ /* Meaner monster, plus treasure */
+ case '9': {
+ floor_ptr->monster_level = floor_ptr->base_level + 9;
+ place_monster(player_ptr, y, x, PM_ALLOW_SLEEP);
+ floor_ptr->monster_level = floor_ptr->base_level;
+ floor_ptr->object_level = floor_ptr->base_level + 7;
+ place_object(player_ptr, y, x, AM_GOOD);
+ floor_ptr->object_level = floor_ptr->base_level;
+ break;
+ }
+
+ /* Nasty monster and treasure */
+ case '8': {
+ floor_ptr->monster_level = floor_ptr->base_level + 40;
+ place_monster(player_ptr, y, x, PM_ALLOW_SLEEP);
+ floor_ptr->monster_level = floor_ptr->base_level;
+ floor_ptr->object_level = floor_ptr->base_level + 20;
+ place_object(player_ptr, y, x, AM_GOOD | AM_GREAT);
+ floor_ptr->object_level = floor_ptr->base_level;
+ break;
+ }
+
+ /* Monster and/or object */
+ case ',': {
+ if (randint0(100) < 50) {
+ floor_ptr->monster_level = floor_ptr->base_level + 3;
+ place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
+ floor_ptr->monster_level = floor_ptr->base_level;
+ }
+ if (randint0(100) < 50) {
+ floor_ptr->object_level = floor_ptr->base_level + 7;
+ place_object(player_ptr, y, x, 0L);
+ floor_ptr->object_level = floor_ptr->base_level;
+ }
+ break;
+ }
+ }
+ }
+ }
}
-
/*!
-* @brief タイプ7の部屋…v_info.txtより小型vaultを生成する / Type 7 -- simple vaults (see "v_info.txt")
-* @return なし
-*/
+ * @brief タイプ7の部屋…v_info.txtより小型vaultを生成する / Type 7 -- simple vaults (see "v_info.txt")
+ * @return なし
+ */
bool build_type7(player_type *player_ptr)
{
- vault_type *v_ptr = NULL;
- int dummy;
- POSITION x, y;
- POSITION xval, yval;
- POSITION xoffset, yoffset;
- int transno;
-
- /* Pick a lesser vault */
- for (dummy = 0; dummy < SAFE_MAX_ATTEMPTS; dummy++)
- {
- /* Access a random vault record */
- v_ptr = &v_info[randint0(max_v_idx)];
-
- /* Accept the first lesser vault */
- if (v_ptr->typ == 7) break;
- }
-
- /* No lesser vault found */
- if (dummy >= SAFE_MAX_ATTEMPTS)
- {
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("小型固定Vaultを配置できませんでした。", "Could not place lesser vault."));
- return FALSE;
- }
-
- /* pick type of transformation (0-7) */
- transno = randint0(8);
-
- /* calculate offsets */
- x = v_ptr->wid;
- y = v_ptr->hgt;
-
- /* Some huge vault cannot be ratated to fit in the dungeon */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if (x + 2 > floor_ptr->height - 2)
- {
- /* Forbid 90 or 270 degree ratation */
- transno &= ~1;
- }
-
- coord_trans(&x, &y, 0, 0, transno);
-
- if (x < 0)
- {
- xoffset = -x - 1;
- }
- else
- {
- xoffset = 0;
- }
-
- if (y < 0)
- {
- yoffset = -y - 1;
- }
- else
- {
- yoffset = 0;
- }
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(player_ptr, &yval, &xval, abs(y), abs(x))) return FALSE;
-
- msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("小型Vault(%s)を生成しました。", "Lesser vault (%s)."), v_name + v_ptr->name);
-
- /* Hack -- Build the vault */
- build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
- v_text + v_ptr->text, xoffset, yoffset, transno);
-
- return TRUE;
+ vault_type *v_ptr = NULL;
+ int dummy;
+ POSITION x, y;
+ POSITION xval, yval;
+ POSITION xoffset, yoffset;
+ int transno;
+
+ /* Pick a lesser vault */
+ for (dummy = 0; dummy < SAFE_MAX_ATTEMPTS; dummy++) {
+ /* Access a random vault record */
+ v_ptr = &v_info[randint0(max_v_idx)];
+
+ /* Accept the first lesser vault */
+ if (v_ptr->typ == 7)
+ break;
+ }
+
+ /* No lesser vault found */
+ if (dummy >= SAFE_MAX_ATTEMPTS) {
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("小型固定Vaultを配置できませんでした。", "Could not place lesser vault."));
+ return FALSE;
+ }
+
+ /* pick type of transformation (0-7) */
+ transno = randint0(8);
+
+ /* calculate offsets */
+ x = v_ptr->wid;
+ y = v_ptr->hgt;
+
+ /* Some huge vault cannot be ratated to fit in the dungeon */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if (x + 2 > floor_ptr->height - 2) {
+ /* Forbid 90 or 270 degree ratation */
+ transno &= ~1;
+ }
+
+ coord_trans(&x, &y, 0, 0, transno);
+
+ if (x < 0) {
+ xoffset = -x - 1;
+ } else {
+ xoffset = 0;
+ }
+
+ if (y < 0) {
+ yoffset = -y - 1;
+ } else {
+ yoffset = 0;
+ }
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ if (!find_space(player_ptr, &yval, &xval, abs(y), abs(x)))
+ return FALSE;
+
+ msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("小型Vault(%s)を生成しました。", "Lesser vault (%s)."), v_name + v_ptr->name);
+
+ /* Hack -- Build the vault */
+ build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text, xoffset, yoffset, transno);
+
+ return TRUE;
}
-
/*!
-* @brief タイプ8の部屋…v_info.txtより大型vaultを生成する / Type 8 -- greater vaults (see "v_info.txt")
-* @return なし
-*/
+ * @brief タイプ8の部屋…v_info.txtより大型vaultを生成する / Type 8 -- greater vaults (see "v_info.txt")
+ * @return なし
+ */
bool build_type8(player_type *player_ptr)
{
- vault_type *v_ptr;
- int dummy;
- POSITION xval, yval;
- POSITION x, y;
- int transno;
- POSITION xoffset, yoffset;
-
- /* Pick a greater vault */
- for (dummy = 0; dummy < SAFE_MAX_ATTEMPTS; dummy++)
- {
- /* Access a random vault record */
- v_ptr = &v_info[randint0(max_v_idx)];
-
- /* Accept the first greater vault */
- if (v_ptr->typ == 8) break;
- }
-
- /* No greater vault found */
- if (dummy >= SAFE_MAX_ATTEMPTS)
- {
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("大型固定Vaultを配置できませんでした。", "Could not place greater vault."));
- return FALSE;
- }
-
- /* pick type of transformation (0-7) */
- transno = randint0(8);
-
- /* calculate offsets */
- x = v_ptr->wid;
- y = v_ptr->hgt;
-
- /* Some huge vault cannot be ratated to fit in the dungeon */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if (x + 2 > floor_ptr->height - 2)
- {
- /* Forbid 90 or 270 degree ratation */
- transno &= ~1;
- }
-
- coord_trans(&x, &y, 0, 0, transno);
-
- if (x < 0)
- {
- xoffset = -x - 1;
- }
- else
- {
- xoffset = 0;
- }
-
- if (y < 0)
- {
- yoffset = -y - 1;
- }
- else
- {
- yoffset = 0;
- }
-
- /*
- * Try to allocate space for room. If fails, exit
- *
- * Hack -- Prepare a bit larger space (+2, +2) to
- * prevent generation of vaults with no-entrance.
- */
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(player_ptr, &yval, &xval, (POSITION)(abs(y) + 2), (POSITION)(abs(x) + 2))) return FALSE;
-
- msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("大型固定Vault(%s)を生成しました。", "Greater vault (%s)."), v_name + v_ptr->name);
-
- /* Hack -- Build the vault */
- build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
- v_text + v_ptr->text, xoffset, yoffset, transno);
-
- return TRUE;
+ vault_type *v_ptr;
+ int dummy;
+ POSITION xval, yval;
+ POSITION x, y;
+ int transno;
+ POSITION xoffset, yoffset;
+
+ /* Pick a greater vault */
+ for (dummy = 0; dummy < SAFE_MAX_ATTEMPTS; dummy++) {
+ /* Access a random vault record */
+ v_ptr = &v_info[randint0(max_v_idx)];
+
+ /* Accept the first greater vault */
+ if (v_ptr->typ == 8)
+ break;
+ }
+
+ /* No greater vault found */
+ if (dummy >= SAFE_MAX_ATTEMPTS) {
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("大型固定Vaultを配置できませんでした。", "Could not place greater vault."));
+ return FALSE;
+ }
+
+ /* pick type of transformation (0-7) */
+ transno = randint0(8);
+
+ /* calculate offsets */
+ x = v_ptr->wid;
+ y = v_ptr->hgt;
+
+ /* Some huge vault cannot be ratated to fit in the dungeon */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if (x + 2 > floor_ptr->height - 2) {
+ /* Forbid 90 or 270 degree ratation */
+ transno &= ~1;
+ }
+
+ coord_trans(&x, &y, 0, 0, transno);
+
+ if (x < 0) {
+ xoffset = -x - 1;
+ } else {
+ xoffset = 0;
+ }
+
+ if (y < 0) {
+ yoffset = -y - 1;
+ } else {
+ yoffset = 0;
+ }
+
+ /*
+ * Try to allocate space for room. If fails, exit
+ *
+ * Hack -- Prepare a bit larger space (+2, +2) to
+ * prevent generation of vaults with no-entrance.
+ */
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ if (!find_space(player_ptr, &yval, &xval, (POSITION)(abs(y) + 2), (POSITION)(abs(x) + 2)))
+ return FALSE;
+
+ msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("大型固定Vault(%s)を生成しました。", "Greater vault (%s)."), v_name + v_ptr->name);
+
+ /* Hack -- Build the vault */
+ build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text, xoffset, yoffset, transno);
+
+ return TRUE;
}
-
/*
-* Build target vault.
-* This is made by two concentric "crypts" with perpendicular
-* walls creating the cross-hairs.
-*/
+ * Build target vault.
+ * This is made by two concentric "crypts" with perpendicular
+ * walls creating the cross-hairs.
+ */
static void build_target_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
{
- POSITION rad, x, y;
-
- /* Make a random metric */
- POSITION h1, h2, h3, h4;
- h1 = randint1(32) - 16;
- h2 = randint1(16);
- h3 = randint1(32);
- h4 = randint1(32) - 16;
-
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("対称形ランダムVaultを生成しました。", "Elemental Vault"));
-
- /* work out outer radius */
- if (xsize > ysize)
- {
- rad = ysize / 2;
- }
- else
- {
- rad = xsize / 2;
- }
-
- /* Make floor */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- for (x = x0 - rad; x <= x0 + rad; x++)
- {
- for (y = y0 - rad; y <= y0 + rad; y++)
- {
- /* clear room flag */
- floor_ptr->grid_array[y][x].info &= ~(CAVE_ROOM);
-
- /* Vault - so is "icky" */
- floor_ptr->grid_array[y][x].info |= CAVE_ICKY;
-
- if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1)
- {
- /* inside- so is floor */
- place_bold(player_ptr, y, x, GB_FLOOR);
- }
- else
- {
- /* make granite outside so arena works */
- place_bold(player_ptr, y, x, GB_EXTRA);
- }
-
- /* proper boundary for arena */
- if (((y + rad) == y0) || ((y - rad) == y0) ||
- ((x + rad) == x0) || ((x - rad) == x0))
- {
- place_bold(player_ptr, y, x, GB_EXTRA);
- }
- }
- }
-
- /* Find visible outer walls and set to be FEAT_OUTER */
- add_outer_wall(player_ptr, x0, y0, FALSE, x0 - rad - 1, y0 - rad - 1, x0 + rad + 1, y0 + rad + 1);
-
- /* Add inner wall */
- for (x = x0 - rad / 2; x <= x0 + rad / 2; x++)
- {
- for (y = y0 - rad / 2; y <= y0 + rad / 2; y++)
- {
- if (dist2(y0, x0, y, x, h1, h2, h3, h4) == rad / 2)
- {
- /* Make an internal wall */
- place_bold(player_ptr, y, x, GB_INNER);
- }
- }
- }
-
- /* Add perpendicular walls */
- for (x = x0 - rad; x <= x0 + rad; x++)
- {
- place_bold(player_ptr, y0, x, GB_INNER);
- }
-
- for (y = y0 - rad; y <= y0 + rad; y++)
- {
- place_bold(player_ptr, y, x0, GB_INNER);
- }
-
- /* Make inner vault */
- for (y = y0 - 1; y <= y0 + 1; y++)
- {
- place_bold(player_ptr, y, x0 - 1, GB_INNER);
- place_bold(player_ptr, y, x0 + 1, GB_INNER);
- }
- for (x = x0 - 1; x <= x0 + 1; x++)
- {
- place_bold(player_ptr, y0 - 1, x, GB_INNER);
- place_bold(player_ptr, y0 + 1, x, GB_INNER);
- }
-
- place_bold(player_ptr, y0, x0, GB_FLOOR);
-
-
- /* Add doors to vault */
- /* get two distances so can place doors relative to centre */
- x = (rad - 2) / 4 + 1;
- y = rad / 2 + x;
-
- add_door(player_ptr, x0 + x, y0);
- add_door(player_ptr, x0 + y, y0);
- add_door(player_ptr, x0 - x, y0);
- add_door(player_ptr, x0 - y, y0);
- add_door(player_ptr, x0, y0 + x);
- add_door(player_ptr, x0, y0 + y);
- add_door(player_ptr, x0, y0 - x);
- add_door(player_ptr, x0, y0 - y);
-
- /* Fill with stuff - medium difficulty */
- fill_treasure(player_ptr, x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
+ POSITION rad, x, y;
+
+ /* Make a random metric */
+ POSITION h1, h2, h3, h4;
+ h1 = randint1(32) - 16;
+ h2 = randint1(16);
+ h3 = randint1(32);
+ h4 = randint1(32) - 16;
+
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("対称形ランダムVaultを生成しました。", "Elemental Vault"));
+
+ /* work out outer radius */
+ if (xsize > ysize) {
+ rad = ysize / 2;
+ } else {
+ rad = xsize / 2;
+ }
+
+ /* Make floor */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ for (x = x0 - rad; x <= x0 + rad; x++) {
+ for (y = y0 - rad; y <= y0 + rad; y++) {
+ /* clear room flag */
+ floor_ptr->grid_array[y][x].info &= ~(CAVE_ROOM);
+
+ /* Vault - so is "icky" */
+ floor_ptr->grid_array[y][x].info |= CAVE_ICKY;
+
+ if (dist2(y0, x0, y, x, h1, h2, h3, h4) <= rad - 1) {
+ /* inside- so is floor */
+ place_bold(player_ptr, y, x, GB_FLOOR);
+ } else {
+ /* make granite outside so arena works */
+ place_bold(player_ptr, y, x, GB_EXTRA);
+ }
+
+ /* proper boundary for arena */
+ if (((y + rad) == y0) || ((y - rad) == y0) || ((x + rad) == x0) || ((x - rad) == x0)) {
+ place_bold(player_ptr, y, x, GB_EXTRA);
+ }
+ }
+ }
+
+ /* Find visible outer walls and set to be FEAT_OUTER */
+ add_outer_wall(player_ptr, x0, y0, FALSE, x0 - rad - 1, y0 - rad - 1, x0 + rad + 1, y0 + rad + 1);
+
+ /* Add inner wall */
+ for (x = x0 - rad / 2; x <= x0 + rad / 2; x++) {
+ for (y = y0 - rad / 2; y <= y0 + rad / 2; y++) {
+ if (dist2(y0, x0, y, x, h1, h2, h3, h4) == rad / 2) {
+ /* Make an internal wall */
+ place_bold(player_ptr, y, x, GB_INNER);
+ }
+ }
+ }
+
+ /* Add perpendicular walls */
+ for (x = x0 - rad; x <= x0 + rad; x++) {
+ place_bold(player_ptr, y0, x, GB_INNER);
+ }
+
+ for (y = y0 - rad; y <= y0 + rad; y++) {
+ place_bold(player_ptr, y, x0, GB_INNER);
+ }
+
+ /* Make inner vault */
+ for (y = y0 - 1; y <= y0 + 1; y++) {
+ place_bold(player_ptr, y, x0 - 1, GB_INNER);
+ place_bold(player_ptr, y, x0 + 1, GB_INNER);
+ }
+ for (x = x0 - 1; x <= x0 + 1; x++) {
+ place_bold(player_ptr, y0 - 1, x, GB_INNER);
+ place_bold(player_ptr, y0 + 1, x, GB_INNER);
+ }
+
+ place_bold(player_ptr, y0, x0, GB_FLOOR);
+
+ /* Add doors to vault */
+ /* get two distances so can place doors relative to centre */
+ x = (rad - 2) / 4 + 1;
+ y = rad / 2 + x;
+
+ add_door(player_ptr, x0 + x, y0);
+ add_door(player_ptr, x0 + y, y0);
+ add_door(player_ptr, x0 - x, y0);
+ add_door(player_ptr, x0 - y, y0);
+ add_door(player_ptr, x0, y0 + x);
+ add_door(player_ptr, x0, y0 + y);
+ add_door(player_ptr, x0, y0 - x);
+ add_door(player_ptr, x0, y0 - y);
+
+ /* Fill with stuff - medium difficulty */
+ fill_treasure(player_ptr, x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
}
-
/*
-* This routine uses a modified version of the lake code to make a
-* distribution of some terrain type over the vault. This type
-* depends on the dungeon depth.
-*
-* Miniture rooms are then scattered across the vault.
-*/
+ * This routine uses a modified version of the lake code to make a
+ * distribution of some terrain type over the vault. This type
+ * depends on the dungeon depth.
+ *
+ * Miniture rooms are then scattered across the vault.
+ */
static void build_elemental_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsiz, POSITION ysiz)
{
- int grd, roug;
- int c1, c2, c3;
- bool done = FALSE;
- POSITION xsize, ysize, xhsize, yhsize, x, y;
- int i;
- int type;
-
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("精霊界ランダムVaultを生成しました。", "Elemental Vault"));
-
- /* round to make sizes even */
- xhsize = xsiz / 2;
- yhsize = ysiz / 2;
- xsize = xhsize * 2;
- ysize = yhsize * 2;
-
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if (floor_ptr->dun_level < 25)
- {
- /* Earth vault (Rubble) */
- type = LAKE_T_EARTH_VAULT;
- }
- else if (floor_ptr->dun_level < 50)
- {
- /* Air vault (Trees) */
- type = LAKE_T_AIR_VAULT;
- }
- else if (floor_ptr->dun_level < 75)
- {
- /* Water vault (shallow water) */
- type = LAKE_T_WATER_VAULT;
- }
- else
- {
- /* Fire vault (shallow lava) */
- type = LAKE_T_FIRE_VAULT;
- }
-
- while (!done)
- {
- /* testing values for these parameters: feel free to adjust */
- grd = 1 << (randint0(3));
-
- /* want average of about 16 */
- roug = randint1(8) * randint1(4);
-
- /* Make up size of various componants */
- /* Floor */
- c3 = 2 * xsize / 3;
-
- /* Deep water/lava */
- c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
-
- /* Shallow boundary */
- c2 = (c1 + c3) / 2;
-
- /* make it */
- generate_hmap(floor_ptr, y0, x0, xsize, ysize, grd, roug, c3);
-
- /* Convert to normal format+ clean up */
- done = generate_lake(player_ptr, y0, x0, xsize, ysize, c1, c2, c3, type);
- }
-
- /* Set icky flag because is a vault */
- for (x = 0; x <= xsize; x++)
- {
- for (y = 0; y <= ysize; y++)
- {
- floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY;
- }
- }
-
- /* make a few rooms in the vault */
- for (i = 1; i <= (xsize * ysize) / 50; i++)
- {
- build_small_room(player_ptr, x0 + randint0(xsize - 4) - xsize / 2 + 2,
- y0 + randint0(ysize - 4) - ysize / 2 + 2);
- }
-
- /* Fill with monsters and treasure, low difficulty */
- fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1,
- y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
+ int grd, roug;
+ int c1, c2, c3;
+ bool done = FALSE;
+ POSITION xsize, ysize, xhsize, yhsize, x, y;
+ int i;
+ int type;
+
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("精霊界ランダムVaultを生成しました。", "Elemental Vault"));
+
+ /* round to make sizes even */
+ xhsize = xsiz / 2;
+ yhsize = ysiz / 2;
+ xsize = xhsize * 2;
+ ysize = yhsize * 2;
+
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if (floor_ptr->dun_level < 25) {
+ /* Earth vault (Rubble) */
+ type = LAKE_T_EARTH_VAULT;
+ } else if (floor_ptr->dun_level < 50) {
+ /* Air vault (Trees) */
+ type = LAKE_T_AIR_VAULT;
+ } else if (floor_ptr->dun_level < 75) {
+ /* Water vault (shallow water) */
+ type = LAKE_T_WATER_VAULT;
+ } else {
+ /* Fire vault (shallow lava) */
+ type = LAKE_T_FIRE_VAULT;
+ }
+
+ while (!done) {
+ /* testing values for these parameters: feel free to adjust */
+ grd = 1 << (randint0(3));
+
+ /* want average of about 16 */
+ roug = randint1(8) * randint1(4);
+
+ /* Make up size of various componants */
+ /* Floor */
+ c3 = 2 * xsize / 3;
+
+ /* Deep water/lava */
+ c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
+
+ /* Shallow boundary */
+ c2 = (c1 + c3) / 2;
+
+ /* make it */
+ generate_hmap(floor_ptr, y0, x0, xsize, ysize, grd, roug, c3);
+
+ /* Convert to normal format+ clean up */
+ done = generate_lake(player_ptr, y0, x0, xsize, ysize, c1, c2, c3, type);
+ }
+
+ /* Set icky flag because is a vault */
+ for (x = 0; x <= xsize; x++) {
+ for (y = 0; y <= ysize; y++) {
+ floor_ptr->grid_array[y0 - yhsize + y][x0 - xhsize + x].info |= CAVE_ICKY;
+ }
+ }
+
+ /* make a few rooms in the vault */
+ for (i = 1; i <= (xsize * ysize) / 50; i++) {
+ build_small_room(player_ptr, x0 + randint0(xsize - 4) - xsize / 2 + 2, y0 + randint0(ysize - 4) - ysize / 2 + 2);
+ }
+
+ /* Fill with monsters and treasure, low difficulty */
+ fill_treasure(player_ptr, x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
}
-
/* Build a "mini" checkerboard vault
-*
-* This is done by making a permanent wall maze and setting
-* the diagonal sqaures of the checker board to be granite.
-* The vault has two entrances on opposite sides to guarantee
-* a way to get in even if the vault abuts a side of the dungeon.
-*/
+ *
+ * This is done by making a permanent wall maze and setting
+ * the diagonal sqaures of the checker board to be granite.
+ * The vault has two entrances on opposite sides to guarantee
+ * a way to get in even if the vault abuts a side of the dungeon.
+ */
static void build_mini_c_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
{
- POSITION dy, dx;
- POSITION y1, x1, y2, x2, y, x, total;
- int m, n, num_vertices;
- int *visited;
-
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("小型チェッカーランダムVaultを生成しました。", "Mini Checker Board Vault."));
-
- /* Pick a random room size */
- dy = ysize / 2 - 1;
- dx = xsize / 2 - 1;
-
- y1 = y0 - dy;
- x1 = x0 - dx;
- y2 = y0 + dy;
- x2 = x0 + dx;
-
-
- /* generate the room */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- for (x = x1 - 2; x <= x2 + 2; x++)
- {
- if (!in_bounds(floor_ptr, y1 - 2, x)) break;
-
- floor_ptr->grid_array[y1 - 2][x].info |= (CAVE_ROOM | CAVE_ICKY);
-
- place_bold(player_ptr, y1 - 2, x, GB_OUTER_NOPERM);
- }
-
- for (x = x1 - 2; x <= x2 + 2; x++)
- {
- if (!in_bounds(floor_ptr, y2 + 2, x)) break;
-
- floor_ptr->grid_array[y2 + 2][x].info |= (CAVE_ROOM | CAVE_ICKY);
-
- place_bold(player_ptr, y2 + 2, x, GB_OUTER_NOPERM);
- }
-
- for (y = y1 - 2; y <= y2 + 2; y++)
- {
- if (!in_bounds(floor_ptr, y, x1 - 2)) break;
-
- floor_ptr->grid_array[y][x1 - 2].info |= (CAVE_ROOM | CAVE_ICKY);
-
- place_bold(player_ptr, y, x1 - 2, GB_OUTER_NOPERM);
- }
-
- for (y = y1 - 2; y <= y2 + 2; y++)
- {
- if (!in_bounds(floor_ptr, y, x2 + 2)) break;
-
- floor_ptr->grid_array[y][x2 + 2].info |= (CAVE_ROOM | CAVE_ICKY);
-
- place_bold(player_ptr, y, x2 + 2, GB_OUTER_NOPERM);
- }
-
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- grid_type *g_ptr = &floor_ptr->grid_array[y][x];
-
- g_ptr->info |= (CAVE_ROOM | CAVE_ICKY);
-
- /* Permanent walls */
- place_grid(player_ptr, g_ptr, GB_INNER_PERM);
- }
- }
-
-
- /* dimensions of vertex array */
- m = dx + 1;
- n = dy + 1;
- num_vertices = m * n;
-
- /* initialize array of visited vertices */
- C_MAKE(visited, num_vertices, int);
-
- /* traverse the graph to create a spannng tree, pick a random root */
- r_visit(player_ptr, y1, x1, y2, x2, randint0(num_vertices), 0, visited);
-
- /* Make it look like a checker board vault */
- for (x = x1; x <= x2; x++)
- {
- for (y = y1; y <= y2; y++)
- {
- total = x - x1 + y - y1;
- /* If total is odd- and is a floor then make a wall */
- if ((total % 2 == 1) && is_floor_bold(floor_ptr, y, x))
- {
- place_bold(player_ptr, y, x, GB_INNER);
- }
- }
- }
-
- /* Make a couple of entrances */
- if (one_in_(2))
- {
- /* left and right */
- y = randint1(dy) + dy / 2;
- place_bold(player_ptr, y1 + y, x1 - 1, GB_INNER);
- place_bold(player_ptr, y1 + y, x2 + 1, GB_INNER);
- }
- else
- {
- /* top and bottom */
- x = randint1(dx) + dx / 2;
- place_bold(player_ptr, y1 - 1, x1 + x, GB_INNER);
- place_bold(player_ptr, y2 + 1, x1 + x, GB_INNER);
- }
-
- /* Fill with monsters and treasure, highest difficulty */
- fill_treasure(player_ptr, x1, x2, y1, y2, 10);
-
- C_KILL(visited, num_vertices, int);
+ POSITION dy, dx;
+ POSITION y1, x1, y2, x2, y, x, total;
+ int m, n, num_vertices;
+ int *visited;
+
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("小型チェッカーランダムVaultを生成しました。", "Mini Checker Board Vault."));
+
+ /* Pick a random room size */
+ dy = ysize / 2 - 1;
+ dx = xsize / 2 - 1;
+
+ y1 = y0 - dy;
+ x1 = x0 - dx;
+ y2 = y0 + dy;
+ x2 = x0 + dx;
+
+ /* generate the room */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ for (x = x1 - 2; x <= x2 + 2; x++) {
+ if (!in_bounds(floor_ptr, y1 - 2, x))
+ break;
+
+ floor_ptr->grid_array[y1 - 2][x].info |= (CAVE_ROOM | CAVE_ICKY);
+
+ place_bold(player_ptr, y1 - 2, x, GB_OUTER_NOPERM);
+ }
+
+ for (x = x1 - 2; x <= x2 + 2; x++) {
+ if (!in_bounds(floor_ptr, y2 + 2, x))
+ break;
+
+ floor_ptr->grid_array[y2 + 2][x].info |= (CAVE_ROOM | CAVE_ICKY);
+
+ place_bold(player_ptr, y2 + 2, x, GB_OUTER_NOPERM);
+ }
+
+ for (y = y1 - 2; y <= y2 + 2; y++) {
+ if (!in_bounds(floor_ptr, y, x1 - 2))
+ break;
+
+ floor_ptr->grid_array[y][x1 - 2].info |= (CAVE_ROOM | CAVE_ICKY);
+
+ place_bold(player_ptr, y, x1 - 2, GB_OUTER_NOPERM);
+ }
+
+ for (y = y1 - 2; y <= y2 + 2; y++) {
+ if (!in_bounds(floor_ptr, y, x2 + 2))
+ break;
+
+ floor_ptr->grid_array[y][x2 + 2].info |= (CAVE_ROOM | CAVE_ICKY);
+
+ place_bold(player_ptr, y, x2 + 2, GB_OUTER_NOPERM);
+ }
+
+ for (y = y1 - 1; y <= y2 + 1; y++) {
+ for (x = x1 - 1; x <= x2 + 1; x++) {
+ grid_type *g_ptr = &floor_ptr->grid_array[y][x];
+
+ g_ptr->info |= (CAVE_ROOM | CAVE_ICKY);
+
+ /* Permanent walls */
+ place_grid(player_ptr, g_ptr, GB_INNER_PERM);
+ }
+ }
+
+ /* dimensions of vertex array */
+ m = dx + 1;
+ n = dy + 1;
+ num_vertices = m * n;
+
+ /* initialize array of visited vertices */
+ C_MAKE(visited, num_vertices, int);
+
+ /* traverse the graph to create a spannng tree, pick a random root */
+ r_visit(player_ptr, y1, x1, y2, x2, randint0(num_vertices), 0, visited);
+
+ /* Make it look like a checker board vault */
+ for (x = x1; x <= x2; x++) {
+ for (y = y1; y <= y2; y++) {
+ total = x - x1 + y - y1;
+ /* If total is odd- and is a floor then make a wall */
+ if ((total % 2 == 1) && is_floor_bold(floor_ptr, y, x)) {
+ place_bold(player_ptr, y, x, GB_INNER);
+ }
+ }
+ }
+
+ /* Make a couple of entrances */
+ if (one_in_(2)) {
+ /* left and right */
+ y = randint1(dy) + dy / 2;
+ place_bold(player_ptr, y1 + y, x1 - 1, GB_INNER);
+ place_bold(player_ptr, y1 + y, x2 + 1, GB_INNER);
+ } else {
+ /* top and bottom */
+ x = randint1(dx) + dx / 2;
+ place_bold(player_ptr, y1 - 1, x1 + x, GB_INNER);
+ place_bold(player_ptr, y2 + 1, x1 + x, GB_INNER);
+ }
+
+ /* Fill with monsters and treasure, highest difficulty */
+ fill_treasure(player_ptr, x1, x2, y1, y2, 10);
+
+ C_KILL(visited, num_vertices, int);
}
/* Build a castle */
/* Driver routine: clear the region and call the recursive
-* room routine.
-*
-*This makes a vault that looks like a castle/ city in the dungeon.
-*/
+ * room routine.
+ *
+ *This makes a vault that looks like a castle/ city in the dungeon.
+ */
static void build_castle_vault(player_type *player_ptr, POSITION x0, POSITION y0, POSITION xsize, POSITION ysize)
{
- POSITION dy, dx;
- POSITION y1, x1, y2, x2;
- POSITION y, x;
-
- /* Pick a random room size */
- dy = ysize / 2 - 1;
- dx = xsize / 2 - 1;
-
- y1 = y0 - dy;
- x1 = x0 - dx;
- y2 = y0 + dy;
- x2 = x0 + dx;
-
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("城型ランダムVaultを生成しました。", "Castle Vault"));
-
- /* generate the room */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- for (y = y1 - 1; y <= y2 + 1; y++)
- {
- for (x = x1 - 1; x <= x2 + 1; x++)
- {
- floor_ptr->grid_array[y][x].info |= (CAVE_ROOM | CAVE_ICKY);
- /* Make everything a floor */
- place_bold(player_ptr, y, x, GB_FLOOR);
- }
- }
-
- /* Make the castle */
- build_recursive_room(player_ptr, x1, y1, x2, y2, randint1(5));
-
- /* Fill with monsters and treasure, low difficulty */
- fill_treasure(player_ptr, x1, x2, y1, y2, randint1(3));
+ POSITION dy, dx;
+ POSITION y1, x1, y2, x2;
+ POSITION y, x;
+
+ /* Pick a random room size */
+ dy = ysize / 2 - 1;
+ dx = xsize / 2 - 1;
+
+ y1 = y0 - dy;
+ x1 = x0 - dx;
+ y2 = y0 + dy;
+ x2 = x0 + dx;
+
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("城型ランダムVaultを生成しました。", "Castle Vault"));
+
+ /* generate the room */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ for (y = y1 - 1; y <= y2 + 1; y++) {
+ for (x = x1 - 1; x <= x2 + 1; x++) {
+ floor_ptr->grid_array[y][x].info |= (CAVE_ROOM | CAVE_ICKY);
+ /* Make everything a floor */
+ place_bold(player_ptr, y, x, GB_FLOOR);
+ }
+ }
+
+ /* Make the castle */
+ build_recursive_room(player_ptr, x1, y1, x2, y2, randint1(5));
+
+ /* Fill with monsters and treasure, low difficulty */
+ fill_treasure(player_ptr, x1, x2, y1, y2, randint1(3));
}
-
/*!
-* @brief タイプ10の部屋…ランダム生成vault / Type 10 -- Random vaults
-* @param player_ptr プレーヤーへの参照ポインタ
-* @return なし
-*/
+ * @brief タイプ10の部屋…ランダム生成vault / Type 10 -- Random vaults
+ * @param player_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ */
bool build_type10(player_type *player_ptr)
{
- POSITION y0, x0, xsize, ysize, vtype;
-
- /* big enough to look good, small enough to be fairly common. */
- xsize = randint1(22) + 22;
- ysize = randint1(11) + 11;
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if (!find_space(player_ptr, &y0, &x0, ysize + 1, xsize + 1)) return FALSE;
-
- /* Select type of vault */
- do
- {
- vtype = randint1(15);
- } while ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) &&
- ((vtype == 1) || (vtype == 3) || (vtype == 8) || (vtype == 9) || (vtype == 11)));
-
- switch (vtype)
- {
- /* Build an appropriate room */
- case 1: case 9: build_bubble_vault(player_ptr, x0, y0, xsize, ysize); break;
- case 2: case 10: build_room_vault(player_ptr, x0, y0, xsize, ysize); break;
- case 3: case 11: build_cave_vault(player_ptr, x0, y0, xsize, ysize); break;
- case 4: case 12: build_maze_vault(player_ptr, x0, y0, xsize, ysize, TRUE); break;
- case 5: case 13: build_mini_c_vault(player_ptr, x0, y0, xsize, ysize); break;
- case 6: case 14: build_castle_vault(player_ptr, x0, y0, xsize, ysize); break;
- case 7: case 15: build_target_vault(player_ptr, x0, y0, xsize, ysize); break;
- case 8: build_elemental_vault(player_ptr, x0, y0, xsize, ysize); break;
- /* I know how to add a few more... give me some time. */
- default: return FALSE;
- }
-
- return TRUE;
+ POSITION y0, x0, xsize, ysize, vtype;
+
+ /* big enough to look good, small enough to be fairly common. */
+ xsize = randint1(22) + 22;
+ ysize = randint1(11) + 11;
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if (!find_space(player_ptr, &y0, &x0, ysize + 1, xsize + 1))
+ return FALSE;
+
+ /* Select type of vault */
+ do {
+ vtype = randint1(15);
+ } while ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_NO_CAVE) && ((vtype == 1) || (vtype == 3) || (vtype == 8) || (vtype == 9) || (vtype == 11)));
+
+ switch (vtype) {
+ /* Build an appropriate room */
+ case 1:
+ case 9:
+ build_bubble_vault(player_ptr, x0, y0, xsize, ysize);
+ break;
+ case 2:
+ case 10:
+ build_room_vault(player_ptr, x0, y0, xsize, ysize);
+ break;
+ case 3:
+ case 11:
+ build_cave_vault(player_ptr, x0, y0, xsize, ysize);
+ break;
+ case 4:
+ case 12:
+ build_maze_vault(player_ptr, x0, y0, xsize, ysize, TRUE);
+ break;
+ case 5:
+ case 13:
+ build_mini_c_vault(player_ptr, x0, y0, xsize, ysize);
+ break;
+ case 6:
+ case 14:
+ build_castle_vault(player_ptr, x0, y0, xsize, ysize);
+ break;
+ case 7:
+ case 15:
+ build_target_vault(player_ptr, x0, y0, xsize, ysize);
+ break;
+ case 8:
+ build_elemental_vault(player_ptr, x0, y0, xsize, ysize);
+ break;
+ /* I know how to add a few more... give me some time. */
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
}
-
/*!
-* @brief タイプ17の部屋…v_info.txtより固定特殊部屋を生成する / Type 17 -- fixed special room (see "v_info.txt")
-* @return なし
-*/
+ * @brief タイプ17の部屋…v_info.txtより固定特殊部屋を生成する / Type 17 -- fixed special room (see "v_info.txt")
+ * @return なし
+ */
bool build_type17(player_type *player_ptr)
{
- vault_type *v_ptr = NULL;
- int dummy;
- POSITION x, y;
- POSITION xval, yval;
- POSITION xoffset, yoffset;
- int transno;
-
- /* Pick a lesser vault */
- for (dummy = 0; dummy < SAFE_MAX_ATTEMPTS; dummy++)
- {
- /* Access a random vault record */
- v_ptr = &v_info[randint0(max_v_idx)];
-
- /* Accept the special fix room. */
- if (v_ptr->typ == 17) break;
- }
-
- /* No lesser vault found */
- if (dummy >= SAFE_MAX_ATTEMPTS)
- {
- msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("固定特殊部屋を配置できませんでした。", "Could not place fixed special room."));
- return FALSE;
- }
-
- /* pick type of transformation (0-7) */
- transno = randint0(8);
-
- /* calculate offsets */
- x = v_ptr->wid;
- y = v_ptr->hgt;
-
- /* Some huge vault cannot be ratated to fit in the dungeon */
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- if (x + 2 > floor_ptr->height - 2)
- {
- /* Forbid 90 or 270 degree ratation */
- transno &= ~1;
- }
-
- coord_trans(&x, &y, 0, 0, transno);
-
- if (x < 0)
- {
- xoffset = -x - 1;
- }
- else
- {
- xoffset = 0;
- }
-
- if (y < 0)
- {
- yoffset = -y - 1;
- }
- else
- {
- yoffset = 0;
- }
-
- /* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(player_ptr, &yval, &xval, abs(y), abs(x))) return FALSE;
-
- msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("特殊固定部屋(%s)を生成しました。", "Special Fix room (%s)."), v_name + v_ptr->name);
-
- /* Hack -- Build the vault */
- build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid,
- v_text + v_ptr->text, xoffset, yoffset, transno);
-
- return TRUE;
+ vault_type *v_ptr = NULL;
+ int dummy;
+ POSITION x, y;
+ POSITION xval, yval;
+ POSITION xoffset, yoffset;
+ int transno;
+
+ /* Pick a lesser vault */
+ for (dummy = 0; dummy < SAFE_MAX_ATTEMPTS; dummy++) {
+ /* Access a random vault record */
+ v_ptr = &v_info[randint0(max_v_idx)];
+
+ /* Accept the special fix room. */
+ if (v_ptr->typ == 17)
+ break;
+ }
+
+ /* No lesser vault found */
+ if (dummy >= SAFE_MAX_ATTEMPTS) {
+ msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("固定特殊部屋を配置できませんでした。", "Could not place fixed special room."));
+ return FALSE;
+ }
+
+ /* pick type of transformation (0-7) */
+ transno = randint0(8);
+
+ /* calculate offsets */
+ x = v_ptr->wid;
+ y = v_ptr->hgt;
+
+ /* Some huge vault cannot be ratated to fit in the dungeon */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ if (x + 2 > floor_ptr->height - 2) {
+ /* Forbid 90 or 270 degree ratation */
+ transno &= ~1;
+ }
+
+ coord_trans(&x, &y, 0, 0, transno);
+
+ if (x < 0) {
+ xoffset = -x - 1;
+ } else {
+ xoffset = 0;
+ }
+
+ if (y < 0) {
+ yoffset = -y - 1;
+ } else {
+ yoffset = 0;
+ }
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ if (!find_space(player_ptr, &yval, &xval, abs(y), abs(x)))
+ return FALSE;
+
+ msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("特殊固定部屋(%s)を生成しました。", "Special Fix room (%s)."), v_name + v_ptr->name);
+
+ /* Hack -- Build the vault */
+ build_vault(player_ptr, yval, xval, v_ptr->hgt, v_ptr->wid, v_text + v_ptr->text, xoffset, yoffset, transno);
+
+ return TRUE;
}
#include "room/room-info-table.h"
#include "room/rooms-city.h"
#include "room/rooms-fractal.h"
-#include "room/rooms-normal.h" // todo 相互依存.
#include "room/rooms-pit-nest.h"
#include "room/rooms-special.h"
#include "room/rooms-trap.h"
-#include "room/rooms-vault.h" // todo 相互依存.
#include "room/treasure-deployment.h"
#include "system/dungeon-data-definition.h"
#include "system/floor-type-definition.h"
#include "view/display-messages.h"
#include "wizard/wizard-messages.h"
-door_type feat_door[MAX_DOOR_TYPES];
-
/*!
* @brief 1マスだけの部屋を作成し、上下左右いずれか一つに隠しドアを配置する。
* @param player_ptr プレーヤーへの参照ポインタ
#include "system/angband.h"
-#define DUN_ROOMS_MAX 40 /*!< 部屋生成処理の最大試行数 / Number of rooms to attempt (was 50) */
-
-/* Maximum locked/jammed doors */
-#define MAX_LJ_DOORS 8
-
-#define MAX_DOOR_TYPES 3
-
-/* A structure type for doors */
-typedef struct door_type {
- FEAT_IDX open;
- FEAT_IDX broken;
- FEAT_IDX closed;
- FEAT_IDX locked[MAX_LJ_DOORS];
- FEAT_IDX num_locked;
- FEAT_IDX jammed[MAX_LJ_DOORS];
- FEAT_IDX num_jammed;
-} door_type;
-
-extern door_type feat_door[MAX_DOOR_TYPES];
-
void build_lake(player_type *player_ptr, int type);
void build_cavern(player_type *player_ptr);
void build_small_room(player_type *player_ptr, POSITION x0, POSITION y0);