conflicting delayed killers
Introduce a new set of functions to manage delayed killers in the trunk, used in addressing the various reports of delayed killer confusion. Since existing delayed killers are related to player properties, the delayed killers are keyed by uprop indexes. I did this to avoid adding yet another set of similar identifiers. - the new delayed_killer() is used for stoning, sliming, sickness, and delayed self-genocide while polymorphed. Some other timed events don't use it (and didn't use the old delayed_killer variable) because they use a fixed message when the timeout occurs. - A new data structure, struct kinfo, is used to track both delayed and immediate killers. This encapsulates all the info involved with identifying a killer. The structure contains a buffer, which subsumes the old killer_buf and several other buffers that didn't/couldn't use killer_buf. - the killer list is saved and restored as part of the game state. - the special case of usick_cause was removed and a delayed killer list entry is now used in its place - common code dealing with (un)sliming is moved to a new make_slimed function - attempted to update all make dependencies for new end.c -> lev.h dependency, sorry if I messed any up
This commit is contained in:
@@ -360,8 +360,8 @@ moveloop()
|
||||
else if (!u.uinvulnerable) {
|
||||
u.utrap -= 1<<8;
|
||||
if(u.utrap < 1<<8) {
|
||||
killer_format = KILLED_BY;
|
||||
killer = "molten lava";
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, "molten lava");
|
||||
You("sink below the surface and die.");
|
||||
done(DISSOLVED);
|
||||
} else if(didmove && !u.umoved) {
|
||||
|
||||
@@ -1210,7 +1210,7 @@ arti_invoke(obj)
|
||||
else u.uhp += healamt;
|
||||
}
|
||||
if(Sick) make_sick(0L,(char *)0,FALSE,SICK_ALL);
|
||||
if(Slimed) Slimed = 0L;
|
||||
if(Slimed) make_slimed(0L, (char *)0);
|
||||
if (Blinded > creamed) make_blinded(creamed, FALSE);
|
||||
context.botl = 1;
|
||||
break;
|
||||
|
||||
@@ -975,7 +975,7 @@ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */
|
||||
/* If you die while dismounting, u.usteed is still set. Since several
|
||||
* places in the done() sequence depend on u.usteed, just detect this
|
||||
* special case. */
|
||||
if (u.usteed && (final < 2 || strcmp(killer, "riding accident"))) {
|
||||
if (u.usteed && (final < 2 || strcmp(killer.name, "riding accident"))) {
|
||||
Sprintf(buf, "riding %s", y_monnam(u.usteed));
|
||||
you_are(buf);
|
||||
}
|
||||
|
||||
@@ -370,18 +370,18 @@ int dest, how;
|
||||
{
|
||||
if (is_u(etmp)) {
|
||||
if (how == DROWNING) {
|
||||
killer = 0; /* drown() sets its own killer */
|
||||
killer.name[0] = 0; /* drown() sets its own killer */
|
||||
(void) drown();
|
||||
} else if (how == BURNING) {
|
||||
killer = 0; /* lava_effects() sets its own killer */
|
||||
killer.name[0] = 0; /* lava_effects() sets own killer */
|
||||
(void) lava_effects();
|
||||
} else {
|
||||
coord xy;
|
||||
|
||||
/* use more specific killer if specified */
|
||||
if (!killer) {
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "falling drawbridge";
|
||||
if (!killer.name[0]) {
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "falling drawbridge");
|
||||
}
|
||||
done(how);
|
||||
/* So, you didn't die */
|
||||
@@ -399,7 +399,7 @@ int dest, how;
|
||||
/* we might have crawled out of the moat to survive */
|
||||
etmp->ex = u.ux, etmp->ey = u.uy;
|
||||
} else {
|
||||
killer = 0;
|
||||
killer.name[0] = 0;
|
||||
/* fake "digested to death" damage-type suppresses corpse */
|
||||
#define mk_message(dest) ((dest & 1) ? "" : (char *)0)
|
||||
#define mk_corpse(dest) ((dest & 2) ? AD_DGST : AD_PHYS)
|
||||
@@ -671,8 +671,8 @@ struct entity *etmp;
|
||||
E_phrase(etmp, "disappear"));
|
||||
}
|
||||
if (!e_survives_at(etmp, etmp->ex, etmp->ey)) {
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "closing drawbridge";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "closing drawbridge");
|
||||
e_died(etmp, 0, CRUSHING); /* no message */
|
||||
return;
|
||||
}
|
||||
@@ -710,8 +710,8 @@ struct entity *etmp;
|
||||
E_phrase(etmp, "fall"),
|
||||
lava ? "lava" : "moat");
|
||||
}
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer = "fell from a drawbridge";
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
Strcpy(killer.name, "fell from a drawbridge");
|
||||
e_died(etmp, e_inview ? 3 : 2, /* CRUSHING is arbitrary */
|
||||
(is_pool(etmp->ex, etmp->ey)) ? DROWNING :
|
||||
(is_lava(etmp->ex, etmp->ey)) ? BURNING :
|
||||
@@ -880,8 +880,8 @@ int x,y;
|
||||
if (e_inview)
|
||||
pline("%s blown apart by flying debris.",
|
||||
E_phrase(etmp2, "are"));
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "exploding drawbridge";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "exploding drawbridge");
|
||||
e_died(etmp2, e_inview? 3 : 2, CRUSHING); /*no corpse*/
|
||||
} /* nothing which is vulnerable can survive this */
|
||||
}
|
||||
@@ -909,8 +909,8 @@ int x,y;
|
||||
E_phrase(etmp1, "die"));
|
||||
#endif
|
||||
}
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "collapsing drawbridge";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "collapsing drawbridge");
|
||||
e_died(etmp1, e_inview? 3 : 2, CRUSHING); /*no corpse*/
|
||||
if(lev1->typ == MOAT) do_entity(etmp1);
|
||||
}
|
||||
|
||||
@@ -45,15 +45,12 @@ struct q_score quest_status = DUMMY;
|
||||
|
||||
NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY;
|
||||
NEARDATA int doorindex = 0;
|
||||
|
||||
NEARDATA char *save_cm = 0;
|
||||
NEARDATA int killer_format = 0;
|
||||
const char *killer = 0;
|
||||
const char *delayed_killer = 0;
|
||||
|
||||
NEARDATA struct kinfo killer = DUMMY;
|
||||
#ifdef GOLDOBJ
|
||||
NEARDATA long done_money = 0;
|
||||
#endif
|
||||
char killer_buf[BUFSZ] = DUMMY;
|
||||
const char *nomovemsg = 0;
|
||||
const char nul[40] = DUMMY; /* contains zeros */
|
||||
NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */
|
||||
|
||||
2
src/do.c
2
src/do.c
@@ -1072,7 +1072,7 @@ boolean at_stairs, falling, portal;
|
||||
if (fd < 0) {
|
||||
pline("%s", whynot);
|
||||
pline("Probably someone removed it.");
|
||||
killer = whynot;
|
||||
Strcpy(killer.name, whynot);
|
||||
done(TRICKED);
|
||||
/* we'll reach here if running in wizard mode */
|
||||
error("Cannot continue this game.");
|
||||
|
||||
@@ -537,10 +537,7 @@ Amulet_on()
|
||||
case FAKE_AMULET_OF_YENDOR:
|
||||
break;
|
||||
case AMULET_OF_UNCHANGING:
|
||||
if (Slimed) {
|
||||
Slimed = 0;
|
||||
context.botl = 1;
|
||||
}
|
||||
if (Slimed) make_slimed(0L, (char *)0);
|
||||
break;
|
||||
case AMULET_OF_CHANGE:
|
||||
{
|
||||
|
||||
@@ -426,17 +426,14 @@ xchar x, y;
|
||||
|
||||
if(kickobj->otyp == CORPSE && touch_petrifies(&mons[kickobj->corpsenm])
|
||||
&& !Stone_resistance && !uarmf) {
|
||||
char kbuf[BUFSZ];
|
||||
|
||||
You("kick the %s with your bare %s.",
|
||||
corpse_xname(kickobj, TRUE), makeplural(body_part(FOOT)));
|
||||
if (!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
|
||||
You("turn to stone...");
|
||||
killer_format = KILLED_BY;
|
||||
killer.format = KILLED_BY;
|
||||
/* KMH -- otmp should be kickobj */
|
||||
Sprintf(kbuf, "kicking %s without boots",
|
||||
Sprintf(killer.name, "kicking %s without boots",
|
||||
an(corpse_xname(kickobj, TRUE)));
|
||||
killer = kbuf;
|
||||
done(STONING);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,8 +96,8 @@ int shotlimit;
|
||||
touch_petrifies(&mons[obj->corpsenm]))) {
|
||||
You("throw the %s corpse with your bare %s.",
|
||||
mons[obj->corpsenm].mname, body_part(HAND));
|
||||
Sprintf(killer_buf, "%s corpse", an(mons[obj->corpsenm].mname));
|
||||
instapetrify(killer_buf);
|
||||
Sprintf(killer.name, "%s corpse", an(mons[obj->corpsenm].mname));
|
||||
instapetrify(killer.name);
|
||||
}
|
||||
if (welded(obj)) {
|
||||
weldmsg(obj);
|
||||
@@ -801,8 +801,8 @@ boolean hitsroof;
|
||||
if (!Stone_resistance &&
|
||||
!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
|
||||
petrify:
|
||||
killer_format = KILLED_BY;
|
||||
killer = "elementary physics"; /* "what goes up..." */
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, "elementary physics"); /* "what goes up..." */
|
||||
You("turn to stone.");
|
||||
if (obj) dropy(obj); /* bypass most of hitfloor() */
|
||||
done(STONING);
|
||||
|
||||
52
src/eat.c
52
src/eat.c
@@ -208,7 +208,7 @@ choke(food) /* To a full belly all food is bad. (It.) */
|
||||
nomovemsg = 0;
|
||||
vomit();
|
||||
} else {
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer.format = KILLED_BY_AN;
|
||||
/*
|
||||
* Note all "killer"s below read "Choked on %s" on the
|
||||
* high score list & tombstone. So plan accordingly.
|
||||
@@ -216,19 +216,19 @@ choke(food) /* To a full belly all food is bad. (It.) */
|
||||
if(food) {
|
||||
You("choke over your %s.", foodword(food));
|
||||
if (food->oclass == COIN_CLASS) {
|
||||
killer = "a very rich meal";
|
||||
Strcpy(killer.name, "a very rich meal");
|
||||
} else {
|
||||
killer = food_xname(food, FALSE);
|
||||
Strcpy(killer.name, food_xname(food, FALSE));
|
||||
if (food->otyp == CORPSE &&
|
||||
(mons[food->corpsenm].geno & G_UNIQ)) {
|
||||
if (!type_is_pname(&mons[food->corpsenm]))
|
||||
killer = the(killer);
|
||||
killer_format = KILLED_BY;
|
||||
Strcpy(killer.name, the(killer.name));
|
||||
killer.format = KILLED_BY;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
You("choke over it.");
|
||||
killer = "quick snack";
|
||||
Strcpy(killer.name, "quick snack");
|
||||
}
|
||||
You("die...");
|
||||
done(CHOKING);
|
||||
@@ -425,9 +425,8 @@ register int pm;
|
||||
if (touch_petrifies(&mons[pm]) || pm == PM_MEDUSA) {
|
||||
if (!Stone_resistance &&
|
||||
!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
|
||||
Sprintf(killer_buf, "tasting %s meat", mons[pm].mname);
|
||||
killer_format = KILLED_BY;
|
||||
killer = killer_buf;
|
||||
Sprintf(killer.name, "tasting %s meat", mons[pm].mname);
|
||||
killer.format = KILLED_BY;
|
||||
You("turn to stone.");
|
||||
done(STONING);
|
||||
if (context.victual.piece)
|
||||
@@ -454,12 +453,11 @@ register int pm;
|
||||
case PM_DEATH:
|
||||
case PM_PESTILENCE:
|
||||
case PM_FAMINE:
|
||||
{ char buf[BUFSZ];
|
||||
{
|
||||
pline("Eating that is instantly fatal.");
|
||||
Sprintf(buf, "unwisely ate the body of %s",
|
||||
Sprintf(killer.name, "unwisely ate the body of %s",
|
||||
mons[pm].mname);
|
||||
killer = buf;
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
done(DIED);
|
||||
/* It so happens that since we know these monsters */
|
||||
/* cannot appear in tins, context.victual.piece will always */
|
||||
@@ -474,8 +472,8 @@ register int pm;
|
||||
if (!Slimed && !Unchanging && !flaming(youmonst.data) &&
|
||||
youmonst.data != &mons[PM_GREEN_SLIME]) {
|
||||
You("don't feel very well.");
|
||||
Slimed = 10L;
|
||||
context.botl = 1;
|
||||
make_slimed(10L, (char*) 0);
|
||||
delayed_killer(SLIMED, KILLED_BY_AN, nul);
|
||||
}
|
||||
/* Fall through */
|
||||
default:
|
||||
@@ -489,7 +487,7 @@ void
|
||||
fix_petrification()
|
||||
{
|
||||
Stoned = 0;
|
||||
delayed_killer = 0;
|
||||
dealloc_killer(find_delayed_killer(STONED));
|
||||
if (Hallucination)
|
||||
pline("What a pity - you just ruined a future piece of %sart!",
|
||||
ACURR(A_CHA) > 15 ? "fine " : "");
|
||||
@@ -1668,8 +1666,8 @@ register struct obj *otmp;
|
||||
if(!rn2(17)) u.uhpmax++;
|
||||
u.uhp = u.uhpmax;
|
||||
} else if (u.uhp <= 0) {
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "rotten lump of royal jelly";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "rotten lump of royal jelly");
|
||||
done(POISONING);
|
||||
}
|
||||
}
|
||||
@@ -1679,10 +1677,12 @@ register struct obj *otmp;
|
||||
if (touch_petrifies(&mons[otmp->corpsenm])) {
|
||||
if (!Stone_resistance &&
|
||||
!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
|
||||
if (!Stoned) Stoned = 5;
|
||||
killer_format = KILLED_BY_AN;
|
||||
Sprintf(killer_buf, "%s egg", mons[otmp->corpsenm].mname);
|
||||
delayed_killer = killer_buf;
|
||||
if (!Stoned) {
|
||||
Stoned = 5;
|
||||
Sprintf(killer.name,
|
||||
"%s egg", mons[otmp->corpsenm].mname);
|
||||
delayed_killer(STONED, KILLED_BY_AN, killer.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2294,8 +2294,8 @@ boolean incr;
|
||||
context.botl = 1;
|
||||
bot();
|
||||
You("die from starvation.");
|
||||
killer_format = KILLED_BY;
|
||||
killer = "starvation";
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, "starvation");
|
||||
done(STARVING);
|
||||
/* if we return, we lifesaved, and that calls newuhs */
|
||||
return;
|
||||
@@ -2346,8 +2346,8 @@ boolean incr;
|
||||
bot();
|
||||
if ((Upolyd ? u.mh : u.uhp) < 1) {
|
||||
You("die from hunger and exhaustion.");
|
||||
killer_format = KILLED_BY;
|
||||
killer = "exhaustion";
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, "exhaustion");
|
||||
done(STARVING);
|
||||
return;
|
||||
}
|
||||
|
||||
166
src/end.c
166
src/end.c
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "hack.h"
|
||||
#include "eshk.h"
|
||||
#include "lev.h"
|
||||
#ifndef NO_SIGNAL
|
||||
#include <signal.h>
|
||||
#endif
|
||||
@@ -188,18 +189,18 @@ register struct monst *mtmp;
|
||||
You("die...");
|
||||
mark_synch(); /* flush buffered screen output */
|
||||
buf[0] = '\0';
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer.format = KILLED_BY_AN;
|
||||
/* "killed by the high priest of Crom" is okay, "killed by the high
|
||||
priest" alone isn't */
|
||||
if ((mtmp->data->geno & G_UNIQ) != 0 && !(mtmp->data == &mons[PM_HIGH_PRIEST] && !mtmp->ispriest)) {
|
||||
if (!type_is_pname(mtmp->data))
|
||||
Strcat(buf, "the ");
|
||||
killer_format = KILLED_BY;
|
||||
killer.format = KILLED_BY;
|
||||
}
|
||||
/* _the_ <invisible> <distorted> ghost of Dudley */
|
||||
if (mtmp->data == &mons[PM_GHOST] && mtmp->mnamelth) {
|
||||
Strcat(buf, "the ");
|
||||
killer_format = KILLED_BY;
|
||||
killer.format = KILLED_BY;
|
||||
}
|
||||
if (mtmp->minvis)
|
||||
Strcat(buf, "invisible ");
|
||||
@@ -212,12 +213,11 @@ register struct monst *mtmp;
|
||||
} else if(mtmp->isshk) {
|
||||
Sprintf(eos(buf), "%s %s, the shopkeeper",
|
||||
(mtmp->female ? "Ms." : "Mr."), shkname(mtmp));
|
||||
killer_format = KILLED_BY;
|
||||
killer.format = KILLED_BY;
|
||||
} else if (mtmp->ispriest || mtmp->isminion) {
|
||||
/* m_monnam() suppresses "the" prefix plus "invisible", and
|
||||
it overrides the effect of Hallucination on priestname() */
|
||||
killer = m_monnam(mtmp);
|
||||
Strcat(buf, killer);
|
||||
Strcat(buf, m_monnam(mtmp));
|
||||
} else {
|
||||
Strcat(buf, mtmp->data->mname);
|
||||
if (mtmp->mnamelth)
|
||||
@@ -225,7 +225,7 @@ register struct monst *mtmp;
|
||||
}
|
||||
|
||||
if (multi) Strcat(buf, ", while helpless");
|
||||
killer = buf;
|
||||
Strcpy(killer.name, buf);
|
||||
if (mtmp->data->mlet == S_WRAITH)
|
||||
u.ugrave_arise = PM_WRAITH;
|
||||
else if (mtmp->data->mlet == S_MUMMY && urace.mummynum != NON_PM)
|
||||
@@ -534,16 +534,16 @@ done(how)
|
||||
int how;
|
||||
{
|
||||
boolean taken;
|
||||
char kilbuf[BUFSZ], pbuf[BUFSZ];
|
||||
char pbuf[BUFSZ];
|
||||
winid endwin = WIN_ERR;
|
||||
boolean bones_ok, have_windows = iflags.window_inited;
|
||||
struct obj *corpse = (struct obj *)0;
|
||||
long umoney;
|
||||
|
||||
if (how == TRICKED) {
|
||||
if (killer) {
|
||||
paniclog("trickery", killer);
|
||||
killer = 0;
|
||||
if (killer.name[0]) {
|
||||
paniclog("trickery", killer.name);
|
||||
killer.name[0] = 0;
|
||||
}
|
||||
#ifdef WIZARD
|
||||
if (wizard) {
|
||||
@@ -553,18 +553,15 @@ int how;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* kilbuf: used to copy killer in case it comes from something like
|
||||
* xname(), which would otherwise get overwritten when we call
|
||||
* xname() when listing possessions
|
||||
* pbuf: holds Sprintf'd output for raw_print and putstr
|
||||
/* pbuf: holds Sprintf'd output for raw_print and putstr
|
||||
*/
|
||||
if (how == ASCENDED || (!killer && how == GENOCIDED))
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
if (how == ASCENDED || (!killer.name[0] && how == GENOCIDED))
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
/* Avoid killed by "a" burning or "a" starvation */
|
||||
if (!killer && (how == STARVING || how == BURNING))
|
||||
killer_format = KILLED_BY;
|
||||
Strcpy(kilbuf, (!killer || how >= PANICKED ? deaths[how] : killer));
|
||||
killer = kilbuf;
|
||||
if (!killer.name[0] && (how == STARVING || how == BURNING))
|
||||
killer.format = KILLED_BY;
|
||||
if (!killer.name[0] || how >= PANICKED)
|
||||
Strcpy(killer.name, deaths[how]);
|
||||
|
||||
if (how < PANICKED) u.umortality++;
|
||||
if (Lifesaved && (how <= GENOCIDED)) {
|
||||
@@ -583,8 +580,8 @@ int how;
|
||||
if (how == GENOCIDED)
|
||||
pline("Unfortunately you are still genocided...");
|
||||
else {
|
||||
killer = 0;
|
||||
killer_format = 0;
|
||||
killer.name[0] = 0;
|
||||
killer.format = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -598,8 +595,8 @@ int how;
|
||||
(how == CHOKING) ? "choke" : "die");
|
||||
if(u.uhpmax <= 0) u.uhpmax = u.ulevel * 8; /* arbitrary */
|
||||
savelife(how);
|
||||
killer = 0;
|
||||
killer_format = 0;
|
||||
killer.name[0] = 0;
|
||||
killer.format = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -659,24 +656,24 @@ die:
|
||||
corpse = mk_named_object(CORPSE, &mons[mnum],
|
||||
u.ux, u.uy, plname);
|
||||
Sprintf(pbuf, "%s, %s%s", plname,
|
||||
killer_format == NO_KILLER_PREFIX ? "" :
|
||||
killer.format == NO_KILLER_PREFIX ? "" :
|
||||
killed_by_prefix[how],
|
||||
killer_format == KILLED_BY_AN ? an(killer) : killer);
|
||||
killer.format == KILLED_BY_AN ? an(killer.name) :
|
||||
killer.name);
|
||||
make_grave(u.ux, u.uy, pbuf);
|
||||
}
|
||||
}
|
||||
|
||||
if (how == QUIT) {
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
if (u.uhp < 1) {
|
||||
how = DIED;
|
||||
u.umortality++; /* skipped above when how==QUIT */
|
||||
/* note that killer is pointing at kilbuf */
|
||||
Strcpy(kilbuf, "quit while already on Charon's boat");
|
||||
}
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
if (u.uhp < 1) {
|
||||
how = DIED;
|
||||
u.umortality++; /* skipped above when how==QUIT */
|
||||
Strcpy(killer.name, "quit while already on Charon's boat");
|
||||
}
|
||||
}
|
||||
if (how == ESCAPED || how == PANICKED)
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
|
||||
if (how != PANICKED) {
|
||||
/* these affect score and/or bones, but avoid them during panic */
|
||||
@@ -755,15 +752,12 @@ die:
|
||||
} else
|
||||
done_stopprint = 1; /* just avoid any more output */
|
||||
|
||||
/* changing kilbuf really changes killer. we do it this way because
|
||||
killer is declared a (const char *)
|
||||
*/
|
||||
if (u.uhave.amulet) Strcat(kilbuf, " (with the Amulet)");
|
||||
if (u.uhave.amulet) Strcat(killer.name, " (with the Amulet)");
|
||||
else if (how == ESCAPED) {
|
||||
if (Is_astralevel(&u.uz)) /* offered Amulet to wrong deity */
|
||||
Strcat(kilbuf, " (in celestial disgrace)");
|
||||
Strcat(killer.name, " (in celestial disgrace)");
|
||||
else if (carrying(FAKE_AMULET_OF_YENDOR))
|
||||
Strcat(kilbuf, " (with a fake Amulet)");
|
||||
Strcat(killer.name, " (with a fake Amulet)");
|
||||
/* don't bother counting to see whether it should be plural */
|
||||
}
|
||||
|
||||
@@ -1100,4 +1094,94 @@ boolean ask;
|
||||
}
|
||||
}
|
||||
|
||||
/* set a delayed killer, ensure non-delayed killer is cleared out */
|
||||
void
|
||||
delayed_killer(id, format, killername)
|
||||
int id;
|
||||
int format;
|
||||
const char *killername;
|
||||
{
|
||||
struct kinfo *k = find_delayed_killer(id);
|
||||
|
||||
if (k == (struct kinfo*) 0) {
|
||||
/* no match, add a new delayed killer to the list */
|
||||
k = (struct kinfo*) alloc(sizeof(struct kinfo));
|
||||
k->id = id;
|
||||
k->next = killer.next;
|
||||
killer.next = k;
|
||||
}
|
||||
|
||||
k->format = format;
|
||||
Strcpy(k->name, killername ? killername : "");
|
||||
killer.name[0] = 0;
|
||||
}
|
||||
|
||||
struct kinfo*
|
||||
find_delayed_killer(id)
|
||||
int id;
|
||||
{
|
||||
struct kinfo* k;
|
||||
|
||||
for (k = killer.next; k != (struct kinfo*) 0; k = k->next) {
|
||||
if (k->id == id) break;
|
||||
}
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
void
|
||||
dealloc_killer(kptr)
|
||||
struct kinfo *kptr;
|
||||
{
|
||||
struct kinfo *prev = &killer, *k;
|
||||
|
||||
if (kptr == (struct kinfo *)0) return;
|
||||
for (k = killer.next; k != (struct kinfo*) 0; k = k->next) {
|
||||
if (k == kptr) break;
|
||||
prev = k;
|
||||
}
|
||||
|
||||
if (k == (struct kinfo*) 0) {
|
||||
impossible("dealloc_killer not on list");
|
||||
} else {
|
||||
prev->next = k->next;
|
||||
free((genericptr_t) k);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
save_killers(fd, mode)
|
||||
int fd;
|
||||
int mode;
|
||||
{
|
||||
struct kinfo *kptr;
|
||||
|
||||
if (perform_bwrite(mode)) {
|
||||
for (kptr = &killer; kptr != (struct kinfo*)0; kptr = kptr->next) {
|
||||
bwrite(fd, (genericptr_t)kptr, sizeof(struct kinfo));
|
||||
}
|
||||
}
|
||||
if (release_data(mode)) {
|
||||
while (killer.next) {
|
||||
kptr = killer.next->next;
|
||||
free((genericptr_t)killer.next);
|
||||
killer.next = kptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
restore_killers(fd)
|
||||
int fd;
|
||||
{
|
||||
struct kinfo *kptr;
|
||||
|
||||
for (kptr = &killer; kptr != (struct kinfo*)0; kptr = kptr->next) {
|
||||
mread(fd, (genericptr_t)kptr, sizeof(struct kinfo));
|
||||
if (kptr->next) {
|
||||
kptr->next = (struct kinfo*) alloc(sizeof(struct kinfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*end.c*/
|
||||
|
||||
@@ -132,9 +132,9 @@ const char *drainer; /* cause of death, if drain should be fatal */
|
||||
reset_rndmonst(NON_PM); /* new monster selection */
|
||||
} else {
|
||||
if (drainer) {
|
||||
killer_format = KILLED_BY;
|
||||
killer = drainer;
|
||||
done(DIED);
|
||||
killer.format = KILLED_BY;
|
||||
if (killer.name != drainer) Strcpy(killer.name, drainer);
|
||||
done(DIED);
|
||||
}
|
||||
/* no drainer or lifesaved */
|
||||
u.uexp = 0;
|
||||
|
||||
@@ -31,7 +31,7 @@ int expltype;
|
||||
boolean starting = 1;
|
||||
boolean visible, any_shield;
|
||||
int uhurt = 0; /* 0=unhurt, 1=items damaged, 2=you and items damaged */
|
||||
const char *str;
|
||||
const char *str = (const char *) 0;
|
||||
int idamres, idamnonres;
|
||||
struct monst *mtmp;
|
||||
uchar adtyp;
|
||||
@@ -53,8 +53,7 @@ int expltype;
|
||||
}
|
||||
|
||||
if (olet == MON_EXPLODE) {
|
||||
str = killer;
|
||||
killer = 0; /* set again later as needed */
|
||||
str = killer.name;
|
||||
adtyp = AD_PHYS;
|
||||
} else
|
||||
switch (abs(type) % 10) {
|
||||
@@ -338,22 +337,23 @@ int expltype;
|
||||
} else {
|
||||
if (olet == MON_EXPLODE) {
|
||||
/* killer handled by caller */
|
||||
if (str != killer_buf && !generic)
|
||||
Strcpy(killer_buf, str);
|
||||
killer_format = KILLED_BY_AN;
|
||||
if (generic)
|
||||
killer.name[0] = 0;
|
||||
else if (str != killer.name)
|
||||
Strcpy(killer.name, str);
|
||||
killer.format = KILLED_BY_AN;
|
||||
} else if (type >= 0 && olet != SCROLL_CLASS) {
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
Sprintf(killer_buf, "caught %sself in %s own %s",
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
Sprintf(killer.name, "caught %sself in %s own %s",
|
||||
uhim(), uhis(), str);
|
||||
} else if (!strncmpi(str,"tower of flame", 8) ||
|
||||
!strncmpi(str,"fireball", 8)) {
|
||||
killer_format = KILLED_BY_AN;
|
||||
Strcpy(killer_buf, str);
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, str);
|
||||
} else {
|
||||
killer_format = KILLED_BY;
|
||||
Strcpy(killer_buf, str);
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, str);
|
||||
}
|
||||
killer = killer_buf;
|
||||
/* Known BUG: BURNING suppresses corpse in bones data,
|
||||
but done does not handle killer reason correctly */
|
||||
done((adtyp == AD_FIRE) ? BURNING : DIED);
|
||||
|
||||
@@ -2099,8 +2099,9 @@ boolean k_format;
|
||||
u.uhpmax = u.uhp; /* perhaps n was negative */
|
||||
context.botl = 1;
|
||||
if(u.uhp < 1) {
|
||||
killer_format = k_format;
|
||||
killer = knam; /* the thing that killed you */
|
||||
killer.format = k_format;
|
||||
if (killer.name != knam) /* the thing that killed you */
|
||||
Strcpy(killer.name, knam ? knam : "");
|
||||
You("die...");
|
||||
done(DIED);
|
||||
} else if (n > 0 && u.uhp*10 < u.uhpmax) {
|
||||
|
||||
@@ -332,8 +332,8 @@ int spellnum;
|
||||
if (Hallucination) {
|
||||
You("have an out of body experience.");
|
||||
} else {
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "touch of death";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "touch of death");
|
||||
done(DIED);
|
||||
}
|
||||
} else {
|
||||
|
||||
43
src/mhitu.c
43
src/mhitu.c
@@ -1058,8 +1058,8 @@ dopois:
|
||||
pline("Unfortunately your brain is still gone.");
|
||||
else
|
||||
Your("last thought fades away.");
|
||||
killer = "brainlessness";
|
||||
killer_format = KILLED_BY;
|
||||
Strcpy(killer.name, "brainlessness");
|
||||
killer.format = KILLED_BY;
|
||||
done(DIED);
|
||||
lifesaved++;
|
||||
}
|
||||
@@ -1150,18 +1150,16 @@ dopois:
|
||||
if (!Stoned && !Stone_resistance
|
||||
&& !(poly_when_stoned(youmonst.data) &&
|
||||
polymon(PM_STONE_GOLEM))) {
|
||||
Stoned = 5;
|
||||
delayed_killer = mtmp->data->mname;
|
||||
if (mtmp->data->geno & G_UNIQ) {
|
||||
if (!type_is_pname(mtmp->data)) {
|
||||
static char buf[BUFSZ];
|
||||
int kformat = KILLED_BY_AN;
|
||||
const char *kname = mtmp->data->mname;
|
||||
|
||||
/* "the" buffer may be reallocated */
|
||||
Strcpy(buf, the(delayed_killer));
|
||||
delayed_killer = buf;
|
||||
}
|
||||
killer_format = KILLED_BY;
|
||||
} else killer_format = KILLED_BY_AN;
|
||||
Stoned = 5;
|
||||
if (mtmp->data->geno & G_UNIQ) {
|
||||
if (!type_is_pname(mtmp->data))
|
||||
kname = the(kname);
|
||||
kformat = KILLED_BY;
|
||||
}
|
||||
delayed_killer(STONED, kformat, kname);
|
||||
return(1);
|
||||
/* You("turn to stone..."); */
|
||||
/* done_in_by(mtmp); */
|
||||
@@ -1195,11 +1193,10 @@ dopois:
|
||||
!Is_waterlevel(&u.uz);
|
||||
|
||||
pline("%s drowns you...", Monnam(mtmp));
|
||||
killer_format = KILLED_BY_AN;
|
||||
Sprintf(buf, "%s by %s",
|
||||
killer.format = KILLED_BY_AN;
|
||||
Sprintf(killer.name, "%s by %s",
|
||||
moat ? "moat" : "pool of water",
|
||||
an(mtmp->data->mname));
|
||||
killer = buf;
|
||||
done(DROWNING);
|
||||
} else if(mattk->aatyp == AT_HUGS)
|
||||
You("are being crushed.");
|
||||
@@ -1450,8 +1447,8 @@ dopois:
|
||||
switch (rn2(20)) {
|
||||
case 19: case 18: case 17:
|
||||
if (!Antimagic) {
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "touch of death";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "touch of death");
|
||||
done(DIED);
|
||||
dmg = 0;
|
||||
break;
|
||||
@@ -1491,10 +1488,8 @@ dopois:
|
||||
dmg = 0;
|
||||
} else if (!Slimed) {
|
||||
You("don't feel very well.");
|
||||
Slimed = 10L;
|
||||
context.botl = 1;
|
||||
killer_format = KILLED_BY_AN;
|
||||
delayed_killer = mtmp->data->mname;
|
||||
make_slimed(10L, (char*) 0);
|
||||
delayed_killer(SLIMED, KILLED_BY_AN, mtmp->data->mname);
|
||||
} else
|
||||
pline("Yuck!");
|
||||
break;
|
||||
@@ -1912,8 +1907,8 @@ gazemu(mtmp, mattk) /* monster gazes at you */
|
||||
if(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))
|
||||
break;
|
||||
You("turn to stone...");
|
||||
killer_format = KILLED_BY;
|
||||
killer = mtmp->data->mname;
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, mtmp->data->mname);
|
||||
done(STONING);
|
||||
}
|
||||
break;
|
||||
|
||||
41
src/mon.c
41
src/mon.c
@@ -1483,10 +1483,10 @@ boolean was_swallowed; /* digestion */
|
||||
if (magr == &youmonst) {
|
||||
There("is an explosion in your %s!",
|
||||
body_part(STOMACH));
|
||||
Sprintf(killer_buf, "%s explosion",
|
||||
Sprintf(killer.name, "%s explosion",
|
||||
s_suffix(mdat->mname));
|
||||
if (Half_physical_damage) tmp = (tmp+1) / 2;
|
||||
losehp(tmp, killer_buf, KILLED_BY_AN);
|
||||
losehp(tmp, killer.name, KILLED_BY_AN);
|
||||
} else {
|
||||
if (!Deaf) You_hear("an explosion.");
|
||||
magr->mhp -= tmp;
|
||||
@@ -1502,9 +1502,8 @@ boolean was_swallowed; /* digestion */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Sprintf(killer_buf, "%s explosion", s_suffix(mdat->mname));
|
||||
killer = killer_buf;
|
||||
killer_format = KILLED_BY_AN;
|
||||
Sprintf(killer.name, "%s explosion", s_suffix(mdat->mname));
|
||||
killer.format = KILLED_BY_AN;
|
||||
explode(mon->mx, mon->my, -1, tmp, MON_EXPLODE, EXPL_NOXIOUS);
|
||||
return (FALSE);
|
||||
}
|
||||
@@ -2018,8 +2017,8 @@ int typ, fatal;
|
||||
losehp(i, pname, kprefix);
|
||||
}
|
||||
if(u.uhp < 1) {
|
||||
killer_format = kprefix;
|
||||
killer = pname;
|
||||
killer.format = kprefix;
|
||||
Strcpy(killer.name, pname);
|
||||
/* "Poisoned by a poisoned ___" is redundant */
|
||||
done(strstri(pname, "poison") ? DIED : POISONING);
|
||||
}
|
||||
@@ -2315,21 +2314,21 @@ struct monst *mon;
|
||||
break;
|
||||
}
|
||||
#ifdef WIZARD
|
||||
/* For debugging only: allow control of polymorphed monster; not saved */
|
||||
/* For debugging: allow control of polymorphed monster; not saved */
|
||||
if (wizard && iflags.mon_polycontrol) {
|
||||
char pprompt[BUFSZ], buf[BUFSZ];
|
||||
int tries = 0;
|
||||
do {
|
||||
Sprintf(pprompt,
|
||||
"Change %s into what kind of monster? [type the name]",
|
||||
mon_nam(mon));
|
||||
getlin(pprompt,buf);
|
||||
mndx = name_to_mon(buf);
|
||||
if (mndx < LOW_PM)
|
||||
You("cannot polymorph %s into that.", mon_nam(mon));
|
||||
else break;
|
||||
} while(++tries < 5);
|
||||
if (tries==5) pline(thats_enough_tries);
|
||||
char pprompt[BUFSZ], buf[BUFSZ];
|
||||
int tries = 0;
|
||||
do {
|
||||
Sprintf(pprompt,
|
||||
"Change %s into what kind of monster? [type the name]",
|
||||
mon_nam(mon));
|
||||
getlin(pprompt,buf);
|
||||
mndx = name_to_mon(buf);
|
||||
if (mndx < LOW_PM)
|
||||
You("cannot polymorph %s into that.", mon_nam(mon));
|
||||
else break;
|
||||
} while(++tries < 5);
|
||||
if (tries==5) pline(thats_enough_tries);
|
||||
}
|
||||
#endif /*WIZARD*/
|
||||
if (mndx == NON_PM) mndx = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
|
||||
|
||||
@@ -400,11 +400,11 @@ m_throw(mon, x, y, dx, dy, range, obj)
|
||||
}
|
||||
}
|
||||
if (hitu && singleobj->otyp == EGG) {
|
||||
if (!Stone_resistance
|
||||
if (!Stoned && !Stone_resistance
|
||||
&& !(poly_when_stoned(youmonst.data) &&
|
||||
polymon(PM_STONE_GOLEM))) {
|
||||
Stoned = 5;
|
||||
killer = (char *) 0;
|
||||
delayed_killer(STONED, KILLED_BY, nul);
|
||||
}
|
||||
}
|
||||
stop_occupation();
|
||||
|
||||
@@ -67,11 +67,16 @@ const char *fmt, *arg;
|
||||
(urace.femalenum != NON_PM &&
|
||||
(mvitals[urace.femalenum].mvflags & G_GENOD))) {
|
||||
/* intervening activity might have clobbered genocide info */
|
||||
killer = delayed_killer;
|
||||
if (!killer || !strstri(killer, "genocid")) {
|
||||
killer_format = KILLED_BY;
|
||||
killer = "self-genocide";
|
||||
struct kinfo *kptr = find_delayed_killer(POLYMORPH);
|
||||
|
||||
if (kptr != (struct kinfo*) 0 && kptr->name[0]) {
|
||||
killer.format = kptr->format;
|
||||
Strcpy(killer.name, kptr->name);
|
||||
} else {
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, "self-genocide");
|
||||
}
|
||||
dealloc_killer(kptr);
|
||||
done(GENOCIDED);
|
||||
}
|
||||
|
||||
@@ -188,7 +193,7 @@ newman()
|
||||
u.uhunger = rn1(500,500);
|
||||
if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL);
|
||||
Stoned = 0;
|
||||
delayed_killer = 0;
|
||||
dealloc_killer(find_delayed_killer(STONED));
|
||||
if (u.uhp <= 0 || u.uhpmax <= 0) {
|
||||
if (Polymorph_control) {
|
||||
if (u.uhp <= 0) u.uhp = 1;
|
||||
@@ -196,8 +201,8 @@ newman()
|
||||
} else {
|
||||
dead: /* we come directly here if their experience level went to 0 or less */
|
||||
Your("new form doesn't seem healthy enough to survive.");
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer="unsuccessful polymorph";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "unsuccessful polymorph");
|
||||
done(DIED);
|
||||
newuhs(FALSE);
|
||||
return; /* lifesaved */
|
||||
@@ -209,7 +214,7 @@ dead: /* we come directly here if their experience level went to 0 or less */
|
||||
(urace.individual.m) ? urace.individual.m : urace.noun);
|
||||
if (Slimed) {
|
||||
Your("body transforms, but there is still slime on you.");
|
||||
Slimed = 10L;
|
||||
make_slimed(10L, (const char*) 0);
|
||||
}
|
||||
context.botl = 1;
|
||||
see_monsters();
|
||||
@@ -385,7 +390,7 @@ int mntmp;
|
||||
You("turn to stone!");
|
||||
mntmp = PM_STONE_GOLEM;
|
||||
Stoned = 0;
|
||||
delayed_killer = 0;
|
||||
dealloc_killer(find_delayed_killer(STONED));
|
||||
}
|
||||
|
||||
u.mtimedone = rn1(500, 500);
|
||||
@@ -399,7 +404,7 @@ int mntmp;
|
||||
|
||||
if (Stone_resistance && Stoned) { /* parnes@eniac.seas.upenn.edu */
|
||||
Stoned = 0;
|
||||
delayed_killer = 0;
|
||||
dealloc_killer(find_delayed_killer(STONED));
|
||||
You("no longer seem to be petrifying.");
|
||||
}
|
||||
if (Sick_resistance && Sick) {
|
||||
@@ -408,13 +413,10 @@ int mntmp;
|
||||
}
|
||||
if (Slimed) {
|
||||
if (flaming(youmonst.data)) {
|
||||
pline_The("slime burns away!");
|
||||
Slimed = 0L;
|
||||
context.botl = 1;
|
||||
make_slimed(0L, "The slime burns away!");
|
||||
} else if (mntmp == PM_GREEN_SLIME) {
|
||||
/* do it silently */
|
||||
Slimed = 0L;
|
||||
context.botl = 1;
|
||||
make_slimed(0L, (char*) 0);
|
||||
}
|
||||
}
|
||||
if (nohands(youmonst.data)) Glib = 0;
|
||||
@@ -715,8 +717,8 @@ rehumanize()
|
||||
{
|
||||
/* You can't revert back while unchanging */
|
||||
if (Unchanging && (u.mh < 1)) {
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer = "killed while stuck in creature form";
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
Strcpy(killer.name, "killed while stuck in creature form");
|
||||
done(DIED);
|
||||
}
|
||||
|
||||
@@ -725,11 +727,8 @@ rehumanize()
|
||||
polyman("return to %s form!", urace.adj);
|
||||
|
||||
if (u.uhp < 1) {
|
||||
char kbuf[256];
|
||||
|
||||
Sprintf(kbuf, "reverting to unhealthy %s form", urace.adj);
|
||||
killer_format = KILLED_BY;
|
||||
killer = kbuf;
|
||||
Sprintf(killer.name, "reverting to unhealthy %s form", urace.adj);
|
||||
killer.format = KILLED_BY;
|
||||
done(DIED);
|
||||
}
|
||||
if (!uarmg) selftouch("No longer petrify-resistant, you");
|
||||
@@ -1045,8 +1044,9 @@ dogaze()
|
||||
l_monnam(mtmp));
|
||||
/* as if gazing at a sleeping anything is fruitful... */
|
||||
You("turn to stone...");
|
||||
killer_format = KILLED_BY;
|
||||
killer = "deliberately meeting Medusa's gaze";
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name,
|
||||
"deliberately meeting Medusa's gaze");
|
||||
done(STONING);
|
||||
}
|
||||
}
|
||||
|
||||
24
src/potion.c
24
src/potion.c
@@ -133,14 +133,24 @@ int type;
|
||||
|
||||
if (Sick) {
|
||||
exercise(A_CON, FALSE);
|
||||
if (cause) {
|
||||
(void) strncpy(u.usick_cause, cause, sizeof(u.usick_cause));
|
||||
u.usick_cause[sizeof(u.usick_cause)-1] = 0;
|
||||
}
|
||||
else
|
||||
u.usick_cause[0] = 0;
|
||||
delayed_killer(SICK, KILLED_BY_AN, cause);
|
||||
} else
|
||||
u.usick_cause[0] = 0;
|
||||
dealloc_killer(find_delayed_killer(SICK));
|
||||
}
|
||||
|
||||
void
|
||||
make_slimed(xtime, msg)
|
||||
long xtime;
|
||||
const char *msg;
|
||||
{
|
||||
long old = Slimed;
|
||||
|
||||
if ((!xtime && old) || (xtime && !old)) {
|
||||
if (msg) pline("%s", msg);
|
||||
context.botl = 1;
|
||||
}
|
||||
set_itimeout(&Slimed, xtime);
|
||||
if (!Slimed) dealloc_killer(find_delayed_killer(SLIMED));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
14
src/pray.c
14
src/pray.c
@@ -279,13 +279,10 @@ register int trouble;
|
||||
You_feel("more limber.");
|
||||
Stoned = 0;
|
||||
context.botl = 1;
|
||||
delayed_killer = 0;
|
||||
dealloc_killer(find_delayed_killer(STONED));
|
||||
break;
|
||||
case TROUBLE_SLIMED:
|
||||
pline_The("slime disappears.");
|
||||
Slimed = 0;
|
||||
context.botl = 1;
|
||||
delayed_killer = 0;
|
||||
make_slimed(0L, "The slime disappears.");
|
||||
break;
|
||||
case TROUBLE_STRANGLED:
|
||||
if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) {
|
||||
@@ -544,12 +541,9 @@ STATIC_OVL void
|
||||
fry_by_god(resp_god)
|
||||
aligntyp resp_god;
|
||||
{
|
||||
char killerbuf[64];
|
||||
|
||||
You("fry to a crisp.");
|
||||
killer_format = KILLED_BY;
|
||||
Sprintf(killerbuf, "the wrath of %s", align_gname(resp_god));
|
||||
killer = killerbuf;
|
||||
killer.format = KILLED_BY;
|
||||
Sprintf(killer.name, "the wrath of %s", align_gname(resp_god));
|
||||
done(DIED);
|
||||
}
|
||||
|
||||
|
||||
23
src/read.c
23
src/read.c
@@ -1593,8 +1593,8 @@ do_class_genocide()
|
||||
}
|
||||
}
|
||||
if (gameover || u.uhp == -1) {
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "scroll of genocide";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "scroll of genocide");
|
||||
if (gameover) done(GENOCIDED);
|
||||
}
|
||||
return;
|
||||
@@ -1709,25 +1709,24 @@ int how;
|
||||
|
||||
u.uhp = -1;
|
||||
if (how & PLAYER) {
|
||||
killer_format = KILLED_BY;
|
||||
killer = "genocidal confusion";
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, "genocidal confusion");
|
||||
} else if (how & ONTHRONE) {
|
||||
/* player selected while on a throne */
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "imperious order";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "imperious order");
|
||||
} else { /* selected player deliberately, not confused */
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "scroll of genocide";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "scroll of genocide");
|
||||
}
|
||||
|
||||
/* Polymorphed characters will die as soon as they're rehumanized. */
|
||||
/* KMH -- Unchanging prevents rehumanization */
|
||||
if (Upolyd && ptr != youmonst.data) {
|
||||
delayed_killer = killer;
|
||||
killer = 0;
|
||||
You_feel("dead inside.");
|
||||
delayed_killer(POLYMORPH, killer.format, killer.name);
|
||||
You_feel("dead inside.");
|
||||
} else
|
||||
done(GENOCIDED);
|
||||
done(GENOCIDED);
|
||||
} else if (ptr == youmonst.data) {
|
||||
rehumanize();
|
||||
}
|
||||
|
||||
@@ -403,6 +403,7 @@ unsigned int *stuckid, *steedid; /* STEED */
|
||||
}
|
||||
|
||||
/* this stuff comes after potential aborted restore attempts */
|
||||
restore_killers(fd);
|
||||
restore_timers(fd, RANGE_GLOBAL, FALSE, 0L);
|
||||
restore_light_sources(fd);
|
||||
invent = restobjchn(fd, FALSE, FALSE);
|
||||
@@ -694,7 +695,7 @@ char *reason;
|
||||
pline("Strange, this map is not as I remember it.");
|
||||
pline("Somebody is trying some trickery here...");
|
||||
pline("This game is void.");
|
||||
killer = reason;
|
||||
Strcpy(killer.name, reason ? reason : "");
|
||||
done(TRICKED);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,18 +117,18 @@ int how;
|
||||
center(GOLD_LINE, buf);
|
||||
|
||||
/* Put together death description */
|
||||
switch (killer_format) {
|
||||
switch (killer.format) {
|
||||
default: impossible("bad killer format?");
|
||||
case KILLED_BY_AN:
|
||||
Strcpy(buf, killed_by_prefix[how]);
|
||||
Strcat(buf, an(killer));
|
||||
Strcat(buf, an(killer.name));
|
||||
break;
|
||||
case KILLED_BY:
|
||||
Strcpy(buf, killed_by_prefix[how]);
|
||||
Strcat(buf, killer);
|
||||
Strcat(buf, killer.name);
|
||||
break;
|
||||
case NO_KILLER_PREFIX:
|
||||
Strcpy(buf, killer);
|
||||
Strcpy(buf, killer.name);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
11
src/save.c
11
src/save.c
@@ -252,7 +252,7 @@ dosave0()
|
||||
HUP pline("%s", whynot);
|
||||
(void) close(fd);
|
||||
(void) delete_savefile();
|
||||
HUP killer = whynot;
|
||||
HUP Strcpy(killer.name, whynot);
|
||||
HUP done(TRICKED);
|
||||
return(0);
|
||||
}
|
||||
@@ -297,6 +297,7 @@ register int fd, mode;
|
||||
}
|
||||
#endif
|
||||
bwrite(fd, (genericptr_t) &u, sizeof(struct you));
|
||||
save_killers(fd, mode);
|
||||
|
||||
/* must come before migrating_objs and migrating_mons are freed */
|
||||
save_timers(fd, mode, RANGE_GLOBAL);
|
||||
@@ -371,7 +372,7 @@ savestateinlock()
|
||||
if (fd < 0) {
|
||||
pline("%s", whynot);
|
||||
pline("Probably someone removed it.");
|
||||
killer = whynot;
|
||||
Strcpy(killer.name, whynot);
|
||||
done(TRICKED);
|
||||
return;
|
||||
}
|
||||
@@ -382,7 +383,7 @@ savestateinlock()
|
||||
"Level #0 pid (%d) doesn't match ours (%d)!",
|
||||
hpid, hackpid);
|
||||
pline("%s", whynot);
|
||||
killer = whynot;
|
||||
Strcpy(killer.name, whynot);
|
||||
done(TRICKED);
|
||||
}
|
||||
(void) close(fd);
|
||||
@@ -390,7 +391,7 @@ savestateinlock()
|
||||
fd = create_levelfile(0, whynot);
|
||||
if (fd < 0) {
|
||||
pline("%s", whynot);
|
||||
killer = whynot;
|
||||
Strcpy(killer.name, whynot);
|
||||
done(TRICKED);
|
||||
return;
|
||||
}
|
||||
@@ -1007,6 +1008,7 @@ freedynamicdata()
|
||||
# define freetrapchn(X) (savetrapchn(0, X, FREE_SAVE), X = 0)
|
||||
# define freefruitchn() savefruitchn(0, FREE_SAVE)
|
||||
# define freenames() savenames(0, FREE_SAVE)
|
||||
# define free_killers() save_killers(0, FREE_SAVE)
|
||||
# define free_oracles() save_oracles(0, FREE_SAVE)
|
||||
# define free_waterlevel() save_waterlevel(0, FREE_SAVE)
|
||||
# define free_worm() save_worm(0, FREE_SAVE)
|
||||
@@ -1032,6 +1034,7 @@ freedynamicdata()
|
||||
freedamage();
|
||||
|
||||
/* game-state data */
|
||||
free_killers();
|
||||
free_timers(RANGE_GLOBAL);
|
||||
free_light_sources(RANGE_GLOBAL);
|
||||
freeobjchn(invent);
|
||||
|
||||
@@ -925,11 +925,7 @@ boolean atme;
|
||||
break;
|
||||
case SPE_CURE_SICKNESS:
|
||||
if (Sick) You("are no longer ill.");
|
||||
if (Slimed) {
|
||||
pline_The("slime disappears!");
|
||||
Slimed = 0;
|
||||
/* context.botl = 1; -- healup() handles this */
|
||||
}
|
||||
if (Slimed) make_slimed(0L, "The slime disappears!");
|
||||
healup(0, 0, TRUE, FALSE);
|
||||
break;
|
||||
case SPE_CREATE_FAMILIAR:
|
||||
|
||||
@@ -631,8 +631,8 @@ level_tele()
|
||||
is_silent(youmonst.data) ? "writhe" : "scream");
|
||||
display_nhwindow(WIN_MESSAGE, FALSE);
|
||||
You("cease to exist.");
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer = "committed suicide";
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
Strcpy(killer.name, "committed suicide");
|
||||
done(DIED);
|
||||
return;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ level_tele()
|
||||
}
|
||||
#endif
|
||||
|
||||
killer = 0; /* still alive, so far... */
|
||||
killer.name[0] = 0; /* still alive, so far... */
|
||||
|
||||
if (newlev < 0) {
|
||||
if (*u.ushops0) {
|
||||
@@ -699,8 +699,8 @@ level_tele()
|
||||
if (newlev <= -10) {
|
||||
You("arrive in heaven.");
|
||||
verbalize("Thou art early, but we'll admit thee.");
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer = "went to heaven prematurely";
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
Strcpy(killer.name, "went to heaven prematurely");
|
||||
} else if (newlev == -9) {
|
||||
You_feel("deliriously happy. ");
|
||||
pline("(In fact, you're on Cloud 9!) ");
|
||||
@@ -708,7 +708,7 @@ level_tele()
|
||||
} else
|
||||
You("are now high above the clouds...");
|
||||
|
||||
if (killer) {
|
||||
if (killer.name[0]) {
|
||||
; /* arrival in heaven is pending */
|
||||
} else if (Levitation) {
|
||||
escape_by_flying = "float gently down to earth";
|
||||
@@ -717,15 +717,14 @@ level_tele()
|
||||
} else {
|
||||
pline("Unfortunately, you don't know how to fly.");
|
||||
You("plummet a few thousand feet to your death.");
|
||||
Sprintf(buf,
|
||||
Sprintf(killer.name,
|
||||
"teleported out of the dungeon and fell to %s death",
|
||||
uhis());
|
||||
killer = buf;
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
}
|
||||
}
|
||||
|
||||
if (killer) { /* the chosen destination was not survivable */
|
||||
if (killer.name[0]) { /* the chosen destination was not survivable */
|
||||
d_level lsav;
|
||||
|
||||
/* set specific death location; this also suppresses bones */
|
||||
|
||||
@@ -144,11 +144,8 @@ void
|
||||
burn_away_slime()
|
||||
{
|
||||
if (Slimed) {
|
||||
pline_The("slime that covers you is burned away!");
|
||||
Slimed = 0L;
|
||||
context.botl = 1;
|
||||
make_slimed(0L, "The slime that covers you is burned away!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +153,7 @@ void
|
||||
nh_timeout()
|
||||
{
|
||||
register struct prop *upp;
|
||||
struct kinfo *kptr;
|
||||
int sleeptime;
|
||||
int m_idx;
|
||||
int baseluck = (flags.moonphase == FULL_MOON) ? 1 : 0;
|
||||
@@ -211,29 +209,28 @@ nh_timeout()
|
||||
|
||||
for(upp = u.uprops; upp < u.uprops+SIZE(u.uprops); upp++)
|
||||
if((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) {
|
||||
kptr = find_delayed_killer(upp - u.uprops);
|
||||
switch(upp - u.uprops){
|
||||
case STONED:
|
||||
if (delayed_killer && !killer) {
|
||||
killer = delayed_killer;
|
||||
delayed_killer = 0;
|
||||
}
|
||||
if (!killer) {
|
||||
/* leaving killer_format would make it
|
||||
"petrified by petrification" */
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer = "killed by petrification";
|
||||
if (kptr && kptr->name[0]) {
|
||||
killer.format = kptr->format;
|
||||
Strcpy(killer.name, kptr->name);
|
||||
} else {
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
Strcpy(killer.name, "killed by petrification");
|
||||
}
|
||||
dealloc_killer(kptr);
|
||||
done(STONING);
|
||||
break;
|
||||
case SLIMED:
|
||||
if (delayed_killer && !killer) {
|
||||
killer = delayed_killer;
|
||||
delayed_killer = 0;
|
||||
}
|
||||
if (!killer) {
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer = "turned into green slime";
|
||||
if (kptr && kptr->name[0]) {
|
||||
killer.format = kptr->format;
|
||||
Strcpy(killer.name, kptr->name);
|
||||
} else {
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
Strcpy(killer.name, "turned into green slime");
|
||||
}
|
||||
dealloc_killer(kptr);
|
||||
done(TURNED_SLIME);
|
||||
break;
|
||||
case VOMITING:
|
||||
@@ -241,15 +238,21 @@ nh_timeout()
|
||||
break;
|
||||
case SICK:
|
||||
You("die from your illness.");
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = u.usick_cause;
|
||||
if ((m_idx = name_to_mon(killer)) >= LOW_PM) {
|
||||
if (kptr && kptr->name[0]) {
|
||||
killer.format = kptr->format;
|
||||
Strcpy(killer.name, kptr->name);
|
||||
} else {
|
||||
killer.format = KILLED_BY_AN;
|
||||
killer.name[0] = 0; /* take the default */
|
||||
}
|
||||
dealloc_killer(kptr);
|
||||
|
||||
if ((m_idx = name_to_mon(killer.name)) >= LOW_PM) {
|
||||
if (type_is_pname(&mons[m_idx])) {
|
||||
killer_format = KILLED_BY;
|
||||
killer.format = KILLED_BY;
|
||||
} else if (mons[m_idx].geno & G_UNIQ) {
|
||||
killer = the(killer);
|
||||
Strcpy(u.usick_cause, killer);
|
||||
killer_format = KILLED_BY;
|
||||
Strcpy(killer.name, the(killer.name));
|
||||
killer.format = KILLED_BY;
|
||||
}
|
||||
}
|
||||
u.usick_type = 0;
|
||||
@@ -318,8 +321,9 @@ nh_timeout()
|
||||
(void) float_down(I_SPECIAL|TIMEOUT, 0L);
|
||||
break;
|
||||
case STRANGLED:
|
||||
killer_format = KILLED_BY;
|
||||
killer = (u.uburied) ? "suffocation" : "strangulation";
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name,
|
||||
(u.uburied) ? "suffocation" : "strangulation");
|
||||
done(DIED);
|
||||
break;
|
||||
case FUMBLING:
|
||||
|
||||
@@ -315,20 +315,20 @@ int how;
|
||||
(void) strncpy(t0->name, plname, NAMSZ);
|
||||
t0->name[NAMSZ] = '\0';
|
||||
t0->death[0] = '\0';
|
||||
switch (killer_format) {
|
||||
switch (killer.format) {
|
||||
default: impossible("bad killer format?");
|
||||
case KILLED_BY_AN:
|
||||
Strcat(t0->death, killed_by_prefix[how]);
|
||||
(void) strncat(t0->death, an(killer),
|
||||
(void) strncat(t0->death, an(killer.name),
|
||||
DTHSZ-strlen(t0->death));
|
||||
break;
|
||||
case KILLED_BY:
|
||||
Strcat(t0->death, killed_by_prefix[how]);
|
||||
(void) strncat(t0->death, killer,
|
||||
(void) strncat(t0->death, killer.name,
|
||||
DTHSZ-strlen(t0->death));
|
||||
break;
|
||||
case NO_KILLER_PREFIX:
|
||||
(void) strncat(t0->death, killer, DTHSZ);
|
||||
(void) strncat(t0->death, killer.name, DTHSZ);
|
||||
break;
|
||||
}
|
||||
t0->birthdate = yyyymmdd(u.ubirthday);
|
||||
|
||||
15
src/trap.c
15
src/trap.c
@@ -2137,8 +2137,8 @@ const char *str;
|
||||
if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))
|
||||
return;
|
||||
You("turn to stone...");
|
||||
killer_format = KILLED_BY;
|
||||
killer = str;
|
||||
killer.format = KILLED_BY;
|
||||
if (str != killer.name) Strcpy(killer.name, str ? str : "");
|
||||
done(STONING);
|
||||
}
|
||||
|
||||
@@ -2902,9 +2902,10 @@ drown()
|
||||
}
|
||||
u.uinwater = 1;
|
||||
You("drown.");
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = (levl[u.ux][u.uy].typ == POOL || Is_medusa_level(&u.uz)) ?
|
||||
"pool of water" : "moat";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name,
|
||||
(levl[u.ux][u.uy].typ == POOL || Is_medusa_level(&u.uz)) ?
|
||||
"pool of water" : "moat");
|
||||
done(DROWNING);
|
||||
/* oops, we're still alive. better get out of the water. */
|
||||
while (!safe_teleds(TRUE)) {
|
||||
@@ -3924,8 +3925,8 @@ lava_effects()
|
||||
|
||||
/* s/he died... */
|
||||
u.uhp = -1;
|
||||
killer_format = KILLED_BY;
|
||||
killer = lava_killer;
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, lava_killer);
|
||||
You("burn to a crisp...");
|
||||
done(BURNING);
|
||||
while (!safe_teleds(TRUE)) {
|
||||
|
||||
13
src/uhitm.c
13
src/uhitm.c
@@ -1519,7 +1519,7 @@ register struct attack *mattk;
|
||||
if (!Unchanging && mdef->data == &mons[PM_GREEN_SLIME]) {
|
||||
if (!Slimed) {
|
||||
You("suck in some slime and don't feel very well.");
|
||||
Slimed = 10L;
|
||||
make_slimed(10L, (char*) 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1536,8 +1536,7 @@ register struct attack *mattk;
|
||||
u.uconduct.food++;
|
||||
if (touch_petrifies(mdef->data) && !Stone_resistance && !Stoned) {
|
||||
Stoned = 5;
|
||||
killer_format = KILLED_BY_AN;
|
||||
delayed_killer = mdef->data->mname;
|
||||
delayed_killer(STONED, KILLED_BY_AN, mdef->data->mname);
|
||||
}
|
||||
if (!vegan(mdef->data))
|
||||
u.uconduct.unvegan++;
|
||||
@@ -1765,10 +1764,9 @@ register struct attack *mattk;
|
||||
if (is_rider(mdef->data)) {
|
||||
pline("Unfortunately, digesting any of it is fatal.");
|
||||
end_engulf();
|
||||
Sprintf(msgbuf, "unwisely tried to eat %s",
|
||||
Sprintf(killer.name, "unwisely tried to eat %s",
|
||||
mdef->data->mname);
|
||||
killer = msgbuf;
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
done(DIED);
|
||||
return 0; /* lifesaved */
|
||||
}
|
||||
@@ -1818,8 +1816,7 @@ register struct attack *mattk;
|
||||
Sprintf(msgbuf, "%s isn't sitting well with you.",
|
||||
The(mdef->data->mname));
|
||||
if (!Unchanging) {
|
||||
Slimed = 5L;
|
||||
context.botl = 1;
|
||||
make_slimed(5L, (char*) 0);
|
||||
}
|
||||
} else
|
||||
exercise(A_CON, TRUE);
|
||||
|
||||
10
src/zap.c
10
src/zap.c
@@ -1852,7 +1852,6 @@ struct obj *obj;
|
||||
boolean ordinary;
|
||||
{
|
||||
int damage = 0;
|
||||
char buf[BUFSZ];
|
||||
|
||||
switch(obj->otyp) {
|
||||
case WAN_STRIKING:
|
||||
@@ -2030,9 +2029,8 @@ boolean ordinary;
|
||||
: "You seem no deader than before.");
|
||||
break;
|
||||
}
|
||||
Sprintf(buf, "shot %sself with a death ray", uhim());
|
||||
killer = buf;
|
||||
killer_format = NO_KILLER_PREFIX;
|
||||
Sprintf(killer.name,"shot %sself with a death ray",uhim());
|
||||
killer.format = NO_KILLER_PREFIX;
|
||||
You("irradiate yourself with pure energy!");
|
||||
You("die.");
|
||||
makeknown(obj->otyp);
|
||||
@@ -3110,8 +3108,8 @@ xchar sx, sy;
|
||||
You("aren't affected.");
|
||||
break;
|
||||
}
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = fltxt;
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, fltxt ? fltxt : "");
|
||||
/* when killed by disintegration breath, don't leave corpse */
|
||||
u.ugrave_arise = (type == -ZT_BREATH(ZT_DEATH)) ? -3 : NON_PM;
|
||||
done(DIED);
|
||||
|
||||
Reference in New Issue
Block a user