Sting vs level teleport revisted

This reverses all of c67f1dd710
except for the fixes37.0 entry and does a better job in a cleaner
fashion.  If Sting is going to start glowing and "you materialize
on a different level" is pending, give the materialize message
before the glowing message.  Otherwise handle both stop-glowing
and/or you-materialize in the normal fashion.
This commit is contained in:
PatR
2020-04-27 10:49:34 -07:00
parent c67f1dd710
commit c17301a75c
5 changed files with 32 additions and 28 deletions

View File

@@ -416,6 +416,7 @@ E void NDECL(save_currentstate);
#endif
E void FDECL(u_collide_m, (struct monst *));
E void FDECL(goto_level, (d_level *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P));
E void NDECL(maybe_lvltport_feedback);
E void FDECL(schedule_goto, (d_level *, BOOLEAN_P, BOOLEAN_P, int,
const char *, const char *));
E void NDECL(deferred_goto);

View File

@@ -219,7 +219,6 @@ struct instance_flags {
int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */
int in_lava_effects; /* hack for Boots_off() */
int last_msg; /* indicator of last message player saw */
int no_glow; /* controls see_monster()'s Sting_effects() */
int override_ID; /* true to force full identification of objects */
int parse_config_file_src; /* hack for parse_config_line() */
int purge_monsters; /* # of dead monsters still on fmon list */

View File

@@ -1907,6 +1907,11 @@ int orc_count; /* new count (warn_obj_cnt is old count); -1 is a flag value */
pline("%s is %s.", bare_artifactname(uwep),
glow_verb(Blind ? 0 : g.warn_obj_cnt, TRUE));
} else if (newstr > 0 && newstr != oldstr) {
/* goto_level() -> docrt() -> see_monsters() -> Sting_effects();
if "you materialize on another level" is pending, give it
now so that start-glowing message comes after it */
maybe_lvltport_feedback(); /* usually called by goto_level() */
/* 'start' message */
if (!Blind)
pline("%s %s %s%c", bare_artifactname(uwep),

View File

@@ -1296,18 +1296,12 @@ see_monsters()
new_warn_obj_cnt++;
}
/* message sequencing: when changing levels via level teleport,
the start-glow/stop-glow message from Sting_effects() would come
too soon so we suppress it for docrt() -> see_monsters() then
reenable it and call see_monsters() a second time */
if (!iflags.no_glow) {
/*
* Make Sting glow blue or stop glowing if required.
*/
if (new_warn_obj_cnt != g.warn_obj_cnt) {
Sting_effects(new_warn_obj_cnt);
g.warn_obj_cnt = new_warn_obj_cnt;
}
/*
* Make Sting glow blue or stop glowing if required.
*/
if (new_warn_obj_cnt != g.warn_obj_cnt) {
Sting_effects(new_warn_obj_cnt);
g.warn_obj_cnt = new_warn_obj_cnt;
}
/* when mounted, hero's location gets caught by monster loop */

View File

@@ -1265,7 +1265,7 @@ boolean at_stairs, falling, portal;
int l_idx, save_mode;
NHFILE *nhfp;
xchar new_ledger;
boolean cant_go_back, great_effort, materializing,
boolean cant_go_back, great_effort,
up = (depth(newlevel) < depth(&u.uz)),
newdungeon = (u.uz.dnum != newlevel->dnum),
was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz),
@@ -1613,15 +1613,9 @@ boolean at_stairs, falling, portal;
else if (Is_firelevel(&u.uz))
fumaroles();
/* to control message sequencing hack for Sting_effects() */
materializing = (g.dfr_post_msg
&& !strncmpi(g.dfr_post_msg, "You materialize", 15));
/* Reset the screen. */
vision_reset(); /* reset the blockages */
g.glyphmap_perlevel_flags = 0L; /* force per-level mapglyph() changes */
if (materializing)
iflags.no_glow++; /* to suppress see_monster()'s Sting_effects() */
docrt(); /* does a full vision recalc */
flush_screen(-1);
@@ -1630,14 +1624,14 @@ boolean at_stairs, falling, portal;
*/
/* deferred arrival message for level teleport looks odd if given
after the various messages below so give it before them */
if (materializing) {
pline("%s", g.dfr_post_msg);
free((genericptr_t) g.dfr_post_msg), g.dfr_post_msg = 0;
iflags.no_glow--;
see_monsters(); /* docrt() did this but we need to repeat it */
}
after the various messages below, so give it before them;
[it might have already been delivered via docrt() -> see_monsters()
-> Sting_effects() -> maybe_lvltport_feedback(), in which case
'dfr_post_msg' has already been reset to Null];
if 'dfr_post_msg' is "you materialize on another level" then
maybe_lvltport_feedback() will deliver it now and then free it */
if (g.dfr_post_msg)
maybe_lvltport_feedback(); /* potentially called by Sting_effects() */
/* special levels can have a custom arrival message */
deliver_splev_message();
@@ -1758,6 +1752,17 @@ boolean at_stairs, falling, portal;
(void) pickup(1);
}
/* usually called from goto_level(); might be called from Sting_effects() */
void
maybe_lvltport_feedback()
{
if (g.dfr_post_msg && !strncmpi(g.dfr_post_msg, "You materialize", 15)) {
/* "You materialize on a different level." */
pline("%s", g.dfr_post_msg);
free((genericptr_t) g.dfr_post_msg), g.dfr_post_msg = 0;
}
}
static void
final_level()
{