*/
#include "angband.h"
+#include "wild.h"
#include "world.h"
#include "monster.h"
#include "realm-hex.h"
#include "player-status.h"
+#include "grid.h"
+#include "monster-status.h"
+
+ /*
+ * Wilderness
+ */
+wilderness_type **wilderness;
+
/*!
* @brief 地形生成確率を決める要素100の配列を確率テーブルから作成する
lim[0] = prob[0].percent;
for (i = 1; i < DUNGEON_FEAT_PROB_NUM; i++) lim[i] = lim[i - 1] + prob[i].percent;
-
- /* Paranoia */
if (lim[DUNGEON_FEAT_PROB_NUM - 1] < 100) lim[DUNGEON_FEAT_PROB_NUM - 1] = 100;
for (i = 0; i < 100; i++)
if (avg > depth_max) avg = depth_max;
/* Set the new value. */
- grid_array[ymid][xmid].feat = (FEAT_IDX)avg;
+ current_floor_ptr->grid_array[ymid][xmid].feat = (FEAT_IDX)avg;
}
if (avg > depth_max) avg = depth_max;
/* Set the new value. */
- grid_array[ymid][xmid].feat = (FEAT_IDX)avg;
+ current_floor_ptr->grid_array[ymid][xmid].feat = (FEAT_IDX)avg;
}
/* Are we done? */
if (x1 + 1 == x2) return;
- 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_mid(current_floor_ptr->grid_array[y1][x1].feat, current_floor_ptr->grid_array[y2][x1].feat, current_floor_ptr->grid_array[y1][x2].feat,
+ current_floor_ptr->grid_array[y2][x2].feat, xmid, ymid, rough, depth_max);
- perturb_point_end(grid_array[y1][x1].feat, grid_array[y1][x2].feat, grid_array[ymid][xmid].feat,
+ perturb_point_end(current_floor_ptr->grid_array[y1][x1].feat, current_floor_ptr->grid_array[y1][x2].feat, current_floor_ptr->grid_array[ymid][xmid].feat,
xmid, y1, rough, depth_max);
- perturb_point_end(grid_array[y1][x2].feat, grid_array[y2][x2].feat, grid_array[ymid][xmid].feat,
+ perturb_point_end(current_floor_ptr->grid_array[y1][x2].feat, current_floor_ptr->grid_array[y2][x2].feat, current_floor_ptr->grid_array[ymid][xmid].feat,
x2, ymid, rough, depth_max);
- perturb_point_end(grid_array[y2][x2].feat, grid_array[y2][x1].feat, grid_array[ymid][xmid].feat,
+ perturb_point_end(current_floor_ptr->grid_array[y2][x2].feat, current_floor_ptr->grid_array[y2][x1].feat, current_floor_ptr->grid_array[ymid][xmid].feat,
xmid, y2, rough, depth_max);
- perturb_point_end(grid_array[y2][x1].feat, grid_array[y1][x1].feat, grid_array[ymid][xmid].feat,
+ perturb_point_end(current_floor_ptr->grid_array[y2][x1].feat, current_floor_ptr->grid_array[y1][x1].feat, current_floor_ptr->grid_array[ymid][xmid].feat,
x1, ymid, rough, depth_max);
{
for (x1 = 0; x1 < MAX_WID; x1++)
{
- grid_array[y1][x1].feat = feat_permanent;
+ current_floor_ptr->grid_array[y1][x1].feat = feat_permanent;
}
}
{
for (x1 = 0; x1 < MAX_WID; x1++)
{
- grid_array[y1][x1].feat = table_size / 2;
+ current_floor_ptr->grid_array[y1][x1].feat = table_size / 2;
}
}
}
* ToDo: calculate the medium height of the adjacent
* terrains for every corner.
*/
- 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);
+ current_floor_ptr->grid_array[1][1].feat = (s16b)randint0(table_size);
+ current_floor_ptr->grid_array[MAX_HGT-2][1].feat = (s16b)randint0(table_size);
+ current_floor_ptr->grid_array[1][MAX_WID-2].feat = (s16b)randint0(table_size);
+ current_floor_ptr->grid_array[MAX_HGT-2][MAX_WID-2].feat = (s16b)randint0(table_size);
if (!corner)
{
/* Hack -- preserve four corners */
- 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;
+ s16b north_west = current_floor_ptr->grid_array[1][1].feat;
+ s16b south_west = current_floor_ptr->grid_array[MAX_HGT - 2][1].feat;
+ s16b north_east = current_floor_ptr->grid_array[1][MAX_WID - 2].feat;
+ s16b south_east = current_floor_ptr->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 */
- 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;
+ current_floor_ptr->grid_array[1][1].feat = north_west;
+ current_floor_ptr->grid_array[MAX_HGT - 2][1].feat = south_west;
+ current_floor_ptr->grid_array[1][MAX_WID - 2].feat = north_east;
+ current_floor_ptr->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++)
{
- grid_array[y1][x1].feat = terrain_table[terrain][grid_array[y1][x1].feat];
+ current_floor_ptr->grid_array[y1][x1].feat = terrain_table[terrain][current_floor_ptr->grid_array[y1][x1].feat];
}
}
}
else /* Hack -- only four corners */
{
- 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];
+ current_floor_ptr->grid_array[1][1].feat = terrain_table[terrain][current_floor_ptr->grid_array[1][1].feat];
+ current_floor_ptr->grid_array[MAX_HGT - 2][1].feat = terrain_table[terrain][current_floor_ptr->grid_array[MAX_HGT - 2][1].feat];
+ current_floor_ptr->grid_array[1][MAX_WID - 2].feat = terrain_table[terrain][current_floor_ptr->grid_array[1][MAX_WID - 2].feat];
+ current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat = terrain_table[terrain][current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat];
}
/* Hack -- Restore the RNG state */
p_ptr->town_num = wilderness[y][x].town;
/* Set the base level */
- base_level = wilderness[y][x].level;
+ current_floor_ptr->base_level = wilderness[y][x].level;
/* Set the dungeon level */
- dun_level = 0;
+ current_floor_ptr->dun_level = 0;
/* Set the monster generation level */
- monster_level = base_level;
+ current_floor_ptr->monster_level = current_floor_ptr->base_level;
/* Set the object generation level */
- object_level = base_level;
+ current_floor_ptr->object_level = current_floor_ptr->base_level;
/* Create the town */
*/
if (wilderness[y][x].road)
{
- grid_array[MAX_HGT/2][MAX_WID/2].feat = feat_floor;
+ current_floor_ptr->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;
- grid_array[y1][x1].feat = feat_floor;
+ current_floor_ptr->grid_array[y1][x1].feat = feat_floor;
}
}
for (y1 = MAX_HGT/2; y1 < MAX_HGT - 1; y1++)
{
x1 = MAX_WID/2;
- grid_array[y1][x1].feat = feat_floor;
+ current_floor_ptr->grid_array[y1][x1].feat = feat_floor;
}
}
for (x1 = MAX_WID/2; x1 < MAX_WID - 1; x1++)
{
y1 = MAX_HGT/2;
- grid_array[y1][x1].feat = feat_floor;
+ current_floor_ptr->grid_array[y1][x1].feat = feat_floor;
}
}
for (x1 = 1; x1 < MAX_WID/2; x1++)
{
y1 = MAX_HGT/2;
- grid_array[y1][x1].feat = feat_floor;
+ current_floor_ptr->grid_array[y1][x1].feat = feat_floor;
}
}
}
/* Hack -- Induce consistant flavors */
Rand_state_set(wilderness[y][x].seed);
- dy = rand_range(6, cur_hgt - 6);
- dx = rand_range(6, cur_wid - 6);
+ dy = rand_range(6, current_floor_ptr->height - 6);
+ dx = rand_range(6, current_floor_ptr->width - 6);
- grid_array[dy][dx].feat = feat_entrance;
- grid_array[dy][dx].special = wilderness[y][x].entrance;
+ current_floor_ptr->grid_array[dy][dx].feat = feat_entrance;
+ current_floor_ptr->grid_array[dy][dx].special = wilderness[y][x].entrance;
/* Hack -- Restore the RNG state */
Rand_state_restore(state_backup);
feature_type *f_ptr;
/* Big town */
- cur_hgt = MAX_HGT;
- cur_wid = MAX_WID;
+ current_floor_ptr->height = MAX_HGT;
+ current_floor_ptr->width = MAX_WID;
/* Assume illegal panel */
- panel_row_min = cur_hgt;
- panel_col_min = cur_wid;
+ panel_row_min = current_floor_ptr->height;
+ panel_col_min = current_floor_ptr->width;
/* Init the wilderness */
- process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
+ process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
x = p_ptr->wilderness_x;
y = p_ptr->wilderness_y;
for (i = 1; i < MAX_WID - 1; i++)
{
- border.north[i] = grid_array[MAX_HGT - 2][i].feat;
+ border.north[i] = current_floor_ptr->grid_array[MAX_HGT - 2][i].feat;
}
/* South border */
for (i = 1; i < MAX_WID - 1; i++)
{
- border.south[i] = grid_array[1][i].feat;
+ border.south[i] = current_floor_ptr->grid_array[1][i].feat;
}
/* West border */
for (i = 1; i < MAX_HGT - 1; i++)
{
- border.west[i] = grid_array[i][MAX_WID - 2].feat;
+ border.west[i] = current_floor_ptr->grid_array[i][MAX_WID - 2].feat;
}
/* East border */
for (i = 1; i < MAX_HGT - 1; i++)
{
- border.east[i] = grid_array[i][1].feat;
+ border.east[i] = current_floor_ptr->grid_array[i][1].feat;
}
/* North west corner */
generate_area(y - 1, x - 1, FALSE, TRUE);
- border.north_west = grid_array[MAX_HGT - 2][MAX_WID - 2].feat;
+ border.north_west = current_floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat;
/* North east corner */
generate_area(y - 1, x + 1, FALSE, TRUE);
- border.north_east = grid_array[MAX_HGT - 2][1].feat;
+ border.north_east = current_floor_ptr->grid_array[MAX_HGT - 2][1].feat;
/* South west corner */
generate_area(y + 1, x - 1, FALSE, TRUE);
- border.south_west = grid_array[1][MAX_WID - 2].feat;
+ border.south_west = current_floor_ptr->grid_array[1][MAX_WID - 2].feat;
/* South east corner */
generate_area(y + 1, x + 1, FALSE, TRUE);
- border.south_east = grid_array[1][1].feat;
+ border.south_east = current_floor_ptr->grid_array[1][1].feat;
/* Create terrain of the current area */
/* Special boundary walls -- North */
for (i = 0; i < MAX_WID; i++)
{
- grid_array[0][i].feat = feat_permanent;
- grid_array[0][i].mimic = border.north[i];
+ current_floor_ptr->grid_array[0][i].feat = feat_permanent;
+ current_floor_ptr->grid_array[0][i].mimic = border.north[i];
}
/* Special boundary walls -- South */
for (i = 0; i < MAX_WID; i++)
{
- grid_array[MAX_HGT - 1][i].feat = feat_permanent;
- grid_array[MAX_HGT - 1][i].mimic = border.south[i];
+ current_floor_ptr->grid_array[MAX_HGT - 1][i].feat = feat_permanent;
+ current_floor_ptr->grid_array[MAX_HGT - 1][i].mimic = border.south[i];
}
/* Special boundary walls -- West */
for (i = 0; i < MAX_HGT; i++)
{
- grid_array[i][0].feat = feat_permanent;
- grid_array[i][0].mimic = border.west[i];
+ current_floor_ptr->grid_array[i][0].feat = feat_permanent;
+ current_floor_ptr->grid_array[i][0].mimic = border.west[i];
}
/* Special boundary walls -- East */
for (i = 0; i < MAX_HGT; i++)
{
- grid_array[i][MAX_WID - 1].feat = feat_permanent;
- grid_array[i][MAX_WID - 1].mimic = border.east[i];
+ current_floor_ptr->grid_array[i][MAX_WID - 1].feat = feat_permanent;
+ current_floor_ptr->grid_array[i][MAX_WID - 1].mimic = border.east[i];
}
/* North west corner */
- grid_array[0][0].mimic = border.north_west;
+ current_floor_ptr->grid_array[0][0].mimic = border.north_west;
/* North east corner */
- grid_array[0][MAX_WID - 1].mimic = border.north_east;
+ current_floor_ptr->grid_array[0][MAX_WID - 1].mimic = border.north_east;
/* South west corner */
- grid_array[MAX_HGT - 1][0].mimic = border.south_west;
+ current_floor_ptr->grid_array[MAX_HGT - 1][0].mimic = border.south_west;
/* South east corner */
- grid_array[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east;
+ current_floor_ptr->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 (y = 0; y < current_floor_ptr->height; y++)
{
- for (x = 0; x < cur_wid; x++)
+ for (x = 0; x < current_floor_ptr->width; x++)
{
- g_ptr = &grid_array[y][x];
+ g_ptr = ¤t_floor_ptr->grid_array[y][x];
if (is_daytime())
{
if (p_ptr->teleport_town)
{
- for (y = 0; y < cur_hgt; y++)
+ for (y = 0; y < current_floor_ptr->height; y++)
{
- for (x = 0; x < cur_wid; x++)
+ for (x = 0; x < current_floor_ptr->width; x++)
{
- g_ptr = &grid_array[y][x];
+ g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Seeing true feature code (ignore mimic) */
f_ptr = &f_info[g_ptr->feat];
else if (p_ptr->leaving_dungeon)
{
- for (y = 0; y < cur_hgt; y++)
+ for (y = 0; y < current_floor_ptr->height; y++)
{
- for (x = 0; x < cur_wid; x++)
+ for (x = 0; x < current_floor_ptr->width; x++)
{
- g_ptr = &grid_array[y][x];
+ g_ptr = ¤t_floor_ptr->grid_array[y][x];
if (cave_have_flag_grid(g_ptr, FF_ENTRANCE))
{
(void)alloc_monster(generate_encounter ? 0 : 3, mode);
}
- if(generate_encounter) ambush_flag = TRUE;
+ if(generate_encounter) p_ptr->ambush_flag = TRUE;
generate_encounter = FALSE;
/* Fill the arrays of floors and walls in the good proportions */
for (i = 0; i < MAX_WID; i++)
for (j = 0; j < MAX_HGT; j++)
{
- grid_array[j][i].feat = feat_permanent;
+ current_floor_ptr->grid_array[j][i].feat = feat_permanent;
}
/* Init the wilderness */
- process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
+ process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
/* Fill the map */
- for (i = 0; i < max_wild_x; i++)
- for (j = 0; j < max_wild_y; j++)
+ for (i = 0; i < current_world_ptr->max_wild_x; i++)
+ for (j = 0; j < current_world_ptr->max_wild_y; j++)
{
if (wilderness[j][i].town && (wilderness[j][i].town != NO_TOWN))
{
- grid_array[j][i].feat = (s16b)feat_town;
- grid_array[j][i].special = (s16b)wilderness[j][i].town;
+ current_floor_ptr->grid_array[j][i].feat = (s16b)feat_town;
+ current_floor_ptr->grid_array[j][i].special = (s16b)wilderness[j][i].town;
}
- else if (wilderness[j][i].road) grid_array[j][i].feat = feat_floor;
+ else if (wilderness[j][i].road) current_floor_ptr->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)))
{
- grid_array[j][i].feat = feat_entrance;
- grid_array[j][i].special = (byte)wilderness[j][i].entrance;
+ current_floor_ptr->grid_array[j][i].feat = feat_entrance;
+ current_floor_ptr->grid_array[j][i].special = (byte)wilderness[j][i].entrance;
}
- else grid_array[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain];
+ else current_floor_ptr->grid_array[j][i].feat = conv_terrain2feat[wilderness[j][i].terrain];
- grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK);
+ current_floor_ptr->grid_array[j][i].info |= (CAVE_GLOW | CAVE_MARK);
}
- cur_hgt = (s16b) max_wild_y;
- cur_wid = (s16b) max_wild_x;
+ current_floor_ptr->height = (s16b) current_world_ptr->max_wild_y;
+ current_floor_ptr->width = (s16b) current_world_ptr->max_wild_x;
- if (cur_hgt > MAX_HGT) cur_hgt = MAX_HGT;
- if (cur_wid > MAX_WID) cur_wid = MAX_WID;
+ if (current_floor_ptr->height > MAX_HGT) current_floor_ptr->height = MAX_HGT;
+ if (current_floor_ptr->width > MAX_WID) current_floor_ptr->width = MAX_WID;
/* Assume illegal panel */
- panel_row_min = cur_hgt;
- panel_col_min = cur_wid;
+ panel_row_min = current_floor_ptr->height;
+ panel_col_min = current_floor_ptr->width;
/* Place the player */
p_ptr->x = p_ptr->wilderness_x;
/* Unused */
(void)ymin;
(void)ymax;
-
- /* Paranoia */
if (!(buf[0] == 'W')) return (PARSE_ERROR_GENERIC);
switch (buf[2])
p_ptr->wilderness_x = atoi(zz[1]);
if ((p_ptr->wilderness_x < 1) ||
- (p_ptr->wilderness_x > max_wild_x) ||
+ (p_ptr->wilderness_x > current_world_ptr->max_wild_x) ||
(p_ptr->wilderness_y < 1) ||
- (p_ptr->wilderness_y > max_wild_y))
+ (p_ptr->wilderness_y > current_world_ptr->max_wild_y))
{
return (PARSE_ERROR_OUT_OF_BOUNDS);
}
POSITION x, y;
/* Init wilderness seeds */
- for (x = 0; x < max_wild_x; x++)
+ for (x = 0; x < current_world_ptr->max_wild_x; x++)
{
- for (y = 0; y < max_wild_y; y++)
+ for (y = 0; y < current_world_ptr->max_wild_y; y++)
{
wilderness[y][x].seed = randint0(0x10000000);
wilderness[y][x].entrance = 0;
int i;
/* Allocate the wilderness (two-dimension array) */
- C_MAKE(wilderness, max_wild_y, wilderness_type_ptr);
- C_MAKE(wilderness[0], max_wild_x * max_wild_y, wilderness_type);
+ C_MAKE(wilderness, current_world_ptr->max_wild_y, wilderness_type_ptr);
+ C_MAKE(wilderness[0], current_world_ptr->max_wild_x * current_world_ptr->max_wild_y, wilderness_type);
/* Init the other pointers */
- for (i = 1; i < max_wild_y; i++)
- wilderness[i] = wilderness[0] + i * max_wild_x;
+ for (i = 1; i < current_world_ptr->max_wild_y; i++)
+ wilderness[i] = wilderness[0] + i * current_world_ptr->max_wild_x;
generate_encounter = FALSE;
check++;
}
- else /* Paranoia */
+ else
{
plog_fmt("Format error");
}
}
-
- /* Paranoia */
if (cur < MAX_FEAT_IN_TERRAIN)
{
plog_fmt("Too few parameters");
if (lite_town || vanilla_town)
{
-#ifdef JP
- msg_print("荒野なんてない。");
-#else
- msg_print("No global map.");
-#endif
+ msg_print(_("荒野なんてない。", "No global map."));
return FALSE;
}
/* Go back to the ordinary map */
p_ptr->wild_mode = FALSE;
-
- /* Leaving */
p_ptr->leaving = TRUE;
/* Succeed */
for (i = 1; i < m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (is_pet(m_ptr) && i != p_ptr->riding) have_pet = TRUE;
if (MON_CSLEEP(m_ptr)) continue;
if (m_ptr->cdis > MAX_SIGHT) continue;
if (!is_hostile(m_ptr)) continue;
-#ifdef JP
- msg_print("敵がすぐ近くにいるときは広域マップに入れない!");
-#else
- msg_print("You cannot enter global map, since there is some monsters nearby!");
-#endif
+ msg_print(_("敵がすぐ近くにいるときは広域マップに入れない!",
+ "You cannot enter global map, since there is some monsters nearby!"));
free_turn(p_ptr);
return FALSE;
}
if (have_pet)
{
-#ifdef JP
- concptr msg = "ペットを置いて広域マップに入りますか?";
-#else
- concptr msg = "Do you leave your pets behind? ";
-#endif
+ concptr msg = _("ペットを置いて広域マップに入りますか?",
+ "Do you leave your pets behind? ");
if (!get_check_strict(msg, CHECK_OKAY_CANCEL))
{
}
}
- /* HACK */
- p_ptr->energy_use = 1000;
+ take_turn(p_ptr, 1000);
/* Remember the position */
p_ptr->oldpx = p_ptr->x;
/* Go into the global map */
p_ptr->wild_mode = TRUE;
-
- /* Leaving */
p_ptr->leaving = TRUE;
/* Succeed */