-/* NetHack 3.6 engrave.c $NHDT-Date: 1456304550 2016/02/24 09:02:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */
+/* NetHack 3.6 engrave.c $NHDT-Date: 1570318925 2019/10/05 23:42:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.75 $ */
/* 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-2019 */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2021 */
/* 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;
if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
return FALSE;
if (check_pit && !Flying
- && (t = t_at(u.ux, u.uy)) != 0 && uteetering_at_seen_pit(t))
+ && (t = t_at(u.ux, u.uy)) != 0
+ && (uteetering_at_seen_pit(t) || uescaped_shaft(t)))
return FALSE;
return (boolean) ((!Levitation || Is_airlevel(&u.uz)
int x, y;
boolean up, check_pit;
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You("can't reach the %s.",
up ? ceiling(x, y)
: (check_pit && can_reach_floor(FALSE))
*/
return "\8bó\92\86";
else if (is_pool(x, y))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
return (Underwater && !Is_waterlevel(&u.uz))
? "bottom" : hliquid("water");
#else
void
wipe_engr_at(x, y, cnt, magical)
-xchar x, y, cnt, magical;
+xchar x, y, cnt;
+boolean magical;
{
register struct engr *ep = engr_at(x, y);
{
register struct engr *ep = engr_at(x, y);
int sensed = 0;
- char buf[BUFSZ];
/* Sensing an engraving does not require sight,
* nor does it necessarily imply comprehension (literacy).
case DUST:
if (!Blind) {
sensed = 1;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s is written here in the %s.", Something,
is_ice(x, y) ? "frost" : "dust");
#else
case BURN:
if (!Blind || can_reach_floor(TRUE)) {
sensed = 1;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("Some text has been %s into the %s here.",
is_ice(x, y) ? "melted" : "burned", surface(x, y));
#else
impossible("%s is written in a very strange way.", Something);
sensed = 1;
}
+
if (sensed) {
- char *et;
+ char *et, buf[BUFSZ];
+ int maxelen = (int) (sizeof buf
+ /* sizeof "literal" counts terminating \0 */
/*JP
- unsigned maxelen = BUFSZ - sizeof("You feel the words: \"\". ");
+ - sizeof "You feel the words: \"\".");
*/
- unsigned maxelen = BUFSZ - sizeof("\82 \82È\82½\82Í\8e\9f\82Ì\82æ\82¤\82É\8a´\82¶\82½\81F\81u\81v");
- if (strlen(ep->engr_txt) > maxelen) {
- (void) strncpy(buf, ep->engr_txt, (int) maxelen);
+ - sizeof "\82 \82È\82½\82Í\8e\9f\82Ì\82æ\82¤\82É\8a´\82¶\82½\81F\81u\81v");
+
+ if ((int) strlen(ep->engr_txt) > maxelen) {
+ (void) strncpy(buf, ep->engr_txt, maxelen);
buf[maxelen] = '\0';
et = buf;
- } else
+ } else {
et = ep->engr_txt;
+ }
/*JP
You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et);
*/
You("%s\81F\81u%s\81v", (Blind) ? "\8e\9f\82Ì\82æ\82¤\82É\8a´\82¶\82½" : "\93Ç\82ñ\82¾", et);
- if (context.run > 1)
+ if (context.run > 0)
nomul(0);
}
}
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;
/*JP
You("tickle %s with %s.", mon_nam(u.ustuck), writer);
*/
- You("%s\82Å%s\82ð\82\82·\82®\82Á\82½\81D", writer, mon_nam(u.ustuck));
+ You("%s\82Å%s\82ð\82\82·\82®\82Á\82½\81D", writer, mon_nam(u.ustuck));
/*JP
Your("message dissolves...");
*/
- Your("\83\81\83b\83Z\81[\83W\82Í\8fÁ\82¦\82½\81D\81D\81D");
+ Your("\83\81\83b\83Z\81[\83W\82Í\8fÁ\82¦\82½\81D\81D\81D");
return 0;
}
if (otmp->oclass != WAND_CLASS && !can_reach_floor(TRUE)) {
case FOOD_CLASS:
case SCROLL_CLASS:
case SPBOOK_CLASS:
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s would get %s.", Yname2(otmp),
is_ice(u.ux, u.uy) ? "all frosty" : "too dirty");
#else
/*JP
"The wand unsuccessfully fights your attempt to write!");
*/
- "\82 \82È\82½\82ª\8f\91\82±\82¤\82Æ\82·\82é\82Æ\8fñ\82Í\92ï\8dR\82µ\82½\81I");
+ "\82 \82È\82½\82ª\8f\91\82±\82¤\82Æ\82·\82é\82Æ\8fñ\82Í\92ï\8dR\82µ\82½\81I");
break;
case WAN_SLOW_MONSTER:
if (!Blind) {
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;
}
pline("\82±\82ê\82Í\8c\8a\8c@\82è\82Ì\8fñ\82¾\81I");
doknown = TRUE;
}
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Strcpy(post_engr_text,
(Blind && !Deaf)
- ? "You hear drilling!"
+ ? "You hear drilling!" /* Deaf-aware */
: Blind
? "You feel tremors."
: IS_GRAVE(levl[u.ux][u.uy].typ)
: "Gravel flies up from the floor.");
#else
Strcpy(post_engr_text,
- Blind
- ? "\8c\8a\82ª\8aJ\82\89¹\82ð\95·\82¢\82½\81I"
- : IS_GRAVE(levl[u.ux][u.uy].typ)
- ? "\95æ\90Î\82©\82ç\94j\95Ð\82ª\94ò\82Ñ\8eU\82Á\82½\81D"
- : is_ice(u.ux,u.uy)
- ? "\95X\82Ì\95\\96Ê\82©\82ç\95X\82Ì\82©\82¯\82ç\82ª\94ò\82Ñ\8eU\82Á\82½\81D"
- : (level.locations[u.ux][u.uy].typ
- == DRAWBRIDGE_DOWN)
- ? "\94j\95Ð\82ª\8b´\82©\82ç\95\91\82¢\82 \82ª\82Á\82½\81D"
- : "\8d»\97\98\82ª\8f°\82©\82ç\94ò\82Ñ\8eU\82Á\82½\81D");
+ (Blind && !Deaf)
+ ? "\8c\8a\82ª\8aJ\82\89¹\82ð\95·\82¢\82½\81I" /* Deaf-aware */
+ : Blind
+ ? "\90U\93®\82ð\8a´\82¶\82½\81D"
+ : IS_GRAVE(levl[u.ux][u.uy].typ)
+ ? "\95æ\90Î\82©\82ç\94j\95Ð\82ª\94ò\82Ñ\8eU\82Á\82½\81D"
+ : is_ice(u.ux,u.uy)
+ ? "\95X\82Ì\95\\96Ê\82©\82ç\95X\82Ì\82©\82¯\82ç\82ª\94ò\82Ñ\8eU\82Á\82½\81D"
+ : (level.locations[u.ux][u.uy].typ
+ == DRAWBRIDGE_DOWN)
+ ? "\94j\95Ð\82ª\8b´\82©\82ç\95\91\82¢\82 \82ª\82Á\82½\81D"
+ : "\8d»\97\98\82ª\8f°\82©\82ç\94ò\82Ñ\8eU\82Á\82½\81D");
#endif
break;
/* type = BURN wands */
pline("\82±\82ê\82Í\89\8a\82Ì\8fñ\82¾\81I");
doknown = TRUE;
}
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Strcpy(post_engr_text, Blind ? "You feel the wand heat up."
: "Flames fly from the wand.");
#else
Strcpy(post_engr_text, "\89Î\89Ô\82ª\8fñ\82©\82ç\94ò\82Ñ\8eU\82Á\82½\81D");
doblind = TRUE;
} else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Strcpy(post_engr_text, !Deaf
- ? "You hear crackling!"
+ ? "You hear crackling!" /* Deaf-aware */
: "Your hair stands up!");
#else
Strcpy(post_engr_text, !Deaf
- ? "\83p\83`\83p\83`\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I"
+ ? "\83p\83`\83p\83`\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I" /* Deaf-aware */
: "\83]\83b\82Æ\82µ\82½\81I");
#endif
break;
*/
You("\83\81\83b\83Z\81[\83W\82ð\90@\82«\82Æ\82Á\82½\81D");
else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s %s.", Yobjnam2(otmp, "get"),
is_ice(u.ux, u.uy) ? "frosty" : "dusty");
#else
*/
pline("\82±\82Ì\95¶\8e\9a\82Í%s\82Å\82Í\90@\82«\82Æ\82ê\82È\82¢\81D", xname(otmp));
else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s %s.", Yobjnam2(otmp, "get"),
is_ice(u.ux, u.uy) ? "frosty" : "dusty");
#else
/* 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);
+ pline_The("engraving now reads: \"%s\".", buf);
*/
- pline("\8d\8f\82Ü\82ê\82½\95¶\8e\9a\82ð\93Ç\82ñ\82¾\81F\81u%s\81v\81D", buf);
+ pline("\8d\8f\82Ü\82ê\82½\95¶\8e\9a\82ð\93Ç\82ñ\82¾\81F\81u%s\81v\81D", buf);
ptext = FALSE;
}
if (zapwand && (otmp->spe < 0)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s %sturns to dust.", The(xname(otmp)),
Blind ? "" : "glows violently, then ");
#else
Blind ? "" : "\8c\83\82µ\82\8bP\82«\81C");
#endif
if (!IS_GRAVE(levl[u.ux][u.uy].typ))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You(
"are not going to get anywhere trying to write in the %s with your dust.",
is_ice(u.ux, u.uy) ? "frost" : "dust");
|| oep->engr_type == ENGR_BLOOD
|| oep->engr_type == MARK) {
if (!Blind) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You("wipe out the message that was %s here.",
(oep->engr_type == DUST)
? "written in the dust"
*/
eow = TRUE;
} else if (type == DUST || type == MARK || type == ENGR_BLOOD) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You("cannot wipe out the message that is %s the %s here.",
oep->engr_type == BURN
? (is_ice(u.ux, u.uy) ? "melted into" : "burned into")
: "engraved in",
surface(u.ux, u.uy));
#else
- You("%s\83\81\83b\83Z\81[\83W\82ð\90@\82«\82Æ\82ê\82È\82©\82Á\82½\81D",
+ You("%s\82É%s\83\81\83b\83Z\81[\83W\82ð\90@\82«\82Æ\82ê\82È\82©\82Á\82½\81D",
+ surface(u.ux, u.uy),
oep->engr_type == BURN
? (is_ice(u.ux, u.uy) ? "\8d\8f\82Ü\82ê\82Ä\82¢\82é" : "\8fÄ\82«\95t\82¯\82ç\82ê\82Ä\82¢\82é")
: "\8d\8f\82Ü\82ê\82Ä\82¢\82é");
everb = (oep && !eow ? "\8d\8f\82Ý\89Á\82¦\82é" : "\8d\8f\82Þ");
break;
case BURN:
-#if 0 /*JP*/
+#if 0 /*JP:T*/
everb = (oep && !eow
? (is_ice(u.ux, u.uy) ? "add to the text melted into"
: "add to the text burned into")
*/
You("%s\82Å%s\82É%s\81D", doname(otmp), eloc, jpast(everb));
else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
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));
if (len == 0 || index(ebuf, '\033')) {
if (zapwand) {
if (!Blind)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s, then %s.", Tobjnam(otmp, "glow"),
otense(otmp, "fade"));
#else
/* 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*/