Skip to content

Commit

Permalink
Merge branch 'unicode' of https://github.com/chasonr/NetHack into pr889
Browse files Browse the repository at this point in the history
  • Loading branch information
nhmall committed Oct 6, 2022
2 parents c3633ca + 5683f88 commit 08163e9
Show file tree
Hide file tree
Showing 19 changed files with 525 additions and 129 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "submodules/pdcurses"]
path = submodules/pdcurses
url = https://github.com/wmcbrine/PDCurses.git
[submodule "submodules/pdcursesmod"]
path = submodules/pdcursesmod
url = https://github.com/Bill-Gray/PDCursesMod.git
3 changes: 3 additions & 0 deletions Cross-compiling
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ Using the cross-compiler, build the following targets:
c) Additional optional library packages/obj files as required

lib/pdcurses/...
or lib/pdcursesmod/...

from sources: addch.c, addchstr.c, addstr.c, attr.c, beep.c,
bkgd.c, border.c, clear.c, color.c, delch.c,
Expand Down Expand Up @@ -461,6 +462,8 @@ Cross-compiler pre-built binary downloads:
http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip
and pdcurses from:
https://github.com/wmcbrine/PDCurses.git
or pdcursesmod from:
https://github.com/Bill-Gray/PDCursesMod.git

- A shell script to download that djgpp cross-compiler and associated
pieces for either linux or macOS is available:
Expand Down
4 changes: 2 additions & 2 deletions include/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -3032,9 +3032,9 @@ extern boolean glyphid_cache_status(void);
extern int glyphrep_to_custom_map_entries(const char *op, int *glyph);
void free_all_glyphmap_u(void);
int add_custom_urep_entry(const char *symset_name, int glyphidx,
const uint8 *utf8str, long ucolor,
uint32 utf32ch, const uint8 *utf8str, long ucolor,
enum graphics_sets which_set);
int set_map_u(glyph_map *gm, const uint8 *utf8str, long ucolor);
int set_map_u(glyph_map *gm, uint32 utf32ch, const uint8 *utf8str, long ucolor);
#endif /* ENHANCED_SYMBOLS */

/* ### vault.c ### */
Expand Down
1 change: 1 addition & 0 deletions include/wintype.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct classic_representation {
struct unicode_representation {
uint32 ucolor;
uint16 u256coloridx;
uint32 utf32ch;
uint8 *utf8str;
};

Expand Down
4 changes: 3 additions & 1 deletion src/symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,9 @@ apply_customizations_to_symset(enum graphics_sets which_set)
details = g.sym_customizations[UNICODESET].details;
while (details) {
gm = &glyphmap[details->content.urep.glyphidx];
(void) set_map_u(gm, details->content.urep.u.utf8str,
(void) set_map_u(gm,
details->content.urep.u.utf32ch,
details->content.urep.u.utf8str,
details->content.urep.u.ucolor);
details = details->next;
}
Expand Down
13 changes: 8 additions & 5 deletions src/utf8map.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat)
uval = unicode_val(findwhat->unicode_val);
if (unicodeval_to_utf8str(uval, utf8str, sizeof utf8str)) {
#ifdef NO_PARSING_SYMSET
set_map_u(gm, utf8str,
set_map_u(gm, uval, utf8str,
(findwhat->color != 0L) ? findwhat->color : 0L);
#endif
add_custom_urep_entry(known_handling[H_UTF8], glyph,
utf8str, findwhat->color, UNICODESET);
uval, utf8str, findwhat->color, UNICODESET);
}
}

Expand Down Expand Up @@ -217,7 +217,7 @@ unicode_val(const char *cp)
}

int
set_map_u(glyph_map *gm, const uint8 *utf8str, long ucolor)
set_map_u(glyph_map *gm, uint32 utf32ch, const uint8 *utf8str, long ucolor)
{
static uint32_t closecolor = 0;
static int clridx = 0;
Expand All @@ -237,6 +237,7 @@ set_map_u(glyph_map *gm, const uint8 *utf8str, long ucolor)
gm->u->u256coloridx = clridx;
else
gm->u->u256coloridx = 0;
gm->u->utf32ch = utf32ch;
return 1;
}
return 0;
Expand Down Expand Up @@ -475,7 +476,7 @@ glyphrep(const char *op)

int
add_custom_urep_entry(const char *customization_name, int glyphidx,
const uint8 *utf8str, long ucolor,
uint32 utf32ch, const uint8 *utf8str, long ucolor,
enum graphics_sets which_set)
{
static uint32_t closecolor = 0;
Expand Down Expand Up @@ -505,6 +506,7 @@ add_custom_urep_entry(const char *customization_name, int glyphidx,
details->content.urep.u.u256coloridx = clridx;
else
details->content.urep.u.u256coloridx = 0;
details->content.urep.u.utf32ch = utf32ch;
return 1;
}
prev = details;
Expand All @@ -522,6 +524,7 @@ add_custom_urep_entry(const char *customization_name, int glyphidx,
newdetails->content.urep.u.u256coloridx = clridx;
else
newdetails->content.urep.u.u256coloridx = 0;
newdetails->content.urep.u.utf32ch = utf32ch;
newdetails->next = (struct customization_detail *) 0;
if (!details && prev) {
prev->next = newdetails;
Expand Down Expand Up @@ -1071,7 +1074,7 @@ to_unicode_callback(int glyph UNUSED, struct find_struct *findwhat)
uval = unicode_val(findwhat->unicode_val);
if (unicodeval_to_utf8str(uval, utf8str, sizeof utf8str)) {
#ifdef NO_PARSING_SYMSET
set_map_u(gm, utf8str,
set_map_u(gm, uval, utf8str,
(findwhat->color != 0L) ? findwhat->color : 0L);
#else

Expand Down
20 changes: 18 additions & 2 deletions sys/msdos/Install.dos
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,21 @@ II. There once was a time when people built NetHack right on their DOS machine.
https://github.com/andrewwutw/build-djgpp/releases/download/v3.0/
a DOS-extender (for including in msdos packaging) from:
http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip
and pdcurses from:
https://github.com/wmcbrine/PDCurses.git
and Lua from:
http://www.lua.org/ftp/lua-5.4.4.tar.gz

If you want the DOSVGA build, to support higher resolutions and Unicode
symbols, you also need:
pdcursesmod from:
https://github.com/Bill-Gray/PDCursesMod.git
(Name this lib/pdcurmod for the native build)
Terminus fonts from:
https://sourceforge.net/projects/terminus-font/files/terminus-font-4.49/terminus-font-4.49.1.tar.gz
(Name this lib/terminus for the native build)
If not, you also need:
pdcurses from:
https://github.com/wmcbrine/PDCurses.git

- A shell script to download the above-mentioned djgpp cross-compiler and
associated support pieces for either linux or macOS is available:
sh sys/msdos/fetch-cross-compiler.sh
Expand Down Expand Up @@ -82,6 +92,12 @@ II. There once was a time when people built NetHack right on their DOS machine.
make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 all
make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 package

Add WANT_DOSVGA for a curses build that supports higher resolutions,
external fonts and Unicode symbols:

make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 WANT_DOSVGA=1 all
make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 WANT_DOSVGA=1 package

Result: The "make package" target will bundle all of the necessary
components to run NetHack on msdos into a folder:
targets/msdos/pkg
Expand Down
Loading

0 comments on commit 08163e9

Please sign in to comment.