-/* NetHack 3.6 context.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ */
+/* NetHack 3.6 context.h $NHDT-Date: 1434421363 2015/06/16 02:22:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
size_t tributesz; /* make it possible to skip this in future */
boolean enabled; /* Do we have tributes turned on? */
Bitfield(bookstock, 1); /* Have we stocked the book? */
+ Bitfield(Deathnotice,1); /* Did Death notice the book? */
/* Markers for other tributes can go here */
- /* 31 free bits */
+ /* 30 free bits */
};
struct context_info {
-/* NetHack 3.6 extern.h $NHDT-Date: 1434330826 2015/06/15 01:13:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.503 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1434421365 2015/06/16 02:22:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.504 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
#ifdef DEBUG
E boolean FDECL(debugcore, (const char *, BOOLEAN_P));
#endif
-E boolean FDECL(read_tribute, (const char *, const char *, int));
+E boolean FDECL(read_tribute, (const char *, const char *, int, char *, int));
+E boolean FDECL(Death_quote, (char *, int));
/* ### fountain.c ### */
E struct obj *FDECL(nxtobj, (struct obj *, int, BOOLEAN_P));
E struct obj *FDECL(carrying, (int));
E boolean NDECL(have_lizard);
+E struct obj *NDECL(u_have_novel);
E struct obj *FDECL(o_on, (unsigned int, struct obj *));
E boolean FDECL(obj_here, (struct obj *, int, int));
E boolean NDECL(wearing_armor);
-/* NetHack 3.6 files.c $NHDT-Date: 1434249087 2015/06/14 02:31:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.179 $ */
+/* NetHack 3.6 files.c $NHDT-Date: 1434421344 2015/06/16 02:22:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.180 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#define PASSAGESCOPE 3
boolean
-read_tribute(tribsection, tribtitle, tribpassage)
+read_tribute(tribsection, tribtitle, tribpassage, nowin_buf, bufsz)
const char *tribsection, *tribtitle;
-int tribpassage;
+int tribpassage, bufsz;
+char *nowin_buf;
{
dlb *fp;
char *endp;
/* check for mandatories */
if (!tribsection || !tribtitle) {
- pline("It's %s of \"%s\"!", badtranslation, tribtitle);
+ if (!nowin_buf)
+ pline("It's %s of \"%s\"!", badtranslation, tribtitle);
return grasped;
}
fp = dlb_fopen(TRIBUTEFILE, "r");
if (!fp) {
/* this is actually an error - cannot open tribute file! */
- pline("You feel too overwhelmed to continue!");
+ if (!nowin_buf)
+ pline("You feel too overwhelmed to continue!");
return grasped;
}
passagenum = atoi(st);
if (passagenum && (passagenum <= passagecnt)) {
scope = PASSAGESCOPE;
- if (matchedtitle && (passagenum == targetpassage))
- tribwin = create_nhwindow(NHW_MENU);
+ if (matchedtitle && (passagenum == targetpassage)) {
+ if (!nowin_buf)
+ tribwin = create_nhwindow(NHW_MENU);
+ }
}
} else if (!strncmpi(&line[1], "e ", sizeof("e ") - 1)) {
if (matchedtitle && (scope == PASSAGESCOPE)
- && tribwin != WIN_ERR)
+ && (!nowin_buf && tribwin != WIN_ERR))
goto cleanup;
if (scope == TITLESCOPE)
matchedtitle = FALSE;
/* comment only, next! */
break;
default:
- if (matchedtitle && scope == PASSAGESCOPE && tribwin != WIN_ERR) {
- putstr(tribwin, 0, line);
- Strcpy(lastline, line);
+ if (matchedtitle && scope == PASSAGESCOPE) {
+ if (!nowin_buf && tribwin != WIN_ERR) {
+ putstr(tribwin, 0, line);
+ Strcpy(lastline, line);
+ } else if (nowin_buf) {
+ if ((int)strlen(line) < bufsz-1)
+ Strcpy(nowin_buf, line);
+ }
}
}
}
cleanup:
(void) dlb_fclose(fp);
- if (tribwin != WIN_ERR) {
+ if (!nowin_buf && tribwin != WIN_ERR) {
if (matchedtitle && scope == PASSAGESCOPE) {
display_nhwindow(tribwin, FALSE);
/* put the final attribution line into message history,
tribwin = WIN_ERR;
grasped = TRUE;
} else {
- pline("It seems to be %s of \"%s\"!", badtranslation, tribtitle);
+ if (!nowin_buf)
+ pline("It seems to be %s of \"%s\"!", badtranslation, tribtitle);
+ else
+ grasped = TRUE;
}
-
return grasped;
}
+
+boolean
+Death_quote(buf, bufsz)
+char *buf;
+int bufsz;
+{
+ return read_tribute("Death", "Death Quotes", 0, buf, bufsz);
+}
/* ---------- END TRIBUTE ----------- */
/*files.c*/
-/* NetHack 3.6 invent.c $NHDT-Date: 1432939569 2015/05/29 22:46:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.166 $ */
+/* NetHack 3.6 invent.c $NHDT-Date: 1434421348 2015/06/16 02:22:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.167 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return (FALSE);
}
+/* 3.6.0 tribute */
+struct obj *
+u_have_novel()
+{
+ register struct obj *otmp;
+
+ for (otmp = invent; otmp; otmp = otmp->nobj)
+ if (otmp->otyp == SPE_NOVEL)
+ return otmp;
+ return (struct obj *)0;
+}
+
struct obj *
o_on(id, objchn)
unsigned int id;
-/* NetHack 3.6 sounds.c $NHDT-Date: 1432510145 2015/05/24 23:29:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
+/* NetHack 3.6 sounds.c $NHDT-Date: 1434421352 2015/06/16 02:22:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.64 $ */
/* Copyright (c) 1989 Janet Walz, Mike Threepoint */
/* NetHack may be freely redistributed. See license for details. */
: soldier_foe_msg[rn2(3)];
} break;
case MS_RIDER:
- if (ptr == &mons[PM_DEATH] && !rn2(10))
+ /* 3.6.0 tribute */
+ if (ptr == &mons[PM_DEATH] &&
+ !context.tribute.Deathnotice && u_have_novel()) {
+ struct obj *book = u_have_novel();
+ const char *tribtitle = (char *)0;
+
+ if (book) {
+ int novelidx = book->novelidx;
+ tribtitle = noveltitle(&novelidx);
+ }
+ if (tribtitle) {
+ Sprintf(verbuf,
+ "Ah, so you have a copy of '%s'. I may have been misquoted there.",
+ tribtitle);
+ verbl_msg = verbuf;
+ context.tribute.Deathnotice = 1;
+ }
+ } else if (ptr == &mons[PM_DEATH] &&
+ !rn2(2) && Death_quote(verbuf, BUFSZ)) {
+ verbl_msg = verbuf;
+ }
+ /* end of tribute addition */
+ else if (ptr == &mons[PM_DEATH] && !rn2(10))
pline_msg = "is busy reading a copy of Sandman #8.";
else
verbl_msg = "Who do you think you are, War?";
-/* NetHack 3.6 spell.c $NHDT-Date: 1432512766 2015/05/25 00:12:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
+/* NetHack 3.6 spell.c $NHDT-Date: 1434421353 2015/06/16 02:22:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */
/* Copyright (c) M. Stephenson 1988 */
/* NetHack may be freely redistributed. See license for details. */
if (booktype == SPE_NOVEL) {
/* Obtain current Terry Pratchett book title */
const char *tribtitle = noveltitle(&spellbook->novelidx);
- if (read_tribute("books", tribtitle, 0)) {
+ if (read_tribute("books", tribtitle, 0, (char *)0, 0)) {
u.uconduct.literate++;
check_unpaid(spellbook);
if (!u.uevent.read_tribute) {