| wraptext | WC2_WRAPTEXT | wc2_wraptext |boolean |
| selectsaved | WC2_SELECTSAVED | wc2_selectsaved |boolean |
| hitpointbar | WC2_HITPOINTBAR | wc2_hitpointbar |boolean |
+ | term_cols | WC2_TERM_COLS | wc2_term_cols |int |
+ | term_rows | WC2_TERM_ROWS | wc2_term_rows |int |
+ | windowborders | WC2_WINDOWBORDERS | wc2_windowborders |int |
+--------------------+--------------------+--------------------+--------+
more wincap2 for STATUS_HILITES support and control
selectsaved -- if port can display a menu of the user's saved games do so.
softkeyboard -- handhelds should display an on-screen keyboard if possible.
splash_screen -- port should/should not display an opening splashscreen.
+term_cols -- Terminal should size itself to specified width, if possible.
+term_rows -- Terminal should size itself to specified height, if possible.
tiled_map -- port should display a tiled map if it can.
tile_width -- port should display tiles with this width or round to closest
if it can.
use_inverse -- port should display inverse when NetHack asks for it.
vary_msgcount -- port should display this number of messages at a time in
the message window.
+windowborders -- port should display borders around main NetHack windows.
+ Can be set to (1) on, (2) off, or (3) auto.
windowcolors
-- port should use these colors for window foreground/background
colors. Syntax:
#if !defined(NOTTYGRAPHICS)
#define TTY_GRAPHICS /* good old tty based graphics */
#endif
+/* #define CURSES_GRAPHICS *//* Curses interface - Karl Garrison*/
/* #define X11_GRAPHICS */ /* X11 interface */
/* #define QT_GRAPHICS */ /* Qt interface */
/* #define GNOME_GRAPHICS */ /* Gnome interface */
#define DEFAULT_WINDOW_SYS "tty"
#endif
+#ifdef CURSES_GRAPHICS
+#ifndef DEFAULT_WINDOW_SYS
+#define DEFAULT_WINDOW_SYS "curses"
+#endif
+#endif
+
#ifdef X11_GRAPHICS
/*
* There are two ways that X11 tiles may be defined. (1) using a custom
boolean rlecomp; /* alternative to zerocomp; run-length encoding
* compression of levels when writing savefile */
uchar num_pad_mode;
+ boolean cursesgraphics; /* Use portable curses extended characters */
#if 0 /* XXXgraphics superseded by symbol sets */
boolean DECgraphics; /* use DEC VT-xxx extended character set */
boolean IBMgraphics; /* use IBM extended character set */
uchar bouldersym; /* symbol for boulder display */
#ifdef TTY_GRAPHICS
char prevmsg_window; /* type of old message window to use */
+#endif
+#if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
boolean extmenu; /* extended commands use menu interface */
#endif
#ifdef MFLOPPY
#ifdef TTY_TILES_ESCCODES
boolean vt_tiledata; /* output console codes for tile support in TTY */
#endif
- boolean wizweight; /* display weight of everything in wizard mode */
-
+ boolean wizweight; /* display weight of everything in wizard mode */
+ boolean cmdassist; /* provide detailed assistance for some commands */
+ boolean clicklook; /* allow right-clicking for look */
+ boolean msg_is_alert; /* suggest windowport should grab player's attention
+ * and request <TAB> acknowlegement */
+ int statuslines; /* default = 2, code support for alternative 3 */
/*
* Window capability support.
*/
boolean wc2_selectsaved; /* display a menu of user's saved games */
boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */
boolean wc2_hitpointbar; /* show graphical bar representing hit points */
- boolean cmdassist; /* provide detailed assistance for some commands */
- boolean clicklook; /* allow right-clicking for look */
+ int wc2_term_cols; /* terminal width, in characters */
+ int wc2_term_rows; /* terminal height, in characters */
+ int wc2_windowborders; /* display borders on NetHack windows */
+ int wc2_petattr; /* text attributes for pet */
+ boolean wc2_guicolor; /* allow colours in gui (outside map) */
boolean obsolete; /* obsolete options can point at this, it isn't used */
struct autopickup_exception *autopickup_exceptions[2];
#define AP_LEAVE 0
short soko_prize_type1; /* bag of holding or */
short soko_prize_type2; /* amulet of reflection */
struct debug_flags debug;
+ boolean windowtype_locked; /* windowtype can't change from configfile */
};
/*
* Compiler-specific adjustments
*===============================================
*/
+
#ifdef _MSC_VER
#if (_MSC_VER > 1000)
/* Visual C 8 warning elimination */
long _RTLENTRY _EXPFUNC lseek(int __handle, long __offset, int __fromwhere);
int _RTLENTRY _EXPFUNC read(int __handle, void _FAR *__buf, unsigned __len);
#endif
-#include <conio.h>
+#ifndef CURSES_GRAPHICS
+#include <conio.h> /* conflicting definitions with curses.h */
+#endif
#undef kbhit /* Use our special NT kbhit */
#define kbhit (*nt_kbhit)
/*
* The screen symbols may be the default or defined at game startup time.
* See drawing.c for defaults.
- * Note: {ibm|dec}_graphics[] arrays (also in drawing.c) must be kept in
+ * Note: {ibm|dec|curses}_graphics[] arrays (also in drawing.c) must be kept in
* synch.
*/
* Must match the order of the known_handlers strings
* in drawing.c
*/
-#define H_UNK 0
-#define H_IBM 1
-#define H_DEC 2
+#define H_UNK 0
+#define H_IBM 1
+#define H_DEC 2
+#define H_CURS 3
extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
extern const struct symdef def_warnsyms[WARNCOUNT];
after updating status window fields */
#define WC2_RESET_STATUS 0x0100L /* 09 call status_update(BL_RESET) to indicate
draw everything */
- /* 23 free bits */
+#define WC2_TERM_SIZE 0x0100L /* 10 support setting terminal size */
+#define WC2_WINDOWBORDERS 0x0200L /* 11 display borders on nh windows */
+#define WC2_PETATTR 0x0400L /* 12 attributes for hilite_pet */
+#define WC2_GUICOLOR 0x0800L /* 13 display colours outside map win */
+ /* 19 free bits */
#define ALIGN_LEFT 1
#define ALIGN_RIGHT 2
return 0;
}
-#ifdef TTY_GRAPHICS
+#if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
#define MAX_EXT_CMD 200 /* Change if we ever have more ext cmds */
/*
void NDECL((*ascgraphics_mode_callback)) = 0; /* set in tty_start_screen() */
#endif
+#ifdef CURSES_GRAPHICS
+void NDECL((*cursesgraphics_mode_callback)) = 0;
+#endif
+
/*
* Convert the given character to an object class. If the character is not
* recognized, then MAXOCLASSES is returned. Used in detect.c, invent.c,
if (SYMHANDLING(H_DEC) && decgraphics_mode_callback)
(*decgraphics_mode_callback)();
#endif
+# ifdef CURSES_GRAPHICS
+ if (SYMHANDLING(H_CURS) && cursesgraphics_mode_callback)
+ (*cursesgraphics_mode_callback)();
+# endif
} else
init_symbols();
}
* to this array at the matching offset.
*/
const char *known_handling[] = {
- "UNKNOWN", /* H_UNK */
- "IBM", /* H_IBM */
- "DEC", /* H_DEC */
+ "UNKNOWN", /* H_UNK */
+ "IBM", /* H_IBM */
+ "DEC", /* H_DEC */
+ "CURS", /* H_CURS */
(const char *) 0,
};
#define PREFER_TILED FALSE
#endif
+#ifdef CURSES_GRAPHICS
+extern int curses_read_attrs(char *attrs);
+#endif
+
enum window_option_types {
MESSAGE_OPTION = 1,
STATUS_OPTION,
{ "confirm", &flags.confirm, TRUE, SET_IN_GAME },
{ "dark_room", &flags.dark_room, TRUE, SET_IN_GAME },
{ "eight_bit_tty", &iflags.wc_eight_bit_input, FALSE, SET_IN_GAME }, /*WC*/
-#ifdef TTY_GRAPHICS
+#if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
{ "extmenu", &iflags.extmenu, FALSE, SET_IN_GAME },
#else
{ "extmenu", (boolean *) 0, FALSE, SET_IN_FILE },
{ "force_invmenu", &iflags.force_invmenu, FALSE, SET_IN_GAME },
{ "fullscreen", &iflags.wc2_fullscreen, FALSE, SET_IN_FILE },
{ "goldX", &iflags.goldX, FALSE, SET_IN_GAME },
+ { "guicolor", &iflags.wc2_guicolor, TRUE, SET_IN_GAME},
{ "help", &flags.help, TRUE, SET_IN_GAME },
{ "herecmd_menu", &iflags.herecmd_menu, FALSE, SET_IN_GAME },
{ "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/
{ "menu_overlay", (boolean *) 0, FALSE, SET_IN_FILE },
#endif
{ "monpolycontrol", &iflags.mon_polycontrol, FALSE, SET_IN_WIZGAME },
+#ifdef CURSES_GRAPHICS
+ { "mouse_support", &iflags.wc_mouse_support, FALSE, DISP_IN_GAME }, /*WC*/
+#else
{ "mouse_support", &iflags.wc_mouse_support, TRUE, DISP_IN_GAME }, /*WC*/
+#endif
#ifdef NEWS
{ "news", &iflags.news, TRUE, DISP_IN_GAME },
#else
{ "monsters", "the symbols to use for monsters", MAXMCLASSES,
SET_IN_FILE },
{ "msghistory", "number of top line messages to save", 5, DISP_IN_GAME },
-#ifdef TTY_GRAPHICS
+#if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
{ "msg_window", "the type of message window required", 1, SET_IN_GAME },
#else
{ "msg_window", "the type of message window required", 1, SET_IN_FILE },
#endif
{ "paranoid_confirmation", "extra prompting in certain situations", 28,
SET_IN_GAME },
+ { "petattr", "attributes for highlighting pets", 12, SET_IN_FILE },
{ "pettype", "your preferred initial pet type", 4, DISP_IN_GAME },
{ "pickup_burden", "maximum burden picked up before prompt", 20,
SET_IN_GAME },
20, SET_IN_GAME },
#else
{ "statushilites", "highlight control", 20, SET_IN_FILE },
+#endif
+#ifdef CURSES_GRAPHICS
+ { "statuslines",
+ "0,1,2 = classic behavior, 3 = alternative behavior",
+ 20, DISP_IN_GAME },
+#else
+ { "statuslines", "# of status lines", 20, SET_IN_FILE },
#endif
{ "symset", "load a set of display symbols from the symbols file", 70,
SET_IN_GAME },
#ifdef BACKWARD_COMPAT
{ "DECgraphics", "load DECGraphics display symbols", 70, SET_IN_FILE },
{ "IBMgraphics", "load IBMGraphics display symbols", 70, SET_IN_FILE },
+#ifdef CURSES_GRAPHICS
+ {"cursesgraphics", "load curses display symbols", 70, SET_IN_FILE},
+#endif
#ifdef MAC_GRAPHICS_ENV
{ "Macgraphics", "load MACGraphics display symbols", 70, SET_IN_FILE },
#endif
*/
fullname = "windowtype";
if (match_optname(opts, fullname, 3, TRUE)) {
+ if (iflags.windowtype_locked)
+ return retval;
if (duplicate)
complain_about_duplicate(opts, 1);
if (negated) {
bad_negation(fullname, TRUE);
return retval;
}
+#ifdef CURSES_GRAPHICS
+ /* WINCAP2
+ * term_cols:amount */
+ fullname = "term_cols";
+ if (match_optname(opts, fullname, sizeof("term_cols")-1, TRUE)) {
+ op = string_for_opt(opts, negated);
+ iflags.wc2_term_cols = atoi(op);
+ if (negated)
+ bad_negation(fullname, FALSE);
+ return retval;
+ }
+
+ /* WINCAP2
+ * term_rows:amount */
+ fullname = "term_rows";
+ if (match_optname(opts, fullname, sizeof("term_rows")-1, TRUE)) {
+ op = string_for_opt(opts, negated);
+ iflags.wc2_term_rows = atoi(op);
+ if (negated)
+ bad_negation(fullname, FALSE);
+ return retval;
+ }
+
+ /* WINCAP2
+ * petattr:string */
+ fullname = "petattr";
+ if (match_optname(opts, fullname, sizeof("petattr")-1, TRUE)) {
+ op = string_for_opt(opts, negated);
+ if (op && !negated) {
+#ifdef CURSES_GRAPHICS
+ iflags.wc2_petattr = curses_read_attrs(op);
+ if (!curses_read_attrs(op))
+ config_error_add("Unknown %s parameter '%s'", fullname, opts);
+ return FALSE;
+#else
+ /* non-curses windowports will not use this flag anyway
+ * but the above will not compile if we don't have curses.
+ * Just set it to a sensible default: */
+ iflags.wc2_petattr = ATR_INVERSE
+#endif
+ } else if (negated) bad_negation(fullname, TRUE);
+ return retval;
+ }
+
+ /* WINCAP2
+ * windowborders:n */
+ fullname = "windowborders";
+ if (match_optname(opts, fullname, sizeof("windowborders")-1, TRUE)) {
+ op = string_for_opt(opts, negated);
+ if (negated && op)
+ bad_negation(fullname, TRUE);
+ else {
+ if (negated)
+ iflags.wc2_windowborders = 2; /* Off */
+ else if (!op)
+ iflags.wc2_windowborders = 1; /* On */
+ else /* Value supplied */
+ iflags.wc2_windowborders = atoi(op);
+ if ((iflags.wc2_windowborders > 3)
+ || (iflags.wc2_windowborders < 1)) {
+ iflags.wc2_windowborders = 0;
+ config_error_add(
+ "Badoption - windowborders %s.", opts);
+ }
+ }
+ return retval;
+ }
+#endif
/* menustyle:traditional or combination or full or partial */
fullname = "menustyle";
status_initialize(REASSESS_ONLY);
need_redraw = TRUE;
#endif
+#ifdef CURSES_GRAPHICS
+ } else if ((boolopt[i].addr) == &iflags.cursesgraphics) {
+ need_redraw = TRUE;
+#endif
#ifdef TEXTCOLOR
} else if (boolopt[i].addr == &iflags.use_color) {
need_redraw = TRUE;
symset[PRIMARY].name ? symset[PRIMARY].name : "default");
if (currentgraphics == PRIMARY && symset[PRIMARY].name)
Strcat(buf, ", active");
+#ifdef CURSES_GRAPHICS
+ } else if (!strcmp(optname, "term_cols")) {
+ if (iflags.wc2_term_cols)
+ Sprintf(buf, "%d", iflags.wc2_term_cols);
+ else
+ Strcpy(buf, defopt);
+ } else if (!strcmp(optname, "term_rows")) {
+ if (iflags.wc2_term_rows)
+ Sprintf(buf, "%d",iflags.wc2_term_rows);
+ else
+ Strcpy(buf, defopt);
+#endif
} else if (!strcmp(optname, "tile_file")) {
Sprintf(buf, "%s",
iflags.wc_tile_file ? iflags.wc_tile_file : defopt);
ttycolors[CLR_YELLOW], ttycolors[CLR_BRIGHT_BLUE],
ttycolors[CLR_BRIGHT_MAGENTA], ttycolors[CLR_BRIGHT_CYAN]);
#endif /* VIDEOSHADES */
+#ifdef CURSES_GRAPHICS
+ } else if (!strcmp(optname,"windowborders")) {
+ Sprintf(buf, "%s",
+ iflags.wc2_windowborders == 1 ? "1=on" :
+ iflags.wc2_windowborders == 2 ? "2=off" :
+ iflags.wc2_windowborders == 3 ? "3=auto" : defopt);
+#endif
} else if (!strcmp(optname, "windowtype")) {
Sprintf(buf, "%s", windowprocs.name);
} else if (!strcmp(optname, "windowcolors")) {
{ "status hilite rules", WC2_HILITE_STATUS },
/* statushilites doesn't have its own bit */
{ "statushilites", WC2_HILITE_STATUS },
+#ifdef CURSES_GRAPHICS
+ {"windowborders", WC2_WINDOWBORDERS},
+#endif
{ (char *) 0, 0L }
};
#include "hack.h"
#if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) \
- || defined(MSWIN_GRAPHICS) || defined(DUMPLOG)
+ || defined(MSWIN_GRAPHICS) || defined(DUMPLOG) || defined(CURSES_GRAPHICS)
#define TEXT_TOMBSTONE
#endif
#if defined(mac) || defined(__BEOS__) || defined(WIN32_GRAPHICS)
#ifdef TTY_GRAPHICS
#include "wintty.h"
#endif
+#ifdef CURSES_GRAPHICS
+extern struct window_procs curses_procs;
+#endif
#ifdef X11_GRAPHICS
/* Cannot just blindly include winX.h without including all of X11 stuff
and must get the order of include files right. Don't bother. */
#ifdef TTY_GRAPHICS
{ &tty_procs, win_tty_init CHAINR(0) },
#endif
+#ifdef CURSES_GRAPHICS
+ { &curses_procs, 0 },
+#endif
#ifdef X11_GRAPHICS
{ &X11_procs, win_X11_init CHAINR(0) },
#endif
nethack_enter(argc, argv);
sys_early_init();
-#ifdef WIN32
+#if defined(WIN32) && defined(TTY_GRAPHICS)
Strcpy(default_window_sys, "tty");
+#else
+#if defined(CURSES_GRAPHICS)
+ Strcpy(default_window_sys, "curses");
+#endif
#endif
resuming = pcmain(argc, argv);
choose_windows(DEFAULT_WINDOW_SYS);
#else
choose_windows(default_window_sys);
+ if (argc > 1
+ && !strcmpi(default_window_sys, "mswin")
+ && strstri(argv[0], "nethackw.exe"))
+ iflags.windowtype_locked = TRUE;
#endif
#if !defined(AMIGA) && !defined(GNUDOS)
} else {
iflags.use_background_glyph = TRUE;
}
-#endif
-#endif
-#endif
+#endif /* TTY_GRAPHICS */
+#endif /* WIN32 */
+#endif /* MSDOS || WIN32 */
#if defined(MSDOS) || defined(WIN32)
init_nhwindows(&argc, argv);
#LINK = gcc
#LFLAGS = -Xlinker -soname=_APP_
+# Compile with PDCurses installed in a separate directory that doesn't
+# conflict with the system curses/ncurses library
+#CFLAGS = -O -I../include -I/usr/local/include/pdcurses
+# Same as above, but for XCurses
+#CFLAGS = -O -DXCURSES -I../include -I/usr/local/include/pdcurses
+# Compile against system curses library, such as ncurses
+#CFLAGS = -O -I../include
+
+
# Only used for the Gnome interface.
# When including the Gnome interface, you need to include gnome specific
# directories. The ones given below is the usual spot for linux systems.
../win/tty/wintty.c
WINTTYOBJ = getline.o termcap.o topl.o wintty.o
#
+# Files for curses interface
+WINCURSESSRC = ../win/curses/cursmain.c ../win/curses/curswins.c \
+ ../win/curses/cursmisc.c ../win/curses/cursdial.c \
+ ../win/curses/cursstat.c ../win/curses/cursinit.c \
+ ../win/curses/cursmesg.c ../win/curses/cursinvt.c
+WINCURSESOBJ = cursmain.o curswins.o cursmisc.o cursdial.o cursstat.o \
+ cursinit.o cursmesg.o cursinvt.o
+#
# files for an X11 port
# (tile.c is a generated source file)
WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \
#WINBESRC = ../win/BeOS/winbe.cpp ../win/BeOS/NHWindow.cpp \
# ../win/BeOS/NHMenuWindow.cpp ../win/BeOS/NHMapWindow.cpp tile.c
#WINBEOBJ = winbe.o NHWindow.o NHMenuWindow.o NHMapWindow.o tile.o
-
#
#
#WINSRC = $(WINTTYSRC)
#WINOBJ = $(WINTTYOBJ)
-
+#
+# Curses - Karl Garrison, Tangles
+#WINSRC = $(WINCURSESSRC)
+#WINOBJ = $(WINCURSESOBJ)
+#
# on some systems the termcap library is in -ltermcap or -lcurses
# on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead
# Sysatt uses shared library in lieu of this option
# WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm
# WINX11LIB = -lXaw -lXmu -lXpm -lXext -lXt -lX11 -lSM -lICE -lm # BSD/OS 2.0
#
+#
# libraries for Qt 3
WINQTLIB = -L$(QTDIR)/lib -lqt
#
#
# libraries for BeOS
WINBELIB = -lbe
-
+#
+# libraries for curses port
+# link with ncurses
+WINCURSESLIB = -lncurses
+# link with pdcurses for SDL, installed in a separate directory
+#WINCURSESLIB = -L/usr/local/lib/pdcurses -lpdcurses -lSDL
+# same as above, for XCurses
+#WINCURSESLIB = -L/usr/local/lib/pdcurses -lXCurses -lXawM -lXmu -lXext -lXt -lX11
+#
#WINLIB = $(WINTTYLIB)
-
+#
+# For Curses
+#WINLIB = $(WINCURSESLIB)
+#
# any other strange libraries your system needs (for Sysunix only -- the more
# specialized targets should already be right)
#
$(CC) $(CFLAGS) -c ../win/tty/topl.c
wintty.o: ../win/tty/wintty.c $(HACK_H) ../include/dlb.h ../include/tcap.h
$(CC) $(CFLAGS) -c ../win/tty/wintty.c
+cursmain.o: ../win/curses/cursmain.c $(HACK_H) ../include/wincurs.h
+ $(CC) $(CFLAGS) -c ../win/curses/cursmain.c
+curswins.o: ../win/curses/curswins.c $(HACK_H) ../include/func_tab.h \
+ ../include/wincurs.h ../win/curses/curswins.h
+ $(CC) $(CFLAGS) -c ../win/curses/curswins.c
+cursmisc.o: ../win/curses/cursmisc.c $(HACK_H) ../include/wincurs.h \
+ ../win/curses/cursmisc.h
+ $(CC) $(CFLAGS) -c ../win/curses/cursmisc.c
+cursdial.o: ../win/curses/cursdial.c $(HACK_H) ../include/func_tab.h \
+ ../include/wincurs.h ../win/curses/cursdial.h
+ $(CC) $(CFLAGS) -c ../win/curses/cursdial.c
+cursstat.o: ../win/curses/cursstat.c $(HACK_H) ../include/wincurs.h \
+ ../win/curses/cursstat.h
+ $(CC) $(CFLAGS) -c ../win/curses/cursstat.c
+cursinit.o: ../win/curses/cursinit.c $(HACK_H) ../include/wincurs.h \
+ ../win/curses/cursinit.h
+ $(CC) $(CFLAGS) -c ../win/curses/cursinit.c
+cursinvt.o: ../win/curses/cursinvt.c $(HACK_H) ../include/wincurs.h \
+ ../win/curses/cursinvt.h
+ $(CC) $(CFLAGS) -c ../win/curses/cursinvt.c
+cursmesg.o: ../win/curses/cursmesg.c $(HACK_H) ../include/wincurs.h \
+ ../win/curses/cursmesg.h
+ $(CC) $(CFLAGS) -c ../win/curses/cursmesg.c
Window.o: ../win/X11/Window.c ../include/xwindowp.h ../include/xwindow.h \
$(CONFIG_H) ../include/lint.h
$(CC) $(CFLAGS) -c ../win/X11/Window.c
CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
CFLAGS+=-DDUMPLOG
CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
+CFLAGS+=-DCURSES_GRAPHICS
LINK=$(CC)
# Only needed for GLIBC stack trace:
LFLAGS=-rdynamic
-WINSRC = $(WINTTYSRC)
-WINOBJ = $(WINTTYOBJ)
-WINLIB = $(WINTTYLIB)
+WINSRC = $(WINTTYSRC) $(WINCURSESSRC)
+WINOBJ = $(WINTTYOBJ) $(WINCURSESOBJ)
+WINLIB = $(WINTTYLIB) $(WINCURSESLIB)
WINTTYLIB=-lcurses
WANT_WIN_TTY=1
#WANT_WIN_X11=1
#WANT_WIN_QT=1
+#WANT_WIN_CURSES=1
# 1a. What is the default window system?
WANT_DEFAULT=tty
#WANT_DEFAULT=x11
#WANT_DEFAULT=qt
+#WANT_DEFAULT=curses
# 1b. If you set WANT_WIN_QT, you need to
# A) set QTDIR either here or in the environment to point to the Qt2 or Qt3
CFLAGS += -DNOTTYGRAPHICS
endif # !WANT_WIN_TTY
+ifdef WANT_WIN_CURSES
+CFLAGS += -DCURSES_GRAPHICS
+WINSRC += $(WINCURSESSRC)
+WINOBJ += $(WINCURSESOBJ)
+WINLIB += -lncurses
+endif
+
ifdef WANT_WIN_X11
WINSRC += $(WINX11SRC)
WINOBJ += $(WINX11OBJ)
#TARGET_CPU=x64
#TARGET_CPU=x86
+#---------------------------------------------------------------
+# OPTIONAL - Curses window port support
+#
+# 4. Uncomment these and set them appropriate if you want to
+# include curses port support alongside TTY support in your
+# console binary. You'll have to set CURSESINCL to the location
+# of your curses header (.h) files and CURSESDLL to the location
+# of your pdcurses.dll.
+#
+ADD_CURSES=Y
+CURSESINCL=..\..\pdcurses
+CURSESLIB=..\..\pdcurses\wincon\pdcurses.lib
+#
#==============================================================================
# This marks the end of the BUILD DECISIONS section.
#==============================================================================
# Source directories. Makedefs hardcodes these, don't change them.
#
-INCL = ..\include # NetHack include files
-DAT = ..\dat # NetHack data files
-DOC = ..\doc # NetHack documentation files
-UTIL = ..\util # Utility source
-SRC = ..\src # Main source
-SSYS = ..\sys\share # Shared system files
-MSWSYS= ..\sys\winnt # mswin specific files
-TTY = ..\win\tty # window port files (tty)
-MSWIN = ..\win\win32 # window port files (WIN32)
-WSHR = ..\win\share # Tile support files
+INCL = ..\include # NetHack include files
+DAT = ..\dat # NetHack data files
+DOC = ..\doc # NetHack documentation files
+UTIL = ..\util # Utility source
+SRC = ..\src # Main source
+SSYS = ..\sys\share # Shared system files
+MSWSYS = ..\sys\winnt # mswin specific files
+TTY = ..\win\tty # window port files (tty)
+MSWIN = ..\win\win32 # window port files (win32)
+CURSES = ..\win\curses # window port files (curses)
+WSHR = ..\win\share # Tile support files
#
# Object directory.
#----------------------------------------------------------------
+!IF "$(ADD_CURSES)" == "Y"
+#CURSESDEF=-D"PDC_DLL_BUILD" -D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE"
+CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE"
+!ELSE
+CURSDEF=
+CURSESLIB=
+CURSESINCL=
+!ENDIF
+
#These will be in the environment variables with one of the VS2017
#developer command prompts.
#VSCMD_ARG_HOST_ARCH=x64
ccommon= -c -nologo -D"_CONSOLE" -D"_CRT_NONSTDC_NO_DEPRECATE" -D"_CRT_SECURE_NO_DEPRECATE" \
-D"_LIB" -D"_SCL_SECURE_NO_DEPRECATE" -D"_VC80_UPGRADE=0x0600" -D"DLB" -D"_MBCS" \
- -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" -EHsc -fp:precise -Gd -GF -GS -Gy \
+ -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" $(CURSESDEF) \
+ -EHsc -fp:precise -Gd -GF -GS -Gy \
$(CL_RECENT) -WX- -Zc:forScope -Zc:wchar_t -Zi
cdebug= -analyze- -D"_DEBUG" -Gm -MTd -RTC1 -Od
crelease= -analyze- -D"_MBCS" -errorReport:prompt -Gm- -MT -O2 -Ot -Ox -Oy
guilibs = $(winlibs)
#
+!IFNDEF ADD_CURSES
INCLDIR= /I..\include /I..\sys\winnt
+!ELSE
+INCLDIR= /I..\include /I..\sys\winnt /I$(CURSESINCL)
+!ENDIF
+
#==========================================
# Util builds
# - Game build
#==========================================
-LIBS= user32.lib winmm.lib $(ZLIB)
+LIBS= user32.lib winmm.lib $(ZLIB) $(CURSESLIB)
! IF ("$(USE_DLB)"=="Y")
DLB = nhdat
TTYOBJ = $(O)topl.o $(O)getline.o $(O)wintty.o
+!IFNDEF ADD_CURSES
+CURSESOBJ=
+!ELSE
+CURSESOBJ= $(O)cursdial.o $(O)cursinit.o $(O)cursinvt.o $(O)cursmain.o \
+ $(O)cursmesg.o $(O)cursmisc.o $(O)cursstat.o $(O)curswins.o
+!ENDIF
+
SOBJ = $(O)winnt.o $(O)pcsys.o $(O)pcunix.o \
$(SOUND) $(O)nhlan.o
$(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \
$(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \
$(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \
- $(VOBJ26) $(VOBJ27) $(VOBJ28) $(VOBJ29) $(REGEX)
+ $(VOBJ26) $(VOBJ27) $(VOBJ28) $(VOBJ29) $(REGEX) \
+ $(CURSESOBJ)
GUIOBJ = $(O)mhaskyn.o $(O)mhdlg.o \
$(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \
{$(UTIL)}.c{$(OBJ)}.o:
@$(cc) $(cflagsBuild) -Fo$@ $<
+#==========================================
+# Rules for files in win\curses
+#==========================================
+
+{$(CURSES)}.c{$(OBJ)}.o:
+ @$(cc) $(cflagsBuild) -Fo$@ $<
+
+{$(CURSES)}.h{$(INCL)}.h:
+ @copy $< $@
+
+#{$(CURSES)}.txt{$(DAT)}.txt:
+# @copy $< $@
+
#==========================================
# Rules for files in win\share
#==========================================
if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt
@if exist $(GAMEDIR)\NetHack.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHack.PDB to conserve space
@if exist $(GAMEDIR)\NetHackW.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHackW.PDB to conserve space
- -copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh
+ -if not exist $(GAMEDIR)\defaults.nh copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh
-if not exist $(GAMEDIR)\record. goto>$(GAMEDIR)\record.
echo install done > $@
! ELSE
@echo Windows x86 32-bit target build
! ENDIF
+!IFDEF TTYOBJ
+ @echo tty window support included
+! IF "$(ADD_CURSES)"=="Y"
+ @echo curses window support also included
+! ENDIF
+!ENDIF
! IF "$(CL)"!=""
# @echo Warning, the CL Environment variable is defined:
# @echo CL=$(CL)
#ifdef TTY_GRAPHICS
{ "tty", "traditional tty-based graphics" },
#endif
+#ifdef CURSES_GRAPHICS
+ { "curses", "terminal-based graphics using curses libraries" },
+#endif
#ifdef X11_GRAPHICS
{ "X11", "X11" },
#endif
if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Qt"))
return 1;
#endif
+#ifdef CURSES_GRAPHICS
+ /* XXX has_color() should be added to windowprocs */
+ /* iflags.wc_color is set to false and the option disabled if the
+ terminal cannot display color */
+ if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "curses"))
+ return iflags.wc_color;
+#endif
#ifdef AMII_GRAPHICS
/* hilites[] not used */
return iflags.use_color ? 1 : 0;