more interactive role selection

This ended up combining several unrelated changes.

Add missing 'fixes' entry for curses-specific item in New Features.

When answering "Shall I pick ... for you? [ynaq]", accept \m as well
as \n and space for choosing the default of 'y', same as normal
ynaq() would.  Also add '*' to '@' as not-shown potential answers;
they force 'random'.

When tty tore down any of the menus, things were reasonable if they
were short enough for corner windows, but tall ones that switch to
full screen weren't fully erased.  The parts of those outside of the
map window stayed behind when the tall menu was closed and cleared.
Mainly affects picking the "~ - reset filtering" choice but also
affected the role menu on 24 line tty screens.  (Didn't affect curses
because it tracks and refreshes its base window when some overlaying
window goes away.)

The role menu used 25 lines so required a second page for the case
of a 24 line screen on tty.  Dealing with that is a bit ugly but it
wasn't an issue when this form of role selection was tty-only (because
the info about choices made so far was displayed on the base window
rather than in an extra menu line back then) so I added a hack for it.
If the role menu will take one more line than the screen height, the
separator between 'random' (below 'Wizard') and 'pick race first' gets
squeezed out.  If the menu needs two more lines (doesn't happen now,
except by changing screen size to 23 lines for testing), a second line
gets squeezed out.  (Not attempted for curses because it wouldn't
help.  'windowborders' and one or two extra separators it adds make
menus taller.  I doubt if many players use curses on 24-line screens
but if they do, they'll be using something new rather than going from
something that used to fit on one page with 3.6.x.)
This commit is contained in:
PatR
2022-12-13 15:59:05 -08:00
parent b2fe51490d
commit 7096c68492
6 changed files with 95 additions and 63 deletions

View File

@@ -275,7 +275,7 @@ void
curses_player_selection(void)
{
#if 1
if (genl_player_setup())
if (genl_player_setup(0))
return; /* success */
/* quit/cancel */

View File

@@ -575,7 +575,7 @@ tty_preference_update(const char *pref)
void
tty_player_selection(void)
{
if (genl_player_setup())
if (genl_player_setup(ttyDisplay->rows))
return;
bail((char *) 0);
@@ -1859,14 +1859,22 @@ tty_dismiss_nhwindow(winid window)
case NHW_MENU:
case NHW_TEXT:
if (cw->active) {
/* skip erasure if window_inited has been reset to 0 during
final run-down in case this is the end-of-game window;
the contents of that window should remain shown even when
the window itself has gone away */
if (iflags.window_inited) {
/* otherwise dismissing the text endwin after other windows
* are dismissed tries to redraw the map and panics. since
* the whole reason for dismissing the other windows was to
* leave the ending window on the screen, we don't want to
* erase it anyway.
*/
erase_menu_or_text(window, cw, FALSE);
boolean clearscreen = FALSE; /* just erase the menu */
/* during role/race/&c selection, menus are put up on top
of the base window; we don't track what was there so
can't refresh--force the screen to be cleared instead
(affects dismissal of 'reset role filtering' menu if
screen height forces that to need a second page) */
if (gp.program_state.in_role_selection)
clearscreen = TRUE;
erase_menu_or_text(window, cw, clearscreen);
}
cw->active = 0;
}