a couple more tribute easter eggs
Changes to be committed: modified: include/context.h modified: include/extern.h modified: src/files.c modified: src/invent.c modified: src/sounds.c modified: src/spell.c Add a couple more tribute easter eggs. - can lead to a remark by Death if you happen to have a pratchett book on your person, as suggested by M. Stephenson (fat chance you will, or think to #chat if you do, but it could be a tournament novelty or something obscure to strive for). - can draw some additional Death quotes from the tribute file. (There's two in there right now. If anyone wants to add or suggest some more, please go ahead. The Death quotes are at the end of the tribute file. One-liners only please or the code will only pull the last line.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -80,8 +80,9 @@ struct tribute_info {
|
||||
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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -765,7 +765,8 @@ E void NDECL(really_close);
|
||||
#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 ### */
|
||||
|
||||
@@ -901,6 +902,7 @@ E struct obj *FDECL(sobj_at, (int, int, int));
|
||||
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);
|
||||
|
||||
48
src/files.c
48
src/files.c
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -3392,9 +3392,10 @@ boolean wildcards;
|
||||
#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;
|
||||
@@ -3409,7 +3410,8 @@ int tribpassage;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -3419,7 +3421,8 @@ int tribpassage;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -3494,12 +3497,14 @@ int tribpassage;
|
||||
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;
|
||||
@@ -3516,16 +3521,21 @@ int tribpassage;
|
||||
/* 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,
|
||||
@@ -3540,11 +3550,21 @@ cleanup:
|
||||
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*/
|
||||
|
||||
14
src/invent.c
14
src/invent.c
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -815,6 +815,18 @@ have_lizard()
|
||||
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;
|
||||
|
||||
26
src/sounds.c
26
src/sounds.c
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -906,7 +906,29 @@ register struct monst *mtmp;
|
||||
: 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?";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -473,7 +473,7 @@ register struct obj *spellbook;
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user