From: nethack.rankin Date: Sat, 19 Aug 2006 05:29:16 +0000 (+0000) Subject: fix #H177 - mimicking gold while hallucinating (trunk only) X-Git-Tag: MOVE2GIT~929 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8076947dd94038a1c29796205551194c664cc29;p=nethack fix #H177 - mimicking gold while hallucinating (trunk only) From a bug report, having hallucination time out while mimicking an orange (instead of gold, after eating a mimic corpse), you'd still get the hallucinatory end-of-mimicking message about not wanting to be peeled. If hallucination state is toggled, update the pending message and change the hero's appearance. In practice, only the orange-to-gold case can occur. Anything which might trigger gold-to-orange will have terminated the hero's mimickery befort that happens. --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index fbf416760..109a704c8 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -156,6 +156,7 @@ pushing a boulder onto a level teleporter trap could issue repeat messages 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 Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 40fd60b95..9ada04400 100644 --- a/include/extern.h +++ b/include/extern.h @@ -567,6 +567,7 @@ E int NDECL(eatfood); E int NDECL(opentin); E int NDECL(unfaint); #endif +E void NDECL(eatmupdate); E boolean FDECL(is_edible, (struct obj *)); E void NDECL(init_uhunger); E int NDECL(Hear_again); diff --git a/src/eat.c b/src/eat.c index 3a6f20753..564f2f870 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)eat.c 3.5 2006/06/25 */ +/* SCCS Id: @(#)eat.c 3.5 2006/08/18 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -163,6 +163,44 @@ eatmdone(VOID_ARGS) /* called after mimicing is over */ return 0; } +/* called when hallucination is toggled */ +void +eatmupdate() +{ + const char *altmsg = 0; + int altapp = 0; /* lint suppression */ + + if (!eatmbuf || nomovemsg != eatmbuf) return; + + if (youmonst.m_ap_type == M_AP_OBJECT && + youmonst.mappearance == ORANGE && + !Hallucination) { + /* revert from hallucinatory to "normal" mimicking */ + altmsg = "You now prefer mimicking yourself."; + altapp = GOLD_PIECE; + } else if (youmonst.m_ap_type == M_AP_OBJECT && + youmonst.mappearance == GOLD_PIECE && + Hallucination) { + /* won't happen; anything which might make immobilized + hero begin hallucinating (black light attack, theft + of Grayswandir) will terminate the mimickery first */ + altmsg = "Your rind escaped intact."; + altapp = ORANGE; + } + + if (altmsg) { + /* replace end-of-mimicking message */ + if (strlen(altmsg) > strlen(eatmbuf)) { + free((genericptr_t) eatmbuf); + eatmbuf = (char *) alloc(strlen(altmsg) + 1); + } + nomovemsg = strcpy(eatmbuf, altmsg); + /* update current image */ + youmonst.mappearance = altapp; + newsym(u.ux, u.uy); + } +} + /* ``[the(] singular(food, xname) [)]'' */ STATIC_OVL const char * food_xname(food, the_pfx) diff --git a/src/potion.c b/src/potion.c index 4f3c55281..727c38a98 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)potion.c 3.5 2006/06/21 */ +/* SCCS Id: @(#)potion.c 3.5 2006/08/18 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -315,6 +315,10 @@ long mask; /* nonzero if resistance status should change by mask */ } if (changed) { + /* in case we're mimicking an orange (hallucinatory form + of mimicking gold) update the mimicking's-over message */ + if (!Hallucination) eatmupdate(); + if (u.uswallow) { swallowed(0); /* redraw swallow display */ } else {