]> granicus.if.org Git - nethack/commitdiff
a couple more tribute easter eggs
authornhmall <mjnh@persona.ca>
Tue, 16 Jun 2015 02:22:56 +0000 (22:22 -0400)
committernhmall <mjnh@persona.ca>
Tue, 16 Jun 2015 02:22:56 +0000 (22:22 -0400)
 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.

include/context.h
include/extern.h
src/files.c
src/invent.c
src/sounds.c
src/spell.c

index 493b7a4a03e764f1e6a1864f57401f3edee128bc..b73499f97939a32a841f6b5fced0da837b427659 100644 (file)
@@ -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 {
index 0a45129e098ae2ec640bbe72507fcfb5481d6ac5..a412da87cee7fa127789a6d8b6b2c3cc1318b76e 100644 (file)
@@ -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);
index 58310f81fda5eec2fdd5bc2b63172a743037b633..3d59f0f33f6a9754dbb8f91eb7b7ff766a11e331 100644 (file)
@@ -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*/
index cb4396d25c89e1cd32d2a7a0ae89878a2b71223e..7b6cbf0ce04e0665bcecaf6f929e42cfddd19714 100644 (file)
@@ -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;
index ff3edf81519fd57bec695c5cbb5f6483be0cadc3..f95f4eb7426ae57fb1f3b18b76c528cc8b88c139 100644 (file)
@@ -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?";
index 384551cc2fefef73375ef6aa3baa48a23e855e6e..d8c7a1b322220ca416fd1c8a36840455cb5dfe6a 100644 (file)
@@ -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) {