Skip to content

Commit

Permalink
Unaware; fix #H202 and extend the fix for #H179 (trunk only)
Browse files Browse the repository at this point in the history
     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.
  • Loading branch information
nethack.rankin committed Sep 2, 2006
1 parent 1574c6e commit 06e9fa9
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 14 deletions.
1 change: 1 addition & 0 deletions doc/fixes35.0
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion include/youprop.h
Original file line number Diff line number Diff line change
@@ -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. */

Expand Down Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion src/mhitm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions src/mondata.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/monmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
12 changes: 8 additions & 4 deletions src/pline.c
Original file line number Diff line number Diff line change
@@ -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. */

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
28 changes: 24 additions & 4 deletions src/potion.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ boolean talk;
{
long old = HConfusion;

if (Unaware) talk = FALSE;

if (!xtime && old) {
if (talk)
You_feel("less %s now.",
Expand All @@ -76,6 +78,8 @@ boolean talk;
{
long old = HStun;

if (Unaware) talk = FALSE;

if (!xtime && old) {
if (talk)
You_feel("%s now.",
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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 */
Expand All @@ -179,6 +195,8 @@ boolean talk;
{
long old = Vomiting;

if (Unaware) talk = FALSE;

if(!xtime && old)
if(talk) You_feel("much less nauseated now.");

Expand All @@ -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) {
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 */
Expand Down

0 comments on commit 06e9fa9

Please sign in to comment.