diff --git a/include/extern.h b/include/extern.h index 2cbe6c487..dea9bedbc 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1350,7 +1350,6 @@ extern void movebubbles(void); extern void water_friction(void); extern void save_waterlevel(NHFILE *); extern void restore_waterlevel(NHFILE *); -extern const char *waterbody_name(xchar, xchar); /* ### mkobj.c ### */ @@ -1934,6 +1933,7 @@ extern char *self_lookat(char *); extern char *monhealthdescr(struct monst *mon, boolean, char *); extern void mhidden_description(struct monst *, boolean, char *); extern boolean object_from_map(int,int,int,struct obj **); +extern const char *waterbody_name(xchar, xchar); extern int do_screen_description(coord, boolean, int, char *, const char **, struct permonst **); extern int do_look(int, coord *); diff --git a/src/mkmaze.c b/src/mkmaze.c index b1cc1ece9..17dda6a8c 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1602,38 +1602,6 @@ restore_waterlevel(NHFILE* nhfp) b->next = (struct bubble *) 0; } -const char * -waterbody_name(xchar x, xchar y) -{ - struct rm *lev; - schar ltyp; - - if (!isok(x, y)) - return "drink"; /* should never happen */ - lev = &levl[x][y]; - ltyp = lev->typ; - if (ltyp == DRAWBRIDGE_UP) - ltyp = db_under_typ(lev->drawbridgemask); - - if (ltyp == LAVAPOOL) - return hliquid("lava"); - else if (ltyp == ICE) - return "ice"; - else if (ltyp == POOL) - return "pool of water"; - else if (ltyp == WATER || Is_waterlevel(&u.uz)) - ; /* fall through to default return value */ - else if (Is_juiblex_level(&u.uz)) - return "swamp"; - else if (ltyp == MOAT && !Is_medusa_level(&u.uz) - /* samurai has two moat spots on quest home level that seem - silly if described as such (maybe change them to pools?) */ - && !(Role_if(PM_SAMURAI) && Is_qstart(&u.uz))) - return "moat"; - - return hliquid("water"); -} - static void set_wportal(void) { diff --git a/src/pager.c b/src/pager.c index 55b8a2f8d..a454c8872 100644 --- a/src/pager.c +++ b/src/pager.c @@ -448,6 +448,57 @@ look_at_monster(char *buf, } /* monbuf is non-null */ } +/* describe a pool location's contents; might return a static buffer so + caller should use it or copy it before calling waterbody_name() again + [3.7: moved here from mkmaze.c] */ +const char * +waterbody_name(xchar x, xchar y) +{ + static char pooltype[40]; + struct rm *lev; + schar ltyp; + + if (!isok(x, y)) + return "drink"; /* should never happen */ + lev = &levl[x][y]; + ltyp = lev->typ; + if (ltyp == DRAWBRIDGE_UP) + ltyp = db_under_typ(lev->drawbridgemask); + + if (ltyp == LAVAPOOL) { + if (!Hallucination) + return "lava"; + Snprintf(pooltype, sizeof pooltype, "molten %s", hliquid("lava")); + return pooltype; + } else if (ltyp == ICE) { + return "ice"; + } else if (ltyp == POOL) { + Snprintf(pooltype, sizeof pooltype, "pool of %s", hliquid("water")); + return pooltype; + } else if (ltyp == MOAT) { + /* a bit of extra flavor over general moat */ + if (Is_medusa_level(&u.uz)) + /* somewhat iffy since ordinary stairs can take you beneath, + but previous generic "water" was rather anti-climactic */ + return "shallow sea"; + else if (Is_juiblex_level(&u.uz)) + return "swamp"; + else if (Role_if(PM_SAMURAI) && Is_qstart(&u.uz)) + /* samurai quest home level has two isolated moat spots; + they sound silly if farlook describes them as such */ + return "pond"; + else + return "moat"; + } else if (ltyp == WATER) { + Snprintf(pooltype, sizeof pooltype, "%s %s", + !Is_waterlevel(&u.uz) ? "wall of" : "limitless", + hliquid("water")); + return pooltype; + } + /* default; should be unreachable */ + return "water"; /* don't hallucinate this as some other liquid */ +} + /* * Return the name of the glyph found at (x,y). * If not hallucinating and the glyph is a monster, also monster data. diff --git a/src/trap.c b/src/trap.c index 3c109d4b4..af4205763 100644 --- a/src/trap.c +++ b/src/trap.c @@ -4192,10 +4192,8 @@ drown(void) } if (!u.uinwater) { - You("%s into the %s%s%c", is_solid ? "plunge" : "fall", - is_solid ? "wall of " : "", - hliquid("water"), - Amphibious || Swimming ? '.' : '!'); + You("%s into the %s%c", is_solid ? "plunge" : "fall", + waterbody_name(u.ux, u.uy), (Amphibious || Swimming) ? '.' : '!'); if (!Swimming && !is_solid) You("sink like %s.", Hallucination ? "the Titanic" : "a rock"); } @@ -5796,7 +5794,7 @@ lava_effects(void) goto burn_stuff; } } else - You("fall into the %s!", hliquid("lava")); + You("fall into the %s!", waterbody_name(u.ux, u.uy)); usurvive = Lifesaved || discover; if (wizard) @@ -5855,7 +5853,7 @@ lava_effects(void) hero needs to escape immediately */ set_utrap((unsigned) (rn1(4, 4) + ((boil_away ? 2 : rn1(4, 12)) << 8)), TT_LAVA); - You("sink into the %s%s!", hliquid("lava"), + You("sink into the %s%s!", waterbody_name(u.ux, u.uy), !boil_away ? ", but it only burns slightly" : " and are about to be immolated"); if (Fire_resistance)