Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2
This commit is contained in:
@@ -196,6 +196,10 @@ avoid potential buffer overflow if object with very long name knocks other
|
|||||||
#wizintrinsic for 'warn_of_mon' didn't set any type of monster (now grid bugs)
|
#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
|
clairvoyance would show trap instead of a monster on/in that trap, which was
|
||||||
intentional, but when clairvoyance finished the monster wasn't shown
|
intentional, but when clairvoyance finished the monster wasn't shown
|
||||||
|
nurse corpse/tin chance to convey poison resistance when eaten was not honored
|
||||||
|
make tame vampires be more aggressive when shifted to bat/fog/wolf form
|
||||||
|
a stale gold symbol could be displayed on the status line following a switch
|
||||||
|
to a new symset, as observed and reported for Windows RogueEpyx symset
|
||||||
|
|
||||||
|
|
||||||
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
|
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
|
||||||
@@ -246,6 +250,10 @@ windows-tty: Fix memory leaks as reported in H5779
|
|||||||
windows-tty: Use nhraykey by default if the players keyboard layout is
|
windows-tty: Use nhraykey by default if the players keyboard layout is
|
||||||
non-english as reported in H4216
|
non-english as reported in H4216
|
||||||
windows-tty: We now support changing altkeyhandler in game
|
windows-tty: We now support changing altkeyhandler in game
|
||||||
|
windows-tty: augment codepage850-to-Unicode mappings that are not displayable
|
||||||
|
with codepage437-to-Unicode mappings that are, to help ensure
|
||||||
|
that rogue-level characters in the status line match their appearance
|
||||||
|
on the map
|
||||||
windows: Added ntassert() mechanism for Windows based port use
|
windows: Added ntassert() mechanism for Windows based port use
|
||||||
windows: heed OPTIONS=symset:default in config file if it is present
|
windows: heed OPTIONS=symset:default in config file if it is present
|
||||||
tty: significant optimizations for performance and per field rendering
|
tty: significant optimizations for performance and per field rendering
|
||||||
@@ -258,6 +266,8 @@ unix: Makefile.src and Makefile.utl inadvertently relied on a 'gnu make'
|
|||||||
verbose so doesn't use '$<' for multi-prerequisite targets unless
|
verbose so doesn't use '$<' for multi-prerequisite targets unless
|
||||||
specifically requested; use 'make QUIETCC=1 <target>' to get the
|
specifically requested; use 'make QUIETCC=1 <target>' to get the
|
||||||
3.6.1 behavior back
|
3.6.1 behavior back
|
||||||
|
vms: data file processing and playground setup were missing post-3.4.3 files
|
||||||
|
engrave, epitaph, and bogusmon made from corresponding *.txt
|
||||||
Qt: add Qt5 specific hints file for linux and Mac OS X (Ray Chason)
|
Qt: add Qt5 specific hints file for linux and Mac OS X (Ray Chason)
|
||||||
Qt: enable compiling Qt5 on Windows (Ray Chason)
|
Qt: enable compiling Qt5 on Windows (Ray Chason)
|
||||||
Qt: entering extended commands, hide non-matching ones
|
Qt: entering extended commands, hide non-matching ones
|
||||||
@@ -304,3 +314,5 @@ for ^X and enlightenment, display the information in a menu rather than a
|
|||||||
|
|
||||||
Code Cleanup and Reorganization
|
Code Cleanup and Reorganization
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
generated source file monstr.c is no longer used
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -424,7 +424,11 @@ E struct plinemsg_type *plinemsg_types;
|
|||||||
E const char *ARGV0;
|
E const char *ARGV0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum earlyarg {ARG_DEBUG, ARG_VERSION};
|
enum earlyarg {ARG_DEBUG, ARG_VERSION
|
||||||
|
#ifdef WIN32
|
||||||
|
,ARG_WINDOWS
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
struct early_opt {
|
struct early_opt {
|
||||||
enum earlyarg e;
|
enum earlyarg e;
|
||||||
|
|||||||
@@ -755,8 +755,15 @@ const char *msg;
|
|||||||
static struct early_opt earlyopts[] = {
|
static struct early_opt earlyopts[] = {
|
||||||
{ARG_DEBUG, "debug", 5, TRUE},
|
{ARG_DEBUG, "debug", 5, TRUE},
|
||||||
{ARG_VERSION, "version", 4, TRUE},
|
{ARG_VERSION, "version", 4, TRUE},
|
||||||
|
#ifdef WIN32
|
||||||
|
{ARG_WINDOWS, "windows", 4, TRUE},
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
extern int FDECL(windows_early_options, (const char *));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 = no match
|
* 0 = no match
|
||||||
@@ -826,6 +833,14 @@ enum earlyarg e_arg;
|
|||||||
early_version_info(insert_into_pastebuf);
|
early_version_info(insert_into_pastebuf);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
#ifdef WIN32
|
||||||
|
case ARG_WINDOWS: {
|
||||||
|
if (extended_opt) {
|
||||||
|
extended_opt++;
|
||||||
|
return windows_early_options(extended_opt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-3
@@ -698,6 +698,7 @@ int fld, idx, idx_p;
|
|||||||
boolean *valsetlist;
|
boolean *valsetlist;
|
||||||
{
|
{
|
||||||
static int oldrndencode = 0;
|
static int oldrndencode = 0;
|
||||||
|
static nhsym oldgoldsym = 0;
|
||||||
int pc, chg, color = NO_COLOR;
|
int pc, chg, color = NO_COLOR;
|
||||||
unsigned anytype;
|
unsigned anytype;
|
||||||
boolean updated = FALSE, reset;
|
boolean updated = FALSE, reset;
|
||||||
@@ -719,10 +720,28 @@ boolean *valsetlist;
|
|||||||
* so $:0 has already been encoded and cached by the window
|
* so $:0 has already been encoded and cached by the window
|
||||||
* port. Without this hack, gold's \G sequence won't be
|
* port. Without this hack, gold's \G sequence won't be
|
||||||
* recognized and ends up being displayed as-is for 'update_all'.
|
* recognized and ends up being displayed as-is for 'update_all'.
|
||||||
|
*
|
||||||
|
* Also, even if context.rndencode hasn't changed and the
|
||||||
|
* gold amount itself hasn't changed, the glyph portion of the
|
||||||
|
* encoding may have changed if a new symset was put into
|
||||||
|
* effect.
|
||||||
|
*
|
||||||
|
* \GXXXXNNNN:25
|
||||||
|
* XXXX = the context.rndencode portion
|
||||||
|
* NNNN = the glyph portion
|
||||||
|
* 25 = the gold amount
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
if (context.rndencode != oldrndencode && fld == BL_GOLD) {
|
|
||||||
chg = 2;
|
if (fld == BL_GOLD) {
|
||||||
oldrndencode = context.rndencode;
|
if (context.rndencode != oldrndencode) {
|
||||||
|
chg = 2;
|
||||||
|
oldrndencode = context.rndencode;
|
||||||
|
}
|
||||||
|
if (oldgoldsym != showsyms[COIN_CLASS + SYM_OFF_O]) {
|
||||||
|
chg = 2;
|
||||||
|
oldgoldsym = showsyms[COIN_CLASS + SYM_OFF_O];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reset = FALSE;
|
reset = FALSE;
|
||||||
|
|||||||
+19
-2
@@ -721,6 +721,7 @@ struct monst *mtmp, *mtarg;
|
|||||||
/* Give 1 in 3 chance of safe breathing even if pet is confused or
|
/* Give 1 in 3 chance of safe breathing even if pet is confused or
|
||||||
* if you're on the quest start level */
|
* if you're on the quest start level */
|
||||||
if (!mtmp->mconf || !rn2(3) || Is_qstart(&u.uz)) {
|
if (!mtmp->mconf || !rn2(3) || Is_qstart(&u.uz)) {
|
||||||
|
int mtmp_lev;
|
||||||
aligntyp align1 = A_NONE, align2 = A_NONE; /* For priests, minions */
|
aligntyp align1 = A_NONE, align2 = A_NONE; /* For priests, minions */
|
||||||
boolean faith1 = TRUE, faith2 = TRUE;
|
boolean faith1 = TRUE, faith2 = TRUE;
|
||||||
|
|
||||||
@@ -774,10 +775,26 @@ struct monst *mtmp, *mtarg;
|
|||||||
|| (mtmp->m_lev > 12 && mtarg->m_lev < mtmp->m_lev - 9
|
|| (mtmp->m_lev > 12 && mtarg->m_lev < mtmp->m_lev - 9
|
||||||
&& u.ulevel > 8 && mtarg->m_lev < u.ulevel - 7))
|
&& u.ulevel > 8 && mtarg->m_lev < u.ulevel - 7))
|
||||||
score -= 25;
|
score -= 25;
|
||||||
|
/* for strength purposes, a vampshifter in weak form (vampire bat,
|
||||||
|
fog cloud, maybe wolf) will attack as if in vampire form;
|
||||||
|
otherwise if won't do much and usually wouldn't suffer enough
|
||||||
|
damage (from counterattacks) to switch back to vampire form;
|
||||||
|
make it be more aggressive by behaving as if stronger */
|
||||||
|
mtmp_lev = mtmp->m_lev;
|
||||||
|
if (is_vampshifter(mtmp) && mtmp->data->mlet != S_VAMPIRE) {
|
||||||
|
/* is_vampshifter() implies (mtmp->cham >= LOW_PM) */
|
||||||
|
mtmp_lev = mons[mtmp->cham].mlevel;
|
||||||
|
/* actual vampire level would range from 1.0*mlvl to 1.5*mlvl */
|
||||||
|
mtmp_lev += rn2(mtmp_lev / 2 + 1);
|
||||||
|
/* we don't expect actual level in weak form to exceed
|
||||||
|
base level of strong form, but handle that if it happens */
|
||||||
|
if (mtmp->m_lev > mtmp_lev)
|
||||||
|
mtmp_lev = mtmp->m_lev;
|
||||||
|
}
|
||||||
/* And pets will hesitate to attack vastly stronger foes.
|
/* And pets will hesitate to attack vastly stronger foes.
|
||||||
This penalty will be discarded if master's in trouble. */
|
This penalty will be discarded if master's in trouble. */
|
||||||
if (mtarg->m_lev > mtmp->m_lev + 4L)
|
if (mtarg->m_lev > mtmp_lev + 4L)
|
||||||
score -= (mtarg->m_lev - mtmp->m_lev) * 20L;
|
score -= (mtarg->m_lev - mtmp_lev) * 20L;
|
||||||
/* All things being the same, go for the beefiest monster. This
|
/* All things being the same, go for the beefiest monster. This
|
||||||
bonus should not be large enough to override the pet's aversion
|
bonus should not be large enough to override the pet's aversion
|
||||||
to attacking much stronger monsters. */
|
to attacking much stronger monsters. */
|
||||||
|
|||||||
@@ -943,10 +943,11 @@ register struct permonst *ptr;
|
|||||||
/* called after completely consuming a corpse */
|
/* called after completely consuming a corpse */
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
cpostfx(pm)
|
cpostfx(pm)
|
||||||
register int pm;
|
int pm;
|
||||||
{
|
{
|
||||||
register int tmp = 0;
|
int tmp = 0;
|
||||||
int catch_lycanthropy = NON_PM;
|
int catch_lycanthropy = NON_PM;
|
||||||
|
boolean check_intrinsics = FALSE;
|
||||||
|
|
||||||
/* in case `afternmv' didn't get called for previously mimicking
|
/* in case `afternmv' didn't get called for previously mimicking
|
||||||
gold, clean up now to avoid `eatmbuf' memory leak */
|
gold, clean up now to avoid `eatmbuf' memory leak */
|
||||||
@@ -958,6 +959,7 @@ register int pm;
|
|||||||
/* MRKR: "eye of newt" may give small magical energy boost */
|
/* MRKR: "eye of newt" may give small magical energy boost */
|
||||||
if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
|
if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
|
||||||
int old_uen = u.uen;
|
int old_uen = u.uen;
|
||||||
|
|
||||||
u.uen += rnd(3);
|
u.uen += rnd(3);
|
||||||
if (u.uen > u.uenmax) {
|
if (u.uen > u.uenmax) {
|
||||||
if (!rn2(3))
|
if (!rn2(3))
|
||||||
@@ -989,6 +991,7 @@ register int pm;
|
|||||||
u.uhp = u.uhpmax;
|
u.uhp = u.uhpmax;
|
||||||
make_blinded(0L, !u.ucreamed);
|
make_blinded(0L, !u.ucreamed);
|
||||||
context.botl = 1;
|
context.botl = 1;
|
||||||
|
check_intrinsics = TRUE; /* might also convey poison resistance */
|
||||||
break;
|
break;
|
||||||
case PM_STALKER:
|
case PM_STALKER:
|
||||||
if (!Invis) {
|
if (!Invis) {
|
||||||
@@ -1090,7 +1093,13 @@ register int pm;
|
|||||||
pline("For some reason, that tasted bland.");
|
pline("For some reason, that tasted bland.");
|
||||||
}
|
}
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
default: {
|
default:
|
||||||
|
check_intrinsics = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* possibly convey an intrinsic */
|
||||||
|
if (check_intrinsics) {
|
||||||
struct permonst *ptr = &mons[pm];
|
struct permonst *ptr = &mons[pm];
|
||||||
boolean conveys_STR = is_giant(ptr);
|
boolean conveys_STR = is_giant(ptr);
|
||||||
int i, count;
|
int i, count;
|
||||||
@@ -1137,9 +1146,7 @@ register int pm;
|
|||||||
gainstr((struct obj *) 0, 0, TRUE);
|
gainstr((struct obj *) 0, 0, TRUE);
|
||||||
else if (tmp > 0)
|
else if (tmp > 0)
|
||||||
givit(tmp, ptr);
|
givit(tmp, ptr);
|
||||||
break;
|
} /* check_intrinsics */
|
||||||
} /* default case */
|
|
||||||
} /* switch */
|
|
||||||
|
|
||||||
if (catch_lycanthropy >= LOW_PM) {
|
if (catch_lycanthropy >= LOW_PM) {
|
||||||
set_ulycn(catch_lycanthropy);
|
set_ulycn(catch_lycanthropy);
|
||||||
|
|||||||
+25
-6
@@ -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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* 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_rumors, (dlb *));
|
||||||
STATIC_DCL void FDECL(init_oracles, (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 */
|
/* rumor size variables are signed so that value -1 can be used as a flag */
|
||||||
static long true_rumor_size = 0L, false_rumor_size;
|
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 */
|
else if (!in_mklev) /* avoid exercizing wisdom for graffiti */
|
||||||
exercise(A_WIS, (adjtruth > 0));
|
exercise(A_WIS, (adjtruth > 0));
|
||||||
} else {
|
} else {
|
||||||
pline("Can't open rumors file!");
|
couldnt_open_file(RUMORFILE);
|
||||||
true_rumor_size = -1; /* don't try to open it again */
|
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
|
/* 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);
|
display_nhwindow(tmpwin, TRUE);
|
||||||
destroy_nhwindow(tmpwin);
|
destroy_nhwindow(tmpwin);
|
||||||
} else {
|
} else {
|
||||||
impossible("Can't open rumors file!");
|
couldnt_open_file(RUMORFILE);
|
||||||
true_rumor_size = -1; /* don't try to open it again */
|
true_rumor_size = -1; /* don't try to open it again */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -314,8 +315,10 @@ char *buf;
|
|||||||
*endp = 0;
|
*endp = 0;
|
||||||
Strcat(buf, xcrypt(line, xbuf));
|
Strcat(buf, xcrypt(line, xbuf));
|
||||||
(void) dlb_fclose(fh);
|
(void) dlb_fclose(fh);
|
||||||
} else
|
} else {
|
||||||
impossible("Can't open file %s!", fname);
|
couldnt_open_file(fname);
|
||||||
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +472,7 @@ boolean delphi;
|
|||||||
destroy_nhwindow(tmpwin);
|
destroy_nhwindow(tmpwin);
|
||||||
(void) dlb_fclose(oracles);
|
(void) dlb_fclose(oracles);
|
||||||
} else {
|
} else {
|
||||||
pline("Can't open oracles file!");
|
couldnt_open_file(ORACLEFILE);
|
||||||
oracle_flg = -1; /* don't try to open it again */
|
oracle_flg = -1; /* don't try to open it again */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -547,4 +550,20 @@ struct monst *oracl;
|
|||||||
return 1;
|
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*/
|
/*rumors.c*/
|
||||||
|
|||||||
@@ -345,6 +345,13 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
if (argcheck(argc, argv, ARG_WINDOWS) == 1) {
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
|
if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
|
||||||
/* avoid matching "-dec" for DECgraphics; since the man page
|
/* avoid matching "-dec" for DECgraphics; since the man page
|
||||||
* says -d directory, hope nobody's using -desomething_else
|
* says -d directory, hope nobody's using -desomething_else
|
||||||
|
|||||||
+13
-3
@@ -1,5 +1,5 @@
|
|||||||
# NetHack Makefile (VMS) - data files: special levels and other data.
|
# NetHack Makefile (VMS) - data files: special levels and other data.
|
||||||
# NetHack 3.6 Makefile.dat $NHDT-Date: 1524689428 2018/04/25 20:50:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.9 $
|
# NetHack 3.6 Makefile.dat $NHDT-Date: 1542388601 2018/11/16 17:16:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.10 $
|
||||||
# Copyright (c) 2015 by Mike Stephenson
|
# Copyright (c) 2015 by Mike Stephenson
|
||||||
# NetHack may be freely redistributed. See license for details.
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
@@ -26,10 +26,11 @@ UTILMARKER = $(UTL)util.timestamp;
|
|||||||
|
|
||||||
# note: filespecs have enough punctuation to satisfy DELETE
|
# note: filespecs have enough punctuation to satisfy DELETE
|
||||||
MARKERS = spec_levs.timestamp;,quest_levs.timestamp;
|
MARKERS = spec_levs.timestamp;,quest_levs.timestamp;
|
||||||
VARDAT = data.;,rumors.;,quest.dat;,oracles.;,options.;
|
VARDAT = data.;,rumors.;,quest.dat;,oracles.;,options.;,\
|
||||||
|
engrave.;,epitaph.;,bogusmon.;
|
||||||
DUNGEON = dungeon.;
|
DUNGEON = dungeon.;
|
||||||
X11TILES= x11tiles.;
|
X11TILES= x11tiles.;
|
||||||
# note: the level lists need to be space separated
|
# note: the level lists need to be space separated for use as-is by $(LEVCOMP)
|
||||||
QUESTLEVS = Arch.des Barb.des Caveman.des Healer.des Knight.des \
|
QUESTLEVS = Arch.des Barb.des Caveman.des Healer.des Knight.des \
|
||||||
Monk.des Priest.des Ranger.des Rogue.des Samurai.des Tourist.des \
|
Monk.des Priest.des Ranger.des Rogue.des Samurai.des Tourist.des \
|
||||||
Valkyrie.des Wizard.des
|
Valkyrie.des Wizard.des
|
||||||
@@ -54,6 +55,12 @@ quest.dat : quest.dat;
|
|||||||
@ $(NOOP)
|
@ $(NOOP)
|
||||||
oracles : oracles.;
|
oracles : oracles.;
|
||||||
@ $(NOOP)
|
@ $(NOOP)
|
||||||
|
engrave : engrave.;
|
||||||
|
@ $(NOOP)
|
||||||
|
epitaph : epitaph.;
|
||||||
|
@ $(NOOP)
|
||||||
|
bogusmon : bogusmon.;
|
||||||
|
@ $(NOOP)
|
||||||
options : options.;
|
options : options.;
|
||||||
@ $(NOOP)
|
@ $(NOOP)
|
||||||
x11tiles : $(X11TILES)
|
x11tiles : $(X11TILES)
|
||||||
@@ -102,6 +109,9 @@ data.; : data.base $(MAKEDEFS)
|
|||||||
rumors.; : rumors.tru rumors.fal $(MAKEDEFS)
|
rumors.; : rumors.tru rumors.fal $(MAKEDEFS)
|
||||||
$(RUN) $(MAKEDEFS) -r
|
$(RUN) $(MAKEDEFS) -r
|
||||||
|
|
||||||
|
engrave.; epitaph.; bogusmon.; : engrave.txt epitaph.txt bogusmon.txt
|
||||||
|
$(RUN) $(MAKEDEFS) -s
|
||||||
|
|
||||||
quest.dat; : quest.txt $(MAKEDEFS)
|
quest.dat; : quest.txt $(MAKEDEFS)
|
||||||
$(RUN) $(MAKEDEFS) -q
|
$(RUN) $(MAKEDEFS) -q
|
||||||
|
|
||||||
|
|||||||
+15
-16
@@ -1,5 +1,5 @@
|
|||||||
# NetHack Makefile (VMS) - for building nethack itself.
|
# NetHack Makefile (VMS) - for building nethack itself.
|
||||||
# NetHack 3.6 Makefile.src $NHDT-Date: 1524689428 2018/04/25 20:50:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.29 $
|
# NetHack 3.6 Makefile.src $NHDT-Date: 1542388601 2018/11/16 17:16:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.31 $
|
||||||
# Copyright (c) 2011 by Robert Patrick Rankin
|
# Copyright (c) 2011 by Robert Patrick Rankin
|
||||||
# NetHack may be freely redistributed. See license for details.
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
@@ -113,19 +113,22 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
|
|||||||
botl.c cmd.c dbridge.c decl.c detect.c dig.c display.c dlb.c do.c \
|
botl.c cmd.c dbridge.c decl.c detect.c dig.c display.c dlb.c do.c \
|
||||||
do_name.c do_wear.c dog.c dogmove.c dokick.c dothrow.c drawing.c \
|
do_name.c do_wear.c dog.c dogmove.c dokick.c dothrow.c drawing.c \
|
||||||
dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \
|
dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \
|
||||||
files.c fountain.c hack.c hacklib.c invent.c light.c lock.c mail.c \
|
files.c fountain.c hack.c hacklib.c invent.c light.c lock.c \
|
||||||
makemon.c mapglyph.c mcastu.c mhitm.c mhitu.c minion.c mklev.c mkmap.c \
|
mail.c makemon.c mapglyph.c mcastu.c mhitm.c mhitu.c minion.c \
|
||||||
|
mklev.c mkmap.c \
|
||||||
mkmaze.c mkobj.c mkroom.c mon.c mondata.c monmove.c monst.c \
|
mkmaze.c mkobj.c mkroom.c mon.c mondata.c monmove.c monst.c \
|
||||||
mplayer.c mthrowu.c muse.c music.c o_init.c objects.c objnam.c \
|
mplayer.c mthrowu.c muse.c music.c o_init.c objects.c objnam.c \
|
||||||
options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \
|
options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \
|
||||||
priest.c quest.c questpgr.c read.c rect.c region.c restore.c rip.c rnd.c \
|
priest.c quest.c questpgr.c read.c rect.c region.c restore.c \
|
||||||
role.c rumors.c save.c shk.c shknam.c sit.c sounds.c sp_lev.c spell.c \
|
rip.c rnd.c role.c \
|
||||||
steal.c steed.c sys.c teleport.c timeout.c topten.c track.c trap.c \
|
rumors.c save.c shk.c shknam.c sit.c sounds.c sp_lev.c spell.c \
|
||||||
u_init.c uhitm.c vault.c version.c vision.c weapon.c were.c wield.c \
|
steal.c steed.c sys.c teleport.c timeout.c topten.c track.c \
|
||||||
|
trap.c u_init.c \
|
||||||
|
uhitm.c vault.c version.c vision.c weapon.c were.c wield.c \
|
||||||
windows.c wizard.c worm.c worn.c write.c zap.c
|
windows.c wizard.c worm.c worn.c write.c zap.c
|
||||||
|
|
||||||
# generated source files (tile.c is handled separately via WINxxxSRC)
|
# generated source files (tile.c is handled separately via WINxxxSRC)
|
||||||
GENCSRC = monstr.c vis_tab.c #tile.c
|
GENCSRC = vis_tab.c #tile.c
|
||||||
|
|
||||||
# .c files for this version (for date.h)
|
# .c files for this version (for date.h)
|
||||||
VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(RANDSRC) $(GENCSRC)
|
VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(RANDSRC) $(GENCSRC)
|
||||||
@@ -159,7 +162,7 @@ HOBJ2 = dog.obj,dogmove.obj,dokick.obj,dothrow.obj,drawing.obj, \
|
|||||||
extralev.obj,files.obj,fountain.obj,hack.obj,hacklib.obj,invent.obj
|
extralev.obj,files.obj,fountain.obj,hack.obj,hacklib.obj,invent.obj
|
||||||
HOBJ3 = light.obj,lock.obj,mail.obj,makemon.obj,mapglyph.obj,mcastu.obj, \
|
HOBJ3 = light.obj,lock.obj,mail.obj,makemon.obj,mapglyph.obj,mcastu.obj, \
|
||||||
mhitm.obj,mhitu.obj,minion.obj,mklev.obj,mkmap.obj,mkmaze.obj, \
|
mhitm.obj,mhitu.obj,minion.obj,mklev.obj,mkmap.obj,mkmaze.obj, \
|
||||||
mkobj.obj,mkroom.obj,mon.obj,mondata.obj,monmove.obj,monstr.obj
|
mkobj.obj,mkroom.obj,mon.obj,mondata.obj,monmove.obj
|
||||||
HOBJ4 = mplayer.obj,mthrowu.obj,muse.obj,music.obj,o_init.obj,objnam.obj, \
|
HOBJ4 = mplayer.obj,mthrowu.obj,muse.obj,music.obj,o_init.obj,objnam.obj, \
|
||||||
options.obj,pager.obj,pickup.obj,pline.obj,polyself.obj, \
|
options.obj,pager.obj,pickup.obj,pline.obj,polyself.obj, \
|
||||||
potion.obj,pray.obj,priest.obj,quest.obj,questpgr.obj,read.obj
|
potion.obj,pray.obj,priest.obj,quest.obj,questpgr.obj,read.obj
|
||||||
@@ -260,10 +263,6 @@ $(INC)pm.h : $(MAKEDEFS)
|
|||||||
$(CD) $(UTL)
|
$(CD) $(UTL)
|
||||||
$(MAKE)$(MAKEFLAGS) $(INC)pm.h
|
$(MAKE)$(MAKEFLAGS) $(INC)pm.h
|
||||||
@ $(CD) $(SRC)
|
@ $(CD) $(SRC)
|
||||||
monstr.c : $(MAKEDEFS)
|
|
||||||
$(CD) $(UTL)
|
|
||||||
$(MAKE)$(MAKEFLAGS) $(SRC)monstr.c
|
|
||||||
@ $(CD) $(SRC)
|
|
||||||
# both vis_tab.h and vis_tab.c are made at the same time by makedefs
|
# both vis_tab.h and vis_tab.c are made at the same time by makedefs
|
||||||
$(INC)vis_tab.h : vis_tab.c
|
$(INC)vis_tab.h : vis_tab.c
|
||||||
$(TOUCH) $(INC)vis_tab.h
|
$(TOUCH) $(INC)vis_tab.h
|
||||||
@@ -290,19 +289,20 @@ $(INC)date.h : $(VERSOURCES) $(HACK_H)
|
|||||||
$(MAKE)$(MAKEFLAGS) $(INC)date.h
|
$(MAKE)$(MAKEFLAGS) $(INC)date.h
|
||||||
@ $(CD) $(SRC)
|
@ $(CD) $(SRC)
|
||||||
|
|
||||||
# special targets
|
# special targets (monstr.c is an obsolete generated source file)
|
||||||
clean :
|
clean :
|
||||||
- if f$search("*.*;-2").nes."" then purge/Keep=2
|
- if f$search("*.*;-2").nes."" then purge/Keep=2
|
||||||
- if f$search("$(INC)*.*;-2").nes."" then purge/Keep=2 $(INC) /Exclude=*conf*.h
|
- if f$search("$(INC)*.*;-2").nes."" then purge/Keep=2 $(INC) /Exclude=*conf*.h
|
||||||
- if f$search("*.obj").nes."" then delete *.obj;*
|
- if f$search("*.obj").nes."" then delete *.obj;*
|
||||||
- if f$search("*.h-t").nes."" then delete *.h-t;* !$(HACK_H),$(CONFIG_H)
|
- if f$search("*.h-t").nes."" then delete *.h-t;* !$(HACK_H),$(CONFIG_H)
|
||||||
|
- if f$search("monstr.c").nes."" then delete monstr.c;*
|
||||||
|
|
||||||
spotless : clean
|
spotless : clean
|
||||||
- if f$search("*.*;-1).nes."" then purge
|
- if f$search("*.*;-1).nes."" then purge
|
||||||
- if f$search("$(INC)*.*;-1").nes."" then purge $(INC)
|
- if f$search("$(INC)*.*;-1").nes."" then purge $(INC)
|
||||||
- if f$search("$(SYSTEM)").nes."" then delete $(SYSTEM)
|
- if f$search("$(SYSTEM)").nes."" then delete $(SYSTEM)
|
||||||
- if f$search("$(GAME)").nes."" then delete $(GAME)
|
- if f$search("$(GAME)").nes."" then delete $(GAME)
|
||||||
- delete monstr.c;,vis_tab.c;,$(INC)vis_tab.h;,\
|
- delete vis_tab.c;,$(INC)vis_tab.h;,\
|
||||||
$(INC)pm.h;,$(INC)onames.h;,$(INC)date.h;
|
$(INC)pm.h;,$(INC)onames.h;,$(INC)date.h;
|
||||||
- if f$search("tile.c").nes."" then delete tile.c;
|
- if f$search("tile.c").nes."" then delete tile.c;
|
||||||
- if f$search("tclib.c").nes."" then delete tclib.c;
|
- if f$search("tclib.c").nes."" then delete tclib.c;
|
||||||
@@ -368,7 +368,6 @@ winstat.obj : $(X11)winstat.c $(HACK_H) $(INC)winX.h
|
|||||||
wintext.obj : $(X11)wintext.c $(HACK_H) $(INC)winX.h $(INC)xwindow.h
|
wintext.obj : $(X11)wintext.c $(HACK_H) $(INC)winX.h $(INC)xwindow.h
|
||||||
winval.obj : $(X11)winval.c $(HACK_H) $(INC)winX.h
|
winval.obj : $(X11)winval.c $(HACK_H) $(INC)winX.h
|
||||||
tile.obj : $(SRC)tile.c $(HACK_H)
|
tile.obj : $(SRC)tile.c $(HACK_H)
|
||||||
monstr.obj : monstr.c $(CONFIG_H)
|
|
||||||
vis_tab.obj : vis_tab.c $(CONFIG_H) $(INC)vis_tab.h
|
vis_tab.obj : vis_tab.c $(CONFIG_H) $(INC)vis_tab.h
|
||||||
# general code
|
# general code
|
||||||
allmain.obj : allmain.c $(HACK_H)
|
allmain.obj : allmain.c $(HACK_H)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# NetHack Makefile (VMS) - for utility programs.
|
# NetHack Makefile (VMS) - for utility programs.
|
||||||
# NetHack 3.6 Makefile.utl $NHDT-Date: 1524689428 2018/04/25 20:50:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.15 $
|
# NetHack 3.6 Makefile.utl $NHDT-Date: 1542388602 2018/11/16 17:16:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.16 $
|
||||||
# Copyright (c) 2011 by Robert Patrick Rankin
|
# Copyright (c) 2011 by Robert Patrick Rankin
|
||||||
# NetHack may be freely redistributed. See license for details.
|
# NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
@@ -173,8 +173,6 @@ $(INC)onames.h : $(MAKEDEFS)
|
|||||||
$(RUN) $(MAKEDEFS) -o
|
$(RUN) $(MAKEDEFS) -o
|
||||||
$(INC)pm.h : $(MAKEDEFS)
|
$(INC)pm.h : $(MAKEDEFS)
|
||||||
$(RUN) $(MAKEDEFS) -p
|
$(RUN) $(MAKEDEFS) -p
|
||||||
$(SRC)monstr.c : $(MAKEDEFS)
|
|
||||||
$(RUN) $(MAKEDEFS) -m
|
|
||||||
# both vis_tab.h and vis_tab.c are made at the same time by makedefs -z
|
# both vis_tab.h and vis_tab.c are made at the same time by makedefs -z
|
||||||
$(INC)vis_tab.h : $(SRC)vis_tab.c
|
$(INC)vis_tab.h : $(SRC)vis_tab.c
|
||||||
$(TOUCH) $(INC)vis_tab.h
|
$(TOUCH) $(INC)vis_tab.h
|
||||||
|
|||||||
+7
-4
@@ -1,9 +1,9 @@
|
|||||||
$ ! vms/install.com -- set up nethack 'playground'
|
$ ! vms/install.com -- set up nethack 'playground'
|
||||||
$! $NHDT-Date: 1524689428 2018/04/25 20:50:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $
|
$! $NHDT-Date: 1542388600 2018/11/16 17:16:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.11 $
|
||||||
$! Copyright (c) 2016 by Robert Patrick Rankin
|
$! Copyright (c) 2016 by Robert Patrick Rankin
|
||||||
$! NetHack may be freely redistributed. See license for details.
|
$! NetHack may be freely redistributed. See license for details.
|
||||||
$ !
|
$ !
|
||||||
$ ! $NHDT-Date: 1524689428 2018/04/25 20:50:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $
|
$ ! $NHDT-Date: 1542388600 2018/11/16 17:16:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.11 $
|
||||||
$ !
|
$ !
|
||||||
$ ! Use vmsbuild.com to create nethack.exe, makedefs, and lev_comp *first*.
|
$ ! Use vmsbuild.com to create nethack.exe, makedefs, and lev_comp *first*.
|
||||||
$ !
|
$ !
|
||||||
@@ -26,10 +26,11 @@ $ if p2.nes."" then gameuic := 'p2'
|
|||||||
$
|
$
|
||||||
$ ! note: all filespecs contain some punctuation,
|
$ ! note: all filespecs contain some punctuation,
|
||||||
$ ! to avoid inadvertent logical name interaction
|
$ ! to avoid inadvertent logical name interaction
|
||||||
$ play_files = "PERM.,RECORD.,LOGFILE.,PANICLOG."
|
$ play_files = "PERM.,RECORD.,LOGFILE.,XLOGFILE.,PANICLOG."
|
||||||
$ help_files = "HELP.,HH.,CMDHELP.,KEYHELP.,WIZHELP.,OPTHELP.," -
|
$ help_files = "HELP.,HH.,CMDHELP.,KEYHELP.,WIZHELP.,OPTHELP.," -
|
||||||
+ "HISTORY.,LICENSE."
|
+ "HISTORY.,LICENSE."
|
||||||
$ data_files = "DATA.,RUMORS.,ORACLES.,OPTIONS.,QUEST.DAT,TRIBUTE."
|
$ data_files = "DATA.,RUMORS.,ORACLES.,OPTIONS.,QUEST.DAT,TRIBUTE.," -
|
||||||
|
+ "ENGRAVE.,EPITAPH.,BOGUSMON."
|
||||||
$ sysconf_file = "[.sys.vms]sysconf"
|
$ sysconf_file = "[.sys.vms]sysconf"
|
||||||
$ guidebook = "[.doc]Guidebook.txt"
|
$ guidebook = "[.doc]Guidebook.txt"
|
||||||
$ invoc_proc = "[.sys.vms]nethack.com"
|
$ invoc_proc = "[.sys.vms]nethack.com"
|
||||||
@@ -88,6 +89,8 @@ $ makedefs -r !rumors.tru + rumors.fal -> rumors
|
|||||||
$ milestone "(oracles)"
|
$ milestone "(oracles)"
|
||||||
$ makedefs -h !oracles.txt -> oracles
|
$ makedefs -h !oracles.txt -> oracles
|
||||||
$ milestone "(dungeon preprocess)"
|
$ milestone "(dungeon preprocess)"
|
||||||
|
$ makedefs -s
|
||||||
|
$ milestone "(engrave, epitaph, bogusmon)"
|
||||||
$ makedefs -e !dungeon.def -> dungeon.pdf
|
$ makedefs -e !dungeon.def -> dungeon.pdf
|
||||||
$ milestone "(quest text)"
|
$ milestone "(quest text)"
|
||||||
$ makedefs -q !quest.txt -> quest.dat
|
$ makedefs -q !quest.txt -> quest.dat
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
$ ! vms/vmsbuild.com -- compile and link NetHack 3.6.* [pr]
|
$ ! vms/vmsbuild.com -- compile and link NetHack 3.6.* [pr]
|
||||||
$ version_number = "3.6.2"
|
$ version_number = "3.6.2"
|
||||||
$ ! $NHDT-Date: 1524689429 2018/04/25 20:50:29 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.17 $
|
$ ! $NHDT-Date: 1542411224 2018/11/16 23:33:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.19 $
|
||||||
# Copyright (c) 2018 by Robert Patrick Rankin
|
# Copyright (c) 2018 by Robert Patrick Rankin
|
||||||
# NetHack may be freely redistributed. See license for details.
|
# NetHack may be freely redistributed. See license for details.
|
||||||
$ !
|
$ !
|
||||||
@@ -251,7 +251,6 @@ $ makedefs -p !pm.h
|
|||||||
$ makedefs -o !onames.h
|
$ makedefs -o !onames.h
|
||||||
$ makedefs -v !date.h
|
$ makedefs -v !date.h
|
||||||
$ milestone " (*.h)"
|
$ milestone " (*.h)"
|
||||||
$ makedefs -m !../src/monstr.c
|
|
||||||
$ makedefs -z !../src/vis_tab.c, ../include/vis_tab.h
|
$ makedefs -z !../src/vis_tab.c, ../include/vis_tab.h
|
||||||
$ milestone " (*.c)"
|
$ milestone " (*.c)"
|
||||||
$ set default [-.src]
|
$ set default [-.src]
|
||||||
@@ -269,7 +268,7 @@ $ c_list = "allmain,apply,artifact,attrib,ball,bones,botl,cmd,dbridge,detect" -
|
|||||||
$ gosub compile_list
|
$ gosub compile_list
|
||||||
$ c_list = "hack,hacklib,invent,light,lock,mail,makemon,mapglyph,mcastu" -
|
$ c_list = "hack,hacklib,invent,light,lock,mail,makemon,mapglyph,mcastu" -
|
||||||
+ ",mhitm,mhitu,minion,mklev,mkmap,mkmaze,mkobj,mkroom,mon,mondata" -
|
+ ",mhitm,mhitu,minion,mklev,mkmap,mkmaze,mkobj,mkroom,mon,mondata" -
|
||||||
+ ",monmove,monstr,mplayer,mthrowu,muse,music,o_init,objnam,options" -
|
+ ",monmove,mplayer,mthrowu,muse,music,o_init,objnam,options" -
|
||||||
+ ",pager,pickup"
|
+ ",pager,pickup"
|
||||||
$ gosub compile_list
|
$ gosub compile_list
|
||||||
$ c_list = "pline,polyself,potion,pray,priest,quest,questpgr,read" -
|
$ c_list = "pline,polyself,potion,pray,priest,quest,questpgr,read" -
|
||||||
|
|||||||
+6
-2
@@ -571,8 +571,6 @@ char ch;
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// Temporary fix. Tty putstatusfield()
|
|
||||||
|
|
||||||
inverse = (console.current_nhattr[ATR_INVERSE] && iflags.wc_inverse);
|
inverse = (console.current_nhattr[ATR_INVERSE] && iflags.wc_inverse);
|
||||||
console.attr = (inverse) ?
|
console.attr = (inverse) ?
|
||||||
ttycolors_inv[console.current_nhcolor] :
|
ttycolors_inv[console.current_nhcolor] :
|
||||||
@@ -1666,6 +1664,12 @@ void set_cp_map()
|
|||||||
int count = MultiByteToWideChar(codePage, 0, &c, 1,
|
int count = MultiByteToWideChar(codePage, 0, &c, 1,
|
||||||
&console.cpMap[i], 1);
|
&console.cpMap[i], 1);
|
||||||
nhassert(count == 1);
|
nhassert(count == 1);
|
||||||
|
|
||||||
|
// If a character was mapped to unicode control codes,
|
||||||
|
// remap to the appropriate unicode character per our
|
||||||
|
// code page 437 mappings.
|
||||||
|
if (console.cpMap[i] < 32)
|
||||||
|
console.cpMap[i] = cp437[console.cpMap[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,3 +44,40 @@ void win10_init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void win10_monitor_size(HWND hWnd, int * width, int * height)
|
||||||
|
{
|
||||||
|
HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
|
||||||
|
MONITORINFO info;
|
||||||
|
info.cbSize = sizeof(MONITORINFO);
|
||||||
|
BOOL success = GetMonitorInfo(monitor, &info);
|
||||||
|
nhassert(success);
|
||||||
|
*width = info.rcMonitor.right - info.rcMonitor.left;
|
||||||
|
*height = info.rcMonitor.bottom - info.rcMonitor.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
int win10_monitor_dpi(HWND hWnd)
|
||||||
|
{
|
||||||
|
UINT monitorDpi = 96;
|
||||||
|
|
||||||
|
if (gWin10.Valid) {
|
||||||
|
monitorDpi = gWin10.GetDpiForWindow(hWnd);
|
||||||
|
if (monitorDpi == 0)
|
||||||
|
monitorDpi = 96;
|
||||||
|
}
|
||||||
|
|
||||||
|
monitorDpi = max(96, monitorDpi);
|
||||||
|
|
||||||
|
return monitorDpi;
|
||||||
|
}
|
||||||
|
|
||||||
|
double win10_monitor_scale(HWND hWnd)
|
||||||
|
{
|
||||||
|
return (double) win10_monitor_dpi(hWnd) / 96.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo)
|
||||||
|
{
|
||||||
|
monitorInfo->scale = win10_monitor_scale(hWnd);
|
||||||
|
win10_monitor_size(hWnd, &monitorInfo->width, &monitorInfo->height);
|
||||||
|
}
|
||||||
|
|||||||
+12
-1
@@ -19,8 +19,19 @@ typedef struct {
|
|||||||
GetDpiForWindowProc GetDpiForWindow;
|
GetDpiForWindowProc GetDpiForWindow;
|
||||||
} Win10;
|
} Win10;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
double scale; // dpi of monitor / 96
|
||||||
|
int width; // in pixels
|
||||||
|
int height; // in pixels
|
||||||
|
} MonitorInfo;
|
||||||
|
|
||||||
extern Win10 gWin10;
|
extern Win10 gWin10;
|
||||||
|
|
||||||
void win10_init();
|
void win10_init();
|
||||||
|
int win10_monitor_dpi(HWND hWnd);
|
||||||
|
double win10_monitor_scale(HWND hWnd);
|
||||||
|
void win10_monitor_size(HWND hWnd, int * width, int * height);
|
||||||
|
void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo);
|
||||||
|
|
||||||
#endif // WIN10_H
|
|
||||||
|
#endif // WIN10_H
|
||||||
|
|||||||
+24
-1
@@ -37,9 +37,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* runtime cursor display control switch */
|
||||||
|
boolean win32_cursorblink;
|
||||||
|
|
||||||
/* globals required within here */
|
/* globals required within here */
|
||||||
HANDLE ffhandle = (HANDLE) 0;
|
HANDLE ffhandle = (HANDLE) 0;
|
||||||
WIN32_FIND_DATA ffd;
|
WIN32_FIND_DATA ffd;
|
||||||
|
|
||||||
typedef HWND(WINAPI *GETCONSOLEWINDOW)();
|
typedef HWND(WINAPI *GETCONSOLEWINDOW)();
|
||||||
static HWND GetConsoleHandle(void);
|
static HWND GetConsoleHandle(void);
|
||||||
static HWND GetConsoleHwnd(void);
|
static HWND GetConsoleHwnd(void);
|
||||||
@@ -581,6 +585,25 @@ BOOL winos_font_support_cp437(HFONT hFont)
|
|||||||
return allFound;
|
return allFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
windows_early_options(window_opt)
|
||||||
|
const char *window_opt;
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* If you return 2, the game will exit before it begins.
|
||||||
|
* Return 1, to say the option parsed okay.
|
||||||
|
* Return 0, to say the option was bad.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (match_optname(window_opt, "cursorblink", 5, FALSE)) {
|
||||||
|
win32_cursorblink = TRUE;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
raw_printf(
|
||||||
|
"-%swindows:cursorblink is the only supported option.\n");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
/*winnt.c*/
|
/*winnt.c*/
|
||||||
|
|||||||
+38
-29
@@ -1,4 +1,4 @@
|
|||||||
! $NHDT-Date: 1524689294 2018/04/25 20:48:14 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.15 $
|
! $NHDT-Date: 1542244983 2018/11/15 01:23:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $
|
||||||
! Copyright (c) 2017 by Pasi Kallinen
|
! Copyright (c) 2017 by Pasi Kallinen
|
||||||
! NetHack may be freely redistributed. See license for details.
|
! NetHack may be freely redistributed. See license for details.
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ NetHack*text*borderWidth: 0
|
|||||||
!
|
!
|
||||||
NetHack.tile_file: x11tiles
|
NetHack.tile_file: x11tiles
|
||||||
!NetHack.double_tile_size: True
|
!NetHack.double_tile_size: True
|
||||||
!
|
|
||||||
! The annotation of pets.
|
! The annotation of pets.
|
||||||
!NetHack.pet_mark_bitmap: pet_mark.xbm
|
!NetHack.pet_mark_bitmap: pet_mark.xbm
|
||||||
!NetHack.pet_mark_color: Red
|
!NetHack.pet_mark_color: Red
|
||||||
@@ -57,30 +57,25 @@ NetHack.tile_file: x11tiles
|
|||||||
! The color to use for the text on the hero's tombstone
|
! The color to use for the text on the hero's tombstone
|
||||||
NetHack*rip*foreground: black
|
NetHack*rip*foreground: black
|
||||||
|
|
||||||
! Translation tables. There are currently several actions in nethack, but
|
|
||||||
! the only one you should be using is "input()", which, with no parameters,
|
|
||||||
! uses XLookupString to translate your keypress into a command. You
|
|
||||||
! can optionally give it parameters to change the behavior, see the example
|
|
||||||
! below. Note that you have to specify the translations in every appropriate
|
|
||||||
! window.
|
|
||||||
NetHack*message*translations: <KeyPress>: input()
|
|
||||||
!
|
|
||||||
! Example extra translations for the map window.
|
|
||||||
!
|
|
||||||
!NetHack*map*translations: #override \
|
|
||||||
! !<Key>Left: input(h) \n\
|
|
||||||
! !<Key>Right: input(l) \n\
|
|
||||||
! !<Key>Up: input(k) \n\
|
|
||||||
! !<Key>Down: input(j)
|
|
||||||
!
|
|
||||||
! The icon to use; supported values are nh72, nh56, and nh32; nh72 is the
|
! The icon to use; supported values are nh72, nh56, and nh32; nh72 is the
|
||||||
! default. Some window managers may not support the larger icon sizes.
|
! default. Some window managers may not support the larger icon sizes.
|
||||||
! It is not guaranteed that the window manager will honor the icon selection.
|
! It is not guaranteed that the window manager will honor the icon selection.
|
||||||
!NetHack*icon: nh56
|
!NetHack*icon: nh56
|
||||||
!
|
|
||||||
! If True, the default, a popup for single character prompts such as y/n
|
! If True, the default, a popup for single character prompts such as y/n
|
||||||
! questions is _not_ used.
|
! questions is _not_ used. Single-character prompts appear in a fixed
|
||||||
NetHack*slow: True
|
! position between the top of the map and the bottom of the messages.
|
||||||
|
! If False, popups appear near where the pointer is positioned so tend to
|
||||||
|
! meander around the screen depending upon where the last click ocurred.
|
||||||
|
! (The name 'slow' is misleading; this feature was originally necessitated
|
||||||
|
! by window managers which were slow putting up popup windows, but the
|
||||||
|
! fixed-position prompting can be just as useful for quick popups.)
|
||||||
|
!NetHack*slow: False
|
||||||
|
|
||||||
|
! If True, force keyboard to attach to popup windows. Some window managers
|
||||||
|
! enforce a click-to-focus-keyboard policy (e.g. the DECwindows wm). NetHack
|
||||||
|
! has a lot of popups and is almost unplayable without some kind of autofocus.
|
||||||
|
!NetHack*autofocus: True
|
||||||
|
|
||||||
! If 'slow' is True, setting 'highlight_prompt' to True will cause the line
|
! If 'slow' is True, setting 'highlight_prompt' to True will cause the line
|
||||||
! between map and message display that's used for prompting to be "hidden"
|
! between map and message display that's used for prompting to be "hidden"
|
||||||
@@ -91,19 +86,33 @@ NetHack*highlight_prompt: False
|
|||||||
|
|
||||||
! The number of lines the message window will show without scrolling.
|
! The number of lines the message window will show without scrolling.
|
||||||
!NetHack*message_lines: 12
|
!NetHack*message_lines: 12
|
||||||
!
|
|
||||||
! If True, the message window has a line that seperates old and new messages.
|
! If True, the message window has a line that seperates old and new messages.
|
||||||
!NetHack*message_line: True
|
!NetHack*message_line: True
|
||||||
!
|
|
||||||
! If True, force keyboard to attach to popup windows. Some window managers
|
|
||||||
! enforce a click-to-focus-keyboard policy (e.g. the DECwindows wm). NetHack
|
|
||||||
! has a lot of popups and is almost unplayable without some kind of autofocus.
|
|
||||||
!NetHack*autofocus: True
|
|
||||||
!
|
|
||||||
|
|
||||||
! True, use a "fancy" style status area vs. TTY-style status lines
|
! If True, the default, use a "fancy" style status area below the map.
|
||||||
|
! Fancy status has some highlighting but does not honor HILITE_STATUS.
|
||||||
|
! If False, use TTY-style status lines (two text lines below the map).
|
||||||
|
! TTY status honors HILITE_STATUS thresholds and colors, but for
|
||||||
|
! attributes only supports inverse (not bold, dim, blink, or underline).
|
||||||
|
! (As of this writing, fancy status looks better with a tiles map and
|
||||||
|
! tty-style status looks good with a text map but not with a tiles one.)
|
||||||
!NetHack*fancy_status: False
|
!NetHack*fancy_status: False
|
||||||
|
|
||||||
|
! Translation tables. There are currently several actions in nethack, but
|
||||||
|
! the only one you should be using is "input()", which, with no parameters,
|
||||||
|
! uses XLookupString to translate your keypress into a command. You can
|
||||||
|
! optionally give it parameters to change the behavior, see the example below.
|
||||||
|
! Note that you have to specify the translations in every appropriate window.
|
||||||
|
NetHack*message*translations: <KeyPress>: input()
|
||||||
|
!
|
||||||
|
! Example extra translations for the map window.
|
||||||
|
!NetHack*map*translations: #override \
|
||||||
|
! !<Key>Left: input(h) \n\
|
||||||
|
! !<Key>Right: input(l) \n\
|
||||||
|
! !<Key>Up: input(k) \n\
|
||||||
|
! !<Key>Down: input(j)
|
||||||
|
|
||||||
! Specify the number of rows and columns of the map window. The default
|
! Specify the number of rows and columns of the map window. The default
|
||||||
! is the standard 80x21 window. Note: this _does_not_ change nethack's
|
! is the standard 80x21 window. Note: this _does_not_ change nethack's
|
||||||
! level size, only what you see of it.
|
! level size, only what you see of it.
|
||||||
|
|||||||
+39
-31
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 winmenu.c $NHDT-Date: 1539812601 2018/10/17 21:43:21 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.28 $ */
|
/* NetHack 3.6 winmenu.c $NHDT-Date: 1542245161 2018/11/15 01:26:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.33 $ */
|
||||||
/* Copyright (c) Dean Luick, 1992 */
|
/* Copyright (c) Dean Luick, 1992 */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -45,6 +45,7 @@ static void FDECL(menu_all, (Widget, XtPointer, XtPointer));
|
|||||||
static void FDECL(menu_none, (Widget, XtPointer, XtPointer));
|
static void FDECL(menu_none, (Widget, XtPointer, XtPointer));
|
||||||
static void FDECL(menu_invert, (Widget, XtPointer, XtPointer));
|
static void FDECL(menu_invert, (Widget, XtPointer, XtPointer));
|
||||||
static void FDECL(menu_search, (Widget, XtPointer, XtPointer));
|
static void FDECL(menu_search, (Widget, XtPointer, XtPointer));
|
||||||
|
static void FDECL(search_menu, (struct xwindow *));
|
||||||
static void FDECL(select_all, (struct xwindow *));
|
static void FDECL(select_all, (struct xwindow *));
|
||||||
static void FDECL(select_none, (struct xwindow *));
|
static void FDECL(select_none, (struct xwindow *));
|
||||||
static void FDECL(select_match, (struct xwindow *, char *));
|
static void FDECL(select_match, (struct xwindow *, char *));
|
||||||
@@ -285,25 +286,9 @@ Cardinal *num_params;
|
|||||||
menu_info->counting = TRUE;
|
menu_info->counting = TRUE;
|
||||||
return;
|
return;
|
||||||
} else if (ch == MENU_SEARCH) { /* search */
|
} else if (ch == MENU_SEARCH) { /* search */
|
||||||
if (menu_info->how == PICK_ANY || menu_info->how == PICK_ONE) {
|
search_menu(wp);
|
||||||
char buf[BUFSZ + 2], tmpbuf[BUFSZ];
|
if (menu_info->how == PICK_ANY)
|
||||||
|
|
||||||
X11_getlin("Search for:", tmpbuf);
|
|
||||||
if (!*tmpbuf || *tmpbuf == '\033')
|
|
||||||
return;
|
|
||||||
/* convert "string" into "*string*" for use with pmatch() */
|
|
||||||
Sprintf(buf, "*%s*", tmpbuf);
|
|
||||||
|
|
||||||
if (menu_info->how == PICK_ANY) {
|
|
||||||
invert_match(wp, buf);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
select_match(wp, buf);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
X11_nhbell();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
} else if (ch == MENU_SELECT_ALL || ch == MENU_SELECT_PAGE) {
|
} else if (ch == MENU_SELECT_ALL || ch == MENU_SELECT_PAGE) {
|
||||||
if (menu_info->how == PICK_ANY)
|
if (menu_info->how == PICK_ANY)
|
||||||
select_all(wp);
|
select_all(wp);
|
||||||
@@ -471,26 +456,49 @@ XtPointer client_data, call_data;
|
|||||||
{
|
{
|
||||||
struct xwindow *wp = (struct xwindow *) client_data;
|
struct xwindow *wp = (struct xwindow *) client_data;
|
||||||
struct menu_info_t *menu_info = wp->menu_information;
|
struct menu_info_t *menu_info = wp->menu_information;
|
||||||
char buf[BUFSZ + 2], tmpbuf[BUFSZ];
|
|
||||||
|
|
||||||
nhUse(w);
|
nhUse(w);
|
||||||
nhUse(call_data);
|
nhUse(call_data);
|
||||||
|
|
||||||
X11_getlin("Search for:", tmpbuf);
|
search_menu(wp);
|
||||||
if (!*tmpbuf || *tmpbuf == '\033')
|
|
||||||
return;
|
|
||||||
/* convert "string" into "*string*" for use with pmatch() */
|
|
||||||
Sprintf(buf, "*%s*", tmpbuf);
|
|
||||||
|
|
||||||
if (menu_info->how == PICK_ANY)
|
|
||||||
invert_match(wp, buf);
|
|
||||||
else
|
|
||||||
select_match(wp, buf);
|
|
||||||
|
|
||||||
if (menu_info->how == PICK_ONE)
|
if (menu_info->how == PICK_ONE)
|
||||||
menu_popdown(wp);
|
menu_popdown(wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* common to menu_search and menu_key */
|
||||||
|
static void
|
||||||
|
search_menu(wp)
|
||||||
|
struct xwindow *wp;
|
||||||
|
{
|
||||||
|
char *pat, buf[BUFSZ + 2]; /* room for '*' + BUFSZ-1 + '*' + '\0' */
|
||||||
|
struct menu_info_t *menu_info = wp->menu_information;
|
||||||
|
|
||||||
|
buf[0] = buf[1] = '\0';
|
||||||
|
pat = &buf[1]; /* leave room to maybe insert '*' at front */
|
||||||
|
if (menu_info->how != PICK_NONE) {
|
||||||
|
X11_getlin("Search for:", pat);
|
||||||
|
if (!*pat || *pat == '\033')
|
||||||
|
return;
|
||||||
|
/* convert "string" into "*string*" for use with pmatch() */
|
||||||
|
if (*pat != '*')
|
||||||
|
*--pat = '*'; /* now points to &buf[0] */
|
||||||
|
if (*(eos(pat) - 1) != '*')
|
||||||
|
Strcat(pat, "*");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (menu_info->how) {
|
||||||
|
case PICK_ANY:
|
||||||
|
invert_match(wp, pat);
|
||||||
|
break;
|
||||||
|
case PICK_ONE:
|
||||||
|
select_match(wp, pat);
|
||||||
|
break;
|
||||||
|
default: /* PICK_NONE */
|
||||||
|
X11_nhbell();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
select_all(wp)
|
select_all(wp)
|
||||||
struct xwindow *wp;
|
struct xwindow *wp;
|
||||||
|
|||||||
+3
-1
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
/* font management and such */
|
/* font management and such */
|
||||||
|
|
||||||
|
#include "win10.h"
|
||||||
#include "winos.h"
|
#include "winos.h"
|
||||||
#include "mhfont.h"
|
#include "mhfont.h"
|
||||||
|
|
||||||
@@ -26,9 +27,10 @@ void
|
|||||||
mswin_init_splashfonts(HWND hWnd)
|
mswin_init_splashfonts(HWND hWnd)
|
||||||
{
|
{
|
||||||
HDC hdc = GetDC(hWnd);
|
HDC hdc = GetDC(hWnd);
|
||||||
|
double scale = win10_monitor_scale(hWnd);
|
||||||
LOGFONT lgfnt;
|
LOGFONT lgfnt;
|
||||||
ZeroMemory(&lgfnt, sizeof(lgfnt));
|
ZeroMemory(&lgfnt, sizeof(lgfnt));
|
||||||
lgfnt.lfHeight = -80; // height of font
|
lgfnt.lfHeight = -(int)(80 * scale); // height of font
|
||||||
lgfnt.lfWidth = 0; // average character width
|
lgfnt.lfWidth = 0; // average character width
|
||||||
lgfnt.lfEscapement = 0; // angle of escapement
|
lgfnt.lfEscapement = 0; // angle of escapement
|
||||||
lgfnt.lfOrientation = 0; // base-line orientation angle
|
lgfnt.lfOrientation = 0; // base-line orientation angle
|
||||||
|
|||||||
+472
-382
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw);
|
|||||||
int mswin_map_mode(HWND hWnd, int mode);
|
int mswin_map_mode(HWND hWnd, int mode);
|
||||||
|
|
||||||
#define ROGUE_LEVEL_MAP_MODE MAP_MODE_ASCII12x16
|
#define ROGUE_LEVEL_MAP_MODE MAP_MODE_ASCII12x16
|
||||||
|
#define ROGUE_LEVEL_MAP_MODE_FIT_TO_SCREEN MAP_MODE_ASCII_FIT_TO_SCREEN
|
||||||
|
|
||||||
#define DEF_CLIPAROUND_MARGIN 5
|
#define DEF_CLIPAROUND_MARGIN 5
|
||||||
#define DEF_CLIPAROUND_AMOUNT 1
|
#define DEF_CLIPAROUND_AMOUNT 1
|
||||||
|
|||||||
+39
-28
@@ -2,6 +2,7 @@
|
|||||||
/* Copyright (c) Alex Kompel, 2002 */
|
/* Copyright (c) Alex Kompel, 2002 */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
|
#include "win10.h"
|
||||||
#include "winMS.h"
|
#include "winMS.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
@@ -22,6 +23,9 @@
|
|||||||
#define DEFAULT_COLOR_BG_MENU COLOR_WINDOW
|
#define DEFAULT_COLOR_BG_MENU COLOR_WINDOW
|
||||||
#define DEFAULT_COLOR_FG_MENU COLOR_WINDOWTEXT
|
#define DEFAULT_COLOR_FG_MENU COLOR_WINDOWTEXT
|
||||||
|
|
||||||
|
#define CHECK_WIDTH 16
|
||||||
|
#define CHECK_HEIGHT 16
|
||||||
|
|
||||||
typedef struct mswin_menu_item {
|
typedef struct mswin_menu_item {
|
||||||
int glyph;
|
int glyph;
|
||||||
ANY_P identifier;
|
ANY_P identifier;
|
||||||
@@ -61,6 +65,7 @@ typedef struct mswin_nethack_menu_window {
|
|||||||
HBITMAP bmpChecked;
|
HBITMAP bmpChecked;
|
||||||
HBITMAP bmpCheckedCount;
|
HBITMAP bmpCheckedCount;
|
||||||
HBITMAP bmpNotChecked;
|
HBITMAP bmpNotChecked;
|
||||||
|
HDC bmpDC;
|
||||||
|
|
||||||
BOOL is_active;
|
BOOL is_active;
|
||||||
} NHMenuWindow, *PNHMenuWindow;
|
} NHMenuWindow, *PNHMenuWindow;
|
||||||
@@ -267,14 +272,14 @@ mswin_menu_window_select_menu(HWND hWnd, int how, MENU_ITEM_P **_selected,
|
|||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
PNHMenuWindow data;
|
PNHMenuWindow data = (PNHMenuWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||||
HWND control;
|
HWND control = GetDlgItem(hWnd, IDC_MENU_TEXT);
|
||||||
HDC hdc;
|
|
||||||
TCHAR title[MAX_LOADSTRING];
|
TCHAR title[MAX_LOADSTRING];
|
||||||
|
|
||||||
data = (PNHMenuWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG: {
|
||||||
|
|
||||||
|
HDC hdc = GetDC(control);
|
||||||
data = (PNHMenuWindow) malloc(sizeof(NHMenuWindow));
|
data = (PNHMenuWindow) malloc(sizeof(NHMenuWindow));
|
||||||
ZeroMemory(data, sizeof(NHMenuWindow));
|
ZeroMemory(data, sizeof(NHMenuWindow));
|
||||||
data->type = MENU_TYPE_TEXT;
|
data->type = MENU_TYPE_TEXT;
|
||||||
@@ -287,12 +292,11 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL_COUNT));
|
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_SEL_COUNT));
|
||||||
data->bmpNotChecked =
|
data->bmpNotChecked =
|
||||||
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_UNSEL));
|
LoadBitmap(GetNHApp()->hApp, MAKEINTRESOURCE(IDB_MENU_UNSEL));
|
||||||
|
data->bmpDC = CreateCompatibleDC(hdc);
|
||||||
data->is_active = FALSE;
|
data->is_active = FALSE;
|
||||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) data);
|
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) data);
|
||||||
|
|
||||||
/* set font for the text cotrol */
|
/* set font for the text cotrol */
|
||||||
control = GetDlgItem(hWnd, IDC_MENU_TEXT);
|
|
||||||
hdc = GetDC(control);
|
|
||||||
SendMessage(control, WM_SETFONT,
|
SendMessage(control, WM_SETFONT,
|
||||||
(WPARAM) mswin_get_font(NHW_MENU, ATR_NONE, hdc, FALSE),
|
(WPARAM) mswin_get_font(NHW_MENU, ATR_NONE, hdc, FALSE),
|
||||||
(LPARAM) 0);
|
(LPARAM) 0);
|
||||||
@@ -310,6 +314,7 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
/* set focus to text control for now */
|
/* set focus to text control for now */
|
||||||
SetFocus(control);
|
SetFocus(control);
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
case WM_MSNH_COMMAND:
|
case WM_MSNH_COMMAND:
|
||||||
@@ -500,6 +505,7 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
if (data) {
|
if (data) {
|
||||||
|
DeleteDC(data->bmpDC);
|
||||||
DeleteObject(data->bmpChecked);
|
DeleteObject(data->bmpChecked);
|
||||||
DeleteObject(data->bmpCheckedCount);
|
DeleteObject(data->bmpCheckedCount);
|
||||||
DeleteObject(data->bmpNotChecked);
|
DeleteObject(data->bmpNotChecked);
|
||||||
@@ -862,9 +868,11 @@ SetMenuListType(HWND hWnd, int how)
|
|||||||
SendMessage(control, WM_SETFONT, (WPARAM) fnt, (LPARAM) 0);
|
SendMessage(control, WM_SETFONT, (WPARAM) fnt, (LPARAM) 0);
|
||||||
|
|
||||||
/* add column to the list view */
|
/* add column to the list view */
|
||||||
|
MonitorInfo monitorInfo;
|
||||||
|
win10_monitor_info(hWnd, &monitorInfo);
|
||||||
ZeroMemory(&lvcol, sizeof(lvcol));
|
ZeroMemory(&lvcol, sizeof(lvcol));
|
||||||
lvcol.mask = LVCF_WIDTH | LVCF_TEXT;
|
lvcol.mask = LVCF_WIDTH | LVCF_TEXT;
|
||||||
lvcol.cx = GetSystemMetrics(SM_CXFULLSCREEN);
|
lvcol.cx = monitorInfo.width;
|
||||||
lvcol.pszText = NH_A2W(data->menu.prompt, wbuf, BUFSZ);
|
lvcol.pszText = NH_A2W(data->menu.prompt, wbuf, BUFSZ);
|
||||||
ListView_InsertColumn(control, 0, &lvcol);
|
ListView_InsertColumn(control, 0, &lvcol);
|
||||||
|
|
||||||
@@ -975,6 +983,9 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
int color = NO_COLOR, attr;
|
int color = NO_COLOR, attr;
|
||||||
boolean menucolr = FALSE;
|
boolean menucolr = FALSE;
|
||||||
|
double monitorScale = win10_monitor_scale(hWnd);
|
||||||
|
int tileXScaled = (int) (TILE_X * monitorScale);
|
||||||
|
int tileYScaled = (int) (TILE_Y * monitorScale);
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(wParam);
|
UNREFERENCED_PARAMETER(wParam);
|
||||||
|
|
||||||
@@ -1009,30 +1020,29 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
if (NHMENU_IS_SELECTABLE(*item)) {
|
if (NHMENU_IS_SELECTABLE(*item)) {
|
||||||
char buf[2];
|
char buf[2];
|
||||||
if (data->how != PICK_NONE) {
|
if (data->how != PICK_NONE) {
|
||||||
HGDIOBJ saveBrush;
|
HBITMAP bmpCheck;
|
||||||
HBRUSH hbrCheckMark;
|
HBITMAP bmpSaved;
|
||||||
|
|
||||||
switch (item->count) {
|
switch (item->count) {
|
||||||
case -1:
|
case -1:
|
||||||
hbrCheckMark = CreatePatternBrush(data->bmpChecked);
|
bmpCheck = data->bmpChecked;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
hbrCheckMark = CreatePatternBrush(data->bmpNotChecked);
|
bmpCheck = data->bmpNotChecked;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
hbrCheckMark = CreatePatternBrush(data->bmpCheckedCount);
|
bmpCheck = data->bmpCheckedCount;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = (lpdis->rcItem.bottom + lpdis->rcItem.top - TILE_Y) / 2;
|
y = (lpdis->rcItem.bottom + lpdis->rcItem.top - tileYScaled) / 2;
|
||||||
SetBrushOrgEx(lpdis->hDC, x, y, NULL);
|
bmpSaved = SelectBitmap(data->bmpDC, bmpCheck);
|
||||||
saveBrush = SelectObject(lpdis->hDC, hbrCheckMark);
|
StretchBlt(lpdis->hDC, x, y, tileXScaled, tileYScaled,
|
||||||
PatBlt(lpdis->hDC, x, y, TILE_X, TILE_Y, PATCOPY);
|
data->bmpDC, 0, 0, CHECK_WIDTH, CHECK_HEIGHT, SRCCOPY);
|
||||||
SelectObject(lpdis->hDC, saveBrush);
|
SelectObject(data->bmpDC, bmpSaved);
|
||||||
DeleteObject(hbrCheckMark);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x += TILE_X + spacing;
|
x += tileXScaled + spacing;
|
||||||
|
|
||||||
if (item->accelerator != 0) {
|
if (item->accelerator != 0) {
|
||||||
buf[0] = item->accelerator;
|
buf[0] = item->accelerator;
|
||||||
@@ -1053,13 +1063,14 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
x += tm.tmAveCharWidth + tm.tmOverhang + spacing;
|
x += tm.tmAveCharWidth + tm.tmOverhang + spacing;
|
||||||
} else {
|
} else {
|
||||||
x += TILE_X + tm.tmAveCharWidth + tm.tmOverhang + 2 * spacing;
|
x += tileXScaled + tm.tmAveCharWidth + tm.tmOverhang + 2 * spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print glyph if present */
|
/* print glyph if present */
|
||||||
if (NHMENU_HAS_GLYPH(*item)) {
|
if (NHMENU_HAS_GLYPH(*item)) {
|
||||||
if (!IS_MAP_ASCII(iflags.wc_map_mode)) {
|
if (!IS_MAP_ASCII(iflags.wc_map_mode)) {
|
||||||
HGDIOBJ saveBmp;
|
HGDIOBJ saveBmp;
|
||||||
|
double monitorScale = win10_monitor_scale(hWnd);
|
||||||
|
|
||||||
saveBmp = SelectObject(tileDC, GetNHApp()->bmpMapTiles);
|
saveBmp = SelectObject(tileDC, GetNHApp()->bmpMapTiles);
|
||||||
ntile = glyph2tile[item->glyph];
|
ntile = glyph2tile[item->glyph];
|
||||||
@@ -1068,21 +1079,21 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
t_y =
|
t_y =
|
||||||
(ntile / GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_Y;
|
(ntile / GetNHApp()->mapTilesPerLine) * GetNHApp()->mapTile_Y;
|
||||||
|
|
||||||
y = (lpdis->rcItem.bottom + lpdis->rcItem.top
|
y = (lpdis->rcItem.bottom + lpdis->rcItem.top - tileYScaled) / 2;
|
||||||
- GetNHApp()->mapTile_Y) / 2;
|
|
||||||
|
|
||||||
if (GetNHApp()->bmpMapTiles == GetNHApp()->bmpTiles) {
|
if (GetNHApp()->bmpMapTiles == GetNHApp()->bmpTiles) {
|
||||||
/* using original nethack tiles - apply image transparently */
|
/* using original nethack tiles - apply image transparently */
|
||||||
(*GetNHApp()->lpfnTransparentBlt)(lpdis->hDC, x, y, TILE_X, TILE_Y,
|
(*GetNHApp()->lpfnTransparentBlt)(lpdis->hDC, x, y,
|
||||||
|
tileXScaled, tileYScaled,
|
||||||
tileDC, t_x, t_y, TILE_X, TILE_Y,
|
tileDC, t_x, t_y, TILE_X, TILE_Y,
|
||||||
TILE_BK_COLOR);
|
TILE_BK_COLOR);
|
||||||
} else {
|
} else {
|
||||||
/* using custom tiles - simple blt */
|
/* using custom tiles - simple blt */
|
||||||
BitBlt(lpdis->hDC, x, y, GetNHApp()->mapTile_X,
|
StretchBlt(lpdis->hDC, x, y, tileXScaled, tileYScaled,
|
||||||
GetNHApp()->mapTile_Y, tileDC, t_x, t_y, SRCCOPY);
|
tileDC, t_x, t_y, GetNHApp()->mapTile_X, GetNHApp()->mapTile_Y, SRCCOPY);
|
||||||
}
|
}
|
||||||
SelectObject(tileDC, saveBmp);
|
SelectObject(tileDC, saveBmp);
|
||||||
x += GetNHApp()->mapTile_X;
|
x += tileXScaled;
|
||||||
} else {
|
} else {
|
||||||
const char *sel_ind;
|
const char *sel_ind;
|
||||||
switch (item->count) {
|
switch (item->count) {
|
||||||
@@ -1106,7 +1117,7 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* no glyph - need to adjust so help window won't look to cramped */
|
/* no glyph - need to adjust so help window won't look to cramped */
|
||||||
x += TILE_X;
|
x += tileXScaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
x += spacing;
|
x += spacing;
|
||||||
|
|||||||
+41
-19
@@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2001 by Alex Kompel */
|
/* Copyright (C) 2001 by Alex Kompel */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
|
#include "win10.h"
|
||||||
#include "winMS.h"
|
#include "winMS.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "mhrip.h"
|
#include "mhrip.h"
|
||||||
@@ -25,6 +26,14 @@ typedef struct mswin_nethack_text_window {
|
|||||||
HANDLE rip_bmp;
|
HANDLE rip_bmp;
|
||||||
TCHAR *window_text;
|
TCHAR *window_text;
|
||||||
TCHAR *rip_text;
|
TCHAR *rip_text;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int graveX;
|
||||||
|
int graveY;
|
||||||
|
int graveHeight;
|
||||||
|
int graveWidth;
|
||||||
} NHRIPWindow, *PNHRIPWindow;
|
} NHRIPWindow, *PNHRIPWindow;
|
||||||
|
|
||||||
INT_PTR CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
|
INT_PTR CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
@@ -62,9 +71,21 @@ mswin_display_RIP_window(HWND hWnd)
|
|||||||
RECT textrect;
|
RECT textrect;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
HFONT OldFont;
|
HFONT OldFont;
|
||||||
|
MonitorInfo monitorInfo;
|
||||||
|
|
||||||
|
win10_monitor_info(hWnd, &monitorInfo);
|
||||||
|
|
||||||
data = (PNHRIPWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
data = (PNHRIPWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||||
|
|
||||||
|
data->x = (int)(RIP_OFFSET_X * monitorInfo.scale);
|
||||||
|
data->y = (int)(RIP_OFFSET_Y * monitorInfo.scale);
|
||||||
|
data->width = (int)(RIP_WIDTH * monitorInfo.scale);
|
||||||
|
data->height = (int)(RIP_HEIGHT * monitorInfo.scale);
|
||||||
|
data->graveX = (int)(RIP_GRAVE_X * monitorInfo.scale);
|
||||||
|
data->graveY = (int)(RIP_GRAVE_Y * monitorInfo.scale);
|
||||||
|
data->graveWidth = (int)(RIP_GRAVE_WIDTH * monitorInfo.scale);
|
||||||
|
data->graveHeight = (int)(RIP_GRAVE_HEIGHT * monitorInfo.scale);
|
||||||
|
|
||||||
GetNHApp()->hPopupWnd = hWnd;
|
GetNHApp()->hPopupWnd = hWnd;
|
||||||
mapWnd = mswin_hwnd_from_winid(WIN_MAP);
|
mapWnd = mswin_hwnd_from_winid(WIN_MAP);
|
||||||
if (!IsWindow(mapWnd))
|
if (!IsWindow(mapWnd))
|
||||||
@@ -73,9 +94,9 @@ mswin_display_RIP_window(HWND hWnd)
|
|||||||
GetWindowRect(hWnd, &riprt);
|
GetWindowRect(hWnd, &riprt);
|
||||||
GetClientRect(hWnd, &clientrect);
|
GetClientRect(hWnd, &clientrect);
|
||||||
textrect = clientrect;
|
textrect = clientrect;
|
||||||
textrect.top += RIP_OFFSET_Y;
|
textrect.top += data->y;
|
||||||
textrect.left += RIP_OFFSET_X;
|
textrect.left += data->x;
|
||||||
textrect.right -= RIP_OFFSET_X;
|
textrect.right -= data->x;
|
||||||
if (data->window_text) {
|
if (data->window_text) {
|
||||||
hdc = GetDC(hWnd);
|
hdc = GetDC(hWnd);
|
||||||
OldFont = SelectObject(hdc, mswin_get_font(NHW_TEXT, 0, hdc, FALSE));
|
OldFont = SelectObject(hdc, mswin_get_font(NHW_TEXT, 0, hdc, FALSE));
|
||||||
@@ -84,17 +105,17 @@ mswin_display_RIP_window(HWND hWnd)
|
|||||||
SelectObject(hdc, OldFont);
|
SelectObject(hdc, OldFont);
|
||||||
ReleaseDC(hWnd, hdc);
|
ReleaseDC(hWnd, hdc);
|
||||||
}
|
}
|
||||||
if (textrect.right - textrect.left > RIP_WIDTH)
|
if (textrect.right - textrect.left > data->width)
|
||||||
clientrect.right = textrect.right + RIP_OFFSET_X - clientrect.right;
|
clientrect.right = textrect.right + data->y - clientrect.right;
|
||||||
else
|
else
|
||||||
clientrect.right =
|
clientrect.right =
|
||||||
textrect.left + 2 * RIP_OFFSET_X + RIP_WIDTH - clientrect.right;
|
textrect.left + 2 * data->x + data->width - clientrect.right;
|
||||||
clientrect.bottom =
|
clientrect.bottom =
|
||||||
textrect.bottom + RIP_HEIGHT + RIP_OFFSET_Y - clientrect.bottom;
|
textrect.bottom + data->height + data->y - clientrect.bottom;
|
||||||
GetWindowRect(GetDlgItem(hWnd, IDOK), &textrect);
|
GetWindowRect(GetDlgItem(hWnd, IDOK), &textrect);
|
||||||
textrect.right -= textrect.left;
|
textrect.right -= textrect.left;
|
||||||
textrect.bottom -= textrect.top;
|
textrect.bottom -= textrect.top;
|
||||||
clientrect.bottom += textrect.bottom + RIP_OFFSET_Y;
|
clientrect.bottom += textrect.bottom + data->y;
|
||||||
riprt.right -= riprt.left;
|
riprt.right -= riprt.left;
|
||||||
riprt.bottom -= riprt.top;
|
riprt.bottom -= riprt.top;
|
||||||
riprt.right += clientrect.right;
|
riprt.right += clientrect.right;
|
||||||
@@ -106,7 +127,7 @@ mswin_display_RIP_window(HWND hWnd)
|
|||||||
GetClientRect(hWnd, &clientrect);
|
GetClientRect(hWnd, &clientrect);
|
||||||
MoveWindow(GetDlgItem(hWnd, IDOK),
|
MoveWindow(GetDlgItem(hWnd, IDOK),
|
||||||
(clientrect.right - clientrect.left - textrect.right) / 2,
|
(clientrect.right - clientrect.left - textrect.right) / 2,
|
||||||
clientrect.bottom - textrect.bottom - RIP_OFFSET_Y,
|
clientrect.bottom - textrect.bottom - data->y,
|
||||||
textrect.right, textrect.bottom, TRUE);
|
textrect.right, textrect.bottom, TRUE);
|
||||||
ShowWindow(hWnd, SW_SHOW);
|
ShowWindow(hWnd, SW_SHOW);
|
||||||
|
|
||||||
@@ -158,9 +179,9 @@ NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
SetBkMode(hdc, TRANSPARENT);
|
SetBkMode(hdc, TRANSPARENT);
|
||||||
GetClientRect(hWnd, &clientrect);
|
GetClientRect(hWnd, &clientrect);
|
||||||
textrect = clientrect;
|
textrect = clientrect;
|
||||||
textrect.top += RIP_OFFSET_Y;
|
textrect.top += data->y;
|
||||||
textrect.left += RIP_OFFSET_X;
|
textrect.left += data->x;
|
||||||
textrect.right -= RIP_OFFSET_X;
|
textrect.right -= data->x;
|
||||||
if (data->window_text) {
|
if (data->window_text) {
|
||||||
DrawText(hdc, data->window_text, strlen(data->window_text),
|
DrawText(hdc, data->window_text, strlen(data->window_text),
|
||||||
&textrect, DT_LEFT | DT_NOPREFIX | DT_CALCRECT);
|
&textrect, DT_LEFT | DT_NOPREFIX | DT_CALCRECT);
|
||||||
@@ -169,15 +190,16 @@ NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
OldBitmap = SelectObject(hdcBitmap, GetNHApp()->bmpRip);
|
OldBitmap = SelectObject(hdcBitmap, GetNHApp()->bmpRip);
|
||||||
SetBkMode(hdc, OPAQUE);
|
SetBkMode(hdc, OPAQUE);
|
||||||
bitmap_offset = (textrect.right - textrect.left - RIP_WIDTH) / 2;
|
bitmap_offset = (textrect.right - textrect.left - data->width) / 2;
|
||||||
BitBlt(hdc, textrect.left + bitmap_offset, textrect.bottom, RIP_WIDTH,
|
StretchBlt(hdc, textrect.left + bitmap_offset, textrect.bottom,
|
||||||
RIP_HEIGHT, hdcBitmap, 0, 0, SRCCOPY);
|
data->width, data->height,
|
||||||
|
hdcBitmap, 0, 0, RIP_WIDTH, RIP_HEIGHT, SRCCOPY);
|
||||||
SetBkMode(hdc, TRANSPARENT);
|
SetBkMode(hdc, TRANSPARENT);
|
||||||
if (data->rip_text) {
|
if (data->rip_text) {
|
||||||
textrect.left += RIP_GRAVE_X + bitmap_offset;
|
textrect.left += data->graveX + bitmap_offset;
|
||||||
textrect.top = textrect.bottom + RIP_GRAVE_Y;
|
textrect.top = textrect.bottom + data->graveY;
|
||||||
textrect.right = textrect.left + RIP_GRAVE_WIDTH;
|
textrect.right = textrect.left + data->graveWidth;
|
||||||
textrect.bottom = textrect.top + RIP_GRAVE_HEIGHT;
|
textrect.bottom = textrect.top + data->graveHeight;
|
||||||
DrawText(hdc, data->rip_text, strlen(data->rip_text), &textrect,
|
DrawText(hdc, data->rip_text, strlen(data->rip_text), &textrect,
|
||||||
DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_WORDBREAK);
|
DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_WORDBREAK);
|
||||||
}
|
}
|
||||||
|
|||||||
+53
-24
@@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2001 by Alex Kompel */
|
/* Copyright (C) 2001 by Alex Kompel */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
|
#include "win10.h"
|
||||||
#include "winMS.h"
|
#include "winMS.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "mhsplash.h"
|
#include "mhsplash.h"
|
||||||
@@ -17,15 +18,24 @@ PNHWinApp GetNHApp(void);
|
|||||||
|
|
||||||
INT_PTR CALLBACK NHSplashWndProc(HWND, UINT, WPARAM, LPARAM);
|
INT_PTR CALLBACK NHSplashWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
|
||||||
#define SPLASH_WIDTH 440
|
#define SPLASH_WIDTH_96DPI 440
|
||||||
#define SPLASH_HEIGHT 322
|
#define SPLASH_HEIGHT_96DPI 322
|
||||||
#define SPLASH_VERSION_X 290
|
#define SPLASH_OFFSET_X_96DPI 10
|
||||||
#define SPLASH_VERSION_Y 10
|
#define SPLASH_OFFSET_Y_96DPI 10
|
||||||
#define SPLASH_OFFSET_X 10
|
#define SPLASH_VERSION_X_96DPI 280
|
||||||
#define SPLASH_OFFSET_Y 10
|
#define SPLASH_VERSION_Y_96DPI 0
|
||||||
|
|
||||||
extern HFONT version_splash_font;
|
extern HFONT version_splash_font;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int offsetX;
|
||||||
|
int offsetY;
|
||||||
|
int versionX;
|
||||||
|
int versionY;
|
||||||
|
} SplashData;
|
||||||
|
|
||||||
void
|
void
|
||||||
mswin_display_splash_window(BOOL show_ver)
|
mswin_display_splash_window(BOOL show_ver)
|
||||||
{
|
{
|
||||||
@@ -34,16 +44,30 @@ mswin_display_splash_window(BOOL show_ver)
|
|||||||
RECT splashrt;
|
RECT splashrt;
|
||||||
RECT clientrt;
|
RECT clientrt;
|
||||||
RECT controlrt;
|
RECT controlrt;
|
||||||
HWND hWnd;
|
|
||||||
int buttop;
|
int buttop;
|
||||||
strbuf_t strbuf;
|
strbuf_t strbuf;
|
||||||
|
|
||||||
strbuf_init(&strbuf);
|
strbuf_init(&strbuf);
|
||||||
|
|
||||||
hWnd = CreateDialog(GetNHApp()->hApp, MAKEINTRESOURCE(IDD_SPLASH),
|
HWND hWnd = CreateDialog(GetNHApp()->hApp, MAKEINTRESOURCE(IDD_SPLASH),
|
||||||
GetNHApp()->hMainWnd, NHSplashWndProc);
|
GetNHApp()->hMainWnd, NHSplashWndProc);
|
||||||
if (!hWnd)
|
if (!hWnd)
|
||||||
panic("Cannot create Splash window");
|
panic("Cannot create Splash window");
|
||||||
|
|
||||||
|
MonitorInfo monitorInfo;
|
||||||
|
win10_monitor_info(hWnd, &monitorInfo);
|
||||||
|
|
||||||
|
SplashData splashData;
|
||||||
|
|
||||||
|
splashData.width = (int) (monitorInfo.scale * SPLASH_WIDTH_96DPI);
|
||||||
|
splashData.height = (int) (monitorInfo.scale * SPLASH_HEIGHT_96DPI);
|
||||||
|
splashData.offsetX = (int) (monitorInfo.scale * SPLASH_OFFSET_X_96DPI);
|
||||||
|
splashData.offsetY = (int) (monitorInfo.scale * SPLASH_OFFSET_Y_96DPI);
|
||||||
|
splashData.versionX = (int) (monitorInfo.scale * SPLASH_VERSION_X_96DPI);
|
||||||
|
splashData.versionY = (int) (monitorInfo.scale * SPLASH_VERSION_Y_96DPI);
|
||||||
|
|
||||||
|
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) &splashData);
|
||||||
|
|
||||||
mswin_init_splashfonts(hWnd);
|
mswin_init_splashfonts(hWnd);
|
||||||
GetNHApp()->hPopupWnd = hWnd;
|
GetNHApp()->hPopupWnd = hWnd;
|
||||||
/* Get control size */
|
/* Get control size */
|
||||||
@@ -57,30 +81,32 @@ mswin_display_splash_window(BOOL show_ver)
|
|||||||
splashrt.right -= splashrt.left;
|
splashrt.right -= splashrt.left;
|
||||||
splashrt.bottom -= splashrt.top;
|
splashrt.bottom -= splashrt.top;
|
||||||
/* Get difference between requested client area and current value */
|
/* Get difference between requested client area and current value */
|
||||||
splashrt.right += SPLASH_WIDTH + SPLASH_OFFSET_X * 2 - clientrt.right;
|
splashrt.right += splashData.width + splashData.offsetX * 2
|
||||||
splashrt.bottom += SPLASH_HEIGHT + controlrt.bottom + SPLASH_OFFSET_Y * 3
|
- clientrt.right;
|
||||||
- clientrt.bottom;
|
splashrt.bottom += splashData.height + controlrt.bottom
|
||||||
|
+ splashData.offsetY * 3
|
||||||
|
- clientrt.bottom;
|
||||||
/* Place the window centered */
|
/* Place the window centered */
|
||||||
/* On the screen, not on the parent window */
|
/* On the screen, not on the parent window */
|
||||||
left = (GetSystemMetrics(SM_CXSCREEN) - splashrt.right) / 2;
|
left = (monitorInfo.width - splashrt.right) / 2;
|
||||||
top = (GetSystemMetrics(SM_CYSCREEN) - splashrt.bottom) / 2;
|
top = (monitorInfo.height - splashrt.bottom) / 2;
|
||||||
MoveWindow(hWnd, left, top, splashrt.right, splashrt.bottom, TRUE);
|
MoveWindow(hWnd, left, top, splashrt.right, splashrt.bottom, TRUE);
|
||||||
/* Place the OK control */
|
/* Place the OK control */
|
||||||
GetClientRect(hWnd, &clientrt);
|
GetClientRect(hWnd, &clientrt);
|
||||||
MoveWindow(GetDlgItem(hWnd, IDOK),
|
MoveWindow(GetDlgItem(hWnd, IDOK),
|
||||||
(clientrt.right - clientrt.left - controlrt.right) / 2,
|
(clientrt.right - clientrt.left - controlrt.right) / 2,
|
||||||
clientrt.bottom - controlrt.bottom - SPLASH_OFFSET_Y,
|
clientrt.bottom - controlrt.bottom - splashData.offsetY,
|
||||||
controlrt.right, controlrt.bottom, TRUE);
|
controlrt.right, controlrt.bottom, TRUE);
|
||||||
buttop = clientrt.bottom - controlrt.bottom - SPLASH_OFFSET_Y;
|
buttop = clientrt.bottom - controlrt.bottom - splashData.offsetY;
|
||||||
/* Place the text control */
|
/* Place the text control */
|
||||||
GetWindowRect(GetDlgItem(hWnd, IDC_EXTRAINFO), &controlrt);
|
GetWindowRect(GetDlgItem(hWnd, IDC_EXTRAINFO), &controlrt);
|
||||||
controlrt.right -= controlrt.left;
|
controlrt.right -= controlrt.left;
|
||||||
controlrt.bottom -= controlrt.top;
|
controlrt.bottom -= controlrt.top;
|
||||||
GetClientRect(hWnd, &clientrt);
|
GetClientRect(hWnd, &clientrt);
|
||||||
MoveWindow(GetDlgItem(hWnd, IDC_EXTRAINFO),
|
MoveWindow(GetDlgItem(hWnd, IDC_EXTRAINFO),
|
||||||
clientrt.left + SPLASH_OFFSET_X,
|
clientrt.left + splashData.offsetX,
|
||||||
buttop - controlrt.bottom - SPLASH_OFFSET_Y,
|
buttop - controlrt.bottom - splashData.offsetY,
|
||||||
clientrt.right - 2 * SPLASH_OFFSET_X, controlrt.bottom, TRUE);
|
clientrt.right - 2 * splashData.offsetX, controlrt.bottom, TRUE);
|
||||||
|
|
||||||
/* Fill the text control */
|
/* Fill the text control */
|
||||||
strbuf_reserve(&strbuf, BUFSIZ);
|
strbuf_reserve(&strbuf, BUFSIZ);
|
||||||
@@ -168,16 +194,19 @@ NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
HANDLE OldFont;
|
HANDLE OldFont;
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
|
|
||||||
|
SplashData *splashData = (SplashData *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||||
|
|
||||||
hdc = BeginPaint(hWnd, &ps);
|
hdc = BeginPaint(hWnd, &ps);
|
||||||
/* Show splash graphic */
|
/* Show splash graphic */
|
||||||
|
|
||||||
hdcBitmap = CreateCompatibleDC(hdc);
|
hdcBitmap = CreateCompatibleDC(hdc);
|
||||||
SetBkMode(hdc, OPAQUE);
|
SetBkMode(hdc, OPAQUE);
|
||||||
OldBitmap = SelectObject(hdcBitmap, GetNHApp()->bmpSplash);
|
OldBitmap = SelectObject(hdcBitmap, GetNHApp()->bmpSplash);
|
||||||
(*GetNHApp()->lpfnTransparentBlt)(hdc, SPLASH_OFFSET_X, SPLASH_OFFSET_Y,
|
(*GetNHApp()->lpfnTransparentBlt)(hdc,
|
||||||
SPLASH_WIDTH, SPLASH_HEIGHT, hdcBitmap, 0,
|
splashData->offsetX, splashData->offsetY,
|
||||||
0, SPLASH_WIDTH, SPLASH_HEIGHT,
|
splashData->width, splashData->height, hdcBitmap,
|
||||||
TILE_BK_COLOR);
|
0, 0, SPLASH_WIDTH_96DPI, SPLASH_HEIGHT_96DPI,
|
||||||
|
TILE_BK_COLOR);
|
||||||
|
|
||||||
SelectObject(hdcBitmap, OldBitmap);
|
SelectObject(hdcBitmap, OldBitmap);
|
||||||
DeleteDC(hdcBitmap);
|
DeleteDC(hdcBitmap);
|
||||||
@@ -186,8 +215,8 @@ NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
/* Print version number */
|
/* Print version number */
|
||||||
|
|
||||||
SetTextColor(hdc, RGB(0, 0, 0));
|
SetTextColor(hdc, RGB(0, 0, 0));
|
||||||
rt.right = rt.left = SPLASH_VERSION_X;
|
rt.right = rt.left = splashData->offsetX + splashData->versionX;
|
||||||
rt.bottom = rt.top = SPLASH_VERSION_Y;
|
rt.bottom = rt.top = splashData->offsetY + splashData->versionY;
|
||||||
Sprintf(VersionString, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR,
|
Sprintf(VersionString, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR,
|
||||||
PATCHLEVEL);
|
PATCHLEVEL);
|
||||||
OldFont = SelectObject(hdc, version_splash_font);
|
OldFont = SelectObject(hdc, version_splash_font);
|
||||||
|
|||||||
+8
-2
@@ -813,8 +813,14 @@ mswin_clear_nhwindow(winid wid)
|
|||||||
&& (GetNHApp()->windowlist[wid].win != NULL)) {
|
&& (GetNHApp()->windowlist[wid].win != NULL)) {
|
||||||
if (GetNHApp()->windowlist[wid].type == NHW_MAP) {
|
if (GetNHApp()->windowlist[wid].type == NHW_MAP) {
|
||||||
if (Is_rogue_level(&u.uz))
|
if (Is_rogue_level(&u.uz))
|
||||||
mswin_map_mode(mswin_hwnd_from_winid(WIN_MAP),
|
if (iflags.wc_map_mode == MAP_MODE_ASCII_FIT_TO_SCREEN ||
|
||||||
ROGUE_LEVEL_MAP_MODE);
|
iflags.wc_map_mode == MAP_MODE_TILES_FIT_TO_SCREEN)
|
||||||
|
|
||||||
|
mswin_map_mode(mswin_hwnd_from_winid(WIN_MAP),
|
||||||
|
ROGUE_LEVEL_MAP_MODE_FIT_TO_SCREEN);
|
||||||
|
else
|
||||||
|
mswin_map_mode(mswin_hwnd_from_winid(WIN_MAP),
|
||||||
|
ROGUE_LEVEL_MAP_MODE);
|
||||||
else
|
else
|
||||||
mswin_map_mode(mswin_hwnd_from_winid(WIN_MAP),
|
mswin_map_mode(mswin_hwnd_from_winid(WIN_MAP),
|
||||||
iflags.wc_map_mode);
|
iflags.wc_map_mode);
|
||||||
|
|||||||
Reference in New Issue
Block a user