-/* NetHack 3.6 engrave.c $NHDT-Date: 1445388915 2015/10/21 00:55:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
+/* NetHack 3.6 engrave.c $NHDT-Date: 1456304550 2016/02/24 09:02:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
+/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
/* JNetHack Copyright */
/* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
-/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016 */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019 */
/* JNetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include "lev.h"
STATIC_VAR NEARDATA struct engr *head_engr;
+STATIC_DCL const char *NDECL(blengr);
char *
random_engraving(outbuf)
/* a random engraving may come from the "rumors" file,
or from the "engrave" file (formerly in an array here) */
if (!rn2(4) || !(rumor = getrumor(0, outbuf, TRUE)) || !*rumor)
- (void) get_rnd_text(ENGRAVEFILE, outbuf);
+ (void) get_rnd_text(ENGRAVEFILE, outbuf, rn2);
wipeout_text(outbuf, (int) (strlen(outbuf) / 4), 0);
return outbuf;
int x, y;
boolean up, check_pit;
{
+#if 0 /*JP*/
You("can't reach the %s.",
up ? ceiling(x, y)
: (check_pit && can_reach_floor(FALSE))
? "bottom of the pit"
: surface(x, y));
+#else
+ You("%s\82É\93Í\82©\82È\82¢\81D",
+ up ? ceiling(x, y)
+ : (check_pit && can_reach_floor(FALSE))
+ ? "\97\8e\82µ\8c\8a\82Ì\92ê"
+ : surface(x, y));
+#endif
}
const char *
*/
return "\8bó\92\86";
else if (is_pool(x, y))
-/*JP
- return (Underwater && !Is_waterlevel(&u.uz)) ? "bottom" : "water";
-*/
- return (Underwater && !Is_waterlevel(&u.uz)) ? "\90\85\82Ì\92ê" : "\90\85\92\86";
+#if 0 /*JP*/
+ return (Underwater && !Is_waterlevel(&u.uz))
+ ? "bottom" : hliquid("water");
+#else
+ return (Underwater && !Is_waterlevel(&u.uz))
+ ? "\90\85\82Ì\92ê" : hliquid("\90\85\92\86");
+#endif
else if (is_ice(x, y))
/*JP
return "ice";
return "\95X";
else if (is_lava(x, y))
/*JP
- return "lava";
+ return hliquid("lava");
*/
- return "\97n\8aâ";
+ return hliquid("\97n\8aâ");
else if (lev->typ == DRAWBRIDGE_DOWN)
/*JP
return "bridge";
* Ignore headstones, in case the player names herself "Elbereth".
*
* If strict checking is requested, the word is only considered to be
- * present if it is intact and is the first word in the engraving.
- * ("Elbereth burrito" matches; "o Elbereth" does not.)
+ * present if it is intact and is the entire content of the engraving.
*/
int
sengr_at(s, x, y, strict)
register struct engr *ep = engr_at(x, y);
if (ep && ep->engr_type != HEADSTONE && ep->engr_time <= moves) {
- return strict ? (strncmpi(ep->engr_txt, s, strlen(s)) == 0)
+ return strict ? (fuzzymatch(ep->engr_txt, s, "", TRUE))
: (strstri(ep->engr_txt, s) != 0);
}
+
return FALSE;
}
xchar e_type;
{
struct engr *ep;
+ unsigned smem = strlen(s) + 1;
if ((ep = engr_at(x, y)) != 0)
del_engr(ep);
- ep = newengr(strlen(s) + 1);
+ ep = newengr(smem);
+ (void) memset((genericptr_t)ep, 0, smem + sizeof(struct engr));
ep->nxt_engr = head_engr;
head_engr = ep;
ep->engr_x = x;
exercise(A_WIS, TRUE);
ep->engr_time = e_time;
ep->engr_type = e_type > 0 ? e_type : rnd(N_ENGRAVE - 1);
- ep->engr_lth = strlen(s) + 1;
+ ep->engr_lth = smem;
}
/* delete any engraving at location <x,y> */
}
/*
- * freehand - returns true if player has a free hand
+ * freehand - returns true if player has a free hand
*/
int
freehand()
* Devaluation of less hard gems is not easily possible because obj struct
* does not contain individual oc_cost currently. 7/91
*
- * steel - 5-8.5 (usu. weapon)
+ * steel - 5-8.5 (usu. weapon)
* diamond - 10 * jade - 5-6 (nephrite)
* ruby - 9 (corundum) * turquoise - 5-6
* sapphire - 9 (corundum) * opal - 5-6
boolean teleengr = FALSE; /* TRUE if we move the old engraving */
boolean zapwand = FALSE; /* TRUE if we remove a wand charge */
xchar type = DUST; /* Type of engraving made */
+ xchar oetype = 0; /* will be set to type of current engraving */
char buf[BUFSZ]; /* Buffer for final/poly engraving text */
char ebuf[BUFSZ]; /* Buffer for initial engraving text */
char fbuf[BUFSZ]; /* Buffer for "your fingers" */
ebuf[0] = (char) 0;
post_engr_text[0] = (char) 0;
maxelen = BUFSZ - 1;
+ if (oep)
+ oetype = oep->engr_type;
if (is_demon(youmonst.data) || youmonst.data->mlet == S_VAMPIRE)
type = ENGR_BLOOD;
return 0;
if (otmp == &zeroobj) {
- Strcat(strcpy(fbuf, "your "), makeplural(body_part(FINGER)));
+/*JP
+ Strcat(strcpy(fbuf, "your "), body_part(FINGERTIP));
+*/
+ Strcat(strcpy(fbuf, "\82 \82È\82½\82Ì"), body_part(FINGERTIP));
writer = fbuf;
} else
writer = yname(otmp);
/*JP
You("would only make a small smudge on the %s.",
*/
- You("\82Í%s\82É\8f¬\82³\82È\82µ\82Ý\82ð\82Â\82¯\82é\82±\82Æ\82µ\82©\82Å\82«\82È\82©\82Á\82½\81D",
+ You("%s\82ð\8f\82µ\82æ\82²\82·\82±\82Æ\82µ\82©\82Å\82«\82È\82©\82Á\82½\81D",
surface(u.ux, u.uy));
return 0;
} else if (!levl[u.ux][u.uy].disturbed) {
if (!Blind) {
type = (xchar) 0; /* random */
(void) random_engraving(buf);
+ } else {
+ /* keep the same type so that feels don't
+ change and only the text is altered,
+ but you won't know anyway because
+ you're a _blind writer_ */
+ if (oetype)
+ type = oetype;
+ xcrypt(blengr(), buf);
}
dengr = TRUE;
}
"\95X\82Ì\82©\82¯\82ç\82ª\8fñ\82©\82ç\82±\82Ú\82ê\97\8e\82¿\82½\81D");
if (!oep || (oep->engr_type != BURN))
break;
+ /*FALLTHRU*/
case WAN_CANCELLATION:
case WAN_MAKE_INVISIBLE:
if (oep && oep->engr_type != HEADSTONE) {
}
#if 0 /*JP*/
Strcpy(post_engr_text,
- Blind
+ (Blind && !Deaf)
? "You hear drilling!"
- : IS_GRAVE(levl[u.ux][u.uy].typ)
- ? "Chips fly out from the headstone."
- : is_ice(u.ux, u.uy)
- ? "Ice chips fly up from the ice surface!"
- : (level.locations[u.ux][u.uy].typ
- == DRAWBRIDGE_DOWN)
- ? "Splinters fly up from the bridge."
- : "Gravel flies up from the floor.");
+ : Blind
+ ? "You feel tremors."
+ : IS_GRAVE(levl[u.ux][u.uy].typ)
+ ? "Chips fly out from the headstone."
+ : is_ice(u.ux, u.uy)
+ ? "Ice chips fly up from the ice surface!"
+ : (level.locations[u.ux][u.uy].typ
+ == DRAWBRIDGE_DOWN)
+ ? "Splinters fly up from the bridge."
+ : "Gravel flies up from the floor.");
#else
Strcpy(post_engr_text,
Blind
Strcpy(post_engr_text, "\89Î\89Ô\82ª\8fñ\82©\82ç\94ò\82Ñ\8eU\82Á\82½\81D");
doblind = TRUE;
} else
-/*JP
- Strcpy(post_engr_text, "You hear crackling!");
-*/
- Strcpy(post_engr_text, "\83p\83`\83p\83`\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I");
+#if 0 /*JP*/
+ Strcpy(post_engr_text, !Deaf
+ ? "You hear crackling!"
+ : "Your hair stands up!");
+#else
+ Strcpy(post_engr_text, !Deaf
+ ? "\83p\83`\83p\83`\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I"
+ : "\83]\83b\82Æ\82µ\82½\81I");
+#endif
break;
/* type = MARK wands */
/* Something has changed the engraving here */
if (*buf) {
make_engr_at(u.ux, u.uy, buf, moves, type);
+ if (!Blind)
/*JP
pline_The("engraving now reads: \"%s\".", buf);
*/
You("%s\82Å%s\82É%s\81D", doname(otmp), eloc, jpast(everb));
else
#if 0 /*JP*/
- You("%s the %s with your %s.", everb, eloc,
- makeplural(body_part(FINGER)));
+ You("%s the %s with your %s.", everb, eloc, body_part(FINGERTIP));
#else
- You("%s\82Å%s\82É%s\81D", body_part(FINGER),
- eloc, jpast(everb));
+ You("%s\82Å%s\82É%s\81D", body_part(FINGER), eloc, jpast(everb));
#endif
/* Prompt for engraving! */
}
}
+/* to support '#stats' wizard-mode command */
+void
+engr_stats(hdrfmt, hdrbuf, count, size)
+const char *hdrfmt;
+char *hdrbuf;
+long *count, *size;
+{
+ struct engr *ep;
+
+ Sprintf(hdrbuf, hdrfmt, (long) sizeof (struct engr));
+ *count = *size = 0L;
+ for (ep = head_engr; ep; ep = ep->nxt_engr) {
+ ++*count;
+ *size += (long) sizeof *ep + (long) ep->engr_lth;
+ }
+}
+
void
del_engr(ep)
register struct engr *ep;
/* Engrave the headstone */
del_engr_at(x, y);
if (!str)
- str = get_rnd_text(EPITAPHFILE, buf);
+ str = get_rnd_text(EPITAPHFILE, buf, rn2);
make_engr_at(x, y, str, 0L, HEADSTONE);
return;
}
+static const char blind_writing[][21] = {
+ {0x44, 0x66, 0x6d, 0x69, 0x62, 0x65, 0x22, 0x45, 0x7b, 0x71,
+ 0x65, 0x6d, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ {0x51, 0x67, 0x60, 0x7a, 0x7f, 0x21, 0x40, 0x71, 0x6b, 0x71,
+ 0x6f, 0x67, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x49, 0x6d, 0x73, 0x69, 0x62, 0x65, 0x22, 0x4c, 0x61, 0x7c,
+ 0x6d, 0x67, 0x24, 0x42, 0x7f, 0x69, 0x6c, 0x77, 0x67, 0x7e, 0x00},
+ {0x4b, 0x6d, 0x6c, 0x66, 0x30, 0x4c, 0x6b, 0x68, 0x7c, 0x7f,
+ 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x51, 0x67, 0x70, 0x7a, 0x7f, 0x6f, 0x67, 0x68, 0x64, 0x71,
+ 0x21, 0x4f, 0x6b, 0x6d, 0x7e, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x4c, 0x63, 0x76, 0x61, 0x71, 0x21, 0x48, 0x6b, 0x7b, 0x75,
+ 0x67, 0x63, 0x24, 0x45, 0x65, 0x6b, 0x6b, 0x65, 0x00, 0x00, 0x00},
+ {0x4c, 0x67, 0x68, 0x6b, 0x78, 0x68, 0x6d, 0x76, 0x7a, 0x75,
+ 0x21, 0x4f, 0x71, 0x7a, 0x75, 0x6f, 0x77, 0x00, 0x00, 0x00, 0x00},
+ {0x44, 0x66, 0x6d, 0x7c, 0x78, 0x21, 0x50, 0x65, 0x66, 0x65,
+ 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x44, 0x66, 0x73, 0x69, 0x62, 0x65, 0x22, 0x56, 0x7d, 0x63,
+ 0x69, 0x76, 0x6b, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+};
+
+STATIC_OVL const char *
+blengr(VOID_ARGS)
+{
+ return blind_writing[rn2(SIZE(blind_writing))];
+}
+
/*engrave.c*/