new #overview menu

Require the 'm' prefix to treat #overview as a menu with selectable
entries.  During end-of-game disclosure it shows every level that was
visited, but during play it only shows levels which have annotations
(typically automatically generated ones).  The menu wasn't offering
any chance to add an annotation to levels without such, so force
'm #overview' to show every visited level.  Continue to avoid that
(and also avoid the clutter introduced by menu entry selector letters)
for normal #overview.
This commit is contained in:
PatR
2023-04-19 02:30:32 -07:00
parent b04ab80cad
commit 4d681eed46
5 changed files with 85 additions and 46 deletions

View File

@@ -37,7 +37,7 @@
.ds f0 "\*(vr
.ds f1
.\"DO NOT REMOVE NH_DATESUB .ds f2 "DATE(%B %-d, %Y)
.ds f2 "March 16, 2023
.ds f2 "April 19, 2023
.
.\" A note on some special characters:
.\" \(lq = left double quote
@@ -1409,12 +1409,21 @@ Precede with the \(oqm\(cq prefix to execute the simpler options command.
\(oq\f(CRO\fP\(cq from simple options back to traditional advanced options.)
.lp #overview
Display information you've discovered about the dungeon.
Any visited
level (unless forgotten due to amnesia) with an annotation is included,
Any visited level
.\" [note: amnesia no longer causes levels to be forgotten so exclude this]
.\" (unless forgotten due to amnesia)
with an annotation is included,
and many things (altars, thrones, fountains, and so on; extra stairs
leading to another dungeon branch) trigger an automatic annotation.
If dungeon overview is chosen during end-of-game disclosure, every visited
level will be included regardless of annotations.
.lp ""
Precede #overview with the \(oqm\(cq prefix to display the dungeon
overview as a menu where you can select any visited level to add or
remove an annotation without needing to return to that level.
This will also force all visited levels to be displayed rather than just
the \(lqinteresting\(rq subset.
.lp ""
Autocompletes.
Default keys are \(oq\(haO\(cq, and \(oqM-O\(cq.
.\" DON'T PANIC!

View File

@@ -46,7 +46,7 @@
\author{Original version - Eric S. Raymond\\
(Edited and expanded for 3.7.0 by Mike Stephenson and others)}
%DO NOT REMOVE NH_DATESUB \date{DATE(%B %-d, %Y)}
\date{March 16, 2023}
\date{April 19, 2023}
\maketitle
@@ -1523,12 +1523,25 @@ Precede with the `{\tt m}' prefix to execute the simpler options command.
`{\tt O}' from simple options back to traditional advanced options.)
%.lp
\item[\tb{\#overview}]
Display information you've discovered about the dungeon. Any visited
level (unless forgotten due to amnesia) with an annotation is included,
Display information you've discovered about the dungeon.
Any visited level
% [note: amnesia no longer causes levels to be forgotten so exclude this]
% (unless forgotten due to amnesia)
with an annotation is included,
and many things (altars, thrones, fountains, and so on; extra stairs
leading to another dungeon branch) trigger an automatic annotation.
If dungeon overview is chosen during end-of-game disclosure, every visited
level will be included regardless of annotations. Autocompletes.
level will be included regardless of annotations.
\\
%.lp ""
Precede \#overview with the `{\tt m}' prefix to display the dungeon
overview as a menu where you can select any visited level to add or
remove an annotation without needing to return to that level.
This will also force all visited levels to be displayed rather than just
the ``interesting'' subset.
\\
%.lp ""
Autocompletes.
Default keys are `{\tt \^{}O}', and `{\tt M-O}'.
% DON'T PANIC!
%.lp

View File

@@ -2053,6 +2053,9 @@ add a tutorial level
engravings appear on the map display
option to create the character deaf
add conduct for petless
preceding #overview with the 'm' prefix brings up the overview display as a
menu allowing selection of any visited level to #annotate; it also
shows every level visited rather than just the "interesting" ones
Platform- and/or Interface-Specific New Features

View File

@@ -2636,9 +2636,12 @@ struct ext_func_tab extcmdlist[] = {
{ '\0', "optionsfull", "show all option settings, possibly change them",
doset, IFBURIED | GENERALCMD | CMD_M_PREFIX, NULL },
/* #overview used to need autocomplete and has retained that even
after being assigned to ^O [old wizard mode ^O is now #wizwhere] */
after being assigned to ^O [old wizard mode ^O is now #wizwhere];
'm' prefix displays overview as a menu where player can choose a
level to supply with an annotation */
{ C('o'), "overview", "show a summary of the explored dungeon",
dooverview, IFBURIED | AUTOCOMPLETE | GENERALCMD, NULL },
dooverview,
IFBURIED | AUTOCOMPLETE | GENERALCMD | CMD_M_PREFIX, NULL },
/* [should #panic actually autocomplete?] */
{ '\0', "panic", "test panic routine (fatal to game)",
wiz_panic, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },

View File

@@ -65,7 +65,7 @@ static mapseen *find_mapseen(d_level *);
static mapseen *find_mapseen_by_str(const char *);
static void print_mapseen(winid, mapseen *, int, int, boolean);
static boolean interest_mapseen(mapseen *);
static void traverse_mapseenchn(boolean, winid, int, int, int *);
static void traverse_mapseenchn(int, winid, int, int, int *);
static const char *seen_string(xint16, const char *);
static const char *br_string2(branch *);
static const char *shop_string(int);
@@ -2748,10 +2748,12 @@ load_mapseen(NHFILE *nhfp)
DISABLE_WARNING_FORMAT_NONLITERAL
/* to support '#stats' wizard-mode command */
/* for '#stats' wizard-mode command, to show memory used for #overview data */
void
overview_stats(winid win, const char *statsfmt,
long *total_count, long *total_size)
overview_stats(
winid win, /* output window */
const char *statsfmt, /* format */
long *total_count, long *total_size) /* args for the format */
{
char buf[BUFSZ], hdrbuf[QBUFSZ];
long ocount, osize, bcount, bsize, acount, asize;
@@ -2858,8 +2860,8 @@ init_mapseen(d_level *lev)
}
}
#define INTEREST(feat) \
((feat).nfount || (feat).nsink || (feat).nthrone || (feat).naltar \
#define INTEREST(feat) \
((feat).nfount || (feat).nsink || (feat).nthrone || (feat).naltar \
|| (feat).ngrave || (feat).ntree || (feat).nshop || (feat).ntemple)
/* || (feat).water || (feat).ice || (feat).lava */
@@ -3208,8 +3210,8 @@ recalc_mapseen(void)
/*ARGUSED*/
/* valley and sanctum levels get automatic annotation once temple is entered */
void
mapseen_temple(struct monst *priest UNUSED) /* currently unused;
might be useful someday */
mapseen_temple(
struct monst *priest UNUSED) /* not used; might be useful someday */
{
mapseen *mptr = find_mapseen(&u.uz);
@@ -3235,37 +3237,40 @@ room_discovered(int roomno)
int
dooverview(void)
{
show_overview(0, 0);
/* game in progress; 'why' is 0 for normal #overview, -1 if user prefixed
#overview with 'm'; 'reason' for end of game isn't applicable: use 0 */
show_overview(iflags.menu_requested ? -1 : 0, 0);
iflags.menu_requested = FALSE;
return ECMD_OK;
}
/* called for #overview or for end of game disclosure */
void
show_overview(int why, /* 0 => #overview command,
1 or 2 => final disclosure
(1: hero lived, 2: hero died) */
int reason) /* how hero died; used when disclosing end-of-game level */
show_overview(
int why, /* 0 => normal #overview command, -1 => 'm' prefix #overview;
* 1 or 2 => final disclosure (1: hero lived, 2: hero died) */
int reason) /* how hero died; used when disclosing end-of-game level */
{
winid win;
int lastdun = -1;
menu_item *selected;
int n = 0;
int n;
/* lazy initialization */
(void) recalc_mapseen();
win = create_nhwindow(NHW_MENU);
if (why == 0)
if (why <= 0)
start_menu(win, MENU_BEHAVE_STANDARD);
/* show the endgame levels before the rest of the dungeon,
so that the Planes (dnum 5-ish) come out above main dungeon (dnum 0) */
if (In_endgame(&u.uz))
traverse_mapseenchn(TRUE, win, why, reason, &lastdun);
traverse_mapseenchn(1, win, why, reason, &lastdun);
/* if game is over or we're not in the endgame yet, show the dungeon */
if (why > 0 || !In_endgame(&u.uz))
traverse_mapseenchn(FALSE, win, why, reason, &lastdun);
if (why != 0 || !In_endgame(&u.uz))
traverse_mapseenchn(0, win, why, reason, &lastdun);
end_menu(win, (char *)0);
n = select_menu(win, (why > 0) ? PICK_NONE : PICK_ONE, &selected);
n = select_menu(win, (why != -1) ? PICK_NONE : PICK_ONE, &selected);
if (n > 0) {
int ledger;
d_level lev;
@@ -3281,8 +3286,12 @@ show_overview(int why, /* 0 => #overview command,
/* display endgame levels or non-endgame levels, not both */
static void
traverse_mapseenchn(boolean viewendgame, winid win, int why, int reason,
int *lastdun_p)
traverse_mapseenchn(
int viewendgame, /* 0: show endgame branch; 1: show other branches */
winid win, /* output window */
int why, /* -1: menu, 0: normal, 1 and 2: end of game disclosure */
int reason, /* when 'why'==1 or 2, how the game ended */
int *lastdun_p) /* where to restart if called twice */
{
mapseen *mptr;
boolean showheader;
@@ -3291,8 +3300,8 @@ traverse_mapseenchn(boolean viewendgame, winid win, int why, int reason,
if (viewendgame ^ In_endgame(&mptr->lev))
continue;
/* only print out info for a level or a dungeon if interest */
if (why > 0 || interest_mapseen(mptr)) {
/* only print out info for a level or a dungeon if it's of interest */
if (why != 0 || interest_mapseen(mptr)) {
showheader = (boolean) (mptr->lev.dnum != *lastdun_p);
print_mapseen(win, mptr, why, reason, showheader);
*lastdun_p = mptr->lev.dnum;
@@ -3464,12 +3473,12 @@ tunesuffix(mapseen *mptr, char *outbuf,
} while (0)
static void
print_mapseen(winid win, mapseen *mptr,
int final, /* 0: not final; 1: game over, alive;
2: game over, dead */
int how, /* cause of death; only used if final==2
and mptr->lev==u.uz */
boolean printdun)
print_mapseen(
winid win, mapseen *mptr,
int final, /* -1: as menu; 0: not final;
* 1: game over, alive; 2: game over, dead */
int how, /* cause of death; only used if final==2 and mptr->lev==u.uz */
boolean printdun)
{
char buf[BUFSZ], tmpbuf[BUFSZ];
int i, depthstart, dnum;
@@ -3509,9 +3518,10 @@ print_mapseen(winid win, mapseen *mptr,
/* calculate level number */
i = depthstart + mptr->lev.dlevel - 1;
if (In_endgame(&mptr->lev))
Sprintf(buf, "%s%s:", final ? TAB : "", endgamelevelname(tmpbuf, i));
Sprintf(buf, "%s%s:", (final != -1) ? TAB : "",
endgamelevelname(tmpbuf, i));
else
Sprintf(buf, "%sLevel %d:", final ? TAB : "", i);
Sprintf(buf, "%sLevel %d:", (final != -1) ? TAB : "", i);
/* wizmode prints out proto dungeon names for clarity */
if (wizard) {
@@ -3525,12 +3535,12 @@ print_mapseen(winid win, mapseen *mptr,
Sprintf(eos(buf), " \"%s\"", mptr->custom);
if (on_level(&u.uz, &mptr->lev))
Sprintf(eos(buf), " <- You %s here.",
(!final || (final == 1 && how == ASCENDED)) ? "are"
(final <= 0 || (final == 1 && how == ASCENDED)) ? "are"
: (final == 1 && how == ESCAPED) ? "left from"
: "were");
any = cg.zeroany;
if (!final)
if (final == -1)
any.a_int = ledger_no(&(mptr->lev)) + 1;
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
@@ -3651,12 +3661,12 @@ print_mapseen(winid win, mapseen *mptr,
}
/* maybe print out bones details */
if (mptr->final_resting_place || final) {
if (mptr->final_resting_place || final > 0) {
struct cemetery *bp;
int kncnt = !died_here ? 0 : 1;
for (bp = mptr->final_resting_place; bp; bp = bp->next)
if (bp->bonesknown || wizard || final)
if (bp->bonesknown || wizard || final > 0)
++kncnt;
if (kncnt) {
Sprintf(buf, "%s%s", PREFIX, "Final resting place for");
@@ -3679,11 +3689,12 @@ print_mapseen(winid win, mapseen *mptr,
buf, MENU_ITEMFLAGS_NONE);
}
for (bp = mptr->final_resting_place; bp; bp = bp->next) {
if (bp->bonesknown || wizard || final) {
if (bp->bonesknown || wizard || final > 0) {
Sprintf(buf, "%s%s%s, %s%c", PREFIX, TAB, bp->who,
bp->how, --kncnt ? ',' : '.');
any = cg.zeroany;
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR,
add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
}
}