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
+29 -7
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;
}