From 44c787009717e23436775bb7f4e3a5115eaba214 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 31 Mar 2007 00:52:45 +0200 Subject: [PATCH] rnd-20070331-1-src * added option "game.forced_scroll_delay_value" to override user choice of scroll delay value for certain level sets with "graphicsinfo.conf" --- ChangeLog | 2 ++ src/conf_gfx.c | 2 ++ src/conf_var.c | 4 ++++ src/conftime.h | 2 +- src/files.c | 2 +- src/game.c | 11 +++++++++-- src/game.h | 4 ++++ src/game_em/graphics.c | 4 ++-- src/main.h | 4 ++++ 9 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index de283ca8..bbccc0d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * added (currently invisible) setup option to define scroll delay value * fixed small bug in priority handling when auto-detecting level start 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" 2007-03-28 * added displaying of most game panel control elements (not animated) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 969f8b28..c61b062c 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5730,6 +5730,8 @@ struct ConfigInfo image_config[] = { "game.button.sound_simple.x", "65" }, { "game.button.sound_simple.y", "245" }, + { "game.forced_scroll_delay_value", "-1" }, + { "[player].boring_delay_fixed", "1000" }, { "[player].boring_delay_random", "1000" }, { "[player].sleeping_delay_fixed", "2000" }, diff --git a/src/conf_var.c b/src/conf_var.c index 349a5991..45ad7dc9 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -2840,6 +2840,10 @@ struct TokenIntPtrInfo image_config_vars[] = "game.button.sound_simple.y", &game.button.sound_simple.y }, + { + "game.forced_scroll_delay_value", + &game.forced_scroll_delay_value + }, { "[player].boring_delay_fixed", &game.player_boring_delay_fixed diff --git a/src/conftime.h b/src/conftime.h index aa902697..1acac485 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-03-30 13:31" +#define COMPILE_DATE_STRING "2007-03-31 00:47" diff --git a/src/files.c b/src/files.c index be1bd3c7..8e686b89 100644 --- a/src/files.c +++ b/src/files.c @@ -7968,7 +7968,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->double_buffering = TRUE; si->direct_draw = !si->double_buffering; si->scroll_delay = TRUE; - si->scroll_delay_value = 9; + si->scroll_delay_value = STD_SCROLL_DELAY; si->soft_scrolling = TRUE; si->fade_screens = TRUE; si->autorecord = TRUE; diff --git a/src/game.c b/src/game.c index 68267071..d580212f 100644 --- a/src/game.c +++ b/src/game.c @@ -2875,6 +2875,13 @@ static void InitGameEngine() recursion_loop_depth = 0; recursion_loop_detected = FALSE; recursion_loop_element = EL_UNDEFINED; + + /* ---------- initialize graphics engine ---------------------------------- */ + game.scroll_delay_value = + (game.forced_scroll_delay_value != -1 ? game.forced_scroll_delay_value : + setup.scroll_delay ? setup.scroll_delay_value : 0); + game.scroll_delay_value = + MIN(MAX(MIN_SCROLL_DELAY, game.scroll_delay_value), MAX_SCROLL_DELAY); } int get_num_special_action(int element, int action_first, int action_last) @@ -4523,7 +4530,7 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, if (quick_relocation) { - int offset = (setup.scroll_delay ? setup.scroll_delay_value : 0); + int offset = game.scroll_delay_value; if (!IN_VIS_FIELD(SCREENX(x), SCREENY(y)) || center_screen) { @@ -12146,7 +12153,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) #endif { int old_scroll_x = scroll_x, old_scroll_y = scroll_y; - int offset = (setup.scroll_delay ? setup.scroll_delay_value : 0); + int offset = game.scroll_delay_value; if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy))) { diff --git a/src/game.h b/src/game.h index b658d1f4..d02c5ced 100644 --- a/src/game.h +++ b/src/game.h @@ -118,6 +118,10 @@ struct GameInfo struct GamePanelInfo panel; struct GameButtonInfo button; + /* values for graphics engine customization */ + int forced_scroll_delay_value; + int scroll_delay_value; + /* values for engine initialization */ int default_push_delay_fixed; int default_push_delay_random; diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index a55909af..68f1c297 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -522,7 +522,7 @@ void DrawRelocatePlayer(struct PlayerInfo *player, boolean quick_relocation) if (quick_relocation) { - int offset = (setup.scroll_delay ? setup.scroll_delay_value : 0); + int offset = game.scroll_delay_value; if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy))) { @@ -726,7 +726,7 @@ void RedrawPlayfield_EM(boolean force_redraw) int player_nr = game_em.last_moving_player; #endif int stepsize = TILEX / 8; - int offset = (setup.scroll_delay ? setup.scroll_delay_value : 0) * TILEX; + int offset = game.scroll_delay_value * TILEX; int offset_x = offset; int offset_y = offset; int screen_x_old = screen_x; diff --git a/src/main.h b/src/main.h index 0ca05c7c..32d81de6 100644 --- a/src/main.h +++ b/src/main.h @@ -56,6 +56,10 @@ #define MAX_LEV_FIELDX MAX_PLAYFIELD_WIDTH #define MAX_LEV_FIELDY MAX_PLAYFIELD_HEIGHT +#define MIN_SCROLL_DELAY 0 +#define STD_SCROLL_DELAY 3 +#define MAX_SCROLL_DELAY 9 + #define SCREENX(a) ((a) - scroll_x) #define SCREENY(a) ((a) - scroll_y) #define LEVELX(a) ((a) + scroll_x) -- 2.34.1