reimplement pull request #944 - grave contents

Pull request from entrez:  if bones left dead hero's corpse on top
of a new grave, don't find a corpse or summon a zombie when digging
the grave up.  It also removed the chance that a ghoul might be
summoned when engraving on a headstone, switching to zombie or mummy
instead.

Rather than adopting the pull request, this retains summoning a
ghoul via engraving and adds the possibly of doing so when kicking
a headstone.  Having a ghoul prowl around the grave is independent
of whether there is a corpse or zombie inside the grave.  To achieve
this, another flag in 'struct rm' is needed; the single bit for
'disturbed' isn't sufficient.  The bigger 'flags' field wasn't in
use for graves so commandeer that for new 'emptygrave'.  'disturbed'
still uses the 'horizontal' bit in order to have engraving and/or
kicking summon at most one ghoul.

Closes #944
This commit is contained in:
PatR
2023-01-23 11:38:15 -08:00
parent 3b5c53de86
commit c5aad9fe56
7 changed files with 77 additions and 37 deletions
+22 -4
View File
@@ -614,10 +614,10 @@ doengrave(void)
surface(u.ux, u.uy));
return ECMD_OK;
} else if (!levl[u.ux][u.uy].disturbed) {
You("disturb the undead!");
levl[u.ux][u.uy].disturbed = 1;
(void) makemon(&mons[PM_GHOUL], u.ux, u.uy, NO_MM_FLAGS);
exercise(A_WIS, FALSE);
/* disturb the grave: summon a ghoul, same as sometimes
happens when kicking; sets levl[ux][uy]->disturbed so
that it'll only happen once */
disturb_grave(u.ux, u.uy);
return ECMD_TIME;
}
}
@@ -1475,6 +1475,24 @@ make_grave(coordxy x, coordxy y, const char *str)
return;
}
/* called when kicking or engraving on a grave's headstone */
void
disturb_grave(coordxy x, coordxy y)
{
struct rm *lev = &levl[x][y];
if (!IS_GRAVE(lev->typ)) {
impossible("Disturing grave that isn't a grave? (%d)", lev->typ);
} else if (lev->disturbed) {
impossible("Disturing already disturbed grave?");
} else {
You("disturb the undead!");
lev->disturbed = 1;
(void) makemon(&mons[PM_GHOUL], x, y, NO_MM_FLAGS);
exercise(A_WIS, FALSE);
}
}
static const char blind_writing[][21] = {
{0x44, 0x66, 0x6d, 0x69, 0x62, 0x65, 0x22, 0x45, 0x7b, 0x71,
0x65, 0x6d, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },