verb agreement

add and use new APIs, Tobjnam, otense and vtense, is_plural
to determine tense/form of verbs and a few pronouns as well
This commit is contained in:
cohrs
2002-02-09 00:30:33 +00:00
parent 91c5521009
commit aac7f717c2
12 changed files with 91 additions and 96 deletions

View File

@@ -173,7 +173,7 @@ register struct obj *obj;
obj->spe = 0;
if (obj->otyp == OIL_LAMP || obj->otyp == BRASS_LANTERN)
obj->age = 0;
Your("%s vibrates briefly.",xname(obj));
Your("%s %s briefly.",xname(obj), otense(obj, "vibrate"));
} else pline(nothing_happens);
}
}
@@ -183,7 +183,7 @@ p_glow1(otmp)
register struct obj *otmp;
{
Your("%s %s briefly.", xname(otmp),
Blind ? "vibrates" : "glows");
otense(otmp, Blind ? "vibrate" : "glow"));
}
static void
@@ -191,10 +191,11 @@ p_glow2(otmp,color)
register struct obj *otmp;
register const char *color;
{
Your("%s %s%s for a moment.",
Your("%s %s%s%s for a moment.",
xname(otmp),
Blind ? "vibrates" : "glows ",
Blind ? (const char *)"" : hcolor(color));
otense(otmp, Blind ? "vibrate" : "glow"),
Blind ? "" : " ",
Blind ? nul : hcolor(color));
}
/* Is the object chargeable? For purposes of inventory display; it is */
@@ -285,8 +286,8 @@ int curse_bless;
/* destruction depends on current state, not adjustment */
if (obj->spe > rn2(7) || obj->spe <= -5) {
Your("%s pulsates momentarily, then explodes!",
xname(obj));
Your("%s %s momentarily, then %s!",
xname(obj), otense(obj,"pulsate"), otense(obj,"explode"));
if (is_on) Ring_gone(obj);
s = rnd(3 * abs(obj->spe)); /* amount of damage */
useup(obj);
@@ -365,7 +366,7 @@ int curse_bless;
stripspe(obj);
if (obj->lamplit) {
if (!Blind)
pline("%s goes out!", The(xname(obj)));
pline("%s out!", Tobjnam(obj, "go"));
end_burn(obj, TRUE);
}
} else if (is_blessed) {
@@ -694,26 +695,28 @@ register struct obj *sobj;
otmp->oerodeproof = !(sobj->cursed);
if(Blind) {
otmp->rknown = FALSE;
Your("%s feels warm for a moment.",
xname(otmp));
Your("%s %s warm for a moment.",
xname(otmp), otense(otmp, "feel"));
} else {
otmp->rknown = TRUE;
Your("%s is covered by a %s %s %s!",
xname(otmp),
Your("%s %s covered by a %s %s %s!",
xname(otmp), otense(otmp, "are"),
sobj->cursed ? "mottled" : "shimmering",
hcolor(sobj->cursed ? Black : golden),
sobj->cursed ? "glow" :
(is_shield(otmp) ? "layer" : "shield"));
}
if (otmp->oerodeproof && (otmp->oeroded || otmp->oeroded2)) {
if (otmp->oerodeproof &&
(otmp->oeroded || otmp->oeroded2)) {
otmp->oeroded = otmp->oeroded2 = 0;
Your("%s %s as good as new!",
xname(otmp), Blind ? "feels" : "looks");
xname(otmp),
otense(otmp, Blind ? "feel" : "look"));
}
break;
}
special_armor = is_elven_armor(otmp) ||
(Role_if(PM_WIZARD) && otmp->otyp == CORNUTHAUM);
(Role_if(PM_WIZARD) && otmp->otyp == CORNUTHAUM);
if (sobj->cursed)
same_color =
(otmp->otyp == BLACK_DRAGON_SCALE_MAIL ||
@@ -728,11 +731,13 @@ register struct obj *sobj;
/* KMH -- catch underflow */
s = sobj->cursed ? -otmp->spe : otmp->spe;
if (s > (special_armor ? 5 : 3) && rn2(s)) {
Your("%s violently %s%s%s for a while, then evaporates.",
xname(otmp),
Blind ? "vibrates" : "glows",
(!Blind && !same_color) ? " " : nul,
(Blind || same_color) ? nul : hcolor(sobj->cursed ? Black : silver));
Your("%s violently %s%s%s for a while, then %s.",
xname(otmp),
otense(otmp, Blind ? "vibrate" : "glow"),
(!Blind && !same_color) ? " " : nul,
(Blind || same_color) ? nul :
hcolor(sobj->cursed ? Black : silver),
otense(otmp, "evaporate"));
if(is_cloak(otmp)) (void) Cloak_off();
if(is_boots(otmp)) (void) Boots_off();
if(is_helmet(otmp)) (void) Helmet_off();
@@ -765,7 +770,7 @@ register struct obj *sobj;
Your("%s %s%s%s%s for a %s.",
xname(otmp),
s == 0 ? "violently " : nul,
Blind ? "vibrates" : "glows",
otense(otmp, Blind ? "vibrate" : "glow"),
(!Blind && !same_color) ? " " : nul,
(Blind || same_color) ? nul : hcolor(sobj->cursed ? Black : silver),
(s*s>1) ? "while" : "moment");
@@ -780,8 +785,8 @@ register struct obj *sobj;
if ((otmp->spe > (special_armor ? 5 : 3)) &&
(special_armor || !rn2(7)))
Your("%s suddenly vibrates %s.",
xname(otmp),
Your("%s suddenly %s %s.",
xname(otmp), otense(otmp, "vibrate"),
Blind ? "again" : "unexpectedly");
break;
}
@@ -808,7 +813,7 @@ register struct obj *sobj;
} else
known = TRUE;
} else { /* armor and scroll both cursed */
Your("%s vibrates.", xname(otmp));
Your("%s %s.", xname(otmp), otense(otmp, "vibrate"));
if (otmp->spe >= -6) otmp->spe--;
make_stunned(HStun + rn1(10, 10), TRUE);
}

View File

@@ -335,7 +335,7 @@ rndcurse() /* curse a few inventory items at random! */
if(otmp->oartifact && spec_ability(otmp, SPFX_INTEL) &&
rn2(10) < 8) {
pline("%s resists!", The(xname(otmp)));
pline("%s!", Tobjnam(otmp, "resist"));
continue;
}

View File

@@ -322,7 +322,7 @@ register struct monst *mtmp;
else
growl_verb = growl_sound(mtmp);
if (growl_verb) {
pline("%s %s!", Monnam(mtmp), makeplural(growl_verb));
pline("%s %s!", Monnam(mtmp), vtense((char *)0, growl_verb));
if(flags.run) nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 18);
}
@@ -363,7 +363,7 @@ register struct monst *mtmp;
break;
}
if (yelp_verb) {
pline("%s %ss!", Monnam(mtmp), yelp_verb);
pline("%s %s!", Monnam(mtmp), vtense((char *)0, yelp_verb));
if(flags.run) nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 12);
}
@@ -395,7 +395,7 @@ register struct monst *mtmp;
break;
}
if (whimper_verb) {
pline("%s %ss.", Monnam(mtmp), whimper_verb);
pline("%s %s.", Monnam(mtmp), vtense((char *)0, whimper_verb));
if(flags.run) nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 6);
}

View File

@@ -132,7 +132,7 @@ cursed_book(lev)
Your("gloves seem unaffected.");
} else if (uarmg->oeroded2 < MAX_ERODE) {
if (uarmg->greased) {
grease_protect(uarmg, "gloves", TRUE, &youmonst);
grease_protect(uarmg, "gloves", &youmonst);
} else {
Your("gloves corrode%s!",
uarmg->oeroded2+1 == MAX_ERODE ?

View File

@@ -433,8 +433,7 @@ register struct obj *otmp;
attacktype(mtmp->data, AT_ENGL)) {
/* this is probably a burning object that you dropped or threw */
if (u.uswallow && mtmp == u.ustuck && !Blind)
pline("%s go%s out.", The(xname(otmp)),
otmp->quan == 1L ? "es" : "");
pline("%s out.", Tobjnam(otmp, "go"));
snuff_otmp = TRUE;
}
/* Must do carrying effects on object prior to add_to_minv() */

View File

@@ -120,7 +120,6 @@ struct monst *victim;
static NEARDATA const char *action[] = { "smoulder", "rust", "rot", "corrode" };
static NEARDATA const char *msg[] = { "burnt", "rusted", "rotten", "corroded" };
boolean vulnerable = FALSE;
boolean plural;
boolean grprot = FALSE;
boolean is_primary = TRUE;
boolean vismon = (victim != &youmonst) && canseemon(victim);
@@ -146,40 +145,37 @@ struct monst *victim;
if (!print && (!vulnerable || otmp->oerodeproof || erosion == MAX_ERODE))
return FALSE;
plural = (is_gloves(otmp) || is_boots(otmp)) &&
!strstri(ostr, "pair of "); /* "pair of *s" is singular */
if (!vulnerable) {
if (flags.verbose) {
if (victim == &youmonst)
Your("%s %s not affected.", ostr, plural ? "are" : "is");
Your("%s %s not affected.", ostr, vtense(ostr, "are"));
else if (vismon)
pline("%s's %s %s not affected.", Monnam(victim), ostr,
plural ? "are" : "is");
vtense(ostr, "are"));
}
} else if (erosion < MAX_ERODE) {
if (grprot && otmp->greased) {
grease_protect(otmp,ostr,plural,victim);
grease_protect(otmp,ostr,victim);
} else if (otmp->oerodeproof || (otmp->blessed && !rnl(4))) {
if (flags.verbose) {
if (victim == &youmonst)
pline("Somehow, your %s %s not affected.",
ostr, plural ? "are" : "is");
ostr, vtense(ostr, "are"));
else if (vismon)
pline("Somehow, %s's %s %s not affected.",
mon_nam(victim), ostr, plural ? "are" : "is");
mon_nam(victim), ostr, vtense(ostr, "are"));
}
} else {
if (victim == &youmonst)
Your("%s %s%s%s!", ostr, action[type],
plural ? "" : "s",
erosion+1 == MAX_ERODE ? " completely" :
erosion ? " further" : "");
Your("%s %s%s!", ostr,
vtense(ostr, action[type]),
erosion+1 == MAX_ERODE ? " completely" :
erosion ? " further" : "");
else if (vismon)
pline("%s's %s %s%s%s!", Monnam(victim), ostr, action[type],
plural ? "" : "s",
pline("%s's %s %s%s!", Monnam(victim), ostr,
vtense(ostr, action[type]),
erosion+1 == MAX_ERODE ? " completely" :
erosion ? " further" : "");
erosion ? " further" : "");
if (is_primary)
otmp->oeroded++;
else
@@ -189,23 +185,22 @@ struct monst *victim;
} else {
if (flags.verbose) {
if (victim == &youmonst)
Your("%s %s%s completely %s.", ostr,
Blind ? "feel" : "look",
plural ? "" : "s", msg[type]);
Your("%s %s completely %s.", ostr,
vtense(ostr, Blind ? "feel" : "look"),
msg[type]);
else if (vismon)
pline("%s's %s look%s completely %s.",
Monnam(victim), ostr,
plural ? "" : "s", msg[type]);
pline("%s's %s %s completely %s.",
Monnam(victim), ostr,
vtense(ostr, "look"), msg[type]);
}
}
return(TRUE);
}
void
grease_protect(otmp,ostr,plu,victim)
grease_protect(otmp,ostr,victim)
register struct obj *otmp;
register const char *ostr;
register boolean plu;
struct monst *victim;
{
static const char txt[] = "protected by the layer of grease!";
@@ -213,10 +208,10 @@ struct monst *victim;
if (ostr) {
if (victim == &youmonst)
Your("%s %s %s",ostr,plu ? "are" : "is", txt);
Your("%s %s %s", ostr, vtense(ostr, "are"), txt);
else if (vismon)
pline("%s's %s %s %s", Monnam(victim),
ostr, plu ? "are" : "is", txt);
ostr, vtense(ostr, "are"), txt);
} else {
if (victim == &youmonst)
Your("%s %s",aobjnam(otmp,"are"), txt);
@@ -2375,7 +2370,7 @@ xchar x, y;
} else if (is_flammable(obj) && obj->oeroded < MAX_ERODE &&
!(obj->oerodeproof || (obj->blessed && !rnl(4)))) {
if (in_sight) {
pline("%s burn%s%s.", Yname2(obj), obj->quan > 1 ? "": "s",
pline("%s %s%s.", Yname2(obj), otense(obj, "burn"),
obj->oeroded+1 == MAX_ERODE ? " completely" :
obj->oeroded ? " further" : "");
}
@@ -3292,7 +3287,7 @@ boolean disarm;
insider = (*u.ushops && inside_shop(u.ux, u.uy) &&
*in_rooms(ox, oy, SHOPBASE) == *u.ushops);
pline("%s explodes!", The(xname(obj)));
pline("%s!", Tobjnam(obj, "explode"));
Sprintf(buf, "exploding %s", xname(obj));
if(costly)

View File

@@ -588,9 +588,9 @@ int thrown;
setmnotwielded(mon,monwep);
MON_NOWEP(mon);
mon->weapon_check = NEED_WEAPON;
pline("%s %s shatter%s from the force of your blow!",
pline("%s %s %s from the force of your blow!",
s_suffix(Monnam(mon)), xname(monwep),
(monwep->quan) == 1L ? "s" : "");
otense(monwep, "shatter"));
m_useup(mon, monwep);
/* If someone just shattered MY weapon, I'd flee! */
if (rn2(4)) {
@@ -868,8 +868,8 @@ int thrown;
}
if (obj && !rn2(nopoison)) {
obj->opoisoned = FALSE;
Your("%s%s no longer poisoned.", xname(obj),
(obj->quan == 1L) ? " is" : "s are"); /**FIXME**/
Your("%s %s no longer poisoned.", xname(obj),
otense(obj, "are"));
}
if (resists_poison(mon))
needpoismsg = TRUE;

View File

@@ -622,7 +622,7 @@ register struct monst *mon;
if (bimanual(mw_tmp)) mon_hand = makeplural(mon_hand);
Sprintf(welded_buf, "%s welded to %s %s",
(mw_tmp->quan == 1L) ? "is" : "are",
otense(mw_tmp, "are"),
mhis(mon), mon_hand);
if (obj->otyp == PICK_AXE) {
@@ -651,8 +651,7 @@ register struct monst *mon;
if (obj->cursed && obj->otyp != CORPSE) {
pline("%s %s to %s %s!",
The(xname(obj)),
(obj->quan == 1L) ? "welds itself"
: "weld themselves",
is_plural(obj) ? "welds itself" : "weld themselves",
s_suffix(mon_nam(mon)), mbodypart(mon,HAND));
obj->bknown = 1;
}
@@ -660,8 +659,8 @@ register struct monst *mon;
if (artifact_light(obj) && !obj->lamplit) {
begin_burn(obj, FALSE);
if (canseemon(mon))
pline("%s glows brilliantly in %s %s!",
The(xname(obj)),
pline("%s brilliantly in %s %s!",
Tobjnam(obj, "glow"),
s_suffix(mon_nam(mon)), mbodypart(mon,HAND));
}
obj->owornmask = W_WEP;
@@ -1215,8 +1214,9 @@ register struct obj *obj;
if (artifact_light(obj) && obj->lamplit) {
end_burn(obj, FALSE);
if (canseemon(mon))
pline("%s in %s %s stops glowing.", The(xname(obj)),
s_suffix(mon_nam(mon)), mbodypart(mon,HAND));
pline("%s in %s %s %s glowing.", The(xname(obj)),
s_suffix(mon_nam(mon)), mbodypart(mon,HAND),
otense(obj, "stop"));
}
obj->owornmask &= ~W_WEP;
}

View File

@@ -101,7 +101,7 @@ register struct obj *obj;
setworn(obj, W_WEP);
if (uwep == obj && artifact_light(olduwep) && olduwep->lamplit) {
end_burn(olduwep, FALSE);
if (!Blind) pline("%s stops glowing.", The(xname(olduwep)));
if (!Blind) pline("%s glowing.", Tobjnam(olduwep, "stop"));
}
/* Note: Explicitly wielding a pick-axe will not give a "bashing"
* message. Wielding one via 'a'pplying it will.
@@ -184,7 +184,7 @@ struct obj *wep;
if (artifact_light(wep) && !wep->lamplit) {
begin_burn(wep, FALSE);
if (!Blind)
pline("%s begins to glow brilliantly!", The(xname(wep)));
pline("%s to glow brilliantly!", Tobjnam(wep, "begin"));
}
#if 0
@@ -369,7 +369,7 @@ dowieldquiver()
} else if (newquiver == uwep) {
/* Prevent accidentally readying the main weapon */
pline("%s already being used as a weapon!",
(uwep->quan == 1L) ? "That is" : "They are");
!is_plural(uwep) ? "That is" : "They are");
return(0);
} else if (newquiver->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL
#ifdef STEED
@@ -415,15 +415,15 @@ can_twoweapon()
else if (NOT_WEAPON(uwep) || NOT_WEAPON(uswapwep)) {
otmp = NOT_WEAPON(uwep) ? uwep : uswapwep;
pline("%s %s.", Yname2(otmp),
(otmp->quan) > 1L ? "aren't weapons" : "isn't a weapon");
is_plural(otmp) ? "aren't weapons" : "isn't a weapon");
} else if (bimanual(uwep) || bimanual(uswapwep)) {
otmp = bimanual(uwep) ? uwep : uswapwep;
pline("%s isn't one-handed.", Yname2(otmp));
} else if (uarms)
You_cant("use two weapons while wearing a shield.");
else if (uswapwep->oartifact)
pline("%s resists being held second to another weapon!",
Yname2(uswapwep));
pline("%s %s being held second to another weapon!",
Yname2(uswapwep), otense(uswapwep, "resist"));
else if (!uarmg && !Stone_resistance && (uswapwep->otyp == CORPSE &&
touch_petrifies(&mons[uswapwep->corpsenm]))) {
char kbuf[BUFSZ];
@@ -481,7 +481,7 @@ uwepgone()
if (uwep) {
if (artifact_light(uwep) && uwep->lamplit) {
end_burn(uwep, FALSE);
if (!Blind) pline("%s stops glowing.", The(xname(uwep)));
if (!Blind) pline("%s glowing.", Tobjnam(uwep, "stop"));
}
setworn((struct obj *)0, W_WEP);
unweapon = TRUE;
@@ -540,7 +540,7 @@ boolean fade_scrolls;
erosion = acid_dmg ? target->oeroded2 : target->oeroded;
if (target->greased) {
grease_protect(target,(char *)0,FALSE,victim);
grease_protect(target,(char *)0,victim);
} else if (target->oclass == SCROLL_CLASS) {
if(fade_scrolls && target->otyp != SCR_BLANK_PAPER
#ifdef MAIL
@@ -650,9 +650,9 @@ register int amount;
if(((uwep->spe > 5 && amount >= 0) || (uwep->spe < -5 && amount < 0))
&& rn2(3)) {
if (!Blind)
Your("%s %s for a while and then evaporate%s.",
Your("%s %s for a while and then %s.",
aobjnam(uwep, "violently glow"), color,
uwep->quan == 1L ? "s" : "");
otense(uwep, "evaporate"));
else
Your("%s.", aobjnam(uwep, "evaporate"));
@@ -709,7 +709,7 @@ register struct obj *obj;
savewornmask = obj->owornmask;
Your("%s %s welded to your %s!",
xname(obj), (obj->quan == 1L) ? "is" : "are",
xname(obj), otense(obj, "are"),
bimanual(obj) ? (const char *)makeplural(body_part(HAND))
: body_part(HAND));
obj->owornmask = savewornmask;

View File

@@ -64,11 +64,11 @@ amulet()
if(ttmp->ttyp == MAGIC_PORTAL) {
int du = distu(ttmp->tx, ttmp->ty);
if (du <= 9)
pline("%s feels hot!", The(xname(amu)));
pline("%s hot!", Tobjnam(amu, "feel"));
else if (du <= 64)
pline("%s feels very warm.", The(xname(amu)));
pline("%s very warm.", Tobjnam(amu, "feel"));
else if (du <= 144)
pline("%s feels warm.", The(xname(amu)));
pline("%s warm.", Tobjnam(amu, "feel"));
/* else, the amulet feels normal */
break;
}

View File

@@ -85,8 +85,8 @@ register struct obj *pen;
return 0;
} else if (Glib) {
dropx(pen);
pline("%s slips from your %s.", The(xname(pen)),
makeplural(body_part(FINGER)));
pline("%s from your %s.",
Tobjnam(pen, "slip"), makeplural(body_part(FINGER)));
return 1;
}

View File

@@ -1446,7 +1446,7 @@ struct obj *obj, *otmp;
return 0;
else {
#ifdef DEBUG
pline("%s pulsates for a moment.", The(xname(obj)));
pline("%s for a moment.", Tobjnam(obj, "pulsate"));
#endif
obj->bypass = 0;
}
@@ -1499,7 +1499,7 @@ struct obj *obj, *otmp;
obj->dknown = 1;
if (Has_contents(obj)) {
if (!obj->cobj)
pline("%s is empty.", The(xname(obj)));
pline("%s empty.", Tobjnam(obj, "are"));
else {
struct obj *o;
/* view contents (not recursively) */
@@ -1815,7 +1815,7 @@ dozap()
current_wand = 0;
}
if (obj && obj->spe < 0) {
pline("%s turns to dust.", The(xname(obj)));
pline("%s to dust.", Tobjnam(obj, "turn"));
useup(obj);
}
update_inventory(); /* maybe used a charge */
@@ -2515,12 +2515,10 @@ register const char *str;
register struct monst *mtmp;
register const char *force; /* usually either "." or "!" */
{
int pl = strcmp(str, makesingular(str));
if((!cansee(bhitpos.x,bhitpos.y) && !canspotmon(mtmp))
|| !flags.verbose)
pline("%s %s it.", The(str), pl ? "hit" : "hits");
else pline("%s %s %s%s", The(str), pl ? "hit" : "hits",
pline("%s %s it.", The(str), vtense(str, "hit"));
else pline("%s %s %s%s", The(str), vtense(str, "hit"),
mon_nam(mtmp), force);
}
@@ -2529,9 +2527,7 @@ miss(str,mtmp)
register const char *str;
register struct monst *mtmp;
{
int pl = strcmp(str, makesingular(str));
pline("%s %s %s.", The(str), pl ? "miss" : "misses",
pline("%s %s %s.", The(str), vtense(str, "miss"),
((cansee(bhitpos.x,bhitpos.y) || canspotmon(mtmp))
&& flags.verbose) ?
mon_nam(mtmp) : "it");