From: Pasi Kallinen Date: Sat, 24 Sep 2016 17:59:19 +0000 (+0300) Subject: Give feedback just before timed levitation runs out X-Git-Tag: NetHack-3.6.1_RC01~596 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea94100e9d0f56385d55f388cd93f854fd3d4c3c;p=nethack Give feedback just before timed levitation runs out --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index d168cbe0a..2344253f7 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -494,6 +494,7 @@ when moving a cursor for travel target, show if there is no known travel path to that location, if "autodescribe" is on show the reason why travel was interrupted if mention_walls is on random horses have a tiny chance of being generated saddled +give feedback just before timed levitation runs out Platform- and/or Interface-Specific New Features diff --git a/src/timeout.c b/src/timeout.c index 902b9befd..47553e2c8 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -8,6 +8,7 @@ STATIC_DCL void NDECL(stoned_dialogue); STATIC_DCL void NDECL(vomiting_dialogue); STATIC_DCL void NDECL(choke_dialogue); +STATIC_DCL void NDECL(levitation_dialogue); STATIC_DCL void NDECL(slime_dialogue); STATIC_DCL void NDECL(slip_or_trip); STATIC_DCL void FDECL(see_lamp_flicker, (struct obj *, const char *)); @@ -153,6 +154,38 @@ choke_dialogue() exercise(A_STR, FALSE); } +static NEARDATA const char *const levi_texts[] = { + "You float slightly lower.", + "You wobble unsteadily %s the %s.", + NULL +}; + +STATIC_OVL void +levitation_dialogue() +{ + long i = (HLevitation & TIMEOUT) / 2L; + + if (ELevitation) + return; + + if (!ACCESSIBLE(levl[u.ux][u.uy].typ) + && !is_pool_or_lava(u.ux,u.uy)) + return; + + if (((HLevitation & TIMEOUT) % 2L) && i >= 0L && i < SIZE(levi_texts)) { + const char *s = levi_texts[SIZE(levi_texts) - i - 1L]; + if (s) { + if (index(s, '%')) { + boolean danger = is_pool_or_lava(u.ux, u.uy) + && !Is_waterlevel(&u.uz); + pline(s, danger ? "over" : "in", + danger ? surface(u.ux, u.uy) : "air"); + } else + pline1(s); + } + } +} + static NEARDATA const char *const slime_texts[] = { "You are turning a little %s.", /* 5 */ "Your limbs are getting oozy.", /* 4 */ @@ -238,6 +271,8 @@ nh_timeout() vomiting_dialogue(); if (Strangled) choke_dialogue(); + if (Levitation) + levitation_dialogue(); if (u.mtimedone && !--u.mtimedone) { if (Unchanging) u.mtimedone = rnd(100 * youmonst.data->mlevel + 1);