From 2ce6152d631d3cdfd213ca2c061cc747f2eb07a2 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Fri, 23 Aug 2002 01:03:59 +0000 Subject: [PATCH] B08021 scroll_amount wincap option > - I'd like to see another option added: scroll_amount. In > combination with scroll_margin, this would control the amount > of squares the screen is scrolled when the scroll_margin is > reached (currently, this amount is 1, but if I recall > correctly, it used to be more). For example, if both were 5, > when you came within 5 spaces of the left screen border, the > screen would shift 5 spaces to the right). --- doc/Guidebook.mn | 7 +++++-- doc/Guidebook.tex | 6 +++++- doc/fixes34.1 | 1 + doc/window.doc | 4 ++-- include/flag.h | 8 ++++---- include/winprocs.h | 4 ++-- src/options.c | 20 ++++++++++++++++++-- win/win32/mhmap.c | 1 + win/win32/mhmap.h | 1 + win/win32/mswproc.c | 11 +++++++++-- 10 files changed, 48 insertions(+), 15 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 8587889c0..7b27d5742 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -5,7 +5,7 @@ .ds vr "NetHack 3.4 .ds f0 "\*(vr .ds f1 -.ds f2 "July 27, 2002 +.ds f2 "August 22, 2002 .mt A Guide to the Mazes of Menace (Guidebook for NetHack) @@ -2147,7 +2147,10 @@ For example, in the protected mode MSDOS version, control whether tiles get pre-loaded into RAM at the start of the game. Doing so enhances performance of the tile graphics, but uses more memory. (default on). Cannot be set with the `O' command. -.lp scroll_margin +.lp scroll_amount +NetHack should scroll the display by this number of cells +when the hero reaches the scroll_margin. +.lp scroll_margin NetHack should scroll the display when the hero or cursor is this number of cells away from the edge of the window. .lp splash_screen diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 3847b004c..9c5282c5e 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -27,7 +27,7 @@ \begin{document} % % input file: guidebook.mn -% $Revision: 1.50 $ $Date: 2002/08/12 01:39:55 $ +% $Revision: 1.51 $ $Date: 2002/08/22 04:18:41 $ % %.ds h0 " %.ds h1 %.ds h2 \% @@ -2643,6 +2643,10 @@ get pre-loaded into RAM at the start of the game. Doing so enhances performance of the tile graphics, but uses more memory. (default on). Cannot be set with the `{\tt O}' command. %.lp +\item[\ib{scroll\_amount}] +NetHack should scroll the display by this number of cells +when the hero reaches the scroll\_margin. +%.lp \item[\ib{scroll\_margin}] NetHack should scroll the display when the hero or cursor is this number of cells away from the edge of the window. diff --git a/doc/fixes34.1 b/doc/fixes34.1 index cb6a14f39..ff63e304c 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -276,6 +276,7 @@ showrace option travel option cmdassist option to provide additional error feedback for some commands mouse_support wincap option +scroll_amount wincap option to adjust how many cells to scroll at scroll_margin debug mode: #panic routine to test panic() and panic save file generation a new PANICLOG optional file to log the reason for panic and impossible messages added validate_prefix_locations() for early directory prefix validation diff --git a/doc/window.doc b/doc/window.doc index 47fe77915..70cc6da8b 100644 --- a/doc/window.doc +++ b/doc/window.doc @@ -482,11 +482,11 @@ to support: | font_size_status | WC_FONTSIZ_STATUS | wc_fontsiz_status |int | | font_size_text | WC_FONTSIZ_TEXT | wc_fontsiz_text |int | | hilite_pet | WC_HILITE_PET | wc_hilite_pet |boolean | - | large_font | WC_LARGE_FONT | wc_large_font |boolean | | map_mode | WC_MAP_MODE | wc_map_mode |int | | player_selection | WC_PLAYER_SELECTION| wc_player_selection|int | | popup_dialog | WC_POPUP_DIALOG | wc_popup_dialog |boolean | | preload_tiles | WC_PRELOAD_TILES | wc_preload_tiles |boolean | + | scroll_amount | WC_SCROLL_AMOUNT | wc_scroll_amount |int | | scroll_margin | WC_SCROLL_MARGIN | wc_scroll_margin |int | | splash_screen | WC_SPLASH_SCREEN | wc_splash_screen |boolean | | tiled_map | WC_TILED_MAP | wc_tiled_map |boolean | @@ -523,12 +523,12 @@ font_size_text -- port should use this size font for text windows. font_status -- port should use a font by this name for status window. font_text -- port should use a font by this name for text windows. hilite_pet -- port should mark pets in some special way on the map. -large_font -- port should use a large font. map_mode -- port should display the map in the manner specified. player_selection -- dialog or prompts for choosing character. popup_dialog -- port should pop up dialog boxes for input. preload_tiles -- port should preload tiles into memory. +scroll_amount -- scroll this amount when scroll_margin is reached. scroll_margin -- port should scroll the display when the hero or cursor is this number of cells away from the edge of the window. splash_screen -- port should/should not display an opening splashscreen. diff --git a/include/flag.h b/include/flag.h index cb84d1918..11b746d1d 100644 --- a/include/flag.h +++ b/include/flag.h @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)flag.h 3.4 2002/07/27 */ +/* SCCS Id: @(#)flag.h 3.4 2002/08/22 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -241,6 +241,7 @@ struct instance_flags { 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_amount; /* scroll this amount at scroll_margin */ int wc_scroll_margin; /* scroll map when this far from the edge */ int wc_map_mode; /* specify map viewing options, mostly @@ -249,12 +250,11 @@ struct instance_flags { boolean wc_splash_screen; /* display an opening splash screen or not */ 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 */ boolean wc_mouse_support; /* allow mouse support */ boolean cmdassist; /* provide detailed assistance for some commands */ + boolean obsolete; /* obsolete options can point at this, it isn't used */ /* Items which belong in flags, but are here to allow save compatibility */ boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */ boolean showrace; /* show hero glyph by race rather than by role */ @@ -274,7 +274,7 @@ struct instance_flags { #define hilite_pet wc_hilite_pet #define use_inverse wc_inverse #ifdef MAC_GRAPHICS_ENV -#define large_font wc_large_font +#define large_font obsolete #endif #ifdef MAC #define popup_dialog wc_popup_dialog diff --git a/include/winprocs.h b/include/winprocs.h index 76ce49f27..3f574370f 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -157,9 +157,9 @@ extern NEARDATA struct window_procs windowprocs; #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_SPLASH_SCREEN 0x800000L /* 24 supports setting scroll margin for map */ +#define WC_SPLASH_SCREEN 0x800000L /* 24 supports display of splash screen */ #define WC_POPUP_DIALOG 0x1000000L /* 25 supports queries in pop dialogs */ -#define WC_LARGE_FONT 0x2000000L /* 26 Port supports large font */ +#define WC_SCROLL_AMOUNT 0x2000000L /* 26 scroll this amount at scroll margin */ #define WC_EIGHT_BIT_IN 0x4000000L /* 27 8-bit character input */ #define WC_PERM_INVENT 0x8000000L /* 28 8-bit character input */ #define WC_MAP_MODE 0x10000000L /* 29 map_mode option */ diff --git a/src/options.c b/src/options.c index 9ea08e9b4..e059c2a3b 100644 --- a/src/options.c +++ b/src/options.c @@ -110,7 +110,7 @@ static struct Bool_Opt #else {"ignintr", (boolean *)0, FALSE, SET_IN_FILE}, #endif - {"large_font", &iflags.wc_large_font, FALSE, SET_IN_FILE}, /*WC*/ + {"large_font", &iflags.obsolete, FALSE, SET_IN_FILE}, /* OBSOLETE */ {"legacy", &flags.legacy, TRUE, DISP_IN_GAME}, {"lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME}, {"lootabc", &iflags.lootabc, FALSE, SET_IN_GAME}, @@ -294,6 +294,8 @@ static struct Comp_Opt sizeof "teleport", SET_IN_GAME }, { "scores", "the parts of the score list you wish to see", 32, SET_IN_GAME }, + { "scroll_amount", "scroll the map this amount when scroll_margin is reached", + 20, DISP_IN_GAME }, /*WC*/ { "scroll_margin", "scroll map when this far from the edge", 20, DISP_IN_GAME }, /*WC*/ #ifdef MSDOS { "soundcard", "type of sound card to use", 20, SET_IN_FILE }, @@ -1866,6 +1868,16 @@ goodfruit: } else if (negated) bad_negation(fullname, TRUE); return; } + /* WINCAP + * scroll_amount:nn */ + fullname = "scroll_amount"; + if (match_optname(opts, fullname, sizeof("scroll_amount")-1, TRUE)) { + op = string_for_opt(opts, negated); + if ((negated && !op) || (!negated && op)) { + iflags.wc_scroll_amount = negated ? 1 : atoi(op); + } else if (negated) bad_negation(fullname, TRUE); + return; + } /* WINCAP * scroll_margin:nn */ fullname = "scroll_margin"; @@ -2759,6 +2771,10 @@ char *buf; Sprintf(buf, "%d top/%d around%s", flags.end_top, flags.end_around, flags.end_own ? "/own" : ""); } + else if (!strcmp(optname, "scroll_amount")) { + if (iflags.wc_scroll_amount) Sprintf(buf, "%d",iflags.wc_scroll_amount); + else Strcpy(buf, defopt); + } else if (!strcmp(optname, "scroll_margin")) { if (iflags.wc_scroll_margin) Sprintf(buf, "%d",iflags.wc_scroll_margin); else Strcpy(buf, defopt); @@ -3145,7 +3161,6 @@ struct wc_Opt wc_options[] = { {"color", WC_COLOR}, {"eight_bit_tty", WC_EIGHT_BIT_IN}, {"hilite_pet", WC_HILITE_PET}, - {"large_font", WC_LARGE_FONT}, /* now obsolete */ {"popup_dialog", WC_POPUP_DIALOG}, {"player_selection", WC_PLAYER_SELECTION}, {"preload_tiles", WC_PRELOAD_TILES}, @@ -3170,6 +3185,7 @@ struct wc_Opt wc_options[] = { {"font_status", WC_FONT_STATUS}, {"font_text", WC_FONT_TEXT}, {"map_mode", WC_MAP_MODE}, + {"scroll_amount", WC_SCROLL_AMOUNT}, {"scroll_margin", WC_SCROLL_MARGIN}, {"splash_screen", WC_SPLASH_SCREEN}, {"vary_msgcount",WC_VARY_MSGCOUNT}, diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index d155d4dbd..da30acc33 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -420,6 +420,7 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ( msg_data->y<(data->yPos+mcam) || msg_data->y>(data->yPos+data->yPageSize-mcam) ); + mcam += iflags.wc_scroll_amount; /* get page size and center horizontally on x-position */ if( scroll_x ) { if( data->xPageSize<=2*mcam ) { diff --git a/win/win32/mhmap.h b/win/win32/mhmap.h index c7d7d3a00..401561d9e 100644 --- a/win/win32/mhmap.h +++ b/win/win32/mhmap.h @@ -16,5 +16,6 @@ int mswin_map_mode(HWND hWnd, int mode); #define ROGUE_LEVEL_MAP_MODE MAP_MODE_ASCII12x16 #define DEF_CLIPAROUND_MARGIN 5 +#define DEF_CLIPAROUND_AMOUNT 1 #endif /* MSWINMapWindow_h */ diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index eca61105f..a1c0ab24e 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -65,7 +65,7 @@ COLORREF message_fg_color = RGB(0xFF, 0xFF, 0xFF); struct window_procs mswin_procs = { "MSWIN", WC_COLOR|WC_HILITE_PET|WC_ALIGN_MESSAGE|WC_ALIGN_STATUS| - WC_INVERSE|WC_SCROLL_MARGIN|WC_MAP_MODE| + WC_INVERSE|WC_SCROLL_AMOUNT|WC_SCROLL_MARGIN|WC_MAP_MODE| WC_FONT_MESSAGE|WC_FONT_STATUS|WC_FONT_MENU|WC_FONT_TEXT| WC_FONTSIZ_MESSAGE|WC_FONTSIZ_STATUS|WC_FONTSIZ_MENU|WC_FONTSIZ_TEXT| WC_TILE_WIDTH|WC_TILE_HEIGHT|WC_TILE_FILE|WC_VARY_MSGCOUNT| @@ -187,6 +187,7 @@ void mswin_init_nhwindows(int* argc, char** argv) if( iflags.wc_align_message==0 ) iflags.wc_align_message = ALIGN_TOP; if( iflags.wc_align_status==0 ) iflags.wc_align_status = ALIGN_BOTTOM; if( iflags.wc_scroll_margin==0 ) iflags.wc_scroll_margin = DEF_CLIPAROUND_MARGIN; + if( iflags.wc_scroll_amount==0 ) iflags.wc_scroll_amount = DEF_CLIPAROUND_AMOUNT; if( iflags.wc_tile_width==0 ) iflags.wc_tile_width = TILE_X; if( iflags.wc_tile_height==0 ) iflags.wc_tile_height = TILE_Y; @@ -216,7 +217,8 @@ void mswin_init_nhwindows(int* argc, char** argv) WC_HILITE_PET | WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | - WC_SCROLL_MARGIN | + WC_SCROLL_AMOUNT | + WC_SCROLL_MARGIN | WC_MAP_MODE | WC_FONT_MESSAGE | WC_FONT_STATUS | @@ -1828,6 +1830,11 @@ void mswin_preference_update(const char *pref) return; } + if( stricmp( pref, "scroll_amount")==0 ) { + mswin_cliparound(u.ux, u.uy); + return; + } + if( stricmp( pref, "scroll_margin")==0 ) { mswin_cliparound(u.ux, u.uy); return;