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