From 04575ef0d5f1551715fca1d1def889fd63b5c3ad Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 9 Feb 2007 02:41:16 +0100 Subject: [PATCH] rnd-20070209-1-src * added sort priority for order of title screens and title messages --- ChangeLog | 3 + src/conf_gfx.c | 113 +++++++- src/conftime.h | 2 +- src/init.c | 6 + src/main.c | 690 ++++++++++++++++++++++++++++++++++++++++++++----- src/main.h | 24 +- src/screens.c | 104 ++++++-- src/tools.c | 14 + src/tools.h | 2 + 9 files changed, 867 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd850437..5d3960af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-02-08 + * added sort priority for order of title screens and title messages + 2007-02-07 * changed end of game again: do not wait for the user to press a key anymore, but directly ask/confirm tape saving and go to hall of fame diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 4f126bc0..8aafe241 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -63,6 +63,8 @@ struct ConfigTypeInfo image_config_suffix[] = { ".fade_delay", ARG_UNDEFINED, TYPE_INTEGER }, { ".post_delay", ARG_UNDEFINED, TYPE_INTEGER }, { ".auto_delay", ARG_UNDEFINED, TYPE_INTEGER }, + { ".align", ARG_UNDEFINED, TYPE_INTEGER }, + { ".sort_priority", ARG_UNDEFINED, TYPE_INTEGER }, { NULL, NULL, 0 } }; @@ -4948,19 +4950,116 @@ struct ConfigInfo image_config[] = /* the following directives are not associated with an image, but probably make sense to be defined in "graphicsinfo.conf", too */ -#if 0 + { "titlemessage_initial_1.x", "-1" }, + { "titlemessage_initial_1.y", "-1" }, + { "titlemessage_initial_1.width", "-1" }, + { "titlemessage_initial_1.height", "-1" }, + { "titlemessage_initial_1.chars", "-1" }, + { "titlemessage_initial_1.lines", "-1" }, + { "titlemessage_initial_1.align", "center" }, + { "titlemessage_initial_1.autowrap", "false" }, + { "titlemessage_initial_1.centered", "false" }, + { "titlemessage_initial_1.skip_comments", "false" }, + { "titlemessage_initial_1.sort_priority", "0" }, + { "titlemessage_initial_2.x", "-1" }, + { "titlemessage_initial_2.y", "-1" }, + { "titlemessage_initial_2.width", "-1" }, + { "titlemessage_initial_2.height", "-1" }, + { "titlemessage_initial_2.chars", "-1" }, + { "titlemessage_initial_2.lines", "-1" }, + { "titlemessage_initial_2.align", "center" }, + { "titlemessage_initial_2.autowrap", "false" }, + { "titlemessage_initial_2.centered", "false" }, + { "titlemessage_initial_2.skip_comments", "false" }, + { "titlemessage_initial_2.sort_priority", "0" }, + { "titlemessage_initial_3.x", "-1" }, + { "titlemessage_initial_3.y", "-1" }, + { "titlemessage_initial_3.width", "-1" }, + { "titlemessage_initial_3.height", "-1" }, + { "titlemessage_initial_3.chars", "-1" }, + { "titlemessage_initial_3.lines", "-1" }, + { "titlemessage_initial_3.align", "center" }, + { "titlemessage_initial_3.autowrap", "false" }, + { "titlemessage_initial_3.centered", "false" }, + { "titlemessage_initial_3.skip_comments", "false" }, + { "titlemessage_initial_3.sort_priority", "0" }, + { "titlemessage_initial_4.x", "-1" }, + { "titlemessage_initial_4.y", "-1" }, + { "titlemessage_initial_4.width", "-1" }, + { "titlemessage_initial_4.height", "-1" }, + { "titlemessage_initial_4.chars", "-1" }, + { "titlemessage_initial_4.lines", "-1" }, + { "titlemessage_initial_4.align", "center" }, + { "titlemessage_initial_4.autowrap", "false" }, + { "titlemessage_initial_4.centered", "false" }, + { "titlemessage_initial_4.skip_comments", "false" }, + { "titlemessage_initial_4.sort_priority", "0" }, + { "titlemessage_initial_5.x", "-1" }, + { "titlemessage_initial_5.y", "-1" }, + { "titlemessage_initial_5.width", "-1" }, + { "titlemessage_initial_5.height", "-1" }, + { "titlemessage_initial_5.chars", "-1" }, + { "titlemessage_initial_5.lines", "-1" }, + { "titlemessage_initial_5.align", "center" }, + { "titlemessage_initial_5.autowrap", "false" }, + { "titlemessage_initial_5.centered", "false" }, + { "titlemessage_initial_5.skip_comments", "false" }, + { "titlemessage_initial_5.sort_priority", "0" }, { "titlemessage_1.x", "-1" }, { "titlemessage_1.y", "-1" }, { "titlemessage_1.width", "-1" }, { "titlemessage_1.height", "-1" }, { "titlemessage_1.chars", "-1" }, { "titlemessage_1.lines", "-1" }, - { "titlemessage_1.align", "-1" }, - { "titlemessage_1.autowrap", "-1" }, - { "titlemessage_1.centered", "-1" }, - { "titlemessage_1.skip_comments", "-1" }, - { "titlemessage_1.sort_priority", "-1" }, -#endif + { "titlemessage_1.align", "center" }, + { "titlemessage_1.autowrap", "false" }, + { "titlemessage_1.centered", "false" }, + { "titlemessage_1.skip_comments", "false" }, + { "titlemessage_1.sort_priority", "0" }, + { "titlemessage_2.x", "-1" }, + { "titlemessage_2.y", "-1" }, + { "titlemessage_2.width", "-1" }, + { "titlemessage_2.height", "-1" }, + { "titlemessage_2.chars", "-1" }, + { "titlemessage_2.lines", "-1" }, + { "titlemessage_2.align", "center" }, + { "titlemessage_2.autowrap", "false" }, + { "titlemessage_2.centered", "false" }, + { "titlemessage_2.skip_comments", "false" }, + { "titlemessage_2.sort_priority", "0" }, + { "titlemessage_3.x", "-1" }, + { "titlemessage_3.y", "-1" }, + { "titlemessage_3.width", "-1" }, + { "titlemessage_3.height", "-1" }, + { "titlemessage_3.chars", "-1" }, + { "titlemessage_3.lines", "-1" }, + { "titlemessage_3.align", "center" }, + { "titlemessage_3.autowrap", "false" }, + { "titlemessage_3.centered", "false" }, + { "titlemessage_3.skip_comments", "false" }, + { "titlemessage_3.sort_priority", "0" }, + { "titlemessage_4.x", "-1" }, + { "titlemessage_4.y", "-1" }, + { "titlemessage_4.width", "-1" }, + { "titlemessage_4.height", "-1" }, + { "titlemessage_4.chars", "-1" }, + { "titlemessage_4.lines", "-1" }, + { "titlemessage_4.align", "center" }, + { "titlemessage_4.autowrap", "false" }, + { "titlemessage_4.centered", "false" }, + { "titlemessage_4.skip_comments", "false" }, + { "titlemessage_4.sort_priority", "0" }, + { "titlemessage_5.x", "-1" }, + { "titlemessage_5.y", "-1" }, + { "titlemessage_5.width", "-1" }, + { "titlemessage_5.height", "-1" }, + { "titlemessage_5.chars", "-1" }, + { "titlemessage_5.lines", "-1" }, + { "titlemessage_5.align", "center" }, + { "titlemessage_5.autowrap", "false" }, + { "titlemessage_5.centered", "false" }, + { "titlemessage_5.skip_comments", "false" }, + { "titlemessage_5.sort_priority", "0" }, { "global.num_toons", "20" }, diff --git a/src/conftime.h b/src/conftime.h index 0290ec17..2ea6f5c2 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-02-08 02:04" +#define COMPILE_DATE_STRING "2007-02-09 02:02" diff --git a/src/init.c b/src/init.c index 49006fa1..ae1ada3a 100644 --- a/src/init.c +++ b/src/init.c @@ -975,6 +975,8 @@ static void set_graphic_parameters(int graphic) graphic_info[graphic].fade_delay = -1; graphic_info[graphic].post_delay = -1; graphic_info[graphic].auto_delay = -1; + graphic_info[graphic].align = ALIGN_CENTER; /* default for title screens */ + graphic_info[graphic].sort_priority = 0; /* default for title screens */ #if 1 /* optional zoom factor for scaling up the image to a larger size */ @@ -1167,6 +1169,10 @@ static void set_graphic_parameters(int graphic) graphic_info[graphic].post_delay = parameter[GFX_ARG_POST_DELAY]; if (parameter[GFX_ARG_AUTO_DELAY] != ARG_UNDEFINED_VALUE) graphic_info[graphic].auto_delay = parameter[GFX_ARG_AUTO_DELAY]; + if (parameter[GFX_ARG_ALIGN] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].align = parameter[GFX_ARG_ALIGN]; + if (parameter[GFX_ARG_SORT_PRIORITY] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].sort_priority = parameter[GFX_ARG_SORT_PRIORITY]; } static void set_cloned_graphic_parameters(int graphic) diff --git a/src/main.c b/src/main.c index dee69a89..3911f391 100644 --- a/src/main.c +++ b/src/main.c @@ -107,6 +107,8 @@ struct GameInfo game; struct GlobalInfo global; struct BorderInfo border; struct TitleInfo title; +struct TitleMessageInfo titlemessage[MAX_NUM_TITLE_MESSAGES]; +struct TitleMessageInfo titlemessage_initial[MAX_NUM_TITLE_MESSAGES]; struct MenuInfo menu; struct DoorInfo door_1, door_2; struct PreviewInfo preview; @@ -5380,71 +5382,641 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] = struct TokenIntPtrInfo image_config_vars[] = { - { "global.num_toons", &global.num_toons }, + { + "titlemessage_initial_1.x", + &titlemessage_initial[0].x + }, + { + "titlemessage_initial_1.y", + &titlemessage_initial[0].y + }, + { + "titlemessage_initial_1.width", + &titlemessage_initial[0].width + }, + { + "titlemessage_initial_1.height", + &titlemessage_initial[0].height + }, + { + "titlemessage_initial_1.chars", + &titlemessage_initial[0].chars + }, + { + "titlemessage_initial_1.lines", + &titlemessage_initial[0].lines + }, + { + "titlemessage_initial_1.align", + &titlemessage_initial[0].align + }, + { + "titlemessage_initial_1.autowrap", + &titlemessage_initial[0].autowrap + }, + { + "titlemessage_initial_1.centered", + &titlemessage_initial[0].centered + }, + { + "titlemessage_initial_1.skip_comments", + &titlemessage_initial[0].skip_comments + }, + { + "titlemessage_initial_1.sort_priority", + &titlemessage_initial[0].sort_priority + }, + { + "titlemessage_initial_2.x", + &titlemessage_initial[1].x + }, + { + "titlemessage_initial_2.y", + &titlemessage_initial[1].y + }, + { + "titlemessage_initial_2.width", + &titlemessage_initial[1].width + }, + { + "titlemessage_initial_2.height", + &titlemessage_initial[1].height + }, + { + "titlemessage_initial_2.chars", + &titlemessage_initial[1].chars + }, + { + "titlemessage_initial_2.lines", + &titlemessage_initial[1].lines + }, + { + "titlemessage_initial_2.align", + &titlemessage_initial[1].align + }, + { + "titlemessage_initial_2.autowrap", + &titlemessage_initial[1].autowrap + }, + { + "titlemessage_initial_2.centered", + &titlemessage_initial[1].centered + }, + { + "titlemessage_initial_2.skip_comments", + &titlemessage_initial[1].skip_comments + }, + { + "titlemessage_initial_2.sort_priority", + &titlemessage_initial[1].sort_priority + }, + { + "titlemessage_initial_3.x", + &titlemessage_initial[2].x + }, + { + "titlemessage_initial_3.y", + &titlemessage_initial[2].y + }, + { + "titlemessage_initial_3.width", + &titlemessage_initial[2].width + }, + { + "titlemessage_initial_3.height", + &titlemessage_initial[2].height + }, + { + "titlemessage_initial_3.chars", + &titlemessage_initial[2].chars + }, + { + "titlemessage_initial_3.lines", + &titlemessage_initial[2].lines + }, + { + "titlemessage_initial_3.align", + &titlemessage_initial[2].align + }, + { + "titlemessage_initial_3.autowrap", + &titlemessage_initial[2].autowrap + }, + { + "titlemessage_initial_3.centered", + &titlemessage_initial[2].centered + }, + { + "titlemessage_initial_3.skip_comments", + &titlemessage_initial[2].skip_comments + }, + { + "titlemessage_initial_3.sort_priority", + &titlemessage_initial[2].sort_priority + }, + { + "titlemessage_initial_4.x", + &titlemessage_initial[3].x + }, + { + "titlemessage_initial_4.y", + &titlemessage_initial[3].y + }, + { + "titlemessage_initial_4.width", + &titlemessage_initial[3].width + }, + { + "titlemessage_initial_4.height", + &titlemessage_initial[3].height + }, + { + "titlemessage_initial_4.chars", + &titlemessage_initial[3].chars + }, + { + "titlemessage_initial_4.lines", + &titlemessage_initial[3].lines + }, + { + "titlemessage_initial_4.align", + &titlemessage_initial[3].align + }, + { + "titlemessage_initial_4.autowrap", + &titlemessage_initial[3].autowrap + }, + { + "titlemessage_initial_4.centered", + &titlemessage_initial[3].centered + }, + { + "titlemessage_initial_4.skip_comments", + &titlemessage_initial[3].skip_comments + }, + { + "titlemessage_initial_4.sort_priority", + &titlemessage_initial[3].sort_priority + }, + { + "titlemessage_initial_5.x", + &titlemessage_initial[4].x + }, + { + "titlemessage_initial_5.y", + &titlemessage_initial[4].y + }, + { + "titlemessage_initial_5.width", + &titlemessage_initial[4].width + }, + { + "titlemessage_initial_5.height", + &titlemessage_initial[4].height + }, + { + "titlemessage_initial_5.chars", + &titlemessage_initial[4].chars + }, + { + "titlemessage_initial_5.lines", + &titlemessage_initial[4].lines + }, + { + "titlemessage_initial_5.align", + &titlemessage_initial[4].align + }, + { + "titlemessage_initial_5.autowrap", + &titlemessage_initial[4].autowrap + }, + { + "titlemessage_initial_5.centered", + &titlemessage_initial[4].centered + }, + { + "titlemessage_initial_5.skip_comments", + &titlemessage_initial[4].skip_comments + }, + { + "titlemessage_initial_5.sort_priority", + &titlemessage_initial[4].sort_priority + }, + { + "titlemessage_1.x", + &titlemessage[0].x + }, + { + "titlemessage_1.y", + &titlemessage[0].y + }, + { + "titlemessage_1.width", + &titlemessage[0].width + }, + { + "titlemessage_1.height", + &titlemessage[0].height + }, + { + "titlemessage_1.chars", + &titlemessage[0].chars + }, + { + "titlemessage_1.lines", + &titlemessage[0].lines + }, + { + "titlemessage_1.align", + &titlemessage[0].align + }, + { + "titlemessage_1.autowrap", + &titlemessage[0].autowrap + }, + { + "titlemessage_1.centered", + &titlemessage[0].centered + }, + { + "titlemessage_1.skip_comments", + &titlemessage[0].skip_comments + }, + { + "titlemessage_1.sort_priority", + &titlemessage[0].sort_priority + }, + { + "titlemessage_2.x", + &titlemessage[1].x + }, + { + "titlemessage_2.y", + &titlemessage[1].y + }, + { + "titlemessage_2.width", + &titlemessage[1].width + }, + { + "titlemessage_2.height", + &titlemessage[1].height + }, + { + "titlemessage_2.chars", + &titlemessage[1].chars + }, + { + "titlemessage_2.lines", + &titlemessage[1].lines + }, + { + "titlemessage_2.align", + &titlemessage[1].align + }, + { + "titlemessage_2.autowrap", + &titlemessage[1].autowrap + }, + { + "titlemessage_2.centered", + &titlemessage[1].centered + }, + { + "titlemessage_2.skip_comments", + &titlemessage[1].skip_comments + }, + { + "titlemessage_2.sort_priority", + &titlemessage[1].sort_priority + }, + { + "titlemessage_3.x", + &titlemessage[2].x + }, + { + "titlemessage_3.y", + &titlemessage[2].y + }, + { + "titlemessage_3.width", + &titlemessage[2].width + }, + { + "titlemessage_3.height", + &titlemessage[2].height + }, + { + "titlemessage_3.chars", + &titlemessage[2].chars + }, + { + "titlemessage_3.lines", + &titlemessage[2].lines + }, + { + "titlemessage_3.align", + &titlemessage[2].align + }, + { + "titlemessage_3.autowrap", + &titlemessage[2].autowrap + }, + { + "titlemessage_3.centered", + &titlemessage[2].centered + }, + { + "titlemessage_3.skip_comments", + &titlemessage[2].skip_comments + }, + { + "titlemessage_3.sort_priority", + &titlemessage[2].sort_priority + }, + { + "titlemessage_4.x", + &titlemessage[3].x + }, + { + "titlemessage_4.y", + &titlemessage[3].y + }, + { + "titlemessage_4.width", + &titlemessage[3].width + }, + { + "titlemessage_4.height", + &titlemessage[3].height + }, + { + "titlemessage_4.chars", + &titlemessage[3].chars + }, + { + "titlemessage_4.lines", + &titlemessage[3].lines + }, + { + "titlemessage_4.align", + &titlemessage[3].align + }, + { + "titlemessage_4.autowrap", + &titlemessage[3].autowrap + }, + { + "titlemessage_4.centered", + &titlemessage[3].centered + }, + { + "titlemessage_4.skip_comments", + &titlemessage[3].skip_comments + }, + { + "titlemessage_4.sort_priority", + &titlemessage[3].sort_priority + }, + { + "titlemessage_5.x", + &titlemessage[4].x + }, + { + "titlemessage_5.y", + &titlemessage[4].y + }, + { + "titlemessage_5.width", + &titlemessage[4].width + }, + { + "titlemessage_5.height", + &titlemessage[4].height + }, + { + "titlemessage_5.chars", + &titlemessage[4].chars + }, + { + "titlemessage_5.lines", + &titlemessage[4].lines + }, + { + "titlemessage_5.align", + &titlemessage[4].align + }, + { + "titlemessage_5.autowrap", + &titlemessage[4].autowrap + }, + { + "titlemessage_5.centered", + &titlemessage[4].centered + }, + { + "titlemessage_5.skip_comments", + &titlemessage[4].skip_comments + }, + { + "titlemessage_5.sort_priority", + &titlemessage[4].sort_priority + }, - { "border.draw_masked.TITLE", &border.draw_masked[GFX_SPECIAL_ARG_TITLE] }, - { "border.draw_masked.MAIN", &border.draw_masked[GFX_SPECIAL_ARG_MAIN] }, - { "border.draw_masked.LEVELS", &border.draw_masked[GFX_SPECIAL_ARG_LEVELS] }, - { "border.draw_masked.SCORES", &border.draw_masked[GFX_SPECIAL_ARG_SCORES] }, - { "border.draw_masked.EDITOR", &border.draw_masked[GFX_SPECIAL_ARG_EDITOR] }, - { "border.draw_masked.INFO", &border.draw_masked[GFX_SPECIAL_ARG_INFO] }, - { "border.draw_masked.SETUP", &border.draw_masked[GFX_SPECIAL_ARG_SETUP] }, - { "border.draw_masked.PLAYING",&border.draw_masked[GFX_SPECIAL_ARG_PLAYING] }, - { "border.draw_masked.DOOR", &border.draw_masked[GFX_SPECIAL_ARG_DOOR] }, + { + "global.num_toons", + &global.num_toons + }, - { "title.fade_delay", &title.fade_delay }, - { "title.post_delay", &title.post_delay }, - { "title.auto_delay", &title.auto_delay }, + { + "border.draw_masked.TITLE", + &border.draw_masked[GFX_SPECIAL_ARG_TITLE] + }, + { + "border.draw_masked.MAIN", + &border.draw_masked[GFX_SPECIAL_ARG_MAIN] + }, + { + "border.draw_masked.LEVELS", + &border.draw_masked[GFX_SPECIAL_ARG_LEVELS] + }, + { + "border.draw_masked.SCORES", + &border.draw_masked[GFX_SPECIAL_ARG_SCORES] + }, + { + "border.draw_masked.EDITOR", + &border.draw_masked[GFX_SPECIAL_ARG_EDITOR] + }, + { + "border.draw_masked.INFO", + &border.draw_masked[GFX_SPECIAL_ARG_INFO] + }, + { + "border.draw_masked.SETUP", + &border.draw_masked[GFX_SPECIAL_ARG_SETUP] + }, + { + "border.draw_masked.PLAYING", + &border.draw_masked[GFX_SPECIAL_ARG_PLAYING] + }, + { + "border.draw_masked.DOOR", + &border.draw_masked[GFX_SPECIAL_ARG_DOOR] + }, + + { + "title.fade_delay", + &title.fade_delay + }, + { + "title.post_delay", + &title.post_delay + }, + { + "title.auto_delay", + &title.auto_delay + }, - { "menu.fade_delay", &menu.fade_delay }, - { "menu.post_delay", &menu.post_delay }, - { "menu.auto_delay", &menu.auto_delay }, + { + "menu.fade_delay", + &menu.fade_delay + }, + { + "menu.post_delay", + &menu.post_delay + }, + { + "menu.auto_delay", + &menu.auto_delay + }, - { "menu.draw_xoffset", &menu.draw_xoffset[GFX_SPECIAL_ARG_DEFAULT] }, - { "menu.draw_yoffset", &menu.draw_yoffset[GFX_SPECIAL_ARG_DEFAULT] }, - { "menu.draw_xoffset.MAIN", &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN] }, - { "menu.draw_yoffset.MAIN", &menu.draw_yoffset[GFX_SPECIAL_ARG_MAIN] }, - { "menu.draw_xoffset.LEVELS", &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELS] }, - { "menu.draw_yoffset.LEVELS", &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS] }, - { "menu.draw_xoffset.SCORES", &menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES] }, - { "menu.draw_yoffset.SCORES", &menu.draw_yoffset[GFX_SPECIAL_ARG_SCORES] }, - { "menu.draw_xoffset.EDITOR", &menu.draw_xoffset[GFX_SPECIAL_ARG_EDITOR] }, - { "menu.draw_yoffset.EDITOR", &menu.draw_yoffset[GFX_SPECIAL_ARG_EDITOR] }, - { "menu.draw_xoffset.INFO", &menu.draw_xoffset[GFX_SPECIAL_ARG_INFO] }, - { "menu.draw_yoffset.INFO", &menu.draw_yoffset[GFX_SPECIAL_ARG_INFO] }, - { "menu.draw_xoffset.INFO[ELEMENTS]", - &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] }, - { "menu.draw_yoffset.INFO[ELEMENTS]", - &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] }, - { "menu.draw_xoffset.INFO[MUSIC]", - &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_MUSIC] }, - { "menu.draw_yoffset.INFO[MUSIC]", - &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_MUSIC] }, - { "menu.draw_xoffset.INFO[CREDITS]", - &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_CREDITS] }, - { "menu.draw_yoffset.INFO[CREDITS]", - &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_CREDITS] }, - { "menu.draw_xoffset.INFO[PROGRAM]", - &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_PROGRAM] }, - { "menu.draw_yoffset.INFO[PROGRAM]", - &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_PROGRAM] }, - { "menu.draw_xoffset.INFO[VERSION]", - &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_VERSION] }, - { "menu.draw_yoffset.INFO[VERSION]", - &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_VERSION] }, - { "menu.draw_xoffset.INFO[LEVELSET]", - &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_LEVELSET] }, - { "menu.draw_yoffset.INFO[LEVELSET]", - &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_LEVELSET] }, - { "menu.draw_xoffset.SETUP", &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP] }, - { "menu.draw_yoffset.SETUP", &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP] }, + { + "menu.draw_xoffset", + &menu.draw_xoffset[GFX_SPECIAL_ARG_DEFAULT] + }, + { + "menu.draw_yoffset", + &menu.draw_yoffset[GFX_SPECIAL_ARG_DEFAULT] + }, + { + "menu.draw_xoffset.MAIN", + &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN] + }, + { + "menu.draw_yoffset.MAIN", + &menu.draw_yoffset[GFX_SPECIAL_ARG_MAIN] + }, + { + "menu.draw_xoffset.LEVELS", + &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELS] + }, + { + "menu.draw_yoffset.LEVELS", + &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS] + }, + { + "menu.draw_xoffset.SCORES", + &menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES] + }, + { + "menu.draw_yoffset.SCORES", + &menu.draw_yoffset[GFX_SPECIAL_ARG_SCORES] + }, + { + "menu.draw_xoffset.EDITOR", + &menu.draw_xoffset[GFX_SPECIAL_ARG_EDITOR] + }, + { + "menu.draw_yoffset.EDITOR", + &menu.draw_yoffset[GFX_SPECIAL_ARG_EDITOR] + }, + { + "menu.draw_xoffset.INFO", + &menu.draw_xoffset[GFX_SPECIAL_ARG_INFO] + }, + { + "menu.draw_yoffset.INFO", + &menu.draw_yoffset[GFX_SPECIAL_ARG_INFO] + }, + { + "menu.draw_xoffset.INFO[ELEMENTS]", + &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] + }, + { + "menu.draw_yoffset.INFO[ELEMENTS]", + &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] + }, + { + "menu.draw_xoffset.INFO[MUSIC]", + &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_MUSIC] + }, + { + "menu.draw_yoffset.INFO[MUSIC]", + &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_MUSIC] + }, + { + "menu.draw_xoffset.INFO[CREDITS]", + &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_CREDITS] + }, + { + "menu.draw_yoffset.INFO[CREDITS]", + &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_CREDITS] + }, + { + "menu.draw_xoffset.INFO[PROGRAM]", + &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_PROGRAM] + }, + { + "menu.draw_yoffset.INFO[PROGRAM]", + &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_PROGRAM] + }, + { + "menu.draw_xoffset.INFO[VERSION]", + &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_VERSION] + }, + { + "menu.draw_yoffset.INFO[VERSION]", + &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_VERSION] + }, + { + "menu.draw_xoffset.INFO[LEVELSET]", + &menu.draw_xoffset_info[GFX_SPECIAL_ARG_INFO_LEVELSET] + }, + { + "menu.draw_yoffset.INFO[LEVELSET]", + &menu.draw_yoffset_info[GFX_SPECIAL_ARG_INFO_LEVELSET] + }, + { + "menu.draw_xoffset.SETUP", + &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP] + }, + { + "menu.draw_yoffset.SETUP", + &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP] + }, - { "menu.scrollbar_xoffset", &menu.scrollbar_xoffset }, + { + "menu.scrollbar_xoffset", + &menu.scrollbar_xoffset + }, - { "menu.list_size", &menu.list_size[GFX_SPECIAL_ARG_DEFAULT] }, - { "menu.list_size.LEVELS", &menu.list_size[GFX_SPECIAL_ARG_LEVELS] }, - { "menu.list_size.SCORES", &menu.list_size[GFX_SPECIAL_ARG_SCORES] }, - { "menu.list_size.INFO", &menu.list_size[GFX_SPECIAL_ARG_INFO] }, + { + "menu.list_size", + &menu.list_size[GFX_SPECIAL_ARG_DEFAULT] + }, + { + "menu.list_size.LEVELS", + &menu.list_size[GFX_SPECIAL_ARG_LEVELS] + }, + { + "menu.list_size.SCORES", + &menu.list_size[GFX_SPECIAL_ARG_SCORES] + }, + { + "menu.list_size.INFO", + &menu.list_size[GFX_SPECIAL_ARG_INFO] + }, { "main.button.name.x", &menu.main.button.name.x }, { "main.button.name.y", &menu.main.button.name.y }, diff --git a/src/main.h b/src/main.h index fb577b77..f9ab95f4 100644 --- a/src/main.h +++ b/src/main.h @@ -1768,8 +1768,10 @@ #define GFX_ARG_FADE_DELAY 39 #define GFX_ARG_POST_DELAY 40 #define GFX_ARG_AUTO_DELAY 41 +#define GFX_ARG_ALIGN 42 +#define GFX_ARG_SORT_PRIORITY 43 -#define NUM_GFX_ARGS 42 +#define NUM_GFX_ARGS 44 /* values for sound configuration suffixes */ @@ -1964,7 +1966,7 @@ struct BorderInfo { - int draw_masked[NUM_SPECIAL_GFX_ARGS]; + boolean draw_masked[NUM_SPECIAL_GFX_ARGS]; }; #if 0 @@ -2035,6 +2037,21 @@ struct TitleInfo int auto_delay_final; }; +struct TitleMessageInfo +{ + int x; + int y; + int width; + int height; + int chars; + int lines; + int align; + boolean autowrap; + boolean centered; + boolean skip_comments; + int sort_priority; +}; + struct MenuInfo { int draw_xoffset[NUM_SPECIAL_GFX_ARGS]; @@ -2484,6 +2501,8 @@ struct GraphicInfo int fade_delay; /* optional setting for drawing title screens */ int post_delay; /* optional setting for drawing title screens */ int auto_delay; /* optional setting for drawing title screens */ + int align; /* optional setting for drawing title screens */ + int sort_priority; /* optional setting for drawing title screens */ boolean use_image_size; /* use image size as default width and height */ @@ -2647,6 +2666,7 @@ extern struct TapeInfo tape; extern struct GlobalInfo global; extern struct BorderInfo border; extern struct TitleInfo title; +extern struct TitleMessageInfo titlemessage[], titlemessage_initial[]; extern struct MenuInfo menu; extern struct DoorInfo door_1, door_2; extern struct PreviewInfo preview; diff --git a/src/screens.c b/src/screens.c index 1aaf95d0..dd25d120 100644 --- a/src/screens.c +++ b/src/screens.c @@ -245,7 +245,6 @@ static Bitmap *scrollbar_bitmap[NUM_SCROLLBAR_BITMAPS]; #define MAX_NUM_TITLE_SCREENS (2 * MAX_NUM_TITLE_IMAGES + \ 2 * MAX_NUM_TITLE_MESSAGES) -static boolean show_title_initial = TRUE; static int num_title_screens = 0; struct TitleControlInfo @@ -253,6 +252,7 @@ struct TitleControlInfo boolean is_image; boolean initial; int local_nr; + int sort_priority; }; struct TitleControlInfo title_controls[MAX_NUM_TITLE_SCREENS]; @@ -429,12 +429,35 @@ static int getTitleScreenGraphic(int nr, boolean initial) return (initial ? IMG_TITLESCREEN_INITIAL_1 : IMG_TITLESCREEN_1) + nr; } +static struct TitleMessageInfo *getTitleMessageInfo(int nr, boolean initial) +{ + return (initial ? &titlemessage_initial[nr] : &titlemessage[nr]); +} + +static int compareTitleControlInfo(const void *object1, const void *object2) +{ + const struct TitleControlInfo *tci1 = (struct TitleControlInfo *)object1; + const struct TitleControlInfo *tci2 = (struct TitleControlInfo *)object2; + int compare_result; + + if (tci1->initial != tci2->initial) + compare_result = (tci1->initial ? -1 : +1); + else if (tci1->sort_priority != tci2->sort_priority) + compare_result = tci1->sort_priority - tci2->sort_priority; + else + compare_result = tci1->local_nr - tci2->local_nr; + + return compare_result; +} + static void InitializeTitleControlsExt_AddTitleInfo(boolean is_image, - boolean initial, int nr) + boolean initial, + int nr, int sort_priority) { title_controls[num_title_screens].is_image = is_image; title_controls[num_title_screens].initial = initial; title_controls[num_title_screens].local_nr = nr; + title_controls[num_title_screens].sort_priority = sort_priority; num_title_screens++; } @@ -444,15 +467,27 @@ static void InitializeTitleControls_CheckTitleInfo(boolean initial) int i; for (i = 0; i < MAX_NUM_TITLE_IMAGES; i++) - if (graphic_info[getTitleScreenGraphic(i, initial)].bitmap != NULL) - InitializeTitleControlsExt_AddTitleInfo(TRUE, initial, i); + { + int graphic = getTitleScreenGraphic(i, initial); + Bitmap *bitmap = graphic_info[graphic].bitmap; + int sort_priority = graphic_info[graphic].sort_priority; + + if (bitmap != NULL) + InitializeTitleControlsExt_AddTitleInfo(TRUE, initial, i, sort_priority); + } for (i = 0; i < MAX_NUM_TITLE_MESSAGES; i++) - if (getLevelSetTitleMessageFilename(i, initial) != NULL) - InitializeTitleControlsExt_AddTitleInfo(FALSE, initial, i); + { + struct TitleMessageInfo *tmi = getTitleMessageInfo(i, initial); + char *filename = getLevelSetTitleMessageFilename(i, initial); + int sort_priority = tmi->sort_priority; + + if (filename != NULL) + InitializeTitleControlsExt_AddTitleInfo(FALSE, initial, i, sort_priority); + } } -static void InitializeTitleControls() +static void InitializeTitleControls(boolean show_title_initial) { num_title_screens = 0; @@ -460,6 +495,10 @@ static void InitializeTitleControls() InitializeTitleControls_CheckTitleInfo(TRUE); InitializeTitleControls_CheckTitleInfo(FALSE); + + /* sort title screens according to sort_priority and title number */ + qsort(title_controls, num_title_screens, sizeof(struct TitleControlInfo), + compareTitleControlInfo); } static void InitializeMainControls() @@ -792,6 +831,9 @@ void DrawTitleScreenImage(int nr, boolean initial) dst_x = (WIN_XSIZE - width) / 2; dst_y = (WIN_YSIZE - height) / 2; + SetDrawBackgroundMask(REDRAW_ALL); + SetWindowBackgroundImage(IMG_BACKGROUND_TITLE); + ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE); if (DrawingOnBackground(dst_x, dst_y)) @@ -833,7 +875,7 @@ void DrawTitleScreenMessage(int nr, boolean initial) return; SetDrawBackgroundMask(REDRAW_ALL); - SetWindowBackgroundImageIfDefined(IMG_BACKGROUND_MESSAGE); + SetWindowBackgroundImage(IMG_BACKGROUND_MESSAGE); ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE); @@ -855,13 +897,32 @@ void DrawTitleScreen() { KeyboardAutoRepeatOff(); +#if 0 SetMainBackgroundImage(IMG_BACKGROUND_TITLE); +#endif HandleTitleScreen(0, 0, 0, 0, MB_MENU_INITIALIZE); StopAnimation(); } +boolean CheckTitleScreen(boolean levelset_has_changed) +{ + static boolean show_title_initial = TRUE; + boolean show_titlescreen = FALSE; + + /* needed to be able to skip title screen, if no image or message defined */ + InitializeTitleControls(show_title_initial); + + if (setup.show_titlescreen && (show_title_initial || levelset_has_changed)) + show_titlescreen = TRUE; + + /* show initial title images and messages only once at program start */ + show_title_initial = FALSE; + + return (show_titlescreen && num_title_screens > 0); +} + void DrawMainMenuExt(int redraw_mask, boolean do_fading) { static LevelDirTree *leveldir_last_valid = NULL; @@ -921,21 +982,17 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) #endif #if 1 - if (setup.show_titlescreen && (show_title_initial || levelset_has_changed)) + if (CheckTitleScreen(levelset_has_changed)) { - /* needed to be able to skip title screen, if no image or message defined */ - InitializeTitleControls(); - - if (num_title_screens > 0) - { - game_status = GAME_MODE_TITLE; + game_status = GAME_MODE_TITLE; - DrawTitleScreen(); + DrawTitleScreen(); - return; - } + return; } + #else + if (setup.show_titlescreen && ((levelset_has_changed && (graphic_info[IMG_TITLESCREEN_1].bitmap != NULL || @@ -1114,7 +1171,11 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) static int title_screen_nr = 0; boolean return_to_main_menu = FALSE; boolean use_fading_main_menu = TRUE; +#if 1 + boolean use_cross_fading = FALSE; +#else boolean use_cross_fading = !show_title_initial; /* default */ +#endif struct TitleControlInfo *tci; if (button == MB_MENU_INITIALIZE) @@ -1125,8 +1186,10 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) title_screen_nr = 0; tci = &title_controls[title_screen_nr]; +#if 0 /* determine number of title screens to display (images and messages) */ InitializeTitleControls(); +#endif if (game_status == GAME_MODE_INFO) { @@ -1244,9 +1307,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (return_to_main_menu) { - /* show initial title images and messages only once at program start */ - show_title_initial = FALSE; - RedrawBackground(); SetMouseCursor(CURSOR_DEFAULT); @@ -2782,7 +2842,7 @@ void DrawInfoScreen_Version() const SDL_version *sdl_version_linked; #endif - SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_PROGRAM); + SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_VERSION); FadeOut(REDRAW_FIELD); diff --git a/src/tools.c b/src/tools.c index 2970cfa9..6b1c61cf 100644 --- a/src/tools.c +++ b/src/tools.c @@ -600,6 +600,20 @@ void SetMainBackgroundImageIfDefined(int graphic) SetMainBackgroundBitmap(graphic_info[graphic].bitmap); } +void SetDoorBackgroundImageIfDefined(int graphic) +{ + if (graphic_info[graphic].bitmap) + SetDoorBackgroundBitmap(graphic_info[graphic].bitmap); +} + +void SetWindowBackgroundImage(int graphic) +{ + SetWindowBackgroundBitmap(graphic == IMG_UNDEFINED ? NULL : + graphic_info[graphic].bitmap ? + graphic_info[graphic].bitmap : + graphic_info[IMG_BACKGROUND].bitmap); +} + void SetMainBackgroundImage(int graphic) { SetMainBackgroundBitmap(graphic == IMG_UNDEFINED ? NULL : diff --git a/src/tools.h b/src/tools.h index 0ec63701..8c839520 100644 --- a/src/tools.h +++ b/src/tools.h @@ -82,6 +82,8 @@ void FadeCrossSaveBackbuffer(); void ClearWindow(); void SetWindowBackgroundImageIfDefined(int); void SetMainBackgroundImageIfDefined(int); +void SetDoorBackgroundImageIfDefined(int); +void SetWindowBackgroundImage(int); void SetMainBackgroundImage(int); void SetDoorBackgroundImage(int); void SetPanelBackground(); -- 2.34.1