symbol set reorganization

Change the way symbol sets are loaded to make them have the same order
as they appear in the symbols file rather than being reversed.

Revise dat/symbols so that the new ordering yields a result similar
to the old ordering, more or less.  I've added a few set descriptions.
The only substantive change is marking DECgraphics as primary-only
(not available on rogue level) and adding new set DECgraphics_2 which
is commented out near the end.

Define symbol handling H_MAC since one of the sets specifies
'handling: MAC'.  All H_MAC is used for now is to avoid showing
MACgraphics as a symset when compiled without MAC_GRAPHICS_ENV (which
was used for pre-OSX Mac by the old code in sys/mac/), so it will be
hidden for everyone.

I left handling H_CURS even though curses doesn't implement anything
for it.  It could do something when rendering the map or assign a
function to 'cursesgraphics_mode_callback' for special init or both
but hasn't needed to.  Since curses is now supporting DECgraphics,
define 'decgraphics_mode_callback' for it.  No value is being
assigned so that doesn't do anything; curses seems to be setting up
the primary character set as text and secondary one as line-drawing
without the need for that hook.

With the added set descriptions, 'O's symset menu looked horrible for
curses due to the way curses decides to set the width of menus and
the resulting line wrapping which took place because of a too-narrow
menu.  I've added a chunk of code to the options handling code which
shouldn't really be there but makes the menu much easier to read.

Lastly, do some formatting cleanup in files.c.
This commit is contained in:
PatR
2019-10-17 05:00:58 -07:00
parent 33d33fcf19
commit 3e368b9a51
6 changed files with 474 additions and 364 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 drawing.c $NHDT-Date: 1546656404 2019/01/05 02:46:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */
/* NetHack 3.6 drawing.c $NHDT-Date: 1571313651 2019/10/17 12:00:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.61 $ */
/* Copyright (c) NetHack Development Team 1992. */
/* NetHack may be freely redistributed. See license for details. */
@@ -255,9 +255,9 @@ static const uchar def_r_oc_syms[MAXOCLASSES] = {
#undef C
#ifdef TERMLIB
#if defined(TERMLIB) || defined(CURSES_GRAPHICS)
void NDECL((*decgraphics_mode_callback)) = 0; /* set in tty_start_screen() */
#endif /* TERMLIB */
#endif /* TERMLIB || CURSES */
#ifdef PC9800
void NDECL((*ibmgraphics_mode_callback)) = 0; /* set in tty_start_screen() */
@@ -496,17 +496,22 @@ int nondefault;
#ifdef PC9800
if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback)
(*ibmgraphics_mode_callback)();
else if (!symset[currentgraphics].name && ascgraphics_mode_callback)
else if (SYMHANDLING(H_UNK) && ascgraphics_mode_callback)
(*ascgraphics_mode_callback)();
#endif
#ifdef TERMLIB
#if defined(TERMLIB) || defined(CURSES_GRAPHICS)
/* curses doesn't assign any routine to dec..._callback but
probably does the expected initialization under the hood
for terminals capable of rendering DECgraphics */
if (SYMHANDLING(H_DEC) && decgraphics_mode_callback)
(*decgraphics_mode_callback)();
#endif
# ifdef CURSES_GRAPHICS
/* there aren't any symbol sets with CURS handling, and the
curses interface never assigns a routine to curses..._callback */
if (SYMHANDLING(H_CURS) && cursesgraphics_mode_callback)
(*cursesgraphics_mode_callback)();
# endif
#endif
} else {
init_l_symbols();
init_showsyms();
@@ -563,6 +568,7 @@ const char *known_handling[] = {
"IBM", /* H_IBM */
"DEC", /* H_DEC */
"CURS", /* H_CURS */
"MAC", /* H_MAC -- pre-OSX MACgraphics */
(const char *) 0,
};