]> granicus.if.org Git - nethack/commitdiff
magic mapping fixes
authornethack.rankin <nethack.rankin>
Mon, 16 Apr 2012 02:05:40 +0000 (02:05 +0000)
committernethack.rankin <nethack.rankin>
Mon, 16 Apr 2012 02:05:40 +0000 (02:05 +0000)
     ^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.)

doc/fixes35.0
src/detect.c

index 2a3e46281025ba869ce8369c5ceae178dd755b97..5cbd142fae46a177d32c1ace382eca33aa57d525 100644 (file)
@@ -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
index 6cb9eb8af315ed2d8fbcb642c1e70f51f9050d5c..6cd342eb7500d15ba29e230d6031954e99c0fcc9 100644 (file)
@@ -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;
        }
     }
 }