pull request #1123 - back-on-solid-ground

Pull request from entrez:  update some terain-change messaging and be
more consistent with "you find yourself back on solid ground."

Closes #1123
This commit is contained in:
PatR
2023-11-07 16:16:09 -08:00
6 changed files with 46 additions and 21 deletions

View File

@@ -2949,7 +2949,8 @@ extern void acid_damage(struct obj *);
extern int water_damage(struct obj *, const char *, boolean);
extern void water_damage_chain(struct obj *, boolean);
extern boolean rnd_nextto_goodpos(coordxy *, coordxy *, struct monst *);
extern void back_on_ground(int);
extern void back_on_ground(boolean);
extern void rescued_from_terrain(int);
extern boolean drown(void);
extern void drain_en(int, boolean);
extern int dountrap(void);

View File

@@ -2822,11 +2822,11 @@ pooleffects(
if (!is_pool(u.ux, u.uy)) {
if (Is_waterlevel(&u.uz)) {
You("pop into an air bubble.");
iflags.last_msg = PLNMSG_BACK_ON_GROUND;
} else if (is_lava(u.ux, u.uy)) {
You("leave the %s...", hliquid("water")); /* oops! */
} else {
You("are on solid %s again.",
is_ice(u.ux, u.uy) ? "ice" : "land");
back_on_ground(FALSE);
iflags.last_msg = PLNMSG_BACK_ON_GROUND;
}
} else if (Is_waterlevel(&u.uz)) {

View File

@@ -4216,8 +4216,6 @@ dfeature_at(coordxy x, coordxy y, char *buf)
cmap = S_lava; /* "molten lava" */
else if (is_ice(x, y))
dfeature = ice_descr(x, y, altbuf), cmap = -1; /* "ice" */
else if (IS_WATERWALL(ltyp))
dfeature = "wall of water";
else if (is_pool(x, y))
dfeature = "pool of water";
else if (IS_SINK(ltyp))

View File

@@ -384,17 +384,8 @@ describe_decor(void)
|| IS_LAVA(iflags.prev_decor)
|| iflags.prev_decor == ICE) {
if (iflags.last_msg != PLNMSG_BACK_ON_GROUND) {
const char *surf = is_ice(u.ux, u.uy)
? ice_descr(u.ux, u.uy, fbuf)
: surface(u.ux, u.uy);
if (!strcmpi(surf, "floor") || !strcmpi(surf, "ground"))
surf = "solid ground";
pline("%s %s %s.",
flags.verbose ? "You are back" : "Back",
(Levitation || Flying) ? "over" : "on", surf);
back_on_ground(FALSE);
}
}
}
iflags.prev_decor = ltyp;

View File

@@ -389,8 +389,8 @@ fix_worst_trouble(int trouble)
/* teleport should always succeed, but if not, just untrap them */
if (!safe_teleds(TELEDS_NO_FLAGS))
reset_utrap(TRUE);
back_on_ground(DISSOLVED); /* DISSOLVED: pending cause of death
* if trouble didn't get cured */
rescued_from_terrain(DISSOLVED); /* DISSOLVED: pending cause of death
* if trouble didn't get cured */
break;
case TROUBLE_STARVING:
/* temporarily lost strength recovery now handled by init_uhunger() */

View File

@@ -4699,11 +4699,46 @@ rnd_nextto_goodpos(coordxy *x, coordxy *y, struct monst *mtmp)
return FALSE;
}
/* print a message about being back on the ground after leaving a pool */
void
back_on_ground(boolean rescued)
{
const char *preposit = (Levitation || Flying) ? "over" : "on",
*surf = surface(u.ux, u.uy), *you_are_back;
char icebuf[QBUFSZ];
if (is_ice(u.ux, u.uy)) {
/* "on ice" */
surf = ice_descr(u.ux, u.uy, icebuf);
} else if (!strcmpi(surf, "floor") || !strcmpi(surf, "ground")) {
/* "on solid ground" */
surf = "solid ground";
} else if (!strcmpi(surf, "bridge") || !strcmpi(surf, "altar")
|| !strcmpi(surf, "headstone")) {
/* "on a bridge" */
surf = an(surf);
} else if (!strcmpi(surf, "stairs") || !strcmpi(surf, "lava")
|| !strcmpi(surf, "bottom")) {
/* "on the stairs" */
surf = the(surf);
} else { /* "cloud", "air", "air bubble", "wall", "fountain", "doorway" */
/* "in a cloud", "in the air" */
surf = !strcmp(surf, "air") ? the(surf) : an(surf);
preposit = "in";
}
if (rescued) {
you_are_back = "You find yourself";
} else {
you_are_back = flags.verbose ? "You are back" : "Back";
}
pline("%s %s %s.", you_are_back, preposit, surf);
}
/* life-saving or divine rescue has attempted to get the hero out of hostile
terrain and put hero in an unexpected spot or failed due to overfull level
and just prevented death so "back on solid ground" may be inappropriate */
void
back_on_ground(int how)
rescued_from_terrain(int how)
{
static const char find_yourself[] = "find yourself";
struct rm *lev = &levl[u.ux][u.uy];
@@ -4738,7 +4773,7 @@ back_on_ground(int how)
break;
}
if (!mesggiven)
You("%s back on solid %s.", find_yourself, surface(u.ux, u.uy));
back_on_ground(TRUE);
iflags.last_msg = PLNMSG_BACK_ON_GROUND; /* for describe_decor() */
/* feedback just disclosed this */
@@ -4882,7 +4917,7 @@ drown(void)
if (u.uinwater)
set_uinwater(0); /* u.uinwater = 0 */
back_on_ground(DROWNING);
rescued_from_terrain(DROWNING);
return TRUE;
}
@@ -6505,7 +6540,7 @@ lava_effects(void)
set_itimeout(&HWwalking, 5L);
goto burn_stuff;
}
back_on_ground(BURNING);
rescued_from_terrain(BURNING);
/* normally done via safe_teleds() -> teleds() -> spoteffects() but
spoteffects() was no-op when called with nonzero in_lava_effects */