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
+2 -1
View File
@@ -2949,7 +2949,8 @@ extern void acid_damage(struct obj *);
extern int water_damage(struct obj *, const char *, boolean); extern int water_damage(struct obj *, const char *, boolean);
extern void water_damage_chain(struct obj *, boolean); extern void water_damage_chain(struct obj *, boolean);
extern boolean rnd_nextto_goodpos(coordxy *, coordxy *, struct monst *); 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 boolean drown(void);
extern void drain_en(int, boolean); extern void drain_en(int, boolean);
extern int dountrap(void); extern int dountrap(void);
+2 -2
View File
@@ -2822,11 +2822,11 @@ pooleffects(
if (!is_pool(u.ux, u.uy)) { if (!is_pool(u.ux, u.uy)) {
if (Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) {
You("pop into an air bubble."); You("pop into an air bubble.");
iflags.last_msg = PLNMSG_BACK_ON_GROUND;
} else if (is_lava(u.ux, u.uy)) { } else if (is_lava(u.ux, u.uy)) {
You("leave the %s...", hliquid("water")); /* oops! */ You("leave the %s...", hliquid("water")); /* oops! */
} else { } else {
You("are on solid %s again.", back_on_ground(FALSE);
is_ice(u.ux, u.uy) ? "ice" : "land");
iflags.last_msg = PLNMSG_BACK_ON_GROUND; iflags.last_msg = PLNMSG_BACK_ON_GROUND;
} }
} else if (Is_waterlevel(&u.uz)) { } else if (Is_waterlevel(&u.uz)) {
-2
View File
@@ -4216,8 +4216,6 @@ dfeature_at(coordxy x, coordxy y, char *buf)
cmap = S_lava; /* "molten lava" */ cmap = S_lava; /* "molten lava" */
else if (is_ice(x, y)) else if (is_ice(x, y))
dfeature = ice_descr(x, y, altbuf), cmap = -1; /* "ice" */ dfeature = ice_descr(x, y, altbuf), cmap = -1; /* "ice" */
else if (IS_WATERWALL(ltyp))
dfeature = "wall of water";
else if (is_pool(x, y)) else if (is_pool(x, y))
dfeature = "pool of water"; dfeature = "pool of water";
else if (IS_SINK(ltyp)) else if (IS_SINK(ltyp))
+1 -10
View File
@@ -384,17 +384,8 @@ describe_decor(void)
|| IS_LAVA(iflags.prev_decor) || IS_LAVA(iflags.prev_decor)
|| iflags.prev_decor == ICE) { || iflags.prev_decor == ICE) {
if (iflags.last_msg != PLNMSG_BACK_ON_GROUND) { if (iflags.last_msg != PLNMSG_BACK_ON_GROUND) {
const char *surf = is_ice(u.ux, u.uy) back_on_ground(FALSE);
? 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);
} }
} }
} }
iflags.prev_decor = ltyp; iflags.prev_decor = ltyp;
+1 -1
View File
@@ -389,7 +389,7 @@ fix_worst_trouble(int trouble)
/* teleport should always succeed, but if not, just untrap them */ /* teleport should always succeed, but if not, just untrap them */
if (!safe_teleds(TELEDS_NO_FLAGS)) if (!safe_teleds(TELEDS_NO_FLAGS))
reset_utrap(TRUE); reset_utrap(TRUE);
back_on_ground(DISSOLVED); /* DISSOLVED: pending cause of death rescued_from_terrain(DISSOLVED); /* DISSOLVED: pending cause of death
* if trouble didn't get cured */ * if trouble didn't get cured */
break; break;
case TROUBLE_STARVING: case TROUBLE_STARVING:
+39 -4
View File
@@ -4699,11 +4699,46 @@ rnd_nextto_goodpos(coordxy *x, coordxy *y, struct monst *mtmp)
return FALSE; 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 /* 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 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 */ and just prevented death so "back on solid ground" may be inappropriate */
void void
back_on_ground(int how) rescued_from_terrain(int how)
{ {
static const char find_yourself[] = "find yourself"; static const char find_yourself[] = "find yourself";
struct rm *lev = &levl[u.ux][u.uy]; struct rm *lev = &levl[u.ux][u.uy];
@@ -4738,7 +4773,7 @@ back_on_ground(int how)
break; break;
} }
if (!mesggiven) 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() */ iflags.last_msg = PLNMSG_BACK_ON_GROUND; /* for describe_decor() */
/* feedback just disclosed this */ /* feedback just disclosed this */
@@ -4882,7 +4917,7 @@ drown(void)
if (u.uinwater) if (u.uinwater)
set_uinwater(0); /* u.uinwater = 0 */ set_uinwater(0); /* u.uinwater = 0 */
back_on_ground(DROWNING); rescued_from_terrain(DROWNING);
return TRUE; return TRUE;
} }
@@ -6505,7 +6540,7 @@ lava_effects(void)
set_itimeout(&HWwalking, 5L); set_itimeout(&HWwalking, 5L);
goto burn_stuff; goto burn_stuff;
} }
back_on_ground(BURNING); rescued_from_terrain(BURNING);
/* normally done via safe_teleds() -> teleds() -> spoteffects() but /* normally done via safe_teleds() -> teleds() -> spoteffects() but
spoteffects() was no-op when called with nonzero in_lava_effects */ spoteffects() was no-op when called with nonzero in_lava_effects */