Skip to content

Commit 382f1ec

Browse files
authored
Merge pull request #177 from entrez/fix_mon_zombie_makers
Another crack at the zombie-making issue
2 parents 53ddb0b + 284549c commit 382f1ec

File tree

5 files changed

+35
-28
lines changed

5 files changed

+35
-28
lines changed

include/extern.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ E int FDECL(cmap_to_type, (int));
15271527

15281528
E void NDECL(mon_sanity_check);
15291529
E int FDECL(m_poisongas_ok, (struct monst *));
1530-
E boolean FDECL(zombie_maker, (struct permonst *));
1530+
E boolean FDECL(zombie_maker, (struct monst *));
15311531
E int FDECL(zombie_form, (struct permonst *));
15321532
E void FDECL(become_flayer, (struct monst *));
15331533
E int FDECL(undead_to_corpse, (int));

include/hack.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,11 @@ enum explosion_types {
447447

448448
/* flags for xkilled() [note: meaning of first bit used to be reversed,
449449
1 to give message and 0 to suppress] */
450-
#define XKILL_GIVEMSG 0
451-
#define XKILL_NOMSG 1
452-
#define XKILL_NOCORPSE 2
453-
#define XKILL_NOCONDUCT 4
450+
#define XKILL_GIVEMSG 0x0
451+
#define XKILL_NOMSG 0x1
452+
#define XKILL_NOCORPSE 0x2
453+
#define XKILL_NOCONDUCT 0x4
454+
#define XKILL_INDIRECT 0x8 /* from exploding summoned sphere */
454455

455456
/* pline_flags; mask values for custompline()'s first argument */
456457
/* #define PLINE_ORDINARY 0 */

src/end.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ int how;
640640
u.ugrave_arise = PM_WRAITH;
641641
else if (mptr->mlet == S_MUMMY && urace.mummynum != NON_PM)
642642
u.ugrave_arise = urace.mummynum;
643-
else if (zombie_maker(mptr) && urace.zombienum != NON_PM)
643+
else if (zombie_maker(mtmp) && urace.zombienum != NON_PM)
644644
u.ugrave_arise = urace.zombienum;
645645
/* Vampire Mages can produce more of their kind if
646646
conditions are just right */

src/mhitm.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -2640,6 +2640,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
26402640
#undef oresist_disintegration
26412641

26422642
mdef->mhp = 0;
2643+
zombify = FALSE;
26432644
if (magr->uexp)
26442645
mon_xkilled(mdef, (char *) 0, -AD_RBRE);
26452646
else
@@ -2722,7 +2723,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
27222723
mdef->mhp = 0;
27232724
}
27242725

2725-
zombify = !mwep && zombie_maker(r_data(magr))
2726+
zombify = !mwep && zombie_maker(magr)
27262727
&& can_become_zombie(r_data(mdef))
27272728
&& ((mattk->aatyp == AT_TUCH
27282729
|| mattk->aatyp == AT_CLAW
@@ -3502,6 +3503,7 @@ struct obj *mwep;
35023503

35033504
assess_dmg:
35043505
if (damage_mon(magr, tmp, (int) mdattk[i].adtyp)) {
3506+
zombify = FALSE;
35053507
if (mdef->uexp)
35063508
mon_xkilled(magr, "", (int) mdattk[i].adtyp);
35073509
else

src/mon.c

+25-21
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,13 @@ struct monst *mtmp;
230230
/* Return TRUE if this monster is capable of converting other monsters into
231231
* zombies. */
232232
boolean
233-
zombie_maker(pm)
234-
struct permonst * pm;
233+
zombie_maker(mon)
234+
struct monst *mon;
235235
{
236-
switch(pm->mlet) {
237-
case S_ZOMBIE:
238-
/* Z-class monsters that aren't actually zombies go here */
239-
return is_zombie(pm);
240-
}
241-
242-
if (!Upolyd && Race_if(PM_DRAUGR))
243-
return TRUE;
244-
245-
return FALSE;
236+
/* NB: right now, this is literally just a wrapper around racial_zombie,
237+
* but maybe in the future there will be more complicated rules or
238+
* exceptions about when zombies will be created -- esp. by the hero */
239+
return racial_zombie(mon);
246240
}
247241

248242
/* From xNetHack: return the monster index of the zombie monster which this monster could be
@@ -761,12 +755,12 @@ unsigned corpseflags;
761755
return (struct obj *) 0;
762756
} else {
763757
corpstatflags |= CORPSTAT_INIT;
764-
if racial_zombie(mtmp)
758+
if (racial_zombie(mtmp))
765759
corpstatflags |= CORPSTAT_ZOMBIE;
766760
/* preserve the unique traits of some creatures */
767761
obj = mkcorpstat(CORPSE, KEEPTRAITS(mtmp) ? mtmp : 0,
768762
mdat, x, y, corpstatflags);
769-
if racial_zombie(mtmp)
763+
if (racial_zombie(mtmp))
770764
obj->age -= 100;
771765
if (burythem) {
772766
boolean dealloc;
@@ -4001,9 +3995,9 @@ int how;
40013995
disintegested = (how == AD_DGST || how == -AD_RBRE
40023996
|| how == AD_WTHR || how == AD_DISN);
40033997
if (disintegested)
4004-
xkilled(mdef, XKILL_NOCORPSE);
3998+
xkilled(mdef, XKILL_NOMSG | XKILL_NOCORPSE | XKILL_INDIRECT);
40053999
else
4006-
xkilled(mdef, XKILL_NOMSG);
4000+
xkilled(mdef, XKILL_NOMSG | XKILL_INDIRECT);
40074001

40084002
if (be_sad && DEADMONSTER(mdef))
40094003
You("have a sad feeling for a moment, then it passes.");
@@ -4051,7 +4045,9 @@ struct monst *mtmp;
40514045
void
40524046
xkilled(mtmp, xkill_flags)
40534047
struct monst *mtmp;
4054-
int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
4048+
int xkill_flags; /* XKILL_GIVEMSG, XKILL_NOMSG, XKILL_NOCORPSE,
4049+
* XKILL_NOCONDUCT (maintain pacificst),
4050+
* or XKILL_INDIRECT (mtmp killed by summoned sphere) */
40554051
{
40564052
int tmp, mndx, x = mtmp->mx, y = mtmp->my;
40574053
struct monst museum = zeromonst;
@@ -4062,7 +4058,8 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
40624058
burycorpse = FALSE,
40634059
nomsg = (xkill_flags & XKILL_NOMSG) != 0,
40644060
nocorpse = (xkill_flags & XKILL_NOCORPSE) != 0,
4065-
noconduct = (xkill_flags & XKILL_NOCONDUCT) != 0;
4061+
noconduct = (xkill_flags & XKILL_NOCONDUCT) != 0,
4062+
indirect = (xkill_flags & XKILL_INDIRECT) != 0;
40664063

40674064
mtmp->mhp = 0; /* caller will usually have already done this */
40684065
if (!noconduct) /* KMH, conduct */
@@ -4179,9 +4176,16 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
41794176
}
41804177
/* corpse--none if hero was inside the monster */
41814178
if (!wasinside && corpse_chance(mtmp, (struct monst *) 0, FALSE)) {
4182-
zombify = (!thrownobj && !stoned && !uwep
4183-
&& zombie_maker(youmonst.data)
4184-
&& zombie_form(r_data(mtmp)) != NON_PM);
4179+
/* for kills by monsters credited to the hero (e.g. summoned
4180+
* exploding spheres), zombify will have been set already in
4181+
* mhitm.c where the information about the particular attacking
4182+
* monster, etc, was available; for actual kills by the hero we
4183+
* can figure it out here */
4184+
if (!indirect) {
4185+
zombify = (!thrownobj && !stoned && !uwep
4186+
&& zombie_maker(&youmonst)
4187+
&& zombie_form(r_data(mtmp)) != NON_PM);
4188+
}
41854189
cadaver = make_corpse(mtmp, burycorpse ? CORPSTAT_BURIED
41864190
: CORPSTAT_NONE);
41874191
zombify = FALSE; /* reset */

0 commit comments

Comments
 (0)