*/
/*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
*
- * 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.
*/
#include "angband.h"
{
for (tx = x - width - 1; tx <= x + width + 1; tx++)
{
- if (!in_bounds(ty, tx)) continue;
+ if (!in_bounds2(ty, tx)) continue;
c_ptr = &cave[ty][tx];
if (distance(ty, tx, y, x) > rand_spread(width, 1)) continue;
/* Do not convert permanent features */
- if (cave_perma_grid(c_ptr) && (c_ptr->feat != FEAT_MOUNTAIN)) continue;
+ if (cave_perma_grid(c_ptr) && !have_flag(f_flags_grid(c_ptr), FF_MOUNTAIN)) continue;
/*
* Clear previous contents, add feature
c_ptr->mimic = 0;
/* Lava terrain glows */
- if ((feat1 == FEAT_DEEP_LAVA) || (feat1 == FEAT_SHAL_LAVA))
+ if (have_flag(f_info[feat1].flags, FF_LAVA))
{
- c_ptr->info |= CAVE_GLOW;
+ if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) c_ptr->info |= CAVE_GLOW;
}
/* Hack -- don't teleport here */
int i, tx, ty;
int y, x, dir;
int dummy = 0;
- bool treasure = FALSE;
cave_type *c_ptr;
+ feature_type *f_ptr;
+
+ feature_type *streamer_ptr = &f_info[feat];
+ bool streamer_is_wall = have_flag(streamer_ptr->flags, FF_WALL) && !have_flag(streamer_ptr->flags, FF_PERMANENT);
+ bool streamer_may_have_gold = have_flag(streamer_ptr->flags, FF_MAY_HAVE_GOLD);
/* Hack -- Choose starting point */
- y = rand_spread(cur_hgt / 2, 10);
- x = rand_spread(cur_wid / 2, 15);
+ y = rand_spread(cur_hgt / 2, cur_hgt / 6);
+ x = rand_spread(cur_wid / 2, cur_wid / 6);
/* Choose a random compass direction */
dir = ddd[randint0(8)];
{
ty = rand_spread(y, d);
tx = rand_spread(x, d);
- if (!in_bounds(ty, tx)) continue;
+ if (!in_bounds2(ty, tx)) continue;
break;
}
/* Access the grid */
c_ptr = &cave[ty][tx];
+ f_ptr = &f_info[c_ptr->feat];
- if ((c_ptr->feat >= FEAT_DEEP_WATER) && (c_ptr->feat <= FEAT_SHAL_LAVA)) continue;
- if ((c_ptr->feat >= FEAT_PERM_EXTRA) && (c_ptr->feat <= FEAT_PERM_SOLID)) continue;
+ if (have_flag(f_ptr->flags, FF_MOVE) && (have_flag(f_ptr->flags, FF_WATER) || have_flag(f_ptr->flags, FF_LAVA)))
+ continue;
+ if (cave_perma_grid(c_ptr) && !have_flag(f_ptr->flags, FF_MOUNTAIN)) continue;
/* Only convert "granite" walls */
- if ((feat >= FEAT_MAGMA) && (feat <= FEAT_WALL_SOLID))
+ if (streamer_is_wall)
{
if (!is_extra_grid(c_ptr) && !is_inner_grid(c_ptr) && !is_outer_grid(c_ptr) && !is_solid_grid(c_ptr)) continue;
if (is_closed_door(c_ptr->feat)) continue;
- if ((feat == FEAT_MAGMA) || (feat == FEAT_QUARTZ)) treasure = TRUE;
- }
- else
- {
- if (cave_perma_grid(c_ptr) && (c_ptr->feat != FEAT_MOUNTAIN)) continue;
}
/* Clear previous contents, add proper vein type */
/* Paranoia: Clear mimic field */
c_ptr->mimic = 0;
- /* Hack -- Add some (known) treasure */
- if (treasure && one_in_(chance)) c_ptr->feat += 0x04;
+ if (streamer_may_have_gold)
+ {
+ /* Hack -- Add some known treasure */
+ if (one_in_(chance))
+ {
+ cave_alter_feat(ty, tx, FF_MAY_HAVE_GOLD);
+ }
+
+ /* Hack -- Add some hidden treasure */
+ else if (one_in_(chance / 4))
+ {
+ cave_alter_feat(ty, tx, FF_MAY_HAVE_GOLD);
+ cave_alter_feat(ty, tx, FF_ENSECRET);
+ }
+ }
}
if (dummy >= SAFE_MAX_ATTEMPTS)
c_ptr->mimic = 0;
/* Light area since is open above */
- cave[j][i].info |= (CAVE_GLOW | CAVE_ROOM);
+ if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) cave[j][i].info |= (CAVE_GLOW | CAVE_ROOM);
}
}
}
*/
void destroy_level(void)
{
- int y1, x1, y, x, k, t, n;
-
- cave_type *c_ptr;
+ int y1, x1, n;
/* Note destroyed levels */
#ifdef JP
-if (cheat_room) msg_print("Ç˲õ¤µ¤ì¤¿³¬");
+ if (cheat_room) msg_print("Ç˲õ¤µ¤ì¤¿³¬");
#else
if (cheat_room) msg_print("Destroyed Level");
#endif
-
/* Drop a few epi-centers (usually about two) */
for (n = 0; n < randint1(5); n++)
{
x1 = rand_range(5, cur_wid - 1 - 5);
y1 = rand_range(5, cur_hgt - 1 - 5);
- /* Big area of affect */
- for (y = (y1 - 15); y <= (y1 + 15); y++)
- {
- for (x = (x1 - 15); x <= (x1 + 15); x++)
- {
- /* Skip illegal grids */
- if (!in_bounds(y, x)) continue;
-
- /* Extract the distance */
- k = distance(y1, x1, y, x);
-
- /* Stay in the circle of death */
- if (k >= 16) continue;
-
- /* Delete the monster (if any) */
- delete_monster(y, x);
-
- /* Access the grid */
- c_ptr = &cave[y][x];
-
- /* Destroy valid grids */
- if (cave_valid_grid(c_ptr))
- {
- /* Delete objects */
- delete_object(y, x);
-
- /* Wall (or floor) type */
- t = randint0(200);
-
- /* Granite */
- if (t < 20)
- {
- /* Create granite wall */
- place_extra_grid(c_ptr);
- }
-
- /* Quartz */
- else if (t < 70)
- {
- /* Create quartz vein */
- c_ptr->feat = FEAT_QUARTZ;
- }
-
- /* Magma */
- else if (t < 100)
- {
- /* Create magma vein */
- c_ptr->feat = FEAT_MAGMA;
- }
-
- /* Floor */
- else
- {
- /* Create floor */
- place_floor_grid(c_ptr);
- }
-
- /* Clear garbage of hidden trap or door */
- c_ptr->mimic = 0;
-
- /* No longer part of a room or vault */
- c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
- /* No longer illuminated or known */
- c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
- }
- }
- }
+ (void)destroy_area(y1, x1, 15, TRUE);
}
}