fix #M108 - seeing while asleep

I think being asleep or unconscious ought to override vision the way
that being blinded does, but that's a more ambitious change than I care to
tackle.  This replaces You("see ...") with You_see("..."), comparable to
You_hear().  It catches the reported door case and several variations of
light sources burning out while on the floor rather than in inventory, but
it probably misses some other cases.  zap_over_floor() in particular is
highly suspect.
This commit is contained in:
nethack.rankin
2005-06-23 03:48:14 +00:00
parent b72967f6a6
commit ebc20fa560
16 changed files with 97 additions and 78 deletions

View File

@@ -128,6 +128,7 @@ when a monster grew into a higher form which had previously been genocided,
the message explaining its fate was only given if it was sensed via ESP
hero could still see for brief period after being blinded by potion vapors
avoid crash when thrown potion hits bars before a monster
don't give messages about seeing things happen while asleep
Platform- and/or Interface-Specific Fixes

View File

@@ -1575,6 +1575,7 @@ E void VDECL(Your, (const char *,...)) PRINTF_F(1,2);
E void VDECL(You_feel, (const char *,...)) PRINTF_F(1,2);
E void VDECL(You_cant, (const char *,...)) PRINTF_F(1,2);
E void VDECL(You_hear, (const char *,...)) PRINTF_F(1,2);
E void VDECL(You_see, (const char *,...)) PRINTF_F(1,2);
E void VDECL(pline_The, (const char *,...)) PRINTF_F(1,2);
E void VDECL(There, (const char *,...)) PRINTF_F(1,2);
E void VDECL(verbalize, (const char *,...)) PRINTF_F(1,2);

View File

@@ -1,11 +1,10 @@
/* SCCS Id: @(#)apply.c 3.5 2005/06/02 */
/* SCCS Id: @(#)apply.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include "edog.h"
static const char tools[] = { TOOL_CLASS, WEAPON_CLASS, WAND_CLASS, 0 };
static const char tools_too[] = { ALL_CLASSES, TOOL_CLASS, POTION_CLASS,
WEAPON_CLASS, WAND_CLASS, GEM_CLASS, 0 };
@@ -1756,7 +1755,7 @@ long timeout;
You_feel("%s %s from your pack!", something,
locomotion(mtmp->data,"drop"));
else
You("see %s %s out of your pack%s!",
You_see("%s %s out of your pack%s!",
monnambuf,
locomotion(mtmp->data,"drop"),
and_vanish);
@@ -1767,7 +1766,7 @@ long timeout;
if (suppress_see)
pline("%s suddenly vanishes!", an(xname(figurine)));
else
You("suddenly see a figurine transform into %s%s!",
You_see("a figurine transform into %s%s!",
monnambuf, and_vanish);
redraw = TRUE; /* update figurine's map location */
}
@@ -1781,12 +1780,11 @@ long timeout;
if (canseemon(figurine->ocarry)) {
Sprintf(carriedby, "%s pack",
s_suffix(a_monnam(mon)));
}
else if (is_pool(mon->mx, mon->my))
} else if (is_pool(mon->mx, mon->my))
Strcpy(carriedby, "empty water");
else
Strcpy(carriedby, "thin air");
You("see %s %s out of %s%s!", monnambuf,
You_see("%s %s out of %s%s!", monnambuf,
locomotion(mtmp->data, "drop"), carriedby,
and_vanish);
}
@@ -2090,11 +2088,11 @@ struct obj *tstone;
Sprintf(stonebuf, "stone%s", plur(tstone->quan));
if (do_scratch)
pline("You make %s%sscratch marks on the %s.",
You("make %s%sscratch marks on the %s.",
streak_color ? streak_color : (const char *)"",
streak_color ? " " : "", stonebuf);
else if (streak_color)
pline("You see %s streaks on the %s.", streak_color, stonebuf);
You_see("%s streaks on the %s.", streak_color, stonebuf);
else
pline(scritch);
return;
@@ -2493,7 +2491,7 @@ static const char
/* Distance attacks by pole-weapons */
STATIC_OVL int
use_pole (obj)
use_pole(obj)
struct obj *obj;
{
int res = 0, typ, max_range = 4, min_range = 4;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dbridge.c 3.5 2003/02/08 */
/* SCCS Id: @(#)dbridge.c 3.5 2005/06/22 */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -746,7 +746,7 @@ int x,y;
x2 = x; y2 = y;
get_wall_for_db(&x2,&y2);
if (cansee(x,y) || cansee(x2,y2))
You("see a drawbridge %s up!",
You_see("a drawbridge %s up!",
(((u.ux == x || u.uy == y) && !Underwater) ||
distu(x2,y2) < distu(x,y)) ? "coming" : "going");
lev1->typ = DRAWBRIDGE_UP;
@@ -798,7 +798,7 @@ int x,y;
x2 = x; y2 = y;
get_wall_for_db(&x2,&y2);
if (cansee(x,y) || cansee(x2,y2))
You("see a drawbridge %s down!",
You_see("a drawbridge %s down!",
(distu(x2,y2) < distu(x,y)) ? "going" : "coming");
lev1->typ = DRAWBRIDGE_DOWN;
lev2 = &levl[x2][y2];

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)detect.c 3.5 2003/08/13 */
/* SCCS Id: @(#)detect.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -842,9 +842,9 @@ struct obj *obj;
case 3 : pline_The("crystal pulses with sinister %s light!",
hcolor((char *)0));
break;
case 4 : You("see goldfish swimming above fluorescent rocks.");
case 4 : You_see("goldfish swimming above fluorescent rocks.");
break;
case 5 : You("see tiny snowflakes spinning around a miniature farmhouse.");
case 5 : You_see("tiny snowflakes spinning around a miniature farmhouse.");
break;
default: pline("Oh wow... like a kaleidoscope!");
break;
@@ -892,7 +892,7 @@ struct obj *obj;
default:
{
int i = rn2(SIZE(level_detects));
You("see %s, %s.",
You_see("%s, %s.",
level_detects[i].what,
level_distance(level_detects[i].where));
}
@@ -902,7 +902,7 @@ struct obj *obj;
if (ret) {
if (!rn2(100)) /* make them nervous */
You("see the Wizard of Yendor gazing out at you.");
You_see("the Wizard of Yendor gazing out at you.");
else pline_The("vision is unclear.");
}
}
@@ -1282,12 +1282,12 @@ sokoban_detect()
/* Map the background and boulders */
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {
levl[x][y].seenv = SVALL;
levl[x][y].waslit = TRUE;
map_background(x, y, 1);
for (obj = level.objects[x][y]; obj; obj = obj->nexthere)
if (obj->otyp == BOULDER)
map_object(obj, 1);
levl[x][y].seenv = SVALL;
levl[x][y].waslit = TRUE;
map_background(x, y, 1);
for (obj = level.objects[x][y]; obj; obj = obj->nexthere)
if (obj->otyp == BOULDER)
map_object(obj, 1);
}
/* Map the traps */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)do.c 3.5 2005/06/02 */
/* SCCS Id: @(#)do.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -345,10 +345,10 @@ giveback:
You("don't see anything happen to the sink.");
break;
case RIN_FREE_ACTION:
You("see the ring slide right down the drain!");
You_see("the ring slide right down the drain!");
break;
case RIN_SEE_INVISIBLE:
You("see some air in the sink.");
You_see("some air in the sink.");
break;
case RIN_STEALTH:
pline_The("sink seems to blend into the floor for a moment.");
@@ -1567,24 +1567,27 @@ struct obj *corpse;
}
break;
case OBJ_CONTAINED:
if (container_where == OBJ_MINVENT && cansee(mtmp->mx, mtmp->my) &&
{
char sackname[BUFSZ];
if (container_where == OBJ_MINVENT &&
cansee(mtmp->mx, mtmp->my) &&
mcarry && canseemon(mcarry) && container) {
pline("%s writhes out of %s!",
pline("%s writhes out of %s!",
Amonnam(mtmp), yname(container));
} else if (container_where == OBJ_INVENT && container) {
char sackname[BUFSZ];
Strcpy(sackname, an(xname(container)));
pline("%s %s out of %s in your pack!",
Blind ? Something : Amonnam(mtmp),
} else if (container_where == OBJ_INVENT && container) {
Strcpy(sackname, an(xname(container)));
pline("%s %s out of %s in your pack!",
Blind ? Something : Amonnam(mtmp),
locomotion(mtmp->data,"writhes"),
sackname);
} else if (container_where == OBJ_FLOOR && container &&
cansee(mtmp->mx, mtmp->my)) {
char sackname[BUFSZ];
Strcpy(sackname, an(xname(container)));
sackname);
} else if (container_where == OBJ_FLOOR && container &&
cansee(mtmp->mx, mtmp->my)) {
Strcpy(sackname, an(xname(container)));
pline("%s escapes from %s!", Amonnam(mtmp), sackname);
}
break;
}
default:
/* we should be able to handle the other cases... */
impossible("revive_corpse: lost corpse @ %d", where);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dogmove.c 3.5 2002/09/10 */
/* SCCS Id: @(#)dogmove.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -955,7 +955,7 @@ struct monst *mtmp;
mtmp->mappearance = qm[idx].mappearance;
newsym(mtmp->mx,mtmp->my);
You("see %s appear where %s was!",
You_see("%s appear where %s was!",
(mtmp->m_ap_type == M_AP_FURNITURE) ?
an(defsyms[mtmp->mappearance].explanation) :
(mtmp->m_ap_type == M_AP_OBJECT &&

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dokick.c 3.5 2004/08/02 */
/* SCCS Id: @(#)dokick.c 3.5 2005/06/22 */
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -993,7 +993,7 @@ dokick()
"Muddy waste pops up from the drain"));
if(!(maploc->looted & S_LRING)) { /* once per sink */
if (!Blind)
You("see a ring shining in its midst.");
You_see("a ring shining in its midst.");
(void) mkobj_at(RING_CLASS, x, y, TRUE);
newsym(x, y);
exercise(A_DEX, TRUE);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)engrave.c 3.5 2005/06/02 */
/* SCCS Id: @(#)engrave.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -335,7 +335,7 @@ register int x,y;
*/
if(!Blind) {
sensed = 1;
You("see a message scrawled in blood here.");
You_see("a message scrawled in blood here.");
}
break;
default:

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)fountain.c 3.5 2005/04/23 */
/* SCCS Id: @(#)fountain.c 3.5 2005/06/22 */
/* Copyright Scott R. Turner, srt@ucla, 10/27/86 */
/* NetHack may be freely redistributed. See license for details. */
@@ -297,7 +297,7 @@ drinkfountain()
pline("Then it passes.");
}
} else {
You("see an image of someone stalking you.");
You_see("an image of someone stalking you.");
pline("But it disappears.");
}
HSee_invisible |= FROMOUTSIDE;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mon.c 3.5 2004/06/12 */
/* SCCS Id: @(#)mon.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2829,7 +2829,7 @@ register boolean silent;
if(nct) pline_The("guard%s get%s angry!",
nct == 1 ? "" : "s", nct == 1 ? "s" : "");
else if(!Blind)
You("see %sangry guard%s approaching!",
You_see("%sangry guard%s approaching!",
sct == 1 ? "an " : "", sct > 1 ? "s" : "");
} else if(!Deaf)
You_hear("the shrill sound of a guard's whistle.");

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)monmove.c 3.5 2004/06/12 */
/* SCCS Id: @(#)monmove.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -22,7 +22,7 @@ mb_trapped(mtmp)
register struct monst *mtmp;
{
if (flags.verbose) {
if (cansee(mtmp->mx, mtmp->my))
if (cansee(mtmp->mx, mtmp->my) && !u.usleep)
pline("KABOOM!! You see a door explode.");
else if (!Deaf)
You_hear("a distant explosion.");
@@ -1139,7 +1139,7 @@ postmov:
} else {
if (flags.verbose) {
if (canseeit)
You("see a door unlock and open.");
You_see("a door unlock and open.");
else if (!Deaf)
You_hear("a door unlock and open.");
}
@@ -1156,7 +1156,7 @@ postmov:
} else {
if (flags.verbose) {
if (canseeit)
You("see a door open.");
You_see("a door open.");
else if (!Deaf)
You_hear("a door open.");
}
@@ -1174,7 +1174,7 @@ postmov:
} else {
if (flags.verbose) {
if (canseeit)
You("see a door crash open.");
You_see("a door crash open.");
else if (!Deaf)
You_hear("a door crash open.");
}

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pline.c 3.5 2004/11/22 */
/* SCCS Id: @(#)pline.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -191,6 +191,23 @@ You_hear VA_DECL(const char *,line)
VA_END();
}
/*VARARGS1*/
void
You_see VA_DECL(const char *,line)
char *tmp;
VA_START(line);
VA_INIT(line, const char *);
if (u.usleep)
YouPrefix(tmp, "You dream that you see ", line);
else if (Blind) /* caller should have caught this... */
YouPrefix(tmp, "You sense ", line);
else
YouPrefix(tmp, "You see ", line);
vpline(strcat(tmp, line), VA_ARGS);
VA_END();
}
/* Print a message inside double-quotes.
* The caller is responsible for checking deafness.
* Gods can speak directly to you in spite of deafness.

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)timeout.c 3.5 2005/06/11 */
/* SCCS Id: @(#)timeout.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -535,7 +535,7 @@ long timeout;
You_feel("%s %s from your pack!", something,
locomotion(mon->data, "drop"));
else
You("see %s %s out of your pack!",
You_see("%s %s out of your pack!",
monnambuf, locomotion(mon->data, "drop"));
if (yours) {
pline("%s cries sound like \"%s%s\"",
@@ -550,7 +550,7 @@ long timeout;
case OBJ_FLOOR:
if (cansee_hatchspot) {
knows_egg = TRUE;
You("see %s hatch.", monnambuf);
You_see("%s hatch.", monnambuf);
redraw = TRUE; /* update egg's map location */
}
break;
@@ -567,7 +567,7 @@ long timeout;
Strcpy(carriedby, "empty water");
else
Strcpy(carriedby, "thin air");
You("see %s %s out of %s!", monnambuf,
You_see("%s %s out of %s!", monnambuf,
locomotion(mon->data, "drop"), carriedby);
}
break;
@@ -737,7 +737,7 @@ const char *tailer;
pline("%s flickers%s.", Yname2(obj), tailer);
break;
case OBJ_FLOOR:
You("see %s flicker%s.", an(xname(obj)), tailer);
You_see("%s flicker%s.", an(xname(obj)), tailer);
break;
}
}
@@ -755,7 +755,7 @@ struct obj *obj;
pline("Batteries have not been invented yet.");
break;
case OBJ_FLOOR:
You("see a lantern getting dim.");
You_see("a lantern getting dim.");
break;
case OBJ_MINVENT:
pline("%s lantern is getting dim.",
@@ -827,7 +827,7 @@ long timeout;
whose);
break;
case OBJ_FLOOR:
You("see a burning potion of oil go out.");
You_see("a burning potion of oil go out.");
need_newsym = TRUE;
break;
}
@@ -865,7 +865,7 @@ long timeout;
Yname2(obj));
break;
case OBJ_FLOOR:
You("see %s about to go out.",
You_see("%s about to go out.",
an(xname(obj)));
break;
}
@@ -887,10 +887,9 @@ long timeout;
break;
case OBJ_FLOOR:
if (obj->otyp == BRASS_LANTERN)
You("see a lantern run out of power.");
You_see("a lantern run out of power.");
else
You("see %s go out.",
an(xname(obj)));
You_see("%s go out.", an(xname(obj)));
break;
}
}
@@ -926,7 +925,7 @@ long timeout;
many ? "s are" : " is");
break;
case OBJ_FLOOR:
You("see %scandle%s getting short.",
You_see("%scandle%s getting short.",
menorah ? "a candelabrum's " :
many ? "some " : "a ",
many ? "s" : "");
@@ -948,7 +947,7 @@ long timeout;
many ? "" : "s");
break;
case OBJ_FLOOR:
You("see %scandle%s flame%s flicker low!",
You_see("%scandle%s flame%s flicker low!",
menorah ? "a candelabrum's " :
many ? "some " : "a ",
many ? "s'" : "'s",
@@ -968,7 +967,7 @@ long timeout;
whose, many ? "s die" : " dies");
break;
case OBJ_FLOOR:
You("see a candelabrum's flame%s die.",
You_see("a candelabrum's flame%s die.",
many ? "s" : "");
break;
}
@@ -985,9 +984,9 @@ long timeout;
You see some wax candles consumed!
You see a wax candle consumed!
*/
You("see %s%s consumed!",
many ? "some " : "",
many ? xname(obj):an(xname(obj)));
You_see("%s%s consumed!",
many ? "some " : "",
many ? xname(obj) : an(xname(obj)));
need_newsym = TRUE;
break;
}

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)trap.c 3.5 2005/06/02 */
/* SCCS Id: @(#)trap.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -914,7 +914,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
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],
You_see("%s %spit below you.", a_your[trap->madeby_u],
ttype == SPIKED_PIT ? "spiked " : "");
} else {
pline("%s pit %sopens up under you!",
@@ -2007,7 +2007,7 @@ glovecheck: target = which_armor(mtmp, W_ARMG);
tower_of_flame,
surface(mtmp->mx,mtmp->my), mon_nam(mtmp));
else if (see_it) /* evidently `mtmp' is invisible */
You("see a %s erupt from the %s!",
You_see("a %s erupt from the %s!",
tower_of_flame, surface(mtmp->mx,mtmp->my));
if (resists_fire(mtmp)) {
@@ -2662,7 +2662,7 @@ domagictrap()
make_blinded((long)rn1(5,10),FALSE);
if (!Blind) Your(vision_clears);
} else if (!Blind) {
You("see a flash of light!");
You_see("a flash of light!");
} else if (!Deaf) {
You_hear("a deafening roar!");
}

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)zap.c 3.5 2005/05/18 */
/* SCCS Id: @(#)zap.c 3.5 2005/06/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2381,7 +2381,7 @@ struct obj *obj; /* wand or spell */
pline("A trap door beneath you closes up then vanishes.");
disclose = TRUE;
} else {
You("see a swirl of %s beneath you.",
You_see("a swirl of %s beneath you.",
is_ice(x,y) ? "frost" : "dust");
}
} else {