]> granicus.if.org Git - nethack/commitdiff
Use more u_locomotion
authorPasi Kallinen <paxed@alt.org>
Sun, 27 Feb 2022 09:06:41 +0000 (11:06 +0200)
committerPasi Kallinen <paxed@alt.org>
Sun, 27 Feb 2022 09:07:31 +0000 (11:07 +0200)
... and make it autocapitalize the first letter, just like locomotion

src/do.c
src/hack.c
src/mon.c
src/steed.c
src/teleport.c
src/trap.c

index 0a6f7597c2e3c223e922158b00d17654440a50e5..37717f6b80e8b4c1699cfc0182c1ab1283e73325 100644 (file)
--- 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 */
index eac0fccf9e2807f910962b84646f7a90168bec57..cfc3f20c2e455436701f8fdd9fea1831ca79b8d3 100644 (file)
@@ -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 <sx,sy> */
@@ -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
index 4349a577d0b1bc9ba87d540edd61ec8f77a6673a..6d08a9afe3b1715f3523118ffcd7eadf0abb1fb7 100644 (file)
--- 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));
     }
 }
 
index 834840fa22336277d27d21dc1b83501680737846..bbca3f7293656399ace4b28e2a0456eeed138a76 100644 (file)
@@ -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);
index 60034361c305c3e0bea8f9b7420b6aaca067801f..c128ae8f4a6dfa212afed2682cce2f1879c0d196 100644 (file)
@@ -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) {
index ab00c0738688c7fbef4d4ee8718a2d0d52510856..5b926ed1fb0e64e61c13d84955cb7f071bdf3604 100644 (file)
@@ -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 */