From c64a1336914e69861b3cee04cd03afb3f1a7801a Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 12 Jun 2018 02:10:22 +0200 Subject: [PATCH] added (optional) menu buttons to select level number and first/last level --- src/conf_gfx.c | 14 ++++++++++++++ src/main.h | 4 ++++ src/screens.c | 10 +++++----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 2d3d99eb..ba530b3d 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -6079,6 +6079,13 @@ struct ConfigInfo image_config[] = { "menu.button_quit.active", UNDEFINED_FILENAME }, { "menu.button_quit.active.clone_from", "menu.button.active" }, + { "menu.button_first_level", UNDEFINED_FILENAME }, + { "menu.button_first_level.active", UNDEFINED_FILENAME }, + { "menu.button_last_level", UNDEFINED_FILENAME }, + { "menu.button_last_level.active", UNDEFINED_FILENAME }, + { "menu.button_level_number", UNDEFINED_FILENAME }, + { "menu.button_level_number.active", UNDEFINED_FILENAME }, + { "menu.scrollbar", "RocksDC.png" }, { "menu.scrollbar.xpos", "8" }, { "menu.scrollbar.ypos", "10" }, @@ -7887,6 +7894,13 @@ struct ConfigInfo image_config[] = { "main.button.quit.x", "0" }, { "main.button.quit.y", "288" }, + { "main.button.first_level.x", "-1" }, + { "main.button.first_level.y", "-1" }, + { "main.button.last_level.x", "-1" }, + { "main.button.last_level.y", "-1" }, + { "main.button.level_number.x", "-1" }, + { "main.button.level_number.y", "-1" }, + { "main.button.prev_level.x", "320" }, { "main.button.prev_level.y", "96" }, { "main.button.next_level.x", "448" }, diff --git a/src/main.h b/src/main.h index d688627d..224c3513 100644 --- a/src/main.h +++ b/src/main.h @@ -2636,6 +2636,10 @@ struct MenuMainButtonInfo struct MenuPosInfo prev_level; struct MenuPosInfo next_level; + + struct MenuPosInfo first_level; + struct MenuPosInfo last_level; + struct MenuPosInfo level_number; }; struct MenuMainTextInfo diff --git a/src/screens.c b/src/screens.c index 9562c08c..ad21972c 100644 --- a/src/screens.c +++ b/src/screens.c @@ -749,19 +749,19 @@ static struct MainControlInfo main_controls[] = #endif { MAIN_CONTROL_FIRST_LEVEL, - NULL, -1, + &menu.main.button.first_level, IMG_MENU_BUTTON_FIRST_LEVEL, &menu.main.text.first_level, &main_text_first_level, NULL, NULL, }, { MAIN_CONTROL_LAST_LEVEL, - NULL, -1, + &menu.main.button.last_level, IMG_MENU_BUTTON_LAST_LEVEL, &menu.main.text.last_level, &main_text_last_level, NULL, NULL, }, { MAIN_CONTROL_LEVEL_NUMBER, - NULL, -1, + &menu.main.button.level_number, IMG_MENU_BUTTON_LEVEL_NUMBER, &menu.main.text.level_number, &main_text_level_number, NULL, NULL, }, @@ -1148,8 +1148,8 @@ static void InitializeMainControls() if (pos_text != NULL) /* (x/y may be -1/-1 here) */ { - /* calculate size for non-clickable text -- needed for text alignment */ - boolean calculate_text_size = (pos_button == NULL && text != NULL); + /* calculate text size -- needed for text alignment */ + boolean calculate_text_size = (text != NULL); if (pos_text->width == -1 || calculate_text_size) pos_text->width = text_width; -- 2.34.1