diff --git a/src/objnam.c b/src/objnam.c index be991fba3..a74786d13 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1421,9 +1421,9 @@ corpse_xname( /* avoid "aligned priest"; it just exposes internal details */ mnam = "priest"; } else { - int cspe = (otmp->spe & CORPSTAT_GENDER), - mgend = (cspe == CORPSTAT_FEMALE) ? FEMALE - : (cspe == CORPSTAT_MALE) ? MALE + int cgend = (otmp->spe & CORPSTAT_GENDER), + mgend = (cgend == CORPSTAT_FEMALE) ? FEMALE + : (cgend == CORPSTAT_MALE) ? MALE : NEUTRAL; mnam = pmname(&mons[omndx], mgend); diff --git a/src/trap.c b/src/trap.c index 18bd505e2..a859fef2e 100644 --- a/src/trap.c +++ b/src/trap.c @@ -597,6 +597,8 @@ animate_statue( int cause, int *fail_reason) { + static const char + historic_statue_is_gone[] = "that the historic statue is now gone"; int mnum = statue->corpsenm; struct permonst *mptr = &mons[mnum]; struct monst *mon = 0, *shkp; @@ -607,8 +609,6 @@ animate_statue( golem_xform = FALSE, use_saved_traits; const char *comes_to_life; char statuename[BUFSZ], tmpbuf[BUFSZ]; - static const char historic_statue_is_gone[] = - "that the historic statue is now gone"; if (cant_revive(&mnum, TRUE, statue)) { /* mnum has changed; we won't be animating this statue as itself */ @@ -632,6 +632,11 @@ animate_statue( if (mon && mon->mtame && !mon->isminion) wary_dog(mon, TRUE); } else { + int sgend = (statue->spe & CORPSTAT_GENDER); + long mmflags = (NO_MINVENT + | ((sgend == CORPSTAT_MALE) ? MM_MALE : 0) + | ((sgend == CORPSTAT_FEMALE) ? MM_FEMALE : 0)); + /* statues of unique monsters from bones or wishing end up here (cant_revive() sets mnum to be doppelganger; mptr reflects the original form for use by newcham()) */ @@ -639,22 +644,17 @@ animate_statue( /* block quest guards from other roles */ || (mptr->msound == MS_GUARDIAN && quest_info(MS_GUARDIAN) != mnum)) { - mon = makemon(&mons[PM_DOPPELGANGER], x, y, - NO_MINVENT | MM_NOCOUNTBIRTH | MM_ADJACENTOK); + mmflags |= MM_NOCOUNTBIRTH | MM_ADJACENTOK; + mon = makemon(&mons[PM_DOPPELGANGER], x, y, mmflags); /* if hero has protection from shape changers, cham field will be NON_PM; otherwise, set form to match the statue */ if (mon && mon->cham >= LOW_PM) (void) newcham(mon, mptr, FALSE, FALSE); } else { - mon = makemon(mptr, x, y, (cause == ANIMATE_SPELL) - ? (NO_MINVENT | MM_ADJACENTOK) - : NO_MINVENT); + if (cause == ANIMATE_SPELL) + mmflags |= MM_ADJACENTOK; + mon = makemon(mptr, x, y, mmflags); } - /* a non-montraits() statue might specify gender */ - if ((statue->spe & CORPSTAT_MALE) != 0) - mon->female = 0; - else if ((statue->spe & CORPSTAT_FEMALE) != 0) - mon->female = 1; } if (!mon) { diff --git a/src/zap.c b/src/zap.c index c0e71db89..e78cb529f 100644 --- a/src/zap.c +++ b/src/zap.c @@ -757,7 +757,8 @@ revive(struct obj *corpse, boolean by_hero) coord xy; xchar x, y; boolean one_of; - int montype, container_nesting = 0; + long mmflags = NO_MINVENT | MM_NOWAIT; + int montype, cgend, container_nesting = 0; if (corpse->otyp != CORPSE) { impossible("Attempting to revive %s?", xname(corpse)); @@ -825,10 +826,17 @@ revive(struct obj *corpse, boolean by_hero) return (struct monst *) 0; } + /* applicable when montraits/corpse->oextra->omonst aren't used */ + cgend = (corpse->spe & CORPSTAT_GENDER); + if (cgend == CORPSTAT_MALE) + mmflags |= MM_MALE; + else if (cgend == CORPSTAT_FEMALE) + mmflags |= MM_FEMALE; + if (cant_revive(&montype, TRUE, corpse)) { /* make a zombie or doppelganger instead */ /* note: montype has changed; mptr keeps old value for newcham() */ - mtmp = makemon(&mons[montype], x, y, NO_MINVENT | MM_NOWAIT); + mtmp = makemon(&mons[montype], x, y, mmflags); if (mtmp) { /* skip ghost handling */ if (has_omid(corpse)) @@ -851,21 +859,11 @@ revive(struct obj *corpse, boolean by_hero) wary_dog(mtmp, TRUE); } else { /* make a new monster */ - mtmp = makemon(mptr, x, y, NO_MINVENT | MM_NOWAIT | MM_NOCOUNTBIRTH); + mtmp = makemon(mptr, x, y, mmflags | MM_NOCOUNTBIRTH); } if (!mtmp) return (struct monst *) 0; - /* if we didn't use montraits, corpse might specify mon's gender */ - if (!has_omonst(corpse)) { - int cspe = (corpse->spe & CORPSTAT_GENDER); - - if (cspe == CORPSTAT_MALE) - mtmp->female = 0; - else if (cspe == CORPSTAT_FEMALE) - mtmp->female = 1; - } - /* hiders shouldn't already be re-hidden when they revive */ if (mtmp->mundetected) { mtmp->mundetected = 0;