From db2620d481ec2ee1474502cd0b3cb31dd0b523ce Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Sun, 19 Oct 2003 19:07:33 +0000 Subject: [PATCH] crystal balls and '~' wrote: - You currently appear to be able to specify '~' and have it try to detect monsters (though it won't detect any long worms) Show the entire worm when specifying either '~' or 'w' now. --- doc/fixes34.3 | 2 ++ include/extern.h | 1 + src/detect.c | 10 +++++++--- src/worm.c | 24 ++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/doc/fixes34.3 b/doc/fixes34.3 index cda68ea6f..31f4bdb1c 100644 --- a/doc/fixes34.3 +++ b/doc/fixes34.3 @@ -53,6 +53,8 @@ non-weapon iron objects should rust when dipped in fountains since suppress "turn to flee" message if monster is mfrozen don't silently interrupt monster's hold on you if Levitation/Flying ends while over water +you could specifiy '~' with crystal ball and have it try to detect monsters, + but it never revealed anything; show the entire long worm now Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index ca03362fb..89c4e6d56 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2322,6 +2322,7 @@ E void FDECL(wormgone, (struct monst *)); E void FDECL(wormhitu, (struct monst *)); E void FDECL(cutworm, (struct monst *,XCHAR_P,XCHAR_P,struct obj *)); E void FDECL(see_wsegs, (struct monst *)); +E void FDECL(detect_wsegs, (struct monst *,BOOLEAN_P)); E void FDECL(save_worm, (int,int)); E void FDECL(rest_worm, (int)); E void FDECL(place_wsegs, (struct monst *)); diff --git a/src/detect.c b/src/detect.c index 350acd2c3..ed73dab33 100644 --- a/src/detect.c +++ b/src/detect.c @@ -597,9 +597,13 @@ int mclass; /* monster class, 0 for all */ cls(); for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) continue; - if (!mclass || mtmp->data->mlet == mclass) - if (mtmp->mx > 0) - show_glyph(mtmp->mx,mtmp->my,mon_to_glyph(mtmp)); + if (!mclass || mtmp->data->mlet == mclass || + (mtmp->data == &mons[PM_LONG_WORM] && mclass == S_WORM_TAIL)) + if (mtmp->mx > 0) { + show_glyph(mtmp->mx,mtmp->my,mon_to_glyph(mtmp)); + /* don't be stingy - display entire worm */ + if (mtmp->data == &mons[PM_LONG_WORM]) detect_wsegs(mtmp,0); + } if (otmp && otmp->cursed && (mtmp->msleeping || !mtmp->mcanmove)) { mtmp->msleeping = mtmp->mfrozen = 0; diff --git a/src/worm.c b/src/worm.c index 22184d575..3d7a32763 100644 --- a/src/worm.c +++ b/src/worm.c @@ -450,6 +450,30 @@ see_wsegs(worm) } } +/* + * detect_wsegs() + * + * Display all of the segments of the given worm for detection. + */ +void +detect_wsegs(worm, use_detection_glyph) + struct monst *worm; + boolean use_detection_glyph; +{ + int num; + struct wseg *curr = wtails[worm->wormno]; + +/* if (!mtmp->wormno) return; bullet proofing */ + + while (curr != wheads[worm->wormno]) { + num = use_detection_glyph ? + detected_monnum_to_glyph(what_mon(PM_LONG_WORM_TAIL)) : + monnum_to_glyph(what_mon(PM_LONG_WORM_TAIL)); + show_glyph(curr->wx,curr->wy,num); + curr = curr->nseg; + } +} + /* * save_worm() -- 2.40.0