From: Holger Schemel Date: Fri, 30 Mar 2007 23:52:46 +0000 (+0200) Subject: rnd-20070331-2-src X-Git-Tag: 3.2.4^2~51 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=13543405e2c3cb994b33161dd12202205158f919;p=rocksndiamonds.git rnd-20070331-2-src * replaced setup option "scroll delay: on/off" by new setup option that directly allows selecting the desired scroll delay value from 0 to 8 --- diff --git a/ChangeLog b/ChangeLog index bbccc0d3..e2d1bbe8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ position in levels without player element (but player from CE etc.) * added option "game.forced_scroll_delay_value" to override user choice of scroll delay value for certain level sets with "graphicsinfo.conf" + * replaced setup option "scroll delay: on/off" by new setup option that + directly allows selecting the desired scroll delay value from 0 to 8 2007-03-28 * added displaying of most game panel control elements (not animated) diff --git a/src/conftime.h b/src/conftime.h index 1acac485..dc36ba0e 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-03-31 00:47" +#define COMPILE_DATE_STRING "2007-03-31 01:45" diff --git a/src/files.c b/src/files.c index 8e686b89..0ebccb98 100644 --- a/src/files.c +++ b/src/files.c @@ -8172,6 +8172,17 @@ void LoadSetup() player_name_new = get_corrected_login_name(setup.player_name); free(setup.player_name); setup.player_name = player_name_new; + + /* "scroll_delay: on(3) / off(0)" was replaced by scroll delay value */ + if (setup.scroll_delay == FALSE) + { + setup.scroll_delay_value = MIN_SCROLL_DELAY; + setup.scroll_delay = TRUE; /* now always "on" */ + } + + /* make sure that scroll delay value stays inside valid range */ + setup.scroll_delay_value = + MIN(MAX(MIN_SCROLL_DELAY, setup.scroll_delay_value), MAX_SCROLL_DELAY); } else Error(ERR_WARN, "using default setup values"); diff --git a/src/main.h b/src/main.h index 32d81de6..e3fd05b5 100644 --- a/src/main.h +++ b/src/main.h @@ -58,7 +58,7 @@ #define MIN_SCROLL_DELAY 0 #define STD_SCROLL_DELAY 3 -#define MAX_SCROLL_DELAY 9 +#define MAX_SCROLL_DELAY 8 #define SCREENX(a) ((a) - scroll_x) #define SCREENY(a) ((a) - scroll_y) diff --git a/src/screens.c b/src/screens.c index 8f4b35b2..5e1a17e3 100644 --- a/src/screens.c +++ b/src/screens.c @@ -35,13 +35,14 @@ #define SETUP_MODE_SHORTCUT_2 6 #define SETUP_MODE_GRAPHICS 7 #define SETUP_MODE_CHOOSE_SCREEN_MODE 8 -#define SETUP_MODE_SOUND 9 -#define SETUP_MODE_ARTWORK 10 -#define SETUP_MODE_CHOOSE_GRAPHICS 11 -#define SETUP_MODE_CHOOSE_SOUNDS 12 -#define SETUP_MODE_CHOOSE_MUSIC 13 +#define SETUP_MODE_CHOOSE_SCROLL_DELAY 9 +#define SETUP_MODE_SOUND 10 +#define SETUP_MODE_ARTWORK 11 +#define SETUP_MODE_CHOOSE_GRAPHICS 12 +#define SETUP_MODE_CHOOSE_SOUNDS 13 +#define SETUP_MODE_CHOOSE_MUSIC 14 -#define MAX_SETUP_MODES 14 +#define MAX_SETUP_MODES 15 /* for input setup functions */ #define SETUPINPUT_SCREEN_POS_START 0 @@ -170,6 +171,9 @@ static int info_mode = INFO_MODE_MAIN; static TreeInfo *screen_modes = NULL; static TreeInfo *screen_mode_current = NULL; +static TreeInfo *scroll_delays = NULL; +static TreeInfo *scroll_delay_current = NULL; + static TreeInfo *game_speeds = NULL; static TreeInfo *game_speed_current = NULL; @@ -204,6 +208,25 @@ static struct { -1, NULL }, }; +static struct +{ + int value; + char *text; +} scroll_delays_list[] = +{ + { 0, "0 Tiles (No Scroll Delay)" }, + { 1, "1 Tile" }, + { 2, "2 Tiles" }, + { 3, "3 Tiles (Default)" }, + { 4, "4 Tiles" }, + { 5, "5 Tiles" }, + { 6, "6 Tiles" }, + { 7, "7 Tiles" }, + { 8, "8 Tiles (Maximum Scroll Delay)"}, + + { -1, NULL }, +}; + #define DRAW_MODE(s) ((s) >= GAME_MODE_MAIN && \ (s) <= GAME_MODE_SETUP ? (s) : \ (s) == GAME_MODE_PSEUDO_TYPENAME ? \ @@ -3901,7 +3924,8 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, { if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED) execSetupGame(); - else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE) + else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE || + setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY) execSetupGraphics(); else execSetupArtwork(); @@ -4084,7 +4108,8 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, { if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED) execSetupGame(); - else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE) + else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE || + setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY) execSetupGraphics(); else execSetupArtwork(); @@ -4269,6 +4294,7 @@ static struct TokenInfo *setup_info; static int num_setup_info; static char *screen_mode_text; +static char *scroll_delay_text; static char *game_speed_text; static char *graphics_set_name; static char *sounds_set_name; @@ -4423,6 +4449,55 @@ static void execSetupGraphics() screen_mode_text = screen_mode_current->name; } +#if 1 + if (scroll_delays == NULL) + { + int i; + + for (i = 0; scroll_delays_list[i].value != -1; i++) + { + TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); + char identifier[32], name[32]; + int value = scroll_delays_list[i].value; + char *text = scroll_delays_list[i].text; + + ti->node_top = &scroll_delays; + ti->sort_priority = value; + + sprintf(identifier, "%d", value); + sprintf(name, "%s", text); + + setString(&ti->identifier, identifier); + setString(&ti->name, name); + setString(&ti->name_sorting, name); + setString(&ti->infotext, "Scroll Delay"); + + pushTreeInfo(&scroll_delays, ti); + } + + /* sort scroll delay values to start with lowest scroll delay value */ + sortTreeInfo(&scroll_delays); + + /* set current scroll delay value to configured scroll delay value */ + scroll_delay_current = + getTreeInfoFromIdentifier(scroll_delays,i_to_a(setup.scroll_delay_value)); + + /* if that fails, set current scroll delay to reliable default value */ + if (scroll_delay_current == NULL) + scroll_delay_current = + getTreeInfoFromIdentifier(scroll_delays, i_to_a(STD_SCROLL_DELAY)); + + /* if that also fails, set current scroll delay to first available value */ + if (scroll_delay_current == NULL) + scroll_delay_current = scroll_delays; + } + + setup.scroll_delay_value = atoi(scroll_delay_current->identifier); + + /* needed for displaying scroll delay text instead of identifier */ + scroll_delay_text = scroll_delay_current->name; +#endif + setup_mode = SETUP_MODE_GRAPHICS; DrawSetupScreen(); } @@ -4440,6 +4515,16 @@ static void execSetupChooseScreenMode() DrawSetupScreen(); } +static void execSetupChooseScrollDelay() +{ +#if 0 + FadeSetEnterMenu(); +#endif + + setup_mode = SETUP_MODE_CHOOSE_SCROLL_DELAY; + DrawSetupScreen(); +} + static void execSetupSound() { #if 0 @@ -4623,7 +4708,11 @@ static struct TokenInfo setup_info_graphics[] = { TYPE_SWITCH, &setup.fullscreen, "Fullscreen:" }, { TYPE_ENTER_LIST, execSetupChooseScreenMode, "Fullscreen Mode:" }, { TYPE_STRING, &screen_mode_text, "" }, - { TYPE_SWITCH, &setup.scroll_delay, "Delayed Scrolling:" }, +#if 0 + { TYPE_SWITCH, &setup.scroll_delay, "Scroll Delay:" }, +#endif + { TYPE_ENTER_LIST, execSetupChooseScrollDelay, "Scroll Delay Value:" }, + { TYPE_STRING, &scroll_delay_text, "" }, #if 0 { TYPE_SWITCH, &setup.soft_scrolling, "Soft Scrolling:" }, { TYPE_SWITCH, &setup.double_buffering,"Double-Buffering:" }, @@ -5852,6 +5941,8 @@ void DrawSetupScreen() DrawChooseTree(&game_speed_current); else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE) DrawChooseTree(&screen_mode_current); + else if (setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY) + DrawChooseTree(&scroll_delay_current); else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS) DrawChooseTree(&artwork.gfx_current); else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS) @@ -5879,6 +5970,8 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button) HandleChooseTree(mx, my, dx, dy, button, &game_speed_current); else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE) HandleChooseTree(mx, my, dx, dy, button, &screen_mode_current); + else if (setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY) + HandleChooseTree(mx, my, dx, dy, button, &scroll_delay_current); else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS) HandleChooseTree(mx, my, dx, dy, button, &artwork.gfx_current); else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)