Skip to content

Commit

Permalink
finding traps while blind
Browse files Browse the repository at this point in the history
     <Someone> reported that when levitating and blind, he was getting
"You float over the hole" without it showing up on the map.  Easiest way
to reproduce:  zap a wand of digging downwards while levitating blind,
move off the spot and back over it.

     Make sure that all traps created by the player are mapped.  For other
traps, it was about 50:50 whether the trap triggering message yields enough
information to warrant forcibly mapping the trap when blind.
  • Loading branch information
nethack.rankin committed Apr 14, 2005
1 parent 68dc083 commit 61dda66
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 30 deletions.
1 change: 1 addition & 0 deletions include/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,7 @@ E struct monst *FDECL(activate_statue_trap,
(struct trap *,XCHAR_P,XCHAR_P,BOOLEAN_P));
E void FDECL(dotrap, (struct trap *, unsigned));
E void FDECL(seetrap, (struct trap *));
E void FDECL(feeltrap, (struct trap *));
E int FDECL(mintrap, (struct monst *));
E void FDECL(instapetrify, (const char *));
E void FDECL(minstapetrify, (struct monst *,BOOLEAN_P));
Expand Down
10 changes: 5 additions & 5 deletions src/apply.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)apply.c 3.5 2005/03/28 */
/* SCCS Id: @(#)apply.c 3.5 2005/04/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */

Expand Down Expand Up @@ -2209,16 +2209,16 @@ set_trap()
ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
ttmp = maketrap(u.ux, u.uy, ttyp);
if (ttmp) {
ttmp->tseen = 1;
ttmp->madeby_u = 1;
newsym(u.ux, u.uy); /* if our hero happens to be invisible */
feeltrap(ttmp);
if (*in_rooms(u.ux,u.uy,SHOPBASE)) {
add_damage(u.ux, u.uy, 0L); /* schedule removal */
}
if (!trapinfo.force_bungle)
You("finish arming %s.",
the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
if (((otmp->cursed || Fumbling) && (rnl(10) > 5)) || trapinfo.force_bungle)
the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
if (((otmp->cursed || Fumbling) && (rnl(10) > 5)) ||
trapinfo.force_bungle)
dotrap(ttmp,
(unsigned)(trapinfo.force_bungle ? FORCEBUNGLE : 0));
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/dig.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dig.c 3.5 2005/03/07 */
/* SCCS Id: @(#)dig.c 3.5 2005/04/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */

Expand Down Expand Up @@ -531,9 +531,9 @@ int ttyp;
ttmp = maketrap(x, y, ttyp);
if (!ttmp) return;
newobjs = level.objects[x][y];
ttmp->tseen = (madeby_u || cansee(x,y));
ttmp->madeby_u = madeby_u;
newsym(ttmp->tx,ttmp->ty);
if (cansee(x,y)) seetrap(ttmp);
else if (madeby_u) feeltrap(ttmp);

if (ttyp == PIT) {

Expand Down
5 changes: 2 additions & 3 deletions src/polyself.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)polyself.c 3.5 2004/11/11 */
/* SCCS Id: @(#)polyself.c 3.5 2005/04/13 */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */

Expand Down Expand Up @@ -919,10 +919,9 @@ dospinweb()
}
ttmp = maketrap(u.ux, u.uy, WEB);
if (ttmp) {
ttmp->tseen = 1;
ttmp->madeby_u = 1;
feeltrap(ttmp);
}
newsym(u.ux, u.uy);
return(1);
}

Expand Down
49 changes: 30 additions & 19 deletions src/trap.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)trap.c 3.5 2005/03/16 */
/* SCCS Id: @(#)trap.c 3.5 2005/04/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */

Expand Down Expand Up @@ -321,8 +321,8 @@ boolean td; /* td == TRUE : trap door or hole */
} while(!rn2(4) && newlevel < dunlevs_in_dungeon(&u.uz));

if(td) {
struct trap *t=t_at(u.ux,u.uy);
seetrap(t);
struct trap *t = t_at(u.ux,u.uy);
feeltrap(t);
if (!In_sokoban(&u.uz)) {
if (t->ttyp == TRAPDOOR)
pline("A trap door opens up under you!");
Expand Down Expand Up @@ -737,7 +737,7 @@ unsigned trflags;
int dmg = d(2,6); /* should be std ROCK dmg? */

trap->once = 1;
seetrap(trap);
feeltrap(trap);
otmp = mksobj_at(ROCK, u.ux, u.uy, TRUE, FALSE);
otmp->quan = 1L;
otmp->owt = weight(otmp);
Expand Down Expand Up @@ -783,7 +783,7 @@ unsigned trflags;

case BEAR_TRAP:
if(Levitation || Flying) break;
seetrap(trap);
feeltrap(trap);
if(amorphous(youmonst.data) || is_whirly(youmonst.data) ||
unsolid(youmonst.data)) {
pline("%s bear trap closes harmlessly through you.",
Expand Down Expand Up @@ -901,7 +901,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
case SPIKED_PIT:
/* KMH -- You can't escape the Sokoban level traps */
if (!In_sokoban(&u.uz) && (Levitation || Flying)) break;
seetrap(trap);
feeltrap(trap);
if (!In_sokoban(&u.uz) && is_clinger(youmonst.data)) {
if(trap->tseen) {
You("see %s %spit below you.", a_your[trap->madeby_u],
Expand Down Expand Up @@ -1003,7 +1003,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
break;

case WEB: /* Our luckless player has stumbled into a web. */
seetrap(trap);
feeltrap(trap);
if (amorphous(youmonst.data) || is_whirly(youmonst.data) ||
unsolid(youmonst.data)) {
if (acidic(youmonst.data) || u.umonnum == PM_GELATINOUS_CUBE ||
Expand All @@ -1022,7 +1022,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
}
if (webmaker(youmonst.data)) {
if (webmsgok)
pline(trap->madeby_u ? "You take a walk on your web."
pline(trap->madeby_u ? "You take a walk on your web."
: "There is a spider web here.");
break;
}
Expand Down Expand Up @@ -1154,7 +1154,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
#endif
if (Levitation || Flying) {
if (!already_seen && rn2(3)) break;
seetrap(trap);
feeltrap(trap);
pline("%s %s in a pile of soil below you.",
already_seen ? "There is" : "You discover",
trap->madeby_u ? "the trigger of your mine" :
Expand All @@ -1175,7 +1175,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);

if (recursive_mine) break;
#endif
seetrap(trap);
feeltrap(trap);
pline("KAABLAMM!!! You triggered %s land mine!",
a_your[trap->madeby_u]);
#ifdef STEED
Expand Down Expand Up @@ -1204,7 +1204,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
case ROLLING_BOULDER_TRAP: {
int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);

seetrap(trap);
feeltrap(trap);
pline("Click! You trigger a rolling boulder trap!");
if(!launch_obj(BOULDER, trap->launch.x, trap->launch.y,
trap->launch2.x, trap->launch2.y, style)) {
Expand All @@ -1215,12 +1215,12 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
break;
}
case MAGIC_PORTAL:
seetrap(trap);
feeltrap(trap);
domagicportal(trap);
break;

default:
seetrap(trap);
feeltrap(trap);
impossible("You hit a trap of type %u", trap->ttyp);
}
}
Expand Down Expand Up @@ -1562,7 +1562,7 @@ int style;
singleobj->oy = dest.dlevel;
singleobj->owornmask = (long)MIGR_RANDOM;
}
seetrap(t);
seetrap(t);
used_up = TRUE;
launch_drop_spot((struct obj *)0, 0, 0);
break;
Expand Down Expand Up @@ -1641,12 +1641,23 @@ int style;

void
seetrap(trap)
register struct trap *trap;
struct trap *trap;
{
if(!trap->tseen) {
trap->tseen = 1;
newsym(trap->tx, trap->ty);
}
if (!trap->tseen) {
trap->tseen = 1;
newsym(trap->tx, trap->ty);
}
}

/* like seetrap() but overrides vision */
void
feeltrap(trap)
struct trap *trap;
{
trap->tseen = 1;
map_trap(trap, 1);
/* in case it's beneath something, redisplay the something */
newsym(trap->tx, trap->ty);
}

STATIC_OVL int
Expand Down

0 comments on commit 61dda66

Please sign in to comment.