From 150d01a9651e0f0c0f26aa8ecf40c553ce0d5ebe Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 6 Dec 2018 22:30:15 -0500 Subject: [PATCH] add MM_ASLEEP makemon() flag and honor it for fill_zoo --- doc/fixes36.2 | 1 + include/hack.h | 13 +++++++------ src/makemon.c | 23 +++++++++++++---------- src/mkroom.c | 2 +- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 7f0673f39..421792d38 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -251,6 +251,7 @@ hero hit by something that causes inventory items to be destroyed with loss of blasted by lightning and dropping hero onto fire trap); [3.6.1 fixed a similar problem with more obvious symptom, an "object lost" panic when the unholy water was wielded; the fix for that wasn't general enough] +add MM_ASLEEP makemon() flag and honor it when creating group for fill_zoo Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/include/hack.h b/include/hack.h index 5785b8590..beab7da8a 100644 --- a/include/hack.h +++ b/include/hack.h @@ -253,13 +253,14 @@ typedef struct sortloot_item Loot; #define MM_IGNOREWATER 0x00008 /* ignore water when positioning */ #define MM_ADJACENTOK \ 0x00010 /* it is acceptable to use adjacent coordinates */ -#define MM_ANGRY 0x00020 /* monster is created angry */ +#define MM_ANGRY 0x00020 /* monster is created angry */ #define MM_NONAME 0x00040 /* monster is not christened */ -#define MM_EGD 0x00100 /* add egd structure */ -#define MM_EPRI 0x00200 /* add epri structure */ -#define MM_ESHK 0x00400 /* add eshk structure */ -#define MM_EMIN 0x00800 /* add emin structure */ -#define MM_EDOG 0x01000 /* add edog structure */ +#define MM_EGD 0x00100 /* add egd structure */ +#define MM_EPRI 0x00200 /* add epri structure */ +#define MM_ESHK 0x00400 /* add eshk structure */ +#define MM_EMIN 0x00800 /* add emin structure */ +#define MM_EDOG 0x01000 /* add edog structure */ +#define MM_ASLEEP 0x02000 /* monsters should be generated asleep */ /* flags for make_corpse() and mkcorpstat() */ #define CORPSTAT_NONE 0x00 diff --git a/src/makemon.c b/src/makemon.c index 33cc7709c..e4d799e9b 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -18,15 +18,15 @@ STATIC_DCL boolean FDECL(uncommon, (int)); STATIC_DCL int FDECL(align_shift, (struct permonst *)); STATIC_DCL boolean FDECL(mk_gen_ok, (int, int, int)); STATIC_DCL boolean FDECL(wrong_elem_type, (struct permonst *)); -STATIC_DCL void FDECL(m_initgrp, (struct monst *, int, int, int)); +STATIC_DCL void FDECL(m_initgrp, (struct monst *, int, int, int, int)); STATIC_DCL void FDECL(m_initthrow, (struct monst *, int, int)); STATIC_DCL void FDECL(m_initweap, (struct monst *)); STATIC_DCL void FDECL(m_initinv, (struct monst *)); STATIC_DCL boolean FDECL(makemon_rnd_goodpos, (struct monst *, unsigned, coord *)); -#define m_initsgrp(mtmp, x, y) m_initgrp(mtmp, x, y, 3) -#define m_initlgrp(mtmp, x, y) m_initgrp(mtmp, x, y, 10) +#define m_initsgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 3, mmf) +#define m_initlgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 10, mmf) #define toostrong(monindx, lev) (mons[monindx].difficulty > lev) #define tooweak(monindx, lev) (mons[monindx].difficulty < lev) @@ -76,9 +76,9 @@ struct permonst *ptr; /* make a group just like mtmp */ STATIC_OVL void -m_initgrp(mtmp, x, y, n) -register struct monst *mtmp; -register int x, y, n; +m_initgrp(mtmp, x, y, n, mmflags) +struct monst *mtmp; +int x, y, n, mmflags; { coord mm; register int cnt = rnd(n); @@ -131,6 +131,8 @@ register int x, y, n; if (enexto(&mm, mm.x, mm.y, mtmp->data)) { mon = makemon(mtmp->data, mm.x, mm.y, NO_MM_FLAGS); if (mon) { + if (mmflags & MM_ASLEEP) + mon->msleeping = 1; mon->mpeaceful = FALSE; mon->mavenge = 0; set_malign(mon); @@ -1193,7 +1195,8 @@ int mmflags; newemin(mtmp); if (mmflags & MM_EDOG) newedog(mtmp); - + if (mmflags & MM_ASLEEP) + mtmp->msleeping = 1; mtmp->nmon = fmon; fmon = mtmp; mtmp->m_id = context.ident++; @@ -1366,12 +1369,12 @@ int mmflags; set_malign(mtmp); /* having finished peaceful changes */ if (anymon) { if ((ptr->geno & G_SGROUP) && rn2(2)) { - m_initsgrp(mtmp, mtmp->mx, mtmp->my); + m_initsgrp(mtmp, mtmp->mx, mtmp->my, mmflags); } else if (ptr->geno & G_LGROUP) { if (rn2(3)) - m_initlgrp(mtmp, mtmp->mx, mtmp->my); + m_initlgrp(mtmp, mtmp->mx, mtmp->my, mmflags); else - m_initsgrp(mtmp, mtmp->mx, mtmp->my); + m_initsgrp(mtmp, mtmp->mx, mtmp->my, mmflags); } } diff --git a/src/mkroom.c b/src/mkroom.c index 15cffdc7f..d0995c7f1 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -341,7 +341,7 @@ struct mkroom *sroom; : (type == ANTHOLE) ? antholemon() : (struct permonst *) 0, - sx, sy, NO_MM_FLAGS); + sx, sy, MM_ASLEEP); if (mon) { mon->msleeping = 1; if (type == COURT && mon->mpeaceful) { -- 2.40.0