Adjust window-port related option processing
to allow common parsing in the core, and direct access to the results by the window port. Notes: o Adds a new field, wincap, to the window_procs structure for setting bits related to the preference features that the window port supports. This allows run-time determination of whether a particular option setting is applicable to the running window port. A window-port is free to support as many, or as few, of the available options as it wants. Ensure that only the ones supported have their corresponding bit set in window_proc.wincap. [see chart in doc/window.doc for help with that.] o The settings I stuck into wincap for each window port are almost certainly not accurate, so each port team should review them. You should only include the ones that you will actually react to and make adjustments for if the user changes that option. Without the setting in wincap, the option won't even show up in the 'O'ptions menu. o preference_update() added to the window-port interface, so that the window-port can be notified if an option of interest (an option with its corresponding bit set in wincap field) is changed. o provided a genl_preference_update() routine in windows.c and used it for all the existing window ports since they don't have a functional one of their own yet. o this messes around heavily with iflags and the options arrays in options.c o I hope I didn't break any port's existing code. I tried not to. The Mac however, in particular, should be looked at because it suffered a namespace collision with what I was working on around fontname. It had Mac specific font stuff in options.c. Please test the Mac.
This commit is contained in:
@@ -2196,6 +2196,7 @@ E void FDECL(setmnotwielded, (struct monst *,struct obj *));
|
||||
|
||||
E void FDECL(choose_windows, (const char *));
|
||||
E char FDECL(genl_message_menu, (CHAR_P,int,const char *));
|
||||
E void FDECL(genl_preference_update, (const char *));
|
||||
|
||||
/* ### wizard.c ### */
|
||||
|
||||
|
||||
@@ -158,10 +158,6 @@ struct instance_flags {
|
||||
boolean cbreak; /* in cbreak mode, rogue format */
|
||||
boolean DECgraphics; /* use DEC VT-xxx extended character set */
|
||||
boolean echo; /* 1 to echo characters */
|
||||
#ifdef TTY_GRAPHICS
|
||||
boolean eight_bit_tty; /* pass eight-bit characters through to tty */
|
||||
boolean extmenu; /* extended commands use menu interface */
|
||||
#endif
|
||||
boolean IBMgraphics; /* use IBM extended character set */
|
||||
unsigned msg_history; /* hint: # of top lines to save */
|
||||
boolean num_pad; /* use numbers for movement commands */
|
||||
@@ -170,26 +166,14 @@ struct instance_flags {
|
||||
int purge_monsters; /* # of dead monsters still on fmon list */
|
||||
int *opt_booldup; /* for duplication of boolean opts in config file */
|
||||
int *opt_compdup; /* for duplication of compound opts in config file */
|
||||
|
||||
uchar bouldersym; /* symbol for boulder display */
|
||||
#ifdef WIZARD
|
||||
boolean sanity_check; /* run sanity checks */
|
||||
boolean mon_polycontrol; /* debug: control monster polymorphs */
|
||||
#endif
|
||||
#ifdef TEXTCOLOR
|
||||
boolean use_color; /* use color graphics */
|
||||
#endif
|
||||
boolean hilite_pet; /* hilight pets on supported environments */
|
||||
boolean use_inverse; /* inverse attribute is available on display */
|
||||
#ifdef MAC_GRAPHICS_ENV
|
||||
boolean large_font; /* draw in larger fonts (say, 12pt instead
|
||||
of 9pt) */
|
||||
boolean MACgraphics; /* use Macintosh extended character set, as
|
||||
as defined in the special font HackFont */
|
||||
unsigned use_stone; /* use the stone ppats */
|
||||
#endif
|
||||
#ifdef MAC
|
||||
boolean popup_dialog; /* put queries in pop up dialogs instead of
|
||||
in the message window */
|
||||
#ifdef TTY_GRAPHICS
|
||||
boolean prevmsg_window; /* show more old messages at a time */
|
||||
boolean extmenu; /* extended commands use menu interface */
|
||||
#endif
|
||||
#ifdef MFLOPPY
|
||||
boolean checkspace; /* check disk space before writing files */
|
||||
@@ -200,34 +184,83 @@ struct instance_flags {
|
||||
boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
|
||||
boolean rawio; /* whether can use rawio (IOCTL call) */
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
boolean hasvga; /* has a vga adapter */
|
||||
boolean usevga; /* use the vga adapter */
|
||||
boolean has8514;
|
||||
boolean use8514;
|
||||
boolean hasvesa;
|
||||
boolean usevesa;
|
||||
boolean grmode; /* currently in graphics mode */
|
||||
#ifdef MAC_GRAPHICS_ENV
|
||||
boolean MACgraphics; /* use Macintosh extended character set, as
|
||||
as defined in the special font HackFont */
|
||||
unsigned use_stone; /* use the stone ppats */
|
||||
#endif
|
||||
#if defined(MSDOS) || defined(WIN32)
|
||||
boolean hassound; /* has a sound card */
|
||||
boolean usesound; /* use the sound card */
|
||||
boolean usepcspeaker; /* use the pc speaker */
|
||||
boolean preload_tiles; /* preload the tiles into RAM */
|
||||
boolean tile_view;
|
||||
boolean over_view;
|
||||
boolean traditional_view;
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
boolean hasvga; /* has a vga adapter */
|
||||
boolean usevga; /* use the vga adapter */
|
||||
boolean grmode; /* currently in graphics mode */
|
||||
#endif
|
||||
#ifdef LAN_FEATURES
|
||||
boolean lan_mail; /* mail is initialized */
|
||||
boolean lan_mail_fetched; /* mail is awaiting display */
|
||||
#endif
|
||||
uchar bouldersym; /* alternative boulder symbol */
|
||||
#ifdef TTY_GRAPHICS
|
||||
boolean prevmsg_window; /* show more old messages at a time */
|
||||
#endif
|
||||
/*
|
||||
* Window capability support.
|
||||
*/
|
||||
boolean wc_color; /* use color graphics */
|
||||
boolean wc_hilite_pet; /* hilight pets */
|
||||
boolean wc_ascii_map; /* show map using traditional ascii */
|
||||
boolean wc_tiled_map; /* show map using tiles */
|
||||
boolean wc_preload_tiles; /* preload tiles into memory */
|
||||
boolean wc_tiles_8x16; /* use 8x16 tiles */
|
||||
boolean wc_tiles_16x16; /* use 16x16 tiles */
|
||||
boolean wc_tiles_32x32; /* use 32x32 tiles */
|
||||
boolean wc_inverse; /* use inverse video for some things */
|
||||
int wc_align_status; /* status win at top|bot|right|left */
|
||||
int wc_align_message; /* message win at top|bot|right|left */
|
||||
int wc_vary_msgcount; /* show more old messages at a time */
|
||||
char *wc_font_map; /* points to font name for the map win */
|
||||
char *wc_font_message; /* points to font name for message win */
|
||||
char *wc_font_status; /* points to font name for status win */
|
||||
char *wc_font_menu; /* points to font name for menu win */
|
||||
char *wc_font_text; /* points to font name for text win */
|
||||
int wc_fontsiz_map; /* font size for the map win */
|
||||
int wc_fontsiz_message; /* font size for the message window */
|
||||
int wc_fontsiz_status; /* font size for the status window */
|
||||
int wc_fontsiz_menu; /* font size for the menu window */
|
||||
int wc_fontsiz_text; /* font size for text windows */
|
||||
int wc_scroll_margin; /* scroll map when this far from
|
||||
the edge */
|
||||
int wc_map_mode; /* specify map viewing options, mostly
|
||||
for backward compatibility */
|
||||
boolean wc_popup_dialog; /* put queries in pop up dialogs instead of
|
||||
in the message window */
|
||||
boolean wc_large_font; /* draw in larger fonts (say, 12pt instead
|
||||
of 9pt) */
|
||||
boolean wc_eight_bit_input; /* allow eight bit input */
|
||||
};
|
||||
|
||||
/*
|
||||
* Old deprecated names
|
||||
*/
|
||||
#ifdef TTY_GRAPHICS
|
||||
#define eight_bit_tty wc_eight_bit_input
|
||||
#endif
|
||||
#ifdef TEXTCOLOR
|
||||
#define use_color wc_color
|
||||
#endif
|
||||
#define hilite_pet wc_hilite_pet
|
||||
#define use_inverse wc_inverse
|
||||
#ifdef MAC_GRAPHICS_ENV
|
||||
#define large_font wc_large_font
|
||||
#endif
|
||||
#ifdef MAC
|
||||
#define popup_dialog wc_popup_dialog
|
||||
#endif
|
||||
#define preload_tiles wc_preload_tiles
|
||||
|
||||
extern NEARDATA struct flag flags;
|
||||
extern NEARDATA struct instance_flags iflags;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
struct window_procs {
|
||||
const char *name;
|
||||
unsigned long wincap; /* window port capability options supported */
|
||||
void FDECL((*win_init_nhwindows), (int *, char **));
|
||||
void NDECL((*win_player_selection));
|
||||
void NDECL((*win_askname));
|
||||
@@ -62,6 +63,7 @@ struct window_procs {
|
||||
void NDECL((*win_end_screen));
|
||||
|
||||
void FDECL((*win_outrip), (winid,int));
|
||||
void FDECL((*win_preference_update), (const char *));
|
||||
};
|
||||
|
||||
extern NEARDATA struct window_procs windowprocs;
|
||||
@@ -125,4 +127,72 @@ extern NEARDATA struct window_procs windowprocs;
|
||||
#define end_screen (*windowprocs.win_end_screen)
|
||||
|
||||
#define outrip (*windowprocs.win_outrip)
|
||||
#define preference_update (*windowprocs.win_preference_update)
|
||||
|
||||
/*
|
||||
* WINCAP
|
||||
* Window port preference capability bits.
|
||||
* Some day this might be better in its own wincap.h file.
|
||||
*/
|
||||
#define WC_COLOR 0x01L /* 01 Port can display things in color */
|
||||
#define WC_HILITE_PET 0x02L /* 02 supports hilite pet */
|
||||
#define WC_ASCII_MAP 0x04L /* 03 supports an ascii map */
|
||||
#define WC_TILED_MAP 0x08L /* 04 supports a tiled map */
|
||||
#define WC_PRELOAD_TILES 0x10L /* 05 supports pre-loading tiles */
|
||||
#define WC_TILES_8x16 0x20L /* 06 supports 8x16 tiles */
|
||||
#define WC_TILES_16x16 0x40L /* 07 supports 16x16 tiles */
|
||||
#define WC_TILES_32x32 0x80L /* 08 supports 32x32 tiles */
|
||||
#define WC_INVERSE 0x100L /* 09 Port supports inverse video */
|
||||
#define WC_ALIGN_MESSAGE 0x200L /* 10 supports message alignmt top|b|l|r */
|
||||
#define WC_ALIGN_STATUS 0x400L /* 11 supports status alignmt top|b|l|r */
|
||||
#define WC_VARY_MSGCOUNT 0x800L /* 12 supports varying message window */
|
||||
#define WC_FONT_MAP 0x1000L /* 13 supports specification of map win font */
|
||||
#define WC_FONT_MESSAGE 0x2000L /* 14 supports specification of msg win font */
|
||||
#define WC_FONT_STATUS 0x4000L /* 15 supports specification of sts win font */
|
||||
#define WC_FONT_MENU 0x8000L /* 16 supports specification of mnu win font */
|
||||
#define WC_FONT_TEXT 0x10000L /* 17 supports specification of txt win font */
|
||||
#define WC_FONTSIZ_MAP 0x20000L /* 18 supports specification of map win font */
|
||||
#define WC_FONTSIZ_MESSAGE 0x40000L /* 19 supports specification of msg win font */
|
||||
#define WC_FONTSIZ_STATUS 0x80000L /* 20 supports specification of sts win font */
|
||||
#define WC_FONTSIZ_MENU 0x100000L /* 21 supports specification of mnu win font */
|
||||
#define WC_FONTSIZ_TEXT 0x200000L /* 22 supports specification of txt win font */
|
||||
#define WC_SCROLL_MARGIN 0x400000L /* 23 supports setting scroll margin for map */
|
||||
#define WC_POPUP_DIALOG 0x800000L /* 24 supports queries in pop dialogs */
|
||||
#define WC_LARGE_FONT 0x1000000L /* 25 Port supports large font */
|
||||
#define WC_EIGHT_BIT_IN 0x2000000L /* 26 8-bit character input */
|
||||
#define WC_PERM_INVENT 0x4000000L /* 27 8-bit character input */
|
||||
#define WC_MAP_MODE 0x8000000L /* 28 map_mode option */
|
||||
/* 4 free bits */
|
||||
#define ALIGN_LEFT 1
|
||||
#define ALIGN_RIGHT 2
|
||||
#define ALIGN_TOP 3
|
||||
#define ALIGN_BOTTOM 4
|
||||
|
||||
#define MAP_MODE_TILES 0
|
||||
#define MAP_MODE_ASCII4x6 1
|
||||
#define MAP_MODE_ASCII6x8 2
|
||||
#define MAP_MODE_ASCII8x8 3
|
||||
#define MAP_MODE_ASCII16x8 4
|
||||
#define MAP_MODE_ASCII7x12 5
|
||||
#define MAP_MODE_ASCII8x12 6
|
||||
#define MAP_MODE_ASCII16x12 7
|
||||
#define MAP_MODE_ASCII12x16 8
|
||||
#define MAP_MODE_ASCII10x18 9
|
||||
#define MAP_MODE_ASCII_FIT_TO_SCREEN 10
|
||||
|
||||
#if 0
|
||||
#define WC_SND_SOUND 0x01L /* 01 Port has some sound capabilities */
|
||||
#define WC_SND_SPEAKER 0x02L /* 02 Sound supported via built-in speaker */
|
||||
#define WC_SND_STEREO 0x04L /* 03 Stereo sound supported */
|
||||
#define WC_SND_RAW 0x08L /* 04 Raw sound supported */
|
||||
#define WC_SND_WAVE 0x10L /* 05 Wave support */
|
||||
#define WC_SND_MIDI 0x20L /* 06 Midi support */
|
||||
/* 26 free bits */
|
||||
#endif
|
||||
|
||||
struct wc_Opt {
|
||||
char *wc_name;
|
||||
unsigned long wc_bit;
|
||||
};
|
||||
|
||||
#endif /* WINPROCS_H */
|
||||
|
||||
Reference in New Issue
Block a user