From: nethack.rankin Date: Mon, 16 Apr 2012 02:05:40 +0000 (+0000) Subject: magic mapping fixes X-Git-Tag: MOVE2GIT~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=084d2ab85d6ae6a4b53d9d78fb530ffc0c84fc89;p=nethack magic mapping fixes ^F on Plane of Water didn't show the magic portal to Astral. I spent a lot of time looking at differences between current code and 3.4.3 to figure out what had changed, then finally tried it on 3.4.3 and discovered that it didn't work back then either. ^F marks all floor and ceiling traps as seen and explicitly maps them, but Water has level.flags.hero_memory clear, making the mapped trap disappear when it isn't in line of sight. When fixing this, I changed magic mapping so that it shows furniture (stairs, altars, fountains, &c) in preference to traps or objects, and known traps in preference to objects, so hidden things can be spotted. (Once they're in line of sight, the precedence reverses to normal, showing objects on top of traps on top of floor.) --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 2a3e46281..5cbd142fa 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -829,6 +829,9 @@ fix message given when part of a stack of items in a monster's inventory is add "Boing!" message when hero zaps resistant monster with striking/force bolt adjust gaze reflection message when your scales are embedded in your skin adjust turning-to-stone or -slime messages when you have no limbs +wizard mode ^F on Plane of Water marked portal as seen but didn't display it +magic mapping displays furniture in preference to known or remembered traps + or objects and known traps in preference to remembered objects Platform- and/or Interface-Specific Fixes diff --git a/src/detect.c b/src/detect.c index 6cb9eb8af..6cd342eb7 100644 --- a/src/detect.c +++ b/src/detect.c @@ -973,7 +973,9 @@ STATIC_OVL void show_map_spot(x, y) register int x, y; { - register struct rm *lev; + struct rm *lev; + struct trap *t; + int oldglyph; if (Confusion && rn2(7)) return; lev = &levl[x][y]; @@ -986,16 +988,26 @@ register int x, y; unblock_point(x,y); } - /* if we don't remember an object or trap there, map it */ - if (lev->typ == ROOM ? - (glyph_is_cmap(lev->glyph) && !glyph_is_trap(lev->glyph) && - glyph_to_cmap(lev->glyph) != ROOM) : - (!glyph_is_object(lev->glyph) && !glyph_is_trap(lev->glyph))) { - if (level.flags.hero_memory) { - magic_map_background(x,y,0); - newsym(x,y); /* show it, if not blocked */ - } else { - magic_map_background(x,y,1); /* display it */ + /* + * Force the real background, then if it's not furniture and there's + * a known trap there, display the trap, else if there was an object + * shown there, redisplay the object. So during mapping, furniture + * takes precedence over traps, which take precedence over objects, + * opposite to how normal vision behaves. + */ + oldglyph = glyph_at(x, y); + if (level.flags.hero_memory) { + magic_map_background(x, y, 0); + newsym(x, y); /* show it, if not blocked */ + } else { + magic_map_background(x, y, 1); /* display it */ + } + if (!IS_FURNITURE(lev->typ)) { + if ((t = t_at(x, y)) != 0 && t->tseen) { + map_trap(t, 1); + } else if (glyph_is_trap(oldglyph) || glyph_is_object(oldglyph)) { + show_glyph(x, y, oldglyph); + if (level.flags.hero_memory) lev->glyph = oldglyph; } } }