From e87496b897f1abd2fedf59beb490349441ad424c Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 11 Nov 2018 10:48:08 -0500 Subject: [PATCH 01/12] merge fluff --- win/win32/winhack.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/win/win32/winhack.c b/win/win32/winhack.c index 2430630ef..1657b0220 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -90,11 +90,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, UNREFERENCED_PARAMETER(nCmdShow); /* We must initialize state sufficiently to support calls to panic */ - // We need to support DPI awareness. - // - // BOOL result = SetProcessDpiAwarenessContext( - // DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - // windowprocs.win_raw_print = mswin_raw_print; windowprocs.win_raw_print_bold = mswin_raw_print_bold; windowprocs.win_wait_synch = mswin_wait_synch; From ed70005c9b9a23257ae8cfd17218c20c2ff0e15e Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 11 Nov 2018 15:39:13 -0500 Subject: [PATCH 02/12] Makefile build updates --- sys/winnt/Makefile.msc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index ca781610b..0c1ba5135 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -397,7 +397,8 @@ VOBJ23 = $(O)sys.o $(O)teleport.o $(O)timeout.o $(O)topten.o VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o -VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o +VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o +VOBJ28 = $(O)win10.o DLBOBJ = $(O)dlb.o @@ -1341,6 +1342,8 @@ $(DAT)\dungeon: $(O)utility.tag $(DAT)\dungeon.def $(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(MSWSYS)\nttty.c @$(cc) $(cflagsBuild) -I$(WSHR) -Fo$@ $(MSWSYS)\nttty.c +$(O)win10.o: $(HACK_H) $(MSWSYS)\win10.c + @$(cc) $(cflagsBuild) -I$(MSWSYS) -I$(MSWIN) -Fo$@ $(MSWSYS)\win10.c $(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(MSWSYS)\winnt.c @$(cc) $(cflagsBuild) -Fo$@ $(MSWSYS)\winnt.c $(O)ntsound.o: $(HACK_H) $(MSWSYS)\ntsound.c @@ -1352,6 +1355,13 @@ $(O)ntsound.o: $(HACK_H) $(MSWSYS)\ntsound.c $(O)guistub.o: $(HACK_H) $(MSWSYS)\stubs.c @$(cc) $(cflagsBuild) -DGUISTUB -Fo$@ $(MSWSYS)\stubs.c +# +# WIN32 dependencies +# + +$(O)winhack.o: $(HACK_H) $(MSWIN)\winhack.c + @$(cc) $(cflagsBuild) -I$(MSWSYS) -I$(MSWIN) -Fo$@ $(MSWIN)\winhack.c + #if you aren't linking in the full tty then #include the following stub for proper linkage. From ab7fb9360e19d28707bb57cca36d1f3a5808721e Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 11 Nov 2018 14:28:54 -0800 Subject: [PATCH 03/12] fix #H7065 - clairvoyance shows trap over monsters and over the hero. 3.6.0's clairvoyance tried to show things in a non-standard sequence, which was intentional but had unintended side-effects like the disappearing monsters complained about in the report. To make it work as intended would have required --More-- whenever it kicked in, which is much too intrusive when it happens every N turns rather than when explicitly casting the spell. Redo it substantially, and give preference to monsters over objects, objects over traps, and traps over underlying terrain like normal vision-based display does. It now detects all monsters within its bounding box but shows ones which aren't directly in view as "unseen monster" unless via spell cast at skilled or expert, or at basic when also having intrinsic clairvoyance. --- doc/fixes36.2 | 2 ++ src/detect.c | 94 ++++++++++++++++++++++++++++++++++++++++++++------- src/drawing.c | 3 +- src/pager.c | 11 ++++-- 4 files changed, 94 insertions(+), 16 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 2de78d988..fb2cf76b0 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -194,6 +194,8 @@ avoid potential buffer overflow if object with very long name knocks other objects down stairs when dropped, thrown, or kicked there #wizintrinsic for 'flying' didn't update status line when flying ended #wizintrinsic for 'warn_of_mon' didn't set any type of monster (now grid bugs) +clairvoyance would show trap instead of a monster on/in that trap, which was + intentional, but when clairvoyance finished the monster wasn't shown Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/detect.c b/src/detect.c index ca6eda709..57ee916ce 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 detect.c $NHDT-Date: 1541144458 2018/11/02 07:40:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.85 $ */ +/* NetHack 3.6 detect.c $NHDT-Date: 1522891623 2018/04/05 01:27:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.81 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1300,25 +1300,82 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */ { register int zx, zy; struct monst *mtmp; + struct obj *otmp; + long save_EDetect_mons; + char save_viz_uyux; boolean unconstrained, refresh = FALSE, mdetected = FALSE, - extended = (sobj && sobj->blessed); - int lo_y = ((u.uy - 5 < 0) ? 0 : u.uy - 5), + /* fake spellbook 'sobj' implies hero has cast the spell; + when book is blessed, casting is skilled or expert level; + if already clairvoyant, non-skilled spell acts like skilled */ + extended = (sobj && (sobj->blessed || Clairvoyant)); + int newglyph, oldglyph, + lo_y = ((u.uy - 5 < 0) ? 0 : u.uy - 5), hi_y = ((u.uy + 6 >= ROWNO) ? ROWNO - 1 : u.uy + 6), lo_x = ((u.ux - 9 < 1) ? 1 : u.ux - 9), /* avoid column 0 */ hi_x = ((u.ux + 10 >= COLNO) ? COLNO - 1 : u.ux + 10), ter_typ = TER_DETECT | TER_MAP | TER_TRP | TER_OBJ; + /* + * 3.6.0 attempted to emphasize terrain over transient map + * properties (monsters and objects) but that led to problems. + * Notably, known trap would be displayed instead of a monster + * on or in it and then the display remained that way after the + * clairvoyant snapshot finished. That could have been fixed by + * issuing --More-- and then regular vision update, but we want + * to avoid that when having a clairvoyant episode every N turns + * (from donating to a temple priest or by carrying the Amulet). + * Unlike when casting the spell, it is much too intrustive when + * in the midst of walking around or combatting monsters. + * + * For 3.6.2, show terrain, then object, then monster like regular + * map updating, except in this case the map locations get marked + * as seen from every direction rather than just from direction of + * hero. Skilled spell marks revealed objects as 'seen up close' + * (but for piles, only the top item) and shows monsters as if + * detected. Non-skilled and timed clairvoyance reveals non-visible + * monsters as 'remembered, unseen'. + */ + + /* if hero is engulfed, show engulfer at */ + save_viz_uyux = viz_array[u.uy][u.ux]; + if (u.uswallow) + viz_array[u.uy][u.ux] |= IN_SIGHT; /* are reversed to [y][x] */ + save_EDetect_mons = EDetect_monsters; + /* for skilled spell, getpos() scanning of the map will display all + monsters within range; otherwise, "unseen creature" will be shown */ + EDetect_monsters |= I_SPECIAL; unconstrained = unconstrain_map(); for (zx = lo_x; zx <= hi_x; zx++) for (zy = lo_y; zy <= hi_y; zy++) { + oldglyph = glyph_at(zx, zy); + /* this will remove 'remembered, unseen mon' (and objects) */ show_map_spot(zx, zy); - - if (extended && (mtmp = m_at(zx, zy)) != 0 + /* if there are any objects here, see the top one */ + if (OBJ_AT(zx, zy)) { + /* not vobj_at(); this is not vision-based access; + unlike object detection, we don't notice buried items */ + otmp = level.objects[zx][zy]; + if (extended) + otmp->dknown = 1; + map_object(otmp, TRUE); + } + /* if there is a monster here, see or detect it, + possibly as "remembered, unseen monster" */ + if ((mtmp = m_at(zx, zy)) != 0 && mtmp->mx == zx && mtmp->my == zy) { /* skip worm tails */ - int oldglyph = glyph_at(zx, zy); - - map_monst(mtmp, FALSE); - if (glyph_at(zx, zy) != oldglyph) + /* if we're going to offer browse_map()/getpos() scanning of + the map and we're not doing extended/blessed clairvoyance + (hence must be swallowed or underwater), show "unseen + creature" unless map already displayed a monster here */ + if ((unconstrained || !level.flags.hero_memory) + && !extended && (zx != u.ux || zy != u.uy) + && !glyph_is_monster(oldglyph)) + map_invisible(zx, zy); + else + map_monst(mtmp, FALSE); + newglyph = glyph_at(zx, zy); + if (extended && newglyph != oldglyph + && !glyph_is_invisible(newglyph)) mdetected = TRUE; } } @@ -1331,13 +1388,26 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */ You("sense your surroundings."); if (extended || glyph_is_monster(glyph_at(u.ux, u.uy))) ter_typ |= TER_MON; - if (extended) - EDetect_monsters |= I_SPECIAL; browse_map(ter_typ, "anything of interest"); - EDetect_monsters &= ~I_SPECIAL; refresh = TRUE; } reconstrain_map(); + EDetect_monsters = save_EDetect_mons; + viz_array[u.uy][u.ux] = save_viz_uyux; + + /* replace monsters with remembered,unseen monster, then run + see_monsters() to update visible ones and warned-of ones */ + for (zx = lo_x; zx <= hi_x; zx++) + for (zy = lo_y; zy <= hi_y; zy++) { + if (zx == u.ux && zy == u.uy) + continue; + newglyph = glyph_at(zx, zy); + if (glyph_is_monster(newglyph) + && glyph_to_mon(newglyph) != PM_LONG_WORM_TAIL) + map_invisible(zx, zy); + } + see_monsters(); + if (refresh) docrt(); } diff --git a/src/drawing.c b/src/drawing.c index d81ffa2c9..68fdebdad 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -26,7 +26,8 @@ nhsym l_syms[SYM_MAX] = DUMMY; /* loaded symbols */ nhsym r_syms[SYM_MAX] = DUMMY; /* rogue symbols */ nhsym warnsyms[WARNCOUNT] = DUMMY; /* the current warning display symbols */ -const char invisexplain[] = "remembered, unseen, creature"; +const char invisexplain[] = "remembered, unseen, creature", + altinvisexplain[] = "unseen creature"; /* for clairvoyance */ /* Default object class symbols. See objclass.h. * {symbol, name, explain} diff --git a/src/pager.c b/src/pager.c index c1824d2f8..305cfdc5a 100644 --- a/src/pager.c +++ b/src/pager.c @@ -895,12 +895,17 @@ struct permonst **for_supplement; } if (sym == DEF_INVISIBLE) { + extern const char altinvisexplain[]; /* drawing.c */ + /* for active clairvoyance, use alternate "unseen creature" */ + boolean usealt = (EDetect_monsters & I_SPECIAL) != 0L; + const char *unseen_explain = !usealt ? invisexplain : altinvisexplain; + if (!found) { - Sprintf(out_str, "%s%s", prefix, an(invisexplain)); - *firstmatch = invisexplain; + Sprintf(out_str, "%s%s", prefix, an(unseen_explain)); + *firstmatch = unseen_explain; found++; } else { - found += append_str(out_str, an(invisexplain)); + found += append_str(out_str, an(unseen_explain)); } } From a22175cd99fda232786835b88f9589f11f143c8f Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 11 Nov 2018 16:04:45 -0800 Subject: [PATCH 04/12] prayer vs blocked by boulder Salvaged from an old, unfinished patch. When checking whether the hero is trapped by walls and solid rock, adjacent boulders are evaluated on whether they can be pushed out of the way. Extend that evaluation: (1) two boulders on a spot are pushable if there is a pool beyond that spot, and (2) boulders can't be pushed diagonally in Sokoban. --- src/pray.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/pray.c b/src/pray.c index 7ad09455a..5569c33f0 100644 --- a/src/pray.c +++ b/src/pray.c @@ -2181,6 +2181,7 @@ blocked_boulder(dx, dy) int dx, dy; { register struct obj *otmp; + int nx, ny; long count = 0L; for (otmp = level.objects[u.ux + dx][u.uy + dy]; otmp; @@ -2189,6 +2190,7 @@ int dx, dy; count += otmp->quan; } + nx = u.ux + 2 * dx, ny = u.uy + 2 * dy; /* next spot beyond boulder(s) */ switch (count) { case 0: /* no boulders--not blocked */ @@ -2196,17 +2198,24 @@ int dx, dy; case 1: /* possibly blocked depending on if it's pushable */ break; + case 2: + /* this is only approximate since multiple boulders might sink */ + if (is_pool_or_lava(nx, ny)) /* does its own isok() check */ + break; /* still need Sokoban check below */ + /*FALLTHRU*/ default: /* more than one boulder--blocked after they push the top one; don't force them to push it first to find out */ return TRUE; } - if (!isok(u.ux + 2 * dx, u.uy + 2 * dy)) + if (dx && dy && Sokoban) /* can't push boulder diagonally in Sokoban */ return TRUE; - if (IS_ROCK(levl[u.ux + 2 * dx][u.uy + 2 * dy].typ)) + if (!isok(nx, ny)) return TRUE; - if (sobj_at(BOULDER, u.ux + 2 * dx, u.uy + 2 * dy)) + if (IS_ROCK(levl[nx][ny].typ)) + return TRUE; + if (sobj_at(BOULDER, nx, ny)) return TRUE; return FALSE; From 8944235282ff7f20f1e592f0c4f806fd295fee12 Mon Sep 17 00:00:00 2001 From: Bart House Date: Mon, 12 Nov 2018 01:58:56 -0800 Subject: [PATCH 05/12] Enforced the inclusion of windows headers before nethack headers. Moved the code page 437 mapping table to winnt.c so that it could be used in window and console clients. Added check that fonts support unicode values we use from code page 437. Use unicode to draw text if font supports it otherwise use ASCII. --- sys/share/pcmain.c | 8 ++-- sys/winnt/nh340key.c | 2 +- sys/winnt/nhdefkey.c | 2 +- sys/winnt/nhraykey.c | 2 +- sys/winnt/ntsound.c | 2 +- sys/winnt/nttty.c | 57 +++++++-------------------- sys/winnt/stubs.c | 4 +- sys/winnt/win32api.h | 40 +++++++++++++------ sys/winnt/winnt.c | 94 +++++++++++++++++++++++++++++++++++++++++++- sys/winnt/winos.h | 20 ++++++++++ util/recover.c | 9 +++-- win/share/tile2bmp.c | 5 ++- win/win32/mhfont.c | 14 +++++++ win/win32/mhfont.h | 1 + win/win32/mhmap.c | 88 +++++++++++++++++++++++------------------ win/win32/mhmenu.c | 2 +- win/win32/mhstatus.c | 50 +++++++++++++++++------ 17 files changed, 276 insertions(+), 124 deletions(-) create mode 100644 sys/winnt/winos.h diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index c55805b09..cc60b3b3c 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -5,6 +5,10 @@ /* main.c - MSDOS, OS/2, ST, Amiga, and Windows NetHack */ +#ifdef WIN32 +#include "win32api.h" /* for GetModuleFileName */ +#endif + #include "hack.h" #include "dlb.h" @@ -22,10 +26,6 @@ #endif #endif -#ifdef WIN32 -#include "win32api.h" /* for GetModuleFileName */ -#endif - #ifdef __DJGPP__ #include /* for getcwd() prototype */ #endif diff --git a/sys/winnt/nh340key.c b/sys/winnt/nh340key.c index 8d512142e..78600ec67 100644 --- a/sys/winnt/nh340key.c +++ b/sys/winnt/nh340key.c @@ -13,9 +13,9 @@ static char where_to_get_source[] = "http://www.nethack.org/"; static char author[] = "The NetHack Development Team"; +#include "win32api.h" #include "hack.h" #include "wintty.h" -#include "win32api.h" extern HANDLE hConIn; extern INPUT_RECORD ir; diff --git a/sys/winnt/nhdefkey.c b/sys/winnt/nhdefkey.c index 5f7390955..f6d110adb 100644 --- a/sys/winnt/nhdefkey.c +++ b/sys/winnt/nhdefkey.c @@ -19,9 +19,9 @@ static char where_to_get_source[] = "http://www.nethack.org/"; static char author[] = "The NetHack Development Team"; +#include "win32api.h" #include "hack.h" #include "wintty.h" -#include "win32api.h" extern HANDLE hConIn; extern INPUT_RECORD ir; diff --git a/sys/winnt/nhraykey.c b/sys/winnt/nhraykey.c index 3b0a6ef04..a1f7af3ca 100644 --- a/sys/winnt/nhraykey.c +++ b/sys/winnt/nhraykey.c @@ -160,9 +160,9 @@ static char where_to_get_source[] = "http://www.nethack.org/"; static char author[] = "Ray Chason"; +#include "win32api.h" #include "hack.h" #include "wintty.h" -#include "win32api.h" extern HANDLE hConIn; extern INPUT_RECORD ir; diff --git a/sys/winnt/ntsound.c b/sys/winnt/ntsound.c index 0e4efbf16..c8ec07450 100644 --- a/sys/winnt/ntsound.c +++ b/sys/winnt/ntsound.c @@ -10,8 +10,8 @@ * */ -#include "hack.h" #include "win32api.h" +#include "hack.h" #include #ifdef USER_SOUNDS diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index 0409d3336..63ef24020 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -16,11 +16,12 @@ #ifdef WIN32 #define NEED_VARARGS /* Uses ... */ +#include "win32api.h" +#include "winos.h" #include "hack.h" #include "wintty.h" #include #include -#include "win32api.h" extern boolean getreturn_enabled; /* from sys/share/pcsys.c */ extern int redirect_stdout; @@ -569,6 +570,9 @@ char ch; } break; default: + + // Temporary fix. Tty putstatusfield() + inverse = (console.current_nhattr[ATR_INVERSE] && iflags.wc_inverse); console.attr = (inverse) ? ttycolors_inv[console.current_nhcolor] : @@ -601,42 +605,6 @@ char ch; * for win32. It is used for glyphs only, not text. */ -/* CP437 to Unicode mapping according to the Unicode Consortium */ -static const WCHAR cp437[] = { - 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, - 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, - 0x25BA, 0x25C4, 0x2195, 0x203C, 0x00B6, 0x00A7, 0x25AC, 0x21A8, - 0x2191, 0x2193, 0x2192, 0x2190, 0x221F, 0x2194, 0x25B2, 0x25BC, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x2302, - 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, - 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, - 0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, - 0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192, - 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, - 0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, - 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, - 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, - 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, - 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, - 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, - 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, - 0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4, - 0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229, - 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248, - 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0 -}; - void g_putch(in_ch) int in_ch; @@ -1690,12 +1658,17 @@ void set_cp_map() if (console.has_unicode) { UINT codePage = GetConsoleOutputCP(); - for (int i = 0; i < 256; i++) { - char c = (char)i; - int count = MultiByteToWideChar(codePage, 0, &c, 1, - &console.cpMap[i], 1); - ntassert(count == 1); + if (codePage == 437) { + memcpy(console.cpMap, cp437, sizeof(console.cpMap)); + } else { + for (int i = 0; i < 256; i++) { + char c = (char)i; + int count = MultiByteToWideChar(codePage, 0, &c, 1, + &console.cpMap[i], 1); + ntassert(count == 1); + } } + } } diff --git a/sys/winnt/stubs.c b/sys/winnt/stubs.c index 64193ce17..bb5ad82e4 100644 --- a/sys/winnt/stubs.c +++ b/sys/winnt/stubs.c @@ -2,6 +2,7 @@ /* Copyright (c) 2015 by Michael Allison */ /* NetHack may be freely redistributed. See license for details. */ +#include "win32api.h" #include "hack.h" #ifdef GUISTUB @@ -52,9 +53,6 @@ char *argv[]; #ifdef TTYSTUB -#include "hack.h" -#include "win32api.h" - HANDLE hConIn; HANDLE hConOut; int GUILaunched; diff --git a/sys/winnt/win32api.h b/sys/winnt/win32api.h index b4dc7e4c8..28514b0ce 100644 --- a/sys/winnt/win32api.h +++ b/sys/winnt/win32api.h @@ -7,22 +7,36 @@ * header files & NetHack before including windows.h, so all NetHack * files should include "win32api.h" rather than . */ +#ifndef WIN32API +#define WIN32API + #if defined(_MSC_VER) -#undef strcmpi -#undef min -#undef max -#pragma warning(disable : 4142) /* Warning, Benign redefinition of type */ -#pragma pack(8) + +#if defined(HACK_H) +#error win32api.h must be included before hack.h #endif -#define WIN32_LEAN_AND_MEAN +#if defined(strcmpi) +#error win32api.h should be included first +#endif -#undef Protection /* We have a global name space collision. No source file - using win32api.h should be using the Protection macro - from youprop.h. - A better fix would be to ensure we include all window - header files before we start clobbering the global name - space with NetHack specific macros. */ +#if defined(min) +#error win32api.h should be included first +#endif + +#if defined(max) +#error win32api.h should be included first +#endif + +#if defined(Protection) +#error win32api.h should be included first +#endif + +#pragma warning(disable : 4142) /* Warning, Benign redefinition of type */ +#pragma pack(8) +#endif // _MSC_VER + +#define WIN32_LEAN_AND_MEAN #include #include @@ -31,4 +45,6 @@ #pragma pack() #endif +#endif // WIN32API + /*win32api.h*/ diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 966b268e0..93f372d62 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -11,6 +11,8 @@ * */ +#include "winos.h" + #define NEED_VARARGS #include "hack.h" #include @@ -18,7 +20,6 @@ #include #endif #include -#include "win32api.h" #ifdef TTY_GRAPHICS #include "wintty.h" #endif @@ -491,6 +492,95 @@ void nethack_enter_winnt() nethack_enter_nttty(); #endif } + +/* CP437 to Unicode mapping according to the Unicode Consortium */ +const WCHAR cp437[256] = { + 0x0020, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, + 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C, + 0x25BA, 0x25C4, 0x2195, 0x203C, 0x00B6, 0x00A7, 0x25AC, 0x21A8, + 0x2191, 0x2193, 0x2192, 0x2190, 0x221F, 0x2194, 0x25B2, 0x25BC, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x2302, + 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, + 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, + 0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, + 0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192, + 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, + 0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, + 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, + 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, + 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, + 0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4, + 0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229, + 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248, + 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0 +}; + +WCHAR * +winos_ascii_to_wide_str(const unsigned char * src, WCHAR * dst, size_t dstLength) +{ + size_t i = 0; + while(i < dstLength - 1 && src[i] != 0) + dst[i++] = cp437[src[i]]; + dst[i] = 0; + return dst; +} + +WCHAR +winos_ascii_to_wide(const unsigned char c) +{ + return cp437[c]; +} + +BOOL winos_font_support_cp437(HFONT hFont) +{ + BOOL allFound = FALSE; + HDC hdc = GetDC(NULL); + HFONT oldFont = SelectObject(hdc, hFont); + + DWORD size = GetFontUnicodeRanges(hdc, NULL); + GLYPHSET *glyphSet = (GLYPHSET *) malloc(size); + + if (glyphSet != NULL) { + GetFontUnicodeRanges(hdc, glyphSet); + + allFound = TRUE; + for (int i = 0; i < 256 && allFound; i++) { + WCHAR wc = cp437[i]; + BOOL found = FALSE; + for (DWORD j = 0; j < glyphSet->cRanges && !found; j++) { + WCHAR first = glyphSet->ranges[j].wcLow; + WCHAR last = first + glyphSet->ranges[j].cGlyphs - 1; + + if (wc >= first && wc <= last) + found = TRUE; + } + if (!found) + allFound = FALSE; + } + + free(glyphSet); + } + + SelectObject(hdc, oldFont); + ReleaseDC(NULL, hdc); + + return allFound; +} + #endif /* WIN32 */ -/*winnt.c*/ +/*winnt.c*/ \ No newline at end of file diff --git a/sys/winnt/winos.h b/sys/winnt/winos.h new file mode 100644 index 000000000..39a4b408e --- /dev/null +++ b/sys/winnt/winos.h @@ -0,0 +1,20 @@ +/* NetHack 3.6 winos.h $NHDT-Date: 1524321419 2018/04/21 14:36:59 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */ +/* Copyright (c) NetHack PC Development Team 2018 */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef WINOS_H +#define WINOS_H + +#include "win32api.h" + +extern const WCHAR cp437[256]; + +WCHAR * +winos_ascii_to_wide_str(const unsigned char * src, WCHAR * dst, size_t dstLength); + +WCHAR +winos_ascii_to_wide(const unsigned char c); + +BOOL winos_font_support_cp437(HFONT hFont); + +#endif // WINOS_H diff --git a/util/recover.c b/util/recover.c index 27c58e709..415313bee 100644 --- a/util/recover.c +++ b/util/recover.c @@ -7,15 +7,16 @@ * level files. Requires that the `checkpoint' option be enabled at the * time NetHack creates those level files. */ -#include "config.h" -#if !defined(O_WRONLY) && !defined(LSC) && !defined(AZTEC_C) -#include -#endif #ifdef WIN32 #include #include "win32api.h" #endif +#include "config.h" +#if !defined(O_WRONLY) && !defined(LSC) && !defined(AZTEC_C) +#include +#endif + #ifdef VMS extern int FDECL(vms_creat, (const char *, unsigned)); extern int FDECL(vms_open, (const char *, int, unsigned)); diff --git a/win/share/tile2bmp.c b/win/share/tile2bmp.c index d0fb36333..ca2c7dd73 100644 --- a/win/share/tile2bmp.c +++ b/win/share/tile2bmp.c @@ -12,12 +12,13 @@ /* #pragma warning(4103:disable) */ -#include "hack.h" -#include "tile.h" #ifndef __GNUC__ #include "win32api.h" #endif +#include "hack.h" +#include "tile.h" + #include #if defined(UINT32_MAX) && defined(INT32_MAX) && defined(UINT16_MAX) #define UINT8 uint8_t diff --git a/win/win32/mhfont.c b/win/win32/mhfont.c index 1b802f2d0..12edec439 100644 --- a/win/win32/mhfont.c +++ b/win/win32/mhfont.c @@ -4,6 +4,7 @@ /* font management and such */ +#include "winos.h" #include "mhfont.h" #define MAXFONTS 64 @@ -12,6 +13,7 @@ static struct font_table_entry { int code; HFONT hFont; + BOOL supportsUnicode; } font_table[MAXFONTS]; static int font_table_size = 0; HFONT version_splash_font; @@ -50,6 +52,16 @@ mswin_destroy_splashfonts() DeleteObject(version_splash_font); } +BOOL +mswin_font_supports_unicode(HFONT hFont) +{ + for (int i = 0; i < font_table_size; i++) + if (font_table[i].hFont == hFont) + return font_table[i].supportsUnicode; + + return FALSE; +} + /* create font based on window type, charater attributes and window device context */ HGDIOBJ @@ -198,6 +210,8 @@ mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace) font_table[font_index].code = NHFONT_CODE(win_type, attr); font_table[font_index].hFont = fnt; + font_table[font_index].supportsUnicode = winos_font_support_cp437(fnt); + return fnt; } diff --git a/win/win32/mhfont.h b/win/win32/mhfont.h index de5fdc8e5..76e651215 100644 --- a/win/win32/mhfont.h +++ b/win/win32/mhfont.h @@ -9,6 +9,7 @@ #include "winMS.h" +BOOL mswin_font_supports_unicode(HFONT hFont); HGDIOBJ mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace); void mswin_init_splashfonts(HWND hWnd); void mswin_destroy_splashfonts(void); diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 8b301da66..347de429c 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -2,12 +2,13 @@ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ -#include "winMS.h" -#include "resource.h" +#include "winos.h" #include "mhmap.h" -#include "mhmsg.h" -#include "mhinput.h" #include "mhfont.h" +#include "mhinput.h" +#include "mhmsg.h" +#include "resource.h" +#include "winMS.h" #include "color.h" #include "patchlevel.h" @@ -17,12 +18,14 @@ extern short glyph2tile[]; -#define TILEBMP_X(ntile) ((ntile % GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_X) -#define TILEBMP_Y(ntile) ((ntile / GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_Y) +#define TILEBMP_X(ntile) \ + ((ntile % GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_X) +#define TILEBMP_Y(ntile) \ + ((ntile / GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_Y) /* map window data */ typedef struct mswin_nethack_map_window { - int map[COLNO][ROWNO]; /* glyph map */ + int map[COLNO][ROWNO]; /* glyph map */ int bkmap[COLNO][ROWNO]; /* backround glyph map */ int mapMode; /* current map mode */ @@ -35,6 +38,7 @@ typedef struct mswin_nethack_map_window { POINT map_orig; /* map origin point */ HFONT hMapFont; /* font for ASCII mode */ + boolean bUnicodeFont; /* font supports unicode page 437 */ } NHMapWindow, *PNHMapWindow; static TCHAR szNHMapWindowClass[] = TEXT("MSNethackMapWndClass"); @@ -199,6 +203,7 @@ mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw) NH_A2W(NHMAP_FONT_NAME, lgfnt.lfFaceName, LF_FACESIZE); } data->hMapFont = CreateFontIndirect(&lgfnt); + data->bUnicodeFont = winos_font_support_cp437(data->hMapFont); mswin_cliparound(data->xCur, data->yCur); @@ -460,13 +465,13 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) data->map[msg_data->x][msg_data->y] = msg_data->glyph; data->bkmap[msg_data->x][msg_data->y] = msg_data->bkglyph; - /* invalidate the update area. Erase backround if there + /* invalidate the update area. Erase backround if there is nothing to paint or we are in text mode */ nhcoord2display(data, msg_data->x, msg_data->y, &rt); - InvalidateRect(hWnd, &rt, - (((msg_data->glyph == NO_GLYPH) && (msg_data->bkglyph == NO_GLYPH)) - || data->bAsciiMode - || Is_rogue_level(&u.uz))); + InvalidateRect(hWnd, &rt, + (((msg_data->glyph == NO_GLYPH) + && (msg_data->bkglyph == NO_GLYPH)) + || data->bAsciiMode || Is_rogue_level(&u.uz))); } } break; @@ -664,7 +669,7 @@ onPaint(HWND hWnd) for (j = paint_rt.top; j < paint_rt.bottom; j++) if (data->map[i][j] >= 0) { char ch; - TCHAR wch; + WCHAR wch; RECT glyph_rect; int color; unsigned special; @@ -703,9 +708,15 @@ onPaint(HWND hWnd) OldFg = SetTextColor(hDC, nhcolor_to_RGB(color)); } #endif - - DrawText(hDC, NH_A2W(&ch, &wch, 1), 1, &glyph_rect, + if (data->bUnicodeFont) { + wch = winos_ascii_to_wide(ch); + DrawTextW(hDC, &wch, 1, &glyph_rect, + DT_CENTER | DT_VCENTER | DT_NOPREFIX); + } else { + DrawTextA(hDC, &ch, 1, &glyph_rect, DT_CENTER | DT_VCENTER | DT_NOPREFIX); + } + SetTextColor(hDC, OldFg); } SelectObject(hDC, oldFont); @@ -741,7 +752,7 @@ onPaint(HWND hWnd) data->xScrTile, data->yScrTile, tileDC, t_x, t_y, GetNHApp()->mapTile_X, GetNHApp()->mapTile_Y, SRCCOPY); - layer ++; + layer++; } if ((glyph != NO_GLYPH) && (glyph != bkglyph)) { @@ -753,8 +764,8 @@ onPaint(HWND hWnd) if (layer > 0) { (*GetNHApp()->lpfnTransparentBlt)( hDC, glyph_rect.left, glyph_rect.top, - data->xScrTile, data->yScrTile, tileDC, - t_x, t_y, GetNHApp()->mapTile_X, + data->xScrTile, data->yScrTile, tileDC, t_x, + t_y, GetNHApp()->mapTile_X, GetNHApp()->mapTile_Y, TILE_BK_COLOR); } else { StretchBlt(hDC, glyph_rect.left, glyph_rect.top, @@ -763,18 +774,18 @@ onPaint(HWND hWnd) GetNHApp()->mapTile_Y, SRCCOPY); } - layer ++; - } + layer++; + } #ifdef USE_PILEMARK - /* rely on NetHack core helper routine */ - (void) mapglyph(data->map[i][j], &mgch, &color, - &special, i, j); - if ((glyph != NO_GLYPH) && (special & MG_PET) + /* rely on NetHack core helper routine */ + (void) mapglyph(data->map[i][j], &mgch, &color, &special, + i, j); + if ((glyph != NO_GLYPH) && (special & MG_PET) #else - if ((glyph != NO_GLYPH) && glyph_is_pet(glyph) + if ((glyph != NO_GLYPH) && glyph_is_pet(glyph) #endif - && iflags.wc_hilite_pet) { + && iflags.wc_hilite_pet) { /* apply pet mark transparently over pet image */ HDC hdcPetMark; @@ -782,35 +793,35 @@ onPaint(HWND hWnd) /* this is DC for petmark bitmap */ hdcPetMark = CreateCompatibleDC(hDC); - bmPetMarkOld = SelectObject( - hdcPetMark, GetNHApp()->bmpPetMark); + bmPetMarkOld = + SelectObject(hdcPetMark, GetNHApp()->bmpPetMark); (*GetNHApp()->lpfnTransparentBlt)( hDC, glyph_rect.left, glyph_rect.top, - data->xScrTile, data->yScrTile, hdcPetMark, 0, - 0, TILE_X, TILE_Y, TILE_BK_COLOR); + data->xScrTile, data->yScrTile, hdcPetMark, 0, 0, + TILE_X, TILE_Y, TILE_BK_COLOR); SelectObject(hdcPetMark, bmPetMarkOld); DeleteDC(hdcPetMark); } #ifdef USE_PILEMARK - if ((glyph != NO_GLYPH) - && (special & MG_OBJPILE) && iflags.hilite_pile) { + if ((glyph != NO_GLYPH) && (special & MG_OBJPILE) + && iflags.hilite_pile) { /* apply pilemark transparently over other image */ HDC hdcPileMark; HBITMAP bmPileMarkOld; /* this is DC for pilemark bitmap */ hdcPileMark = CreateCompatibleDC(hDC); - bmPileMarkOld = SelectObject( - hdcPileMark, GetNHApp()->bmpPileMark); + bmPileMarkOld = SelectObject(hdcPileMark, + GetNHApp()->bmpPileMark); (*GetNHApp()->lpfnTransparentBlt)( hDC, glyph_rect.left, glyph_rect.top, - data->xScrTile, data->yScrTile, hdcPileMark, 0, - 0, TILE_X, TILE_Y, TILE_BK_COLOR); + data->xScrTile, data->yScrTile, hdcPileMark, 0, 0, + TILE_X, TILE_Y, TILE_BK_COLOR); SelectObject(hdcPileMark, bmPileMarkOld); - DeleteDC(hdcPileMark); - } + DeleteDC(hdcPileMark); + } #endif } @@ -1030,4 +1041,3 @@ nhcolor_to_RGB(int c) return GetNHApp()->regMapColors[c]; return RGB(0x00, 0x00, 0x00); } - diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index 6b0b4fda2..a298f3893 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -561,7 +561,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) saveFont = SelectObject(hdc, mswin_get_font(NHW_MENU, ATR_NONE, hdc, FALSE)); SetRect(&text_rt, 0, 0, 0, 0); - DrawText(hdc, msg_data->text, strlen(msg_data->text), &text_rt, + DrawTextA(hdc, msg_data->text, strlen(msg_data->text), &text_rt, DT_CALCRECT | DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE); data->text.text_box_size.cx = diff --git a/win/win32/mhstatus.c b/win/win32/mhstatus.c index 80799ad82..074762816 100644 --- a/win/win32/mhstatus.c +++ b/win/win32/mhstatus.c @@ -3,6 +3,7 @@ /* NetHack may be freely redistributed. See license for details. */ #include +#include "winos.h" #include "winMS.h" #include "mhstatus.h" #include "mhmsg.h" @@ -278,7 +279,7 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) int **fop; SIZE sz; HGDIOBJ normalFont, boldFont; - TCHAR wbuf[BUFSZ]; + WCHAR wbuf[BUFSZ]; RECT rt; PAINTSTRUCT ps; HDC hdc; @@ -335,7 +336,8 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) clr = data->colors[*f] & 0x00ff; atr = (data->colors[*f] & 0xff00) >> 8; vlen = strlen(data->vals[*f]); - NH_A2W(data->vals[*f], wbuf, SIZE(wbuf)); + + const char *str = data->vals[*f]; if (atr & HL_BOLD) fntatr = ATR_BOLD; @@ -347,7 +349,13 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) fntatr = ATR_BLINK; else if (atr & HL_DIM) fntatr = ATR_DIM; + fnt = mswin_get_font(NHW_STATUS, fntatr, hdc, FALSE); + + BOOL useUnicode = mswin_font_supports_unicode(fnt); + + winos_ascii_to_wide_str(str, wbuf, SIZE(wbuf)); + nFg = (clr == NO_COLOR ? status_fg_color : ((clr >= 0 && clr < CLR_MAX) ? nhcolor_to_RGB(clr) : status_fg_color)); @@ -365,11 +373,19 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) /* SetTextColor(hdc, nhcolor_to_RGB(hpbar_color)); */ SetTextColor(hdc, status_fg_color); - /* get bounding rectangle */ - GetTextExtentPoint32(hdc, wbuf, vlen, &sz); + if (useUnicode) { + /* get bounding rectangle */ + GetTextExtentPoint32W(hdc, wbuf, vlen, &sz); - /* first draw title normally */ - DrawText(hdc, wbuf, vlen, &rt, DT_LEFT); + /* first draw title normally */ + DrawTextW(hdc, wbuf, vlen, &rt, DT_LEFT); + } else { + /* get bounding rectangle */ + GetTextExtentPoint32A(hdc, str, vlen, &sz); + + /* first draw title normally */ + DrawTextA(hdc, str, vlen, &rt, DT_LEFT); + } if (hpbar_percent > 0) { /* calc bar length */ @@ -385,7 +401,11 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) FillRect(hdc, &barrect, back_brush); SetBkMode(hdc, TRANSPARENT); SetTextColor(hdc, nBg); - DrawText(hdc, wbuf, vlen, &barrect, DT_LEFT); + + if (useUnicode) + DrawTextW(hdc, wbuf, vlen, &barrect, DT_LEFT); + else + DrawTextA(hdc, str, vlen, &barrect, DT_LEFT); } DeleteObject(back_brush); } else { @@ -401,11 +421,19 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) SetBkColor(hdc, nBg); SetTextColor(hdc, nFg); - /* get bounding rectangle */ - GetTextExtentPoint32(hdc, wbuf, vlen, &sz); + if (useUnicode) { + /* get bounding rectangle */ + GetTextExtentPoint32W(hdc, wbuf, vlen, &sz); - /* draw */ - DrawText(hdc, wbuf, vlen, &rt, DT_LEFT); + /* draw */ + DrawTextW(hdc, wbuf, vlen, &rt, DT_LEFT); + } else { + /* get bounding rectangle */ + GetTextExtentPoint32A(hdc, str, vlen, &sz); + + /* draw */ + DrawTextA(hdc, str, vlen, &rt, DT_LEFT); + } } assert(sz.cy >= 0); From 53a6ce2c2a28d38cdfa54ace70473ceee7fff1dd Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 12 Nov 2018 02:13:32 -0800 Subject: [PATCH 06/12] conflicting countdowns I tried 'pick all' in the #wizintrinsics' menu and after 30 turns, died with "poisoned by a poisoned, while vomiting". Food poisioning and/or terminal illness beat the other fatal conditions to the coup de gras. However, the final stage of vomiting sets Sick to 0 cure food poisoning and ends up clobbering the killer reason if Sick is due to terminal illness. It's feasible for that to happen without using #wizintrinsic, so this fixes that, and also a few other combinations that seemed contradictory: 1) limbs turn to stone during Stoned countdown now cures wounded legs; 2) turn to stone (a couple of turns later) cures vomiting and sliming; 3) turning to slime during Slimed countdown cures stoning. --- src/eat.c | 3 ++- src/potion.c | 11 +++++++++-- src/timeout.c | 27 +++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/eat.c b/src/eat.c index 40c7a4399..cff0a12fd 100644 --- a/src/eat.c +++ b/src/eat.c @@ -3181,7 +3181,8 @@ vomit() /* A good idea from David Neves */ dealing with some esoteric body_part() */ Your("jaw gapes convulsively."); } else { - make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE); + if (Sick && (u.usick_type & SICK_VOMITABLE) != 0) + make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE); /* if not enough in stomach to actually vomit then dry heave; vomiting_dialog() gives a vomit message when its countdown reaches 0, but only if u.uhs < FAINTING (and !cantvomit()) */ diff --git a/src/potion.c b/src/potion.c index 6904bc315..281a2e4a3 100644 --- a/src/potion.c +++ b/src/potion.c @@ -113,6 +113,7 @@ const char *cause; /* sickness cause */ boolean talk; int type; { + struct kinfo *kptr; long old = Sick; #if 0 @@ -148,11 +149,17 @@ int type; context.botl = TRUE; } + kptr = find_delayed_killer(SICK); if (Sick) { exercise(A_CON, FALSE); - delayed_killer(SICK, KILLED_BY_AN, cause); + if (!old || !kptr) { + int kpfx = ((cause && !strcmp(cause, "#wizintrinsic")) + ? KILLED_BY : KILLED_BY_AN); + + delayed_killer(SICK, kpfx, cause); + } } else - dealloc_killer(find_delayed_killer(SICK)); + dealloc_killer(kptr); } void diff --git a/src/timeout.c b/src/timeout.c index a75fc66b9..1360f1132 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -136,10 +136,19 @@ stoned_dialogue() nomul(-3); /* can't move anymore */ multi_reason = "getting stoned"; nomovemsg = You_can_move_again; /* not unconscious */ + /* "your limbs have turned to stone" so terminate wounded legs */ + if ((HWounded_legs & TIMEOUT) != 0L && !u.usteed) + set_itimeout(&HWounded_legs, 0L); break; - case 2: + case 2: /* turned to stone */ if ((HDeaf & TIMEOUT) > 0L && (HDeaf & TIMEOUT) < 5L) set_itimeout(&HDeaf, 5L); /* avoid Hear_again at tail end */ + /* if also vomiting or turning into slime, stop those */ + if ((Vomiting & TIMEOUT) != 0L) + set_itimeout(&Vomiting, 0L), context.botl = 1; + if ((Slimed & TIMEOUT) != 0L) + set_itimeout(&Slimed, 0L), context.botl = 1; + break; default: break; } @@ -318,15 +327,25 @@ slime_dialogue() } else pline1(buf); } - if (i == 3L) { /* limbs becoming oozy */ + + switch (i) { + case 3L: /* limbs becoming oozy */ HFast = 0L; /* lose intrinsic speed */ if (!Popeye(SLIMED)) stop_occupation(); if (multi > 0) nomul(0); + break; + case 2L: /* skin begins to peel */ + if ((HDeaf & TIMEOUT) > 0L && (HDeaf & TIMEOUT) < 5L) + set_itimeout(&HDeaf, 5L); /* avoid Hear_again at tail end */ + break; + case 1L: /* turning into slime */ + /* if also turning to stone, stop doing that (no message) */ + if ((Stoned & TIMEOUT) != 0L) + set_itimeout(&Stoned, 0L), context.botl = 1; + break; } - if (i == 2L && (HDeaf & TIMEOUT) > 0L && (HDeaf & TIMEOUT) < 5L) - set_itimeout(&HDeaf, 5L); /* avoid Hear_again at tail end */ exercise(A_DEX, FALSE); } From f3bc4af2420454b2286d57126b5fdc29221a87ab Mon Sep 17 00:00:00 2001 From: Bart House Date: Mon, 12 Nov 2018 09:13:51 -0800 Subject: [PATCH 07/12] Removing support for Visual Studio 2015 solution. --- sys/winnt/Install.nt | 21 +-- win/win32/mhmap.c | 1 + win/win32/vs2015/NetHack.sln | 197 ----------------------- win/win32/vs2015/NetHack.vcxproj | 232 ---------------------------- win/win32/vs2015/NetHackW.vcxproj | 191 ----------------------- win/win32/vs2015/afterdgncomp.proj | 12 -- win/win32/vs2015/afterdlb.proj | 17 -- win/win32/vs2015/afterlevcomp.proj | 12 -- win/win32/vs2015/aftermakedefs.proj | 21 --- win/win32/vs2015/afternethack.proj | 15 -- win/win32/vs2015/afterrecover.proj | 12 -- win/win32/vs2015/aftertile2bmp.proj | 13 -- win/win32/vs2015/aftertilemap.proj | 12 -- win/win32/vs2015/afteruudecode.proj | 20 --- win/win32/vs2015/build.bat | 44 ------ win/win32/vs2015/common.props | 41 ----- win/win32/vs2015/config.props | 21 --- win/win32/vs2015/console.props | 11 -- win/win32/vs2015/default.props | 18 --- win/win32/vs2015/default_dll.props | 17 -- win/win32/vs2015/dgncomp.vcxproj | 125 --------------- win/win32/vs2015/dirs.props | 24 --- win/win32/vs2015/dlb.vcxproj | 43 ------ win/win32/vs2015/dll.props | 11 -- win/win32/vs2015/files.props | 227 --------------------------- win/win32/vs2015/levcomp.vcxproj | 88 ----------- win/win32/vs2015/makedefs.vcxproj | 55 ------- win/win32/vs2015/nh340key.def | 8 - win/win32/vs2015/nh340key.vcxproj | 42 ----- win/win32/vs2015/nhdefkey.def | 8 - win/win32/vs2015/nhdefkey.vcxproj | 42 ----- win/win32/vs2015/nhraykey.def | 8 - win/win32/vs2015/nhraykey.vcxproj | 42 ----- win/win32/vs2015/notes.txt | 45 ------ win/win32/vs2015/recover.vcxproj | 45 ------ win/win32/vs2015/tile2bmp.vcxproj | 47 ------ win/win32/vs2015/tilemap.vcxproj | 81 ---------- win/win32/vs2015/tiles.vcxproj | 124 --------------- win/win32/vs2015/uudecode.vcxproj | 29 ---- 39 files changed, 8 insertions(+), 2014 deletions(-) delete mode 100755 win/win32/vs2015/NetHack.sln delete mode 100755 win/win32/vs2015/NetHack.vcxproj delete mode 100755 win/win32/vs2015/NetHackW.vcxproj delete mode 100644 win/win32/vs2015/afterdgncomp.proj delete mode 100644 win/win32/vs2015/afterdlb.proj delete mode 100644 win/win32/vs2015/afterlevcomp.proj delete mode 100644 win/win32/vs2015/aftermakedefs.proj delete mode 100644 win/win32/vs2015/afternethack.proj delete mode 100644 win/win32/vs2015/afterrecover.proj delete mode 100644 win/win32/vs2015/aftertile2bmp.proj delete mode 100644 win/win32/vs2015/aftertilemap.proj delete mode 100644 win/win32/vs2015/afteruudecode.proj delete mode 100644 win/win32/vs2015/build.bat delete mode 100644 win/win32/vs2015/common.props delete mode 100644 win/win32/vs2015/config.props delete mode 100644 win/win32/vs2015/console.props delete mode 100644 win/win32/vs2015/default.props delete mode 100644 win/win32/vs2015/default_dll.props delete mode 100755 win/win32/vs2015/dgncomp.vcxproj delete mode 100644 win/win32/vs2015/dirs.props delete mode 100644 win/win32/vs2015/dlb.vcxproj delete mode 100644 win/win32/vs2015/dll.props delete mode 100644 win/win32/vs2015/files.props delete mode 100755 win/win32/vs2015/levcomp.vcxproj delete mode 100755 win/win32/vs2015/makedefs.vcxproj delete mode 100644 win/win32/vs2015/nh340key.def delete mode 100644 win/win32/vs2015/nh340key.vcxproj delete mode 100644 win/win32/vs2015/nhdefkey.def delete mode 100755 win/win32/vs2015/nhdefkey.vcxproj delete mode 100644 win/win32/vs2015/nhraykey.def delete mode 100644 win/win32/vs2015/nhraykey.vcxproj delete mode 100644 win/win32/vs2015/notes.txt delete mode 100755 win/win32/vs2015/recover.vcxproj delete mode 100755 win/win32/vs2015/tile2bmp.vcxproj delete mode 100755 win/win32/vs2015/tilemap.vcxproj delete mode 100755 win/win32/vs2015/tiles.vcxproj delete mode 100755 win/win32/vs2015/uudecode.vcxproj diff --git a/sys/winnt/Install.nt b/sys/winnt/Install.nt index dd278e0a4..9d8fd01e0 100644 --- a/sys/winnt/Install.nt +++ b/sys/winnt/Install.nt @@ -22,7 +22,6 @@ You can build a TTY version of NetHack and a Windows Graphical version. You can use one of the following build environments: o A copy of Microsoft Visual Studio 2017 Community Edition - OR Microsoft Visual Studio 2015 Express OR @@ -35,20 +34,15 @@ version. You can use one of the following build environments: Graphical version. /--------------------------------------------------------\ -| Building And Running Using Visual Studio 2015 or | -| Visual Studio 2017 | +| Building And Running Using Visual Studio 2017 | \--------------------------------------------------------/ -If you are NOT using Visual Studio 2015 or Visual Studio 2017 IDE, or -you prefer to build using a Make utility and a Makefile proceed -to "Building Using Make". +If you are NOT using Visual Studio 2017 IDE, or you prefer to build +using a Make utility and a Makefile proceed to "Building Using Make". -When using either Visual Studio 2015 or Visual Studio 2017, you simply -need to load the solution file within the IDE, build the solution and -run the version of NetHack you wish to run. - -The Visual Studio 2015 NetHack solution file can be found here: - win\win32\vs2015\NetHack.sln +When using either Visual Studio 2017, you simply need to load the +solution file within the IDE, build the solution and run the version +of NetHack you wish to run. The Visual Studio 2017 NetHack solution file can be found here: win\win32\vs2017\NetHack.sln @@ -64,8 +58,7 @@ You can also build all the projects for all platforms and configurations using a "build.bat" batch file found in the same directory as the solution. Open a developer command prompt for the version of Visual Studio you are -using. Change to the appropriate directory (i.e. win\win32\vs2015 for -VS2015 builds, win\win32\vs2017 for VS2017 builds) and run "build.bat". +using. Change to the directory win\win32\vs2017 and run "build.bat". /-----------------------------------\ | Building Using Make | diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 347de429c..de95d687d 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -13,6 +13,7 @@ #include "color.h" #include "patchlevel.h" +//#define NHMAP_FONT_NAME TEXT("Terminal") #define NHMAP_FONT_NAME TEXT("Terminal") #define MAXWINDOWTEXT 255 diff --git a/win/win32/vs2015/NetHack.sln b/win/win32/vs2015/NetHack.sln deleted file mode 100755 index 2c2e78230..000000000 --- a/win/win32/vs2015/NetHack.sln +++ /dev/null @@ -1,197 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetHackW", "NetHackW.vcxproj", "{CEC5D360-8804-454F-8591-002184C23499}" - ProjectSection(ProjectDependencies) = postProject - {93F10526-209E-41D7-BBEA-775787876895} = {93F10526-209E-41D7-BBEA-775787876895} - {63F9B82B-F589-4082-ABE5-D4F0682050AB} = {63F9B82B-F589-4082-ABE5-D4F0682050AB} - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} = {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - {642BC75D-ABAF-403E-8224-7C725FD4CB42} = {642BC75D-ABAF-403E-8224-7C725FD4CB42} - {6813477F-64B6-4B97-B230-438D0D233385} = {6813477F-64B6-4B97-B230-438D0D233385} - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} = {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} = {8A3F81C7-2968-49A8-86BF-2669412AD7DE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dgncomp", "dgncomp.vcxproj", "{8A3F81C7-2968-49A8-86BF-2669412AD7DE}" - ProjectSection(ProjectDependencies) = postProject - {642BC75D-ABAF-403E-8224-7C725FD4CB42} = {642BC75D-ABAF-403E-8224-7C725FD4CB42} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dlb", "dlb.vcxproj", "{0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}" - ProjectSection(ProjectDependencies) = postProject - {63F9B82B-F589-4082-ABE5-D4F0682050AB} = {63F9B82B-F589-4082-ABE5-D4F0682050AB} - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} = {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} = {8A3F81C7-2968-49A8-86BF-2669412AD7DE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "levcomp", "levcomp.vcxproj", "{9DD9C52E-E8C9-4533-BD22-83C055C0AABA}" - ProjectSection(ProjectDependencies) = postProject - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makedefs", "makedefs.vcxproj", "{BA3DD34C-04B7-40D0-B373-9329AA9E8945}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recover", "recover.vcxproj", "{2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tile2bmp", "tile2bmp.vcxproj", "{642BC75D-ABAF-403E-8224-7C725FD4CB42}" - ProjectSection(ProjectDependencies) = postProject - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} = {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tilemap", "tilemap.vcxproj", "{93F10526-209E-41D7-BBEA-775787876895}" - ProjectSection(ProjectDependencies) = postProject - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} = {8A3F81C7-2968-49A8-86BF-2669412AD7DE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uudecode", "uudecode.vcxproj", "{63F9B82B-F589-4082-ABE5-D4F0682050AB}" - ProjectSection(ProjectDependencies) = postProject - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetHack", "NetHack.vcxproj", "{609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}" - ProjectSection(ProjectDependencies) = postProject - {63F9B82B-F589-4082-ABE5-D4F0682050AB} = {63F9B82B-F589-4082-ABE5-D4F0682050AB} - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} = {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - {6813477F-64B6-4B97-B230-438D0D233385} = {6813477F-64B6-4B97-B230-438D0D233385} - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} = {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} = {8A3F81C7-2968-49A8-86BF-2669412AD7DE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nhdefkey", "nhdefkey.vcxproj", "{6813477F-64B6-4B97-B230-438D0D233385}" - ProjectSection(ProjectDependencies) = postProject - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nh340key", "nh340key.vcxproj", "{BE04E242-A1E9-4593-B95B-057F37330B76}" - ProjectSection(ProjectDependencies) = postProject - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nhraykey", "nhraykey.vcxproj", "{2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}" - ProjectSection(ProjectDependencies) = postProject - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CEC5D360-8804-454F-8591-002184C23499}.Debug|Win32.ActiveCfg = Debug|Win32 - {CEC5D360-8804-454F-8591-002184C23499}.Debug|Win32.Build.0 = Debug|Win32 - {CEC5D360-8804-454F-8591-002184C23499}.Debug|x64.ActiveCfg = Debug|x64 - {CEC5D360-8804-454F-8591-002184C23499}.Debug|x64.Build.0 = Debug|x64 - {CEC5D360-8804-454F-8591-002184C23499}.Release|Win32.ActiveCfg = Release|Win32 - {CEC5D360-8804-454F-8591-002184C23499}.Release|Win32.Build.0 = Release|Win32 - {CEC5D360-8804-454F-8591-002184C23499}.Release|x64.ActiveCfg = Release|x64 - {CEC5D360-8804-454F-8591-002184C23499}.Release|x64.Build.0 = Release|x64 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Debug|Win32.ActiveCfg = Debug|Win32 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Debug|Win32.Build.0 = Debug|Win32 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Debug|x64.ActiveCfg = Debug|x64 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Debug|x64.Build.0 = Debug|x64 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Release|Win32.ActiveCfg = Release|Win32 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Release|Win32.Build.0 = Release|Win32 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Release|x64.ActiveCfg = Release|x64 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Release|x64.Build.0 = Release|x64 - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Debug|Win32.ActiveCfg = Debug|Win32 - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Debug|Win32.Build.0 = Debug|Win32 - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Debug|x64.ActiveCfg = Debug|x64 - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Debug|x64.Build.0 = Debug|x64 - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Release|Win32.ActiveCfg = Release|Win32 - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Release|Win32.Build.0 = Release|Win32 - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Release|x64.ActiveCfg = Release|x64 - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Release|x64.Build.0 = Release|x64 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Debug|Win32.ActiveCfg = Debug|Win32 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Debug|Win32.Build.0 = Debug|Win32 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Debug|x64.ActiveCfg = Debug|x64 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Debug|x64.Build.0 = Debug|x64 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Release|Win32.ActiveCfg = Release|Win32 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Release|Win32.Build.0 = Release|Win32 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Release|x64.ActiveCfg = Release|x64 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Release|x64.Build.0 = Release|x64 - {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Debug|Win32.ActiveCfg = Debug|Win32 - {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Debug|Win32.Build.0 = Debug|Win32 - {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Debug|x64.ActiveCfg = Debug|x64 - {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Debug|x64.Build.0 = Debug|x64 - {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Release|Win32.ActiveCfg = Release|Win32 - {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Release|Win32.Build.0 = Release|Win32 - {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Release|x64.ActiveCfg = Release|x64 - {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Release|x64.Build.0 = Release|x64 - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}.Debug|Win32.ActiveCfg = Debug|Win32 - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}.Debug|Win32.Build.0 = Debug|Win32 - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}.Debug|x64.ActiveCfg = Debug|x64 - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}.Debug|x64.Build.0 = Debug|x64 - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}.Release|Win32.ActiveCfg = Release|Win32 - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}.Release|Win32.Build.0 = Release|Win32 - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}.Release|x64.ActiveCfg = Release|x64 - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E}.Release|x64.Build.0 = Release|x64 - {642BC75D-ABAF-403E-8224-7C725FD4CB42}.Debug|Win32.ActiveCfg = Debug|Win32 - {642BC75D-ABAF-403E-8224-7C725FD4CB42}.Debug|Win32.Build.0 = Debug|Win32 - {642BC75D-ABAF-403E-8224-7C725FD4CB42}.Debug|x64.ActiveCfg = Debug|x64 - {642BC75D-ABAF-403E-8224-7C725FD4CB42}.Debug|x64.Build.0 = Debug|x64 - {642BC75D-ABAF-403E-8224-7C725FD4CB42}.Release|Win32.ActiveCfg = Release|Win32 - {642BC75D-ABAF-403E-8224-7C725FD4CB42}.Release|Win32.Build.0 = Release|Win32 - {642BC75D-ABAF-403E-8224-7C725FD4CB42}.Release|x64.ActiveCfg = Release|x64 - {642BC75D-ABAF-403E-8224-7C725FD4CB42}.Release|x64.Build.0 = Release|x64 - {93F10526-209E-41D7-BBEA-775787876895}.Debug|Win32.ActiveCfg = Debug|Win32 - {93F10526-209E-41D7-BBEA-775787876895}.Debug|Win32.Build.0 = Debug|Win32 - {93F10526-209E-41D7-BBEA-775787876895}.Debug|x64.ActiveCfg = Debug|x64 - {93F10526-209E-41D7-BBEA-775787876895}.Debug|x64.Build.0 = Debug|x64 - {93F10526-209E-41D7-BBEA-775787876895}.Release|Win32.ActiveCfg = Release|Win32 - {93F10526-209E-41D7-BBEA-775787876895}.Release|Win32.Build.0 = Release|Win32 - {93F10526-209E-41D7-BBEA-775787876895}.Release|x64.ActiveCfg = Release|x64 - {93F10526-209E-41D7-BBEA-775787876895}.Release|x64.Build.0 = Release|x64 - {63F9B82B-F589-4082-ABE5-D4F0682050AB}.Debug|Win32.ActiveCfg = Debug|Win32 - {63F9B82B-F589-4082-ABE5-D4F0682050AB}.Debug|Win32.Build.0 = Debug|Win32 - {63F9B82B-F589-4082-ABE5-D4F0682050AB}.Debug|x64.ActiveCfg = Debug|x64 - {63F9B82B-F589-4082-ABE5-D4F0682050AB}.Debug|x64.Build.0 = Debug|x64 - {63F9B82B-F589-4082-ABE5-D4F0682050AB}.Release|Win32.ActiveCfg = Release|Win32 - {63F9B82B-F589-4082-ABE5-D4F0682050AB}.Release|Win32.Build.0 = Release|Win32 - {63F9B82B-F589-4082-ABE5-D4F0682050AB}.Release|x64.ActiveCfg = Release|x64 - {63F9B82B-F589-4082-ABE5-D4F0682050AB}.Release|x64.Build.0 = Release|x64 - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}.Debug|Win32.ActiveCfg = Debug|Win32 - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}.Debug|Win32.Build.0 = Debug|Win32 - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}.Debug|x64.ActiveCfg = Debug|x64 - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}.Debug|x64.Build.0 = Debug|x64 - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}.Release|Win32.ActiveCfg = Release|Win32 - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}.Release|Win32.Build.0 = Release|Win32 - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}.Release|x64.ActiveCfg = Release|x64 - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}.Release|x64.Build.0 = Release|x64 - {6813477F-64B6-4B97-B230-438D0D233385}.Debug|Win32.ActiveCfg = Debug|Win32 - {6813477F-64B6-4B97-B230-438D0D233385}.Debug|Win32.Build.0 = Debug|Win32 - {6813477F-64B6-4B97-B230-438D0D233385}.Debug|x64.ActiveCfg = Debug|x64 - {6813477F-64B6-4B97-B230-438D0D233385}.Debug|x64.Build.0 = Debug|x64 - {6813477F-64B6-4B97-B230-438D0D233385}.Release|Win32.ActiveCfg = Release|Win32 - {6813477F-64B6-4B97-B230-438D0D233385}.Release|Win32.Build.0 = Release|Win32 - {6813477F-64B6-4B97-B230-438D0D233385}.Release|x64.ActiveCfg = Release|x64 - {6813477F-64B6-4B97-B230-438D0D233385}.Release|x64.Build.0 = Release|x64 - {BE04E242-A1E9-4593-B95B-057F37330B76}.Debug|Win32.ActiveCfg = Debug|Win32 - {BE04E242-A1E9-4593-B95B-057F37330B76}.Debug|Win32.Build.0 = Debug|Win32 - {BE04E242-A1E9-4593-B95B-057F37330B76}.Debug|x64.ActiveCfg = Debug|x64 - {BE04E242-A1E9-4593-B95B-057F37330B76}.Debug|x64.Build.0 = Debug|x64 - {BE04E242-A1E9-4593-B95B-057F37330B76}.Release|Win32.ActiveCfg = Release|Win32 - {BE04E242-A1E9-4593-B95B-057F37330B76}.Release|Win32.Build.0 = Release|Win32 - {BE04E242-A1E9-4593-B95B-057F37330B76}.Release|x64.ActiveCfg = Release|x64 - {BE04E242-A1E9-4593-B95B-057F37330B76}.Release|x64.Build.0 = Release|x64 - {2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}.Debug|Win32.ActiveCfg = Debug|Win32 - {2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}.Debug|Win32.Build.0 = Debug|Win32 - {2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}.Debug|x64.ActiveCfg = Debug|x64 - {2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}.Debug|x64.Build.0 = Debug|x64 - {2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}.Release|Win32.ActiveCfg = Release|Win32 - {2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}.Release|Win32.Build.0 = Release|Win32 - {2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}.Release|x64.ActiveCfg = Release|x64 - {2E1F4BB3-3BD7-43AD-8E64-D3B8A2F5D7B2}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/win/win32/vs2015/NetHack.vcxproj b/win/win32/vs2015/NetHack.vcxproj deleted file mode 100755 index 8d9335f95..000000000 --- a/win/win32/vs2015/NetHack.vcxproj +++ /dev/null @@ -1,232 +0,0 @@ - - - - - {609BC774-C6F8-4B2B-AA7D-5B3D0EA95751} - Win32Proj - NetHack - - - - - - - - - - $(BinDir) - - - - /Gs /Oi- %(AdditionalOptions) - Disabled - Default - Speed - true - $(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);%(AdditionalIncludeDirectories) - TILES;WIN32CON;DLB;MSWIN_GRAPHICS;_LIB;%(PreprocessorDefinitions) - - - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;winmm.lib;Winmm.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GUISTUB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/win/win32/vs2015/NetHackW.vcxproj b/win/win32/vs2015/NetHackW.vcxproj deleted file mode 100755 index bd33da76f..000000000 --- a/win/win32/vs2015/NetHackW.vcxproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - {CEC5D360-8804-454F-8591-002184C23499} - NetHackW - - - - - - - - - - - $(BinDir) - - - - - /Gs /Oi- %(AdditionalOptions) - Disabled - true - $(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);%(AdditionalIncludeDirectories) - TILES;_WINDOWS;DLB;MSWIN_GRAPHICS;WIN32CONNDEBUG;%(PreprocessorDefinitions) - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - - Windows - comctl32.lib;winmm.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TTYSTUB; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/win/win32/vs2015/afterdgncomp.proj b/win/win32/vs2015/afterdgncomp.proj deleted file mode 100644 index 7aebee743..000000000 --- a/win/win32/vs2015/afterdgncomp.proj +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/afterdlb.proj b/win/win32/vs2015/afterdlb.proj deleted file mode 100644 index ed68ba33e..000000000 --- a/win/win32/vs2015/afterdlb.proj +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/win/win32/vs2015/afterlevcomp.proj b/win/win32/vs2015/afterlevcomp.proj deleted file mode 100644 index 924f66cd5..000000000 --- a/win/win32/vs2015/afterlevcomp.proj +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/win/win32/vs2015/aftermakedefs.proj b/win/win32/vs2015/aftermakedefs.proj deleted file mode 100644 index a48e685a7..000000000 --- a/win/win32/vs2015/aftermakedefs.proj +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/win/win32/vs2015/afternethack.proj b/win/win32/vs2015/afternethack.proj deleted file mode 100644 index 3b769323e..000000000 --- a/win/win32/vs2015/afternethack.proj +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/win/win32/vs2015/afterrecover.proj b/win/win32/vs2015/afterrecover.proj deleted file mode 100644 index 0652e7828..000000000 --- a/win/win32/vs2015/afterrecover.proj +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/win/win32/vs2015/aftertile2bmp.proj b/win/win32/vs2015/aftertile2bmp.proj deleted file mode 100644 index 28d2b2e39..000000000 --- a/win/win32/vs2015/aftertile2bmp.proj +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/win/win32/vs2015/aftertilemap.proj b/win/win32/vs2015/aftertilemap.proj deleted file mode 100644 index bfdb48fe9..000000000 --- a/win/win32/vs2015/aftertilemap.proj +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/win/win32/vs2015/afteruudecode.proj b/win/win32/vs2015/afteruudecode.proj deleted file mode 100644 index b33e3c4f4..000000000 --- a/win/win32/vs2015/afteruudecode.proj +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/win/win32/vs2015/build.bat b/win/win32/vs2015/build.bat deleted file mode 100644 index 78b7356ad..000000000 --- a/win/win32/vs2015/build.bat +++ /dev/null @@ -1,44 +0,0 @@ -@echo off - -if "%VisualStudioVersion%"=="" ( - echo MSBuild environment not set ... attempting to setup build environment. - call :setup_environment -) - -if "%VisualStudioVersion%"=="" ( - echo Unable to setup build environment. Exiting. - goto :EOF -) - -msbuild NetHack.sln /t:Clean;Build /p:Configuration=Debug;Platform=Win32 -msbuild NetHack.sln /t:Clean;Build /p:Configuration=Debug;Platform=x64 -msbuild NetHack.sln /t:Clean;Build /p:Configuration=Release;Platform=Win32 -msbuild NetHack.sln /t:Clean;Build /p:Configuration=Release;Platform=x64 - -goto :EOF - -:setup_environment - - -if "%VS140COMNTOOLS%"=="" ( - call :set_vs14comntools -) - -if "%VS140COMNTOOLS%"=="" ( - echo Can not find Visual Studio 2015 Common Tools path. - echo Set VS140COMNTOOLS appropriately. - goto :EOF -) - -call "%VS140COMNTOOLS%VsMSBuildCmd.bat" -cd %~dp0 - -goto :EOF - -:set_vs14comntools - -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\Tools" ( - set "VS140COMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\Tools\" -) - -goto :EOF diff --git a/win/win32/vs2015/common.props b/win/win32/vs2015/common.props deleted file mode 100644 index 5889dbb7d..000000000 --- a/win/win32/vs2015/common.props +++ /dev/null @@ -1,41 +0,0 @@ - - - - true - - - false - - - - Level3 - WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - - Console - $(SymbolsDir)$(TargetName).pdb - - - - - Disabled - _DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - true - - - - - MaxSpeed - OnlyExplicitInline - NDEBUG;%(PreprocessorDefinitions) - MultiThreaded - - - UseLinkTimeCodeGeneration - - - \ No newline at end of file diff --git a/win/win32/vs2015/config.props b/win/win32/vs2015/config.props deleted file mode 100644 index 84ef04da2..000000000 --- a/win/win32/vs2015/config.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - \ No newline at end of file diff --git a/win/win32/vs2015/console.props b/win/win32/vs2015/console.props deleted file mode 100644 index 8fdca9d9e..000000000 --- a/win/win32/vs2015/console.props +++ /dev/null @@ -1,11 +0,0 @@ - - - - - _CONSOLE;%(PreprocessorDefinitions) - - - Console - - - \ No newline at end of file diff --git a/win/win32/vs2015/default.props b/win/win32/vs2015/default.props deleted file mode 100644 index 82619060c..000000000 --- a/win/win32/vs2015/default.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - Application - false - MultiByte - v140 - $(BinDir) - - - true - - - false - true - - - \ No newline at end of file diff --git a/win/win32/vs2015/default_dll.props b/win/win32/vs2015/default_dll.props deleted file mode 100644 index 94a07f465..000000000 --- a/win/win32/vs2015/default_dll.props +++ /dev/null @@ -1,17 +0,0 @@ - - - - DynamicLibrary - false - MultiByte - v140 - - - true - - - false - true - - - \ No newline at end of file diff --git a/win/win32/vs2015/dgncomp.vcxproj b/win/win32/vs2015/dgncomp.vcxproj deleted file mode 100755 index a44735de3..000000000 --- a/win/win32/vs2015/dgncomp.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} - - - - - - - - - - - - - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Lex; - Yacc; - $(BuildDependsOn); - - - - - - - NoLex; - NoYacc; - $(BuildDependsOn); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/dirs.props b/win/win32/vs2015/dirs.props deleted file mode 100644 index 8cdcf60c2..000000000 --- a/win/win32/vs2015/dirs.props +++ /dev/null @@ -1,24 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\..\..\ - $(RootDir)bin\$(Configuration)\$(Platform)\ - $(ProjectDir)obj\$(Configuration)\$(Platform)\$(TargetName)\ - $(ProjectDir)symbols\$(Configuration)\$(Platform)\$(TargetName)\ - $(RootDir)tools\$(Configuration)\$(Platform)\ - $(RootDir)util\ - $(RootDir)dat\ - $(RootDir)doc\ - $(RootDir)include\ - $(RootDir)src\ - $(RootDir)sys\ - $(RootDir)util\ - $(RootDir)sys\share\ - $(RootDir)sys\winnt\ - $(RootDir)win\share\ - $(RootDir)win\tty\ - $(RootDir)win\win32\ - $(ToolsDir) - $(ObjDir) - - \ No newline at end of file diff --git a/win/win32/vs2015/dlb.vcxproj b/win/win32/vs2015/dlb.vcxproj deleted file mode 100644 index 06424d447..000000000 --- a/win/win32/vs2015/dlb.vcxproj +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} - - - - - - - - - - - - - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/dll.props b/win/win32/vs2015/dll.props deleted file mode 100644 index 3b37e2ede..000000000 --- a/win/win32/vs2015/dll.props +++ /dev/null @@ -1,11 +0,0 @@ - - - - - WIN32CON;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - - - Windows - - - \ No newline at end of file diff --git a/win/win32/vs2015/files.props b/win/win32/vs2015/files.props deleted file mode 100644 index 483ec1eb1..000000000 --- a/win/win32/vs2015/files.props +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/win/win32/vs2015/levcomp.vcxproj b/win/win32/vs2015/levcomp.vcxproj deleted file mode 100755 index 1d01ffa87..000000000 --- a/win/win32/vs2015/levcomp.vcxproj +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} - - - - - - - - - - - - - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;YY_NO_UNISTD_H;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - Lex; - Yacc; - $(BuildDependsOn); - - - - - - - NoLex; - NoYacc; - $(BuildDependsOn); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/makedefs.vcxproj b/win/win32/vs2015/makedefs.vcxproj deleted file mode 100755 index cedd41204..000000000 --- a/win/win32/vs2015/makedefs.vcxproj +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - - - - - - - - - - - - - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/nh340key.def b/win/win32/vs2015/nh340key.def deleted file mode 100644 index f484a536f..000000000 --- a/win/win32/vs2015/nh340key.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY nh340key -EXPORTS -ProcessKeystroke -NHkbhit -CheckInput -SourceWhere -SourceAuthor -KeyHandlerName diff --git a/win/win32/vs2015/nh340key.vcxproj b/win/win32/vs2015/nh340key.vcxproj deleted file mode 100644 index 8b2068662..000000000 --- a/win/win32/vs2015/nh340key.vcxproj +++ /dev/null @@ -1,42 +0,0 @@ - - - - - {be04e242-a1e9-4593-b95b-057f37330b76} - Win32Proj - nh340key - - - - - - - - - - $(BinDir) - - - - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) - - - $(ToolsDir)$(TargetName).lib - - - - - nh340key.def - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/nhdefkey.def b/win/win32/vs2015/nhdefkey.def deleted file mode 100644 index 2950904e4..000000000 --- a/win/win32/vs2015/nhdefkey.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY nhdefkey -EXPORTS -ProcessKeystroke -NHkbhit -CheckInput -SourceWhere -SourceAuthor -KeyHandlerName diff --git a/win/win32/vs2015/nhdefkey.vcxproj b/win/win32/vs2015/nhdefkey.vcxproj deleted file mode 100755 index 84fdf2fd3..000000000 --- a/win/win32/vs2015/nhdefkey.vcxproj +++ /dev/null @@ -1,42 +0,0 @@ - - - - - {6813477F-64B6-4B97-B230-438D0D233385} - Win32Proj - nhdefkey - - - - - - - - - - $(BinDir) - - - - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) - - - $(ToolsDir)$(TargetName).lib - - - - - nhdefkey.def - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/nhraykey.def b/win/win32/vs2015/nhraykey.def deleted file mode 100644 index 5432a1af3..000000000 --- a/win/win32/vs2015/nhraykey.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY nhraykey -EXPORTS -ProcessKeystroke -NHkbhit -CheckInput -SourceWhere -SourceAuthor -KeyHandlerName diff --git a/win/win32/vs2015/nhraykey.vcxproj b/win/win32/vs2015/nhraykey.vcxproj deleted file mode 100644 index 0017f4a49..000000000 --- a/win/win32/vs2015/nhraykey.vcxproj +++ /dev/null @@ -1,42 +0,0 @@ - - - - - {2e1f4bb3-3bd7-43ad-8e64-d3b8a2f5d7b2} - Win32Proj - nhraykey - - - - - - - - - - $(BinDir) - - - - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) - - - $(ToolsDir)$(TargetName).lib - - - - - nhraykey.def - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/notes.txt b/win/win32/vs2015/notes.txt deleted file mode 100644 index 5a7d93371..000000000 --- a/win/win32/vs2015/notes.txt +++ /dev/null @@ -1,45 +0,0 @@ -Changes made to vs2015 build - -To Do - -Questions - -1. Why is /Gs used? This initiates stack probes for every function call (not just functions that use more then 4k)? -2. Why is /Oi- used? This turns off compiler intrinsics. -3. Why is /FS used? This forces serialization of writes to PDB. This really isn't needed. -4. Why are we disabling optimizations for release builds? -5. Why are we omitting frame pointers? Makes debugging harder. Crash dumps less usefull. -6. Why are we forcing function level linking? -7. Why are we turning off intrinsics (again)? -8. Why are we enabling additional security checks? (SDLCheck) -9. Why are we using string pooling? -10. Why do we turn off multi-processor compilation? - -Nethack Compiler Settings - Release -/Gs -/Oi- -/FS -Optimizations:Disabled -WarningLevel:Level3 -InlineFunctionExpansion:Default -FavorSizeOrSpeed:Speed -OmitFramePointers:true -Optimization:MaxSpeed -FunctionLevelLinking:true -IntrinsicFunctions:false -PreprocessorDefinitions:TILES;MSWIN_GRAPHICS;WIN32;WIN32CON;DLB;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;_CONSOLE;_LIB; -SDLCheck:true -AdditionalIncludeDirectories:..\win\win32;..\include;..\sys\winnt;..\sys\share;..\win\share; -StringPooling:true -RuntimeLibrary:MultiThreaded -SuppressStartupBanner:true -MultiProcessorCompilation:false - -Nethack Link Settings - Release -SubSystem:Console -GenetateDebugInformation:true -EnableCOMDATFolding:true -OptimizeReferenes:true -AdditionalDependencies:kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;winmm.lib;Winmm.lib; -SuppressStartupBanner:true -TargetMachine:MachineX86 diff --git a/win/win32/vs2015/recover.vcxproj b/win/win32/vs2015/recover.vcxproj deleted file mode 100755 index 7abba076f..000000000 --- a/win/win32/vs2015/recover.vcxproj +++ /dev/null @@ -1,45 +0,0 @@ - - - - - {2F35F228-6733-4FE5-9B46-B3AA10D4BC2E} - - - - - - - - - - $(BinDir) - - - - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/tile2bmp.vcxproj b/win/win32/vs2015/tile2bmp.vcxproj deleted file mode 100755 index 9b72b98f1..000000000 --- a/win/win32/vs2015/tile2bmp.vcxproj +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - {642BC75D-ABAF-403E-8224-7C725FD4CB42} - - - - - - - - - - - - - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) - - - - - - - - - - - - TILETEXT;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/tilemap.vcxproj b/win/win32/vs2015/tilemap.vcxproj deleted file mode 100755 index a970b2aa6..000000000 --- a/win/win32/vs2015/tilemap.vcxproj +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - {93F10526-209E-41D7-BBEA-775787876895} - - - - - - - - - - - - - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2015/tiles.vcxproj b/win/win32/vs2015/tiles.vcxproj deleted file mode 100755 index f617646f0..000000000 --- a/win/win32/vs2015/tiles.vcxproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {55946465-FC65-47B3-BB48-742C7694C0D6} - MakeFileProj - - - - Makefile - false - v120 - - - Makefile - false - v120 - - - Makefile - false - v120 - - - Makefile - false - v120 - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\..\util\ - .\..\util\ - .\Debug\ - .\Debug\ - nmake /f "tiles.mak" - nmake /f "tiles.mak" - nmake /f "tiles.mak" /a - nmake /f "tiles.mak" /a - - - ..\win\win32\tiles.bmp - ..\win\win32\tiles.bmp - $(NMakePreprocessorDefinitions) - $(NMakePreprocessorDefinitions) - $(NMakeIncludeSearchPath) - $(NMakeIncludeSearchPath) - $(NMakeForcedIncludes) - $(NMakeForcedIncludes) - $(NMakeAssemblySearchPath) - $(NMakeAssemblySearchPath) - $(NMakeForcedUsingAssemblies) - $(NMakeForcedUsingAssemblies) - .\..\util\ - .\..\util\ - .\Release\ - .\Release\ - nmake /f "tiles.mak" - nmake /f "tiles.mak" - nmake /f "tiles.mak" /a - nmake /f "tiles.mak" /a - - - ..\win\win32\tiles.bmp - ..\win\win32\tiles.bmp - $(NMakePreprocessorDefinitions) - $(NMakePreprocessorDefinitions) - $(NMakeIncludeSearchPath) - $(NMakeIncludeSearchPath) - $(NMakeForcedIncludes) - $(NMakeForcedIncludes) - $(NMakeAssemblySearchPath) - $(NMakeAssemblySearchPath) - $(NMakeForcedUsingAssemblies) - $(NMakeForcedUsingAssemblies) - - - - - - {642bc75d-abaf-403e-8224-7c725fd4cb42} - false - - - - - - diff --git a/win/win32/vs2015/uudecode.vcxproj b/win/win32/vs2015/uudecode.vcxproj deleted file mode 100755 index d37115eed..000000000 --- a/win/win32/vs2015/uudecode.vcxproj +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - {63F9B82B-F589-4082-ABE5-D4F0682050AB} - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 1295e7ee28df49ad378c5c27c56da45600e52580 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 12 Nov 2018 11:02:40 -0800 Subject: [PATCH 08/12] conflicting countdowns again Use the make_foo() intrinsic set/reset routines instead of trying to manipulate the intrinsics directly. Previous patch left Dex down by 1 if stoning caused wounded legs to be fixed, and left delayed killer allocated if stoning cured sliming or vice versa. --- include/extern.h | 2 +- src/do.c | 13 +++++++++---- src/eat.c | 2 +- src/potion.c | 22 ++++++++++++++-------- src/pray.c | 2 +- src/sit.c | 2 +- src/steed.c | 10 +++------- src/timeout.c | 20 ++++++++++---------- 8 files changed, 40 insertions(+), 33 deletions(-) diff --git a/include/extern.h b/include/extern.h index 69ac1eec2..8fd85e91e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -390,7 +390,7 @@ E void FDECL(revive_mon, (ANY_P *, long)); E int NDECL(donull); E int NDECL(dowipe); E void FDECL(set_wounded_legs, (long, int)); -E void NDECL(heal_legs); +E void FDECL(heal_legs, (int)); /* ### do_name.c ### */ diff --git a/src/do.c b/src/do.c index bcae4ca43..00f0b8edd 100644 --- a/src/do.c +++ b/src/do.c @@ -1882,7 +1882,8 @@ register int timex; } void -heal_legs() +heal_legs(how) +int how; /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */ { if (Wounded_legs) { if (ATEMP(A_DEX) < 0) { @@ -1890,7 +1891,11 @@ heal_legs() context.botl = 1; } - if (!u.usteed) { + /* when mounted, wounded legs applies to the steed; + during petrification countdown, "your limbs turn to stone" + before the final stages and that calls us (how==2) to cure + wounded legs, but we want to suppress the feel better message */ + if (!u.usteed && how != 2) { const char *legs = body_part(LEG); if ((EWounded_legs & BOTH_SIDES) == BOTH_SIDES) @@ -1900,7 +1905,7 @@ heal_legs() Your("%s %s better.", legs, vtense(legs, "feel")); } - HWounded_legs = EWounded_legs = 0; + HWounded_legs = EWounded_legs = 0L; /* Wounded_legs reduces carrying capacity, so we want an encumbrance check when they're healed. However, @@ -1912,7 +1917,7 @@ heal_legs() it might be immediately contradicted [able to carry more when steed becomes healthy, then possible floor feedback, then able to carry less when back on foot]. */ - if (!in_steed_dismounting) + if (how == 0) (void) encumber_msg(); } } diff --git a/src/eat.c b/src/eat.c index cff0a12fd..0d5e83ab2 100644 --- a/src/eat.c +++ b/src/eat.c @@ -2217,7 +2217,7 @@ struct obj *otmp; } } if (!otmp->cursed) - heal_legs(); + heal_legs(0); break; case EGG: if (flesh_petrifies(&mons[otmp->corpsenm])) { diff --git a/src/potion.c b/src/potion.c index 281a2e4a3..9ee433061 100644 --- a/src/potion.c +++ b/src/potion.c @@ -106,6 +106,9 @@ boolean talk; set_itimeout(&HStun, xtime); } +/* Sick is overloaded with both fatal illness and food poisoning (via + u.usick_type bit mask), but delayed killer can only support one or + the other at a time. They should become separate intrinsics.... */ void make_sick(xtime, cause, talk, type) long xtime; @@ -116,7 +119,7 @@ int type; struct kinfo *kptr; long old = Sick; -#if 0 +#if 0 /* tell player even if hero is unconscious */ if (Unaware) talk = FALSE; #endif @@ -152,7 +155,10 @@ int type; kptr = find_delayed_killer(SICK); if (Sick) { exercise(A_CON, FALSE); - if (!old || !kptr) { + /* setting delayed_killer used to be unconditional, but that's + not right when make_sick(0) is called to cure food poisoning + if hero was also fatally ill; this is only approximate */ + if (xtime || !old || !kptr) { int kpfx = ((cause && !strcmp(cause, "#wizintrinsic")) ? KILLED_BY : KILLED_BY_AN); @@ -169,7 +175,7 @@ const char *msg; { long old = Slimed; -#if 0 +#if 0 /* tell player even if hero is unconscious */ if (Unaware) msg = 0; #endif @@ -177,7 +183,7 @@ const char *msg; if ((xtime != 0L) ^ (old != 0L)) { context.botl = TRUE; if (msg) - pline1(msg); + pline("%s", msg); } if (!Slimed) dealloc_killer(find_delayed_killer(SLIMED)); @@ -193,7 +199,7 @@ const char *killername; { long old = Stoned; -#if 0 +#if 0 /* tell player even if hero is unconscious */ if (Unaware) msg = 0; #endif @@ -201,7 +207,7 @@ const char *killername; if ((xtime != 0L) ^ (old != 0L)) { context.botl = TRUE; if (msg) - pline1(msg); + pline("%s", msg); } if (!Stoned) dealloc_killer(find_delayed_killer(STONED)); @@ -899,9 +905,9 @@ register struct obj *otmp; } break; case POT_SPEED: + /* skip when mounted; heal_legs() would heal steeds legs */ if (Wounded_legs && !otmp->cursed && !u.usteed) { - /* heal_legs() would heal steeds legs */ - heal_legs(); + heal_legs(0); unkn++; break; } diff --git a/src/pray.c b/src/pray.c index 5569c33f0..e1f55cb49 100644 --- a/src/pray.c +++ b/src/pray.c @@ -524,7 +524,7 @@ int trouble; break; } case TROUBLE_WOUNDED_LEGS: - heal_legs(); + heal_legs(0); break; case TROUBLE_STUNNED: make_stunned(0L, TRUE); diff --git a/src/sit.c b/src/sit.c index 0f8bedbb4..1aa8085bf 100644 --- a/src/sit.c +++ b/src/sit.c @@ -188,7 +188,7 @@ dosit() u.ucreamed = 0; make_blinded(0L, TRUE); make_sick(0L, (char *) 0, FALSE, SICK_ALL); - heal_legs(); + heal_legs(0); context.botl = 1; break; case 5: diff --git a/src/steed.c b/src/steed.c index 8cbf9d0ef..6b940c26e 100644 --- a/src/steed.c +++ b/src/steed.c @@ -221,7 +221,7 @@ boolean force; /* Quietly force this animal */ if (Wounded_legs) { Your("%s are in no shape for riding.", makeplural(body_part(LEG))); if (force && wizard && yn("Heal your legs?") == 'y') - HWounded_legs = EWounded_legs = 0; + HWounded_legs = EWounded_legs = 0L; else return (FALSE); } @@ -542,12 +542,8 @@ int reason; /* Player was thrown off etc. */ } /* While riding, Wounded_legs refers to the steed's legs; after dismounting, it reverts to the hero's legs. */ - if (repair_leg_damage) { - /* [TODO: make heal_legs() take a parameter to handle this] */ - in_steed_dismounting = TRUE; - heal_legs(); - in_steed_dismounting = FALSE; - } + if (repair_leg_damage) + heal_legs(1); /* Release the steed and saddle */ u.usteed = 0; diff --git a/src/timeout.c b/src/timeout.c index 1360f1132..110aa03ad 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -137,17 +137,17 @@ stoned_dialogue() multi_reason = "getting stoned"; nomovemsg = You_can_move_again; /* not unconscious */ /* "your limbs have turned to stone" so terminate wounded legs */ - if ((HWounded_legs & TIMEOUT) != 0L && !u.usteed) - set_itimeout(&HWounded_legs, 0L); + if (Wounded_legs && !u.usteed) + heal_legs(2); break; case 2: /* turned to stone */ if ((HDeaf & TIMEOUT) > 0L && (HDeaf & TIMEOUT) < 5L) set_itimeout(&HDeaf, 5L); /* avoid Hear_again at tail end */ - /* if also vomiting or turning into slime, stop those */ - if ((Vomiting & TIMEOUT) != 0L) - set_itimeout(&Vomiting, 0L), context.botl = 1; - if ((Slimed & TIMEOUT) != 0L) - set_itimeout(&Slimed, 0L), context.botl = 1; + /* if also vomiting or turning into slime, stop those (no messages) */ + if (Vomiting) + make_vomiting(0L, FALSE); + if (Slimed) + make_slimed(0L, (char *) 0); break; default: break; @@ -342,8 +342,8 @@ slime_dialogue() break; case 1L: /* turning into slime */ /* if also turning to stone, stop doing that (no message) */ - if ((Stoned & TIMEOUT) != 0L) - set_itimeout(&Stoned, 0L), context.botl = 1; + if (Stoned) + make_stoned(0L, (char *) 0, KILLED_BY_AN, (char *) 0); break; } exercise(A_DEX, FALSE); @@ -553,7 +553,7 @@ nh_timeout() stop_occupation(); break; case WOUNDED_LEGS: - heal_legs(); + heal_legs(0); stop_occupation(); break; case HALLUC: From 5c2ff62089c4494384c3d8ef3ff6e4db55b9ce6a Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 12 Nov 2018 11:08:59 -0800 Subject: [PATCH 09/12] comment tidbit --- src/potion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/potion.c b/src/potion.c index 9ee433061..537cb064b 100644 --- a/src/potion.c +++ b/src/potion.c @@ -905,7 +905,7 @@ register struct obj *otmp; } break; case POT_SPEED: - /* skip when mounted; heal_legs() would heal steeds legs */ + /* skip when mounted; heal_legs() would heal steed's legs */ if (Wounded_legs && !otmp->cursed && !u.usteed) { heal_legs(0); unkn++; From 3bb759a9ab8e5c8195bf1d0523f71a80217b344a Mon Sep 17 00:00:00 2001 From: Bart House Date: Mon, 12 Nov 2018 17:45:22 -0800 Subject: [PATCH 10/12] Started work to support per monitor DPI. Using DPI to scale tiles appropriately. Renamed ntassert to nhassert. (Naming mistake caused by using ntassert at work). Re-ordered a few more includes to get window headers included before nethack headers. --- include/ntconf.h | 8 +- sys/winnt/nttty.c | 44 +++--- sys/winnt/win10.c | 12 +- sys/winnt/win10.h | 13 +- sys/winnt/winnt.c | 4 +- win/win32/mhmap.c | 202 ++++++++++++++----------- win/win32/vs2017/.gitignore | 2 +- win/win32/vs2017/NetHackW.exe.manifest | 4 +- win/win32/winhack.c | 3 +- 9 files changed, 166 insertions(+), 126 deletions(-) diff --git a/include/ntconf.h b/include/ntconf.h index 36a87e2e4..c0e2f77c0 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -249,13 +249,13 @@ extern int FDECL(alternative_palette, (char *)); #endif #ifdef NDEBUG -#define ntassert(expression) ((void)0) +#define nhassert(expression) ((void)0) #else -extern void FDECL(ntassert_failed, (const char * exp, const char * file, +extern void FDECL(nhassert_failed, (const char * exp, const char * file, int line)); -#define ntassert(expression) (void)((!!(expression)) || \ - (ntassert_failed(#expression, __FILE__, __LINE__), 0)) +#define nhassert(expression) (void)((!!(expression)) || \ + (nhassert_failed(#expression, __FILE__, __LINE__), 0)) #endif #define nethack_enter(argc, argv) nethack_enter_winnt() diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index 63ef24020..31b618acc 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -242,8 +242,8 @@ static void back_buffer_flip() void buffer_fill_to_end(cell_t * buffer, cell_t * fill, int x, int y) { - ntassert(x >= 0 && x < console.width); - ntassert(y >= 0 && ((y < console.height) || (y == console.height && + nhassert(x >= 0 && x < console.width); + nhassert(y >= 0 && ((y < console.height) || (y == console.height && x == 0))); cell_t * dst = buffer + console.width * y + x; @@ -257,8 +257,8 @@ void buffer_fill_to_end(cell_t * buffer, cell_t * fill, int x, int y) static void buffer_clear_to_end_of_line(cell_t * buffer, int x, int y) { - ntassert(x >= 0 && x < console.width); - ntassert(y >= 0 && ((y < console.height) || (y == console.height && + nhassert(x >= 0 && x < console.width); + nhassert(y >= 0 && ((y < console.height) || (y == console.height && x == 0))); cell_t * dst = buffer + console.width * y + x; cell_t *sentinel = buffer + console.width * (y + 1); @@ -272,8 +272,8 @@ static void buffer_clear_to_end_of_line(cell_t * buffer, int x, int y) void buffer_write(cell_t * buffer, cell_t * cell, COORD pos) { - ntassert(pos.X >= 0 && pos.X < console.width); - ntassert(pos.Y >= 0 && pos.Y < console.height); + nhassert(pos.X >= 0 && pos.X < console.width); + nhassert(pos.Y >= 0 && pos.Y < console.height); cell_t * dst = buffer + (console.width * pos.Y) + pos.X; *dst = *cell; @@ -465,8 +465,8 @@ int *x, *y, *mod; static void set_console_cursor(int x, int y) { - ntassert(x >= 0 && x < console.width); - ntassert(y >= 0 && y < console.height); + nhassert(x >= 0 && x < console.width); + nhassert(y >= 0 && y < console.height); console.cursor.X = max(0, min(console.width - 1, x)); console.cursor.Y = max(0, min(console.height - 1, y)); @@ -547,8 +547,8 @@ void xputc_core(ch) char ch; { - ntassert(console.cursor.X >= 0 && console.cursor.X < console.width); - ntassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); + nhassert(console.cursor.X >= 0 && console.cursor.X < console.width); + nhassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); boolean inverse = FALSE; cell_t cell; @@ -596,8 +596,8 @@ char ch; } } - ntassert(console.cursor.X >= 0 && console.cursor.X < console.width); - ntassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); + nhassert(console.cursor.X >= 0 && console.cursor.X < console.width); + nhassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); } /* @@ -982,7 +982,7 @@ register char *op; void unload_keyboard_handler() { - ntassert(keyboard_handler.hLibrary != NULL); + nhassert(keyboard_handler.hLibrary != NULL); FreeLibrary(keyboard_handler.hLibrary); memset(&keyboard_handler, 0, sizeof(keyboard_handler_t)); @@ -1619,10 +1619,10 @@ set_known_good_console_font() L"Consolas"); success = SetConsoleOutputCP(437); - ntassert(success); + nhassert(success); success = SetCurrentConsoleFontEx(console.hConOut, FALSE, &console_font_info); - ntassert(success); + nhassert(success); } /* restore_original_console_font will restore the console font and code page @@ -1665,7 +1665,7 @@ void set_cp_map() char c = (char)i; int count = MultiByteToWideChar(codePage, 0, &c, 1, &console.cpMap[i], 1); - ntassert(count == 1); + nhassert(count == 1); } } @@ -1685,8 +1685,8 @@ void early_raw_print(const char *s) if (console.hConOut == NULL) return; - ntassert(console.cursor.X >= 0 && console.cursor.X < console.width); - ntassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); + nhassert(console.cursor.X >= 0 && console.cursor.X < console.width); + nhassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); WORD attribute = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE; DWORD unused; @@ -1725,8 +1725,8 @@ void early_raw_print(const char *s) s++; } - ntassert(console.cursor.X >= 0 && console.cursor.X < console.width); - ntassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); + nhassert(console.cursor.X >= 0 && console.cursor.X < console.width); + nhassert(console.cursor.Y >= 0 && console.cursor.Y < console.height); SetConsoleCursorPosition(console.hConOut, console.cursor); @@ -1762,7 +1762,7 @@ void nethack_enter_nttty() windowprocs.win_raw_print = early_raw_print; console.hConOut = GetStdHandle(STD_OUTPUT_HANDLE); - ntassert(console.hConOut != NULL); // NOTE: this assert will not print + nhassert(console.hConOut != NULL); // NOTE: this assert will not print GetConsoleScreenBufferInfo(console.hConOut, &console.origcsbi); @@ -1803,7 +1803,7 @@ void nethack_enter_nttty() /* At this point early_raw_print will work */ console.hConIn = GetStdHandle(STD_INPUT_HANDLE); - ntassert(console.hConIn != NULL); + nhassert(console.hConIn != NULL); /* grow the size of the console buffer if it is not wide enough */ if (console.origcsbi.dwSize.X < console.width) { diff --git a/sys/winnt/win10.c b/sys/winnt/win10.c index 7eea016e9..bf2ed9d39 100644 --- a/sys/winnt/win10.c +++ b/sys/winnt/win10.c @@ -2,12 +2,12 @@ /* Copyright (C) 2018 by Bart House */ /* NetHack may be freely redistributed. See license for details. */ -#include -#include "winMS.h" -#include "hack.h" #include "win10.h" +#include #include +#include "hack.h" + Win10 gWin10 = { 0 }; void win10_init() @@ -27,6 +27,10 @@ void win10_init() if (gWin10.AreDpiAwarenessContextsEqual == NULL) panic("Unable to get address of AreDpiAwarenessContextsEqual"); + gWin10.GetDpiForWindow = (GetDpiForWindowProc) GetProcAddress(hUser32, "GetDpiForWindow"); + if (gWin10.GetDpiForWindow == NULL) + panic("Unable to get address of GetDpiForWindow"); + FreeLibrary(hUser32); gWin10.Valid = TRUE; @@ -35,7 +39,7 @@ void win10_init() if (gWin10.Valid) { if (!gWin10.AreDpiAwarenessContextsEqual( gWin10.GetThreadDpiAwarenessContext(), - DPI_AWARENESS_CONTEXT_UNAWARE)) + DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)) panic("Unexpected DpiAwareness state"); } diff --git a/sys/winnt/win10.h b/sys/winnt/win10.h index 22065df9f..02b943b56 100644 --- a/sys/winnt/win10.h +++ b/sys/winnt/win10.h @@ -2,16 +2,25 @@ /* Copyright (C) 2018 by Bart House */ /* NetHack may be freely redistributed. See license for details. */ -typedef DPI_AWARENESS_CONTEXT(WINAPI * GetThreadDpiAwarenessContextProc)(VOID); -typedef BOOL (WINAPI *AreDpiAwarenessContextsEqualProc)(DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB); +#ifndef WIN10_H +#define WIN10_H + +#include "win32api.h" + +typedef DPI_AWARENESS_CONTEXT(WINAPI *GetThreadDpiAwarenessContextProc)(VOID); +typedef BOOL(WINAPI *AreDpiAwarenessContextsEqualProc)( + DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB); +typedef UINT(WINAPI *GetDpiForWindowProc)(HWND hwnd); typedef struct { BOOL Valid; GetThreadDpiAwarenessContextProc GetThreadDpiAwarenessContext; AreDpiAwarenessContextsEqualProc AreDpiAwarenessContextsEqual; + GetDpiForWindowProc GetDpiForWindow; } Win10; extern Win10 gWin10; void win10_init(); +#endif // WIN10_H \ No newline at end of file diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 93f372d62..e3aaf640e 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -468,8 +468,8 @@ char *buf; } #endif /* RUNTIME_PORT_ID */ -/* ntassert_failed is called when an ntassert's condition is false */ -void ntassert_failed(const char * exp, const char * file, int line) +/* nhassert_failed is called when an nhassert's condition is false */ +void nhassert_failed(const char * exp, const char * file, int line) { char message[128]; _snprintf(message, sizeof(message), diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index de95d687d..e186ca13a 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -3,12 +3,14 @@ /* NetHack may be freely redistributed. See license for details. */ #include "winos.h" +#include "winMS.h" +#include "win10.h" + #include "mhmap.h" #include "mhfont.h" #include "mhinput.h" #include "mhmsg.h" #include "resource.h" -#include "winMS.h" #include "color.h" #include "patchlevel.h" @@ -34,12 +36,18 @@ typedef struct mswin_nethack_map_window { boolean bFitToScreenMode; /* switch Fit map to screen mode on/off */ int xPos, yPos; /* scroll position */ int xPageSize, yPageSize; /* scroll page size */ + int xMin, xMax, yMin, yMax; /* scroll range */ int xCur, yCur; /* position of the cursor */ - int xScrTile, yScrTile; /* size of display tile */ + int xScrTile, yScrTile; /* size of tile on screen in pixels */ POINT map_orig; /* map origin point */ - HFONT hMapFont; /* font for ASCII mode */ - boolean bUnicodeFont; /* font supports unicode page 437 */ + HFONT hMapFont; /* font for ASCII mode */ + boolean bUnicodeFont; /* font supports unicode page 437 */ + + int tileWidth; /* width of tile in pixels at 96 dpi */ + int tileHeight; /* height of tile in pixels at 96 dpi */ + double scale; /* scale factor */ + } NHMapWindow, *PNHMapWindow; static TCHAR szNHMapWindowClass[] = TEXT("MSNethackMapWndClass"); @@ -101,29 +109,57 @@ mswin_init_map_window() } void -mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw) +mswin_map_stretch(HWND hWnd, LPSIZE map_size, BOOL redraw) { - PNHMapWindow data; - RECT client_rt; - SCROLLINFO si; - SIZE wnd_size; - LOGFONT lgfnt; - /* check arguments */ - if (!IsWindow(hWnd) || !lpsz || lpsz->cx <= 0 || lpsz->cy <= 0) + if (!IsWindow(hWnd) || !map_size || map_size->cx <= 0 + || map_size->cy <= 0) return; + PNHMapWindow data = (PNHMapWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA); + /* calculate window size */ + RECT client_rt; GetClientRect(hWnd, &client_rt); + + SIZE wnd_size; wnd_size.cx = client_rt.right - client_rt.left; wnd_size.cy = client_rt.bottom - client_rt.top; + if (wnd_size.cx > 0 && wnd_size.cy > 0 && data->bFitToScreenMode) { + double windowAspectRatio = + (double) wnd_size.cx / (double) wnd_size.cy; + UINT mapWidth = COLNO * data->tileWidth; + UINT mapHeight = ROWNO * data->tileHeight; + + double mapAspectRatio = (double) mapWidth / (double) mapHeight; + + if (windowAspectRatio > mapAspectRatio) + data->scale = (double) wnd_size.cy / (double) mapHeight; + else + data->scale = (double) wnd_size.cx / (double) mapWidth; + + } else { + // Auto size window + + UINT windowDpi = 96; + + if (gWin10.Valid) { + windowDpi = gWin10.GetDpiForWindow(hWnd); + if (windowDpi == 0) + windowDpi = 96; + } + + windowDpi = max(96, windowDpi); + data->scale = (double) windowDpi / 96.0; + } + /* set new screen tile size */ - data = (PNHMapWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA); - data->xScrTile = - max(1, (data->bFitToScreenMode ? wnd_size.cx : lpsz->cx) / COLNO); - data->yScrTile = - max(1, (data->bFitToScreenMode ? wnd_size.cy : lpsz->cy) / ROWNO); + data->xScrTile = (int) (data->tileWidth * data->scale); + data->yScrTile = (int) (data->tileHeight * data->scale); + + data->xScrTile = max(1, data->xScrTile); + data->yScrTile = max(1, data->yScrTile); /* set map origin point */ data->map_orig.x = @@ -134,55 +170,48 @@ mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw) data->map_orig.x -= data->map_orig.x % data->xScrTile; data->map_orig.y -= data->map_orig.y % data->yScrTile; - /* adjust horizontal scroll bar */ - if (data->bFitToScreenMode) - data->xPageSize = COLNO + 1; /* disable scroll bar */ - else - data->xPageSize = wnd_size.cx / data->xScrTile; + // Set horizontal scroll - if (data->xPageSize >= COLNO) { - data->xPos = 0; - GetNHApp()->bNoHScroll = TRUE; - } else { - GetNHApp()->bNoHScroll = FALSE; - data->xPos = max( - 0, min(COLNO - data->xPageSize + 1, u.ux - data->xPageSize / 2)); - } + data->xPageSize = min(COLNO, wnd_size.cx / data->xScrTile); + + GetNHApp()->bNoHScroll = (data->xPageSize == COLNO); + + data->xMin = 0; + data->xMax = COLNO - data->xPageSize; + data->xPos = max(0, min(data->xMax, u.ux - (data->xPageSize / 2))); + + SCROLLINFO si; si.cbSize = sizeof(si); si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; - si.nMin = 0; - si.nMax = COLNO; - si.nPage = data->xPageSize; + si.nMin = data->xMin; + si.nMax = data->xMax; + si.nPage = 1; si.nPos = data->xPos; SetScrollInfo(hWnd, SB_HORZ, &si, TRUE); - /* adjust vertical scroll bar */ - if (data->bFitToScreenMode) - data->yPageSize = ROWNO + 1; /* disable scroll bar */ - else - data->yPageSize = wnd_size.cy / data->yScrTile; + data->yPageSize = min(ROWNO, wnd_size.cy / data->yScrTile); - if (data->yPageSize >= ROWNO) { - data->yPos = 0; - GetNHApp()->bNoVScroll = TRUE; - } else { - GetNHApp()->bNoVScroll = FALSE; - data->yPos = max( - 0, min(ROWNO - data->yPageSize + 1, u.uy - data->yPageSize / 2)); - } + GetNHApp()->bNoVScroll = (data->yPageSize == ROWNO); + + data->yMin = 0; + data->yMax = ROWNO - data->yPageSize; + data->yPos = max(0, min(data->yMax, u.uy - (data->yPageSize / 2))); si.cbSize = sizeof(si); si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; - si.nMin = 0; - si.nMax = ROWNO; - si.nPage = data->yPageSize; + si.nMin = data->yMin; + si.nMax = data->yMax; + si.nPage = 1; si.nPos = data->yPos; SetScrollInfo(hWnd, SB_VERT, &si, TRUE); /* create font */ if (data->hMapFont) DeleteObject(data->hMapFont); + + LOGFONT lgfnt; + ZeroMemory(&lgfnt, sizeof(lgfnt)); lgfnt.lfHeight = -data->yScrTile; // height of font lgfnt.lfWidth = -data->xScrTile; // average character width @@ -231,95 +260,92 @@ mswin_map_mode(HWND hWnd, int mode) case MAP_MODE_ASCII4x6: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 4 * COLNO; - mapSize.cy = 6 * ROWNO; + data->tileWidth = 4; + data->tileHeight = 6; break; case MAP_MODE_ASCII6x8: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 6 * COLNO; - mapSize.cy = 8 * ROWNO; + data->tileWidth = 6; + data->tileHeight = 8; break; case MAP_MODE_ASCII8x8: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 8 * COLNO; - mapSize.cy = 8 * ROWNO; + data->tileWidth = 8; + data->tileHeight = 8; break; case MAP_MODE_ASCII16x8: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 16 * COLNO; - mapSize.cy = 8 * ROWNO; + data->tileWidth = 16; + data->tileHeight = 8; break; case MAP_MODE_ASCII7x12: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 7 * COLNO; - mapSize.cy = 12 * ROWNO; + data->tileWidth = 7; + data->tileHeight = 12; break; case MAP_MODE_ASCII8x12: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 8 * COLNO; - mapSize.cy = 12 * ROWNO; + data->tileWidth = 8; + data->tileHeight = 12; break; case MAP_MODE_ASCII16x12: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 16 * COLNO; - mapSize.cy = 12 * ROWNO; + data->tileWidth = 16; + data->tileHeight = 12; break; case MAP_MODE_ASCII12x16: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 12 * COLNO; - mapSize.cy = 16 * ROWNO; + data->tileWidth = 12; + data->tileHeight = 16; break; case MAP_MODE_ASCII10x18: data->bAsciiMode = TRUE; data->bFitToScreenMode = FALSE; - mapSize.cx = 10 * COLNO; - mapSize.cy = 18 * ROWNO; + data->tileWidth = 10; + data->tileHeight = 18; break; - case MAP_MODE_ASCII_FIT_TO_SCREEN: { - RECT client_rt; - GetClientRect(hWnd, &client_rt); - mapSize.cx = client_rt.right - client_rt.left; - mapSize.cy = client_rt.bottom - client_rt.top; - + case MAP_MODE_ASCII_FIT_TO_SCREEN: data->bAsciiMode = TRUE; data->bFitToScreenMode = TRUE; - } break; - - case MAP_MODE_TILES_FIT_TO_SCREEN: { - RECT client_rt; - GetClientRect(hWnd, &client_rt); - mapSize.cx = client_rt.right - client_rt.left; - mapSize.cy = client_rt.bottom - client_rt.top; + data->tileWidth = 12; + data->tileHeight = 16; + break; + case MAP_MODE_TILES_FIT_TO_SCREEN: data->bAsciiMode = FALSE; data->bFitToScreenMode = TRUE; - } break; + data->tileWidth = GetNHApp()->mapTile_X; + data->tileHeight = GetNHApp()->mapTile_Y; + break; case MAP_MODE_TILES: default: data->bAsciiMode = FALSE; data->bFitToScreenMode = FALSE; - mapSize.cx = GetNHApp()->mapTile_X * COLNO; - mapSize.cy = GetNHApp()->mapTile_Y * ROWNO; + data->tileWidth = GetNHApp()->mapTile_X; + data->tileHeight = GetNHApp()->mapTile_Y; break; } + mapSize.cx = data->tileWidth * COLNO; + mapSize.cy = data->tileHeight * ROWNO; + mswin_map_stretch(hWnd, &mapSize, TRUE); mswin_update_inventory(); /* for perm_invent to hide/show tiles */ @@ -618,6 +644,8 @@ onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam) data->xScrTile = GetNHApp()->mapTile_X; data->yScrTile = GetNHApp()->mapTile_Y; + data->tileWidth = GetNHApp()->mapTile_X; + data->tileHeight = GetNHApp()->mapTile_Y; SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) data); } @@ -712,10 +740,10 @@ onPaint(HWND hWnd) if (data->bUnicodeFont) { wch = winos_ascii_to_wide(ch); DrawTextW(hDC, &wch, 1, &glyph_rect, - DT_CENTER | DT_VCENTER | DT_NOPREFIX); + DT_CENTER | DT_VCENTER | DT_NOPREFIX); } else { DrawTextA(hDC, &ch, 1, &glyph_rect, - DT_CENTER | DT_VCENTER | DT_NOPREFIX); + DT_CENTER | DT_VCENTER | DT_NOPREFIX); } SetTextColor(hDC, OldFg); @@ -887,7 +915,7 @@ onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam) yNewPos = data->yPos; } - yNewPos = max(0, min(ROWNO - data->yPageSize + 1, yNewPos)); + yNewPos = max(0, min(data->yMax, yNewPos)); if (yNewPos == data->yPos) return; @@ -948,7 +976,7 @@ onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam) xNewPos = data->xPos; } - xNewPos = max(0, min(COLNO - data->xPageSize + 1, xNewPos)); + xNewPos = max(0, min(data->xMax, xNewPos)); if (xNewPos == data->xPos) return; diff --git a/win/win32/vs2017/.gitignore b/win/win32/vs2017/.gitignore index 6d1d5c867..f87237325 100644 --- a/win/win32/vs2017/.gitignore +++ b/win/win32/vs2017/.gitignore @@ -1,4 +1,4 @@ !NetHack.sln *.db-shm *.db-wal - +paniclog diff --git a/win/win32/vs2017/NetHackW.exe.manifest b/win/win32/vs2017/NetHackW.exe.manifest index 3a236519c..51db0685b 100644 --- a/win/win32/vs2017/NetHackW.exe.manifest +++ b/win/win32/vs2017/NetHackW.exe.manifest @@ -2,9 +2,7 @@ - unaware - - + PerMonitorV2 diff --git a/win/win32/winhack.c b/win/win32/winhack.c index 1657b0220..9dcbb4e4b 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -5,14 +5,15 @@ // winhack.cpp : Defines the entry point for the application. // +#include "win10.h" #include + #include "winMS.h" #include "hack.h" #include "dlb.h" #include "resource.h" #include "mhmain.h" #include "mhmap.h" -#include "win10.h" /* Borland and MinGW redefine "boolean" in shlwapi.h, so just use the little bit we need */ From 0bbc7cb6db6fa9cc2b870a19a12d61d02e29dcf5 Mon Sep 17 00:00:00 2001 From: Bart House Date: Mon, 12 Nov 2018 19:36:08 -0800 Subject: [PATCH 11/12] Adjust tile size to bounds of text meterics when in ascii mode. --- win/win32/mhmap.c | 127 +++++++++++++++++++++++++++++----------------- 1 file changed, 81 insertions(+), 46 deletions(-) diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index e186ca13a..ce9330e8e 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -2,13 +2,13 @@ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ -#include "winos.h" -#include "winMS.h" #include "win10.h" +#include "winMS.h" +#include "winos.h" -#include "mhmap.h" #include "mhfont.h" #include "mhinput.h" +#include "mhmap.h" #include "mhmsg.h" #include "resource.h" @@ -31,22 +31,22 @@ typedef struct mswin_nethack_map_window { int map[COLNO][ROWNO]; /* glyph map */ int bkmap[COLNO][ROWNO]; /* backround glyph map */ - int mapMode; /* current map mode */ - boolean bAsciiMode; /* switch ASCII/tiled mode */ - boolean bFitToScreenMode; /* switch Fit map to screen mode on/off */ - int xPos, yPos; /* scroll position */ - int xPageSize, yPageSize; /* scroll page size */ + int mapMode; /* current map mode */ + boolean bAsciiMode; /* switch ASCII/tiled mode */ + boolean bFitToScreenMode; /* switch Fit map to screen mode on/off */ + int xPos, yPos; /* scroll position */ + int xPageSize, yPageSize; /* scroll page size */ int xMin, xMax, yMin, yMax; /* scroll range */ - int xCur, yCur; /* position of the cursor */ - int xScrTile, yScrTile; /* size of tile on screen in pixels */ - POINT map_orig; /* map origin point */ + int xCur, yCur; /* position of the cursor */ + int xScrTile, yScrTile; /* size of tile on screen in pixels */ + POINT map_orig; /* map origin point */ HFONT hMapFont; /* font for ASCII mode */ boolean bUnicodeFont; /* font supports unicode page 437 */ - int tileWidth; /* width of tile in pixels at 96 dpi */ - int tileHeight; /* height of tile in pixels at 96 dpi */ - double scale; /* scale factor */ + int tileWidth; /* width of tile in pixels at 96 dpi */ + int tileHeight; /* height of tile in pixels at 96 dpi */ + double scale; /* scale factor */ } NHMapWindow, *PNHMapWindow; @@ -161,6 +161,68 @@ mswin_map_stretch(HWND hWnd, LPSIZE map_size, BOOL redraw) data->xScrTile = max(1, data->xScrTile); data->yScrTile = max(1, data->yScrTile); + /* create font */ + if (data->hMapFont) + DeleteObject(data->hMapFont); + + LOGFONT lgfnt; + + ZeroMemory(&lgfnt, sizeof(lgfnt)); + lgfnt.lfHeight = -data->yScrTile; // height of font + lgfnt.lfWidth = -data->xScrTile; // average character width + lgfnt.lfEscapement = 0; // angle of escapement + lgfnt.lfOrientation = 0; // base-line orientation angle + lgfnt.lfWeight = FW_NORMAL; // font weight + lgfnt.lfItalic = FALSE; // italic attribute option + lgfnt.lfUnderline = FALSE; // underline attribute option + lgfnt.lfStrikeOut = FALSE; // strikeout attribute option + lgfnt.lfCharSet = mswin_charset(); // character set identifier + lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision + lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision + lgfnt.lfQuality = NONANTIALIASED_QUALITY; // output quality + if (iflags.wc_font_map && *iflags.wc_font_map) { + lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family + NH_A2W(iflags.wc_font_map, lgfnt.lfFaceName, LF_FACESIZE); + } else { + lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family + NH_A2W(NHMAP_FONT_NAME, lgfnt.lfFaceName, LF_FACESIZE); + } + + TEXTMETRIC textMetrics; + + while (1) { + data->hMapFont = CreateFontIndirect(&lgfnt); + + HDC hdc = GetDC(NULL); + HFONT savedFont = SelectObject(hdc, data->hMapFont); + + GetTextMetrics(hdc, &textMetrics); + + SelectObject(hdc, savedFont); + ReleaseDC(NULL, hdc); + + if (textMetrics.tmHeight > data->yScrTile) { + lgfnt.lfHeight++; + continue; + } + + if (textMetrics.tmAveCharWidth > data->xScrTile) { + lgfnt.lfWidth++; + continue; + } + + break; + } + + data->bUnicodeFont = winos_font_support_cp437(data->hMapFont); + + // set tile size to match font metrics + + if (data->bAsciiMode) { + data->xScrTile = textMetrics.tmAveCharWidth; + data->yScrTile = textMetrics.tmHeight; + } + /* set map origin point */ data->map_orig.x = max(0, client_rt.left + (wnd_size.cx - data->xScrTile * COLNO) / 2); @@ -206,35 +268,6 @@ mswin_map_stretch(HWND hWnd, LPSIZE map_size, BOOL redraw) si.nPos = data->yPos; SetScrollInfo(hWnd, SB_VERT, &si, TRUE); - /* create font */ - if (data->hMapFont) - DeleteObject(data->hMapFont); - - LOGFONT lgfnt; - - ZeroMemory(&lgfnt, sizeof(lgfnt)); - lgfnt.lfHeight = -data->yScrTile; // height of font - lgfnt.lfWidth = -data->xScrTile; // average character width - lgfnt.lfEscapement = 0; // angle of escapement - lgfnt.lfOrientation = 0; // base-line orientation angle - lgfnt.lfWeight = FW_NORMAL; // font weight - lgfnt.lfItalic = FALSE; // italic attribute option - lgfnt.lfUnderline = FALSE; // underline attribute option - lgfnt.lfStrikeOut = FALSE; // strikeout attribute option - lgfnt.lfCharSet = mswin_charset(); // character set identifier - lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision - lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision - lgfnt.lfQuality = DEFAULT_QUALITY; // output quality - if (iflags.wc_font_map && *iflags.wc_font_map) { - lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family - NH_A2W(iflags.wc_font_map, lgfnt.lfFaceName, LF_FACESIZE); - } else { - lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family - NH_A2W(NHMAP_FONT_NAME, lgfnt.lfFaceName, LF_FACESIZE); - } - data->hMapFont = CreateFontIndirect(&lgfnt); - data->bUnicodeFont = winos_font_support_cp437(data->hMapFont); - mswin_cliparound(data->xCur, data->yCur); if (redraw) @@ -320,7 +353,7 @@ mswin_map_mode(HWND hWnd, int mode) data->tileHeight = 18; break; - case MAP_MODE_ASCII_FIT_TO_SCREEN: + case MAP_MODE_ASCII_FIT_TO_SCREEN: data->bAsciiMode = TRUE; data->bFitToScreenMode = TRUE; data->tileWidth = 12; @@ -740,10 +773,12 @@ onPaint(HWND hWnd) if (data->bUnicodeFont) { wch = winos_ascii_to_wide(ch); DrawTextW(hDC, &wch, 1, &glyph_rect, - DT_CENTER | DT_VCENTER | DT_NOPREFIX); + DT_CENTER | DT_VCENTER | DT_NOPREFIX + | DT_SINGLELINE); } else { DrawTextA(hDC, &ch, 1, &glyph_rect, - DT_CENTER | DT_VCENTER | DT_NOPREFIX); + DT_CENTER | DT_VCENTER | DT_NOPREFIX + | DT_SINGLELINE); } SetTextColor(hDC, OldFg); From d89deb5bf7a08953616189bd8a56f916261054d9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 12 Nov 2018 23:10:42 -0500 Subject: [PATCH 12/12] Makefile update to reference recently added file --- sys/winnt/Makefile.msc | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index ca781610b..2967c2cd0 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -300,7 +300,7 @@ conlibs = $(baselibs) guilibs = $(winlibs) # -INCLDIR= /I..\include +INCLDIR= /I..\include /I..\sys\winnt #========================================== # Util builds @@ -397,7 +397,8 @@ VOBJ23 = $(O)sys.o $(O)teleport.o $(O)timeout.o $(O)topten.o VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o -VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o +VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o +VOBJ28 = $(O)win10.o DLBOBJ = $(O)dlb.o @@ -996,14 +997,6 @@ $(O)envchk.tag: $(O)obj.tag #=========== SECONDARY TARGETS ============ #========================================== -#=========================================== -# Header files NOT distributed in $(INCL) -#=========================================== - -$(INCL)\win32api.h: $(MSWSYS)\win32api.h - copy $(MSWSYS)\win32api.h $@ - - #========================================== # DLB utility and nhdat file creation #========================================== @@ -1064,7 +1057,7 @@ $(U)recover.exe: $(RECOVOBJS) @echo Linking $(@:\=/) $(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(RECOVOBJS) -$(O)recover.o: $(CONFIG_H) $(U)recover.c $(INCL)\win32api.h +$(O)recover.o: $(CONFIG_H) $(U)recover.c $(MSWSYS)\win32api.h @$(cc) $(cflagsBuild) -Fo$@ $(U)recover.c #========================================== @@ -1158,10 +1151,10 @@ $(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32) ) << -$(O)tile2bmp.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h +$(O)tile2bmp.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h @$(cc) $(cflagsBuild) -I$(WSHR) /DPACKED_FILE /Fo$@ $(WSHR)\tile2bmp.c -$(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h +$(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h @$(cc) $(cflagsBuild) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WSHR)\tile2bmp.c #========================================== @@ -1234,7 +1227,6 @@ spotless: clean if exist $(O)gamedir.tag del $(O)gamedir.tag if exist $(O)nh*key.lib del $(O)nh*key.lib if exist $(O)nh*key.exp del $(O)nh*key.exp - if exist $(INCL)\win32api.h del $(INCL)\win32api.h if exist $(MSWIN)\mnsel.bmp del $(MSWIN)\mnsel.bmp if exist $(MSWIN)\mnselcnt.bmp del $(MSWIN)\mnselcnt.bmp if exist $(MSWIN)\mnunsel.bmp del $(MSWIN)\mnunsel.bmp @@ -1339,9 +1331,9 @@ $(DAT)\dungeon: $(O)utility.tag $(DAT)\dungeon.def # NT dependencies # -$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(MSWSYS)\nttty.c +$(O)nttty.o: $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h $(MSWSYS)\nttty.c @$(cc) $(cflagsBuild) -I$(WSHR) -Fo$@ $(MSWSYS)\nttty.c -$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(MSWSYS)\winnt.c +$(O)winnt.o: $(HACK_H) $(MSWSYS)\win32api.h $(MSWSYS)\winnt.c @$(cc) $(cflagsBuild) -Fo$@ $(MSWSYS)\winnt.c $(O)ntsound.o: $(HACK_H) $(MSWSYS)\ntsound.c @$(cc) $(cflagsBuild) -Fo$@ $(MSWSYS)\ntsound.c @@ -1390,7 +1382,7 @@ $(O)panic.o: $(U)panic.c $(CONFIG_H) $(O)tos.o: ..\sys\atari\tos.c $(HACK_H) $(INCL)\tcap.h @$(CC) $(cflagsBuild) -Fo$@ ..\sys\atari\tos.c $(O)pcmain.o: ..\sys\share\pcmain.c $(HACK_H) $(INCL)\dlb.h \ - $(INCL)\win32api.h + $(MSWSYS)\win32api.h @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\pcmain.c $(O)pcsys.o: ..\sys\share\pcsys.c $(HACK_H) @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\pcsys.c