]> granicus.if.org Git - nethack/commitdiff
water description
authorPatR <rankin@nethack.org>
Sun, 6 Feb 2022 21:20:15 +0000 (13:20 -0800)
committerPatR <rankin@nethack.org>
Sun, 6 Feb 2022 21:20:15 +0000 (13:20 -0800)
The wall of water goaded me into updating waterbody_name().  It's
mostly the same, aside from being moved from mkmaze.c to pager.c and
adding "{wall of|limitless} water" instead of plain "water" for WATER
terrain.  I'm not very happy with "limitless" for the Plane of Water
because limits imposed by air bubbles are all over the place.  "Wall
of water" might work ok for that level.

Water on Medusa's level is now described as "shallow sea" rather than
lame "water".  The two unusual pools on the Samurai home level are
described as "pond" rather than previous "water" which replaced 3.6's
ridiculous "moat".  When lava is hallucinated, it is described as
"molten <substance>" (yielding silly things like "molten yoghurt"),
rather than just "<substance>" to distinguish it from hallucinated
water.  'autodescribe' doesn't use waterbody_name() though.

include/extern.h
src/mkmaze.c
src/pager.c
src/trap.c

index 2cbe6c487cedf48fe18144ae6bc8d874b4d6aeb2..dea9bedbc6cb9d01e1310659f224089497f8dd26 100644 (file)
@@ -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 *);
index b1cc1ece9d1baf62a07d9b16bacda5f4267f198a..17dda6a8c8a9c0ddbe2721ee58e8807fffe45a92 100644 (file)
@@ -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)
 {
index 55b8a2f8dbaaa8ebce0f2ff3b4bd9160412ce6f8..a454c8872ea61ed7b0f40ee8fd6706486ce03190 100644 (file)
@@ -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.
index 3c109d4b44964db276cf2451f17bb26f19c93d91..af4205763b7a525d56b5a417d6e72f9ebe460861 100644 (file)
@@ -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)