From 44a649b0b4cbc0f494583887389d41c528df7123 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 18 Sep 2023 19:20:01 +0300 Subject: [PATCH] Wand of probing reveals map locations in ray path --- doc/fixes3-7-0.txt | 1 + include/extern.h | 1 + src/detect.c | 11 +++++------ src/zap.c | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 9312a4671..939947a17 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1236,6 +1236,7 @@ a pet that was poison resistant but not stoning resistant would eat Medusa's ring of hunger prevents choking on your food paranoid_confirm:pray can be changed to require yes/no response instead of y/n by also setting paranoid_confirm:Confirm +wand of probing reveals map locations in the ray path Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 2287a31ac..d85e8f881 100644 --- a/include/extern.h +++ b/include/extern.h @@ -354,6 +354,7 @@ extern int monster_detect(struct obj *, int); extern int trap_detect(struct obj *); extern const char *level_distance(d_level *); extern void use_crystal_ball(struct obj **); +extern void show_map_spot(coordxy, coordxy, boolean); extern void do_mapping(void); extern void do_vicinity_map(struct obj *); extern void cvt_sdoor_to_door(struct rm *); diff --git a/src/detect.c b/src/detect.c index 868029a41..793b9b92e 100644 --- a/src/detect.c +++ b/src/detect.c @@ -23,7 +23,6 @@ static void sense_trap(struct trap *, coordxy, coordxy, int); static int detect_obj_traps(struct obj *, boolean, int); static void display_trap_map(struct trap *, int); static int furniture_detect(void); -static void show_map_spot(coordxy, coordxy); static void findone(coordxy, coordxy, genericptr_t); static void openone(coordxy, coordxy, genericptr_t); static int mfind0(struct monst *, boolean); @@ -1323,15 +1322,15 @@ use_crystal_ball(struct obj **optr) return; } -static void -show_map_spot(coordxy x, coordxy y) +void +show_map_spot(coordxy x, coordxy y, boolean cnf) { struct rm *lev; struct trap *t; struct engr *ep; int oldglyph; - if (Confusion && rn2(7)) + if (cnf && rn2(7)) return; lev = &levl[x][y]; @@ -1379,7 +1378,7 @@ do_mapping(void) unconstrained = unconstrain_map(); for (zx = 1; zx < COLNO; zx++) for (zy = 0; zy < ROWNO; zy++) - show_map_spot(zx, zy); + show_map_spot(zx, zy, Confusion); if (!gl.level.flags.hero_memory || unconstrained) { flush_screen(1); /* flush temp screen */ @@ -1452,7 +1451,7 @@ do_vicinity_map(struct obj *sobj) /* scroll--actually fake spellbook--object */ for (zy = lo_y; zy <= hi_y; zy++) { oldglyph = glyph_at(zx, zy); /* this will remove 'remembered, unseen mon' (and objects) */ - show_map_spot(zx, zy); + show_map_spot(zx, zy, Confusion); /* if there are any objects here, see the top one */ if (OBJ_AT(zx, zy)) { /* not vobj_at(); this is not vision-based access; diff --git a/src/zap.c b/src/zap.c index c4e88cea2..d7fcffe2b 100644 --- a/src/zap.c +++ b/src/zap.c @@ -3639,6 +3639,22 @@ bhit( } if (learn_it) learnwand(obj); + } else if (weapon == ZAPPED_WAND) { + boolean learn_it = FALSE; + + if (obj->otyp == WAN_PROBING) { + if (!cansee(x, y)) { + int oldglyph = glyph_at(x, y); + + show_map_spot(x, y, FALSE); + if (oldglyph != glyph_at(x, y)) { + /* TODO: need to give some message */ + learn_it = TRUE; + } + } + } + if (learn_it) + learnwand(obj); } /* [shouldn't this trap handling be in zap_over_floor()?] */