/*
+ * Fill the arrays of floors and walls in the good proportions
+ */
+void set_floor_and_wall(byte type)
+{
+ static byte cur_type = 255;
+ int i;
+
+ /* Already filled */
+ if (cur_type == type) return;
+
+ cur_type = type;
+
+ for (i = 0; i < 100; i++)
+ {
+ int lim1, lim2, lim3;
+
+ lim1 = d_info[type].floor_percent1;
+ lim2 = lim1 + d_info[type].floor_percent2;
+ lim3 = lim2 + d_info[type].floor_percent3;
+
+ if (i < lim1)
+ floor_type[i] = d_info[type].floor1;
+ else if (i < lim2)
+ floor_type[i] = d_info[type].floor2;
+ else if (i < lim3)
+ floor_type[i] = d_info[type].floor3;
+
+ lim1 = d_info[type].fill_percent1;
+ lim2 = lim1 + d_info[type].fill_percent2;
+ lim3 = lim2 + d_info[type].fill_percent3;
+ if (i < lim1)
+ fill_type[i] = d_info[type].fill_type1;
+ else if (i < lim2)
+ fill_type[i] = d_info[type].fill_type2;
+ else if (i < lim3)
+ fill_type[i] = d_info[type].fill_type3;
+ }
+}
+
+
+/*
* Helper for plasma generation.
*/
static void perturb_point_mid(int x1, int x2, int x3, int x4,
};
-void generate_wilderness_area(int terrain, u32b seed, bool border, bool corner)
+static void generate_wilderness_area(int terrain, u32b seed, bool border, bool corner)
{
int x1, y1;
int table_size = sizeof(terrain_table[0]) / sizeof(int);
else
init_flags = INIT_CREATE_DUNGEON;
- process_dungeon_file("t_info_j.txt", 0, 0, MAX_HGT, MAX_WID);
+ process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
if (!corner && !border) p_ptr->visit |= (1L << (p_ptr->town_num - 1));
}
}
}
- if (wilderness[y][x].entrance && !wilderness[y][x].town && (total_winner || !(d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER)))
+ if (wilderness[y][x].entrance && !wilderness[y][x].town && (p_ptr->total_winner || !(d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER)))
{
int dy, dx;
Rand_quick = TRUE;
/* Hack -- Induce consistant town layout */
- Rand_value = wilderness[y][x].seed;
+ Rand_value = wilderness[y][x].seed;
dy = rand_range(6, cur_hgt - 6);
dx = rand_range(6, cur_wid - 6);
void wilderness_gen(void)
{
int i, y, x, lim;
- bool daytime;
cave_type *c_ptr;
- /* Big town */
+ /* Big town */
cur_hgt = MAX_HGT;
cur_wid = MAX_WID;
/* Assume illegal panel */
- panel_row = 255;
- panel_col = 255;
+ panel_row_min = cur_hgt;
+ panel_col_min = cur_wid;
/* Init the wilderness */
- process_dungeon_file("w_info_j.txt", 0, 0, max_wild_y, max_wild_x);
+ process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
x = p_ptr->wilderness_x;
y = p_ptr->wilderness_y;
/* South east corner */
cave[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east;
-
- /* Day time */
- if ((turn % (20L * TOWN_DAWN)) < ((20L * TOWN_DAWN) / 2))
- daytime = TRUE;
- else
- daytime = FALSE;
-
/* Light up or darken the area */
for (y = 0; y < cur_hgt; y++)
{
/* Get the cave grid */
c_ptr = &cave[y][x];
- if (daytime)
+ if (is_daytime())
{
/* Assume lit */
c_ptr->info |= (CAVE_GLOW);
/* Darken "boring" features */
if ((c_ptr->feat <= FEAT_INVIS) ||
((c_ptr->feat >= FEAT_DEEP_WATER) &&
- (c_ptr->feat <= FEAT_TREES) &&
+ (c_ptr->feat <= FEAT_MOUNTAIN) &&
(c_ptr->feat != FEAT_MUSEUM)) ||
(x == 0) || (x == cur_wid-1) ||
(y == 0) || (y == cur_hgt-1))
/* Make some residents */
for (i = 0; i < lim; i++)
{
+ u32b mode = 0;
+
+ if (!(generate_encounter || (one_in_(2) && (!p_ptr->town_num))))
+ mode |= PM_ALLOW_SLEEP;
+
/* Make a resident */
- (void)alloc_monster(generate_encounter ? 0 : 3, (bool)!(generate_encounter || (one_in_(2) && (!p_ptr->town_num))));
+ (void)alloc_monster(generate_encounter ? 0 : 3, mode);
}
if(generate_encounter) ambush_flag = TRUE;
generate_encounter = FALSE;
- for (i = 0; i < 100; i++)
- {
- floor_type[i] = FEAT_FLOOR;
- fill_type[i] = FEAT_WALL_EXTRA;
- }
+ /* Fill the arrays of floors and walls in the good proportions */
+ set_floor_and_wall(0);
/* Set rewarded quests to finished */
for (i = 0; i < max_quests; i++)
*/
void wilderness_gen_small()
{
- int i, j;
+ int i, j;
- /* To prevent stupid things */
- for (i = 0; i < MAX_WID; i++)
- for (j = 0; j < MAX_HGT; j++)
+ /* To prevent stupid things */
+ for (i = 0; i < MAX_WID; i++)
+ for (j = 0; j < MAX_HGT; j++)
{
- cave[j][i].feat = FEAT_PERM_SOLID;
+ cave[j][i].feat = FEAT_PERM_SOLID;
}
/* Init the wilderness */
- process_dungeon_file("w_info_j.txt", 0, 0, max_wild_y, max_wild_x);
+ process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
- /* Fill the map */
- for (i = 0; i < max_wild_x; i++)
- for (j = 0; j < max_wild_y; j++)
+ /* Fill the map */
+ for (i = 0; i < max_wild_x; i++)
+ for (j = 0; j < max_wild_y; j++)
{
if (wilderness[j][i].town && (wilderness[j][i].town != NO_TOWN))
{
cave[j][i].special = wilderness[j][i].town;
}
else if (wilderness[j][i].road) cave[j][i].feat = FEAT_FLOOR;
- else if (wilderness[j][i].entrance && (total_winner || !(d_info[wilderness[j][i].entrance].flags1 & DF1_WINNER)))
+ else if (wilderness[j][i].entrance && (p_ptr->total_winner || !(d_info[wilderness[j][i].entrance].flags1 & DF1_WINNER)))
{
cave[j][i].feat = FEAT_ENTRANCE;
cave[j][i].special = (byte)wilderness[j][i].entrance;
}
- else cave[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain];
+ else cave[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain];
- cave[j][i].info |= (CAVE_GLOW | CAVE_MARK);
+ cave[j][i].info |= (CAVE_GLOW | CAVE_MARK);
}
- cur_hgt = (max_wild_y / SCREEN_HGT + 1) * SCREEN_HGT;
- cur_wid = (max_wild_x / SCREEN_WID + 1) * SCREEN_WID;
+ cur_hgt = (s16b) max_wild_y;
+ cur_wid = (s16b) max_wild_x;
if (cur_hgt > MAX_HGT) cur_hgt = MAX_HGT;
if (cur_wid > MAX_WID) cur_wid = MAX_WID;
/* Assume illegal panel */
- panel_row = 255;
- panel_col = 255;
+ panel_row_min = cur_hgt;
+ panel_col_min = cur_wid;
- /* Place the player */
- px = p_ptr->wilderness_x;
- py = p_ptr->wilderness_y;
+ /* Place the player */
+ px = p_ptr->wilderness_x;
+ py = p_ptr->wilderness_y;
p_ptr->town_num = 0;
}
if (have_pet)
{
#ifdef JP
- if(!get_check_strict("¥Ú¥Ã¥È¤òÃÖ¤¤¤Æ¹°è¥Þ¥Ã¥×¤ËÆþ¤ê¤Þ¤¹¤«¡©", 1))
+ if(!get_check_strict("¥Ú¥Ã¥È¤òÃÖ¤¤¤Æ¹°è¥Þ¥Ã¥×¤ËÆþ¤ê¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
#else
- if(!get_check_strict("Do you leave your pets behind? ", 1))
+ if(!get_check_strict("Do you leave your pets behind? ", CHECK_OKAY_CANCEL))
#endif
{
energy_use = 0;