livelog level entry events

Fix up the level descriptions used when logging an "entered new level"
event.  Most of the change is for adding an extra argument to calls
to describe_level().  The curses portion is in a big chunk of old code
suppressed by #if 0.

I didn't notice that the level entry events are classified as LL_DEBUG
until all the work was done.  This promotes the entry events for the
four Plane of <Element> levels from debug events to major ones instead.
It doesn't do that for the Astral Plane because the entered-the-Astral-
Plane achievement already produces a major event for that.  Most other
key level entry events are in a similar situation--or will become that
way once another set of achievements eventually gets added--so there
aren't any other event classification promotions.
This commit is contained in:
PatR
2022-03-01 13:53:57 -08:00
parent 2f273eb70b
commit 2bef05bb77
10 changed files with 71 additions and 52 deletions

View File

@@ -812,7 +812,7 @@ void NetHackQtStatusWindow::updateStats()
buf.toLatin1().constData());
name.setLabel(buf2, NetHackQtLabelledIcon::NoNum, u.ulevel);
if (!describe_level(buf3)) {
if (!describe_level(buf3, 0)) {
Sprintf(buf3, "%s, level %d",
g.dungeons[u.uz.dnum].dname, ::depth(&u.uz));
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 winstat.c $NHDT-Date: 1641763638 2022/01/09 21:27:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */
/* NetHack 3.7 winstat.c $NHDT-Date: 1646171629 2022/03/01 21:53:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.36 $ */
/* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */
@@ -1481,7 +1481,7 @@ update_val(struct X_status_value *attr_rec, long new_value)
rank_of(u.ulevel, g.pl_character[0], flags.female));
} else if (attr_rec == &shown_stats[F_DLEVEL]) {
if (!describe_level(buf)) {
if (!describe_level(buf, 0)) {
Strcpy(buf, g.dungeons[u.uz.dnum].dname);
Sprintf(eos(buf), ", level %d", depth(&u.uz));
}

View File

@@ -1639,7 +1639,8 @@ curses_color_attr(int nh_color, int bg_color)
return cattr;
}
/* Returns a complete curses attribute. Used to possibly bold/underline/etc HP/Pw. */
/* Returns a complete curses attribute.
Used to possibly bold/underline/etc HP/Pw. */
#ifdef STATUS_COLORS
static attr_t
hpen_color_attr(boolean is_hp, int cur, int max)
@@ -1665,17 +1666,18 @@ hpen_color_attr(boolean is_hp, int cur, int max)
#endif
/* Return color for the HP bar.
With status colors ON, this respect its configuration (defaulting to gray), but
only obeys the color (no weird attributes for the HP bar).
With status colors OFF, this returns reasonable defaults which are also used
for the HP/Pw text itself. */
With status colors ON, this respect its configuration (defaulting to gray),
but only obeys the color (no weird attributes for the HP bar).
With status colors OFF, this returns reasonable defaults which are also
used for the HP/Pw text itself. */
static int
hpen_color(boolean is_hp, int cur, int max)
{
#ifdef STATUS_COLORS
if (iflags.use_status_colors) {
struct color_option stat_color;
stat_color = percentage_color_of(cur, max, is_hp ? hp_colors : pw_colors);
stat_color = percentage_color_of(cur, max,
is_hp ? hp_colors : pw_colors);
if (stat_color.color == NO_COLOR)
return CLR_GRAY;
@@ -1872,7 +1874,7 @@ draw_horizontal(int x, int y, int hp, int hpmax)
y++;
wmove(win, y, x);
describe_level(buf);
describe_level(buf, 0);
wprintw(win, "%s", buf);
@@ -2135,7 +2137,8 @@ draw_vertical(int x, int y, int hp, int hpmax)
wmove(win, y++, x);
if (Upolyd)
print_statdiff("Hit Dice: ", &prevlevel, mons[u.umonnum].mlevel, STAT_OTHER);
print_statdiff("Hit Dice: ", &prevlevel, mons[u.umonnum].mlevel,
STAT_OTHER);
else if (flags.showexp) {
print_statdiff("Experience: ", &prevlevel, u.ulevel, STAT_OTHER);
/* use waddch, we don't want to highlight the '/' */
@@ -2153,7 +2156,8 @@ draw_vertical(int x, int y, int hp, int hpmax)
#ifdef SCORE_ON_BOTL
if (flags.showscore) {
print_statdiff("Score: ", &prevscore, botl_score(), STAT_OTHER);
print_statdiff("Score: ", &prevscore, botl_score(),
STAT_OTHER);
wmove(win, y++, x);
}
#endif /* SCORE_ON_BOTL */
@@ -2178,7 +2182,7 @@ curses_add_statuses(WINDOW *win, boolean align_right,
*x = mx;
}
#define statprob(str, trouble) \
#define statprob(str, trouble) \
curses_add_status(win, align_right, vertical, x, y, str, trouble)
/* Hunger */
@@ -2214,7 +2218,8 @@ curses_add_status(WINDOW *win, boolean align_right, boolean vertical,
if (!vertical && !align_right)
waddch(win, ' ');
/* For whatever reason, hunger states have trailing spaces. Get rid of them. */
/* For whatever reason, hunger states have trailing spaces. Get rid of
them. */
char buf[BUFSZ];
Strcpy(buf, str);
int i;