Use IS_WATERWALL and is_waterwall
This commit is contained in:
@@ -296,6 +296,7 @@ extern void free_nomakedefs(void);
|
||||
|
||||
/* ### dbridge.c ### */
|
||||
|
||||
extern boolean is_waterwall(xchar, xchar);
|
||||
extern boolean is_pool(int, int);
|
||||
extern boolean is_lava(int, int);
|
||||
extern boolean is_pool_or_lava(int, int);
|
||||
|
||||
@@ -105,6 +105,7 @@ enum levl_typ_types {
|
||||
#define IS_FURNITURE(typ) ((typ) >= STAIRS && (typ) <= ALTAR)
|
||||
#define IS_AIR(typ) ((typ) == AIR || (typ) == CLOUD)
|
||||
#define IS_SOFT(typ) ((typ) == AIR || (typ) == CLOUD || IS_POOL(typ))
|
||||
#define IS_WATERWALL(typ) ((typ) == WATER)
|
||||
|
||||
/*
|
||||
* Note: secret doors (SDOOR) want to use both rm.doormask and
|
||||
|
||||
@@ -33,6 +33,14 @@ static boolean e_missed(struct entity *, boolean);
|
||||
static boolean e_jumps(struct entity *);
|
||||
static void do_entity(struct entity *);
|
||||
|
||||
boolean
|
||||
is_waterwall(xchar x, xchar y)
|
||||
{
|
||||
if (isok(x, y) && IS_WATERWALL(levl[x][y].typ))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
boolean
|
||||
is_pool(int x, int y)
|
||||
{
|
||||
|
||||
@@ -851,7 +851,7 @@ hurtle_step(genericptr_t arg, int x, int y)
|
||||
switch_terrain();
|
||||
|
||||
if (is_pool(x, y) && !u.uinwater) {
|
||||
if ((Is_waterlevel(&u.uz) && levl[x][y].typ == WATER)
|
||||
if ((Is_waterlevel(&u.uz) && is_waterwall(x,y))
|
||||
|| !(Levitation || Flying || Wwalking)) {
|
||||
g.multi = 0; /* can move, so drown() allows crawling out of water */
|
||||
(void) drown();
|
||||
|
||||
@@ -1535,7 +1535,7 @@ u_simple_floortyp(xchar x, xchar y)
|
||||
{
|
||||
boolean u_in_air = (Levitation || Flying || !grounded(g.youmonst.data));
|
||||
|
||||
if (levl[x][y].typ == WATER)
|
||||
if (is_waterwall(x,y))
|
||||
return WATER; /* wall of water, fly/lev does not matter */
|
||||
if (!u_in_air) {
|
||||
if (is_pool(x,y))
|
||||
@@ -1551,7 +1551,7 @@ static boolean
|
||||
swim_move_danger(xchar x, xchar y)
|
||||
{
|
||||
schar newtyp = u_simple_floortyp(x, y);
|
||||
boolean liquid_wall = (newtyp == WATER);
|
||||
boolean liquid_wall = IS_WATERWALL(newtyp);
|
||||
|
||||
if ((newtyp != u_simple_floortyp(u.ux, u.uy))
|
||||
&& !Stunned && !Confusion && levl[x][y].seenv
|
||||
@@ -2352,7 +2352,7 @@ switch_terrain(void)
|
||||
{
|
||||
struct rm *lev = &levl[u.ux][u.uy];
|
||||
boolean blocklev = (IS_ROCK(lev->typ) || closed_door(u.ux, u.uy)
|
||||
|| lev->typ == WATER),
|
||||
|| IS_WATERWALL(lev->typ)),
|
||||
was_levitating = !!Levitation, was_flying = !!Flying;
|
||||
|
||||
if (blocklev) {
|
||||
@@ -2464,7 +2464,7 @@ pooleffects(boolean newspot) /* true if called by spoteffects */
|
||||
if (is_lava(u.ux, u.uy)) {
|
||||
if (lava_effects())
|
||||
return TRUE;
|
||||
} else if ((!Wwalking || levl[u.ux][u.uy].typ == WATER)
|
||||
} else if ((!Wwalking || is_waterwall(u.ux,u.uy))
|
||||
&& (newspot || !u.uinwater || !(Swimming || Amphibious))) {
|
||||
if (drown())
|
||||
return TRUE;
|
||||
|
||||
@@ -239,8 +239,8 @@ castmu(register struct monst *mtmp,
|
||||
&& !is_undirected_spell(mattk->adtyp, spellnum)) {
|
||||
pline("%s casts a spell at %s!",
|
||||
canseemon(mtmp) ? Monnam(mtmp) : "Something",
|
||||
levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
|
||||
: "thin air");
|
||||
is_waterwall(mtmp->mux,mtmp->muy) ? "empty water"
|
||||
: "thin air");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ wildmiss(struct monst *mtmp, struct attack *mattk)
|
||||
break;
|
||||
case 2:
|
||||
pline("%s strikes at %s!", Monst_name,
|
||||
(levl[mtmp->mux][mtmp->muy].typ == WATER)
|
||||
is_waterwall(mtmp->mux,mtmp->muy)
|
||||
? "empty water"
|
||||
: "thin air");
|
||||
break;
|
||||
@@ -1402,8 +1402,8 @@ explmu(struct monst *mtmp, struct attack *mattk, boolean ufound)
|
||||
if (!ufound) {
|
||||
pline("%s explodes at a spot in %s!",
|
||||
canseemon(mtmp) ? Monnam(mtmp) : "It",
|
||||
levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
|
||||
: "thin air");
|
||||
is_waterwall(mtmp->mux,mtmp->muy) ? "empty water"
|
||||
: "thin air");
|
||||
} else {
|
||||
hitmsg(mtmp, mattk);
|
||||
}
|
||||
|
||||
@@ -708,7 +708,7 @@ static int
|
||||
minliquid_core(struct monst* mtmp)
|
||||
{
|
||||
boolean inpool, inlava, infountain;
|
||||
boolean waterwall = (levl[mtmp->mx][mtmp->my].typ == WATER);
|
||||
boolean waterwall = is_waterwall(mtmp->mx,mtmp->my);
|
||||
|
||||
/* [ceiling clingers are handled below] */
|
||||
inpool = (is_pool(mtmp->mx, mtmp->my)
|
||||
@@ -1785,7 +1785,7 @@ mfndpos(
|
||||
|
||||
nodiag = NODIAG(mdat - mons);
|
||||
wantpool = (mdat->mlet == S_EEL);
|
||||
poolok = ((!Is_waterlevel(&u.uz) && !(nowtyp != WATER)
|
||||
poolok = ((!Is_waterlevel(&u.uz) && IS_WATERWALL(nowtyp)
|
||||
&& !grounded(mdat))
|
||||
|| (is_swimmer(mdat) && !wantpool));
|
||||
/* note: floating eye is the only is_floater() so this could be
|
||||
|
||||
@@ -1079,7 +1079,7 @@ linedup_callback(
|
||||
if (!isok(bx, by))
|
||||
return FALSE;
|
||||
if (IS_ROCK(levl[bx][by].typ) || closed_door(bx, by)
|
||||
|| levl[bx][by].typ == WATER)
|
||||
|| is_waterwall(bx, by))
|
||||
return FALSE;
|
||||
if ((*fnc)(bx, by))
|
||||
return TRUE;
|
||||
@@ -1123,7 +1123,7 @@ linedup(
|
||||
/* <bx,by> is guaranteed to eventually converge with <ax,ay> */
|
||||
bx += dx, by += dy;
|
||||
if (IS_ROCK(levl[bx][by].typ) || closed_door(bx, by)
|
||||
|| levl[bx][by].typ == WATER)
|
||||
|| is_waterwall(bx, by))
|
||||
return FALSE;
|
||||
if (sobj_at(BOULDER, bx, by))
|
||||
++boulderspots;
|
||||
|
||||
@@ -510,7 +510,7 @@ waterbody_name(xchar x, xchar y)
|
||||
} else {
|
||||
return "moat";
|
||||
}
|
||||
} else if (ltyp == WATER) {
|
||||
} else if (IS_WATERWALL(ltyp)) {
|
||||
if (Is_waterlevel(&u.uz))
|
||||
return "limitless water"; /* even if hallucinating */
|
||||
Snprintf(pooltype, sizeof pooltype, "wall of %s", hliquid("water"));
|
||||
|
||||
@@ -83,14 +83,14 @@ goodpos(int x, int y, struct monst* mtmp, long gpflags)
|
||||
if (mtmp == &g.youmonst)
|
||||
return (Swimming || Amphibious
|
||||
|| (!Is_waterlevel(&u.uz)
|
||||
&& !(levl[x][y].typ == WATER)
|
||||
&& !is_waterwall(x, y)
|
||||
/* water on the Plane of Water has no surface
|
||||
so there's no way to be on or above that */
|
||||
&& (Levitation || Flying || Wwalking)));
|
||||
else
|
||||
return (is_swimmer(mdat)
|
||||
|| (!Is_waterlevel(&u.uz)
|
||||
&& !(levl[x][y].typ == WATER)
|
||||
&& !is_waterwall(x, y)
|
||||
&& !grounded(mdat)));
|
||||
} else if (mdat->mlet == S_EEL && rn2(13) && !ignorewater) {
|
||||
return FALSE;
|
||||
|
||||
@@ -4185,7 +4185,7 @@ drown(void)
|
||||
const char *pool_of_water;
|
||||
boolean inpool_ok = FALSE, crawl_ok;
|
||||
int i, x, y;
|
||||
boolean is_solid = (levl[u.ux][u.uy].typ == WATER);
|
||||
boolean is_solid = is_waterwall(u.ux, u.uy);
|
||||
|
||||
feel_newsym(u.ux, u.uy); /* in case Blind, map the water here */
|
||||
/* happily wading in the same contiguous pool */
|
||||
|
||||
@@ -2911,7 +2911,7 @@ mhitm_ad_wrap(struct monst *magr, struct attack *mattk, struct monst *mdef,
|
||||
} else if (u.ustuck == magr) {
|
||||
if (is_pool(magr->mx, magr->my) && !Swimming && !Amphibious) {
|
||||
boolean moat = (levl[magr->mx][magr->my].typ != POOL)
|
||||
&& (levl[magr->mx][magr->my].typ != WATER)
|
||||
&& !is_waterwall(magr->mx, magr->my)
|
||||
&& !Is_medusa_level(&u.uz)
|
||||
&& !Is_waterlevel(&u.uz);
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ does_block(int x, int y, struct rm *lev)
|
||||
&& (lev->doormask & (D_CLOSED | D_LOCKED | D_TRAPPED))))
|
||||
return 1;
|
||||
|
||||
if (lev->typ == CLOUD || lev->typ == WATER
|
||||
if (lev->typ == CLOUD || IS_WATERWALL(lev->typ)
|
||||
|| (lev->typ == MOAT && Underwater))
|
||||
return 1;
|
||||
|
||||
|
||||
@@ -3460,7 +3460,7 @@ bhit(int ddx, int ddy, int range, /* direction and range */
|
||||
typ = levl[g.bhitpos.x][g.bhitpos.y].typ;
|
||||
|
||||
/* WATER aka "wall of water" stops items */
|
||||
if (typ == WATER) {
|
||||
if (IS_WATERWALL(typ)) {
|
||||
if (weapon == THROWN_WEAPON || weapon == KICKED_WEAPON)
|
||||
break;
|
||||
}
|
||||
@@ -4705,7 +4705,7 @@ zap_over_floor(xchar x, xchar y, int type, boolean *shopdamage,
|
||||
boolean lava = is_lava(x, y),
|
||||
moat = is_moat(x, y);
|
||||
|
||||
if (lev->typ == WATER) {
|
||||
if (IS_WATERWALL(lev->typ)) {
|
||||
/* For now, don't let WATER freeze. */
|
||||
if (see_it)
|
||||
pline_The("%s freezes for a moment.", hliquid("water"));
|
||||
|
||||
Reference in New Issue
Block a user