up/down level feedback

With sounds on, using #levelchange to drop more than one level only
gave the level-loss sound effect once.  Level-gain sound was better
because the more verbose messaging triggered --More-- before moving
on.  Have both gain and loss use urgent_pline() in case messages
are being suppressed due to ESC, and have both request --More-- to
make the player acknowledge the message.  That has a side-effect of
letting the sound play to conclusion.
This commit is contained in:
PatR
2023-02-04 15:28:13 -08:00
parent 6cf077a684
commit 9ce98594a4

View File

@@ -220,14 +220,18 @@ losexp(
(drainer==NULL) resets a level 1 character to 0 experience points
without reducing level and that isn't fatal so suppress the message
in that situation */
if (u.ulevel > 1 || drainer)
pline("%s level %d.", Goodbye(), u.ulevel);
if (u.ulevel > 1 || drainer) {
urgent_pline("%s level %d.", Goodbye(), u.ulevel);
SoundAchievement(0, sa2_xpleveldown, 0);
/* issue --More-- so that player acknowleges the loss in level
and also to give the sound effect enough time to play */
display_nhwindow(WIN_MESSAGE, TRUE);
}
if (u.ulevel > 1) {
u.ulevel -= 1;
/* remove intrinsic abilities */
adjabil(u.ulevel + 1, u.ulevel);
livelog_printf(LL_MINORAC, "lost experience level %d", u.ulevel + 1);
SoundAchievement(0, sa2_xpleveldown, 0);
} else {
if (drainer) {
gk.killer.format = KILLED_BY;
@@ -235,7 +239,7 @@ losexp(
Strcpy(gk.killer.name, drainer);
done(DIED);
}
/* no drainer or lifesaved */
/* no drainer or else lifesaved */
u.uexp = 0;
livelog_printf(LL_MINORAC, "lost all experience");
}
@@ -339,13 +343,16 @@ pluslvl(
u.uexp = newuexp(u.ulevel);
}
++u.ulevel;
pline("Welcome %sto experience level %d.",
(u.ulevelmax < u.ulevel) ? "" : "back ",
u.ulevel);
urgent_pline("Welcome %sto experience level %d.",
(u.ulevelmax < u.ulevel) ? "" : "back ", u.ulevel);
SoundAchievement(0, sa2_xplevelup, 0);
/* issue --More-- so that player acknowleges the gain in level
and also to give the sound effect enough time to play */
display_nhwindow(WIN_MESSAGE, TRUE);
if (u.ulevelmax < u.ulevel)
u.ulevelmax = u.ulevel;
adjabil(u.ulevel - 1, u.ulevel); /* give new intrinsics */
SoundAchievement(0, sa2_xplevelup, 0);
old_ach_cnt = count_achievements();
newrank = xlev_to_rank(u.ulevel);
if (newrank > oldrank)