]> granicus.if.org Git - nethack/commitdiff
fix #H177 - mimicking gold while hallucinating (trunk only)
authornethack.rankin <nethack.rankin>
Sat, 19 Aug 2006 05:29:16 +0000 (05:29 +0000)
committernethack.rankin <nethack.rankin>
Sat, 19 Aug 2006 05:29:16 +0000 (05:29 +0000)
     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.

doc/fixes35.0
include/extern.h
src/eat.c
src/potion.c

index fbf416760b48a0ff6d3b56a2b53e058270f57705..109a704c843a5df6b3639fbed9d454ece27af061 100644 (file)
@@ -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
index 40fd60b95218977fa57437b60d560f45078a6c7d..9ada0440087c0f31d6e4ca714fd783b49aad67c6 100644 (file)
@@ -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);
index 3a6f207532d77fe71724a593a1a6ee4e0e38eaaa..564f2f8703e94c9b136de42e930baa4ef42717e7 100644 (file)
--- 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)
index 4f3c5528134c4f2f0c801ccff14bde3812b257fe..727c38a9812717b2f61eb521c0824732562d8c52 100644 (file)
@@ -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 {