diff --git a/include/decl.h b/include/decl.h index 9989a93dc..0a5e374f7 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1257,6 +1257,7 @@ struct instance_globals { /* uhitm.c */ boolean override_confirmation; /* Used to flag attacks caused by * Stormbringer's maliciousness. */ + short corpsenm_digested; /* monster type being digested, set by gulpum */ /* vision.c */ seenV **viz_array; /* used in cansee() and couldsee() macros */ diff --git a/include/extern.h b/include/extern.h index 2c96fc639..68adedd8e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -775,6 +775,7 @@ extern void set_tin_variety(struct obj *, int); extern int tin_variety_txt(char *, int *); extern void tin_details(struct obj *, int, char *); extern boolean Popeye(int); +extern int Finish_digestion(void); /* ### end.c ### */ diff --git a/src/decl.c b/src/decl.c index e2384a0da..40e04ec2e 100644 --- a/src/decl.c +++ b/src/decl.c @@ -674,6 +674,7 @@ const struct instance_globals g_init = { /* uhitm.c */ FALSE, /* override_confirmation */ + NON_PM, /* corpsenm_digested */ /* vision.c */ UNDEFINED_PTR, /* viz_array */ diff --git a/src/eat.c b/src/eat.c index c6f3f9a97..1ebf42014 100644 --- a/src/eat.c +++ b/src/eat.c @@ -3791,4 +3791,16 @@ Popeye(int threat) return FALSE; } +/* the hero has swallowed a monster whole as a purple worm or similar, and has + finished digesting its corpse (called via g.afternmv) */ +int +Finish_digestion(void) +{ + if (g.corpsenm_digested != NON_PM) { + cpostfx(g.corpsenm_digested); + g.corpsenm_digested = NON_PM; + } + return 0; +} + /*eat.c*/ diff --git a/src/uhitm.c b/src/uhitm.c index a267a43c7..c2fbd396d 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -4462,8 +4462,9 @@ gulpum(struct monst *mdef, struct attack *mattk) && !(g.mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) { /* nutrition only if there can be a corpse */ u.uhunger += (pd->cnutrit + 1) / 2; - } else + } else { tmp = 0; + } Sprintf(msgbuf, "You totally digest %s.", mon_nam(mdef)); if (tmp != 0) { /* setting afternmv = end_engulf is tempting, @@ -4477,6 +4478,9 @@ gulpum(struct monst *mdef, struct attack *mattk) nomul(-tmp); g.multi_reason = "digesting something"; g.nomovemsg = msgbuf; + /* possible intrinsic once totally digested */ + g.corpsenm_digested = monsndx(pd); + g.afternmv = Finish_digestion; } else pline1(msgbuf); if (pd == &mons[PM_GREEN_SLIME]) {