if (avg > depth_max) avg = depth_max;
/* Set the new value. */
- cave[ymid][xmid].feat = (FEAT_IDX)avg;
+ grid_array[ymid][xmid].feat = (FEAT_IDX)avg;
}
if (avg > depth_max) avg = depth_max;
/* Set the new value. */
- cave[ymid][xmid].feat = (FEAT_IDX)avg;
+ grid_array[ymid][xmid].feat = (FEAT_IDX)avg;
}
/* Are we done? */
if (x1 + 1 == x2) return;
- perturb_point_mid(cave[y1][x1].feat, cave[y2][x1].feat, cave[y1][x2].feat,
- cave[y2][x2].feat, xmid, ymid, rough, depth_max);
+ perturb_point_mid(grid_array[y1][x1].feat, grid_array[y2][x1].feat, grid_array[y1][x2].feat,
+ grid_array[y2][x2].feat, xmid, ymid, rough, depth_max);
- perturb_point_end(cave[y1][x1].feat, cave[y1][x2].feat, cave[ymid][xmid].feat,
+ perturb_point_end(grid_array[y1][x1].feat, grid_array[y1][x2].feat, grid_array[ymid][xmid].feat,
xmid, y1, rough, depth_max);
- perturb_point_end(cave[y1][x2].feat, cave[y2][x2].feat, cave[ymid][xmid].feat,
+ perturb_point_end(grid_array[y1][x2].feat, grid_array[y2][x2].feat, grid_array[ymid][xmid].feat,
x2, ymid, rough, depth_max);
- perturb_point_end(cave[y2][x2].feat, cave[y2][x1].feat, cave[ymid][xmid].feat,
+ perturb_point_end(grid_array[y2][x2].feat, grid_array[y2][x1].feat, grid_array[ymid][xmid].feat,
xmid, y2, rough, depth_max);
- perturb_point_end(cave[y2][x1].feat, cave[y1][x1].feat, cave[ymid][xmid].feat,
+ perturb_point_end(grid_array[y2][x1].feat, grid_array[y1][x1].feat, grid_array[ymid][xmid].feat,
x1, ymid, rough, depth_max);
{
for (x1 = 0; x1 < MAX_WID; x1++)
{
- cave[y1][x1].feat = feat_permanent;
+ grid_array[y1][x1].feat = feat_permanent;
}
}
{
for (x1 = 0; x1 < MAX_WID; x1++)
{
- cave[y1][x1].feat = table_size / 2;
+ grid_array[y1][x1].feat = table_size / 2;
}
}
}
* ToDo: calculate the medium height of the adjacent
* terrains for every corner.
*/
- cave[1][1].feat = (s16b)randint0(table_size);
- cave[MAX_HGT-2][1].feat = (s16b)randint0(table_size);
- cave[1][MAX_WID-2].feat = (s16b)randint0(table_size);
- cave[MAX_HGT-2][MAX_WID-2].feat = (s16b)randint0(table_size);
+ grid_array[1][1].feat = (s16b)randint0(table_size);
+ grid_array[MAX_HGT-2][1].feat = (s16b)randint0(table_size);
+ grid_array[1][MAX_WID-2].feat = (s16b)randint0(table_size);
+ grid_array[MAX_HGT-2][MAX_WID-2].feat = (s16b)randint0(table_size);
if (!corner)
{
/* Hack -- preserve four corners */
- s16b north_west = cave[1][1].feat;
- s16b south_west = cave[MAX_HGT - 2][1].feat;
- s16b north_east = cave[1][MAX_WID - 2].feat;
- s16b south_east = cave[MAX_HGT - 2][MAX_WID - 2].feat;
+ s16b north_west = grid_array[1][1].feat;
+ s16b south_west = grid_array[MAX_HGT - 2][1].feat;
+ s16b north_east = grid_array[1][MAX_WID - 2].feat;
+ s16b south_east = grid_array[MAX_HGT - 2][MAX_WID - 2].feat;
/* x1, y1, x2, y2, num_depths, roughness */
plasma_recursive(1, 1, MAX_WID-2, MAX_HGT-2, table_size-1, roughness);
/* Hack -- copyback four corners */
- cave[1][1].feat = north_west;
- cave[MAX_HGT - 2][1].feat = south_west;
- cave[1][MAX_WID - 2].feat = north_east;
- cave[MAX_HGT - 2][MAX_WID - 2].feat = south_east;
+ grid_array[1][1].feat = north_west;
+ grid_array[MAX_HGT - 2][1].feat = south_west;
+ grid_array[1][MAX_WID - 2].feat = north_east;
+ grid_array[MAX_HGT - 2][MAX_WID - 2].feat = south_east;
for (y1 = 1; y1 < MAX_HGT - 1; y1++)
{
for (x1 = 1; x1 < MAX_WID - 1; x1++)
{
- cave[y1][x1].feat = terrain_table[terrain][cave[y1][x1].feat];
+ grid_array[y1][x1].feat = terrain_table[terrain][grid_array[y1][x1].feat];
}
}
}
else /* Hack -- only four corners */
{
- cave[1][1].feat = terrain_table[terrain][cave[1][1].feat];
- cave[MAX_HGT - 2][1].feat = terrain_table[terrain][cave[MAX_HGT - 2][1].feat];
- cave[1][MAX_WID - 2].feat = terrain_table[terrain][cave[1][MAX_WID - 2].feat];
- cave[MAX_HGT - 2][MAX_WID - 2].feat = terrain_table[terrain][cave[MAX_HGT - 2][MAX_WID - 2].feat];
+ grid_array[1][1].feat = terrain_table[terrain][grid_array[1][1].feat];
+ grid_array[MAX_HGT - 2][1].feat = terrain_table[terrain][grid_array[MAX_HGT - 2][1].feat];
+ grid_array[1][MAX_WID - 2].feat = terrain_table[terrain][grid_array[1][MAX_WID - 2].feat];
+ grid_array[MAX_HGT - 2][MAX_WID - 2].feat = terrain_table[terrain][grid_array[MAX_HGT - 2][MAX_WID - 2].feat];
}
/* Hack -- Restore the RNG state */
*/
if (wilderness[y][x].road)
{
- cave[MAX_HGT/2][MAX_WID/2].feat = feat_floor;
+ grid_array[MAX_HGT/2][MAX_WID/2].feat = feat_floor;
if (wilderness[y-1][x].road)
{
for (y1 = 1; y1 < MAX_HGT/2; y1++)
{
x1 = MAX_WID/2;
- cave[y1][x1].feat = feat_floor;
+ grid_array[y1][x1].feat = feat_floor;
}
}
for (y1 = MAX_HGT/2; y1 < MAX_HGT - 1; y1++)
{
x1 = MAX_WID/2;
- cave[y1][x1].feat = feat_floor;
+ grid_array[y1][x1].feat = feat_floor;
}
}
for (x1 = MAX_WID/2; x1 < MAX_WID - 1; x1++)
{
y1 = MAX_HGT/2;
- cave[y1][x1].feat = feat_floor;
+ grid_array[y1][x1].feat = feat_floor;
}
}
for (x1 = 1; x1 < MAX_WID/2; x1++)
{
y1 = MAX_HGT/2;
- cave[y1][x1].feat = feat_floor;
+ grid_array[y1][x1].feat = feat_floor;
}
}
}
dy = rand_range(6, cur_hgt - 6);
dx = rand_range(6, cur_wid - 6);
- cave[dy][dx].feat = feat_entrance;
- cave[dy][dx].special = wilderness[y][x].entrance;
+ grid_array[dy][dx].feat = feat_entrance;
+ grid_array[dy][dx].special = wilderness[y][x].entrance;
/* Hack -- Restore the RNG state */
Rand_state_restore(state_backup);
for (i = 1; i < MAX_WID - 1; i++)
{
- border.north[i] = cave[MAX_HGT - 2][i].feat;
+ border.north[i] = grid_array[MAX_HGT - 2][i].feat;
}
/* South border */
for (i = 1; i < MAX_WID - 1; i++)
{
- border.south[i] = cave[1][i].feat;
+ border.south[i] = grid_array[1][i].feat;
}
/* West border */
for (i = 1; i < MAX_HGT - 1; i++)
{
- border.west[i] = cave[i][MAX_WID - 2].feat;
+ border.west[i] = grid_array[i][MAX_WID - 2].feat;
}
/* East border */
for (i = 1; i < MAX_HGT - 1; i++)
{
- border.east[i] = cave[i][1].feat;
+ border.east[i] = grid_array[i][1].feat;
}
/* North west corner */
generate_area(y - 1, x - 1, FALSE, TRUE);
- border.north_west = cave[MAX_HGT - 2][MAX_WID - 2].feat;
+ border.north_west = grid_array[MAX_HGT - 2][MAX_WID - 2].feat;
/* North east corner */
generate_area(y - 1, x + 1, FALSE, TRUE);
- border.north_east = cave[MAX_HGT - 2][1].feat;
+ border.north_east = grid_array[MAX_HGT - 2][1].feat;
/* South west corner */
generate_area(y + 1, x - 1, FALSE, TRUE);
- border.south_west = cave[1][MAX_WID - 2].feat;
+ border.south_west = grid_array[1][MAX_WID - 2].feat;
/* South east corner */
generate_area(y + 1, x + 1, FALSE, TRUE);
- border.south_east = cave[1][1].feat;
+ border.south_east = grid_array[1][1].feat;
/* Create terrain of the current area */
/* Special boundary walls -- North */
for (i = 0; i < MAX_WID; i++)
{
- cave[0][i].feat = feat_permanent;
- cave[0][i].mimic = border.north[i];
+ grid_array[0][i].feat = feat_permanent;
+ grid_array[0][i].mimic = border.north[i];
}
/* Special boundary walls -- South */
for (i = 0; i < MAX_WID; i++)
{
- cave[MAX_HGT - 1][i].feat = feat_permanent;
- cave[MAX_HGT - 1][i].mimic = border.south[i];
+ grid_array[MAX_HGT - 1][i].feat = feat_permanent;
+ grid_array[MAX_HGT - 1][i].mimic = border.south[i];
}
/* Special boundary walls -- West */
for (i = 0; i < MAX_HGT; i++)
{
- cave[i][0].feat = feat_permanent;
- cave[i][0].mimic = border.west[i];
+ grid_array[i][0].feat = feat_permanent;
+ grid_array[i][0].mimic = border.west[i];
}
/* Special boundary walls -- East */
for (i = 0; i < MAX_HGT; i++)
{
- cave[i][MAX_WID - 1].feat = feat_permanent;
- cave[i][MAX_WID - 1].mimic = border.east[i];
+ grid_array[i][MAX_WID - 1].feat = feat_permanent;
+ grid_array[i][MAX_WID - 1].mimic = border.east[i];
}
/* North west corner */
- cave[0][0].mimic = border.north_west;
+ grid_array[0][0].mimic = border.north_west;
/* North east corner */
- cave[0][MAX_WID - 1].mimic = border.north_east;
+ grid_array[0][MAX_WID - 1].mimic = border.north_east;
/* South west corner */
- cave[MAX_HGT - 1][0].mimic = border.south_west;
+ grid_array[MAX_HGT - 1][0].mimic = border.south_west;
/* South east corner */
- cave[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east;
+ grid_array[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east;
/* Light up or darken the area */
for (y = 0; y < cur_hgt; y++)
{
for (x = 0; x < cur_wid; x++)
{
- /* Get the cave grid */
- c_ptr = &cave[y][x];
+ /* Get the grid */
+ c_ptr = &grid_array[y][x];
if (is_daytime())
{
{
for (x = 0; x < cur_wid; x++)
{
- /* Get the cave grid */
- c_ptr = &cave[y][x];
+ /* Get the grid */
+ c_ptr = &grid_array[y][x];
/* Seeing true feature code (ignore mimic) */
f_ptr = &f_info[c_ptr->feat];
{
for (x = 0; x < cur_wid; x++)
{
- /* Get the cave grid */
- c_ptr = &cave[y][x];
+ /* Get the grid */
+ c_ptr = &grid_array[y][x];
if (cave_have_flag_grid(c_ptr, FF_ENTRANCE))
{
for (i = 0; i < MAX_WID; i++)
for (j = 0; j < MAX_HGT; j++)
{
- cave[j][i].feat = feat_permanent;
+ grid_array[j][i].feat = feat_permanent;
}
/* Init the wilderness */
{
if (wilderness[j][i].town && (wilderness[j][i].town != NO_TOWN))
{
- cave[j][i].feat = (s16b)feat_town;
- cave[j][i].special = (s16b)wilderness[j][i].town;
+ grid_array[j][i].feat = (s16b)feat_town;
+ grid_array[j][i].special = (s16b)wilderness[j][i].town;
}
- else if (wilderness[j][i].road) cave[j][i].feat = feat_floor;
+ else if (wilderness[j][i].road) grid_array[j][i].feat = feat_floor;
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;
+ grid_array[j][i].feat = feat_entrance;
+ grid_array[j][i].special = (byte)wilderness[j][i].entrance;
}
- else cave[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain];
+ else grid_array[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain];
- cave[j][i].info |= (CAVE_GLOW | CAVE_MARK);
+ grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK);
}
cur_hgt = (s16b) max_wild_y;