From 15fa1f0ac71eba2caef366488dbe6ff58f82dc08 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 8 Jun 2019 21:54:06 -0400 Subject: [PATCH 1/6] debug mode wishing for hidden hiders --- src/read.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/read.c b/src/read.c index 063f73c13..dbf50db37 100644 --- a/src/read.c +++ b/src/read.c @@ -2434,7 +2434,7 @@ struct _create_particular_data { char monclass; boolean randmonst; boolean maketame, makepeaceful, makehostile; - boolean sleeping, saddled, invisible; + boolean sleeping, saddled, invisible, hidden; }; boolean @@ -2464,6 +2464,10 @@ struct _create_particular_data *d; d->invisible = TRUE; (void) memset(tmpp, ' ', sizeof "invisible " - 1); } + if ((tmpp = strstri(bufp, "hidden ")) != 0) { + d->hidden = TRUE; + (void) memset(tmpp, ' ', sizeof "hidden " - 1); + } /* check "female" before "male" to avoid false hit mid-word */ if ((tmpp = strstri(bufp, "female ")) != 0) { d->fem = 1; @@ -2574,6 +2578,10 @@ struct _create_particular_data *d; } if (d->sleeping) mtmp->msleeping = 1; + if (d->hidden && is_hider(mtmp->data)) { + mtmp->mundetected = 1; + newsym(mtmp->mx, mtmp->my); + } madeany = TRUE; /* in case we got a doppelganger instead of what was asked for, make it start out looking like what was asked for */ From ea9a385d6733538d72b0bdfc62638b20a90d0def Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 8 Jun 2019 22:40:51 -0400 Subject: [PATCH 2/6] fixes entry and a display effect related to is_hider wishing --- doc/fixes36.3 | 1 + src/read.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 6c858a823..43b3b0863 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -66,6 +66,7 @@ thrown or kicked light source (lit lamp, candle, oil) should emit light as it unlike watching a monster trying to swap out a cursed weapon for some other weapon and failing, watching it wield a cursed weapon didn't report that weapon becoming welded to the monster's hand/claw/whatever +debug mode wishing for hidden monsters that pass is_hider test Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/read.c b/src/read.c index dbf50db37..baf82d641 100644 --- a/src/read.c +++ b/src/read.c @@ -2579,7 +2579,20 @@ struct _create_particular_data *d; if (d->sleeping) mtmp->msleeping = 1; if (d->hidden && is_hider(mtmp->data)) { - mtmp->mundetected = 1; + if (wizard && cansee(mtmp->mx, mtmp->my)) { + int i, glyph[2]; + + glyph[0] = glyph_at(mtmp->mx, mtmp->my); + mtmp->mundetected = 1; + newsym(mtmp->mx, mtmp->my); + glyph[1] = glyph_at(mtmp->mx, mtmp->my); + if (!canseemon(mtmp) && !sensemon(mtmp)) + for (i = 0; i < 15; i++) { + show_glyph(mtmp->mx, mtmp->my, glyph[i % 2]); + flush_screen(1); + delay_output(); + } + } newsym(mtmp->mx, mtmp->my); } madeany = TRUE; From 54d24d0333057d88265bf7e15ad00d3cffe2ebf6 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 8 Jun 2019 23:19:29 -0400 Subject: [PATCH 3/6] make display effect code reusable and move it to display.c --- include/extern.h | 1 + src/display.c | 22 ++++++++++++++++++++++ src/read.c | 18 +++++------------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/include/extern.h b/include/extern.h index 072fe60ac..a911b6750 100644 --- a/include/extern.h +++ b/include/extern.h @@ -360,6 +360,7 @@ E void FDECL(newsym, (int, int)); E void FDECL(newsym_force, (int, int)); E void FDECL(shieldeff, (XCHAR_P, XCHAR_P)); E void FDECL(tmp_at, (int, int)); +E void FDECL(flash_glyph_at, (int, int, int)); E void FDECL(swallowed, (int)); E void FDECL(under_ground, (int)); E void FDECL(under_water, (int)); diff --git a/src/display.c b/src/display.c index c5b155bd6..1ef7a26d5 100644 --- a/src/display.c +++ b/src/display.c @@ -1067,6 +1067,28 @@ int x, y; } /* end case */ } +/* + * flash_glyph_at(x, y, glyph) + * + * Briefly flash between the passed glyph and the glyph that's + * meant to be at the location. + */ +void +flash_glyph_at(x, y, tg) +int x, y, tg; +{ + int i, glyph[2]; + + glyph[0] = tg; + glyph[1] = glyph_at(x, y); + for (i = 0; i < 15; i++) { + show_glyph(x, y, glyph[i % 2]); + flush_screen(1); + delay_output(); + } + newsym(x, y); +} + /* * swallowed() * diff --git a/src/read.c b/src/read.c index baf82d641..97678dba2 100644 --- a/src/read.c +++ b/src/read.c @@ -2579,21 +2579,13 @@ struct _create_particular_data *d; if (d->sleeping) mtmp->msleeping = 1; if (d->hidden && is_hider(mtmp->data)) { - if (wizard && cansee(mtmp->mx, mtmp->my)) { - int i, glyph[2]; + int saveglyph = glyph_at(mtmp->mx, mtmp->my); - glyph[0] = glyph_at(mtmp->mx, mtmp->my); - mtmp->mundetected = 1; - newsym(mtmp->mx, mtmp->my); - glyph[1] = glyph_at(mtmp->mx, mtmp->my); - if (!canseemon(mtmp) && !sensemon(mtmp)) - for (i = 0; i < 15; i++) { - show_glyph(mtmp->mx, mtmp->my, glyph[i % 2]); - flush_screen(1); - delay_output(); - } - } + mtmp->mundetected = 1; newsym(mtmp->mx, mtmp->my); + if (wizard && cansee(mtmp->mx, mtmp->my)) + if (!canseemon(mtmp) && !sensemon(mtmp)) + flash_glyph_at(mtmp->mx, mtmp->my, saveglyph); } madeany = TRUE; /* in case we got a doppelganger instead of what was asked From 8a82a67d4182775f3e766b868ee8913b1e1eba78 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 9 Jun 2019 07:41:11 -0400 Subject: [PATCH 4/6] overlooked rn2_on_display_rng bit --- src/muse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/muse.c b/src/muse.c index ec533c077..d9cc9f1ba 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1976,7 +1976,7 @@ struct monst *mtmp; #ifdef CLIPPING cliparound(mtmp->mx, mtmp->my); #endif - show_glyph(mtmp->mx, mtmp->my, mon_to_glyph(mtmp, rn2)); + show_glyph(mtmp->mx, mtmp->my, mon_to_glyph(mtmp, rn2_on_display_rng)); display_self(); You_feel("aggravated at %s.", noit_mon_nam(mtmp)); display_nhwindow(WIN_MAP, TRUE); From 5f676aa56c77e1d48032e94b1613ac651cba46a8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 9 Jun 2019 07:46:14 -0400 Subject: [PATCH 5/6] extend wizard-mode display effect to unseen invisible monsters --- doc/fixes36.3 | 3 ++- src/read.c | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 43b3b0863..961ed254f 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -66,7 +66,7 @@ thrown or kicked light source (lit lamp, candle, oil) should emit light as it unlike watching a monster trying to swap out a cursed weapon for some other weapon and failing, watching it wield a cursed weapon didn't report that weapon becoming welded to the monster's hand/claw/whatever -debug mode wishing for hidden monsters that pass is_hider test +wizard-mode: wish for hidden monsters that pass is_hider test Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository @@ -117,6 +117,7 @@ classify sources as released, beta, or work-in-progress via NH_DEVEL_STATUS rather than just released vs beta via BETA if you reach the edge of a level (relatively uncommon) and try to move off, report that you can't go farther if the 'mention_walls' option is set +wizard-mode: display effect to show where an unseen wished-for monster landed NetHack Community Patches (or Variation) Included diff --git a/src/read.c b/src/read.c index 97678dba2..8ae59abd1 100644 --- a/src/read.c +++ b/src/read.c @@ -2522,9 +2522,9 @@ create_particular_creation(d) struct _create_particular_data *d; { struct permonst *whichpm = NULL; - int i, firstchoice = NON_PM; + int i, saveglyph, firstchoice = NON_PM; struct monst *mtmp; - boolean madeany = FALSE; + boolean madeany = FALSE, doflash = FALSE; if (!d->randmonst) { firstchoice = d->which; @@ -2570,19 +2570,25 @@ struct _create_particular_data *d; } if (d->invisible) { int mx = mtmp->mx, my = mtmp->my; + saveglyph = glyph_at(mx, my); mon_set_minvis(mtmp); if (does_block(mx, my, &levl[mx][my])) block_point(mx, my); else unblock_point(mx, my); + if (saveglyph == glyph_at(mx, my)) + saveglyph = mon_to_glyph(mtmp, rn2_on_display_rng); + doflash = TRUE; + } + if (d->hidden && is_hider(mtmp->data)) { + saveglyph = glyph_at(mtmp->mx, mtmp->my); + mtmp->mundetected = 1; + newsym(mtmp->mx, mtmp->my); + doflash = TRUE; } if (d->sleeping) mtmp->msleeping = 1; - if (d->hidden && is_hider(mtmp->data)) { - int saveglyph = glyph_at(mtmp->mx, mtmp->my); - - mtmp->mundetected = 1; - newsym(mtmp->mx, mtmp->my); + if (doflash) { if (wizard && cansee(mtmp->mx, mtmp->my)) if (!canseemon(mtmp) && !sensemon(mtmp)) flash_glyph_at(mtmp->mx, mtmp->my, saveglyph); From f1f085c7fdcd6e9b763f6f703f32480ad5e2b475 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 9 Jun 2019 08:08:50 -0400 Subject: [PATCH 6/6] display effect bits --- src/display.c | 4 +++- src/read.c | 11 ++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/display.c b/src/display.c index 1ef7a26d5..5f8367586 100644 --- a/src/display.c +++ b/src/display.c @@ -1080,7 +1080,9 @@ int x, y, tg; int i, glyph[2]; glyph[0] = tg; - glyph[1] = glyph_at(x, y); + glyph[1] = (level.flags.hero_memory) + ? levl[x][y].glyph + : back_to_glyph(x, y); for (i = 0; i < 15; i++) { show_glyph(x, y, glyph[i % 2]); flush_screen(1); diff --git a/src/read.c b/src/read.c index 8ae59abd1..bbdffdfbd 100644 --- a/src/read.c +++ b/src/read.c @@ -2522,7 +2522,7 @@ create_particular_creation(d) struct _create_particular_data *d; { struct permonst *whichpm = NULL; - int i, saveglyph, firstchoice = NON_PM; + int i, flashglyph, firstchoice = NON_PM; struct monst *mtmp; boolean madeany = FALSE, doflash = FALSE; @@ -2553,6 +2553,7 @@ struct _create_particular_data *d; /* otherwise try again */ continue; } + flashglyph = mon_to_glyph(mtmp, rn2_on_display_rng); /* 'is_FOO()' ought to be called 'always_FOO()' */ if (d->fem != -1 && !is_male(mtmp->data) && !is_female(mtmp->data)) mtmp->female = d->fem; /* ignored for is_neuter() */ @@ -2570,20 +2571,16 @@ struct _create_particular_data *d; } if (d->invisible) { int mx = mtmp->mx, my = mtmp->my; - saveglyph = glyph_at(mx, my); + mon_set_minvis(mtmp); if (does_block(mx, my, &levl[mx][my])) block_point(mx, my); else unblock_point(mx, my); - if (saveglyph == glyph_at(mx, my)) - saveglyph = mon_to_glyph(mtmp, rn2_on_display_rng); doflash = TRUE; } if (d->hidden && is_hider(mtmp->data)) { - saveglyph = glyph_at(mtmp->mx, mtmp->my); mtmp->mundetected = 1; - newsym(mtmp->mx, mtmp->my); doflash = TRUE; } if (d->sleeping) @@ -2591,7 +2588,7 @@ struct _create_particular_data *d; if (doflash) { if (wizard && cansee(mtmp->mx, mtmp->my)) if (!canseemon(mtmp) && !sensemon(mtmp)) - flash_glyph_at(mtmp->mx, mtmp->my, saveglyph); + flash_glyph_at(mtmp->mx, mtmp->my, flashglyph); } madeany = TRUE; /* in case we got a doppelganger instead of what was asked