From: nethack.rankin Date: Sat, 2 Sep 2006 03:32:18 +0000 (+0000) Subject: Unaware; fix #H202 and extend the fix for #H179 (trunk only) X-Git-Tag: MOVE2GIT~921 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06e9fa91de8e6694c6d923d4006a138263067369;p=nethack 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. --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 109a704c8..24c57f2b7 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 tame/peaceful grabber/engulfer will release hero after conflict ends 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 diff --git a/include/youprop.h b/include/youprop.h index 11c98bc08..6f6f59d80 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -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 */ /* NetHack may be freely redistributed. See license for details. */ @@ -359,5 +359,8 @@ #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 */ diff --git a/src/mhitm.c b/src/mhitm.c index 37341a6f9..702174c39 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -327,7 +327,7 @@ mattackm(magr, mdef) mdef->mundetected = 0; newsym(mdef->mx, mdef->my); if(canseemon(mdef) && !sensemon(mdef)) { - if (u.usleep) You("dream of %s.", + if (Unaware) You("dream of %s.", (mdef->data->geno & G_UNIQ) ? a_monnam(mdef) : makeplural(m_monnam(mdef))); else pline("Suddenly, you notice %s.", a_monnam(mdef)); diff --git a/src/mondata.c b/src/mondata.c index 77040b2a9..dfbce3d55 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -119,7 +119,7 @@ struct monst *mon; boolean is_you = (mon == &youmonst); struct obj *o; - if (is_you ? (Blind || u.usleep || is_fainted()) : + if (is_you ? (Blind || Unaware) : (mon->mblinded || !mon->mcansee || !haseyes(ptr) || /* BUG: temporary sleep sets mfrozen, but since paralysis does too, we can't check it */ @@ -185,7 +185,7 @@ struct obj *obj; /* aatyp == AT_WEAP, AT_SPIT */ break; case AT_ENGL: - if (is_you && (Blindfolded || u.usleep || u.ucreamed)) + if (is_you && (Blindfolded || Unaware || u.ucreamed)) return FALSE; if (!is_you && mdef->msleeping) return FALSE; diff --git a/src/monmove.c b/src/monmove.c index f3aacb73f..2deb55104 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -21,7 +21,7 @@ mb_trapped(mtmp) register struct monst *mtmp; { 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."); else if (!Deaf) You_hear("a distant explosion."); diff --git a/src/pline.c b/src/pline.c index a992836f4..313d07bd6 100644 --- a/src/pline.c +++ b/src/pline.c @@ -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. */ /* NetHack may be freely redistributed. See license for details. */ @@ -134,7 +134,11 @@ You_feel VA_DECL(const char *,line) char *tmp; VA_START(line); 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(); } @@ -179,7 +183,7 @@ You_hear VA_DECL(const char *,line) VA_INIT(line, const char *); if (Underwater) YouPrefix(tmp, "You barely hear ", line); - else if (u.usleep) + else if (Unaware) YouPrefix(tmp, "You dream that you hear ", line); else YouPrefix(tmp, "You hear ", line); @@ -194,7 +198,7 @@ You_see VA_DECL(const char *,line) VA_START(line); VA_INIT(line, const char *); - if (u.usleep) + if (Unaware) YouPrefix(tmp, "You dream that you see ", line); else if (Blind) /* caller should have caught this... */ YouPrefix(tmp, "You sense ", line); diff --git a/src/potion.c b/src/potion.c index 727c38a98..cbff9a0d7 100644 --- a/src/potion.c +++ b/src/potion.c @@ -59,6 +59,8 @@ boolean talk; { long old = HConfusion; + if (Unaware) talk = FALSE; + if (!xtime && old) { if (talk) You_feel("less %s now.", @@ -76,6 +78,8 @@ boolean talk; { long old = HStun; + if (Unaware) talk = FALSE; + if (!xtime && old) { if (talk) You_feel("%s now.", @@ -105,6 +109,10 @@ int type; { long old = Sick; +#if 0 + if (Unaware) talk = FALSE; +#endif + if (xtime > 0L) { if (Sick_resistance) return; if (!old) { @@ -125,7 +133,7 @@ int type; if (talk) You_feel("somewhat better."); set_itimeout(&Sick, Sick * 2); /* approximation */ } else { - if (talk) pline("What a relief!"); + if (talk) You_feel("cured. What a relief!"); Sick = 0L; /* set_itimeout(&Sick, 0L) */ } context.botl = TRUE; @@ -145,6 +153,10 @@ const char *msg; { long old = Slimed; +#if 0 + if (Unaware) msg = 0; +#endif + if ((!xtime && old) || (xtime && !old)) { if (msg) pline("%s", msg); context.botl = 1; @@ -163,6 +175,10 @@ const char *killername; { long old = Stoned; +#if 0 + if (Unaware) msg = 0; +#endif + if ((!xtime && old) || (xtime && !old)) { if (msg) pline("%s", msg); /* context.botl = 1; --- Stoned is not a status line item */ @@ -179,6 +195,8 @@ boolean talk; { long old = Vomiting; + if (Unaware) talk = FALSE; + if(!xtime && old) if(talk) You_feel("much less nauseated now."); @@ -205,7 +223,7 @@ boolean talk; can_see_now = !Blind; Blinded = old; /* restore */ - if (u.usleep) talk = FALSE; + if (Unaware) talk = FALSE; if (can_see_now && !u_could_see) { /* regaining sight */ if (talk) { @@ -283,6 +301,8 @@ long mask; /* nonzero if resistance status should change by mask */ boolean changed = 0; const char *message, *verb; + if (Unaware) talk = FALSE; + message = (!xtime) ? "Everything %s SO boring now." : "Oh wow! Everything %s so cosmic!"; verb = (!Blind) ? "looks" : "feels"; @@ -1431,12 +1451,12 @@ register struct obj *obj; exercise(A_DEX, TRUE); break; case POT_BLINDNESS: - if (!Blind && !u.usleep) { + if (!Blind && !Unaware) { kn++; pline("It suddenly gets dark."); } make_blinded(itimeout_incr(Blinded, rnd(5)), FALSE); - if (!Blind && !u.usleep) Your(vision_clears); + if (!Blind && !Unaware) Your(vision_clears); break; case POT_WATER: if(u.umonnum == PM_GREMLIN) { diff --git a/src/trap.c b/src/trap.c index 2b4dea113..8813f457c 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3092,7 +3092,7 @@ drown() return(FALSE); } 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 */ if (!level.flags.noteleport) { (void) dotele(); @@ -3113,6 +3113,8 @@ drown() while still asleep; we can't do that the same way that waking due to combat is handled; note unmul() clears u.usleep */ 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) */ if (multi < 0 || (Upolyd && !youmonst.data->mmove)) goto crawl; /* look around for a place to crawl to */