]> granicus.if.org Git - nethack/commitdiff
Show t-shirt text at end of game inventory disclose
authorPasi Kallinen <paxed@alt.org>
Fri, 27 Mar 2015 14:08:06 +0000 (16:08 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 27 Mar 2015 14:08:06 +0000 (16:08 +0200)
Restricting the text display only to the end of game disclose,
so it doesn't clutter the inventory during gameplay and so that
the readability of t-shirts is not given away.

include/extern.h
src/objnam.c
src/read.c

index 30e6c6d4394905b6339a35d7ddc15dd2fe90faa4..d6347207c4b317125e672986499c72d328326714 100644 (file)
@@ -1824,6 +1824,7 @@ E long NDECL(random);
 /* ### read.c ### */
 
 E void FDECL(learnscroll, (struct obj *));
+E char *FDECL(tshirt_text, (struct obj *, char *));
 E int NDECL(doread);
 E boolean FDECL(is_chargeable, (struct obj *));
 E void FDECL(recharge, (struct obj *,int));
index 54923ce1e9aad552f24924f448816556fc174286..f40222c3b5dfbe4de805acc14d4aaa74b69862b8 100644 (file)
@@ -489,6 +489,11 @@ register struct obj *obj;
        }
        if (pluralize) Strcpy(buf, makeplural(buf));
 
+       if (obj->otyp == T_SHIRT && program_state.gameover) {
+           char tmpbuf[BUFSZ];
+           Sprintf(eos(buf), " with text \"%s\"", tshirt_text(obj, tmpbuf));
+       }
+
        if (has_oname(obj) && dknown) {
                Strcat(buf, " named ");
 nameit:
index 9be9f9390e89bfec4d9635fa83fb7d99f128c38a..26e9f2f625e823f27d15c1ccf13a54bede2528e9 100644 (file)
@@ -53,6 +53,39 @@ struct obj *sobj;
        (void) learnscrolltyp(sobj->otyp);
 }
 
+char *
+tshirt_text(tshirt, buf)
+struct obj *tshirt;
+char *buf;
+{
+    static const char *shirt_msgs[] = { /* Scott Bigham */
+    "I explored the Dungeons of Doom and all I got was this lousy T-shirt!",
+    "Is that Mjollnir in your pocket or are you just happy to see me?",
+    "It's not the size of your sword, it's how #enhance'd you are with it.",
+    "Madame Elvira's House O' Succubi Lifetime Customer",
+    "Madame Elvira's House O' Succubi Employee of the Month",
+    "Ludios Vault Guards Do It In Small, Dark Rooms",
+    "Yendor Military Soldiers Do It In Large Groups",
+    "I survived Yendor Military Boot Camp",
+    "Ludios Accounting School Intra-Mural Lacrosse Team",
+    "Oracle(TM) Fountains 10th Annual Wet T-Shirt Contest",
+    "Hey, black dragon!  Disintegrate THIS!",
+    "I'm With Stupid -->",
+    "Don't blame me, I voted for Izchak!",
+    "Don't Panic",                             /* HHGTTG */
+    "Furinkan High School Athletic Dept.",     /* Ranma 1/2 */
+    "Hel-LOOO, Nurse!",                        /* Animaniacs */
+    };
+    int erosion;
+    Strcpy(buf, shirt_msgs[tshirt->o_id % SIZE(shirt_msgs)]);
+    erosion = greatest_erosion(tshirt);
+    if (erosion)
+       wipeout_text(buf,
+                    (int)(strlen(buf) * erosion / (2*MAX_ERODE)),
+                    tshirt->o_id ^ (unsigned)ubirthday);
+    return buf;
+}
+
 int
 doread()
 {
@@ -73,27 +106,7 @@ doread()
            useup(scroll);
            return(1);
        } else if (scroll->otyp == T_SHIRT) {
-           static const char *shirt_msgs[] = { /* Scott Bigham */
-    "I explored the Dungeons of Doom and all I got was this lousy T-shirt!",
-    "Is that Mjollnir in your pocket or are you just happy to see me?",
-    "It's not the size of your sword, it's how #enhance'd you are with it.",
-    "Madame Elvira's House O' Succubi Lifetime Customer",
-    "Madame Elvira's House O' Succubi Employee of the Month",
-    "Ludios Vault Guards Do It In Small, Dark Rooms",
-    "Yendor Military Soldiers Do It In Large Groups",
-    "I survived Yendor Military Boot Camp",
-    "Ludios Accounting School Intra-Mural Lacrosse Team",
-    "Oracle(TM) Fountains 10th Annual Wet T-Shirt Contest",
-    "Hey, black dragon!  Disintegrate THIS!",
-    "I'm With Stupid -->",
-    "Don't blame me, I voted for Izchak!",
-    "Don't Panic",                             /* HHGTTG */
-    "Furinkan High School Athletic Dept.",     /* Ranma 1/2 */
-    "Hel-LOOO, Nurse!",                        /* Animaniacs */
-           };
            char buf[BUFSZ];
-           int erosion;
-
            if (Blind) {
                You_cant("feel any Braille writing.");
                return 0;
@@ -108,13 +121,7 @@ doread()
            u.uconduct.literate++;
            if(flags.verbose)
                pline("It reads:");
-           Strcpy(buf, shirt_msgs[scroll->o_id % SIZE(shirt_msgs)]);
-           erosion = greatest_erosion(scroll);
-           if (erosion)
-               wipeout_text(buf,
-                       (int)(strlen(buf) * erosion / (2*MAX_ERODE)),
-                            scroll->o_id ^ (unsigned)ubirthday);
-           pline("\"%s\"", buf);
+           pline("\"%s\"", tshirt_text(scroll, buf));
            return 1;
        } else if (scroll->oclass != SCROLL_CLASS
                && scroll->oclass != SPBOOK_CLASS) {