hallucinatory water and lava terrain

When browsing the map while hallucinating and looking at a pool, a
moat, or 'other' water or at molten lava, report with hallucinatory
liquids rather than the ordinary substance.  Likewise when browsing
self on map or using ^X would report "sinking into lava".
This commit is contained in:
PatR
2020-01-11 09:34:01 -08:00
parent 92994f6d71
commit 7c3ae74c27
5 changed files with 55 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.61 $ $NHDT-Date: 1578761136 2020/01/11 16:45:36 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.62 $ $NHDT-Date: 1578764038 2020/01/11 17:33:58 $
General Fixes and Modified Features
-----------------------------------
@@ -98,6 +98,8 @@ add 'quick_farsight' option to provide some control over random clairvoyance
revealed map can seem intrusive; doesn't affect clairvoyance spell
replace "money" in in-game texts with "gold"
when hallucinating, see hallucinated currencies instead of bits for an ale
when hallucinating, see hallucinated liquids when looking at water or lava
on the map
applying a spellbook hints about read charges left
wizard mode wishing for level topology can now create hidden doors (ask for
"secret door" when at a door or wall location) and hidden corridor

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1578668018 2020/01/10 14:53:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.782 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1578764033 2020/01/11 17:33:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.783 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -231,7 +231,7 @@ E void FDECL(rhack, (char *));
E int NDECL(doextlist);
E int NDECL(extcmd_via_menu);
E int NDECL(enter_explore_mode);
E char *FDECL(trap_predicament, (char *, BOOLEAN_P));
E char *FDECL(trap_predicament, (char *, int, BOOLEAN_P));
E void FDECL(enlightenment, (int, int));
E void FDECL(youhiding, (BOOLEAN_P, int));
E void FDECL(show_conduct, (int));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1578668021 2020/01/10 14:53:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.390 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1578764033 2020/01/11 17:33:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.391 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1813,8 +1813,9 @@ walking_on_water()
/* describe u.utraptype; used by status_enlightenment() and self_lookat() */
char *
trap_predicament(outbuf, wizxtra)
trap_predicament(outbuf, final, wizxtra)
char *outbuf;
int final;
boolean wizxtra;
{
struct trap *t;
@@ -1826,9 +1827,7 @@ boolean wizxtra;
Strcpy(outbuf, "tethered to something buried");
break;
case TT_LAVA:
/* surface() should always yield "lava" here unless hallucinatory
surfaces get added someday [please don't...] */
Sprintf(outbuf, "sinking into %s", surface(u.ux, u.uy));
Sprintf(outbuf, "sinking into %s", final ? "lava" : hliquid("lava"));
break;
case TT_INFLOOR:
Sprintf(outbuf, "stuck in %s", the(surface(u.ux, u.uy)));
@@ -2547,7 +2546,7 @@ int final;
char predicament[BUFSZ];
boolean anchored = (u.utraptype == TT_BURIEDBALL);
(void) trap_predicament(predicament, wizard);
(void) trap_predicament(predicament, final, wizard);
if (u.usteed) { /* not `Riding' here */
Sprintf(buf, "%s%s ", anchored ? "you and " : "", steedname);
*buf = highc(*buf);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_name.c $NHDT-Date: 1574648939 2019/11/25 02:28:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.167 $ */
/* NetHack 3.6 do_name.c $NHDT-Date: 1578764034 2020/01/11 17:33:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.169 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2161,14 +2161,26 @@ static NEARDATA const char *const hliquids[] = {
"caramel sauce", "ink", "aqueous humour", "milk substitute",
"fruit juice", "glowing lava", "gastric acid", "mineral water",
"cough syrup", "quicksilver", "sweet vitriol", "grey goo", "pink slime",
/* "new coke (tm)", --better not */
};
/* if hallucinating, return a random liquid instead of 'liquidpref' */
const char *
hliquid(liquidpref)
const char *liquidpref;
const char *liquidpref; /* use as-is when not hallucinating (unless empty) */
{
return (Hallucination || !liquidpref) ? hliquids[rn2(SIZE(hliquids))]
: liquidpref;
if (Hallucination || !liquidpref || !*liquidpref) {
int indx, count = SIZE(hliquids);
/* if we have a non-hallucinatory default value, include it
among the choices */
if (liquidpref && *liquidpref)
++count;
indx = rn2_on_display_rng(count);
if (indx < SIZE(hliquids))
return hliquids[indx];
}
return liquidpref;
}
/* Aliases for road-runner nemesis

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pager.c $NHDT-Date: 1578761137 2020/01/11 16:45:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.182 $ */
/* NetHack 3.6 pager.c $NHDT-Date: 1578764034 2020/01/11 17:33:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.183 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -95,7 +95,7 @@ char *outbuf;
Sprintf(eos(outbuf), ", chained to %s",
uball ? ansimpleoname(uball) : "nothing?");
if (u.utrap) /* bear trap, pit, web, in-floor, in-lava, tethered */
Sprintf(eos(outbuf), ", %s", trap_predicament(trapbuf, FALSE));
Sprintf(eos(outbuf), ", %s", trap_predicament(trapbuf, 0, FALSE));
return outbuf;
}
@@ -842,14 +842,16 @@ struct permonst **for_supplement;
static const char mon_interior[] = "the interior of a monster",
unreconnoitered[] = "unreconnoitered";
static char look_buf[BUFSZ];
char prefix[BUFSZ];
char prefix[BUFSZ], gobbledygook[33];
int i, alt_i, j, glyph = NO_GLYPH,
skipped_venom = 0, found = 0; /* count of matching syms found */
boolean hit_trap, need_to_look = FALSE,
submerged = (Underwater && !Is_waterlevel(&u.uz));
submerged = (Underwater && !Is_waterlevel(&u.uz)),
hallucinate = (Hallucination && !g.program_state.gameover);
const char *x_str;
nhsym tmpsym;
gobbledygook[0] = '\0'; /* no hallucinatory liquid (yet) */
if (looked) {
int oc;
unsigned os;
@@ -916,7 +918,8 @@ struct permonst **for_supplement;
/* Check for monsters */
if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) {
for (i = 1; i < MAXMCLASSES; i++) {
if (sym == (looked ? g.showsyms[i + SYM_OFF_M] : def_monsyms[i].sym)
if (sym == (looked ? g.showsyms[i + SYM_OFF_M]
: def_monsyms[i].sym)
&& def_monsyms[i].explain && *def_monsyms[i].explain) {
need_to_look = TRUE;
if (!found) {
@@ -995,14 +998,26 @@ struct permonst **for_supplement;
/* alt_i is now 3 or more and no longer of interest */
}
if (sym == (looked ? g.showsyms[i] : defsyms[i].sym) && *x_str) {
/* POOL, MOAT, and WATER are "water", LAVAPOOL is "molten lava" */
boolean water_or_lava = (!strcmp(x_str, "water")
|| !strcmp(x_str, "molten lava"));
/* avoid "an unexplored", "an stone", "an air", "a water",
"a floor of a room", "a dark part of a room";
"a molten lava", "a floor of a room", "a dark part of a room";
article==2 => "the", 1 => "an", 0 => (none) */
int article = strstri(x_str, " of a room") ? 2
: !(alt_i <= 2
|| strcmp(x_str, "air") == 0
|| strcmp(x_str, "land") == 0
|| strcmp(x_str, "water") == 0);
|| water_or_lava);
/* substitute for "water" and "molten lava" when hallucinating */
if (water_or_lava && hallucinate) {
if (*gobbledygook)
continue; /* just 1 or player could tell h2o from lava */
x_str = strncpy(gobbledygook, hliquid(x_str),
(int) sizeof gobbledygook - 1);
gobbledygook[sizeof gobbledygook - 1] = '\0';
}
if (!found) {
if (is_cmap_trap(i)) {
@@ -1135,6 +1150,11 @@ struct permonst **for_supplement;
pm = lookat(cc.x, cc.y, look_buf, monbuf);
if (pm && for_supplement)
*for_supplement = pm;
/* lookat() doesn't hallucinate liquids; substitute ours */
if (*gobbledygook && (!strcmp(look_buf, "water")
|| !strcmp(look_buf, "molten lava")))
Strcpy(look_buf, gobbledygook);
*firstmatch = look_buf;
if (*(*firstmatch)) {
Sprintf(temp_buf, " (%s)", *firstmatch);
@@ -1149,6 +1169,8 @@ struct permonst **for_supplement;
}
}
}
if (*firstmatch == gobbledygook) /* fixup for 'found==1' */
*firstmatch = strcpy(look_buf, gobbledygook);
return found;
}