From a33f1edd249c3d3a9865272a68cc31e2d00f9ea7 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 4 Jul 2024 14:27:28 -0700 Subject: [PATCH] YMonnam(monst) Replace several upstart(y_monnam(mon)) with new YMonnam(mon) to produce "Your little dog" and such. Also change one or two Monnam(mon) to YMonnam(mon) and one pline(...) to pline_mon(mon, ...). --- include/extern.h | 3 ++- src/apply.c | 8 ++++---- src/do_name.c | 22 ++++++++++++++++------ src/hack.c | 33 +++++++++++++++------------------ src/makemon.c | 12 ++++++------ src/steed.c | 6 +++--- src/trap.c | 4 ++-- 7 files changed, 48 insertions(+), 40 deletions(-) diff --git a/include/extern.h b/include/extern.h index a5d0f24e4..58774113f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 extern.h $NHDT-Date: 1718303205 2024/06/13 18:26:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1426 $ */ +/* NetHack 3.7 extern.h $NHDT-Date: 1720128155 2024/07/04 21:22:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1430 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -649,6 +649,7 @@ extern char *Some_Monnam(struct monst *) NONNULLARG1; extern char *noname_monnam(struct monst *, int) NONNULLARG1; extern char *m_monnam(struct monst *) NONNULLARG1; extern char *y_monnam(struct monst *) NONNULLARG1; +extern char *YMonnam(struct monst *) NONNULLARG1; extern char *Adjmonnam(struct monst *, const char *) NONNULLARG1; extern char *Amonnam(struct monst *) NONNULLARG1; extern char *a_monnam(struct monst *) NONNULLARG1; diff --git a/src/apply.c b/src/apply.c index 7988bbce4..4773d3c86 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 apply.c $NHDT-Date: 1708126533 2024/02/16 23:35:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.437 $ */ +/* NetHack 3.7 apply.c $NHDT-Date: 1720128162 2024/07/04 21:22:42 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.449 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -716,7 +716,8 @@ m_unleash(struct monst *mtmp, boolean feedback) if (feedback) { if (canseemon(mtmp)) - pline_mon(mtmp, "%s pulls free of %s leash!", Monnam(mtmp), mhis(mtmp)); + pline_mon(mtmp, "%s pulls free of %s leash!", + Monnam(mtmp), mhis(mtmp)); else Your("leash falls slack."); } @@ -2046,8 +2047,7 @@ jump(int magic) /* 0=Physical, otherwise skill level */ if (!is_valid_jump_pos(cc.x, cc.y, magic, TRUE)) { return ECMD_FAIL; } else if (u.usteed && u_at(cc.x, cc.y)) { - pline("%s isn't capable of jumping in place.", - upstart(y_monnam(u.usteed))); + pline("%s isn't capable of jumping in place.", YMonnam(u.usteed)); return ECMD_FAIL; } else { coord uc; diff --git a/src/do_name.c b/src/do_name.c index c1574618a..01b5d0cf3 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 do_name.c $NHDT-Date: 1708126536 2024/02/16 23:35:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.307 $ */ +/* NetHack 3.7 do_name.c $NHDT-Date: 1720128164 2024/07/04 21:22:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.319 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1061,7 +1061,7 @@ Monnam(struct monst *mtmp) char *bp = mon_nam(mtmp); *bp = highc(*bp); - return bp; + return bp; } char * @@ -1070,7 +1070,7 @@ noit_Monnam(struct monst *mtmp) char *bp = noit_mon_nam(mtmp); *bp = highc(*bp); - return bp; + return bp; } char * @@ -1079,7 +1079,7 @@ Some_Monnam(struct monst *mtmp) char *bp = some_mon_nam(mtmp); *bp = highc(*bp); - return bp; + return bp; } /* return "a dog" rather than "Fido", honoring hallucination and visibility */ @@ -1113,6 +1113,16 @@ y_monnam(struct monst *mtmp) return x_monnam(mtmp, prefix, (char *) 0, suppression_flag, FALSE); } +/* y_monnam() for start of sentence */ +char * +YMonnam(struct monst *mtmp) +{ + char *bp = y_monnam(mtmp); + + *bp = highc(*bp); + return bp; +} + char * Adjmonnam(struct monst *mtmp, const char *adj) { @@ -1120,7 +1130,7 @@ Adjmonnam(struct monst *mtmp, const char *adj) has_mgivenname(mtmp) ? SUPPRESS_SADDLE : 0, FALSE); *bp = highc(*bp); - return bp; + return bp; } char * @@ -1136,7 +1146,7 @@ Amonnam(struct monst *mtmp) char *bp = a_monnam(mtmp); *bp = highc(*bp); - return bp; + return bp; } /* used for monster ID by the '/', ';', and 'C' commands to block remote diff --git a/src/hack.c b/src/hack.c index 1432a06d9..2836500e8 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 hack.c $NHDT-Date: 1715022473 2024/05/06 19:07:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.447 $ */ +/* NetHack 3.7 hack.c $NHDT-Date: 1720128165 2024/07/04 21:22:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.449 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -389,7 +389,7 @@ moverock(void) case TELEP_TRAP: if (u.usteed) pline("%s pushes %s and suddenly it disappears!", - upstart(y_monnam(u.usteed)), the(xname(otmp))); + YMonnam(u.usteed), the(xname(otmp))); else You("push %s and suddenly it disappears!", the(xname(otmp))); @@ -450,8 +450,7 @@ moverock(void) exercise(A_STR, TRUE); } else { if (givemesg) - pline("%s moves %s.", - upstart(y_monnam(u.usteed)), what); + pline("%s moves %s.", YMonnam(u.usteed), what); } gb.bldrpushtime = gm.moves; } @@ -489,7 +488,7 @@ moverock(void) what = the(xname(otmp)); if (u.usteed) pline("%s tries to move %s, but cannot.", - upstart(y_monnam(u.usteed)), what); + YMonnam(u.usteed), what); else You("try to move %s, but in vain.", what); if (Blind) @@ -1075,7 +1074,7 @@ test_move( } else if (dx && dy && worm_cross(ux, uy, x, y)) { /* consecutive long worm segments are at and */ if (mode == DO_MOVE) - pline("%s is in your way.", Monnam(m_at(ux, y))); + pline("%s is in your way.", YMonnam(m_at(ux, y))); return FALSE; } /* Pick travel path that does not require crossing a trap. @@ -2009,20 +2008,20 @@ domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y) didnt_move = TRUE; } else if (u.ux0 != x && u.uy0 != y && NODIAG(mtmp->data - mons)) { /* can't swap places when pet can't move to your spot */ - You("stop. %s can't move diagonally.", upstart(y_monnam(mtmp))); + You("stop. %s can't move diagonally.", YMonnam(mtmp)); didnt_move = TRUE; } else if (u_with_boulder && !(verysmall(mtmp->data) && (!mtmp->minvent || curr_mon_load(mtmp) <= 600))) { /* can't swap places when pet won't fit there with the boulder */ You("stop. %s won't fit into the same spot that you're at.", - upstart(y_monnam(mtmp))); + YMonnam(mtmp)); didnt_move = TRUE; } else if (u.ux0 != x && u.uy0 != y && bad_rock(mtmp->data, x, u.uy0) && bad_rock(mtmp->data, u.ux0, y) && (bigmonst(mtmp->data) || (curr_mon_load(mtmp) > 600))) { /* can't swap places when pet won't fit thru the opening */ - You("stop. %s won't fit through.", upstart(y_monnam(mtmp))); + You("stop. %s won't fit through.", YMonnam(mtmp)); didnt_move = TRUE; } else if (mtmp->mpeaceful && mtmp->mtrapped) { /* all mtame are also mpeaceful, so this affects pets too */ @@ -2034,8 +2033,7 @@ domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y) feeltrap(trap); /* show on map once mtmp is out of the way */ which = just_an(anbuf, what); /* "a " or "an " */ } - You("stop. %s can't move out of %s%s.", - upstart(y_monnam(mtmp)), which, what); + You("stop. %s can't move out of %s%s.", YMonnam(mtmp), which, what); handle_tip(TIP_UNTRAP_MON); didnt_move = TRUE; } else if (mtmp->mpeaceful @@ -2044,8 +2042,7 @@ domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y) || mundisplaceable(mtmp))) { /* displacing peaceful into unsafe or trapped space, or trying to displace quest leader, Oracle, shopkeeper, priest, or vault guard */ - You("stop. %s doesn't want to swap places.", - upstart(y_monnam(mtmp))); + You("stop. %s doesn't want to swap places.", YMonnam(mtmp)); didnt_move = TRUE; } else { mtmp->mtrapped = 0; @@ -2460,7 +2457,7 @@ escape_from_sticky_mon(coordxy x, coordxy y) */ mtmp = u.ustuck; set_ustuck((struct monst *) 0); - You("release %s.", mon_nam(mtmp)); + You("release %s.", y_monnam(mtmp)); } else { /* If holder is asleep or paralyzed: * 37.5% chance of getting away, @@ -2478,7 +2475,7 @@ escape_from_sticky_mon(coordxy x, coordxy y) pull_free: mtmp = u.ustuck; set_ustuck((struct monst *) 0); - You("pull free from %s.", mon_nam(mtmp)); + You("pull free from %s.", y_monnam(mtmp)); break; case 3: if (!u.ustuck->mcanmove) { @@ -2490,7 +2487,7 @@ escape_from_sticky_mon(coordxy x, coordxy y) default: if (u.ustuck->mtame && !Conflict && !u.ustuck->mconf) goto pull_free; - You("cannot escape from %s!", mon_nam(u.ustuck)); + You("cannot escape from %s!", y_monnam(u.ustuck)); nomul(0); return TRUE; } @@ -2733,7 +2730,7 @@ domove_core(void) mtmp->mux = u.ux, mtmp->muy = u.uy; pline("%s swaps places with you...", - !noticed_it ? Something : Monnam(mtmp)); + !noticed_it ? Something : YMonnam(mtmp)); if (!canspotmon(mtmp)) map_invisible(u.ux0, u.uy0); /* monster chose to swap places; hero doesn't get any credit @@ -3673,7 +3670,7 @@ lookaround(void) || (infront && !gc.context.travel)) { if (flags.mention_walls) pline_xy(x, y, "%s blocks your path.", - upstart(a_monnam(mtmp))); + upstart(a_monnam(mtmp))); goto stop; } } diff --git a/src/makemon.c b/src/makemon.c index 2e2662210..249cfc6c7 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 makemon.c $NHDT-Date: 1713334814 2024/04/17 06:20:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.245 $ */ +/* NetHack 3.7 makemon.c $NHDT-Date: 1720128166 2024/07/04 21:22:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.249 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1999,11 +1999,11 @@ grow_up(struct monst *mtmp, struct monst *victim) slightly less sexist if prepared for it...) */ : (fem && !mtmp->female) ? "female " : "", pmname(ptr, fem)); - pline("%s %s %s.", upstart(y_monnam(mtmp)), - (fem != mtmp->female) ? "changes into" - : humanoid(ptr) ? "becomes" - : "grows up into", - an(buf)); + pline_mon(mtmp, "%s %s %s.", YMonnam(mtmp), + (fem != mtmp->female) ? "changes into" + : humanoid(ptr) ? "becomes" + : "grows up into", + an(buf)); } set_mon_data(mtmp, ptr); if (mtmp->cham == oldtype && is_shapeshifter(ptr)) diff --git a/src/steed.c b/src/steed.c index 7866939f9..0fae5a4ca 100644 --- a/src/steed.c +++ b/src/steed.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 steed.c $NHDT-Date: 1702274036 2023/12/11 05:53:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.115 $ */ +/* NetHack 3.7 steed.c $NHDT-Date: 1720128167 2024/07/04 21:22:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.121 $ */ /* Copyright (c) Kevin Hugo, 1998-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -869,12 +869,12 @@ stucksteed(boolean checkfeeding) if (steed) { /* check whether steed can move */ if (helpless(steed)) { - pline("%s won't move!", upstart(y_monnam(steed))); + pline("%s won't move!", YMonnam(steed)); return TRUE; } /* optionally check whether steed is in the midst of a meal */ if (checkfeeding && steed->meating) { - pline("%s is still eating.", upstart(y_monnam(steed))); + pline("%s is still eating.", YMonnam(steed)); return TRUE; } } diff --git a/src/trap.c b/src/trap.c index 301d686ae..5aaaee0de 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 trap.c $NHDT-Date: 1717884802 2024/06/08 22:13:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.598 $ */ +/* NetHack 3.7 trap.c $NHDT-Date: 1720128169 2024/07/04 21:22:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.602 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4082,7 +4082,7 @@ climb_pit(void) many times without further user intervention by using a run attempt to keep retrying to escape from the pit) */ if (u.usteed) - Norep("%s is still in a pit.", upstart(y_monnam(u.usteed))); + Norep("%s is still in a pit.", YMonnam(u.usteed)); else Norep((Hallucination && !rn2(5)) ? "You've fallen, and you can't get up."