Merge branch 'macosx-curses-fall2018' into NetHack-3.6.2-beta01
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#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 */
|
||||
@@ -118,6 +119,12 @@
|
||||
#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
|
||||
|
||||
@@ -312,6 +312,7 @@ struct instance_flags {
|
||||
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 */
|
||||
@@ -323,6 +324,8 @@ struct instance_flags {
|
||||
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
|
||||
@@ -363,8 +366,12 @@ struct instance_flags {
|
||||
#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.
|
||||
*/
|
||||
@@ -416,8 +423,11 @@ struct instance_flags {
|
||||
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
|
||||
@@ -438,6 +448,7 @@ struct instance_flags {
|
||||
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 */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
|
||||
#define BETA /* development or beta testing [MRS] */
|
||||
|
||||
#define DEBUG
|
||||
#ifndef DEBUG /* allow tool chains to define without causing warnings */
|
||||
#define DEBUG
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Files expected to exist in the playground directory.
|
||||
|
||||
@@ -93,6 +93,7 @@ extern void FDECL(interject, (int));
|
||||
* Compiler-specific adjustments
|
||||
*===============================================
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if (_MSC_VER > 1000)
|
||||
/* Visual C 8 warning elimination */
|
||||
@@ -227,7 +228,9 @@ open(const char _FAR *__path, int __access, ... /*unsigned mode*/);
|
||||
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)
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ enum levl_typ_types {
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -294,9 +294,10 @@ struct symsetentry {
|
||||
* 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];
|
||||
|
||||
@@ -91,8 +91,13 @@ E int FDECL(srandom, (unsigned int));
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#if defined(MACOSX)
|
||||
E long NDECL(lrand48);
|
||||
E void FDECL(srand48, (long));
|
||||
#else
|
||||
E long lrand48();
|
||||
E void srand48();
|
||||
#endif /* MACOSX */
|
||||
#endif /* BSD || ULTRIX || RANDOM */
|
||||
|
||||
#if !defined(BSD) || defined(ultrix)
|
||||
|
||||
@@ -389,6 +389,11 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
|
||||
#undef signed
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#define UNUSED __attribute__((unused))
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allow gcc2 to check parameters of printf-like calls with -Wformat;
|
||||
* append this to a prototype declaration (see pline() in extern.h).
|
||||
|
||||
310
include/wincurs.h
Normal file
310
include/wincurs.h
Normal file
@@ -0,0 +1,310 @@
|
||||
#ifndef WINCURS_H
|
||||
#define WINCURS_H
|
||||
|
||||
/* Global declarations for curses interface */
|
||||
|
||||
int term_rows, term_cols; /* size of underlying terminal */
|
||||
|
||||
WINDOW *base_term; /* underlying terminal window */
|
||||
|
||||
WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */
|
||||
|
||||
int orig_cursor; /* Preserve initial cursor state */
|
||||
|
||||
boolean counting; /* Count window is active */
|
||||
|
||||
|
||||
#define TEXTCOLOR /* Allow color */
|
||||
#define NHW_END 19
|
||||
#define OFF 0
|
||||
#define ON 1
|
||||
#define NONE -1
|
||||
#define KEY_ESC 0x1b
|
||||
#define DIALOG_BORDER_COLOR CLR_MAGENTA
|
||||
#define ALERT_BORDER_COLOR CLR_RED
|
||||
#define SCROLLBAR_COLOR CLR_MAGENTA
|
||||
#define SCROLLBAR_BACK_COLOR CLR_BLACK
|
||||
#define HIGHLIGHT_COLOR CLR_WHITE
|
||||
#define MORECOLOR CLR_ORANGE
|
||||
#define STAT_UP_COLOR CLR_GREEN
|
||||
#define STAT_DOWN_COLOR CLR_RED
|
||||
#define MESSAGE_WIN 1
|
||||
#define STATUS_WIN 2
|
||||
#define MAP_WIN 3
|
||||
#define INV_WIN 4
|
||||
#define NHWIN_MAX 5
|
||||
#define MESG_HISTORY_MAX 200
|
||||
#if !defined(__APPLE__) || !defined(NCURSES_VERSION)
|
||||
# define USE_DARKGRAY /* Allow "bright" black; delete if not visible */
|
||||
#endif /* !__APPLE__ && !PDCURSES */
|
||||
#define CURSES_DARK_GRAY 17
|
||||
#define MAP_SCROLLBARS
|
||||
#ifdef PDCURSES
|
||||
# define getmouse nc_getmouse
|
||||
# ifndef NCURSES_MOUSE_VERSION
|
||||
# define NCURSES_MOUSE_VERSION
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum orient_type
|
||||
{
|
||||
CENTER,
|
||||
UP,
|
||||
DOWN,
|
||||
RIGHT,
|
||||
LEFT,
|
||||
UNDEFINED
|
||||
} orient;
|
||||
|
||||
|
||||
/* cursmain.c */
|
||||
|
||||
extern struct window_procs curses_procs;
|
||||
|
||||
extern void curses_init_nhwindows(int* argcp, char** argv);
|
||||
|
||||
extern void curses_player_selection(void);
|
||||
|
||||
extern void curses_askname(void);
|
||||
|
||||
extern void curses_get_nh_event(void);
|
||||
|
||||
extern void curses_exit_nhwindows(const char *str);
|
||||
|
||||
extern void curses_suspend_nhwindows(const char *str);
|
||||
|
||||
extern void curses_resume_nhwindows(void);
|
||||
|
||||
extern winid curses_create_nhwindow(int type);
|
||||
|
||||
extern void curses_clear_nhwindow(winid wid);
|
||||
|
||||
extern void curses_display_nhwindow(winid wid, BOOLEAN_P block);
|
||||
|
||||
extern void curses_destroy_nhwindow(winid wid);
|
||||
|
||||
extern void curses_curs(winid wid, int x, int y);
|
||||
|
||||
extern void curses_putstr(winid wid, int attr, const char *text);
|
||||
|
||||
extern void curses_display_file(const char *filename,BOOLEAN_P must_exist);
|
||||
|
||||
extern void curses_start_menu(winid wid);
|
||||
|
||||
extern void curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
|
||||
CHAR_P accelerator, CHAR_P group_accel, int attr,
|
||||
const char *str, BOOLEAN_P presel);
|
||||
|
||||
extern void curses_end_menu(winid wid, const char *prompt);
|
||||
|
||||
extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected);
|
||||
|
||||
extern void curses_update_inventory(void);
|
||||
|
||||
extern void curses_mark_synch(void);
|
||||
|
||||
extern void curses_wait_synch(void);
|
||||
|
||||
extern void curses_cliparound(int x, int y);
|
||||
|
||||
extern void curses_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph, int bkglyph);
|
||||
|
||||
extern void curses_raw_print(const char *str);
|
||||
|
||||
extern void curses_raw_print_bold(const char *str);
|
||||
|
||||
extern int curses_nhgetch(void);
|
||||
|
||||
extern int curses_nh_poskey(int *x, int *y, int *mod);
|
||||
|
||||
extern void curses_nhbell(void);
|
||||
|
||||
extern int curses_doprev_message(void);
|
||||
|
||||
extern char curses_yn_function(const char *question, const char *choices, CHAR_P def);
|
||||
|
||||
extern void curses_getlin(const char *question, char *input);
|
||||
|
||||
extern int curses_get_ext_cmd(void);
|
||||
|
||||
extern void curses_number_pad(int state);
|
||||
|
||||
extern void curses_delay_output(void);
|
||||
|
||||
extern void curses_start_screen(void);
|
||||
|
||||
extern void curses_end_screen(void);
|
||||
|
||||
extern void curses_outrip(winid wid, int how);
|
||||
|
||||
extern void genl_outrip(winid tmpwin, int how, time_t when);
|
||||
|
||||
extern void curses_preference_update(const char *pref);
|
||||
|
||||
|
||||
/* curswins.c */
|
||||
|
||||
extern WINDOW *curses_create_window(int width, int height, orient orientation);
|
||||
|
||||
extern void curses_destroy_win(WINDOW *win);
|
||||
|
||||
extern WINDOW *curses_get_nhwin(winid wid);
|
||||
|
||||
extern void curses_add_nhwin(winid wid, int height, int width, int y,
|
||||
int x, orient orientation, boolean border);
|
||||
|
||||
extern void curses_add_wid(winid wid);
|
||||
|
||||
extern void curses_refresh_nhwin(winid wid);
|
||||
|
||||
extern void curses_refresh_nethack_windows(void);
|
||||
|
||||
extern void curses_del_nhwin(winid wid);
|
||||
|
||||
extern void curses_del_wid(winid wid);
|
||||
|
||||
extern void curses_putch(winid wid, int x, int y, int ch, int color, int attrs);
|
||||
|
||||
extern void curses_get_window_size(winid wid, int *height, int *width);
|
||||
|
||||
extern boolean curses_window_has_border(winid wid);
|
||||
|
||||
extern boolean curses_window_exists(winid wid);
|
||||
|
||||
extern int curses_get_window_orientation(winid wid);
|
||||
|
||||
extern void curses_get_window_xy(winid wid, int *x, int *y);
|
||||
|
||||
extern void curses_puts(winid wid, int attr, const char *text);
|
||||
|
||||
extern void curses_clear_nhwin(winid wid);
|
||||
|
||||
extern void curses_alert_win_border(winid wid, boolean onoff);
|
||||
|
||||
extern void curses_alert_main_borders(boolean onoff);
|
||||
|
||||
extern void curses_draw_map(int sx, int sy, int ex, int ey);
|
||||
|
||||
extern boolean curses_map_borders(int *sx, int *sy, int *ex, int *ey,
|
||||
int ux, int uy);
|
||||
|
||||
|
||||
/* cursmisc.c */
|
||||
|
||||
extern int curses_read_char(void);
|
||||
|
||||
extern void curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff);
|
||||
|
||||
extern void curses_bail(const char *mesg);
|
||||
|
||||
extern winid curses_get_wid(int type);
|
||||
|
||||
extern char *curses_copy_of(const char *s);
|
||||
|
||||
extern int curses_num_lines(const char *str, int width);
|
||||
|
||||
extern char *curses_break_str(const char *str, int width, int line_num);
|
||||
|
||||
extern char *curses_str_remainder(const char *str, int width, int line_num);
|
||||
|
||||
extern boolean curses_is_menu(winid wid);
|
||||
|
||||
extern boolean curses_is_text(winid wid);
|
||||
|
||||
extern int curses_convert_glyph(int ch, int glyph);
|
||||
|
||||
extern void curses_move_cursor(winid wid, int x, int y);
|
||||
|
||||
extern void curses_prehousekeeping(void);
|
||||
|
||||
extern void curses_posthousekeeping(void);
|
||||
|
||||
extern void curses_view_file(const char *filename, boolean must_exist);
|
||||
|
||||
extern void curses_rtrim(char *str);
|
||||
|
||||
extern int curses_get_count(int first_digit);
|
||||
|
||||
extern int curses_convert_attr(int attr);
|
||||
|
||||
extern int curses_read_attrs(char *attrs);
|
||||
|
||||
extern int curses_convert_keys(int key);
|
||||
|
||||
extern int curses_get_mouse(int *mousex, int *mousey, int *mod);
|
||||
|
||||
/* cursdial.c */
|
||||
|
||||
extern void curses_line_input_dialog(const char *prompt, char *answer, int buffer);
|
||||
|
||||
extern int curses_character_input_dialog(const char *prompt, const char *choices, CHAR_P def);
|
||||
|
||||
extern int curses_ext_cmd(void);
|
||||
|
||||
extern void curses_create_nhmenu(winid wid);
|
||||
extern void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier,
|
||||
CHAR_P accelerator, CHAR_P group_accel, int attr, const char *str,
|
||||
BOOLEAN_P presel);
|
||||
|
||||
extern void curses_finalize_nhmenu(winid wid, const char *prompt);
|
||||
|
||||
extern int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected);
|
||||
|
||||
extern boolean curses_menu_exists(winid wid);
|
||||
|
||||
extern void curses_del_menu(winid wid);
|
||||
|
||||
|
||||
/* cursstat.c */
|
||||
|
||||
extern void curses_status_init(void);
|
||||
extern void curses_status_update(int, genericptr_t, int, int, int, unsigned long *);
|
||||
/* extern attr_t curses_color_attr(int nh_color, int bg_color); */
|
||||
/* extern void curses_update_stats(void); */
|
||||
/* extern void curses_decrement_highlight(void); */
|
||||
|
||||
/* cursinvt.c */
|
||||
|
||||
extern void curses_update_inv(void);
|
||||
extern void curses_add_inv(int, int, CHAR_P, attr_t, const char *);
|
||||
|
||||
/* cursinit.c */
|
||||
|
||||
extern void curses_create_main_windows(void);
|
||||
|
||||
extern void curses_init_nhcolors(void);
|
||||
|
||||
extern void curses_choose_character(void);
|
||||
|
||||
extern int curses_character_dialog(const char** choices, const char *prompt);
|
||||
|
||||
extern void curses_init_options(void);
|
||||
|
||||
extern void curses_display_splash_window(void);
|
||||
|
||||
extern void curses_cleanup(void);
|
||||
|
||||
|
||||
/* cursmesg.c */
|
||||
|
||||
extern void curses_message_win_puts(const char *message, boolean recursed);
|
||||
|
||||
extern int curses_block(boolean require_tab); /* for MSGTYPE=STOP */
|
||||
|
||||
extern int curses_more(void);
|
||||
|
||||
extern void curses_clear_unhighlight_message_window(void);
|
||||
|
||||
extern void curses_message_win_getline(const char *prompt, char *answer, int buffer);
|
||||
|
||||
extern void curses_last_messages(void);
|
||||
|
||||
extern void curses_init_mesg_history(void);
|
||||
|
||||
extern void curses_prev_mesg(void);
|
||||
|
||||
extern void curses_count_window(const char *count_text);
|
||||
|
||||
#endif /* WINCURS_H */
|
||||
|
||||
@@ -216,7 +216,11 @@ extern
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user