Unaware; fix #H202 and extend the fix for #H179 (trunk only)

Turn being unconscious (via several reasons, including fainted from
hunger) into a pseudo-property named `Unaware' and use it in several
places where only being asleep was checked.  #H202 was about a stunned
character who got the recovery message when it timed out while fainted.
This suppresses messages for several difficulties when they begin or end
while hero is Unaware.  Messages about fatal illness, sliming, or
petrification aren't suppressed; they're too important to hide from the
player.  "You feel ..." messages come out as "You dream that you feel ..."
when Unaware; fairly lame but hopefully adequate.
This commit is contained in:
nethack.rankin
2006-09-02 03:32:18 +00:00
parent 1574c6effd
commit 06e9fa91de
8 changed files with 44 additions and 14 deletions
+1
View File
@@ -157,6 +157,7 @@ if shopkeeper or priest gets teleported while inside his shop or temple,
give locations inside that room preference when choosing destination give locations inside that room preference when choosing destination
tame/peaceful grabber/engulfer will release hero after conflict ends tame/peaceful grabber/engulfer will release hero after conflict ends
make changes in hallucination be reflected by changes in mimickery feedback make changes in hallucination be reflected by changes in mimickery feedback
add Unaware pseudo-property to suppress various messages while unconscious
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+4 -1
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)youprop.h 3.5 1999/07/02 */ /* SCCS Id: @(#)youprop.h 3.5 2006/09/01 */
/* Copyright (c) 1989 Mike Threepoint */ /* Copyright (c) 1989 Mike Threepoint */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -359,5 +359,8 @@
#define Lifesaved u.uprops[LIFESAVED].extrinsic #define Lifesaved u.uprops[LIFESAVED].extrinsic
/* unconscious() includes u.usleep but not is_fainted(); the multi test is
redundant but allows the function calls to be skipped most of the time */
#define Unaware (multi < 0 && (unconscious() || is_fainted()))
#endif /* YOUPROP_H */ #endif /* YOUPROP_H */
+1 -1
View File
@@ -327,7 +327,7 @@ mattackm(magr, mdef)
mdef->mundetected = 0; mdef->mundetected = 0;
newsym(mdef->mx, mdef->my); newsym(mdef->mx, mdef->my);
if(canseemon(mdef) && !sensemon(mdef)) { if(canseemon(mdef) && !sensemon(mdef)) {
if (u.usleep) You("dream of %s.", if (Unaware) You("dream of %s.",
(mdef->data->geno & G_UNIQ) ? (mdef->data->geno & G_UNIQ) ?
a_monnam(mdef) : makeplural(m_monnam(mdef))); a_monnam(mdef) : makeplural(m_monnam(mdef)));
else pline("Suddenly, you notice %s.", a_monnam(mdef)); else pline("Suddenly, you notice %s.", a_monnam(mdef));
+2 -2
View File
@@ -119,7 +119,7 @@ struct monst *mon;
boolean is_you = (mon == &youmonst); boolean is_you = (mon == &youmonst);
struct obj *o; struct obj *o;
if (is_you ? (Blind || u.usleep || is_fainted()) : if (is_you ? (Blind || Unaware) :
(mon->mblinded || !mon->mcansee || !haseyes(ptr) || (mon->mblinded || !mon->mcansee || !haseyes(ptr) ||
/* BUG: temporary sleep sets mfrozen, but since /* BUG: temporary sleep sets mfrozen, but since
paralysis does too, we can't check it */ paralysis does too, we can't check it */
@@ -185,7 +185,7 @@ struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */
break; break;
case AT_ENGL: case AT_ENGL:
if (is_you && (Blindfolded || u.usleep || u.ucreamed)) if (is_you && (Blindfolded || Unaware || u.ucreamed))
return FALSE; return FALSE;
if (!is_you && mdef->msleeping) if (!is_you && mdef->msleeping)
return FALSE; return FALSE;
+1 -1
View File
@@ -21,7 +21,7 @@ mb_trapped(mtmp)
register struct monst *mtmp; register struct monst *mtmp;
{ {
if (flags.verbose) { if (flags.verbose) {
if (cansee(mtmp->mx, mtmp->my) && !u.usleep) if (cansee(mtmp->mx, mtmp->my) && !Unaware)
pline("KABOOM!! You see a door explode."); pline("KABOOM!! You see a door explode.");
else if (!Deaf) else if (!Deaf)
You_hear("a distant explosion."); You_hear("a distant explosion.");
+8 -4
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pline.c 3.5 2006/02/20 */ /* SCCS Id: @(#)pline.c 3.5 2006/08/30 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -134,7 +134,11 @@ You_feel VA_DECL(const char *,line)
char *tmp; char *tmp;
VA_START(line); VA_START(line);
VA_INIT(line, const char *); VA_INIT(line, const char *);
vpline(YouMessage(tmp, "You feel ", line), VA_ARGS); if (Unaware)
YouPrefix(tmp, "You dream that you feel ", line);
else
YouPrefix(tmp, "You feel ", line);
vpline(strcat(tmp, line), VA_ARGS);
VA_END(); VA_END();
} }
@@ -179,7 +183,7 @@ You_hear VA_DECL(const char *,line)
VA_INIT(line, const char *); VA_INIT(line, const char *);
if (Underwater) if (Underwater)
YouPrefix(tmp, "You barely hear ", line); YouPrefix(tmp, "You barely hear ", line);
else if (u.usleep) else if (Unaware)
YouPrefix(tmp, "You dream that you hear ", line); YouPrefix(tmp, "You dream that you hear ", line);
else else
YouPrefix(tmp, "You hear ", line); YouPrefix(tmp, "You hear ", line);
@@ -194,7 +198,7 @@ You_see VA_DECL(const char *,line)
VA_START(line); VA_START(line);
VA_INIT(line, const char *); VA_INIT(line, const char *);
if (u.usleep) if (Unaware)
YouPrefix(tmp, "You dream that you see ", line); YouPrefix(tmp, "You dream that you see ", line);
else if (Blind) /* caller should have caught this... */ else if (Blind) /* caller should have caught this... */
YouPrefix(tmp, "You sense ", line); YouPrefix(tmp, "You sense ", line);
+24 -4
View File
@@ -59,6 +59,8 @@ boolean talk;
{ {
long old = HConfusion; long old = HConfusion;
if (Unaware) talk = FALSE;
if (!xtime && old) { if (!xtime && old) {
if (talk) if (talk)
You_feel("less %s now.", You_feel("less %s now.",
@@ -76,6 +78,8 @@ boolean talk;
{ {
long old = HStun; long old = HStun;
if (Unaware) talk = FALSE;
if (!xtime && old) { if (!xtime && old) {
if (talk) if (talk)
You_feel("%s now.", You_feel("%s now.",
@@ -105,6 +109,10 @@ int type;
{ {
long old = Sick; long old = Sick;
#if 0
if (Unaware) talk = FALSE;
#endif
if (xtime > 0L) { if (xtime > 0L) {
if (Sick_resistance) return; if (Sick_resistance) return;
if (!old) { if (!old) {
@@ -125,7 +133,7 @@ int type;
if (talk) You_feel("somewhat better."); if (talk) You_feel("somewhat better.");
set_itimeout(&Sick, Sick * 2); /* approximation */ set_itimeout(&Sick, Sick * 2); /* approximation */
} else { } else {
if (talk) pline("What a relief!"); if (talk) You_feel("cured. What a relief!");
Sick = 0L; /* set_itimeout(&Sick, 0L) */ Sick = 0L; /* set_itimeout(&Sick, 0L) */
} }
context.botl = TRUE; context.botl = TRUE;
@@ -145,6 +153,10 @@ const char *msg;
{ {
long old = Slimed; long old = Slimed;
#if 0
if (Unaware) msg = 0;
#endif
if ((!xtime && old) || (xtime && !old)) { if ((!xtime && old) || (xtime && !old)) {
if (msg) pline("%s", msg); if (msg) pline("%s", msg);
context.botl = 1; context.botl = 1;
@@ -163,6 +175,10 @@ const char *killername;
{ {
long old = Stoned; long old = Stoned;
#if 0
if (Unaware) msg = 0;
#endif
if ((!xtime && old) || (xtime && !old)) { if ((!xtime && old) || (xtime && !old)) {
if (msg) pline("%s", msg); if (msg) pline("%s", msg);
/* context.botl = 1; --- Stoned is not a status line item */ /* context.botl = 1; --- Stoned is not a status line item */
@@ -179,6 +195,8 @@ boolean talk;
{ {
long old = Vomiting; long old = Vomiting;
if (Unaware) talk = FALSE;
if(!xtime && old) if(!xtime && old)
if(talk) You_feel("much less nauseated now."); if(talk) You_feel("much less nauseated now.");
@@ -205,7 +223,7 @@ boolean talk;
can_see_now = !Blind; can_see_now = !Blind;
Blinded = old; /* restore */ Blinded = old; /* restore */
if (u.usleep) talk = FALSE; if (Unaware) talk = FALSE;
if (can_see_now && !u_could_see) { /* regaining sight */ if (can_see_now && !u_could_see) { /* regaining sight */
if (talk) { if (talk) {
@@ -283,6 +301,8 @@ long mask; /* nonzero if resistance status should change by mask */
boolean changed = 0; boolean changed = 0;
const char *message, *verb; const char *message, *verb;
if (Unaware) talk = FALSE;
message = (!xtime) ? "Everything %s SO boring now." : message = (!xtime) ? "Everything %s SO boring now." :
"Oh wow! Everything %s so cosmic!"; "Oh wow! Everything %s so cosmic!";
verb = (!Blind) ? "looks" : "feels"; verb = (!Blind) ? "looks" : "feels";
@@ -1431,12 +1451,12 @@ register struct obj *obj;
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
break; break;
case POT_BLINDNESS: case POT_BLINDNESS:
if (!Blind && !u.usleep) { if (!Blind && !Unaware) {
kn++; kn++;
pline("It suddenly gets dark."); pline("It suddenly gets dark.");
} }
make_blinded(itimeout_incr(Blinded, rnd(5)), FALSE); make_blinded(itimeout_incr(Blinded, rnd(5)), FALSE);
if (!Blind && !u.usleep) Your(vision_clears); if (!Blind && !Unaware) Your(vision_clears);
break; break;
case POT_WATER: case POT_WATER:
if(u.umonnum == PM_GREMLIN) { if(u.umonnum == PM_GREMLIN) {
+3 -1
View File
@@ -3092,7 +3092,7 @@ drown()
return(FALSE); return(FALSE);
} }
if ((Teleportation || can_teleport(youmonst.data)) && if ((Teleportation || can_teleport(youmonst.data)) &&
!u.usleep && (Teleport_control || rn2(3) < Luck+2)) { !Unaware && (Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell."); /* utcsri!carroll */ You("attempt a teleport spell."); /* utcsri!carroll */
if (!level.flags.noteleport) { if (!level.flags.noteleport) {
(void) dotele(); (void) dotele();
@@ -3113,6 +3113,8 @@ drown()
while still asleep; we can't do that the same way that waking while still asleep; we can't do that the same way that waking
due to combat is handled; note unmul() clears u.usleep */ due to combat is handled; note unmul() clears u.usleep */
if (u.usleep) unmul("Suddenly you wake up!"); if (u.usleep) unmul("Suddenly you wake up!");
/* being doused will revive from fainting */
if (is_fainted()) reset_faint();
/* can't crawl if unable to move (crawl_ok flag stays false) */ /* can't crawl if unable to move (crawl_ok flag stays false) */
if (multi < 0 || (Upolyd && !youmonst.data->mmove)) goto crawl; if (multi < 0 || (Upolyd && !youmonst.data->mmove)) goto crawl;
/* look around for a place to crawl to */ /* look around for a place to crawl to */