fix bz265 - accessibility fix for reluctant pet

Requested by a blind player.  The message "Fido moves only reluctantly"
didn't convey enough information to be useful.  Describe the reason why
the move is reluctant:  "Fido steps reluctantly over <some object>."

If there is a pile, it will describe the top item rather than whichever
cursed item the pet doesn't want to step on.
This commit is contained in:
PatR
2015-12-30 23:38:11 -08:00
parent 7be8e1f8bb
commit a236f9d5f6
2 changed files with 28 additions and 13 deletions
+2
View File
@@ -75,6 +75,8 @@ teleporting or polymorphing a sink via ring drop shouldn't depend upon being
change "unlockable chest" to "broken chest" so that it won't be misunderstood change "unlockable chest" to "broken chest" so that it won't be misunderstood
("capable of being unlocked" vs intended "not capable of being locked") ("capable of being unlocked" vs intended "not capable of being locked")
use doname instead of xname when using '/' or ';' to look at objects on map use doname instead of xname when using '/' or ';' to look at objects on map
when a pet moves reluctantly, name the top item of the pile it is reluctant
to step on if the hero sees or remembers any object(s) at that spot
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+26 -13
View File
@@ -405,9 +405,10 @@ int udist;
omx = mtmp->mx; omx = mtmp->mx;
omy = mtmp->my; omy = mtmp->my;
/* if we are carrying something then we drop it (perhaps near @) */ /* If we are carrying something then we drop it (perhaps near @).
/* Note: if apport == 1 then our behaviour is independent of udist */ * Note: if apport == 1 then our behaviour is independent of udist.
/* Use udist+1 so steed won't cause divide by zero */ * Use udist+1 so steed won't cause divide by zero.
*/
if (droppables(mtmp)) { if (droppables(mtmp)) {
if (!rn2(udist + 1) || !rn2(edog->apport)) if (!rn2(udist + 1) || !rn2(edog->apport))
if (rn2(10) < edog->apport) { if (rn2(10) < edog->apport) {
@@ -459,7 +460,7 @@ int udist;
return 0; return 0;
} }
/* set dog's goal -- gtyp, gx, gy /* set dog's goal -- gtyp, gx, gy;
returns -1/0/1 (dog's desire to approach player) or -2 (abort move) */ returns -1/0/1 (dog's desire to approach player) or -2 (abort move) */
STATIC_OVL int STATIC_OVL int
dog_goal(mtmp, edog, after, udist, whappr) dog_goal(mtmp, edog, after, udist, whappr)
@@ -613,7 +614,7 @@ int after, udist, whappr;
int int
dog_move(mtmp, after) dog_move(mtmp, after)
register struct monst *mtmp; register struct monst *mtmp;
register int after; /* this is extra fast monster movement */ int after; /* this is extra fast monster movement */
{ {
int omx, omy; /* original mtmp position */ int omx, omy; /* original mtmp position */
int appr, whappr, udist; int appr, whappr, udist;
@@ -794,6 +795,7 @@ register int after; /* this is extra fast monster movement */
&& better_with_displacing && !undesirable_disp(mtmp, nx, ny)) { && better_with_displacing && !undesirable_disp(mtmp, nx, ny)) {
int mstatus; int mstatus;
register struct monst *mtmp2 = m_at(nx, ny); register struct monst *mtmp2 = m_at(nx, ny);
mstatus = mdisplacem(mtmp, mtmp2, FALSE); /* displace monster */ mstatus = mdisplacem(mtmp, mtmp2, FALSE); /* displace monster */
if (mstatus & MM_DEF_DIED) if (mstatus & MM_DEF_DIED)
return 2; return 2;
@@ -814,12 +816,13 @@ register int after; /* this is extra fast monster movement */
if (mtmp->mleashed) { if (mtmp->mleashed) {
if (!Deaf) if (!Deaf)
whimper(mtmp); whimper(mtmp);
} else } else {
/* 1/40 chance of stepping on it anyway, in case /* 1/40 chance of stepping on it anyway, in case
* it has to pass one to follow the player... * it has to pass one to follow the player...
*/ */
if (trap->tseen && rn2(40)) if (trap->tseen && rn2(40))
continue; continue;
}
} }
} }
@@ -827,9 +830,9 @@ register int after; /* this is extra fast monster movement */
/* (minion isn't interested; `cursemsg' stays FALSE) */ /* (minion isn't interested; `cursemsg' stays FALSE) */
if (has_edog) if (has_edog)
for (obj = level.objects[nx][ny]; obj; obj = obj->nexthere) { for (obj = level.objects[nx][ny]; obj; obj = obj->nexthere) {
if (obj->cursed) if (obj->cursed) {
cursemsg[i] = TRUE; cursemsg[i] = TRUE;
else if ((otyp = dogfood(mtmp, obj)) < MANFOOD } else if ((otyp = dogfood(mtmp, obj)) < MANFOOD
&& (otyp < ACCFOOD && (otyp < ACCFOOD
|| edog->hungrytime <= monstermoves)) { || edog->hungrytime <= monstermoves)) {
/* Note: our dog likes the food so much that he /* Note: our dog likes the food so much that he
@@ -906,13 +909,23 @@ newdogpos:
wasseen = canseemon(mtmp); wasseen = canseemon(mtmp);
remove_monster(omx, omy); remove_monster(omx, omy);
place_monster(mtmp, nix, niy); place_monster(mtmp, nix, niy);
if (cursemsg[chi] && (wasseen || canseemon(mtmp))) if (cursemsg[chi] && (wasseen || canseemon(mtmp))) {
pline("%s moves only reluctantly.", noit_Monnam(mtmp)); /* describe top item of pile, not necessarily cursed item itself;
don't use glyph_at() here--it would return the pet but we want
to know whether an object is remembered at this map location */
struct obj *o = (!Hallucination
&& glyph_is_object(levl[nix][niy].glyph))
? vobj_at(nix, niy) : 0;
const char *what = o ? distant_name(o, doname) : something;
pline("%s %s reluctantly over %s.", noit_Monnam(mtmp),
vtense((char *) 0, locomotion(mtmp->data, "step")), what);
}
for (j = MTSZ - 1; j > 0; j--) for (j = MTSZ - 1; j > 0; j--)
mtmp->mtrack[j] = mtmp->mtrack[j - 1]; mtmp->mtrack[j] = mtmp->mtrack[j - 1];
mtmp->mtrack[0].x = omx; mtmp->mtrack[0].x = omx;
mtmp->mtrack[0].y = omy; mtmp->mtrack[0].y = omy;
/* We have to know if the pet's gonna do a combined eat and /* We have to know if the pet's going to do a combined eat and
* move before moving it, but it can't eat until after being * move before moving it, but it can't eat until after being
* moved. Thus the do_eat flag. * moved. Thus the do_eat flag.
*/ */
@@ -1012,7 +1025,7 @@ xchar mx, my, fx, fy;
return FALSE; return FALSE;
} }
/*ARGSUSED*/ /* do_clear_area client */ /* do_clear_area client */
STATIC_PTR void STATIC_PTR void
wantdoor(x, y, distance) wantdoor(x, y, distance)
int x, y; int x, y;