From 9d3710163e4986df0e3c7f5214dfd00de8cb627f Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 13 Dec 2023 13:15:18 -0800 Subject: [PATCH] fix #K4063 - "back on ground" given at odd time Moving over at item that's resting on ice gives a message about there being ice present and then about the item, whether mention_decor is On or Off. With it On, you'll get a message about being back on solid ground as soon as you leave the ice. With it Off you wouldn't get that at all if not levitating; that's the basic no-mention_decor behavior for ice. However, if you were levitating, you would get a delayed "back on solid ground" message when moving over some other object, which might occur quite a bit later. Autopickup handling is calling describe_decor() when the hero is levitating and some of that wasn't appropriate for no-mention_decor. This issue has been present since I first implemented mention_decor, not introduced by recent back_on_ground() changes. --- doc/fixes3-7-0.txt | 4 ++++ src/hack.c | 1 - src/pickup.c | 38 +++++++++++++++++++++++++------------- src/timeout.c | 11 ++++++----- src/trap.c | 1 + 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index a7dbffed3..953f4dd60 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1801,6 +1801,10 @@ add 'X' as a potential context-sensitive item-action for uwep and uswapwep monsters weren't noticing hero's possession or lack of magic resistance when hero getting zapped by a wand of striking was or wasn't resisted discard monsters' observations about hero's resistances when saving bones +autopickup while levitating shares code with 'mention_decor'; after being told + about ice covered by an object, moving over some other object later + when mention_decor is Off could give "you are back on solid ground" + long after leaving the ice Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/src/hack.c b/src/hack.c index 5dac90956..6ad4a59cb 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2831,7 +2831,6 @@ pooleffects( You("leave the %s...", hliquid("water")); /* oops! */ } else { back_on_ground(FALSE); - iflags.last_msg = PLNMSG_BACK_ON_GROUND; } } else if (Is_waterlevel(&u.uz)) { still_inwater = TRUE; diff --git a/src/pickup.c b/src/pickup.c index 01e272103..20acf61ab 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -299,14 +299,16 @@ void force_decor(boolean via_probing) { /* we don't want describe_decor() to defer feedback if hero is fumbling - with 1 turn left, or for ice_descr() to skip thawing details if hero - is probing when levitating while blind (those will be skipped for - look_here() and farlook() or autodescribe); we can't control that by - temporarily tweaking properties because that could become noticeable - if status gets updated while decor feedback is being delivered */ + with 1 turn left until next slip_or_trip(), or for ice_descr() to + omit thawing details if hero is probing when levitating while blind + (those will be skipped for look_here() and farlook() or autodescribe); + we can't control that by temporarily tweaking properties because that + could become noticeable if status gets updated while decor feedback + is being delivered */ gd.decor_fumble_override = TRUE; gd.decor_levitate_override = via_probing; - /* force current terrain to be different from previous location */ + /* force current terrain to be different from previous location, or + uninteresting if previous location was actually inside solid stone */ iflags.prev_decor = STONE; (void) describe_decor(); gd.decor_fumble_override = gd.decor_levitate_override = FALSE; @@ -314,9 +316,12 @@ force_decor(boolean via_probing) } void -deferred_decor(boolean setup) /* True: deferring, False: catching up */ +deferred_decor( + boolean setup) /* True: deferring, False: catching up */ { - if (setup) { + if (!flags.mention_decor) { + iflags.defer_decor = FALSE; + } else if (setup) { iflags.defer_decor = TRUE; } else { (void) describe_decor(); @@ -334,14 +339,17 @@ describe_decor(void) const char *dfeature; int ltyp; - if ((HFumbling & TIMEOUT) == 1L && !iflags.defer_decor + if ((HFumbling & TIMEOUT) == 1L /* about to slip_or_trip */ + && !iflags.defer_decor && !gd.decor_fumble_override) { /* probe_decor() */ /* - * Work around a message sequencing issue: avoid + * Work around a message sequencing issue if Fumbling's periodic + * timeout is about to kick in: avoid the combination * |You are back on floor. * |You trip over . or You flounder. * when the trip is being caused by moving on ice as hero - * steps off ice onto non-ice. + * steps off ice onto non-ice. Defer the back-on-floor part if + * that is about to happen. */ deferred_decor(TRUE); return FALSE; @@ -378,7 +386,7 @@ describe_decor(void) Strcpy(fbuf, dfeature); Sprintf(outbuf, "%s.", upstart(fbuf)); } - if (ltyp == ICE) + if (ltyp == ICE && flags.mention_decor) Norep("%s", outbuf); else pline("%s", outbuf); @@ -391,7 +399,11 @@ describe_decor(void) } } } - iflags.prev_decor = ltyp; + /* describe_decor() is normally called when moving onto a different + type of terrain, but it is also called by pickup() even when + mention_decor is Off if hero can't reach floor; only adapt the next + describe_decor() by what has just occurred in this one when it's On */ + iflags.prev_decor = flags.mention_decor ? ltyp : STONE; return res; } diff --git a/src/timeout.c b/src/timeout.c index dee2509f7..1f9bc5326 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1138,9 +1138,7 @@ slip_or_trip(void) struct obj *otmp = vobj_at(u.ux, u.uy), *otmp2; const char *what; char buf[BUFSZ]; - boolean on_foot = TRUE; - if (u.usteed) - on_foot = FALSE; + boolean on_foot = !u.usteed; if (otmp && on_foot && !u.uinwater && is_pool(u.ux, u.uy)) otmp = 0; @@ -1179,11 +1177,14 @@ slip_or_trip(void) /* is fumbling from ice alone? */ boolean ice_only = !(EFumbling || (HFumbling & ~FROMOUTSIDE)); - pline("%s %s%s on the ice.", + pline("%s %s%s %s the ice.", u.usteed ? upstart(x_monnam(u.usteed, ARTICLE_THE, (char *) 0, SUPPRESS_SADDLE, FALSE)) : "You", - rn2(2) ? "slip" : "slide", on_foot ? "" : "s"); + rn2(2) ? "slip" : "slide", on_foot ? "" : "s", + /* sometimes slipping due to ice occurs during turn that hero + has just moved off the ice; phrase things differently then */ + is_ice(u.ux, u.uy) ? "on" : "off"); /* fumbling outside of ice while mounted always causes the hero to fall from the saddle, so to avoid a counterintuitive effect where ice makes riding _less_ hazardous, unconditionally dismount if diff --git a/src/trap.c b/src/trap.c index 7baf41b34..d3cead5b6 100644 --- a/src/trap.c +++ b/src/trap.c @@ -4728,6 +4728,7 @@ back_on_ground(boolean rescued) you_are_back = flags.verbose ? "You are back" : "Back"; } pline("%s %s %s.", you_are_back, preposit, surf); + iflags.last_msg = PLNMSG_BACK_ON_GROUND; } /* life-saving or divine rescue has attempted to get the hero out of hostile