deaf-aware fixup
This commit is contained in:
+85
-62
@@ -5,9 +5,11 @@
|
|||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "lev.h"
|
#include "lev.h"
|
||||||
|
#include "sfproto.h"
|
||||||
|
|
||||||
STATIC_VAR NEARDATA struct engr *head_engr;
|
|
||||||
STATIC_DCL const char *NDECL(blengr);
|
static NEARDATA struct engr *head_engr;
|
||||||
|
static const char *NDECL(blengr);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
random_engraving(outbuf)
|
random_engraving(outbuf)
|
||||||
@@ -159,7 +161,7 @@ boolean check_pit;
|
|||||||
|
|
||||||
return (boolean) ((!Levitation || Is_airlevel(&u.uz)
|
return (boolean) ((!Levitation || Is_airlevel(&u.uz)
|
||||||
|| Is_waterlevel(&u.uz))
|
|| Is_waterlevel(&u.uz))
|
||||||
&& (!u.uundetected || !is_hider(youmonst.data)
|
&& (!u.uundetected || !is_hider(g.youmonst.data)
|
||||||
|| u.umonnum == PM_TRAPPER));
|
|| u.umonnum == PM_TRAPPER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +271,7 @@ boolean strict;
|
|||||||
{
|
{
|
||||||
register struct engr *ep = engr_at(x, y);
|
register struct engr *ep = engr_at(x, y);
|
||||||
|
|
||||||
if (ep && ep->engr_type != HEADSTONE && ep->engr_time <= moves) {
|
if (ep && ep->engr_type != HEADSTONE && ep->engr_time <= g.moves) {
|
||||||
return strict ? (fuzzymatch(ep->engr_txt, s, "", TRUE))
|
return strict ? (fuzzymatch(ep->engr_txt, s, "", TRUE))
|
||||||
: (strstri(ep->engr_txt, s) != 0);
|
: (strstri(ep->engr_txt, s) != 0);
|
||||||
}
|
}
|
||||||
@@ -378,7 +380,7 @@ int x, y;
|
|||||||
et = ep->engr_txt;
|
et = ep->engr_txt;
|
||||||
}
|
}
|
||||||
You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et);
|
You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et);
|
||||||
if (context.run > 0)
|
if (g.context.run > 0)
|
||||||
nomul(0);
|
nomul(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,7 +407,7 @@ xchar e_type;
|
|||||||
ep->engr_txt = (char *) (ep + 1);
|
ep->engr_txt = (char *) (ep + 1);
|
||||||
Strcpy(ep->engr_txt, s);
|
Strcpy(ep->engr_txt, s);
|
||||||
/* engraving Elbereth shows wisdom */
|
/* engraving Elbereth shows wisdom */
|
||||||
if (!in_mklev && !strcmp(s, "Elbereth"))
|
if (!g.in_mklev && !strcmp(s, "Elbereth"))
|
||||||
exercise(A_WIS, TRUE);
|
exercise(A_WIS, TRUE);
|
||||||
ep->engr_time = e_time;
|
ep->engr_time = e_time;
|
||||||
ep->engr_type = e_type > 0 ? e_type : rnd(N_ENGRAVE - 1);
|
ep->engr_type = e_type > 0 ? e_type : rnd(N_ENGRAVE - 1);
|
||||||
@@ -494,8 +496,8 @@ doengrave()
|
|||||||
struct obj *otmp; /* Object selected with which to engrave */
|
struct obj *otmp; /* Object selected with which to engrave */
|
||||||
char *writer;
|
char *writer;
|
||||||
|
|
||||||
multi = 0; /* moves consumed */
|
g.multi = 0; /* moves consumed */
|
||||||
nomovemsg = (char *) 0; /* occupation end message */
|
g.nomovemsg = (char *) 0; /* occupation end message */
|
||||||
|
|
||||||
buf[0] = (char) 0;
|
buf[0] = (char) 0;
|
||||||
ebuf[0] = (char) 0;
|
ebuf[0] = (char) 0;
|
||||||
@@ -503,7 +505,7 @@ doengrave()
|
|||||||
maxelen = BUFSZ - 1;
|
maxelen = BUFSZ - 1;
|
||||||
if (oep)
|
if (oep)
|
||||||
oetype = oep->engr_type;
|
oetype = oep->engr_type;
|
||||||
if (is_demon(youmonst.data) || youmonst.data->mlet == S_VAMPIRE)
|
if (is_demon(g.youmonst.data) || is_vampire(g.youmonst.data))
|
||||||
type = ENGR_BLOOD;
|
type = ENGR_BLOOD;
|
||||||
|
|
||||||
/* Can the adventurer engrave at all? */
|
/* Can the adventurer engrave at all? */
|
||||||
@@ -532,7 +534,7 @@ doengrave()
|
|||||||
You_cant("write here.");
|
You_cant("write here.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (cantwield(youmonst.data)) {
|
if (cantwield(g.youmonst.data)) {
|
||||||
You_cant("even hold anything!");
|
You_cant("even hold anything!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -544,10 +546,10 @@ doengrave()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
otmp = getobj(styluses, "write with");
|
otmp = getobj(styluses, "write with");
|
||||||
if (!otmp) /* otmp == zeroobj if fingers */
|
if (!otmp) /* otmp == cg.zeroobj if fingers */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (otmp == &zeroobj) {
|
if (otmp == &cg.zeroobj) {
|
||||||
Strcat(strcpy(fbuf, "your "), body_part(FINGERTIP));
|
Strcat(strcpy(fbuf, "your "), body_part(FINGERTIP));
|
||||||
writer = fbuf;
|
writer = fbuf;
|
||||||
} else
|
} else
|
||||||
@@ -576,7 +578,7 @@ doengrave()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (IS_GRAVE(levl[u.ux][u.uy].typ)) {
|
if (IS_GRAVE(levl[u.ux][u.uy].typ)) {
|
||||||
if (otmp == &zeroobj) { /* using only finger */
|
if (otmp == &cg.zeroobj) { /* using only finger */
|
||||||
You("would only make a small smudge on the %s.",
|
You("would only make a small smudge on the %s.",
|
||||||
surface(u.ux, u.uy));
|
surface(u.ux, u.uy));
|
||||||
return 0;
|
return 0;
|
||||||
@@ -762,7 +764,7 @@ doengrave()
|
|||||||
? "Chips fly out from the headstone."
|
? "Chips fly out from the headstone."
|
||||||
: is_ice(u.ux, u.uy)
|
: is_ice(u.ux, u.uy)
|
||||||
? "Ice chips fly up from the ice surface!"
|
? "Ice chips fly up from the ice surface!"
|
||||||
: (level.locations[u.ux][u.uy].typ
|
: (g.level.locations[u.ux][u.uy].typ
|
||||||
== DRAWBRIDGE_DOWN)
|
== DRAWBRIDGE_DOWN)
|
||||||
? "Splinters fly up from the bridge."
|
? "Splinters fly up from the bridge."
|
||||||
: "Gravel flies up from the floor.");
|
: "Gravel flies up from the floor.");
|
||||||
@@ -792,7 +794,7 @@ doengrave()
|
|||||||
doblind = TRUE;
|
doblind = TRUE;
|
||||||
} else
|
} else
|
||||||
Strcpy(post_engr_text, !Deaf
|
Strcpy(post_engr_text, !Deaf
|
||||||
? "You hear crackling!" /* Deaf-aware */
|
? "You hear crackling!" /* Deaf-aware */
|
||||||
: "Your hair stands up!");
|
: "Your hair stands up!");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -906,7 +908,7 @@ doengrave()
|
|||||||
}
|
}
|
||||||
/* Something has changed the engraving here */
|
/* Something has changed the engraving here */
|
||||||
if (*buf) {
|
if (*buf) {
|
||||||
make_engr_at(u.ux, u.uy, buf, moves, type);
|
make_engr_at(u.ux, u.uy, buf, g.moves, type);
|
||||||
if (!Blind)
|
if (!Blind)
|
||||||
pline_The("engraving now reads: \"%s\".", buf);
|
pline_The("engraving now reads: \"%s\".", buf);
|
||||||
ptext = FALSE;
|
ptext = FALSE;
|
||||||
@@ -1013,7 +1015,7 @@ doengrave()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Tell adventurer what is going on */
|
/* Tell adventurer what is going on */
|
||||||
if (otmp != &zeroobj)
|
if (otmp != &cg.zeroobj)
|
||||||
You("%s the %s with %s.", everb, eloc, doname(otmp));
|
You("%s the %s with %s.", everb, eloc, doname(otmp));
|
||||||
else
|
else
|
||||||
You("%s the %s with your %s.", everb, eloc, body_part(FINGERTIP));
|
You("%s the %s with your %s.", everb, eloc, body_part(FINGERTIP));
|
||||||
@@ -1069,21 +1071,21 @@ doengrave()
|
|||||||
*/
|
*/
|
||||||
switch (type) {
|
switch (type) {
|
||||||
default:
|
default:
|
||||||
multi = -(len / 10);
|
g.multi = -(len / 10);
|
||||||
if (multi)
|
if (g.multi)
|
||||||
nomovemsg = "You finish your weird engraving.";
|
g.nomovemsg = "You finish your weird engraving.";
|
||||||
break;
|
break;
|
||||||
case DUST:
|
case DUST:
|
||||||
multi = -(len / 10);
|
g.multi = -(len / 10);
|
||||||
if (multi)
|
if (g.multi)
|
||||||
nomovemsg = "You finish writing in the dust.";
|
g.nomovemsg = "You finish writing in the dust.";
|
||||||
break;
|
break;
|
||||||
case HEADSTONE:
|
case HEADSTONE:
|
||||||
case ENGRAVE:
|
case ENGRAVE:
|
||||||
multi = -(len / 10);
|
g.multi = -(len / 10);
|
||||||
if (otmp->oclass == WEAPON_CLASS
|
if (otmp->oclass == WEAPON_CLASS
|
||||||
&& (otmp->otyp != ATHAME || otmp->cursed)) {
|
&& (otmp->otyp != ATHAME || otmp->cursed)) {
|
||||||
multi = -len;
|
g.multi = -len;
|
||||||
maxelen = ((otmp->spe + 3) * 2) + 1;
|
maxelen = ((otmp->spe + 3) * 2) + 1;
|
||||||
/* -2 => 3, -1 => 5, 0 => 7, +1 => 9, +2 => 11
|
/* -2 => 3, -1 => 5, 0 => 7, +1 => 9, +2 => 11
|
||||||
* Note: this does not allow a +0 anything (except an athame)
|
* Note: this does not allow a +0 anything (except an athame)
|
||||||
@@ -1093,45 +1095,45 @@ doengrave()
|
|||||||
pline("%s dull.", Yobjnam2(otmp, "get"));
|
pline("%s dull.", Yobjnam2(otmp, "get"));
|
||||||
costly_alteration(otmp, COST_DEGRD);
|
costly_alteration(otmp, COST_DEGRD);
|
||||||
if (len > maxelen) {
|
if (len > maxelen) {
|
||||||
multi = -maxelen;
|
g.multi = -maxelen;
|
||||||
otmp->spe = -3;
|
otmp->spe = -3;
|
||||||
} else if (len > 1)
|
} else if (len > 1)
|
||||||
otmp->spe -= len >> 1;
|
otmp->spe -= len >> 1;
|
||||||
else
|
else
|
||||||
otmp->spe -= 1; /* Prevent infinite engraving */
|
otmp->spe -= 1; /* Prevent infinite engraving */
|
||||||
} else if (otmp->oclass == RING_CLASS || otmp->oclass == GEM_CLASS) {
|
} else if (otmp->oclass == RING_CLASS || otmp->oclass == GEM_CLASS) {
|
||||||
multi = -len;
|
g.multi = -len;
|
||||||
}
|
}
|
||||||
if (multi)
|
if (g.multi)
|
||||||
nomovemsg = "You finish engraving.";
|
g.nomovemsg = "You finish engraving.";
|
||||||
break;
|
break;
|
||||||
case BURN:
|
case BURN:
|
||||||
multi = -(len / 10);
|
g.multi = -(len / 10);
|
||||||
if (multi)
|
if (g.multi)
|
||||||
nomovemsg = is_ice(u.ux, u.uy)
|
g.nomovemsg = is_ice(u.ux, u.uy)
|
||||||
? "You finish melting your message into the ice."
|
? "You finish melting your message into the ice."
|
||||||
: "You finish burning your message into the floor.";
|
: "You finish burning your message into the floor.";
|
||||||
break;
|
break;
|
||||||
case MARK:
|
case MARK:
|
||||||
multi = -(len / 10);
|
g.multi = -(len / 10);
|
||||||
if (otmp->otyp == MAGIC_MARKER) {
|
if (otmp->otyp == MAGIC_MARKER) {
|
||||||
maxelen = otmp->spe * 2; /* one charge / 2 letters */
|
maxelen = otmp->spe * 2; /* one charge / 2 letters */
|
||||||
if (len > maxelen) {
|
if (len > maxelen) {
|
||||||
Your("marker dries out.");
|
Your("marker dries out.");
|
||||||
otmp->spe = 0;
|
otmp->spe = 0;
|
||||||
multi = -(maxelen / 10);
|
g.multi = -(maxelen / 10);
|
||||||
} else if (len > 1)
|
} else if (len > 1)
|
||||||
otmp->spe -= len >> 1;
|
otmp->spe -= len >> 1;
|
||||||
else
|
else
|
||||||
otmp->spe -= 1; /* Prevent infinite graffiti */
|
otmp->spe -= 1; /* Prevent infinite graffiti */
|
||||||
}
|
}
|
||||||
if (multi)
|
if (g.multi)
|
||||||
nomovemsg = "You finish defacing the dungeon.";
|
g.nomovemsg = "You finish defacing the dungeon.";
|
||||||
break;
|
break;
|
||||||
case ENGR_BLOOD:
|
case ENGR_BLOOD:
|
||||||
multi = -(len / 10);
|
g.multi = -(len / 10);
|
||||||
if (multi)
|
if (g.multi)
|
||||||
nomovemsg = "You finish scrawling.";
|
g.nomovemsg = "You finish scrawling.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1142,8 +1144,8 @@ doengrave()
|
|||||||
maxelen--;
|
maxelen--;
|
||||||
if (!maxelen && *sp) {
|
if (!maxelen && *sp) {
|
||||||
*sp = '\0';
|
*sp = '\0';
|
||||||
if (multi)
|
if (g.multi)
|
||||||
nomovemsg = "You cannot write any more.";
|
g.nomovemsg = "You cannot write any more.";
|
||||||
You("are only able to write \"%s\".", ebuf);
|
You("are only able to write \"%s\".", ebuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1152,11 +1154,11 @@ doengrave()
|
|||||||
Strcpy(buf, oep->engr_txt);
|
Strcpy(buf, oep->engr_txt);
|
||||||
(void) strncat(buf, ebuf, BUFSZ - (int) strlen(buf) - 1);
|
(void) strncat(buf, ebuf, BUFSZ - (int) strlen(buf) - 1);
|
||||||
/* Put the engraving onto the map */
|
/* Put the engraving onto the map */
|
||||||
make_engr_at(u.ux, u.uy, buf, moves - multi, type);
|
make_engr_at(u.ux, u.uy, buf, g.moves - g.multi, type);
|
||||||
|
|
||||||
if (post_engr_text[0])
|
if (post_engr_text[0])
|
||||||
pline("%s", post_engr_text);
|
pline("%s", post_engr_text);
|
||||||
if (doblind && !resists_blnd(&youmonst)) {
|
if (doblind && !resists_blnd(&g.youmonst)) {
|
||||||
You("are blinded by the flash!");
|
You("are blinded by the flash!");
|
||||||
make_blinded((long) rnd(50), FALSE);
|
make_blinded((long) rnd(50), FALSE);
|
||||||
if (!Blind)
|
if (!Blind)
|
||||||
@@ -1178,49 +1180,70 @@ sanitize_engravings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
save_engravings(fd, mode)
|
save_engravings(nhfp)
|
||||||
int fd, mode;
|
NHFILE *nhfp;
|
||||||
{
|
{
|
||||||
struct engr *ep, *ep2;
|
struct engr *ep, *ep2;
|
||||||
unsigned no_more_engr = 0;
|
unsigned no_more_engr = 0;
|
||||||
|
|
||||||
for (ep = head_engr; ep; ep = ep2) {
|
for (ep = head_engr; ep; ep = ep2) {
|
||||||
ep2 = ep->nxt_engr;
|
ep2 = ep->nxt_engr;
|
||||||
if (ep->engr_lth && ep->engr_txt[0] && perform_bwrite(mode)) {
|
if (ep->engr_lth && ep->engr_txt[0] && perform_bwrite(nhfp)) {
|
||||||
bwrite(fd, (genericptr_t) &ep->engr_lth, sizeof ep->engr_lth);
|
if (nhfp->structlevel) {
|
||||||
bwrite(fd, (genericptr_t) ep, sizeof (struct engr) + ep->engr_lth);
|
bwrite(nhfp->fd, (genericptr_t)&(ep->engr_lth), sizeof(ep->engr_lth));
|
||||||
|
bwrite(nhfp->fd, (genericptr_t)ep, sizeof(struct engr) + ep->engr_lth);
|
||||||
|
}
|
||||||
|
if (nhfp->fieldlevel) {
|
||||||
|
sfo_unsigned(nhfp, &(ep->engr_lth), "engravings", "engr_lth", 1);
|
||||||
|
sfo_engr(nhfp, ep, "engravings", "engr", 1);
|
||||||
|
sfo_str(nhfp, ep->engr_txt, "engravings", "engr_txt", ep->engr_lth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (release_data(mode))
|
if (release_data(nhfp))
|
||||||
dealloc_engr(ep);
|
dealloc_engr(ep);
|
||||||
}
|
}
|
||||||
if (perform_bwrite(mode))
|
if (perform_bwrite(nhfp)) {
|
||||||
bwrite(fd, (genericptr_t) &no_more_engr, sizeof no_more_engr);
|
if (nhfp->structlevel)
|
||||||
if (release_data(mode))
|
bwrite(nhfp->fd, (genericptr_t)&no_more_engr, sizeof no_more_engr);
|
||||||
|
if (nhfp->fieldlevel)
|
||||||
|
sfo_unsigned(nhfp, &no_more_engr, "engravings", "engr_lth", 1);
|
||||||
|
}
|
||||||
|
if (release_data(nhfp))
|
||||||
head_engr = 0;
|
head_engr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rest_engravings(fd)
|
rest_engravings(nhfp)
|
||||||
int fd;
|
NHFILE *nhfp;
|
||||||
{
|
{
|
||||||
struct engr *ep;
|
struct engr *ep;
|
||||||
unsigned lth;
|
unsigned lth;
|
||||||
|
|
||||||
head_engr = 0;
|
head_engr = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
mread(fd, (genericptr_t) <h, sizeof lth);
|
if (nhfp->structlevel)
|
||||||
|
mread(nhfp->fd, (genericptr_t) <h, sizeof(unsigned));
|
||||||
|
if (nhfp->fieldlevel)
|
||||||
|
sfi_unsigned(nhfp, <h, "engravings", "engr_lth", 1);
|
||||||
|
|
||||||
if (lth == 0)
|
if (lth == 0)
|
||||||
return;
|
return;
|
||||||
ep = newengr(lth);
|
ep = newengr(lth);
|
||||||
mread(fd, (genericptr_t) ep, sizeof (struct engr) + lth);
|
if (nhfp->structlevel) {
|
||||||
|
mread(nhfp->fd, (genericptr_t) ep, sizeof(struct engr) + lth);
|
||||||
|
}
|
||||||
|
if (nhfp->fieldlevel) {
|
||||||
|
sfi_engr(nhfp, ep, "engravings", "engr", 1);
|
||||||
|
ep->engr_txt = (char *) (ep + 1);
|
||||||
|
sfi_str(nhfp, ep->engr_txt, "engravings", "engr_txt", lth);
|
||||||
|
}
|
||||||
ep->nxt_engr = head_engr;
|
ep->nxt_engr = head_engr;
|
||||||
head_engr = ep;
|
head_engr = ep;
|
||||||
ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */
|
ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */
|
||||||
/* Mark as finished for bones levels -- no problem for
|
/* mark as finished for bones levels -- no problem for
|
||||||
* normal levels as the player must have finished engraving
|
* normal levels as the player must have finished engraving
|
||||||
* to be able to move again.
|
* to be able to move again */
|
||||||
*/
|
ep->engr_time = g.moves;
|
||||||
ep->engr_time = moves;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1325,7 +1348,7 @@ static const char blind_writing[][21] = {
|
|||||||
0x69, 0x76, 0x6b, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
0x69, 0x76, 0x6b, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
};
|
};
|
||||||
|
|
||||||
STATIC_OVL const char *
|
static const char *
|
||||||
blengr(VOID_ARGS)
|
blengr(VOID_ARGS)
|
||||||
{
|
{
|
||||||
return blind_writing[rn2(SIZE(blind_writing))];
|
return blind_writing[rn2(SIZE(blind_writing))];
|
||||||
|
|||||||
Reference in New Issue
Block a user