wincap field updates

As Warwick suggested, instead of having fixed tile
sizes as options, allow specification of the size
explicitly.

Also, at Yitzhak's suggestion, provide a hook for
overriding the port's tile file name.  That name,
and the contents of the file it points to, will
be window-port specific of course.
This commit is contained in:
nethack.allison
2002-02-04 12:50:46 +00:00
parent c4a0faa9f1
commit bd44ec4f65
5 changed files with 76 additions and 31 deletions

View File

@@ -440,9 +440,9 @@ to support:
| preload_tiles | WC_PRELOAD_TILES | wc_preload_tiles |boolean | | preload_tiles | WC_PRELOAD_TILES | wc_preload_tiles |boolean |
| scroll_margin | WC_SCROLL_MARGIN | wc_scroll_margin |int | | scroll_margin | WC_SCROLL_MARGIN | wc_scroll_margin |int |
| tiled_map | WC_TILED_MAP | wc_tiled_map |boolean | | tiled_map | WC_TILED_MAP | wc_tiled_map |boolean |
| tiles_16x16 | WC_TILES_16x16 | wc_tiles_16x16 |boolean | | tile_width | WC_TILE_WIDTH | wc_tile_width |int |
| tiles_32x32 | WC_TILES_32x32 | wc_tiles_32x32 |boolean | | tile_height | WC_TILE_HEIGHT | wc_tile_height |int |
| tiles_8x16 | WC_TILES_8x16 | wc_tiles_8x16 |boolean | | tile_file | WC_TILE_FILE | wc_tile_file |char * |
| use_inverse | WC_INVERSE | wc_inverse |boolean | | use_inverse | WC_INVERSE | wc_inverse |boolean |
| vary_msgcount | WC_VARY_MSGCOUNT | wc_vary_msgcount |int | | vary_msgcount | WC_VARY_MSGCOUNT | wc_vary_msgcount |int |
+-------------------+--------------------+-------------------+--------+ +-------------------+--------------------+-------------------+--------+
@@ -471,9 +471,12 @@ preload_tiles -- port should preload tiles into memory.
scroll_margin -- port should scroll the display when the hero or cursor scroll_margin -- port should scroll the display when the hero or cursor
is this number of cells away from the edge of the window. is this number of cells away from the edge of the window.
tiled_map -- port should display a tiled map if it can. tiled_map -- port should display a tiled map if it can.
tiles_16x16 -- port should display 16x16 tiles if it can. tile_width -- port should display tiles with this width or round to closest
tiles_32x32 -- port should display 32x32 tiles if it can. if it can.
tiles_8x16 -- port should display 8x16 tiles if it can. tile_height -- port should display tiles with this height or round to closest
if it can.
tile_file -- open this alterntive tile file. The file name is likely to be
window-port or platform specific.
use_inverse -- port should display inverse when NetHack asks for it. use_inverse -- port should display inverse when NetHack asks for it.
vary_msgcount -- port should display this number of messages at a time in vary_msgcount -- port should display this number of messages at a time in
the message window. the message window.

View File

@@ -209,16 +209,16 @@ struct instance_flags {
/* /*
* Window capability support. * Window capability support.
*/ */
boolean wc_color; /* use color graphics */ boolean wc_color; /* use color graphics */
boolean wc_hilite_pet; /* hilight pets */ boolean wc_hilite_pet; /* hilight pets */
boolean wc_ascii_map; /* show map using traditional ascii */ boolean wc_ascii_map; /* show map using traditional ascii */
boolean wc_tiled_map; /* show map using tiles */ boolean wc_tiled_map; /* show map using tiles */
boolean wc_preload_tiles; /* preload tiles into memory */ boolean wc_preload_tiles; /* preload tiles into memory */
boolean wc_tiles_8x16; /* use 8x16 tiles */ int wc_tile_width; /* tile width */
boolean wc_tiles_16x16; /* use 16x16 tiles */ int wc_tile_height; /* tile height */
boolean wc_tiles_32x32; /* use 32x32 tiles */ char *wc_tile_file; /* name of tile file;overrides default */
boolean wc_inverse; /* use inverse video for some things */ boolean wc_inverse; /* use inverse video for some things */
int wc_align_status; /* status win at top|bot|right|left */ int wc_align_status; /* status win at top|bot|right|left */
int wc_align_message; /* message 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 */ 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_map; /* points to font name for the map win */

View File

@@ -139,9 +139,9 @@ extern NEARDATA struct window_procs windowprocs;
#define WC_ASCII_MAP 0x04L /* 03 supports an ascii map */ #define WC_ASCII_MAP 0x04L /* 03 supports an ascii map */
#define WC_TILED_MAP 0x08L /* 04 supports a tiled map */ #define WC_TILED_MAP 0x08L /* 04 supports a tiled map */
#define WC_PRELOAD_TILES 0x10L /* 05 supports pre-loading tiles */ #define WC_PRELOAD_TILES 0x10L /* 05 supports pre-loading tiles */
#define WC_TILES_8x16 0x20L /* 06 supports 8x16 tiles */ #define WC_TILE_WIDTH 0x20L /* 06 prefer this width of tile */
#define WC_TILES_16x16 0x40L /* 07 supports 16x16 tiles */ #define WC_TILE_HEIGHT 0x40L /* 07 prefer this height of tile */
#define WC_TILES_32x32 0x80L /* 08 supports 32x32 tiles */ #define WC_TILE_FILE 0x80L /* 08 alternative tile file name */
#define WC_INVERSE 0x100L /* 09 Port supports inverse video */ #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_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_ALIGN_STATUS 0x400L /* 11 supports status alignmt top|b|l|r */
@@ -168,6 +168,7 @@ extern NEARDATA struct window_procs windowprocs;
#define ALIGN_TOP 3 #define ALIGN_TOP 3
#define ALIGN_BOTTOM 4 #define ALIGN_BOTTOM 4
/* map_mode settings - deprecated */
#define MAP_MODE_TILES 0 #define MAP_MODE_TILES 0
#define MAP_MODE_ASCII4x6 1 #define MAP_MODE_ASCII4x6 1
#define MAP_MODE_ASCII6x8 2 #define MAP_MODE_ASCII6x8 2

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)options.c 3.3 2002/02/02 */ /* SCCS Id: @(#)options.c 3.3 2002/02/04 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -171,9 +171,6 @@ static struct Bool_Opt
{"standout", &flags.standout, FALSE, SET_IN_GAME}, {"standout", &flags.standout, FALSE, SET_IN_GAME},
{"time", &flags.time, FALSE, SET_IN_GAME}, {"time", &flags.time, FALSE, SET_IN_GAME},
{"tiled_map", &iflags.wc_tiled_map, FALSE, DISP_IN_GAME}, /*WC*/ {"tiled_map", &iflags.wc_tiled_map, FALSE, DISP_IN_GAME}, /*WC*/
{"tiles_8x16", &iflags.wc_tiles_8x16, FALSE, DISP_IN_GAME}, /*WC*/
{"tiles_16x16", &iflags.wc_tiles_16x16, FALSE, DISP_IN_GAME}, /*WC*/
{"tiles_32x32", &iflags.wc_tiles_32x32, FALSE, DISP_IN_GAME}, /*WC*/
#ifdef TIMED_DELAY #ifdef TIMED_DELAY
{"timed_delay", &flags.nap, TRUE, SET_IN_GAME}, {"timed_delay", &flags.nap, TRUE, SET_IN_GAME},
#else #else
@@ -289,6 +286,9 @@ static struct Comp_Opt
#endif #endif
{ "suppress_alert", "suppress alerts about version-specific features", { "suppress_alert", "suppress alerts about version-specific features",
8, SET_IN_GAME }, 8, SET_IN_GAME },
{ "tile_width", "width of tiles", 20, DISP_IN_GAME}, /*WC*/
{ "tile_height", "height of tiles", 20, DISP_IN_GAME}, /*WC*/
{ "tile_file", "name of tile file", 70, DISP_IN_GAME}, /*WC*/
{ "traps", "the symbols to use in drawing traps", { "traps", "the symbols to use in drawing traps",
MAXTCHARS+1, SET_IN_FILE }, MAXTCHARS+1, SET_IN_FILE },
#ifdef MAC #ifdef MAC
@@ -1879,6 +1879,36 @@ goodfruit:
} else if (negated) bad_negation(fullname, TRUE); } else if (negated) bad_negation(fullname, TRUE);
return; return;
} }
/* WINCAP
* tile_width:nn */
fullname = "tile_width";
if (match_optname(opts, fullname, sizeof("tile_width")-1, TRUE)) {
op = string_for_env_opt(fullname, opts, negated);
if ((negated && !op) || (!negated && op)) {
iflags.wc_tile_width = negated ? 0 : atoi(op);
} else if (negated) bad_negation(fullname, TRUE);
return;
}
/* WINCAP
* tile_file:name */
fullname = "tile_file";
if (match_optname(opts, fullname, sizeof("tile_file")-1, TRUE)) {
if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
if (iflags.wc_tile_file) free(iflags.wc_tile_file);
iflags.wc_tile_file = (char *)alloc(strlen(op) + 1);
Strcpy(iflags.wc_tile_file, op);
}
}
/* WINCAP
* tile_height:nn */
fullname = "tile_height";
if (match_optname(opts, fullname, sizeof("tile_height")-1, TRUE)) {
op = string_for_env_opt(fullname, opts, negated);
if ((negated && !op) || (!negated && op)) {
iflags.wc_tile_height = negated ? 0 : atoi(op);
} else if (negated) bad_negation(fullname, TRUE);
return;
}
/* WINCAP /* WINCAP
* vary_msgcount:nn */ * vary_msgcount:nn */
fullname = "vary_msgcount"; fullname = "vary_msgcount";
@@ -2627,7 +2657,14 @@ char *buf;
FEATURE_NOTICE_VER_MAJ, FEATURE_NOTICE_VER_MAJ,
FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_MIN,
FEATURE_NOTICE_VER_PATCH); FEATURE_NOTICE_VER_PATCH);
} else if (!strcmp(optname, "traps")) }
else if (!strcmp(optname, "tile_file"))
Sprintf(buf, "%s", iflags.wc_tile_file ? iflags.wc_tile_file : none);
else if (!strcmp(optname, "tile_height"))
Sprintf(buf, "%d", iflags.wc_tile_width);
else if (!strcmp(optname, "tile_width"))
Sprintf(buf, "%d", iflags.wc_tile_width);
else if (!strcmp(optname, "traps"))
Sprintf(buf, "%s", to_be_done); Sprintf(buf, "%s", to_be_done);
else if (!strcmp(optname, "vary_msgcount")) else if (!strcmp(optname, "vary_msgcount"))
Sprintf(buf, "%d", iflags.wc_vary_msgcount); Sprintf(buf, "%d", iflags.wc_vary_msgcount);
@@ -2979,9 +3016,9 @@ struct wc_Opt wc_options[] = {
{"popup_dialog", WC_POPUP_DIALOG}, {"popup_dialog", WC_POPUP_DIALOG},
{"preload_tiles", WC_PRELOAD_TILES}, {"preload_tiles", WC_PRELOAD_TILES},
{"tiled_map", WC_TILED_MAP}, {"tiled_map", WC_TILED_MAP},
{"tiles_16x16", WC_TILES_16x16}, {"tile_file", WC_TILE_FILE},
{"tiles_32x32", WC_TILES_32x32}, {"tile_width", WC_TILE_WIDTH},
{"tiles_8x16", WC_TILES_8x16}, {"tile_height", WC_TILE_HEIGHT},
{"use_inverse", WC_INVERSE}, {"use_inverse", WC_INVERSE},
{"align_message", WC_ALIGN_MESSAGE}, {"align_message", WC_ALIGN_MESSAGE},
{"align_status", WC_ALIGN_STATUS}, {"align_status", WC_ALIGN_STATUS},
@@ -3037,6 +3074,7 @@ int wtype;
char *fontname; char *fontname;
{ {
char **fn = (char **)0; char **fn = (char **)0;
if (!fontname) return;
switch(wtype) { switch(wtype) {
case NHW_MAP: case NHW_MAP:
fn = &iflags.wc_font_map; fn = &iflags.wc_font_map;
@@ -3053,6 +3091,8 @@ char *fontname;
case NHW_STATUS: case NHW_STATUS:
fn = &iflags.wc_font_status; fn = &iflags.wc_font_status;
break; break;
default:
return;
} }
if (fn) { if (fn) {
if (*fn) free(*fn); if (*fn) free(*fn);

View File

@@ -997,6 +997,7 @@ freedynamicdata()
if (iflags.wc_font_text) free(iflags.wc_font_text); if (iflags.wc_font_text) free(iflags.wc_font_text);
if (iflags.wc_font_menu) free(iflags.wc_font_menu); if (iflags.wc_font_menu) free(iflags.wc_font_menu);
if (iflags.wc_font_status) free(iflags.wc_font_status); if (iflags.wc_font_status) free(iflags.wc_font_status);
if (iflags.wc_tile_file) free(iflags.wc_tile_file);
#endif /* FREE_ALL_MEMORY */ #endif /* FREE_ALL_MEMORY */
return; return;