From 141dec6d2e03147b94fd72b940bf72b627d27e7d Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 16 Nov 2018 18:49:12 -0800 Subject: [PATCH 01/14] feedback for missing readonly data files If bogusmon, engrave, epitaph, oralces, or rumors won't open, assume it's because the file is missing so don't have impossible() tack on "saving and restoring might fix this" when telling the player. (Missing rumors or oracles previously only used pline() rather than impossible() so this hadn't been an issue for them. Now it would be.) --- src/rumors.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/rumors.c b/src/rumors.c index 5e9af00a0..a0f367952 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 rumors.c $NHDT-Date: 1446713640 2015/11/05 08:54:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */ +/* NetHack 3.6 rumors.c $NHDT-Date: 1542422933 2018/11/17 02:48:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -43,6 +43,7 @@ STATIC_DCL void FDECL(init_rumors, (dlb *)); STATIC_DCL void FDECL(init_oracles, (dlb *)); +STATIC_DCL void FDECL(couldnt_open_file, (const char *)); /* rumor size variables are signed so that value -1 can be used as a flag */ static long true_rumor_size = 0L, false_rumor_size; @@ -155,7 +156,7 @@ boolean exclude_cookie; else if (!in_mklev) /* avoid exercizing wisdom for graffiti */ exercise(A_WIS, (adjtruth > 0)); } else { - pline("Can't open rumors file!"); + couldnt_open_file(RUMORFILE); true_rumor_size = -1; /* don't try to open it again */ } /* this is safe either way, so do it always since we can't get the definition @@ -272,7 +273,7 @@ rumor_check() display_nhwindow(tmpwin, TRUE); destroy_nhwindow(tmpwin); } else { - impossible("Can't open rumors file!"); + couldnt_open_file(RUMORFILE); true_rumor_size = -1; /* don't try to open it again */ } } @@ -314,8 +315,10 @@ char *buf; *endp = 0; Strcat(buf, xcrypt(line, xbuf)); (void) dlb_fclose(fh); - } else - impossible("Can't open file %s!", fname); + } else { + couldnt_open_file(fname); + } + return buf; } @@ -469,7 +472,7 @@ boolean delphi; destroy_nhwindow(tmpwin); (void) dlb_fclose(oracles); } else { - pline("Can't open oracles file!"); + couldnt_open_file(ORACLEFILE); oracle_flg = -1; /* don't try to open it again */ } } @@ -547,4 +550,20 @@ struct monst *oracl; return 1; } +STATIC_OVL void +couldnt_open_file(filename) +const char *filename; +{ + int save_something = program_state.something_worth_saving; + + /* most likely the file is missing, so suppress impossible()'s + "saving and restoring might fix this" (unless the fuzzer, + which escalates impossible to panic, is running) */ + if (!iflags.debug_fuzzer) + program_state.something_worth_saving = 0; + + impossible("Can't open '%s' file.", filename); + program_state.something_worth_saving = save_something; +} + /*rumors.c*/ From d2436d9f3c005fb3a0bd32508f32e17acb0eb44d Mon Sep 17 00:00:00 2001 From: Bart House Date: Fri, 16 Nov 2018 21:48:00 -0800 Subject: [PATCH 02/14] Map curso blinking controlled by win32_cursorblink. --- win/win32/mhmap.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 233e02ed1..8e61aea8c 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -21,8 +21,6 @@ #define CURSOR_BLINK_INTERVAL 1000 // milliseconds #define CURSOR_HEIGHT 2 // pixels -#define CUSOR_BLINK FALSE // Set to true for a cursor that blinks - extern short glyph2tile[]; #define TILEBMP_X(ntile) \ @@ -59,7 +57,10 @@ typedef struct mswin_nethack_map_window { double monitorScale; /* from 96dpi to monitor dpi*/ boolean cursorOn; - int yCursor; /* height of cursor inback buffer in pixels */ + int yNoBlinkCursor; /* non-blinking cursor height inback buffer + in pixels */ + int yBlinkCursor; /* blinking cursor height inback buffer + in pixels */ int backWidth; /* back buffer width */ int backHeight; /* back buffer height */ @@ -132,10 +133,8 @@ mswin_init_map_window() mswin_apply_window_style(hWnd); -#if CURSOR_BLINK /* set cursor blink timer */ SetTimer(hWnd, 0, CURSOR_BLINK_INTERVAL, NULL); -#endif return hWnd; } @@ -283,11 +282,8 @@ mswin_map_stretch(HWND hWnd, LPSIZE map_size, BOOL redraw) data->yFrontTile = (int) ((double) data->yBackTile * data->frontScale); /* calcuate ASCII cursor height */ -#if CURSOR_BLINK - data->yCursor = (int) ((double) CURSOR_HEIGHT * data->backScale); -#else - data->yCursor = data->yBackTile; -#endif + data->yBlinkCursor = (int) ((double) CURSOR_HEIGHT * data->backScale); + data->yNoBlinkCursor = data->yBackTile; /* set map origin point */ data->map_orig.x = @@ -830,7 +826,8 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect) } #endif - if (i == data->xCur && j == data->yCur && data->cursorOn) + if (i == data->xCur && j == data->yCur && + (data->cursorOn || !win32_cursorblink)) DrawFocusRect(data->backBufferDC, rect); } @@ -897,12 +894,16 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect) SetTextColor(data->backBufferDC, OldFg); } - if (i == data->xCur && j == data->yCur && data->cursorOn) + if (i == data->xCur && j == data->yCur && + (data->cursorOn || !win32_cursorblink)) { + int yCursor = (win32_cursorblink ? data->yBlinkCursor : + data->yNoBlinkCursor); PatBlt(data->backBufferDC, - rect->left, rect->bottom - data->yCursor, + rect->left, rect->bottom - yCursor, rect->right - rect->left, - data->yCursor, + yCursor, DSTINVERT); + } } static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg) From 8f4c2d2a82d123cc36708e717b8347c53442e4de Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 17 Nov 2018 16:31:22 -0800 Subject: [PATCH 03/14] formatting: tile.c A while back I changed tilemap.c to clean up the formatting of generated tile.c. This is a smaller change to revise the layout of its big array. --- win/share/tilemap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/win/share/tilemap.c b/win/share/tilemap.c index e2ec90e40..f859f44e8 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 tilemap.c $NHDT-Date: 1524689272 2018/04/25 20:47:52 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.33 $ */ +/* NetHack 3.6 tilemap.c $NHDT-Date: 1542501042 2018/11/18 00:30:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.35 $ */ /* Copyright (c) 2016 by Michael Allison */ /* NetHack may be freely redistributed. See license for details. */ @@ -497,9 +497,11 @@ main() Fprintf(ofp, "\nshort glyph2tile[MAX_GLYPH] = {\n"); for (i = 0; i < MAX_GLYPH; i++) { - Fprintf(ofp, "%2d,%c", tilemap[i], (i % 12) ? ' ' : '\n'); + Fprintf(ofp, " %4d,", tilemap[i]); + if ((i % 12) == 11 || i == MAX_GLYPH - 1) + Fprintf(ofp, "\n"); } - Fprintf(ofp, "\n};\n"); + Fprintf(ofp, "};\n"); process_substitutions(ofp); From 27fe555bc1e4af8b2f250d4c2bd89781a0288107 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 17 Nov 2018 16:40:53 -0800 Subject: [PATCH 04/14] src/ formatting Clean up quite a bit of minor things found with simple grep patterns: operator at end of continued line instead of beginning of continuation (and a few comments which produced false matches, so that they won't do so next time), trailing spaces (only one or two of those), tabs (a dozen or so of those), several casts which didn't have a space between the type and the expression (I wasn't systematic about finding these). I think the only code change was in the function for the help command. --- src/botl.c | 54 +++++++++++++++++++++++++-------------------------- src/display.c | 4 ++-- src/dogmove.c | 10 +++------- src/dokick.c | 8 ++++---- src/dothrow.c | 5 +++-- src/mkmaze.c | 19 +++++++++--------- src/mthrowu.c | 2 +- src/objnam.c | 6 +++--- src/options.c | 4 ++-- src/pager.c | 20 +++++++++---------- src/potion.c | 9 ++++----- src/read.c | 4 ++-- src/role.c | 17 ++++++++-------- src/sp_lev.c | 12 ++++++------ src/trap.c | 9 ++++----- src/vision.c | 18 ++++++++--------- src/wizard.c | 2 +- 17 files changed, 98 insertions(+), 105 deletions(-) diff --git a/src/botl.c b/src/botl.c index b2462f50f..4af749105 100644 --- a/src/botl.c +++ b/src/botl.c @@ -91,8 +91,9 @@ check_gold_symbol() int goldch, goldoc; unsigned int goldos; int goldglyph = objnum_to_glyph(GOLD_PIECE); + (void) mapglyph(goldglyph, &goldch, &goldoc, &goldos, 0, 0); - iflags.invis_goldsym = ((char)goldch <= ' '); + iflags.invis_goldsym = ((char) goldch <= ' '); } char * @@ -829,8 +830,7 @@ boolean *valsetlist; * the display, call status_update() with BL_FLUSH. * */ - if (context.botlx && - (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L) + if (context.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L) status_update(BL_RESET, (genericptr_t) 0, 0, 0, NO_COLOR, &cond_hilites[0]); else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L) @@ -2091,33 +2091,33 @@ boolean from_configfile; } const struct condmap valid_conditions[] = { - {"stone", BL_MASK_STONE}, - {"slime", BL_MASK_SLIME}, - {"strngl", BL_MASK_STRNGL}, - {"foodPois", BL_MASK_FOODPOIS}, - {"termIll", BL_MASK_TERMILL}, - {"blind", BL_MASK_BLIND}, - {"deaf", BL_MASK_DEAF}, - {"stun", BL_MASK_STUN}, - {"conf", BL_MASK_CONF}, - {"hallu", BL_MASK_HALLU}, - {"lev", BL_MASK_LEV}, - {"fly", BL_MASK_FLY}, - {"ride", BL_MASK_RIDE}, + { "stone", BL_MASK_STONE }, + { "slime", BL_MASK_SLIME }, + { "strngl", BL_MASK_STRNGL }, + { "foodPois", BL_MASK_FOODPOIS }, + { "termIll", BL_MASK_TERMILL }, + { "blind", BL_MASK_BLIND }, + { "deaf", BL_MASK_DEAF }, + { "stun", BL_MASK_STUN }, + { "conf", BL_MASK_CONF }, + { "hallu", BL_MASK_HALLU }, + { "lev", BL_MASK_LEV }, + { "fly", BL_MASK_FLY }, + { "ride", BL_MASK_RIDE }, }; const struct condmap condition_aliases[] = { - {"strangled", BL_MASK_STRNGL}, - {"all", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL | - BL_MASK_FOODPOIS | BL_MASK_TERMILL | - BL_MASK_BLIND | BL_MASK_DEAF | BL_MASK_STUN | - BL_MASK_CONF | BL_MASK_HALLU | - BL_MASK_LEV | BL_MASK_FLY | BL_MASK_RIDE }, - {"major_troubles", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL | - BL_MASK_FOODPOIS | BL_MASK_TERMILL}, - {"minor_troubles", BL_MASK_BLIND | BL_MASK_DEAF | BL_MASK_STUN | - BL_MASK_CONF | BL_MASK_HALLU}, - {"movement", BL_MASK_LEV | BL_MASK_FLY | BL_MASK_RIDE} + { "strangled", BL_MASK_STRNGL }, + { "all", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL + | BL_MASK_FOODPOIS | BL_MASK_TERMILL + | BL_MASK_BLIND | BL_MASK_DEAF | BL_MASK_STUN + | BL_MASK_CONF | BL_MASK_HALLU + | BL_MASK_LEV | BL_MASK_FLY | BL_MASK_RIDE }, + { "major_troubles", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL + | BL_MASK_FOODPOIS | BL_MASK_TERMILL }, + { "minor_troubles", BL_MASK_BLIND | BL_MASK_DEAF | BL_MASK_STUN + | BL_MASK_CONF | BL_MASK_HALLU }, + { "movement", BL_MASK_LEV | BL_MASK_FLY | BL_MASK_RIDE } }; unsigned long diff --git a/src/display.c b/src/display.c index 9aca21fa4..129b63fd3 100644 --- a/src/display.c +++ b/src/display.c @@ -989,7 +989,7 @@ int x, y; /* Erase (reset) from source to end */ for (i = 0; i < tglyph->sidx; i++) newsym(tglyph->saved[i].x, tglyph->saved[i].y); - } else if (tglyph->style == DISP_TETHER) { + } else if (tglyph->style == DISP_TETHER) { int i; if (y == BACKTRACK && tglyph->sidx > 1) { @@ -1028,7 +1028,7 @@ int x, y; tglyph->saved[tglyph->sidx].x = x; tglyph->saved[tglyph->sidx].y = y; tglyph->sidx += 1; - } else if (tglyph->style == DISP_TETHER) { + } else if (tglyph->style == DISP_TETHER) { if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) break; /* too many locations */ if (tglyph->sidx) { diff --git a/src/dogmove.c b/src/dogmove.c index e21d4e3f5..1c8f4dd79 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -651,10 +651,8 @@ int maxdist; if (targ) { /* Is the monster visible to the pet? */ - if ((!targ->minvis || perceives(mtmp->data)) && - !targ->mundetected) + if ((!targ->minvis || perceives(mtmp->data)) && !targ->mundetected) break; - /* If the pet can't see it, it assumes it aint there */ targ = 0; } @@ -1107,12 +1105,10 @@ int after; /* this is extra fast monster movement */ /* This causes unintended issues for pets trying to follow the hero. Thus, only run it if not leashed and >5 tiles away. */ - if (!mtmp->mleashed && - distmin(mtmp->mx, mtmp->my, u.ux, u.uy) > 5) { + if (!mtmp->mleashed && distmin(mtmp->mx, mtmp->my, u.ux, u.uy) > 5) { k = has_edog ? uncursedcnt : cnt; for (j = 0; j < MTSZ && j < k - 1; j++) - if (nx == mtmp->mtrack[j].x && - ny == mtmp->mtrack[j].y) + if (nx == mtmp->mtrack[j].x && ny == mtmp->mtrack[j].y) if (rn2(MTSZ * (k - j))) goto nxti; } diff --git a/src/dokick.c b/src/dokick.c index 85d461696..3cce7395f 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -495,13 +495,13 @@ xchar x, y; return 0; if ((trap = t_at(x, y)) != 0) { - if ((is_pit(trap->ttyp) && !Passes_walls) - || trap->ttyp == WEB) { + if ((is_pit(trap->ttyp) && !Passes_walls) || trap->ttyp == WEB) { if (!trap->tseen) find_trap(trap); You_cant("kick %s that's in a %s!", something, - Hallucination ? "tizzy" : - (trap->ttyp == WEB) ? "web" : "pit"); + Hallucination ? "tizzy" + : (trap->ttyp == WEB) ? "web" + : "pit"); return 1; } if (trap->ttyp == STATUE_TRAP) { diff --git a/src/dothrow.c b/src/dothrow.c index 877740193..d40857447 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1287,9 +1287,10 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ pline("%s returns to your hand!", The(xname(thrownobj))); thrownobj = addinv(thrownobj); (void) encumber_msg(); - if (thrownobj->owornmask & W_QUIVER) /* in case addinv() autoquivered */ + /* in case addinv() autoquivered */ + if (thrownobj->owornmask & W_QUIVER) setuqwep((struct obj *) 0); - setuwep(thrownobj); + setuwep(thrownobj); } else { /* ball is not picked up by monster */ if (obj != uball) diff --git a/src/mkmaze.c b/src/mkmaze.c index 1c2aca8da..6300fe56f 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -632,7 +632,7 @@ char *s; } #define ORC_LEADER 1 -static const char *orcfruit[] = {"paddle cactus", "dwarven root"}; +static const char *orcfruit[] = { "paddle cactus", "dwarven root" }; void migrate_orc(mtmp, mflags) @@ -643,8 +643,8 @@ unsigned long mflags; d_level dest; cur_depth = (int) depth(&u.uz); - max_depth = dunlevs_in_dungeon(&u.uz) + - (dungeons[u.uz.dnum].depth_start - 1); + max_depth = dunlevs_in_dungeon(&u.uz) + + (dungeons[u.uz.dnum].depth_start - 1); if (mflags == ORC_LEADER) { /* Note that the orc leader will take possession of any * remaining stuff not already delivered to other @@ -695,8 +695,7 @@ struct monst *mtmp; } if (is_captain || !rn2(8)) { otyp = shiny_obj(RING_CLASS); - if ((otyp != STRANGE_OBJECT) && - (otmp = mksobj(otyp, FALSE, FALSE)) != 0) + if (otyp != STRANGE_OBJECT && (otmp = mksobj(otyp, FALSE, FALSE)) != 0) add_to_minv(mtmp, otmp); } } @@ -754,11 +753,11 @@ stolen_booty(VOID_ARGS) for (i = 0; i < cnt; ++i) { /* Food items - but no lembas! (or some other weird things) */ otyp = rn2((TIN - TRIPE_RATION) + 1) + TRIPE_RATION; - if (otyp != LEMBAS_WAFER && otyp != GLOB_OF_GRAY_OOZE && - otyp != GLOB_OF_BROWN_PUDDING && otyp != GLOB_OF_GREEN_SLIME && - otyp != GLOB_OF_BLACK_PUDDING && otyp != MEAT_STICK && - otyp != MEATBALL && otyp != MEAT_STICK && otyp != MEAT_RING && - otyp != HUGE_CHUNK_OF_MEAT && otyp != CORPSE) + if (otyp != LEMBAS_WAFER && otyp != GLOB_OF_GRAY_OOZE + && otyp != GLOB_OF_BROWN_PUDDING && otyp != GLOB_OF_GREEN_SLIME + && otyp != GLOB_OF_BLACK_PUDDING && otyp != MEAT_STICK + && otyp != MEATBALL && otyp != MEAT_STICK && otyp != MEAT_RING + && otyp != HUGE_CHUNK_OF_MEAT && otyp != CORPSE) migr_booty_item(otyp, gang); } migr_booty_item(rn2(2) ? LONG_SWORD : SILVER_SABER, gang); diff --git a/src/mthrowu.c b/src/mthrowu.c index 28a979940..b2ffd6d28 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -804,7 +804,7 @@ struct attack *mattk; if ((typ >= AD_MAGM) && (typ <= AD_ACID)) { if (canseemon(mtmp)) pline("%s breathes %s!", Monnam(mtmp), breathwep[typ - 1]); - dobuzz((int) (-20 - (typ - 1)), (int)mattk->damn, + dobuzz((int) (-20 - (typ - 1)), (int) mattk->damn, mtmp->mx, mtmp->my, sgn(tbx), sgn(tby), FALSE); nomul(0); /* breath runs out sometimes. Also, give monster some diff --git a/src/objnam.c b/src/objnam.c index bf108c472..3fc3e01d2 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -2484,8 +2484,6 @@ badman(basestr, to_plural) const char *basestr; boolean to_plural; /* true => makeplural, false => makesingular */ { - int i, al; - char *endstr, *spot; /* these are all the prefixes for *man that don't have a *men plural */ static const char *no_men[] = { "albu", "antihu", "anti", "ata", "auto", "bildungsro", "cai", "cay", @@ -2501,11 +2499,13 @@ boolean to_plural; /* true => makeplural, false => makesingular */ "tegu", "vela", "da", "hy", "lu", "no", "nu", "ra", "ru", "se", "vi", "ya", "o", "a", }; + int i, al; + const char *endstr, *spot; if (!basestr || strlen(basestr) < 4) return FALSE; - endstr = eos((char *)basestr); + endstr = eos((char *) basestr); if (to_plural) { for (i = 0; i < SIZE(no_men); i++) { diff --git a/src/options.c b/src/options.c index e337b4c36..7e986a7f5 100644 --- a/src/options.c +++ b/src/options.c @@ -3293,8 +3293,8 @@ boolean tinitial, tfrom_file; /* WINCAP * - * map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12| - * ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen] + * map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12 + * |ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen] */ fullname = "map_mode"; if (match_optname(opts, fullname, sizeof("map_mode") - 1, TRUE)) { diff --git a/src/pager.c b/src/pager.c index 305cfdc5a..d086086f0 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,8 @@ STATIC_DCL struct permonst *FDECL(lookat, (int, int, char *, char *)); STATIC_DCL void FDECL(checkfile, (char *, struct permonst *, BOOLEAN_P, BOOLEAN_P, char *)); STATIC_DCL void FDECL(look_all, (BOOLEAN_P,BOOLEAN_P)); -STATIC_DCL void FDECL(do_supplemental_info, (char *, struct permonst *,BOOLEAN_P)); +STATIC_DCL void FDECL(do_supplemental_info, (char *, struct permonst *, + BOOLEAN_P)); STATIC_DCL void NDECL(whatdoes_help); STATIC_DCL void NDECL(docontact); STATIC_DCL void NDECL(dispfile_help); @@ -1352,9 +1353,8 @@ boolean without_asking; * meant to support in-game mythology, and not * available from data.base or other sources. */ - if (name && pm && is_orc(pm) && - (strlen(name) < (BUFSZ - 1)) && - (bp = strstri(name, " of ")) != 0) { + if (name && pm && is_orc(pm) && (strlen(name) < (BUFSZ - 1)) + && (bp = strstri(name, " of ")) != 0) { char fullname[BUFSZ]; Strcpy(fullname, name); @@ -1880,7 +1880,7 @@ domenucontrols() /* data for dohelp() */ static struct { - void (*f)(); + void NDECL((*f)); const char *text; } help_menu_items[] = { { hmenu_doextversion, "About NetHack (version information)." }, @@ -1900,7 +1900,7 @@ static struct { { port_help, "%s-specific help and commands." }, #endif { dispfile_debughelp, "List of wizard-mode commands." }, - { NULL, (char *) 0 } + { (void NDECL((*))) 0, (char *) 0 } }; /* the '?' command */ @@ -1913,7 +1913,6 @@ dohelp() menu_item *selected; anything any; int sel; - char *bufptr; any = zeroany; /* zero all bits */ start_menu(tmpwin); @@ -1923,13 +1922,12 @@ dohelp() continue; if (help_menu_items[i].text[0] == '%') { Sprintf(helpbuf, help_menu_items[i].text, PORT_ID); - bufptr = helpbuf; } else { - bufptr = (char *)help_menu_items[i].text; + Strcpy(helpbuf, help_menu_items[i].text); } any.a_int = i + 1; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - bufptr, MENU_UNSELECTED); + helpbuf, MENU_UNSELECTED); } end_menu(tmpwin, "Select one item:"); n = select_menu(tmpwin, PICK_ONE, &selected); @@ -1937,7 +1935,7 @@ dohelp() if (n > 0) { sel = selected[0].item.a_int - 1; free((genericptr_t) selected); - (void)(*help_menu_items[sel].f)(); + (void) (*help_menu_items[sel].f)(); } return 0; } diff --git a/src/potion.c b/src/potion.c index 537cb064b..8985755bb 100644 --- a/src/potion.c +++ b/src/potion.c @@ -597,8 +597,7 @@ register struct obj *otmp; the spell or with a unihorn; this is better than full healing in that it can restore all of them, not just half, and a blessed potion restores them all at once */ - if (otmp->otyp == POT_RESTORE_ABILITY && - u.ulevel < u.ulevelmax) { + if (otmp->otyp == POT_RESTORE_ABILITY && u.ulevel < u.ulevelmax) { do { pluslvl(FALSE); } while (u.ulevel < u.ulevelmax && otmp->blessed); @@ -608,9 +607,9 @@ register struct obj *otmp; case POT_HALLUCINATION: if (Hallucination || Halluc_resistance) nothing++; - (void) make_hallucinated( - itimeout_incr(HHallucination, rn1(200, 600 - 300 * bcsign(otmp))), - TRUE, 0L); + (void) make_hallucinated(itimeout_incr(HHallucination, + rn1(200, 600 - 300 * bcsign(otmp))), + TRUE, 0L); break; case POT_WATER: if (!otmp->blessed && !otmp->cursed) { diff --git a/src/read.c b/src/read.c index 8691d7f4c..f6b2c3092 100644 --- a/src/read.c +++ b/src/read.c @@ -2370,8 +2370,8 @@ struct obj *sobj; uball->spe = 1; /* special ball (see save) */ /* - * Place ball & chain if not swallowed. If swallowed, the ball & - * chain variables will be set at the next call to placebc(). + * Place ball & chain if not swallowed. If swallowed, the ball & chain + * variables will be set at the next call to placebc(). */ if (!u.uswallow) { placebc(); diff --git a/src/role.c b/src/role.c index f13ff5ede..69adcab7b 100644 --- a/src/role.c +++ b/src/role.c @@ -1703,14 +1703,15 @@ plnamesuffix() /* some generic user names will be ignored in favor of prompting */ if (sysopt.genericusers) { - if (*sysopt.genericusers == '*') *plname = '\0'; - else { - i = (int)strlen(plname); - if ((sptr = strstri(sysopt.genericusers, plname)) != 0 - && (sptr == sysopt.genericusers || sptr[-1] == ' ') - && (sptr[i] == ' ' || sptr[i] == '\0')) - *plname = '\0'; /* call askname() */ - } + if (*sysopt.genericusers == '*') { + *plname = '\0'; + } else { + i = (int) strlen(plname); + if ((sptr = strstri(sysopt.genericusers, plname)) != 0 + && (sptr == sysopt.genericusers || sptr[-1] == ' ') + && (sptr[i] == ' ' || sptr[i] == '\0')) + *plname = '\0'; /* call askname() */ + } } do { diff --git a/src/sp_lev.c b/src/sp_lev.c index 488a04d87..52fe277ec 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -231,7 +231,7 @@ struct splevstack *st; st->depth = 0; st->depth_alloc = SPLEV_STACK_RESERVE; st->stackdata = - (struct opvar **) alloc(st->depth_alloc * sizeof(struct opvar *)); + (struct opvar **) alloc(st->depth_alloc * sizeof (struct opvar *)); } } @@ -284,7 +284,7 @@ struct opvar *v; if (st->depth >= st->depth_alloc) { struct opvar **tmp = (struct opvar **) alloc( - (st->depth_alloc + SPLEV_STACK_RESERVE) * sizeof(struct opvar *)); + (st->depth_alloc + SPLEV_STACK_RESERVE) * sizeof (struct opvar *)); (void) memcpy(tmp, st->stackdata, st->depth_alloc * sizeof(struct opvar *)); @@ -352,7 +352,7 @@ struct opvar * opvar_new_str(s) char *s; { - struct opvar *tmpov = (struct opvar *) alloc(sizeof(struct opvar)); + struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar)); tmpov->spovartyp = SPOVAR_STRING; if (s) { @@ -370,7 +370,7 @@ struct opvar * opvar_new_int(i) long i; { - struct opvar *tmpov = (struct opvar *) alloc(sizeof(struct opvar)); + struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar)); tmpov->spovartyp = SPOVAR_INT; tmpov->vardata.l = i; @@ -381,7 +381,7 @@ struct opvar * opvar_new_coord(x, y) int x, y; { - struct opvar *tmpov = (struct opvar *) alloc(sizeof(struct opvar)); + struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar)); tmpov->spovartyp = SPOVAR_COORD; tmpov->vardata.l = SP_COORD_PACK(x, y); @@ -393,7 +393,7 @@ struct opvar * opvar_new_region(x1,y1,x2,y2) int x1,y1,x2,y2; { - struct opvar *tmpov = (struct opvar *)alloc(sizeof (struct opvar)); + struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar)); tmpov->spovartyp = SPOVAR_REGION; tmpov->vardata.l = SP_REGION_PACK(x1,y1,x2,y2); diff --git a/src/trap.c b/src/trap.c index 957e0f63c..ab7ed7883 100644 --- a/src/trap.c +++ b/src/trap.c @@ -5033,10 +5033,10 @@ struct trap *adjtrap; { struct trap *trap_with_u = t_at(u.ux0, u.uy0); - if (trap_with_u && adjtrap && u.utrap && u.utraptype == TT_PIT && - is_pit(trap_with_u->ttyp) && - is_pit(adjtrap->ttyp)) { + if (trap_with_u && adjtrap && u.utrap && u.utraptype == TT_PIT + && is_pit(trap_with_u->ttyp) && is_pit(adjtrap->ttyp)) { int idx; + for (idx = 0; idx < 8; idx++) { if (xdir[idx] == u.dx && ydir[idx] == u.dy) return TRUE; @@ -5063,8 +5063,7 @@ struct trap *trap; x = trap->tx + xdir[diridx]; y = trap->ty + ydir[diridx]; if (isok(x, y)) { - if ((t = t_at(x, y)) != 0 - && is_pit(t->ttyp)) { + if ((t = t_at(x, y)) != 0 && is_pit(t->ttyp)) { trap->conjoined |= (1 << diridx); join_adjacent_pits(t); } else diff --git a/src/vision.c b/src/vision.c index be87051d9..b8ce2e507 100644 --- a/src/vision.c +++ b/src/vision.c @@ -379,8 +379,8 @@ STATIC_DCL int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); * @ <-- hero --> @ * * - * We fake the above check by only checking if the horizontal & - * vertical positions adjacent to the crosswall and T wall are + * We fake the above check by only checking if the horizontal + * & vertical positions adjacent to the crosswall and T wall are * unblocked. Then, _in general_ we can see beyond. Generally, * this is good enough. * @@ -388,8 +388,8 @@ STATIC_DCL int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); * information (we're doing a top down scan in vision_recalc). * We would need to scan once to set all IN_SIGHT and COULD_SEE * bits, then again to correctly set the seenv bits. - * + I'm trying to make this as cheap as possible. The display & - * vision eat up too much CPU time. + * + I'm trying to make this as cheap as possible. The display + * & vision eat up too much CPU time. * * * Note: Even as I write this, I'm still not convinced. There are too @@ -877,11 +877,11 @@ int x, y; } /*==========================================================================*\ - | | - | Everything below this line uses (y,x) instead of (x,y) --- the | - | algorithms are faster if they are less recursive and can scan | - | on a row longer. | - | | + : : + : Everything below this line uses (y,x) instead of (x,y) --- the : + : algorithms are faster if they are less recursive and can scan : + : on a row longer. : + : : \*==========================================================================*/ /* ======================================================================= *\ diff --git a/src/wizard.c b/src/wizard.c index b3a19e887..df64a4d2d 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -587,7 +587,7 @@ struct monst *summoner; } while (summoner && ((attacktype(&mons[makeindex], AT_MAGC) && mons[makeindex].difficulty - >= mons[summoner->mnum].difficulty) + >= mons[summoner->mnum].difficulty) || (s_cls == S_DEMON && m_cls == S_ANGEL) || (s_cls == S_ANGEL && m_cls == S_DEMON))); /* do this after picking the monster to place */ From 83fb79b77597cc44658458872a81d406ae177487 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 17 Nov 2018 21:17:43 -0500 Subject: [PATCH 05/14] more CR on windows --- win/curses/cursmesg.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 67986bbbb..d54249dcd 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -133,9 +133,11 @@ curses_message_win_puts(const char *message, boolean recursed) } #ifdef WIN32 -#define XTRA_RESP "\r" +#define RESP " \n\033\r" /* space, enter, esc, cr */ +#define TRANS " \n\033\n" /* translated return value */ #else -#define XTRA_RESP "" +#define RESP " \n\033" /* space, enter, esc */ +#define TRANS " \n\033" #endif int @@ -145,8 +147,9 @@ curses_block(boolean noscroll) { int height, width, ret; WINDOW *win = curses_get_nhwin(MESSAGE_WIN); - char *resp = " \n\033" XTRA_RESP; /* space, enter, esc */ - + char *resp = RESP; + char *trans = TRANS; + char *rp = (char *) 0; curses_get_window_size(MESSAGE_WIN, &height, &width); curses_toggle_color_attr(win, MORECOLOR, NONE, ON); mvwprintw(win, my, mx, iflags.msg_is_alert ? "" : ">>"); @@ -158,7 +161,9 @@ curses_block(boolean noscroll) /* msgtype=stop should require space/enter rather than * just any key, as we want to prevent YASD from * riding direction keys. */ - while (!iflags.msg_is_alert && (ret = wgetch(win)) && !index(resp,(char)ret)); + while (!iflags.msg_is_alert && + (ret = wgetch(win)) && ((rp = index(resp,(char)ret)) == 0)) + ; if (iflags.msg_is_alert) curses_alert_main_borders(FALSE); if (height == 1) { @@ -171,6 +176,8 @@ curses_block(boolean noscroll) } wrefresh(win); } + if (rp) + ret = trans[(rp - resp)]; return ret; } From 2829e3f78003bc554d435dd473693b1326eee003 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 17 Nov 2018 21:29:41 -0500 Subject: [PATCH 06/14] Revert "more CR on windows" This reverts commit 83fb79b77597cc44658458872a81d406ae177487. --- win/curses/cursmesg.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index d54249dcd..67986bbbb 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -133,11 +133,9 @@ curses_message_win_puts(const char *message, boolean recursed) } #ifdef WIN32 -#define RESP " \n\033\r" /* space, enter, esc, cr */ -#define TRANS " \n\033\n" /* translated return value */ +#define XTRA_RESP "\r" #else -#define RESP " \n\033" /* space, enter, esc */ -#define TRANS " \n\033" +#define XTRA_RESP "" #endif int @@ -147,9 +145,8 @@ curses_block(boolean noscroll) { int height, width, ret; WINDOW *win = curses_get_nhwin(MESSAGE_WIN); - char *resp = RESP; - char *trans = TRANS; - char *rp = (char *) 0; + char *resp = " \n\033" XTRA_RESP; /* space, enter, esc */ + curses_get_window_size(MESSAGE_WIN, &height, &width); curses_toggle_color_attr(win, MORECOLOR, NONE, ON); mvwprintw(win, my, mx, iflags.msg_is_alert ? "" : ">>"); @@ -161,9 +158,7 @@ curses_block(boolean noscroll) /* msgtype=stop should require space/enter rather than * just any key, as we want to prevent YASD from * riding direction keys. */ - while (!iflags.msg_is_alert && - (ret = wgetch(win)) && ((rp = index(resp,(char)ret)) == 0)) - ; + while (!iflags.msg_is_alert && (ret = wgetch(win)) && !index(resp,(char)ret)); if (iflags.msg_is_alert) curses_alert_main_borders(FALSE); if (height == 1) { @@ -176,8 +171,6 @@ curses_block(boolean noscroll) } wrefresh(win); } - if (rp) - ret = trans[(rp - resp)]; return ret; } From 816a7dd87151525e0e6b71b6fd024fe25de24e6d Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 17 Nov 2018 21:30:01 -0500 Subject: [PATCH 07/14] Revert "curses port: accept return on Windows platform" This reverts commit ac367ef4cc2cbad036964402ba541f869e6c8dd9. --- win/curses/cursmesg.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 67986bbbb..9fc1d6442 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -132,11 +132,6 @@ curses_message_win_puts(const char *message, boolean recursed) wrefresh(win); } -#ifdef WIN32 -#define XTRA_RESP "\r" -#else -#define XTRA_RESP "" -#endif int curses_block(boolean noscroll) @@ -145,7 +140,8 @@ curses_block(boolean noscroll) { int height, width, ret; WINDOW *win = curses_get_nhwin(MESSAGE_WIN); - char *resp = " \n\033" XTRA_RESP; /* space, enter, esc */ + char *resp = " \n\033"; /* space, enter, esc */ + curses_get_window_size(MESSAGE_WIN, &height, &width); curses_toggle_color_attr(win, MORECOLOR, NONE, ON); From 6ba270563c70bd4273e19db50be976c7a2a73388 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 17 Nov 2018 23:56:31 -0800 Subject: [PATCH 08/14] Build curses if PDCurses is available. There are two ways to enable curses in the build. Either set the environment variable PDCURSES to a folder containing a PDCurses repository OR place the PDCurses folder alongside the NetHack source repository. --- win/win32/vs2017/NetHack.vcxproj | 46 ++++++++++++++------------------ win/win32/vs2017/dirs.props | 3 +++ 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/win/win32/vs2017/NetHack.vcxproj b/win/win32/vs2017/NetHack.vcxproj index 981bc1e45..e51474a65 100644 --- a/win/win32/vs2017/NetHack.vcxproj +++ b/win/win32/vs2017/NetHack.vcxproj @@ -16,18 +16,16 @@ $(BinDir) - - $(PDCURSES);$(IncludePath) - - - $(PDCURSES);$(IncludePath) - - - $(PDCURSES);$(IncludePath) - - - $(PDCURSES);$(IncludePath) - + + + $(PDCURSES);%(AdditionalIncludeDirectories) + CURSES_GRAPHICS;%(PreprocessorDefinitions) + + + $(PDCURSES)\bin\$(Platform)\$(Configuration)\ + PDCurses.lib;%(AdditionalDependencies) + + /Gs /Oi- %(AdditionalOptions) @@ -36,14 +34,10 @@ Speed true $(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);%(AdditionalIncludeDirectories) - TILES;WIN32CON;DLB;MSWIN_GRAPHICS;CURSES_GRAPHICS;_LIB;%(PreprocessorDefinitions) + 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;PDCurses.lib;%(AdditionalDependencies) - $(PDCURSES)\bin\$(Platform)\$(Configuration)\ - $(PDCURSES)\bin\$(Platform)\$(Configuration)\ - $(PDCURSES)\bin\$(Platform)\$(Configuration)\ - $(PDCURSES)\bin\$(Platform)\$(Configuration)\ + 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) @@ -170,14 +164,14 @@ - - - - - - - - + + + + + + + + diff --git a/win/win32/vs2017/dirs.props b/win/win32/vs2017/dirs.props index e1c36b8a1..0ebb31a25 100644 --- a/win/win32/vs2017/dirs.props +++ b/win/win32/vs2017/dirs.props @@ -22,4 +22,7 @@ $(ObjDir) $(RootDir)win\curses\ + + $(RootDir)..\PDCurses\ + From 9c4de50c9a67d005f89193ee008397c7bf0dcbc9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 18 Nov 2018 06:24:32 -0500 Subject: [PATCH 09/14] windows VS Makefile with curses and PDCurses --- sys/winnt/Makefile.msc | 103 +++++++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 20 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 7f908c637..c0773c035 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -32,11 +32,12 @@ #======================================================================================== # BUILD DECISIONS SECTION # -# There are currently only 3 decisions that you can choose to make, and none are -# required: +# There are currently only 4 decisions that you can choose to make, and none are +# absolutely required because defaults are in place: # 1. Where do you want your build to end up? # 2. Do you want debug information in the executable? # 3. Do you want to explicitly override auto-detection of a 32-bit or 64-bit target? +# 4. Do you want to include the optional curses port? # #----------------------------------------------------------------------------------------- #========================================================================================= @@ -64,15 +65,16 @@ DEBUGINFO = Y #--------------------------------------------------------------- # OPTIONAL - Curses window port support # -# 4. Uncomment these and set them appropriate if you want to +# 4. Uncomment these and set them appropriately if you want to # include curses port support alongside TTY support in your -# console binary. You'll have to set CURSESINCL to the location -# of your curses header (.h) files and CURSESDLL to the location -# of your pdcurses.dll. +# NetHack.exe binary. +# +# You'll have to set PDCURSES_H to the correct location of the +# PDCurses header (.h) files and PDCURSES_C to the location +# of your PDCurses C files. # ADD_CURSES=Y -CURSESINCL=..\..\pdcurses -CURSESLIB=..\..\pdcurses\wincon\pdcurses.lib +PDCURSES_TOP=..\..\pdcurses # #============================================================================== # This marks the end of the BUILD DECISIONS section. @@ -98,18 +100,20 @@ CURSESLIB=..\..\pdcurses\wincon\pdcurses.lib # Source directories. Makedefs hardcodes these, don't change them. # -INCL = ..\include # NetHack include files -DAT = ..\dat # NetHack data files -DOC = ..\doc # NetHack documentation files -UTIL = ..\util # Utility source -SRC = ..\src # Main source -SSYS = ..\sys\share # Shared system files -MSWSYS = ..\sys\winnt # mswin specific files -TTY = ..\win\tty # window port files (tty) -MSWIN = ..\win\win32 # window port files (win32) -CURSES = ..\win\curses # window port files (curses) -WSHR = ..\win\share # Tile support files +INCL = ..\include # NetHack include files +DAT = ..\dat # NetHack data files +DOC = ..\doc # NetHack documentation files +UTIL = ..\util # Utility source +SRC = ..\src # Main source +SSYS = ..\sys\share # Shared system files +MSWSYS = ..\sys\winnt # mswin specific files +TTY = ..\win\tty # window port files (tty) +MSWIN = ..\win\win32 # window port files (win32) +WCURSES = ..\win\curses # window port files (curses) +WSHR = ..\win\share # Tile support files +! IF ("$(ADD_CURSES)"=="Y") +PDCURSES = # # Object directory. # @@ -481,6 +485,38 @@ ALLOBJ = $(SOBJ) $(DLBOBJ) $(WOBJ) $(OBJS) $(VVOBJ) OPTIONS_FILE = $(DAT)\options +!IF "$(ADD_CURSES)" == "Y" +#========================================== +# PDCurses build macros +#========================================== +PDCURSES_CURSES_H = $(PDCURSES_TOP)\curses.h +PDCURSES_CURSPRIV_H = $(PDCURSES_TOP)\curspriv.h +PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) +PANEL_HEADER = $(PDCURSES_TOP)\panel.h +TERM_HEADER = $(PDCURSES_TOP)\term.h +PDCSRC = $(PDCURSES_TOP)\wincon + +PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \ + $(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \ + $(O)deprec.o $(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \ + $(O)initscr.o $(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o \ + $(O)keyname.o $(O)mouse.o $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o \ + $(O)panel.o $(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \ + $(O)slk.o $(O)termattr.o $(O)terminfo.o $(O)touch.o $(O)util.o $(O)window.o \ + $(O)debug.o + +PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \ + $(O)pdcsetsc.o $(O)pdcutil.o +PDCOSDIR = $(PDCURSES_SRCDIR)/wincon + +PDCURSES_WIN_H = $(PDCOSDIR)/pdcwin.h + +PDCLIB = $(O)\pdcurses.lib + +!ELSE +PDCLIB = +!ENDIF + #========================================== # Header file macros #========================================== @@ -602,6 +638,16 @@ DATABASE = $(DAT)\data.base {$(MSWIN)}.c{$(OBJ)}.o: @$(cc) $(cflagsBuild) -Fo$@ $< +#========================================== +# Rules for files in PDCurses +#========================================== + +{$(PDCURSES_TOP)}.c{$(OBJ)}.o: + @$(cc) $(cflagsBuild) -Fo$@ $< + +{$(PDCSRC)}.c{$(OBJ)}.o: + @$(cc) $(cflagsBuild) -Fo$@ $< + #========================================== #=============== TARGETS ================== #========================================== @@ -757,7 +803,7 @@ $(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(O)tile.o $(O)nttty.o $(O)guistub.o \ @if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR) @echo Linking $(@:\=/) $(link) $(lflagsBuild) $(conlflags) /STACK:2048 /PDB:$(GAMEDIR)\$(@B).PDB /MAP:$(O)$(@B).MAP \ - $(LIBS) $(conlibs) -out:$@ @<<$(@B).lnk + $(PDCLIB) $(LIBS) $(conlibs) -out:$@ @<<$(@B).lnk $(GAMEOBJ) $(TTYOBJ) $(O)nttty.o @@ -1213,6 +1259,12 @@ $(O)tile2bmp.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\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 +#========================================== +# PDCurses +#========================================== + +$(PDCLIB) : $(PDCLIBOBJS) + #========================================== # Housekeeping #========================================== @@ -1428,6 +1480,17 @@ $(O)panic.o: $(U)panic.c $(CONFIG_H) (O)cppregex.o: $(O)cppregex.cpp $(HACK_H) @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\cppregex.cpp +# +# curses window port dependencies +# +$(O)\cursdial.o: $(WCURSES)\cursdial.c $(WCURSES)\cursdial.h $(INCL)\wincurs.h +$(O)\cursinit.c: $(WCURSES)\cursinit.c $(WCURSES)\cursinit.h $(INCL)\wincurs.h +$(O)\cursinvt.c: $(WCURSES)\cursinvt.c $(WCURSES)\cursinvt.h $(INCL)\wincurs.h +$(O)\cursmain.c: $(WCURSES)\cursmain.c $(WCURSES)\cursmain.h $(INCL)\wincurs.h +$(O)\cursmesg.c: $(WCURSES)\cursmesg.c $(WCURSES)\cursmesg.h $(INCL)\wincurs.h +$(O)\cursmisc.c: $(WCURSES)\cursmisc.c $(WCURSES)\cursmisc.h $(INCL)\wincurs.h +$(O)\cursstat.c: $(WCURSES)\cursstat.c $(WCURSES)\cursstat.h $(INCL)\wincurs.h +$(O)\curswins.c: $(WCURSES)\curswins.c $(WCURSES)\curswins.h $(INCL)\wincurs.h # # The rest are stolen from sys/unix/Makefile.src, # with the following changes: From bbe7029e773d5637dd2facaddb2d3ff9095497e8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 18 Nov 2018 06:48:47 -0500 Subject: [PATCH 10/14] more curses Makfile mods --- sys/winnt/Makefile.msc | 273 ++++++++++++++++++++--------------------- 1 file changed, 136 insertions(+), 137 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index c0773c035..49b1aa590 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -112,8 +112,6 @@ MSWIN = ..\win\win32 # window port files (win32) WCURSES = ..\win\curses # window port files (curses) WSHR = ..\win\share # Tile support files -! IF ("$(ADD_CURSES)"=="Y") -PDCURSES = # # Object directory. # @@ -219,17 +217,6 @@ VSVER=2999 #untested future version !include ! ENDIF -#---------------------------------------------------------------- - -!IF "$(ADD_CURSES)" == "Y" -#CURSESDEF=-D"PDC_DLL_BUILD" -D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" -CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" -!ELSE -CURSDEF= -CURSESLIB= -CURSESINCL= -!ENDIF - #These will be in the environment variables with one of the VS2017 #developer command prompts. #VSCMD_ARG_HOST_ARCH=x64 @@ -259,100 +246,6 @@ CL_RECENT=-sdl ! ENDIF !ENDIF -ccommon= -c -nologo -D"_CONSOLE" -D"_CRT_NONSTDC_NO_DEPRECATE" -D"_CRT_SECURE_NO_DEPRECATE" \ - -D"_LIB" -D"_SCL_SECURE_NO_DEPRECATE" -D"_VC80_UPGRADE=0x0600" -D"DLB" -D"_MBCS" \ - -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" $(CURSESDEF) \ - -EHsc -fp:precise -Gd -GF -GS -Gy \ - $(CL_RECENT) -WX- -Zc:forScope -Zc:wchar_t -Zi -cdebug= -analyze- -D"_DEBUG" -Gm -MTd -RTC1 -Od -crelease= -analyze- -D"_MBCS" -errorReport:prompt -Gm- -MT -O2 -Ot -Ox -Oy - -lcommon= /NOLOGO /INCREMENTAL:NO - -!IF "$(DEBUGINFO)" == "Y" -ldebug = /DEBUG -cflags1=$(ccommon) $(cdebug) -lflags1=$(lcommon) $(ldebug) -!ELSE -ldebug= /DEBUG -cflags1=$(ccommon) $(crelease) -lflags1=$(lcommon) $(ldebug) -!ENDIF - -lflags= $(lflags1) - -!IF "$(TARGET_CPU)" == "x86" -cflags = $(cflags1) -D_X86_=1 -DWIN32 -D_WIN32 -W3 -scall = -Gz - -!ELSEIF "$(TARGET_CPU)" == "x64" -cflags = $(cflags1) -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -scall = -!ENDIF - -!IF ($(VSVER) >= 2012) -cflags = $(cflags:-W4=-W3) -!ENDIF - -#More verbose warning output options below -#cflags = $(cflags:-W4=-wd4131 -#cflags = $(cflags:-W4=-Wall) -#cflags = $(cflags:-W3=-wd4131 -#cflags = $(cflags:-W3=-Wall) - -# declarations for use on Intel x86 systems -!IF "$(TARGET_CPU)" == "x86" -DLLENTRY = @12 -EXEVER=5.01 -MACHINE=/MACHINE:X86 -!ENDIF - -# declarations for use on AMD64 systems -!IF "$(TARGET_CPU)" == "x64" -DLLENTRY = -EXEVER=5.02 -MACHINE=/MACHINE:X64 -!ENDIF - -# for Windows applications -conlflags = $(lflags) -subsystem:console,$(EXEVER) -guilflags = $(lflags) -subsystem:windows,$(EXEVER) -dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll - -# basic subsystem specific libraries, less the C Run-Time -baselibs = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib gdi32.lib -winlibs = $(baselibs) user32.lib comdlg32.lib winspool.lib - -# for Windows applications that use the C Run-Time libraries -conlibs = $(baselibs) -guilibs = $(winlibs) -# - -!IFNDEF ADD_CURSES -INCLDIR= /I..\include /I..\sys\winnt -!ELSE -INCLDIR= /I..\include /I..\sys\winnt /I$(CURSESINCL) -!ENDIF - - -#========================================== -# Util builds -#========================================== - -cflagsBuild = $(cflags) $(INCLDIR) $(WINPFLAG) $(DLBFLG) -lflagsBuild = $(lflags) $(conlibs) $(MACHINE) - -#========================================== -# - Game build -#========================================== - -LIBS= user32.lib winmm.lib $(ZLIB) $(CURSESLIB) - -! IF ("$(USE_DLB)"=="Y") -DLB = nhdat -! ELSE -DLB = -! ENDIF #========================================== #================ MACROS ================== @@ -492,10 +385,8 @@ OPTIONS_FILE = $(DAT)\options PDCURSES_CURSES_H = $(PDCURSES_TOP)\curses.h PDCURSES_CURSPRIV_H = $(PDCURSES_TOP)\curspriv.h PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) -PANEL_HEADER = $(PDCURSES_TOP)\panel.h -TERM_HEADER = $(PDCURSES_TOP)\term.h -PDCSRC = $(PDCURSES_TOP)\wincon - +PDCSRC = $(PDCURSES_TOP)\pdcurses +PDCWINCON = $(PDCURSES_TOP)\wincon PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \ $(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \ $(O)deprec.o $(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \ @@ -507,12 +398,11 @@ PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \ $(O)pdcsetsc.o $(O)pdcutil.o -PDCOSDIR = $(PDCURSES_SRCDIR)/wincon - -PDCURSES_WIN_H = $(PDCOSDIR)/pdcwin.h PDCLIB = $(O)\pdcurses.lib +PDCINCL = /I$(PDCURSES_TOP) /I$(PDCSRC) /I$(PDCURSES_TOP)\pdcurses + !ELSE PDCLIB = !ENDIF @@ -554,6 +444,114 @@ TILE_H = ..\win\share\tile.h DATABASE = $(DAT)\data.base +#========================================== +# More compiler setup post-macros +#========================================== +#---------------------------------------------------------------- + +!IF "$(ADD_CURSES)" == "Y" +#CURSESDEF=-D"PDC_DLL_BUILD" -D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" +CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" +!ELSE +CURSDEF= +CURSESLIB= +CURSESINCL= +!ENDIF + +ccommon= -c -nologo -D"_CONSOLE" -D"_CRT_NONSTDC_NO_DEPRECATE" -D"_CRT_SECURE_NO_DEPRECATE" \ + -D"_LIB" -D"_SCL_SECURE_NO_DEPRECATE" -D"_VC80_UPGRADE=0x0600" -D"DLB" -D"_MBCS" \ + -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" $(CURSESDEF) \ + -EHsc -fp:precise -Gd -GF -GS -Gy \ + $(CL_RECENT) -WX- -Zc:forScope -Zc:wchar_t -Zi +cdebug= -analyze- -D"_DEBUG" -Gm -MTd -RTC1 -Od +crelease= -analyze- -D"_MBCS" -errorReport:prompt -Gm- -MT -O2 -Ot -Ox -Oy + +lcommon= /NOLOGO /INCREMENTAL:NO + +!IF "$(DEBUGINFO)" == "Y" +ldebug = /DEBUG +cflags1=$(ccommon) $(cdebug) +lflags1=$(lcommon) $(ldebug) +!ELSE +ldebug= /DEBUG +cflags1=$(ccommon) $(crelease) +lflags1=$(lcommon) $(ldebug) +!ENDIF + +lflags= $(lflags1) + +!IF "$(TARGET_CPU)" == "x86" +cflags = $(cflags1) -D_X86_=1 -DWIN32 -D_WIN32 -W3 +scall = -Gz + +!ELSEIF "$(TARGET_CPU)" == "x64" +cflags = $(cflags1) -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 +scall = +!ENDIF + +!IF ($(VSVER) >= 2012) +cflags = $(cflags:-W4=-W3) +!ENDIF + +#More verbose warning output options below +#cflags = $(cflags:-W4=-wd4131 +#cflags = $(cflags:-W4=-Wall) +#cflags = $(cflags:-W3=-wd4131 +#cflags = $(cflags:-W3=-Wall) + +# declarations for use on Intel x86 systems +!IF "$(TARGET_CPU)" == "x86" +DLLENTRY = @12 +EXEVER=5.01 +MACHINE=/MACHINE:X86 +!ENDIF + +# declarations for use on AMD64 systems +!IF "$(TARGET_CPU)" == "x64" +DLLENTRY = +EXEVER=5.02 +MACHINE=/MACHINE:X64 +!ENDIF + +# for Windows applications +conlflags = $(lflags) -subsystem:console,$(EXEVER) +guilflags = $(lflags) -subsystem:windows,$(EXEVER) +dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll + +# basic subsystem specific libraries, less the C Run-Time +baselibs = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib gdi32.lib +winlibs = $(baselibs) user32.lib comdlg32.lib winspool.lib + +# for Windows applications that use the C Run-Time libraries +conlibs = $(baselibs) +guilibs = $(winlibs) +# + +!IFNDEF ADD_CURSES +INCLDIR= /I..\include /I..\sys\winnt +!ELSE +INCLDIR= /I..\include /I..\sys\winnt /I$(CURSESINCL) +!ENDIF + +#========================================== +# Util builds +#========================================== + +cflagsBuild = $(cflags) $(INCLDIR) $(WINPFLAG) $(DLBFLG) +lflagsBuild = $(lflags) $(conlibs) $(MACHINE) + +#========================================== +# - Game build +#========================================== + +LIBS= user32.lib winmm.lib $(ZLIB) $(CURSESLIB) + +! IF ("$(USE_DLB)"=="Y") +DLB = nhdat +! ELSE +DLB = +! ENDIF + #========================================== #================ RULES ================== #========================================== @@ -597,19 +595,6 @@ DATABASE = $(DAT)\data.base {$(UTIL)}.c{$(OBJ)}.o: @$(cc) $(cflagsBuild) -Fo$@ $< -#========================================== -# Rules for files in win\curses -#========================================== - -{$(CURSES)}.c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< - -{$(CURSES)}.h{$(INCL)}.h: - @copy $< $@ - -#{$(CURSES)}.txt{$(DAT)}.txt: -# @copy $< $@ - #========================================== # Rules for files in win\share #========================================== @@ -638,15 +623,28 @@ DATABASE = $(DAT)\data.base {$(MSWIN)}.c{$(OBJ)}.o: @$(cc) $(cflagsBuild) -Fo$@ $< +#========================================== +# Rules for files in win\curses +#========================================== + +{$(WCURSES)}.c{$(OBJ)}.o: + @$(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $< + +#{$(WCURSES)}.txt{$(DAT)}.txt: +# @copy $< $@ + #========================================== # Rules for files in PDCurses #========================================== {$(PDCURSES_TOP)}.c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $< {$(PDCSRC)}.c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $< + +{$(PDCWINCON)}.c{$(OBJ)}.o: + @$(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $< #========================================== #=============== TARGETS ================== @@ -798,12 +796,12 @@ GAMEOBJ=$(GAMEOBJ:^ =^ # objs: $(GAMEOBJ) $(TTYOBJ) $(O)tile.o $(O)guistub.o -$(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(O)tile.o $(O)nttty.o $(O)guistub.o \ +$(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)guistub.o \ $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)console.res $(KEYDLLS) @if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR) @echo Linking $(@:\=/) $(link) $(lflagsBuild) $(conlflags) /STACK:2048 /PDB:$(GAMEDIR)\$(@B).PDB /MAP:$(O)$(@B).MAP \ - $(PDCLIB) $(LIBS) $(conlibs) -out:$@ @<<$(@B).lnk + $(LIBS) $(PDCLIB) $(conlibs) -out:$@ @<<$(@B).lnk $(GAMEOBJ) $(TTYOBJ) $(O)nttty.o @@ -826,7 +824,7 @@ $(GAMEDIR)\NetHackW.exe : $(O)gamedir.tag $(O)tile.o $(O)ttystub.o \ @if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR) @echo Linking $(@:\=/) $(link) $(lflagsBuild) $(guilflags) /STACK:2048 /PDB:$(GAMEDIR)\$(@B).PDB \ - /MAP:$(O)$(@B).MAP $(LIBS) $(guilibs) $(COMCTRL) -out:$@ @<<$(@B).lnk + /MAP:$(O)$(@B).MAP $(LIBS) $(PDCLIB) $(guilibs) $(COMCTRL) -out:$@ @<<$(@B).lnk $(GAMEOBJ) $(GUIOBJ) $(O)tile.o @@ -1263,7 +1261,8 @@ $(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h # PDCurses #========================================== -$(PDCLIB) : $(PDCLIBOBJS) +$(PDCLIB) : $(PDCLIBOBJS) $(PDCOBJS) + lib -nologo /out:$@ $(PDCLIBOBJS) $(PDCOBJS) #========================================== # Housekeeping @@ -1539,9 +1538,9 @@ $(O)topl.o: ..\win\tty\topl.c $(HACK_H) $(INCL)\tcap.h @$(CC) $(cflagsBuild) -Fo$@ ..\win\tty\topl.c $(O)wintty.o: ..\win\tty\wintty.c $(HACK_H) $(INCL)\dlb.h $(INCL)\tcap.h @$(CC) $(cflagsBuild) -Fo$@ ..\win\tty\wintty.c -$(O)Window.o: ..\win\X11\Window.c $(INCL)\xwindowp.h $(INCL)\xwindow.h \ - $(CONFIG_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\Window.c +#$(O)Window.o: ..\win\X11\Window.c $(INCL)\xwindowp.h $(INCL)\xwindow.h \ +# $(CONFIG_H) +# @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\Window.c $(O)dialogs.o: ..\win\X11\dialogs.c $(CONFIG_H) @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\dialogs.c $(O)winX.o: ..\win\X11\winX.c $(HACK_H) $(INCL)\winX.h $(INCL)\dlb.h \ @@ -1739,7 +1738,7 @@ $(O)vision.o: vision.c $(HACK_H) $(INCL)\vis_tab.h $(O)weapon.o: weapon.c $(HACK_H) $(O)were.o: were.c $(HACK_H) $(O)wield.o: wield.c $(HACK_H) -$(O)windows.o: windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h +#$(O)windows.o: windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h $(O)wizard.o: wizard.c $(HACK_H) $(INCL)\qtext.h $(O)worm.o: worm.c $(HACK_H) $(INCL)\lev.h $(O)worn.o: worn.c $(HACK_H) From 935fe5bca831f304e60b525ec03c3e46cb6c44e0 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 18 Nov 2018 06:57:17 -0500 Subject: [PATCH 11/14] Makefile macro correction --- sys/winnt/Makefile.msc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 49b1aa590..1f7f5fed6 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -401,7 +401,7 @@ PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o PDCLIB = $(O)\pdcurses.lib -PDCINCL = /I$(PDCURSES_TOP) /I$(PDCSRC) /I$(PDCURSES_TOP)\pdcurses +PDCINCL = /I$(PDCURSES_TOP) /I$(PDCSRC) /I$(PDCWINCON) !ELSE PDCLIB = @@ -1348,6 +1348,9 @@ spotless: clean if exist $(U)tilemap.exe del $(U)tilemap.exe if exist $(U)uudecode.exe del $(U)uudecode.exe if exist $(U)dlb_main.exe del $(U)dlb_main.exe +!IF "$(ADD_CURSES)" == "Y" + if exist $(U)pdcurses.lib del $(O)pdcurses.lib +!ENDIF clean: if exist $(O)*.o del $(O)*.o if exist $(O)utility.tag del $(O)utility.tag From bf0e0b9f1281152ee5e551f8da0bad37043430fb Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 18 Nov 2018 07:10:58 -0500 Subject: [PATCH 12/14] Makefile cut-and-paste error --- sys/winnt/Makefile.msc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 1f7f5fed6..28a7bae48 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -1349,7 +1349,7 @@ spotless: clean if exist $(U)uudecode.exe del $(U)uudecode.exe if exist $(U)dlb_main.exe del $(U)dlb_main.exe !IF "$(ADD_CURSES)" == "Y" - if exist $(U)pdcurses.lib del $(O)pdcurses.lib + if exist $(O)pdcurses.lib del $(O)pdcurses.lib !ENDIF clean: if exist $(O)*.o del $(O)*.o From 1b36af5d8aee7e501678ab64a6b725d825614cf1 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 18 Nov 2018 07:59:59 -0500 Subject: [PATCH 13/14] update Install.nt --- sys/winnt/Install.nt | 75 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/sys/winnt/Install.nt b/sys/winnt/Install.nt index 9d8fd01e0..91446103e 100644 --- a/sys/winnt/Install.nt +++ b/sys/winnt/Install.nt @@ -5,7 +5,7 @@ NetHack 3.6 on a Windows system (Windows 7/8.x/10 or later only. XP may work but is untested) ============================================================== - Last revision: $NHDT-Date: 1524317622 2018/04/21 13:33:42 $ + Last revision: $NHDT-Date: 1542545993 2018/11/18 12:59:53 $ Credit for the porting of NetHack to the Win32 Console Subsystem goes to the NT Porting Team started by Michael Allison. @@ -47,6 +47,10 @@ of NetHack you wish to run. The Visual Studio 2017 NetHack solution file can be found here: win\win32\vs2017\NetHack.sln +Before executing the steps to build listed in the next paragraph, +decide if you want to include optional curses window-port. See +the note just below entitled "Optional curses window-port support." + So the steps are: 1. Launch the IDE. 2. Open the appropriate solution file. @@ -60,6 +64,26 @@ 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 directory win\win32\vs2017 and run "build.bat". + + +Starting with 3.6.2, the community patch for a window-port that uses +curses was incorporated into the NetHack source code tree. That window-port, +which evolved from work originally done by Karl Garrison, has been used in +several NetHack variants and on nethack.alt.org and on +www.hardfought.org/nethack/. + +If you want to include the curses window-port support in your Visual Studio +build, you will have to first obtain the PDCurses sources from +https://github.com/wmcbrine/PDCurses +and have them available prior to building NetHack. There are two ways to +enable curses window-port support during the VS build: Either set the +environment variable PDCURSES to a folder containing a PDCurses +repository/source-tree + OR +Place the PDCurses folder alongside the NetHack source repository prior +to proceeding with steps 1 through 5 above. + + /-----------------------------------\ | Building Using Make | \-----------------------------------/ @@ -151,7 +175,26 @@ Setting Up source tree. cd src -2. Make sure all the NetHack files are in the appropriate directory +2. Starting with 3.6.2, the community patch for a window-port that uses + curses was incorporated into the NetHack source code tree. That + window-port, which evolved from work originally done by Karl Garrison, + has been used in several NetHack variants and on nethack.alt.org and + on www.hardfought.org/nethack/. + + If you want to include the optional curses window-port support in your + command line Makefile build, you will have to first obtain the + PDCurses sources from https://github.com/wmcbrine/PDCurses + and have that source code tree available prior to building NetHack. + Edit your Makefile and in Question 4 of the four decisions you can + make in there, uncomment these two lines: + ADD_CURSES=Y + PDCURSES_TOP=..\..\pdcurses + + Adjust the PDCURSES_TOP macro so that it points to the correct + location for the top of the PDCurses source tree if it differs from + the path shown. + +3. Make sure all the NetHack files are in the appropriate directory structure. You should have a main directory with subdirectories dat, doc, include, src, sys\share, sys\winnt, util, and binary (The "binary" directory was created by nhsetup.bat earlier if you @@ -164,26 +207,26 @@ Setting Up they are not necessary for building the TTY version for the Win32 console subsystem. You can delete them to save space. - Required Directories for a Win32 Console NetHack: + Required Directories for a Win32 Console NetHack build: - top - | - ----------------------------------------------------/ /----- - | | | | | | | | - util dat doc include src sys win binary - | | - ------ ----- - | | | - share winnt tty + top -------------(optional) ---------------- + | | + ------------------------------------------------- pdcurses-top + | | | | | | | | | + util dat doc include src sys win pdcurses wincon + | | + ------ ----- + | | | + share winnt tty Required Directories for a Win32 Graphical NetHack: top | - ----------------------------------------------------/ /----- - | | | | | | | | - util dat doc include src sys win binary + ------------------------------------------------- + | | | | | | | + util dat doc include src sys win | | ------ ----- | | | @@ -200,7 +243,7 @@ Setting Up trouble with them, so you may need to convert them. The compiler should not have any problems with them however. -3. Now go to the include subdirectory to check a couple of the header +4. Now go to the include subdirectory to check a couple of the header files there. Things *should* work as they are, but since you have probably set up your system in some sort of custom configuration it doesn't hurt to check out the following: From 60c3c2f1130bdaa27483524e0d22ec38faa1fc43 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 18 Nov 2018 08:34:24 -0500 Subject: [PATCH 14/14] fix a build error when curses is NOT enabled Fix an error when curses build macros are not defined makefile(1262) : fatal error U1083: target macro '$(PDCLIB)' expands to nothing --- sys/winnt/Makefile.msc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 28a7bae48..926eed8ad 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -73,8 +73,8 @@ DEBUGINFO = Y # PDCurses header (.h) files and PDCURSES_C to the location # of your PDCurses C files. # -ADD_CURSES=Y -PDCURSES_TOP=..\..\pdcurses +#ADD_CURSES=Y +#PDCURSES_TOP=..\..\pdcurses # #============================================================================== # This marks the end of the BUILD DECISIONS section. @@ -1261,7 +1261,7 @@ $(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h # PDCurses #========================================== -$(PDCLIB) : $(PDCLIBOBJS) $(PDCOBJS) +$(O)\pdcurses.lib : $(PDCLIBOBJS) $(PDCOBJS) lib -nologo /out:$@ $(PDCLIBOBJS) $(PDCOBJS) #==========================================