[Pkg-nethack-devel] nethack/sys/winnt Install.nt,1.1.1.1,1.2 Makefile.bcc,1.1.1.1,1.2 Makefile.gcc,1.1.1.1,1.2 Makefile.msc,1.1.1.1,1.2 console.rc,1.1.1.1,1.2 defaults.nh,1.1.1.1,1.2 nh340key.c,1.1.1.1,1.2 nhdefkey.c,1.1.1.1,1.2 nhraykey.c,1.1.1.1,1.2 nttty.c,1.1.1.1,1.2 porthelp,1.1.1.1,1.2 winnt.c,1.1.1.1,1.2
Joshua Kwan
joshk-guest@quantz.debian.org
Tue, 09 Dec 2003 16:14:47 +0000
- Previous message: [Pkg-nethack-devel] nethack/sys/wince Install.ce,1.1.1.1,1.2 mhdlg.c,1.1.1.1,1.2 mhtxtbuf.c,1.1.1.1,1.2 winhack.rc,1.1.1.1,1.2 winhcksp.rc,1.1.1.1,1.2
- Next message: [Pkg-nethack-devel] nethack/win/Qt qt_win.cpp,1.1.1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pkg-nethack/nethack/sys/winnt
In directory quantz:/tmp/cvs-serv9687/sys/winnt
Modified Files:
Install.nt Makefile.bcc Makefile.gcc Makefile.msc console.rc
defaults.nh nh340key.c nhdefkey.c nhraykey.c nttty.c porthelp
winnt.c
Log Message:
Merge Nethack 3.4.3 upstream source.
Index: nh340key.c
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/nh340key.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nh340key.c 7 Oct 2003 19:00:38 -0000 1.1.1.1
+++ nh340key.c 9 Dec 2003 16:14:45 -0000 1.2
@@ -196,7 +196,11 @@
if (ch || iskeypad(scan) || altseq) {
done = 1; /* Stop looking */
retval = 1; /* Found what we sought */
+ } else {
+ /* Strange Key event; let's purge it to avoid trouble */
+ ReadConsoleInput(hConIn,ir,1,&count);
}
+
}
else if ((ir->EventType == MOUSE_EVENT &&
(ir->Event.MouseEvent.dwButtonState & MOUSEMASK))) {
Index: console.rc
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/console.rc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- console.rc 7 Oct 2003 19:00:37 -0000 1.1.1.1
+++ console.rc 9 Dec 2003 16:14:45 -0000 1.2
@@ -12,8 +12,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 3,4,2,0
- PRODUCTVERSION 3,4,2,0
+ FILEVERSION 3,4,3,0
+ PRODUCTVERSION 3,4,3,0
FILEFLAGSMASK 0x1fL
#ifdef _DEBUG
FILEFLAGS 0x9L
@@ -29,13 +29,13 @@
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "NetHack for Windows - TTY Interface\0"
- VALUE "FileVersion", "3.4.2\0"
+ VALUE "FileVersion", "3.4.3\0"
VALUE "InternalName", "NetHack\0"
VALUE "LegalCopyright", "Copyright (C) 1985 - 2003. By Stichting Mathematisch Centrum and M. Stephenson. See license for details.\0"
VALUE "OriginalFilename", "NetHack.exe\0"
- VALUE "PrivateBuild", "030825\0"
+ VALUE "PrivateBuild", "031014\0"
VALUE "ProductName", "NetHack\0"
- VALUE "ProductVersion", "3.4.2\0"
+ VALUE "ProductVersion", "3.4.3\0"
END
END
BLOCK "VarFileInfo"
Index: Makefile.msc
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/Makefile.msc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile.msc 7 Oct 2003 19:00:38 -0000 1.1.1.1
+++ Makefile.msc 9 Dec 2003 16:14:44 -0000 1.2
@@ -469,6 +469,7 @@
! IF ("$(USE_DLB)"=="Y")
copy nhdat $(GAMEDIR)
copy $(DAT)\license $(GAMEDIR)
+ copy $(DAT)\opthelp $(GAMEDIR)
! ELSE
copy $(DAT)\*. $(GAMEDIR)
copy $(DAT)\*.dat $(GAMEDIR)
@@ -1321,7 +1322,7 @@
$(O)dog.o: dog.c $(HACK_H) $(INCL)\edog.h
$(O)dogmove.o: dogmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
$(O)dokick.o: dokick.c $(HACK_H) $(INCL)\eshk.h
-$(O)dothrow.o: dothrow.c $(HACK_H)
+$(O)dothrow.o: dothrow.c $(HACK_H) $(INCL)\edog.h
$(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h
$(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
$(O)eat.o: eat.c $(HACK_H)
Index: Install.nt
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/Install.nt,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Install.nt 7 Oct 2003 19:00:37 -0000 1.1.1.1
+++ Install.nt 9 Dec 2003 16:14:44 -0000 1.2
@@ -15,7 +15,7 @@
The PC Windows porting team consisting of Michael Allison, David Cohrs,
Alex Kompel, Dion Nicolaas, Yitzhak Sapir, and Janet Walz maintained the
-tty and graphical win32 versions of NetHack 3.4.2.
+tty and graphical win32 versions of NetHack 3.4.3.
You can build either the TTY version of NetHack or the Windows Graphical
version. In either case you can use one of the following build
@@ -426,10 +426,10 @@
If you will be running it by launching it from a shortcut, just use
the following information when setting up the shortcut.
- Description : NetHack 3.4.2 Console version
+ Description : NetHack 3.4.3 Console version
Command Line : C:\NETHACK\BINARY\NETHACK.EXE
- Description : NetHack 3.4.2 Graphical Interface
+ Description : NetHack 3.4.3 Graphical Interface
Command Line : C:\NETHACK\BINARY\NETHACKW.EXE
(changing the directory to the appropriate one of course)
Index: defaults.nh
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/defaults.nh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- defaults.nh 7 Oct 2003 19:00:37 -0000 1.1.1.1
+++ defaults.nh 9 Dec 2003 16:14:45 -0000 1.2
@@ -50,10 +50,8 @@
# Note: the rest_on_space in the next line may not be
# appropriate for a beginning NetHack player, since
# it could result in use of a turn unintentionally.
-# If you're new to NetHack, comment it out. It is
-# being left in to keep the sample config file the
-# same as it was in past releases.
-OPTIONS=rest_on_space
+# If you're new to NetHack, leave it commented it out.
+#OPTIONS=rest_on_space
#
# Set some options to control graphical window-port (these will
# be safely and silently ignored by the tty port)
Index: nttty.c
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/nttty.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nttty.c 7 Oct 2003 19:00:38 -0000 1.1.1.1
+++ nttty.c 9 Dec 2003 16:14:45 -0000 1.2
@@ -3,8 +3,11 @@
/* NetHack may be freely redistributed. See license for details. */
/* tty.c - (Windows NT) version */
+
/*
- * Initial Creation M. Allison 93/01/31
+ * Initial Creation M. Allison 1993/01/31
+ * Switch to low level console output routines M. Allison 2003/10/01
+ * Restrict cursor movement until input pending M. Lehotay 2003/10/02
*
*/
@@ -32,7 +35,8 @@
* SetConsoleCtrlHandler
* PeekConsoleInput
* ReadConsoleInput
- * WriteConsole
+ * WriteConsoleOutputCharacter
+ * FillConsoleOutputAttribute
*/
/* Win32 Console handles for input and output */
@@ -54,6 +58,12 @@
int GUILaunched;
static BOOL FDECL(CtrlHandler, (DWORD));
+#ifdef PORT_DEBUG
+static boolean display_cursor_info = FALSE;
+#endif
+
+extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
+
/* dynamic keystroke handling .DLL support */
typedef int (__stdcall * PROCESS_KEYSTROKE)(
HANDLE,
@@ -106,25 +116,20 @@
# ifdef TEXTCOLOR
static void NDECL(init_ttycolor);
# endif
+static void NDECL(really_move_cursor);
#define MAX_OVERRIDES 256
unsigned char key_overrides[MAX_OVERRIDES];
-#define DEFTEXTCOLOR ttycolors[7]
-#ifdef TEXTCOLOR
-#define DEFGLYPHBGRND (0)
-#else
-#define DEFGLYPHBGRND (0)
-#endif
-
static char nullstr[] = "";
char erase_char,kill_char;
-static char currentcolor = FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE;
-static char noninvertedcurrentcolor = FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE;
-static char currenthilite = 0;
-static char currentbackground = 0;
-static boolean colorchange = TRUE;
+#define DEFTEXTCOLOR ttycolors[7]
+static WORD background = 0;
+static WORD foreground = (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
+static WORD attr = (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
+static DWORD ccount, acount;
+static COORD cursor = {0,0};
/*
* Called after returning from ! or ^Z
@@ -151,42 +156,11 @@
settty(s)
const char *s;
{
+ cmov(ttyDisplay->curx, ttyDisplay->cury);
end_screen();
if(s) raw_print(s);
}
-/*
- * mode == 0 set processed console output mode.
- * mode == 1 set raw console output mode (no control character expansion).
- */
-void
-set_output_mode(mode)
-int mode;
-{
- static DWORD save_output_cmode = 0;
- static boolean initmode = FALSE;
- DWORD cmode, mask = ENABLE_PROCESSED_OUTPUT;
- if (!initmode) {
- /* fetch original output mode */
- GetConsoleMode(hConOut,&save_output_cmode);
- initmode = TRUE;
- }
- if (mode == 0) {
- cmode = save_output_cmode;
- /* Turn ON the settings specified in the mask */
- cmode |= mask;
- SetConsoleMode(hConOut,cmode);
- iflags.rawio = 0;
- } else {
- cmode = save_output_cmode;
- /* Turn OFF the settings specified in the mask */
- cmode &= ~mask;
- SetConsoleMode(hConOut,cmode);
- iflags.rawio = 1;
- }
-}
-
-
/* called by init_nhwindows() and resume_nhwindows() */
void
setftty()
@@ -198,7 +172,6 @@
tty_startup(wid, hgt)
int *wid, *hgt;
{
-/* int twid = origcsbi.dwSize.X; */
int twid = origcsbi.srWindow.Right - origcsbi.srWindow.Left + 1;
if (twid > 80) twid = 80;
@@ -223,6 +196,7 @@
tty_end_screen()
{
clear_screen();
+ really_move_cursor();
if (GetConsoleScreenBufferInfo(hConOut,&csbi))
{
DWORD ccnt;
@@ -241,8 +215,6 @@
FlushConsoleInputBuffer(hConIn);
}
-extern boolean getreturn_disable; /* from sys/share/pcsys.c */
-
static BOOL CtrlHandler(ctrltype)
DWORD ctrltype;
{
@@ -253,8 +225,7 @@
case CTRL_CLOSE_EVENT:
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT:
- set_output_mode(0); /* Allow processed output */
- getreturn_disable = TRUE;
+ getreturn_enabled = FALSE;
#ifndef NOSAVEONHANGUP
hangup(0);
#endif
@@ -293,10 +264,11 @@
(origcsbi.dwCursorPosition.Y == 0));
if ((origcsbi.dwSize.X <= 0) || (origcsbi.dwSize.Y <= 0))
GUILaunched = 0;
+
+ /* Obtain handles for the standard Console I/O devices */
hConIn = GetStdHandle(STD_INPUT_HANDLE);
hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
#if 0
- /* Obtain handles for the standard Console I/O devices */
hConIn = CreateFile("CONIN$",
GENERIC_READ |GENERIC_WRITE,
FILE_SHARE_READ |FILE_SHARE_WRITE,
@@ -306,6 +278,7 @@
FILE_SHARE_READ |FILE_SHARE_WRITE,
0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,0);
#endif
+
GetConsoleMode(hConIn,&cmode);
#ifdef NO_MOUSE_ALLOWED
mask = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
@@ -320,13 +293,13 @@
cmode |= ENABLE_MOUSE_INPUT;
#endif
SetConsoleMode(hConIn,cmode);
-
- set_output_mode(1); /* raw output mode; no tab expansion */
if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE)) {
/* Unable to set control handler */
cmode = 0; /* just to have a statement to break on for debugger */
}
get_scr_size();
+ cursor.X = cursor.Y = 0;
+ really_move_cursor();
}
int process_keystroke(ir, valid, numberpad, portdebug)
@@ -354,8 +327,8 @@
{
GetConsoleScreenBufferInfo(hConOut, &csbi);
- LI = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
- CO = csbi.srWindow.Right - csbi.srWindow.Left + 1;
+ LI = csbi.srWindow.Bottom - (csbi.srWindow.Top + 1);
+ CO = csbi.srWindow.Right - (csbi.srWindow.Left + 1);
if ( (LI < 25) || (CO < 80) ) {
COORD newcoord;
@@ -376,6 +349,7 @@
int mod;
coord cc;
DWORD count;
+ really_move_cursor();
return pCheckInput(hConIn, &ir, &count, iflags.num_pad, 0, &mod, &cc);
}
@@ -386,6 +360,7 @@
int ch;
coord cc;
DWORD count;
+ really_move_cursor();
ch = pCheckInput(hConIn, &ir, &count, iflags.num_pad, 1, mod, &cc);
if (!ch) {
*x = cc.x;
@@ -394,97 +369,127 @@
return ch;
}
-void
-nocmov(x, y)
-int x,y;
+static void
+really_move_cursor()
{
- ntcoord.X = x;
- ntcoord.Y = y;
- SetConsoleCursorPosition(hConOut,ntcoord);
+#if defined(PORT_DEBUG) && defined(WIZARD)
+ char oldtitle[BUFSZ], newtitle[BUFSZ];
+ if (display_cursor_info && wizard) {
+ oldtitle[0] = '\0';
+ if (GetConsoleTitle(oldtitle, BUFSZ)) {
+ oldtitle[39] = '\0';
+ }
+ Sprintf(newtitle, "%-55s tty=(%02d,%02d) nttty=(%02d,%02d)",
+ oldtitle, ttyDisplay->curx, ttyDisplay->cury,
+ cursor.X, cursor.Y);
+ (void)SetConsoleTitle(newtitle);
+ }
+#endif
+ if (ttyDisplay) {
+ cursor.X = ttyDisplay->curx;
+ cursor.Y = ttyDisplay->cury;
+ }
+ SetConsoleCursorPosition(hConOut, cursor);
}
void
cmov(x, y)
register int x, y;
{
- ntcoord.X = x;
- ntcoord.Y = y;
- SetConsoleCursorPosition(hConOut,ntcoord);
ttyDisplay->cury = y;
ttyDisplay->curx = x;
+ cursor.X = x;
+ cursor.Y = y;
}
void
-xputc(c)
-char c;
+nocmov(x, y)
+int x,y;
{
- DWORD count;
+ cursor.X = x;
+ cursor.Y = y;
+ ttyDisplay->curx = x;
+ ttyDisplay->cury = y;
+}
- switch(c) {
+void
+xputc_core(ch)
+char ch;
+{
+ switch(ch) {
case '\n':
+ cursor.Y++;
+ /* fall through */
case '\r':
- cmov(ttyDisplay->curx, ttyDisplay->cury);
- return;
- }
- if (colorchange) {
- SetConsoleTextAttribute(hConOut,
- (currentcolor | currenthilite | currentbackground));
- colorchange = FALSE;
+ cursor.X = 1;
+ break;
+ case '\b':
+ cursor.X--;
+ break;
+ default:
+ WriteConsoleOutputAttribute(hConOut,&attr,1,
+ cursor,&acount);
+ WriteConsoleOutputCharacter(hConOut,&ch,1,
+ cursor,&ccount);
+ cursor.X++;
}
- WriteConsole(hConOut,&c,1,&count,0);
+}
+
+void
+xputc(ch)
+char ch;
+{
+ cursor.X = ttyDisplay->curx;
+ cursor.Y = ttyDisplay->cury;
+ xputc_core(ch);
}
void
xputs(s)
const char *s;
{
- DWORD count;
- if (colorchange) {
- SetConsoleTextAttribute(hConOut,
- (currentcolor | currenthilite | currentbackground));
- colorchange = FALSE;
+ int k;
+ int slen = strlen(s);
+
+ if (ttyDisplay) {
+ cursor.X = ttyDisplay->curx;
+ cursor.Y = ttyDisplay->cury;
+ }
+
+ if (s) {
+ for (k=0; k < slen && s[k]; ++k)
+ xputc_core(s[k]);
}
- WriteConsole(hConOut,s,strlen(s),&count,0);
}
+
/*
- * Overrides winntty.c function of the same name
+ * Overrides wintty.c function of the same name
* for win32. It is used for glyphs only, not text.
*/
void
g_putch(in_ch)
int in_ch;
{
- char ch = (char)in_ch;
- DWORD count = 1;
- int tcolor;
- int bckgnd = currentbackground;
+ char ch = (char)in_ch;
- if (colorchange) {
- tcolor = currentcolor | bckgnd | currenthilite;
- SetConsoleTextAttribute(hConOut, tcolor);
- }
- WriteConsole(hConOut,&ch,1,&count,0);
- colorchange = TRUE; /* force next output back to current nethack values */
- return;
+ cursor.X = ttyDisplay->curx;
+ cursor.Y = ttyDisplay->cury;
+ WriteConsoleOutputAttribute(hConOut,&attr,1,cursor,&acount);
+ WriteConsoleOutputCharacter(hConOut,&ch,1,cursor,&ccount);
}
void
cl_end()
{
- DWORD count;
-
- ntcoord.X = ttyDisplay->curx;
- ntcoord.Y = ttyDisplay->cury;
- FillConsoleOutputAttribute(hConOut, DEFTEXTCOLOR,
- CO - ntcoord.X,ntcoord, &count);
- ntcoord.X = ttyDisplay->curx;
- ntcoord.Y = ttyDisplay->cury;
- FillConsoleOutputCharacter(hConOut,' ',
- CO - ntcoord.X,ntcoord,&count);
- tty_curs(BASE_WINDOW, (int)ttyDisplay->curx+1,
- (int)ttyDisplay->cury);
- colorchange = TRUE;
+ int cx;
+ cursor.X = ttyDisplay->curx;
+ cursor.Y = ttyDisplay->cury;
+ cx = CO - cursor.X;
+ FillConsoleOutputAttribute(hConOut, DEFTEXTCOLOR, cx, cursor, &acount);
+ FillConsoleOutputCharacter(hConOut,' ', cx, cursor,&ccount);
+ tty_curs(BASE_WINDOW, (int)ttyDisplay->curx+1,
+ (int)ttyDisplay->cury);
}
@@ -501,13 +506,10 @@
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
csbi.dwSize.X * csbi.dwSize.Y,
newcoord, &ccnt);
- newcoord.X = 0;
- newcoord.Y = 0;
FillConsoleOutputCharacter(hConOut,' ',
csbi.dwSize.X * csbi.dwSize.Y,
newcoord, &ccnt);
}
- colorchange = TRUE;
home();
}
@@ -515,7 +517,7 @@
void
home()
{
- tty_curs(BASE_WINDOW, 1, 0);
+ cursor.X = cursor.Y = 0;
ttyDisplay->curx = ttyDisplay->cury = 0;
}
@@ -523,17 +525,30 @@
void
backsp()
{
- GetConsoleScreenBufferInfo(hConOut,&csbi);
- if (csbi.dwCursorPosition.X > 0)
- ntcoord.X = csbi.dwCursorPosition.X-1;
- ntcoord.Y = csbi.dwCursorPosition.Y;
- SetConsoleCursorPosition(hConOut,ntcoord);
- /* colorchange shouldn't ever happen here but.. */
- if (colorchange) {
- SetConsoleTextAttribute(hConOut,
- (currentcolor|currenthilite|currentbackground));
- colorchange = FALSE;
+ cursor.X = ttyDisplay->curx;
+ cursor.Y = ttyDisplay->cury;
+ xputc_core('\b');
+}
+
+void
+cl_eos()
+{
+ int cy = ttyDisplay->cury+1;
+ if (GetConsoleScreenBufferInfo(hConOut,&csbi)) {
+ DWORD ccnt;
+ COORD newcoord;
+
+ newcoord.X = ttyDisplay->curx;
+ newcoord.Y = ttyDisplay->cury;
+ FillConsoleOutputAttribute(hConOut,
+ FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
+ csbi.dwSize.X * csbi.dwSize.Y - cy,
+ newcoord, &ccnt);
+ FillConsoleOutputCharacter(hConOut,' ',
+ csbi.dwSize.X * csbi.dwSize.Y - cy,
+ newcoord, &ccnt);
}
+ tty_curs(BASE_WINDOW, (int)ttyDisplay->curx+1, (int)ttyDisplay->cury);
}
void
@@ -558,41 +573,6 @@
}
}
-void
-cl_eos()
-{
- register int cy = ttyDisplay->cury+1;
-#if 0
- while(cy <= LI-2) {
- cl_end();
- xputc('\n');
- cy++;
- }
- cl_end();
-#else
- if (GetConsoleScreenBufferInfo(hConOut,&csbi)) {
- DWORD ccnt;
- COORD newcoord;
-
- newcoord.X = 0;
- newcoord.Y = ttyDisplay->cury;
- FillConsoleOutputAttribute(hConOut,
- FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
- csbi.dwSize.X * csbi.dwSize.Y - cy,
- newcoord, &ccnt);
- newcoord.X = 0;
- newcoord.Y = ttyDisplay->cury;
- FillConsoleOutputCharacter(hConOut,' ',
- csbi.dwSize.X * csbi.dwSize.Y - cy,
- newcoord, &ccnt);
- }
- colorchange = TRUE;
-#endif
- tty_curs(BASE_WINDOW, (int)ttyDisplay->curx+1,
- (int)ttyDisplay->cury);
-}
-
-
# ifdef TEXTCOLOR
/*
* CLR_BLACK 0
@@ -622,7 +602,7 @@
ttycolors[CLR_RED] = FOREGROUND_RED;
ttycolors[CLR_GREEN] = FOREGROUND_GREEN;
ttycolors[CLR_BROWN] = FOREGROUND_GREEN|FOREGROUND_RED;
- ttycolors[CLR_BLUE] = FOREGROUND_BLUE|FOREGROUND_INTENSITY;
+ ttycolors[CLR_BLUE] = FOREGROUND_BLUE;
ttycolors[CLR_MAGENTA] = FOREGROUND_BLUE|FOREGROUND_RED;
ttycolors[CLR_CYAN] = FOREGROUND_GREEN|FOREGROUND_BLUE;
ttycolors[CLR_GRAY] = FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE;
@@ -635,7 +615,8 @@
ttycolors[CLR_BRIGHT_BLUE] = FOREGROUND_BLUE|FOREGROUND_INTENSITY;
ttycolors[CLR_BRIGHT_MAGENTA] = FOREGROUND_BLUE|FOREGROUND_RED|\
FOREGROUND_INTENSITY;
- ttycolors[CLR_BRIGHT_CYAN] = FOREGROUND_GREEN|FOREGROUND_BLUE;
+ ttycolors[CLR_BRIGHT_CYAN] = FOREGROUND_GREEN|FOREGROUND_BLUE|\
+ FOREGROUND_INTENSITY;
ttycolors[CLR_WHITE] = FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED|\
FOREGROUND_INTENSITY;
}
@@ -657,111 +638,97 @@
}
void
-term_start_attr(int attr)
+term_start_attr(int attrib)
{
- switch(attr){
+ switch(attrib){
case ATR_INVERSE:
if (iflags.wc_inverse) {
- noninvertedcurrentcolor = currentcolor;
/* Suggestion by Lee Berger */
- if ((currentcolor & (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED)) ==
+ if ((foreground & (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED)) ==
(FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED))
- currentcolor = 0;
- currentbackground = (BACKGROUND_RED|BACKGROUND_BLUE|BACKGROUND_GREEN);
- colorchange = TRUE;
+ foreground &= ~(FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
+ background = (BACKGROUND_RED|BACKGROUND_BLUE|BACKGROUND_GREEN);
break;
- } /* else */
+ }
/*FALLTHRU*/
case ATR_ULINE:
- case ATR_BOLD:
case ATR_BLINK:
- standoutbeg();
+ case ATR_BOLD:
+ foreground |= FOREGROUND_INTENSITY;
break;
default:
-#ifdef DEBUG
- impossible("term_start_attr: strange attribute %d", attr);
-#endif
- standoutend();
- if (currentcolor == 0)
- currentcolor = FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED;
- currentbackground = 0;
+ foreground &= ~FOREGROUND_INTENSITY;
break;
}
+ attr = (foreground | background);
}
void
-term_end_attr(int attr)
+term_end_attr(int attrib)
{
- switch(attr){
+ switch(attrib){
case ATR_INVERSE:
- if (iflags.wc_inverse) {
- if (currentcolor == 0 && noninvertedcurrentcolor != 0)
- currentcolor = noninvertedcurrentcolor;
- noninvertedcurrentcolor = 0;
- currentbackground = 0;
- colorchange = TRUE;
- break;
- } /* else */
- /*FALLTHRU*/
+ if ((foreground & (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED)) == 0)
+ foreground |= (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
+ background = 0;
+ break;
case ATR_ULINE:
- case ATR_BOLD:
case ATR_BLINK:
- default:
- standoutend();
- if (currentcolor == 0)
- currentcolor = FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED;
- currentbackground = 0;
- break;
+ case ATR_BOLD:
+ foreground &= ~FOREGROUND_INTENSITY;
+ break;
}
+ attr = (foreground | background);
}
void
term_end_raw_bold(void)
{
- standoutend();
+ term_end_attr(ATR_BOLD);
}
void
term_start_raw_bold(void)
{
- standoutbeg();
+ term_start_attr(ATR_BOLD);
}
void
term_start_color(int color)
{
-# ifdef TEXTCOLOR
+#ifdef TEXTCOLOR
if (color >= 0 && color < CLR_MAX) {
- currentcolor = ttycolors[color];
- colorchange = TRUE;
+ foreground = (background != 0 && (color == CLR_GRAY || color == CLR_WHITE)) ?
+ ttycolors[0] : ttycolors[color];
}
-# endif
+#else
+ foreground = DEFTEXTCOLOR;
+#endif
+ attr = (foreground | background);
}
void
term_end_color(void)
{
-# ifdef TEXTCOLOR
- currentcolor = DEFTEXTCOLOR;
- colorchange = TRUE;
-# endif
+#ifdef TEXTCOLOR
+ foreground = DEFTEXTCOLOR;
+#endif
+ attr = (foreground | background);
}
void
standoutbeg()
{
- currenthilite = FOREGROUND_INTENSITY;
- colorchange = TRUE;
+ term_start_attr(ATR_BOLD);
}
void
standoutend()
{
- currenthilite = 0;
- colorchange = TRUE;
+ term_end_attr(ATR_BOLD);
}
#ifndef NO_MOUSE_ALLOWED
@@ -799,6 +766,7 @@
int ch;
xputs("\n");
while (!valid || ch != 27) {
+ nocmov(ttyDisplay->curx, ttyDisplay->cury);
ReadConsoleInput(hConIn,&ir,1,&count);
if ((ir.EventType == KEY_EVENT) && ir.Event.KeyEvent.bKeyDown)
ch = process_keystroke(&ir, &valid, iflags.num_pad, 1);
@@ -833,6 +801,11 @@
(void)doredraw();
}
}
+
+void win32con_toggle_cursor_info()
+{
+ display_cursor_info = !display_cursor_info;
+}
#endif
void
@@ -948,4 +921,41 @@
}
}
+/* 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);
+ VA_END();
+ xputs(buf);
+ if (ttyDisplay) curs(BASE_WINDOW, cursor.X+1, cursor.Y);
+ return;
+}
+
+/* fatal error */
+/*VARARGS1*/
+void
+error VA_DECL(const char *,s)
+ char buf[BUFSZ];
+ VA_START(s);
+ VA_INIT(s, const char *);
+ /* error() may get called before tty is initialized */
+ if (iflags.window_inited) end_screen();
+ buf[0] = '\n';
+ (void) vsprintf(&buf[1], s, VA_ARGS);
+ VA_END();
+ msmsg(buf);
+ really_move_cursor();
+ exit(EXIT_FAILURE);
+}
+
+void
+synch_cursor()
+{
+ really_move_cursor();
+}
#endif /* WIN32CON */
Index: Makefile.gcc
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/Makefile.gcc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile.gcc 7 Oct 2003 19:00:37 -0000 1.1.1.1
+++ Makefile.gcc 9 Dec 2003 16:14:44 -0000 1.2
@@ -498,6 +498,7 @@
ifeq "$(USE_DLB)" "Y"
$(subst /,\,copy nhdat $(GAMEDIR))
$(subst /,\,copy $(DAT)/license $(GAMEDIR))
+ $(subst /,\,copy $(DAT)/opthelp $(GAMEDIR))
else
$(subst /,\,copy $(DAT)/*. $(GAMEDIR))
$(subst /,\,copy $(DAT)/*.dat $(GAMEDIR))
@@ -1254,7 +1255,7 @@
$(O)dog.o: dog.c $(HACK_H) $(INCL)/edog.h
$(O)dogmove.o: dogmove.c $(HACK_H) $(INCL)/mfndpos.h $(INCL)/edog.h
$(O)dokick.o: dokick.c $(HACK_H) $(INCL)/eshk.h
-$(O)dothrow.o: dothrow.c $(HACK_H)
+$(O)dothrow.o: dothrow.c $(HACK_H) $(INCL)/edog.h
$(O)drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.h
$(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h
$(O)eat.o: eat.c $(HACK_H)
Index: winnt.c
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/winnt.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- winnt.c 7 Oct 2003 19:00:38 -0000 1.1.1.1
+++ winnt.c 9 Dec 2003 16:14:45 -0000 1.2
@@ -17,7 +17,9 @@
#endif
#include <ctype.h>
#include "win32api.h"
-
+#ifdef WIN32CON
+#include "wintty.h"
+#endif
#ifdef WIN32
@@ -195,22 +197,22 @@
}
# endif
-
+#ifndef WIN32CON
/* fatal error */
/*VARARGS1*/
-
void
error VA_DECL(const char *,s)
+ char buf[BUFSZ];
VA_START(s);
VA_INIT(s, const char *);
/* error() may get called before tty is initialized */
if (iflags.window_inited) end_screen();
if (!strncmpi(windowprocs.name, "tty", 3)) {
- putchar('\n');
- Vprintf(s,VA_ARGS);
- putchar('\n');
+ buf[0] = '\n';
+ (void) vsprintf(&buf[1], s, VA_ARGS);
+ Strcat(buf, "\n");
+ msmsg(buf);
} else {
- char buf[BUFSZ];
(void) vsprintf(buf, s, VA_ARGS);
Strcat(buf, "\n");
raw_printf(buf);
@@ -218,20 +220,104 @@
VA_END();
exit(EXIT_FAILURE);
}
+#endif
void Delay(int ms)
{
(void)Sleep(ms);
}
+#ifdef WIN32CON
+extern void NDECL(backsp);
+#endif
+
void win32_abort()
{
-
#ifdef WIZARD
- if (wizard)
- DebugBreak();
+ if (wizard) {
+# ifdef WIN32CON
+ int c, ci, ct;
+
+ if (!iflags.window_inited)
+ c = 'n';
+ ct = 0;
+ msmsg("Execute debug breakpoint wizard?");
+ while ((ci=nhgetch()) != '\n') {
+ if (ct > 0) {
+ backsp(); /* \b is visible on NT */
+ (void) putchar(' ');
+ backsp();
+ ct = 0;
+ c = 'n';
+ }
+ if (ci == 'y' || ci == 'n' || ci == 'Y' || ci == 'N') {
+ ct = 1;
+ c = ci;
+ msmsg("%c",c);
+ }
+ }
+ if (c == 'y')
+ DebugBreak();
+# endif
+ }
#endif
abort();
+}
+
+static char interjection_buf[INTERJECTION_TYPES][1024];
+static int interjection[INTERJECTION_TYPES];
+
+void
+interject_assistance(num, interjection_type, ptr1, ptr2)
+int num;
+int interjection_type;
+genericptr_t ptr1;
+genericptr_t ptr2;
+{
+ switch(num) {
+ case 1: {
+ char *panicmsg = (char *)ptr1;
+ char *datadir = (char *)ptr2;
+ char *tempdir = nh_getenv("TEMP");
+ interjection_type = INTERJECT_PANIC;
+ interjection[INTERJECT_PANIC] = 1;
+ /*
+ * ptr1 = the panic message about to be delivered.
+ * ptr2 = the directory prefix of the dungeon file
+ * that failed to open.
+ * Check to see if datadir matches tempdir or a
+ * common windows temp location. If it does, inform
+ * the user that they are probably trying to run the
+ * game from within their unzip utility, so the required
+ * files really don't exist at the location. Instruct
+ * them to unpack them first.
+ */
+ if (panicmsg && datadir) {
+ if (!strncmpi(datadir, "C:\\WINDOWS\\TEMP", 15) ||
+ strstri(datadir, "TEMP") ||
+ (tempdir && strstri(datadir, tempdir))) {
+ (void)strncpy(interjection_buf[INTERJECT_PANIC],
+ "\nOne common cause of this error is attempting to execute\n"
+ "the game by double-clicking on it while it is displayed\n"
+ "inside an unzip utility.\n\n"
+ "You have to unzip the contents of the zip file into a\n"
+ "folder on your system, and then run \"NetHack.exe\" or \n"
+ "\"NetHackW.exe\" from there.\n\n"
+ "If that is not the situation, you are encouraged to\n"
+ "report the error as shown above.\n\n", 1023);
+ }
+ }
+ }
+ break;
+ }
+}
+
+void
+interject(interjection_type)
+int interjection_type;
+{
+ if (interjection_type >= 0 && interjection_type < INTERJECTION_TYPES)
+ msmsg(interjection_buf[interjection_type]);
}
#endif /* WIN32 */
Index: nhdefkey.c
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/nhdefkey.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nhdefkey.c 7 Oct 2003 19:00:38 -0000 1.1.1.1
+++ nhdefkey.c 9 Dec 2003 16:14:45 -0000 1.2
@@ -228,7 +228,11 @@
if (ch || iskeypad(scan) || altseq) {
done = 1; /* Stop looking */
retval = 1; /* Found what we sought */
+ } else {
+ /* Strange Key event; let's purge it to avoid trouble */
+ ReadConsoleInput(hConIn,ir,1,&count);
}
+
}
else if ((ir->EventType == MOUSE_EVENT &&
(ir->Event.MouseEvent.dwButtonState & MOUSEMASK))) {
Index: nhraykey.c
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/nhraykey.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- nhraykey.c 7 Oct 2003 19:00:38 -0000 1.1.1.1
+++ nhraykey.c 9 Dec 2003 16:14:45 -0000 1.2
@@ -545,7 +545,11 @@
if (ch || iskeypad(scan) || altseq) {
done = 1; /* Stop looking */
retval = 1; /* Found what we sought */
+ } else {
+ /* Strange Key event; let's purge it to avoid trouble */
+ ReadConsoleInput(hConIn,ir,1,&count);
}
+
}
else if ((ir->EventType == MOUSE_EVENT &&
(ir->Event.MouseEvent.dwButtonState & MOUSEMASK))) {
Index: Makefile.bcc
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/Makefile.bcc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile.bcc 7 Oct 2003 19:00:37 -0000 1.1.1.1
+++ Makefile.bcc 9 Dec 2003 16:14:44 -0000 1.2
@@ -2,7 +2,7 @@
# Copyright (c) NetHack PC Development Team 1993-2003
#
#
-# IMPORTANT NOTE: This Makefile has not been tested for 3.4.2.
+# IMPORTANT NOTE: This Makefile has not been tested for 3.4.3.
#
#
# NetHack 3.4.x Makefile for Borland C++ V5.5.1 and above and Borland's MAKE
@@ -534,6 +534,7 @@
! IF ("$(USE_DLB)"=="Y")
copy nhdat $(GAMEDIR)
copy $(DAT)\license $(GAMEDIR)
+ copy $(DAT)\opthelp $(GAMEDIR)
! ELSE
copy $(DAT)\*. $(GAMEDIR)
copy $(DAT)\*.dat $(GAMEDIR)
@@ -1280,7 +1281,7 @@
$(O)dog.o: dog.c $(HACK_H) $(INCL)\edog.h
$(O)dogmove.o: dogmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
$(O)dokick.o: dokick.c $(HACK_H) $(INCL)\eshk.h
-$(O)dothrow.o: dothrow.c $(HACK_H)
+$(O)dothrow.o: dothrow.c $(HACK_H) $(INCL)\edog.h
$(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h
$(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
$(O)eat.o: eat.c $(HACK_H)
Index: porthelp
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/sys/winnt/porthelp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- porthelp 7 Oct 2003 19:00:38 -0000 1.1.1.1
+++ porthelp 9 Dec 2003 16:14:45 -0000 1.2
@@ -1,7 +1,7 @@
- Microsoft Windows specific help file for NetHack 3.4.2
+ Microsoft Windows specific help file for NetHack 3.4.3
Copyright (c) NetHack PC Development Team 1993-2002.
NetHack may be freely distributed. See license for details.
- (Last Revision: March 16, 2002)
+ (Last Revision: October 14, 2003)
This file details specifics for NetHack built for Windows 95, 98, NT,
Me, 2000, and XP. Users of really early 16-bit Windows versions should
@@ -242,7 +242,7 @@
the map_mode option.
Window Settings - Changes your logged-on user's settings for NetHack.
-In 3.4.2, only one setting is available: NetHack mode, which can be
+In 3.4.3, only one setting is available: NetHack mode, which can be
checked or unchecked. NetHack mode allows you to use the ALT key for
game key commands [see list above]. You can use F10 to access the
menu bar while in NetHack mode. You can also clear your logged-on
- Previous message: [Pkg-nethack-devel] nethack/sys/wince Install.ce,1.1.1.1,1.2 mhdlg.c,1.1.1.1,1.2 mhtxtbuf.c,1.1.1.1,1.2 winhack.rc,1.1.1.1,1.2 winhcksp.rc,1.1.1.1,1.2
- Next message: [Pkg-nethack-devel] nethack/win/Qt qt_win.cpp,1.1.1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]