Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-05-25 18:36:30 -04:00
22 changed files with 782 additions and 394 deletions

View File

@@ -13,6 +13,7 @@
*
*/
#ifdef WIN32
#define NEED_VARARGS /* Uses ... */
#include "hack.h"
@@ -21,6 +22,10 @@
#include <sys\stat.h>
#include "win32api.h"
extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
extern int redirect_stdout;
#ifdef TTY_GRAPHICS
/*
* Console Buffer Flipping Support
*
@@ -84,9 +89,6 @@ INPUT_RECORD ir;
/* Support for changing console font if existing glyph widths are too wide */
extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
extern int redirect_stdout;
/* Flag for whether NetHack was launched via the GUI, not the command line.
* The reason we care at all, is so that we can get
* a final RETURN at the end of the game when launched from the GUI
@@ -1078,40 +1080,6 @@ void set_altkeyhandler(const char * inName)
return;
}
/* this is used as a printf() replacement when the window
* system isn't initialized yet
*/
void msmsg
VA_DECL(const char *, fmt)
{
char buf[ROWNO * COLNO]; /* worst case scenario */
VA_START(fmt);
VA_INIT(fmt, const char *);
Vsprintf(buf, fmt, VA_ARGS);
if (redirect_stdout)
fprintf(stdout, "%s", buf);
else {
if(!init_ttycolor_completed)
init_ttycolor();
/* if we have generated too many messages ... ask the user to
* confirm and then clear.
*/
if (console.cursor.Y > console.height - 4) {
xputs("Hit <Enter> to continue.");
while (pgetchar() != '\n')
;
raw_clear_screen();
set_console_cursor(1, 0);
}
xputs(buf);
if (ttyDisplay)
curs(BASE_WINDOW, console.cursor.X + 1, console.cursor.Y);
}
VA_END();
return;
}
/* fatal error */
/*VARARGS1*/
@@ -1912,5 +1880,43 @@ void nethack_enter_nttty()
error("Unable to load nhraykey.dll");
}
}
#endif TTY_GRAPHICS
/* this is used as a printf() replacement when the window
* system isn't initialized yet
*/
void msmsg
VA_DECL(const char *, fmt)
{
char buf[ROWNO * COLNO]; /* worst case scenario */
VA_START(fmt);
VA_INIT(fmt, const char *);
Vsprintf(buf, fmt, VA_ARGS);
if (redirect_stdout)
fprintf(stdout, "%s", buf);
else {
#ifdef TTY_GRAPHICS
if(!init_ttycolor_completed)
init_ttycolor();
/* if we have generated too many messages ... ask the user to
* confirm and then clear.
*/
if (console.cursor.Y > console.height - 4) {
xputs("Hit <Enter> to continue.");
while (pgetchar() != '\n')
;
raw_clear_screen();
set_console_cursor(1, 0);
}
xputs(buf);
if (ttyDisplay)
curs(BASE_WINDOW, console.cursor.X + 1, console.cursor.Y);
#else
fprintf(stdout, "%s", buf);
#endif
}
VA_END();
return;
}
#endif /* WIN32 */

View File

@@ -96,11 +96,13 @@ clear_screen()
return;
}
#ifdef TTY_GRAPHICS
void
backsp()
{
return;
}
#endif
int
has_color(int color)
@@ -158,11 +160,13 @@ VA_DECL(const char *, s)
return;
}
#ifdef TTY_GRAPHICS
void
synch_cursor()
{
return;
}
#endif
void
more()

View File

@@ -17,7 +17,9 @@
#endif
#include <ctype.h>
#include "win32api.h"
#ifdef TTY_GRAPHICS
#include "wintty.h"
#endif
#ifdef WIN32
/*
@@ -227,7 +229,14 @@ Delay(int ms)
(void) Sleep(ms);
}
#ifdef TTY_GRAPHICS
extern void NDECL(backsp);
#else
void
backsp()
{
}
#endif
void
win32_abort()
@@ -481,11 +490,10 @@ void ntassert_failed(const char * exp, const char * file, int line)
/* nethack_enter_winnt() is the first thing called from main */
void nethack_enter_winnt()
{
#ifdef WIN32CON
#ifdef TTY_GRAPHICS
nethack_enter_nttty();
#endif
}
#endif /* WIN32 */
/*winnt.c*/