/* File: wild.c */
-/* Purpose: Wilderness generation */
-
/*
- * Copyright (c) 1989, 1999 James E. Wilson, Robert A. Koeneke,
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke,
* Robert Ruehlmann
*
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies. Other copyrights may also apply.
*/
+/* Purpose: Wilderness generation */
+
#include "angband.h"
/*
+ * 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,
int table_size = sizeof(terrain_table[0]) / sizeof(int);
int roughness = 1; /* The roughness of the level. */
+ /* Unused */
+ (void)border;
+
/* The outer wall is easy */
if (terrain == TERRAIN_EDGE)
{
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));
}
/* 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;
/* 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++)
}
/* 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++)
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;
int i, num;
char *zz[33];
+ /* Unused */
+ (void)ymin;
+ (void)ymax;
/* Paranoia */
if (!(buf[0] == 'W')) return (PARSE_ERROR_GENERIC);