From: Pasi Kallinen Date: Sun, 27 Feb 2022 09:06:41 +0000 (+0200) Subject: Use more u_locomotion X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d4d0f4b0edfcc14834244dbefdb5028991860a7;p=nethack Use more u_locomotion ... and make it autocapitalize the first letter, just like locomotion --- diff --git a/src/do.c b/src/do.c index 0a6f7597c..37717f6b8 100644 --- a/src/do.c +++ b/src/do.c @@ -1097,8 +1097,7 @@ dodown(void) if (trap) { const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through"; - const char *actn = Flying ? "fly" - : locomotion(g.youmonst.data, "jump"); + const char *actn = u_locomotion("jump"); if (g.youmonst.data->msize >= MZ_HUGE) { char qbuf[QBUFSZ]; @@ -1577,7 +1576,7 @@ goto_level( if (flags.verbose || great_effort) pline("%s %s up%s the %s.", great_effort ? "With great effort, you" : "You", - Levitation ? "float" : Flying ? "fly" : "climb", + u_locomotion("climb"), (Flying && g.at_ladder) ? " along" : "", g.at_ladder ? "ladder" : "stairs"); } else { /* down */ diff --git a/src/hack.c b/src/hack.c index eac0fccf9..cfc3f20c2 100644 --- a/src/hack.c +++ b/src/hack.c @@ -187,8 +187,7 @@ moverock(void) spot without pushing it; hero is poly'd into a giant, so exotic forms of locomotion are out, but might be levitating (ring, potion, spell) or flying (amulet) */ - You("%s over a boulder here.", - Levitation ? "float" : Flying ? "fly" : "step"); + You("%s over a boulder here.", u_locomotion("step")); /* ["over" seems weird on air level but what else to say?] */ sokoban_guilt(); res = 0; /* move to */ @@ -1535,11 +1534,14 @@ check_buried_zombies(xchar x, xchar y) } } +/* return an appropriate locomotion word for hero */ const char * u_locomotion(const char *def) { - return Levitation ? "levitate" - : Flying ? "fly" + boolean capitalize = (*def == highc(*def)); + + return Levitation ? (capitalize ? "Float" : "float") + : Flying ? (capitalize ? "Fly" : "fly") : locomotion(g.youmonst.data, def); } @@ -2980,7 +2982,7 @@ check_special_room(boolean newlev) break; case MORGUE: if (midnight()) { - const char *run = locomotion(g.youmonst.data, "Run"); + const char *run = u_locomotion("Run"); pline("%s away! %s away!", run, run); } else diff --git a/src/mon.c b/src/mon.c index 4349a577d..6d08a9afe 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2806,7 +2806,7 @@ monstone(struct monst* mdef) if (wasinside) { if (is_animal(mdef->data)) You("%s through an opening in the new %s.", - locomotion(g.youmonst.data, "jump"), xname(otmp)); + u_locomotion("jump"), xname(otmp)); } } diff --git a/src/steed.c b/src/steed.c index 834840fa2..bbca3f729 100644 --- a/src/steed.c +++ b/src/steed.c @@ -507,7 +507,7 @@ dismount_steed( case DISMOUNT_THROWN: case DISMOUNT_FELL: verb = (reason == DISMOUNT_THROWN) ? "are thrown" - : ulev ? "float" : ufly ? "fly" : "fall"; + : u_locomotion("fall"); You("%s off of %s!", verb, mon_nam(mtmp)); if (!have_spot) have_spot = landing_spot(&cc, reason, 1); diff --git a/src/teleport.c b/src/teleport.c index 60034361c..c128ae8f4 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -696,8 +696,7 @@ dotele( } } if (trap) - You("%s onto the teleportation trap.", - locomotion(g.youmonst.data, "jump")); + You("%s onto the teleportation trap.", u_locomotion("jump")); } else trap = 0; } @@ -1119,9 +1118,7 @@ level_tele_trap(struct trap* trap, unsigned int trflags) Strcpy(verbbuf, "trigger"); /* follows "You sit down." */ intentional = TRUE; } else - Sprintf(verbbuf, "%s onto", - Levitation ? (const char *) "float" - : locomotion(g.youmonst.data, "step")); + Sprintf(verbbuf, "%s onto", u_locomotion("step")); You("%s a level teleport trap!", verbbuf); if (Antimagic && !intentional) { diff --git a/src/trap.c b/src/trap.c index ab00c0738..5b926ed1f 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1858,9 +1858,7 @@ trapeffect_web( x_monnam(u.usteed, steed_article, "poor", SUPPRESS_SADDLE, FALSE)); } else { - Sprintf(verbbuf, "%s into", - Levitation ? (const char *) "float" - : locomotion(g.youmonst.data, "stumble")); + Sprintf(verbbuf, "%s into", u_locomotion("stumble")); } You("%s %s spider web!", verbbuf, a_your[trap->madeby_u]); } @@ -2155,9 +2153,7 @@ trapeffect_poly_trap( x_monnam(u.usteed, steed_article, (char *) 0, SUPPRESS_SADDLE, FALSE)); else - Sprintf(verbbuf, "%s onto", - Levitation ? (const char *) "float" - : locomotion(g.youmonst.data, "step")); + Sprintf(verbbuf, "%s onto", u_locomotion("step")); You("%s a polymorph trap!", verbbuf); if (Antimagic || Unchanging) { shieldeff(u.ux, u.uy); @@ -2499,7 +2495,7 @@ dotrap(struct trap *trap, unsigned trflags) } else if (!forcetrap) { if (floor_trigger(ttype) && check_in_air(&g.youmonst, trflags)) { if (already_seen) { - You("%s over %s %s.", Levitation ? "float" : "fly", + You("%s over %s %s.", u_locomotion("step"), (ttype == ARROW_TRAP && !trap->madeby_u) ? "an" : a_your[trap->madeby_u], trapname(ttype, FALSE)); @@ -3561,7 +3557,7 @@ climb_pit(void) } else if ((Flying || is_clinger(g.youmonst.data)) && !Sokoban) { /* eg fell in pit, then poly'd to a flying monster; or used '>' to deliberately enter it */ - You("%s from the %s.", Flying ? "fly" : "climb", pitname); + You("%s from the %s.", u_locomotion("climb"), pitname); reset_utrap(FALSE); fill_pit(u.ux, u.uy); g.vision_full_recalc = 1; /* vision limits change */