hats vs helms

Something from <Someone>'s list:  some messages have hardcoded references
to "helmet" which sound strange when the character is wearing a hat or cap.
helm_simple_name() is comparable to the existing cloak_simple_name().  It
returns "helm" or "hat" depending upon whether the helmet provides the
same protection that yields the assorted repetitions of "fortunately,
you are wearing a hard helmet".  This choice ends up categorizing elven
leather helm as a hat (which I think is ok given that its undiscovered
description is "leather hat"), contrary to <Someone>'s suggestion that the
distinction be made based on whether the helmet was made of cloth.

     I started on this a year and a half ago but didn't commit it.
Unfortunately I don't remember why and haven't done any significant
additional work now--just recovered from some intervening bit rot and
confirmed that the patch as is seems to be working ok (in the trunk; the
branch side has not been tested).  I suspect that I meant to look for
additional helmet messages which could benefit from conditional headgear
description.  (Those "hard helmet" ones don't need it, although they
should perhaps be moved into a common routine instead of being replicated.)
This commit is contained in:
nethack.rankin
2004-11-13 04:00:52 +00:00
parent 88dad9386b
commit 7672a2c60b
10 changed files with 67 additions and 27 deletions
+1
View File
@@ -62,6 +62,7 @@ incorrect screen display if engulfer gets turned to stone when trying to
panic on subsequent move if engulfer gets turned to stone and poly'd hero panic on subsequent move if engulfer gets turned to stone and poly'd hero
also has attached ball&chain also has attached ball&chain
give more specific messages when dropping weapons due to slippery fingers give more specific messages when dropping weapons due to slippery fingers
various helmet messages changed to distinguish between "helm" and "hat"
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+2 -1
View File
@@ -1432,13 +1432,14 @@ E char *FDECL(yname, (struct obj *));
E char *FDECL(Yname2, (struct obj *)); E char *FDECL(Yname2, (struct obj *));
E char *FDECL(ysimple_name, (struct obj *)); E char *FDECL(ysimple_name, (struct obj *));
E char *FDECL(Ysimple_name2, (struct obj *)); E char *FDECL(Ysimple_name2, (struct obj *));
E char *FDECL(bare_artifactname, (struct obj *));
E char *FDECL(makeplural, (const char *)); E char *FDECL(makeplural, (const char *));
E char *FDECL(makesingular, (const char *)); E char *FDECL(makesingular, (const char *));
E struct obj *FDECL(readobjnam, (char *,struct obj *,BOOLEAN_P)); E struct obj *FDECL(readobjnam, (char *,struct obj *,BOOLEAN_P));
E int FDECL(rnd_class, (int,int)); E int FDECL(rnd_class, (int,int));
E const char *FDECL(cloak_simple_name, (struct obj *)); E const char *FDECL(cloak_simple_name, (struct obj *));
E const char *FDECL(helm_simple_name, (struct obj *));
E const char *FDECL(mimic_obj_name, (struct monst *)); E const char *FDECL(mimic_obj_name, (struct monst *));
E char *FDECL(bare_artifactname, (struct obj *));
/* ### options.c ### */ /* ### options.c ### */
+10 -5
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)do_wear.c 3.4 2004/10/29 */ /* SCCS Id: @(#)do_wear.c 3.4 2004/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1180,7 +1180,10 @@ register struct obj *otmp;
if(delay) { if(delay) {
nomul(delay); nomul(delay);
if (is_helmet(otmp)) { if (is_helmet(otmp)) {
nomovemsg = "You finish taking off your helmet."; /* ick... */
nomovemsg = !strcmp(helm_simple_name(otmp), "hat") ?
"You finish taking off your hat." :
"You finish taking off your helmet.";
afternmv = Helmet_off; afternmv = Helmet_off;
} }
else if (is_gloves(otmp)) { else if (is_gloves(otmp)) {
@@ -1282,13 +1285,14 @@ boolean noisy;
if (is_helmet(otmp)) { if (is_helmet(otmp)) {
if (uarmh) { if (uarmh) {
if (noisy) already_wearing(an(c_helmet)); if (noisy) already_wearing(an(helm_simple_name(uarmh)));
err++; err++;
} else if (Upolyd && has_horns(youmonst.data) && !is_flimsy(otmp)) { } else if (Upolyd && has_horns(youmonst.data) && !is_flimsy(otmp)) {
/* (flimsy exception matches polyself handling) */ /* (flimsy exception matches polyself handling) */
if (noisy) if (noisy)
pline_The("%s won't fit over your horn%s.", pline_The("%s won't fit over your horn%s.",
c_helmet, plur(num_horns(youmonst.data))); helm_simple_name(otmp),
plur(num_horns(youmonst.data)));
err++; err++;
} else } else
*mask = W_ARMH; *mask = W_ARMH;
@@ -2146,7 +2150,8 @@ register struct obj *atmp;
#endif #endif
} else if (DESTROY_ARM(uarmh)) { } else if (DESTROY_ARM(uarmh)) {
if (donning(otmp)) cancel_don(); if (donning(otmp)) cancel_don();
Your("helmet turns to dust and is blown away!"); Your("%s turns to dust and is blown away!",
helm_simple_name(uarmh));
(void) Helmet_off(); (void) Helmet_off();
useup(otmp); useup(otmp);
} else if (DESTROY_ARM(uarmg)) { } else if (DESTROY_ARM(uarmg)) {
+3 -2
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)hack.c 3.4 2004/08/16 */ /* SCCS Id: @(#)hack.c 3.4 2004/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1626,7 +1626,8 @@ stillinwater:;
if(mtmp->mtame) /* jumps to greet you, not attack */ if(mtmp->mtame) /* jumps to greet you, not attack */
; ;
else if(uarmh && is_metallic(uarmh)) else if(uarmh && is_metallic(uarmh))
pline("Its blow glances off your helmet."); pline("Its blow glances off your %s.",
helm_simple_name(uarmh));
else if (u.uac + 3 <= rnd(20)) else if (u.uac + 3 <= rnd(20))
You("are almost hit by %s!", You("are almost hit by %s!",
x_monnam(mtmp, ARTICLE_A, "falling", 0, TRUE)); x_monnam(mtmp, ARTICLE_A, "falling", 0, TRUE));
+6 -5
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mhitu.c 3.4 2004/10/27 */ /* SCCS Id: @(#)mhitu.c 3.4 2004/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -371,8 +371,8 @@ mattacku(mtmp)
obj = which_armor(mtmp, WORN_HELMET); obj = which_armor(mtmp, WORN_HELMET);
if (obj && is_metallic(obj)) { if (obj && is_metallic(obj)) {
Your("blow glances off %s helmet.", Your("blow glances off %s %s.",
s_suffix(mon_nam(mtmp))); s_suffix(mon_nam(mtmp)), helm_simple_name(obj));
} else { } else {
if (3 + find_mac(mtmp) <= rnd(20)) { if (3 + find_mac(mtmp) <= rnd(20)) {
pline("%s is hit by a falling piercer (you)!", pline("%s is hit by a falling piercer (you)!",
@@ -1053,7 +1053,8 @@ dopois:
if (uarmh && rn2(8)) { if (uarmh && rn2(8)) {
/* not body_part(HEAD) */ /* not body_part(HEAD) */
Your("helmet blocks the attack to your head."); Your("%s blocks the attack to your head.",
helm_simple_name(uarmh));
break; break;
} }
if (Half_physical_damage) dmg = (dmg+1) / 2; if (Half_physical_damage) dmg = (dmg+1) / 2;
@@ -2260,7 +2261,7 @@ register struct monst *mon;
if(!uwep || !welded(uwep)) if(!uwep || !welded(uwep))
mayberem(uarmg, "gloves"); mayberem(uarmg, "gloves");
mayberem(uarms, "shield"); mayberem(uarms, "shield");
mayberem(uarmh, "helmet"); mayberem(uarmh, helm_simple_name(uarmh));
#ifdef TOURIST #ifdef TOURIST
if(!uarmc && !uarm) if(!uarmc && !uarm)
mayberem(uarmu, "shirt"); mayberem(uarmu, "shirt");
+21 -1
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)objnam.c 3.4 2004/08/02 */ /* SCCS Id: @(#)objnam.c 3.4 2004/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2811,6 +2811,26 @@ struct obj *cloak;
return "cloak"; return "cloak";
} }
/* helm vs hat for messages */
const char *
helm_simple_name(helmet)
struct obj *helmet;
{
/*
* There is some wiggle room here; the result has been chosen
* for consistency with the "protected by hard helmet" messages
* given for various bonks on the head: headgear that provides
* such protection is a "helm", that which doesn't is a "hat".
*
* elven leather helm / leather hat -> hat
* dwarvish iron helm / hard hat -> helm
* The rest are completely straightforward:
* fedora, cornuthaum, dunce cap -> hat
* all other types of helmets -> helm
*/
return (helmet && !is_metallic(helmet)) ? "hat" : "helm";
}
const char * const char *
mimic_obj_name(mtmp) mimic_obj_name(mtmp)
struct monst *mtmp; struct monst *mtmp;
+5 -3
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)polyself.c 3.4 2003/01/08 */ /* SCCS Id: @(#)polyself.c 3.4 2004/11/11 */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -651,7 +651,8 @@ break_armor()
hornbuf, vtense(hornbuf, "pierce"), yname(otmp)); hornbuf, vtense(hornbuf, "pierce"), yname(otmp));
} else { } else {
if (donning(otmp)) cancel_don(); if (donning(otmp)) cancel_don();
Your("helmet falls to the %s!", surface(u.ux, u.uy)); Your("%s falls to the %s!",
helm_simple_name(otmp), surface(u.ux, u.uy));
(void) Helmet_off(); (void) Helmet_off();
dropx(otmp); dropx(otmp);
} }
@@ -673,7 +674,8 @@ break_armor()
} }
if ((otmp = uarmh) != 0) { if ((otmp = uarmh) != 0) {
if (donning(otmp)) cancel_don(); if (donning(otmp)) cancel_don();
Your("helmet falls to the %s!", surface(u.ux, u.uy)); Your("%s falls to the %s!",
helm_simple_name(otmp), surface(u.ux, u.uy));
(void) Helmet_off(); (void) Helmet_off();
dropx(otmp); dropx(otmp);
} }
+3 -2
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)steal.c 3.4 2003/12/04 */ /* SCCS Id: @(#)steal.c 3.4 2004/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -21,7 +21,8 @@ register struct obj *otmp;
(otmp == uarms) ? "shield" : (otmp == uarms) ? "shield" :
(otmp == uarmg) ? "gloves" : (otmp == uarmg) ? "gloves" :
(otmp == uarmc) ? cloak_simple_name(otmp) : (otmp == uarmc) ? cloak_simple_name(otmp) :
(otmp == uarmh) ? "helmet" : "armor"); (otmp == uarmh) ? helm_simple_name(otmp) :
"armor");
} }
#ifndef GOLDOBJ #ifndef GOLDOBJ
+7 -4
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)trap.c 3.4 2004/09/10 */ /* SCCS Id: @(#)trap.c 3.4 2004/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -55,7 +55,8 @@ struct monst *victim;
item = (victim == &youmonst) ? uarmh : which_armor(victim, W_ARMH); item = (victim == &youmonst) ? uarmh : which_armor(victim, W_ARMH);
if (item) { if (item) {
mat_idx = objects[item->otyp].oc_material; mat_idx = objects[item->otyp].oc_material;
Sprintf(buf,"%s helmet", materialnm[mat_idx] ); Sprintf(buf,"%s %s",
materialnm[mat_idx], helm_simple_name(item));
} }
if (!burn_dmg(item, item ? buf : "helmet")) continue; if (!burn_dmg(item, item ? buf : "helmet")) continue;
break; break;
@@ -850,7 +851,8 @@ unsigned trflags;
case 0: case 0:
pline("%s you on the %s!", A_gush_of_water_hits, pline("%s you on the %s!", A_gush_of_water_hits,
body_part(HEAD)); body_part(HEAD));
(void) rust_dmg(uarmh, "helmet", 1, TRUE, &youmonst); (void) rust_dmg(uarmh, helm_simple_name(uarmh),
1, TRUE, &youmonst);
break; break;
case 1: case 1:
pline("%s your left %s!", A_gush_of_water_hits, pline("%s your left %s!", A_gush_of_water_hits,
@@ -1903,7 +1905,8 @@ register struct monst *mtmp;
pline("%s %s on the %s!", A_gush_of_water_hits, pline("%s %s on the %s!", A_gush_of_water_hits,
mon_nam(mtmp), mbodypart(mtmp, HEAD)); mon_nam(mtmp), mbodypart(mtmp, HEAD));
target = which_armor(mtmp, W_ARMH); target = which_armor(mtmp, W_ARMH);
(void) rust_dmg(target, "helmet", 1, TRUE, mtmp); (void) rust_dmg(target, helm_simple_name(target),
1, TRUE, mtmp);
break; break;
case 1: case 1:
if (in_sight) if (in_sight)
+9 -4
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)uhitm.c 3.4 2004/06/12 */ /* SCCS Id: @(#)uhitm.c 3.4 2004/11/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1545,6 +1545,9 @@ register struct attack *mattk;
} }
break; break;
case AD_DRIN: case AD_DRIN:
{
struct obj *helmet;
if (notonhead || !has_head(mdef->data)) { if (notonhead || !has_head(mdef->data)) {
pline("%s doesn't seem harmed.", Monnam(mdef)); pline("%s doesn't seem harmed.", Monnam(mdef));
tmp = 0; tmp = 0;
@@ -1558,9 +1561,10 @@ register struct attack *mattk;
} }
if (m_slips_free(mdef, mattk)) break; if (m_slips_free(mdef, mattk)) break;
if ((mdef->misc_worn_check & W_ARMH) && rn2(8)) { if ((helmet = which_armor(mdef, W_ARMH)) != 0 && rn2(8)) {
pline("%s helmet blocks your attack to %s head.", pline("%s %s blocks your attack to %s head.",
s_suffix(Monnam(mdef)), mhis(mdef)); s_suffix(Monnam(mdef)),
helm_simple_name(helmet), mhis(mdef));
break; break;
} }
@@ -1588,6 +1592,7 @@ register struct attack *mattk;
} }
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
break; break;
}
case AD_STCK: case AD_STCK:
if (!negated && !sticks(mdef->data)) if (!negated && !sticks(mdef->data))
u.ustuck = mdef; /* it's now stuck to you */ u.ustuck = mdef; /* it's now stuck to you */