Merge branch 'win-minor' into NetHack-3.6.0
This commit is contained in:
@@ -17,6 +17,7 @@ Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
-----------------------------------------
|
||||
windows-tty: Specify both width and height when creating font for width testing
|
||||
tty: some optimizations for performance and per field rendering
|
||||
|
||||
|
||||
Code Cleanup and Reorganization
|
||||
|
||||
@@ -26,7 +26,7 @@ E void NDECL(display_gamewindows);
|
||||
E void NDECL(newgame);
|
||||
E void FDECL(welcome, (BOOLEAN_P));
|
||||
E time_t NDECL(get_realtime);
|
||||
E boolean FDECL(argcheck, (int, char **, enum earlyarg));
|
||||
E int FDECL(argcheck, (int, char **, enum earlyarg));
|
||||
|
||||
/* ### apply.c ### */
|
||||
|
||||
@@ -786,6 +786,7 @@ E void NDECL(read_wizkit);
|
||||
E int FDECL(read_sym_file, (int));
|
||||
E int FDECL(parse_sym_line, (char *, int));
|
||||
E void FDECL(paniclog, (const char *, const char *));
|
||||
E void FDECL(testinglog, (const char *, const char *, const char *));
|
||||
E int FDECL(validate_prefix_locations, (char *));
|
||||
#ifdef SELECTSAVED
|
||||
E char *FDECL(plname_from_file, (const char *));
|
||||
@@ -1157,6 +1158,7 @@ E boolean FDECL(usmellmon, (struct permonst *));
|
||||
|
||||
E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int));
|
||||
E char *FDECL(encglyph, (int));
|
||||
E const char *FDECL(decode_mixed, (char *,const char *));
|
||||
E void FDECL(genl_putmixed, (winid, int, const char *));
|
||||
|
||||
/* ### mcastu.c ### */
|
||||
@@ -1618,6 +1620,7 @@ E int NDECL(tgetch);
|
||||
E int FDECL(ntposkey, (int *, int *, int *));
|
||||
E void FDECL(set_output_mode, (int));
|
||||
E void NDECL(synch_cursor);
|
||||
E void NDECL(nethack_enter_nttty);
|
||||
#endif
|
||||
|
||||
/* ### o_init.c ### */
|
||||
@@ -2777,6 +2780,11 @@ E void NDECL(dump_close_log);
|
||||
E void FDECL(dump_redirect, (BOOLEAN_P));
|
||||
E void FDECL(dump_forward_putstr, (winid, int, const char*, int));
|
||||
|
||||
/* ### winnt.c ### */
|
||||
#ifdef WIN32
|
||||
E void NDECL(nethack_enter_winnt);
|
||||
#endif
|
||||
|
||||
/* ### wizard.c ### */
|
||||
|
||||
E void NDECL(amulet);
|
||||
|
||||
@@ -221,6 +221,16 @@ enum getloc_filters {
|
||||
NUM_GFILTER
|
||||
};
|
||||
|
||||
struct debug_flags {
|
||||
boolean test;
|
||||
#ifdef TTY_GRAPHICS
|
||||
boolean ttystatus;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
boolean immediateflips;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct instance_flags {
|
||||
/* stuff that really isn't option or platform related. They are
|
||||
* set and cleared during the game to control the internal
|
||||
@@ -423,6 +433,7 @@ struct instance_flags {
|
||||
short mines_prize_type; /* luckstone */
|
||||
short soko_prize_type1; /* bag of holding or */
|
||||
short soko_prize_type2; /* amulet of reflection */
|
||||
struct debug_flags debug;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* #define BETA */ /* development or beta testing [MRS] */
|
||||
#define BETA /* development or beta testing [MRS] */
|
||||
|
||||
#define DEBUG
|
||||
|
||||
@@ -352,4 +352,10 @@ struct savefile_info {
|
||||
#define PANICTRACE_GDB
|
||||
#endif
|
||||
|
||||
/* Supply nethack_enter macro if not supplied by port */
|
||||
#ifndef nethack_enter
|
||||
#define nethack_enter(argc, argv) ((void) 0)
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* GLOBAL_H */
|
||||
|
||||
@@ -203,7 +203,9 @@ extern void NDECL(win32_abort);
|
||||
extern void FDECL(nttty_preference_update, (const char *));
|
||||
extern void NDECL(toggle_mouse_support);
|
||||
extern void FDECL(map_subkeyvalue, (char *));
|
||||
extern void NDECL(load_keyboard_handler);
|
||||
#if defined(WIN32CON)
|
||||
extern void FDECL(set_altkeyhandler, (const char *));
|
||||
#endif
|
||||
extern void NDECL(raw_clear_screen);
|
||||
|
||||
#include <fcntl.h>
|
||||
@@ -246,4 +248,16 @@ extern int FDECL(set_win32_option, (const char *, const char *));
|
||||
extern int FDECL(alternative_palette, (char *));
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define ntassert(expression) ((void)0)
|
||||
#else
|
||||
extern void FDECL(ntassert_failed, (const char * exp, const char * file,
|
||||
int line));
|
||||
|
||||
#define ntassert(expression) (void)((!!(expression)) || \
|
||||
(ntassert_failed(#expression, __FILE__, __LINE__), 0))
|
||||
#endif
|
||||
|
||||
#define nethack_enter(argc, argv) nethack_enter_winnt()
|
||||
|
||||
#endif /* NTCONF_H */
|
||||
|
||||
@@ -69,6 +69,19 @@ struct DisplayDesc {
|
||||
|
||||
#endif /* WINDOW_STRUCTS */
|
||||
|
||||
#ifdef STATUS_HILITES
|
||||
struct tty_status_fields {
|
||||
int idx;
|
||||
int color;
|
||||
int attr;
|
||||
int x, y;
|
||||
size_t lth;
|
||||
boolean valid;
|
||||
boolean dirty;
|
||||
boolean redraw;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define MAXWIN 20 /* maximum number of windows, cop-out */
|
||||
|
||||
/* tty dependent window types */
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
/* various code that was replicated in *main.c */
|
||||
|
||||
#include "hack.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef NO_SIGNAL
|
||||
#include <signal.h>
|
||||
@@ -16,6 +17,7 @@ STATIC_DCL void NDECL(do_positionbar);
|
||||
#endif
|
||||
STATIC_DCL void FDECL(regen_hp, (int));
|
||||
STATIC_DCL void FDECL(interrupt_multi, (const char *));
|
||||
STATIC_DCL void FDECL(debug_fields, (const char *));
|
||||
|
||||
void
|
||||
moveloop(resuming)
|
||||
@@ -752,11 +754,18 @@ const char *msg;
|
||||
*/
|
||||
|
||||
static struct early_opt earlyopts[] = {
|
||||
{ARG_DEBUG, "debug", 5, FALSE},
|
||||
{ARG_DEBUG, "debug", 5, TRUE},
|
||||
{ARG_VERSION, "version", 4, TRUE},
|
||||
};
|
||||
|
||||
boolean
|
||||
/*
|
||||
* Returns:
|
||||
* 0 = no match
|
||||
* 1 = found and skip past this argument
|
||||
* 2 = found and trigger immediate exit
|
||||
*/
|
||||
|
||||
int
|
||||
argcheck(argc, argv, e_arg)
|
||||
int argc;
|
||||
char *argv[];
|
||||
@@ -774,7 +783,7 @@ enum earlyarg e_arg;
|
||||
if ((idx >= SIZE(earlyopts)) || (argc <= 1))
|
||||
return FALSE;
|
||||
|
||||
for (i = 1; i < argc; ++i) {
|
||||
for (i = 0; i < argc; ++i) {
|
||||
if (argv[i][0] != '-')
|
||||
continue;
|
||||
if (argv[i][1] == '-') {
|
||||
@@ -789,15 +798,20 @@ enum earlyarg e_arg;
|
||||
}
|
||||
|
||||
if (match) {
|
||||
const char *extended_opt = index(userea,':');
|
||||
|
||||
if (!extended_opt)
|
||||
extended_opt = index(userea, '=');
|
||||
switch(e_arg) {
|
||||
case ARG_DEBUG:
|
||||
if (extended_opt) {
|
||||
extended_opt++;
|
||||
debug_fields(extended_opt);
|
||||
}
|
||||
return 1;
|
||||
break;
|
||||
case ARG_VERSION: {
|
||||
boolean insert_into_pastebuf = FALSE;
|
||||
const char *extended_opt = index(userea,':');
|
||||
|
||||
if (!extended_opt)
|
||||
extended_opt = index(userea, '=');
|
||||
|
||||
if (extended_opt) {
|
||||
extended_opt++;
|
||||
@@ -812,7 +826,7 @@ enum earlyarg e_arg;
|
||||
}
|
||||
}
|
||||
early_version_info(insert_into_pastebuf);
|
||||
return TRUE;
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -822,4 +836,62 @@ enum earlyarg e_arg;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* These are internal controls to aid developers with
|
||||
* testing and debugging particular aspects of the code.
|
||||
* They are not player options and the only place they
|
||||
* are documented is right here. No gameplay is altered.
|
||||
*
|
||||
* test - test whether this parser is working
|
||||
* ttystatus - TTY:
|
||||
* immediateflips - WIN32: turn off display performance
|
||||
* optimization so that display output
|
||||
* can be debugged without buffering.
|
||||
*/
|
||||
void
|
||||
debug_fields(opts)
|
||||
const char *opts;
|
||||
{
|
||||
char *op;
|
||||
boolean negated = FALSE;
|
||||
|
||||
while ((op = index(opts, ',')) != 0) {
|
||||
*op++ = 0;
|
||||
/* recurse */
|
||||
debug_fields(op);
|
||||
}
|
||||
if (strlen(opts) > BUFSZ / 2)
|
||||
return;
|
||||
|
||||
|
||||
/* strip leading and trailing white space */
|
||||
while (isspace((uchar) *opts))
|
||||
opts++;
|
||||
op = eos((char *) opts);
|
||||
while (--op >= opts && isspace((uchar) *op))
|
||||
*op = '\0';
|
||||
|
||||
if (!*opts) {
|
||||
/* empty */
|
||||
return;
|
||||
}
|
||||
while ((*opts == '!') || !strncmpi(opts, "no", 2)) {
|
||||
if (*opts == '!')
|
||||
opts++;
|
||||
else
|
||||
opts += 2;
|
||||
negated = !negated;
|
||||
}
|
||||
if (match_optname(opts, "test", 4, FALSE))
|
||||
iflags.debug.test = negated ? FALSE : TRUE;
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (match_optname(opts, "ttystatus", 9, FALSE))
|
||||
iflags.debug.ttystatus = negated ? FALSE : TRUE;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
if (match_optname(opts, "immediateflips", 14, FALSE))
|
||||
iflags.debug.immediateflips = negated ? FALSE : TRUE;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
/*allmain.c*/
|
||||
|
||||
15
src/botl.c
15
src/botl.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 botl.c $NHDT-Date: 1506903619 2017/10/02 00:20:19 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.81 $ */
|
||||
/* NetHack 3.6 botl.c $NHDT-Date: 1525696908 2018/05/07 12:41:48 $ $NHDT-Branch: tty-status $:$NHDT-Revision: 1.91 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2006. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -483,14 +483,14 @@ STATIC_DCL struct istat_s initblstats[MAXBLSTATS] = {
|
||||
INIT_BLSTAT("charisma", " Ch:%s", ANY_INT, 10, BL_CH),
|
||||
INIT_BLSTAT("alignment", " %s", ANY_STR, 40, BL_ALIGN),
|
||||
INIT_BLSTAT("score", " S:%s", ANY_LONG, 20, BL_SCORE),
|
||||
INIT_BLSTAT("carrying-capacity", " %s", ANY_LONG, 20, BL_CAP),
|
||||
INIT_BLSTAT("carrying-capacity", " %s", ANY_INT, 20, BL_CAP),
|
||||
INIT_BLSTAT("gold", " %s", ANY_LONG, 30, BL_GOLD),
|
||||
INIT_BLSTATP("power", " Pw:%s", ANY_INT, 10, BL_ENEMAX, BL_ENE),
|
||||
INIT_BLSTAT("power-max", "(%s)", ANY_INT, 10, BL_ENEMAX),
|
||||
INIT_BLSTAT("experience-level", " Xp:%s", ANY_LONG, 10, BL_XP),
|
||||
INIT_BLSTAT("experience-level", " Xp:%s", ANY_INT, 10, BL_XP),
|
||||
INIT_BLSTAT("armor-class", " AC:%s", ANY_INT, 10, BL_AC),
|
||||
INIT_BLSTAT("HD", " HD:%s", ANY_INT, 10, BL_HD),
|
||||
INIT_BLSTAT("time", " T:%s", ANY_INT, 20, BL_TIME),
|
||||
INIT_BLSTAT("time", " T:%s", ANY_LONG, 20, BL_TIME),
|
||||
INIT_BLSTAT("hunger", " %s", ANY_UINT, 40, BL_HUNGER),
|
||||
INIT_BLSTATP("hitpoints", " HP:%s", ANY_INT, 10, BL_HPMAX, BL_HP),
|
||||
INIT_BLSTAT("hitpoints-max", "(%s)", ANY_INT, 10, BL_HPMAX),
|
||||
@@ -630,7 +630,7 @@ bot_via_windowport()
|
||||
|
||||
/* Experience */
|
||||
blstats[idx][BL_XP].a.a_int = u.ulevel;
|
||||
blstats[idx][BL_EXP].a.a_int = u.uexp;
|
||||
blstats[idx][BL_EXP].a.a_long = u.uexp;
|
||||
|
||||
/* Time (moves) */
|
||||
blstats[idx][BL_TIME].a.a_long = moves;
|
||||
@@ -858,7 +858,10 @@ boolean
|
||||
: TRUE;
|
||||
|
||||
fieldname = initblstats[i].fldname;
|
||||
fieldfmt = initblstats[i].fldfmt;
|
||||
if (fld == BL_TITLE && iflags.wc2_hitpointbar)
|
||||
fieldfmt = "%-30s";
|
||||
else
|
||||
fieldfmt = initblstats[i].fldfmt;
|
||||
status_enablefield(fld, fieldname, fieldfmt, fldenabled);
|
||||
}
|
||||
update_all = TRUE;
|
||||
|
||||
28
src/files.c
28
src/files.c
@@ -3542,7 +3542,7 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW;
|
||||
|
||||
/* ---------- END SCOREBOARD CREATION ----------- */
|
||||
|
||||
/* ---------- BEGIN PANIC/IMPOSSIBLE LOG ----------- */
|
||||
/* ---------- BEGIN PANIC/IMPOSSIBLE/TESTING LOG ----------- */
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
@@ -3579,7 +3579,31 @@ const char *reason; /* explanation */
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------- END PANIC/IMPOSSIBLE LOG ----------- */
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
testinglog(filenm, type, reason)
|
||||
const char *filenm; /* ad hoc file name */
|
||||
const char *type;
|
||||
const char *reason; /* explanation */
|
||||
{
|
||||
FILE *lfile;
|
||||
char fnbuf[BUFSZ];
|
||||
|
||||
if (!filenm) return;
|
||||
Strcpy(fnbuf, filenm);
|
||||
if (index(fnbuf, '.') == 0)
|
||||
Strcat(fnbuf, ".log");
|
||||
lfile = fopen_datafile(fnbuf, "a", TROUBLEPREFIX);
|
||||
if (lfile) {
|
||||
time_t now = getnow();
|
||||
int uid = getuid();
|
||||
(void) fprintf(lfile, "%s\n%s\n", type, reason);
|
||||
(void) fclose(lfile);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------- END PANIC/IMPOSSIBLE/TESTING LOG ----------- */
|
||||
|
||||
#ifdef SELF_RECOVER
|
||||
|
||||
|
||||
136
src/mapglyph.c
136
src/mapglyph.c
@@ -247,6 +247,78 @@ int glyph;
|
||||
return encbuf;
|
||||
}
|
||||
|
||||
const char *
|
||||
decode_mixed(buf, str)
|
||||
char *buf;
|
||||
const char *str;
|
||||
{
|
||||
static const char hex[] = "00112233445566778899aAbBcCdDeEfF";
|
||||
char *put = buf;
|
||||
|
||||
if (!put || !str)
|
||||
return "";
|
||||
|
||||
while (*str) {
|
||||
if (*str == '\\') {
|
||||
int rndchk, dcount, so, gv, ch = 0, oc = 0;
|
||||
unsigned os = 0;
|
||||
const char *dp, *save_str;
|
||||
|
||||
save_str = str++;
|
||||
switch (*str) {
|
||||
case 'G': /* glyph value \GXXXXNNNN*/
|
||||
rndchk = dcount = 0;
|
||||
for (++str; *str && ++dcount <= 4; ++str)
|
||||
if ((dp = index(hex, *str)) != 0)
|
||||
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
|
||||
else
|
||||
break;
|
||||
if (rndchk == context.rndencode) {
|
||||
gv = dcount = 0;
|
||||
for (; *str && ++dcount <= 4; ++str)
|
||||
if ((dp = index(hex, *str)) != 0)
|
||||
gv = (gv * 16) + ((int) (dp - hex) / 2);
|
||||
else
|
||||
break;
|
||||
so = mapglyph(gv, &ch, &oc, &os, 0, 0);
|
||||
*put++ = showsyms[so];
|
||||
/* 'str' is ready for the next loop iteration and '*str'
|
||||
should not be copied at the end of this iteration */
|
||||
continue;
|
||||
} else {
|
||||
/* possible forgery - leave it the way it is */
|
||||
str = save_str;
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case 'S': /* symbol offset */
|
||||
so = rndchk = dcount = 0;
|
||||
for (++str; *str && ++dcount <= 4; ++str)
|
||||
if ((dp = index(hex, *str)) != 0)
|
||||
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
|
||||
else
|
||||
break;
|
||||
if (rndchk == context.rndencode) {
|
||||
dcount = 0;
|
||||
for (; *str && ++dcount <= 2; ++str)
|
||||
if ((dp = index(hex, *str)) != 0)
|
||||
so = (so * 16) + ((int) (dp - hex) / 2);
|
||||
else
|
||||
break;
|
||||
}
|
||||
*put++ = showsyms[so];
|
||||
break;
|
||||
#endif
|
||||
case '\\':
|
||||
break;
|
||||
}
|
||||
}
|
||||
*put++ = *str++;
|
||||
}
|
||||
*put = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* This differs from putstr() because the str parameter can
|
||||
* contain a sequence of characters representing:
|
||||
@@ -265,71 +337,9 @@ winid window;
|
||||
int attr;
|
||||
const char *str;
|
||||
{
|
||||
static const char hex[] = "00112233445566778899aAbBcCdDeEfF";
|
||||
char buf[BUFSZ];
|
||||
const char *cp = str;
|
||||
char *put = buf;
|
||||
|
||||
while (*cp) {
|
||||
if (*cp == '\\') {
|
||||
int rndchk, dcount, so, gv, ch = 0, oc = 0;
|
||||
unsigned os = 0;
|
||||
const char *dp, *save_cp;
|
||||
|
||||
save_cp = cp++;
|
||||
switch (*cp) {
|
||||
case 'G': /* glyph value \GXXXXNNNN*/
|
||||
rndchk = dcount = 0;
|
||||
for (++cp; *cp && ++dcount <= 4; ++cp)
|
||||
if ((dp = index(hex, *cp)) != 0)
|
||||
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
|
||||
else
|
||||
break;
|
||||
if (rndchk == context.rndencode) {
|
||||
gv = dcount = 0;
|
||||
for (; *cp && ++dcount <= 4; ++cp)
|
||||
if ((dp = index(hex, *cp)) != 0)
|
||||
gv = (gv * 16) + ((int) (dp - hex) / 2);
|
||||
else
|
||||
break;
|
||||
so = mapglyph(gv, &ch, &oc, &os, 0, 0);
|
||||
*put++ = showsyms[so];
|
||||
/* 'cp' is ready for the next loop iteration and '*cp'
|
||||
should not be copied at the end of this iteration */
|
||||
continue;
|
||||
} else {
|
||||
/* possible forgery - leave it the way it is */
|
||||
cp = save_cp;
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case 'S': /* symbol offset */
|
||||
so = rndchk = dcount = 0;
|
||||
for (++cp; *cp && ++dcount <= 4; ++cp)
|
||||
if ((dp = index(hex, *cp)) != 0)
|
||||
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
|
||||
else
|
||||
break;
|
||||
if (rndchk == context.rndencode) {
|
||||
dcount = 0;
|
||||
for (; *cp && ++dcount <= 2; ++cp)
|
||||
if ((dp = index(hex, *cp)) != 0)
|
||||
so = (so * 16) + ((int) (dp - hex) / 2);
|
||||
else
|
||||
break;
|
||||
}
|
||||
*put++ = showsyms[so];
|
||||
break;
|
||||
#endif
|
||||
case '\\':
|
||||
break;
|
||||
}
|
||||
}
|
||||
*put++ = *cp++;
|
||||
}
|
||||
*put = '\0';
|
||||
/* now send it to the normal putstr */
|
||||
putstr(window, attr, buf);
|
||||
putstr(window, attr, decode_mixed(buf, str));
|
||||
}
|
||||
|
||||
/*mapglyph.c*/
|
||||
|
||||
@@ -263,7 +263,7 @@ static struct Comp_Opt {
|
||||
DISP_IN_GAME },
|
||||
{ "align_message", "message window alignment", 20, DISP_IN_GAME }, /*WC*/
|
||||
{ "align_status", "status window alignment", 20, DISP_IN_GAME }, /*WC*/
|
||||
{ "altkeyhandler", "alternate key handler", 20, DISP_IN_GAME },
|
||||
{ "altkeyhandler", "alternate key handler", 20, SET_IN_GAME },
|
||||
#ifdef BACKWARD_COMPAT
|
||||
{ "boulder", "deprecated (use S_boulder in sym file instead)", 1,
|
||||
SET_IN_GAME },
|
||||
@@ -2651,9 +2651,8 @@ boolean tinitial, tfrom_file;
|
||||
bad_negation(fullname, FALSE);
|
||||
return FALSE;
|
||||
} else if ((op = string_for_opt(opts, negated)) != 0) {
|
||||
#ifdef WIN32
|
||||
(void) strncpy(iflags.altkeyhandler, op, MAX_ALTKEYHANDLER - 5);
|
||||
load_keyboard_handler();
|
||||
#if defined(WIN32CON)
|
||||
set_altkeyhandler(op);
|
||||
#endif
|
||||
} else
|
||||
return FALSE;
|
||||
|
||||
@@ -57,12 +57,14 @@ extern void FDECL(nethack_exit, (int));
|
||||
extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
|
||||
extern int redirect_stdout; /* from sys/share/pcsys.c */
|
||||
extern int GUILaunched;
|
||||
HANDLE hStdOut;
|
||||
char *NDECL(exename);
|
||||
char default_window_sys[] = "mswin";
|
||||
#ifndef WIN32CON
|
||||
HANDLE hStdOut;
|
||||
boolean NDECL(fakeconsole);
|
||||
void NDECL(freefakeconsole);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MSWIN_GRAPHICS)
|
||||
extern void NDECL(mswin_destroy_reg);
|
||||
@@ -93,6 +95,8 @@ char *argv[];
|
||||
{
|
||||
boolean resuming;
|
||||
|
||||
nethack_enter(argc, argv);
|
||||
|
||||
sys_early_init();
|
||||
#ifdef WIN32
|
||||
Strcpy(default_window_sys, "tty");
|
||||
@@ -331,9 +335,14 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
Strcpy(hackdir, HACKDIR);
|
||||
#endif
|
||||
if (argc > 1) {
|
||||
if (argcheck(argc, argv, ARG_VERSION))
|
||||
if (argcheck(argc, argv, ARG_VERSION) == 2)
|
||||
nethack_exit(EXIT_SUCCESS);
|
||||
|
||||
if (argcheck(argc, argv, ARG_DEBUG) == 1) {
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (!strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
|
||||
/* avoid matching "-dec" for DECgraphics; since the man page
|
||||
* says -d directory, hope nobody's using -desomething_else
|
||||
@@ -353,7 +362,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
Strcpy(hackdir, dir);
|
||||
}
|
||||
if (argc > 1) {
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(WIN32CON)
|
||||
int sfd = 0;
|
||||
boolean tmpconsole = FALSE;
|
||||
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
@@ -363,7 +372,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
* may do a prscore().
|
||||
*/
|
||||
if (!strncmp(argv[1], "-s", 2)) {
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(WIN32CON)
|
||||
|
||||
#if 0
|
||||
if (!hStdOut) {
|
||||
@@ -390,7 +399,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
initoptions();
|
||||
#endif
|
||||
prscore(argc, argv);
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(WIN32CON)
|
||||
if (tmpconsole) {
|
||||
getreturn("to exit");
|
||||
freefakeconsole();
|
||||
@@ -416,7 +425,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
#endif
|
||||
nhusage();
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(WIN32CON)
|
||||
if (tmpconsole) {
|
||||
getreturn("to exit");
|
||||
freefakeconsole();
|
||||
@@ -913,7 +922,7 @@ authorize_wizard_mode()
|
||||
#define PATH_SEPARATOR '\\'
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(WIN32CON)
|
||||
static char exenamebuf[PATHLEN];
|
||||
extern HANDLE hConIn;
|
||||
extern HANDLE hConOut;
|
||||
|
||||
@@ -111,9 +111,14 @@ char *argv[];
|
||||
dir = nh_getenv("HACKDIR");
|
||||
|
||||
if (argc > 1) {
|
||||
if (argcheck(argc, argv, ARG_VERSION))
|
||||
if (argcheck(argc, argv, ARG_VERSION) == 2)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
if (argcheck(argc, argv, ARG_DEBUG) == 1) {
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (!strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
|
||||
/* avoid matching "-dec" for DECgraphics; since the man page
|
||||
* says -d directory, hope nobody's using -desomething_else
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -136,12 +136,6 @@ register char *op;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
load_keyboard_handler()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* this is used as a printf() replacement when the window
|
||||
* system isn't initialized yet
|
||||
*/
|
||||
@@ -176,4 +170,15 @@ more()
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
nethack_enter_nttty()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
set_altkeyhandler(const char *inName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* TTYSTUBS */
|
||||
|
||||
@@ -207,7 +207,7 @@ VA_DECL(const char *, s)
|
||||
/* error() may get called before tty is initialized */
|
||||
if (iflags.window_inited)
|
||||
end_screen();
|
||||
if (!strncmpi(windowprocs.name, "tty", 3)) {
|
||||
if (windowprocs.name != NULL && !strncmpi(windowprocs.name, "tty", 3)) {
|
||||
buf[0] = '\n';
|
||||
(void) vsprintf(&buf[1], s, VA_ARGS);
|
||||
Strcat(buf, "\n");
|
||||
@@ -461,6 +461,31 @@ char *buf;
|
||||
}
|
||||
#endif /* RUNTIME_PORT_ID */
|
||||
|
||||
/* ntassert_failed is called when an ntassert's condition is false */
|
||||
void ntassert_failed(const char * exp, const char * file, int line)
|
||||
{
|
||||
char message[128];
|
||||
_snprintf(message, sizeof(message),
|
||||
"NHASSERT(%s) in '%s' at line %d\n", exp, file, line);
|
||||
|
||||
if (IsDebuggerPresent()) {
|
||||
OutputDebugStringA(message);
|
||||
DebugBreak();
|
||||
}
|
||||
|
||||
// strip off the newline
|
||||
message[strlen(message) - 1] = '\0';
|
||||
error(message);
|
||||
}
|
||||
|
||||
/* nethack_enter_winnt() is the first thing called from main */
|
||||
void nethack_enter_winnt()
|
||||
{
|
||||
#ifdef WIN32CON
|
||||
nethack_enter_nttty();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
/*winnt.c*/
|
||||
|
||||
987
win/tty/wintty.c
987
win/tty/wintty.c
File diff suppressed because it is too large
Load Diff
@@ -391,10 +391,6 @@ PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
case NM_KILLFOCUS:
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "KILLFOCUS %lx\n", (unsigned long) control);
|
||||
OutputDebugStringA(buf);
|
||||
|
||||
if (data->focus == data->control_race) {
|
||||
data->focus = NULL;
|
||||
ListView_RedrawItems(data->control_race, 0, data->race_count - 1);
|
||||
@@ -406,9 +402,6 @@ PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
case NM_SETFOCUS:
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "SETFOCUS %lx\n", (unsigned long) control);
|
||||
OutputDebugStringA(buf);
|
||||
data->focus = control;
|
||||
|
||||
if (control == data->control_race) {
|
||||
@@ -716,15 +709,9 @@ plselDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
if (lpdis->itemID < 0)
|
||||
return FALSE;
|
||||
|
||||
HWND control = GetDlgItem(hWnd, wParam);
|
||||
HWND control = GetDlgItem(hWnd, (int) wParam);
|
||||
int i = lpdis->itemID;
|
||||
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "DRAW %lx %d\n", (unsigned long)control, i);
|
||||
OutputDebugStringA(buf);
|
||||
}
|
||||
|
||||
const char * string;
|
||||
|
||||
boolean ok = TRUE;
|
||||
@@ -774,12 +761,6 @@ plselDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
client_rt.left + ListView_GetColumnWidth(lpdis->hwndItem, 0),
|
||||
lpdis->rcItem.bottom);
|
||||
DrawFocusRect(lpdis->hDC, &rect);
|
||||
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "FOCUS %lx %d\n", (unsigned long)control, i);
|
||||
OutputDebugStringA(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -795,6 +795,7 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
if (!OpenClipboard(hWnd)) {
|
||||
NHMessageBox(hWnd, TEXT("Cannot open clipboard"),
|
||||
MB_OK | MB_ICONERROR);
|
||||
free(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -803,6 +804,7 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(char));
|
||||
if (hglbCopy == NULL) {
|
||||
CloseClipboard();
|
||||
free(p);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user