Don't advance the main RNG during hallucination

This is based on the multiple-RNGs code fron NetHack4, but using
only the parts relevant to the display RNG (and with substantial
changes, both because of post-3.4.3 changes, and because Nethack4's
display code is based on Slash'EM's rather than NetHack's).
This commit is contained in:
Alex Smith
2019-01-28 04:45:26 +00:00
parent 1083971228
commit ce5184c3da
21 changed files with 150 additions and 93 deletions

View File

@@ -78,10 +78,12 @@ struct monst *mtmp;
boolean showtail;
{
if (def_monsyms[(int) mtmp->data->mlet].sym == ' ')
show_glyph(mtmp->mx, mtmp->my, detected_mon_to_glyph(mtmp));
else
show_glyph(mtmp->mx, mtmp->my,
mtmp->mtame ? pet_to_glyph(mtmp) : mon_to_glyph(mtmp));
detected_mon_to_glyph(mtmp, newsym_rn2));
else
show_glyph(mtmp->mx, mtmp->my, mtmp->mtame
? pet_to_glyph(mtmp, newsym_rn2)
: mon_to_glyph(mtmp, newsym_rn2));
if (showtail && mtmp->data == &mons[PM_LONG_WORM])
detect_wsegs(mtmp, 0);
@@ -1591,14 +1593,20 @@ void
find_trap(trap)
struct trap *trap;
{
int tt = what_trap(trap->ttyp);
int tt = what_trap(trap->ttyp, rn2);
boolean cleared = FALSE;
trap->tseen = 1;
exercise(A_WIS, TRUE);
feel_newsym(trap->tx, trap->ty);
if (levl[trap->tx][trap->ty].glyph != trap_to_glyph(trap)) {
/* The "Hallucination ||" is to preserve 3.6.1 behaviour, but this
behaviour might need a rework in the hallucination case
(e.g. to not prompt if any trap glyph appears on the
square). */
if (Hallucination ||
levl[trap->tx][trap->ty].glyph !=
trap_to_glyph(trap, rn2_on_display_rng)) {
/* There's too much clutter to see your find otherwise */
cls();
map_trap(trap, 1);
@@ -1832,7 +1840,7 @@ int default_glyph, which_subset;
an object, replacing any object or trap at its spot) */
glyph = !swallowed ? glyph_at(x, y) : levl_glyph;
if (keep_mons && x == u.ux && y == u.uy && swallowed)
glyph = mon_to_glyph(u.ustuck);
glyph = mon_to_glyph(u.ustuck, rn2_on_display_rng);
else if (((glyph_is_monster(glyph)
|| glyph_is_warning(glyph)) && !keep_mons)
|| glyph_is_swallow(glyph))
@@ -1841,7 +1849,7 @@ int default_glyph, which_subset;
|| glyph_is_invisible(glyph))
&& keep_traps && !covers_traps(x, y)) {
if ((t = t_at(x, y)) != 0 && t->tseen)
glyph = trap_to_glyph(t);
glyph = trap_to_glyph(t, rn2_on_display_rng);
}
if ((glyph_is_object(glyph) && !keep_objs)
|| (glyph_is_trap(glyph) && !keep_traps)