Sting vs level teleport's "materialize" message

When level teleporting, Sting/Orcrish/Grimtooth would start or stop
glowing based on occupants of the new level before "you materialize
on another level".  That wasn't necessarily incorrect for the glow
stopping but was clearly wrong for it starting.  This fix uses a flag
as a hack to avoid finding and changing all the calls to docrt() and
see_monsters().  It ought to be fixed properly....
This commit is contained in:
PatR
2020-04-27 05:09:19 -07:00
parent 09f9b3598f
commit c67f1dd710
4 changed files with 30 additions and 10 deletions
+5 -2
View File
@@ -192,11 +192,14 @@ data.base lookup of an entry with any blank lines would falsely claim that
using nhl_error() to report a Lua processing problem would clobber the stack using nhl_error() to report a Lua processing problem would clobber the stack
level teleporation's "You materialize on a different level!" could be given level teleporation's "You materialize on a different level!" could be given
out of sequence with other arrival messages out of sequence with other arrival messages
creating Mine Town variant 1 (Orcish Town) sometimes complained about being more sequencing: if wielding Sting or similar and level teleporting to a
unable to place lregion type 1 and failed to have any staircase up level with different warning effect, the start-glowing or stop-glowing
message came before the materialize message on the destination level
prevent "you materialize on a different level" after "a mysterious force prevent "you materialize on a different level" after "a mysterious force
prevents you from descending" if you try to level teleport past the prevents you from descending" if you try to level teleport past the
stairs down from the quest home level before being granted access stairs down from the quest home level before being granted access
creating Mine Town variant 1 (Orcish Town) sometimes complained about being
unable to place lregion type 1 and failed to have any staircase up
set g.context.botl for glove and wielding actions that could start or end set g.context.botl for glove and wielding actions that could start or end
bare-handedness in support of condtests[bl_bareh] bare-handedness in support of condtests[bl_bareh]
reinstate ranked ordering of the status condition fields reinstate ranked ordering of the status condition fields
+1
View File
@@ -219,6 +219,7 @@ struct instance_flags {
int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */ int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */
int in_lava_effects; /* hack for Boots_off() */ int in_lava_effects; /* hack for Boots_off() */
int last_msg; /* indicator of last message player saw */ 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 override_ID; /* true to force full identification of objects */
int parse_config_file_src; /* hack for parse_config_line() */ int parse_config_file_src; /* hack for parse_config_line() */
int purge_monsters; /* # of dead monsters still on fmon list */ int purge_monsters; /* # of dead monsters still on fmon list */
+13 -6
View File
@@ -1295,12 +1295,19 @@ see_monsters()
if (Warn_of_mon && (g.context.warntype.obj & mon->data->mflags2) != 0L) if (Warn_of_mon && (g.context.warntype.obj & mon->data->mflags2) != 0L)
new_warn_obj_cnt++; new_warn_obj_cnt++;
} }
/*
* Make Sting glow blue or stop glowing if required. /* message sequencing: when changing levels via level teleport,
*/ the start-glow/stop-glow message from Sting_effects() would come
if (new_warn_obj_cnt != g.warn_obj_cnt) { too soon so we suppress it for docrt() -> see_monsters() then
Sting_effects(new_warn_obj_cnt); reenable it and call see_monsters() a second time */
g.warn_obj_cnt = new_warn_obj_cnt; 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;
}
} }
/* when mounted, hero's location gets caught by monster loop */ /* when mounted, hero's location gets caught by monster loop */
+11 -2
View File
@@ -1265,7 +1265,7 @@ boolean at_stairs, falling, portal;
int l_idx, save_mode; int l_idx, save_mode;
NHFILE *nhfp; NHFILE *nhfp;
xchar new_ledger; xchar new_ledger;
boolean cant_go_back, great_effort, boolean cant_go_back, great_effort, materializing,
up = (depth(newlevel) < depth(&u.uz)), up = (depth(newlevel) < depth(&u.uz)),
newdungeon = (u.uz.dnum != newlevel->dnum), newdungeon = (u.uz.dnum != newlevel->dnum),
was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz), was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz),
@@ -1613,9 +1613,15 @@ boolean at_stairs, falling, portal;
else if (Is_firelevel(&u.uz)) else if (Is_firelevel(&u.uz))
fumaroles(); 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. */ /* Reset the screen. */
vision_reset(); /* reset the blockages */ vision_reset(); /* reset the blockages */
g.glyphmap_perlevel_flags = 0L; /* force per-level mapglyph() changes */ 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 */ docrt(); /* does a full vision recalc */
flush_screen(-1); flush_screen(-1);
@@ -1625,9 +1631,12 @@ boolean at_stairs, falling, portal;
/* deferred arrival message for level teleport looks odd if given /* deferred arrival message for level teleport looks odd if given
after the various messages below so give it before them */ after the various messages below so give it before them */
if (g.dfr_post_msg && !strncmpi(g.dfr_post_msg, "You materialize", 15)) { if (materializing) {
pline("%s", g.dfr_post_msg); pline("%s", g.dfr_post_msg);
free((genericptr_t) g.dfr_post_msg), g.dfr_post_msg = 0; 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 */
} }
/* special levels can have a custom arrival message */ /* special levels can have a custom arrival message */