ENHANCED_SYMBOLS

A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h

With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
    ucolor          RGB color for use with truecolor terminals/platforms.
                    A ucolor value of zero means "not set." The actual
                    rgb value of 0 has the 0x1000000 bit set.
    u256coloridx    256 color index value for use with 256 color
                    terminals, the closest color match to ucolor.
    utf8str         Custom representation via utf-8 string (can be null).

There is a new symset included in the symbols file, called enhanced1.

Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.

The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.

Examples:
   OPTIONS=glyph:G_fountain/U+03A8/0-150-255

(Your platform/terminal font needs to be able to include/display the
character, of course.)

The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.

Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.

Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c
This commit is contained in:
nhmall
2022-05-07 10:25:13 -04:00
parent 132e1d433a
commit cb0c21e91d
50 changed files with 3072 additions and 1242 deletions

View File

@@ -2,7 +2,7 @@
# Copyright (c) 2006 by Michael Allison
# NetHack may be freely redistributed. See license for details.
#
# Symbol sets for use in NetHack's text-based display.
# Symbol sets and handlers for use in NetHack's text-based display.
#
# IBMgraphics works by specifying special characters which reside
# outside the range of normal printable characters. It has subsets
@@ -22,7 +22,17 @@
# on an old graphics mode for the Curses interface and is the default
# on that windowport if no symset is specified. The Curses interface
# can also use DECgraphics as-is; IBMgraphics probably won't work.
#
# Symsets that use the UTF8 handler work a little differently than
# those that do not. When the UTF8 handler is in effect, any NetHack
# glyphs that have a utf8str entry present in the runtime glyphmap[]
# array will utilize that UTF-8 character sequence for the glyph display
# instead of the NetHack ttychar symbol that would otherwise be used.
# Any NetHack glyphs that don't actually have a utf8str sequence present
# in the internal glyphmap will simply fall back to utilizing the typical
# NetHack ttychar symbol as usual. That is true even when the UTF-8
# handler is in effect.
#
# plain looks decent for room+corridor levels where there aren't a lot
# of wall corners and ones present tend to be spread out, but it looks
# awful for wallified mazes
@@ -550,4 +560,94 @@ start: MACgraphics
S_pool: \xe0
finish
start: Enhanced1
Description: Enhanced with Unicode glyphs and 24-bit color
Restrictions: primary
Handling: UTF8
S_vwall: U+2502 # BOX DRAWINGS LIGHT VERTICAL
S_hwall: U+2500 # BOX DRAWINGS LIGHT HORIZONTAL
S_tlcorn: U+250c # BOX DRAWINGS LIGHT DOWN AND RIGHT
S_trcorn: U+2510 # BOX DRAWINGS LIGHT DOWN AND LEFT
S_blcorn: U+2514 # BOX DRAWINGS LIGHT UP AND RIGHT
S_brcorn: U+2518 # BOX DRAWINGS LIGHT UP AND LEFT
S_crwall: U+253c # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
S_tuwall: U+2534 # BOX DRAWINGS LIGHT UP AND HORIZONTAL
S_tdwall: U+252c # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
S_tlwall: U+2524 # BOX DRAWINGS LIGHT VERTICAL AND LEFT
S_trwall: U+251c # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
S_ndoor: U+00b7 # MIDDLE DOT
S_vodoor: U+2592 # MEDIUM SHADE
S_hodoor: U+2592 # MEDIUM SHADE
S_bars: U+2261 # IDENTICAL TO
S_tree: U+03a8 # GREEK CAPITAL LETTER PSI
S_room: U+00b7 # MIDDLE DOT
S_darkroom: U+00b7 # MIDDLE DOT
S_upladder: U+2264 # LESS-THAN OR EQUAL TO
S_dnladder: U+2265 # GREATER-THAN OR EQUAL TO
S_altar: U+03A9 # GREEK CAPITAL LETTER OMEGA
S_grave: U+2020 # DAGGER
G_fountain: U+2320/0-150-255 # TOP HALF INTEGRAL
S_pool: U+224b # TRIPLE TILDE
S_ice: U+00b7 # MIDDLE DOT
S_lava: U+224b # TRIPLE TILDE
S_vodbridge: U+00b7 # MIDDLE DOT
S_hodbridge: U+00b7 # MIDDLE DOT
S_water: U+2248 # ALMOST EQUAL TO
S_web: U+00A4 # CURRENCY SIGN
S_vbeam: U+2502 # BOX DRAWINGS LIGHT VERTICAL
S_hbeam: U+2500 # BOX DRAWINGS LIGHT HORIZONTAL
S_sw_tc: U+2594 # UPPER ONE EIGHTH BLOCK
S_sw_ml: U+258f # LEFT ONE EIGHTH BLOCK
S_sw_mr: U+2595 # RIGHT ONE EIGHTH BLOCK
S_sw_bc: U+2581 # LOWER ONE EIGHTH BLOCK
S_expl_tc: U+2594 # UPPER ONE EIGHTH BLOCK
S_expl_ml: U+258f # LEFT ONE EIGHTH BLOCK
S_expl_mr: U+2595 # RIGHT ONE EIGHTH BLOCK
S_expl_bc: U+2581 # LOWER ONE EIGHTH BLOCK
G_vwall_sokoban: U+2502/0-0-190
G_hwall_sokoban: U+2500/0-0-190
G_tlcorn_sokoban: U+250c/0-0-190
G_trcorn_sokoban: U+2510/0-0-190
G_blcorn_sokoban: U+2514/0-0-190
G_brcorn_sokoban: U+2518/0-0-190
G_crwall_sokoban: U+253C/0-0-190
G_tuwall_sokoban: U+2500/0-0-190
G_tdwall_sokoban: U+252C/0-0-190
G_tlwall_sokoban: U+2524/0-0-190
G_trwall_sokoban: U+251C/0-0-190
G_vwall_gehennom: U+2502/190-0-0
G_hwall_gehennom: U+2500/190-0-0
G_tlcorn_gehennom: U+250c/190-0-0
G_trcorn_gehennom: U+2510/190-0-0
G_blcorn_gehennom: U+2514/190-0-0
G_brcorn_gehennom: U+2518/190-0-0
G_crwall_gehennom: U+253C/190-0-0
G_tuwall_gehennom: U+2500/190-0-0
G_tdwall_gehennom: U+252C/190-0-0
G_tlwall_gehennom: U+2524/190-0-0
G_trwall_gehennom: U+251C/190-0-0
G_vwall_knox: U+2502/150-75-0
G_hwall_knox: U+2500/150-75-0
G_tlcorn_knox: U+250c/150-75-0
G_trcorn_knox: U+2510/150-75-0
G_blcorn_knox: U+2514/150-75-0
G_brcorn_knox: U+2518/150-75-0
G_crwall_knox: U+253C/150-75-0
G_tuwall_knox: U+2500/150-75-0
G_tdwall_knox: U+252C/150-75-0
G_tlwall_knox: U+2524/150-75-0
G_trwall_knox: U+251C/150-75-0
G_vwall_mines: U+2502/113-126-142
G_hwall_mines: U+2500/113-126-142
G_tlcorn_mines: U+250c/113-126-142
G_trcorn_mines: U+2510/113-126-142
G_blcorn_mines: U+2514/113-126-142
G_brcorn_mines: U+2518/113-126-142
G_crwall_mines: U+253C/113-126-142
G_tuwall_mines: U+2500/113-126-142
G_tdwall_mines: U+252C/113-126-142
G_tlwall_mines: U+2524/113-126-142
G_trwall_mines: U+251C/113-126-142
finish
# symbols EOF